diff --git a/.circleci/config.yml b/.circleci/config.yml
index 91c7a947a3b..85c49ea90b9 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -2609,6 +2609,7 @@ jobs:
pip install "pytest-mock==3.12.0"
pip install "pytest-asyncio==0.21.1"
pip install "mypy==1.18.2"
+ pip install apscheduler
- run:
name: Build Docker image
command: |
diff --git a/.github/workflows/test-litellm.yml b/.github/workflows/test-litellm.yml
index b7f4a25d593..1d9bd201fa8 100644
--- a/.github/workflows/test-litellm.yml
+++ b/.github/workflows/test-litellm.yml
@@ -33,6 +33,7 @@ jobs:
poetry run pip install "google-genai==1.22.0"
poetry run pip install "google-cloud-aiplatform>=1.38"
poetry run pip install "fastapi-offline==1.7.3"
+ poetry run pip install "python-multipart==0.0.18"
- name: Setup litellm-enterprise as local package
run: |
cd enterprise
@@ -40,4 +41,4 @@ jobs:
cd ..
- name: Run tests
run: |
- poetry run pytest tests/test_litellm --tb=short -vv --maxfail=10 -n 4
+ poetry run pytest tests/test_litellm --tb=short -vv --maxfail=10 -n 4 --durations=50
diff --git a/README.md b/README.md
index 812b20e6986..6dcebfbd3d9 100644
--- a/README.md
+++ b/README.md
@@ -301,53 +301,108 @@ curl 'http://0.0.0.0:4000/key/generate' \
}
```
-## Supported Providers ([Docs](https://docs.litellm.ai/docs/providers))
+## Supported Providers ([Website Supported Models](https://models.litellm.ai/) | [Docs](https://docs.litellm.ai/docs/providers))
-| Provider | [Completion](https://docs.litellm.ai/docs/#basic-usage) | [Streaming](https://docs.litellm.ai/docs/completion/stream#streaming-responses) | [Async Completion](https://docs.litellm.ai/docs/completion/stream#async-completion) | [Async Streaming](https://docs.litellm.ai/docs/completion/stream#async-streaming) | [Async Embedding](https://docs.litellm.ai/docs/embedding/supported_embedding) | [Async Image Generation](https://docs.litellm.ai/docs/image_generation) |
-|-------------------------------------------------------------------------------------|---------------------------------------------------------|---------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------|-------------------------------------------------------------------------------|-------------------------------------------------------------------------|
-| [openai](https://docs.litellm.ai/docs/providers/openai) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
-| [Meta - Llama API](https://docs.litellm.ai/docs/providers/meta_llama) | ✅ | ✅ | ✅ | ✅ | | |
-| [azure](https://docs.litellm.ai/docs/providers/azure) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
-| [AI/ML API](https://docs.litellm.ai/docs/providers/aiml) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
-| [aws - sagemaker](https://docs.litellm.ai/docs/providers/aws_sagemaker) | ✅ | ✅ | ✅ | ✅ | ✅ | |
-| [aws - bedrock](https://docs.litellm.ai/docs/providers/bedrock) | ✅ | ✅ | ✅ | ✅ | ✅ | |
-| [google - vertex_ai](https://docs.litellm.ai/docs/providers/vertex) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
-| [google - palm](https://docs.litellm.ai/docs/providers/palm) | ✅ | ✅ | ✅ | ✅ | | |
-| [google AI Studio - gemini](https://docs.litellm.ai/docs/providers/gemini) | ✅ | ✅ | ✅ | ✅ | | |
-| [mistral ai api](https://docs.litellm.ai/docs/providers/mistral) | ✅ | ✅ | ✅ | ✅ | ✅ | |
-| [cloudflare AI Workers](https://docs.litellm.ai/docs/providers/cloudflare_workers) | ✅ | ✅ | ✅ | ✅ | | |
-| [CompactifAI](https://docs.litellm.ai/docs/providers/compactifai) | ✅ | ✅ | ✅ | ✅ | | |
-| [cohere](https://docs.litellm.ai/docs/providers/cohere) | ✅ | ✅ | ✅ | ✅ | ✅ | |
-| [anthropic](https://docs.litellm.ai/docs/providers/anthropic) | ✅ | ✅ | ✅ | ✅ | | |
-| [empower](https://docs.litellm.ai/docs/providers/empower) | ✅ | ✅ | ✅ | ✅ |
-| [huggingface](https://docs.litellm.ai/docs/providers/huggingface) | ✅ | ✅ | ✅ | ✅ | ✅ | |
-| [replicate](https://docs.litellm.ai/docs/providers/replicate) | ✅ | ✅ | ✅ | ✅ | | |
-| [together_ai](https://docs.litellm.ai/docs/providers/togetherai) | ✅ | ✅ | ✅ | ✅ | | |
-| [openrouter](https://docs.litellm.ai/docs/providers/openrouter) | ✅ | ✅ | ✅ | ✅ | | |
-| [ai21](https://docs.litellm.ai/docs/providers/ai21) | ✅ | ✅ | ✅ | ✅ | | |
-| [baseten](https://docs.litellm.ai/docs/providers/baseten) | ✅ | ✅ | ✅ | ✅ | | |
-| [vllm](https://docs.litellm.ai/docs/providers/vllm) | ✅ | ✅ | ✅ | ✅ | | |
-| [nlp_cloud](https://docs.litellm.ai/docs/providers/nlp_cloud) | ✅ | ✅ | ✅ | ✅ | | |
-| [aleph alpha](https://docs.litellm.ai/docs/providers/aleph_alpha) | ✅ | ✅ | ✅ | ✅ | | |
-| [petals](https://docs.litellm.ai/docs/providers/petals) | ✅ | ✅ | ✅ | ✅ | | |
-| [ollama](https://docs.litellm.ai/docs/providers/ollama) | ✅ | ✅ | ✅ | ✅ | ✅ | |
-| [deepinfra](https://docs.litellm.ai/docs/providers/deepinfra) | ✅ | ✅ | ✅ | ✅ | | |
-| [perplexity-ai](https://docs.litellm.ai/docs/providers/perplexity) | ✅ | ✅ | ✅ | ✅ | | |
-| [Groq AI](https://docs.litellm.ai/docs/providers/groq) | ✅ | ✅ | ✅ | ✅ | | |
-| [Deepseek](https://docs.litellm.ai/docs/providers/deepseek) | ✅ | ✅ | ✅ | ✅ | | |
-| [anyscale](https://docs.litellm.ai/docs/providers/anyscale) | ✅ | ✅ | ✅ | ✅ | | |
-| [IBM - watsonx.ai](https://docs.litellm.ai/docs/providers/watsonx) | ✅ | ✅ | ✅ | ✅ | ✅ | |
-| [voyage ai](https://docs.litellm.ai/docs/providers/voyage) | | | | | ✅ | |
-| [xinference [Xorbits Inference]](https://docs.litellm.ai/docs/providers/xinference) | | | | | ✅ | |
-| [FriendliAI](https://docs.litellm.ai/docs/providers/friendliai) | ✅ | ✅ | ✅ | ✅ | | |
-| [Galadriel](https://docs.litellm.ai/docs/providers/galadriel) | ✅ | ✅ | ✅ | ✅ | | |
-| [GradientAI](https://docs.litellm.ai/docs/providers/gradient_ai) | ✅ | ✅ | | | | |
-| [Novita AI](https://novita.ai/models/llm?utm_source=github_litellm&utm_medium=github_readme&utm_campaign=github_link) | ✅ | ✅ | ✅ | ✅ | | |
-| [Featherless AI](https://docs.litellm.ai/docs/providers/featherless_ai) | ✅ | ✅ | ✅ | ✅ | | |
-| [Nebius AI Studio](https://docs.litellm.ai/docs/providers/nebius) | ✅ | ✅ | ✅ | ✅ | ✅ | |
-| [Heroku](https://docs.litellm.ai/docs/providers/heroku) | ✅ | ✅ | | | | |
-| [OVHCloud AI Endpoints](https://docs.litellm.ai/docs/providers/ovhcloud) | ✅ | ✅ | | | | |
-| [CometAPI](https://docs.litellm.ai/docs/providers/cometapi) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
+| Provider | `/chat/completions` | `/messages` | `/responses` | `/embeddings` | `/image/generations` | `/audio/transcriptions` | `/audio/speech` | `/moderations` | `/batches` | `/rerank` |
+|-------------------------------------------------------------------------------------|---------------------|-------------|--------------|---------------|----------------------|-------------------------|-----------------|----------------|-----------|-----------|
+| [AI/ML API (`aiml`)](https://docs.litellm.ai/docs/providers/aiml) | ✅ | ✅ | ✅ | ✅ | ✅ | | | | | |
+| [AI21 (`ai21`)](https://docs.litellm.ai/docs/providers/ai21) | ✅ | ✅ | ✅ | | | | | | | |
+| [AI21 Chat (`ai21_chat`)](https://docs.litellm.ai/docs/providers/ai21) | ✅ | ✅ | ✅ | | | | | | | |
+| [Aleph Alpha](https://docs.litellm.ai/docs/providers/aleph_alpha) | ✅ | ✅ | ✅ | | | | | | | |
+| [Anthropic (`anthropic`)](https://docs.litellm.ai/docs/providers/anthropic) | ✅ | ✅ | ✅ | | | | | | ✅ | |
+| [Anthropic Text (`anthropic_text`)](https://docs.litellm.ai/docs/providers/anthropic) | ✅ | ✅ | ✅ | | | | | | ✅ | |
+| [Anyscale](https://docs.litellm.ai/docs/providers/anyscale) | ✅ | ✅ | ✅ | | | | | | | |
+| [AssemblyAI (`assemblyai`)](https://docs.litellm.ai/docs/pass_through/assembly_ai) | ✅ | ✅ | ✅ | | | ✅ | | | | |
+| [Auto Router (`auto_router`)](https://docs.litellm.ai/docs/proxy/auto_routing) | ✅ | ✅ | ✅ | | | | | | | |
+| [AWS - Bedrock (`bedrock`)](https://docs.litellm.ai/docs/providers/bedrock) | ✅ | ✅ | ✅ | ✅ | | | | | | ✅ |
+| [AWS - Sagemaker (`sagemaker`)](https://docs.litellm.ai/docs/providers/aws_sagemaker) | ✅ | ✅ | ✅ | ✅ | | | | | | |
+| [Azure (`azure`)](https://docs.litellm.ai/docs/providers/azure) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | |
+| [Azure AI (`azure_ai`)](https://docs.litellm.ai/docs/providers/azure_ai) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | |
+| [Azure Text (`azure_text`)](https://docs.litellm.ai/docs/providers/azure) | ✅ | ✅ | ✅ | | | ✅ | ✅ | ✅ | ✅ | |
+| [Baseten (`baseten`)](https://docs.litellm.ai/docs/providers/baseten) | ✅ | ✅ | ✅ | | | | | | | |
+| [Bytez (`bytez`)](https://docs.litellm.ai/docs/providers/bytez) | ✅ | ✅ | ✅ | | | | | | | |
+| [Cerebras (`cerebras`)](https://docs.litellm.ai/docs/providers/cerebras) | ✅ | ✅ | ✅ | | | | | | | |
+| [Clarifai (`clarifai`)](https://docs.litellm.ai/docs/providers/clarifai) | ✅ | ✅ | ✅ | | | | | | | |
+| [Cloudflare AI Workers (`cloudflare`)](https://docs.litellm.ai/docs/providers/cloudflare_workers) | ✅ | ✅ | ✅ | | | | | | | |
+| [Codestral (`codestral`)](https://docs.litellm.ai/docs/providers/codestral) | ✅ | ✅ | ✅ | | | | | | | |
+| [Cohere (`cohere`)](https://docs.litellm.ai/docs/providers/cohere) | ✅ | ✅ | ✅ | ✅ | | | | | | ✅ |
+| [Cohere Chat (`cohere_chat`)](https://docs.litellm.ai/docs/providers/cohere) | ✅ | ✅ | ✅ | | | | | | | |
+| [CometAPI (`cometapi`)](https://docs.litellm.ai/docs/providers/cometapi) | ✅ | ✅ | ✅ | ✅ | | | | | | |
+| [CompactifAI (`compactifai`)](https://docs.litellm.ai/docs/providers/compactifai) | ✅ | ✅ | ✅ | | | | | | | |
+| [Custom (`custom`)](https://docs.litellm.ai/docs/providers/custom_llm_server) | ✅ | ✅ | ✅ | | | | | | | |
+| [Custom OpenAI (`custom_openai`)](https://docs.litellm.ai/docs/providers/openai_compatible) | ✅ | ✅ | ✅ | | | ✅ | ✅ | ✅ | ✅ | |
+| [Dashscope (`dashscope`)](https://docs.litellm.ai/docs/providers/dashscope) | ✅ | ✅ | ✅ | | | | | | | |
+| [Databricks (`databricks`)](https://docs.litellm.ai/docs/providers/databricks) | ✅ | ✅ | ✅ | | | | | | | |
+| [DataRobot (`datarobot`)](https://docs.litellm.ai/docs/providers/datarobot) | ✅ | ✅ | ✅ | | | | | | | |
+| [Deepgram (`deepgram`)](https://docs.litellm.ai/docs/providers/deepgram) | ✅ | ✅ | ✅ | | | ✅ | | | | |
+| [DeepInfra (`deepinfra`)](https://docs.litellm.ai/docs/providers/deepinfra) | ✅ | ✅ | ✅ | | | | | | | |
+| [Deepseek (`deepseek`)](https://docs.litellm.ai/docs/providers/deepseek) | ✅ | ✅ | ✅ | | | | | | | |
+| [ElevenLabs (`elevenlabs`)](https://docs.litellm.ai/docs/providers/elevenlabs) | ✅ | ✅ | ✅ | | | | ✅ | | | |
+| [Empower (`empower`)](https://docs.litellm.ai/docs/providers/empower) | ✅ | ✅ | ✅ | | | | | | | |
+| [Fal AI (`fal_ai`)](https://docs.litellm.ai/docs/providers/fal_ai) | ✅ | ✅ | ✅ | | ✅ | | | | | |
+| [Featherless AI (`featherless_ai`)](https://docs.litellm.ai/docs/providers/featherless_ai) | ✅ | ✅ | ✅ | | | | | | | |
+| [Fireworks AI (`fireworks_ai`)](https://docs.litellm.ai/docs/providers/fireworks_ai) | ✅ | ✅ | ✅ | | | | | | | |
+| [FriendliAI (`friendliai`)](https://docs.litellm.ai/docs/providers/friendliai) | ✅ | ✅ | ✅ | | | | | | | |
+| [Galadriel (`galadriel`)](https://docs.litellm.ai/docs/providers/galadriel) | ✅ | ✅ | ✅ | | | | | | | |
+| [GitHub Copilot (`github_copilot`)](https://docs.litellm.ai/docs/providers/github_copilot) | ✅ | ✅ | ✅ | | | | | | | |
+| [GitHub Models (`github`)](https://docs.litellm.ai/docs/providers/github) | ✅ | ✅ | ✅ | | | | | | | |
+| [Google - PaLM](https://docs.litellm.ai/docs/providers/palm) | ✅ | ✅ | ✅ | | | | | | | |
+| [Google - Vertex AI (`vertex_ai`)](https://docs.litellm.ai/docs/providers/vertex) | ✅ | ✅ | ✅ | ✅ | ✅ | | | | | |
+| [Google AI Studio - Gemini (`gemini`)](https://docs.litellm.ai/docs/providers/gemini) | ✅ | ✅ | ✅ | | | | | | | |
+| [GradientAI (`gradient_ai`)](https://docs.litellm.ai/docs/providers/gradient_ai) | ✅ | ✅ | ✅ | | | | | | | |
+| [Groq AI (`groq`)](https://docs.litellm.ai/docs/providers/groq) | ✅ | ✅ | ✅ | | | | | | | |
+| [Heroku (`heroku`)](https://docs.litellm.ai/docs/providers/heroku) | ✅ | ✅ | ✅ | | | | | | | |
+| [Hosted VLLM (`hosted_vllm`)](https://docs.litellm.ai/docs/providers/vllm) | ✅ | ✅ | ✅ | | | | | | | |
+| [Huggingface (`huggingface`)](https://docs.litellm.ai/docs/providers/huggingface) | ✅ | ✅ | ✅ | ✅ | | | | | | ✅ |
+| [Hyperbolic (`hyperbolic`)](https://docs.litellm.ai/docs/providers/hyperbolic) | ✅ | ✅ | ✅ | | | | | | | |
+| [IBM - Watsonx.ai (`watsonx`)](https://docs.litellm.ai/docs/providers/watsonx) | ✅ | ✅ | ✅ | ✅ | | | | | | |
+| [Infinity (`infinity`)](https://docs.litellm.ai/docs/providers/infinity) | | | | ✅ | | | | | | |
+| [Jina AI (`jina_ai`)](https://docs.litellm.ai/docs/providers/jina_ai) | | | | ✅ | | | | | | |
+| [Lambda AI (`lambda_ai`)](https://docs.litellm.ai/docs/providers/lambda_ai) | ✅ | ✅ | ✅ | | | | | | | |
+| [Lemonade (`lemonade`)](https://docs.litellm.ai/docs/providers/lemonade) | ✅ | ✅ | ✅ | | | | | | | |
+| [LiteLLM Proxy (`litellm_proxy`)](https://docs.litellm.ai/docs/providers/litellm_proxy) | ✅ | ✅ | ✅ | ✅ | ✅ | | | | | |
+| [Llamafile (`llamafile`)](https://docs.litellm.ai/docs/providers/llamafile) | ✅ | ✅ | ✅ | | | | | | | |
+| [LM Studio (`lm_studio`)](https://docs.litellm.ai/docs/providers/lm_studio) | ✅ | ✅ | ✅ | | | | | | | |
+| [Maritalk (`maritalk`)](https://docs.litellm.ai/docs/providers/maritalk) | ✅ | ✅ | ✅ | | | | | | | |
+| [Meta - Llama API (`meta_llama`)](https://docs.litellm.ai/docs/providers/meta_llama) | ✅ | ✅ | ✅ | | | | | | | |
+| [Mistral AI API (`mistral`)](https://docs.litellm.ai/docs/providers/mistral) | ✅ | ✅ | ✅ | ✅ | | | | | | |
+| [Moonshot (`moonshot`)](https://docs.litellm.ai/docs/providers/moonshot) | ✅ | ✅ | ✅ | | | | | | | |
+| [Morph (`morph`)](https://docs.litellm.ai/docs/providers/morph) | ✅ | ✅ | ✅ | | | | | | | |
+| [Nebius AI Studio (`nebius`)](https://docs.litellm.ai/docs/providers/nebius) | ✅ | ✅ | ✅ | ✅ | | | | | | |
+| [NLP Cloud (`nlp_cloud`)](https://docs.litellm.ai/docs/providers/nlp_cloud) | ✅ | ✅ | ✅ | | | | | | | |
+| [Novita AI (`novita`)](https://novita.ai/models/llm?utm_source=github_litellm&utm_medium=github_readme&utm_campaign=github_link) | ✅ | ✅ | ✅ | | | | | | | |
+| [Nscale (`nscale`)](https://docs.litellm.ai/docs/providers/nscale) | ✅ | ✅ | ✅ | | | | | | | |
+| [Nvidia NIM (`nvidia_nim`)](https://docs.litellm.ai/docs/providers/nvidia_nim) | ✅ | ✅ | ✅ | | | | | | | |
+| [OCI (`oci`)](https://docs.litellm.ai/docs/providers/oci) | ✅ | ✅ | ✅ | | | | | | | |
+| [Ollama (`ollama`)](https://docs.litellm.ai/docs/providers/ollama) | ✅ | ✅ | ✅ | ✅ | | | | | | |
+| [Ollama Chat (`ollama_chat`)](https://docs.litellm.ai/docs/providers/ollama) | ✅ | ✅ | ✅ | | | | | | | |
+| [Oobabooga (`oobabooga`)](https://docs.litellm.ai/docs/providers/openai_compatible) | ✅ | ✅ | ✅ | | | ✅ | ✅ | ✅ | ✅ | |
+| [OpenAI (`openai`)](https://docs.litellm.ai/docs/providers/openai) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | |
+| [OpenAI-like (`openai_like`)](https://docs.litellm.ai/docs/providers/openai_compatible) | | | | ✅ | | | | | | |
+| [OpenRouter (`openrouter`)](https://docs.litellm.ai/docs/providers/openrouter) | ✅ | ✅ | ✅ | | | | | | | |
+| [OVHCloud AI Endpoints (`ovhcloud`)](https://docs.litellm.ai/docs/providers/ovhcloud) | ✅ | ✅ | ✅ | | | | | | | |
+| [Perplexity AI (`perplexity`)](https://docs.litellm.ai/docs/providers/perplexity) | ✅ | ✅ | ✅ | | | | | | | |
+| [Petals (`petals`)](https://docs.litellm.ai/docs/providers/petals) | ✅ | ✅ | ✅ | | | | | | | |
+| [Predibase (`predibase`)](https://docs.litellm.ai/docs/providers/predibase) | ✅ | ✅ | ✅ | | | | | | | |
+| [Recraft (`recraft`)](https://docs.litellm.ai/docs/providers/recraft) | | | | | ✅ | | | | | |
+| [Replicate (`replicate`)](https://docs.litellm.ai/docs/providers/replicate) | ✅ | ✅ | ✅ | | | | | | | |
+| [Sagemaker Chat (`sagemaker_chat`)](https://docs.litellm.ai/docs/providers/aws_sagemaker) | ✅ | ✅ | ✅ | | | | | | | |
+| [Sambanova (`sambanova`)](https://docs.litellm.ai/docs/providers/sambanova) | ✅ | ✅ | ✅ | | | | | | | |
+| [Snowflake (`snowflake`)](https://docs.litellm.ai/docs/providers/snowflake) | ✅ | ✅ | ✅ | | | | | | | |
+| [Text Completion Codestral (`text-completion-codestral`)](https://docs.litellm.ai/docs/providers/codestral) | ✅ | ✅ | ✅ | | | | | | | |
+| [Text Completion OpenAI (`text-completion-openai`)](https://docs.litellm.ai/docs/providers/text_completion_openai) | ✅ | ✅ | ✅ | | | ✅ | ✅ | ✅ | ✅ | |
+| [Together AI (`together_ai`)](https://docs.litellm.ai/docs/providers/togetherai) | ✅ | ✅ | ✅ | | | | | | | |
+| [Topaz (`topaz`)](https://docs.litellm.ai/docs/providers/topaz) | ✅ | ✅ | ✅ | | | | | | | |
+| [Triton (`triton`)](https://docs.litellm.ai/docs/providers/triton-inference-server) | ✅ | ✅ | ✅ | | | | | | | |
+| [V0 (`v0`)](https://docs.litellm.ai/docs/providers/v0) | ✅ | ✅ | ✅ | | | | | | | |
+| [Vercel AI Gateway (`vercel_ai_gateway`)](https://docs.litellm.ai/docs/providers/vercel_ai_gateway) | ✅ | ✅ | ✅ | | | | | | | |
+| [VLLM (`vllm`)](https://docs.litellm.ai/docs/providers/vllm) | ✅ | ✅ | ✅ | | | | | | | |
+| [Volcengine (`volcengine`)](https://docs.litellm.ai/docs/providers/volcano) | ✅ | ✅ | ✅ | | | | | | | |
+| [Voyage AI (`voyage`)](https://docs.litellm.ai/docs/providers/voyage) | | | | ✅ | | | | | | |
+| [WandB Inference (`wandb`)](https://docs.litellm.ai/docs/providers/wandb_inference) | ✅ | ✅ | ✅ | | | | | | | |
+| [Watsonx Text (`watsonx_text`)](https://docs.litellm.ai/docs/providers/watsonx) | ✅ | ✅ | ✅ | | | | | | | |
+| [xAI (`xai`)](https://docs.litellm.ai/docs/providers/xai) | ✅ | ✅ | ✅ | | | | | | | |
+| [Xinference (`xinference`)](https://docs.litellm.ai/docs/providers/xinference) | | | | ✅ | | | | | | |
[**Read the Docs**](https://docs.litellm.ai/docs/)
diff --git a/batch_small.jsonl b/batch_small.jsonl
new file mode 100644
index 00000000000..36792f79dec
--- /dev/null
+++ b/batch_small.jsonl
@@ -0,0 +1,4 @@
+{"custom_id": "request-1", "method": "POST", "url": "/v1/chat/completions", "body": {"model": "gpt-3.5-turbo", "messages": [{"role": "user", "content": "Hello, how are you?"}]}}
+{"custom_id": "request-2", "method": "POST", "url": "/v1/chat/completions", "body": {"model": "gpt-3.5-turbo", "messages": [{"role": "user", "content": "What is the weather today?"}]}}
+{"custom_id": "request-3", "method": "POST", "url": "/v1/chat/completions", "body": {"model": "gpt-3.5-turbo", "messages": [{"role": "user", "content": "Tell me a short joke"}]}}
+
diff --git a/docs/my-website/docs/completion/prompt_caching.md b/docs/my-website/docs/completion/prompt_caching.md
index c8adf4bcccf..630c9e58d24 100644
--- a/docs/my-website/docs/completion/prompt_caching.md
+++ b/docs/my-website/docs/completion/prompt_caching.md
@@ -27,7 +27,7 @@ For the supported providers, LiteLLM follows the OpenAI prompt caching usage obj
}
```
-- `prompt_tokens`: These are the non-cached prompt tokens (same as Anthropic, equivalent to Deepseek `prompt_cache_miss_tokens`).
+- `prompt_tokens`: These are all prompt tokens including cache-miss and cache-hit input tokens.
- `completion_tokens`: These are the output tokens generated by the model.
- `total_tokens`: Sum of prompt_tokens + completion_tokens.
- `prompt_tokens_details`: Object containing cached_tokens.
diff --git a/docs/my-website/docs/files_endpoints.md b/docs/my-website/docs/files_endpoints.md
index 31a02d41a3f..88493fe0bbd 100644
--- a/docs/my-website/docs/files_endpoints.md
+++ b/docs/my-website/docs/files_endpoints.md
@@ -57,7 +57,7 @@ client = OpenAI(
client.files.create(
file=wav_data,
purpose="user_data",
- extra_body={"custom_llm_provider": "openai"}
+ extra_headers={"custom-llm-provider": "openai"}
)
```
@@ -71,7 +71,7 @@ client = OpenAI(
base_url="http://0.0.0.0:4000/v1"
)
-files = client.files.list(extra_body={"custom_llm_provider": "openai"})
+files = client.files.list(extra_headers={"custom-llm-provider": "openai"})
print("files=", files)
```
@@ -85,7 +85,7 @@ client = OpenAI(
base_url="http://0.0.0.0:4000/v1"
)
-file = client.files.retrieve(file_id="file-abc123", extra_body={"custom_llm_provider": "openai"})
+file = client.files.retrieve(file_id="file-abc123", extra_headers={"custom-llm-provider": "openai"})
print("file=", file)
```
@@ -99,7 +99,7 @@ client = OpenAI(
base_url="http://0.0.0.0:4000/v1"
)
-response = client.files.delete(file_id="file-abc123", extra_body={"custom_llm_provider": "openai"})
+response = client.files.delete(file_id="file-abc123", extra_headers={"custom-llm-provider": "openai"})
print("delete response=", response)
```
@@ -113,7 +113,7 @@ client = OpenAI(
base_url="http://0.0.0.0:4000/v1"
)
-content = client.files.content(file_id="file-abc123", extra_body={"custom_llm_provider": "openai"})
+content = client.files.content(file_id="file-abc123", extra_headers={"custom-llm-provider": "openai"})
print("content=", content)
```
diff --git a/docs/my-website/docs/fine_tuning.md b/docs/my-website/docs/fine_tuning.md
index f3f955cb01d..2779a478f8f 100644
--- a/docs/my-website/docs/fine_tuning.md
+++ b/docs/my-website/docs/fine_tuning.md
@@ -62,7 +62,7 @@ client = AsyncOpenAI(api_key="sk-1234", base_url="http://0.0.0.0:4000") # base_u
file_name = "openai_batch_completions.jsonl"
response = await client.files.create(
- extra_body={"custom_llm_provider": "azure"}, # tell litellm proxy which provider to use
+ extra_headers={"custom-llm-provider": "azure"}, # tell litellm proxy which provider to use
file=open(file_name, "rb"),
purpose="fine-tune",
)
@@ -73,8 +73,8 @@ response = await client.files.create(
```shell
curl http://localhost:4000/v1/files \
-H "Authorization: Bearer sk-1234" \
+ -H "custom-llm-provider: azure" \
-F purpose="batch" \
- -F custom_llm_provider="azure"\
-F file="@mydata.jsonl"
```
@@ -92,7 +92,7 @@ curl http://localhost:4000/v1/files \
ft_job = await client.fine_tuning.jobs.create(
model="gpt-35-turbo-1106", # Azure OpenAI model you want to fine-tune
training_file="file-abc123", # file_id from create file response
- extra_body={"custom_llm_provider": "azure"}, # tell litellm proxy which provider to use
+ extra_headers={"custom-llm-provider": "azure"}, # tell litellm proxy which provider to use
)
```
@@ -103,8 +103,8 @@ ft_job = await client.fine_tuning.jobs.create(
curl http://localhost:4000/v1/fine_tuning/jobs \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-1234" \
+ -H "custom-llm-provider: azure" \
-d '{
- "custom_llm_provider": "azure",
"model": "gpt-35-turbo-1106",
"training_file": "file-abc123"
}'
@@ -215,7 +215,7 @@ curl http://localhost:4000/v1/fine_tuning/jobs \
# cancel specific fine tuning job
cancel_ft_job = await client.fine_tuning.jobs.cancel(
fine_tuning_job_id="123", # fine tuning job id
- extra_body={"custom_llm_provider": "azure"}, # tell litellm proxy which provider to use
+ extra_headers={"custom-llm-provider": "azure"}, # tell litellm proxy which provider to use
)
print("response from cancel ft job={}".format(cancel_ft_job))
@@ -228,7 +228,7 @@ print("response from cancel ft job={}".format(cancel_ft_job))
curl -X POST http://localhost:4000/v1/fine_tuning/jobs/ftjob-abc123/cancel \
-H "Authorization: Bearer sk-1234" \
-H "Content-Type: application/json" \
- -d '{"custom_llm_provider": "azure"}'
+ -H "custom-llm-provider: azure"
```
@@ -242,7 +242,7 @@ curl -X POST http://localhost:4000/v1/fine_tuning/jobs/ftjob-abc123/cancel \
```python
list_ft_jobs = await client.fine_tuning.jobs.list(
- extra_query={"custom_llm_provider": "azure"} # tell litellm proxy which provider to use
+ extra_headers={"custom-llm-provider": "azure"} # tell litellm proxy which provider to use
)
print("list of ft jobs={}".format(list_ft_jobs))
@@ -252,9 +252,10 @@ print("list of ft jobs={}".format(list_ft_jobs))
```shell
-curl -X GET 'http://localhost:4000/v1/fine_tuning/jobs?custom_llm_provider=azure' \
+curl -X GET 'http://localhost:4000/v1/fine_tuning/jobs' \
-H "Content-Type: application/json" \
- -H "Authorization: Bearer sk-1234"
+ -H "Authorization: Bearer sk-1234" \
+ -H "custom-llm-provider: azure"
```
diff --git a/docs/my-website/docs/observability/opik_integration.md b/docs/my-website/docs/observability/opik_integration.md
index 1ba1c2de210..d28c46f0b4b 100644
--- a/docs/my-website/docs/observability/opik_integration.md
+++ b/docs/my-website/docs/observability/opik_integration.md
@@ -220,7 +220,41 @@ curl --location --request POST 'http://0.0.0.0:4000/chat/completions' \
}'
```
+## Automatic Metadata from API Keys
+In some cases, the requester may be unable or unaware of how to add Opik metadata to their requests. To ensure all Opik-related actions are properly tracked, LiteLLM Proxy can automatically associate metadata from a user-specific API key when none is provided in the request.
+
+### How It Works
+
+When you create an API key in LiteLLM Proxy, you can attach Opik-specific metadata to the key itself. This metadata will be automatically applied to all requests made with that key, unless the request explicitly provides its own Opik metadata (which takes precedence).
+
+
+### Usage
+
+**Step 1: Save Opik Metadata to the corresponding Api Key**
+Go to 'Virtual Keys', click on your choosen api key and edit 'Settings'.
+Now save the opik metadata as user api key metdata.
+
+
+
+**Step 2: Use the key - Opik metadata is automatically applied**
+
+```bash
+curl -L -X POST 'http://0.0.0.0:4000/v1/chat/completions' \
+-H 'Content-Type: application/json' \
+-H 'Authorization: Bearer sk-key-from-step-1' \
+-d '{
+ "model": "gpt-3.5-turbo",
+ "messages": [
+ {
+ "role": "user",
+ "content": "What's the weather like in Boston today?"
+ }
+ ]
+}'
+```
+
+All requests made with this key will automatically be tracked in the "TestProject" Opik project with the specified tags, without requiring the user to pass metadata in each request.
## Support & Talk to Founders
diff --git a/docs/my-website/docs/providers/azure/azure.md b/docs/my-website/docs/providers/azure/azure.md
index a9c08e2ef24..2f845357328 100644
--- a/docs/my-website/docs/providers/azure/azure.md
+++ b/docs/my-website/docs/providers/azure/azure.md
@@ -834,7 +834,7 @@ client = OpenAI(
batch_input_file = client.files.create(
file=open("mydata.jsonl", "rb"),
purpose="batch",
- extra_body={"custom_llm_provider": "azure"}
+ extra_headers={"custom-llm-provider": "azure"}
)
file_id = batch_input_file.id
```
@@ -870,7 +870,7 @@ batch = client.batches.create( # re use client from above
endpoint="/v1/chat/completions",
completion_window="24h",
metadata={"description": "My batch job"},
- extra_body={"custom_llm_provider": "azure"}
+ extra_headers={"custom-llm-provider": "azure"}
)
```
@@ -898,7 +898,7 @@ curl http://localhost:4000/v1/batches \
```python
retrieved_batch = client.batches.retrieve(
batch.id,
- extra_query={"custom_llm_provider": "azure"}
+ extra_headers={"custom-llm-provider": "azure"}
)
```
@@ -922,7 +922,7 @@ curl http://localhost:4000/v1/batches/batch_abc123 \
```python
cancelled_batch = client.batches.cancel(
batch.id,
- extra_body={"custom_llm_provider": "azure"}
+ extra_headers={"custom-llm-provider": "azure"}
)
```
@@ -945,7 +945,7 @@ curl http://localhost:4000/v1/batches/batch_abc123/cancel \
```python
-client.batches.list(extra_query={"custom_llm_provider": "azure"})
+client.batches.list(extra_headers={"custom-llm-provider": "azure"})
```
diff --git a/docs/my-website/docs/providers/azure/videos.md b/docs/my-website/docs/providers/azure/videos.md
index 22e714a8ecf..d088c63f710 100644
--- a/docs/my-website/docs/providers/azure/videos.md
+++ b/docs/my-website/docs/providers/azure/videos.md
@@ -31,7 +31,7 @@ os.environ["AZURE_OPENAI_API_VERSION"] = "2024-02-15-preview"
### Basic Usage
```python
-from litellm import video_generation, video_status, video_retrieval
+from litellm import video_generation, video_status, video_content
import os
import time
@@ -68,7 +68,7 @@ while True:
time.sleep(10) # Wait 10 seconds before checking again
# Download video content when ready
-video_bytes = video_retrieval(
+video_bytes = video_content(
video_id=response.id,
model="azure/sora-2"
)
@@ -146,10 +146,10 @@ client = openai.OpenAI(
)
# request sent to model set on litellm proxy, `litellm --model`
-response = client.videos.generations.create(
+response = client.videos.create(
model="azure-sora-2",
prompt="A cat playing with a ball of yarn in a sunny garden",
- seconds="8",
+ seconds=8,
size="720x1280"
)
@@ -210,7 +210,7 @@ general_settings:
```python
# Download video content
-video_bytes = video_retrieval(
+video_bytes = video_content(
video_id="video_1234567890",
model="azure/sora-2"
)
@@ -242,7 +242,7 @@ def generate_and_download_video(prompt):
time.sleep(30)
# Step 3: Download video
- video_bytes = litellm.video_retrieval(
+ video_bytes = litellm.video_content(
video_id=video_id,
model="azure/sora-2"
)
diff --git a/docs/my-website/docs/providers/fal_ai.md b/docs/my-website/docs/providers/fal_ai.md
new file mode 100644
index 00000000000..d42182b57a1
--- /dev/null
+++ b/docs/my-website/docs/providers/fal_ai.md
@@ -0,0 +1,310 @@
+import Tabs from '@theme/Tabs';
+import TabItem from '@theme/TabItem';
+
+# Fal AI
+
+Fal AI provides fast, scalable access to state-of-the-art image generation models including FLUX, Stable Diffusion, Imagen, and more.
+
+## Overview
+
+| Property | Details |
+|----------|---------|
+| Description | Fal AI offers optimized infrastructure for running image generation models at scale with low latency. |
+| Provider Route on LiteLLM | `fal_ai/` |
+| Provider Doc | [Fal AI Documentation ↗](https://fal.ai/models) |
+| Supported Operations | [`/images/generations`](#image-generation) |
+
+## Setup
+
+### API Key
+
+```python showLineNumbers
+import os
+
+# Set your Fal AI API key
+os.environ["FAL_AI_API_KEY"] = "your-fal-api-key"
+```
+
+Get your API key from [fal.ai](https://fal.ai/).
+
+## Supported Models
+
+| Model Name | Description | Documentation |
+|------------|-------------|---------------|
+| `fal_ai/fal-ai/flux-pro/v1.1-ultra` | FLUX Pro v1.1 Ultra - High-quality image generation | [Docs ↗](https://fal.ai/models/fal-ai/flux-pro/v1.1-ultra) |
+| `fal_ai/fal-ai/imagen4/preview` | Google's Imagen 4 - Highest quality model | [Docs ↗](https://fal.ai/models/fal-ai/imagen4/preview) |
+| `fal_ai/fal-ai/recraft/v3/text-to-image` | Recraft v3 - Multiple style options | [Docs ↗](https://fal.ai/models/fal-ai/recraft/v3/text-to-image) |
+| `fal_ai/fal-ai/stable-diffusion-v35-medium` | Stable Diffusion v3.5 Medium | [Docs ↗](https://fal.ai/models/fal-ai/stable-diffusion-v35-medium) |
+| `fal_ai/bria/text-to-image/3.2` | Bria 3.2 - Commercial-grade generation | [Docs ↗](https://fal.ai/models/bria/text-to-image/3.2) |
+
+## Image Generation
+
+### Usage - LiteLLM Python SDK
+
+
+
+
+```python showLineNumbers title="Basic Image Generation"
+import litellm
+import os
+
+# Set your API key
+os.environ["FAL_AI_API_KEY"] = "your-fal-api-key"
+
+# Generate an image
+response = litellm.image_generation(
+ model="fal_ai/fal-ai/flux-pro/v1.1-ultra",
+ prompt="A serene mountain landscape at sunset with vibrant colors"
+)
+
+print(response.data[0].url)
+```
+
+
+
+
+
+```python showLineNumbers title="Google Imagen 4 Generation"
+import litellm
+import os
+
+os.environ["FAL_AI_API_KEY"] = "your-fal-api-key"
+
+# Generate with Imagen 4
+response = litellm.image_generation(
+ model="fal_ai/fal-ai/imagen4/preview",
+ prompt="A vintage 1960s kitchen with flour package on countertop",
+ aspect_ratio="16:9",
+ num_images=1
+)
+
+print(response.data[0].url)
+```
+
+
+
+
+
+```python showLineNumbers title="Recraft v3 with Style"
+import litellm
+import os
+
+os.environ["FAL_AI_API_KEY"] = "your-fal-api-key"
+
+# Generate with specific style
+response = litellm.image_generation(
+ model="fal_ai/fal-ai/recraft/v3/text-to-image",
+ prompt="A red panda eating bamboo",
+ style="realistic_image",
+ image_size="landscape_4_3"
+)
+
+print(response.data[0].url)
+```
+
+
+
+
+
+```python showLineNumbers title="Async Image Generation"
+import litellm
+import asyncio
+import os
+
+async def generate_image():
+ os.environ["FAL_AI_API_KEY"] = "your-fal-api-key"
+
+ response = await litellm.aimage_generation(
+ model="fal_ai/fal-ai/stable-diffusion-v35-medium",
+ prompt="A cyberpunk cityscape with neon lights",
+ guidance_scale=7.5,
+ num_inference_steps=50
+ )
+
+ print(response.data[0].url)
+ return response
+
+asyncio.run(generate_image())
+```
+
+
+
+
+
+```python showLineNumbers title="Advanced FLUX Pro Generation"
+import litellm
+import os
+
+os.environ["FAL_AI_API_KEY"] = "your-fal-api-key"
+
+# Generate with advanced parameters
+response = litellm.image_generation(
+ model="fal_ai/fal-ai/flux-pro/v1.1-ultra",
+ prompt="A majestic dragon soaring over mountains",
+ n=2,
+ size="1792x1024", # Maps to aspect_ratio="16:9"
+ seed=42,
+ safety_tolerance="2",
+ enhance_prompt=True
+)
+
+for image in response.data:
+ print(f"Generated image: {image.url}")
+```
+
+
+
+
+### Usage - LiteLLM Proxy Server
+
+#### 1. Configure your config.yaml
+
+```yaml showLineNumbers title="Fal AI Image Generation Configuration"
+model_list:
+ - model_name: flux-ultra
+ litellm_params:
+ model: fal_ai/fal-ai/flux-pro/v1.1-ultra
+ api_key: os.environ/FAL_AI_API_KEY
+ model_info:
+ mode: image_generation
+
+ - model_name: imagen4
+ litellm_params:
+ model: fal_ai/fal-ai/imagen4/preview
+ api_key: os.environ/FAL_AI_API_KEY
+ model_info:
+ mode: image_generation
+
+ - model_name: stable-diffusion
+ litellm_params:
+ model: fal_ai/fal-ai/stable-diffusion-v35-medium
+ api_key: os.environ/FAL_AI_API_KEY
+ model_info:
+ mode: image_generation
+
+general_settings:
+ master_key: sk-1234
+```
+
+#### 2. Start LiteLLM Proxy Server
+
+```bash showLineNumbers title="Start Proxy Server"
+litellm --config /path/to/config.yaml
+
+# RUNNING on http://0.0.0.0:4000
+```
+
+#### 3. Make requests
+
+
+
+
+```python showLineNumbers title="Generate via Proxy - OpenAI SDK"
+from openai import OpenAI
+
+client = OpenAI(
+ base_url="http://localhost:4000",
+ api_key="sk-1234"
+)
+
+response = client.images.generate(
+ model="flux-ultra",
+ prompt="A beautiful sunset over the ocean",
+ n=1,
+ size="1024x1024"
+)
+
+print(response.data[0].url)
+```
+
+
+
+
+
+```python showLineNumbers title="Generate via Proxy - LiteLLM SDK"
+import litellm
+
+response = litellm.image_generation(
+ model="litellm_proxy/imagen4",
+ prompt="A cozy coffee shop interior",
+ api_base="http://localhost:4000",
+ api_key="sk-1234"
+)
+
+print(response.data[0].url)
+```
+
+
+
+
+
+```bash showLineNumbers title="Generate via Proxy - cURL"
+curl --location 'http://localhost:4000/v1/images/generations' \
+--header 'Content-Type: application/json' \
+--header 'Authorization: Bearer sk-1234' \
+--data '{
+ "model": "stable-diffusion",
+ "prompt": "A serene Japanese garden with cherry blossoms",
+ "n": 1,
+ "size": "1024x1024"
+}'
+```
+
+
+
+
+
+
+## Using Model-Specific Parameters
+
+LiteLLM forwards any additional parameters directly to the Fal AI API. You can pass model-specific parameters in your request and they will be sent to Fal AI.
+
+```python showLineNumbers title="Pass Model-Specific Parameters"
+import litellm
+
+# Any parameters beyond the standard ones are forwarded to Fal AI
+response = litellm.image_generation(
+ model="fal_ai/fal-ai/flux-pro/v1.1-ultra",
+ prompt="A beautiful sunset",
+ # Model-specific Fal AI parameters
+ aspect_ratio="16:9",
+ safety_tolerance="2",
+ enhance_prompt=True,
+ seed=42
+)
+```
+
+For the complete list of parameters supported by each model, see:
+- [FLUX Pro v1.1-ultra Parameters ↗](https://fal.ai/models/fal-ai/flux-pro/v1.1-ultra/api)
+- [Imagen 4 Parameters ↗](https://fal.ai/models/fal-ai/imagen4/preview/api)
+- [Recraft v3 Parameters ↗](https://fal.ai/models/fal-ai/recraft/v3/text-to-image/api)
+- [Stable Diffusion v3.5 Parameters ↗](https://fal.ai/models/fal-ai/stable-diffusion-v35-medium/api)
+- [Bria 3.2 Parameters ↗](https://fal.ai/models/bria/text-to-image/3.2/api)
+
+## Supported Parameters
+
+Standard OpenAI-compatible parameters that work across all models:
+
+| Parameter | Type | Description | Default |
+|-----------|------|-------------|---------|
+| `prompt` | string | Text description of desired image | Required |
+| `model` | string | Fal AI model to use | Required |
+| `n` | integer | Number of images to generate (1-4) | `1` |
+| `size` | string | Image dimensions (maps to model-specific format) | Model default |
+| `api_key` | string | Your Fal AI API key | Environment variable |
+
+## Getting Started
+
+1. Sign up at [fal.ai](https://fal.ai/)
+2. Get your API key from your account settings
+3. Set `FAL_AI_API_KEY` environment variable
+4. Choose a model from the [Fal AI model gallery](https://fal.ai/models)
+5. Start generating images with LiteLLM
+
+## Additional Resources
+
+- [Fal AI Documentation](https://fal.ai/docs)
+- [Model Gallery](https://fal.ai/models)
+- [API Reference](https://fal.ai/docs/api-reference)
+- [Pricing](https://fal.ai/pricing)
+
diff --git a/docs/my-website/docs/providers/github.md b/docs/my-website/docs/providers/github.md
index b9e525ef5c1..51220166140 100644
--- a/docs/my-website/docs/providers/github.md
+++ b/docs/my-website/docs/providers/github.md
@@ -1,7 +1,7 @@
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
-# 🆕 Github
+# Github
https://github.com/marketplace/models
:::tip
diff --git a/docs/my-website/docs/providers/google_ai_studio/files.md b/docs/my-website/docs/providers/google_ai_studio/files.md
index 500f1d57185..ce61ce1a90b 100644
--- a/docs/my-website/docs/providers/google_ai_studio/files.md
+++ b/docs/my-website/docs/providers/google_ai_studio/files.md
@@ -39,7 +39,7 @@ encoded_string = base64.b64encode(wav_data).decode('utf-8')
file = create_file(
file=wav_data,
purpose="user_data",
- extra_body={"custom_llm_provider": "gemini"},
+ extra_headers={"custom-llm-provider": "gemini"},
api_key=os.getenv("GEMINI_API_KEY"),
)
diff --git a/docs/my-website/docs/providers/oci.md b/docs/my-website/docs/providers/oci.md
index 1f52fba04f3..cea5d6824a0 100644
--- a/docs/my-website/docs/providers/oci.md
+++ b/docs/my-website/docs/providers/oci.md
@@ -29,17 +29,38 @@ Check the [OCI Models List](https://docs.oracle.com/en-us/iaas/Content/generativ
## Authentication
-LiteLLM uses OCI signing key authentication. Follow the [official Oracle tutorial](https://docs.oracle.com/en-us/iaas/Content/API/Concepts/apisigningkey.htm) to create a signing key and obtain the following parameters:
+LiteLLM supports two authentication methods for OCI:
+
+### Method 1: Manual Credentials
+Provide individual OCI credentials directly to LiteLLM. Follow the [official Oracle tutorial](https://docs.oracle.com/en-us/iaas/Content/API/Concepts/apisigningkey.htm) to create a signing key and obtain the following parameters:
- `user`
- `fingerprint`
- `tenancy`
- `region`
-- `key_file`
+- `key_file` or `key`
+- `compartment_id`
+
+This is the default method for LiteLLM AI Gateway (LLM Proxy) access to OCI GenAI models.
+
+### Method 2: OCI SDK Signer
+Use an OCI SDK `Signer` object for authentication. This method:
+- Leverages the official [OCI SDK for signing](https://docs.oracle.com/en-us/iaas/tools/python/latest/api/signing.html)
+- Supports additional authentication methods (instance principals, workload identity, etc.)
+
+To use this method, install the OCI SDK:
+```bash
+pip install oci
+```
+
+This method is an alternative when using the LiteLLM SDK on Oracle Cloud Infrastructure (instances or Oracle Kubernetes Engine).
## Usage
-Input the parameters obtained from the OCI signing key creation process into the `completion` function.
+
+
+
+Input the parameters obtained from the OCI signing key creation process into the `completion` function:
```python
import os
@@ -64,10 +85,119 @@ response = completion(
print(response)
```
+
+
+
+Use the OCI SDK `Signer` for authentication:
+
+```python
+from litellm import completion
+from oci.signer import Signer
+
+# Create an OCI Signer
+signer = Signer(
+ tenancy="ocid1.tenancy.oc1..",
+ user="ocid1.user.oc1..",
+ fingerprint="xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx",
+ private_key_file_location="~/.oci/key.pem",
+ # Or use private_key_content=""
+)
+
+messages = [{"role": "user", "content": "Hey! how's it going?"}]
+response = completion(
+ model="oci/xai.grok-4",
+ messages=messages,
+ oci_signer=signer,
+ oci_region="us-chicago-1", # Optional, defaults to us-ashburn-1
+ oci_serving_mode="ON_DEMAND", # Optional, default is "ON_DEMAND". Other option is "DEDICATED"
+ oci_compartment_id="",
+)
+print(response)
+```
+
+**Alternative: Use OCI Config File**
+
+The OCI SDK can automatically load credentials from `~/.oci/config`:
+
+```python
+from litellm import completion
+from oci.config import from_file
+from oci.signer import Signer
+
+# Load config from file
+config = from_file("~/.oci/config", "DEFAULT") # "DEFAULT" is the profile name
+signer = Signer(
+ tenancy=config["tenancy"],
+ user=config["user"],
+ fingerprint=config["fingerprint"],
+ private_key_file_location=config["key_file"],
+ pass_phrase=config.get("pass_phrase") # Optional if key is encrypted
+)
+
+messages = [{"role": "user", "content": "Hey! how's it going?"}]
+response = completion(
+ model="oci/xai.grok-4",
+ messages=messages,
+ oci_signer=signer,
+ oci_region=config["region"],
+ oci_compartment_id="",
+)
+print(response)
+```
+
+**Instance Principal Authentication**
+
+For applications running on OCI compute instances:
+
+```python
+from litellm import completion
+from oci.auth.signers import InstancePrincipalsSecurityTokenSigner
+
+oci.auth.signers.get_oke_workload_identity_resource_principal_signer()
+# Use instance principal authentication
+signer = InstancePrincipalsSecurityTokenSigner()
+
+messages = [{"role": "user", "content": "Hey! how's it going?"}]
+response = completion(
+ model="oci/xai.grok-4",
+ messages=messages,
+ oci_signer=signer,
+ oci_region="us-chicago-1",
+ oci_compartment_id="",
+)
+print(response)
+```
+
+**Use workload identity authentication**
+
+For applications running in Oracle Kubernetes Engine (OKE):
+
+```python
+from litellm import completion
+from oci.auth.signers import get_oke_workload_identity_resource_principal_signer
+
+# Use instance principal authentication
+signer = get_oke_workload_identity_resource_principal_signer()
+
+messages = [{"role": "user", "content": "Hey! how's it going?"}]
+response = completion(
+ model="oci/xai.grok-4",
+ messages=messages,
+ oci_signer=signer,
+ oci_region="us-chicago-1",
+ oci_compartment_id="",
+)
+print(response)
+```
+
+
## Usage - Streaming
Just set `stream=True` when calling completion.
+
+
+
```python
import os
from litellm import completion
@@ -93,10 +223,68 @@ for chunk in response:
print(chunk["choices"][0]["delta"]["content"]) # same as openai format
```
+
+
+
+```python
+from litellm import completion
+from oci.signer import Signer
+
+signer = Signer(
+ tenancy="ocid1.tenancy.oc1..",
+ user="ocid1.user.oc1..",
+ fingerprint="xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx",
+ private_key_file_location="~/.oci/key.pem",
+)
+
+messages = [{"role": "user", "content": "Hey! how's it going?"}]
+response = completion(
+ model="oci/xai.grok-4",
+ messages=messages,
+ stream=True,
+ oci_signer=signer,
+ oci_region="us-chicago-1",
+ oci_compartment_id="",
+)
+for chunk in response:
+ print(chunk["choices"][0]["delta"]["content"]) # same as openai format
+```
+
+
+
+
## Usage Examples by Model Type
### Using Cohere Models
+
+
+
+```python
+from litellm import completion
+from oci.signer import Signer
+
+signer = Signer(
+ tenancy="ocid1.tenancy.oc1..",
+ user="ocid1.user.oc1..",
+ fingerprint="xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx",
+ private_key_file_location="~/.oci/key.pem",
+)
+
+messages = [{"role": "user", "content": "Explain quantum computing"}]
+response = completion(
+ model="oci/cohere.command-latest",
+ messages=messages,
+ oci_signer=signer,
+ oci_region="us-chicago-1",
+ oci_compartment_id="",
+)
+print(response)
+```
+
+
+
+
```python
from litellm import completion
@@ -112,4 +300,7 @@ response = completion(
oci_compartment_id=,
)
print(response)
-```
\ No newline at end of file
+```
+
+
+
\ No newline at end of file
diff --git a/docs/my-website/docs/providers/openai/videos.md b/docs/my-website/docs/providers/openai/videos.md
index 4dc18da77bd..473279e60ef 100644
--- a/docs/my-website/docs/providers/openai/videos.md
+++ b/docs/my-website/docs/providers/openai/videos.md
@@ -17,7 +17,7 @@ os.environ["OPENAI_API_KEY"] = "your-api-key"
### Basic Usage
```python
-from litellm import video_generation, video_retrieval
+from litellm import video_generation, video_content
import os
os.environ["OPENAI_API_KEY"] = "your-api-key"
@@ -34,7 +34,7 @@ print(f"Video ID: {response.id}")
print(f"Status: {response.status}")
# Download video content when ready
-video_bytes = video_retrieval(
+video_bytes = video_content(
video_id=response.id,
model="sora-2"
)
@@ -63,7 +63,7 @@ with open("generated_video.mp4", "wb") as f:
```python
# Download video content
-video_bytes = video_retrieval(
+video_bytes = video_content(
video_id="video_1234567890",
model="sora-2"
)
@@ -95,7 +95,7 @@ def generate_and_download_video(prompt):
time.sleep(30)
# Step 3: Download video
- video_bytes = litellm.video_retrieval(
+ video_bytes = litellm.video_content(
video_id=video_id,
model="sora-2"
)
@@ -118,7 +118,7 @@ video_file = generate_and_download_video(
# Video editing with reference image
response = litellm.video_generation(
prompt="Make the cat jump higher",
- input_reference="path/to/image.jpg", # Reference image
+ input_reference=open("path/to/image.jpg", "rb"), # Reference image
model="sora-2",
seconds="8"
)
diff --git a/docs/my-website/docs/providers/openrouter.md b/docs/my-website/docs/providers/openrouter.md
index 58a87f68495..327634909b3 100644
--- a/docs/my-website/docs/providers/openrouter.md
+++ b/docs/my-website/docs/providers/openrouter.md
@@ -9,10 +9,9 @@ LiteLLM supports all the text / chat / vision models from [OpenRouter](https://o
```python
import os
from litellm import completion
+
os.environ["OPENROUTER_API_KEY"] = ""
os.environ["OPENROUTER_API_BASE"] = "" # [OPTIONAL] defaults to https://openrouter.ai/api/v1
-
-
os.environ["OR_SITE_URL"] = "" # [OPTIONAL]
os.environ["OR_APP_NAME"] = "" # [OPTIONAL]
@@ -22,8 +21,32 @@ response = completion(
)
```
-## OpenRouter Completion Models
+## Configuration with Environment Variables
+For production environments, you can dynamically configure the base_url using environment variables:
+
+```python
+import os
+from litellm import completion
+
+# Configure with environment variables
+OPENROUTER_API_KEY = os.getenv("OPENROUTER_API_KEY")
+OPENROUTER_BASE_URL = os.getenv("OPENROUTER_API_BASE", "https://openrouter.ai/api/v1")
+
+# Set environment for LiteLLM
+os.environ["OPENROUTER_API_KEY"] = OPENROUTER_API_KEY
+os.environ["OPENROUTER_API_BASE"] = OPENROUTER_BASE_URL
+
+response = completion(
+ model="openrouter/google/palm-2-chat-bison",
+ messages=messages,
+ base_url=OPENROUTER_BASE_URL # Explicitly pass base_url for clarity
+)
+```
+
+This approach provides better flexibility for managing configurations across different environments (dev, staging, production) and makes it easier to switch between self-hosted and cloud endpoints.
+
+## OpenRouter Completion Models
🚨 LiteLLM supports ALL OpenRouter models, send `model=openrouter/` to send it to open router. See all openrouter models [here](https://openrouter.ai/models)
| Model Name | Function Call |
@@ -40,12 +63,12 @@ response = completion(
| openrouter/meta-llama/llama-2-70b-chat | `completion('openrouter/meta-llama/llama-2-70b-chat', messages)` | `os.environ['OR_SITE_URL']`,`os.environ['OR_APP_NAME']`,`os.environ['OPENROUTER_API_KEY']` |
## Passing OpenRouter Params - transforms, models, route
-
Pass `transforms`, `models`, `route`as arguments to `litellm.completion()`
```python
import os
from litellm import completion
+
os.environ["OPENROUTER_API_KEY"] = ""
response = completion(
@@ -54,4 +77,4 @@ response = completion(
transforms = [""],
route= ""
)
-```
\ No newline at end of file
+```
diff --git a/docs/my-website/docs/providers/vertex.md b/docs/my-website/docs/providers/vertex.md
index 6f0210f270b..874b637e4db 100644
--- a/docs/my-website/docs/providers/vertex.md
+++ b/docs/my-website/docs/providers/vertex.md
@@ -2935,7 +2935,7 @@ finetune_settings:
ft_job = await client.fine_tuning.jobs.create(
model="gemini-1.0-pro-002", # Vertex model you want to fine-tune
training_file="gs://cloud-samples-data/ai-platform/generative_ai/sft_train_data.jsonl", # file_id from create file response
- extra_body={"custom_llm_provider": "vertex_ai"}, # tell litellm proxy which provider to use
+ extra_headers={"custom-llm-provider": "vertex_ai"}, # tell litellm proxy which provider to use
)
```
@@ -2946,8 +2946,8 @@ ft_job = await client.fine_tuning.jobs.create(
curl http://localhost:4000/v1/fine_tuning/jobs \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-1234" \
+ -H "custom-llm-provider: vertex_ai" \
-d '{
- "custom_llm_provider": "vertex_ai",
"model": "gemini-1.0-pro-002",
"training_file": "gs://cloud-samples-data/ai-platform/generative_ai/sft_train_data.jsonl"
}'
@@ -2975,9 +2975,7 @@ ft_job = client.fine_tuning.jobs.create(
"learning_rate_multiplier": 0.1, # learning_rate_multiplier on Vertex
"adapter_size": "ADAPTER_SIZE_ONE" # type: ignore, vertex specific hyperparameter
},
- extra_body={
- "custom_llm_provider": "vertex_ai",
- },
+ extra_headers={"custom-llm-provider": "vertex_ai"},
)
```
@@ -2988,8 +2986,8 @@ ft_job = client.fine_tuning.jobs.create(
curl http://localhost:4000/v1/fine_tuning/jobs \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-1234" \
+ -H "custom-llm-provider: vertex_ai" \
-d '{
- "custom_llm_provider": "vertex_ai",
"model": "gemini-1.0-pro-002",
"training_file": "gs://cloud-samples-data/ai-platform/generative_ai/sft_train_data.jsonl",
"hyperparameters": {
diff --git a/docs/my-website/docs/providers/vertex_batch.md b/docs/my-website/docs/providers/vertex_batch.md
index 730f31be87d..01052ba32e3 100644
--- a/docs/my-website/docs/providers/vertex_batch.md
+++ b/docs/my-website/docs/providers/vertex_batch.md
@@ -50,7 +50,7 @@ oai_client = OpenAI(
file_obj = oai_client.files.create(
file=open("batch_requests.jsonl", "rb"),
purpose="batch",
- extra_body={"custom_llm_provider": "vertex_ai"}
+ extra_headers={"custom-llm-provider": "vertex_ai"}
)
print(f"File uploaded with ID: {file_obj.id}")
@@ -63,9 +63,9 @@ print(f"File uploaded with ID: {file_obj.id}")
curl --request POST \
--url http://localhost:4000/v1/files \
--header 'Content-Type: multipart/form-data' \
+ --header 'custom-llm-provider: vertex_ai' \
--form purpose=batch \
- --form file=@batch_requests.jsonl \
- --form custom_llm_provider=vertex_ai
+ --form file=@batch_requests.jsonl
```
@@ -100,7 +100,7 @@ create_batch_response = oai_client.batches.create(
completion_window="24h",
endpoint="/v1/chat/completions",
input_file_id=batch_input_file_id, # e.g. "gs://my-batch-bucket/litellm-vertex-files/publishers/google/models/gemini-2.5-flash-lite/abc123-def4-5678-9012-34567890abcd"
- extra_body={"custom_llm_provider": "vertex_ai"}
+ extra_headers={"custom-llm-provider": "vertex_ai"}
)
print(f"Batch created with ID: {create_batch_response.id}")
@@ -113,11 +113,11 @@ print(f"Batch created with ID: {create_batch_response.id}")
curl --request POST \
--url http://localhost:4000/v1/batches \
--header 'Content-Type: application/json' \
+ --header 'custom-llm-provider: vertex_ai' \
--data '{
"input_file_id": "gs://my-batch-bucket/litellm-vertex-files/publishers/google/models/gemini-2.5-flash-lite/abc123-def4-5678-9012-34567890abcd",
"endpoint": "/v1/chat/completions",
- "completion_window": "24h",
- "custom_llm_provider": "vertex_ai"
+ "completion_window": "24h"
}'
```
@@ -162,7 +162,7 @@ Check the status of your batch job. The batch will progress through states: `val
```python showLineNumbers title="retrieve_batch.py"
retrieved_batch = oai_client.batches.retrieve(
batch_id=create_batch_response.id, # Created batch id, e.g. 7814463557919047680
- extra_query={"custom_llm_provider": "vertex_ai"}
+ extra_headers={"custom-llm-provider": "vertex_ai"}
)
print(f"Batch status: {retrieved_batch.status}")
@@ -230,7 +230,7 @@ encoded_file_id = urllib.parse.quote_plus(output_file_id)
# Get file content
file_content = oai_client.files.content(
file_id=encoded_file_id,
- extra_body={"custom_llm_provider": "vertex_ai"}
+ extra_headers={"custom-llm-provider": "vertex_ai"}
)
# Process the results
diff --git a/docs/my-website/docs/proxy/access_control.md b/docs/my-website/docs/proxy/access_control.md
index 47a17496feb..678032be9a2 100644
--- a/docs/my-website/docs/proxy/access_control.md
+++ b/docs/my-website/docs/proxy/access_control.md
@@ -10,8 +10,25 @@ Role-based access control (RBAC) is based on Organizations, Teams and Internal U
- `Organizations` are the top-level entities that contain Teams.
- `Team` - A Team is a collection of multiple `Internal Users`
- `Internal Users` - users that can create keys, make LLM API calls, view usage on LiteLLM. Users can be on multiple teams.
-- `Virtual Keys` - Keys are used for authentication to the LiteLLM API. Keys are tied to a `Internal User` and `Team`
+- `Virtual Keys` - Keys are used for authentication to the LiteLLM API. Each key can optionally be associated with a `user_id`, a `team_id`, or both:
+ - **User-only key**: Has a `user_id` but no `team_id`. Tracked individually, deleted when the user is deleted.
+ - **Team key (Service Account)**: Has a `team_id` but no `user_id`. Shared by the team, not deleted when users are removed. [Learn more about service account keys](https://docs.litellm.ai/docs/proxy/virtual_keys#service-account-keys).
+ - **User + Team key**: Has both `user_id` and `team_id`. Belongs to a specific user within a team context.
+### When to Use Each Key Type
+
+| Key Type | Use Case | Spend Tracking | Lifecycle |
+|----------|----------|----------------|-----------|
+| **User-only** | Personal API keys for individual developers | Tracked to the user | Deleted when user is deleted |
+| **Team (Service Account)** | Production apps, CI/CD pipelines, shared services | Tracked to the team only | Persists even when team members leave |
+| **User + Team** | User working within a team context | Tracked to both user and team | Deleted when user is deleted |
+
+**Example scenarios:**
+- Use **user-only keys** for developers testing locally
+- Use **team service account keys** for your production application that shouldn't break when employees leave
+- Use **user + team keys** when you want individual accountability within a team budget
+
+---
## User Roles
diff --git a/docs/my-website/docs/proxy/config_settings.md b/docs/my-website/docs/proxy/config_settings.md
index 6c4783329bd..003e02d4d5b 100644
--- a/docs/my-website/docs/proxy/config_settings.md
+++ b/docs/my-website/docs/proxy/config_settings.md
@@ -232,7 +232,7 @@ router_settings:
| max_response_size_mb | int | The maximum size for responses in MB. LLM Responses above this size will not be sent. |
| proxy_budget_rescheduler_min_time | int | The minimum time (in seconds) to wait before checking db for budget resets. **Default is 597 seconds** |
| proxy_budget_rescheduler_max_time | int | The maximum time (in seconds) to wait before checking db for budget resets. **Default is 605 seconds** |
-| proxy_batch_write_at | int | Time (in seconds) to wait before batch writing spend logs to the db. **Default is 10 seconds** |
+| proxy_batch_write_at | int | Time (in seconds) to wait before batch writing spend logs to the db. **Default is 30 seconds** |
| proxy_batch_polling_interval | int | Time (in seconds) to wait before polling a batch, to check if it's completed. **Default is 6000 seconds (1 hour)** |
| alerting_args | dict | Args for Slack Alerting [Doc on Slack Alerting](./alerting.md) |
| custom_key_generate | str | Custom function for key generation [Doc on custom key generation](./virtual_keys.md#custom--key-generate) |
@@ -361,6 +361,10 @@ router_settings:
| AIOHTTP_TRUST_ENV | Flag to enable aiohttp trust environment. When this is set to True, aiohttp will respect HTTP(S)_PROXY env vars. **Default is False**
| AIOHTTP_TTL_DNS_CACHE | DNS cache time-to-live for aiohttp in seconds. **Default is 300**
| ALLOWED_EMAIL_DOMAINS | List of email domains allowed for access
+| APSCHEDULER_COALESCE | Whether to combine multiple pending executions of a job into one. **Default is False**
+| APSCHEDULER_MAX_INSTANCES | Maximum number of concurrent instances of each job. **Default is 1**
+| APSCHEDULER_MISFIRE_GRACE_TIME | Grace time in seconds for misfired jobs. **Default is 1**
+| APSCHEDULER_REPLACE_EXISTING | Whether to replace existing jobs with the same ID. **Default is False**
| ARIZE_API_KEY | API key for Arize platform integration
| ARIZE_SPACE_KEY | Space key for Arize platform
| ARGILLA_BATCH_SIZE | Batch size for Argilla logging
@@ -726,7 +730,7 @@ router_settings:
| PROMPTLAYER_API_KEY | API key for PromptLayer integration
| PROXY_ADMIN_ID | Admin identifier for proxy server
| PROXY_BASE_URL | Base URL for proxy service
-| PROXY_BATCH_WRITE_AT | Time in seconds to wait before batch writing spend logs to the database. Default is 10
+| PROXY_BATCH_WRITE_AT | Time in seconds to wait before batch writing spend logs to the database. Default is 30
| PROXY_BATCH_POLLING_INTERVAL | Time in seconds to wait before polling a batch, to check if it's completed. Default is 6000s (1 hour)
| PROXY_BUDGET_RESCHEDULER_MAX_TIME | Maximum time in seconds to wait before checking database for budget resets. Default is 605
| PROXY_BUDGET_RESCHEDULER_MIN_TIME | Minimum time in seconds to wait before checking database for budget resets. Default is 597
diff --git a/docs/my-website/docs/proxy/deploy.md b/docs/my-website/docs/proxy/deploy.md
index 7d2389383d1..45178916008 100644
--- a/docs/my-website/docs/proxy/deploy.md
+++ b/docs/my-website/docs/proxy/deploy.md
@@ -2,7 +2,7 @@ import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import Image from '@theme/IdealImage';
-# Docker, Deployment
+# Docker, Helm, Terraform
You can find the Dockerfile to build litellm proxy [here](https://github.com/BerriAI/litellm/blob/main/Dockerfile)
@@ -195,7 +195,7 @@ docker run \
s/o [Nicholas Cecere](https://www.linkedin.com/in/nicholas-cecere-24243549/) for his LiteLLM User Management Terraform
-👉 [Go here for Terraform](https://github.com/ncecere/terraform-litellm-user-mgmt)
+👉 [Go here for Terraform](https://github.com/BerriAI/terraform-provider-litellm)
### Kubernetes
diff --git a/docs/my-website/docs/proxy/guardrails/grayswan.md b/docs/my-website/docs/proxy/guardrails/grayswan.md
index dbd9258292b..b510c870a1e 100644
--- a/docs/my-website/docs/proxy/guardrails/grayswan.md
+++ b/docs/my-website/docs/proxy/guardrails/grayswan.md
@@ -18,6 +18,7 @@ Cygnal returns a `violation` score between `0` and `1` (higher means more likely
```bash
export GRAYSWAN_API_KEY="your-grayswan-key"
+export GRAYSWAN_API_BASE="https://api.grayswan.ai"
```
### 2. Configure `config.yaml`
@@ -37,6 +38,7 @@ guardrails:
guardrail: grayswan
mode: [pre_call, post_call] # monitor both input and output
api_key: os.environ/GRAYSWAN_API_KEY
+ api_base: os.environ/GRAYSWAN_API_BASE # optional
optional_params:
on_flagged_action: monitor # or "block"
violation_threshold: 0.5 # score >= threshold is flagged
diff --git a/docs/my-website/docs/proxy/guardrails/ibm_guardrails.md b/docs/my-website/docs/proxy/guardrails/ibm_guardrails.md
index 6d1f2eae911..0c13d2dcea9 100644
--- a/docs/my-website/docs/proxy/guardrails/ibm_guardrails.md
+++ b/docs/my-website/docs/proxy/guardrails/ibm_guardrails.md
@@ -3,11 +3,18 @@ import TabItem from '@theme/TabItem';
# IBM Guardrails
-LiteLLM works with IBM's FMS Guardrails for content safety. You can use it to detect jailbreaks, PII, hate speech, and more.
+LiteLLM works with [IBM's FMS Guardrails](https://github.com/foundation-model-stack/fms-guardrails-orchestrator) for content safety. You can use it to detect jailbreaks, PII, hate speech, and more.
## What it does
-IBM Guardrails analyzes text and tells you if it contains things you want to avoid. It gives each detection a score. Higher scores mean it's more confident.
+IBM's FMS Guardrails is a framework for invoking detectors on LLM inputs and outputs. To configure these detectors, you can use e.g. [TrustyAI detectors](https://github.com/trustyai-explainability/guardrails-detectors), an open-source project maintained by the Red Hat's [TrustyAI team](https://github.com/trustyai-explainability) that allows the user to configure detectors that are:
+
+- regex patterns
+- file type validators
+- custom Python functions
+- Hugging Face [AutoModelForSequenceClassification](https://huggingface.co/docs/transformers/en/model_doc/auto#transformers.AutoModelForSequenceClassification), i.e. sequence classification models
+
+Each detector outputs an API response based on the following [openapi schema](https://foundation-model-stack.github.io/fms-guardrails-orchestrator/docs/api/openapi_detector_api.yaml).
You can run these checks:
- Before sending to the LLM (on user input)
@@ -73,7 +80,7 @@ curl -i http://localhost:4000/v1/chat/completions \
- `guardrail` - str - Set to `ibm_guardrails`
- `auth_token` - str - Your IBM Guardrails auth token. Can use `os.environ/IBM_GUARDRAILS_AUTH_TOKEN`
-- `base_url` - str - URL of your IBM Guardrails server
+- `base_url` - str - URL of your IBM Detector or Guardrails server
- `detector_id` - str - Which detector to use (e.g., "jailbreak-detector", "pii-detector")
### Optional params
@@ -97,7 +104,7 @@ IBM Guardrails has two APIs you can use:
### Detector Server (recommended)
-The simpler one. Sends all messages at once.
+[This Detectors API](https://foundation-model-stack.github.io/fms-guardrails-orchestrator/?urls.primaryName=Detector+API#/Text) uses `api/v1/text/contents` endpoint to run a single detector; it can accept multiple text inputs within a request.
```yaml
guardrails:
@@ -113,7 +120,7 @@ guardrails:
### Orchestrator
-If you're using the IBM FMS Guardrails Orchestrator, you can use this.
+If you're using the IBM FMS Guardrails Orchestrator, you can use [FMS Orchestrator API](https://foundation-model-stack.github.io/fms-guardrails-orchestrator/?urls.primaryName=Orchestrator+API), specifically by leveraging the `api/v2/text/detection/content` to potentially run multiple detectors in a single request; however, this endpoint can only accept one text input per request.
```yaml
guardrails:
diff --git a/docs/my-website/docs/proxy/guardrails/panw_prisma_airs.md b/docs/my-website/docs/proxy/guardrails/panw_prisma_airs.md
index 97f3e7efe54..e1d6ddf5928 100644
--- a/docs/my-website/docs/proxy/guardrails/panw_prisma_airs.md
+++ b/docs/my-website/docs/proxy/guardrails/panw_prisma_airs.md
@@ -199,10 +199,44 @@ Expected successful response:
| Parameter | Required | Description | Default |
|-----------|----------|-------------|---------|
| `api_key` | Yes | Your PANW Prisma AIRS API key from Strata Cloud Manager | - |
-| `profile_name` | Yes | Security profile name configured in Strata Cloud Manager | - |
+| `profile_name` | No | Security profile name configured in Strata Cloud Manager. Optional if API key has linked profile | - |
+| `app_name` | No | Application identifier for tracking in Prisma AIRS analytics (will be prefixed with "LiteLLM-") | `LiteLLM` |
| `api_base` | No | Custom API base URL (without /v1/scan/sync/request path) | `https://service.api.aisecurity.paloaltonetworks.com` |
| `mode` | No | When to run the guardrail | `pre_call` |
+## Per-Request Metadata Overrides
+
+You can override guardrail settings on a per-request basis using the `metadata` field:
+
+```json
+{
+ "model": "gpt-4",
+ "messages": [...],
+ "metadata": {
+ "profile_name": "dev-allow-all", // Override profile name
+ "profile_id": "uuid-here", // Override profile ID (takes precedence)
+ "user_ip": "192.168.1.100", // Track user IP
+ "app_name": "MyApp" // Custom app name (becomes "LiteLLM-MyApp")
+ }
+}
+```
+
+**Supported Metadata Fields:**
+
+| Field | Description | Priority |
+|-------|-------------|----------|
+| `profile_name` | PANW AI security profile name | Per-request > config |
+| `profile_id` | PANW AI security profile ID (takes precedence over profile_name) | Per-request only |
+| `user_ip` | User IP address for tracking in Prisma AIRS | Per-request only |
+| `app_name` | Application identifier (prefixed with "LiteLLM-") | Per-request > config > "LiteLLM" |
+
+:::info Profile Resolution
+- If both `profile_id` and `profile_name` are provided, PANW API uses `profile_id` (it takes precedence)
+- If no profile is specified in metadata, uses the config `profile_name`
+- If no profile is specified at all, PANW API will use the profile linked to your API key in Strata Cloud Manager
+- **Note:** If your API key is not linked to a profile, you must provide `profile_name` or `profile_id`
+:::
+
## Environment Variables
```bash
@@ -235,6 +269,43 @@ guardrails:
profile_name: "permissive-policy" # Lower security profile
```
+### Multiple API Keys (Multi-Tenant)
+
+For multi-tenant deployments where different customers need different PANW API keys, create separate guardrail instances:
+
+```yaml
+guardrails:
+ - guardrail_name: "panw-customer-a"
+ litellm_params:
+ guardrail: panw_prisma_airs
+ mode: "pre_call"
+ api_key: os.environ/PANW_CUSTOMER_A_KEY # Linked to Customer A profile in SCM
+
+ - guardrail_name: "panw-customer-b"
+ litellm_params:
+ guardrail: panw_prisma_airs
+ mode: "pre_call"
+ api_key: os.environ/PANW_CUSTOMER_B_KEY # Linked to Customer B profile in SCM
+```
+
+Then route requests to the appropriate guardrail:
+
+```bash
+curl -X POST http://localhost:4000/v1/chat/completions \
+ -H "Content-Type: application/json" \
+ -H "Authorization: Bearer sk-1234" \
+ -d '{
+ "model": "gpt-4",
+ "messages": [{"role": "user", "content": "Hello"}],
+ "guardrails": ["panw-customer-a"]
+ }'
+```
+
+**Use Cases:**
+- **Multi-tenant deployments**: Different customers with different security policies
+- **Environment-specific policies**: Dev/staging/prod with different API keys and profiles
+- **A/B testing**: Compare different security profiles side-by-side
+
### Content Masking
PANW Prisma AIRS can automatically mask sensitive content (PII, credit cards, SSNs, etc.) instead of blocking requests. This allows your application to continue functioning while protecting sensitive data.
diff --git a/docs/my-website/docs/proxy/guardrails/pillar_security.md b/docs/my-website/docs/proxy/guardrails/pillar_security.md
index a5a416839f6..5ab9f9bf8cb 100644
--- a/docs/my-website/docs/proxy/guardrails/pillar_security.md
+++ b/docs/my-website/docs/proxy/guardrails/pillar_security.md
@@ -29,7 +29,7 @@ Use Pillar Security for comprehensive LLM security including:
Add Pillar Security to your `config.yaml`:
-**🌟 Recommended Configuration (Dual Mode):**
+**🌟 Recommended Configuration:**
```yaml
model_list:
- model_name: gpt-4.1-mini
@@ -45,6 +45,8 @@ guardrails:
api_key: os.environ/PILLAR_API_KEY # Your Pillar API key
api_base: os.environ/PILLAR_API_BASE # Pillar API endpoint
on_flagged_action: "monitor" # Log threats but allow requests
+ fallback_on_error: "allow" # Gracefully degrade if Pillar is down (default)
+ timeout: 5.0 # Timeout for Pillar API calls in seconds (default)
persist_session: true # Keep conversations visible in Pillar dashboard
async_mode: false # Request synchronous verdicts
include_scanners: true # Return scanner category breakdown
@@ -207,6 +209,8 @@ You can configure Pillar Security using environment variables:
export PILLAR_API_KEY="your_api_key_here"
export PILLAR_API_BASE="https://api.pillar.security"
export PILLAR_ON_FLAGGED_ACTION="monitor"
+export PILLAR_FALLBACK_ON_ERROR="allow"
+export PILLAR_TIMEOUT="30.0"
```
### Session Tracking
@@ -245,6 +249,66 @@ Logs the violation but allows the request to proceed:
on_flagged_action: "monitor"
```
+### Resilience and Error Handling
+
+#### Graceful Degradation (`fallback_on_error`)
+
+Control what happens when the Pillar API is unavailable (network errors, timeouts, service outages):
+
+```yaml
+fallback_on_error: "allow" # Default - recommended for production resilience
+```
+
+**Available Options:**
+
+- **`allow` (Default - Recommended)**: Proceed without scanning when Pillar is unavailable
+ - **No service interruption** if Pillar is down
+ - **Best for production** where availability is critical
+ - Security scans are skipped during outages (logged as warnings)
+
+ ```yaml
+ guardrails:
+ - guardrail_name: "pillar-resilient"
+ litellm_params:
+ guardrail: pillar
+ fallback_on_error: "allow" # Graceful degradation
+ ```
+
+- **`block`**: Reject all requests when Pillar is unavailable
+ - **Fail-secure approach** - no request proceeds without scanning
+ - **Service interruption** during Pillar outages
+ - Returns 503 Service Unavailable error
+
+ ```yaml
+ guardrails:
+ - guardrail_name: "pillar-fail-secure"
+ litellm_params:
+ guardrail: pillar
+ fallback_on_error: "block" # Fail secure
+ ```
+
+#### Timeout Configuration
+
+Configure how long to wait for Pillar API responses:
+
+**Example Configurations:**
+
+```yaml
+# Production: Default - Fast with graceful degradation
+guardrails:
+ - guardrail_name: "pillar-production"
+ litellm_params:
+ guardrail: pillar
+ timeout: 5.0 # Default - fast failure detection
+ fallback_on_error: "allow" # Graceful degradation (required)
+```
+
+**Environment Variables:**
+```bash
+export PILLAR_FALLBACK_ON_ERROR="allow"
+export PILLAR_TIMEOUT="5.0"
+```
+
## Advanced Configuration
**Quick takeaways**
diff --git a/docs/my-website/docs/proxy/logging.md b/docs/my-website/docs/proxy/logging.md
index 497e6e95a52..baf3d42234d 100644
--- a/docs/my-website/docs/proxy/logging.md
+++ b/docs/my-website/docs/proxy/logging.md
@@ -1415,18 +1415,26 @@ AWS_REGION_NAME = ""
```yaml
model_list:
- - model_name: gpt-4o
+ - model_name: gpt-4o
litellm_params:
model: gpt-4o
+
litellm_settings:
callbacks: ["aws_sqs"]
+
aws_sqs_callback_params:
- sqs_queue_url: https://sqs.us-west-2.amazonaws.com/123456789012/my-queue # AWS SQS Queue URL
- sqs_region_name: us-west-2 # AWS Region Name for SQS
- sqs_aws_access_key_id: os.environ/AWS_ACCESS_KEY_ID # use os.environ/ to pass environment variables. This is AWS Access Key ID for SQS
- sqs_aws_secret_access_key: os.environ/AWS_SECRET_ACCESS_KEY # AWS Secret Access Key for SQS
- sqs_batch_size: 10 # [OPTIONAL] Number of messages to batch before sending (default: 10)
- sqs_flush_interval: 30 # [OPTIONAL] Time in seconds to wait before flushing batch (default: 30)
+ # --- 🧱 Required Parameters ---
+ sqs_queue_url: https://sqs.us-west-2.amazonaws.com/123456789012/my-queue
+ # The AWS SQS Queue URL to which LiteLLM will send log events.
+
+ sqs_region_name: us-west-2
+ # AWS Region for your SQS queue (e.g., us-east-1, eu-central-1, etc.)
+
+ # --- Logging Controls ---
+ sqs_strip_base64_files: true
+ # If true, LiteLLM will remove or redact base64-encoded binary data (e.g., PDFs, images, audio)
+ # from logged messages to avoid large payloads. SQS has a 1 MB payload size limit.
+
```
**Step 3**: Start the proxy, make a test request
diff --git a/docs/my-website/docs/videos.md b/docs/my-website/docs/videos.md
index dd96398f8d6..344a0f852df 100644
--- a/docs/my-website/docs/videos.md
+++ b/docs/my-website/docs/videos.md
@@ -21,7 +21,7 @@ LiteLLM follows the [OpenAI Video Generation API specification](https://platform
### Quick Start
```python
-from litellm import video_generation, video_status, video_retrieval
+from litellm import video_generation, video_status, video_content
import os
import time
@@ -56,7 +56,7 @@ while True:
time.sleep(10) # Wait 10 seconds before checking again
# Download video content when ready
-video_bytes = video_retrieval(
+video_bytes = video_content(
video_id=response.id,
model="openai/sora-2"
)
@@ -69,7 +69,7 @@ with open("generated_video.mp4", "wb") as f:
### Async Usage
```python
-from litellm import avideo_generation, avideo_status, avideo_retrieval
+from litellm import avideo_generation, avideo_status, avideo_content
import os, asyncio
os.environ["OPENAI_API_KEY"] = "sk-.."
@@ -103,7 +103,7 @@ async def test_async_video():
await asyncio.sleep(10) # Wait 10 seconds before checking again
# Download video content when ready
- video_bytes = await avideo_retrieval(
+ video_bytes = await avideo_content(
video_id=response.id,
model="openai/sora-2"
)
@@ -241,57 +241,45 @@ litellm --config /path/to/config.yaml
Test video generation request
```bash
-curl http://0.0.0.0:4000/videos/generations \
- -H "Authorization: Bearer sk-1234" \
- -H "Content-Type: application/json" \
- -d '{
+curl --location 'http://localhost:4000/v1/videos' \
+--header 'Content-Type: application/json' \
+--header 'x-litellm-api-key: sk-1234' \
+--data '{
"model": "sora-2",
- "prompt": "A cat playing with a ball of yarn in a sunny garden",
- "seconds": "8",
- "size": "720x1280"
- }'
+ "prompt": "A beautiful sunset over the ocean"
+}'
```
Test video status request
```bash
-curl http://0.0.0.0:4000/videos/status \
- -H "Authorization: Bearer sk-1234" \
- -H "Content-Type: application/json" \
- -d '{
- "video_id": "video_1234567890",
- "model": "sora-2"
- }'
+curl --location 'http://localhost:4000/v1/videos/video_id' \
+--header 'Accept: application/json' \
+--header 'x-litellm-api-key: sk-1234'
+
```
Test video retrieval request
```bash
-curl http://0.0.0.0:4000/videos/retrieval \
- -H "Authorization: Bearer sk-1234" \
- -H "Content-Type: application/json" \
- -d '{
- "video_id": "video_1234567890",
- "model": "sora-2"
- }'
+curl --location 'http://localhost:4000/v1/videos/video_id/content' \
+--header 'Accept: application/json' \
+--header 'x-litellm-api-key: sk-1234'
+
```
Test video remix request
```bash
-curl http://0.0.0.0:4000/videos/remix \
- -H "Authorization: Bearer sk-1234" \
- -H "Content-Type: multipart/form-data" \
- -F 'model=sora-2' \
- -F 'prompt=Make the cat jump higher' \
- -F 'input_reference=@path/to/image.jpg' \
- -F 'seconds=8'
+curl --location --request POST 'http://localhost:4000/v1/videos/string/remix' \
+--header 'Accept: application/json' \
+--header 'x-litellm-api-key: sk-1234'
```
Test Azure video generation request
```bash
-curl http://0.0.0.0:4000/videos/generations \
+curl http://localhost:4000/v1/videos \
-H "Authorization: Bearer sk-1234" \
-H "Content-Type: application/json" \
-d '{
@@ -302,6 +290,188 @@ curl http://0.0.0.0:4000/videos/generations \
}'
```
+## **Using OpenAI Client with LiteLLM Proxy**
+
+You can use the standard OpenAI Python client to interact with LiteLLM's video endpoints. This provides a familiar interface while leveraging LiteLLM's provider abstraction and proxy features.
+
+### Setup
+
+First, configure your OpenAI client to point to your LiteLLM proxy:
+
+```python
+from openai import OpenAI
+
+# Point the OpenAI client to your LiteLLM proxy
+client = OpenAI(
+ api_key="sk-1234", # Your LiteLLM proxy API key
+ base_url="http://localhost:4000/v1" # Your LiteLLM proxy URL
+)
+```
+
+### Video Generation
+
+Generate a new video using the OpenAI client interface:
+
+```python
+# Basic video generation
+response = client.videos.create(
+ model="sora-2",
+ prompt="A cat playing with a ball of yarn in a sunny garden",
+ seconds=8,
+ size="720x1280"
+)
+
+print(f"Video ID: {response.id}")
+print(f"Status: {response.status}")
+```
+
+### Video Generation with Reference Image
+
+Create a video using a reference image:
+
+```python
+# Video generation with reference image
+response = client.videos.create(
+ model="sora-2",
+ prompt="Add clouds to the video",
+ seconds=4,
+ input_reference=open("/path/to/your/image.jpg", "rb")
+)
+
+print(f"Video ID: {response.id}")
+print(f"Status: {response.status}")
+```
+
+### Video Status Checking
+
+Check the status of a video generation:
+
+```python
+# Check video status
+status_response = client.videos.retrieve(
+ video_id="video_6900378779308191a7359266e59b53fc01cd6bbd27a70763"
+)
+
+print(f"Status: {status_response.status}")
+print(f"Progress: {status_response.progress}%")
+
+# Poll until completion
+import time
+
+while status_response.status not in ["completed", "failed"]:
+ time.sleep(10) # Wait 10 seconds
+ status_response = client.videos.retrieve(
+ video_id="video_6900378779308191a7359266e59b53fc01cd6bbd27a70763"
+ )
+ print(f"Current status: {status_response.status}")
+```
+
+### List Videos
+
+Get a list of your videos:
+
+```python
+# List all videos
+videos = client.videos.list()
+
+for video in videos.data:
+ print(f"Video ID: {video.id}, Status: {video.status}")
+```
+
+### Download Video Content
+
+Download the completed video:
+
+```python
+# Download video content
+response = client.videos.download_content(
+ video_id="video_68fa2938848c8190bb718f977503aba6092ab18d68938fed"
+)
+
+# Save the video to file
+with open("generated_video.mp4", "wb") as f:
+ f.write(response.content)
+
+print("Video downloaded successfully!")
+```
+
+### Video Remix (Editing)
+
+Edit an existing video with new instructions:
+
+```python
+# Remix/edit an existing video
+response = client.videos.remix(
+ video_id="video_68fa2574bdd88190873a8af06a370ff407094ddbc4bbb91b",
+ prompt="Slow the cloud movement",
+ seconds=8
+)
+
+print(f"Remix Video ID: {response.id}")
+print(f"Status: {response.status}")
+```
+
+### Complete Workflow Example
+
+Here's a complete example showing the full video generation workflow:
+
+```python
+from openai import OpenAI
+import time
+
+# Initialize client
+client = OpenAI(
+ api_key="sk-1234",
+ base_url="http://localhost:4000/v1"
+)
+
+# 1. Generate video
+print("Generating video...")
+response = client.videos.create(
+ model="sora-2",
+ prompt="A serene lake with mountains in the background",
+ seconds=8,
+ size="1280x720"
+)
+
+video_id = response.id
+print(f"Video generation started. ID: {video_id}")
+
+# 2. Poll for completion
+print("Waiting for video to complete...")
+while True:
+ status = client.videos.retrieve(video_id=video_id)
+ print(f"Status: {status.status}")
+
+ if status.status == "completed":
+ print("Video generation completed!")
+ break
+ elif status.status == "failed":
+ print("Video generation failed!")
+ break
+
+ time.sleep(10)
+
+# 3. Download video
+if status.status == "completed":
+ print("Downloading video...")
+ video_content = client.videos.download_content(video_id=video_id)
+
+ with open(f"video_{video_id}.mp4", "wb") as f:
+ f.write(video_content.content)
+
+ print("Video saved successfully!")
+
+# 4. Optional: Remix the video
+print("Creating a remix...")
+remix_response = client.videos.remix(
+ video_id=video_id,
+ prompt="Add gentle ripples to the lake surface"
+)
+
+print(f"Remix started. ID: {remix_response.id}")
+```
+
## **Request/Response Format**
:::info
@@ -381,19 +551,21 @@ The response follows OpenAI's video generation format with the following structu
```json
{
- "id": "video_1234567890",
- "object": "video",
- "status": "queued",
- "created_at": 1712697600,
- "model": "sora-2",
- "size": "720x1280",
- "seconds": "8",
- "usage": {
- "prompt_tokens": 0,
- "completion_tokens": 0,
- "total_tokens": 0,
- "duration_seconds": 8.0
- }
+ "id": "video_6900378779308191a7359266e59b53fc01cd6bbd27a70763",
+ "object": "video",
+ "status": "queued",
+ "created_at": 1761621895,
+ "completed_at": null,
+ "expires_at": null,
+ "error": null,
+ "progress": 0,
+ "remixed_from_video_id": null,
+ "seconds": "4",
+ "size": "720x1280",
+ "model": "sora-2",
+ "usage": {
+ "duration_seconds": 4.0
+ }
}
```
diff --git a/docs/my-website/img/opik_key_metadata.png b/docs/my-website/img/opik_key_metadata.png
new file mode 100644
index 00000000000..c810f270dae
Binary files /dev/null and b/docs/my-website/img/opik_key_metadata.png differ
diff --git a/docs/my-website/sidebars.js b/docs/my-website/sidebars.js
index 4e217b939de..3b993e4620c 100644
--- a/docs/my-website/sidebars.js
+++ b/docs/my-website/sidebars.js
@@ -32,6 +32,7 @@ const sidebars = {
items: [
"proxy/guardrails/quick_start",
...[
+ "adding_provider/adding_guardrail_support",
"proxy/guardrails/aim_security",
"proxy/guardrails/aporia_api",
"proxy/guardrails/azure_content_guardrail",
@@ -431,6 +432,7 @@ const sidebars = {
"providers/openai",
"providers/openai/responses_api",
"providers/openai/text_to_speech",
+ "providers/openai/videos",
]
},
"providers/text_completion_openai",
@@ -443,6 +445,7 @@ const sidebars = {
"providers/azure/azure_responses",
"providers/azure/azure_embedding",
"providers/azure/azure_speech",
+ "providers/azure/videos",
]
},
{
@@ -534,6 +537,7 @@ const sidebars = {
"providers/groq",
"providers/deepseek",
"providers/elevenlabs",
+ "providers/fal_ai",
"providers/fireworks_ai",
"providers/clarifai",
"providers/compactifai",
@@ -713,7 +717,7 @@ const sidebars = {
items: [
"adding_provider/directory_structure",
"adding_provider/new_rerank_provider",
- "adding_provider/adding_guardrail_support"],
+ ]
},
"extras/contributing",
"contributing",
diff --git a/enterprise/litellm_enterprise/integrations/prometheus.py b/enterprise/litellm_enterprise/integrations/prometheus.py
index 49037678df9..d3b599edff9 100644
--- a/enterprise/litellm_enterprise/integrations/prometheus.py
+++ b/enterprise/litellm_enterprise/integrations/prometheus.py
@@ -2189,6 +2189,9 @@ class PrometheusLogger(CustomLogger):
prometheus_logger.initialize_remaining_budget_metrics,
"interval",
minutes=PROMETHEUS_BUDGET_METRICS_REFRESH_INTERVAL_MINUTES,
+ # REMOVED jitter parameter - major cause of memory leak
+ id="prometheus_budget_metrics_job",
+ replace_existing=True,
)
@staticmethod
diff --git a/enterprise/litellm_enterprise/proxy/guardrails/endpoints.py b/enterprise/litellm_enterprise/proxy/guardrails/endpoints.py
deleted file mode 100644
index 8b42b2549cd..00000000000
--- a/enterprise/litellm_enterprise/proxy/guardrails/endpoints.py
+++ /dev/null
@@ -1,43 +0,0 @@
-"""
-Enterprise Guardrail Routes on LiteLLM Proxy
-
-To see all free guardrails see litellm/proxy/guardrails/*
-
-
-Exposed Routes:
-- /mask_pii
-"""
-from typing import Optional
-
-from fastapi import APIRouter, Depends
-
-from litellm.integrations.custom_guardrail import CustomGuardrail
-from litellm.proxy._types import UserAPIKeyAuth
-from litellm.proxy.auth.user_api_key_auth import user_api_key_auth
-from litellm.proxy.guardrails.guardrail_endpoints import GUARDRAIL_REGISTRY
-from litellm.types.guardrails import ApplyGuardrailRequest, ApplyGuardrailResponse
-
-router = APIRouter(tags=["guardrails"], prefix="/guardrails")
-
-
-@router.post("/apply_guardrail", response_model=ApplyGuardrailResponse)
-async def apply_guardrail(
- request: ApplyGuardrailRequest,
- user_api_key_dict: UserAPIKeyAuth = Depends(user_api_key_auth),
-):
- """
- Mask PII from a given text, requires a guardrail to be added to litellm.
- """
- active_guardrail: Optional[
- CustomGuardrail
- ] = GUARDRAIL_REGISTRY.get_initialized_guardrail_callback(
- guardrail_name=request.guardrail_name
- )
- if active_guardrail is None:
- raise Exception(f"Guardrail {request.guardrail_name} not found")
-
- response_text = await active_guardrail.apply_guardrail(
- text=request.text, language=request.language, entities=request.entities
- )
-
- return ApplyGuardrailResponse(response_text=response_text)
diff --git a/litellm-js/spend-logs/package-lock.json b/litellm-js/spend-logs/package-lock.json
index 95f8acdec3a..b59d9f2d2a3 100644
--- a/litellm-js/spend-logs/package-lock.json
+++ b/litellm-js/spend-logs/package-lock.json
@@ -6,7 +6,7 @@
"": {
"dependencies": {
"@hono/node-server": "^1.10.1",
- "hono": "^4.9.7"
+ "hono": "^4.10.3"
},
"devDependencies": {
"@types/node": "^20.11.17",
@@ -463,9 +463,9 @@
}
},
"node_modules/hono": {
- "version": "4.9.7",
- "resolved": "https://registry.npmjs.org/hono/-/hono-4.9.7.tgz",
- "integrity": "sha512-t4Te6ERzIaC48W3x4hJmBwgNlLhmiEdEE5ViYb02ffw4ignHNHa5IBtPjmbKstmtKa8X6C35iWwK4HaqvrzG9w==",
+ "version": "4.10.3",
+ "resolved": "https://registry.npmjs.org/hono/-/hono-4.10.3.tgz",
+ "integrity": "sha512-2LOYWUbnhdxdL8MNbNg9XZig6k+cZXm5IjHn2Aviv7honhBMOHb+jxrKIeJRZJRmn+htUCKhaicxwXuUDlchRA==",
"license": "MIT",
"engines": {
"node": ">=16.9.0"
diff --git a/litellm-js/spend-logs/package.json b/litellm-js/spend-logs/package.json
index 5370f7a0eca..d21a8acef23 100644
--- a/litellm-js/spend-logs/package.json
+++ b/litellm-js/spend-logs/package.json
@@ -4,7 +4,7 @@
},
"dependencies": {
"@hono/node-server": "^1.10.1",
- "hono": "^4.9.7"
+ "hono": "^4.10.3"
},
"devDependencies": {
"@types/node": "^20.11.17",
diff --git a/litellm-proxy-extras/litellm_proxy_extras/schema.prisma b/litellm-proxy-extras/litellm_proxy_extras/schema.prisma
index 9cb9edc9268..ce2fc2e4753 100644
--- a/litellm-proxy-extras/litellm_proxy_extras/schema.prisma
+++ b/litellm-proxy-extras/litellm_proxy_extras/schema.prisma
@@ -580,4 +580,12 @@ model LiteLLM_SearchToolsTable {
search_tool_info Json?
created_at DateTime @default(now())
updated_at DateTime @updatedAt
+}
+
+// SSO configuration table
+model LiteLLM_SSOConfig {
+ id String @id @default("sso_config")
+ sso_settings Json
+ created_at DateTime @default(now())
+ updated_at DateTime @updatedAt
}
\ No newline at end of file
diff --git a/litellm/__init__.py b/litellm/__init__.py
index 3c5aecb82c2..04463266947 100644
--- a/litellm/__init__.py
+++ b/litellm/__init__.py
@@ -475,6 +475,7 @@ nlp_cloud_models: Set = set()
aleph_alpha_models: Set = set()
bedrock_models: Set = set()
bedrock_converse_models: Set = set(BEDROCK_CONVERSE_MODELS)
+fal_ai_models: Set = set()
fireworks_ai_models: Set = set()
fireworks_ai_embedding_models: Set = set()
deepinfra_models: Set = set()
@@ -663,6 +664,8 @@ def add_known_models():
text_completion_codestral_models.add(key)
elif value.get("litellm_provider") == "xai":
xai_models.add(key)
+ elif value.get("litellm_provider") == "fal_ai":
+ fal_ai_models.add(key)
elif value.get("litellm_provider") == "deepseek":
deepseek_models.add(key)
elif value.get("litellm_provider") == "meta_llama":
@@ -813,6 +816,7 @@ model_list = list(
| gemini_models
| text_completion_codestral_models
| xai_models
+ | fal_ai_models
| deepseek_models
| azure_ai_models
| voyage_models
@@ -895,6 +899,7 @@ models_by_provider: dict = {
"aleph_alpha": aleph_alpha_models,
"text-completion-codestral": text_completion_codestral_models,
"xai": xai_models,
+ "fal_ai": fal_ai_models,
"deepseek": deepseek_models,
"mistral": mistral_chat_models,
"azure_ai": azure_ai_models,
diff --git a/litellm/batches/batch_utils.py b/litellm/batches/batch_utils.py
index 027c0b219c8..8289801ee30 100644
--- a/litellm/batches/batch_utils.py
+++ b/litellm/batches/batch_utils.py
@@ -1,10 +1,15 @@
import json
-from typing import Any, List, Literal, Tuple, Optional
+import time
+from typing import Any, List, Literal, Optional, Tuple
+
+import httpx
import litellm
from litellm._logging import verbose_logger
+from litellm._uuid import uuid
from litellm.types.llms.openai import Batch
-from litellm.types.utils import CallTypes, Usage
+from litellm.types.utils import CallTypes, ModelResponse, Usage
+from litellm.utils import token_counter
async def calculate_batch_cost_and_usage(
@@ -107,6 +112,10 @@ def calculate_vertex_ai_batch_cost_and_usage(
"""
Calculate both cost and usage from Vertex AI batch responses
"""
+ from litellm.litellm_core_utils.litellm_logging import Logging
+ from litellm.llms.vertex_ai.gemini.vertex_and_google_ai_studio_gemini import (
+ VertexGeminiConfig,
+ )
total_cost = 0.0
total_tokens = 0
prompt_tokens = 0
@@ -115,14 +124,7 @@ def calculate_vertex_ai_batch_cost_and_usage(
for response in vertex_ai_batch_responses:
if response.get("status") == "JOB_STATE_SUCCEEDED": # Check if response was successful
# Transform Vertex AI response to OpenAI format if needed
- from litellm.llms.vertex_ai.gemini.vertex_and_google_ai_studio_gemini import VertexGeminiConfig
- from litellm import ModelResponse
- from litellm.litellm_core_utils.litellm_logging import Logging
- from litellm.types.utils import CallTypes
- from litellm._uuid import uuid
- import httpx
- import time
-
+
# Create required arguments for the transformation method
model_response = ModelResponse()
@@ -163,8 +165,9 @@ def calculate_vertex_ai_batch_cost_and_usage(
total_cost += cost
# Extract usage from the transformed response
- if hasattr(openai_format_response, 'usage') and openai_format_response.usage:
- usage = openai_format_response.usage
+ usage_obj = getattr(openai_format_response, 'usage', None)
+ if usage_obj:
+ usage = usage_obj
else:
# Fallback: create usage from response dict
response_dict = openai_format_response.dict() if hasattr(openai_format_response, 'dict') else {}
@@ -278,6 +281,33 @@ def _get_batch_job_total_usage_from_file_content(
completion_tokens=completion_tokens,
)
+def _get_batch_job_input_file_usage(
+ file_content_dictionary: List[dict],
+ custom_llm_provider: Literal["openai", "azure", "vertex_ai"] = "openai",
+ model_name: Optional[str] = None,
+) -> Usage:
+ """
+ Count the number of tokens in the input file
+
+ Used for batch rate limiting to count the number of tokens in the input file
+ """
+ prompt_tokens: int = 0
+ completion_tokens: int = 0
+
+ for _item in file_content_dictionary:
+ body = _item.get("body", {})
+ model = body.get("model", model_name or "")
+ messages = body.get("messages", [])
+
+ if messages:
+ item_tokens = token_counter(model=model, messages=messages)
+ prompt_tokens += item_tokens
+
+ return Usage(
+ total_tokens=prompt_tokens + completion_tokens,
+ prompt_tokens=prompt_tokens,
+ completion_tokens=completion_tokens,
+ )
def _get_batch_job_usage_from_response_body(response_body: dict) -> Usage:
"""
diff --git a/litellm/constants.py b/litellm/constants.py
index db2794a770a..37bf68d5cde 100644
--- a/litellm/constants.py
+++ b/litellm/constants.py
@@ -1050,7 +1050,17 @@ PROXY_BATCH_POLLING_INTERVAL = int(os.getenv("PROXY_BATCH_POLLING_INTERVAL", 360
PROXY_BUDGET_RESCHEDULER_MAX_TIME = int(
os.getenv("PROXY_BUDGET_RESCHEDULER_MAX_TIME", 605)
)
-PROXY_BATCH_WRITE_AT = int(os.getenv("PROXY_BATCH_WRITE_AT", 10)) # in seconds
+# MEMORY LEAK FIX: Increased from 10s to 30s minimum to prevent memory issues with APScheduler
+# Very frequent intervals (<30s) can cause memory leaks in APScheduler's internal functions
+PROXY_BATCH_WRITE_AT = int(os.getenv("PROXY_BATCH_WRITE_AT", 30)) # in seconds, increased from 10
+
+# APScheduler Configuration - MEMORY LEAK FIX
+# These settings prevent memory leaks in APScheduler's normalize() and _apply_jitter() functions
+APSCHEDULER_COALESCE = os.getenv("APSCHEDULER_COALESCE", "True").lower() in ["true", "1"] # collapse many missed runs into one
+APSCHEDULER_MISFIRE_GRACE_TIME = int(os.getenv("APSCHEDULER_MISFIRE_GRACE_TIME", 3600)) # ignore runs older than 1 hour (was 120)
+APSCHEDULER_MAX_INSTANCES = int(os.getenv("APSCHEDULER_MAX_INSTANCES", 1)) # prevent concurrent job instances
+APSCHEDULER_REPLACE_EXISTING = os.getenv("APSCHEDULER_REPLACE_EXISTING", "True").lower() in ["true", "1"] # always replace existing jobs
+
DEFAULT_HEALTH_CHECK_INTERVAL = int(
os.getenv("DEFAULT_HEALTH_CHECK_INTERVAL", 300)
) # 5 minutes
diff --git a/litellm/images/main.py b/litellm/images/main.py
index 63603411fb1..5be5f993814 100644
--- a/litellm/images/main.py
+++ b/litellm/images/main.py
@@ -342,6 +342,7 @@ def image_generation( # noqa: PLR0915
litellm.LlmProviders.RECRAFT,
litellm.LlmProviders.AIML,
litellm.LlmProviders.GEMINI,
+ litellm.LlmProviders.FAL_AI,
):
if image_generation_config is None:
raise ValueError(
diff --git a/litellm/integrations/_types/open_inference.py b/litellm/integrations/_types/open_inference.py
index 65ecadcf370..af2ff2347c8 100644
--- a/litellm/integrations/_types/open_inference.py
+++ b/litellm/integrations/_types/open_inference.py
@@ -387,3 +387,42 @@ class OpenInferenceLLMProviderValues(Enum):
GOOGLE = "google"
AZURE = "azure"
AWS = "aws"
+
+
+class ErrorAttributes:
+ """
+ Attributes for error information in spans.
+
+ These attributes follow OpenTelemetry semantic conventions for exceptions
+ and are used to record error information from StandardLoggingPayloadErrorInformation.
+ """
+
+ ERROR_TYPE = "error.type"
+ """
+ The type/class of the error (e.g., 'ValueError', 'OpenAIError', 'RateLimitError').
+ Corresponds to StandardLoggingPayloadErrorInformation.error_class
+ """
+
+ ERROR_MESSAGE = "error.message"
+ """
+ The error message describing what went wrong.
+ Corresponds to StandardLoggingPayloadErrorInformation.error_message
+ """
+
+ ERROR_CODE = "error.code"
+ """
+ The error code (e.g., HTTP status code like '500', '429', or provider-specific codes).
+ Corresponds to StandardLoggingPayloadErrorInformation.error_code
+ """
+
+ ERROR_STACK_TRACE = "error.stack_trace"
+ """
+ The full stack trace of the error.
+ Corresponds to StandardLoggingPayloadErrorInformation.traceback
+ """
+
+ ERROR_LLM_PROVIDER = "error.llm_provider"
+ """
+ The LLM provider where the error occurred (e.g., 'openai', 'anthropic', 'azure').
+ Corresponds to StandardLoggingPayloadErrorInformation.llm_provider
+ """
diff --git a/litellm/integrations/custom_logger.py b/litellm/integrations/custom_logger.py
index d631c466865..1df16a28177 100644
--- a/litellm/integrations/custom_logger.py
+++ b/litellm/integrations/custom_logger.py
@@ -1,5 +1,6 @@
#### What this does ####
# On success, logs events to Promptlayer
+import re
import traceback
from typing import (
TYPE_CHECKING,
@@ -15,7 +16,9 @@ from typing import (
from pydantic import BaseModel
+from litellm._logging import verbose_logger
from litellm.caching.caching import DualCache
+from litellm.constants import DEFAULT_MAX_RECURSE_DEPTH_SENSITIVE_DATA_MASKER
from litellm.types.integrations.argilla import ArgillaItem
from litellm.types.llms.openai import AllMessageValues, ChatCompletionRequest
from litellm.types.utils import (
@@ -53,6 +56,12 @@ else:
PreRoutingHookResponse = Any
+_BASE64_INLINE_PATTERN = re.compile(
+ r"data:(?:application|image|audio|video)/[a-zA-Z0-9.+-]+;base64,[A-Za-z0-9+/=\s]+",
+ re.MULTILINE,
+)
+
+
class CustomLogger: # https://docs.litellm.ai/docs/observability/custom_callback#callback-class
# Class variables or attributes
def __init__(
@@ -567,3 +576,91 @@ class CustomLogger: # https://docs.litellm.ai/docs/observability/custom_callbac
Get the proxy server request from cold storage using the object key directly.
"""
pass
+
+
+ async def _strip_base64_from_messages(
+ self, payload: "StandardLoggingPayload", max_depth: int = DEFAULT_MAX_RECURSE_DEPTH_SENSITIVE_DATA_MASKER
+ ) -> "StandardLoggingPayload":
+ """
+ Removes or redacts base64-encoded file data (e.g., PDFs, images, audio)
+ from messages and responses before sending to SQS.
+
+ Behavior:
+ • Drop entries with a 'file' key.
+ • Drop entries with type == 'file' or any non-text type.
+ • Keep untyped or text content.
+ • Recursively redact inline base64 blobs in *any* string field, at any depth.
+ """
+ raw_messages: Any = payload.get("messages", [])
+ messages: list[Any] = raw_messages if isinstance(raw_messages, list) else []
+ verbose_logger.debug(f"[CustomLogger] Stripping base64 from {len(messages)} messages")
+
+ if messages:
+ payload["messages"] = self._process_messages(messages=messages, max_depth=max_depth)
+
+ total_items = 0
+ for m in payload.get("messages", []) or []:
+ if isinstance(m, dict):
+ content = m.get("content", [])
+ if isinstance(content, list):
+ total_items += len(content)
+
+ verbose_logger.debug(
+ f"[CustomLogger] Completed base64 strip; retained {total_items} content items"
+ )
+ return payload
+
+
+ def _redact_base64(self, value: Any, depth: int = 0, max_depth: int = DEFAULT_MAX_RECURSE_DEPTH_SENSITIVE_DATA_MASKER) -> Any:
+ """Recursively redact inline base64 from any nested structure with a max recursion depth limit."""
+ if depth > max_depth:
+ verbose_logger.warning(
+ f"[CustomLogger] Max recursion depth {max_depth} reached while redacting base64"
+ )
+ return "[MAX_DEPTH_REACHED]"
+
+ if isinstance(value, str):
+ if _BASE64_INLINE_PATTERN.search(value):
+ verbose_logger.debug(
+ f"[CustomLogger] Redacted inline base64 string: {value[:40]}..."
+ )
+ return _BASE64_INLINE_PATTERN.sub("[BASE64_REDACTED]", value)
+ return value
+
+ if isinstance(value, list):
+ return [self._redact_base64(value=v, depth=depth + 1, max_depth=max_depth) for v in value]
+
+ if isinstance(value, dict):
+ return {k: self._redact_base64(value=v, depth=depth + 1, max_depth=max_depth) for k, v in value.items()}
+
+ return value
+
+ def _should_keep_content(self, content: Any) -> bool:
+ """Return True if this content item should be retained."""
+ if not isinstance(content, dict):
+ return True
+ if "file" in content:
+ return False
+ ctype = content.get("type")
+ return not (isinstance(ctype, str) and ctype != "text")
+
+ def _process_messages(self, messages: list[Any], max_depth: int = DEFAULT_MAX_RECURSE_DEPTH_SENSITIVE_DATA_MASKER) -> List[Dict[str, Any]]:
+ filtered_messages: List[Dict[str, Any]] = []
+ for msg in messages:
+ if not isinstance(msg, dict):
+ continue
+ contents: Any = msg.get("content")
+ if isinstance(contents, list):
+ cleaned: list[Any] = []
+ for c in contents:
+ if self._should_keep_content(content=c):
+ cleaned.append(self._redact_base64(value=c, max_depth=max_depth))
+ msg["content"] = cleaned
+ else:
+ msg["content"] = self._redact_base64(value=contents, max_depth=max_depth)
+
+ for key, val in list(msg.items()):
+ if key != "content":
+ msg[key] = self._redact_base64(value=val, max_depth=max_depth)
+ filtered_messages.append(msg)
+ return filtered_messages
diff --git a/litellm/integrations/gitlab/__init__.py b/litellm/integrations/gitlab/__init__.py
index cd22afc2ba0..c73a23b6874 100644
--- a/litellm/integrations/gitlab/__init__.py
+++ b/litellm/integrations/gitlab/__init__.py
@@ -8,7 +8,7 @@ if TYPE_CHECKING:
from litellm.types.prompts.init_prompts import SupportedPromptIntegrations
from litellm.integrations.custom_prompt_management import CustomPromptManagement
from litellm.types.prompts.init_prompts import PromptSpec, PromptLiteLLMParams
-from .gitlab_prompt_manager import GitLabPromptManager
+from .gitlab_prompt_manager import GitLabPromptManager, GitLabPromptCache
# Global instances
global_gitlab_config: Optional[dict] = None
@@ -16,13 +16,13 @@ global_gitlab_config: Optional[dict] = None
def set_global_gitlab_config(config: dict) -> None:
"""
- Set the global BitBucket configuration for prompt management.
+ Set the global gitlab configuration for prompt management.
Args:
- config: Dictionary containing BitBucket configuration
- - workspace: BitBucket workspace name
+ config: Dictionary containing gitlab configuration
+ - workspace: gitlab workspace name
- repository: Repository name
- - access_token: BitBucket access token
+ - access_token: gitlab access token
- branch: Branch to fetch prompts from (default: main)
"""
import litellm
@@ -34,7 +34,7 @@ def prompt_initializer(
litellm_params: "PromptLiteLLMParams", prompt_spec: "PromptSpec"
) -> "CustomPromptManagement":
"""
- Initialize a prompt from a BitBucket repository.
+ Initialize a prompt from a Gitlab repository.
"""
gitlab_config = getattr(litellm_params, "gitlab_config", None)
prompt_id = getattr(litellm_params, "prompt_id", None)
@@ -42,16 +42,16 @@ def prompt_initializer(
if not gitlab_config:
raise ValueError(
- "bitbucket_config is required for BitBucket prompt integration"
+ "gitlab_config is required for gitlab prompt integration"
)
try:
- bitbucket_prompt_manager = GitLabPromptManager(
+ gitlab_prompt_manager = GitLabPromptManager(
gitlab_config=gitlab_config,
prompt_id=prompt_id,
)
- return bitbucket_prompt_manager
+ return gitlab_prompt_manager
except Exception as e:
raise e
@@ -90,6 +90,7 @@ prompt_initializer_registry = {
# Export public API
__all__ = [
"GitLabPromptManager",
+ "GitLabPromptCache",
"set_global_gitlab_config",
"global_gitlab_config",
]
diff --git a/litellm/integrations/gitlab/gitlab_prompt_manager.py b/litellm/integrations/gitlab/gitlab_prompt_manager.py
index b782f10ccc5..37013273cb0 100644
--- a/litellm/integrations/gitlab/gitlab_prompt_manager.py
+++ b/litellm/integrations/gitlab/gitlab_prompt_manager.py
@@ -12,10 +12,24 @@ from litellm.integrations.prompt_management_base import (
)
from litellm.types.llms.openai import AllMessageValues
from litellm.types.utils import StandardCallbackDynamicParams
-
from litellm.integrations.gitlab.gitlab_client import GitLabClient
+GITLAB_PREFIX = "gitlab::"
+
+def encode_prompt_id(raw_id: str) -> str:
+ """Convert GitLab path IDs like 'invoice/extract' → 'gitlab::invoice::extract'"""
+ if raw_id.startswith(GITLAB_PREFIX):
+ return raw_id # already encoded
+ return f"{GITLAB_PREFIX}{raw_id.replace('/', '::')}"
+
+def decode_prompt_id(encoded_id: str) -> str:
+ """Convert 'gitlab::invoice::extract' → 'invoice/extract'"""
+ if not encoded_id.startswith(GITLAB_PREFIX):
+ return encoded_id
+ return encoded_id[len(GITLAB_PREFIX):].replace("::", "/")
+
+
class GitLabPromptTemplate:
def __init__(
self,
@@ -87,6 +101,7 @@ class GitLabTemplateManager:
def _id_to_repo_path(self, prompt_id: str) -> str:
"""Map a prompt_id to a repo path (respects prompts_path and adds .prompt)."""
+ prompt_id = decode_prompt_id(prompt_id)
if self.prompts_path:
return f"{self.prompts_path}/{prompt_id}.prompt"
return f"{prompt_id}.prompt"
@@ -101,26 +116,27 @@ class GitLabTemplateManager:
path = path[len(self.prompts_path.strip("/")) + 1 :]
if path.endswith(".prompt"):
path = path[: -len(".prompt")]
- return path
+ return encode_prompt_id(path)
# ---------- loading ----------
def _load_prompt_from_gitlab(self, prompt_id: str, *, ref: Optional[str] = None) -> None:
"""Load a specific .prompt file from GitLab (scoped under prompts_path if set)."""
try:
+ # prompt_id = decode_prompt_id(prompt_id)
file_path = self._id_to_repo_path(prompt_id)
prompt_content = self.gitlab_client.get_file_content(file_path, ref=ref)
if prompt_content:
template = self._parse_prompt_file(prompt_content, prompt_id)
self.prompts[prompt_id] = template
except Exception as e:
- raise Exception(f"Failed to load prompt '{prompt_id}' from GitLab: {e}")
+ raise Exception(f"Failed to load prompt '{encode_prompt_id(prompt_id)}' from GitLab: {e}")
def load_all_prompts(self, *, recursive: bool = True) -> List[str]:
"""
Eagerly load all .prompt files from prompts_path. Returns loaded IDs.
"""
- files = self.list_templates(recursive=recursive) # reuse logic
+ files = self.list_templates(recursive=recursive)
loaded: List[str] = []
for pid in files:
if pid not in self.prompts:
@@ -195,9 +211,6 @@ class GitLabTemplateManager:
return self.prompts.get(template_id)
def list_templates(self, *, recursive: bool = True) -> List[str]:
- """
- List available prompt IDs discovered under prompts_path (no extension, relative to prompts_path).
- """
"""
List available prompt IDs under prompts_path (no extension).
Compatible with both list_files signatures:
@@ -248,7 +261,7 @@ class GitLabPromptManager(CustomPromptManagement):
"access_token": "glpat_***",
"tag": "v1.2.3", # optional; takes precedence
"branch": "main", # default fallback
- "prompts_path": "prompts/chat" # <--- NEW
+ "prompts_path": "prompts/chat"
}
"""
@@ -438,9 +451,11 @@ class GitLabPromptManager(CustomPromptManagement):
prompt_version: Optional[int] = None,
) -> PromptManagementClient:
try:
- if prompt_id not in self.prompt_manager.prompts:
+ decoded_id = decode_prompt_id(prompt_id)
+ if decoded_id not in self.prompt_manager.prompts:
git_ref = getattr(dynamic_callback_params, "extra", {}).get("git_ref") if hasattr(dynamic_callback_params, "extra") else None
- self.prompt_manager._load_prompt_from_gitlab(prompt_id, ref=git_ref)
+ self.prompt_manager._load_prompt_from_gitlab(decoded_id, ref=git_ref)
+
rendered_prompt, prompt_metadata = self.get_prompt_template(
prompt_id, prompt_variables
@@ -486,3 +501,148 @@ class GitLabPromptManager(CustomPromptManagement):
prompt_label,
prompt_version,
)
+
+
+class GitLabPromptCache:
+ """
+ Cache all .prompt files from a GitLab repo into memory.
+
+ - Keys are the *repo file paths* (e.g. "prompts/chat/greet/hi.prompt")
+ mapped to JSON-like dicts containing content + metadata.
+ - Also exposes a by-ID view (ID == path relative to prompts_path without ".prompt",
+ e.g. "greet/hi").
+
+ Usage:
+
+ cfg = {
+ "project": "group/subgroup/repo",
+ "access_token": "glpat_***",
+ "prompts_path": "prompts/chat", # optional, can be empty for repo root
+ # "branch": "main", # default is "main"
+ # "tag": "v1.2.3", # takes precedence over branch
+ # "base_url": "https://gitlab.com/api/v4" # default
+ }
+
+ cache = GitLabPromptCache(cfg)
+ cache.load_all() # fetch + parse all .prompt files
+
+ print(cache.list_files()) # repo file paths
+ print(cache.list_ids()) # template IDs relative to prompts_path
+
+ prompt_json = cache.get_by_file("prompts/chat/greet/hi.prompt")
+ prompt_json2 = cache.get_by_id("greet/hi")
+
+ # If GitLab content changes and you want to refresh:
+ cache.reload() # re-scan and refresh all
+ """
+
+ def __init__(
+ self,
+ gitlab_config: Dict[str, Any],
+ *,
+ ref: Optional[str] = None,
+ gitlab_client: Optional[GitLabClient] = None,
+ ) -> None:
+ # Build a PromptManager (which internally builds TemplateManager + Client)
+ self.prompt_manager = GitLabPromptManager(
+ gitlab_config=gitlab_config,
+ prompt_id=None,
+ ref=ref,
+ gitlab_client=gitlab_client,
+ )
+ self.template_manager: GitLabTemplateManager = self.prompt_manager.prompt_manager
+
+ # In-memory stores
+ self._by_file: Dict[str, Dict[str, Any]] = {}
+ self._by_id: Dict[str, Dict[str, Any]] = {}
+
+ # -------------------------
+ # Public API
+ # -------------------------
+
+ def load_all(self, *, recursive: bool = True) -> Dict[str, Dict[str, Any]]:
+ """
+ Scan GitLab for all .prompt files under prompts_path, load and parse each,
+ and return the mapping of repo file path -> JSON-like dict.
+ """
+ ids = self.template_manager.list_templates(recursive=recursive) # IDs relative to prompts_path
+ for pid in ids:
+ # Ensure template is loaded into TemplateManager
+ if pid not in self.template_manager.prompts:
+ self.template_manager._load_prompt_from_gitlab(pid)
+
+ tmpl = self.template_manager.get_template(pid)
+ if tmpl is None:
+ # If something raced/failed, try once more
+ self.template_manager._load_prompt_from_gitlab(pid)
+ tmpl = self.template_manager.get_template(pid)
+ if tmpl is None:
+ continue
+
+ file_path = self.template_manager._id_to_repo_path(pid) # "prompts/chat/..../file.prompt"
+ entry = self._template_to_json(pid, tmpl)
+
+ self._by_file[file_path] = entry
+ # prefixed_id = pid if pid.startswith("gitlab::") else f"gitlab::{pid}"
+ encoded_id = encode_prompt_id(pid)
+ self._by_id[encoded_id] = entry
+ # self._by_id[pid] = entry
+
+ return self._by_id
+
+ def reload(self, *, recursive: bool = True) -> Dict[str, Dict[str, Any]]:
+ """Clear the cache and re-load from GitLab."""
+ self._by_file.clear()
+ self._by_id.clear()
+ return self.load_all(recursive=recursive)
+
+ def list_files(self) -> List[str]:
+ """Return the repo file paths currently cached."""
+ return list(self._by_file.keys())
+
+ def list_ids(self) -> List[str]:
+ """Return the template IDs (relative to prompts_path, without extension) currently cached."""
+ return list(self._by_id.keys())
+
+ def get_by_file(self, file_path: str) -> Optional[Dict[str, Any]]:
+ """Get a cached prompt JSON by repo file path."""
+ return self._by_file.get(file_path)
+
+ def get_by_id(self, prompt_id: str) -> Optional[Dict[str, Any]]:
+ """Get a cached prompt JSON by prompt ID (relative to prompts_path)."""
+ if prompt_id in self._by_id:
+ return self._by_id[prompt_id]
+
+ # Try normalized forms
+ decoded = decode_prompt_id(prompt_id)
+ encoded = encode_prompt_id(decoded)
+
+ return self._by_id.get(encoded) or self._by_id.get(decoded)
+
+ # -------------------------
+ # Internals
+ # -------------------------
+
+ def _template_to_json(self, prompt_id: str, tmpl: GitLabPromptTemplate) -> Dict[str, Any]:
+ """
+ Normalize a GitLabPromptTemplate into a JSON-like dict that is easy to serialize.
+ """
+ # Safer copy of metadata (avoid accidental mutation)
+ md = dict(tmpl.metadata or {})
+
+ # Pull standard fields (also present in metadata sometimes)
+ model = tmpl.model
+ temperature = tmpl.temperature
+ max_tokens = tmpl.max_tokens
+ optional_params = dict(tmpl.optional_params or {})
+
+ return {
+ "id": prompt_id, # e.g. "greet/hi"
+ "path": self.template_manager._id_to_repo_path(prompt_id), # e.g. "prompts/chat/greet/hi.prompt"
+ "content": tmpl.content, # rendered content (without frontmatter)
+ "metadata": md, # parsed frontmatter
+ "model": model,
+ "temperature": temperature,
+ "max_tokens": max_tokens,
+ "optional_params": optional_params,
+ }
\ No newline at end of file
diff --git a/litellm/integrations/langfuse/langfuse_otel.py b/litellm/integrations/langfuse/langfuse_otel.py
index fbe480be95f..43d16b5e4cb 100644
--- a/litellm/integrations/langfuse/langfuse_otel.py
+++ b/litellm/integrations/langfuse/langfuse_otel.py
@@ -48,11 +48,12 @@ class LangfuseOtelLogger(OpenTelemetry):
_utils.set_attributes(span, kwargs, response_obj)
#########################################################
- # Set Langfuse specific attributes eg Langfuse Environment
+ # Set Langfuse specific attributes
#########################################################
LangfuseOtelLogger._set_langfuse_specific_attributes(
span=span,
- kwargs=kwargs
+ kwargs=kwargs,
+ response_obj=response_obj
)
return
@@ -86,7 +87,7 @@ class LangfuseOtelLogger(OpenTelemetry):
return metadata
@staticmethod
- def _set_langfuse_specific_attributes(span: Span, kwargs):
+ def _set_langfuse_specific_attributes(span: Span, kwargs, response_obj):
"""
Sets Langfuse specific metadata attributes onto the OTEL span.
@@ -96,6 +97,7 @@ class LangfuseOtelLogger(OpenTelemetry):
compatibility.
"""
from litellm.integrations.arize._utils import safe_set_attribute
+ from litellm.litellm_core_utils.safe_json_dumps import safe_dumps
# 1) Environment variable override
langfuse_environment = os.environ.get("LANGFUSE_TRACING_ENVIRONMENT")
@@ -141,6 +143,75 @@ class LangfuseOtelLogger(OpenTelemetry):
value = str(value)
safe_set_attribute(span, enum_attr.value, value)
+ # 3) Set observation input/output for better UI display
+ #
+ # These Langfuse-specific attributes provide better UI display,
+ # especially for tool calls and function calling.
+ # Set observation input (messages)
+ messages = kwargs.get("messages")
+ if messages:
+ safe_set_attribute(
+ span,
+ LangfuseSpanAttributes.OBSERVATION_INPUT.value,
+ safe_dumps(messages),
+ )
+
+ # Set observation output (response with tool_calls if present)
+ if response_obj and hasattr(response_obj, "get"):
+ choices = response_obj.get("choices", [])
+ if choices:
+ # Extract the first choice's message
+ first_choice = choices[0]
+ message = first_choice.get("message", {})
+
+ # Check if there are tool_calls
+ tool_calls = message.get("tool_calls")
+ if tool_calls:
+ # Transform tool_calls to Langfuse-expected format
+ transformed_tool_calls = []
+ for tool_call in tool_calls:
+ function = tool_call.get("function", {})
+ arguments_str = function.get("arguments", "{}")
+
+ # Parse arguments from JSON string to object
+ try:
+ arguments_obj = json.loads(arguments_str) if isinstance(arguments_str, str) else arguments_str
+ except json.JSONDecodeError:
+ arguments_obj = {}
+
+ # Create Langfuse-compatible tool call object
+ langfuse_tool_call = {
+ "id": response_obj.get("id", ""),
+ "name": function.get("name", ""),
+ "call_id": tool_call.get("id", ""),
+ "type": "function_call",
+ "arguments": arguments_obj,
+ }
+ transformed_tool_calls.append(langfuse_tool_call)
+
+ # Set the observation output with transformed tool_calls
+ safe_set_attribute(
+ span,
+ LangfuseSpanAttributes.OBSERVATION_OUTPUT.value,
+ safe_dumps(transformed_tool_calls),
+ )
+ else:
+ # No tool_calls, use regular content-based output
+ output_data = {}
+
+ if message.get("role"):
+ output_data["role"] = message.get("role")
+
+ if message.get("content") is not None:
+ output_data["content"] = message.get("content")
+
+ if output_data:
+ safe_set_attribute(
+ span,
+ LangfuseSpanAttributes.OBSERVATION_OUTPUT.value,
+ safe_dumps(output_data),
+ )
+
@staticmethod
def _get_langfuse_otel_host() -> Optional[str]:
"""
diff --git a/litellm/integrations/opentelemetry.py b/litellm/integrations/opentelemetry.py
index 11f2c6b2618..9315384ad96 100644
--- a/litellm/integrations/opentelemetry.py
+++ b/litellm/integrations/opentelemetry.py
@@ -841,6 +841,10 @@ class OpenTelemetry(CustomLogger):
)
span.set_status(Status(StatusCode.ERROR))
self.set_attributes(span, kwargs, response_obj)
+
+ # Record exception information using OTEL standard method
+ self._record_exception_on_span(span=span, kwargs=kwargs)
+
span.end(end_time=self._to_ns(end_time))
# Create span for guardrail information
@@ -849,6 +853,87 @@ class OpenTelemetry(CustomLogger):
if parent_otel_span is not None:
parent_otel_span.end(end_time=self._to_ns(datetime.now()))
+ def _record_exception_on_span(self, span: Span, kwargs: dict):
+ """
+ Record exception information on the span using OTEL standard methods.
+
+ This extracts error information from StandardLoggingPayload and:
+ 1. Uses span.record_exception() for the actual exception object (OTEL standard)
+ 2. Sets structured error attributes from StandardLoggingPayloadErrorInformation
+ """
+ try:
+ from litellm.integrations._types.open_inference import ErrorAttributes
+
+ # Get the exception object if available
+ exception = kwargs.get("exception")
+
+ # Record the exception using OTEL's standard method
+ if exception is not None:
+ span.record_exception(exception)
+
+ # Get StandardLoggingPayload for structured error information
+ standard_logging_payload: Optional[StandardLoggingPayload] = kwargs.get(
+ "standard_logging_object"
+ )
+
+ if standard_logging_payload is None:
+ return
+
+ # Extract error_information from StandardLoggingPayload
+ error_information = standard_logging_payload.get("error_information")
+
+ if error_information is None:
+ # Fallback to error_str if error_information is not available
+ error_str = standard_logging_payload.get("error_str")
+ if error_str:
+ self.safe_set_attribute(
+ span=span,
+ key=ErrorAttributes.ERROR_MESSAGE,
+ value=error_str,
+ )
+ return
+
+ # Set structured error attributes from StandardLoggingPayloadErrorInformation
+ if error_information.get("error_code"):
+ self.safe_set_attribute(
+ span=span,
+ key=ErrorAttributes.ERROR_CODE,
+ value=error_information["error_code"],
+ )
+
+ if error_information.get("error_class"):
+ self.safe_set_attribute(
+ span=span,
+ key=ErrorAttributes.ERROR_TYPE,
+ value=error_information["error_class"],
+ )
+
+ if error_information.get("error_message"):
+ self.safe_set_attribute(
+ span=span,
+ key=ErrorAttributes.ERROR_MESSAGE,
+ value=error_information["error_message"],
+ )
+
+ if error_information.get("llm_provider"):
+ self.safe_set_attribute(
+ span=span,
+ key=ErrorAttributes.ERROR_LLM_PROVIDER,
+ value=error_information["llm_provider"],
+ )
+
+ if error_information.get("traceback"):
+ self.safe_set_attribute(
+ span=span,
+ key=ErrorAttributes.ERROR_STACK_TRACE,
+ value=error_information["traceback"],
+ )
+
+ except Exception as e:
+ verbose_logger.exception(
+ "OpenTelemetry: Error recording exception on span: %s", str(e)
+ )
+
def set_tools_attributes(self, span: Span, tools):
import json
diff --git a/litellm/integrations/opik/opik.py b/litellm/integrations/opik/opik.py
index 9fa3482f663..c28aa14a11e 100644
--- a/litellm/integrations/opik/opik.py
+++ b/litellm/integrations/opik/opik.py
@@ -204,6 +204,13 @@ class OpikLogger(CustomBatchLogger):
# Update litellm_opik_metadata with opik metadata from requester
standard_logging_metadata = standard_logging_object.get("metadata", {}) or {}
requester_metadata = standard_logging_metadata.get("requester_metadata", {}) or {}
+
+ # If requester_metadata is empty, try to get it from user_api_key_auth_metadata saved in api key
+ if not requester_metadata:
+ requester_metadata = standard_logging_metadata.get(
+ "user_api_key_auth_metadata", {}
+ ) or {}
+
requester_opik_metadata = requester_metadata.get("opik", {}) or {}
litellm_opik_metadata.update(requester_opik_metadata)
diff --git a/litellm/integrations/sqs.py b/litellm/integrations/sqs.py
index ad4df97f98e..545aebbec6d 100644
--- a/litellm/integrations/sqs.py
+++ b/litellm/integrations/sqs.py
@@ -9,6 +9,7 @@ from __future__ import annotations
import asyncio
import base64
import json
+import re
import traceback
from typing import List, Optional
@@ -30,6 +31,11 @@ from litellm.types.utils import StandardLoggingPayload
from .custom_batch_logger import CustomBatchLogger
+_BASE64_INLINE_PATTERN = re.compile(
+ r"data:(?:application|image|audio|video)/[a-zA-Z0-9.+-]+;base64,[A-Za-z0-9+/=\s]+",
+ re.MULTILINE,
+)
+
class SQSLogger(CustomBatchLogger, BaseAWSLLM):
"""Batching logger that writes logs to an AWS SQS queue, optionally encrypting the payload."""
@@ -54,6 +60,7 @@ class SQSLogger(CustomBatchLogger, BaseAWSLLM):
sqs_flush_interval: Optional[int] = DEFAULT_SQS_FLUSH_INTERVAL_SECONDS,
sqs_batch_size: Optional[int] = DEFAULT_SQS_BATCH_SIZE,
sqs_config=None,
+ sqs_strip_base64_files: bool = False,
# --- 🔐 Application-level encryption params ---
sqs_aws_use_application_level_encryption: bool = False,
sqs_app_encryption_key_b64: Optional[str] = None,
@@ -84,6 +91,7 @@ class SQSLogger(CustomBatchLogger, BaseAWSLLM):
sqs_aws_role_name=sqs_aws_role_name,
sqs_aws_web_identity_token=sqs_aws_web_identity_token,
sqs_aws_sts_endpoint=sqs_aws_sts_endpoint,
+ sqs_strip_base64_files=sqs_strip_base64_files,
sqs_aws_use_application_level_encryption=sqs_aws_use_application_level_encryption,
sqs_app_encryption_key_b64=sqs_app_encryption_key_b64,
sqs_app_encryption_aad=sqs_app_encryption_aad,
@@ -113,25 +121,26 @@ class SQSLogger(CustomBatchLogger, BaseAWSLLM):
raise e
def _init_sqs_params(
- self,
- sqs_queue_url: Optional[str] = None,
- sqs_region_name: Optional[str] = None,
- sqs_api_version: Optional[str] = None,
- sqs_use_ssl: bool = True,
- sqs_verify: Optional[bool] = None,
- sqs_endpoint_url: Optional[str] = None,
- sqs_aws_access_key_id: Optional[str] = None,
- sqs_aws_secret_access_key: Optional[str] = None,
- sqs_aws_session_token: Optional[str] = None,
- sqs_aws_session_name: Optional[str] = None,
- sqs_aws_profile_name: Optional[str] = None,
- sqs_aws_role_name: Optional[str] = None,
- sqs_aws_web_identity_token: Optional[str] = None,
- sqs_aws_sts_endpoint: Optional[str] = None,
- sqs_aws_use_application_level_encryption: bool = False,
- sqs_app_encryption_key_b64: Optional[str] = None,
- sqs_app_encryption_aad: Optional[str] = None,
- sqs_config=None,
+ self,
+ sqs_queue_url: Optional[str] = None,
+ sqs_region_name: Optional[str] = None,
+ sqs_api_version: Optional[str] = None,
+ sqs_use_ssl: bool = True,
+ sqs_verify: Optional[bool] = None,
+ sqs_endpoint_url: Optional[str] = None,
+ sqs_aws_access_key_id: Optional[str] = None,
+ sqs_aws_secret_access_key: Optional[str] = None,
+ sqs_aws_session_token: Optional[str] = None,
+ sqs_aws_session_name: Optional[str] = None,
+ sqs_aws_profile_name: Optional[str] = None,
+ sqs_aws_role_name: Optional[str] = None,
+ sqs_aws_web_identity_token: Optional[str] = None,
+ sqs_aws_sts_endpoint: Optional[str] = None,
+ sqs_strip_base64_files: bool = False,
+ sqs_aws_use_application_level_encryption: bool = False,
+ sqs_app_encryption_key_b64: Optional[str] = None,
+ sqs_app_encryption_aad: Optional[str] = None,
+ sqs_config=None,
) -> None:
litellm.aws_sqs_callback_params = litellm.aws_sqs_callback_params or {}
@@ -141,55 +150,59 @@ class SQSLogger(CustomBatchLogger, BaseAWSLLM):
litellm.aws_sqs_callback_params[key] = litellm.get_secret(value)
self.sqs_queue_url = (
- litellm.aws_sqs_callback_params.get("sqs_queue_url") or sqs_queue_url
+ litellm.aws_sqs_callback_params.get("sqs_queue_url") or sqs_queue_url
)
self.sqs_region_name = (
- litellm.aws_sqs_callback_params.get("sqs_region_name") or sqs_region_name
+ litellm.aws_sqs_callback_params.get("sqs_region_name") or sqs_region_name
)
self.sqs_api_version = (
- litellm.aws_sqs_callback_params.get("sqs_api_version") or sqs_api_version
+ litellm.aws_sqs_callback_params.get("sqs_api_version") or sqs_api_version
)
self.sqs_use_ssl = (
- litellm.aws_sqs_callback_params.get("sqs_use_ssl", True) or sqs_use_ssl
+ litellm.aws_sqs_callback_params.get("sqs_use_ssl", True) or sqs_use_ssl
)
self.sqs_verify = litellm.aws_sqs_callback_params.get("sqs_verify") or sqs_verify
self.sqs_endpoint_url = (
- litellm.aws_sqs_callback_params.get("sqs_endpoint_url") or sqs_endpoint_url
+ litellm.aws_sqs_callback_params.get("sqs_endpoint_url") or sqs_endpoint_url
)
self.sqs_aws_access_key_id = (
- litellm.aws_sqs_callback_params.get("sqs_aws_access_key_id")
- or sqs_aws_access_key_id
+ litellm.aws_sqs_callback_params.get("sqs_aws_access_key_id")
+ or sqs_aws_access_key_id
)
self.sqs_aws_secret_access_key = (
- litellm.aws_sqs_callback_params.get("sqs_aws_secret_access_key")
- or sqs_aws_secret_access_key
+ litellm.aws_sqs_callback_params.get("sqs_aws_secret_access_key")
+ or sqs_aws_secret_access_key
)
self.sqs_aws_session_token = (
- litellm.aws_sqs_callback_params.get("sqs_aws_session_token")
- or sqs_aws_session_token
+ litellm.aws_sqs_callback_params.get("sqs_aws_session_token")
+ or sqs_aws_session_token
)
self.sqs_aws_session_name = (
- litellm.aws_sqs_callback_params.get("sqs_aws_session_name") or sqs_aws_session_name
+ litellm.aws_sqs_callback_params.get("sqs_aws_session_name") or sqs_aws_session_name
)
self.sqs_aws_profile_name = (
- litellm.aws_sqs_callback_params.get("sqs_aws_profile_name") or sqs_aws_profile_name
+ litellm.aws_sqs_callback_params.get("sqs_aws_profile_name") or sqs_aws_profile_name
)
self.sqs_aws_role_name = (
- litellm.aws_sqs_callback_params.get("sqs_aws_role_name") or sqs_aws_role_name
+ litellm.aws_sqs_callback_params.get("sqs_aws_role_name") or sqs_aws_role_name
)
self.sqs_aws_web_identity_token = (
- litellm.aws_sqs_callback_params.get("sqs_aws_web_identity_token")
- or sqs_aws_web_identity_token
+ litellm.aws_sqs_callback_params.get("sqs_aws_web_identity_token")
+ or sqs_aws_web_identity_token
)
self.sqs_aws_sts_endpoint = (
- litellm.aws_sqs_callback_params.get("sqs_aws_sts_endpoint") or sqs_aws_sts_endpoint
+ litellm.aws_sqs_callback_params.get("sqs_aws_sts_endpoint") or sqs_aws_sts_endpoint
+ )
+ self.sqs_strip_base64_files = (
+ litellm.aws_sqs_callback_params.get("sqs_strip_base64_files", False)
+ or sqs_strip_base64_files
)
self.sqs_aws_use_application_level_encryption = (
@@ -217,13 +230,15 @@ class SQSLogger(CustomBatchLogger, BaseAWSLLM):
self.sqs_config = litellm.aws_sqs_callback_params.get("sqs_config") or sqs_config
async def async_log_success_event(
- self, kwargs, response_obj, start_time, end_time
+ self, kwargs, response_obj, start_time, end_time
) -> None:
try:
verbose_logger.debug(
"SQS Logging - Enters logging function for model %s", kwargs
)
standard_logging_payload = kwargs.get("standard_logging_object")
+ if self.sqs_strip_base64_files:
+ standard_logging_payload = await self._strip_base64_from_messages(standard_logging_payload)
if standard_logging_payload is None:
raise ValueError("standard_logging_payload is None")
@@ -337,4 +352,3 @@ class SQSLogger(CustomBatchLogger, BaseAWSLLM):
response.raise_for_status()
except Exception as e:
verbose_logger.exception(f"Error sending to SQS: {str(e)}")
-
diff --git a/litellm/litellm_core_utils/app_crypto.py b/litellm/litellm_core_utils/app_crypto.py
index bb5043b2b7b..5ce6d8d77f9 100644
--- a/litellm/litellm_core_utils/app_crypto.py
+++ b/litellm/litellm_core_utils/app_crypto.py
@@ -1,16 +1,18 @@
import base64
import json
import os
+from typing import Optional
from cryptography.hazmat.primitives.ciphers.aead import AESGCM
+
class AppCrypto:
def __init__(self, master_key: bytes):
if len(master_key) != 32:
raise ValueError("Master key must be 32 bytes for AES-256-GCM")
self.key = master_key
- def encrypt_json(self, data: dict, aad: bytes | None = None) -> dict:
+ def encrypt_json(self, data: dict, aad: Optional[bytes] = None) -> dict:
aes = AESGCM(self.key)
nonce = os.urandom(12)
plaintext = json.dumps(data).encode("utf-8")
@@ -22,7 +24,7 @@ class AppCrypto:
"tag": base64.b64encode(tag).decode(),
}
- def decrypt_json(self, enc: dict, aad: bytes | None = None) -> dict:
+ def decrypt_json(self, enc: dict, aad: Optional[bytes] = None) -> dict:
aes = AESGCM(self.key)
nonce = base64.b64decode(enc["nonce"])
ct = base64.b64decode(enc["ciphertext"])
diff --git a/litellm/litellm_core_utils/core_helpers.py b/litellm/litellm_core_utils/core_helpers.py
index 7423e55b626..8b9f53cec15 100644
--- a/litellm/litellm_core_utils/core_helpers.py
+++ b/litellm/litellm_core_utils/core_helpers.py
@@ -1,6 +1,6 @@
# What is this?
## Helper utilities
-from typing import TYPE_CHECKING, Any, Iterable, List, Optional, Union
+from typing import TYPE_CHECKING, Any, Iterable, List, Literal, Optional, Union
import httpx
@@ -138,6 +138,22 @@ def add_missing_spend_metadata_to_litellm_metadata(
return litellm_metadata
+def get_metadata_variable_name_from_kwargs(
+ kwargs: dict,
+) -> Literal["metadata", "litellm_metadata"]:
+ """
+ Helper to return what the "metadata" field should be called in the request data
+
+ - New endpoints return `litellm_metadata`
+ - Old endpoints return `metadata`
+
+ Context:
+ - LiteLLM used `metadata` as an internal field for storing metadata
+ - OpenAI then started using this field for their metadata
+ - LiteLLM is now moving to using `litellm_metadata` for our metadata
+ """
+ return "litellm_metadata" if "litellm_metadata" in kwargs else "metadata"
+
def get_litellm_metadata_from_kwargs(kwargs: dict):
"""
Helper to get litellm metadata from all litellm request kwargs
diff --git a/litellm/litellm_core_utils/exception_mapping_utils.py b/litellm/litellm_core_utils/exception_mapping_utils.py
index c6d3637ffcb..61551b04236 100644
--- a/litellm/litellm_core_utils/exception_mapping_utils.py
+++ b/litellm/litellm_core_utils/exception_mapping_utils.py
@@ -67,6 +67,7 @@ class ExceptionCheckers:
"string too long. expected a string with maximum length",
"model's maximum context limit",
"is longer than the model's context length",
+ "input tokens exceed the configured limit",
]
for substring in known_exception_substrings:
if substring in _error_str_lowercase:
diff --git a/litellm/litellm_core_utils/litellm_logging.py b/litellm/litellm_core_utils/litellm_logging.py
index e4e67502390..c9d766628a9 100644
--- a/litellm/litellm_core_utils/litellm_logging.py
+++ b/litellm/litellm_core_utils/litellm_logging.py
@@ -117,6 +117,7 @@ from litellm.types.utils import (
)
from litellm.types.videos.main import VideoObject
from litellm.utils import _get_base_model_from_metadata, executor, print_verbose
+from litellm.llms.base_llm.ocr.transformation import OCRResponse
from ..integrations.argilla import ArgillaLogger
from ..integrations.arize.arize_phoenix import ArizePhoenixLogger
@@ -1619,6 +1620,7 @@ class Logging(LiteLLMLoggingBaseClass):
or isinstance(logging_result, OpenAIFileObject)
or isinstance(logging_result, LiteLLMRealtimeStreamLoggingObject)
or isinstance(logging_result, OpenAIModerationResponse)
+ or isinstance(logging_result, OCRResponse) # OCR
or isinstance(logging_result, dict)
and logging_result.get("object") == "vector_store.search_results.page"
or isinstance(logging_result, VideoObject)
diff --git a/litellm/litellm_core_utils/prompt_templates/common_utils.py b/litellm/litellm_core_utils/prompt_templates/common_utils.py
index 19d5932ff28..33658d49063 100644
--- a/litellm/litellm_core_utils/prompt_templates/common_utils.py
+++ b/litellm/litellm_core_utils/prompt_templates/common_utils.py
@@ -654,6 +654,102 @@ def _get_image_mime_type_from_url(url: str) -> Optional[str]:
return None
+def infer_content_type_from_url_and_content(
+ url: str,
+ content: bytes,
+ current_content_type: Optional[str] = None,
+) -> str:
+ """
+ Infer content type from URL extension and binary content when content-type header is missing or generic.
+
+ This helper implements a fallback strategy for determining MIME types when HTTP headers
+ are missing or provide generic values (like binary/octet-stream). It's commonly used
+ when processing images and documents from various sources (S3, URLs, etc.).
+
+ Fallback Strategy:
+ 1. If current_content_type is valid (not None and not generic octet-stream), return it
+ 2. Try to infer from URL extension (handles query parameters)
+ 3. Try to detect from binary content signature (magic bytes)
+ 4. Raise ValueError if all methods fail
+
+ Args:
+ url: The URL of the content (used to extract file extension)
+ content: The binary content (first ~100 bytes are sufficient for detection)
+ current_content_type: The current content-type from headers (may be None or generic)
+
+ Returns:
+ str: The inferred MIME type (e.g., "image/png", "application/pdf")
+
+ Raises:
+ ValueError: If content type cannot be determined by any method
+
+ Example:
+ >>> content_type = infer_content_type_from_url_and_content(
+ ... url="https://s3.amazonaws.com/bucket/image.png?AWSAccessKeyId=123",
+ ... content=png_binary_data,
+ ... current_content_type="binary/octet-stream"
+ ... )
+ >>> print(content_type)
+ "image/png"
+ """
+ from litellm.litellm_core_utils.token_counter import get_image_type
+
+ # If we have a valid content type that's not generic, use it
+ if current_content_type and current_content_type not in [
+ "binary/octet-stream",
+ "application/octet-stream",
+ ]:
+ return current_content_type
+
+ # Extension to MIME type mapping
+ # Supports images, documents, and other common file types
+ extension_to_mime = {
+ # Image formats
+ "jpg": "image/jpeg",
+ "jpeg": "image/jpeg",
+ "png": "image/png",
+ "gif": "image/gif",
+ "webp": "image/webp",
+ # Document formats
+ "pdf": "application/pdf",
+ "csv": "text/csv",
+ "doc": "application/msword",
+ "docx": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
+ "xls": "application/vnd.ms-excel",
+ "xlsx": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
+ "html": "text/html",
+ "txt": "text/plain",
+ "md": "text/markdown",
+ }
+
+ # Try to infer from URL extension
+ if url:
+ extension = url.split(".")[-1].lower().split("?")[0] # Remove query params
+ inferred_type = extension_to_mime.get(extension)
+ if inferred_type:
+ return inferred_type
+
+ # Try to detect from binary content signature (magic bytes)
+ if content:
+ detected_type = get_image_type(content[:100])
+ if detected_type:
+ type_to_mime = {
+ "png": "image/png",
+ "jpeg": "image/jpeg",
+ "gif": "image/gif",
+ "webp": "image/webp",
+ "heic": "image/heic",
+ }
+ if detected_type in type_to_mime:
+ return type_to_mime[detected_type]
+
+ # If all fallbacks failed, raise error
+ raise ValueError(
+ f"Unable to determine content type from URL: {url}. "
+ f"Response content-type: {current_content_type}"
+ )
+
+
def get_tool_call_names(tools: List[ChatCompletionToolParam]) -> List[str]:
"""
Get tool call names from tools
diff --git a/litellm/litellm_core_utils/prompt_templates/factory.py b/litellm/litellm_core_utils/prompt_templates/factory.py
index a5a4ab6cbf2..18bd9fc1684 100644
--- a/litellm/litellm_core_utils/prompt_templates/factory.py
+++ b/litellm/litellm_core_utils/prompt_templates/factory.py
@@ -38,7 +38,11 @@ from litellm.types.llms.vertex_ai import FunctionResponse as VertexFunctionRespo
from litellm.types.llms.vertex_ai import PartType as VertexPartType
from litellm.types.utils import GenericImageParsingChunk
-from .common_utils import convert_content_list_to_str, is_non_content_values_set
+from .common_utils import (
+ convert_content_list_to_str,
+ infer_content_type_from_url_and_content,
+ is_non_content_values_set,
+)
from .image_handling import convert_url_to_base64
@@ -2536,13 +2540,17 @@ class BedrockImageProcessor:
"""Handles both sync and async image processing for Bedrock conversations."""
@staticmethod
- def _post_call_image_processing(response: httpx.Response) -> Tuple[str, str]:
+ def _post_call_image_processing(response: httpx.Response, image_url: str = "") -> Tuple[str, str]:
# Check the response's content type to ensure it is an image
content_type = response.headers.get("content-type")
- if not content_type:
- raise ValueError(
- f"URL does not contain content-type (content-type: {content_type})"
- )
+
+ # Use helper function to infer content type with fallback logic
+ content_type = infer_content_type_from_url_and_content(
+ url=image_url,
+ content=response.content,
+ current_content_type=content_type,
+ )
+
content_type = _parse_content_type(content_type)
# Convert the image content to base64 bytes
@@ -2561,7 +2569,7 @@ class BedrockImageProcessor:
response = await client.get(image_url, follow_redirects=True)
response.raise_for_status() # Raise an exception for HTTP errors
- return BedrockImageProcessor._post_call_image_processing(response)
+ return BedrockImageProcessor._post_call_image_processing(response, image_url)
except Exception as e:
raise e
@@ -2574,7 +2582,7 @@ class BedrockImageProcessor:
response = client.get(image_url, follow_redirects=True)
response.raise_for_status() # Raise an exception for HTTP errors
- return BedrockImageProcessor._post_call_image_processing(response)
+ return BedrockImageProcessor._post_call_image_processing(response, image_url)
except Exception as e:
raise e
diff --git a/litellm/litellm_core_utils/redact_messages.py b/litellm/litellm_core_utils/redact_messages.py
index 5ac38949e2b..849cb20cdc5 100644
--- a/litellm/litellm_core_utils/redact_messages.py
+++ b/litellm/litellm_core_utils/redact_messages.py
@@ -14,6 +14,9 @@ import litellm
from litellm.integrations.custom_logger import CustomLogger
from litellm.secret_managers.main import str_to_bool
from litellm.types.utils import StandardCallbackDynamicParams
+from litellm.litellm_core_utils.core_helpers import (
+ get_metadata_variable_name_from_kwargs,
+)
import asyncio
if TYPE_CHECKING:
@@ -37,6 +40,38 @@ def redact_message_input_output_from_custom_logger(
return result
+def _redact_choice_content(choice):
+ """Helper to redact content in a choice (message or delta)."""
+ if isinstance(choice, litellm.Choices):
+ choice.message.content = "redacted-by-litellm"
+ if hasattr(choice.message, "reasoning_content"):
+ choice.message.reasoning_content = "redacted-by-litellm"
+ if hasattr(choice.message, "thinking_blocks"):
+ choice.message.thinking_blocks = None
+ elif isinstance(choice, litellm.utils.StreamingChoices):
+ choice.delta.content = "redacted-by-litellm"
+ if hasattr(choice.delta, "reasoning_content"):
+ choice.delta.reasoning_content = "redacted-by-litellm"
+ if hasattr(choice.delta, "thinking_blocks"):
+ choice.delta.thinking_blocks = None
+
+
+def _redact_responses_api_output(output_items):
+ """Helper to redact ResponsesAPIResponse output items."""
+ for output_item in output_items:
+ if hasattr(output_item, "content") and isinstance(output_item.content, list):
+ for content_part in output_item.content:
+ if hasattr(content_part, "text"):
+ content_part.text = "redacted-by-litellm"
+
+ # Redact reasoning items in output array
+ if hasattr(output_item, "type") and output_item.type == "reasoning":
+ if hasattr(output_item, "summary") and isinstance(output_item.summary, list):
+ for summary_item in output_item.summary:
+ if hasattr(summary_item, "text"):
+ summary_item.text = "redacted-by-litellm"
+
+
def perform_redaction(model_call_details: dict, result):
"""
Performs the actual redaction on the logging object and result.
@@ -56,19 +91,12 @@ def perform_redaction(model_call_details: dict, result):
_streaming_response = model_call_details["complete_streaming_response"]
if hasattr(_streaming_response, "choices"):
for choice in _streaming_response.choices:
- if isinstance(choice, litellm.Choices):
- choice.message.content = "redacted-by-litellm"
- elif isinstance(choice, litellm.utils.StreamingChoices):
- choice.delta.content = "redacted-by-litellm"
+ _redact_choice_content(choice)
elif hasattr(_streaming_response, "output"):
- # Handle ResponsesAPIResponse format
- for output_item in _streaming_response.output:
- if hasattr(output_item, "content") and isinstance(
- output_item.content, list
- ):
- for content_part in output_item.content:
- if hasattr(content_part, "text"):
- content_part.text = "redacted-by-litellm"
+ _redact_responses_api_output(_streaming_response.output)
+ # Redact reasoning field in ResponsesAPIResponse
+ if hasattr(_streaming_response, "reasoning") and _streaming_response.reasoning is not None:
+ _streaming_response.reasoning = None
# Redact result
if result is not None:
@@ -84,17 +112,13 @@ def perform_redaction(model_call_details: dict, result):
if isinstance(_result, litellm.ModelResponse):
if hasattr(_result, "choices") and _result.choices is not None:
for choice in _result.choices:
- if isinstance(choice, litellm.Choices):
- choice.message.content = "redacted-by-litellm"
- elif isinstance(choice, litellm.utils.StreamingChoices):
- choice.delta.content = "redacted-by-litellm"
+ _redact_choice_content(choice)
elif isinstance(_result, litellm.ResponsesAPIResponse):
if hasattr(_result, "output"):
- for output_item in _result.output:
- if hasattr(output_item, "content") and isinstance(output_item.content, list):
- for content_part in output_item.content:
- if hasattr(content_part, "text"):
- content_part.text = "redacted-by-litellm"
+ _redact_responses_api_output(_result.output)
+ # Redact reasoning field in ResponsesAPIResponse
+ if hasattr(_result, "reasoning") and _result.reasoning is not None:
+ _result.reasoning = None
elif isinstance(_result, litellm.EmbeddingResponse):
if hasattr(_result, "data") and _result.data is not None:
_result.data = []
@@ -107,11 +131,13 @@ def should_redact_message_logging(model_call_details: dict) -> bool:
"""
Determine if message logging should be redacted.
"""
- _request_headers = (
- model_call_details.get("litellm_params", {}).get("metadata", {}) or {}
- )
-
- request_headers = _request_headers.get("headers", {})
+ litellm_params = model_call_details.get("litellm_params", {})
+
+ metadata_field = get_metadata_variable_name_from_kwargs(litellm_params)
+ metadata = litellm_params.get(metadata_field, {})
+
+ # Get headers from the metadata
+ request_headers = metadata.get("headers", {}) if isinstance(metadata, dict) else {}
possible_request_headers = [
"litellm-enable-message-redaction", # old header. maintain backwards compatibility
diff --git a/litellm/llms/azure/common_utils.py b/litellm/llms/azure/common_utils.py
index dfe662cc165..d9c5bea1a3f 100644
--- a/litellm/llms/azure/common_utils.py
+++ b/litellm/llms/azure/common_utils.py
@@ -759,4 +759,4 @@ class BaseAzureLLM(BaseOpenAILLM):
def _is_azure_v1_api_version(api_version: Optional[str]) -> bool:
if api_version is None:
return False
- return api_version == "preview" or api_version == "latest"
+ return api_version in {"preview", "latest", "v1"}
diff --git a/litellm/llms/bedrock/base_aws_llm.py b/litellm/llms/bedrock/base_aws_llm.py
index bc0466388f9..4c854437544 100644
--- a/litellm/llms/bedrock/base_aws_llm.py
+++ b/litellm/llms/bedrock/base_aws_llm.py
@@ -1,6 +1,7 @@
import hashlib
import json
import os
+import urllib.parse
from datetime import datetime
from typing import (
TYPE_CHECKING,
@@ -331,16 +332,61 @@ class BaseAWSLLM:
return provider
return None
+ @staticmethod
+ def get_bedrock_model_id(
+ optional_params: dict,
+ provider: Optional[BEDROCK_INVOKE_PROVIDERS_LITERAL],
+ model: str,
+ ) -> str:
+ model_id = optional_params.pop("model_id", None)
+ if model_id is not None:
+ model_id = BaseAWSLLM.encode_model_id(model_id=model_id)
+ else:
+ model_id = model
+
+ model_id = model_id.replace("invoke/", "", 1)
+ if provider == "llama" and "llama/" in model_id:
+ model_id = BaseAWSLLM._get_model_id_from_model_with_spec(
+ model_id, spec="llama"
+ )
+ elif provider == "deepseek_r1" and "deepseek_r1/" in model_id:
+ model_id = BaseAWSLLM._get_model_id_from_model_with_spec(
+ model_id, spec="deepseek_r1"
+ )
+ return model_id
+
+ @staticmethod
+ def _get_model_id_from_model_with_spec(
+ model: str,
+ spec: str,
+ ) -> str:
+ """
+ Remove `llama` from modelID since `llama` is simply a spec to follow for custom bedrock models
+ """
+ model_id = model.replace(spec + "/", "")
+ return BaseAWSLLM.encode_model_id(model_id=model_id)
+
+ @staticmethod
+ def encode_model_id(model_id: str) -> str:
+ """
+ Double encode the model ID to ensure it matches the expected double-encoded format.
+ Args:
+ model_id (str): The model ID to encode.
+ Returns:
+ str: The double-encoded model ID.
+ """
+ return urllib.parse.quote(model_id, safe="")
+
@staticmethod
def get_bedrock_embedding_provider(
model: str,
) -> Optional[BEDROCK_EMBEDDING_PROVIDERS_LITERAL]:
"""
Helper function to get the bedrock embedding provider from the model
-
+
Handles scenarios like:
1. model=cohere.embed-english-v3:0 -> Returns `cohere`
- 2. model=amazon.titan-embed-text-v1 -> Returns `amazon`
+ 2. model=amazon.titan-embed-text-v1 -> Returns `amazon`
3. model=us.twelvelabs.marengo-embed-2-7-v1:0 -> Returns `twelvelabs`
4. model=twelvelabs.marengo-embed-2-7-v1:0 -> Returns `twelvelabs`
"""
@@ -349,20 +395,24 @@ class BaseAWSLLM:
parts = model.split(".")
# Check if the second part (after potential region) is a known provider
if len(parts) >= 2:
- potential_provider = parts[1] # e.g., "twelvelabs" from "us.twelvelabs.marengo-embed-2-7-v1:0"
+ potential_provider = parts[
+ 1
+ ] # e.g., "twelvelabs" from "us.twelvelabs.marengo-embed-2-7-v1:0"
if potential_provider in get_args(BEDROCK_EMBEDDING_PROVIDERS_LITERAL):
return cast(BEDROCK_EMBEDDING_PROVIDERS_LITERAL, potential_provider)
-
+
# Check if the first part is a known provider (standard format)
- potential_provider = parts[0] # e.g., "cohere" from "cohere.embed-english-v3:0"
+ potential_provider = parts[
+ 0
+ ] # e.g., "cohere" from "cohere.embed-english-v3:0"
if potential_provider in get_args(BEDROCK_EMBEDDING_PROVIDERS_LITERAL):
return cast(BEDROCK_EMBEDDING_PROVIDERS_LITERAL, potential_provider)
-
+
# Fallback: check if any provider name appears in the model string
for provider in get_args(BEDROCK_EMBEDDING_PROVIDERS_LITERAL):
if provider in model:
return cast(BEDROCK_EMBEDDING_PROVIDERS_LITERAL, provider)
-
+
return None
def _get_aws_region_name(
@@ -984,20 +1034,23 @@ class BaseAWSLLM:
raise ImportError(
"Missing boto3 to call bedrock. Run 'pip install boto3'."
)
-
+
# Filter headers for AWS signature calculation
# AWS SigV4 only includes specific headers in signature calculation
aws_signature_headers = self._filter_headers_for_aws_signature(headers)
sigv4 = SigV4Auth(credentials, "bedrock", aws_region_name)
request = AWSRequest(
- method="POST", url=endpoint_url, data=data, headers=aws_signature_headers
+ method="POST",
+ url=endpoint_url,
+ data=data,
+ headers=aws_signature_headers,
)
sigv4.add_auth(request)
-
+
# Add back all original headers (including forwarded ones) after signature calculation
for header_name, header_value in headers.items():
request.headers[header_name] = header_value
-
+
if (
extra_headers is not None and "Authorization" in extra_headers
): # prevent sigv4 from overwriting the auth header
@@ -1013,16 +1066,27 @@ class BaseAWSLLM:
"""
aws_signature_headers = {}
aws_headers = {
- 'host', 'content-type', 'date', 'x-amz-date', 'x-amz-security-token',
- 'x-amz-content-sha256', 'x-amz-algorithm', 'x-amz-credential',
- 'x-amz-signedheaders', 'x-amz-signature'
+ "host",
+ "content-type",
+ "date",
+ "x-amz-date",
+ "x-amz-security-token",
+ "x-amz-content-sha256",
+ "x-amz-algorithm",
+ "x-amz-credential",
+ "x-amz-signedheaders",
+ "x-amz-signature",
}
-
+
for header_name, header_value in headers.items():
header_lower = header_name.lower()
- if header_lower in aws_headers or header_lower.startswith('x-amz-') or header_lower.startswith('x-amzn-'):
+ if (
+ header_lower in aws_headers
+ or header_lower.startswith("x-amz-")
+ or header_lower.startswith("x-amzn-")
+ ):
aws_signature_headers[header_name] = header_value
-
+
return aws_signature_headers
def _sign_request(
diff --git a/litellm/llms/bedrock/chat/converse_handler.py b/litellm/llms/bedrock/chat/converse_handler.py
index 54c603e5960..fd1f6f0c893 100644
--- a/litellm/llms/bedrock/chat/converse_handler.py
+++ b/litellm/llms/bedrock/chat/converse_handler.py
@@ -1,5 +1,4 @@
import json
-import urllib
from typing import Any, Optional, Union
import httpx
@@ -84,16 +83,6 @@ class BedrockConverseLLM(BaseAWSLLM):
def __init__(self) -> None:
super().__init__()
- def encode_model_id(self, model_id: str) -> str:
- """
- Double encode the model ID to ensure it matches the expected double-encoded format.
- Args:
- model_id (str): The model ID to encode.
- Returns:
- str: The double-encoded model ID.
- """
- return urllib.parse.quote(model_id, safe="") # type: ignore
-
async def async_streaming(
self,
model: str,
diff --git a/litellm/llms/bedrock/chat/invoke_handler.py b/litellm/llms/bedrock/chat/invoke_handler.py
index 71aadffe5bb..53cbafcbe6a 100644
--- a/litellm/llms/bedrock/chat/invoke_handler.py
+++ b/litellm/llms/bedrock/chat/invoke_handler.py
@@ -3,20 +3,15 @@ TODO: DELETE FILE. Bedrock LLM is no longer used. Goto `litellm/llms/bedrock/cha
"""
import copy
-import json
import time
import types
-import urllib.parse
from functools import partial
from typing import (
- Any,
AsyncIterator,
Callable,
Iterator,
- List,
Optional,
Tuple,
- Union,
cast,
get_args,
)
@@ -672,16 +667,6 @@ class BedrockLLM(BaseAWSLLM):
return model_response
- def encode_model_id(self, model_id: str) -> str:
- """
- Double encode the model ID to ensure it matches the expected double-encoded format.
- Args:
- model_id (str): The model ID to encode.
- Returns:
- str: The double-encoded model ID.
- """
- return urllib.parse.quote(model_id, safe="")
-
def completion( # noqa: PLR0915
self,
model: str,
@@ -1176,33 +1161,6 @@ class BedrockLLM(BaseAWSLLM):
return cast(litellm.BEDROCK_INVOKE_PROVIDERS_LITERAL, provider)
return None
- def get_bedrock_model_id(
- self,
- optional_params: dict,
- provider: Optional[litellm.BEDROCK_INVOKE_PROVIDERS_LITERAL],
- model: str,
- ) -> str:
- modelId = optional_params.pop("model_id", None)
- if modelId is not None:
- modelId = self.encode_model_id(model_id=modelId)
- else:
- modelId = model
-
- if provider == "llama" and "llama/" in modelId:
- modelId = self._get_model_id_for_llama_like_model(modelId)
-
- return modelId
-
- def _get_model_id_for_llama_like_model(
- self,
- model: str,
- ) -> str:
- """
- Remove `llama` from modelID since `llama` is simply a spec to follow for custom bedrock models
- """
- model_id = model.replace("llama/", "")
- return self.encode_model_id(model_id=model_id)
-
def get_response_stream_shape():
global _response_stream_shape_cache
diff --git a/litellm/llms/bedrock/chat/invoke_transformations/base_invoke_transformation.py b/litellm/llms/bedrock/chat/invoke_transformations/base_invoke_transformation.py
index 08a0690716b..e6146f1064e 100644
--- a/litellm/llms/bedrock/chat/invoke_transformations/base_invoke_transformation.py
+++ b/litellm/llms/bedrock/chat/invoke_transformations/base_invoke_transformation.py
@@ -1,7 +1,6 @@
import copy
import json
import time
-import urllib.parse
from functools import partial
from typing import TYPE_CHECKING, Any, List, Optional, Tuple, Union, cast, get_args
@@ -190,14 +189,16 @@ class AmazonInvokeConfig(BaseConfig, BaseAWSLLM):
] = True # cohere requires stream = True in inference params
request_data = {"prompt": prompt, **inference_params}
elif provider == "anthropic":
- transformed_request = litellm.AmazonAnthropicClaudeConfig().transform_request(
- model=model,
- messages=messages,
- optional_params=optional_params,
- litellm_params=litellm_params,
- headers=headers,
+ transformed_request = (
+ litellm.AmazonAnthropicClaudeConfig().transform_request(
+ model=model,
+ messages=messages,
+ optional_params=optional_params,
+ litellm_params=litellm_params,
+ headers=headers,
+ )
)
-
+
return transformed_request
elif provider == "nova":
return litellm.AmazonInvokeNovaConfig().transform_request(
@@ -327,7 +328,9 @@ class AmazonInvokeConfig(BaseConfig, BaseAWSLLM):
elif provider == "meta" or provider == "llama" or provider == "deepseek_r1":
outputText = completion_response["generation"]
elif provider == "mistral":
- outputText = litellm.AmazonMistralConfig.get_outputText(completion_response, model_response)
+ outputText = litellm.AmazonMistralConfig.get_outputText(
+ completion_response, model_response
+ )
else: # amazon titan
outputText = completion_response.get("results")[0].get("outputText")
except Exception as e:
@@ -549,48 +552,6 @@ class AmazonInvokeConfig(BaseConfig, BaseAWSLLM):
return cast(litellm.BEDROCK_INVOKE_PROVIDERS_LITERAL, provider)
return None
- def get_bedrock_model_id(
- self,
- optional_params: dict,
- provider: Optional[litellm.BEDROCK_INVOKE_PROVIDERS_LITERAL],
- model: str,
- ) -> str:
- modelId = optional_params.pop("model_id", None)
- if modelId is not None:
- modelId = self.encode_model_id(model_id=modelId)
- else:
- modelId = model
-
- modelId = modelId.replace("invoke/", "", 1)
- if provider == "llama" and "llama/" in modelId:
- modelId = self._get_model_id_from_model_with_spec(modelId, spec="llama")
- elif provider == "deepseek_r1" and "deepseek_r1/" in modelId:
- modelId = self._get_model_id_from_model_with_spec(
- modelId, spec="deepseek_r1"
- )
- return modelId
-
- def _get_model_id_from_model_with_spec(
- self,
- model: str,
- spec: str,
- ) -> str:
- """
- Remove `llama` from modelID since `llama` is simply a spec to follow for custom bedrock models
- """
- model_id = model.replace(spec + "/", "")
- return self.encode_model_id(model_id=model_id)
-
- def encode_model_id(self, model_id: str) -> str:
- """
- Double encode the model ID to ensure it matches the expected double-encoded format.
- Args:
- model_id (str): The model ID to encode.
- Returns:
- str: The double-encoded model ID.
- """
- return urllib.parse.quote(model_id, safe="")
-
def convert_messages_to_prompt(
self, model, messages, provider, custom_prompt_dict
) -> Tuple[str, Optional[list]]:
diff --git a/litellm/llms/bedrock/image/image_handler.py b/litellm/llms/bedrock/image/image_handler.py
index 1c418f78296..313a1dc17bd 100644
--- a/litellm/llms/bedrock/image/image_handler.py
+++ b/litellm/llms/bedrock/image/image_handler.py
@@ -7,6 +7,7 @@ import httpx
from pydantic import BaseModel
import litellm
+from litellm import BEDROCK_INVOKE_PROVIDERS_LITERAL
from litellm._logging import verbose_logger
from litellm.litellm_core_utils.litellm_logging import Logging as LitellmLogging
from litellm.llms.bedrock.image.amazon_nova_canvas_transformation import (
@@ -183,8 +184,14 @@ class BedrockImageGeneration(BaseAWSLLM):
optional_params, model
)
+ # Use the existing ARN-aware provider detection method
+ bedrock_provider = self.get_bedrock_invoke_provider(model)
### SET RUNTIME ENDPOINT ###
- modelId = model
+ modelId = self.get_bedrock_model_id(
+ model=model,
+ provider=bedrock_provider,
+ optional_params=optional_params,
+ )
_, proxy_endpoint_url = self.get_runtime_endpoint(
api_base=api_base,
aws_bedrock_runtime_endpoint=boto3_credentials_info.aws_bedrock_runtime_endpoint,
@@ -192,7 +199,10 @@ class BedrockImageGeneration(BaseAWSLLM):
)
proxy_endpoint_url = f"{proxy_endpoint_url}/model/{modelId}/invoke"
data = self._get_request_body(
- model=model, prompt=prompt, optional_params=optional_params
+ model=model,
+ prompt=prompt,
+ optional_params=optional_params,
+ bedrock_provider=bedrock_provider,
)
# Make POST Request
@@ -231,6 +241,7 @@ class BedrockImageGeneration(BaseAWSLLM):
def _get_request_body(
self,
model: str,
+ bedrock_provider: Optional[BEDROCK_INVOKE_PROVIDERS_LITERAL],
prompt: str,
optional_params: dict,
) -> dict:
@@ -242,9 +253,6 @@ class BedrockImageGeneration(BaseAWSLLM):
Returns:
dict: The request body to use for the Bedrock Image Generation API
"""
- # Use the existing ARN-aware provider detection method
- bedrock_provider = self.get_bedrock_invoke_provider(model)
-
if bedrock_provider == "amazon" or bedrock_provider == "nova":
# Handle Amazon Nova Canvas models
provider = "amazon"
diff --git a/litellm/llms/cohere/chat/v2_transformation.py b/litellm/llms/cohere/chat/v2_transformation.py
index 50426a0883b..8f6dde1967c 100644
--- a/litellm/llms/cohere/chat/v2_transformation.py
+++ b/litellm/llms/cohere/chat/v2_transformation.py
@@ -6,7 +6,12 @@ import httpx
import litellm
from litellm.llms.base_llm.chat.transformation import BaseLLMException
from litellm.types.llms.cohere import CohereV2ChatResponse
-from litellm.types.llms.openai import AllMessageValues, ChatCompletionToolCallChunk
+from litellm.types.llms.openai import (
+ AllMessageValues,
+ ChatCompletionToolCallChunk,
+ ChatCompletionAnnotation,
+ ChatCompletionAnnotationURLCitation,
+)
from litellm.llms.openai.chat.gpt_transformation import OpenAIGPTConfig
from litellm.types.utils import ModelResponse, Usage
@@ -207,9 +212,15 @@ class CohereV2ChatConfig(OpenAIGPTConfig):
]
)
- ## ADD CITATIONS
- if "citations" in cohere_v2_chat_response:
- setattr(model_response, "citations", cohere_v2_chat_response["citations"])
+ ## ADD CITATIONS AS ANNOTATIONS
+ annotations: Optional[List[ChatCompletionAnnotation]] = None
+ citations = None
+
+ if "message" in cohere_v2_chat_response and "citations" in cohere_v2_chat_response["message"]:
+ citations = cohere_v2_chat_response["message"]["citations"]
+
+ if citations:
+ annotations = self._translate_citations_to_openai_annotations(citations)
## Tool calling response
cohere_tools_response = cohere_v2_chat_response["message"].get("tool_calls", [])
@@ -225,8 +236,13 @@ class CohereV2ChatConfig(OpenAIGPTConfig):
_message = litellm.Message(
tool_calls=tool_calls,
content=None,
+ annotations=annotations,
)
model_response.choices[0].message = _message # type: ignore
+ else:
+ if annotations:
+ current_message = model_response.choices[0].message # type: ignore
+ current_message.annotations = annotations
## CALCULATING USAGE - use cohere `billed_units` for returning usage
token_usage = cohere_v2_chat_response["usage"].get("tokens", {})
@@ -276,3 +292,66 @@ class CohereV2ChatConfig(OpenAIGPTConfig):
self, error_message: str, status_code: int, headers: Union[dict, httpx.Headers]
) -> BaseLLMException:
return CohereError(status_code=status_code, message=error_message)
+
+ def _translate_citations_to_openai_annotations(self, citations: List[dict]) -> List[ChatCompletionAnnotation]:
+ """
+ Transform Cohere citations to OpenAI annotations format.
+
+ Creates separate annotations for each source in a citation, allowing multiple
+ annotations with the same start/end index if they reference different sources.
+
+ Args:
+ citations: List of Cohere citation objects with format:
+ {
+ "start": int,
+ "end": int,
+ "text": str,
+ "sources": [
+ {
+ "type": "document",
+ "document": {
+ "title": str,
+ "snippet": str,
+ ...
+ },
+ "id": str
+ }
+ ]
+ }
+
+ Returns:
+ List of OpenAI ChatCompletionAnnotation objects (one per source)
+ """
+ annotations: List[ChatCompletionAnnotation] = []
+
+ for citation in citations:
+ start_index = citation.get("start", 0)
+ end_index = citation.get("end", 0)
+
+ # Extract source information - loop through all sources
+ sources = citation.get("sources", [])
+ if not sources:
+ continue
+
+ # Create an annotation for each source
+ for source in sources:
+ if source.get("type") == "document" and "document" in source:
+ document = source["document"]
+ title = document.get("title", "")
+ url = source.get("url") or f"source:{source.get('id', 'unknown')}"
+
+ url_citation: ChatCompletionAnnotationURLCitation = {
+ "start_index": start_index,
+ "end_index": end_index,
+ "title": title,
+ "url": url,
+ }
+
+ annotation: ChatCompletionAnnotation = {
+ "type": "url_citation",
+ "url_citation": url_citation,
+ }
+
+ annotations.append(annotation)
+
+ return annotations
\ No newline at end of file
diff --git a/litellm/llms/custom_httpx/http_handler.py b/litellm/llms/custom_httpx/http_handler.py
index accdddbc4dd..cc451e5fa95 100644
--- a/litellm/llms/custom_httpx/http_handler.py
+++ b/litellm/llms/custom_httpx/http_handler.py
@@ -3,7 +3,7 @@ import os
import ssl
import sys
import time
-from typing import TYPE_CHECKING, Any, Callable, Dict, List, Mapping, Optional, Union
+from typing import TYPE_CHECKING, Any, Callable, Dict, List, Mapping, Optional, Tuple, Union
import certifi
import httpx
@@ -47,6 +47,46 @@ headers = {
_DEFAULT_TIMEOUT = httpx.Timeout(timeout=5.0, connect=5.0)
+def _prepare_request_data_and_content(
+ data: Optional[Union[dict, str, bytes]] = None,
+ content: Any = None,
+) -> Tuple[Optional[Union[dict, Mapping]], Any]:
+ """
+ Helper function to route data/content parameters correctly for httpx requests
+
+ This prevents httpx DeprecationWarnings that cause memory leaks.
+
+ Background:
+ - httpx shows a DeprecationWarning when you pass bytes/str to `data=`
+ - It wants you to use `content=` instead for bytes/str
+ - The warning itself leaks memory when triggered repeatedly
+
+ Solution:
+ - Move bytes/str from `data=` to `content=` before calling build_request
+ - Keep dicts in `data=` (that's still the correct parameter for dicts)
+
+ Args:
+ data: Request data (can be dict, str, or bytes)
+ content: Request content (raw bytes/str)
+
+ Returns:
+ Tuple of (request_data, request_content) properly routed for httpx
+ """
+ request_data = None
+ request_content = content
+
+ if data is not None:
+ if isinstance(data, (bytes, str)):
+ # Bytes/strings belong in content= (only if not already provided)
+ if content is None:
+ request_content = data
+ else:
+ # dict/Mapping stays in data= parameter
+ request_data = data
+
+ return request_data, request_content
+
+
def get_ssl_configuration(
ssl_verify: Optional[VerifyTypes] = None,
) -> Union[bool, str, ssl.SSLContext]:
@@ -301,17 +341,20 @@ class AsyncHTTPHandler:
if timeout is None:
timeout = self.timeout
+ # Prepare data/content parameters to prevent httpx DeprecationWarning (memory leak fix)
+ request_data, request_content = _prepare_request_data_and_content(data, content)
+
req = self.client.build_request(
"POST",
url,
- data=data, # type: ignore
+ data=request_data,
json=json,
params=params,
headers=headers,
timeout=timeout,
files=files,
- content=content,
- )
+ content=request_content,
+ )
response = await self.client.send(req, stream=stream)
response.raise_for_status()
return response
@@ -364,19 +407,23 @@ class AsyncHTTPHandler:
async def put(
self,
url: str,
- data: Optional[Union[dict, str]] = None, # type: ignore
+ data: Optional[Union[dict, str, bytes]] = None, # type: ignore
json: Optional[dict] = None,
params: Optional[dict] = None,
headers: Optional[dict] = None,
timeout: Optional[Union[float, httpx.Timeout]] = None,
stream: bool = False,
+ content: Any = None,
):
try:
if timeout is None:
timeout = self.timeout
+ # Prepare data/content parameters to prevent httpx DeprecationWarning (memory leak fix)
+ request_data, request_content = _prepare_request_data_and_content(data, content)
+
req = self.client.build_request(
- "PUT", url, data=data, json=json, params=params, headers=headers, timeout=timeout # type: ignore
+ "PUT", url, data=request_data, json=json, params=params, headers=headers, timeout=timeout, content=request_content # type: ignore
)
response = await self.client.send(req)
response.raise_for_status()
@@ -424,19 +471,23 @@ class AsyncHTTPHandler:
async def patch(
self,
url: str,
- data: Optional[Union[dict, str]] = None, # type: ignore
+ data: Optional[Union[dict, str, bytes]] = None, # type: ignore
json: Optional[dict] = None,
params: Optional[dict] = None,
headers: Optional[dict] = None,
timeout: Optional[Union[float, httpx.Timeout]] = None,
stream: bool = False,
+ content: Any = None,
):
try:
if timeout is None:
timeout = self.timeout
+ # Prepare data/content parameters to prevent httpx DeprecationWarning (memory leak fix)
+ request_data, request_content = _prepare_request_data_and_content(data, content)
+
req = self.client.build_request(
- "PATCH", url, data=data, json=json, params=params, headers=headers, timeout=timeout # type: ignore
+ "PATCH", url, data=request_data, json=json, params=params, headers=headers, timeout=timeout, content=request_content # type: ignore
)
response = await self.client.send(req)
response.raise_for_status()
@@ -484,18 +535,23 @@ class AsyncHTTPHandler:
async def delete(
self,
url: str,
- data: Optional[Union[dict, str]] = None, # type: ignore
+ data: Optional[Union[dict, str, bytes]] = None, # type: ignore
json: Optional[dict] = None,
params: Optional[dict] = None,
headers: Optional[dict] = None,
timeout: Optional[Union[float, httpx.Timeout]] = None,
stream: bool = False,
+ content: Any = None,
):
try:
if timeout is None:
timeout = self.timeout
+
+ # Prepare data/content parameters to prevent httpx DeprecationWarning (memory leak fix)
+ request_data, request_content = _prepare_request_data_and_content(data, content)
+
req = self.client.build_request(
- "DELETE", url, data=data, json=json, params=params, headers=headers, timeout=timeout # type: ignore
+ "DELETE", url, data=request_data, json=json, params=params, headers=headers, timeout=timeout, content=request_content # type: ignore
)
response = await self.client.send(req, stream=stream)
response.raise_for_status()
@@ -543,8 +599,11 @@ class AsyncHTTPHandler:
Used for retrying connection client errors.
"""
+ # Prepare data/content parameters to prevent httpx DeprecationWarning (memory leak fix)
+ request_data, request_content = _prepare_request_data_and_content(data, content)
+
req = client.build_request(
- "POST", url, data=data, json=json, params=params, headers=headers, content=content # type: ignore
+ "POST", url, data=request_data, json=json, params=params, headers=headers, content=request_content # type: ignore
)
response = await client.send(req, stream=stream)
response.raise_for_status()
@@ -798,21 +857,24 @@ class HTTPHandler:
logging_obj: Optional[LiteLLMLoggingObject] = None,
):
try:
+ # Prepare data/content parameters to prevent httpx DeprecationWarning (memory leak fix)
+ request_data, request_content = _prepare_request_data_and_content(data, content)
+
if timeout is not None:
req = self.client.build_request(
"POST",
url,
- data=data, # type: ignore
+ data=request_data, # type: ignore
json=json,
params=params,
headers=headers,
timeout=timeout,
files=files,
- content=content, # type: ignore
+ content=request_content, # type: ignore
)
else:
req = self.client.build_request(
- "POST", url, data=data, json=json, params=params, headers=headers, files=files, content=content # type: ignore
+ "POST", url, data=request_data, json=json, params=params, headers=headers, files=files, content=request_content # type: ignore
)
response = self.client.send(req, stream=stream)
response.raise_for_status()
@@ -840,21 +902,25 @@ class HTTPHandler:
def patch(
self,
url: str,
- data: Optional[Union[dict, str]] = None,
+ data: Optional[Union[dict, str, bytes]] = None,
json: Optional[Union[dict, str]] = None,
params: Optional[dict] = None,
headers: Optional[dict] = None,
stream: bool = False,
timeout: Optional[Union[float, httpx.Timeout]] = None,
+ content: Any = None,
):
try:
+ # Prepare data/content parameters to prevent httpx DeprecationWarning (memory leak fix)
+ request_data, request_content = _prepare_request_data_and_content(data, content)
+
if timeout is not None:
req = self.client.build_request(
- "PATCH", url, data=data, json=json, params=params, headers=headers, timeout=timeout # type: ignore
+ "PATCH", url, data=request_data, json=json, params=params, headers=headers, timeout=timeout, content=request_content # type: ignore
)
else:
req = self.client.build_request(
- "PATCH", url, data=data, json=json, params=params, headers=headers # type: ignore
+ "PATCH", url, data=request_data, json=json, params=params, headers=headers, content=request_content # type: ignore
)
response = self.client.send(req, stream=stream)
response.raise_for_status()
@@ -883,21 +949,25 @@ class HTTPHandler:
def put(
self,
url: str,
- data: Optional[Union[dict, str]] = None,
+ data: Optional[Union[dict, str, bytes]] = None,
json: Optional[Union[dict, str]] = None,
params: Optional[dict] = None,
headers: Optional[dict] = None,
stream: bool = False,
timeout: Optional[Union[float, httpx.Timeout]] = None,
+ content: Any = None,
):
try:
+ # Prepare data/content parameters to prevent httpx DeprecationWarning (memory leak fix)
+ request_data, request_content = _prepare_request_data_and_content(data, content)
+
if timeout is not None:
req = self.client.build_request(
- "PUT", url, data=data, json=json, params=params, headers=headers, timeout=timeout # type: ignore
+ "PUT", url, data=request_data, json=json, params=params, headers=headers, timeout=timeout, content=request_content # type: ignore
)
else:
req = self.client.build_request(
- "PUT", url, data=data, json=json, params=params, headers=headers # type: ignore
+ "PUT", url, data=request_data, json=json, params=params, headers=headers, content=request_content # type: ignore
)
response = self.client.send(req, stream=stream)
return response
@@ -913,21 +983,25 @@ class HTTPHandler:
def delete(
self,
url: str,
- data: Optional[Union[dict, str]] = None, # type: ignore
+ data: Optional[Union[dict, str, bytes]] = None, # type: ignore
json: Optional[dict] = None,
params: Optional[dict] = None,
headers: Optional[dict] = None,
timeout: Optional[Union[float, httpx.Timeout]] = None,
stream: bool = False,
+ content: Any = None,
):
try:
+ # Prepare data/content parameters to prevent httpx DeprecationWarning (memory leak fix)
+ request_data, request_content = _prepare_request_data_and_content(data, content)
+
if timeout is not None:
req = self.client.build_request(
- "DELETE", url, data=data, json=json, params=params, headers=headers, timeout=timeout # type: ignore
+ "DELETE", url, data=request_data, json=json, params=params, headers=headers, timeout=timeout, content=request_content # type: ignore
)
else:
req = self.client.build_request(
- "DELETE", url, data=data, json=json, params=params, headers=headers # type: ignore
+ "DELETE", url, data=request_data, json=json, params=params, headers=headers, content=request_content # type: ignore
)
response = self.client.send(req, stream=stream)
response.raise_for_status()
diff --git a/litellm/llms/custom_httpx/llm_http_handler.py b/litellm/llms/custom_httpx/llm_http_handler.py
index b67e8823d0c..0a01e9cd68a 100644
--- a/litellm/llms/custom_httpx/llm_http_handler.py
+++ b/litellm/llms/custom_httpx/llm_http_handler.py
@@ -1774,11 +1774,16 @@ class BaseLLMHTTPHandler:
provider_specific_header=provider_specific_header,
custom_llm_provider=custom_llm_provider,
)
+ forwarded_headers = kwargs.get("headers", None)
+ if forwarded_headers and extra_headers:
+ merged_headers = {**forwarded_headers, **extra_headers}
+ else:
+ merged_headers = forwarded_headers or extra_headers
(
headers,
api_base,
) = anthropic_messages_provider_config.validate_anthropic_messages_environment(
- headers=extra_headers or {},
+ headers=merged_headers or {},
model=model,
messages=messages,
optional_params=anthropic_messages_optional_request_params,
diff --git a/litellm/llms/deepgram/audio_transcription/transformation.py b/litellm/llms/deepgram/audio_transcription/transformation.py
index 0cdfd734de7..faa68e97eae 100644
--- a/litellm/llms/deepgram/audio_transcription/transformation.py
+++ b/litellm/llms/deepgram/audio_transcription/transformation.py
@@ -58,7 +58,7 @@ class DeepgramAudioTranscriptionConfig(BaseAudioTranscriptionConfig):
) -> AudioTranscriptionRequestData:
"""
Processes the audio file input based on its type and returns AudioTranscriptionRequestData.
-
+
For Deepgram, the binary audio data is sent directly as the request body.
Args:
@@ -69,12 +69,11 @@ class DeepgramAudioTranscriptionConfig(BaseAudioTranscriptionConfig):
"""
# Use common utility to process the audio file
processed_audio = process_audio_file(audio_file)
-
+
# Return structured data with binary content and no files
# For Deepgram, we send binary data directly as request body
return AudioTranscriptionRequestData(
- data=processed_audio.file_content,
- files=None
+ data=processed_audio.file_content, files=None
)
def transform_audio_transcription_response(
@@ -99,9 +98,11 @@ class DeepgramAudioTranscriptionConfig(BaseAudioTranscriptionConfig):
# Add additional metadata matching OpenAI format
response["task"] = "transcribe"
- response["language"] = (
- "english" # Deepgram auto-detects but doesn't return language
- )
+
+ # Use detected_language if available, otherwise default to "en"
+ detected_language = first_channel.get("detected_language")
+ response["language"] = detected_language if detected_language else "en"
+
response["duration"] = response_json["metadata"]["duration"]
# Transform words to match OpenAI format
@@ -150,7 +151,6 @@ class DeepgramAudioTranscriptionConfig(BaseAudioTranscriptionConfig):
return url
-
def _format_param_value(self, value) -> str:
"""
Formats a parameter value for use in query string.
@@ -180,7 +180,7 @@ class DeepgramAudioTranscriptionConfig(BaseAudioTranscriptionConfig):
provider_specific_params = self.get_provider_specific_params(
optional_params=optional_params,
model=model,
- openai_params=self.get_supported_openai_params(model)
+ openai_params=self.get_supported_openai_params(model),
)
for key, value in provider_specific_params.items():
diff --git a/litellm/llms/fal_ai/__init__.py b/litellm/llms/fal_ai/__init__.py
new file mode 100644
index 00000000000..492197951e9
--- /dev/null
+++ b/litellm/llms/fal_ai/__init__.py
@@ -0,0 +1,24 @@
+from .cost_calculator import cost_calculator
+from .image_generation import (
+ FalAIBaseConfig,
+ FalAIBriaConfig,
+ FalAIFluxProV11UltraConfig,
+ FalAIImageGenerationConfig,
+ FalAIImagen4Config,
+ FalAIRecraftV3Config,
+ FalAIStableDiffusionConfig,
+ get_fal_ai_image_generation_config,
+)
+
+__all__ = [
+ "cost_calculator",
+ "FalAIBaseConfig",
+ "FalAIImageGenerationConfig",
+ "FalAIImagen4Config",
+ "FalAIRecraftV3Config",
+ "FalAIBriaConfig",
+ "FalAIFluxProV11UltraConfig",
+ "FalAIStableDiffusionConfig",
+ "get_fal_ai_image_generation_config",
+]
+
diff --git a/litellm/llms/fal_ai/cost_calculator.py b/litellm/llms/fal_ai/cost_calculator.py
new file mode 100644
index 00000000000..b7caae3834f
--- /dev/null
+++ b/litellm/llms/fal_ai/cost_calculator.py
@@ -0,0 +1,26 @@
+from typing import Any
+
+import litellm
+from litellm.types.utils import ImageResponse
+
+
+def cost_calculator(
+ model: str,
+ image_response: Any,
+) -> float:
+ """
+ fal.ai image generation cost calculator
+ """
+ _model_info = litellm.get_model_info(
+ model=model,
+ custom_llm_provider=litellm.LlmProviders.FAL_AI.value,
+ )
+ output_cost_per_image: float = _model_info.get("output_cost_per_image") or 0.0
+ num_images: int = 0
+ if isinstance(image_response, ImageResponse):
+ if image_response.data:
+ num_images = len(image_response.data)
+ return output_cost_per_image * num_images
+ else:
+ raise ValueError(f"image_response must be of type ImageResponse got type={type(image_response)}")
+
diff --git a/litellm/llms/fal_ai/image_generation/__init__.py b/litellm/llms/fal_ai/image_generation/__init__.py
new file mode 100644
index 00000000000..74d3b434b87
--- /dev/null
+++ b/litellm/llms/fal_ai/image_generation/__init__.py
@@ -0,0 +1,49 @@
+from litellm.llms.base_llm.image_generation.transformation import (
+ BaseImageGenerationConfig,
+)
+
+from .bria_transformation import FalAIBriaConfig
+from .flux_pro_v11_ultra_transformation import FalAIFluxProV11UltraConfig
+from .imagen4_transformation import FalAIImagen4Config
+from .recraft_v3_transformation import FalAIRecraftV3Config
+from .stable_diffusion_transformation import FalAIStableDiffusionConfig
+from .transformation import FalAIBaseConfig, FalAIImageGenerationConfig
+
+__all__ = [
+ "FalAIBaseConfig",
+ "FalAIImageGenerationConfig",
+ "FalAIImagen4Config",
+ "FalAIRecraftV3Config",
+ "FalAIBriaConfig",
+ "FalAIFluxProV11UltraConfig",
+ "FalAIStableDiffusionConfig",
+]
+
+
+def get_fal_ai_image_generation_config(model: str) -> BaseImageGenerationConfig:
+ """
+ Get the appropriate Fal AI image generation configuration based on the model.
+
+ Args:
+ model: The Fal AI model name (e.g., "fal-ai/imagen4/preview", "fal-ai/recraft/v3/text-to-image")
+
+ Returns:
+ The appropriate configuration class for the specified model
+ """
+ model_lower = model.lower()
+
+ # Map model names to their corresponding configuration classes
+ if "imagen4" in model_lower or "imagen-4" in model_lower:
+ return FalAIImagen4Config()
+ elif "recraft" in model_lower:
+ return FalAIRecraftV3Config()
+ elif "bria" in model_lower:
+ return FalAIBriaConfig()
+ elif "flux-pro" in model_lower and "ultra" in model_lower:
+ return FalAIFluxProV11UltraConfig()
+ elif "stable-diffusion" in model_lower:
+ return FalAIStableDiffusionConfig()
+
+ # Default to generic Fal AI configuration
+ return FalAIImageGenerationConfig()
+
diff --git a/litellm/llms/fal_ai/image_generation/bria_transformation.py b/litellm/llms/fal_ai/image_generation/bria_transformation.py
new file mode 100644
index 00000000000..cb5aa6b761d
--- /dev/null
+++ b/litellm/llms/fal_ai/image_generation/bria_transformation.py
@@ -0,0 +1,231 @@
+from typing import TYPE_CHECKING, Any, List, Optional
+
+import httpx
+
+from litellm.types.llms.openai import OpenAIImageGenerationOptionalParams
+from litellm.types.utils import ImageObject, ImageResponse
+
+from .transformation import FalAIBaseConfig
+
+if TYPE_CHECKING:
+ from litellm.litellm_core_utils.litellm_logging import Logging as _LiteLLMLoggingObj
+
+ LiteLLMLoggingObj = _LiteLLMLoggingObj
+else:
+ LiteLLMLoggingObj = Any
+
+
+class FalAIBriaConfig(FalAIBaseConfig):
+ """
+ Configuration for Bria Text-to-Image 3.2 model.
+
+ Bria 3.2 is a commercial-grade text-to-image model with prompt enhancement
+ and multiple aspect ratio options.
+
+ Model endpoint: bria/text-to-image/3.2
+ Documentation: https://fal.ai/models/bria/text-to-image/3.2
+ """
+ IMAGE_GENERATION_ENDPOINT: str = "bria/text-to-image/3.2"
+
+ def get_supported_openai_params(
+ self, model: str
+ ) -> List[OpenAIImageGenerationOptionalParams]:
+ """
+ Get supported OpenAI parameters for Bria 3.2.
+ """
+ return [
+ "n",
+ "response_format",
+ "size",
+ ]
+
+ def map_openai_params(
+ self,
+ non_default_params: dict,
+ optional_params: dict,
+ model: str,
+ drop_params: bool,
+ ) -> dict:
+ """
+ Map OpenAI parameters to Bria 3.2 parameters.
+
+ Mappings:
+ - size -> aspect_ratio (1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9)
+ - response_format -> ignored (Bria returns URLs)
+ - n -> ignored (Bria doesn't support multiple images in one call)
+ """
+ supported_params = self.get_supported_openai_params(model)
+
+ # Map OpenAI params to Bria params
+ param_mapping = {
+ "size": "aspect_ratio",
+ }
+
+ for k in non_default_params.keys():
+ if k not in optional_params.keys():
+ if k in supported_params:
+ # Use mapped parameter name if exists
+ mapped_key = param_mapping.get(k, k)
+ mapped_value = non_default_params[k]
+
+ # Transform specific parameters
+ if k == "response_format":
+ # Bria always returns URLs, so we can ignore this
+ continue
+ elif k == "n":
+ # Bria doesn't support multiple images, ignore
+ continue
+ elif k == "size":
+ # Map OpenAI size format to Bria aspect ratio
+ mapped_value = self._map_aspect_ratio(mapped_value)
+
+ optional_params[mapped_key] = mapped_value
+ elif drop_params:
+ pass
+ else:
+ raise ValueError(
+ f"Parameter {k} is not supported for model {model}. Supported parameters are {supported_params}. Set drop_params=True to drop unsupported parameters."
+ )
+
+ return optional_params
+
+ def _map_aspect_ratio(self, size: str) -> str:
+ """
+ Map OpenAI size format to Bria aspect ratio format.
+
+ OpenAI format: "1024x1024", "1792x1024", etc.
+ Bria format: "1:1", "2:3", "3:2", "3:4", "4:3", "4:5", "5:4", "9:16", "16:9"
+ """
+ # Map common OpenAI sizes to Bria aspect ratios
+ size_to_aspect_ratio = {
+ "1024x1024": "1:1",
+ "512x512": "1:1",
+ "1792x1024": "16:9",
+ "1024x1792": "9:16",
+ "1024x768": "4:3",
+ "768x1024": "3:4",
+ "1280x960": "4:3",
+ "960x1280": "3:4",
+ }
+
+ if size in size_to_aspect_ratio:
+ return size_to_aspect_ratio[size]
+
+ # Parse custom size format "WIDTHxHEIGHT" and calculate aspect ratio
+ if "x" in size:
+ try:
+ width_str, height_str = size.split("x")
+ width = int(width_str)
+ height = int(height_str)
+
+ # Calculate aspect ratio and find closest match
+ ratio = width / height
+
+ # Map to closest supported aspect ratio
+ if 0.95 <= ratio <= 1.05: # Close to 1:1
+ return "1:1"
+ elif ratio >= 1.7: # Close to 16:9
+ return "16:9"
+ elif ratio <= 0.6: # Close to 9:16
+ return "9:16"
+ elif 1.3 <= ratio <= 1.4: # Close to 4:3
+ return "4:3"
+ elif 0.7 <= ratio <= 0.8: # Close to 3:4
+ return "3:4"
+ elif 1.45 <= ratio <= 1.55: # Close to 3:2
+ return "3:2"
+ elif 0.65 <= ratio <= 0.7: # Close to 2:3
+ return "2:3"
+ elif 1.2 <= ratio <= 1.3: # Close to 5:4
+ return "5:4"
+ elif 0.75 <= ratio <= 0.85: # Close to 4:5
+ return "4:5"
+ except (ValueError, AttributeError, ZeroDivisionError):
+ pass
+
+ # Default to 1:1
+ return "1:1"
+
+ def transform_image_generation_request(
+ self,
+ model: str,
+ prompt: str,
+ optional_params: dict,
+ litellm_params: dict,
+ headers: dict,
+ ) -> dict:
+ """
+ Transform the image generation request to Bria 3.2 request body.
+
+ Required parameters:
+ - prompt: Prompt for image generation
+
+ Optional parameters:
+ - aspect_ratio: "1:1", "2:3", "3:2", "3:4", "4:3", "4:5", "5:4", "9:16", "16:9" (default: "1:1")
+ - prompt_enhancer: Improve the prompt (default: true)
+ - sync_mode: Return image directly in response (default: false)
+ - truncate_prompt: Truncate the prompt (default: true)
+ - guidance_scale: Guidance scale 1-10 (default: 5)
+ - num_inference_steps: Inference steps 20-50 (default: 30)
+ - seed: Random seed for reproducibility (default: 5555)
+ - negative_prompt: Negative prompt string
+ """
+ bria_request_body = {
+ "prompt": prompt,
+ **optional_params,
+ }
+
+ return bria_request_body
+
+ def transform_image_generation_response(
+ self,
+ model: str,
+ raw_response: httpx.Response,
+ model_response: ImageResponse,
+ logging_obj: LiteLLMLoggingObj,
+ request_data: dict,
+ optional_params: dict,
+ litellm_params: dict,
+ encoding: Any,
+ api_key: Optional[str] = None,
+ json_mode: Optional[bool] = None,
+ ) -> ImageResponse:
+ """
+ Transform the Bria 3.2 response to litellm ImageResponse format.
+
+ Expected response format:
+ {
+ "image": {
+ "url": "https://...",
+ "content_type": "image/png",
+ "file_name": "...",
+ "file_size": 123456,
+ "width": 1024,
+ "height": 1024
+ }
+ }
+ """
+ try:
+ response_data = raw_response.json()
+ except Exception as e:
+ raise self.get_error_class(
+ error_message=f"Error transforming image generation response: {e}",
+ status_code=raw_response.status_code,
+ headers=raw_response.headers,
+ )
+
+ if not model_response.data:
+ model_response.data = []
+
+ # Handle Bria response format - uses "image" (singular) not "images"
+ image_data = response_data.get("image")
+ if image_data and isinstance(image_data, dict):
+ model_response.data.append(
+ ImageObject(
+ url=image_data.get("url", None),
+ b64_json=None, # Bria returns URLs only
+ )
+ )
+
+ return model_response
+
diff --git a/litellm/llms/fal_ai/image_generation/flux_pro_v11_ultra_transformation.py b/litellm/llms/fal_ai/image_generation/flux_pro_v11_ultra_transformation.py
new file mode 100644
index 00000000000..664f11d40dc
--- /dev/null
+++ b/litellm/llms/fal_ai/image_generation/flux_pro_v11_ultra_transformation.py
@@ -0,0 +1,263 @@
+from typing import TYPE_CHECKING, Any, List, Optional
+
+import httpx
+
+from litellm.types.llms.openai import OpenAIImageGenerationOptionalParams
+from litellm.types.utils import ImageObject, ImageResponse
+
+from .transformation import FalAIBaseConfig
+
+if TYPE_CHECKING:
+ from litellm.litellm_core_utils.litellm_logging import Logging as _LiteLLMLoggingObj
+
+ LiteLLMLoggingObj = _LiteLLMLoggingObj
+else:
+ LiteLLMLoggingObj = Any
+
+
+class FalAIFluxProV11UltraConfig(FalAIBaseConfig):
+ """
+ Configuration for Fal AI Flux Pro v1.1-ultra model.
+
+ FLUX Pro v1.1-ultra is a high-quality text-to-image model with enhanced detail
+ and support for image prompts.
+
+ Model endpoint: fal-ai/flux-pro/v1.1-ultra
+ Documentation: https://fal.ai/models/fal-ai/flux-pro/v1.1-ultra
+ """
+ IMAGE_GENERATION_ENDPOINT: str = "fal-ai/flux-pro/v1.1-ultra"
+
+ def get_supported_openai_params(
+ self, model: str
+ ) -> List[OpenAIImageGenerationOptionalParams]:
+ """
+ Get supported OpenAI parameters for Flux Pro v1.1-ultra.
+ """
+ return [
+ "n",
+ "response_format",
+ "size",
+ ]
+
+ def map_openai_params(
+ self,
+ non_default_params: dict,
+ optional_params: dict,
+ model: str,
+ drop_params: bool,
+ ) -> dict:
+ """
+ Map OpenAI parameters to Flux Pro v1.1-ultra parameters.
+
+ Mappings:
+ - n -> num_images (1-4, default 1)
+ - response_format -> output_format (jpeg or png)
+ - size -> aspect_ratio (21:9, 16:9, 4:3, 3:2, 1:1, 2:3, 3:4, 9:16, 9:21)
+ """
+ supported_params = self.get_supported_openai_params(model)
+
+ # Map OpenAI params to Flux Pro v1.1-ultra params
+ param_mapping = {
+ "n": "num_images",
+ "response_format": "output_format",
+ "size": "aspect_ratio",
+ }
+
+ for k in non_default_params.keys():
+ if k not in optional_params.keys():
+ if k in supported_params:
+ # Use mapped parameter name if exists
+ mapped_key = param_mapping.get(k, k)
+ mapped_value = non_default_params[k]
+
+ # Transform specific parameters
+ if k == "response_format":
+ # Map OpenAI response formats to image formats
+ if mapped_value in ["b64_json", "url"]:
+ mapped_value = "jpeg"
+ elif k == "size":
+ # Map OpenAI size format to Flux aspect ratio
+ mapped_value = self._map_aspect_ratio(mapped_value)
+
+ optional_params[mapped_key] = mapped_value
+ elif drop_params:
+ pass
+ else:
+ raise ValueError(
+ f"Parameter {k} is not supported for model {model}. Supported parameters are {supported_params}. Set drop_params=True to drop unsupported parameters."
+ )
+
+ return optional_params
+
+ def _map_aspect_ratio(self, size: str) -> str:
+ """
+ Map OpenAI size format to Flux Pro aspect ratio format.
+
+ OpenAI format: "1024x1024", "1792x1024", etc.
+ Flux format: "21:9", "16:9", "4:3", "3:2", "1:1", "2:3", "3:4", "9:16", "9:21"
+
+ Default: "16:9"
+ """
+ # Map common OpenAI sizes to Flux aspect ratios
+ size_to_aspect_ratio = {
+ "1024x1024": "1:1",
+ "512x512": "1:1",
+ "1792x1024": "16:9",
+ "1024x1792": "9:16",
+ "1024x768": "4:3",
+ "768x1024": "3:4",
+ "1536x1024": "3:2",
+ "1024x1536": "2:3",
+ "2048x876": "21:9",
+ "876x2048": "9:21",
+ }
+
+ if size in size_to_aspect_ratio:
+ return size_to_aspect_ratio[size]
+
+ # Parse custom size format "WIDTHxHEIGHT" and calculate aspect ratio
+ if "x" in size:
+ try:
+ width_str, height_str = size.split("x")
+ width = int(width_str)
+ height = int(height_str)
+
+ # Calculate aspect ratio and find closest match
+ ratio = width / height
+
+ # Map to closest supported aspect ratio
+ if 0.95 <= ratio <= 1.05: # Close to 1:1
+ return "1:1"
+ elif ratio >= 2.3: # Close to 21:9
+ return "21:9"
+ elif 1.7 <= ratio < 2.3: # Close to 16:9
+ return "16:9"
+ elif 1.3 <= ratio < 1.7: # Close to 4:3
+ return "4:3"
+ elif 1.4 <= ratio < 1.6: # Close to 3:2
+ return "3:2"
+ elif 0.6 <= ratio < 0.7: # Close to 3:4
+ return "3:4"
+ elif 0.65 <= ratio < 0.75: # Close to 2:3
+ return "2:3"
+ elif 0.5 <= ratio < 0.6: # Close to 9:16
+ return "9:16"
+ elif ratio < 0.5: # Close to 9:21
+ return "9:21"
+ except (ValueError, AttributeError, ZeroDivisionError):
+ pass
+
+ # Default to 16:9
+ return "16:9"
+
+ def transform_image_generation_request(
+ self,
+ model: str,
+ prompt: str,
+ optional_params: dict,
+ litellm_params: dict,
+ headers: dict,
+ ) -> dict:
+ """
+ Transform the image generation request to Flux Pro v1.1-ultra request body.
+
+ Required parameters:
+ - prompt: The prompt to generate an image from
+
+ Optional parameters:
+ - num_images: Number of images (1-4, default: 1)
+ - aspect_ratio: Aspect ratio (default: "16:9")
+ - raw: Generate less processed images (default: false)
+ - output_format: "jpeg" or "png" (default: "jpeg")
+ - image_url: Image URL for image-to-image generation
+ - sync_mode: Return data URI (default: false)
+ - safety_tolerance: Safety level "1"-"6" (default: "2")
+ - enable_safety_checker: Enable safety checker (default: true)
+ - seed: Random seed for reproducibility
+ - image_prompt_strength: Strength of image prompt 0-1 (default: 0.1)
+ - enhance_prompt: Enhance prompt for better results (default: false)
+ """
+ flux_pro_request_body = {
+ "prompt": prompt,
+ **optional_params,
+ }
+
+ return flux_pro_request_body
+
+ def transform_image_generation_response(
+ self,
+ model: str,
+ raw_response: httpx.Response,
+ model_response: ImageResponse,
+ logging_obj: LiteLLMLoggingObj,
+ request_data: dict,
+ optional_params: dict,
+ litellm_params: dict,
+ encoding: Any,
+ api_key: Optional[str] = None,
+ json_mode: Optional[bool] = None,
+ ) -> ImageResponse:
+ """
+ Transform the Flux Pro v1.1-ultra response to litellm ImageResponse format.
+
+ Expected response format:
+ {
+ "images": [
+ {
+ "url": "https://...",
+ "width": 1024,
+ "height": 768,
+ "content_type": "image/jpeg"
+ }
+ ],
+ "timings": {"inference": 2.5, ...},
+ "seed": 42,
+ "has_nsfw_concepts": [false],
+ "prompt": "original prompt"
+ }
+ """
+ try:
+ response_data = raw_response.json()
+ except Exception as e:
+ raise self.get_error_class(
+ error_message=f"Error transforming image generation response: {e}",
+ status_code=raw_response.status_code,
+ headers=raw_response.headers,
+ )
+
+ if not model_response.data:
+ model_response.data = []
+
+ # Handle Flux Pro v1.1-ultra response format
+ images = response_data.get("images", [])
+ if isinstance(images, list):
+ for image_data in images:
+ if isinstance(image_data, dict):
+ model_response.data.append(
+ ImageObject(
+ url=image_data.get("url", None),
+ b64_json=None, # Flux Pro returns URLs only
+ )
+ )
+ elif isinstance(image_data, str):
+ # If images is just a list of URLs
+ model_response.data.append(
+ ImageObject(
+ url=image_data,
+ b64_json=None,
+ )
+ )
+
+ # Add additional metadata from Flux Pro response
+ if hasattr(model_response, "_hidden_params"):
+ if "seed" in response_data:
+ model_response._hidden_params["seed"] = response_data["seed"]
+ if "timings" in response_data:
+ model_response._hidden_params["timings"] = response_data["timings"]
+ if "has_nsfw_concepts" in response_data:
+ model_response._hidden_params["has_nsfw_concepts"] = response_data[
+ "has_nsfw_concepts"
+ ]
+
+ return model_response
+
diff --git a/litellm/llms/fal_ai/image_generation/imagen4_transformation.py b/litellm/llms/fal_ai/image_generation/imagen4_transformation.py
new file mode 100644
index 00000000000..f38ced65313
--- /dev/null
+++ b/litellm/llms/fal_ai/image_generation/imagen4_transformation.py
@@ -0,0 +1,242 @@
+from typing import TYPE_CHECKING, Any, List, Optional
+
+import httpx
+
+from litellm.types.llms.openai import OpenAIImageGenerationOptionalParams
+from litellm.types.utils import ImageObject, ImageResponse
+
+from .transformation import FalAIBaseConfig
+
+if TYPE_CHECKING:
+ from litellm.litellm_core_utils.litellm_logging import Logging as _LiteLLMLoggingObj
+
+ LiteLLMLoggingObj = _LiteLLMLoggingObj
+else:
+ LiteLLMLoggingObj = Any
+
+
+class FalAIImagen4Config(FalAIBaseConfig):
+ """
+ Configuration for Fal AI Imagen4 model.
+
+ Google's highest quality image generation model available through Fal AI.
+
+ Model variants:
+ - fal-ai/imagen4/preview (Standard): $0.05 per image
+ - fal-ai/imagen4/preview/fast (Fast): $0.04 per image
+ - fal-ai/imagen4/preview/ultra (Ultra): $0.06 per image
+
+ Documentation: https://fal.ai/models/fal-ai/imagen4/preview
+ """
+ IMAGE_GENERATION_ENDPOINT: str = "fal-ai/imagen4/preview"
+
+ def get_supported_openai_params(
+ self, model: str
+ ) -> List[OpenAIImageGenerationOptionalParams]:
+ """
+ Get supported OpenAI parameters for Imagen4.
+ """
+ return [
+ "n",
+ "response_format",
+ "size",
+ ]
+
+ def map_openai_params(
+ self,
+ non_default_params: dict,
+ optional_params: dict,
+ model: str,
+ drop_params: bool,
+ ) -> dict:
+ """
+ Map OpenAI parameters to Imagen4 parameters.
+
+ Mappings:
+ - n -> num_images (1-4, default 1)
+ - size -> aspect_ratio (1:1, 16:9, 9:16, 3:4, 4:3)
+ - response_format -> ignored (Imagen4 returns URLs)
+ """
+ supported_params = self.get_supported_openai_params(model)
+
+ # Map OpenAI params to Imagen4 params
+ param_mapping = {
+ "n": "num_images",
+ "size": "aspect_ratio",
+ }
+
+ for k in non_default_params.keys():
+ if k not in optional_params.keys():
+ if k in supported_params:
+ # Use mapped parameter name if exists
+ mapped_key = param_mapping.get(k, k)
+ mapped_value = non_default_params[k]
+
+ # Transform specific parameters
+ if k == "response_format":
+ # Imagen4 always returns URLs, so we can ignore this
+ continue
+ elif k == "size":
+ # Map OpenAI size format to Imagen4 aspect ratio
+ mapped_value = self._map_aspect_ratio(mapped_value)
+
+ optional_params[mapped_key] = mapped_value
+ elif drop_params:
+ pass
+ else:
+ raise ValueError(
+ f"Parameter {k} is not supported for model {model}. Supported parameters are {supported_params}. Set drop_params=True to drop unsupported parameters."
+ )
+
+ return optional_params
+
+ def _map_aspect_ratio(self, size: str) -> str:
+ """
+ Map OpenAI size format to Imagen4 aspect ratio format.
+
+ OpenAI format: "1024x1024", "1792x1024", etc.
+ Imagen4 format: "1:1", "16:9", "9:16", "3:4", "4:3"
+
+ Available aspect ratios:
+ - 1:1 (default)
+ - 16:9
+ - 9:16
+ - 3:4
+ - 4:3
+ """
+ # Map common OpenAI sizes to Imagen4 aspect ratios
+ size_to_aspect_ratio = {
+ "1024x1024": "1:1",
+ "512x512": "1:1",
+ "1792x1024": "16:9",
+ "1024x1792": "9:16",
+ "1024x768": "4:3",
+ "768x1024": "3:4",
+ }
+
+ if size in size_to_aspect_ratio:
+ return size_to_aspect_ratio[size]
+
+ # Parse custom size format "WIDTHxHEIGHT" and calculate aspect ratio
+ if "x" in size:
+ try:
+ width_str, height_str = size.split("x")
+ width = int(width_str)
+ height = int(height_str)
+
+ # Calculate aspect ratio and find closest match
+ ratio = width / height
+
+ # Map to closest supported aspect ratio
+ if 0.95 <= ratio <= 1.05: # Close to 1:1
+ return "1:1"
+ elif ratio >= 1.7: # Close to 16:9
+ return "16:9"
+ elif ratio <= 0.6: # Close to 9:16
+ return "9:16"
+ elif ratio >= 1.2: # Close to 4:3
+ return "4:3"
+ elif ratio <= 0.8: # Close to 3:4
+ return "3:4"
+ except (ValueError, AttributeError, ZeroDivisionError):
+ pass
+
+ # Default to 1:1
+ return "1:1"
+
+ def transform_image_generation_request(
+ self,
+ model: str,
+ prompt: str,
+ optional_params: dict,
+ litellm_params: dict,
+ headers: dict,
+ ) -> dict:
+ """
+ Transform the image generation request to Imagen4 request body.
+
+ Required parameters:
+ - prompt: The text prompt describing what you want to see
+
+ Optional parameters:
+ - aspect_ratio: "1:1", "16:9", "9:16", "3:4", "4:3" (default: "1:1")
+ - num_images: Number of images (1-4, default: 1)
+ - resolution: "1K" or "2K" (default: "1K")
+ - seed: Random seed for reproducibility
+ - negative_prompt: Description of what to discourage (default: "")
+ """
+ imagen4_request_body = {
+ "prompt": prompt,
+ **optional_params,
+ }
+
+ return imagen4_request_body
+
+ def transform_image_generation_response(
+ self,
+ model: str,
+ raw_response: httpx.Response,
+ model_response: ImageResponse,
+ logging_obj: LiteLLMLoggingObj,
+ request_data: dict,
+ optional_params: dict,
+ litellm_params: dict,
+ encoding: Any,
+ api_key: Optional[str] = None,
+ json_mode: Optional[bool] = None,
+ ) -> ImageResponse:
+ """
+ Transform the Imagen4 response to litellm ImageResponse format.
+
+ Expected response format:
+ {
+ "images": [
+ {
+ "url": "https://...",
+ "content_type": "image/png",
+ "file_name": "z9RV14K95DvU.png",
+ "file_size": 4404019
+ }
+ ],
+ "seed": 42
+ }
+ """
+ try:
+ response_data = raw_response.json()
+ except Exception as e:
+ raise self.get_error_class(
+ error_message=f"Error transforming image generation response: {e}",
+ status_code=raw_response.status_code,
+ headers=raw_response.headers,
+ )
+
+ if not model_response.data:
+ model_response.data = []
+
+ # Handle Imagen4 response format
+ images = response_data.get("images", [])
+ if isinstance(images, list):
+ for image_data in images:
+ if isinstance(image_data, dict):
+ model_response.data.append(
+ ImageObject(
+ url=image_data.get("url", None),
+ b64_json=None, # Imagen4 returns URLs only
+ )
+ )
+ elif isinstance(image_data, str):
+ # If images is just a list of URLs
+ model_response.data.append(
+ ImageObject(
+ url=image_data,
+ b64_json=None,
+ )
+ )
+
+ # Add seed metadata from Imagen4 response
+ if hasattr(model_response, "_hidden_params"):
+ if "seed" in response_data:
+ model_response._hidden_params["seed"] = response_data["seed"]
+
+ return model_response
+
diff --git a/litellm/llms/fal_ai/image_generation/recraft_v3_transformation.py b/litellm/llms/fal_ai/image_generation/recraft_v3_transformation.py
new file mode 100644
index 00000000000..572a8a0f1c3
--- /dev/null
+++ b/litellm/llms/fal_ai/image_generation/recraft_v3_transformation.py
@@ -0,0 +1,226 @@
+from typing import TYPE_CHECKING, Any, List, Optional
+
+import httpx
+
+from litellm.types.llms.openai import OpenAIImageGenerationOptionalParams
+from litellm.types.utils import ImageObject, ImageResponse
+
+from .transformation import FalAIBaseConfig
+
+if TYPE_CHECKING:
+ from litellm.litellm_core_utils.litellm_logging import Logging as _LiteLLMLoggingObj
+
+ LiteLLMLoggingObj = _LiteLLMLoggingObj
+else:
+ LiteLLMLoggingObj = Any
+
+
+class FalAIRecraftV3Config(FalAIBaseConfig):
+ """
+ Configuration for Fal AI Recraft v3 Text-to-Image model.
+
+ Recraft v3 is a text-to-image model with multiple style options including
+ realistic images, digital illustrations, and vector illustrations.
+
+ Model endpoint: fal-ai/recraft/v3/text-to-image
+ Documentation: https://fal.ai/models/fal-ai/recraft/v3/text-to-image
+ """
+ IMAGE_GENERATION_ENDPOINT: str = "fal-ai/recraft/v3/text-to-image"
+
+ def get_supported_openai_params(
+ self, model: str
+ ) -> List[OpenAIImageGenerationOptionalParams]:
+ """
+ Get supported OpenAI parameters for Recraft v3.
+ """
+ return [
+ "n",
+ "response_format",
+ "size",
+ ]
+
+ def map_openai_params(
+ self,
+ non_default_params: dict,
+ optional_params: dict,
+ model: str,
+ drop_params: bool,
+ ) -> dict:
+ """
+ Map OpenAI parameters to Recraft v3 parameters.
+
+ Mappings:
+ - size -> image_size (can be preset or custom width/height)
+ - response_format -> ignored (Recraft returns URLs)
+ - n -> ignored (Recraft doesn't support multiple images)
+ """
+ supported_params = self.get_supported_openai_params(model)
+
+ # Map OpenAI params to Recraft v3 params
+ param_mapping = {
+ "size": "image_size",
+ }
+
+ for k in non_default_params.keys():
+ if k not in optional_params.keys():
+ if k in supported_params:
+ # Use mapped parameter name if exists
+ mapped_key = param_mapping.get(k, k)
+ mapped_value = non_default_params[k]
+
+ # Transform specific parameters
+ if k == "response_format":
+ # Recraft always returns URLs, so we can ignore this
+ continue
+ elif k == "n":
+ # Recraft doesn't support multiple images, ignore
+ continue
+ elif k == "size":
+ # Map OpenAI size format to Recraft image_size
+ mapped_value = self._map_image_size(mapped_value)
+
+ optional_params[mapped_key] = mapped_value
+ elif drop_params:
+ pass
+ else:
+ raise ValueError(
+ f"Parameter {k} is not supported for model {model}. Supported parameters are {supported_params}. Set drop_params=True to drop unsupported parameters."
+ )
+
+ return optional_params
+
+ def _map_image_size(self, size: str) -> Any:
+ """
+ Map OpenAI size format to Recraft v3 image_size format.
+
+ OpenAI format: "1024x1024", "1792x1024", etc.
+ Recraft format: Can be preset strings or {"width": int, "height": int}
+
+ Available presets:
+ - square_hd (default)
+ - square
+ - portrait_4_3
+ - portrait_16_9
+ - landscape_4_3
+ - landscape_16_9
+ """
+ # Map common OpenAI sizes to Recraft presets
+ size_mapping = {
+ "1024x1024": "square_hd",
+ "512x512": "square",
+ "768x1024": "portrait_4_3",
+ "576x1024": "portrait_16_9",
+ "1024x768": "landscape_4_3",
+ "1024x576": "landscape_16_9",
+ }
+
+ if size in size_mapping:
+ return size_mapping[size]
+
+ # Parse custom size format "WIDTHxHEIGHT"
+ if "x" in size:
+ try:
+ width, height = size.split("x")
+ return {
+ "width": int(width),
+ "height": int(height),
+ }
+ except (ValueError, AttributeError):
+ pass
+
+ # Default to square_hd
+ return "square_hd"
+
+ def transform_image_generation_request(
+ self,
+ model: str,
+ prompt: str,
+ optional_params: dict,
+ litellm_params: dict,
+ headers: dict,
+ ) -> dict:
+ """
+ Transform the image generation request to Recraft v3 request body.
+
+ Required parameters:
+ - prompt: Text prompt (max 1000 characters)
+
+ Optional parameters:
+ - image_size: Preset or {"width": int, "height": int} (default: "square_hd")
+ - style: Style preset (default: "realistic_image")
+ Options: "any", "realistic_image", "digital_illustration", "vector_illustration", etc.
+ - colors: Array of RGB color objects [{"r": 0-255, "g": 0-255, "b": 0-255}]
+ - enable_safety_checker: Enable safety checker (default: false)
+ - style_id: UUID for custom style reference
+
+ Note: Vector illustrations cost 2X as much.
+ """
+ recraft_request_body = {
+ "prompt": prompt,
+ **optional_params,
+ }
+
+ return recraft_request_body
+
+ def transform_image_generation_response(
+ self,
+ model: str,
+ raw_response: httpx.Response,
+ model_response: ImageResponse,
+ logging_obj: LiteLLMLoggingObj,
+ request_data: dict,
+ optional_params: dict,
+ litellm_params: dict,
+ encoding: Any,
+ api_key: Optional[str] = None,
+ json_mode: Optional[bool] = None,
+ ) -> ImageResponse:
+ """
+ Transform the Recraft v3 response to litellm ImageResponse format.
+
+ Expected response format:
+ {
+ "images": [
+ {
+ "url": "https://...",
+ "content_type": "image/webp",
+ "file_name": "...",
+ "file_size": 123456
+ }
+ ]
+ }
+ """
+ try:
+ response_data = raw_response.json()
+ except Exception as e:
+ raise self.get_error_class(
+ error_message=f"Error transforming image generation response: {e}",
+ status_code=raw_response.status_code,
+ headers=raw_response.headers,
+ )
+
+ if not model_response.data:
+ model_response.data = []
+
+ # Handle Recraft v3 response format
+ images = response_data.get("images", [])
+ if isinstance(images, list):
+ for image_data in images:
+ if isinstance(image_data, dict):
+ model_response.data.append(
+ ImageObject(
+ url=image_data.get("url", None),
+ b64_json=None, # Recraft returns URLs only
+ )
+ )
+ elif isinstance(image_data, str):
+ # If images is just a list of URLs
+ model_response.data.append(
+ ImageObject(
+ url=image_data,
+ b64_json=None,
+ )
+ )
+
+ return model_response
+
diff --git a/litellm/llms/fal_ai/image_generation/stable_diffusion_transformation.py b/litellm/llms/fal_ai/image_generation/stable_diffusion_transformation.py
new file mode 100644
index 00000000000..10e2c6b4161
--- /dev/null
+++ b/litellm/llms/fal_ai/image_generation/stable_diffusion_transformation.py
@@ -0,0 +1,281 @@
+from typing import TYPE_CHECKING, Any, List, Optional
+
+import httpx
+
+from litellm.types.llms.openai import OpenAIImageGenerationOptionalParams
+from litellm.types.utils import ImageObject, ImageResponse
+
+from .transformation import FalAIBaseConfig
+
+if TYPE_CHECKING:
+ from litellm.litellm_core_utils.litellm_logging import Logging as _LiteLLMLoggingObj
+
+ LiteLLMLoggingObj = _LiteLLMLoggingObj
+else:
+ LiteLLMLoggingObj = Any
+
+
+class FalAIStableDiffusionConfig(FalAIBaseConfig):
+ """
+ Configuration for Fal AI Stable Diffusion models.
+
+ Supports Stable Diffusion v3.5 variants and other Stable Diffusion models on Fal AI.
+
+ Example models:
+ - fal-ai/stable-diffusion-v35-medium
+ - fal-ai/stable-diffusion-v35-large
+
+ Documentation: https://fal.ai/models/fal-ai/stable-diffusion-v35-medium
+ """
+ IMAGE_GENERATION_ENDPOINT: str = "" # Will be set from model name
+
+ def get_complete_url(
+ self,
+ api_base: Optional[str],
+ api_key: Optional[str],
+ model: str,
+ optional_params: dict,
+ litellm_params: dict,
+ stream: Optional[bool] = None,
+ ) -> str:
+ """
+ Get the complete url for the request.
+
+ For Stable Diffusion models, extract the endpoint from the model name.
+ """
+ from litellm.secret_managers.main import get_secret_str
+
+ complete_url: str = (
+ api_base
+ or get_secret_str("FAL_AI_API_BASE")
+ or self.DEFAULT_BASE_URL
+ )
+
+ complete_url = complete_url.rstrip("/")
+
+ # Extract endpoint from model name
+ # e.g., "fal-ai/stable-diffusion-v35-medium" or "stable-diffusion-v35-medium"
+ endpoint = model
+ if "/" in model and not model.startswith("fal-ai/"):
+ # If model is like "custom/stable-diffusion-v35-medium", use full path
+ endpoint = model
+ elif not model.startswith("fal-ai/"):
+ # If model is just "stable-diffusion-v35-medium", prepend fal-ai
+ endpoint = f"fal-ai/{model}"
+
+ complete_url = f"{complete_url}/{endpoint}"
+ return complete_url
+
+ def get_supported_openai_params(
+ self, model: str
+ ) -> List[OpenAIImageGenerationOptionalParams]:
+ """
+ Get supported OpenAI parameters for Stable Diffusion models.
+ """
+ return [
+ "n",
+ "response_format",
+ "size",
+ ]
+
+ def map_openai_params(
+ self,
+ non_default_params: dict,
+ optional_params: dict,
+ model: str,
+ drop_params: bool,
+ ) -> dict:
+ """
+ Map OpenAI parameters to Stable Diffusion parameters.
+
+ Mappings:
+ - n -> num_images (1-4, default 1)
+ - response_format -> output_format (jpeg or png)
+ - size -> image_size (can be preset or custom width/height)
+ """
+ supported_params = self.get_supported_openai_params(model)
+
+ # Map OpenAI params to Stable Diffusion params
+ param_mapping = {
+ "n": "num_images",
+ "response_format": "output_format",
+ "size": "image_size",
+ }
+
+ for k in non_default_params.keys():
+ if k not in optional_params.keys():
+ if k in supported_params:
+ # Use mapped parameter name if exists
+ mapped_key = param_mapping.get(k, k)
+ mapped_value = non_default_params[k]
+
+ # Transform specific parameters
+ if k == "response_format":
+ # Map OpenAI response formats to image formats
+ if mapped_value in ["b64_json", "url"]:
+ mapped_value = "jpeg"
+ elif k == "size":
+ # Map OpenAI size format to Stable Diffusion image_size
+ mapped_value = self._map_image_size(mapped_value)
+
+ optional_params[mapped_key] = mapped_value
+ elif drop_params:
+ pass
+ else:
+ raise ValueError(
+ f"Parameter {k} is not supported for model {model}. Supported parameters are {supported_params}. Set drop_params=True to drop unsupported parameters."
+ )
+
+ return optional_params
+
+ def _map_image_size(self, size: str) -> Any:
+ """
+ Map OpenAI size format to Stable Diffusion image_size format.
+
+ OpenAI format: "1024x1024", "1792x1024", etc.
+ Stable Diffusion format: Can be preset strings or {"width": int, "height": int}
+
+ Available presets:
+ - square_hd
+ - square
+ - portrait_4_3
+ - portrait_16_9
+ - landscape_4_3 (default)
+ - landscape_16_9
+ """
+ # Map common OpenAI sizes to Stable Diffusion presets
+ size_mapping = {
+ "1024x1024": "square_hd",
+ "512x512": "square",
+ "768x1024": "portrait_4_3",
+ "576x1024": "portrait_16_9",
+ "1024x768": "landscape_4_3",
+ "1024x576": "landscape_16_9",
+ }
+
+ if size in size_mapping:
+ return size_mapping[size]
+
+ # Parse custom size format "WIDTHxHEIGHT"
+ if "x" in size:
+ try:
+ width, height = size.split("x")
+ return {
+ "width": int(width),
+ "height": int(height),
+ }
+ except (ValueError, AttributeError):
+ pass
+
+ # Default to landscape_4_3
+ return "landscape_4_3"
+
+ def transform_image_generation_request(
+ self,
+ model: str,
+ prompt: str,
+ optional_params: dict,
+ litellm_params: dict,
+ headers: dict,
+ ) -> dict:
+ """
+ Transform the image generation request to Stable Diffusion request body.
+
+ Required parameters:
+ - prompt: The prompt to generate an image from
+
+ Optional parameters:
+ - num_images: Number of images (1-4, default: 1)
+ - image_size: Size preset or {"width": int, "height": int} (default: landscape_4_3)
+ - output_format: "jpeg" or "png" (default: jpeg)
+ - sync_mode: Wait for image upload before returning (default: false)
+ - guidance_scale: CFG scale 0-20 (default: 4.5)
+ - num_inference_steps: Inference steps 1-50 (default: 40)
+ - seed: Random seed for reproducibility
+ - negative_prompt: Negative prompt string (default: "")
+ - enable_safety_checker: Enable safety checker (default: true)
+ """
+ stable_diffusion_request_body = {
+ "prompt": prompt,
+ **optional_params,
+ }
+
+ return stable_diffusion_request_body
+
+ def transform_image_generation_response(
+ self,
+ model: str,
+ raw_response: httpx.Response,
+ model_response: ImageResponse,
+ logging_obj: LiteLLMLoggingObj,
+ request_data: dict,
+ optional_params: dict,
+ litellm_params: dict,
+ encoding: Any,
+ api_key: Optional[str] = None,
+ json_mode: Optional[bool] = None,
+ ) -> ImageResponse:
+ """
+ Transform the Stable Diffusion response to litellm ImageResponse format.
+
+ Expected response format:
+ {
+ "images": [
+ {
+ "url": "https://...",
+ "width": 1024,
+ "height": 768,
+ "content_type": "image/jpeg"
+ }
+ ],
+ "timings": {"inference": 2.5, ...},
+ "seed": 42,
+ "has_nsfw_concepts": [false],
+ "prompt": "original prompt"
+ }
+ """
+ try:
+ response_data = raw_response.json()
+ except Exception as e:
+ raise self.get_error_class(
+ error_message=f"Error transforming image generation response: {e}",
+ status_code=raw_response.status_code,
+ headers=raw_response.headers,
+ )
+
+ if not model_response.data:
+ model_response.data = []
+
+ # Handle Stable Diffusion response format
+ images = response_data.get("images", [])
+ if isinstance(images, list):
+ for image_data in images:
+ if isinstance(image_data, dict):
+ model_response.data.append(
+ ImageObject(
+ url=image_data.get("url", None),
+ b64_json=None, # Stable Diffusion returns URLs only
+ )
+ )
+ elif isinstance(image_data, str):
+ # If images is just a list of URLs
+ model_response.data.append(
+ ImageObject(
+ url=image_data,
+ b64_json=None,
+ )
+ )
+
+ # Add additional metadata from Stable Diffusion response
+ if hasattr(model_response, "_hidden_params"):
+ if "seed" in response_data:
+ model_response._hidden_params["seed"] = response_data["seed"]
+ if "timings" in response_data:
+ model_response._hidden_params["timings"] = response_data["timings"]
+ if "has_nsfw_concepts" in response_data:
+ model_response._hidden_params["has_nsfw_concepts"] = response_data[
+ "has_nsfw_concepts"
+ ]
+
+ return model_response
+
diff --git a/litellm/llms/fal_ai/image_generation/transformation.py b/litellm/llms/fal_ai/image_generation/transformation.py
new file mode 100644
index 00000000000..04b7b167523
--- /dev/null
+++ b/litellm/llms/fal_ai/image_generation/transformation.py
@@ -0,0 +1,176 @@
+from typing import TYPE_CHECKING, Any, List, Optional
+
+import httpx
+
+from litellm.llms.base_llm.image_generation.transformation import (
+ BaseImageGenerationConfig,
+)
+from litellm.secret_managers.main import get_secret_str
+from litellm.types.llms.openai import (
+ AllMessageValues,
+ OpenAIImageGenerationOptionalParams,
+)
+from litellm.types.utils import ImageObject, ImageResponse
+
+if TYPE_CHECKING:
+ from litellm.litellm_core_utils.litellm_logging import Logging as _LiteLLMLoggingObj
+
+ LiteLLMLoggingObj = _LiteLLMLoggingObj
+else:
+ LiteLLMLoggingObj = Any
+
+
+class FalAIBaseConfig(BaseImageGenerationConfig):
+ """
+ Base configuration for Fal AI image generation models.
+ Handles common functionality like URL construction and authentication.
+ """
+ DEFAULT_BASE_URL: str = "https://fal.run"
+ IMAGE_GENERATION_ENDPOINT: str = ""
+
+ def get_complete_url(
+ self,
+ api_base: Optional[str],
+ api_key: Optional[str],
+ model: str,
+ optional_params: dict,
+ litellm_params: dict,
+ stream: Optional[bool] = None,
+ ) -> str:
+ """
+ Get the complete url for the request
+
+ Some providers need `model` in `api_base`
+ """
+ complete_url: str = (
+ api_base
+ or get_secret_str("FAL_AI_API_BASE")
+ or self.DEFAULT_BASE_URL
+ )
+
+ complete_url = complete_url.rstrip("/")
+ if self.IMAGE_GENERATION_ENDPOINT:
+ complete_url = f"{complete_url}/{self.IMAGE_GENERATION_ENDPOINT}"
+ return complete_url
+
+ def validate_environment(
+ self,
+ headers: dict,
+ model: str,
+ messages: List[AllMessageValues],
+ optional_params: dict,
+ litellm_params: dict,
+ api_key: Optional[str] = None,
+ api_base: Optional[str] = None,
+ ) -> dict:
+ final_api_key: Optional[str] = (
+ api_key or
+ get_secret_str("FAL_AI_API_KEY")
+ )
+ if not final_api_key:
+ raise ValueError("FAL_AI_API_KEY is not set")
+
+ headers["Authorization"] = f"Key {final_api_key}"
+ return headers
+
+ def transform_image_generation_response(
+ self,
+ model: str,
+ raw_response: httpx.Response,
+ model_response: ImageResponse,
+ logging_obj: LiteLLMLoggingObj,
+ request_data: dict,
+ optional_params: dict,
+ litellm_params: dict,
+ encoding: Any,
+ api_key: Optional[str] = None,
+ json_mode: Optional[bool] = None,
+ ) -> ImageResponse:
+ """
+ Transform the image generation response to the litellm image response
+ """
+ try:
+ response_data = raw_response.json()
+ except Exception as e:
+ raise self.get_error_class(
+ error_message=f"Error transforming image generation response: {e}",
+ status_code=raw_response.status_code,
+ headers=raw_response.headers,
+ )
+ if not model_response.data:
+ model_response.data = []
+
+ # Handle fal.ai response format
+ images = response_data.get("images", [])
+ if isinstance(images, list):
+ for image_data in images:
+ if isinstance(image_data, dict):
+ model_response.data.append(ImageObject(
+ url=image_data.get("url", None),
+ b64_json=image_data.get("b64_json", None),
+ ))
+ elif isinstance(image_data, str):
+ # If images is just a list of URLs
+ model_response.data.append(ImageObject(
+ url=image_data,
+ b64_json=None,
+ ))
+
+ return model_response
+
+
+class FalAIImageGenerationConfig(FalAIBaseConfig):
+ """
+ Default Fal AI image generation configuration for generic models.
+ """
+
+ def get_supported_openai_params(
+ self, model: str
+ ) -> List[OpenAIImageGenerationOptionalParams]:
+ """
+ Get supported OpenAI parameters for fal.ai image generation
+ """
+ return [
+ "n",
+ "response_format",
+ "size",
+ ]
+
+ def map_openai_params(
+ self,
+ non_default_params: dict,
+ optional_params: dict,
+ model: str,
+ drop_params: bool,
+ ) -> dict:
+ supported_params = self.get_supported_openai_params(model)
+ for k in non_default_params.keys():
+ if k not in optional_params.keys():
+ if k in supported_params:
+ optional_params[k] = non_default_params[k]
+ elif drop_params:
+ pass
+ else:
+ raise ValueError(
+ f"Parameter {k} is not supported for model {model}. Supported parameters are {supported_params}. Set drop_params=True to drop unsupported parameters."
+ )
+
+ return optional_params
+
+ def transform_image_generation_request(
+ self,
+ model: str,
+ prompt: str,
+ optional_params: dict,
+ litellm_params: dict,
+ headers: dict,
+ ) -> dict:
+ """
+ Transform the image generation request to the fal.ai image generation request body
+ """
+ fal_ai_image_generation_request_body = {
+ "prompt": prompt,
+ **optional_params,
+ }
+ return fal_ai_image_generation_request_body
+
diff --git a/litellm/llms/oci/chat/transformation.py b/litellm/llms/oci/chat/transformation.py
index 3ab827797c5..167ba26bacb 100644
--- a/litellm/llms/oci/chat/transformation.py
+++ b/litellm/llms/oci/chat/transformation.py
@@ -2,7 +2,8 @@ import base64
import datetime
import hashlib
import json
-from typing import TYPE_CHECKING, Any, AsyncIterator, Dict, List, Optional, Tuple, Union
+from dataclasses import dataclass
+from typing import TYPE_CHECKING, Any, AsyncIterator, Dict, List, Optional, Protocol, Tuple, Union
from urllib.parse import urlparse
import httpx
@@ -62,6 +63,47 @@ else:
LiteLLMLoggingObj = Any
+class OCISignerProtocol(Protocol):
+ """
+ Protocol for OCI request signers (e.g., oci.signer.Signer).
+
+ This protocol defines the interface expected for OCI SDK signer objects.
+ Compatible with the OCI Python SDK's Signer class.
+
+ See: https://docs.oracle.com/en-us/iaas/tools/python/latest/api/signing.html
+ """
+
+ def do_request_sign(self, request: Any, *, enforce_content_headers: bool = False) -> None:
+ """
+ Sign an HTTP request by adding authentication headers.
+
+ Args:
+ request: Request object with method, url, headers, body, and path_url attributes
+ enforce_content_headers: Whether to enforce content-type and content-length headers
+ """
+ ...
+
+
+@dataclass
+class OCIRequestWrapper:
+ """
+ Wrapper for HTTP requests compatible with OCI signer interface.
+
+ This class wraps request data in a format compatible with OCI SDK signers,
+ which expect objects with method, url, headers, body, and path_url attributes.
+ """
+ method: str
+ url: str
+ headers: dict
+ body: bytes
+
+ @property
+ def path_url(self) -> str:
+ """Returns the path + query string for OCI signing."""
+ parsed_url = urlparse(self.url)
+ return parsed_url.path + ("?" + parsed_url.query if parsed_url.query else "")
+
+
def sha256_base64(data: bytes) -> str:
digest = hashlib.sha256(data).digest()
return base64.b64encode(digest).decode()
@@ -228,29 +270,89 @@ class OCIChatConfig(BaseConfig):
return adapted_params
- def sign_request(
+ def _sign_with_oci_signer(
self,
headers: dict,
optional_params: dict,
request_data: dict,
api_base: str,
- api_key: Optional[str] = None,
- model: Optional[str] = None,
- stream: Optional[bool] = None,
- fake_stream: Optional[bool] = None,
- ) -> Tuple[dict, Optional[bytes]]:
+ ) -> Tuple[dict, bytes]:
"""
- Some providers like Bedrock require signing the request. The sign request funtion needs access to `request_data` and `complete_url`
- Args:
- headers: dict
- optional_params: dict
- request_data: dict - the request body being sent in http request
- api_base: str - the complete url being sent in http request
- Returns:
- dict - the signed headers
- """
- import json
+ Sign request using OCI SDK Signer object.
+ Args:
+ headers: Request headers to be signed
+ optional_params: Optional parameters including oci_signer
+ request_data: The request body dict to be sent in HTTP request
+ api_base: The complete URL for the HTTP request
+
+ Returns:
+ Tuple of (signed_headers, encoded_body)
+
+ Raises:
+ OCIError: If signing fails
+ ValueError: If HTTP method is unsupported
+ """
+ oci_signer = optional_params.get("oci_signer")
+ body = json.dumps(request_data).encode("utf-8")
+ method = str(optional_params.get("method", "POST")).upper()
+
+ if method not in ["POST", "GET", "PUT", "DELETE", "PATCH"]:
+ raise ValueError(f"Unsupported HTTP method: {method}")
+
+ prepared_headers = headers.copy()
+ prepared_headers.setdefault("content-type", "application/json")
+ prepared_headers.setdefault("content-length", str(len(body)))
+
+ request_wrapper = OCIRequestWrapper(
+ method=method,
+ url=api_base,
+ headers=prepared_headers,
+ body=body
+ )
+
+ if oci_signer is None:
+ raise ValueError("oci_signer cannot be None when calling _sign_with_oci_signer")
+
+ try:
+ oci_signer.do_request_sign(request_wrapper, enforce_content_headers=True)
+ except Exception as e:
+ raise OCIError(
+ status_code=500,
+ message=(
+ f"Failed to sign request with provided oci_signer: {str(e)}. "
+ "The signer must implement the OCI SDK Signer interface with a "
+ "do_request_sign(request, enforce_content_headers=True) method. "
+ "See: https://docs.oracle.com/en-us/iaas/tools/python/latest/api/signing.html"
+ )
+ ) from e
+
+ headers.update(request_wrapper.headers)
+ return headers, body
+
+ def _sign_with_manual_credentials(
+ self,
+ headers: dict,
+ optional_params: dict,
+ request_data: dict,
+ api_base: str,
+ ) -> Tuple[dict, None]:
+ """
+ Sign request using manual OCI credentials.
+
+ Args:
+ headers: Request headers to be signed
+ optional_params: Optional parameters including OCI credentials
+ request_data: The request body dict to be sent in HTTP request
+ api_base: The complete URL for the HTTP request
+
+ Returns:
+ Tuple of (signed_headers, None)
+
+ Raises:
+ Exception: If required credentials are missing
+ ImportError: If cryptography package is not installed
+ """
oci_region = optional_params.get("oci_region", "us-ashburn-1")
api_base = (
api_base
@@ -355,6 +457,69 @@ class OCIChatConfig(BaseConfig):
return headers, None
+ def sign_request(
+ self,
+ headers: dict,
+ optional_params: dict,
+ request_data: dict,
+ api_base: str,
+ api_key: Optional[str] = None,
+ model: Optional[str] = None,
+ stream: Optional[bool] = None,
+ fake_stream: Optional[bool] = None,
+ ) -> Tuple[dict, Optional[bytes]]:
+ """
+ Sign the OCI request by adding authentication headers.
+
+ Supports two signing modes:
+ 1. OCI SDK Signer: Use an oci_signer object to sign the request
+ 2. Manual Signing: Use OCI credentials to manually sign the request
+
+ Args:
+ headers: Request headers to be signed
+ optional_params: Optional parameters including auth credentials or oci_signer
+ request_data: The request body dict to be sent in HTTP request
+ api_base: The complete URL for the HTTP request
+ api_key: Optional API key (not used for OCI)
+ model: Optional model name
+ stream: Optional streaming flag
+ fake_stream: Optional fake streaming flag
+
+ Returns:
+ Tuple of (signed_headers, encoded_body):
+ - If oci_signer is provided: Returns (headers, body) where body is the encoded JSON
+ - If manual credentials are provided: Returns (headers, None) as body is not returned
+ for the manual signing path
+
+ Raises:
+ OCIError: If signing fails with oci_signer
+ Exception: If required credentials are missing
+ ImportError: If cryptography package is not installed (manual signing only)
+
+ Example:
+ >>> from oci.signer import Signer
+ >>> signer = Signer(
+ ... tenancy="ocid1.tenancy.oc1..",
+ ... user="ocid1.user.oc1..",
+ ... fingerprint="xx:xx:xx",
+ ... private_key_file_location="~/.oci/key.pem"
+ ... )
+ >>> headers, body = config.sign_request(
+ ... headers={},
+ ... optional_params={"oci_signer": signer},
+ ... request_data={"message": "Hello"},
+ ... api_base="https://inference.generativeai.us-ashburn-1.oci.oraclecloud.com/..."
+ ... )
+ """
+ oci_signer = optional_params.get("oci_signer")
+
+ # If a signer is provided, use it for request signing
+ if oci_signer is not None:
+ return self._sign_with_oci_signer(headers, optional_params, request_data, api_base)
+
+ # Standard manual credential signing
+ return self._sign_with_manual_credentials(headers, optional_params, request_data, api_base)
+
def validate_environment(
self,
headers: dict,
@@ -365,36 +530,67 @@ class OCIChatConfig(BaseConfig):
api_key: Optional[str] = None,
api_base: Optional[str] = None,
) -> dict:
+ """
+ Validate the OCI environment and credentials.
+
+ Supports two authentication modes:
+ 1. OCI SDK Signer: Pass an oci_signer object (e.g., oci.signer.Signer)
+ 2. Manual Credentials: Pass oci_user, oci_fingerprint, oci_tenancy, and oci_key/oci_key_file
+
+ Args:
+ headers: Request headers to populate
+ model: Model name
+ messages: List of chat messages
+ optional_params: Optional parameters including authentication credentials
+ litellm_params: LiteLLM parameters
+ api_key: Optional API key (not used for OCI)
+ api_base: Optional API base URL
+
+ Returns:
+ Updated headers dict
+
+ Raises:
+ Exception: If required parameters are missing or invalid
+ """
+ oci_signer = optional_params.get("oci_signer")
oci_region = optional_params.get("oci_region", "us-ashburn-1")
+
+ # Determine api_base
api_base = (
api_base
or litellm.api_base
or f"https://inference.generativeai.{oci_region}.oci.oraclecloud.com"
)
- oci_user = optional_params.get("oci_user")
- oci_fingerprint = optional_params.get("oci_fingerprint")
- oci_tenancy = optional_params.get("oci_tenancy")
- oci_key = optional_params.get("oci_key")
- oci_key_file = optional_params.get("oci_key_file")
- oci_compartment_id = optional_params.get("oci_compartment_id")
-
- if (
- not oci_user
- or not oci_fingerprint
- or not oci_tenancy
- or not (oci_key or oci_key_file)
- or not oci_compartment_id
- ):
- raise Exception(
- "Missing required parameters: oci_user, oci_fingerprint, oci_tenancy, oci_compartment_id "
- "and at least one of oci_key or oci_key_file."
- )
if not api_base:
raise Exception(
- "Either `api_base` must be provided or `litellm.api_base` must be set. Alternatively, you can set the `oci_region` optional parameter to use the default OCI region."
+ "Either `api_base` must be provided or `litellm.api_base` must be set. "
+ "Alternatively, you can set the `oci_region` optional parameter to use the default OCI region."
)
+ # Validate credentials only if signer is not provided
+ if oci_signer is None:
+ oci_user = optional_params.get("oci_user")
+ oci_fingerprint = optional_params.get("oci_fingerprint")
+ oci_tenancy = optional_params.get("oci_tenancy")
+ oci_key = optional_params.get("oci_key")
+ oci_key_file = optional_params.get("oci_key_file")
+ oci_compartment_id = optional_params.get("oci_compartment_id")
+
+ if (
+ not oci_user
+ or not oci_fingerprint
+ or not oci_tenancy
+ or not (oci_key or oci_key_file)
+ or not oci_compartment_id
+ ):
+ raise Exception(
+ "Missing required parameters: oci_user, oci_fingerprint, oci_tenancy, oci_compartment_id "
+ "and at least one of oci_key or oci_key_file. "
+ "Alternatively, provide an oci_signer object from the OCI SDK."
+ )
+
+ # Common header setup
headers.update(
{
"content-type": "application/json",
@@ -442,12 +638,12 @@ class OCIChatConfig(BaseConfig):
for openai_key, oci_key in open_ai_to_oci_param_map.items():
if oci_key and openai_key in optional_params:
selected_params[oci_key] = optional_params[openai_key] # type: ignore[index]
-
+
# Also check for already-mapped OCI params (for backward compatibility)
for oci_value in open_ai_to_oci_param_map.values():
if oci_value and oci_value in optional_params and oci_value not in selected_params:
selected_params[oci_value] = optional_params[oci_value] # type: ignore[index]
-
+
if "tools" in selected_params:
if vendor == OCIVendors.COHERE:
selected_params["tools"] = self.adapt_tool_definitions_to_cohere_standard( # type: ignore[assignment]
@@ -465,7 +661,7 @@ class OCIChatConfig(BaseConfig):
for msg in messages[:-1]: # All messages except the last one
role = msg.get("role")
content = msg.get("content")
-
+
if isinstance(content, list):
# Extract text from content array
text_content = ""
@@ -473,11 +669,11 @@ class OCIChatConfig(BaseConfig):
if isinstance(content_item, dict) and content_item.get("type") == "text":
text_content += content_item.get("text", "")
content = text_content
-
+
# Ensure content is a string
if not isinstance(content, str):
content = str(content) if content is not None else ""
-
+
# Handle tool calls
tool_calls: Optional[List[CohereToolCall]] = None
if role == "assistant" and "tool_calls" in msg and msg.get("tool_calls"): # type: ignore[union-attr,typeddict-item]
@@ -492,12 +688,12 @@ class OCIChatConfig(BaseConfig):
arguments = {}
else:
arguments = raw_arguments
-
+
tool_calls.append(CohereToolCall(
name=str(tool_call.get("function", {}).get("name", "")),
parameters=arguments
))
-
+
if role == "user":
chat_history.append(CohereMessage(role="USER", message=content))
elif role == "assistant":
@@ -505,11 +701,11 @@ class OCIChatConfig(BaseConfig):
elif role == "tool":
# Tool messages need special handling
chat_history.append(CohereMessage(
- role="TOOL",
+ role="TOOL",
message=content,
toolCalls=None # Tool messages don't have tool calls
))
-
+
return chat_history
def adapt_tool_definitions_to_cohere_standard(self, tools: List[Dict[str, Any]]) -> List[CohereTool]:
@@ -519,7 +715,7 @@ class OCIChatConfig(BaseConfig):
function_def = tool.get("function", {})
parameters = function_def.get("parameters", {}).get("properties", {})
required = function_def.get("parameters", {}).get("required", [])
-
+
parameter_definitions = {}
for param_name, param_schema in parameters.items():
parameter_definitions[param_name] = CohereParameterDefinition(
@@ -527,13 +723,13 @@ class OCIChatConfig(BaseConfig):
type=param_schema.get("type", "string"),
isRequired=param_name in required
)
-
+
cohere_tools.append(CohereTool(
name=function_def.get("name", ""),
description=function_def.get("description", ""),
parameterDefinitions=parameter_definitions
))
-
+
return cohere_tools
def _extract_text_content(self, content: Any) -> str:
@@ -586,7 +782,7 @@ class OCIChatConfig(BaseConfig):
user_messages = [msg for msg in messages if msg.get("role") == "user"]
if not user_messages:
raise Exception("No user message found for Cohere model")
-
+
# Create Cohere-specific chat request
chat_request = CohereChatRequest(
@@ -595,7 +791,7 @@ class OCIChatConfig(BaseConfig):
chatHistory=self.adapt_messages_to_cohere_standard(messages),
**self._get_optional_params(OCIVendors.COHERE, optional_params)
)
-
+
data = OCICompletionPayload(
compartmentId=oci_compartment_id,
servingMode=servingMode,
@@ -616,24 +812,24 @@ class OCIChatConfig(BaseConfig):
return data.model_dump(exclude_none=True)
def _handle_cohere_response(
- self,
- json_response: dict,
- model: str,
+ self,
+ json_response: dict,
+ model: str,
model_response: ModelResponse
) -> ModelResponse:
"""Handle Cohere-specific response format."""
cohere_response = CohereChatResult(**json_response)
# Cohere response format (uses camelCase)
model_id = model
-
+
# Set basic response info
model_response.model = model_id
model_response.created = int(datetime.datetime.now().timestamp())
-
+
# Extract the response text
response_text = cohere_response.chatResponse.text
oci_finish_reason = cohere_response.chatResponse.finishReason
-
+
# Map finish reason
if oci_finish_reason == "COMPLETE":
finish_reason = "stop"
@@ -641,7 +837,7 @@ class OCIChatConfig(BaseConfig):
finish_reason = "length"
else:
finish_reason = "stop"
-
+
# Handle tool calls
tool_calls: Optional[List[Dict[str, Any]]] = None
if cohere_response.chatResponse.toolCalls:
@@ -655,7 +851,7 @@ class OCIChatConfig(BaseConfig):
"arguments": json.dumps(tool_call.parameters)
}
})
-
+
# Create choice
from litellm.types.utils import Choices
choice = Choices(
@@ -668,7 +864,7 @@ class OCIChatConfig(BaseConfig):
finish_reason=finish_reason
)
model_response.choices = [choice]
-
+
# Extract usage info
usage_info = cohere_response.chatResponse.usage
from litellm.types.utils import Usage
@@ -677,13 +873,13 @@ class OCIChatConfig(BaseConfig):
completion_tokens=usage_info.completionTokens, # type: ignore[union-attr]
total_tokens=usage_info.totalTokens # type: ignore[union-attr]
)
-
+
return model_response
def _handle_generic_response(
- self,
- json: dict,
- model: str,
+ self,
+ json: dict,
+ model: str,
model_response: ModelResponse,
raw_response: httpx.Response
) -> ModelResponse:
@@ -695,7 +891,7 @@ class OCIChatConfig(BaseConfig):
message=f"Response cannot be casted to OCICompletionResponse: {str(e)}",
status_code=raw_response.status_code,
)
-
+
iso_str = completion_response.chatResponse.timeCreated
dt = datetime.datetime.fromisoformat(iso_str.replace("Z", "+00:00"))
model_response.created = int(dt.timestamp())
@@ -751,7 +947,7 @@ class OCIChatConfig(BaseConfig):
)
vendor = get_vendor_from_model(model)
-
+
# Handle response based on vendor type
if vendor == OCIVendors.COHERE:
model_response = self._handle_cohere_response(json, model, model_response)
@@ -1080,7 +1276,7 @@ class OCIStreamWrapper(CustomStreamWrapper):
if not chunk.startswith("data:"):
raise ValueError(f"Chunk does not start with 'data:': {chunk}")
dict_chunk = json.loads(chunk[5:]) # Remove 'data: ' prefix and parse JSON
-
+
# Check if this is a Cohere stream chunk
if "apiFormat" in dict_chunk and dict_chunk.get("apiFormat") == "COHERE":
return self._handle_cohere_stream_chunk(dict_chunk)
diff --git a/litellm/llms/openai/openai.py b/litellm/llms/openai/openai.py
index 324205237dc..492ed624231 100644
--- a/litellm/llms/openai/openai.py
+++ b/litellm/llms/openai/openai.py
@@ -1203,7 +1203,6 @@ class OpenAIChatCompletion(BaseLLM, BaseOpenAILLM):
) -> EmbeddingResponse:
super().embedding()
try:
- model = model
data = {"model": model, "input": input, **optional_params}
max_retries = max_retries or litellm.DEFAULT_MAX_RETRIES
if not isinstance(max_retries, int):
@@ -1332,7 +1331,6 @@ class OpenAIChatCompletion(BaseLLM, BaseOpenAILLM):
) -> ImageResponse:
data = {}
try:
- model = model
data = {"model": model, "prompt": prompt, **optional_params}
max_retries = data.pop("max_retries", 2)
if not isinstance(max_retries, int):
diff --git a/litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py b/litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py
index 257c6a599f9..112d3783787 100644
--- a/litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py
+++ b/litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py
@@ -220,11 +220,8 @@ class VertexGeminiConfig(VertexAIBaseConfig, BaseConfig):
def _supports_penalty_parameters(self, model: str) -> bool:
unsupported_models = ["gemini-2.5-pro-preview-06-05"]
-
- for pattern in unsupported_models:
- if model in pattern:
- return False
-
+ if model in unsupported_models:
+ return False
return True
def get_supported_openai_params(self, model: str) -> List[str]:
@@ -416,7 +413,7 @@ class VertexGeminiConfig(VertexAIBaseConfig, BaseConfig):
# Handle tools with 'type' field (OpenAI spec compliance) Ignore this field -> https://github.com/BerriAI/litellm/issues/14644#issuecomment-3342061838
if "type" in tool:
- del tool["type"] # type: ignore
+ tool = {k: tool[k] for k in tool if k != "type"}
tool_name = list(tool.keys())[0] if len(tool.keys()) == 1 else None
if tool_name and (
diff --git a/litellm/main.py b/litellm/main.py
index aa52795f435..b7af4e8d39c 100644
--- a/litellm/main.py
+++ b/litellm/main.py
@@ -5298,11 +5298,15 @@ def moderation(
or get_secret_str("OPENAI_API_KEY")
)
+ # Extract api_base from kwargs
+ api_base = kwargs.get("api_base", None)
+
openai_client = kwargs.get("client", None)
if openai_client is None:
- openai_client = openai.OpenAI(
- api_key=api_key,
- )
+ if api_base is not None:
+ openai_client = openai.OpenAI(api_key=api_key, base_url=api_base)
+ else:
+ openai_client = openai.OpenAI(api_key=api_key)
if model is not None:
response = openai_client.moderations.create(input=input, model=model)
@@ -5332,21 +5336,11 @@ async def amoderation(
or litellm.openai_key
or get_secret_str("OPENAI_API_KEY")
)
- openai_client = kwargs.get("client", None)
- if openai_client is None or not isinstance(openai_client, AsyncOpenAI):
- # call helper to get OpenAI client
- # _get_openai_client maintains in-memory caching logic for OpenAI clients
- _openai_client: AsyncOpenAI = openai_chat_completions._get_openai_client( # type: ignore
- is_async=True,
- api_key=api_key,
- )
- else:
- _openai_client = openai_client
-
optional_params = GenericLiteLLMParams(**kwargs)
litellm_logging_obj: Optional[LiteLLMLoggingObj] = kwargs.get(
"litellm_logging_obj", None
)
+ _dynamic_api_base = None
try:
(
model,
@@ -5363,6 +5357,18 @@ async def amoderation(
# `model` is optional field for moderation - get_llm_provider will throw BadRequestError if model is not set / not recognized
pass
+ openai_client = kwargs.get("client", None)
+ if openai_client is None or not isinstance(openai_client, AsyncOpenAI):
+ # call helper to get OpenAI client
+ # _get_openai_client maintains in-memory caching logic for OpenAI clients
+ _openai_client: AsyncOpenAI = openai_chat_completions._get_openai_client( # type: ignore
+ is_async=True,
+ api_key=api_key,
+ api_base=optional_params.api_base or _dynamic_api_base,
+ )
+ else:
+ _openai_client = openai_client
+
# update litellm_logging_obj with environment variables
custom_llm_provider = custom_llm_provider or litellm.LlmProviders.OPENAI.value
if litellm_logging_obj is not None:
diff --git a/litellm/model_prices_and_context_window_backup.json b/litellm/model_prices_and_context_window_backup.json
index 2eced0d9095..7103ffd457a 100644
--- a/litellm/model_prices_and_context_window_backup.json
+++ b/litellm/model_prices_and_context_window_backup.json
@@ -1106,6 +1106,7 @@
"supports_vision": true
},
"azure/eu/gpt-4o-2024-08-06": {
+ "deprecation_date": "2026-02-27",
"cache_read_input_token_cost": 1.375e-06,
"input_cost_per_token": 2.75e-06,
"litellm_provider": "azure",
@@ -1122,6 +1123,7 @@
"supports_vision": true
},
"azure/eu/gpt-4o-2024-11-20": {
+ "deprecation_date": "2026-03-01",
"cache_creation_input_token_cost": 1.38e-06,
"input_cost_per_token": 2.75e-06,
"litellm_provider": "azure",
@@ -1280,7 +1282,7 @@
},
"azure/global-standard/gpt-4o-2024-08-06": {
"cache_read_input_token_cost": 1.25e-06,
- "deprecation_date": "2025-08-20",
+ "deprecation_date": "2026-02-27",
"input_cost_per_token": 2.5e-06,
"litellm_provider": "azure",
"max_input_tokens": 128000,
@@ -1297,7 +1299,7 @@
},
"azure/global-standard/gpt-4o-2024-11-20": {
"cache_read_input_token_cost": 1.25e-06,
- "deprecation_date": "2025-12-20",
+ "deprecation_date": "2026-03-01",
"input_cost_per_token": 2.5e-06,
"litellm_provider": "azure",
"max_input_tokens": 128000,
@@ -1326,6 +1328,7 @@
"supports_vision": true
},
"azure/global/gpt-4o-2024-08-06": {
+ "deprecation_date": "2026-02-27",
"cache_read_input_token_cost": 1.25e-06,
"input_cost_per_token": 2.5e-06,
"litellm_provider": "azure",
@@ -1342,6 +1345,7 @@
"supports_vision": true
},
"azure/global/gpt-4o-2024-11-20": {
+ "deprecation_date": "2026-03-01",
"cache_read_input_token_cost": 1.25e-06,
"input_cost_per_token": 2.5e-06,
"litellm_provider": "azure",
@@ -1625,6 +1629,7 @@
"supports_web_search": false
},
"azure/gpt-4.1-2025-04-14": {
+ "deprecation_date": "2026-11-04",
"cache_read_input_token_cost": 5e-07,
"input_cost_per_token": 2e-06,
"input_cost_per_token_batches": 1e-06,
@@ -1691,6 +1696,7 @@
"supports_web_search": false
},
"azure/gpt-4.1-mini-2025-04-14": {
+ "deprecation_date": "2026-11-04",
"cache_read_input_token_cost": 1e-07,
"input_cost_per_token": 4e-07,
"input_cost_per_token_batches": 2e-07,
@@ -1756,6 +1762,7 @@
"supports_vision": true
},
"azure/gpt-4.1-nano-2025-04-14": {
+ "deprecation_date": "2026-11-04",
"cache_read_input_token_cost": 2.5e-08,
"input_cost_per_token": 1e-07,
"input_cost_per_token_batches": 5e-08,
@@ -1837,6 +1844,7 @@
"supports_vision": true
},
"azure/gpt-4o-2024-08-06": {
+ "deprecation_date": "2026-02-27",
"cache_read_input_token_cost": 1.25e-06,
"input_cost_per_token": 2.5e-06,
"litellm_provider": "azure",
@@ -1853,6 +1861,7 @@
"supports_vision": true
},
"azure/gpt-4o-2024-11-20": {
+ "deprecation_date": "2026-03-01",
"cache_read_input_token_cost": 1.25e-06,
"input_cost_per_token": 2.75e-06,
"litellm_provider": "azure",
@@ -2604,6 +2613,7 @@
"supports_vision": true
},
"azure/o3-2025-04-16": {
+ "deprecation_date": "2026-04-16",
"cache_read_input_token_cost": 2.5e-06,
"input_cost_per_token": 1e-05,
"litellm_provider": "azure",
@@ -2832,6 +2842,7 @@
"output_cost_per_token": 0.0
},
"azure/text-embedding-3-small": {
+ "deprecation_date": "2026-04-30",
"input_cost_per_token": 2e-08,
"litellm_provider": "azure",
"max_input_tokens": 8191,
@@ -2870,6 +2881,7 @@
"mode": "audio_speech"
},
"azure/us/gpt-4o-2024-08-06": {
+ "deprecation_date": "2026-02-27",
"cache_read_input_token_cost": 1.375e-06,
"input_cost_per_token": 2.75e-06,
"litellm_provider": "azure",
@@ -2886,6 +2898,7 @@
"supports_vision": true
},
"azure/us/gpt-4o-2024-11-20": {
+ "deprecation_date": "2026-03-01",
"cache_creation_input_token_cost": 1.38e-06,
"input_cost_per_token": 2.75e-06,
"litellm_provider": "azure",
@@ -3385,7 +3398,7 @@
"source": "https://azure.microsoft.com/en-us/pricing/details/ai-foundry-models/microsoft/",
"supports_reasoning": true,
"supports_tool_choice": true
- },
+ },
"azure_ai/cohere-rerank-v3-english": {
"input_cost_per_query": 0.002,
"input_cost_per_token": 0.0,
@@ -4911,7 +4924,7 @@
"cache_creation_input_token_cost": 3.75e-06,
"cache_creation_input_token_cost_above_1hr": 6e-06,
"cache_read_input_token_cost": 3e-07,
- "deprecation_date": "2026-02-01",
+ "deprecation_date": "2026-02-19",
"input_cost_per_token": 3e-06,
"litellm_provider": "anthropic",
"max_input_tokens": 200000,
@@ -4968,7 +4981,6 @@
"cache_creation_input_token_cost": 3e-07,
"cache_creation_input_token_cost_above_1hr": 6e-06,
"cache_read_input_token_cost": 3e-08,
- "deprecation_date": "2025-03-01",
"input_cost_per_token": 2.5e-07,
"litellm_provider": "anthropic",
"max_input_tokens": 200000,
@@ -4988,7 +5000,7 @@
"cache_creation_input_token_cost": 1.875e-05,
"cache_creation_input_token_cost_above_1hr": 6e-06,
"cache_read_input_token_cost": 1.5e-06,
- "deprecation_date": "2025-03-01",
+ "deprecation_date": "2026-05-01",
"input_cost_per_token": 1.5e-05,
"litellm_provider": "anthropic",
"max_input_tokens": 200000,
@@ -5172,6 +5184,7 @@
"cache_creation_input_token_cost_above_1hr": 3e-05,
"cache_read_input_token_cost": 1.5e-06,
"input_cost_per_token": 1.5e-05,
+ "deprecation_date": "2026-08-05",
"litellm_provider": "anthropic",
"max_input_tokens": 200000,
"max_output_tokens": 32000,
@@ -5199,6 +5212,7 @@
"cache_creation_input_token_cost_above_1hr": 3e-05,
"cache_read_input_token_cost": 1.5e-06,
"input_cost_per_token": 1.5e-05,
+ "deprecation_date": "2026-05-14",
"litellm_provider": "anthropic",
"max_input_tokens": 200000,
"max_output_tokens": 32000,
@@ -5222,6 +5236,7 @@
"tool_use_system_prompt_tokens": 159
},
"claude-sonnet-4-20250514": {
+ "deprecation_date": "2026-05-14",
"cache_creation_input_token_cost": 3.75e-06,
"cache_creation_input_token_cost_above_1hr": 6e-06,
"cache_read_input_token_cost": 3e-07,
@@ -7753,7 +7768,7 @@
"supports_function_calling": true,
"supports_reasoning": true,
"supports_tool_choice": true
- },
+ },
"dolphin": {
"input_cost_per_token": 5e-07,
"litellm_provider": "nlp_cloud",
@@ -7847,7 +7862,7 @@
"input_cost_per_query": 5e-03,
"litellm_provider": "perplexity",
"mode": "search"
- },
+ },
"elevenlabs/scribe_v1": {
"input_cost_per_second": 6.11e-05,
"litellm_provider": "elevenlabs",
@@ -7993,6 +8008,7 @@
"cache_creation_input_token_cost": 1.375e-06,
"cache_read_input_token_cost": 1.1e-07,
"input_cost_per_token": 1.1e-06,
+ "deprecation_date": "2026-10-15",
"litellm_provider": "bedrock",
"max_input_tokens": 200000,
"max_output_tokens": 8192,
@@ -8243,6 +8259,46 @@
"supports_function_calling": true,
"supports_tool_choice": false
},
+ "fal_ai/bria/text-to-image/3.2": {
+ "litellm_provider": "fal_ai",
+ "mode": "image_generation",
+ "output_cost_per_image": 0.0398,
+ "supported_endpoints": [
+ "/v1/images/generations"
+ ]
+ },
+ "fal_ai/fal-ai/flux-pro/v1.1-ultra": {
+ "litellm_provider": "fal_ai",
+ "mode": "image_generation",
+ "output_cost_per_image": 0.0398,
+ "supported_endpoints": [
+ "/v1/images/generations"
+ ]
+ },
+ "fal_ai/fal-ai/imagen4/preview": {
+ "litellm_provider": "fal_ai",
+ "mode": "image_generation",
+ "output_cost_per_image": 0.0398,
+ "supported_endpoints": [
+ "/v1/images/generations"
+ ]
+ },
+ "fal_ai/fal-ai/recraft/v3/text-to-image": {
+ "litellm_provider": "fal_ai",
+ "mode": "image_generation",
+ "output_cost_per_image": 0.0398,
+ "supported_endpoints": [
+ "/v1/images/generations"
+ ]
+ },
+ "fal_ai/fal-ai/stable-diffusion-v35-medium": {
+ "litellm_provider": "fal_ai",
+ "mode": "image_generation",
+ "output_cost_per_image": 0.0398,
+ "supported_endpoints": [
+ "/v1/images/generations"
+ ]
+ },
"featherless_ai/featherless-ai/Qwerky-72B": {
"litellm_provider": "featherless_ai",
"max_input_tokens": 32768,
@@ -10453,6 +10509,18 @@
"supports_tool_choice": true,
"supports_vision": true
},
+ "gemini/gemini-embedding-001": {
+ "input_cost_per_token": 1.5e-07,
+ "litellm_provider": "gemini",
+ "max_input_tokens": 2048,
+ "max_tokens": 2048,
+ "mode": "embedding",
+ "output_cost_per_token": 0,
+ "output_vector_size": 3072,
+ "rpm": 10000,
+ "source": "https://ai.google.dev/gemini-api/docs/embeddings#model-versions",
+ "tpm": 10000000
+ },
"gemini/gemini-1.5-flash": {
"input_cost_per_token": 7.5e-08,
"input_cost_per_token_above_128k_tokens": 1.5e-07,
@@ -12397,6 +12465,7 @@
"supports_tool_choice": true
},
"gpt-3.5-turbo-1106": {
+ "deprecation_date": "2026-09-28",
"input_cost_per_token": 1e-06,
"litellm_provider": "openai",
"max_input_tokens": 16385,
@@ -12466,6 +12535,7 @@
"supports_tool_choice": true
},
"gpt-4-0125-preview": {
+ "deprecation_date": "2026-03-26",
"input_cost_per_token": 1e-05,
"litellm_provider": "openai",
"max_input_tokens": 128000,
@@ -12506,6 +12576,7 @@
"supports_tool_choice": true
},
"gpt-4-1106-preview": {
+ "deprecation_date": "2026-03-26",
"input_cost_per_token": 1e-05,
"litellm_provider": "openai",
"max_input_tokens": 128000,
@@ -15830,6 +15901,20 @@
"max_tokens": 8192,
"mode": "embedding"
},
+ "mistral/codestral-embed": {
+ "input_cost_per_token": 0.15e-06,
+ "litellm_provider": "mistral",
+ "max_input_tokens": 8192,
+ "max_tokens": 8192,
+ "mode": "embedding"
+ },
+ "mistral/codestral-embed-2505": {
+ "input_cost_per_token": 0.15e-06,
+ "litellm_provider": "mistral",
+ "max_input_tokens": 8192,
+ "max_tokens": 8192,
+ "mode": "embedding"
+ },
"mistral/mistral-large-2402": {
"input_cost_per_token": 4e-06,
"litellm_provider": "mistral",
@@ -16563,6 +16648,7 @@
"supports_vision": true
},
"o1-mini-2024-09-12": {
+ "deprecation_date": "2025-10-27",
"cache_read_input_token_cost": 1.5e-06,
"input_cost_per_token": 3e-06,
"litellm_provider": "openai",
@@ -17733,24 +17819,24 @@
"supports_vision": true,
"tool_use_system_prompt_tokens": 159
},
- "openrouter/anthropic/claude-sonnet-4.5": {
- "input_cost_per_image": 0.0048,
- "input_cost_per_token": 3e-06,
- "input_cost_per_token_above_200k_tokens": 6e-06,
- "output_cost_per_token_above_200k_tokens": 2.25e-05,
+ "openrouter/anthropic/claude-haiku-4.5": {
+ "cache_creation_input_token_cost": 1.25e-06,
+ "cache_read_input_token_cost": 1e-07,
+ "input_cost_per_token": 1e-06,
"litellm_provider": "openrouter",
- "max_input_tokens": 1000000,
- "max_output_tokens": 1000000,
- "max_tokens": 1000000,
+ "max_input_tokens": 200000,
+ "max_output_tokens": 200000,
+ "max_tokens": 200000,
"mode": "chat",
- "output_cost_per_token": 1.5e-05,
+ "output_cost_per_token": 5e-06,
"supports_assistant_prefill": true,
"supports_computer_use": true,
"supports_function_calling": true,
+ "supports_prompt_caching": true,
"supports_reasoning": true,
"supports_tool_choice": true,
"supports_vision": true,
- "tool_use_system_prompt_tokens": 159
+ "tool_use_system_prompt_tokens": 346
},
"openrouter/bytedance/ui-tars-1.5-7b": {
"input_cost_per_token": 1e-07,
@@ -19166,7 +19252,7 @@
"supports_function_calling": true,
"supports_reasoning": true,
"supports_tool_choice": true
- },
+ },
"qwen.qwen3-32b-v1:0": {
"input_cost_per_token": 1.5e-07,
"litellm_provider": "bedrock_converse",
@@ -19178,7 +19264,7 @@
"supports_function_calling": true,
"supports_reasoning": true,
"supports_tool_choice": true
- },
+ },
"recraft/recraftv2": {
"litellm_provider": "recraft",
"mode": "image_generation",
diff --git a/litellm/proxy/_experimental/mcp_server/discoverable_endpoints.py b/litellm/proxy/_experimental/mcp_server/discoverable_endpoints.py
index 59a443f7b79..583c83cca51 100644
--- a/litellm/proxy/_experimental/mcp_server/discoverable_endpoints.py
+++ b/litellm/proxy/_experimental/mcp_server/discoverable_endpoints.py
@@ -20,6 +20,55 @@ router = APIRouter(
)
+def get_request_base_url(request: Request) -> str:
+ """
+ Get the base URL for the request, considering X-Forwarded-* headers.
+
+ When behind a proxy (like nginx), the proxy may set:
+ - X-Forwarded-Proto: The original protocol (http/https)
+ - X-Forwarded-Host: The original host (may include port)
+ - X-Forwarded-Port: The original port (if not in Host header)
+
+ Args:
+ request: FastAPI Request object
+
+ Returns:
+ The reconstructed base URL (e.g., "https://proxy.example.com")
+ """
+ base_url = str(request.base_url).rstrip("/")
+ parsed = urlparse(base_url)
+
+ # Get forwarded headers
+ x_forwarded_proto = request.headers.get("X-Forwarded-Proto")
+ x_forwarded_host = request.headers.get("X-Forwarded-Host")
+ x_forwarded_port = request.headers.get("X-Forwarded-Port")
+
+ # Start with the original scheme
+ scheme = x_forwarded_proto if x_forwarded_proto else parsed.scheme
+
+ # Handle host and port
+ if x_forwarded_host:
+ # X-Forwarded-Host may already include port (e.g., "example.com:8080")
+ if ":" in x_forwarded_host and not x_forwarded_host.startswith("["):
+ # Host includes port
+ netloc = x_forwarded_host
+ elif x_forwarded_port:
+ # Port is separate
+ netloc = f"{x_forwarded_host}:{x_forwarded_port}"
+ else:
+ # Just host, no explicit port
+ netloc = x_forwarded_host
+ else:
+ # No X-Forwarded-Host, use original netloc
+ netloc = parsed.netloc
+ if x_forwarded_port and ":" not in netloc:
+ # Add forwarded port if not already in netloc
+ netloc = f"{netloc}:{x_forwarded_port}"
+
+ # Reconstruct the URL
+ return urlunparse((scheme, netloc, parsed.path, "", "", ""))
+
+
def encode_state_with_base_url(
base_url: str,
original_state: str,
@@ -107,7 +156,9 @@ async def authorize(
# Parse it to remove any existing query
parsed = urlparse(redirect_uri)
base_url = urlunparse(parsed._replace(query=""))
- request_base_url = str(request.base_url).rstrip("/")
+
+ # Get the correct base URL considering X-Forwarded-* headers
+ request_base_url = get_request_base_url(request)
# Encode the base_url, original state, PKCE params, and client redirect_uri in encrypted state
encoded_state = encode_state_with_base_url(
@@ -177,7 +228,8 @@ async def token_endpoint(
if mcp_server.token_url is None:
raise HTTPException(status_code=400, detail="MCP server token url is not set")
- proxy_base_url = str(request.base_url).rstrip("/")
+ # Get the correct base URL considering X-Forwarded-* headers
+ proxy_base_url = get_request_base_url(request)
# Build token request data
token_data = {
@@ -251,7 +303,8 @@ async def callback(code: str, state: str):
async def oauth_protected_resource_mcp(
request: Request, mcp_server_name: Optional[str] = None
):
- request_base_url = str(request.base_url).rstrip("/")
+ # Get the correct base URL considering X-Forwarded-* headers
+ request_base_url = get_request_base_url(request)
return {
"authorization_servers": [
(
@@ -273,7 +326,8 @@ async def oauth_protected_resource_mcp(
async def oauth_authorization_server_mcp(
request: Request, mcp_server_name: Optional[str] = None
):
- request_base_url = str(request.base_url).rstrip("/")
+ # Get the correct base URL considering X-Forwarded-* headers
+ request_base_url = get_request_base_url(request)
authorization_endpoint = (
f"{request_base_url}/{mcp_server_name}/authorize"
@@ -320,7 +374,8 @@ async def register_client(request: Request, mcp_server_name: Optional[str] = Non
global_mcp_server_manager,
)
- request_base_url = str(request.base_url).rstrip("/")
+ # Get the correct base URL considering X-Forwarded-* headers
+ request_base_url = get_request_base_url(request)
request_data = await _read_request_body(request=request)
data: dict = {**request_data}
diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/1162-278deed893787c5d.js b/litellm/proxy/_experimental/out/_next/static/chunks/1162-278deed893787c5d.js
new file mode 100644
index 00000000000..42e084fc3b7
--- /dev/null
+++ b/litellm/proxy/_experimental/out/_next/static/chunks/1162-278deed893787c5d.js
@@ -0,0 +1 @@
+"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1162,4851],{88009:function(e,t,n){n.d(t,{Z:function(){return l}});var r=n(1119),o=n(2265),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M464 144H160c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V160c0-8.8-7.2-16-16-16zm-52 268H212V212h200v200zm452-268H560c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V160c0-8.8-7.2-16-16-16zm-52 268H612V212h200v200zM464 544H160c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V560c0-8.8-7.2-16-16-16zm-52 268H212V612h200v200zm452-268H560c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V560c0-8.8-7.2-16-16-16zm-52 268H612V612h200v200z"}}]},name:"appstore",theme:"outlined"},i=n(55015),l=o.forwardRef(function(e,t){return o.createElement(i.Z,(0,r.Z)({},e,{ref:t,icon:a}))})},37527:function(e,t,n){n.d(t,{Z:function(){return l}});var r=n(1119),o=n(2265),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M894 462c30.9 0 43.8-39.7 18.7-58L530.8 126.2a31.81 31.81 0 00-37.6 0L111.3 404c-25.1 18.2-12.2 58 18.8 58H192v374h-72c-4.4 0-8 3.6-8 8v52c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-52c0-4.4-3.6-8-8-8h-72V462h62zM512 196.7l271.1 197.2H240.9L512 196.7zM264 462h117v374H264V462zm189 0h117v374H453V462zm307 374H642V462h118v374z"}}]},name:"bank",theme:"outlined"},i=n(55015),l=o.forwardRef(function(e,t){return o.createElement(i.Z,(0,r.Z)({},e,{ref:t,icon:a}))})},9775:function(e,t,n){n.d(t,{Z:function(){return l}});var r=n(1119),o=n(2265),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M888 792H200V168c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v688c0 4.4 3.6 8 8 8h752c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm-600-80h56c4.4 0 8-3.6 8-8V560c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v144c0 4.4 3.6 8 8 8zm152 0h56c4.4 0 8-3.6 8-8V384c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v320c0 4.4 3.6 8 8 8zm152 0h56c4.4 0 8-3.6 8-8V462c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v242c0 4.4 3.6 8 8 8zm152 0h56c4.4 0 8-3.6 8-8V304c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v400c0 4.4 3.6 8 8 8z"}}]},name:"bar-chart",theme:"outlined"},i=n(55015),l=o.forwardRef(function(e,t){return o.createElement(i.Z,(0,r.Z)({},e,{ref:t,icon:a}))})},11429:function(e,t,n){n.d(t,{Z:function(){return l}});var r=n(1119),o=n(2265),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M766.4 744.3c43.7 0 79.4-36.2 79.4-80.5 0-53.5-79.4-140.8-79.4-140.8S687 610.3 687 663.8c0 44.3 35.7 80.5 79.4 80.5zm-377.1-44.1c7.1 7.1 18.6 7.1 25.6 0l256.1-256c7.1-7.1 7.1-18.6 0-25.6l-256-256c-.6-.6-1.3-1.2-2-1.7l-78.2-78.2a9.11 9.11 0 00-12.8 0l-48 48a9.11 9.11 0 000 12.8l67.2 67.2-207.8 207.9c-7.1 7.1-7.1 18.6 0 25.6l255.9 256zm12.9-448.6l178.9 178.9H223.4l178.8-178.9zM904 816H120c-4.4 0-8 3.6-8 8v80c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-80c0-4.4-3.6-8-8-8z"}}]},name:"bg-colors",theme:"outlined"},i=n(55015),l=o.forwardRef(function(e,t){return o.createElement(i.Z,(0,r.Z)({},e,{ref:t,icon:a}))})},68208:function(e,t,n){n.d(t,{Z:function(){return l}});var r=n(1119),o=n(2265),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M856 376H648V168c0-8.8-7.2-16-16-16H168c-8.8 0-16 7.2-16 16v464c0 8.8 7.2 16 16 16h208v208c0 8.8 7.2 16 16 16h464c8.8 0 16-7.2 16-16V392c0-8.8-7.2-16-16-16zm-480 16v188H220V220h360v156H392c-8.8 0-16 7.2-16 16zm204 52v136H444V444h136zm224 360H444V648h188c8.8 0 16-7.2 16-16V444h156v360z"}}]},name:"block",theme:"outlined"},i=n(55015),l=o.forwardRef(function(e,t){return o.createElement(i.Z,(0,r.Z)({},e,{ref:t,icon:a}))})},83669:function(e,t,n){n.d(t,{Z:function(){return l}});var r=n(1119),o=n(2265),a={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"},i=n(55015),l=o.forwardRef(function(e,t){return o.createElement(i.Z,(0,r.Z)({},e,{ref:t,icon:a}))})},62670:function(e,t,n){n.d(t,{Z:function(){return l}});var r=n(1119),o=n(2265),a={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"},i=n(55015),l=o.forwardRef(function(e,t){return o.createElement(i.Z,(0,r.Z)({},e,{ref:t,icon:a}))})},29271:function(e,t,n){n.d(t,{Z:function(){return l}});var r=n(1119),o=n(2265),a={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:"M464 688a48 48 0 1096 0 48 48 0 10-96 0zm24-112h48c4.4 0 8-3.6 8-8V296c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v272c0 4.4 3.6 8 8 8z"}}]},name:"exclamation-circle",theme:"outlined"},i=n(55015),l=o.forwardRef(function(e,t){return o.createElement(i.Z,(0,r.Z)({},e,{ref:t,icon:a}))})},41169:function(e,t,n){n.d(t,{Z:function(){return l}});var r=n(1119),o=n(2265),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 472a40 40 0 1080 0 40 40 0 10-80 0zm367 352.9L696.3 352V178H768v-68H256v68h71.7v174L145 824.9c-2.8 7.4-4.3 15.2-4.3 23.1 0 35.3 28.7 64 64 64h614.6c7.9 0 15.7-1.5 23.1-4.3 33-12.7 49.4-49.8 36.6-82.8zM395.7 364.7V180h232.6v184.7L719.2 600c-20.7-5.3-42.1-8-63.9-8-61.2 0-119.2 21.5-165.3 60a188.78 188.78 0 01-121.3 43.9c-32.7 0-64.1-8.3-91.8-23.7l118.8-307.5zM210.5 844l41.7-107.8c35.7 18.1 75.4 27.8 116.6 27.8 61.2 0 119.2-21.5 165.3-60 33.9-28.2 76.3-43.9 121.3-43.9 35 0 68.4 9.5 97.6 27.1L813.5 844h-603z"}}]},name:"experiment",theme:"outlined"},i=n(55015),l=o.forwardRef(function(e,t){return o.createElement(i.Z,(0,r.Z)({},e,{ref:t,icon:a}))})},10798:function(e,t,n){n.d(t,{Z:function(){return l}});var r=n(1119),o=n(2265),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M880.1 154H143.9c-24.5 0-39.8 26.7-27.5 48L349 597.4V838c0 17.7 14.2 32 31.8 32h262.4c17.6 0 31.8-14.3 31.8-32V597.4L907.7 202c12.2-21.3-3.1-48-27.6-48zM603.4 798H420.6V642h182.9v156zm9.6-236.6l-9.5 16.6h-183l-9.5-16.6L212.7 226h598.6L613 561.4z"}}]},name:"filter",theme:"outlined"},i=n(55015),l=o.forwardRef(function(e,t){return o.createElement(i.Z,(0,r.Z)({},e,{ref:t,icon:a}))})},48231:function(e,t,n){n.d(t,{Z:function(){return l}});var r=n(1119),o=n(2265),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M888 792H200V168c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v688c0 4.4 3.6 8 8 8h752c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM305.8 637.7c3.1 3.1 8.1 3.1 11.3 0l138.3-137.6L583 628.5c3.1 3.1 8.2 3.1 11.3 0l275.4-275.3c3.1-3.1 3.1-8.2 0-11.3l-39.6-39.6a8.03 8.03 0 00-11.3 0l-230 229.9L461.4 404a8.03 8.03 0 00-11.3 0L266.3 586.7a8.03 8.03 0 000 11.3l39.5 39.7z"}}]},name:"line-chart",theme:"outlined"},i=n(55015),l=o.forwardRef(function(e,t){return o.createElement(i.Z,(0,r.Z)({},e,{ref:t,icon:a}))})},62272:function(e,t,n){n.d(t,{Z:function(){return l}});var r=n(1119),o=n(2265),a={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"},i=n(55015),l=o.forwardRef(function(e,t){return o.createElement(i.Z,(0,r.Z)({},e,{ref:t,icon:a}))})},28595:function(e,t,n){n.d(t,{Z:function(){return l}});var r=n(1119),o=n(2265),a={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:"M719.4 499.1l-296.1-215A15.9 15.9 0 00398 297v430c0 13.1 14.8 20.5 25.3 12.9l296.1-215a15.9 15.9 0 000-25.8zm-257.6 134V390.9L628.5 512 461.8 633.1z"}}]},name:"play-circle",theme:"outlined"},i=n(55015),l=o.forwardRef(function(e,t){return o.createElement(i.Z,(0,r.Z)({},e,{ref:t,icon:a}))})},34419:function(e,t,n){n.d(t,{Z:function(){return l}});var r=n(1119),o=n(2265),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M696 480H544V328c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v152H328c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h152v152c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V544h152c4.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:"plus-circle",theme:"outlined"},i=n(55015),l=o.forwardRef(function(e,t){return o.createElement(i.Z,(0,r.Z)({},e,{ref:t,icon:a}))})},23907:function(e,t,n){n.d(t,{Z:function(){return l}});var r=n(1119),o=n(2265),a={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"},i=n(55015),l=o.forwardRef(function(e,t){return o.createElement(i.Z,(0,r.Z)({},e,{ref:t,icon:a}))})},55322:function(e,t,n){n.d(t,{Z:function(){return l}});var r=n(1119),o=n(2265),a={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"},i=n(55015),l=o.forwardRef(function(e,t){return o.createElement(i.Z,(0,r.Z)({},e,{ref:t,icon:a}))})},41361:function(e,t,n){n.d(t,{Z:function(){return l}});var r=n(1119),o=n(2265),a={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"},i=n(55015),l=o.forwardRef(function(e,t){return o.createElement(i.Z,(0,r.Z)({},e,{ref:t,icon:a}))})},92414:function(e,t,n){n.d(t,{Z:function(){return b}});var r=n(5853),o=n(2265);n(42698),n(64016),n(8710);var a=n(33232),i=n(44140),l=n(58747);let c=e=>{var t=(0,r._T)(e,[]);return o.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),o.createElement("path",{d:"M18.031 16.6168L22.3137 20.8995L20.8995 22.3137L16.6168 18.031C15.0769 19.263 13.124 20 11 20C6.032 20 2 15.968 2 11C2 6.032 6.032 2 11 2C15.968 2 20 6.032 20 11C20 13.124 19.263 15.0769 18.031 16.6168ZM16.0247 15.8748C17.2475 14.6146 18 12.8956 18 11C18 7.1325 14.8675 4 11 4C7.1325 4 4 7.1325 4 11C4 14.8675 7.1325 18 11 18C12.8956 18 14.6146 17.2475 15.8748 16.0247L16.0247 15.8748Z"}))};var s=n(4537),d=n(9528),u=n(33044);let m=e=>{var t=(0,r._T)(e,[]);return o.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:"100%",height:"100%",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},t),o.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),o.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"}))};var h=n(97324),f=n(1153),p=n(96398);let g=(0,f.fn)("MultiSelect"),b=o.forwardRef((e,t)=>{let{defaultValue:n,value:f,onValueChange:b,placeholder:v="Select...",placeholderSearch:k="Search",disabled:x=!1,icon:y,children:w,className:C}=e,E=(0,r._T)(e,["defaultValue","value","onValueChange","placeholder","placeholderSearch","disabled","icon","children","className"]),[S,M]=(0,i.Z)(n,f),{reactElementChildren:z,optionsAvailable:Z}=(0,o.useMemo)(()=>{let e=o.Children.toArray(w).filter(o.isValidElement);return{reactElementChildren:e,optionsAvailable:(0,p.n0)("",e)}},[w]),[O,j]=(0,o.useState)(""),N=(null!=S?S:[]).length>0,_=(0,o.useMemo)(()=>O?(0,p.n0)(O,z):Z,[O,z,Z]),I=()=>{j("")};return o.createElement(d.R,Object.assign({as:"div",ref:t,defaultValue:S,value:S,onChange:e=>{null==b||b(e),M(e)},disabled:x,className:(0,h.q)("w-full min-w-[10rem] relative text-tremor-default",C)},E,{multiple:!0}),e=>{let{value:t}=e;return o.createElement(o.Fragment,null,o.createElement(d.R.Button,{className:(0,h.q)("w-full outline-none text-left whitespace-nowrap truncate rounded-tremor-default focus:ring-2 transition duration-100 border pr-8 py-1.5","border-tremor-border shadow-tremor-input focus:border-tremor-brand-subtle focus:ring-tremor-brand-muted","dark:border-dark-tremor-border dark:shadow-dark-tremor-input dark:focus:border-dark-tremor-brand-subtle dark:focus:ring-dark-tremor-brand-muted",y?"pl-11 -ml-0.5":"pl-3",(0,p.um)(t.length>0,x))},y&&o.createElement("span",{className:(0,h.q)("absolute inset-y-0 left-0 flex items-center ml-px pl-2.5")},o.createElement(y,{className:(0,h.q)(g("Icon"),"flex-none h-5 w-5","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")})),o.createElement("div",{className:"h-6 flex items-center"},t.length>0?o.createElement("div",{className:"flex flex-nowrap overflow-x-scroll [&::-webkit-scrollbar]:hidden [scrollbar-width:none] gap-x-1 mr-5 -ml-1.5 relative"},Z.filter(e=>t.includes(e.props.value)).map((e,n)=>{var r;return o.createElement("div",{key:n,className:(0,h.q)("max-w-[100px] lg:max-w-[200px] flex justify-center items-center pl-2 pr-1.5 py-1 font-medium","rounded-tremor-small","bg-tremor-background-muted dark:bg-dark-tremor-background-muted","bg-tremor-background-subtle dark:bg-dark-tremor-background-subtle","text-tremor-content-default dark:text-dark-tremor-content-default","text-tremor-content-emphasis dark:text-dark-tremor-content-emphasis")},o.createElement("div",{className:"text-xs truncate "},null!==(r=e.props.children)&&void 0!==r?r:e.props.value),o.createElement("div",{onClick:n=>{n.preventDefault();let r=t.filter(t=>t!==e.props.value);null==b||b(r),M(r)}},o.createElement(m,{className:(0,h.q)(g("clearIconItem"),"cursor-pointer rounded-tremor-full w-3.5 h-3.5 ml-2","text-tremor-content-subtle hover:text-tremor-content","dark:text-dark-tremor-content-subtle dark:hover:text-tremor-content")})))})):o.createElement("span",null,v)),o.createElement("span",{className:(0,h.q)("absolute inset-y-0 right-0 flex items-center mr-2.5")},o.createElement(l.Z,{className:(0,h.q)(g("arrowDownIcon"),"flex-none h-5 w-5","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")}))),N&&!x?o.createElement("button",{type:"button",className:(0,h.q)("absolute inset-y-0 right-0 flex items-center mr-8"),onClick:e=>{e.preventDefault(),M([]),null==b||b([])}},o.createElement(s.Z,{className:(0,h.q)(g("clearIconAllItems"),"flex-none h-4 w-4","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")})):null,o.createElement(u.u,{className:"absolute z-10 w-full",enter:"transition ease duration-100 transform",enterFrom:"opacity-0 -translate-y-4",enterTo:"opacity-100 translate-y-0",leave:"transition ease duration-100 transform",leaveFrom:"opacity-100 translate-y-0",leaveTo:"opacity-0 -translate-y-4"},o.createElement(d.R.Options,{className:(0,h.q)("divide-y overflow-y-auto outline-none rounded-tremor-default max-h-[228px] left-0 border my-1","bg-tremor-background border-tremor-border divide-tremor-border shadow-tremor-dropdown","dark:bg-dark-tremor-background dark:border-dark-tremor-border dark:divide-dark-tremor-border dark:shadow-dark-tremor-dropdown")},o.createElement("div",{className:(0,h.q)("flex items-center w-full px-2.5","bg-tremor-background-muted","dark:bg-dark-tremor-background-muted")},o.createElement("span",null,o.createElement(c,{className:(0,h.q)("flex-none w-4 h-4 mr-2","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")})),o.createElement("input",{name:"search",type:"input",autoComplete:"off",placeholder:k,className:(0,h.q)("w-full focus:outline-none focus:ring-none bg-transparent text-tremor-default py-2","text-tremor-content-emphasis","dark:text-dark-tremor-content-emphasis"),onKeyDown:e=>{"Space"===e.code&&""!==e.target.value&&e.stopPropagation()},onChange:e=>j(e.target.value),value:O})),o.createElement(a.Z.Provider,Object.assign({},{onBlur:{handleResetSearch:I}},{value:{selectedValue:t}}),_))))})});b.displayName="MultiSelect"},46030:function(e,t,n){n.d(t,{Z:function(){return d}});var r=n(5853);n(42698),n(64016),n(8710);var o=n(33232),a=n(2265),i=n(97324),l=n(1153),c=n(9528);let s=(0,l.fn)("MultiSelectItem"),d=a.forwardRef((e,t)=>{let{value:n,className:d,children:u}=e,m=(0,r._T)(e,["value","className","children"]),{selectedValue:h}=(0,a.useContext)(o.Z),f=(0,l.NZ)(n,h);return a.createElement(c.R.Option,Object.assign({className:(0,i.q)(s("root"),"flex justify-start items-center cursor-default text-tremor-default p-2.5","ui-active:bg-tremor-background-muted ui-active:text-tremor-content-strong ui-selected:text-tremor-content-strong text-tremor-content-emphasis","dark:ui-active:bg-dark-tremor-background-muted dark:ui-active:text-dark-tremor-content-strong dark:ui-selected:text-dark-tremor-content-strong dark:ui-selected:bg-dark-tremor-background-muted dark:text-dark-tremor-content-emphasis",d),ref:t,key:n,value:n},m),a.createElement("input",{type:"checkbox",className:(0,i.q)(s("checkbox"),"flex-none focus:ring-none focus:outline-none cursor-pointer mr-2.5","accent-tremor-brand","dark:accent-dark-tremor-brand"),checked:f,readOnly:!0}),a.createElement("span",{className:"whitespace-nowrap truncate"},null!=u?u:n))});d.displayName="MultiSelectItem"},16853:function(e,t,n){n.d(t,{Z:function(){return d}});var r=n(5853),o=n(96398),a=n(44140),i=n(2265),l=n(97324),c=n(1153);let s=(0,c.fn)("Textarea"),d=i.forwardRef((e,t)=>{let{value:n,defaultValue:d="",placeholder:u="Type...",error:m=!1,errorMessage:h,disabled:f=!1,className:p,onChange:g,onValueChange:b}=e,v=(0,r._T)(e,["value","defaultValue","placeholder","error","errorMessage","disabled","className","onChange","onValueChange"]),[k,x]=(0,a.Z)(d,n),y=(0,i.useRef)(null),w=(0,o.Uh)(k);return i.createElement(i.Fragment,null,i.createElement("textarea",Object.assign({ref:(0,c.lq)([y,t]),value:k,placeholder:u,disabled:f,className:(0,l.q)(s("Textarea"),"w-full flex items-center outline-none rounded-tremor-default px-3 py-2 text-tremor-default focus:ring-2 transition duration-100 border","shadow-tremor-input focus:border-tremor-brand-subtle focus:ring-tremor-brand-muted","dark:shadow-dark-tremor-input focus:dark:border-dark-tremor-brand-subtle focus:dark:ring-dark-tremor-brand-muted",(0,o.um)(w,f,m),f?"placeholder:text-tremor-content-subtle dark:placeholder:text-dark-tremor-content-subtle":"placeholder:text-tremor-content dark:placeholder:text-dark-tremor-content",p),"data-testid":"text-area",onChange:e=>{null==g||g(e),x(e.target.value),null==b||b(e.target.value)}},v)),m&&h?i.createElement("p",{className:(0,l.q)(s("errorMessage"),"text-sm text-red-500 mt-1")},h):null)});d.displayName="Textarea"},67982:function(e,t,n){n.d(t,{Z:function(){return c}});var r=n(5853),o=n(97324),a=n(1153),i=n(2265);let l=(0,a.fn)("Divider"),c=i.forwardRef((e,t)=>{let{className:n,children:a}=e,c=(0,r._T)(e,["className","children"]);return i.createElement("div",Object.assign({ref:t,className:(0,o.q)(l("root"),"w-full mx-auto my-6 flex justify-between gap-3 items-center text-tremor-default","text-tremor-content","dark:text-dark-tremor-content",n)},c),a?i.createElement(i.Fragment,null,i.createElement("div",{className:(0,o.q)("w-full h-[1px] bg-tremor-border dark:bg-dark-tremor-border")}),i.createElement("div",{className:(0,o.q)("text-inherit whitespace-nowrap")},a),i.createElement("div",{className:(0,o.q)("w-full h-[1px] bg-tremor-border dark:bg-dark-tremor-border")})):i.createElement("div",{className:(0,o.q)("w-full h-[1px] bg-tremor-border dark:bg-dark-tremor-border")}))});c.displayName="Divider"},96889:function(e,t,n){n.d(t,{Z:function(){return s}});var r=n(5853),o=n(2265),a=n(26898),i=n(97324),l=n(1153);let c=(0,l.fn)("BarList"),s=o.forwardRef((e,t)=>{var n;let s;let{data:d=[],color:u,valueFormatter:m=l.Cj,showAnimation:h=!1,className:f}=e,p=(0,r._T)(e,["data","color","valueFormatter","showAnimation","className"]),g=(n=d.map(e=>e.value),s=-1/0,n.forEach(e=>{s=Math.max(s,e)}),n.map(e=>0===e?0:Math.max(e/s*100,1)));return o.createElement("div",Object.assign({ref:t,className:(0,i.q)(c("root"),"flex justify-between space-x-6",f)},p),o.createElement("div",{className:(0,i.q)(c("bars"),"relative w-full")},d.map((e,t)=>{var n,r,s;let m=e.icon;return o.createElement("div",{key:null!==(n=e.key)&&void 0!==n?n:e.name,className:(0,i.q)(c("bar"),"flex items-center rounded-tremor-small bg-opacity-30","h-9",e.color||u?(0,l.bM)(null!==(r=e.color)&&void 0!==r?r:u,a.K.background).bgColor:"bg-tremor-brand-subtle dark:bg-dark-tremor-brand-subtle dark:bg-opacity-30",t===d.length-1?"mb-0":"mb-2"),style:{width:"".concat(g[t],"%"),transition:h?"all 1s":""}},o.createElement("div",{className:(0,i.q)("absolute max-w-full flex left-2")},m?o.createElement(m,{className:(0,i.q)(c("barIcon"),"flex-none h-5 w-5 mr-2","text-tremor-content","dark:text-dark-tremor-content")}):null,e.href?o.createElement("a",{href:e.href,target:null!==(s=e.target)&&void 0!==s?s:"_blank",rel:"noreferrer",className:(0,i.q)(c("barLink"),"whitespace-nowrap hover:underline truncate text-tremor-default","text-tremor-content-emphasis","dark:text-dark-tremor-content-emphasis")},e.name):o.createElement("p",{className:(0,i.q)(c("barText"),"whitespace-nowrap truncate text-tremor-default","text-tremor-content-emphasis","dark:text-dark-tremor-content-emphasis")},e.name)))})),o.createElement("div",{className:"text-right min-w-min"},d.map((e,t)=>{var n;return o.createElement("div",{key:null!==(n=e.key)&&void 0!==n?n:e.name,className:(0,i.q)(c("labelWrapper"),"flex justify-end items-center","h-9",t===d.length-1?"mb-0":"mb-2")},o.createElement("p",{className:(0,i.q)(c("labelText"),"whitespace-nowrap truncate text-tremor-default","text-tremor-content-emphasis","dark:text-dark-tremor-content-emphasis")},m(e.value)))})))});s.displayName="BarList"},44851:function(e,t,n){n.d(t,{default:function(){return q}});var r=n(2265),o=n(77565),a=n(36760),i=n.n(a),l=n(83145),c=n(26365),s=n(41154),d=n(50506),u=n(32559),m=n(1119),h=n(6989),f=n(45287),p=n(11993),g=n(47970),b=n(95814),v=r.forwardRef(function(e,t){var n,o=e.prefixCls,a=e.forceRender,l=e.className,s=e.style,d=e.children,u=e.isActive,m=e.role,h=r.useState(u||a),f=(0,c.Z)(h,2),g=f[0],b=f[1];return(r.useEffect(function(){(a||u)&&b(!0)},[a,u]),g)?r.createElement("div",{ref:t,className:i()("".concat(o,"-content"),(n={},(0,p.Z)(n,"".concat(o,"-content-active"),u),(0,p.Z)(n,"".concat(o,"-content-inactive"),!u),n),l),style:s,role:m},r.createElement("div",{className:"".concat(o,"-content-box")},d)):null});v.displayName="PanelContent";var k=["showArrow","headerClass","isActive","onItemClick","forceRender","className","prefixCls","collapsible","accordion","panelKey","extra","header","expandIcon","openMotion","destroyInactivePanel","children"],x=r.forwardRef(function(e,t){var n,o,a=e.showArrow,l=e.headerClass,c=e.isActive,s=e.onItemClick,d=e.forceRender,u=e.className,f=e.prefixCls,x=e.collapsible,y=e.accordion,w=e.panelKey,C=e.extra,E=e.header,S=e.expandIcon,M=e.openMotion,z=e.destroyInactivePanel,Z=e.children,O=(0,h.Z)(e,k),j="disabled"===x,N="header"===x,_="icon"===x,I=function(){null==s||s(w)},R="function"==typeof S?S(e):r.createElement("i",{className:"arrow"});R&&(R=r.createElement("div",{className:"".concat(f,"-expand-icon"),onClick:["header","icon"].includes(x)?I:void 0},R));var P=i()((n={},(0,p.Z)(n,"".concat(f,"-item"),!0),(0,p.Z)(n,"".concat(f,"-item-active"),c),(0,p.Z)(n,"".concat(f,"-item-disabled"),j),n),u),L={className:i()(l,(o={},(0,p.Z)(o,"".concat(f,"-header"),!0),(0,p.Z)(o,"".concat(f,"-header-collapsible-only"),N),(0,p.Z)(o,"".concat(f,"-icon-collapsible-only"),_),o)),"aria-expanded":c,"aria-disabled":j,onKeyDown:function(e){("Enter"===e.key||e.keyCode===b.Z.ENTER||e.which===b.Z.ENTER)&&I()}};return N||_||(L.onClick=I,L.role=y?"tab":"button",L.tabIndex=j?-1:0),r.createElement("div",(0,m.Z)({},O,{ref:t,className:P}),r.createElement("div",L,(void 0===a||a)&&R,r.createElement("span",{className:"".concat(f,"-header-text"),onClick:"header"===x?I:void 0},E),null!=C&&"boolean"!=typeof C&&r.createElement("div",{className:"".concat(f,"-extra")},C)),r.createElement(g.ZP,(0,m.Z)({visible:c,leavedClassName:"".concat(f,"-content-hidden")},M,{forceRender:d,removeOnLeave:z}),function(e,t){var n=e.className,o=e.style;return r.createElement(v,{ref:t,prefixCls:f,className:n,style:o,isActive:c,forceRender:d,role:y?"tabpanel":void 0},Z)}))}),y=["children","label","key","collapsible","onItemClick","destroyInactivePanel"],w=function(e,t){var n=t.prefixCls,o=t.accordion,a=t.collapsible,i=t.destroyInactivePanel,l=t.onItemClick,c=t.activeKey,s=t.openMotion,d=t.expandIcon;return e.map(function(e,t){var u=e.children,f=e.label,p=e.key,g=e.collapsible,b=e.onItemClick,v=e.destroyInactivePanel,k=(0,h.Z)(e,y),w=String(null!=p?p:t),C=null!=g?g:a,E=!1;return E=o?c[0]===w:c.indexOf(w)>-1,r.createElement(x,(0,m.Z)({},k,{prefixCls:n,key:w,panelKey:w,isActive:E,accordion:o,openMotion:s,expandIcon:d,header:f,collapsible:C,onItemClick:function(e){"disabled"!==C&&(l(e),null==b||b(e))},destroyInactivePanel:null!=v?v:i}),u)})},C=function(e,t,n){if(!e)return null;var o=n.prefixCls,a=n.accordion,i=n.collapsible,l=n.destroyInactivePanel,c=n.onItemClick,s=n.activeKey,d=n.openMotion,u=n.expandIcon,m=e.key||String(t),h=e.props,f=h.header,p=h.headerClass,g=h.destroyInactivePanel,b=h.collapsible,v=h.onItemClick,k=!1;k=a?s[0]===m:s.indexOf(m)>-1;var x=null!=b?b:i,y={key:m,panelKey:m,header:f,headerClass:p,isActive:k,prefixCls:o,destroyInactivePanel:null!=g?g:l,openMotion:d,accordion:a,children:e.props.children,onItemClick:function(e){"disabled"!==x&&(c(e),null==v||v(e))},expandIcon:u,collapsible:x};return"string"==typeof e.type?e:(Object.keys(y).forEach(function(e){void 0===y[e]&&delete y[e]}),r.cloneElement(e,y))};function E(e){var t=e;if(!Array.isArray(t)){var n=(0,s.Z)(t);t="number"===n||"string"===n?[t]:[]}return t.map(function(e){return String(e)})}var S=Object.assign(r.forwardRef(function(e,t){var n,o=e.prefixCls,a=void 0===o?"rc-collapse":o,s=e.destroyInactivePanel,m=e.style,h=e.accordion,p=e.className,g=e.children,b=e.collapsible,v=e.openMotion,k=e.expandIcon,x=e.activeKey,y=e.defaultActiveKey,S=e.onChange,M=e.items,z=i()(a,p),Z=(0,d.Z)([],{value:x,onChange:function(e){return null==S?void 0:S(e)},defaultValue:y,postState:E}),O=(0,c.Z)(Z,2),j=O[0],N=O[1];(0,u.ZP)(!g,"[rc-collapse] `children` will be removed in next major version. Please use `items` instead.");var _=(n={prefixCls:a,accordion:h,openMotion:v,expandIcon:k,collapsible:b,destroyInactivePanel:void 0!==s&&s,onItemClick:function(e){return N(function(){return h?j[0]===e?[]:[e]:j.indexOf(e)>-1?j.filter(function(t){return t!==e}):[].concat((0,l.Z)(j),[e])})},activeKey:j},Array.isArray(M)?w(M,n):(0,f.Z)(g).map(function(e,t){return C(e,t,n)}));return r.createElement("div",{ref:t,className:z,style:m,role:h?"tablist":void 0},_)}),{Panel:x});S.Panel;var M=n(18694),z=n(68710),Z=n(19722),O=n(71744),j=n(33759);let N=r.forwardRef((e,t)=>{let{getPrefixCls:n}=r.useContext(O.E_),{prefixCls:o,className:a,showArrow:l=!0}=e,c=n("collapse",o),s=i()({["".concat(c,"-no-arrow")]:!l},a);return r.createElement(S.Panel,Object.assign({ref:t},e,{prefixCls:c,className:s}))});var _=n(352),I=n(12918),R=n(63074),P=n(80669),L=n(3104);let B=e=>{let{componentCls:t,contentBg:n,padding:r,headerBg:o,headerPadding:a,collapseHeaderPaddingSM:i,collapseHeaderPaddingLG:l,collapsePanelBorderRadius:c,lineWidth:s,lineType:d,colorBorder:u,colorText:m,colorTextHeading:h,colorTextDisabled:f,fontSizeLG:p,lineHeight:g,lineHeightLG:b,marginSM:v,paddingSM:k,paddingLG:x,paddingXS:y,motionDurationSlow:w,fontSizeIcon:C,contentPadding:E,fontHeight:S,fontHeightLG:M}=e,z="".concat((0,_.bf)(s)," ").concat(d," ").concat(u);return{[t]:Object.assign(Object.assign({},(0,I.Wf)(e)),{backgroundColor:o,border:z,borderBottom:0,borderRadius:c,"&-rtl":{direction:"rtl"},["& > ".concat(t,"-item")]:{borderBottom:z,"&:last-child":{["\n &,\n & > ".concat(t,"-header")]:{borderRadius:"0 0 ".concat((0,_.bf)(c)," ").concat((0,_.bf)(c))}},["> ".concat(t,"-header")]:{position:"relative",display:"flex",flexWrap:"nowrap",alignItems:"flex-start",padding:a,color:h,lineHeight:g,cursor:"pointer",transition:"all ".concat(w,", visibility 0s"),["> ".concat(t,"-header-text")]:{flex:"auto"},"&:focus":{outline:"none"},["".concat(t,"-expand-icon")]:{height:S,display:"flex",alignItems:"center",paddingInlineEnd:v},["".concat(t,"-arrow")]:Object.assign(Object.assign({},(0,I.Ro)()),{fontSize:C,svg:{transition:"transform ".concat(w)}}),["".concat(t,"-header-text")]:{marginInlineEnd:"auto"}},["".concat(t,"-icon-collapsible-only")]:{cursor:"unset",["".concat(t,"-expand-icon")]:{cursor:"pointer"}}},["".concat(t,"-content")]:{color:m,backgroundColor:n,borderTop:z,["& > ".concat(t,"-content-box")]:{padding:E},"&-hidden":{display:"none"}},"&-small":{["> ".concat(t,"-item")]:{["> ".concat(t,"-header")]:{padding:i,paddingInlineStart:y,["> ".concat(t,"-expand-icon")]:{marginInlineStart:e.calc(k).sub(y).equal()}},["> ".concat(t,"-content > ").concat(t,"-content-box")]:{padding:k}}},"&-large":{["> ".concat(t,"-item")]:{fontSize:p,lineHeight:b,["> ".concat(t,"-header")]:{padding:l,paddingInlineStart:r,["> ".concat(t,"-expand-icon")]:{height:M,marginInlineStart:e.calc(x).sub(r).equal()}},["> ".concat(t,"-content > ").concat(t,"-content-box")]:{padding:x}}},["".concat(t,"-item:last-child")]:{["> ".concat(t,"-content")]:{borderRadius:"0 0 ".concat((0,_.bf)(c)," ").concat((0,_.bf)(c))}},["& ".concat(t,"-item-disabled > ").concat(t,"-header")]:{"\n &,\n & > .arrow\n ":{color:f,cursor:"not-allowed"}},["&".concat(t,"-icon-position-end")]:{["& > ".concat(t,"-item")]:{["> ".concat(t,"-header")]:{["".concat(t,"-expand-icon")]:{order:1,paddingInlineEnd:0,paddingInlineStart:v}}}}})}},H=e=>{let{componentCls:t}=e,n="> ".concat(t,"-item > ").concat(t,"-header ").concat(t,"-arrow svg");return{["".concat(t,"-rtl")]:{[n]:{transform:"rotate(180deg)"}}}},V=e=>{let{componentCls:t,headerBg:n,paddingXXS:r,colorBorder:o}=e;return{["".concat(t,"-borderless")]:{backgroundColor:n,border:0,["> ".concat(t,"-item")]:{borderBottom:"1px solid ".concat(o)},["\n > ".concat(t,"-item:last-child,\n > ").concat(t,"-item:last-child ").concat(t,"-header\n ")]:{borderRadius:0},["> ".concat(t,"-item:last-child")]:{borderBottom:0},["> ".concat(t,"-item > ").concat(t,"-content")]:{backgroundColor:"transparent",borderTop:0},["> ".concat(t,"-item > ").concat(t,"-content > ").concat(t,"-content-box")]:{paddingTop:r}}}},A=e=>{let{componentCls:t,paddingSM:n}=e;return{["".concat(t,"-ghost")]:{backgroundColor:"transparent",border:0,["> ".concat(t,"-item")]:{borderBottom:0,["> ".concat(t,"-content")]:{backgroundColor:"transparent",border:0,["> ".concat(t,"-content-box")]:{paddingBlock:n}}}}}};var T=(0,P.I$)("Collapse",e=>{let t=(0,L.TS)(e,{collapseHeaderPaddingSM:"".concat((0,_.bf)(e.paddingXS)," ").concat((0,_.bf)(e.paddingSM)),collapseHeaderPaddingLG:"".concat((0,_.bf)(e.padding)," ").concat((0,_.bf)(e.paddingLG)),collapsePanelBorderRadius:e.borderRadiusLG});return[B(t),V(t),A(t),H(t),(0,R.Z)(t)]},e=>({headerPadding:"".concat(e.paddingSM,"px ").concat(e.padding,"px"),headerBg:e.colorFillAlter,contentPadding:"".concat(e.padding,"px 16px"),contentBg:e.colorBgContainer})),q=Object.assign(r.forwardRef((e,t)=>{let{getPrefixCls:n,direction:a,collapse:l}=r.useContext(O.E_),{prefixCls:c,className:s,rootClassName:d,style:u,bordered:m=!0,ghost:h,size:p,expandIconPosition:g="start",children:b,expandIcon:v}=e,k=(0,j.Z)(e=>{var t;return null!==(t=null!=p?p:e)&&void 0!==t?t:"middle"}),x=n("collapse",c),y=n(),[w,C,E]=T(x),N=r.useMemo(()=>"left"===g?"start":"right"===g?"end":g,[g]),_=i()("".concat(x,"-icon-position-").concat(N),{["".concat(x,"-borderless")]:!m,["".concat(x,"-rtl")]:"rtl"===a,["".concat(x,"-ghost")]:!!h,["".concat(x,"-").concat(k)]:"middle"!==k},null==l?void 0:l.className,s,d,C,E),I=Object.assign(Object.assign({},(0,z.Z)(y)),{motionAppear:!1,leavedClassName:"".concat(x,"-content-hidden")}),R=r.useMemo(()=>b?(0,f.Z)(b).map((e,t)=>{var n,r;if(null===(n=e.props)||void 0===n?void 0:n.disabled){let n=null!==(r=e.key)&&void 0!==r?r:String(t),{disabled:o,collapsible:a}=e.props,i=Object.assign(Object.assign({},(0,M.Z)(e.props,["disabled"])),{key:n,collapsible:null!=a?a:o?"disabled":void 0});return(0,Z.Tm)(e,i)}return e}):null,[b]);return w(r.createElement(S,Object.assign({ref:t,openMotion:I},(0,M.Z)(e,["rootClassName"]),{expandIcon:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=v?v(e):r.createElement(o.Z,{rotate:e.isActive?90:void 0});return(0,Z.Tm)(t,()=>({className:i()(t.props.className,"".concat(x,"-arrow"))}))},prefixCls:x,className:_,style:Object.assign(Object.assign({},null==l?void 0:l.style),u)}),R))}),{Panel:N})},19226:function(e,t,n){n.d(t,{default:function(){return S}});var r=n(83145),o=n(2265),a=n(36760),i=n.n(a),l=n(18694),c=n(71744),s=n(80856),d=n(45287),u=n(92239),m=n(352),h=n(80669),f=e=>{let{componentCls:t,bodyBg:n,lightSiderBg:r,lightTriggerBg:o,lightTriggerColor:a}=e;return{["".concat(t,"-sider-light")]:{background:r,["".concat(t,"-sider-trigger")]:{color:a,background:o},["".concat(t,"-sider-zero-width-trigger")]:{color:a,background:o,border:"1px solid ".concat(n),borderInlineStart:0}}}};let p=e=>{let{antCls:t,componentCls:n,colorText:r,triggerColor:o,footerBg:a,triggerBg:i,headerHeight:l,headerPadding:c,headerColor:s,footerPadding:d,triggerHeight:u,zeroTriggerHeight:h,zeroTriggerWidth:p,motionDurationMid:g,motionDurationSlow:b,fontSize:v,borderRadius:k,bodyBg:x,headerBg:y,siderBg:w}=e;return{[n]:Object.assign(Object.assign({display:"flex",flex:"auto",flexDirection:"column",minHeight:0,background:x,"&, *":{boxSizing:"border-box"},["&".concat(n,"-has-sider")]:{flexDirection:"row",["> ".concat(n,", > ").concat(n,"-content")]:{width:0}},["".concat(n,"-header, &").concat(n,"-footer")]:{flex:"0 0 auto"},["".concat(n,"-sider")]:{position:"relative",minWidth:0,background:w,transition:"all ".concat(g,", background 0s"),"&-children":{height:"100%",marginTop:-.1,paddingTop:.1,["".concat(t,"-menu").concat(t,"-menu-inline-collapsed")]:{width:"auto"}},"&-has-trigger":{paddingBottom:u},"&-right":{order:1},"&-trigger":{position:"fixed",bottom:0,zIndex:1,height:u,color:o,lineHeight:(0,m.bf)(u),textAlign:"center",background:i,cursor:"pointer",transition:"all ".concat(g)},"&-zero-width":{"> *":{overflow:"hidden"},"&-trigger":{position:"absolute",top:l,insetInlineEnd:e.calc(p).mul(-1).equal(),zIndex:1,width:p,height:h,color:o,fontSize:e.fontSizeXL,display:"flex",alignItems:"center",justifyContent:"center",background:w,borderStartStartRadius:0,borderStartEndRadius:k,borderEndEndRadius:k,borderEndStartRadius:0,cursor:"pointer",transition:"background ".concat(b," ease"),"&::after":{position:"absolute",inset:0,background:"transparent",transition:"all ".concat(b),content:'""'},"&:hover::after":{background:"rgba(255, 255, 255, 0.2)"},"&-right":{insetInlineStart:e.calc(p).mul(-1).equal(),borderStartStartRadius:k,borderStartEndRadius:0,borderEndEndRadius:0,borderEndStartRadius:k}}}}},f(e)),{"&-rtl":{direction:"rtl"}}),["".concat(n,"-header")]:{height:l,padding:c,color:s,lineHeight:(0,m.bf)(l),background:y,["".concat(t,"-menu")]:{lineHeight:"inherit"}},["".concat(n,"-footer")]:{padding:d,color:r,fontSize:v,background:a},["".concat(n,"-content")]:{flex:"auto",minHeight:0}}};var g=(0,h.I$)("Layout",e=>[p(e)],e=>{let{colorBgLayout:t,controlHeight:n,controlHeightLG:r,colorText:o,controlHeightSM:a,marginXXS:i,colorTextLightSolid:l,colorBgContainer:c}=e,s=1.25*r;return{colorBgHeader:"#001529",colorBgBody:t,colorBgTrigger:"#002140",bodyBg:t,headerBg:"#001529",headerHeight:2*n,headerPadding:"0 ".concat(s,"px"),headerColor:o,footerPadding:"".concat(a,"px ").concat(s,"px"),footerBg:t,siderBg:"#001529",triggerHeight:r+2*i,triggerBg:"#002140",triggerColor:l,zeroTriggerWidth:r,zeroTriggerHeight:r,lightSiderBg:c,lightTriggerBg:c,lightTriggerColor:o}},{deprecatedTokens:[["colorBgBody","bodyBg"],["colorBgHeader","headerBg"],["colorBgTrigger","triggerBg"]]}),b=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,r=Object.getOwnPropertySymbols(e);ot.indexOf(r[o])&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n};function v(e){let{suffixCls:t,tagName:n,displayName:r}=e;return e=>o.forwardRef((r,a)=>o.createElement(e,Object.assign({ref:a,suffixCls:t,tagName:n},r)))}let k=o.forwardRef((e,t)=>{let{prefixCls:n,suffixCls:r,className:a,tagName:l}=e,s=b(e,["prefixCls","suffixCls","className","tagName"]),{getPrefixCls:d}=o.useContext(c.E_),u=d("layout",n),[m,h,f]=g(u),p=r?"".concat(u,"-").concat(r):u;return m(o.createElement(l,Object.assign({className:i()(n||p,a,h,f),ref:t},s)))}),x=o.forwardRef((e,t)=>{let{direction:n}=o.useContext(c.E_),[a,m]=o.useState([]),{prefixCls:h,className:f,rootClassName:p,children:v,hasSider:k,tagName:x,style:y}=e,w=b(e,["prefixCls","className","rootClassName","children","hasSider","tagName","style"]),C=(0,l.Z)(w,["suffixCls"]),{getPrefixCls:E,layout:S}=o.useContext(c.E_),M=E("layout",h),z="boolean"==typeof k?k:!!a.length||(0,d.Z)(v).some(e=>e.type===u.Z),[Z,O,j]=g(M),N=i()(M,{["".concat(M,"-has-sider")]:z,["".concat(M,"-rtl")]:"rtl"===n},null==S?void 0:S.className,f,p,O,j),_=o.useMemo(()=>({siderHook:{addSider:e=>{m(t=>[].concat((0,r.Z)(t),[e]))},removeSider:e=>{m(t=>t.filter(t=>t!==e))}}}),[]);return Z(o.createElement(s.V.Provider,{value:_},o.createElement(x,Object.assign({ref:t,className:N,style:Object.assign(Object.assign({},null==S?void 0:S.style),y)},C),v)))}),y=v({tagName:"div",displayName:"Layout"})(x),w=v({suffixCls:"header",tagName:"header",displayName:"Header"})(k),C=v({suffixCls:"footer",tagName:"footer",displayName:"Footer"})(k),E=v({suffixCls:"content",tagName:"main",displayName:"Content"})(k);y.Header=w,y.Footer=C,y.Content=E,y.Sider=u.Z,y._InternalSiderContext=u.D;var S=y},35631:function(e,t,n){n.d(t,{Z:function(){return N}});var r=n(83145),o=n(36760),a=n.n(o),i=n(2265),l=n(53253),c=n(6543),s=n(71744),d=n(91086),u=n(10295),m=n(28617),h=n(19097),f=n(87908),p=n(19722),g=n(54998);let b=i.createContext({});b.Consumer;var v=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,r=Object.getOwnPropertySymbols(e);ot.indexOf(r[o])&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n};let k=(0,i.forwardRef)((e,t)=>{let n;var{prefixCls:r,children:o,actions:l,extra:c,className:d,colStyle:u}=e,m=v(e,["prefixCls","children","actions","extra","className","colStyle"]);let{grid:h,itemLayout:f}=(0,i.useContext)(b),{getPrefixCls:k}=(0,i.useContext)(s.E_),x=k("list",r),y=l&&l.length>0&&i.createElement("ul",{className:"".concat(x,"-item-action"),key:"actions"},l.map((e,t)=>i.createElement("li",{key:"".concat(x,"-item-action-").concat(t)},e,t!==l.length-1&&i.createElement("em",{className:"".concat(x,"-item-action-split")})))),w=i.createElement(h?"div":"li",Object.assign({},m,h?{}:{ref:t},{className:a()("".concat(x,"-item"),{["".concat(x,"-item-no-flex")]:!("vertical"===f?!!c:(i.Children.forEach(o,e=>{"string"==typeof e&&(n=!0)}),!(n&&i.Children.count(o)>1)))},d)}),"vertical"===f&&c?[i.createElement("div",{className:"".concat(x,"-item-main"),key:"content"},o,y),i.createElement("div",{className:"".concat(x,"-item-extra"),key:"extra"},c)]:[o,y,(0,p.Tm)(c,{key:"extra"})]);return h?i.createElement(g.Z,{ref:t,flex:1,style:u},w):w});k.Meta=e=>{var{prefixCls:t,className:n,avatar:r,title:o,description:l}=e,c=v(e,["prefixCls","className","avatar","title","description"]);let{getPrefixCls:d}=(0,i.useContext)(s.E_),u=d("list",t),m=a()("".concat(u,"-item-meta"),n),h=i.createElement("div",{className:"".concat(u,"-item-meta-content")},o&&i.createElement("h4",{className:"".concat(u,"-item-meta-title")},o),l&&i.createElement("div",{className:"".concat(u,"-item-meta-description")},l));return i.createElement("div",Object.assign({},c,{className:m}),r&&i.createElement("div",{className:"".concat(u,"-item-meta-avatar")},r),(o||l)&&h)};var x=n(352),y=n(12918),w=n(80669),C=n(3104);let E=e=>{let{listBorderedCls:t,componentCls:n,paddingLG:r,margin:o,itemPaddingSM:a,itemPaddingLG:i,marginLG:l,borderRadiusLG:c}=e;return{["".concat(t)]:{border:"".concat((0,x.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorBorder),borderRadius:c,["".concat(n,"-header,").concat(n,"-footer,").concat(n,"-item")]:{paddingInline:r},["".concat(n,"-pagination")]:{margin:"".concat((0,x.bf)(o)," ").concat((0,x.bf)(l))}},["".concat(t).concat(n,"-sm")]:{["".concat(n,"-item,").concat(n,"-header,").concat(n,"-footer")]:{padding:a}},["".concat(t).concat(n,"-lg")]:{["".concat(n,"-item,").concat(n,"-header,").concat(n,"-footer")]:{padding:i}}}},S=e=>{let{componentCls:t,screenSM:n,screenMD:r,marginLG:o,marginSM:a,margin:i}=e;return{["@media screen and (max-width:".concat(r,"px)")]:{["".concat(t)]:{["".concat(t,"-item")]:{["".concat(t,"-item-action")]:{marginInlineStart:o}}},["".concat(t,"-vertical")]:{["".concat(t,"-item")]:{["".concat(t,"-item-extra")]:{marginInlineStart:o}}}},["@media screen and (max-width: ".concat(n,"px)")]:{["".concat(t)]:{["".concat(t,"-item")]:{flexWrap:"wrap",["".concat(t,"-action")]:{marginInlineStart:a}}},["".concat(t,"-vertical")]:{["".concat(t,"-item")]:{flexWrap:"wrap-reverse",["".concat(t,"-item-main")]:{minWidth:e.contentWidth},["".concat(t,"-item-extra")]:{margin:"auto auto ".concat((0,x.bf)(i))}}}}}},M=e=>{let{componentCls:t,antCls:n,controlHeight:r,minHeight:o,paddingSM:a,marginLG:i,padding:l,itemPadding:c,colorPrimary:s,itemPaddingSM:d,itemPaddingLG:u,paddingXS:m,margin:h,colorText:f,colorTextDescription:p,motionDurationSlow:g,lineWidth:b,headerBg:v,footerBg:k,emptyTextPadding:w,metaMarginBottom:C,avatarMarginRight:E,titleMarginBottom:S,descriptionFontSize:M}=e,z={};return["start","center","end"].forEach(e=>{z["&-align-".concat(e)]={textAlign:e}}),{["".concat(t)]:Object.assign(Object.assign({},(0,y.Wf)(e)),{position:"relative","*":{outline:"none"},["".concat(t,"-header")]:{background:v},["".concat(t,"-footer")]:{background:k},["".concat(t,"-header, ").concat(t,"-footer")]:{paddingBlock:a},["".concat(t,"-pagination")]:Object.assign(Object.assign({marginBlockStart:i},z),{["".concat(n,"-pagination-options")]:{textAlign:"start"}}),["".concat(t,"-spin")]:{minHeight:o,textAlign:"center"},["".concat(t,"-items")]:{margin:0,padding:0,listStyle:"none"},["".concat(t,"-item")]:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:c,color:f,["".concat(t,"-item-meta")]:{display:"flex",flex:1,alignItems:"flex-start",maxWidth:"100%",["".concat(t,"-item-meta-avatar")]:{marginInlineEnd:E},["".concat(t,"-item-meta-content")]:{flex:"1 0",width:0,color:f},["".concat(t,"-item-meta-title")]:{margin:"0 0 ".concat((0,x.bf)(e.marginXXS)," 0"),color:f,fontSize:e.fontSize,lineHeight:e.lineHeight,"> a":{color:f,transition:"all ".concat(g),"&:hover":{color:s}}},["".concat(t,"-item-meta-description")]:{color:p,fontSize:M,lineHeight:e.lineHeight}},["".concat(t,"-item-action")]:{flex:"0 0 auto",marginInlineStart:e.marginXXL,padding:0,fontSize:0,listStyle:"none","& > li":{position:"relative",display:"inline-block",padding:"0 ".concat((0,x.bf)(m)),color:p,fontSize:e.fontSize,lineHeight:e.lineHeight,textAlign:"center","&:first-child":{paddingInlineStart:0}},["".concat(t,"-item-action-split")]:{position:"absolute",insetBlockStart:"50%",insetInlineEnd:0,width:b,height:e.calc(e.fontHeight).sub(e.calc(e.marginXXS).mul(2)).equal(),transform:"translateY(-50%)",backgroundColor:e.colorSplit}}},["".concat(t,"-empty")]:{padding:"".concat((0,x.bf)(l)," 0"),color:p,fontSize:e.fontSizeSM,textAlign:"center"},["".concat(t,"-empty-text")]:{padding:w,color:e.colorTextDisabled,fontSize:e.fontSize,textAlign:"center"},["".concat(t,"-item-no-flex")]:{display:"block"}}),["".concat(t,"-grid ").concat(n,"-col > ").concat(t,"-item")]:{display:"block",maxWidth:"100%",marginBlockEnd:h,paddingBlock:0,borderBlockEnd:"none"},["".concat(t,"-vertical ").concat(t,"-item")]:{alignItems:"initial",["".concat(t,"-item-main")]:{display:"block",flex:1},["".concat(t,"-item-extra")]:{marginInlineStart:i},["".concat(t,"-item-meta")]:{marginBlockEnd:C,["".concat(t,"-item-meta-title")]:{marginBlockStart:0,marginBlockEnd:S,color:f,fontSize:e.fontSizeLG,lineHeight:e.lineHeightLG}},["".concat(t,"-item-action")]:{marginBlockStart:l,marginInlineStart:"auto","> li":{padding:"0 ".concat((0,x.bf)(l)),"&:first-child":{paddingInlineStart:0}}}},["".concat(t,"-split ").concat(t,"-item")]:{borderBlockEnd:"".concat((0,x.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorSplit),"&:last-child":{borderBlockEnd:"none"}},["".concat(t,"-split ").concat(t,"-header")]:{borderBlockEnd:"".concat((0,x.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorSplit)},["".concat(t,"-split").concat(t,"-empty ").concat(t,"-footer")]:{borderTop:"".concat((0,x.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorSplit)},["".concat(t,"-loading ").concat(t,"-spin-nested-loading")]:{minHeight:r},["".concat(t,"-split").concat(t,"-something-after-last-item ").concat(n,"-spin-container > ").concat(t,"-items > ").concat(t,"-item:last-child")]:{borderBlockEnd:"".concat((0,x.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorSplit)},["".concat(t,"-lg ").concat(t,"-item")]:{padding:u},["".concat(t,"-sm ").concat(t,"-item")]:{padding:d},["".concat(t,":not(").concat(t,"-vertical)")]:{["".concat(t,"-item-no-flex")]:{["".concat(t,"-item-action")]:{float:"right"}}}}};var z=(0,w.I$)("List",e=>{let t=(0,C.TS)(e,{listBorderedCls:"".concat(e.componentCls,"-bordered"),minHeight:e.controlHeightLG});return[M(t),E(t),S(t)]},e=>({contentWidth:220,itemPadding:"".concat((0,x.bf)(e.paddingContentVertical)," 0"),itemPaddingSM:"".concat((0,x.bf)(e.paddingContentVerticalSM)," ").concat((0,x.bf)(e.paddingContentHorizontal)),itemPaddingLG:"".concat((0,x.bf)(e.paddingContentVerticalLG)," ").concat((0,x.bf)(e.paddingContentHorizontalLG)),headerBg:"transparent",footerBg:"transparent",emptyTextPadding:e.padding,metaMarginBottom:e.padding,avatarMarginRight:e.padding,titleMarginBottom:e.paddingSM,descriptionFontSize:e.fontSize})),Z=n(33759),O=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,r=Object.getOwnPropertySymbols(e);ot.indexOf(r[o])&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n};function j(e){var t,{pagination:n=!1,prefixCls:o,bordered:p=!1,split:g=!0,className:v,rootClassName:k,style:x,children:y,itemLayout:w,loadMore:C,grid:E,dataSource:S=[],size:M,header:j,footer:N,loading:_=!1,rowKey:I,renderItem:R,locale:P}=e,L=O(e,["pagination","prefixCls","bordered","split","className","rootClassName","style","children","itemLayout","loadMore","grid","dataSource","size","header","footer","loading","rowKey","renderItem","locale"]);let B=n&&"object"==typeof n?n:{},[H,V]=i.useState(B.defaultCurrent||1),[A,T]=i.useState(B.defaultPageSize||10),{getPrefixCls:q,renderEmpty:W,direction:F,list:D}=i.useContext(s.E_),G=e=>(t,r)=>{var o;V(t),T(r),n&&n[e]&&(null===(o=null==n?void 0:n[e])||void 0===o||o.call(n,t,r))},K=G("onChange"),U=G("onShowSizeChange"),X=(e,t)=>{let n;return R?((n="function"==typeof I?I(e):I?e[I]:e.key)||(n="list-item-".concat(t)),i.createElement(i.Fragment,{key:n},R(e,t))):null},$=q("list",o),[Y,J,Q]=z($),ee=_;"boolean"==typeof ee&&(ee={spinning:ee});let et=ee&&ee.spinning,en=(0,Z.Z)(M),er="";switch(en){case"large":er="lg";break;case"small":er="sm"}let eo=a()($,{["".concat($,"-vertical")]:"vertical"===w,["".concat($,"-").concat(er)]:er,["".concat($,"-split")]:g,["".concat($,"-bordered")]:p,["".concat($,"-loading")]:et,["".concat($,"-grid")]:!!E,["".concat($,"-something-after-last-item")]:!!(C||n||N),["".concat($,"-rtl")]:"rtl"===F},null==D?void 0:D.className,v,k,J,Q),ea=(0,l.Z)({current:1,total:0},{total:S.length,current:H,pageSize:A},n||{}),ei=Math.ceil(ea.total/ea.pageSize);ea.current>ei&&(ea.current=ei);let el=n?i.createElement("div",{className:a()("".concat($,"-pagination"),"".concat($,"-pagination-align-").concat(null!==(t=null==ea?void 0:ea.align)&&void 0!==t?t:"end"))},i.createElement(h.Z,Object.assign({},ea,{onChange:K,onShowSizeChange:U}))):null,ec=(0,r.Z)(S);n&&S.length>(ea.current-1)*ea.pageSize&&(ec=(0,r.Z)(S).splice((ea.current-1)*ea.pageSize,ea.pageSize));let es=Object.keys(E||{}).some(e=>["xs","sm","md","lg","xl","xxl"].includes(e)),ed=(0,m.Z)(es),eu=i.useMemo(()=>{for(let e=0;e{if(!E)return;let e=eu&&E[eu]?E[eu]:E.column;if(e)return{width:"".concat(100/e,"%"),maxWidth:"".concat(100/e,"%")}},[null==E?void 0:E.column,eu]),eh=et&&i.createElement("div",{style:{minHeight:53}});if(ec.length>0){let e=ec.map((e,t)=>X(e,t));eh=E?i.createElement(u.Z,{gutter:E.gutter},i.Children.map(e,e=>i.createElement("div",{key:null==e?void 0:e.key,style:em},e))):i.createElement("ul",{className:"".concat($,"-items")},e)}else y||et||(eh=i.createElement("div",{className:"".concat($,"-empty-text")},P&&P.emptyText||(null==W?void 0:W("List"))||i.createElement(d.Z,{componentName:"List"})));let ef=ea.position||"bottom",ep=i.useMemo(()=>({grid:E,itemLayout:w}),[JSON.stringify(E),w]);return Y(i.createElement(b.Provider,{value:ep},i.createElement("div",Object.assign({style:Object.assign(Object.assign({},null==D?void 0:D.style),x),className:eo},L),("top"===ef||"both"===ef)&&el,j&&i.createElement("div",{className:"".concat($,"-header")},j),i.createElement(f.Z,Object.assign({},ee),eh,y),N&&i.createElement("div",{className:"".concat($,"-footer")},N),C||("bottom"===ef||"both"===ef)&&el)))}j.Item=k;var N=j},40875:function(e,t,n){n.d(t,{Z:function(){return r}});let r=(0,n(79205).Z)("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]])},22135:function(e,t,n){n.d(t,{Z:function(){return r}});let r=(0,n(79205).Z)("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]])},5136:function(e,t,n){n.d(t,{Z:function(){return r}});let r=(0,n(79205).Z)("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"}]])},64935:function(e,t,n){n.d(t,{Z:function(){return r}});let r=(0,n(79205).Z)("code",[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]])},96362:function(e,t,n){n.d(t,{Z:function(){return r}});let r=(0,n(79205).Z)("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"}]])},29202:function(e,t,n){n.d(t,{Z:function(){return r}});let r=(0,n(79205).Z)("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"}]])},33245:function(e,t,n){n.d(t,{Z:function(){return r}});let r=(0,n(79205).Z)("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]])},54001:function(e,t,n){n.d(t,{Z:function(){return r}});let r=(0,n(79205).Z)("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"}]])},51817:function(e,t,n){n.d(t,{Z:function(){return r}});let r=(0,n(79205).Z)("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]])},21047:function(e,t,n){n.d(t,{Z:function(){return r}});let r=(0,n(79205).Z)("minus",[["path",{d:"M5 12h14",key:"1ays0h"}]])},96137:function(e,t,n){n.d(t,{Z:function(){return r}});let r=(0,n(79205).Z)("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"}]])},80221:function(e,t,n){n.d(t,{Z:function(){return r}});let r=(0,n(79205).Z)("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]])},70525:function(e,t,n){n.d(t,{Z:function(){return r}});let r=(0,n(79205).Z)("trending-up",[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]])},76865:function(e,t,n){n.d(t,{Z:function(){return r}});let r=(0,n(79205).Z)("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]])},49663:function(e,t,n){n.d(t,{Z:function(){return r}});let r=(0,n(79205).Z)("user-check",[["path",{d:"m16 11 2 2 4-4",key:"9rsbq5"}],["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]])},95805:function(e,t,n){n.d(t,{Z:function(){return r}});let r=(0,n(79205).Z)("users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]])},11239:function(e,t,n){n.d(t,{Z:function(){return r}});let r=(0,n(79205).Z)("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"}]])},33145:function(e,t,n){n.d(t,{default:function(){return o.a}});var r=n(48461),o=n.n(r)},65878:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"Image",{enumerable:!0,get:function(){return k}});let r=n(47043),o=n(53099),a=n(57437),i=o._(n(2265)),l=r._(n(54887)),c=r._(n(38293)),s=n(55346),d=n(90128),u=n(62589);n(31765);let m=n(25523),h=r._(n(5084)),f={deviceSizes:[640,750,828,1080,1200,1920,2048,3840],imageSizes:[16,32,48,64,96,128,256,384],path:"/_next/image",loader:"default",dangerouslyAllowSVG:!1,unoptimized:!1};function p(e,t,n,r,o,a,i){let l=null==e?void 0:e.src;e&&e["data-loaded-src"]!==l&&(e["data-loaded-src"]=l,("decode"in e?e.decode():Promise.resolve()).catch(()=>{}).then(()=>{if(e.parentElement&&e.isConnected){if("empty"!==t&&o(!0),null==n?void 0:n.current){let t=new Event("load");Object.defineProperty(t,"target",{writable:!1,value:e});let r=!1,o=!1;n.current({...t,nativeEvent:t,currentTarget:e,target:e,isDefaultPrevented:()=>r,isPropagationStopped:()=>o,persist:()=>{},preventDefault:()=>{r=!0,t.preventDefault()},stopPropagation:()=>{o=!0,t.stopPropagation()}})}(null==r?void 0:r.current)&&r.current(e)}}))}function g(e){return i.use?{fetchPriority:e}:{fetchpriority:e}}"undefined"==typeof window&&(globalThis.__NEXT_IMAGE_IMPORTED=!0);let b=(0,i.forwardRef)((e,t)=>{let{src:n,srcSet:r,sizes:o,height:l,width:c,decoding:s,className:d,style:u,fetchPriority:m,placeholder:h,loading:f,unoptimized:b,fill:v,onLoadRef:k,onLoadingCompleteRef:x,setBlurComplete:y,setShowAltText:w,sizesInput:C,onLoad:E,onError:S,...M}=e;return(0,a.jsx)("img",{...M,...g(m),loading:f,width:c,height:l,decoding:s,"data-nimg":v?"fill":"1",className:d,style:u,sizes:o,srcSet:r,src:n,ref:(0,i.useCallback)(e=>{t&&("function"==typeof t?t(e):"object"==typeof t&&(t.current=e)),e&&(S&&(e.src=e.src),e.complete&&p(e,h,k,x,y,b,C))},[n,h,k,x,y,S,b,C,t]),onLoad:e=>{p(e.currentTarget,h,k,x,y,b,C)},onError:e=>{w(!0),"empty"!==h&&y(!0),S&&S(e)}})});function v(e){let{isAppRouter:t,imgAttributes:n}=e,r={as:"image",imageSrcSet:n.srcSet,imageSizes:n.sizes,crossOrigin:n.crossOrigin,referrerPolicy:n.referrerPolicy,...g(n.fetchPriority)};return t&&l.default.preload?(l.default.preload(n.src,r),null):(0,a.jsx)(c.default,{children:(0,a.jsx)("link",{rel:"preload",href:n.srcSet?void 0:n.src,...r},"__nimg-"+n.src+n.srcSet+n.sizes)})}let k=(0,i.forwardRef)((e,t)=>{let n=(0,i.useContext)(m.RouterContext),r=(0,i.useContext)(u.ImageConfigContext),o=(0,i.useMemo)(()=>{var e;let t=f||r||d.imageConfigDefault,n=[...t.deviceSizes,...t.imageSizes].sort((e,t)=>e-t),o=t.deviceSizes.sort((e,t)=>e-t),a=null==(e=t.qualities)?void 0:e.sort((e,t)=>e-t);return{...t,allSizes:n,deviceSizes:o,qualities:a}},[r]),{onLoad:l,onLoadingComplete:c}=e,p=(0,i.useRef)(l);(0,i.useEffect)(()=>{p.current=l},[l]);let g=(0,i.useRef)(c);(0,i.useEffect)(()=>{g.current=c},[c]);let[k,x]=(0,i.useState)(!1),[y,w]=(0,i.useState)(!1),{props:C,meta:E}=(0,s.getImgProps)(e,{defaultLoader:h.default,imgConf:o,blurComplete:k,showAltText:y});return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(b,{...C,unoptimized:E.unoptimized,placeholder:E.placeholder,fill:E.fill,onLoadRef:p,onLoadingCompleteRef:g,setBlurComplete:x,setShowAltText:w,sizesInput:e.sizes,ref:t}),E.priority?(0,a.jsx)(v,{isAppRouter:!n,imgAttributes:C}):null]})});("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},91436:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"AmpStateContext",{enumerable:!0,get:function(){return r}});let r=n(47043)._(n(2265)).default.createContext({})},23964:function(e,t){function n(e){let{ampFirst:t=!1,hybrid:n=!1,hasQuery:r=!1}=void 0===e?{}:e;return t||n&&r}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"isInAmpMode",{enumerable:!0,get:function(){return n}})},55346:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"getImgProps",{enumerable:!0,get:function(){return l}}),n(31765);let r=n(96496),o=n(90128);function a(e){return void 0!==e.default}function i(e){return void 0===e?e:"number"==typeof e?Number.isFinite(e)?e:NaN:"string"==typeof e&&/^[0-9]+$/.test(e)?parseInt(e,10):NaN}function l(e,t){var n,l;let c,s,d,{src:u,sizes:m,unoptimized:h=!1,priority:f=!1,loading:p,className:g,quality:b,width:v,height:k,fill:x=!1,style:y,overrideSrc:w,onLoad:C,onLoadingComplete:E,placeholder:S="empty",blurDataURL:M,fetchPriority:z,decoding:Z="async",layout:O,objectFit:j,objectPosition:N,lazyBoundary:_,lazyRoot:I,...R}=e,{imgConf:P,showAltText:L,blurComplete:B,defaultLoader:H}=t,V=P||o.imageConfigDefault;if("allSizes"in V)c=V;else{let e=[...V.deviceSizes,...V.imageSizes].sort((e,t)=>e-t),t=V.deviceSizes.sort((e,t)=>e-t),r=null==(n=V.qualities)?void 0:n.sort((e,t)=>e-t);c={...V,allSizes:e,deviceSizes:t,qualities:r}}if(void 0===H)throw Error("images.loaderFile detected but the file is missing default export.\nRead more: https://nextjs.org/docs/messages/invalid-images-config");let A=R.loader||H;delete R.loader,delete R.srcSet;let T="__next_img_default"in A;if(T){if("custom"===c.loader)throw Error('Image with src "'+u+'" is missing "loader" prop.\nRead more: https://nextjs.org/docs/messages/next-image-missing-loader')}else{let e=A;A=t=>{let{config:n,...r}=t;return e(r)}}if(O){"fill"===O&&(x=!0);let e={intrinsic:{maxWidth:"100%",height:"auto"},responsive:{width:"100%",height:"auto"}}[O];e&&(y={...y,...e});let t={responsive:"100vw",fill:"100vw"}[O];t&&!m&&(m=t)}let q="",W=i(v),F=i(k);if("object"==typeof(l=u)&&(a(l)||void 0!==l.src)){let e=a(u)?u.default:u;if(!e.src)throw Error("An object should only be passed to the image component src parameter if it comes from a static image import. It must include src. Received "+JSON.stringify(e));if(!e.height||!e.width)throw Error("An object should only be passed to the image component src parameter if it comes from a static image import. It must include height and width. Received "+JSON.stringify(e));if(s=e.blurWidth,d=e.blurHeight,M=M||e.blurDataURL,q=e.src,!x){if(W||F){if(W&&!F){let t=W/e.width;F=Math.round(e.height*t)}else if(!W&&F){let t=F/e.height;W=Math.round(e.width*t)}}else W=e.width,F=e.height}}let D=!f&&("lazy"===p||void 0===p);(!(u="string"==typeof u?u:q)||u.startsWith("data:")||u.startsWith("blob:"))&&(h=!0,D=!1),c.unoptimized&&(h=!0),T&&u.endsWith(".svg")&&!c.dangerouslyAllowSVG&&(h=!0),f&&(z="high");let G=i(b),K=Object.assign(x?{position:"absolute",height:"100%",width:"100%",left:0,top:0,right:0,bottom:0,objectFit:j,objectPosition:N}:{},L?{}:{color:"transparent"},y),U=B||"empty"===S?null:"blur"===S?'url("data:image/svg+xml;charset=utf-8,'+(0,r.getImageBlurSvg)({widthInt:W,heightInt:F,blurWidth:s,blurHeight:d,blurDataURL:M||"",objectFit:K.objectFit})+'")':'url("'+S+'")',X=U?{backgroundSize:K.objectFit||"cover",backgroundPosition:K.objectPosition||"50% 50%",backgroundRepeat:"no-repeat",backgroundImage:U}:{},$=function(e){let{config:t,src:n,unoptimized:r,width:o,quality:a,sizes:i,loader:l}=e;if(r)return{src:n,srcSet:void 0,sizes:void 0};let{widths:c,kind:s}=function(e,t,n){let{deviceSizes:r,allSizes:o}=e;if(n){let e=/(^|\s)(1?\d?\d)vw/g,t=[];for(let r;r=e.exec(n);r)t.push(parseInt(r[2]));if(t.length){let e=.01*Math.min(...t);return{widths:o.filter(t=>t>=r[0]*e),kind:"w"}}return{widths:o,kind:"w"}}return"number"!=typeof t?{widths:r,kind:"w"}:{widths:[...new Set([t,2*t].map(e=>o.find(t=>t>=e)||o[o.length-1]))],kind:"x"}}(t,o,i),d=c.length-1;return{sizes:i||"w"!==s?i:"100vw",srcSet:c.map((e,r)=>l({config:t,src:n,quality:a,width:e})+" "+("w"===s?e:r+1)+s).join(", "),src:l({config:t,src:n,quality:a,width:c[d]})}}({config:c,src:u,unoptimized:h,width:W,quality:G,sizes:m,loader:A});return{props:{...R,loading:D?"lazy":p,fetchPriority:z,width:W,height:F,decoding:Z,className:g,style:{...K,...X},sizes:$.sizes,srcSet:$.srcSet,src:w||$.src},meta:{unoptimized:h,priority:f,placeholder:S,fill:x}}}},38293:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{default:function(){return p},defaultHead:function(){return u}});let r=n(47043),o=n(53099),a=n(57437),i=o._(n(2265)),l=r._(n(17421)),c=n(91436),s=n(48701),d=n(23964);function u(e){void 0===e&&(e=!1);let t=[(0,a.jsx)("meta",{charSet:"utf-8"})];return e||t.push((0,a.jsx)("meta",{name:"viewport",content:"width=device-width"})),t}function m(e,t){return"string"==typeof t||"number"==typeof t?e:t.type===i.default.Fragment?e.concat(i.default.Children.toArray(t.props.children).reduce((e,t)=>"string"==typeof t||"number"==typeof t?e:e.concat(t),[])):e.concat(t)}n(31765);let h=["name","httpEquiv","charSet","itemProp"];function f(e,t){let{inAmpMode:n}=t;return e.reduce(m,[]).reverse().concat(u(n).reverse()).filter(function(){let e=new Set,t=new Set,n=new Set,r={};return o=>{let a=!0,i=!1;if(o.key&&"number"!=typeof o.key&&o.key.indexOf("$")>0){i=!0;let t=o.key.slice(o.key.indexOf("$")+1);e.has(t)?a=!1:e.add(t)}switch(o.type){case"title":case"base":t.has(o.type)?a=!1:t.add(o.type);break;case"meta":for(let e=0,t=h.length;e{let r=e.key||t;if(!n&&"link"===e.type&&e.props.href&&["https://fonts.googleapis.com/css","https://use.typekit.net/"].some(t=>e.props.href.startsWith(t))){let t={...e.props||{}};return t["data-href"]=t.href,t.href=void 0,t["data-optimized-fonts"]=!0,i.default.cloneElement(e,t)}return i.default.cloneElement(e,{key:r})})}let p=function(e){let{children:t}=e,n=(0,i.useContext)(c.AmpStateContext),r=(0,i.useContext)(s.HeadManagerContext);return(0,a.jsx)(l.default,{reduceComponentsToState:f,headManager:r,inAmpMode:(0,d.isInAmpMode)(n),children:t})};("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},96496:function(e,t){function n(e){let{widthInt:t,heightInt:n,blurWidth:r,blurHeight:o,blurDataURL:a,objectFit:i}=e,l=r?40*r:t,c=o?40*o:n,s=l&&c?"viewBox='0 0 "+l+" "+c+"'":"";return"%3Csvg xmlns='http://www.w3.org/2000/svg' "+s+"%3E%3Cfilter id='b' color-interpolation-filters='sRGB'%3E%3CfeGaussianBlur stdDeviation='20'/%3E%3CfeColorMatrix values='1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 100 -1' result='s'/%3E%3CfeFlood x='0' y='0' width='100%25' height='100%25'/%3E%3CfeComposite operator='out' in='s'/%3E%3CfeComposite in2='SourceGraphic'/%3E%3CfeGaussianBlur stdDeviation='20'/%3E%3C/filter%3E%3Cimage width='100%25' height='100%25' x='0' y='0' preserveAspectRatio='"+(s?"none":"contain"===i?"xMidYMid":"cover"===i?"xMidYMid slice":"none")+"' style='filter: url(%23b);' href='"+a+"'/%3E%3C/svg%3E"}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"getImageBlurSvg",{enumerable:!0,get:function(){return n}})},62589:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"ImageConfigContext",{enumerable:!0,get:function(){return a}});let r=n(47043)._(n(2265)),o=n(90128),a=r.default.createContext(o.imageConfigDefault)},90128:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{VALID_LOADERS:function(){return n},imageConfigDefault:function(){return r}});let n=["default","imgix","cloudinary","akamai","custom"],r={deviceSizes:[640,750,828,1080,1200,1920,2048,3840],imageSizes:[16,32,48,64,96,128,256,384],path:"/_next/image",loader:"default",loaderFile:"",domains:[],disableStaticImages:!1,minimumCacheTTL:60,formats:["image/webp"],dangerouslyAllowSVG:!1,contentSecurityPolicy:"script-src 'none'; frame-src 'none'; sandbox;",contentDispositionType:"inline",localPatterns:void 0,remotePatterns:[],qualities:void 0,unoptimized:!1}},48461:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{default:function(){return c},getImageProps:function(){return l}});let r=n(47043),o=n(55346),a=n(65878),i=r._(n(5084));function l(e){let{props:t}=(0,o.getImgProps)(e,{defaultLoader:i.default,imgConf:{deviceSizes:[640,750,828,1080,1200,1920,2048,3840],imageSizes:[16,32,48,64,96,128,256,384],path:"/_next/image",loader:"default",dangerouslyAllowSVG:!1,unoptimized:!1}});for(let[e,n]of Object.entries(t))void 0===n&&delete t[e];return{props:t}}let c=a.Image},5084:function(e,t){function n(e){var t;let{config:n,src:r,width:o,quality:a}=e,i=a||(null==(t=n.qualities)?void 0:t.reduce((e,t)=>Math.abs(t-75){}:r.useLayoutEffect,i=o?()=>{}:r.useEffect;function l(e){let{headManager:t,reduceComponentsToState:n}=e;function l(){if(t&&t.mountedInstances){let o=r.Children.toArray(Array.from(t.mountedInstances).filter(Boolean));t.updateHead(n(o,e))}}if(o){var c;null==t||null==(c=t.mountedInstances)||c.add(e.children),l()}return a(()=>{var n;return null==t||null==(n=t.mountedInstances)||n.add(e.children),()=>{var n;null==t||null==(n=t.mountedInstances)||n.delete(e.children)}}),a(()=>(t&&(t._pendingUpdate=l),()=>{t&&(t._pendingUpdate=l)})),i(()=>(t&&t._pendingUpdate&&(t._pendingUpdate(),t._pendingUpdate=null),()=>{t&&t._pendingUpdate&&(t._pendingUpdate(),t._pendingUpdate=null)})),null}},1479:function(e,t){t.Z={'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%)"}}},82422:function(e,t,n){var r=n(2265);let o=r.forwardRef(function(e,t){return r.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),r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"}))});t.Z=o},51853:function(e,t,n){var r=n(2265);let o=r.forwardRef(function(e,t){return r.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),r.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"}))});t.Z=o},3477:function(e,t,n){var r=n(2265);let o=r.forwardRef(function(e,t){return r.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),r.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"}))});t.Z=o},71437:function(e,t,n){var r=n(2265);let o=r.forwardRef(function(e,t){return r.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),r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),r.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"}))});t.Z=o},82376:function(e,t,n){var r=n(2265);let o=r.forwardRef(function(e,t){return r.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),r.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"}))});t.Z=o},17732:function(e,t,n){var r=n(2265);let o=r.forwardRef(function(e,t){return r.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),r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"}))});t.Z=o},3837:function(e,t,n){var r=n(2265);let o=r.forwardRef(function(e,t){return r.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),r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"}))});t.Z=o},19616:function(e,t,n){n.d(t,{G:function(){return i}});var r=n(2265);let o={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={...o,...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 i(e,t){let[n,o]=(0,r.useState)(e),i=function(e,t){let[n]=(0,r.useState)(()=>{var n;return Object.getOwnPropertyNames(Object.getPrototypeOf(n=new a(e,t))).filter(e=>"function"==typeof n[e]).reduce((e,t)=>{let r=n[t];return"function"==typeof r&&(e[t]=r.bind(n)),e},{})});return n.setOptions(t),n}(o,t);return[n,i.maybeExecute,i]}},21770:function(e,t,n){n.d(t,{D:function(){return u}});var r=n(2265),o=n(2894),a=n(18238),i=n(24112),l=n(45345),c=class extends i.l{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#o()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),(0,l.VS)(this.options,t)||this.#e.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&(0,l.Ym)(t.mutationKey)!==(0,l.Ym)(this.options.mutationKey)?this.reset():this.#n?.state.status==="pending"&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#o(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#o(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#o(){let e=this.#n?.state??(0,o.R)();this.#t={...e,isPending:"pending"===e.status,isSuccess:"success"===e.status,isError:"error"===e.status,isIdle:"idle"===e.status,mutate:this.mutate,reset:this.reset}}#a(e){a.V.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context;e?.type==="success"?(this.#r.onSuccess?.(e.data,t,n),this.#r.onSettled?.(e.data,null,t,n)):e?.type==="error"&&(this.#r.onError?.(e.error,t,n),this.#r.onSettled?.(void 0,e.error,t,n))}this.listeners.forEach(e=>{e(this.#t)})})}},s=n(29827),d=n(51172);function u(e,t){let n=(0,s.NL)(t),[o]=r.useState(()=>new c(n,e));r.useEffect(()=>{o.setOptions(e)},[o,e]);let i=r.useSyncExternalStore(r.useCallback(e=>o.subscribe(a.V.batchCalls(e)),[o]),()=>o.getCurrentResult(),()=>o.getCurrentResult()),l=r.useCallback((e,t)=>{o.mutate(e,t).catch(d.Z)},[o]);if(i.error&&(0,d.L)(o.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:l,mutateAsync:i.mutate}}}}]);
\ No newline at end of file
diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/131-114a46ffd6544611.js b/litellm/proxy/_experimental/out/_next/static/chunks/131-430e945bc56307dc.js
similarity index 100%
rename from litellm/proxy/_experimental/out/_next/static/chunks/131-114a46ffd6544611.js
rename to litellm/proxy/_experimental/out/_next/static/chunks/131-430e945bc56307dc.js
diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/1739-fc28b5c8fce919b7.js b/litellm/proxy/_experimental/out/_next/static/chunks/1739-b8a3795ea80fe5e5.js
similarity index 100%
rename from litellm/proxy/_experimental/out/_next/static/chunks/1739-fc28b5c8fce919b7.js
rename to litellm/proxy/_experimental/out/_next/static/chunks/1739-b8a3795ea80fe5e5.js
diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/1853-fa2eb7102429db88.js b/litellm/proxy/_experimental/out/_next/static/chunks/1853-fa2eb7102429db88.js
deleted file mode 100644
index bf9673fcf7c..00000000000
--- a/litellm/proxy/_experimental/out/_next/static/chunks/1853-fa2eb7102429db88.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1853],{41649:function(e,t,n){n.d(t,{Z:function(){return f}});var r=n(5853),a=n(2265),o=n(1526),l=n(7084),i=n(26898),c=n(97324),s=n(1153);let d={xs:{paddingX:"px-2",paddingY:"py-0.5",fontSize:"text-xs"},sm:{paddingX:"px-2.5",paddingY:"py-0.5",fontSize:"text-sm"},md:{paddingX:"px-3",paddingY:"py-0.5",fontSize:"text-md"},lg:{paddingX:"px-3.5",paddingY:"py-0.5",fontSize:"text-lg"},xl:{paddingX:"px-4",paddingY:"py-1",fontSize:"text-xl"}},u={xs:{height:"h-4",width:"w-4"},sm:{height:"h-4",width:"w-4"},md:{height:"h-4",width:"w-4"},lg:{height:"h-5",width:"w-5"},xl:{height:"h-6",width:"w-6"}},p=(0,s.fn)("Badge"),f=a.forwardRef((e,t)=>{let{color:n,icon:f,size:m=l.u8.SM,tooltip:h,className:g,children:b}=e,v=(0,r._T)(e,["color","icon","size","tooltip","className","children"]),x=f||null,{tooltipProps:w,getReferenceProps:k}=(0,o.l)();return a.createElement("span",Object.assign({ref:(0,s.lq)([t,w.refs.setReference]),className:(0,c.q)(p("root"),"w-max flex-shrink-0 inline-flex justify-center items-center cursor-default rounded-tremor-full",n?(0,c.q)((0,s.bM)(n,i.K.background).bgColor,(0,s.bM)(n,i.K.text).textColor,"bg-opacity-20 dark:bg-opacity-25"):(0,c.q)("bg-tremor-brand-muted text-tremor-brand-emphasis","dark:bg-dark-tremor-brand-muted dark:text-dark-tremor-brand-emphasis"),d[m].paddingX,d[m].paddingY,d[m].fontSize,g)},k,v),a.createElement(o.Z,Object.assign({text:h},w)),x?a.createElement(x,{className:(0,c.q)(p("icon"),"shrink-0 -ml-1 mr-1.5",u[m].height,u[m].width)}):null,a.createElement("p",{className:(0,c.q)(p("text"),"text-sm whitespace-nowrap")},b))});f.displayName="Badge"},30150:function(e,t,n){n.d(t,{Z:function(){return p}});var r=n(5853),a=n(2265);let o=e=>{var t=(0,r._T)(e,[]);return a.createElement("svg",Object.assign({},t,{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2.5"}),a.createElement("path",{d:"M12 4v16m8-8H4"}))},l=e=>{var t=(0,r._T)(e,[]);return a.createElement("svg",Object.assign({},t,{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2.5"}),a.createElement("path",{d:"M20 12H4"}))};var i=n(97324),c=n(1153),s=n(69262);let d="flex mx-auto text-tremor-content-subtle dark:text-dark-tremor-content-subtle",u="cursor-pointer hover:text-tremor-content dark:hover:text-dark-tremor-content",p=a.forwardRef((e,t)=>{let{onSubmit:n,enableStepper:p=!0,disabled:f,onValueChange:m,onChange:h}=e,g=(0,r._T)(e,["onSubmit","enableStepper","disabled","onValueChange","onChange"]),b=(0,a.useRef)(null),[v,x]=a.useState(!1),w=a.useCallback(()=>{x(!0)},[]),k=a.useCallback(()=>{x(!1)},[]),[y,E]=a.useState(!1),S=a.useCallback(()=>{E(!0)},[]),C=a.useCallback(()=>{E(!1)},[]);return a.createElement(s.Z,Object.assign({type:"number",ref:(0,c.lq)([b,t]),disabled:f,makeInputClassName:(0,c.fn)("NumberInput"),onKeyDown:e=>{var t;if("Enter"===e.key&&!e.ctrlKey&&!e.altKey&&!e.shiftKey){let e=null===(t=b.current)||void 0===t?void 0:t.value;null==n||n(parseFloat(null!=e?e:""))}"ArrowDown"===e.key&&w(),"ArrowUp"===e.key&&S()},onKeyUp:e=>{"ArrowDown"===e.key&&k(),"ArrowUp"===e.key&&C()},onChange:e=>{f||(null==m||m(parseFloat(e.target.value)),null==h||h(e))},stepper:p?a.createElement("div",{className:(0,i.q)("flex justify-center align-middle")},a.createElement("div",{tabIndex:-1,onClick:e=>e.preventDefault(),onMouseDown:e=>e.preventDefault(),onTouchStart:e=>{e.cancelable&&e.preventDefault()},onMouseUp:()=>{var e,t;f||(null===(e=b.current)||void 0===e||e.stepDown(),null===(t=b.current)||void 0===t||t.dispatchEvent(new Event("input",{bubbles:!0})))},className:(0,i.q)(!f&&u,d,"group py-[10px] px-2.5 border-l border-tremor-border dark:border-dark-tremor-border")},a.createElement(l,{"data-testid":"step-down",className:(v?"scale-95":"")+" h-4 w-4 duration-75 transition group-active:scale-95"})),a.createElement("div",{tabIndex:-1,onClick:e=>e.preventDefault(),onMouseDown:e=>e.preventDefault(),onTouchStart:e=>{e.cancelable&&e.preventDefault()},onMouseUp:()=>{var e,t;f||(null===(e=b.current)||void 0===e||e.stepUp(),null===(t=b.current)||void 0===t||t.dispatchEvent(new Event("input",{bubbles:!0})))},className:(0,i.q)(!f&&u,d,"group py-[10px] px-2.5 border-l border-tremor-border dark:border-dark-tremor-border")},a.createElement(o,{"data-testid":"step-up",className:(y?"scale-95":"")+" h-4 w-4 duration-75 transition group-active:scale-95"}))):null},g))});p.displayName="NumberInput"},87452:function(e,t,n){n.d(t,{Z:function(){return u},r:function(){return d}});var r=n(5853),a=n(21886);n(42698),n(64016);var o=n(8710);n(33232);var l=n(97324),i=n(1153),c=n(2265);let s=(0,i.fn)("Accordion"),d=(0,c.createContext)({isOpen:!1}),u=c.forwardRef((e,t)=>{var n;let{defaultOpen:i=!1,children:u,className:p}=e,f=(0,r._T)(e,["defaultOpen","children","className"]),m=null!==(n=(0,c.useContext)(o.Z))&&void 0!==n?n:(0,l.q)("rounded-tremor-default border");return c.createElement(a.p,Object.assign({as:"div",ref:t,className:(0,l.q)(s("root"),"overflow-hidden","bg-tremor-background border-tremor-border","dark:bg-dark-tremor-background dark:border-dark-tremor-border",m,p),defaultOpen:i},f),e=>{let{open:t}=e;return c.createElement(d.Provider,{value:{isOpen:t}},u)})});u.displayName="Accordion"},88829:function(e,t,n){n.d(t,{Z:function(){return c}});var r=n(5853),a=n(2265),o=n(21886),l=n(97324);let i=(0,n(1153).fn)("AccordionBody"),c=a.forwardRef((e,t)=>{let{children:n,className:c}=e,s=(0,r._T)(e,["children","className"]);return a.createElement(o.p.Panel,Object.assign({ref:t,className:(0,l.q)(i("root"),"w-full text-tremor-default px-4 pb-3","text-tremor-content","dark:text-dark-tremor-content",c)},s),n)});c.displayName="AccordionBody"},72208:function(e,t,n){n.d(t,{Z:function(){return d}});var r=n(5853),a=n(2265),o=n(21886);let l=e=>{var t=(0,r._T)(e,[]);return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),a.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 i=n(87452),c=n(97324);let s=(0,n(1153).fn)("AccordionHeader"),d=a.forwardRef((e,t)=>{let{children:n,className:d}=e,u=(0,r._T)(e,["children","className"]),{isOpen:p}=(0,a.useContext)(i.r);return a.createElement(o.p.Button,Object.assign({ref:t,className:(0,c.q)(s("root"),"w-full flex items-center justify-between px-4 py-3","text-tremor-content-emphasis","dark:text-dark-tremor-content-emphasis",d)},u),a.createElement("div",{className:(0,c.q)(s("children"),"flex flex-1 text-inherit mr-4")},n),a.createElement("div",null,a.createElement(l,{className:(0,c.q)(s("arrowIcon"),"h-5 w-5 -mr-1","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle",p?"transition-all":"transition-all -rotate-180")})))});d.displayName="AccordionHeader"},23496:function(e,t,n){n.d(t,{Z:function(){return m}});var r=n(2265),a=n(36760),o=n.n(a),l=n(71744),i=n(352),c=n(12918),s=n(80669),d=n(3104);let u=e=>{let{componentCls:t,sizePaddingEdgeHorizontal:n,colorSplit:r,lineWidth:a,textPaddingInline:o,orientationMargin:l,verticalMarginInline:s}=e;return{[t]:Object.assign(Object.assign({},(0,c.Wf)(e)),{borderBlockStart:"".concat((0,i.bf)(a)," solid ").concat(r),"&-vertical":{position:"relative",top:"-0.06em",display:"inline-block",height:"0.9em",marginInline:s,marginBlock:0,verticalAlign:"middle",borderTop:0,borderInlineStart:"".concat((0,i.bf)(a)," solid ").concat(r)},"&-horizontal":{display:"flex",clear:"both",width:"100%",minWidth:"100%",margin:"".concat((0,i.bf)(e.dividerHorizontalGutterMargin)," 0")},["&-horizontal".concat(t,"-with-text")]:{display:"flex",alignItems:"center",margin:"".concat((0,i.bf)(e.dividerHorizontalWithTextGutterMargin)," 0"),color:e.colorTextHeading,fontWeight:500,fontSize:e.fontSizeLG,whiteSpace:"nowrap",textAlign:"center",borderBlockStart:"0 ".concat(r),"&::before, &::after":{position:"relative",width:"50%",borderBlockStart:"".concat((0,i.bf)(a)," solid transparent"),borderBlockStartColor:"inherit",borderBlockEnd:0,transform:"translateY(50%)",content:"''"}},["&-horizontal".concat(t,"-with-text-left")]:{"&::before":{width:"calc(".concat(l," * 100%)")},"&::after":{width:"calc(100% - ".concat(l," * 100%)")}},["&-horizontal".concat(t,"-with-text-right")]:{"&::before":{width:"calc(100% - ".concat(l," * 100%)")},"&::after":{width:"calc(".concat(l," * 100%)")}},["".concat(t,"-inner-text")]:{display:"inline-block",paddingBlock:0,paddingInline:o},"&-dashed":{background:"none",borderColor:r,borderStyle:"dashed",borderWidth:"".concat((0,i.bf)(a)," 0 0")},["&-horizontal".concat(t,"-with-text").concat(t,"-dashed")]:{"&::before, &::after":{borderStyle:"dashed none none"}},["&-vertical".concat(t,"-dashed")]:{borderInlineStartWidth:a,borderInlineEnd:0,borderBlockStart:0,borderBlockEnd:0},["&-plain".concat(t,"-with-text")]:{color:e.colorText,fontWeight:"normal",fontSize:e.fontSize},["&-horizontal".concat(t,"-with-text-left").concat(t,"-no-default-orientation-margin-left")]:{"&::before":{width:0},"&::after":{width:"100%"},["".concat(t,"-inner-text")]:{paddingInlineStart:n}},["&-horizontal".concat(t,"-with-text-right").concat(t,"-no-default-orientation-margin-right")]:{"&::before":{width:"100%"},"&::after":{width:0},["".concat(t,"-inner-text")]:{paddingInlineEnd:n}}})}};var p=(0,s.I$)("Divider",e=>[u((0,d.TS)(e,{dividerHorizontalWithTextGutterMargin:e.margin,dividerHorizontalGutterMargin:e.marginLG,sizePaddingEdgeHorizontal:0}))],e=>({textPaddingInline:"1em",orientationMargin:.05,verticalMarginInline:e.marginXS}),{unitless:{orientationMargin:!0}}),f=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,r=Object.getOwnPropertySymbols(e);at.indexOf(r[a])&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]]);return n},m=e=>{let{getPrefixCls:t,direction:n,divider:a}=r.useContext(l.E_),{prefixCls:i,type:c="horizontal",orientation:s="center",orientationMargin:d,className:u,rootClassName:m,children:h,dashed:g,plain:b,style:v}=e,x=f(e,["prefixCls","type","orientation","orientationMargin","className","rootClassName","children","dashed","plain","style"]),w=t("divider",i),[k,y,E]=p(w),S=s.length>0?"-".concat(s):s,C=!!h,I="left"===s&&null!=d,N="right"===s&&null!=d,O=o()(w,null==a?void 0:a.className,y,E,"".concat(w,"-").concat(c),{["".concat(w,"-with-text")]:C,["".concat(w,"-with-text").concat(S)]:C,["".concat(w,"-dashed")]:!!g,["".concat(w,"-plain")]:!!b,["".concat(w,"-rtl")]:"rtl"===n,["".concat(w,"-no-default-orientation-margin-left")]:I,["".concat(w,"-no-default-orientation-margin-right")]:N},u,m),P=r.useMemo(()=>"number"==typeof d?d:/^\d+$/.test(d)?Number(d):d,[d]),M=Object.assign(Object.assign({},I&&{marginLeft:P}),N&&{marginRight:P});return k(r.createElement("div",Object.assign({className:O,style:Object.assign(Object.assign({},null==a?void 0:a.style),v)},x,{role:"separator"}),h&&"vertical"!==c&&r.createElement("span",{className:"".concat(w,"-inner-text"),style:M},h)))}},30401:function(e,t,n){n.d(t,{Z:function(){return r}});let r=(0,n(79205).Z)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]])},78867:function(e,t,n){n.d(t,{Z:function(){return r}});let r=(0,n(79205).Z)("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]])},21886:function(e,t,n){let r,a;n.d(t,{p:function(){return O}});var o,l=n(2265),i=n(13323),c=n(17684),s=n(80004),d=n(93689),u=n(37863),p=n(47634),f=n(24536),m=n(40293),h=n(27847);let g=null!=(o=l.startTransition)?o:function(e){e()};var b=n(37388),v=((r=v||{})[r.Open=0]="Open",r[r.Closed=1]="Closed",r),x=((a=x||{})[a.ToggleDisclosure=0]="ToggleDisclosure",a[a.CloseDisclosure=1]="CloseDisclosure",a[a.SetButtonId=2]="SetButtonId",a[a.SetPanelId=3]="SetPanelId",a[a.LinkPanel=4]="LinkPanel",a[a.UnlinkPanel=5]="UnlinkPanel",a);let w={0:e=>({...e,disclosureState:(0,f.E)(e.disclosureState,{0:1,1:0})}),1:e=>1===e.disclosureState?e:{...e,disclosureState:1},4:e=>!0===e.linkedPanel?e:{...e,linkedPanel:!0},5:e=>!1===e.linkedPanel?e:{...e,linkedPanel:!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}},k=(0,l.createContext)(null);function y(e){let t=(0,l.useContext)(k);if(null===t){let t=Error("<".concat(e," /> is missing a parent component."));throw Error.captureStackTrace&&Error.captureStackTrace(t,y),t}return t}k.displayName="DisclosureContext";let E=(0,l.createContext)(null);E.displayName="DisclosureAPIContext";let S=(0,l.createContext)(null);function C(e,t){return(0,f.E)(t.type,w,e,t)}S.displayName="DisclosurePanelContext";let I=l.Fragment,N=h.AN.RenderStrategy|h.AN.Static,O=Object.assign((0,h.yV)(function(e,t){let{defaultOpen:n=!1,...r}=e,a=(0,l.useRef)(null),o=(0,d.T)(t,(0,d.h)(e=>{a.current=e},void 0===e.as||e.as===l.Fragment)),c=(0,l.useRef)(null),s=(0,l.useRef)(null),p=(0,l.useReducer)(C,{disclosureState:n?0:1,linkedPanel:!1,buttonRef:s,panelRef:c,buttonId:null,panelId:null}),[{disclosureState:g,buttonId:b},v]=p,x=(0,i.z)(e=>{v({type:1});let t=(0,m.r)(a);if(!t||!b)return;let n=e?e instanceof HTMLElement?e:e.current instanceof HTMLElement?e.current:t.getElementById(b):t.getElementById(b);null==n||n.focus()}),w=(0,l.useMemo)(()=>({close:x}),[x]),y=(0,l.useMemo)(()=>({open:0===g,close:x}),[g,x]);return l.createElement(k.Provider,{value:p},l.createElement(E.Provider,{value:w},l.createElement(u.up,{value:(0,f.E)(g,{0:u.ZM.Open,1:u.ZM.Closed})},(0,h.sY)({ourProps:{ref:o},theirProps:r,slot:y,defaultTag:I,name:"Disclosure"}))))}),{Button:(0,h.yV)(function(e,t){let n=(0,c.M)(),{id:r="headlessui-disclosure-button-".concat(n),...a}=e,[o,u]=y("Disclosure.Button"),f=(0,l.useContext)(S),m=null!==f&&f===o.panelId,g=(0,l.useRef)(null),v=(0,d.T)(g,t,m?null:o.buttonRef),x=(0,h.Y2)();(0,l.useEffect)(()=>{if(!m)return u({type:2,buttonId:r}),()=>{u({type:2,buttonId:null})}},[r,u,m]);let w=(0,i.z)(e=>{var t;if(m){if(1===o.disclosureState)return;switch(e.key){case b.R.Space:case b.R.Enter:e.preventDefault(),e.stopPropagation(),u({type:0}),null==(t=o.buttonRef.current)||t.focus()}}else switch(e.key){case b.R.Space:case b.R.Enter:e.preventDefault(),e.stopPropagation(),u({type:0})}}),k=(0,i.z)(e=>{e.key===b.R.Space&&e.preventDefault()}),E=(0,i.z)(t=>{var n;(0,p.P)(t.currentTarget)||e.disabled||(m?(u({type:0}),null==(n=o.buttonRef.current)||n.focus()):u({type:0}))}),C=(0,l.useMemo)(()=>({open:0===o.disclosureState}),[o]),I=(0,s.f)(e,g),N=m?{ref:v,type:I,onKeyDown:w,onClick:E}:{ref:v,id:r,type:I,"aria-expanded":0===o.disclosureState,"aria-controls":o.linkedPanel?o.panelId:void 0,onKeyDown:w,onKeyUp:k,onClick:E};return(0,h.sY)({mergeRefs:x,ourProps:N,theirProps:a,slot:C,defaultTag:"button",name:"Disclosure.Button"})}),Panel:(0,h.yV)(function(e,t){let n=(0,c.M)(),{id:r="headlessui-disclosure-panel-".concat(n),...a}=e,[o,i]=y("Disclosure.Panel"),{close:s}=function e(t){let n=(0,l.useContext)(E);if(null===n){let n=Error("<".concat(t," /> is missing a parent component."));throw Error.captureStackTrace&&Error.captureStackTrace(n,e),n}return n}("Disclosure.Panel"),p=(0,h.Y2)(),f=(0,d.T)(t,o.panelRef,e=>{g(()=>i({type:e?4:5}))});(0,l.useEffect)(()=>(i({type:3,panelId:r}),()=>{i({type:3,panelId:null})}),[r,i]);let m=(0,u.oJ)(),b=null!==m?(m&u.ZM.Open)===u.ZM.Open:0===o.disclosureState,v=(0,l.useMemo)(()=>({open:0===o.disclosureState,close:s}),[o,s]);return l.createElement(S.Provider,{value:o.panelId},(0,h.sY)({mergeRefs:p,ourProps:{ref:f,id:r},theirProps:a,slot:v,defaultTag:"div",features:N,visible:b,name:"Disclosure.Panel"}))})})},86462:function(e,t,n){var r=n(2265);let a=r.forwardRef(function(e,t){return r.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),r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"}))});t.Z=a},23628:function(e,t,n){var r=n(2265);let a=r.forwardRef(function(e,t){return r.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),r.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"}))});t.Z=a}}]);
\ No newline at end of file
diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/2004-08bb1f463a2409e4.js b/litellm/proxy/_experimental/out/_next/static/chunks/2004-836e8f164e69b068.js
similarity index 100%
rename from litellm/proxy/_experimental/out/_next/static/chunks/2004-08bb1f463a2409e4.js
rename to litellm/proxy/_experimental/out/_next/static/chunks/2004-836e8f164e69b068.js
diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/2012-349484b0c5e31882.js b/litellm/proxy/_experimental/out/_next/static/chunks/2012-0bbf11e40fd2af7d.js
similarity index 100%
rename from litellm/proxy/_experimental/out/_next/static/chunks/2012-349484b0c5e31882.js
rename to litellm/proxy/_experimental/out/_next/static/chunks/2012-0bbf11e40fd2af7d.js
diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/2019-48d89281c5103ab7.js b/litellm/proxy/_experimental/out/_next/static/chunks/2019-c448ee48f8526098.js
similarity index 100%
rename from litellm/proxy/_experimental/out/_next/static/chunks/2019-48d89281c5103ab7.js
rename to litellm/proxy/_experimental/out/_next/static/chunks/2019-c448ee48f8526098.js
diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/2162-246f81f806dcd551.js b/litellm/proxy/_experimental/out/_next/static/chunks/2162-52d2743e52b9b773.js
similarity index 100%
rename from litellm/proxy/_experimental/out/_next/static/chunks/2162-246f81f806dcd551.js
rename to litellm/proxy/_experimental/out/_next/static/chunks/2162-52d2743e52b9b773.js
diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/2202-5828413daf645b2b.js b/litellm/proxy/_experimental/out/_next/static/chunks/2202-902e08da4e70850b.js
similarity index 99%
rename from litellm/proxy/_experimental/out/_next/static/chunks/2202-5828413daf645b2b.js
rename to litellm/proxy/_experimental/out/_next/static/chunks/2202-902e08da4e70850b.js
index 360c52e29ce..f673220808f 100644
--- a/litellm/proxy/_experimental/out/_next/static/chunks/2202-5828413daf645b2b.js
+++ b/litellm/proxy/_experimental/out/_next/static/chunks/2202-902e08da4e70850b.js
@@ -1 +1 @@
-"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2202],{19431:function(e,s,t){t.d(s,{x:function(){return a.Z},z:function(){return l.Z}});var l=t(20831),a=t(84264)},65925:function(e,s,t){t.d(s,{m:function(){return i}});var l=t(57437);t(2265);var a=t(52787);let{Option:r}=a.default,i=e=>e?({"24h":"daily","7d":"weekly","30d":"monthly"})[e]||e:"Not set";s.Z=e=>{let{value:s,onChange:t,className:i="",style:n={}}=e;return(0,l.jsxs)(a.default,{style:{width:"100%",...n},value:s||void 0,onChange:t,className:i,placeholder:"n/a",children:[(0,l.jsx)(r,{value:"24h",children:"daily"}),(0,l.jsx)(r,{value:"7d",children:"weekly"}),(0,l.jsx)(r,{value:"30d",children:"monthly"})]})}},7765:function(e,s,t){t.d(s,{Z:function(){return q}});var l=t(57437),a=t(2265),r=t(52787),i=t(13634),n=t(64482),d=t(73002),o=t(82680),c=t(87452),m=t(88829),u=t(72208),x=t(20831),h=t(57365),f=t(84264),p=t(49566),j=t(96761),g=t(98187),v=t(19250),b=t(19431),y=t(93192),N=t(65319),_=t(72188),w=t(73879),k=t(34310),C=t(38434),S=t(26349),Z=t(35291),U=t(3632),I=t(15452),V=t.n(I),L=t(71157),P=t(44643),R=t(88532),D=t(29233),E=t(9114),T=e=>{let{accessToken:s,teams:t,possibleUIRoles:r,onUsersCreated:i}=e,[n,d]=(0,a.useState)(!1),[c,m]=(0,a.useState)([]),[u,x]=(0,a.useState)(!1),[h,f]=(0,a.useState)(null),[p,j]=(0,a.useState)(null),[g,I]=(0,a.useState)(null),[T,z]=(0,a.useState)(null),[O,B]=(0,a.useState)(null),[F,A]=(0,a.useState)("http://localhost:4000");(0,a.useEffect)(()=>{(async()=>{try{let e=await (0,v.getProxyUISettings)(s);B(e)}catch(e){console.error("Error fetching UI settings:",e)}})(),A(new URL("/",window.location.href).toString())},[s]);let M=async()=>{x(!0);let e=c.map(e=>({...e,status:"pending"}));m(e);let t=!1;for(let i=0;ie.trim()).filter(Boolean),0===e.teams.length&&delete e.teams),n.models&&"string"==typeof n.models&&""!==n.models.trim()&&(e.models=n.models.split(",").map(e=>e.trim()).filter(Boolean),0===e.models.length&&delete e.models),n.max_budget&&""!==n.max_budget.toString().trim()){let s=parseFloat(n.max_budget.toString());!isNaN(s)&&s>0&&(e.max_budget=s)}n.budget_duration&&""!==n.budget_duration.trim()&&(e.budget_duration=n.budget_duration.trim()),n.metadata&&"string"==typeof n.metadata&&""!==n.metadata.trim()&&(e.metadata=n.metadata.trim()),console.log("Sending user data:",e);let a=await (0,v.userCreateCall)(s,null,e);if(console.log("Full response:",a),a&&(a.key||a.user_id)){t=!0,console.log("Success case triggered");let e=(null===(l=a.data)||void 0===l?void 0:l.user_id)||a.user_id;try{if(null==O?void 0:O.SSO_ENABLED){let e=new URL("/ui",F).toString();m(s=>s.map((s,t)=>t===i?{...s,status:"success",key:a.key||a.user_id,invitation_link:e}:s))}else{let t=await (0,v.invitationCreateCall)(s,e),l=new URL("/ui?invitation_id=".concat(t.id),F).toString();m(e=>e.map((e,s)=>s===i?{...e,status:"success",key:a.key||a.user_id,invitation_link:l}:e))}}catch(e){console.error("Error creating invitation:",e),m(e=>e.map((e,s)=>s===i?{...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=(null==a?void 0:a.error)||"Failed to create user";console.log("Error message:",e),m(s=>s.map((s,t)=>t===i?{...s,status:"failed",error:e}:s))}}catch(s){console.error("Caught error:",s);let e=(null==s?void 0:null===(r=s.response)||void 0===r?void 0:null===(a=r.data)||void 0===a?void 0:a.error)||(null==s?void 0:s.message)||String(s);m(s=>s.map((s,t)=>t===i?{...s,status:"failed",error:e}:s))}}x(!1),t&&i&&i()};return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(b.z,{className:"mb-0",onClick:()=>d(!0),children:"+ Bulk Invite Users"}),(0,l.jsx)(o.Z,{title:"Bulk Invite Users",visible:n,width:800,onCancel:()=>d(!1),bodyStyle:{maxHeight:"70vh",overflow:"auto"},footer:null,children:(0,l.jsx)("div",{className:"flex flex-col",children:0===c.length?(0,l.jsxs)("div",{className:"mb-6",children:[(0,l.jsxs)("div",{className:"flex items-center mb-4",children:[(0,l.jsx)("div",{className:"w-8 h-8 rounded-full bg-blue-500 text-white flex items-center justify-center mr-3",children:"1"}),(0,l.jsx)("h3",{className:"text-lg font-medium",children:"Download and fill the template"})]}),(0,l.jsxs)("div",{className:"ml-11 mb-6",children:[(0,l.jsx)("p",{className:"mb-4",children:"Add multiple users at once by following these steps:"}),(0,l.jsxs)("ol",{className:"list-decimal list-inside space-y-2 ml-2 mb-4",children:[(0,l.jsx)("li",{children:"Download our CSV template"}),(0,l.jsx)("li",{children:"Add your users' information to the spreadsheet"}),(0,l.jsx)("li",{children:"Save the file and upload it here"}),(0,l.jsx)("li",{children:"After creation, download the results file containing the API keys for each user"})]}),(0,l.jsxs)("div",{className:"bg-gray-50 p-4 rounded-md border border-gray-200 mb-4",children:[(0,l.jsx)("h4",{className:"font-medium mb-2",children:"Template Column Names"}),(0,l.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[(0,l.jsxs)("div",{className:"flex items-start",children:[(0,l.jsx)("div",{className:"w-3 h-3 rounded-full bg-red-500 mt-1.5 mr-2 flex-shrink-0"}),(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"font-medium",children:"user_email"}),(0,l.jsx)("p",{className:"text-sm text-gray-600",children:"User's email address (required)"})]})]}),(0,l.jsxs)("div",{className:"flex items-start",children:[(0,l.jsx)("div",{className:"w-3 h-3 rounded-full bg-red-500 mt-1.5 mr-2 flex-shrink-0"}),(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"font-medium",children:"user_role"}),(0,l.jsx)("p",{className:"text-sm text-gray-600",children:'User\'s role (one of: "proxy_admin", "proxy_admin_view_only", "internal_user", "internal_user_view_only")'})]})]}),(0,l.jsxs)("div",{className:"flex items-start",children:[(0,l.jsx)("div",{className:"w-3 h-3 rounded-full bg-gray-300 mt-1.5 mr-2 flex-shrink-0"}),(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"font-medium",children:"teams"}),(0,l.jsx)("p",{className:"text-sm text-gray-600",children:'Comma-separated team IDs (e.g., "team-1,team-2")'})]})]}),(0,l.jsxs)("div",{className:"flex items-start",children:[(0,l.jsx)("div",{className:"w-3 h-3 rounded-full bg-gray-300 mt-1.5 mr-2 flex-shrink-0"}),(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"font-medium",children:"max_budget"}),(0,l.jsx)("p",{className:"text-sm text-gray-600",children:'Maximum budget as a number (e.g., "100")'})]})]}),(0,l.jsxs)("div",{className:"flex items-start",children:[(0,l.jsx)("div",{className:"w-3 h-3 rounded-full bg-gray-300 mt-1.5 mr-2 flex-shrink-0"}),(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"font-medium",children:"budget_duration"}),(0,l.jsx)("p",{className:"text-sm text-gray-600",children:'Budget reset period (e.g., "30d", "1mo")'})]})]}),(0,l.jsxs)("div",{className:"flex items-start",children:[(0,l.jsx)("div",{className:"w-3 h-3 rounded-full bg-gray-300 mt-1.5 mr-2 flex-shrink-0"}),(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"font-medium",children:"models"}),(0,l.jsx)("p",{className:"text-sm text-gray-600",children:'Comma-separated allowed models (e.g., "gpt-3.5-turbo,gpt-4")'})]})]})]})]}),(0,l.jsxs)(b.z,{onClick:()=>{let e=new Blob([V().unparse([["user_email","user_role","teams","max_budget","budget_duration","models"],["user@example.com","internal_user","team-id-1,team-id-2","100","30d","gpt-3.5-turbo,gpt-4"]])],{type:"text/csv"}),s=window.URL.createObjectURL(e),t=document.createElement("a");t.href=s,t.download="bulk_users_template.csv",document.body.appendChild(t),t.click(),document.body.removeChild(t),window.URL.revokeObjectURL(s)},size:"lg",className:"w-full md:w-auto",children:[(0,l.jsx)(w.Z,{className:"mr-2"})," Download CSV Template"]})]}),(0,l.jsxs)("div",{className:"flex items-center mb-4",children:[(0,l.jsx)("div",{className:"w-8 h-8 rounded-full bg-blue-500 text-white flex items-center justify-center mr-3",children:"2"}),(0,l.jsx)("h3",{className:"text-lg font-medium",children:"Upload your completed CSV"})]}),(0,l.jsxs)("div",{className:"ml-11",children:[T?(0,l.jsxs)("div",{className:"mb-4 p-4 rounded-md border ".concat(g?"bg-red-50 border-red-200":"bg-blue-50 border-blue-200"),children:[(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsxs)("div",{className:"flex items-center",children:[g?(0,l.jsx)(k.Z,{className:"text-red-500 text-xl mr-3"}):(0,l.jsx)(C.Z,{className:"text-blue-500 text-xl mr-3"}),(0,l.jsxs)("div",{children:[(0,l.jsx)(y.default.Text,{strong:!0,className:g?"text-red-800":"text-blue-800",children:T.name}),(0,l.jsxs)(y.default.Text,{className:"block text-xs ".concat(g?"text-red-600":"text-blue-600"),children:[(T.size/1024).toFixed(1)," KB • ",new Date().toLocaleDateString()]})]})]}),(0,l.jsxs)(b.z,{size:"xs",variant:"secondary",onClick:()=>{z(null),m([]),f(null),j(null),I(null)},className:"flex items-center",children:[(0,l.jsx)(S.Z,{className:"mr-1"})," Remove"]})]}),g?(0,l.jsxs)("div",{className:"mt-3 text-red-600 text-sm flex items-start",children:[(0,l.jsx)(Z.Z,{className:"mr-2 mt-0.5"}),(0,l.jsx)("span",{children:g})]}):!p&&(0,l.jsxs)("div",{className:"mt-3 flex items-center",children:[(0,l.jsx)("div",{className:"w-full bg-gray-200 rounded-full h-1.5",children:(0,l.jsx)("div",{className:"bg-blue-500 h-1.5 rounded-full w-full animate-pulse"})}),(0,l.jsx)("span",{className:"ml-2 text-xs text-blue-600",children:"Processing..."})]})]}):(0,l.jsx)(N.default,{beforeUpload:e=>((f(null),j(null),I(null),z(e),"text/csv"===e.type||e.name.endsWith(".csv"))?e.size>5242880?I("File is too large (".concat((e.size/1048576).toFixed(1)," MB). Please upload a CSV file smaller than 5MB.")):V().parse(e,{complete:e=>{if(!e.data||0===e.data.length){j("The CSV file appears to be empty. Please upload a file with data."),m([]);return}if(1===e.data.length){j("The CSV file only contains headers but no user data. Please add user data to your CSV."),m([]);return}let s=e.data[0];if(0===s.length||1===s.length&&""===s[0]){j("The CSV file doesn't contain any column headers. Please make sure your CSV has headers."),m([]);return}let l=["user_email","user_role"].filter(e=>!s.includes(e));if(l.length>0){j("Your CSV is missing these required columns: ".concat(l.join(", "),". Please add these columns to your CSV file.")),m([]);return}try{let l=e.data.slice(1).map((e,l)=>{var a,r,i,n,d,o;if(0===e.length||1===e.length&&""===e[0])return null;if(e.length=parseFloat(c.max_budget.toString())&&m.push("Max budget must be greater than 0")),c.budget_duration&&!c.budget_duration.match(/^\d+[dhmwy]$|^\d+mo$/)&&m.push('Invalid budget duration format "'.concat(c.budget_duration,'". Use format like "30d", "1mo", "2w", "6h"')),c.teams&&"string"==typeof c.teams&&t&&t.length>0){let e=t.map(e=>e.team_id),s=c.teams.split(",").map(e=>e.trim()).filter(s=>!e.includes(s));s.length>0&&m.push("Unknown team(s): ".concat(s.join(", ")))}return m.length>0&&(c.isValid=!1,c.error=m.join(", ")),c}).filter(Boolean),a=l.filter(e=>e.isValid);m(l),0===l.length?j("No valid data rows found in the CSV file. Please check your file format."):0===a.length?f("No valid users found in the CSV. Please check the errors below and fix your CSV file."):a.length{f("Failed to parse CSV file: ".concat(e.message)),m([])},header:!1}):(I("Invalid file type: ".concat(e.name,". Please upload a CSV file (.csv extension).")),E.Z.fromBackend("Invalid file type. Please upload a CSV file.")),!1),accept:".csv",maxCount:1,showUploadList:!1,children:(0,l.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,l.jsx)(U.Z,{className:"text-3xl text-gray-400 mb-2"}),(0,l.jsx)("p",{className:"mb-1",children:"Drag and drop your CSV file here"}),(0,l.jsx)("p",{className:"text-sm text-gray-500 mb-3",children:"or"}),(0,l.jsx)(b.z,{size:"sm",children:"Browse files"}),(0,l.jsx)("p",{className:"text-xs text-gray-500 mt-4",children:"Only CSV files (.csv) are supported"})]})}),p&&(0,l.jsx)("div",{className:"mb-4 p-4 bg-yellow-50 border border-yellow-200 rounded-md",children:(0,l.jsxs)("div",{className:"flex items-start",children:[(0,l.jsx)(R.Z,{className:"h-5 w-5 text-yellow-500 mr-2 mt-0.5"}),(0,l.jsxs)("div",{children:[(0,l.jsx)(y.default.Text,{strong:!0,className:"text-yellow-800",children:"CSV Structure Error"}),(0,l.jsx)(y.default.Paragraph,{className:"text-yellow-700 mt-1 mb-0",children:p}),(0,l.jsx)(y.default.Paragraph,{className:"text-yellow-700 mt-2 mb-0",children:"Please download our template and ensure your CSV follows the required format."})]})]})})]})]}):(0,l.jsxs)("div",{className:"mb-6",children:[(0,l.jsxs)("div",{className:"flex items-center mb-4",children:[(0,l.jsx)("div",{className:"w-8 h-8 rounded-full bg-blue-500 text-white flex items-center justify-center mr-3",children:"3"}),(0,l.jsx)("h3",{className:"text-lg font-medium",children:c.some(e=>"success"===e.status||"failed"===e.status)?"User Creation Results":"Review and create users"})]}),h&&(0,l.jsx)("div",{className:"ml-11 mb-4 p-4 bg-red-50 border border-red-200 rounded-md",children:(0,l.jsxs)("div",{className:"flex items-start",children:[(0,l.jsx)(Z.Z,{className:"text-red-500 mr-2 mt-1"}),(0,l.jsxs)("div",{children:[(0,l.jsx)(b.x,{className:"text-red-600 font-medium",children:h}),c.some(e=>!e.isValid)&&(0,l.jsxs)("ul",{className:"mt-2 list-disc list-inside text-red-600 text-sm",children:[(0,l.jsx)("li",{children:"Check the table below for specific errors in each row"}),(0,l.jsx)("li",{children:"Common issues include invalid email formats, missing required fields, or incorrect role values"}),(0,l.jsx)("li",{children:"Fix these issues in your CSV file and upload again"})]})]})]})}),(0,l.jsxs)("div",{className:"ml-11",children:[(0,l.jsxs)("div",{className:"flex justify-between items-center mb-3",children:[(0,l.jsx)("div",{className:"flex items-center",children:c.some(e=>"success"===e.status||"failed"===e.status)?(0,l.jsxs)("div",{className:"flex items-center",children:[(0,l.jsx)(b.x,{className:"text-lg font-medium mr-3",children:"Creation Summary"}),(0,l.jsxs)(b.x,{className:"text-sm bg-green-100 text-green-800 px-2 py-1 rounded mr-2",children:[c.filter(e=>"success"===e.status).length," Successful"]}),c.some(e=>"failed"===e.status)&&(0,l.jsxs)(b.x,{className:"text-sm bg-red-100 text-red-800 px-2 py-1 rounded",children:[c.filter(e=>"failed"===e.status).length," Failed"]})]}):(0,l.jsxs)("div",{className:"flex items-center",children:[(0,l.jsx)(b.x,{className:"text-lg font-medium mr-3",children:"User Preview"}),(0,l.jsxs)(b.x,{className:"text-sm bg-blue-100 text-blue-800 px-2 py-1 rounded",children:[c.filter(e=>e.isValid).length," of ",c.length," users valid"]})]})}),!c.some(e=>"success"===e.status||"failed"===e.status)&&(0,l.jsxs)("div",{className:"flex space-x-3",children:[(0,l.jsx)(b.z,{onClick:()=>{m([]),f(null)},variant:"secondary",children:"Back"}),(0,l.jsx)(b.z,{onClick:M,disabled:0===c.filter(e=>e.isValid).length||u,children:u?"Creating...":"Create ".concat(c.filter(e=>e.isValid).length," Users")})]})]}),c.some(e=>"success"===e.status)&&(0,l.jsx)("div",{className:"mb-4 p-4 bg-blue-50 border border-blue-200 rounded-md",children:(0,l.jsxs)("div",{className:"flex items-start",children:[(0,l.jsx)("div",{className:"mr-3 mt-1",children:(0,l.jsx)(P.Z,{className:"h-5 w-5 text-blue-500"})}),(0,l.jsxs)("div",{children:[(0,l.jsx)(b.x,{className:"font-medium text-blue-800",children:"User creation complete"}),(0,l.jsxs)(b.x,{className:"block text-sm text-blue-700 mt-1",children:[(0,l.jsx)("span",{className:"font-medium",children:"Next step:"})," Download the credentials file containing API keys and invitation links. Users will need these API keys to make LLM requests through LiteLLM."]})]})]})}),(0,l.jsx)(_.Z,{dataSource:c,columns:[{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,l.jsxs)("div",{children:[(0,l.jsxs)("div",{className:"flex items-center",children:[(0,l.jsx)(P.Z,{className:"h-5 w-5 text-green-500 mr-2"}),(0,l.jsx)("span",{className:"text-green-500",children:"Success"})]}),s.invitation_link&&(0,l.jsx)("div",{className:"mt-1",children:(0,l.jsxs)("div",{className:"flex items-center",children:[(0,l.jsx)("span",{className:"text-xs text-gray-500 truncate max-w-[150px]",children:s.invitation_link}),(0,l.jsx)(D.CopyToClipboard,{text:s.invitation_link,onCopy:()=>E.Z.success("Invitation link copied!"),children:(0,l.jsx)("button",{className:"ml-1 text-blue-500 text-xs hover:text-blue-700",children:"Copy"})})]})})]}):(0,l.jsxs)("div",{children:[(0,l.jsxs)("div",{className:"flex items-center",children:[(0,l.jsx)(L.Z,{className:"h-5 w-5 text-red-500 mr-2"}),(0,l.jsx)("span",{className:"text-red-500",children:"Failed"})]}),s.error&&(0,l.jsx)("span",{className:"text-sm text-red-500 ml-7",children:JSON.stringify(s.error)})]}):(0,l.jsx)("span",{className:"text-gray-500",children:"Pending"}):(0,l.jsxs)("div",{children:[(0,l.jsxs)("div",{className:"flex items-center",children:[(0,l.jsx)(L.Z,{className:"h-5 w-5 text-red-500 mr-2"}),(0,l.jsx)("span",{className:"text-red-500",children:"Invalid"})]}),s.error&&(0,l.jsx)("span",{className:"text-sm text-red-500 ml-7",children:s.error})]})}],size:"small",pagination:{pageSize:5},scroll:{y:300},rowClassName:e=>e.isValid?"":"bg-red-50"}),!c.some(e=>"success"===e.status||"failed"===e.status)&&(0,l.jsxs)("div",{className:"flex justify-end mt-4",children:[(0,l.jsx)(b.z,{onClick:()=>{m([]),f(null)},variant:"secondary",className:"mr-3",children:"Back"}),(0,l.jsx)(b.z,{onClick:M,disabled:0===c.filter(e=>e.isValid).length||u,children:u?"Creating...":"Create ".concat(c.filter(e=>e.isValid).length," Users")})]}),c.some(e=>"success"===e.status||"failed"===e.status)&&(0,l.jsxs)("div",{className:"flex justify-end mt-4",children:[(0,l.jsx)(b.z,{onClick:()=>{m([]),f(null)},variant:"secondary",className:"mr-3",children:"Start New Bulk Import"}),(0,l.jsxs)(b.z,{onClick:()=>{let e=c.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||""})),s=new Blob([V().unparse(e)],{type:"text/csv"}),t=window.URL.createObjectURL(s),l=document.createElement("a");l.href=t,l.download="bulk_users_results.csv",document.body.appendChild(l),l.click(),document.body.removeChild(l),window.URL.revokeObjectURL(t)},variant:"primary",className:"flex items-center",children:[(0,l.jsx)(w.Z,{className:"mr-2"})," Download User Credentials"]})]})]})]})})})]})},z=t(89970),O=t(15424),B=t(46468),F=t(29827);let{Option:A}=r.default,M=()=>"undefined"!=typeof crypto&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){let s=16*Math.random()|0;return("x"==e?s:3&s|8).toString(16)});var q=e=>{let{userID:s,accessToken:t,teams:b,possibleUIRoles:y,onUserCreated:N,isEmbedded:_=!1}=e,w=(0,F.NL)(),[k,C]=(0,a.useState)(null),[S]=i.Z.useForm(),[Z,U]=(0,a.useState)(!1),[I,V]=(0,a.useState)(!1),[L,P]=(0,a.useState)([]),[R,D]=(0,a.useState)(!1),[q,J]=(0,a.useState)(null),[K,W]=(0,a.useState)(null);(0,a.useEffect)(()=>{let e=async()=>{try{let e=await (0,v.modelAvailableCall)(t,s,"any"),l=[];for(let s=0;s{var l,a,r;try{E.Z.info("Making API Call"),_||U(!0),e.models&&0!==e.models.length||"proxy_admin"===e.user_role||(console.log("formValues.user_role",e.user_role),e.models=["no-default-models"]),console.log("formValues in create user:",e);let a=await (0,v.userCreateCall)(t,null,e);await w.invalidateQueries({queryKey:["userList"]}),console.log("user create Response:",a),V(!0);let r=(null===(l=a.data)||void 0===l?void 0:l.user_id)||a.user_id;if(N&&_){N(r),S.resetFields();return}if(null==k?void 0:k.SSO_ENABLED){let e={id:M(),user_id:r,is_accepted:!1,accepted_at:null,expires_at:new Date(Date.now()+6048e5),created_at:new Date,created_by:s,updated_at:new Date,updated_by:s,has_user_setup_sso:!0};J(e),D(!0)}else(0,v.invitationCreateCall)(t,r).then(e=>{e.has_user_setup_sso=!1,J(e),D(!0)});E.Z.success("API user Created"),S.resetFields(),localStorage.removeItem("userData"+s)}catch(s){let e=(null===(r=s.response)||void 0===r?void 0:null===(a=r.data)||void 0===a?void 0:a.detail)||(null==s?void 0:s.message)||"Error creating the user";E.Z.fromBackend(e),console.error("Error creating the user:",s)}};return _?(0,l.jsxs)(i.Z,{form:S,onFinish:$,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,l.jsx)(i.Z.Item,{label:"User Email",name:"user_email",children:(0,l.jsx)(p.Z,{placeholder:""})}),(0,l.jsx)(i.Z.Item,{label:"User Role",name:"user_role",children:(0,l.jsx)(r.default,{children:y&&Object.entries(y).map(e=>{let[s,{ui_label:t,description:a}]=e;return(0,l.jsx)(h.Z,{value:s,title:t,children:(0,l.jsxs)("div",{className:"flex",children:[t," ",(0,l.jsx)("p",{className:"ml-2",style:{color:"gray",fontSize:"12px"},children:a})]})},s)})})}),(0,l.jsx)(i.Z.Item,{label:"Team ID",name:"team_id",children:(0,l.jsx)(r.default,{placeholder:"Select Team ID",style:{width:"100%"},children:b?b.map(e=>(0,l.jsx)(A,{value:e.team_id,children:e.team_alias},e.team_id)):(0,l.jsx)(A,{value:null,children:"Default Team"},"default")})}),(0,l.jsx)(i.Z.Item,{label:"Metadata",name:"metadata",children:(0,l.jsx)(n.default.TextArea,{rows:4,placeholder:"Enter metadata as JSON"})}),(0,l.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,l.jsx)(d.ZP,{htmlType:"submit",children:"Create User"})})]}):(0,l.jsxs)("div",{className:"flex gap-2",children:[(0,l.jsx)(x.Z,{className:"mb-0",onClick:()=>U(!0),children:"+ Invite User"}),(0,l.jsx)(T,{accessToken:t,teams:b,possibleUIRoles:y}),(0,l.jsxs)(o.Z,{title:"Invite User",visible:Z,width:800,footer:null,onOk:()=>{U(!1),S.resetFields()},onCancel:()=>{U(!1),V(!1),S.resetFields()},children:[(0,l.jsx)(f.Z,{className:"mb-1",children:"Create a User who can own keys"}),(0,l.jsxs)(i.Z,{form:S,onFinish:$,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,l.jsx)(i.Z.Item,{label:"User Email",name:"user_email",children:(0,l.jsx)(p.Z,{placeholder:""})}),(0,l.jsx)(i.Z.Item,{label:(0,l.jsxs)("span",{children:["Global Proxy Role"," ",(0,l.jsx)(z.Z,{title:"This is the role that the user will globally on the proxy. This role is independent of any team/org specific roles.",children:(0,l.jsx)(O.Z,{})})]}),name:"user_role",children:(0,l.jsx)(r.default,{children:y&&Object.entries(y).map(e=>{let[s,{ui_label:t,description:a}]=e;return(0,l.jsx)(h.Z,{value:s,title:t,children:(0,l.jsxs)("div",{className:"flex",children:[t," ",(0,l.jsx)("p",{className:"ml-2",style:{color:"gray",fontSize:"12px"},children:a})]})},s)})})}),(0,l.jsx)(i.Z.Item,{label:"Team ID",className:"gap-2",name:"team_id",help:"If selected, user will be added as a 'user' role to the team.",children:(0,l.jsx)(r.default,{placeholder:"Select Team ID",style:{width:"100%"},children:b?b.map(e=>(0,l.jsx)(A,{value:e.team_id,children:e.team_alias},e.team_id)):(0,l.jsx)(A,{value:null,children:"Default Team"},"default")})}),(0,l.jsx)(i.Z.Item,{label:"Metadata",name:"metadata",children:(0,l.jsx)(n.default.TextArea,{rows:4,placeholder:"Enter metadata as JSON"})}),(0,l.jsxs)(c.Z,{children:[(0,l.jsx)(u.Z,{children:(0,l.jsx)(j.Z,{children:"Personal Key Creation"})}),(0,l.jsx)(m.Z,{children:(0,l.jsx)(i.Z.Item,{className:"gap-2",label:(0,l.jsxs)("span",{children:["Models"," ",(0,l.jsx)(z.Z,{title:"Models user has access to, outside of team scope.",children:(0,l.jsx)(O.Z,{style:{marginLeft:"4px"}})})]}),name:"models",help:"Models user has access to, outside of team scope.",children:(0,l.jsxs)(r.default,{mode:"multiple",placeholder:"Select models",style:{width:"100%"},children:[(0,l.jsx)(r.default.Option,{value:"all-proxy-models",children:"All Proxy Models"},"all-proxy-models"),L.map(e=>(0,l.jsx)(r.default.Option,{value:e,children:(0,B.W0)(e)},e))]})})})]}),(0,l.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,l.jsx)(d.ZP,{htmlType:"submit",children:"Create User"})})]})]}),I&&(0,l.jsx)(g.Z,{isInvitationLinkModalVisible:R,setIsInvitationLinkModalVisible:D,baseUrl:K||"",invitationLinkData:q})]})}},98187:function(e,s,t){t.d(s,{Z:function(){return o}});var l=t(57437);t(2265);var a=t(93192),r=t(82680),i=t(29233),n=t(19431),d=t(9114);function o(e){let{isInvitationLinkModalVisible:s,setIsInvitationLinkModalVisible:t,baseUrl:o,invitationLinkData:c,modalType:m="invitation"}=e,{Title:u,Paragraph:x}=a.default,h=()=>{if(!o)return"";let e=new URL(o).pathname,s=e&&"/"!==e?"".concat(e,"/ui"):"ui";if(null==c?void 0:c.has_user_setup_sso)return new URL(s,o).toString();let t="".concat(s,"?invitation_id=").concat(null==c?void 0:c.id);return"resetPassword"===m&&(t+="&action=reset_password"),new URL(t,o).toString()};return(0,l.jsxs)(r.Z,{title:"invitation"===m?"Invitation Link":"Reset Password Link",visible:s,width:800,footer:null,onOk:()=>{t(!1)},onCancel:()=>{t(!1)},children:[(0,l.jsx)(x,{children:"invitation"===m?"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,l.jsxs)("div",{className:"flex justify-between pt-5 pb-2",children:[(0,l.jsx)(n.x,{className:"text-base",children:"User ID"}),(0,l.jsx)(n.x,{children:null==c?void 0:c.user_id})]}),(0,l.jsxs)("div",{className:"flex justify-between pt-5 pb-2",children:[(0,l.jsx)(n.x,{children:"invitation"===m?"Invitation Link":"Reset Password Link"}),(0,l.jsx)(n.x,{children:(0,l.jsx)(n.x,{children:h()})})]}),(0,l.jsx)("div",{className:"flex justify-end mt-5",children:(0,l.jsx)(i.CopyToClipboard,{text:h(),onCopy:()=>d.Z.success("Copied!"),children:(0,l.jsx)(n.z,{variant:"primary",children:"invitation"===m?"Copy invitation link":"Copy password reset link"})})})]})}}}]);
\ No newline at end of file
+"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2202],{19431:function(e,s,t){t.d(s,{x:function(){return a.Z},z:function(){return l.Z}});var l=t(20831),a=t(84264)},65925:function(e,s,t){t.d(s,{m:function(){return i}});var l=t(57437);t(2265);var a=t(52787);let{Option:r}=a.default,i=e=>e?({"24h":"daily","7d":"weekly","30d":"monthly"})[e]||e:"Not set";s.Z=e=>{let{value:s,onChange:t,className:i="",style:n={}}=e;return(0,l.jsxs)(a.default,{style:{width:"100%",...n},value:s||void 0,onChange:t,className:i,placeholder:"n/a",children:[(0,l.jsx)(r,{value:"24h",children:"daily"}),(0,l.jsx)(r,{value:"7d",children:"weekly"}),(0,l.jsx)(r,{value:"30d",children:"monthly"})]})}},7765:function(e,s,t){t.d(s,{Z:function(){return q}});var l=t(57437),a=t(2265),r=t(52787),i=t(13634),n=t(64482),d=t(73002),o=t(82680),c=t(87452),m=t(88829),u=t(72208),x=t(20831),h=t(57365),f=t(84264),p=t(49566),j=t(96761),g=t(98187),v=t(19250),b=t(19431),y=t(93192),N=t(65319),_=t(81915),w=t(73879),k=t(34310),C=t(38434),S=t(26349),Z=t(35291),U=t(3632),I=t(15452),V=t.n(I),L=t(71157),P=t(44643),R=t(88532),D=t(29233),E=t(9114),T=e=>{let{accessToken:s,teams:t,possibleUIRoles:r,onUsersCreated:i}=e,[n,d]=(0,a.useState)(!1),[c,m]=(0,a.useState)([]),[u,x]=(0,a.useState)(!1),[h,f]=(0,a.useState)(null),[p,j]=(0,a.useState)(null),[g,I]=(0,a.useState)(null),[T,z]=(0,a.useState)(null),[O,B]=(0,a.useState)(null),[F,A]=(0,a.useState)("http://localhost:4000");(0,a.useEffect)(()=>{(async()=>{try{let e=await (0,v.getProxyUISettings)(s);B(e)}catch(e){console.error("Error fetching UI settings:",e)}})(),A(new URL("/",window.location.href).toString())},[s]);let M=async()=>{x(!0);let e=c.map(e=>({...e,status:"pending"}));m(e);let t=!1;for(let i=0;ie.trim()).filter(Boolean),0===e.teams.length&&delete e.teams),n.models&&"string"==typeof n.models&&""!==n.models.trim()&&(e.models=n.models.split(",").map(e=>e.trim()).filter(Boolean),0===e.models.length&&delete e.models),n.max_budget&&""!==n.max_budget.toString().trim()){let s=parseFloat(n.max_budget.toString());!isNaN(s)&&s>0&&(e.max_budget=s)}n.budget_duration&&""!==n.budget_duration.trim()&&(e.budget_duration=n.budget_duration.trim()),n.metadata&&"string"==typeof n.metadata&&""!==n.metadata.trim()&&(e.metadata=n.metadata.trim()),console.log("Sending user data:",e);let a=await (0,v.userCreateCall)(s,null,e);if(console.log("Full response:",a),a&&(a.key||a.user_id)){t=!0,console.log("Success case triggered");let e=(null===(l=a.data)||void 0===l?void 0:l.user_id)||a.user_id;try{if(null==O?void 0:O.SSO_ENABLED){let e=new URL("/ui",F).toString();m(s=>s.map((s,t)=>t===i?{...s,status:"success",key:a.key||a.user_id,invitation_link:e}:s))}else{let t=await (0,v.invitationCreateCall)(s,e),l=new URL("/ui?invitation_id=".concat(t.id),F).toString();m(e=>e.map((e,s)=>s===i?{...e,status:"success",key:a.key||a.user_id,invitation_link:l}:e))}}catch(e){console.error("Error creating invitation:",e),m(e=>e.map((e,s)=>s===i?{...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=(null==a?void 0:a.error)||"Failed to create user";console.log("Error message:",e),m(s=>s.map((s,t)=>t===i?{...s,status:"failed",error:e}:s))}}catch(s){console.error("Caught error:",s);let e=(null==s?void 0:null===(r=s.response)||void 0===r?void 0:null===(a=r.data)||void 0===a?void 0:a.error)||(null==s?void 0:s.message)||String(s);m(s=>s.map((s,t)=>t===i?{...s,status:"failed",error:e}:s))}}x(!1),t&&i&&i()};return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(b.z,{className:"mb-0",onClick:()=>d(!0),children:"+ Bulk Invite Users"}),(0,l.jsx)(o.Z,{title:"Bulk Invite Users",visible:n,width:800,onCancel:()=>d(!1),bodyStyle:{maxHeight:"70vh",overflow:"auto"},footer:null,children:(0,l.jsx)("div",{className:"flex flex-col",children:0===c.length?(0,l.jsxs)("div",{className:"mb-6",children:[(0,l.jsxs)("div",{className:"flex items-center mb-4",children:[(0,l.jsx)("div",{className:"w-8 h-8 rounded-full bg-blue-500 text-white flex items-center justify-center mr-3",children:"1"}),(0,l.jsx)("h3",{className:"text-lg font-medium",children:"Download and fill the template"})]}),(0,l.jsxs)("div",{className:"ml-11 mb-6",children:[(0,l.jsx)("p",{className:"mb-4",children:"Add multiple users at once by following these steps:"}),(0,l.jsxs)("ol",{className:"list-decimal list-inside space-y-2 ml-2 mb-4",children:[(0,l.jsx)("li",{children:"Download our CSV template"}),(0,l.jsx)("li",{children:"Add your users' information to the spreadsheet"}),(0,l.jsx)("li",{children:"Save the file and upload it here"}),(0,l.jsx)("li",{children:"After creation, download the results file containing the API keys for each user"})]}),(0,l.jsxs)("div",{className:"bg-gray-50 p-4 rounded-md border border-gray-200 mb-4",children:[(0,l.jsx)("h4",{className:"font-medium mb-2",children:"Template Column Names"}),(0,l.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[(0,l.jsxs)("div",{className:"flex items-start",children:[(0,l.jsx)("div",{className:"w-3 h-3 rounded-full bg-red-500 mt-1.5 mr-2 flex-shrink-0"}),(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"font-medium",children:"user_email"}),(0,l.jsx)("p",{className:"text-sm text-gray-600",children:"User's email address (required)"})]})]}),(0,l.jsxs)("div",{className:"flex items-start",children:[(0,l.jsx)("div",{className:"w-3 h-3 rounded-full bg-red-500 mt-1.5 mr-2 flex-shrink-0"}),(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"font-medium",children:"user_role"}),(0,l.jsx)("p",{className:"text-sm text-gray-600",children:'User\'s role (one of: "proxy_admin", "proxy_admin_view_only", "internal_user", "internal_user_view_only")'})]})]}),(0,l.jsxs)("div",{className:"flex items-start",children:[(0,l.jsx)("div",{className:"w-3 h-3 rounded-full bg-gray-300 mt-1.5 mr-2 flex-shrink-0"}),(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"font-medium",children:"teams"}),(0,l.jsx)("p",{className:"text-sm text-gray-600",children:'Comma-separated team IDs (e.g., "team-1,team-2")'})]})]}),(0,l.jsxs)("div",{className:"flex items-start",children:[(0,l.jsx)("div",{className:"w-3 h-3 rounded-full bg-gray-300 mt-1.5 mr-2 flex-shrink-0"}),(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"font-medium",children:"max_budget"}),(0,l.jsx)("p",{className:"text-sm text-gray-600",children:'Maximum budget as a number (e.g., "100")'})]})]}),(0,l.jsxs)("div",{className:"flex items-start",children:[(0,l.jsx)("div",{className:"w-3 h-3 rounded-full bg-gray-300 mt-1.5 mr-2 flex-shrink-0"}),(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"font-medium",children:"budget_duration"}),(0,l.jsx)("p",{className:"text-sm text-gray-600",children:'Budget reset period (e.g., "30d", "1mo")'})]})]}),(0,l.jsxs)("div",{className:"flex items-start",children:[(0,l.jsx)("div",{className:"w-3 h-3 rounded-full bg-gray-300 mt-1.5 mr-2 flex-shrink-0"}),(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"font-medium",children:"models"}),(0,l.jsx)("p",{className:"text-sm text-gray-600",children:'Comma-separated allowed models (e.g., "gpt-3.5-turbo,gpt-4")'})]})]})]})]}),(0,l.jsxs)(b.z,{onClick:()=>{let e=new Blob([V().unparse([["user_email","user_role","teams","max_budget","budget_duration","models"],["user@example.com","internal_user","team-id-1,team-id-2","100","30d","gpt-3.5-turbo,gpt-4"]])],{type:"text/csv"}),s=window.URL.createObjectURL(e),t=document.createElement("a");t.href=s,t.download="bulk_users_template.csv",document.body.appendChild(t),t.click(),document.body.removeChild(t),window.URL.revokeObjectURL(s)},size:"lg",className:"w-full md:w-auto",children:[(0,l.jsx)(w.Z,{className:"mr-2"})," Download CSV Template"]})]}),(0,l.jsxs)("div",{className:"flex items-center mb-4",children:[(0,l.jsx)("div",{className:"w-8 h-8 rounded-full bg-blue-500 text-white flex items-center justify-center mr-3",children:"2"}),(0,l.jsx)("h3",{className:"text-lg font-medium",children:"Upload your completed CSV"})]}),(0,l.jsxs)("div",{className:"ml-11",children:[T?(0,l.jsxs)("div",{className:"mb-4 p-4 rounded-md border ".concat(g?"bg-red-50 border-red-200":"bg-blue-50 border-blue-200"),children:[(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsxs)("div",{className:"flex items-center",children:[g?(0,l.jsx)(k.Z,{className:"text-red-500 text-xl mr-3"}):(0,l.jsx)(C.Z,{className:"text-blue-500 text-xl mr-3"}),(0,l.jsxs)("div",{children:[(0,l.jsx)(y.default.Text,{strong:!0,className:g?"text-red-800":"text-blue-800",children:T.name}),(0,l.jsxs)(y.default.Text,{className:"block text-xs ".concat(g?"text-red-600":"text-blue-600"),children:[(T.size/1024).toFixed(1)," KB • ",new Date().toLocaleDateString()]})]})]}),(0,l.jsxs)(b.z,{size:"xs",variant:"secondary",onClick:()=>{z(null),m([]),f(null),j(null),I(null)},className:"flex items-center",children:[(0,l.jsx)(S.Z,{className:"mr-1"})," Remove"]})]}),g?(0,l.jsxs)("div",{className:"mt-3 text-red-600 text-sm flex items-start",children:[(0,l.jsx)(Z.Z,{className:"mr-2 mt-0.5"}),(0,l.jsx)("span",{children:g})]}):!p&&(0,l.jsxs)("div",{className:"mt-3 flex items-center",children:[(0,l.jsx)("div",{className:"w-full bg-gray-200 rounded-full h-1.5",children:(0,l.jsx)("div",{className:"bg-blue-500 h-1.5 rounded-full w-full animate-pulse"})}),(0,l.jsx)("span",{className:"ml-2 text-xs text-blue-600",children:"Processing..."})]})]}):(0,l.jsx)(N.default,{beforeUpload:e=>((f(null),j(null),I(null),z(e),"text/csv"===e.type||e.name.endsWith(".csv"))?e.size>5242880?I("File is too large (".concat((e.size/1048576).toFixed(1)," MB). Please upload a CSV file smaller than 5MB.")):V().parse(e,{complete:e=>{if(!e.data||0===e.data.length){j("The CSV file appears to be empty. Please upload a file with data."),m([]);return}if(1===e.data.length){j("The CSV file only contains headers but no user data. Please add user data to your CSV."),m([]);return}let s=e.data[0];if(0===s.length||1===s.length&&""===s[0]){j("The CSV file doesn't contain any column headers. Please make sure your CSV has headers."),m([]);return}let l=["user_email","user_role"].filter(e=>!s.includes(e));if(l.length>0){j("Your CSV is missing these required columns: ".concat(l.join(", "),". Please add these columns to your CSV file.")),m([]);return}try{let l=e.data.slice(1).map((e,l)=>{var a,r,i,n,d,o;if(0===e.length||1===e.length&&""===e[0])return null;if(e.length=parseFloat(c.max_budget.toString())&&m.push("Max budget must be greater than 0")),c.budget_duration&&!c.budget_duration.match(/^\d+[dhmwy]$|^\d+mo$/)&&m.push('Invalid budget duration format "'.concat(c.budget_duration,'". Use format like "30d", "1mo", "2w", "6h"')),c.teams&&"string"==typeof c.teams&&t&&t.length>0){let e=t.map(e=>e.team_id),s=c.teams.split(",").map(e=>e.trim()).filter(s=>!e.includes(s));s.length>0&&m.push("Unknown team(s): ".concat(s.join(", ")))}return m.length>0&&(c.isValid=!1,c.error=m.join(", ")),c}).filter(Boolean),a=l.filter(e=>e.isValid);m(l),0===l.length?j("No valid data rows found in the CSV file. Please check your file format."):0===a.length?f("No valid users found in the CSV. Please check the errors below and fix your CSV file."):a.length{f("Failed to parse CSV file: ".concat(e.message)),m([])},header:!1}):(I("Invalid file type: ".concat(e.name,". Please upload a CSV file (.csv extension).")),E.Z.fromBackend("Invalid file type. Please upload a CSV file.")),!1),accept:".csv",maxCount:1,showUploadList:!1,children:(0,l.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,l.jsx)(U.Z,{className:"text-3xl text-gray-400 mb-2"}),(0,l.jsx)("p",{className:"mb-1",children:"Drag and drop your CSV file here"}),(0,l.jsx)("p",{className:"text-sm text-gray-500 mb-3",children:"or"}),(0,l.jsx)(b.z,{size:"sm",children:"Browse files"}),(0,l.jsx)("p",{className:"text-xs text-gray-500 mt-4",children:"Only CSV files (.csv) are supported"})]})}),p&&(0,l.jsx)("div",{className:"mb-4 p-4 bg-yellow-50 border border-yellow-200 rounded-md",children:(0,l.jsxs)("div",{className:"flex items-start",children:[(0,l.jsx)(R.Z,{className:"h-5 w-5 text-yellow-500 mr-2 mt-0.5"}),(0,l.jsxs)("div",{children:[(0,l.jsx)(y.default.Text,{strong:!0,className:"text-yellow-800",children:"CSV Structure Error"}),(0,l.jsx)(y.default.Paragraph,{className:"text-yellow-700 mt-1 mb-0",children:p}),(0,l.jsx)(y.default.Paragraph,{className:"text-yellow-700 mt-2 mb-0",children:"Please download our template and ensure your CSV follows the required format."})]})]})})]})]}):(0,l.jsxs)("div",{className:"mb-6",children:[(0,l.jsxs)("div",{className:"flex items-center mb-4",children:[(0,l.jsx)("div",{className:"w-8 h-8 rounded-full bg-blue-500 text-white flex items-center justify-center mr-3",children:"3"}),(0,l.jsx)("h3",{className:"text-lg font-medium",children:c.some(e=>"success"===e.status||"failed"===e.status)?"User Creation Results":"Review and create users"})]}),h&&(0,l.jsx)("div",{className:"ml-11 mb-4 p-4 bg-red-50 border border-red-200 rounded-md",children:(0,l.jsxs)("div",{className:"flex items-start",children:[(0,l.jsx)(Z.Z,{className:"text-red-500 mr-2 mt-1"}),(0,l.jsxs)("div",{children:[(0,l.jsx)(b.x,{className:"text-red-600 font-medium",children:h}),c.some(e=>!e.isValid)&&(0,l.jsxs)("ul",{className:"mt-2 list-disc list-inside text-red-600 text-sm",children:[(0,l.jsx)("li",{children:"Check the table below for specific errors in each row"}),(0,l.jsx)("li",{children:"Common issues include invalid email formats, missing required fields, or incorrect role values"}),(0,l.jsx)("li",{children:"Fix these issues in your CSV file and upload again"})]})]})]})}),(0,l.jsxs)("div",{className:"ml-11",children:[(0,l.jsxs)("div",{className:"flex justify-between items-center mb-3",children:[(0,l.jsx)("div",{className:"flex items-center",children:c.some(e=>"success"===e.status||"failed"===e.status)?(0,l.jsxs)("div",{className:"flex items-center",children:[(0,l.jsx)(b.x,{className:"text-lg font-medium mr-3",children:"Creation Summary"}),(0,l.jsxs)(b.x,{className:"text-sm bg-green-100 text-green-800 px-2 py-1 rounded mr-2",children:[c.filter(e=>"success"===e.status).length," Successful"]}),c.some(e=>"failed"===e.status)&&(0,l.jsxs)(b.x,{className:"text-sm bg-red-100 text-red-800 px-2 py-1 rounded",children:[c.filter(e=>"failed"===e.status).length," Failed"]})]}):(0,l.jsxs)("div",{className:"flex items-center",children:[(0,l.jsx)(b.x,{className:"text-lg font-medium mr-3",children:"User Preview"}),(0,l.jsxs)(b.x,{className:"text-sm bg-blue-100 text-blue-800 px-2 py-1 rounded",children:[c.filter(e=>e.isValid).length," of ",c.length," users valid"]})]})}),!c.some(e=>"success"===e.status||"failed"===e.status)&&(0,l.jsxs)("div",{className:"flex space-x-3",children:[(0,l.jsx)(b.z,{onClick:()=>{m([]),f(null)},variant:"secondary",children:"Back"}),(0,l.jsx)(b.z,{onClick:M,disabled:0===c.filter(e=>e.isValid).length||u,children:u?"Creating...":"Create ".concat(c.filter(e=>e.isValid).length," Users")})]})]}),c.some(e=>"success"===e.status)&&(0,l.jsx)("div",{className:"mb-4 p-4 bg-blue-50 border border-blue-200 rounded-md",children:(0,l.jsxs)("div",{className:"flex items-start",children:[(0,l.jsx)("div",{className:"mr-3 mt-1",children:(0,l.jsx)(P.Z,{className:"h-5 w-5 text-blue-500"})}),(0,l.jsxs)("div",{children:[(0,l.jsx)(b.x,{className:"font-medium text-blue-800",children:"User creation complete"}),(0,l.jsxs)(b.x,{className:"block text-sm text-blue-700 mt-1",children:[(0,l.jsx)("span",{className:"font-medium",children:"Next step:"})," Download the credentials file containing API keys and invitation links. Users will need these API keys to make LLM requests through LiteLLM."]})]})]})}),(0,l.jsx)(_.Z,{dataSource:c,columns:[{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,l.jsxs)("div",{children:[(0,l.jsxs)("div",{className:"flex items-center",children:[(0,l.jsx)(P.Z,{className:"h-5 w-5 text-green-500 mr-2"}),(0,l.jsx)("span",{className:"text-green-500",children:"Success"})]}),s.invitation_link&&(0,l.jsx)("div",{className:"mt-1",children:(0,l.jsxs)("div",{className:"flex items-center",children:[(0,l.jsx)("span",{className:"text-xs text-gray-500 truncate max-w-[150px]",children:s.invitation_link}),(0,l.jsx)(D.CopyToClipboard,{text:s.invitation_link,onCopy:()=>E.Z.success("Invitation link copied!"),children:(0,l.jsx)("button",{className:"ml-1 text-blue-500 text-xs hover:text-blue-700",children:"Copy"})})]})})]}):(0,l.jsxs)("div",{children:[(0,l.jsxs)("div",{className:"flex items-center",children:[(0,l.jsx)(L.Z,{className:"h-5 w-5 text-red-500 mr-2"}),(0,l.jsx)("span",{className:"text-red-500",children:"Failed"})]}),s.error&&(0,l.jsx)("span",{className:"text-sm text-red-500 ml-7",children:JSON.stringify(s.error)})]}):(0,l.jsx)("span",{className:"text-gray-500",children:"Pending"}):(0,l.jsxs)("div",{children:[(0,l.jsxs)("div",{className:"flex items-center",children:[(0,l.jsx)(L.Z,{className:"h-5 w-5 text-red-500 mr-2"}),(0,l.jsx)("span",{className:"text-red-500",children:"Invalid"})]}),s.error&&(0,l.jsx)("span",{className:"text-sm text-red-500 ml-7",children:s.error})]})}],size:"small",pagination:{pageSize:5},scroll:{y:300},rowClassName:e=>e.isValid?"":"bg-red-50"}),!c.some(e=>"success"===e.status||"failed"===e.status)&&(0,l.jsxs)("div",{className:"flex justify-end mt-4",children:[(0,l.jsx)(b.z,{onClick:()=>{m([]),f(null)},variant:"secondary",className:"mr-3",children:"Back"}),(0,l.jsx)(b.z,{onClick:M,disabled:0===c.filter(e=>e.isValid).length||u,children:u?"Creating...":"Create ".concat(c.filter(e=>e.isValid).length," Users")})]}),c.some(e=>"success"===e.status||"failed"===e.status)&&(0,l.jsxs)("div",{className:"flex justify-end mt-4",children:[(0,l.jsx)(b.z,{onClick:()=>{m([]),f(null)},variant:"secondary",className:"mr-3",children:"Start New Bulk Import"}),(0,l.jsxs)(b.z,{onClick:()=>{let e=c.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||""})),s=new Blob([V().unparse(e)],{type:"text/csv"}),t=window.URL.createObjectURL(s),l=document.createElement("a");l.href=t,l.download="bulk_users_results.csv",document.body.appendChild(l),l.click(),document.body.removeChild(l),window.URL.revokeObjectURL(t)},variant:"primary",className:"flex items-center",children:[(0,l.jsx)(w.Z,{className:"mr-2"})," Download User Credentials"]})]})]})]})})})]})},z=t(89970),O=t(15424),B=t(46468),F=t(29827);let{Option:A}=r.default,M=()=>"undefined"!=typeof crypto&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){let s=16*Math.random()|0;return("x"==e?s:3&s|8).toString(16)});var q=e=>{let{userID:s,accessToken:t,teams:b,possibleUIRoles:y,onUserCreated:N,isEmbedded:_=!1}=e,w=(0,F.NL)(),[k,C]=(0,a.useState)(null),[S]=i.Z.useForm(),[Z,U]=(0,a.useState)(!1),[I,V]=(0,a.useState)(!1),[L,P]=(0,a.useState)([]),[R,D]=(0,a.useState)(!1),[q,J]=(0,a.useState)(null),[K,W]=(0,a.useState)(null);(0,a.useEffect)(()=>{let e=async()=>{try{let e=await (0,v.modelAvailableCall)(t,s,"any"),l=[];for(let s=0;s{var l,a,r;try{E.Z.info("Making API Call"),_||U(!0),e.models&&0!==e.models.length||"proxy_admin"===e.user_role||(console.log("formValues.user_role",e.user_role),e.models=["no-default-models"]),console.log("formValues in create user:",e);let a=await (0,v.userCreateCall)(t,null,e);await w.invalidateQueries({queryKey:["userList"]}),console.log("user create Response:",a),V(!0);let r=(null===(l=a.data)||void 0===l?void 0:l.user_id)||a.user_id;if(N&&_){N(r),S.resetFields();return}if(null==k?void 0:k.SSO_ENABLED){let e={id:M(),user_id:r,is_accepted:!1,accepted_at:null,expires_at:new Date(Date.now()+6048e5),created_at:new Date,created_by:s,updated_at:new Date,updated_by:s,has_user_setup_sso:!0};J(e),D(!0)}else(0,v.invitationCreateCall)(t,r).then(e=>{e.has_user_setup_sso=!1,J(e),D(!0)});E.Z.success("API user Created"),S.resetFields(),localStorage.removeItem("userData"+s)}catch(s){let e=(null===(r=s.response)||void 0===r?void 0:null===(a=r.data)||void 0===a?void 0:a.detail)||(null==s?void 0:s.message)||"Error creating the user";E.Z.fromBackend(e),console.error("Error creating the user:",s)}};return _?(0,l.jsxs)(i.Z,{form:S,onFinish:$,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,l.jsx)(i.Z.Item,{label:"User Email",name:"user_email",children:(0,l.jsx)(p.Z,{placeholder:""})}),(0,l.jsx)(i.Z.Item,{label:"User Role",name:"user_role",children:(0,l.jsx)(r.default,{children:y&&Object.entries(y).map(e=>{let[s,{ui_label:t,description:a}]=e;return(0,l.jsx)(h.Z,{value:s,title:t,children:(0,l.jsxs)("div",{className:"flex",children:[t," ",(0,l.jsx)("p",{className:"ml-2",style:{color:"gray",fontSize:"12px"},children:a})]})},s)})})}),(0,l.jsx)(i.Z.Item,{label:"Team ID",name:"team_id",children:(0,l.jsx)(r.default,{placeholder:"Select Team ID",style:{width:"100%"},children:b?b.map(e=>(0,l.jsx)(A,{value:e.team_id,children:e.team_alias},e.team_id)):(0,l.jsx)(A,{value:null,children:"Default Team"},"default")})}),(0,l.jsx)(i.Z.Item,{label:"Metadata",name:"metadata",children:(0,l.jsx)(n.default.TextArea,{rows:4,placeholder:"Enter metadata as JSON"})}),(0,l.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,l.jsx)(d.ZP,{htmlType:"submit",children:"Create User"})})]}):(0,l.jsxs)("div",{className:"flex gap-2",children:[(0,l.jsx)(x.Z,{className:"mb-0",onClick:()=>U(!0),children:"+ Invite User"}),(0,l.jsx)(T,{accessToken:t,teams:b,possibleUIRoles:y}),(0,l.jsxs)(o.Z,{title:"Invite User",visible:Z,width:800,footer:null,onOk:()=>{U(!1),S.resetFields()},onCancel:()=>{U(!1),V(!1),S.resetFields()},children:[(0,l.jsx)(f.Z,{className:"mb-1",children:"Create a User who can own keys"}),(0,l.jsxs)(i.Z,{form:S,onFinish:$,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,l.jsx)(i.Z.Item,{label:"User Email",name:"user_email",children:(0,l.jsx)(p.Z,{placeholder:""})}),(0,l.jsx)(i.Z.Item,{label:(0,l.jsxs)("span",{children:["Global Proxy Role"," ",(0,l.jsx)(z.Z,{title:"This is the role that the user will globally on the proxy. This role is independent of any team/org specific roles.",children:(0,l.jsx)(O.Z,{})})]}),name:"user_role",children:(0,l.jsx)(r.default,{children:y&&Object.entries(y).map(e=>{let[s,{ui_label:t,description:a}]=e;return(0,l.jsx)(h.Z,{value:s,title:t,children:(0,l.jsxs)("div",{className:"flex",children:[t," ",(0,l.jsx)("p",{className:"ml-2",style:{color:"gray",fontSize:"12px"},children:a})]})},s)})})}),(0,l.jsx)(i.Z.Item,{label:"Team ID",className:"gap-2",name:"team_id",help:"If selected, user will be added as a 'user' role to the team.",children:(0,l.jsx)(r.default,{placeholder:"Select Team ID",style:{width:"100%"},children:b?b.map(e=>(0,l.jsx)(A,{value:e.team_id,children:e.team_alias},e.team_id)):(0,l.jsx)(A,{value:null,children:"Default Team"},"default")})}),(0,l.jsx)(i.Z.Item,{label:"Metadata",name:"metadata",children:(0,l.jsx)(n.default.TextArea,{rows:4,placeholder:"Enter metadata as JSON"})}),(0,l.jsxs)(c.Z,{children:[(0,l.jsx)(u.Z,{children:(0,l.jsx)(j.Z,{children:"Personal Key Creation"})}),(0,l.jsx)(m.Z,{children:(0,l.jsx)(i.Z.Item,{className:"gap-2",label:(0,l.jsxs)("span",{children:["Models"," ",(0,l.jsx)(z.Z,{title:"Models user has access to, outside of team scope.",children:(0,l.jsx)(O.Z,{style:{marginLeft:"4px"}})})]}),name:"models",help:"Models user has access to, outside of team scope.",children:(0,l.jsxs)(r.default,{mode:"multiple",placeholder:"Select models",style:{width:"100%"},children:[(0,l.jsx)(r.default.Option,{value:"all-proxy-models",children:"All Proxy Models"},"all-proxy-models"),L.map(e=>(0,l.jsx)(r.default.Option,{value:e,children:(0,B.W0)(e)},e))]})})})]}),(0,l.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,l.jsx)(d.ZP,{htmlType:"submit",children:"Create User"})})]})]}),I&&(0,l.jsx)(g.Z,{isInvitationLinkModalVisible:R,setIsInvitationLinkModalVisible:D,baseUrl:K||"",invitationLinkData:q})]})}},98187:function(e,s,t){t.d(s,{Z:function(){return o}});var l=t(57437);t(2265);var a=t(93192),r=t(82680),i=t(29233),n=t(19431),d=t(9114);function o(e){let{isInvitationLinkModalVisible:s,setIsInvitationLinkModalVisible:t,baseUrl:o,invitationLinkData:c,modalType:m="invitation"}=e,{Title:u,Paragraph:x}=a.default,h=()=>{if(!o)return"";let e=new URL(o).pathname,s=e&&"/"!==e?"".concat(e,"/ui"):"ui";if(null==c?void 0:c.has_user_setup_sso)return new URL(s,o).toString();let t="".concat(s,"?invitation_id=").concat(null==c?void 0:c.id);return"resetPassword"===m&&(t+="&action=reset_password"),new URL(t,o).toString()};return(0,l.jsxs)(r.Z,{title:"invitation"===m?"Invitation Link":"Reset Password Link",visible:s,width:800,footer:null,onOk:()=>{t(!1)},onCancel:()=>{t(!1)},children:[(0,l.jsx)(x,{children:"invitation"===m?"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,l.jsxs)("div",{className:"flex justify-between pt-5 pb-2",children:[(0,l.jsx)(n.x,{className:"text-base",children:"User ID"}),(0,l.jsx)(n.x,{children:null==c?void 0:c.user_id})]}),(0,l.jsxs)("div",{className:"flex justify-between pt-5 pb-2",children:[(0,l.jsx)(n.x,{children:"invitation"===m?"Invitation Link":"Reset Password Link"}),(0,l.jsx)(n.x,{children:(0,l.jsx)(n.x,{children:h()})})]}),(0,l.jsx)("div",{className:"flex justify-end mt-5",children:(0,l.jsx)(i.CopyToClipboard,{text:h(),onCopy:()=>d.Z.success("Copied!"),children:(0,l.jsx)(n.z,{variant:"primary",children:"invitation"===m?"Copy invitation link":"Copy password reset link"})})})]})}}}]);
\ No newline at end of file
diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/2273-28dec6d6da007fff.js b/litellm/proxy/_experimental/out/_next/static/chunks/2273-8b9ed1c724f4f8b6.js
similarity index 100%
rename from litellm/proxy/_experimental/out/_next/static/chunks/2273-28dec6d6da007fff.js
rename to litellm/proxy/_experimental/out/_next/static/chunks/2273-8b9ed1c724f4f8b6.js
diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/2306-8bb763a915ba9145.js b/litellm/proxy/_experimental/out/_next/static/chunks/2306-dfb3df53f3a9cd88.js
similarity index 100%
rename from litellm/proxy/_experimental/out/_next/static/chunks/2306-8bb763a915ba9145.js
rename to litellm/proxy/_experimental/out/_next/static/chunks/2306-dfb3df53f3a9cd88.js
diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/2945-00442a283770ee5d.js b/litellm/proxy/_experimental/out/_next/static/chunks/2945-00442a283770ee5d.js
new file mode 100644
index 00000000000..e19df366c50
--- /dev/null
+++ b/litellm/proxy/_experimental/out/_next/static/chunks/2945-00442a283770ee5d.js
@@ -0,0 +1 @@
+"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2945],{41649:function(e,t,n){n.d(t,{Z:function(){return p}});var o=n(5853),a=n(2265),i=n(1526),r=n(7084),c=n(26898),l=n(97324),s=n(1153);let d={xs:{paddingX:"px-2",paddingY:"py-0.5",fontSize:"text-xs"},sm:{paddingX:"px-2.5",paddingY:"py-0.5",fontSize:"text-sm"},md:{paddingX:"px-3",paddingY:"py-0.5",fontSize:"text-md"},lg:{paddingX:"px-3.5",paddingY:"py-0.5",fontSize:"text-lg"},xl:{paddingX:"px-4",paddingY:"py-1",fontSize:"text-xl"}},m={xs:{height:"h-4",width:"w-4"},sm:{height:"h-4",width:"w-4"},md:{height:"h-4",width:"w-4"},lg:{height:"h-5",width:"w-5"},xl:{height:"h-6",width:"w-6"}},u=(0,s.fn)("Badge"),p=a.forwardRef((e,t)=>{let{color:n,icon:p,size:g=r.u8.SM,tooltip:b,className:h,children:f}=e,v=(0,o._T)(e,["color","icon","size","tooltip","className","children"]),x=p||null,{tooltipProps:k,getReferenceProps:S}=(0,i.l)();return a.createElement("span",Object.assign({ref:(0,s.lq)([t,k.refs.setReference]),className:(0,l.q)(u("root"),"w-max flex-shrink-0 inline-flex justify-center items-center cursor-default rounded-tremor-full",n?(0,l.q)((0,s.bM)(n,c.K.background).bgColor,(0,s.bM)(n,c.K.text).textColor,"bg-opacity-20 dark:bg-opacity-25"):(0,l.q)("bg-tremor-brand-muted text-tremor-brand-emphasis","dark:bg-dark-tremor-brand-muted dark:text-dark-tremor-brand-emphasis"),d[g].paddingX,d[g].paddingY,d[g].fontSize,h)},S,v),a.createElement(i.Z,Object.assign({text:b},k)),x?a.createElement(x,{className:(0,l.q)(u("icon"),"shrink-0 -ml-1 mr-1.5",m[g].height,m[g].width)}):null,a.createElement("p",{className:(0,l.q)(u("text"),"text-sm whitespace-nowrap")},f))});p.displayName="Badge"},30150:function(e,t,n){n.d(t,{Z:function(){return u}});var o=n(5853),a=n(2265);let i=e=>{var t=(0,o._T)(e,[]);return a.createElement("svg",Object.assign({},t,{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2.5"}),a.createElement("path",{d:"M12 4v16m8-8H4"}))},r=e=>{var t=(0,o._T)(e,[]);return a.createElement("svg",Object.assign({},t,{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2.5"}),a.createElement("path",{d:"M20 12H4"}))};var c=n(97324),l=n(1153),s=n(69262);let d="flex mx-auto text-tremor-content-subtle dark:text-dark-tremor-content-subtle",m="cursor-pointer hover:text-tremor-content dark:hover:text-dark-tremor-content",u=a.forwardRef((e,t)=>{let{onSubmit:n,enableStepper:u=!0,disabled:p,onValueChange:g,onChange:b}=e,h=(0,o._T)(e,["onSubmit","enableStepper","disabled","onValueChange","onChange"]),f=(0,a.useRef)(null),[v,x]=a.useState(!1),k=a.useCallback(()=>{x(!0)},[]),S=a.useCallback(()=>{x(!1)},[]),[y,C]=a.useState(!1),w=a.useCallback(()=>{C(!0)},[]),E=a.useCallback(()=>{C(!1)},[]);return a.createElement(s.Z,Object.assign({type:"number",ref:(0,l.lq)([f,t]),disabled:p,makeInputClassName:(0,l.fn)("NumberInput"),onKeyDown:e=>{var t;if("Enter"===e.key&&!e.ctrlKey&&!e.altKey&&!e.shiftKey){let e=null===(t=f.current)||void 0===t?void 0:t.value;null==n||n(parseFloat(null!=e?e:""))}"ArrowDown"===e.key&&k(),"ArrowUp"===e.key&&w()},onKeyUp:e=>{"ArrowDown"===e.key&&S(),"ArrowUp"===e.key&&E()},onChange:e=>{p||(null==g||g(parseFloat(e.target.value)),null==b||b(e))},stepper:u?a.createElement("div",{className:(0,c.q)("flex justify-center align-middle")},a.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=f.current)||void 0===e||e.stepDown(),null===(t=f.current)||void 0===t||t.dispatchEvent(new Event("input",{bubbles:!0})))},className:(0,c.q)(!p&&m,d,"group py-[10px] px-2.5 border-l border-tremor-border dark:border-dark-tremor-border")},a.createElement(r,{"data-testid":"step-down",className:(v?"scale-95":"")+" h-4 w-4 duration-75 transition group-active:scale-95"})),a.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=f.current)||void 0===e||e.stepUp(),null===(t=f.current)||void 0===t||t.dispatchEvent(new Event("input",{bubbles:!0})))},className:(0,c.q)(!p&&m,d,"group py-[10px] px-2.5 border-l border-tremor-border dark:border-dark-tremor-border")},a.createElement(i,{"data-testid":"step-up",className:(y?"scale-95":"")+" h-4 w-4 duration-75 transition group-active:scale-95"}))):null},h))});u.displayName="NumberInput"},53253:function(e,t){t.Z=function(){let e=Object.assign({},arguments.length<=0?void 0:arguments[0]);for(let t=1;t{let o=n[t];void 0!==o&&(e[t]=o)})}return e}},23496:function(e,t,n){n.d(t,{Z:function(){return g}});var o=n(2265),a=n(36760),i=n.n(a),r=n(71744),c=n(352),l=n(12918),s=n(80669),d=n(3104);let m=e=>{let{componentCls:t,sizePaddingEdgeHorizontal:n,colorSplit:o,lineWidth:a,textPaddingInline:i,orientationMargin:r,verticalMarginInline:s}=e;return{[t]:Object.assign(Object.assign({},(0,l.Wf)(e)),{borderBlockStart:"".concat((0,c.bf)(a)," solid ").concat(o),"&-vertical":{position:"relative",top:"-0.06em",display:"inline-block",height:"0.9em",marginInline:s,marginBlock:0,verticalAlign:"middle",borderTop:0,borderInlineStart:"".concat((0,c.bf)(a)," solid ").concat(o)},"&-horizontal":{display:"flex",clear:"both",width:"100%",minWidth:"100%",margin:"".concat((0,c.bf)(e.dividerHorizontalGutterMargin)," 0")},["&-horizontal".concat(t,"-with-text")]:{display:"flex",alignItems:"center",margin:"".concat((0,c.bf)(e.dividerHorizontalWithTextGutterMargin)," 0"),color:e.colorTextHeading,fontWeight:500,fontSize:e.fontSizeLG,whiteSpace:"nowrap",textAlign:"center",borderBlockStart:"0 ".concat(o),"&::before, &::after":{position:"relative",width:"50%",borderBlockStart:"".concat((0,c.bf)(a)," solid transparent"),borderBlockStartColor:"inherit",borderBlockEnd:0,transform:"translateY(50%)",content:"''"}},["&-horizontal".concat(t,"-with-text-left")]:{"&::before":{width:"calc(".concat(r," * 100%)")},"&::after":{width:"calc(100% - ".concat(r," * 100%)")}},["&-horizontal".concat(t,"-with-text-right")]:{"&::before":{width:"calc(100% - ".concat(r," * 100%)")},"&::after":{width:"calc(".concat(r," * 100%)")}},["".concat(t,"-inner-text")]:{display:"inline-block",paddingBlock:0,paddingInline:i},"&-dashed":{background:"none",borderColor:o,borderStyle:"dashed",borderWidth:"".concat((0,c.bf)(a)," 0 0")},["&-horizontal".concat(t,"-with-text").concat(t,"-dashed")]:{"&::before, &::after":{borderStyle:"dashed none none"}},["&-vertical".concat(t,"-dashed")]:{borderInlineStartWidth:a,borderInlineEnd:0,borderBlockStart:0,borderBlockEnd:0},["&-plain".concat(t,"-with-text")]:{color:e.colorText,fontWeight:"normal",fontSize:e.fontSize},["&-horizontal".concat(t,"-with-text-left").concat(t,"-no-default-orientation-margin-left")]:{"&::before":{width:0},"&::after":{width:"100%"},["".concat(t,"-inner-text")]:{paddingInlineStart:n}},["&-horizontal".concat(t,"-with-text-right").concat(t,"-no-default-orientation-margin-right")]:{"&::before":{width:"100%"},"&::after":{width:0},["".concat(t,"-inner-text")]:{paddingInlineEnd:n}}})}};var u=(0,s.I$)("Divider",e=>[m((0,d.TS)(e,{dividerHorizontalWithTextGutterMargin:e.margin,dividerHorizontalGutterMargin:e.marginLG,sizePaddingEdgeHorizontal:0}))],e=>({textPaddingInline:"1em",orientationMargin:.05,verticalMarginInline:e.marginXS}),{unitless:{orientationMargin:!0}}),p=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>t.indexOf(o)&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,o=Object.getOwnPropertySymbols(e);at.indexOf(o[a])&&Object.prototype.propertyIsEnumerable.call(e,o[a])&&(n[o[a]]=e[o[a]]);return n},g=e=>{let{getPrefixCls:t,direction:n,divider:a}=o.useContext(r.E_),{prefixCls:c,type:l="horizontal",orientation:s="center",orientationMargin:d,className:m,rootClassName:g,children:b,dashed:h,plain:f,style:v}=e,x=p(e,["prefixCls","type","orientation","orientationMargin","className","rootClassName","children","dashed","plain","style"]),k=t("divider",c),[S,y,C]=u(k),w=s.length>0?"-".concat(s):s,E=!!b,N="left"===s&&null!=d,z="right"===s&&null!=d,j=i()(k,null==a?void 0:a.className,y,C,"".concat(k,"-").concat(l),{["".concat(k,"-with-text")]:E,["".concat(k,"-with-text").concat(w)]:E,["".concat(k,"-dashed")]:!!h,["".concat(k,"-plain")]:!!f,["".concat(k,"-rtl")]:"rtl"===n,["".concat(k,"-no-default-orientation-margin-left")]:N,["".concat(k,"-no-default-orientation-margin-right")]:z},m,g),O=o.useMemo(()=>"number"==typeof d?d:/^\d+$/.test(d)?Number(d):d,[d]),M=Object.assign(Object.assign({},N&&{marginLeft:O}),z&&{marginRight:O});return S(o.createElement("div",Object.assign({className:j,style:Object.assign(Object.assign({},null==a?void 0:a.style),v)},x,{role:"separator"}),b&&"vertical"!==l&&o.createElement("span",{className:"".concat(k,"-inner-text"),style:M},b)))}},28617:function(e,t,n){var o=n(2265),a=n(27380),i=n(51646),r=n(6543);t.Z=function(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0],t=(0,o.useRef)({}),n=(0,i.Z)(),c=(0,r.ZP)();return(0,a.Z)(()=>{let o=c.subscribe(o=>{t.current=o,e&&n()});return()=>c.unsubscribe(o)},[]),t.current}},19097:function(e,t,n){n.d(t,{Z:function(){return ea}});var o=n(1119),a=n(2265),i={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M272.9 512l265.4-339.1c4.1-5.2.4-12.9-6.3-12.9h-77.3c-4.9 0-9.6 2.3-12.6 6.1L186.8 492.3a31.99 31.99 0 000 39.5l255.3 326.1c3 3.9 7.7 6.1 12.6 6.1H532c6.7 0 10.4-7.7 6.3-12.9L272.9 512zm304 0l265.4-339.1c4.1-5.2.4-12.9-6.3-12.9h-77.3c-4.9 0-9.6 2.3-12.6 6.1L490.8 492.3a31.99 31.99 0 000 39.5l255.3 326.1c3 3.9 7.7 6.1 12.6 6.1H836c6.7 0 10.4-7.7 6.3-12.9L576.9 512z"}}]},name:"double-left",theme:"outlined"},r=n(55015),c=a.forwardRef(function(e,t){return a.createElement(r.Z,(0,o.Z)({},e,{ref:t,icon:i}))}),l={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M533.2 492.3L277.9 166.1c-3-3.9-7.7-6.1-12.6-6.1H188c-6.7 0-10.4 7.7-6.3 12.9L447.1 512 181.7 851.1A7.98 7.98 0 00188 864h77.3c4.9 0 9.6-2.3 12.6-6.1l255.3-326.1c9.1-11.7 9.1-27.9 0-39.5zm304 0L581.9 166.1c-3-3.9-7.7-6.1-12.6-6.1H492c-6.7 0-10.4 7.7-6.3 12.9L751.1 512 485.7 851.1A7.98 7.98 0 00492 864h77.3c4.9 0 9.6-2.3 12.6-6.1l255.3-326.1c9.1-11.7 9.1-27.9 0-39.5z"}}]},name:"double-right",theme:"outlined"},s=a.forwardRef(function(e,t){return a.createElement(r.Z,(0,o.Z)({},e,{ref:t,icon:l}))}),d=n(15327),m=n(77565),u=n(36760),p=n.n(u),g=n(11993),b=n(31686),h=n(26365),f=n(50506),v=n(95814),x=n(18242);n(32559);var k={items_per_page:"条/页",jump_to:"跳至",jump_to_confirm:"确定",page:"页",prev_page:"上一页",next_page:"下一页",prev_5:"向前 5 页",next_5:"向后 5 页",prev_3:"向前 3 页",next_3:"向后 3 页",page_size:"页码"},S=["10","20","50","100"],y=function(e){var t=e.pageSizeOptions,n=void 0===t?S:t,o=e.locale,i=e.changeSize,r=e.pageSize,c=e.goButton,l=e.quickGo,s=e.rootPrefixCls,d=e.selectComponentClass,m=e.selectPrefixCls,u=e.disabled,p=e.buildOptionText,g=a.useState(""),b=(0,h.Z)(g,2),f=b[0],x=b[1],k=function(){return!f||Number.isNaN(f)?void 0:Number(f)},y="function"==typeof p?p:function(e){return"".concat(e," ").concat(o.items_per_page)},C=function(e){""!==f&&(e.keyCode===v.Z.ENTER||"click"===e.type)&&(x(""),null==l||l(k()))},w="".concat(s,"-options");if(!i&&!l)return null;var E=null,N=null,z=null;if(i&&d){var j=(n.some(function(e){return e.toString()===r.toString()})?n:n.concat([r.toString()]).sort(function(e,t){return(Number.isNaN(Number(e))?0:Number(e))-(Number.isNaN(Number(t))?0:Number(t))})).map(function(e,t){return a.createElement(d.Option,{key:t,value:e.toString()},y(e))});E=a.createElement(d,{disabled:u,prefixCls:m,showSearch:!1,className:"".concat(w,"-size-changer"),optionLabelProp:"children",popupMatchSelectWidth:!1,value:(r||n[0]).toString(),onChange:function(e){null==i||i(Number(e))},getPopupContainer:function(e){return e.parentNode},"aria-label":o.page_size,defaultOpen:!1},j)}return l&&(c&&(z="boolean"==typeof c?a.createElement("button",{type:"button",onClick:C,onKeyUp:C,disabled:u,className:"".concat(w,"-quick-jumper-button")},o.jump_to_confirm):a.createElement("span",{onClick:C,onKeyUp:C},c)),N=a.createElement("div",{className:"".concat(w,"-quick-jumper")},o.jump_to,a.createElement("input",{disabled:u,type:"text",value:f,onChange:function(e){x(e.target.value)},onKeyUp:C,onBlur:function(e){!c&&""!==f&&(x(""),e.relatedTarget&&(e.relatedTarget.className.indexOf("".concat(s,"-item-link"))>=0||e.relatedTarget.className.indexOf("".concat(s,"-item"))>=0)||null==l||l(k()))},"aria-label":o.page}),o.page,z)),a.createElement("li",{className:w},E,N)},C=function(e){var t,n=e.rootPrefixCls,o=e.page,i=e.active,r=e.className,c=e.showTitle,l=e.onClick,s=e.onKeyPress,d=e.itemRender,m="".concat(n,"-item"),u=p()(m,"".concat(m,"-").concat(o),(t={},(0,g.Z)(t,"".concat(m,"-active"),i),(0,g.Z)(t,"".concat(m,"-disabled"),!o),t),r),b=d(o,"page",a.createElement("a",{rel:"nofollow"},o));return b?a.createElement("li",{title:c?String(o):null,className:u,onClick:function(){l(o)},onKeyDown:function(e){s(e,l,o)},tabIndex:0},b):null},w=function(e,t,n){return n};function E(){}function N(e){var t=Number(e);return"number"==typeof t&&!Number.isNaN(t)&&isFinite(t)&&Math.floor(t)===t}function z(e,t,n){return Math.floor((n-1)/(void 0===e?t:e))+1}var j=function(e){var t,n,i,r,c,l=e.prefixCls,s=void 0===l?"rc-pagination":l,d=e.selectPrefixCls,m=e.className,u=e.selectComponentClass,S=e.current,j=e.defaultCurrent,O=e.total,M=void 0===O?0:O,B=e.pageSize,I=e.defaultPageSize,Z=e.onChange,T=void 0===Z?E:Z,P=e.hideOnSinglePage,D=e.showPrevNextJumpers,H=e.showQuickJumper,_=e.showLessItems,A=e.showTitle,W=void 0===A||A,R=e.onShowSizeChange,q=void 0===R?E:R,X=e.locale,L=void 0===X?k:X,K=e.style,U=e.totalBoundaryShowSizeChanger,G=e.disabled,F=e.simple,V=e.showTotal,Y=e.showSizeChanger,J=e.pageSizeOptions,Q=e.itemRender,$=void 0===Q?w:Q,ee=e.jumpPrevIcon,et=e.jumpNextIcon,en=e.prevIcon,eo=e.nextIcon,ea=a.useRef(null),ei=(0,f.Z)(10,{value:B,defaultValue:void 0===I?10:I}),er=(0,h.Z)(ei,2),ec=er[0],el=er[1],es=(0,f.Z)(1,{value:S,defaultValue:void 0===j?1:j,postState:function(e){return Math.max(1,Math.min(e,z(void 0,ec,M)))}}),ed=(0,h.Z)(es,2),em=ed[0],eu=ed[1],ep=a.useState(em),eg=(0,h.Z)(ep,2),eb=eg[0],eh=eg[1];(0,a.useEffect)(function(){eh(em)},[em]);var ef=Math.max(1,em-(_?3:5)),ev=Math.min(z(void 0,ec,M),em+(_?3:5));function ex(t,n){var o=t||a.createElement("button",{type:"button","aria-label":n,className:"".concat(s,"-item-link")});return"function"==typeof t&&(o=a.createElement(t,(0,b.Z)({},e))),o}function ek(e){var t=e.target.value,n=z(void 0,ec,M);return""===t?t:Number.isNaN(Number(t))?eb:t>=n?n:Number(t)}var eS=M>ec&&H;function ey(e){var t=ek(e);switch(t!==eb&&eh(t),e.keyCode){case v.Z.ENTER:eC(t);break;case v.Z.UP:eC(t-1);break;case v.Z.DOWN:eC(t+1)}}function eC(e){if(N(e)&&e!==em&&N(M)&&M>0&&!G){var t=z(void 0,ec,M),n=e;return e>t?n=t:e<1&&(n=1),n!==eb&&eh(n),eu(n),null==T||T(n,ec),n}return em}var ew=em>1,eE=em(void 0===U?50:U);function ez(){ew&&eC(em-1)}function ej(){eE&&eC(em+1)}function eO(){eC(ef)}function eM(){eC(ev)}function eB(e,t){if("Enter"===e.key||e.charCode===v.Z.ENTER||e.keyCode===v.Z.ENTER){for(var n=arguments.length,o=Array(n>2?n-2:0),a=2;aM?M:em*ec])),eD=null,eH=z(void 0,ec,M);if(P&&M<=ec)return null;var e_=[],eA={rootPrefixCls:s,onClick:eC,onKeyPress:eB,showTitle:W,itemRender:$,page:-1},eW=em-1>0?em-1:0,eR=em+1=2*eK&&3!==em&&(e_[0]=a.cloneElement(e_[0],{className:p()("".concat(s,"-item-after-jump-prev"),e_[0].props.className)}),e_.unshift(eZ)),eH-em>=2*eK&&em!==eH-2){var e0=e_[e_.length-1];e_[e_.length-1]=a.cloneElement(e0,{className:p()("".concat(s,"-item-before-jump-next"),e0.props.className)}),e_.push(eD)}1!==eJ&&e_.unshift(a.createElement(C,(0,o.Z)({},eA,{key:1,page:1}))),eQ!==eH&&e_.push(a.createElement(C,(0,o.Z)({},eA,{key:eH,page:eH})))}var e1=(t=$(eW,"prev",ex(en,"prev page")),a.isValidElement(t)?a.cloneElement(t,{disabled:!ew}):t);if(e1){var e2=!ew||!eH;e1=a.createElement("li",{title:W?L.prev_page:null,onClick:ez,tabIndex:e2?null:0,onKeyDown:function(e){eB(e,ez)},className:p()("".concat(s,"-prev"),(0,g.Z)({},"".concat(s,"-disabled"),e2)),"aria-disabled":e2},e1)}var e5=(n=$(eR,"next",ex(eo,"next page")),a.isValidElement(n)?a.cloneElement(n,{disabled:!eE}):n);e5&&(F?(r=!eE,c=ew?0:null):c=(r=!eE||!eH)?null:0,e5=a.createElement("li",{title:W?L.next_page:null,onClick:ej,tabIndex:c,onKeyDown:function(e){eB(e,ej)},className:p()("".concat(s,"-next"),(0,g.Z)({},"".concat(s,"-disabled"),r)),"aria-disabled":r},e5));var e6=p()(s,m,(i={},(0,g.Z)(i,"".concat(s,"-simple"),F),(0,g.Z)(i,"".concat(s,"-disabled"),G),i));return a.createElement("ul",(0,o.Z)({className:e6,style:K,ref:ea},eT),eP,e1,F?eL:e_,e5,a.createElement(y,{locale:L,rootPrefixCls:s,disabled:G,selectComponentClass:u,selectPrefixCls:void 0===d?"rc-select":d,changeSize:eN?function(e){var t=z(e,ec,M),n=em>t&&0!==t?t:em;el(e),eh(n),null==q||q(em,e),eu(n),null==T||T(n,e)}:null,pageSize:ec,pageSizeOptions:J,quickGo:eS?eC:null,goButton:eX}))},O=n(96257),M=n(71744),B=n(33759),I=n(28617),Z=n(55274),T=n(52787);let P=e=>a.createElement(T.default,Object.assign({},e,{showSearch:!0,size:"small"})),D=e=>a.createElement(T.default,Object.assign({},e,{showSearch:!0,size:"middle"}));P.Option=T.default.Option,D.Option=T.default.Option;var H=n(352),_=n(31282),A=n(37433),W=n(12918),R=n(3104),q=n(80669),X=n(65265);let L=e=>{let{componentCls:t}=e;return{["".concat(t,"-disabled")]:{"&, &:hover":{cursor:"not-allowed",["".concat(t,"-item-link")]:{color:e.colorTextDisabled,cursor:"not-allowed"}},"&:focus-visible":{cursor:"not-allowed",["".concat(t,"-item-link")]:{color:e.colorTextDisabled,cursor:"not-allowed"}}},["&".concat(t,"-disabled")]:{cursor:"not-allowed",["".concat(t,"-item")]:{cursor:"not-allowed","&:hover, &:active":{backgroundColor:"transparent"},a:{color:e.colorTextDisabled,backgroundColor:"transparent",border:"none",cursor:"not-allowed"},"&-active":{borderColor:e.colorBorder,backgroundColor:e.itemActiveBgDisabled,"&:hover, &:active":{backgroundColor:e.itemActiveBgDisabled},a:{color:e.itemActiveColorDisabled}}},["".concat(t,"-item-link")]:{color:e.colorTextDisabled,cursor:"not-allowed","&:hover, &:active":{backgroundColor:"transparent"},["".concat(t,"-simple&")]:{backgroundColor:"transparent","&:hover, &:active":{backgroundColor:"transparent"}}},["".concat(t,"-simple-pager")]:{color:e.colorTextDisabled},["".concat(t,"-jump-prev, ").concat(t,"-jump-next")]:{["".concat(t,"-item-link-icon")]:{opacity:0},["".concat(t,"-item-ellipsis")]:{opacity:1}}},["&".concat(t,"-simple")]:{["".concat(t,"-prev, ").concat(t,"-next")]:{["&".concat(t,"-disabled ").concat(t,"-item-link")]:{"&:hover, &:active":{backgroundColor:"transparent"}}}}}},K=e=>{let{componentCls:t}=e;return{["&".concat(t,"-mini ").concat(t,"-total-text, &").concat(t,"-mini ").concat(t,"-simple-pager")]:{height:e.itemSizeSM,lineHeight:(0,H.bf)(e.itemSizeSM)},["&".concat(t,"-mini ").concat(t,"-item")]:{minWidth:e.itemSizeSM,height:e.itemSizeSM,margin:0,lineHeight:(0,H.bf)(e.calc(e.itemSizeSM).sub(2).equal())},["&".concat(t,"-mini:not(").concat(t,"-disabled) ").concat(t,"-item:not(").concat(t,"-item-active)")]:{backgroundColor:"transparent",borderColor:"transparent","&:hover":{backgroundColor:e.colorBgTextHover},"&:active":{backgroundColor:e.colorBgTextActive}},["&".concat(t,"-mini ").concat(t,"-prev, &").concat(t,"-mini ").concat(t,"-next")]:{minWidth:e.itemSizeSM,height:e.itemSizeSM,margin:0,lineHeight:(0,H.bf)(e.itemSizeSM)},["&".concat(t,"-mini:not(").concat(t,"-disabled)")]:{["".concat(t,"-prev, ").concat(t,"-next")]:{["&:hover ".concat(t,"-item-link")]:{backgroundColor:e.colorBgTextHover},["&:active ".concat(t,"-item-link")]:{backgroundColor:e.colorBgTextActive},["&".concat(t,"-disabled:hover ").concat(t,"-item-link")]:{backgroundColor:"transparent"}}},["\n &".concat(t,"-mini ").concat(t,"-prev ").concat(t,"-item-link,\n &").concat(t,"-mini ").concat(t,"-next ").concat(t,"-item-link\n ")]:{backgroundColor:"transparent",borderColor:"transparent","&::after":{height:e.itemSizeSM,lineHeight:(0,H.bf)(e.itemSizeSM)}},["&".concat(t,"-mini ").concat(t,"-jump-prev, &").concat(t,"-mini ").concat(t,"-jump-next")]:{height:e.itemSizeSM,marginInlineEnd:0,lineHeight:(0,H.bf)(e.itemSizeSM)},["&".concat(t,"-mini ").concat(t,"-options")]:{marginInlineStart:e.paginationMiniOptionsMarginInlineStart,"&-size-changer":{top:e.miniOptionsSizeChangerTop},"&-quick-jumper":{height:e.itemSizeSM,lineHeight:(0,H.bf)(e.itemSizeSM),input:Object.assign(Object.assign({},(0,_.x0)(e)),{width:e.paginationMiniQuickJumperInputWidth,height:e.controlHeightSM})}}}},U=e=>{let{componentCls:t}=e;return{["\n &".concat(t,"-simple ").concat(t,"-prev,\n &").concat(t,"-simple ").concat(t,"-next\n ")]:{height:e.itemSizeSM,lineHeight:(0,H.bf)(e.itemSizeSM),verticalAlign:"top",["".concat(t,"-item-link")]:{height:e.itemSizeSM,backgroundColor:"transparent",border:0,"&:hover":{backgroundColor:e.colorBgTextHover},"&:active":{backgroundColor:e.colorBgTextActive},"&::after":{height:e.itemSizeSM,lineHeight:(0,H.bf)(e.itemSizeSM)}}},["&".concat(t,"-simple ").concat(t,"-simple-pager")]:{display:"inline-block",height:e.itemSizeSM,marginInlineEnd:e.marginXS,input:{boxSizing:"border-box",height:"100%",marginInlineEnd:e.marginXS,padding:"0 ".concat((0,H.bf)(e.paginationItemPaddingInline)),textAlign:"center",backgroundColor:e.itemInputBg,border:"".concat((0,H.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorBorder),borderRadius:e.borderRadius,outline:"none",transition:"border-color ".concat(e.motionDurationMid),color:"inherit","&:hover":{borderColor:e.colorPrimary},"&:focus":{borderColor:e.colorPrimaryHover,boxShadow:"".concat((0,H.bf)(e.inputOutlineOffset)," 0 ").concat((0,H.bf)(e.controlOutlineWidth)," ").concat(e.controlOutline)},"&[disabled]":{color:e.colorTextDisabled,backgroundColor:e.colorBgContainerDisabled,borderColor:e.colorBorder,cursor:"not-allowed"}}}}},G=e=>{let{componentCls:t}=e;return{["".concat(t,"-jump-prev, ").concat(t,"-jump-next")]:{outline:0,["".concat(t,"-item-container")]:{position:"relative",["".concat(t,"-item-link-icon")]:{color:e.colorPrimary,fontSize:e.fontSizeSM,opacity:0,transition:"all ".concat(e.motionDurationMid),"&-svg":{top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,margin:"auto"}},["".concat(t,"-item-ellipsis")]:{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,display:"block",margin:"auto",color:e.colorTextDisabled,fontFamily:"Arial, Helvetica, sans-serif",letterSpacing:e.paginationEllipsisLetterSpacing,textAlign:"center",textIndent:e.paginationEllipsisTextIndent,opacity:1,transition:"all ".concat(e.motionDurationMid)}},"&:hover":{["".concat(t,"-item-link-icon")]:{opacity:1},["".concat(t,"-item-ellipsis")]:{opacity:0}}},["\n ".concat(t,"-prev,\n ").concat(t,"-jump-prev,\n ").concat(t,"-jump-next\n ")]:{marginInlineEnd:e.marginXS},["\n ".concat(t,"-prev,\n ").concat(t,"-next,\n ").concat(t,"-jump-prev,\n ").concat(t,"-jump-next\n ")]:{display:"inline-block",minWidth:e.itemSize,height:e.itemSize,color:e.colorText,fontFamily:e.fontFamily,lineHeight:"".concat((0,H.bf)(e.itemSize)),textAlign:"center",verticalAlign:"middle",listStyle:"none",borderRadius:e.borderRadius,cursor:"pointer",transition:"all ".concat(e.motionDurationMid)},["".concat(t,"-prev, ").concat(t,"-next")]:{fontFamily:"Arial, Helvetica, sans-serif",outline:0,button:{color:e.colorText,cursor:"pointer",userSelect:"none"},["".concat(t,"-item-link")]:{display:"block",width:"100%",height:"100%",padding:0,fontSize:e.fontSizeSM,textAlign:"center",backgroundColor:"transparent",border:"".concat((0,H.bf)(e.lineWidth)," ").concat(e.lineType," transparent"),borderRadius:e.borderRadius,outline:"none",transition:"all ".concat(e.motionDurationMid)},["&:hover ".concat(t,"-item-link")]:{backgroundColor:e.colorBgTextHover},["&:active ".concat(t,"-item-link")]:{backgroundColor:e.colorBgTextActive},["&".concat(t,"-disabled:hover")]:{["".concat(t,"-item-link")]:{backgroundColor:"transparent"}}},["".concat(t,"-slash")]:{marginInlineEnd:e.paginationSlashMarginInlineEnd,marginInlineStart:e.paginationSlashMarginInlineStart},["".concat(t,"-options")]:{display:"inline-block",marginInlineStart:e.margin,verticalAlign:"middle","&-size-changer.-select":{display:"inline-block",width:"auto"},"&-quick-jumper":{display:"inline-block",height:e.controlHeight,marginInlineStart:e.marginXS,lineHeight:(0,H.bf)(e.controlHeight),verticalAlign:"top",input:Object.assign(Object.assign(Object.assign({},(0,_.ik)(e)),(0,X.$U)(e,{borderColor:e.colorBorder,hoverBorderColor:e.colorPrimaryHover,activeBorderColor:e.colorPrimary,activeShadow:e.activeShadow})),{"&[disabled]":Object.assign({},(0,X.Xy)(e)),width:e.calc(e.controlHeightLG).mul(1.25).equal(),height:e.controlHeight,boxSizing:"border-box",margin:0,marginInlineStart:e.marginXS,marginInlineEnd:e.marginXS})}}}},F=e=>{let{componentCls:t}=e;return{["".concat(t,"-item")]:{display:"inline-block",minWidth:e.itemSize,height:e.itemSize,marginInlineEnd:e.marginXS,fontFamily:e.fontFamily,lineHeight:(0,H.bf)(e.calc(e.itemSize).sub(2).equal()),textAlign:"center",verticalAlign:"middle",listStyle:"none",backgroundColor:"transparent",border:"".concat((0,H.bf)(e.lineWidth)," ").concat(e.lineType," transparent"),borderRadius:e.borderRadius,outline:0,cursor:"pointer",userSelect:"none",a:{display:"block",padding:"0 ".concat((0,H.bf)(e.paginationItemPaddingInline)),color:e.colorText,"&:hover":{textDecoration:"none"}},["&:not(".concat(t,"-item-active)")]:{"&:hover":{transition:"all ".concat(e.motionDurationMid),backgroundColor:e.colorBgTextHover},"&:active":{backgroundColor:e.colorBgTextActive}},"&-active":{fontWeight:e.fontWeightStrong,backgroundColor:e.itemActiveBg,borderColor:e.colorPrimary,a:{color:e.colorPrimary},"&:hover":{borderColor:e.colorPrimaryHover},"&:hover a":{color:e.colorPrimaryHover}}}}},V=e=>{let{componentCls:t}=e;return{[t]:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},(0,W.Wf)(e)),{"ul, ol":{margin:0,padding:0,listStyle:"none"},"&::after":{display:"block",clear:"both",height:0,overflow:"hidden",visibility:"hidden",content:'""'},["".concat(t,"-total-text")]:{display:"inline-block",height:e.itemSize,marginInlineEnd:e.marginXS,lineHeight:(0,H.bf)(e.calc(e.itemSize).sub(2).equal()),verticalAlign:"middle"}}),F(e)),G(e)),U(e)),K(e)),L(e)),{["@media only screen and (max-width: ".concat(e.screenLG,"px)")]:{["".concat(t,"-item")]:{"&-after-jump-prev, &-before-jump-next":{display:"none"}}},["@media only screen and (max-width: ".concat(e.screenSM,"px)")]:{["".concat(t,"-options")]:{display:"none"}}}),["&".concat(e.componentCls,"-rtl")]:{direction:"rtl"}}},Y=e=>{let{componentCls:t}=e;return{["".concat(t,":not(").concat(t,"-disabled)")]:{["".concat(t,"-item")]:Object.assign({},(0,W.Qy)(e)),["".concat(t,"-jump-prev, ").concat(t,"-jump-next")]:{"&:focus-visible":Object.assign({["".concat(t,"-item-link-icon")]:{opacity:1},["".concat(t,"-item-ellipsis")]:{opacity:0}},(0,W.oN)(e))},["".concat(t,"-prev, ").concat(t,"-next")]:{["&:focus-visible ".concat(t,"-item-link")]:Object.assign({},(0,W.oN)(e))}}}},J=e=>Object.assign({itemBg:e.colorBgContainer,itemSize:e.controlHeight,itemSizeSM:e.controlHeightSM,itemActiveBg:e.colorBgContainer,itemLinkBg:e.colorBgContainer,itemActiveColorDisabled:e.colorTextDisabled,itemActiveBgDisabled:e.controlItemBgActiveDisabled,itemInputBg:e.colorBgContainer,miniOptionsSizeChangerTop:0},(0,A.T)(e)),Q=e=>(0,R.TS)(e,{inputOutlineOffset:0,paginationMiniOptionsMarginInlineStart:e.calc(e.marginXXS).div(2).equal(),paginationMiniQuickJumperInputWidth:e.calc(e.controlHeightLG).mul(1.1).equal(),paginationItemPaddingInline:e.calc(e.marginXXS).mul(1.5).equal(),paginationEllipsisLetterSpacing:e.calc(e.marginXXS).div(2).equal(),paginationSlashMarginInlineStart:e.marginXXS,paginationSlashMarginInlineEnd:e.marginSM,paginationEllipsisTextIndent:"0.13em"},(0,A.e)(e));var $=(0,q.I$)("Pagination",e=>{let t=Q(e);return[V(t),Y(t)]},J),ee=n(29961);let et=e=>{let{componentCls:t}=e;return{["".concat(t).concat(t,"-bordered").concat(t,"-disabled:not(").concat(t,"-mini)")]:{"&, &:hover":{["".concat(t,"-item-link")]:{borderColor:e.colorBorder}},"&:focus-visible":{["".concat(t,"-item-link")]:{borderColor:e.colorBorder}},["".concat(t,"-item, ").concat(t,"-item-link")]:{backgroundColor:e.colorBgContainerDisabled,borderColor:e.colorBorder,["&:hover:not(".concat(t,"-item-active)")]:{backgroundColor:e.colorBgContainerDisabled,borderColor:e.colorBorder,a:{color:e.colorTextDisabled}},["&".concat(t,"-item-active")]:{backgroundColor:e.itemActiveBgDisabled}},["".concat(t,"-prev, ").concat(t,"-next")]:{"&:hover button":{backgroundColor:e.colorBgContainerDisabled,borderColor:e.colorBorder,color:e.colorTextDisabled},["".concat(t,"-item-link")]:{backgroundColor:e.colorBgContainerDisabled,borderColor:e.colorBorder}}},["".concat(t).concat(t,"-bordered:not(").concat(t,"-mini)")]:{["".concat(t,"-prev, ").concat(t,"-next")]:{"&:hover button":{borderColor:e.colorPrimaryHover,backgroundColor:e.itemBg},["".concat(t,"-item-link")]:{backgroundColor:e.itemLinkBg,borderColor:e.colorBorder},["&:hover ".concat(t,"-item-link")]:{borderColor:e.colorPrimary,backgroundColor:e.itemBg,color:e.colorPrimary},["&".concat(t,"-disabled")]:{["".concat(t,"-item-link")]:{borderColor:e.colorBorder,color:e.colorTextDisabled}}},["".concat(t,"-item")]:{backgroundColor:e.itemBg,border:"".concat((0,H.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorBorder),["&:hover:not(".concat(t,"-item-active)")]:{borderColor:e.colorPrimary,backgroundColor:e.itemBg,a:{color:e.colorPrimary}},"&-active":{borderColor:e.colorPrimary}}}}};var en=(0,q.bk)(["Pagination","bordered"],e=>[et(Q(e))],J),eo=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>t.indexOf(o)&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,o=Object.getOwnPropertySymbols(e);at.indexOf(o[a])&&Object.prototype.propertyIsEnumerable.call(e,o[a])&&(n[o[a]]=e[o[a]]);return n},ea=e=>{let{prefixCls:t,selectPrefixCls:n,className:o,rootClassName:i,style:r,size:l,locale:u,selectComponentClass:g,responsive:b,showSizeChanger:h}=e,f=eo(e,["prefixCls","selectPrefixCls","className","rootClassName","style","size","locale","selectComponentClass","responsive","showSizeChanger"]),{xs:v}=(0,I.Z)(b),[,x]=(0,ee.ZP)(),{getPrefixCls:k,direction:S,pagination:y={}}=a.useContext(M.E_),C=k("pagination",t),[w,E,N]=$(C),z=null!=h?h:y.showSizeChanger,T=a.useMemo(()=>{let e=a.createElement("span",{className:"".concat(C,"-item-ellipsis")},"•••"),t=a.createElement("button",{className:"".concat(C,"-item-link"),type:"button",tabIndex:-1},"rtl"===S?a.createElement(m.Z,null):a.createElement(d.Z,null));return{prevIcon:t,nextIcon:a.createElement("button",{className:"".concat(C,"-item-link"),type:"button",tabIndex:-1},"rtl"===S?a.createElement(d.Z,null):a.createElement(m.Z,null)),jumpPrevIcon:a.createElement("a",{className:"".concat(C,"-item-link")},a.createElement("div",{className:"".concat(C,"-item-container")},"rtl"===S?a.createElement(s,{className:"".concat(C,"-item-link-icon")}):a.createElement(c,{className:"".concat(C,"-item-link-icon")}),e)),jumpNextIcon:a.createElement("a",{className:"".concat(C,"-item-link")},a.createElement("div",{className:"".concat(C,"-item-container")},"rtl"===S?a.createElement(c,{className:"".concat(C,"-item-link-icon")}):a.createElement(s,{className:"".concat(C,"-item-link-icon")}),e))}},[S,C]),[H]=(0,Z.Z)("Pagination",O.Z),_=Object.assign(Object.assign({},H),u),A=(0,B.Z)(l),W="small"===A||!!(v&&!A&&b),R=k("select",n),q=p()({["".concat(C,"-mini")]:W,["".concat(C,"-rtl")]:"rtl"===S,["".concat(C,"-bordered")]:x.wireframe},null==y?void 0:y.className,o,i,E,N),X=Object.assign(Object.assign({},null==y?void 0:y.style),r);return w(a.createElement(a.Fragment,null,x.wireframe&&a.createElement(en,{prefixCls:C}),a.createElement(j,Object.assign({},T,f,{style:X,prefixCls:C,selectPrefixCls:R,className:q,selectComponentClass:g||(W?P:D),locale:_,showSizeChanger:z}))))}},30401:function(e,t,n){n.d(t,{Z:function(){return o}});let o=(0,n(79205).Z)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]])},78867:function(e,t,n){n.d(t,{Z:function(){return o}});let o=(0,n(79205).Z)("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]])},86462:function(e,t,n){var o=n(2265);let a=o.forwardRef(function(e,t){return o.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),o.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"}))});t.Z=a}}]);
\ No newline at end of file
diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/302-b44f49193a517791.js b/litellm/proxy/_experimental/out/_next/static/chunks/302-b44f49193a517791.js
deleted file mode 100644
index 903f19da9e2..00000000000
--- a/litellm/proxy/_experimental/out/_next/static/chunks/302-b44f49193a517791.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[302],{58927:function(e,s,r){r.d(s,{J:function(){return l.Z}});var l=r(47323)},302:function(e,s,r){r.d(s,{d:function(){return eU},o:function(){return eJ}});var l=r(57437),t=r(2265),a=r(16593),n=r(52787),i=r(82680),o=r(89970),c=r(20831),d=r(12485),m=r(18135),x=r(35242),u=r(29706),h=r(77991),p=r(49804),j=r(67101),g=r(84264),v=r(96761),f=r(12322),b=r(58927),y=r(53410),N=r(74998);let _=e=>{try{let s=e.indexOf("/mcp/");if(-1===s)return{token:null,baseUrl:e};let r=e.split("/mcp/");if(2!==r.length)return{token:null,baseUrl:e};let l=r[0]+"/mcp/",t=r[1];if(!t)return{token:null,baseUrl:e};return{token:t,baseUrl:l}}catch(s){return console.error("Error parsing MCP URL:",s),{token:null,baseUrl:e}}},Z=e=>{let{token:s,baseUrl:r}=_(e);return s?r+"...":e},w=e=>{let{token:s}=_(e);return{maskedUrl:Z(e),hasToken:!!s}},C=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(),S=e=>e&&e.includes("-")?Promise.reject("Server name cannot contain '-' (hyphen). Please use '_' (underscore) instead."):Promise.resolve(),k=(e,s,r,t)=>[{accessorKey:"server_id",header:"Server ID",cell:e=>{let{row:r}=e;return(0,l.jsxs)("button",{onClick:()=>s(r.original.server_id),className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left w-full truncate whitespace-nowrap cursor-pointer max-w-[15ch]",children:[r.original.server_id.slice(0,7),"..."]})}},{accessorKey:"server_name",header:"Name"},{accessorKey:"alias",header:"Alias"},{id:"url",header:"URL",cell:e=>{let{row:s}=e,{maskedUrl:r}=w(s.original.url);return(0,l.jsx)("span",{className:"font-mono text-sm",children:r})}},{accessorKey:"transport",header:"Transport",cell:e=>{let{getValue:s}=e;return(0,l.jsx)("span",{children:(s()||"http").toUpperCase()})}},{accessorKey:"auth_type",header:"Auth Type",cell:e=>{let{getValue:s}=e;return(0,l.jsx)("span",{children:s()||"none"})}},{id:"health_status",header:"Health Status",cell:e=>{let{row:s}=e,r=s.original,t=r.status||"unknown",a=r.last_health_check,n=r.health_check_error,i=(0,l.jsxs)("div",{className:"max-w-xs",children:[(0,l.jsxs)("div",{className:"font-semibold mb-1",children:["Health Status: ",t]}),a&&(0,l.jsxs)("div",{className:"text-xs mb-1",children:["Last Check: ",new Date(a).toLocaleString()]}),n&&(0,l.jsxs)("div",{className:"text-xs",children:[(0,l.jsx)("div",{className:"font-medium text-red-400 mb-1",children:"Error:"}),(0,l.jsx)("div",{className:"break-words",children:n})]}),!a&&!n&&(0,l.jsx)("div",{className:"text-xs text-gray-400",children:"No health check data available"})]});return(0,l.jsx)(o.Z,{title:i,placement:"top",children:(0,l.jsxs)("button",{className:"font-mono text-xs font-normal px-2 py-0.5 text-left w-full truncate whitespace-nowrap cursor-pointer max-w-[10ch] ".concat((e=>{switch(e){case"healthy":return"text-green-500 bg-green-50 hover:bg-green-100";case"unhealthy":return"text-red-500 bg-red-50 hover:bg-red-100";default:return"text-gray-500 bg-gray-50 hover:bg-gray-100"}})(t)),children:[(0,l.jsx)("span",{className:"mr-1",children:"●"}),t.charAt(0).toUpperCase()+t.slice(1)]})})}},{id:"mcp_access_groups",header:"Access Groups",cell:e=>{let{row:s}=e,r=s.original.mcp_access_groups;if(Array.isArray(r)&&r.length>0&&"string"==typeof r[0]){let e=r.join(", ");return(0,l.jsx)(o.Z,{title:e,children:(0,l.jsx)("span",{className:"max-w-[200px] truncate block",children:e.length>30?"".concat(e.slice(0,30),"..."):e})})}return(0,l.jsx)("span",{className:"text-gray-400 italic",children:"None"})}},{header:"Created At",accessorKey:"created_at",sortingFn:"datetime",cell:e=>{let{row:s}=e,r=s.original;return(0,l.jsx)("span",{className:"text-xs",children:r.created_at?new Date(r.created_at).toLocaleDateString():"-"})}},{header:"Updated At",accessorKey:"updated_at",sortingFn:"datetime",cell:e=>{let{row:s}=e,r=s.original;return(0,l.jsx)("span",{className:"text-xs",children:r.updated_at?new Date(r.updated_at).toLocaleDateString():"-"})}},{id:"actions",header:"Actions",cell:e=>{let{row:s}=e;return(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(b.J,{icon:y.Z,size:"sm",onClick:()=>r(s.original.server_id),className:"cursor-pointer"}),(0,l.jsx)(b.J,{icon:N.Z,size:"sm",onClick:()=>t(s.original.server_id),className:"cursor-pointer"})]})}}];var P=r(19250),A=r(20347),L=r(10900),M=r(82376),T=r(71437),I=r(12514),E=r(47323);let z={NONE:"none",API_KEY:"api_key",BEARER_TOKEN:"bearer_token",BASIC:"basic"},q={SSE:"sse"},O=e=>(console.log(e),null==e)?q.SSE:e,R=e=>null==e?z.NONE:e,U=e=>R(e)!==z.NONE;var F=r(13634),B=r(73002),K=r(49566),V=r(20577),D=r(44851),H=r(33866),G=r(62670),Y=r(15424),J=r(58630),$=e=>{let{value:s={},onChange:r,tools:t=[],disabled:a=!1}=e,n=(e,l)=>{let t={...s,tool_name_to_cost_per_query:{...s.tool_name_to_cost_per_query,[e]:l}};null==r||r(t)};return(0,l.jsx)(I.Z,{children:(0,l.jsxs)("div",{className:"space-y-6",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2 mb-4",children:[(0,l.jsx)(G.Z,{className:"text-green-600"}),(0,l.jsx)(v.Z,{children:"Cost Configuration"}),(0,l.jsx)(o.Z,{title:"Configure costs for this MCP server's tool calls. Set a default rate and per-tool overrides.",children:(0,l.jsx)(Y.Z,{className:"text-gray-400"})})]}),(0,l.jsxs)("div",{className:"space-y-4",children:[(0,l.jsxs)("div",{children:[(0,l.jsxs)("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:["Default Cost per Query ($)",(0,l.jsx)(o.Z,{title:"Default cost charged for each tool call to this server.",children:(0,l.jsx)(Y.Z,{className:"ml-1 text-gray-400"})})]}),(0,l.jsx)(V.Z,{min:0,step:1e-4,precision:4,placeholder:"0.0000",value:s.default_cost_per_query,onChange:e=>{let l={...s,default_cost_per_query:e};null==r||r(l)},disabled:a,style:{width:"200px"},addonBefore:"$"}),(0,l.jsx)(g.Z,{className:"block mt-1 text-gray-500 text-sm",children:"Set a default cost for all tool calls to this server"})]}),t.length>0&&(0,l.jsxs)("div",{className:"space-y-4",children:[(0,l.jsxs)("label",{className:"block text-sm font-medium text-gray-700",children:["Tool-Specific Costs ($)",(0,l.jsx)(o.Z,{title:"Override the default cost for specific tools. Leave blank to use the default rate.",children:(0,l.jsx)(Y.Z,{className:"ml-1 text-gray-400"})})]}),(0,l.jsx)(D.default,{items:[{key:"1",label:(0,l.jsxs)("div",{className:"flex items-center",children:[(0,l.jsx)(J.Z,{className:"mr-2 text-blue-500"}),(0,l.jsx)("span",{className:"font-medium",children:"Available Tools"}),(0,l.jsx)(H.Z,{count:t.length,style:{backgroundColor:"#52c41a",marginLeft:"8px"}})]}),children:(0,l.jsx)("div",{className:"space-y-3 max-h-64 overflow-y-auto",children:t.map((e,r)=>{var t;return(0,l.jsxs)("div",{className:"flex items-center justify-between p-3 bg-gray-50 rounded-lg",children:[(0,l.jsxs)("div",{className:"flex-1",children:[(0,l.jsx)(g.Z,{className:"font-medium text-gray-900",children:e.name}),e.description&&(0,l.jsx)(g.Z,{className:"text-gray-500 text-sm block mt-1",children:e.description})]}),(0,l.jsx)("div",{className:"ml-4",children:(0,l.jsx)(V.Z,{min:0,step:1e-4,precision:4,placeholder:"Use default",value:null===(t=s.tool_name_to_cost_per_query)||void 0===t?void 0:t[e.name],onChange:s=>n(e.name,s),disabled:a,style:{width:"120px"},addonBefore:"$"})})]},r)})})}]})]})]}),(s.default_cost_per_query||s.tool_name_to_cost_per_query&&Object.keys(s.tool_name_to_cost_per_query).length>0)&&(0,l.jsxs)("div",{className:"mt-6 p-4 bg-blue-50 border border-blue-200 rounded-lg",children:[(0,l.jsx)(g.Z,{className:"text-blue-800 font-medium",children:"Cost Summary:"}),(0,l.jsxs)("div",{className:"mt-2 space-y-1",children:[s.default_cost_per_query&&(0,l.jsxs)(g.Z,{className:"text-blue-700",children:["• Default cost: $",s.default_cost_per_query.toFixed(4)," per query"]}),s.tool_name_to_cost_per_query&&Object.entries(s.tool_name_to_cost_per_query).map(e=>{let[s,r]=e;return null!=r&&(0,l.jsxs)(g.Z,{className:"text-blue-700",children:["• ",s,": $",r.toFixed(4)," per query"]},s)})]})]})]})})};let{Panel:W}=D.default;var Q=e=>{let{availableAccessGroups:s,mcpServer:r,searchValue:a,setSearchValue:i,getAccessGroupOptions:c}=e,d=F.Z.useFormInstance();return(0,t.useEffect)(()=>{r&&r.extra_headers&&d.setFieldValue("extra_headers",r.extra_headers)},[r,d]),(0,l.jsx)(D.default,{className:"bg-gray-50 border border-gray-200 rounded-lg",expandIconPosition:"end",ghost:!1,children:(0,l.jsx)(W,{header:(0,l.jsxs)("div",{className:"flex items-center",children:[(0,l.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,l.jsx)("div",{className:"w-2 h-2 bg-blue-500 rounded-full"}),(0,l.jsx)("h3",{className:"text-lg font-semibold text-gray-900",children:"Permission Management / Access Control"})]}),(0,l.jsx)("p",{className:"text-sm text-gray-600 ml-4",children:"Configure access permissions and security settings (Optional)"})]}),className:"border-0",children:(0,l.jsxs)("div",{className:"space-y-6 pt-4",children:[(0,l.jsx)(F.Z.Item,{label:(0,l.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["MCP Access Groups",(0,l.jsx)(o.Z,{title:"Specify access groups for this MCP server. Users must be in at least one of these groups to access the server.",children:(0,l.jsx)(Y.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"mcp_access_groups",className:"mb-4",children:(0,l.jsx)(n.default,{mode:"tags",showSearch:!0,placeholder:"Select existing groups or type to create new ones",optionFilterProp:"value",filterOption:(e,s)=>{var r;return(null!==(r=null==s?void 0:s.value)&&void 0!==r?r:"").toLowerCase().includes(e.toLowerCase())},onSearch:e=>i(e),tokenSeparators:[","],options:c(),maxTagCount:"responsive",allowClear:!0})}),(0,l.jsx)(F.Z.Item,{label:(0,l.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Extra Headers",(0,l.jsx)(o.Z,{title:"Forward custom headers from incoming requests to this MCP server (e.g., Authorization, X-Custom-Header, User-Agent)",children:(0,l.jsx)(Y.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})}),(null==r?void 0:r.extra_headers)&&r.extra_headers.length>0&&(0,l.jsxs)("span",{className:"ml-2 text-xs bg-blue-100 text-blue-700 px-2 py-1 rounded-full",children:[r.extra_headers.length," configured"]})]}),name:"extra_headers",children:(0,l.jsx)(n.default,{mode:"tags",placeholder:(null==r?void 0:r.extra_headers)&&r.extra_headers.length>0?"Currently: ".concat(r.extra_headers.join(", ")):"Enter header names (e.g., Authorization, X-Custom-Header)",className:"rounded-lg",size:"large",tokenSeparators:[","],allowClear:!0})})]})},"permissions")})},X=r(83669),ee=r(87908),es=r(61994);let er=e=>{let{accessToken:s,formValues:r,enabled:l=!0}=e,[a,n]=(0,t.useState)([]),[i,o]=(0,t.useState)(!1),[c,d]=(0,t.useState)(null),[m,x]=(0,t.useState)(!1),u=!!(r.url&&r.transport&&r.auth_type&&s),h=async()=>{if(s&&r.url){o(!0),d(null);try{let e={server_id:r.server_id||"",server_name:r.server_name||"",url:r.url,transport:r.transport,auth_type:r.auth_type,mcp_info:r.mcp_info},l=await (0,P.testMCPToolsListRequest)(s,e);if(l.tools&&!l.error)n(l.tools),d(null),l.tools.length>0&&!m&&x(!0);else{let e=l.message||"Failed to retrieve tools list";d(e),n([]),x(!1)}}catch(e){console.error("Tools fetch error:",e),d(e instanceof Error?e.message:String(e)),n([]),x(!1)}finally{o(!1)}}},p=()=>{n([]),d(null),x(!1)};return(0,t.useEffect)(()=>{l&&(u?h():p())},[r.url,r.transport,r.auth_type,s,l,u]),{tools:a,isLoadingTools:i,toolsError:c,hasShownSuccessMessage:m,canFetchTools:u,fetchTools:h,clearTools:p}};var el=e=>{let{accessToken:s,formValues:r,allowedTools:a,existingAllowedTools:n,onAllowedToolsChange:i}=e,o=(0,t.useRef)(0),{tools:c,isLoadingTools:d,toolsError:m,canFetchTools:x}=er({accessToken:s,formValues:r,enabled:!0});(0,t.useEffect)(()=>{if(c.length>0&&c.length!==o.current&&0===a.length){if(n&&n.length>0){let e=c.map(e=>e.name);i(n.filter(s=>e.includes(s)))}else i(c.map(e=>e.name))}o.current=c.length},[c,a.length,n,i]);let u=e=>{a.includes(e)?i(a.filter(s=>s!==e)):i([...a,e])};return x||r.url?(0,l.jsx)(I.Z,{children:(0,l.jsxs)("div",{className:"space-y-4",children:[(0,l.jsx)("div",{className:"flex items-center justify-between",children:(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(J.Z,{className:"text-blue-600"}),(0,l.jsx)(v.Z,{children:"Tool Configuration"}),c.length>0&&(0,l.jsx)(H.Z,{count:c.length,style:{backgroundColor:"#52c41a"}})]})}),(0,l.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-3",children:(0,l.jsxs)(g.Z,{className:"text-blue-800 text-sm",children:[(0,l.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."]})}),d&&(0,l.jsxs)("div",{className:"flex items-center justify-center py-6",children:[(0,l.jsx)(ee.Z,{size:"large"}),(0,l.jsx)(g.Z,{className:"ml-3",children:"Loading tools..."})]}),m&&!d&&(0,l.jsxs)("div",{className:"text-center py-6 text-red-500 border rounded-lg border-dashed border-red-300 bg-red-50",children:[(0,l.jsx)(J.Z,{className:"text-2xl mb-2"}),(0,l.jsx)(g.Z,{className:"text-red-600 font-medium",children:"Unable to load tools"}),(0,l.jsx)("br",{}),(0,l.jsx)(g.Z,{className:"text-sm text-red-500",children:m})]}),!d&&!m&&0===c.length&&x&&(0,l.jsxs)("div",{className:"text-center py-6 text-gray-400 border rounded-lg border-dashed",children:[(0,l.jsx)(J.Z,{className:"text-2xl mb-2"}),(0,l.jsx)(g.Z,{children:"No tools available for configuration"}),(0,l.jsx)("br",{}),(0,l.jsx)(g.Z,{className:"text-sm",children:"Connect to an MCP server with tools to configure them"})]}),!x&&r.url&&(0,l.jsxs)("div",{className:"text-center py-6 text-gray-400 border rounded-lg border-dashed",children:[(0,l.jsx)(J.Z,{className:"text-2xl mb-2"}),(0,l.jsx)(g.Z,{children:"Complete required fields to configure tools"}),(0,l.jsx)("br",{}),(0,l.jsx)(g.Z,{className:"text-sm",children:"Fill in URL, Transport, and Authentication to load available tools"})]}),!d&&!m&&c.length>0&&(0,l.jsxs)("div",{className:"space-y-3",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2 p-3 bg-green-50 rounded-lg border border-green-200 flex-1",children:[(0,l.jsx)(X.Z,{className:"text-green-600"}),(0,l.jsxs)(g.Z,{className:"text-green-700 font-medium",children:[a.length," of ",c.length," ",1===c.length?"tool":"tools"," enabled for user access"]})]}),(0,l.jsxs)("div",{className:"flex gap-2 ml-3",children:[(0,l.jsx)("button",{type:"button",onClick:()=>{i(c.map(e=>e.name))},className:"px-3 py-1.5 text-sm text-blue-600 hover:text-blue-700 hover:bg-blue-50 rounded-md transition-colors",children:"Enable All"}),(0,l.jsx)("button",{type:"button",onClick:()=>{i([])},className:"px-3 py-1.5 text-sm text-gray-600 hover:text-gray-700 hover:bg-gray-100 rounded-md transition-colors",children:"Disable All"})]})]}),(0,l.jsx)("div",{className:"space-y-2",children:c.map((e,s)=>(0,l.jsx)("div",{className:"p-4 rounded-lg border transition-colors cursor-pointer ".concat(a.includes(e.name)?"bg-blue-50 border-blue-300 hover:border-blue-400":"bg-gray-50 border-gray-200 hover:border-gray-300"),onClick:()=>u(e.name),children:(0,l.jsxs)("div",{className:"flex items-start gap-3",children:[(0,l.jsx)(es.Z,{checked:a.includes(e.name),onChange:()=>u(e.name)}),(0,l.jsxs)("div",{className:"flex-1",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(g.Z,{className:"font-medium text-gray-900",children:e.name}),(0,l.jsx)("span",{className:"px-2 py-0.5 text-xs rounded-full font-medium ".concat(a.includes(e.name)?"bg-green-100 text-green-800":"bg-red-100 text-red-800"),children:a.includes(e.name)?"Enabled":"Disabled"})]}),e.description&&(0,l.jsx)(g.Z,{className:"text-gray-500 text-sm block mt-1",children:e.description}),(0,l.jsx)(g.Z,{className:"text-gray-400 text-xs block mt-1",children:a.includes(e.name)?"✓ Users can call this tool":"✗ Users cannot call this tool"})]})]})},s))})]})]})}):null},et=r(9114),ea=e=>{let{mcpServer:s,accessToken:r,onCancel:a,onSuccess:i,availableAccessGroups:o}=e,[p]=F.Z.useForm(),[j,g]=(0,t.useState)({}),[v,f]=(0,t.useState)([]),[b,y]=(0,t.useState)(!1),[N,_]=(0,t.useState)(""),[Z,w]=(0,t.useState)(!1),[k,A]=(0,t.useState)([]);(0,t.useEffect)(()=>{var e;(null===(e=s.mcp_info)||void 0===e?void 0:e.mcp_server_cost_info)&&g(s.mcp_info.mcp_server_cost_info)},[s]),(0,t.useEffect)(()=>{s.allowed_tools&&A(s.allowed_tools)},[s]),(0,t.useEffect)(()=>{if(s.mcp_access_groups){let e=s.mcp_access_groups.map(e=>"string"==typeof e?e:e.name||String(e));p.setFieldValue("mcp_access_groups",e)}},[s]),(0,t.useEffect)(()=>{L()},[s,r]);let L=async()=>{if(r&&s.url){y(!0);try{let e={server_id:s.server_id,server_name:s.server_name,url:s.url,transport:s.transport,auth_type:s.auth_type,mcp_info:s.mcp_info},l=await (0,P.testMCPToolsListRequest)(r,e);l.tools&&!l.error?f(l.tools):(console.error("Failed to fetch tools:",l.message),f([]))}catch(e){console.error("Tools fetch error:",e),f([])}finally{y(!1)}}},M=async e=>{if(r)try{let l=(e.mcp_access_groups||[]).map(e=>"string"==typeof e?e:e.name||String(e)),t={...e,server_id:s.server_id,mcp_info:{server_name:e.server_name||e.url,description:e.description,mcp_server_cost_info:Object.keys(j).length>0?j:null},mcp_access_groups:l,alias:e.alias,extra_headers:e.extra_headers||[],allowed_tools:k.length>0?k:null,disallowed_tools:e.disallowed_tools||[]},a=await (0,P.updateMCPServer)(r,t);et.Z.success("MCP Server updated successfully"),i(a)}catch(e){et.Z.fromBackend("Failed to update MCP Server"+((null==e?void 0:e.message)?": ".concat(e.message):""))}};return(0,l.jsxs)(m.Z,{children:[(0,l.jsxs)(x.Z,{className:"grid w-full grid-cols-2",children:[(0,l.jsx)(d.Z,{children:"Server Configuration"}),(0,l.jsx)(d.Z,{children:"Cost Configuration"})]}),(0,l.jsxs)(h.Z,{className:"mt-6",children:[(0,l.jsx)(u.Z,{children:(0,l.jsxs)(F.Z,{form:p,onFinish:M,initialValues:s,layout:"vertical",children:[(0,l.jsx)(F.Z.Item,{label:"MCP Server Name",name:"server_name",rules:[{validator:(e,s)=>S(s)}],children:(0,l.jsx)(K.Z,{})}),(0,l.jsx)(F.Z.Item,{label:"Alias",name:"alias",rules:[{validator:(e,s)=>S(s)}],children:(0,l.jsx)(K.Z,{onChange:()=>w(!0)})}),(0,l.jsx)(F.Z.Item,{label:"Description",name:"description",children:(0,l.jsx)(K.Z,{})}),(0,l.jsx)(F.Z.Item,{label:"MCP Server URL",name:"url",rules:[{required:!0,message:"Please enter a server URL"},{validator:(e,s)=>C(s)}],children:(0,l.jsx)(K.Z,{})}),(0,l.jsx)(F.Z.Item,{label:"Transport Type",name:"transport",rules:[{required:!0}],children:(0,l.jsxs)(n.default,{children:[(0,l.jsx)(n.default.Option,{value:"sse",children:"Server-Sent Events (SSE)"}),(0,l.jsx)(n.default.Option,{value:"http",children:"HTTP"})]})}),(0,l.jsx)(F.Z.Item,{label:"Authentication",name:"auth_type",rules:[{required:!0}],children:(0,l.jsxs)(n.default,{children:[(0,l.jsx)(n.default.Option,{value:"none",children:"None"}),(0,l.jsx)(n.default.Option,{value:"api_key",children:"API Key"}),(0,l.jsx)(n.default.Option,{value:"bearer_token",children:"Bearer Token"}),(0,l.jsx)(n.default.Option,{value:"basic",children:"Basic Auth"})]})}),(0,l.jsx)("div",{className:"mt-6",children:(0,l.jsx)(Q,{availableAccessGroups:o,mcpServer:s,searchValue:N,setSearchValue:_,getAccessGroupOptions:()=>{let e=o.map(e=>({value:e,label:(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),(0,l.jsx)("span",{className:"font-medium",children:e})]})}));return N&&!o.some(e=>e.toLowerCase().includes(N.toLowerCase()))&&e.push({value:N,label:(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("div",{className:"w-2 h-2 bg-blue-500 rounded-full"}),(0,l.jsx)("span",{className:"font-medium",children:N}),(0,l.jsx)("span",{className:"text-gray-400 text-xs ml-1",children:"create new group"})]})}),e}})}),(0,l.jsx)("div",{className:"mt-6",children:(0,l.jsx)(el,{accessToken:r,formValues:{server_id:s.server_id,server_name:s.server_name,url:s.url,transport:s.transport,auth_type:s.auth_type,mcp_info:s.mcp_info},allowedTools:k,existingAllowedTools:s.allowed_tools||null,onAllowedToolsChange:A})}),(0,l.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,l.jsx)(B.ZP,{onClick:a,children:"Cancel"}),(0,l.jsx)(c.Z,{type:"submit",children:"Save Changes"})]})]})}),(0,l.jsx)(u.Z,{children:(0,l.jsxs)("div",{className:"space-y-6",children:[(0,l.jsx)($,{value:j,onChange:g,tools:v,disabled:b}),(0,l.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,l.jsx)(B.ZP,{onClick:a,children:"Cancel"}),(0,l.jsx)(c.Z,{onClick:()=>p.submit(),children:"Save Changes"})]})]})})]})]})},en=r(92280),ei=e=>{let{costConfig:s}=e,r=(null==s?void 0:s.default_cost_per_query)!==void 0&&(null==s?void 0:s.default_cost_per_query)!==null,t=(null==s?void 0:s.tool_name_to_cost_per_query)&&Object.keys(s.tool_name_to_cost_per_query).length>0;return r||t?(0,l.jsx)("div",{className:"mt-6 pt-6 border-t border-gray-200",children:(0,l.jsxs)("div",{className:"space-y-4",children:[r&&(null==s?void 0:s.default_cost_per_query)!==void 0&&(null==s?void 0:s.default_cost_per_query)!==null&&(0,l.jsxs)("div",{children:[(0,l.jsx)(en.x,{className:"font-medium",children:"Default Cost per Query"}),(0,l.jsxs)("div",{className:"text-green-600 font-mono",children:["$",s.default_cost_per_query.toFixed(4)]})]}),t&&(null==s?void 0:s.tool_name_to_cost_per_query)&&(0,l.jsxs)("div",{children:[(0,l.jsx)(en.x,{className:"font-medium",children:"Tool-Specific Costs"}),(0,l.jsx)("div",{className:"mt-2 space-y-2",children:Object.entries(s.tool_name_to_cost_per_query).map(e=>{let[s,r]=e;return null!=r&&(0,l.jsxs)("div",{className:"flex justify-between items-center p-3 bg-gray-50 rounded-lg",children:[(0,l.jsx)(en.x,{className:"font-medium",children:s}),(0,l.jsxs)(en.x,{className:"text-green-600 font-mono",children:["$",r.toFixed(4)," per query"]})]},s)})})]}),(0,l.jsxs)("div",{className:"mt-4 p-4 bg-blue-50 border border-blue-200 rounded-lg",children:[(0,l.jsx)(en.x,{className:"text-blue-800 font-medium",children:"Cost Summary:"}),(0,l.jsxs)("div",{className:"mt-2 space-y-1",children:[r&&(null==s?void 0:s.default_cost_per_query)!==void 0&&(null==s?void 0:s.default_cost_per_query)!==null&&(0,l.jsxs)(en.x,{className:"text-blue-700",children:["• Default cost: $",s.default_cost_per_query.toFixed(4)," per query"]}),t&&(null==s?void 0:s.tool_name_to_cost_per_query)&&(0,l.jsxs)(en.x,{className:"text-blue-700",children:["• ",Object.keys(s.tool_name_to_cost_per_query).length," tool(s) with custom pricing"]})]})]})]})}):(0,l.jsx)("div",{className:"mt-6 pt-6 border-t border-gray-200",children:(0,l.jsx)("div",{className:"space-y-4",children:(0,l.jsx)("div",{className:"p-4 bg-gray-50 border border-gray-200 rounded-lg",children:(0,l.jsx)(en.x,{className:"text-gray-600",children:"No cost configuration set for this server. Tool calls will be charged at $0.00 per tool call."})})})})},eo=r(59872),ec=r(30401),ed=r(78867);let em=e=>{var s,r,a,n,i;let{mcpServer:o,onBack:p,isEditing:f,isProxyAdmin:b,accessToken:y,userRole:N,userID:_,availableAccessGroups:Z}=e,[C,S]=(0,t.useState)(f),[k,P]=(0,t.useState)(!1),[A,z]=(0,t.useState)({}),{maskedUrl:q,hasToken:U}=w(o.url),F=(e,s)=>U?s?e:q:e,K=async(e,s)=>{await (0,eo.vQ)(e)&&(z(e=>({...e,[s]:!0})),setTimeout(()=>{z(e=>({...e,[s]:!1}))},2e3))};return(0,l.jsxs)("div",{className:"p-4 max-w-full",children:[(0,l.jsx)("div",{className:"flex justify-between items-center mb-6",children:(0,l.jsxs)("div",{children:[(0,l.jsx)(c.Z,{icon:L.Z,variant:"light",className:"mb-4",onClick:p,children:"Back to All Servers"}),(0,l.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,l.jsx)(v.Z,{children:o.server_name}),(0,l.jsx)(B.ZP,{type:"text",size:"small",icon:A["mcp-server_name"]?(0,l.jsx)(ec.Z,{size:12}):(0,l.jsx)(ed.Z,{size:12}),onClick:()=>K(o.server_name,"mcp-server_name"),className:"left-2 z-10 transition-all duration-200 ".concat(A["mcp-server_name"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")}),o.alias&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("span",{className:"ml-4 text-gray-500",children:"Alias:"}),(0,l.jsx)("span",{className:"ml-1 font-mono text-blue-600",children:o.alias}),(0,l.jsx)(B.ZP,{type:"text",size:"small",icon:A["mcp-alias"]?(0,l.jsx)(ec.Z,{size:12}):(0,l.jsx)(ed.Z,{size:12}),onClick:()=>K(o.alias,"mcp-alias"),className:"left-2 z-10 transition-all duration-200 ".concat(A["mcp-alias"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]})]}),(0,l.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,l.jsx)(g.Z,{className:"text-gray-500 font-mono",children:o.server_id}),(0,l.jsx)(B.ZP,{type:"text",size:"small",icon:A["mcp-server-id"]?(0,l.jsx)(ec.Z,{size:12}):(0,l.jsx)(ed.Z,{size:12}),onClick:()=>K(o.server_id,"mcp-server-id"),className:"left-2 z-10 transition-all duration-200 ".concat(A["mcp-server-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]})]})}),(0,l.jsxs)(m.Z,{defaultIndex:C?2:0,children:[(0,l.jsx)(x.Z,{className:"mb-4",children:[(0,l.jsx)(d.Z,{children:"Overview"},"overview"),(0,l.jsx)(d.Z,{children:"MCP Tools"},"tools"),...b?[(0,l.jsx)(d.Z,{children:"Settings"},"settings")]:[]]}),(0,l.jsxs)(h.Z,{children:[(0,l.jsxs)(u.Z,{children:[(0,l.jsxs)(j.Z,{numItems:1,numItemsSm:2,numItemsLg:3,className:"gap-6",children:[(0,l.jsxs)(I.Z,{children:[(0,l.jsx)(g.Z,{children:"Transport"}),(0,l.jsx)("div",{className:"mt-2",children:(0,l.jsx)(v.Z,{children:O(null!==(n=o.transport)&&void 0!==n?n:void 0)})})]}),(0,l.jsxs)(I.Z,{children:[(0,l.jsx)(g.Z,{children:"Auth Type"}),(0,l.jsx)("div",{className:"mt-2",children:(0,l.jsx)(g.Z,{children:R(null!==(i=o.auth_type)&&void 0!==i?i:void 0)})})]}),(0,l.jsxs)(I.Z,{children:[(0,l.jsx)(g.Z,{children:"Host Url"}),(0,l.jsxs)("div",{className:"mt-2 flex items-center gap-2",children:[(0,l.jsx)(g.Z,{className:"break-all overflow-wrap-anywhere",children:F(o.url,k)}),U&&(0,l.jsx)("button",{onClick:()=>P(!k),className:"p-1 hover:bg-gray-100 rounded",children:(0,l.jsx)(E.Z,{icon:k?M.Z:T.Z,size:"sm",className:"text-gray-500"})})]})]})]}),(0,l.jsxs)(I.Z,{className:"mt-2",children:[(0,l.jsx)(v.Z,{children:"Cost Configuration"}),(0,l.jsx)(ei,{costConfig:null===(s=o.mcp_info)||void 0===s?void 0:s.mcp_server_cost_info})]})]}),(0,l.jsx)(u.Z,{children:(0,l.jsx)(eJ,{serverId:o.server_id,accessToken:y,auth_type:o.auth_type,userRole:N,userID:_,serverAlias:o.alias})}),(0,l.jsx)(u.Z,{children:(0,l.jsxs)(I.Z,{children:[(0,l.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,l.jsx)(v.Z,{children:"MCP Server Settings"}),C?null:(0,l.jsx)(c.Z,{variant:"light",onClick:()=>S(!0),children:"Edit Settings"})]}),C?(0,l.jsx)(ea,{mcpServer:o,accessToken:y,onCancel:()=>S(!1),onSuccess:e=>{S(!1),p()},availableAccessGroups:Z}):(0,l.jsxs)("div",{className:"space-y-4",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)(g.Z,{className:"font-medium",children:"Server Name"}),(0,l.jsx)("div",{children:o.server_name})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)(g.Z,{className:"font-medium",children:"Alias"}),(0,l.jsx)("div",{children:o.alias})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)(g.Z,{className:"font-medium",children:"Description"}),(0,l.jsx)("div",{children:o.description})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)(g.Z,{className:"font-medium",children:"URL"}),(0,l.jsxs)("div",{className:"font-mono break-all overflow-wrap-anywhere max-w-full flex items-center gap-2",children:[F(o.url,k),U&&(0,l.jsx)("button",{onClick:()=>P(!k),className:"p-1 hover:bg-gray-100 rounded",children:(0,l.jsx)(E.Z,{icon:k?M.Z:T.Z,size:"sm",className:"text-gray-500"})})]})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)(g.Z,{className:"font-medium",children:"Transport"}),(0,l.jsx)("div",{children:O(o.transport)})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)(g.Z,{className:"font-medium",children:"Extra Headers"}),(0,l.jsx)("div",{children:null===(r=o.extra_headers)||void 0===r?void 0:r.join(", ")})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)(g.Z,{className:"font-medium",children:"Auth Type"}),(0,l.jsx)("div",{children:R(o.auth_type)})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)(g.Z,{className:"font-medium",children:"Access Groups"}),(0,l.jsx)("div",{children:o.mcp_access_groups&&o.mcp_access_groups.length>0?(0,l.jsx)("div",{className:"flex flex-wrap gap-2",children:o.mcp_access_groups.map((e,s)=>{var r;return(0,l.jsx)("span",{className:"px-2 py-1 bg-gray-100 rounded-md text-sm",children:"string"==typeof e?e:null!==(r=null==e?void 0:e.name)&&void 0!==r?r:""},s)})}):(0,l.jsx)(g.Z,{className:"text-gray-500",children:"No access groups defined"})})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)(g.Z,{className:"font-medium",children:"Allowed Tools"}),(0,l.jsx)("div",{children:o.allowed_tools&&o.allowed_tools.length>0?(0,l.jsx)("div",{className:"flex flex-wrap gap-2",children:o.allowed_tools.map((e,s)=>(0,l.jsx)("span",{className:"px-2 py-1 bg-blue-50 border border-blue-200 rounded-md text-sm",children:e},s))}):(0,l.jsx)(g.Z,{className:"text-gray-500",children:"All tools enabled"})})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)(g.Z,{className:"font-medium",children:"Cost Configuration"}),(0,l.jsx)(ei,{costConfig:null===(a=o.mcp_info)||void 0===a?void 0:a.mcp_server_cost_info})]})]})]})})]})]})]})};var ex=r(64504),eu=r(61778),eh=r(29271),ep=r(89245),ej=e=>{let{accessToken:s,formValues:r,onToolsLoaded:a}=e,{tools:n,isLoadingTools:i,toolsError:o,canFetchTools:c,fetchTools:d}=er({accessToken:s,formValues:r,enabled:!0});return((0,t.useEffect)(()=>{null==a||a(n)},[n,a]),c||r.url)?(0,l.jsx)(I.Z,{children:(0,l.jsxs)("div",{className:"space-y-4",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(X.Z,{className:"text-blue-600"}),(0,l.jsx)(v.Z,{children:"Connection Status"})]}),!c&&r.url&&(0,l.jsxs)("div",{className:"text-center py-6 text-gray-400 border rounded-lg border-dashed",children:[(0,l.jsx)(J.Z,{className:"text-2xl mb-2"}),(0,l.jsx)(g.Z,{children:"Complete required fields to test connection"}),(0,l.jsx)("br",{}),(0,l.jsx)(g.Z,{className:"text-sm",children:"Fill in URL, Transport, and Authentication to test MCP server connection"})]}),c&&(0,l.jsxs)("div",{children:[(0,l.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)(g.Z,{className:"text-gray-700 font-medium",children:i?"Testing connection to MCP server...":n.length>0?"Connection successful":o?"Connection failed":"Ready to test connection"}),(0,l.jsx)("br",{}),(0,l.jsxs)(g.Z,{className:"text-gray-500 text-sm",children:["Server: ",r.url]})]}),i&&(0,l.jsxs)("div",{className:"flex items-center text-blue-600",children:[(0,l.jsx)(ee.Z,{size:"small",className:"mr-2"}),(0,l.jsx)(g.Z,{className:"text-blue-600",children:"Connecting..."})]}),!i&&!o&&n.length>0&&(0,l.jsxs)("div",{className:"flex items-center text-green-600",children:[(0,l.jsx)(X.Z,{className:"mr-1"}),(0,l.jsx)(g.Z,{className:"text-green-600 font-medium",children:"Connected"})]}),o&&(0,l.jsxs)("div",{className:"flex items-center text-red-600",children:[(0,l.jsx)(eh.Z,{className:"mr-1"}),(0,l.jsx)(g.Z,{className:"text-red-600 font-medium",children:"Failed"})]})]}),i&&(0,l.jsxs)("div",{className:"flex items-center justify-center py-6",children:[(0,l.jsx)(ee.Z,{size:"large"}),(0,l.jsx)(g.Z,{className:"ml-3",children:"Testing connection and loading tools..."})]}),o&&(0,l.jsx)(eu.Z,{message:"Connection Failed",description:o,type:"error",showIcon:!0,action:(0,l.jsx)(B.ZP,{icon:(0,l.jsx)(ep.Z,{}),onClick:d,size:"small",children:"Retry"})}),!i&&0===n.length&&!o&&(0,l.jsxs)("div",{className:"text-center py-6 text-gray-500 border rounded-lg border-dashed",children:[(0,l.jsx)(X.Z,{className:"text-2xl mb-2 text-green-500"}),(0,l.jsx)(g.Z,{className:"text-green-600 font-medium",children:"Connection successful!"}),(0,l.jsx)("br",{}),(0,l.jsx)(g.Z,{className:"text-gray-500",children:"No tools found for this MCP server"})]})]})]})}):null},eg=r(64482),ev=e=>{let{isVisible:s}=e;return s?(0,l.jsx)(F.Z.Item,{label:(0,l.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Stdio Configuration (JSON)",(0,l.jsx)(o.Z,{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,l.jsx)(Y.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"stdio_config",rules:[{required:!0,message:"Please enter stdio configuration"},{validator:(e,s)=>{if(!s)return Promise.resolve();try{return JSON.parse(s),Promise.resolve()}catch(e){return Promise.reject("Please enter valid JSON")}}}],children:(0,l.jsx)(eg.default.TextArea,{placeholder:'{\n "mcpServers": {\n "circleci-mcp-server": {\n "command": "npx",\n "args": ["-y", "@circleci/mcp-server-circleci"],\n "env": {\n "CIRCLECI_TOKEN": "your-circleci-token",\n "CIRCLECI_BASE_URL": "https://circleci.com"\n }\n }\n }\n}',rows:12,className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500 font-mono text-sm"})}):null};let ef="".concat("../ui/assets/logos/","mcp_logo.png");var eb=e=>{let{userRole:s,accessToken:r,onCreateSuccess:a,isModalVisible:c,setModalVisible:d,availableAccessGroups:m}=e,[x]=F.Z.useForm(),[u,h]=(0,t.useState)(!1),[p,j]=(0,t.useState)({}),[g,v]=(0,t.useState)({}),[f,b]=(0,t.useState)(!1),[y,N]=(0,t.useState)([]),[_,Z]=(0,t.useState)([]),[w,k]=(0,t.useState)(""),[L,M]=(0,t.useState)(""),[T,I]=(0,t.useState)(""),E=(e,s)=>{if(!e){I("");return}"sse"!==s||e.endsWith("/sse")?"http"!==s||e.endsWith("/mcp")?I(""):I("Typically MCP HTTP URLs end with /mcp. You can add this url but this is a warning."):I("Typically MCP SSE URLs end with /sse. You can add this url but this is a warning.")},z=async e=>{h(!0);try{let s=e.mcp_access_groups,l={};if(e.stdio_config&&"stdio"===w)try{let s=JSON.parse(e.stdio_config),r=s;if(s.mcpServers&&"object"==typeof s.mcpServers){let l=Object.keys(s.mcpServers);if(l.length>0){let t=l[0];r=s.mcpServers[t],e.server_name||(e.server_name=t.replace(/-/g,"_"))}}l={command:r.command,args:r.args,env:r.env},console.log("Parsed stdio config:",l)}catch(e){et.Z.fromBackend("Invalid JSON in stdio configuration");return}let t={...e,...l,stdio_config:void 0,mcp_info:{server_name:e.server_name||e.url,description:e.description,mcp_server_cost_info:Object.keys(p).length>0?p:null},mcp_access_groups:s,alias:e.alias,allowed_tools:_.length>0?_:null};if(console.log("Payload: ".concat(JSON.stringify(t))),null!=r){let e=await (0,P.createMCPServer)(r,t);et.Z.success("MCP Server created successfully"),x.resetFields(),j({}),N([]),Z([]),I(""),b(!1),d(!1),a(e)}}catch(e){et.Z.fromBackend("Error creating MCP Server: "+e)}finally{h(!1)}},q=()=>{x.resetFields(),j({}),N([]),Z([]),I(""),b(!1),d(!1)};return(t.useEffect(()=>{if(!f&&g.server_name){let e=g.server_name.replace(/\s+/g,"_");x.setFieldsValue({alias:e}),v(s=>({...s,alias:e}))}},[g.server_name]),t.useEffect(()=>{c||v({})},[c]),(0,A.tY)(s))?(0,l.jsx)(i.Z,{title:(0,l.jsxs)("div",{className:"flex items-center space-x-3 pb-4 border-b border-gray-100",children:[(0,l.jsx)("img",{src:ef,alt:"MCP Logo",className:"w-8 h-8 object-contain",style:{height:"20px",width:"20px",marginRight:"8px",objectFit:"contain"}}),(0,l.jsx)("h2",{className:"text-xl font-semibold text-gray-900",children:"Add New MCP Server"})]}),open:c,width:1e3,onCancel:q,footer:null,className:"top-8",styles:{body:{padding:"24px"},header:{padding:"24px 24px 0 24px",border:"none"}},children:(0,l.jsx)("div",{className:"mt-6",children:(0,l.jsxs)(F.Z,{form:x,onFinish:z,onValuesChange:(e,s)=>v(s),layout:"vertical",className:"space-y-6",children:[(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-6",children:[(0,l.jsx)(F.Z.Item,{label:(0,l.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["MCP Server Name",(0,l.jsx)(o.Z,{title:"Best practice: Use a descriptive name that indicates the server's purpose (e.g., 'GitHub_MCP', 'Email_Service'). Hyphens '-' are not allowed; use underscores '_' instead.",children:(0,l.jsx)(Y.Z,{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)=>S(s)}],children:(0,l.jsx)(ex.o,{placeholder:"e.g., GitHub_MCP, Zapier_MCP, etc.",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,l.jsx)(F.Z.Item,{label:(0,l.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Alias",(0,l.jsx)(o.Z,{title:"A short, unique identifier for this server. Defaults to the server name with spaces replaced by underscores.",children:(0,l.jsx)(Y.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"alias",rules:[{required:!1},{validator:(e,s)=>s&&s.includes("-")?Promise.reject("Alias cannot contain '-' (hyphen). Please use '_' (underscore) instead."):Promise.resolve()}],children:(0,l.jsx)(ex.o,{placeholder:"e.g., GitHub_MCP, Zapier_MCP, etc.",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500",onChange:()=>b(!0)})}),(0,l.jsx)(F.Z.Item,{label:(0,l.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,l.jsx)(ex.o,{placeholder:"Brief description of what this server does",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,l.jsx)(F.Z.Item,{label:(0,l.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,l.jsxs)(n.default,{placeholder:"Select transport",className:"rounded-lg",size:"large",onChange:e=>{if(k(e),"stdio"===e)x.setFieldsValue({url:void 0,auth_type:void 0}),I("");else{x.setFieldsValue({command:void 0,args:void 0,env:void 0});let s=x.getFieldValue("url");s&&E(s,e)}},value:w,children:[(0,l.jsx)(n.default.Option,{value:"http",children:"HTTP"}),(0,l.jsx)(n.default.Option,{value:"sse",children:"Server-Sent Events (SSE)"}),(0,l.jsx)(n.default.Option,{value:"stdio",children:"Standard Input/Output (stdio)"})]})}),"stdio"!==w&&(0,l.jsx)(F.Z.Item,{label:(0,l.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)=>C(s)}],children:(0,l.jsxs)("div",{children:[(0,l.jsx)(ex.o,{placeholder:"https://your-mcp-server.com",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500",onChange:e=>E(e.target.value,w)}),T&&(0,l.jsx)("div",{className:"mt-1 text-red-500 text-sm font-medium",children:T})]})}),"stdio"!==w&&(0,l.jsx)(F.Z.Item,{label:(0,l.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Authentication"}),name:"auth_type",rules:[{required:!0,message:"Please select an auth type"}],children:(0,l.jsxs)(n.default,{placeholder:"Select auth type",className:"rounded-lg",size:"large",children:[(0,l.jsx)(n.default.Option,{value:"none",children:"None"}),(0,l.jsx)(n.default.Option,{value:"api_key",children:"API Key"}),(0,l.jsx)(n.default.Option,{value:"bearer_token",children:"Bearer Token"}),(0,l.jsx)(n.default.Option,{value:"basic",children:"Basic Auth"})]})}),(0,l.jsx)(ev,{isVisible:"stdio"===w})]}),(0,l.jsx)("div",{className:"mt-8",children:(0,l.jsx)(Q,{availableAccessGroups:m,mcpServer:null,searchValue:L,setSearchValue:M,getAccessGroupOptions:()=>{let e=m.map(e=>({value:e,label:(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),(0,l.jsx)("span",{className:"font-medium",children:e})]})}));return L&&!m.some(e=>e.toLowerCase().includes(L.toLowerCase()))&&e.push({value:L,label:(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("div",{className:"w-2 h-2 bg-blue-500 rounded-full"}),(0,l.jsx)("span",{className:"font-medium",children:L}),(0,l.jsx)("span",{className:"text-gray-400 text-xs ml-1",children:"create new group"})]})}),e}})}),(0,l.jsx)("div",{className:"mt-8 pt-6 border-t border-gray-200",children:(0,l.jsx)(ej,{accessToken:r,formValues:g,onToolsLoaded:N})}),(0,l.jsx)("div",{className:"mt-6",children:(0,l.jsx)(el,{accessToken:r,formValues:g,allowedTools:_,existingAllowedTools:null,onAllowedToolsChange:Z})}),(0,l.jsx)("div",{className:"mt-6",children:(0,l.jsx)($,{value:p,onChange:j,tools:y.filter(e=>_.includes(e.name)),disabled:!1})}),(0,l.jsxs)("div",{className:"flex items-center justify-end space-x-3 pt-6 border-t border-gray-100",children:[(0,l.jsx)(ex.z,{variant:"secondary",onClick:q,children:"Cancel"}),(0,l.jsx)(ex.z,{variant:"primary",loading:u,children:u?"Creating...":"Add MCP Server"})]})]})})}):null},ey=r(93192),eN=r(67960),e_=r(63709),eZ=r(93142),ew=r(64935),eC=r(11239),eS=r(54001),ek=r(96137),eP=r(96362),eA=r(80221),eL=r(29202);let{Title:eM,Text:eT}=ey.default,{Panel:eI}=D.default,eE=e=>{let{icon:s,title:r,description:a,children:n,serverName:i,accessGroups:o=["dev"]}=e,[c,d]=(0,t.useState)(!1),m=()=>{let e={"x-litellm-api-key":"Bearer YOUR_LITELLM_API_KEY"};if(c&&i){let s=[i.replace(/\s+/g,"_"),...o].join(",");e["x-mcp-servers"]=[s]}return e};return(0,l.jsxs)(eN.Z,{className:"border border-gray-200",children:[(0,l.jsxs)("div",{className:"flex items-center gap-3 mb-3",children:[(0,l.jsx)("span",{className:"p-2 rounded-lg bg-gray-50",children:s}),(0,l.jsxs)("div",{children:[(0,l.jsx)(eM,{level:5,className:"mb-0",children:r}),(0,l.jsx)(eT,{className:"text-gray-600",children:a})]})]}),i&&("Implementation Example"===r||"Configuration"===r)&&(0,l.jsxs)(F.Z.Item,{className:"mb-4",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,l.jsx)(e_.Z,{size:"small",checked:c,onChange:d}),(0,l.jsxs)(eT,{className:"text-sm",children:["Limit tools to specific MCP servers or MCP groups by passing the ",(0,l.jsx)("code",{children:"x-mcp-servers"})," header"]})]}),c&&(0,l.jsx)(eu.Z,{className:"mt-2",type:"info",showIcon:!0,message:"Two Options",description:(0,l.jsxs)("div",{children:[(0,l.jsxs)("p",{children:[(0,l.jsx)("strong",{children:"Option 1:"})," Get a specific server: ",(0,l.jsxs)("code",{children:['["',i.replace(/\s+/g,"_"),'"]']})]}),(0,l.jsxs)("p",{children:[(0,l.jsx)("strong",{children:"Option 2:"})," Get a group of MCPs: ",(0,l.jsx)("code",{children:'["dev-group"]'})]}),(0,l.jsxs)("p",{className:"mt-2 text-sm text-gray-600",children:["You can also mix both: ",(0,l.jsx)("code",{children:'["Server1,dev-group"]'})]})]})})]}),t.Children.map(n,e=>{if(t.isValidElement(e)&&e.props.hasOwnProperty("code")&&e.props.hasOwnProperty("copyKey")){let s=e.props.code;if(s&&s.includes('"headers":'))return t.cloneElement(e,{code:s.replace(/"headers":\s*{[^}]*}/,'"headers": '.concat(JSON.stringify(m(),null,8)))})}return e})]})};var ez=e=>{let{currentServerAccessGroups:s=[]}=e,r=(0,P.getProxyBaseUrl)(),[a,n]=(0,t.useState)({}),[i,o]=(0,t.useState)({openai:[],litellm:[],cursor:[],http:[]}),[c]=(0,t.useState)("Zapier_MCP"),p=async(e,s)=>{await (0,eo.vQ)(e)&&(n(e=>({...e,[s]:!0})),setTimeout(()=>{n(e=>({...e,[s]:!1}))},2e3))},j=e=>{let{code:s,copyKey:r,title:t,className:n=""}=e;return(0,l.jsxs)("div",{className:"relative group",children:[t&&(0,l.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,l.jsx)(ew.Z,{size:16,className:"text-blue-600"}),(0,l.jsx)(eT,{strong:!0,className:"text-gray-700",children:t})]}),(0,l.jsxs)(eN.Z,{className:"bg-gray-50 border border-gray-200 relative ".concat(n),children:[(0,l.jsx)(B.ZP,{type:"text",size:"small",icon:a[r]?(0,l.jsx)(ec.Z,{size:12}):(0,l.jsx)(ed.Z,{size:12}),onClick:()=>p(s,r),className:"absolute top-2 right-2 z-10 transition-all duration-200 ".concat(a[r]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")}),(0,l.jsx)("pre",{className:"text-sm overflow-x-auto pr-10 text-gray-800 font-mono leading-relaxed",children:s})]})]})},f=e=>{let{step:s,title:r,children:t}=e;return(0,l.jsxs)("div",{className:"flex gap-4",children:[(0,l.jsx)("div",{className:"flex-shrink-0",children:(0,l.jsx)("div",{className:"w-8 h-8 bg-blue-600 text-white rounded-full flex items-center justify-center text-sm font-semibold",children:s})}),(0,l.jsxs)("div",{className:"flex-1",children:[(0,l.jsx)(eT,{strong:!0,className:"text-gray-800 block mb-2",children:r}),t]})]})};return(0,l.jsx)("div",{children:(0,l.jsxs)(eZ.Z,{direction:"vertical",size:"large",className:"w-full",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)(v.Z,{className:"text-3xl font-bold text-gray-900 mb-3",children:"Connect to your MCP client"}),(0,l.jsx)(g.Z,{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,l.jsxs)(m.Z,{className:"w-full",children:[(0,l.jsx)(x.Z,{className:"flex justify-start mt-8 mb-6",children:(0,l.jsxs)("div",{className:"flex bg-gray-100 p-1 rounded-lg",children:[(0,l.jsx)(d.Z,{className:"px-6 py-3 rounded-md transition-all duration-200",children:(0,l.jsxs)("span",{className:"flex items-center gap-2 font-medium",children:[(0,l.jsx)(ew.Z,{size:18}),"OpenAI API"]})}),(0,l.jsx)(d.Z,{className:"px-6 py-3 rounded-md transition-all duration-200",children:(0,l.jsxs)("span",{className:"flex items-center gap-2 font-medium",children:[(0,l.jsx)(eC.Z,{size:18}),"LiteLLM Proxy"]})}),(0,l.jsx)(d.Z,{className:"px-6 py-3 rounded-md transition-all duration-200",children:(0,l.jsxs)("span",{className:"flex items-center gap-2 font-medium",children:[(0,l.jsx)(eA.Z,{size:18}),"Cursor"]})}),(0,l.jsx)(d.Z,{className:"px-6 py-3 rounded-md transition-all duration-200",children:(0,l.jsxs)("span",{className:"flex items-center gap-2 font-medium",children:[(0,l.jsx)(eL.Z,{size:18}),"Streamable HTTP"]})})]})}),(0,l.jsxs)(h.Z,{children:[(0,l.jsx)(u.Z,{className:"mt-6",children:(0,l.jsx)(()=>(0,l.jsxs)(eZ.Z,{direction:"vertical",size:"large",className:"w-full",children:[(0,l.jsxs)("div",{className:"bg-gradient-to-r from-blue-50 to-indigo-50 p-6 rounded-lg border border-blue-100",children:[(0,l.jsxs)("div",{className:"flex items-center gap-3 mb-3",children:[(0,l.jsx)(ew.Z,{className:"text-blue-600",size:24}),(0,l.jsx)(eM,{level:4,className:"mb-0 text-blue-900",children:"OpenAI Responses API Integration"})]}),(0,l.jsx)(eT,{className:"text-blue-700",children:"Connect OpenAI Responses API to your LiteLLM MCP server for seamless tool integration"})]}),(0,l.jsxs)(eZ.Z,{direction:"vertical",size:"large",className:"w-full",children:[(0,l.jsx)(eE,{icon:(0,l.jsx)(eS.Z,{className:"text-blue-600",size:16}),title:"API Key Setup",description:"Configure your OpenAI API key for authentication",children:(0,l.jsxs)(eZ.Z,{direction:"vertical",size:"middle",className:"w-full",children:[(0,l.jsx)("div",{children:(0,l.jsxs)(eT,{children:["Get your API key from the"," ",(0,l.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,l.jsx)(eP.Z,{size:12})]})]})}),(0,l.jsx)(j,{title:"Environment Variable",code:'export OPENAI_API_KEY="sk-..."',copyKey:"openai-env"})]})}),(0,l.jsx)(eE,{icon:(0,l.jsx)(ek.Z,{className:"text-blue-600",size:16}),title:"MCP Server Information",description:"Connection details for your LiteLLM MCP server",children:(0,l.jsx)(j,{title:"Server URL",code:"".concat(r,"/mcp"),copyKey:"openai-server-url"})}),(0,l.jsx)(eE,{icon:(0,l.jsx)(ew.Z,{className:"text-blue-600",size:16}),title:"Implementation Example",description:"Complete cURL example for using the Responses API",serverName:"Zapier Gmail",accessGroups:["dev"],children:(0,l.jsx)(j,{code:'curl --location \'https://api.openai.com/v1/responses\' \\\n--header \'Content-Type: application/json\' \\\n--header "Authorization: Bearer $OPENAI_API_KEY" \\\n--data \'{\n "model": "gpt-4.1",\n "tools": [\n {\n "type": "mcp",\n "server_label": "litellm",\n "server_url": "'.concat(r,'/mcp",\n "require_approval": "never",\n "headers": {\n "x-litellm-api-key": "Bearer YOUR_LITELLM_API_KEY",\n "x-mcp-servers": ["Zapier_MCP,dev"]\n }\n }\n ],\n "input": "Run available tools",\n "tool_choice": "required"\n}\''),copyKey:"openai-curl",className:"text-xs"})})]})]}),{})}),(0,l.jsx)(u.Z,{className:"mt-6",children:(0,l.jsx)(()=>(0,l.jsxs)(eZ.Z,{direction:"vertical",size:"large",className:"w-full",children:[(0,l.jsxs)("div",{className:"bg-gradient-to-r from-emerald-50 to-green-50 p-6 rounded-lg border border-emerald-100",children:[(0,l.jsxs)("div",{className:"flex items-center gap-3 mb-3",children:[(0,l.jsx)(eC.Z,{className:"text-emerald-600",size:24}),(0,l.jsx)(eM,{level:4,className:"mb-0 text-emerald-900",children:"LiteLLM Proxy API Integration"})]}),(0,l.jsx)(eT,{className:"text-emerald-700",children:"Connect to LiteLLM Proxy Responses API for seamless tool integration with multiple model providers"})]}),(0,l.jsxs)(eZ.Z,{direction:"vertical",size:"large",className:"w-full",children:[(0,l.jsx)(eE,{icon:(0,l.jsx)(eS.Z,{className:"text-emerald-600",size:16}),title:"API Key Setup",description:"Configure your LiteLLM Proxy API key for authentication",children:(0,l.jsxs)(eZ.Z,{direction:"vertical",size:"middle",className:"w-full",children:[(0,l.jsx)("div",{children:(0,l.jsx)(eT,{children:"Get your API key from your LiteLLM Proxy dashboard or contact your administrator"})}),(0,l.jsx)(j,{title:"Environment Variable",code:'export LITELLM_API_KEY="sk-..."',copyKey:"litellm-env"})]})}),(0,l.jsx)(eE,{icon:(0,l.jsx)(ek.Z,{className:"text-emerald-600",size:16}),title:"MCP Server Information",description:"Connection details for your LiteLLM MCP server",children:(0,l.jsx)(j,{title:"Server URL",code:"".concat(r,"/mcp"),copyKey:"litellm-server-url"})}),(0,l.jsx)(eE,{icon:(0,l.jsx)(ew.Z,{className:"text-emerald-600",size:16}),title:"Implementation Example",description:"Complete cURL example for using the LiteLLM Proxy Responses API",serverName:c,accessGroups:["dev"],children:(0,l.jsx)(j,{code:"curl --location '".concat(r,'/v1/responses\' \\\n--header \'Content-Type: application/json\' \\\n--header "Authorization: Bearer $LITELLM_API_KEY" \\\n--data \'{\n "model": "gpt-4",\n "tools": [\n {\n "type": "mcp",\n "server_label": "litellm",\n "server_url": "').concat(r,'/mcp",\n "require_approval": "never",\n "headers": {\n "x-litellm-api-key": "Bearer YOUR_LITELLM_API_KEY",\n "x-mcp-servers": ["Zapier_MCP,dev"]\n }\n }\n ],\n "input": "Run available tools",\n "tool_choice": "required"\n}\''),copyKey:"litellm-curl",className:"text-xs"})})]})]}),{})}),(0,l.jsx)(u.Z,{className:"mt-6",children:(0,l.jsx)(()=>(0,l.jsxs)(eZ.Z,{direction:"vertical",size:"large",className:"w-full",children:[(0,l.jsxs)("div",{className:"bg-gradient-to-r from-purple-50 to-blue-50 p-6 rounded-lg border border-purple-100",children:[(0,l.jsxs)("div",{className:"flex items-center gap-3 mb-3",children:[(0,l.jsx)(eA.Z,{className:"text-purple-600",size:24}),(0,l.jsx)(eM,{level:4,className:"mb-0 text-purple-900",children:"Cursor IDE Integration"})]}),(0,l.jsx)(eT,{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,l.jsxs)(eN.Z,{className:"border border-gray-200",children:[(0,l.jsx)(eM,{level:5,className:"mb-4 text-gray-800",children:"Setup Instructions"}),(0,l.jsxs)(eZ.Z,{direction:"vertical",size:"large",className:"w-full",children:[(0,l.jsx)(f,{step:1,title:"Open Cursor Settings",children:(0,l.jsxs)(eT,{className:"text-gray-600",children:["Use the keyboard shortcut ",(0,l.jsx)("code",{className:"bg-gray-100 px-2 py-1 rounded",children:"⇧+⌘+J"})," (Mac) or"," ",(0,l.jsx)("code",{className:"bg-gray-100 px-2 py-1 rounded",children:"Ctrl+Shift+J"})," (Windows/Linux)"]})}),(0,l.jsx)(f,{step:2,title:"Navigate to MCP Tools",children:(0,l.jsx)(eT,{className:"text-gray-600",children:'Go to the "MCP Tools" tab and click "New MCP Server"'})}),(0,l.jsxs)(f,{step:3,title:"Add Configuration",children:[(0,l.jsxs)(eT,{className:"text-gray-600 mb-3",children:["Copy the JSON configuration below and paste it into Cursor, then save with"," ",(0,l.jsx)("code",{className:"bg-gray-100 px-2 py-1 rounded",children:"Cmd+S"})," or"," ",(0,l.jsx)("code",{className:"bg-gray-100 px-2 py-1 rounded",children:"Ctrl+S"})]}),(0,l.jsx)(eE,{icon:(0,l.jsx)(ew.Z,{className:"text-purple-600",size:16}),title:"Configuration",description:"Cursor MCP configuration",serverName:"Zapier Gmail",accessGroups:["dev"],children:(0,l.jsx)(j,{code:'{\n "mcpServers": {\n "Zapier_MCP": {\n "server_url": "'.concat(r,'/mcp",\n "headers": {\n "x-litellm-api-key": "Bearer YOUR_LITELLM_API_KEY",\n "x-mcp-servers": ["Zapier_MCP,dev"]\n }\n }\n }\n}'),copyKey:"cursor-config",className:"text-xs"})})]})]})]})]}),{})}),(0,l.jsx)(u.Z,{className:"mt-6",children:(0,l.jsx)(()=>(0,l.jsxs)(eZ.Z,{direction:"vertical",size:"large",className:"w-full",children:[(0,l.jsxs)("div",{className:"bg-gradient-to-r from-green-50 to-teal-50 p-6 rounded-lg border border-green-100",children:[(0,l.jsxs)("div",{className:"flex items-center gap-3 mb-3",children:[(0,l.jsx)(eL.Z,{className:"text-green-600",size:24}),(0,l.jsx)(eM,{level:4,className:"mb-0 text-green-900",children:"Streamable HTTP Transport"})]}),(0,l.jsx)(eT,{className:"text-green-700",children:"Connect to LiteLLM MCP using HTTP transport. Compatible with any MCP client that supports HTTP streaming."})]}),(0,l.jsx)(eE,{icon:(0,l.jsx)(eL.Z,{className:"text-green-600",size:16}),title:"Universal MCP Connection",description:"Use this URL with any MCP client that supports HTTP transport",children:(0,l.jsxs)(eZ.Z,{direction:"vertical",size:"middle",className:"w-full",children:[(0,l.jsx)("div",{children:(0,l.jsx)(eT,{children:"Each MCP client supports different transports. Refer to your client documentation to determine the appropriate transport method."})}),(0,l.jsx)(j,{title:"Server URL",code:"".concat(r,"/mcp"),copyKey:"http-server-url"}),(0,l.jsx)(j,{title:"Headers Configuration",code:JSON.stringify({"x-litellm-api-key":"Bearer YOUR_LITELLM_API_KEY"},null,2),copyKey:"http-headers"}),(0,l.jsx)("div",{className:"mt-4",children:(0,l.jsx)(B.ZP,{type:"link",className:"p-0 h-auto text-blue-600 hover:text-blue-700",href:"https://modelcontextprotocol.io/docs/concepts/transports",icon:(0,l.jsx)(eP.Z,{size:14}),children:"Learn more about MCP transports"})})]})})]}),{})})]})]})]})})},eq=r(67187);let{Option:eO}=n.default,eR=e=>{let{isModalOpen:s,title:r,confirmDelete:t,cancelDelete:a}=e;return s?(0,l.jsx)(i.Z,{open:s,onOk:t,okType:"danger",onCancel:a,children:(0,l.jsxs)(j.Z,{numItems:1,className:"gap-2 w-full",children:[(0,l.jsx)(v.Z,{children:r}),(0,l.jsx)(p.Z,{numColSpan:1,children:(0,l.jsx)("p",{children:"Are you sure you want to delete this MCP Server?"})})]})}):null};var eU=e=>{let{accessToken:s,userRole:r,userID:i}=e,{data:p,isLoading:j,refetch:b,dataUpdatedAt:y}=(0,a.a)({queryKey:["mcpServers"],queryFn:()=>{if(!s)throw Error("Access Token required");return(0,P.fetchMCPServers)(s)},enabled:!!s});t.useEffect(()=>{p&&(console.log("MCP Servers fetched:",p),p.forEach(e=>{console.log("Server: ".concat(e.server_name||e.server_id)),console.log(" allowed_tools:",e.allowed_tools)}))},[p]);let[N,_]=(0,t.useState)(null),[Z,w]=(0,t.useState)(!1),[C,S]=(0,t.useState)(null),[L,M]=(0,t.useState)(!1),[T,I]=(0,t.useState)("all"),[E,z]=(0,t.useState)("all"),[q,O]=(0,t.useState)([]),[R,U]=(0,t.useState)(!1),F="Internal User"===r,B=t.useMemo(()=>{if(!p)return[];let e=new Set,s=[];return p.forEach(r=>{r.teams&&r.teams.forEach(r=>{let l=r.team_id;e.has(l)||(e.add(l),s.push(r))})}),s},[p]),K=t.useMemo(()=>p?Array.from(new Set(p.flatMap(e=>e.mcp_access_groups).filter(e=>null!=e))):[],[p]),V=e=>{I(e),H(e,E)},D=e=>{z(e),H(T,e)},H=(e,s)=>{if(!p)return O([]);let r=p;if("personal"===e){O([]);return}"all"!==e&&(r=r.filter(s=>{var r;return null===(r=s.teams)||void 0===r?void 0:r.some(s=>s.team_id===e)})),"all"!==s&&(r=r.filter(e=>{var r;return null===(r=e.mcp_access_groups)||void 0===r?void 0:r.some(e=>"string"==typeof e?e===s:e&&e.name===s)})),O(r)};(0,t.useEffect)(()=>{H(T,E)},[y]);let G=t.useMemo(()=>k(null!=r?r:"",e=>{S(e),M(!1)},e=>{S(e),M(!0)},Y),[r]);function Y(e){_(e),w(!0)}let J=async()=>{if(null!=N&&null!=s){try{await (0,P.deleteMCPServer)(s,N),et.Z.success("Deleted MCP Server successfully"),b()}catch(e){console.error("Error deleting the mcp server:",e)}w(!1),_(null)}};return s&&r&&i?(0,l.jsxs)("div",{className:"w-full h-full p-6",children:[(0,l.jsx)(eR,{isModalOpen:Z,title:"Delete MCP Server",confirmDelete:J,cancelDelete:()=>{w(!1),_(null)}}),(0,l.jsx)(eb,{userRole:r,accessToken:s,onCreateSuccess:e=>{O(s=>[...s,e]),U(!1)},isModalVisible:R,setModalVisible:U,availableAccessGroups:K}),(0,l.jsx)(v.Z,{children:"MCP Servers"}),(0,l.jsx)(g.Z,{className:"text-tremor-content mt-2",children:"Configure and manage your MCP servers"}),(0,A.tY)(r)&&(0,l.jsx)(c.Z,{className:"mt-4 mb-4",onClick:()=>U(!0),children:"+ Add New MCP Server"}),(0,l.jsxs)(m.Z,{className:"w-full h-full",children:[(0,l.jsx)(x.Z,{className:"flex justify-between mt-2 w-full items-center",children:(0,l.jsxs)("div",{className:"flex",children:[(0,l.jsx)(d.Z,{children:"All Servers"}),(0,l.jsx)(d.Z,{children:"Connect"})]})}),(0,l.jsxs)(h.Z,{children:[(0,l.jsx)(u.Z,{children:(0,l.jsx)(()=>C?(0,l.jsx)(em,{mcpServer:q.find(e=>e.server_id===C)||{server_id:"",server_name:"",alias:"",url:"",transport:"",auth_type:"",created_at:"",created_by:"",updated_at:"",updated_by:""},onBack:()=>{M(!1),S(null),b()},isProxyAdmin:(0,A.tY)(r),isEditing:L,accessToken:s,userID:i,userRole:r,availableAccessGroups:K}):(0,l.jsxs)("div",{className:"w-full h-full",children:[(0,l.jsx)("div",{className:"w-full px-6",children:(0,l.jsx)("div",{className:"flex flex-col space-y-4",children:(0,l.jsx)("div",{className:"flex items-center justify-between bg-gray-50 rounded-lg p-4 border-2 border-gray-200",children:(0,l.jsxs)("div",{className:"flex items-center gap-4",children:[(0,l.jsx)(g.Z,{className:"text-lg font-semibold text-gray-900",children:"Current Team:"}),(0,l.jsxs)(n.default,{value:T,onChange:V,style:{width:300},children:[(0,l.jsx)(eO,{value:"all",children:(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("div",{className:"w-2 h-2 bg-blue-500 rounded-full"}),(0,l.jsx)("span",{className:"font-medium",children:F?"All Available Servers":"All Servers"})]})}),(0,l.jsx)(eO,{value:"personal",children:(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),(0,l.jsx)("span",{className:"font-medium",children:"Personal"})]})}),B.map(e=>(0,l.jsx)(eO,{value:e.team_id,children:(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),(0,l.jsx)("span",{className:"font-medium",children:e.team_alias||e.team_id})]})},e.team_id))]}),(0,l.jsxs)(g.Z,{className:"text-lg font-semibold text-gray-900 ml-6",children:["Access Group:",(0,l.jsx)(o.Z,{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,l.jsx)(eq.Z,{style:{marginLeft:4,color:"#888"}})})]}),(0,l.jsxs)(n.default,{value:E,onChange:D,style:{width:300},children:[(0,l.jsx)(eO,{value:"all",children:(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("div",{className:"w-2 h-2 bg-blue-500 rounded-full"}),(0,l.jsx)("span",{className:"font-medium",children:"All Access Groups"})]})}),K.map(e=>(0,l.jsx)(eO,{value:e,children:(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),(0,l.jsx)("span",{className:"font-medium",children:e})]})},e))]})]})})})}),(0,l.jsx)("div",{className:"w-full px-6 mt-6",children:(0,l.jsx)(f.w,{data:q,columns:G,renderSubComponent:()=>(0,l.jsx)("div",{}),getRowCanExpand:()=>!1,isLoading:j,noDataMessage:"No MCP servers configured"})})]}),{})}),(0,l.jsx)(u.Z,{children:(0,l.jsx)(ez,{})})]})]})]}):(console.log("Missing required authentication parameters",{accessToken:s,userRole:r,userID:i}),(0,l.jsx)("div",{className:"p-6 text-center text-gray-500",children:"Missing required authentication parameters."}))},eF=r(21770);function eB(e){let{tool:s,needsAuth:r,authValue:a,onSubmit:n,isLoading:i,result:c,error:d,onClose:m}=e,[x]=F.Z.useForm(),[u,h]=t.useState("formatted"),[p,j]=t.useState(null),[g,v]=t.useState(null),f=t.useMemo(()=>"string"==typeof s.inputSchema?{type:"object",properties:{input:{type:"string",description:"Input for this tool"}},required:["input"]}:s.inputSchema,[s.inputSchema]),b=t.useMemo(()=>f.properties&&f.properties.params&&"object"===f.properties.params.type&&f.properties.params.properties?{type:"object",properties:f.properties.params.properties,required:f.properties.params.required||[]}:f,[f]);t.useEffect(()=>{p&&(c||d)&&v(Date.now()-p)},[c,d,p]);let y=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 r=document.execCommand("copy");if(document.body.removeChild(s),!r)throw Error("execCommand failed");return!0}}catch(e){return console.error("Copy failed:",e),!1}},N=async()=>{await y(JSON.stringify(c,null,2))?et.Z.success("Result copied to clipboard"):et.Z.fromBackend("Failed to copy result")},_=async()=>{await y(s.name)?et.Z.success("Tool name copied to clipboard"):et.Z.fromBackend("Failed to copy tool name")};return(0,l.jsxs)("div",{className:"space-y-4 h-full",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between pb-3 border-b border-gray-200",children:[(0,l.jsxs)("div",{className:"flex items-center space-x-3",children:[s.mcp_info.logo_url&&(0,l.jsx)("img",{src:s.mcp_info.logo_url,alt:"".concat(s.mcp_info.server_name," logo"),className:"w-6 h-6 object-contain"}),(0,l.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,l.jsxs)("div",{className:"flex items-center space-x-2 mb-1",children:[(0,l.jsx)("h2",{className:"text-lg font-semibold text-gray-900",children:"Test Tool:"}),(0,l.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:_,title:"Click to copy tool name",children:[(0,l.jsx)("span",{className:"font-mono text-slate-700 font-medium text-sm",children:s.name}),(0,l.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,l.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,l.jsx)("p",{className:"text-xs text-gray-600",children:s.description}),(0,l.jsxs)("p",{className:"text-xs text-gray-500",children:["Provider: ",s.mcp_info.server_name]})]})]}),(0,l.jsx)(ex.z,{onClick:m,variant:"light",size:"sm",className:"text-gray-500 hover:text-gray-700",children:(0,l.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,l.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,l.jsxs)("div",{className:"grid grid-cols-2 gap-4 h-full",children:[(0,l.jsxs)("div",{className:"bg-white border border-gray-200 rounded-lg",children:[(0,l.jsx)("div",{className:"border-b border-gray-100 px-4 py-2",children:(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsx)("h3",{className:"text-sm font-semibold text-gray-900",children:"Input Parameters"}),(0,l.jsx)(o.Z,{title:"Configure the input parameters for this tool call",children:(0,l.jsx)(Y.Z,{className:"text-gray-400 hover:text-gray-600"})})]})}),(0,l.jsx)("div",{className:"p-4",children:(0,l.jsxs)(F.Z,{form:x,onFinish:e=>{j(Date.now()),v(null);let s={};Object.entries(e).forEach(e=>{var r;let[l,t]=e,a=null===(r=b.properties)||void 0===r?void 0:r[l];if(a&&null!=t&&""!==t)switch(a.type){case"boolean":s[l]="true"===t||!0===t;break;case"number":s[l]=Number(t);break;case"string":s[l]=String(t);break;default:s[l]=t}else null!=t&&""!==t&&(s[l]=t)}),n(f.properties&&f.properties.params&&"object"===f.properties.params.type&&f.properties.params.properties?{params:s}:s)},layout:"vertical",className:"space-y-3",children:["string"==typeof s.inputSchema?(0,l.jsx)("div",{className:"space-y-3",children:(0,l.jsx)(F.Z.Item,{label:(0,l.jsxs)("span",{className:"text-sm font-medium text-gray-700",children:["Input ",(0,l.jsx)("span",{className:"text-red-500",children:"*"})]}),name:"input",rules:[{required:!0,message:"Please enter input for this tool"}],className:"mb-3",children:(0,l.jsx)(ex.o,{placeholder:"Enter input for this tool",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})})}):void 0===b.properties?(0,l.jsx)("div",{className:"text-center py-6 bg-gray-50 rounded-lg border border-gray-200",children:(0,l.jsxs)("div",{className:"max-w-sm mx-auto",children:[(0,l.jsx)("h4",{className:"text-sm font-medium text-gray-900 mb-1",children:"No Parameters Required"}),(0,l.jsx)("p",{className:"text-xs text-gray-500",children:"This tool can be called without any input parameters."})]})}):(0,l.jsx)("div",{className:"space-y-3",children:Object.entries(b.properties).map(e=>{var s,r,t,a,n;let[i,c]=e;return(0,l.jsxs)(F.Z.Item,{label:(0,l.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:[i," ",(null===(s=b.required)||void 0===s?void 0:s.includes(i))&&(0,l.jsx)("span",{className:"text-red-500",children:"*"}),c.description&&(0,l.jsx)(o.Z,{title:c.description,children:(0,l.jsx)(Y.Z,{className:"ml-2 text-gray-400 hover:text-gray-600"})})]}),name:i,rules:[{required:null===(r=b.required)||void 0===r?void 0:r.includes(i),message:"Please enter ".concat(i)}],className:"mb-3",children:["string"===c.type&&c.enum&&(0,l.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:c.default,children:[!(null===(t=b.required)||void 0===t?void 0:t.includes(i))&&(0,l.jsxs)("option",{value:"",children:["Select ",i]}),c.enum.map(e=>(0,l.jsx)("option",{value:e,children:e},e))]}),"string"===c.type&&!c.enum&&(0,l.jsx)(ex.o,{placeholder:c.description||"Enter ".concat(i),className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"}),"number"===c.type&&(0,l.jsx)("input",{type:"number",placeholder:c.description||"Enter ".concat(i),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"===c.type&&(0,l.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:(null===(a=c.default)||void 0===a?void 0:a.toString())||"",children:[!(null===(n=b.required)||void 0===n?void 0:n.includes(i))&&(0,l.jsxs)("option",{value:"",children:["Select ",i]}),(0,l.jsx)("option",{value:"true",children:"True"}),(0,l.jsx)("option",{value:"false",children:"False"})]})]},i)})}),(0,l.jsx)("div",{className:"pt-3 border-t border-gray-100",children:(0,l.jsx)(ex.z,{onClick:()=>x.submit(),disabled:i,variant:"primary",className:"w-full",loading:i,children:i?"Calling Tool...":c||d?"Call Again":"Call Tool"})})]})})]}),(0,l.jsxs)("div",{className:"bg-white border border-gray-200 rounded-lg",children:[(0,l.jsx)("div",{className:"border-b border-gray-100 px-4 py-2",children:(0,l.jsx)("h3",{className:"text-sm font-semibold text-gray-900",children:"Tool Result"})}),(0,l.jsx)("div",{className:"p-4",children:c||d||i?(0,l.jsxs)("div",{className:"space-y-3",children:[c&&!i&&!d&&(0,l.jsx)("div",{className:"p-2 bg-green-50 border border-green-200 rounded-lg",children:(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,l.jsx)("svg",{className:"h-4 w-4 text-green-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,l.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,l.jsx)("h4",{className:"text-xs font-medium text-green-900",children:"Tool executed successfully"}),null!==g&&(0,l.jsxs)("span",{className:"text-xs text-green-600 ml-1",children:["• ",(g/1e3).toFixed(2),"s"]})]}),(0,l.jsxs)("div",{className:"flex items-center space-x-1",children:[(0,l.jsxs)("div",{className:"flex bg-white rounded border border-green-300 p-0.5",children:[(0,l.jsx)("button",{onClick:()=>h("formatted"),className:"px-2 py-1 text-xs font-medium rounded transition-colors ".concat("formatted"===u?"bg-green-100 text-green-800":"text-green-600 hover:text-green-800"),children:"Formatted"}),(0,l.jsx)("button",{onClick:()=>h("json"),className:"px-2 py-1 text-xs font-medium rounded transition-colors ".concat("json"===u?"bg-green-100 text-green-800":"text-green-600 hover:text-green-800"),children:"JSON"})]}),(0,l.jsx)("button",{onClick:N,className:"p-1 hover:bg-green-100 rounded text-green-700",title:"Copy response",children:(0,l.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,l.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),(0,l.jsx)("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})})]})]})}),(0,l.jsxs)("div",{className:"max-h-96 overflow-y-auto",children:[i&&(0,l.jsxs)("div",{className:"flex flex-col justify-center items-center h-48 text-gray-500",children:[(0,l.jsxs)("div",{className:"relative",children:[(0,l.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-2 border-gray-200"}),(0,l.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-2 border-blue-600 border-t-transparent absolute top-0"})]}),(0,l.jsx)("p",{className:"text-sm font-medium mt-3",children:"Calling tool..."}),(0,l.jsx)("p",{className:"text-xs text-gray-400 mt-1",children:"Please wait while we process your request"})]}),d&&(0,l.jsx)("div",{className:"bg-red-50 border border-red-200 rounded-lg p-3",children:(0,l.jsxs)("div",{className:"flex items-start space-x-2",children:[(0,l.jsx)("div",{className:"flex-shrink-0",children:(0,l.jsx)("svg",{className:"h-4 w-4 text-red-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,l.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,l.jsxs)("div",{className:"flex-1",children:[(0,l.jsxs)("div",{className:"flex items-center space-x-2 mb-1",children:[(0,l.jsx)("h4",{className:"text-xs font-medium text-red-900",children:"Tool Call Failed"}),null!==g&&(0,l.jsxs)("span",{className:"text-xs text-red-600",children:["• ",(g/1e3).toFixed(2),"s"]})]}),(0,l.jsx)("div",{className:"bg-white border border-red-200 rounded p-2 max-h-48 overflow-y-auto",children:(0,l.jsx)("pre",{className:"text-xs whitespace-pre-wrap text-red-700 font-mono",children:d.message})})]})]})}),c&&!i&&!d&&(0,l.jsx)("div",{className:"space-y-3",children:"formatted"===u?c.map((e,s)=>(0,l.jsxs)("div",{className:"border border-gray-200 rounded-lg overflow-hidden",children:["text"===e.type&&(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{className:"bg-gray-50 px-3 py-1 border-b border-gray-200",children:(0,l.jsx)("span",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:"Text Response"})}),(0,l.jsx)("div",{className:"p-3",children:(0,l.jsx)("div",{className:"bg-white rounded border border-gray-200 max-h-64 overflow-y-auto",children:(0,l.jsx)("div",{className:"p-3 space-y-2",children:e.text.split("\n\n").map((e,s)=>{if(""===e.trim())return null;if(e.startsWith("##")){let r=e.replace(/^#+\s/,"");return(0,l.jsx)("div",{className:"border-b border-gray-200 pb-1 mb-2",children:(0,l.jsx)("h3",{className:"text-sm font-semibold text-gray-900",children:r})},s)}let r=/(https?:\/\/[^\s\)]+)/g;if(r.test(e)){let t=e.split(r);return(0,l.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded p-2",children:(0,l.jsx)("div",{className:"text-xs text-gray-700 leading-relaxed whitespace-pre-wrap",children:t.map((e,s)=>r.test(e)?(0,l.jsx)("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-800 underline break-all",children:e},s):e)})},s)}return e.includes("Score:")?(0,l.jsx)("div",{className:"bg-green-50 border-l-4 border-green-400 p-2 rounded-r",children:(0,l.jsx)("p",{className:"text-xs text-green-800 font-medium whitespace-pre-wrap",children:e})},s):(0,l.jsx)("div",{className:"bg-gray-50 rounded p-2 border border-gray-200",children:(0,l.jsx)("div",{className:"text-xs text-gray-700 leading-relaxed whitespace-pre-wrap font-mono",children:e})},s)}).filter(Boolean)})})})]}),"image"===e.type&&e.url&&(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{className:"bg-gray-50 px-3 py-1 border-b border-gray-200",children:(0,l.jsx)("span",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:"Image Response"})}),(0,l.jsx)("div",{className:"p-3",children:(0,l.jsx)("div",{className:"bg-gray-50 rounded p-3 border border-gray-200",children:(0,l.jsx)("img",{src:e.url,alt:"Tool result",className:"max-w-full h-auto rounded shadow-sm"})})})]}),"embedded_resource"===e.type&&(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{className:"bg-gray-50 px-3 py-1 border-b border-gray-200",children:(0,l.jsx)("span",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:"Embedded Resource"})}),(0,l.jsx)("div",{className:"p-3",children:(0,l.jsxs)("div",{className:"flex items-center space-x-2 p-3 bg-blue-50 border border-blue-200 rounded",children:[(0,l.jsx)("div",{className:"flex-shrink-0",children:(0,l.jsx)("svg",{className:"h-5 w-5 text-blue-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,l.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,l.jsxs)("div",{className:"flex-1",children:[(0,l.jsxs)("p",{className:"text-xs font-medium text-blue-900",children:["Resource Type: ",e.resource_type]}),e.url&&(0,l.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,l.jsxs)("svg",{className:"ml-1 h-3 w-3",fill:"currentColor",viewBox:"0 0 20 20",children:[(0,l.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,l.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"})]})]})]})]})})]})]},s)):(0,l.jsx)("div",{className:"bg-white rounded border border-gray-200",children:(0,l.jsx)("div",{className:"p-3 overflow-auto max-h-80 bg-gray-50",children:(0,l.jsx)("pre",{className:"text-xs font-mono whitespace-pre-wrap break-all text-gray-800",children:JSON.stringify(c,null,2)})})})})]})]}):(0,l.jsx)("div",{className:"flex flex-col justify-center items-center h-48 text-gray-500",children:(0,l.jsxs)("div",{className:"text-center max-w-sm",children:[(0,l.jsx)("div",{className:"mb-3",children:(0,l.jsx)("svg",{className:"mx-auto h-12 w-12 text-gray-300",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,l.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1,d:"M13 10V3L4 14h7v7l9-11h-7z"})})}),(0,l.jsx)("h4",{className:"text-sm font-medium text-gray-900 mb-1",children:"Ready to Call Tool"}),(0,l.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 eK=r(29488),eV=r(36724),eD=r(57400),eH=r(69993);let eG=e=>{let s,{visible:r,onOk:t,onCancel:a,authType:n}=e,[o]=F.Z.useForm();if(n===z.API_KEY||n===z.BEARER_TOKEN){let e=n===z.API_KEY?"API Key":"Bearer Token";s=(0,l.jsx)(F.Z.Item,{name:"authValue",label:e,rules:[{required:!0,message:"Please input your ".concat(e)}],children:(0,l.jsx)(eg.default.Password,{})})}else n===z.BASIC&&(s=(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(F.Z.Item,{name:"username",label:"Username",rules:[{required:!0,message:"Please input your username"}],children:(0,l.jsx)(eg.default,{})}),(0,l.jsx)(F.Z.Item,{name:"password",label:"Password",rules:[{required:!0,message:"Please input your password"}],children:(0,l.jsx)(eg.default.Password,{})})]}));return(0,l.jsx)(i.Z,{open:r,title:"Authentication",onOk:()=>{o.validateFields().then(e=>{n===z.BASIC?t("".concat(e.username.trim(),":").concat(e.password.trim())):t(e.authValue.trim())})},onCancel:a,destroyOnClose:!0,children:(0,l.jsx)(F.Z,{form:o,layout:"vertical",children:s})})},eY=e=>{let{authType:s,onAuthSubmit:r,onClearAuth:a,hasAuth:n}=e,[i,o]=(0,t.useState)(!1);return(0,l.jsxs)("div",{className:"space-y-3",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsxs)(eV.xv,{className:"text-sm font-medium text-gray-700",children:["Authentication ",n?"✓":""]}),(0,l.jsxs)("div",{className:"flex gap-2",children:[n&&(0,l.jsx)(eV.zx,{onClick:()=>{a()},size:"sm",variant:"secondary",className:"text-xs text-red-600 hover:text-red-700",children:"Clear"}),(0,l.jsx)(eV.zx,{onClick:()=>o(!0),size:"sm",variant:"secondary",className:"text-xs",children:n?"Update":"Add Auth"})]})]}),(0,l.jsx)(eV.xv,{className:"text-xs text-gray-500",children:n?"Authentication configured and saved locally":"Some tools may require authentication"}),(0,l.jsx)(eG,{visible:i,onOk:e=>{r(e),o(!1)},onCancel:()=>o(!1),authType:s})]})};var eJ=e=>{let{serverId:s,accessToken:r,auth_type:n,userRole:i,userID:o,serverAlias:c}=e,[d,m]=(0,t.useState)(""),[x,u]=(0,t.useState)(null),[h,p]=(0,t.useState)(null),[j,g]=(0,t.useState)(null);(0,t.useEffect)(()=>{if(U(n)){let e=(0,eK.Ui)(s,c||void 0);e&&m(e)}},[s,c,n]);let v=e=>{m(e),e&&U(n)&&((0,eK.Hc)(s,e,n||"none",c||void 0),et.Z.success("Authentication token saved locally"))},f=()=>{m(""),(0,eK.e4)(s),et.Z.info("Authentication token cleared")},{data:b,isLoading:y,error:N}=(0,a.a)({queryKey:["mcpTools",s,d,c],queryFn:()=>{if(!r)throw Error("Access Token required");return(0,P.listMCPTools)(r,s,d,c||void 0)},enabled:!!r,staleTime:3e4}),{mutate:_,isPending:Z}=(0,eF.D)({mutationFn:async e=>{if(!r)throw Error("Access Token required");try{return await (0,P.callMCPTool)(r,e.tool.name,e.arguments,e.authValue,c||void 0)}catch(e){throw e}},onSuccess:e=>{p(e),g(null)},onError:e=>{g(e),p(null)}}),w=(null==b?void 0:b.tools)||[],C=""!==d;return(0,l.jsx)("div",{className:"w-full h-screen p-4 bg-white",children:(0,l.jsx)(eV.Zb,{className:"w-full rounded-xl shadow-md overflow-hidden",children:(0,l.jsxs)("div",{className:"flex h-auto w-full gap-4",children:[(0,l.jsxs)("div",{className:"w-1/4 p-4 bg-gray-50 flex flex-col",children:[(0,l.jsx)(eV.Dx,{className:"text-xl font-semibold mb-6 mt-2",children:"MCP Tools"}),(0,l.jsxs)("div",{className:"flex flex-col flex-1",children:[(0,l.jsxs)("div",{className:"flex flex-col flex-1 min-h-0",children:[(0,l.jsxs)(eV.xv,{className:"font-medium block mb-3 text-gray-700 flex items-center",children:[(0,l.jsx)(J.Z,{className:"mr-2"})," Available Tools",w.length>0&&(0,l.jsx)("span",{className:"ml-2 bg-blue-100 text-blue-800 text-xs font-medium px-2 py-0.5 rounded-full",children:w.length})]}),y&&(0,l.jsxs)("div",{className:"flex flex-col items-center justify-center py-8 bg-white border border-gray-200 rounded-lg",children:[(0,l.jsxs)("div",{className:"relative mb-3",children:[(0,l.jsx)("div",{className:"animate-spin rounded-full h-6 w-6 border-2 border-gray-200"}),(0,l.jsx)("div",{className:"animate-spin rounded-full h-6 w-6 border-2 border-blue-600 border-t-transparent absolute top-0"})]}),(0,l.jsx)("p",{className:"text-xs font-medium text-gray-700",children:"Loading tools..."})]}),(null==b?void 0:b.error)&&!y&&!w.length&&(0,l.jsx)("div",{className:"p-3 text-xs text-red-800 rounded-lg bg-red-50 border border-red-200",children:(0,l.jsxs)("p",{className:"font-medium",children:["Error: ",b.message]})}),!y&&!(null==b?void 0:b.error)&&(!w||0===w.length)&&(0,l.jsxs)("div",{className:"p-4 text-center bg-white border border-gray-200 rounded-lg",children:[(0,l.jsx)("div",{className:"mx-auto w-8 h-8 bg-gray-200 rounded-full flex items-center justify-center mb-2",children:(0,l.jsx)("svg",{className:"w-4 h-4 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,l.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,l.jsx)("p",{className:"text-xs font-medium text-gray-700 mb-1",children:"No tools available"}),(0,l.jsx)("p",{className:"text-xs text-gray-500",children:"No tools found for this server"})]}),!y&&!(null==b?void 0:b.error)&&w.length>0&&(0,l.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:w.map(e=>(0,l.jsxs)("div",{className:"border rounded-lg p-3 cursor-pointer transition-all hover:shadow-sm ".concat((null==x?void 0:x.name)===e.name?"border-blue-500 bg-blue-50 ring-1 ring-blue-200":"border-gray-200 bg-white hover:border-gray-300"),onClick:()=>{u(e),p(null),g(null)},children:[(0,l.jsxs)("div",{className:"flex items-start space-x-2",children:[e.mcp_info.logo_url&&(0,l.jsx)("img",{src:e.mcp_info.logo_url,alt:"".concat(e.mcp_info.server_name," logo"),className:"w-4 h-4 object-contain flex-shrink-0 mt-0.5"}),(0,l.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,l.jsx)("h4",{className:"font-mono text-xs font-medium text-gray-900 truncate",children:e.name}),(0,l.jsx)("p",{className:"text-xs text-gray-500 truncate",children:e.mcp_info.server_name}),(0,l.jsx)("p",{className:"text-xs text-gray-600 mt-1 line-clamp-2 leading-relaxed",children:e.description})]})]}),(null==x?void 0:x.name)===e.name&&(0,l.jsx)("div",{className:"mt-2 pt-2 border-t border-blue-200",children:(0,l.jsxs)("div",{className:"flex items-center text-xs font-medium text-blue-700",children:[(0,l.jsx)("svg",{className:"w-3 h-3 mr-1",fill:"currentColor",viewBox:"0 0 20 20",children:(0,l.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))})]}),U(n)&&(0,l.jsx)("div",{className:"pt-4 border-t border-gray-200 flex-shrink-0 mt-6",children:C?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(eV.xv,{className:"font-medium block mb-3 text-gray-700 flex items-center",children:[(0,l.jsx)(eD.Z,{className:"mr-2"})," Authentication"]}),(0,l.jsx)(eY,{authType:n,onAuthSubmit:v,onClearAuth:f,hasAuth:C})]}):(0,l.jsxs)("div",{className:"p-4 bg-gradient-to-r from-orange-50 to-red-50 border border-orange-200 rounded-lg",children:[(0,l.jsxs)("div",{className:"flex items-center mb-3",children:[(0,l.jsx)(eD.Z,{className:"mr-2 text-orange-600 text-lg"}),(0,l.jsx)(eV.xv,{className:"font-semibold text-orange-800",children:"Authentication Required"})]}),(0,l.jsx)(eV.xv,{className:"text-sm text-orange-700 mb-4",children:"This MCP server requires authentication. You must add your credentials below to access the tools."}),(0,l.jsx)(eY,{authType:n,onAuthSubmit:v,onClearAuth:f,hasAuth:C})]})})]})]}),(0,l.jsxs)("div",{className:"w-3/4 flex flex-col bg-white",children:[(0,l.jsx)("div",{className:"p-4 border-b border-gray-200 flex justify-between items-center",children:(0,l.jsx)(eV.Dx,{className:"text-xl font-semibold mb-0",children:"Tool Testing Playground"})}),(0,l.jsx)("div",{className:"flex-1 overflow-auto p-4",children:x?(0,l.jsx)("div",{className:"h-full",children:(0,l.jsx)(eB,{tool:x,needsAuth:U(n),authValue:d,onSubmit:e=>{_({tool:x,arguments:e,authValue:d})},result:h,error:j,isLoading:Z,onClose:()=>u(null)})}):(0,l.jsxs)("div",{className:"h-full flex flex-col items-center justify-center text-gray-400",children:[(0,l.jsx)(eH.Z,{style:{fontSize:"48px",marginBottom:"16px"}}),(0,l.jsx)(eV.xv,{className:"text-lg font-medium text-gray-600 mb-2",children:"Select a Tool to Test"}),(0,l.jsx)(eV.xv,{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."})]})})]})]})})})}}}]);
\ No newline at end of file
diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/3298-f271bfaa40544a40.js b/litellm/proxy/_experimental/out/_next/static/chunks/3298-f271bfaa40544a40.js
deleted file mode 100644
index 5b953a5bdf6..00000000000
--- a/litellm/proxy/_experimental/out/_next/static/chunks/3298-f271bfaa40544a40.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3298],{1309:function(e,l,a){a.d(l,{C:function(){return r.Z}});var r=a(41649)},63298:function(e,l,a){a.d(l,{Z:function(){return eG}});var r,i,t=a(57437),s=a(2265),n=a(16312),o=a(82680),d=a(19250),c=a(93192),u=a(52787),m=a(91810),p=a(13634),g=a(3810),x=a(64504);(r=i||(i={})).PresidioPII="Presidio PII",r.Bedrock="Bedrock Guardrail",r.Lakera="Lakera";let h={},f=e=>{let l={};return l.PresidioPII="Presidio PII",l.Bedrock="Bedrock Guardrail",l.Lakera="Lakera",Object.entries(e).forEach(e=>{let[a,r]=e;r&&"object"==typeof r&&"ui_friendly_name"in r&&(l[a.split("_").map((e,l)=>e.charAt(0).toUpperCase()+e.slice(1)).join("")]=r.ui_friendly_name)}),h=l,l},j=()=>Object.keys(h).length>0?h:i,v={PresidioPII:"presidio",Bedrock:"bedrock",Lakera:"lakera_v2"},_=e=>{Object.entries(e).forEach(e=>{let[l,a]=e;a&&"object"==typeof a&&"ui_friendly_name"in a&&(v[l.split("_").map((e,l)=>e.charAt(0).toUpperCase()+e.slice(1)).join("")]=l)})},y=e=>!!e&&"Presidio PII"===j()[e],b="../ui/assets/logos/",N={"Presidio PII":"".concat(b,"presidio.png"),"Bedrock Guardrail":"".concat(b,"bedrock.svg"),Lakera:"".concat(b,"lakeraai.jpeg"),"Azure Content Safety Prompt Shield":"".concat(b,"presidio.png"),"Azure Content Safety Text Moderation":"".concat(b,"presidio.png"),"Aporia AI":"".concat(b,"aporia.png"),"PANW Prisma AIRS":"".concat(b,"palo_alto_networks.jpeg"),"Noma Security":"".concat(b,"noma_security.png"),"Javelin Guardrails":"".concat(b,"javelin.png"),"Pillar Guardrail":"".concat(b,"pillar.jpeg"),"Google Cloud Model Armor":"".concat(b,"google.svg"),"Guardrails AI":"".concat(b,"guardrails_ai.jpeg"),"Lasso Guardrail":"".concat(b,"lasso.png"),"Pangea Guardrail":"".concat(b,"pangea.png"),"AIM Guardrail":"".concat(b,"aim_security.jpeg"),"OpenAI Moderation":"".concat(b,"openai_small.svg"),EnkryptAI:"".concat(b,"enkrypt_ai.avif")},S=e=>{if(!e)return{logo:"",displayName:"-"};let l=Object.keys(v).find(l=>v[l].toLowerCase()===e.toLowerCase());if(!l)return{logo:"",displayName:e};let a=j()[l];return{logo:N[a]||"",displayName:a||e}};var k=a(33866),w=a(89970),I=a(73002),P=a(61994),Z=a(97416),C=a(8881),O=a(10798),A=a(49638);let{Text:E}=c.default,{Option:G}=u.default,L=e=>e.replace(/_/g," "),F=e=>{switch(e){case"MASK":return(0,t.jsx)(Z.Z,{style:{marginRight:4}});case"BLOCK":return(0,t.jsx)(C.Z,{style:{marginRight:4}});default:return null}},z=e=>{let{categories:l,selectedCategories:a,onChange:r}=e;return(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center mb-2",children:[(0,t.jsx)(O.Z,{className:"text-gray-500 mr-1"}),(0,t.jsx)(E,{className:"text-gray-500 font-medium",children:"Filter by category"})]}),(0,t.jsx)(u.default,{mode:"multiple",placeholder:"Select categories to filter by",style:{width:"100%"},onChange:r,value:a,allowClear:!0,showSearch:!0,optionFilterProp:"children",className:"mb-4",tagRender:e=>(0,t.jsx)(g.Z,{color:"blue",closable:e.closable,onClose:e.onClose,className:"mr-2 mb-2",children:e.label}),children:l.map(e=>(0,t.jsx)(G,{value:e.category,children:e.category},e.category))})]})},T=e=>{let{onSelectAll:l,onUnselectAll:a,hasSelectedEntities:r}=e;return(0,t.jsxs)("div",{className:"bg-gray-50 p-5 rounded-lg mb-6 border border-gray-200 shadow-sm",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)(E,{strong:!0,className:"text-gray-700 text-base",children:"Quick Actions"}),(0,t.jsx)(w.Z,{title:"Apply action to all PII types at once",children:(0,t.jsx)("div",{className:"ml-2 text-gray-400 cursor-help text-xs",children:"ⓘ"})})]}),(0,t.jsx)(I.ZP,{type:"default",onClick:a,disabled:!r,icon:(0,t.jsx)(A.Z,{}),className:"border-gray-300 hover:text-red-600 hover:border-red-300",children:"Unselect All"})]}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsx)(I.ZP,{type:"default",onClick:()=>l("MASK"),className:"flex items-center justify-center h-10 border-blue-200 hover:border-blue-300 hover:text-blue-700 bg-blue-50 hover:bg-blue-100 text-blue-600",block:!0,icon:(0,t.jsx)(Z.Z,{}),children:"Select All & Mask"}),(0,t.jsx)(I.ZP,{type:"default",onClick:()=>l("BLOCK"),className:"flex items-center justify-center h-10 border-red-200 hover:border-red-300 hover:text-red-700 bg-red-50 hover:bg-red-100 text-red-600",block:!0,icon:(0,t.jsx)(C.Z,{}),children:"Select All & Block"})]})]})},M=e=>{let{entities:l,selectedEntities:a,selectedActions:r,actions:i,onEntitySelect:s,onActionSelect:n,entityToCategoryMap:o}=e;return(0,t.jsxs)("div",{className:"border rounded-lg overflow-hidden shadow-sm",children:[(0,t.jsxs)("div",{className:"bg-gray-50 px-5 py-3 border-b flex",children:[(0,t.jsx)(E,{strong:!0,className:"flex-1 text-gray-700",children:"PII Type"}),(0,t.jsx)(E,{strong:!0,className:"w-32 text-right text-gray-700",children:"Action"})]}),(0,t.jsx)("div",{className:"max-h-[400px] overflow-y-auto",children:0===l.length?(0,t.jsx)("div",{className:"py-10 text-center text-gray-500",children:"No PII types match your filter criteria"}):l.map(e=>(0,t.jsxs)("div",{className:"px-5 py-3 flex items-center justify-between hover:bg-gray-50 border-b ".concat(a.includes(e)?"bg-blue-50":""),children:[(0,t.jsxs)("div",{className:"flex items-center flex-1",children:[(0,t.jsx)(P.Z,{checked:a.includes(e),onChange:()=>s(e),className:"mr-3"}),(0,t.jsx)(E,{className:a.includes(e)?"font-medium text-gray-900":"text-gray-700",children:L(e)}),o.get(e)&&(0,t.jsx)(g.Z,{className:"ml-2 text-xs",color:"blue",children:o.get(e)})]}),(0,t.jsx)("div",{className:"w-32",children:(0,t.jsx)(u.default,{value:a.includes(e)&&r[e]||"MASK",onChange:l=>n(e,l),style:{width:120},disabled:!a.includes(e),className:"".concat(a.includes(e)?"":"opacity-50"),dropdownMatchSelectWidth:!1,children:i.map(e=>(0,t.jsx)(G,{value:e,children:(0,t.jsxs)("div",{className:"flex items-center",children:[F(e),e]})},e))})})]},e))})]})},{Title:B,Text:J}=c.default;var D=e=>{let{entities:l,actions:a,selectedEntities:r,selectedActions:i,onEntitySelect:n,onActionSelect:o,entityCategories:d=[]}=e,[c,u]=(0,s.useState)([]),m=new Map;d.forEach(e=>{e.entities.forEach(l=>{m.set(l,e.category)})});let p=l.filter(e=>0===c.length||c.includes(m.get(e)||""));return(0,t.jsxs)("div",{className:"pii-configuration",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-5",children:[(0,t.jsx)("div",{className:"flex items-center",children:(0,t.jsx)(B,{level:4,className:"mb-0 font-semibold text-gray-800",children:"Configure PII Protection"})}),(0,t.jsx)(k.Z,{count:r.length,showZero:!0,style:{backgroundColor:r.length>0?"#4f46e5":"#d9d9d9"},overflowCount:999,children:(0,t.jsxs)(J,{className:"text-gray-500",children:[r.length," items selected"]})})]}),(0,t.jsxs)("div",{className:"mb-6",children:[(0,t.jsx)(z,{categories:d,selectedCategories:c,onChange:u}),(0,t.jsx)(T,{onSelectAll:e=>{l.forEach(l=>{r.includes(l)||n(l),o(l,e)})},onUnselectAll:()=>{r.forEach(e=>{n(e)})},hasSelectedEntities:r.length>0})]}),(0,t.jsx)(M,{entities:p,selectedEntities:r,selectedActions:i,actions:a,onEntitySelect:n,onActionSelect:o,entityToCategoryMap:m})]})},V=a(87908),K=a(31283),R=a(24199),U=e=>{var l;let{selectedProvider:a,accessToken:r,providerParams:i=null,value:n=null}=e,[o,c]=(0,s.useState)(!1),[m,g]=(0,s.useState)(i),[x,h]=(0,s.useState)(null);if((0,s.useEffect)(()=>{if(i){g(i);return}let e=async()=>{if(r){c(!0),h(null);try{let e=await (0,d.getGuardrailProviderSpecificParams)(r);console.log("Provider params API response:",e),g(e),f(e),_(e)}catch(e){console.error("Error fetching provider params:",e),h("Failed to load provider parameters")}finally{c(!1)}}};i||e()},[r,i]),!a)return null;if(o)return(0,t.jsx)(V.Z,{tip:"Loading provider parameters..."});if(x)return(0,t.jsx)("div",{className:"text-red-500",children:x});let j=null===(l=v[a])||void 0===l?void 0:l.toLowerCase(),y=m&&m[j];if(console.log("Provider key:",j),console.log("Provider fields:",y),!y||0===Object.keys(y).length)return(0,t.jsx)("div",{children:"No configuration fields available for this provider."});console.log("Value:",n);let b=function(e){let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",a=arguments.length>2?arguments[2]:void 0;return Object.entries(e).map(e=>{let[r,i]=e,s=l?"".concat(l,".").concat(r):r,o=a?a[r]:null==n?void 0:n[r];return(console.log("Field value:",o),"ui_friendly_name"===r||"optional_params"===r&&"nested"===i.type&&i.fields)?null:"nested"===i.type&&i.fields?(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"mb-2 font-medium",children:r}),(0,t.jsx)("div",{className:"ml-4 border-l-2 border-gray-200 pl-4",children:b(i.fields,s,o)})]},s):(0,t.jsx)(p.Z.Item,{name:s,label:r,tooltip:i.description,rules:i.required?[{required:!0,message:"".concat(r," is required")}]:void 0,children:"select"===i.type&&i.options?(0,t.jsx)(u.default,{placeholder:i.description,defaultValue:o||i.default_value,children:i.options.map(e=>(0,t.jsx)(u.default.Option,{value:e,children:e},e))}):"multiselect"===i.type&&i.options?(0,t.jsx)(u.default,{mode:"multiple",placeholder:i.description,defaultValue:o||i.default_value,children:i.options.map(e=>(0,t.jsx)(u.default.Option,{value:e,children:e},e))}):"bool"===i.type||"boolean"===i.type?(0,t.jsxs)(u.default,{placeholder:i.description,defaultValue:void 0!==o?String(o):i.default_value,children:[(0,t.jsx)(u.default.Option,{value:"true",children:"True"}),(0,t.jsx)(u.default.Option,{value:"false",children:"False"})]}):"number"===i.type?(0,t.jsx)(R.Z,{step:1,width:400,placeholder:i.description,defaultValue:void 0!==o?Number(o):void 0}):r.includes("password")||r.includes("secret")||r.includes("key")?(0,t.jsx)(K.o,{placeholder:i.description,type:"password",defaultValue:o||""}):(0,t.jsx)(K.o,{placeholder:i.description,type:"text",defaultValue:o||""})},s)})};return(0,t.jsx)(t.Fragment,{children:b(y)})};let{Title:q}=c.default,H=e=>{let{field:l,fieldKey:a,fullFieldKey:r,value:i}=e,[n,o]=s.useState([]),[d,c]=s.useState(l.dict_key_options||[]);s.useEffect(()=>{if(i&&"object"==typeof i){let e=Object.keys(i);o(e.map(e=>({key:e,id:"".concat(e,"_").concat(Date.now(),"_").concat(Math.random())}))),c((l.dict_key_options||[]).filter(l=>!e.includes(l)))}},[i,l.dict_key_options]);let m=e=>{e&&(o([...n,{key:e,id:"".concat(e,"_").concat(Date.now())}]),c(d.filter(l=>l!==e)))},g=(e,l)=>{o(n.filter(l=>l.id!==e)),c([...d,l].sort())};return(0,t.jsxs)("div",{className:"space-y-3",children:[n.map(e=>(0,t.jsxs)("div",{className:"flex items-center space-x-3 p-3 border rounded-lg",children:[(0,t.jsx)("div",{className:"w-24 font-medium text-sm",children:e.key}),(0,t.jsx)("div",{className:"flex-1",children:(0,t.jsx)(p.Z.Item,{name:Array.isArray(r)?[...r,e.key]:[r,e.key],style:{marginBottom:0},initialValue:i&&"object"==typeof i?i[e.key]:void 0,normalize:"number"===l.dict_value_type?e=>{if(null==e||""===e)return;let l=Number(e);return isNaN(l)?e:l}:void 0,children:"number"===l.dict_value_type?(0,t.jsx)(R.Z,{step:1,width:200,placeholder:"Enter ".concat(e.key," value")}):"boolean"===l.dict_value_type?(0,t.jsxs)(u.default,{placeholder:"Select ".concat(e.key," value"),children:[(0,t.jsx)(u.default.Option,{value:!0,children:"True"}),(0,t.jsx)(u.default.Option,{value:!1,children:"False"})]}):(0,t.jsx)(K.o,{placeholder:"Enter ".concat(e.key," value"),type:"text"})})}),(0,t.jsx)("button",{type:"button",className:"text-red-500 hover:text-red-700 text-sm",onClick:()=>g(e.id,e.key),children:"Remove"})]},e.id)),d.length>0&&(0,t.jsxs)("div",{className:"flex items-center space-x-3 mt-2",children:[(0,t.jsx)(u.default,{placeholder:"Select category to configure",style:{width:200},onSelect:e=>e&&m(e),value:void 0,children:d.map(e=>(0,t.jsx)(u.default.Option,{value:e,children:e},e))}),(0,t.jsx)("span",{className:"text-sm text-gray-500",children:"Select a category to add threshold configuration"})]})]})};var Y=e=>{let{optionalParams:l,parentFieldKey:a,values:r}=e,i=(e,l)=>{let i="".concat(a,".").concat(e),s=null==r?void 0:r[e];return(console.log("value",s),"dict"===l.type&&l.dict_key_options)?(0,t.jsxs)("div",{className:"mb-8 p-6 bg-gray-50 rounded-lg border border-gray-200",children:[(0,t.jsx)("div",{className:"mb-4 font-medium text-gray-900 text-base",children:e}),(0,t.jsx)("p",{className:"text-sm text-gray-600 mb-4",children:l.description}),(0,t.jsx)(H,{field:l,fieldKey:e,fullFieldKey:[a,e],value:s})]},i):(0,t.jsx)("div",{className:"mb-8 p-6 bg-white rounded-lg border border-gray-200 shadow-sm",children:(0,t.jsx)(p.Z.Item,{name:[a,e],label:(0,t.jsxs)("div",{className:"mb-2",children:[(0,t.jsx)("div",{className:"font-medium text-gray-900 text-base",children:e}),(0,t.jsx)("p",{className:"text-sm text-gray-600 mt-1",children:l.description})]}),rules:l.required?[{required:!0,message:"".concat(e," is required")}]:void 0,className:"mb-0",initialValue:void 0!==s?s:l.default_value,normalize:"number"===l.type?e=>{if(null==e||""===e)return;let l=Number(e);return isNaN(l)?e:l}:void 0,children:"select"===l.type&&l.options?(0,t.jsx)(u.default,{placeholder:l.description,children:l.options.map(e=>(0,t.jsx)(u.default.Option,{value:e,children:e},e))}):"multiselect"===l.type&&l.options?(0,t.jsx)(u.default,{mode:"multiple",placeholder:l.description,children:l.options.map(e=>(0,t.jsx)(u.default.Option,{value:e,children:e},e))}):"bool"===l.type||"boolean"===l.type?(0,t.jsxs)(u.default,{placeholder:l.description,children:[(0,t.jsx)(u.default.Option,{value:"true",children:"True"}),(0,t.jsx)(u.default.Option,{value:"false",children:"False"})]}):"number"===l.type?(0,t.jsx)(R.Z,{step:1,width:400,placeholder:l.description}):e.includes("password")||e.includes("secret")||e.includes("key")?(0,t.jsx)(K.o,{placeholder:l.description,type:"password"}):(0,t.jsx)(K.o,{placeholder:l.description,type:"text"})})},i)};return l.fields&&0!==Object.keys(l.fields).length?(0,t.jsxs)("div",{className:"guardrail-optional-params",children:[(0,t.jsxs)("div",{className:"mb-8 pb-4 border-b border-gray-100",children:[(0,t.jsx)(q,{level:3,className:"mb-2 font-semibold text-gray-900",children:"Optional Parameters"}),(0,t.jsx)("p",{className:"text-gray-600 text-sm",children:l.description||"Configure additional settings for this guardrail provider"})]}),(0,t.jsx)("div",{className:"space-y-8",children:Object.entries(l.fields).map(e=>{let[l,a]=e;return i(l,a)})})]}):null},Q=a(9114);let{Title:W,Text:X,Link:$}=c.default,{Option:ee}=u.default,{Step:el}=m.default,ea={pre_call:"Before LLM Call - Runs before the LLM call and checks the input (Recommended)",during_call:"During LLM Call - Runs in parallel with the LLM call, with response held until check completes",post_call:"After LLM Call - Runs after the LLM call and checks only the output",logging_only:"Logging Only - Only runs on logging callbacks without affecting the LLM call",pre_mcp_call:"Before MCP Tool Call - Runs before MCP tool execution and validates tool calls",during_mcp_call:"During MCP Tool Call - Runs in parallel with MCP tool execution for monitoring"};var er=e=>{let{visible:l,onClose:a,accessToken:r,onSuccess:i}=e,[n]=p.Z.useForm(),[c,h]=(0,s.useState)(!1),[b,S]=(0,s.useState)(null),[k,w]=(0,s.useState)(null),[I,P]=(0,s.useState)([]),[Z,C]=(0,s.useState)({}),[O,A]=(0,s.useState)(0),[E,G]=(0,s.useState)(null),[L,F]=(0,s.useState)([]),[z,T]=(0,s.useState)(2),[M,B]=(0,s.useState)({});(0,s.useEffect)(()=>{r&&(async()=>{try{let[e,l]=await Promise.all([(0,d.getGuardrailUISettings)(r),(0,d.getGuardrailProviderSpecificParams)(r)]);w(e),G(l),f(l),_(l)}catch(e){console.error("Error fetching guardrail data:",e),Q.Z.fromBackend("Failed to load guardrail configuration")}})()},[r]);let J=e=>{S(e),n.setFieldsValue({config:void 0,presidio_analyzer_api_base:void 0,presidio_anonymizer_api_base:void 0}),P([]),C({}),F([]),T(2),B({})},V=e=>{P(l=>l.includes(e)?l.filter(l=>l!==e):[...l,e])},K=(e,l)=>{C(a=>({...a,[e]:l}))},R=async()=>{try{if(0===O&&(await n.validateFields(["guardrail_name","provider","mode","default_on"]),b)){let e=["guardrail_name","provider","mode","default_on"];"PresidioPII"===b&&e.push("presidio_analyzer_api_base","presidio_anonymizer_api_base"),await n.validateFields(e)}if(1===O&&y(b)&&0===I.length){Q.Z.fromBackend("Please select at least one PII entity to continue");return}A(O+1)}catch(e){console.error("Form validation failed:",e)}},q=()=>{n.resetFields(),S(null),P([]),C({}),F([]),T(2),B({}),A(0)},H=()=>{q(),a()},W=async()=>{try{h(!0),await n.validateFields();let l=n.getFieldsValue(!0),t=v[l.provider],s={guardrail_name:l.guardrail_name,litellm_params:{guardrail:t,mode:l.mode,default_on:l.default_on},guardrail_info:{}};if("PresidioPII"===l.provider&&I.length>0){let e={};I.forEach(l=>{e[l]=Z[l]||"MASK"}),s.litellm_params.pii_entities_config=e,l.presidio_analyzer_api_base&&(s.litellm_params.presidio_analyzer_api_base=l.presidio_analyzer_api_base),l.presidio_anonymizer_api_base&&(s.litellm_params.presidio_anonymizer_api_base=l.presidio_anonymizer_api_base)}else if(l.config)try{let e=JSON.parse(l.config);s.guardrail_info=e}catch(e){Q.Z.fromBackend("Invalid JSON in configuration"),h(!1);return}if(console.log("values: ",JSON.stringify(l)),E&&b){var e;let a=null===(e=v[b])||void 0===e?void 0:e.toLowerCase();console.log("providerKey: ",a);let r=E[a]||{},i=new Set;console.log("providerSpecificParams: ",JSON.stringify(r)),Object.keys(r).forEach(e=>{"optional_params"!==e&&i.add(e)}),r.optional_params&&r.optional_params.fields&&Object.keys(r.optional_params.fields).forEach(e=>{i.add(e)}),console.log("allowedParams: ",i),i.forEach(e=>{let a=l[e];if(null==a||""===a){var r;a=null===(r=l.optional_params)||void 0===r?void 0:r[e]}null!=a&&""!==a&&(s.litellm_params[e]=a)})}if(!r)throw Error("No access token available");console.log("Sending guardrail data:",JSON.stringify(s)),await (0,d.createGuardrailCall)(r,s),Q.Z.success("Guardrail created successfully"),q(),i(),a()}catch(e){console.error("Failed to create guardrail:",e),Q.Z.fromBackend("Failed to create guardrail: "+(e instanceof Error?e.message:String(e)))}finally{h(!1)}},X=()=>{var e;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(p.Z.Item,{name:"guardrail_name",label:"Guardrail Name",rules:[{required:!0,message:"Please enter a guardrail name"}],children:(0,t.jsx)(x.o,{placeholder:"Enter a name for this guardrail"})}),(0,t.jsx)(p.Z.Item,{name:"provider",label:"Guardrail Provider",rules:[{required:!0,message:"Please select a provider"}],children:(0,t.jsx)(u.default,{placeholder:"Select a guardrail provider",onChange:J,labelInValue:!1,optionLabelProp:"label",dropdownRender:e=>e,showSearch:!0,children:Object.entries(j()).map(e=>{let[l,a]=e;return(0,t.jsx)(ee,{value:l,label:(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center"},children:[N[a]&&(0,t.jsx)("img",{src:N[a],alt:"",style:{height:"20px",width:"20px",marginRight:"8px",objectFit:"contain"},onError:e=>{e.currentTarget.style.display="none"}}),(0,t.jsx)("span",{children:a})]}),children:(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center"},children:[N[a]&&(0,t.jsx)("img",{src:N[a],alt:"",style:{height:"20px",width:"20px",marginRight:"8px",objectFit:"contain"},onError:e=>{e.currentTarget.style.display="none"}}),(0,t.jsx)("span",{children:a})]})},l)})})}),(0,t.jsx)(p.Z.Item,{name:"mode",label:"Mode",tooltip:"How the guardrail should be applied",rules:[{required:!0,message:"Please select a mode"}],children:(0,t.jsx)(u.default,{optionLabelProp:"label",mode:"multiple",children:(null==k?void 0:null===(e=k.supported_modes)||void 0===e?void 0:e.map(e=>(0,t.jsx)(ee,{value:e,label:e,children:(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("strong",{children:e}),"pre_call"===e&&(0,t.jsx)(g.Z,{color:"green",style:{marginLeft:"8px"},children:"Recommended"})]}),(0,t.jsx)("div",{style:{fontSize:"12px",color:"#888"},children:ea[e]})]})},e)))||(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(ee,{value:"pre_call",label:"pre_call",children:(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("strong",{children:"pre_call"})," ",(0,t.jsx)(g.Z,{color:"green",children:"Recommended"})]}),(0,t.jsx)("div",{style:{fontSize:"12px",color:"#888"},children:ea.pre_call})]})}),(0,t.jsx)(ee,{value:"during_call",label:"during_call",children:(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{children:(0,t.jsx)("strong",{children:"during_call"})}),(0,t.jsx)("div",{style:{fontSize:"12px",color:"#888"},children:ea.during_call})]})}),(0,t.jsx)(ee,{value:"post_call",label:"post_call",children:(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{children:(0,t.jsx)("strong",{children:"post_call"})}),(0,t.jsx)("div",{style:{fontSize:"12px",color:"#888"},children:ea.post_call})]})}),(0,t.jsx)(ee,{value:"logging_only",label:"logging_only",children:(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{children:(0,t.jsx)("strong",{children:"logging_only"})}),(0,t.jsx)("div",{style:{fontSize:"12px",color:"#888"},children:ea.logging_only})]})})]})})}),(0,t.jsx)(p.Z.Item,{name:"default_on",label:"Always On",tooltip:"If enabled, this guardrail will be applied to all requests by default.",children:(0,t.jsxs)(u.default,{children:[(0,t.jsx)(u.default.Option,{value:!0,children:"Yes"}),(0,t.jsx)(u.default.Option,{value:!1,children:"No"})]})}),(0,t.jsx)(U,{selectedProvider:b,accessToken:r,providerParams:E})]})},$=()=>k&&"PresidioPII"===b?(0,t.jsx)(D,{entities:k.supported_entities,actions:k.supported_actions,selectedEntities:I,selectedActions:Z,onEntitySelect:V,onActionSelect:K,entityCategories:k.pii_entity_categories}):null,er=()=>{var e;if(!b||!E)return null;console.log("guardrail_provider_map: ",v),console.log("selectedProvider: ",b);let l=null===(e=v[b])||void 0===e?void 0:e.toLowerCase(),a=E&&E[l];return a&&a.optional_params?(0,t.jsx)(Y,{optionalParams:a.optional_params,parentFieldKey:"optional_params"}):null};return(0,t.jsx)(o.Z,{title:"Add Guardrail",open:l,onCancel:H,footer:null,width:700,children:(0,t.jsxs)(p.Z,{form:n,layout:"vertical",initialValues:{mode:"pre_call",default_on:!1},children:[(0,t.jsxs)(m.default,{current:O,className:"mb-6",children:[(0,t.jsx)(el,{title:"Basic Info"}),(0,t.jsx)(el,{title:y(b)?"PII Configuration":"Provider Configuration"})]}),(()=>{switch(O){case 0:return X();case 1:if(y(b))return $();return er();default:return null}})(),(0,t.jsxs)("div",{className:"flex justify-end space-x-2 mt-4",children:[O>0&&(0,t.jsx)(x.z,{variant:"secondary",onClick:()=>{A(O-1)},children:"Previous"}),O<2&&(0,t.jsx)(x.z,{onClick:R,children:"Next"}),2===O&&(0,t.jsx)(x.z,{onClick:W,loading:c,children:"Create Guardrail"}),(0,t.jsx)(x.z,{variant:"secondary",onClick:H,children:"Cancel"})]})]})})},ei=a(20831),et=a(47323),es=a(21626),en=a(97214),eo=a(28241),ed=a(58834),ec=a(69552),eu=a(71876),em=a(74998),ep=a(44633),eg=a(86462),ex=a(49084),eh=a(1309),ef=a(71594),ej=a(24525),ev=a(64482),e_=a(63709);let{Title:ey,Text:eb}=c.default,{Option:eN}=u.default;var eS=e=>{var l;let{visible:a,onClose:r,accessToken:i,onSuccess:n,guardrailId:c,initialValues:m}=e,[g]=p.Z.useForm(),[h,f]=(0,s.useState)(!1),[_,y]=(0,s.useState)((null==m?void 0:m.provider)||null),[b,S]=(0,s.useState)(null),[k,w]=(0,s.useState)([]),[I,P]=(0,s.useState)({});(0,s.useEffect)(()=>{(async()=>{try{if(!i)return;let e=await (0,d.getGuardrailUISettings)(i);S(e)}catch(e){console.error("Error fetching guardrail settings:",e),Q.Z.fromBackend("Failed to load guardrail settings")}})()},[i]),(0,s.useEffect)(()=>{(null==m?void 0:m.pii_entities_config)&&Object.keys(m.pii_entities_config).length>0&&(w(Object.keys(m.pii_entities_config)),P(m.pii_entities_config))},[m]);let Z=e=>{w(l=>l.includes(e)?l.filter(l=>l!==e):[...l,e])},C=(e,l)=>{P(a=>({...a,[e]:l}))},O=async()=>{try{f(!0);let e=await g.validateFields(),l=v[e.provider],a={guardrail_id:c,guardrail:{guardrail_name:e.guardrail_name,litellm_params:{guardrail:l,mode:e.mode,default_on:e.default_on},guardrail_info:{}}};if("PresidioPII"===e.provider&&k.length>0){let e={};k.forEach(l=>{e[l]=I[l]||"MASK"}),a.guardrail.litellm_params.pii_entities_config=e}else if(e.config)try{let l=JSON.parse(e.config);"Bedrock"===e.provider&&l?(l.guardrail_id&&(a.guardrail.litellm_params.guardrailIdentifier=l.guardrail_id),l.guardrail_version&&(a.guardrail.litellm_params.guardrailVersion=l.guardrail_version)):a.guardrail.guardrail_info=l}catch(e){Q.Z.fromBackend("Invalid JSON in configuration"),f(!1);return}if(!i)throw Error("No access token available");console.log("Sending guardrail update data:",JSON.stringify(a));let t=await fetch("/guardrails/".concat(c),{method:"PUT",headers:{Authorization:"Bearer ".concat(i),"Content-Type":"application/json"},body:JSON.stringify(a)});if(!t.ok){let e=await t.text();throw Error(e||"Failed to update guardrail")}Q.Z.success("Guardrail updated successfully"),n(),r()}catch(e){console.error("Failed to update guardrail:",e),Q.Z.fromBackend("Failed to update guardrail: "+(e instanceof Error?e.message:String(e)))}finally{f(!1)}},A=()=>b&&_&&"PresidioPII"===_?(0,t.jsx)(D,{entities:b.supported_entities,actions:b.supported_actions,selectedEntities:k,selectedActions:I,onEntitySelect:Z,onActionSelect:C,entityCategories:b.pii_entity_categories}):null;return(0,t.jsx)(o.Z,{title:"Edit Guardrail",open:a,onCancel:r,footer:null,width:700,children:(0,t.jsxs)(p.Z,{form:g,layout:"vertical",initialValues:m,children:[(0,t.jsx)(p.Z.Item,{name:"guardrail_name",label:"Guardrail Name",rules:[{required:!0,message:"Please enter a guardrail name"}],children:(0,t.jsx)(x.o,{placeholder:"Enter a name for this guardrail"})}),(0,t.jsx)(p.Z.Item,{name:"provider",label:"Guardrail Provider",rules:[{required:!0,message:"Please select a provider"}],children:(0,t.jsx)(u.default,{placeholder:"Select a guardrail provider",onChange:e=>{y(e),g.setFieldsValue({config:void 0}),w([]),P({})},disabled:!0,optionLabelProp:"label",children:Object.entries(j()).map(e=>{let[l,a]=e;return(0,t.jsx)(eN,{value:l,label:a,children:(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center"},children:[N[a]&&(0,t.jsx)("img",{src:N[a],alt:"",style:{height:"20px",width:"20px",marginRight:"8px",objectFit:"contain"},onError:e=>{e.currentTarget.style.display="none"}}),(0,t.jsx)("span",{children:a})]})},l)})})}),(0,t.jsx)(p.Z.Item,{name:"mode",label:"Mode",tooltip:"How the guardrail should be applied",rules:[{required:!0,message:"Please select a mode"}],children:(0,t.jsx)(u.default,{children:(null==b?void 0:null===(l=b.supported_modes)||void 0===l?void 0:l.map(e=>(0,t.jsx)(eN,{value:e,children:e},e)))||(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(eN,{value:"pre_call",children:"pre_call"}),(0,t.jsx)(eN,{value:"post_call",children:"post_call"})]})})}),(0,t.jsx)(p.Z.Item,{name:"default_on",label:"Always On",tooltip:"If enabled, this guardrail will be applied to all requests by default",valuePropName:"checked",children:(0,t.jsx)(e_.Z,{})}),(()=>{if(!_)return null;if("PresidioPII"===_)return A();switch(_){case"Aporia":return(0,t.jsx)(p.Z.Item,{label:"Aporia Configuration",name:"config",tooltip:"JSON configuration for Aporia",children:(0,t.jsx)(ev.default.TextArea,{rows:4,placeholder:'{\n "api_key": "your_aporia_api_key",\n "project_name": "your_project_name"\n}'})});case"AimSecurity":return(0,t.jsx)(p.Z.Item,{label:"Aim Security Configuration",name:"config",tooltip:"JSON configuration for Aim Security",children:(0,t.jsx)(ev.default.TextArea,{rows:4,placeholder:'{\n "api_key": "your_aim_api_key"\n}'})});case"Bedrock":return(0,t.jsx)(p.Z.Item,{label:"Amazon Bedrock Configuration",name:"config",tooltip:"JSON configuration for Amazon Bedrock guardrails",children:(0,t.jsx)(ev.default.TextArea,{rows:4,placeholder:'{\n "guardrail_id": "your_guardrail_id",\n "guardrail_version": "your_guardrail_version"\n}'})});case"GuardrailsAI":return(0,t.jsx)(p.Z.Item,{label:"Guardrails.ai Configuration",name:"config",tooltip:"JSON configuration for Guardrails.ai",children:(0,t.jsx)(ev.default.TextArea,{rows:4,placeholder:'{\n "api_key": "your_guardrails_api_key",\n "guardrail_id": "your_guardrail_id"\n}'})});case"LakeraAI":return(0,t.jsx)(p.Z.Item,{label:"Lakera AI Configuration",name:"config",tooltip:"JSON configuration for Lakera AI",children:(0,t.jsx)(ev.default.TextArea,{rows:4,placeholder:'{\n "api_key": "your_lakera_api_key"\n}'})});case"PromptInjection":return(0,t.jsx)(p.Z.Item,{label:"Prompt Injection Configuration",name:"config",tooltip:"JSON configuration for prompt injection detection",children:(0,t.jsx)(ev.default.TextArea,{rows:4,placeholder:'{\n "threshold": 0.8\n}'})});default:return(0,t.jsx)(p.Z.Item,{label:"Custom Configuration",name:"config",tooltip:"JSON configuration for your custom guardrail",children:(0,t.jsx)(ev.default.TextArea,{rows:4,placeholder:'{\n "key1": "value1",\n "key2": "value2"\n}'})})}})(),(0,t.jsxs)("div",{className:"flex justify-end space-x-2 mt-4",children:[(0,t.jsx)(x.z,{variant:"secondary",onClick:r,children:"Cancel"}),(0,t.jsx)(x.z,{onClick:O,loading:h,children:"Update Guardrail"})]})]})})},ek=e=>{let{guardrailsList:l,isLoading:a,onDeleteClick:r,accessToken:i,onGuardrailUpdated:n,isAdmin:o=!1,onGuardrailClick:d}=e,[c,u]=(0,s.useState)([{id:"created_at",desc:!0}]),[m,p]=(0,s.useState)(!1),[g,x]=(0,s.useState)(null),h=e=>e?new Date(e).toLocaleString():"-",f=[{header:"Guardrail ID",accessorKey:"guardrail_id",cell:e=>(0,t.jsx)(w.Z,{title:String(e.getValue()||""),children:(0,t.jsx)(ei.Z,{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]",onClick:()=>e.getValue()&&d(e.getValue()),children:e.getValue()?"".concat(String(e.getValue()).slice(0,7),"..."):""})})},{header:"Name",accessorKey:"guardrail_name",cell:e=>{let{row:l}=e,a=l.original;return(0,t.jsx)(w.Z,{title:a.guardrail_name,children:(0,t.jsx)("span",{className:"text-xs font-medium",children:a.guardrail_name||"-"})})}},{header:"Provider",accessorKey:"litellm_params.guardrail",cell:e=>{let{row:l}=e,{logo:a,displayName:r}=S(l.original.litellm_params.guardrail);return(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[a&&(0,t.jsx)("img",{src:a,alt:"".concat(r," logo"),className:"w-4 h-4",onError:e=>{e.target.style.display="none"}}),(0,t.jsx)("span",{className:"text-xs",children:r})]})}},{header:"Mode",accessorKey:"litellm_params.mode",cell:e=>{let{row:l}=e,a=l.original;return(0,t.jsx)("span",{className:"text-xs",children:a.litellm_params.mode})}},{header:"Default On",accessorKey:"litellm_params.default_on",cell:e=>{var l,a;let{row:r}=e,i=r.original;return(0,t.jsx)(eh.C,{color:(null===(l=i.litellm_params)||void 0===l?void 0:l.default_on)?"green":"gray",className:"text-xs font-normal",size:"xs",children:(null===(a=i.litellm_params)||void 0===a?void 0:a.default_on)?"Default On":"Default Off"})}},{header:"Created At",accessorKey:"created_at",cell:e=>{let{row:l}=e,a=l.original;return(0,t.jsx)(w.Z,{title:a.created_at,children:(0,t.jsx)("span",{className:"text-xs",children:h(a.created_at)})})}},{header:"Updated At",accessorKey:"updated_at",cell:e=>{let{row:l}=e,a=l.original;return(0,t.jsx)(w.Z,{title:a.updated_at,children:(0,t.jsx)("span",{className:"text-xs",children:h(a.updated_at)})})}},{id:"actions",header:"",cell:e=>{let{row:l}=e,a=l.original;return(0,t.jsx)("div",{className:"flex space-x-2",children:(0,t.jsx)(et.Z,{icon:em.Z,size:"sm",onClick:()=>a.guardrail_id&&r(a.guardrail_id,a.guardrail_name||"Unnamed Guardrail"),className:"cursor-pointer hover:text-red-500",tooltip:"Delete guardrail"})})}}],j=(0,ef.b7)({data:l,columns:f,state:{sorting:c},onSortingChange:u,getCoreRowModel:(0,ej.sC)(),getSortedRowModel:(0,ej.tj)(),enableSorting:!0});return(0,t.jsxs)("div",{className:"rounded-lg custom-border relative",children:[(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)(es.Z,{className:"[&_td]:py-0.5 [&_th]:py-1",children:[(0,t.jsx)(ed.Z,{children:j.getHeaderGroups().map(e=>(0,t.jsx)(eu.Z,{children:e.headers.map(e=>(0,t.jsx)(ec.Z,{className:"py-1 h-8 ".concat("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,ef.ie)(e.column.columnDef.header,e.getContext())}),"actions"!==e.id&&(0,t.jsx)("div",{className:"w-4",children:e.column.getIsSorted()?({asc:(0,t.jsx)(ep.Z,{className:"h-4 w-4 text-blue-500"}),desc:(0,t.jsx)(eg.Z,{className:"h-4 w-4 text-blue-500"})})[e.column.getIsSorted()]:(0,t.jsx)(ex.Z,{className:"h-4 w-4 text-gray-400"})})]})},e.id))},e.id))}),(0,t.jsx)(en.Z,{children:a?(0,t.jsx)(eu.Z,{children:(0,t.jsx)(eo.Z,{colSpan:f.length,className:"h-8 text-center",children:(0,t.jsx)("div",{className:"text-center text-gray-500",children:(0,t.jsx)("p",{children:"Loading..."})})})}):l.length>0?j.getRowModel().rows.map(e=>(0,t.jsx)(eu.Z,{className:"h-8",children:e.getVisibleCells().map(e=>(0,t.jsx)(eo.Z,{className:"py-0.5 max-h-8 overflow-hidden text-ellipsis whitespace-nowrap ".concat("actions"===e.column.id?"sticky right-0 bg-white shadow-[-4px_0_8px_-6px_rgba(0,0,0,0.1)]":""),children:(0,ef.ie)(e.column.columnDef.cell,e.getContext())},e.id))},e.id)):(0,t.jsx)(eu.Z,{children:(0,t.jsx)(eo.Z,{colSpan:f.length,className:"h-8 text-center",children:(0,t.jsx)("div",{className:"text-center text-gray-500",children:(0,t.jsx)("p",{children:"No guardrails found"})})})})})]})}),g&&(0,t.jsx)(eS,{visible:m,onClose:()=>p(!1),accessToken:i,onSuccess:()=>{p(!1),x(null),n()},guardrailId:g.guardrail_id||"",initialValues:{guardrail_name:g.guardrail_name||"",provider:Object.keys(v).find(e=>v[e]===(null==g?void 0:g.litellm_params.guardrail))||"",mode:g.litellm_params.mode,default_on:g.litellm_params.default_on,pii_entities_config:g.litellm_params.pii_entities_config,...g.guardrail_info}})]})},ew=a(20347),eI=a(30078),eP=a(23496),eZ=a(10900),eC=a(59872),eO=a(30401),eA=a(78867),eE=e=>{var l,a,r,i,n,o,c,m,g,x,h;let{guardrailId:f,onClose:j,accessToken:_,isAdmin:y}=e,[b,N]=(0,s.useState)(null),[k,w]=(0,s.useState)(null),[P,Z]=(0,s.useState)(!0),[C,O]=(0,s.useState)(!1),[A]=p.Z.useForm(),[E,G]=(0,s.useState)([]),[L,F]=(0,s.useState)({}),[z,T]=(0,s.useState)(null),[M,B]=(0,s.useState)({}),J=async()=>{try{var e;if(Z(!0),!_)return;let l=await (0,d.getGuardrailInfo)(_,f);if(N(l),null===(e=l.litellm_params)||void 0===e?void 0:e.pii_entities_config){let e=l.litellm_params.pii_entities_config;if(G([]),F({}),Object.keys(e).length>0){let l=[],a={};Object.entries(e).forEach(e=>{let[r,i]=e;l.push(r),a[r]="string"==typeof i?i:"MASK"}),G(l),F(a)}}else G([]),F({})}catch(e){Q.Z.fromBackend("Failed to load guardrail information"),console.error("Error fetching guardrail info:",e)}finally{Z(!1)}},V=async()=>{try{if(!_)return;let e=await (0,d.getGuardrailProviderSpecificParams)(_);w(e)}catch(e){console.error("Error fetching guardrail provider specific params:",e)}},K=async()=>{try{if(!_)return;let e=await (0,d.getGuardrailUISettings)(_);T(e)}catch(e){console.error("Error fetching guardrail UI settings:",e)}};(0,s.useEffect)(()=>{V()},[_]),(0,s.useEffect)(()=>{J(),K()},[f,_]),(0,s.useEffect)(()=>{if(b&&A){var e;A.setFieldsValue({guardrail_name:b.guardrail_name,...b.litellm_params,guardrail_info:b.guardrail_info?JSON.stringify(b.guardrail_info,null,2):"",...(null===(e=b.litellm_params)||void 0===e?void 0:e.optional_params)&&{optional_params:b.litellm_params.optional_params}})}},[b,k,A]);let R=async e=>{try{var l,a,r;if(!_)return;let i={litellm_params:{}};e.guardrail_name!==b.guardrail_name&&(i.guardrail_name=e.guardrail_name),e.default_on!==(null===(l=b.litellm_params)||void 0===l?void 0:l.default_on)&&(i.litellm_params.default_on=e.default_on);let t=b.guardrail_info,s=e.guardrail_info?JSON.parse(e.guardrail_info):void 0;JSON.stringify(t)!==JSON.stringify(s)&&(i.guardrail_info=s);let n=(null===(a=b.litellm_params)||void 0===a?void 0:a.pii_entities_config)||{},o={};E.forEach(e=>{o[e]=L[e]||"MASK"}),JSON.stringify(n)!==JSON.stringify(o)&&(i.litellm_params.pii_entities_config=o);let c=Object.keys(v).find(e=>{var l;return v[e]===(null===(l=b.litellm_params)||void 0===l?void 0:l.guardrail)});if(console.log("values: ",JSON.stringify(e)),console.log("currentProvider: ",c),k&&c){let l=k[null===(r=v[c])||void 0===r?void 0:r.toLowerCase()]||{},a=new Set;console.log("providerSpecificParams: ",JSON.stringify(l)),Object.keys(l).forEach(e=>{"optional_params"!==e&&a.add(e)}),l.optional_params&&l.optional_params.fields&&Object.keys(l.optional_params.fields).forEach(e=>{a.add(e)}),console.log("allowedParams: ",a),a.forEach(l=>{var a,r;let t=e[l];(null==t||""===t)&&(t=null===(r=e.optional_params)||void 0===r?void 0:r[l]);let s=null===(a=b.litellm_params)||void 0===a?void 0:a[l];JSON.stringify(t)!==JSON.stringify(s)&&(null!=t&&""!==t?i.litellm_params[l]=t:null!=s&&""!==s&&(i.litellm_params[l]=null))})}if(0===Object.keys(i.litellm_params).length&&delete i.litellm_params,0===Object.keys(i).length){Q.Z.info("No changes detected"),O(!1);return}await (0,d.updateGuardrailCall)(_,f,i),Q.Z.success("Guardrail updated successfully"),J(),O(!1)}catch(e){console.error("Error updating guardrail:",e),Q.Z.fromBackend("Failed to update guardrail")}};if(P)return(0,t.jsx)("div",{className:"p-4",children:"Loading..."});if(!b)return(0,t.jsx)("div",{className:"p-4",children:"Guardrail not found"});let q=e=>e?new Date(e).toLocaleString():"-",{logo:H,displayName:W}=S((null===(l=b.litellm_params)||void 0===l?void 0:l.guardrail)||""),X=async(e,l)=>{await (0,eC.vQ)(e)&&(B(e=>({...e,[l]:!0})),setTimeout(()=>{B(e=>({...e,[l]:!1}))},2e3))};return(0,t.jsxs)("div",{className:"p-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(eI.zx,{icon:eZ.Z,variant:"light",onClick:j,className:"mb-4",children:"Back to Guardrails"}),(0,t.jsx)(eI.Dx,{children:b.guardrail_name||"Unnamed Guardrail"}),(0,t.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,t.jsx)(eI.xv,{className:"text-gray-500 font-mono",children:b.guardrail_id}),(0,t.jsx)(I.ZP,{type:"text",size:"small",icon:M["guardrail-id"]?(0,t.jsx)(eO.Z,{size:12}):(0,t.jsx)(eA.Z,{size:12}),onClick:()=>X(b.guardrail_id,"guardrail-id"),className:"left-2 z-10 transition-all duration-200 ".concat(M["guardrail-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]})]}),(0,t.jsxs)(eI.v0,{children:[(0,t.jsxs)(eI.td,{className:"mb-4",children:[(0,t.jsx)(eI.OK,{children:"Overview"},"overview"),y?(0,t.jsx)(eI.OK,{children:"Settings"},"settings"):(0,t.jsx)(t.Fragment,{})]}),(0,t.jsxs)(eI.nP,{children:[(0,t.jsxs)(eI.x4,{children:[(0,t.jsxs)(eI.rj,{numItems:1,numItemsSm:2,numItemsLg:3,className:"gap-6",children:[(0,t.jsxs)(eI.Zb,{children:[(0,t.jsx)(eI.xv,{children:"Provider"}),(0,t.jsxs)("div",{className:"mt-2 flex items-center space-x-2",children:[H&&(0,t.jsx)("img",{src:H,alt:"".concat(W," logo"),className:"w-6 h-6",onError:e=>{e.target.style.display="none"}}),(0,t.jsx)(eI.Dx,{children:W})]})]}),(0,t.jsxs)(eI.Zb,{children:[(0,t.jsx)(eI.xv,{children:"Mode"}),(0,t.jsxs)("div",{className:"mt-2",children:[(0,t.jsx)(eI.Dx,{children:(null===(a=b.litellm_params)||void 0===a?void 0:a.mode)||"-"}),(0,t.jsx)(eI.Ct,{color:(null===(r=b.litellm_params)||void 0===r?void 0:r.default_on)?"green":"gray",children:(null===(i=b.litellm_params)||void 0===i?void 0:i.default_on)?"Default On":"Default Off"})]})]}),(0,t.jsxs)(eI.Zb,{children:[(0,t.jsx)(eI.xv,{children:"Created At"}),(0,t.jsxs)("div",{className:"mt-2",children:[(0,t.jsx)(eI.Dx,{children:q(b.created_at)}),(0,t.jsxs)(eI.xv,{children:["Last Updated: ",q(b.updated_at)]})]})]})]}),(null===(n=b.litellm_params)||void 0===n?void 0:n.pii_entities_config)&&Object.keys(b.litellm_params.pii_entities_config).length>0&&(0,t.jsx)(eI.Zb,{className:"mt-6",children:(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsx)(eI.xv,{className:"font-medium",children:"PII Protection"}),(0,t.jsxs)(eI.Ct,{color:"blue",children:[Object.keys(b.litellm_params.pii_entities_config).length," PII entities configured"]})]})}),b.guardrail_info&&Object.keys(b.guardrail_info).length>0&&(0,t.jsxs)(eI.Zb,{className:"mt-6",children:[(0,t.jsx)(eI.xv,{children:"Guardrail Info"}),(0,t.jsx)("div",{className:"mt-2 space-y-2",children:Object.entries(b.guardrail_info).map(e=>{let[l,a]=e;return(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)(eI.xv,{className:"font-medium w-1/3",children:l}),(0,t.jsx)(eI.xv,{className:"w-2/3",children:"object"==typeof a?JSON.stringify(a,null,2):String(a)})]},l)})})]})]}),y&&(0,t.jsx)(eI.x4,{children:(0,t.jsxs)(eI.Zb,{children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,t.jsx)(eI.Dx,{children:"Guardrail Settings"}),!C&&(0,t.jsx)(eI.zx,{onClick:()=>O(!0),children:"Edit Settings"})]}),C?(0,t.jsxs)(p.Z,{form:A,onFinish:R,initialValues:{guardrail_name:b.guardrail_name,...b.litellm_params,guardrail_info:b.guardrail_info?JSON.stringify(b.guardrail_info,null,2):"",...(null===(o=b.litellm_params)||void 0===o?void 0:o.optional_params)&&{optional_params:b.litellm_params.optional_params}},layout:"vertical",children:[(0,t.jsx)(p.Z.Item,{label:"Guardrail Name",name:"guardrail_name",rules:[{required:!0,message:"Please input a guardrail name"}],children:(0,t.jsx)(eI.oi,{})}),(0,t.jsx)(p.Z.Item,{label:"Default On",name:"default_on",children:(0,t.jsxs)(u.default,{children:[(0,t.jsx)(u.default.Option,{value:!0,children:"Yes"}),(0,t.jsx)(u.default.Option,{value:!1,children:"No"})]})}),(null===(c=b.litellm_params)||void 0===c?void 0:c.guardrail)==="presidio"&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(eP.Z,{orientation:"left",children:"PII Protection"}),(0,t.jsx)("div",{className:"mb-6",children:z&&(0,t.jsx)(D,{entities:z.supported_entities,actions:z.supported_actions,selectedEntities:E,selectedActions:L,onEntitySelect:e=>{G(l=>l.includes(e)?l.filter(l=>l!==e):[...l,e])},onActionSelect:(e,l)=>{F(a=>({...a,[e]:l}))},entityCategories:z.pii_entity_categories})})]}),(0,t.jsx)(eP.Z,{orientation:"left",children:"Provider Settings"}),(0,t.jsx)(U,{selectedProvider:Object.keys(v).find(e=>{var l;return v[e]===(null===(l=b.litellm_params)||void 0===l?void 0:l.guardrail)})||null,accessToken:_,providerParams:k,value:b.litellm_params}),k&&(()=>{var e;let l=Object.keys(v).find(e=>{var l;return v[e]===(null===(l=b.litellm_params)||void 0===l?void 0:l.guardrail)});if(!l)return null;let a=k[null===(e=v[l])||void 0===e?void 0:e.toLowerCase()];return a&&a.optional_params?(0,t.jsx)(Y,{optionalParams:a.optional_params,parentFieldKey:"optional_params",values:b.litellm_params}):null})(),(0,t.jsx)(eP.Z,{orientation:"left",children:"Advanced Settings"}),(0,t.jsx)(p.Z.Item,{label:"Guardrail Information",name:"guardrail_info",children:(0,t.jsx)(ev.default.TextArea,{rows:5})}),(0,t.jsxs)("div",{className:"flex justify-end gap-2 mt-6",children:[(0,t.jsx)(I.ZP,{onClick:()=>O(!1),children:"Cancel"}),(0,t.jsx)(eI.zx,{children:"Save Changes"})]})]}):(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(eI.xv,{className:"font-medium",children:"Guardrail ID"}),(0,t.jsx)("div",{className:"font-mono",children:b.guardrail_id})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(eI.xv,{className:"font-medium",children:"Guardrail Name"}),(0,t.jsx)("div",{children:b.guardrail_name||"Unnamed Guardrail"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(eI.xv,{className:"font-medium",children:"Provider"}),(0,t.jsx)("div",{children:W})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(eI.xv,{className:"font-medium",children:"Mode"}),(0,t.jsx)("div",{children:(null===(m=b.litellm_params)||void 0===m?void 0:m.mode)||"-"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(eI.xv,{className:"font-medium",children:"Default On"}),(0,t.jsx)(eI.Ct,{color:(null===(g=b.litellm_params)||void 0===g?void 0:g.default_on)?"green":"gray",children:(null===(x=b.litellm_params)||void 0===x?void 0:x.default_on)?"Yes":"No"})]}),(null===(h=b.litellm_params)||void 0===h?void 0:h.pii_entities_config)&&Object.keys(b.litellm_params.pii_entities_config).length>0&&(0,t.jsxs)("div",{children:[(0,t.jsx)(eI.xv,{className:"font-medium",children:"PII Protection"}),(0,t.jsx)("div",{className:"mt-2",children:(0,t.jsxs)(eI.Ct,{color:"blue",children:[Object.keys(b.litellm_params.pii_entities_config).length," PII entities configured"]})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(eI.xv,{className:"font-medium",children:"Created At"}),(0,t.jsx)("div",{children:q(b.created_at)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(eI.xv,{className:"font-medium",children:"Last Updated"}),(0,t.jsx)("div",{children:q(b.updated_at)})]})]})]})})]})]})]})},eG=e=>{let{accessToken:l,userRole:a}=e,[r,i]=(0,s.useState)([]),[c,u]=(0,s.useState)(!1),[m,p]=(0,s.useState)(!1),[g,x]=(0,s.useState)(!1),[h,f]=(0,s.useState)(null),[j,v]=(0,s.useState)(null),_=!!a&&(0,ew.tY)(a),y=async()=>{if(l){p(!0);try{let e=await (0,d.getGuardrailsList)(l);console.log("guardrails: ".concat(JSON.stringify(e))),i(e.guardrails)}catch(e){console.error("Error fetching guardrails:",e)}finally{p(!1)}}};(0,s.useEffect)(()=>{y()},[l]);let b=async()=>{if(h&&l){x(!0);try{await (0,d.deleteGuardrailCall)(l,h.id),Q.Z.success('Guardrail "'.concat(h.name,'" deleted successfully')),y()}catch(e){console.error("Error deleting guardrail:",e),Q.Z.fromBackend("Failed to delete guardrail")}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.jsx)("div",{className:"flex justify-between items-center mb-4",children:(0,t.jsx)(n.z,{onClick:()=>{j&&v(null),u(!0)},disabled:!l,children:"+ Add New Guardrail"})}),j?(0,t.jsx)(eE,{guardrailId:j,onClose:()=>v(null),accessToken:l,isAdmin:_}):(0,t.jsx)(ek,{guardrailsList:r,isLoading:m,onDeleteClick:(e,l)=>{f({id:e,name:l})},accessToken:l,onGuardrailUpdated:y,isAdmin:_,onGuardrailClick:e=>v(e)}),(0,t.jsx)(er,{visible:c,onClose:()=>{u(!1)},accessToken:l,onSuccess:()=>{y()}}),h&&(0,t.jsxs)(o.Z,{title:"Delete Guardrail",open:null!==h,onOk:b,onCancel:()=>{f(null)},confirmLoading:g,okText:"Delete",okButtonProps:{danger:!0},children:[(0,t.jsxs)("p",{children:["Are you sure you want to delete guardrail: ",h.name," ?"]}),(0,t.jsx)("p",{children:"This action cannot be undone."})]})]})}}}]);
\ No newline at end of file
diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/3801-e8b8c1bf8b6a231c.js b/litellm/proxy/_experimental/out/_next/static/chunks/3801-12f0e220f3db9b4b.js
similarity index 100%
rename from litellm/proxy/_experimental/out/_next/static/chunks/3801-e8b8c1bf8b6a231c.js
rename to litellm/proxy/_experimental/out/_next/static/chunks/3801-12f0e220f3db9b4b.js
diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/3866-e3419825a249263f.js b/litellm/proxy/_experimental/out/_next/static/chunks/3866-e3419825a249263f.js
deleted file mode 100644
index fbd7451e2c7..00000000000
--- a/litellm/proxy/_experimental/out/_next/static/chunks/3866-e3419825a249263f.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3866],{33866:function(t,o,n){n.d(o,{Z:function(){return B}});var e=n(2265),a=n(36760),r=n.n(a),i=n(47970),c=n(93350),l=n(19722),s=n(71744),u=n(352),d=n(12918),m=n(18536),b=n(3104),g=n(80669);let p=new u.E4("antStatusProcessing",{"0%":{transform:"scale(0.8)",opacity:.5},"100%":{transform:"scale(2.4)",opacity:0}}),f=new u.E4("antZoomBadgeIn",{"0%":{transform:"scale(0) translate(50%, -50%)",opacity:0},"100%":{transform:"scale(1) translate(50%, -50%)"}}),v=new u.E4("antZoomBadgeOut",{"0%":{transform:"scale(1) translate(50%, -50%)"},"100%":{transform:"scale(0) translate(50%, -50%)",opacity:0}}),h=new u.E4("antNoWrapperZoomBadgeIn",{"0%":{transform:"scale(0)",opacity:0},"100%":{transform:"scale(1)"}}),y=new u.E4("antNoWrapperZoomBadgeOut",{"0%":{transform:"scale(1)"},"100%":{transform:"scale(0)",opacity:0}}),O=new u.E4("antBadgeLoadingCircle",{"0%":{transformOrigin:"50%"},"100%":{transform:"translate(50%, -50%) rotate(360deg)",transformOrigin:"50%"}}),w=t=>{let{componentCls:o,iconCls:n,antCls:e,badgeShadowSize:a,motionDurationSlow:r,textFontSize:i,textFontSizeSM:c,statusSize:l,dotSize:s,textFontWeight:b,indicatorHeight:g,indicatorHeightSM:w,marginXS:E,calc:N}=t,S="".concat(e,"-scroll-number"),C=(0,m.Z)(t,(t,n)=>{let{darkColor:e}=n;return{["&".concat(o," ").concat(o,"-color-").concat(t)]:{background:e,["&:not(".concat(o,"-count)")]:{color:e}}}});return{[o]:Object.assign(Object.assign(Object.assign(Object.assign({},(0,d.Wf)(t)),{position:"relative",display:"inline-block",width:"fit-content",lineHeight:1,["".concat(o,"-count")]:{zIndex:t.indicatorZIndex,minWidth:g,height:g,color:t.badgeTextColor,fontWeight:b,fontSize:i,lineHeight:(0,u.bf)(g),whiteSpace:"nowrap",textAlign:"center",background:t.badgeColor,borderRadius:N(g).div(2).equal(),boxShadow:"0 0 0 ".concat((0,u.bf)(a)," ").concat(t.badgeShadowColor),transition:"background ".concat(t.motionDurationMid),a:{color:t.badgeTextColor},"a:hover":{color:t.badgeTextColor},"a:hover &":{background:t.badgeColorHover}},["".concat(o,"-count-sm")]:{minWidth:w,height:w,fontSize:c,lineHeight:(0,u.bf)(w),borderRadius:N(w).div(2).equal()},["".concat(o,"-multiple-words")]:{padding:"0 ".concat((0,u.bf)(t.paddingXS)),bdi:{unicodeBidi:"plaintext"}},["".concat(o,"-dot")]:{zIndex:t.indicatorZIndex,width:s,minWidth:s,height:s,background:t.badgeColor,borderRadius:"100%",boxShadow:"0 0 0 ".concat((0,u.bf)(a)," ").concat(t.badgeShadowColor)},["".concat(o,"-dot").concat(S)]:{transition:"background ".concat(r)},["".concat(o,"-count, ").concat(o,"-dot, ").concat(S,"-custom-component")]:{position:"absolute",top:0,insetInlineEnd:0,transform:"translate(50%, -50%)",transformOrigin:"100% 0%",["&".concat(n,"-spin")]:{animationName:O,animationDuration:"1s",animationIterationCount:"infinite",animationTimingFunction:"linear"}},["&".concat(o,"-status")]:{lineHeight:"inherit",verticalAlign:"baseline",["".concat(o,"-status-dot")]:{position:"relative",top:-1,display:"inline-block",width:l,height:l,verticalAlign:"middle",borderRadius:"50%"},["".concat(o,"-status-success")]:{backgroundColor:t.colorSuccess},["".concat(o,"-status-processing")]:{overflow:"visible",color:t.colorPrimary,backgroundColor:t.colorPrimary,"&::after":{position:"absolute",top:0,insetInlineStart:0,width:"100%",height:"100%",borderWidth:a,borderStyle:"solid",borderColor:"inherit",borderRadius:"50%",animationName:p,animationDuration:t.badgeProcessingDuration,animationIterationCount:"infinite",animationTimingFunction:"ease-in-out",content:'""'}},["".concat(o,"-status-default")]:{backgroundColor:t.colorTextPlaceholder},["".concat(o,"-status-error")]:{backgroundColor:t.colorError},["".concat(o,"-status-warning")]:{backgroundColor:t.colorWarning},["".concat(o,"-status-text")]:{marginInlineStart:E,color:t.colorText,fontSize:t.fontSize}}}),C),{["".concat(o,"-zoom-appear, ").concat(o,"-zoom-enter")]:{animationName:f,animationDuration:t.motionDurationSlow,animationTimingFunction:t.motionEaseOutBack,animationFillMode:"both"},["".concat(o,"-zoom-leave")]:{animationName:v,animationDuration:t.motionDurationSlow,animationTimingFunction:t.motionEaseOutBack,animationFillMode:"both"},["&".concat(o,"-not-a-wrapper")]:{["".concat(o,"-zoom-appear, ").concat(o,"-zoom-enter")]:{animationName:h,animationDuration:t.motionDurationSlow,animationTimingFunction:t.motionEaseOutBack},["".concat(o,"-zoom-leave")]:{animationName:y,animationDuration:t.motionDurationSlow,animationTimingFunction:t.motionEaseOutBack},["&:not(".concat(o,"-status)")]:{verticalAlign:"middle"},["".concat(S,"-custom-component, ").concat(o,"-count")]:{transform:"none"},["".concat(S,"-custom-component, ").concat(S)]:{position:"relative",top:"auto",display:"block",transformOrigin:"50% 50%"}},["".concat(S)]:{overflow:"hidden",["".concat(S,"-only")]:{position:"relative",display:"inline-block",height:g,transition:"all ".concat(t.motionDurationSlow," ").concat(t.motionEaseOutBack),WebkitTransformStyle:"preserve-3d",WebkitBackfaceVisibility:"hidden",["> p".concat(S,"-only-unit")]:{height:g,margin:0,WebkitTransformStyle:"preserve-3d",WebkitBackfaceVisibility:"hidden"}},["".concat(S,"-symbol")]:{verticalAlign:"top"}},"&-rtl":{direction:"rtl",["".concat(o,"-count, ").concat(o,"-dot, ").concat(S,"-custom-component")]:{transform:"translate(-50%, -50%)"}}})}},E=t=>{let{fontHeight:o,lineWidth:n,marginXS:e,colorBorderBg:a}=t,r=t.colorBgContainer,i=t.colorError,c=t.colorErrorHover;return(0,b.TS)(t,{badgeFontHeight:o,badgeShadowSize:n,badgeTextColor:r,badgeColor:i,badgeColorHover:c,badgeShadowColor:a,badgeProcessingDuration:"1.2s",badgeRibbonOffset:e,badgeRibbonCornerTransform:"scaleY(0.75)",badgeRibbonCornerFilter:"brightness(75%)"})},N=t=>{let{fontSize:o,lineHeight:n,fontSizeSM:e,lineWidth:a}=t;return{indicatorZIndex:"auto",indicatorHeight:Math.round(o*n)-2*a,indicatorHeightSM:o,dotSize:e/2,textFontSize:e,textFontSizeSM:e,textFontWeight:"normal",statusSize:e/2}};var S=(0,g.I$)("Badge",t=>w(E(t)),N);let C=t=>{let{antCls:o,badgeFontHeight:n,marginXS:e,badgeRibbonOffset:a,calc:r}=t,i="".concat(o,"-ribbon"),c=(0,m.Z)(t,(t,o)=>{let{darkColor:n}=o;return{["&".concat(i,"-color-").concat(t)]:{background:n,color:n}}});return{["".concat("".concat(o,"-ribbon-wrapper"))]:{position:"relative"},["".concat(i)]:Object.assign(Object.assign(Object.assign(Object.assign({},(0,d.Wf)(t)),{position:"absolute",top:e,padding:"0 ".concat((0,u.bf)(t.paddingXS)),color:t.colorPrimary,lineHeight:(0,u.bf)(n),whiteSpace:"nowrap",backgroundColor:t.colorPrimary,borderRadius:t.borderRadiusSM,["".concat(i,"-text")]:{color:t.colorTextLightSolid},["".concat(i,"-corner")]:{position:"absolute",top:"100%",width:a,height:a,color:"currentcolor",border:"".concat((0,u.bf)(r(a).div(2).equal())," solid"),transform:t.badgeRibbonCornerTransform,transformOrigin:"top",filter:t.badgeRibbonCornerFilter}}),c),{["&".concat(i,"-placement-end")]:{insetInlineEnd:r(a).mul(-1).equal(),borderEndEndRadius:0,["".concat(i,"-corner")]:{insetInlineEnd:0,borderInlineEndColor:"transparent",borderBlockEndColor:"transparent"}},["&".concat(i,"-placement-start")]:{insetInlineStart:r(a).mul(-1).equal(),borderEndStartRadius:0,["".concat(i,"-corner")]:{insetInlineStart:0,borderBlockEndColor:"transparent",borderInlineStartColor:"transparent"}},"&-rtl":{direction:"rtl"}})}};var j=(0,g.I$)(["Badge","Ribbon"],t=>C(E(t)),N);function x(t){let o,{prefixCls:n,value:a,current:i,offset:c=0}=t;return c&&(o={position:"absolute",top:"".concat(c,"00%"),left:0}),e.createElement("span",{style:o,className:r()("".concat(n,"-only-unit"),{current:i})},a)}function k(t){let o,n;let{prefixCls:a,count:r,value:i}=t,c=Number(i),l=Math.abs(r),[s,u]=e.useState(c),[d,m]=e.useState(l),b=()=>{u(c),m(l)};if(e.useEffect(()=>{let t=setTimeout(()=>{b()},1e3);return()=>{clearTimeout(t)}},[c]),s===c||Number.isNaN(c)||Number.isNaN(s))o=[e.createElement(x,Object.assign({},t,{key:c,current:!0}))],n={transition:"none"};else{o=[];let a=c+10,r=[];for(let t=c;t<=a;t+=1)r.push(t);let i=r.findIndex(t=>t%10===s);o=r.map((o,n)=>e.createElement(x,Object.assign({},t,{key:o,value:o%10,offset:n-i,current:n===i}))),n={transform:"translateY(".concat(-function(t,o,n){let e=t,a=0;for(;(e+10)%10!==o;)e+=n,a+=n;return a}(s,c,do.indexOf(e)&&(n[e]=t[e]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,e=Object.getOwnPropertySymbols(t);ao.indexOf(e[a])&&Object.prototype.propertyIsEnumerable.call(t,e[a])&&(n[e[a]]=t[e[a]]);return n};let T=e.forwardRef((t,o)=>{let{prefixCls:n,count:a,className:i,motionClassName:c,style:u,title:d,show:m,component:b="sup",children:g}=t,p=I(t,["prefixCls","count","className","motionClassName","style","title","show","component","children"]),{getPrefixCls:f}=e.useContext(s.E_),v=f("scroll-number",n),h=Object.assign(Object.assign({},p),{"data-show":m,style:u,className:r()(v,i,c),title:d}),y=a;if(a&&Number(a)%1==0){let t=String(a).split("");y=e.createElement("bdi",null,t.map((o,n)=>e.createElement(k,{prefixCls:v,count:Number(a),value:o,key:t.length-n})))}return(u&&u.borderColor&&(h.style=Object.assign(Object.assign({},u),{boxShadow:"0 0 0 1px ".concat(u.borderColor," inset")})),g)?(0,l.Tm)(g,t=>({className:r()("".concat(v,"-custom-component"),null==t?void 0:t.className,c)})):e.createElement(b,Object.assign({},h,{ref:o}),y)});var R=function(t,o){var n={};for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&0>o.indexOf(e)&&(n[e]=t[e]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,e=Object.getOwnPropertySymbols(t);ao.indexOf(e[a])&&Object.prototype.propertyIsEnumerable.call(t,e[a])&&(n[e[a]]=t[e[a]]);return n};let z=e.forwardRef((t,o)=>{var n,a,u,d,m;let{prefixCls:b,scrollNumberPrefixCls:g,children:p,status:f,text:v,color:h,count:y=null,overflowCount:O=99,dot:w=!1,size:E="default",title:N,offset:C,style:j,className:x,rootClassName:k,classNames:I,styles:z,showZero:B=!1}=t,P=R(t,["prefixCls","scrollNumberPrefixCls","children","status","text","color","count","overflowCount","dot","size","title","offset","style","className","rootClassName","classNames","styles","showZero"]),{getPrefixCls:D,direction:W,badge:F}=e.useContext(s.E_),Z=D("badge",b),[H,M,_]=S(Z),A=y>O?"".concat(O,"+"):y,q="0"===A||0===A,L=(null!=f||null!=h)&&(null===y||q&&!B),V=w&&!q,X=V?"":A,Y=(0,e.useMemo)(()=>(null==X||""===X||q&&!B)&&!V,[X,q,B,V]),$=(0,e.useRef)(y);Y||($.current=y);let G=$.current,J=(0,e.useRef)(X);Y||(J.current=X);let K=J.current,Q=(0,e.useRef)(V);Y||(Q.current=V);let U=(0,e.useMemo)(()=>{if(!C)return Object.assign(Object.assign({},null==F?void 0:F.style),j);let t={marginTop:C[1]};return"rtl"===W?t.left=parseInt(C[0],10):t.right=-parseInt(C[0],10),Object.assign(Object.assign(Object.assign({},t),null==F?void 0:F.style),j)},[W,C,j,null==F?void 0:F.style]),tt=null!=N?N:"string"==typeof G||"number"==typeof G?G:void 0,to=Y||!v?null:e.createElement("span",{className:"".concat(Z,"-status-text")},v),tn=G&&"object"==typeof G?(0,l.Tm)(G,t=>({style:Object.assign(Object.assign({},U),t.style)})):void 0,te=(0,c.o2)(h,!1),ta=r()(null==I?void 0:I.indicator,null===(n=null==F?void 0:F.classNames)||void 0===n?void 0:n.indicator,{["".concat(Z,"-status-dot")]:L,["".concat(Z,"-status-").concat(f)]:!!f,["".concat(Z,"-color-").concat(h)]:te}),tr={};h&&!te&&(tr.color=h,tr.background=h);let ti=r()(Z,{["".concat(Z,"-status")]:L,["".concat(Z,"-not-a-wrapper")]:!p,["".concat(Z,"-rtl")]:"rtl"===W},x,k,null==F?void 0:F.className,null===(a=null==F?void 0:F.classNames)||void 0===a?void 0:a.root,null==I?void 0:I.root,M,_);if(!p&&L){let t=U.color;return H(e.createElement("span",Object.assign({},P,{className:ti,style:Object.assign(Object.assign(Object.assign({},null==z?void 0:z.root),null===(u=null==F?void 0:F.styles)||void 0===u?void 0:u.root),U)}),e.createElement("span",{className:ta,style:Object.assign(Object.assign(Object.assign({},null==z?void 0:z.indicator),null===(d=null==F?void 0:F.styles)||void 0===d?void 0:d.indicator),tr)}),v&&e.createElement("span",{style:{color:t},className:"".concat(Z,"-status-text")},v)))}return H(e.createElement("span",Object.assign({ref:o},P,{className:ti,style:Object.assign(Object.assign({},null===(m=null==F?void 0:F.styles)||void 0===m?void 0:m.root),null==z?void 0:z.root)}),p,e.createElement(i.ZP,{visible:!Y,motionName:"".concat(Z,"-zoom"),motionAppear:!1,motionDeadline:1e3},t=>{var o,n;let{className:a,ref:i}=t,c=D("scroll-number",g),l=Q.current,s=r()(null==I?void 0:I.indicator,null===(o=null==F?void 0:F.classNames)||void 0===o?void 0:o.indicator,{["".concat(Z,"-dot")]:l,["".concat(Z,"-count")]:!l,["".concat(Z,"-count-sm")]:"small"===E,["".concat(Z,"-multiple-words")]:!l&&K&&K.toString().length>1,["".concat(Z,"-status-").concat(f)]:!!f,["".concat(Z,"-color-").concat(h)]:te}),u=Object.assign(Object.assign(Object.assign({},null==z?void 0:z.indicator),null===(n=null==F?void 0:F.styles)||void 0===n?void 0:n.indicator),U);return h&&!te&&((u=u||{}).background=h),e.createElement(T,{prefixCls:c,show:!Y,motionClassName:a,className:s,count:K,title:tt,style:u,key:"scrollNumber",ref:i},tn)}),to))});z.Ribbon=t=>{let{className:o,prefixCls:n,style:a,color:i,children:l,text:u,placement:d="end",rootClassName:m}=t,{getPrefixCls:b,direction:g}=e.useContext(s.E_),p=b("ribbon",n),f="".concat(p,"-wrapper"),[v,h,y]=j(p,f),O=(0,c.o2)(i,!1),w=r()(p,"".concat(p,"-placement-").concat(d),{["".concat(p,"-rtl")]:"rtl"===g,["".concat(p,"-color-").concat(i)]:O},o),E={},N={};return i&&!O&&(E.background=i,N.color=i),v(e.createElement("div",{className:r()(f,m,h,y)},l,e.createElement("div",{className:r()(w,h),style:Object.assign(Object.assign({},E),a)},e.createElement("span",{className:"".concat(p,"-text")},u),e.createElement("div",{className:"".concat(p,"-corner"),style:N}))))};var B=z}}]);
\ No newline at end of file
diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/4138-c37bac62b3dd3750.js b/litellm/proxy/_experimental/out/_next/static/chunks/4138-c37bac62b3dd3750.js
new file mode 100644
index 00000000000..b235de32d17
--- /dev/null
+++ b/litellm/proxy/_experimental/out/_next/static/chunks/4138-c37bac62b3dd3750.js
@@ -0,0 +1 @@
+"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4138],{71618:function(e,s,r){r.d(s,{OK:function(){return l.Z},nP:function(){return o.Z},td:function(){return n.Z},v0:function(){return a.Z},x4:function(){return i.Z},zx:function(){return t.Z}});var t=r(20831),l=r(12485),a=r(18135),n=r(35242),i=r(29706),o=r(77991)},58927:function(e,s,r){r.d(s,{J:function(){return t.Z}});var t=r(47323)},94138:function(e,s,r){r.d(s,{d:function(){return eF},o:function(){return e$}});var t=r(57437),l=r(2265),a=r(16593),n=r(52787),i=r(82680),o=r(89970),c=r(71618),d=r(49804),m=r(67101),x=r(84264),u=r(96761),h=r(12322),p=r(58927),j=r(53410),g=r(74998);let v=e=>{try{let s=e.indexOf("/mcp/");if(-1===s)return{token:null,baseUrl:e};let r=e.split("/mcp/");if(2!==r.length)return{token:null,baseUrl:e};let t=r[0]+"/mcp/",l=r[1];if(!l)return{token:null,baseUrl:e};return{token:l,baseUrl:t}}catch(s){return console.error("Error parsing MCP URL:",s),{token:null,baseUrl:e}}},f=e=>{let{token:s,baseUrl:r}=v(e);return s?r+"...":e},b=e=>{let{token:s}=v(e);return{maskedUrl:f(e),hasToken:!!s}},y=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(),N=e=>e&&e.includes("-")?Promise.reject("Server name cannot contain '-' (hyphen). Please use '_' (underscore) instead."):Promise.resolve(),_=(e,s,r,l)=>[{accessorKey:"server_id",header:"Server ID",cell:e=>{let{row:r}=e;return(0,t.jsxs)("button",{onClick:()=>s(r.original.server_id),className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left w-full truncate whitespace-nowrap cursor-pointer max-w-[15ch]",children:[r.original.server_id.slice(0,7),"..."]})}},{accessorKey:"server_name",header:"Name"},{accessorKey:"alias",header:"Alias"},{id:"url",header:"URL",cell:e=>{let{row:s}=e,{maskedUrl:r}=b(s.original.url);return(0,t.jsx)("span",{className:"font-mono text-sm",children:r})}},{accessorKey:"transport",header:"Transport",cell:e=>{let{getValue:s}=e;return(0,t.jsx)("span",{children:(s()||"http").toUpperCase()})}},{accessorKey:"auth_type",header:"Auth Type",cell:e=>{let{getValue:s}=e;return(0,t.jsx)("span",{children:s()||"none"})}},{id:"health_status",header:"Health Status",cell:e=>{let{row:s}=e,r=s.original,l=r.status||"unknown",a=r.last_health_check,n=r.health_check_error,i=(0,t.jsxs)("div",{className:"max-w-xs",children:[(0,t.jsxs)("div",{className:"font-semibold mb-1",children:["Health Status: ",l]}),a&&(0,t.jsxs)("div",{className:"text-xs mb-1",children:["Last Check: ",new Date(a).toLocaleString()]}),n&&(0,t.jsxs)("div",{className:"text-xs",children:[(0,t.jsx)("div",{className:"font-medium text-red-400 mb-1",children:"Error:"}),(0,t.jsx)("div",{className:"break-words",children:n})]}),!a&&!n&&(0,t.jsx)("div",{className:"text-xs text-gray-400",children:"No health check data available"})]});return(0,t.jsx)(o.Z,{title:i,placement:"top",children:(0,t.jsxs)("button",{className:"font-mono text-xs font-normal px-2 py-0.5 text-left w-full truncate whitespace-nowrap cursor-pointer max-w-[10ch] ".concat((e=>{switch(e){case"healthy":return"text-green-500 bg-green-50 hover:bg-green-100";case"unhealthy":return"text-red-500 bg-red-50 hover:bg-red-100";default:return"text-gray-500 bg-gray-50 hover:bg-gray-100"}})(l)),children:[(0,t.jsx)("span",{className:"mr-1",children:"●"}),l.charAt(0).toUpperCase()+l.slice(1)]})})}},{id:"mcp_access_groups",header:"Access Groups",cell:e=>{let{row:s}=e,r=s.original.mcp_access_groups;if(Array.isArray(r)&&r.length>0&&"string"==typeof r[0]){let e=r.join(", ");return(0,t.jsx)(o.Z,{title:e,children:(0,t.jsx)("span",{className:"max-w-[200px] truncate block",children:e.length>30?"".concat(e.slice(0,30),"..."):e})})}return(0,t.jsx)("span",{className:"text-gray-400 italic",children:"None"})}},{header:"Created At",accessorKey:"created_at",sortingFn:"datetime",cell:e=>{let{row:s}=e,r=s.original;return(0,t.jsx)("span",{className:"text-xs",children:r.created_at?new Date(r.created_at).toLocaleDateString():"-"})}},{header:"Updated At",accessorKey:"updated_at",sortingFn:"datetime",cell:e=>{let{row:s}=e,r=s.original;return(0,t.jsx)("span",{className:"text-xs",children:r.updated_at?new Date(r.updated_at).toLocaleDateString():"-"})}},{id:"actions",header:"Actions",cell:e=>{let{row:s}=e;return(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(p.J,{icon:j.Z,size:"sm",onClick:()=>r(s.original.server_id),className:"cursor-pointer"}),(0,t.jsx)(p.J,{icon:g.Z,size:"sm",onClick:()=>l(s.original.server_id),className:"cursor-pointer"})]})}}];var Z=r(19250),w=r(20347),C=r(10900),S=r(82376),P=r(71437),k=r(20831),A=r(12514),L=r(47323),M=r(12485),T=r(18135),I=r(35242),E=r(29706),z=r(77991);let O={NONE:"none",API_KEY:"api_key",BEARER_TOKEN:"bearer_token",BASIC:"basic"},q={SSE:"sse"},R=e=>(console.log(e),null==e)?q.SSE:e,U=e=>null==e?O.NONE:e,F=e=>U(e)!==O.NONE;var B=r(13634),K=r(73002),V=r(49566),D=r(20577),H=r(44851),G=r(33866),Y=r(62670),J=r(15424),$=r(58630),W=e=>{let{value:s={},onChange:r,tools:l=[],disabled:a=!1}=e,n=(e,t)=>{let l={...s,tool_name_to_cost_per_query:{...s.tool_name_to_cost_per_query,[e]:t}};null==r||r(l)};return(0,t.jsx)(A.Z,{children:(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-4",children:[(0,t.jsx)(Y.Z,{className:"text-green-600"}),(0,t.jsx)(u.Z,{children:"Cost Configuration"}),(0,t.jsx)(o.Z,{title:"Configure costs for this MCP server's tool calls. Set a default rate and per-tool overrides.",children:(0,t.jsx)(J.Z,{className:"text-gray-400"})})]}),(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:["Default Cost per Query ($)",(0,t.jsx)(o.Z,{title:"Default cost charged for each tool call to this server.",children:(0,t.jsx)(J.Z,{className:"ml-1 text-gray-400"})})]}),(0,t.jsx)(D.Z,{min:0,step:1e-4,precision:4,placeholder:"0.0000",value:s.default_cost_per_query,onChange:e=>{let t={...s,default_cost_per_query:e};null==r||r(t)},disabled:a,style:{width:"200px"},addonBefore:"$"}),(0,t.jsx)(x.Z,{className:"block mt-1 text-gray-500 text-sm",children:"Set a default cost for all tool calls to this server"})]}),l.length>0&&(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("label",{className:"block text-sm font-medium text-gray-700",children:["Tool-Specific Costs ($)",(0,t.jsx)(o.Z,{title:"Override the default cost for specific tools. Leave blank to use the default rate.",children:(0,t.jsx)(J.Z,{className:"ml-1 text-gray-400"})})]}),(0,t.jsx)(H.default,{items:[{key:"1",label:(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)($.Z,{className:"mr-2 text-blue-500"}),(0,t.jsx)("span",{className:"font-medium",children:"Available Tools"}),(0,t.jsx)(G.Z,{count:l.length,style:{backgroundColor:"#52c41a",marginLeft:"8px"}})]}),children:(0,t.jsx)("div",{className:"space-y-3 max-h-64 overflow-y-auto",children:l.map((e,r)=>{var l;return(0,t.jsxs)("div",{className:"flex items-center justify-between p-3 bg-gray-50 rounded-lg",children:[(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)(x.Z,{className:"font-medium text-gray-900",children:e.name}),e.description&&(0,t.jsx)(x.Z,{className:"text-gray-500 text-sm block mt-1",children:e.description})]}),(0,t.jsx)("div",{className:"ml-4",children:(0,t.jsx)(D.Z,{min:0,step:1e-4,precision:4,placeholder:"Use default",value:null===(l=s.tool_name_to_cost_per_query)||void 0===l?void 0:l[e.name],onChange:s=>n(e.name,s),disabled:a,style:{width:"120px"},addonBefore:"$"})})]},r)})})}]})]})]}),(s.default_cost_per_query||s.tool_name_to_cost_per_query&&Object.keys(s.tool_name_to_cost_per_query).length>0)&&(0,t.jsxs)("div",{className:"mt-6 p-4 bg-blue-50 border border-blue-200 rounded-lg",children:[(0,t.jsx)(x.Z,{className:"text-blue-800 font-medium",children:"Cost Summary:"}),(0,t.jsxs)("div",{className:"mt-2 space-y-1",children:[s.default_cost_per_query&&(0,t.jsxs)(x.Z,{className:"text-blue-700",children:["• Default cost: $",s.default_cost_per_query.toFixed(4)," per query"]}),s.tool_name_to_cost_per_query&&Object.entries(s.tool_name_to_cost_per_query).map(e=>{let[s,r]=e;return null!=r&&(0,t.jsxs)(x.Z,{className:"text-blue-700",children:["• ",s,": $",r.toFixed(4)," per query"]},s)})]})]})]})})};let{Panel:Q}=H.default;var X=e=>{let{availableAccessGroups:s,mcpServer:r,searchValue:a,setSearchValue:i,getAccessGroupOptions:c}=e,d=B.Z.useFormInstance();return(0,l.useEffect)(()=>{r&&r.extra_headers&&d.setFieldValue("extra_headers",r.extra_headers)},[r,d]),(0,t.jsx)(H.default,{className:"bg-gray-50 border border-gray-200 rounded-lg",expandIconPosition:"end",ghost:!1,children:(0,t.jsx)(Q,{header:(0,t.jsxs)("div",{className:"flex items-center",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)("h3",{className:"text-lg font-semibold text-gray-900",children:"Permission Management / Access Control"})]}),(0,t.jsx)("p",{className:"text-sm text-gray-600 ml-4",children:"Configure access permissions and security settings (Optional)"})]}),className:"border-0",children:(0,t.jsxs)("div",{className:"space-y-6 pt-4",children:[(0,t.jsx)(B.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["MCP Access Groups",(0,t.jsx)(o.Z,{title:"Specify access groups for this MCP server. Users must be in at least one of these groups to access the server.",children:(0,t.jsx)(J.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"mcp_access_groups",className:"mb-4",children:(0,t.jsx)(n.default,{mode:"tags",showSearch:!0,placeholder:"Select existing groups or type to create new ones",optionFilterProp:"value",filterOption:(e,s)=>{var r;return(null!==(r=null==s?void 0:s.value)&&void 0!==r?r:"").toLowerCase().includes(e.toLowerCase())},onSearch:e=>i(e),tokenSeparators:[","],options:c(),maxTagCount:"responsive",allowClear:!0})}),(0,t.jsx)(B.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Extra Headers",(0,t.jsx)(o.Z,{title:"Forward custom headers from incoming requests to this MCP server (e.g., Authorization, X-Custom-Header, User-Agent)",children:(0,t.jsx)(J.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})}),(null==r?void 0:r.extra_headers)&&r.extra_headers.length>0&&(0,t.jsxs)("span",{className:"ml-2 text-xs bg-blue-100 text-blue-700 px-2 py-1 rounded-full",children:[r.extra_headers.length," configured"]})]}),name:"extra_headers",children:(0,t.jsx)(n.default,{mode:"tags",placeholder:(null==r?void 0:r.extra_headers)&&r.extra_headers.length>0?"Currently: ".concat(r.extra_headers.join(", ")):"Enter header names (e.g., Authorization, X-Custom-Header)",className:"rounded-lg",size:"large",tokenSeparators:[","],allowClear:!0})})]})},"permissions")})},ee=r(83669),es=r(87908),er=r(61994);let et=e=>{let{accessToken:s,formValues:r,enabled:t=!0}=e,[a,n]=(0,l.useState)([]),[i,o]=(0,l.useState)(!1),[c,d]=(0,l.useState)(null),[m,x]=(0,l.useState)(!1),u=!!(r.url&&r.transport&&r.auth_type&&s),h=async()=>{if(s&&r.url){o(!0),d(null);try{let e={server_id:r.server_id||"",server_name:r.server_name||"",url:r.url,transport:r.transport,auth_type:r.auth_type,mcp_info:r.mcp_info},t=await (0,Z.testMCPToolsListRequest)(s,e);if(t.tools&&!t.error)n(t.tools),d(null),t.tools.length>0&&!m&&x(!0);else{let e=t.message||"Failed to retrieve tools list";d(e),n([]),x(!1)}}catch(e){console.error("Tools fetch error:",e),d(e instanceof Error?e.message:String(e)),n([]),x(!1)}finally{o(!1)}}},p=()=>{n([]),d(null),x(!1)};return(0,l.useEffect)(()=>{t&&(u?h():p())},[r.url,r.transport,r.auth_type,s,t,u]),{tools:a,isLoadingTools:i,toolsError:c,hasShownSuccessMessage:m,canFetchTools:u,fetchTools:h,clearTools:p}};var el=e=>{let{accessToken:s,formValues:r,allowedTools:a,existingAllowedTools:n,onAllowedToolsChange:i}=e,o=(0,l.useRef)(0),{tools:c,isLoadingTools:d,toolsError:m,canFetchTools:h}=et({accessToken:s,formValues:r,enabled:!0});(0,l.useEffect)(()=>{if(c.length>0&&c.length!==o.current&&0===a.length){if(n&&n.length>0){let e=c.map(e=>e.name);i(n.filter(s=>e.includes(s)))}else i(c.map(e=>e.name))}o.current=c.length},[c,a.length,n,i]);let p=e=>{a.includes(e)?i(a.filter(s=>s!==e)):i([...a,e])};return h||r.url?(0,t.jsx)(A.Z,{children:(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)("div",{className:"flex items-center justify-between",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)($.Z,{className:"text-blue-600"}),(0,t.jsx)(u.Z,{children:"Tool Configuration"}),c.length>0&&(0,t.jsx)(G.Z,{count:c.length,style:{backgroundColor:"#52c41a"}})]})}),(0,t.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-3",children:(0,t.jsxs)(x.Z,{className:"text-blue-800 text-sm",children:[(0,t.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."]})}),d&&(0,t.jsxs)("div",{className:"flex items-center justify-center py-6",children:[(0,t.jsx)(es.Z,{size:"large"}),(0,t.jsx)(x.Z,{className:"ml-3",children:"Loading tools..."})]}),m&&!d&&(0,t.jsxs)("div",{className:"text-center py-6 text-red-500 border rounded-lg border-dashed border-red-300 bg-red-50",children:[(0,t.jsx)($.Z,{className:"text-2xl mb-2"}),(0,t.jsx)(x.Z,{className:"text-red-600 font-medium",children:"Unable to load tools"}),(0,t.jsx)("br",{}),(0,t.jsx)(x.Z,{className:"text-sm text-red-500",children:m})]}),!d&&!m&&0===c.length&&h&&(0,t.jsxs)("div",{className:"text-center py-6 text-gray-400 border rounded-lg border-dashed",children:[(0,t.jsx)($.Z,{className:"text-2xl mb-2"}),(0,t.jsx)(x.Z,{children:"No tools available for configuration"}),(0,t.jsx)("br",{}),(0,t.jsx)(x.Z,{className:"text-sm",children:"Connect to an MCP server with tools to configure them"})]}),!h&&r.url&&(0,t.jsxs)("div",{className:"text-center py-6 text-gray-400 border rounded-lg border-dashed",children:[(0,t.jsx)($.Z,{className:"text-2xl mb-2"}),(0,t.jsx)(x.Z,{children:"Complete required fields to configure tools"}),(0,t.jsx)("br",{}),(0,t.jsx)(x.Z,{className:"text-sm",children:"Fill in URL, Transport, and Authentication to load available tools"})]}),!d&&!m&&c.length>0&&(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 p-3 bg-green-50 rounded-lg border border-green-200 flex-1",children:[(0,t.jsx)(ee.Z,{className:"text-green-600"}),(0,t.jsxs)(x.Z,{className:"text-green-700 font-medium",children:[a.length," of ",c.length," ",1===c.length?"tool":"tools"," enabled for user access"]})]}),(0,t.jsxs)("div",{className:"flex gap-2 ml-3",children:[(0,t.jsx)("button",{type:"button",onClick:()=>{i(c.map(e=>e.name))},className:"px-3 py-1.5 text-sm text-blue-600 hover:text-blue-700 hover:bg-blue-50 rounded-md transition-colors",children:"Enable All"}),(0,t.jsx)("button",{type:"button",onClick:()=>{i([])},className:"px-3 py-1.5 text-sm text-gray-600 hover:text-gray-700 hover:bg-gray-100 rounded-md transition-colors",children:"Disable All"})]})]}),(0,t.jsx)("div",{className:"space-y-2",children:c.map((e,s)=>(0,t.jsx)("div",{className:"p-4 rounded-lg border transition-colors cursor-pointer ".concat(a.includes(e.name)?"bg-blue-50 border-blue-300 hover:border-blue-400":"bg-gray-50 border-gray-200 hover:border-gray-300"),onClick:()=>p(e.name),children:(0,t.jsxs)("div",{className:"flex items-start gap-3",children:[(0,t.jsx)(er.Z,{checked:a.includes(e.name),onChange:()=>p(e.name)}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(x.Z,{className:"font-medium text-gray-900",children:e.name}),(0,t.jsx)("span",{className:"px-2 py-0.5 text-xs rounded-full font-medium ".concat(a.includes(e.name)?"bg-green-100 text-green-800":"bg-red-100 text-red-800"),children:a.includes(e.name)?"Enabled":"Disabled"})]}),e.description&&(0,t.jsx)(x.Z,{className:"text-gray-500 text-sm block mt-1",children:e.description}),(0,t.jsx)(x.Z,{className:"text-gray-400 text-xs block mt-1",children:a.includes(e.name)?"✓ Users can call this tool":"✗ Users cannot call this tool"})]})]})},s))})]})]})}):null},ea=r(9114),en=e=>{let{mcpServer:s,accessToken:r,onCancel:a,onSuccess:i,availableAccessGroups:o}=e,[c]=B.Z.useForm(),[d,m]=(0,l.useState)({}),[x,u]=(0,l.useState)([]),[h,p]=(0,l.useState)(!1),[j,g]=(0,l.useState)(""),[v,f]=(0,l.useState)(!1),[b,_]=(0,l.useState)([]);(0,l.useEffect)(()=>{var e;(null===(e=s.mcp_info)||void 0===e?void 0:e.mcp_server_cost_info)&&m(s.mcp_info.mcp_server_cost_info)},[s]),(0,l.useEffect)(()=>{s.allowed_tools&&_(s.allowed_tools)},[s]),(0,l.useEffect)(()=>{if(s.mcp_access_groups){let e=s.mcp_access_groups.map(e=>"string"==typeof e?e:e.name||String(e));c.setFieldValue("mcp_access_groups",e)}},[s]),(0,l.useEffect)(()=>{w()},[s,r]);let w=async()=>{if(r&&s.url){p(!0);try{let e={server_id:s.server_id,server_name:s.server_name,url:s.url,transport:s.transport,auth_type:s.auth_type,mcp_info:s.mcp_info},t=await (0,Z.testMCPToolsListRequest)(r,e);t.tools&&!t.error?u(t.tools):(console.error("Failed to fetch tools:",t.message),u([]))}catch(e){console.error("Tools fetch error:",e),u([])}finally{p(!1)}}},C=async e=>{if(r)try{let t=(e.mcp_access_groups||[]).map(e=>"string"==typeof e?e:e.name||String(e)),l={...e,server_id:s.server_id,mcp_info:{server_name:e.server_name||e.url,description:e.description,mcp_server_cost_info:Object.keys(d).length>0?d:null},mcp_access_groups:t,alias:e.alias,extra_headers:e.extra_headers||[],allowed_tools:b.length>0?b:null,disallowed_tools:e.disallowed_tools||[]},a=await (0,Z.updateMCPServer)(r,l);ea.Z.success("MCP Server updated successfully"),i(a)}catch(e){ea.Z.fromBackend("Failed to update MCP Server"+((null==e?void 0:e.message)?": ".concat(e.message):""))}};return(0,t.jsxs)(T.Z,{children:[(0,t.jsxs)(I.Z,{className:"grid w-full grid-cols-2",children:[(0,t.jsx)(M.Z,{children:"Server Configuration"}),(0,t.jsx)(M.Z,{children:"Cost Configuration"})]}),(0,t.jsxs)(z.Z,{className:"mt-6",children:[(0,t.jsx)(E.Z,{children:(0,t.jsxs)(B.Z,{form:c,onFinish:C,initialValues:s,layout:"vertical",children:[(0,t.jsx)(B.Z.Item,{label:"MCP Server Name",name:"server_name",rules:[{validator:(e,s)=>N(s)}],children:(0,t.jsx)(V.Z,{})}),(0,t.jsx)(B.Z.Item,{label:"Alias",name:"alias",rules:[{validator:(e,s)=>N(s)}],children:(0,t.jsx)(V.Z,{onChange:()=>f(!0)})}),(0,t.jsx)(B.Z.Item,{label:"Description",name:"description",children:(0,t.jsx)(V.Z,{})}),(0,t.jsx)(B.Z.Item,{label:"MCP Server URL",name:"url",rules:[{required:!0,message:"Please enter a server URL"},{validator:(e,s)=>y(s)}],children:(0,t.jsx)(V.Z,{})}),(0,t.jsx)(B.Z.Item,{label:"Transport Type",name:"transport",rules:[{required:!0}],children:(0,t.jsxs)(n.default,{children:[(0,t.jsx)(n.default.Option,{value:"sse",children:"Server-Sent Events (SSE)"}),(0,t.jsx)(n.default.Option,{value:"http",children:"HTTP"})]})}),(0,t.jsx)(B.Z.Item,{label:"Authentication",name:"auth_type",rules:[{required:!0}],children:(0,t.jsxs)(n.default,{children:[(0,t.jsx)(n.default.Option,{value:"none",children:"None"}),(0,t.jsx)(n.default.Option,{value:"api_key",children:"API Key"}),(0,t.jsx)(n.default.Option,{value:"bearer_token",children:"Bearer Token"}),(0,t.jsx)(n.default.Option,{value:"basic",children:"Basic Auth"})]})}),(0,t.jsx)("div",{className:"mt-6",children:(0,t.jsx)(X,{availableAccessGroups:o,mcpServer:s,searchValue:j,setSearchValue:g,getAccessGroupOptions:()=>{let e=o.map(e=>({value:e,label:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),(0,t.jsx)("span",{className:"font-medium",children:e})]})}));return j&&!o.some(e=>e.toLowerCase().includes(j.toLowerCase()))&&e.push({value:j,label:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"w-2 h-2 bg-blue-500 rounded-full"}),(0,t.jsx)("span",{className:"font-medium",children:j}),(0,t.jsx)("span",{className:"text-gray-400 text-xs ml-1",children:"create new group"})]})}),e}})}),(0,t.jsx)("div",{className:"mt-6",children:(0,t.jsx)(el,{accessToken:r,formValues:{server_id:s.server_id,server_name:s.server_name,url:s.url,transport:s.transport,auth_type:s.auth_type,mcp_info:s.mcp_info},allowedTools:b,existingAllowedTools:s.allowed_tools||null,onAllowedToolsChange:_})}),(0,t.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,t.jsx)(K.ZP,{onClick:a,children:"Cancel"}),(0,t.jsx)(k.Z,{type:"submit",children:"Save Changes"})]})]})}),(0,t.jsx)(E.Z,{children:(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsx)(W,{value:d,onChange:m,tools:x,disabled:h}),(0,t.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,t.jsx)(K.ZP,{onClick:a,children:"Cancel"}),(0,t.jsx)(k.Z,{onClick:()=>c.submit(),children:"Save Changes"})]})]})})]})]})},ei=r(92280),eo=e=>{let{costConfig:s}=e,r=(null==s?void 0:s.default_cost_per_query)!==void 0&&(null==s?void 0:s.default_cost_per_query)!==null,l=(null==s?void 0:s.tool_name_to_cost_per_query)&&Object.keys(s.tool_name_to_cost_per_query).length>0;return r||l?(0,t.jsx)("div",{className:"mt-6 pt-6 border-t border-gray-200",children:(0,t.jsxs)("div",{className:"space-y-4",children:[r&&(null==s?void 0:s.default_cost_per_query)!==void 0&&(null==s?void 0:s.default_cost_per_query)!==null&&(0,t.jsxs)("div",{children:[(0,t.jsx)(ei.x,{className:"font-medium",children:"Default Cost per Query"}),(0,t.jsxs)("div",{className:"text-green-600 font-mono",children:["$",s.default_cost_per_query.toFixed(4)]})]}),l&&(null==s?void 0:s.tool_name_to_cost_per_query)&&(0,t.jsxs)("div",{children:[(0,t.jsx)(ei.x,{className:"font-medium",children:"Tool-Specific Costs"}),(0,t.jsx)("div",{className:"mt-2 space-y-2",children:Object.entries(s.tool_name_to_cost_per_query).map(e=>{let[s,r]=e;return null!=r&&(0,t.jsxs)("div",{className:"flex justify-between items-center p-3 bg-gray-50 rounded-lg",children:[(0,t.jsx)(ei.x,{className:"font-medium",children:s}),(0,t.jsxs)(ei.x,{className:"text-green-600 font-mono",children:["$",r.toFixed(4)," per query"]})]},s)})})]}),(0,t.jsxs)("div",{className:"mt-4 p-4 bg-blue-50 border border-blue-200 rounded-lg",children:[(0,t.jsx)(ei.x,{className:"text-blue-800 font-medium",children:"Cost Summary:"}),(0,t.jsxs)("div",{className:"mt-2 space-y-1",children:[r&&(null==s?void 0:s.default_cost_per_query)!==void 0&&(null==s?void 0:s.default_cost_per_query)!==null&&(0,t.jsxs)(ei.x,{className:"text-blue-700",children:["• Default cost: $",s.default_cost_per_query.toFixed(4)," per query"]}),l&&(null==s?void 0:s.tool_name_to_cost_per_query)&&(0,t.jsxs)(ei.x,{className:"text-blue-700",children:["• ",Object.keys(s.tool_name_to_cost_per_query).length," tool(s) with custom pricing"]})]})]})]})}):(0,t.jsx)("div",{className:"mt-6 pt-6 border-t border-gray-200",children:(0,t.jsx)("div",{className:"space-y-4",children:(0,t.jsx)("div",{className:"p-4 bg-gray-50 border border-gray-200 rounded-lg",children:(0,t.jsx)(ei.x,{className:"text-gray-600",children:"No cost configuration set for this server. Tool calls will be charged at $0.00 per tool call."})})})})},ec=r(59872),ed=r(30401),em=r(78867);let ex=e=>{var s,r,a,n,i;let{mcpServer:o,onBack:c,isEditing:d,isProxyAdmin:h,accessToken:p,userRole:j,userID:g,availableAccessGroups:v}=e,[f,y]=(0,l.useState)(d),[N,_]=(0,l.useState)(!1),[Z,w]=(0,l.useState)({}),{maskedUrl:O,hasToken:q}=b(o.url),F=(e,s)=>q?s?e:O:e,B=async(e,s)=>{await (0,ec.vQ)(e)&&(w(e=>({...e,[s]:!0})),setTimeout(()=>{w(e=>({...e,[s]:!1}))},2e3))};return(0,t.jsxs)("div",{className:"p-4 max-w-full",children:[(0,t.jsx)("div",{className:"flex justify-between items-center mb-6",children:(0,t.jsxs)("div",{children:[(0,t.jsx)(k.Z,{icon:C.Z,variant:"light",className:"mb-4",onClick:c,children:"Back to All Servers"}),(0,t.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,t.jsx)(u.Z,{children:o.server_name}),(0,t.jsx)(K.ZP,{type:"text",size:"small",icon:Z["mcp-server_name"]?(0,t.jsx)(ed.Z,{size:12}):(0,t.jsx)(em.Z,{size:12}),onClick:()=>B(o.server_name,"mcp-server_name"),className:"left-2 z-10 transition-all duration-200 ".concat(Z["mcp-server_name"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")}),o.alias&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"ml-4 text-gray-500",children:"Alias:"}),(0,t.jsx)("span",{className:"ml-1 font-mono text-blue-600",children:o.alias}),(0,t.jsx)(K.ZP,{type:"text",size:"small",icon:Z["mcp-alias"]?(0,t.jsx)(ed.Z,{size:12}):(0,t.jsx)(em.Z,{size:12}),onClick:()=>B(o.alias,"mcp-alias"),className:"left-2 z-10 transition-all duration-200 ".concat(Z["mcp-alias"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]})]}),(0,t.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,t.jsx)(x.Z,{className:"text-gray-500 font-mono",children:o.server_id}),(0,t.jsx)(K.ZP,{type:"text",size:"small",icon:Z["mcp-server-id"]?(0,t.jsx)(ed.Z,{size:12}):(0,t.jsx)(em.Z,{size:12}),onClick:()=>B(o.server_id,"mcp-server-id"),className:"left-2 z-10 transition-all duration-200 ".concat(Z["mcp-server-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]})]})}),(0,t.jsxs)(T.Z,{defaultIndex:f?2:0,children:[(0,t.jsx)(I.Z,{className:"mb-4",children:[(0,t.jsx)(M.Z,{children:"Overview"},"overview"),(0,t.jsx)(M.Z,{children:"MCP Tools"},"tools"),...h?[(0,t.jsx)(M.Z,{children:"Settings"},"settings")]:[]]}),(0,t.jsxs)(z.Z,{children:[(0,t.jsxs)(E.Z,{children:[(0,t.jsxs)(m.Z,{numItems:1,numItemsSm:2,numItemsLg:3,className:"gap-6",children:[(0,t.jsxs)(A.Z,{children:[(0,t.jsx)(x.Z,{children:"Transport"}),(0,t.jsx)("div",{className:"mt-2",children:(0,t.jsx)(u.Z,{children:R(null!==(n=o.transport)&&void 0!==n?n:void 0)})})]}),(0,t.jsxs)(A.Z,{children:[(0,t.jsx)(x.Z,{children:"Auth Type"}),(0,t.jsx)("div",{className:"mt-2",children:(0,t.jsx)(x.Z,{children:U(null!==(i=o.auth_type)&&void 0!==i?i:void 0)})})]}),(0,t.jsxs)(A.Z,{children:[(0,t.jsx)(x.Z,{children:"Host Url"}),(0,t.jsxs)("div",{className:"mt-2 flex items-center gap-2",children:[(0,t.jsx)(x.Z,{className:"break-all overflow-wrap-anywhere",children:F(o.url,N)}),q&&(0,t.jsx)("button",{onClick:()=>_(!N),className:"p-1 hover:bg-gray-100 rounded",children:(0,t.jsx)(L.Z,{icon:N?S.Z:P.Z,size:"sm",className:"text-gray-500"})})]})]})]}),(0,t.jsxs)(A.Z,{className:"mt-2",children:[(0,t.jsx)(u.Z,{children:"Cost Configuration"}),(0,t.jsx)(eo,{costConfig:null===(s=o.mcp_info)||void 0===s?void 0:s.mcp_server_cost_info})]})]}),(0,t.jsx)(E.Z,{children:(0,t.jsx)(e$,{serverId:o.server_id,accessToken:p,auth_type:o.auth_type,userRole:j,userID:g,serverAlias:o.alias})}),(0,t.jsx)(E.Z,{children:(0,t.jsxs)(A.Z,{children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,t.jsx)(u.Z,{children:"MCP Server Settings"}),f?null:(0,t.jsx)(k.Z,{variant:"light",onClick:()=>y(!0),children:"Edit Settings"})]}),f?(0,t.jsx)(en,{mcpServer:o,accessToken:p,onCancel:()=>y(!1),onSuccess:e=>{y(!1),c()},availableAccessGroups:v}):(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(x.Z,{className:"font-medium",children:"Server Name"}),(0,t.jsx)("div",{children:o.server_name})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(x.Z,{className:"font-medium",children:"Alias"}),(0,t.jsx)("div",{children:o.alias})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(x.Z,{className:"font-medium",children:"Description"}),(0,t.jsx)("div",{children:o.description})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(x.Z,{className:"font-medium",children:"URL"}),(0,t.jsxs)("div",{className:"font-mono break-all overflow-wrap-anywhere max-w-full flex items-center gap-2",children:[F(o.url,N),q&&(0,t.jsx)("button",{onClick:()=>_(!N),className:"p-1 hover:bg-gray-100 rounded",children:(0,t.jsx)(L.Z,{icon:N?S.Z:P.Z,size:"sm",className:"text-gray-500"})})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(x.Z,{className:"font-medium",children:"Transport"}),(0,t.jsx)("div",{children:R(o.transport)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(x.Z,{className:"font-medium",children:"Extra Headers"}),(0,t.jsx)("div",{children:null===(r=o.extra_headers)||void 0===r?void 0:r.join(", ")})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(x.Z,{className:"font-medium",children:"Auth Type"}),(0,t.jsx)("div",{children:U(o.auth_type)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(x.Z,{className:"font-medium",children:"Access Groups"}),(0,t.jsx)("div",{children:o.mcp_access_groups&&o.mcp_access_groups.length>0?(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:o.mcp_access_groups.map((e,s)=>{var r;return(0,t.jsx)("span",{className:"px-2 py-1 bg-gray-100 rounded-md text-sm",children:"string"==typeof e?e:null!==(r=null==e?void 0:e.name)&&void 0!==r?r:""},s)})}):(0,t.jsx)(x.Z,{className:"text-gray-500",children:"No access groups defined"})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(x.Z,{className:"font-medium",children:"Allowed Tools"}),(0,t.jsx)("div",{children:o.allowed_tools&&o.allowed_tools.length>0?(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:o.allowed_tools.map((e,s)=>(0,t.jsx)("span",{className:"px-2 py-1 bg-blue-50 border border-blue-200 rounded-md text-sm",children:e},s))}):(0,t.jsx)(x.Z,{className:"text-gray-500",children:"All tools enabled"})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(x.Z,{className:"font-medium",children:"Cost Configuration"}),(0,t.jsx)(eo,{costConfig:null===(a=o.mcp_info)||void 0===a?void 0:a.mcp_server_cost_info})]})]})]})})]})]})]})};var eu=r(64504),eh=r(61778),ep=r(29271),ej=r(89245),eg=e=>{let{accessToken:s,formValues:r,onToolsLoaded:a}=e,{tools:n,isLoadingTools:i,toolsError:o,canFetchTools:c,fetchTools:d}=et({accessToken:s,formValues:r,enabled:!0});return((0,l.useEffect)(()=>{null==a||a(n)},[n,a]),c||r.url)?(0,t.jsx)(A.Z,{children:(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(ee.Z,{className:"text-blue-600"}),(0,t.jsx)(u.Z,{children:"Connection Status"})]}),!c&&r.url&&(0,t.jsxs)("div",{className:"text-center py-6 text-gray-400 border rounded-lg border-dashed",children:[(0,t.jsx)($.Z,{className:"text-2xl mb-2"}),(0,t.jsx)(x.Z,{children:"Complete required fields to test connection"}),(0,t.jsx)("br",{}),(0,t.jsx)(x.Z,{className:"text-sm",children:"Fill in URL, Transport, and Authentication to test MCP server connection"})]}),c&&(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(x.Z,{className:"text-gray-700 font-medium",children:i?"Testing connection to MCP server...":n.length>0?"Connection successful":o?"Connection failed":"Ready to test connection"}),(0,t.jsx)("br",{}),(0,t.jsxs)(x.Z,{className:"text-gray-500 text-sm",children:["Server: ",r.url]})]}),i&&(0,t.jsxs)("div",{className:"flex items-center text-blue-600",children:[(0,t.jsx)(es.Z,{size:"small",className:"mr-2"}),(0,t.jsx)(x.Z,{className:"text-blue-600",children:"Connecting..."})]}),!i&&!o&&n.length>0&&(0,t.jsxs)("div",{className:"flex items-center text-green-600",children:[(0,t.jsx)(ee.Z,{className:"mr-1"}),(0,t.jsx)(x.Z,{className:"text-green-600 font-medium",children:"Connected"})]}),o&&(0,t.jsxs)("div",{className:"flex items-center text-red-600",children:[(0,t.jsx)(ep.Z,{className:"mr-1"}),(0,t.jsx)(x.Z,{className:"text-red-600 font-medium",children:"Failed"})]})]}),i&&(0,t.jsxs)("div",{className:"flex items-center justify-center py-6",children:[(0,t.jsx)(es.Z,{size:"large"}),(0,t.jsx)(x.Z,{className:"ml-3",children:"Testing connection and loading tools..."})]}),o&&(0,t.jsx)(eh.Z,{message:"Connection Failed",description:o,type:"error",showIcon:!0,action:(0,t.jsx)(K.ZP,{icon:(0,t.jsx)(ej.Z,{}),onClick:d,size:"small",children:"Retry"})}),!i&&0===n.length&&!o&&(0,t.jsxs)("div",{className:"text-center py-6 text-gray-500 border rounded-lg border-dashed",children:[(0,t.jsx)(ee.Z,{className:"text-2xl mb-2 text-green-500"}),(0,t.jsx)(x.Z,{className:"text-green-600 font-medium",children:"Connection successful!"}),(0,t.jsx)("br",{}),(0,t.jsx)(x.Z,{className:"text-gray-500",children:"No tools found for this MCP server"})]})]})]})}):null},ev=r(64482),ef=e=>{let{isVisible:s}=e;return s?(0,t.jsx)(B.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Stdio Configuration (JSON)",(0,t.jsx)(o.Z,{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,t.jsx)(J.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"stdio_config",rules:[{required:!0,message:"Please enter stdio configuration"},{validator:(e,s)=>{if(!s)return Promise.resolve();try{return JSON.parse(s),Promise.resolve()}catch(e){return Promise.reject("Please enter valid JSON")}}}],children:(0,t.jsx)(ev.default.TextArea,{placeholder:'{\n "mcpServers": {\n "circleci-mcp-server": {\n "command": "npx",\n "args": ["-y", "@circleci/mcp-server-circleci"],\n "env": {\n "CIRCLECI_TOKEN": "your-circleci-token",\n "CIRCLECI_BASE_URL": "https://circleci.com"\n }\n }\n }\n}',rows:12,className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500 font-mono text-sm"})}):null};let eb="".concat("../ui/assets/logos/","mcp_logo.png");var ey=e=>{let{userRole:s,accessToken:r,onCreateSuccess:a,isModalVisible:c,setModalVisible:d,availableAccessGroups:m}=e,[x]=B.Z.useForm(),[u,h]=(0,l.useState)(!1),[p,j]=(0,l.useState)({}),[g,v]=(0,l.useState)({}),[f,b]=(0,l.useState)(!1),[_,C]=(0,l.useState)([]),[S,P]=(0,l.useState)([]),[k,A]=(0,l.useState)(""),[L,M]=(0,l.useState)(""),[T,I]=(0,l.useState)(""),E=(e,s)=>{if(!e){I("");return}"sse"!==s||e.endsWith("/sse")?"http"!==s||e.endsWith("/mcp")?I(""):I("Typically MCP HTTP URLs end with /mcp. You can add this url but this is a warning."):I("Typically MCP SSE URLs end with /sse. You can add this url but this is a warning.")},z=async e=>{h(!0);try{let s=e.mcp_access_groups,t={};if(e.stdio_config&&"stdio"===k)try{let s=JSON.parse(e.stdio_config),r=s;if(s.mcpServers&&"object"==typeof s.mcpServers){let t=Object.keys(s.mcpServers);if(t.length>0){let l=t[0];r=s.mcpServers[l],e.server_name||(e.server_name=l.replace(/-/g,"_"))}}t={command:r.command,args:r.args,env:r.env},console.log("Parsed stdio config:",t)}catch(e){ea.Z.fromBackend("Invalid JSON in stdio configuration");return}let l={...e,...t,stdio_config:void 0,mcp_info:{server_name:e.server_name||e.url,description:e.description,mcp_server_cost_info:Object.keys(p).length>0?p:null},mcp_access_groups:s,alias:e.alias,allowed_tools:S.length>0?S:null};if(console.log("Payload: ".concat(JSON.stringify(l))),null!=r){let e=await (0,Z.createMCPServer)(r,l);ea.Z.success("MCP Server created successfully"),x.resetFields(),j({}),C([]),P([]),I(""),b(!1),d(!1),a(e)}}catch(e){ea.Z.fromBackend("Error creating MCP Server: "+e)}finally{h(!1)}},O=()=>{x.resetFields(),j({}),C([]),P([]),I(""),b(!1),d(!1)};return(l.useEffect(()=>{if(!f&&g.server_name){let e=g.server_name.replace(/\s+/g,"_");x.setFieldsValue({alias:e}),v(s=>({...s,alias:e}))}},[g.server_name]),l.useEffect(()=>{c||v({})},[c]),(0,w.tY)(s))?(0,t.jsx)(i.Z,{title:(0,t.jsxs)("div",{className:"flex items-center space-x-3 pb-4 border-b border-gray-100",children:[(0,t.jsx)("img",{src:eb,alt:"MCP Logo",className:"w-8 h-8 object-contain",style:{height:"20px",width:"20px",marginRight:"8px",objectFit:"contain"}}),(0,t.jsx)("h2",{className:"text-xl font-semibold text-gray-900",children:"Add New MCP Server"})]}),open:c,width:1e3,onCancel:O,footer:null,className:"top-8",styles:{body:{padding:"24px"},header:{padding:"24px 24px 0 24px",border:"none"}},children:(0,t.jsx)("div",{className:"mt-6",children:(0,t.jsxs)(B.Z,{form:x,onFinish:z,onValuesChange:(e,s)=>v(s),layout:"vertical",className:"space-y-6",children:[(0,t.jsxs)("div",{className:"grid grid-cols-1 gap-6",children:[(0,t.jsx)(B.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["MCP Server Name",(0,t.jsx)(o.Z,{title:"Best practice: Use a descriptive name that indicates the server's purpose (e.g., 'GitHub_MCP', 'Email_Service'). Hyphens '-' are not allowed; use underscores '_' instead.",children:(0,t.jsx)(J.Z,{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)=>N(s)}],children:(0,t.jsx)(eu.o,{placeholder:"e.g., GitHub_MCP, Zapier_MCP, etc.",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,t.jsx)(B.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Alias",(0,t.jsx)(o.Z,{title:"A short, unique identifier for this server. Defaults to the server name with spaces replaced by underscores.",children:(0,t.jsx)(J.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"alias",rules:[{required:!1},{validator:(e,s)=>s&&s.includes("-")?Promise.reject("Alias cannot contain '-' (hyphen). Please use '_' (underscore) instead."):Promise.resolve()}],children:(0,t.jsx)(eu.o,{placeholder:"e.g., GitHub_MCP, Zapier_MCP, etc.",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500",onChange:()=>b(!0)})}),(0,t.jsx)(B.Z.Item,{label:(0,t.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,t.jsx)(eu.o,{placeholder:"Brief description of what this server does",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,t.jsx)(B.Z.Item,{label:(0,t.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,t.jsxs)(n.default,{placeholder:"Select transport",className:"rounded-lg",size:"large",onChange:e=>{if(A(e),"stdio"===e)x.setFieldsValue({url:void 0,auth_type:void 0}),I("");else{x.setFieldsValue({command:void 0,args:void 0,env:void 0});let s=x.getFieldValue("url");s&&E(s,e)}},value:k,children:[(0,t.jsx)(n.default.Option,{value:"http",children:"HTTP"}),(0,t.jsx)(n.default.Option,{value:"sse",children:"Server-Sent Events (SSE)"}),(0,t.jsx)(n.default.Option,{value:"stdio",children:"Standard Input/Output (stdio)"})]})}),"stdio"!==k&&(0,t.jsx)(B.Z.Item,{label:(0,t.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)=>y(s)}],children:(0,t.jsxs)("div",{children:[(0,t.jsx)(eu.o,{placeholder:"https://your-mcp-server.com",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500",onChange:e=>E(e.target.value,k)}),T&&(0,t.jsx)("div",{className:"mt-1 text-red-500 text-sm font-medium",children:T})]})}),"stdio"!==k&&(0,t.jsx)(B.Z.Item,{label:(0,t.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Authentication"}),name:"auth_type",rules:[{required:!0,message:"Please select an auth type"}],children:(0,t.jsxs)(n.default,{placeholder:"Select auth type",className:"rounded-lg",size:"large",children:[(0,t.jsx)(n.default.Option,{value:"none",children:"None"}),(0,t.jsx)(n.default.Option,{value:"api_key",children:"API Key"}),(0,t.jsx)(n.default.Option,{value:"bearer_token",children:"Bearer Token"}),(0,t.jsx)(n.default.Option,{value:"basic",children:"Basic Auth"})]})}),(0,t.jsx)(ef,{isVisible:"stdio"===k})]}),(0,t.jsx)("div",{className:"mt-8",children:(0,t.jsx)(X,{availableAccessGroups:m,mcpServer:null,searchValue:L,setSearchValue:M,getAccessGroupOptions:()=>{let e=m.map(e=>({value:e,label:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),(0,t.jsx)("span",{className:"font-medium",children:e})]})}));return L&&!m.some(e=>e.toLowerCase().includes(L.toLowerCase()))&&e.push({value:L,label:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"w-2 h-2 bg-blue-500 rounded-full"}),(0,t.jsx)("span",{className:"font-medium",children:L}),(0,t.jsx)("span",{className:"text-gray-400 text-xs ml-1",children:"create new group"})]})}),e}})}),(0,t.jsx)("div",{className:"mt-8 pt-6 border-t border-gray-200",children:(0,t.jsx)(eg,{accessToken:r,formValues:g,onToolsLoaded:C})}),(0,t.jsx)("div",{className:"mt-6",children:(0,t.jsx)(el,{accessToken:r,formValues:g,allowedTools:S,existingAllowedTools:null,onAllowedToolsChange:P})}),(0,t.jsx)("div",{className:"mt-6",children:(0,t.jsx)(W,{value:p,onChange:j,tools:_.filter(e=>S.includes(e.name)),disabled:!1})}),(0,t.jsxs)("div",{className:"flex items-center justify-end space-x-3 pt-6 border-t border-gray-100",children:[(0,t.jsx)(eu.z,{variant:"secondary",onClick:O,children:"Cancel"}),(0,t.jsx)(eu.z,{variant:"primary",loading:u,children:u?"Creating...":"Add MCP Server"})]})]})})}):null},eN=r(93192),e_=r(67960),eZ=r(63709),ew=r(93142),eC=r(64935),eS=r(11239),eP=r(54001),ek=r(96137),eA=r(96362),eL=r(80221),eM=r(29202);let{Title:eT,Text:eI}=eN.default,{Panel:eE}=H.default,ez=e=>{let{icon:s,title:r,description:a,children:n,serverName:i,accessGroups:o=["dev"]}=e,[c,d]=(0,l.useState)(!1),m=()=>{let e={"x-litellm-api-key":"Bearer YOUR_LITELLM_API_KEY"};if(c&&i){let s=[i.replace(/\s+/g,"_"),...o].join(",");e["x-mcp-servers"]=[s]}return e};return(0,t.jsxs)(e_.Z,{className:"border border-gray-200",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 mb-3",children:[(0,t.jsx)("span",{className:"p-2 rounded-lg bg-gray-50",children:s}),(0,t.jsxs)("div",{children:[(0,t.jsx)(eT,{level:5,className:"mb-0",children:r}),(0,t.jsx)(eI,{className:"text-gray-600",children:a})]})]}),i&&("Implementation Example"===r||"Configuration"===r)&&(0,t.jsxs)(B.Z.Item,{className:"mb-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,t.jsx)(eZ.Z,{size:"small",checked:c,onChange:d}),(0,t.jsxs)(eI,{className:"text-sm",children:["Limit tools to specific MCP servers or MCP groups by passing the ",(0,t.jsx)("code",{children:"x-mcp-servers"})," header"]})]}),c&&(0,t.jsx)(eh.Z,{className:"mt-2",type:"info",showIcon:!0,message:"Two Options",description:(0,t.jsxs)("div",{children:[(0,t.jsxs)("p",{children:[(0,t.jsx)("strong",{children:"Option 1:"})," Get a specific server: ",(0,t.jsxs)("code",{children:['["',i.replace(/\s+/g,"_"),'"]']})]}),(0,t.jsxs)("p",{children:[(0,t.jsx)("strong",{children:"Option 2:"})," Get a group of MCPs: ",(0,t.jsx)("code",{children:'["dev-group"]'})]}),(0,t.jsxs)("p",{className:"mt-2 text-sm text-gray-600",children:["You can also mix both: ",(0,t.jsx)("code",{children:'["Server1,dev-group"]'})]})]})})]}),l.Children.map(n,e=>{if(l.isValidElement(e)&&e.props.hasOwnProperty("code")&&e.props.hasOwnProperty("copyKey")){let s=e.props.code;if(s&&s.includes('"headers":'))return l.cloneElement(e,{code:s.replace(/"headers":\s*{[^}]*}/,'"headers": '.concat(JSON.stringify(m(),null,8)))})}return e})]})};var eO=e=>{let{currentServerAccessGroups:s=[]}=e,r=(0,Z.getProxyBaseUrl)(),[a,n]=(0,l.useState)({}),[i,o]=(0,l.useState)({openai:[],litellm:[],cursor:[],http:[]}),[c]=(0,l.useState)("Zapier_MCP"),d=async(e,s)=>{await (0,ec.vQ)(e)&&(n(e=>({...e,[s]:!0})),setTimeout(()=>{n(e=>({...e,[s]:!1}))},2e3))},m=e=>{let{code:s,copyKey:r,title:l,className:n=""}=e;return(0,t.jsxs)("div",{className:"relative group",children:[l&&(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,t.jsx)(eC.Z,{size:16,className:"text-blue-600"}),(0,t.jsx)(eI,{strong:!0,className:"text-gray-700",children:l})]}),(0,t.jsxs)(e_.Z,{className:"bg-gray-50 border border-gray-200 relative ".concat(n),children:[(0,t.jsx)(K.ZP,{type:"text",size:"small",icon:a[r]?(0,t.jsx)(ed.Z,{size:12}):(0,t.jsx)(em.Z,{size:12}),onClick:()=>d(s,r),className:"absolute top-2 right-2 z-10 transition-all duration-200 ".concat(a[r]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")}),(0,t.jsx)("pre",{className:"text-sm overflow-x-auto pr-10 text-gray-800 font-mono leading-relaxed",children:s})]})]})},h=e=>{let{step:s,title:r,children:l}=e;return(0,t.jsxs)("div",{className:"flex gap-4",children:[(0,t.jsx)("div",{className:"flex-shrink-0",children:(0,t.jsx)("div",{className:"w-8 h-8 bg-blue-600 text-white rounded-full flex items-center justify-center text-sm font-semibold",children:s})}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)(eI,{strong:!0,className:"text-gray-800 block mb-2",children:r}),l]})]})};return(0,t.jsx)("div",{children:(0,t.jsxs)(ew.Z,{direction:"vertical",size:"large",className:"w-full",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(u.Z,{className:"text-3xl font-bold text-gray-900 mb-3",children:"Connect to your MCP client"}),(0,t.jsx)(x.Z,{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,t.jsxs)(T.Z,{className:"w-full",children:[(0,t.jsx)(I.Z,{className:"flex justify-start mt-8 mb-6",children:(0,t.jsxs)("div",{className:"flex bg-gray-100 p-1 rounded-lg",children:[(0,t.jsx)(M.Z,{className:"px-6 py-3 rounded-md transition-all duration-200",children:(0,t.jsxs)("span",{className:"flex items-center gap-2 font-medium",children:[(0,t.jsx)(eC.Z,{size:18}),"OpenAI API"]})}),(0,t.jsx)(M.Z,{className:"px-6 py-3 rounded-md transition-all duration-200",children:(0,t.jsxs)("span",{className:"flex items-center gap-2 font-medium",children:[(0,t.jsx)(eS.Z,{size:18}),"LiteLLM Proxy"]})}),(0,t.jsx)(M.Z,{className:"px-6 py-3 rounded-md transition-all duration-200",children:(0,t.jsxs)("span",{className:"flex items-center gap-2 font-medium",children:[(0,t.jsx)(eL.Z,{size:18}),"Cursor"]})}),(0,t.jsx)(M.Z,{className:"px-6 py-3 rounded-md transition-all duration-200",children:(0,t.jsxs)("span",{className:"flex items-center gap-2 font-medium",children:[(0,t.jsx)(eM.Z,{size:18}),"Streamable HTTP"]})})]})}),(0,t.jsxs)(z.Z,{children:[(0,t.jsx)(E.Z,{className:"mt-6",children:(0,t.jsx)(()=>(0,t.jsxs)(ew.Z,{direction:"vertical",size:"large",className:"w-full",children:[(0,t.jsxs)("div",{className:"bg-gradient-to-r from-blue-50 to-indigo-50 p-6 rounded-lg border border-blue-100",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 mb-3",children:[(0,t.jsx)(eC.Z,{className:"text-blue-600",size:24}),(0,t.jsx)(eT,{level:4,className:"mb-0 text-blue-900",children:"OpenAI Responses API Integration"})]}),(0,t.jsx)(eI,{className:"text-blue-700",children:"Connect OpenAI Responses API to your LiteLLM MCP server for seamless tool integration"})]}),(0,t.jsxs)(ew.Z,{direction:"vertical",size:"large",className:"w-full",children:[(0,t.jsx)(ez,{icon:(0,t.jsx)(eP.Z,{className:"text-blue-600",size:16}),title:"API Key Setup",description:"Configure your OpenAI API key for authentication",children:(0,t.jsxs)(ew.Z,{direction:"vertical",size:"middle",className:"w-full",children:[(0,t.jsx)("div",{children:(0,t.jsxs)(eI,{children:["Get your API key from the"," ",(0,t.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,t.jsx)(eA.Z,{size:12})]})]})}),(0,t.jsx)(m,{title:"Environment Variable",code:'export OPENAI_API_KEY="sk-..."',copyKey:"openai-env"})]})}),(0,t.jsx)(ez,{icon:(0,t.jsx)(ek.Z,{className:"text-blue-600",size:16}),title:"MCP Server Information",description:"Connection details for your LiteLLM MCP server",children:(0,t.jsx)(m,{title:"Server URL",code:"".concat(r,"/mcp"),copyKey:"openai-server-url"})}),(0,t.jsx)(ez,{icon:(0,t.jsx)(eC.Z,{className:"text-blue-600",size:16}),title:"Implementation Example",description:"Complete cURL example for using the Responses API",serverName:"Zapier Gmail",accessGroups:["dev"],children:(0,t.jsx)(m,{code:'curl --location \'https://api.openai.com/v1/responses\' \\\n--header \'Content-Type: application/json\' \\\n--header "Authorization: Bearer $OPENAI_API_KEY" \\\n--data \'{\n "model": "gpt-4.1",\n "tools": [\n {\n "type": "mcp",\n "server_label": "litellm",\n "server_url": "'.concat(r,'/mcp",\n "require_approval": "never",\n "headers": {\n "x-litellm-api-key": "Bearer YOUR_LITELLM_API_KEY",\n "x-mcp-servers": ["Zapier_MCP,dev"]\n }\n }\n ],\n "input": "Run available tools",\n "tool_choice": "required"\n}\''),copyKey:"openai-curl",className:"text-xs"})})]})]}),{})}),(0,t.jsx)(E.Z,{className:"mt-6",children:(0,t.jsx)(()=>(0,t.jsxs)(ew.Z,{direction:"vertical",size:"large",className:"w-full",children:[(0,t.jsxs)("div",{className:"bg-gradient-to-r from-emerald-50 to-green-50 p-6 rounded-lg border border-emerald-100",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 mb-3",children:[(0,t.jsx)(eS.Z,{className:"text-emerald-600",size:24}),(0,t.jsx)(eT,{level:4,className:"mb-0 text-emerald-900",children:"LiteLLM Proxy API Integration"})]}),(0,t.jsx)(eI,{className:"text-emerald-700",children:"Connect to LiteLLM Proxy Responses API for seamless tool integration with multiple model providers"})]}),(0,t.jsxs)(ew.Z,{direction:"vertical",size:"large",className:"w-full",children:[(0,t.jsx)(ez,{icon:(0,t.jsx)(eP.Z,{className:"text-emerald-600",size:16}),title:"API Key Setup",description:"Configure your LiteLLM Proxy API key for authentication",children:(0,t.jsxs)(ew.Z,{direction:"vertical",size:"middle",className:"w-full",children:[(0,t.jsx)("div",{children:(0,t.jsx)(eI,{children:"Get your API key from your LiteLLM Proxy dashboard or contact your administrator"})}),(0,t.jsx)(m,{title:"Environment Variable",code:'export LITELLM_API_KEY="sk-..."',copyKey:"litellm-env"})]})}),(0,t.jsx)(ez,{icon:(0,t.jsx)(ek.Z,{className:"text-emerald-600",size:16}),title:"MCP Server Information",description:"Connection details for your LiteLLM MCP server",children:(0,t.jsx)(m,{title:"Server URL",code:"".concat(r,"/mcp"),copyKey:"litellm-server-url"})}),(0,t.jsx)(ez,{icon:(0,t.jsx)(eC.Z,{className:"text-emerald-600",size:16}),title:"Implementation Example",description:"Complete cURL example for using the LiteLLM Proxy Responses API",serverName:c,accessGroups:["dev"],children:(0,t.jsx)(m,{code:"curl --location '".concat(r,'/v1/responses\' \\\n--header \'Content-Type: application/json\' \\\n--header "Authorization: Bearer $LITELLM_API_KEY" \\\n--data \'{\n "model": "gpt-4",\n "tools": [\n {\n "type": "mcp",\n "server_label": "litellm",\n "server_url": "').concat(r,'/mcp",\n "require_approval": "never",\n "headers": {\n "x-litellm-api-key": "Bearer YOUR_LITELLM_API_KEY",\n "x-mcp-servers": ["Zapier_MCP,dev"]\n }\n }\n ],\n "input": "Run available tools",\n "tool_choice": "required"\n}\''),copyKey:"litellm-curl",className:"text-xs"})})]})]}),{})}),(0,t.jsx)(E.Z,{className:"mt-6",children:(0,t.jsx)(()=>(0,t.jsxs)(ew.Z,{direction:"vertical",size:"large",className:"w-full",children:[(0,t.jsxs)("div",{className:"bg-gradient-to-r from-purple-50 to-blue-50 p-6 rounded-lg border border-purple-100",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 mb-3",children:[(0,t.jsx)(eL.Z,{className:"text-purple-600",size:24}),(0,t.jsx)(eT,{level:4,className:"mb-0 text-purple-900",children:"Cursor IDE Integration"})]}),(0,t.jsx)(eI,{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,t.jsxs)(e_.Z,{className:"border border-gray-200",children:[(0,t.jsx)(eT,{level:5,className:"mb-4 text-gray-800",children:"Setup Instructions"}),(0,t.jsxs)(ew.Z,{direction:"vertical",size:"large",className:"w-full",children:[(0,t.jsx)(h,{step:1,title:"Open Cursor Settings",children:(0,t.jsxs)(eI,{className:"text-gray-600",children:["Use the keyboard shortcut ",(0,t.jsx)("code",{className:"bg-gray-100 px-2 py-1 rounded",children:"⇧+⌘+J"})," (Mac) or"," ",(0,t.jsx)("code",{className:"bg-gray-100 px-2 py-1 rounded",children:"Ctrl+Shift+J"})," (Windows/Linux)"]})}),(0,t.jsx)(h,{step:2,title:"Navigate to MCP Tools",children:(0,t.jsx)(eI,{className:"text-gray-600",children:'Go to the "MCP Tools" tab and click "New MCP Server"'})}),(0,t.jsxs)(h,{step:3,title:"Add Configuration",children:[(0,t.jsxs)(eI,{className:"text-gray-600 mb-3",children:["Copy the JSON configuration below and paste it into Cursor, then save with"," ",(0,t.jsx)("code",{className:"bg-gray-100 px-2 py-1 rounded",children:"Cmd+S"})," or"," ",(0,t.jsx)("code",{className:"bg-gray-100 px-2 py-1 rounded",children:"Ctrl+S"})]}),(0,t.jsx)(ez,{icon:(0,t.jsx)(eC.Z,{className:"text-purple-600",size:16}),title:"Configuration",description:"Cursor MCP configuration",serverName:"Zapier Gmail",accessGroups:["dev"],children:(0,t.jsx)(m,{code:'{\n "mcpServers": {\n "Zapier_MCP": {\n "server_url": "'.concat(r,'/mcp",\n "headers": {\n "x-litellm-api-key": "Bearer YOUR_LITELLM_API_KEY",\n "x-mcp-servers": ["Zapier_MCP,dev"]\n }\n }\n }\n}'),copyKey:"cursor-config",className:"text-xs"})})]})]})]})]}),{})}),(0,t.jsx)(E.Z,{className:"mt-6",children:(0,t.jsx)(()=>(0,t.jsxs)(ew.Z,{direction:"vertical",size:"large",className:"w-full",children:[(0,t.jsxs)("div",{className:"bg-gradient-to-r from-green-50 to-teal-50 p-6 rounded-lg border border-green-100",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 mb-3",children:[(0,t.jsx)(eM.Z,{className:"text-green-600",size:24}),(0,t.jsx)(eT,{level:4,className:"mb-0 text-green-900",children:"Streamable HTTP Transport"})]}),(0,t.jsx)(eI,{className:"text-green-700",children:"Connect to LiteLLM MCP using HTTP transport. Compatible with any MCP client that supports HTTP streaming."})]}),(0,t.jsx)(ez,{icon:(0,t.jsx)(eM.Z,{className:"text-green-600",size:16}),title:"Universal MCP Connection",description:"Use this URL with any MCP client that supports HTTP transport",children:(0,t.jsxs)(ew.Z,{direction:"vertical",size:"middle",className:"w-full",children:[(0,t.jsx)("div",{children:(0,t.jsx)(eI,{children:"Each MCP client supports different transports. Refer to your client documentation to determine the appropriate transport method."})}),(0,t.jsx)(m,{title:"Server URL",code:"".concat(r,"/mcp"),copyKey:"http-server-url"}),(0,t.jsx)(m,{title:"Headers Configuration",code:JSON.stringify({"x-litellm-api-key":"Bearer YOUR_LITELLM_API_KEY"},null,2),copyKey:"http-headers"}),(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsx)(K.ZP,{type:"link",className:"p-0 h-auto text-blue-600 hover:text-blue-700",href:"https://modelcontextprotocol.io/docs/concepts/transports",icon:(0,t.jsx)(eA.Z,{size:14}),children:"Learn more about MCP transports"})})]})})]}),{})})]})]})]})})},eq=r(67187);let{Option:eR}=n.default,eU=e=>{let{isModalOpen:s,title:r,confirmDelete:l,cancelDelete:a}=e;return s?(0,t.jsx)(i.Z,{open:s,onOk:l,okType:"danger",onCancel:a,children:(0,t.jsxs)(m.Z,{numItems:1,className:"gap-2 w-full",children:[(0,t.jsx)(u.Z,{children:r}),(0,t.jsx)(d.Z,{numColSpan:1,children:(0,t.jsx)("p",{children:"Are you sure you want to delete this MCP Server?"})})]})}):null};var eF=e=>{let{accessToken:s,userRole:r,userID:i}=e,{data:d,isLoading:m,refetch:p,dataUpdatedAt:j}=(0,a.a)({queryKey:["mcpServers"],queryFn:()=>{if(!s)throw Error("Access Token required");return(0,Z.fetchMCPServers)(s)},enabled:!!s});l.useEffect(()=>{d&&(console.log("MCP Servers fetched:",d),d.forEach(e=>{console.log("Server: ".concat(e.server_name||e.server_id)),console.log(" allowed_tools:",e.allowed_tools)}))},[d]);let[g,v]=(0,l.useState)(null),[f,b]=(0,l.useState)(!1),[y,N]=(0,l.useState)(null),[C,S]=(0,l.useState)(!1),[P,k]=(0,l.useState)("all"),[A,L]=(0,l.useState)("all"),[M,T]=(0,l.useState)([]),[I,E]=(0,l.useState)(!1),z="Internal User"===r,O=l.useMemo(()=>{if(!d)return[];let e=new Set,s=[];return d.forEach(r=>{r.teams&&r.teams.forEach(r=>{let t=r.team_id;e.has(t)||(e.add(t),s.push(r))})}),s},[d]),q=l.useMemo(()=>d?Array.from(new Set(d.flatMap(e=>e.mcp_access_groups).filter(e=>null!=e))):[],[d]),R=e=>{k(e),F(e,A)},U=e=>{L(e),F(P,e)},F=(e,s)=>{if(!d)return T([]);let r=d;if("personal"===e){T([]);return}"all"!==e&&(r=r.filter(s=>{var r;return null===(r=s.teams)||void 0===r?void 0:r.some(s=>s.team_id===e)})),"all"!==s&&(r=r.filter(e=>{var r;return null===(r=e.mcp_access_groups)||void 0===r?void 0:r.some(e=>"string"==typeof e?e===s:e&&e.name===s)})),T(r)};(0,l.useEffect)(()=>{F(P,A)},[j]);let B=l.useMemo(()=>_(null!=r?r:"",e=>{N(e),S(!1)},e=>{N(e),S(!0)},K),[r]);function K(e){v(e),b(!0)}let V=async()=>{if(null!=g&&null!=s){try{await (0,Z.deleteMCPServer)(s,g),ea.Z.success("Deleted MCP Server successfully"),p()}catch(e){console.error("Error deleting the mcp server:",e)}b(!1),v(null)}};return s&&r&&i?(0,t.jsxs)("div",{className:"w-full h-full p-6",children:[(0,t.jsx)(eU,{isModalOpen:f,title:"Delete MCP Server",confirmDelete:V,cancelDelete:()=>{b(!1),v(null)}}),(0,t.jsx)(ey,{userRole:r,accessToken:s,onCreateSuccess:e=>{T(s=>[...s,e]),E(!1)},isModalVisible:I,setModalVisible:E,availableAccessGroups:q}),(0,t.jsx)(u.Z,{children:"MCP Servers"}),(0,t.jsx)(x.Z,{className:"text-tremor-content mt-2",children:"Configure and manage your MCP servers"}),(0,w.tY)(r)&&(0,t.jsx)(c.zx,{className:"mt-4 mb-4",onClick:()=>E(!0),children:"+ Add New MCP Server"}),(0,t.jsxs)(c.v0,{className:"w-full h-full",children:[(0,t.jsx)(c.td,{className:"flex justify-between mt-2 w-full items-center",children:(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)(c.OK,{children:"All Servers"}),(0,t.jsx)(c.OK,{children:"Connect"})]})}),(0,t.jsxs)(c.nP,{children:[(0,t.jsx)(c.x4,{children:(0,t.jsx)(()=>y?(0,t.jsx)(ex,{mcpServer:M.find(e=>e.server_id===y)||{server_id:"",server_name:"",alias:"",url:"",transport:"",auth_type:"",created_at:"",created_by:"",updated_at:"",updated_by:""},onBack:()=>{S(!1),N(null),p()},isProxyAdmin:(0,w.tY)(r),isEditing:C,accessToken:s,userID:i,userRole:r,availableAccessGroups:q}):(0,t.jsxs)("div",{className:"w-full h-full",children:[(0,t.jsx)("div",{className:"w-full px-6",children:(0,t.jsx)("div",{className:"flex flex-col space-y-4",children:(0,t.jsx)("div",{className:"flex items-center justify-between bg-gray-50 rounded-lg p-4 border-2 border-gray-200",children:(0,t.jsxs)("div",{className:"flex items-center gap-4",children:[(0,t.jsx)(x.Z,{className:"text-lg font-semibold text-gray-900",children:"Current Team:"}),(0,t.jsxs)(n.default,{value:P,onChange:R,style:{width:300},children:[(0,t.jsx)(eR,{value:"all",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"w-2 h-2 bg-blue-500 rounded-full"}),(0,t.jsx)("span",{className:"font-medium",children:z?"All Available Servers":"All Servers"})]})}),(0,t.jsx)(eR,{value:"personal",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),(0,t.jsx)("span",{className:"font-medium",children:"Personal"})]})}),O.map(e=>(0,t.jsx)(eR,{value:e.team_id,children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),(0,t.jsx)("span",{className:"font-medium",children:e.team_alias||e.team_id})]})},e.team_id))]}),(0,t.jsxs)(x.Z,{className:"text-lg font-semibold text-gray-900 ml-6",children:["Access Group:",(0,t.jsx)(o.Z,{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,t.jsx)(eq.Z,{style:{marginLeft:4,color:"#888"}})})]}),(0,t.jsxs)(n.default,{value:A,onChange:U,style:{width:300},children:[(0,t.jsx)(eR,{value:"all",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"w-2 h-2 bg-blue-500 rounded-full"}),(0,t.jsx)("span",{className:"font-medium",children:"All Access Groups"})]})}),q.map(e=>(0,t.jsx)(eR,{value:e,children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),(0,t.jsx)("span",{className:"font-medium",children:e})]})},e))]})]})})})}),(0,t.jsx)("div",{className:"w-full px-6 mt-6",children:(0,t.jsx)(h.w,{data:M,columns:B,renderSubComponent:()=>(0,t.jsx)("div",{}),getRowCanExpand:()=>!1,isLoading:m,noDataMessage:"No MCP servers configured"})})]}),{})}),(0,t.jsx)(c.x4,{children:(0,t.jsx)(eO,{})})]})]})]}):(console.log("Missing required authentication parameters",{accessToken:s,userRole:r,userID:i}),(0,t.jsx)("div",{className:"p-6 text-center text-gray-500",children:"Missing required authentication parameters."}))},eB=r(21770);function eK(e){let{tool:s,needsAuth:r,authValue:a,onSubmit:n,isLoading:i,result:c,error:d,onClose:m}=e,[x]=B.Z.useForm(),[u,h]=l.useState("formatted"),[p,j]=l.useState(null),[g,v]=l.useState(null),f=l.useMemo(()=>"string"==typeof s.inputSchema?{type:"object",properties:{input:{type:"string",description:"Input for this tool"}},required:["input"]}:s.inputSchema,[s.inputSchema]),b=l.useMemo(()=>f.properties&&f.properties.params&&"object"===f.properties.params.type&&f.properties.params.properties?{type:"object",properties:f.properties.params.properties,required:f.properties.params.required||[]}:f,[f]);l.useEffect(()=>{p&&(c||d)&&v(Date.now()-p)},[c,d,p]);let y=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 r=document.execCommand("copy");if(document.body.removeChild(s),!r)throw Error("execCommand failed");return!0}}catch(e){return console.error("Copy failed:",e),!1}},N=async()=>{await y(JSON.stringify(c,null,2))?ea.Z.success("Result copied to clipboard"):ea.Z.fromBackend("Failed to copy result")},_=async()=>{await y(s.name)?ea.Z.success("Tool name copied to clipboard"):ea.Z.fromBackend("Failed to copy tool name")};return(0,t.jsxs)("div",{className:"space-y-4 h-full",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between pb-3 border-b border-gray-200",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-3",children:[s.mcp_info.logo_url&&(0,t.jsx)("img",{src:s.mcp_info.logo_url,alt:"".concat(s.mcp_info.server_name," logo"),className:"w-6 h-6 object-contain"}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2 mb-1",children:[(0,t.jsx)("h2",{className:"text-lg font-semibold text-gray-900",children:"Test Tool:"}),(0,t.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:_,title:"Click to copy tool name",children:[(0,t.jsx)("span",{className:"font-mono text-slate-700 font-medium text-sm",children:s.name}),(0,t.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,t.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,t.jsx)("p",{className:"text-xs text-gray-600",children:s.description}),(0,t.jsxs)("p",{className:"text-xs text-gray-500",children:["Provider: ",s.mcp_info.server_name]})]})]}),(0,t.jsx)(eu.z,{onClick:m,variant:"light",size:"sm",className:"text-gray-500 hover:text-gray-700",children:(0,t.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4 h-full",children:[(0,t.jsxs)("div",{className:"bg-white border border-gray-200 rounded-lg",children:[(0,t.jsx)("div",{className:"border-b border-gray-100 px-4 py-2",children:(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)("h3",{className:"text-sm font-semibold text-gray-900",children:"Input Parameters"}),(0,t.jsx)(o.Z,{title:"Configure the input parameters for this tool call",children:(0,t.jsx)(J.Z,{className:"text-gray-400 hover:text-gray-600"})})]})}),(0,t.jsx)("div",{className:"p-4",children:(0,t.jsxs)(B.Z,{form:x,onFinish:e=>{j(Date.now()),v(null);let s={};Object.entries(e).forEach(e=>{var r;let[t,l]=e,a=null===(r=b.properties)||void 0===r?void 0:r[t];if(a&&null!=l&&""!==l)switch(a.type){case"boolean":s[t]="true"===l||!0===l;break;case"number":s[t]=Number(l);break;case"string":s[t]=String(l);break;default:s[t]=l}else null!=l&&""!==l&&(s[t]=l)}),n(f.properties&&f.properties.params&&"object"===f.properties.params.type&&f.properties.params.properties?{params:s}:s)},layout:"vertical",className:"space-y-3",children:["string"==typeof s.inputSchema?(0,t.jsx)("div",{className:"space-y-3",children:(0,t.jsx)(B.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700",children:["Input ",(0,t.jsx)("span",{className:"text-red-500",children:"*"})]}),name:"input",rules:[{required:!0,message:"Please enter input for this tool"}],className:"mb-3",children:(0,t.jsx)(eu.o,{placeholder:"Enter input for this tool",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})})}):void 0===b.properties?(0,t.jsx)("div",{className:"text-center py-6 bg-gray-50 rounded-lg border border-gray-200",children:(0,t.jsxs)("div",{className:"max-w-sm mx-auto",children:[(0,t.jsx)("h4",{className:"text-sm font-medium text-gray-900 mb-1",children:"No Parameters Required"}),(0,t.jsx)("p",{className:"text-xs text-gray-500",children:"This tool can be called without any input parameters."})]})}):(0,t.jsx)("div",{className:"space-y-3",children:Object.entries(b.properties).map(e=>{var s,r,l,a,n;let[i,c]=e;return(0,t.jsxs)(B.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:[i," ",(null===(s=b.required)||void 0===s?void 0:s.includes(i))&&(0,t.jsx)("span",{className:"text-red-500",children:"*"}),c.description&&(0,t.jsx)(o.Z,{title:c.description,children:(0,t.jsx)(J.Z,{className:"ml-2 text-gray-400 hover:text-gray-600"})})]}),name:i,rules:[{required:null===(r=b.required)||void 0===r?void 0:r.includes(i),message:"Please enter ".concat(i)}],className:"mb-3",children:["string"===c.type&&c.enum&&(0,t.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:c.default,children:[!(null===(l=b.required)||void 0===l?void 0:l.includes(i))&&(0,t.jsxs)("option",{value:"",children:["Select ",i]}),c.enum.map(e=>(0,t.jsx)("option",{value:e,children:e},e))]}),"string"===c.type&&!c.enum&&(0,t.jsx)(eu.o,{placeholder:c.description||"Enter ".concat(i),className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"}),"number"===c.type&&(0,t.jsx)("input",{type:"number",placeholder:c.description||"Enter ".concat(i),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"===c.type&&(0,t.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:(null===(a=c.default)||void 0===a?void 0:a.toString())||"",children:[!(null===(n=b.required)||void 0===n?void 0:n.includes(i))&&(0,t.jsxs)("option",{value:"",children:["Select ",i]}),(0,t.jsx)("option",{value:"true",children:"True"}),(0,t.jsx)("option",{value:"false",children:"False"})]})]},i)})}),(0,t.jsx)("div",{className:"pt-3 border-t border-gray-100",children:(0,t.jsx)(eu.z,{onClick:()=>x.submit(),disabled:i,variant:"primary",className:"w-full",loading:i,children:i?"Calling Tool...":c||d?"Call Again":"Call Tool"})})]})})]}),(0,t.jsxs)("div",{className:"bg-white border border-gray-200 rounded-lg",children:[(0,t.jsx)("div",{className:"border-b border-gray-100 px-4 py-2",children:(0,t.jsx)("h3",{className:"text-sm font-semibold text-gray-900",children:"Tool Result"})}),(0,t.jsx)("div",{className:"p-4",children:c||d||i?(0,t.jsxs)("div",{className:"space-y-3",children:[c&&!i&&!d&&(0,t.jsx)("div",{className:"p-2 bg-green-50 border border-green-200 rounded-lg",children:(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)("svg",{className:"h-4 w-4 text-green-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,t.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,t.jsx)("h4",{className:"text-xs font-medium text-green-900",children:"Tool executed successfully"}),null!==g&&(0,t.jsxs)("span",{className:"text-xs text-green-600 ml-1",children:["• ",(g/1e3).toFixed(2),"s"]})]}),(0,t.jsxs)("div",{className:"flex items-center space-x-1",children:[(0,t.jsxs)("div",{className:"flex bg-white rounded border border-green-300 p-0.5",children:[(0,t.jsx)("button",{onClick:()=>h("formatted"),className:"px-2 py-1 text-xs font-medium rounded transition-colors ".concat("formatted"===u?"bg-green-100 text-green-800":"text-green-600 hover:text-green-800"),children:"Formatted"}),(0,t.jsx)("button",{onClick:()=>h("json"),className:"px-2 py-1 text-xs font-medium rounded transition-colors ".concat("json"===u?"bg-green-100 text-green-800":"text-green-600 hover:text-green-800"),children:"JSON"})]}),(0,t.jsx)("button",{onClick:N,className:"p-1 hover:bg-green-100 rounded text-green-700",title:"Copy response",children:(0,t.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,t.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),(0,t.jsx)("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})})]})]})}),(0,t.jsxs)("div",{className:"max-h-96 overflow-y-auto",children:[i&&(0,t.jsxs)("div",{className:"flex flex-col justify-center items-center h-48 text-gray-500",children:[(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-2 border-gray-200"}),(0,t.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-2 border-blue-600 border-t-transparent absolute top-0"})]}),(0,t.jsx)("p",{className:"text-sm font-medium mt-3",children:"Calling tool..."}),(0,t.jsx)("p",{className:"text-xs text-gray-400 mt-1",children:"Please wait while we process your request"})]}),d&&(0,t.jsx)("div",{className:"bg-red-50 border border-red-200 rounded-lg p-3",children:(0,t.jsxs)("div",{className:"flex items-start space-x-2",children:[(0,t.jsx)("div",{className:"flex-shrink-0",children:(0,t.jsx)("svg",{className:"h-4 w-4 text-red-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,t.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,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2 mb-1",children:[(0,t.jsx)("h4",{className:"text-xs font-medium text-red-900",children:"Tool Call Failed"}),null!==g&&(0,t.jsxs)("span",{className:"text-xs text-red-600",children:["• ",(g/1e3).toFixed(2),"s"]})]}),(0,t.jsx)("div",{className:"bg-white border border-red-200 rounded p-2 max-h-48 overflow-y-auto",children:(0,t.jsx)("pre",{className:"text-xs whitespace-pre-wrap text-red-700 font-mono",children:d.message})})]})]})}),c&&!i&&!d&&(0,t.jsx)("div",{className:"space-y-3",children:"formatted"===u?c.map((e,s)=>(0,t.jsxs)("div",{className:"border border-gray-200 rounded-lg overflow-hidden",children:["text"===e.type&&(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"bg-gray-50 px-3 py-1 border-b border-gray-200",children:(0,t.jsx)("span",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:"Text Response"})}),(0,t.jsx)("div",{className:"p-3",children:(0,t.jsx)("div",{className:"bg-white rounded border border-gray-200 max-h-64 overflow-y-auto",children:(0,t.jsx)("div",{className:"p-3 space-y-2",children:e.text.split("\n\n").map((e,s)=>{if(""===e.trim())return null;if(e.startsWith("##")){let r=e.replace(/^#+\s/,"");return(0,t.jsx)("div",{className:"border-b border-gray-200 pb-1 mb-2",children:(0,t.jsx)("h3",{className:"text-sm font-semibold text-gray-900",children:r})},s)}let r=/(https?:\/\/[^\s\)]+)/g;if(r.test(e)){let l=e.split(r);return(0,t.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded p-2",children:(0,t.jsx)("div",{className:"text-xs text-gray-700 leading-relaxed whitespace-pre-wrap",children:l.map((e,s)=>r.test(e)?(0,t.jsx)("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-800 underline break-all",children:e},s):e)})},s)}return e.includes("Score:")?(0,t.jsx)("div",{className:"bg-green-50 border-l-4 border-green-400 p-2 rounded-r",children:(0,t.jsx)("p",{className:"text-xs text-green-800 font-medium whitespace-pre-wrap",children:e})},s):(0,t.jsx)("div",{className:"bg-gray-50 rounded p-2 border border-gray-200",children:(0,t.jsx)("div",{className:"text-xs text-gray-700 leading-relaxed whitespace-pre-wrap font-mono",children:e})},s)}).filter(Boolean)})})})]}),"image"===e.type&&e.url&&(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"bg-gray-50 px-3 py-1 border-b border-gray-200",children:(0,t.jsx)("span",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:"Image Response"})}),(0,t.jsx)("div",{className:"p-3",children:(0,t.jsx)("div",{className:"bg-gray-50 rounded p-3 border border-gray-200",children:(0,t.jsx)("img",{src:e.url,alt:"Tool result",className:"max-w-full h-auto rounded shadow-sm"})})})]}),"embedded_resource"===e.type&&(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"bg-gray-50 px-3 py-1 border-b border-gray-200",children:(0,t.jsx)("span",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:"Embedded Resource"})}),(0,t.jsx)("div",{className:"p-3",children:(0,t.jsxs)("div",{className:"flex items-center space-x-2 p-3 bg-blue-50 border border-blue-200 rounded",children:[(0,t.jsx)("div",{className:"flex-shrink-0",children:(0,t.jsx)("svg",{className:"h-5 w-5 text-blue-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,t.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,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsxs)("p",{className:"text-xs font-medium text-blue-900",children:["Resource Type: ",e.resource_type]}),e.url&&(0,t.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,t.jsxs)("svg",{className:"ml-1 h-3 w-3",fill:"currentColor",viewBox:"0 0 20 20",children:[(0,t.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,t.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"})]})]})]})]})})]})]},s)):(0,t.jsx)("div",{className:"bg-white rounded border border-gray-200",children:(0,t.jsx)("div",{className:"p-3 overflow-auto max-h-80 bg-gray-50",children:(0,t.jsx)("pre",{className:"text-xs font-mono whitespace-pre-wrap break-all text-gray-800",children:JSON.stringify(c,null,2)})})})})]})]}):(0,t.jsx)("div",{className:"flex flex-col justify-center items-center h-48 text-gray-500",children:(0,t.jsxs)("div",{className:"text-center max-w-sm",children:[(0,t.jsx)("div",{className:"mb-3",children:(0,t.jsx)("svg",{className:"mx-auto h-12 w-12 text-gray-300",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1,d:"M13 10V3L4 14h7v7l9-11h-7z"})})}),(0,t.jsx)("h4",{className:"text-sm font-medium text-gray-900 mb-1",children:"Ready to Call Tool"}),(0,t.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 eV=r(29488),eD=r(36724),eH=r(57400),eG=r(69993);let eY=e=>{let s,{visible:r,onOk:l,onCancel:a,authType:n}=e,[o]=B.Z.useForm();if(n===O.API_KEY||n===O.BEARER_TOKEN){let e=n===O.API_KEY?"API Key":"Bearer Token";s=(0,t.jsx)(B.Z.Item,{name:"authValue",label:e,rules:[{required:!0,message:"Please input your ".concat(e)}],children:(0,t.jsx)(ev.default.Password,{})})}else n===O.BASIC&&(s=(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(B.Z.Item,{name:"username",label:"Username",rules:[{required:!0,message:"Please input your username"}],children:(0,t.jsx)(ev.default,{})}),(0,t.jsx)(B.Z.Item,{name:"password",label:"Password",rules:[{required:!0,message:"Please input your password"}],children:(0,t.jsx)(ev.default.Password,{})})]}));return(0,t.jsx)(i.Z,{open:r,title:"Authentication",onOk:()=>{o.validateFields().then(e=>{n===O.BASIC?l("".concat(e.username.trim(),":").concat(e.password.trim())):l(e.authValue.trim())})},onCancel:a,destroyOnClose:!0,children:(0,t.jsx)(B.Z,{form:o,layout:"vertical",children:s})})},eJ=e=>{let{authType:s,onAuthSubmit:r,onClearAuth:a,hasAuth:n}=e,[i,o]=(0,l.useState)(!1);return(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)(eD.xv,{className:"text-sm font-medium text-gray-700",children:["Authentication ",n?"✓":""]}),(0,t.jsxs)("div",{className:"flex gap-2",children:[n&&(0,t.jsx)(eD.zx,{onClick:()=>{a()},size:"sm",variant:"secondary",className:"text-xs text-red-600 hover:text-red-700",children:"Clear"}),(0,t.jsx)(eD.zx,{onClick:()=>o(!0),size:"sm",variant:"secondary",className:"text-xs",children:n?"Update":"Add Auth"})]})]}),(0,t.jsx)(eD.xv,{className:"text-xs text-gray-500",children:n?"Authentication configured and saved locally":"Some tools may require authentication"}),(0,t.jsx)(eY,{visible:i,onOk:e=>{r(e),o(!1)},onCancel:()=>o(!1),authType:s})]})};var e$=e=>{let{serverId:s,accessToken:r,auth_type:n,userRole:i,userID:o,serverAlias:c}=e,[d,m]=(0,l.useState)(""),[x,u]=(0,l.useState)(null),[h,p]=(0,l.useState)(null),[j,g]=(0,l.useState)(null);(0,l.useEffect)(()=>{if(F(n)){let e=(0,eV.Ui)(s,c||void 0);e&&m(e)}},[s,c,n]);let v=e=>{m(e),e&&F(n)&&((0,eV.Hc)(s,e,n||"none",c||void 0),ea.Z.success("Authentication token saved locally"))},f=()=>{m(""),(0,eV.e4)(s),ea.Z.info("Authentication token cleared")},{data:b,isLoading:y,error:N}=(0,a.a)({queryKey:["mcpTools",s,d,c],queryFn:()=>{if(!r)throw Error("Access Token required");return(0,Z.listMCPTools)(r,s,d,c||void 0)},enabled:!!r,staleTime:3e4}),{mutate:_,isPending:w}=(0,eB.D)({mutationFn:async e=>{if(!r)throw Error("Access Token required");try{return await (0,Z.callMCPTool)(r,e.tool.name,e.arguments,e.authValue,c||void 0)}catch(e){throw e}},onSuccess:e=>{p(e),g(null)},onError:e=>{g(e),p(null)}}),C=(null==b?void 0:b.tools)||[],S=""!==d;return(0,t.jsx)("div",{className:"w-full h-screen p-4 bg-white",children:(0,t.jsx)(eD.Zb,{className:"w-full rounded-xl shadow-md overflow-hidden",children:(0,t.jsxs)("div",{className:"flex h-auto w-full gap-4",children:[(0,t.jsxs)("div",{className:"w-1/4 p-4 bg-gray-50 flex flex-col",children:[(0,t.jsx)(eD.Dx,{className:"text-xl font-semibold mb-6 mt-2",children:"MCP Tools"}),(0,t.jsxs)("div",{className:"flex flex-col flex-1",children:[(0,t.jsxs)("div",{className:"flex flex-col flex-1 min-h-0",children:[(0,t.jsxs)(eD.xv,{className:"font-medium block mb-3 text-gray-700 flex items-center",children:[(0,t.jsx)($.Z,{className:"mr-2"})," Available Tools",C.length>0&&(0,t.jsx)("span",{className:"ml-2 bg-blue-100 text-blue-800 text-xs font-medium px-2 py-0.5 rounded-full",children:C.length})]}),y&&(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center py-8 bg-white border border-gray-200 rounded-lg",children:[(0,t.jsxs)("div",{className:"relative mb-3",children:[(0,t.jsx)("div",{className:"animate-spin rounded-full h-6 w-6 border-2 border-gray-200"}),(0,t.jsx)("div",{className:"animate-spin rounded-full h-6 w-6 border-2 border-blue-600 border-t-transparent absolute top-0"})]}),(0,t.jsx)("p",{className:"text-xs font-medium text-gray-700",children:"Loading tools..."})]}),(null==b?void 0:b.error)&&!y&&!C.length&&(0,t.jsx)("div",{className:"p-3 text-xs text-red-800 rounded-lg bg-red-50 border border-red-200",children:(0,t.jsxs)("p",{className:"font-medium",children:["Error: ",b.message]})}),!y&&!(null==b?void 0:b.error)&&(!C||0===C.length)&&(0,t.jsxs)("div",{className:"p-4 text-center bg-white border border-gray-200 rounded-lg",children:[(0,t.jsx)("div",{className:"mx-auto w-8 h-8 bg-gray-200 rounded-full flex items-center justify-center mb-2",children:(0,t.jsx)("svg",{className:"w-4 h-4 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.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,t.jsx)("p",{className:"text-xs font-medium text-gray-700 mb-1",children:"No tools available"}),(0,t.jsx)("p",{className:"text-xs text-gray-500",children:"No tools found for this server"})]}),!y&&!(null==b?void 0:b.error)&&C.length>0&&(0,t.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:C.map(e=>(0,t.jsxs)("div",{className:"border rounded-lg p-3 cursor-pointer transition-all hover:shadow-sm ".concat((null==x?void 0:x.name)===e.name?"border-blue-500 bg-blue-50 ring-1 ring-blue-200":"border-gray-200 bg-white hover:border-gray-300"),onClick:()=>{u(e),p(null),g(null)},children:[(0,t.jsxs)("div",{className:"flex items-start space-x-2",children:[e.mcp_info.logo_url&&(0,t.jsx)("img",{src:e.mcp_info.logo_url,alt:"".concat(e.mcp_info.server_name," logo"),className:"w-4 h-4 object-contain flex-shrink-0 mt-0.5"}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("h4",{className:"font-mono text-xs font-medium text-gray-900 truncate",children:e.name}),(0,t.jsx)("p",{className:"text-xs text-gray-500 truncate",children:e.mcp_info.server_name}),(0,t.jsx)("p",{className:"text-xs text-gray-600 mt-1 line-clamp-2 leading-relaxed",children:e.description})]})]}),(null==x?void 0:x.name)===e.name&&(0,t.jsx)("div",{className:"mt-2 pt-2 border-t border-blue-200",children:(0,t.jsxs)("div",{className:"flex items-center text-xs font-medium text-blue-700",children:[(0,t.jsx)("svg",{className:"w-3 h-3 mr-1",fill:"currentColor",viewBox:"0 0 20 20",children:(0,t.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))})]}),F(n)&&(0,t.jsx)("div",{className:"pt-4 border-t border-gray-200 flex-shrink-0 mt-6",children:S?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(eD.xv,{className:"font-medium block mb-3 text-gray-700 flex items-center",children:[(0,t.jsx)(eH.Z,{className:"mr-2"})," Authentication"]}),(0,t.jsx)(eJ,{authType:n,onAuthSubmit:v,onClearAuth:f,hasAuth:S})]}):(0,t.jsxs)("div",{className:"p-4 bg-gradient-to-r from-orange-50 to-red-50 border border-orange-200 rounded-lg",children:[(0,t.jsxs)("div",{className:"flex items-center mb-3",children:[(0,t.jsx)(eH.Z,{className:"mr-2 text-orange-600 text-lg"}),(0,t.jsx)(eD.xv,{className:"font-semibold text-orange-800",children:"Authentication Required"})]}),(0,t.jsx)(eD.xv,{className:"text-sm text-orange-700 mb-4",children:"This MCP server requires authentication. You must add your credentials below to access the tools."}),(0,t.jsx)(eJ,{authType:n,onAuthSubmit:v,onClearAuth:f,hasAuth:S})]})})]})]}),(0,t.jsxs)("div",{className:"w-3/4 flex flex-col bg-white",children:[(0,t.jsx)("div",{className:"p-4 border-b border-gray-200 flex justify-between items-center",children:(0,t.jsx)(eD.Dx,{className:"text-xl font-semibold mb-0",children:"Tool Testing Playground"})}),(0,t.jsx)("div",{className:"flex-1 overflow-auto p-4",children:x?(0,t.jsx)("div",{className:"h-full",children:(0,t.jsx)(eK,{tool:x,needsAuth:F(n),authValue:d,onSubmit:e=>{_({tool:x,arguments:e,authValue:d})},result:h,error:j,isLoading:w,onClose:()=>u(null)})}):(0,t.jsxs)("div",{className:"h-full flex flex-col items-center justify-center text-gray-400",children:[(0,t.jsx)(eG.Z,{style:{fontSize:"48px",marginBottom:"16px"}}),(0,t.jsx)(eD.xv,{className:"text-lg font-medium text-gray-600 mb-2",children:"Select a Tool to Test"}),(0,t.jsx)(eD.xv,{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."})]})})]})]})})})}}}]);
\ No newline at end of file
diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/4193-486afc1bc957d491.js b/litellm/proxy/_experimental/out/_next/static/chunks/4193-486afc1bc957d491.js
new file mode 100644
index 00000000000..7887df99400
--- /dev/null
+++ b/litellm/proxy/_experimental/out/_next/static/chunks/4193-486afc1bc957d491.js
@@ -0,0 +1 @@
+"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4193],{62670:function(t,e,n){n.d(e,{Z:function(){return s}});var o=n(1119),r=n(2265),c={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"},a=n(55015),s=r.forwardRef(function(t,e){return r.createElement(a.Z,(0,o.Z)({},t,{ref:e,icon:c}))})},29271:function(t,e,n){n.d(e,{Z:function(){return s}});var o=n(1119),r=n(2265),c={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:"M464 688a48 48 0 1096 0 48 48 0 10-96 0zm24-112h48c4.4 0 8-3.6 8-8V296c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v272c0 4.4 3.6 8 8 8z"}}]},name:"exclamation-circle",theme:"outlined"},a=n(55015),s=r.forwardRef(function(t,e){return r.createElement(a.Z,(0,o.Z)({},t,{ref:e,icon:c}))})},89245:function(t,e,n){n.d(e,{Z:function(){return s}});var o=n(1119),r=n(2265),c={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"},a=n(55015),s=r.forwardRef(function(t,e){return r.createElement(a.Z,(0,o.Z)({},t,{ref:e,icon:c}))})},69993:function(t,e,n){n.d(e,{Z:function(){return s}});var o=n(1119),r=n(2265),c={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"},a=n(55015),s=r.forwardRef(function(t,e){return r.createElement(a.Z,(0,o.Z)({},t,{ref:e,icon:c}))})},57400:function(t,e,n){n.d(e,{Z:function(){return s}});var o=n(1119),r=n(2265),c={icon:{tag:"svg",attrs:{viewBox:"0 0 1024 1024",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64L128 192v384c0 212.1 171.9 384 384 384s384-171.9 384-384V192L512 64zm312 512c0 172.3-139.7 312-312 312S200 748.3 200 576V246l312-110 312 110v330z"}},{tag:"path",attrs:{d:"M378.4 475.1a35.91 35.91 0 00-50.9 0 35.91 35.91 0 000 50.9l129.4 129.4 2.1 2.1a33.98 33.98 0 0048.1 0L730.6 434a33.98 33.98 0 000-48.1l-2.8-2.8a33.98 33.98 0 00-48.1 0L483 579.7 378.4 475.1z"}}]},name:"safety",theme:"outlined"},a=n(55015),s=r.forwardRef(function(t,e){return r.createElement(a.Z,(0,o.Z)({},t,{ref:e,icon:c}))})},58630:function(t,e,n){n.d(e,{Z:function(){return s}});var o=n(1119),r=n(2265),c={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"},a=n(55015),s=r.forwardRef(function(t,e){return r.createElement(a.Z,(0,o.Z)({},t,{ref:e,icon:c}))})},49804:function(t,e,n){n.d(e,{Z:function(){return l}});var o=n(5853),r=n(97324),c=n(1153),a=n(2265),s=n(9496);let i=(0,c.fn)("Col"),l=a.forwardRef((t,e)=>{let{numColSpan:n=1,numColSpanSm:c,numColSpanMd:l,numColSpanLg:u,children:d,className:m}=t,p=(0,o._T)(t,["numColSpan","numColSpanSm","numColSpanMd","numColSpanLg","children","className"]),g=(t,e)=>t&&Object.keys(e).includes(String(t))?e[t]:"";return a.createElement("div",Object.assign({ref:e,className:(0,r.q)(i("root"),(()=>{let t=g(n,s.PT),e=g(c,s.SP),o=g(l,s.VS),a=g(u,s._w);return(0,r.q)(t,e,o,a)})(),m)},p),d)});l.displayName="Col"},67101:function(t,e,n){n.d(e,{Z:function(){return u}});var o=n(5853),r=n(97324),c=n(1153),a=n(2265),s=n(9496);let i=(0,c.fn)("Grid"),l=(t,e)=>t&&Object.keys(e).includes(String(t))?e[t]:"",u=a.forwardRef((t,e)=>{let{numItems:n=1,numItemsSm:c,numItemsMd:u,numItemsLg:d,children:m,className:p}=t,g=(0,o._T)(t,["numItems","numItemsSm","numItemsMd","numItemsLg","children","className"]),f=l(n,s._m),h=l(c,s.LH),v=l(u,s.l5),y=l(d,s.N4),b=(0,r.q)(f,h,v,y);return a.createElement("div",Object.assign({ref:e,className:(0,r.q)(i("root"),"grid",b,p)},g),m)});u.displayName="Grid"},9496:function(t,e,n){n.d(e,{LH:function(){return r},N4:function(){return a},PT:function(){return s},SP:function(){return i},VS:function(){return l},_m:function(){return o},_w:function(){return u},l5:function(){return c}});let o={0:"grid-cols-none",1:"grid-cols-1",2:"grid-cols-2",3:"grid-cols-3",4:"grid-cols-4",5:"grid-cols-5",6:"grid-cols-6",7:"grid-cols-7",8:"grid-cols-8",9:"grid-cols-9",10:"grid-cols-10",11:"grid-cols-11",12:"grid-cols-12"},r={0:"sm:grid-cols-none",1:"sm:grid-cols-1",2:"sm:grid-cols-2",3:"sm:grid-cols-3",4:"sm:grid-cols-4",5:"sm:grid-cols-5",6:"sm:grid-cols-6",7:"sm:grid-cols-7",8:"sm:grid-cols-8",9:"sm:grid-cols-9",10:"sm:grid-cols-10",11:"sm:grid-cols-11",12:"sm:grid-cols-12"},c={0:"md:grid-cols-none",1:"md:grid-cols-1",2:"md:grid-cols-2",3:"md:grid-cols-3",4:"md:grid-cols-4",5:"md:grid-cols-5",6:"md:grid-cols-6",7:"md:grid-cols-7",8:"md:grid-cols-8",9:"md:grid-cols-9",10:"md:grid-cols-10",11:"md:grid-cols-11",12:"md:grid-cols-12"},a={0:"lg:grid-cols-none",1:"lg:grid-cols-1",2:"lg:grid-cols-2",3:"lg:grid-cols-3",4:"lg:grid-cols-4",5:"lg:grid-cols-5",6:"lg:grid-cols-6",7:"lg:grid-cols-7",8:"lg:grid-cols-8",9:"lg:grid-cols-9",10:"lg:grid-cols-10",11:"lg:grid-cols-11",12:"lg:grid-cols-12"},s={1:"col-span-1",2:"col-span-2",3:"col-span-3",4:"col-span-4",5:"col-span-5",6:"col-span-6",7:"col-span-7",8:"col-span-8",9:"col-span-9",10:"col-span-10",11:"col-span-11",12:"col-span-12",13:"col-span-13"},i={1:"sm:col-span-1",2:"sm:col-span-2",3:"sm:col-span-3",4:"sm:col-span-4",5:"sm:col-span-5",6:"sm:col-span-6",7:"sm:col-span-7",8:"sm:col-span-8",9:"sm:col-span-9",10:"sm:col-span-10",11:"sm:col-span-11",12:"sm:col-span-12",13:"sm:col-span-13"},l={1:"md:col-span-1",2:"md:col-span-2",3:"md:col-span-3",4:"md:col-span-4",5:"md:col-span-5",6:"md:col-span-6",7:"md:col-span-7",8:"md:col-span-8",9:"md:col-span-9",10:"md:col-span-10",11:"md:col-span-11",12:"md:col-span-12",13:"md:col-span-13"},u={1:"lg:col-span-1",2:"lg:col-span-2",3:"lg:col-span-3",4:"lg:col-span-4",5:"lg:col-span-5",6:"lg:col-span-6",7:"lg:col-span-7",8:"lg:col-span-8",9:"lg:col-span-9",10:"lg:col-span-10",11:"lg:col-span-11",12:"lg:col-span-12",13:"lg:col-span-13"}},61778:function(t,e,n){n.d(e,{Z:function(){return P}});var o=n(2265),r=n(8900),c=n(39725),a=n(49638),s=n(54537),i=n(55726),l=n(36760),u=n.n(l),d=n(47970),m=n(18242),p=n(19722),g=n(71744),f=n(352),h=n(12918),v=n(80669);let y=(t,e,n,o,r)=>({background:t,border:"".concat((0,f.bf)(o.lineWidth)," ").concat(o.lineType," ").concat(e),["".concat(r,"-icon")]:{color:n}}),b=t=>{let{componentCls:e,motionDurationSlow:n,marginXS:o,marginSM:r,fontSize:c,fontSizeLG:a,lineHeight:s,borderRadiusLG:i,motionEaseInOutCirc:l,withDescriptionIconSize:u,colorText:d,colorTextHeading:m,withDescriptionPadding:p,defaultPadding:g}=t;return{[e]:Object.assign(Object.assign({},(0,h.Wf)(t)),{position:"relative",display:"flex",alignItems:"center",padding:g,wordWrap:"break-word",borderRadius:i,["&".concat(e,"-rtl")]:{direction:"rtl"},["".concat(e,"-content")]:{flex:1,minWidth:0},["".concat(e,"-icon")]:{marginInlineEnd:o,lineHeight:0},"&-description":{display:"none",fontSize:c,lineHeight:s},"&-message":{color:m},["&".concat(e,"-motion-leave")]:{overflow:"hidden",opacity:1,transition:"max-height ".concat(n," ").concat(l,", opacity ").concat(n," ").concat(l,",\n padding-top ").concat(n," ").concat(l,", padding-bottom ").concat(n," ").concat(l,",\n margin-bottom ").concat(n," ").concat(l)},["&".concat(e,"-motion-leave-active")]:{maxHeight:0,marginBottom:"0 !important",paddingTop:0,paddingBottom:0,opacity:0}}),["".concat(e,"-with-description")]:{alignItems:"flex-start",padding:p,["".concat(e,"-icon")]:{marginInlineEnd:r,fontSize:u,lineHeight:0},["".concat(e,"-message")]:{display:"block",marginBottom:o,color:m,fontSize:a},["".concat(e,"-description")]:{display:"block",color:d}},["".concat(e,"-banner")]:{marginBottom:0,border:"0 !important",borderRadius:0}}},w=t=>{let{componentCls:e,colorSuccess:n,colorSuccessBorder:o,colorSuccessBg:r,colorWarning:c,colorWarningBorder:a,colorWarningBg:s,colorError:i,colorErrorBorder:l,colorErrorBg:u,colorInfo:d,colorInfoBorder:m,colorInfoBg:p}=t;return{[e]:{"&-success":y(r,o,n,t,e),"&-info":y(p,m,d,t,e),"&-warning":y(s,a,c,t,e),"&-error":Object.assign(Object.assign({},y(u,l,i,t,e)),{["".concat(e,"-description > pre")]:{margin:0,padding:0}})}}},k=t=>{let{componentCls:e,iconCls:n,motionDurationMid:o,marginXS:r,fontSizeIcon:c,colorIcon:a,colorIconHover:s}=t;return{[e]:{"&-action":{marginInlineStart:r},["".concat(e,"-close-icon")]:{marginInlineStart:r,padding:0,overflow:"hidden",fontSize:c,lineHeight:(0,f.bf)(c),backgroundColor:"transparent",border:"none",outline:"none",cursor:"pointer",["".concat(n,"-close")]:{color:a,transition:"color ".concat(o),"&:hover":{color:s}}},"&-close-text":{color:a,transition:"color ".concat(o),"&:hover":{color:s}}}}};var x=(0,v.I$)("Alert",t=>[b(t),w(t),k(t)],t=>({withDescriptionIconSize:t.fontSizeHeading3,defaultPadding:"".concat(t.paddingContentVerticalSM,"px ").concat(12,"px"),withDescriptionPadding:"".concat(t.paddingMD,"px ").concat(t.paddingContentHorizontalLG,"px")})),Z=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&0>e.indexOf(o)&&(n[o]=t[o]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols)for(var r=0,o=Object.getOwnPropertySymbols(t);re.indexOf(o[r])&&Object.prototype.propertyIsEnumerable.call(t,o[r])&&(n[o[r]]=t[o[r]]);return n};let C={success:r.Z,info:i.Z,error:c.Z,warning:s.Z},E=t=>{let{icon:e,prefixCls:n,type:r}=t,c=C[r]||null;return e?(0,p.wm)(e,o.createElement("span",{className:"".concat(n,"-icon")},e),()=>({className:u()("".concat(n,"-icon"),{[e.props.className]:e.props.className})})):o.createElement(c,{className:"".concat(n,"-icon")})},M=t=>{let{isClosable:e,prefixCls:n,closeIcon:r,handleClose:c}=t,s=!0===r||void 0===r?o.createElement(a.Z,null):r;return e?o.createElement("button",{type:"button",onClick:c,className:"".concat(n,"-close-icon"),tabIndex:0},s):null};var O=t=>{let{description:e,prefixCls:n,message:r,banner:c,className:a,rootClassName:s,style:i,onMouseEnter:l,onMouseLeave:p,onClick:f,afterClose:h,showIcon:v,closable:y,closeText:b,closeIcon:w,action:k}=t,C=Z(t,["description","prefixCls","message","banner","className","rootClassName","style","onMouseEnter","onMouseLeave","onClick","afterClose","showIcon","closable","closeText","closeIcon","action"]),[O,S]=o.useState(!1),N=o.useRef(null),{getPrefixCls:z,direction:j,alert:L}=o.useContext(g.E_),R=z("alert",n),[I,P,A]=x(R),H=e=>{var n;S(!0),null===(n=t.onClose)||void 0===n||n.call(t,e)},V=o.useMemo(()=>void 0!==t.type?t.type:c?"warning":"info",[t.type,c]),B=o.useMemo(()=>!!b||("boolean"==typeof y?y:!1!==w&&null!=w),[b,w,y]),_=!!c&&void 0===v||v,q=u()(R,"".concat(R,"-").concat(V),{["".concat(R,"-with-description")]:!!e,["".concat(R,"-no-icon")]:!_,["".concat(R,"-banner")]:!!c,["".concat(R,"-rtl")]:"rtl"===j},null==L?void 0:L.className,a,s,A,P),W=(0,m.Z)(C,{aria:!0,data:!0});return I(o.createElement(d.ZP,{visible:!O,motionName:"".concat(R,"-motion"),motionAppear:!1,motionEnter:!1,onLeaveStart:t=>({maxHeight:t.offsetHeight}),onLeaveEnd:h},n=>{let{className:c,style:a}=n;return o.createElement("div",Object.assign({ref:N,"data-show":!O,className:u()(q,c),style:Object.assign(Object.assign(Object.assign({},null==L?void 0:L.style),i),a),onMouseEnter:l,onMouseLeave:p,onClick:f,role:"alert"},W),_?o.createElement(E,{description:e,icon:t.icon,prefixCls:R,type:V}):null,o.createElement("div",{className:"".concat(R,"-content")},r?o.createElement("div",{className:"".concat(R,"-message")},r):null,e?o.createElement("div",{className:"".concat(R,"-description")},e):null),k?o.createElement("div",{className:"".concat(R,"-action")},k):null,o.createElement(M,{isClosable:B,prefixCls:R,closeIcon:b||w,handleClose:H}))}))},S=n(76405),N=n(25049),z=n(37977),j=n(63929),L=n(24995),R=n(15354);let I=function(t){function e(){var t,n,o;return(0,S.Z)(this,e),n=e,o=arguments,n=(0,L.Z)(n),(t=(0,z.Z)(this,(0,j.Z)()?Reflect.construct(n,o||[],(0,L.Z)(this).constructor):n.apply(this,o))).state={error:void 0,info:{componentStack:""}},t}return(0,R.Z)(e,t),(0,N.Z)(e,[{key:"componentDidCatch",value:function(t,e){this.setState({error:t,info:e})}},{key:"render",value:function(){let{message:t,description:e,children:n}=this.props,{error:r,info:c}=this.state,a=c&&c.componentStack?c.componentStack:null,s=void 0===t?(r||"").toString():t;return r?o.createElement(O,{type:"error",message:s,description:o.createElement("pre",{style:{fontSize:"0.9em",overflowX:"auto"}},void 0===e?a:e)}):n}}]),e}(o.Component);O.ErrorBoundary=I;var P=O},93142:function(t,e,n){n.d(e,{Z:function(){return v}});var o=n(2265),r=n(36760),c=n.n(r),a=n(45287);function s(t){return["small","middle","large"].includes(t)}function i(t){return!!t&&"number"==typeof t&&!Number.isNaN(t)}var l=n(71744),u=n(65658);let d=o.createContext({latestIndex:0}),m=d.Provider;var p=t=>{let{className:e,index:n,children:r,split:c,style:a}=t,{latestIndex:s}=o.useContext(d);return null==r?null:o.createElement(o.Fragment,null,o.createElement("div",{className:e,style:a},r),ne.indexOf(o)&&(n[o]=t[o]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols)for(var r=0,o=Object.getOwnPropertySymbols(t);re.indexOf(o[r])&&Object.prototype.propertyIsEnumerable.call(t,o[r])&&(n[o[r]]=t[o[r]]);return n};let h=o.forwardRef((t,e)=>{var n,r;let{getPrefixCls:u,space:d,direction:h}=o.useContext(l.E_),{size:v=(null==d?void 0:d.size)||"small",align:y,className:b,rootClassName:w,children:k,direction:x="horizontal",prefixCls:Z,split:C,style:E,wrap:M=!1,classNames:O,styles:S}=t,N=f(t,["size","align","className","rootClassName","children","direction","prefixCls","split","style","wrap","classNames","styles"]),[z,j]=Array.isArray(v)?v:[v,v],L=s(j),R=s(z),I=i(j),P=i(z),A=(0,a.Z)(k,{keepEmpty:!0}),H=void 0===y&&"horizontal"===x?"center":y,V=u("space",Z),[B,_,q]=(0,g.Z)(V),W=c()(V,null==d?void 0:d.className,_,"".concat(V,"-").concat(x),{["".concat(V,"-rtl")]:"rtl"===h,["".concat(V,"-align-").concat(H)]:H,["".concat(V,"-gap-row-").concat(j)]:L,["".concat(V,"-gap-col-").concat(z)]:R},b,w,q),T=c()("".concat(V,"-item"),null!==(n=null==O?void 0:O.item)&&void 0!==n?n:null===(r=null==d?void 0:d.classNames)||void 0===r?void 0:r.item),D=0,G=A.map((t,e)=>{var n,r;null!=t&&(D=e);let c=t&&t.key||"".concat(T,"-").concat(e);return o.createElement(p,{className:T,key:c,index:e,split:C,style:null!==(n=null==S?void 0:S.item)&&void 0!==n?n:null===(r=null==d?void 0:d.styles)||void 0===r?void 0:r.item},t)}),U=o.useMemo(()=>({latestIndex:D}),[D]);if(0===A.length)return null;let K={};return M&&(K.flexWrap="wrap"),!R&&P&&(K.columnGap=z),!L&&I&&(K.rowGap=j),B(o.createElement("div",Object.assign({ref:e,className:W,style:Object.assign(Object.assign(Object.assign({},K),null==d?void 0:d.style),E)},N),o.createElement(m,{value:U},G)))});h.Compact=u.ZP;var v=h},79205:function(t,e,n){n.d(e,{Z:function(){return d}});var o=n(2265);let r=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),c=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,e,n)=>n?n.toUpperCase():e.toLowerCase()),a=t=>{let e=c(t);return e.charAt(0).toUpperCase()+e.slice(1)},s=function(){for(var t=arguments.length,e=Array(t),n=0;n!!t&&""!==t.trim()&&n.indexOf(t)===e).join(" ").trim()},i=t=>{for(let e in t)if(e.startsWith("aria-")||"role"===e||"title"===e)return!0};var l={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let u=(0,o.forwardRef)((t,e)=>{let{color:n="currentColor",size:r=24,strokeWidth:c=2,absoluteStrokeWidth:a,className:u="",children:d,iconNode:m,...p}=t;return(0,o.createElement)("svg",{ref:e,...l,width:r,height:r,stroke:n,strokeWidth:a?24*Number(c)/Number(r):c,className:s("lucide",u),...!d&&!i(p)&&{"aria-hidden":"true"},...p},[...m.map(t=>{let[e,n]=t;return(0,o.createElement)(e,n)}),...Array.isArray(d)?d:[d]])}),d=(t,e)=>{let n=(0,o.forwardRef)((n,c)=>{let{className:i,...l}=n;return(0,o.createElement)(u,{ref:c,iconNode:e,className:s("lucide-".concat(r(a(t))),"lucide-".concat(t),i),...l})});return n.displayName=a(t),n}},30401:function(t,e,n){n.d(e,{Z:function(){return o}});let o=(0,n(79205).Z)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]])},64935:function(t,e,n){n.d(e,{Z:function(){return o}});let o=(0,n(79205).Z)("code",[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]])},78867:function(t,e,n){n.d(e,{Z:function(){return o}});let o=(0,n(79205).Z)("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]])},96362:function(t,e,n){n.d(e,{Z:function(){return o}});let o=(0,n(79205).Z)("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"}]])},29202:function(t,e,n){n.d(e,{Z:function(){return o}});let o=(0,n(79205).Z)("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"}]])},54001:function(t,e,n){n.d(e,{Z:function(){return o}});let o=(0,n(79205).Z)("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"}]])},96137:function(t,e,n){n.d(e,{Z:function(){return o}});let o=(0,n(79205).Z)("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"}]])},80221:function(t,e,n){n.d(e,{Z:function(){return o}});let o=(0,n(79205).Z)("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]])},11239:function(t,e,n){n.d(e,{Z:function(){return o}});let o=(0,n(79205).Z)("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"}]])},10900:function(t,e,n){var o=n(2265);let r=o.forwardRef(function(t,e){return o.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:e},t),o.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 19l-7-7m0 0l7-7m-7 7h18"}))});e.Z=r},71437:function(t,e,n){var o=n(2265);let r=o.forwardRef(function(t,e){return o.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:e},t),o.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),o.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.Z=r},82376:function(t,e,n){var o=n(2265);let r=o.forwardRef(function(t,e){return o.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:e},t),o.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"}))});e.Z=r},29827:function(t,e,n){n.d(e,{NL:function(){return a},aH:function(){return s}});var o=n(2265),r=n(57437),c=o.createContext(void 0),a=t=>{let e=o.useContext(c);if(t)return t;if(!e)throw Error("No QueryClient set, use QueryClientProvider to set one");return e},s=t=>{let{client:e,children:n}=t;return o.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,r.jsx)(c.Provider,{value:e,children:n})}},21770:function(t,e,n){n.d(e,{D:function(){return d}});var o=n(2265),r=n(2894),c=n(18238),a=n(24112),s=n(45345),i=class extends a.l{#t;#e=void 0;#n;#o;constructor(t,e){super(),this.#t=t,this.setOptions(e),this.bindMethods(),this.#r()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){let e=this.options;this.options=this.#t.defaultMutationOptions(t),(0,s.VS)(this.options,e)||this.#t.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#n,observer:this}),e?.mutationKey&&this.options.mutationKey&&(0,s.Ym)(e.mutationKey)!==(0,s.Ym)(this.options.mutationKey)?this.reset():this.#n?.state.status==="pending"&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(t){this.#r(),this.#c(t)}getCurrentResult(){return this.#e}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#r(),this.#c()}mutate(t,e){return this.#o=e,this.#n?.removeObserver(this),this.#n=this.#t.getMutationCache().build(this.#t,this.options),this.#n.addObserver(this),this.#n.execute(t)}#r(){let t=this.#n?.state??(0,r.R)();this.#e={...t,isPending:"pending"===t.status,isSuccess:"success"===t.status,isError:"error"===t.status,isIdle:"idle"===t.status,mutate:this.mutate,reset:this.reset}}#c(t){c.V.batch(()=>{if(this.#o&&this.hasListeners()){let e=this.#e.variables,n=this.#e.context;t?.type==="success"?(this.#o.onSuccess?.(t.data,e,n),this.#o.onSettled?.(t.data,null,e,n)):t?.type==="error"&&(this.#o.onError?.(t.error,e,n),this.#o.onSettled?.(void 0,t.error,e,n))}this.listeners.forEach(t=>{t(this.#e)})})}},l=n(29827),u=n(51172);function d(t,e){let n=(0,l.NL)(e),[r]=o.useState(()=>new i(n,t));o.useEffect(()=>{r.setOptions(t)},[r,t]);let a=o.useSyncExternalStore(o.useCallback(t=>r.subscribe(c.V.batchCalls(t)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),s=o.useCallback((t,e)=>{r.mutate(t,e).catch(u.Z)},[r]);if(a.error&&(0,u.L)(r.options.throwOnError,[a.error]))throw a.error;return{...a,mutate:s,mutateAsync:a.mutate}}}}]);
\ No newline at end of file
diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/4238-943dbcbd28576cd0.js b/litellm/proxy/_experimental/out/_next/static/chunks/4238-943dbcbd28576cd0.js
new file mode 100644
index 00000000000..01ee027ca83
--- /dev/null
+++ b/litellm/proxy/_experimental/out/_next/static/chunks/4238-943dbcbd28576cd0.js
@@ -0,0 +1 @@
+"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4238],{1309:function(e,a,l){l.d(a,{C:function(){return r.Z}});var r=l(41649)},84238:function(e,a,l){l.d(a,{Z:function(){return e1}});var r,i,t=l(57437),s=l(2265),n=l(71618),d=l(82680),o=l(19250),c=l(93192),u=l(52787),m=l(91810),x=l(13634),p=l(3810),h=l(64504);(r=i||(i={})).PresidioPII="Presidio PII",r.Bedrock="Bedrock Guardrail",r.Lakera="Lakera";let g={},f=e=>{let a={};return a.PresidioPII="Presidio PII",a.Bedrock="Bedrock Guardrail",a.Lakera="Lakera",Object.entries(e).forEach(e=>{let[l,r]=e;r&&"object"==typeof r&&"ui_friendly_name"in r&&(a[l.split("_").map((e,a)=>e.charAt(0).toUpperCase()+e.slice(1)).join("")]=r.ui_friendly_name)}),g=a,a},j=()=>Object.keys(g).length>0?g:i,v={PresidioPII:"presidio",Bedrock:"bedrock",Lakera:"lakera_v2"},y=e=>{Object.entries(e).forEach(e=>{let[a,l]=e;l&&"object"==typeof l&&"ui_friendly_name"in l&&(v[a.split("_").map((e,a)=>e.charAt(0).toUpperCase()+e.slice(1)).join("")]=a)})},_=e=>!!e&&"Presidio PII"===j()[e],b="../ui/assets/logos/",N={"Presidio PII":"".concat(b,"presidio.png"),"Bedrock Guardrail":"".concat(b,"bedrock.svg"),Lakera:"".concat(b,"lakeraai.jpeg"),"Azure Content Safety Prompt Shield":"".concat(b,"presidio.png"),"Azure Content Safety Text Moderation":"".concat(b,"presidio.png"),"Aporia AI":"".concat(b,"aporia.png"),"PANW Prisma AIRS":"".concat(b,"palo_alto_networks.jpeg"),"Noma Security":"".concat(b,"noma_security.png"),"Javelin Guardrails":"".concat(b,"javelin.png"),"Pillar Guardrail":"".concat(b,"pillar.jpeg"),"Google Cloud Model Armor":"".concat(b,"google.svg"),"Guardrails AI":"".concat(b,"guardrails_ai.jpeg"),"Lasso Guardrail":"".concat(b,"lasso.png"),"Pangea Guardrail":"".concat(b,"pangea.png"),"AIM Guardrail":"".concat(b,"aim_security.jpeg"),"OpenAI Moderation":"".concat(b,"openai_small.svg"),EnkryptAI:"".concat(b,"enkrypt_ai.avif")},w=e=>{if(!e)return{logo:"",displayName:"-"};let a=Object.keys(v).find(a=>v[a].toLowerCase()===e.toLowerCase());if(!a)return{logo:"",displayName:e};let l=j()[a];return{logo:N[l]||"",displayName:l||e}};var S=l(33866),k=l(89970),Z=l(73002),C=l(61994),I=l(97416),P=l(8881),O=l(10798),A=l(49638);let{Text:E}=c.default,{Option:G}=u.default,L=e=>e.replace(/_/g," "),T=e=>{switch(e){case"MASK":return(0,t.jsx)(I.Z,{style:{marginRight:4}});case"BLOCK":return(0,t.jsx)(P.Z,{style:{marginRight:4}});default:return null}},z=e=>{let{categories:a,selectedCategories:l,onChange:r}=e;return(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center mb-2",children:[(0,t.jsx)(O.Z,{className:"text-gray-500 mr-1"}),(0,t.jsx)(E,{className:"text-gray-500 font-medium",children:"Filter by category"})]}),(0,t.jsx)(u.default,{mode:"multiple",placeholder:"Select categories to filter by",style:{width:"100%"},onChange:r,value:l,allowClear:!0,showSearch:!0,optionFilterProp:"children",className:"mb-4",tagRender:e=>(0,t.jsx)(p.Z,{color:"blue",closable:e.closable,onClose:e.onClose,className:"mr-2 mb-2",children:e.label}),children:a.map(e=>(0,t.jsx)(G,{value:e.category,children:e.category},e.category))})]})},F=e=>{let{onSelectAll:a,onUnselectAll:l,hasSelectedEntities:r}=e;return(0,t.jsxs)("div",{className:"bg-gray-50 p-5 rounded-lg mb-6 border border-gray-200 shadow-sm",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)(E,{strong:!0,className:"text-gray-700 text-base",children:"Quick Actions"}),(0,t.jsx)(k.Z,{title:"Apply action to all PII types at once",children:(0,t.jsx)("div",{className:"ml-2 text-gray-400 cursor-help text-xs",children:"ⓘ"})})]}),(0,t.jsx)(Z.ZP,{type:"default",onClick:l,disabled:!r,icon:(0,t.jsx)(A.Z,{}),className:"border-gray-300 hover:text-red-600 hover:border-red-300",children:"Unselect All"})]}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsx)(Z.ZP,{type:"default",onClick:()=>a("MASK"),className:"flex items-center justify-center h-10 border-blue-200 hover:border-blue-300 hover:text-blue-700 bg-blue-50 hover:bg-blue-100 text-blue-600",block:!0,icon:(0,t.jsx)(I.Z,{}),children:"Select All & Mask"}),(0,t.jsx)(Z.ZP,{type:"default",onClick:()=>a("BLOCK"),className:"flex items-center justify-center h-10 border-red-200 hover:border-red-300 hover:text-red-700 bg-red-50 hover:bg-red-100 text-red-600",block:!0,icon:(0,t.jsx)(P.Z,{}),children:"Select All & Block"})]})]})},M=e=>{let{entities:a,selectedEntities:l,selectedActions:r,actions:i,onEntitySelect:s,onActionSelect:n,entityToCategoryMap:d}=e;return(0,t.jsxs)("div",{className:"border rounded-lg overflow-hidden shadow-sm",children:[(0,t.jsxs)("div",{className:"bg-gray-50 px-5 py-3 border-b flex",children:[(0,t.jsx)(E,{strong:!0,className:"flex-1 text-gray-700",children:"PII Type"}),(0,t.jsx)(E,{strong:!0,className:"w-32 text-right text-gray-700",children:"Action"})]}),(0,t.jsx)("div",{className:"max-h-[400px] overflow-y-auto",children:0===a.length?(0,t.jsx)("div",{className:"py-10 text-center text-gray-500",children:"No PII types match your filter criteria"}):a.map(e=>(0,t.jsxs)("div",{className:"px-5 py-3 flex items-center justify-between hover:bg-gray-50 border-b ".concat(l.includes(e)?"bg-blue-50":""),children:[(0,t.jsxs)("div",{className:"flex items-center flex-1",children:[(0,t.jsx)(C.Z,{checked:l.includes(e),onChange:()=>s(e),className:"mr-3"}),(0,t.jsx)(E,{className:l.includes(e)?"font-medium text-gray-900":"text-gray-700",children:L(e)}),d.get(e)&&(0,t.jsx)(p.Z,{className:"ml-2 text-xs",color:"blue",children:d.get(e)})]}),(0,t.jsx)("div",{className:"w-32",children:(0,t.jsx)(u.default,{value:l.includes(e)&&r[e]||"MASK",onChange:a=>n(e,a),style:{width:120},disabled:!l.includes(e),className:"".concat(l.includes(e)?"":"opacity-50"),dropdownMatchSelectWidth:!1,children:i.map(e=>(0,t.jsx)(G,{value:e,children:(0,t.jsxs)("div",{className:"flex items-center",children:[T(e),e]})},e))})})]},e))})]})},{Title:B,Text:D}=c.default;var J=e=>{let{entities:a,actions:l,selectedEntities:r,selectedActions:i,onEntitySelect:n,onActionSelect:d,entityCategories:o=[]}=e,[c,u]=(0,s.useState)([]),m=new Map;o.forEach(e=>{e.entities.forEach(a=>{m.set(a,e.category)})});let x=a.filter(e=>0===c.length||c.includes(m.get(e)||""));return(0,t.jsxs)("div",{className:"pii-configuration",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-5",children:[(0,t.jsx)("div",{className:"flex items-center",children:(0,t.jsx)(B,{level:4,className:"mb-0 font-semibold text-gray-800",children:"Configure PII Protection"})}),(0,t.jsx)(S.Z,{count:r.length,showZero:!0,style:{backgroundColor:r.length>0?"#4f46e5":"#d9d9d9"},overflowCount:999,children:(0,t.jsxs)(D,{className:"text-gray-500",children:[r.length," items selected"]})})]}),(0,t.jsxs)("div",{className:"mb-6",children:[(0,t.jsx)(z,{categories:o,selectedCategories:c,onChange:u}),(0,t.jsx)(F,{onSelectAll:e=>{a.forEach(a=>{r.includes(a)||n(a),d(a,e)})},onUnselectAll:()=>{r.forEach(e=>{n(e)})},hasSelectedEntities:r.length>0})]}),(0,t.jsx)(M,{entities:x,selectedEntities:r,selectedActions:i,actions:l,onEntitySelect:n,onActionSelect:d,entityToCategoryMap:m})]})},K=l(87908),V=l(31283),R=l(24199),U=e=>{var a;let{selectedProvider:l,accessToken:r,providerParams:i=null,value:n=null}=e,[d,c]=(0,s.useState)(!1),[m,p]=(0,s.useState)(i),[h,g]=(0,s.useState)(null);if((0,s.useEffect)(()=>{if(i){p(i);return}let e=async()=>{if(r){c(!0),g(null);try{let e=await (0,o.getGuardrailProviderSpecificParams)(r);console.log("Provider params API response:",e),p(e),f(e),y(e)}catch(e){console.error("Error fetching provider params:",e),g("Failed to load provider parameters")}finally{c(!1)}}};i||e()},[r,i]),!l)return null;if(d)return(0,t.jsx)(K.Z,{tip:"Loading provider parameters..."});if(h)return(0,t.jsx)("div",{className:"text-red-500",children:h});let j=null===(a=v[l])||void 0===a?void 0:a.toLowerCase(),_=m&&m[j];if(console.log("Provider key:",j),console.log("Provider fields:",_),!_||0===Object.keys(_).length)return(0,t.jsx)("div",{children:"No configuration fields available for this provider."});console.log("Value:",n);let b=function(e){let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",l=arguments.length>2?arguments[2]:void 0;return Object.entries(e).map(e=>{let[r,i]=e,s=a?"".concat(a,".").concat(r):r,d=l?l[r]:null==n?void 0:n[r];return(console.log("Field value:",d),"ui_friendly_name"===r||"optional_params"===r&&"nested"===i.type&&i.fields)?null:"nested"===i.type&&i.fields?(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"mb-2 font-medium",children:r}),(0,t.jsx)("div",{className:"ml-4 border-l-2 border-gray-200 pl-4",children:b(i.fields,s,d)})]},s):(0,t.jsx)(x.Z.Item,{name:s,label:r,tooltip:i.description,rules:i.required?[{required:!0,message:"".concat(r," is required")}]:void 0,children:"select"===i.type&&i.options?(0,t.jsx)(u.default,{placeholder:i.description,defaultValue:d||i.default_value,children:i.options.map(e=>(0,t.jsx)(u.default.Option,{value:e,children:e},e))}):"multiselect"===i.type&&i.options?(0,t.jsx)(u.default,{mode:"multiple",placeholder:i.description,defaultValue:d||i.default_value,children:i.options.map(e=>(0,t.jsx)(u.default.Option,{value:e,children:e},e))}):"bool"===i.type||"boolean"===i.type?(0,t.jsxs)(u.default,{placeholder:i.description,defaultValue:void 0!==d?String(d):i.default_value,children:[(0,t.jsx)(u.default.Option,{value:"true",children:"True"}),(0,t.jsx)(u.default.Option,{value:"false",children:"False"})]}):"number"===i.type?(0,t.jsx)(R.Z,{step:1,width:400,placeholder:i.description,defaultValue:void 0!==d?Number(d):void 0}):r.includes("password")||r.includes("secret")||r.includes("key")?(0,t.jsx)(V.o,{placeholder:i.description,type:"password",defaultValue:d||""}):(0,t.jsx)(V.o,{placeholder:i.description,type:"text",defaultValue:d||""})},s)})};return(0,t.jsx)(t.Fragment,{children:b(_)})};let{Title:q}=c.default,H=e=>{let{field:a,fieldKey:l,fullFieldKey:r,value:i}=e,[n,d]=s.useState([]),[o,c]=s.useState(a.dict_key_options||[]);s.useEffect(()=>{if(i&&"object"==typeof i){let e=Object.keys(i);d(e.map(e=>({key:e,id:"".concat(e,"_").concat(Date.now(),"_").concat(Math.random())}))),c((a.dict_key_options||[]).filter(a=>!e.includes(a)))}},[i,a.dict_key_options]);let m=e=>{e&&(d([...n,{key:e,id:"".concat(e,"_").concat(Date.now())}]),c(o.filter(a=>a!==e)))},p=(e,a)=>{d(n.filter(a=>a.id!==e)),c([...o,a].sort())};return(0,t.jsxs)("div",{className:"space-y-3",children:[n.map(e=>(0,t.jsxs)("div",{className:"flex items-center space-x-3 p-3 border rounded-lg",children:[(0,t.jsx)("div",{className:"w-24 font-medium text-sm",children:e.key}),(0,t.jsx)("div",{className:"flex-1",children:(0,t.jsx)(x.Z.Item,{name:Array.isArray(r)?[...r,e.key]:[r,e.key],style:{marginBottom:0},initialValue:i&&"object"==typeof i?i[e.key]:void 0,normalize:"number"===a.dict_value_type?e=>{if(null==e||""===e)return;let a=Number(e);return isNaN(a)?e:a}:void 0,children:"number"===a.dict_value_type?(0,t.jsx)(R.Z,{step:1,width:200,placeholder:"Enter ".concat(e.key," value")}):"boolean"===a.dict_value_type?(0,t.jsxs)(u.default,{placeholder:"Select ".concat(e.key," value"),children:[(0,t.jsx)(u.default.Option,{value:!0,children:"True"}),(0,t.jsx)(u.default.Option,{value:!1,children:"False"})]}):(0,t.jsx)(V.o,{placeholder:"Enter ".concat(e.key," value"),type:"text"})})}),(0,t.jsx)("button",{type:"button",className:"text-red-500 hover:text-red-700 text-sm",onClick:()=>p(e.id,e.key),children:"Remove"})]},e.id)),o.length>0&&(0,t.jsxs)("div",{className:"flex items-center space-x-3 mt-2",children:[(0,t.jsx)(u.default,{placeholder:"Select category to configure",style:{width:200},onSelect:e=>e&&m(e),value:void 0,children:o.map(e=>(0,t.jsx)(u.default.Option,{value:e,children:e},e))}),(0,t.jsx)("span",{className:"text-sm text-gray-500",children:"Select a category to add threshold configuration"})]})]})};var Y=e=>{let{optionalParams:a,parentFieldKey:l,values:r}=e,i=(e,a)=>{let i="".concat(l,".").concat(e),s=null==r?void 0:r[e];return(console.log("value",s),"dict"===a.type&&a.dict_key_options)?(0,t.jsxs)("div",{className:"mb-8 p-6 bg-gray-50 rounded-lg border border-gray-200",children:[(0,t.jsx)("div",{className:"mb-4 font-medium text-gray-900 text-base",children:e}),(0,t.jsx)("p",{className:"text-sm text-gray-600 mb-4",children:a.description}),(0,t.jsx)(H,{field:a,fieldKey:e,fullFieldKey:[l,e],value:s})]},i):(0,t.jsx)("div",{className:"mb-8 p-6 bg-white rounded-lg border border-gray-200 shadow-sm",children:(0,t.jsx)(x.Z.Item,{name:[l,e],label:(0,t.jsxs)("div",{className:"mb-2",children:[(0,t.jsx)("div",{className:"font-medium text-gray-900 text-base",children:e}),(0,t.jsx)("p",{className:"text-sm text-gray-600 mt-1",children:a.description})]}),rules:a.required?[{required:!0,message:"".concat(e," is required")}]:void 0,className:"mb-0",initialValue:void 0!==s?s:a.default_value,normalize:"number"===a.type?e=>{if(null==e||""===e)return;let a=Number(e);return isNaN(a)?e:a}:void 0,children:"select"===a.type&&a.options?(0,t.jsx)(u.default,{placeholder:a.description,children:a.options.map(e=>(0,t.jsx)(u.default.Option,{value:e,children:e},e))}):"multiselect"===a.type&&a.options?(0,t.jsx)(u.default,{mode:"multiple",placeholder:a.description,children:a.options.map(e=>(0,t.jsx)(u.default.Option,{value:e,children:e},e))}):"bool"===a.type||"boolean"===a.type?(0,t.jsxs)(u.default,{placeholder:a.description,children:[(0,t.jsx)(u.default.Option,{value:"true",children:"True"}),(0,t.jsx)(u.default.Option,{value:"false",children:"False"})]}):"number"===a.type?(0,t.jsx)(R.Z,{step:1,width:400,placeholder:a.description}):e.includes("password")||e.includes("secret")||e.includes("key")?(0,t.jsx)(V.o,{placeholder:a.description,type:"password"}):(0,t.jsx)(V.o,{placeholder:a.description,type:"text"})})},i)};return a.fields&&0!==Object.keys(a.fields).length?(0,t.jsxs)("div",{className:"guardrail-optional-params",children:[(0,t.jsxs)("div",{className:"mb-8 pb-4 border-b border-gray-100",children:[(0,t.jsx)(q,{level:3,className:"mb-2 font-semibold text-gray-900",children:"Optional Parameters"}),(0,t.jsx)("p",{className:"text-gray-600 text-sm",children:a.description||"Configure additional settings for this guardrail provider"})]}),(0,t.jsx)("div",{className:"space-y-8",children:Object.entries(a.fields).map(e=>{let[a,l]=e;return i(a,l)})})]}):null},Q=l(9114);let{Title:W,Text:X,Link:$}=c.default,{Option:ee}=u.default,{Step:ea}=m.default,el={pre_call:"Before LLM Call - Runs before the LLM call and checks the input (Recommended)",during_call:"During LLM Call - Runs in parallel with the LLM call, with response held until check completes",post_call:"After LLM Call - Runs after the LLM call and checks only the output",logging_only:"Logging Only - Only runs on logging callbacks without affecting the LLM call",pre_mcp_call:"Before MCP Tool Call - Runs before MCP tool execution and validates tool calls",during_mcp_call:"During MCP Tool Call - Runs in parallel with MCP tool execution for monitoring"};var er=e=>{let{visible:a,onClose:l,accessToken:r,onSuccess:i}=e,[n]=x.Z.useForm(),[c,g]=(0,s.useState)(!1),[b,w]=(0,s.useState)(null),[S,k]=(0,s.useState)(null),[Z,C]=(0,s.useState)([]),[I,P]=(0,s.useState)({}),[O,A]=(0,s.useState)(0),[E,G]=(0,s.useState)(null),[L,T]=(0,s.useState)([]),[z,F]=(0,s.useState)(2),[M,B]=(0,s.useState)({});(0,s.useEffect)(()=>{r&&(async()=>{try{let[e,a]=await Promise.all([(0,o.getGuardrailUISettings)(r),(0,o.getGuardrailProviderSpecificParams)(r)]);k(e),G(a),f(a),y(a)}catch(e){console.error("Error fetching guardrail data:",e),Q.Z.fromBackend("Failed to load guardrail configuration")}})()},[r]);let D=e=>{w(e),n.setFieldsValue({config:void 0,presidio_analyzer_api_base:void 0,presidio_anonymizer_api_base:void 0}),C([]),P({}),T([]),F(2),B({})},K=e=>{C(a=>a.includes(e)?a.filter(a=>a!==e):[...a,e])},V=(e,a)=>{P(l=>({...l,[e]:a}))},R=async()=>{try{if(0===O&&(await n.validateFields(["guardrail_name","provider","mode","default_on"]),b)){let e=["guardrail_name","provider","mode","default_on"];"PresidioPII"===b&&e.push("presidio_analyzer_api_base","presidio_anonymizer_api_base"),await n.validateFields(e)}if(1===O&&_(b)&&0===Z.length){Q.Z.fromBackend("Please select at least one PII entity to continue");return}A(O+1)}catch(e){console.error("Form validation failed:",e)}},q=()=>{n.resetFields(),w(null),C([]),P({}),T([]),F(2),B({}),A(0)},H=()=>{q(),l()},W=async()=>{try{g(!0),await n.validateFields();let a=n.getFieldsValue(!0),t=v[a.provider],s={guardrail_name:a.guardrail_name,litellm_params:{guardrail:t,mode:a.mode,default_on:a.default_on},guardrail_info:{}};if("PresidioPII"===a.provider&&Z.length>0){let e={};Z.forEach(a=>{e[a]=I[a]||"MASK"}),s.litellm_params.pii_entities_config=e,a.presidio_analyzer_api_base&&(s.litellm_params.presidio_analyzer_api_base=a.presidio_analyzer_api_base),a.presidio_anonymizer_api_base&&(s.litellm_params.presidio_anonymizer_api_base=a.presidio_anonymizer_api_base)}else if(a.config)try{let e=JSON.parse(a.config);s.guardrail_info=e}catch(e){Q.Z.fromBackend("Invalid JSON in configuration"),g(!1);return}if(console.log("values: ",JSON.stringify(a)),E&&b){var e;let l=null===(e=v[b])||void 0===e?void 0:e.toLowerCase();console.log("providerKey: ",l);let r=E[l]||{},i=new Set;console.log("providerSpecificParams: ",JSON.stringify(r)),Object.keys(r).forEach(e=>{"optional_params"!==e&&i.add(e)}),r.optional_params&&r.optional_params.fields&&Object.keys(r.optional_params.fields).forEach(e=>{i.add(e)}),console.log("allowedParams: ",i),i.forEach(e=>{let l=a[e];if(null==l||""===l){var r;l=null===(r=a.optional_params)||void 0===r?void 0:r[e]}null!=l&&""!==l&&(s.litellm_params[e]=l)})}if(!r)throw Error("No access token available");console.log("Sending guardrail data:",JSON.stringify(s)),await (0,o.createGuardrailCall)(r,s),Q.Z.success("Guardrail created successfully"),q(),i(),l()}catch(e){console.error("Failed to create guardrail:",e),Q.Z.fromBackend("Failed to create guardrail: "+(e instanceof Error?e.message:String(e)))}finally{g(!1)}},X=()=>{var e;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(x.Z.Item,{name:"guardrail_name",label:"Guardrail Name",rules:[{required:!0,message:"Please enter a guardrail name"}],children:(0,t.jsx)(h.o,{placeholder:"Enter a name for this guardrail"})}),(0,t.jsx)(x.Z.Item,{name:"provider",label:"Guardrail Provider",rules:[{required:!0,message:"Please select a provider"}],children:(0,t.jsx)(u.default,{placeholder:"Select a guardrail provider",onChange:D,labelInValue:!1,optionLabelProp:"label",dropdownRender:e=>e,showSearch:!0,children:Object.entries(j()).map(e=>{let[a,l]=e;return(0,t.jsx)(ee,{value:a,label:(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center"},children:[N[l]&&(0,t.jsx)("img",{src:N[l],alt:"",style:{height:"20px",width:"20px",marginRight:"8px",objectFit:"contain"},onError:e=>{e.currentTarget.style.display="none"}}),(0,t.jsx)("span",{children:l})]}),children:(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center"},children:[N[l]&&(0,t.jsx)("img",{src:N[l],alt:"",style:{height:"20px",width:"20px",marginRight:"8px",objectFit:"contain"},onError:e=>{e.currentTarget.style.display="none"}}),(0,t.jsx)("span",{children:l})]})},a)})})}),(0,t.jsx)(x.Z.Item,{name:"mode",label:"Mode",tooltip:"How the guardrail should be applied",rules:[{required:!0,message:"Please select a mode"}],children:(0,t.jsx)(u.default,{optionLabelProp:"label",mode:"multiple",children:(null==S?void 0:null===(e=S.supported_modes)||void 0===e?void 0:e.map(e=>(0,t.jsx)(ee,{value:e,label:e,children:(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("strong",{children:e}),"pre_call"===e&&(0,t.jsx)(p.Z,{color:"green",style:{marginLeft:"8px"},children:"Recommended"})]}),(0,t.jsx)("div",{style:{fontSize:"12px",color:"#888"},children:el[e]})]})},e)))||(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(ee,{value:"pre_call",label:"pre_call",children:(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("strong",{children:"pre_call"})," ",(0,t.jsx)(p.Z,{color:"green",children:"Recommended"})]}),(0,t.jsx)("div",{style:{fontSize:"12px",color:"#888"},children:el.pre_call})]})}),(0,t.jsx)(ee,{value:"during_call",label:"during_call",children:(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{children:(0,t.jsx)("strong",{children:"during_call"})}),(0,t.jsx)("div",{style:{fontSize:"12px",color:"#888"},children:el.during_call})]})}),(0,t.jsx)(ee,{value:"post_call",label:"post_call",children:(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{children:(0,t.jsx)("strong",{children:"post_call"})}),(0,t.jsx)("div",{style:{fontSize:"12px",color:"#888"},children:el.post_call})]})}),(0,t.jsx)(ee,{value:"logging_only",label:"logging_only",children:(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{children:(0,t.jsx)("strong",{children:"logging_only"})}),(0,t.jsx)("div",{style:{fontSize:"12px",color:"#888"},children:el.logging_only})]})})]})})}),(0,t.jsx)(x.Z.Item,{name:"default_on",label:"Always On",tooltip:"If enabled, this guardrail will be applied to all requests by default.",children:(0,t.jsxs)(u.default,{children:[(0,t.jsx)(u.default.Option,{value:!0,children:"Yes"}),(0,t.jsx)(u.default.Option,{value:!1,children:"No"})]})}),(0,t.jsx)(U,{selectedProvider:b,accessToken:r,providerParams:E})]})},$=()=>S&&"PresidioPII"===b?(0,t.jsx)(J,{entities:S.supported_entities,actions:S.supported_actions,selectedEntities:Z,selectedActions:I,onEntitySelect:K,onActionSelect:V,entityCategories:S.pii_entity_categories}):null,er=()=>{var e;if(!b||!E)return null;console.log("guardrail_provider_map: ",v),console.log("selectedProvider: ",b);let a=null===(e=v[b])||void 0===e?void 0:e.toLowerCase(),l=E&&E[a];return l&&l.optional_params?(0,t.jsx)(Y,{optionalParams:l.optional_params,parentFieldKey:"optional_params"}):null};return(0,t.jsx)(d.Z,{title:"Add Guardrail",open:a,onCancel:H,footer:null,width:700,children:(0,t.jsxs)(x.Z,{form:n,layout:"vertical",initialValues:{mode:"pre_call",default_on:!1},children:[(0,t.jsxs)(m.default,{current:O,className:"mb-6",children:[(0,t.jsx)(ea,{title:"Basic Info"}),(0,t.jsx)(ea,{title:_(b)?"PII Configuration":"Provider Configuration"})]}),(()=>{switch(O){case 0:return X();case 1:if(_(b))return $();return er();default:return null}})(),(0,t.jsxs)("div",{className:"flex justify-end space-x-2 mt-4",children:[O>0&&(0,t.jsx)(h.z,{variant:"secondary",onClick:()=>{A(O-1)},children:"Previous"}),O<2&&(0,t.jsx)(h.z,{onClick:R,children:"Next"}),2===O&&(0,t.jsx)(h.z,{onClick:W,loading:c,children:"Create Guardrail"}),(0,t.jsx)(h.z,{variant:"secondary",onClick:H,children:"Cancel"})]})]})})},ei=l(20831),et=l(47323),es=l(21626),en=l(97214),ed=l(28241),eo=l(58834),ec=l(69552),eu=l(71876),em=l(74998),ex=l(44633),ep=l(86462),eh=l(49084),eg=l(1309),ef=l(71594),ej=l(24525),ev=l(64482),ey=l(63709);let{Title:e_,Text:eb}=c.default,{Option:eN}=u.default;var ew=e=>{var a;let{visible:l,onClose:r,accessToken:i,onSuccess:n,guardrailId:c,initialValues:m}=e,[p]=x.Z.useForm(),[g,f]=(0,s.useState)(!1),[y,_]=(0,s.useState)((null==m?void 0:m.provider)||null),[b,w]=(0,s.useState)(null),[S,k]=(0,s.useState)([]),[Z,C]=(0,s.useState)({});(0,s.useEffect)(()=>{(async()=>{try{if(!i)return;let e=await (0,o.getGuardrailUISettings)(i);w(e)}catch(e){console.error("Error fetching guardrail settings:",e),Q.Z.fromBackend("Failed to load guardrail settings")}})()},[i]),(0,s.useEffect)(()=>{(null==m?void 0:m.pii_entities_config)&&Object.keys(m.pii_entities_config).length>0&&(k(Object.keys(m.pii_entities_config)),C(m.pii_entities_config))},[m]);let I=e=>{k(a=>a.includes(e)?a.filter(a=>a!==e):[...a,e])},P=(e,a)=>{C(l=>({...l,[e]:a}))},O=async()=>{try{f(!0);let e=await p.validateFields(),a=v[e.provider],l={guardrail_id:c,guardrail:{guardrail_name:e.guardrail_name,litellm_params:{guardrail:a,mode:e.mode,default_on:e.default_on},guardrail_info:{}}};if("PresidioPII"===e.provider&&S.length>0){let e={};S.forEach(a=>{e[a]=Z[a]||"MASK"}),l.guardrail.litellm_params.pii_entities_config=e}else if(e.config)try{let a=JSON.parse(e.config);"Bedrock"===e.provider&&a?(a.guardrail_id&&(l.guardrail.litellm_params.guardrailIdentifier=a.guardrail_id),a.guardrail_version&&(l.guardrail.litellm_params.guardrailVersion=a.guardrail_version)):l.guardrail.guardrail_info=a}catch(e){Q.Z.fromBackend("Invalid JSON in configuration"),f(!1);return}if(!i)throw Error("No access token available");console.log("Sending guardrail update data:",JSON.stringify(l));let t=await fetch("/guardrails/".concat(c),{method:"PUT",headers:{Authorization:"Bearer ".concat(i),"Content-Type":"application/json"},body:JSON.stringify(l)});if(!t.ok){let e=await t.text();throw Error(e||"Failed to update guardrail")}Q.Z.success("Guardrail updated successfully"),n(),r()}catch(e){console.error("Failed to update guardrail:",e),Q.Z.fromBackend("Failed to update guardrail: "+(e instanceof Error?e.message:String(e)))}finally{f(!1)}},A=()=>b&&y&&"PresidioPII"===y?(0,t.jsx)(J,{entities:b.supported_entities,actions:b.supported_actions,selectedEntities:S,selectedActions:Z,onEntitySelect:I,onActionSelect:P,entityCategories:b.pii_entity_categories}):null;return(0,t.jsx)(d.Z,{title:"Edit Guardrail",open:l,onCancel:r,footer:null,width:700,children:(0,t.jsxs)(x.Z,{form:p,layout:"vertical",initialValues:m,children:[(0,t.jsx)(x.Z.Item,{name:"guardrail_name",label:"Guardrail Name",rules:[{required:!0,message:"Please enter a guardrail name"}],children:(0,t.jsx)(h.o,{placeholder:"Enter a name for this guardrail"})}),(0,t.jsx)(x.Z.Item,{name:"provider",label:"Guardrail Provider",rules:[{required:!0,message:"Please select a provider"}],children:(0,t.jsx)(u.default,{placeholder:"Select a guardrail provider",onChange:e=>{_(e),p.setFieldsValue({config:void 0}),k([]),C({})},disabled:!0,optionLabelProp:"label",children:Object.entries(j()).map(e=>{let[a,l]=e;return(0,t.jsx)(eN,{value:a,label:l,children:(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center"},children:[N[l]&&(0,t.jsx)("img",{src:N[l],alt:"",style:{height:"20px",width:"20px",marginRight:"8px",objectFit:"contain"},onError:e=>{e.currentTarget.style.display="none"}}),(0,t.jsx)("span",{children:l})]})},a)})})}),(0,t.jsx)(x.Z.Item,{name:"mode",label:"Mode",tooltip:"How the guardrail should be applied",rules:[{required:!0,message:"Please select a mode"}],children:(0,t.jsx)(u.default,{children:(null==b?void 0:null===(a=b.supported_modes)||void 0===a?void 0:a.map(e=>(0,t.jsx)(eN,{value:e,children:e},e)))||(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(eN,{value:"pre_call",children:"pre_call"}),(0,t.jsx)(eN,{value:"post_call",children:"post_call"})]})})}),(0,t.jsx)(x.Z.Item,{name:"default_on",label:"Always On",tooltip:"If enabled, this guardrail will be applied to all requests by default",valuePropName:"checked",children:(0,t.jsx)(ey.Z,{})}),(()=>{if(!y)return null;if("PresidioPII"===y)return A();switch(y){case"Aporia":return(0,t.jsx)(x.Z.Item,{label:"Aporia Configuration",name:"config",tooltip:"JSON configuration for Aporia",children:(0,t.jsx)(ev.default.TextArea,{rows:4,placeholder:'{\n "api_key": "your_aporia_api_key",\n "project_name": "your_project_name"\n}'})});case"AimSecurity":return(0,t.jsx)(x.Z.Item,{label:"Aim Security Configuration",name:"config",tooltip:"JSON configuration for Aim Security",children:(0,t.jsx)(ev.default.TextArea,{rows:4,placeholder:'{\n "api_key": "your_aim_api_key"\n}'})});case"Bedrock":return(0,t.jsx)(x.Z.Item,{label:"Amazon Bedrock Configuration",name:"config",tooltip:"JSON configuration for Amazon Bedrock guardrails",children:(0,t.jsx)(ev.default.TextArea,{rows:4,placeholder:'{\n "guardrail_id": "your_guardrail_id",\n "guardrail_version": "your_guardrail_version"\n}'})});case"GuardrailsAI":return(0,t.jsx)(x.Z.Item,{label:"Guardrails.ai Configuration",name:"config",tooltip:"JSON configuration for Guardrails.ai",children:(0,t.jsx)(ev.default.TextArea,{rows:4,placeholder:'{\n "api_key": "your_guardrails_api_key",\n "guardrail_id": "your_guardrail_id"\n}'})});case"LakeraAI":return(0,t.jsx)(x.Z.Item,{label:"Lakera AI Configuration",name:"config",tooltip:"JSON configuration for Lakera AI",children:(0,t.jsx)(ev.default.TextArea,{rows:4,placeholder:'{\n "api_key": "your_lakera_api_key"\n}'})});case"PromptInjection":return(0,t.jsx)(x.Z.Item,{label:"Prompt Injection Configuration",name:"config",tooltip:"JSON configuration for prompt injection detection",children:(0,t.jsx)(ev.default.TextArea,{rows:4,placeholder:'{\n "threshold": 0.8\n}'})});default:return(0,t.jsx)(x.Z.Item,{label:"Custom Configuration",name:"config",tooltip:"JSON configuration for your custom guardrail",children:(0,t.jsx)(ev.default.TextArea,{rows:4,placeholder:'{\n "key1": "value1",\n "key2": "value2"\n}'})})}})(),(0,t.jsxs)("div",{className:"flex justify-end space-x-2 mt-4",children:[(0,t.jsx)(h.z,{variant:"secondary",onClick:r,children:"Cancel"}),(0,t.jsx)(h.z,{onClick:O,loading:g,children:"Update Guardrail"})]})]})})},eS=e=>{let{guardrailsList:a,isLoading:l,onDeleteClick:r,accessToken:i,onGuardrailUpdated:n,isAdmin:d=!1,onGuardrailClick:o}=e,[c,u]=(0,s.useState)([{id:"created_at",desc:!0}]),[m,x]=(0,s.useState)(!1),[p,h]=(0,s.useState)(null),g=e=>e?new Date(e).toLocaleString():"-",f=[{header:"Guardrail ID",accessorKey:"guardrail_id",cell:e=>(0,t.jsx)(k.Z,{title:String(e.getValue()||""),children:(0,t.jsx)(ei.Z,{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]",onClick:()=>e.getValue()&&o(e.getValue()),children:e.getValue()?"".concat(String(e.getValue()).slice(0,7),"..."):""})})},{header:"Name",accessorKey:"guardrail_name",cell:e=>{let{row:a}=e,l=a.original;return(0,t.jsx)(k.Z,{title:l.guardrail_name,children:(0,t.jsx)("span",{className:"text-xs font-medium",children:l.guardrail_name||"-"})})}},{header:"Provider",accessorKey:"litellm_params.guardrail",cell:e=>{let{row:a}=e,{logo:l,displayName:r}=w(a.original.litellm_params.guardrail);return(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[l&&(0,t.jsx)("img",{src:l,alt:"".concat(r," logo"),className:"w-4 h-4",onError:e=>{e.target.style.display="none"}}),(0,t.jsx)("span",{className:"text-xs",children:r})]})}},{header:"Mode",accessorKey:"litellm_params.mode",cell:e=>{let{row:a}=e,l=a.original;return(0,t.jsx)("span",{className:"text-xs",children:l.litellm_params.mode})}},{header:"Default On",accessorKey:"litellm_params.default_on",cell:e=>{var a,l;let{row:r}=e,i=r.original;return(0,t.jsx)(eg.C,{color:(null===(a=i.litellm_params)||void 0===a?void 0:a.default_on)?"green":"gray",className:"text-xs font-normal",size:"xs",children:(null===(l=i.litellm_params)||void 0===l?void 0:l.default_on)?"Default On":"Default Off"})}},{header:"Created At",accessorKey:"created_at",cell:e=>{let{row:a}=e,l=a.original;return(0,t.jsx)(k.Z,{title:l.created_at,children:(0,t.jsx)("span",{className:"text-xs",children:g(l.created_at)})})}},{header:"Updated At",accessorKey:"updated_at",cell:e=>{let{row:a}=e,l=a.original;return(0,t.jsx)(k.Z,{title:l.updated_at,children:(0,t.jsx)("span",{className:"text-xs",children:g(l.updated_at)})})}},{id:"actions",header:"",cell:e=>{let{row:a}=e,l=a.original;return(0,t.jsx)("div",{className:"flex space-x-2",children:(0,t.jsx)(et.Z,{icon:em.Z,size:"sm",onClick:()=>l.guardrail_id&&r(l.guardrail_id,l.guardrail_name||"Unnamed Guardrail"),className:"cursor-pointer hover:text-red-500",tooltip:"Delete guardrail"})})}}],j=(0,ef.b7)({data:a,columns:f,state:{sorting:c},onSortingChange:u,getCoreRowModel:(0,ej.sC)(),getSortedRowModel:(0,ej.tj)(),enableSorting:!0});return(0,t.jsxs)("div",{className:"rounded-lg custom-border relative",children:[(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)(es.Z,{className:"[&_td]:py-0.5 [&_th]:py-1",children:[(0,t.jsx)(eo.Z,{children:j.getHeaderGroups().map(e=>(0,t.jsx)(eu.Z,{children:e.headers.map(e=>(0,t.jsx)(ec.Z,{className:"py-1 h-8 ".concat("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,ef.ie)(e.column.columnDef.header,e.getContext())}),"actions"!==e.id&&(0,t.jsx)("div",{className:"w-4",children:e.column.getIsSorted()?({asc:(0,t.jsx)(ex.Z,{className:"h-4 w-4 text-blue-500"}),desc:(0,t.jsx)(ep.Z,{className:"h-4 w-4 text-blue-500"})})[e.column.getIsSorted()]:(0,t.jsx)(eh.Z,{className:"h-4 w-4 text-gray-400"})})]})},e.id))},e.id))}),(0,t.jsx)(en.Z,{children:l?(0,t.jsx)(eu.Z,{children:(0,t.jsx)(ed.Z,{colSpan:f.length,className:"h-8 text-center",children:(0,t.jsx)("div",{className:"text-center text-gray-500",children:(0,t.jsx)("p",{children:"Loading..."})})})}):a.length>0?j.getRowModel().rows.map(e=>(0,t.jsx)(eu.Z,{className:"h-8",children:e.getVisibleCells().map(e=>(0,t.jsx)(ed.Z,{className:"py-0.5 max-h-8 overflow-hidden text-ellipsis whitespace-nowrap ".concat("actions"===e.column.id?"sticky right-0 bg-white shadow-[-4px_0_8px_-6px_rgba(0,0,0,0.1)]":""),children:(0,ef.ie)(e.column.columnDef.cell,e.getContext())},e.id))},e.id)):(0,t.jsx)(eu.Z,{children:(0,t.jsx)(ed.Z,{colSpan:f.length,className:"h-8 text-center",children:(0,t.jsx)("div",{className:"text-center text-gray-500",children:(0,t.jsx)("p",{children:"No guardrails found"})})})})})]})}),p&&(0,t.jsx)(ew,{visible:m,onClose:()=>x(!1),accessToken:i,onSuccess:()=>{x(!1),h(null),n()},guardrailId:p.guardrail_id||"",initialValues:{guardrail_name:p.guardrail_name||"",provider:Object.keys(v).find(e=>v[e]===(null==p?void 0:p.litellm_params.guardrail))||"",mode:p.litellm_params.mode,default_on:p.litellm_params.default_on,pii_entities_config:p.litellm_params.pii_entities_config,...p.guardrail_info}})]})},ek=l(20347),eZ=l(30078),eC=l(23496),eI=l(10900),eP=l(59872),eO=l(30401),eA=l(78867),eE=e=>{var a,l,r,i,n,d,c,m,p,h,g;let{guardrailId:f,onClose:j,accessToken:y,isAdmin:_}=e,[b,N]=(0,s.useState)(null),[S,k]=(0,s.useState)(null),[C,I]=(0,s.useState)(!0),[P,O]=(0,s.useState)(!1),[A]=x.Z.useForm(),[E,G]=(0,s.useState)([]),[L,T]=(0,s.useState)({}),[z,F]=(0,s.useState)(null),[M,B]=(0,s.useState)({}),D=async()=>{try{var e;if(I(!0),!y)return;let a=await (0,o.getGuardrailInfo)(y,f);if(N(a),null===(e=a.litellm_params)||void 0===e?void 0:e.pii_entities_config){let e=a.litellm_params.pii_entities_config;if(G([]),T({}),Object.keys(e).length>0){let a=[],l={};Object.entries(e).forEach(e=>{let[r,i]=e;a.push(r),l[r]="string"==typeof i?i:"MASK"}),G(a),T(l)}}else G([]),T({})}catch(e){Q.Z.fromBackend("Failed to load guardrail information"),console.error("Error fetching guardrail info:",e)}finally{I(!1)}},K=async()=>{try{if(!y)return;let e=await (0,o.getGuardrailProviderSpecificParams)(y);k(e)}catch(e){console.error("Error fetching guardrail provider specific params:",e)}},V=async()=>{try{if(!y)return;let e=await (0,o.getGuardrailUISettings)(y);F(e)}catch(e){console.error("Error fetching guardrail UI settings:",e)}};(0,s.useEffect)(()=>{K()},[y]),(0,s.useEffect)(()=>{D(),V()},[f,y]),(0,s.useEffect)(()=>{if(b&&A){var e;A.setFieldsValue({guardrail_name:b.guardrail_name,...b.litellm_params,guardrail_info:b.guardrail_info?JSON.stringify(b.guardrail_info,null,2):"",...(null===(e=b.litellm_params)||void 0===e?void 0:e.optional_params)&&{optional_params:b.litellm_params.optional_params}})}},[b,S,A]);let R=async e=>{try{var a,l,r;if(!y)return;let i={litellm_params:{}};e.guardrail_name!==b.guardrail_name&&(i.guardrail_name=e.guardrail_name),e.default_on!==(null===(a=b.litellm_params)||void 0===a?void 0:a.default_on)&&(i.litellm_params.default_on=e.default_on);let t=b.guardrail_info,s=e.guardrail_info?JSON.parse(e.guardrail_info):void 0;JSON.stringify(t)!==JSON.stringify(s)&&(i.guardrail_info=s);let n=(null===(l=b.litellm_params)||void 0===l?void 0:l.pii_entities_config)||{},d={};E.forEach(e=>{d[e]=L[e]||"MASK"}),JSON.stringify(n)!==JSON.stringify(d)&&(i.litellm_params.pii_entities_config=d);let c=Object.keys(v).find(e=>{var a;return v[e]===(null===(a=b.litellm_params)||void 0===a?void 0:a.guardrail)});if(console.log("values: ",JSON.stringify(e)),console.log("currentProvider: ",c),S&&c){let a=S[null===(r=v[c])||void 0===r?void 0:r.toLowerCase()]||{},l=new Set;console.log("providerSpecificParams: ",JSON.stringify(a)),Object.keys(a).forEach(e=>{"optional_params"!==e&&l.add(e)}),a.optional_params&&a.optional_params.fields&&Object.keys(a.optional_params.fields).forEach(e=>{l.add(e)}),console.log("allowedParams: ",l),l.forEach(a=>{var l,r;let t=e[a];(null==t||""===t)&&(t=null===(r=e.optional_params)||void 0===r?void 0:r[a]);let s=null===(l=b.litellm_params)||void 0===l?void 0:l[a];JSON.stringify(t)!==JSON.stringify(s)&&(null!=t&&""!==t?i.litellm_params[a]=t:null!=s&&""!==s&&(i.litellm_params[a]=null))})}if(0===Object.keys(i.litellm_params).length&&delete i.litellm_params,0===Object.keys(i).length){Q.Z.info("No changes detected"),O(!1);return}await (0,o.updateGuardrailCall)(y,f,i),Q.Z.success("Guardrail updated successfully"),D(),O(!1)}catch(e){console.error("Error updating guardrail:",e),Q.Z.fromBackend("Failed to update guardrail")}};if(C)return(0,t.jsx)("div",{className:"p-4",children:"Loading..."});if(!b)return(0,t.jsx)("div",{className:"p-4",children:"Guardrail not found"});let q=e=>e?new Date(e).toLocaleString():"-",{logo:H,displayName:W}=w((null===(a=b.litellm_params)||void 0===a?void 0:a.guardrail)||""),X=async(e,a)=>{await (0,eP.vQ)(e)&&(B(e=>({...e,[a]:!0})),setTimeout(()=>{B(e=>({...e,[a]:!1}))},2e3))};return(0,t.jsxs)("div",{className:"p-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(eZ.zx,{icon:eI.Z,variant:"light",onClick:j,className:"mb-4",children:"Back to Guardrails"}),(0,t.jsx)(eZ.Dx,{children:b.guardrail_name||"Unnamed Guardrail"}),(0,t.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,t.jsx)(eZ.xv,{className:"text-gray-500 font-mono",children:b.guardrail_id}),(0,t.jsx)(Z.ZP,{type:"text",size:"small",icon:M["guardrail-id"]?(0,t.jsx)(eO.Z,{size:12}):(0,t.jsx)(eA.Z,{size:12}),onClick:()=>X(b.guardrail_id,"guardrail-id"),className:"left-2 z-10 transition-all duration-200 ".concat(M["guardrail-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]})]}),(0,t.jsxs)(eZ.v0,{children:[(0,t.jsxs)(eZ.td,{className:"mb-4",children:[(0,t.jsx)(eZ.OK,{children:"Overview"},"overview"),_?(0,t.jsx)(eZ.OK,{children:"Settings"},"settings"):(0,t.jsx)(t.Fragment,{})]}),(0,t.jsxs)(eZ.nP,{children:[(0,t.jsxs)(eZ.x4,{children:[(0,t.jsxs)(eZ.rj,{numItems:1,numItemsSm:2,numItemsLg:3,className:"gap-6",children:[(0,t.jsxs)(eZ.Zb,{children:[(0,t.jsx)(eZ.xv,{children:"Provider"}),(0,t.jsxs)("div",{className:"mt-2 flex items-center space-x-2",children:[H&&(0,t.jsx)("img",{src:H,alt:"".concat(W," logo"),className:"w-6 h-6",onError:e=>{e.target.style.display="none"}}),(0,t.jsx)(eZ.Dx,{children:W})]})]}),(0,t.jsxs)(eZ.Zb,{children:[(0,t.jsx)(eZ.xv,{children:"Mode"}),(0,t.jsxs)("div",{className:"mt-2",children:[(0,t.jsx)(eZ.Dx,{children:(null===(l=b.litellm_params)||void 0===l?void 0:l.mode)||"-"}),(0,t.jsx)(eZ.Ct,{color:(null===(r=b.litellm_params)||void 0===r?void 0:r.default_on)?"green":"gray",children:(null===(i=b.litellm_params)||void 0===i?void 0:i.default_on)?"Default On":"Default Off"})]})]}),(0,t.jsxs)(eZ.Zb,{children:[(0,t.jsx)(eZ.xv,{children:"Created At"}),(0,t.jsxs)("div",{className:"mt-2",children:[(0,t.jsx)(eZ.Dx,{children:q(b.created_at)}),(0,t.jsxs)(eZ.xv,{children:["Last Updated: ",q(b.updated_at)]})]})]})]}),(null===(n=b.litellm_params)||void 0===n?void 0:n.pii_entities_config)&&Object.keys(b.litellm_params.pii_entities_config).length>0&&(0,t.jsx)(eZ.Zb,{className:"mt-6",children:(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsx)(eZ.xv,{className:"font-medium",children:"PII Protection"}),(0,t.jsxs)(eZ.Ct,{color:"blue",children:[Object.keys(b.litellm_params.pii_entities_config).length," PII entities configured"]})]})}),b.guardrail_info&&Object.keys(b.guardrail_info).length>0&&(0,t.jsxs)(eZ.Zb,{className:"mt-6",children:[(0,t.jsx)(eZ.xv,{children:"Guardrail Info"}),(0,t.jsx)("div",{className:"mt-2 space-y-2",children:Object.entries(b.guardrail_info).map(e=>{let[a,l]=e;return(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)(eZ.xv,{className:"font-medium w-1/3",children:a}),(0,t.jsx)(eZ.xv,{className:"w-2/3",children:"object"==typeof l?JSON.stringify(l,null,2):String(l)})]},a)})})]})]}),_&&(0,t.jsx)(eZ.x4,{children:(0,t.jsxs)(eZ.Zb,{children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,t.jsx)(eZ.Dx,{children:"Guardrail Settings"}),!P&&(0,t.jsx)(eZ.zx,{onClick:()=>O(!0),children:"Edit Settings"})]}),P?(0,t.jsxs)(x.Z,{form:A,onFinish:R,initialValues:{guardrail_name:b.guardrail_name,...b.litellm_params,guardrail_info:b.guardrail_info?JSON.stringify(b.guardrail_info,null,2):"",...(null===(d=b.litellm_params)||void 0===d?void 0:d.optional_params)&&{optional_params:b.litellm_params.optional_params}},layout:"vertical",children:[(0,t.jsx)(x.Z.Item,{label:"Guardrail Name",name:"guardrail_name",rules:[{required:!0,message:"Please input a guardrail name"}],children:(0,t.jsx)(eZ.oi,{})}),(0,t.jsx)(x.Z.Item,{label:"Default On",name:"default_on",children:(0,t.jsxs)(u.default,{children:[(0,t.jsx)(u.default.Option,{value:!0,children:"Yes"}),(0,t.jsx)(u.default.Option,{value:!1,children:"No"})]})}),(null===(c=b.litellm_params)||void 0===c?void 0:c.guardrail)==="presidio"&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(eC.Z,{orientation:"left",children:"PII Protection"}),(0,t.jsx)("div",{className:"mb-6",children:z&&(0,t.jsx)(J,{entities:z.supported_entities,actions:z.supported_actions,selectedEntities:E,selectedActions:L,onEntitySelect:e=>{G(a=>a.includes(e)?a.filter(a=>a!==e):[...a,e])},onActionSelect:(e,a)=>{T(l=>({...l,[e]:a}))},entityCategories:z.pii_entity_categories})})]}),(0,t.jsx)(eC.Z,{orientation:"left",children:"Provider Settings"}),(0,t.jsx)(U,{selectedProvider:Object.keys(v).find(e=>{var a;return v[e]===(null===(a=b.litellm_params)||void 0===a?void 0:a.guardrail)})||null,accessToken:y,providerParams:S,value:b.litellm_params}),S&&(()=>{var e;let a=Object.keys(v).find(e=>{var a;return v[e]===(null===(a=b.litellm_params)||void 0===a?void 0:a.guardrail)});if(!a)return null;let l=S[null===(e=v[a])||void 0===e?void 0:e.toLowerCase()];return l&&l.optional_params?(0,t.jsx)(Y,{optionalParams:l.optional_params,parentFieldKey:"optional_params",values:b.litellm_params}):null})(),(0,t.jsx)(eC.Z,{orientation:"left",children:"Advanced Settings"}),(0,t.jsx)(x.Z.Item,{label:"Guardrail Information",name:"guardrail_info",children:(0,t.jsx)(ev.default.TextArea,{rows:5})}),(0,t.jsxs)("div",{className:"flex justify-end gap-2 mt-6",children:[(0,t.jsx)(Z.ZP,{onClick:()=>O(!1),children:"Cancel"}),(0,t.jsx)(eZ.zx,{children:"Save Changes"})]})]}):(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(eZ.xv,{className:"font-medium",children:"Guardrail ID"}),(0,t.jsx)("div",{className:"font-mono",children:b.guardrail_id})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(eZ.xv,{className:"font-medium",children:"Guardrail Name"}),(0,t.jsx)("div",{children:b.guardrail_name||"Unnamed Guardrail"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(eZ.xv,{className:"font-medium",children:"Provider"}),(0,t.jsx)("div",{children:W})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(eZ.xv,{className:"font-medium",children:"Mode"}),(0,t.jsx)("div",{children:(null===(m=b.litellm_params)||void 0===m?void 0:m.mode)||"-"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(eZ.xv,{className:"font-medium",children:"Default On"}),(0,t.jsx)(eZ.Ct,{color:(null===(p=b.litellm_params)||void 0===p?void 0:p.default_on)?"green":"gray",children:(null===(h=b.litellm_params)||void 0===h?void 0:h.default_on)?"Yes":"No"})]}),(null===(g=b.litellm_params)||void 0===g?void 0:g.pii_entities_config)&&Object.keys(b.litellm_params.pii_entities_config).length>0&&(0,t.jsxs)("div",{children:[(0,t.jsx)(eZ.xv,{className:"font-medium",children:"PII Protection"}),(0,t.jsx)("div",{className:"mt-2",children:(0,t.jsxs)(eZ.Ct,{color:"blue",children:[Object.keys(b.litellm_params.pii_entities_config).length," PII entities configured"]})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(eZ.xv,{className:"font-medium",children:"Created At"}),(0,t.jsx)("div",{children:q(b.created_at)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(eZ.xv,{className:"font-medium",children:"Last Updated"}),(0,t.jsx)("div",{children:q(b.updated_at)})]})]})]})})]})]})]})},eG=l(12514),eL=l(84264),eT=l(49566),ez=l(96761),eF=l(85180),eM=l(35631),eB=l(29436),eD=l(41169),eJ=l(16312),eK=l(15424),eV=l(23639),eR=l(77565),eU=l(70464),eq=l(83669),eH=l(5540);let{Text:eY}=c.default;var eQ=function(e){let{results:a,errors:l}=e,[r,i]=(0,s.useState)(new Set),n=e=>{let a=new Set(r);a.has(e)?a.delete(e):a.add(e),i(a)},d=async e=>{try{if(navigator.clipboard&&window.isSecureContext)return await navigator.clipboard.writeText(e),!0;{let a=document.createElement("textarea");a.value=e,a.style.position="fixed",a.style.opacity="0",document.body.appendChild(a),a.focus(),a.select();let l=document.execCommand("copy");if(document.body.removeChild(a),!l)throw Error("execCommand failed");return!0}}catch(e){return console.error("Copy failed:",e),!1}};return a||l?(0,t.jsxs)("div",{className:"space-y-3 pt-4 border-t border-gray-200",children:[(0,t.jsx)("h3",{className:"text-sm font-semibold text-gray-900",children:"Results"}),a&&a.map(e=>{let a=r.has(e.guardrailName);return(0,t.jsx)(eG.Z,{className:"bg-green-50 border-green-200",children:(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2 cursor-pointer flex-1",onClick:()=>n(e.guardrailName),children:[a?(0,t.jsx)(eR.Z,{className:"text-gray-500 text-xs"}):(0,t.jsx)(eU.Z,{className:"text-gray-500 text-xs"}),(0,t.jsx)(eq.Z,{className:"text-green-600 text-lg"}),(0,t.jsx)("span",{className:"text-sm font-medium text-green-800",children:e.guardrailName})]}),(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-1 text-xs text-gray-600",children:[(0,t.jsx)(eH.Z,{}),(0,t.jsxs)("span",{className:"font-medium",children:[e.latency,"ms"]})]}),!a&&(0,t.jsx)(ei.Z,{size:"xs",variant:"secondary",icon:eV.Z,onClick:async()=>{await d(e.response_text)?Q.Z.success("Result copied to clipboard"):Q.Z.fromBackend("Failed to copy result")},children:"Copy"})]})]}),!a&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"bg-white border border-green-200 rounded p-3",children:[(0,t.jsx)("label",{className:"text-xs font-medium text-gray-600 mb-2 block",children:"Output Text"}),(0,t.jsx)("div",{className:"font-mono text-sm text-gray-900 whitespace-pre-wrap break-words",children:e.response_text})]}),(0,t.jsxs)("div",{className:"text-xs text-gray-600",children:[(0,t.jsx)("span",{className:"font-medium",children:"Characters:"})," ",e.response_text.length]})]})]})},e.guardrailName)}),l&&l.map(e=>{let a=r.has(e.guardrailName);return(0,t.jsx)(eG.Z,{className:"bg-red-50 border-red-200",children:(0,t.jsxs)("div",{className:"flex items-start space-x-2",children:[(0,t.jsx)("div",{className:"cursor-pointer mt-0.5",onClick:()=>n(e.guardrailName),children:a?(0,t.jsx)(eR.Z,{className:"text-gray-500 text-xs"}):(0,t.jsx)(eU.Z,{className:"text-gray-500 text-xs"})}),(0,t.jsx)("div",{className:"text-red-600 mt-0.5",children:(0,t.jsx)("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 20 20",children:(0,t.jsx)("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})})}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,t.jsxs)("p",{className:"text-sm font-medium text-red-800 cursor-pointer",onClick:()=>n(e.guardrailName),children:[e.guardrailName," - Error"]}),(0,t.jsxs)("div",{className:"flex items-center space-x-1 text-xs text-gray-600",children:[(0,t.jsx)(eH.Z,{}),(0,t.jsxs)("span",{className:"font-medium",children:[e.latency,"ms"]})]})]}),!a&&(0,t.jsx)("p",{className:"text-sm text-red-700 mt-1",children:e.error.message})]})]})},e.guardrailName)})]}):null};let{TextArea:eW}=ev.default,{Text:eX}=c.default;var e$=function(e){let{guardrailNames:a,onSubmit:l,isLoading:r,results:i,errors:n,onClose:d}=e,[o,c]=(0,s.useState)(""),u=()=>{if(!o.trim()){Q.Z.fromBackend("Please enter text to test");return}l(o)},m=async e=>{try{if(navigator.clipboard&&window.isSecureContext)return await navigator.clipboard.writeText(e),!0;{let a=document.createElement("textarea");a.value=e,a.style.position="fixed",a.style.opacity="0",document.body.appendChild(a),a.focus(),a.select();let l=document.execCommand("copy");if(document.body.removeChild(a),!l)throw Error("execCommand failed");return!0}}catch(e){return console.error("Copy failed:",e),!1}},x=async()=>{await m(o)?Q.Z.success("Input copied to clipboard"):Q.Z.fromBackend("Failed to copy input")};return(0,t.jsxs)("div",{className:"space-y-4 h-full flex flex-col",children:[(0,t.jsx)("div",{className:"flex items-center justify-between pb-3 border-b border-gray-200",children:(0,t.jsx)("div",{className:"flex items-center space-x-3",children:(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2 mb-1",children:[(0,t.jsx)("h2",{className:"text-lg font-semibold text-gray-900",children:"Test Guardrails:"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:a.map(e=>(0,t.jsx)("div",{className:"inline-flex items-center space-x-1 bg-blue-50 px-3 py-1 rounded-md border border-blue-200",children:(0,t.jsx)("span",{className:"font-mono text-blue-700 font-medium text-sm",children:e})},e))})]}),(0,t.jsxs)("p",{className:"text-sm text-gray-500",children:["Test ",a.length>1?"guardrails":"guardrail"," and compare results"]})]})})}),(0,t.jsxs)("div",{className:"flex-1 overflow-auto space-y-4",children:[(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-2",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Input Text"}),(0,t.jsx)(k.Z,{title:"Press Enter to submit. Use Shift+Enter for new line.",children:(0,t.jsx)(eK.Z,{className:"text-gray-400 cursor-help"})})]}),o&&(0,t.jsx)(eJ.z,{size:"xs",variant:"secondary",icon:eV.Z,onClick:x,children:"Copy Input"})]}),(0,t.jsx)(eW,{value:o,onChange:e=>c(e.target.value),onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||e.ctrlKey||e.metaKey||(e.preventDefault(),u())},placeholder:"Enter text to test with guardrails...",rows:8,className:"font-mono text-sm"}),(0,t.jsxs)("div",{className:"flex justify-between items-center mt-1",children:[(0,t.jsxs)(eX,{className:"text-xs text-gray-500",children:["Press ",(0,t.jsx)("kbd",{className:"px-1 py-0.5 bg-gray-100 border border-gray-300 rounded text-xs",children:"Enter"})," to submit • ",(0,t.jsx)("kbd",{className:"px-1 py-0.5 bg-gray-100 border border-gray-300 rounded text-xs",children:"Shift+Enter"})," for new line"]}),(0,t.jsxs)(eX,{className:"text-xs text-gray-500",children:["Characters: ",o.length]})]})]}),(0,t.jsx)("div",{className:"pt-2",children:(0,t.jsx)(eJ.z,{onClick:u,loading:r,disabled:!o.trim(),className:"w-full",children:r?"Testing ".concat(a.length," guardrail").concat(a.length>1?"s":"","..."):"Test ".concat(a.length," guardrail").concat(a.length>1?"s":"")})})]}),(0,t.jsx)(eQ,{results:i,errors:n})]})]})},e0=e=>{let{guardrailsList:a,isLoading:l,accessToken:r,onClose:i}=e,[n,d]=(0,s.useState)(new Set),[c,u]=(0,s.useState)(""),[m,x]=(0,s.useState)([]),[p,h]=(0,s.useState)([]),[g,f]=(0,s.useState)(!1),j=a.filter(e=>{var a;return null===(a=e.guardrail_name)||void 0===a?void 0:a.toLowerCase().includes(c.toLowerCase())}),v=e=>{let a=new Set(n);a.has(e)?a.delete(e):a.add(e),d(a)},y=async e=>{if(0===n.size||!r)return;f(!0),x([]),h([]);let a=[],l=[];await Promise.all(Array.from(n).map(async i=>{let t=Date.now();try{let l=await (0,o.applyGuardrail)(r,i,e,null,null),s=Date.now()-t;a.push({guardrailName:i,response_text:l.response_text,latency:s})}catch(a){let e=Date.now()-t;console.error("Error testing guardrail ".concat(i,":"),a),l.push({guardrailName:i,error:a,latency:e})}})),x(a),h(l),f(!1),a.length>0&&Q.Z.success("".concat(a.length," guardrail").concat(a.length>1?"s":""," applied successfully")),l.length>0&&Q.Z.fromBackend("".concat(l.length," guardrail").concat(l.length>1?"s":""," failed"))};return(0,t.jsx)("div",{className:"w-full h-[calc(100vh-200px)]",children:(0,t.jsx)(eG.Z,{className:"h-full",children:(0,t.jsxs)("div",{className:"flex h-full",children:[(0,t.jsxs)("div",{className:"w-1/4 border-r border-gray-200 flex flex-col overflow-hidden",children:[(0,t.jsx)("div",{className:"p-4 border-b border-gray-200",children:(0,t.jsxs)("div",{className:"mb-3",children:[(0,t.jsx)(ez.Z,{className:"text-lg font-semibold mb-3",children:"Guardrails"}),(0,t.jsx)(eT.Z,{icon:eB.Z,placeholder:"Search guardrails...",value:c,onValueChange:u})]})}),(0,t.jsx)("div",{className:"flex-1 overflow-auto",children:l?(0,t.jsx)("div",{className:"flex items-center justify-center h-32",children:(0,t.jsx)(K.Z,{})}):0===j.length?(0,t.jsx)("div",{className:"p-4",children:(0,t.jsx)(eF.Z,{description:c?"No guardrails match your search":"No guardrails available"})}):(0,t.jsx)(eM.Z,{dataSource:j,renderItem:e=>(0,t.jsx)(eM.Z.Item,{onClick:()=>{e.guardrail_name&&v(e.guardrail_name)},className:"cursor-pointer hover:bg-gray-50 transition-colors px-4 ".concat(n.has(e.guardrail_name||"")?"bg-blue-50 border-l-4 border-l-blue-500":"border-l-4 border-l-transparent"),children:(0,t.jsx)(eM.Z.Item.Meta,{avatar:(0,t.jsx)(C.Z,{checked:n.has(e.guardrail_name||""),onClick:a=>{a.stopPropagation(),e.guardrail_name&&v(e.guardrail_name)}}),title:(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)(eD.Z,{className:"text-gray-400"}),(0,t.jsx)("span",{className:"font-medium text-gray-900",children:e.guardrail_name})]}),description:(0,t.jsxs)("div",{className:"text-xs space-y-1 mt-1",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"font-medium",children:"Type: "}),(0,t.jsx)("span",{className:"text-gray-600",children:e.litellm_params.guardrail})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"font-medium",children:"Mode: "}),(0,t.jsx)("span",{className:"text-gray-600",children:e.litellm_params.mode})]})]})})})})}),(0,t.jsx)("div",{className:"p-3 border-t border-gray-200 bg-gray-50",children:(0,t.jsxs)(eL.Z,{className:"text-xs text-gray-600",children:[n.size," of ",j.length," selected"]})})]}),(0,t.jsxs)("div",{className:"w-3/4 flex flex-col bg-white",children:[(0,t.jsx)("div",{className:"p-4 border-b border-gray-200 flex justify-between items-center",children:(0,t.jsx)(ez.Z,{className:"text-xl font-semibold mb-0",children:"Guardrail Testing Playground"})}),(0,t.jsx)("div",{className:"flex-1 overflow-auto p-4",children:0===n.size?(0,t.jsxs)("div",{className:"h-full flex flex-col items-center justify-center text-gray-400",children:[(0,t.jsx)(eD.Z,{style:{fontSize:"48px",marginBottom:"16px"}}),(0,t.jsx)(eL.Z,{className:"text-lg font-medium text-gray-600 mb-2",children:"Select Guardrails to Test"}),(0,t.jsx)(eL.Z,{className:"text-center text-gray-500 max-w-md",children:"Choose one or more guardrails from the left sidebar to start testing and comparing results."})]}):(0,t.jsx)("div",{className:"h-full",children:(0,t.jsx)(e$,{guardrailNames:Array.from(n),onSubmit:y,results:m.length>0?m:null,errors:p.length>0?p:null,isLoading:g,onClose:()=>d(new Set)})})})]})]})})})},e1=e=>{let{accessToken:a,userRole:l}=e,[r,i]=(0,s.useState)([]),[c,u]=(0,s.useState)(!1),[m,x]=(0,s.useState)(!1),[p,h]=(0,s.useState)(!1),[g,f]=(0,s.useState)(null),[j,v]=(0,s.useState)(null),[y,_]=(0,s.useState)(0),b=!!l&&(0,ek.tY)(l),N=async()=>{if(a){x(!0);try{let e=await (0,o.getGuardrailsList)(a);console.log("guardrails: ".concat(JSON.stringify(e))),i(e.guardrails)}catch(e){console.error("Error fetching guardrails:",e)}finally{x(!1)}}};(0,s.useEffect)(()=>{N()},[a]);let w=async()=>{if(g&&a){h(!0);try{await (0,o.deleteGuardrailCall)(a,g.id),Q.Z.success('Guardrail "'.concat(g.name,'" deleted successfully')),N()}catch(e){console.error("Error deleting guardrail:",e),Q.Z.fromBackend("Failed to delete guardrail")}finally{h(!1),f(null)}}};return(0,t.jsx)("div",{className:"w-full mx-auto flex-auto overflow-y-auto m-8 p-2",children:(0,t.jsxs)(n.v0,{index:y,onIndexChange:_,children:[(0,t.jsxs)(n.td,{className:"mb-4",children:[(0,t.jsx)(n.OK,{children:"Guardrails"}),(0,t.jsx)(n.OK,{disabled:!a||0===r.length,children:"Test Playground"})]}),(0,t.jsxs)(n.nP,{children:[(0,t.jsxs)(n.x4,{children:[(0,t.jsx)("div",{className:"flex justify-between items-center mb-4",children:(0,t.jsx)(n.zx,{onClick:()=>{j&&v(null),u(!0)},disabled:!a,children:"+ Add New Guardrail"})}),j?(0,t.jsx)(eE,{guardrailId:j,onClose:()=>v(null),accessToken:a,isAdmin:b}):(0,t.jsx)(eS,{guardrailsList:r,isLoading:m,onDeleteClick:(e,a)=>{f({id:e,name:a})},accessToken:a,onGuardrailUpdated:N,isAdmin:b,onGuardrailClick:e=>v(e)}),(0,t.jsx)(er,{visible:c,onClose:()=>{u(!1)},accessToken:a,onSuccess:()=>{N()}}),g&&(0,t.jsxs)(d.Z,{title:"Delete Guardrail",open:null!==g,onOk:w,onCancel:()=>{f(null)},confirmLoading:p,okText:"Delete",okButtonProps:{danger:!0},children:[(0,t.jsxs)("p",{children:["Are you sure you want to delete guardrail: ",g.name," ?"]}),(0,t.jsx)("p",{children:"This action cannot be undone."})]})]}),(0,t.jsx)(n.x4,{children:(0,t.jsx)(e0,{guardrailsList:r,isLoading:m,accessToken:a,onClose:()=>_(0)})})]})]})})}}}]);
\ No newline at end of file
diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/4292-8682ab62a15b3165.js b/litellm/proxy/_experimental/out/_next/static/chunks/4292-fce839d666533ad3.js
similarity index 67%
rename from litellm/proxy/_experimental/out/_next/static/chunks/4292-8682ab62a15b3165.js
rename to litellm/proxy/_experimental/out/_next/static/chunks/4292-fce839d666533ad3.js
index 0ca32afb38f..376a6cb8334 100644
--- a/litellm/proxy/_experimental/out/_next/static/chunks/4292-8682ab62a15b3165.js
+++ b/litellm/proxy/_experimental/out/_next/static/chunks/4292-fce839d666533ad3.js
@@ -1 +1 @@
-"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4292],{84717:function(e,s,t){t.d(s,{Ct:function(){return a.Z},Dx:function(){return u.Z},OK:function(){return n.Z},Zb:function(){return r.Z},nP:function(){return m.Z},rj:function(){return i.Z},td:function(){return o.Z},v0:function(){return d.Z},x4:function(){return c.Z},xv:function(){return x.Z},zx:function(){return l.Z}});var a=t(41649),l=t(20831),r=t(12514),i=t(67101),n=t(12485),d=t(18135),o=t(35242),c=t(29706),m=t(77991),x=t(84264),u=t(96761)},40728:function(e,s,t){t.d(s,{C:function(){return a.Z},x:function(){return l.Z}});var a=t(41649),l=t(84264)},16721:function(e,s,t){t.d(s,{Dx:function(){return d.Z},JX:function(){return l.Z},oi:function(){return n.Z},rj:function(){return r.Z},xv:function(){return i.Z},zx:function(){return a.Z}});var a=t(20831),l=t(49804),r=t(67101),i=t(84264),n=t(49566),d=t(96761)},64504:function(e,s,t){t.d(s,{o:function(){return l.Z},z:function(){return a.Z}});var a=t(20831),l=t(49566)},67479:function(e,s,t){var a=t(57437),l=t(2265),r=t(52787),i=t(19250);s.Z=e=>{let{onChange:s,value:t,className:n,accessToken:d,disabled:o}=e,[c,m]=(0,l.useState)([]),[x,u]=(0,l.useState)(!1);return(0,l.useEffect)(()=>{(async()=>{if(d){u(!0);try{let e=await (0,i.getGuardrailsList)(d);console.log("Guardrails response:",e),e.guardrails&&(console.log("Guardrails data:",e.guardrails),m(e.guardrails))}catch(e){console.error("Error fetching guardrails:",e)}finally{u(!1)}}})()},[d]),(0,a.jsx)("div",{children:(0,a.jsx)(r.default,{mode:"multiple",disabled:o,placeholder:o?"Setting guardrails is a premium feature.":"Select guardrails",onChange:e=>{console.log("Selected guardrails:",e),s(e)},value:t,loading:x,className:n,options:c.map(e=>(console.log("Mapping guardrail:",e),{label:"".concat(e.guardrail_name),value:e.guardrail_name})),optionFilterProp:"label",showSearch:!0,style:{width:"100%"}})})}},27799:function(e,s,t){var a=t(57437);t(2265);var l=t(40728),r=t(82182),i=t(91777),n=t(97434);s.Z=function(e){let{loggingConfigs:s=[],disabledCallbacks:t=[],variant:d="card",className:o=""}=e,c=e=>{var s;return(null===(s=Object.entries(n.Lo).find(s=>{let[t,a]=s;return a===e}))||void 0===s?void 0:s[0])||e},m=e=>{switch(e){case"success":return"green";case"failure":return"red";case"success_and_failure":return"blue";default:return"gray"}},x=e=>{switch(e){case"success":return"Success Only";case"failure":return"Failure Only";case"success_and_failure":return"Success & Failure";default:return e}},u=(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(r.Z,{className:"h-4 w-4 text-blue-600"}),(0,a.jsx)(l.x,{className:"font-semibold text-gray-900",children:"Logging Integrations"}),(0,a.jsx)(l.C,{color:"blue",size:"xs",children:s.length})]}),s.length>0?(0,a.jsx)("div",{className:"space-y-3",children:s.map((e,s)=>{var t;let i=c(e.callback_name),d=null===(t=n.Dg[i])||void 0===t?void 0:t.logo;return(0,a.jsxs)("div",{className:"flex items-center justify-between p-3 rounded-lg bg-blue-50 border border-blue-200",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[d?(0,a.jsx)("img",{src:d,alt:i,className:"w-5 h-5 object-contain"}):(0,a.jsx)(r.Z,{className:"h-5 w-5 text-gray-400"}),(0,a.jsxs)("div",{children:[(0,a.jsx)(l.x,{className:"font-medium text-blue-800",children:i}),(0,a.jsxs)(l.x,{className:"text-xs text-blue-600",children:[Object.keys(e.callback_vars).length," parameters configured"]})]})]}),(0,a.jsx)(l.C,{color:m(e.callback_type),size:"sm",children:x(e.callback_type)})]},s)})}):(0,a.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-50 border border-gray-200",children:[(0,a.jsx)(r.Z,{className:"h-4 w-4 text-gray-400"}),(0,a.jsx)(l.x,{className:"text-gray-500 text-sm",children:"No logging integrations configured"})]})]}),(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(i.Z,{className:"h-4 w-4 text-red-600"}),(0,a.jsx)(l.x,{className:"font-semibold text-gray-900",children:"Disabled Callbacks"}),(0,a.jsx)(l.C,{color:"red",size:"xs",children:t.length})]}),t.length>0?(0,a.jsx)("div",{className:"space-y-3",children:t.map((e,s)=>{var t;let r=n.RD[e]||e,d=null===(t=n.Dg[r])||void 0===t?void 0:t.logo;return(0,a.jsxs)("div",{className:"flex items-center justify-between p-3 rounded-lg bg-red-50 border border-red-200",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[d?(0,a.jsx)("img",{src:d,alt:r,className:"w-5 h-5 object-contain"}):(0,a.jsx)(i.Z,{className:"h-5 w-5 text-gray-400"}),(0,a.jsxs)("div",{children:[(0,a.jsx)(l.x,{className:"font-medium text-red-800",children:r}),(0,a.jsx)(l.x,{className:"text-xs text-red-600",children:"Disabled for this key"})]})]}),(0,a.jsx)(l.C,{color:"red",size:"sm",children:"Disabled"})]},s)})}):(0,a.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-50 border border-gray-200",children:[(0,a.jsx)(i.Z,{className:"h-4 w-4 text-gray-400"}),(0,a.jsx)(l.x,{className:"text-gray-500 text-sm",children:"No callbacks disabled"})]})]})]});return"card"===d?(0,a.jsxs)("div",{className:"bg-white border border-gray-200 rounded-lg p-6 ".concat(o),children:[(0,a.jsx)("div",{className:"flex items-center gap-2 mb-6",children:(0,a.jsxs)("div",{children:[(0,a.jsx)(l.x,{className:"font-semibold text-gray-900",children:"Logging Settings"}),(0,a.jsx)(l.x,{className:"text-xs text-gray-500",children:"Active logging integrations and disabled callbacks for this key"})]})}),u]}):(0,a.jsxs)("div",{className:"".concat(o),children:[(0,a.jsx)(l.x,{className:"font-medium text-gray-900 mb-3",children:"Logging Settings"}),u]})}},98015:function(e,s,t){t.d(s,{Z:function(){return g}});var a=t(57437),l=t(2265),r=t(92280),i=t(40728),n=t(79814),d=t(19250),o=function(e){let{vectorStores:s,accessToken:t}=e,[r,o]=(0,l.useState)([]);(0,l.useEffect)(()=>{(async()=>{if(t&&0!==s.length)try{let e=await (0,d.vectorStoreListCall)(t);e.data&&o(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)}})()},[t,s.length]);let c=e=>{let s=r.find(s=>s.vector_store_id===e);return s?"".concat(s.vector_store_name||s.vector_store_id," (").concat(s.vector_store_id,")"):e};return(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(n.Z,{className:"h-4 w-4 text-blue-600"}),(0,a.jsx)(i.x,{className:"font-semibold text-gray-900",children:"Vector Stores"}),(0,a.jsx)(i.C,{color:"blue",size:"xs",children:s.length})]}),s.length>0?(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:s.map((e,s)=>(0,a.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:c(e)},s))}):(0,a.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-50 border border-gray-200",children:[(0,a.jsx)(n.Z,{className:"h-4 w-4 text-gray-400"}),(0,a.jsx)(i.x,{className:"text-gray-500 text-sm",children:"No vector stores configured"})]})]})},c=t(25327),m=t(86462),x=t(47686),u=t(89970),h=function(e){let{mcpServers:s,mcpAccessGroups:r=[],mcpToolPermissions:n={},accessToken:o}=e,[h,g]=(0,l.useState)([]),[p,j]=(0,l.useState)([]),[v,b]=(0,l.useState)(new Set),y=e=>{b(s=>{let t=new Set(s);return t.has(e)?t.delete(e):t.add(e),t})};(0,l.useEffect)(()=>{(async()=>{if(o&&s.length>0)try{let e=await (0,d.fetchMCPServers)(o);e&&Array.isArray(e)?g(e):e.data&&Array.isArray(e.data)&&g(e.data)}catch(e){console.error("Error fetching MCP servers:",e)}})()},[o,s.length]),(0,l.useEffect)(()=>{(async()=>{if(o&&r.length>0)try{let e=await Promise.resolve().then(t.bind(t,19250)).then(e=>e.fetchMCPAccessGroups(o));j(Array.isArray(e)?e:e.data||[])}catch(e){console.error("Error fetching MCP access groups:",e)}})()},[o,r.length]);let _=e=>{let s=h.find(s=>s.server_id===e);if(s){let t=e.length>7?"".concat(e.slice(0,3),"...").concat(e.slice(-4)):e;return"".concat(s.alias," (").concat(t,")")}return e},f=e=>e,N=[...s.map(e=>({type:"server",value:e})),...r.map(e=>({type:"accessGroup",value:e}))],k=N.length;return(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(c.Z,{className:"h-4 w-4 text-blue-600"}),(0,a.jsx)(i.x,{className:"font-semibold text-gray-900",children:"MCP Servers"}),(0,a.jsx)(i.C,{color:"blue",size:"xs",children:k})]}),k>0?(0,a.jsx)("div",{className:"max-h-[400px] overflow-y-auto space-y-2 pr-1",children:N.map((e,s)=>{let t="server"===e.type?n[e.value]:void 0,l=t&&t.length>0,r=v.has(e.value);return(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("div",{onClick:()=>l&&y(e.value),className:"flex items-center gap-3 py-2 px-3 rounded-lg border border-gray-200 transition-all ".concat(l?"cursor-pointer hover:bg-gray-50 hover:border-gray-300":"bg-white"),children:[(0,a.jsx)("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:"server"===e.type?(0,a.jsx)(u.Z,{title:"Full ID: ".concat(e.value),placement:"top",children:(0,a.jsxs)("div",{className:"inline-flex items-center gap-2 min-w-0",children:[(0,a.jsx)("span",{className:"inline-block w-1.5 h-1.5 bg-blue-500 rounded-full flex-shrink-0"}),(0,a.jsx)("span",{className:"text-sm font-medium text-gray-900 truncate",children:_(e.value)})]})}):(0,a.jsxs)("div",{className:"inline-flex items-center gap-2 min-w-0",children:[(0,a.jsx)("span",{className:"inline-block w-1.5 h-1.5 bg-green-500 rounded-full flex-shrink-0"}),(0,a.jsx)("span",{className:"text-sm font-medium text-gray-900 truncate",children:f(e.value)}),(0,a.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,a.jsxs)("div",{className:"flex items-center gap-1 flex-shrink-0 whitespace-nowrap",children:[(0,a.jsx)("span",{className:"text-xs font-medium text-gray-600",children:t.length}),(0,a.jsx)("span",{className:"text-xs text-gray-500",children:1===t.length?"tool":"tools"}),r?(0,a.jsx)(m.Z,{className:"h-3.5 w-3.5 text-gray-400 ml-0.5"}):(0,a.jsx)(x.Z,{className:"h-3.5 w-3.5 text-gray-400 ml-0.5"})]})]}),l&&r&&(0,a.jsx)("div",{className:"ml-4 pl-4 border-l-2 border-blue-200 pb-1",children:(0,a.jsx)("div",{className:"flex flex-wrap gap-1.5",children:t.map((e,s)=>(0,a.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},s))})})]},s)})}):(0,a.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-50 border border-gray-200",children:[(0,a.jsx)(c.Z,{className:"h-4 w-4 text-gray-400"}),(0,a.jsx)(i.x,{className:"text-gray-500 text-sm",children:"No MCP servers or access groups configured"})]})]})},g=function(e){let{objectPermission:s,variant:t="card",className:l="",accessToken:i}=e,n=(null==s?void 0:s.vector_stores)||[],d=(null==s?void 0:s.mcp_servers)||[],c=(null==s?void 0:s.mcp_access_groups)||[],m=(null==s?void 0:s.mcp_tool_permissions)||{},x=(0,a.jsxs)("div",{className:"card"===t?"grid grid-cols-1 md:grid-cols-2 gap-6":"space-y-4",children:[(0,a.jsx)(o,{vectorStores:n,accessToken:i}),(0,a.jsx)(h,{mcpServers:d,mcpAccessGroups:c,mcpToolPermissions:m,accessToken:i})]});return"card"===t?(0,a.jsxs)("div",{className:"bg-white border border-gray-200 rounded-lg p-6 ".concat(l),children:[(0,a.jsx)("div",{className:"flex items-center gap-2 mb-6",children:(0,a.jsxs)("div",{children:[(0,a.jsx)(r.x,{className:"font-semibold text-gray-900",children:"Object Permissions"}),(0,a.jsx)(r.x,{className:"text-xs text-gray-500",children:"Access control for Vector Stores and MCP Servers"})]})}),x]}):(0,a.jsxs)("div",{className:"".concat(l),children:[(0,a.jsx)(r.x,{className:"font-medium text-gray-900 mb-3",children:"Object Permissions"}),x]})}},21425:function(e,s,t){var a=t(57437);t(2265);var l=t(54507);s.Z=e=>{let{value:s,onChange:t,disabledCallbacks:r=[],onDisabledCallbacksChange:i}=e;return(0,a.jsx)(l.Z,{value:s,onChange:t,disabledCallbacks:r,onDisabledCallbacksChange:i})}},94292:function(e,s,t){t.d(s,{Z:function(){return Q}});var a=t(57437),l=t(2265),r=t(84717),i=t(10900),n=t(23628),d=t(74998),o=t(19250),c=t(13634),m=t(73002),x=t(89970),u=t(9114),h=t(52787),g=t(64482),p=t(64504),j=t(30874),v=t(24199),b=t(97415),y=t(95920),_=t(68473),f=t(21425);let N=["logging"],k=e=>e&&"object"==typeof e?Object.fromEntries(Object.entries(e).filter(e=>{let[s]=e;return!N.includes(s)})):{},w=e=>e&&"object"==typeof e&&Array.isArray(e.logging)?e.logging:[],Z=function(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return JSON.stringify(k(e),null,s)};var S=t(97434),C=t(67479),A=t(62099),I=t(65895),P=t(95096);function L(e){var s,t,r,i,n,d,u,N,k,L;let{keyData:D,onCancel:M,onSubmit:R,teams:T,accessToken:E,userID:F,userRole:z,premiumUser:K=!1}=e,[O]=c.Z.useForm(),[U,V]=(0,l.useState)([]),[G,B]=(0,l.useState)([]),J=null==T?void 0:T.find(e=>e.team_id===D.team_id),[W,q]=(0,l.useState)([]),[$,Q]=(0,l.useState)([]),[X,Y]=(0,l.useState)(!1),[H,ee]=(0,l.useState)(Array.isArray(null===(s=D.metadata)||void 0===s?void 0:s.litellm_disabled_callbacks)?(0,S.PA)(D.metadata.litellm_disabled_callbacks):[]),[es,et]=(0,l.useState)(D.auto_rotate||!1),[ea,el]=(0,l.useState)(D.rotation_interval||"");(0,l.useEffect)(()=>{let e=async()=>{if(F&&z&&E)try{if(null===D.team_id){let e=(await (0,o.modelAvailableCall)(E,F,z)).data.map(e=>e.id);q(e)}else if(null==J?void 0:J.team_id){let e=await (0,j.wk)(F,z,E,J.team_id);q(Array.from(new Set([...J.models,...e])))}}catch(e){console.error("Error fetching models:",e)}};(async()=>{if(E)try{let e=await (0,o.getPromptsList)(E);B(e.prompts.map(e=>e.prompt_id))}catch(e){console.error("Failed to fetch prompts:",e)}})(),e()},[F,z,E,J,D.team_id]),(0,l.useEffect)(()=>{O.setFieldValue("disabled_callbacks",H)},[O,H]);let er=e=>e&&({"24h":"daily","7d":"weekly","30d":"monthly"})[e]||null,ei={...D,token:D.token||D.token_id,budget_duration:er(D.budget_duration),metadata:Z(D.metadata),guardrails:null===(t=D.metadata)||void 0===t?void 0:t.guardrails,prompts:null===(r=D.metadata)||void 0===r?void 0:r.prompts,vector_stores:(null===(i=D.object_permission)||void 0===i?void 0:i.vector_stores)||[],mcp_servers_and_groups:{servers:(null===(n=D.object_permission)||void 0===n?void 0:n.mcp_servers)||[],accessGroups:(null===(d=D.object_permission)||void 0===d?void 0:d.mcp_access_groups)||[]},mcp_tool_permissions:(null===(u=D.object_permission)||void 0===u?void 0:u.mcp_tool_permissions)||{},logging_settings:w(D.metadata),disabled_callbacks:Array.isArray(null===(N=D.metadata)||void 0===N?void 0:N.litellm_disabled_callbacks)?(0,S.PA)(D.metadata.litellm_disabled_callbacks):[],auto_rotate:D.auto_rotate||!1,...D.rotation_interval&&{rotation_interval:D.rotation_interval}};return(0,l.useEffect)(()=>{var e,s,t,a,l,r,i;O.setFieldsValue({...D,token:D.token||D.token_id,budget_duration:er(D.budget_duration),metadata:Z(D.metadata),guardrails:null===(e=D.metadata)||void 0===e?void 0:e.guardrails,prompts:null===(s=D.metadata)||void 0===s?void 0:s.prompts,vector_stores:(null===(t=D.object_permission)||void 0===t?void 0:t.vector_stores)||[],mcp_servers_and_groups:{servers:(null===(a=D.object_permission)||void 0===a?void 0:a.mcp_servers)||[],accessGroups:(null===(l=D.object_permission)||void 0===l?void 0:l.mcp_access_groups)||[]},mcp_tool_permissions:(null===(r=D.object_permission)||void 0===r?void 0:r.mcp_tool_permissions)||{},logging_settings:w(D.metadata),disabled_callbacks:Array.isArray(null===(i=D.metadata)||void 0===i?void 0:i.litellm_disabled_callbacks)?(0,S.PA)(D.metadata.litellm_disabled_callbacks):[],auto_rotate:D.auto_rotate||!1,...D.rotation_interval&&{rotation_interval:D.rotation_interval}})},[D,O]),(0,l.useEffect)(()=>{O.setFieldValue("auto_rotate",es)},[es,O]),(0,l.useEffect)(()=>{ea&&O.setFieldValue("rotation_interval",ea)},[ea,O]),console.log("premiumUser:",K),(0,a.jsxs)(c.Z,{form:O,onFinish:R,initialValues:ei,layout:"vertical",children:[(0,a.jsx)(c.Z.Item,{label:"Key Alias",name:"key_alias",children:(0,a.jsx)(p.o,{})}),(0,a.jsx)(c.Z.Item,{label:"Models",name:"models",children:(0,a.jsxs)(h.default,{mode:"multiple",placeholder:"Select models",style:{width:"100%"},children:[W.length>0&&(0,a.jsx)(h.default.Option,{value:"all-team-models",children:"All Team Models"}),W.map(e=>(0,a.jsx)(h.default.Option,{value:e,children:e},e))]})}),(0,a.jsx)(c.Z.Item,{label:"Max Budget (USD)",name:"max_budget",children:(0,a.jsx)(v.Z,{step:.01,style:{width:"100%"},placeholder:"Enter a numerical value"})}),(0,a.jsx)(c.Z.Item,{label:"Reset Budget",name:"budget_duration",children:(0,a.jsxs)(h.default,{placeholder:"n/a",children:[(0,a.jsx)(h.default.Option,{value:"daily",children:"Daily"}),(0,a.jsx)(h.default.Option,{value:"weekly",children:"Weekly"}),(0,a.jsx)(h.default.Option,{value:"monthly",children:"Monthly"})]})}),(0,a.jsx)(c.Z.Item,{label:"TPM Limit",name:"tpm_limit",children:(0,a.jsx)(v.Z,{min:0})}),(0,a.jsx)(I.Z,{type:"tpm",name:"tpm_limit_type",showDetailedDescriptions:!1}),(0,a.jsx)(c.Z.Item,{label:"RPM Limit",name:"rpm_limit",children:(0,a.jsx)(v.Z,{min:0})}),(0,a.jsx)(I.Z,{type:"rpm",name:"rpm_limit_type",showDetailedDescriptions:!1}),(0,a.jsx)(c.Z.Item,{label:"Max Parallel Requests",name:"max_parallel_requests",children:(0,a.jsx)(v.Z,{min:0})}),(0,a.jsx)(c.Z.Item,{label:"Model TPM Limit",name:"model_tpm_limit",children:(0,a.jsx)(g.default.TextArea,{rows:4,placeholder:'{"gpt-4": 100, "claude-v1": 200}'})}),(0,a.jsx)(c.Z.Item,{label:"Model RPM Limit",name:"model_rpm_limit",children:(0,a.jsx)(g.default.TextArea,{rows:4,placeholder:'{"gpt-4": 100, "claude-v1": 200}'})}),(0,a.jsx)(c.Z.Item,{label:"Guardrails",name:"guardrails",children:E&&(0,a.jsx)(C.Z,{onChange:e=>{O.setFieldValue("guardrails",e)},accessToken:E,disabled:!K})}),(0,a.jsx)(c.Z.Item,{label:"Prompts",name:"prompts",children:(0,a.jsx)(x.Z,{title:K?"":"Setting prompts by key is a premium feature",placement:"top",children:(0,a.jsx)(h.default,{mode:"tags",style:{width:"100%"},disabled:!K,placeholder:K?Array.isArray(null===(k=D.metadata)||void 0===k?void 0:k.prompts)&&D.metadata.prompts.length>0?"Current: ".concat(D.metadata.prompts.join(", ")):"Select or enter prompts":"Premium feature - Upgrade to set prompts by key",options:G.map(e=>({value:e,label:e}))})})}),(0,a.jsx)(c.Z.Item,{label:"Allowed Pass Through Routes",name:"allowed_passthrough_routes",children:(0,a.jsx)(x.Z,{title:K?"":"Setting allowed pass through routes by key is a premium feature",placement:"top",children:(0,a.jsx)(P.Z,{onChange:e=>O.setFieldValue("allowed_passthrough_routes",e),value:O.getFieldValue("allowed_passthrough_routes"),accessToken:E||"",placeholder:K?Array.isArray(null===(L=D.metadata)||void 0===L?void 0:L.allowed_passthrough_routes)&&D.metadata.allowed_passthrough_routes.length>0?"Current: ".concat(D.metadata.allowed_passthrough_routes.join(", ")):"Select or enter allowed pass through routes":"Premium feature - Upgrade to set allowed pass through routes by key",disabled:!K})})}),(0,a.jsx)(c.Z.Item,{label:"Vector Stores",name:"vector_stores",children:(0,a.jsx)(b.Z,{onChange:e=>O.setFieldValue("vector_stores",e),value:O.getFieldValue("vector_stores"),accessToken:E||"",placeholder:"Select vector stores"})}),(0,a.jsx)(c.Z.Item,{label:"MCP Servers / Access Groups",name:"mcp_servers_and_groups",children:(0,a.jsx)(y.Z,{onChange:e=>O.setFieldValue("mcp_servers_and_groups",e),value:O.getFieldValue("mcp_servers_and_groups"),accessToken:E||"",placeholder:"Select MCP servers or access groups (optional)"})}),(0,a.jsx)(c.Z.Item,{name:"mcp_tool_permissions",initialValue:{},hidden:!0,children:(0,a.jsx)(g.default,{type:"hidden"})}),(0,a.jsx)(c.Z.Item,{noStyle:!0,shouldUpdate:(e,s)=>e.mcp_servers_and_groups!==s.mcp_servers_and_groups||e.mcp_tool_permissions!==s.mcp_tool_permissions,children:()=>{var e;return(0,a.jsx)("div",{className:"mb-6",children:(0,a.jsx)(_.Z,{accessToken:E||"",selectedServers:(null===(e=O.getFieldValue("mcp_servers_and_groups"))||void 0===e?void 0:e.servers)||[],toolPermissions:O.getFieldValue("mcp_tool_permissions")||{},onChange:e=>O.setFieldsValue({mcp_tool_permissions:e})})})}}),(0,a.jsx)(c.Z.Item,{label:"Team ID",name:"team_id",children:(0,a.jsx)(h.default,{placeholder:"Select team",style:{width:"100%"},children:null==T?void 0:T.map(e=>(0,a.jsx)(h.default.Option,{value:e.team_id,children:"".concat(e.team_alias," (").concat(e.team_id,")")},e.team_id))})}),(0,a.jsx)(c.Z.Item,{label:"Logging Settings",name:"logging_settings",children:(0,a.jsx)(f.Z,{value:O.getFieldValue("logging_settings"),onChange:e=>O.setFieldValue("logging_settings",e),disabledCallbacks:H,onDisabledCallbacksChange:e=>{ee((0,S.PA)(e)),O.setFieldValue("disabled_callbacks",e)}})}),(0,a.jsx)(c.Z.Item,{label:"Metadata",name:"metadata",children:(0,a.jsx)(g.default.TextArea,{rows:10})}),(0,a.jsx)("div",{className:"mb-4",children:(0,a.jsx)(A.Z,{form:O,autoRotationEnabled:es,onAutoRotationChange:et,rotationInterval:ea,onRotationIntervalChange:el})}),(0,a.jsx)(c.Z.Item,{name:"token",hidden:!0,children:(0,a.jsx)(g.default,{})}),(0,a.jsx)(c.Z.Item,{name:"disabled_callbacks",hidden:!0,children:(0,a.jsx)(g.default,{})}),(0,a.jsx)(c.Z.Item,{name:"auto_rotate",hidden:!0,children:(0,a.jsx)(g.default,{})}),(0,a.jsx)(c.Z.Item,{name:"rotation_interval",hidden:!0,children:(0,a.jsx)(g.default,{})}),(0,a.jsx)("div",{className:"sticky z-10 bg-white p-4 border-t border-gray-200 bottom-[-1.5rem] inset-x-[-1.5rem]",children:(0,a.jsxs)("div",{className:"flex justify-end items-center gap-2",children:[(0,a.jsx)(m.ZP,{onClick:M,children:"Cancel"}),(0,a.jsx)(p.z,{type:"submit",children:"Save Changes"})]})})]})}var D=t(16721),M=t(82680),R=t(20577),T=t(7366),E=t(29233);function F(e){let{selectedToken:s,visible:t,onClose:r,accessToken:i,premiumUser:n,setAccessToken:d,onKeyUpdate:m}=e,[x]=c.Z.useForm(),[h,g]=(0,l.useState)(null),[p,j]=(0,l.useState)(null),[v,b]=(0,l.useState)(null),[y,_]=(0,l.useState)(!1),[f,N]=(0,l.useState)(!1),[k,w]=(0,l.useState)(null);(0,l.useEffect)(()=>{t&&s&&i&&(x.setFieldsValue({key_alias:s.key_alias,max_budget:s.max_budget,tpm_limit:s.tpm_limit,rpm_limit:s.rpm_limit,duration:s.duration||""}),w(i),N(s.key_name===i))},[t,s,x,i]),(0,l.useEffect)(()=>{t||(g(null),_(!1),N(!1),w(null),x.resetFields())},[t,x]);let Z=e=>{if(!e)return null;try{let s;let t=new Date;if(e.endsWith("s"))s=(0,T.Z)(t,{seconds:parseInt(e)});else if(e.endsWith("h"))s=(0,T.Z)(t,{hours:parseInt(e)});else if(e.endsWith("d"))s=(0,T.Z)(t,{days:parseInt(e)});else throw Error("Invalid duration format");return s.toLocaleString()}catch(e){return null}};(0,l.useEffect)(()=>{(null==p?void 0:p.duration)?b(Z(p.duration)):b(null)},[null==p?void 0:p.duration]);let S=async()=>{if(s&&k){_(!0);try{let e=await x.validateFields(),t=await (0,o.regenerateKeyCall)(k,s.token||s.token_id,e);g(t.key),u.Z.success("API Key regenerated successfully"),console.log("Full regenerate response:",t);let a={token:t.token||t.key_id||s.token,key_name:t.key,max_budget:e.max_budget,tpm_limit:e.tpm_limit,rpm_limit:e.rpm_limit,expires:e.duration?Z(e.duration):s.expires,...t};console.log("Updated key data with new token:",a),f&&(w(t.key),d&&d(t.key)),m&&m(a),_(!1)}catch(e){console.error("Error regenerating key:",e),u.Z.fromBackend(e),_(!1)}}},C=()=>{g(null),_(!1),N(!1),w(null),x.resetFields(),r()};return(0,a.jsx)(M.Z,{title:"Regenerate API Key",open:t,onCancel:C,footer:h?[(0,a.jsx)(D.zx,{onClick:C,children:"Close"},"close")]:[(0,a.jsx)(D.zx,{onClick:C,className:"mr-2",children:"Cancel"},"cancel"),(0,a.jsx)(D.zx,{onClick:S,disabled:y,children:y?"Regenerating...":"Regenerate"},"regenerate")],children:h?(0,a.jsxs)(D.rj,{numItems:1,className:"gap-2 w-full",children:[(0,a.jsx)(D.Dx,{children:"Regenerated Key"}),(0,a.jsx)(D.JX,{numColSpan:1,children:(0,a.jsxs)("p",{children:["Please replace your old key with the new key generated. For security reasons,"," ",(0,a.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,a.jsxs)(D.JX,{numColSpan:1,children:[(0,a.jsx)(D.xv,{className:"mt-3",children:"Key Alias:"}),(0,a.jsx)("div",{className:"bg-gray-100 p-2 rounded mb-2",children:(0,a.jsx)("pre",{className:"break-words whitespace-normal",children:(null==s?void 0:s.key_alias)||"No alias set"})}),(0,a.jsx)(D.xv,{className:"mt-3",children:"New API Key:"}),(0,a.jsx)("div",{className:"bg-gray-100 p-2 rounded mb-2",children:(0,a.jsx)("pre",{className:"break-words whitespace-normal",children:h})}),(0,a.jsx)(E.CopyToClipboard,{text:h,onCopy:()=>u.Z.success("API Key copied to clipboard"),children:(0,a.jsx)(D.zx,{className:"mt-3",children:"Copy API Key"})})]})]}):(0,a.jsxs)(c.Z,{form:x,layout:"vertical",onValuesChange:e=>{"duration"in e&&j(s=>({...s,duration:e.duration}))},children:[(0,a.jsx)(c.Z.Item,{name:"key_alias",label:"Key Alias",children:(0,a.jsx)(D.oi,{disabled:!0})}),(0,a.jsx)(c.Z.Item,{name:"max_budget",label:"Max Budget (USD)",children:(0,a.jsx)(R.Z,{step:.01,precision:2,style:{width:"100%"}})}),(0,a.jsx)(c.Z.Item,{name:"tpm_limit",label:"TPM Limit",children:(0,a.jsx)(R.Z,{style:{width:"100%"}})}),(0,a.jsx)(c.Z.Item,{name:"rpm_limit",label:"RPM Limit",children:(0,a.jsx)(R.Z,{style:{width:"100%"}})}),(0,a.jsx)(c.Z.Item,{name:"duration",label:"Expire Key (eg: 30s, 30h, 30d)",className:"mt-8",children:(0,a.jsx)(D.oi,{placeholder:""})}),(0,a.jsxs)("div",{className:"mt-2 text-sm text-gray-500",children:["Current expiry: ",(null==s?void 0:s.expires)?new Date(s.expires).toLocaleString():"Never"]}),v&&(0,a.jsxs)("div",{className:"mt-2 text-sm text-green-600",children:["New expiry: ",v]})]})})}var z=t(20347),K=t(98015),O=t(27799),U=t(59872),V=t(30401),G=t(78867),B=t(85968),J=t(40728),W=t(58710),q=e=>{let{autoRotate:s=!1,rotationInterval:t,lastRotationAt:l,keyRotationAt:r,nextRotationAt:i,variant:d="card",className:o=""}=e,c=e=>{let s=new Date(e),t=s.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}),a=s.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0});return"".concat(t," at ").concat(a)},m=(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsx)("div",{className:"space-y-3",children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(n.Z,{className:"h-4 w-4 text-blue-600"}),(0,a.jsx)(J.x,{className:"font-semibold text-gray-900",children:"Auto-Rotation"}),(0,a.jsx)(J.C,{color:s?"green":"gray",size:"xs",children:s?"Enabled":"Disabled"}),s&&t&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(J.x,{className:"text-gray-400",children:"•"}),(0,a.jsxs)(J.x,{className:"text-sm text-gray-600",children:["Every ",t]})]})]})}),(s||l||r||i)&&(0,a.jsxs)("div",{className:"space-y-3",children:[l&&(0,a.jsxs)("div",{className:"flex items-center gap-2 p-3 bg-gray-50 border border-gray-200 rounded-md",children:[(0,a.jsx)(W.Z,{className:"w-4 h-4 text-gray-500"}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)(J.x,{className:"font-medium text-gray-700",children:"Last Rotation"}),(0,a.jsx)(J.x,{className:"text-sm text-gray-600",children:c(l)})]})]}),(r||i)&&(0,a.jsxs)("div",{className:"flex items-center gap-2 p-3 bg-gray-50 border border-gray-200 rounded-md",children:[(0,a.jsx)(W.Z,{className:"w-4 h-4 text-gray-500"}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)(J.x,{className:"font-medium text-gray-700",children:"Next Scheduled Rotation"}),(0,a.jsx)(J.x,{className:"text-sm text-gray-600",children:c(i||r||"")})]})]}),s&&!l&&!r&&!i&&(0,a.jsxs)("div",{className:"flex items-center gap-2 p-3 bg-gray-50 border border-gray-100 rounded-md",children:[(0,a.jsx)(W.Z,{className:"w-4 h-4 text-gray-500"}),(0,a.jsx)(J.x,{className:"text-gray-600",children:"No rotation history available"})]})]}),!s&&!l&&!r&&!i&&(0,a.jsxs)("div",{className:"flex items-center gap-2 p-3 bg-gray-50 border border-gray-100 rounded-md",children:[(0,a.jsx)(n.Z,{className:"w-4 h-4 text-gray-400"}),(0,a.jsx)(J.x,{className:"text-gray-600",children:"Auto-rotation is not enabled for this key"})]})]});return"card"===d?(0,a.jsxs)("div",{className:"bg-white border border-gray-200 rounded-lg p-6 ".concat(o),children:[(0,a.jsx)("div",{className:"flex items-center gap-2 mb-6",children:(0,a.jsxs)("div",{children:[(0,a.jsx)(J.x,{className:"font-semibold text-gray-900",children:"Auto-Rotation"}),(0,a.jsx)(J.x,{className:"text-xs text-gray-500",children:"Automatic key rotation settings and status for this key"})]})}),m]}):(0,a.jsxs)("div",{className:"".concat(o),children:[(0,a.jsx)(J.x,{className:"font-medium text-gray-900 mb-3",children:"Auto-Rotation"}),m]})},$=t(33304);function Q(e){var s,t,h,g,p,j;let{keyId:v,onClose:b,keyData:y,accessToken:_,userID:f,userRole:N,teams:k,onKeyDataUpdate:C,onDelete:A,premiumUser:I,setAccessToken:P,backButtonText:D="Back to Keys"}=e,[M,R]=(0,l.useState)(!1),[T]=c.Z.useForm(),[E,J]=(0,l.useState)(!1),[W,Q]=(0,l.useState)(""),[X,Y]=(0,l.useState)(!1),[H,ee]=(0,l.useState)({}),[es,et]=(0,l.useState)(y),[ea,el]=(0,l.useState)(null),[er,ei]=(0,l.useState)(!1);if((0,l.useEffect)(()=>{y&&et(y)},[y]),(0,l.useEffect)(()=>{if(er){let e=setTimeout(()=>{ei(!1)},5e3);return()=>clearTimeout(e)}},[er]),!es)return(0,a.jsxs)("div",{className:"p-4",children:[(0,a.jsx)(r.zx,{icon:i.Z,variant:"light",onClick:b,className:"mb-4",children:D}),(0,a.jsx)(r.xv,{children:"Key not found"})]});let en=async e=>{try{var s,t,a,l;if(!_)return;let r=e.token;if(e.key=r,I||(delete e.guardrails,delete e.prompts),e.max_budget=(0,$.C)(e.max_budget),void 0!==e.vector_stores&&(e.object_permission={...es.object_permission,vector_stores:e.vector_stores||[]},delete e.vector_stores),void 0!==e.mcp_servers_and_groups){let{servers:s,accessGroups:t}=e.mcp_servers_and_groups||{servers:[],accessGroups:[]};e.object_permission={...es.object_permission,mcp_servers:s||[],mcp_access_groups:t||[]},delete e.mcp_servers_and_groups}if(void 0!==e.mcp_tool_permissions){let s=e.mcp_tool_permissions||{};Object.keys(s).length>0&&(e.object_permission={...e.object_permission,mcp_tool_permissions:s}),delete e.mcp_tool_permissions}if(""===e.max_budget&&(e.max_budget=null),e.metadata&&"string"==typeof e.metadata)try{let a=JSON.parse(e.metadata);e.metadata={...a,...(null===(s=e.guardrails)||void 0===s?void 0:s.length)>0?{guardrails:e.guardrails}:{},...e.logging_settings?{logging:e.logging_settings}:{},...(null===(t=e.disabled_callbacks)||void 0===t?void 0:t.length)>0?{litellm_disabled_callbacks:(0,S.Z3)(e.disabled_callbacks)}:{}}}catch(e){console.error("Error parsing metadata JSON:",e),u.Z.error("Invalid metadata JSON");return}else e.metadata={...e.metadata||{},...(null===(a=e.guardrails)||void 0===a?void 0:a.length)>0?{guardrails:e.guardrails}:{},...e.logging_settings?{logging:e.logging_settings}:{},...(null===(l=e.disabled_callbacks)||void 0===l?void 0:l.length)>0?{litellm_disabled_callbacks:(0,S.Z3)(e.disabled_callbacks)}:{}};delete e.logging_settings,e.budget_duration&&(e.budget_duration=({daily:"24h",weekly:"7d",monthly:"30d"})[e.budget_duration]);let i=await (0,o.keyUpdateCall)(_,e);et(e=>e?{...e,...i}:void 0),C&&C(i),u.Z.success("Key updated successfully"),R(!1)}catch(e){u.Z.fromBackend((0,B.O)(e)),console.error("Error updating key:",e)}},ed=async()=>{try{if(!_)return;await (0,o.keyDeleteCall)(_,es.token||es.token_id),u.Z.success("Key deleted successfully"),A&&A(),b()}catch(e){console.error("Error deleting the key:",e),u.Z.fromBackend(e)}Q("")},eo=async(e,s)=>{await (0,U.vQ)(e)&&(ee(e=>({...e,[s]:!0})),setTimeout(()=>{ee(e=>({...e,[s]:!1}))},2e3))},ec=e=>{let s=new Date(e),t=s.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}),a=s.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0});return"".concat(t," at ").concat(a)};return(0,a.jsxs)("div",{className:"w-full h-screen p-4",children:[(0,a.jsxs)("div",{className:"flex justify-between items-center mb-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(r.zx,{icon:i.Z,variant:"light",onClick:b,className:"mb-4",children:D}),(0,a.jsx)(r.Dx,{children:es.key_alias||"API Key"}),(0,a.jsxs)("div",{className:"flex items-center cursor-pointer mb-2 space-y-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-xs text-gray-400 uppercase tracking-wide mt-2",children:"Key ID"}),(0,a.jsx)(r.xv,{className:"text-gray-500 font-mono text-sm",children:es.token_id||es.token})]}),(0,a.jsx)(m.ZP,{type:"text",size:"small",icon:H["key-id"]?(0,a.jsx)(V.Z,{size:12}):(0,a.jsx)(G.Z,{size:12}),onClick:()=>eo(es.token_id||es.token,"key-id"),className:"ml-2 transition-all duration-200".concat(H["key-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,a.jsx)(r.xv,{className:"text-sm text-gray-500",children:es.updated_at&&es.updated_at!==es.created_at?"Updated: ".concat(ec(es.updated_at)):"Created: ".concat(ec(es.created_at))}),er&&(0,a.jsx)(r.Ct,{color:"green",size:"xs",className:"animate-pulse",children:"Recently Regenerated"}),ea&&(0,a.jsx)(r.Ct,{color:"blue",size:"xs",children:"Regenerated"})]})]}),N&&z.LQ.includes(N)&&(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(x.Z,{title:I?"":"This is a LiteLLM Enterprise feature, and requires a valid key to use.",children:(0,a.jsx)("span",{className:"inline-block",children:(0,a.jsx)(r.zx,{icon:n.Z,variant:"secondary",onClick:()=>Y(!0),className:"flex items-center",disabled:!I,children:"Regenerate Key"})})}),(0,a.jsx)(r.zx,{icon:d.Z,variant:"secondary",onClick:()=>J(!0),className:"flex items-center",children:"Delete Key"})]})]}),(0,a.jsx)(F,{selectedToken:es,visible:X,onClose:()=>Y(!1),accessToken:_,premiumUser:I,setAccessToken:P,onKeyUpdate:e=>{et(s=>{if(s)return{...s,...e,created_at:new Date().toLocaleString()}}),el(new Date),ei(!0),C&&C({...e,created_at:new Date().toLocaleString()})}}),E&&(()=>{let e=(null==es?void 0:es.key_alias)||(null==es?void 0:es.token_id)||"API Key",s=W===e;return(0,a.jsx)("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:(0,a.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,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center justify-between px-6 py-4 border-b border-gray-200",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold text-gray-900",children:"Delete Key"}),(0,a.jsx)("button",{onClick:()=>{J(!1),Q("")},className:"text-gray-400 hover:text-gray-500 focus:outline-none",children:(0,a.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,a.jsxs)("div",{className:"px-6 py-4",children:[(0,a.jsxs)("div",{className:"flex items-start gap-3 p-4 bg-red-50 border border-red-100 rounded-md mb-5",children:[(0,a.jsx)("div",{className:"text-red-500 mt-0.5",children:(0,a.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L3.082 16.5c-.77.833.192 2.5 1.732 2.5z"})})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-base font-medium text-red-600",children:"Warning: You are about to delete this API key."}),(0,a.jsx)("p",{className:"text-base text-red-600 mt-2",children:"This action is irreversible and will immediately revoke access for any applications using this key."})]})]}),(0,a.jsx)("p",{className:"text-base text-gray-600 mb-5",children:"Are you sure you want to delete this API key?"}),(0,a.jsxs)("div",{className:"mb-5",children:[(0,a.jsxs)("label",{className:"block text-base font-medium text-gray-700 mb-2",children:["Type ",(0,a.jsx)("span",{className:"underline",children:e})," to confirm deletion:"]}),(0,a.jsx)("input",{type:"text",value:W,onChange:e=>Q(e.target.value),placeholder:"Enter key 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,a.jsxs)("div",{className:"px-6 py-4 bg-gray-50 flex justify-end gap-4",children:[(0,a.jsx)("button",{onClick:()=>{J(!1),Q("")},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,a.jsx)("button",{onClick:ed,disabled:!s,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 ".concat(s?"bg-red-600 hover:bg-red-700":"bg-red-300 cursor-not-allowed"),children:"Delete Key"})]})]})})})(),(0,a.jsxs)(r.v0,{children:[(0,a.jsxs)(r.td,{className:"mb-4",children:[(0,a.jsx)(r.OK,{children:"Overview"}),(0,a.jsx)(r.OK,{children:"Settings"})]}),(0,a.jsxs)(r.nP,{children:[(0,a.jsx)(r.x4,{children:(0,a.jsxs)(r.rj,{numItems:1,numItemsSm:2,numItemsLg:3,className:"gap-6",children:[(0,a.jsxs)(r.Zb,{children:[(0,a.jsx)(r.xv,{children:"Spend"}),(0,a.jsxs)("div",{className:"mt-2",children:[(0,a.jsxs)(r.Dx,{children:["$",(0,U.pw)(es.spend,4)]}),(0,a.jsxs)(r.xv,{children:["of"," ",null!==es.max_budget?"$".concat((0,U.pw)(es.max_budget)):"Unlimited"]})]})]}),(0,a.jsxs)(r.Zb,{children:[(0,a.jsx)(r.xv,{children:"Rate Limits"}),(0,a.jsxs)("div",{className:"mt-2",children:[(0,a.jsxs)(r.xv,{children:["TPM: ",null!==es.tpm_limit?es.tpm_limit:"Unlimited"]}),(0,a.jsxs)(r.xv,{children:["RPM: ",null!==es.rpm_limit?es.rpm_limit:"Unlimited"]})]})]}),(0,a.jsxs)(r.Zb,{children:[(0,a.jsx)(r.xv,{children:"Models"}),(0,a.jsx)("div",{className:"mt-2 flex flex-wrap gap-2",children:es.models&&es.models.length>0?es.models.map((e,s)=>(0,a.jsx)(r.Ct,{color:"red",children:e},s)):(0,a.jsx)(r.xv,{children:"No models specified"})})]}),(0,a.jsx)(r.Zb,{children:(0,a.jsx)(K.Z,{objectPermission:es.object_permission,variant:"inline",accessToken:_})}),(0,a.jsx)(O.Z,{loggingConfigs:w(es.metadata),disabledCallbacks:Array.isArray(null===(s=es.metadata)||void 0===s?void 0:s.litellm_disabled_callbacks)?(0,S.PA)(es.metadata.litellm_disabled_callbacks):[],variant:"card"}),(0,a.jsx)(q,{autoRotate:es.auto_rotate,rotationInterval:es.rotation_interval,lastRotationAt:es.last_rotation_at,keyRotationAt:es.key_rotation_at,nextRotationAt:es.next_rotation_at,variant:"card"})]})}),(0,a.jsx)(r.x4,{children:(0,a.jsxs)(r.Zb,{className:"overflow-y-auto max-h-[65vh]",children:[(0,a.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,a.jsx)(r.Dx,{children:"Key Settings"}),!M&&N&&z.LQ.includes(N)&&(0,a.jsx)(r.zx,{variant:"light",onClick:()=>R(!0),children:"Edit Settings"})]}),M?(0,a.jsx)(L,{keyData:es,onCancel:()=>R(!1),onSubmit:en,teams:k,accessToken:_,userID:f,userRole:N,premiumUser:I}):(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Key ID"}),(0,a.jsx)(r.xv,{className:"font-mono",children:es.token_id||es.token})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Key Alias"}),(0,a.jsx)(r.xv,{children:es.key_alias||"Not Set"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Secret Key"}),(0,a.jsx)(r.xv,{className:"font-mono",children:es.key_name})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Team ID"}),(0,a.jsx)(r.xv,{children:es.team_id||"Not Set"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Organization"}),(0,a.jsx)(r.xv,{children:es.organization_id||"Not Set"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Created"}),(0,a.jsx)(r.xv,{children:ec(es.created_at)})]}),ea&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Last Regenerated"}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(r.xv,{children:ec(ea)}),(0,a.jsx)(r.Ct,{color:"green",size:"xs",children:"Recent"})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Expires"}),(0,a.jsx)(r.xv,{children:es.expires?ec(es.expires):"Never"})]}),(0,a.jsx)(q,{autoRotate:es.auto_rotate,rotationInterval:es.rotation_interval,lastRotationAt:es.last_rotation_at,keyRotationAt:es.key_rotation_at,nextRotationAt:es.next_rotation_at,variant:"inline",className:"pt-4 border-t border-gray-200"}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Spend"}),(0,a.jsxs)(r.xv,{children:["$",(0,U.pw)(es.spend,4)," USD"]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Budget"}),(0,a.jsx)(r.xv,{children:null!==es.max_budget?"$".concat((0,U.pw)(es.max_budget,2)):"Unlimited"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Prompts"}),(0,a.jsx)(r.xv,{children:Array.isArray(null===(t=es.metadata)||void 0===t?void 0:t.prompts)&&es.metadata.prompts.length>0?es.metadata.prompts.map((e,s)=>(0,a.jsx)("span",{className:"px-2 mr-2 py-1 bg-blue-100 rounded text-xs",children:e},s)):"No prompts specified"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Allowed Pass Through Routes"}),(0,a.jsx)(r.xv,{children:Array.isArray(null===(h=es.metadata)||void 0===h?void 0:h.allowed_passthrough_routes)&&es.metadata.allowed_passthrough_routes.length>0?es.metadata.allowed_passthrough_routes.map((e,s)=>(0,a.jsx)("span",{className:"px-2 mr-2 py-1 bg-blue-100 rounded text-xs",children:e},s)):"No pass through routes specified"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Models"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:es.models&&es.models.length>0?es.models.map((e,s)=>(0,a.jsx)("span",{className:"px-2 py-1 bg-blue-100 rounded text-xs",children:e},s)):(0,a.jsx)(r.xv,{children:"No models specified"})})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Rate Limits"}),(0,a.jsxs)(r.xv,{children:["TPM: ",null!==es.tpm_limit?es.tpm_limit:"Unlimited"]}),(0,a.jsxs)(r.xv,{children:["RPM: ",null!==es.rpm_limit?es.rpm_limit:"Unlimited"]}),(0,a.jsxs)(r.xv,{children:["Max Parallel Requests:"," ",null!==es.max_parallel_requests?es.max_parallel_requests:"Unlimited"]}),(0,a.jsxs)(r.xv,{children:["Model TPM Limits:"," ",(null===(g=es.metadata)||void 0===g?void 0:g.model_tpm_limit)?JSON.stringify(es.metadata.model_tpm_limit):"Unlimited"]}),(0,a.jsxs)(r.xv,{children:["Model RPM Limits:"," ",(null===(p=es.metadata)||void 0===p?void 0:p.model_rpm_limit)?JSON.stringify(es.metadata.model_rpm_limit):"Unlimited"]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Metadata"}),(0,a.jsx)("pre",{className:"bg-gray-100 p-2 rounded text-xs overflow-auto mt-1",children:Z(es.metadata)})]}),(0,a.jsx)(K.Z,{objectPermission:es.object_permission,variant:"inline",className:"pt-4 border-t border-gray-200",accessToken:_}),(0,a.jsx)(O.Z,{loggingConfigs:w(es.metadata),disabledCallbacks:Array.isArray(null===(j=es.metadata)||void 0===j?void 0:j.litellm_disabled_callbacks)?(0,S.PA)(es.metadata.litellm_disabled_callbacks):[],variant:"inline",className:"pt-4 border-t border-gray-200"})]})]})})]})]})]})}},33304:function(e,s,t){t.d(s,{C:function(){return a}});function a(e){return""===e?null:e}}}]);
\ No newline at end of file
+"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4292],{84717:function(e,s,t){t.d(s,{Ct:function(){return a.Z},Dx:function(){return u.Z},OK:function(){return n.Z},Zb:function(){return r.Z},nP:function(){return m.Z},rj:function(){return i.Z},td:function(){return o.Z},v0:function(){return d.Z},x4:function(){return c.Z},xv:function(){return x.Z},zx:function(){return l.Z}});var a=t(41649),l=t(20831),r=t(12514),i=t(67101),n=t(12485),d=t(18135),o=t(35242),c=t(29706),m=t(77991),x=t(84264),u=t(96761)},40728:function(e,s,t){t.d(s,{C:function(){return a.Z},x:function(){return l.Z}});var a=t(41649),l=t(84264)},16721:function(e,s,t){t.d(s,{Dx:function(){return d.Z},JX:function(){return l.Z},oi:function(){return n.Z},rj:function(){return r.Z},xv:function(){return i.Z},zx:function(){return a.Z}});var a=t(20831),l=t(49804),r=t(67101),i=t(84264),n=t(49566),d=t(96761)},64504:function(e,s,t){t.d(s,{o:function(){return l.Z},z:function(){return a.Z}});var a=t(20831),l=t(49566)},67479:function(e,s,t){var a=t(57437),l=t(2265),r=t(52787),i=t(19250);s.Z=e=>{let{onChange:s,value:t,className:n,accessToken:d,disabled:o}=e,[c,m]=(0,l.useState)([]),[x,u]=(0,l.useState)(!1);return(0,l.useEffect)(()=>{(async()=>{if(d){u(!0);try{let e=await (0,i.getGuardrailsList)(d);console.log("Guardrails response:",e),e.guardrails&&(console.log("Guardrails data:",e.guardrails),m(e.guardrails))}catch(e){console.error("Error fetching guardrails:",e)}finally{u(!1)}}})()},[d]),(0,a.jsx)("div",{children:(0,a.jsx)(r.default,{mode:"multiple",disabled:o,placeholder:o?"Setting guardrails is a premium feature.":"Select guardrails",onChange:e=>{console.log("Selected guardrails:",e),s(e)},value:t,loading:x,className:n,options:c.map(e=>(console.log("Mapping guardrail:",e),{label:"".concat(e.guardrail_name),value:e.guardrail_name})),optionFilterProp:"label",showSearch:!0,style:{width:"100%"}})})}},27799:function(e,s,t){var a=t(57437);t(2265);var l=t(40728),r=t(82182),i=t(91777),n=t(97434);s.Z=function(e){let{loggingConfigs:s=[],disabledCallbacks:t=[],variant:d="card",className:o=""}=e,c=e=>{var s;return(null===(s=Object.entries(n.Lo).find(s=>{let[t,a]=s;return a===e}))||void 0===s?void 0:s[0])||e},m=e=>{switch(e){case"success":return"green";case"failure":return"red";case"success_and_failure":return"blue";default:return"gray"}},x=e=>{switch(e){case"success":return"Success Only";case"failure":return"Failure Only";case"success_and_failure":return"Success & Failure";default:return e}},u=(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(r.Z,{className:"h-4 w-4 text-blue-600"}),(0,a.jsx)(l.x,{className:"font-semibold text-gray-900",children:"Logging Integrations"}),(0,a.jsx)(l.C,{color:"blue",size:"xs",children:s.length})]}),s.length>0?(0,a.jsx)("div",{className:"space-y-3",children:s.map((e,s)=>{var t;let i=c(e.callback_name),d=null===(t=n.Dg[i])||void 0===t?void 0:t.logo;return(0,a.jsxs)("div",{className:"flex items-center justify-between p-3 rounded-lg bg-blue-50 border border-blue-200",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[d?(0,a.jsx)("img",{src:d,alt:i,className:"w-5 h-5 object-contain"}):(0,a.jsx)(r.Z,{className:"h-5 w-5 text-gray-400"}),(0,a.jsxs)("div",{children:[(0,a.jsx)(l.x,{className:"font-medium text-blue-800",children:i}),(0,a.jsxs)(l.x,{className:"text-xs text-blue-600",children:[Object.keys(e.callback_vars).length," parameters configured"]})]})]}),(0,a.jsx)(l.C,{color:m(e.callback_type),size:"sm",children:x(e.callback_type)})]},s)})}):(0,a.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-50 border border-gray-200",children:[(0,a.jsx)(r.Z,{className:"h-4 w-4 text-gray-400"}),(0,a.jsx)(l.x,{className:"text-gray-500 text-sm",children:"No logging integrations configured"})]})]}),(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(i.Z,{className:"h-4 w-4 text-red-600"}),(0,a.jsx)(l.x,{className:"font-semibold text-gray-900",children:"Disabled Callbacks"}),(0,a.jsx)(l.C,{color:"red",size:"xs",children:t.length})]}),t.length>0?(0,a.jsx)("div",{className:"space-y-3",children:t.map((e,s)=>{var t;let r=n.RD[e]||e,d=null===(t=n.Dg[r])||void 0===t?void 0:t.logo;return(0,a.jsxs)("div",{className:"flex items-center justify-between p-3 rounded-lg bg-red-50 border border-red-200",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[d?(0,a.jsx)("img",{src:d,alt:r,className:"w-5 h-5 object-contain"}):(0,a.jsx)(i.Z,{className:"h-5 w-5 text-gray-400"}),(0,a.jsxs)("div",{children:[(0,a.jsx)(l.x,{className:"font-medium text-red-800",children:r}),(0,a.jsx)(l.x,{className:"text-xs text-red-600",children:"Disabled for this key"})]})]}),(0,a.jsx)(l.C,{color:"red",size:"sm",children:"Disabled"})]},s)})}):(0,a.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-50 border border-gray-200",children:[(0,a.jsx)(i.Z,{className:"h-4 w-4 text-gray-400"}),(0,a.jsx)(l.x,{className:"text-gray-500 text-sm",children:"No callbacks disabled"})]})]})]});return"card"===d?(0,a.jsxs)("div",{className:"bg-white border border-gray-200 rounded-lg p-6 ".concat(o),children:[(0,a.jsx)("div",{className:"flex items-center gap-2 mb-6",children:(0,a.jsxs)("div",{children:[(0,a.jsx)(l.x,{className:"font-semibold text-gray-900",children:"Logging Settings"}),(0,a.jsx)(l.x,{className:"text-xs text-gray-500",children:"Active logging integrations and disabled callbacks for this key"})]})}),u]}):(0,a.jsxs)("div",{className:"".concat(o),children:[(0,a.jsx)(l.x,{className:"font-medium text-gray-900 mb-3",children:"Logging Settings"}),u]})}},98015:function(e,s,t){t.d(s,{Z:function(){return g}});var a=t(57437),l=t(2265),r=t(92280),i=t(40728),n=t(79814),d=t(19250),o=function(e){let{vectorStores:s,accessToken:t}=e,[r,o]=(0,l.useState)([]);(0,l.useEffect)(()=>{(async()=>{if(t&&0!==s.length)try{let e=await (0,d.vectorStoreListCall)(t);e.data&&o(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)}})()},[t,s.length]);let c=e=>{let s=r.find(s=>s.vector_store_id===e);return s?"".concat(s.vector_store_name||s.vector_store_id," (").concat(s.vector_store_id,")"):e};return(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(n.Z,{className:"h-4 w-4 text-blue-600"}),(0,a.jsx)(i.x,{className:"font-semibold text-gray-900",children:"Vector Stores"}),(0,a.jsx)(i.C,{color:"blue",size:"xs",children:s.length})]}),s.length>0?(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:s.map((e,s)=>(0,a.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:c(e)},s))}):(0,a.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-50 border border-gray-200",children:[(0,a.jsx)(n.Z,{className:"h-4 w-4 text-gray-400"}),(0,a.jsx)(i.x,{className:"text-gray-500 text-sm",children:"No vector stores configured"})]})]})},c=t(25327),m=t(86462),x=t(47686),u=t(89970),h=function(e){let{mcpServers:s,mcpAccessGroups:r=[],mcpToolPermissions:n={},accessToken:o}=e,[h,g]=(0,l.useState)([]),[p,j]=(0,l.useState)([]),[v,b]=(0,l.useState)(new Set),y=e=>{b(s=>{let t=new Set(s);return t.has(e)?t.delete(e):t.add(e),t})};(0,l.useEffect)(()=>{(async()=>{if(o&&s.length>0)try{let e=await (0,d.fetchMCPServers)(o);e&&Array.isArray(e)?g(e):e.data&&Array.isArray(e.data)&&g(e.data)}catch(e){console.error("Error fetching MCP servers:",e)}})()},[o,s.length]),(0,l.useEffect)(()=>{(async()=>{if(o&&r.length>0)try{let e=await Promise.resolve().then(t.bind(t,19250)).then(e=>e.fetchMCPAccessGroups(o));j(Array.isArray(e)?e:e.data||[])}catch(e){console.error("Error fetching MCP access groups:",e)}})()},[o,r.length]);let _=e=>{let s=h.find(s=>s.server_id===e);if(s){let t=e.length>7?"".concat(e.slice(0,3),"...").concat(e.slice(-4)):e;return"".concat(s.alias," (").concat(t,")")}return e},f=e=>e,N=[...s.map(e=>({type:"server",value:e})),...r.map(e=>({type:"accessGroup",value:e}))],k=N.length;return(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(c.Z,{className:"h-4 w-4 text-blue-600"}),(0,a.jsx)(i.x,{className:"font-semibold text-gray-900",children:"MCP Servers"}),(0,a.jsx)(i.C,{color:"blue",size:"xs",children:k})]}),k>0?(0,a.jsx)("div",{className:"max-h-[400px] overflow-y-auto space-y-2 pr-1",children:N.map((e,s)=>{let t="server"===e.type?n[e.value]:void 0,l=t&&t.length>0,r=v.has(e.value);return(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("div",{onClick:()=>l&&y(e.value),className:"flex items-center gap-3 py-2 px-3 rounded-lg border border-gray-200 transition-all ".concat(l?"cursor-pointer hover:bg-gray-50 hover:border-gray-300":"bg-white"),children:[(0,a.jsx)("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:"server"===e.type?(0,a.jsx)(u.Z,{title:"Full ID: ".concat(e.value),placement:"top",children:(0,a.jsxs)("div",{className:"inline-flex items-center gap-2 min-w-0",children:[(0,a.jsx)("span",{className:"inline-block w-1.5 h-1.5 bg-blue-500 rounded-full flex-shrink-0"}),(0,a.jsx)("span",{className:"text-sm font-medium text-gray-900 truncate",children:_(e.value)})]})}):(0,a.jsxs)("div",{className:"inline-flex items-center gap-2 min-w-0",children:[(0,a.jsx)("span",{className:"inline-block w-1.5 h-1.5 bg-green-500 rounded-full flex-shrink-0"}),(0,a.jsx)("span",{className:"text-sm font-medium text-gray-900 truncate",children:f(e.value)}),(0,a.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,a.jsxs)("div",{className:"flex items-center gap-1 flex-shrink-0 whitespace-nowrap",children:[(0,a.jsx)("span",{className:"text-xs font-medium text-gray-600",children:t.length}),(0,a.jsx)("span",{className:"text-xs text-gray-500",children:1===t.length?"tool":"tools"}),r?(0,a.jsx)(m.Z,{className:"h-3.5 w-3.5 text-gray-400 ml-0.5"}):(0,a.jsx)(x.Z,{className:"h-3.5 w-3.5 text-gray-400 ml-0.5"})]})]}),l&&r&&(0,a.jsx)("div",{className:"ml-4 pl-4 border-l-2 border-blue-200 pb-1",children:(0,a.jsx)("div",{className:"flex flex-wrap gap-1.5",children:t.map((e,s)=>(0,a.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},s))})})]},s)})}):(0,a.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-50 border border-gray-200",children:[(0,a.jsx)(c.Z,{className:"h-4 w-4 text-gray-400"}),(0,a.jsx)(i.x,{className:"text-gray-500 text-sm",children:"No MCP servers or access groups configured"})]})]})},g=function(e){let{objectPermission:s,variant:t="card",className:l="",accessToken:i}=e,n=(null==s?void 0:s.vector_stores)||[],d=(null==s?void 0:s.mcp_servers)||[],c=(null==s?void 0:s.mcp_access_groups)||[],m=(null==s?void 0:s.mcp_tool_permissions)||{},x=(0,a.jsxs)("div",{className:"card"===t?"grid grid-cols-1 md:grid-cols-2 gap-6":"space-y-4",children:[(0,a.jsx)(o,{vectorStores:n,accessToken:i}),(0,a.jsx)(h,{mcpServers:d,mcpAccessGroups:c,mcpToolPermissions:m,accessToken:i})]});return"card"===t?(0,a.jsxs)("div",{className:"bg-white border border-gray-200 rounded-lg p-6 ".concat(l),children:[(0,a.jsx)("div",{className:"flex items-center gap-2 mb-6",children:(0,a.jsxs)("div",{children:[(0,a.jsx)(r.x,{className:"font-semibold text-gray-900",children:"Object Permissions"}),(0,a.jsx)(r.x,{className:"text-xs text-gray-500",children:"Access control for Vector Stores and MCP Servers"})]})}),x]}):(0,a.jsxs)("div",{className:"".concat(l),children:[(0,a.jsx)(r.x,{className:"font-medium text-gray-900 mb-3",children:"Object Permissions"}),x]})}},21425:function(e,s,t){var a=t(57437);t(2265);var l=t(54507);s.Z=e=>{let{value:s,onChange:t,disabledCallbacks:r=[],onDisabledCallbacksChange:i}=e;return(0,a.jsx)(l.Z,{value:s,onChange:t,disabledCallbacks:r,onDisabledCallbacksChange:i})}},94292:function(e,s,t){t.d(s,{Z:function(){return Q}});var a=t(57437),l=t(2265),r=t(84717),i=t(10900),n=t(23628),d=t(74998),o=t(19250),c=t(13634),m=t(73002),x=t(89970),u=t(9114),h=t(52787),g=t(64482),p=t(64504),j=t(30874),v=t(24199),b=t(97415),y=t(95920),_=t(68473),f=t(21425);let N=["logging"],k=e=>e&&"object"==typeof e?Object.fromEntries(Object.entries(e).filter(e=>{let[s]=e;return!N.includes(s)})):{},w=e=>e&&"object"==typeof e&&Array.isArray(e.logging)?e.logging:[],Z=function(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return JSON.stringify(k(e),null,s)};var S=t(97434),C=t(67479),A=t(62099),I=t(65895),P=t(95096);function L(e){var s,t,r,i,n,d,u,N,k,L;let{keyData:D,onCancel:M,onSubmit:R,teams:T,accessToken:E,userID:F,userRole:z,premiumUser:K=!1}=e,[O]=c.Z.useForm(),[U,V]=(0,l.useState)([]),[G,B]=(0,l.useState)([]),J=null==T?void 0:T.find(e=>e.team_id===D.team_id),[q,W]=(0,l.useState)([]),[$,Q]=(0,l.useState)([]),[X,Y]=(0,l.useState)(!1),[H,ee]=(0,l.useState)(Array.isArray(null===(s=D.metadata)||void 0===s?void 0:s.litellm_disabled_callbacks)?(0,S.PA)(D.metadata.litellm_disabled_callbacks):[]),[es,et]=(0,l.useState)(D.auto_rotate||!1),[ea,el]=(0,l.useState)(D.rotation_interval||"");(0,l.useEffect)(()=>{let e=async()=>{if(F&&z&&E)try{if(null===D.team_id){let e=(await (0,o.modelAvailableCall)(E,F,z)).data.map(e=>e.id);W(e)}else if(null==J?void 0:J.team_id){let e=await (0,j.wk)(F,z,E,J.team_id);W(Array.from(new Set([...J.models,...e])))}}catch(e){console.error("Error fetching models:",e)}};(async()=>{if(E)try{let e=await (0,o.getPromptsList)(E);B(e.prompts.map(e=>e.prompt_id))}catch(e){console.error("Failed to fetch prompts:",e)}})(),e()},[F,z,E,J,D.team_id]),(0,l.useEffect)(()=>{O.setFieldValue("disabled_callbacks",H)},[O,H]);let er=e=>e&&({"24h":"daily","7d":"weekly","30d":"monthly"})[e]||null,ei={...D,token:D.token||D.token_id,budget_duration:er(D.budget_duration),metadata:Z(D.metadata),guardrails:null===(t=D.metadata)||void 0===t?void 0:t.guardrails,prompts:null===(r=D.metadata)||void 0===r?void 0:r.prompts,vector_stores:(null===(i=D.object_permission)||void 0===i?void 0:i.vector_stores)||[],mcp_servers_and_groups:{servers:(null===(n=D.object_permission)||void 0===n?void 0:n.mcp_servers)||[],accessGroups:(null===(d=D.object_permission)||void 0===d?void 0:d.mcp_access_groups)||[]},mcp_tool_permissions:(null===(u=D.object_permission)||void 0===u?void 0:u.mcp_tool_permissions)||{},logging_settings:w(D.metadata),disabled_callbacks:Array.isArray(null===(N=D.metadata)||void 0===N?void 0:N.litellm_disabled_callbacks)?(0,S.PA)(D.metadata.litellm_disabled_callbacks):[],auto_rotate:D.auto_rotate||!1,...D.rotation_interval&&{rotation_interval:D.rotation_interval}};return(0,l.useEffect)(()=>{var e,s,t,a,l,r,i;O.setFieldsValue({...D,token:D.token||D.token_id,budget_duration:er(D.budget_duration),metadata:Z(D.metadata),guardrails:null===(e=D.metadata)||void 0===e?void 0:e.guardrails,prompts:null===(s=D.metadata)||void 0===s?void 0:s.prompts,vector_stores:(null===(t=D.object_permission)||void 0===t?void 0:t.vector_stores)||[],mcp_servers_and_groups:{servers:(null===(a=D.object_permission)||void 0===a?void 0:a.mcp_servers)||[],accessGroups:(null===(l=D.object_permission)||void 0===l?void 0:l.mcp_access_groups)||[]},mcp_tool_permissions:(null===(r=D.object_permission)||void 0===r?void 0:r.mcp_tool_permissions)||{},logging_settings:w(D.metadata),disabled_callbacks:Array.isArray(null===(i=D.metadata)||void 0===i?void 0:i.litellm_disabled_callbacks)?(0,S.PA)(D.metadata.litellm_disabled_callbacks):[],auto_rotate:D.auto_rotate||!1,...D.rotation_interval&&{rotation_interval:D.rotation_interval}})},[D,O]),(0,l.useEffect)(()=>{O.setFieldValue("auto_rotate",es)},[es,O]),(0,l.useEffect)(()=>{ea&&O.setFieldValue("rotation_interval",ea)},[ea,O]),console.log("premiumUser:",K),(0,a.jsxs)(c.Z,{form:O,onFinish:R,initialValues:ei,layout:"vertical",children:[(0,a.jsx)(c.Z.Item,{label:"Key Alias",name:"key_alias",children:(0,a.jsx)(p.o,{})}),(0,a.jsx)(c.Z.Item,{label:"Models",name:"models",children:(0,a.jsxs)(h.default,{mode:"multiple",placeholder:"Select models",style:{width:"100%"},children:[q.length>0&&(0,a.jsx)(h.default.Option,{value:"all-team-models",children:"All Team Models"}),q.map(e=>(0,a.jsx)(h.default.Option,{value:e,children:e},e))]})}),(0,a.jsx)(c.Z.Item,{label:"Max Budget (USD)",name:"max_budget",children:(0,a.jsx)(v.Z,{step:.01,style:{width:"100%"},placeholder:"Enter a numerical value"})}),(0,a.jsx)(c.Z.Item,{label:"Reset Budget",name:"budget_duration",children:(0,a.jsxs)(h.default,{placeholder:"n/a",children:[(0,a.jsx)(h.default.Option,{value:"daily",children:"Daily"}),(0,a.jsx)(h.default.Option,{value:"weekly",children:"Weekly"}),(0,a.jsx)(h.default.Option,{value:"monthly",children:"Monthly"})]})}),(0,a.jsx)(c.Z.Item,{label:"TPM Limit",name:"tpm_limit",children:(0,a.jsx)(v.Z,{min:0})}),(0,a.jsx)(I.Z,{type:"tpm",name:"tpm_limit_type",showDetailedDescriptions:!1}),(0,a.jsx)(c.Z.Item,{label:"RPM Limit",name:"rpm_limit",children:(0,a.jsx)(v.Z,{min:0})}),(0,a.jsx)(I.Z,{type:"rpm",name:"rpm_limit_type",showDetailedDescriptions:!1}),(0,a.jsx)(c.Z.Item,{label:"Max Parallel Requests",name:"max_parallel_requests",children:(0,a.jsx)(v.Z,{min:0})}),(0,a.jsx)(c.Z.Item,{label:"Model TPM Limit",name:"model_tpm_limit",children:(0,a.jsx)(g.default.TextArea,{rows:4,placeholder:'{"gpt-4": 100, "claude-v1": 200}'})}),(0,a.jsx)(c.Z.Item,{label:"Model RPM Limit",name:"model_rpm_limit",children:(0,a.jsx)(g.default.TextArea,{rows:4,placeholder:'{"gpt-4": 100, "claude-v1": 200}'})}),(0,a.jsx)(c.Z.Item,{label:"Guardrails",name:"guardrails",children:E&&(0,a.jsx)(C.Z,{onChange:e=>{O.setFieldValue("guardrails",e)},accessToken:E,disabled:!K})}),(0,a.jsx)(c.Z.Item,{label:"Prompts",name:"prompts",children:(0,a.jsx)(x.Z,{title:K?"":"Setting prompts by key is a premium feature",placement:"top",children:(0,a.jsx)(h.default,{mode:"tags",style:{width:"100%"},disabled:!K,placeholder:K?Array.isArray(null===(k=D.metadata)||void 0===k?void 0:k.prompts)&&D.metadata.prompts.length>0?"Current: ".concat(D.metadata.prompts.join(", ")):"Select or enter prompts":"Premium feature - Upgrade to set prompts by key",options:G.map(e=>({value:e,label:e}))})})}),(0,a.jsx)(c.Z.Item,{label:"Allowed Pass Through Routes",name:"allowed_passthrough_routes",children:(0,a.jsx)(x.Z,{title:K?"":"Setting allowed pass through routes by key is a premium feature",placement:"top",children:(0,a.jsx)(P.Z,{onChange:e=>O.setFieldValue("allowed_passthrough_routes",e),value:O.getFieldValue("allowed_passthrough_routes"),accessToken:E||"",placeholder:K?Array.isArray(null===(L=D.metadata)||void 0===L?void 0:L.allowed_passthrough_routes)&&D.metadata.allowed_passthrough_routes.length>0?"Current: ".concat(D.metadata.allowed_passthrough_routes.join(", ")):"Select or enter allowed pass through routes":"Premium feature - Upgrade to set allowed pass through routes by key",disabled:!K})})}),(0,a.jsx)(c.Z.Item,{label:"Vector Stores",name:"vector_stores",children:(0,a.jsx)(b.Z,{onChange:e=>O.setFieldValue("vector_stores",e),value:O.getFieldValue("vector_stores"),accessToken:E||"",placeholder:"Select vector stores"})}),(0,a.jsx)(c.Z.Item,{label:"MCP Servers / Access Groups",name:"mcp_servers_and_groups",children:(0,a.jsx)(y.Z,{onChange:e=>O.setFieldValue("mcp_servers_and_groups",e),value:O.getFieldValue("mcp_servers_and_groups"),accessToken:E||"",placeholder:"Select MCP servers or access groups (optional)"})}),(0,a.jsx)(c.Z.Item,{name:"mcp_tool_permissions",initialValue:{},hidden:!0,children:(0,a.jsx)(g.default,{type:"hidden"})}),(0,a.jsx)(c.Z.Item,{noStyle:!0,shouldUpdate:(e,s)=>e.mcp_servers_and_groups!==s.mcp_servers_and_groups||e.mcp_tool_permissions!==s.mcp_tool_permissions,children:()=>{var e;return(0,a.jsx)("div",{className:"mb-6",children:(0,a.jsx)(_.Z,{accessToken:E||"",selectedServers:(null===(e=O.getFieldValue("mcp_servers_and_groups"))||void 0===e?void 0:e.servers)||[],toolPermissions:O.getFieldValue("mcp_tool_permissions")||{},onChange:e=>O.setFieldsValue({mcp_tool_permissions:e})})})}}),(0,a.jsx)(c.Z.Item,{label:"Team ID",name:"team_id",children:(0,a.jsx)(h.default,{placeholder:"Select team",style:{width:"100%"},children:null==T?void 0:T.map(e=>(0,a.jsx)(h.default.Option,{value:e.team_id,children:"".concat(e.team_alias," (").concat(e.team_id,")")},e.team_id))})}),(0,a.jsx)(c.Z.Item,{label:"Logging Settings",name:"logging_settings",children:(0,a.jsx)(f.Z,{value:O.getFieldValue("logging_settings"),onChange:e=>O.setFieldValue("logging_settings",e),disabledCallbacks:H,onDisabledCallbacksChange:e=>{ee((0,S.PA)(e)),O.setFieldValue("disabled_callbacks",e)}})}),(0,a.jsx)(c.Z.Item,{label:"Metadata",name:"metadata",children:(0,a.jsx)(g.default.TextArea,{rows:10})}),(0,a.jsx)("div",{className:"mb-4",children:(0,a.jsx)(A.Z,{form:O,autoRotationEnabled:es,onAutoRotationChange:et,rotationInterval:ea,onRotationIntervalChange:el})}),(0,a.jsx)(c.Z.Item,{name:"token",hidden:!0,children:(0,a.jsx)(g.default,{})}),(0,a.jsx)(c.Z.Item,{name:"disabled_callbacks",hidden:!0,children:(0,a.jsx)(g.default,{})}),(0,a.jsx)(c.Z.Item,{name:"auto_rotate",hidden:!0,children:(0,a.jsx)(g.default,{})}),(0,a.jsx)(c.Z.Item,{name:"rotation_interval",hidden:!0,children:(0,a.jsx)(g.default,{})}),(0,a.jsx)("div",{className:"sticky z-10 bg-white p-4 border-t border-gray-200 bottom-[-1.5rem] inset-x-[-1.5rem]",children:(0,a.jsxs)("div",{className:"flex justify-end items-center gap-2",children:[(0,a.jsx)(m.ZP,{onClick:M,children:"Cancel"}),(0,a.jsx)(p.z,{type:"submit",children:"Save Changes"})]})})]})}var D=t(16721),M=t(82680),R=t(20577),T=t(7366),E=t(29233);function F(e){let{selectedToken:s,visible:t,onClose:r,accessToken:i,premiumUser:n,setAccessToken:d,onKeyUpdate:m}=e,[x]=c.Z.useForm(),[h,g]=(0,l.useState)(null),[p,j]=(0,l.useState)(null),[v,b]=(0,l.useState)(null),[y,_]=(0,l.useState)(!1),[f,N]=(0,l.useState)(!1),[k,w]=(0,l.useState)(null);(0,l.useEffect)(()=>{t&&s&&i&&(x.setFieldsValue({key_alias:s.key_alias,max_budget:s.max_budget,tpm_limit:s.tpm_limit,rpm_limit:s.rpm_limit,duration:s.duration||""}),w(i),N(s.key_name===i))},[t,s,x,i]),(0,l.useEffect)(()=>{t||(g(null),_(!1),N(!1),w(null),x.resetFields())},[t,x]);let Z=e=>{if(!e)return null;try{let s;let t=new Date;if(e.endsWith("s"))s=(0,T.Z)(t,{seconds:parseInt(e)});else if(e.endsWith("h"))s=(0,T.Z)(t,{hours:parseInt(e)});else if(e.endsWith("d"))s=(0,T.Z)(t,{days:parseInt(e)});else throw Error("Invalid duration format");return s.toLocaleString()}catch(e){return null}};(0,l.useEffect)(()=>{(null==p?void 0:p.duration)?b(Z(p.duration)):b(null)},[null==p?void 0:p.duration]);let S=async()=>{if(s&&k){_(!0);try{let e=await x.validateFields(),t=await (0,o.regenerateKeyCall)(k,s.token||s.token_id,e);g(t.key),u.Z.success("API Key regenerated successfully"),console.log("Full regenerate response:",t);let a={token:t.token||t.key_id||s.token,key_name:t.key,max_budget:e.max_budget,tpm_limit:e.tpm_limit,rpm_limit:e.rpm_limit,expires:e.duration?Z(e.duration):s.expires,...t};console.log("Updated key data with new token:",a),f&&(w(t.key),d&&d(t.key)),m&&m(a),_(!1)}catch(e){console.error("Error regenerating key:",e),u.Z.fromBackend(e),_(!1)}}},C=()=>{g(null),_(!1),N(!1),w(null),x.resetFields(),r()};return(0,a.jsx)(M.Z,{title:"Regenerate API Key",open:t,onCancel:C,footer:h?[(0,a.jsx)(D.zx,{onClick:C,children:"Close"},"close")]:[(0,a.jsx)(D.zx,{onClick:C,className:"mr-2",children:"Cancel"},"cancel"),(0,a.jsx)(D.zx,{onClick:S,disabled:y,children:y?"Regenerating...":"Regenerate"},"regenerate")],children:h?(0,a.jsxs)(D.rj,{numItems:1,className:"gap-2 w-full",children:[(0,a.jsx)(D.Dx,{children:"Regenerated Key"}),(0,a.jsx)(D.JX,{numColSpan:1,children:(0,a.jsxs)("p",{children:["Please replace your old key with the new key generated. For security reasons,"," ",(0,a.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,a.jsxs)(D.JX,{numColSpan:1,children:[(0,a.jsx)(D.xv,{className:"mt-3",children:"Key Alias:"}),(0,a.jsx)("div",{className:"bg-gray-100 p-2 rounded mb-2",children:(0,a.jsx)("pre",{className:"break-words whitespace-normal",children:(null==s?void 0:s.key_alias)||"No alias set"})}),(0,a.jsx)(D.xv,{className:"mt-3",children:"New API Key:"}),(0,a.jsx)("div",{className:"bg-gray-100 p-2 rounded mb-2",children:(0,a.jsx)("pre",{className:"break-words whitespace-normal",children:h})}),(0,a.jsx)(E.CopyToClipboard,{text:h,onCopy:()=>u.Z.success("API Key copied to clipboard"),children:(0,a.jsx)(D.zx,{className:"mt-3",children:"Copy API Key"})})]})]}):(0,a.jsxs)(c.Z,{form:x,layout:"vertical",onValuesChange:e=>{"duration"in e&&j(s=>({...s,duration:e.duration}))},children:[(0,a.jsx)(c.Z.Item,{name:"key_alias",label:"Key Alias",children:(0,a.jsx)(D.oi,{disabled:!0})}),(0,a.jsx)(c.Z.Item,{name:"max_budget",label:"Max Budget (USD)",children:(0,a.jsx)(R.Z,{step:.01,precision:2,style:{width:"100%"}})}),(0,a.jsx)(c.Z.Item,{name:"tpm_limit",label:"TPM Limit",children:(0,a.jsx)(R.Z,{style:{width:"100%"}})}),(0,a.jsx)(c.Z.Item,{name:"rpm_limit",label:"RPM Limit",children:(0,a.jsx)(R.Z,{style:{width:"100%"}})}),(0,a.jsx)(c.Z.Item,{name:"duration",label:"Expire Key (eg: 30s, 30h, 30d)",className:"mt-8",children:(0,a.jsx)(D.oi,{placeholder:""})}),(0,a.jsxs)("div",{className:"mt-2 text-sm text-gray-500",children:["Current expiry: ",(null==s?void 0:s.expires)?new Date(s.expires).toLocaleString():"Never"]}),v&&(0,a.jsxs)("div",{className:"mt-2 text-sm text-green-600",children:["New expiry: ",v]})]})})}var z=t(20347),K=t(98015),O=t(27799),U=t(59872),V=t(30401),G=t(78867),B=t(85968),J=t(40728),q=t(58710),W=e=>{let{autoRotate:s=!1,rotationInterval:t,lastRotationAt:l,keyRotationAt:r,nextRotationAt:i,variant:d="card",className:o=""}=e,c=e=>{let s=new Date(e),t=s.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}),a=s.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0});return"".concat(t," at ").concat(a)},m=(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsx)("div",{className:"space-y-3",children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(n.Z,{className:"h-4 w-4 text-blue-600"}),(0,a.jsx)(J.x,{className:"font-semibold text-gray-900",children:"Auto-Rotation"}),(0,a.jsx)(J.C,{color:s?"green":"gray",size:"xs",children:s?"Enabled":"Disabled"}),s&&t&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(J.x,{className:"text-gray-400",children:"•"}),(0,a.jsxs)(J.x,{className:"text-sm text-gray-600",children:["Every ",t]})]})]})}),(s||l||r||i)&&(0,a.jsxs)("div",{className:"space-y-3",children:[l&&(0,a.jsxs)("div",{className:"flex items-center gap-2 p-3 bg-gray-50 border border-gray-200 rounded-md",children:[(0,a.jsx)(q.Z,{className:"w-4 h-4 text-gray-500"}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)(J.x,{className:"font-medium text-gray-700",children:"Last Rotation"}),(0,a.jsx)(J.x,{className:"text-sm text-gray-600",children:c(l)})]})]}),(r||i)&&(0,a.jsxs)("div",{className:"flex items-center gap-2 p-3 bg-gray-50 border border-gray-200 rounded-md",children:[(0,a.jsx)(q.Z,{className:"w-4 h-4 text-gray-500"}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)(J.x,{className:"font-medium text-gray-700",children:"Next Scheduled Rotation"}),(0,a.jsx)(J.x,{className:"text-sm text-gray-600",children:c(i||r||"")})]})]}),s&&!l&&!r&&!i&&(0,a.jsxs)("div",{className:"flex items-center gap-2 p-3 bg-gray-50 border border-gray-100 rounded-md",children:[(0,a.jsx)(q.Z,{className:"w-4 h-4 text-gray-500"}),(0,a.jsx)(J.x,{className:"text-gray-600",children:"No rotation history available"})]})]}),!s&&!l&&!r&&!i&&(0,a.jsxs)("div",{className:"flex items-center gap-2 p-3 bg-gray-50 border border-gray-100 rounded-md",children:[(0,a.jsx)(n.Z,{className:"w-4 h-4 text-gray-400"}),(0,a.jsx)(J.x,{className:"text-gray-600",children:"Auto-rotation is not enabled for this key"})]})]});return"card"===d?(0,a.jsxs)("div",{className:"bg-white border border-gray-200 rounded-lg p-6 ".concat(o),children:[(0,a.jsx)("div",{className:"flex items-center gap-2 mb-6",children:(0,a.jsxs)("div",{children:[(0,a.jsx)(J.x,{className:"font-semibold text-gray-900",children:"Auto-Rotation"}),(0,a.jsx)(J.x,{className:"text-xs text-gray-500",children:"Automatic key rotation settings and status for this key"})]})}),m]}):(0,a.jsxs)("div",{className:"".concat(o),children:[(0,a.jsx)(J.x,{className:"font-medium text-gray-900 mb-3",children:"Auto-Rotation"}),m]})},$=t(33304);function Q(e){var s,t,h,g,p,j;let{keyId:v,onClose:b,keyData:y,accessToken:_,userID:f,userRole:N,teams:k,onKeyDataUpdate:C,onDelete:A,premiumUser:I,setAccessToken:P,backButtonText:D="Back to Keys"}=e,[M,R]=(0,l.useState)(!1),[T]=c.Z.useForm(),[E,J]=(0,l.useState)(!1),[q,Q]=(0,l.useState)(""),[X,Y]=(0,l.useState)(!1),[H,ee]=(0,l.useState)({}),[es,et]=(0,l.useState)(y),[ea,el]=(0,l.useState)(null),[er,ei]=(0,l.useState)(!1);if((0,l.useEffect)(()=>{y&&et(y)},[y]),(0,l.useEffect)(()=>{if(er){let e=setTimeout(()=>{ei(!1)},5e3);return()=>clearTimeout(e)}},[er]),!es)return(0,a.jsxs)("div",{className:"p-4",children:[(0,a.jsx)(r.zx,{icon:i.Z,variant:"light",onClick:b,className:"mb-4",children:D}),(0,a.jsx)(r.xv,{children:"Key not found"})]});let en=async e=>{try{var s,t,a,l;if(!_)return;let r=e.token;if(e.key=r,I||(delete e.guardrails,delete e.prompts),e.max_budget=(0,$.C)(e.max_budget),void 0!==e.vector_stores&&(e.object_permission={...es.object_permission,vector_stores:e.vector_stores||[]},delete e.vector_stores),void 0!==e.mcp_servers_and_groups){let{servers:s,accessGroups:t}=e.mcp_servers_and_groups||{servers:[],accessGroups:[]};e.object_permission={...es.object_permission,mcp_servers:s||[],mcp_access_groups:t||[]},delete e.mcp_servers_and_groups}if(void 0!==e.mcp_tool_permissions){let s=e.mcp_tool_permissions||{};Object.keys(s).length>0&&(e.object_permission={...e.object_permission,mcp_tool_permissions:s}),delete e.mcp_tool_permissions}if(e.max_budget=(0,$.C)(e.max_budget),e.tpm_limit=(0,$.C)(e.tpm_limit),e.rpm_limit=(0,$.C)(e.rpm_limit),e.max_parallel_requests=(0,$.C)(e.max_parallel_requests),e.metadata&&"string"==typeof e.metadata)try{let a=JSON.parse(e.metadata);e.metadata={...a,...(null===(s=e.guardrails)||void 0===s?void 0:s.length)>0?{guardrails:e.guardrails}:{},...e.logging_settings?{logging:e.logging_settings}:{},...(null===(t=e.disabled_callbacks)||void 0===t?void 0:t.length)>0?{litellm_disabled_callbacks:(0,S.Z3)(e.disabled_callbacks)}:{}}}catch(e){console.error("Error parsing metadata JSON:",e),u.Z.error("Invalid metadata JSON");return}else e.metadata={...e.metadata||{},...(null===(a=e.guardrails)||void 0===a?void 0:a.length)>0?{guardrails:e.guardrails}:{},...e.logging_settings?{logging:e.logging_settings}:{},...(null===(l=e.disabled_callbacks)||void 0===l?void 0:l.length)>0?{litellm_disabled_callbacks:(0,S.Z3)(e.disabled_callbacks)}:{}};delete e.logging_settings,e.budget_duration&&(e.budget_duration=({daily:"24h",weekly:"7d",monthly:"30d"})[e.budget_duration]);let i=await (0,o.keyUpdateCall)(_,e);et(e=>e?{...e,...i}:void 0),C&&C(i),u.Z.success("Key updated successfully"),R(!1)}catch(e){u.Z.fromBackend((0,B.O)(e)),console.error("Error updating key:",e)}},ed=async()=>{try{if(!_)return;await (0,o.keyDeleteCall)(_,es.token||es.token_id),u.Z.success("Key deleted successfully"),A&&A(),b()}catch(e){console.error("Error deleting the key:",e),u.Z.fromBackend(e)}Q("")},eo=async(e,s)=>{await (0,U.vQ)(e)&&(ee(e=>({...e,[s]:!0})),setTimeout(()=>{ee(e=>({...e,[s]:!1}))},2e3))},ec=e=>{let s=new Date(e),t=s.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}),a=s.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0});return"".concat(t," at ").concat(a)};return(0,a.jsxs)("div",{className:"w-full h-screen p-4",children:[(0,a.jsxs)("div",{className:"flex justify-between items-center mb-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(r.zx,{icon:i.Z,variant:"light",onClick:b,className:"mb-4",children:D}),(0,a.jsx)(r.Dx,{children:es.key_alias||"API Key"}),(0,a.jsxs)("div",{className:"flex items-center cursor-pointer mb-2 space-y-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-xs text-gray-400 uppercase tracking-wide mt-2",children:"Key ID"}),(0,a.jsx)(r.xv,{className:"text-gray-500 font-mono text-sm",children:es.token_id||es.token})]}),(0,a.jsx)(m.ZP,{type:"text",size:"small",icon:H["key-id"]?(0,a.jsx)(V.Z,{size:12}):(0,a.jsx)(G.Z,{size:12}),onClick:()=>eo(es.token_id||es.token,"key-id"),className:"ml-2 transition-all duration-200".concat(H["key-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,a.jsx)(r.xv,{className:"text-sm text-gray-500",children:es.updated_at&&es.updated_at!==es.created_at?"Updated: ".concat(ec(es.updated_at)):"Created: ".concat(ec(es.created_at))}),er&&(0,a.jsx)(r.Ct,{color:"green",size:"xs",className:"animate-pulse",children:"Recently Regenerated"}),ea&&(0,a.jsx)(r.Ct,{color:"blue",size:"xs",children:"Regenerated"})]})]}),N&&z.LQ.includes(N)&&(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(x.Z,{title:I?"":"This is a LiteLLM Enterprise feature, and requires a valid key to use.",children:(0,a.jsx)("span",{className:"inline-block",children:(0,a.jsx)(r.zx,{icon:n.Z,variant:"secondary",onClick:()=>Y(!0),className:"flex items-center",disabled:!I,children:"Regenerate Key"})})}),(0,a.jsx)(r.zx,{icon:d.Z,variant:"secondary",onClick:()=>J(!0),className:"flex items-center",children:"Delete Key"})]})]}),(0,a.jsx)(F,{selectedToken:es,visible:X,onClose:()=>Y(!1),accessToken:_,premiumUser:I,setAccessToken:P,onKeyUpdate:e=>{et(s=>{if(s)return{...s,...e,created_at:new Date().toLocaleString()}}),el(new Date),ei(!0),C&&C({...e,created_at:new Date().toLocaleString()})}}),E&&(()=>{let e=(null==es?void 0:es.key_alias)||(null==es?void 0:es.token_id)||"API Key",s=q===e;return(0,a.jsx)("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:(0,a.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,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center justify-between px-6 py-4 border-b border-gray-200",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold text-gray-900",children:"Delete Key"}),(0,a.jsx)("button",{onClick:()=>{J(!1),Q("")},className:"text-gray-400 hover:text-gray-500 focus:outline-none",children:(0,a.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,a.jsxs)("div",{className:"px-6 py-4",children:[(0,a.jsxs)("div",{className:"flex items-start gap-3 p-4 bg-red-50 border border-red-100 rounded-md mb-5",children:[(0,a.jsx)("div",{className:"text-red-500 mt-0.5",children:(0,a.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L3.082 16.5c-.77.833.192 2.5 1.732 2.5z"})})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-base font-medium text-red-600",children:"Warning: You are about to delete this API key."}),(0,a.jsx)("p",{className:"text-base text-red-600 mt-2",children:"This action is irreversible and will immediately revoke access for any applications using this key."})]})]}),(0,a.jsx)("p",{className:"text-base text-gray-600 mb-5",children:"Are you sure you want to delete this API key?"}),(0,a.jsxs)("div",{className:"mb-5",children:[(0,a.jsxs)("label",{className:"block text-base font-medium text-gray-700 mb-2",children:["Type ",(0,a.jsx)("span",{className:"underline",children:e})," to confirm deletion:"]}),(0,a.jsx)("input",{type:"text",value:q,onChange:e=>Q(e.target.value),placeholder:"Enter key 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,a.jsxs)("div",{className:"px-6 py-4 bg-gray-50 flex justify-end gap-4",children:[(0,a.jsx)("button",{onClick:()=>{J(!1),Q("")},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,a.jsx)("button",{onClick:ed,disabled:!s,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 ".concat(s?"bg-red-600 hover:bg-red-700":"bg-red-300 cursor-not-allowed"),children:"Delete Key"})]})]})})})(),(0,a.jsxs)(r.v0,{children:[(0,a.jsxs)(r.td,{className:"mb-4",children:[(0,a.jsx)(r.OK,{children:"Overview"}),(0,a.jsx)(r.OK,{children:"Settings"})]}),(0,a.jsxs)(r.nP,{children:[(0,a.jsx)(r.x4,{children:(0,a.jsxs)(r.rj,{numItems:1,numItemsSm:2,numItemsLg:3,className:"gap-6",children:[(0,a.jsxs)(r.Zb,{children:[(0,a.jsx)(r.xv,{children:"Spend"}),(0,a.jsxs)("div",{className:"mt-2",children:[(0,a.jsxs)(r.Dx,{children:["$",(0,U.pw)(es.spend,4)]}),(0,a.jsxs)(r.xv,{children:["of"," ",null!==es.max_budget?"$".concat((0,U.pw)(es.max_budget)):"Unlimited"]})]})]}),(0,a.jsxs)(r.Zb,{children:[(0,a.jsx)(r.xv,{children:"Rate Limits"}),(0,a.jsxs)("div",{className:"mt-2",children:[(0,a.jsxs)(r.xv,{children:["TPM: ",null!==es.tpm_limit?es.tpm_limit:"Unlimited"]}),(0,a.jsxs)(r.xv,{children:["RPM: ",null!==es.rpm_limit?es.rpm_limit:"Unlimited"]})]})]}),(0,a.jsxs)(r.Zb,{children:[(0,a.jsx)(r.xv,{children:"Models"}),(0,a.jsx)("div",{className:"mt-2 flex flex-wrap gap-2",children:es.models&&es.models.length>0?es.models.map((e,s)=>(0,a.jsx)(r.Ct,{color:"red",children:e},s)):(0,a.jsx)(r.xv,{children:"No models specified"})})]}),(0,a.jsx)(r.Zb,{children:(0,a.jsx)(K.Z,{objectPermission:es.object_permission,variant:"inline",accessToken:_})}),(0,a.jsx)(O.Z,{loggingConfigs:w(es.metadata),disabledCallbacks:Array.isArray(null===(s=es.metadata)||void 0===s?void 0:s.litellm_disabled_callbacks)?(0,S.PA)(es.metadata.litellm_disabled_callbacks):[],variant:"card"}),(0,a.jsx)(W,{autoRotate:es.auto_rotate,rotationInterval:es.rotation_interval,lastRotationAt:es.last_rotation_at,keyRotationAt:es.key_rotation_at,nextRotationAt:es.next_rotation_at,variant:"card"})]})}),(0,a.jsx)(r.x4,{children:(0,a.jsxs)(r.Zb,{className:"overflow-y-auto max-h-[65vh]",children:[(0,a.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,a.jsx)(r.Dx,{children:"Key Settings"}),!M&&N&&z.LQ.includes(N)&&(0,a.jsx)(r.zx,{variant:"light",onClick:()=>R(!0),children:"Edit Settings"})]}),M?(0,a.jsx)(L,{keyData:es,onCancel:()=>R(!1),onSubmit:en,teams:k,accessToken:_,userID:f,userRole:N,premiumUser:I}):(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Key ID"}),(0,a.jsx)(r.xv,{className:"font-mono",children:es.token_id||es.token})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Key Alias"}),(0,a.jsx)(r.xv,{children:es.key_alias||"Not Set"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Secret Key"}),(0,a.jsx)(r.xv,{className:"font-mono",children:es.key_name})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Team ID"}),(0,a.jsx)(r.xv,{children:es.team_id||"Not Set"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Organization"}),(0,a.jsx)(r.xv,{children:es.organization_id||"Not Set"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Created"}),(0,a.jsx)(r.xv,{children:ec(es.created_at)})]}),ea&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Last Regenerated"}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(r.xv,{children:ec(ea)}),(0,a.jsx)(r.Ct,{color:"green",size:"xs",children:"Recent"})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Expires"}),(0,a.jsx)(r.xv,{children:es.expires?ec(es.expires):"Never"})]}),(0,a.jsx)(W,{autoRotate:es.auto_rotate,rotationInterval:es.rotation_interval,lastRotationAt:es.last_rotation_at,keyRotationAt:es.key_rotation_at,nextRotationAt:es.next_rotation_at,variant:"inline",className:"pt-4 border-t border-gray-200"}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Spend"}),(0,a.jsxs)(r.xv,{children:["$",(0,U.pw)(es.spend,4)," USD"]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Budget"}),(0,a.jsx)(r.xv,{children:null!==es.max_budget?"$".concat((0,U.pw)(es.max_budget,2)):"Unlimited"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Prompts"}),(0,a.jsx)(r.xv,{children:Array.isArray(null===(t=es.metadata)||void 0===t?void 0:t.prompts)&&es.metadata.prompts.length>0?es.metadata.prompts.map((e,s)=>(0,a.jsx)("span",{className:"px-2 mr-2 py-1 bg-blue-100 rounded text-xs",children:e},s)):"No prompts specified"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Allowed Pass Through Routes"}),(0,a.jsx)(r.xv,{children:Array.isArray(null===(h=es.metadata)||void 0===h?void 0:h.allowed_passthrough_routes)&&es.metadata.allowed_passthrough_routes.length>0?es.metadata.allowed_passthrough_routes.map((e,s)=>(0,a.jsx)("span",{className:"px-2 mr-2 py-1 bg-blue-100 rounded text-xs",children:e},s)):"No pass through routes specified"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Models"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:es.models&&es.models.length>0?es.models.map((e,s)=>(0,a.jsx)("span",{className:"px-2 py-1 bg-blue-100 rounded text-xs",children:e},s)):(0,a.jsx)(r.xv,{children:"No models specified"})})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Rate Limits"}),(0,a.jsxs)(r.xv,{children:["TPM: ",null!==es.tpm_limit?es.tpm_limit:"Unlimited"]}),(0,a.jsxs)(r.xv,{children:["RPM: ",null!==es.rpm_limit?es.rpm_limit:"Unlimited"]}),(0,a.jsxs)(r.xv,{children:["Max Parallel Requests:"," ",null!==es.max_parallel_requests?es.max_parallel_requests:"Unlimited"]}),(0,a.jsxs)(r.xv,{children:["Model TPM Limits:"," ",(null===(g=es.metadata)||void 0===g?void 0:g.model_tpm_limit)?JSON.stringify(es.metadata.model_tpm_limit):"Unlimited"]}),(0,a.jsxs)(r.xv,{children:["Model RPM Limits:"," ",(null===(p=es.metadata)||void 0===p?void 0:p.model_rpm_limit)?JSON.stringify(es.metadata.model_rpm_limit):"Unlimited"]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Metadata"}),(0,a.jsx)("pre",{className:"bg-gray-100 p-2 rounded text-xs overflow-auto mt-1",children:Z(es.metadata)})]}),(0,a.jsx)(K.Z,{objectPermission:es.object_permission,variant:"inline",className:"pt-4 border-t border-gray-200",accessToken:_}),(0,a.jsx)(O.Z,{loggingConfigs:w(es.metadata),disabledCallbacks:Array.isArray(null===(j=es.metadata)||void 0===j?void 0:j.litellm_disabled_callbacks)?(0,S.PA)(es.metadata.litellm_disabled_callbacks):[],variant:"inline",className:"pt-4 border-t border-gray-200"})]})]})})]})]})]})}},33304:function(e,s,t){t.d(s,{C:function(){return a}});function a(e){return""===e?null:e}}}]);
\ No newline at end of file
diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/4696-6ed186a88283bc88.js b/litellm/proxy/_experimental/out/_next/static/chunks/4696-42f889dd0e9f1f8b.js
similarity index 100%
rename from litellm/proxy/_experimental/out/_next/static/chunks/4696-6ed186a88283bc88.js
rename to litellm/proxy/_experimental/out/_next/static/chunks/4696-42f889dd0e9f1f8b.js
diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/5030-d46e46be47c1567d.js b/litellm/proxy/_experimental/out/_next/static/chunks/5030-d46e46be47c1567d.js
new file mode 100644
index 00000000000..f22c6ea7f7f
--- /dev/null
+++ b/litellm/proxy/_experimental/out/_next/static/chunks/5030-d46e46be47c1567d.js
@@ -0,0 +1 @@
+"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5030],{83669:function(t,o,n){n.d(o,{Z:function(){return i}});var e=n(1119),a=n(2265),r={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"},c=n(55015),i=a.forwardRef(function(t,o){return a.createElement(c.Z,(0,e.Z)({},t,{ref:o,icon:r}))})},33866:function(t,o,n){n.d(o,{Z:function(){return B}});var e=n(2265),a=n(36760),r=n.n(a),c=n(47970),i=n(93350),l=n(19722),s=n(71744),u=n(352),d=n(12918),m=n(18536),b=n(3104),g=n(80669);let p=new u.E4("antStatusProcessing",{"0%":{transform:"scale(0.8)",opacity:.5},"100%":{transform:"scale(2.4)",opacity:0}}),f=new u.E4("antZoomBadgeIn",{"0%":{transform:"scale(0) translate(50%, -50%)",opacity:0},"100%":{transform:"scale(1) translate(50%, -50%)"}}),v=new u.E4("antZoomBadgeOut",{"0%":{transform:"scale(1) translate(50%, -50%)"},"100%":{transform:"scale(0) translate(50%, -50%)",opacity:0}}),h=new u.E4("antNoWrapperZoomBadgeIn",{"0%":{transform:"scale(0)",opacity:0},"100%":{transform:"scale(1)"}}),y=new u.E4("antNoWrapperZoomBadgeOut",{"0%":{transform:"scale(1)"},"100%":{transform:"scale(0)",opacity:0}}),O=new u.E4("antBadgeLoadingCircle",{"0%":{transformOrigin:"50%"},"100%":{transform:"translate(50%, -50%) rotate(360deg)",transformOrigin:"50%"}}),w=t=>{let{componentCls:o,iconCls:n,antCls:e,badgeShadowSize:a,motionDurationSlow:r,textFontSize:c,textFontSizeSM:i,statusSize:l,dotSize:s,textFontWeight:b,indicatorHeight:g,indicatorHeightSM:w,marginXS:E,calc:S}=t,C="".concat(e,"-scroll-number"),N=(0,m.Z)(t,(t,n)=>{let{darkColor:e}=n;return{["&".concat(o," ").concat(o,"-color-").concat(t)]:{background:e,["&:not(".concat(o,"-count)")]:{color:e}}}});return{[o]:Object.assign(Object.assign(Object.assign(Object.assign({},(0,d.Wf)(t)),{position:"relative",display:"inline-block",width:"fit-content",lineHeight:1,["".concat(o,"-count")]:{zIndex:t.indicatorZIndex,minWidth:g,height:g,color:t.badgeTextColor,fontWeight:b,fontSize:c,lineHeight:(0,u.bf)(g),whiteSpace:"nowrap",textAlign:"center",background:t.badgeColor,borderRadius:S(g).div(2).equal(),boxShadow:"0 0 0 ".concat((0,u.bf)(a)," ").concat(t.badgeShadowColor),transition:"background ".concat(t.motionDurationMid),a:{color:t.badgeTextColor},"a:hover":{color:t.badgeTextColor},"a:hover &":{background:t.badgeColorHover}},["".concat(o,"-count-sm")]:{minWidth:w,height:w,fontSize:i,lineHeight:(0,u.bf)(w),borderRadius:S(w).div(2).equal()},["".concat(o,"-multiple-words")]:{padding:"0 ".concat((0,u.bf)(t.paddingXS)),bdi:{unicodeBidi:"plaintext"}},["".concat(o,"-dot")]:{zIndex:t.indicatorZIndex,width:s,minWidth:s,height:s,background:t.badgeColor,borderRadius:"100%",boxShadow:"0 0 0 ".concat((0,u.bf)(a)," ").concat(t.badgeShadowColor)},["".concat(o,"-dot").concat(C)]:{transition:"background ".concat(r)},["".concat(o,"-count, ").concat(o,"-dot, ").concat(C,"-custom-component")]:{position:"absolute",top:0,insetInlineEnd:0,transform:"translate(50%, -50%)",transformOrigin:"100% 0%",["&".concat(n,"-spin")]:{animationName:O,animationDuration:"1s",animationIterationCount:"infinite",animationTimingFunction:"linear"}},["&".concat(o,"-status")]:{lineHeight:"inherit",verticalAlign:"baseline",["".concat(o,"-status-dot")]:{position:"relative",top:-1,display:"inline-block",width:l,height:l,verticalAlign:"middle",borderRadius:"50%"},["".concat(o,"-status-success")]:{backgroundColor:t.colorSuccess},["".concat(o,"-status-processing")]:{overflow:"visible",color:t.colorPrimary,backgroundColor:t.colorPrimary,"&::after":{position:"absolute",top:0,insetInlineStart:0,width:"100%",height:"100%",borderWidth:a,borderStyle:"solid",borderColor:"inherit",borderRadius:"50%",animationName:p,animationDuration:t.badgeProcessingDuration,animationIterationCount:"infinite",animationTimingFunction:"ease-in-out",content:'""'}},["".concat(o,"-status-default")]:{backgroundColor:t.colorTextPlaceholder},["".concat(o,"-status-error")]:{backgroundColor:t.colorError},["".concat(o,"-status-warning")]:{backgroundColor:t.colorWarning},["".concat(o,"-status-text")]:{marginInlineStart:E,color:t.colorText,fontSize:t.fontSize}}}),N),{["".concat(o,"-zoom-appear, ").concat(o,"-zoom-enter")]:{animationName:f,animationDuration:t.motionDurationSlow,animationTimingFunction:t.motionEaseOutBack,animationFillMode:"both"},["".concat(o,"-zoom-leave")]:{animationName:v,animationDuration:t.motionDurationSlow,animationTimingFunction:t.motionEaseOutBack,animationFillMode:"both"},["&".concat(o,"-not-a-wrapper")]:{["".concat(o,"-zoom-appear, ").concat(o,"-zoom-enter")]:{animationName:h,animationDuration:t.motionDurationSlow,animationTimingFunction:t.motionEaseOutBack},["".concat(o,"-zoom-leave")]:{animationName:y,animationDuration:t.motionDurationSlow,animationTimingFunction:t.motionEaseOutBack},["&:not(".concat(o,"-status)")]:{verticalAlign:"middle"},["".concat(C,"-custom-component, ").concat(o,"-count")]:{transform:"none"},["".concat(C,"-custom-component, ").concat(C)]:{position:"relative",top:"auto",display:"block",transformOrigin:"50% 50%"}},["".concat(C)]:{overflow:"hidden",["".concat(C,"-only")]:{position:"relative",display:"inline-block",height:g,transition:"all ".concat(t.motionDurationSlow," ").concat(t.motionEaseOutBack),WebkitTransformStyle:"preserve-3d",WebkitBackfaceVisibility:"hidden",["> p".concat(C,"-only-unit")]:{height:g,margin:0,WebkitTransformStyle:"preserve-3d",WebkitBackfaceVisibility:"hidden"}},["".concat(C,"-symbol")]:{verticalAlign:"top"}},"&-rtl":{direction:"rtl",["".concat(o,"-count, ").concat(o,"-dot, ").concat(C,"-custom-component")]:{transform:"translate(-50%, -50%)"}}})}},E=t=>{let{fontHeight:o,lineWidth:n,marginXS:e,colorBorderBg:a}=t,r=t.colorBgContainer,c=t.colorError,i=t.colorErrorHover;return(0,b.TS)(t,{badgeFontHeight:o,badgeShadowSize:n,badgeTextColor:r,badgeColor:c,badgeColorHover:i,badgeShadowColor:a,badgeProcessingDuration:"1.2s",badgeRibbonOffset:e,badgeRibbonCornerTransform:"scaleY(0.75)",badgeRibbonCornerFilter:"brightness(75%)"})},S=t=>{let{fontSize:o,lineHeight:n,fontSizeSM:e,lineWidth:a}=t;return{indicatorZIndex:"auto",indicatorHeight:Math.round(o*n)-2*a,indicatorHeightSM:o,dotSize:e/2,textFontSize:e,textFontSizeSM:e,textFontWeight:"normal",statusSize:e/2}};var C=(0,g.I$)("Badge",t=>w(E(t)),S);let N=t=>{let{antCls:o,badgeFontHeight:n,marginXS:e,badgeRibbonOffset:a,calc:r}=t,c="".concat(o,"-ribbon"),i=(0,m.Z)(t,(t,o)=>{let{darkColor:n}=o;return{["&".concat(c,"-color-").concat(t)]:{background:n,color:n}}});return{["".concat("".concat(o,"-ribbon-wrapper"))]:{position:"relative"},["".concat(c)]:Object.assign(Object.assign(Object.assign(Object.assign({},(0,d.Wf)(t)),{position:"absolute",top:e,padding:"0 ".concat((0,u.bf)(t.paddingXS)),color:t.colorPrimary,lineHeight:(0,u.bf)(n),whiteSpace:"nowrap",backgroundColor:t.colorPrimary,borderRadius:t.borderRadiusSM,["".concat(c,"-text")]:{color:t.colorTextLightSolid},["".concat(c,"-corner")]:{position:"absolute",top:"100%",width:a,height:a,color:"currentcolor",border:"".concat((0,u.bf)(r(a).div(2).equal())," solid"),transform:t.badgeRibbonCornerTransform,transformOrigin:"top",filter:t.badgeRibbonCornerFilter}}),i),{["&".concat(c,"-placement-end")]:{insetInlineEnd:r(a).mul(-1).equal(),borderEndEndRadius:0,["".concat(c,"-corner")]:{insetInlineEnd:0,borderInlineEndColor:"transparent",borderBlockEndColor:"transparent"}},["&".concat(c,"-placement-start")]:{insetInlineStart:r(a).mul(-1).equal(),borderEndStartRadius:0,["".concat(c,"-corner")]:{insetInlineStart:0,borderBlockEndColor:"transparent",borderInlineStartColor:"transparent"}},"&-rtl":{direction:"rtl"}})}};var j=(0,g.I$)(["Badge","Ribbon"],t=>N(E(t)),S);function x(t){let o,{prefixCls:n,value:a,current:c,offset:i=0}=t;return i&&(o={position:"absolute",top:"".concat(i,"00%"),left:0}),e.createElement("span",{style:o,className:r()("".concat(n,"-only-unit"),{current:c})},a)}function k(t){let o,n;let{prefixCls:a,count:r,value:c}=t,i=Number(c),l=Math.abs(r),[s,u]=e.useState(i),[d,m]=e.useState(l),b=()=>{u(i),m(l)};if(e.useEffect(()=>{let t=setTimeout(()=>{b()},1e3);return()=>{clearTimeout(t)}},[i]),s===i||Number.isNaN(i)||Number.isNaN(s))o=[e.createElement(x,Object.assign({},t,{key:i,current:!0}))],n={transition:"none"};else{o=[];let a=i+10,r=[];for(let t=i;t<=a;t+=1)r.push(t);let c=r.findIndex(t=>t%10===s);o=r.map((o,n)=>e.createElement(x,Object.assign({},t,{key:o,value:o%10,offset:n-c,current:n===c}))),n={transform:"translateY(".concat(-function(t,o,n){let e=t,a=0;for(;(e+10)%10!==o;)e+=n,a+=n;return a}(s,i,do.indexOf(e)&&(n[e]=t[e]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,e=Object.getOwnPropertySymbols(t);ao.indexOf(e[a])&&Object.prototype.propertyIsEnumerable.call(t,e[a])&&(n[e[a]]=t[e[a]]);return n};let T=e.forwardRef((t,o)=>{let{prefixCls:n,count:a,className:c,motionClassName:i,style:u,title:d,show:m,component:b="sup",children:g}=t,p=I(t,["prefixCls","count","className","motionClassName","style","title","show","component","children"]),{getPrefixCls:f}=e.useContext(s.E_),v=f("scroll-number",n),h=Object.assign(Object.assign({},p),{"data-show":m,style:u,className:r()(v,c,i),title:d}),y=a;if(a&&Number(a)%1==0){let t=String(a).split("");y=e.createElement("bdi",null,t.map((o,n)=>e.createElement(k,{prefixCls:v,count:Number(a),value:o,key:t.length-n})))}return(u&&u.borderColor&&(h.style=Object.assign(Object.assign({},u),{boxShadow:"0 0 0 1px ".concat(u.borderColor," inset")})),g)?(0,l.Tm)(g,t=>({className:r()("".concat(v,"-custom-component"),null==t?void 0:t.className,i)})):e.createElement(b,Object.assign({},h,{ref:o}),y)});var z=function(t,o){var n={};for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&0>o.indexOf(e)&&(n[e]=t[e]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,e=Object.getOwnPropertySymbols(t);ao.indexOf(e[a])&&Object.prototype.propertyIsEnumerable.call(t,e[a])&&(n[e[a]]=t[e[a]]);return n};let R=e.forwardRef((t,o)=>{var n,a,u,d,m;let{prefixCls:b,scrollNumberPrefixCls:g,children:p,status:f,text:v,color:h,count:y=null,overflowCount:O=99,dot:w=!1,size:E="default",title:S,offset:N,style:j,className:x,rootClassName:k,classNames:I,styles:R,showZero:B=!1}=t,P=z(t,["prefixCls","scrollNumberPrefixCls","children","status","text","color","count","overflowCount","dot","size","title","offset","style","className","rootClassName","classNames","styles","showZero"]),{getPrefixCls:D,direction:W,badge:Z}=e.useContext(s.E_),F=D("badge",b),[M,H,_]=C(F),A=y>O?"".concat(O,"+"):y,q="0"===A||0===A,L=(null!=f||null!=h)&&(null===y||q&&!B),V=w&&!q,X=V?"":A,Y=(0,e.useMemo)(()=>(null==X||""===X||q&&!B)&&!V,[X,q,B,V]),$=(0,e.useRef)(y);Y||($.current=y);let G=$.current,J=(0,e.useRef)(X);Y||(J.current=X);let K=J.current,Q=(0,e.useRef)(V);Y||(Q.current=V);let U=(0,e.useMemo)(()=>{if(!N)return Object.assign(Object.assign({},null==Z?void 0:Z.style),j);let t={marginTop:N[1]};return"rtl"===W?t.left=parseInt(N[0],10):t.right=-parseInt(N[0],10),Object.assign(Object.assign(Object.assign({},t),null==Z?void 0:Z.style),j)},[W,N,j,null==Z?void 0:Z.style]),tt=null!=S?S:"string"==typeof G||"number"==typeof G?G:void 0,to=Y||!v?null:e.createElement("span",{className:"".concat(F,"-status-text")},v),tn=G&&"object"==typeof G?(0,l.Tm)(G,t=>({style:Object.assign(Object.assign({},U),t.style)})):void 0,te=(0,i.o2)(h,!1),ta=r()(null==I?void 0:I.indicator,null===(n=null==Z?void 0:Z.classNames)||void 0===n?void 0:n.indicator,{["".concat(F,"-status-dot")]:L,["".concat(F,"-status-").concat(f)]:!!f,["".concat(F,"-color-").concat(h)]:te}),tr={};h&&!te&&(tr.color=h,tr.background=h);let tc=r()(F,{["".concat(F,"-status")]:L,["".concat(F,"-not-a-wrapper")]:!p,["".concat(F,"-rtl")]:"rtl"===W},x,k,null==Z?void 0:Z.className,null===(a=null==Z?void 0:Z.classNames)||void 0===a?void 0:a.root,null==I?void 0:I.root,H,_);if(!p&&L){let t=U.color;return M(e.createElement("span",Object.assign({},P,{className:tc,style:Object.assign(Object.assign(Object.assign({},null==R?void 0:R.root),null===(u=null==Z?void 0:Z.styles)||void 0===u?void 0:u.root),U)}),e.createElement("span",{className:ta,style:Object.assign(Object.assign(Object.assign({},null==R?void 0:R.indicator),null===(d=null==Z?void 0:Z.styles)||void 0===d?void 0:d.indicator),tr)}),v&&e.createElement("span",{style:{color:t},className:"".concat(F,"-status-text")},v)))}return M(e.createElement("span",Object.assign({ref:o},P,{className:tc,style:Object.assign(Object.assign({},null===(m=null==Z?void 0:Z.styles)||void 0===m?void 0:m.root),null==R?void 0:R.root)}),p,e.createElement(c.ZP,{visible:!Y,motionName:"".concat(F,"-zoom"),motionAppear:!1,motionDeadline:1e3},t=>{var o,n;let{className:a,ref:c}=t,i=D("scroll-number",g),l=Q.current,s=r()(null==I?void 0:I.indicator,null===(o=null==Z?void 0:Z.classNames)||void 0===o?void 0:o.indicator,{["".concat(F,"-dot")]:l,["".concat(F,"-count")]:!l,["".concat(F,"-count-sm")]:"small"===E,["".concat(F,"-multiple-words")]:!l&&K&&K.toString().length>1,["".concat(F,"-status-").concat(f)]:!!f,["".concat(F,"-color-").concat(h)]:te}),u=Object.assign(Object.assign(Object.assign({},null==R?void 0:R.indicator),null===(n=null==Z?void 0:Z.styles)||void 0===n?void 0:n.indicator),U);return h&&!te&&((u=u||{}).background=h),e.createElement(T,{prefixCls:i,show:!Y,motionClassName:a,className:s,count:K,title:tt,style:u,key:"scrollNumber",ref:c},tn)}),to))});R.Ribbon=t=>{let{className:o,prefixCls:n,style:a,color:c,children:l,text:u,placement:d="end",rootClassName:m}=t,{getPrefixCls:b,direction:g}=e.useContext(s.E_),p=b("ribbon",n),f="".concat(p,"-wrapper"),[v,h,y]=j(p,f),O=(0,i.o2)(c,!1),w=r()(p,"".concat(p,"-placement-").concat(d),{["".concat(p,"-rtl")]:"rtl"===g,["".concat(p,"-color-").concat(c)]:O},o),E={},S={};return c&&!O&&(E.background=c,S.color=c),v(e.createElement("div",{className:r()(f,m,h,y)},l,e.createElement("div",{className:r()(w,h),style:Object.assign(Object.assign({},E),a)},e.createElement("span",{className:"".concat(p,"-text")},u),e.createElement("div",{className:"".concat(p,"-corner"),style:S}))))};var B=R}}]);
\ No newline at end of file
diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/5594-2152049a23d41bda.js b/litellm/proxy/_experimental/out/_next/static/chunks/5594-2152049a23d41bda.js
new file mode 100644
index 00000000000..91234468f31
--- /dev/null
+++ b/litellm/proxy/_experimental/out/_next/static/chunks/5594-2152049a23d41bda.js
@@ -0,0 +1 @@
+"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5594],{89245:function(e,t,r){r.d(t,{Z:function(){return i}});var n=r(1119),a=r(2265),o={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"},l=r(55015),i=a.forwardRef(function(e,t){return a.createElement(l.Z,(0,n.Z)({},e,{ref:t,icon:o}))})},69993:function(e,t,r){r.d(t,{Z:function(){return i}});var n=r(1119),a=r(2265),o={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"},l=r(55015),i=a.forwardRef(function(e,t){return a.createElement(l.Z,(0,n.Z)({},e,{ref:t,icon:o}))})},78355:function(e,t,r){r.d(t,{Z:function(){return i}});var n=r(1119),a=r(2265),o={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"},l=r(55015),i=a.forwardRef(function(e,t){return a.createElement(l.Z,(0,n.Z)({},e,{ref:t,icon:o}))})},41649:function(e,t,r){r.d(t,{Z:function(){return f}});var n=r(5853),a=r(2265),o=r(1526),l=r(7084),i=r(26898),d=r(97324),c=r(1153);let s={xs:{paddingX:"px-2",paddingY:"py-0.5",fontSize:"text-xs"},sm:{paddingX:"px-2.5",paddingY:"py-0.5",fontSize:"text-sm"},md:{paddingX:"px-3",paddingY:"py-0.5",fontSize:"text-md"},lg:{paddingX:"px-3.5",paddingY:"py-0.5",fontSize:"text-lg"},xl:{paddingX:"px-4",paddingY:"py-1",fontSize:"text-xl"}},u={xs:{height:"h-4",width:"w-4"},sm:{height:"h-4",width:"w-4"},md:{height:"h-4",width:"w-4"},lg:{height:"h-5",width:"w-5"},xl:{height:"h-6",width:"w-6"}},m=(0,c.fn)("Badge"),f=a.forwardRef((e,t)=>{let{color:r,icon:f,size:p=l.u8.SM,tooltip:b,className:g,children:h}=e,x=(0,n._T)(e,["color","icon","size","tooltip","className","children"]),w=f||null,{tooltipProps:v,getReferenceProps:k}=(0,o.l)();return a.createElement("span",Object.assign({ref:(0,c.lq)([t,v.refs.setReference]),className:(0,d.q)(m("root"),"w-max flex-shrink-0 inline-flex justify-center items-center cursor-default rounded-tremor-full",r?(0,d.q)((0,c.bM)(r,i.K.background).bgColor,(0,c.bM)(r,i.K.text).textColor,"bg-opacity-20 dark:bg-opacity-25"):(0,d.q)("bg-tremor-brand-muted text-tremor-brand-emphasis","dark:bg-dark-tremor-brand-muted dark:text-dark-tremor-brand-emphasis"),s[p].paddingX,s[p].paddingY,s[p].fontSize,g)},k,x),a.createElement(o.Z,Object.assign({text:b},v)),w?a.createElement(w,{className:(0,d.q)(m("icon"),"shrink-0 -ml-1 mr-1.5",u[p].height,u[p].width)}):null,a.createElement("p",{className:(0,d.q)(m("text"),"text-sm whitespace-nowrap")},h))});f.displayName="Badge"},47323:function(e,t,r){r.d(t,{Z:function(){return b}});var n=r(5853),a=r(2265),o=r(1526),l=r(7084),i=r(97324),d=r(1153),c=r(26898);let s={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"}},u={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:""}},f=(e,t)=>{switch(e){case"simple":return{textColor:t?(0,d.bM)(t,c.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:"",borderColor:"",ringColor:""};case"light":return{textColor:t?(0,d.bM)(t,c.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:t?(0,i.q)((0,d.bM)(t,c.K.background).bgColor,"bg-opacity-20"):"bg-tremor-brand-muted dark:bg-dark-tremor-brand-muted",borderColor:"",ringColor:""};case"shadow":return{textColor:t?(0,d.bM)(t,c.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:t?(0,i.q)((0,d.bM)(t,c.K.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,d.bM)(t,c.K.text).textColor:"text-tremor-brand-inverted dark:text-dark-tremor-brand-inverted",bgColor:t?(0,i.q)((0,d.bM)(t,c.K.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,d.bM)(t,c.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:t?(0,i.q)((0,d.bM)(t,c.K.background).bgColor,"bg-opacity-20"):"bg-tremor-background dark:bg-dark-tremor-background",borderColor:t?(0,d.bM)(t,c.K.ring).borderColor:"border-tremor-brand-subtle dark:border-dark-tremor-brand-subtle",ringColor:t?(0,i.q)((0,d.bM)(t,c.K.ring).ringColor,"ring-opacity-40"):"ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted"}}},p=(0,d.fn)("Icon"),b=a.forwardRef((e,t)=>{let{icon:r,variant:c="simple",tooltip:b,size:g=l.u8.SM,color:h,className:x}=e,w=(0,n._T)(e,["icon","variant","tooltip","size","color","className"]),v=f(c,h),{tooltipProps:k,getReferenceProps:y}=(0,o.l)();return a.createElement("span",Object.assign({ref:(0,d.lq)([t,k.refs.setReference]),className:(0,i.q)(p("root"),"inline-flex flex-shrink-0 items-center",v.bgColor,v.textColor,v.borderColor,v.ringColor,m[c].rounded,m[c].border,m[c].shadow,m[c].ring,s[g].paddingX,s[g].paddingY,x)},y,w),a.createElement(o.Z,Object.assign({text:b},k)),a.createElement(r,{className:(0,i.q)(p("icon"),"shrink-0",u[g].height,u[g].width)}))});b.displayName="Icon"},30150:function(e,t,r){r.d(t,{Z:function(){return m}});var n=r(5853),a=r(2265);let o=e=>{var t=(0,n._T)(e,[]);return a.createElement("svg",Object.assign({},t,{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2.5"}),a.createElement("path",{d:"M12 4v16m8-8H4"}))},l=e=>{var t=(0,n._T)(e,[]);return a.createElement("svg",Object.assign({},t,{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2.5"}),a.createElement("path",{d:"M20 12H4"}))};var i=r(97324),d=r(1153),c=r(69262);let s="flex mx-auto text-tremor-content-subtle dark:text-dark-tremor-content-subtle",u="cursor-pointer hover:text-tremor-content dark:hover:text-dark-tremor-content",m=a.forwardRef((e,t)=>{let{onSubmit:r,enableStepper:m=!0,disabled:f,onValueChange:p,onChange:b}=e,g=(0,n._T)(e,["onSubmit","enableStepper","disabled","onValueChange","onChange"]),h=(0,a.useRef)(null),[x,w]=a.useState(!1),v=a.useCallback(()=>{w(!0)},[]),k=a.useCallback(()=>{w(!1)},[]),[y,C]=a.useState(!1),E=a.useCallback(()=>{C(!0)},[]),N=a.useCallback(()=>{C(!1)},[]);return a.createElement(c.Z,Object.assign({type:"number",ref:(0,d.lq)([h,t]),disabled:f,makeInputClassName:(0,d.fn)("NumberInput"),onKeyDown:e=>{var t;if("Enter"===e.key&&!e.ctrlKey&&!e.altKey&&!e.shiftKey){let e=null===(t=h.current)||void 0===t?void 0:t.value;null==r||r(parseFloat(null!=e?e:""))}"ArrowDown"===e.key&&v(),"ArrowUp"===e.key&&E()},onKeyUp:e=>{"ArrowDown"===e.key&&k(),"ArrowUp"===e.key&&N()},onChange:e=>{f||(null==p||p(parseFloat(e.target.value)),null==b||b(e))},stepper:m?a.createElement("div",{className:(0,i.q)("flex justify-center align-middle")},a.createElement("div",{tabIndex:-1,onClick:e=>e.preventDefault(),onMouseDown:e=>e.preventDefault(),onTouchStart:e=>{e.cancelable&&e.preventDefault()},onMouseUp:()=>{var e,t;f||(null===(e=h.current)||void 0===e||e.stepDown(),null===(t=h.current)||void 0===t||t.dispatchEvent(new Event("input",{bubbles:!0})))},className:(0,i.q)(!f&&u,s,"group py-[10px] px-2.5 border-l border-tremor-border dark:border-dark-tremor-border")},a.createElement(l,{"data-testid":"step-down",className:(x?"scale-95":"")+" h-4 w-4 duration-75 transition group-active:scale-95"})),a.createElement("div",{tabIndex:-1,onClick:e=>e.preventDefault(),onMouseDown:e=>e.preventDefault(),onTouchStart:e=>{e.cancelable&&e.preventDefault()},onMouseUp:()=>{var e,t;f||(null===(e=h.current)||void 0===e||e.stepUp(),null===(t=h.current)||void 0===t||t.dispatchEvent(new Event("input",{bubbles:!0})))},className:(0,i.q)(!f&&u,s,"group py-[10px] px-2.5 border-l border-tremor-border dark:border-dark-tremor-border")},a.createElement(o,{"data-testid":"step-up",className:(y?"scale-95":"")+" h-4 w-4 duration-75 transition group-active:scale-95"}))):null},g))});m.displayName="NumberInput"},87452:function(e,t,r){r.d(t,{Z:function(){return u},r:function(){return s}});var n=r(5853),a=r(21886);r(42698),r(64016);var o=r(8710);r(33232);var l=r(97324),i=r(1153),d=r(2265);let c=(0,i.fn)("Accordion"),s=(0,d.createContext)({isOpen:!1}),u=d.forwardRef((e,t)=>{var r;let{defaultOpen:i=!1,children:u,className:m}=e,f=(0,n._T)(e,["defaultOpen","children","className"]),p=null!==(r=(0,d.useContext)(o.Z))&&void 0!==r?r:(0,l.q)("rounded-tremor-default border");return d.createElement(a.p,Object.assign({as:"div",ref:t,className:(0,l.q)(c("root"),"overflow-hidden","bg-tremor-background border-tremor-border","dark:bg-dark-tremor-background dark:border-dark-tremor-border",p,m),defaultOpen:i},f),e=>{let{open:t}=e;return d.createElement(s.Provider,{value:{isOpen:t}},u)})});u.displayName="Accordion"},88829:function(e,t,r){r.d(t,{Z:function(){return d}});var n=r(5853),a=r(2265),o=r(21886),l=r(97324);let i=(0,r(1153).fn)("AccordionBody"),d=a.forwardRef((e,t)=>{let{children:r,className:d}=e,c=(0,n._T)(e,["children","className"]);return a.createElement(o.p.Panel,Object.assign({ref:t,className:(0,l.q)(i("root"),"w-full text-tremor-default px-4 pb-3","text-tremor-content","dark:text-dark-tremor-content",d)},c),r)});d.displayName="AccordionBody"},72208:function(e,t,r){r.d(t,{Z:function(){return s}});var n=r(5853),a=r(2265),o=r(21886);let l=e=>{var t=(0,n._T)(e,[]);return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),a.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 i=r(87452),d=r(97324);let c=(0,r(1153).fn)("AccordionHeader"),s=a.forwardRef((e,t)=>{let{children:r,className:s}=e,u=(0,n._T)(e,["children","className"]),{isOpen:m}=(0,a.useContext)(i.r);return a.createElement(o.p.Button,Object.assign({ref:t,className:(0,d.q)(c("root"),"w-full flex items-center justify-between px-4 py-3","text-tremor-content-emphasis","dark:text-dark-tremor-content-emphasis",s)},u),a.createElement("div",{className:(0,d.q)(c("children"),"flex flex-1 text-inherit mr-4")},r),a.createElement("div",null,a.createElement(l,{className:(0,d.q)(c("arrowIcon"),"h-5 w-5 -mr-1","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle",m?"transition-all":"transition-all -rotate-180")})))});s.displayName="AccordionHeader"},67982:function(e,t,r){r.d(t,{Z:function(){return d}});var n=r(5853),a=r(97324),o=r(1153),l=r(2265);let i=(0,o.fn)("Divider"),d=l.forwardRef((e,t)=>{let{className:r,children:o}=e,d=(0,n._T)(e,["className","children"]);return l.createElement("div",Object.assign({ref:t,className:(0,a.q)(i("root"),"w-full mx-auto my-6 flex justify-between gap-3 items-center text-tremor-default","text-tremor-content","dark:text-dark-tremor-content",r)},d),o?l.createElement(l.Fragment,null,l.createElement("div",{className:(0,a.q)("w-full h-[1px] bg-tremor-border dark:bg-dark-tremor-border")}),l.createElement("div",{className:(0,a.q)("text-inherit whitespace-nowrap")},o),l.createElement("div",{className:(0,a.q)("w-full h-[1px] bg-tremor-border dark:bg-dark-tremor-border")})):l.createElement("div",{className:(0,a.q)("w-full h-[1px] bg-tremor-border dark:bg-dark-tremor-border")}))});d.displayName="Divider"},21626:function(e,t,r){r.d(t,{Z:function(){return i}});var n=r(5853),a=r(2265),o=r(97324);let l=(0,r(1153).fn)("Table"),i=a.forwardRef((e,t)=>{let{children:r,className:i}=e,d=(0,n._T)(e,["children","className"]);return a.createElement("div",{className:(0,o.q)(l("root"),"overflow-auto",i)},a.createElement("table",Object.assign({ref:t,className:(0,o.q)(l("table"),"w-full text-tremor-default","text-tremor-content","dark:text-dark-tremor-content")},d),r))});i.displayName="Table"},97214:function(e,t,r){r.d(t,{Z:function(){return i}});var n=r(5853),a=r(2265),o=r(97324);let l=(0,r(1153).fn)("TableBody"),i=a.forwardRef((e,t)=>{let{children:r,className:i}=e,d=(0,n._T)(e,["children","className"]);return a.createElement(a.Fragment,null,a.createElement("tbody",Object.assign({ref:t,className:(0,o.q)(l("root"),"align-top divide-y","divide-tremor-border","dark:divide-dark-tremor-border",i)},d),r))});i.displayName="TableBody"},28241:function(e,t,r){r.d(t,{Z:function(){return i}});var n=r(5853),a=r(2265),o=r(97324);let l=(0,r(1153).fn)("TableCell"),i=a.forwardRef((e,t)=>{let{children:r,className:i}=e,d=(0,n._T)(e,["children","className"]);return a.createElement(a.Fragment,null,a.createElement("td",Object.assign({ref:t,className:(0,o.q)(l("root"),"align-middle whitespace-nowrap text-left p-4",i)},d),r))});i.displayName="TableCell"},58834:function(e,t,r){r.d(t,{Z:function(){return i}});var n=r(5853),a=r(2265),o=r(97324);let l=(0,r(1153).fn)("TableHead"),i=a.forwardRef((e,t)=>{let{children:r,className:i}=e,d=(0,n._T)(e,["children","className"]);return a.createElement(a.Fragment,null,a.createElement("thead",Object.assign({ref:t,className:(0,o.q)(l("root"),"text-left","text-tremor-content","dark:text-dark-tremor-content",i)},d),r))});i.displayName="TableHead"},69552:function(e,t,r){r.d(t,{Z:function(){return i}});var n=r(5853),a=r(2265),o=r(97324);let l=(0,r(1153).fn)("TableHeaderCell"),i=a.forwardRef((e,t)=>{let{children:r,className:i}=e,d=(0,n._T)(e,["children","className"]);return a.createElement(a.Fragment,null,a.createElement("th",Object.assign({ref:t,className:(0,o.q)(l("root"),"whitespace-nowrap text-left font-semibold top-0 px-4 py-3.5","text-tremor-content","dark:text-dark-tremor-content",i)},d),r))});i.displayName="TableHeaderCell"},71876:function(e,t,r){r.d(t,{Z:function(){return i}});var n=r(5853),a=r(2265),o=r(97324);let l=(0,r(1153).fn)("TableRow"),i=a.forwardRef((e,t)=>{let{children:r,className:i}=e,d=(0,n._T)(e,["children","className"]);return a.createElement(a.Fragment,null,a.createElement("tr",Object.assign({ref:t,className:(0,o.q)(l("row"),i)},d),r))});i.displayName="TableRow"},96761:function(e,t,r){r.d(t,{Z:function(){return d}});var n=r(5853),a=r(26898),o=r(97324),l=r(1153),i=r(2265);let d=i.forwardRef((e,t)=>{let{color:r,children:d,className:c}=e,s=(0,n._T)(e,["color","children","className"]);return i.createElement("p",Object.assign({ref:t,className:(0,o.q)("font-medium text-tremor-title",r?(0,l.bM)(r,a.K.darkText).textColor:"text-tremor-content-emphasis dark:text-dark-tremor-content-emphasis",c)},s),d)});d.displayName="Title"},23496:function(e,t,r){r.d(t,{Z:function(){return p}});var n=r(2265),a=r(36760),o=r.n(a),l=r(71744),i=r(352),d=r(12918),c=r(80669),s=r(3104);let u=e=>{let{componentCls:t,sizePaddingEdgeHorizontal:r,colorSplit:n,lineWidth:a,textPaddingInline:o,orientationMargin:l,verticalMarginInline:c}=e;return{[t]:Object.assign(Object.assign({},(0,d.Wf)(e)),{borderBlockStart:"".concat((0,i.bf)(a)," solid ").concat(n),"&-vertical":{position:"relative",top:"-0.06em",display:"inline-block",height:"0.9em",marginInline:c,marginBlock:0,verticalAlign:"middle",borderTop:0,borderInlineStart:"".concat((0,i.bf)(a)," solid ").concat(n)},"&-horizontal":{display:"flex",clear:"both",width:"100%",minWidth:"100%",margin:"".concat((0,i.bf)(e.dividerHorizontalGutterMargin)," 0")},["&-horizontal".concat(t,"-with-text")]:{display:"flex",alignItems:"center",margin:"".concat((0,i.bf)(e.dividerHorizontalWithTextGutterMargin)," 0"),color:e.colorTextHeading,fontWeight:500,fontSize:e.fontSizeLG,whiteSpace:"nowrap",textAlign:"center",borderBlockStart:"0 ".concat(n),"&::before, &::after":{position:"relative",width:"50%",borderBlockStart:"".concat((0,i.bf)(a)," solid transparent"),borderBlockStartColor:"inherit",borderBlockEnd:0,transform:"translateY(50%)",content:"''"}},["&-horizontal".concat(t,"-with-text-left")]:{"&::before":{width:"calc(".concat(l," * 100%)")},"&::after":{width:"calc(100% - ".concat(l," * 100%)")}},["&-horizontal".concat(t,"-with-text-right")]:{"&::before":{width:"calc(100% - ".concat(l," * 100%)")},"&::after":{width:"calc(".concat(l," * 100%)")}},["".concat(t,"-inner-text")]:{display:"inline-block",paddingBlock:0,paddingInline:o},"&-dashed":{background:"none",borderColor:n,borderStyle:"dashed",borderWidth:"".concat((0,i.bf)(a)," 0 0")},["&-horizontal".concat(t,"-with-text").concat(t,"-dashed")]:{"&::before, &::after":{borderStyle:"dashed none none"}},["&-vertical".concat(t,"-dashed")]:{borderInlineStartWidth:a,borderInlineEnd:0,borderBlockStart:0,borderBlockEnd:0},["&-plain".concat(t,"-with-text")]:{color:e.colorText,fontWeight:"normal",fontSize:e.fontSize},["&-horizontal".concat(t,"-with-text-left").concat(t,"-no-default-orientation-margin-left")]:{"&::before":{width:0},"&::after":{width:"100%"},["".concat(t,"-inner-text")]:{paddingInlineStart:r}},["&-horizontal".concat(t,"-with-text-right").concat(t,"-no-default-orientation-margin-right")]:{"&::before":{width:"100%"},"&::after":{width:0},["".concat(t,"-inner-text")]:{paddingInlineEnd:r}}})}};var m=(0,c.I$)("Divider",e=>[u((0,s.TS)(e,{dividerHorizontalWithTextGutterMargin:e.margin,dividerHorizontalGutterMargin:e.marginLG,sizePaddingEdgeHorizontal:0}))],e=>({textPaddingInline:"1em",orientationMargin:.05,verticalMarginInline:e.marginXS}),{unitless:{orientationMargin:!0}}),f=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 a=0,n=Object.getOwnPropertySymbols(e);at.indexOf(n[a])&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]]);return r},p=e=>{let{getPrefixCls:t,direction:r,divider:a}=n.useContext(l.E_),{prefixCls:i,type:d="horizontal",orientation:c="center",orientationMargin:s,className:u,rootClassName:p,children:b,dashed:g,plain:h,style:x}=e,w=f(e,["prefixCls","type","orientation","orientationMargin","className","rootClassName","children","dashed","plain","style"]),v=t("divider",i),[k,y,C]=m(v),E=c.length>0?"-".concat(c):c,N=!!b,M="left"===c&&null!=s,S="right"===c&&null!=s,T=o()(v,null==a?void 0:a.className,y,C,"".concat(v,"-").concat(d),{["".concat(v,"-with-text")]:N,["".concat(v,"-with-text").concat(E)]:N,["".concat(v,"-dashed")]:!!g,["".concat(v,"-plain")]:!!h,["".concat(v,"-rtl")]:"rtl"===r,["".concat(v,"-no-default-orientation-margin-left")]:M,["".concat(v,"-no-default-orientation-margin-right")]:S},u,p),O=n.useMemo(()=>"number"==typeof s?s:/^\d+$/.test(s)?Number(s):s,[s]),z=Object.assign(Object.assign({},M&&{marginLeft:O}),S&&{marginRight:O});return k(n.createElement("div",Object.assign({className:T,style:Object.assign(Object.assign({},null==a?void 0:a.style),x)},w,{role:"separator"}),b&&"vertical"!==d&&n.createElement("span",{className:"".concat(v,"-inner-text"),style:z},b)))}},79205:function(e,t,r){r.d(t,{Z:function(){return u}});var n=r(2265);let a=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),o=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,r)=>r?r.toUpperCase():t.toLowerCase()),l=e=>{let t=o(e);return t.charAt(0).toUpperCase()+t.slice(1)},i=function(){for(var e=arguments.length,t=Array(e),r=0;r!!e&&""!==e.trim()&&r.indexOf(e)===t).join(" ").trim()},d=e=>{for(let t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0};var c={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let s=(0,n.forwardRef)((e,t)=>{let{color:r="currentColor",size:a=24,strokeWidth:o=2,absoluteStrokeWidth:l,className:s="",children:u,iconNode:m,...f}=e;return(0,n.createElement)("svg",{ref:t,...c,width:a,height:a,stroke:r,strokeWidth:l?24*Number(o)/Number(a):o,className:i("lucide",s),...!u&&!d(f)&&{"aria-hidden":"true"},...f},[...m.map(e=>{let[t,r]=e;return(0,n.createElement)(t,r)}),...Array.isArray(u)?u:[u]])}),u=(e,t)=>{let r=(0,n.forwardRef)((r,o)=>{let{className:d,...c}=r;return(0,n.createElement)(s,{ref:o,iconNode:t,className:i("lucide-".concat(a(l(e))),"lucide-".concat(e),d),...c})});return r.displayName=l(e),r}},30401:function(e,t,r){r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]])},78867:function(e,t,r){r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]])},88906:function(e,t,r){r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("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"}]])},76865:function(e,t,r){r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]])},92369:function(e,t,r){r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("user",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]])},21886:function(e,t,r){let n,a;r.d(t,{p:function(){return T}});var o,l=r(2265),i=r(13323),d=r(17684),c=r(80004),s=r(93689),u=r(37863),m=r(47634),f=r(24536),p=r(40293),b=r(27847);let g=null!=(o=l.startTransition)?o:function(e){e()};var h=r(37388),x=((n=x||{})[n.Open=0]="Open",n[n.Closed=1]="Closed",n),w=((a=w||{})[a.ToggleDisclosure=0]="ToggleDisclosure",a[a.CloseDisclosure=1]="CloseDisclosure",a[a.SetButtonId=2]="SetButtonId",a[a.SetPanelId=3]="SetPanelId",a[a.LinkPanel=4]="LinkPanel",a[a.UnlinkPanel=5]="UnlinkPanel",a);let v={0:e=>({...e,disclosureState:(0,f.E)(e.disclosureState,{0:1,1:0})}),1:e=>1===e.disclosureState?e:{...e,disclosureState:1},4:e=>!0===e.linkedPanel?e:{...e,linkedPanel:!0},5:e=>!1===e.linkedPanel?e:{...e,linkedPanel:!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}},k=(0,l.createContext)(null);function y(e){let t=(0,l.useContext)(k);if(null===t){let t=Error("<".concat(e," /> is missing a parent component."));throw Error.captureStackTrace&&Error.captureStackTrace(t,y),t}return t}k.displayName="DisclosureContext";let C=(0,l.createContext)(null);C.displayName="DisclosureAPIContext";let E=(0,l.createContext)(null);function N(e,t){return(0,f.E)(t.type,v,e,t)}E.displayName="DisclosurePanelContext";let M=l.Fragment,S=b.AN.RenderStrategy|b.AN.Static,T=Object.assign((0,b.yV)(function(e,t){let{defaultOpen:r=!1,...n}=e,a=(0,l.useRef)(null),o=(0,s.T)(t,(0,s.h)(e=>{a.current=e},void 0===e.as||e.as===l.Fragment)),d=(0,l.useRef)(null),c=(0,l.useRef)(null),m=(0,l.useReducer)(N,{disclosureState:r?0:1,linkedPanel:!1,buttonRef:c,panelRef:d,buttonId:null,panelId:null}),[{disclosureState:g,buttonId:h},x]=m,w=(0,i.z)(e=>{x({type:1});let t=(0,p.r)(a);if(!t||!h)return;let r=e?e instanceof HTMLElement?e:e.current instanceof HTMLElement?e.current:t.getElementById(h):t.getElementById(h);null==r||r.focus()}),v=(0,l.useMemo)(()=>({close:w}),[w]),y=(0,l.useMemo)(()=>({open:0===g,close:w}),[g,w]);return l.createElement(k.Provider,{value:m},l.createElement(C.Provider,{value:v},l.createElement(u.up,{value:(0,f.E)(g,{0:u.ZM.Open,1:u.ZM.Closed})},(0,b.sY)({ourProps:{ref:o},theirProps:n,slot:y,defaultTag:M,name:"Disclosure"}))))}),{Button:(0,b.yV)(function(e,t){let r=(0,d.M)(),{id:n="headlessui-disclosure-button-".concat(r),...a}=e,[o,u]=y("Disclosure.Button"),f=(0,l.useContext)(E),p=null!==f&&f===o.panelId,g=(0,l.useRef)(null),x=(0,s.T)(g,t,p?null:o.buttonRef),w=(0,b.Y2)();(0,l.useEffect)(()=>{if(!p)return u({type:2,buttonId:n}),()=>{u({type:2,buttonId:null})}},[n,u,p]);let v=(0,i.z)(e=>{var t;if(p){if(1===o.disclosureState)return;switch(e.key){case h.R.Space:case h.R.Enter:e.preventDefault(),e.stopPropagation(),u({type:0}),null==(t=o.buttonRef.current)||t.focus()}}else switch(e.key){case h.R.Space:case h.R.Enter:e.preventDefault(),e.stopPropagation(),u({type:0})}}),k=(0,i.z)(e=>{e.key===h.R.Space&&e.preventDefault()}),C=(0,i.z)(t=>{var r;(0,m.P)(t.currentTarget)||e.disabled||(p?(u({type:0}),null==(r=o.buttonRef.current)||r.focus()):u({type:0}))}),N=(0,l.useMemo)(()=>({open:0===o.disclosureState}),[o]),M=(0,c.f)(e,g),S=p?{ref:x,type:M,onKeyDown:v,onClick:C}:{ref:x,id:n,type:M,"aria-expanded":0===o.disclosureState,"aria-controls":o.linkedPanel?o.panelId:void 0,onKeyDown:v,onKeyUp:k,onClick:C};return(0,b.sY)({mergeRefs:w,ourProps:S,theirProps:a,slot:N,defaultTag:"button",name:"Disclosure.Button"})}),Panel:(0,b.yV)(function(e,t){let r=(0,d.M)(),{id:n="headlessui-disclosure-panel-".concat(r),...a}=e,[o,i]=y("Disclosure.Panel"),{close:c}=function e(t){let r=(0,l.useContext)(C);if(null===r){let r=Error("<".concat(t," /> is missing a parent component."));throw Error.captureStackTrace&&Error.captureStackTrace(r,e),r}return r}("Disclosure.Panel"),m=(0,b.Y2)(),f=(0,s.T)(t,o.panelRef,e=>{g(()=>i({type:e?4:5}))});(0,l.useEffect)(()=>(i({type:3,panelId:n}),()=>{i({type:3,panelId:null})}),[n,i]);let p=(0,u.oJ)(),h=null!==p?(p&u.ZM.Open)===u.ZM.Open:0===o.disclosureState,x=(0,l.useMemo)(()=>({open:0===o.disclosureState,close:c}),[o,c]);return l.createElement(E.Provider,{value:o.panelId},(0,b.sY)({mergeRefs:m,ourProps:{ref:f,id:n},theirProps:a,slot:x,defaultTag:"div",features:S,visible:h,name:"Disclosure.Panel"}))})})},86462:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.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),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"}))});t.Z=a},53410:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.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),n.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"}))});t.Z=a},23628:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.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),n.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"}))});t.Z=a}}]);
\ No newline at end of file
diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/5809-d60bc4c289559705.js b/litellm/proxy/_experimental/out/_next/static/chunks/5809-9e86f5b4f99e8e66.js
similarity index 100%
rename from litellm/proxy/_experimental/out/_next/static/chunks/5809-d60bc4c289559705.js
rename to litellm/proxy/_experimental/out/_next/static/chunks/5809-9e86f5b4f99e8e66.js
diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/5830-47ce1a4897188f14.js b/litellm/proxy/_experimental/out/_next/static/chunks/5830-47ce1a4897188f14.js
deleted file mode 100644
index 3dbc686a04f..00000000000
--- a/litellm/proxy/_experimental/out/_next/static/chunks/5830-47ce1a4897188f14.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5830],{10798:function(e,r,t){t.d(r,{Z:function(){return i}});var n=t(1119),o=t(2265),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M880.1 154H143.9c-24.5 0-39.8 26.7-27.5 48L349 597.4V838c0 17.7 14.2 32 31.8 32h262.4c17.6 0 31.8-14.3 31.8-32V597.4L907.7 202c12.2-21.3-3.1-48-27.6-48zM603.4 798H420.6V642h182.9v156zm9.6-236.6l-9.5 16.6h-183l-9.5-16.6L212.7 226h598.6L613 561.4z"}}]},name:"filter",theme:"outlined"},l=t(55015),i=o.forwardRef(function(e,r){return o.createElement(l.Z,(0,n.Z)({},e,{ref:r,icon:a}))})},8881:function(e,r,t){t.d(r,{Z:function(){return i}});var n=t(1119),o=t(2265),a={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-372 0-89 31.3-170.8 83.5-234.8l523.3 523.3C682.8 852.7 601 884 512 884zm288.5-137.2L277.2 223.5C341.2 171.3 423 140 512 140c205.4 0 372 166.6 372 372 0 89-31.3 170.8-83.5 234.8z"}}]},name:"stop",theme:"outlined"},l=t(55015),i=o.forwardRef(function(e,r){return o.createElement(l.Z,(0,n.Z)({},e,{ref:r,icon:a}))})},41649:function(e,r,t){t.d(r,{Z:function(){return u}});var n=t(5853),o=t(2265),a=t(1526),l=t(7084),i=t(26898),d=t(97324),c=t(1153);let s={xs:{paddingX:"px-2",paddingY:"py-0.5",fontSize:"text-xs"},sm:{paddingX:"px-2.5",paddingY:"py-0.5",fontSize:"text-sm"},md:{paddingX:"px-3",paddingY:"py-0.5",fontSize:"text-md"},lg:{paddingX:"px-3.5",paddingY:"py-0.5",fontSize:"text-lg"},xl:{paddingX:"px-4",paddingY:"py-1",fontSize:"text-xl"}},g={xs:{height:"h-4",width:"w-4"},sm:{height:"h-4",width:"w-4"},md:{height:"h-4",width:"w-4"},lg:{height:"h-5",width:"w-5"},xl:{height:"h-6",width:"w-6"}},m=(0,c.fn)("Badge"),u=o.forwardRef((e,r)=>{let{color:t,icon:u,size:p=l.u8.SM,tooltip:b,className:h,children:f}=e,w=(0,n._T)(e,["color","icon","size","tooltip","className","children"]),x=u||null,{tooltipProps:k,getReferenceProps:v}=(0,a.l)();return o.createElement("span",Object.assign({ref:(0,c.lq)([r,k.refs.setReference]),className:(0,d.q)(m("root"),"w-max flex-shrink-0 inline-flex justify-center items-center cursor-default rounded-tremor-full",t?(0,d.q)((0,c.bM)(t,i.K.background).bgColor,(0,c.bM)(t,i.K.text).textColor,"bg-opacity-20 dark:bg-opacity-25"):(0,d.q)("bg-tremor-brand-muted text-tremor-brand-emphasis","dark:bg-dark-tremor-brand-muted dark:text-dark-tremor-brand-emphasis"),s[p].paddingX,s[p].paddingY,s[p].fontSize,h)},v,w),o.createElement(a.Z,Object.assign({text:b},k)),x?o.createElement(x,{className:(0,d.q)(m("icon"),"shrink-0 -ml-1 mr-1.5",g[p].height,g[p].width)}):null,o.createElement("p",{className:(0,d.q)(m("text"),"text-sm whitespace-nowrap")},f))});u.displayName="Badge"},47323:function(e,r,t){t.d(r,{Z:function(){return b}});var n=t(5853),o=t(2265),a=t(1526),l=t(7084),i=t(97324),d=t(1153),c=t(26898);let s={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"}},g={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:""}},u=(e,r)=>{switch(e){case"simple":return{textColor:r?(0,d.bM)(r,c.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:"",borderColor:"",ringColor:""};case"light":return{textColor:r?(0,d.bM)(r,c.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:r?(0,i.q)((0,d.bM)(r,c.K.background).bgColor,"bg-opacity-20"):"bg-tremor-brand-muted dark:bg-dark-tremor-brand-muted",borderColor:"",ringColor:""};case"shadow":return{textColor:r?(0,d.bM)(r,c.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:r?(0,i.q)((0,d.bM)(r,c.K.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:r?(0,d.bM)(r,c.K.text).textColor:"text-tremor-brand-inverted dark:text-dark-tremor-brand-inverted",bgColor:r?(0,i.q)((0,d.bM)(r,c.K.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:r?(0,d.bM)(r,c.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:r?(0,i.q)((0,d.bM)(r,c.K.background).bgColor,"bg-opacity-20"):"bg-tremor-background dark:bg-dark-tremor-background",borderColor:r?(0,d.bM)(r,c.K.ring).borderColor:"border-tremor-brand-subtle dark:border-dark-tremor-brand-subtle",ringColor:r?(0,i.q)((0,d.bM)(r,c.K.ring).ringColor,"ring-opacity-40"):"ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted"}}},p=(0,d.fn)("Icon"),b=o.forwardRef((e,r)=>{let{icon:t,variant:c="simple",tooltip:b,size:h=l.u8.SM,color:f,className:w}=e,x=(0,n._T)(e,["icon","variant","tooltip","size","color","className"]),k=u(c,f),{tooltipProps:v,getReferenceProps:C}=(0,a.l)();return o.createElement("span",Object.assign({ref:(0,d.lq)([r,v.refs.setReference]),className:(0,i.q)(p("root"),"inline-flex flex-shrink-0 items-center",k.bgColor,k.textColor,k.borderColor,k.ringColor,m[c].rounded,m[c].border,m[c].shadow,m[c].ring,s[h].paddingX,s[h].paddingY,w)},C,x),o.createElement(a.Z,Object.assign({text:b},v)),o.createElement(t,{className:(0,i.q)(p("icon"),"shrink-0",g[h].height,g[h].width)}))});b.displayName="Icon"},30150:function(e,r,t){t.d(r,{Z:function(){return m}});var n=t(5853),o=t(2265);let a=e=>{var r=(0,n._T)(e,[]);return o.createElement("svg",Object.assign({},r,{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2.5"}),o.createElement("path",{d:"M12 4v16m8-8H4"}))},l=e=>{var r=(0,n._T)(e,[]);return o.createElement("svg",Object.assign({},r,{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2.5"}),o.createElement("path",{d:"M20 12H4"}))};var i=t(97324),d=t(1153),c=t(69262);let s="flex mx-auto text-tremor-content-subtle dark:text-dark-tremor-content-subtle",g="cursor-pointer hover:text-tremor-content dark:hover:text-dark-tremor-content",m=o.forwardRef((e,r)=>{let{onSubmit:t,enableStepper:m=!0,disabled:u,onValueChange:p,onChange:b}=e,h=(0,n._T)(e,["onSubmit","enableStepper","disabled","onValueChange","onChange"]),f=(0,o.useRef)(null),[w,x]=o.useState(!1),k=o.useCallback(()=>{x(!0)},[]),v=o.useCallback(()=>{x(!1)},[]),[C,y]=o.useState(!1),E=o.useCallback(()=>{y(!0)},[]),S=o.useCallback(()=>{y(!1)},[]);return o.createElement(c.Z,Object.assign({type:"number",ref:(0,d.lq)([f,r]),disabled:u,makeInputClassName:(0,d.fn)("NumberInput"),onKeyDown:e=>{var r;if("Enter"===e.key&&!e.ctrlKey&&!e.altKey&&!e.shiftKey){let e=null===(r=f.current)||void 0===r?void 0:r.value;null==t||t(parseFloat(null!=e?e:""))}"ArrowDown"===e.key&&k(),"ArrowUp"===e.key&&E()},onKeyUp:e=>{"ArrowDown"===e.key&&v(),"ArrowUp"===e.key&&S()},onChange:e=>{u||(null==p||p(parseFloat(e.target.value)),null==b||b(e))},stepper:m?o.createElement("div",{className:(0,i.q)("flex justify-center align-middle")},o.createElement("div",{tabIndex:-1,onClick:e=>e.preventDefault(),onMouseDown:e=>e.preventDefault(),onTouchStart:e=>{e.cancelable&&e.preventDefault()},onMouseUp:()=>{var e,r;u||(null===(e=f.current)||void 0===e||e.stepDown(),null===(r=f.current)||void 0===r||r.dispatchEvent(new Event("input",{bubbles:!0})))},className:(0,i.q)(!u&&g,s,"group py-[10px] px-2.5 border-l border-tremor-border dark:border-dark-tremor-border")},o.createElement(l,{"data-testid":"step-down",className:(w?"scale-95":"")+" h-4 w-4 duration-75 transition group-active:scale-95"})),o.createElement("div",{tabIndex:-1,onClick:e=>e.preventDefault(),onMouseDown:e=>e.preventDefault(),onTouchStart:e=>{e.cancelable&&e.preventDefault()},onMouseUp:()=>{var e,r;u||(null===(e=f.current)||void 0===e||e.stepUp(),null===(r=f.current)||void 0===r||r.dispatchEvent(new Event("input",{bubbles:!0})))},className:(0,i.q)(!u&&g,s,"group py-[10px] px-2.5 border-l border-tremor-border dark:border-dark-tremor-border")},o.createElement(a,{"data-testid":"step-up",className:(C?"scale-95":"")+" h-4 w-4 duration-75 transition group-active:scale-95"}))):null},h))});m.displayName="NumberInput"},67101:function(e,r,t){t.d(r,{Z:function(){return s}});var n=t(5853),o=t(97324),a=t(1153),l=t(2265),i=t(9496);let d=(0,a.fn)("Grid"),c=(e,r)=>e&&Object.keys(r).includes(String(e))?r[e]:"",s=l.forwardRef((e,r)=>{let{numItems:t=1,numItemsSm:a,numItemsMd:s,numItemsLg:g,children:m,className:u}=e,p=(0,n._T)(e,["numItems","numItemsSm","numItemsMd","numItemsLg","children","className"]),b=c(t,i._m),h=c(a,i.LH),f=c(s,i.l5),w=c(g,i.N4),x=(0,o.q)(b,h,f,w);return l.createElement("div",Object.assign({ref:r,className:(0,o.q)(d("root"),"grid",x,u)},p),m)});s.displayName="Grid"},9496:function(e,r,t){t.d(r,{LH:function(){return o},N4:function(){return l},PT:function(){return i},SP:function(){return d},VS:function(){return c},_m:function(){return n},_w:function(){return s},l5:function(){return a}});let n={0:"grid-cols-none",1:"grid-cols-1",2:"grid-cols-2",3:"grid-cols-3",4:"grid-cols-4",5:"grid-cols-5",6:"grid-cols-6",7:"grid-cols-7",8:"grid-cols-8",9:"grid-cols-9",10:"grid-cols-10",11:"grid-cols-11",12:"grid-cols-12"},o={0:"sm:grid-cols-none",1:"sm:grid-cols-1",2:"sm:grid-cols-2",3:"sm:grid-cols-3",4:"sm:grid-cols-4",5:"sm:grid-cols-5",6:"sm:grid-cols-6",7:"sm:grid-cols-7",8:"sm:grid-cols-8",9:"sm:grid-cols-9",10:"sm:grid-cols-10",11:"sm:grid-cols-11",12:"sm:grid-cols-12"},a={0:"md:grid-cols-none",1:"md:grid-cols-1",2:"md:grid-cols-2",3:"md:grid-cols-3",4:"md:grid-cols-4",5:"md:grid-cols-5",6:"md:grid-cols-6",7:"md:grid-cols-7",8:"md:grid-cols-8",9:"md:grid-cols-9",10:"md:grid-cols-10",11:"md:grid-cols-11",12:"md:grid-cols-12"},l={0:"lg:grid-cols-none",1:"lg:grid-cols-1",2:"lg:grid-cols-2",3:"lg:grid-cols-3",4:"lg:grid-cols-4",5:"lg:grid-cols-5",6:"lg:grid-cols-6",7:"lg:grid-cols-7",8:"lg:grid-cols-8",9:"lg:grid-cols-9",10:"lg:grid-cols-10",11:"lg:grid-cols-11",12:"lg:grid-cols-12"},i={1:"col-span-1",2:"col-span-2",3:"col-span-3",4:"col-span-4",5:"col-span-5",6:"col-span-6",7:"col-span-7",8:"col-span-8",9:"col-span-9",10:"col-span-10",11:"col-span-11",12:"col-span-12",13:"col-span-13"},d={1:"sm:col-span-1",2:"sm:col-span-2",3:"sm:col-span-3",4:"sm:col-span-4",5:"sm:col-span-5",6:"sm:col-span-6",7:"sm:col-span-7",8:"sm:col-span-8",9:"sm:col-span-9",10:"sm:col-span-10",11:"sm:col-span-11",12:"sm:col-span-12",13:"sm:col-span-13"},c={1:"md:col-span-1",2:"md:col-span-2",3:"md:col-span-3",4:"md:col-span-4",5:"md:col-span-5",6:"md:col-span-6",7:"md:col-span-7",8:"md:col-span-8",9:"md:col-span-9",10:"md:col-span-10",11:"md:col-span-11",12:"md:col-span-12",13:"md:col-span-13"},s={1:"lg:col-span-1",2:"lg:col-span-2",3:"lg:col-span-3",4:"lg:col-span-4",5:"lg:col-span-5",6:"lg:col-span-6",7:"lg:col-span-7",8:"lg:col-span-8",9:"lg:col-span-9",10:"lg:col-span-10",11:"lg:col-span-11",12:"lg:col-span-12",13:"lg:col-span-13"}},23496:function(e,r,t){t.d(r,{Z:function(){return p}});var n=t(2265),o=t(36760),a=t.n(o),l=t(71744),i=t(352),d=t(12918),c=t(80669),s=t(3104);let g=e=>{let{componentCls:r,sizePaddingEdgeHorizontal:t,colorSplit:n,lineWidth:o,textPaddingInline:a,orientationMargin:l,verticalMarginInline:c}=e;return{[r]:Object.assign(Object.assign({},(0,d.Wf)(e)),{borderBlockStart:"".concat((0,i.bf)(o)," solid ").concat(n),"&-vertical":{position:"relative",top:"-0.06em",display:"inline-block",height:"0.9em",marginInline:c,marginBlock:0,verticalAlign:"middle",borderTop:0,borderInlineStart:"".concat((0,i.bf)(o)," solid ").concat(n)},"&-horizontal":{display:"flex",clear:"both",width:"100%",minWidth:"100%",margin:"".concat((0,i.bf)(e.dividerHorizontalGutterMargin)," 0")},["&-horizontal".concat(r,"-with-text")]:{display:"flex",alignItems:"center",margin:"".concat((0,i.bf)(e.dividerHorizontalWithTextGutterMargin)," 0"),color:e.colorTextHeading,fontWeight:500,fontSize:e.fontSizeLG,whiteSpace:"nowrap",textAlign:"center",borderBlockStart:"0 ".concat(n),"&::before, &::after":{position:"relative",width:"50%",borderBlockStart:"".concat((0,i.bf)(o)," solid transparent"),borderBlockStartColor:"inherit",borderBlockEnd:0,transform:"translateY(50%)",content:"''"}},["&-horizontal".concat(r,"-with-text-left")]:{"&::before":{width:"calc(".concat(l," * 100%)")},"&::after":{width:"calc(100% - ".concat(l," * 100%)")}},["&-horizontal".concat(r,"-with-text-right")]:{"&::before":{width:"calc(100% - ".concat(l," * 100%)")},"&::after":{width:"calc(".concat(l," * 100%)")}},["".concat(r,"-inner-text")]:{display:"inline-block",paddingBlock:0,paddingInline:a},"&-dashed":{background:"none",borderColor:n,borderStyle:"dashed",borderWidth:"".concat((0,i.bf)(o)," 0 0")},["&-horizontal".concat(r,"-with-text").concat(r,"-dashed")]:{"&::before, &::after":{borderStyle:"dashed none none"}},["&-vertical".concat(r,"-dashed")]:{borderInlineStartWidth:o,borderInlineEnd:0,borderBlockStart:0,borderBlockEnd:0},["&-plain".concat(r,"-with-text")]:{color:e.colorText,fontWeight:"normal",fontSize:e.fontSize},["&-horizontal".concat(r,"-with-text-left").concat(r,"-no-default-orientation-margin-left")]:{"&::before":{width:0},"&::after":{width:"100%"},["".concat(r,"-inner-text")]:{paddingInlineStart:t}},["&-horizontal".concat(r,"-with-text-right").concat(r,"-no-default-orientation-margin-right")]:{"&::before":{width:"100%"},"&::after":{width:0},["".concat(r,"-inner-text")]:{paddingInlineEnd:t}}})}};var m=(0,c.I$)("Divider",e=>[g((0,s.TS)(e,{dividerHorizontalWithTextGutterMargin:e.margin,dividerHorizontalGutterMargin:e.marginLG,sizePaddingEdgeHorizontal:0}))],e=>({textPaddingInline:"1em",orientationMargin:.05,verticalMarginInline:e.marginXS}),{unitless:{orientationMargin:!0}}),u=function(e,r){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>r.indexOf(n)&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,n=Object.getOwnPropertySymbols(e);or.indexOf(n[o])&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(t[n[o]]=e[n[o]]);return t},p=e=>{let{getPrefixCls:r,direction:t,divider:o}=n.useContext(l.E_),{prefixCls:i,type:d="horizontal",orientation:c="center",orientationMargin:s,className:g,rootClassName:p,children:b,dashed:h,plain:f,style:w}=e,x=u(e,["prefixCls","type","orientation","orientationMargin","className","rootClassName","children","dashed","plain","style"]),k=r("divider",i),[v,C,y]=m(k),E=c.length>0?"-".concat(c):c,S=!!b,M="left"===c&&null!=s,N="right"===c&&null!=s,z=a()(k,null==o?void 0:o.className,C,y,"".concat(k,"-").concat(d),{["".concat(k,"-with-text")]:S,["".concat(k,"-with-text").concat(E)]:S,["".concat(k,"-dashed")]:!!h,["".concat(k,"-plain")]:!!f,["".concat(k,"-rtl")]:"rtl"===t,["".concat(k,"-no-default-orientation-margin-left")]:M,["".concat(k,"-no-default-orientation-margin-right")]:N},g,p),j=n.useMemo(()=>"number"==typeof s?s:/^\d+$/.test(s)?Number(s):s,[s]),O=Object.assign(Object.assign({},M&&{marginLeft:j}),N&&{marginRight:j});return v(n.createElement("div",Object.assign({className:z,style:Object.assign(Object.assign({},null==o?void 0:o.style),w)},x,{role:"separator"}),b&&"vertical"!==d&&n.createElement("span",{className:"".concat(k,"-inner-text"),style:O},b)))}},28617:function(e,r,t){var n=t(2265),o=t(27380),a=t(51646),l=t(6543);r.Z=function(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0],r=(0,n.useRef)({}),t=(0,a.Z)(),i=(0,l.ZP)();return(0,o.Z)(()=>{let n=i.subscribe(n=>{r.current=n,e&&t()});return()=>i.unsubscribe(n)},[]),r.current}},79205:function(e,r,t){t.d(r,{Z:function(){return g}});var n=t(2265);let o=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),a=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,r,t)=>t?t.toUpperCase():r.toLowerCase()),l=e=>{let r=a(e);return r.charAt(0).toUpperCase()+r.slice(1)},i=function(){for(var e=arguments.length,r=Array(e),t=0;t!!e&&""!==e.trim()&&t.indexOf(e)===r).join(" ").trim()},d=e=>{for(let r in e)if(r.startsWith("aria-")||"role"===r||"title"===r)return!0};var c={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let s=(0,n.forwardRef)((e,r)=>{let{color:t="currentColor",size:o=24,strokeWidth:a=2,absoluteStrokeWidth:l,className:s="",children:g,iconNode:m,...u}=e;return(0,n.createElement)("svg",{ref:r,...c,width:o,height:o,stroke:t,strokeWidth:l?24*Number(a)/Number(o):a,className:i("lucide",s),...!g&&!d(u)&&{"aria-hidden":"true"},...u},[...m.map(e=>{let[r,t]=e;return(0,n.createElement)(r,t)}),...Array.isArray(g)?g:[g]])}),g=(e,r)=>{let t=(0,n.forwardRef)((t,a)=>{let{className:d,...c}=t;return(0,n.createElement)(s,{ref:a,iconNode:r,className:i("lucide-".concat(o(l(e))),"lucide-".concat(e),d),...c})});return t.displayName=l(e),t}},30401:function(e,r,t){t.d(r,{Z:function(){return n}});let n=(0,t(79205).Z)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]])},78867:function(e,r,t){t.d(r,{Z:function(){return n}});let n=(0,t(79205).Z)("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]])},10900:function(e,r,t){var n=t(2265);let o=n.forwardRef(function(e,r){return n.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),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 19l-7-7m0 0l7-7m-7 7h18"}))});r.Z=o},86462:function(e,r,t){var n=t(2265);let o=n.forwardRef(function(e,r){return n.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),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"}))});r.Z=o}}]);
\ No newline at end of file
diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/603-faa4ea3b065504a3.js b/litellm/proxy/_experimental/out/_next/static/chunks/603-3af2a9437ea18ed4.js
similarity index 100%
rename from litellm/proxy/_experimental/out/_next/static/chunks/603-faa4ea3b065504a3.js
rename to litellm/proxy/_experimental/out/_next/static/chunks/603-3af2a9437ea18ed4.js
diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/6204-ffb653bc9622a6e0.js b/litellm/proxy/_experimental/out/_next/static/chunks/6204-f39cf49b663f757e.js
similarity index 100%
rename from litellm/proxy/_experimental/out/_next/static/chunks/6204-ffb653bc9622a6e0.js
rename to litellm/proxy/_experimental/out/_next/static/chunks/6204-f39cf49b663f757e.js
diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/6494-7124dea6b90175e7.js b/litellm/proxy/_experimental/out/_next/static/chunks/6494-7124dea6b90175e7.js
deleted file mode 100644
index 070b64d83a0..00000000000
--- a/litellm/proxy/_experimental/out/_next/static/chunks/6494-7124dea6b90175e7.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6494],{3632:function(e,t,n){n.d(t,{Z:function(){return c}});var o=n(1119),r=n(2265),a={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"},l=n(55015),c=r.forwardRef(function(e,t){return r.createElement(l.Z,(0,o.Z)({},e,{ref:t,icon:a}))})},35291:function(e,t,n){n.d(t,{Z:function(){return c}});var o=n(1119),r=n(2265),a={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"},l=n(55015),c=r.forwardRef(function(e,t){return r.createElement(l.Z,(0,o.Z)({},e,{ref:t,icon:a}))})},28617:function(e,t,n){var o=n(2265),r=n(27380),a=n(51646),l=n(6543);t.Z=function(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0],t=(0,o.useRef)({}),n=(0,a.Z)(),c=(0,l.ZP)();return(0,r.Z)(()=>{let o=c.subscribe(o=>{t.current=o,e&&n()});return()=>c.unsubscribe(o)},[]),t.current}},29967:function(e,t,n){n.d(t,{ZP:function(){return T}});var o=n(2265),r=n(36760),a=n.n(r),l=n(50506),c=n(18242),i=n(71744),d=n(33759);let s=o.createContext(null),u=s.Provider,f=o.createContext(null),p=f.Provider;var m=n(20873),g=n(28791),h=n(6694),v=n(34709),b=n(86586),y=n(39109),x=n(352),k=n(12918),C=n(80669),S=n(3104);let E=e=>{let{componentCls:t,antCls:n}=e,o="".concat(t,"-group");return{[o]:Object.assign(Object.assign({},(0,k.Wf)(e)),{display:"inline-block",fontSize:0,["&".concat(o,"-rtl")]:{direction:"rtl"},["".concat(n,"-badge ").concat(n,"-badge-count")]:{zIndex:1},["> ".concat(n,"-badge:not(:first-child) > ").concat(n,"-button-wrapper")]:{borderInlineStart:"none"}})}},w=e=>{let{componentCls:t,wrapperMarginInlineEnd:n,colorPrimary:o,radioSize:r,motionDurationSlow:a,motionDurationMid:l,motionEaseInOutCirc:c,colorBgContainer:i,colorBorder:d,lineWidth:s,colorBgContainerDisabled:u,colorTextDisabled:f,paddingXS:p,dotColorDisabled:m,lineType:g,radioColor:h,radioBgColor:v,calc:b}=e,y="".concat(t,"-inner"),C=b(r).sub(b(4).mul(2)),S=b(1).mul(r).equal();return{["".concat(t,"-wrapper")]:Object.assign(Object.assign({},(0,k.Wf)(e)),{display:"inline-flex",alignItems:"baseline",marginInlineStart:0,marginInlineEnd:n,cursor:"pointer",["&".concat(t,"-wrapper-rtl")]:{direction:"rtl"},"&-disabled":{cursor:"not-allowed",color:e.colorTextDisabled},"&::after":{display:"inline-block",width:0,overflow:"hidden",content:'"\\a0"'},["".concat(t,"-checked::after")]:{position:"absolute",insetBlockStart:0,insetInlineStart:0,width:"100%",height:"100%",border:"".concat((0,x.bf)(s)," ").concat(g," ").concat(o),borderRadius:"50%",visibility:"hidden",content:'""'},[t]:Object.assign(Object.assign({},(0,k.Wf)(e)),{position:"relative",display:"inline-block",outline:"none",cursor:"pointer",alignSelf:"center",borderRadius:"50%"}),["".concat(t,"-wrapper:hover &,\n &:hover ").concat(y)]:{borderColor:o},["".concat(t,"-input:focus-visible + ").concat(y)]:Object.assign({},(0,k.oN)(e)),["".concat(t,":hover::after, ").concat(t,"-wrapper:hover &::after")]:{visibility:"visible"},["".concat(t,"-inner")]:{"&::after":{boxSizing:"border-box",position:"absolute",insetBlockStart:"50%",insetInlineStart:"50%",display:"block",width:S,height:S,marginBlockStart:b(1).mul(r).div(-2).equal(),marginInlineStart:b(1).mul(r).div(-2).equal(),backgroundColor:h,borderBlockStart:0,borderInlineStart:0,borderRadius:S,transform:"scale(0)",opacity:0,transition:"all ".concat(a," ").concat(c),content:'""'},boxSizing:"border-box",position:"relative",insetBlockStart:0,insetInlineStart:0,display:"block",width:S,height:S,backgroundColor:i,borderColor:d,borderStyle:"solid",borderWidth:s,borderRadius:"50%",transition:"all ".concat(l)},["".concat(t,"-input")]:{position:"absolute",inset:0,zIndex:1,cursor:"pointer",opacity:0},["".concat(t,"-checked")]:{[y]:{borderColor:o,backgroundColor:v,"&::after":{transform:"scale(".concat(e.calc(e.dotSize).div(r).equal(),")"),opacity:1,transition:"all ".concat(a," ").concat(c)}}},["".concat(t,"-disabled")]:{cursor:"not-allowed",[y]:{backgroundColor:u,borderColor:d,cursor:"not-allowed","&::after":{backgroundColor:m}},["".concat(t,"-input")]:{cursor:"not-allowed"},["".concat(t,"-disabled + span")]:{color:f,cursor:"not-allowed"},["&".concat(t,"-checked")]:{[y]:{"&::after":{transform:"scale(".concat(b(C).div(r).equal({unit:!1}),")")}}}},["span".concat(t," + *")]:{paddingInlineStart:p,paddingInlineEnd:p}})}},N=e=>{let{buttonColor:t,controlHeight:n,componentCls:o,lineWidth:r,lineType:a,colorBorder:l,motionDurationSlow:c,motionDurationMid:i,buttonPaddingInline:d,fontSize:s,buttonBg:u,fontSizeLG:f,controlHeightLG:p,controlHeightSM:m,paddingXS:g,borderRadius:h,borderRadiusSM:v,borderRadiusLG:b,buttonCheckedBg:y,buttonSolidCheckedColor:C,colorTextDisabled:S,colorBgContainerDisabled:E,buttonCheckedBgDisabled:w,buttonCheckedColorDisabled:N,colorPrimary:Z,colorPrimaryHover:O,colorPrimaryActive:K,buttonSolidCheckedBg:I,buttonSolidCheckedHoverBg:R,buttonSolidCheckedActiveBg:P,calc:D}=e;return{["".concat(o,"-button-wrapper")]:{position:"relative",display:"inline-block",height:n,margin:0,paddingInline:d,paddingBlock:0,color:t,fontSize:s,lineHeight:(0,x.bf)(D(n).sub(D(r).mul(2)).equal()),background:u,border:"".concat((0,x.bf)(r)," ").concat(a," ").concat(l),borderBlockStartWidth:D(r).add(.02).equal(),borderInlineStartWidth:0,borderInlineEndWidth:r,cursor:"pointer",transition:["color ".concat(i),"background ".concat(i),"box-shadow ".concat(i)].join(","),a:{color:t},["> ".concat(o,"-button")]:{position:"absolute",insetBlockStart:0,insetInlineStart:0,zIndex:-1,width:"100%",height:"100%"},"&:not(:first-child)":{"&::before":{position:"absolute",insetBlockStart:D(r).mul(-1).equal(),insetInlineStart:D(r).mul(-1).equal(),display:"block",boxSizing:"content-box",width:1,height:"100%",paddingBlock:r,paddingInline:0,backgroundColor:l,transition:"background-color ".concat(c),content:'""'}},"&:first-child":{borderInlineStart:"".concat((0,x.bf)(r)," ").concat(a," ").concat(l),borderStartStartRadius:h,borderEndStartRadius:h},"&:last-child":{borderStartEndRadius:h,borderEndEndRadius:h},"&:first-child:last-child":{borderRadius:h},["".concat(o,"-group-large &")]:{height:p,fontSize:f,lineHeight:(0,x.bf)(D(p).sub(D(r).mul(2)).equal()),"&:first-child":{borderStartStartRadius:b,borderEndStartRadius:b},"&:last-child":{borderStartEndRadius:b,borderEndEndRadius:b}},["".concat(o,"-group-small &")]:{height:m,paddingInline:D(g).sub(r).equal(),paddingBlock:0,lineHeight:(0,x.bf)(D(m).sub(D(r).mul(2)).equal()),"&:first-child":{borderStartStartRadius:v,borderEndStartRadius:v},"&:last-child":{borderStartEndRadius:v,borderEndEndRadius:v}},"&:hover":{position:"relative",color:Z},"&:has(:focus-visible)":Object.assign({},(0,k.oN)(e)),["".concat(o,"-inner, input[type='checkbox'], input[type='radio']")]:{width:0,height:0,opacity:0,pointerEvents:"none"},["&-checked:not(".concat(o,"-button-wrapper-disabled)")]:{zIndex:1,color:Z,background:y,borderColor:Z,"&::before":{backgroundColor:Z},"&:first-child":{borderColor:Z},"&:hover":{color:O,borderColor:O,"&::before":{backgroundColor:O}},"&:active":{color:K,borderColor:K,"&::before":{backgroundColor:K}}},["".concat(o,"-group-solid &-checked:not(").concat(o,"-button-wrapper-disabled)")]:{color:C,background:I,borderColor:I,"&:hover":{color:C,background:R,borderColor:R},"&:active":{color:C,background:P,borderColor:P}},"&-disabled":{color:S,backgroundColor:E,borderColor:l,cursor:"not-allowed","&:first-child, &:hover":{color:S,backgroundColor:E,borderColor:l}},["&-disabled".concat(o,"-button-wrapper-checked")]:{color:N,backgroundColor:w,borderColor:l,boxShadow:"none"}}}};var Z=(0,C.I$)("Radio",e=>{let{controlOutline:t,controlOutlineWidth:n}=e,o="0 0 0 ".concat((0,x.bf)(n)," ").concat(t),r=(0,S.TS)(e,{radioFocusShadow:o,radioButtonFocusShadow:o});return[E(r),w(r),N(r)]},e=>{let{wireframe:t,padding:n,marginXS:o,lineWidth:r,fontSizeLG:a,colorText:l,colorBgContainer:c,colorTextDisabled:i,controlItemBgActiveDisabled:d,colorTextLightSolid:s,colorPrimary:u,colorPrimaryHover:f,colorPrimaryActive:p,colorWhite:m}=e;return{radioSize:a,dotSize:t?a-8:a-(4+r)*2,dotColorDisabled:i,buttonSolidCheckedColor:s,buttonSolidCheckedBg:u,buttonSolidCheckedHoverBg:f,buttonSolidCheckedActiveBg:p,buttonBg:c,buttonCheckedBg:c,buttonColor:l,buttonCheckedBgDisabled:d,buttonCheckedColorDisabled:i,buttonPaddingInline:n-r,wrapperMarginInlineEnd:o,radioColor:t?u:m,radioBgColor:t?c:u}},{unitless:{radioSize:!0,dotSize:!0}}),O=n(64024),K=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>t.indexOf(o)&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var r=0,o=Object.getOwnPropertySymbols(e);rt.indexOf(o[r])&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]]);return n};let I=o.forwardRef((e,t)=>{var n,r;let l=o.useContext(s),c=o.useContext(f),{getPrefixCls:d,direction:u,radio:p}=o.useContext(i.E_),x=o.useRef(null),k=(0,g.sQ)(t,x),{isFormItemInput:C}=o.useContext(y.aM),{prefixCls:S,className:E,rootClassName:w,children:N,style:I,title:R}=e,P=K(e,["prefixCls","className","rootClassName","children","style","title"]),D=d("radio",S),M="button"===((null==l?void 0:l.optionType)||c),T=M?"".concat(D,"-button"):D,j=(0,O.Z)(D),[B,z,H]=Z(D,j),L=Object.assign({},P),A=o.useContext(b.Z);l&&(L.name=l.name,L.onChange=t=>{var n,o;null===(n=e.onChange)||void 0===n||n.call(e,t),null===(o=null==l?void 0:l.onChange)||void 0===o||o.call(l,t)},L.checked=e.value===l.value,L.disabled=null!==(n=L.disabled)&&void 0!==n?n:l.disabled),L.disabled=null!==(r=L.disabled)&&void 0!==r?r:A;let _=a()("".concat(T,"-wrapper"),{["".concat(T,"-wrapper-checked")]:L.checked,["".concat(T,"-wrapper-disabled")]:L.disabled,["".concat(T,"-wrapper-rtl")]:"rtl"===u,["".concat(T,"-wrapper-in-form-item")]:C},null==p?void 0:p.className,E,w,z,H,j);return B(o.createElement(h.Z,{component:"Radio",disabled:L.disabled},o.createElement("label",{className:_,style:Object.assign(Object.assign({},null==p?void 0:p.style),I),onMouseEnter:e.onMouseEnter,onMouseLeave:e.onMouseLeave,title:R},o.createElement(m.Z,Object.assign({},L,{className:a()(L.className,!M&&v.A),type:"radio",prefixCls:T,ref:k})),void 0!==N?o.createElement("span",null,N):null)))}),R=o.forwardRef((e,t)=>{let{getPrefixCls:n,direction:r}=o.useContext(i.E_),[s,f]=(0,l.Z)(e.defaultValue,{value:e.value}),{prefixCls:p,className:m,rootClassName:g,options:h,buttonStyle:v="outline",disabled:b,children:y,size:x,style:k,id:C,onMouseEnter:S,onMouseLeave:E,onFocus:w,onBlur:N}=e,K=n("radio",p),R="".concat(K,"-group"),P=(0,O.Z)(K),[D,M,T]=Z(K,P),j=y;h&&h.length>0&&(j=h.map(e=>"string"==typeof e||"number"==typeof e?o.createElement(I,{key:e.toString(),prefixCls:K,disabled:b,value:e,checked:s===e},e):o.createElement(I,{key:"radio-group-value-options-".concat(e.value),prefixCls:K,disabled:e.disabled||b,value:e.value,checked:s===e.value,title:e.title,style:e.style,id:e.id,required:e.required},e.label)));let B=(0,d.Z)(x),z=a()(R,"".concat(R,"-").concat(v),{["".concat(R,"-").concat(B)]:B,["".concat(R,"-rtl")]:"rtl"===r},m,g,M,T,P);return D(o.createElement("div",Object.assign({},(0,c.Z)(e,{aria:!0,data:!0}),{className:z,style:k,onMouseEnter:S,onMouseLeave:E,onFocus:w,onBlur:N,id:C,ref:t}),o.createElement(u,{value:{onChange:t=>{let n=t.target.value;"value"in e||f(n);let{onChange:o}=e;o&&n!==s&&o(t)},value:s,disabled:e.disabled,name:e.name,optionType:e.optionType}},j)))});var P=o.memo(R),D=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>t.indexOf(o)&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var r=0,o=Object.getOwnPropertySymbols(e);rt.indexOf(o[r])&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]]);return n},M=o.forwardRef((e,t)=>{let{getPrefixCls:n}=o.useContext(i.E_),{prefixCls:r}=e,a=D(e,["prefixCls"]),l=n("radio",r);return o.createElement(p,{value:"button"},o.createElement(I,Object.assign({prefixCls:l},a,{type:"radio",ref:t})))});I.Button=M,I.Group=P,I.__ANT_RADIO=!0;var T=I},72188:function(e,t,n){n.d(t,{Z:function(){return re}});var o,r,a=n(2265),l={},c="rc-table-internal-hook",i=n(26365),d=n(58525),s=n(27380),u=n(16671),f=n(54887);function p(e){var t=a.createContext(void 0);return{Context:t,Provider:function(e){var n=e.value,o=e.children,r=a.useRef(n);r.current=n;var l=a.useState(function(){return{getValue:function(){return r.current},listeners:new Set}}),c=(0,i.Z)(l,1)[0];return(0,s.Z)(function(){(0,f.unstable_batchedUpdates)(function(){c.listeners.forEach(function(e){e(n)})})},[n]),a.createElement(t.Provider,{value:c},o)},defaultValue:e}}function m(e,t){var n=(0,d.Z)("function"==typeof t?t:function(e){if(void 0===t)return e;if(!Array.isArray(t))return e[t];var n={};return t.forEach(function(t){n[t]=e[t]}),n}),o=a.useContext(null==e?void 0:e.Context),r=o||{},l=r.listeners,c=r.getValue,f=a.useRef();f.current=n(o?c():null==e?void 0:e.defaultValue);var p=a.useState({}),m=(0,i.Z)(p,2)[1];return(0,s.Z)(function(){if(o)return l.add(e),function(){l.delete(e)};function e(e){var t=n(e);(0,u.Z)(f.current,t,!0)||m({})}},[o]),f.current}var g=n(1119),h=n(28791);function v(){var e=a.createContext(null);function t(){return a.useContext(e)}return{makeImmutable:function(n,o){var r=(0,h.Yr)(n),l=function(l,c){var i=r?{ref:c}:{},d=a.useRef(0),s=a.useRef(l);return null!==t()?a.createElement(n,(0,g.Z)({},l,i)):((!o||o(s.current,l))&&(d.current+=1),s.current=l,a.createElement(e.Provider,{value:d.current},a.createElement(n,(0,g.Z)({},l,i))))};return r?a.forwardRef(l):l},responseImmutable:function(e,n){var o=(0,h.Yr)(e),r=function(n,r){return t(),a.createElement(e,(0,g.Z)({},n,o?{ref:r}:{}))};return o?a.memo(a.forwardRef(r),n):a.memo(r,n)},useImmutableMark:t}}var b=v();b.makeImmutable,b.responseImmutable,b.useImmutableMark;var y=v(),x=y.makeImmutable,k=y.responseImmutable,C=y.useImmutableMark,S=p();a.memo(function(){var e,t,n,o,r,l=(t=a.useRef(0),t.current+=1,n=a.useRef(void 0),o=[],Object.keys(e||{}).map(function(t){var r;(null==e?void 0:e[t])!==(null===(r=n.current)||void 0===r?void 0:r[t])&&o.push(t)}),n.current=e,r=a.useRef([]),o.length&&(r.current=o),a.useDebugValue(t.current),a.useDebugValue(r.current.join(", ")),t.current);return a.createElement("h1",null,"Render Times: ",l)}).displayName="RenderBlock";var E=n(41154),w=n(31686),N=n(11993),Z=n(36760),O=n.n(Z),K=n(6397),I=n(16847),R=n(32559),P=a.createContext({renderWithProps:!1});function D(e){var t=[],n={};return e.forEach(function(e){for(var o=e||{},r=o.key,a=o.dataIndex,l=r||(null==a?[]:Array.isArray(a)?a:[a]).join("-")||"RC_TABLE_KEY";n[l];)l="".concat(l,"_next");n[l]=!0,t.push(l)}),t}var M=n(74126),T=function(e){var t,n=e.ellipsis,o=e.rowType,r=e.children,l=!0===n?{showTitle:!0}:n;return l&&(l.showTitle||"header"===o)&&("string"==typeof r||"number"==typeof r?t=r.toString():a.isValidElement(r)&&"string"==typeof r.props.children&&(t=r.props.children)),t},j=a.memo(function(e){var t,n,o,r,l,c,d,s,f,p,h=e.component,v=e.children,b=e.ellipsis,y=e.scope,x=e.prefixCls,k=e.className,Z=e.align,R=e.record,D=e.render,j=e.dataIndex,B=e.renderIndex,z=e.shouldCellUpdate,H=e.index,L=e.rowType,A=e.colSpan,_=e.rowSpan,W=e.fixLeft,q=e.fixRight,F=e.firstFixLeft,V=e.lastFixLeft,X=e.firstFixRight,U=e.lastFixRight,G=e.appendNode,Y=e.additionalProps,$=void 0===Y?{}:Y,J=e.isSticky,Q="".concat(x,"-cell"),ee=m(S,["supportSticky","allColumnsFixedLeft"]),et=ee.supportSticky,en=ee.allColumnsFixedLeft,eo=(t=a.useContext(P),n=C(),(0,K.Z)(function(){if(null!=v)return[v];var e=null==j||""===j?[]:Array.isArray(j)?j:[j],n=(0,I.Z)(R,e),o=n,r=void 0;if(D){var l=D(n,R,B);!l||"object"!==(0,E.Z)(l)||Array.isArray(l)||a.isValidElement(l)?o=l:(o=l.children,r=l.props,t.renderWithProps=!0)}return[o,r]},[n,R,v,j,D,B],function(e,n){if(z){var o=(0,i.Z)(e,2)[1];return z((0,i.Z)(n,2)[1],o)}return!!t.renderWithProps||!(0,u.Z)(e,n,!0)})),er=(0,i.Z)(eo,2),ea=er[0],el=er[1],ec={},ei="number"==typeof W&&et,ed="number"==typeof q&&et;ei&&(ec.position="sticky",ec.left=W),ed&&(ec.position="sticky",ec.right=q);var es=null!==(o=null!==(r=null!==(l=null==el?void 0:el.colSpan)&&void 0!==l?l:$.colSpan)&&void 0!==r?r:A)&&void 0!==o?o:1,eu=null!==(c=null!==(d=null!==(s=null==el?void 0:el.rowSpan)&&void 0!==s?s:$.rowSpan)&&void 0!==d?d:_)&&void 0!==c?c:1,ef=m(S,function(e){var t,n;return[(t=eu||1,n=e.hoverStartRow,H<=e.hoverEndRow&&H+t-1>=n),e.onHover]}),ep=(0,i.Z)(ef,2),em=ep[0],eg=ep[1],eh=(0,M.zX)(function(e){var t;R&&eg(H,H+eu-1),null==$||null===(t=$.onMouseEnter)||void 0===t||t.call($,e)}),ev=(0,M.zX)(function(e){var t;R&&eg(-1,-1),null==$||null===(t=$.onMouseLeave)||void 0===t||t.call($,e)});if(0===es||0===eu)return null;var eb=null!==(f=$.title)&&void 0!==f?f:T({rowType:L,ellipsis:b,children:ea}),ey=O()(Q,k,(p={},(0,N.Z)((0,N.Z)((0,N.Z)((0,N.Z)((0,N.Z)((0,N.Z)((0,N.Z)((0,N.Z)((0,N.Z)((0,N.Z)(p,"".concat(Q,"-fix-left"),ei&&et),"".concat(Q,"-fix-left-first"),F&&et),"".concat(Q,"-fix-left-last"),V&&et),"".concat(Q,"-fix-left-all"),V&&en&&et),"".concat(Q,"-fix-right"),ed&&et),"".concat(Q,"-fix-right-first"),X&&et),"".concat(Q,"-fix-right-last"),U&&et),"".concat(Q,"-ellipsis"),b),"".concat(Q,"-with-append"),G),"".concat(Q,"-fix-sticky"),(ei||ed)&&J&&et),(0,N.Z)(p,"".concat(Q,"-row-hover"),!el&&em)),$.className,null==el?void 0:el.className),ex={};Z&&(ex.textAlign=Z);var ek=(0,w.Z)((0,w.Z)((0,w.Z)((0,w.Z)({},ec),$.style),ex),null==el?void 0:el.style),eC=ea;return"object"!==(0,E.Z)(eC)||Array.isArray(eC)||a.isValidElement(eC)||(eC=null),b&&(V||X)&&(eC=a.createElement("span",{className:"".concat(Q,"-content")},eC)),a.createElement(h,(0,g.Z)({},el,$,{className:ey,style:ek,title:eb,scope:y,onMouseEnter:eh,onMouseLeave:ev,colSpan:1!==es?es:null,rowSpan:1!==eu?eu:null}),G,eC)});function B(e,t,n,o,r,a){var l,c,i=n[e]||{},d=n[t]||{};"left"===i.fixed?l=o.left["rtl"===r?t:e]:"right"===d.fixed&&(c=o.right["rtl"===r?e:t]);var s=!1,u=!1,f=!1,p=!1,m=n[t+1],g=n[e-1],h=!(null!=a&&a.children);return"rtl"===r?void 0!==l?p=!(g&&"left"===g.fixed)&&h:void 0!==c&&(f=!(m&&"right"===m.fixed)&&h):void 0!==l?s=!(m&&"left"===m.fixed)&&h:void 0!==c&&(u=!(g&&"right"===g.fixed)&&h),{fixLeft:l,fixRight:c,lastFixLeft:s,firstFixRight:u,lastFixRight:f,firstFixLeft:p,isSticky:o.isSticky}}var z=a.createContext({}),H=n(6989),L=["children"];function A(e){return e.children}A.Row=function(e){var t=e.children,n=(0,H.Z)(e,L);return a.createElement("tr",n,t)},A.Cell=function(e){var t=e.className,n=e.index,o=e.children,r=e.colSpan,l=void 0===r?1:r,c=e.rowSpan,i=e.align,d=m(S,["prefixCls","direction"]),s=d.prefixCls,u=d.direction,f=a.useContext(z),p=f.scrollColumnIndex,h=f.stickyOffsets,v=f.flattenColumns,b=f.columns,y=n+l-1+1===p?l+1:l,x=B(n,n+y-1,v,h,u,null==b?void 0:b[n]);return a.createElement(j,(0,g.Z)({className:t,index:n,component:"td",prefixCls:s,record:null,dataIndex:null,align:i,colSpan:y,rowSpan:c,render:function(){return o}},x))};var _=k(function(e){var t=e.children,n=e.stickyOffsets,o=e.flattenColumns,r=e.columns,l=m(S,"prefixCls"),c=o.length-1,i=o[c],d=a.useMemo(function(){return{stickyOffsets:n,flattenColumns:o,scrollColumnIndex:null!=i&&i.scrollbar?c:null,columns:r}},[i,o,c,n,r]);return a.createElement(z.Provider,{value:d},a.createElement("tfoot",{className:"".concat(l,"-summary")},t))}),W=n(31474),q=n(2857),F=n(10281),V=n(3208),X=n(18242);function U(e,t,n,o){return a.useMemo(function(){if(null!=n&&n.size){for(var r=[],a=0;a<(null==e?void 0:e.length);a+=1)!function e(t,n,o,r,a,l,c){t.push({record:n,indent:o,index:c});var i=l(n),d=null==a?void 0:a.has(i);if(n&&Array.isArray(n[r])&&d)for(var s=0;s1?n-1:0),r=1;r=0;i-=1){var d=t[i],s=n&&n[i],u=s&&s[ea];if(d||u||c){var f=u||{},p=(f.columnType,(0,H.Z)(f,el));r.unshift(a.createElement("col",(0,g.Z)({key:i,style:{width:d}},p))),c=!0}}return a.createElement("colgroup",null,r)},ei=n(83145),ed=["className","noData","columns","flattenColumns","colWidths","columCount","stickyOffsets","direction","fixHeader","stickyTopOffset","stickyBottomOffset","stickyClassName","onScroll","maxContentScroll","children"],es=a.forwardRef(function(e,t){var n=e.className,o=e.noData,r=e.columns,l=e.flattenColumns,c=e.colWidths,i=e.columCount,d=e.stickyOffsets,s=e.direction,u=e.fixHeader,f=e.stickyTopOffset,p=e.stickyBottomOffset,g=e.stickyClassName,v=e.onScroll,b=e.maxContentScroll,y=e.children,x=(0,H.Z)(e,ed),k=m(S,["prefixCls","scrollbarSize","isSticky"]),C=k.prefixCls,E=k.scrollbarSize,Z=k.isSticky,K=Z&&!u?0:E,I=a.useRef(null),R=a.useCallback(function(e){(0,h.mH)(t,e),(0,h.mH)(I,e)},[]);a.useEffect(function(){var e;function t(e){var t=e.currentTarget,n=e.deltaX;n&&(v({currentTarget:t,scrollLeft:t.scrollLeft+n}),e.preventDefault())}return null===(e=I.current)||void 0===e||e.addEventListener("wheel",t),function(){var e;null===(e=I.current)||void 0===e||e.removeEventListener("wheel",t)}},[]);var P=a.useMemo(function(){return l.every(function(e){return e.width})},[l]),D=l[l.length-1],M={fixed:D?D.fixed:null,scrollbar:!0,onHeaderCell:function(){return{className:"".concat(C,"-cell-scrollbar")}}},T=(0,a.useMemo)(function(){return K?[].concat((0,ei.Z)(r),[M]):r},[K,r]),j=(0,a.useMemo)(function(){return K?[].concat((0,ei.Z)(l),[M]):l},[K,l]),B=(0,a.useMemo)(function(){var e=d.right,t=d.left;return(0,w.Z)((0,w.Z)({},d),{},{left:"rtl"===s?[].concat((0,ei.Z)(t.map(function(e){return e+K})),[0]):t,right:"rtl"===s?e:[].concat((0,ei.Z)(e.map(function(e){return e+K})),[0]),isSticky:Z})},[K,d,Z]),z=(0,a.useMemo)(function(){for(var e=[],t=0;t1?"colgroup":"col":null,ellipsis:l.ellipsis,align:l.align,component:l.title?c:i,prefixCls:f,key:h[t]},d,{additionalProps:n,rowType:"header"}))}))}ef.displayName="HeaderRow";var ep=k(function(e){var t=e.stickyOffsets,n=e.columns,o=e.flattenColumns,r=e.onHeaderRow,l=m(S,["prefixCls","getComponent"]),c=l.prefixCls,i=l.getComponent,d=a.useMemo(function(){return function(e){var t=[];!function e(n,o){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;t[r]=t[r]||[];var a=o;return n.filter(Boolean).map(function(n){var o={key:n.key,className:n.className||"",children:n.title,column:n,colStart:a},l=1,c=n.children;return c&&c.length>0&&(l=e(c,a,r+1).reduce(function(e,t){return e+t},0),o.hasSubColumns=!0),"colSpan"in n&&(l=n.colSpan),"rowSpan"in n&&(o.rowSpan=n.rowSpan),o.colSpan=l,o.colEnd=o.colStart+l-1,t[r].push(o),a+=l,l})}(e,0);for(var n=t.length,o=function(e){t[e].forEach(function(t){("rowSpan"in t)||t.hasSubColumns||(t.rowSpan=n-e)})},r=0;r1&&void 0!==arguments[1]?arguments[1]:"";return"number"==typeof t?t:t.endsWith("%")?e*parseFloat(t)/100:null}var eh=["children"],ev=["fixed"];function eb(e){return(0,em.Z)(e).filter(function(e){return a.isValidElement(e)}).map(function(e){var t=e.key,n=e.props,o=n.children,r=(0,H.Z)(n,eh),a=(0,w.Z)({key:t},r);return o&&(a.children=eb(o)),a})}function ey(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"key";return e.filter(function(e){return e&&"object"===(0,E.Z)(e)}).reduce(function(e,n,o){var r=n.fixed,a=!0===r?"left":r,l="".concat(t,"-").concat(o),c=n.children;return c&&c.length>0?[].concat((0,ei.Z)(e),(0,ei.Z)(ey(c,l).map(function(e){return(0,w.Z)({fixed:a},e)}))):[].concat((0,ei.Z)(e),[(0,w.Z)((0,w.Z)({key:l},n),{},{fixed:a})])},[])}var ex=function(e,t){var n=e.prefixCls,o=e.columns,r=e.children,c=e.expandable,d=e.expandedKeys,s=e.columnTitle,u=e.getRowKey,f=e.onTriggerExpand,p=e.expandIcon,m=e.rowExpandable,g=e.expandIconColumnIndex,h=e.direction,v=e.expandRowByClick,b=e.columnWidth,y=e.fixed,x=e.scrollWidth,k=e.clientWidth,C=a.useMemo(function(){return function e(t){return t.filter(function(e){return e&&"object"===(0,E.Z)(e)&&!e.hidden}).map(function(t){var n=t.children;return n&&n.length>0?(0,w.Z)((0,w.Z)({},t),{},{children:e(n)}):t})}((o||eb(r)||[]).slice())},[o,r]),S=a.useMemo(function(){if(c){var e,t=C.slice();if(!t.includes(l)){var o=g||0;o>=0&&t.splice(o,0,l)}var r=t.indexOf(l);t=t.filter(function(e,t){return e!==l||t===r});var i=C[r];e=("left"===y||y)&&!g?"left":("right"===y||y)&&g===C.length?"right":i?i.fixed:null;var h=(0,N.Z)((0,N.Z)((0,N.Z)((0,N.Z)((0,N.Z)((0,N.Z)({},ea,{className:"".concat(n,"-expand-icon-col"),columnType:"EXPAND_COLUMN"}),"title",s),"fixed",e),"className","".concat(n,"-row-expand-icon-cell")),"width",b),"render",function(e,t,o){var r=u(t,o),l=p({prefixCls:n,expanded:d.has(r),expandable:!m||m(t),record:t,onExpand:f});return v?a.createElement("span",{onClick:function(e){return e.stopPropagation()}},l):l});return t.map(function(e){return e===l?h:e})}return C.filter(function(e){return e!==l})},[c,C,u,d,p,h]),Z=a.useMemo(function(){var e=S;return t&&(e=t(e)),e.length||(e=[{render:function(){return null}}]),e},[t,S,h]),O=a.useMemo(function(){return"rtl"===h?ey(Z).map(function(e){var t=e.fixed,n=(0,H.Z)(e,ev),o=t;return"left"===t?o="right":"right"===t&&(o="left"),(0,w.Z)({fixed:o},n)}):ey(Z)},[Z,h,x]),K=a.useMemo(function(){if(x&&x>0){var e=0,t=0;O.forEach(function(n){var o=eg(x,n.width);o?e+=o:t+=1});var n=Math.max(x,k),o=Math.max(n-e,t),r=t,a=o/t,l=0,c=O.map(function(e){var t=(0,w.Z)({},e),n=eg(x,t.width);if(n)t.width=n;else{var c=Math.floor(a);t.width=1===r?o:c,o-=c,r-=1}return l+=t.width,t});if(l=f&&(o=f-p),l({scrollLeft:o/f*(u+2)}),x.current.x=e.pageX},R=function(){if(r.current){var e=eN(r.current).top,t=e+r.current.offsetHeight,n=d===window?document.documentElement.scrollTop+window.innerHeight:eN(d).top+d.clientHeight;t-(0,V.Z)()<=n||e>=n-c?y(function(e){return(0,w.Z)((0,w.Z)({},e),{},{isHiddenScrollBar:!0})}):y(function(e){return(0,w.Z)((0,w.Z)({},e),{},{isHiddenScrollBar:!1})})}},P=function(e){y(function(t){return(0,w.Z)((0,w.Z)({},t),{},{scrollLeft:e/u*f||0})})};return(a.useImperativeHandle(t,function(){return{setScrollLeft:P}}),a.useEffect(function(){var e=ew(document.body,"mouseup",K,!1),t=ew(document.body,"mousemove",I,!1);return R(),function(){e.remove(),t.remove()}},[p,E]),a.useEffect(function(){var e=ew(d,"scroll",R,!1),t=ew(window,"resize",R,!1);return function(){e.remove(),t.remove()}},[d]),a.useEffect(function(){b.isHiddenScrollBar||y(function(e){var t=r.current;return t?(0,w.Z)((0,w.Z)({},e),{},{scrollLeft:t.scrollLeft/t.scrollWidth*t.clientWidth}):e})},[b.isHiddenScrollBar]),u<=f||!p||b.isHiddenScrollBar)?null:a.createElement("div",{style:{height:(0,V.Z)(),width:f,bottom:c},className:"".concat(s,"-sticky-scroll")},a.createElement("div",{onMouseDown:function(e){e.persist(),x.current.delta=e.pageX-b.scrollLeft,x.current.x=0,Z(!0),e.preventDefault()},ref:g,className:O()("".concat(s,"-sticky-scroll-bar"),(0,N.Z)({},"".concat(s,"-sticky-scroll-bar-active"),E)),style:{width:"".concat(p,"px"),transform:"translate3d(".concat(b.scrollLeft,"px, 0, 0)")}}))}),eO="rc-table",eK=[],eI={};function eR(){return"No Data"}var eP=a.forwardRef(function(e,t){var n,o=(0,w.Z)({rowKey:"key",prefixCls:eO,emptyText:eR},e),r=o.prefixCls,l=o.className,s=o.rowClassName,f=o.style,p=o.data,m=o.rowKey,h=o.scroll,v=o.tableLayout,b=o.direction,y=o.title,x=o.footer,k=o.summary,C=o.caption,Z=o.id,R=o.showHeader,P=o.components,M=o.emptyText,T=o.onRow,j=o.onHeaderRow,z=o.internalHooks,L=o.transformColumns,U=o.internalRefs,G=o.tailor,Y=o.getContainerWidth,$=o.sticky,J=p||eK,Q=!!J.length,ee=z===c,et=a.useCallback(function(e,t){return(0,I.Z)(P,e)||t},[P]),en=a.useMemo(function(){return"function"==typeof m?m:function(e){return e&&e[m]}},[m]),ea=et(["body"]),el=(t_=a.useState(-1),tq=(tW=(0,i.Z)(t_,2))[0],tF=tW[1],tV=a.useState(-1),tU=(tX=(0,i.Z)(tV,2))[0],tG=tX[1],[tq,tU,a.useCallback(function(e,t){tF(e),tG(t)},[])]),ed=(0,i.Z)(el,3),es=ed[0],ef=ed[1],em=ed[2],eg=(tQ=(t$=o.expandable,tJ=(0,H.Z)(o,er),!1===(tY="expandable"in o?(0,w.Z)((0,w.Z)({},tJ),t$):tJ).showExpandColumn&&(tY.expandIconColumnIndex=-1),tY).expandIcon,t0=tY.expandedRowKeys,t1=tY.defaultExpandedRowKeys,t2=tY.defaultExpandAllRows,t3=tY.expandedRowRender,t4=tY.onExpand,t6=tY.onExpandedRowsChange,t8=tY.childrenColumnName||"children",t5=a.useMemo(function(){return t3?"row":!!(o.expandable&&o.internalHooks===c&&o.expandable.__PARENT_RENDER_ICON__||J.some(function(e){return e&&"object"===(0,E.Z)(e)&&e[t8]}))&&"nest"},[!!t3,J]),t7=a.useState(function(){if(t1)return t1;if(t2){var e;return e=[],function t(n){(n||[]).forEach(function(n,o){e.push(en(n,o)),t(n[t8])})}(J),e}return[]}),ne=(t9=(0,i.Z)(t7,2))[0],nt=t9[1],nn=a.useMemo(function(){return new Set(t0||ne||[])},[t0,ne]),no=a.useCallback(function(e){var t,n=en(e,J.indexOf(e)),o=nn.has(n);o?(nn.delete(n),t=(0,ei.Z)(nn)):t=[].concat((0,ei.Z)(nn),[n]),nt(t),t4&&t4(!o,e),t6&&t6(t)},[en,nn,J,t4,t6]),[tY,t5,nn,tQ||ek,t8,no]),eh=(0,i.Z)(eg,6),ev=eh[0],eb=eh[1],ey=eh[2],ew=eh[3],eN=eh[4],eP=eh[5],eD=null==h?void 0:h.x,eM=a.useState(0),eT=(0,i.Z)(eM,2),ej=eT[0],eB=eT[1],ez=ex((0,w.Z)((0,w.Z)((0,w.Z)({},o),ev),{},{expandable:!!ev.expandedRowRender,columnTitle:ev.columnTitle,expandedKeys:ey,getRowKey:en,onTriggerExpand:eP,expandIcon:ew,expandIconColumnIndex:ev.expandIconColumnIndex,direction:b,scrollWidth:ee&&G&&"number"==typeof eD?eD:null,clientWidth:ej}),ee?L:null),eH=(0,i.Z)(ez,3),eL=eH[0],eA=eH[1],e_=eH[2],eW=null!=e_?e_:eD,eq=a.useMemo(function(){return{columns:eL,flattenColumns:eA}},[eL,eA]),eF=a.useRef(),eV=a.useRef(),eX=a.useRef(),eU=a.useRef();a.useImperativeHandle(t,function(){return{nativeElement:eF.current,scrollTo:function(e){var t;if(eX.current instanceof HTMLElement){var n=e.index,o=e.top,r=e.key;if(o)null===(a=eX.current)||void 0===a||a.scrollTo({top:o});else{var a,l,c=null!=r?r:en(J[n]);null===(l=eX.current.querySelector('[data-row-key="'.concat(c,'"]')))||void 0===l||l.scrollIntoView()}}else null!==(t=eX.current)&&void 0!==t&&t.scrollTo&&eX.current.scrollTo(e)}}});var eG=a.useRef(),eY=a.useState(!1),e$=(0,i.Z)(eY,2),eJ=e$[0],eQ=e$[1],e0=a.useState(!1),e1=(0,i.Z)(e0,2),e2=e1[0],e3=e1[1],e4=eC(new Map),e6=(0,i.Z)(e4,2),e8=e6[0],e5=e6[1],e7=D(eA).map(function(e){return e8.get(e)}),e9=a.useMemo(function(){return e7},[e7.join("_")]),te=(nr=eA.length,(0,a.useMemo)(function(){for(var e=[],t=[],n=0,o=0,r=0;r0)):(eQ(a>0),e3(a1?y-D:0,pointerEvents:"auto"}),T=a.useMemo(function(){return f?P<=1:0===I||0===P||P>1},[P,I,f]);T?M.visibility="hidden":f&&(M.height=null==p?void 0:p(P));var B={};return(0===P||0===I)&&(B.rowSpan=1,B.colSpan=1),a.createElement(j,(0,g.Z)({className:O()(b,u),ellipsis:o.ellipsis,align:o.align,scope:o.rowScope,component:"div",prefixCls:n.prefixCls,key:C,record:d,index:c,renderIndex:i,dataIndex:v,render:T?function(){return null}:h,shouldCellUpdate:o.shouldCellUpdate},S,{appendNode:E,additionalProps:(0,w.Z)((0,w.Z)({},N),{},{style:M},B)}))},ez=["data","index","className","rowKey","style","extra","getHeight"],eH=k(a.forwardRef(function(e,t){var n,o=e.data,r=e.index,l=e.className,c=e.rowKey,i=e.style,d=e.extra,s=e.getHeight,u=(0,H.Z)(e,ez),f=o.record,p=o.indent,h=o.index,v=m(S,["prefixCls","flattenColumns","fixColumn","componentWidth","scrollX"]),b=v.scrollX,y=v.flattenColumns,x=v.prefixCls,k=v.fixColumn,C=v.componentWidth,E=G(f,c,r,p),Z=E.rowSupportExpand,K=E.expanded,I=E.rowProps,R=E.expandedRowRender,P=E.expandedRowClassName;if(Z&&K){var D=R(f,r,p+1,K),M=null==P?void 0:P(f,r,p),T={};k&&(T={style:(0,N.Z)({},"--virtual-width","".concat(C,"px"))});var B="".concat(x,"-expanded-row-cell");n=a.createElement("div",{className:O()("".concat(x,"-expanded-row"),"".concat(x,"-expanded-row-level-").concat(p+1),M)},a.createElement(j,{component:"div",prefixCls:x,className:O()(B,(0,N.Z)({},"".concat(B,"-fixed"),k)),additionalProps:T},D))}var z=(0,w.Z)((0,w.Z)({},i),{},{width:b});d&&(z.position="absolute",z.pointerEvents="none");var L=a.createElement("div",(0,g.Z)({},I,u,{ref:Z?null:t,className:O()(l,"".concat(x,"-row"),null==I?void 0:I.className,(0,N.Z)({},"".concat(x,"-row-extra"),d)),style:(0,w.Z)((0,w.Z)({},z),null==I?void 0:I.style)}),y.map(function(e,t){return a.createElement(eB,{key:t,rowInfo:E,column:e,colIndex:t,indent:p,index:r,renderIndex:h,record:f,inverse:d,getHeight:s})}));return Z?a.createElement("div",{ref:t},L,n):L})),eL=k(a.forwardRef(function(e,t){var n,o=e.data,r=e.onScroll,l=m(S,["flattenColumns","onColumnResize","getRowKey","prefixCls","expandedKeys","childrenColumnName","emptyNode","scrollX"]),c=l.flattenColumns,d=l.onColumnResize,s=l.getRowKey,u=l.expandedKeys,f=l.prefixCls,p=l.childrenColumnName,h=l.emptyNode,v=l.scrollX,b=m(eT),y=b.sticky,x=b.scrollY,k=b.listItemHeight,C=a.useRef(),w=U(o,p,u,s),N=a.useMemo(function(){var e=0;return c.map(function(t){var n=t.width,o=t.key;return e+=n,[o,n,e]})},[c]),Z=a.useMemo(function(){return N.map(function(e){return e[2]})},[N]);a.useEffect(function(){N.forEach(function(e){var t=(0,i.Z)(e,2);d(t[0],t[1])})},[N]),a.useImperativeHandle(t,function(){var e={scrollTo:function(e){var t;null===(t=C.current)||void 0===t||t.scrollTo(e)}};return Object.defineProperty(e,"scrollLeft",{get:function(){var e;return(null===(e=C.current)||void 0===e?void 0:e.getScrollInfo().x)||0},set:function(e){var t;null===(t=C.current)||void 0===t||t.scrollTo({left:e})}}),e});var K=function(e,t){var n=null===(r=w[t])||void 0===r?void 0:r.record,o=e.onCell;if(o){var r,a,l=o(n,t);return null!==(a=null==l?void 0:l.rowSpan)&&void 0!==a?a:1}return 1},I=a.useMemo(function(){return{columnsOffset:Z}},[Z]),R="".concat(f,"-tbody");if(w.length){var P={};y&&(P.position="sticky",P.bottom=0,"object"===(0,E.Z)(y)&&y.offsetScroll&&(P.bottom=y.offsetScroll)),n=a.createElement(eM.Z,{fullHeight:!1,ref:C,styles:{horizontalScrollBar:P},className:O()(R,"".concat(R,"-virtual")),height:x,itemHeight:k||24,data:w,itemKey:function(e){return s(e.record)},scrollWidth:v,onVirtualScroll:function(e){r({scrollLeft:e.x})},extraRender:function(e){var t=e.start,n=e.end,o=e.getSize,r=e.offsetY;if(n<0)return null;for(var l=c.filter(function(e){return 0===K(e,t)}),i=t,d=function(e){if(!(l=l.filter(function(t){return 0===K(t,e)})).length)return i=e,1},u=t;u>=0&&!d(u);u-=1);for(var f=c.filter(function(e){return 1!==K(e,n)}),p=n,m=function(e){if(!(f=f.filter(function(t){return 1!==K(t,e)})).length)return p=Math.max(e-1,n),1},g=n;g1})&&h.push(e)},b=i;b<=p;b+=1)if(v(b))continue;return h.map(function(e){var t=w[e],n=s(t.record,e),l=o(n);return a.createElement(eH,{key:e,data:t,rowKey:n,index:e,style:{top:-r+l.top},extra:!0,getHeight:function(t){var r=e+t-1,a=o(n,s(w[r].record,r));return a.bottom-a.top}})})}},function(e,t,n){var o=s(e.record,t);return a.createElement(eH,(0,g.Z)({data:e,rowKey:o,index:t},n))})}else n=a.createElement("div",{className:O()("".concat(f,"-placeholder"))},a.createElement(j,{component:"div",prefixCls:f},h));return a.createElement(ej.Provider,{value:I},n)})),eA=function(e,t){var n=t.ref,o=t.onScroll;return a.createElement(eL,{ref:n,data:e,onScroll:o})},e_=a.forwardRef(function(e,t){var n=e.columns,o=e.scroll,r=e.sticky,l=e.prefixCls,i=void 0===l?eO:l,d=e.className,s=e.listItemHeight,u=e.components,f=o||{},p=f.x,m=f.y;"number"!=typeof p&&(p=1),"number"!=typeof m&&(m=500);var h=a.useMemo(function(){return{sticky:r,scrollY:m,listItemHeight:s}},[r,m,s]);return a.createElement(eT.Provider,{value:h},a.createElement(eD,(0,g.Z)({},e,{className:O()(d,"".concat(i,"-virtual")),scroll:(0,w.Z)((0,w.Z)({},o),{},{x:p}),components:(0,w.Z)((0,w.Z)({},u),{},{body:eA}),columns:n,internalHooks:c,tailor:!0,ref:t})))});x(e_,void 0);var eW=n(70464),eq=n(76405),eF=n(25049),eV=n(63496),eX=n(15354),eU=n(15900),eG=a.createContext(null),eY=a.memo(function(e){for(var t,n=e.prefixCls,o=e.level,r=e.isStart,l=e.isEnd,c="".concat(n,"-indent-unit"),i=[],d=0;d1&&void 0!==arguments[1]?arguments[1]:null;return n.map(function(d,s){for(var u,f=eQ(o?o.pos:"0",s),p=e0(d[a],f),m=0;m1&&void 0!==arguments[1]?arguments[1]:{},f=u.initWrapper,p=u.processEntity,m=u.onProcessFinished,g=u.externalGetKey,h=u.childrenPropName,v=u.fieldNames,b=arguments.length>2?arguments[2]:void 0,y={},x={},k={posEntities:y,keyEntities:x};return f&&(k=f(k)||k),t=function(e){var t=e.node,n=e.index,o=e.pos,r=e.key,a=e.parentPos,l=e.level,c={node:t,nodes:e.nodes,index:n,key:r,pos:o,level:l},i=e0(r,o);y[o]=c,x[i]=c,c.parent=y[a],c.parent&&(c.parent.children=c.parent.children||[],c.parent.children.push(c)),p&&p(c,k)},n={externalGetKey:g||b,childrenPropName:h,fieldNames:v},a=(r=("object"===(0,E.Z)(n)?n:{externalGetKey:n})||{}).childrenPropName,l=r.externalGetKey,i=(c=e1(r.fieldNames)).key,d=c.children,s=a||d,l?"string"==typeof l?o=function(e){return e[l]}:"function"==typeof l&&(o=function(e){return l(e)}):o=function(e,t){return e0(e[i],t)},function n(r,a,l,c){var i=r?r[s]:e,d=r?eQ(l.pos,a):"0",u=r?[].concat((0,ei.Z)(c),[r]):[];if(r){var f=o(r,d);t({node:r,index:a,pos:d,key:f,parentPos:l.node?l.pos:null,level:l.level+1,nodes:u})}i&&i.forEach(function(e,t){n(e,t,{node:r,pos:d,level:l?l.level+1:-1},u)})}(null),m&&m(k),k}function e6(e,t){var n=t.expandedKeys,o=t.selectedKeys,r=t.loadedKeys,a=t.loadingKeys,l=t.checkedKeys,c=t.halfCheckedKeys,i=t.dragOverNodeKey,d=t.dropPosition,s=t.keyEntities[e];return{eventKey:e,expanded:-1!==n.indexOf(e),selected:-1!==o.indexOf(e),loaded:-1!==r.indexOf(e),loading:-1!==a.indexOf(e),checked:-1!==l.indexOf(e),halfChecked:-1!==c.indexOf(e),pos:String(s?s.pos:""),dragOver:i===e&&0===d,dragOverGapTop:i===e&&-1===d,dragOverGapBottom:i===e&&1===d}}function e8(e){var t=e.data,n=e.expanded,o=e.selected,r=e.checked,a=e.loaded,l=e.loading,c=e.halfChecked,i=e.dragOver,d=e.dragOverGapTop,s=e.dragOverGapBottom,u=e.pos,f=e.active,p=e.eventKey,m=(0,w.Z)((0,w.Z)({},t),{},{expanded:n,selected:o,checked:r,loaded:a,loading:l,halfChecked:c,dragOver:i,dragOverGapTop:d,dragOverGapBottom:s,pos:u,active:f,key:p});return"props"in m||Object.defineProperty(m,"props",{get:function(){return(0,R.ZP)(!1,"Second param return from event is node data instead of TreeNode instance. Please read value directly instead of reading from `props`."),e}}),m}var e5=["eventKey","className","style","dragOver","dragOverGapTop","dragOverGapBottom","isLeaf","isStart","isEnd","expanded","selected","checked","halfChecked","loading","domRef","active","data","onMouseMove","selectable"],e7="open",e9="close",te=function(e){(0,eX.Z)(n,e);var t=(0,eU.Z)(n);function n(){var e;(0,eq.Z)(this,n);for(var o=arguments.length,r=Array(o),l=0;l=0&&n.splice(o,1),n}function to(e,t){var n=(e||[]).slice();return -1===n.indexOf(t)&&n.push(t),n}function tr(e){return e.split("-")}function ta(e,t,n,o,r,a,l,c,i,d){var s,u,f=e.clientX,p=e.clientY,m=e.target.getBoundingClientRect(),g=m.top,h=m.height,v=(("rtl"===d?-1:1)*(((null==r?void 0:r.x)||0)-f)-12)/o,b=c[n.props.eventKey];if(p-1.5?a({dragNode:N,dropNode:Z,dropPosition:1})?S=1:O=!1:a({dragNode:N,dropNode:Z,dropPosition:0})?S=0:a({dragNode:N,dropNode:Z,dropPosition:1})?S=1:O=!1:a({dragNode:N,dropNode:Z,dropPosition:1})?S=1:O=!1,{dropPosition:S,dropLevelOffset:E,dropTargetKey:b.key,dropTargetPos:b.pos,dragOverNodeKey:C,dropContainerKey:0===S?null:(null===(u=b.parent)||void 0===u?void 0:u.key)||null,dropAllowed:O}}function tl(e,t){if(e)return t.multiple?e.slice():e.length?[e[0]]:e}function tc(e){var t;if(!e)return null;if(Array.isArray(e))t={checkedKeys:e,halfCheckedKeys:void 0};else{if("object"!==(0,E.Z)(e))return(0,R.ZP)(!1,"`checkedKeys` is not an array or an object"),null;t={checkedKeys:e.checked||void 0,halfCheckedKeys:e.halfChecked||void 0}}return t}function ti(e,t){var n=new Set;return(e||[]).forEach(function(e){!function e(o){if(!n.has(o)){var r=t[o];if(r){n.add(o);var a=r.parent;!r.node.disabled&&a&&e(a.key)}}}(e)}),(0,ei.Z)(n)}function td(e,t){var n=new Set;return e.forEach(function(e){t.has(e)||n.add(e)}),n}function ts(e){var t=e||{},n=t.disabled,o=t.disableCheckbox,r=t.checkable;return!!(n||o)||!1===r}function tu(e,t,n,o){var r,a=[];r=o||ts;var l=new Set(e.filter(function(e){var t=!!n[e];return t||a.push(e),t})),c=new Map,i=0;return Object.keys(n).forEach(function(e){var t=n[e],o=t.level,r=c.get(o);r||(r=new Set,c.set(o,r)),r.add(t),i=Math.max(i,o)}),(0,R.ZP)(!a.length,"Tree missing follow keys: ".concat(a.slice(0,100).map(function(e){return"'".concat(e,"'")}).join(", "))),!0===t?function(e,t,n,o){for(var r=new Set(e),a=new Set,l=0;l<=n;l+=1)(t.get(l)||new Set).forEach(function(e){var t=e.key,n=e.node,a=e.children,l=void 0===a?[]:a;r.has(t)&&!o(n)&&l.filter(function(e){return!o(e.node)}).forEach(function(e){r.add(e.key)})});for(var c=new Set,i=n;i>=0;i-=1)(t.get(i)||new Set).forEach(function(e){var t=e.parent;if(!(o(e.node)||!e.parent||c.has(e.parent.key))){if(o(e.parent.node)){c.add(t.key);return}var n=!0,l=!1;(t.children||[]).filter(function(e){return!o(e.node)}).forEach(function(e){var t=e.key,o=r.has(t);n&&!o&&(n=!1),!l&&(o||a.has(t))&&(l=!0)}),n&&r.add(t.key),l&&a.add(t.key),c.add(t.key)}});return{checkedKeys:Array.from(r),halfCheckedKeys:Array.from(td(a,r))}}(l,c,i,r):function(e,t,n,o,r){for(var a=new Set(e),l=new Set(t),c=0;c<=o;c+=1)(n.get(c)||new Set).forEach(function(e){var t=e.key,n=e.node,o=e.children,c=void 0===o?[]:o;a.has(t)||l.has(t)||r(n)||c.filter(function(e){return!r(e.node)}).forEach(function(e){a.delete(e.key)})});l=new Set;for(var i=new Set,d=o;d>=0;d-=1)(n.get(d)||new Set).forEach(function(e){var t=e.parent;if(!(r(e.node)||!e.parent||i.has(e.parent.key))){if(r(e.parent.node)){i.add(t.key);return}var n=!0,o=!1;(t.children||[]).filter(function(e){return!r(e.node)}).forEach(function(e){var t=e.key,r=a.has(t);n&&!r&&(n=!1),!o&&(r||l.has(t))&&(o=!0)}),n||a.delete(t.key),o&&l.add(t.key),i.add(t.key)}});return{checkedKeys:Array.from(a),halfCheckedKeys:Array.from(td(l,a))}}(l,t.halfCheckedKeys,c,i,r)}tt.displayName="TreeNode",tt.isTreeNode=1;var tf=n(50506),tp=n(13613),tm=n(61994),tg=n(80795),th=n(29967);let tv={},tb="SELECT_ALL",ty="SELECT_INVERT",tx="SELECT_NONE",tk=[],tC=(e,t)=>{let n=[];return(t||[]).forEach(t=>{n.push(t),t&&"object"==typeof t&&e in t&&(n=[].concat((0,ei.Z)(n),(0,ei.Z)(tC(e,t[e]))))}),n};var tS=(e,t)=>{let{preserveSelectedRowKeys:n,selectedRowKeys:o,defaultSelectedRowKeys:r,getCheckboxProps:l,onChange:c,onSelect:i,onSelectAll:d,onSelectInvert:s,onSelectNone:u,onSelectMultiple:f,columnWidth:p,type:m,selections:g,fixed:h,renderCell:v,hideSelectAll:b,checkStrictly:y=!0}=t||{},{prefixCls:x,data:k,pageData:C,getRecordByKey:S,getRowKey:E,expandType:w,childrenColumnName:N,locale:Z,getPopupContainer:K}=e,I=(0,tp.ln)("Table"),[R,P]=function(e){let[t,n]=(0,a.useState)(null);return[(0,a.useCallback)((o,r,a)=>{let l=null!=t?t:o,c=Math.max(l||0,o),i=r.slice(Math.min(l||0,o),c+1).map(t=>e(t)),d=i.some(e=>!a.has(e)),s=[];return i.forEach(e=>{d?(a.has(e)||s.push(e),a.add(e)):(a.delete(e),s.push(e))}),n(d?c:null),s},[t]),e=>{n(e)}]}(e=>e),[D,M]=(0,tf.Z)(o||r||tk,{value:o}),T=a.useRef(new Map),j=(0,a.useCallback)(e=>{if(n){let t=new Map;e.forEach(e=>{let n=S(e);!n&&T.current.has(e)&&(n=T.current.get(e)),t.set(e,n)}),T.current=t}},[S,n]);a.useEffect(()=>{j(D)},[D]);let{keyEntities:B}=(0,a.useMemo)(()=>{if(y)return{keyEntities:null};let e=k;if(n){let t=new Set(k.map((e,t)=>E(e,t))),n=Array.from(T.current).reduce((e,n)=>{let[o,r]=n;return t.has(o)?e:e.concat(r)},[]);e=[].concat((0,ei.Z)(e),(0,ei.Z)(n))}return e4(e,{externalGetKey:E,childrenPropName:N})},[k,E,y,N,n]),z=(0,a.useMemo)(()=>tC(N,C),[N,C]),H=(0,a.useMemo)(()=>{let e=new Map;return z.forEach((t,n)=>{let o=E(t,n),r=(l?l(t):null)||{};e.set(o,r)}),e},[z,E,l]),L=(0,a.useCallback)(e=>{var t;return!!(null===(t=H.get(E(e)))||void 0===t?void 0:t.disabled)},[H,E]),[A,_]=(0,a.useMemo)(()=>{if(y)return[D||[],[]];let{checkedKeys:e,halfCheckedKeys:t}=tu(D,!0,B,L);return[e||[],t]},[D,y,B,L]),W=(0,a.useMemo)(()=>new Set("radio"===m?A.slice(0,1):A),[A,m]),q=(0,a.useMemo)(()=>"radio"===m?new Set:new Set(_),[_,m]);a.useEffect(()=>{t||M(tk)},[!!t]);let F=(0,a.useCallback)((e,t)=>{let o,r;j(e),n?(o=e,r=e.map(e=>T.current.get(e))):(o=[],r=[],e.forEach(e=>{let t=S(e);void 0!==t&&(o.push(e),r.push(t))})),M(o),null==c||c(o,r,{type:t})},[M,S,c,n]),V=(0,a.useCallback)((e,t,n,o)=>{if(i){let r=n.map(e=>S(e));i(S(e),t,r,o)}F(n,"single")},[i,S,F]),X=(0,a.useMemo)(()=>!g||b?null:(!0===g?[tb,ty,tx]:g).map(e=>e===tb?{key:"all",text:Z.selectionAll,onSelect(){F(k.map((e,t)=>E(e,t)).filter(e=>{let t=H.get(e);return!(null==t?void 0:t.disabled)||W.has(e)}),"all")}}:e===ty?{key:"invert",text:Z.selectInvert,onSelect(){let e=new Set(W);C.forEach((t,n)=>{let o=E(t,n),r=H.get(o);(null==r?void 0:r.disabled)||(e.has(o)?e.delete(o):e.add(o))});let t=Array.from(e);s&&(I.deprecated(!1,"onSelectInvert","onChange"),s(t)),F(t,"invert")}}:e===tx?{key:"none",text:Z.selectNone,onSelect(){null==u||u(),F(Array.from(W).filter(e=>{let t=H.get(e);return null==t?void 0:t.disabled}),"none")}}:e).map(e=>Object.assign(Object.assign({},e),{onSelect:function(){for(var t,n=arguments.length,o=Array(n),r=0;r{var n;let o,r,l;if(!t)return e.filter(e=>e!==tv);let c=(0,ei.Z)(e),i=new Set(W),s=z.map(E).filter(e=>!H.get(e).disabled),u=s.every(e=>i.has(e)),k=s.some(e=>i.has(e));if("radio"!==m){let e;if(X){let t={getPopupContainer:K,items:X.map((e,t)=>{let{key:n,text:o,onSelect:r}=e;return{key:null!=n?n:t,onClick:()=>{null==r||r(s)},label:o}})};e=a.createElement("div",{className:"".concat(x,"-selection-extra")},a.createElement(tg.Z,{menu:t,getPopupContainer:K},a.createElement("span",null,a.createElement(eW.Z,null))))}let t=z.map((e,t)=>{let n=E(e,t),o=H.get(n)||{};return Object.assign({checked:i.has(n)},o)}).filter(e=>{let{disabled:t}=e;return t}),n=!!t.length&&t.length===z.length,l=n&&t.every(e=>{let{checked:t}=e;return t}),c=n&&t.some(e=>{let{checked:t}=e;return t});r=a.createElement(tm.Z,{checked:n?l:!!z.length&&u,indeterminate:n?!l&&c:!u&&k,onChange:()=>{let e=[];u?s.forEach(t=>{i.delete(t),e.push(t)}):s.forEach(t=>{i.has(t)||(i.add(t),e.push(t))});let t=Array.from(i);null==d||d(!u,t.map(e=>S(e)),e.map(e=>S(e))),F(t,"all"),P(null)},disabled:0===z.length||n,"aria-label":e?"Custom selection":"Select all",skipGroup:!0}),o=!b&&a.createElement("div",{className:"".concat(x,"-selection")},r,e)}if(l="radio"===m?(e,t,n)=>{let o=E(t,n),r=i.has(o);return{node:a.createElement(th.ZP,Object.assign({},H.get(o),{checked:r,onClick:e=>e.stopPropagation(),onChange:e=>{i.has(o)||V(o,!0,[o],e.nativeEvent)}})),checked:r}}:(e,t,n)=>{var o;let r;let l=E(t,n),c=i.has(l),d=q.has(l),u=H.get(l);return r="nest"===w?d:null!==(o=null==u?void 0:u.indeterminate)&&void 0!==o?o:d,{node:a.createElement(tm.Z,Object.assign({},u,{indeterminate:r,checked:c,skipGroup:!0,onClick:e=>e.stopPropagation(),onChange:e=>{let{nativeEvent:t}=e,{shiftKey:n}=t,o=s.findIndex(e=>e===l),r=A.some(e=>s.includes(e));if(n&&y&&r){let e=R(o,s,i),t=Array.from(i);null==f||f(!c,t.map(e=>S(e)),e.map(e=>S(e))),F(t,"multiple")}else if(y){let e=c?tn(A,l):to(A,l);V(l,!c,e,t)}else{let{checkedKeys:e,halfCheckedKeys:n}=tu([].concat((0,ei.Z)(A),[l]),!0,B,L),o=e;if(c){let t=new Set(e);t.delete(l),o=tu(Array.from(t),{checked:!1,halfCheckedKeys:n},B,L).checkedKeys}V(l,!c,o,t)}c?P(null):P(o)}})),checked:c}},!c.includes(tv)){if(0===c.findIndex(e=>{var t;return(null===(t=e[ea])||void 0===t?void 0:t.columnType)==="EXPAND_COLUMN"})){let[e,...t]=c;c=[e,tv].concat((0,ei.Z)(t))}else c=[tv].concat((0,ei.Z)(c))}let C=c.indexOf(tv),N=(c=c.filter((e,t)=>e!==tv||t===C))[C-1],Z=c[C+1],I=h;void 0===I&&((null==Z?void 0:Z.fixed)!==void 0?I=Z.fixed:(null==N?void 0:N.fixed)!==void 0&&(I=N.fixed)),I&&N&&(null===(n=N[ea])||void 0===n?void 0:n.columnType)==="EXPAND_COLUMN"&&void 0===N.fixed&&(N.fixed=I);let D=O()("".concat(x,"-selection-col"),{["".concat(x,"-selection-col-with-dropdown")]:g&&"checkbox"===m}),M={fixed:I,width:p,className:"".concat(x,"-selection-column"),title:(null==t?void 0:t.columnTitle)?"function"==typeof t.columnTitle?t.columnTitle(r):t.columnTitle:o,render:(e,t,n)=>{let{node:o,checked:r}=l(e,t,n);return v?v(r,t,n,o):o},onCell:t.onCell,[ea]:{className:D}};return c.map(e=>e===tv?M:e)},[E,z,t,A,W,q,p,X,w,H,f,V,L]),W]},tE=n(53346);function tw(e){return null!=e&&e===e.window}var tN=n(71744),tZ=n(91086),tO=n(64024),tK=n(33759),tI=n(28617),tR=n(13823),tP={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M272.9 512l265.4-339.1c4.1-5.2.4-12.9-6.3-12.9h-77.3c-4.9 0-9.6 2.3-12.6 6.1L186.8 492.3a31.99 31.99 0 000 39.5l255.3 326.1c3 3.9 7.7 6.1 12.6 6.1H532c6.7 0 10.4-7.7 6.3-12.9L272.9 512zm304 0l265.4-339.1c4.1-5.2.4-12.9-6.3-12.9h-77.3c-4.9 0-9.6 2.3-12.6 6.1L490.8 492.3a31.99 31.99 0 000 39.5l255.3 326.1c3 3.9 7.7 6.1 12.6 6.1H836c6.7 0 10.4-7.7 6.3-12.9L576.9 512z"}}]},name:"double-left",theme:"outlined"},tD=n(55015),tM=a.forwardRef(function(e,t){return a.createElement(tD.Z,(0,g.Z)({},e,{ref:t,icon:tP}))}),tT={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M533.2 492.3L277.9 166.1c-3-3.9-7.7-6.1-12.6-6.1H188c-6.7 0-10.4 7.7-6.3 12.9L447.1 512 181.7 851.1A7.98 7.98 0 00188 864h77.3c4.9 0 9.6-2.3 12.6-6.1l255.3-326.1c9.1-11.7 9.1-27.9 0-39.5zm304 0L581.9 166.1c-3-3.9-7.7-6.1-12.6-6.1H492c-6.7 0-10.4 7.7-6.3 12.9L751.1 512 485.7 851.1A7.98 7.98 0 00492 864h77.3c4.9 0 9.6-2.3 12.6-6.1l255.3-326.1c9.1-11.7 9.1-27.9 0-39.5z"}}]},name:"double-right",theme:"outlined"},tj=a.forwardRef(function(e,t){return a.createElement(tD.Z,(0,g.Z)({},e,{ref:t,icon:tT}))}),tB=n(15327),tz=n(77565),tH=n(95814),tL={items_per_page:"条/页",jump_to:"跳至",jump_to_confirm:"确定",page:"页",prev_page:"上一页",next_page:"下一页",prev_5:"向前 5 页",next_5:"向后 5 页",prev_3:"向前 3 页",next_3:"向后 3 页",page_size:"页码"},tA=["10","20","50","100"],t_=function(e){var t=e.pageSizeOptions,n=void 0===t?tA:t,o=e.locale,r=e.changeSize,l=e.pageSize,c=e.goButton,d=e.quickGo,s=e.rootPrefixCls,u=e.selectComponentClass,f=e.selectPrefixCls,p=e.disabled,m=e.buildOptionText,g=a.useState(""),h=(0,i.Z)(g,2),v=h[0],b=h[1],y=function(){return!v||Number.isNaN(v)?void 0:Number(v)},x="function"==typeof m?m:function(e){return"".concat(e," ").concat(o.items_per_page)},k=function(e){""!==v&&(e.keyCode===tH.Z.ENTER||"click"===e.type)&&(b(""),null==d||d(y()))},C="".concat(s,"-options");if(!r&&!d)return null;var S=null,E=null,w=null;if(r&&u){var N=(n.some(function(e){return e.toString()===l.toString()})?n:n.concat([l.toString()]).sort(function(e,t){return(Number.isNaN(Number(e))?0:Number(e))-(Number.isNaN(Number(t))?0:Number(t))})).map(function(e,t){return a.createElement(u.Option,{key:t,value:e.toString()},x(e))});S=a.createElement(u,{disabled:p,prefixCls:f,showSearch:!1,className:"".concat(C,"-size-changer"),optionLabelProp:"children",popupMatchSelectWidth:!1,value:(l||n[0]).toString(),onChange:function(e){null==r||r(Number(e))},getPopupContainer:function(e){return e.parentNode},"aria-label":o.page_size,defaultOpen:!1},N)}return d&&(c&&(w="boolean"==typeof c?a.createElement("button",{type:"button",onClick:k,onKeyUp:k,disabled:p,className:"".concat(C,"-quick-jumper-button")},o.jump_to_confirm):a.createElement("span",{onClick:k,onKeyUp:k},c)),E=a.createElement("div",{className:"".concat(C,"-quick-jumper")},o.jump_to,a.createElement("input",{disabled:p,type:"text",value:v,onChange:function(e){b(e.target.value)},onKeyUp:k,onBlur:function(e){!c&&""!==v&&(b(""),e.relatedTarget&&(e.relatedTarget.className.indexOf("".concat(s,"-item-link"))>=0||e.relatedTarget.className.indexOf("".concat(s,"-item"))>=0)||null==d||d(y()))},"aria-label":o.page}),o.page,w)),a.createElement("li",{className:C},S,E)},tW=function(e){var t,n=e.rootPrefixCls,o=e.page,r=e.active,l=e.className,c=e.showTitle,i=e.onClick,d=e.onKeyPress,s=e.itemRender,u="".concat(n,"-item"),f=O()(u,"".concat(u,"-").concat(o),(t={},(0,N.Z)(t,"".concat(u,"-active"),r),(0,N.Z)(t,"".concat(u,"-disabled"),!o),t),l),p=s(o,"page",a.createElement("a",{rel:"nofollow"},o));return p?a.createElement("li",{title:c?String(o):null,className:f,onClick:function(){i(o)},onKeyDown:function(e){d(e,i,o)},tabIndex:0},p):null},tq=function(e,t,n){return n};function tF(){}function tV(e){var t=Number(e);return"number"==typeof t&&!Number.isNaN(t)&&isFinite(t)&&Math.floor(t)===t}function tX(e,t,n){return Math.floor((n-1)/(void 0===e?t:e))+1}var tU=function(e){var t,n,o,r,l,c=e.prefixCls,d=void 0===c?"rc-pagination":c,s=e.selectPrefixCls,u=e.className,f=e.selectComponentClass,p=e.current,m=e.defaultCurrent,h=e.total,v=void 0===h?0:h,b=e.pageSize,y=e.defaultPageSize,x=e.onChange,k=void 0===x?tF:x,C=e.hideOnSinglePage,S=e.showPrevNextJumpers,E=e.showQuickJumper,Z=e.showLessItems,K=e.showTitle,I=void 0===K||K,R=e.onShowSizeChange,P=void 0===R?tF:R,D=e.locale,M=void 0===D?tL:D,T=e.style,j=e.totalBoundaryShowSizeChanger,B=e.disabled,z=e.simple,H=e.showTotal,L=e.showSizeChanger,A=e.pageSizeOptions,_=e.itemRender,W=void 0===_?tq:_,q=e.jumpPrevIcon,F=e.jumpNextIcon,V=e.prevIcon,U=e.nextIcon,G=a.useRef(null),Y=(0,tf.Z)(10,{value:b,defaultValue:void 0===y?10:y}),$=(0,i.Z)(Y,2),J=$[0],Q=$[1],ee=(0,tf.Z)(1,{value:p,defaultValue:void 0===m?1:m,postState:function(e){return Math.max(1,Math.min(e,tX(void 0,J,v)))}}),et=(0,i.Z)(ee,2),en=et[0],eo=et[1],er=a.useState(en),ea=(0,i.Z)(er,2),el=ea[0],ec=ea[1];(0,a.useEffect)(function(){ec(en)},[en]);var ei=Math.max(1,en-(Z?3:5)),ed=Math.min(tX(void 0,J,v),en+(Z?3:5));function es(t,n){var o=t||a.createElement("button",{type:"button","aria-label":n,className:"".concat(d,"-item-link")});return"function"==typeof t&&(o=a.createElement(t,(0,w.Z)({},e))),o}function eu(e){var t=e.target.value,n=tX(void 0,J,v);return""===t?t:Number.isNaN(Number(t))?el:t>=n?n:Number(t)}var ef=v>J&&E;function ep(e){var t=eu(e);switch(t!==el&&ec(t),e.keyCode){case tH.Z.ENTER:em(t);break;case tH.Z.UP:em(t-1);break;case tH.Z.DOWN:em(t+1)}}function em(e){if(tV(e)&&e!==en&&tV(v)&&v>0&&!B){var t=tX(void 0,J,v),n=e;return e>t?n=t:e<1&&(n=1),n!==el&&ec(n),eo(n),null==k||k(n,J),n}return en}var eg=en>1,eh=en(void 0===j?50:j);function eb(){eg&&em(en-1)}function ey(){eh&&em(en+1)}function ex(){em(ei)}function ek(){em(ed)}function eC(e,t){if("Enter"===e.key||e.charCode===tH.Z.ENTER||e.keyCode===tH.Z.ENTER){for(var n=arguments.length,o=Array(n>2?n-2:0),r=2;rv?v:en*J])),eZ=null,eO=tX(void 0,J,v);if(C&&v<=J)return null;var eK=[],eI={rootPrefixCls:d,onClick:em,onKeyPress:eC,showTitle:I,itemRender:W,page:-1},eR=en-1>0?en-1:0,eP=en+1=2*ej&&3!==en&&(eK[0]=a.cloneElement(eK[0],{className:O()("".concat(d,"-item-after-jump-prev"),eK[0].props.className)}),eK.unshift(eE)),eO-en>=2*ej&&en!==eO-2){var eF=eK[eK.length-1];eK[eK.length-1]=a.cloneElement(eF,{className:O()("".concat(d,"-item-before-jump-next"),eF.props.className)}),eK.push(eZ)}1!==e_&&eK.unshift(a.createElement(tW,(0,g.Z)({},eI,{key:1,page:1}))),eW!==eO&&eK.push(a.createElement(tW,(0,g.Z)({},eI,{key:eO,page:eO})))}var eV=(t=W(eR,"prev",es(V,"prev page")),a.isValidElement(t)?a.cloneElement(t,{disabled:!eg}):t);if(eV){var eX=!eg||!eO;eV=a.createElement("li",{title:I?M.prev_page:null,onClick:eb,tabIndex:eX?null:0,onKeyDown:function(e){eC(e,eb)},className:O()("".concat(d,"-prev"),(0,N.Z)({},"".concat(d,"-disabled"),eX)),"aria-disabled":eX},eV)}var eU=(n=W(eP,"next",es(U,"next page")),a.isValidElement(n)?a.cloneElement(n,{disabled:!eh}):n);eU&&(z?(r=!eh,l=eg?0:null):l=(r=!eh||!eO)?null:0,eU=a.createElement("li",{title:I?M.next_page:null,onClick:ey,tabIndex:l,onKeyDown:function(e){eC(e,ey)},className:O()("".concat(d,"-next"),(0,N.Z)({},"".concat(d,"-disabled"),r)),"aria-disabled":r},eU));var eG=O()(d,u,(o={},(0,N.Z)(o,"".concat(d,"-simple"),z),(0,N.Z)(o,"".concat(d,"-disabled"),B),o));return a.createElement("ul",(0,g.Z)({className:eG,style:T,ref:G},ew),eN,eV,z?eT:eK,eU,a.createElement(t_,{locale:M,rootPrefixCls:d,disabled:B,selectComponentClass:f,selectPrefixCls:void 0===s?"rc-select":s,changeSize:ev?function(e){var t=tX(e,J,v),n=en>t&&0!==t?t:en;Q(e),ec(n),null==P||P(en,e),eo(n),null==k||k(n,e)}:null,pageSize:J,pageSizeOptions:A,quickGo:ef?em:null,goButton:eM}))},tG=n(96257),tY=n(55274),t$=n(52787);let tJ=e=>a.createElement(t$.default,Object.assign({},e,{showSearch:!0,size:"small"})),tQ=e=>a.createElement(t$.default,Object.assign({},e,{showSearch:!0,size:"middle"}));tJ.Option=t$.default.Option,tQ.Option=t$.default.Option;var t0=n(352),t1=n(31282),t2=n(37433),t3=n(12918),t4=n(3104),t6=n(80669),t8=n(65265);let t5=e=>{let{componentCls:t}=e;return{["".concat(t,"-disabled")]:{"&, &:hover":{cursor:"not-allowed",["".concat(t,"-item-link")]:{color:e.colorTextDisabled,cursor:"not-allowed"}},"&:focus-visible":{cursor:"not-allowed",["".concat(t,"-item-link")]:{color:e.colorTextDisabled,cursor:"not-allowed"}}},["&".concat(t,"-disabled")]:{cursor:"not-allowed",["".concat(t,"-item")]:{cursor:"not-allowed","&:hover, &:active":{backgroundColor:"transparent"},a:{color:e.colorTextDisabled,backgroundColor:"transparent",border:"none",cursor:"not-allowed"},"&-active":{borderColor:e.colorBorder,backgroundColor:e.itemActiveBgDisabled,"&:hover, &:active":{backgroundColor:e.itemActiveBgDisabled},a:{color:e.itemActiveColorDisabled}}},["".concat(t,"-item-link")]:{color:e.colorTextDisabled,cursor:"not-allowed","&:hover, &:active":{backgroundColor:"transparent"},["".concat(t,"-simple&")]:{backgroundColor:"transparent","&:hover, &:active":{backgroundColor:"transparent"}}},["".concat(t,"-simple-pager")]:{color:e.colorTextDisabled},["".concat(t,"-jump-prev, ").concat(t,"-jump-next")]:{["".concat(t,"-item-link-icon")]:{opacity:0},["".concat(t,"-item-ellipsis")]:{opacity:1}}},["&".concat(t,"-simple")]:{["".concat(t,"-prev, ").concat(t,"-next")]:{["&".concat(t,"-disabled ").concat(t,"-item-link")]:{"&:hover, &:active":{backgroundColor:"transparent"}}}}}},t7=e=>{let{componentCls:t}=e;return{["&".concat(t,"-mini ").concat(t,"-total-text, &").concat(t,"-mini ").concat(t,"-simple-pager")]:{height:e.itemSizeSM,lineHeight:(0,t0.bf)(e.itemSizeSM)},["&".concat(t,"-mini ").concat(t,"-item")]:{minWidth:e.itemSizeSM,height:e.itemSizeSM,margin:0,lineHeight:(0,t0.bf)(e.calc(e.itemSizeSM).sub(2).equal())},["&".concat(t,"-mini:not(").concat(t,"-disabled) ").concat(t,"-item:not(").concat(t,"-item-active)")]:{backgroundColor:"transparent",borderColor:"transparent","&:hover":{backgroundColor:e.colorBgTextHover},"&:active":{backgroundColor:e.colorBgTextActive}},["&".concat(t,"-mini ").concat(t,"-prev, &").concat(t,"-mini ").concat(t,"-next")]:{minWidth:e.itemSizeSM,height:e.itemSizeSM,margin:0,lineHeight:(0,t0.bf)(e.itemSizeSM)},["&".concat(t,"-mini:not(").concat(t,"-disabled)")]:{["".concat(t,"-prev, ").concat(t,"-next")]:{["&:hover ".concat(t,"-item-link")]:{backgroundColor:e.colorBgTextHover},["&:active ".concat(t,"-item-link")]:{backgroundColor:e.colorBgTextActive},["&".concat(t,"-disabled:hover ").concat(t,"-item-link")]:{backgroundColor:"transparent"}}},["\n &".concat(t,"-mini ").concat(t,"-prev ").concat(t,"-item-link,\n &").concat(t,"-mini ").concat(t,"-next ").concat(t,"-item-link\n ")]:{backgroundColor:"transparent",borderColor:"transparent","&::after":{height:e.itemSizeSM,lineHeight:(0,t0.bf)(e.itemSizeSM)}},["&".concat(t,"-mini ").concat(t,"-jump-prev, &").concat(t,"-mini ").concat(t,"-jump-next")]:{height:e.itemSizeSM,marginInlineEnd:0,lineHeight:(0,t0.bf)(e.itemSizeSM)},["&".concat(t,"-mini ").concat(t,"-options")]:{marginInlineStart:e.paginationMiniOptionsMarginInlineStart,"&-size-changer":{top:e.miniOptionsSizeChangerTop},"&-quick-jumper":{height:e.itemSizeSM,lineHeight:(0,t0.bf)(e.itemSizeSM),input:Object.assign(Object.assign({},(0,t1.x0)(e)),{width:e.paginationMiniQuickJumperInputWidth,height:e.controlHeightSM})}}}},t9=e=>{let{componentCls:t}=e;return{["\n &".concat(t,"-simple ").concat(t,"-prev,\n &").concat(t,"-simple ").concat(t,"-next\n ")]:{height:e.itemSizeSM,lineHeight:(0,t0.bf)(e.itemSizeSM),verticalAlign:"top",["".concat(t,"-item-link")]:{height:e.itemSizeSM,backgroundColor:"transparent",border:0,"&:hover":{backgroundColor:e.colorBgTextHover},"&:active":{backgroundColor:e.colorBgTextActive},"&::after":{height:e.itemSizeSM,lineHeight:(0,t0.bf)(e.itemSizeSM)}}},["&".concat(t,"-simple ").concat(t,"-simple-pager")]:{display:"inline-block",height:e.itemSizeSM,marginInlineEnd:e.marginXS,input:{boxSizing:"border-box",height:"100%",marginInlineEnd:e.marginXS,padding:"0 ".concat((0,t0.bf)(e.paginationItemPaddingInline)),textAlign:"center",backgroundColor:e.itemInputBg,border:"".concat((0,t0.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorBorder),borderRadius:e.borderRadius,outline:"none",transition:"border-color ".concat(e.motionDurationMid),color:"inherit","&:hover":{borderColor:e.colorPrimary},"&:focus":{borderColor:e.colorPrimaryHover,boxShadow:"".concat((0,t0.bf)(e.inputOutlineOffset)," 0 ").concat((0,t0.bf)(e.controlOutlineWidth)," ").concat(e.controlOutline)},"&[disabled]":{color:e.colorTextDisabled,backgroundColor:e.colorBgContainerDisabled,borderColor:e.colorBorder,cursor:"not-allowed"}}}}},ne=e=>{let{componentCls:t}=e;return{["".concat(t,"-jump-prev, ").concat(t,"-jump-next")]:{outline:0,["".concat(t,"-item-container")]:{position:"relative",["".concat(t,"-item-link-icon")]:{color:e.colorPrimary,fontSize:e.fontSizeSM,opacity:0,transition:"all ".concat(e.motionDurationMid),"&-svg":{top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,margin:"auto"}},["".concat(t,"-item-ellipsis")]:{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,display:"block",margin:"auto",color:e.colorTextDisabled,fontFamily:"Arial, Helvetica, sans-serif",letterSpacing:e.paginationEllipsisLetterSpacing,textAlign:"center",textIndent:e.paginationEllipsisTextIndent,opacity:1,transition:"all ".concat(e.motionDurationMid)}},"&:hover":{["".concat(t,"-item-link-icon")]:{opacity:1},["".concat(t,"-item-ellipsis")]:{opacity:0}}},["\n ".concat(t,"-prev,\n ").concat(t,"-jump-prev,\n ").concat(t,"-jump-next\n ")]:{marginInlineEnd:e.marginXS},["\n ".concat(t,"-prev,\n ").concat(t,"-next,\n ").concat(t,"-jump-prev,\n ").concat(t,"-jump-next\n ")]:{display:"inline-block",minWidth:e.itemSize,height:e.itemSize,color:e.colorText,fontFamily:e.fontFamily,lineHeight:"".concat((0,t0.bf)(e.itemSize)),textAlign:"center",verticalAlign:"middle",listStyle:"none",borderRadius:e.borderRadius,cursor:"pointer",transition:"all ".concat(e.motionDurationMid)},["".concat(t,"-prev, ").concat(t,"-next")]:{fontFamily:"Arial, Helvetica, sans-serif",outline:0,button:{color:e.colorText,cursor:"pointer",userSelect:"none"},["".concat(t,"-item-link")]:{display:"block",width:"100%",height:"100%",padding:0,fontSize:e.fontSizeSM,textAlign:"center",backgroundColor:"transparent",border:"".concat((0,t0.bf)(e.lineWidth)," ").concat(e.lineType," transparent"),borderRadius:e.borderRadius,outline:"none",transition:"all ".concat(e.motionDurationMid)},["&:hover ".concat(t,"-item-link")]:{backgroundColor:e.colorBgTextHover},["&:active ".concat(t,"-item-link")]:{backgroundColor:e.colorBgTextActive},["&".concat(t,"-disabled:hover")]:{["".concat(t,"-item-link")]:{backgroundColor:"transparent"}}},["".concat(t,"-slash")]:{marginInlineEnd:e.paginationSlashMarginInlineEnd,marginInlineStart:e.paginationSlashMarginInlineStart},["".concat(t,"-options")]:{display:"inline-block",marginInlineStart:e.margin,verticalAlign:"middle","&-size-changer.-select":{display:"inline-block",width:"auto"},"&-quick-jumper":{display:"inline-block",height:e.controlHeight,marginInlineStart:e.marginXS,lineHeight:(0,t0.bf)(e.controlHeight),verticalAlign:"top",input:Object.assign(Object.assign(Object.assign({},(0,t1.ik)(e)),(0,t8.$U)(e,{borderColor:e.colorBorder,hoverBorderColor:e.colorPrimaryHover,activeBorderColor:e.colorPrimary,activeShadow:e.activeShadow})),{"&[disabled]":Object.assign({},(0,t8.Xy)(e)),width:e.calc(e.controlHeightLG).mul(1.25).equal(),height:e.controlHeight,boxSizing:"border-box",margin:0,marginInlineStart:e.marginXS,marginInlineEnd:e.marginXS})}}}},nt=e=>{let{componentCls:t}=e;return{["".concat(t,"-item")]:{display:"inline-block",minWidth:e.itemSize,height:e.itemSize,marginInlineEnd:e.marginXS,fontFamily:e.fontFamily,lineHeight:(0,t0.bf)(e.calc(e.itemSize).sub(2).equal()),textAlign:"center",verticalAlign:"middle",listStyle:"none",backgroundColor:"transparent",border:"".concat((0,t0.bf)(e.lineWidth)," ").concat(e.lineType," transparent"),borderRadius:e.borderRadius,outline:0,cursor:"pointer",userSelect:"none",a:{display:"block",padding:"0 ".concat((0,t0.bf)(e.paginationItemPaddingInline)),color:e.colorText,"&:hover":{textDecoration:"none"}},["&:not(".concat(t,"-item-active)")]:{"&:hover":{transition:"all ".concat(e.motionDurationMid),backgroundColor:e.colorBgTextHover},"&:active":{backgroundColor:e.colorBgTextActive}},"&-active":{fontWeight:e.fontWeightStrong,backgroundColor:e.itemActiveBg,borderColor:e.colorPrimary,a:{color:e.colorPrimary},"&:hover":{borderColor:e.colorPrimaryHover},"&:hover a":{color:e.colorPrimaryHover}}}}},nn=e=>{let{componentCls:t}=e;return{[t]:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},(0,t3.Wf)(e)),{"ul, ol":{margin:0,padding:0,listStyle:"none"},"&::after":{display:"block",clear:"both",height:0,overflow:"hidden",visibility:"hidden",content:'""'},["".concat(t,"-total-text")]:{display:"inline-block",height:e.itemSize,marginInlineEnd:e.marginXS,lineHeight:(0,t0.bf)(e.calc(e.itemSize).sub(2).equal()),verticalAlign:"middle"}}),nt(e)),ne(e)),t9(e)),t7(e)),t5(e)),{["@media only screen and (max-width: ".concat(e.screenLG,"px)")]:{["".concat(t,"-item")]:{"&-after-jump-prev, &-before-jump-next":{display:"none"}}},["@media only screen and (max-width: ".concat(e.screenSM,"px)")]:{["".concat(t,"-options")]:{display:"none"}}}),["&".concat(e.componentCls,"-rtl")]:{direction:"rtl"}}},no=e=>{let{componentCls:t}=e;return{["".concat(t,":not(").concat(t,"-disabled)")]:{["".concat(t,"-item")]:Object.assign({},(0,t3.Qy)(e)),["".concat(t,"-jump-prev, ").concat(t,"-jump-next")]:{"&:focus-visible":Object.assign({["".concat(t,"-item-link-icon")]:{opacity:1},["".concat(t,"-item-ellipsis")]:{opacity:0}},(0,t3.oN)(e))},["".concat(t,"-prev, ").concat(t,"-next")]:{["&:focus-visible ".concat(t,"-item-link")]:Object.assign({},(0,t3.oN)(e))}}}},nr=e=>Object.assign({itemBg:e.colorBgContainer,itemSize:e.controlHeight,itemSizeSM:e.controlHeightSM,itemActiveBg:e.colorBgContainer,itemLinkBg:e.colorBgContainer,itemActiveColorDisabled:e.colorTextDisabled,itemActiveBgDisabled:e.controlItemBgActiveDisabled,itemInputBg:e.colorBgContainer,miniOptionsSizeChangerTop:0},(0,t2.T)(e)),na=e=>(0,t4.TS)(e,{inputOutlineOffset:0,paginationMiniOptionsMarginInlineStart:e.calc(e.marginXXS).div(2).equal(),paginationMiniQuickJumperInputWidth:e.calc(e.controlHeightLG).mul(1.1).equal(),paginationItemPaddingInline:e.calc(e.marginXXS).mul(1.5).equal(),paginationEllipsisLetterSpacing:e.calc(e.marginXXS).div(2).equal(),paginationSlashMarginInlineStart:e.marginXXS,paginationSlashMarginInlineEnd:e.marginSM,paginationEllipsisTextIndent:"0.13em"},(0,t2.e)(e));var nl=(0,t6.I$)("Pagination",e=>{let t=na(e);return[nn(t),no(t)]},nr),nc=n(29961);let ni=e=>{let{componentCls:t}=e;return{["".concat(t).concat(t,"-bordered").concat(t,"-disabled:not(").concat(t,"-mini)")]:{"&, &:hover":{["".concat(t,"-item-link")]:{borderColor:e.colorBorder}},"&:focus-visible":{["".concat(t,"-item-link")]:{borderColor:e.colorBorder}},["".concat(t,"-item, ").concat(t,"-item-link")]:{backgroundColor:e.colorBgContainerDisabled,borderColor:e.colorBorder,["&:hover:not(".concat(t,"-item-active)")]:{backgroundColor:e.colorBgContainerDisabled,borderColor:e.colorBorder,a:{color:e.colorTextDisabled}},["&".concat(t,"-item-active")]:{backgroundColor:e.itemActiveBgDisabled}},["".concat(t,"-prev, ").concat(t,"-next")]:{"&:hover button":{backgroundColor:e.colorBgContainerDisabled,borderColor:e.colorBorder,color:e.colorTextDisabled},["".concat(t,"-item-link")]:{backgroundColor:e.colorBgContainerDisabled,borderColor:e.colorBorder}}},["".concat(t).concat(t,"-bordered:not(").concat(t,"-mini)")]:{["".concat(t,"-prev, ").concat(t,"-next")]:{"&:hover button":{borderColor:e.colorPrimaryHover,backgroundColor:e.itemBg},["".concat(t,"-item-link")]:{backgroundColor:e.itemLinkBg,borderColor:e.colorBorder},["&:hover ".concat(t,"-item-link")]:{borderColor:e.colorPrimary,backgroundColor:e.itemBg,color:e.colorPrimary},["&".concat(t,"-disabled")]:{["".concat(t,"-item-link")]:{borderColor:e.colorBorder,color:e.colorTextDisabled}}},["".concat(t,"-item")]:{backgroundColor:e.itemBg,border:"".concat((0,t0.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorBorder),["&:hover:not(".concat(t,"-item-active)")]:{borderColor:e.colorPrimary,backgroundColor:e.itemBg,a:{color:e.colorPrimary}},"&-active":{borderColor:e.colorPrimary}}}}};var nd=(0,t6.bk)(["Pagination","bordered"],e=>[ni(na(e))],nr),ns=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>t.indexOf(o)&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var r=0,o=Object.getOwnPropertySymbols(e);rt.indexOf(o[r])&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]]);return n},nu=e=>{let{prefixCls:t,selectPrefixCls:n,className:o,rootClassName:r,style:l,size:c,locale:i,selectComponentClass:d,responsive:s,showSizeChanger:u}=e,f=ns(e,["prefixCls","selectPrefixCls","className","rootClassName","style","size","locale","selectComponentClass","responsive","showSizeChanger"]),{xs:p}=(0,tI.Z)(s),[,m]=(0,nc.ZP)(),{getPrefixCls:g,direction:h,pagination:v={}}=a.useContext(tN.E_),b=g("pagination",t),[y,x,k]=nl(b),C=null!=u?u:v.showSizeChanger,S=a.useMemo(()=>{let e=a.createElement("span",{className:"".concat(b,"-item-ellipsis")},"•••"),t=a.createElement("button",{className:"".concat(b,"-item-link"),type:"button",tabIndex:-1},"rtl"===h?a.createElement(tz.Z,null):a.createElement(tB.Z,null));return{prevIcon:t,nextIcon:a.createElement("button",{className:"".concat(b,"-item-link"),type:"button",tabIndex:-1},"rtl"===h?a.createElement(tB.Z,null):a.createElement(tz.Z,null)),jumpPrevIcon:a.createElement("a",{className:"".concat(b,"-item-link")},a.createElement("div",{className:"".concat(b,"-item-container")},"rtl"===h?a.createElement(tj,{className:"".concat(b,"-item-link-icon")}):a.createElement(tM,{className:"".concat(b,"-item-link-icon")}),e)),jumpNextIcon:a.createElement("a",{className:"".concat(b,"-item-link")},a.createElement("div",{className:"".concat(b,"-item-container")},"rtl"===h?a.createElement(tM,{className:"".concat(b,"-item-link-icon")}):a.createElement(tj,{className:"".concat(b,"-item-link-icon")}),e))}},[h,b]),[E]=(0,tY.Z)("Pagination",tG.Z),w=Object.assign(Object.assign({},E),i),N=(0,tK.Z)(c),Z="small"===N||!!(p&&!N&&s),K=g("select",n),I=O()({["".concat(b,"-mini")]:Z,["".concat(b,"-rtl")]:"rtl"===h,["".concat(b,"-bordered")]:m.wireframe},null==v?void 0:v.className,o,r,x,k),R=Object.assign(Object.assign({},null==v?void 0:v.style),l);return y(a.createElement(a.Fragment,null,m.wireframe&&a.createElement(nd,{prefixCls:b}),a.createElement(tU,Object.assign({},S,f,{style:R,prefixCls:b,selectPrefixCls:K,className:I,selectComponentClass:d||(Z?tJ:tQ),locale:w,showSizeChanger:C}))))},nf=n(87908);function np(e,t){return"key"in e&&void 0!==e.key&&null!==e.key?e.key:e.dataIndex?Array.isArray(e.dataIndex)?e.dataIndex.join("."):e.dataIndex:t}function nm(e,t){return t?"".concat(t,"-").concat(e):"".concat(e)}function ng(e,t){return"function"==typeof e?e(t):e}var nh={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M349 838c0 17.7 14.2 32 31.8 32h262.4c17.6 0 31.8-14.3 31.8-32V642H349v196zm531.1-684H143.9c-24.5 0-39.8 26.7-27.5 48l221.3 376h348.8l221.3-376c12.1-21.3-3.2-48-27.7-48z"}}]},name:"filter",theme:"filled"},nv=a.forwardRef(function(e,t){return a.createElement(tD.Z,(0,g.Z)({},e,{ref:t,icon:nh}))}),nb=n(51646),ny=n(73002),nx=n(85180),nk=n(45937),nC=n(88208);function nS(e){if(null==e)throw TypeError("Cannot destructure "+e)}var nE=n(47970),nw=["className","style","motion","motionNodes","motionType","onMotionStart","onMotionEnd","active","treeNodeRequiredProps"],nN=function(e,t){var n,o,r,l,c,d=e.className,u=e.style,f=e.motion,p=e.motionNodes,m=e.motionType,h=e.onMotionStart,v=e.onMotionEnd,b=e.active,y=e.treeNodeRequiredProps,x=(0,H.Z)(e,nw),k=a.useState(!0),C=(0,i.Z)(k,2),S=C[0],E=C[1],w=a.useContext(eG).prefixCls,N=p&&"hide"!==m;(0,s.Z)(function(){p&&N!==S&&E(N)},[p]);var Z=a.useRef(!1),K=function(){p&&!Z.current&&(Z.current=!0,v())};return(n=function(){p&&h()},o=a.useState(!1),l=(r=(0,i.Z)(o,2))[0],c=r[1],(0,s.Z)(function(){if(l)return n(),function(){K()}},[l]),(0,s.Z)(function(){return c(!0),function(){c(!1)}},[]),p)?a.createElement(nE.ZP,(0,g.Z)({ref:t,visible:S},f,{motionAppear:"show"===m,onVisibleChanged:function(e){N===e&&K()}}),function(e,t){var n=e.className,o=e.style;return a.createElement("div",{ref:t,className:O()("".concat(w,"-treenode-motion"),n),style:o},p.map(function(e){var t=(0,g.Z)({},(nS(e.data),e.data)),n=e.title,o=e.key,r=e.isStart,l=e.isEnd;delete t.children;var c=e6(o,y);return a.createElement(tt,(0,g.Z)({},t,c,{title:n,active:b,data:e.data,key:o,isStart:r,isEnd:l}))}))}):a.createElement(tt,(0,g.Z)({domRef:t,className:d,style:u},x,{active:b}))};nN.displayName="MotionTreeNode";var nZ=a.forwardRef(nN);function nO(e,t,n){var o=e.findIndex(function(e){return e.key===n}),r=e[o+1],a=t.findIndex(function(e){return e.key===n});if(r){var l=t.findIndex(function(e){return e.key===r.key});return t.slice(a+1,l)}return t.slice(a+1)}var nK=["prefixCls","data","selectable","checkable","expandedKeys","selectedKeys","checkedKeys","loadedKeys","loadingKeys","halfCheckedKeys","keyEntities","disabled","dragging","dragOverNodeKey","dropPosition","motion","height","itemHeight","virtual","focusable","activeItem","focused","tabIndex","onKeyDown","onFocus","onBlur","onActiveChange","onListChangeStart","onListChangeEnd"],nI={width:0,height:0,display:"flex",overflow:"hidden",opacity:0,border:0,padding:0,margin:0},nR=function(){},nP="RC_TREE_MOTION_".concat(Math.random()),nD={key:nP},nM={key:nP,level:0,index:0,pos:"0",node:nD,nodes:[nD]},nT={parent:null,children:[],pos:nM.pos,data:nD,title:null,key:nP,isStart:[],isEnd:[]};function nj(e,t,n,o){return!1!==t&&n?e.slice(0,Math.ceil(n/o)+1):e}function nB(e){return e0(e.key,e.pos)}var nz=a.forwardRef(function(e,t){var n=e.prefixCls,o=e.data,r=(e.selectable,e.checkable,e.expandedKeys),l=e.selectedKeys,c=e.checkedKeys,d=e.loadedKeys,u=e.loadingKeys,f=e.halfCheckedKeys,p=e.keyEntities,m=e.disabled,h=e.dragging,v=e.dragOverNodeKey,b=e.dropPosition,y=e.motion,x=e.height,k=e.itemHeight,C=e.virtual,S=e.focusable,E=e.activeItem,w=e.focused,N=e.tabIndex,Z=e.onKeyDown,O=e.onFocus,K=e.onBlur,I=e.onActiveChange,R=e.onListChangeStart,P=e.onListChangeEnd,D=(0,H.Z)(e,nK),M=a.useRef(null),T=a.useRef(null);a.useImperativeHandle(t,function(){return{scrollTo:function(e){M.current.scrollTo(e)},getIndentWidth:function(){return T.current.offsetWidth}}});var j=a.useState(r),B=(0,i.Z)(j,2),z=B[0],L=B[1],A=a.useState(o),_=(0,i.Z)(A,2),W=_[0],q=_[1],F=a.useState(o),V=(0,i.Z)(F,2),X=V[0],U=V[1],G=a.useState([]),Y=(0,i.Z)(G,2),$=Y[0],J=Y[1],Q=a.useState(null),ee=(0,i.Z)(Q,2),et=ee[0],en=ee[1],eo=a.useRef(o);function er(){var e=eo.current;q(e),U(e),J([]),en(null),P()}eo.current=o,(0,s.Z)(function(){L(r);var e=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=e.length,o=t.length;if(1!==Math.abs(n-o))return{add:!1,key:null};function r(e,t){var n=new Map;e.forEach(function(e){n.set(e,!0)});var o=t.filter(function(e){return!n.has(e)});return 1===o.length?o[0]:null}return n ").concat(t);return t}(E)),a.createElement("div",null,a.createElement("input",{style:nI,disabled:!1===S||m,tabIndex:!1!==S?N:null,onKeyDown:Z,onFocus:O,onBlur:K,value:"",onChange:nR,"aria-label":"for screen reader"})),a.createElement("div",{className:"".concat(n,"-treenode"),"aria-hidden":!0,style:{position:"absolute",pointerEvents:"none",visibility:"hidden",height:0,overflow:"hidden",border:0,padding:0}},a.createElement("div",{className:"".concat(n,"-indent")},a.createElement("div",{ref:T,className:"".concat(n,"-indent-unit")}))),a.createElement(eM.Z,(0,g.Z)({},D,{data:ea,itemKey:nB,height:x,fullHeight:!1,virtual:C,itemHeight:k,prefixCls:"".concat(n,"-list"),ref:M,onVisibleChange:function(e,t){var n=new Set(e);t.filter(function(e){return!n.has(e)}).some(function(e){return nB(e)===nP})&&er()}}),function(e){var t=e.pos,n=(0,g.Z)({},(nS(e.data),e.data)),o=e.title,r=e.key,l=e.isStart,c=e.isEnd,i=e0(r,t);delete n.key,delete n.children;var d=e6(i,el);return a.createElement(nZ,(0,g.Z)({},n,d,{title:o,active:!!E&&r===E.key,pos:t,data:e.data,isStart:l,isEnd:c,motion:y,motionNodes:r===nP?$:null,motionType:et,onMotionStart:R,onMotionEnd:er,treeNodeRequiredProps:el,onMouseMove:function(){I(null)}}))}))});nz.displayName="NodeList";var nH=function(e){(0,eX.Z)(n,e);var t=(0,eU.Z)(n);function n(){var e;(0,eq.Z)(this,n);for(var o=arguments.length,r=Array(o),l=0;l0&&void 0!==arguments[0]?arguments[0]:[];t.forEach(function(t){var n=t.key,r=t.children;o.push(n),e(r)})}(l[i].children),o),indent:e.listRef.current.getIndentWidth()}),e.setExpandedKeys(d),window.addEventListener("dragend",e.onWindowDragEnd),null==c||c({event:t,node:e8(n.props)})},e.onNodeDragEnter=function(t,n){var o=e.state,r=o.expandedKeys,a=o.keyEntities,l=o.dragChildrenKeys,c=o.flattenNodes,i=o.indent,d=e.props,s=d.onDragEnter,u=d.onExpand,f=d.allowDrop,p=d.direction,m=n.props,g=m.pos,h=m.eventKey,v=(0,eV.Z)(e).dragNode;if(e.currentMouseOverDroppableNodeKey!==h&&(e.currentMouseOverDroppableNodeKey=h),!v){e.resetDragState();return}var b=ta(t,v,n,i,e.dragStartMousePosition,f,c,a,r,p),y=b.dropPosition,x=b.dropLevelOffset,k=b.dropTargetKey,C=b.dropContainerKey,S=b.dropTargetPos,E=b.dropAllowed,w=b.dragOverNodeKey;if(-1!==l.indexOf(k)||!E||(e.delayedDragEnterLogic||(e.delayedDragEnterLogic={}),Object.keys(e.delayedDragEnterLogic).forEach(function(t){clearTimeout(e.delayedDragEnterLogic[t])}),v.props.eventKey!==n.props.eventKey&&(t.persist(),e.delayedDragEnterLogic[g]=window.setTimeout(function(){if(null!==e.state.draggingNodeKey){var o=(0,ei.Z)(r),l=a[n.props.eventKey];l&&(l.children||[]).length&&(o=to(r,n.props.eventKey)),"expandedKeys"in e.props||e.setExpandedKeys(o),null==u||u(o,{node:e8(n.props),expanded:!0,nativeEvent:t.nativeEvent})}},800)),v.props.eventKey===k&&0===x)){e.resetDragState();return}e.setState({dragOverNodeKey:w,dropPosition:y,dropLevelOffset:x,dropTargetKey:k,dropContainerKey:C,dropTargetPos:S,dropAllowed:E}),null==s||s({event:t,node:e8(n.props),expandedKeys:r})},e.onNodeDragOver=function(t,n){var o=e.state,r=o.dragChildrenKeys,a=o.flattenNodes,l=o.keyEntities,c=o.expandedKeys,i=o.indent,d=e.props,s=d.onDragOver,u=d.allowDrop,f=d.direction,p=(0,eV.Z)(e).dragNode;if(p){var m=ta(t,p,n,i,e.dragStartMousePosition,u,a,l,c,f),g=m.dropPosition,h=m.dropLevelOffset,v=m.dropTargetKey,b=m.dropContainerKey,y=m.dropAllowed,x=m.dropTargetPos,k=m.dragOverNodeKey;-1===r.indexOf(v)&&y&&(p.props.eventKey===v&&0===h?null===e.state.dropPosition&&null===e.state.dropLevelOffset&&null===e.state.dropTargetKey&&null===e.state.dropContainerKey&&null===e.state.dropTargetPos&&!1===e.state.dropAllowed&&null===e.state.dragOverNodeKey||e.resetDragState():g===e.state.dropPosition&&h===e.state.dropLevelOffset&&v===e.state.dropTargetKey&&b===e.state.dropContainerKey&&x===e.state.dropTargetPos&&y===e.state.dropAllowed&&k===e.state.dragOverNodeKey||e.setState({dropPosition:g,dropLevelOffset:h,dropTargetKey:v,dropContainerKey:b,dropTargetPos:x,dropAllowed:y,dragOverNodeKey:k}),null==s||s({event:t,node:e8(n.props)}))}},e.onNodeDragLeave=function(t,n){e.currentMouseOverDroppableNodeKey!==n.props.eventKey||t.currentTarget.contains(t.relatedTarget)||(e.resetDragState(),e.currentMouseOverDroppableNodeKey=null);var o=e.props.onDragLeave;null==o||o({event:t,node:e8(n.props)})},e.onWindowDragEnd=function(t){e.onNodeDragEnd(t,null,!0),window.removeEventListener("dragend",e.onWindowDragEnd)},e.onNodeDragEnd=function(t,n){var o=e.props.onDragEnd;e.setState({dragOverNodeKey:null}),e.cleanDragState(),null==o||o({event:t,node:e8(n.props)}),e.dragNode=null,window.removeEventListener("dragend",e.onWindowDragEnd)},e.onNodeDrop=function(t,n){var o,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],a=e.state,l=a.dragChildrenKeys,c=a.dropPosition,i=a.dropTargetKey,d=a.dropTargetPos;if(a.dropAllowed){var s=e.props.onDrop;if(e.setState({dragOverNodeKey:null}),e.cleanDragState(),null!==i){var u=(0,w.Z)((0,w.Z)({},e6(i,e.getTreeNodeRequiredProps())),{},{active:(null===(o=e.getActiveItem())||void 0===o?void 0:o.key)===i,data:e.state.keyEntities[i].node}),f=-1!==l.indexOf(i);(0,R.ZP)(!f,"Can not drop to dragNode's children node. This is a bug of rc-tree. Please report an issue.");var p=tr(d),m={event:t,node:e8(u),dragNode:e.dragNode?e8(e.dragNode.props):null,dragNodesKeys:[e.dragNode.props.eventKey].concat(l),dropToGap:0!==c,dropPosition:c+Number(p[p.length-1])};r||null==s||s(m),e.dragNode=null}}},e.cleanDragState=function(){null!==e.state.draggingNodeKey&&e.setState({draggingNodeKey:null,dropPosition:null,dropContainerKey:null,dropTargetKey:null,dropLevelOffset:null,dropAllowed:!0,dragOverNodeKey:null}),e.dragStartMousePosition=null,e.currentMouseOverDroppableNodeKey=null},e.triggerExpandActionExpand=function(t,n){var o=e.state,r=o.expandedKeys,a=o.flattenNodes,l=n.expanded,c=n.key;if(!n.isLeaf&&!t.shiftKey&&!t.metaKey&&!t.ctrlKey){var i=a.filter(function(e){return e.key===c})[0],d=e8((0,w.Z)((0,w.Z)({},e6(c,e.getTreeNodeRequiredProps())),{},{data:i.data}));e.setExpandedKeys(l?tn(r,c):to(r,c)),e.onNodeExpand(t,d)}},e.onNodeClick=function(t,n){var o=e.props,r=o.onClick;"click"===o.expandAction&&e.triggerExpandActionExpand(t,n),null==r||r(t,n)},e.onNodeDoubleClick=function(t,n){var o=e.props,r=o.onDoubleClick;"doubleClick"===o.expandAction&&e.triggerExpandActionExpand(t,n),null==r||r(t,n)},e.onNodeSelect=function(t,n){var o=e.state.selectedKeys,r=e.state,a=r.keyEntities,l=r.fieldNames,c=e.props,i=c.onSelect,d=c.multiple,s=n.selected,u=n[l.key],f=!s,p=(o=f?d?to(o,u):[u]:tn(o,u)).map(function(e){var t=a[e];return t?t.node:null}).filter(function(e){return e});e.setUncontrolledState({selectedKeys:o}),null==i||i(o,{event:"select",selected:f,node:n,selectedNodes:p,nativeEvent:t.nativeEvent})},e.onNodeCheck=function(t,n,o){var r,a=e.state,l=a.keyEntities,c=a.checkedKeys,i=a.halfCheckedKeys,d=e.props,s=d.checkStrictly,u=d.onCheck,f=n.key,p={event:"check",node:n,checked:o,nativeEvent:t.nativeEvent};if(s){var m=o?to(c,f):tn(c,f);r={checked:m,halfChecked:tn(i,f)},p.checkedNodes=m.map(function(e){return l[e]}).filter(function(e){return e}).map(function(e){return e.node}),e.setUncontrolledState({checkedKeys:m})}else{var g=tu([].concat((0,ei.Z)(c),[f]),!0,l),h=g.checkedKeys,v=g.halfCheckedKeys;if(!o){var b=new Set(h);b.delete(f);var y=tu(Array.from(b),{checked:!1,halfCheckedKeys:v},l);h=y.checkedKeys,v=y.halfCheckedKeys}r=h,p.checkedNodes=[],p.checkedNodesPositions=[],p.halfCheckedKeys=v,h.forEach(function(e){var t=l[e];if(t){var n=t.node,o=t.pos;p.checkedNodes.push(n),p.checkedNodesPositions.push({node:n,pos:o})}}),e.setUncontrolledState({checkedKeys:h},!1,{halfCheckedKeys:v})}null==u||u(r,p)},e.onNodeLoad=function(t){var n=t.key,o=new Promise(function(o,r){e.setState(function(a){var l=a.loadedKeys,c=a.loadingKeys,i=void 0===c?[]:c,d=e.props,s=d.loadData,u=d.onLoad;return s&&-1===(void 0===l?[]:l).indexOf(n)&&-1===i.indexOf(n)?(s(t).then(function(){var r=to(e.state.loadedKeys,n);null==u||u(r,{event:"load",node:t}),e.setUncontrolledState({loadedKeys:r}),e.setState(function(e){return{loadingKeys:tn(e.loadingKeys,n)}}),o()}).catch(function(t){if(e.setState(function(e){return{loadingKeys:tn(e.loadingKeys,n)}}),e.loadingRetryTimes[n]=(e.loadingRetryTimes[n]||0)+1,e.loadingRetryTimes[n]>=10){var a=e.state.loadedKeys;(0,R.ZP)(!1,"Retry for `loadData` many times but still failed. No more retry."),e.setUncontrolledState({loadedKeys:to(a,n)}),o()}r(t)}),{loadingKeys:to(i,n)}):null})});return o.catch(function(){}),o},e.onNodeMouseEnter=function(t,n){var o=e.props.onMouseEnter;null==o||o({event:t,node:n})},e.onNodeMouseLeave=function(t,n){var o=e.props.onMouseLeave;null==o||o({event:t,node:n})},e.onNodeContextMenu=function(t,n){var o=e.props.onRightClick;o&&(t.preventDefault(),o({event:t,node:n}))},e.onFocus=function(){var t=e.props.onFocus;e.setState({focused:!0});for(var n=arguments.length,o=Array(n),r=0;r1&&void 0!==arguments[1]&&arguments[1],o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(!e.destroyed){var r=!1,a=!0,l={};Object.keys(t).forEach(function(n){if(n in e.props){a=!1;return}r=!0,l[n]=t[n]}),r&&(!n||a)&&e.setState((0,w.Z)((0,w.Z)({},l),o))}},e.scrollTo=function(t){e.listRef.current.scrollTo(t)},e}return(0,eF.Z)(n,[{key:"componentDidMount",value:function(){this.destroyed=!1,this.onUpdated()}},{key:"componentDidUpdate",value:function(){this.onUpdated()}},{key:"onUpdated",value:function(){var e=this.props,t=e.activeKey,n=e.itemScrollOffset;void 0!==t&&t!==this.state.activeKey&&(this.setState({activeKey:t}),null!==t&&this.scrollTo({key:t,offset:void 0===n?0:n}))}},{key:"componentWillUnmount",value:function(){window.removeEventListener("dragend",this.onWindowDragEnd),this.destroyed=!0}},{key:"resetDragState",value:function(){this.setState({dragOverNodeKey:null,dropPosition:null,dropLevelOffset:null,dropTargetKey:null,dropContainerKey:null,dropTargetPos:null,dropAllowed:!1})}},{key:"render",value:function(){var e,t,n=this.state,o=n.focused,r=n.flattenNodes,l=n.keyEntities,c=n.draggingNodeKey,i=n.activeKey,d=n.dropLevelOffset,s=n.dropContainerKey,u=n.dropTargetKey,f=n.dropPosition,p=n.dragOverNodeKey,m=n.indent,h=this.props,v=h.prefixCls,b=h.className,y=h.style,x=h.showLine,k=h.focusable,C=h.tabIndex,S=h.selectable,w=h.showIcon,Z=h.icon,K=h.switcherIcon,I=h.draggable,R=h.checkable,P=h.checkStrictly,D=h.disabled,M=h.motion,T=h.loadData,j=h.filterTreeNode,B=h.height,z=h.itemHeight,H=h.virtual,L=h.titleRender,A=h.dropIndicatorRender,_=h.onContextMenu,W=h.onScroll,q=h.direction,F=h.rootClassName,V=h.rootStyle,U=(0,X.Z)(this.props,{aria:!0,data:!0});return I&&(t="object"===(0,E.Z)(I)?I:"function"==typeof I?{nodeDraggable:I}:{}),a.createElement(eG.Provider,{value:{prefixCls:v,selectable:S,showIcon:w,icon:Z,switcherIcon:K,draggable:t,draggingNodeKey:c,checkable:R,checkStrictly:P,disabled:D,keyEntities:l,dropLevelOffset:d,dropContainerKey:s,dropTargetKey:u,dropPosition:f,dragOverNodeKey:p,indent:m,direction:q,dropIndicatorRender:A,loadData:T,filterTreeNode:j,titleRender:L,onNodeClick:this.onNodeClick,onNodeDoubleClick:this.onNodeDoubleClick,onNodeExpand:this.onNodeExpand,onNodeSelect:this.onNodeSelect,onNodeCheck:this.onNodeCheck,onNodeLoad:this.onNodeLoad,onNodeMouseEnter:this.onNodeMouseEnter,onNodeMouseLeave:this.onNodeMouseLeave,onNodeContextMenu:this.onNodeContextMenu,onNodeDragStart:this.onNodeDragStart,onNodeDragEnter:this.onNodeDragEnter,onNodeDragOver:this.onNodeDragOver,onNodeDragLeave:this.onNodeDragLeave,onNodeDragEnd:this.onNodeDragEnd,onNodeDrop:this.onNodeDrop}},a.createElement("div",{role:"tree",className:O()(v,b,F,(e={},(0,N.Z)(e,"".concat(v,"-show-line"),x),(0,N.Z)(e,"".concat(v,"-focused"),o),(0,N.Z)(e,"".concat(v,"-active-focused"),null!==i),e)),style:V},a.createElement(nz,(0,g.Z)({ref:this.listRef,prefixCls:v,style:y,data:r,disabled:D,selectable:S,checkable:!!R,motion:M,dragging:null!==c,height:B,itemHeight:z,virtual:H,focusable:k,focused:o,tabIndex:void 0===C?0:C,activeItem:this.getActiveItem(),onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.onKeyDown,onActiveChange:this.onActiveChange,onListChangeStart:this.onListChangeStart,onListChangeEnd:this.onListChangeEnd,onContextMenu:_,onScroll:W},this.getTreeNodeRequiredProps(),U))))}}],[{key:"getDerivedStateFromProps",value:function(e,t){var n,o,r=t.prevProps,a={prevProps:e};function l(t){return!r&&t in e||r&&r[t]!==e[t]}var c=t.fieldNames;if(l("fieldNames")&&(c=e1(e.fieldNames),a.fieldNames=c),l("treeData")?n=e.treeData:l("children")&&((0,R.ZP)(!1,"`children` of Tree is deprecated. Please use `treeData` instead."),n=e2(e.children)),n){a.treeData=n;var i=e4(n,{fieldNames:c});a.keyEntities=(0,w.Z)((0,N.Z)({},nP,nM),i.keyEntities)}var d=a.keyEntities||t.keyEntities;if(l("expandedKeys")||r&&l("autoExpandParent"))a.expandedKeys=e.autoExpandParent||!r&&e.defaultExpandParent?ti(e.expandedKeys,d):e.expandedKeys;else if(!r&&e.defaultExpandAll){var s=(0,w.Z)({},d);delete s[nP],a.expandedKeys=Object.keys(s).map(function(e){return s[e].key})}else!r&&e.defaultExpandedKeys&&(a.expandedKeys=e.autoExpandParent||e.defaultExpandParent?ti(e.defaultExpandedKeys,d):e.defaultExpandedKeys);if(a.expandedKeys||delete a.expandedKeys,n||a.expandedKeys){var u=e3(n||t.treeData,a.expandedKeys||t.expandedKeys,c);a.flattenNodes=u}if(e.selectable&&(l("selectedKeys")?a.selectedKeys=tl(e.selectedKeys,e):!r&&e.defaultSelectedKeys&&(a.selectedKeys=tl(e.defaultSelectedKeys,e))),e.checkable&&(l("checkedKeys")?o=tc(e.checkedKeys)||{}:!r&&e.defaultCheckedKeys?o=tc(e.defaultCheckedKeys)||{}:n&&(o=tc(e.checkedKeys)||{checkedKeys:t.checkedKeys,halfCheckedKeys:t.halfCheckedKeys}),o)){var f=o,p=f.checkedKeys,m=void 0===p?[]:p,g=f.halfCheckedKeys,h=void 0===g?[]:g;if(!e.checkStrictly){var v=tu(m,!0,d);m=v.checkedKeys,h=v.halfCheckedKeys}a.checkedKeys=m,a.halfCheckedKeys=h}return l("loadedKeys")&&(a.loadedKeys=e.loadedKeys),a}}]),n}(a.Component);nH.defaultProps={prefixCls:"rc-tree",showLine:!1,showIcon:!0,selectable:!0,multiple:!1,checkable:!1,disabled:!1,checkStrictly:!1,draggable:!1,defaultExpandParent:!0,autoExpandParent:!1,defaultExpandAll:!1,defaultExpandedKeys:[],defaultCheckedKeys:[],defaultSelectedKeys:[],dropIndicatorRender:function(e){var t=e.dropPosition,n=e.dropLevelOffset,o=e.indent,r={pointerEvents:"none",position:"absolute",right:0,backgroundColor:"red",height:2};switch(t){case -1:r.top=0,r.left=-n*o;break;case 1:r.bottom=0,r.left=-n*o;break;case 0:r.bottom=0,r.left=o}return a.createElement("div",{style:r})},allowDrop:function(){return!0},expandAction:!1},nH.TreeNode=tt;var nL={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 42h216v494z"}}]},name:"file",theme:"outlined"},nA=a.forwardRef(function(e,t){return a.createElement(tD.Z,(0,g.Z)({},e,{ref:t,icon:nL}))}),n_={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M928 444H820V330.4c0-17.7-14.3-32-32-32H473L355.7 186.2a8.15 8.15 0 00-5.5-2.2H96c-17.7 0-32 14.3-32 32v592c0 17.7 14.3 32 32 32h698c13 0 24.8-7.9 29.7-20l134-332c1.5-3.8 2.3-7.9 2.3-12 0-17.7-14.3-32-32-32zM136 256h188.5l119.6 114.4H748V444H238c-13 0-24.8 7.9-29.7 20L136 643.2V256zm635.3 512H159l103.3-256h612.4L771.3 768z"}}]},name:"folder-open",theme:"outlined"},nW=a.forwardRef(function(e,t){return a.createElement(tD.Z,(0,g.Z)({},e,{ref:t,icon:n_}))}),nq={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M880 298.4H521L403.7 186.2a8.15 8.15 0 00-5.5-2.2H144c-17.7 0-32 14.3-32 32v592c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V330.4c0-17.7-14.3-32-32-32zM840 768H184V256h188.5l119.6 114.4H840V768z"}}]},name:"folder",theme:"outlined"},nF=a.forwardRef(function(e,t){return a.createElement(tD.Z,(0,g.Z)({},e,{ref:t,icon:nq}))}),nV={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M300 276.5a56 56 0 1056-97 56 56 0 00-56 97zm0 284a56 56 0 1056-97 56 56 0 00-56 97zM640 228a56 56 0 10112 0 56 56 0 00-112 0zm0 284a56 56 0 10112 0 56 56 0 00-112 0zM300 844.5a56 56 0 1056-97 56 56 0 00-56 97zM640 796a56 56 0 10112 0 56 56 0 00-112 0z"}}]},name:"holder",theme:"outlined"},nX=a.forwardRef(function(e,t){return a.createElement(tD.Z,(0,g.Z)({},e,{ref:t,icon:nV}))}),nU=n(68710),nG=n(23159),nY=n(63074);let n$=new t0.E4("ant-tree-node-fx-do-not-use",{"0%":{opacity:0},"100%":{opacity:1}}),nJ=(e,t)=>({[".".concat(e,"-switcher-icon")]:{display:"inline-block",fontSize:10,verticalAlign:"baseline",svg:{transition:"transform ".concat(t.motionDurationSlow)}}}),nQ=(e,t)=>({[".".concat(e,"-drop-indicator")]:{position:"absolute",zIndex:1,height:2,backgroundColor:t.colorPrimary,borderRadius:1,pointerEvents:"none","&:after":{position:"absolute",top:-3,insetInlineStart:-6,width:8,height:8,backgroundColor:"transparent",border:"".concat((0,t0.bf)(t.lineWidthBold)," solid ").concat(t.colorPrimary),borderRadius:"50%",content:'""'}}}),n0=(e,t)=>{let{treeCls:n,treeNodeCls:o,treeNodePadding:r,titleHeight:a,nodeSelectedBg:l,nodeHoverBg:c}=t,i=t.paddingXS;return{[n]:Object.assign(Object.assign({},(0,t3.Wf)(t)),{background:t.colorBgContainer,borderRadius:t.borderRadius,transition:"background-color ".concat(t.motionDurationSlow),["&".concat(n,"-rtl")]:{["".concat(n,"-switcher")]:{"&_close":{["".concat(n,"-switcher-icon")]:{svg:{transform:"rotate(90deg)"}}}}},["&-focused:not(:hover):not(".concat(n,"-active-focused)")]:Object.assign({},(0,t3.oN)(t)),["".concat(n,"-list-holder-inner")]:{alignItems:"flex-start"},["&".concat(n,"-block-node")]:{["".concat(n,"-list-holder-inner")]:{alignItems:"stretch",["".concat(n,"-node-content-wrapper")]:{flex:"auto"},["".concat(o,".dragging")]:{position:"relative","&:after":{position:"absolute",top:0,insetInlineEnd:0,bottom:r,insetInlineStart:0,border:"1px solid ".concat(t.colorPrimary),opacity:0,animationName:n$,animationDuration:t.motionDurationSlow,animationPlayState:"running",animationFillMode:"forwards",content:'""',pointerEvents:"none"}}}},["".concat(o)]:{display:"flex",alignItems:"flex-start",padding:"0 0 ".concat((0,t0.bf)(r)," 0"),outline:"none","&-rtl":{direction:"rtl"},"&-disabled":{["".concat(n,"-node-content-wrapper")]:{color:t.colorTextDisabled,cursor:"not-allowed","&:hover":{background:"transparent"}}},["&-active ".concat(n,"-node-content-wrapper")]:{background:t.controlItemBgHover},["&:not(".concat(o,"-disabled).filter-node ").concat(n,"-title")]:{color:"inherit",fontWeight:500},"&-draggable":{cursor:"grab",["".concat(n,"-draggable-icon")]:{flexShrink:0,width:a,lineHeight:"".concat((0,t0.bf)(a)),textAlign:"center",visibility:"visible",opacity:.2,transition:"opacity ".concat(t.motionDurationSlow),["".concat(o,":hover &")]:{opacity:.45}},["&".concat(o,"-disabled")]:{["".concat(n,"-draggable-icon")]:{visibility:"hidden"}}}},["".concat(n,"-indent")]:{alignSelf:"stretch",whiteSpace:"nowrap",userSelect:"none","&-unit":{display:"inline-block",width:a}},["".concat(n,"-draggable-icon")]:{visibility:"hidden"},["".concat(n,"-switcher")]:Object.assign(Object.assign({},nJ(e,t)),{position:"relative",flex:"none",alignSelf:"stretch",width:a,margin:0,lineHeight:"".concat((0,t0.bf)(a)),textAlign:"center",cursor:"pointer",userSelect:"none",transition:"all ".concat(t.motionDurationSlow),borderRadius:t.borderRadius,"&-noop":{cursor:"unset"},["&:not(".concat(n,"-switcher-noop):hover")]:{backgroundColor:t.colorBgTextHover},"&_close":{["".concat(n,"-switcher-icon")]:{svg:{transform:"rotate(-90deg)"}}},"&-loading-icon":{color:t.colorPrimary},"&-leaf-line":{position:"relative",zIndex:1,display:"inline-block",width:"100%",height:"100%","&:before":{position:"absolute",top:0,insetInlineEnd:t.calc(a).div(2).equal(),bottom:t.calc(r).mul(-1).equal(),marginInlineStart:-1,borderInlineEnd:"1px solid ".concat(t.colorBorder),content:'""'},"&:after":{position:"absolute",width:t.calc(t.calc(a).div(2).equal()).mul(.8).equal(),height:t.calc(a).div(2).equal(),borderBottom:"1px solid ".concat(t.colorBorder),content:'""'}}}),["".concat(n,"-checkbox")]:{top:"initial",marginInlineEnd:i,alignSelf:"flex-start",marginTop:t.marginXXS},["".concat(n,"-node-content-wrapper, ").concat(n,"-checkbox + span")]:{position:"relative",zIndex:"auto",minHeight:a,margin:0,padding:"0 ".concat((0,t0.bf)(t.calc(t.paddingXS).div(2).equal())),color:"inherit",lineHeight:"".concat((0,t0.bf)(a)),background:"transparent",borderRadius:t.borderRadius,cursor:"pointer",transition:"all ".concat(t.motionDurationMid,", border 0s, line-height 0s, box-shadow 0s"),"&:hover":{backgroundColor:c},["&".concat(n,"-node-selected")]:{backgroundColor:l},["".concat(n,"-iconEle")]:{display:"inline-block",width:a,height:a,lineHeight:"".concat((0,t0.bf)(a)),textAlign:"center",verticalAlign:"top","&:empty":{display:"none"}}},["".concat(n,"-unselectable ").concat(n,"-node-content-wrapper:hover")]:{backgroundColor:"transparent"},["".concat(n,"-node-content-wrapper")]:Object.assign({lineHeight:"".concat((0,t0.bf)(a)),userSelect:"none"},nQ(e,t)),["".concat(o,".drop-container")]:{"> [draggable]":{boxShadow:"0 0 0 2px ".concat(t.colorPrimary)}},"&-show-line":{["".concat(n,"-indent")]:{"&-unit":{position:"relative",height:"100%","&:before":{position:"absolute",top:0,insetInlineEnd:t.calc(a).div(2).equal(),bottom:t.calc(r).mul(-1).equal(),borderInlineEnd:"1px solid ".concat(t.colorBorder),content:'""'},"&-end":{"&:before":{display:"none"}}}},["".concat(n,"-switcher")]:{background:"transparent","&-line-icon":{verticalAlign:"-0.15em"}}},["".concat(o,"-leaf-last")]:{["".concat(n,"-switcher")]:{"&-leaf-line":{"&:before":{top:"auto !important",bottom:"auto !important",height:"".concat((0,t0.bf)(t.calc(a).div(2).equal())," !important")}}}}})}},n1=e=>{let{treeCls:t,treeNodeCls:n,treeNodePadding:o,directoryNodeSelectedBg:r,directoryNodeSelectedColor:a}=e;return{["".concat(t).concat(t,"-directory")]:{[n]:{position:"relative","&:before":{position:"absolute",top:0,insetInlineEnd:0,bottom:o,insetInlineStart:0,transition:"background-color ".concat(e.motionDurationMid),content:'""',pointerEvents:"none"},"&:hover":{"&:before":{background:e.controlItemBgHover}},"> *":{zIndex:1},["".concat(t,"-switcher")]:{transition:"color ".concat(e.motionDurationMid)},["".concat(t,"-node-content-wrapper")]:{borderRadius:0,userSelect:"none","&:hover":{background:"transparent"},["&".concat(t,"-node-selected")]:{color:a,background:"transparent"}},"&-selected":{"\n &:hover::before,\n &::before\n ":{background:r},["".concat(t,"-switcher")]:{color:a},["".concat(t,"-node-content-wrapper")]:{color:a,background:"transparent"}}}}}},n2=(e,t)=>{let n=".".concat(e),o=t.calc(t.paddingXS).div(2).equal(),r=(0,t4.TS)(t,{treeCls:n,treeNodeCls:"".concat(n,"-treenode"),treeNodePadding:o});return[n0(e,r),n1(r)]},n3=e=>{let{controlHeightSM:t}=e;return{titleHeight:t,nodeHoverBg:e.controlItemBgHover,nodeSelectedBg:e.controlItemBgActive}};var n4=(0,t6.I$)("Tree",(e,t)=>{let{prefixCls:n}=t;return[{[e.componentCls]:(0,nG.C2)("".concat(n,"-checkbox"),e)},n2(n,e),(0,nY.Z)(e)]},e=>{let{colorTextLightSolid:t,colorPrimary:n}=e;return Object.assign(Object.assign({},n3(e)),{directoryNodeSelectedColor:t,directoryNodeSelectedBg:n})});function n6(e){let{dropPosition:t,dropLevelOffset:n,prefixCls:o,indent:r,direction:l="ltr"}=e,c="ltr"===l?"left":"right",i={[c]:-n*r+4,["ltr"===l?"right":"left"]:0};switch(t){case -1:i.top=-3;break;case 1:i.bottom=-3;break;default:i.bottom=-3,i[c]=r+4}return a.createElement("div",{style:i,className:"".concat(o,"-drop-indicator")})}var n8={icon:{tag:"svg",attrs:{viewBox:"0 0 1024 1024",focusable:"false"},children:[{tag:"path",attrs:{d:"M840.4 300H183.6c-19.7 0-30.7 20.8-18.5 35l328.4 380.8c9.4 10.9 27.5 10.9 37 0L858.9 335c12.2-14.2 1.2-35-18.5-35z"}}]},name:"caret-down",theme:"filled"},n5=a.forwardRef(function(e,t){return a.createElement(tD.Z,(0,g.Z)({},e,{ref:t,icon:n8}))}),n7=n(61935),n9={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M328 544h368c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H328c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8z"}},{tag:"path",attrs:{d:"M880 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:"minus-square",theme:"outlined"},oe=a.forwardRef(function(e,t){return a.createElement(tD.Z,(0,g.Z)({},e,{ref:t,icon:n9}))}),ot={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M328 544h152v152c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V544h152c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H544V328c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v152H328c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8z"}},{tag:"path",attrs:{d:"M880 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:"plus-square",theme:"outlined"},on=a.forwardRef(function(e,t){return a.createElement(tD.Z,(0,g.Z)({},e,{ref:t,icon:ot}))}),oo=n(19722),or=e=>{let t;let{prefixCls:n,switcherIcon:o,treeNodeProps:r,showLine:l}=e,{isLeaf:c,expanded:i,loading:d}=r;if(d)return a.createElement(n7.Z,{className:"".concat(n,"-switcher-loading-icon")});if(l&&"object"==typeof l&&(t=l.showLeafIcon),c){if(!l)return null;if("boolean"!=typeof t&&t){let e="function"==typeof t?t(r):t;return(0,oo.l$)(e)?(0,oo.Tm)(e,{className:O()(e.props.className||"","".concat(n,"-switcher-line-custom-icon"))}):e}return t?a.createElement(nA,{className:"".concat(n,"-switcher-line-icon")}):a.createElement("span",{className:"".concat(n,"-switcher-leaf-line")})}let s="".concat(n,"-switcher-icon"),u="function"==typeof o?o(r):o;return(0,oo.l$)(u)?(0,oo.Tm)(u,{className:O()(u.props.className||"",s)}):void 0!==u?u:l?i?a.createElement(oe,{className:"".concat(n,"-switcher-line-icon")}):a.createElement(on,{className:"".concat(n,"-switcher-line-icon")}):a.createElement(n5,{className:s})};let oa=a.forwardRef((e,t)=>{var n;let{getPrefixCls:o,direction:r,virtual:l,tree:c}=a.useContext(tN.E_),{prefixCls:i,className:d,showIcon:s=!1,showLine:u,switcherIcon:f,blockNode:p=!1,children:m,checkable:g=!1,selectable:h=!0,draggable:v,motion:b,style:y}=e,x=o("tree",i),k=o(),C=null!=b?b:Object.assign(Object.assign({},(0,nU.Z)(k)),{motionAppear:!1}),S=Object.assign(Object.assign({},e),{checkable:g,selectable:h,showIcon:s,motion:C,blockNode:p,showLine:!!u,dropIndicatorRender:n6}),[E,w,N]=n4(x),[,Z]=(0,nc.ZP)(),K=Z.paddingXS/2+((null===(n=Z.Tree)||void 0===n?void 0:n.titleHeight)||Z.controlHeightSM),I=a.useMemo(()=>{if(!v)return!1;let e={};switch(typeof v){case"function":e.nodeDraggable=v;break;case"object":e=Object.assign({},v)}return!1!==e.icon&&(e.icon=e.icon||a.createElement(nX,null)),e},[v]);return E(a.createElement(nH,Object.assign({itemHeight:K,ref:t,virtual:l},S,{style:Object.assign(Object.assign({},null==c?void 0:c.style),y),prefixCls:x,className:O()({["".concat(x,"-icon-hide")]:!s,["".concat(x,"-block-node")]:p,["".concat(x,"-unselectable")]:!h,["".concat(x,"-rtl")]:"rtl"===r},null==c?void 0:c.className,d,w,N),direction:r,checkable:g?a.createElement("span",{className:"".concat(x,"-checkbox-inner")}):g,selectable:h,switcherIcon:e=>a.createElement(or,{prefixCls:x,switcherIcon:f,treeNodeProps:e,showLine:u}),draggable:I}),m))});function ol(e,t,n){let{key:o,children:r}=n;e.forEach(function(e){let a=e[o],l=e[r];!1!==t(a,e)&&ol(l||[],t,n)})}(o=r||(r={}))[o.None=0]="None",o[o.Start=1]="Start",o[o.End=2]="End";var oc=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>t.indexOf(o)&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var r=0,o=Object.getOwnPropertySymbols(e);rt.indexOf(o[r])&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]]);return n};function oi(e){let{isLeaf:t,expanded:n}=e;return t?a.createElement(nA,null):n?a.createElement(nW,null):a.createElement(nF,null)}function od(e){let{treeData:t,children:n}=e;return t||e2(n)}let os=a.forwardRef((e,t)=>{var{defaultExpandAll:n,defaultExpandParent:o,defaultExpandedKeys:l}=e,c=oc(e,["defaultExpandAll","defaultExpandParent","defaultExpandedKeys"]);let i=a.useRef(),d=a.useRef(),s=()=>{let{keyEntities:e}=e4(od(c));return n?Object.keys(e):o?ti(c.expandedKeys||l||[],e):c.expandedKeys||l},[u,f]=a.useState(c.selectedKeys||c.defaultSelectedKeys||[]),[p,m]=a.useState(()=>s());a.useEffect(()=>{"selectedKeys"in c&&f(c.selectedKeys)},[c.selectedKeys]),a.useEffect(()=>{"expandedKeys"in c&&m(c.expandedKeys)},[c.expandedKeys]);let{getPrefixCls:g,direction:h}=a.useContext(tN.E_),{prefixCls:v,className:b,showIcon:y=!0,expandAction:x="click"}=c,k=oc(c,["prefixCls","className","showIcon","expandAction"]),C=g("tree",v),S=O()("".concat(C,"-directory"),{["".concat(C,"-directory-rtl")]:"rtl"===h},b);return a.createElement(oa,Object.assign({icon:oi,ref:t,blockNode:!0},k,{showIcon:y,expandAction:x,prefixCls:C,className:S,expandedKeys:p,selectedKeys:u,onSelect:(e,t)=>{var n;let o;let{multiple:a,fieldNames:l}=c,{node:s,nativeEvent:u}=t,{key:m=""}=s,g=od(c),h=Object.assign(Object.assign({},t),{selected:!0}),v=(null==u?void 0:u.ctrlKey)||(null==u?void 0:u.metaKey),b=null==u?void 0:u.shiftKey;a&&v?(o=e,i.current=m,d.current=o):a&&b?o=Array.from(new Set([].concat((0,ei.Z)(d.current||[]),(0,ei.Z)(function(e){let{treeData:t,expandedKeys:n,startKey:o,endKey:a,fieldNames:l}=e,c=[],i=r.None;return o&&o===a?[o]:o&&a?(ol(t,e=>{if(i===r.End)return!1;if(e===o||e===a){if(c.push(e),i===r.None)i=r.Start;else if(i===r.Start)return i=r.End,!1}else i===r.Start&&c.push(e);return n.includes(e)},e1(l)),c):[]}({treeData:g,expandedKeys:p,startKey:m,endKey:i.current,fieldNames:l}))))):(o=[m],i.current=m,d.current=o),h.selectedNodes=function(e,t,n){let o=(0,ei.Z)(t),r=[];return ol(e,(e,t)=>{let n=o.indexOf(e);return -1!==n&&(r.push(t),o.splice(n,1)),!!o.length},e1(n)),r}(g,o,l),null===(n=c.onSelect)||void 0===n||n.call(c,o,h),"selectedKeys"in c||f(o)},onExpand:(e,t)=>{var n;return"expandedKeys"in c||m(e),null===(n=c.onExpand)||void 0===n?void 0:n.call(c,e,t)}}))});oa.DirectoryTree=os,oa.TreeNode=tt;var ou=n(29436),of=n(64482),op=function(e){let{value:t,onChange:n,filterSearch:o,tablePrefixCls:r,locale:l}=e;return o?a.createElement("div",{className:"".concat(r,"-filter-dropdown-search")},a.createElement(of.default,{prefix:a.createElement(ou.Z,null),placeholder:l.filterSearchPlaceholder,onChange:n,value:t,htmlSize:1,className:"".concat(r,"-filter-dropdown-search-input")})):null};let om=e=>{let{keyCode:t}=e;t===tH.Z.ENTER&&e.stopPropagation()},og=a.forwardRef((e,t)=>a.createElement("div",{className:e.className,onClick:e=>e.stopPropagation(),onKeyDown:om,ref:t},e.children));function oh(e){let t=[];return(e||[]).forEach(e=>{let{value:n,children:o}=e;t.push(n),o&&(t=[].concat((0,ei.Z)(t),(0,ei.Z)(oh(o))))}),t}function ov(e,t){return("string"==typeof t||"number"==typeof t)&&(null==t?void 0:t.toString().toLowerCase().includes(e.trim().toLowerCase()))}var ob=function(e){var t,n;let o,r;let{tablePrefixCls:l,prefixCls:c,column:i,dropdownPrefixCls:d,columnKey:s,filterMultiple:f,filterMode:p="menu",filterSearch:m=!1,filterState:g,triggerFilter:h,locale:v,children:b,getPopupContainer:y,rootClassName:x}=e,{filterDropdownOpen:k,onFilterDropdownOpenChange:C,filterResetToDefaultFilteredValue:S,defaultFilteredValue:E,filterDropdownVisible:w,onFilterDropdownVisibleChange:N}=i,[Z,K]=a.useState(!1),I=!!(g&&((null===(t=g.filteredKeys)||void 0===t?void 0:t.length)||g.forceFiltered)),R=e=>{K(e),null==C||C(e),null==N||N(e)},P=null!==(n=null!=k?k:w)&&void 0!==n?n:Z,D=null==g?void 0:g.filteredKeys,[M,T]=function(e){let t=a.useRef(e),n=(0,nb.Z)();return[()=>t.current,e=>{t.current=e,n()}]}(D||[]),j=e=>{let{selectedKeys:t}=e;T(t)};a.useEffect(()=>{Z&&j({selectedKeys:D||[]})},[D]);let[B,z]=a.useState([]),[H,L]=a.useState(""),A=e=>{let{value:t}=e.target;L(t)};a.useEffect(()=>{Z||L("")},[Z]);let _=e=>{let t=e&&e.length?e:null;if(null===t&&(!g||!g.filteredKeys)||(0,u.Z)(t,null==g?void 0:g.filteredKeys,!0))return null;h({column:i,key:s,filteredKeys:t})},W=()=>{R(!1),_(M())},q=function(){let{confirm:e,closeDropdown:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{confirm:!1,closeDropdown:!1};e&&_([]),t&&R(!1),L(""),S?T((E||[]).map(e=>String(e))):T([])},F=O()({["".concat(d,"-menu-without-submenu")]:!(i.filters||[]).some(e=>{let{children:t}=e;return t})}),V=e=>{let{filters:t}=e;return(t||[]).map((e,t)=>{let n=String(e.value),o={title:e.text,key:void 0!==e.value?n:String(t)};return e.children&&(o.children=V({filters:e.children})),o})},X=e=>{var t;return Object.assign(Object.assign({},e),{text:e.title,value:e.key,children:(null===(t=e.children)||void 0===t?void 0:t.map(e=>X(e)))||[]})};if("function"==typeof i.filterDropdown)o=i.filterDropdown({prefixCls:"".concat(d,"-custom"),setSelectedKeys:e=>j({selectedKeys:e}),selectedKeys:M(),confirm:function(){let{closeDropdown:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{closeDropdown:!0};e&&R(!1),_(M())},clearFilters:q,filters:i.filters,visible:P,close:()=>{R(!1)}});else if(i.filterDropdown)o=i.filterDropdown;else{let e=M()||[];o=a.createElement(a.Fragment,null,0===(i.filters||[]).length?a.createElement(nx.Z,{image:nx.Z.PRESENTED_IMAGE_SIMPLE,description:v.filterEmptyText,imageStyle:{height:24},style:{margin:0,padding:"16px 0"}}):"tree"===p?a.createElement(a.Fragment,null,a.createElement(op,{filterSearch:m,value:H,onChange:A,tablePrefixCls:l,locale:v}),a.createElement("div",{className:"".concat(l,"-filter-dropdown-tree")},f?a.createElement(tm.Z,{checked:e.length===oh(i.filters).length,indeterminate:e.length>0&&e.length{e.target.checked?T(oh(null==i?void 0:i.filters).map(e=>String(e))):T([])}},v.filterCheckall):null,a.createElement(oa,{checkable:!0,selectable:!1,blockNode:!0,multiple:f,checkStrictly:!f,className:"".concat(d,"-menu"),onCheck:(e,t)=>{let{node:n,checked:o}=t;f?j({selectedKeys:e}):j({selectedKeys:o&&n.key?[n.key]:[]})},checkedKeys:e,selectedKeys:e,showIcon:!1,treeData:V({filters:i.filters}),autoExpandParent:!0,defaultExpandAll:!0,filterTreeNode:H.trim()?e=>"function"==typeof m?m(H,X(e)):ov(H,e.title):void 0}))):a.createElement(a.Fragment,null,a.createElement(op,{filterSearch:m,value:H,onChange:A,tablePrefixCls:l,locale:v}),a.createElement(nk.Z,{selectable:!0,multiple:f,prefixCls:"".concat(d,"-menu"),className:F,onSelect:j,onDeselect:j,selectedKeys:e,getPopupContainer:y,openKeys:B,onOpenChange:e=>{z(e)},items:function e(t){let{filters:n,prefixCls:o,filteredKeys:r,filterMultiple:l,searchValue:c,filterSearch:i}=t;return n.map((t,n)=>{let d=String(t.value);if(t.children)return{key:d||n,label:t.text,popupClassName:"".concat(o,"-dropdown-submenu"),children:e({filters:t.children,prefixCls:o,filteredKeys:r,filterMultiple:l,searchValue:c,filterSearch:i})};let s=l?tm.Z:th.ZP,u={key:void 0!==t.value?d:n,label:a.createElement(a.Fragment,null,a.createElement(s,{checked:r.includes(d)}),a.createElement("span",null,t.text))};return c.trim()?"function"==typeof i?i(c,t)?u:null:ov(c,t.text)?u:null:u})}({filters:i.filters||[],filterSearch:m,prefixCls:c,filteredKeys:M(),filterMultiple:f,searchValue:H})})),a.createElement("div",{className:"".concat(c,"-dropdown-btns")},a.createElement(ny.ZP,{type:"link",size:"small",disabled:S?(0,u.Z)((E||[]).map(e=>String(e)),e,!0):0===e.length,onClick:()=>q()},v.filterReset),a.createElement(ny.ZP,{type:"primary",size:"small",onClick:W},v.filterConfirm)))}i.filterDropdown&&(o=a.createElement(nC.J,{selectable:void 0},o)),r="function"==typeof i.filterIcon?i.filterIcon(I):i.filterIcon?i.filterIcon:a.createElement(nv,null);let{direction:U}=a.useContext(tN.E_);return a.createElement("div",{className:"".concat(c,"-column")},a.createElement("span",{className:"".concat(l,"-column-title")},b),a.createElement(tg.Z,{dropdownRender:()=>a.createElement(og,{className:"".concat(c,"-dropdown")},o),trigger:["click"],open:P,onOpenChange:(e,t)=>{"trigger"===t.source&&(e&&void 0!==D&&T(D||[]),R(e),e||i.filterDropdown||W())},getPopupContainer:y,placement:"rtl"===U?"bottomLeft":"bottomRight",rootClassName:x},a.createElement("span",{role:"button",tabIndex:-1,className:O()("".concat(c,"-trigger"),{active:I}),onClick:e=>{e.stopPropagation()}},r)))};function oy(e,t,n){let o=[];return(e||[]).forEach((e,r)=>{var a;let l=nm(r,n);if(e.filters||"filterDropdown"in e||"onFilter"in e){if("filteredValue"in e){let t=e.filteredValue;"filterDropdown"in e||(t=null!==(a=null==t?void 0:t.map(String))&&void 0!==a?a:t),o.push({column:e,key:np(e,l),filteredKeys:t,forceFiltered:e.filtered})}else o.push({column:e,key:np(e,l),filteredKeys:t&&e.defaultFilteredValue?e.defaultFilteredValue:void 0,forceFiltered:e.filtered})}"children"in e&&(o=[].concat((0,ei.Z)(o),(0,ei.Z)(oy(e.children,t,l))))}),o}function ox(e){let t={};return e.forEach(e=>{let{key:n,filteredKeys:o,column:r}=e,{filters:a,filterDropdown:l}=r;if(l)t[n]=o||null;else if(Array.isArray(o)){let e=oh(a);t[n]=e.filter(e=>o.includes(String(e)))}else t[n]=null}),t}function ok(e,t){return t.reduce((e,t)=>{let{column:{onFilter:n,filters:o},filteredKeys:r}=t;return n&&r&&r.length?e.filter(e=>r.some(t=>{let r=oh(o),a=r.findIndex(e=>String(e)===String(t));return n(-1!==a?r[a]:t,e)})):e},e)}let oC=e=>e.flatMap(e=>"children"in e?[e].concat((0,ei.Z)(oC(e.children||[]))):[e]);var oS=function(e){let{prefixCls:t,dropdownPrefixCls:n,mergedColumns:o,onFilterChange:r,getPopupContainer:l,locale:c,rootClassName:i}=e;(0,tp.ln)("Table");let d=a.useMemo(()=>oC(o||[]),[o]),[s,u]=a.useState(()=>oy(d,!0)),f=a.useMemo(()=>{let e=oy(d,!1);if(0===e.length)return e;let t=!0;if(e.forEach(e=>{let{filteredKeys:n}=e;void 0!==n&&(t=!1)}),t){let e=(d||[]).map((e,t)=>np(e,nm(t)));return s.filter(t=>{let{key:n}=t;return e.includes(n)}).map(t=>{let n=d[e.findIndex(e=>e===t.key)];return Object.assign(Object.assign({},t),{column:Object.assign(Object.assign({},t.column),n),forceFiltered:n.filtered})})}return e},[d,s]),p=a.useMemo(()=>ox(f),[f]),m=e=>{let t=f.filter(t=>{let{key:n}=t;return n!==e.key});t.push(e),u(t),r(ox(t),t)};return[e=>(function e(t,n,o,r,l,c,i,d,s){return o.map((o,u)=>{let f=nm(u,d),{filterMultiple:p=!0,filterMode:m,filterSearch:g}=o,h=o;if(h.filters||h.filterDropdown){let e=np(h,f),d=r.find(t=>{let{key:n}=t;return e===n});h=Object.assign(Object.assign({},h),{title:r=>a.createElement(ob,{tablePrefixCls:t,prefixCls:"".concat(t,"-filter"),dropdownPrefixCls:n,column:h,columnKey:e,filterState:d,filterMultiple:p,filterMode:m,filterSearch:g,triggerFilter:c,locale:l,getPopupContainer:i,rootClassName:s},ng(o.title,r))})}return"children"in h&&(h=Object.assign(Object.assign({},h),{children:e(t,n,h.children,r,l,c,i,f,s)})),h})})(t,n,e,f,c,m,l,void 0,i),f,p]},oE=function(){let e=Object.assign({},arguments.length<=0?void 0:arguments[0]);for(let t=1;t{let o=n[t];void 0!==o&&(e[t]=o)})}return e},ow=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>t.indexOf(o)&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var r=0,o=Object.getOwnPropertySymbols(e);rt.indexOf(o[r])&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]]);return n},oN=function(e,t,n){let o=n&&"object"==typeof n?n:{},{total:r=0}=o,l=ow(o,["total"]),[c,i]=(0,a.useState)(()=>({current:"defaultCurrent"in l?l.defaultCurrent:1,pageSize:"defaultPageSize"in l?l.defaultPageSize:10})),d=oE(c,l,{total:r>0?r:e}),s=Math.ceil((r||e)/d.pageSize);d.current>s&&(d.current=s||1);let u=(e,t)=>{i({current:null!=e?e:1,pageSize:t||d.pageSize})};return!1===n?[{},()=>{}]:[Object.assign(Object.assign({},d),{onChange:(e,o)=>{var r;n&&(null===(r=n.onChange)||void 0===r||r.call(n,e,o)),u(e,o),t(e,o||(null==d?void 0:d.pageSize))}}),u]},oZ={icon:{tag:"svg",attrs:{viewBox:"0 0 1024 1024",focusable:"false"},children:[{tag:"path",attrs:{d:"M840.4 300H183.6c-19.7 0-30.7 20.8-18.5 35l328.4 380.8c9.4 10.9 27.5 10.9 37 0L858.9 335c12.2-14.2 1.2-35-18.5-35z"}}]},name:"caret-down",theme:"outlined"},oO=a.forwardRef(function(e,t){return a.createElement(tD.Z,(0,g.Z)({},e,{ref:t,icon:oZ}))}),oK={icon:{tag:"svg",attrs:{viewBox:"0 0 1024 1024",focusable:"false"},children:[{tag:"path",attrs:{d:"M858.9 689L530.5 308.2c-9.4-10.9-27.5-10.9-37 0L165.1 689c-12.2 14.2-1.2 35 18.5 35h656.8c19.7 0 30.7-20.8 18.5-35z"}}]},name:"caret-up",theme:"outlined"},oI=a.forwardRef(function(e,t){return a.createElement(tD.Z,(0,g.Z)({},e,{ref:t,icon:oK}))}),oR=n(89970);let oP="ascend",oD="descend";function oM(e){return"object"==typeof e.sorter&&"number"==typeof e.sorter.multiple&&e.sorter.multiple}function oT(e){return"function"==typeof e?e:!!e&&"object"==typeof e&&!!e.compare&&e.compare}function oj(e,t,n){let o=[];function r(e,t){o.push({column:e,key:np(e,t),multiplePriority:oM(e),sortOrder:e.sortOrder})}return(e||[]).forEach((e,a)=>{let l=nm(a,n);e.children?("sortOrder"in e&&r(e,l),o=[].concat((0,ei.Z)(o),(0,ei.Z)(oj(e.children,t,l)))):e.sorter&&("sortOrder"in e?r(e,l):t&&e.defaultSortOrder&&o.push({column:e,key:np(e,l),multiplePriority:oM(e),sortOrder:e.defaultSortOrder}))}),o}function oB(e){let{column:t,sortOrder:n}=e;return{column:t,order:n,field:t.dataIndex,columnKey:t.key}}function oz(e){let t=e.filter(e=>{let{sortOrder:t}=e;return t}).map(oB);return 0===t.length&&e.length?Object.assign(Object.assign({},oB(e[e.length-1])),{column:void 0}):t.length<=1?t[0]||{}:t}function oH(e,t,n){let o=t.slice().sort((e,t)=>t.multiplePriority-e.multiplePriority),r=e.slice(),a=o.filter(e=>{let{column:{sorter:t},sortOrder:n}=e;return oT(t)&&n});return a.length?r.sort((e,t)=>{for(let n=0;n{let o=e[n];return o?Object.assign(Object.assign({},e),{[n]:oH(o,t,n)}):e}):r}var oL=x(eP,(e,t)=>{let{_renderTimes:n}=e,{_renderTimes:o}=t;return n!==o}),oA=x(e_,(e,t)=>{let{_renderTimes:n}=e,{_renderTimes:o}=t;return n!==o}),o_=n(36360),oW=e=>{let{componentCls:t,lineWidth:n,lineType:o,tableBorderColor:r,tableHeaderBg:a,tablePaddingVertical:l,tablePaddingHorizontal:c,calc:i}=e,d="".concat((0,t0.bf)(n)," ").concat(o," ").concat(r),s=(e,o,r)=>({["&".concat(t,"-").concat(e)]:{["> ".concat(t,"-container")]:{["> ".concat(t,"-content, > ").concat(t,"-body")]:{"\n > table > tbody > tr > th,\n > table > tbody > tr > td\n ":{["> ".concat(t,"-expanded-row-fixed")]:{margin:"".concat((0,t0.bf)(i(o).mul(-1).equal()),"\n ").concat((0,t0.bf)(i(i(r).add(n)).mul(-1).equal()))}}}}}});return{["".concat(t,"-wrapper")]:{["".concat(t).concat(t,"-bordered")]:Object.assign(Object.assign(Object.assign({["> ".concat(t,"-title")]:{border:d,borderBottom:0},["> ".concat(t,"-container")]:{borderInlineStart:d,borderTop:d,["\n > ".concat(t,"-content,\n > ").concat(t,"-header,\n > ").concat(t,"-body,\n > ").concat(t,"-summary\n ")]:{"> table":{"\n > thead > tr > th,\n > thead > tr > td,\n > tbody > tr > th,\n > tbody > tr > td,\n > tfoot > tr > th,\n > tfoot > tr > td\n ":{borderInlineEnd:d},"> thead":{"> tr:not(:last-child) > th":{borderBottom:d},"> tr > th::before":{backgroundColor:"transparent !important"}},"\n > thead > tr,\n > tbody > tr,\n > tfoot > tr\n ":{["> ".concat(t,"-cell-fix-right-first::after")]:{borderInlineEnd:d}},"\n > tbody > tr > th,\n > tbody > tr > td\n ":{["> ".concat(t,"-expanded-row-fixed")]:{margin:"".concat((0,t0.bf)(i(l).mul(-1).equal())," ").concat((0,t0.bf)(i(i(c).add(n)).mul(-1).equal())),"&::after":{position:"absolute",top:0,insetInlineEnd:n,bottom:0,borderInlineEnd:d,content:'""'}}}}}},["&".concat(t,"-scroll-horizontal")]:{["> ".concat(t,"-container > ").concat(t,"-body")]:{"> table > tbody":{["\n > tr".concat(t,"-expanded-row,\n > tr").concat(t,"-placeholder\n ")]:{"> th, > td":{borderInlineEnd:0}}}}}},s("middle",e.tablePaddingVerticalMiddle,e.tablePaddingHorizontalMiddle)),s("small",e.tablePaddingVerticalSmall,e.tablePaddingHorizontalSmall)),{["> ".concat(t,"-footer")]:{border:d,borderTop:0}}),["".concat(t,"-cell")]:{["".concat(t,"-container:first-child")]:{borderTop:0},"&-scrollbar:not([rowspan])":{boxShadow:"0 ".concat((0,t0.bf)(n)," 0 ").concat((0,t0.bf)(n)," ").concat(a)}},["".concat(t,"-bordered ").concat(t,"-cell-scrollbar")]:{borderInlineEnd:d}}}},oq=e=>{let{componentCls:t}=e;return{["".concat(t,"-wrapper")]:{["".concat(t,"-cell-ellipsis")]:Object.assign(Object.assign({},t3.vS),{wordBreak:"keep-all",["\n &".concat(t,"-cell-fix-left-last,\n &").concat(t,"-cell-fix-right-first\n ")]:{overflow:"visible",["".concat(t,"-cell-content")]:{display:"block",overflow:"hidden",textOverflow:"ellipsis"}},["".concat(t,"-column-title")]:{overflow:"hidden",textOverflow:"ellipsis",wordBreak:"keep-all"}})}}},oF=e=>{let{componentCls:t}=e;return{["".concat(t,"-wrapper")]:{["".concat(t,"-tbody > tr").concat(t,"-placeholder")]:{textAlign:"center",color:e.colorTextDisabled,"\n &:hover > th,\n &:hover > td,\n ":{background:e.colorBgContainer}}}}},oV=n(76122),oX=e=>{let{componentCls:t,antCls:n,motionDurationSlow:o,lineWidth:r,paddingXS:a,lineType:l,tableBorderColor:c,tableExpandIconBg:i,tableExpandColumnWidth:d,borderRadius:s,tablePaddingVertical:u,tablePaddingHorizontal:f,tableExpandedRowBg:p,paddingXXS:m,expandIconMarginTop:g,expandIconSize:h,expandIconHalfInner:v,expandIconScale:b,calc:y}=e,x="".concat((0,t0.bf)(r)," ").concat(l," ").concat(c),k=y(m).sub(r).equal();return{["".concat(t,"-wrapper")]:{["".concat(t,"-expand-icon-col")]:{width:d},["".concat(t,"-row-expand-icon-cell")]:{textAlign:"center",["".concat(t,"-row-expand-icon")]:{display:"inline-flex",float:"none",verticalAlign:"sub"}},["".concat(t,"-row-indent")]:{height:1,float:"left"},["".concat(t,"-row-expand-icon")]:Object.assign(Object.assign({},(0,oV.N)(e)),{position:"relative",float:"left",boxSizing:"border-box",width:h,height:h,padding:0,color:"inherit",lineHeight:(0,t0.bf)(h),background:i,border:x,borderRadius:s,transform:"scale(".concat(b,")"),transition:"all ".concat(o),userSelect:"none","&:focus, &:hover, &:active":{borderColor:"currentcolor"},"&::before, &::after":{position:"absolute",background:"currentcolor",transition:"transform ".concat(o," ease-out"),content:'""'},"&::before":{top:v,insetInlineEnd:k,insetInlineStart:k,height:r},"&::after":{top:k,bottom:k,insetInlineStart:v,width:r,transform:"rotate(90deg)"},"&-collapsed::before":{transform:"rotate(-180deg)"},"&-collapsed::after":{transform:"rotate(0deg)"},"&-spaced":{"&::before, &::after":{display:"none",content:"none"},background:"transparent",border:0,visibility:"hidden"}}),["".concat(t,"-row-indent + ").concat(t,"-row-expand-icon")]:{marginTop:g,marginInlineEnd:a},["tr".concat(t,"-expanded-row")]:{"&, &:hover":{"> th, > td":{background:p}},["".concat(n,"-descriptions-view")]:{display:"flex",table:{flex:"auto",width:"auto"}}},["".concat(t,"-expanded-row-fixed")]:{position:"relative",margin:"".concat((0,t0.bf)(y(u).mul(-1).equal())," ").concat((0,t0.bf)(y(f).mul(-1).equal())),padding:"".concat((0,t0.bf)(u)," ").concat((0,t0.bf)(f))}}}},oU=e=>{let{componentCls:t,antCls:n,iconCls:o,tableFilterDropdownWidth:r,tableFilterDropdownSearchWidth:a,paddingXXS:l,paddingXS:c,colorText:i,lineWidth:d,lineType:s,tableBorderColor:u,headerIconColor:f,fontSizeSM:p,tablePaddingHorizontal:m,borderRadius:g,motionDurationSlow:h,colorTextDescription:v,colorPrimary:b,tableHeaderFilterActiveBg:y,colorTextDisabled:x,tableFilterDropdownBg:k,tableFilterDropdownHeight:C,controlItemBgHover:S,controlItemBgActive:E,boxShadowSecondary:w,filterDropdownMenuBg:N,calc:Z}=e,O="".concat(n,"-dropdown"),K="".concat(t,"-filter-dropdown"),I="".concat(n,"-tree"),R="".concat((0,t0.bf)(d)," ").concat(s," ").concat(u);return[{["".concat(t,"-wrapper")]:{["".concat(t,"-filter-column")]:{display:"flex",justifyContent:"space-between"},["".concat(t,"-filter-trigger")]:{position:"relative",display:"flex",alignItems:"center",marginBlock:Z(l).mul(-1).equal(),marginInline:"".concat((0,t0.bf)(l)," ").concat((0,t0.bf)(Z(m).div(2).mul(-1).equal())),padding:"0 ".concat((0,t0.bf)(l)),color:f,fontSize:p,borderRadius:g,cursor:"pointer",transition:"all ".concat(h),"&:hover":{color:v,background:y},"&.active":{color:b}}}},{["".concat(n,"-dropdown")]:{[K]:Object.assign(Object.assign({},(0,t3.Wf)(e)),{minWidth:r,backgroundColor:k,borderRadius:g,boxShadow:w,overflow:"hidden",["".concat(O,"-menu")]:{maxHeight:C,overflowX:"hidden",border:0,boxShadow:"none",borderRadius:"unset",backgroundColor:N,"&:empty::after":{display:"block",padding:"".concat((0,t0.bf)(c)," 0"),color:x,fontSize:p,textAlign:"center",content:'"Not Found"'}},["".concat(K,"-tree")]:{paddingBlock:"".concat((0,t0.bf)(c)," 0"),paddingInline:c,[I]:{padding:0},["".concat(I,"-treenode ").concat(I,"-node-content-wrapper:hover")]:{backgroundColor:S},["".concat(I,"-treenode-checkbox-checked ").concat(I,"-node-content-wrapper")]:{"&, &:hover":{backgroundColor:E}}},["".concat(K,"-search")]:{padding:c,borderBottom:R,"&-input":{input:{minWidth:a},[o]:{color:x}}},["".concat(K,"-checkall")]:{width:"100%",marginBottom:l,marginInlineStart:l},["".concat(K,"-btns")]:{display:"flex",justifyContent:"space-between",padding:"".concat((0,t0.bf)(Z(c).sub(d).equal())," ").concat((0,t0.bf)(c)),overflow:"hidden",borderTop:R}})}},{["".concat(n,"-dropdown ").concat(K,", ").concat(K,"-submenu")]:{["".concat(n,"-checkbox-wrapper + span")]:{paddingInlineStart:c,color:i},"> ul":{maxHeight:"calc(100vh - 130px)",overflowX:"hidden",overflowY:"auto"}}}]},oG=e=>{let{componentCls:t,lineWidth:n,colorSplit:o,motionDurationSlow:r,zIndexTableFixed:a,tableBg:l,zIndexTableSticky:c,calc:i}=e;return{["".concat(t,"-wrapper")]:{["\n ".concat(t,"-cell-fix-left,\n ").concat(t,"-cell-fix-right\n ")]:{position:"sticky !important",zIndex:a,background:l},["\n ".concat(t,"-cell-fix-left-first::after,\n ").concat(t,"-cell-fix-left-last::after\n ")]:{position:"absolute",top:0,right:{_skip_check_:!0,value:0},bottom:i(n).mul(-1).equal(),width:30,transform:"translateX(100%)",transition:"box-shadow ".concat(r),content:'""',pointerEvents:"none"},["".concat(t,"-cell-fix-left-all::after")]:{display:"none"},["\n ".concat(t,"-cell-fix-right-first::after,\n ").concat(t,"-cell-fix-right-last::after\n ")]:{position:"absolute",top:0,bottom:i(n).mul(-1).equal(),left:{_skip_check_:!0,value:0},width:30,transform:"translateX(-100%)",transition:"box-shadow ".concat(r),content:'""',pointerEvents:"none"},["".concat(t,"-container")]:{position:"relative","&::before, &::after":{position:"absolute",top:0,bottom:0,zIndex:i(c).add(1).equal({unit:!1}),width:30,transition:"box-shadow ".concat(r),content:'""',pointerEvents:"none"},"&::before":{insetInlineStart:0},"&::after":{insetInlineEnd:0}},["".concat(t,"-ping-left")]:{["&:not(".concat(t,"-has-fix-left) ").concat(t,"-container::before")]:{boxShadow:"inset 10px 0 8px -8px ".concat(o)},["\n ".concat(t,"-cell-fix-left-first::after,\n ").concat(t,"-cell-fix-left-last::after\n ")]:{boxShadow:"inset 10px 0 8px -8px ".concat(o)},["".concat(t,"-cell-fix-left-last::before")]:{backgroundColor:"transparent !important"}},["".concat(t,"-ping-right")]:{["&:not(".concat(t,"-has-fix-right) ").concat(t,"-container::after")]:{boxShadow:"inset -10px 0 8px -8px ".concat(o)},["\n ".concat(t,"-cell-fix-right-first::after,\n ").concat(t,"-cell-fix-right-last::after\n ")]:{boxShadow:"inset -10px 0 8px -8px ".concat(o)}}}}},oY=e=>{let{componentCls:t,antCls:n,margin:o}=e;return{["".concat(t,"-wrapper")]:{["".concat(t,"-pagination").concat(n,"-pagination")]:{margin:"".concat((0,t0.bf)(o)," 0")},["".concat(t,"-pagination")]:{display:"flex",flexWrap:"wrap",rowGap:e.paddingXS,"> *":{flex:"none"},"&-left":{justifyContent:"flex-start"},"&-center":{justifyContent:"center"},"&-right":{justifyContent:"flex-end"}}}}},o$=e=>{let{componentCls:t,tableRadius:n}=e;return{["".concat(t,"-wrapper")]:{[t]:{["".concat(t,"-title, ").concat(t,"-header")]:{borderRadius:"".concat((0,t0.bf)(n)," ").concat((0,t0.bf)(n)," 0 0")},["".concat(t,"-title + ").concat(t,"-container")]:{borderStartStartRadius:0,borderStartEndRadius:0,["".concat(t,"-header, table")]:{borderRadius:0},"table > thead > tr:first-child":{"th:first-child, th:last-child, td:first-child, td:last-child":{borderRadius:0}}},"&-container":{borderStartStartRadius:n,borderStartEndRadius:n,"table > thead > tr:first-child":{"> *:first-child":{borderStartStartRadius:n},"> *:last-child":{borderStartEndRadius:n}}},"&-footer":{borderRadius:"0 0 ".concat((0,t0.bf)(n)," ").concat((0,t0.bf)(n))}}}}},oJ=e=>{let{componentCls:t}=e;return{["".concat(t,"-wrapper-rtl")]:{direction:"rtl",table:{direction:"rtl"},["".concat(t,"-pagination-left")]:{justifyContent:"flex-end"},["".concat(t,"-pagination-right")]:{justifyContent:"flex-start"},["".concat(t,"-row-expand-icon")]:{float:"right","&::after":{transform:"rotate(-90deg)"},"&-collapsed::before":{transform:"rotate(180deg)"},"&-collapsed::after":{transform:"rotate(0deg)"}},["".concat(t,"-container")]:{"&::before":{insetInlineStart:"unset",insetInlineEnd:0},"&::after":{insetInlineStart:0,insetInlineEnd:"unset"},["".concat(t,"-row-indent")]:{float:"right"}}}}},oQ=e=>{let{componentCls:t,antCls:n,iconCls:o,fontSizeIcon:r,padding:a,paddingXS:l,headerIconColor:c,headerIconHoverColor:i,tableSelectionColumnWidth:d,tableSelectedRowBg:s,tableSelectedRowHoverBg:u,tableRowHoverBg:f,tablePaddingHorizontal:p,calc:m}=e;return{["".concat(t,"-wrapper")]:{["".concat(t,"-selection-col")]:{width:d,["&".concat(t,"-selection-col-with-dropdown")]:{width:m(d).add(r).add(m(a).div(4)).equal()}},["".concat(t,"-bordered ").concat(t,"-selection-col")]:{width:m(d).add(m(l).mul(2)).equal(),["&".concat(t,"-selection-col-with-dropdown")]:{width:m(d).add(r).add(m(a).div(4)).add(m(l).mul(2)).equal()}},["\n table tr th".concat(t,"-selection-column,\n table tr td").concat(t,"-selection-column,\n ").concat(t,"-selection-column\n ")]:{paddingInlineEnd:e.paddingXS,paddingInlineStart:e.paddingXS,textAlign:"center",["".concat(n,"-radio-wrapper")]:{marginInlineEnd:0}},["table tr th".concat(t,"-selection-column").concat(t,"-cell-fix-left")]:{zIndex:e.zIndexTableFixed+1},["table tr th".concat(t,"-selection-column::after")]:{backgroundColor:"transparent !important"},["".concat(t,"-selection")]:{position:"relative",display:"inline-flex",flexDirection:"column"},["".concat(t,"-selection-extra")]:{position:"absolute",top:0,zIndex:1,cursor:"pointer",transition:"all ".concat(e.motionDurationSlow),marginInlineStart:"100%",paddingInlineStart:(0,t0.bf)(m(p).div(4).equal()),[o]:{color:c,fontSize:r,verticalAlign:"baseline","&:hover":{color:i}}},["".concat(t,"-tbody")]:{["".concat(t,"-row")]:{["&".concat(t,"-row-selected")]:{["> ".concat(t,"-cell")]:{background:s,"&-row-hover":{background:u}}},["> ".concat(t,"-cell-row-hover")]:{background:f}}}}}},o0=e=>{let{componentCls:t,tableExpandColumnWidth:n,calc:o}=e,r=(e,r,a,l)=>({["".concat(t).concat(t,"-").concat(e)]:{fontSize:l,["\n ".concat(t,"-title,\n ").concat(t,"-footer,\n ").concat(t,"-cell,\n ").concat(t,"-thead > tr > th,\n ").concat(t,"-tbody > tr > th,\n ").concat(t,"-tbody > tr > td,\n tfoot > tr > th,\n tfoot > tr > td\n ")]:{padding:"".concat((0,t0.bf)(r)," ").concat((0,t0.bf)(a))},["".concat(t,"-filter-trigger")]:{marginInlineEnd:(0,t0.bf)(o(a).div(2).mul(-1).equal())},["".concat(t,"-expanded-row-fixed")]:{margin:"".concat((0,t0.bf)(o(r).mul(-1).equal())," ").concat((0,t0.bf)(o(a).mul(-1).equal()))},["".concat(t,"-tbody")]:{["".concat(t,"-wrapper:only-child ").concat(t)]:{marginBlock:(0,t0.bf)(o(r).mul(-1).equal()),marginInline:"".concat((0,t0.bf)(o(n).sub(a).equal())," ").concat((0,t0.bf)(o(a).mul(-1).equal()))}},["".concat(t,"-selection-extra")]:{paddingInlineStart:(0,t0.bf)(o(a).div(4).equal())}}});return{["".concat(t,"-wrapper")]:Object.assign(Object.assign({},r("middle",e.tablePaddingVerticalMiddle,e.tablePaddingHorizontalMiddle,e.tableFontSizeMiddle)),r("small",e.tablePaddingVerticalSmall,e.tablePaddingHorizontalSmall,e.tableFontSizeSmall))}},o1=e=>{let{componentCls:t,marginXXS:n,fontSizeIcon:o,headerIconColor:r,headerIconHoverColor:a}=e;return{["".concat(t,"-wrapper")]:{["".concat(t,"-thead th").concat(t,"-column-has-sorters")]:{outline:"none",cursor:"pointer",transition:"all ".concat(e.motionDurationSlow),"&:hover":{background:e.tableHeaderSortHoverBg,"&::before":{backgroundColor:"transparent !important"}},"&:focus-visible":{color:e.colorPrimary},["\n &".concat(t,"-cell-fix-left:hover,\n &").concat(t,"-cell-fix-right:hover\n ")]:{background:e.tableFixedHeaderSortActiveBg}},["".concat(t,"-thead th").concat(t,"-column-sort")]:{background:e.tableHeaderSortBg,"&::before":{backgroundColor:"transparent !important"}},["td".concat(t,"-column-sort")]:{background:e.tableBodySortBg},["".concat(t,"-column-title")]:{position:"relative",zIndex:1,flex:1},["".concat(t,"-column-sorters")]:{display:"flex",flex:"auto",alignItems:"center",justifyContent:"space-between","&::after":{position:"absolute",inset:0,width:"100%",height:"100%",content:'""'}},["".concat(t,"-column-sorter")]:{marginInlineStart:n,color:r,fontSize:0,transition:"color ".concat(e.motionDurationSlow),"&-inner":{display:"inline-flex",flexDirection:"column",alignItems:"center"},"&-up, &-down":{fontSize:o,"&.active":{color:e.colorPrimary}},["".concat(t,"-column-sorter-up + ").concat(t,"-column-sorter-down")]:{marginTop:"-0.3em"}},["".concat(t,"-column-sorters:hover ").concat(t,"-column-sorter")]:{color:a}}}},o2=e=>{let{componentCls:t,opacityLoading:n,tableScrollThumbBg:o,tableScrollThumbBgHover:r,tableScrollThumbSize:a,tableScrollBg:l,zIndexTableSticky:c,stickyScrollBarBorderRadius:i,lineWidth:d,lineType:s,tableBorderColor:u}=e,f="".concat((0,t0.bf)(d)," ").concat(s," ").concat(u);return{["".concat(t,"-wrapper")]:{["".concat(t,"-sticky")]:{"&-holder":{position:"sticky",zIndex:c,background:e.colorBgContainer},"&-scroll":{position:"sticky",bottom:0,height:"".concat((0,t0.bf)(a)," !important"),zIndex:c,display:"flex",alignItems:"center",background:l,borderTop:f,opacity:n,"&:hover":{transformOrigin:"center bottom"},"&-bar":{height:a,backgroundColor:o,borderRadius:i,transition:"all ".concat(e.motionDurationSlow,", transform none"),position:"absolute",bottom:0,"&:hover, &-active":{backgroundColor:r}}}}}}},o3=e=>{let{componentCls:t,lineWidth:n,tableBorderColor:o,calc:r}=e,a="".concat((0,t0.bf)(n)," ").concat(e.lineType," ").concat(o);return{["".concat(t,"-wrapper")]:{["".concat(t,"-summary")]:{position:"relative",zIndex:e.zIndexTableFixed,background:e.tableBg,"> tr":{"> th, > td":{borderBottom:a}}},["div".concat(t,"-summary")]:{boxShadow:"0 ".concat((0,t0.bf)(r(n).mul(-1).equal())," 0 ").concat(o)}}}},o4=e=>{let{componentCls:t,motionDurationMid:n,lineWidth:o,lineType:r,tableBorderColor:a,calc:l}=e,c="".concat((0,t0.bf)(o)," ").concat(r," ").concat(a),i="".concat(t,"-expanded-row-cell");return{["".concat(t,"-wrapper")]:{["".concat(t,"-tbody-virtual")]:{["".concat(t,"-row")]:{display:"flex",boxSizing:"border-box",width:"100%"},["".concat(t,"-cell")]:{borderBottom:c,transition:"background ".concat(n)},["".concat(t,"-expanded-row")]:{["".concat(i).concat(i,"-fixed")]:{position:"sticky",insetInlineStart:0,overflow:"hidden",width:"calc(var(--virtual-width) - ".concat((0,t0.bf)(o),")"),borderInlineEnd:"none"}}},["".concat(t,"-bordered")]:{["".concat(t,"-tbody-virtual")]:{"&:after":{content:'""',insetInline:0,bottom:0,borderBottom:c,position:"absolute"},["".concat(t,"-cell")]:{borderInlineEnd:c,["&".concat(t,"-cell-fix-right-first:before")]:{content:'""',position:"absolute",insetBlock:0,insetInlineStart:l(o).mul(-1).equal(),borderInlineStart:c}}},["&".concat(t,"-virtual")]:{["".concat(t,"-placeholder ").concat(t,"-cell")]:{borderInlineEnd:c,borderBottom:c}}}}}};let o6=e=>{let{componentCls:t,fontWeightStrong:n,tablePaddingVertical:o,tablePaddingHorizontal:r,tableExpandColumnWidth:a,lineWidth:l,lineType:c,tableBorderColor:i,tableFontSize:d,tableBg:s,tableRadius:u,tableHeaderTextColor:f,motionDurationMid:p,tableHeaderBg:m,tableHeaderCellSplitColor:g,tableFooterTextColor:h,tableFooterBg:v,calc:b}=e,y="".concat((0,t0.bf)(l)," ").concat(c," ").concat(i);return{["".concat(t,"-wrapper")]:Object.assign(Object.assign({clear:"both",maxWidth:"100%"},(0,t3.dF)()),{[t]:Object.assign(Object.assign({},(0,t3.Wf)(e)),{fontSize:d,background:s,borderRadius:"".concat((0,t0.bf)(u)," ").concat((0,t0.bf)(u)," 0 0")}),table:{width:"100%",textAlign:"start",borderRadius:"".concat((0,t0.bf)(u)," ").concat((0,t0.bf)(u)," 0 0"),borderCollapse:"separate",borderSpacing:0},["\n ".concat(t,"-cell,\n ").concat(t,"-thead > tr > th,\n ").concat(t,"-tbody > tr > th,\n ").concat(t,"-tbody > tr > td,\n tfoot > tr > th,\n tfoot > tr > td\n ")]:{position:"relative",padding:"".concat((0,t0.bf)(o)," ").concat((0,t0.bf)(r)),overflowWrap:"break-word"},["".concat(t,"-title")]:{padding:"".concat((0,t0.bf)(o)," ").concat((0,t0.bf)(r))},["".concat(t,"-thead")]:{"\n > tr > th,\n > tr > td\n ":{position:"relative",color:f,fontWeight:n,textAlign:"start",background:m,borderBottom:y,transition:"background ".concat(p," ease"),"&[colspan]:not([colspan='1'])":{textAlign:"center"},["&:not(:last-child):not(".concat(t,"-selection-column):not(").concat(t,"-row-expand-icon-cell):not([colspan])::before")]:{position:"absolute",top:"50%",insetInlineEnd:0,width:1,height:"1.6em",backgroundColor:g,transform:"translateY(-50%)",transition:"background-color ".concat(p),content:'""'}},"> tr:not(:last-child) > th[colspan]":{borderBottom:0}},["".concat(t,"-tbody")]:{"> tr":{"> th, > td":{transition:"background ".concat(p,", border-color ").concat(p),borderBottom:y,["\n > ".concat(t,"-wrapper:only-child,\n > ").concat(t,"-expanded-row-fixed > ").concat(t,"-wrapper:only-child\n ")]:{[t]:{marginBlock:(0,t0.bf)(b(o).mul(-1).equal()),marginInline:"".concat((0,t0.bf)(b(a).sub(r).equal()),"\n ").concat((0,t0.bf)(b(r).mul(-1).equal())),["".concat(t,"-tbody > tr:last-child > td")]:{borderBottom:0,"&:first-child, &:last-child":{borderRadius:0}}}}},"> th":{position:"relative",color:f,fontWeight:n,textAlign:"start",background:m,borderBottom:y,transition:"background ".concat(p," ease")}}},["".concat(t,"-footer")]:{padding:"".concat((0,t0.bf)(o)," ").concat((0,t0.bf)(r)),color:h,background:v}})}};var o8=(0,t6.I$)("Table",e=>{let{colorTextHeading:t,colorSplit:n,colorBgContainer:o,controlInteractiveSize:r,headerBg:a,headerColor:l,headerSortActiveBg:c,headerSortHoverBg:i,bodySortBg:d,rowHoverBg:s,rowSelectedBg:u,rowSelectedHoverBg:f,rowExpandedBg:p,cellPaddingBlock:m,cellPaddingInline:g,cellPaddingBlockMD:h,cellPaddingInlineMD:v,cellPaddingBlockSM:b,cellPaddingInlineSM:y,borderColor:x,footerBg:k,footerColor:C,headerBorderRadius:S,cellFontSize:E,cellFontSizeMD:w,cellFontSizeSM:N,headerSplitColor:Z,fixedHeaderSortActiveBg:O,headerFilterHoverBg:K,filterDropdownBg:I,expandIconBg:R,selectionColumnWidth:P,stickyScrollBarBg:D,calc:M}=e,T=(0,t4.TS)(e,{tableFontSize:E,tableBg:o,tableRadius:S,tablePaddingVertical:m,tablePaddingHorizontal:g,tablePaddingVerticalMiddle:h,tablePaddingHorizontalMiddle:v,tablePaddingVerticalSmall:b,tablePaddingHorizontalSmall:y,tableBorderColor:x,tableHeaderTextColor:l,tableHeaderBg:a,tableFooterTextColor:C,tableFooterBg:k,tableHeaderCellSplitColor:Z,tableHeaderSortBg:c,tableHeaderSortHoverBg:i,tableBodySortBg:d,tableFixedHeaderSortActiveBg:O,tableHeaderFilterActiveBg:K,tableFilterDropdownBg:I,tableRowHoverBg:s,tableSelectedRowBg:u,tableSelectedRowHoverBg:f,zIndexTableFixed:2,zIndexTableSticky:3,tableFontSizeMiddle:w,tableFontSizeSmall:N,tableSelectionColumnWidth:P,tableExpandIconBg:R,tableExpandColumnWidth:M(r).add(M(e.padding).mul(2)).equal(),tableExpandedRowBg:p,tableFilterDropdownWidth:120,tableFilterDropdownHeight:264,tableFilterDropdownSearchWidth:140,tableScrollThumbSize:8,tableScrollThumbBg:D,tableScrollThumbBgHover:t,tableScrollBg:n});return[o6(T),oY(T),o3(T),o1(T),oU(T),oW(T),o$(T),oX(T),o3(T),oF(T),oQ(T),oG(T),o2(T),oq(T),o0(T),oJ(T),o4(T)]},e=>{let{colorFillAlter:t,colorBgContainer:n,colorTextHeading:o,colorFillSecondary:r,colorFillContent:a,controlItemBgActive:l,controlItemBgActiveHover:c,padding:i,paddingSM:d,paddingXS:s,colorBorderSecondary:u,borderRadiusLG:f,controlHeight:p,colorTextPlaceholder:m,fontSize:g,fontSizeSM:h,lineHeight:v,lineWidth:b,colorIcon:y,colorIconHover:x,opacityLoading:k,controlInteractiveSize:C}=e,S=new o_.C(r).onBackground(n).toHexShortString(),E=new o_.C(a).onBackground(n).toHexShortString(),w=new o_.C(t).onBackground(n).toHexShortString(),N=new o_.C(y),Z=new o_.C(x),O=C/2-b,K=2*O+3*b;return{headerBg:w,headerColor:o,headerSortActiveBg:S,headerSortHoverBg:E,bodySortBg:w,rowHoverBg:w,rowSelectedBg:l,rowSelectedHoverBg:c,rowExpandedBg:t,cellPaddingBlock:i,cellPaddingInline:i,cellPaddingBlockMD:d,cellPaddingInlineMD:s,cellPaddingBlockSM:s,cellPaddingInlineSM:s,borderColor:u,headerBorderRadius:f,footerBg:w,footerColor:o,cellFontSize:g,cellFontSizeMD:g,cellFontSizeSM:g,headerSplitColor:u,fixedHeaderSortActiveBg:S,headerFilterHoverBg:a,filterDropdownMenuBg:n,filterDropdownBg:n,expandIconBg:n,selectionColumnWidth:p,stickyScrollBarBg:m,stickyScrollBarBorderRadius:100,expandIconMarginTop:(g*v-3*b)/2-Math.ceil((1.4*h-3*b)/2),headerIconColor:N.clone().setAlpha(N.getAlpha()*k).toRgbString(),headerIconHoverColor:Z.clone().setAlpha(Z.getAlpha()*k).toRgbString(),expandIconHalfInner:O,expandIconSize:K,expandIconScale:C/K}},{unitless:{expandIconScale:!0}});let o5=[];var o7=a.forwardRef((e,t)=>{var n,o;let r,l,i;let{prefixCls:d,className:s,rootClassName:u,style:f,size:p,bordered:m,dropdownPrefixCls:g,dataSource:h,pagination:v,rowSelection:b,rowKey:y="key",rowClassName:x,columns:k,children:C,childrenColumnName:S,onChange:E,getPopupContainer:w,loading:N,expandIcon:Z,expandable:K,expandedRowRender:I,expandIconColumnIndex:R,indentSize:P,scroll:D,sortDirections:M,locale:T,showSorterTooltip:j=!0,virtual:B}=e;(0,tp.ln)("Table");let z=a.useMemo(()=>k||eb(C),[k,C]),H=a.useMemo(()=>z.some(e=>e.responsive),[z]),L=(0,tI.Z)(H),A=a.useMemo(()=>{let e=new Set(Object.keys(L).filter(e=>L[e]));return z.filter(t=>!t.responsive||t.responsive.some(t=>e.has(t)))},[z,L]),_=(0,e$.Z)(e,["className","style","columns"]),{locale:W=tR.Z,direction:q,table:F,renderEmpty:V,getPrefixCls:X,getPopupContainer:U}=a.useContext(tN.E_),G=(0,tK.Z)(p),Y=Object.assign(Object.assign({},W.Table),T),$=h||o5,J=X("table",d),Q=X("dropdown",g),[,ee]=(0,nc.ZP)(),et=(0,tO.Z)(J),[en,eo,er]=o8(J,et),ea=Object.assign({childrenColumnName:S,expandIconColumnIndex:R},K),{childrenColumnName:el="children"}=ea,ec=a.useMemo(()=>$.some(e=>null==e?void 0:e[el])?"nest":I||K&&K.expandedRowRender?"row":null,[$]),ed={body:a.useRef()},es=a.useRef(null),eu=a.useRef(null);n=()=>Object.assign(Object.assign({},eu.current),{nativeElement:es.current}),(0,a.useImperativeHandle)(t,()=>{let e=n(),{nativeElement:t}=e;return"undefined"!=typeof Proxy?new Proxy(t,{get:(t,n)=>e[n]?e[n]:Reflect.get(t,n)}):(t._antProxy=t._antProxy||{},Object.keys(e).forEach(n=>{if(!(n in t._antProxy)){let o=t[n];t._antProxy[n]=o,t[n]=e[n]}}),t)});let ef=a.useMemo(()=>"function"==typeof y?y:e=>null==e?void 0:e[y],[y]),[ep]=function(e,t,n){let o=a.useRef({});return[function(r){if(!o.current||o.current.data!==e||o.current.childrenColumnName!==t||o.current.getRowKey!==n){let r=new Map;!function e(o){o.forEach((o,a)=>{let l=n(o,a);r.set(l,o),o&&"object"==typeof o&&t in o&&e(o[t]||[])})}(e),o.current={data:e,childrenColumnName:t,kvMap:r,getRowKey:n}}return o.current.kvMap.get(r)}]}($,el,ef),em={},eg=function(e,t){var n,o,r;let a=arguments.length>2&&void 0!==arguments[2]&&arguments[2],l=Object.assign(Object.assign({},em),e);a&&(null===(n=em.resetPagination)||void 0===n||n.call(em),(null===(o=l.pagination)||void 0===o?void 0:o.current)&&(l.pagination.current=1),v&&v.onChange&&v.onChange(1,null===(r=l.pagination)||void 0===r?void 0:r.pageSize)),D&&!1!==D.scrollToFirstRowOnChange&&ed.body.current&&function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{getContainer:n=()=>window,callback:o,duration:r=450}=t,a=n(),l=function(e,t){var n,o;if("undefined"==typeof window)return 0;let r=t?"scrollTop":"scrollLeft",a=0;return tw(e)?a=e[t?"pageYOffset":"pageXOffset"]:e instanceof Document?a=e.documentElement[r]:e instanceof HTMLElement?a=e[r]:e&&(a=e[r]),e&&!tw(e)&&"number"!=typeof a&&(a=null===(o=(null!==(n=e.ownerDocument)&&void 0!==n?n:e).documentElement)||void 0===o?void 0:o[r]),a}(a,!0),c=Date.now(),i=()=>{let t=Date.now()-c,n=function(e,t,n,o){let r=n-t;return(e/=o/2)<1?r/2*e*e*e+t:r/2*((e-=2)*e*e+2)+t}(t>r?r:t,l,e,r);tw(a)?a.scrollTo(window.pageXOffset,n):a instanceof Document||"HTMLDocument"===a.constructor.name?a.documentElement.scrollTop=n:a.scrollTop=n,ted.body.current}),null==E||E(l.pagination,l.filters,l.sorter,{currentDataSource:ok(oH($,l.sorterStates,el),l.filterStates),action:t})},[eh,ev,ey,ex]=function(e){let{prefixCls:t,mergedColumns:n,onSorterChange:o,sortDirections:r,tableLocale:l,showSorterTooltip:c}=e,[i,d]=a.useState(oj(n,!0)),s=a.useMemo(()=>{let e=!0,t=oj(n,!1);if(!t.length)return i;let o=[];function r(t){e?o.push(t):o.push(Object.assign(Object.assign({},t),{sortOrder:null}))}let a=null;return t.forEach(t=>{null===a?(r(t),t.sortOrder&&(!1===t.multiplePriority?e=!1:a=!0)):(a&&!1!==t.multiplePriority||(e=!1),r(t))}),o},[n,i]),u=a.useMemo(()=>{let e=s.map(e=>{let{column:t,sortOrder:n}=e;return{column:t,order:n}});return{sortColumns:e,sortColumn:e[0]&&e[0].column,sortOrder:e[0]&&e[0].order}},[s]);function f(e){let t;d(t=!1!==e.multiplePriority&&s.length&&!1!==s[0].multiplePriority?[].concat((0,ei.Z)(s.filter(t=>{let{key:n}=t;return n!==e.key})),[e]):[e]),o(oz(t),t)}return[e=>(function e(t,n,o,r,l,c,i,d){return(n||[]).map((n,s)=>{let u=nm(s,d),f=n;if(f.sorter){let e;let d=f.sortDirections||l,s=void 0===f.showSorterTooltip?i:f.showSorterTooltip,p=np(f,u),m=o.find(e=>{let{key:t}=e;return t===p}),g=m?m.sortOrder:null,h=g?d[d.indexOf(g)+1]:d[0];if(n.sortIcon)e=n.sortIcon({sortOrder:g});else{let n=d.includes(oP)&&a.createElement(oI,{className:O()("".concat(t,"-column-sorter-up"),{active:g===oP})}),o=d.includes(oD)&&a.createElement(oO,{className:O()("".concat(t,"-column-sorter-down"),{active:g===oD})});e=a.createElement("span",{className:O()("".concat(t,"-column-sorter"),{["".concat(t,"-column-sorter-full")]:!!(n&&o)})},a.createElement("span",{className:"".concat(t,"-column-sorter-inner"),"aria-hidden":"true"},n,o))}let{cancelSort:v,triggerAsc:b,triggerDesc:y}=c||{},x=v;h===oD?x=y:h===oP&&(x=b);let k="object"==typeof s?Object.assign({title:x},s):{title:x};f=Object.assign(Object.assign({},f),{className:O()(f.className,{["".concat(t,"-column-sort")]:g}),title:o=>{let r=a.createElement("div",{className:"".concat(t,"-column-sorters")},a.createElement("span",{className:"".concat(t,"-column-title")},ng(n.title,o)),e);return s?a.createElement(oR.Z,Object.assign({},k),r):r},onHeaderCell:e=>{let o=n.onHeaderCell&&n.onHeaderCell(e)||{},a=o.onClick,l=o.onKeyDown;o.onClick=e=>{r({column:n,key:p,sortOrder:h,multiplePriority:oM(n)}),null==a||a(e)},o.onKeyDown=e=>{e.keyCode===tH.Z.ENTER&&(r({column:n,key:p,sortOrder:h,multiplePriority:oM(n)}),null==l||l(e))};let c=function(e,t){let n=ng(e,t);return"[object Object]"===Object.prototype.toString.call(n)?"":n}(n.title,{}),i=null==c?void 0:c.toString();return g?o["aria-sort"]="ascend"===g?"ascending":"descending":o["aria-label"]=i||"",o.className=O()(o.className,"".concat(t,"-column-has-sorters")),o.tabIndex=0,n.ellipsis&&(o.title=(null!=c?c:"").toString()),o}})}return"children"in f&&(f=Object.assign(Object.assign({},f),{children:e(t,f.children,o,r,l,c,i,u)})),f})})(t,e,s,f,r,l,c),s,u,()=>oz(s)]}({prefixCls:J,mergedColumns:A,onSorterChange:(e,t)=>{eg({sorter:e,sorterStates:t},"sort",!1)},sortDirections:M||["ascend","descend"],tableLocale:Y,showSorterTooltip:j}),ek=a.useMemo(()=>oH($,ev,el),[$,ev]);em.sorter=ex(),em.sorterStates=ev;let[eC,eS,eE]=oS({prefixCls:J,locale:Y,dropdownPrefixCls:Q,mergedColumns:A,onFilterChange:(e,t)=>{eg({filters:e,filterStates:t},"filter",!0)},getPopupContainer:w||U,rootClassName:O()(u,et)}),ew=ok(ek,eS);em.filters=eE,em.filterStates=eS;let[eN]=(o=a.useMemo(()=>{let e={};return Object.keys(eE).forEach(t=>{null!==eE[t]&&(e[t]=eE[t])}),Object.assign(Object.assign({},ey),{filters:e})},[ey,eE]),[a.useCallback(e=>(function e(t,n){return t.map(t=>{let o=Object.assign({},t);return o.title=ng(t.title,n),"children"in o&&(o.children=e(o.children,n)),o})})(e,o),[o])]),[eZ,eO]=oN(ew.length,(e,t)=>{eg({pagination:Object.assign(Object.assign({},em.pagination),{current:e,pageSize:t})},"paginate")},v);em.pagination=!1===v?{}:function(e,t){let n={current:e.current,pageSize:e.pageSize};return Object.keys(t&&"object"==typeof t?t:{}).forEach(t=>{let o=e[t];"function"!=typeof o&&(n[t]=o)}),n}(eZ,v),em.resetPagination=eO;let eK=a.useMemo(()=>{if(!1===v||!eZ.pageSize)return ew;let{current:e=1,total:t,pageSize:n=10}=eZ;return ew.lengthn?ew.slice((e-1)*n,e*n):ew:ew.slice((e-1)*n,e*n)},[!!v,ew,eZ&&eZ.current,eZ&&eZ.pageSize,eZ&&eZ.total]),[eI,eR]=tS({prefixCls:J,data:ew,pageData:eK,getRowKey:ef,getRecordByKey:ep,expandType:ec,childrenColumnName:el,locale:Y,getPopupContainer:w||U},b);ea.__PARENT_RENDER_ICON__=ea.expandIcon,ea.expandIcon=ea.expandIcon||Z||function(e){let{prefixCls:t,onExpand:n,record:o,expanded:r,expandable:l}=e,c="".concat(t,"-row-expand-icon");return a.createElement("button",{type:"button",onClick:e=>{n(o,e),e.stopPropagation()},className:O()(c,{["".concat(c,"-spaced")]:!l,["".concat(c,"-expanded")]:l&&r,["".concat(c,"-collapsed")]:l&&!r}),"aria-label":r?Y.collapse:Y.expand,"aria-expanded":r})},"nest"===ec&&void 0===ea.expandIconColumnIndex?ea.expandIconColumnIndex=b?1:0:ea.expandIconColumnIndex>0&&b&&(ea.expandIconColumnIndex-=1),"number"!=typeof ea.indentSize&&(ea.indentSize="number"==typeof P?P:15);let eP=a.useCallback(e=>eN(eI(eC(eh(e)))),[eh,eC,eI]);if(!1!==v&&(null==eZ?void 0:eZ.total)){let e;e=eZ.size?eZ.size:"small"===G||"middle"===G?"small":void 0;let t=t=>a.createElement(nu,Object.assign({},eZ,{className:O()("".concat(J,"-pagination ").concat(J,"-pagination-").concat(t),eZ.className),size:e})),n="rtl"===q?"left":"right",{position:o}=eZ;if(null!==o&&Array.isArray(o)){let e=o.find(e=>e.includes("top")),a=o.find(e=>e.includes("bottom")),c=o.every(e=>"none"==="".concat(e));e||a||c||(l=t(n)),e&&(r=t(e.toLowerCase().replace("top",""))),a&&(l=t(a.toLowerCase().replace("bottom","")))}else l=t(n)}"boolean"==typeof N?i={spinning:N}:"object"==typeof N&&(i=Object.assign({spinning:!0},N));let eD=O()(er,et,"".concat(J,"-wrapper"),null==F?void 0:F.className,{["".concat(J,"-wrapper-rtl")]:"rtl"===q},s,u,eo),eM=Object.assign(Object.assign({},null==F?void 0:F.style),f),eT=T&&T.emptyText||(null==V?void 0:V("Table"))||a.createElement(tZ.Z,{componentName:"Table"}),ej={},eB=a.useMemo(()=>{let{fontSize:e,lineHeight:t,padding:n,paddingXS:o,paddingSM:r}=ee,a=Math.floor(e*t);switch(G){case"large":return 2*n+a;case"small":return 2*o+a;default:return 2*r+a}},[ee,G]);return B&&(ej.listItemHeight=eB),en(a.createElement("div",{ref:es,className:eD,style:eM},a.createElement(nf.Z,Object.assign({spinning:!1},i),r,a.createElement(B?oA:oL,Object.assign({},ej,_,{ref:eu,columns:A,direction:q,expandable:ea,prefixCls:J,className:O()({["".concat(J,"-middle")]:"middle"===G,["".concat(J,"-small")]:"small"===G,["".concat(J,"-bordered")]:m,["".concat(J,"-empty")]:0===$.length},er,et,eo),data:eK,rowKey:ef,rowClassName:(e,t,n)=>{let o;return o="function"==typeof x?O()(x(e,t,n)):O()(x),O()({["".concat(J,"-row-selected")]:eR.has(ef(e,t))},o)},emptyText:eT,internalHooks:c,internalRefs:ed,transformColumns:eP,getContainerWidth:(e,t)=>{let n=e.querySelector(".".concat(J,"-container")),o=t;if(n){let e=getComputedStyle(n);o=t-parseInt(e.borderLeftWidth,10)-parseInt(e.borderRightWidth,10)}return o}})),l)))});let o9=a.forwardRef((e,t)=>{let n=a.useRef(0);return n.current+=1,a.createElement(o7,Object.assign({},e,{ref:t,_renderTimes:n.current}))});o9.SELECTION_COLUMN=tv,o9.EXPAND_COLUMN=l,o9.SELECTION_ALL=tb,o9.SELECTION_INVERT=ty,o9.SELECTION_NONE=tx,o9.Column=function(e){return null},o9.ColumnGroup=function(e){return null},o9.Summary=A;var re=o9},88532:function(e,t,n){var o=n(2265);let r=o.forwardRef(function(e,t){return o.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),o.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"}))});t.Z=r}}]);
\ No newline at end of file
diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/6802-046eb3ef4ed725bf.js b/litellm/proxy/_experimental/out/_next/static/chunks/6802-046eb3ef4ed725bf.js
new file mode 100644
index 00000000000..de957fe2564
--- /dev/null
+++ b/litellm/proxy/_experimental/out/_next/static/chunks/6802-046eb3ef4ed725bf.js
@@ -0,0 +1 @@
+"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6802],{5540:function(t,e,n){n.d(e,{Z:function(){return i}});var r=n(1119),o=n(2265),a={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"},c=n(55015),i=o.forwardRef(function(t,e){return o.createElement(c.Z,(0,r.Z)({},t,{ref:e,icon:a}))})},41169:function(t,e,n){n.d(e,{Z:function(){return i}});var r=n(1119),o=n(2265),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 472a40 40 0 1080 0 40 40 0 10-80 0zm367 352.9L696.3 352V178H768v-68H256v68h71.7v174L145 824.9c-2.8 7.4-4.3 15.2-4.3 23.1 0 35.3 28.7 64 64 64h614.6c7.9 0 15.7-1.5 23.1-4.3 33-12.7 49.4-49.8 36.6-82.8zM395.7 364.7V180h232.6v184.7L719.2 600c-20.7-5.3-42.1-8-63.9-8-61.2 0-119.2 21.5-165.3 60a188.78 188.78 0 01-121.3 43.9c-32.7 0-64.1-8.3-91.8-23.7l118.8-307.5zM210.5 844l41.7-107.8c35.7 18.1 75.4 27.8 116.6 27.8 61.2 0 119.2-21.5 165.3-60 33.9-28.2 76.3-43.9 121.3-43.9 35 0 68.4 9.5 97.6 27.1L813.5 844h-603z"}}]},name:"experiment",theme:"outlined"},c=n(55015),i=o.forwardRef(function(t,e){return o.createElement(c.Z,(0,r.Z)({},t,{ref:e,icon:a}))})},10798:function(t,e,n){n.d(e,{Z:function(){return i}});var r=n(1119),o=n(2265),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M880.1 154H143.9c-24.5 0-39.8 26.7-27.5 48L349 597.4V838c0 17.7 14.2 32 31.8 32h262.4c17.6 0 31.8-14.3 31.8-32V597.4L907.7 202c12.2-21.3-3.1-48-27.6-48zM603.4 798H420.6V642h182.9v156zm9.6-236.6l-9.5 16.6h-183l-9.5-16.6L212.7 226h598.6L613 561.4z"}}]},name:"filter",theme:"outlined"},c=n(55015),i=o.forwardRef(function(t,e){return o.createElement(c.Z,(0,r.Z)({},t,{ref:e,icon:a}))})},15327:function(t,e,n){n.d(e,{Z:function(){return i}});var r=n(1119),o=n(2265),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M724 218.3V141c0-6.7-7.7-10.4-12.9-6.3L260.3 486.8a31.86 31.86 0 000 50.3l450.8 352.1c5.3 4.1 12.9.4 12.9-6.3v-77.3c0-4.9-2.3-9.6-6.1-12.6l-360-281 360-281.1c3.8-3 6.1-7.7 6.1-12.6z"}}]},name:"left",theme:"outlined"},c=n(55015),i=o.forwardRef(function(t,e){return o.createElement(c.Z,(0,r.Z)({},t,{ref:e,icon:a}))})},77565:function(t,e,n){n.d(e,{Z:function(){return i}});var r=n(1119),o=n(2265),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M765.7 486.8L314.9 134.7A7.97 7.97 0 00302 141v77.3c0 4.9 2.3 9.6 6.1 12.6l360 281.1-360 281.1c-3.9 3-6.1 7.7-6.1 12.6V883c0 6.7 7.7 10.4 12.9 6.3l450.8-352.1a31.96 31.96 0 000-50.4z"}}]},name:"right",theme:"outlined"},c=n(55015),i=o.forwardRef(function(t,e){return o.createElement(c.Z,(0,r.Z)({},t,{ref:e,icon:a}))})},8881:function(t,e,n){n.d(e,{Z:function(){return i}});var r=n(1119),o=n(2265),a={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-372 0-89 31.3-170.8 83.5-234.8l523.3 523.3C682.8 852.7 601 884 512 884zm288.5-137.2L277.2 223.5C341.2 171.3 423 140 512 140c205.4 0 372 166.6 372 372 0 89-31.3 170.8-83.5 234.8z"}}]},name:"stop",theme:"outlined"},c=n(55015),i=o.forwardRef(function(t,e){return o.createElement(c.Z,(0,r.Z)({},t,{ref:e,icon:a}))})},47323:function(t,e,n){n.d(e,{Z:function(){return f}});var r=n(5853),o=n(2265),a=n(1526),c=n(7084),i=n(97324),l=n(1153),d=n(26898);let s={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"}},m={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"}},g={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:""}},p=(t,e)=>{switch(t){case"simple":return{textColor:e?(0,l.bM)(e,d.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:"",borderColor:"",ringColor:""};case"light":return{textColor:e?(0,l.bM)(e,d.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:e?(0,i.q)((0,l.bM)(e,d.K.background).bgColor,"bg-opacity-20"):"bg-tremor-brand-muted dark:bg-dark-tremor-brand-muted",borderColor:"",ringColor:""};case"shadow":return{textColor:e?(0,l.bM)(e,d.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:e?(0,i.q)((0,l.bM)(e,d.K.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:e?(0,l.bM)(e,d.K.text).textColor:"text-tremor-brand-inverted dark:text-dark-tremor-brand-inverted",bgColor:e?(0,i.q)((0,l.bM)(e,d.K.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:e?(0,l.bM)(e,d.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:e?(0,i.q)((0,l.bM)(e,d.K.background).bgColor,"bg-opacity-20"):"bg-tremor-background dark:bg-dark-tremor-background",borderColor:e?(0,l.bM)(e,d.K.ring).borderColor:"border-tremor-brand-subtle dark:border-dark-tremor-brand-subtle",ringColor:e?(0,i.q)((0,l.bM)(e,d.K.ring).ringColor,"ring-opacity-40"):"ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted"}}},u=(0,l.fn)("Icon"),f=o.forwardRef((t,e)=>{let{icon:n,variant:d="simple",tooltip:f,size:b=c.u8.SM,color:h,className:x}=t,v=(0,r._T)(t,["icon","variant","tooltip","size","color","className"]),k=p(d,h),{tooltipProps:y,getReferenceProps:C}=(0,a.l)();return o.createElement("span",Object.assign({ref:(0,l.lq)([e,y.refs.setReference]),className:(0,i.q)(u("root"),"inline-flex flex-shrink-0 items-center",k.bgColor,k.textColor,k.borderColor,k.ringColor,g[d].rounded,g[d].border,g[d].shadow,g[d].ring,s[b].paddingX,s[b].paddingY,x)},C,v),o.createElement(a.Z,Object.assign({text:f},y)),o.createElement(n,{className:(0,i.q)(u("icon"),"shrink-0",m[b].height,m[b].width)}))});f.displayName="Icon"},67101:function(t,e,n){n.d(e,{Z:function(){return s}});var r=n(5853),o=n(97324),a=n(1153),c=n(2265),i=n(9496);let l=(0,a.fn)("Grid"),d=(t,e)=>t&&Object.keys(e).includes(String(t))?e[t]:"",s=c.forwardRef((t,e)=>{let{numItems:n=1,numItemsSm:a,numItemsMd:s,numItemsLg:m,children:g,className:p}=t,u=(0,r._T)(t,["numItems","numItemsSm","numItemsMd","numItemsLg","children","className"]),f=d(n,i._m),b=d(a,i.LH),h=d(s,i.l5),x=d(m,i.N4),v=(0,o.q)(f,b,h,x);return c.createElement("div",Object.assign({ref:e,className:(0,o.q)(l("root"),"grid",v,p)},u),g)});s.displayName="Grid"},9496:function(t,e,n){n.d(e,{LH:function(){return o},N4:function(){return c},PT:function(){return i},SP:function(){return l},VS:function(){return d},_m:function(){return r},_w:function(){return s},l5:function(){return a}});let r={0:"grid-cols-none",1:"grid-cols-1",2:"grid-cols-2",3:"grid-cols-3",4:"grid-cols-4",5:"grid-cols-5",6:"grid-cols-6",7:"grid-cols-7",8:"grid-cols-8",9:"grid-cols-9",10:"grid-cols-10",11:"grid-cols-11",12:"grid-cols-12"},o={0:"sm:grid-cols-none",1:"sm:grid-cols-1",2:"sm:grid-cols-2",3:"sm:grid-cols-3",4:"sm:grid-cols-4",5:"sm:grid-cols-5",6:"sm:grid-cols-6",7:"sm:grid-cols-7",8:"sm:grid-cols-8",9:"sm:grid-cols-9",10:"sm:grid-cols-10",11:"sm:grid-cols-11",12:"sm:grid-cols-12"},a={0:"md:grid-cols-none",1:"md:grid-cols-1",2:"md:grid-cols-2",3:"md:grid-cols-3",4:"md:grid-cols-4",5:"md:grid-cols-5",6:"md:grid-cols-6",7:"md:grid-cols-7",8:"md:grid-cols-8",9:"md:grid-cols-9",10:"md:grid-cols-10",11:"md:grid-cols-11",12:"md:grid-cols-12"},c={0:"lg:grid-cols-none",1:"lg:grid-cols-1",2:"lg:grid-cols-2",3:"lg:grid-cols-3",4:"lg:grid-cols-4",5:"lg:grid-cols-5",6:"lg:grid-cols-6",7:"lg:grid-cols-7",8:"lg:grid-cols-8",9:"lg:grid-cols-9",10:"lg:grid-cols-10",11:"lg:grid-cols-11",12:"lg:grid-cols-12"},i={1:"col-span-1",2:"col-span-2",3:"col-span-3",4:"col-span-4",5:"col-span-5",6:"col-span-6",7:"col-span-7",8:"col-span-8",9:"col-span-9",10:"col-span-10",11:"col-span-11",12:"col-span-12",13:"col-span-13"},l={1:"sm:col-span-1",2:"sm:col-span-2",3:"sm:col-span-3",4:"sm:col-span-4",5:"sm:col-span-5",6:"sm:col-span-6",7:"sm:col-span-7",8:"sm:col-span-8",9:"sm:col-span-9",10:"sm:col-span-10",11:"sm:col-span-11",12:"sm:col-span-12",13:"sm:col-span-13"},d={1:"md:col-span-1",2:"md:col-span-2",3:"md:col-span-3",4:"md:col-span-4",5:"md:col-span-5",6:"md:col-span-6",7:"md:col-span-7",8:"md:col-span-8",9:"md:col-span-9",10:"md:col-span-10",11:"md:col-span-11",12:"md:col-span-12",13:"md:col-span-13"},s={1:"lg:col-span-1",2:"lg:col-span-2",3:"lg:col-span-3",4:"lg:col-span-4",5:"lg:col-span-5",6:"lg:col-span-6",7:"lg:col-span-7",8:"lg:col-span-8",9:"lg:col-span-9",10:"lg:col-span-10",11:"lg:col-span-11",12:"lg:col-span-12",13:"lg:col-span-13"}},35631:function(t,e,n){n.d(e,{Z:function(){return L}});var r=n(83145),o=n(36760),a=n.n(o),c=n(2265),i=n(53253),l=n(6543),d=n(71744),s=n(91086),m=n(10295),g=n(28617),p=n(19097),u=n(87908),f=n(19722),b=n(54998);let h=c.createContext({});h.Consumer;var x=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&0>e.indexOf(r)&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,r=Object.getOwnPropertySymbols(t);oe.indexOf(r[o])&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]]);return n};let v=(0,c.forwardRef)((t,e)=>{let n;var{prefixCls:r,children:o,actions:i,extra:l,className:s,colStyle:m}=t,g=x(t,["prefixCls","children","actions","extra","className","colStyle"]);let{grid:p,itemLayout:u}=(0,c.useContext)(h),{getPrefixCls:v}=(0,c.useContext)(d.E_),k=v("list",r),y=i&&i.length>0&&c.createElement("ul",{className:"".concat(k,"-item-action"),key:"actions"},i.map((t,e)=>c.createElement("li",{key:"".concat(k,"-item-action-").concat(e)},t,e!==i.length-1&&c.createElement("em",{className:"".concat(k,"-item-action-split")})))),C=c.createElement(p?"div":"li",Object.assign({},g,p?{}:{ref:e},{className:a()("".concat(k,"-item"),{["".concat(k,"-item-no-flex")]:!("vertical"===u?!!l:(c.Children.forEach(o,t=>{"string"==typeof t&&(n=!0)}),!(n&&c.Children.count(o)>1)))},s)}),"vertical"===u&&l?[c.createElement("div",{className:"".concat(k,"-item-main"),key:"content"},o,y),c.createElement("div",{className:"".concat(k,"-item-extra"),key:"extra"},l)]:[o,y,(0,f.Tm)(l,{key:"extra"})]);return p?c.createElement(b.Z,{ref:e,flex:1,style:m},C):C});v.Meta=t=>{var{prefixCls:e,className:n,avatar:r,title:o,description:i}=t,l=x(t,["prefixCls","className","avatar","title","description"]);let{getPrefixCls:s}=(0,c.useContext)(d.E_),m=s("list",e),g=a()("".concat(m,"-item-meta"),n),p=c.createElement("div",{className:"".concat(m,"-item-meta-content")},o&&c.createElement("h4",{className:"".concat(m,"-item-meta-title")},o),i&&c.createElement("div",{className:"".concat(m,"-item-meta-description")},i));return c.createElement("div",Object.assign({},l,{className:g}),r&&c.createElement("div",{className:"".concat(m,"-item-meta-avatar")},r),(o||i)&&p)};var k=n(352),y=n(12918),C=n(80669),w=n(3104);let S=t=>{let{listBorderedCls:e,componentCls:n,paddingLG:r,margin:o,itemPaddingSM:a,itemPaddingLG:c,marginLG:i,borderRadiusLG:l}=t;return{["".concat(e)]:{border:"".concat((0,k.bf)(t.lineWidth)," ").concat(t.lineType," ").concat(t.colorBorder),borderRadius:l,["".concat(n,"-header,").concat(n,"-footer,").concat(n,"-item")]:{paddingInline:r},["".concat(n,"-pagination")]:{margin:"".concat((0,k.bf)(o)," ").concat((0,k.bf)(i))}},["".concat(e).concat(n,"-sm")]:{["".concat(n,"-item,").concat(n,"-header,").concat(n,"-footer")]:{padding:a}},["".concat(e).concat(n,"-lg")]:{["".concat(n,"-item,").concat(n,"-header,").concat(n,"-footer")]:{padding:c}}}},E=t=>{let{componentCls:e,screenSM:n,screenMD:r,marginLG:o,marginSM:a,margin:c}=t;return{["@media screen and (max-width:".concat(r,"px)")]:{["".concat(e)]:{["".concat(e,"-item")]:{["".concat(e,"-item-action")]:{marginInlineStart:o}}},["".concat(e,"-vertical")]:{["".concat(e,"-item")]:{["".concat(e,"-item-extra")]:{marginInlineStart:o}}}},["@media screen and (max-width: ".concat(n,"px)")]:{["".concat(e)]:{["".concat(e,"-item")]:{flexWrap:"wrap",["".concat(e,"-action")]:{marginInlineStart:a}}},["".concat(e,"-vertical")]:{["".concat(e,"-item")]:{flexWrap:"wrap-reverse",["".concat(e,"-item-main")]:{minWidth:t.contentWidth},["".concat(e,"-item-extra")]:{margin:"auto auto ".concat((0,k.bf)(c))}}}}}},z=t=>{let{componentCls:e,antCls:n,controlHeight:r,minHeight:o,paddingSM:a,marginLG:c,padding:i,itemPadding:l,colorPrimary:d,itemPaddingSM:s,itemPaddingLG:m,paddingXS:g,margin:p,colorText:u,colorTextDescription:f,motionDurationSlow:b,lineWidth:h,headerBg:x,footerBg:v,emptyTextPadding:C,metaMarginBottom:w,avatarMarginRight:S,titleMarginBottom:E,descriptionFontSize:z}=t,N={};return["start","center","end"].forEach(t=>{N["&-align-".concat(t)]={textAlign:t}}),{["".concat(e)]:Object.assign(Object.assign({},(0,y.Wf)(t)),{position:"relative","*":{outline:"none"},["".concat(e,"-header")]:{background:x},["".concat(e,"-footer")]:{background:v},["".concat(e,"-header, ").concat(e,"-footer")]:{paddingBlock:a},["".concat(e,"-pagination")]:Object.assign(Object.assign({marginBlockStart:c},N),{["".concat(n,"-pagination-options")]:{textAlign:"start"}}),["".concat(e,"-spin")]:{minHeight:o,textAlign:"center"},["".concat(e,"-items")]:{margin:0,padding:0,listStyle:"none"},["".concat(e,"-item")]:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:l,color:u,["".concat(e,"-item-meta")]:{display:"flex",flex:1,alignItems:"flex-start",maxWidth:"100%",["".concat(e,"-item-meta-avatar")]:{marginInlineEnd:S},["".concat(e,"-item-meta-content")]:{flex:"1 0",width:0,color:u},["".concat(e,"-item-meta-title")]:{margin:"0 0 ".concat((0,k.bf)(t.marginXXS)," 0"),color:u,fontSize:t.fontSize,lineHeight:t.lineHeight,"> a":{color:u,transition:"all ".concat(b),"&:hover":{color:d}}},["".concat(e,"-item-meta-description")]:{color:f,fontSize:z,lineHeight:t.lineHeight}},["".concat(e,"-item-action")]:{flex:"0 0 auto",marginInlineStart:t.marginXXL,padding:0,fontSize:0,listStyle:"none","& > li":{position:"relative",display:"inline-block",padding:"0 ".concat((0,k.bf)(g)),color:f,fontSize:t.fontSize,lineHeight:t.lineHeight,textAlign:"center","&:first-child":{paddingInlineStart:0}},["".concat(e,"-item-action-split")]:{position:"absolute",insetBlockStart:"50%",insetInlineEnd:0,width:h,height:t.calc(t.fontHeight).sub(t.calc(t.marginXXS).mul(2)).equal(),transform:"translateY(-50%)",backgroundColor:t.colorSplit}}},["".concat(e,"-empty")]:{padding:"".concat((0,k.bf)(i)," 0"),color:f,fontSize:t.fontSizeSM,textAlign:"center"},["".concat(e,"-empty-text")]:{padding:C,color:t.colorTextDisabled,fontSize:t.fontSize,textAlign:"center"},["".concat(e,"-item-no-flex")]:{display:"block"}}),["".concat(e,"-grid ").concat(n,"-col > ").concat(e,"-item")]:{display:"block",maxWidth:"100%",marginBlockEnd:p,paddingBlock:0,borderBlockEnd:"none"},["".concat(e,"-vertical ").concat(e,"-item")]:{alignItems:"initial",["".concat(e,"-item-main")]:{display:"block",flex:1},["".concat(e,"-item-extra")]:{marginInlineStart:c},["".concat(e,"-item-meta")]:{marginBlockEnd:w,["".concat(e,"-item-meta-title")]:{marginBlockStart:0,marginBlockEnd:E,color:u,fontSize:t.fontSizeLG,lineHeight:t.lineHeightLG}},["".concat(e,"-item-action")]:{marginBlockStart:i,marginInlineStart:"auto","> li":{padding:"0 ".concat((0,k.bf)(i)),"&:first-child":{paddingInlineStart:0}}}},["".concat(e,"-split ").concat(e,"-item")]:{borderBlockEnd:"".concat((0,k.bf)(t.lineWidth)," ").concat(t.lineType," ").concat(t.colorSplit),"&:last-child":{borderBlockEnd:"none"}},["".concat(e,"-split ").concat(e,"-header")]:{borderBlockEnd:"".concat((0,k.bf)(t.lineWidth)," ").concat(t.lineType," ").concat(t.colorSplit)},["".concat(e,"-split").concat(e,"-empty ").concat(e,"-footer")]:{borderTop:"".concat((0,k.bf)(t.lineWidth)," ").concat(t.lineType," ").concat(t.colorSplit)},["".concat(e,"-loading ").concat(e,"-spin-nested-loading")]:{minHeight:r},["".concat(e,"-split").concat(e,"-something-after-last-item ").concat(n,"-spin-container > ").concat(e,"-items > ").concat(e,"-item:last-child")]:{borderBlockEnd:"".concat((0,k.bf)(t.lineWidth)," ").concat(t.lineType," ").concat(t.colorSplit)},["".concat(e,"-lg ").concat(e,"-item")]:{padding:m},["".concat(e,"-sm ").concat(e,"-item")]:{padding:s},["".concat(e,":not(").concat(e,"-vertical)")]:{["".concat(e,"-item-no-flex")]:{["".concat(e,"-item-action")]:{float:"right"}}}}};var N=(0,C.I$)("List",t=>{let e=(0,w.TS)(t,{listBorderedCls:"".concat(t.componentCls,"-bordered"),minHeight:t.controlHeightLG});return[z(e),S(e),E(e)]},t=>({contentWidth:220,itemPadding:"".concat((0,k.bf)(t.paddingContentVertical)," 0"),itemPaddingSM:"".concat((0,k.bf)(t.paddingContentVerticalSM)," ").concat((0,k.bf)(t.paddingContentHorizontal)),itemPaddingLG:"".concat((0,k.bf)(t.paddingContentVerticalLG)," ").concat((0,k.bf)(t.paddingContentHorizontalLG)),headerBg:"transparent",footerBg:"transparent",emptyTextPadding:t.padding,metaMarginBottom:t.padding,avatarMarginRight:t.padding,titleMarginBottom:t.paddingSM,descriptionFontSize:t.fontSize})),M=n(33759),O=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&0>e.indexOf(r)&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,r=Object.getOwnPropertySymbols(t);oe.indexOf(r[o])&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]]);return n};function Z(t){var e,{pagination:n=!1,prefixCls:o,bordered:f=!1,split:b=!0,className:x,rootClassName:v,style:k,children:y,itemLayout:C,loadMore:w,grid:S,dataSource:E=[],size:z,header:Z,footer:L,loading:j=!1,rowKey:I,renderItem:B,locale:H}=t,W=O(t,["pagination","prefixCls","bordered","split","className","rootClassName","style","children","itemLayout","loadMore","grid","dataSource","size","header","footer","loading","rowKey","renderItem","locale"]);let P=n&&"object"==typeof n?n:{},[R,T]=c.useState(P.defaultCurrent||1),[A,_]=c.useState(P.defaultPageSize||10),{getPrefixCls:K,renderEmpty:V,direction:X,list:q}=c.useContext(d.E_),G=t=>(e,r)=>{var o;T(e),_(r),n&&n[t]&&(null===(o=null==n?void 0:n[t])||void 0===o||o.call(n,e,r))},Y=G("onChange"),$=G("onShowSizeChange"),F=(t,e)=>{let n;return B?((n="function"==typeof I?I(t):I?t[I]:t.key)||(n="list-item-".concat(e)),c.createElement(c.Fragment,{key:n},B(t,e))):null},U=K("list",o),[D,J,Q]=N(U),tt=j;"boolean"==typeof tt&&(tt={spinning:tt});let te=tt&&tt.spinning,tn=(0,M.Z)(z),tr="";switch(tn){case"large":tr="lg";break;case"small":tr="sm"}let to=a()(U,{["".concat(U,"-vertical")]:"vertical"===C,["".concat(U,"-").concat(tr)]:tr,["".concat(U,"-split")]:b,["".concat(U,"-bordered")]:f,["".concat(U,"-loading")]:te,["".concat(U,"-grid")]:!!S,["".concat(U,"-something-after-last-item")]:!!(w||n||L),["".concat(U,"-rtl")]:"rtl"===X},null==q?void 0:q.className,x,v,J,Q),ta=(0,i.Z)({current:1,total:0},{total:E.length,current:R,pageSize:A},n||{}),tc=Math.ceil(ta.total/ta.pageSize);ta.current>tc&&(ta.current=tc);let ti=n?c.createElement("div",{className:a()("".concat(U,"-pagination"),"".concat(U,"-pagination-align-").concat(null!==(e=null==ta?void 0:ta.align)&&void 0!==e?e:"end"))},c.createElement(p.Z,Object.assign({},ta,{onChange:Y,onShowSizeChange:$}))):null,tl=(0,r.Z)(E);n&&E.length>(ta.current-1)*ta.pageSize&&(tl=(0,r.Z)(E).splice((ta.current-1)*ta.pageSize,ta.pageSize));let td=Object.keys(S||{}).some(t=>["xs","sm","md","lg","xl","xxl"].includes(t)),ts=(0,g.Z)(td),tm=c.useMemo(()=>{for(let t=0;t{if(!S)return;let t=tm&&S[tm]?S[tm]:S.column;if(t)return{width:"".concat(100/t,"%"),maxWidth:"".concat(100/t,"%")}},[null==S?void 0:S.column,tm]),tp=te&&c.createElement("div",{style:{minHeight:53}});if(tl.length>0){let t=tl.map((t,e)=>F(t,e));tp=S?c.createElement(m.Z,{gutter:S.gutter},c.Children.map(t,t=>c.createElement("div",{key:null==t?void 0:t.key,style:tg},t))):c.createElement("ul",{className:"".concat(U,"-items")},t)}else y||te||(tp=c.createElement("div",{className:"".concat(U,"-empty-text")},H&&H.emptyText||(null==V?void 0:V("List"))||c.createElement(s.Z,{componentName:"List"})));let tu=ta.position||"bottom",tf=c.useMemo(()=>({grid:S,itemLayout:C}),[JSON.stringify(S),C]);return D(c.createElement(h.Provider,{value:tf},c.createElement("div",Object.assign({style:Object.assign(Object.assign({},null==q?void 0:q.style),k),className:to},W),("top"===tu||"both"===tu)&&ti,Z&&c.createElement("div",{className:"".concat(U,"-header")},Z),c.createElement(u.Z,Object.assign({},tt),tp,y),L&&c.createElement("div",{className:"".concat(U,"-footer")},L),w||("bottom"===tu||"both"===tu)&&ti)))}Z.Item=v;var L=Z},79205:function(t,e,n){n.d(e,{Z:function(){return m}});var r=n(2265);let o=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),a=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,e,n)=>n?n.toUpperCase():e.toLowerCase()),c=t=>{let e=a(t);return e.charAt(0).toUpperCase()+e.slice(1)},i=function(){for(var t=arguments.length,e=Array(t),n=0;n!!t&&""!==t.trim()&&n.indexOf(t)===e).join(" ").trim()},l=t=>{for(let e in t)if(e.startsWith("aria-")||"role"===e||"title"===e)return!0};var d={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let s=(0,r.forwardRef)((t,e)=>{let{color:n="currentColor",size:o=24,strokeWidth:a=2,absoluteStrokeWidth:c,className:s="",children:m,iconNode:g,...p}=t;return(0,r.createElement)("svg",{ref:e,...d,width:o,height:o,stroke:n,strokeWidth:c?24*Number(a)/Number(o):a,className:i("lucide",s),...!m&&!l(p)&&{"aria-hidden":"true"},...p},[...g.map(t=>{let[e,n]=t;return(0,r.createElement)(e,n)}),...Array.isArray(m)?m:[m]])}),m=(t,e)=>{let n=(0,r.forwardRef)((n,a)=>{let{className:l,...d}=n;return(0,r.createElement)(s,{ref:a,iconNode:e,className:i("lucide-".concat(o(c(t))),"lucide-".concat(t),l),...d})});return n.displayName=c(t),n}},10900:function(t,e,n){var r=n(2265);let o=r.forwardRef(function(t,e){return r.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:e},t),r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 19l-7-7m0 0l7-7m-7 7h18"}))});e.Z=o}}]);
\ No newline at end of file
diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/6836-e30124a71aafae62.js b/litellm/proxy/_experimental/out/_next/static/chunks/6836-e30124a71aafae62.js
deleted file mode 100644
index 7c65a928e8f..00000000000
--- a/litellm/proxy/_experimental/out/_next/static/chunks/6836-e30124a71aafae62.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6836],{83669:function(t,e,n){n.d(e,{Z:function(){return s}});var o=n(1119),r=n(2265),c={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"},a=n(55015),s=r.forwardRef(function(t,e){return r.createElement(a.Z,(0,o.Z)({},t,{ref:e,icon:c}))})},62670:function(t,e,n){n.d(e,{Z:function(){return s}});var o=n(1119),r=n(2265),c={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"},a=n(55015),s=r.forwardRef(function(t,e){return r.createElement(a.Z,(0,o.Z)({},t,{ref:e,icon:c}))})},29271:function(t,e,n){n.d(e,{Z:function(){return s}});var o=n(1119),r=n(2265),c={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:"M464 688a48 48 0 1096 0 48 48 0 10-96 0zm24-112h48c4.4 0 8-3.6 8-8V296c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v272c0 4.4 3.6 8 8 8z"}}]},name:"exclamation-circle",theme:"outlined"},a=n(55015),s=r.forwardRef(function(t,e){return r.createElement(a.Z,(0,o.Z)({},t,{ref:e,icon:c}))})},89245:function(t,e,n){n.d(e,{Z:function(){return s}});var o=n(1119),r=n(2265),c={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"},a=n(55015),s=r.forwardRef(function(t,e){return r.createElement(a.Z,(0,o.Z)({},t,{ref:e,icon:c}))})},69993:function(t,e,n){n.d(e,{Z:function(){return s}});var o=n(1119),r=n(2265),c={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"},a=n(55015),s=r.forwardRef(function(t,e){return r.createElement(a.Z,(0,o.Z)({},t,{ref:e,icon:c}))})},57400:function(t,e,n){n.d(e,{Z:function(){return s}});var o=n(1119),r=n(2265),c={icon:{tag:"svg",attrs:{viewBox:"0 0 1024 1024",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64L128 192v384c0 212.1 171.9 384 384 384s384-171.9 384-384V192L512 64zm312 512c0 172.3-139.7 312-312 312S200 748.3 200 576V246l312-110 312 110v330z"}},{tag:"path",attrs:{d:"M378.4 475.1a35.91 35.91 0 00-50.9 0 35.91 35.91 0 000 50.9l129.4 129.4 2.1 2.1a33.98 33.98 0 0048.1 0L730.6 434a33.98 33.98 0 000-48.1l-2.8-2.8a33.98 33.98 0 00-48.1 0L483 579.7 378.4 475.1z"}}]},name:"safety",theme:"outlined"},a=n(55015),s=r.forwardRef(function(t,e){return r.createElement(a.Z,(0,o.Z)({},t,{ref:e,icon:c}))})},58630:function(t,e,n){n.d(e,{Z:function(){return s}});var o=n(1119),r=n(2265),c={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"},a=n(55015),s=r.forwardRef(function(t,e){return r.createElement(a.Z,(0,o.Z)({},t,{ref:e,icon:c}))})},49804:function(t,e,n){n.d(e,{Z:function(){return l}});var o=n(5853),r=n(97324),c=n(1153),a=n(2265),s=n(9496);let i=(0,c.fn)("Col"),l=a.forwardRef((t,e)=>{let{numColSpan:n=1,numColSpanSm:c,numColSpanMd:l,numColSpanLg:u,children:d,className:m}=t,p=(0,o._T)(t,["numColSpan","numColSpanSm","numColSpanMd","numColSpanLg","children","className"]),g=(t,e)=>t&&Object.keys(e).includes(String(t))?e[t]:"";return a.createElement("div",Object.assign({ref:e,className:(0,r.q)(i("root"),(()=>{let t=g(n,s.PT),e=g(c,s.SP),o=g(l,s.VS),a=g(u,s._w);return(0,r.q)(t,e,o,a)})(),m)},p),d)});l.displayName="Col"},67101:function(t,e,n){n.d(e,{Z:function(){return u}});var o=n(5853),r=n(97324),c=n(1153),a=n(2265),s=n(9496);let i=(0,c.fn)("Grid"),l=(t,e)=>t&&Object.keys(e).includes(String(t))?e[t]:"",u=a.forwardRef((t,e)=>{let{numItems:n=1,numItemsSm:c,numItemsMd:u,numItemsLg:d,children:m,className:p}=t,g=(0,o._T)(t,["numItems","numItemsSm","numItemsMd","numItemsLg","children","className"]),f=l(n,s._m),h=l(c,s.LH),v=l(u,s.l5),y=l(d,s.N4),b=(0,r.q)(f,h,v,y);return a.createElement("div",Object.assign({ref:e,className:(0,r.q)(i("root"),"grid",b,p)},g),m)});u.displayName="Grid"},9496:function(t,e,n){n.d(e,{LH:function(){return r},N4:function(){return a},PT:function(){return s},SP:function(){return i},VS:function(){return l},_m:function(){return o},_w:function(){return u},l5:function(){return c}});let o={0:"grid-cols-none",1:"grid-cols-1",2:"grid-cols-2",3:"grid-cols-3",4:"grid-cols-4",5:"grid-cols-5",6:"grid-cols-6",7:"grid-cols-7",8:"grid-cols-8",9:"grid-cols-9",10:"grid-cols-10",11:"grid-cols-11",12:"grid-cols-12"},r={0:"sm:grid-cols-none",1:"sm:grid-cols-1",2:"sm:grid-cols-2",3:"sm:grid-cols-3",4:"sm:grid-cols-4",5:"sm:grid-cols-5",6:"sm:grid-cols-6",7:"sm:grid-cols-7",8:"sm:grid-cols-8",9:"sm:grid-cols-9",10:"sm:grid-cols-10",11:"sm:grid-cols-11",12:"sm:grid-cols-12"},c={0:"md:grid-cols-none",1:"md:grid-cols-1",2:"md:grid-cols-2",3:"md:grid-cols-3",4:"md:grid-cols-4",5:"md:grid-cols-5",6:"md:grid-cols-6",7:"md:grid-cols-7",8:"md:grid-cols-8",9:"md:grid-cols-9",10:"md:grid-cols-10",11:"md:grid-cols-11",12:"md:grid-cols-12"},a={0:"lg:grid-cols-none",1:"lg:grid-cols-1",2:"lg:grid-cols-2",3:"lg:grid-cols-3",4:"lg:grid-cols-4",5:"lg:grid-cols-5",6:"lg:grid-cols-6",7:"lg:grid-cols-7",8:"lg:grid-cols-8",9:"lg:grid-cols-9",10:"lg:grid-cols-10",11:"lg:grid-cols-11",12:"lg:grid-cols-12"},s={1:"col-span-1",2:"col-span-2",3:"col-span-3",4:"col-span-4",5:"col-span-5",6:"col-span-6",7:"col-span-7",8:"col-span-8",9:"col-span-9",10:"col-span-10",11:"col-span-11",12:"col-span-12",13:"col-span-13"},i={1:"sm:col-span-1",2:"sm:col-span-2",3:"sm:col-span-3",4:"sm:col-span-4",5:"sm:col-span-5",6:"sm:col-span-6",7:"sm:col-span-7",8:"sm:col-span-8",9:"sm:col-span-9",10:"sm:col-span-10",11:"sm:col-span-11",12:"sm:col-span-12",13:"sm:col-span-13"},l={1:"md:col-span-1",2:"md:col-span-2",3:"md:col-span-3",4:"md:col-span-4",5:"md:col-span-5",6:"md:col-span-6",7:"md:col-span-7",8:"md:col-span-8",9:"md:col-span-9",10:"md:col-span-10",11:"md:col-span-11",12:"md:col-span-12",13:"md:col-span-13"},u={1:"lg:col-span-1",2:"lg:col-span-2",3:"lg:col-span-3",4:"lg:col-span-4",5:"lg:col-span-5",6:"lg:col-span-6",7:"lg:col-span-7",8:"lg:col-span-8",9:"lg:col-span-9",10:"lg:col-span-10",11:"lg:col-span-11",12:"lg:col-span-12",13:"lg:col-span-13"}},61778:function(t,e,n){n.d(e,{Z:function(){return H}});var o=n(2265),r=n(8900),c=n(39725),a=n(49638),s=n(54537),i=n(55726),l=n(36760),u=n.n(l),d=n(47970),m=n(18242),p=n(19722),g=n(71744),f=n(352),h=n(12918),v=n(80669);let y=(t,e,n,o,r)=>({background:t,border:"".concat((0,f.bf)(o.lineWidth)," ").concat(o.lineType," ").concat(e),["".concat(r,"-icon")]:{color:n}}),b=t=>{let{componentCls:e,motionDurationSlow:n,marginXS:o,marginSM:r,fontSize:c,fontSizeLG:a,lineHeight:s,borderRadiusLG:i,motionEaseInOutCirc:l,withDescriptionIconSize:u,colorText:d,colorTextHeading:m,withDescriptionPadding:p,defaultPadding:g}=t;return{[e]:Object.assign(Object.assign({},(0,h.Wf)(t)),{position:"relative",display:"flex",alignItems:"center",padding:g,wordWrap:"break-word",borderRadius:i,["&".concat(e,"-rtl")]:{direction:"rtl"},["".concat(e,"-content")]:{flex:1,minWidth:0},["".concat(e,"-icon")]:{marginInlineEnd:o,lineHeight:0},"&-description":{display:"none",fontSize:c,lineHeight:s},"&-message":{color:m},["&".concat(e,"-motion-leave")]:{overflow:"hidden",opacity:1,transition:"max-height ".concat(n," ").concat(l,", opacity ").concat(n," ").concat(l,",\n padding-top ").concat(n," ").concat(l,", padding-bottom ").concat(n," ").concat(l,",\n margin-bottom ").concat(n," ").concat(l)},["&".concat(e,"-motion-leave-active")]:{maxHeight:0,marginBottom:"0 !important",paddingTop:0,paddingBottom:0,opacity:0}}),["".concat(e,"-with-description")]:{alignItems:"flex-start",padding:p,["".concat(e,"-icon")]:{marginInlineEnd:r,fontSize:u,lineHeight:0},["".concat(e,"-message")]:{display:"block",marginBottom:o,color:m,fontSize:a},["".concat(e,"-description")]:{display:"block",color:d}},["".concat(e,"-banner")]:{marginBottom:0,border:"0 !important",borderRadius:0}}},w=t=>{let{componentCls:e,colorSuccess:n,colorSuccessBorder:o,colorSuccessBg:r,colorWarning:c,colorWarningBorder:a,colorWarningBg:s,colorError:i,colorErrorBorder:l,colorErrorBg:u,colorInfo:d,colorInfoBorder:m,colorInfoBg:p}=t;return{[e]:{"&-success":y(r,o,n,t,e),"&-info":y(p,m,d,t,e),"&-warning":y(s,a,c,t,e),"&-error":Object.assign(Object.assign({},y(u,l,i,t,e)),{["".concat(e,"-description > pre")]:{margin:0,padding:0}})}}},k=t=>{let{componentCls:e,iconCls:n,motionDurationMid:o,marginXS:r,fontSizeIcon:c,colorIcon:a,colorIconHover:s}=t;return{[e]:{"&-action":{marginInlineStart:r},["".concat(e,"-close-icon")]:{marginInlineStart:r,padding:0,overflow:"hidden",fontSize:c,lineHeight:(0,f.bf)(c),backgroundColor:"transparent",border:"none",outline:"none",cursor:"pointer",["".concat(n,"-close")]:{color:a,transition:"color ".concat(o),"&:hover":{color:s}}},"&-close-text":{color:a,transition:"color ".concat(o),"&:hover":{color:s}}}}};var x=(0,v.I$)("Alert",t=>[b(t),w(t),k(t)],t=>({withDescriptionIconSize:t.fontSizeHeading3,defaultPadding:"".concat(t.paddingContentVerticalSM,"px ").concat(12,"px"),withDescriptionPadding:"".concat(t.paddingMD,"px ").concat(t.paddingContentHorizontalLG,"px")})),Z=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&0>e.indexOf(o)&&(n[o]=t[o]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols)for(var r=0,o=Object.getOwnPropertySymbols(t);re.indexOf(o[r])&&Object.prototype.propertyIsEnumerable.call(t,o[r])&&(n[o[r]]=t[o[r]]);return n};let C={success:r.Z,info:i.Z,error:c.Z,warning:s.Z},E=t=>{let{icon:e,prefixCls:n,type:r}=t,c=C[r]||null;return e?(0,p.wm)(e,o.createElement("span",{className:"".concat(n,"-icon")},e),()=>({className:u()("".concat(n,"-icon"),{[e.props.className]:e.props.className})})):o.createElement(c,{className:"".concat(n,"-icon")})},M=t=>{let{isClosable:e,prefixCls:n,closeIcon:r,handleClose:c}=t,s=!0===r||void 0===r?o.createElement(a.Z,null):r;return e?o.createElement("button",{type:"button",onClick:c,className:"".concat(n,"-close-icon"),tabIndex:0},s):null};var O=t=>{let{description:e,prefixCls:n,message:r,banner:c,className:a,rootClassName:s,style:i,onMouseEnter:l,onMouseLeave:p,onClick:f,afterClose:h,showIcon:v,closable:y,closeText:b,closeIcon:w,action:k}=t,C=Z(t,["description","prefixCls","message","banner","className","rootClassName","style","onMouseEnter","onMouseLeave","onClick","afterClose","showIcon","closable","closeText","closeIcon","action"]),[O,S]=o.useState(!1),N=o.useRef(null),{getPrefixCls:z,direction:L,alert:j}=o.useContext(g.E_),R=z("alert",n),[I,H,P]=x(R),A=e=>{var n;S(!0),null===(n=t.onClose)||void 0===n||n.call(t,e)},V=o.useMemo(()=>void 0!==t.type?t.type:c?"warning":"info",[t.type,c]),B=o.useMemo(()=>!!b||("boolean"==typeof y?y:!1!==w&&null!=w),[b,w,y]),_=!!c&&void 0===v||v,q=u()(R,"".concat(R,"-").concat(V),{["".concat(R,"-with-description")]:!!e,["".concat(R,"-no-icon")]:!_,["".concat(R,"-banner")]:!!c,["".concat(R,"-rtl")]:"rtl"===L},null==j?void 0:j.className,a,s,P,H),W=(0,m.Z)(C,{aria:!0,data:!0});return I(o.createElement(d.ZP,{visible:!O,motionName:"".concat(R,"-motion"),motionAppear:!1,motionEnter:!1,onLeaveStart:t=>({maxHeight:t.offsetHeight}),onLeaveEnd:h},n=>{let{className:c,style:a}=n;return o.createElement("div",Object.assign({ref:N,"data-show":!O,className:u()(q,c),style:Object.assign(Object.assign(Object.assign({},null==j?void 0:j.style),i),a),onMouseEnter:l,onMouseLeave:p,onClick:f,role:"alert"},W),_?o.createElement(E,{description:e,icon:t.icon,prefixCls:R,type:V}):null,o.createElement("div",{className:"".concat(R,"-content")},r?o.createElement("div",{className:"".concat(R,"-message")},r):null,e?o.createElement("div",{className:"".concat(R,"-description")},e):null),k?o.createElement("div",{className:"".concat(R,"-action")},k):null,o.createElement(M,{isClosable:B,prefixCls:R,closeIcon:b||w,handleClose:A}))}))},S=n(76405),N=n(25049),z=n(37977),L=n(63929),j=n(24995),R=n(15354);let I=function(t){function e(){var t,n,o;return(0,S.Z)(this,e),n=e,o=arguments,n=(0,j.Z)(n),(t=(0,z.Z)(this,(0,L.Z)()?Reflect.construct(n,o||[],(0,j.Z)(this).constructor):n.apply(this,o))).state={error:void 0,info:{componentStack:""}},t}return(0,R.Z)(e,t),(0,N.Z)(e,[{key:"componentDidCatch",value:function(t,e){this.setState({error:t,info:e})}},{key:"render",value:function(){let{message:t,description:e,children:n}=this.props,{error:r,info:c}=this.state,a=c&&c.componentStack?c.componentStack:null,s=void 0===t?(r||"").toString():t;return r?o.createElement(O,{type:"error",message:s,description:o.createElement("pre",{style:{fontSize:"0.9em",overflowX:"auto"}},void 0===e?a:e)}):n}}]),e}(o.Component);O.ErrorBoundary=I;var H=O},93142:function(t,e,n){n.d(e,{Z:function(){return v}});var o=n(2265),r=n(36760),c=n.n(r),a=n(45287);function s(t){return["small","middle","large"].includes(t)}function i(t){return!!t&&"number"==typeof t&&!Number.isNaN(t)}var l=n(71744),u=n(65658);let d=o.createContext({latestIndex:0}),m=d.Provider;var p=t=>{let{className:e,index:n,children:r,split:c,style:a}=t,{latestIndex:s}=o.useContext(d);return null==r?null:o.createElement(o.Fragment,null,o.createElement("div",{className:e,style:a},r),ne.indexOf(o)&&(n[o]=t[o]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols)for(var r=0,o=Object.getOwnPropertySymbols(t);re.indexOf(o[r])&&Object.prototype.propertyIsEnumerable.call(t,o[r])&&(n[o[r]]=t[o[r]]);return n};let h=o.forwardRef((t,e)=>{var n,r;let{getPrefixCls:u,space:d,direction:h}=o.useContext(l.E_),{size:v=(null==d?void 0:d.size)||"small",align:y,className:b,rootClassName:w,children:k,direction:x="horizontal",prefixCls:Z,split:C,style:E,wrap:M=!1,classNames:O,styles:S}=t,N=f(t,["size","align","className","rootClassName","children","direction","prefixCls","split","style","wrap","classNames","styles"]),[z,L]=Array.isArray(v)?v:[v,v],j=s(L),R=s(z),I=i(L),H=i(z),P=(0,a.Z)(k,{keepEmpty:!0}),A=void 0===y&&"horizontal"===x?"center":y,V=u("space",Z),[B,_,q]=(0,g.Z)(V),W=c()(V,null==d?void 0:d.className,_,"".concat(V,"-").concat(x),{["".concat(V,"-rtl")]:"rtl"===h,["".concat(V,"-align-").concat(A)]:A,["".concat(V,"-gap-row-").concat(L)]:j,["".concat(V,"-gap-col-").concat(z)]:R},b,w,q),T=c()("".concat(V,"-item"),null!==(n=null==O?void 0:O.item)&&void 0!==n?n:null===(r=null==d?void 0:d.classNames)||void 0===r?void 0:r.item),D=0,G=P.map((t,e)=>{var n,r;null!=t&&(D=e);let c=t&&t.key||"".concat(T,"-").concat(e);return o.createElement(p,{className:T,key:c,index:e,split:C,style:null!==(n=null==S?void 0:S.item)&&void 0!==n?n:null===(r=null==d?void 0:d.styles)||void 0===r?void 0:r.item},t)}),U=o.useMemo(()=>({latestIndex:D}),[D]);if(0===P.length)return null;let K={};return M&&(K.flexWrap="wrap"),!R&&H&&(K.columnGap=z),!j&&I&&(K.rowGap=L),B(o.createElement("div",Object.assign({ref:e,className:W,style:Object.assign(Object.assign(Object.assign({},K),null==d?void 0:d.style),E)},N),o.createElement(m,{value:U},G)))});h.Compact=u.ZP;var v=h},79205:function(t,e,n){n.d(e,{Z:function(){return d}});var o=n(2265);let r=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),c=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,e,n)=>n?n.toUpperCase():e.toLowerCase()),a=t=>{let e=c(t);return e.charAt(0).toUpperCase()+e.slice(1)},s=function(){for(var t=arguments.length,e=Array(t),n=0;n!!t&&""!==t.trim()&&n.indexOf(t)===e).join(" ").trim()},i=t=>{for(let e in t)if(e.startsWith("aria-")||"role"===e||"title"===e)return!0};var l={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let u=(0,o.forwardRef)((t,e)=>{let{color:n="currentColor",size:r=24,strokeWidth:c=2,absoluteStrokeWidth:a,className:u="",children:d,iconNode:m,...p}=t;return(0,o.createElement)("svg",{ref:e,...l,width:r,height:r,stroke:n,strokeWidth:a?24*Number(c)/Number(r):c,className:s("lucide",u),...!d&&!i(p)&&{"aria-hidden":"true"},...p},[...m.map(t=>{let[e,n]=t;return(0,o.createElement)(e,n)}),...Array.isArray(d)?d:[d]])}),d=(t,e)=>{let n=(0,o.forwardRef)((n,c)=>{let{className:i,...l}=n;return(0,o.createElement)(u,{ref:c,iconNode:e,className:s("lucide-".concat(r(a(t))),"lucide-".concat(t),i),...l})});return n.displayName=a(t),n}},30401:function(t,e,n){n.d(e,{Z:function(){return o}});let o=(0,n(79205).Z)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]])},64935:function(t,e,n){n.d(e,{Z:function(){return o}});let o=(0,n(79205).Z)("code",[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]])},78867:function(t,e,n){n.d(e,{Z:function(){return o}});let o=(0,n(79205).Z)("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]])},96362:function(t,e,n){n.d(e,{Z:function(){return o}});let o=(0,n(79205).Z)("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"}]])},29202:function(t,e,n){n.d(e,{Z:function(){return o}});let o=(0,n(79205).Z)("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"}]])},54001:function(t,e,n){n.d(e,{Z:function(){return o}});let o=(0,n(79205).Z)("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"}]])},96137:function(t,e,n){n.d(e,{Z:function(){return o}});let o=(0,n(79205).Z)("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"}]])},80221:function(t,e,n){n.d(e,{Z:function(){return o}});let o=(0,n(79205).Z)("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]])},11239:function(t,e,n){n.d(e,{Z:function(){return o}});let o=(0,n(79205).Z)("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"}]])},10900:function(t,e,n){var o=n(2265);let r=o.forwardRef(function(t,e){return o.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:e},t),o.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 19l-7-7m0 0l7-7m-7 7h18"}))});e.Z=r},71437:function(t,e,n){var o=n(2265);let r=o.forwardRef(function(t,e){return o.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:e},t),o.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),o.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.Z=r},82376:function(t,e,n){var o=n(2265);let r=o.forwardRef(function(t,e){return o.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:e},t),o.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"}))});e.Z=r},29827:function(t,e,n){n.d(e,{NL:function(){return a},aH:function(){return s}});var o=n(2265),r=n(57437),c=o.createContext(void 0),a=t=>{let e=o.useContext(c);if(t)return t;if(!e)throw Error("No QueryClient set, use QueryClientProvider to set one");return e},s=t=>{let{client:e,children:n}=t;return o.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,r.jsx)(c.Provider,{value:e,children:n})}},21770:function(t,e,n){n.d(e,{D:function(){return d}});var o=n(2265),r=n(2894),c=n(18238),a=n(24112),s=n(45345),i=class extends a.l{#t;#e=void 0;#n;#o;constructor(t,e){super(),this.#t=t,this.setOptions(e),this.bindMethods(),this.#r()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){let e=this.options;this.options=this.#t.defaultMutationOptions(t),(0,s.VS)(this.options,e)||this.#t.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#n,observer:this}),e?.mutationKey&&this.options.mutationKey&&(0,s.Ym)(e.mutationKey)!==(0,s.Ym)(this.options.mutationKey)?this.reset():this.#n?.state.status==="pending"&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(t){this.#r(),this.#c(t)}getCurrentResult(){return this.#e}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#r(),this.#c()}mutate(t,e){return this.#o=e,this.#n?.removeObserver(this),this.#n=this.#t.getMutationCache().build(this.#t,this.options),this.#n.addObserver(this),this.#n.execute(t)}#r(){let t=this.#n?.state??(0,r.R)();this.#e={...t,isPending:"pending"===t.status,isSuccess:"success"===t.status,isError:"error"===t.status,isIdle:"idle"===t.status,mutate:this.mutate,reset:this.reset}}#c(t){c.V.batch(()=>{if(this.#o&&this.hasListeners()){let e=this.#e.variables,n=this.#e.context;t?.type==="success"?(this.#o.onSuccess?.(t.data,e,n),this.#o.onSettled?.(t.data,null,e,n)):t?.type==="error"&&(this.#o.onError?.(t.error,e,n),this.#o.onSettled?.(void 0,t.error,e,n))}this.listeners.forEach(t=>{t(this.#e)})})}},l=n(29827),u=n(51172);function d(t,e){let n=(0,l.NL)(e),[r]=o.useState(()=>new i(n,t));o.useEffect(()=>{r.setOptions(t)},[r,t]);let a=o.useSyncExternalStore(o.useCallback(t=>r.subscribe(c.V.batchCalls(t)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),s=o.useCallback((t,e)=>{r.mutate(t,e).catch(u.Z)},[r]);if(a.error&&(0,u.L)(r.options.throwOnError,[a.error]))throw a.error;return{...a,mutate:s,mutateAsync:a.mutate}}}}]);
\ No newline at end of file
diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/6925-d4eca81aad56779e.js b/litellm/proxy/_experimental/out/_next/static/chunks/6925-44a56ef45075ee91.js
similarity index 100%
rename from litellm/proxy/_experimental/out/_next/static/chunks/6925-d4eca81aad56779e.js
rename to litellm/proxy/_experimental/out/_next/static/chunks/6925-44a56ef45075ee91.js
diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/7155-d31924ad3d34db5e.js b/litellm/proxy/_experimental/out/_next/static/chunks/7155-27d718d02ba5a250.js
similarity index 99%
rename from litellm/proxy/_experimental/out/_next/static/chunks/7155-d31924ad3d34db5e.js
rename to litellm/proxy/_experimental/out/_next/static/chunks/7155-27d718d02ba5a250.js
index c1f542b6fc6..918151fa498 100644
--- a/litellm/proxy/_experimental/out/_next/static/chunks/7155-d31924ad3d34db5e.js
+++ b/litellm/proxy/_experimental/out/_next/static/chunks/7155-27d718d02ba5a250.js
@@ -1 +1 @@
-"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7155],{88913:function(e,s,l){l.d(s,{Dx:function(){return d.Z},Zb:function(){return a.Z},iz:function(){return r.Z},oi:function(){return n.Z},xv:function(){return i.Z},zx:function(){return t.Z}});var t=l(20831),a=l(12514),r=l(67982),i=l(84264),n=l(49566),d=l(96761)},77155:function(e,s,l){l.d(s,{Z:function(){return ey}});var t=l(57437),a=l(2265),r=l(58643),i=l(19250),n=l(16312),d=l(7765),o=l(57365),c=l(49566),u=l(13634),m=l(82680),x=l(52787),h=l(20577),g=l(73002),j=l(24199),p=l(65925),v=e=>{let{visible:s,possibleUIRoles:l,onCancel:r,user:i,onSubmit:n}=e,[d,v]=(0,a.useState)(i),[f]=u.Z.useForm();(0,a.useEffect)(()=>{f.resetFields()},[i]);let y=async()=>{f.resetFields(),r()},b=async e=>{n(e),f.resetFields(),r()};return i?(0,t.jsx)(m.Z,{visible:s,onCancel:y,footer:null,title:"Edit User "+i.user_id,width:1e3,children:(0,t.jsx)(u.Z,{form:f,onFinish:b,initialValues:i,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(u.Z.Item,{className:"mt-8",label:"User Email",tooltip:"Email of the User",name:"user_email",children:(0,t.jsx)(c.Z,{})}),(0,t.jsx)(u.Z.Item,{label:"user_id",name:"user_id",hidden:!0,children:(0,t.jsx)(c.Z,{})}),(0,t.jsx)(u.Z.Item,{label:"User Role",name:"user_role",children:(0,t.jsx)(x.default,{children:l&&Object.entries(l).map(e=>{let[s,{ui_label:l,description:a}]=e;return(0,t.jsx)(o.Z,{value:s,title:l,children:(0,t.jsxs)("div",{className:"flex",children:[l," ",(0,t.jsx)("p",{className:"ml-2",style:{color:"gray",fontSize:"12px"},children:a})]})},s)})})}),(0,t.jsx)(u.Z.Item,{label:"Spend (USD)",name:"spend",tooltip:"(float) - Spend of all LLM calls completed by this user",help:"Across all keys (including keys with team_id).",children:(0,t.jsx)(h.Z,{min:0,step:.01})}),(0,t.jsx)(u.Z.Item,{label:"User Budget (USD)",name:"max_budget",tooltip:"(float) - Maximum budget of this user",help:"Maximum budget of this user.",children:(0,t.jsx)(j.Z,{min:0,step:.01})}),(0,t.jsx)(u.Z.Item,{label:"Reset Budget",name:"budget_duration",children:(0,t.jsx)(p.Z,{})}),(0,t.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,t.jsx)(g.ZP,{htmlType:"submit",children:"Save"})}),(0,t.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,t.jsx)(g.ZP,{htmlType:"submit",children:"Save"})})]})})}):null},f=l(98187),y=l(93192),b=l(42264),_=l(61994),N=l(72188),w=l(23496),k=l(67960),Z=l(93142),S=l(89970),C=l(16853),U=l(46468),I=l(20347),D=l(15424);function z(e){let{userData:s,onCancel:l,onSubmit:r,teams:i,accessToken:d,userID:m,userRole:h,userModels:g,possibleUIRoles:v,isBulkEdit:f=!1}=e,[y]=u.Z.useForm();return a.useEffect(()=>{var e,l,t,a,r,i;y.setFieldsValue({user_id:s.user_id,user_email:null===(e=s.user_info)||void 0===e?void 0:e.user_email,user_role:null===(l=s.user_info)||void 0===l?void 0:l.user_role,models:(null===(t=s.user_info)||void 0===t?void 0:t.models)||[],max_budget:null===(a=s.user_info)||void 0===a?void 0:a.max_budget,budget_duration:null===(r=s.user_info)||void 0===r?void 0:r.budget_duration,metadata:(null===(i=s.user_info)||void 0===i?void 0:i.metadata)?JSON.stringify(s.user_info.metadata,null,2):void 0})},[s,y]),(0,t.jsxs)(u.Z,{form:y,onFinish:e=>{if(e.metadata&&"string"==typeof e.metadata)try{e.metadata=JSON.parse(e.metadata)}catch(e){console.error("Error parsing metadata JSON:",e);return}r(e)},layout:"vertical",children:[!f&&(0,t.jsx)(u.Z.Item,{label:"User ID",name:"user_id",children:(0,t.jsx)(c.Z,{disabled:!0})}),!f&&(0,t.jsx)(u.Z.Item,{label:"Email",name:"user_email",children:(0,t.jsx)(c.Z,{})}),(0,t.jsx)(u.Z.Item,{label:(0,t.jsxs)("span",{children:["Global Proxy Role"," ",(0,t.jsx)(S.Z,{title:"This is the role that the user will globally on the proxy. This role is independent of any team/org specific roles.",children:(0,t.jsx)(D.Z,{})})]}),name:"user_role",children:(0,t.jsx)(x.default,{children:v&&Object.entries(v).map(e=>{let[s,{ui_label:l,description:a}]=e;return(0,t.jsx)(o.Z,{value:s,title:l,children:(0,t.jsxs)("div",{className:"flex",children:[l," ",(0,t.jsx)("p",{className:"ml-2",style:{color:"gray",fontSize:"12px"},children:a})]})},s)})})}),(0,t.jsx)(u.Z.Item,{label:(0,t.jsxs)("span",{children:["Personal Models"," ",(0,t.jsx)(S.Z,{title:"Select which models this user can access outside of team-scope. Choose 'All Proxy Models' to grant access to all models available on the proxy.",children:(0,t.jsx)(D.Z,{style:{marginLeft:"4px"}})})]}),name:"models",children:(0,t.jsxs)(x.default,{mode:"multiple",placeholder:"Select models",style:{width:"100%"},disabled:!I.ZL.includes(h||""),children:[(0,t.jsx)(x.default.Option,{value:"all-proxy-models",children:"All Proxy Models"},"all-proxy-models"),(0,t.jsx)(x.default.Option,{value:"no-default-models",children:"No Default Models"},"no-default-models"),g.map(e=>(0,t.jsx)(x.default.Option,{value:e,children:(0,U.W0)(e)},e))]})}),(0,t.jsx)(u.Z.Item,{label:"Max Budget (USD)",name:"max_budget",children:(0,t.jsx)(j.Z,{step:.01,precision:2,style:{width:"100%"}})}),(0,t.jsx)(u.Z.Item,{label:"Reset Budget",name:"budget_duration",children:(0,t.jsx)(p.Z,{})}),(0,t.jsx)(u.Z.Item,{label:"Metadata",name:"metadata",children:(0,t.jsx)(C.Z,{rows:4,placeholder:"Enter metadata as JSON"})}),(0,t.jsxs)("div",{className:"flex justify-end space-x-2",children:[(0,t.jsx)(n.z,{variant:"secondary",type:"button",onClick:l,children:"Cancel"}),(0,t.jsx)(n.z,{type:"submit",children:"Save Changes"})]})]})}var A=l(9114);let{Text:L,Title:B}=y.default;var E=e=>{let{visible:s,onCancel:l,selectedUsers:r,possibleUIRoles:n,accessToken:d,onSuccess:o,teams:c,userRole:u,userModels:g,allowAllUsers:j=!1}=e,[p,v]=(0,a.useState)(!1),[f,y]=(0,a.useState)([]),[S,C]=(0,a.useState)(null),[U,I]=(0,a.useState)(!1),[D,E]=(0,a.useState)(!1),M=()=>{y([]),C(null),I(!1),E(!1),l()},R=a.useMemo(()=>({user_id:"bulk_edit",user_info:{user_email:"",user_role:"",teams:[],models:[],max_budget:null,spend:0,metadata:{},created_at:null,updated_at:null},keys:[],teams:c||[]}),[c,s]),O=async e=>{if(console.log("formValues",e),!d){A.Z.fromBackend("Access token not found");return}v(!0);try{let s=r.map(e=>e.user_id),t={};e.user_role&&""!==e.user_role&&(t.user_role=e.user_role),null!==e.max_budget&&void 0!==e.max_budget&&(t.max_budget=e.max_budget),e.models&&e.models.length>0&&(t.models=e.models),e.budget_duration&&""!==e.budget_duration&&(t.budget_duration=e.budget_duration),e.metadata&&Object.keys(e.metadata).length>0&&(t.metadata=e.metadata);let a=Object.keys(t).length>0,n=U&&f.length>0;if(!a&&!n){A.Z.fromBackend("Please modify at least one field or select teams to add users to");return}let c=[];if(a){if(D){let e=await (0,i.userBulkUpdateUserCall)(d,t,void 0,!0);c.push("Updated all users (".concat(e.total_requested," total)"))}else await (0,i.userBulkUpdateUserCall)(d,t,s),c.push("Updated ".concat(s.length," user(s)"))}if(n){let e=[];for(let s of f)try{let l=null;D?l=null:r.map(e=>({user_id:e.user_id,role:"user",user_email:e.user_email||null}));let t=await (0,i.teamBulkMemberAddCall)(d,s,l||null,S||void 0,D);console.log("result",t),e.push({teamId:s,success:!0,successfulAdditions:t.successful_additions,failedAdditions:t.failed_additions})}catch(l){console.error("Failed to add users to team ".concat(s,":"),l),e.push({teamId:s,success:!1,error:l})}let s=e.filter(e=>e.success),l=e.filter(e=>!e.success);if(s.length>0){let e=s.reduce((e,s)=>e+s.successfulAdditions,0);c.push("Added users to ".concat(s.length," team(s) (").concat(e," total additions)"))}l.length>0&&b.ZP.warning("Failed to add users to ".concat(l.length," team(s)"))}c.length>0&&A.Z.success(c.join(". ")),y([]),C(null),I(!1),E(!1),o(),l()}catch(e){console.error("Bulk operation failed:",e),A.Z.fromBackend("Failed to perform bulk operations")}finally{v(!1)}};return(0,t.jsxs)(m.Z,{visible:s,onCancel:M,footer:null,title:D?"Bulk Edit All Users":"Bulk Edit ".concat(r.length," User(s)"),width:800,children:[j&&(0,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsx)(_.Z,{checked:D,onChange:e=>E(e.target.checked),children:(0,t.jsx)(L,{strong:!0,children:"Update ALL users in the system"})}),D&&(0,t.jsx)("div",{style:{marginTop:8},children:(0,t.jsx)(L,{type:"warning",style:{fontSize:"12px"},children:"⚠️ This will apply changes to ALL users in the system, not just the selected ones."})})]}),!D&&(0,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsxs)(B,{level:5,children:["Selected Users (",r.length,"):"]}),(0,t.jsx)(N.Z,{size:"small",bordered:!0,dataSource:r,pagination:!1,scroll:{y:200},rowKey:"user_id",columns:[{title:"User ID",dataIndex:"user_id",key:"user_id",width:"30%",render:e=>(0,t.jsx)(L,{strong:!0,style:{fontSize:"12px"},children:e.length>20?"".concat(e.slice(0,20),"..."):e})},{title:"Email",dataIndex:"user_email",key:"user_email",width:"25%",render:e=>(0,t.jsx)(L,{type:"secondary",style:{fontSize:"12px"},children:e||"No email"})},{title:"Current Role",dataIndex:"user_role",key:"user_role",width:"25%",render:e=>{var s;return(0,t.jsx)(L,{style:{fontSize:"12px"},children:(null==n?void 0:null===(s=n[e])||void 0===s?void 0:s.ui_label)||e})}},{title:"Budget",dataIndex:"max_budget",key:"max_budget",width:"20%",render:e=>(0,t.jsx)(L,{style:{fontSize:"12px"},children:null!==e?"$".concat(e):"Unlimited"})}]})]}),(0,t.jsx)(w.Z,{}),(0,t.jsx)("div",{className:"mb-4",children:(0,t.jsxs)(L,{children:[(0,t.jsx)("strong",{children:"Instructions:"})," Fill in the fields below with the values you want to apply to all selected users. You can bulk edit: role, budget, models, and metadata. You can also add users to teams."]})}),(0,t.jsx)(k.Z,{title:"Team Management",size:"small",className:"mb-4",style:{backgroundColor:"#fafafa"},children:(0,t.jsxs)(Z.Z,{direction:"vertical",style:{width:"100%"},children:[(0,t.jsx)(_.Z,{checked:U,onChange:e=>I(e.target.checked),children:"Add selected users to teams"}),U&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(L,{strong:!0,children:"Select Teams:"}),(0,t.jsx)(x.default,{mode:"multiple",placeholder:"Select teams to add users to",value:f,onChange:y,style:{width:"100%",marginTop:8},options:(null==c?void 0:c.map(e=>({label:e.team_alias||e.team_id,value:e.team_id})))||[]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(L,{strong:!0,children:"Team Budget (Optional):"}),(0,t.jsx)(h.Z,{placeholder:"Max budget per user in team",value:S,onChange:e=>C(e),style:{width:"100%",marginTop:8},min:0,step:.01,precision:2}),(0,t.jsx)(L,{type:"secondary",style:{fontSize:"12px"},children:"Leave empty for unlimited budget within team limits"})]}),(0,t.jsx)(L,{type:"secondary",style:{fontSize:"12px"},children:'Users will be added with "user" role by default. All users will be added to each selected team.'})]})]})}),(0,t.jsx)(z,{userData:R,onCancel:M,onSubmit:O,teams:c,accessToken:d,userID:"bulk_edit",userRole:u,userModels:g,possibleUIRoles:n,isBulkEdit:!0}),p&&(0,t.jsx)("div",{style:{textAlign:"center",marginTop:"10px"},children:(0,t.jsxs)(L,{children:["Updating ",D?"all users":r.length," user(s)..."]})})]})},M=l(41649),R=l(67101),O=l(47323),T=l(15731),P=l(53410),F=l(74998),K=l(23628),V=l(59872);let q=(e,s,l,a,r,i)=>{let n=[{header:"User ID",accessorKey:"user_id",cell:e=>{let{row:s}=e;return(0,t.jsx)(S.Z,{title:s.original.user_id,children:(0,t.jsx)("span",{className:"text-xs",children:s.original.user_id?"".concat(s.original.user_id.slice(0,7),"..."):"-"})})}},{header:"Email",accessorKey:"user_email",cell:e=>{let{row:s}=e;return(0,t.jsx)("span",{className:"text-xs",children:s.original.user_email||"-"})}},{header:"Global Proxy Role",accessorKey:"user_role",cell:s=>{var l;let{row:a}=s;return(0,t.jsx)("span",{className:"text-xs",children:(null==e?void 0:null===(l=e[a.original.user_role])||void 0===l?void 0:l.ui_label)||"-"})}},{header:"Spend (USD)",accessorKey:"spend",cell:e=>{let{row:s}=e;return(0,t.jsx)("span",{className:"text-xs",children:s.original.spend?(0,V.pw)(s.original.spend,4):"-"})}},{header:"Budget (USD)",accessorKey:"max_budget",cell:e=>{let{row:s}=e;return(0,t.jsx)("span",{className:"text-xs",children:null!==s.original.max_budget?s.original.max_budget:"Unlimited"})}},{header:()=>(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{children:"SSO ID"}),(0,t.jsx)(S.Z,{title:"SSO ID is the ID of the user in the SSO provider. If the user is not using SSO, this will be null.",children:(0,t.jsx)(T.Z,{className:"w-4 h-4"})})]}),accessorKey:"sso_user_id",cell:e=>{let{row:s}=e;return(0,t.jsx)("span",{className:"text-xs",children:null!==s.original.sso_user_id?s.original.sso_user_id:"-"})}},{header:"API Keys",accessorKey:"key_count",cell:e=>{let{row:s}=e;return(0,t.jsx)(R.Z,{numItems:2,children:s.original.key_count>0?(0,t.jsxs)(M.Z,{size:"xs",color:"indigo",children:[s.original.key_count," Keys"]}):(0,t.jsx)(M.Z,{size:"xs",color:"gray",children:"No Keys"})})}},{header:"Created At",accessorKey:"created_at",sortingFn:"datetime",cell:e=>{let{row:s}=e;return(0,t.jsx)("span",{className:"text-xs",children:s.original.created_at?new Date(s.original.created_at).toLocaleDateString():"-"})}},{header:"Updated At",accessorKey:"updated_at",sortingFn:"datetime",cell:e=>{let{row:s}=e;return(0,t.jsx)("span",{className:"text-xs",children:s.original.updated_at?new Date(s.original.updated_at).toLocaleDateString():"-"})}},{id:"actions",header:"",cell:e=>{let{row:s}=e;return(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(S.Z,{title:"Edit user details",zIndex:9999,children:(0,t.jsx)(O.Z,{icon:P.Z,size:"sm",onClick:()=>r(s.original.user_id,!0)})}),(0,t.jsx)(S.Z,{title:"Delete user",zIndex:9999,children:(0,t.jsx)(O.Z,{icon:F.Z,size:"sm",onClick:()=>l(s.original.user_id)})}),(0,t.jsx)(S.Z,{title:"Reset Password",zIndex:9999,children:(0,t.jsx)(O.Z,{icon:K.Z,size:"sm",onClick:()=>a(s.original.user_id)})})]})}}];if(i){let{onSelectUser:e,onSelectAll:s,isUserSelected:l,isAllSelected:a,isIndeterminate:r}=i;return[{id:"select",header:()=>(0,t.jsx)(_.Z,{indeterminate:r,checked:a,onChange:e=>s(e.target.checked),onClick:e=>e.stopPropagation()}),cell:s=>{let{row:a}=s;return(0,t.jsx)(_.Z,{checked:l(a.original),onChange:s=>e(a.original,s.target.checked),onClick:e=>e.stopPropagation()})}},...n]}return n};var G=l(71594),J=l(24525),W=l(27281),Q=l(21626),$=l(97214),H=l(28241),Y=l(58834),X=l(69552),ee=l(71876),es=l(44633),el=l(86462),et=l(49084),ea=l(84717),er=l(10900),ei=l(30401),en=l(78867);function ed(e){var s,l,r,n,d,o,c,u,m,x,h,j,v,y,b,_,N,w,k,Z,S,C,U,D,L,B,E,M,R,O,T,P,q,G,J,W,Q;let{userId:$,onClose:H,accessToken:Y,userRole:X,onDelete:ee,possibleUIRoles:es,initialTab:el=0,startInEditMode:et=!1}=e,[ed,eo]=(0,a.useState)(null),[ec,eu]=(0,a.useState)(!1),[em,ex]=(0,a.useState)(!0),[eh,eg]=(0,a.useState)(et),[ej,ep]=(0,a.useState)([]),[ev,ef]=(0,a.useState)(!1),[ey,eb]=(0,a.useState)(null),[e_,eN]=(0,a.useState)(null),[ew,ek]=(0,a.useState)(el),[eZ,eS]=(0,a.useState)({}),[eC,eU]=(0,a.useState)(!1);a.useEffect(()=>{eN((0,i.getProxyBaseUrl)())},[]),a.useEffect(()=>{console.log("userId: ".concat($,", userRole: ").concat(X,", accessToken: ").concat(Y)),(async()=>{try{if(!Y)return;let e=await (0,i.userInfoCall)(Y,$,X||"",!1,null,null,!0);eo(e);let s=(await (0,i.modelAvailableCall)(Y,$,X||"")).data.map(e=>e.id);ep(s)}catch(e){console.error("Error fetching user data:",e),A.Z.fromBackend("Failed to fetch user data")}finally{ex(!1)}})()},[Y,$,X]);let eI=async()=>{if(!Y){A.Z.fromBackend("Access token not found");return}try{A.Z.success("Generating password reset link...");let e=await (0,i.invitationCreateCall)(Y,$);eb(e),ef(!0)}catch(e){A.Z.fromBackend("Failed to generate password reset link")}},eD=async()=>{try{if(!Y)return;await (0,i.userDeleteCall)(Y,[$]),A.Z.success("User deleted successfully"),ee&&ee(),H()}catch(e){console.error("Error deleting user:",e),A.Z.fromBackend("Failed to delete user")}},ez=async e=>{try{if(!Y||!ed)return;await (0,i.userUpdateUserCall)(Y,e,null),eo({...ed,user_info:{...ed.user_info,user_email:e.user_email,models:e.models,max_budget:e.max_budget,budget_duration:e.budget_duration,metadata:e.metadata}}),A.Z.success("User updated successfully"),eg(!1)}catch(e){console.error("Error updating user:",e),A.Z.fromBackend("Failed to update user")}};if(em)return(0,t.jsxs)("div",{className:"p-4",children:[(0,t.jsx)(ea.zx,{icon:er.Z,variant:"light",onClick:H,className:"mb-4",children:"Back to Users"}),(0,t.jsx)(ea.xv,{children:"Loading user data..."})]});if(!ed)return(0,t.jsxs)("div",{className:"p-4",children:[(0,t.jsx)(ea.zx,{icon:er.Z,variant:"light",onClick:H,className:"mb-4",children:"Back to Users"}),(0,t.jsx)(ea.xv,{children:"User not found"})]});let eA=async(e,s)=>{await (0,V.vQ)(e)&&(eS(e=>({...e,[s]:!0})),setTimeout(()=>{eS(e=>({...e,[s]:!1}))},2e3))};return(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)(ea.zx,{icon:er.Z,variant:"light",onClick:H,className:"mb-4",children:"Back to Users"}),(0,t.jsx)(ea.Dx,{children:(null===(s=ed.user_info)||void 0===s?void 0:s.user_email)||"User"}),(0,t.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,t.jsx)(ea.xv,{className:"text-gray-500 font-mono",children:ed.user_id}),(0,t.jsx)(g.ZP,{type:"text",size:"small",icon:eZ["user-id"]?(0,t.jsx)(ei.Z,{size:12}):(0,t.jsx)(en.Z,{size:12}),onClick:()=>eA(ed.user_id,"user-id"),className:"left-2 z-10 transition-all duration-200 ".concat(eZ["user-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]})]}),X&&I.LQ.includes(X)&&(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)(ea.zx,{icon:K.Z,variant:"secondary",onClick:eI,className:"flex items-center",children:"Reset Password"}),(0,t.jsx)(ea.zx,{icon:F.Z,variant:"secondary",onClick:()=>eu(!0),className:"flex items-center",children:"Delete User"})]})]}),ec&&(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.jsx)("span",{className:"hidden sm:inline-block sm:align-middle sm:h-screen","aria-hidden":"true",children:""}),(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 User"}),(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 user?"})})]})})}),(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)(ea.zx,{onClick:eD,color:"red",className:"ml-2",children:"Delete"}),(0,t.jsx)(ea.zx,{onClick:()=>eu(!1),children:"Cancel"})]})]})]})}),(0,t.jsxs)(ea.v0,{defaultIndex:ew,onIndexChange:ek,children:[(0,t.jsxs)(ea.td,{className:"mb-4",children:[(0,t.jsx)(ea.OK,{children:"Overview"}),(0,t.jsx)(ea.OK,{children:"Details"})]}),(0,t.jsxs)(ea.nP,{children:[(0,t.jsx)(ea.x4,{children:(0,t.jsxs)(ea.rj,{numItems:1,numItemsSm:2,numItemsLg:3,className:"gap-6",children:[(0,t.jsxs)(ea.Zb,{children:[(0,t.jsx)(ea.xv,{children:"Spend"}),(0,t.jsxs)("div",{className:"mt-2",children:[(0,t.jsxs)(ea.Dx,{children:["$",(0,V.pw)((null===(l=ed.user_info)||void 0===l?void 0:l.spend)||0,4)]}),(0,t.jsxs)(ea.xv,{children:["of"," ",(null===(r=ed.user_info)||void 0===r?void 0:r.max_budget)!==null?"$".concat((0,V.pw)(ed.user_info.max_budget,4)):"Unlimited"]})]})]}),(0,t.jsxs)(ea.Zb,{children:[(0,t.jsx)(ea.xv,{children:"Teams"}),(0,t.jsx)("div",{className:"mt-2",children:(null===(n=ed.teams)||void 0===n?void 0:n.length)&&(null===(d=ed.teams)||void 0===d?void 0:d.length)>0?(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[null===(o=ed.teams)||void 0===o?void 0:o.slice(0,eC?ed.teams.length:20).map((e,s)=>(0,t.jsx)(ea.Ct,{color:"blue",title:e.team_alias,children:e.team_alias},s)),!eC&&(null===(c=ed.teams)||void 0===c?void 0:c.length)>20&&(0,t.jsxs)(ea.Ct,{color:"gray",className:"cursor-pointer hover:bg-gray-200 transition-colors",onClick:()=>eU(!0),children:["+",ed.teams.length-20," more"]}),eC&&(null===(u=ed.teams)||void 0===u?void 0:u.length)>20&&(0,t.jsx)(ea.Ct,{color:"gray",className:"cursor-pointer hover:bg-gray-200 transition-colors",onClick:()=>eU(!1),children:"Show Less"})]}):(0,t.jsx)(ea.xv,{children:"No teams"})})]}),(0,t.jsxs)(ea.Zb,{children:[(0,t.jsx)(ea.xv,{children:"API Keys"}),(0,t.jsx)("div",{className:"mt-2",children:(0,t.jsxs)(ea.xv,{children:[(null===(m=ed.keys)||void 0===m?void 0:m.length)||0," keys"]})})]}),(0,t.jsxs)(ea.Zb,{children:[(0,t.jsx)(ea.xv,{children:"Personal Models"}),(0,t.jsx)("div",{className:"mt-2",children:(null===(h=ed.user_info)||void 0===h?void 0:null===(x=h.models)||void 0===x?void 0:x.length)&&(null===(v=ed.user_info)||void 0===v?void 0:null===(j=v.models)||void 0===j?void 0:j.length)>0?null===(b=ed.user_info)||void 0===b?void 0:null===(y=b.models)||void 0===y?void 0:y.map((e,s)=>(0,t.jsx)(ea.xv,{children:e},s)):(0,t.jsx)(ea.xv,{children:"All proxy models"})})]})]})}),(0,t.jsx)(ea.x4,{children:(0,t.jsxs)(ea.Zb,{children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,t.jsx)(ea.Dx,{children:"User Settings"}),!eh&&X&&I.LQ.includes(X)&&(0,t.jsx)(ea.zx,{variant:"light",onClick:()=>eg(!0),children:"Edit Settings"})]}),eh&&ed?(0,t.jsx)(z,{userData:ed,onCancel:()=>eg(!1),onSubmit:ez,teams:ed.teams,accessToken:Y,userID:$,userRole:X,userModels:ej,possibleUIRoles:es}):(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(ea.xv,{className:"font-medium",children:"User ID"}),(0,t.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,t.jsx)(ea.xv,{className:"font-mono",children:ed.user_id}),(0,t.jsx)(g.ZP,{type:"text",size:"small",icon:eZ["user-id"]?(0,t.jsx)(ei.Z,{size:12}):(0,t.jsx)(en.Z,{size:12}),onClick:()=>eA(ed.user_id,"user-id"),className:"left-2 z-10 transition-all duration-200 ".concat(eZ["user-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(ea.xv,{className:"font-medium",children:"Email"}),(0,t.jsx)(ea.xv,{children:(null===(_=ed.user_info)||void 0===_?void 0:_.user_email)||"Not Set"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(ea.xv,{className:"font-medium",children:"Global Proxy Role"}),(0,t.jsx)(ea.xv,{children:(null===(N=ed.user_info)||void 0===N?void 0:N.user_role)||"Not Set"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(ea.xv,{className:"font-medium",children:"Created"}),(0,t.jsx)(ea.xv,{children:(null===(w=ed.user_info)||void 0===w?void 0:w.created_at)?new Date(ed.user_info.created_at).toLocaleString():"Unknown"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(ea.xv,{className:"font-medium",children:"Last Updated"}),(0,t.jsx)(ea.xv,{children:(null===(k=ed.user_info)||void 0===k?void 0:k.updated_at)?new Date(ed.user_info.updated_at).toLocaleString():"Unknown"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(ea.xv,{className:"font-medium",children:"Teams"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:(null===(Z=ed.teams)||void 0===Z?void 0:Z.length)&&(null===(S=ed.teams)||void 0===S?void 0:S.length)>0?(0,t.jsxs)(t.Fragment,{children:[null===(C=ed.teams)||void 0===C?void 0:C.slice(0,eC?ed.teams.length:20).map((e,s)=>(0,t.jsx)("span",{className:"px-2 py-1 bg-blue-100 rounded text-xs",title:e.team_alias||e.team_id,children:e.team_alias||e.team_id},s)),!eC&&(null===(U=ed.teams)||void 0===U?void 0:U.length)>20&&(0,t.jsxs)("span",{className:"px-2 py-1 bg-gray-100 rounded text-xs cursor-pointer hover:bg-gray-200 transition-colors",onClick:()=>eU(!0),children:["+",ed.teams.length-20," more"]}),eC&&(null===(D=ed.teams)||void 0===D?void 0:D.length)>20&&(0,t.jsx)("span",{className:"px-2 py-1 bg-gray-100 rounded text-xs cursor-pointer hover:bg-gray-200 transition-colors",onClick:()=>eU(!1),children:"Show Less"})]}):(0,t.jsx)(ea.xv,{children:"No teams"})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(ea.xv,{className:"font-medium",children:"Personal Models"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:(null===(B=ed.user_info)||void 0===B?void 0:null===(L=B.models)||void 0===L?void 0:L.length)&&(null===(M=ed.user_info)||void 0===M?void 0:null===(E=M.models)||void 0===E?void 0:E.length)>0?null===(O=ed.user_info)||void 0===O?void 0:null===(R=O.models)||void 0===R?void 0:R.map((e,s)=>(0,t.jsx)("span",{className:"px-2 py-1 bg-blue-100 rounded text-xs",children:e},s)):(0,t.jsx)(ea.xv,{children:"All proxy models"})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(ea.xv,{className:"font-medium",children:"API Keys"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:(null===(T=ed.keys)||void 0===T?void 0:T.length)&&(null===(P=ed.keys)||void 0===P?void 0:P.length)>0?ed.keys.map((e,s)=>(0,t.jsx)("span",{className:"px-2 py-1 bg-green-100 rounded text-xs",children:e.key_alias||e.token},s)):(0,t.jsx)(ea.xv,{children:"No API keys"})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(ea.xv,{className:"font-medium",children:"Max Budget"}),(0,t.jsx)(ea.xv,{children:(null===(q=ed.user_info)||void 0===q?void 0:q.max_budget)!==null&&(null===(G=ed.user_info)||void 0===G?void 0:G.max_budget)!==void 0?"$".concat((0,V.pw)(ed.user_info.max_budget,4)):"Unlimited"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(ea.xv,{className:"font-medium",children:"Budget Reset"}),(0,t.jsx)(ea.xv,{children:(0,p.m)(null!==(Q=null===(J=ed.user_info)||void 0===J?void 0:J.budget_duration)&&void 0!==Q?Q:null)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(ea.xv,{className:"font-medium",children:"Metadata"}),(0,t.jsx)("pre",{className:"bg-gray-100 p-2 rounded text-xs overflow-auto mt-1",children:JSON.stringify((null===(W=ed.user_info)||void 0===W?void 0:W.metadata)||{},null,2)})]})]})]})})]})]}),(0,t.jsx)(f.Z,{isInvitationLinkModalVisible:ev,setIsInvitationLinkModalVisible:ef,baseUrl:e_||"",invitationLinkData:ey,modalType:"resetPassword"})]})}function eo(e){let{data:s=[],columns:l,isLoading:r=!1,onSortChange:i,currentSort:n,accessToken:d,userRole:c,possibleUIRoles:u,handleEdit:m,handleDelete:x,handleResetPassword:h,selectedUsers:g=[],onSelectionChange:j,enableSelection:p=!1,filters:v,updateFilters:f,initialFilters:y,teams:b,userListResponse:_,currentPage:N,handlePageChange:w}=e,[k,Z]=a.useState([{id:(null==n?void 0:n.sortBy)||"created_at",desc:(null==n?void 0:n.sortOrder)==="desc"}]),[S,C]=a.useState(null),[U,I]=a.useState(!1),[D,z]=a.useState(!1),A=function(e){let s=arguments.length>1&&void 0!==arguments[1]&&arguments[1];C(e),I(s)},L=(e,s)=>{j&&(s?j([...g,e]):j(g.filter(s=>s.user_id!==e.user_id)))},B=e=>{j&&(e?j(s):j([]))},E=e=>g.some(s=>s.user_id===e.user_id),M=s.length>0&&g.length===s.length,R=g.length>0&&g.lengthu?q(u,m,x,h,A,p?{selectedUsers:g,onSelectUser:L,onSelectAll:B,isUserSelected:E,isAllSelected:M,isIndeterminate:R}:void 0):l,[u,m,x,h,A,l,p,g,M,R]),T=(0,G.b7)({data:s,columns:O,state:{sorting:k},onSortingChange:e=>{if(Z(e),e.length>0){let s=e[0],l=s.id,t=s.desc?"desc":"asc";null==i||i(l,t)}},getCoreRowModel:(0,J.sC)(),getSortedRowModel:(0,J.tj)(),enableSorting:!0});return(a.useEffect(()=>{n&&Z([{id:n.sortBy,desc:"desc"===n.sortOrder}])},[n]),S)?(0,t.jsx)(ed,{userId:S,onClose:()=>{C(null),I(!1)},accessToken:d,userRole:c,possibleUIRoles:u,initialTab:U?1:0,startInEditMode:U}):(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow",children:[(0,t.jsx)("div",{className:"border-b px-6 py-4",children:(0,t.jsxs)("div",{className:"flex flex-col space-y-4",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,t.jsxs)("div",{className:"relative w-64",children:[(0,t.jsx)("input",{type:"text",placeholder:"Search by email...",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:v.email,onChange:e=>f({email:e.target.value})}),(0,t.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,t.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,t.jsxs)("button",{className:"px-3 py-2 text-sm border rounded-md hover:bg-gray-50 flex items-center gap-2 ".concat(D?"bg-gray-100":""),onClick:()=>z(!D),children:[(0,t.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.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",(v.user_id||v.user_role||v.team)&&(0,t.jsx)("span",{className:"w-2 h-2 rounded-full bg-blue-500"})]}),(0,t.jsxs)("button",{className:"px-3 py-2 text-sm border rounded-md hover:bg-gray-50 flex items-center gap-2",onClick:()=>{f(y)},children:[(0,t.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.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"]})]}),D&&(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-3 mt-3",children:[(0,t.jsxs)("div",{className:"relative w-64",children:[(0,t.jsx)("input",{type:"text",placeholder:"Filter by User 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:v.user_id,onChange:e=>f({user_id:e.target.value})}),(0,t.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,t.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,t.jsx)("div",{className:"w-64",children:(0,t.jsx)(W.Z,{value:v.user_role,onValueChange:e=>f({user_role:e}),placeholder:"Select Role",children:u&&Object.entries(u).map(e=>{let[s,l]=e;return(0,t.jsx)(o.Z,{value:s,children:l.ui_label},s)})})}),(0,t.jsx)("div",{className:"w-64",children:(0,t.jsx)(W.Z,{value:v.team,onValueChange:e=>f({team:e}),placeholder:"Select Team",children:null==b?void 0:b.map(e=>(0,t.jsx)(o.Z,{value:e.team_id,children:e.team_alias||e.team_id},e.team_id))})}),(0,t.jsx)("div",{className:"relative w-64",children:(0,t.jsx)("input",{type:"text",placeholder:"Filter by SSO 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:v.sso_user_id,onChange:e=>f({sso_user_id:e.target.value})})})]}),(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsxs)("span",{className:"text-sm text-gray-700",children:["Showing"," ",_&&_.users&&_.users.length>0?(_.page-1)*_.page_size+1:0," ","-"," ",_&&_.users?Math.min(_.page*_.page_size,_.total):0," ","of ",_?_.total:0," results"]}),(0,t.jsxs)("div",{className:"flex space-x-2",children:[(0,t.jsx)("button",{onClick:()=>w(N-1),disabled:1===N,className:"px-3 py-1 text-sm border rounded-md ".concat(1===N?"bg-gray-100 text-gray-400 cursor-not-allowed":"hover:bg-gray-50"),children:"Previous"}),(0,t.jsx)("button",{onClick:()=>w(N+1),disabled:!_||N>=_.total_pages,className:"px-3 py-1 text-sm border rounded-md ".concat(!_||N>=_.total_pages?"bg-gray-100 text-gray-400 cursor-not-allowed":"hover:bg-gray-50"),children:"Next"})]})]})]})}),(0,t.jsx)("div",{className:"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)(Q.Z,{className:"[&_td]:py-0.5 [&_th]:py-1",children:[(0,t.jsx)(Y.Z,{children:T.getHeaderGroups().map(e=>(0,t.jsx)(ee.Z,{children:e.headers.map(e=>(0,t.jsx)(X.Z,{className:"py-1 h-8 ".concat("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,G.ie)(e.column.columnDef.header,e.getContext())}),"actions"!==e.id&&(0,t.jsx)("div",{className:"w-4",children:e.column.getIsSorted()?({asc:(0,t.jsx)(es.Z,{className:"h-4 w-4 text-blue-500"}),desc:(0,t.jsx)(el.Z,{className:"h-4 w-4 text-blue-500"})})[e.column.getIsSorted()]:(0,t.jsx)(et.Z,{className:"h-4 w-4 text-gray-400"})})]})},e.id))},e.id))}),(0,t.jsx)($.Z,{children:r?(0,t.jsx)(ee.Z,{children:(0,t.jsx)(H.Z,{colSpan:O.length,className:"h-8 text-center",children:(0,t.jsx)("div",{className:"text-center text-gray-500",children:(0,t.jsx)("p",{children:"\uD83D\uDE85 Loading users..."})})})}):s.length>0?T.getRowModel().rows.map(e=>(0,t.jsx)(ee.Z,{className:"h-8",children:e.getVisibleCells().map(e=>(0,t.jsx)(H.Z,{className:"py-0.5 max-h-8 overflow-hidden text-ellipsis whitespace-nowrap ".concat("actions"===e.column.id?"sticky right-0 bg-white shadow-[-4px_0_8px_-6px_rgba(0,0,0,0.1)]":""),onClick:()=>{"user_id"===e.column.id&&A(e.getValue(),!1)},style:{cursor:"user_id"===e.column.id?"pointer":"default",color:"user_id"===e.column.id?"#3b82f6":"inherit"},children:(0,G.ie)(e.column.columnDef.cell,e.getContext())},e.id))},e.id)):(0,t.jsx)(ee.Z,{children:(0,t.jsx)(H.Z,{colSpan:O.length,className:"h-8 text-center",children:(0,t.jsx)("div",{className:"text-center text-gray-500",children:(0,t.jsx)("p",{children:"No users found"})})})})})]})})})})]})}var ec=l(88913),eu=l(63709),em=l(87908),ex=l(26349),eh=l(96473),eg=e=>{var s;let{accessToken:l,possibleUIRoles:r,userID:n,userRole:d}=e,[o,c]=(0,a.useState)(!0),[u,m]=(0,a.useState)(null),[g,j]=(0,a.useState)(!1),[v,f]=(0,a.useState)({}),[b,_]=(0,a.useState)(!1),[N,w]=(0,a.useState)([]),{Paragraph:k}=y.default,{Option:Z}=x.default;(0,a.useEffect)(()=>{(async()=>{if(!l){c(!1);return}try{let e=await (0,i.getInternalUserSettings)(l);if(m(e),f(e.values||{}),l)try{let e=await (0,i.modelAvailableCall)(l,n,d);if(e&&e.data){let s=e.data.map(e=>e.id);w(s)}}catch(e){console.error("Error fetching available models:",e)}}catch(e){console.error("Error fetching SSO settings:",e),A.Z.fromBackend("Failed to fetch SSO settings")}finally{c(!1)}})()},[l]);let S=async()=>{if(l){_(!0);try{let e=Object.entries(v).reduce((e,s)=>{let[l,t]=s;return e[l]=""===t?null:t,e},{}),s=await (0,i.updateInternalUserSettings)(l,e);m({...u,values:s.settings}),j(!1)}catch(e){console.error("Error updating SSO settings:",e),A.Z.fromBackend("Failed to update settings: "+e)}finally{_(!1)}}},C=(e,s)=>{f(l=>({...l,[e]:s}))},I=e=>e&&Array.isArray(e)?e.map(e=>"string"==typeof e?{team_id:e,user_role:"user"}:"object"==typeof e&&e.team_id?{team_id:e.team_id,max_budget_in_team:e.max_budget_in_team,user_role:e.user_role||"user"}:{team_id:"",user_role:"user"}):[],D=e=>{let s=I(e),l=(e,l,t)=>{let a=[...s];a[e]={...a[e],[l]:t},C("teams",a)},a=e=>{C("teams",s.filter((s,l)=>l!==e))};return(0,t.jsxs)("div",{className:"space-y-3",children:[s.map((e,s)=>(0,t.jsxs)("div",{className:"border rounded-lg p-4 bg-gray-50",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,t.jsxs)(ec.xv,{className:"font-medium",children:["Team ",s+1]}),(0,t.jsx)(ec.zx,{size:"sm",variant:"secondary",icon:ex.Z,onClick:()=>a(s),className:"text-red-500 hover:text-red-700",children:"Remove"})]}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(ec.xv,{className:"text-sm font-medium mb-1",children:"Team ID"}),(0,t.jsx)(ec.oi,{value:e.team_id,onChange:e=>l(s,"team_id",e.target.value),placeholder:"Enter team ID"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(ec.xv,{className:"text-sm font-medium mb-1",children:"Max Budget in Team"}),(0,t.jsx)(h.Z,{style:{width:"100%"},value:e.max_budget_in_team,onChange:e=>l(s,"max_budget_in_team",e),placeholder:"Optional",min:0,step:.01,precision:2})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(ec.xv,{className:"text-sm font-medium mb-1",children:"User Role"}),(0,t.jsxs)(x.default,{style:{width:"100%"},value:e.user_role,onChange:e=>l(s,"user_role",e),children:[(0,t.jsx)(Z,{value:"user",children:"User"}),(0,t.jsx)(Z,{value:"admin",children:"Admin"})]})]})]})]},s)),(0,t.jsx)(ec.zx,{variant:"secondary",icon:eh.Z,onClick:()=>{C("teams",[...s,{team_id:"",user_role:"user"}])},className:"w-full",children:"Add Team"})]})},z=(e,s,l)=>{var a;let i=s.type;if("teams"===e)return(0,t.jsx)("div",{className:"mt-2",children:D(v[e]||[])});if("user_role"===e&&r)return(0,t.jsx)(x.default,{style:{width:"100%"},value:v[e]||"",onChange:s=>C(e,s),className:"mt-2",children:Object.entries(r).filter(e=>{let[s]=e;return s.includes("internal_user")}).map(e=>{let[s,{ui_label:l,description:a}]=e;return(0,t.jsx)(Z,{value:s,children:(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("span",{children:l}),(0,t.jsx)("span",{className:"ml-2 text-xs text-gray-500",children:a})]})},s)})});if("budget_duration"===e)return(0,t.jsx)(p.Z,{value:v[e]||null,onChange:s=>C(e,s),className:"mt-2"});if("boolean"===i)return(0,t.jsx)("div",{className:"mt-2",children:(0,t.jsx)(eu.Z,{checked:!!v[e],onChange:s=>C(e,s)})});if("array"===i&&(null===(a=s.items)||void 0===a?void 0:a.enum))return(0,t.jsx)(x.default,{mode:"multiple",style:{width:"100%"},value:v[e]||[],onChange:s=>C(e,s),className:"mt-2",children:s.items.enum.map(e=>(0,t.jsx)(Z,{value:e,children:e},e))});if("models"===e)return(0,t.jsxs)(x.default,{mode:"multiple",style:{width:"100%"},value:v[e]||[],onChange:s=>C(e,s),className:"mt-2",children:[(0,t.jsx)(Z,{value:"no-default-models",children:"No Default Models"}),N.map(e=>(0,t.jsx)(Z,{value:e,children:(0,U.W0)(e)},e))]});if("string"===i&&s.enum)return(0,t.jsx)(x.default,{style:{width:"100%"},value:v[e]||"",onChange:s=>C(e,s),className:"mt-2",children:s.enum.map(e=>(0,t.jsx)(Z,{value:e,children:e},e))});else return(0,t.jsx)(ec.oi,{value:void 0!==v[e]?String(v[e]):"",onChange:s=>C(e,s.target.value),placeholder:s.description||"",className:"mt-2"})},L=(e,s)=>{if(null==s)return(0,t.jsx)("span",{className:"text-gray-400",children:"Not set"});if("teams"===e&&Array.isArray(s)){if(0===s.length)return(0,t.jsx)("span",{className:"text-gray-400",children:"No teams assigned"});let e=I(s);return(0,t.jsx)("div",{className:"space-y-2 mt-1",children:e.map((e,s)=>(0,t.jsx)("div",{className:"border rounded-lg p-3 bg-white",children:(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-2 text-sm",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"font-medium text-gray-600",children:"Team ID:"}),(0,t.jsx)("p",{className:"text-gray-900",children:e.team_id||"Not specified"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"font-medium text-gray-600",children:"Max Budget:"}),(0,t.jsx)("p",{className:"text-gray-900",children:void 0!==e.max_budget_in_team?"$".concat((0,V.pw)(e.max_budget_in_team,4)):"No limit"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"font-medium text-gray-600",children:"Role:"}),(0,t.jsx)("p",{className:"text-gray-900 capitalize",children:e.user_role})]})]})},s))})}if("user_role"===e&&r&&r[s]){let{ui_label:e,description:l}=r[s];return(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"font-medium",children:e}),l&&(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:l})]})}return"budget_duration"===e?(0,t.jsx)("span",{children:(0,p.m)(s)}):"boolean"==typeof s?(0,t.jsx)("span",{children:s?"Enabled":"Disabled"}):"models"===e&&Array.isArray(s)?0===s.length?(0,t.jsx)("span",{className:"text-gray-400",children:"None"}):(0,t.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:s.map((e,s)=>(0,t.jsx)("span",{className:"px-2 py-1 bg-blue-100 rounded text-xs",children:(0,U.W0)(e)},s))}):"object"==typeof s?Array.isArray(s)?0===s.length?(0,t.jsx)("span",{className:"text-gray-400",children:"None"}):(0,t.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:s.map((e,s)=>(0,t.jsx)("span",{className:"px-2 py-1 bg-blue-100 rounded text-xs",children:"object"==typeof e?JSON.stringify(e):String(e)},s))}):(0,t.jsx)("pre",{className:"bg-gray-100 p-2 rounded text-xs overflow-auto mt-1",children:JSON.stringify(s,null,2)}):(0,t.jsx)("span",{children:String(s)})};return o?(0,t.jsx)("div",{className:"flex justify-center items-center h-64",children:(0,t.jsx)(em.Z,{size:"large"})}):u?(0,t.jsxs)(ec.Zb,{children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,t.jsx)(ec.Dx,{children:"Default User Settings"}),!o&&u&&(g?(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(ec.zx,{variant:"secondary",onClick:()=>{j(!1),f(u.values||{})},disabled:b,children:"Cancel"}),(0,t.jsx)(ec.zx,{onClick:S,loading:b,children:"Save Changes"})]}):(0,t.jsx)(ec.zx,{onClick:()=>j(!0),children:"Edit Settings"}))]}),(null==u?void 0:null===(s=u.field_schema)||void 0===s?void 0:s.description)&&(0,t.jsx)(k,{className:"mb-4",children:u.field_schema.description}),(0,t.jsx)(ec.iz,{}),(0,t.jsx)("div",{className:"mt-4 space-y-4",children:(()=>{let{values:e,field_schema:s}=u;return s&&s.properties?Object.entries(s.properties).map(s=>{let[l,a]=s,r=e[l],i=l.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase());return(0,t.jsxs)("div",{className:"mb-6 pb-6 border-b border-gray-200 last:border-0",children:[(0,t.jsx)(ec.xv,{className:"font-medium text-lg",children:i}),(0,t.jsx)(k,{className:"text-sm text-gray-500 mt-1",children:a.description||"No description available"}),g?(0,t.jsx)("div",{className:"mt-2",children:z(l,a,r)}):(0,t.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:L(l,r)})]},l)}):(0,t.jsx)(ec.xv,{children:"No schema information available"})})()})]}):(0,t.jsx)(ec.Zb,{children:(0,t.jsx)(ec.xv,{children:"No settings available or you do not have permission to view them."})})},ej=l(29827),ep=l(16593),ev=l(19616);let ef={email:"",user_id:"",user_role:"",sso_user_id:"",team:"",model:"",min_spend:null,max_spend:null,sort_by:"created_at",sort_order:"desc"};var ey=e=>{var s;let{accessToken:l,token:o,userRole:c,userID:u,teams:m}=e,x=(0,ej.NL)(),[h,g]=(0,a.useState)(1),[j,p]=(0,a.useState)(!1),[y,b]=(0,a.useState)(null),[_,N]=(0,a.useState)(!1),[w,k]=(0,a.useState)(null),[Z,S]=(0,a.useState)("users"),[C,U]=(0,a.useState)(ef),[D,z,L]=(0,ev.G)(C,{wait:300}),[B,M]=(0,a.useState)(!1),[R,O]=(0,a.useState)(null),[T,P]=(0,a.useState)(null),[F,K]=(0,a.useState)([]),[G,J]=(0,a.useState)(!1),[W,Q]=(0,a.useState)(!1),[$,H]=(0,a.useState)([]),Y=e=>{k(e),N(!0)};(0,a.useEffect)(()=>()=>{L.cancel()},[L]),(0,a.useEffect)(()=>{P((0,i.getProxyBaseUrl)())},[]),(0,a.useEffect)(()=>{(async()=>{try{if(!u||!c||!l)return;let e=(await (0,i.modelAvailableCall)(l,u,c)).data.map(e=>e.id);console.log("available_model_names:",e),H(e)}catch(e){console.error("Error fetching user models:",e)}})()},[l,u,c]);let X=e=>{U(s=>{let l={...s,...e};return z(l),l})},ee=async e=>{if(!l){A.Z.fromBackend("Access token not found");return}try{A.Z.success("Generating password reset link...");let s=await (0,i.invitationCreateCall)(l,e);O(s),M(!0)}catch(e){A.Z.fromBackend("Failed to generate password reset link")}},es=async()=>{if(w&&l)try{await (0,i.userDeleteCall)(l,[w]),x.setQueriesData({queryKey:["userList"]},e=>{if(void 0===e)return e;let s=e.users.filter(e=>e.user_id!==w);return{...e,users:s}}),A.Z.success("User deleted successfully")}catch(e){console.error("Error deleting user:",e),A.Z.fromBackend("Failed to delete user")}N(!1),k(null)},el=async()=>{b(null),p(!1)},et=async e=>{if(console.log("inside handleEditSubmit:",e),l&&o&&c&&u){try{let s=await (0,i.userUpdateUserCall)(l,e,null);x.setQueriesData({queryKey:["userList"]},e=>{if(void 0===e)return e;let l=e.users.map(e=>e.user_id===s.data.user_id?(0,V.nl)(e,s.data):e);return{...e,users:l}}),A.Z.success("User ".concat(e.user_id," updated successfully"))}catch(e){console.error("There was an error updating the user",e)}b(null),p(!1)}},ea=async e=>{g(e)},er=(0,ep.a)({queryKey:["userList",{debouncedFilter:D,currentPage:h}],queryFn:async()=>{if(!l)throw Error("Access token required");return await (0,i.userListCall)(l,D.user_id?[D.user_id]:null,h,25,D.email||null,D.user_role||null,D.team||null,D.sso_user_id||null,D.sort_by,D.sort_order)},enabled:!!(l&&o&&c&&u),placeholderData:e=>e}),ei=er.data,en=(0,ep.a)({queryKey:["userRoles"],initialData:()=>({}),queryFn:async()=>{if(!l)throw Error("Access token required");return await (0,i.getPossibleUserRoles)(l)},enabled:!!(l&&o&&c&&u)}).data;if(er.isLoading||!l||!o||!c||!u)return(0,t.jsx)("div",{children:"Loading..."});let ed=q(en,e=>{b(e),p(!0)},Y,ee,()=>{});return(0,t.jsxs)("div",{className:"w-full p-8 overflow-hidden",children:[(0,t.jsx)("div",{className:"flex items-center justify-between mb-4",children:(0,t.jsxs)("div",{className:"flex space-x-3",children:[(0,t.jsx)(d.Z,{userID:u,accessToken:l,teams:m,possibleUIRoles:en}),(0,t.jsx)(n.z,{onClick:()=>{Q(!W),K([])},variant:W?"primary":"secondary",className:"flex items-center",children:W?"Cancel Selection":"Select Users"}),W&&(0,t.jsxs)(n.z,{onClick:()=>{if(0===F.length){A.Z.fromBackend("Please select users to edit");return}J(!0)},disabled:0===F.length,className:"flex items-center",children:["Bulk Edit (",F.length," selected)"]})]})}),(0,t.jsxs)(r.v0,{defaultIndex:0,onIndexChange:e=>S(0===e?"users":"settings"),children:[(0,t.jsxs)(r.td,{className:"mb-4",children:[(0,t.jsx)(r.OK,{children:"Users"}),(0,t.jsx)(r.OK,{children:"Default User Settings"})]}),(0,t.jsxs)(r.nP,{children:[(0,t.jsx)(r.x4,{children:(0,t.jsx)(eo,{data:(null===(s=er.data)||void 0===s?void 0:s.users)||[],columns:ed,isLoading:er.isLoading,accessToken:l,userRole:c,onSortChange:(e,s)=>{X({sort_by:e,sort_order:s})},currentSort:{sortBy:C.sort_by,sortOrder:C.sort_order},possibleUIRoles:en,handleEdit:e=>{b(e),p(!0)},handleDelete:Y,handleResetPassword:ee,enableSelection:W,selectedUsers:F,onSelectionChange:e=>{K(e)},filters:C,updateFilters:X,initialFilters:ef,teams:m,userListResponse:ei,currentPage:h,handlePageChange:ea})}),(0,t.jsx)(r.x4,{children:(0,t.jsx)(eg,{accessToken:l,possibleUIRoles:en,userID:u,userRole:c})})]})]}),(0,t.jsx)(v,{visible:j,possibleUIRoles:en,onCancel:el,user:y,onSubmit:et}),_&&(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.jsx)("span",{className:"hidden sm:inline-block sm:align-middle sm:h-screen","aria-hidden":"true",children:""}),(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 User"}),(0,t.jsxs)("div",{className:"mt-2",children:[(0,t.jsx)("p",{className:"text-sm text-gray-500",children:"Are you sure you want to delete this user?"}),(0,t.jsxs)("p",{className:"text-sm font-medium text-gray-900 mt-2",children:["User ID: ",w]})]})]})})}),(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)(n.z,{onClick:es,color:"red",className:"ml-2",children:"Delete"}),(0,t.jsx)(n.z,{onClick:()=>{N(!1),k(null)},children:"Cancel"})]})]})]})}),(0,t.jsx)(f.Z,{isInvitationLinkModalVisible:B,setIsInvitationLinkModalVisible:M,baseUrl:T||"",invitationLinkData:R,modalType:"resetPassword"}),(0,t.jsx)(E,{visible:G,onCancel:()=>J(!1),selectedUsers:F,possibleUIRoles:en,accessToken:l,onSuccess:()=>{x.invalidateQueries({queryKey:["userList"]}),K([]),Q(!1)},teams:m,userRole:c,userModels:$,allowAllUsers:!!c&&(0,I.tY)(c)})]})}}}]);
\ No newline at end of file
+"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7155],{88913:function(e,s,l){l.d(s,{Dx:function(){return d.Z},Zb:function(){return a.Z},iz:function(){return r.Z},oi:function(){return n.Z},xv:function(){return i.Z},zx:function(){return t.Z}});var t=l(20831),a=l(12514),r=l(67982),i=l(84264),n=l(49566),d=l(96761)},77155:function(e,s,l){l.d(s,{Z:function(){return ey}});var t=l(57437),a=l(2265),r=l(58643),i=l(19250),n=l(16312),d=l(7765),o=l(57365),c=l(49566),u=l(13634),m=l(82680),x=l(52787),h=l(20577),g=l(73002),j=l(24199),p=l(65925),v=e=>{let{visible:s,possibleUIRoles:l,onCancel:r,user:i,onSubmit:n}=e,[d,v]=(0,a.useState)(i),[f]=u.Z.useForm();(0,a.useEffect)(()=>{f.resetFields()},[i]);let y=async()=>{f.resetFields(),r()},b=async e=>{n(e),f.resetFields(),r()};return i?(0,t.jsx)(m.Z,{visible:s,onCancel:y,footer:null,title:"Edit User "+i.user_id,width:1e3,children:(0,t.jsx)(u.Z,{form:f,onFinish:b,initialValues:i,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(u.Z.Item,{className:"mt-8",label:"User Email",tooltip:"Email of the User",name:"user_email",children:(0,t.jsx)(c.Z,{})}),(0,t.jsx)(u.Z.Item,{label:"user_id",name:"user_id",hidden:!0,children:(0,t.jsx)(c.Z,{})}),(0,t.jsx)(u.Z.Item,{label:"User Role",name:"user_role",children:(0,t.jsx)(x.default,{children:l&&Object.entries(l).map(e=>{let[s,{ui_label:l,description:a}]=e;return(0,t.jsx)(o.Z,{value:s,title:l,children:(0,t.jsxs)("div",{className:"flex",children:[l," ",(0,t.jsx)("p",{className:"ml-2",style:{color:"gray",fontSize:"12px"},children:a})]})},s)})})}),(0,t.jsx)(u.Z.Item,{label:"Spend (USD)",name:"spend",tooltip:"(float) - Spend of all LLM calls completed by this user",help:"Across all keys (including keys with team_id).",children:(0,t.jsx)(h.Z,{min:0,step:.01})}),(0,t.jsx)(u.Z.Item,{label:"User Budget (USD)",name:"max_budget",tooltip:"(float) - Maximum budget of this user",help:"Maximum budget of this user.",children:(0,t.jsx)(j.Z,{min:0,step:.01})}),(0,t.jsx)(u.Z.Item,{label:"Reset Budget",name:"budget_duration",children:(0,t.jsx)(p.Z,{})}),(0,t.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,t.jsx)(g.ZP,{htmlType:"submit",children:"Save"})}),(0,t.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,t.jsx)(g.ZP,{htmlType:"submit",children:"Save"})})]})})}):null},f=l(98187),y=l(93192),b=l(42264),_=l(61994),N=l(81915),w=l(23496),k=l(67960),Z=l(93142),S=l(89970),C=l(16853),U=l(46468),I=l(20347),D=l(15424);function z(e){let{userData:s,onCancel:l,onSubmit:r,teams:i,accessToken:d,userID:m,userRole:h,userModels:g,possibleUIRoles:v,isBulkEdit:f=!1}=e,[y]=u.Z.useForm();return a.useEffect(()=>{var e,l,t,a,r,i;y.setFieldsValue({user_id:s.user_id,user_email:null===(e=s.user_info)||void 0===e?void 0:e.user_email,user_role:null===(l=s.user_info)||void 0===l?void 0:l.user_role,models:(null===(t=s.user_info)||void 0===t?void 0:t.models)||[],max_budget:null===(a=s.user_info)||void 0===a?void 0:a.max_budget,budget_duration:null===(r=s.user_info)||void 0===r?void 0:r.budget_duration,metadata:(null===(i=s.user_info)||void 0===i?void 0:i.metadata)?JSON.stringify(s.user_info.metadata,null,2):void 0})},[s,y]),(0,t.jsxs)(u.Z,{form:y,onFinish:e=>{if(e.metadata&&"string"==typeof e.metadata)try{e.metadata=JSON.parse(e.metadata)}catch(e){console.error("Error parsing metadata JSON:",e);return}r(e)},layout:"vertical",children:[!f&&(0,t.jsx)(u.Z.Item,{label:"User ID",name:"user_id",children:(0,t.jsx)(c.Z,{disabled:!0})}),!f&&(0,t.jsx)(u.Z.Item,{label:"Email",name:"user_email",children:(0,t.jsx)(c.Z,{})}),(0,t.jsx)(u.Z.Item,{label:(0,t.jsxs)("span",{children:["Global Proxy Role"," ",(0,t.jsx)(S.Z,{title:"This is the role that the user will globally on the proxy. This role is independent of any team/org specific roles.",children:(0,t.jsx)(D.Z,{})})]}),name:"user_role",children:(0,t.jsx)(x.default,{children:v&&Object.entries(v).map(e=>{let[s,{ui_label:l,description:a}]=e;return(0,t.jsx)(o.Z,{value:s,title:l,children:(0,t.jsxs)("div",{className:"flex",children:[l," ",(0,t.jsx)("p",{className:"ml-2",style:{color:"gray",fontSize:"12px"},children:a})]})},s)})})}),(0,t.jsx)(u.Z.Item,{label:(0,t.jsxs)("span",{children:["Personal Models"," ",(0,t.jsx)(S.Z,{title:"Select which models this user can access outside of team-scope. Choose 'All Proxy Models' to grant access to all models available on the proxy.",children:(0,t.jsx)(D.Z,{style:{marginLeft:"4px"}})})]}),name:"models",children:(0,t.jsxs)(x.default,{mode:"multiple",placeholder:"Select models",style:{width:"100%"},disabled:!I.ZL.includes(h||""),children:[(0,t.jsx)(x.default.Option,{value:"all-proxy-models",children:"All Proxy Models"},"all-proxy-models"),(0,t.jsx)(x.default.Option,{value:"no-default-models",children:"No Default Models"},"no-default-models"),g.map(e=>(0,t.jsx)(x.default.Option,{value:e,children:(0,U.W0)(e)},e))]})}),(0,t.jsx)(u.Z.Item,{label:"Max Budget (USD)",name:"max_budget",children:(0,t.jsx)(j.Z,{step:.01,precision:2,style:{width:"100%"}})}),(0,t.jsx)(u.Z.Item,{label:"Reset Budget",name:"budget_duration",children:(0,t.jsx)(p.Z,{})}),(0,t.jsx)(u.Z.Item,{label:"Metadata",name:"metadata",children:(0,t.jsx)(C.Z,{rows:4,placeholder:"Enter metadata as JSON"})}),(0,t.jsxs)("div",{className:"flex justify-end space-x-2",children:[(0,t.jsx)(n.z,{variant:"secondary",type:"button",onClick:l,children:"Cancel"}),(0,t.jsx)(n.z,{type:"submit",children:"Save Changes"})]})]})}var A=l(9114);let{Text:L,Title:B}=y.default;var E=e=>{let{visible:s,onCancel:l,selectedUsers:r,possibleUIRoles:n,accessToken:d,onSuccess:o,teams:c,userRole:u,userModels:g,allowAllUsers:j=!1}=e,[p,v]=(0,a.useState)(!1),[f,y]=(0,a.useState)([]),[S,C]=(0,a.useState)(null),[U,I]=(0,a.useState)(!1),[D,E]=(0,a.useState)(!1),M=()=>{y([]),C(null),I(!1),E(!1),l()},R=a.useMemo(()=>({user_id:"bulk_edit",user_info:{user_email:"",user_role:"",teams:[],models:[],max_budget:null,spend:0,metadata:{},created_at:null,updated_at:null},keys:[],teams:c||[]}),[c,s]),O=async e=>{if(console.log("formValues",e),!d){A.Z.fromBackend("Access token not found");return}v(!0);try{let s=r.map(e=>e.user_id),t={};e.user_role&&""!==e.user_role&&(t.user_role=e.user_role),null!==e.max_budget&&void 0!==e.max_budget&&(t.max_budget=e.max_budget),e.models&&e.models.length>0&&(t.models=e.models),e.budget_duration&&""!==e.budget_duration&&(t.budget_duration=e.budget_duration),e.metadata&&Object.keys(e.metadata).length>0&&(t.metadata=e.metadata);let a=Object.keys(t).length>0,n=U&&f.length>0;if(!a&&!n){A.Z.fromBackend("Please modify at least one field or select teams to add users to");return}let c=[];if(a){if(D){let e=await (0,i.userBulkUpdateUserCall)(d,t,void 0,!0);c.push("Updated all users (".concat(e.total_requested," total)"))}else await (0,i.userBulkUpdateUserCall)(d,t,s),c.push("Updated ".concat(s.length," user(s)"))}if(n){let e=[];for(let s of f)try{let l=null;D?l=null:r.map(e=>({user_id:e.user_id,role:"user",user_email:e.user_email||null}));let t=await (0,i.teamBulkMemberAddCall)(d,s,l||null,S||void 0,D);console.log("result",t),e.push({teamId:s,success:!0,successfulAdditions:t.successful_additions,failedAdditions:t.failed_additions})}catch(l){console.error("Failed to add users to team ".concat(s,":"),l),e.push({teamId:s,success:!1,error:l})}let s=e.filter(e=>e.success),l=e.filter(e=>!e.success);if(s.length>0){let e=s.reduce((e,s)=>e+s.successfulAdditions,0);c.push("Added users to ".concat(s.length," team(s) (").concat(e," total additions)"))}l.length>0&&b.ZP.warning("Failed to add users to ".concat(l.length," team(s)"))}c.length>0&&A.Z.success(c.join(". ")),y([]),C(null),I(!1),E(!1),o(),l()}catch(e){console.error("Bulk operation failed:",e),A.Z.fromBackend("Failed to perform bulk operations")}finally{v(!1)}};return(0,t.jsxs)(m.Z,{visible:s,onCancel:M,footer:null,title:D?"Bulk Edit All Users":"Bulk Edit ".concat(r.length," User(s)"),width:800,children:[j&&(0,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsx)(_.Z,{checked:D,onChange:e=>E(e.target.checked),children:(0,t.jsx)(L,{strong:!0,children:"Update ALL users in the system"})}),D&&(0,t.jsx)("div",{style:{marginTop:8},children:(0,t.jsx)(L,{type:"warning",style:{fontSize:"12px"},children:"⚠️ This will apply changes to ALL users in the system, not just the selected ones."})})]}),!D&&(0,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsxs)(B,{level:5,children:["Selected Users (",r.length,"):"]}),(0,t.jsx)(N.Z,{size:"small",bordered:!0,dataSource:r,pagination:!1,scroll:{y:200},rowKey:"user_id",columns:[{title:"User ID",dataIndex:"user_id",key:"user_id",width:"30%",render:e=>(0,t.jsx)(L,{strong:!0,style:{fontSize:"12px"},children:e.length>20?"".concat(e.slice(0,20),"..."):e})},{title:"Email",dataIndex:"user_email",key:"user_email",width:"25%",render:e=>(0,t.jsx)(L,{type:"secondary",style:{fontSize:"12px"},children:e||"No email"})},{title:"Current Role",dataIndex:"user_role",key:"user_role",width:"25%",render:e=>{var s;return(0,t.jsx)(L,{style:{fontSize:"12px"},children:(null==n?void 0:null===(s=n[e])||void 0===s?void 0:s.ui_label)||e})}},{title:"Budget",dataIndex:"max_budget",key:"max_budget",width:"20%",render:e=>(0,t.jsx)(L,{style:{fontSize:"12px"},children:null!==e?"$".concat(e):"Unlimited"})}]})]}),(0,t.jsx)(w.Z,{}),(0,t.jsx)("div",{className:"mb-4",children:(0,t.jsxs)(L,{children:[(0,t.jsx)("strong",{children:"Instructions:"})," Fill in the fields below with the values you want to apply to all selected users. You can bulk edit: role, budget, models, and metadata. You can also add users to teams."]})}),(0,t.jsx)(k.Z,{title:"Team Management",size:"small",className:"mb-4",style:{backgroundColor:"#fafafa"},children:(0,t.jsxs)(Z.Z,{direction:"vertical",style:{width:"100%"},children:[(0,t.jsx)(_.Z,{checked:U,onChange:e=>I(e.target.checked),children:"Add selected users to teams"}),U&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(L,{strong:!0,children:"Select Teams:"}),(0,t.jsx)(x.default,{mode:"multiple",placeholder:"Select teams to add users to",value:f,onChange:y,style:{width:"100%",marginTop:8},options:(null==c?void 0:c.map(e=>({label:e.team_alias||e.team_id,value:e.team_id})))||[]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(L,{strong:!0,children:"Team Budget (Optional):"}),(0,t.jsx)(h.Z,{placeholder:"Max budget per user in team",value:S,onChange:e=>C(e),style:{width:"100%",marginTop:8},min:0,step:.01,precision:2}),(0,t.jsx)(L,{type:"secondary",style:{fontSize:"12px"},children:"Leave empty for unlimited budget within team limits"})]}),(0,t.jsx)(L,{type:"secondary",style:{fontSize:"12px"},children:'Users will be added with "user" role by default. All users will be added to each selected team.'})]})]})}),(0,t.jsx)(z,{userData:R,onCancel:M,onSubmit:O,teams:c,accessToken:d,userID:"bulk_edit",userRole:u,userModels:g,possibleUIRoles:n,isBulkEdit:!0}),p&&(0,t.jsx)("div",{style:{textAlign:"center",marginTop:"10px"},children:(0,t.jsxs)(L,{children:["Updating ",D?"all users":r.length," user(s)..."]})})]})},M=l(41649),R=l(67101),O=l(47323),T=l(15731),P=l(53410),F=l(74998),K=l(23628),V=l(59872);let q=(e,s,l,a,r,i)=>{let n=[{header:"User ID",accessorKey:"user_id",cell:e=>{let{row:s}=e;return(0,t.jsx)(S.Z,{title:s.original.user_id,children:(0,t.jsx)("span",{className:"text-xs",children:s.original.user_id?"".concat(s.original.user_id.slice(0,7),"..."):"-"})})}},{header:"Email",accessorKey:"user_email",cell:e=>{let{row:s}=e;return(0,t.jsx)("span",{className:"text-xs",children:s.original.user_email||"-"})}},{header:"Global Proxy Role",accessorKey:"user_role",cell:s=>{var l;let{row:a}=s;return(0,t.jsx)("span",{className:"text-xs",children:(null==e?void 0:null===(l=e[a.original.user_role])||void 0===l?void 0:l.ui_label)||"-"})}},{header:"Spend (USD)",accessorKey:"spend",cell:e=>{let{row:s}=e;return(0,t.jsx)("span",{className:"text-xs",children:s.original.spend?(0,V.pw)(s.original.spend,4):"-"})}},{header:"Budget (USD)",accessorKey:"max_budget",cell:e=>{let{row:s}=e;return(0,t.jsx)("span",{className:"text-xs",children:null!==s.original.max_budget?s.original.max_budget:"Unlimited"})}},{header:()=>(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{children:"SSO ID"}),(0,t.jsx)(S.Z,{title:"SSO ID is the ID of the user in the SSO provider. If the user is not using SSO, this will be null.",children:(0,t.jsx)(T.Z,{className:"w-4 h-4"})})]}),accessorKey:"sso_user_id",cell:e=>{let{row:s}=e;return(0,t.jsx)("span",{className:"text-xs",children:null!==s.original.sso_user_id?s.original.sso_user_id:"-"})}},{header:"API Keys",accessorKey:"key_count",cell:e=>{let{row:s}=e;return(0,t.jsx)(R.Z,{numItems:2,children:s.original.key_count>0?(0,t.jsxs)(M.Z,{size:"xs",color:"indigo",children:[s.original.key_count," Keys"]}):(0,t.jsx)(M.Z,{size:"xs",color:"gray",children:"No Keys"})})}},{header:"Created At",accessorKey:"created_at",sortingFn:"datetime",cell:e=>{let{row:s}=e;return(0,t.jsx)("span",{className:"text-xs",children:s.original.created_at?new Date(s.original.created_at).toLocaleDateString():"-"})}},{header:"Updated At",accessorKey:"updated_at",sortingFn:"datetime",cell:e=>{let{row:s}=e;return(0,t.jsx)("span",{className:"text-xs",children:s.original.updated_at?new Date(s.original.updated_at).toLocaleDateString():"-"})}},{id:"actions",header:"",cell:e=>{let{row:s}=e;return(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(S.Z,{title:"Edit user details",zIndex:9999,children:(0,t.jsx)(O.Z,{icon:P.Z,size:"sm",onClick:()=>r(s.original.user_id,!0)})}),(0,t.jsx)(S.Z,{title:"Delete user",zIndex:9999,children:(0,t.jsx)(O.Z,{icon:F.Z,size:"sm",onClick:()=>l(s.original.user_id)})}),(0,t.jsx)(S.Z,{title:"Reset Password",zIndex:9999,children:(0,t.jsx)(O.Z,{icon:K.Z,size:"sm",onClick:()=>a(s.original.user_id)})})]})}}];if(i){let{onSelectUser:e,onSelectAll:s,isUserSelected:l,isAllSelected:a,isIndeterminate:r}=i;return[{id:"select",header:()=>(0,t.jsx)(_.Z,{indeterminate:r,checked:a,onChange:e=>s(e.target.checked),onClick:e=>e.stopPropagation()}),cell:s=>{let{row:a}=s;return(0,t.jsx)(_.Z,{checked:l(a.original),onChange:s=>e(a.original,s.target.checked),onClick:e=>e.stopPropagation()})}},...n]}return n};var G=l(71594),J=l(24525),W=l(27281),Q=l(21626),$=l(97214),H=l(28241),Y=l(58834),X=l(69552),ee=l(71876),es=l(44633),el=l(86462),et=l(49084),ea=l(84717),er=l(10900),ei=l(30401),en=l(78867);function ed(e){var s,l,r,n,d,o,c,u,m,x,h,j,v,y,b,_,N,w,k,Z,S,C,U,D,L,B,E,M,R,O,T,P,q,G,J,W,Q;let{userId:$,onClose:H,accessToken:Y,userRole:X,onDelete:ee,possibleUIRoles:es,initialTab:el=0,startInEditMode:et=!1}=e,[ed,eo]=(0,a.useState)(null),[ec,eu]=(0,a.useState)(!1),[em,ex]=(0,a.useState)(!0),[eh,eg]=(0,a.useState)(et),[ej,ep]=(0,a.useState)([]),[ev,ef]=(0,a.useState)(!1),[ey,eb]=(0,a.useState)(null),[e_,eN]=(0,a.useState)(null),[ew,ek]=(0,a.useState)(el),[eZ,eS]=(0,a.useState)({}),[eC,eU]=(0,a.useState)(!1);a.useEffect(()=>{eN((0,i.getProxyBaseUrl)())},[]),a.useEffect(()=>{console.log("userId: ".concat($,", userRole: ").concat(X,", accessToken: ").concat(Y)),(async()=>{try{if(!Y)return;let e=await (0,i.userInfoCall)(Y,$,X||"",!1,null,null,!0);eo(e);let s=(await (0,i.modelAvailableCall)(Y,$,X||"")).data.map(e=>e.id);ep(s)}catch(e){console.error("Error fetching user data:",e),A.Z.fromBackend("Failed to fetch user data")}finally{ex(!1)}})()},[Y,$,X]);let eI=async()=>{if(!Y){A.Z.fromBackend("Access token not found");return}try{A.Z.success("Generating password reset link...");let e=await (0,i.invitationCreateCall)(Y,$);eb(e),ef(!0)}catch(e){A.Z.fromBackend("Failed to generate password reset link")}},eD=async()=>{try{if(!Y)return;await (0,i.userDeleteCall)(Y,[$]),A.Z.success("User deleted successfully"),ee&&ee(),H()}catch(e){console.error("Error deleting user:",e),A.Z.fromBackend("Failed to delete user")}},ez=async e=>{try{if(!Y||!ed)return;await (0,i.userUpdateUserCall)(Y,e,null),eo({...ed,user_info:{...ed.user_info,user_email:e.user_email,models:e.models,max_budget:e.max_budget,budget_duration:e.budget_duration,metadata:e.metadata}}),A.Z.success("User updated successfully"),eg(!1)}catch(e){console.error("Error updating user:",e),A.Z.fromBackend("Failed to update user")}};if(em)return(0,t.jsxs)("div",{className:"p-4",children:[(0,t.jsx)(ea.zx,{icon:er.Z,variant:"light",onClick:H,className:"mb-4",children:"Back to Users"}),(0,t.jsx)(ea.xv,{children:"Loading user data..."})]});if(!ed)return(0,t.jsxs)("div",{className:"p-4",children:[(0,t.jsx)(ea.zx,{icon:er.Z,variant:"light",onClick:H,className:"mb-4",children:"Back to Users"}),(0,t.jsx)(ea.xv,{children:"User not found"})]});let eA=async(e,s)=>{await (0,V.vQ)(e)&&(eS(e=>({...e,[s]:!0})),setTimeout(()=>{eS(e=>({...e,[s]:!1}))},2e3))};return(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)(ea.zx,{icon:er.Z,variant:"light",onClick:H,className:"mb-4",children:"Back to Users"}),(0,t.jsx)(ea.Dx,{children:(null===(s=ed.user_info)||void 0===s?void 0:s.user_email)||"User"}),(0,t.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,t.jsx)(ea.xv,{className:"text-gray-500 font-mono",children:ed.user_id}),(0,t.jsx)(g.ZP,{type:"text",size:"small",icon:eZ["user-id"]?(0,t.jsx)(ei.Z,{size:12}):(0,t.jsx)(en.Z,{size:12}),onClick:()=>eA(ed.user_id,"user-id"),className:"left-2 z-10 transition-all duration-200 ".concat(eZ["user-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]})]}),X&&I.LQ.includes(X)&&(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)(ea.zx,{icon:K.Z,variant:"secondary",onClick:eI,className:"flex items-center",children:"Reset Password"}),(0,t.jsx)(ea.zx,{icon:F.Z,variant:"secondary",onClick:()=>eu(!0),className:"flex items-center",children:"Delete User"})]})]}),ec&&(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.jsx)("span",{className:"hidden sm:inline-block sm:align-middle sm:h-screen","aria-hidden":"true",children:""}),(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 User"}),(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 user?"})})]})})}),(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)(ea.zx,{onClick:eD,color:"red",className:"ml-2",children:"Delete"}),(0,t.jsx)(ea.zx,{onClick:()=>eu(!1),children:"Cancel"})]})]})]})}),(0,t.jsxs)(ea.v0,{defaultIndex:ew,onIndexChange:ek,children:[(0,t.jsxs)(ea.td,{className:"mb-4",children:[(0,t.jsx)(ea.OK,{children:"Overview"}),(0,t.jsx)(ea.OK,{children:"Details"})]}),(0,t.jsxs)(ea.nP,{children:[(0,t.jsx)(ea.x4,{children:(0,t.jsxs)(ea.rj,{numItems:1,numItemsSm:2,numItemsLg:3,className:"gap-6",children:[(0,t.jsxs)(ea.Zb,{children:[(0,t.jsx)(ea.xv,{children:"Spend"}),(0,t.jsxs)("div",{className:"mt-2",children:[(0,t.jsxs)(ea.Dx,{children:["$",(0,V.pw)((null===(l=ed.user_info)||void 0===l?void 0:l.spend)||0,4)]}),(0,t.jsxs)(ea.xv,{children:["of"," ",(null===(r=ed.user_info)||void 0===r?void 0:r.max_budget)!==null?"$".concat((0,V.pw)(ed.user_info.max_budget,4)):"Unlimited"]})]})]}),(0,t.jsxs)(ea.Zb,{children:[(0,t.jsx)(ea.xv,{children:"Teams"}),(0,t.jsx)("div",{className:"mt-2",children:(null===(n=ed.teams)||void 0===n?void 0:n.length)&&(null===(d=ed.teams)||void 0===d?void 0:d.length)>0?(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[null===(o=ed.teams)||void 0===o?void 0:o.slice(0,eC?ed.teams.length:20).map((e,s)=>(0,t.jsx)(ea.Ct,{color:"blue",title:e.team_alias,children:e.team_alias},s)),!eC&&(null===(c=ed.teams)||void 0===c?void 0:c.length)>20&&(0,t.jsxs)(ea.Ct,{color:"gray",className:"cursor-pointer hover:bg-gray-200 transition-colors",onClick:()=>eU(!0),children:["+",ed.teams.length-20," more"]}),eC&&(null===(u=ed.teams)||void 0===u?void 0:u.length)>20&&(0,t.jsx)(ea.Ct,{color:"gray",className:"cursor-pointer hover:bg-gray-200 transition-colors",onClick:()=>eU(!1),children:"Show Less"})]}):(0,t.jsx)(ea.xv,{children:"No teams"})})]}),(0,t.jsxs)(ea.Zb,{children:[(0,t.jsx)(ea.xv,{children:"API Keys"}),(0,t.jsx)("div",{className:"mt-2",children:(0,t.jsxs)(ea.xv,{children:[(null===(m=ed.keys)||void 0===m?void 0:m.length)||0," keys"]})})]}),(0,t.jsxs)(ea.Zb,{children:[(0,t.jsx)(ea.xv,{children:"Personal Models"}),(0,t.jsx)("div",{className:"mt-2",children:(null===(h=ed.user_info)||void 0===h?void 0:null===(x=h.models)||void 0===x?void 0:x.length)&&(null===(v=ed.user_info)||void 0===v?void 0:null===(j=v.models)||void 0===j?void 0:j.length)>0?null===(b=ed.user_info)||void 0===b?void 0:null===(y=b.models)||void 0===y?void 0:y.map((e,s)=>(0,t.jsx)(ea.xv,{children:e},s)):(0,t.jsx)(ea.xv,{children:"All proxy models"})})]})]})}),(0,t.jsx)(ea.x4,{children:(0,t.jsxs)(ea.Zb,{children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,t.jsx)(ea.Dx,{children:"User Settings"}),!eh&&X&&I.LQ.includes(X)&&(0,t.jsx)(ea.zx,{variant:"light",onClick:()=>eg(!0),children:"Edit Settings"})]}),eh&&ed?(0,t.jsx)(z,{userData:ed,onCancel:()=>eg(!1),onSubmit:ez,teams:ed.teams,accessToken:Y,userID:$,userRole:X,userModels:ej,possibleUIRoles:es}):(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(ea.xv,{className:"font-medium",children:"User ID"}),(0,t.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,t.jsx)(ea.xv,{className:"font-mono",children:ed.user_id}),(0,t.jsx)(g.ZP,{type:"text",size:"small",icon:eZ["user-id"]?(0,t.jsx)(ei.Z,{size:12}):(0,t.jsx)(en.Z,{size:12}),onClick:()=>eA(ed.user_id,"user-id"),className:"left-2 z-10 transition-all duration-200 ".concat(eZ["user-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(ea.xv,{className:"font-medium",children:"Email"}),(0,t.jsx)(ea.xv,{children:(null===(_=ed.user_info)||void 0===_?void 0:_.user_email)||"Not Set"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(ea.xv,{className:"font-medium",children:"Global Proxy Role"}),(0,t.jsx)(ea.xv,{children:(null===(N=ed.user_info)||void 0===N?void 0:N.user_role)||"Not Set"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(ea.xv,{className:"font-medium",children:"Created"}),(0,t.jsx)(ea.xv,{children:(null===(w=ed.user_info)||void 0===w?void 0:w.created_at)?new Date(ed.user_info.created_at).toLocaleString():"Unknown"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(ea.xv,{className:"font-medium",children:"Last Updated"}),(0,t.jsx)(ea.xv,{children:(null===(k=ed.user_info)||void 0===k?void 0:k.updated_at)?new Date(ed.user_info.updated_at).toLocaleString():"Unknown"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(ea.xv,{className:"font-medium",children:"Teams"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:(null===(Z=ed.teams)||void 0===Z?void 0:Z.length)&&(null===(S=ed.teams)||void 0===S?void 0:S.length)>0?(0,t.jsxs)(t.Fragment,{children:[null===(C=ed.teams)||void 0===C?void 0:C.slice(0,eC?ed.teams.length:20).map((e,s)=>(0,t.jsx)("span",{className:"px-2 py-1 bg-blue-100 rounded text-xs",title:e.team_alias||e.team_id,children:e.team_alias||e.team_id},s)),!eC&&(null===(U=ed.teams)||void 0===U?void 0:U.length)>20&&(0,t.jsxs)("span",{className:"px-2 py-1 bg-gray-100 rounded text-xs cursor-pointer hover:bg-gray-200 transition-colors",onClick:()=>eU(!0),children:["+",ed.teams.length-20," more"]}),eC&&(null===(D=ed.teams)||void 0===D?void 0:D.length)>20&&(0,t.jsx)("span",{className:"px-2 py-1 bg-gray-100 rounded text-xs cursor-pointer hover:bg-gray-200 transition-colors",onClick:()=>eU(!1),children:"Show Less"})]}):(0,t.jsx)(ea.xv,{children:"No teams"})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(ea.xv,{className:"font-medium",children:"Personal Models"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:(null===(B=ed.user_info)||void 0===B?void 0:null===(L=B.models)||void 0===L?void 0:L.length)&&(null===(M=ed.user_info)||void 0===M?void 0:null===(E=M.models)||void 0===E?void 0:E.length)>0?null===(O=ed.user_info)||void 0===O?void 0:null===(R=O.models)||void 0===R?void 0:R.map((e,s)=>(0,t.jsx)("span",{className:"px-2 py-1 bg-blue-100 rounded text-xs",children:e},s)):(0,t.jsx)(ea.xv,{children:"All proxy models"})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(ea.xv,{className:"font-medium",children:"API Keys"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:(null===(T=ed.keys)||void 0===T?void 0:T.length)&&(null===(P=ed.keys)||void 0===P?void 0:P.length)>0?ed.keys.map((e,s)=>(0,t.jsx)("span",{className:"px-2 py-1 bg-green-100 rounded text-xs",children:e.key_alias||e.token},s)):(0,t.jsx)(ea.xv,{children:"No API keys"})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(ea.xv,{className:"font-medium",children:"Max Budget"}),(0,t.jsx)(ea.xv,{children:(null===(q=ed.user_info)||void 0===q?void 0:q.max_budget)!==null&&(null===(G=ed.user_info)||void 0===G?void 0:G.max_budget)!==void 0?"$".concat((0,V.pw)(ed.user_info.max_budget,4)):"Unlimited"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(ea.xv,{className:"font-medium",children:"Budget Reset"}),(0,t.jsx)(ea.xv,{children:(0,p.m)(null!==(Q=null===(J=ed.user_info)||void 0===J?void 0:J.budget_duration)&&void 0!==Q?Q:null)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(ea.xv,{className:"font-medium",children:"Metadata"}),(0,t.jsx)("pre",{className:"bg-gray-100 p-2 rounded text-xs overflow-auto mt-1",children:JSON.stringify((null===(W=ed.user_info)||void 0===W?void 0:W.metadata)||{},null,2)})]})]})]})})]})]}),(0,t.jsx)(f.Z,{isInvitationLinkModalVisible:ev,setIsInvitationLinkModalVisible:ef,baseUrl:e_||"",invitationLinkData:ey,modalType:"resetPassword"})]})}function eo(e){let{data:s=[],columns:l,isLoading:r=!1,onSortChange:i,currentSort:n,accessToken:d,userRole:c,possibleUIRoles:u,handleEdit:m,handleDelete:x,handleResetPassword:h,selectedUsers:g=[],onSelectionChange:j,enableSelection:p=!1,filters:v,updateFilters:f,initialFilters:y,teams:b,userListResponse:_,currentPage:N,handlePageChange:w}=e,[k,Z]=a.useState([{id:(null==n?void 0:n.sortBy)||"created_at",desc:(null==n?void 0:n.sortOrder)==="desc"}]),[S,C]=a.useState(null),[U,I]=a.useState(!1),[D,z]=a.useState(!1),A=function(e){let s=arguments.length>1&&void 0!==arguments[1]&&arguments[1];C(e),I(s)},L=(e,s)=>{j&&(s?j([...g,e]):j(g.filter(s=>s.user_id!==e.user_id)))},B=e=>{j&&(e?j(s):j([]))},E=e=>g.some(s=>s.user_id===e.user_id),M=s.length>0&&g.length===s.length,R=g.length>0&&g.lengthu?q(u,m,x,h,A,p?{selectedUsers:g,onSelectUser:L,onSelectAll:B,isUserSelected:E,isAllSelected:M,isIndeterminate:R}:void 0):l,[u,m,x,h,A,l,p,g,M,R]),T=(0,G.b7)({data:s,columns:O,state:{sorting:k},onSortingChange:e=>{if(Z(e),e.length>0){let s=e[0],l=s.id,t=s.desc?"desc":"asc";null==i||i(l,t)}},getCoreRowModel:(0,J.sC)(),getSortedRowModel:(0,J.tj)(),enableSorting:!0});return(a.useEffect(()=>{n&&Z([{id:n.sortBy,desc:"desc"===n.sortOrder}])},[n]),S)?(0,t.jsx)(ed,{userId:S,onClose:()=>{C(null),I(!1)},accessToken:d,userRole:c,possibleUIRoles:u,initialTab:U?1:0,startInEditMode:U}):(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow",children:[(0,t.jsx)("div",{className:"border-b px-6 py-4",children:(0,t.jsxs)("div",{className:"flex flex-col space-y-4",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,t.jsxs)("div",{className:"relative w-64",children:[(0,t.jsx)("input",{type:"text",placeholder:"Search by email...",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:v.email,onChange:e=>f({email:e.target.value})}),(0,t.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,t.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,t.jsxs)("button",{className:"px-3 py-2 text-sm border rounded-md hover:bg-gray-50 flex items-center gap-2 ".concat(D?"bg-gray-100":""),onClick:()=>z(!D),children:[(0,t.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.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",(v.user_id||v.user_role||v.team)&&(0,t.jsx)("span",{className:"w-2 h-2 rounded-full bg-blue-500"})]}),(0,t.jsxs)("button",{className:"px-3 py-2 text-sm border rounded-md hover:bg-gray-50 flex items-center gap-2",onClick:()=>{f(y)},children:[(0,t.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.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"]})]}),D&&(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-3 mt-3",children:[(0,t.jsxs)("div",{className:"relative w-64",children:[(0,t.jsx)("input",{type:"text",placeholder:"Filter by User 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:v.user_id,onChange:e=>f({user_id:e.target.value})}),(0,t.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,t.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,t.jsx)("div",{className:"w-64",children:(0,t.jsx)(W.Z,{value:v.user_role,onValueChange:e=>f({user_role:e}),placeholder:"Select Role",children:u&&Object.entries(u).map(e=>{let[s,l]=e;return(0,t.jsx)(o.Z,{value:s,children:l.ui_label},s)})})}),(0,t.jsx)("div",{className:"w-64",children:(0,t.jsx)(W.Z,{value:v.team,onValueChange:e=>f({team:e}),placeholder:"Select Team",children:null==b?void 0:b.map(e=>(0,t.jsx)(o.Z,{value:e.team_id,children:e.team_alias||e.team_id},e.team_id))})}),(0,t.jsx)("div",{className:"relative w-64",children:(0,t.jsx)("input",{type:"text",placeholder:"Filter by SSO 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:v.sso_user_id,onChange:e=>f({sso_user_id:e.target.value})})})]}),(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsxs)("span",{className:"text-sm text-gray-700",children:["Showing"," ",_&&_.users&&_.users.length>0?(_.page-1)*_.page_size+1:0," ","-"," ",_&&_.users?Math.min(_.page*_.page_size,_.total):0," ","of ",_?_.total:0," results"]}),(0,t.jsxs)("div",{className:"flex space-x-2",children:[(0,t.jsx)("button",{onClick:()=>w(N-1),disabled:1===N,className:"px-3 py-1 text-sm border rounded-md ".concat(1===N?"bg-gray-100 text-gray-400 cursor-not-allowed":"hover:bg-gray-50"),children:"Previous"}),(0,t.jsx)("button",{onClick:()=>w(N+1),disabled:!_||N>=_.total_pages,className:"px-3 py-1 text-sm border rounded-md ".concat(!_||N>=_.total_pages?"bg-gray-100 text-gray-400 cursor-not-allowed":"hover:bg-gray-50"),children:"Next"})]})]})]})}),(0,t.jsx)("div",{className:"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)(Q.Z,{className:"[&_td]:py-0.5 [&_th]:py-1",children:[(0,t.jsx)(Y.Z,{children:T.getHeaderGroups().map(e=>(0,t.jsx)(ee.Z,{children:e.headers.map(e=>(0,t.jsx)(X.Z,{className:"py-1 h-8 ".concat("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,G.ie)(e.column.columnDef.header,e.getContext())}),"actions"!==e.id&&(0,t.jsx)("div",{className:"w-4",children:e.column.getIsSorted()?({asc:(0,t.jsx)(es.Z,{className:"h-4 w-4 text-blue-500"}),desc:(0,t.jsx)(el.Z,{className:"h-4 w-4 text-blue-500"})})[e.column.getIsSorted()]:(0,t.jsx)(et.Z,{className:"h-4 w-4 text-gray-400"})})]})},e.id))},e.id))}),(0,t.jsx)($.Z,{children:r?(0,t.jsx)(ee.Z,{children:(0,t.jsx)(H.Z,{colSpan:O.length,className:"h-8 text-center",children:(0,t.jsx)("div",{className:"text-center text-gray-500",children:(0,t.jsx)("p",{children:"\uD83D\uDE85 Loading users..."})})})}):s.length>0?T.getRowModel().rows.map(e=>(0,t.jsx)(ee.Z,{className:"h-8",children:e.getVisibleCells().map(e=>(0,t.jsx)(H.Z,{className:"py-0.5 max-h-8 overflow-hidden text-ellipsis whitespace-nowrap ".concat("actions"===e.column.id?"sticky right-0 bg-white shadow-[-4px_0_8px_-6px_rgba(0,0,0,0.1)]":""),onClick:()=>{"user_id"===e.column.id&&A(e.getValue(),!1)},style:{cursor:"user_id"===e.column.id?"pointer":"default",color:"user_id"===e.column.id?"#3b82f6":"inherit"},children:(0,G.ie)(e.column.columnDef.cell,e.getContext())},e.id))},e.id)):(0,t.jsx)(ee.Z,{children:(0,t.jsx)(H.Z,{colSpan:O.length,className:"h-8 text-center",children:(0,t.jsx)("div",{className:"text-center text-gray-500",children:(0,t.jsx)("p",{children:"No users found"})})})})})]})})})})]})}var ec=l(88913),eu=l(63709),em=l(87908),ex=l(26349),eh=l(96473),eg=e=>{var s;let{accessToken:l,possibleUIRoles:r,userID:n,userRole:d}=e,[o,c]=(0,a.useState)(!0),[u,m]=(0,a.useState)(null),[g,j]=(0,a.useState)(!1),[v,f]=(0,a.useState)({}),[b,_]=(0,a.useState)(!1),[N,w]=(0,a.useState)([]),{Paragraph:k}=y.default,{Option:Z}=x.default;(0,a.useEffect)(()=>{(async()=>{if(!l){c(!1);return}try{let e=await (0,i.getInternalUserSettings)(l);if(m(e),f(e.values||{}),l)try{let e=await (0,i.modelAvailableCall)(l,n,d);if(e&&e.data){let s=e.data.map(e=>e.id);w(s)}}catch(e){console.error("Error fetching available models:",e)}}catch(e){console.error("Error fetching SSO settings:",e),A.Z.fromBackend("Failed to fetch SSO settings")}finally{c(!1)}})()},[l]);let S=async()=>{if(l){_(!0);try{let e=Object.entries(v).reduce((e,s)=>{let[l,t]=s;return e[l]=""===t?null:t,e},{}),s=await (0,i.updateInternalUserSettings)(l,e);m({...u,values:s.settings}),j(!1)}catch(e){console.error("Error updating SSO settings:",e),A.Z.fromBackend("Failed to update settings: "+e)}finally{_(!1)}}},C=(e,s)=>{f(l=>({...l,[e]:s}))},I=e=>e&&Array.isArray(e)?e.map(e=>"string"==typeof e?{team_id:e,user_role:"user"}:"object"==typeof e&&e.team_id?{team_id:e.team_id,max_budget_in_team:e.max_budget_in_team,user_role:e.user_role||"user"}:{team_id:"",user_role:"user"}):[],D=e=>{let s=I(e),l=(e,l,t)=>{let a=[...s];a[e]={...a[e],[l]:t},C("teams",a)},a=e=>{C("teams",s.filter((s,l)=>l!==e))};return(0,t.jsxs)("div",{className:"space-y-3",children:[s.map((e,s)=>(0,t.jsxs)("div",{className:"border rounded-lg p-4 bg-gray-50",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,t.jsxs)(ec.xv,{className:"font-medium",children:["Team ",s+1]}),(0,t.jsx)(ec.zx,{size:"sm",variant:"secondary",icon:ex.Z,onClick:()=>a(s),className:"text-red-500 hover:text-red-700",children:"Remove"})]}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(ec.xv,{className:"text-sm font-medium mb-1",children:"Team ID"}),(0,t.jsx)(ec.oi,{value:e.team_id,onChange:e=>l(s,"team_id",e.target.value),placeholder:"Enter team ID"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(ec.xv,{className:"text-sm font-medium mb-1",children:"Max Budget in Team"}),(0,t.jsx)(h.Z,{style:{width:"100%"},value:e.max_budget_in_team,onChange:e=>l(s,"max_budget_in_team",e),placeholder:"Optional",min:0,step:.01,precision:2})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(ec.xv,{className:"text-sm font-medium mb-1",children:"User Role"}),(0,t.jsxs)(x.default,{style:{width:"100%"},value:e.user_role,onChange:e=>l(s,"user_role",e),children:[(0,t.jsx)(Z,{value:"user",children:"User"}),(0,t.jsx)(Z,{value:"admin",children:"Admin"})]})]})]})]},s)),(0,t.jsx)(ec.zx,{variant:"secondary",icon:eh.Z,onClick:()=>{C("teams",[...s,{team_id:"",user_role:"user"}])},className:"w-full",children:"Add Team"})]})},z=(e,s,l)=>{var a;let i=s.type;if("teams"===e)return(0,t.jsx)("div",{className:"mt-2",children:D(v[e]||[])});if("user_role"===e&&r)return(0,t.jsx)(x.default,{style:{width:"100%"},value:v[e]||"",onChange:s=>C(e,s),className:"mt-2",children:Object.entries(r).filter(e=>{let[s]=e;return s.includes("internal_user")}).map(e=>{let[s,{ui_label:l,description:a}]=e;return(0,t.jsx)(Z,{value:s,children:(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("span",{children:l}),(0,t.jsx)("span",{className:"ml-2 text-xs text-gray-500",children:a})]})},s)})});if("budget_duration"===e)return(0,t.jsx)(p.Z,{value:v[e]||null,onChange:s=>C(e,s),className:"mt-2"});if("boolean"===i)return(0,t.jsx)("div",{className:"mt-2",children:(0,t.jsx)(eu.Z,{checked:!!v[e],onChange:s=>C(e,s)})});if("array"===i&&(null===(a=s.items)||void 0===a?void 0:a.enum))return(0,t.jsx)(x.default,{mode:"multiple",style:{width:"100%"},value:v[e]||[],onChange:s=>C(e,s),className:"mt-2",children:s.items.enum.map(e=>(0,t.jsx)(Z,{value:e,children:e},e))});if("models"===e)return(0,t.jsxs)(x.default,{mode:"multiple",style:{width:"100%"},value:v[e]||[],onChange:s=>C(e,s),className:"mt-2",children:[(0,t.jsx)(Z,{value:"no-default-models",children:"No Default Models"}),N.map(e=>(0,t.jsx)(Z,{value:e,children:(0,U.W0)(e)},e))]});if("string"===i&&s.enum)return(0,t.jsx)(x.default,{style:{width:"100%"},value:v[e]||"",onChange:s=>C(e,s),className:"mt-2",children:s.enum.map(e=>(0,t.jsx)(Z,{value:e,children:e},e))});else return(0,t.jsx)(ec.oi,{value:void 0!==v[e]?String(v[e]):"",onChange:s=>C(e,s.target.value),placeholder:s.description||"",className:"mt-2"})},L=(e,s)=>{if(null==s)return(0,t.jsx)("span",{className:"text-gray-400",children:"Not set"});if("teams"===e&&Array.isArray(s)){if(0===s.length)return(0,t.jsx)("span",{className:"text-gray-400",children:"No teams assigned"});let e=I(s);return(0,t.jsx)("div",{className:"space-y-2 mt-1",children:e.map((e,s)=>(0,t.jsx)("div",{className:"border rounded-lg p-3 bg-white",children:(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-2 text-sm",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"font-medium text-gray-600",children:"Team ID:"}),(0,t.jsx)("p",{className:"text-gray-900",children:e.team_id||"Not specified"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"font-medium text-gray-600",children:"Max Budget:"}),(0,t.jsx)("p",{className:"text-gray-900",children:void 0!==e.max_budget_in_team?"$".concat((0,V.pw)(e.max_budget_in_team,4)):"No limit"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"font-medium text-gray-600",children:"Role:"}),(0,t.jsx)("p",{className:"text-gray-900 capitalize",children:e.user_role})]})]})},s))})}if("user_role"===e&&r&&r[s]){let{ui_label:e,description:l}=r[s];return(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"font-medium",children:e}),l&&(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:l})]})}return"budget_duration"===e?(0,t.jsx)("span",{children:(0,p.m)(s)}):"boolean"==typeof s?(0,t.jsx)("span",{children:s?"Enabled":"Disabled"}):"models"===e&&Array.isArray(s)?0===s.length?(0,t.jsx)("span",{className:"text-gray-400",children:"None"}):(0,t.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:s.map((e,s)=>(0,t.jsx)("span",{className:"px-2 py-1 bg-blue-100 rounded text-xs",children:(0,U.W0)(e)},s))}):"object"==typeof s?Array.isArray(s)?0===s.length?(0,t.jsx)("span",{className:"text-gray-400",children:"None"}):(0,t.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:s.map((e,s)=>(0,t.jsx)("span",{className:"px-2 py-1 bg-blue-100 rounded text-xs",children:"object"==typeof e?JSON.stringify(e):String(e)},s))}):(0,t.jsx)("pre",{className:"bg-gray-100 p-2 rounded text-xs overflow-auto mt-1",children:JSON.stringify(s,null,2)}):(0,t.jsx)("span",{children:String(s)})};return o?(0,t.jsx)("div",{className:"flex justify-center items-center h-64",children:(0,t.jsx)(em.Z,{size:"large"})}):u?(0,t.jsxs)(ec.Zb,{children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,t.jsx)(ec.Dx,{children:"Default User Settings"}),!o&&u&&(g?(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(ec.zx,{variant:"secondary",onClick:()=>{j(!1),f(u.values||{})},disabled:b,children:"Cancel"}),(0,t.jsx)(ec.zx,{onClick:S,loading:b,children:"Save Changes"})]}):(0,t.jsx)(ec.zx,{onClick:()=>j(!0),children:"Edit Settings"}))]}),(null==u?void 0:null===(s=u.field_schema)||void 0===s?void 0:s.description)&&(0,t.jsx)(k,{className:"mb-4",children:u.field_schema.description}),(0,t.jsx)(ec.iz,{}),(0,t.jsx)("div",{className:"mt-4 space-y-4",children:(()=>{let{values:e,field_schema:s}=u;return s&&s.properties?Object.entries(s.properties).map(s=>{let[l,a]=s,r=e[l],i=l.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase());return(0,t.jsxs)("div",{className:"mb-6 pb-6 border-b border-gray-200 last:border-0",children:[(0,t.jsx)(ec.xv,{className:"font-medium text-lg",children:i}),(0,t.jsx)(k,{className:"text-sm text-gray-500 mt-1",children:a.description||"No description available"}),g?(0,t.jsx)("div",{className:"mt-2",children:z(l,a,r)}):(0,t.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:L(l,r)})]},l)}):(0,t.jsx)(ec.xv,{children:"No schema information available"})})()})]}):(0,t.jsx)(ec.Zb,{children:(0,t.jsx)(ec.xv,{children:"No settings available or you do not have permission to view them."})})},ej=l(29827),ep=l(16593),ev=l(19616);let ef={email:"",user_id:"",user_role:"",sso_user_id:"",team:"",model:"",min_spend:null,max_spend:null,sort_by:"created_at",sort_order:"desc"};var ey=e=>{var s;let{accessToken:l,token:o,userRole:c,userID:u,teams:m}=e,x=(0,ej.NL)(),[h,g]=(0,a.useState)(1),[j,p]=(0,a.useState)(!1),[y,b]=(0,a.useState)(null),[_,N]=(0,a.useState)(!1),[w,k]=(0,a.useState)(null),[Z,S]=(0,a.useState)("users"),[C,U]=(0,a.useState)(ef),[D,z,L]=(0,ev.G)(C,{wait:300}),[B,M]=(0,a.useState)(!1),[R,O]=(0,a.useState)(null),[T,P]=(0,a.useState)(null),[F,K]=(0,a.useState)([]),[G,J]=(0,a.useState)(!1),[W,Q]=(0,a.useState)(!1),[$,H]=(0,a.useState)([]),Y=e=>{k(e),N(!0)};(0,a.useEffect)(()=>()=>{L.cancel()},[L]),(0,a.useEffect)(()=>{P((0,i.getProxyBaseUrl)())},[]),(0,a.useEffect)(()=>{(async()=>{try{if(!u||!c||!l)return;let e=(await (0,i.modelAvailableCall)(l,u,c)).data.map(e=>e.id);console.log("available_model_names:",e),H(e)}catch(e){console.error("Error fetching user models:",e)}})()},[l,u,c]);let X=e=>{U(s=>{let l={...s,...e};return z(l),l})},ee=async e=>{if(!l){A.Z.fromBackend("Access token not found");return}try{A.Z.success("Generating password reset link...");let s=await (0,i.invitationCreateCall)(l,e);O(s),M(!0)}catch(e){A.Z.fromBackend("Failed to generate password reset link")}},es=async()=>{if(w&&l)try{await (0,i.userDeleteCall)(l,[w]),x.setQueriesData({queryKey:["userList"]},e=>{if(void 0===e)return e;let s=e.users.filter(e=>e.user_id!==w);return{...e,users:s}}),A.Z.success("User deleted successfully")}catch(e){console.error("Error deleting user:",e),A.Z.fromBackend("Failed to delete user")}N(!1),k(null)},el=async()=>{b(null),p(!1)},et=async e=>{if(console.log("inside handleEditSubmit:",e),l&&o&&c&&u){try{let s=await (0,i.userUpdateUserCall)(l,e,null);x.setQueriesData({queryKey:["userList"]},e=>{if(void 0===e)return e;let l=e.users.map(e=>e.user_id===s.data.user_id?(0,V.nl)(e,s.data):e);return{...e,users:l}}),A.Z.success("User ".concat(e.user_id," updated successfully"))}catch(e){console.error("There was an error updating the user",e)}b(null),p(!1)}},ea=async e=>{g(e)},er=(0,ep.a)({queryKey:["userList",{debouncedFilter:D,currentPage:h}],queryFn:async()=>{if(!l)throw Error("Access token required");return await (0,i.userListCall)(l,D.user_id?[D.user_id]:null,h,25,D.email||null,D.user_role||null,D.team||null,D.sso_user_id||null,D.sort_by,D.sort_order)},enabled:!!(l&&o&&c&&u),placeholderData:e=>e}),ei=er.data,en=(0,ep.a)({queryKey:["userRoles"],initialData:()=>({}),queryFn:async()=>{if(!l)throw Error("Access token required");return await (0,i.getPossibleUserRoles)(l)},enabled:!!(l&&o&&c&&u)}).data;if(er.isLoading||!l||!o||!c||!u)return(0,t.jsx)("div",{children:"Loading..."});let ed=q(en,e=>{b(e),p(!0)},Y,ee,()=>{});return(0,t.jsxs)("div",{className:"w-full p-8 overflow-hidden",children:[(0,t.jsx)("div",{className:"flex items-center justify-between mb-4",children:(0,t.jsxs)("div",{className:"flex space-x-3",children:[(0,t.jsx)(d.Z,{userID:u,accessToken:l,teams:m,possibleUIRoles:en}),(0,t.jsx)(n.z,{onClick:()=>{Q(!W),K([])},variant:W?"primary":"secondary",className:"flex items-center",children:W?"Cancel Selection":"Select Users"}),W&&(0,t.jsxs)(n.z,{onClick:()=>{if(0===F.length){A.Z.fromBackend("Please select users to edit");return}J(!0)},disabled:0===F.length,className:"flex items-center",children:["Bulk Edit (",F.length," selected)"]})]})}),(0,t.jsxs)(r.v0,{defaultIndex:0,onIndexChange:e=>S(0===e?"users":"settings"),children:[(0,t.jsxs)(r.td,{className:"mb-4",children:[(0,t.jsx)(r.OK,{children:"Users"}),(0,t.jsx)(r.OK,{children:"Default User Settings"})]}),(0,t.jsxs)(r.nP,{children:[(0,t.jsx)(r.x4,{children:(0,t.jsx)(eo,{data:(null===(s=er.data)||void 0===s?void 0:s.users)||[],columns:ed,isLoading:er.isLoading,accessToken:l,userRole:c,onSortChange:(e,s)=>{X({sort_by:e,sort_order:s})},currentSort:{sortBy:C.sort_by,sortOrder:C.sort_order},possibleUIRoles:en,handleEdit:e=>{b(e),p(!0)},handleDelete:Y,handleResetPassword:ee,enableSelection:W,selectedUsers:F,onSelectionChange:e=>{K(e)},filters:C,updateFilters:X,initialFilters:ef,teams:m,userListResponse:ei,currentPage:h,handlePageChange:ea})}),(0,t.jsx)(r.x4,{children:(0,t.jsx)(eg,{accessToken:l,possibleUIRoles:en,userID:u,userRole:c})})]})]}),(0,t.jsx)(v,{visible:j,possibleUIRoles:en,onCancel:el,user:y,onSubmit:et}),_&&(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.jsx)("span",{className:"hidden sm:inline-block sm:align-middle sm:h-screen","aria-hidden":"true",children:""}),(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 User"}),(0,t.jsxs)("div",{className:"mt-2",children:[(0,t.jsx)("p",{className:"text-sm text-gray-500",children:"Are you sure you want to delete this user?"}),(0,t.jsxs)("p",{className:"text-sm font-medium text-gray-900 mt-2",children:["User ID: ",w]})]})]})})}),(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)(n.z,{onClick:es,color:"red",className:"ml-2",children:"Delete"}),(0,t.jsx)(n.z,{onClick:()=>{N(!1),k(null)},children:"Cancel"})]})]})]})}),(0,t.jsx)(f.Z,{isInvitationLinkModalVisible:B,setIsInvitationLinkModalVisible:M,baseUrl:T||"",invitationLinkData:R,modalType:"resetPassword"}),(0,t.jsx)(E,{visible:G,onCancel:()=>J(!1),selectedUsers:F,possibleUIRoles:en,accessToken:l,onSuccess:()=>{x.invalidateQueries({queryKey:["userList"]}),K([]),Q(!1)},teams:m,userRole:c,userModels:$,allowAllUsers:!!c&&(0,I.tY)(c)})]})}}}]);
\ No newline at end of file
diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/7640-0474293166ede97c.js b/litellm/proxy/_experimental/out/_next/static/chunks/7640-0474293166ede97c.js
deleted file mode 100644
index 7050f4d7926..00000000000
--- a/litellm/proxy/_experimental/out/_next/static/chunks/7640-0474293166ede97c.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7640],{89245:function(e,r,t){t.d(r,{Z:function(){return l}});var a=t(1119),o=t(2265),n={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"},d=t(55015),l=o.forwardRef(function(e,r){return o.createElement(d.Z,(0,a.Z)({},e,{ref:r,icon:n}))})},69993:function(e,r,t){t.d(r,{Z:function(){return l}});var a=t(1119),o=t(2265),n={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"},d=t(55015),l=o.forwardRef(function(e,r){return o.createElement(d.Z,(0,a.Z)({},e,{ref:r,icon:n}))})},78355:function(e,r,t){t.d(r,{Z:function(){return l}});var a=t(1119),o=t(2265),n={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"},d=t(55015),l=o.forwardRef(function(e,r){return o.createElement(d.Z,(0,a.Z)({},e,{ref:r,icon:n}))})},47323:function(e,r,t){t.d(r,{Z:function(){return g}});var a=t(5853),o=t(2265),n=t(1526),d=t(7084),l=t(97324),i=t(1153),c=t(26898);let s={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"}},m={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"}},u={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:""}},b=(e,r)=>{switch(e){case"simple":return{textColor:r?(0,i.bM)(r,c.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:"",borderColor:"",ringColor:""};case"light":return{textColor:r?(0,i.bM)(r,c.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:r?(0,l.q)((0,i.bM)(r,c.K.background).bgColor,"bg-opacity-20"):"bg-tremor-brand-muted dark:bg-dark-tremor-brand-muted",borderColor:"",ringColor:""};case"shadow":return{textColor:r?(0,i.bM)(r,c.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:r?(0,l.q)((0,i.bM)(r,c.K.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:r?(0,i.bM)(r,c.K.text).textColor:"text-tremor-brand-inverted dark:text-dark-tremor-brand-inverted",bgColor:r?(0,l.q)((0,i.bM)(r,c.K.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:r?(0,i.bM)(r,c.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:r?(0,l.q)((0,i.bM)(r,c.K.background).bgColor,"bg-opacity-20"):"bg-tremor-background dark:bg-dark-tremor-background",borderColor:r?(0,i.bM)(r,c.K.ring).borderColor:"border-tremor-brand-subtle dark:border-dark-tremor-brand-subtle",ringColor:r?(0,l.q)((0,i.bM)(r,c.K.ring).ringColor,"ring-opacity-40"):"ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted"}}},f=(0,i.fn)("Icon"),g=o.forwardRef((e,r)=>{let{icon:t,variant:c="simple",tooltip:g,size:h=d.u8.SM,color:p,className:k}=e,w=(0,a._T)(e,["icon","variant","tooltip","size","color","className"]),x=b(c,p),{tooltipProps:v,getReferenceProps:C}=(0,n.l)();return o.createElement("span",Object.assign({ref:(0,i.lq)([r,v.refs.setReference]),className:(0,l.q)(f("root"),"inline-flex flex-shrink-0 items-center",x.bgColor,x.textColor,x.borderColor,x.ringColor,u[c].rounded,u[c].border,u[c].shadow,u[c].ring,s[h].paddingX,s[h].paddingY,k)},C,w),o.createElement(n.Z,Object.assign({text:g},v)),o.createElement(t,{className:(0,l.q)(f("icon"),"shrink-0",m[h].height,m[h].width)}))});g.displayName="Icon"},67982:function(e,r,t){t.d(r,{Z:function(){return i}});var a=t(5853),o=t(97324),n=t(1153),d=t(2265);let l=(0,n.fn)("Divider"),i=d.forwardRef((e,r)=>{let{className:t,children:n}=e,i=(0,a._T)(e,["className","children"]);return d.createElement("div",Object.assign({ref:r,className:(0,o.q)(l("root"),"w-full mx-auto my-6 flex justify-between gap-3 items-center text-tremor-default","text-tremor-content","dark:text-dark-tremor-content",t)},i),n?d.createElement(d.Fragment,null,d.createElement("div",{className:(0,o.q)("w-full h-[1px] bg-tremor-border dark:bg-dark-tremor-border")}),d.createElement("div",{className:(0,o.q)("text-inherit whitespace-nowrap")},n),d.createElement("div",{className:(0,o.q)("w-full h-[1px] bg-tremor-border dark:bg-dark-tremor-border")})):d.createElement("div",{className:(0,o.q)("w-full h-[1px] bg-tremor-border dark:bg-dark-tremor-border")}))});i.displayName="Divider"},21626:function(e,r,t){t.d(r,{Z:function(){return l}});var a=t(5853),o=t(2265),n=t(97324);let d=(0,t(1153).fn)("Table"),l=o.forwardRef((e,r)=>{let{children:t,className:l}=e,i=(0,a._T)(e,["children","className"]);return o.createElement("div",{className:(0,n.q)(d("root"),"overflow-auto",l)},o.createElement("table",Object.assign({ref:r,className:(0,n.q)(d("table"),"w-full text-tremor-default","text-tremor-content","dark:text-dark-tremor-content")},i),t))});l.displayName="Table"},97214:function(e,r,t){t.d(r,{Z:function(){return l}});var a=t(5853),o=t(2265),n=t(97324);let d=(0,t(1153).fn)("TableBody"),l=o.forwardRef((e,r)=>{let{children:t,className:l}=e,i=(0,a._T)(e,["children","className"]);return o.createElement(o.Fragment,null,o.createElement("tbody",Object.assign({ref:r,className:(0,n.q)(d("root"),"align-top divide-y","divide-tremor-border","dark:divide-dark-tremor-border",l)},i),t))});l.displayName="TableBody"},28241:function(e,r,t){t.d(r,{Z:function(){return l}});var a=t(5853),o=t(2265),n=t(97324);let d=(0,t(1153).fn)("TableCell"),l=o.forwardRef((e,r)=>{let{children:t,className:l}=e,i=(0,a._T)(e,["children","className"]);return o.createElement(o.Fragment,null,o.createElement("td",Object.assign({ref:r,className:(0,n.q)(d("root"),"align-middle whitespace-nowrap text-left p-4",l)},i),t))});l.displayName="TableCell"},58834:function(e,r,t){t.d(r,{Z:function(){return l}});var a=t(5853),o=t(2265),n=t(97324);let d=(0,t(1153).fn)("TableHead"),l=o.forwardRef((e,r)=>{let{children:t,className:l}=e,i=(0,a._T)(e,["children","className"]);return o.createElement(o.Fragment,null,o.createElement("thead",Object.assign({ref:r,className:(0,n.q)(d("root"),"text-left","text-tremor-content","dark:text-dark-tremor-content",l)},i),t))});l.displayName="TableHead"},69552:function(e,r,t){t.d(r,{Z:function(){return l}});var a=t(5853),o=t(2265),n=t(97324);let d=(0,t(1153).fn)("TableHeaderCell"),l=o.forwardRef((e,r)=>{let{children:t,className:l}=e,i=(0,a._T)(e,["children","className"]);return o.createElement(o.Fragment,null,o.createElement("th",Object.assign({ref:r,className:(0,n.q)(d("root"),"whitespace-nowrap text-left font-semibold top-0 px-4 py-3.5","text-tremor-content","dark:text-dark-tremor-content",l)},i),t))});l.displayName="TableHeaderCell"},71876:function(e,r,t){t.d(r,{Z:function(){return l}});var a=t(5853),o=t(2265),n=t(97324);let d=(0,t(1153).fn)("TableRow"),l=o.forwardRef((e,r)=>{let{children:t,className:l}=e,i=(0,a._T)(e,["children","className"]);return o.createElement(o.Fragment,null,o.createElement("tr",Object.assign({ref:r,className:(0,n.q)(d("row"),l)},i),t))});l.displayName="TableRow"},96761:function(e,r,t){t.d(r,{Z:function(){return i}});var a=t(5853),o=t(26898),n=t(97324),d=t(1153),l=t(2265);let i=l.forwardRef((e,r)=>{let{color:t,children:i,className:c}=e,s=(0,a._T)(e,["color","children","className"]);return l.createElement("p",Object.assign({ref:r,className:(0,n.q)("font-medium text-tremor-title",t?(0,d.bM)(t,o.K.darkText).textColor:"text-tremor-content-emphasis dark:text-dark-tremor-content-emphasis",c)},s),i)});i.displayName="Title"},79205:function(e,r,t){t.d(r,{Z:function(){return m}});var a=t(2265);let o=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),n=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,r,t)=>t?t.toUpperCase():r.toLowerCase()),d=e=>{let r=n(e);return r.charAt(0).toUpperCase()+r.slice(1)},l=function(){for(var e=arguments.length,r=Array(e),t=0;t!!e&&""!==e.trim()&&t.indexOf(e)===r).join(" ").trim()},i=e=>{for(let r in e)if(r.startsWith("aria-")||"role"===r||"title"===r)return!0};var c={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let s=(0,a.forwardRef)((e,r)=>{let{color:t="currentColor",size:o=24,strokeWidth:n=2,absoluteStrokeWidth:d,className:s="",children:m,iconNode:u,...b}=e;return(0,a.createElement)("svg",{ref:r,...c,width:o,height:o,stroke:t,strokeWidth:d?24*Number(n)/Number(o):n,className:l("lucide",s),...!m&&!i(b)&&{"aria-hidden":"true"},...b},[...u.map(e=>{let[r,t]=e;return(0,a.createElement)(r,t)}),...Array.isArray(m)?m:[m]])}),m=(e,r)=>{let t=(0,a.forwardRef)((t,n)=>{let{className:i,...c}=t;return(0,a.createElement)(s,{ref:n,iconNode:r,className:l("lucide-".concat(o(d(e))),"lucide-".concat(e),i),...c})});return t.displayName=d(e),t}},88906:function(e,r,t){t.d(r,{Z:function(){return a}});let a=(0,t(79205).Z)("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"}]])},76865:function(e,r,t){t.d(r,{Z:function(){return a}});let a=(0,t(79205).Z)("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]])},92369:function(e,r,t){t.d(r,{Z:function(){return a}});let a=(0,t(79205).Z)("user",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]])},53410:function(e,r,t){var a=t(2265);let o=a.forwardRef(function(e,r){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:r},e),a.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"}))});r.Z=o}}]);
\ No newline at end of file
diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/773-70bcd55c3ac1ea8c.js b/litellm/proxy/_experimental/out/_next/static/chunks/773-bc7c79548c46494f.js
similarity index 100%
rename from litellm/proxy/_experimental/out/_next/static/chunks/773-70bcd55c3ac1ea8c.js
rename to litellm/proxy/_experimental/out/_next/static/chunks/773-bc7c79548c46494f.js
diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/7801-7ca1116f6ca3efd9.js b/litellm/proxy/_experimental/out/_next/static/chunks/7801-7ca1116f6ca3efd9.js
new file mode 100644
index 00000000000..f565abfe4a4
--- /dev/null
+++ b/litellm/proxy/_experimental/out/_next/static/chunks/7801-7ca1116f6ca3efd9.js
@@ -0,0 +1 @@
+"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7801],{16312:function(e,l,t){t.d(l,{z:function(){return s.Z}});var s=t(20831)},9335:function(e,l,t){t.d(l,{JO:function(){return s.Z},OK:function(){return a.Z},nP:function(){return n.Z},td:function(){return o.Z},v0:function(){return r.Z},x4:function(){return i.Z}});var s=t(47323),a=t(12485),r=t(18135),o=t(35242),i=t(29706),n=t(77991)},58643:function(e,l,t){t.d(l,{OK:function(){return s.Z},nP:function(){return i.Z},td:function(){return r.Z},v0:function(){return a.Z},x4:function(){return o.Z}});var s=t(12485),a=t(18135),r=t(35242),o=t(29706),i=t(77991)},37801:function(e,l,t){t.d(l,{Z:function(){return lO}});var s=t(57437),a=t(2265),r=t(49804),o=t(67101),i=t(84264),n=t(19250),d=t(42673),c=t(9114);let m=async(e,l,t)=>{try{console.log("handling submit for formValues:",e);let l=e.model_mappings||[];if("model_mappings"in e&&delete e.model_mappings,e.model&&e.model.includes("all-wildcard")){let t=e.custom_llm_provider,s=d.fK[t]+"/*";e.model_name=s,l.push({public_name:s,litellm_model:s}),e.model=s}let t=[];for(let s of l){let l={},a={},r=s.public_name;for(let[t,r]of(l.model=s.litellm_model,e.input_cost_per_token&&(e.input_cost_per_token=Number(e.input_cost_per_token)/1e6),e.output_cost_per_token&&(e.output_cost_per_token=Number(e.output_cost_per_token)/1e6),l.model=s.litellm_model,console.log("formValues add deployment:",e),Object.entries(e)))if(""!==r&&"custom_pricing"!==t&&"pricing_model"!==t&&"cache_control"!==t){if("model_name"==t)l.model=r;else if("custom_llm_provider"==t){console.log("custom_llm_provider:",r);let e=d.fK[r];l.custom_llm_provider=e,console.log("custom_llm_provider mappingResult:",e)}else if("model"==t)continue;else if("base_model"===t)a[t]=r;else if("team_id"===t)a.team_id=r;else if("model_access_group"===t)a.access_groups=r;else if("mode"==t)console.log("placing mode in modelInfo"),a.mode=r,delete l.mode;else if("custom_model_name"===t)l.model=r;else if("litellm_extra_params"==t){console.log("litellm_extra_params:",r);let e={};if(r&&void 0!=r){try{e=JSON.parse(r)}catch(e){throw c.Z.fromBackend("Failed to parse LiteLLM Extra Params: "+e),Error("Failed to parse litellm_extra_params: "+e)}for(let[t,s]of Object.entries(e))l[t]=s}}else if("model_info_params"==t){console.log("model_info_params:",r);let e={};if(r&&void 0!=r){try{e=JSON.parse(r)}catch(e){throw c.Z.fromBackend("Failed to parse LiteLLM Extra Params: "+e),Error("Failed to parse litellm_extra_params: "+e)}for(let[l,t]of Object.entries(e))a[l]=t}}else if("input_cost_per_token"===t||"output_cost_per_token"===t||"input_cost_per_second"===t){r&&(l[t]=Number(r));continue}else l[t]=r}t.push({litellmParamsObj:l,modelInfoObj:a,modelName:r})}return t}catch(e){c.Z.fromBackend("Failed to create model: "+e)}},u=async(e,l,t,s)=>{try{let a=await m(e,l,t);if(!a||0===a.length)return;for(let e of a){let{litellmParamsObj:t,modelInfoObj:s,modelName:a}=e,r={model_name:a,litellm_params:t,model_info:s},o=await (0,n.modelCreateCall)(l,r);console.log("response for model create call: ".concat(o.data))}s&&s(),t.resetFields()}catch(e){c.Z.fromBackend("Failed to add model: "+e)}};var h=t(62490),x=t(53410),p=t(74998),g=t(93192),f=t(13634),j=t(82680),v=t(52787),_=t(89970),y=t(73002),b=t(56522),N=t(65319),w=t(47451),k=t(69410),C=t(3632);let{Link:Z}=g.default,S={[d.Cl.OpenAI]:[{key:"api_base",label:"API Base",type:"text",placeholder:"https://api.openai.com/v1",tooltip:"Common endpoints: https://api.openai.com/v1, https://eu.api.openai.com, https://us.api.openai.com",defaultValue:"https://api.openai.com/v1"},{key:"organization",label:"OpenAI Organization ID",placeholder:"[OPTIONAL] my-unique-org"},{key:"api_key",label:"OpenAI API Key",type:"password",required:!0}],[d.Cl.OpenAI_Text]:[{key:"api_base",label:"API Base",type:"text",placeholder:"https://api.openai.com/v1",tooltip:"Common endpoints: https://api.openai.com/v1, https://eu.api.openai.com, https://us.api.openai.com",defaultValue:"https://api.openai.com/v1"},{key:"organization",label:"OpenAI Organization ID",placeholder:"[OPTIONAL] my-unique-org"},{key:"api_key",label:"OpenAI API Key",type:"password",required:!0}],[d.Cl.Vertex_AI]:[{key:"vertex_project",label:"Vertex Project",placeholder:"adroit-cadet-1234..",required:!0},{key:"vertex_location",label:"Vertex Location",placeholder:"us-east-1",required:!0},{key:"vertex_credentials",label:"Vertex Credentials",required:!0,type:"upload"}],[d.Cl.AssemblyAI]:[{key:"api_base",label:"API Base",type:"select",required:!0,options:["https://api.assemblyai.com","https://api.eu.assemblyai.com"]},{key:"api_key",label:"AssemblyAI API Key",type:"password",required:!0}],[d.Cl.Azure]:[{key:"api_base",label:"API Base",placeholder:"https://...",required:!0},{key:"api_version",label:"API Version",placeholder:"2023-07-01-preview",tooltip:"By default litellm will use the latest version. If you want to use a different version, you can specify it here"},{key:"base_model",label:"Base Model",placeholder:"azure/gpt-3.5-turbo"},{key:"api_key",label:"Azure API Key",type:"password",required:!0}],[d.Cl.Azure_AI_Studio]:[{key:"api_base",label:"API Base",placeholder:"https://.openai.azure.com/openai/deployments/gpt-4o/chat/completions?api-version=2024-10-21",tooltip:"Enter your full Target URI from Azure Foundry here. Example: https://litellm8397336933.openai.azure.com/openai/deployments/gpt-4o/chat/completions?api-version=2024-10-21",required:!0},{key:"api_key",label:"Azure API Key",type:"password",required:!0}],[d.Cl.OpenAI_Compatible]:[{key:"api_base",label:"API Base",placeholder:"https://...",required:!0},{key:"api_key",label:"OpenAI API Key",type:"password",required:!0}],[d.Cl.Dashscope]:[{key:"api_key",label:"Dashscope API Key",type:"password",required:!0},{key:"api_base",label:"API Base",placeholder:"https://dashscope-intl.aliyuncs.com/compatible-mode/v1",defaultValue:"https://dashscope-intl.aliyuncs.com/compatible-mode/v1",required:!0,tooltip:"The base URL for your Dashscope server. Defaults to https://dashscope-intl.aliyuncs.com/compatible-mode/v1 if not specified."}],[d.Cl.OpenAI_Text_Compatible]:[{key:"api_base",label:"API Base",placeholder:"https://...",required:!0},{key:"api_key",label:"OpenAI API Key",type:"password",required:!0}],[d.Cl.Bedrock]:[{key:"aws_access_key_id",label:"AWS Access Key ID",type:"password",required:!1,tooltip:"You can provide the raw key or the environment variable (e.g. `os.environ/MY_SECRET_KEY`)."},{key:"aws_secret_access_key",label:"AWS Secret Access Key",type:"password",required:!1,tooltip:"You can provide the raw key or the environment variable (e.g. `os.environ/MY_SECRET_KEY`)."},{key:"aws_session_token",label:"AWS Session Token",type:"password",required:!1,tooltip:"Temporary credentials session token. You can provide the raw token or the environment variable (e.g. `os.environ/MY_SESSION_TOKEN`)."},{key:"aws_region_name",label:"AWS Region Name",placeholder:"us-east-1",required:!1,tooltip:"You can provide the raw key or the environment variable (e.g. `os.environ/MY_SECRET_KEY`)."},{key:"aws_session_name",label:"AWS Session Name",placeholder:"my-session",required:!1,tooltip:"Name for the AWS session. You can provide the raw value or the environment variable (e.g. `os.environ/MY_SESSION_NAME`)."},{key:"aws_profile_name",label:"AWS Profile Name",placeholder:"default",required:!1,tooltip:"AWS profile name to use for authentication. You can provide the raw value or the environment variable (e.g. `os.environ/MY_PROFILE_NAME`)."},{key:"aws_role_name",label:"AWS Role Name",placeholder:"MyRole",required:!1,tooltip:"AWS IAM role name to assume. You can provide the raw value or the environment variable (e.g. `os.environ/MY_ROLE_NAME`)."},{key:"aws_web_identity_token",label:"AWS Web Identity Token",type:"password",required:!1,tooltip:"Web identity token for OIDC authentication. You can provide the raw token or the environment variable (e.g. `os.environ/MY_WEB_IDENTITY_TOKEN`)."},{key:"aws_bedrock_runtime_endpoint",label:"AWS Bedrock Runtime Endpoint",placeholder:"https://bedrock-runtime.us-east-1.amazonaws.com",required:!1,tooltip:"Custom Bedrock runtime endpoint URL. You can provide the raw value or the environment variable (e.g. `os.environ/MY_BEDROCK_ENDPOINT`)."}],[d.Cl.SageMaker]:[{key:"aws_access_key_id",label:"AWS Access Key ID",type:"password",required:!1,tooltip:"You can provide the raw key or the environment variable (e.g. `os.environ/MY_SECRET_KEY`)."},{key:"aws_secret_access_key",label:"AWS Secret Access Key",type:"password",required:!1,tooltip:"You can provide the raw key or the environment variable (e.g. `os.environ/MY_SECRET_KEY`)."},{key:"aws_region_name",label:"AWS Region Name",placeholder:"us-east-1",required:!1,tooltip:"You can provide the raw key or the environment variable (e.g. `os.environ/MY_SECRET_KEY`)."}],[d.Cl.Ollama]:[{key:"api_base",label:"API Base",placeholder:"http://localhost:11434",defaultValue:"http://localhost:11434",required:!1,tooltip:"The base URL for your Ollama server. Defaults to http://localhost:11434 if not specified."}],[d.Cl.Anthropic]:[{key:"api_key",label:"API Key",placeholder:"sk-",type:"password",required:!0}],[d.Cl.Deepgram]:[{key:"api_key",label:"API Key",type:"password",required:!0}],[d.Cl.ElevenLabs]:[{key:"api_key",label:"API Key",type:"password",required:!0}],[d.Cl.Google_AI_Studio]:[{key:"api_key",label:"API Key",placeholder:"aig-",type:"password",required:!0}],[d.Cl.Groq]:[{key:"api_key",label:"API Key",type:"password",required:!0}],[d.Cl.MistralAI]:[{key:"api_key",label:"API Key",type:"password",required:!0}],[d.Cl.Deepseek]:[{key:"api_key",label:"API Key",type:"password",required:!0}],[d.Cl.Cohere]:[{key:"api_key",label:"API Key",type:"password",required:!0}],[d.Cl.Databricks]:[{key:"api_key",label:"API Key",type:"password",required:!0}],[d.Cl.xAI]:[{key:"api_key",label:"API Key",type:"password",required:!0}],[d.Cl.AIML]:[{key:"api_key",label:"API Key",type:"password",required:!0}],[d.Cl.Cerebras]:[{key:"api_key",label:"API Key",type:"password",required:!0}],[d.Cl.Sambanova]:[{key:"api_key",label:"API Key",type:"password",required:!0}],[d.Cl.Perplexity]:[{key:"api_key",label:"API Key",type:"password",required:!0}],[d.Cl.TogetherAI]:[{key:"api_key",label:"API Key",type:"password",required:!0}],[d.Cl.Openrouter]:[{key:"api_key",label:"API Key",type:"password",required:!0}],[d.Cl.FireworksAI]:[{key:"api_key",label:"API Key",type:"password",required:!0}],[d.Cl.GradientAI]:[{key:"api_base",label:"GradientAI Endpoint",placeholder:"https://...",required:!1},{key:"api_key",label:"GradientAI API Key",type:"password",required:!0}],[d.Cl.Triton]:[{key:"api_key",label:"API Key",type:"password",required:!1},{key:"api_base",label:"API Base",placeholder:"http://localhost:8000/generate",required:!1}],[d.Cl.Hosted_Vllm]:[{key:"api_base",label:"API Base",placeholder:"https://...",required:!0},{key:"api_key",label:"OpenAI API Key",type:"password",required:!0}],[d.Cl.Voyage]:[{key:"api_key",label:"API Key",type:"password",required:!0}],[d.Cl.JinaAI]:[{key:"api_key",label:"API Key",type:"password",required:!0}],[d.Cl.VolcEngine]:[{key:"api_key",label:"API Key",type:"password",required:!0}],[d.Cl.DeepInfra]:[{key:"api_key",label:"API Key",type:"password",required:!0}],[d.Cl.Oracle]:[{key:"api_key",label:"API Key",type:"password",required:!0}],[d.Cl.Snowflake]:[{key:"api_key",label:"Snowflake API Key / JWT Key for Authentication",type:"password",required:!0},{key:"api_base",label:"Snowflake API Endpoint",placeholder:"https://1234567890.snowflakecomputing.com/api/v2/cortex/inference:complete",tooltip:"Enter the full endpoint with path here. Example: https://1234567890.snowflakecomputing.com/api/v2/cortex/inference:complete",required:!0}],[d.Cl.Infinity]:[{key:"api_base",label:"API Base",placeholder:"http://localhost:7997"}]};var A=e=>{let{selectedProvider:l,uploadProps:t}=e,r=d.Cl[l],o=f.Z.useFormInstance(),i=a.useMemo(()=>S[r]||[],[r]),n={name:"file",accept:".json",beforeUpload:e=>{if("application/json"===e.type){let l=new FileReader;l.onload=e=>{if(e.target){let l=e.target.result;console.log("Setting field value from JSON, length: ".concat(l.length)),o.setFieldsValue({vertex_credentials:l}),console.log("Form values after setting:",o.getFieldsValue())}},l.readAsText(e)}return!1},onChange(e){console.log("Upload onChange triggered in ProviderSpecificFields"),console.log("Current form values:",o.getFieldsValue()),"uploading"!==e.file.status&&console.log(e.file,e.fileList)}};return(0,s.jsx)(s.Fragment,{children:i.map(e=>{var l;return(0,s.jsxs)(a.Fragment,{children:[(0,s.jsx)(f.Z.Item,{label:e.label,name:e.key,rules:e.required?[{required:!0,message:"Required"}]:void 0,tooltip:e.tooltip,className:"vertex_credentials"===e.key?"mb-0":void 0,children:"select"===e.type?(0,s.jsx)(v.default,{placeholder:e.placeholder,defaultValue:e.defaultValue,children:null===(l=e.options)||void 0===l?void 0:l.map(e=>(0,s.jsx)(v.default.Option,{value:e,children:e},e))}):"upload"===e.type?(0,s.jsx)(N.default,{...n,onChange:l=>{(null==t?void 0:t.onChange)&&t.onChange(l),setTimeout(()=>{let l=o.getFieldValue(e.key);console.log("".concat(e.key," value after upload:"),JSON.stringify(l))},500)},children:(0,s.jsx)(y.ZP,{icon:(0,s.jsx)(C.Z,{}),children:"Click to Upload"})}):(0,s.jsx)(b.o,{placeholder:e.placeholder,type:"password"===e.type?"password":"text",defaultValue:e.defaultValue})}),"vertex_credentials"===e.key&&(0,s.jsx)(w.Z,{children:(0,s.jsx)(k.Z,{children:(0,s.jsx)(b.x,{className:"mb-3 mt-1",children:"Give a gcp service account(.json file)"})})}),"base_model"===e.key&&(0,s.jsxs)(w.Z,{children:[(0,s.jsx)(k.Z,{span:10}),(0,s.jsx)(k.Z,{span:10,children:(0,s.jsxs)(b.x,{className:"mb-2",children:["The actual model your azure deployment uses. Used for accurate cost tracking. Select name from"," ",(0,s.jsx)(Z,{href:"https://github.com/BerriAI/litellm/blob/main/model_prices_and_context_window.json",target:"_blank",children:"here"})]})})]})]},e.key)})})},I=t(31283);let{Title:E,Link:P}=g.default;var M=e=>{let{isVisible:l,onCancel:t,onAddCredential:r,onUpdateCredential:o,uploadProps:i,addOrEdit:n,existingCredential:c}=e,[m]=f.Z.useForm(),[u,h]=(0,a.useState)(d.Cl.OpenAI),[x,p]=(0,a.useState)(!1);return(0,a.useEffect)(()=>{c&&(m.setFieldsValue({credential_name:c.credential_name,custom_llm_provider:c.credential_info.custom_llm_provider,api_base:c.credential_values.api_base,api_version:c.credential_values.api_version,base_model:c.credential_values.base_model,api_key:c.credential_values.api_key}),h(c.credential_info.custom_llm_provider))},[c]),(0,s.jsx)(j.Z,{title:"add"===n?"Add New Credential":"Edit Credential",visible:l,onCancel:()=>{t(),m.resetFields()},footer:null,width:600,children:(0,s.jsxs)(f.Z,{form:m,onFinish:e=>{let l=Object.entries(e).reduce((e,l)=>{let[t,s]=l;return""!==s&&null!=s&&(e[t]=s),e},{});"add"===n?r(l):o(l),m.resetFields()},layout:"vertical",children:[(0,s.jsx)(f.Z.Item,{label:"Credential Name:",name:"credential_name",rules:[{required:!0,message:"Credential name is required"}],initialValue:null==c?void 0:c.credential_name,children:(0,s.jsx)(I.o,{placeholder:"Enter a friendly name for these credentials",disabled:null!=c&&!!c.credential_name})}),(0,s.jsx)(f.Z.Item,{rules:[{required:!0,message:"Required"}],label:"Provider:",name:"custom_llm_provider",tooltip:"Helper to auto-populate provider specific fields",children:(0,s.jsx)(v.default,{showSearch:!0,onChange:e=>{h(e),m.setFieldValue("custom_llm_provider",e)},children:Object.entries(d.Cl).map(e=>{let[l,t]=e;return(0,s.jsx)(v.default.Option,{value:l,children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("img",{src:d.cd[t],alt:"".concat(l," logo"),className:"w-5 h-5",onError:e=>{let l=e.target,s=l.parentElement;if(s){let e=document.createElement("div");e.className="w-5 h-5 rounded-full bg-gray-200 flex items-center justify-center text-xs",e.textContent=t.charAt(0),s.replaceChild(e,l)}}}),(0,s.jsx)("span",{children:t})]})},l)})})}),(0,s.jsx)(A,{selectedProvider:u,uploadProps:i}),(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsx)(_.Z,{title:"Get help on our github",children:(0,s.jsx)(P,{href:"https://github.com/BerriAI/litellm/issues",children:"Need Help?"})}),(0,s.jsxs)("div",{children:[(0,s.jsx)(y.ZP,{onClick:()=>{t(),m.resetFields()},style:{marginRight:10},children:"Cancel"}),(0,s.jsx)(y.ZP,{htmlType:"submit",children:"add"===n?"Add Credential":"Update Credential"})]})]})]})})},F=t(16312),L=t(88532),T=e=>{let{isVisible:l,onCancel:t,onConfirm:r,credentialName:o}=e,[i,n]=(0,a.useState)(""),d=i===o,c=()=>{n(""),t()};return(0,s.jsx)(j.Z,{title:(0,s.jsxs)("div",{className:"flex items-center",children:[(0,s.jsx)(L.Z,{className:"h-6 w-6 text-red-600 mr-2"}),"Delete Credential"]}),open:l,footer:null,onCancel:c,closable:!0,destroyOnClose:!0,maskClosable:!1,children:(0,s.jsxs)("div",{className:"mt-4",children:[(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)(L.Z,{className:"h-5 w-5"})}),(0,s.jsx)("div",{children:(0,s.jsx)("p",{className:"text-base font-medium text-red-600",children:"This action cannot be undone and may break existing integrations."})})]}),(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.jsxs)("span",{className:"underline italic",children:["'",o,"'"]})," to confirm deletion:"]}),(0,s.jsx)("input",{type:"text",value:i,onChange:e=>n(e.target.value),placeholder:"Enter credential 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:"flex justify-end space-x-2",children:[(0,s.jsx)(F.z,{onClick:c,variant:"secondary",className:"mr-2",children:"Cancel"}),(0,s.jsx)(F.z,{onClick:()=>{d&&(n(""),r())},color:"red",className:"focus:ring-red-500",disabled:!d,children:"Delete Credential"})]})]})})},R=e=>{let{accessToken:l,uploadProps:t,credentialList:r,fetchCredentials:o}=e,[i,d]=(0,a.useState)(!1),[m,u]=(0,a.useState)(!1),[g,j]=(0,a.useState)(null),[v,_]=(0,a.useState)(null),[y]=f.Z.useForm(),b=["credential_name","custom_llm_provider"],N=async e=>{if(!l)return;let t=Object.entries(e).filter(e=>{let[l]=e;return!b.includes(l)}).reduce((e,l)=>{let[t,s]=l;return{...e,[t]:s}},{}),s={credential_name:e.credential_name,credential_values:t,credential_info:{custom_llm_provider:e.custom_llm_provider}};await (0,n.credentialUpdateCall)(l,e.credential_name,s),c.Z.success("Credential updated successfully"),u(!1),o(l)},w=async e=>{if(!l)return;let t=Object.entries(e).filter(e=>{let[l]=e;return!b.includes(l)}).reduce((e,l)=>{let[t,s]=l;return{...e,[t]:s}},{}),s={credential_name:e.credential_name,credential_values:t,credential_info:{custom_llm_provider:e.custom_llm_provider}};await (0,n.credentialCreateCall)(l,s),c.Z.success("Credential added successfully"),d(!1),o(l)};(0,a.useEffect)(()=>{l&&o(l)},[l]);let k=e=>{let l={openai:"blue",azure:"indigo",anthropic:"purple",default:"gray"},t=l[e.toLowerCase()]||l.default;return(0,s.jsx)(h.Ct,{color:t,size:"xs",children:e})},C=async e=>{l&&(await (0,n.credentialDeleteCall)(l,e),c.Z.success("Credential deleted successfully"),_(null),o(l))},Z=e=>{_(e)};return(0,s.jsxs)("div",{className:"w-full mx-auto flex-auto overflow-y-auto m-8 p-2",children:[(0,s.jsx)("div",{className:"flex justify-between items-center mb-4",children:(0,s.jsx)(h.xv,{children:"Configured credentials for different AI providers. Add and manage your API credentials."})}),(0,s.jsx)(h.Zb,{children:(0,s.jsxs)(h.iA,{children:[(0,s.jsx)(h.ss,{children:(0,s.jsxs)(h.SC,{children:[(0,s.jsx)(h.xs,{children:"Credential Name"}),(0,s.jsx)(h.xs,{children:"Provider"}),(0,s.jsx)(h.xs,{children:"Description"})]})}),(0,s.jsx)(h.RM,{children:r&&0!==r.length?r.map((e,l)=>{var t,a;return(0,s.jsxs)(h.SC,{children:[(0,s.jsx)(h.pj,{children:e.credential_name}),(0,s.jsx)(h.pj,{children:k((null===(t=e.credential_info)||void 0===t?void 0:t.custom_llm_provider)||"-")}),(0,s.jsx)(h.pj,{children:(null===(a=e.credential_info)||void 0===a?void 0:a.description)||"-"}),(0,s.jsxs)(h.pj,{children:[(0,s.jsx)(h.zx,{icon:x.Z,variant:"light",size:"sm",onClick:()=>{j(e),u(!0)}}),(0,s.jsx)(h.zx,{icon:p.Z,variant:"light",size:"sm",onClick:()=>Z(e.credential_name)})]})]},l)}):(0,s.jsx)(h.SC,{children:(0,s.jsx)(h.pj,{colSpan:4,className:"text-center py-4 text-gray-500",children:"No credentials configured"})})})]})}),(0,s.jsx)(h.zx,{onClick:()=>d(!0),className:"mt-4",children:"Add Credential"}),i&&(0,s.jsx)(M,{onAddCredential:w,isVisible:i,onCancel:()=>d(!1),uploadProps:t,addOrEdit:"add",onUpdateCredential:N,existingCredential:null}),m&&(0,s.jsx)(M,{onAddCredential:w,isVisible:m,existingCredential:g,onUpdateCredential:N,uploadProps:t,onCancel:()=>u(!1),addOrEdit:"edit"}),v&&(0,s.jsx)(T,{isVisible:!0,onCancel:()=>{_(null)},onConfirm:()=>C(v),credentialName:v})]})};let O=e=>{var l;return(null==e?void 0:null===(l=e.model_info)||void 0===l?void 0:l.team_public_model_name)?e.model_info.team_public_model_name:(null==e?void 0:e.model_name)||"-"};var V=t(9335),D=t(23628),q=t(33293),z=t(20831),B=t(12514),K=t(12485),U=t(18135),G=t(35242),H=t(29706),J=t(77991),W=t(49566),Y=t(96761),$=t(24199),Q=t(10900),X=t(45589),ee=t(64482),el=t(15424);let{Title:et,Link:es}=g.default;var ea=e=>{let{isVisible:l,onCancel:t,onAddCredential:a,existingCredential:r,setIsCredentialModalOpen:o}=e,[i]=f.Z.useForm();return console.log("existingCredential in add credentials tab: ".concat(JSON.stringify(r))),(0,s.jsx)(j.Z,{title:"Reuse Credentials",visible:l,onCancel:()=>{t(),i.resetFields()},footer:null,width:600,children:(0,s.jsxs)(f.Z,{form:i,onFinish:e=>{a(e),i.resetFields(),o(!1)},layout:"vertical",children:[(0,s.jsx)(f.Z.Item,{label:"Credential Name:",name:"credential_name",rules:[{required:!0,message:"Credential name is required"}],initialValue:null==r?void 0:r.credential_name,children:(0,s.jsx)(I.o,{placeholder:"Enter a friendly name for these credentials"})}),Object.entries((null==r?void 0:r.credential_values)||{}).map(e=>{let[l,t]=e;return(0,s.jsx)(f.Z.Item,{label:l,name:l,initialValue:t,children:(0,s.jsx)(I.o,{placeholder:"Enter ".concat(l),disabled:!0})},l)}),(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsx)(_.Z,{title:"Get help on our github",children:(0,s.jsx)(es,{href:"https://github.com/BerriAI/litellm/issues",children:"Need Help?"})}),(0,s.jsxs)("div",{children:[(0,s.jsx)(y.ZP,{onClick:()=>{t(),i.resetFields()},style:{marginRight:10},children:"Cancel"}),(0,s.jsx)(y.ZP,{htmlType:"submit",children:"Reuse Credentials"})]})]})]})})},er=t(63709),eo=t(45246),ei=t(96473);let{Text:en}=g.default;var ed=e=>{let{form:l,showCacheControl:t,onCacheControlChange:a}=e,r=e=>{let t=l.getFieldValue("litellm_extra_params");try{let s=t?JSON.parse(t):{};e.length>0?s.cache_control_injection_points=e:delete s.cache_control_injection_points,Object.keys(s).length>0?l.setFieldValue("litellm_extra_params",JSON.stringify(s,null,2)):l.setFieldValue("litellm_extra_params","")}catch(e){console.error("Error updating cache control points:",e)}};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(f.Z.Item,{label:"Cache Control Injection Points",name:"cache_control",valuePropName:"checked",className:"mb-4",tooltip:"Tell litellm where to inject cache control checkpoints. You can specify either by role (to apply to all messages of that role) or by specific message index.",children:(0,s.jsx)(er.Z,{onChange:a,className:"bg-gray-600"})}),t&&(0,s.jsxs)("div",{className:"ml-6 pl-4 border-l-2 border-gray-200",children:[(0,s.jsx)(en,{className:"text-sm text-gray-500 block mb-4",children:"Providers like Anthropic, Bedrock API require users to specify where to inject cache control checkpoints, litellm can automatically add them for you as a cost saving feature."}),(0,s.jsx)(f.Z.List,{name:"cache_control_injection_points",initialValue:[{location:"message"}],children:(e,t)=>{let{add:a,remove:o}=t;return(0,s.jsxs)(s.Fragment,{children:[e.map((t,a)=>(0,s.jsxs)("div",{className:"flex items-center mb-4 gap-4",children:[(0,s.jsx)(f.Z.Item,{...t,label:"Type",name:[t.name,"location"],initialValue:"message",className:"mb-0",style:{width:"180px"},children:(0,s.jsx)(v.default,{disabled:!0,options:[{value:"message",label:"Message"}]})}),(0,s.jsx)(f.Z.Item,{...t,label:"Role",name:[t.name,"role"],className:"mb-0",style:{width:"180px"},tooltip:"LiteLLM will mark all messages of this role as cacheable",children:(0,s.jsx)(v.default,{placeholder:"Select a role",allowClear:!0,options:[{value:"user",label:"User"},{value:"system",label:"System"},{value:"assistant",label:"Assistant"}],onChange:()=>{r(l.getFieldValue("cache_control_points"))}})}),(0,s.jsx)(f.Z.Item,{...t,label:"Index",name:[t.name,"index"],className:"mb-0",style:{width:"180px"},tooltip:"(Optional) If set litellm will mark the message at this index as cacheable",children:(0,s.jsx)($.Z,{type:"number",placeholder:"Optional",step:1,min:0,onChange:()=>{r(l.getFieldValue("cache_control_points"))}})}),e.length>1&&(0,s.jsx)(eo.Z,{className:"text-red-500 cursor-pointer text-lg ml-12",onClick:()=>{o(t.name),setTimeout(()=>{r(l.getFieldValue("cache_control_points"))},0)}})]},t.key)),(0,s.jsx)(f.Z.Item,{children:(0,s.jsxs)("button",{type:"button",className:"flex items-center justify-center w-full border border-dashed border-gray-300 py-2 px-4 text-gray-600 hover:text-blue-600 hover:border-blue-300 transition-all rounded",onClick:()=>a(),children:[(0,s.jsx)(ei.Z,{className:"mr-2"}),"Add Injection Point"]})})]})}})]})]})},ec=t(30401),em=t(78867),eu=t(59872),eh=t(51601),ex=t(44851),ep=t(67960),eg=t(20577),ef=t(70464),ej=t(26349),ev=t(92280);let{TextArea:e_}=ee.default,{Panel:ey}=ex.default;var eb=e=>{let{modelInfo:l,value:t,onChange:r}=e,[o,i]=(0,a.useState)([]),[n,d]=(0,a.useState)(!1),[c,m]=(0,a.useState)([]);(0,a.useEffect)(()=>{if(null==t?void 0:t.routes){let e=t.routes.map((e,l)=>({id:e.id||"route-".concat(l,"-").concat(Date.now()),model:e.name||e.model||"",utterances:e.utterances||[],description:e.description||"",score_threshold:e.score_threshold||.5}));i(e),m(e.map(e=>e.id))}else i([]),m([])},[t]);let u=e=>{let l=o.filter(l=>l.id!==e);i(l),x(l),m(l=>l.filter(l=>l!==e))},h=(e,l,t)=>{let s=o.map(s=>s.id===e?{...s,[l]:t}:s);i(s),x(s)},x=e=>{let l={routes:e.map(e=>({name:e.model,utterances:e.utterances,description:e.description,score_threshold:e.score_threshold}))};null==r||r(l)},p=l.map(e=>({value:e.model_group,label:e.model_group}));return(0,s.jsxs)("div",{className:"w-full max-w-none",children:[(0,s.jsxs)("div",{className:"flex justify-between items-center mb-6 w-full",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(ev.x,{className:"text-lg font-semibold",children:"Routes Configuration"}),(0,s.jsx)(_.Z,{title:"Configure routing logic to automatically select the best model based on user input patterns",children:(0,s.jsx)(el.Z,{className:"text-gray-400"})})]}),(0,s.jsx)(y.ZP,{type:"primary",icon:(0,s.jsx)(ei.Z,{}),onClick:()=>{let e="route-".concat(Date.now()),l=[...o,{id:e,model:"",utterances:[],description:"",score_threshold:.5}];i(l),x(l),m(l=>[...l,e])},className:"bg-blue-600 hover:bg-blue-700",children:"Add Route"})]}),0===o.length?(0,s.jsx)("div",{className:"text-center py-12 text-gray-500 bg-gray-50 rounded-lg border-2 border-dashed border-gray-200 mb-6",children:(0,s.jsx)(ev.x,{children:"No routes configured. Click “Add Route” to get started."})}):(0,s.jsx)("div",{className:"space-y-3 mb-6 w-full",children:o.map((e,l)=>(0,s.jsx)(ep.Z,{className:"border border-gray-200 shadow-sm w-full",bodyStyle:{padding:0},children:(0,s.jsx)(ex.default,{ghost:!0,expandIcon:e=>{let{isActive:l}=e;return(0,s.jsx)(ef.Z,{rotate:l?180:0})},activeKey:c,onChange:e=>m(Array.isArray(e)?e:[e].filter(Boolean)),items:[{key:e.id,label:(0,s.jsxs)("div",{className:"flex justify-between items-center py-2",children:[(0,s.jsxs)(ev.x,{className:"font-medium text-base",children:["Route ",l+1,": ",e.model||"Unnamed"]}),(0,s.jsx)(y.ZP,{type:"text",danger:!0,icon:(0,s.jsx)(ej.Z,{}),onClick:l=>{l.stopPropagation(),u(e.id)},className:"mr-2"})]}),children:(0,s.jsxs)("div",{className:"px-6 pb-6 w-full",children:[(0,s.jsxs)("div",{className:"mb-4 w-full",children:[(0,s.jsx)(ev.x,{className:"text-sm font-medium mb-2 block",children:"Model"}),(0,s.jsx)(v.default,{value:e.model,onChange:l=>h(e.id,"model",l),placeholder:"Select model",showSearch:!0,style:{width:"100%"},options:p})]}),(0,s.jsxs)("div",{className:"mb-4 w-full",children:[(0,s.jsx)(ev.x,{className:"text-sm font-medium mb-2 block",children:"Description"}),(0,s.jsx)(e_,{value:e.description,onChange:l=>h(e.id,"description",l.target.value),placeholder:"Describe when this route should be used...",rows:2,style:{width:"100%"}})]}),(0,s.jsxs)("div",{className:"mb-4 w-full",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,s.jsx)(ev.x,{className:"text-sm font-medium",children:"Score Threshold"}),(0,s.jsx)(_.Z,{title:"Minimum similarity score to route to this model (0-1)",children:(0,s.jsx)(el.Z,{className:"text-gray-400"})})]}),(0,s.jsx)(eg.Z,{value:e.score_threshold,onChange:l=>h(e.id,"score_threshold",l||0),min:0,max:1,step:.1,style:{width:"100%"},placeholder:"0.5"})]}),(0,s.jsxs)("div",{className:"w-full",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,s.jsx)(ev.x,{className:"text-sm font-medium",children:"Example Utterances"}),(0,s.jsx)(_.Z,{title:"Training examples for this route. Type an utterance and press Enter to add it.",children:(0,s.jsx)(el.Z,{className:"text-gray-400"})})]}),(0,s.jsx)(ev.x,{className:"text-xs text-gray-500 mb-2",children:"Type an utterance and press Enter to add it. You can also paste multiple lines."}),(0,s.jsx)(v.default,{mode:"tags",value:e.utterances,onChange:l=>h(e.id,"utterances",l),placeholder:"Type an utterance and press Enter...",style:{width:"100%"},tokenSeparators:["\n"],maxTagCount:"responsive",allowClear:!0})]})]})}]})},e.id))}),(0,s.jsxs)("div",{className:"border-t pt-6 w-full",children:[(0,s.jsxs)("div",{className:"flex justify-between items-center mb-4 w-full",children:[(0,s.jsx)(ev.x,{className:"text-lg font-semibold",children:"JSON Preview"}),(0,s.jsx)(y.ZP,{type:"link",onClick:()=>d(!n),className:"text-blue-600 p-0",children:n?"Hide":"Show"})]}),n&&(0,s.jsx)(ep.Z,{className:"bg-gray-50 w-full",children:(0,s.jsx)("pre",{className:"text-sm overflow-auto max-h-64 w-full",children:JSON.stringify({routes:o.map(e=>({name:e.model,utterances:e.utterances,description:e.description,score_threshold:e.score_threshold}))},null,2)})})]})]})},eN=e=>{let{isVisible:l,onCancel:t,onSuccess:r,modelData:o,accessToken:i,userRole:d}=e,[m]=f.Z.useForm(),[u,h]=(0,a.useState)(!1),[x,p]=(0,a.useState)([]),[g,_]=(0,a.useState)([]),[N,w]=(0,a.useState)(!1),[k,C]=(0,a.useState)(!1),[Z,S]=(0,a.useState)(null);(0,a.useEffect)(()=>{l&&o&&A()},[l,o]),(0,a.useEffect)(()=>{let e=async()=>{if(i)try{let e=await (0,n.modelAvailableCall)(i,"","",!1,null,!0,!0);p(e.data.map(e=>e.id))}catch(e){console.error("Error fetching model access groups:",e)}},t=async()=>{if(i)try{let e=await (0,eh.p)(i);_(e)}catch(e){console.error("Error fetching model info:",e)}};l&&(e(),t())},[l,i]);let A=()=>{try{var e,l,t,s,a,r;let i=null;(null===(e=o.litellm_params)||void 0===e?void 0:e.auto_router_config)&&(i="string"==typeof o.litellm_params.auto_router_config?JSON.parse(o.litellm_params.auto_router_config):o.litellm_params.auto_router_config),S(i),m.setFieldsValue({auto_router_name:o.model_name,auto_router_default_model:(null===(l=o.litellm_params)||void 0===l?void 0:l.auto_router_default_model)||"",auto_router_embedding_model:(null===(t=o.litellm_params)||void 0===t?void 0:t.auto_router_embedding_model)||"",model_access_group:(null===(s=o.model_info)||void 0===s?void 0:s.access_groups)||[]});let n=new Set(g.map(e=>e.model_group));w(!n.has(null===(a=o.litellm_params)||void 0===a?void 0:a.auto_router_default_model)),C(!n.has(null===(r=o.litellm_params)||void 0===r?void 0:r.auto_router_embedding_model))}catch(e){console.error("Error parsing auto router config:",e),c.Z.fromBackend("Error loading auto router configuration")}},I=async()=>{try{h(!0);let e=await m.validateFields(),l={...o.litellm_params,auto_router_config:JSON.stringify(Z),auto_router_default_model:e.auto_router_default_model,auto_router_embedding_model:e.auto_router_embedding_model||void 0},s={...o.model_info,access_groups:e.model_access_group||[]},a={model_name:e.auto_router_name,litellm_params:l,model_info:s};await (0,n.modelPatchUpdateCall)(i,a,o.model_info.id);let d={...o,model_name:e.auto_router_name,litellm_params:l,model_info:s};c.Z.success("Auto router configuration updated successfully"),r(d),t()}catch(e){console.error("Error updating auto router:",e),c.Z.fromBackend("Failed to update auto router configuration")}finally{h(!1)}},E=g.map(e=>({value:e.model_group,label:e.model_group}));return(0,s.jsx)(j.Z,{title:"Edit Auto Router Configuration",open:l,onCancel:t,footer:[(0,s.jsx)(y.ZP,{onClick:t,children:"Cancel"},"cancel"),(0,s.jsx)(y.ZP,{loading:u,onClick:I,children:"Save Changes"},"submit")],width:1e3,destroyOnClose:!0,children:(0,s.jsxs)("div",{className:"space-y-6",children:[(0,s.jsx)(b.x,{className:"text-gray-600",children:"Edit the auto router configuration including routing logic, default models, and access settings."}),(0,s.jsxs)(f.Z,{form:m,layout:"vertical",className:"space-y-4",children:[(0,s.jsx)(f.Z.Item,{label:"Auto Router Name",name:"auto_router_name",rules:[{required:!0,message:"Auto router name is required"}],children:(0,s.jsx)(b.o,{placeholder:"e.g., auto_router_1, smart_routing"})}),(0,s.jsx)("div",{className:"w-full",children:(0,s.jsx)(eb,{modelInfo:g,value:Z,onChange:e=>{S(e)}})}),(0,s.jsx)(f.Z.Item,{label:"Default Model",name:"auto_router_default_model",rules:[{required:!0,message:"Default model is required"}],children:(0,s.jsx)(v.default,{placeholder:"Select a default model",onChange:e=>{w("custom"===e)},options:[...E,{value:"custom",label:"Enter custom model name"}],showSearch:!0})}),(0,s.jsx)(f.Z.Item,{label:"Embedding Model",name:"auto_router_embedding_model",children:(0,s.jsx)(v.default,{placeholder:"Select an embedding model (optional)",onChange:e=>{C("custom"===e)},options:[...E,{value:"custom",label:"Enter custom model name"}],showSearch:!0,allowClear:!0})}),"Admin"===d&&(0,s.jsx)(f.Z.Item,{label:"Model Access Groups",name:"model_access_group",tooltip:"Control who can access this auto router",children:(0,s.jsx)(v.default,{mode:"tags",showSearch:!0,placeholder:"Select existing groups or type to create new ones",optionFilterProp:"children",tokenSeparators:[","],options:x.map(e=>({value:e,label:e})),maxTagCount:"responsive",allowClear:!0})})]})]})})};function ew(e){var l,t,r,m,u,h,x,g,b,N,w,k,C,Z,S,A,I,E,P,M,F,L,T,R,V,D,q,et,es;let{modelId:er,onClose:eo,modelData:ei,accessToken:en,userID:eh,userRole:ex,editModel:ep,setEditModalVisible:eg,setSelectedModel:ef,onModelUpdate:ej,modelAccessGroups:ev}=e,[e_]=f.Z.useForm(),[ey,eb]=(0,a.useState)(null),[ew,ek]=(0,a.useState)(!1),[eC,eZ]=(0,a.useState)(!1),[eS,eA]=(0,a.useState)(!1),[eI,eE]=(0,a.useState)(!1),[eP,eM]=(0,a.useState)(!1),[eF,eL]=(0,a.useState)(null),[eT,eR]=(0,a.useState)(!1),[eO,eV]=(0,a.useState)({}),[eD,eq]=(0,a.useState)(!1),[ez,eB]=(0,a.useState)([]),eK=("Admin"===ex||(null==ei?void 0:null===(l=ei.model_info)||void 0===l?void 0:l.created_by)===eh)&&(null==ei?void 0:null===(t=ei.model_info)||void 0===t?void 0:t.db_model),eU=(null==ei?void 0:null===(r=ei.litellm_params)||void 0===r?void 0:r.auto_router_config)!=null,eG=(null==ei?void 0:null===(m=ei.litellm_params)||void 0===m?void 0:m.litellm_credential_name)!=null&&(null==ei?void 0:null===(u=ei.litellm_params)||void 0===u?void 0:u.litellm_credential_name)!=void 0;console.log("usingExistingCredential, ",eG),console.log("modelData.litellm_params.litellm_credential_name, ",null==ei?void 0:null===(h=ei.litellm_params)||void 0===h?void 0:h.litellm_credential_name),(0,a.useEffect)(()=>{let e=async()=>{var e,l,t,s,a,r,o;if(!en)return;let i=await (0,n.modelInfoV1Call)(en,er);console.log("modelInfoResponse, ",i);let d=i.data[0];d&&!d.litellm_model_name&&(d={...d,litellm_model_name:null!==(o=null!==(r=null!==(a=null==d?void 0:null===(l=d.litellm_params)||void 0===l?void 0:l.litellm_model_name)&&void 0!==a?a:null==d?void 0:null===(t=d.litellm_params)||void 0===t?void 0:t.model)&&void 0!==r?r:null==d?void 0:null===(s=d.model_info)||void 0===s?void 0:s.key)&&void 0!==o?o:null}),eb(d),(null==d?void 0:null===(e=d.litellm_params)||void 0===e?void 0:e.cache_control_injection_points)&&eR(!0)},l=async()=>{if(en)try{let e=(await (0,n.getGuardrailsList)(en)).guardrails.map(e=>e.guardrail_name);eB(e)}catch(e){console.error("Failed to fetch guardrails:",e)}};(async()=>{if(console.log("accessToken, ",en),!en||eG)return;let e=await (0,n.credentialGetCall)(en,null,er);console.log("existingCredentialResponse, ",e),eL({credential_name:e.credential_name,credential_values:e.credential_values,credential_info:e.credential_info})})(),e(),l()},[en,er]);let eH=async e=>{var l;if(console.log("values, ",e),!en)return;let t={credential_name:e.credential_name,model_id:er,credential_info:{custom_llm_provider:null===(l=ey.litellm_params)||void 0===l?void 0:l.custom_llm_provider}};c.Z.info("Storing credential.."),console.log("credentialResponse, ",await (0,n.credentialCreateCall)(en,t)),c.Z.success("Credential stored successfully")},eJ=async e=>{try{var l;let t;if(!en)return;eE(!0),console.log("values.model_name, ",e.model_name);let s={...ey.litellm_params,model:e.litellm_model_name,api_base:e.api_base,custom_llm_provider:e.custom_llm_provider,organization:e.organization,tpm:e.tpm,rpm:e.rpm,max_retries:e.max_retries,timeout:e.timeout,stream_timeout:e.stream_timeout,input_cost_per_token:e.input_cost/1e6,output_cost_per_token:e.output_cost/1e6};e.guardrails&&(s.guardrails=e.guardrails),e.cache_control&&(null===(l=e.cache_control_injection_points)||void 0===l?void 0:l.length)>0?s.cache_control_injection_points=e.cache_control_injection_points:delete s.cache_control_injection_points;try{t=e.model_info?JSON.parse(e.model_info):ei.model_info,e.model_access_group&&(t={...t,access_groups:e.model_access_group})}catch(e){c.Z.fromBackend("Invalid JSON in Model Info");return}let a={model_name:e.model_name,litellm_params:s,model_info:t};await (0,n.modelPatchUpdateCall)(en,a,er);let r={...ey,model_name:e.model_name,litellm_model_name:e.litellm_model_name,litellm_params:s,model_info:t};eb(r),ej&&ej(r),c.Z.success("Model settings updated successfully"),eA(!1),eM(!1)}catch(e){console.error("Error updating model:",e),c.Z.fromBackend("Failed to update model settings")}finally{eE(!1)}};if(!ei)return(0,s.jsxs)("div",{className:"p-4",children:[(0,s.jsx)(z.Z,{icon:Q.Z,variant:"light",onClick:eo,className:"mb-4",children:"Back to Models"}),(0,s.jsx)(i.Z,{children:"Model not found"})]});let eW=async()=>{try{if(!en)return;await (0,n.modelDeleteCall)(en,er),c.Z.success("Model deleted successfully"),ej&&ej({deleted:!0,model_info:{id:er}}),eo()}catch(e){console.error("Error deleting the model:",e),c.Z.fromBackend("Failed to delete model")}},eY=async(e,l)=>{await (0,eu.vQ)(e)&&(eV(e=>({...e,[l]:!0})),setTimeout(()=>{eV(e=>({...e,[l]:!1}))},2e3))};return(0,s.jsxs)("div",{className:"p-4",children:[(0,s.jsxs)("div",{className:"flex justify-between items-center mb-6",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(z.Z,{icon:Q.Z,variant:"light",onClick:eo,className:"mb-4",children:"Back to Models"}),(0,s.jsxs)(Y.Z,{children:["Public Model Name: ",O(ei)]}),(0,s.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,s.jsx)(i.Z,{className:"text-gray-500 font-mono",children:ei.model_info.id}),(0,s.jsx)(y.ZP,{type:"text",size:"small",icon:eO["model-id"]?(0,s.jsx)(ec.Z,{size:12}):(0,s.jsx)(em.Z,{size:12}),onClick:()=>eY(ei.model_info.id,"model-id"),className:"left-2 z-10 transition-all duration-200 ".concat(eO["model-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]})]}),(0,s.jsxs)("div",{className:"flex gap-2",children:["Admin"===ex&&(0,s.jsx)(z.Z,{icon:X.Z,variant:"secondary",onClick:()=>eZ(!0),className:"flex items-center",children:"Re-use Credentials"}),eK&&(0,s.jsx)(z.Z,{icon:p.Z,variant:"secondary",onClick:()=>ek(!0),className:"flex items-center",children:"Delete Model"})]})]}),(0,s.jsxs)(U.Z,{children:[(0,s.jsxs)(G.Z,{className:"mb-6",children:[(0,s.jsx)(K.Z,{children:"Overview"}),(0,s.jsx)(K.Z,{children:"Raw JSON"})]}),(0,s.jsxs)(J.Z,{children:[(0,s.jsxs)(H.Z,{children:[(0,s.jsxs)(o.Z,{numItems:1,numItemsSm:2,numItemsLg:3,className:"gap-6 mb-6",children:[(0,s.jsxs)(B.Z,{children:[(0,s.jsx)(i.Z,{children:"Provider"}),(0,s.jsxs)("div",{className:"mt-2 flex items-center space-x-2",children:[ei.provider&&(0,s.jsx)("img",{src:(0,d.dr)(ei.provider).logo,alt:"".concat(ei.provider," logo"),className:"w-4 h-4",onError:e=>{let l=e.target,t=l.parentElement;if(t){var s;let e=document.createElement("div");e.className="w-4 h-4 rounded-full bg-gray-200 flex items-center justify-center text-xs",e.textContent=(null===(s=ei.provider)||void 0===s?void 0:s.charAt(0))||"-",t.replaceChild(e,l)}}}),(0,s.jsx)(Y.Z,{children:ei.provider||"Not Set"})]})]}),(0,s.jsxs)(B.Z,{children:[(0,s.jsx)(i.Z,{children:"LiteLLM Model"}),(0,s.jsx)("div",{className:"mt-2 overflow-hidden",children:(0,s.jsx)(_.Z,{title:ei.litellm_model_name||"Not Set",children:(0,s.jsx)("div",{className:"break-all text-sm font-medium leading-relaxed cursor-pointer",children:ei.litellm_model_name||"Not Set"})})})]}),(0,s.jsxs)(B.Z,{children:[(0,s.jsx)(i.Z,{children:"Pricing"}),(0,s.jsxs)("div",{className:"mt-2",children:[(0,s.jsxs)(i.Z,{children:["Input: $",ei.input_cost,"/1M tokens"]}),(0,s.jsxs)(i.Z,{children:["Output: $",ei.output_cost,"/1M tokens"]})]})]})]}),(0,s.jsxs)("div",{className:"mb-6 text-sm text-gray-500 flex items-center gap-x-6",children:[(0,s.jsxs)("div",{className:"flex items-center gap-x-2",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:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})}),"Created At"," ",ei.model_info.created_at?new Date(ei.model_info.created_at).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):"Not Set"]}),(0,s.jsxs)("div",{className:"flex items-center gap-x-2",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:"M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"})}),"Created By ",ei.model_info.created_by||"Not Set"]})]}),(0,s.jsxs)(B.Z,{children:[(0,s.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,s.jsx)(Y.Z,{children:"Model Settings"}),(0,s.jsxs)("div",{className:"flex gap-2",children:[eU&&eK&&!eP&&(0,s.jsx)(z.Z,{variant:"primary",onClick:()=>eq(!0),className:"flex items-center",children:"Edit Auto Router"}),eK?!eP&&(0,s.jsx)(z.Z,{variant:"secondary",onClick:()=>eM(!0),className:"flex items-center",children:"Edit Model"}):(0,s.jsx)(_.Z,{title:"Only DB models can be edited. You must be an admin or the creator of the model to edit it.",children:(0,s.jsx)(el.Z,{})})]})]}),ey?(0,s.jsx)(f.Z,{form:e_,onFinish:eJ,initialValues:{model_name:ey.model_name,litellm_model_name:ey.litellm_model_name,api_base:ey.litellm_params.api_base,custom_llm_provider:ey.litellm_params.custom_llm_provider,organization:ey.litellm_params.organization,tpm:ey.litellm_params.tpm,rpm:ey.litellm_params.rpm,max_retries:ey.litellm_params.max_retries,timeout:ey.litellm_params.timeout,stream_timeout:ey.litellm_params.stream_timeout,input_cost:ey.litellm_params.input_cost_per_token?1e6*ey.litellm_params.input_cost_per_token:(null===(x=ey.model_info)||void 0===x?void 0:x.input_cost_per_token)*1e6||null,output_cost:(null===(g=ey.litellm_params)||void 0===g?void 0:g.output_cost_per_token)?1e6*ey.litellm_params.output_cost_per_token:(null===(b=ey.model_info)||void 0===b?void 0:b.output_cost_per_token)*1e6||null,cache_control:null!==(N=ey.litellm_params)&&void 0!==N&&!!N.cache_control_injection_points,cache_control_injection_points:(null===(w=ey.litellm_params)||void 0===w?void 0:w.cache_control_injection_points)||[],model_access_group:Array.isArray(null===(k=ey.model_info)||void 0===k?void 0:k.access_groups)?ey.model_info.access_groups:[],guardrails:Array.isArray(null===(C=ey.litellm_params)||void 0===C?void 0:C.guardrails)?ey.litellm_params.guardrails:[]},layout:"vertical",onValuesChange:()=>eA(!0),children:(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(i.Z,{className:"font-medium",children:"Model Name"}),eP?(0,s.jsx)(f.Z.Item,{name:"model_name",className:"mb-0",children:(0,s.jsx)(W.Z,{placeholder:"Enter model name"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:ey.model_name})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(i.Z,{className:"font-medium",children:"LiteLLM Model Name"}),eP?(0,s.jsx)(f.Z.Item,{name:"litellm_model_name",className:"mb-0",children:(0,s.jsx)(W.Z,{placeholder:"Enter LiteLLM model name"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:ey.litellm_model_name})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(i.Z,{className:"font-medium",children:"Input Cost (per 1M tokens)"}),eP?(0,s.jsx)(f.Z.Item,{name:"input_cost",className:"mb-0",children:(0,s.jsx)($.Z,{placeholder:"Enter input cost"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null==ey?void 0:null===(Z=ey.litellm_params)||void 0===Z?void 0:Z.input_cost_per_token)?((null===(S=ey.litellm_params)||void 0===S?void 0:S.input_cost_per_token)*1e6).toFixed(4):(null==ey?void 0:null===(A=ey.model_info)||void 0===A?void 0:A.input_cost_per_token)?(1e6*ey.model_info.input_cost_per_token).toFixed(4):null})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(i.Z,{className:"font-medium",children:"Output Cost (per 1M tokens)"}),eP?(0,s.jsx)(f.Z.Item,{name:"output_cost",className:"mb-0",children:(0,s.jsx)($.Z,{placeholder:"Enter output cost"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null==ey?void 0:null===(I=ey.litellm_params)||void 0===I?void 0:I.output_cost_per_token)?(1e6*ey.litellm_params.output_cost_per_token).toFixed(4):(null==ey?void 0:null===(E=ey.model_info)||void 0===E?void 0:E.output_cost_per_token)?(1e6*ey.model_info.output_cost_per_token).toFixed(4):null})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(i.Z,{className:"font-medium",children:"API Base"}),eP?(0,s.jsx)(f.Z.Item,{name:"api_base",className:"mb-0",children:(0,s.jsx)(W.Z,{placeholder:"Enter API base"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(P=ey.litellm_params)||void 0===P?void 0:P.api_base)||"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(i.Z,{className:"font-medium",children:"Custom LLM Provider"}),eP?(0,s.jsx)(f.Z.Item,{name:"custom_llm_provider",className:"mb-0",children:(0,s.jsx)(W.Z,{placeholder:"Enter custom LLM provider"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(M=ey.litellm_params)||void 0===M?void 0:M.custom_llm_provider)||"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(i.Z,{className:"font-medium",children:"Organization"}),eP?(0,s.jsx)(f.Z.Item,{name:"organization",className:"mb-0",children:(0,s.jsx)(W.Z,{placeholder:"Enter organization"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(F=ey.litellm_params)||void 0===F?void 0:F.organization)||"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(i.Z,{className:"font-medium",children:"TPM (Tokens per Minute)"}),eP?(0,s.jsx)(f.Z.Item,{name:"tpm",className:"mb-0",children:(0,s.jsx)($.Z,{placeholder:"Enter TPM"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(L=ey.litellm_params)||void 0===L?void 0:L.tpm)||"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(i.Z,{className:"font-medium",children:"RPM (Requests per Minute)"}),eP?(0,s.jsx)(f.Z.Item,{name:"rpm",className:"mb-0",children:(0,s.jsx)($.Z,{placeholder:"Enter RPM"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(T=ey.litellm_params)||void 0===T?void 0:T.rpm)||"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(i.Z,{className:"font-medium",children:"Max Retries"}),eP?(0,s.jsx)(f.Z.Item,{name:"max_retries",className:"mb-0",children:(0,s.jsx)($.Z,{placeholder:"Enter max retries"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(R=ey.litellm_params)||void 0===R?void 0:R.max_retries)||"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(i.Z,{className:"font-medium",children:"Timeout (seconds)"}),eP?(0,s.jsx)(f.Z.Item,{name:"timeout",className:"mb-0",children:(0,s.jsx)($.Z,{placeholder:"Enter timeout"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(V=ey.litellm_params)||void 0===V?void 0:V.timeout)||"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(i.Z,{className:"font-medium",children:"Stream Timeout (seconds)"}),eP?(0,s.jsx)(f.Z.Item,{name:"stream_timeout",className:"mb-0",children:(0,s.jsx)($.Z,{placeholder:"Enter stream timeout"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(D=ey.litellm_params)||void 0===D?void 0:D.stream_timeout)||"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(i.Z,{className:"font-medium",children:"Model Access Groups"}),eP?(0,s.jsx)(f.Z.Item,{name:"model_access_group",className:"mb-0",children:(0,s.jsx)(v.default,{mode:"tags",showSearch:!0,placeholder:"Select existing groups or type to create new ones",optionFilterProp:"children",tokenSeparators:[","],maxTagCount:"responsive",allowClear:!0,style:{width:"100%"},options:null==ev?void 0:ev.map(e=>({value:e,label:e}))})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(q=ey.model_info)||void 0===q?void 0:q.access_groups)?Array.isArray(ey.model_info.access_groups)?ey.model_info.access_groups.length>0?(0,s.jsx)("div",{className:"flex flex-wrap gap-1",children:ey.model_info.access_groups.map((e,l)=>(0,s.jsx)("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-blue-100 text-blue-800",children:e},l))}):"No groups assigned":ey.model_info.access_groups:"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsxs)(i.Z,{className:"font-medium",children:["Guardrails"," ",(0,s.jsx)(_.Z,{title:"Apply safety guardrails to this model to filter content or enforce policies",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)(el.Z,{style:{marginLeft:"4px"}})})})]}),eP?(0,s.jsx)(f.Z.Item,{name:"guardrails",className:"mb-0",children:(0,s.jsx)(v.default,{mode:"tags",showSearch:!0,placeholder:"Select existing guardrails or type to create new ones",optionFilterProp:"children",tokenSeparators:[","],maxTagCount:"responsive",allowClear:!0,style:{width:"100%"},options:ez.map(e=>({value:e,label:e}))})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(et=ey.litellm_params)||void 0===et?void 0:et.guardrails)?Array.isArray(ey.litellm_params.guardrails)?ey.litellm_params.guardrails.length>0?(0,s.jsx)("div",{className:"flex flex-wrap gap-1",children:ey.litellm_params.guardrails.map((e,l)=>(0,s.jsx)("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-green-100 text-green-800",children:e},l))}):"No guardrails assigned":ey.litellm_params.guardrails:"Not Set"})]}),eP?(0,s.jsx)(ed,{form:e_,showCacheControl:eT,onCacheControlChange:e=>eR(e)}):(0,s.jsxs)("div",{children:[(0,s.jsx)(i.Z,{className:"font-medium",children:"Cache Control"}),(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(es=ey.litellm_params)||void 0===es?void 0:es.cache_control_injection_points)?(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{children:"Enabled"}),(0,s.jsx)("div",{className:"mt-2",children:ey.litellm_params.cache_control_injection_points.map((e,l)=>(0,s.jsxs)("div",{className:"text-sm text-gray-600 mb-1",children:["Location: ",e.location,",",e.role&&(0,s.jsxs)("span",{children:[" Role: ",e.role]}),void 0!==e.index&&(0,s.jsxs)("span",{children:[" Index: ",e.index]})]},l))})]}):"Disabled"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(i.Z,{className:"font-medium",children:"Model Info"}),eP?(0,s.jsx)(f.Z.Item,{name:"model_info",className:"mb-0",children:(0,s.jsx)(ee.default.TextArea,{rows:4,placeholder:'{"gpt-4": 100, "claude-v1": 200}',defaultValue:JSON.stringify(ei.model_info,null,2)})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(0,s.jsx)("pre",{className:"bg-gray-100 p-2 rounded text-xs overflow-auto mt-1",children:JSON.stringify(ey.model_info,null,2)})})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(i.Z,{className:"font-medium",children:"Team ID"}),(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:ei.model_info.team_id||"Not Set"})]})]}),eP&&(0,s.jsxs)("div",{className:"mt-6 flex justify-end gap-2",children:[(0,s.jsx)(z.Z,{variant:"secondary",onClick:()=>{e_.resetFields(),eA(!1),eM(!1)},children:"Cancel"}),(0,s.jsx)(z.Z,{variant:"primary",onClick:()=>e_.submit(),loading:eI,children:"Save Changes"})]})]})}):(0,s.jsx)(i.Z,{children:"Loading..."})]})]}),(0,s.jsx)(H.Z,{children:(0,s.jsx)(B.Z,{children:(0,s.jsx)("pre",{className:"bg-gray-100 p-4 rounded text-xs overflow-auto",children:JSON.stringify(ei,null,2)})})})]})]}),ew&&(0,s.jsx)("div",{className:"fixed z-10 inset-0 overflow-y-auto",children:(0,s.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,s.jsx)("div",{className:"fixed inset-0 transition-opacity","aria-hidden":"true",children:(0,s.jsx)("div",{className:"absolute inset-0 bg-gray-500 opacity-75"})}),(0,s.jsx)("span",{className:"hidden sm:inline-block sm:align-middle sm:h-screen","aria-hidden":"true",children:""}),(0,s.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,s.jsx)("div",{className:"bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4",children:(0,s.jsx)("div",{className:"sm:flex sm:items-start",children:(0,s.jsxs)("div",{className:"mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left",children:[(0,s.jsx)("h3",{className:"text-lg leading-6 font-medium text-gray-900",children:"Delete Model"}),(0,s.jsx)("div",{className:"mt-2",children:(0,s.jsx)("p",{className:"text-sm text-gray-500",children:"Are you sure you want to delete this model?"})})]})})}),(0,s.jsxs)("div",{className:"bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse",children:[(0,s.jsx)(y.ZP,{onClick:eW,className:"ml-2",danger:!0,children:"Delete"}),(0,s.jsx)(y.ZP,{onClick:()=>ek(!1),children:"Cancel"})]})]})]})}),eC&&!eG?(0,s.jsx)(ea,{isVisible:eC,onCancel:()=>eZ(!1),onAddCredential:eH,existingCredential:eF,setIsCredentialModalOpen:eZ}):(0,s.jsx)(j.Z,{open:eC,onCancel:()=>eZ(!1),title:"Using Existing Credential",children:(0,s.jsx)(i.Z,{children:ei.litellm_params.litellm_credential_name})}),(0,s.jsx)(eN,{isVisible:eD,onCancel:()=>eq(!1),onSuccess:e=>{eb(e),ej&&ej(e)},modelData:ey||ei,accessToken:en||"",userRole:ex||""})]})}var ek=t(58643),eC=e=>{let{selectedProvider:l,providerModels:t,getPlaceholder:a}=e,r=f.Z.useFormInstance(),o=e=>{let t=e.target.value,s=(r.getFieldValue("model_mappings")||[]).map(e=>"custom"===e.public_name||"custom"===e.litellm_model?l===d.Cl.Azure?{public_name:t,litellm_model:"azure/".concat(t)}:{public_name:t,litellm_model:t}:e);r.setFieldsValue({model_mappings:s})};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(f.Z.Item,{label:"LiteLLM Model Name(s)",tooltip:"The model name LiteLLM will send to the LLM API",className:"mb-0",children:[(0,s.jsx)(f.Z.Item,{name:"model",rules:[{required:!0,message:"Please enter ".concat(l===d.Cl.Azure?"a deployment name":"at least one model",".")}],noStyle:!0,children:l===d.Cl.Azure||l===d.Cl.OpenAI_Compatible||l===d.Cl.Ollama?(0,s.jsx)(s.Fragment,{children:(0,s.jsx)(b.o,{placeholder:a(l),onChange:l===d.Cl.Azure?e=>{let l=e.target.value,t=l?[{public_name:l,litellm_model:"azure/".concat(l)}]:[];r.setFieldsValue({model:l,model_mappings:t})}:void 0})}):t.length>0?(0,s.jsx)(v.default,{mode:"multiple",allowClear:!0,showSearch:!0,placeholder:"Select models",onChange:e=>{let t=Array.isArray(e)?e:[e];if(t.includes("all-wildcard"))r.setFieldsValue({model_name:void 0,model_mappings:[]});else if(JSON.stringify(r.getFieldValue("model"))!==JSON.stringify(t)){let e=t.map(e=>l===d.Cl.Azure?{public_name:e,litellm_model:"azure/".concat(e)}:{public_name:e,litellm_model:e});r.setFieldsValue({model:t,model_mappings:e})}},optionFilterProp:"children",filterOption:(e,l)=>{var t;return(null!==(t=null==l?void 0:l.label)&&void 0!==t?t:"").toLowerCase().includes(e.toLowerCase())},options:[{label:"Custom Model Name (Enter below)",value:"custom"},{label:"All ".concat(l," Models (Wildcard)"),value:"all-wildcard"},...t.map(e=>({label:e,value:e}))],style:{width:"100%"}}):(0,s.jsx)(b.o,{placeholder:a(l)})}),(0,s.jsx)(f.Z.Item,{noStyle:!0,shouldUpdate:(e,l)=>e.model!==l.model,children:e=>{let{getFieldValue:t}=e,a=t("model")||[];return(Array.isArray(a)?a:[a]).includes("custom")&&(0,s.jsx)(f.Z.Item,{name:"custom_model_name",rules:[{required:!0,message:"Please enter a custom model name."}],className:"mt-2",children:(0,s.jsx)(b.o,{placeholder:l===d.Cl.Azure?"Enter Azure deployment name":"Enter custom model name",onChange:o})})}})]}),(0,s.jsxs)(w.Z,{children:[(0,s.jsx)(k.Z,{span:10}),(0,s.jsx)(k.Z,{span:14,children:(0,s.jsx)(b.x,{className:"mb-3 mt-1",children:l===d.Cl.Azure?"Your deployment name will be saved as the public model name, and LiteLLM will use 'azure/deployment-name' internally":"The model name LiteLLM will send to the LLM API"})})]})]})},eZ=t(81915),eS=t(67187);let eA=e=>{let{content:l,children:t,width:r="auto",className:o=""}=e,[i,n]=(0,a.useState)(!1),[d,c]=(0,a.useState)("top"),m=(0,a.useRef)(null),u=()=>{if(m.current){let e=m.current.getBoundingClientRect(),l=e.top,t=window.innerHeight-e.bottom;l<300&&t>300?c("bottom"):c("top")}};return(0,s.jsxs)("div",{className:"relative inline-block",ref:m,children:[t||(0,s.jsx)(eS.Z,{className:"ml-1 text-gray-500 cursor-help",onMouseEnter:()=>{u(),n(!0)},onMouseLeave:()=>n(!1)}),i&&(0,s.jsxs)("div",{className:"absolute left-1/2 -translate-x-1/2 z-50 bg-black/90 text-white p-2 rounded-md text-sm font-normal shadow-lg ".concat(o),style:{["top"===d?"bottom":"top"]:"100%",width:r,marginBottom:"top"===d?"8px":"0",marginTop:"bottom"===d?"8px":"0"},children:[l,(0,s.jsx)("div",{className:"absolute left-1/2 -translate-x-1/2 w-0 h-0",style:{top:"top"===d?"100%":"auto",bottom:"bottom"===d?"100%":"auto",borderTop:"top"===d?"6px solid rgba(0, 0, 0, 0.9)":"6px solid transparent",borderBottom:"bottom"===d?"6px solid rgba(0, 0, 0, 0.9)":"6px solid transparent",borderLeft:"6px solid transparent",borderRight:"6px solid transparent"}})]})]})};var eI=()=>{let e=f.Z.useFormInstance(),[l,t]=(0,a.useState)(0),r=f.Z.useWatch("model",e)||[],o=Array.isArray(r)?r:[r],i=f.Z.useWatch("custom_model_name",e),n=!o.includes("all-wildcard"),c=f.Z.useWatch("custom_llm_provider",e);if((0,a.useEffect)(()=>{if(i&&o.includes("custom")){let l=(e.getFieldValue("model_mappings")||[]).map(e=>"custom"===e.public_name||"custom"===e.litellm_model?c===d.Cl.Azure?{public_name:i,litellm_model:"azure/".concat(i)}:{public_name:i,litellm_model:i}:e);e.setFieldValue("model_mappings",l),t(e=>e+1)}},[i,o,c,e]),(0,a.useEffect)(()=>{if(o.length>0&&!o.includes("all-wildcard")){let l=e.getFieldValue("model_mappings")||[];if(l.length!==o.length||!o.every(e=>l.some(l=>"custom"===e?"custom"===l.litellm_model||l.litellm_model===i:c===d.Cl.Azure?l.litellm_model==="azure/".concat(e):l.litellm_model===e))){let l=o.map(e=>"custom"===e&&i?c===d.Cl.Azure?{public_name:i,litellm_model:"azure/".concat(i)}:{public_name:i,litellm_model:i}:c===d.Cl.Azure?{public_name:e,litellm_model:"azure/".concat(e)}:{public_name:e,litellm_model:e});e.setFieldValue("model_mappings",l),t(e=>e+1)}}},[o,i,c,e]),!n)return null;let m=(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"mb-2 font-normal",children:"The name you specify in your API calls to LiteLLM Proxy"}),(0,s.jsxs)("div",{className:"mb-2 font-normal",children:[(0,s.jsx)("strong",{children:"Example:"})," If you name your public model"," ",(0,s.jsx)("code",{className:"bg-gray-700 px-1 py-0.5 rounded text-xs",children:"example-name"}),", and choose"," ",(0,s.jsx)("code",{className:"bg-gray-700 px-1 py-0.5 rounded text-xs",children:"openai/qwen-plus-latest"})," as the LiteLLM model"]}),(0,s.jsxs)("div",{className:"mb-2 font-normal",children:[(0,s.jsx)("strong",{children:"Usage:"})," You make an API call to the LiteLLM proxy with"," ",(0,s.jsx)("code",{className:"bg-gray-700 px-1 py-0.5 rounded text-xs",children:'model = "example-name"'})]}),(0,s.jsxs)("div",{className:"font-normal",children:[(0,s.jsx)("strong",{children:"Result:"})," LiteLLM sends"," ",(0,s.jsx)("code",{className:"bg-gray-700 px-1 py-0.5 rounded text-xs",children:"qwen-plus-latest"})," to the provider"]})]}),u=(0,s.jsx)("div",{children:"The model name LiteLLM will send to the LLM API"}),h=[{title:(0,s.jsxs)("span",{className:"flex items-center",children:["Public Model Name",(0,s.jsx)(eA,{content:m,width:"500px"})]}),dataIndex:"public_name",key:"public_name",render:(l,t,a)=>(0,s.jsx)(I.o,{value:l,onChange:l=>{let t=[...e.getFieldValue("model_mappings")];t[a].public_name=l.target.value,e.setFieldValue("model_mappings",t)}})},{title:(0,s.jsxs)("span",{className:"flex items-center",children:["LiteLLM Model Name",(0,s.jsx)(eA,{content:u,width:"360px"})]}),dataIndex:"litellm_model",key:"litellm_model"}];return(0,s.jsx)(s.Fragment,{children:(0,s.jsx)(f.Z.Item,{label:"Model Mappings",name:"model_mappings",tooltip:"Map public model names to LiteLLM model names for load balancing",labelCol:{span:10},wrapperCol:{span:16},labelAlign:"left",rules:[{required:!0,validator:async(e,l)=>{if(!l||0===l.length)throw Error("At least one model mapping is required");if(l.filter(e=>!e.public_name||""===e.public_name.trim()).length>0)throw Error("All model mappings must have valid public names")}}],children:(0,s.jsx)(eZ.Z,{dataSource:e.getFieldValue("model_mappings"),columns:h,pagination:!1,size:"small"},l)})})},eE=t(26210),eP=t(90464);let{Link:eM}=g.default;var eF=e=>{let{showAdvancedSettings:l,setShowAdvancedSettings:t,teams:r,guardrailsList:o}=e,[i]=f.Z.useForm(),[n,d]=a.useState(!1),[c,m]=a.useState("per_token"),[u,h]=a.useState(!1),x=(e,l)=>l&&(isNaN(Number(l))||0>Number(l))?Promise.reject("Please enter a valid positive number"):Promise.resolve(),p=(e,l)=>{if(!l)return Promise.resolve();try{return JSON.parse(l),Promise.resolve()}catch(e){return Promise.reject("Please enter valid JSON")}};return(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)(eE.UQ,{className:"mt-2 mb-4",children:[(0,s.jsx)(eE._m,{children:(0,s.jsx)("b",{children:"Advanced Settings"})}),(0,s.jsx)(eE.X1,{children:(0,s.jsxs)("div",{className:"bg-white rounded-lg",children:[(0,s.jsx)(f.Z.Item,{label:"Custom Pricing",name:"custom_pricing",valuePropName:"checked",className:"mb-4",children:(0,s.jsx)(er.Z,{onChange:e=>{d(e),e||i.setFieldsValue({input_cost_per_token:void 0,output_cost_per_token:void 0,input_cost_per_second:void 0})},className:"bg-gray-600"})}),(0,s.jsx)(f.Z.Item,{label:(0,s.jsxs)("span",{children:["Guardrails"," ",(0,s.jsx)(_.Z,{title:"Apply safety guardrails to this key to filter content or enforce policies",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)(el.Z,{style:{marginLeft:"4px"}})})})]}),name:"guardrails",className:"mt-4",help:"Select existing guardrails. Go to 'Guardrails' tab to create new guardrails.",children:(0,s.jsx)(v.default,{mode:"tags",style:{width:"100%"},placeholder:"Select or enter guardrails",options:o.map(e=>({value:e,label:e}))})}),n&&(0,s.jsxs)("div",{className:"ml-6 pl-4 border-l-2 border-gray-200",children:[(0,s.jsx)(f.Z.Item,{label:"Pricing Model",name:"pricing_model",className:"mb-4",children:(0,s.jsx)(v.default,{defaultValue:"per_token",onChange:e=>m(e),options:[{value:"per_token",label:"Per Million Tokens"},{value:"per_second",label:"Per Second"}]})}),"per_token"===c?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(f.Z.Item,{label:"Input Cost (per 1M tokens)",name:"input_cost_per_token",rules:[{validator:x}],className:"mb-4",children:(0,s.jsx)(eE.oi,{})}),(0,s.jsx)(f.Z.Item,{label:"Output Cost (per 1M tokens)",name:"output_cost_per_token",rules:[{validator:x}],className:"mb-4",children:(0,s.jsx)(eE.oi,{})})]}):(0,s.jsx)(f.Z.Item,{label:"Cost Per Second",name:"input_cost_per_second",rules:[{validator:x}],className:"mb-4",children:(0,s.jsx)(eE.oi,{})})]}),(0,s.jsx)(f.Z.Item,{label:"Use in pass through routes",name:"use_in_pass_through",valuePropName:"checked",className:"mb-4 mt-4",tooltip:(0,s.jsxs)("span",{children:["Allow using these credentials in pass through routes."," ",(0,s.jsx)(eM,{href:"https://docs.litellm.ai/docs/pass_through/vertex_ai",target:"_blank",children:"Learn more"})]}),children:(0,s.jsx)(er.Z,{onChange:e=>{let l=i.getFieldValue("litellm_extra_params");try{let t=l?JSON.parse(l):{};e?t.use_in_pass_through=!0:delete t.use_in_pass_through,Object.keys(t).length>0?i.setFieldValue("litellm_extra_params",JSON.stringify(t,null,2)):i.setFieldValue("litellm_extra_params","")}catch(l){e?i.setFieldValue("litellm_extra_params",JSON.stringify({use_in_pass_through:!0},null,2)):i.setFieldValue("litellm_extra_params","")}},className:"bg-gray-600"})}),(0,s.jsx)(ed,{form:i,showCacheControl:u,onCacheControlChange:e=>{if(h(e),!e){let e=i.getFieldValue("litellm_extra_params");try{let l=e?JSON.parse(e):{};delete l.cache_control_injection_points,Object.keys(l).length>0?i.setFieldValue("litellm_extra_params",JSON.stringify(l,null,2)):i.setFieldValue("litellm_extra_params","")}catch(e){i.setFieldValue("litellm_extra_params","")}}}}),(0,s.jsx)(f.Z.Item,{label:"LiteLLM Params",name:"litellm_extra_params",tooltip:"Optional litellm params used for making a litellm.completion() call.",className:"mb-4 mt-4",rules:[{validator:p}],children:(0,s.jsx)(eP.Z,{rows:4,placeholder:'{ "rpm": 100, "timeout": 0, "stream_timeout": 0 }'})}),(0,s.jsxs)(w.Z,{className:"mb-4",children:[(0,s.jsx)(k.Z,{span:10}),(0,s.jsx)(k.Z,{span:10,children:(0,s.jsxs)(eE.xv,{className:"text-gray-600 text-sm",children:["Pass JSON of litellm supported params"," ",(0,s.jsx)(eM,{href:"https://docs.litellm.ai/docs/completion/input",target:"_blank",children:"litellm.completion() call"})]})})]}),(0,s.jsx)(f.Z.Item,{label:"Model Info",name:"model_info_params",tooltip:"Optional model info params. Returned when calling `/model/info` endpoint.",className:"mb-0",rules:[{validator:p}],children:(0,s.jsx)(eP.Z,{rows:4,placeholder:'{ "mode": "chat" }'})})]})})]})})},eL=t(29),eT=t.n(eL),eR=t(23496),eO=t(35291),eV=t(23639);let{Text:eD}=g.default;var eq=e=>{let{formValues:l,accessToken:t,testMode:r,modelName:o="this model",onClose:i,onTestComplete:d}=e,[u,h]=a.useState(null),[x,p]=a.useState(null),[g,f]=a.useState(null),[j,v]=a.useState(!0),[_,b]=a.useState(!1),[N,w]=a.useState(!1),k=async()=>{v(!0),w(!1),h(null),p(null),f(null),b(!1),await new Promise(e=>setTimeout(e,100));try{console.log("Testing connection with form values:",l);let a=await m(l,t,null);if(!a){console.log("No result from prepareModelAddRequest"),h("Failed to prepare model data. Please check your form inputs."),b(!1),v(!1);return}console.log("Result from prepareModelAddRequest:",a);let{litellmParamsObj:r,modelInfoObj:o,modelName:i}=a[0],d=await (0,n.testConnectionRequest)(t,r,o,null==o?void 0:o.mode);if("success"===d.status)c.Z.success("Connection test successful!"),h(null),b(!0);else{var e,s;let l=(null===(e=d.result)||void 0===e?void 0:e.error)||d.message||"Unknown error";h(l),p(r),f(null===(s=d.result)||void 0===s?void 0:s.raw_request_typed_dict),b(!1)}}catch(e){console.error("Test connection error:",e),h(e instanceof Error?e.message:String(e)),b(!1)}finally{v(!1),d&&d()}};a.useEffect(()=>{let e=setTimeout(()=>{k()},200);return()=>clearTimeout(e)},[]);let C=e=>e?e.split("stack trace:")[0].trim().replace(/^litellm\.(.*?)Error: /,""):"Unknown error",Z="string"==typeof u?C(u):(null==u?void 0:u.message)?C(u.message):"Unknown error",S=g?((e,l,t)=>{let s=JSON.stringify(l,null,2).split("\n").map(e=>" ".concat(e)).join("\n"),a=Object.entries(t).map(e=>{let[l,t]=e;return"-H '".concat(l,": ").concat(t,"'")}).join(" \\\n ");return"curl -X POST \\\n ".concat(e," \\\n ").concat(a?"".concat(a," \\\n "):"","-H 'Content-Type: application/json' \\\n -d '{\n").concat(s,"\n }'")})(g.raw_request_api_base,g.raw_request_body,g.raw_request_headers||{}):"";return(0,s.jsxs)("div",{style:{padding:"24px",borderRadius:"8px",backgroundColor:"#fff"},children:[j?(0,s.jsxs)("div",{style:{textAlign:"center",padding:"32px 20px"},className:"jsx-dc9a0e2d897fe63b",children:[(0,s.jsx)("div",{style:{marginBottom:"16px"},className:"jsx-dc9a0e2d897fe63b loading-spinner",children:(0,s.jsx)("div",{style:{border:"3px solid #f3f3f3",borderTop:"3px solid #1890ff",borderRadius:"50%",width:"30px",height:"30px",animation:"spin 1s linear infinite",margin:"0 auto"},className:"jsx-dc9a0e2d897fe63b"})}),(0,s.jsxs)(eD,{style:{fontSize:"16px"},children:["Testing connection to ",o,"..."]}),(0,s.jsx)(eT(),{id:"dc9a0e2d897fe63b",children:"@-webkit-keyframes spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@-moz-keyframes spin{0%{-moz-transform:rotate(0deg);transform:rotate(0deg)}100%{-moz-transform:rotate(360deg);transform:rotate(360deg)}}@-o-keyframes spin{0%{-o-transform:rotate(0deg);transform:rotate(0deg)}100%{-o-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes spin{0%{-webkit-transform:rotate(0deg);-moz-transform:rotate(0deg);-o-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg);-moz-transform:rotate(360deg);-o-transform:rotate(360deg);transform:rotate(360deg)}}"})]}):_?(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"32px 20px"},children:[(0,s.jsx)("div",{style:{color:"#52c41a",fontSize:"24px",display:"flex",alignItems:"center"},children:(0,s.jsx)("svg",{viewBox:"64 64 896 896",focusable:"false","data-icon":"check-circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",children:(0,s.jsx)("path",{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm193.5 301.7l-210.6 292a31.8 31.8 0 01-51.7 0L318.5 484.9c-3.8-5.3 0-12.7 6.5-12.7h46.9c10.2 0 19.9 4.9 25.9 13.3l71.2 98.8 157.2-218c6-8.3 15.6-13.3 25.9-13.3H699c6.5 0 10.3 7.4 6.5 12.7z"})})}),(0,s.jsxs)(eD,{type:"success",style:{fontSize:"18px",fontWeight:500,marginLeft:"10px"},children:["Connection to ",o," successful!"]})]}):(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",marginBottom:"20px"},children:[(0,s.jsx)(eO.Z,{style:{color:"#ff4d4f",fontSize:"24px",marginRight:"12px"}}),(0,s.jsxs)(eD,{type:"danger",style:{fontSize:"18px",fontWeight:500},children:["Connection to ",o," failed"]})]}),(0,s.jsxs)("div",{style:{backgroundColor:"#fff2f0",border:"1px solid #ffccc7",borderRadius:"8px",padding:"16px",marginBottom:"20px",boxShadow:"0 1px 2px rgba(0, 0, 0, 0.03)"},children:[(0,s.jsxs)(eD,{strong:!0,style:{display:"block",marginBottom:"8px"},children:["Error:"," "]}),(0,s.jsx)(eD,{type:"danger",style:{fontSize:"14px",lineHeight:"1.5"},children:Z}),u&&(0,s.jsx)("div",{style:{marginTop:"12px"},children:(0,s.jsx)(y.ZP,{type:"link",onClick:()=>w(!N),style:{paddingLeft:0,height:"auto"},children:N?"Hide Details":"Show Details"})})]}),N&&(0,s.jsxs)("div",{style:{marginBottom:"20px"},children:[(0,s.jsx)(eD,{strong:!0,style:{display:"block",marginBottom:"8px",fontSize:"15px"},children:"Troubleshooting Details"}),(0,s.jsx)("pre",{style:{backgroundColor:"#f5f5f5",padding:"16px",borderRadius:"8px",fontSize:"13px",maxHeight:"200px",overflow:"auto",border:"1px solid #e8e8e8",lineHeight:"1.5"},children:"string"==typeof u?u:JSON.stringify(u,null,2)})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(eD,{strong:!0,style:{display:"block",marginBottom:"8px",fontSize:"15px"},children:"API Request"}),(0,s.jsx)("pre",{style:{backgroundColor:"#f5f5f5",padding:"16px",borderRadius:"8px",fontSize:"13px",maxHeight:"250px",overflow:"auto",border:"1px solid #e8e8e8",lineHeight:"1.5"},children:S||"No request data available"}),(0,s.jsx)(y.ZP,{style:{marginTop:"8px"},icon:(0,s.jsx)(eV.Z,{}),onClick:()=>{navigator.clipboard.writeText(S||""),c.Z.success("Copied to clipboard")},children:"Copy to Clipboard"})]})]})}),(0,s.jsx)(eR.Z,{style:{margin:"24px 0 16px"}}),(0,s.jsx)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:(0,s.jsx)(y.ZP,{type:"link",href:"https://docs.litellm.ai/docs/providers",target:"_blank",icon:(0,s.jsx)(el.Z,{}),children:"View Documentation"})})]})};let ez=[{value:"chat",label:"Chat - /chat/completions"},{value:"completion",label:"Completion - /completions"},{value:"embedding",label:"Embedding - /embeddings"},{value:"audio_speech",label:"Audio Speech - /audio/speech"},{value:"audio_transcription",label:"Audio Transcription - /audio/transcriptions"},{value:"image_generation",label:"Image Generation - /images/generations"},{value:"rerank",label:"Rerank - /rerank"},{value:"realtime",label:"Realtime - /realtime"},{value:"batch",label:"Batch - /batch"},{value:"ocr",label:"OCR - /ocr"}];var eB=t(92858),eK=t(84376),eU=t(20347);let eG=async(e,l,t,s)=>{try{console.log("=== AUTO ROUTER SUBMIT HANDLER CALLED ==="),console.log("handling auto router submit for formValues:",e),console.log("Access token:",l?"Present":"Missing"),console.log("Form:",t?"Present":"Missing"),console.log("Callback:",s?"Present":"Missing");let a={model_name:e.auto_router_name,litellm_params:{model:"auto_router/".concat(e.auto_router_name),auto_router_config:JSON.stringify(e.auto_router_config),auto_router_default_model:e.auto_router_default_model},model_info:{}};e.auto_router_embedding_model&&"custom"!==e.auto_router_embedding_model?a.litellm_params.auto_router_embedding_model=e.auto_router_embedding_model:e.custom_embedding_model&&(a.litellm_params.auto_router_embedding_model=e.custom_embedding_model),e.team_id&&(a.model_info.team_id=e.team_id),e.model_access_group&&e.model_access_group.length>0&&(a.model_info.access_groups=e.model_access_group),console.log("Auto router configuration to be created:",a),console.log("Auto router config (stringified):",a.litellm_params.auto_router_config),console.log("Calling modelCreateCall with:",{accessToken:l?"Present":"Missing",config:a});let r=await (0,n.modelCreateCall)(l,a);console.log("response for auto router create call:",r),t.resetFields()}catch(e){console.error("Failed to add auto router:",e),c.Z.fromBackend("Failed to add auto router: "+e)}},{Title:eH,Link:eJ}=g.default;var eW=e=>{let{form:l,handleOk:t,accessToken:r,userRole:o}=e,[i,d]=(0,a.useState)(!1),[m,u]=(0,a.useState)(!1),[h,x]=(0,a.useState)(""),[p,N]=(0,a.useState)([]),[w,k]=(0,a.useState)([]),[C,Z]=(0,a.useState)(!1),[S,A]=(0,a.useState)(!1),[I,E]=(0,a.useState)(null);(0,a.useEffect)(()=>{(async()=>{N((await (0,n.modelAvailableCall)(r,"","",!1,null,!0,!0)).data.map(e=>e.id))})()},[r]),(0,a.useEffect)(()=>{(async()=>{try{let e=await (0,eh.p)(r);console.log("Fetched models for auto router:",e),k(e)}catch(e){console.error("Error fetching model info for auto router:",e)}})()},[r]);let P=eU.ZL.includes(o),M=async()=>{u(!0),x("test-".concat(Date.now())),d(!0)},F=()=>{console.log("Auto router submit triggered!"),console.log("Router config:",I);let e=l.getFieldsValue();if(console.log("Form values:",e),!e.auto_router_name){c.Z.fromBackend("Please enter an Auto Router Name");return}if(!e.auto_router_default_model){c.Z.fromBackend("Please select a Default Model");return}if(l.setFieldsValue({custom_llm_provider:"auto_router",model:e.auto_router_name,api_key:"not_required_for_auto_router"}),!I||!I.routes||0===I.routes.length){c.Z.fromBackend("Please configure at least one route for the auto router");return}if(I.routes.filter(e=>!e.name||!e.description||0===e.utterances.length).length>0){c.Z.fromBackend("Please ensure all routes have a target model, description, and at least one utterance");return}l.validateFields().then(e=>{console.log("Form validation passed, submitting with values:",e);let s={...e,auto_router_config:I};console.log("Final submit values:",s),eG(s,r,l,t)}).catch(e=>{console.error("Validation failed:",e);let l=e.errorFields||[];if(l.length>0){let e=l.map(e=>{let l=e.name[0];return({auto_router_name:"Auto Router Name",auto_router_default_model:"Default Model",auto_router_embedding_model:"Embedding Model"})[l]||l});c.Z.fromBackend("Please fill in the following required fields: ".concat(e.join(", ")))}else c.Z.fromBackend("Please fill in all required fields")})};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(eH,{level:2,children:"Add Auto Router"}),(0,s.jsx)(b.x,{className:"text-gray-600 mb-6",children:"Create an auto router with intelligent routing logic that automatically selects the best model based on user input patterns and semantic matching."}),(0,s.jsx)(ep.Z,{children:(0,s.jsxs)(f.Z,{form:l,onFinish:F,labelCol:{span:10},wrapperCol:{span:16},labelAlign:"left",children:[(0,s.jsx)(f.Z.Item,{rules:[{required:!0,message:"Auto router name is required"}],label:"Auto Router Name",name:"auto_router_name",tooltip:"Unique name for this auto router configuration",labelCol:{span:10},labelAlign:"left",children:(0,s.jsx)(b.o,{placeholder:"e.g., auto_router_1, smart_routing"})}),(0,s.jsx)("div",{className:"w-full mb-4",children:(0,s.jsx)(eb,{modelInfo:w,value:I,onChange:e=>{E(e),l.setFieldValue("auto_router_config",e)}})}),(0,s.jsx)(f.Z.Item,{rules:[{required:!0,message:"Default model is required"}],label:"Default Model",name:"auto_router_default_model",tooltip:"Fallback model to use when auto routing logic cannot determine the best model",labelCol:{span:10},labelAlign:"left",children:(0,s.jsx)(v.default,{placeholder:"Select a default model",onChange:e=>{Z("custom"===e)},options:[...Array.from(new Set(w.map(e=>e.model_group))).map(e=>({value:e,label:e})),{value:"custom",label:"Enter custom model name"}],style:{width:"100%"},showSearch:!0})}),(0,s.jsx)(f.Z.Item,{label:"Embedding Model",name:"auto_router_embedding_model",tooltip:"Optional: Embedding model to use for semantic routing decisions",labelCol:{span:10},labelAlign:"left",children:(0,s.jsx)(v.default,{value:l.getFieldValue("auto_router_embedding_model"),placeholder:"Select an embedding model (optional)",onChange:e=>{A("custom"===e),l.setFieldValue("auto_router_embedding_model",e)},options:[...Array.from(new Set(w.map(e=>e.model_group))).map(e=>({value:e,label:e})),{value:"custom",label:"Enter custom model name"}],style:{width:"100%"},showSearch:!0,allowClear:!0})}),(0,s.jsxs)("div",{className:"flex items-center my-4",children:[(0,s.jsx)("div",{className:"flex-grow border-t border-gray-200"}),(0,s.jsx)("span",{className:"px-4 text-gray-500 text-sm",children:"Additional Settings"}),(0,s.jsx)("div",{className:"flex-grow border-t border-gray-200"})]}),P&&(0,s.jsx)(f.Z.Item,{label:"Model Access Group",name:"model_access_group",className:"mb-4",tooltip:"Use model access groups to control who can access this auto router",children:(0,s.jsx)(v.default,{mode:"tags",showSearch:!0,placeholder:"Select existing groups or type to create new ones",optionFilterProp:"children",tokenSeparators:[","],options:p.map(e=>({value:e,label:e})),maxTagCount:"responsive",allowClear:!0})}),(0,s.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,s.jsx)(_.Z,{title:"Get help on our github",children:(0,s.jsx)(g.default.Link,{href:"https://github.com/BerriAI/litellm/issues",children:"Need Help?"})}),(0,s.jsxs)("div",{className:"space-x-2",children:[(0,s.jsx)(y.ZP,{onClick:M,loading:m,children:"Test Connect"}),(0,s.jsx)(y.ZP,{onClick:()=>{console.log("Add Auto Router button clicked!"),console.log("Current router config:",I),console.log("Current form values:",l.getFieldsValue()),F()},children:"Add Auto Router"})]})]})]})}),(0,s.jsx)(j.Z,{title:"Connection Test Results",open:i,onCancel:()=>{d(!1),u(!1)},footer:[(0,s.jsx)(y.ZP,{onClick:()=>{d(!1),u(!1)},children:"Close"},"close")],width:700,children:i&&(0,s.jsx)(eq,{formValues:l.getFieldsValue(),accessToken:r,testMode:"chat",modelName:l.getFieldValue("auto_router_name"),onClose:()=>{d(!1),u(!1)},onTestComplete:()=>u(!1)},h)})]})};let{Title:eY,Link:e$}=g.default;var eQ=e=>{let{form:l,handleOk:t,selectedProvider:r,setSelectedProvider:o,providerModels:c,setProviderModelsFn:m,getPlaceholder:u,uploadProps:h,showAdvancedSettings:x,setShowAdvancedSettings:p,teams:b,credentials:N,accessToken:C,userRole:Z,premiumUser:S}=e,[I]=f.Z.useForm(),[E,P]=(0,a.useState)("chat"),[M,F]=(0,a.useState)(!1),[L,T]=(0,a.useState)(!1),[R,O]=(0,a.useState)([]),[V,D]=(0,a.useState)("");(0,a.useEffect)(()=>{(async()=>{try{let e=(await (0,n.getGuardrailsList)(C)).guardrails.map(e=>e.guardrail_name);O(e)}catch(e){console.error("Failed to fetch guardrails:",e)}})()},[C]);let q=async()=>{T(!0),D("test-".concat(Date.now())),F(!0)},[z,B]=(0,a.useState)(!1),[K,U]=(0,a.useState)([]);(0,a.useEffect)(()=>{(async()=>{U((await (0,n.modelAvailableCall)(C,"","",!1,null,!0,!0)).data.map(e=>e.id))})()},[C]);let G=eU.ZL.includes(Z);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(ek.v0,{className:"w-full",children:[(0,s.jsxs)(ek.td,{className:"mb-4",children:[(0,s.jsx)(ek.OK,{children:"Add Model"}),(0,s.jsx)(ek.OK,{children:"Add Auto Router"})]}),(0,s.jsxs)(ek.nP,{children:[(0,s.jsxs)(ek.x4,{children:[(0,s.jsx)(eY,{level:2,children:"Add Model"}),(0,s.jsx)(ep.Z,{children:(0,s.jsx)(f.Z,{form:l,onFinish:e=>{console.log("\uD83D\uDD25 Form onFinish triggered with values:",e),t()},onFinishFailed:e=>{console.log("\uD83D\uDCA5 Form onFinishFailed triggered:",e)},labelCol:{span:10},wrapperCol:{span:16},labelAlign:"left",children:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(f.Z.Item,{rules:[{required:!0,message:"Required"}],label:"Provider:",name:"custom_llm_provider",tooltip:"E.g. OpenAI, Azure OpenAI, Anthropic, Bedrock, etc.",labelCol:{span:10},labelAlign:"left",children:(0,s.jsx)(v.default,{showSearch:!0,value:r,onChange:e=>{o(e),m(e),l.setFieldsValue({model:[],model_name:void 0})},children:Object.entries(d.Cl).map(e=>{let[l,t]=e;return(0,s.jsx)(v.default.Option,{value:l,children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("img",{src:d.cd[t],alt:"".concat(l," logo"),className:"w-5 h-5",onError:e=>{let l=e.target,s=l.parentElement;if(s){let e=document.createElement("div");e.className="w-5 h-5 rounded-full bg-gray-200 flex items-center justify-center text-xs",e.textContent=t.charAt(0),s.replaceChild(e,l)}}}),(0,s.jsx)("span",{children:t})]})},l)})})}),(0,s.jsx)(eC,{selectedProvider:r,providerModels:c,getPlaceholder:u}),(0,s.jsx)(eI,{}),(0,s.jsx)(f.Z.Item,{label:"Mode",name:"mode",className:"mb-1",children:(0,s.jsx)(v.default,{style:{width:"100%"},value:E,onChange:e=>P(e),options:ez})}),(0,s.jsxs)(w.Z,{children:[(0,s.jsx)(k.Z,{span:10}),(0,s.jsx)(k.Z,{span:10,children:(0,s.jsxs)(i.Z,{className:"mb-5 mt-1",children:[(0,s.jsx)("strong",{children:"Optional"})," - LiteLLM endpoint to use when health checking this model"," ",(0,s.jsx)(e$,{href:"https://docs.litellm.ai/docs/proxy/health#health",target:"_blank",children:"Learn more"})]})})]}),(0,s.jsx)("div",{className:"mb-4",children:(0,s.jsx)(g.default.Text,{className:"text-sm text-gray-500 mb-2",children:"Either select existing credentials OR enter new provider credentials below"})}),(0,s.jsx)(f.Z.Item,{label:"Existing Credentials",name:"litellm_credential_name",children:(0,s.jsx)(v.default,{showSearch:!0,placeholder:"Select or search for existing credentials",optionFilterProp:"children",filterOption:(e,l)=>{var t;return(null!==(t=null==l?void 0:l.label)&&void 0!==t?t:"").toLowerCase().includes(e.toLowerCase())},options:[{value:null,label:"None"},...N.map(e=>({value:e.credential_name,label:e.credential_name}))],allowClear:!0})}),(0,s.jsxs)("div",{className:"flex items-center my-4",children:[(0,s.jsx)("div",{className:"flex-grow border-t border-gray-200"}),(0,s.jsx)("span",{className:"px-4 text-gray-500 text-sm",children:"OR"}),(0,s.jsx)("div",{className:"flex-grow border-t border-gray-200"})]}),(0,s.jsx)(f.Z.Item,{noStyle:!0,shouldUpdate:(e,l)=>e.litellm_credential_name!==l.litellm_credential_name||e.provider!==l.provider,children:e=>{let{getFieldValue:l}=e,t=l("litellm_credential_name");return(console.log("\uD83D\uDD11 Credential Name Changed:",t),t)?(0,s.jsx)("div",{className:"text-gray-500 text-sm text-center",children:"Using existing credentials - no additional provider fields needed"}):(0,s.jsx)(A,{selectedProvider:r,uploadProps:h})}}),(0,s.jsxs)("div",{className:"flex items-center my-4",children:[(0,s.jsx)("div",{className:"flex-grow border-t border-gray-200"}),(0,s.jsx)("span",{className:"px-4 text-gray-500 text-sm",children:"Additional Model Info Settings"}),(0,s.jsx)("div",{className:"flex-grow border-t border-gray-200"})]}),(0,s.jsx)(f.Z.Item,{label:"Team-BYOK Model",tooltip:"Only use this model + credential combination for this team. Useful when teams want to onboard their own OpenAI keys.",className:"mb-4",children:(0,s.jsx)(_.Z,{title:S?"":"This is an enterprise-only feature. Upgrade to premium to restrict model+credential combinations to a specific team.",placement:"top",children:(0,s.jsx)(eB.Z,{checked:z,onChange:e=>{B(e),e||l.setFieldValue("team_id",void 0)},disabled:!S})})}),z&&(0,s.jsx)(f.Z.Item,{label:"Select Team",name:"team_id",className:"mb-4",tooltip:"Only keys for this team will be able to call this model.",rules:[{required:z&&!G,message:"Please select a team."}],children:(0,s.jsx)(eK.Z,{teams:b,disabled:!S})}),G&&(0,s.jsx)(s.Fragment,{children:(0,s.jsx)(f.Z.Item,{label:"Model Access Group",name:"model_access_group",className:"mb-4",tooltip:"Use model access groups to give users access to select models, and add new ones to the group over time.",children:(0,s.jsx)(v.default,{mode:"tags",showSearch:!0,placeholder:"Select existing groups or type to create new ones",optionFilterProp:"children",tokenSeparators:[","],options:K.map(e=>({value:e,label:e})),maxTagCount:"responsive",allowClear:!0})})}),(0,s.jsx)(eF,{showAdvancedSettings:x,setShowAdvancedSettings:p,teams:b,guardrailsList:R}),(0,s.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,s.jsx)(_.Z,{title:"Get help on our github",children:(0,s.jsx)(g.default.Link,{href:"https://github.com/BerriAI/litellm/issues",children:"Need Help?"})}),(0,s.jsxs)("div",{className:"space-x-2",children:[(0,s.jsx)(y.ZP,{onClick:q,loading:L,children:"Test Connect"}),(0,s.jsx)(y.ZP,{htmlType:"submit",children:"Add Model"})]})]})]})})})]}),(0,s.jsx)(ek.x4,{children:(0,s.jsx)(eW,{form:I,handleOk:()=>{I.validateFields().then(e=>{eG(e,C,I,t)}).catch(e=>{console.error("Validation failed:",e)})},accessToken:C,userRole:Z})})]})]}),(0,s.jsx)(j.Z,{title:"Connection Test Results",open:M,onCancel:()=>{F(!1),T(!1)},footer:[(0,s.jsx)(y.ZP,{onClick:()=>{F(!1),T(!1)},children:"Close"},"close")],width:700,children:M&&(0,s.jsx)(eq,{formValues:l.getFieldsValue(),accessToken:C,testMode:E,modelName:l.getFieldValue("model_name")||l.getFieldValue("model"),onClose:()=>{F(!1),T(!1)},onTestComplete:()=>T(!1)},V)})]})},eX=t(41649),e0=t(8048),e1=t(61994),e2=t(15731),e4=t(91126);let e5=(e,l,t,a,r,o,i,n,d,c,m)=>[{header:()=>(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(e1.Z,{checked:t,indeterminate:l.length>0&&!t,onChange:e=>r(e.target.checked),onClick:e=>e.stopPropagation()}),(0,s.jsx)("span",{children:"Model ID"})]}),accessorKey:"model_info.id",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:t}=e,r=t.original,o=r.model_name,i=l.includes(o);return(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(e1.Z,{checked:i,onChange:e=>a(o,e.target.checked),onClick:e=>e.stopPropagation()}),(0,s.jsx)(_.Z,{title:r.model_info.id,children:(0,s.jsx)("div",{className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left w-full truncate whitespace-nowrap cursor-pointer max-w-[15ch]",onClick:()=>m&&m(r.model_info.id),children:r.model_info.id})})]})}},{header:"Model Name",accessorKey:"model_name",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:l}=e,t=l.original,a=n(t)||t.model_name;return(0,s.jsx)("div",{className:"font-medium text-sm",children:(0,s.jsx)(_.Z,{title:a,children:(0,s.jsx)("div",{className:"truncate max-w-[200px]",children:a})})})}},{header:"Health Status",accessorKey:"health_status",enableSorting:!0,sortingFn:(e,l,t)=>{var s,a;let r=e.getValue("health_status")||"unknown",o=l.getValue("health_status")||"unknown",i={healthy:0,checking:1,unknown:2,unhealthy:3};return(null!==(s=i[r])&&void 0!==s?s:4)-(null!==(a=i[o])&&void 0!==a?a:4)},cell:l=>{var t;let{row:a}=l,r=a.original,o={status:r.health_status,loading:r.health_loading,error:r.health_error};if(o.loading)return(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsxs)("div",{className:"flex space-x-1",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-indigo-500 rounded-full animate-pulse"}),(0,s.jsx)("div",{className:"w-2 h-2 bg-indigo-500 rounded-full animate-pulse",style:{animationDelay:"0.2s"}}),(0,s.jsx)("div",{className:"w-2 h-2 bg-indigo-500 rounded-full animate-pulse",style:{animationDelay:"0.4s"}})]}),(0,s.jsx)(ev.x,{className:"text-gray-600 text-sm",children:"Checking..."})]});let n=r.model_name,d="healthy"===o.status&&(null===(t=e[n])||void 0===t?void 0:t.successResponse);return(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[i(o.status),d&&c&&(0,s.jsx)(_.Z,{title:"View response details",placement:"top",children:(0,s.jsx)("button",{onClick:()=>{var l;return c(n,null===(l=e[n])||void 0===l?void 0:l.successResponse)},className:"p-1 text-green-600 hover:text-green-800 hover:bg-green-50 rounded cursor-pointer transition-colors",children:(0,s.jsx)(e2.Z,{className:"h-4 w-4"})})})]})}},{header:"Error Details",accessorKey:"health_error",enableSorting:!1,cell:l=>{let{row:t}=l,a=t.original.model_name,r=e[a];if(!(null==r?void 0:r.error))return(0,s.jsx)(ev.x,{className:"text-gray-400 text-sm",children:"No errors"});let o=r.error,i=r.fullError||r.error;return(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("div",{className:"max-w-[200px]",children:(0,s.jsx)(_.Z,{title:o,placement:"top",children:(0,s.jsx)(ev.x,{className:"text-red-600 text-sm truncate",children:o})})}),d&&i!==o&&(0,s.jsx)(_.Z,{title:"View full error details",placement:"top",children:(0,s.jsx)("button",{onClick:()=>d(a,o,i),className:"p-1 text-red-600 hover:text-red-800 hover:bg-red-50 rounded cursor-pointer transition-colors",children:(0,s.jsx)(e2.Z,{className:"h-4 w-4"})})})]})}},{header:"Last Check",accessorKey:"last_check",enableSorting:!0,sortingFn:(e,l,t)=>{let s=e.getValue("last_check")||"Never checked",a=l.getValue("last_check")||"Never checked";if("Never checked"===s&&"Never checked"===a)return 0;if("Never checked"===s)return 1;if("Never checked"===a)return -1;if("Check in progress..."===s&&"Check in progress..."===a)return 0;if("Check in progress..."===s)return -1;if("Check in progress..."===a)return 1;let r=new Date(s),o=new Date(a);return isNaN(r.getTime())&&isNaN(o.getTime())?0:isNaN(r.getTime())?1:isNaN(o.getTime())?-1:o.getTime()-r.getTime()},cell:e=>{let{row:l}=e,t=l.original;return(0,s.jsx)(ev.x,{className:"text-gray-600 text-sm",children:t.health_loading?"Check in progress...":t.last_check})}},{header:"Last Success",accessorKey:"last_success",enableSorting:!0,sortingFn:(e,l,t)=>{let s=e.getValue("last_success")||"Never succeeded",a=l.getValue("last_success")||"Never succeeded";if("Never succeeded"===s&&"Never succeeded"===a)return 0;if("Never succeeded"===s)return 1;if("Never succeeded"===a)return -1;if("None"===s&&"None"===a)return 0;if("None"===s)return 1;if("None"===a)return -1;let r=new Date(s),o=new Date(a);return isNaN(r.getTime())&&isNaN(o.getTime())?0:isNaN(r.getTime())?1:isNaN(o.getTime())?-1:o.getTime()-r.getTime()},cell:l=>{let{row:t}=l,a=e[t.original.model_name],r=(null==a?void 0:a.lastSuccess)||"None";return(0,s.jsx)(ev.x,{className:"text-gray-600 text-sm",children:r})}},{header:"Actions",id:"actions",cell:e=>{let{row:l}=e,t=l.original,a=t.model_name,r=t.health_status&&"none"!==t.health_status,i=t.health_loading?"Checking...":r?"Re-run Health Check":"Run Health Check";return(0,s.jsx)(_.Z,{title:i,placement:"top",children:(0,s.jsx)("button",{className:"p-2 rounded-md transition-colors ".concat(t.health_loading?"text-gray-400 cursor-not-allowed bg-gray-100":"text-indigo-600 hover:text-indigo-700 hover:bg-indigo-50"),onClick:()=>{t.health_loading||o(a)},disabled:t.health_loading,children:t.health_loading?(0,s.jsxs)("div",{className:"flex space-x-1",children:[(0,s.jsx)("div",{className:"w-1 h-1 bg-gray-400 rounded-full animate-pulse"}),(0,s.jsx)("div",{className:"w-1 h-1 bg-gray-400 rounded-full animate-pulse",style:{animationDelay:"0.2s"}}),(0,s.jsx)("div",{className:"w-1 h-1 bg-gray-400 rounded-full animate-pulse",style:{animationDelay:"0.4s"}})]}):r?(0,s.jsx)(D.Z,{className:"h-4 w-4"}):(0,s.jsx)(e4.Z,{className:"h-4 w-4"})})})},enableSorting:!1}],e6=[{pattern:/Missing .* API Key/i,replacement:"Missing API Key"},{pattern:/Connection timeout/i,replacement:"Connection timeout"},{pattern:/Network.*not.*ok/i,replacement:"Network connection failed"},{pattern:/403.*Forbidden/i,replacement:"Access forbidden - check API key permissions"},{pattern:/401.*Unauthorized/i,replacement:"Unauthorized - invalid API key"},{pattern:/429.*rate limit/i,replacement:"Rate limit exceeded"},{pattern:/500.*Internal Server Error/i,replacement:"Provider internal server error"},{pattern:/litellm\.AuthenticationError/i,replacement:"Authentication failed"},{pattern:/litellm\.RateLimitError/i,replacement:"Rate limit exceeded"},{pattern:/litellm\.APIError/i,replacement:"API error"}];var e3=e=>{let{accessToken:l,modelData:t,all_models_on_proxy:r,getDisplayModelName:o,setSelectedModelId:d}=e,[c,m]=(0,a.useState)({}),[u,h]=(0,a.useState)([]),[x,p]=(0,a.useState)(!1),[g,f]=(0,a.useState)(!1),[v,_]=(0,a.useState)(null),[b,N]=(0,a.useState)(!1),[w,k]=(0,a.useState)(null),C=(0,a.useRef)(null);(0,a.useEffect)(()=>{l&&(null==t?void 0:t.data)&&(async()=>{let e={};t.data.forEach(l=>{e[l.model_name]={status:"none",lastCheck:"None",lastSuccess:"None",loading:!1,error:void 0,fullError:void 0,successResponse:void 0}});try{let s=await (0,n.latestHealthChecksCall)(l);s&&s.latest_health_checks&&"object"==typeof s.latest_health_checks&&Object.entries(s.latest_health_checks).forEach(l=>{let[s,a]=l;if(!a)return;let r=null,o=t.data.find(e=>e.model_name===s);if(o)r=o.model_name;else{let e=t.data.find(e=>e.model_info&&e.model_info.id===s);if(e)r=e.model_name;else if(a.model_name){let e=t.data.find(e=>e.model_name===a.model_name);e&&(r=e.model_name)}}if(r){let l=a.error_message||void 0;e[r]={status:a.status||"unknown",lastCheck:a.checked_at?new Date(a.checked_at).toLocaleString():"None",lastSuccess:"healthy"===a.status&&a.checked_at?new Date(a.checked_at).toLocaleString():"None",loading:!1,error:l?Z(l):void 0,fullError:l,successResponse:"healthy"===a.status?a:void 0}}})}catch(e){console.warn("Failed to load health check history (using default states):",e)}m(e)})()},[l,t]);let Z=e=>{var l;if(!e)return"Health check failed";let t="string"==typeof e?e:JSON.stringify(e),s=t.match(/(\w+Error):\s*(\d{3})/i);if(s)return"".concat(s[1],": ").concat(s[2]);let a=t.match(/(AuthenticationError|RateLimitError|BadRequestError|InternalServerError|TimeoutError|NotFoundError|ForbiddenError|ServiceUnavailableError|BadGatewayError|ContentPolicyViolationError|\w+Error)/i),r=t.match(/\b(400|401|403|404|408|429|500|502|503|504)\b/);if(a&&r)return"".concat(a[1],": ").concat(r[1]);if(r){let e=r[1];return"".concat({400:"BadRequestError",401:"AuthenticationError",403:"ForbiddenError",404:"NotFoundError",408:"TimeoutError",429:"RateLimitError",500:"InternalServerError",502:"BadGatewayError",503:"ServiceUnavailableError",504:"GatewayTimeoutError"}[e],": ").concat(e)}if(a){let e=a[1],l={AuthenticationError:"401",RateLimitError:"429",BadRequestError:"400",InternalServerError:"500",TimeoutError:"408",NotFoundError:"404",ForbiddenError:"403",ServiceUnavailableError:"503",BadGatewayError:"502",GatewayTimeoutError:"504",ContentPolicyViolationError:"400"}[e];return l?"".concat(e,": ").concat(l):e}for(let{pattern:e,replacement:l}of e6)if(e.test(t))return l;if(/missing.*api.*key|invalid.*key|unauthorized/i.test(t))return"AuthenticationError: 401";if(/rate.*limit|too.*many.*requests/i.test(t))return"RateLimitError: 429";if(/timeout|timed.*out/i.test(t))return"TimeoutError: 408";if(/not.*found/i.test(t))return"NotFoundError: 404";if(/forbidden|access.*denied/i.test(t))return"ForbiddenError: 403";if(/internal.*server.*error/i.test(t))return"InternalServerError: 500";let o=t.replace(/[\n\r]+/g," ").replace(/\s+/g," ").trim(),i=null===(l=o.split(/[.!?]/)[0])||void 0===l?void 0:l.trim();return i&&i.length>0?i.length>100?i.substring(0,97)+"...":i:o.length>100?o.substring(0,97)+"...":o},S=async e=>{if(l){m(l=>({...l,[e]:{...l[e],loading:!0,status:"checking"}}));try{var s,a;let r=await (0,n.individualModelHealthCheckCall)(l,e),o=new Date().toLocaleString();if(r.unhealthy_count>0&&r.unhealthy_endpoints&&r.unhealthy_endpoints.length>0){let l=(null===(s=r.unhealthy_endpoints[0])||void 0===s?void 0:s.error)||"Health check failed",t=Z(l);m(s=>{var a;return{...s,[e]:{status:"unhealthy",lastCheck:o,lastSuccess:(null===(a=s[e])||void 0===a?void 0:a.lastSuccess)||"None",loading:!1,error:t,fullError:l}}})}else m(l=>({...l,[e]:{status:"healthy",lastCheck:o,lastSuccess:o,loading:!1,successResponse:r}}));try{let s=await (0,n.latestHealthChecksCall)(l),r=t.data.find(l=>l.model_name===e);if(r){let l=r.model_info.id,t=null===(a=s.latest_health_checks)||void 0===a?void 0:a[l];if(t){let l=t.error_message||void 0;m(s=>{var a,r,o,i,n,d,c;return{...s,[e]:{status:t.status||(null===(a=s[e])||void 0===a?void 0:a.status)||"unknown",lastCheck:t.checked_at?new Date(t.checked_at).toLocaleString():(null===(r=s[e])||void 0===r?void 0:r.lastCheck)||"None",lastSuccess:"healthy"===t.status?t.checked_at?new Date(t.checked_at).toLocaleString():(null===(o=s[e])||void 0===o?void 0:o.lastSuccess)||"None":(null===(i=s[e])||void 0===i?void 0:i.lastSuccess)||"None",loading:!1,error:l?Z(l):null===(n=s[e])||void 0===n?void 0:n.error,fullError:l||(null===(d=s[e])||void 0===d?void 0:d.fullError),successResponse:"healthy"===t.status?t:null===(c=s[e])||void 0===c?void 0:c.successResponse}}})}}}catch(e){console.debug("Could not fetch updated status from database (non-critical):",e)}}catch(a){let l=new Date().toLocaleString(),t=a instanceof Error?a.message:String(a),s=Z(t);m(a=>{var r;return{...a,[e]:{status:"unhealthy",lastCheck:l,lastSuccess:(null===(r=a[e])||void 0===r?void 0:r.lastSuccess)||"None",loading:!1,error:s,fullError:t}}})}}},A=async()=>{let e=u.length>0?u:r,s=e.reduce((e,l)=>(e[l]={...c[l],loading:!0,status:"checking"},e),{});m(e=>({...e,...s}));let a={},o=e.map(async e=>{if(l)try{let s=await (0,n.individualModelHealthCheckCall)(l,e);a[e]=s;let r=new Date().toLocaleString();if(s.unhealthy_count>0&&s.unhealthy_endpoints&&s.unhealthy_endpoints.length>0){var t;let l=(null===(t=s.unhealthy_endpoints[0])||void 0===t?void 0:t.error)||"Health check failed",a=Z(l);m(t=>{var s;return{...t,[e]:{status:"unhealthy",lastCheck:r,lastSuccess:(null===(s=t[e])||void 0===s?void 0:s.lastSuccess)||"None",loading:!1,error:a,fullError:l}}})}else m(l=>({...l,[e]:{status:"healthy",lastCheck:r,lastSuccess:r,loading:!1,successResponse:s}}))}catch(a){console.error("Health check failed for ".concat(e,":"),a);let l=new Date().toLocaleString(),t=a instanceof Error?a.message:String(a),s=Z(t);m(a=>{var r;return{...a,[e]:{status:"unhealthy",lastCheck:l,lastSuccess:(null===(r=a[e])||void 0===r?void 0:r.lastSuccess)||"None",loading:!1,error:s,fullError:t}}})}});await Promise.allSettled(o);try{if(!l)return;let s=await (0,n.latestHealthChecksCall)(l);s.latest_health_checks&&Object.entries(s.latest_health_checks).forEach(l=>{let[s,a]=l,r=t.data.find(e=>e.model_info.id===s);if(r&&e.includes(r.model_name)&&a){let e=r.model_name,l=a.error_message||void 0;m(t=>{let s=t[e];return{...t,[e]:{status:a.status||(null==s?void 0:s.status)||"unknown",lastCheck:a.checked_at?new Date(a.checked_at).toLocaleString():(null==s?void 0:s.lastCheck)||"None",lastSuccess:"healthy"===a.status&&a.checked_at?new Date(a.checked_at).toLocaleString():(null==s?void 0:s.lastSuccess)||"None",loading:!1,error:l?Z(l):null==s?void 0:s.error,fullError:l||(null==s?void 0:s.fullError),successResponse:"healthy"===a.status?a:null==s?void 0:s.successResponse}}})}})}catch(e){console.warn("Failed to fetch updated health statuses from database (non-critical):",e)}},I=e=>{p(e),e?h(r):h([])},E=()=>{f(!1),_(null)},P=()=>{N(!1),k(null)};return(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"mb-6",children:(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(Y.Z,{children:"Model Health Status"}),(0,s.jsx)(i.Z,{className:"text-gray-600 mt-1",children:"Run health checks on individual models to verify they are working correctly"})]}),(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[u.length>0&&(0,s.jsx)(z.Z,{size:"sm",variant:"light",onClick:()=>I(!1),className:"px-3 py-1 text-sm",children:"Clear Selection"}),(0,s.jsx)(z.Z,{size:"sm",variant:"secondary",onClick:A,disabled:Object.values(c).some(e=>e.loading),className:"px-3 py-1 text-sm",children:u.length>0&&u.length{l?h(l=>[...l,e]):(h(l=>l.filter(l=>l!==e)),p(!1))},I,S,e=>{switch(e){case"healthy":return(0,s.jsx)(eX.Z,{color:"emerald",children:"healthy"});case"unhealthy":return(0,s.jsx)(eX.Z,{color:"red",children:"unhealthy"});case"checking":return(0,s.jsx)(eX.Z,{color:"blue",children:"checking"});case"none":return(0,s.jsx)(eX.Z,{color:"gray",children:"none"});default:return(0,s.jsx)(eX.Z,{color:"gray",children:"unknown"})}},o,(e,l,t)=>{_({modelName:e,cleanedError:l,fullError:t}),f(!0)},(e,l)=>{k({modelName:e,response:l}),N(!0)},d),data:t.data.map(e=>{let l=c[e.model_name]||{status:"none",lastCheck:"None",loading:!1};return{model_name:e.model_name,model_info:e.model_info,provider:e.provider,litellm_model_name:e.litellm_model_name,health_status:l.status,last_check:l.lastCheck,last_success:l.lastSuccess||"None",health_loading:l.loading,health_error:l.error,health_full_error:l.fullError}}),isLoading:!1,table:C})}),(0,s.jsx)(j.Z,{title:v?"Health Check Error - ".concat(v.modelName):"Error Details",open:g,onCancel:E,footer:[(0,s.jsx)(y.ZP,{onClick:E,children:"Close"},"close")],width:800,children:v&&(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(i.Z,{className:"font-medium",children:"Error:"}),(0,s.jsx)("div",{className:"mt-2 p-3 bg-red-50 border border-red-200 rounded-md",children:(0,s.jsx)(i.Z,{className:"text-red-800",children:v.cleanedError})})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(i.Z,{className:"font-medium",children:"Full Error Details:"}),(0,s.jsx)("div",{className:"mt-2 p-3 bg-gray-50 border border-gray-200 rounded-md max-h-96 overflow-y-auto",children:(0,s.jsx)("pre",{className:"text-sm text-gray-800 whitespace-pre-wrap",children:v.fullError})})]})]})}),(0,s.jsx)(j.Z,{title:w?"Health Check Response - ".concat(w.modelName):"Response Details",open:b,onCancel:P,footer:[(0,s.jsx)(y.ZP,{onClick:P,children:"Close"},"close")],width:800,children:w&&(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(i.Z,{className:"font-medium",children:"Status:"}),(0,s.jsx)("div",{className:"mt-2 p-3 bg-green-50 border border-green-200 rounded-md",children:(0,s.jsx)(i.Z,{className:"text-green-800",children:"Health check passed successfully"})})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(i.Z,{className:"font-medium",children:"Response Details:"}),(0,s.jsx)("div",{className:"mt-2 p-3 bg-gray-50 border border-gray-200 rounded-md max-h-96 overflow-y-auto",children:(0,s.jsx)("pre",{className:"text-sm text-gray-800 whitespace-pre-wrap",children:JSON.stringify(w.response,null,2)})})]})]})})]})},e8=t(7166),e7=t(86462),e9=t(47686),le=t(77355),ll=t(93416),lt=t(95704),ls=e=>{let{accessToken:l,initialModelGroupAlias:t={},onAliasUpdate:r}=e,[o,i]=(0,a.useState)([]),[d,m]=(0,a.useState)({aliasName:"",targetModelGroup:""}),[u,h]=(0,a.useState)(null),[x,g]=(0,a.useState)(!0);(0,a.useEffect)(()=>{i(Object.entries(t).map((e,l)=>{var t;let[s,a]=e;return{id:"".concat(l,"-").concat(s),aliasName:s,targetModelGroup:"string"==typeof a?a:null!==(t=null==a?void 0:a.model)&&void 0!==t?t:""}}))},[t]);let f=async e=>{if(!l)return console.error("Access token is missing"),!1;try{let t={};return e.forEach(e=>{t[e.aliasName]=e.targetModelGroup}),console.log("Saving model group alias:",t),await (0,n.setCallbacksCall)(l,{router_settings:{model_group_alias:t}}),r&&r(t),!0}catch(e){return console.error("Failed to save model group alias settings:",e),c.Z.fromBackend("Failed to save model group alias settings"),!1}},j=async()=>{if(!d.aliasName||!d.targetModelGroup){c.Z.fromBackend("Please provide both alias name and target model group");return}if(o.some(e=>e.aliasName===d.aliasName)){c.Z.fromBackend("An alias with this name already exists");return}let e=[...o,{id:"".concat(Date.now(),"-").concat(d.aliasName),aliasName:d.aliasName,targetModelGroup:d.targetModelGroup}];await f(e)&&(i(e),m({aliasName:"",targetModelGroup:""}),c.Z.success("Alias added successfully"))},v=e=>{h({...e})},_=async()=>{if(!u)return;if(!u.aliasName||!u.targetModelGroup){c.Z.fromBackend("Please provide both alias name and target model group");return}if(o.some(e=>e.id!==u.id&&e.aliasName===u.aliasName)){c.Z.fromBackend("An alias with this name already exists");return}let e=o.map(e=>e.id===u.id?u:e);await f(e)&&(i(e),h(null),c.Z.success("Alias updated successfully"))},y=()=>{h(null)},b=async e=>{let l=o.filter(l=>l.id!==e);await f(l)&&(i(l),c.Z.success("Alias deleted successfully"))},N=o.reduce((e,l)=>(e[l.aliasName]=l.targetModelGroup,e),{});return(0,s.jsxs)(lt.Zb,{className:"mb-6",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between cursor-pointer",onClick:()=>g(!x),children:[(0,s.jsxs)("div",{className:"flex flex-col",children:[(0,s.jsx)(lt.Dx,{className:"mb-0",children:"Model Group Alias Settings"}),(0,s.jsx)("p",{className:"text-sm text-gray-500",children:"Create aliases for your model groups to simplify API calls. For example, you can create an alias 'gpt-4o' that points to 'gpt-4o-mini-openai' model group."})]}),(0,s.jsx)("div",{className:"flex items-center",children:x?(0,s.jsx)(e7.Z,{className:"w-5 h-5 text-gray-500"}):(0,s.jsx)(e9.Z,{className:"w-5 h-5 text-gray-500"})})]}),x&&(0,s.jsxs)("div",{className:"mt-4",children:[(0,s.jsxs)("div",{className:"mb-6",children:[(0,s.jsx)(lt.xv,{className:"text-sm font-medium text-gray-700 mb-2",children:"Add New Alias"}),(0,s.jsxs)("div",{className:"grid grid-cols-3 gap-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs text-gray-500 mb-1",children:"Alias Name"}),(0,s.jsx)("input",{type:"text",value:d.aliasName,onChange:e=>m({...d,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,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs text-gray-500 mb-1",children:"Target Model Group"}),(0,s.jsx)("input",{type:"text",value:d.targetModelGroup,onChange:e=>m({...d,targetModelGroup:e.target.value}),placeholder:"e.g., gpt-4o-mini-openai",className:"w-full px-3 py-2 border border-gray-300 rounded-md text-sm"})]}),(0,s.jsx)("div",{className:"flex items-end",children:(0,s.jsxs)("button",{onClick:j,disabled:!d.aliasName||!d.targetModelGroup,className:"flex items-center px-4 py-2 rounded-md text-sm ".concat(d.aliasName&&d.targetModelGroup?"bg-green-600 text-white hover:bg-green-700":"bg-gray-300 text-gray-500 cursor-not-allowed"),children:[(0,s.jsx)(le.Z,{className:"w-4 h-4 mr-1"}),"Add Alias"]})})]})]}),(0,s.jsx)(lt.xv,{className:"text-sm font-medium text-gray-700 mb-2",children:"Manage Existing Aliases"}),(0,s.jsx)("div",{className:"rounded-lg custom-border relative mb-6",children:(0,s.jsx)("div",{className:"overflow-x-auto",children:(0,s.jsxs)(lt.iA,{className:"[&_td]:py-0.5 [&_th]:py-1",children:[(0,s.jsx)(lt.ss,{children:(0,s.jsxs)(lt.SC,{children:[(0,s.jsx)(lt.xs,{className:"py-1 h-8",children:"Alias Name"}),(0,s.jsx)(lt.xs,{className:"py-1 h-8",children:"Target Model Group"}),(0,s.jsx)(lt.xs,{className:"py-1 h-8",children:"Actions"})]})}),(0,s.jsxs)(lt.RM,{children:[o.map(e=>(0,s.jsx)(lt.SC,{className:"h-8",children:u&&u.id===e.id?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(lt.pj,{className:"py-0.5",children:(0,s.jsx)("input",{type:"text",value:u.aliasName,onChange:e=>h({...u,aliasName:e.target.value}),className:"w-full px-2 py-1 border border-gray-300 rounded-md text-sm"})}),(0,s.jsx)(lt.pj,{className:"py-0.5",children:(0,s.jsx)("input",{type:"text",value:u.targetModelGroup,onChange:e=>h({...u,targetModelGroup:e.target.value}),className:"w-full px-2 py-1 border border-gray-300 rounded-md text-sm"})}),(0,s.jsx)(lt.pj,{className:"py-0.5 whitespace-nowrap",children:(0,s.jsxs)("div",{className:"flex space-x-2",children:[(0,s.jsx)("button",{onClick:_,className:"text-xs bg-blue-50 text-blue-600 px-2 py-1 rounded hover:bg-blue-100",children:"Save"}),(0,s.jsx)("button",{onClick:y,className:"text-xs bg-gray-50 text-gray-600 px-2 py-1 rounded hover:bg-gray-100",children:"Cancel"})]})})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(lt.pj,{className:"py-0.5 text-sm text-gray-900",children:e.aliasName}),(0,s.jsx)(lt.pj,{className:"py-0.5 text-sm text-gray-500",children:e.targetModelGroup}),(0,s.jsx)(lt.pj,{className:"py-0.5 whitespace-nowrap",children:(0,s.jsxs)("div",{className:"flex space-x-2",children:[(0,s.jsx)("button",{onClick:()=>v(e),className:"text-xs bg-blue-50 text-blue-600 px-2 py-1 rounded hover:bg-blue-100",children:(0,s.jsx)(ll.Z,{className:"w-3 h-3"})}),(0,s.jsx)("button",{onClick:()=>b(e.id),className:"text-xs bg-red-50 text-red-600 px-2 py-1 rounded hover:bg-red-100",children:(0,s.jsx)(p.Z,{className:"w-3 h-3"})})]})})]})},e.id)),0===o.length&&(0,s.jsx)(lt.SC,{children:(0,s.jsx)(lt.pj,{colSpan:3,className:"py-0.5 text-sm text-gray-500 text-center",children:"No aliases added yet. Add a new alias above."})})]})]})})}),(0,s.jsxs)(lt.Zb,{children:[(0,s.jsx)(lt.Dx,{className:"mb-4",children:"Configuration Example"}),(0,s.jsx)(lt.xv,{className:"text-gray-600 mb-4",children:"Here's how your current aliases would look in the config.yaml:"}),(0,s.jsx)("div",{className:"bg-gray-100 rounded-lg p-4 font-mono text-sm",children:(0,s.jsxs)("div",{className:"text-gray-700",children:["router_settings:",(0,s.jsx)("br",{}),"\xa0\xa0model_group_alias:",0===Object.keys(N).length?(0,s.jsxs)("span",{className:"text-gray-500",children:[(0,s.jsx)("br",{}),"\xa0\xa0\xa0\xa0# No aliases configured yet"]}):Object.entries(N).map(e=>{let[l,t]=e;return(0,s.jsxs)("span",{children:[(0,s.jsx)("br",{}),'\xa0\xa0\xa0\xa0"',l,'": "',t,'"']},l)})]})})]})]})]})},la=t(27281),lr=t(57365),lo=t(47323);let li=(e,l,t,a,r,o,i,n,c,m,u)=>[{header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Model ID"}),accessorKey:"model_info.id",cell:e=>{let{row:l}=e,t=l.original;return(0,s.jsx)(_.Z,{title:t.model_info.id,children:(0,s.jsx)("div",{className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left w-full truncate whitespace-nowrap cursor-pointer max-w-[15ch]",onClick:()=>a(t.model_info.id),children:t.model_info.id})})}},{header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Model Information"}),accessorKey:"model_name",size:250,cell:e=>{let{row:l}=e,t=l.original,a=o(l.original)||"-",r=(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("strong",{children:"Provider:"})," ",t.provider||"-"]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("strong",{children:"Public Model Name:"})," ",a]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("strong",{children:"LiteLLM Model Name:"})," ",t.litellm_model_name||"-"]})]});return(0,s.jsx)(_.Z,{title:r,children:(0,s.jsxs)("div",{className:"flex items-start space-x-2 min-w-0 w-full max-w-[250px]",children:[(0,s.jsx)("div",{className:"flex-shrink-0 mt-0.5",children:t.provider?(0,s.jsx)("img",{src:(0,d.dr)(t.provider).logo,alt:"".concat(t.provider," logo"),className:"w-4 h-4",onError:e=>{let l=e.target,s=l.parentElement;if(s){var a;let e=document.createElement("div");e.className="w-4 h-4 rounded-full bg-gray-200 flex items-center justify-center text-xs",e.textContent=(null===(a=t.provider)||void 0===a?void 0:a.charAt(0))||"-",s.replaceChild(e,l)}}}):(0,s.jsx)("div",{className:"w-4 h-4 rounded-full bg-gray-200 flex items-center justify-center text-xs",children:"-"})}),(0,s.jsxs)("div",{className:"flex flex-col min-w-0 flex-1",children:[(0,s.jsx)("div",{className:"text-xs font-medium text-gray-900 truncate max-w-[210px]",children:a}),(0,s.jsx)("div",{className:"text-xs text-gray-500 truncate mt-0.5 max-w-[210px]",children:t.litellm_model_name||"-"})]})]})})}},{header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Credentials"}),accessorKey:"litellm_credential_name",size:180,cell:e=>{var l;let{row:t}=e,a=null===(l=t.original.litellm_params)||void 0===l?void 0:l.litellm_credential_name;return a?(0,s.jsx)(_.Z,{title:"Credential: ".concat(a),children:(0,s.jsxs)("div",{className:"flex items-center space-x-2 max-w-[180px]",children:[(0,s.jsx)(X.Z,{className:"w-4 h-4 text-blue-500 flex-shrink-0"}),(0,s.jsx)("span",{className:"text-xs truncate",title:a,children:a})]})}):(0,s.jsxs)("div",{className:"flex items-center space-x-2 max-w-[180px]",children:[(0,s.jsx)(X.Z,{className:"w-4 h-4 text-gray-300 flex-shrink-0"}),(0,s.jsx)("span",{className:"text-xs text-gray-400",children:"No credentials"})]})}},{header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Created By"}),accessorKey:"model_info.created_by",sortingFn:"datetime",size:160,cell:e=>{let{row:l}=e,t=l.original,a=t.model_info.created_by,r=t.model_info.created_at?new Date(t.model_info.created_at).toLocaleDateString():null;return(0,s.jsxs)("div",{className:"flex flex-col min-w-0 max-w-[160px]",children:[(0,s.jsx)("div",{className:"text-xs font-medium text-gray-900 truncate",title:a||"Unknown",children:a||"Unknown"}),(0,s.jsx)("div",{className:"text-xs text-gray-500 truncate mt-0.5",title:r||"Unknown date",children:r||"Unknown date"})]})}},{header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Updated At"}),accessorKey:"model_info.updated_at",sortingFn:"datetime",cell:e=>{let{row:l}=e,t=l.original;return(0,s.jsx)("span",{className:"text-xs",children:t.model_info.updated_at?new Date(t.model_info.updated_at).toLocaleDateString():"-"})}},{header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Costs"}),accessorKey:"input_cost",size:120,cell:e=>{let{row:l}=e,t=l.original,a=t.input_cost,r=t.output_cost;return a||r?(0,s.jsx)(_.Z,{title:"Cost per 1M tokens",children:(0,s.jsxs)("div",{className:"flex flex-col min-w-0 max-w-[120px]",children:[a&&(0,s.jsxs)("div",{className:"text-xs font-medium text-gray-900 truncate",children:["In: $",a]}),r&&(0,s.jsxs)("div",{className:"text-xs text-gray-500 truncate mt-0.5",children:["Out: $",r]})]})}):(0,s.jsx)("div",{className:"max-w-[120px]",children:(0,s.jsx)("span",{className:"text-xs text-gray-400",children:"-"})})}},{header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Team ID"}),accessorKey:"model_info.team_id",cell:e=>{let{row:l}=e,t=l.original;return t.model_info.team_id?(0,s.jsx)("div",{className:"overflow-hidden",children:(0,s.jsx)(_.Z,{title:t.model_info.team_id,children:(0,s.jsxs)(z.Z,{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]",onClick:()=>r(t.model_info.team_id),children:[t.model_info.team_id.slice(0,7),"..."]})})}):"-"}},{header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Model Access Group"}),accessorKey:"model_info.model_access_group",enableSorting:!1,cell:e=>{let{row:l}=e,t=l.original,a=t.model_info.access_groups;if(!a||0===a.length)return"-";let r=t.model_info.id,o=m.has(r),i=a.length>1,n=()=>{let e=new Set(m);o?e.delete(r):e.add(r),u(e)};return(0,s.jsxs)("div",{className:"flex items-center gap-1 overflow-hidden",children:[(0,s.jsx)(eX.Z,{size:"xs",color:"blue",className:"text-xs px-1.5 py-0.5 h-5 leading-tight flex-shrink-0",children:a[0]}),(o||!i&&2===a.length)&&a.slice(1).map((e,l)=>(0,s.jsx)(eX.Z,{size:"xs",color:"blue",className:"text-xs px-1.5 py-0.5 h-5 leading-tight flex-shrink-0",children:e},l+1)),i&&(0,s.jsx)("button",{onClick:e=>{e.stopPropagation(),n()},className:"text-xs text-blue-600 hover:text-blue-800 px-1 py-0.5 rounded hover:bg-blue-50 h-5 leading-tight flex-shrink-0 whitespace-nowrap",children:o?"−":"+".concat(a.length-1)})]})}},{header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Status"}),accessorKey:"model_info.db_model",cell:e=>{let{row:l}=e,t=l.original;return(0,s.jsx)("div",{className:"\n inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium\n ".concat(t.model_info.db_model?"bg-blue-50 text-blue-600":"bg-gray-100 text-gray-600","\n "),children:t.model_info.db_model?"DB Model":"Config Model"})}},{id:"actions",header:"",cell:t=>{var r;let{row:o}=t,i=o.original,n="Admin"===e||(null===(r=i.model_info)||void 0===r?void 0:r.created_by)===l;return(0,s.jsx)("div",{className:"flex items-center justify-end gap-2 pr-4",children:(0,s.jsx)(lo.Z,{icon:p.Z,size:"sm",onClick:()=>{n&&(a(i.model_info.id),c(!1))},className:n?"cursor-pointer":"opacity-50 cursor-not-allowed"})})}}];var ln=t(11318),ld=t(39760),lc=e=>{let{selectedModelGroup:l,setSelectedModelGroup:t,availableModelGroups:r,availableModelAccessGroups:n,setSelectedModelId:d,setSelectedTeamId:c,setEditModel:m,modelData:u}=e,{userId:h,userRole:x,premiumUser:p}=(0,ld.Z)(),{teams:g}=(0,ln.Z)(),[f,j]=(0,a.useState)(""),[v,_]=(0,a.useState)("current_team"),[y,b]=(0,a.useState)("personal"),[N,w]=(0,a.useState)(!1),[k,C]=(0,a.useState)(null),[Z,S]=(0,a.useState)(new Set),[A,I]=(0,a.useState)({pageIndex:0,pageSize:50}),E=(0,a.useRef)(null),P=(0,a.useMemo)(()=>u&&u.data&&0!==u.data.length?u.data.filter(e=>{var t,s,a,r,o;let i=""===f||e.model_name.toLowerCase().includes(f.toLowerCase()),n="all"===l||e.model_name===l||!l||"wildcard"===l&&(null===(t=e.model_name)||void 0===t?void 0:t.includes("*")),d="all"===k||(null===(s=e.model_info.access_groups)||void 0===s?void 0:s.includes(k))||!k,c=!0;return"current_team"===v&&(c="personal"===y?(null===(a=e.model_info)||void 0===a?void 0:a.direct_access)===!0:(null===(o=e.model_info)||void 0===o?void 0:null===(r=o.access_via_team_ids)||void 0===r?void 0:r.includes(y))===!0),i&&n&&d&&c}):[],[u,f,l,k,y,v]),M=(0,a.useMemo)(()=>{let e=A.pageIndex*A.pageSize,l=e+A.pageSize;return P.slice(e,l)},[P,A.pageIndex,A.pageSize]);return(0,a.useEffect)(()=>{I(e=>({...e,pageIndex:0}))},[f,l,k,y,v]),(0,s.jsx)(H.Z,{children:(0,s.jsx)(o.Z,{children:(0,s.jsx)("div",{className:"flex flex-col space-y-4",children:(0,s.jsxs)("div",{className:"bg-white rounded-lg shadow",children:[(0,s.jsxs)("div",{className:"border-b px-6 py-4 bg-gray-50",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"flex items-center gap-4",children:[(0,s.jsx)(i.Z,{className:"text-lg font-semibold text-gray-900",children:"Current Team:"}),(0,s.jsxs)(la.Z,{className:"w-80",defaultValue:"personal",value:y,onValueChange:e=>b(e),children:[(0,s.jsx)(lr.Z,{value:"personal",children:(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:"Personal"})]})}),null==g?void 0:g.filter(e=>e.team_id).map(e=>(0,s.jsx)(lr.Z,{value:e.team_id,children:(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.team_alias?"".concat(e.team_alias.slice(0,30),"..."):"Team ".concat(e.team_id.slice(0,30),"...")})]})},e.team_id))]})]}),(0,s.jsxs)("div",{className:"flex items-center gap-4",children:[(0,s.jsx)(i.Z,{className:"text-lg font-semibold text-gray-900",children:"View:"}),(0,s.jsxs)(la.Z,{className:"w-64",defaultValue:"current_team",value:v,onValueChange:e=>_(e),children:[(0,s.jsx)(lr.Z,{value:"current_team",children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-purple-500 rounded-full"}),(0,s.jsx)("span",{className:"font-medium",children:"Current Team Models"})]})}),(0,s.jsx)(lr.Z,{value:"all",children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-gray-500 rounded-full"}),(0,s.jsx)("span",{className:"font-medium",children:"All Available Models"})]})})]})]})]}),"current_team"===v&&(0,s.jsxs)("div",{className:"flex items-start gap-2 mt-3",children:[(0,s.jsx)(el.Z,{className:"text-gray-400 mt-0.5 flex-shrink-0 text-xs"}),(0,s.jsx)("div",{className:"text-xs text-gray-500",children:"personal"===y?(0,s.jsxs)("span",{children:["To access these models: Create a Virtual Key without selecting a team on the"," ",(0,s.jsx)("a",{href:"/public?login=success&page=api-keys",className:"text-gray-600 hover:text-gray-800 underline",children:"Virtual Keys page"})]}):(0,s.jsxs)("span",{children:['To access these models: Create a Virtual Key and select Team as "',y,'" on the'," ",(0,s.jsx)("a",{href:"/public?login=success&page=api-keys",className:"text-gray-600 hover:text-gray-800 underline",children:"Virtual Keys page"})]})})]})]}),(0,s.jsx)("div",{className:"border-b px-6 py-4",children:(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 model names...",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:f,onChange:e=>j(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 ".concat(N?"bg-gray-100":""),onClick:()=>w(!N),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"]}),(0,s.jsxs)("button",{className:"px-3 py-2 text-sm border rounded-md hover:bg-gray-50 flex items-center gap-2",onClick:()=>{j(""),t("all"),C(null),b("personal"),_("current_team"),I({pageIndex:0,pageSize:50})},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"]})]}),N&&(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-3 mt-3",children:[(0,s.jsx)("div",{className:"w-64",children:(0,s.jsxs)(la.Z,{value:null!=l?l:"all",onValueChange:e=>t("all"===e?"all":e),placeholder:"Filter by Public Model Name",children:[(0,s.jsx)(lr.Z,{value:"all",children:"All Models"}),(0,s.jsx)(lr.Z,{value:"wildcard",children:"Wildcard Models (*)"}),r.map((e,l)=>(0,s.jsx)(lr.Z,{value:e,children:e},l))]})}),(0,s.jsx)("div",{className:"w-64",children:(0,s.jsxs)(la.Z,{value:null!=k?k:"all",onValueChange:e=>C("all"===e?null:e),placeholder:"Filter by Model Access Group",children:[(0,s.jsx)(lr.Z,{value:"all",children:"All Model Access Groups"}),n.map((e,l)=>(0,s.jsx)(lr.Z,{value:e,children:e},l))]})})]}),(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsx)("span",{className:"text-sm text-gray-700",children:P.length>0?"Showing ".concat(A.pageIndex*A.pageSize+1," - ").concat(Math.min((A.pageIndex+1)*A.pageSize,P.length)," of ").concat(P.length," results"):"Showing 0 results"}),P.length>A.pageSize&&(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("button",{onClick:()=>I(e=>({...e,pageIndex:e.pageIndex-1})),disabled:0===A.pageIndex,className:"px-3 py-1 text-sm border rounded-md ".concat(0===A.pageIndex?"bg-gray-100 text-gray-400 cursor-not-allowed":"hover:bg-gray-50"),children:"Previous"}),(0,s.jsx)("button",{onClick:()=>I(e=>({...e,pageIndex:e.pageIndex+1})),disabled:A.pageIndex>=Math.ceil(P.length/A.pageSize)-1,className:"px-3 py-1 text-sm border rounded-md ".concat(A.pageIndex>=Math.ceil(P.length/A.pageSize)-1?"bg-gray-100 text-gray-400 cursor-not-allowed":"hover:bg-gray-50"),children:"Next"})]})]})]})}),(0,s.jsx)(e0.C,{columns:li(x,h,p,d,c,O,()=>{},()=>{},m,Z,S),data:M,isLoading:!1,table:E})]})})})})},lm=t(93142),lu=t(867),lh=t(3810),lx=t(89245),lp=t(5540),lg=t(8881);let{Text:lf}=g.default;var lj=e=>{let{accessToken:l,onReloadSuccess:t,buttonText:r="Reload Price Data",showIcon:o=!0,size:i="middle",type:d="primary",className:m=""}=e,[u,h]=(0,a.useState)(!1),[x,p]=(0,a.useState)(!1),[g,f]=(0,a.useState)(!1),[v,_]=(0,a.useState)(!1),[b,N]=(0,a.useState)(6),[w,k]=(0,a.useState)(null),[C,Z]=(0,a.useState)(!1);(0,a.useEffect)(()=>{S();let e=setInterval(()=>{S()},3e4);return()=>clearInterval(e)},[l]);let S=async()=>{if(l){Z(!0);try{console.log("Fetching reload status...");let e=await (0,n.getModelCostMapReloadStatus)(l);console.log("Received status:",e),k(e)}catch(e){console.error("Failed to fetch reload status:",e),k({scheduled:!1,interval_hours:null,last_run:null,next_run:null})}finally{Z(!1)}}},A=async()=>{if(!l){c.Z.fromBackend("No access token available");return}h(!0);try{let e=await (0,n.reloadModelCostMap)(l);"success"===e.status?(c.Z.success("Price data reloaded successfully! ".concat(e.models_count||0," models updated.")),null==t||t(),await S()):c.Z.fromBackend("Failed to reload price data")}catch(e){console.error("Error reloading price data:",e),c.Z.fromBackend("Failed to reload price data. Please try again.")}finally{h(!1)}},I=async()=>{if(!l){c.Z.fromBackend("No access token available");return}if(b<=0){c.Z.fromBackend("Hours must be greater than 0");return}p(!0);try{let e=await (0,n.scheduleModelCostMapReload)(l,b);"success"===e.status?(c.Z.success("Periodic reload scheduled for every ".concat(b," hours")),_(!1),await S()):c.Z.fromBackend("Failed to schedule periodic reload")}catch(e){console.error("Error scheduling reload:",e),c.Z.fromBackend("Failed to schedule periodic reload. Please try again.")}finally{p(!1)}},E=async()=>{if(!l){c.Z.fromBackend("No access token available");return}f(!0);try{let e=await (0,n.cancelModelCostMapReload)(l);"success"===e.status?(c.Z.success("Periodic reload cancelled successfully"),await S()):c.Z.fromBackend("Failed to cancel periodic reload")}catch(e){console.error("Error cancelling reload:",e),c.Z.fromBackend("Failed to cancel periodic reload. Please try again.")}finally{f(!1)}},P=e=>{if(!e)return"Never";try{return new Date(e).toLocaleString()}catch(l){return e}};return(0,s.jsxs)("div",{className:m,children:[(0,s.jsxs)(lm.Z,{direction:"horizontal",size:"middle",style:{marginBottom:16},children:[(0,s.jsx)(lu.Z,{title:"Hard Refresh Price Data",description:"This will immediately fetch the latest pricing information from the remote source. Continue?",onConfirm:A,okText:"Yes",cancelText:"No",okButtonProps:{style:{backgroundColor:"#6366f1",borderColor:"#6366f1",color:"white",fontWeight:"500",borderRadius:"0.375rem",padding:"0.375rem 0.75rem",height:"auto",fontSize:"0.875rem",lineHeight:"1.25rem",transition:"all 0.2s ease-in-out"},onMouseEnter:e=>{e.currentTarget.style.backgroundColor="#4f46e5"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="#6366f1"}},children:(0,s.jsx)(y.ZP,{type:d,size:i,loading:u,icon:o?(0,s.jsx)(lx.Z,{}):void 0,style:{backgroundColor:"#6366f1",borderColor:"#6366f1",color:"white",fontWeight:"500",borderRadius:"0.375rem",padding:"0.375rem 0.75rem",height:"auto",fontSize:"0.875rem",lineHeight:"1.25rem",transition:"all 0.2s ease-in-out"},onMouseEnter:e=>{e.currentTarget.style.backgroundColor="#4f46e5"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="#6366f1"},children:r})}),(null==w?void 0:w.scheduled)?(0,s.jsx)(y.ZP,{type:"default",size:i,danger:!0,icon:(0,s.jsx)(lg.Z,{}),loading:g,onClick:E,style:{borderColor:"#ff4d4f",color:"#ff4d4f",fontWeight:"500",borderRadius:"0.375rem",padding:"0.375rem 0.75rem",height:"auto",fontSize:"0.875rem",lineHeight:"1.25rem"},children:"Cancel Periodic Reload"}):(0,s.jsx)(y.ZP,{type:"default",size:i,icon:(0,s.jsx)(lp.Z,{}),onClick:()=>_(!0),style:{borderColor:"#d9d9d9",color:"#6366f1",fontWeight:"500",borderRadius:"0.375rem",padding:"0.375rem 0.75rem",height:"auto",fontSize:"0.875rem",lineHeight:"1.25rem"},children:"Set Up Periodic Reload"})]}),w&&(0,s.jsx)(ep.Z,{size:"small",style:{backgroundColor:"#f8f9fa",border:"1px solid #e9ecef",borderRadius:8},children:(0,s.jsxs)(lm.Z,{direction:"vertical",size:"small",style:{width:"100%"},children:[w.scheduled?(0,s.jsx)("div",{children:(0,s.jsxs)(lh.Z,{color:"green",icon:(0,s.jsx)(lp.Z,{}),children:["Scheduled every ",w.interval_hours," hours"]})}):(0,s.jsx)(lf,{type:"secondary",children:"No periodic reload scheduled"}),(0,s.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,s.jsx)(lf,{type:"secondary",style:{fontSize:"12px"},children:"Last run:"}),(0,s.jsx)(lf,{style:{fontSize:"12px"},children:P(w.last_run)})]}),w.scheduled&&(0,s.jsxs)(s.Fragment,{children:[w.next_run&&(0,s.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,s.jsx)(lf,{type:"secondary",style:{fontSize:"12px"},children:"Next run:"}),(0,s.jsx)(lf,{style:{fontSize:"12px"},children:P(w.next_run)})]}),(0,s.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,s.jsx)(lf,{type:"secondary",style:{fontSize:"12px"},children:"Status:"}),(0,s.jsx)(lh.Z,{color:(null==w?void 0:w.scheduled)?w.last_run?"success":"processing":"default",children:(null==w?void 0:w.scheduled)?w.last_run?"Active":"Ready":"Not scheduled"})]})]})]})}),(0,s.jsxs)(j.Z,{title:"Set Up Periodic Reload",open:v,onOk:I,onCancel:()=>_(!1),confirmLoading:x,okText:"Schedule",cancelText:"Cancel",okButtonProps:{style:{backgroundColor:"#6366f1",borderColor:"#6366f1",color:"white"}},children:[(0,s.jsx)("div",{style:{marginBottom:16},children:(0,s.jsx)(lf,{children:"Set up automatic reload of price data every:"})}),(0,s.jsx)("div",{style:{marginBottom:16},children:(0,s.jsx)(eg.Z,{min:1,max:168,value:b,onChange:e=>N(e||6),addonAfter:"hours",style:{width:"100%"}})}),(0,s.jsx)("div",{children:(0,s.jsxs)(lf,{type:"secondary",children:["This will automatically fetch the latest pricing data from the remote source every ",b," hours."]})})]})]})},lv=e=>{let{setModelMap:l}=e,{accessToken:t}=(0,ld.Z)();return(0,s.jsx)(H.Z,{children:(0,s.jsxs)("div",{className:"p-6",children:[(0,s.jsxs)("div",{className:"mb-6",children:[(0,s.jsx)(Y.Z,{children:"Price Data Management"}),(0,s.jsx)(i.Z,{className:"text-tremor-content",children:"Manage model pricing data and configure automatic reload schedules"})]}),(0,s.jsx)(lj,{accessToken:t,onReloadSuccess:()=>{(async()=>{l(await (0,n.modelCostMap)(t))})()},buttonText:"Reload Price Data",size:"middle",type:"primary",className:"w-full"})]})})};let l_={"BadRequestError (400)":"BadRequestErrorRetries","AuthenticationError (401)":"AuthenticationErrorRetries","TimeoutError (408)":"TimeoutErrorRetries","RateLimitError (429)":"RateLimitErrorRetries","ContentPolicyViolationError (400)":"ContentPolicyViolationErrorRetries","InternalServerError (500)":"InternalServerErrorRetries"};var ly=e=>{let{selectedModelGroup:l,setSelectedModelGroup:t,availableModelGroups:a,globalRetryPolicy:r,setGlobalRetryPolicy:o,defaultRetry:n,modelGroupRetryPolicy:d,setModelGroupRetryPolicy:c,handleSaveRetrySettings:m}=e;return(0,s.jsxs)(H.Z,{children:[(0,s.jsx)("div",{className:"flex items-center gap-4 mb-6",children:(0,s.jsxs)("div",{className:"flex items-center",children:[(0,s.jsx)(i.Z,{children:"Retry Policy Scope:"}),(0,s.jsxs)(la.Z,{className:"ml-2 w-48",defaultValue:"global",value:"global"===l?"global":l||a[0],onValueChange:e=>t(e),children:[(0,s.jsx)(lr.Z,{value:"global",children:"Global Default"}),a.map((e,l)=>(0,s.jsx)(lr.Z,{value:e,onClick:()=>t(e),children:e},l))]})]})}),"global"===l?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(Y.Z,{children:"Global Retry Policy"}),(0,s.jsx)(i.Z,{className:"mb-6",children:"Default retry settings applied to all model groups unless overridden"})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(Y.Z,{children:["Retry Policy for ",l]}),(0,s.jsx)(i.Z,{className:"mb-6",children:"Model-specific retry settings. Falls back to global defaults if not set."})]}),l_&&(0,s.jsx)("table",{children:(0,s.jsx)("tbody",{children:Object.entries(l_).map((e,t)=>{var a,m,u,h;let x,[p,g]=e;if("global"===l)x=null!==(a=null==r?void 0:r[g])&&void 0!==a?a:n;else{let e=null==d?void 0:null===(m=d[l])||void 0===m?void 0:m[g];x=null!=e?e:null!==(u=null==r?void 0:r[g])&&void 0!==u?u:n}return(0,s.jsxs)("tr",{className:"flex justify-between items-center mt-2",children:[(0,s.jsxs)("td",{children:[(0,s.jsx)(i.Z,{children:p}),"global"!==l&&(0,s.jsxs)(i.Z,{className:"text-xs text-gray-500 ml-2",children:["(Global: ",null!==(h=null==r?void 0:r[g])&&void 0!==h?h:n,")"]})]}),(0,s.jsx)("td",{children:(0,s.jsx)(eg.Z,{className:"ml-5",value:x,min:0,step:1,onChange:e=>{"global"===l?o(l=>null==e?l:{...null!=l?l:{},[g]:e}):c(t=>{var s;let a=null!==(s=null==t?void 0:t[l])&&void 0!==s?s:{};return{...null!=t?t:{},[l]:{...a,[g]:e}}})}})})]},t)})})}),(0,s.jsx)(z.Z,{className:"mt-6 mr-8",onClick:m,children:"Save"})]})},lb=t(75105),lN=t(40278),lw=t(97765),lk=t(21626),lC=t(97214),lZ=t(28241),lS=t(58834),lA=t(69552),lI=t(71876),lE=t(39789),lP=t(79326),lM=t(2356),lF=t(59664),lL=e=>{let{modelMetrics:l,modelMetricsCategories:t,customTooltip:a,premiumUser:r}=e;return(0,s.jsx)(lF.Z,{title:"Time to First token (s)",className:"h-72",data:l,index:"date",showLegend:!1,categories:t,colors:["indigo","rose"],connectNulls:!0,customTooltip:a})},lT=e=>{let{setSelectedAPIKey:l,keys:t,teams:r,setSelectedCustomer:o,allEndUsers:n}=e,{premiumUser:d}=(0,ld.Z)(),[c,m]=(0,a.useState)(null);return(0,s.jsxs)("div",{children:[(0,s.jsx)(i.Z,{className:"mb-1",children:"Select API Key Name"}),d?(0,s.jsxs)("div",{children:[(0,s.jsxs)(la.Z,{defaultValue:"all-keys",children:[(0,s.jsx)(lr.Z,{value:"all-keys",onClick:()=>{l(null)},children:"All Keys"},"all-keys"),null==t?void 0:t.map((e,t)=>e&&null!==e.key_alias&&e.key_alias.length>0?(0,s.jsx)(lr.Z,{value:String(t),onClick:()=>{l(e)},children:e.key_alias},t):null)]}),(0,s.jsx)(i.Z,{className:"mt-1",children:"Select Customer Name"}),(0,s.jsxs)(la.Z,{defaultValue:"all-customers",children:[(0,s.jsx)(lr.Z,{value:"all-customers",onClick:()=>{o(null)},children:"All Customers"},"all-customers"),null==n?void 0:n.map((e,l)=>(0,s.jsx)(lr.Z,{value:e,onClick:()=>{o(e)},children:e},l))]}),(0,s.jsx)(i.Z,{className:"mt-1",children:"Select Team"}),(0,s.jsxs)(la.Z,{className:"w-64 relative z-50",defaultValue:"all",value:null!=c?c:"all",onValueChange:e=>m("all"===e?null:e),children:[(0,s.jsx)(lr.Z,{value:"all",children:"All Teams"}),null==r?void 0:r.filter(e=>e.team_id).map(e=>(0,s.jsx)(lr.Z,{value:e.team_id,children:e.team_alias?"".concat(e.team_alias," (").concat(e.team_id.slice(0,8),"...)"):"Team ".concat(e.team_id.slice(0,8),"...")},e.team_id))]})]}):(0,s.jsxs)("div",{children:[(0,s.jsx)(i.Z,{className:"mt-1",children:"Select Team"}),(0,s.jsxs)(la.Z,{className:"w-64 relative z-50",defaultValue:"all",value:null!=c?c:"all",onValueChange:e=>m("all"===e?null:e),children:[(0,s.jsx)(lr.Z,{value:"all",children:"All Teams"}),null==r?void 0:r.filter(e=>e.team_id).map(e=>(0,s.jsx)(lr.Z,{value:e.team_id,children:e.team_alias?"".concat(e.team_alias," (").concat(e.team_id.slice(0,8),"...)"):"Team ".concat(e.team_id.slice(0,8),"...")},e.team_id))]})]})]})},lR=e=>{let{dateValue:l,setDateValue:t,selectedModelGroup:d,availableModelGroups:c,setShowAdvancedFilters:m,modelMetrics:u,modelMetricsCategories:h,streamingModelMetrics:x,streamingModelMetricsCategories:p,customTooltip:g,slowResponsesData:f,modelExceptions:j,globalExceptionData:v,allExceptions:_,globalExceptionPerDeployment:y,setSelectedAPIKey:b,keys:N,setSelectedCustomer:w,teams:k,allEndUsers:C,selectedAPIKey:Z,selectedCustomer:S,selectedTeam:A,setSelectedModelGroup:I,setModelMetrics:E,setModelMetricsCategories:P,setStreamingModelMetrics:M,setStreamingModelMetricsCategories:F,setSlowResponsesData:L,setModelExceptions:T,setAllExceptions:R,setGlobalExceptionData:O,setGlobalExceptionPerDeployment:V}=e,{accessToken:D,userId:q,userRole:W,premiumUser:$}=(0,ld.Z)();(0,a.useEffect)(()=>{Q(d,l.from,l.to)},[Z,S,A]);let Q=async(e,l,t)=>{if(console.log("Updating model metrics for group:",e),!D||!q||!W||!l||!t)return;console.log("inside updateModelMetrics - startTime:",l,"endTime:",t),I(e);let s=null==Z?void 0:Z.token;void 0===s&&(s=null);let a=S;void 0===a&&(a=null);try{let r=await (0,n.modelMetricsCall)(D,q,W,e,l.toISOString(),t.toISOString(),s,a);console.log("Model metrics response:",r),E(r.data),P(r.all_api_bases);let o=await (0,n.streamingModelMetricsCall)(D,e,l.toISOString(),t.toISOString());M(o.data),F(o.all_api_bases);let i=await (0,n.modelExceptionsCall)(D,q,W,e,l.toISOString(),t.toISOString(),s,a);console.log("Model exceptions response:",i),T(i.data),R(i.exception_types);let d=await (0,n.modelMetricsSlowResponsesCall)(D,q,W,e,l.toISOString(),t.toISOString(),s,a);if(console.log("slowResponses:",d),L(d),e){let s=await (0,n.adminGlobalActivityExceptions)(D,null==l?void 0:l.toISOString().split("T")[0],null==t?void 0:t.toISOString().split("T")[0],e);O(s);let a=await (0,n.adminGlobalActivityExceptionsPerDeployment)(D,null==l?void 0:l.toISOString().split("T")[0],null==t?void 0:t.toISOString().split("T")[0],e);V(a)}}catch(e){console.error("Failed to fetch model metrics",e)}};return(0,s.jsxs)(H.Z,{children:[(0,s.jsxs)(o.Z,{numItems:4,className:"mt-2 mb-2",children:[(0,s.jsx)(r.Z,{children:(0,s.jsx)(lE.Z,{value:l,className:"mr-2",onValueChange:e=>{t(e),Q(d,e.from,e.to)}})}),(0,s.jsxs)(r.Z,{className:"ml-2",children:[(0,s.jsx)(i.Z,{children:"Select Model Group"}),(0,s.jsx)(la.Z,{defaultValue:d||c[0],value:d||c[0],children:c.map((e,t)=>(0,s.jsx)(lr.Z,{value:e,onClick:()=>Q(e,l.from,l.to),children:e},t))})]}),(0,s.jsx)(r.Z,{children:(0,s.jsx)(lP.Z,{trigger:"click",content:(0,s.jsx)(lT,{allEndUsers:C,keys:N,setSelectedAPIKey:b,setSelectedCustomer:w,teams:k}),overlayStyle:{width:"20vw"},children:(0,s.jsx)(z.Z,{icon:lM.Z,size:"md",variant:"secondary",className:"mt-4 ml-2",style:{border:"none"},onClick:()=>m(!0)})})})]}),(0,s.jsxs)(o.Z,{numItems:2,children:[(0,s.jsx)(r.Z,{children:(0,s.jsx)(B.Z,{className:"mr-2 max-h-[400px] min-h-[400px]",children:(0,s.jsxs)(U.Z,{children:[(0,s.jsxs)(G.Z,{variant:"line",defaultValue:"1",children:[(0,s.jsx)(K.Z,{value:"1",children:"Avg. Latency per Token"}),(0,s.jsx)(K.Z,{value:"2",children:"Time to first token"})]}),(0,s.jsxs)(J.Z,{children:[(0,s.jsxs)(H.Z,{children:[(0,s.jsx)("p",{className:"text-gray-500 italic",children:" (seconds/token)"}),(0,s.jsx)(i.Z,{className:"text-gray-500 italic mt-1 mb-1",children:"average Latency for successfull requests divided by the total tokens"}),u&&h&&(0,s.jsx)(lb.Z,{title:"Model Latency",className:"h-72",data:u,showLegend:!1,index:"date",categories:h,connectNulls:!0,customTooltip:g})]}),(0,s.jsx)(H.Z,{children:(0,s.jsx)(lL,{modelMetrics:x,modelMetricsCategories:p,customTooltip:g,premiumUser:$})})]})]})})}),(0,s.jsx)(r.Z,{children:(0,s.jsx)(B.Z,{className:"ml-2 max-h-[400px] min-h-[400px] overflow-y-auto",children:(0,s.jsxs)(lk.Z,{children:[(0,s.jsx)(lS.Z,{children:(0,s.jsxs)(lI.Z,{children:[(0,s.jsx)(lA.Z,{children:"Deployment"}),(0,s.jsx)(lA.Z,{children:"Success Responses"}),(0,s.jsxs)(lA.Z,{children:["Slow Responses ",(0,s.jsx)("p",{children:"Success Responses taking 600+s"})]})]})}),(0,s.jsx)(lC.Z,{children:f.map((e,l)=>(0,s.jsxs)(lI.Z,{children:[(0,s.jsx)(lZ.Z,{children:e.api_base}),(0,s.jsx)(lZ.Z,{children:e.total_count}),(0,s.jsx)(lZ.Z,{children:e.slow_count})]},l))})]})})})]}),(0,s.jsx)(o.Z,{numItems:1,className:"gap-2 w-full mt-2",children:(0,s.jsxs)(B.Z,{children:[(0,s.jsxs)(Y.Z,{children:["All Exceptions for ",d]}),(0,s.jsx)(lN.Z,{className:"h-60",data:j,index:"model",categories:_,stack:!0,yAxisWidth:30})]})}),(0,s.jsxs)(o.Z,{numItems:1,className:"gap-2 w-full mt-2",children:[(0,s.jsxs)(B.Z,{children:[(0,s.jsxs)(Y.Z,{children:["All Up Rate Limit Errors (429) for ",d]}),(0,s.jsxs)(o.Z,{numItems:1,children:[(0,s.jsxs)(r.Z,{children:[(0,s.jsxs)(lw.Z,{style:{fontSize:"15px",fontWeight:"normal",color:"#535452"},children:["Num Rate Limit Errors ",v.sum_num_rate_limit_exceptions]}),(0,s.jsx)(lN.Z,{className:"h-40",data:v.daily_data,index:"date",colors:["rose"],categories:["num_rate_limit_exceptions"],onValueChange:e=>console.log(e)})]}),(0,s.jsx)(r.Z,{})]})]}),$?(0,s.jsx)(s.Fragment,{children:y.map((e,l)=>(0,s.jsxs)(B.Z,{children:[(0,s.jsx)(Y.Z,{children:e.api_base?e.api_base:"Unknown API Base"}),(0,s.jsx)(o.Z,{numItems:1,children:(0,s.jsxs)(r.Z,{children:[(0,s.jsxs)(lw.Z,{style:{fontSize:"15px",fontWeight:"normal",color:"#535452"},children:["Num Rate Limit Errors (429) ",e.sum_num_rate_limit_exceptions]}),(0,s.jsx)(lN.Z,{className:"h-40",data:e.daily_data,index:"date",colors:["rose"],categories:["num_rate_limit_exceptions"],onValueChange:e=>console.log(e)})]})})]},l))}):(0,s.jsx)(s.Fragment,{children:y&&y.length>0&&y.slice(0,1).map((e,l)=>(0,s.jsxs)(B.Z,{children:[(0,s.jsx)(Y.Z,{children:"✨ Rate Limit Errors by Deployment"}),(0,s.jsx)("p",{className:"mb-2 text-gray-500 italic text-[12px]",children:"Upgrade to see exceptions for all deployments"}),(0,s.jsx)(z.Z,{variant:"primary",className:"mb-2",children:(0,s.jsx)("a",{href:"https://forms.gle/W3U4PZpJGFHWtHyA9",target:"_blank",children:"Get Free Trial"})}),(0,s.jsxs)(B.Z,{children:[(0,s.jsx)(Y.Z,{children:e.api_base}),(0,s.jsx)(o.Z,{numItems:1,children:(0,s.jsxs)(r.Z,{children:[(0,s.jsxs)(lw.Z,{style:{fontSize:"15px",fontWeight:"normal",color:"#535452"},children:["Num Rate Limit Errors ",e.sum_num_rate_limit_exceptions]}),(0,s.jsx)(lN.Z,{className:"h-40",data:e.daily_data,index:"date",colors:["rose"],categories:["num_rate_limit_exceptions"],onValueChange:e=>console.log(e)})]})})]})]},l))})]})]})},lO=e=>{let{accessToken:l,token:t,userRole:m,userID:h,modelData:x={data:[]},keys:p,setModelData:j,premiumUser:v,teams:_}=e,[y]=f.Z.useForm(),[b,N]=(0,a.useState)(null),[w,k]=(0,a.useState)(""),[C,Z]=(0,a.useState)([]),[S,A]=(0,a.useState)([]),[I,E]=(0,a.useState)(d.Cl.OpenAI),[P,M]=(0,a.useState)(!1),[F,L]=(0,a.useState)(null),[T,z]=(0,a.useState)([]),[B,K]=(0,a.useState)([]),[U,G]=(0,a.useState)(null),[H,J]=(0,a.useState)([]),[W,Y]=(0,a.useState)([]),[$,Q]=(0,a.useState)([]),[X,ee]=(0,a.useState)([]),[el,et]=(0,a.useState)([]),[es,ea]=(0,a.useState)([]),[er,eo]=(0,a.useState)([]),[ei,en]=(0,a.useState)({from:new Date(Date.now()-6048e5),to:new Date}),[ed,ec]=(0,a.useState)(null),[em,eu]=(0,a.useState)(null),[eh,ex]=(0,a.useState)(0),[ep,eg]=(0,a.useState)({}),[ef,ej]=(0,a.useState)([]),[ev,e_]=(0,a.useState)(!1),[ey,eb]=(0,a.useState)(null),[eN,ek]=(0,a.useState)(null),[eC,eZ]=(0,a.useState)([]),[eS,eA]=(0,a.useState)([]),[eI,eE]=(0,a.useState)({}),[eP,eM]=(0,a.useState)(!1),[eF,eL]=(0,a.useState)(null),[eT,eR]=(0,a.useState)(!1),[eO,eV]=(0,a.useState)(null),[eD,eq]=(0,a.useState)(null),[ez,eB]=(0,a.useState)(!1),eK=(0,a.useRef)(null),[eG,eH]=(0,a.useState)(0),eJ=async e=>{try{let l=await (0,n.credentialListCall)(e);console.log("credentials: ".concat(JSON.stringify(l))),eA(l.credentials)}catch(e){console.error("Error fetching credentials:",e)}};(0,a.useEffect)(()=>{let e=e=>{eK.current&&!eK.current.contains(e.target)&&eB(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);let eW={name:"file",accept:".json",beforeUpload:e=>{if("application/json"===e.type){let l=new FileReader;l.onload=e=>{if(e.target){let l=e.target.result;console.log("Resetting vertex_credentials to JSON; jsonStr: ".concat(l)),y.setFieldsValue({vertex_credentials:l}),console.log("Form values right after setting:",y.getFieldsValue())}},l.readAsText(e)}return!1},onChange(e){console.log("Upload onChange triggered with values:",e),console.log("Current form values:",y.getFieldsValue()),"uploading"!==e.file.status&&console.log(e.file,e.fileList),"done"===e.file.status?c.Z.success("".concat(e.file.name," file uploaded successfully")):"error"===e.file.status&&c.Z.fromBackend("".concat(e.file.name," file upload failed."))}},eY=()=>{k(new Date().toLocaleString())},e$=async()=>{if(!l){console.error("Access token is missing");return}try{let e={router_settings:{}};"global"===U?(console.log("Saving global retry policy:",em),em&&(e.router_settings.retry_policy=em),c.Z.success("Global retry settings saved successfully")):(console.log("Saving model group retry policy for",U,":",ed),ed&&(e.router_settings.model_group_retry_policy=ed),c.Z.success("Retry settings saved successfully for ".concat(U))),await (0,n.setCallbacksCall)(l,e)}catch(e){console.error("Failed to save retry settings:",e),c.Z.fromBackend("Failed to save retry settings")}};if((0,a.useEffect)(()=>{if(!l||!t||!m||!h)return;let e=async()=>{try{var e,t,s,a,r,o,i,d,c,u,x,p;let g=await (0,n.modelInfoCall)(l,h,m);console.log("Model data response:",g.data),j(g);let f=await (0,n.modelSettingsCall)(l);f&&A(f);let v=new Set;for(let e=0;e0&&(b=_[_.length-1],console.log("_initial_model_group:",b)),console.log("selectedModelGroup:",U);let N=await (0,n.modelMetricsCall)(l,h,m,b,null===(e=ei.from)||void 0===e?void 0:e.toISOString(),null===(t=ei.to)||void 0===t?void 0:t.toISOString(),null==ey?void 0:ey.token,eN);console.log("Model metrics response:",N),J(N.data),Y(N.all_api_bases);let w=await (0,n.streamingModelMetricsCall)(l,b,null===(s=ei.from)||void 0===s?void 0:s.toISOString(),null===(a=ei.to)||void 0===a?void 0:a.toISOString());Q(w.data),ee(w.all_api_bases);let k=await (0,n.modelExceptionsCall)(l,h,m,b,null===(r=ei.from)||void 0===r?void 0:r.toISOString(),null===(o=ei.to)||void 0===o?void 0:o.toISOString(),null==ey?void 0:ey.token,eN);console.log("Model exceptions response:",k),et(k.data),ea(k.exception_types);let C=await (0,n.modelMetricsSlowResponsesCall)(l,h,m,b,null===(i=ei.from)||void 0===i?void 0:i.toISOString(),null===(d=ei.to)||void 0===d?void 0:d.toISOString(),null==ey?void 0:ey.token,eN),Z=await (0,n.adminGlobalActivityExceptions)(l,null===(c=ei.from)||void 0===c?void 0:c.toISOString().split("T")[0],null===(u=ei.to)||void 0===u?void 0:u.toISOString().split("T")[0],b);eg(Z);let S=await (0,n.adminGlobalActivityExceptionsPerDeployment)(l,null===(x=ei.from)||void 0===x?void 0:x.toISOString().split("T")[0],null===(p=ei.to)||void 0===p?void 0:p.toISOString().split("T")[0],b);ej(S),console.log("dailyExceptions:",Z),console.log("dailyExceptionsPerDeplyment:",S),console.log("slowResponses:",C),eo(C);let I=await (0,n.allEndUsersCall)(l);eZ(null==I?void 0:I.map(e=>e.user_id));let E=(await (0,n.getCallbacksCall)(l,h,m)).router_settings;console.log("routerSettingsInfo:",E);let P=E.model_group_retry_policy,M=E.num_retries;console.log("model_group_retry_policy:",P),console.log("default_retries:",M),ec(P),eu(E.retry_policy),ex(M);let F=E.model_group_alias||{};eE(F)}catch(e){console.error("There was an error fetching the model data",e)}};l&&t&&m&&h&&e();let s=async()=>{let e=await (0,n.modelCostMap)(l);console.log("received model cost map data: ".concat(Object.keys(e))),N(e)};null==b&&s(),eY()},[l,t,m,h,b,w,eD]),!x||!l||!t||!m||!h)return(0,s.jsx)("div",{children:"Loading..."});let eX=[],e0=[];for(let e=0;e(console.log("GET PROVIDER CALLED! - ".concat(b)),null!=b&&"object"==typeof b&&e in b)?b[e].litellm_provider:"openai";if(t){let e=t.split("/"),l=e[0];(r=s)||(r=1===e.length?m(t):l)}else r="-";a&&(o=null==a?void 0:a.input_cost_per_token,i=null==a?void 0:a.output_cost_per_token,n=null==a?void 0:a.max_tokens,d=null==a?void 0:a.max_input_tokens),(null==l?void 0:l.litellm_params)&&(c=Object.fromEntries(Object.entries(null==l?void 0:l.litellm_params).filter(e=>{let[l]=e;return"model"!==l&&"api_base"!==l}))),x.data[e].provider=r,x.data[e].input_cost=o,x.data[e].output_cost=i,x.data[e].litellm_model_name=t,e0.push(r),x.data[e].input_cost&&(x.data[e].input_cost=(1e6*Number(x.data[e].input_cost)).toFixed(2)),x.data[e].output_cost&&(x.data[e].output_cost=(1e6*Number(x.data[e].output_cost)).toFixed(2)),x.data[e].max_tokens=n,x.data[e].max_input_tokens=d,x.data[e].api_base=null==l?void 0:null===(e4=l.litellm_params)||void 0===e4?void 0:e4.api_base,x.data[e].cleanedLitellmParams=c,eX.push(l.model_name),console.log(x.data[e])}if(m&&"Admin Viewer"==m){let{Title:e,Paragraph:l}=g.default;return(0,s.jsxs)("div",{children:[(0,s.jsx)(e,{level:1,children:"Access Denied"}),(0,s.jsx)(l,{children:"Ask your proxy admin for access to view all models"})]})}return(console.log("selectedProvider: ".concat(I)),console.log("providerModels.length: ".concat(C.length)),Object.keys(d.Cl).find(e=>d.Cl[e]===I),eO)?(0,s.jsx)("div",{className:"w-full h-full",children:(0,s.jsx)(q.Z,{teamId:eO,onClose:()=>eV(null),accessToken:l,is_team_admin:"Admin"===m,is_proxy_admin:"Proxy Admin"===m,userModels:eX,editTeam:!1,onUpdate:eY})}):(0,s.jsx)("div",{className:"w-full mx-4 h-[75vh]",children:(0,s.jsx)(o.Z,{numItems:1,className:"gap-2 p-8 w-full mt-2",children:(0,s.jsxs)(r.Z,{numColSpan:1,className:"flex flex-col gap-2",children:[(0,s.jsx)("div",{className:"flex justify-between items-center mb-4",children:(0,s.jsxs)("div",{children:[(0,s.jsx)("h2",{className:"text-lg font-semibold",children:"Model Management"}),eU.ZL.includes(m)?(0,s.jsx)("p",{className:"text-sm text-gray-600",children:"Add and manage models for the proxy"}):(0,s.jsx)("p",{className:"text-sm text-gray-600",children:"Add models for teams you are an admin for."})]})}),eF?(0,s.jsx)(ew,{modelId:eF,editModel:!0,onClose:()=>{eL(null),eR(!1)},modelData:x.data.find(e=>e.model_info.id===eF),accessToken:l,userID:h,userRole:m,setEditModalVisible:M,setSelectedModel:L,onModelUpdate:e=>{j({...x,data:x.data.map(l=>l.model_info.id===e.model_info.id?e:l)}),eY()},modelAccessGroups:B}):(0,s.jsxs)(V.v0,{index:eG,onIndexChange:eH,className:"gap-2 h-[75vh] w-full ",children:[(0,s.jsxs)(V.td,{className:"flex justify-between mt-2 w-full items-center",children:[(0,s.jsxs)("div",{className:"flex",children:[eU.ZL.includes(m)?(0,s.jsx)(V.OK,{children:"All Models"}):(0,s.jsx)(V.OK,{children:"Your Models"}),(0,s.jsx)(V.OK,{children:"Add Model"}),eU.ZL.includes(m)&&(0,s.jsx)(V.OK,{children:"LLM Credentials"}),eU.ZL.includes(m)&&(0,s.jsx)(V.OK,{children:"Pass-Through Endpoints"}),eU.ZL.includes(m)&&(0,s.jsx)(V.OK,{children:"Health Status"}),eU.ZL.includes(m)&&(0,s.jsx)(V.OK,{children:"Model Analytics"}),eU.ZL.includes(m)&&(0,s.jsx)(V.OK,{children:"Model Retry Settings"}),eU.ZL.includes(m)&&(0,s.jsx)(V.OK,{children:"Model Group Alias"}),eU.ZL.includes(m)&&(0,s.jsx)(V.OK,{children:"Price Data Reload"})]}),(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[w&&(0,s.jsxs)(i.Z,{children:["Last Refreshed: ",w]}),(0,s.jsx)(V.JO,{icon:D.Z,variant:"shadow",size:"xs",className:"self-center",onClick:eY})]})]}),(0,s.jsxs)(V.nP,{children:[(0,s.jsx)(lc,{selectedModelGroup:U,setSelectedModelGroup:G,availableModelGroups:T,availableModelAccessGroups:B,setSelectedModelId:eL,setSelectedTeamId:eV,setEditModel:eR,modelData:x}),(0,s.jsx)(V.x4,{className:"h-full",children:(0,s.jsx)(eQ,{form:y,handleOk:()=>{console.log("\uD83D\uDE80 handleOk called from model dashboard!"),console.log("Current form values:",y.getFieldsValue()),y.validateFields().then(e=>{console.log("✅ Validation passed, submitting:",e),u(e,l,y,eY)}).catch(e=>{var l;console.error("❌ Validation failed:",e),console.error("Form errors:",e.errorFields);let t=(null===(l=e.errorFields)||void 0===l?void 0:l.map(e=>"".concat(e.name.join("."),": ").concat(e.errors.join(", "))).join(" | "))||"Unknown validation error";c.Z.fromBackend("Please fill in the following required fields: ".concat(t))})},selectedProvider:I,setSelectedProvider:E,providerModels:C,setProviderModelsFn:e=>{let l=(0,d.bK)(e,b);Z(l),console.log("providerModels: ".concat(l))},getPlaceholder:d.ph,uploadProps:eW,showAdvancedSettings:eP,setShowAdvancedSettings:eM,teams:_,credentials:eS,accessToken:l,userRole:m,premiumUser:v})}),(0,s.jsx)(V.x4,{children:(0,s.jsx)(R,{accessToken:l,uploadProps:eW,credentialList:eS,fetchCredentials:eJ})}),(0,s.jsx)(V.x4,{children:(0,s.jsx)(e8.Z,{accessToken:l,userRole:m,userID:h,modelData:x,premiumUser:v})}),(0,s.jsx)(V.x4,{children:(0,s.jsx)(e3,{accessToken:l,modelData:x,all_models_on_proxy:eX,getDisplayModelName:O,setSelectedModelId:eL})}),(0,s.jsx)(lR,{dateValue:ei,setDateValue:en,selectedModelGroup:U,availableModelGroups:T,setShowAdvancedFilters:e_,modelMetrics:H,modelMetricsCategories:W,streamingModelMetrics:$,streamingModelMetricsCategories:X,customTooltip:e=>{var l,t;let{payload:a,active:r}=e;if(!r||!a)return null;let o=null===(t=a[0])||void 0===t?void 0:null===(l=t.payload)||void 0===l?void 0:l.date,i=a.sort((e,l)=>l.value-e.value);if(i.length>5){let e=i.length-5;(i=i.slice(0,5)).push({dataKey:"".concat(e," other deployments"),value:a.slice(5).reduce((e,l)=>e+l.value,0),color:"gray"})}return(0,s.jsxs)("div",{className:"w-150 rounded-tremor-default border border-tremor-border bg-tremor-background p-2 text-tremor-default shadow-tremor-dropdown",children:[o&&(0,s.jsxs)("p",{className:"text-tremor-content-emphasis mb-2",children:["Date: ",o]}),i.map((e,l)=>{let t=parseFloat(e.value.toFixed(5)),a=0===t&&e.value>0?"<0.00001":t.toFixed(5);return(0,s.jsxs)("div",{className:"flex justify-between",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 mt-1 rounded-full bg-".concat(e.color,"-500")}),(0,s.jsx)("p",{className:"text-tremor-content",children:e.dataKey})]}),(0,s.jsx)("p",{className:"font-medium text-tremor-content-emphasis text-righ ml-2",children:a})]},l)})]})},slowResponsesData:er,modelExceptions:el,globalExceptionData:ep,allExceptions:es,globalExceptionPerDeployment:ef,allEndUsers:eC,keys:p,setSelectedAPIKey:eb,setSelectedCustomer:ek,teams:_,selectedAPIKey:ey,selectedCustomer:eN,selectedTeam:eD,setAllExceptions:ea,setGlobalExceptionData:eg,setGlobalExceptionPerDeployment:ej,setModelExceptions:et,setModelMetrics:J,setModelMetricsCategories:Y,setSelectedModelGroup:G,setSlowResponsesData:eo,setStreamingModelMetrics:Q,setStreamingModelMetricsCategories:ee}),(0,s.jsx)(ly,{selectedModelGroup:U,setSelectedModelGroup:G,availableModelGroups:T,globalRetryPolicy:em,setGlobalRetryPolicy:eu,defaultRetry:eh,modelGroupRetryPolicy:ed,setModelGroupRetryPolicy:ec,handleSaveRetrySettings:e$}),(0,s.jsx)(V.x4,{children:(0,s.jsx)(ls,{accessToken:l,initialModelGroupAlias:eI,onAliasUpdate:eE})}),(0,s.jsx)(lv,{setModelMap:N})]})]})]})})})}},7166:function(e,l,t){t.d(l,{Z:function(){return J}});var s=t(57437),a=t(2265),r=t(20831),o=t(47323),i=t(84264),n=t(96761),d=t(19250),c=t(89970),m=t(33866),u=t(15731),h=t(53410),x=t(74998),p=t(92858),g=t(49566),f=t(12514),j=t(97765),v=t(52787),_=t(13634),y=t(82680),b=t(61778),N=t(24199),w=t(12660),k=t(15424),C=t(93142),Z=t(73002),S=t(45246),A=t(96473),I=t(31283),E=e=>{let{value:l={},onChange:t}=e,[r,o]=(0,a.useState)(Object.entries(l)),i=e=>{let l=r.filter((l,t)=>t!==e);o(l),null==t||t(Object.fromEntries(l))},n=(e,l,s)=>{let a=[...r];a[e]=[l,s],o(a),null==t||t(Object.fromEntries(a))};return(0,s.jsxs)("div",{children:[r.map((e,l)=>{let[t,a]=e;return(0,s.jsxs)(C.Z,{style:{display:"flex",marginBottom:8},align:"center",children:[(0,s.jsx)(I.o,{placeholder:"Header Name",value:t,onChange:e=>n(l,e.target.value,a)}),(0,s.jsx)(I.o,{placeholder:"Header Value",value:a,onChange:e=>n(l,t,e.target.value)}),(0,s.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%"},children:(0,s.jsx)(S.Z,{onClick:()=>i(l),style:{cursor:"pointer"}})})]},l)}),(0,s.jsx)(Z.ZP,{type:"dashed",onClick:()=>{o([...r,["",""]])},icon:(0,s.jsx)(A.Z,{}),children:"Add Header"})]})},P=t(77565),M=e=>{let{pathValue:l,targetValue:t,includeSubpath:a}=e,r=(0,d.getProxyBaseUrl)();return l&&t?(0,s.jsxs)(f.Z,{className:"p-5",children:[(0,s.jsx)(n.Z,{className:"text-lg font-semibold text-gray-900 mb-2",children:"Route Preview"}),(0,s.jsx)(j.Z,{className:"text-gray-600 mb-5",children:"How your requests will be routed"}),(0,s.jsxs)("div",{className:"space-y-5",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"text-base font-semibold text-gray-900 mb-3",children:"Basic routing:"}),(0,s.jsxs)("div",{className:"flex items-center gap-4",children:[(0,s.jsxs)("div",{className:"flex-1 bg-gray-50 border border-gray-200 rounded-lg p-3",children:[(0,s.jsx)("div",{className:"text-sm text-gray-600 mb-2",children:"Your endpoint"}),(0,s.jsx)("code",{className:"font-mono text-sm text-gray-900",children:l?"".concat(r).concat(l):""})]}),(0,s.jsx)("div",{className:"text-gray-400",children:(0,s.jsx)(P.Z,{className:"text-lg"})}),(0,s.jsxs)("div",{className:"flex-1 bg-gray-50 border border-gray-200 rounded-lg p-3",children:[(0,s.jsx)("div",{className:"text-sm text-gray-600 mb-2",children:"Forwards to"}),(0,s.jsx)("code",{className:"font-mono text-sm text-gray-900",children:t})]})]})]}),a&&(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"text-base font-semibold text-gray-900 mb-3",children:"With subpaths:"}),(0,s.jsxs)("div",{className:"flex items-center gap-4",children:[(0,s.jsxs)("div",{className:"flex-1 bg-gray-50 border border-gray-200 rounded-lg p-3",children:[(0,s.jsx)("div",{className:"text-sm text-gray-600 mb-2",children:"Your endpoint + subpath"}),(0,s.jsxs)("code",{className:"font-mono text-sm text-gray-900",children:[l&&"".concat(r).concat(l),(0,s.jsx)("span",{className:"text-blue-600",children:"/v1/text-to-image/base/model"})]})]}),(0,s.jsx)("div",{className:"text-gray-400",children:(0,s.jsx)(P.Z,{className:"text-lg"})}),(0,s.jsxs)("div",{className:"flex-1 bg-gray-50 border border-gray-200 rounded-lg p-3",children:[(0,s.jsx)("div",{className:"text-sm text-gray-600 mb-2",children:"Forwards to"}),(0,s.jsxs)("code",{className:"font-mono text-sm text-gray-900",children:[t,(0,s.jsx)("span",{className:"text-blue-600",children:"/v1/text-to-image/base/model"})]})]})]}),(0,s.jsxs)("div",{className:"mt-3 text-sm text-gray-600",children:["Any path after ",l," will be appended to the target URL"]})]})}),!a&&(0,s.jsx)("div",{className:"mt-4 p-3 bg-blue-50 rounded-md border border-blue-200",children:(0,s.jsxs)("div",{className:"flex items-start",children:[(0,s.jsx)(k.Z,{className:"text-blue-500 mt-0.5 mr-2 flex-shrink-0"}),(0,s.jsxs)("div",{className:"text-sm text-blue-700",children:[(0,s.jsx)("span",{className:"font-medium",children:"Not seeing the routing you wanted?"})," Try enabling - Include Subpaths - above - this allows subroutes like"," ",(0,s.jsx)("code",{className:"bg-blue-100 px-1 py-0.5 rounded font-mono text-xs",children:"/api/v1/models"})," to be forwarded automatically."]})]})})]})]}):null},F=t(9114),L=t(63709),T=e=>{let{premiumUser:l,authEnabled:t,onAuthChange:a}=e;return(0,s.jsxs)(f.Z,{className:"p-6",children:[(0,s.jsx)(n.Z,{className:"text-lg font-semibold text-gray-900 mb-2",children:"Security"}),(0,s.jsx)(j.Z,{className:"text-gray-600 mb-4",children:"When enabled, requests to this endpoint will require a valid LiteLLM API key"}),l?(0,s.jsx)(_.Z.Item,{name:"auth",valuePropName:"checked",className:"mb-0",children:(0,s.jsx)(L.Z,{checked:t,onChange:e=>{a(e)}})}):(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center mb-3",children:[(0,s.jsx)(L.Z,{disabled:!0,checked:!1,style:{outline:"2px solid #d1d5db",outlineOffset:"2px"}}),(0,s.jsx)("span",{className:"ml-2 text-sm text-gray-400",children:"Authentication (Premium)"})]}),(0,s.jsx)("div",{className:"p-3 bg-yellow-50 border border-yellow-200 rounded-lg",children:(0,s.jsxs)(i.Z,{className:"text-sm text-yellow-800",children:["Setting authentication for pass-through endpoints is a LiteLLM Enterprise feature. Get a trial key"," ",(0,s.jsx)("a",{href:"https://www.litellm.ai/#pricing",target:"_blank",rel:"noopener noreferrer",className:"underline",children:"here"}),"."]})})]})]})};let{Option:R}=v.default;var O=e=>{let{accessToken:l,setPassThroughItems:t,passThroughItems:o,premiumUser:i=!1}=e,[m]=_.Z.useForm(),[u,h]=(0,a.useState)(!1),[x,v]=(0,a.useState)(!1),[C,Z]=(0,a.useState)(""),[S,A]=(0,a.useState)(""),[I,P]=(0,a.useState)(""),[L,R]=(0,a.useState)(!0),[O,V]=(0,a.useState)(!1),D=()=>{m.resetFields(),A(""),P(""),R(!0),h(!1)},q=e=>{let l=e;e&&!e.startsWith("/")&&(l="/"+e),A(l),m.setFieldsValue({path:l})},z=async e=>{console.log("addPassThrough called with:",e),v(!0);try{!i&&"auth"in e&&delete e.auth,console.log("formValues: ".concat(JSON.stringify(e)));let s=(await (0,d.createPassThroughEndpoint)(l,e)).endpoints[0],a=[...o,s];t(a),F.Z.success("Pass-through endpoint created successfully"),m.resetFields(),A(""),P(""),R(!0),h(!1)}catch(e){F.Z.fromBackend("Error creating pass-through endpoint: "+e)}finally{v(!1)}};return(0,s.jsxs)("div",{children:[(0,s.jsx)(r.Z,{className:"mx-auto mb-4 mt-4",onClick:()=>h(!0),children:"+ Add Pass-Through Endpoint"}),(0,s.jsx)(y.Z,{title:(0,s.jsxs)("div",{className:"flex items-center space-x-3 pb-4 border-b border-gray-100",children:[(0,s.jsx)(w.Z,{className:"text-xl text-blue-500"}),(0,s.jsx)("h2",{className:"text-xl font-semibold text-gray-900",children:"Add Pass-Through Endpoint"})]}),open:u,width:1e3,onCancel:D,footer:null,className:"top-8",styles:{body:{padding:"24px"},header:{padding:"24px 24px 0 24px",border:"none"}},children:(0,s.jsxs)("div",{className:"mt-6",children:[(0,s.jsx)(b.Z,{message:"What is a Pass-Through Endpoint?",description:"Route requests from your LiteLLM proxy to any external API. Perfect for custom models, image generation APIs, or any service you want to proxy through LiteLLM.",type:"info",showIcon:!0,className:"mb-6"}),(0,s.jsxs)(_.Z,{form:m,onFinish:z,layout:"vertical",className:"space-y-6",initialValues:{include_subpath:!0,path:S,target:I},children:[(0,s.jsxs)(f.Z,{className:"p-5",children:[(0,s.jsx)(n.Z,{className:"text-lg font-semibold text-gray-900 mb-2",children:"Route Configuration"}),(0,s.jsx)(j.Z,{className:"text-gray-600 mb-5",children:"Configure how requests to your domain will be forwarded to the target API"}),(0,s.jsxs)("div",{className:"space-y-5",children:[(0,s.jsx)(_.Z.Item,{label:(0,s.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Path Prefix"}),name:"path",rules:[{required:!0,message:"Path is required",pattern:/^\//}],extra:(0,s.jsx)("div",{className:"text-xs text-gray-500 mt-1",children:"Example: /bria, /adobe-photoshop, /elasticsearch"}),className:"mb-4",children:(0,s.jsx)("div",{className:"flex items-center",children:(0,s.jsx)(g.Z,{placeholder:"bria",value:S,onChange:e=>q(e.target.value),className:"flex-1"})})}),(0,s.jsx)(_.Z.Item,{label:(0,s.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Target URL"}),name:"target",rules:[{required:!0,message:"Target URL is required"},{type:"url",message:"Please enter a valid URL"}],extra:(0,s.jsx)("div",{className:"text-xs text-gray-500 mt-1",children:"Example:https://engine.prod.bria-api.com"}),className:"mb-4",children:(0,s.jsx)(g.Z,{placeholder:"https://engine.prod.bria-api.com",value:I,onChange:e=>{P(e.target.value),m.setFieldsValue({target:e.target.value})}})}),(0,s.jsxs)("div",{className:"flex items-center justify-between py-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"text-sm font-medium text-gray-700",children:"Include Subpaths"}),(0,s.jsx)("div",{className:"text-xs text-gray-500 mt-0.5",children:"Forward all subpaths to the target API (recommended for REST APIs)"})]}),(0,s.jsx)(_.Z.Item,{name:"include_subpath",valuePropName:"checked",className:"mb-0",children:(0,s.jsx)(p.Z,{checked:L,onChange:R})})]})]})]}),(0,s.jsx)(M,{pathValue:S,targetValue:I,includeSubpath:L}),(0,s.jsxs)(f.Z,{className:"p-6",children:[(0,s.jsx)(n.Z,{className:"text-lg font-semibold text-gray-900 mb-2",children:"Headers"}),(0,s.jsx)(j.Z,{className:"text-gray-600 mb-6",children:"Add headers that will be sent with every request to the target API"}),(0,s.jsx)(_.Z.Item,{label:(0,s.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Authentication Headers",(0,s.jsx)(c.Z,{title:"Authentication and other headers to forward with requests",children:(0,s.jsx)(k.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"headers",rules:[{required:!0,message:"Please configure the headers"}],extra:(0,s.jsxs)("div",{className:"text-xs text-gray-500 mt-2",children:[(0,s.jsx)("div",{className:"font-medium mb-1",children:"Add authentication tokens and other required headers"}),(0,s.jsx)("div",{children:"Common examples: auth_token, Authorization, x-api-key"})]}),children:(0,s.jsx)(E,{})})]}),(0,s.jsx)(T,{premiumUser:i,authEnabled:O,onAuthChange:e=>{V(e),m.setFieldsValue({auth:e})}}),(0,s.jsxs)(f.Z,{className:"p-6",children:[(0,s.jsx)(n.Z,{className:"text-lg font-semibold text-gray-900 mb-2",children:"Billing"}),(0,s.jsx)(j.Z,{className:"text-gray-600 mb-6",children:"Optional cost tracking for this endpoint"}),(0,s.jsx)(_.Z.Item,{label:(0,s.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Cost Per Request (USD)",(0,s.jsx)(c.Z,{title:"Optional: Track costs for requests to this endpoint",children:(0,s.jsx)(k.Z,{className:"ml-2 text-gray-400 hover:text-gray-600"})})]}),name:"cost_per_request",extra:(0,s.jsx)("div",{className:"text-xs text-gray-500 mt-2",children:"The cost charged for each request through this endpoint"}),children:(0,s.jsx)(N.Z,{min:0,step:.001,precision:4,placeholder:"2.0000",size:"large"})})]}),(0,s.jsxs)("div",{className:"flex items-center justify-end space-x-3 pt-6 border-t border-gray-100",children:[(0,s.jsx)(r.Z,{variant:"secondary",onClick:D,children:"Cancel"}),(0,s.jsx)(r.Z,{variant:"primary",loading:x,onClick:()=>{console.log("Submit button clicked"),m.submit()},children:x?"Creating...":"Add Pass-Through Endpoint"})]})]})]})})]})},V=t(30078),D=t(64482),q=t(20577),z=t(87769),B=t(42208);let K=e=>{let{value:l}=e,[t,r]=(0,a.useState)(!1),o=JSON.stringify(l,null,2);return(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("pre",{className:"font-mono text-xs bg-gray-50 p-2 rounded max-w-md overflow-auto",children:t?o:"••••••••"}),(0,s.jsx)("button",{onClick:()=>r(!t),className:"p-1 hover:bg-gray-100 rounded",type:"button",children:t?(0,s.jsx)(z.Z,{className:"w-4 h-4 text-gray-500"}):(0,s.jsx)(B.Z,{className:"w-4 h-4 text-gray-500"})})]})};var U=e=>{let{endpointData:l,onClose:t,accessToken:r,isAdmin:o,premiumUser:i=!1,onEndpointUpdated:n}=e,[c,m]=(0,a.useState)(l),[u,h]=(0,a.useState)(!1),[x,p]=(0,a.useState)(!1),[g,f]=(0,a.useState)((null==l?void 0:l.auth)||!1),[j]=_.Z.useForm(),v=async e=>{try{if(!r||!(null==c?void 0:c.id))return;let l={};if(e.headers)try{l="string"==typeof e.headers?JSON.parse(e.headers):e.headers}catch(e){F.Z.fromBackend("Invalid JSON format for headers");return}let t={path:c.path,target:e.target,headers:l,include_subpath:e.include_subpath,cost_per_request:e.cost_per_request,auth:i?e.auth:void 0};await (0,d.updatePassThroughEndpoint)(r,c.id,t),m({...c,...t}),p(!1),n&&n()}catch(e){console.error("Error updating endpoint:",e),F.Z.fromBackend("Failed to update pass through endpoint")}},y=async()=>{try{if(!r||!(null==c?void 0:c.id))return;await (0,d.deletePassThroughEndpointsCall)(r,c.id),F.Z.success("Pass through endpoint deleted successfully"),t(),n&&n()}catch(e){console.error("Error deleting endpoint:",e),F.Z.fromBackend("Failed to delete pass through endpoint")}};return u?(0,s.jsx)("div",{className:"p-4",children:"Loading..."}):c?(0,s.jsxs)("div",{className:"p-4",children:[(0,s.jsx)("div",{className:"flex justify-between items-center mb-6",children:(0,s.jsxs)("div",{children:[(0,s.jsx)(Z.ZP,{onClick:t,className:"mb-4",children:"← Back"}),(0,s.jsxs)(V.Dx,{children:["Pass Through Endpoint: ",c.path]}),(0,s.jsx)(V.xv,{className:"text-gray-500 font-mono",children:c.id})]})}),(0,s.jsxs)(V.v0,{children:[(0,s.jsxs)(V.td,{className:"mb-4",children:[(0,s.jsx)(V.OK,{children:"Overview"},"overview"),o?(0,s.jsx)(V.OK,{children:"Settings"},"settings"):(0,s.jsx)(s.Fragment,{})]}),(0,s.jsxs)(V.nP,{children:[(0,s.jsxs)(V.x4,{children:[(0,s.jsxs)(V.rj,{numItems:1,numItemsSm:2,numItemsLg:3,className:"gap-6",children:[(0,s.jsxs)(V.Zb,{children:[(0,s.jsx)(V.xv,{children:"Path"}),(0,s.jsx)("div",{className:"mt-2",children:(0,s.jsx)(V.Dx,{className:"font-mono",children:c.path})})]}),(0,s.jsxs)(V.Zb,{children:[(0,s.jsx)(V.xv,{children:"Target"}),(0,s.jsx)("div",{className:"mt-2",children:(0,s.jsx)(V.Dx,{children:c.target})})]}),(0,s.jsxs)(V.Zb,{children:[(0,s.jsx)(V.xv,{children:"Configuration"}),(0,s.jsxs)("div",{className:"mt-2 space-y-2",children:[(0,s.jsx)("div",{children:(0,s.jsx)(V.Ct,{color:c.include_subpath?"green":"gray",children:c.include_subpath?"Include Subpath":"Exact Path"})}),(0,s.jsx)("div",{children:(0,s.jsx)(V.Ct,{color:c.auth?"blue":"gray",children:c.auth?"Auth Required":"No Auth"})}),void 0!==c.cost_per_request&&(0,s.jsx)("div",{children:(0,s.jsxs)(V.xv,{children:["Cost per request: $",c.cost_per_request]})})]})]})]}),(0,s.jsx)("div",{className:"mt-6",children:(0,s.jsx)(M,{pathValue:c.path,targetValue:c.target,includeSubpath:c.include_subpath||!1})}),c.headers&&Object.keys(c.headers).length>0&&(0,s.jsxs)(V.Zb,{className:"mt-6",children:[(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsx)(V.xv,{className:"font-medium",children:"Headers"}),(0,s.jsxs)(V.Ct,{color:"blue",children:[Object.keys(c.headers).length," headers configured"]})]}),(0,s.jsx)("div",{className:"mt-4",children:(0,s.jsx)(K,{value:c.headers})})]})]}),o&&(0,s.jsx)(V.x4,{children:(0,s.jsxs)(V.Zb,{children:[(0,s.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,s.jsx)(V.Dx,{children:"Pass Through Endpoint Settings"}),(0,s.jsx)("div",{className:"space-x-2",children:!x&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(V.zx,{onClick:()=>p(!0),children:"Edit Settings"}),(0,s.jsx)(V.zx,{onClick:y,variant:"secondary",color:"red",children:"Delete Endpoint"})]})})]}),x?(0,s.jsxs)(_.Z,{form:j,onFinish:v,initialValues:{target:c.target,headers:c.headers?JSON.stringify(c.headers,null,2):"",include_subpath:c.include_subpath||!1,cost_per_request:c.cost_per_request,auth:c.auth||!1},layout:"vertical",children:[(0,s.jsx)(_.Z.Item,{label:"Target URL",name:"target",rules:[{required:!0,message:"Please input a target URL"}],children:(0,s.jsx)(V.oi,{placeholder:"https://api.example.com"})}),(0,s.jsx)(_.Z.Item,{label:"Headers (JSON)",name:"headers",children:(0,s.jsx)(D.default.TextArea,{rows:5,placeholder:'{"Authorization": "Bearer your-token", "Content-Type": "application/json"}'})}),(0,s.jsx)(_.Z.Item,{label:"Include Subpath",name:"include_subpath",valuePropName:"checked",children:(0,s.jsx)(L.Z,{})}),(0,s.jsx)(_.Z.Item,{label:"Cost per Request",name:"cost_per_request",children:(0,s.jsx)(q.Z,{min:0,step:.01,precision:2,placeholder:"0.00",addonBefore:"$"})}),(0,s.jsx)(T,{premiumUser:i,authEnabled:g,onAuthChange:e=>{f(e),j.setFieldsValue({auth:e})}}),(0,s.jsxs)("div",{className:"flex justify-end gap-2 mt-6",children:[(0,s.jsx)(Z.ZP,{onClick:()=>p(!1),children:"Cancel"}),(0,s.jsx)(V.zx,{children:"Save Changes"})]})]}):(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(V.xv,{className:"font-medium",children:"Path"}),(0,s.jsx)("div",{className:"font-mono",children:c.path})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(V.xv,{className:"font-medium",children:"Target URL"}),(0,s.jsx)("div",{children:c.target})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(V.xv,{className:"font-medium",children:"Include Subpath"}),(0,s.jsx)(V.Ct,{color:c.include_subpath?"green":"gray",children:c.include_subpath?"Yes":"No"})]}),void 0!==c.cost_per_request&&(0,s.jsxs)("div",{children:[(0,s.jsx)(V.xv,{className:"font-medium",children:"Cost per Request"}),(0,s.jsxs)("div",{children:["$",c.cost_per_request]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(V.xv,{className:"font-medium",children:"Authentication Required"}),(0,s.jsx)(V.Ct,{color:c.auth?"green":"gray",children:c.auth?"Yes":"No"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(V.xv,{className:"font-medium",children:"Headers"}),c.headers&&Object.keys(c.headers).length>0?(0,s.jsx)("div",{className:"mt-2",children:(0,s.jsx)(K,{value:c.headers})}):(0,s.jsx)("div",{className:"text-gray-500",children:"No headers configured"})]})]})]})})]})]})]}):(0,s.jsx)("div",{className:"p-4",children:"Pass through endpoint not found"})},G=t(12322);let H=e=>{let{value:l}=e,[t,r]=(0,a.useState)(!1),o=JSON.stringify(l);return(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("span",{className:"font-mono text-xs",children:t?o:"••••••••"}),(0,s.jsx)("button",{onClick:()=>r(!t),className:"p-1 hover:bg-gray-100 rounded",type:"button",children:t?(0,s.jsx)(z.Z,{className:"w-4 h-4 text-gray-500"}):(0,s.jsx)(B.Z,{className:"w-4 h-4 text-gray-500"})})]})};var J=e=>{let{accessToken:l,userRole:t,userID:p,modelData:g,premiumUser:f}=e,[j,v]=(0,a.useState)([]),[_,y]=(0,a.useState)(null),[b,N]=(0,a.useState)(!1),[w,k]=(0,a.useState)(null);(0,a.useEffect)(()=>{l&&t&&p&&(0,d.getPassThroughEndpointsCall)(l).then(e=>{v(e.endpoints)})},[l,t,p]);let C=async e=>{k(e),N(!0)},Z=async()=>{if(null!=w&&l){try{await (0,d.deletePassThroughEndpointsCall)(l,w);let e=j.filter(e=>e.id!==w);v(e),F.Z.success("Endpoint deleted successfully.")}catch(e){console.error("Error deleting the endpoint:",e),F.Z.fromBackend("Error deleting the endpoint: "+e)}N(!1),k(null)}},S=(e,l)=>{C(e)},A=[{header:"ID",accessorKey:"id",cell:e=>(0,s.jsx)(c.Z,{title:e.row.original.id,children:(0,s.jsx)("div",{className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left w-full truncate whitespace-nowrap cursor-pointer max-w-[15ch]",onClick:()=>e.row.original.id&&y(e.row.original.id),children:e.row.original.id})})},{header:"Path",accessorKey:"path"},{header:"Target",accessorKey:"target",cell:e=>(0,s.jsx)(i.Z,{children:e.getValue()})},{header:()=>(0,s.jsxs)("div",{className:"flex items-center gap-1",children:[(0,s.jsx)("span",{children:"Authentication"}),(0,s.jsx)(c.Z,{title:"LiteLLM Virtual Key required to call endpoint",children:(0,s.jsx)(u.Z,{className:"w-4 h-4 text-gray-400 cursor-help"})})]}),accessorKey:"auth",cell:e=>(0,s.jsx)(m.Z,{color:e.getValue()?"green":"gray",children:e.getValue()?"Yes":"No"})},{header:"Headers",accessorKey:"headers",cell:e=>(0,s.jsx)(H,{value:e.getValue()||{}})},{header:"Actions",id:"actions",cell:e=>{let{row:l}=e;return(0,s.jsxs)("div",{className:"flex space-x-1",children:[(0,s.jsx)(o.Z,{icon:h.Z,size:"sm",onClick:()=>l.original.id&&y(l.original.id),title:"Edit"}),(0,s.jsx)(o.Z,{icon:x.Z,size:"sm",onClick:()=>S(l.original.id,l.index),title:"Delete"})]})}}];if(!l)return null;if(_){console.log("selectedEndpointId",_),console.log("generalSettings",j);let e=j.find(e=>e.id===_);return e?(0,s.jsx)(U,{endpointData:e,onClose:()=>y(null),accessToken:l,isAdmin:"Admin"===t||"admin"===t,premiumUser:f,onEndpointUpdated:()=>{l&&(0,d.getPassThroughEndpointsCall)(l).then(e=>{v(e.endpoints)})}}):(0,s.jsx)("div",{children:"Endpoint not found"})}return(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{children:"Pass Through Endpoints"}),(0,s.jsx)(i.Z,{className:"text-tremor-content",children:"Configure and manage your pass-through endpoints"})]}),(0,s.jsx)(O,{accessToken:l,setPassThroughItems:v,passThroughItems:j,premiumUser:f}),(0,s.jsx)(G.w,{data:j,columns:A,renderSubComponent:()=>(0,s.jsx)("div",{}),getRowCanExpand:()=>!1,isLoading:!1,noDataMessage:"No pass-through endpoints configured"}),b&&(0,s.jsx)("div",{className:"fixed z-10 inset-0 overflow-y-auto",children:(0,s.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,s.jsx)("div",{className:"fixed inset-0 transition-opacity","aria-hidden":"true",children:(0,s.jsx)("div",{className:"absolute inset-0 bg-gray-500 opacity-75"})}),(0,s.jsx)("span",{className:"hidden sm:inline-block sm:align-middle sm:h-screen","aria-hidden":"true",children:""}),(0,s.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,s.jsx)("div",{className:"bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4",children:(0,s.jsx)("div",{className:"sm:flex sm:items-start",children:(0,s.jsxs)("div",{className:"mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left",children:[(0,s.jsx)("h3",{className:"text-lg leading-6 font-medium text-gray-900",children:"Delete Pass-Through Endpoint"}),(0,s.jsx)("div",{className:"mt-2",children:(0,s.jsx)("p",{className:"text-sm text-gray-500",children:"Are you sure you want to delete this pass-through endpoint? This action cannot be undone."})})]})})}),(0,s.jsxs)("div",{className:"bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse",children:[(0,s.jsx)(r.Z,{onClick:Z,color:"red",className:"ml-2",children:"Delete"}),(0,s.jsx)(r.Z,{onClick:()=>{N(!1),k(null)},children:"Cancel"})]})]})]})})]})}},39789:function(e,l,t){t.d(l,{Z:function(){return i}});var s=t(57437),a=t(2265),r=t(21487),o=t(84264),i=e=>{let{value:l,onValueChange:t,label:i="Select Time Range",className:n="",showTimeRange:d=!0}=e,[c,m]=(0,a.useState)(!1),u=(0,a.useRef)(null),h=(0,a.useCallback)(e=>{m(!0),setTimeout(()=>m(!1),1500),t(e),requestIdleCallback(()=>{if(e.from){let l;let s={...e},a=new Date(e.from);l=new Date(e.to?e.to:e.from),a.toDateString(),l.toDateString(),a.setHours(0,0,0,0),l.setHours(23,59,59,999),s.from=a,s.to=l,t(s)}},{timeout:100})},[t]),x=(0,a.useCallback)((e,l)=>{if(!e||!l)return"";let t=e=>e.toLocaleString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!0,timeZoneName:"short"});if(e.toDateString()!==l.toDateString())return"".concat(t(e)," - ").concat(t(l));{let t=e.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),s=e.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!0}),a=l.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!0,timeZoneName:"short"});return"".concat(t,": ").concat(s," - ").concat(a)}},[]);return(0,s.jsxs)("div",{className:n,children:[i&&(0,s.jsx)(o.Z,{className:"mb-2",children:i}),(0,s.jsxs)("div",{className:"relative w-fit",children:[(0,s.jsx)("div",{ref:u,children:(0,s.jsx)(r.Z,{enableSelect:!0,value:l,onValueChange:h,placeholder:"Select date range",enableClear:!1,style:{zIndex:100}})}),c&&(0,s.jsx)("div",{className:"absolute top-1/2 animate-pulse",style:{left:"calc(100% + 8px)",transform:"translateY(-50%)",zIndex:110},children:(0,s.jsxs)("div",{className:"flex items-center gap-1 text-green-600 text-sm font-medium bg-white px-2 py-1 rounded-full border border-green-200 shadow-sm whitespace-nowrap",children:[(0,s.jsx)("div",{className:"w-3 h-3 bg-green-500 text-white rounded-full flex items-center justify-center text-xs",children:"✓"}),(0,s.jsx)("span",{className:"text-xs",children:"Selected"})]})})]}),d&&l.from&&l.to&&(0,s.jsx)(o.Z,{className:"mt-2 text-xs text-gray-500",children:x(l.from,l.to)})]})}},12322:function(e,l,t){t.d(l,{w:function(){return n}});var s=t(57437),a=t(2265),r=t(71594),o=t(24525),i=t(19130);function n(e){let{data:l=[],columns:t,getRowCanExpand:n,renderSubComponent:d,isLoading:c=!1,loadingMessage:m="\uD83D\uDE85 Loading logs...",noDataMessage:u="No logs found"}=e,h=(0,r.b7)({data:l,columns:t,getRowCanExpand:n,getRowId:(e,l)=>{var t;return null!==(t=null==e?void 0:e.request_id)&&void 0!==t?t:String(l)},getCoreRowModel:(0,o.sC)(),getExpandedRowModel:(0,o.rV)()});return(0,s.jsx)("div",{className:"rounded-lg custom-border overflow-x-auto w-full max-w-full box-border",children:(0,s.jsxs)(i.iA,{className:"[&_td]:py-0.5 [&_th]:py-1 table-fixed w-full box-border",style:{minWidth:"400px"},children:[(0,s.jsx)(i.ss,{children:h.getHeaderGroups().map(e=>(0,s.jsx)(i.SC,{children:e.headers.map(e=>(0,s.jsx)(i.xs,{className:"py-1 h-8",children:e.isPlaceholder?null:(0,r.ie)(e.column.columnDef.header,e.getContext())},e.id))},e.id))}),(0,s.jsx)(i.RM,{children:c?(0,s.jsx)(i.SC,{children:(0,s.jsx)(i.pj,{colSpan:t.length,className:"h-8 text-center",children:(0,s.jsx)("div",{className:"text-center text-gray-500",children:(0,s.jsx)("p",{children:m})})})}):h.getRowModel().rows.length>0?h.getRowModel().rows.map(e=>(0,s.jsxs)(a.Fragment,{children:[(0,s.jsx)(i.SC,{className:"h-8",children:e.getVisibleCells().map(e=>(0,s.jsx)(i.pj,{className:"py-0.5 max-h-8 overflow-hidden text-ellipsis whitespace-nowrap",children:(0,r.ie)(e.column.columnDef.cell,e.getContext())},e.id))}),e.getIsExpanded()&&(0,s.jsx)(i.SC,{children:(0,s.jsx)(i.pj,{colSpan:e.getVisibleCells().length,className:"p-0",children:(0,s.jsx)("div",{className:"w-full max-w-full overflow-hidden box-border",children:d({row:e})})})})]},e.id)):(0,s.jsx)(i.SC,{children:(0,s.jsx)(i.pj,{colSpan:t.length,className:"h-8 text-center",children:(0,s.jsx)("div",{className:"text-center text-gray-500",children:(0,s.jsx)("p",{children:u})})})})})]})})}}}]);
\ No newline at end of file
diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/7801-9db7724dad309faf.js b/litellm/proxy/_experimental/out/_next/static/chunks/7801-9db7724dad309faf.js
deleted file mode 100644
index 3ab29948cdf..00000000000
--- a/litellm/proxy/_experimental/out/_next/static/chunks/7801-9db7724dad309faf.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7801],{16312:function(e,l,t){t.d(l,{z:function(){return s.Z}});var s=t(20831)},9335:function(e,l,t){t.d(l,{JO:function(){return s.Z},OK:function(){return a.Z},nP:function(){return n.Z},td:function(){return o.Z},v0:function(){return r.Z},x4:function(){return i.Z}});var s=t(47323),a=t(12485),r=t(18135),o=t(35242),i=t(29706),n=t(77991)},58643:function(e,l,t){t.d(l,{OK:function(){return s.Z},nP:function(){return i.Z},td:function(){return r.Z},v0:function(){return a.Z},x4:function(){return o.Z}});var s=t(12485),a=t(18135),r=t(35242),o=t(29706),i=t(77991)},37801:function(e,l,t){t.d(l,{Z:function(){return lO}});var s=t(57437),a=t(2265),r=t(49804),o=t(67101),i=t(84264),n=t(19250),d=t(42673),c=t(9114);let m=async(e,l,t)=>{try{console.log("handling submit for formValues:",e);let l=e.model_mappings||[];if("model_mappings"in e&&delete e.model_mappings,e.model&&e.model.includes("all-wildcard")){let t=e.custom_llm_provider,s=d.fK[t]+"/*";e.model_name=s,l.push({public_name:s,litellm_model:s}),e.model=s}let t=[];for(let s of l){let l={},a={},r=s.public_name;for(let[t,r]of(l.model=s.litellm_model,e.input_cost_per_token&&(e.input_cost_per_token=Number(e.input_cost_per_token)/1e6),e.output_cost_per_token&&(e.output_cost_per_token=Number(e.output_cost_per_token)/1e6),l.model=s.litellm_model,console.log("formValues add deployment:",e),Object.entries(e)))if(""!==r&&"custom_pricing"!==t&&"pricing_model"!==t&&"cache_control"!==t){if("model_name"==t)l.model=r;else if("custom_llm_provider"==t){console.log("custom_llm_provider:",r);let e=d.fK[r];l.custom_llm_provider=e,console.log("custom_llm_provider mappingResult:",e)}else if("model"==t)continue;else if("base_model"===t)a[t]=r;else if("team_id"===t)a.team_id=r;else if("model_access_group"===t)a.access_groups=r;else if("mode"==t)console.log("placing mode in modelInfo"),a.mode=r,delete l.mode;else if("custom_model_name"===t)l.model=r;else if("litellm_extra_params"==t){console.log("litellm_extra_params:",r);let e={};if(r&&void 0!=r){try{e=JSON.parse(r)}catch(e){throw c.Z.fromBackend("Failed to parse LiteLLM Extra Params: "+e),Error("Failed to parse litellm_extra_params: "+e)}for(let[t,s]of Object.entries(e))l[t]=s}}else if("model_info_params"==t){console.log("model_info_params:",r);let e={};if(r&&void 0!=r){try{e=JSON.parse(r)}catch(e){throw c.Z.fromBackend("Failed to parse LiteLLM Extra Params: "+e),Error("Failed to parse litellm_extra_params: "+e)}for(let[l,t]of Object.entries(e))a[l]=t}}else if("input_cost_per_token"===t||"output_cost_per_token"===t||"input_cost_per_second"===t){r&&(l[t]=Number(r));continue}else l[t]=r}t.push({litellmParamsObj:l,modelInfoObj:a,modelName:r})}return t}catch(e){c.Z.fromBackend("Failed to create model: "+e)}},u=async(e,l,t,s)=>{try{let a=await m(e,l,t);if(!a||0===a.length)return;for(let e of a){let{litellmParamsObj:t,modelInfoObj:s,modelName:a}=e,r={model_name:a,litellm_params:t,model_info:s},o=await (0,n.modelCreateCall)(l,r);console.log("response for model create call: ".concat(o.data))}s&&s(),t.resetFields()}catch(e){c.Z.fromBackend("Failed to add model: "+e)}};var h=t(62490),x=t(53410),p=t(74998),g=t(93192),f=t(13634),j=t(82680),v=t(52787),_=t(89970),y=t(73002),b=t(56522),N=t(65319),w=t(47451),k=t(69410),C=t(3632);let{Link:Z}=g.default,S={[d.Cl.OpenAI]:[{key:"api_base",label:"API Base",type:"select",options:["https://api.openai.com/v1","https://eu.api.openai.com"],defaultValue:"https://api.openai.com/v1"},{key:"organization",label:"OpenAI Organization ID",placeholder:"[OPTIONAL] my-unique-org"},{key:"api_key",label:"OpenAI API Key",type:"password",required:!0}],[d.Cl.OpenAI_Text]:[{key:"api_base",label:"API Base",type:"select",options:["https://api.openai.com/v1","https://eu.api.openai.com"],defaultValue:"https://api.openai.com/v1"},{key:"organization",label:"OpenAI Organization ID",placeholder:"[OPTIONAL] my-unique-org"},{key:"api_key",label:"OpenAI API Key",type:"password",required:!0}],[d.Cl.Vertex_AI]:[{key:"vertex_project",label:"Vertex Project",placeholder:"adroit-cadet-1234..",required:!0},{key:"vertex_location",label:"Vertex Location",placeholder:"us-east-1",required:!0},{key:"vertex_credentials",label:"Vertex Credentials",required:!0,type:"upload"}],[d.Cl.AssemblyAI]:[{key:"api_base",label:"API Base",type:"select",required:!0,options:["https://api.assemblyai.com","https://api.eu.assemblyai.com"]},{key:"api_key",label:"AssemblyAI API Key",type:"password",required:!0}],[d.Cl.Azure]:[{key:"api_base",label:"API Base",placeholder:"https://...",required:!0},{key:"api_version",label:"API Version",placeholder:"2023-07-01-preview",tooltip:"By default litellm will use the latest version. If you want to use a different version, you can specify it here"},{key:"base_model",label:"Base Model",placeholder:"azure/gpt-3.5-turbo"},{key:"api_key",label:"Azure API Key",type:"password",required:!0}],[d.Cl.Azure_AI_Studio]:[{key:"api_base",label:"API Base",placeholder:"https://.openai.azure.com/openai/deployments/gpt-4o/chat/completions?api-version=2024-10-21",tooltip:"Enter your full Target URI from Azure Foundry here. Example: https://litellm8397336933.openai.azure.com/openai/deployments/gpt-4o/chat/completions?api-version=2024-10-21",required:!0},{key:"api_key",label:"Azure API Key",type:"password",required:!0}],[d.Cl.OpenAI_Compatible]:[{key:"api_base",label:"API Base",placeholder:"https://...",required:!0},{key:"api_key",label:"OpenAI API Key",type:"password",required:!0}],[d.Cl.Dashscope]:[{key:"api_key",label:"Dashscope API Key",type:"password",required:!0},{key:"api_base",label:"API Base",placeholder:"https://dashscope-intl.aliyuncs.com/compatible-mode/v1",defaultValue:"https://dashscope-intl.aliyuncs.com/compatible-mode/v1",required:!0,tooltip:"The base URL for your Dashscope server. Defaults to https://dashscope-intl.aliyuncs.com/compatible-mode/v1 if not specified."}],[d.Cl.OpenAI_Text_Compatible]:[{key:"api_base",label:"API Base",placeholder:"https://...",required:!0},{key:"api_key",label:"OpenAI API Key",type:"password",required:!0}],[d.Cl.Bedrock]:[{key:"aws_access_key_id",label:"AWS Access Key ID",type:"password",required:!1,tooltip:"You can provide the raw key or the environment variable (e.g. `os.environ/MY_SECRET_KEY`)."},{key:"aws_secret_access_key",label:"AWS Secret Access Key",type:"password",required:!1,tooltip:"You can provide the raw key or the environment variable (e.g. `os.environ/MY_SECRET_KEY`)."},{key:"aws_session_token",label:"AWS Session Token",type:"password",required:!1,tooltip:"Temporary credentials session token. You can provide the raw token or the environment variable (e.g. `os.environ/MY_SESSION_TOKEN`)."},{key:"aws_region_name",label:"AWS Region Name",placeholder:"us-east-1",required:!1,tooltip:"You can provide the raw key or the environment variable (e.g. `os.environ/MY_SECRET_KEY`)."},{key:"aws_session_name",label:"AWS Session Name",placeholder:"my-session",required:!1,tooltip:"Name for the AWS session. You can provide the raw value or the environment variable (e.g. `os.environ/MY_SESSION_NAME`)."},{key:"aws_profile_name",label:"AWS Profile Name",placeholder:"default",required:!1,tooltip:"AWS profile name to use for authentication. You can provide the raw value or the environment variable (e.g. `os.environ/MY_PROFILE_NAME`)."},{key:"aws_role_name",label:"AWS Role Name",placeholder:"MyRole",required:!1,tooltip:"AWS IAM role name to assume. You can provide the raw value or the environment variable (e.g. `os.environ/MY_ROLE_NAME`)."},{key:"aws_web_identity_token",label:"AWS Web Identity Token",type:"password",required:!1,tooltip:"Web identity token for OIDC authentication. You can provide the raw token or the environment variable (e.g. `os.environ/MY_WEB_IDENTITY_TOKEN`)."},{key:"aws_bedrock_runtime_endpoint",label:"AWS Bedrock Runtime Endpoint",placeholder:"https://bedrock-runtime.us-east-1.amazonaws.com",required:!1,tooltip:"Custom Bedrock runtime endpoint URL. You can provide the raw value or the environment variable (e.g. `os.environ/MY_BEDROCK_ENDPOINT`)."}],[d.Cl.SageMaker]:[{key:"aws_access_key_id",label:"AWS Access Key ID",type:"password",required:!1,tooltip:"You can provide the raw key or the environment variable (e.g. `os.environ/MY_SECRET_KEY`)."},{key:"aws_secret_access_key",label:"AWS Secret Access Key",type:"password",required:!1,tooltip:"You can provide the raw key or the environment variable (e.g. `os.environ/MY_SECRET_KEY`)."},{key:"aws_region_name",label:"AWS Region Name",placeholder:"us-east-1",required:!1,tooltip:"You can provide the raw key or the environment variable (e.g. `os.environ/MY_SECRET_KEY`)."}],[d.Cl.Ollama]:[{key:"api_base",label:"API Base",placeholder:"http://localhost:11434",defaultValue:"http://localhost:11434",required:!1,tooltip:"The base URL for your Ollama server. Defaults to http://localhost:11434 if not specified."}],[d.Cl.Anthropic]:[{key:"api_key",label:"API Key",placeholder:"sk-",type:"password",required:!0}],[d.Cl.Deepgram]:[{key:"api_key",label:"API Key",type:"password",required:!0}],[d.Cl.ElevenLabs]:[{key:"api_key",label:"API Key",type:"password",required:!0}],[d.Cl.Google_AI_Studio]:[{key:"api_key",label:"API Key",placeholder:"aig-",type:"password",required:!0}],[d.Cl.Groq]:[{key:"api_key",label:"API Key",type:"password",required:!0}],[d.Cl.MistralAI]:[{key:"api_key",label:"API Key",type:"password",required:!0}],[d.Cl.Deepseek]:[{key:"api_key",label:"API Key",type:"password",required:!0}],[d.Cl.Cohere]:[{key:"api_key",label:"API Key",type:"password",required:!0}],[d.Cl.Databricks]:[{key:"api_key",label:"API Key",type:"password",required:!0}],[d.Cl.xAI]:[{key:"api_key",label:"API Key",type:"password",required:!0}],[d.Cl.AIML]:[{key:"api_key",label:"API Key",type:"password",required:!0}],[d.Cl.Cerebras]:[{key:"api_key",label:"API Key",type:"password",required:!0}],[d.Cl.Sambanova]:[{key:"api_key",label:"API Key",type:"password",required:!0}],[d.Cl.Perplexity]:[{key:"api_key",label:"API Key",type:"password",required:!0}],[d.Cl.TogetherAI]:[{key:"api_key",label:"API Key",type:"password",required:!0}],[d.Cl.Openrouter]:[{key:"api_key",label:"API Key",type:"password",required:!0}],[d.Cl.FireworksAI]:[{key:"api_key",label:"API Key",type:"password",required:!0}],[d.Cl.GradientAI]:[{key:"api_base",label:"GradientAI Endpoint",placeholder:"https://...",required:!1},{key:"api_key",label:"GradientAI API Key",type:"password",required:!0}],[d.Cl.Triton]:[{key:"api_key",label:"API Key",type:"password",required:!1},{key:"api_base",label:"API Base",placeholder:"http://localhost:8000/generate",required:!1}],[d.Cl.Hosted_Vllm]:[{key:"api_base",label:"API Base",placeholder:"https://...",required:!0},{key:"api_key",label:"OpenAI API Key",type:"password",required:!0}],[d.Cl.Voyage]:[{key:"api_key",label:"API Key",type:"password",required:!0}],[d.Cl.JinaAI]:[{key:"api_key",label:"API Key",type:"password",required:!0}],[d.Cl.VolcEngine]:[{key:"api_key",label:"API Key",type:"password",required:!0}],[d.Cl.DeepInfra]:[{key:"api_key",label:"API Key",type:"password",required:!0}],[d.Cl.Oracle]:[{key:"api_key",label:"API Key",type:"password",required:!0}],[d.Cl.Snowflake]:[{key:"api_key",label:"Snowflake API Key / JWT Key for Authentication",type:"password",required:!0},{key:"api_base",label:"Snowflake API Endpoint",placeholder:"https://1234567890.snowflakecomputing.com/api/v2/cortex/inference:complete",tooltip:"Enter the full endpoint with path here. Example: https://1234567890.snowflakecomputing.com/api/v2/cortex/inference:complete",required:!0}],[d.Cl.Infinity]:[{key:"api_base",label:"API Base",placeholder:"http://localhost:7997"}]};var A=e=>{let{selectedProvider:l,uploadProps:t}=e,r=d.Cl[l],o=f.Z.useFormInstance(),i=a.useMemo(()=>S[r]||[],[r]),n={name:"file",accept:".json",beforeUpload:e=>{if("application/json"===e.type){let l=new FileReader;l.onload=e=>{if(e.target){let l=e.target.result;console.log("Setting field value from JSON, length: ".concat(l.length)),o.setFieldsValue({vertex_credentials:l}),console.log("Form values after setting:",o.getFieldsValue())}},l.readAsText(e)}return!1},onChange(e){console.log("Upload onChange triggered in ProviderSpecificFields"),console.log("Current form values:",o.getFieldsValue()),"uploading"!==e.file.status&&console.log(e.file,e.fileList)}};return(0,s.jsx)(s.Fragment,{children:i.map(e=>{var l;return(0,s.jsxs)(a.Fragment,{children:[(0,s.jsx)(f.Z.Item,{label:e.label,name:e.key,rules:e.required?[{required:!0,message:"Required"}]:void 0,tooltip:e.tooltip,className:"vertex_credentials"===e.key?"mb-0":void 0,children:"select"===e.type?(0,s.jsx)(v.default,{placeholder:e.placeholder,defaultValue:e.defaultValue,children:null===(l=e.options)||void 0===l?void 0:l.map(e=>(0,s.jsx)(v.default.Option,{value:e,children:e},e))}):"upload"===e.type?(0,s.jsx)(N.default,{...n,onChange:l=>{(null==t?void 0:t.onChange)&&t.onChange(l),setTimeout(()=>{let l=o.getFieldValue(e.key);console.log("".concat(e.key," value after upload:"),JSON.stringify(l))},500)},children:(0,s.jsx)(y.ZP,{icon:(0,s.jsx)(C.Z,{}),children:"Click to Upload"})}):(0,s.jsx)(b.o,{placeholder:e.placeholder,type:"password"===e.type?"password":"text"})}),"vertex_credentials"===e.key&&(0,s.jsx)(w.Z,{children:(0,s.jsx)(k.Z,{children:(0,s.jsx)(b.x,{className:"mb-3 mt-1",children:"Give a gcp service account(.json file)"})})}),"base_model"===e.key&&(0,s.jsxs)(w.Z,{children:[(0,s.jsx)(k.Z,{span:10}),(0,s.jsx)(k.Z,{span:10,children:(0,s.jsxs)(b.x,{className:"mb-2",children:["The actual model your azure deployment uses. Used for accurate cost tracking. Select name from"," ",(0,s.jsx)(Z,{href:"https://github.com/BerriAI/litellm/blob/main/model_prices_and_context_window.json",target:"_blank",children:"here"})]})})]})]},e.key)})})},I=t(31283);let{Title:E,Link:P}=g.default;var M=e=>{let{isVisible:l,onCancel:t,onAddCredential:r,onUpdateCredential:o,uploadProps:i,addOrEdit:n,existingCredential:c}=e,[m]=f.Z.useForm(),[u,h]=(0,a.useState)(d.Cl.OpenAI),[x,p]=(0,a.useState)(!1);return(0,a.useEffect)(()=>{c&&(m.setFieldsValue({credential_name:c.credential_name,custom_llm_provider:c.credential_info.custom_llm_provider,api_base:c.credential_values.api_base,api_version:c.credential_values.api_version,base_model:c.credential_values.base_model,api_key:c.credential_values.api_key}),h(c.credential_info.custom_llm_provider))},[c]),(0,s.jsx)(j.Z,{title:"add"===n?"Add New Credential":"Edit Credential",visible:l,onCancel:()=>{t(),m.resetFields()},footer:null,width:600,children:(0,s.jsxs)(f.Z,{form:m,onFinish:e=>{let l=Object.entries(e).reduce((e,l)=>{let[t,s]=l;return""!==s&&null!=s&&(e[t]=s),e},{});"add"===n?r(l):o(l),m.resetFields()},layout:"vertical",children:[(0,s.jsx)(f.Z.Item,{label:"Credential Name:",name:"credential_name",rules:[{required:!0,message:"Credential name is required"}],initialValue:null==c?void 0:c.credential_name,children:(0,s.jsx)(I.o,{placeholder:"Enter a friendly name for these credentials",disabled:null!=c&&!!c.credential_name})}),(0,s.jsx)(f.Z.Item,{rules:[{required:!0,message:"Required"}],label:"Provider:",name:"custom_llm_provider",tooltip:"Helper to auto-populate provider specific fields",children:(0,s.jsx)(v.default,{showSearch:!0,onChange:e=>{h(e),m.setFieldValue("custom_llm_provider",e)},children:Object.entries(d.Cl).map(e=>{let[l,t]=e;return(0,s.jsx)(v.default.Option,{value:l,children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("img",{src:d.cd[t],alt:"".concat(l," logo"),className:"w-5 h-5",onError:e=>{let l=e.target,s=l.parentElement;if(s){let e=document.createElement("div");e.className="w-5 h-5 rounded-full bg-gray-200 flex items-center justify-center text-xs",e.textContent=t.charAt(0),s.replaceChild(e,l)}}}),(0,s.jsx)("span",{children:t})]})},l)})})}),(0,s.jsx)(A,{selectedProvider:u,uploadProps:i}),(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsx)(_.Z,{title:"Get help on our github",children:(0,s.jsx)(P,{href:"https://github.com/BerriAI/litellm/issues",children:"Need Help?"})}),(0,s.jsxs)("div",{children:[(0,s.jsx)(y.ZP,{onClick:()=>{t(),m.resetFields()},style:{marginRight:10},children:"Cancel"}),(0,s.jsx)(y.ZP,{htmlType:"submit",children:"add"===n?"Add Credential":"Update Credential"})]})]})]})})},F=t(16312),L=t(88532),T=e=>{let{isVisible:l,onCancel:t,onConfirm:r,credentialName:o}=e,[i,n]=(0,a.useState)(""),d=i===o,c=()=>{n(""),t()};return(0,s.jsx)(j.Z,{title:(0,s.jsxs)("div",{className:"flex items-center",children:[(0,s.jsx)(L.Z,{className:"h-6 w-6 text-red-600 mr-2"}),"Delete Credential"]}),open:l,footer:null,onCancel:c,closable:!0,destroyOnClose:!0,maskClosable:!1,children:(0,s.jsxs)("div",{className:"mt-4",children:[(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)(L.Z,{className:"h-5 w-5"})}),(0,s.jsx)("div",{children:(0,s.jsx)("p",{className:"text-base font-medium text-red-600",children:"This action cannot be undone and may break existing integrations."})})]}),(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.jsxs)("span",{className:"underline italic",children:["'",o,"'"]})," to confirm deletion:"]}),(0,s.jsx)("input",{type:"text",value:i,onChange:e=>n(e.target.value),placeholder:"Enter credential 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:"flex justify-end space-x-2",children:[(0,s.jsx)(F.z,{onClick:c,variant:"secondary",className:"mr-2",children:"Cancel"}),(0,s.jsx)(F.z,{onClick:()=>{d&&(n(""),r())},color:"red",className:"focus:ring-red-500",disabled:!d,children:"Delete Credential"})]})]})})},R=e=>{let{accessToken:l,uploadProps:t,credentialList:r,fetchCredentials:o}=e,[i,d]=(0,a.useState)(!1),[m,u]=(0,a.useState)(!1),[g,j]=(0,a.useState)(null),[v,_]=(0,a.useState)(null),[y]=f.Z.useForm(),b=["credential_name","custom_llm_provider"],N=async e=>{if(!l)return;let t=Object.entries(e).filter(e=>{let[l]=e;return!b.includes(l)}).reduce((e,l)=>{let[t,s]=l;return{...e,[t]:s}},{}),s={credential_name:e.credential_name,credential_values:t,credential_info:{custom_llm_provider:e.custom_llm_provider}};await (0,n.credentialUpdateCall)(l,e.credential_name,s),c.Z.success("Credential updated successfully"),u(!1),o(l)},w=async e=>{if(!l)return;let t=Object.entries(e).filter(e=>{let[l]=e;return!b.includes(l)}).reduce((e,l)=>{let[t,s]=l;return{...e,[t]:s}},{}),s={credential_name:e.credential_name,credential_values:t,credential_info:{custom_llm_provider:e.custom_llm_provider}};await (0,n.credentialCreateCall)(l,s),c.Z.success("Credential added successfully"),d(!1),o(l)};(0,a.useEffect)(()=>{l&&o(l)},[l]);let k=e=>{let l={openai:"blue",azure:"indigo",anthropic:"purple",default:"gray"},t=l[e.toLowerCase()]||l.default;return(0,s.jsx)(h.Ct,{color:t,size:"xs",children:e})},C=async e=>{l&&(await (0,n.credentialDeleteCall)(l,e),c.Z.success("Credential deleted successfully"),_(null),o(l))},Z=e=>{_(e)};return(0,s.jsxs)("div",{className:"w-full mx-auto flex-auto overflow-y-auto m-8 p-2",children:[(0,s.jsx)("div",{className:"flex justify-between items-center mb-4",children:(0,s.jsx)(h.xv,{children:"Configured credentials for different AI providers. Add and manage your API credentials."})}),(0,s.jsx)(h.Zb,{children:(0,s.jsxs)(h.iA,{children:[(0,s.jsx)(h.ss,{children:(0,s.jsxs)(h.SC,{children:[(0,s.jsx)(h.xs,{children:"Credential Name"}),(0,s.jsx)(h.xs,{children:"Provider"}),(0,s.jsx)(h.xs,{children:"Description"})]})}),(0,s.jsx)(h.RM,{children:r&&0!==r.length?r.map((e,l)=>{var t,a;return(0,s.jsxs)(h.SC,{children:[(0,s.jsx)(h.pj,{children:e.credential_name}),(0,s.jsx)(h.pj,{children:k((null===(t=e.credential_info)||void 0===t?void 0:t.custom_llm_provider)||"-")}),(0,s.jsx)(h.pj,{children:(null===(a=e.credential_info)||void 0===a?void 0:a.description)||"-"}),(0,s.jsxs)(h.pj,{children:[(0,s.jsx)(h.zx,{icon:x.Z,variant:"light",size:"sm",onClick:()=>{j(e),u(!0)}}),(0,s.jsx)(h.zx,{icon:p.Z,variant:"light",size:"sm",onClick:()=>Z(e.credential_name)})]})]},l)}):(0,s.jsx)(h.SC,{children:(0,s.jsx)(h.pj,{colSpan:4,className:"text-center py-4 text-gray-500",children:"No credentials configured"})})})]})}),(0,s.jsx)(h.zx,{onClick:()=>d(!0),className:"mt-4",children:"Add Credential"}),i&&(0,s.jsx)(M,{onAddCredential:w,isVisible:i,onCancel:()=>d(!1),uploadProps:t,addOrEdit:"add",onUpdateCredential:N,existingCredential:null}),m&&(0,s.jsx)(M,{onAddCredential:w,isVisible:m,existingCredential:g,onUpdateCredential:N,uploadProps:t,onCancel:()=>u(!1),addOrEdit:"edit"}),v&&(0,s.jsx)(T,{isVisible:!0,onCancel:()=>{_(null)},onConfirm:()=>C(v),credentialName:v})]})};let O=e=>{var l;return(null==e?void 0:null===(l=e.model_info)||void 0===l?void 0:l.team_public_model_name)?e.model_info.team_public_model_name:(null==e?void 0:e.model_name)||"-"};var D=t(9335),V=t(23628),q=t(33293),z=t(20831),B=t(12514),K=t(12485),U=t(18135),G=t(35242),H=t(29706),J=t(77991),W=t(49566),Y=t(96761),$=t(24199),Q=t(10900),X=t(45589),ee=t(64482),el=t(15424);let{Title:et,Link:es}=g.default;var ea=e=>{let{isVisible:l,onCancel:t,onAddCredential:a,existingCredential:r,setIsCredentialModalOpen:o}=e,[i]=f.Z.useForm();return console.log("existingCredential in add credentials tab: ".concat(JSON.stringify(r))),(0,s.jsx)(j.Z,{title:"Reuse Credentials",visible:l,onCancel:()=>{t(),i.resetFields()},footer:null,width:600,children:(0,s.jsxs)(f.Z,{form:i,onFinish:e=>{a(e),i.resetFields(),o(!1)},layout:"vertical",children:[(0,s.jsx)(f.Z.Item,{label:"Credential Name:",name:"credential_name",rules:[{required:!0,message:"Credential name is required"}],initialValue:null==r?void 0:r.credential_name,children:(0,s.jsx)(I.o,{placeholder:"Enter a friendly name for these credentials"})}),Object.entries((null==r?void 0:r.credential_values)||{}).map(e=>{let[l,t]=e;return(0,s.jsx)(f.Z.Item,{label:l,name:l,initialValue:t,children:(0,s.jsx)(I.o,{placeholder:"Enter ".concat(l),disabled:!0})},l)}),(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsx)(_.Z,{title:"Get help on our github",children:(0,s.jsx)(es,{href:"https://github.com/BerriAI/litellm/issues",children:"Need Help?"})}),(0,s.jsxs)("div",{children:[(0,s.jsx)(y.ZP,{onClick:()=>{t(),i.resetFields()},style:{marginRight:10},children:"Cancel"}),(0,s.jsx)(y.ZP,{htmlType:"submit",children:"Reuse Credentials"})]})]})]})})},er=t(63709),eo=t(45246),ei=t(96473);let{Text:en}=g.default;var ed=e=>{let{form:l,showCacheControl:t,onCacheControlChange:a}=e,r=e=>{let t=l.getFieldValue("litellm_extra_params");try{let s=t?JSON.parse(t):{};e.length>0?s.cache_control_injection_points=e:delete s.cache_control_injection_points,Object.keys(s).length>0?l.setFieldValue("litellm_extra_params",JSON.stringify(s,null,2)):l.setFieldValue("litellm_extra_params","")}catch(e){console.error("Error updating cache control points:",e)}};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(f.Z.Item,{label:"Cache Control Injection Points",name:"cache_control",valuePropName:"checked",className:"mb-4",tooltip:"Tell litellm where to inject cache control checkpoints. You can specify either by role (to apply to all messages of that role) or by specific message index.",children:(0,s.jsx)(er.Z,{onChange:a,className:"bg-gray-600"})}),t&&(0,s.jsxs)("div",{className:"ml-6 pl-4 border-l-2 border-gray-200",children:[(0,s.jsx)(en,{className:"text-sm text-gray-500 block mb-4",children:"Providers like Anthropic, Bedrock API require users to specify where to inject cache control checkpoints, litellm can automatically add them for you as a cost saving feature."}),(0,s.jsx)(f.Z.List,{name:"cache_control_injection_points",initialValue:[{location:"message"}],children:(e,t)=>{let{add:a,remove:o}=t;return(0,s.jsxs)(s.Fragment,{children:[e.map((t,a)=>(0,s.jsxs)("div",{className:"flex items-center mb-4 gap-4",children:[(0,s.jsx)(f.Z.Item,{...t,label:"Type",name:[t.name,"location"],initialValue:"message",className:"mb-0",style:{width:"180px"},children:(0,s.jsx)(v.default,{disabled:!0,options:[{value:"message",label:"Message"}]})}),(0,s.jsx)(f.Z.Item,{...t,label:"Role",name:[t.name,"role"],className:"mb-0",style:{width:"180px"},tooltip:"LiteLLM will mark all messages of this role as cacheable",children:(0,s.jsx)(v.default,{placeholder:"Select a role",allowClear:!0,options:[{value:"user",label:"User"},{value:"system",label:"System"},{value:"assistant",label:"Assistant"}],onChange:()=>{r(l.getFieldValue("cache_control_points"))}})}),(0,s.jsx)(f.Z.Item,{...t,label:"Index",name:[t.name,"index"],className:"mb-0",style:{width:"180px"},tooltip:"(Optional) If set litellm will mark the message at this index as cacheable",children:(0,s.jsx)($.Z,{type:"number",placeholder:"Optional",step:1,min:0,onChange:()=>{r(l.getFieldValue("cache_control_points"))}})}),e.length>1&&(0,s.jsx)(eo.Z,{className:"text-red-500 cursor-pointer text-lg ml-12",onClick:()=>{o(t.name),setTimeout(()=>{r(l.getFieldValue("cache_control_points"))},0)}})]},t.key)),(0,s.jsx)(f.Z.Item,{children:(0,s.jsxs)("button",{type:"button",className:"flex items-center justify-center w-full border border-dashed border-gray-300 py-2 px-4 text-gray-600 hover:text-blue-600 hover:border-blue-300 transition-all rounded",onClick:()=>a(),children:[(0,s.jsx)(ei.Z,{className:"mr-2"}),"Add Injection Point"]})})]})}})]})]})},ec=t(30401),em=t(78867),eu=t(59872),eh=t(51601),ex=t(44851),ep=t(67960),eg=t(20577),ef=t(70464),ej=t(26349),ev=t(92280);let{TextArea:e_}=ee.default,{Panel:ey}=ex.default;var eb=e=>{let{modelInfo:l,value:t,onChange:r}=e,[o,i]=(0,a.useState)([]),[n,d]=(0,a.useState)(!1),[c,m]=(0,a.useState)([]);(0,a.useEffect)(()=>{if(null==t?void 0:t.routes){let e=t.routes.map((e,l)=>({id:e.id||"route-".concat(l,"-").concat(Date.now()),model:e.name||e.model||"",utterances:e.utterances||[],description:e.description||"",score_threshold:e.score_threshold||.5}));i(e),m(e.map(e=>e.id))}else i([]),m([])},[t]);let u=e=>{let l=o.filter(l=>l.id!==e);i(l),x(l),m(l=>l.filter(l=>l!==e))},h=(e,l,t)=>{let s=o.map(s=>s.id===e?{...s,[l]:t}:s);i(s),x(s)},x=e=>{let l={routes:e.map(e=>({name:e.model,utterances:e.utterances,description:e.description,score_threshold:e.score_threshold}))};null==r||r(l)},p=l.map(e=>({value:e.model_group,label:e.model_group}));return(0,s.jsxs)("div",{className:"w-full max-w-none",children:[(0,s.jsxs)("div",{className:"flex justify-between items-center mb-6 w-full",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(ev.x,{className:"text-lg font-semibold",children:"Routes Configuration"}),(0,s.jsx)(_.Z,{title:"Configure routing logic to automatically select the best model based on user input patterns",children:(0,s.jsx)(el.Z,{className:"text-gray-400"})})]}),(0,s.jsx)(y.ZP,{type:"primary",icon:(0,s.jsx)(ei.Z,{}),onClick:()=>{let e="route-".concat(Date.now()),l=[...o,{id:e,model:"",utterances:[],description:"",score_threshold:.5}];i(l),x(l),m(l=>[...l,e])},className:"bg-blue-600 hover:bg-blue-700",children:"Add Route"})]}),0===o.length?(0,s.jsx)("div",{className:"text-center py-12 text-gray-500 bg-gray-50 rounded-lg border-2 border-dashed border-gray-200 mb-6",children:(0,s.jsx)(ev.x,{children:"No routes configured. Click “Add Route” to get started."})}):(0,s.jsx)("div",{className:"space-y-3 mb-6 w-full",children:o.map((e,l)=>(0,s.jsx)(ep.Z,{className:"border border-gray-200 shadow-sm w-full",bodyStyle:{padding:0},children:(0,s.jsx)(ex.default,{ghost:!0,expandIcon:e=>{let{isActive:l}=e;return(0,s.jsx)(ef.Z,{rotate:l?180:0})},activeKey:c,onChange:e=>m(Array.isArray(e)?e:[e].filter(Boolean)),items:[{key:e.id,label:(0,s.jsxs)("div",{className:"flex justify-between items-center py-2",children:[(0,s.jsxs)(ev.x,{className:"font-medium text-base",children:["Route ",l+1,": ",e.model||"Unnamed"]}),(0,s.jsx)(y.ZP,{type:"text",danger:!0,icon:(0,s.jsx)(ej.Z,{}),onClick:l=>{l.stopPropagation(),u(e.id)},className:"mr-2"})]}),children:(0,s.jsxs)("div",{className:"px-6 pb-6 w-full",children:[(0,s.jsxs)("div",{className:"mb-4 w-full",children:[(0,s.jsx)(ev.x,{className:"text-sm font-medium mb-2 block",children:"Model"}),(0,s.jsx)(v.default,{value:e.model,onChange:l=>h(e.id,"model",l),placeholder:"Select model",showSearch:!0,style:{width:"100%"},options:p})]}),(0,s.jsxs)("div",{className:"mb-4 w-full",children:[(0,s.jsx)(ev.x,{className:"text-sm font-medium mb-2 block",children:"Description"}),(0,s.jsx)(e_,{value:e.description,onChange:l=>h(e.id,"description",l.target.value),placeholder:"Describe when this route should be used...",rows:2,style:{width:"100%"}})]}),(0,s.jsxs)("div",{className:"mb-4 w-full",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,s.jsx)(ev.x,{className:"text-sm font-medium",children:"Score Threshold"}),(0,s.jsx)(_.Z,{title:"Minimum similarity score to route to this model (0-1)",children:(0,s.jsx)(el.Z,{className:"text-gray-400"})})]}),(0,s.jsx)(eg.Z,{value:e.score_threshold,onChange:l=>h(e.id,"score_threshold",l||0),min:0,max:1,step:.1,style:{width:"100%"},placeholder:"0.5"})]}),(0,s.jsxs)("div",{className:"w-full",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,s.jsx)(ev.x,{className:"text-sm font-medium",children:"Example Utterances"}),(0,s.jsx)(_.Z,{title:"Training examples for this route. Type an utterance and press Enter to add it.",children:(0,s.jsx)(el.Z,{className:"text-gray-400"})})]}),(0,s.jsx)(ev.x,{className:"text-xs text-gray-500 mb-2",children:"Type an utterance and press Enter to add it. You can also paste multiple lines."}),(0,s.jsx)(v.default,{mode:"tags",value:e.utterances,onChange:l=>h(e.id,"utterances",l),placeholder:"Type an utterance and press Enter...",style:{width:"100%"},tokenSeparators:["\n"],maxTagCount:"responsive",allowClear:!0})]})]})}]})},e.id))}),(0,s.jsxs)("div",{className:"border-t pt-6 w-full",children:[(0,s.jsxs)("div",{className:"flex justify-between items-center mb-4 w-full",children:[(0,s.jsx)(ev.x,{className:"text-lg font-semibold",children:"JSON Preview"}),(0,s.jsx)(y.ZP,{type:"link",onClick:()=>d(!n),className:"text-blue-600 p-0",children:n?"Hide":"Show"})]}),n&&(0,s.jsx)(ep.Z,{className:"bg-gray-50 w-full",children:(0,s.jsx)("pre",{className:"text-sm overflow-auto max-h-64 w-full",children:JSON.stringify({routes:o.map(e=>({name:e.model,utterances:e.utterances,description:e.description,score_threshold:e.score_threshold}))},null,2)})})]})]})},eN=e=>{let{isVisible:l,onCancel:t,onSuccess:r,modelData:o,accessToken:i,userRole:d}=e,[m]=f.Z.useForm(),[u,h]=(0,a.useState)(!1),[x,p]=(0,a.useState)([]),[g,_]=(0,a.useState)([]),[N,w]=(0,a.useState)(!1),[k,C]=(0,a.useState)(!1),[Z,S]=(0,a.useState)(null);(0,a.useEffect)(()=>{l&&o&&A()},[l,o]),(0,a.useEffect)(()=>{let e=async()=>{if(i)try{let e=await (0,n.modelAvailableCall)(i,"","",!1,null,!0,!0);p(e.data.map(e=>e.id))}catch(e){console.error("Error fetching model access groups:",e)}},t=async()=>{if(i)try{let e=await (0,eh.p)(i);_(e)}catch(e){console.error("Error fetching model info:",e)}};l&&(e(),t())},[l,i]);let A=()=>{try{var e,l,t,s,a,r;let i=null;(null===(e=o.litellm_params)||void 0===e?void 0:e.auto_router_config)&&(i="string"==typeof o.litellm_params.auto_router_config?JSON.parse(o.litellm_params.auto_router_config):o.litellm_params.auto_router_config),S(i),m.setFieldsValue({auto_router_name:o.model_name,auto_router_default_model:(null===(l=o.litellm_params)||void 0===l?void 0:l.auto_router_default_model)||"",auto_router_embedding_model:(null===(t=o.litellm_params)||void 0===t?void 0:t.auto_router_embedding_model)||"",model_access_group:(null===(s=o.model_info)||void 0===s?void 0:s.access_groups)||[]});let n=new Set(g.map(e=>e.model_group));w(!n.has(null===(a=o.litellm_params)||void 0===a?void 0:a.auto_router_default_model)),C(!n.has(null===(r=o.litellm_params)||void 0===r?void 0:r.auto_router_embedding_model))}catch(e){console.error("Error parsing auto router config:",e),c.Z.fromBackend("Error loading auto router configuration")}},I=async()=>{try{h(!0);let e=await m.validateFields(),l={...o.litellm_params,auto_router_config:JSON.stringify(Z),auto_router_default_model:e.auto_router_default_model,auto_router_embedding_model:e.auto_router_embedding_model||void 0},s={...o.model_info,access_groups:e.model_access_group||[]},a={model_name:e.auto_router_name,litellm_params:l,model_info:s};await (0,n.modelPatchUpdateCall)(i,a,o.model_info.id);let d={...o,model_name:e.auto_router_name,litellm_params:l,model_info:s};c.Z.success("Auto router configuration updated successfully"),r(d),t()}catch(e){console.error("Error updating auto router:",e),c.Z.fromBackend("Failed to update auto router configuration")}finally{h(!1)}},E=g.map(e=>({value:e.model_group,label:e.model_group}));return(0,s.jsx)(j.Z,{title:"Edit Auto Router Configuration",open:l,onCancel:t,footer:[(0,s.jsx)(y.ZP,{onClick:t,children:"Cancel"},"cancel"),(0,s.jsx)(y.ZP,{loading:u,onClick:I,children:"Save Changes"},"submit")],width:1e3,destroyOnClose:!0,children:(0,s.jsxs)("div",{className:"space-y-6",children:[(0,s.jsx)(b.x,{className:"text-gray-600",children:"Edit the auto router configuration including routing logic, default models, and access settings."}),(0,s.jsxs)(f.Z,{form:m,layout:"vertical",className:"space-y-4",children:[(0,s.jsx)(f.Z.Item,{label:"Auto Router Name",name:"auto_router_name",rules:[{required:!0,message:"Auto router name is required"}],children:(0,s.jsx)(b.o,{placeholder:"e.g., auto_router_1, smart_routing"})}),(0,s.jsx)("div",{className:"w-full",children:(0,s.jsx)(eb,{modelInfo:g,value:Z,onChange:e=>{S(e)}})}),(0,s.jsx)(f.Z.Item,{label:"Default Model",name:"auto_router_default_model",rules:[{required:!0,message:"Default model is required"}],children:(0,s.jsx)(v.default,{placeholder:"Select a default model",onChange:e=>{w("custom"===e)},options:[...E,{value:"custom",label:"Enter custom model name"}],showSearch:!0})}),(0,s.jsx)(f.Z.Item,{label:"Embedding Model",name:"auto_router_embedding_model",children:(0,s.jsx)(v.default,{placeholder:"Select an embedding model (optional)",onChange:e=>{C("custom"===e)},options:[...E,{value:"custom",label:"Enter custom model name"}],showSearch:!0,allowClear:!0})}),"Admin"===d&&(0,s.jsx)(f.Z.Item,{label:"Model Access Groups",name:"model_access_group",tooltip:"Control who can access this auto router",children:(0,s.jsx)(v.default,{mode:"tags",showSearch:!0,placeholder:"Select existing groups or type to create new ones",optionFilterProp:"children",tokenSeparators:[","],options:x.map(e=>({value:e,label:e})),maxTagCount:"responsive",allowClear:!0})})]})]})})};function ew(e){var l,t,r,m,u,h,x,g,b,N,w,k,C,Z,S,A,I,E,P,M,F,L,T,R,D,V,q,et;let{modelId:es,onClose:er,modelData:eo,accessToken:ei,userID:en,userRole:eh,editModel:ex,setEditModalVisible:ep,setSelectedModel:eg,onModelUpdate:ef,modelAccessGroups:ej}=e,[ev]=f.Z.useForm(),[e_,ey]=(0,a.useState)(null),[eb,ew]=(0,a.useState)(!1),[ek,eC]=(0,a.useState)(!1),[eZ,eS]=(0,a.useState)(!1),[eA,eI]=(0,a.useState)(!1),[eE,eP]=(0,a.useState)(!1),[eM,eF]=(0,a.useState)(null),[eL,eT]=(0,a.useState)(!1),[eR,eO]=(0,a.useState)({}),[eD,eV]=(0,a.useState)(!1),[eq,ez]=(0,a.useState)([]),eB="Admin"===eh||(null==eo?void 0:null===(l=eo.model_info)||void 0===l?void 0:l.created_by)===en,eK=(null==eo?void 0:null===(t=eo.litellm_params)||void 0===t?void 0:t.auto_router_config)!=null,eU=(null==eo?void 0:null===(r=eo.litellm_params)||void 0===r?void 0:r.litellm_credential_name)!=null&&(null==eo?void 0:null===(m=eo.litellm_params)||void 0===m?void 0:m.litellm_credential_name)!=void 0;console.log("usingExistingCredential, ",eU),console.log("modelData.litellm_params.litellm_credential_name, ",null==eo?void 0:null===(u=eo.litellm_params)||void 0===u?void 0:u.litellm_credential_name),(0,a.useEffect)(()=>{let e=async()=>{var e,l,t,s,a,r,o;if(!ei)return;let i=await (0,n.modelInfoV1Call)(ei,es);console.log("modelInfoResponse, ",i);let d=i.data[0];d&&!d.litellm_model_name&&(d={...d,litellm_model_name:null!==(o=null!==(r=null!==(a=null==d?void 0:null===(l=d.litellm_params)||void 0===l?void 0:l.litellm_model_name)&&void 0!==a?a:null==d?void 0:null===(t=d.litellm_params)||void 0===t?void 0:t.model)&&void 0!==r?r:null==d?void 0:null===(s=d.model_info)||void 0===s?void 0:s.key)&&void 0!==o?o:null}),ey(d),(null==d?void 0:null===(e=d.litellm_params)||void 0===e?void 0:e.cache_control_injection_points)&&eT(!0)},l=async()=>{if(ei)try{let e=(await (0,n.getGuardrailsList)(ei)).guardrails.map(e=>e.guardrail_name);ez(e)}catch(e){console.error("Failed to fetch guardrails:",e)}};(async()=>{if(console.log("accessToken, ",ei),!ei||eU)return;let e=await (0,n.credentialGetCall)(ei,null,es);console.log("existingCredentialResponse, ",e),eF({credential_name:e.credential_name,credential_values:e.credential_values,credential_info:e.credential_info})})(),e(),l()},[ei,es]);let eG=async e=>{var l;if(console.log("values, ",e),!ei)return;let t={credential_name:e.credential_name,model_id:es,credential_info:{custom_llm_provider:null===(l=e_.litellm_params)||void 0===l?void 0:l.custom_llm_provider}};c.Z.info("Storing credential.."),console.log("credentialResponse, ",await (0,n.credentialCreateCall)(ei,t)),c.Z.success("Credential stored successfully")},eH=async e=>{try{var l;let t;if(!ei)return;eI(!0),console.log("values.model_name, ",e.model_name);let s={...e_.litellm_params,model:e.litellm_model_name,api_base:e.api_base,custom_llm_provider:e.custom_llm_provider,organization:e.organization,tpm:e.tpm,rpm:e.rpm,max_retries:e.max_retries,timeout:e.timeout,stream_timeout:e.stream_timeout,input_cost_per_token:e.input_cost/1e6,output_cost_per_token:e.output_cost/1e6};e.guardrails&&(s.guardrails=e.guardrails),e.cache_control&&(null===(l=e.cache_control_injection_points)||void 0===l?void 0:l.length)>0?s.cache_control_injection_points=e.cache_control_injection_points:delete s.cache_control_injection_points;try{t=e.model_info?JSON.parse(e.model_info):eo.model_info,e.model_access_group&&(t={...t,access_groups:e.model_access_group})}catch(e){c.Z.fromBackend("Invalid JSON in Model Info");return}let a={model_name:e.model_name,litellm_params:s,model_info:t};await (0,n.modelPatchUpdateCall)(ei,a,es);let r={...e_,model_name:e.model_name,litellm_model_name:e.litellm_model_name,litellm_params:s,model_info:t};ey(r),ef&&ef(r),c.Z.success("Model settings updated successfully"),eS(!1),eP(!1)}catch(e){console.error("Error updating model:",e),c.Z.fromBackend("Failed to update model settings")}finally{eI(!1)}};if(!eo)return(0,s.jsxs)("div",{className:"p-4",children:[(0,s.jsx)(z.Z,{icon:Q.Z,variant:"light",onClick:er,className:"mb-4",children:"Back to Models"}),(0,s.jsx)(i.Z,{children:"Model not found"})]});let eJ=async()=>{try{if(!ei)return;await (0,n.modelDeleteCall)(ei,es),c.Z.success("Model deleted successfully"),ef&&ef({deleted:!0,model_info:{id:es}}),er()}catch(e){console.error("Error deleting the model:",e),c.Z.fromBackend("Failed to delete model")}},eW=async(e,l)=>{await (0,eu.vQ)(e)&&(eO(e=>({...e,[l]:!0})),setTimeout(()=>{eO(e=>({...e,[l]:!1}))},2e3))};return(0,s.jsxs)("div",{className:"p-4",children:[(0,s.jsxs)("div",{className:"flex justify-between items-center mb-6",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(z.Z,{icon:Q.Z,variant:"light",onClick:er,className:"mb-4",children:"Back to Models"}),(0,s.jsxs)(Y.Z,{children:["Public Model Name: ",O(eo)]}),(0,s.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,s.jsx)(i.Z,{className:"text-gray-500 font-mono",children:eo.model_info.id}),(0,s.jsx)(y.ZP,{type:"text",size:"small",icon:eR["model-id"]?(0,s.jsx)(ec.Z,{size:12}):(0,s.jsx)(em.Z,{size:12}),onClick:()=>eW(eo.model_info.id,"model-id"),className:"left-2 z-10 transition-all duration-200 ".concat(eR["model-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]})]}),(0,s.jsxs)("div",{className:"flex gap-2",children:["Admin"===eh&&(0,s.jsx)(z.Z,{icon:X.Z,variant:"secondary",onClick:()=>eC(!0),className:"flex items-center",children:"Re-use Credentials"}),eB&&(0,s.jsx)(z.Z,{icon:p.Z,variant:"secondary",onClick:()=>ew(!0),className:"flex items-center",children:"Delete Model"})]})]}),(0,s.jsxs)(U.Z,{children:[(0,s.jsxs)(G.Z,{className:"mb-6",children:[(0,s.jsx)(K.Z,{children:"Overview"}),(0,s.jsx)(K.Z,{children:"Raw JSON"})]}),(0,s.jsxs)(J.Z,{children:[(0,s.jsxs)(H.Z,{children:[(0,s.jsxs)(o.Z,{numItems:1,numItemsSm:2,numItemsLg:3,className:"gap-6 mb-6",children:[(0,s.jsxs)(B.Z,{children:[(0,s.jsx)(i.Z,{children:"Provider"}),(0,s.jsxs)("div",{className:"mt-2 flex items-center space-x-2",children:[eo.provider&&(0,s.jsx)("img",{src:(0,d.dr)(eo.provider).logo,alt:"".concat(eo.provider," logo"),className:"w-4 h-4",onError:e=>{let l=e.target,t=l.parentElement;if(t){var s;let e=document.createElement("div");e.className="w-4 h-4 rounded-full bg-gray-200 flex items-center justify-center text-xs",e.textContent=(null===(s=eo.provider)||void 0===s?void 0:s.charAt(0))||"-",t.replaceChild(e,l)}}}),(0,s.jsx)(Y.Z,{children:eo.provider||"Not Set"})]})]}),(0,s.jsxs)(B.Z,{children:[(0,s.jsx)(i.Z,{children:"LiteLLM Model"}),(0,s.jsx)("div",{className:"mt-2 overflow-hidden",children:(0,s.jsx)(_.Z,{title:eo.litellm_model_name||"Not Set",children:(0,s.jsx)("div",{className:"break-all text-sm font-medium leading-relaxed cursor-pointer",children:eo.litellm_model_name||"Not Set"})})})]}),(0,s.jsxs)(B.Z,{children:[(0,s.jsx)(i.Z,{children:"Pricing"}),(0,s.jsxs)("div",{className:"mt-2",children:[(0,s.jsxs)(i.Z,{children:["Input: $",eo.input_cost,"/1M tokens"]}),(0,s.jsxs)(i.Z,{children:["Output: $",eo.output_cost,"/1M tokens"]})]})]})]}),(0,s.jsxs)("div",{className:"mb-6 text-sm text-gray-500 flex items-center gap-x-6",children:[(0,s.jsxs)("div",{className:"flex items-center gap-x-2",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:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})}),"Created At"," ",eo.model_info.created_at?new Date(eo.model_info.created_at).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):"Not Set"]}),(0,s.jsxs)("div",{className:"flex items-center gap-x-2",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:"M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"})}),"Created By ",eo.model_info.created_by||"Not Set"]})]}),(0,s.jsxs)(B.Z,{children:[(0,s.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,s.jsx)(Y.Z,{children:"Model Settings"}),(0,s.jsxs)("div",{className:"flex gap-2",children:[eK&&eB&&!eE&&(0,s.jsx)(z.Z,{variant:"primary",onClick:()=>eV(!0),className:"flex items-center",children:"Edit Auto Router"}),eB&&!eE&&(0,s.jsx)(z.Z,{variant:"secondary",onClick:()=>eP(!0),className:"flex items-center",children:"Edit Model"})]})]}),e_?(0,s.jsx)(f.Z,{form:ev,onFinish:eH,initialValues:{model_name:e_.model_name,litellm_model_name:e_.litellm_model_name,api_base:e_.litellm_params.api_base,custom_llm_provider:e_.litellm_params.custom_llm_provider,organization:e_.litellm_params.organization,tpm:e_.litellm_params.tpm,rpm:e_.litellm_params.rpm,max_retries:e_.litellm_params.max_retries,timeout:e_.litellm_params.timeout,stream_timeout:e_.litellm_params.stream_timeout,input_cost:e_.litellm_params.input_cost_per_token?1e6*e_.litellm_params.input_cost_per_token:(null===(h=e_.model_info)||void 0===h?void 0:h.input_cost_per_token)*1e6||null,output_cost:(null===(x=e_.litellm_params)||void 0===x?void 0:x.output_cost_per_token)?1e6*e_.litellm_params.output_cost_per_token:(null===(g=e_.model_info)||void 0===g?void 0:g.output_cost_per_token)*1e6||null,cache_control:null!==(b=e_.litellm_params)&&void 0!==b&&!!b.cache_control_injection_points,cache_control_injection_points:(null===(N=e_.litellm_params)||void 0===N?void 0:N.cache_control_injection_points)||[],model_access_group:Array.isArray(null===(w=e_.model_info)||void 0===w?void 0:w.access_groups)?e_.model_info.access_groups:[],guardrails:Array.isArray(null===(k=e_.litellm_params)||void 0===k?void 0:k.guardrails)?e_.litellm_params.guardrails:[]},layout:"vertical",onValuesChange:()=>eS(!0),children:(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(i.Z,{className:"font-medium",children:"Model Name"}),eE?(0,s.jsx)(f.Z.Item,{name:"model_name",className:"mb-0",children:(0,s.jsx)(W.Z,{placeholder:"Enter model name"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:e_.model_name})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(i.Z,{className:"font-medium",children:"LiteLLM Model Name"}),eE?(0,s.jsx)(f.Z.Item,{name:"litellm_model_name",className:"mb-0",children:(0,s.jsx)(W.Z,{placeholder:"Enter LiteLLM model name"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:e_.litellm_model_name})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(i.Z,{className:"font-medium",children:"Input Cost (per 1M tokens)"}),eE?(0,s.jsx)(f.Z.Item,{name:"input_cost",className:"mb-0",children:(0,s.jsx)($.Z,{placeholder:"Enter input cost"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null==e_?void 0:null===(C=e_.litellm_params)||void 0===C?void 0:C.input_cost_per_token)?((null===(Z=e_.litellm_params)||void 0===Z?void 0:Z.input_cost_per_token)*1e6).toFixed(4):(null==e_?void 0:null===(S=e_.model_info)||void 0===S?void 0:S.input_cost_per_token)?(1e6*e_.model_info.input_cost_per_token).toFixed(4):null})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(i.Z,{className:"font-medium",children:"Output Cost (per 1M tokens)"}),eE?(0,s.jsx)(f.Z.Item,{name:"output_cost",className:"mb-0",children:(0,s.jsx)($.Z,{placeholder:"Enter output cost"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null==e_?void 0:null===(A=e_.litellm_params)||void 0===A?void 0:A.output_cost_per_token)?(1e6*e_.litellm_params.output_cost_per_token).toFixed(4):(null==e_?void 0:null===(I=e_.model_info)||void 0===I?void 0:I.output_cost_per_token)?(1e6*e_.model_info.output_cost_per_token).toFixed(4):null})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(i.Z,{className:"font-medium",children:"API Base"}),eE?(0,s.jsx)(f.Z.Item,{name:"api_base",className:"mb-0",children:(0,s.jsx)(W.Z,{placeholder:"Enter API base"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(E=e_.litellm_params)||void 0===E?void 0:E.api_base)||"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(i.Z,{className:"font-medium",children:"Custom LLM Provider"}),eE?(0,s.jsx)(f.Z.Item,{name:"custom_llm_provider",className:"mb-0",children:(0,s.jsx)(W.Z,{placeholder:"Enter custom LLM provider"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(P=e_.litellm_params)||void 0===P?void 0:P.custom_llm_provider)||"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(i.Z,{className:"font-medium",children:"Organization"}),eE?(0,s.jsx)(f.Z.Item,{name:"organization",className:"mb-0",children:(0,s.jsx)(W.Z,{placeholder:"Enter organization"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(M=e_.litellm_params)||void 0===M?void 0:M.organization)||"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(i.Z,{className:"font-medium",children:"TPM (Tokens per Minute)"}),eE?(0,s.jsx)(f.Z.Item,{name:"tpm",className:"mb-0",children:(0,s.jsx)($.Z,{placeholder:"Enter TPM"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(F=e_.litellm_params)||void 0===F?void 0:F.tpm)||"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(i.Z,{className:"font-medium",children:"RPM (Requests per Minute)"}),eE?(0,s.jsx)(f.Z.Item,{name:"rpm",className:"mb-0",children:(0,s.jsx)($.Z,{placeholder:"Enter RPM"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(L=e_.litellm_params)||void 0===L?void 0:L.rpm)||"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(i.Z,{className:"font-medium",children:"Max Retries"}),eE?(0,s.jsx)(f.Z.Item,{name:"max_retries",className:"mb-0",children:(0,s.jsx)($.Z,{placeholder:"Enter max retries"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(T=e_.litellm_params)||void 0===T?void 0:T.max_retries)||"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(i.Z,{className:"font-medium",children:"Timeout (seconds)"}),eE?(0,s.jsx)(f.Z.Item,{name:"timeout",className:"mb-0",children:(0,s.jsx)($.Z,{placeholder:"Enter timeout"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(R=e_.litellm_params)||void 0===R?void 0:R.timeout)||"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(i.Z,{className:"font-medium",children:"Stream Timeout (seconds)"}),eE?(0,s.jsx)(f.Z.Item,{name:"stream_timeout",className:"mb-0",children:(0,s.jsx)($.Z,{placeholder:"Enter stream timeout"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(D=e_.litellm_params)||void 0===D?void 0:D.stream_timeout)||"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(i.Z,{className:"font-medium",children:"Model Access Groups"}),eE?(0,s.jsx)(f.Z.Item,{name:"model_access_group",className:"mb-0",children:(0,s.jsx)(v.default,{mode:"tags",showSearch:!0,placeholder:"Select existing groups or type to create new ones",optionFilterProp:"children",tokenSeparators:[","],maxTagCount:"responsive",allowClear:!0,style:{width:"100%"},options:null==ej?void 0:ej.map(e=>({value:e,label:e}))})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(V=e_.model_info)||void 0===V?void 0:V.access_groups)?Array.isArray(e_.model_info.access_groups)?e_.model_info.access_groups.length>0?(0,s.jsx)("div",{className:"flex flex-wrap gap-1",children:e_.model_info.access_groups.map((e,l)=>(0,s.jsx)("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-blue-100 text-blue-800",children:e},l))}):"No groups assigned":e_.model_info.access_groups:"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsxs)(i.Z,{className:"font-medium",children:["Guardrails"," ",(0,s.jsx)(_.Z,{title:"Apply safety guardrails to this model to filter content or enforce policies",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)(el.Z,{style:{marginLeft:"4px"}})})})]}),eE?(0,s.jsx)(f.Z.Item,{name:"guardrails",className:"mb-0",children:(0,s.jsx)(v.default,{mode:"tags",showSearch:!0,placeholder:"Select existing guardrails or type to create new ones",optionFilterProp:"children",tokenSeparators:[","],maxTagCount:"responsive",allowClear:!0,style:{width:"100%"},options:eq.map(e=>({value:e,label:e}))})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(q=e_.litellm_params)||void 0===q?void 0:q.guardrails)?Array.isArray(e_.litellm_params.guardrails)?e_.litellm_params.guardrails.length>0?(0,s.jsx)("div",{className:"flex flex-wrap gap-1",children:e_.litellm_params.guardrails.map((e,l)=>(0,s.jsx)("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-green-100 text-green-800",children:e},l))}):"No guardrails assigned":e_.litellm_params.guardrails:"Not Set"})]}),eE?(0,s.jsx)(ed,{form:ev,showCacheControl:eL,onCacheControlChange:e=>eT(e)}):(0,s.jsxs)("div",{children:[(0,s.jsx)(i.Z,{className:"font-medium",children:"Cache Control"}),(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(et=e_.litellm_params)||void 0===et?void 0:et.cache_control_injection_points)?(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{children:"Enabled"}),(0,s.jsx)("div",{className:"mt-2",children:e_.litellm_params.cache_control_injection_points.map((e,l)=>(0,s.jsxs)("div",{className:"text-sm text-gray-600 mb-1",children:["Location: ",e.location,",",e.role&&(0,s.jsxs)("span",{children:[" Role: ",e.role]}),void 0!==e.index&&(0,s.jsxs)("span",{children:[" Index: ",e.index]})]},l))})]}):"Disabled"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(i.Z,{className:"font-medium",children:"Model Info"}),eE?(0,s.jsx)(f.Z.Item,{name:"model_info",className:"mb-0",children:(0,s.jsx)(ee.default.TextArea,{rows:4,placeholder:'{"gpt-4": 100, "claude-v1": 200}',defaultValue:JSON.stringify(eo.model_info,null,2)})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(0,s.jsx)("pre",{className:"bg-gray-100 p-2 rounded text-xs overflow-auto mt-1",children:JSON.stringify(e_.model_info,null,2)})})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(i.Z,{className:"font-medium",children:"Team ID"}),(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:eo.model_info.team_id||"Not Set"})]})]}),eE&&(0,s.jsxs)("div",{className:"mt-6 flex justify-end gap-2",children:[(0,s.jsx)(z.Z,{variant:"secondary",onClick:()=>{ev.resetFields(),eS(!1),eP(!1)},children:"Cancel"}),(0,s.jsx)(z.Z,{variant:"primary",onClick:()=>ev.submit(),loading:eA,children:"Save Changes"})]})]})}):(0,s.jsx)(i.Z,{children:"Loading..."})]})]}),(0,s.jsx)(H.Z,{children:(0,s.jsx)(B.Z,{children:(0,s.jsx)("pre",{className:"bg-gray-100 p-4 rounded text-xs overflow-auto",children:JSON.stringify(eo,null,2)})})})]})]}),eb&&(0,s.jsx)("div",{className:"fixed z-10 inset-0 overflow-y-auto",children:(0,s.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,s.jsx)("div",{className:"fixed inset-0 transition-opacity","aria-hidden":"true",children:(0,s.jsx)("div",{className:"absolute inset-0 bg-gray-500 opacity-75"})}),(0,s.jsx)("span",{className:"hidden sm:inline-block sm:align-middle sm:h-screen","aria-hidden":"true",children:""}),(0,s.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,s.jsx)("div",{className:"bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4",children:(0,s.jsx)("div",{className:"sm:flex sm:items-start",children:(0,s.jsxs)("div",{className:"mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left",children:[(0,s.jsx)("h3",{className:"text-lg leading-6 font-medium text-gray-900",children:"Delete Model"}),(0,s.jsx)("div",{className:"mt-2",children:(0,s.jsx)("p",{className:"text-sm text-gray-500",children:"Are you sure you want to delete this model?"})})]})})}),(0,s.jsxs)("div",{className:"bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse",children:[(0,s.jsx)(y.ZP,{onClick:eJ,className:"ml-2",danger:!0,children:"Delete"}),(0,s.jsx)(y.ZP,{onClick:()=>ew(!1),children:"Cancel"})]})]})]})}),ek&&!eU?(0,s.jsx)(ea,{isVisible:ek,onCancel:()=>eC(!1),onAddCredential:eG,existingCredential:eM,setIsCredentialModalOpen:eC}):(0,s.jsx)(j.Z,{open:ek,onCancel:()=>eC(!1),title:"Using Existing Credential",children:(0,s.jsx)(i.Z,{children:eo.litellm_params.litellm_credential_name})}),(0,s.jsx)(eN,{isVisible:eD,onCancel:()=>eV(!1),onSuccess:e=>{ey(e),ef&&ef(e)},modelData:e_||eo,accessToken:ei||"",userRole:eh||""})]})}var ek=t(58643),eC=e=>{let{selectedProvider:l,providerModels:t,getPlaceholder:a}=e,r=f.Z.useFormInstance(),o=e=>{let t=e.target.value,s=(r.getFieldValue("model_mappings")||[]).map(e=>"custom"===e.public_name||"custom"===e.litellm_model?l===d.Cl.Azure?{public_name:t,litellm_model:"azure/".concat(t)}:{public_name:t,litellm_model:t}:e);r.setFieldsValue({model_mappings:s})};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(f.Z.Item,{label:"LiteLLM Model Name(s)",tooltip:"The model name LiteLLM will send to the LLM API",className:"mb-0",children:[(0,s.jsx)(f.Z.Item,{name:"model",rules:[{required:!0,message:"Please enter ".concat(l===d.Cl.Azure?"a deployment name":"at least one model",".")}],noStyle:!0,children:l===d.Cl.Azure||l===d.Cl.OpenAI_Compatible||l===d.Cl.Ollama?(0,s.jsx)(s.Fragment,{children:(0,s.jsx)(b.o,{placeholder:a(l),onChange:l===d.Cl.Azure?e=>{let l=e.target.value,t=l?[{public_name:l,litellm_model:"azure/".concat(l)}]:[];r.setFieldsValue({model:l,model_mappings:t})}:void 0})}):t.length>0?(0,s.jsx)(v.default,{mode:"multiple",allowClear:!0,showSearch:!0,placeholder:"Select models",onChange:e=>{let t=Array.isArray(e)?e:[e];if(t.includes("all-wildcard"))r.setFieldsValue({model_name:void 0,model_mappings:[]});else if(JSON.stringify(r.getFieldValue("model"))!==JSON.stringify(t)){let e=t.map(e=>l===d.Cl.Azure?{public_name:e,litellm_model:"azure/".concat(e)}:{public_name:e,litellm_model:e});r.setFieldsValue({model:t,model_mappings:e})}},optionFilterProp:"children",filterOption:(e,l)=>{var t;return(null!==(t=null==l?void 0:l.label)&&void 0!==t?t:"").toLowerCase().includes(e.toLowerCase())},options:[{label:"Custom Model Name (Enter below)",value:"custom"},{label:"All ".concat(l," Models (Wildcard)"),value:"all-wildcard"},...t.map(e=>({label:e,value:e}))],style:{width:"100%"}}):(0,s.jsx)(b.o,{placeholder:a(l)})}),(0,s.jsx)(f.Z.Item,{noStyle:!0,shouldUpdate:(e,l)=>e.model!==l.model,children:e=>{let{getFieldValue:t}=e,a=t("model")||[];return(Array.isArray(a)?a:[a]).includes("custom")&&(0,s.jsx)(f.Z.Item,{name:"custom_model_name",rules:[{required:!0,message:"Please enter a custom model name."}],className:"mt-2",children:(0,s.jsx)(b.o,{placeholder:l===d.Cl.Azure?"Enter Azure deployment name":"Enter custom model name",onChange:o})})}})]}),(0,s.jsxs)(w.Z,{children:[(0,s.jsx)(k.Z,{span:10}),(0,s.jsx)(k.Z,{span:14,children:(0,s.jsx)(b.x,{className:"mb-3 mt-1",children:l===d.Cl.Azure?"Your deployment name will be saved as the public model name, and LiteLLM will use 'azure/deployment-name' internally":"The model name LiteLLM will send to the LLM API"})})]})]})},eZ=t(72188),eS=t(67187);let eA=e=>{let{content:l,children:t,width:r="auto",className:o=""}=e,[i,n]=(0,a.useState)(!1),[d,c]=(0,a.useState)("top"),m=(0,a.useRef)(null),u=()=>{if(m.current){let e=m.current.getBoundingClientRect(),l=e.top,t=window.innerHeight-e.bottom;l<300&&t>300?c("bottom"):c("top")}};return(0,s.jsxs)("div",{className:"relative inline-block",ref:m,children:[t||(0,s.jsx)(eS.Z,{className:"ml-1 text-gray-500 cursor-help",onMouseEnter:()=>{u(),n(!0)},onMouseLeave:()=>n(!1)}),i&&(0,s.jsxs)("div",{className:"absolute left-1/2 -translate-x-1/2 z-50 bg-black/90 text-white p-2 rounded-md text-sm font-normal shadow-lg ".concat(o),style:{["top"===d?"bottom":"top"]:"100%",width:r,marginBottom:"top"===d?"8px":"0",marginTop:"bottom"===d?"8px":"0"},children:[l,(0,s.jsx)("div",{className:"absolute left-1/2 -translate-x-1/2 w-0 h-0",style:{top:"top"===d?"100%":"auto",bottom:"bottom"===d?"100%":"auto",borderTop:"top"===d?"6px solid rgba(0, 0, 0, 0.9)":"6px solid transparent",borderBottom:"bottom"===d?"6px solid rgba(0, 0, 0, 0.9)":"6px solid transparent",borderLeft:"6px solid transparent",borderRight:"6px solid transparent"}})]})]})};var eI=()=>{let e=f.Z.useFormInstance(),[l,t]=(0,a.useState)(0),r=f.Z.useWatch("model",e)||[],o=Array.isArray(r)?r:[r],i=f.Z.useWatch("custom_model_name",e),n=!o.includes("all-wildcard"),c=f.Z.useWatch("custom_llm_provider",e);if((0,a.useEffect)(()=>{if(i&&o.includes("custom")){let l=(e.getFieldValue("model_mappings")||[]).map(e=>"custom"===e.public_name||"custom"===e.litellm_model?c===d.Cl.Azure?{public_name:i,litellm_model:"azure/".concat(i)}:{public_name:i,litellm_model:i}:e);e.setFieldValue("model_mappings",l),t(e=>e+1)}},[i,o,c,e]),(0,a.useEffect)(()=>{if(o.length>0&&!o.includes("all-wildcard")){let l=e.getFieldValue("model_mappings")||[];if(l.length!==o.length||!o.every(e=>l.some(l=>"custom"===e?"custom"===l.litellm_model||l.litellm_model===i:c===d.Cl.Azure?l.litellm_model==="azure/".concat(e):l.litellm_model===e))){let l=o.map(e=>"custom"===e&&i?c===d.Cl.Azure?{public_name:i,litellm_model:"azure/".concat(i)}:{public_name:i,litellm_model:i}:c===d.Cl.Azure?{public_name:e,litellm_model:"azure/".concat(e)}:{public_name:e,litellm_model:e});e.setFieldValue("model_mappings",l),t(e=>e+1)}}},[o,i,c,e]),!n)return null;let m=(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"mb-2 font-normal",children:"The name you specify in your API calls to LiteLLM Proxy"}),(0,s.jsxs)("div",{className:"mb-2 font-normal",children:[(0,s.jsx)("strong",{children:"Example:"})," If you name your public model"," ",(0,s.jsx)("code",{className:"bg-gray-700 px-1 py-0.5 rounded text-xs",children:"example-name"}),", and choose"," ",(0,s.jsx)("code",{className:"bg-gray-700 px-1 py-0.5 rounded text-xs",children:"openai/qwen-plus-latest"})," as the LiteLLM model"]}),(0,s.jsxs)("div",{className:"mb-2 font-normal",children:[(0,s.jsx)("strong",{children:"Usage:"})," You make an API call to the LiteLLM proxy with"," ",(0,s.jsx)("code",{className:"bg-gray-700 px-1 py-0.5 rounded text-xs",children:'model = "example-name"'})]}),(0,s.jsxs)("div",{className:"font-normal",children:[(0,s.jsx)("strong",{children:"Result:"})," LiteLLM sends"," ",(0,s.jsx)("code",{className:"bg-gray-700 px-1 py-0.5 rounded text-xs",children:"qwen-plus-latest"})," to the provider"]})]}),u=(0,s.jsx)("div",{children:"The model name LiteLLM will send to the LLM API"}),h=[{title:(0,s.jsxs)("span",{className:"flex items-center",children:["Public Model Name",(0,s.jsx)(eA,{content:m,width:"500px"})]}),dataIndex:"public_name",key:"public_name",render:(l,t,a)=>(0,s.jsx)(I.o,{value:l,onChange:l=>{let t=[...e.getFieldValue("model_mappings")];t[a].public_name=l.target.value,e.setFieldValue("model_mappings",t)}})},{title:(0,s.jsxs)("span",{className:"flex items-center",children:["LiteLLM Model Name",(0,s.jsx)(eA,{content:u,width:"360px"})]}),dataIndex:"litellm_model",key:"litellm_model"}];return(0,s.jsx)(s.Fragment,{children:(0,s.jsx)(f.Z.Item,{label:"Model Mappings",name:"model_mappings",tooltip:"Map public model names to LiteLLM model names for load balancing",labelCol:{span:10},wrapperCol:{span:16},labelAlign:"left",rules:[{required:!0,validator:async(e,l)=>{if(!l||0===l.length)throw Error("At least one model mapping is required");if(l.filter(e=>!e.public_name||""===e.public_name.trim()).length>0)throw Error("All model mappings must have valid public names")}}],children:(0,s.jsx)(eZ.Z,{dataSource:e.getFieldValue("model_mappings"),columns:h,pagination:!1,size:"small"},l)})})},eE=t(26210),eP=t(90464);let{Link:eM}=g.default;var eF=e=>{let{showAdvancedSettings:l,setShowAdvancedSettings:t,teams:r,guardrailsList:o}=e,[i]=f.Z.useForm(),[n,d]=a.useState(!1),[c,m]=a.useState("per_token"),[u,h]=a.useState(!1),x=(e,l)=>l&&(isNaN(Number(l))||0>Number(l))?Promise.reject("Please enter a valid positive number"):Promise.resolve(),p=(e,l)=>{if(!l)return Promise.resolve();try{return JSON.parse(l),Promise.resolve()}catch(e){return Promise.reject("Please enter valid JSON")}};return(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)(eE.UQ,{className:"mt-2 mb-4",children:[(0,s.jsx)(eE._m,{children:(0,s.jsx)("b",{children:"Advanced Settings"})}),(0,s.jsx)(eE.X1,{children:(0,s.jsxs)("div",{className:"bg-white rounded-lg",children:[(0,s.jsx)(f.Z.Item,{label:"Custom Pricing",name:"custom_pricing",valuePropName:"checked",className:"mb-4",children:(0,s.jsx)(er.Z,{onChange:e=>{d(e),e||i.setFieldsValue({input_cost_per_token:void 0,output_cost_per_token:void 0,input_cost_per_second:void 0})},className:"bg-gray-600"})}),(0,s.jsx)(f.Z.Item,{label:(0,s.jsxs)("span",{children:["Guardrails"," ",(0,s.jsx)(_.Z,{title:"Apply safety guardrails to this key to filter content or enforce policies",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)(el.Z,{style:{marginLeft:"4px"}})})})]}),name:"guardrails",className:"mt-4",help:"Select existing guardrails. Go to 'Guardrails' tab to create new guardrails.",children:(0,s.jsx)(v.default,{mode:"tags",style:{width:"100%"},placeholder:"Select or enter guardrails",options:o.map(e=>({value:e,label:e}))})}),n&&(0,s.jsxs)("div",{className:"ml-6 pl-4 border-l-2 border-gray-200",children:[(0,s.jsx)(f.Z.Item,{label:"Pricing Model",name:"pricing_model",className:"mb-4",children:(0,s.jsx)(v.default,{defaultValue:"per_token",onChange:e=>m(e),options:[{value:"per_token",label:"Per Million Tokens"},{value:"per_second",label:"Per Second"}]})}),"per_token"===c?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(f.Z.Item,{label:"Input Cost (per 1M tokens)",name:"input_cost_per_token",rules:[{validator:x}],className:"mb-4",children:(0,s.jsx)(eE.oi,{})}),(0,s.jsx)(f.Z.Item,{label:"Output Cost (per 1M tokens)",name:"output_cost_per_token",rules:[{validator:x}],className:"mb-4",children:(0,s.jsx)(eE.oi,{})})]}):(0,s.jsx)(f.Z.Item,{label:"Cost Per Second",name:"input_cost_per_second",rules:[{validator:x}],className:"mb-4",children:(0,s.jsx)(eE.oi,{})})]}),(0,s.jsx)(f.Z.Item,{label:"Use in pass through routes",name:"use_in_pass_through",valuePropName:"checked",className:"mb-4 mt-4",tooltip:(0,s.jsxs)("span",{children:["Allow using these credentials in pass through routes."," ",(0,s.jsx)(eM,{href:"https://docs.litellm.ai/docs/pass_through/vertex_ai",target:"_blank",children:"Learn more"})]}),children:(0,s.jsx)(er.Z,{onChange:e=>{let l=i.getFieldValue("litellm_extra_params");try{let t=l?JSON.parse(l):{};e?t.use_in_pass_through=!0:delete t.use_in_pass_through,Object.keys(t).length>0?i.setFieldValue("litellm_extra_params",JSON.stringify(t,null,2)):i.setFieldValue("litellm_extra_params","")}catch(l){e?i.setFieldValue("litellm_extra_params",JSON.stringify({use_in_pass_through:!0},null,2)):i.setFieldValue("litellm_extra_params","")}},className:"bg-gray-600"})}),(0,s.jsx)(ed,{form:i,showCacheControl:u,onCacheControlChange:e=>{if(h(e),!e){let e=i.getFieldValue("litellm_extra_params");try{let l=e?JSON.parse(e):{};delete l.cache_control_injection_points,Object.keys(l).length>0?i.setFieldValue("litellm_extra_params",JSON.stringify(l,null,2)):i.setFieldValue("litellm_extra_params","")}catch(e){i.setFieldValue("litellm_extra_params","")}}}}),(0,s.jsx)(f.Z.Item,{label:"LiteLLM Params",name:"litellm_extra_params",tooltip:"Optional litellm params used for making a litellm.completion() call.",className:"mb-4 mt-4",rules:[{validator:p}],children:(0,s.jsx)(eP.Z,{rows:4,placeholder:'{ "rpm": 100, "timeout": 0, "stream_timeout": 0 }'})}),(0,s.jsxs)(w.Z,{className:"mb-4",children:[(0,s.jsx)(k.Z,{span:10}),(0,s.jsx)(k.Z,{span:10,children:(0,s.jsxs)(eE.xv,{className:"text-gray-600 text-sm",children:["Pass JSON of litellm supported params"," ",(0,s.jsx)(eM,{href:"https://docs.litellm.ai/docs/completion/input",target:"_blank",children:"litellm.completion() call"})]})})]}),(0,s.jsx)(f.Z.Item,{label:"Model Info",name:"model_info_params",tooltip:"Optional model info params. Returned when calling `/model/info` endpoint.",className:"mb-0",rules:[{validator:p}],children:(0,s.jsx)(eP.Z,{rows:4,placeholder:'{ "mode": "chat" }'})})]})})]})})},eL=t(29),eT=t.n(eL),eR=t(23496),eO=t(35291),eD=t(23639);let{Text:eV}=g.default;var eq=e=>{let{formValues:l,accessToken:t,testMode:r,modelName:o="this model",onClose:i,onTestComplete:d}=e,[u,h]=a.useState(null),[x,p]=a.useState(null),[g,f]=a.useState(null),[j,v]=a.useState(!0),[_,b]=a.useState(!1),[N,w]=a.useState(!1),k=async()=>{v(!0),w(!1),h(null),p(null),f(null),b(!1),await new Promise(e=>setTimeout(e,100));try{console.log("Testing connection with form values:",l);let a=await m(l,t,null);if(!a){console.log("No result from prepareModelAddRequest"),h("Failed to prepare model data. Please check your form inputs."),b(!1),v(!1);return}console.log("Result from prepareModelAddRequest:",a);let{litellmParamsObj:r,modelInfoObj:o,modelName:i}=a[0],d=await (0,n.testConnectionRequest)(t,r,o,null==o?void 0:o.mode);if("success"===d.status)c.Z.success("Connection test successful!"),h(null),b(!0);else{var e,s;let l=(null===(e=d.result)||void 0===e?void 0:e.error)||d.message||"Unknown error";h(l),p(r),f(null===(s=d.result)||void 0===s?void 0:s.raw_request_typed_dict),b(!1)}}catch(e){console.error("Test connection error:",e),h(e instanceof Error?e.message:String(e)),b(!1)}finally{v(!1),d&&d()}};a.useEffect(()=>{let e=setTimeout(()=>{k()},200);return()=>clearTimeout(e)},[]);let C=e=>e?e.split("stack trace:")[0].trim().replace(/^litellm\.(.*?)Error: /,""):"Unknown error",Z="string"==typeof u?C(u):(null==u?void 0:u.message)?C(u.message):"Unknown error",S=g?((e,l,t)=>{let s=JSON.stringify(l,null,2).split("\n").map(e=>" ".concat(e)).join("\n"),a=Object.entries(t).map(e=>{let[l,t]=e;return"-H '".concat(l,": ").concat(t,"'")}).join(" \\\n ");return"curl -X POST \\\n ".concat(e," \\\n ").concat(a?"".concat(a," \\\n "):"","-H 'Content-Type: application/json' \\\n -d '{\n").concat(s,"\n }'")})(g.raw_request_api_base,g.raw_request_body,g.raw_request_headers||{}):"";return(0,s.jsxs)("div",{style:{padding:"24px",borderRadius:"8px",backgroundColor:"#fff"},children:[j?(0,s.jsxs)("div",{style:{textAlign:"center",padding:"32px 20px"},className:"jsx-dc9a0e2d897fe63b",children:[(0,s.jsx)("div",{style:{marginBottom:"16px"},className:"jsx-dc9a0e2d897fe63b loading-spinner",children:(0,s.jsx)("div",{style:{border:"3px solid #f3f3f3",borderTop:"3px solid #1890ff",borderRadius:"50%",width:"30px",height:"30px",animation:"spin 1s linear infinite",margin:"0 auto"},className:"jsx-dc9a0e2d897fe63b"})}),(0,s.jsxs)(eV,{style:{fontSize:"16px"},children:["Testing connection to ",o,"..."]}),(0,s.jsx)(eT(),{id:"dc9a0e2d897fe63b",children:"@-webkit-keyframes spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@-moz-keyframes spin{0%{-moz-transform:rotate(0deg);transform:rotate(0deg)}100%{-moz-transform:rotate(360deg);transform:rotate(360deg)}}@-o-keyframes spin{0%{-o-transform:rotate(0deg);transform:rotate(0deg)}100%{-o-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes spin{0%{-webkit-transform:rotate(0deg);-moz-transform:rotate(0deg);-o-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg);-moz-transform:rotate(360deg);-o-transform:rotate(360deg);transform:rotate(360deg)}}"})]}):_?(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"32px 20px"},children:[(0,s.jsx)("div",{style:{color:"#52c41a",fontSize:"24px",display:"flex",alignItems:"center"},children:(0,s.jsx)("svg",{viewBox:"64 64 896 896",focusable:"false","data-icon":"check-circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",children:(0,s.jsx)("path",{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm193.5 301.7l-210.6 292a31.8 31.8 0 01-51.7 0L318.5 484.9c-3.8-5.3 0-12.7 6.5-12.7h46.9c10.2 0 19.9 4.9 25.9 13.3l71.2 98.8 157.2-218c6-8.3 15.6-13.3 25.9-13.3H699c6.5 0 10.3 7.4 6.5 12.7z"})})}),(0,s.jsxs)(eV,{type:"success",style:{fontSize:"18px",fontWeight:500,marginLeft:"10px"},children:["Connection to ",o," successful!"]})]}):(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",marginBottom:"20px"},children:[(0,s.jsx)(eO.Z,{style:{color:"#ff4d4f",fontSize:"24px",marginRight:"12px"}}),(0,s.jsxs)(eV,{type:"danger",style:{fontSize:"18px",fontWeight:500},children:["Connection to ",o," failed"]})]}),(0,s.jsxs)("div",{style:{backgroundColor:"#fff2f0",border:"1px solid #ffccc7",borderRadius:"8px",padding:"16px",marginBottom:"20px",boxShadow:"0 1px 2px rgba(0, 0, 0, 0.03)"},children:[(0,s.jsxs)(eV,{strong:!0,style:{display:"block",marginBottom:"8px"},children:["Error:"," "]}),(0,s.jsx)(eV,{type:"danger",style:{fontSize:"14px",lineHeight:"1.5"},children:Z}),u&&(0,s.jsx)("div",{style:{marginTop:"12px"},children:(0,s.jsx)(y.ZP,{type:"link",onClick:()=>w(!N),style:{paddingLeft:0,height:"auto"},children:N?"Hide Details":"Show Details"})})]}),N&&(0,s.jsxs)("div",{style:{marginBottom:"20px"},children:[(0,s.jsx)(eV,{strong:!0,style:{display:"block",marginBottom:"8px",fontSize:"15px"},children:"Troubleshooting Details"}),(0,s.jsx)("pre",{style:{backgroundColor:"#f5f5f5",padding:"16px",borderRadius:"8px",fontSize:"13px",maxHeight:"200px",overflow:"auto",border:"1px solid #e8e8e8",lineHeight:"1.5"},children:"string"==typeof u?u:JSON.stringify(u,null,2)})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(eV,{strong:!0,style:{display:"block",marginBottom:"8px",fontSize:"15px"},children:"API Request"}),(0,s.jsx)("pre",{style:{backgroundColor:"#f5f5f5",padding:"16px",borderRadius:"8px",fontSize:"13px",maxHeight:"250px",overflow:"auto",border:"1px solid #e8e8e8",lineHeight:"1.5"},children:S||"No request data available"}),(0,s.jsx)(y.ZP,{style:{marginTop:"8px"},icon:(0,s.jsx)(eD.Z,{}),onClick:()=>{navigator.clipboard.writeText(S||""),c.Z.success("Copied to clipboard")},children:"Copy to Clipboard"})]})]})}),(0,s.jsx)(eR.Z,{style:{margin:"24px 0 16px"}}),(0,s.jsx)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:(0,s.jsx)(y.ZP,{type:"link",href:"https://docs.litellm.ai/docs/providers",target:"_blank",icon:(0,s.jsx)(el.Z,{}),children:"View Documentation"})})]})};let ez=[{value:"chat",label:"Chat - /chat/completions"},{value:"completion",label:"Completion - /completions"},{value:"embedding",label:"Embedding - /embeddings"},{value:"audio_speech",label:"Audio Speech - /audio/speech"},{value:"audio_transcription",label:"Audio Transcription - /audio/transcriptions"},{value:"image_generation",label:"Image Generation - /images/generations"},{value:"rerank",label:"Rerank - /rerank"},{value:"realtime",label:"Realtime - /realtime"},{value:"batch",label:"Batch - /batch"},{value:"ocr",label:"OCR - /ocr"}];var eB=t(92858),eK=t(84376),eU=t(20347);let eG=async(e,l,t,s)=>{try{console.log("=== AUTO ROUTER SUBMIT HANDLER CALLED ==="),console.log("handling auto router submit for formValues:",e),console.log("Access token:",l?"Present":"Missing"),console.log("Form:",t?"Present":"Missing"),console.log("Callback:",s?"Present":"Missing");let a={model_name:e.auto_router_name,litellm_params:{model:"auto_router/".concat(e.auto_router_name),auto_router_config:JSON.stringify(e.auto_router_config),auto_router_default_model:e.auto_router_default_model},model_info:{}};e.auto_router_embedding_model&&"custom"!==e.auto_router_embedding_model?a.litellm_params.auto_router_embedding_model=e.auto_router_embedding_model:e.custom_embedding_model&&(a.litellm_params.auto_router_embedding_model=e.custom_embedding_model),e.team_id&&(a.model_info.team_id=e.team_id),e.model_access_group&&e.model_access_group.length>0&&(a.model_info.access_groups=e.model_access_group),console.log("Auto router configuration to be created:",a),console.log("Auto router config (stringified):",a.litellm_params.auto_router_config),console.log("Calling modelCreateCall with:",{accessToken:l?"Present":"Missing",config:a});let r=await (0,n.modelCreateCall)(l,a);console.log("response for auto router create call:",r),t.resetFields()}catch(e){console.error("Failed to add auto router:",e),c.Z.fromBackend("Failed to add auto router: "+e)}},{Title:eH,Link:eJ}=g.default;var eW=e=>{let{form:l,handleOk:t,accessToken:r,userRole:o}=e,[i,d]=(0,a.useState)(!1),[m,u]=(0,a.useState)(!1),[h,x]=(0,a.useState)(""),[p,N]=(0,a.useState)([]),[w,k]=(0,a.useState)([]),[C,Z]=(0,a.useState)(!1),[S,A]=(0,a.useState)(!1),[I,E]=(0,a.useState)(null);(0,a.useEffect)(()=>{(async()=>{N((await (0,n.modelAvailableCall)(r,"","",!1,null,!0,!0)).data.map(e=>e.id))})()},[r]),(0,a.useEffect)(()=>{(async()=>{try{let e=await (0,eh.p)(r);console.log("Fetched models for auto router:",e),k(e)}catch(e){console.error("Error fetching model info for auto router:",e)}})()},[r]);let P=eU.ZL.includes(o),M=async()=>{u(!0),x("test-".concat(Date.now())),d(!0)},F=()=>{console.log("Auto router submit triggered!"),console.log("Router config:",I);let e=l.getFieldsValue();if(console.log("Form values:",e),!e.auto_router_name){c.Z.fromBackend("Please enter an Auto Router Name");return}if(!e.auto_router_default_model){c.Z.fromBackend("Please select a Default Model");return}if(l.setFieldsValue({custom_llm_provider:"auto_router",model:e.auto_router_name,api_key:"not_required_for_auto_router"}),!I||!I.routes||0===I.routes.length){c.Z.fromBackend("Please configure at least one route for the auto router");return}if(I.routes.filter(e=>!e.name||!e.description||0===e.utterances.length).length>0){c.Z.fromBackend("Please ensure all routes have a target model, description, and at least one utterance");return}l.validateFields().then(e=>{console.log("Form validation passed, submitting with values:",e);let s={...e,auto_router_config:I};console.log("Final submit values:",s),eG(s,r,l,t)}).catch(e=>{console.error("Validation failed:",e);let l=e.errorFields||[];if(l.length>0){let e=l.map(e=>{let l=e.name[0];return({auto_router_name:"Auto Router Name",auto_router_default_model:"Default Model",auto_router_embedding_model:"Embedding Model"})[l]||l});c.Z.fromBackend("Please fill in the following required fields: ".concat(e.join(", ")))}else c.Z.fromBackend("Please fill in all required fields")})};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(eH,{level:2,children:"Add Auto Router"}),(0,s.jsx)(b.x,{className:"text-gray-600 mb-6",children:"Create an auto router with intelligent routing logic that automatically selects the best model based on user input patterns and semantic matching."}),(0,s.jsx)(ep.Z,{children:(0,s.jsxs)(f.Z,{form:l,onFinish:F,labelCol:{span:10},wrapperCol:{span:16},labelAlign:"left",children:[(0,s.jsx)(f.Z.Item,{rules:[{required:!0,message:"Auto router name is required"}],label:"Auto Router Name",name:"auto_router_name",tooltip:"Unique name for this auto router configuration",labelCol:{span:10},labelAlign:"left",children:(0,s.jsx)(b.o,{placeholder:"e.g., auto_router_1, smart_routing"})}),(0,s.jsx)("div",{className:"w-full mb-4",children:(0,s.jsx)(eb,{modelInfo:w,value:I,onChange:e=>{E(e),l.setFieldValue("auto_router_config",e)}})}),(0,s.jsx)(f.Z.Item,{rules:[{required:!0,message:"Default model is required"}],label:"Default Model",name:"auto_router_default_model",tooltip:"Fallback model to use when auto routing logic cannot determine the best model",labelCol:{span:10},labelAlign:"left",children:(0,s.jsx)(v.default,{placeholder:"Select a default model",onChange:e=>{Z("custom"===e)},options:[...Array.from(new Set(w.map(e=>e.model_group))).map(e=>({value:e,label:e})),{value:"custom",label:"Enter custom model name"}],style:{width:"100%"},showSearch:!0})}),(0,s.jsx)(f.Z.Item,{label:"Embedding Model",name:"auto_router_embedding_model",tooltip:"Optional: Embedding model to use for semantic routing decisions",labelCol:{span:10},labelAlign:"left",children:(0,s.jsx)(v.default,{value:l.getFieldValue("auto_router_embedding_model"),placeholder:"Select an embedding model (optional)",onChange:e=>{A("custom"===e),l.setFieldValue("auto_router_embedding_model",e)},options:[...Array.from(new Set(w.map(e=>e.model_group))).map(e=>({value:e,label:e})),{value:"custom",label:"Enter custom model name"}],style:{width:"100%"},showSearch:!0,allowClear:!0})}),(0,s.jsxs)("div",{className:"flex items-center my-4",children:[(0,s.jsx)("div",{className:"flex-grow border-t border-gray-200"}),(0,s.jsx)("span",{className:"px-4 text-gray-500 text-sm",children:"Additional Settings"}),(0,s.jsx)("div",{className:"flex-grow border-t border-gray-200"})]}),P&&(0,s.jsx)(f.Z.Item,{label:"Model Access Group",name:"model_access_group",className:"mb-4",tooltip:"Use model access groups to control who can access this auto router",children:(0,s.jsx)(v.default,{mode:"tags",showSearch:!0,placeholder:"Select existing groups or type to create new ones",optionFilterProp:"children",tokenSeparators:[","],options:p.map(e=>({value:e,label:e})),maxTagCount:"responsive",allowClear:!0})}),(0,s.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,s.jsx)(_.Z,{title:"Get help on our github",children:(0,s.jsx)(g.default.Link,{href:"https://github.com/BerriAI/litellm/issues",children:"Need Help?"})}),(0,s.jsxs)("div",{className:"space-x-2",children:[(0,s.jsx)(y.ZP,{onClick:M,loading:m,children:"Test Connect"}),(0,s.jsx)(y.ZP,{onClick:()=>{console.log("Add Auto Router button clicked!"),console.log("Current router config:",I),console.log("Current form values:",l.getFieldsValue()),F()},children:"Add Auto Router"})]})]})]})}),(0,s.jsx)(j.Z,{title:"Connection Test Results",open:i,onCancel:()=>{d(!1),u(!1)},footer:[(0,s.jsx)(y.ZP,{onClick:()=>{d(!1),u(!1)},children:"Close"},"close")],width:700,children:i&&(0,s.jsx)(eq,{formValues:l.getFieldsValue(),accessToken:r,testMode:"chat",modelName:l.getFieldValue("auto_router_name"),onClose:()=>{d(!1),u(!1)},onTestComplete:()=>u(!1)},h)})]})};let{Title:eY,Link:e$}=g.default;var eQ=e=>{let{form:l,handleOk:t,selectedProvider:r,setSelectedProvider:o,providerModels:c,setProviderModelsFn:m,getPlaceholder:u,uploadProps:h,showAdvancedSettings:x,setShowAdvancedSettings:p,teams:b,credentials:N,accessToken:C,userRole:Z,premiumUser:S}=e,[I]=f.Z.useForm(),[E,P]=(0,a.useState)("chat"),[M,F]=(0,a.useState)(!1),[L,T]=(0,a.useState)(!1),[R,O]=(0,a.useState)([]),[D,V]=(0,a.useState)("");(0,a.useEffect)(()=>{(async()=>{try{let e=(await (0,n.getGuardrailsList)(C)).guardrails.map(e=>e.guardrail_name);O(e)}catch(e){console.error("Failed to fetch guardrails:",e)}})()},[C]);let q=async()=>{T(!0),V("test-".concat(Date.now())),F(!0)},[z,B]=(0,a.useState)(!1),[K,U]=(0,a.useState)([]);(0,a.useEffect)(()=>{(async()=>{U((await (0,n.modelAvailableCall)(C,"","",!1,null,!0,!0)).data.map(e=>e.id))})()},[C]);let G=eU.ZL.includes(Z);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(ek.v0,{className:"w-full",children:[(0,s.jsxs)(ek.td,{className:"mb-4",children:[(0,s.jsx)(ek.OK,{children:"Add Model"}),(0,s.jsx)(ek.OK,{children:"Add Auto Router"})]}),(0,s.jsxs)(ek.nP,{children:[(0,s.jsxs)(ek.x4,{children:[(0,s.jsx)(eY,{level:2,children:"Add Model"}),(0,s.jsx)(ep.Z,{children:(0,s.jsx)(f.Z,{form:l,onFinish:e=>{console.log("\uD83D\uDD25 Form onFinish triggered with values:",e),t()},onFinishFailed:e=>{console.log("\uD83D\uDCA5 Form onFinishFailed triggered:",e)},labelCol:{span:10},wrapperCol:{span:16},labelAlign:"left",children:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(f.Z.Item,{rules:[{required:!0,message:"Required"}],label:"Provider:",name:"custom_llm_provider",tooltip:"E.g. OpenAI, Azure OpenAI, Anthropic, Bedrock, etc.",labelCol:{span:10},labelAlign:"left",children:(0,s.jsx)(v.default,{showSearch:!0,value:r,onChange:e=>{o(e),m(e),l.setFieldsValue({model:[],model_name:void 0})},children:Object.entries(d.Cl).map(e=>{let[l,t]=e;return(0,s.jsx)(v.default.Option,{value:l,children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("img",{src:d.cd[t],alt:"".concat(l," logo"),className:"w-5 h-5",onError:e=>{let l=e.target,s=l.parentElement;if(s){let e=document.createElement("div");e.className="w-5 h-5 rounded-full bg-gray-200 flex items-center justify-center text-xs",e.textContent=t.charAt(0),s.replaceChild(e,l)}}}),(0,s.jsx)("span",{children:t})]})},l)})})}),(0,s.jsx)(eC,{selectedProvider:r,providerModels:c,getPlaceholder:u}),(0,s.jsx)(eI,{}),(0,s.jsx)(f.Z.Item,{label:"Mode",name:"mode",className:"mb-1",children:(0,s.jsx)(v.default,{style:{width:"100%"},value:E,onChange:e=>P(e),options:ez})}),(0,s.jsxs)(w.Z,{children:[(0,s.jsx)(k.Z,{span:10}),(0,s.jsx)(k.Z,{span:10,children:(0,s.jsxs)(i.Z,{className:"mb-5 mt-1",children:[(0,s.jsx)("strong",{children:"Optional"})," - LiteLLM endpoint to use when health checking this model"," ",(0,s.jsx)(e$,{href:"https://docs.litellm.ai/docs/proxy/health#health",target:"_blank",children:"Learn more"})]})})]}),(0,s.jsx)("div",{className:"mb-4",children:(0,s.jsx)(g.default.Text,{className:"text-sm text-gray-500 mb-2",children:"Either select existing credentials OR enter new provider credentials below"})}),(0,s.jsx)(f.Z.Item,{label:"Existing Credentials",name:"litellm_credential_name",children:(0,s.jsx)(v.default,{showSearch:!0,placeholder:"Select or search for existing credentials",optionFilterProp:"children",filterOption:(e,l)=>{var t;return(null!==(t=null==l?void 0:l.label)&&void 0!==t?t:"").toLowerCase().includes(e.toLowerCase())},options:[{value:null,label:"None"},...N.map(e=>({value:e.credential_name,label:e.credential_name}))],allowClear:!0})}),(0,s.jsxs)("div",{className:"flex items-center my-4",children:[(0,s.jsx)("div",{className:"flex-grow border-t border-gray-200"}),(0,s.jsx)("span",{className:"px-4 text-gray-500 text-sm",children:"OR"}),(0,s.jsx)("div",{className:"flex-grow border-t border-gray-200"})]}),(0,s.jsx)(f.Z.Item,{noStyle:!0,shouldUpdate:(e,l)=>e.litellm_credential_name!==l.litellm_credential_name||e.provider!==l.provider,children:e=>{let{getFieldValue:l}=e,t=l("litellm_credential_name");return(console.log("\uD83D\uDD11 Credential Name Changed:",t),t)?(0,s.jsx)("div",{className:"text-gray-500 text-sm text-center",children:"Using existing credentials - no additional provider fields needed"}):(0,s.jsx)(A,{selectedProvider:r,uploadProps:h})}}),(0,s.jsxs)("div",{className:"flex items-center my-4",children:[(0,s.jsx)("div",{className:"flex-grow border-t border-gray-200"}),(0,s.jsx)("span",{className:"px-4 text-gray-500 text-sm",children:"Additional Model Info Settings"}),(0,s.jsx)("div",{className:"flex-grow border-t border-gray-200"})]}),(0,s.jsx)(f.Z.Item,{label:"Team-BYOK Model",tooltip:"Only use this model + credential combination for this team. Useful when teams want to onboard their own OpenAI keys.",className:"mb-4",children:(0,s.jsx)(_.Z,{title:S?"":"This is an enterprise-only feature. Upgrade to premium to restrict model+credential combinations to a specific team.",placement:"top",children:(0,s.jsx)(eB.Z,{checked:z,onChange:e=>{B(e),e||l.setFieldValue("team_id",void 0)},disabled:!S})})}),z&&(0,s.jsx)(f.Z.Item,{label:"Select Team",name:"team_id",className:"mb-4",tooltip:"Only keys for this team will be able to call this model.",rules:[{required:z&&!G,message:"Please select a team."}],children:(0,s.jsx)(eK.Z,{teams:b,disabled:!S})}),G&&(0,s.jsx)(s.Fragment,{children:(0,s.jsx)(f.Z.Item,{label:"Model Access Group",name:"model_access_group",className:"mb-4",tooltip:"Use model access groups to give users access to select models, and add new ones to the group over time.",children:(0,s.jsx)(v.default,{mode:"tags",showSearch:!0,placeholder:"Select existing groups or type to create new ones",optionFilterProp:"children",tokenSeparators:[","],options:K.map(e=>({value:e,label:e})),maxTagCount:"responsive",allowClear:!0})})}),(0,s.jsx)(eF,{showAdvancedSettings:x,setShowAdvancedSettings:p,teams:b,guardrailsList:R}),(0,s.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,s.jsx)(_.Z,{title:"Get help on our github",children:(0,s.jsx)(g.default.Link,{href:"https://github.com/BerriAI/litellm/issues",children:"Need Help?"})}),(0,s.jsxs)("div",{className:"space-x-2",children:[(0,s.jsx)(y.ZP,{onClick:q,loading:L,children:"Test Connect"}),(0,s.jsx)(y.ZP,{htmlType:"submit",children:"Add Model"})]})]})]})})})]}),(0,s.jsx)(ek.x4,{children:(0,s.jsx)(eW,{form:I,handleOk:()=>{I.validateFields().then(e=>{eG(e,C,I,t)}).catch(e=>{console.error("Validation failed:",e)})},accessToken:C,userRole:Z})})]})]}),(0,s.jsx)(j.Z,{title:"Connection Test Results",open:M,onCancel:()=>{F(!1),T(!1)},footer:[(0,s.jsx)(y.ZP,{onClick:()=>{F(!1),T(!1)},children:"Close"},"close")],width:700,children:M&&(0,s.jsx)(eq,{formValues:l.getFieldsValue(),accessToken:C,testMode:E,modelName:l.getFieldValue("model_name")||l.getFieldValue("model"),onClose:()=>{F(!1),T(!1)},onTestComplete:()=>T(!1)},D)})]})},eX=t(41649),e0=t(8048),e1=t(61994),e2=t(15731),e4=t(91126);let e5=(e,l,t,a,r,o,i,n,d,c,m)=>[{header:()=>(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(e1.Z,{checked:t,indeterminate:l.length>0&&!t,onChange:e=>r(e.target.checked),onClick:e=>e.stopPropagation()}),(0,s.jsx)("span",{children:"Model ID"})]}),accessorKey:"model_info.id",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:t}=e,r=t.original,o=r.model_name,i=l.includes(o);return(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(e1.Z,{checked:i,onChange:e=>a(o,e.target.checked),onClick:e=>e.stopPropagation()}),(0,s.jsx)(_.Z,{title:r.model_info.id,children:(0,s.jsx)("div",{className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left w-full truncate whitespace-nowrap cursor-pointer max-w-[15ch]",onClick:()=>m&&m(r.model_info.id),children:r.model_info.id})})]})}},{header:"Model Name",accessorKey:"model_name",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:l}=e,t=l.original,a=n(t)||t.model_name;return(0,s.jsx)("div",{className:"font-medium text-sm",children:(0,s.jsx)(_.Z,{title:a,children:(0,s.jsx)("div",{className:"truncate max-w-[200px]",children:a})})})}},{header:"Health Status",accessorKey:"health_status",enableSorting:!0,sortingFn:(e,l,t)=>{var s,a;let r=e.getValue("health_status")||"unknown",o=l.getValue("health_status")||"unknown",i={healthy:0,checking:1,unknown:2,unhealthy:3};return(null!==(s=i[r])&&void 0!==s?s:4)-(null!==(a=i[o])&&void 0!==a?a:4)},cell:l=>{var t;let{row:a}=l,r=a.original,o={status:r.health_status,loading:r.health_loading,error:r.health_error};if(o.loading)return(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsxs)("div",{className:"flex space-x-1",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-indigo-500 rounded-full animate-pulse"}),(0,s.jsx)("div",{className:"w-2 h-2 bg-indigo-500 rounded-full animate-pulse",style:{animationDelay:"0.2s"}}),(0,s.jsx)("div",{className:"w-2 h-2 bg-indigo-500 rounded-full animate-pulse",style:{animationDelay:"0.4s"}})]}),(0,s.jsx)(ev.x,{className:"text-gray-600 text-sm",children:"Checking..."})]});let n=r.model_name,d="healthy"===o.status&&(null===(t=e[n])||void 0===t?void 0:t.successResponse);return(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[i(o.status),d&&c&&(0,s.jsx)(_.Z,{title:"View response details",placement:"top",children:(0,s.jsx)("button",{onClick:()=>{var l;return c(n,null===(l=e[n])||void 0===l?void 0:l.successResponse)},className:"p-1 text-green-600 hover:text-green-800 hover:bg-green-50 rounded cursor-pointer transition-colors",children:(0,s.jsx)(e2.Z,{className:"h-4 w-4"})})})]})}},{header:"Error Details",accessorKey:"health_error",enableSorting:!1,cell:l=>{let{row:t}=l,a=t.original.model_name,r=e[a];if(!(null==r?void 0:r.error))return(0,s.jsx)(ev.x,{className:"text-gray-400 text-sm",children:"No errors"});let o=r.error,i=r.fullError||r.error;return(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("div",{className:"max-w-[200px]",children:(0,s.jsx)(_.Z,{title:o,placement:"top",children:(0,s.jsx)(ev.x,{className:"text-red-600 text-sm truncate",children:o})})}),d&&i!==o&&(0,s.jsx)(_.Z,{title:"View full error details",placement:"top",children:(0,s.jsx)("button",{onClick:()=>d(a,o,i),className:"p-1 text-red-600 hover:text-red-800 hover:bg-red-50 rounded cursor-pointer transition-colors",children:(0,s.jsx)(e2.Z,{className:"h-4 w-4"})})})]})}},{header:"Last Check",accessorKey:"last_check",enableSorting:!0,sortingFn:(e,l,t)=>{let s=e.getValue("last_check")||"Never checked",a=l.getValue("last_check")||"Never checked";if("Never checked"===s&&"Never checked"===a)return 0;if("Never checked"===s)return 1;if("Never checked"===a)return -1;if("Check in progress..."===s&&"Check in progress..."===a)return 0;if("Check in progress..."===s)return -1;if("Check in progress..."===a)return 1;let r=new Date(s),o=new Date(a);return isNaN(r.getTime())&&isNaN(o.getTime())?0:isNaN(r.getTime())?1:isNaN(o.getTime())?-1:o.getTime()-r.getTime()},cell:e=>{let{row:l}=e,t=l.original;return(0,s.jsx)(ev.x,{className:"text-gray-600 text-sm",children:t.health_loading?"Check in progress...":t.last_check})}},{header:"Last Success",accessorKey:"last_success",enableSorting:!0,sortingFn:(e,l,t)=>{let s=e.getValue("last_success")||"Never succeeded",a=l.getValue("last_success")||"Never succeeded";if("Never succeeded"===s&&"Never succeeded"===a)return 0;if("Never succeeded"===s)return 1;if("Never succeeded"===a)return -1;if("None"===s&&"None"===a)return 0;if("None"===s)return 1;if("None"===a)return -1;let r=new Date(s),o=new Date(a);return isNaN(r.getTime())&&isNaN(o.getTime())?0:isNaN(r.getTime())?1:isNaN(o.getTime())?-1:o.getTime()-r.getTime()},cell:l=>{let{row:t}=l,a=e[t.original.model_name],r=(null==a?void 0:a.lastSuccess)||"None";return(0,s.jsx)(ev.x,{className:"text-gray-600 text-sm",children:r})}},{header:"Actions",id:"actions",cell:e=>{let{row:l}=e,t=l.original,a=t.model_name,r=t.health_status&&"none"!==t.health_status,i=t.health_loading?"Checking...":r?"Re-run Health Check":"Run Health Check";return(0,s.jsx)(_.Z,{title:i,placement:"top",children:(0,s.jsx)("button",{className:"p-2 rounded-md transition-colors ".concat(t.health_loading?"text-gray-400 cursor-not-allowed bg-gray-100":"text-indigo-600 hover:text-indigo-700 hover:bg-indigo-50"),onClick:()=>{t.health_loading||o(a)},disabled:t.health_loading,children:t.health_loading?(0,s.jsxs)("div",{className:"flex space-x-1",children:[(0,s.jsx)("div",{className:"w-1 h-1 bg-gray-400 rounded-full animate-pulse"}),(0,s.jsx)("div",{className:"w-1 h-1 bg-gray-400 rounded-full animate-pulse",style:{animationDelay:"0.2s"}}),(0,s.jsx)("div",{className:"w-1 h-1 bg-gray-400 rounded-full animate-pulse",style:{animationDelay:"0.4s"}})]}):r?(0,s.jsx)(V.Z,{className:"h-4 w-4"}):(0,s.jsx)(e4.Z,{className:"h-4 w-4"})})})},enableSorting:!1}],e6=[{pattern:/Missing .* API Key/i,replacement:"Missing API Key"},{pattern:/Connection timeout/i,replacement:"Connection timeout"},{pattern:/Network.*not.*ok/i,replacement:"Network connection failed"},{pattern:/403.*Forbidden/i,replacement:"Access forbidden - check API key permissions"},{pattern:/401.*Unauthorized/i,replacement:"Unauthorized - invalid API key"},{pattern:/429.*rate limit/i,replacement:"Rate limit exceeded"},{pattern:/500.*Internal Server Error/i,replacement:"Provider internal server error"},{pattern:/litellm\.AuthenticationError/i,replacement:"Authentication failed"},{pattern:/litellm\.RateLimitError/i,replacement:"Rate limit exceeded"},{pattern:/litellm\.APIError/i,replacement:"API error"}];var e3=e=>{let{accessToken:l,modelData:t,all_models_on_proxy:r,getDisplayModelName:o,setSelectedModelId:d}=e,[c,m]=(0,a.useState)({}),[u,h]=(0,a.useState)([]),[x,p]=(0,a.useState)(!1),[g,f]=(0,a.useState)(!1),[v,_]=(0,a.useState)(null),[b,N]=(0,a.useState)(!1),[w,k]=(0,a.useState)(null),C=(0,a.useRef)(null);(0,a.useEffect)(()=>{l&&(null==t?void 0:t.data)&&(async()=>{let e={};t.data.forEach(l=>{e[l.model_name]={status:"none",lastCheck:"None",lastSuccess:"None",loading:!1,error:void 0,fullError:void 0,successResponse:void 0}});try{let s=await (0,n.latestHealthChecksCall)(l);s&&s.latest_health_checks&&"object"==typeof s.latest_health_checks&&Object.entries(s.latest_health_checks).forEach(l=>{let[s,a]=l;if(!a)return;let r=null,o=t.data.find(e=>e.model_name===s);if(o)r=o.model_name;else{let e=t.data.find(e=>e.model_info&&e.model_info.id===s);if(e)r=e.model_name;else if(a.model_name){let e=t.data.find(e=>e.model_name===a.model_name);e&&(r=e.model_name)}}if(r){let l=a.error_message||void 0;e[r]={status:a.status||"unknown",lastCheck:a.checked_at?new Date(a.checked_at).toLocaleString():"None",lastSuccess:"healthy"===a.status&&a.checked_at?new Date(a.checked_at).toLocaleString():"None",loading:!1,error:l?Z(l):void 0,fullError:l,successResponse:"healthy"===a.status?a:void 0}}})}catch(e){console.warn("Failed to load health check history (using default states):",e)}m(e)})()},[l,t]);let Z=e=>{var l;if(!e)return"Health check failed";let t="string"==typeof e?e:JSON.stringify(e),s=t.match(/(\w+Error):\s*(\d{3})/i);if(s)return"".concat(s[1],": ").concat(s[2]);let a=t.match(/(AuthenticationError|RateLimitError|BadRequestError|InternalServerError|TimeoutError|NotFoundError|ForbiddenError|ServiceUnavailableError|BadGatewayError|ContentPolicyViolationError|\w+Error)/i),r=t.match(/\b(400|401|403|404|408|429|500|502|503|504)\b/);if(a&&r)return"".concat(a[1],": ").concat(r[1]);if(r){let e=r[1];return"".concat({400:"BadRequestError",401:"AuthenticationError",403:"ForbiddenError",404:"NotFoundError",408:"TimeoutError",429:"RateLimitError",500:"InternalServerError",502:"BadGatewayError",503:"ServiceUnavailableError",504:"GatewayTimeoutError"}[e],": ").concat(e)}if(a){let e=a[1],l={AuthenticationError:"401",RateLimitError:"429",BadRequestError:"400",InternalServerError:"500",TimeoutError:"408",NotFoundError:"404",ForbiddenError:"403",ServiceUnavailableError:"503",BadGatewayError:"502",GatewayTimeoutError:"504",ContentPolicyViolationError:"400"}[e];return l?"".concat(e,": ").concat(l):e}for(let{pattern:e,replacement:l}of e6)if(e.test(t))return l;if(/missing.*api.*key|invalid.*key|unauthorized/i.test(t))return"AuthenticationError: 401";if(/rate.*limit|too.*many.*requests/i.test(t))return"RateLimitError: 429";if(/timeout|timed.*out/i.test(t))return"TimeoutError: 408";if(/not.*found/i.test(t))return"NotFoundError: 404";if(/forbidden|access.*denied/i.test(t))return"ForbiddenError: 403";if(/internal.*server.*error/i.test(t))return"InternalServerError: 500";let o=t.replace(/[\n\r]+/g," ").replace(/\s+/g," ").trim(),i=null===(l=o.split(/[.!?]/)[0])||void 0===l?void 0:l.trim();return i&&i.length>0?i.length>100?i.substring(0,97)+"...":i:o.length>100?o.substring(0,97)+"...":o},S=async e=>{if(l){m(l=>({...l,[e]:{...l[e],loading:!0,status:"checking"}}));try{var s,a;let r=await (0,n.individualModelHealthCheckCall)(l,e),o=new Date().toLocaleString();if(r.unhealthy_count>0&&r.unhealthy_endpoints&&r.unhealthy_endpoints.length>0){let l=(null===(s=r.unhealthy_endpoints[0])||void 0===s?void 0:s.error)||"Health check failed",t=Z(l);m(s=>{var a;return{...s,[e]:{status:"unhealthy",lastCheck:o,lastSuccess:(null===(a=s[e])||void 0===a?void 0:a.lastSuccess)||"None",loading:!1,error:t,fullError:l}}})}else m(l=>({...l,[e]:{status:"healthy",lastCheck:o,lastSuccess:o,loading:!1,successResponse:r}}));try{let s=await (0,n.latestHealthChecksCall)(l),r=t.data.find(l=>l.model_name===e);if(r){let l=r.model_info.id,t=null===(a=s.latest_health_checks)||void 0===a?void 0:a[l];if(t){let l=t.error_message||void 0;m(s=>{var a,r,o,i,n,d,c;return{...s,[e]:{status:t.status||(null===(a=s[e])||void 0===a?void 0:a.status)||"unknown",lastCheck:t.checked_at?new Date(t.checked_at).toLocaleString():(null===(r=s[e])||void 0===r?void 0:r.lastCheck)||"None",lastSuccess:"healthy"===t.status?t.checked_at?new Date(t.checked_at).toLocaleString():(null===(o=s[e])||void 0===o?void 0:o.lastSuccess)||"None":(null===(i=s[e])||void 0===i?void 0:i.lastSuccess)||"None",loading:!1,error:l?Z(l):null===(n=s[e])||void 0===n?void 0:n.error,fullError:l||(null===(d=s[e])||void 0===d?void 0:d.fullError),successResponse:"healthy"===t.status?t:null===(c=s[e])||void 0===c?void 0:c.successResponse}}})}}}catch(e){console.debug("Could not fetch updated status from database (non-critical):",e)}}catch(a){let l=new Date().toLocaleString(),t=a instanceof Error?a.message:String(a),s=Z(t);m(a=>{var r;return{...a,[e]:{status:"unhealthy",lastCheck:l,lastSuccess:(null===(r=a[e])||void 0===r?void 0:r.lastSuccess)||"None",loading:!1,error:s,fullError:t}}})}}},A=async()=>{let e=u.length>0?u:r,s=e.reduce((e,l)=>(e[l]={...c[l],loading:!0,status:"checking"},e),{});m(e=>({...e,...s}));let a={},o=e.map(async e=>{if(l)try{let s=await (0,n.individualModelHealthCheckCall)(l,e);a[e]=s;let r=new Date().toLocaleString();if(s.unhealthy_count>0&&s.unhealthy_endpoints&&s.unhealthy_endpoints.length>0){var t;let l=(null===(t=s.unhealthy_endpoints[0])||void 0===t?void 0:t.error)||"Health check failed",a=Z(l);m(t=>{var s;return{...t,[e]:{status:"unhealthy",lastCheck:r,lastSuccess:(null===(s=t[e])||void 0===s?void 0:s.lastSuccess)||"None",loading:!1,error:a,fullError:l}}})}else m(l=>({...l,[e]:{status:"healthy",lastCheck:r,lastSuccess:r,loading:!1,successResponse:s}}))}catch(a){console.error("Health check failed for ".concat(e,":"),a);let l=new Date().toLocaleString(),t=a instanceof Error?a.message:String(a),s=Z(t);m(a=>{var r;return{...a,[e]:{status:"unhealthy",lastCheck:l,lastSuccess:(null===(r=a[e])||void 0===r?void 0:r.lastSuccess)||"None",loading:!1,error:s,fullError:t}}})}});await Promise.allSettled(o);try{if(!l)return;let s=await (0,n.latestHealthChecksCall)(l);s.latest_health_checks&&Object.entries(s.latest_health_checks).forEach(l=>{let[s,a]=l,r=t.data.find(e=>e.model_info.id===s);if(r&&e.includes(r.model_name)&&a){let e=r.model_name,l=a.error_message||void 0;m(t=>{let s=t[e];return{...t,[e]:{status:a.status||(null==s?void 0:s.status)||"unknown",lastCheck:a.checked_at?new Date(a.checked_at).toLocaleString():(null==s?void 0:s.lastCheck)||"None",lastSuccess:"healthy"===a.status&&a.checked_at?new Date(a.checked_at).toLocaleString():(null==s?void 0:s.lastSuccess)||"None",loading:!1,error:l?Z(l):null==s?void 0:s.error,fullError:l||(null==s?void 0:s.fullError),successResponse:"healthy"===a.status?a:null==s?void 0:s.successResponse}}})}})}catch(e){console.warn("Failed to fetch updated health statuses from database (non-critical):",e)}},I=e=>{p(e),e?h(r):h([])},E=()=>{f(!1),_(null)},P=()=>{N(!1),k(null)};return(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"mb-6",children:(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(Y.Z,{children:"Model Health Status"}),(0,s.jsx)(i.Z,{className:"text-gray-600 mt-1",children:"Run health checks on individual models to verify they are working correctly"})]}),(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[u.length>0&&(0,s.jsx)(z.Z,{size:"sm",variant:"light",onClick:()=>I(!1),className:"px-3 py-1 text-sm",children:"Clear Selection"}),(0,s.jsx)(z.Z,{size:"sm",variant:"secondary",onClick:A,disabled:Object.values(c).some(e=>e.loading),className:"px-3 py-1 text-sm",children:u.length>0&&u.length{l?h(l=>[...l,e]):(h(l=>l.filter(l=>l!==e)),p(!1))},I,S,e=>{switch(e){case"healthy":return(0,s.jsx)(eX.Z,{color:"emerald",children:"healthy"});case"unhealthy":return(0,s.jsx)(eX.Z,{color:"red",children:"unhealthy"});case"checking":return(0,s.jsx)(eX.Z,{color:"blue",children:"checking"});case"none":return(0,s.jsx)(eX.Z,{color:"gray",children:"none"});default:return(0,s.jsx)(eX.Z,{color:"gray",children:"unknown"})}},o,(e,l,t)=>{_({modelName:e,cleanedError:l,fullError:t}),f(!0)},(e,l)=>{k({modelName:e,response:l}),N(!0)},d),data:t.data.map(e=>{let l=c[e.model_name]||{status:"none",lastCheck:"None",loading:!1};return{model_name:e.model_name,model_info:e.model_info,provider:e.provider,litellm_model_name:e.litellm_model_name,health_status:l.status,last_check:l.lastCheck,last_success:l.lastSuccess||"None",health_loading:l.loading,health_error:l.error,health_full_error:l.fullError}}),isLoading:!1,table:C})}),(0,s.jsx)(j.Z,{title:v?"Health Check Error - ".concat(v.modelName):"Error Details",open:g,onCancel:E,footer:[(0,s.jsx)(y.ZP,{onClick:E,children:"Close"},"close")],width:800,children:v&&(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(i.Z,{className:"font-medium",children:"Error:"}),(0,s.jsx)("div",{className:"mt-2 p-3 bg-red-50 border border-red-200 rounded-md",children:(0,s.jsx)(i.Z,{className:"text-red-800",children:v.cleanedError})})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(i.Z,{className:"font-medium",children:"Full Error Details:"}),(0,s.jsx)("div",{className:"mt-2 p-3 bg-gray-50 border border-gray-200 rounded-md max-h-96 overflow-y-auto",children:(0,s.jsx)("pre",{className:"text-sm text-gray-800 whitespace-pre-wrap",children:v.fullError})})]})]})}),(0,s.jsx)(j.Z,{title:w?"Health Check Response - ".concat(w.modelName):"Response Details",open:b,onCancel:P,footer:[(0,s.jsx)(y.ZP,{onClick:P,children:"Close"},"close")],width:800,children:w&&(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(i.Z,{className:"font-medium",children:"Status:"}),(0,s.jsx)("div",{className:"mt-2 p-3 bg-green-50 border border-green-200 rounded-md",children:(0,s.jsx)(i.Z,{className:"text-green-800",children:"Health check passed successfully"})})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(i.Z,{className:"font-medium",children:"Response Details:"}),(0,s.jsx)("div",{className:"mt-2 p-3 bg-gray-50 border border-gray-200 rounded-md max-h-96 overflow-y-auto",children:(0,s.jsx)("pre",{className:"text-sm text-gray-800 whitespace-pre-wrap",children:JSON.stringify(w.response,null,2)})})]})]})})]})},e8=t(7166),e7=t(86462),e9=t(47686),le=t(77355),ll=t(93416),lt=t(95704),ls=e=>{let{accessToken:l,initialModelGroupAlias:t={},onAliasUpdate:r}=e,[o,i]=(0,a.useState)([]),[d,m]=(0,a.useState)({aliasName:"",targetModelGroup:""}),[u,h]=(0,a.useState)(null),[x,g]=(0,a.useState)(!0);(0,a.useEffect)(()=>{i(Object.entries(t).map((e,l)=>{var t;let[s,a]=e;return{id:"".concat(l,"-").concat(s),aliasName:s,targetModelGroup:"string"==typeof a?a:null!==(t=null==a?void 0:a.model)&&void 0!==t?t:""}}))},[t]);let f=async e=>{if(!l)return console.error("Access token is missing"),!1;try{let t={};return e.forEach(e=>{t[e.aliasName]=e.targetModelGroup}),console.log("Saving model group alias:",t),await (0,n.setCallbacksCall)(l,{router_settings:{model_group_alias:t}}),r&&r(t),!0}catch(e){return console.error("Failed to save model group alias settings:",e),c.Z.fromBackend("Failed to save model group alias settings"),!1}},j=async()=>{if(!d.aliasName||!d.targetModelGroup){c.Z.fromBackend("Please provide both alias name and target model group");return}if(o.some(e=>e.aliasName===d.aliasName)){c.Z.fromBackend("An alias with this name already exists");return}let e=[...o,{id:"".concat(Date.now(),"-").concat(d.aliasName),aliasName:d.aliasName,targetModelGroup:d.targetModelGroup}];await f(e)&&(i(e),m({aliasName:"",targetModelGroup:""}),c.Z.success("Alias added successfully"))},v=e=>{h({...e})},_=async()=>{if(!u)return;if(!u.aliasName||!u.targetModelGroup){c.Z.fromBackend("Please provide both alias name and target model group");return}if(o.some(e=>e.id!==u.id&&e.aliasName===u.aliasName)){c.Z.fromBackend("An alias with this name already exists");return}let e=o.map(e=>e.id===u.id?u:e);await f(e)&&(i(e),h(null),c.Z.success("Alias updated successfully"))},y=()=>{h(null)},b=async e=>{let l=o.filter(l=>l.id!==e);await f(l)&&(i(l),c.Z.success("Alias deleted successfully"))},N=o.reduce((e,l)=>(e[l.aliasName]=l.targetModelGroup,e),{});return(0,s.jsxs)(lt.Zb,{className:"mb-6",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between cursor-pointer",onClick:()=>g(!x),children:[(0,s.jsxs)("div",{className:"flex flex-col",children:[(0,s.jsx)(lt.Dx,{className:"mb-0",children:"Model Group Alias Settings"}),(0,s.jsx)("p",{className:"text-sm text-gray-500",children:"Create aliases for your model groups to simplify API calls. For example, you can create an alias 'gpt-4o' that points to 'gpt-4o-mini-openai' model group."})]}),(0,s.jsx)("div",{className:"flex items-center",children:x?(0,s.jsx)(e7.Z,{className:"w-5 h-5 text-gray-500"}):(0,s.jsx)(e9.Z,{className:"w-5 h-5 text-gray-500"})})]}),x&&(0,s.jsxs)("div",{className:"mt-4",children:[(0,s.jsxs)("div",{className:"mb-6",children:[(0,s.jsx)(lt.xv,{className:"text-sm font-medium text-gray-700 mb-2",children:"Add New Alias"}),(0,s.jsxs)("div",{className:"grid grid-cols-3 gap-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs text-gray-500 mb-1",children:"Alias Name"}),(0,s.jsx)("input",{type:"text",value:d.aliasName,onChange:e=>m({...d,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,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs text-gray-500 mb-1",children:"Target Model Group"}),(0,s.jsx)("input",{type:"text",value:d.targetModelGroup,onChange:e=>m({...d,targetModelGroup:e.target.value}),placeholder:"e.g., gpt-4o-mini-openai",className:"w-full px-3 py-2 border border-gray-300 rounded-md text-sm"})]}),(0,s.jsx)("div",{className:"flex items-end",children:(0,s.jsxs)("button",{onClick:j,disabled:!d.aliasName||!d.targetModelGroup,className:"flex items-center px-4 py-2 rounded-md text-sm ".concat(d.aliasName&&d.targetModelGroup?"bg-green-600 text-white hover:bg-green-700":"bg-gray-300 text-gray-500 cursor-not-allowed"),children:[(0,s.jsx)(le.Z,{className:"w-4 h-4 mr-1"}),"Add Alias"]})})]})]}),(0,s.jsx)(lt.xv,{className:"text-sm font-medium text-gray-700 mb-2",children:"Manage Existing Aliases"}),(0,s.jsx)("div",{className:"rounded-lg custom-border relative mb-6",children:(0,s.jsx)("div",{className:"overflow-x-auto",children:(0,s.jsxs)(lt.iA,{className:"[&_td]:py-0.5 [&_th]:py-1",children:[(0,s.jsx)(lt.ss,{children:(0,s.jsxs)(lt.SC,{children:[(0,s.jsx)(lt.xs,{className:"py-1 h-8",children:"Alias Name"}),(0,s.jsx)(lt.xs,{className:"py-1 h-8",children:"Target Model Group"}),(0,s.jsx)(lt.xs,{className:"py-1 h-8",children:"Actions"})]})}),(0,s.jsxs)(lt.RM,{children:[o.map(e=>(0,s.jsx)(lt.SC,{className:"h-8",children:u&&u.id===e.id?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(lt.pj,{className:"py-0.5",children:(0,s.jsx)("input",{type:"text",value:u.aliasName,onChange:e=>h({...u,aliasName:e.target.value}),className:"w-full px-2 py-1 border border-gray-300 rounded-md text-sm"})}),(0,s.jsx)(lt.pj,{className:"py-0.5",children:(0,s.jsx)("input",{type:"text",value:u.targetModelGroup,onChange:e=>h({...u,targetModelGroup:e.target.value}),className:"w-full px-2 py-1 border border-gray-300 rounded-md text-sm"})}),(0,s.jsx)(lt.pj,{className:"py-0.5 whitespace-nowrap",children:(0,s.jsxs)("div",{className:"flex space-x-2",children:[(0,s.jsx)("button",{onClick:_,className:"text-xs bg-blue-50 text-blue-600 px-2 py-1 rounded hover:bg-blue-100",children:"Save"}),(0,s.jsx)("button",{onClick:y,className:"text-xs bg-gray-50 text-gray-600 px-2 py-1 rounded hover:bg-gray-100",children:"Cancel"})]})})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(lt.pj,{className:"py-0.5 text-sm text-gray-900",children:e.aliasName}),(0,s.jsx)(lt.pj,{className:"py-0.5 text-sm text-gray-500",children:e.targetModelGroup}),(0,s.jsx)(lt.pj,{className:"py-0.5 whitespace-nowrap",children:(0,s.jsxs)("div",{className:"flex space-x-2",children:[(0,s.jsx)("button",{onClick:()=>v(e),className:"text-xs bg-blue-50 text-blue-600 px-2 py-1 rounded hover:bg-blue-100",children:(0,s.jsx)(ll.Z,{className:"w-3 h-3"})}),(0,s.jsx)("button",{onClick:()=>b(e.id),className:"text-xs bg-red-50 text-red-600 px-2 py-1 rounded hover:bg-red-100",children:(0,s.jsx)(p.Z,{className:"w-3 h-3"})})]})})]})},e.id)),0===o.length&&(0,s.jsx)(lt.SC,{children:(0,s.jsx)(lt.pj,{colSpan:3,className:"py-0.5 text-sm text-gray-500 text-center",children:"No aliases added yet. Add a new alias above."})})]})]})})}),(0,s.jsxs)(lt.Zb,{children:[(0,s.jsx)(lt.Dx,{className:"mb-4",children:"Configuration Example"}),(0,s.jsx)(lt.xv,{className:"text-gray-600 mb-4",children:"Here's how your current aliases would look in the config.yaml:"}),(0,s.jsx)("div",{className:"bg-gray-100 rounded-lg p-4 font-mono text-sm",children:(0,s.jsxs)("div",{className:"text-gray-700",children:["router_settings:",(0,s.jsx)("br",{}),"\xa0\xa0model_group_alias:",0===Object.keys(N).length?(0,s.jsxs)("span",{className:"text-gray-500",children:[(0,s.jsx)("br",{}),"\xa0\xa0\xa0\xa0# No aliases configured yet"]}):Object.entries(N).map(e=>{let[l,t]=e;return(0,s.jsxs)("span",{children:[(0,s.jsx)("br",{}),'\xa0\xa0\xa0\xa0"',l,'": "',t,'"']},l)})]})})]})]})]})},la=t(27281),lr=t(57365),lo=t(47323);let li=(e,l,t,a,r,o,i,n,c,m,u)=>[{header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Model ID"}),accessorKey:"model_info.id",cell:e=>{let{row:l}=e,t=l.original;return(0,s.jsx)(_.Z,{title:t.model_info.id,children:(0,s.jsx)("div",{className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left w-full truncate whitespace-nowrap cursor-pointer max-w-[15ch]",onClick:()=>a(t.model_info.id),children:t.model_info.id})})}},{header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Model Information"}),accessorKey:"model_name",size:250,cell:e=>{let{row:l}=e,t=l.original,a=o(l.original)||"-",r=(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("strong",{children:"Provider:"})," ",t.provider||"-"]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("strong",{children:"Public Model Name:"})," ",a]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("strong",{children:"LiteLLM Model Name:"})," ",t.litellm_model_name||"-"]})]});return(0,s.jsx)(_.Z,{title:r,children:(0,s.jsxs)("div",{className:"flex items-start space-x-2 min-w-0 w-full max-w-[250px]",children:[(0,s.jsx)("div",{className:"flex-shrink-0 mt-0.5",children:t.provider?(0,s.jsx)("img",{src:(0,d.dr)(t.provider).logo,alt:"".concat(t.provider," logo"),className:"w-4 h-4",onError:e=>{let l=e.target,s=l.parentElement;if(s){var a;let e=document.createElement("div");e.className="w-4 h-4 rounded-full bg-gray-200 flex items-center justify-center text-xs",e.textContent=(null===(a=t.provider)||void 0===a?void 0:a.charAt(0))||"-",s.replaceChild(e,l)}}}):(0,s.jsx)("div",{className:"w-4 h-4 rounded-full bg-gray-200 flex items-center justify-center text-xs",children:"-"})}),(0,s.jsxs)("div",{className:"flex flex-col min-w-0 flex-1",children:[(0,s.jsx)("div",{className:"text-xs font-medium text-gray-900 truncate max-w-[210px]",children:a}),(0,s.jsx)("div",{className:"text-xs text-gray-500 truncate mt-0.5 max-w-[210px]",children:t.litellm_model_name||"-"})]})]})})}},{header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Credentials"}),accessorKey:"litellm_credential_name",size:180,cell:e=>{var l;let{row:t}=e,a=null===(l=t.original.litellm_params)||void 0===l?void 0:l.litellm_credential_name;return a?(0,s.jsx)(_.Z,{title:"Credential: ".concat(a),children:(0,s.jsxs)("div",{className:"flex items-center space-x-2 max-w-[180px]",children:[(0,s.jsx)(X.Z,{className:"w-4 h-4 text-blue-500 flex-shrink-0"}),(0,s.jsx)("span",{className:"text-xs truncate",title:a,children:a})]})}):(0,s.jsxs)("div",{className:"flex items-center space-x-2 max-w-[180px]",children:[(0,s.jsx)(X.Z,{className:"w-4 h-4 text-gray-300 flex-shrink-0"}),(0,s.jsx)("span",{className:"text-xs text-gray-400",children:"No credentials"})]})}},{header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Created By"}),accessorKey:"model_info.created_by",sortingFn:"datetime",size:160,cell:e=>{let{row:l}=e,t=l.original,a=t.model_info.created_by,r=t.model_info.created_at?new Date(t.model_info.created_at).toLocaleDateString():null;return(0,s.jsxs)("div",{className:"flex flex-col min-w-0 max-w-[160px]",children:[(0,s.jsx)("div",{className:"text-xs font-medium text-gray-900 truncate",title:a||"Unknown",children:a||"Unknown"}),(0,s.jsx)("div",{className:"text-xs text-gray-500 truncate mt-0.5",title:r||"Unknown date",children:r||"Unknown date"})]})}},{header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Updated At"}),accessorKey:"model_info.updated_at",sortingFn:"datetime",cell:e=>{let{row:l}=e,t=l.original;return(0,s.jsx)("span",{className:"text-xs",children:t.model_info.updated_at?new Date(t.model_info.updated_at).toLocaleDateString():"-"})}},{header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Costs"}),accessorKey:"input_cost",size:120,cell:e=>{let{row:l}=e,t=l.original,a=t.input_cost,r=t.output_cost;return a||r?(0,s.jsx)(_.Z,{title:"Cost per 1M tokens",children:(0,s.jsxs)("div",{className:"flex flex-col min-w-0 max-w-[120px]",children:[a&&(0,s.jsxs)("div",{className:"text-xs font-medium text-gray-900 truncate",children:["In: $",a]}),r&&(0,s.jsxs)("div",{className:"text-xs text-gray-500 truncate mt-0.5",children:["Out: $",r]})]})}):(0,s.jsx)("div",{className:"max-w-[120px]",children:(0,s.jsx)("span",{className:"text-xs text-gray-400",children:"-"})})}},{header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Team ID"}),accessorKey:"model_info.team_id",cell:e=>{let{row:l}=e,t=l.original;return t.model_info.team_id?(0,s.jsx)("div",{className:"overflow-hidden",children:(0,s.jsx)(_.Z,{title:t.model_info.team_id,children:(0,s.jsxs)(z.Z,{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]",onClick:()=>r(t.model_info.team_id),children:[t.model_info.team_id.slice(0,7),"..."]})})}):"-"}},{header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Model Access Group"}),accessorKey:"model_info.model_access_group",enableSorting:!1,cell:e=>{let{row:l}=e,t=l.original,a=t.model_info.access_groups;if(!a||0===a.length)return"-";let r=t.model_info.id,o=m.has(r),i=a.length>1,n=()=>{let e=new Set(m);o?e.delete(r):e.add(r),u(e)};return(0,s.jsxs)("div",{className:"flex items-center gap-1 overflow-hidden",children:[(0,s.jsx)(eX.Z,{size:"xs",color:"blue",className:"text-xs px-1.5 py-0.5 h-5 leading-tight flex-shrink-0",children:a[0]}),(o||!i&&2===a.length)&&a.slice(1).map((e,l)=>(0,s.jsx)(eX.Z,{size:"xs",color:"blue",className:"text-xs px-1.5 py-0.5 h-5 leading-tight flex-shrink-0",children:e},l+1)),i&&(0,s.jsx)("button",{onClick:e=>{e.stopPropagation(),n()},className:"text-xs text-blue-600 hover:text-blue-800 px-1 py-0.5 rounded hover:bg-blue-50 h-5 leading-tight flex-shrink-0 whitespace-nowrap",children:o?"−":"+".concat(a.length-1)})]})}},{header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Status"}),accessorKey:"model_info.db_model",cell:e=>{let{row:l}=e,t=l.original;return(0,s.jsx)("div",{className:"\n inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium\n ".concat(t.model_info.db_model?"bg-blue-50 text-blue-600":"bg-gray-100 text-gray-600","\n "),children:t.model_info.db_model?"DB Model":"Config Model"})}},{id:"actions",header:"",cell:t=>{var r;let{row:o}=t,i=o.original,n="Admin"===e||(null===(r=i.model_info)||void 0===r?void 0:r.created_by)===l;return(0,s.jsx)("div",{className:"flex items-center justify-end gap-2 pr-4",children:(0,s.jsx)(lo.Z,{icon:p.Z,size:"sm",onClick:()=>{n&&(a(i.model_info.id),c(!1))},className:n?"cursor-pointer":"opacity-50 cursor-not-allowed"})})}}];var ln=t(11318),ld=t(39760),lc=e=>{let{selectedModelGroup:l,setSelectedModelGroup:t,availableModelGroups:r,availableModelAccessGroups:n,setSelectedModelId:d,setSelectedTeamId:c,setEditModel:m,modelData:u}=e,{userId:h,userRole:x,premiumUser:p}=(0,ld.Z)(),{teams:g}=(0,ln.Z)(),[f,j]=(0,a.useState)(""),[v,_]=(0,a.useState)("current_team"),[y,b]=(0,a.useState)("personal"),[N,w]=(0,a.useState)(!1),[k,C]=(0,a.useState)(null),[Z,S]=(0,a.useState)(new Set),[A,I]=(0,a.useState)({pageIndex:0,pageSize:50}),E=(0,a.useRef)(null),P=(0,a.useMemo)(()=>u&&u.data&&0!==u.data.length?u.data.filter(e=>{var t,s,a,r,o;let i=""===f||e.model_name.toLowerCase().includes(f.toLowerCase()),n="all"===l||e.model_name===l||!l||"wildcard"===l&&(null===(t=e.model_name)||void 0===t?void 0:t.includes("*")),d="all"===k||(null===(s=e.model_info.access_groups)||void 0===s?void 0:s.includes(k))||!k,c=!0;return"current_team"===v&&(c="personal"===y?(null===(a=e.model_info)||void 0===a?void 0:a.direct_access)===!0:(null===(o=e.model_info)||void 0===o?void 0:null===(r=o.access_via_team_ids)||void 0===r?void 0:r.includes(y))===!0),i&&n&&d&&c}):[],[u,f,l,k,y,v]),M=(0,a.useMemo)(()=>{let e=A.pageIndex*A.pageSize,l=e+A.pageSize;return P.slice(e,l)},[P,A.pageIndex,A.pageSize]);return(0,a.useEffect)(()=>{I(e=>({...e,pageIndex:0}))},[f,l,k,y,v]),(0,s.jsx)(H.Z,{children:(0,s.jsx)(o.Z,{children:(0,s.jsx)("div",{className:"flex flex-col space-y-4",children:(0,s.jsxs)("div",{className:"bg-white rounded-lg shadow",children:[(0,s.jsxs)("div",{className:"border-b px-6 py-4 bg-gray-50",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"flex items-center gap-4",children:[(0,s.jsx)(i.Z,{className:"text-lg font-semibold text-gray-900",children:"Current Team:"}),(0,s.jsxs)(la.Z,{className:"w-80",defaultValue:"personal",value:y,onValueChange:e=>b(e),children:[(0,s.jsx)(lr.Z,{value:"personal",children:(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:"Personal"})]})}),null==g?void 0:g.filter(e=>e.team_id).map(e=>(0,s.jsx)(lr.Z,{value:e.team_id,children:(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.team_alias?"".concat(e.team_alias.slice(0,30),"..."):"Team ".concat(e.team_id.slice(0,30),"...")})]})},e.team_id))]})]}),(0,s.jsxs)("div",{className:"flex items-center gap-4",children:[(0,s.jsx)(i.Z,{className:"text-lg font-semibold text-gray-900",children:"View:"}),(0,s.jsxs)(la.Z,{className:"w-64",defaultValue:"current_team",value:v,onValueChange:e=>_(e),children:[(0,s.jsx)(lr.Z,{value:"current_team",children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-purple-500 rounded-full"}),(0,s.jsx)("span",{className:"font-medium",children:"Current Team Models"})]})}),(0,s.jsx)(lr.Z,{value:"all",children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-gray-500 rounded-full"}),(0,s.jsx)("span",{className:"font-medium",children:"All Available Models"})]})})]})]})]}),"current_team"===v&&(0,s.jsxs)("div",{className:"flex items-start gap-2 mt-3",children:[(0,s.jsx)(el.Z,{className:"text-gray-400 mt-0.5 flex-shrink-0 text-xs"}),(0,s.jsx)("div",{className:"text-xs text-gray-500",children:"personal"===y?(0,s.jsxs)("span",{children:["To access these models: Create a Virtual Key without selecting a team on the"," ",(0,s.jsx)("a",{href:"/public?login=success&page=api-keys",className:"text-gray-600 hover:text-gray-800 underline",children:"Virtual Keys page"})]}):(0,s.jsxs)("span",{children:['To access these models: Create a Virtual Key and select Team as "',y,'" on the'," ",(0,s.jsx)("a",{href:"/public?login=success&page=api-keys",className:"text-gray-600 hover:text-gray-800 underline",children:"Virtual Keys page"})]})})]})]}),(0,s.jsx)("div",{className:"border-b px-6 py-4",children:(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 model names...",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:f,onChange:e=>j(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 ".concat(N?"bg-gray-100":""),onClick:()=>w(!N),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"]}),(0,s.jsxs)("button",{className:"px-3 py-2 text-sm border rounded-md hover:bg-gray-50 flex items-center gap-2",onClick:()=>{j(""),t("all"),C(null),b("personal"),_("current_team"),I({pageIndex:0,pageSize:50})},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"]})]}),N&&(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-3 mt-3",children:[(0,s.jsx)("div",{className:"w-64",children:(0,s.jsxs)(la.Z,{value:null!=l?l:"all",onValueChange:e=>t("all"===e?"all":e),placeholder:"Filter by Public Model Name",children:[(0,s.jsx)(lr.Z,{value:"all",children:"All Models"}),(0,s.jsx)(lr.Z,{value:"wildcard",children:"Wildcard Models (*)"}),r.map((e,l)=>(0,s.jsx)(lr.Z,{value:e,children:e},l))]})}),(0,s.jsx)("div",{className:"w-64",children:(0,s.jsxs)(la.Z,{value:null!=k?k:"all",onValueChange:e=>C("all"===e?null:e),placeholder:"Filter by Model Access Group",children:[(0,s.jsx)(lr.Z,{value:"all",children:"All Model Access Groups"}),n.map((e,l)=>(0,s.jsx)(lr.Z,{value:e,children:e},l))]})})]}),(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsx)("span",{className:"text-sm text-gray-700",children:P.length>0?"Showing ".concat(A.pageIndex*A.pageSize+1," - ").concat(Math.min((A.pageIndex+1)*A.pageSize,P.length)," of ").concat(P.length," results"):"Showing 0 results"}),P.length>A.pageSize&&(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("button",{onClick:()=>I(e=>({...e,pageIndex:e.pageIndex-1})),disabled:0===A.pageIndex,className:"px-3 py-1 text-sm border rounded-md ".concat(0===A.pageIndex?"bg-gray-100 text-gray-400 cursor-not-allowed":"hover:bg-gray-50"),children:"Previous"}),(0,s.jsx)("button",{onClick:()=>I(e=>({...e,pageIndex:e.pageIndex+1})),disabled:A.pageIndex>=Math.ceil(P.length/A.pageSize)-1,className:"px-3 py-1 text-sm border rounded-md ".concat(A.pageIndex>=Math.ceil(P.length/A.pageSize)-1?"bg-gray-100 text-gray-400 cursor-not-allowed":"hover:bg-gray-50"),children:"Next"})]})]})]})}),(0,s.jsx)(e0.C,{columns:li(x,h,p,d,c,O,()=>{},()=>{},m,Z,S),data:M,isLoading:!1,table:E})]})})})})},lm=t(93142),lu=t(867),lh=t(3810),lx=t(89245),lp=t(5540),lg=t(8881);let{Text:lf}=g.default;var lj=e=>{let{accessToken:l,onReloadSuccess:t,buttonText:r="Reload Price Data",showIcon:o=!0,size:i="middle",type:d="primary",className:m=""}=e,[u,h]=(0,a.useState)(!1),[x,p]=(0,a.useState)(!1),[g,f]=(0,a.useState)(!1),[v,_]=(0,a.useState)(!1),[b,N]=(0,a.useState)(6),[w,k]=(0,a.useState)(null),[C,Z]=(0,a.useState)(!1);(0,a.useEffect)(()=>{S();let e=setInterval(()=>{S()},3e4);return()=>clearInterval(e)},[l]);let S=async()=>{if(l){Z(!0);try{console.log("Fetching reload status...");let e=await (0,n.getModelCostMapReloadStatus)(l);console.log("Received status:",e),k(e)}catch(e){console.error("Failed to fetch reload status:",e),k({scheduled:!1,interval_hours:null,last_run:null,next_run:null})}finally{Z(!1)}}},A=async()=>{if(!l){c.Z.fromBackend("No access token available");return}h(!0);try{let e=await (0,n.reloadModelCostMap)(l);"success"===e.status?(c.Z.success("Price data reloaded successfully! ".concat(e.models_count||0," models updated.")),null==t||t(),await S()):c.Z.fromBackend("Failed to reload price data")}catch(e){console.error("Error reloading price data:",e),c.Z.fromBackend("Failed to reload price data. Please try again.")}finally{h(!1)}},I=async()=>{if(!l){c.Z.fromBackend("No access token available");return}if(b<=0){c.Z.fromBackend("Hours must be greater than 0");return}p(!0);try{let e=await (0,n.scheduleModelCostMapReload)(l,b);"success"===e.status?(c.Z.success("Periodic reload scheduled for every ".concat(b," hours")),_(!1),await S()):c.Z.fromBackend("Failed to schedule periodic reload")}catch(e){console.error("Error scheduling reload:",e),c.Z.fromBackend("Failed to schedule periodic reload. Please try again.")}finally{p(!1)}},E=async()=>{if(!l){c.Z.fromBackend("No access token available");return}f(!0);try{let e=await (0,n.cancelModelCostMapReload)(l);"success"===e.status?(c.Z.success("Periodic reload cancelled successfully"),await S()):c.Z.fromBackend("Failed to cancel periodic reload")}catch(e){console.error("Error cancelling reload:",e),c.Z.fromBackend("Failed to cancel periodic reload. Please try again.")}finally{f(!1)}},P=e=>{if(!e)return"Never";try{return new Date(e).toLocaleString()}catch(l){return e}};return(0,s.jsxs)("div",{className:m,children:[(0,s.jsxs)(lm.Z,{direction:"horizontal",size:"middle",style:{marginBottom:16},children:[(0,s.jsx)(lu.Z,{title:"Hard Refresh Price Data",description:"This will immediately fetch the latest pricing information from the remote source. Continue?",onConfirm:A,okText:"Yes",cancelText:"No",okButtonProps:{style:{backgroundColor:"#6366f1",borderColor:"#6366f1",color:"white",fontWeight:"500",borderRadius:"0.375rem",padding:"0.375rem 0.75rem",height:"auto",fontSize:"0.875rem",lineHeight:"1.25rem",transition:"all 0.2s ease-in-out"},onMouseEnter:e=>{e.currentTarget.style.backgroundColor="#4f46e5"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="#6366f1"}},children:(0,s.jsx)(y.ZP,{type:d,size:i,loading:u,icon:o?(0,s.jsx)(lx.Z,{}):void 0,style:{backgroundColor:"#6366f1",borderColor:"#6366f1",color:"white",fontWeight:"500",borderRadius:"0.375rem",padding:"0.375rem 0.75rem",height:"auto",fontSize:"0.875rem",lineHeight:"1.25rem",transition:"all 0.2s ease-in-out"},onMouseEnter:e=>{e.currentTarget.style.backgroundColor="#4f46e5"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="#6366f1"},children:r})}),(null==w?void 0:w.scheduled)?(0,s.jsx)(y.ZP,{type:"default",size:i,danger:!0,icon:(0,s.jsx)(lg.Z,{}),loading:g,onClick:E,style:{borderColor:"#ff4d4f",color:"#ff4d4f",fontWeight:"500",borderRadius:"0.375rem",padding:"0.375rem 0.75rem",height:"auto",fontSize:"0.875rem",lineHeight:"1.25rem"},children:"Cancel Periodic Reload"}):(0,s.jsx)(y.ZP,{type:"default",size:i,icon:(0,s.jsx)(lp.Z,{}),onClick:()=>_(!0),style:{borderColor:"#d9d9d9",color:"#6366f1",fontWeight:"500",borderRadius:"0.375rem",padding:"0.375rem 0.75rem",height:"auto",fontSize:"0.875rem",lineHeight:"1.25rem"},children:"Set Up Periodic Reload"})]}),w&&(0,s.jsx)(ep.Z,{size:"small",style:{backgroundColor:"#f8f9fa",border:"1px solid #e9ecef",borderRadius:8},children:(0,s.jsxs)(lm.Z,{direction:"vertical",size:"small",style:{width:"100%"},children:[w.scheduled?(0,s.jsx)("div",{children:(0,s.jsxs)(lh.Z,{color:"green",icon:(0,s.jsx)(lp.Z,{}),children:["Scheduled every ",w.interval_hours," hours"]})}):(0,s.jsx)(lf,{type:"secondary",children:"No periodic reload scheduled"}),(0,s.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,s.jsx)(lf,{type:"secondary",style:{fontSize:"12px"},children:"Last run:"}),(0,s.jsx)(lf,{style:{fontSize:"12px"},children:P(w.last_run)})]}),w.scheduled&&(0,s.jsxs)(s.Fragment,{children:[w.next_run&&(0,s.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,s.jsx)(lf,{type:"secondary",style:{fontSize:"12px"},children:"Next run:"}),(0,s.jsx)(lf,{style:{fontSize:"12px"},children:P(w.next_run)})]}),(0,s.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,s.jsx)(lf,{type:"secondary",style:{fontSize:"12px"},children:"Status:"}),(0,s.jsx)(lh.Z,{color:(null==w?void 0:w.scheduled)?w.last_run?"success":"processing":"default",children:(null==w?void 0:w.scheduled)?w.last_run?"Active":"Ready":"Not scheduled"})]})]})]})}),(0,s.jsxs)(j.Z,{title:"Set Up Periodic Reload",open:v,onOk:I,onCancel:()=>_(!1),confirmLoading:x,okText:"Schedule",cancelText:"Cancel",okButtonProps:{style:{backgroundColor:"#6366f1",borderColor:"#6366f1",color:"white"}},children:[(0,s.jsx)("div",{style:{marginBottom:16},children:(0,s.jsx)(lf,{children:"Set up automatic reload of price data every:"})}),(0,s.jsx)("div",{style:{marginBottom:16},children:(0,s.jsx)(eg.Z,{min:1,max:168,value:b,onChange:e=>N(e||6),addonAfter:"hours",style:{width:"100%"}})}),(0,s.jsx)("div",{children:(0,s.jsxs)(lf,{type:"secondary",children:["This will automatically fetch the latest pricing data from the remote source every ",b," hours."]})})]})]})},lv=e=>{let{setModelMap:l}=e,{accessToken:t}=(0,ld.Z)();return(0,s.jsx)(H.Z,{children:(0,s.jsxs)("div",{className:"p-6",children:[(0,s.jsxs)("div",{className:"mb-6",children:[(0,s.jsx)(Y.Z,{children:"Price Data Management"}),(0,s.jsx)(i.Z,{className:"text-tremor-content",children:"Manage model pricing data and configure automatic reload schedules"})]}),(0,s.jsx)(lj,{accessToken:t,onReloadSuccess:()=>{(async()=>{l(await (0,n.modelCostMap)(t))})()},buttonText:"Reload Price Data",size:"middle",type:"primary",className:"w-full"})]})})};let l_={"BadRequestError (400)":"BadRequestErrorRetries","AuthenticationError (401)":"AuthenticationErrorRetries","TimeoutError (408)":"TimeoutErrorRetries","RateLimitError (429)":"RateLimitErrorRetries","ContentPolicyViolationError (400)":"ContentPolicyViolationErrorRetries","InternalServerError (500)":"InternalServerErrorRetries"};var ly=e=>{let{selectedModelGroup:l,setSelectedModelGroup:t,availableModelGroups:a,globalRetryPolicy:r,setGlobalRetryPolicy:o,defaultRetry:n,modelGroupRetryPolicy:d,setModelGroupRetryPolicy:c,handleSaveRetrySettings:m}=e;return(0,s.jsxs)(H.Z,{children:[(0,s.jsx)("div",{className:"flex items-center gap-4 mb-6",children:(0,s.jsxs)("div",{className:"flex items-center",children:[(0,s.jsx)(i.Z,{children:"Retry Policy Scope:"}),(0,s.jsxs)(la.Z,{className:"ml-2 w-48",defaultValue:"global",value:"global"===l?"global":l||a[0],onValueChange:e=>t(e),children:[(0,s.jsx)(lr.Z,{value:"global",children:"Global Default"}),a.map((e,l)=>(0,s.jsx)(lr.Z,{value:e,onClick:()=>t(e),children:e},l))]})]})}),"global"===l?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(Y.Z,{children:"Global Retry Policy"}),(0,s.jsx)(i.Z,{className:"mb-6",children:"Default retry settings applied to all model groups unless overridden"})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(Y.Z,{children:["Retry Policy for ",l]}),(0,s.jsx)(i.Z,{className:"mb-6",children:"Model-specific retry settings. Falls back to global defaults if not set."})]}),l_&&(0,s.jsx)("table",{children:(0,s.jsx)("tbody",{children:Object.entries(l_).map((e,t)=>{var a,m,u,h;let x,[p,g]=e;if("global"===l)x=null!==(a=null==r?void 0:r[g])&&void 0!==a?a:n;else{let e=null==d?void 0:null===(m=d[l])||void 0===m?void 0:m[g];x=null!=e?e:null!==(u=null==r?void 0:r[g])&&void 0!==u?u:n}return(0,s.jsxs)("tr",{className:"flex justify-between items-center mt-2",children:[(0,s.jsxs)("td",{children:[(0,s.jsx)(i.Z,{children:p}),"global"!==l&&(0,s.jsxs)(i.Z,{className:"text-xs text-gray-500 ml-2",children:["(Global: ",null!==(h=null==r?void 0:r[g])&&void 0!==h?h:n,")"]})]}),(0,s.jsx)("td",{children:(0,s.jsx)(eg.Z,{className:"ml-5",value:x,min:0,step:1,onChange:e=>{"global"===l?o(l=>null==e?l:{...null!=l?l:{},[g]:e}):c(t=>{var s;let a=null!==(s=null==t?void 0:t[l])&&void 0!==s?s:{};return{...null!=t?t:{},[l]:{...a,[g]:e}}})}})})]},t)})})}),(0,s.jsx)(z.Z,{className:"mt-6 mr-8",onClick:m,children:"Save"})]})},lb=t(75105),lN=t(40278),lw=t(97765),lk=t(21626),lC=t(97214),lZ=t(28241),lS=t(58834),lA=t(69552),lI=t(71876),lE=t(39789),lP=t(79326),lM=t(2356),lF=t(59664),lL=e=>{let{modelMetrics:l,modelMetricsCategories:t,customTooltip:a,premiumUser:r}=e;return(0,s.jsx)(lF.Z,{title:"Time to First token (s)",className:"h-72",data:l,index:"date",showLegend:!1,categories:t,colors:["indigo","rose"],connectNulls:!0,customTooltip:a})},lT=e=>{let{setSelectedAPIKey:l,keys:t,teams:r,setSelectedCustomer:o,allEndUsers:n}=e,{premiumUser:d}=(0,ld.Z)(),[c,m]=(0,a.useState)(null);return(0,s.jsxs)("div",{children:[(0,s.jsx)(i.Z,{className:"mb-1",children:"Select API Key Name"}),d?(0,s.jsxs)("div",{children:[(0,s.jsxs)(la.Z,{defaultValue:"all-keys",children:[(0,s.jsx)(lr.Z,{value:"all-keys",onClick:()=>{l(null)},children:"All Keys"},"all-keys"),null==t?void 0:t.map((e,t)=>e&&null!==e.key_alias&&e.key_alias.length>0?(0,s.jsx)(lr.Z,{value:String(t),onClick:()=>{l(e)},children:e.key_alias},t):null)]}),(0,s.jsx)(i.Z,{className:"mt-1",children:"Select Customer Name"}),(0,s.jsxs)(la.Z,{defaultValue:"all-customers",children:[(0,s.jsx)(lr.Z,{value:"all-customers",onClick:()=>{o(null)},children:"All Customers"},"all-customers"),null==n?void 0:n.map((e,l)=>(0,s.jsx)(lr.Z,{value:e,onClick:()=>{o(e)},children:e},l))]}),(0,s.jsx)(i.Z,{className:"mt-1",children:"Select Team"}),(0,s.jsxs)(la.Z,{className:"w-64 relative z-50",defaultValue:"all",value:null!=c?c:"all",onValueChange:e=>m("all"===e?null:e),children:[(0,s.jsx)(lr.Z,{value:"all",children:"All Teams"}),null==r?void 0:r.filter(e=>e.team_id).map(e=>(0,s.jsx)(lr.Z,{value:e.team_id,children:e.team_alias?"".concat(e.team_alias," (").concat(e.team_id.slice(0,8),"...)"):"Team ".concat(e.team_id.slice(0,8),"...")},e.team_id))]})]}):(0,s.jsxs)("div",{children:[(0,s.jsx)(i.Z,{className:"mt-1",children:"Select Team"}),(0,s.jsxs)(la.Z,{className:"w-64 relative z-50",defaultValue:"all",value:null!=c?c:"all",onValueChange:e=>m("all"===e?null:e),children:[(0,s.jsx)(lr.Z,{value:"all",children:"All Teams"}),null==r?void 0:r.filter(e=>e.team_id).map(e=>(0,s.jsx)(lr.Z,{value:e.team_id,children:e.team_alias?"".concat(e.team_alias," (").concat(e.team_id.slice(0,8),"...)"):"Team ".concat(e.team_id.slice(0,8),"...")},e.team_id))]})]})]})},lR=e=>{let{dateValue:l,setDateValue:t,selectedModelGroup:d,availableModelGroups:c,setShowAdvancedFilters:m,modelMetrics:u,modelMetricsCategories:h,streamingModelMetrics:x,streamingModelMetricsCategories:p,customTooltip:g,slowResponsesData:f,modelExceptions:j,globalExceptionData:v,allExceptions:_,globalExceptionPerDeployment:y,setSelectedAPIKey:b,keys:N,setSelectedCustomer:w,teams:k,allEndUsers:C,selectedAPIKey:Z,selectedCustomer:S,selectedTeam:A,setSelectedModelGroup:I,setModelMetrics:E,setModelMetricsCategories:P,setStreamingModelMetrics:M,setStreamingModelMetricsCategories:F,setSlowResponsesData:L,setModelExceptions:T,setAllExceptions:R,setGlobalExceptionData:O,setGlobalExceptionPerDeployment:D}=e,{accessToken:V,userId:q,userRole:W,premiumUser:$}=(0,ld.Z)();(0,a.useEffect)(()=>{Q(d,l.from,l.to)},[Z,S,A]);let Q=async(e,l,t)=>{if(console.log("Updating model metrics for group:",e),!V||!q||!W||!l||!t)return;console.log("inside updateModelMetrics - startTime:",l,"endTime:",t),I(e);let s=null==Z?void 0:Z.token;void 0===s&&(s=null);let a=S;void 0===a&&(a=null);try{let r=await (0,n.modelMetricsCall)(V,q,W,e,l.toISOString(),t.toISOString(),s,a);console.log("Model metrics response:",r),E(r.data),P(r.all_api_bases);let o=await (0,n.streamingModelMetricsCall)(V,e,l.toISOString(),t.toISOString());M(o.data),F(o.all_api_bases);let i=await (0,n.modelExceptionsCall)(V,q,W,e,l.toISOString(),t.toISOString(),s,a);console.log("Model exceptions response:",i),T(i.data),R(i.exception_types);let d=await (0,n.modelMetricsSlowResponsesCall)(V,q,W,e,l.toISOString(),t.toISOString(),s,a);if(console.log("slowResponses:",d),L(d),e){let s=await (0,n.adminGlobalActivityExceptions)(V,null==l?void 0:l.toISOString().split("T")[0],null==t?void 0:t.toISOString().split("T")[0],e);O(s);let a=await (0,n.adminGlobalActivityExceptionsPerDeployment)(V,null==l?void 0:l.toISOString().split("T")[0],null==t?void 0:t.toISOString().split("T")[0],e);D(a)}}catch(e){console.error("Failed to fetch model metrics",e)}};return(0,s.jsxs)(H.Z,{children:[(0,s.jsxs)(o.Z,{numItems:4,className:"mt-2 mb-2",children:[(0,s.jsx)(r.Z,{children:(0,s.jsx)(lE.Z,{value:l,className:"mr-2",onValueChange:e=>{t(e),Q(d,e.from,e.to)}})}),(0,s.jsxs)(r.Z,{className:"ml-2",children:[(0,s.jsx)(i.Z,{children:"Select Model Group"}),(0,s.jsx)(la.Z,{defaultValue:d||c[0],value:d||c[0],children:c.map((e,t)=>(0,s.jsx)(lr.Z,{value:e,onClick:()=>Q(e,l.from,l.to),children:e},t))})]}),(0,s.jsx)(r.Z,{children:(0,s.jsx)(lP.Z,{trigger:"click",content:(0,s.jsx)(lT,{allEndUsers:C,keys:N,setSelectedAPIKey:b,setSelectedCustomer:w,teams:k}),overlayStyle:{width:"20vw"},children:(0,s.jsx)(z.Z,{icon:lM.Z,size:"md",variant:"secondary",className:"mt-4 ml-2",style:{border:"none"},onClick:()=>m(!0)})})})]}),(0,s.jsxs)(o.Z,{numItems:2,children:[(0,s.jsx)(r.Z,{children:(0,s.jsx)(B.Z,{className:"mr-2 max-h-[400px] min-h-[400px]",children:(0,s.jsxs)(U.Z,{children:[(0,s.jsxs)(G.Z,{variant:"line",defaultValue:"1",children:[(0,s.jsx)(K.Z,{value:"1",children:"Avg. Latency per Token"}),(0,s.jsx)(K.Z,{value:"2",children:"Time to first token"})]}),(0,s.jsxs)(J.Z,{children:[(0,s.jsxs)(H.Z,{children:[(0,s.jsx)("p",{className:"text-gray-500 italic",children:" (seconds/token)"}),(0,s.jsx)(i.Z,{className:"text-gray-500 italic mt-1 mb-1",children:"average Latency for successfull requests divided by the total tokens"}),u&&h&&(0,s.jsx)(lb.Z,{title:"Model Latency",className:"h-72",data:u,showLegend:!1,index:"date",categories:h,connectNulls:!0,customTooltip:g})]}),(0,s.jsx)(H.Z,{children:(0,s.jsx)(lL,{modelMetrics:x,modelMetricsCategories:p,customTooltip:g,premiumUser:$})})]})]})})}),(0,s.jsx)(r.Z,{children:(0,s.jsx)(B.Z,{className:"ml-2 max-h-[400px] min-h-[400px] overflow-y-auto",children:(0,s.jsxs)(lk.Z,{children:[(0,s.jsx)(lS.Z,{children:(0,s.jsxs)(lI.Z,{children:[(0,s.jsx)(lA.Z,{children:"Deployment"}),(0,s.jsx)(lA.Z,{children:"Success Responses"}),(0,s.jsxs)(lA.Z,{children:["Slow Responses ",(0,s.jsx)("p",{children:"Success Responses taking 600+s"})]})]})}),(0,s.jsx)(lC.Z,{children:f.map((e,l)=>(0,s.jsxs)(lI.Z,{children:[(0,s.jsx)(lZ.Z,{children:e.api_base}),(0,s.jsx)(lZ.Z,{children:e.total_count}),(0,s.jsx)(lZ.Z,{children:e.slow_count})]},l))})]})})})]}),(0,s.jsx)(o.Z,{numItems:1,className:"gap-2 w-full mt-2",children:(0,s.jsxs)(B.Z,{children:[(0,s.jsxs)(Y.Z,{children:["All Exceptions for ",d]}),(0,s.jsx)(lN.Z,{className:"h-60",data:j,index:"model",categories:_,stack:!0,yAxisWidth:30})]})}),(0,s.jsxs)(o.Z,{numItems:1,className:"gap-2 w-full mt-2",children:[(0,s.jsxs)(B.Z,{children:[(0,s.jsxs)(Y.Z,{children:["All Up Rate Limit Errors (429) for ",d]}),(0,s.jsxs)(o.Z,{numItems:1,children:[(0,s.jsxs)(r.Z,{children:[(0,s.jsxs)(lw.Z,{style:{fontSize:"15px",fontWeight:"normal",color:"#535452"},children:["Num Rate Limit Errors ",v.sum_num_rate_limit_exceptions]}),(0,s.jsx)(lN.Z,{className:"h-40",data:v.daily_data,index:"date",colors:["rose"],categories:["num_rate_limit_exceptions"],onValueChange:e=>console.log(e)})]}),(0,s.jsx)(r.Z,{})]})]}),$?(0,s.jsx)(s.Fragment,{children:y.map((e,l)=>(0,s.jsxs)(B.Z,{children:[(0,s.jsx)(Y.Z,{children:e.api_base?e.api_base:"Unknown API Base"}),(0,s.jsx)(o.Z,{numItems:1,children:(0,s.jsxs)(r.Z,{children:[(0,s.jsxs)(lw.Z,{style:{fontSize:"15px",fontWeight:"normal",color:"#535452"},children:["Num Rate Limit Errors (429) ",e.sum_num_rate_limit_exceptions]}),(0,s.jsx)(lN.Z,{className:"h-40",data:e.daily_data,index:"date",colors:["rose"],categories:["num_rate_limit_exceptions"],onValueChange:e=>console.log(e)})]})})]},l))}):(0,s.jsx)(s.Fragment,{children:y&&y.length>0&&y.slice(0,1).map((e,l)=>(0,s.jsxs)(B.Z,{children:[(0,s.jsx)(Y.Z,{children:"✨ Rate Limit Errors by Deployment"}),(0,s.jsx)("p",{className:"mb-2 text-gray-500 italic text-[12px]",children:"Upgrade to see exceptions for all deployments"}),(0,s.jsx)(z.Z,{variant:"primary",className:"mb-2",children:(0,s.jsx)("a",{href:"https://forms.gle/W3U4PZpJGFHWtHyA9",target:"_blank",children:"Get Free Trial"})}),(0,s.jsxs)(B.Z,{children:[(0,s.jsx)(Y.Z,{children:e.api_base}),(0,s.jsx)(o.Z,{numItems:1,children:(0,s.jsxs)(r.Z,{children:[(0,s.jsxs)(lw.Z,{style:{fontSize:"15px",fontWeight:"normal",color:"#535452"},children:["Num Rate Limit Errors ",e.sum_num_rate_limit_exceptions]}),(0,s.jsx)(lN.Z,{className:"h-40",data:e.daily_data,index:"date",colors:["rose"],categories:["num_rate_limit_exceptions"],onValueChange:e=>console.log(e)})]})})]})]},l))})]})]})},lO=e=>{let{accessToken:l,token:t,userRole:m,userID:h,modelData:x={data:[]},keys:p,setModelData:j,premiumUser:v,teams:_}=e,[y]=f.Z.useForm(),[b,N]=(0,a.useState)(null),[w,k]=(0,a.useState)(""),[C,Z]=(0,a.useState)([]),[S,A]=(0,a.useState)([]),[I,E]=(0,a.useState)(d.Cl.OpenAI),[P,M]=(0,a.useState)(!1),[F,L]=(0,a.useState)(null),[T,z]=(0,a.useState)([]),[B,K]=(0,a.useState)([]),[U,G]=(0,a.useState)(null),[H,J]=(0,a.useState)([]),[W,Y]=(0,a.useState)([]),[$,Q]=(0,a.useState)([]),[X,ee]=(0,a.useState)([]),[el,et]=(0,a.useState)([]),[es,ea]=(0,a.useState)([]),[er,eo]=(0,a.useState)([]),[ei,en]=(0,a.useState)({from:new Date(Date.now()-6048e5),to:new Date}),[ed,ec]=(0,a.useState)(null),[em,eu]=(0,a.useState)(null),[eh,ex]=(0,a.useState)(0),[ep,eg]=(0,a.useState)({}),[ef,ej]=(0,a.useState)([]),[ev,e_]=(0,a.useState)(!1),[ey,eb]=(0,a.useState)(null),[eN,ek]=(0,a.useState)(null),[eC,eZ]=(0,a.useState)([]),[eS,eA]=(0,a.useState)([]),[eI,eE]=(0,a.useState)({}),[eP,eM]=(0,a.useState)(!1),[eF,eL]=(0,a.useState)(null),[eT,eR]=(0,a.useState)(!1),[eO,eD]=(0,a.useState)(null),[eV,eq]=(0,a.useState)(null),[ez,eB]=(0,a.useState)(!1),eK=(0,a.useRef)(null),[eG,eH]=(0,a.useState)(0),eJ=async e=>{try{let l=await (0,n.credentialListCall)(e);console.log("credentials: ".concat(JSON.stringify(l))),eA(l.credentials)}catch(e){console.error("Error fetching credentials:",e)}};(0,a.useEffect)(()=>{let e=e=>{eK.current&&!eK.current.contains(e.target)&&eB(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);let eW={name:"file",accept:".json",beforeUpload:e=>{if("application/json"===e.type){let l=new FileReader;l.onload=e=>{if(e.target){let l=e.target.result;console.log("Resetting vertex_credentials to JSON; jsonStr: ".concat(l)),y.setFieldsValue({vertex_credentials:l}),console.log("Form values right after setting:",y.getFieldsValue())}},l.readAsText(e)}return!1},onChange(e){console.log("Upload onChange triggered with values:",e),console.log("Current form values:",y.getFieldsValue()),"uploading"!==e.file.status&&console.log(e.file,e.fileList),"done"===e.file.status?c.Z.success("".concat(e.file.name," file uploaded successfully")):"error"===e.file.status&&c.Z.fromBackend("".concat(e.file.name," file upload failed."))}},eY=()=>{k(new Date().toLocaleString())},e$=async()=>{if(!l){console.error("Access token is missing");return}try{let e={router_settings:{}};"global"===U?(console.log("Saving global retry policy:",em),em&&(e.router_settings.retry_policy=em),c.Z.success("Global retry settings saved successfully")):(console.log("Saving model group retry policy for",U,":",ed),ed&&(e.router_settings.model_group_retry_policy=ed),c.Z.success("Retry settings saved successfully for ".concat(U))),await (0,n.setCallbacksCall)(l,e)}catch(e){console.error("Failed to save retry settings:",e),c.Z.fromBackend("Failed to save retry settings")}};if((0,a.useEffect)(()=>{if(!l||!t||!m||!h)return;let e=async()=>{try{var e,t,s,a,r,o,i,d,c,u,x,p;let g=await (0,n.modelInfoCall)(l,h,m);console.log("Model data response:",g.data),j(g);let f=await (0,n.modelSettingsCall)(l);f&&A(f);let v=new Set;for(let e=0;e0&&(b=_[_.length-1],console.log("_initial_model_group:",b)),console.log("selectedModelGroup:",U);let N=await (0,n.modelMetricsCall)(l,h,m,b,null===(e=ei.from)||void 0===e?void 0:e.toISOString(),null===(t=ei.to)||void 0===t?void 0:t.toISOString(),null==ey?void 0:ey.token,eN);console.log("Model metrics response:",N),J(N.data),Y(N.all_api_bases);let w=await (0,n.streamingModelMetricsCall)(l,b,null===(s=ei.from)||void 0===s?void 0:s.toISOString(),null===(a=ei.to)||void 0===a?void 0:a.toISOString());Q(w.data),ee(w.all_api_bases);let k=await (0,n.modelExceptionsCall)(l,h,m,b,null===(r=ei.from)||void 0===r?void 0:r.toISOString(),null===(o=ei.to)||void 0===o?void 0:o.toISOString(),null==ey?void 0:ey.token,eN);console.log("Model exceptions response:",k),et(k.data),ea(k.exception_types);let C=await (0,n.modelMetricsSlowResponsesCall)(l,h,m,b,null===(i=ei.from)||void 0===i?void 0:i.toISOString(),null===(d=ei.to)||void 0===d?void 0:d.toISOString(),null==ey?void 0:ey.token,eN),Z=await (0,n.adminGlobalActivityExceptions)(l,null===(c=ei.from)||void 0===c?void 0:c.toISOString().split("T")[0],null===(u=ei.to)||void 0===u?void 0:u.toISOString().split("T")[0],b);eg(Z);let S=await (0,n.adminGlobalActivityExceptionsPerDeployment)(l,null===(x=ei.from)||void 0===x?void 0:x.toISOString().split("T")[0],null===(p=ei.to)||void 0===p?void 0:p.toISOString().split("T")[0],b);ej(S),console.log("dailyExceptions:",Z),console.log("dailyExceptionsPerDeplyment:",S),console.log("slowResponses:",C),eo(C);let I=await (0,n.allEndUsersCall)(l);eZ(null==I?void 0:I.map(e=>e.user_id));let E=(await (0,n.getCallbacksCall)(l,h,m)).router_settings;console.log("routerSettingsInfo:",E);let P=E.model_group_retry_policy,M=E.num_retries;console.log("model_group_retry_policy:",P),console.log("default_retries:",M),ec(P),eu(E.retry_policy),ex(M);let F=E.model_group_alias||{};eE(F)}catch(e){console.error("There was an error fetching the model data",e)}};l&&t&&m&&h&&e();let s=async()=>{let e=await (0,n.modelCostMap)(l);console.log("received model cost map data: ".concat(Object.keys(e))),N(e)};null==b&&s(),eY()},[l,t,m,h,b,w,eV]),!x||!l||!t||!m||!h)return(0,s.jsx)("div",{children:"Loading..."});let eX=[],e0=[];for(let e=0;e(console.log("GET PROVIDER CALLED! - ".concat(b)),null!=b&&"object"==typeof b&&e in b)?b[e].litellm_provider:"openai";if(t){let e=t.split("/"),l=e[0];(r=s)||(r=1===e.length?m(t):l)}else r="-";a&&(o=null==a?void 0:a.input_cost_per_token,i=null==a?void 0:a.output_cost_per_token,n=null==a?void 0:a.max_tokens,d=null==a?void 0:a.max_input_tokens),(null==l?void 0:l.litellm_params)&&(c=Object.fromEntries(Object.entries(null==l?void 0:l.litellm_params).filter(e=>{let[l]=e;return"model"!==l&&"api_base"!==l}))),x.data[e].provider=r,x.data[e].input_cost=o,x.data[e].output_cost=i,x.data[e].litellm_model_name=t,e0.push(r),x.data[e].input_cost&&(x.data[e].input_cost=(1e6*Number(x.data[e].input_cost)).toFixed(2)),x.data[e].output_cost&&(x.data[e].output_cost=(1e6*Number(x.data[e].output_cost)).toFixed(2)),x.data[e].max_tokens=n,x.data[e].max_input_tokens=d,x.data[e].api_base=null==l?void 0:null===(e4=l.litellm_params)||void 0===e4?void 0:e4.api_base,x.data[e].cleanedLitellmParams=c,eX.push(l.model_name),console.log(x.data[e])}if(m&&"Admin Viewer"==m){let{Title:e,Paragraph:l}=g.default;return(0,s.jsxs)("div",{children:[(0,s.jsx)(e,{level:1,children:"Access Denied"}),(0,s.jsx)(l,{children:"Ask your proxy admin for access to view all models"})]})}return(console.log("selectedProvider: ".concat(I)),console.log("providerModels.length: ".concat(C.length)),Object.keys(d.Cl).find(e=>d.Cl[e]===I),eO)?(0,s.jsx)("div",{className:"w-full h-full",children:(0,s.jsx)(q.Z,{teamId:eO,onClose:()=>eD(null),accessToken:l,is_team_admin:"Admin"===m,is_proxy_admin:"Proxy Admin"===m,userModels:eX,editTeam:!1,onUpdate:eY})}):(0,s.jsx)("div",{className:"w-full mx-4 h-[75vh]",children:(0,s.jsx)(o.Z,{numItems:1,className:"gap-2 p-8 w-full mt-2",children:(0,s.jsxs)(r.Z,{numColSpan:1,className:"flex flex-col gap-2",children:[(0,s.jsx)("div",{className:"flex justify-between items-center mb-4",children:(0,s.jsxs)("div",{children:[(0,s.jsx)("h2",{className:"text-lg font-semibold",children:"Model Management"}),eU.ZL.includes(m)?(0,s.jsx)("p",{className:"text-sm text-gray-600",children:"Add and manage models for the proxy"}):(0,s.jsx)("p",{className:"text-sm text-gray-600",children:"Add models for teams you are an admin for."})]})}),eF?(0,s.jsx)(ew,{modelId:eF,editModel:!0,onClose:()=>{eL(null),eR(!1)},modelData:x.data.find(e=>e.model_info.id===eF),accessToken:l,userID:h,userRole:m,setEditModalVisible:M,setSelectedModel:L,onModelUpdate:e=>{j({...x,data:x.data.map(l=>l.model_info.id===e.model_info.id?e:l)}),eY()},modelAccessGroups:B}):(0,s.jsxs)(D.v0,{index:eG,onIndexChange:eH,className:"gap-2 h-[75vh] w-full ",children:[(0,s.jsxs)(D.td,{className:"flex justify-between mt-2 w-full items-center",children:[(0,s.jsxs)("div",{className:"flex",children:[eU.ZL.includes(m)?(0,s.jsx)(D.OK,{children:"All Models"}):(0,s.jsx)(D.OK,{children:"Your Models"}),(0,s.jsx)(D.OK,{children:"Add Model"}),eU.ZL.includes(m)&&(0,s.jsx)(D.OK,{children:"LLM Credentials"}),eU.ZL.includes(m)&&(0,s.jsx)(D.OK,{children:"Pass-Through Endpoints"}),eU.ZL.includes(m)&&(0,s.jsx)(D.OK,{children:"Health Status"}),eU.ZL.includes(m)&&(0,s.jsx)(D.OK,{children:"Model Analytics"}),eU.ZL.includes(m)&&(0,s.jsx)(D.OK,{children:"Model Retry Settings"}),eU.ZL.includes(m)&&(0,s.jsx)(D.OK,{children:"Model Group Alias"}),eU.ZL.includes(m)&&(0,s.jsx)(D.OK,{children:"Price Data Reload"})]}),(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[w&&(0,s.jsxs)(i.Z,{children:["Last Refreshed: ",w]}),(0,s.jsx)(D.JO,{icon:V.Z,variant:"shadow",size:"xs",className:"self-center",onClick:eY})]})]}),(0,s.jsxs)(D.nP,{children:[(0,s.jsx)(lc,{selectedModelGroup:U,setSelectedModelGroup:G,availableModelGroups:T,availableModelAccessGroups:B,setSelectedModelId:eL,setSelectedTeamId:eD,setEditModel:eR,modelData:x}),(0,s.jsx)(D.x4,{className:"h-full",children:(0,s.jsx)(eQ,{form:y,handleOk:()=>{console.log("\uD83D\uDE80 handleOk called from model dashboard!"),console.log("Current form values:",y.getFieldsValue()),y.validateFields().then(e=>{console.log("✅ Validation passed, submitting:",e),u(e,l,y,eY)}).catch(e=>{var l;console.error("❌ Validation failed:",e),console.error("Form errors:",e.errorFields);let t=(null===(l=e.errorFields)||void 0===l?void 0:l.map(e=>"".concat(e.name.join("."),": ").concat(e.errors.join(", "))).join(" | "))||"Unknown validation error";c.Z.fromBackend("Please fill in the following required fields: ".concat(t))})},selectedProvider:I,setSelectedProvider:E,providerModels:C,setProviderModelsFn:e=>{let l=(0,d.bK)(e,b);Z(l),console.log("providerModels: ".concat(l))},getPlaceholder:d.ph,uploadProps:eW,showAdvancedSettings:eP,setShowAdvancedSettings:eM,teams:_,credentials:eS,accessToken:l,userRole:m,premiumUser:v})}),(0,s.jsx)(D.x4,{children:(0,s.jsx)(R,{accessToken:l,uploadProps:eW,credentialList:eS,fetchCredentials:eJ})}),(0,s.jsx)(D.x4,{children:(0,s.jsx)(e8.Z,{accessToken:l,userRole:m,userID:h,modelData:x,premiumUser:v})}),(0,s.jsx)(D.x4,{children:(0,s.jsx)(e3,{accessToken:l,modelData:x,all_models_on_proxy:eX,getDisplayModelName:O,setSelectedModelId:eL})}),(0,s.jsx)(lR,{dateValue:ei,setDateValue:en,selectedModelGroup:U,availableModelGroups:T,setShowAdvancedFilters:e_,modelMetrics:H,modelMetricsCategories:W,streamingModelMetrics:$,streamingModelMetricsCategories:X,customTooltip:e=>{var l,t;let{payload:a,active:r}=e;if(!r||!a)return null;let o=null===(t=a[0])||void 0===t?void 0:null===(l=t.payload)||void 0===l?void 0:l.date,i=a.sort((e,l)=>l.value-e.value);if(i.length>5){let e=i.length-5;(i=i.slice(0,5)).push({dataKey:"".concat(e," other deployments"),value:a.slice(5).reduce((e,l)=>e+l.value,0),color:"gray"})}return(0,s.jsxs)("div",{className:"w-150 rounded-tremor-default border border-tremor-border bg-tremor-background p-2 text-tremor-default shadow-tremor-dropdown",children:[o&&(0,s.jsxs)("p",{className:"text-tremor-content-emphasis mb-2",children:["Date: ",o]}),i.map((e,l)=>{let t=parseFloat(e.value.toFixed(5)),a=0===t&&e.value>0?"<0.00001":t.toFixed(5);return(0,s.jsxs)("div",{className:"flex justify-between",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 mt-1 rounded-full bg-".concat(e.color,"-500")}),(0,s.jsx)("p",{className:"text-tremor-content",children:e.dataKey})]}),(0,s.jsx)("p",{className:"font-medium text-tremor-content-emphasis text-righ ml-2",children:a})]},l)})]})},slowResponsesData:er,modelExceptions:el,globalExceptionData:ep,allExceptions:es,globalExceptionPerDeployment:ef,allEndUsers:eC,keys:p,setSelectedAPIKey:eb,setSelectedCustomer:ek,teams:_,selectedAPIKey:ey,selectedCustomer:eN,selectedTeam:eV,setAllExceptions:ea,setGlobalExceptionData:eg,setGlobalExceptionPerDeployment:ej,setModelExceptions:et,setModelMetrics:J,setModelMetricsCategories:Y,setSelectedModelGroup:G,setSlowResponsesData:eo,setStreamingModelMetrics:Q,setStreamingModelMetricsCategories:ee}),(0,s.jsx)(ly,{selectedModelGroup:U,setSelectedModelGroup:G,availableModelGroups:T,globalRetryPolicy:em,setGlobalRetryPolicy:eu,defaultRetry:eh,modelGroupRetryPolicy:ed,setModelGroupRetryPolicy:ec,handleSaveRetrySettings:e$}),(0,s.jsx)(D.x4,{children:(0,s.jsx)(ls,{accessToken:l,initialModelGroupAlias:eI,onAliasUpdate:eE})}),(0,s.jsx)(lv,{setModelMap:N})]})]})]})})})}},7166:function(e,l,t){t.d(l,{Z:function(){return J}});var s=t(57437),a=t(2265),r=t(20831),o=t(47323),i=t(84264),n=t(96761),d=t(19250),c=t(89970),m=t(33866),u=t(15731),h=t(53410),x=t(74998),p=t(92858),g=t(49566),f=t(12514),j=t(97765),v=t(52787),_=t(13634),y=t(82680),b=t(61778),N=t(24199),w=t(12660),k=t(15424),C=t(93142),Z=t(73002),S=t(45246),A=t(96473),I=t(31283),E=e=>{let{value:l={},onChange:t}=e,[r,o]=(0,a.useState)(Object.entries(l)),i=e=>{let l=r.filter((l,t)=>t!==e);o(l),null==t||t(Object.fromEntries(l))},n=(e,l,s)=>{let a=[...r];a[e]=[l,s],o(a),null==t||t(Object.fromEntries(a))};return(0,s.jsxs)("div",{children:[r.map((e,l)=>{let[t,a]=e;return(0,s.jsxs)(C.Z,{style:{display:"flex",marginBottom:8},align:"center",children:[(0,s.jsx)(I.o,{placeholder:"Header Name",value:t,onChange:e=>n(l,e.target.value,a)}),(0,s.jsx)(I.o,{placeholder:"Header Value",value:a,onChange:e=>n(l,t,e.target.value)}),(0,s.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%"},children:(0,s.jsx)(S.Z,{onClick:()=>i(l),style:{cursor:"pointer"}})})]},l)}),(0,s.jsx)(Z.ZP,{type:"dashed",onClick:()=>{o([...r,["",""]])},icon:(0,s.jsx)(A.Z,{}),children:"Add Header"})]})},P=t(77565),M=e=>{let{pathValue:l,targetValue:t,includeSubpath:a}=e,r=(0,d.getProxyBaseUrl)();return l&&t?(0,s.jsxs)(f.Z,{className:"p-5",children:[(0,s.jsx)(n.Z,{className:"text-lg font-semibold text-gray-900 mb-2",children:"Route Preview"}),(0,s.jsx)(j.Z,{className:"text-gray-600 mb-5",children:"How your requests will be routed"}),(0,s.jsxs)("div",{className:"space-y-5",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"text-base font-semibold text-gray-900 mb-3",children:"Basic routing:"}),(0,s.jsxs)("div",{className:"flex items-center gap-4",children:[(0,s.jsxs)("div",{className:"flex-1 bg-gray-50 border border-gray-200 rounded-lg p-3",children:[(0,s.jsx)("div",{className:"text-sm text-gray-600 mb-2",children:"Your endpoint"}),(0,s.jsx)("code",{className:"font-mono text-sm text-gray-900",children:l?"".concat(r).concat(l):""})]}),(0,s.jsx)("div",{className:"text-gray-400",children:(0,s.jsx)(P.Z,{className:"text-lg"})}),(0,s.jsxs)("div",{className:"flex-1 bg-gray-50 border border-gray-200 rounded-lg p-3",children:[(0,s.jsx)("div",{className:"text-sm text-gray-600 mb-2",children:"Forwards to"}),(0,s.jsx)("code",{className:"font-mono text-sm text-gray-900",children:t})]})]})]}),a&&(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"text-base font-semibold text-gray-900 mb-3",children:"With subpaths:"}),(0,s.jsxs)("div",{className:"flex items-center gap-4",children:[(0,s.jsxs)("div",{className:"flex-1 bg-gray-50 border border-gray-200 rounded-lg p-3",children:[(0,s.jsx)("div",{className:"text-sm text-gray-600 mb-2",children:"Your endpoint + subpath"}),(0,s.jsxs)("code",{className:"font-mono text-sm text-gray-900",children:[l&&"".concat(r).concat(l),(0,s.jsx)("span",{className:"text-blue-600",children:"/v1/text-to-image/base/model"})]})]}),(0,s.jsx)("div",{className:"text-gray-400",children:(0,s.jsx)(P.Z,{className:"text-lg"})}),(0,s.jsxs)("div",{className:"flex-1 bg-gray-50 border border-gray-200 rounded-lg p-3",children:[(0,s.jsx)("div",{className:"text-sm text-gray-600 mb-2",children:"Forwards to"}),(0,s.jsxs)("code",{className:"font-mono text-sm text-gray-900",children:[t,(0,s.jsx)("span",{className:"text-blue-600",children:"/v1/text-to-image/base/model"})]})]})]}),(0,s.jsxs)("div",{className:"mt-3 text-sm text-gray-600",children:["Any path after ",l," will be appended to the target URL"]})]})}),!a&&(0,s.jsx)("div",{className:"mt-4 p-3 bg-blue-50 rounded-md border border-blue-200",children:(0,s.jsxs)("div",{className:"flex items-start",children:[(0,s.jsx)(k.Z,{className:"text-blue-500 mt-0.5 mr-2 flex-shrink-0"}),(0,s.jsxs)("div",{className:"text-sm text-blue-700",children:[(0,s.jsx)("span",{className:"font-medium",children:"Not seeing the routing you wanted?"})," Try enabling - Include Subpaths - above - this allows subroutes like"," ",(0,s.jsx)("code",{className:"bg-blue-100 px-1 py-0.5 rounded font-mono text-xs",children:"/api/v1/models"})," to be forwarded automatically."]})]})})]})]}):null},F=t(9114),L=t(63709),T=e=>{let{premiumUser:l,authEnabled:t,onAuthChange:a}=e;return(0,s.jsxs)(f.Z,{className:"p-6",children:[(0,s.jsx)(n.Z,{className:"text-lg font-semibold text-gray-900 mb-2",children:"Security"}),(0,s.jsx)(j.Z,{className:"text-gray-600 mb-4",children:"When enabled, requests to this endpoint will require a valid LiteLLM API key"}),l?(0,s.jsx)(_.Z.Item,{name:"auth",valuePropName:"checked",className:"mb-0",children:(0,s.jsx)(L.Z,{checked:t,onChange:e=>{a(e)}})}):(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center mb-3",children:[(0,s.jsx)(L.Z,{disabled:!0,checked:!1,style:{outline:"2px solid #d1d5db",outlineOffset:"2px"}}),(0,s.jsx)("span",{className:"ml-2 text-sm text-gray-400",children:"Authentication (Premium)"})]}),(0,s.jsx)("div",{className:"p-3 bg-yellow-50 border border-yellow-200 rounded-lg",children:(0,s.jsxs)(i.Z,{className:"text-sm text-yellow-800",children:["Setting authentication for pass-through endpoints is a LiteLLM Enterprise feature. Get a trial key"," ",(0,s.jsx)("a",{href:"https://www.litellm.ai/#pricing",target:"_blank",rel:"noopener noreferrer",className:"underline",children:"here"}),"."]})})]})]})};let{Option:R}=v.default;var O=e=>{let{accessToken:l,setPassThroughItems:t,passThroughItems:o,premiumUser:i=!1}=e,[m]=_.Z.useForm(),[u,h]=(0,a.useState)(!1),[x,v]=(0,a.useState)(!1),[C,Z]=(0,a.useState)(""),[S,A]=(0,a.useState)(""),[I,P]=(0,a.useState)(""),[L,R]=(0,a.useState)(!0),[O,D]=(0,a.useState)(!1),V=()=>{m.resetFields(),A(""),P(""),R(!0),h(!1)},q=e=>{let l=e;e&&!e.startsWith("/")&&(l="/"+e),A(l),m.setFieldsValue({path:l})},z=async e=>{console.log("addPassThrough called with:",e),v(!0);try{!i&&"auth"in e&&delete e.auth,console.log("formValues: ".concat(JSON.stringify(e)));let s=(await (0,d.createPassThroughEndpoint)(l,e)).endpoints[0],a=[...o,s];t(a),F.Z.success("Pass-through endpoint created successfully"),m.resetFields(),A(""),P(""),R(!0),h(!1)}catch(e){F.Z.fromBackend("Error creating pass-through endpoint: "+e)}finally{v(!1)}};return(0,s.jsxs)("div",{children:[(0,s.jsx)(r.Z,{className:"mx-auto mb-4 mt-4",onClick:()=>h(!0),children:"+ Add Pass-Through Endpoint"}),(0,s.jsx)(y.Z,{title:(0,s.jsxs)("div",{className:"flex items-center space-x-3 pb-4 border-b border-gray-100",children:[(0,s.jsx)(w.Z,{className:"text-xl text-blue-500"}),(0,s.jsx)("h2",{className:"text-xl font-semibold text-gray-900",children:"Add Pass-Through Endpoint"})]}),open:u,width:1e3,onCancel:V,footer:null,className:"top-8",styles:{body:{padding:"24px"},header:{padding:"24px 24px 0 24px",border:"none"}},children:(0,s.jsxs)("div",{className:"mt-6",children:[(0,s.jsx)(b.Z,{message:"What is a Pass-Through Endpoint?",description:"Route requests from your LiteLLM proxy to any external API. Perfect for custom models, image generation APIs, or any service you want to proxy through LiteLLM.",type:"info",showIcon:!0,className:"mb-6"}),(0,s.jsxs)(_.Z,{form:m,onFinish:z,layout:"vertical",className:"space-y-6",initialValues:{include_subpath:!0,path:S,target:I},children:[(0,s.jsxs)(f.Z,{className:"p-5",children:[(0,s.jsx)(n.Z,{className:"text-lg font-semibold text-gray-900 mb-2",children:"Route Configuration"}),(0,s.jsx)(j.Z,{className:"text-gray-600 mb-5",children:"Configure how requests to your domain will be forwarded to the target API"}),(0,s.jsxs)("div",{className:"space-y-5",children:[(0,s.jsx)(_.Z.Item,{label:(0,s.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Path Prefix"}),name:"path",rules:[{required:!0,message:"Path is required",pattern:/^\//}],extra:(0,s.jsx)("div",{className:"text-xs text-gray-500 mt-1",children:"Example: /bria, /adobe-photoshop, /elasticsearch"}),className:"mb-4",children:(0,s.jsx)("div",{className:"flex items-center",children:(0,s.jsx)(g.Z,{placeholder:"bria",value:S,onChange:e=>q(e.target.value),className:"flex-1"})})}),(0,s.jsx)(_.Z.Item,{label:(0,s.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Target URL"}),name:"target",rules:[{required:!0,message:"Target URL is required"},{type:"url",message:"Please enter a valid URL"}],extra:(0,s.jsx)("div",{className:"text-xs text-gray-500 mt-1",children:"Example:https://engine.prod.bria-api.com"}),className:"mb-4",children:(0,s.jsx)(g.Z,{placeholder:"https://engine.prod.bria-api.com",value:I,onChange:e=>{P(e.target.value),m.setFieldsValue({target:e.target.value})}})}),(0,s.jsxs)("div",{className:"flex items-center justify-between py-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"text-sm font-medium text-gray-700",children:"Include Subpaths"}),(0,s.jsx)("div",{className:"text-xs text-gray-500 mt-0.5",children:"Forward all subpaths to the target API (recommended for REST APIs)"})]}),(0,s.jsx)(_.Z.Item,{name:"include_subpath",valuePropName:"checked",className:"mb-0",children:(0,s.jsx)(p.Z,{checked:L,onChange:R})})]})]})]}),(0,s.jsx)(M,{pathValue:S,targetValue:I,includeSubpath:L}),(0,s.jsxs)(f.Z,{className:"p-6",children:[(0,s.jsx)(n.Z,{className:"text-lg font-semibold text-gray-900 mb-2",children:"Headers"}),(0,s.jsx)(j.Z,{className:"text-gray-600 mb-6",children:"Add headers that will be sent with every request to the target API"}),(0,s.jsx)(_.Z.Item,{label:(0,s.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Authentication Headers",(0,s.jsx)(c.Z,{title:"Authentication and other headers to forward with requests",children:(0,s.jsx)(k.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"headers",rules:[{required:!0,message:"Please configure the headers"}],extra:(0,s.jsxs)("div",{className:"text-xs text-gray-500 mt-2",children:[(0,s.jsx)("div",{className:"font-medium mb-1",children:"Add authentication tokens and other required headers"}),(0,s.jsx)("div",{children:"Common examples: auth_token, Authorization, x-api-key"})]}),children:(0,s.jsx)(E,{})})]}),(0,s.jsx)(T,{premiumUser:i,authEnabled:O,onAuthChange:e=>{D(e),m.setFieldsValue({auth:e})}}),(0,s.jsxs)(f.Z,{className:"p-6",children:[(0,s.jsx)(n.Z,{className:"text-lg font-semibold text-gray-900 mb-2",children:"Billing"}),(0,s.jsx)(j.Z,{className:"text-gray-600 mb-6",children:"Optional cost tracking for this endpoint"}),(0,s.jsx)(_.Z.Item,{label:(0,s.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Cost Per Request (USD)",(0,s.jsx)(c.Z,{title:"Optional: Track costs for requests to this endpoint",children:(0,s.jsx)(k.Z,{className:"ml-2 text-gray-400 hover:text-gray-600"})})]}),name:"cost_per_request",extra:(0,s.jsx)("div",{className:"text-xs text-gray-500 mt-2",children:"The cost charged for each request through this endpoint"}),children:(0,s.jsx)(N.Z,{min:0,step:.001,precision:4,placeholder:"2.0000",size:"large"})})]}),(0,s.jsxs)("div",{className:"flex items-center justify-end space-x-3 pt-6 border-t border-gray-100",children:[(0,s.jsx)(r.Z,{variant:"secondary",onClick:V,children:"Cancel"}),(0,s.jsx)(r.Z,{variant:"primary",loading:x,onClick:()=>{console.log("Submit button clicked"),m.submit()},children:x?"Creating...":"Add Pass-Through Endpoint"})]})]})]})})]})},D=t(30078),V=t(64482),q=t(20577),z=t(87769),B=t(42208);let K=e=>{let{value:l}=e,[t,r]=(0,a.useState)(!1),o=JSON.stringify(l,null,2);return(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("pre",{className:"font-mono text-xs bg-gray-50 p-2 rounded max-w-md overflow-auto",children:t?o:"••••••••"}),(0,s.jsx)("button",{onClick:()=>r(!t),className:"p-1 hover:bg-gray-100 rounded",type:"button",children:t?(0,s.jsx)(z.Z,{className:"w-4 h-4 text-gray-500"}):(0,s.jsx)(B.Z,{className:"w-4 h-4 text-gray-500"})})]})};var U=e=>{let{endpointData:l,onClose:t,accessToken:r,isAdmin:o,premiumUser:i=!1,onEndpointUpdated:n}=e,[c,m]=(0,a.useState)(l),[u,h]=(0,a.useState)(!1),[x,p]=(0,a.useState)(!1),[g,f]=(0,a.useState)((null==l?void 0:l.auth)||!1),[j]=_.Z.useForm(),v=async e=>{try{if(!r||!(null==c?void 0:c.id))return;let l={};if(e.headers)try{l="string"==typeof e.headers?JSON.parse(e.headers):e.headers}catch(e){F.Z.fromBackend("Invalid JSON format for headers");return}let t={path:c.path,target:e.target,headers:l,include_subpath:e.include_subpath,cost_per_request:e.cost_per_request,auth:i?e.auth:void 0};await (0,d.updatePassThroughEndpoint)(r,c.id,t),m({...c,...t}),p(!1),n&&n()}catch(e){console.error("Error updating endpoint:",e),F.Z.fromBackend("Failed to update pass through endpoint")}},y=async()=>{try{if(!r||!(null==c?void 0:c.id))return;await (0,d.deletePassThroughEndpointsCall)(r,c.id),F.Z.success("Pass through endpoint deleted successfully"),t(),n&&n()}catch(e){console.error("Error deleting endpoint:",e),F.Z.fromBackend("Failed to delete pass through endpoint")}};return u?(0,s.jsx)("div",{className:"p-4",children:"Loading..."}):c?(0,s.jsxs)("div",{className:"p-4",children:[(0,s.jsx)("div",{className:"flex justify-between items-center mb-6",children:(0,s.jsxs)("div",{children:[(0,s.jsx)(Z.ZP,{onClick:t,className:"mb-4",children:"← Back"}),(0,s.jsxs)(D.Dx,{children:["Pass Through Endpoint: ",c.path]}),(0,s.jsx)(D.xv,{className:"text-gray-500 font-mono",children:c.id})]})}),(0,s.jsxs)(D.v0,{children:[(0,s.jsxs)(D.td,{className:"mb-4",children:[(0,s.jsx)(D.OK,{children:"Overview"},"overview"),o?(0,s.jsx)(D.OK,{children:"Settings"},"settings"):(0,s.jsx)(s.Fragment,{})]}),(0,s.jsxs)(D.nP,{children:[(0,s.jsxs)(D.x4,{children:[(0,s.jsxs)(D.rj,{numItems:1,numItemsSm:2,numItemsLg:3,className:"gap-6",children:[(0,s.jsxs)(D.Zb,{children:[(0,s.jsx)(D.xv,{children:"Path"}),(0,s.jsx)("div",{className:"mt-2",children:(0,s.jsx)(D.Dx,{className:"font-mono",children:c.path})})]}),(0,s.jsxs)(D.Zb,{children:[(0,s.jsx)(D.xv,{children:"Target"}),(0,s.jsx)("div",{className:"mt-2",children:(0,s.jsx)(D.Dx,{children:c.target})})]}),(0,s.jsxs)(D.Zb,{children:[(0,s.jsx)(D.xv,{children:"Configuration"}),(0,s.jsxs)("div",{className:"mt-2 space-y-2",children:[(0,s.jsx)("div",{children:(0,s.jsx)(D.Ct,{color:c.include_subpath?"green":"gray",children:c.include_subpath?"Include Subpath":"Exact Path"})}),(0,s.jsx)("div",{children:(0,s.jsx)(D.Ct,{color:c.auth?"blue":"gray",children:c.auth?"Auth Required":"No Auth"})}),void 0!==c.cost_per_request&&(0,s.jsx)("div",{children:(0,s.jsxs)(D.xv,{children:["Cost per request: $",c.cost_per_request]})})]})]})]}),(0,s.jsx)("div",{className:"mt-6",children:(0,s.jsx)(M,{pathValue:c.path,targetValue:c.target,includeSubpath:c.include_subpath||!1})}),c.headers&&Object.keys(c.headers).length>0&&(0,s.jsxs)(D.Zb,{className:"mt-6",children:[(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsx)(D.xv,{className:"font-medium",children:"Headers"}),(0,s.jsxs)(D.Ct,{color:"blue",children:[Object.keys(c.headers).length," headers configured"]})]}),(0,s.jsx)("div",{className:"mt-4",children:(0,s.jsx)(K,{value:c.headers})})]})]}),o&&(0,s.jsx)(D.x4,{children:(0,s.jsxs)(D.Zb,{children:[(0,s.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,s.jsx)(D.Dx,{children:"Pass Through Endpoint Settings"}),(0,s.jsx)("div",{className:"space-x-2",children:!x&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(D.zx,{onClick:()=>p(!0),children:"Edit Settings"}),(0,s.jsx)(D.zx,{onClick:y,variant:"secondary",color:"red",children:"Delete Endpoint"})]})})]}),x?(0,s.jsxs)(_.Z,{form:j,onFinish:v,initialValues:{target:c.target,headers:c.headers?JSON.stringify(c.headers,null,2):"",include_subpath:c.include_subpath||!1,cost_per_request:c.cost_per_request,auth:c.auth||!1},layout:"vertical",children:[(0,s.jsx)(_.Z.Item,{label:"Target URL",name:"target",rules:[{required:!0,message:"Please input a target URL"}],children:(0,s.jsx)(D.oi,{placeholder:"https://api.example.com"})}),(0,s.jsx)(_.Z.Item,{label:"Headers (JSON)",name:"headers",children:(0,s.jsx)(V.default.TextArea,{rows:5,placeholder:'{"Authorization": "Bearer your-token", "Content-Type": "application/json"}'})}),(0,s.jsx)(_.Z.Item,{label:"Include Subpath",name:"include_subpath",valuePropName:"checked",children:(0,s.jsx)(L.Z,{})}),(0,s.jsx)(_.Z.Item,{label:"Cost per Request",name:"cost_per_request",children:(0,s.jsx)(q.Z,{min:0,step:.01,precision:2,placeholder:"0.00",addonBefore:"$"})}),(0,s.jsx)(T,{premiumUser:i,authEnabled:g,onAuthChange:e=>{f(e),j.setFieldsValue({auth:e})}}),(0,s.jsxs)("div",{className:"flex justify-end gap-2 mt-6",children:[(0,s.jsx)(Z.ZP,{onClick:()=>p(!1),children:"Cancel"}),(0,s.jsx)(D.zx,{children:"Save Changes"})]})]}):(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(D.xv,{className:"font-medium",children:"Path"}),(0,s.jsx)("div",{className:"font-mono",children:c.path})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(D.xv,{className:"font-medium",children:"Target URL"}),(0,s.jsx)("div",{children:c.target})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(D.xv,{className:"font-medium",children:"Include Subpath"}),(0,s.jsx)(D.Ct,{color:c.include_subpath?"green":"gray",children:c.include_subpath?"Yes":"No"})]}),void 0!==c.cost_per_request&&(0,s.jsxs)("div",{children:[(0,s.jsx)(D.xv,{className:"font-medium",children:"Cost per Request"}),(0,s.jsxs)("div",{children:["$",c.cost_per_request]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(D.xv,{className:"font-medium",children:"Authentication Required"}),(0,s.jsx)(D.Ct,{color:c.auth?"green":"gray",children:c.auth?"Yes":"No"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(D.xv,{className:"font-medium",children:"Headers"}),c.headers&&Object.keys(c.headers).length>0?(0,s.jsx)("div",{className:"mt-2",children:(0,s.jsx)(K,{value:c.headers})}):(0,s.jsx)("div",{className:"text-gray-500",children:"No headers configured"})]})]})]})})]})]})]}):(0,s.jsx)("div",{className:"p-4",children:"Pass through endpoint not found"})},G=t(12322);let H=e=>{let{value:l}=e,[t,r]=(0,a.useState)(!1),o=JSON.stringify(l);return(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("span",{className:"font-mono text-xs",children:t?o:"••••••••"}),(0,s.jsx)("button",{onClick:()=>r(!t),className:"p-1 hover:bg-gray-100 rounded",type:"button",children:t?(0,s.jsx)(z.Z,{className:"w-4 h-4 text-gray-500"}):(0,s.jsx)(B.Z,{className:"w-4 h-4 text-gray-500"})})]})};var J=e=>{let{accessToken:l,userRole:t,userID:p,modelData:g,premiumUser:f}=e,[j,v]=(0,a.useState)([]),[_,y]=(0,a.useState)(null),[b,N]=(0,a.useState)(!1),[w,k]=(0,a.useState)(null);(0,a.useEffect)(()=>{l&&t&&p&&(0,d.getPassThroughEndpointsCall)(l).then(e=>{v(e.endpoints)})},[l,t,p]);let C=async e=>{k(e),N(!0)},Z=async()=>{if(null!=w&&l){try{await (0,d.deletePassThroughEndpointsCall)(l,w);let e=j.filter(e=>e.id!==w);v(e),F.Z.success("Endpoint deleted successfully.")}catch(e){console.error("Error deleting the endpoint:",e),F.Z.fromBackend("Error deleting the endpoint: "+e)}N(!1),k(null)}},S=(e,l)=>{C(e)},A=[{header:"ID",accessorKey:"id",cell:e=>(0,s.jsx)(c.Z,{title:e.row.original.id,children:(0,s.jsx)("div",{className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left w-full truncate whitespace-nowrap cursor-pointer max-w-[15ch]",onClick:()=>e.row.original.id&&y(e.row.original.id),children:e.row.original.id})})},{header:"Path",accessorKey:"path"},{header:"Target",accessorKey:"target",cell:e=>(0,s.jsx)(i.Z,{children:e.getValue()})},{header:()=>(0,s.jsxs)("div",{className:"flex items-center gap-1",children:[(0,s.jsx)("span",{children:"Authentication"}),(0,s.jsx)(c.Z,{title:"LiteLLM Virtual Key required to call endpoint",children:(0,s.jsx)(u.Z,{className:"w-4 h-4 text-gray-400 cursor-help"})})]}),accessorKey:"auth",cell:e=>(0,s.jsx)(m.Z,{color:e.getValue()?"green":"gray",children:e.getValue()?"Yes":"No"})},{header:"Headers",accessorKey:"headers",cell:e=>(0,s.jsx)(H,{value:e.getValue()||{}})},{header:"Actions",id:"actions",cell:e=>{let{row:l}=e;return(0,s.jsxs)("div",{className:"flex space-x-1",children:[(0,s.jsx)(o.Z,{icon:h.Z,size:"sm",onClick:()=>l.original.id&&y(l.original.id),title:"Edit"}),(0,s.jsx)(o.Z,{icon:x.Z,size:"sm",onClick:()=>S(l.original.id,l.index),title:"Delete"})]})}}];if(!l)return null;if(_){console.log("selectedEndpointId",_),console.log("generalSettings",j);let e=j.find(e=>e.id===_);return e?(0,s.jsx)(U,{endpointData:e,onClose:()=>y(null),accessToken:l,isAdmin:"Admin"===t||"admin"===t,premiumUser:f,onEndpointUpdated:()=>{l&&(0,d.getPassThroughEndpointsCall)(l).then(e=>{v(e.endpoints)})}}):(0,s.jsx)("div",{children:"Endpoint not found"})}return(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{children:"Pass Through Endpoints"}),(0,s.jsx)(i.Z,{className:"text-tremor-content",children:"Configure and manage your pass-through endpoints"})]}),(0,s.jsx)(O,{accessToken:l,setPassThroughItems:v,passThroughItems:j,premiumUser:f}),(0,s.jsx)(G.w,{data:j,columns:A,renderSubComponent:()=>(0,s.jsx)("div",{}),getRowCanExpand:()=>!1,isLoading:!1,noDataMessage:"No pass-through endpoints configured"}),b&&(0,s.jsx)("div",{className:"fixed z-10 inset-0 overflow-y-auto",children:(0,s.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,s.jsx)("div",{className:"fixed inset-0 transition-opacity","aria-hidden":"true",children:(0,s.jsx)("div",{className:"absolute inset-0 bg-gray-500 opacity-75"})}),(0,s.jsx)("span",{className:"hidden sm:inline-block sm:align-middle sm:h-screen","aria-hidden":"true",children:""}),(0,s.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,s.jsx)("div",{className:"bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4",children:(0,s.jsx)("div",{className:"sm:flex sm:items-start",children:(0,s.jsxs)("div",{className:"mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left",children:[(0,s.jsx)("h3",{className:"text-lg leading-6 font-medium text-gray-900",children:"Delete Pass-Through Endpoint"}),(0,s.jsx)("div",{className:"mt-2",children:(0,s.jsx)("p",{className:"text-sm text-gray-500",children:"Are you sure you want to delete this pass-through endpoint? This action cannot be undone."})})]})})}),(0,s.jsxs)("div",{className:"bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse",children:[(0,s.jsx)(r.Z,{onClick:Z,color:"red",className:"ml-2",children:"Delete"}),(0,s.jsx)(r.Z,{onClick:()=>{N(!1),k(null)},children:"Cancel"})]})]})]})})]})}},39789:function(e,l,t){t.d(l,{Z:function(){return i}});var s=t(57437),a=t(2265),r=t(21487),o=t(84264),i=e=>{let{value:l,onValueChange:t,label:i="Select Time Range",className:n="",showTimeRange:d=!0}=e,[c,m]=(0,a.useState)(!1),u=(0,a.useRef)(null),h=(0,a.useCallback)(e=>{m(!0),setTimeout(()=>m(!1),1500),t(e),requestIdleCallback(()=>{if(e.from){let l;let s={...e},a=new Date(e.from);l=new Date(e.to?e.to:e.from),a.toDateString(),l.toDateString(),a.setHours(0,0,0,0),l.setHours(23,59,59,999),s.from=a,s.to=l,t(s)}},{timeout:100})},[t]),x=(0,a.useCallback)((e,l)=>{if(!e||!l)return"";let t=e=>e.toLocaleString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!0,timeZoneName:"short"});if(e.toDateString()!==l.toDateString())return"".concat(t(e)," - ").concat(t(l));{let t=e.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),s=e.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!0}),a=l.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!0,timeZoneName:"short"});return"".concat(t,": ").concat(s," - ").concat(a)}},[]);return(0,s.jsxs)("div",{className:n,children:[i&&(0,s.jsx)(o.Z,{className:"mb-2",children:i}),(0,s.jsxs)("div",{className:"relative w-fit",children:[(0,s.jsx)("div",{ref:u,children:(0,s.jsx)(r.Z,{enableSelect:!0,value:l,onValueChange:h,placeholder:"Select date range",enableClear:!1,style:{zIndex:100}})}),c&&(0,s.jsx)("div",{className:"absolute top-1/2 animate-pulse",style:{left:"calc(100% + 8px)",transform:"translateY(-50%)",zIndex:110},children:(0,s.jsxs)("div",{className:"flex items-center gap-1 text-green-600 text-sm font-medium bg-white px-2 py-1 rounded-full border border-green-200 shadow-sm whitespace-nowrap",children:[(0,s.jsx)("div",{className:"w-3 h-3 bg-green-500 text-white rounded-full flex items-center justify-center text-xs",children:"✓"}),(0,s.jsx)("span",{className:"text-xs",children:"Selected"})]})})]}),d&&l.from&&l.to&&(0,s.jsx)(o.Z,{className:"mt-2 text-xs text-gray-500",children:x(l.from,l.to)})]})}},12322:function(e,l,t){t.d(l,{w:function(){return n}});var s=t(57437),a=t(2265),r=t(71594),o=t(24525),i=t(19130);function n(e){let{data:l=[],columns:t,getRowCanExpand:n,renderSubComponent:d,isLoading:c=!1,loadingMessage:m="\uD83D\uDE85 Loading logs...",noDataMessage:u="No logs found"}=e,h=(0,r.b7)({data:l,columns:t,getRowCanExpand:n,getRowId:(e,l)=>{var t;return null!==(t=null==e?void 0:e.request_id)&&void 0!==t?t:String(l)},getCoreRowModel:(0,o.sC)(),getExpandedRowModel:(0,o.rV)()});return(0,s.jsx)("div",{className:"rounded-lg custom-border overflow-x-auto w-full max-w-full box-border",children:(0,s.jsxs)(i.iA,{className:"[&_td]:py-0.5 [&_th]:py-1 table-fixed w-full box-border",style:{minWidth:"400px"},children:[(0,s.jsx)(i.ss,{children:h.getHeaderGroups().map(e=>(0,s.jsx)(i.SC,{children:e.headers.map(e=>(0,s.jsx)(i.xs,{className:"py-1 h-8",children:e.isPlaceholder?null:(0,r.ie)(e.column.columnDef.header,e.getContext())},e.id))},e.id))}),(0,s.jsx)(i.RM,{children:c?(0,s.jsx)(i.SC,{children:(0,s.jsx)(i.pj,{colSpan:t.length,className:"h-8 text-center",children:(0,s.jsx)("div",{className:"text-center text-gray-500",children:(0,s.jsx)("p",{children:m})})})}):h.getRowModel().rows.length>0?h.getRowModel().rows.map(e=>(0,s.jsxs)(a.Fragment,{children:[(0,s.jsx)(i.SC,{className:"h-8",children:e.getVisibleCells().map(e=>(0,s.jsx)(i.pj,{className:"py-0.5 max-h-8 overflow-hidden text-ellipsis whitespace-nowrap",children:(0,r.ie)(e.column.columnDef.cell,e.getContext())},e.id))}),e.getIsExpanded()&&(0,s.jsx)(i.SC,{children:(0,s.jsx)(i.pj,{colSpan:e.getVisibleCells().length,className:"p-0",children:(0,s.jsx)("div",{className:"w-full max-w-full overflow-hidden box-border",children:d({row:e})})})})]},e.id)):(0,s.jsx)(i.SC,{children:(0,s.jsx)(i.pj,{colSpan:t.length,className:"h-8 text-center",children:(0,s.jsx)("div",{className:"text-center text-gray-500",children:(0,s.jsx)("p",{children:u})})})})})]})})}}}]);
\ No newline at end of file
diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/7906-11071e9e2e7b8318.js b/litellm/proxy/_experimental/out/_next/static/chunks/7906-11071e9e2e7b8318.js
new file mode 100644
index 00000000000..72fe3384366
--- /dev/null
+++ b/litellm/proxy/_experimental/out/_next/static/chunks/7906-11071e9e2e7b8318.js
@@ -0,0 +1 @@
+(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7906],{26035:function(e){"use strict";e.exports=function(e,n){for(var a,r,i,o=e||"",s=n||"div",l={},c=0;c4&&m.slice(0,4)===o&&s.test(t)&&("-"===t.charAt(4)?b=o+(n=t.slice(5).replace(l,u)).charAt(0).toUpperCase()+n.slice(1):(g=(p=t).slice(4),t=l.test(g)?p:("-"!==(g=g.replace(c,d)).charAt(0)&&(g="-"+g),o+g)),f=r),new f(b,t))};var s=/^data[-\w.:]+$/i,l=/-[a-z]/g,c=/[A-Z]/g;function d(e){return"-"+e.toLowerCase()}function u(e){return e.charAt(1).toUpperCase()}},30466:function(e,t,n){"use strict";var a=n(82855),r=n(64541),i=n(80808),o=n(44987),s=n(72731),l=n(98946);e.exports=a([i,r,o,s,l])},72731:function(e,t,n){"use strict";var a=n(20321),r=n(41757),i=a.booleanish,o=a.number,s=a.spaceSeparated;e.exports=r({transform:function(e,t){return"role"===t?t:"aria-"+t.slice(4).toLowerCase()},properties:{ariaActiveDescendant:null,ariaAtomic:i,ariaAutoComplete:null,ariaBusy:i,ariaChecked:i,ariaColCount:o,ariaColIndex:o,ariaColSpan:o,ariaControls:s,ariaCurrent:null,ariaDescribedBy:s,ariaDetails:null,ariaDisabled:i,ariaDropEffect:s,ariaErrorMessage:null,ariaExpanded:i,ariaFlowTo:s,ariaGrabbed:i,ariaHasPopup:null,ariaHidden:i,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:s,ariaLevel:o,ariaLive:null,ariaModal:i,ariaMultiLine:i,ariaMultiSelectable:i,ariaOrientation:null,ariaOwns:s,ariaPlaceholder:null,ariaPosInSet:o,ariaPressed:i,ariaReadOnly:i,ariaRelevant:null,ariaRequired:i,ariaRoleDescription:s,ariaRowCount:o,ariaRowIndex:o,ariaRowSpan:o,ariaSelected:i,ariaSetSize:o,ariaSort:null,ariaValueMax:o,ariaValueMin:o,ariaValueNow:o,ariaValueText:null,role:null}})},98946:function(e,t,n){"use strict";var a=n(20321),r=n(41757),i=n(53296),o=a.boolean,s=a.overloadedBoolean,l=a.booleanish,c=a.number,d=a.spaceSeparated,u=a.commaSeparated;e.exports=r({space:"html",attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},transform:i,mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:u,acceptCharset:d,accessKey:d,action:null,allow:null,allowFullScreen:o,allowPaymentRequest:o,allowUserMedia:o,alt:null,as:null,async:o,autoCapitalize:null,autoComplete:d,autoFocus:o,autoPlay:o,capture:o,charSet:null,checked:o,cite:null,className:d,cols:c,colSpan:null,content:null,contentEditable:l,controls:o,controlsList:d,coords:c|u,crossOrigin:null,data:null,dateTime:null,decoding:null,default:o,defer:o,dir:null,dirName:null,disabled:o,download:s,draggable:l,encType:null,enterKeyHint:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:o,formTarget:null,headers:d,height:c,hidden:o,high:c,href:null,hrefLang:null,htmlFor:d,httpEquiv:d,id:null,imageSizes:null,imageSrcSet:u,inputMode:null,integrity:null,is:null,isMap:o,itemId:null,itemProp:d,itemRef:d,itemScope:o,itemType:d,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:o,low:c,manifest:null,max:null,maxLength:c,media:null,method:null,min:null,minLength:c,multiple:o,muted:o,name:null,nonce:null,noModule:o,noValidate:o,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforePrint:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextMenu:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:o,optimum:c,pattern:null,ping:d,placeholder:null,playsInline:o,poster:null,preload:null,readOnly:o,referrerPolicy:null,rel:d,required:o,reversed:o,rows:c,rowSpan:c,sandbox:d,scope:null,scoped:o,seamless:o,selected:o,shape:null,size:c,sizes:null,slot:null,span:c,spellCheck:l,src:null,srcDoc:null,srcLang:null,srcSet:u,start:c,step:null,style:null,tabIndex:c,target:null,title:null,translate:null,type:null,typeMustMatch:o,useMap:null,value:l,width:c,wrap:null,align:null,aLink:null,archive:d,axis:null,background:null,bgColor:null,border:c,borderColor:null,bottomMargin:c,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:o,declare:o,event:null,face:null,frame:null,frameBorder:null,hSpace:c,leftMargin:c,link:null,longDesc:null,lowSrc:null,marginHeight:c,marginWidth:c,noResize:o,noHref:o,noShade:o,noWrap:o,object:null,profile:null,prompt:null,rev:null,rightMargin:c,rules:null,scheme:null,scrolling:l,standby:null,summary:null,text:null,topMargin:c,valueType:null,version:null,vAlign:null,vLink:null,vSpace:c,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:o,disableRemotePlayback:o,prefix:null,property:null,results:c,security:null,unselectable:null}})},53296:function(e,t,n){"use strict";var a=n(38781);e.exports=function(e,t){return a(e,t.toLowerCase())}},38781:function(e){"use strict";e.exports=function(e,t){return t in e?e[t]:t}},41757:function(e,t,n){"use strict";var a=n(96532),r=n(61723),i=n(51351);e.exports=function(e){var t,n,o=e.space,s=e.mustUseProperty||[],l=e.attributes||{},c=e.properties,d=e.transform,u={},p={};for(t in c)n=new i(t,d(l,t),c[t],o),-1!==s.indexOf(t)&&(n.mustUseProperty=!0),u[t]=n,p[a(t)]=t,p[a(n.attribute)]=t;return new r(u,p,o)}},51351:function(e,t,n){"use strict";var a=n(24192),r=n(20321);e.exports=s,s.prototype=new a,s.prototype.defined=!0;var i=["boolean","booleanish","overloadedBoolean","number","commaSeparated","spaceSeparated","commaOrSpaceSeparated"],o=i.length;function s(e,t,n,s){var l,c,d,u=-1;for(s&&(this.space=s),a.call(this,e,t);++u=d.reach));A+=T.value.length,T=T.next){var _,R=T.value;if(n.length>t.length)return;if(!(R instanceof i)){var I=1;if(E){if(!(_=o(y,A,t,f))||_.index>=t.length)break;var N=_.index,w=_.index+_[0].length,k=A;for(k+=T.value.length;N>=k;)k+=(T=T.next).value.length;if(k-=T.value.length,A=k,T.value instanceof i)continue;for(var v=T;v!==n.tail&&(kd.reach&&(d.reach=x);var D=T.prev;if(O&&(D=l(n,D,O),A+=O.length),function(e,t,n){for(var a=t.next,r=0;r1){var P={cause:u+","+g,reach:x};e(t,n,a,T.prev,A,P),d&&P.reach>d.reach&&(d.reach=P.reach)}}}}}}(e,c,t,c.head,0),function(e){for(var t=[],n=e.head.next;n!==e.tail;)t.push(n.value),n=n.next;return t}(c)},hooks:{all:{},add:function(e,t){var n=r.hooks.all;n[e]=n[e]||[],n[e].push(t)},run:function(e,t){var n=r.hooks.all[e];if(n&&n.length)for(var a,i=0;a=n[i++];)a(t)}},Token:i};function i(e,t,n,a){this.type=e,this.content=t,this.alias=n,this.length=0|(a||"").length}function o(e,t,n,a){e.lastIndex=t;var r=e.exec(n);if(r&&a&&r[1]){var i=r[1].length;r.index+=i,r[0]=r[0].slice(i)}return r}function s(){var e={value:null,prev:null,next:null},t={value:null,prev:e,next:null};e.next=t,this.head=e,this.tail=t,this.length=0}function l(e,t,n){var a=t.next,r={value:n,prev:t,next:a};return t.next=r,a.prev=r,e.length++,r}if(e.Prism=r,i.stringify=function e(t,n){if("string"==typeof t)return t;if(Array.isArray(t)){var a="";return t.forEach(function(t){a+=e(t,n)}),a}var i={type:t.type,content:e(t.content,n),tag:"span",classes:["token",t.type],attributes:{},language:n},o=t.alias;o&&(Array.isArray(o)?Array.prototype.push.apply(i.classes,o):i.classes.push(o)),r.hooks.run("wrap",i);var s="";for(var l in i.attributes)s+=" "+l+'="'+(i.attributes[l]||"").replace(/"/g,""")+'"';return"<"+i.tag+' class="'+i.classes.join(" ")+'"'+s+">"+i.content+""+i.tag+">"},!e.document)return e.addEventListener&&(r.disableWorkerMessageHandler||e.addEventListener("message",function(t){var n=JSON.parse(t.data),a=n.language,i=n.code,o=n.immediateClose;e.postMessage(r.highlight(i,r.languages[a],a)),o&&e.close()},!1)),r;var c=r.util.currentScript();function d(){r.manual||r.highlightAll()}if(c&&(r.filename=c.src,c.hasAttribute("data-manual")&&(r.manual=!0)),!r.manual){var u=document.readyState;"loading"===u||"interactive"===u&&c&&c.defer?document.addEventListener("DOMContentLoaded",d):window.requestAnimationFrame?window.requestAnimationFrame(d):window.setTimeout(d,16)}return r}("undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{});e.exports&&(e.exports=a),void 0!==n.g&&(n.g.Prism=a)},17906:function(e,t,n){"use strict";n.d(t,{Z:function(){return I}});var a,r,i=n(6989),o=n(83145),s=n(11993),l=n(2265),c=n(1119);function d(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,a)}return n}function u(e){for(var t=1;t1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;return(function(e){if(0===e.length||1===e.length)return e;var t,n=e.join(".");return p[n]||(p[n]=0===(t=e.length)||1===t?e:2===t?[e[0],e[1],"".concat(e[0],".").concat(e[1]),"".concat(e[1],".").concat(e[0])]:3===t?[e[0],e[1],e[2],"".concat(e[0],".").concat(e[1]),"".concat(e[0],".").concat(e[2]),"".concat(e[1],".").concat(e[0]),"".concat(e[1],".").concat(e[2]),"".concat(e[2],".").concat(e[0]),"".concat(e[2],".").concat(e[1]),"".concat(e[0],".").concat(e[1],".").concat(e[2]),"".concat(e[0],".").concat(e[2],".").concat(e[1]),"".concat(e[1],".").concat(e[0],".").concat(e[2]),"".concat(e[1],".").concat(e[2],".").concat(e[0]),"".concat(e[2],".").concat(e[0],".").concat(e[1]),"".concat(e[2],".").concat(e[1],".").concat(e[0])]:t>=4?[e[0],e[1],e[2],e[3],"".concat(e[0],".").concat(e[1]),"".concat(e[0],".").concat(e[2]),"".concat(e[0],".").concat(e[3]),"".concat(e[1],".").concat(e[0]),"".concat(e[1],".").concat(e[2]),"".concat(e[1],".").concat(e[3]),"".concat(e[2],".").concat(e[0]),"".concat(e[2],".").concat(e[1]),"".concat(e[2],".").concat(e[3]),"".concat(e[3],".").concat(e[0]),"".concat(e[3],".").concat(e[1]),"".concat(e[3],".").concat(e[2]),"".concat(e[0],".").concat(e[1],".").concat(e[2]),"".concat(e[0],".").concat(e[1],".").concat(e[3]),"".concat(e[0],".").concat(e[2],".").concat(e[1]),"".concat(e[0],".").concat(e[2],".").concat(e[3]),"".concat(e[0],".").concat(e[3],".").concat(e[1]),"".concat(e[0],".").concat(e[3],".").concat(e[2]),"".concat(e[1],".").concat(e[0],".").concat(e[2]),"".concat(e[1],".").concat(e[0],".").concat(e[3]),"".concat(e[1],".").concat(e[2],".").concat(e[0]),"".concat(e[1],".").concat(e[2],".").concat(e[3]),"".concat(e[1],".").concat(e[3],".").concat(e[0]),"".concat(e[1],".").concat(e[3],".").concat(e[2]),"".concat(e[2],".").concat(e[0],".").concat(e[1]),"".concat(e[2],".").concat(e[0],".").concat(e[3]),"".concat(e[2],".").concat(e[1],".").concat(e[0]),"".concat(e[2],".").concat(e[1],".").concat(e[3]),"".concat(e[2],".").concat(e[3],".").concat(e[0]),"".concat(e[2],".").concat(e[3],".").concat(e[1]),"".concat(e[3],".").concat(e[0],".").concat(e[1]),"".concat(e[3],".").concat(e[0],".").concat(e[2]),"".concat(e[3],".").concat(e[1],".").concat(e[0]),"".concat(e[3],".").concat(e[1],".").concat(e[2]),"".concat(e[3],".").concat(e[2],".").concat(e[0]),"".concat(e[3],".").concat(e[2],".").concat(e[1]),"".concat(e[0],".").concat(e[1],".").concat(e[2],".").concat(e[3]),"".concat(e[0],".").concat(e[1],".").concat(e[3],".").concat(e[2]),"".concat(e[0],".").concat(e[2],".").concat(e[1],".").concat(e[3]),"".concat(e[0],".").concat(e[2],".").concat(e[3],".").concat(e[1]),"".concat(e[0],".").concat(e[3],".").concat(e[1],".").concat(e[2]),"".concat(e[0],".").concat(e[3],".").concat(e[2],".").concat(e[1]),"".concat(e[1],".").concat(e[0],".").concat(e[2],".").concat(e[3]),"".concat(e[1],".").concat(e[0],".").concat(e[3],".").concat(e[2]),"".concat(e[1],".").concat(e[2],".").concat(e[0],".").concat(e[3]),"".concat(e[1],".").concat(e[2],".").concat(e[3],".").concat(e[0]),"".concat(e[1],".").concat(e[3],".").concat(e[0],".").concat(e[2]),"".concat(e[1],".").concat(e[3],".").concat(e[2],".").concat(e[0]),"".concat(e[2],".").concat(e[0],".").concat(e[1],".").concat(e[3]),"".concat(e[2],".").concat(e[0],".").concat(e[3],".").concat(e[1]),"".concat(e[2],".").concat(e[1],".").concat(e[0],".").concat(e[3]),"".concat(e[2],".").concat(e[1],".").concat(e[3],".").concat(e[0]),"".concat(e[2],".").concat(e[3],".").concat(e[0],".").concat(e[1]),"".concat(e[2],".").concat(e[3],".").concat(e[1],".").concat(e[0]),"".concat(e[3],".").concat(e[0],".").concat(e[1],".").concat(e[2]),"".concat(e[3],".").concat(e[0],".").concat(e[2],".").concat(e[1]),"".concat(e[3],".").concat(e[1],".").concat(e[0],".").concat(e[2]),"".concat(e[3],".").concat(e[1],".").concat(e[2],".").concat(e[0]),"".concat(e[3],".").concat(e[2],".").concat(e[0],".").concat(e[1]),"".concat(e[3],".").concat(e[2],".").concat(e[1],".").concat(e[0])]:void 0),p[n]})(e.filter(function(e){return"token"!==e})).reduce(function(e,t){return u(u({},e),n[t])},t)}(s.className,Object.assign({},s.style,void 0===r?{}:r),a)})}else f=u(u({},s),{},{className:s.className.join(" ")});var T=E(n.children);return l.createElement(g,(0,c.Z)({key:o},f),T)}}({node:e,stylesheet:n,useInlineStyles:a,key:"code-segement".concat(t)})})}function A(e){return e&&void 0!==e.highlightAuto}var _=n(99113),R=(a=n.n(_)(),r={'code[class*="language-"]':{color:"black",background:"none",textShadow:"0 1px white",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"},'pre[class*="language-"]':{color:"black",background:"#f5f2f0",textShadow:"0 1px white",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",padding:"1em",margin:".5em 0",overflow:"auto"},'pre[class*="language-"]::-moz-selection':{textShadow:"none",background:"#b3d4fc"},'pre[class*="language-"] ::-moz-selection':{textShadow:"none",background:"#b3d4fc"},'code[class*="language-"]::-moz-selection':{textShadow:"none",background:"#b3d4fc"},'code[class*="language-"] ::-moz-selection':{textShadow:"none",background:"#b3d4fc"},'pre[class*="language-"]::selection':{textShadow:"none",background:"#b3d4fc"},'pre[class*="language-"] ::selection':{textShadow:"none",background:"#b3d4fc"},'code[class*="language-"]::selection':{textShadow:"none",background:"#b3d4fc"},'code[class*="language-"] ::selection':{textShadow:"none",background:"#b3d4fc"},':not(pre) > code[class*="language-"]':{background:"#f5f2f0",padding:".1em",borderRadius:".3em",whiteSpace:"normal"},comment:{color:"slategray"},prolog:{color:"slategray"},doctype:{color:"slategray"},cdata:{color:"slategray"},punctuation:{color:"#999"},namespace:{Opacity:".7"},property:{color:"#905"},tag:{color:"#905"},boolean:{color:"#905"},number:{color:"#905"},constant:{color:"#905"},symbol:{color:"#905"},deleted:{color:"#905"},selector:{color:"#690"},"attr-name":{color:"#690"},string:{color:"#690"},char:{color:"#690"},builtin:{color:"#690"},inserted:{color:"#690"},operator:{color:"#9a6e3a",background:"hsla(0, 0%, 100%, .5)"},entity:{color:"#9a6e3a",background:"hsla(0, 0%, 100%, .5)",cursor:"help"},url:{color:"#9a6e3a",background:"hsla(0, 0%, 100%, .5)"},".language-css .token.string":{color:"#9a6e3a",background:"hsla(0, 0%, 100%, .5)"},".style .token.string":{color:"#9a6e3a",background:"hsla(0, 0%, 100%, .5)"},atrule:{color:"#07a"},"attr-value":{color:"#07a"},keyword:{color:"#07a"},function:{color:"#DD4A68"},"class-name":{color:"#DD4A68"},regex:{color:"#e90"},important:{color:"#e90",fontWeight:"bold"},variable:{color:"#e90"},bold:{fontWeight:"bold"},italic:{fontStyle:"italic"}},function(e){var t=e.language,n=e.children,s=e.style,c=void 0===s?r:s,d=e.customStyle,u=void 0===d?{}:d,p=e.codeTagProps,m=void 0===p?{className:t?"language-".concat(t):void 0,style:b(b({},c['code[class*="language-"]']),c['code[class*="language-'.concat(t,'"]')])}:p,_=e.useInlineStyles,R=void 0===_||_,I=e.showLineNumbers,N=void 0!==I&&I,w=e.showInlineLineNumbers,k=void 0===w||w,v=e.startingLineNumber,C=void 0===v?1:v,O=e.lineNumberContainerStyle,L=e.lineNumberStyle,x=void 0===L?{}:L,D=e.wrapLines,P=e.wrapLongLines,M=void 0!==P&&P,F=e.lineProps,U=e.renderer,B=e.PreTag,G=void 0===B?"pre":B,$=e.CodeTag,H=void 0===$?"code":$,z=e.code,V=void 0===z?(Array.isArray(n)?n[0]:n)||"":z,j=e.astGenerator,W=(0,i.Z)(e,g);j=j||a;var q=N?l.createElement(E,{containerStyle:O,codeStyle:m.style||{},numberStyle:x,startingLineNumber:C,codeString:V}):null,Y=c.hljs||c['pre[class*="language-"]']||{backgroundColor:"#fff"},K=A(j)?"hljs":"prismjs",Z=R?Object.assign({},W,{style:Object.assign({},Y,u)}):Object.assign({},W,{className:W.className?"".concat(K," ").concat(W.className):K,style:Object.assign({},u)});if(M?m.style=b({whiteSpace:"pre-wrap"},m.style):m.style=b({whiteSpace:"pre"},m.style),!j)return l.createElement(G,Z,q,l.createElement(H,m,V));(void 0===D&&U||M)&&(D=!0),U=U||T;var X=[{type:"text",value:V}],Q=function(e){var t=e.astGenerator,n=e.language,a=e.code,r=e.defaultCodeValue;if(A(t)){var i=-1!==t.listLanguages().indexOf(n);return"text"===n?{value:r,language:"text"}:i?t.highlight(n,a):t.highlightAuto(a)}try{return n&&"text"!==n?{value:t.highlight(a,n)}:{value:r}}catch(e){return{value:r}}}({astGenerator:j,language:t,code:V,defaultCodeValue:X});null===Q.language&&(Q.value=X);var J=Q.value.length;1===J&&"text"===Q.value[0].type&&(J=Q.value[0].value.split("\n").length);var ee=J+C,et=function(e,t,n,a,r,i,s,l,c){var d,u=function e(t){for(var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=0;r2&&void 0!==arguments[2]?arguments[2]:[];return t||o.length>0?function(e,i){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return y({children:e,lineNumber:i,lineNumberStyle:l,largestLineNumber:s,showInlineLineNumbers:r,lineProps:n,className:o,showLineNumbers:a,wrapLongLines:c,wrapLines:t})}(e,i,o):function(e,t){if(a&&t&&r){var n=S(l,t,s);e.unshift(h(t,n))}return e}(e,i)}for(;m]?|>=?|\?=|[-+\/=])(?=\s)/,lookbehind:!0},"string-operator":{pattern:/(\s)&&?(?=\s)/,lookbehind:!0,alias:"keyword"},"token-operator":[{pattern:/(\w)(?:->?|=>|[~|{}])(?=\w)/,lookbehind:!0,alias:"punctuation"},{pattern:/[|{}]/,alias:"punctuation"}],punctuation:/[,.:()]/}}e.exports=t,t.displayName="abap",t.aliases=[]},36463:function(e){"use strict";function t(e){var t;t="(?:ALPHA|BIT|CHAR|CR|CRLF|CTL|DIGIT|DQUOTE|HEXDIG|HTAB|LF|LWSP|OCTET|SP|VCHAR|WSP)",e.languages.abnf={comment:/;.*/,string:{pattern:/(?:%[is])?"[^"\n\r]*"/,greedy:!0,inside:{punctuation:/^%[is]/}},range:{pattern:/%(?:b[01]+-[01]+|d\d+-\d+|x[A-F\d]+-[A-F\d]+)/i,alias:"number"},terminal:{pattern:/%(?:b[01]+(?:\.[01]+)*|d\d+(?:\.\d+)*|x[A-F\d]+(?:\.[A-F\d]+)*)/i,alias:"number"},repetition:{pattern:/(^|[^\w-])(?:\d*\*\d*|\d+)/,lookbehind:!0,alias:"operator"},definition:{pattern:/(^[ \t]*)(?:[a-z][\w-]*|<[^<>\r\n]*>)(?=\s*=)/m,lookbehind:!0,alias:"keyword",inside:{punctuation:/<|>/}},"core-rule":{pattern:RegExp("(?:(^|[^<\\w-])"+t+"|<"+t+">)(?![\\w-])","i"),lookbehind:!0,alias:["rule","constant"],inside:{punctuation:/<|>/}},rule:{pattern:/(^|[^<\w-])[a-z][\w-]*|<[^<>\r\n]*>/i,lookbehind:!0,inside:{punctuation:/<|>/}},operator:/=\/?|\//,punctuation:/[()\[\]]/}}e.exports=t,t.displayName="abnf",t.aliases=[]},25276:function(e){"use strict";function t(e){e.languages.actionscript=e.languages.extend("javascript",{keyword:/\b(?:as|break|case|catch|class|const|default|delete|do|dynamic|each|else|extends|final|finally|for|function|get|if|implements|import|in|include|instanceof|interface|internal|is|namespace|native|new|null|override|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|use|var|void|while|with)\b/,operator:/\+\+|--|(?:[+\-*\/%^]|&&?|\|\|?|<|>>?>?|[!=]=?)=?|[~?@]/}),e.languages.actionscript["class-name"].alias="function",delete e.languages.actionscript.parameter,delete e.languages.actionscript["literal-property"],e.languages.markup&&e.languages.insertBefore("actionscript","string",{xml:{pattern:/(^|[^.])<\/?\w+(?:\s+[^\s>\/=]+=("|')(?:\\[\s\S]|(?!\2)[^\\])*\2)*\s*\/?>/,lookbehind:!0,inside:e.languages.markup}})}e.exports=t,t.displayName="actionscript",t.aliases=[]},82679:function(e){"use strict";function t(e){e.languages.ada={comment:/--.*/,string:/"(?:""|[^"\r\f\n])*"/,number:[{pattern:/\b\d(?:_?\d)*#[\dA-F](?:_?[\dA-F])*(?:\.[\dA-F](?:_?[\dA-F])*)?#(?:E[+-]?\d(?:_?\d)*)?/i},{pattern:/\b\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:E[+-]?\d(?:_?\d)*)?\b/i}],"attr-name":/\b'\w+/,keyword:/\b(?:abort|abs|abstract|accept|access|aliased|all|and|array|at|begin|body|case|constant|declare|delay|delta|digits|do|else|elsif|end|entry|exception|exit|for|function|generic|goto|if|in|interface|is|limited|loop|mod|new|not|null|of|others|out|overriding|package|pragma|private|procedure|protected|raise|range|record|rem|renames|requeue|return|reverse|select|separate|some|subtype|synchronized|tagged|task|terminate|then|type|until|use|when|while|with|xor)\b/i,boolean:/\b(?:false|true)\b/i,operator:/<[=>]?|>=?|=>?|:=|\/=?|\*\*?|[&+-]/,punctuation:/\.\.?|[,;():]/,char:/'.'/,variable:/\b[a-z](?:\w)*\b/i}}e.exports=t,t.displayName="ada",t.aliases=[]},80943:function(e){"use strict";function t(e){e.languages.agda={comment:/\{-[\s\S]*?(?:-\}|$)|--.*/,string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^\\\r\n"])*"/,greedy:!0},punctuation:/[(){}⦃⦄.;@]/,"class-name":{pattern:/((?:data|record) +)\S+/,lookbehind:!0},function:{pattern:/(^[ \t]*)(?!\s)[^:\r\n]+(?=:)/m,lookbehind:!0},operator:{pattern:/(^\s*|\s)(?:[=|:∀→λ\\?_]|->)(?=\s)/,lookbehind:!0},keyword:/\b(?:Set|abstract|constructor|data|eta-equality|field|forall|hiding|import|in|inductive|infix|infixl|infixr|instance|let|macro|module|mutual|no-eta-equality|open|overlap|pattern|postulate|primitive|private|public|quote|quoteContext|quoteGoal|quoteTerm|record|renaming|rewrite|syntax|tactic|unquote|unquoteDecl|unquoteDef|using|variable|where|with)\b/}}e.exports=t,t.displayName="agda",t.aliases=[]},34168:function(e){"use strict";function t(e){e.languages.al={comment:/\/\/.*|\/\*[\s\S]*?\*\//,string:{pattern:/'(?:''|[^'\r\n])*'(?!')|"(?:""|[^"\r\n])*"(?!")/,greedy:!0},function:{pattern:/(\b(?:event|procedure|trigger)\s+|(?:^|[^.])\.\s*)[a-z_]\w*(?=\s*\()/i,lookbehind:!0},keyword:[/\b(?:array|asserterror|begin|break|case|do|downto|else|end|event|exit|for|foreach|function|if|implements|in|indataset|interface|internal|local|of|procedure|program|protected|repeat|runonclient|securityfiltering|suppressdispose|temporary|then|to|trigger|until|var|while|with|withevents)\b/i,/\b(?:action|actions|addafter|addbefore|addfirst|addlast|area|assembly|chartpart|codeunit|column|controladdin|cuegroup|customizes|dataitem|dataset|dotnet|elements|enum|enumextension|extends|field|fieldattribute|fieldelement|fieldgroup|fieldgroups|fields|filter|fixed|grid|group|key|keys|label|labels|layout|modify|moveafter|movebefore|movefirst|movelast|page|pagecustomization|pageextension|part|profile|query|repeater|report|requestpage|schema|separator|systempart|table|tableelement|tableextension|textattribute|textelement|type|usercontrol|value|xmlport)\b/i],number:/\b(?:0x[\da-f]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?)(?:F|LL?|U(?:LL?)?)?\b/i,boolean:/\b(?:false|true)\b/i,variable:/\b(?:Curr(?:FieldNo|Page|Report)|x?Rec|RequestOptionsPage)\b/,"class-name":/\b(?:automation|biginteger|bigtext|blob|boolean|byte|char|clienttype|code|completiontriggererrorlevel|connectiontype|database|dataclassification|datascope|date|dateformula|datetime|decimal|defaultlayout|dialog|dictionary|dotnetassembly|dotnettypedeclaration|duration|errorinfo|errortype|executioncontext|executionmode|fieldclass|fieldref|fieldtype|file|filterpagebuilder|guid|httpclient|httpcontent|httpheaders|httprequestmessage|httpresponsemessage|instream|integer|joker|jsonarray|jsonobject|jsontoken|jsonvalue|keyref|list|moduledependencyinfo|moduleinfo|none|notification|notificationscope|objecttype|option|outstream|pageresult|record|recordid|recordref|reportformat|securityfilter|sessionsettings|tableconnectiontype|tablefilter|testaction|testfield|testfilterfield|testpage|testpermissions|testrequestpage|text|textbuilder|textconst|textencoding|time|transactionmodel|transactiontype|variant|verbosity|version|view|views|webserviceactioncontext|webserviceactionresultcode|xmlattribute|xmlattributecollection|xmlcdata|xmlcomment|xmldeclaration|xmldocument|xmldocumenttype|xmlelement|xmlnamespacemanager|xmlnametable|xmlnode|xmlnodelist|xmlprocessinginstruction|xmlreadoptions|xmltext|xmlwriteoptions)\b/i,operator:/\.\.|:[=:]|[-+*/]=?|<>|[<>]=?|=|\b(?:and|div|mod|not|or|xor)\b/i,punctuation:/[()\[\]{}:.;,]/}}e.exports=t,t.displayName="al",t.aliases=[]},25262:function(e){"use strict";function t(e){e.languages.antlr4={comment:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,string:{pattern:/'(?:\\.|[^\\'\r\n])*'/,greedy:!0},"character-class":{pattern:/\[(?:\\.|[^\\\]\r\n])*\]/,greedy:!0,alias:"regex",inside:{range:{pattern:/([^[]|(?:^|[^\\])(?:\\\\)*\\\[)-(?!\])/,lookbehind:!0,alias:"punctuation"},escape:/\\(?:u(?:[a-fA-F\d]{4}|\{[a-fA-F\d]+\})|[pP]\{[=\w-]+\}|[^\r\nupP])/,punctuation:/[\[\]]/}},action:{pattern:/\{(?:[^{}]|\{(?:[^{}]|\{(?:[^{}]|\{[^{}]*\})*\})*\})*\}/,greedy:!0,inside:{content:{pattern:/(\{)[\s\S]+(?=\})/,lookbehind:!0},punctuation:/[{}]/}},command:{pattern:/(->\s*(?!\s))(?:\s*(?:,\s*)?\b[a-z]\w*(?:\s*\([^()\r\n]*\))?)+(?=\s*;)/i,lookbehind:!0,inside:{function:/\b\w+(?=\s*(?:[,(]|$))/,punctuation:/[,()]/}},annotation:{pattern:/@\w+(?:::\w+)*/,alias:"keyword"},label:{pattern:/#[ \t]*\w+/,alias:"punctuation"},keyword:/\b(?:catch|channels|finally|fragment|grammar|import|lexer|locals|mode|options|parser|returns|throws|tokens)\b/,definition:[{pattern:/\b[a-z]\w*(?=\s*:)/,alias:["rule","class-name"]},{pattern:/\b[A-Z]\w*(?=\s*:)/,alias:["token","constant"]}],constant:/\b[A-Z][A-Z_]*\b/,operator:/\.\.|->|[|~]|[*+?]\??/,punctuation:/[;:()=]/},e.languages.g4=e.languages.antlr4}e.exports=t,t.displayName="antlr4",t.aliases=["g4"]},60486:function(e){"use strict";function t(e){e.languages.apacheconf={comment:/#.*/,"directive-inline":{pattern:/(^[\t ]*)\b(?:AcceptFilter|AcceptPathInfo|AccessFileName|Action|Add(?:Alt|AltByEncoding|AltByType|Charset|DefaultCharset|Description|Encoding|Handler|Icon|IconByEncoding|IconByType|InputFilter|Language|ModuleInfo|OutputFilter|OutputFilterByType|Type)|Alias|AliasMatch|Allow(?:CONNECT|EncodedSlashes|Methods|Override|OverrideList)?|Anonymous(?:_LogEmail|_MustGiveEmail|_NoUserID|_VerifyEmail)?|AsyncRequestWorkerFactor|Auth(?:BasicAuthoritative|BasicFake|BasicProvider|BasicUseDigestAlgorithm|DBDUserPWQuery|DBDUserRealmQuery|DBMGroupFile|DBMType|DBMUserFile|Digest(?:Algorithm|Domain|NonceLifetime|Provider|Qop|ShmemSize)|Form(?:Authoritative|Body|DisableNoStore|FakeBasicAuth|Location|LoginRequiredLocation|LoginSuccessLocation|LogoutLocation|Method|Mimetype|Password|Provider|SitePassphrase|Size|Username)|GroupFile|LDAP(?:AuthorizePrefix|BindAuthoritative|BindDN|BindPassword|CharsetConfig|CompareAsUser|CompareDNOnServer|DereferenceAliases|GroupAttribute|GroupAttributeIsDN|InitialBindAsUser|InitialBindPattern|MaxSubGroupDepth|RemoteUserAttribute|RemoteUserIsDN|SearchAsUser|SubGroupAttribute|SubGroupClass|Url)|Merging|Name|nCache(?:Context|Enable|ProvideFor|SOCache|Timeout)|nzFcgiCheckAuthnProvider|nzFcgiDefineProvider|Type|UserFile|zDBDLoginToReferer|zDBDQuery|zDBDRedirectQuery|zDBMType|zSendForbiddenOnFailure)|BalancerGrowth|BalancerInherit|BalancerMember|BalancerPersist|BrowserMatch|BrowserMatchNoCase|BufferedLogs|BufferSize|Cache(?:DefaultExpire|DetailHeader|DirLength|DirLevels|Disable|Enable|File|Header|IgnoreCacheControl|IgnoreHeaders|IgnoreNoLastMod|IgnoreQueryString|IgnoreURLSessionIdentifiers|KeyBaseURL|LastModifiedFactor|Lock|LockMaxAge|LockPath|MaxExpire|MaxFileSize|MinExpire|MinFileSize|NegotiatedDocs|QuickHandler|ReadSize|ReadTime|Root|Socache(?:MaxSize|MaxTime|MinTime|ReadSize|ReadTime)?|StaleOnError|StoreExpired|StoreNoStore|StorePrivate)|CGIDScriptTimeout|CGIMapExtension|CharsetDefault|CharsetOptions|CharsetSourceEnc|CheckCaseOnly|CheckSpelling|ChrootDir|ContentDigest|CookieDomain|CookieExpires|CookieName|CookieStyle|CookieTracking|CoreDumpDirectory|CustomLog|Dav|DavDepthInfinity|DavGenericLockDB|DavLockDB|DavMinTimeout|DBDExptime|DBDInitSQL|DBDKeep|DBDMax|DBDMin|DBDParams|DBDPersist|DBDPrepareSQL|DBDriver|DefaultIcon|DefaultLanguage|DefaultRuntimeDir|DefaultType|Define|Deflate(?:BufferSize|CompressionLevel|FilterNote|InflateLimitRequestBody|InflateRatio(?:Burst|Limit)|MemLevel|WindowSize)|Deny|DirectoryCheckHandler|DirectoryIndex|DirectoryIndexRedirect|DirectorySlash|DocumentRoot|DTracePrivileges|DumpIOInput|DumpIOOutput|EnableExceptionHook|EnableMMAP|EnableSendfile|Error|ErrorDocument|ErrorLog|ErrorLogFormat|Example|ExpiresActive|ExpiresByType|ExpiresDefault|ExtendedStatus|ExtFilterDefine|ExtFilterOptions|FallbackResource|FileETag|FilterChain|FilterDeclare|FilterProtocol|FilterProvider|FilterTrace|ForceLanguagePriority|ForceType|ForensicLog|GprofDir|GracefulShutdownTimeout|Group|Header|HeaderName|Heartbeat(?:Address|Listen|MaxServers|Storage)|HostnameLookups|IdentityCheck|IdentityCheckTimeout|ImapBase|ImapDefault|ImapMenu|Include|IncludeOptional|Index(?:HeadInsert|Ignore|IgnoreReset|Options|OrderDefault|StyleSheet)|InputSed|ISAPI(?:AppendLogToErrors|AppendLogToQuery|CacheFile|FakeAsync|LogNotSupported|ReadAheadBuffer)|KeepAlive|KeepAliveTimeout|KeptBodySize|LanguagePriority|LDAP(?:CacheEntries|CacheTTL|ConnectionPoolTTL|ConnectionTimeout|LibraryDebug|OpCacheEntries|OpCacheTTL|ReferralHopLimit|Referrals|Retries|RetryDelay|SharedCacheFile|SharedCacheSize|Timeout|TrustedClientCert|TrustedGlobalCert|TrustedMode|VerifyServerCert)|Limit(?:InternalRecursion|Request(?:Body|Fields|FieldSize|Line)|XMLRequestBody)|Listen|ListenBackLog|LoadFile|LoadModule|LogFormat|LogLevel|LogMessage|LuaAuthzProvider|LuaCodeCache|Lua(?:Hook(?:AccessChecker|AuthChecker|CheckUserID|Fixups|InsertFilter|Log|MapToStorage|TranslateName|TypeChecker)|Inherit|InputFilter|MapHandler|OutputFilter|PackageCPath|PackagePath|QuickHandler|Root|Scope)|Max(?:ConnectionsPerChild|KeepAliveRequests|MemFree|RangeOverlaps|RangeReversals|Ranges|RequestWorkers|SpareServers|SpareThreads|Threads)|MergeTrailers|MetaDir|MetaFiles|MetaSuffix|MimeMagicFile|MinSpareServers|MinSpareThreads|MMapFile|ModemStandard|ModMimeUsePathInfo|MultiviewsMatch|Mutex|NameVirtualHost|NoProxy|NWSSLTrustedCerts|NWSSLUpgradeable|Options|Order|OutputSed|PassEnv|PidFile|PrivilegesMode|Protocol|ProtocolEcho|Proxy(?:AddHeaders|BadHeader|Block|Domain|ErrorOverride|ExpressDBMFile|ExpressDBMType|ExpressEnable|FtpDirCharset|FtpEscapeWildcards|FtpListOnWildcard|HTML(?:BufSize|CharsetOut|DocType|Enable|Events|Extended|Fixups|Interp|Links|Meta|StripComments|URLMap)|IOBufferSize|MaxForwards|Pass(?:Inherit|InterpolateEnv|Match|Reverse|ReverseCookieDomain|ReverseCookiePath)?|PreserveHost|ReceiveBufferSize|Remote|RemoteMatch|Requests|SCGIInternalRedirect|SCGISendfile|Set|SourceAddress|Status|Timeout|Via)|ReadmeName|ReceiveBufferSize|Redirect|RedirectMatch|RedirectPermanent|RedirectTemp|ReflectorHeader|RemoteIP(?:Header|InternalProxy|InternalProxyList|ProxiesHeader|TrustedProxy|TrustedProxyList)|RemoveCharset|RemoveEncoding|RemoveHandler|RemoveInputFilter|RemoveLanguage|RemoveOutputFilter|RemoveType|RequestHeader|RequestReadTimeout|Require|Rewrite(?:Base|Cond|Engine|Map|Options|Rule)|RLimitCPU|RLimitMEM|RLimitNPROC|Satisfy|ScoreBoardFile|Script(?:Alias|AliasMatch|InterpreterSource|Log|LogBuffer|LogLength|Sock)?|SecureListen|SeeRequestTail|SendBufferSize|Server(?:Admin|Alias|Limit|Name|Path|Root|Signature|Tokens)|Session(?:Cookie(?:Name|Name2|Remove)|Crypto(?:Cipher|Driver|Passphrase|PassphraseFile)|DBD(?:CookieName|CookieName2|CookieRemove|DeleteLabel|InsertLabel|PerUser|SelectLabel|UpdateLabel)|Env|Exclude|Header|Include|MaxAge)?|SetEnv|SetEnvIf|SetEnvIfExpr|SetEnvIfNoCase|SetHandler|SetInputFilter|SetOutputFilter|SSIEndTag|SSIErrorMsg|SSIETag|SSILastModified|SSILegacyExprParser|SSIStartTag|SSITimeFormat|SSIUndefinedEcho|SSL(?:CACertificateFile|CACertificatePath|CADNRequestFile|CADNRequestPath|CARevocationCheck|CARevocationFile|CARevocationPath|CertificateChainFile|CertificateFile|CertificateKeyFile|CipherSuite|Compression|CryptoDevice|Engine|FIPS|HonorCipherOrder|InsecureRenegotiation|OCSP(?:DefaultResponder|Enable|OverrideResponder|ResponderTimeout|ResponseMaxAge|ResponseTimeSkew|UseRequestNonce)|OpenSSLConfCmd|Options|PassPhraseDialog|Protocol|Proxy(?:CACertificateFile|CACertificatePath|CARevocation(?:Check|File|Path)|CheckPeer(?:CN|Expire|Name)|CipherSuite|Engine|MachineCertificate(?:ChainFile|File|Path)|Protocol|Verify|VerifyDepth)|RandomSeed|RenegBufferSize|Require|RequireSSL|Session(?:Cache|CacheTimeout|TicketKeyFile|Tickets)|SRPUnknownUserSeed|SRPVerifierFile|Stapling(?:Cache|ErrorCacheTimeout|FakeTryLater|ForceURL|ResponderTimeout|ResponseMaxAge|ResponseTimeSkew|ReturnResponderErrors|StandardCacheTimeout)|StrictSNIVHostCheck|UserName|UseStapling|VerifyClient|VerifyDepth)|StartServers|StartThreads|Substitute|Suexec|SuexecUserGroup|ThreadLimit|ThreadsPerChild|ThreadStackSize|TimeOut|TraceEnable|TransferLog|TypesConfig|UnDefine|UndefMacro|UnsetEnv|Use|UseCanonicalName|UseCanonicalPhysicalPort|User|UserDir|VHostCGIMode|VHostCGIPrivs|VHostGroup|VHostPrivs|VHostSecure|VHostUser|Virtual(?:DocumentRoot|ScriptAlias)(?:IP)?|WatchdogInterval|XBitHack|xml2EncAlias|xml2EncDefault|xml2StartParse)\b/im,lookbehind:!0,alias:"property"},"directive-block":{pattern:/<\/?\b(?:Auth[nz]ProviderAlias|Directory|DirectoryMatch|Else|ElseIf|Files|FilesMatch|If|IfDefine|IfModule|IfVersion|Limit|LimitExcept|Location|LocationMatch|Macro|Proxy|Require(?:All|Any|None)|VirtualHost)\b.*>/i,inside:{"directive-block":{pattern:/^<\/?\w+/,inside:{punctuation:/^<\/?/},alias:"tag"},"directive-block-parameter":{pattern:/.*[^>]/,inside:{punctuation:/:/,string:{pattern:/("|').*\1/,inside:{variable:/[$%]\{?(?:\w\.?[-+:]?)+\}?/}}},alias:"attr-value"},punctuation:/>/},alias:"tag"},"directive-flags":{pattern:/\[(?:[\w=],?)+\]/,alias:"keyword"},string:{pattern:/("|').*\1/,inside:{variable:/[$%]\{?(?:\w\.?[-+:]?)+\}?/}},variable:/[$%]\{?(?:\w\.?[-+:]?)+\}?/,regex:/\^?.*\$|\^.*\$?/}}e.exports=t,t.displayName="apacheconf",t.aliases=[]},5134:function(e,t,n){"use strict";var a=n(12782);function r(e){e.register(a),function(e){var t=/\b(?:(?:after|before)(?=\s+[a-z])|abstract|activate|and|any|array|as|asc|autonomous|begin|bigdecimal|blob|boolean|break|bulk|by|byte|case|cast|catch|char|class|collect|commit|const|continue|currency|date|datetime|decimal|default|delete|desc|do|double|else|end|enum|exception|exit|export|extends|final|finally|float|for|from|get(?=\s*[{};])|global|goto|group|having|hint|if|implements|import|in|inner|insert|instanceof|int|integer|interface|into|join|like|limit|list|long|loop|map|merge|new|not|null|nulls|number|object|of|on|or|outer|override|package|parallel|pragma|private|protected|public|retrieve|return|rollback|select|set|short|sObject|sort|static|string|super|switch|synchronized|system|testmethod|then|this|throw|time|transaction|transient|trigger|try|undelete|update|upsert|using|virtual|void|webservice|when|where|while|(?:inherited|with|without)\s+sharing)\b/i,n=/\b(?:(?=[a-z_]\w*\s*[<\[])|(?!))[A-Z_]\w*(?:\s*\.\s*[A-Z_]\w*)*\b(?:\s*(?:\[\s*\]|<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>))*/.source.replace(//g,function(){return t.source});function a(e){return RegExp(e.replace(//g,function(){return n}),"i")}var r={keyword:t,punctuation:/[()\[\]{};,:.<>]/};e.languages.apex={comment:e.languages.clike.comment,string:e.languages.clike.string,sql:{pattern:/((?:[=,({:]|\breturn)\s*)\[[^\[\]]*\]/i,lookbehind:!0,greedy:!0,alias:"language-sql",inside:e.languages.sql},annotation:{pattern:/@\w+\b/,alias:"punctuation"},"class-name":[{pattern:a(/(\b(?:class|enum|extends|implements|instanceof|interface|new|trigger\s+\w+\s+on)\s+)/.source),lookbehind:!0,inside:r},{pattern:a(/(\(\s*)(?=\s*\)\s*[\w(])/.source),lookbehind:!0,inside:r},{pattern:a(/(?=\s*\w+\s*[;=,(){:])/.source),inside:r}],trigger:{pattern:/(\btrigger\s+)\w+\b/i,lookbehind:!0,alias:"class-name"},keyword:t,function:/\b[a-z_]\w*(?=\s*\()/i,boolean:/\b(?:false|true)\b/i,number:/(?:\B\.\d+|\b\d+(?:\.\d+|L)?)\b/i,operator:/[!=](?:==?)?|\?\.?|&&|\|\||--|\+\+|[-+*/^&|]=?|:|<=?|>{1,3}=?/,punctuation:/[()\[\]{};,.]/}}(e)}e.exports=r,r.displayName="apex",r.aliases=[]},94048:function(e){"use strict";function t(e){e.languages.apl={comment:/(?:⍝|#[! ]).*$/m,string:{pattern:/'(?:[^'\r\n]|'')*'/,greedy:!0},number:/¯?(?:\d*\.?\b\d+(?:e[+¯]?\d+)?|¯|∞)(?:j¯?(?:(?:\d+(?:\.\d+)?|\.\d+)(?:e[+¯]?\d+)?|¯|∞))?/i,statement:/:[A-Z][a-z][A-Za-z]*\b/,"system-function":{pattern:/⎕[A-Z]+/i,alias:"function"},constant:/[⍬⌾#⎕⍞]/,function:/[-+×÷⌈⌊∣|⍳⍸?*⍟○!⌹<≤=>≥≠≡≢∊⍷∪∩~∨∧⍱⍲⍴,⍪⌽⊖⍉↑↓⊂⊃⊆⊇⌷⍋⍒⊤⊥⍕⍎⊣⊢⍁⍂≈⍯↗¤→]/,"monadic-operator":{pattern:/[\\\/⌿⍀¨⍨⌶&∥]/,alias:"operator"},"dyadic-operator":{pattern:/[.⍣⍠⍤∘⌸@⌺⍥]/,alias:"operator"},assignment:{pattern:/←/,alias:"keyword"},punctuation:/[\[;\]()◇⋄]/,dfn:{pattern:/[{}⍺⍵⍶⍹∇⍫:]/,alias:"builtin"}}}e.exports=t,t.displayName="apl",t.aliases=[]},51228:function(e){"use strict";function t(e){e.languages.applescript={comment:[/\(\*(?:\(\*(?:[^*]|\*(?!\)))*\*\)|(?!\(\*)[\s\S])*?\*\)/,/--.+/,/#.+/],string:/"(?:\\.|[^"\\\r\n])*"/,number:/(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e-?\d+)?\b/i,operator:[/[&=≠≤≥*+\-\/÷^]|[<>]=?/,/\b(?:(?:begin|end|start)s? with|(?:contains?|(?:does not|doesn't) contain)|(?:is|isn't|is not) (?:contained by|in)|(?:(?:is|isn't|is not) )?(?:greater|less) than(?: or equal)?(?: to)?|(?:comes|(?:does not|doesn't) come) (?:after|before)|(?:is|isn't|is not) equal(?: to)?|(?:(?:does not|doesn't) equal|equal to|equals|is not|isn't)|(?:a )?(?:ref(?: to)?|reference to)|(?:and|as|div|mod|not|or))\b/],keyword:/\b(?:about|above|after|against|apart from|around|aside from|at|back|before|beginning|behind|below|beneath|beside|between|but|by|considering|continue|copy|does|eighth|else|end|equal|error|every|exit|false|fifth|first|for|fourth|from|front|get|given|global|if|ignoring|in|instead of|into|is|it|its|last|local|me|middle|my|ninth|of|on|onto|out of|over|prop|property|put|repeat|return|returning|second|set|seventh|since|sixth|some|tell|tenth|that|the|then|third|through|thru|timeout|times|to|transaction|true|try|until|where|while|whose|with|without)\b/,"class-name":/\b(?:POSIX file|RGB color|alias|application|boolean|centimeters|centimetres|class|constant|cubic centimeters|cubic centimetres|cubic feet|cubic inches|cubic meters|cubic metres|cubic yards|date|degrees Celsius|degrees Fahrenheit|degrees Kelvin|feet|file|gallons|grams|inches|integer|kilograms|kilometers|kilometres|list|liters|litres|meters|metres|miles|number|ounces|pounds|quarts|real|record|reference|script|square feet|square kilometers|square kilometres|square meters|square metres|square miles|square yards|text|yards)\b/,punctuation:/[{}():,¬«»《》]/}}e.exports=t,t.displayName="applescript",t.aliases=[]},29606:function(e){"use strict";function t(e){e.languages.aql={comment:/\/\/.*|\/\*[\s\S]*?\*\//,property:{pattern:/([{,]\s*)(?:(?!\d)\w+|(["'´`])(?:(?!\2)[^\\\r\n]|\\.)*\2)(?=\s*:)/,lookbehind:!0,greedy:!0},string:{pattern:/(["'])(?:(?!\1)[^\\\r\n]|\\.)*\1/,greedy:!0},identifier:{pattern:/([´`])(?:(?!\1)[^\\\r\n]|\\.)*\1/,greedy:!0},variable:/@@?\w+/,keyword:[{pattern:/(\bWITH\s+)COUNT(?=\s+INTO\b)/i,lookbehind:!0},/\b(?:AGGREGATE|ALL|AND|ANY|ASC|COLLECT|DESC|DISTINCT|FILTER|FOR|GRAPH|IN|INBOUND|INSERT|INTO|K_PATHS|K_SHORTEST_PATHS|LET|LIKE|LIMIT|NONE|NOT|NULL|OR|OUTBOUND|REMOVE|REPLACE|RETURN|SHORTEST_PATH|SORT|UPDATE|UPSERT|WINDOW|WITH)\b/i,{pattern:/(^|[^\w.[])(?:KEEP|PRUNE|SEARCH|TO)\b/i,lookbehind:!0},{pattern:/(^|[^\w.[])(?:CURRENT|NEW|OLD)\b/,lookbehind:!0},{pattern:/\bOPTIONS(?=\s*\{)/i}],function:/\b(?!\d)\w+(?=\s*\()/,boolean:/\b(?:false|true)\b/i,range:{pattern:/\.\./,alias:"operator"},number:[/\b0b[01]+/i,/\b0x[0-9a-f]+/i,/(?:\B\.\d+|\b(?:0|[1-9]\d*)(?:\.\d+)?)(?:e[+-]?\d+)?/i],operator:/\*{2,}|[=!]~|[!=<>]=?|&&|\|\||[-+*/%]/,punctuation:/::|[?.:,;()[\]{}]/}}e.exports=t,t.displayName="aql",t.aliases=[]},59760:function(e,t,n){"use strict";var a=n(85028);function r(e){e.register(a),e.languages.arduino=e.languages.extend("cpp",{keyword:/\b(?:String|array|bool|boolean|break|byte|case|catch|continue|default|do|double|else|finally|for|function|goto|if|in|instanceof|int|integer|long|loop|new|null|return|setup|string|switch|throw|try|void|while|word)\b/,constant:/\b(?:ANALOG_MESSAGE|DEFAULT|DIGITAL_MESSAGE|EXTERNAL|FIRMATA_STRING|HIGH|INPUT|INPUT_PULLUP|INTERNAL|INTERNAL1V1|INTERNAL2V56|LED_BUILTIN|LOW|OUTPUT|REPORT_ANALOG|REPORT_DIGITAL|SET_PIN_MODE|SYSEX_START|SYSTEM_RESET)\b/,builtin:/\b(?:Audio|BSSID|Bridge|Client|Console|EEPROM|Esplora|EsploraTFT|Ethernet|EthernetClient|EthernetServer|EthernetUDP|File|FileIO|FileSystem|Firmata|GPRS|GSM|GSMBand|GSMClient|GSMModem|GSMPIN|GSMScanner|GSMServer|GSMVoiceCall|GSM_SMS|HttpClient|IPAddress|IRread|Keyboard|KeyboardController|LiquidCrystal|LiquidCrystal_I2C|Mailbox|Mouse|MouseController|PImage|Process|RSSI|RobotControl|RobotMotor|SD|SPI|SSID|Scheduler|Serial|Server|Servo|SoftwareSerial|Stepper|Stream|TFT|Task|USBHost|WiFi|WiFiClient|WiFiServer|WiFiUDP|Wire|YunClient|YunServer|abs|addParameter|analogRead|analogReadResolution|analogReference|analogWrite|analogWriteResolution|answerCall|attach|attachGPRS|attachInterrupt|attached|autoscroll|available|background|beep|begin|beginPacket|beginSD|beginSMS|beginSpeaker|beginTFT|beginTransmission|beginWrite|bit|bitClear|bitRead|bitSet|bitWrite|blink|blinkVersion|buffer|changePIN|checkPIN|checkPUK|checkReg|circle|cityNameRead|cityNameWrite|clear|clearScreen|click|close|compassRead|config|connect|connected|constrain|cos|countryNameRead|countryNameWrite|createChar|cursor|debugPrint|delay|delayMicroseconds|detach|detachInterrupt|digitalRead|digitalWrite|disconnect|display|displayLogos|drawBMP|drawCompass|encryptionType|end|endPacket|endSMS|endTransmission|endWrite|exists|exitValue|fill|find|findUntil|flush|gatewayIP|get|getAsynchronously|getBand|getButton|getCurrentCarrier|getIMEI|getKey|getModifiers|getOemKey|getPINUsed|getResult|getSignalStrength|getSocket|getVoiceCallStatus|getXChange|getYChange|hangCall|height|highByte|home|image|interrupts|isActionDone|isDirectory|isListening|isPIN|isPressed|isValid|keyPressed|keyReleased|keyboardRead|knobRead|leftToRight|line|lineFollowConfig|listen|listenOnLocalhost|loadImage|localIP|lowByte|macAddress|maintain|map|max|messageAvailable|micros|millis|min|mkdir|motorsStop|motorsWrite|mouseDragged|mouseMoved|mousePressed|mouseReleased|move|noAutoscroll|noBlink|noBuffer|noCursor|noDisplay|noFill|noInterrupts|noListenOnLocalhost|noStroke|noTone|onReceive|onRequest|open|openNextFile|overflow|parseCommand|parseFloat|parseInt|parsePacket|pauseMode|peek|pinMode|playFile|playMelody|point|pointTo|position|pow|prepare|press|print|printFirmwareVersion|printVersion|println|process|processInput|pulseIn|put|random|randomSeed|read|readAccelerometer|readBlue|readButton|readBytes|readBytesUntil|readGreen|readJoystickButton|readJoystickSwitch|readJoystickX|readJoystickY|readLightSensor|readMessage|readMicrophone|readNetworks|readRed|readSlider|readString|readStringUntil|readTemperature|ready|rect|release|releaseAll|remoteIP|remoteNumber|remotePort|remove|requestFrom|retrieveCallingNumber|rewindDirectory|rightToLeft|rmdir|robotNameRead|robotNameWrite|run|runAsynchronously|runShellCommand|runShellCommandAsynchronously|running|scanNetworks|scrollDisplayLeft|scrollDisplayRight|seek|sendAnalog|sendDigitalPortPair|sendDigitalPorts|sendString|sendSysex|serialEvent|setBand|setBitOrder|setClockDivider|setCursor|setDNS|setDataMode|setFirmwareVersion|setMode|setPINUsed|setSpeed|setTextSize|setTimeout|shiftIn|shiftOut|shutdown|sin|size|sqrt|startLoop|step|stop|stroke|subnetMask|switchPIN|tan|tempoWrite|text|tone|transfer|tuneWrite|turn|updateIR|userNameRead|userNameWrite|voiceCall|waitContinue|width|write|writeBlue|writeGreen|writeJSON|writeMessage|writeMicroseconds|writeRGB|writeRed|yield)\b/}),e.languages.ino=e.languages.arduino}e.exports=r,r.displayName="arduino",r.aliases=["ino"]},36023:function(e){"use strict";function t(e){e.languages.arff={comment:/%.*/,string:{pattern:/(["'])(?:\\.|(?!\1)[^\\\r\n])*\1/,greedy:!0},keyword:/@(?:attribute|data|end|relation)\b/i,number:/\b\d+(?:\.\d+)?\b/,punctuation:/[{},]/}}e.exports=t,t.displayName="arff",t.aliases=[]},26894:function(e){"use strict";function t(e){!function(e){var t={pattern:/(^[ \t]*)\[(?!\[)(?:(["'$`])(?:(?!\2)[^\\]|\\.)*\2|\[(?:[^\[\]\\]|\\.)*\]|[^\[\]\\"'$`]|\\.)*\]/m,lookbehind:!0,inside:{quoted:{pattern:/([$`])(?:(?!\1)[^\\]|\\.)*\1/,inside:{punctuation:/^[$`]|[$`]$/}},interpreted:{pattern:/'(?:[^'\\]|\\.)*'/,inside:{punctuation:/^'|'$/}},string:/"(?:[^"\\]|\\.)*"/,variable:/\w+(?==)/,punctuation:/^\[|\]$|,/,operator:/=/,"attr-value":/(?!^\s+$).+/}},n=e.languages.asciidoc={"comment-block":{pattern:/^(\/{4,})(?:\r?\n|\r)(?:[\s\S]*(?:\r?\n|\r))??\1/m,alias:"comment"},table:{pattern:/^\|={3,}(?:(?:\r?\n|\r(?!\n)).*)*?(?:\r?\n|\r)\|={3,}$/m,inside:{specifiers:{pattern:/(?:(?:(?:\d+(?:\.\d+)?|\.\d+)[+*](?:[<^>](?:\.[<^>])?|\.[<^>])?|[<^>](?:\.[<^>])?|\.[<^>])[a-z]*|[a-z]+)(?=\|)/,alias:"attr-value"},punctuation:{pattern:/(^|[^\\])[|!]=*/,lookbehind:!0}}},"passthrough-block":{pattern:/^(\+{4,})(?:\r?\n|\r)(?:[\s\S]*(?:\r?\n|\r))??\1$/m,inside:{punctuation:/^\++|\++$/}},"literal-block":{pattern:/^(-{4,}|\.{4,})(?:\r?\n|\r)(?:[\s\S]*(?:\r?\n|\r))??\1$/m,inside:{punctuation:/^(?:-+|\.+)|(?:-+|\.+)$/}},"other-block":{pattern:/^(--|\*{4,}|_{4,}|={4,})(?:\r?\n|\r)(?:[\s\S]*(?:\r?\n|\r))??\1$/m,inside:{punctuation:/^(?:-+|\*+|_+|=+)|(?:-+|\*+|_+|=+)$/}},"list-punctuation":{pattern:/(^[ \t]*)(?:-|\*{1,5}|\.{1,5}|(?:[a-z]|\d+)\.|[xvi]+\))(?= )/im,lookbehind:!0,alias:"punctuation"},"list-label":{pattern:/(^[ \t]*)[a-z\d].+(?::{2,4}|;;)(?=\s)/im,lookbehind:!0,alias:"symbol"},"indented-block":{pattern:/((\r?\n|\r)\2)([ \t]+)\S.*(?:(?:\r?\n|\r)\3.+)*(?=\2{2}|$)/,lookbehind:!0},comment:/^\/\/.*/m,title:{pattern:/^.+(?:\r?\n|\r)(?:={3,}|-{3,}|~{3,}|\^{3,}|\+{3,})$|^={1,5} .+|^\.(?![\s.]).*/m,alias:"important",inside:{punctuation:/^(?:\.|=+)|(?:=+|-+|~+|\^+|\++)$/}},"attribute-entry":{pattern:/^:[^:\r\n]+:(?: .*?(?: \+(?:\r?\n|\r).*?)*)?$/m,alias:"tag"},attributes:t,hr:{pattern:/^'{3,}$/m,alias:"punctuation"},"page-break":{pattern:/^<{3,}$/m,alias:"punctuation"},admonition:{pattern:/^(?:CAUTION|IMPORTANT|NOTE|TIP|WARNING):/m,alias:"keyword"},callout:[{pattern:/(^[ \t]*)\d*>/m,lookbehind:!0,alias:"symbol"},{pattern:/<\d+>/,alias:"symbol"}],macro:{pattern:/\b[a-z\d][a-z\d-]*::?(?:[^\s\[\]]*\[(?:[^\]\\"']|(["'])(?:(?!\1)[^\\]|\\.)*\1|\\.)*\])/,inside:{function:/^[a-z\d-]+(?=:)/,punctuation:/^::?/,attributes:{pattern:/(?:\[(?:[^\]\\"']|(["'])(?:(?!\1)[^\\]|\\.)*\1|\\.)*\])/,inside:t.inside}}},inline:{pattern:/(^|[^\\])(?:(?:\B\[(?:[^\]\\"']|(["'])(?:(?!\2)[^\\]|\\.)*\2|\\.)*\])?(?:\b_(?!\s)(?: _|[^_\\\r\n]|\\.)+(?:(?:\r?\n|\r)(?: _|[^_\\\r\n]|\\.)+)*_\b|\B``(?!\s).+?(?:(?:\r?\n|\r).+?)*''\B|\B`(?!\s)(?:[^`'\s]|\s+\S)+['`]\B|\B(['*+#])(?!\s)(?: \3|(?!\3)[^\\\r\n]|\\.)+(?:(?:\r?\n|\r)(?: \3|(?!\3)[^\\\r\n]|\\.)+)*\3\B)|(?:\[(?:[^\]\\"']|(["'])(?:(?!\4)[^\\]|\\.)*\4|\\.)*\])?(?:(__|\*\*|\+\+\+?|##|\$\$|[~^]).+?(?:(?:\r?\n|\r).+?)*\5|\{[^}\r\n]+\}|\[\[\[?.+?(?:(?:\r?\n|\r).+?)*\]?\]\]|<<.+?(?:(?:\r?\n|\r).+?)*>>|\(\(\(?.+?(?:(?:\r?\n|\r).+?)*\)?\)\)))/m,lookbehind:!0,inside:{attributes:t,url:{pattern:/^(?:\[\[\[?.+?\]?\]\]|<<.+?>>)$/,inside:{punctuation:/^(?:\[\[\[?|<<)|(?:\]\]\]?|>>)$/}},"attribute-ref":{pattern:/^\{.+\}$/,inside:{variable:{pattern:/(^\{)[a-z\d,+_-]+/,lookbehind:!0},operator:/^[=?!#%@$]|!(?=[:}])/,punctuation:/^\{|\}$|::?/}},italic:{pattern:/^(['_])[\s\S]+\1$/,inside:{punctuation:/^(?:''?|__?)|(?:''?|__?)$/}},bold:{pattern:/^\*[\s\S]+\*$/,inside:{punctuation:/^\*\*?|\*\*?$/}},punctuation:/^(?:``?|\+{1,3}|##?|\$\$|[~^]|\(\(\(?)|(?:''?|\+{1,3}|##?|\$\$|[~^`]|\)?\)\))$/}},replacement:{pattern:/\((?:C|R|TM)\)/,alias:"builtin"},entity:/?[\da-z]{1,8};/i,"line-continuation":{pattern:/(^| )\+$/m,lookbehind:!0,alias:"punctuation"}};function a(e){e=e.split(" ");for(var t={},a=0,r=e.length;a>=?|<<=?|&&?|\|\|?|[-+*/%&|^!=<>?]=?/,punctuation:/[(),:]/}}e.exports=t,t.displayName="asmatmel",t.aliases=[]},82592:function(e,t,n){"use strict";var a=n(53494);function r(e){e.register(a),e.languages.aspnet=e.languages.extend("markup",{"page-directive":{pattern:/<%\s*@.*%>/,alias:"tag",inside:{"page-directive":{pattern:/<%\s*@\s*(?:Assembly|Control|Implements|Import|Master(?:Type)?|OutputCache|Page|PreviousPageType|Reference|Register)?|%>/i,alias:"tag"},rest:e.languages.markup.tag.inside}},directive:{pattern:/<%.*%>/,alias:"tag",inside:{directive:{pattern:/<%\s*?[$=%#:]{0,2}|%>/,alias:"tag"},rest:e.languages.csharp}}}),e.languages.aspnet.tag.pattern=/<(?!%)\/?[^\s>\/]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+))?)*\s*\/?>/,e.languages.insertBefore("inside","punctuation",{directive:e.languages.aspnet.directive},e.languages.aspnet.tag.inside["attr-value"]),e.languages.insertBefore("aspnet","comment",{"asp-comment":{pattern:/<%--[\s\S]*?--%>/,alias:["asp","comment"]}}),e.languages.insertBefore("aspnet",e.languages.javascript?"script":"tag",{"asp-script":{pattern:/(LiteLLM Dashboard