diff --git a/docs/my-website/docs/a2a_agent_headers.md b/docs/my-website/docs/a2a_agent_headers.md new file mode 100644 index 00000000000..457893b3b66 --- /dev/null +++ b/docs/my-website/docs/a2a_agent_headers.md @@ -0,0 +1,252 @@ +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# A2A Agent Authentication Headers + +Forward authentication credentials (Bearer tokens, API keys, etc.) from clients to backend A2A agents. + +## Overview + +When LiteLLM proxies a request to a backend A2A agent, the agent may require its own authentication headers. There are three ways to supply them: + +| Method | Who configures | How it works | +|---|---|---| +| **Static headers** | Admin (UI / API) | Always sent, regardless of client request | +| **Forward client headers** | Admin (UI / API) | Header names to extract from client request and forward | +| **Convention-based** | Client (no admin config) | Client sends `x-a2a-{agent_name}-{header}` — automatically routed | + +All three methods can be combined. **Static headers always win** on key conflicts. + +--- + +## Method 1 — Static Headers + +Admin-configured headers that are always sent to the backend agent. Use this for server-to-server tokens or internal credentials that clients should never see or override. + + + + +1. Go to **Agents** in the LiteLLM dashboard. +2. Create or edit an agent. +3. Open the **Authentication Headers** panel. +4. Under **Static Headers**, click **Add Static Header** and fill in the header name and value. + + + + +```bash +curl -X POST http://localhost:4000/v1/agents \ + -H "Authorization: Bearer sk-admin" \ + -H "Content-Type: application/json" \ + -d '{ + "agent_name": "my-agent", + "agent_card_params": { ... }, + "static_headers": { + "Authorization": "Bearer internal-server-token", + "X-Internal-Service": "litellm-proxy" + } + }' +``` + +To update an existing agent: + +```bash +curl -X PATCH http://localhost:4000/v1/agents/{agent_id} \ + -H "Authorization: Bearer sk-admin" \ + -H "Content-Type: application/json" \ + -d '{ + "static_headers": { + "Authorization": "Bearer new-token" + } + }' +``` + + + + +**Client call — no special headers needed:** + +```bash +curl -X POST http://localhost:4000/a2a/my-agent \ + -H "Authorization: Bearer sk-client-key" \ + -H "Content-Type: application/json" \ + -d '{ + "jsonrpc": "2.0", "id": "1", "method": "message/send", + "params": { "message": { "role": "user", "parts": [{"kind": "text", "text": "Hello"}], "messageId": "msg-1" } } + }' +``` + +The backend agent receives `Authorization: Bearer internal-server-token` without the client ever knowing the value. + +--- + +## Method 2 — Forward Client Headers + +Admin specifies a list of header **names**. When the client sends a request that includes those headers, LiteLLM extracts their values and forwards them to the backend agent. The client controls the values; the admin controls which headers are eligible to be forwarded. + + + + +1. Go to **Agents** in the LiteLLM dashboard. +2. Create or edit an agent. +3. Open the **Authentication Headers** panel. +4. Under **Forward Client Headers**, type header names and press **Enter** (e.g. `x-api-key`, `Authorization`). + + + + +```bash +curl -X POST http://localhost:4000/v1/agents \ + -H "Authorization: Bearer sk-admin" \ + -H "Content-Type: application/json" \ + -d '{ + "agent_name": "my-agent", + "agent_card_params": { ... }, + "extra_headers": ["x-api-key", "x-user-token"] + }' +``` + + + + +**Client call — include the forwarded headers:** + +```bash +curl -X POST http://localhost:4000/a2a/my-agent \ + -H "Authorization: Bearer sk-client-key" \ + -H "x-api-key: user-secret-value" \ + -H "Content-Type: application/json" \ + -d '{ ... }' +``` + +The backend agent receives `x-api-key: user-secret-value`. + +:::note +Header name matching is **case-insensitive**. If the client sends `X-API-Key` and `extra_headers` lists `x-api-key`, they match. +::: + +--- + +## Method 3 — Convention-Based Forwarding + +Clients can forward headers to a specific agent without any admin pre-configuration by using the naming convention: + +``` +x-a2a-{agent_name_or_id}-{header_name}: value +``` + +LiteLLM parses these headers automatically and routes them to the matching agent only. + +**Examples:** + +| Client header sent | Agent name/ID | Forwarded as | +|---|---|---| +| `x-a2a-my-agent-authorization: Bearer tok` | `my-agent` | `authorization: Bearer tok` | +| `x-a2a-my-agent-x-api-key: secret` | `my-agent` | `x-api-key: secret` | +| `x-a2a-abc123-authorization: Bearer tok` | agent ID `abc123` | `authorization: Bearer tok` | + +```bash +curl -X POST http://localhost:4000/a2a/my-agent \ + -H "Authorization: Bearer sk-client-key" \ + -H "x-a2a-my-agent-authorization: Bearer agent-specific-token" \ + -H "Content-Type: application/json" \ + -d '{ ... }' +``` + +The `x-a2a-other-agent-authorization` header sent in the same request is **not** forwarded to `my-agent` — it is silently ignored. + +:::tip Matches both agent name and agent ID +Both the human-readable name (e.g. `my-agent`) and the UUID (e.g. `abc123-...`) are valid. Use whichever is convenient for the client. +::: + +--- + +## Merge Precedence + +When multiple methods supply the same header name, **static headers win**: + +``` +dynamic (forwarded/convention) → merged ← static (overlays, wins) +``` + +Example: + +| Source | `Authorization` value | +|---|---| +| Client sends (via `extra_headers` or convention) | `Bearer client-token` | +| Admin-configured `static_headers` | `Bearer server-token` | +| **What the backend agent receives** | **`Bearer server-token`** | + +This ensures admin-controlled credentials cannot be overridden by client requests. + +--- + +## Combining All Three Methods + +```bash +# Register agent with static + forwarded headers +curl -X POST http://localhost:4000/v1/agents \ + -H "Authorization: Bearer sk-admin" \ + -H "Content-Type: application/json" \ + -d '{ + "agent_name": "my-agent", + "agent_card_params": { ... }, + "static_headers": { + "X-Internal-Token": "secret123" + }, + "extra_headers": ["x-user-id"] + }' + +# Client call using all three mechanisms +curl -X POST http://localhost:4000/a2a/my-agent \ + -H "Authorization: Bearer sk-client-key" \ + -H "x-user-id: user-42" \ + -H "x-a2a-my-agent-x-request-id: req-abc" \ + -H "Content-Type: application/json" \ + -d '{ ... }' +``` + +The backend agent receives: + +``` +X-Internal-Token: secret123 ← static header (always) +x-user-id: user-42 ← forwarded (in extra_headers) +x-request-id: req-abc ← convention-based (x-a2a-my-agent-*) +X-LiteLLM-Trace-Id: ← LiteLLM internal +X-LiteLLM-Agent-Id: ← LiteLLM internal +``` + +--- + +## Header Isolation + +Each agent invocation uses an isolated HTTP connection. Headers configured for agent A are **never** sent to agent B, even if both agents are running and receiving requests simultaneously. + +--- + +## API Reference + +### `POST /v1/agents` / `PATCH /v1/agents/{agent_id}` + +| Field | Type | Description | +|---|---|---| +| `static_headers` | `object` | `{"Header-Name": "value"}` — always forwarded | +| `extra_headers` | `string[]` | Header names to extract from client request and forward | + +### Agent Response + +Both fields are returned in `GET /v1/agents` and `GET /v1/agents/{agent_id}`: + +```json +{ + "agent_id": "...", + "agent_name": "my-agent", + "static_headers": { "X-Internal-Token": "secret123" }, + "extra_headers": ["x-user-id"], + ... +} +``` + +:::caution +`static_headers` values are stored in the database and returned by the API. Treat them as you would any credential — do not store sensitive long-lived tokens here if your API is publicly accessible. Consider using short-lived tokens or environment-injected secrets instead. +::: diff --git a/docs/my-website/docs/mcp.md b/docs/my-website/docs/mcp.md index 822b3f5fabc..57bc1d57ffd 100644 --- a/docs/my-website/docs/mcp.md +++ b/docs/my-website/docs/mcp.md @@ -704,6 +704,63 @@ asyncio.run(main()) [Learn more about customer management →](./proxy/customers) +## Calling the Proxy's /v1/responses Endpoint + +When calling your LiteLLM Proxy's `/v1/responses` endpoint to use MCP tools, **always use `server_url: "litellm_proxy"`** in the tools array. This tells the proxy to use its configured MCP servers. + +:::important Do not use the full proxy URL +Using `server_url: "https://your-proxy.com/mcp"` is incorrect when the request is already going to the proxy. The proxy needs the literal value `litellm_proxy` to route to its configured MCP servers. +::: + +```bash title="Correct: Using litellm_proxy" showLineNumbers +curl --location 'https://your-proxy.com/v1/responses' \ +--header 'Content-Type: application/json' \ +--header "Authorization: Bearer $LITELLM_API_KEY" \ +--data '{ + "model": "gpt-4", + "tools": [ + { + "type": "mcp", + "server_label": "litellm", + "server_url": "litellm_proxy", + "require_approval": "never" + } + ], + "input": "Run available tools", + "tool_choice": "required" +}' +``` + +### Sending Custom Headers to MCP Servers + +To pass custom headers (e.g., API keys, auth tokens) to specific MCP servers, use either: + +**Option 1: Request headers** – Add `x-mcp-{server_alias}-{header_name}` to your request headers. The proxy forwards these to the matching MCP server. + +```bash +# Send Authorization header to the "weather2" MCP server +--header 'x-mcp-weather2-authorization: Bearer your-token' + +# Send custom header to the "github" MCP server +--header 'x-mcp-github-x-api-key: your-api-key' +``` + +**Option 2: Headers in tool config** – Include a `headers` object in the tool definition. These are merged with request headers. + +```json +{ + "type": "mcp", + "server_label": "litellm", + "server_url": "litellm_proxy", + "require_approval": "never", + "headers": { + "x-litellm-api-key": "Bearer YOUR_LITELLM_API_KEY", + "x-mcp-servers": "Zapier_MCP,dev-group", + "x-mcp-weather2-authorization": "Bearer your-weather-api-token" + } +} +``` + ## Using your MCP with client side credentials Use this if you want to pass a client side authentication token to LiteLLM to then pass to your MCP to auth to your MCP. diff --git a/docs/my-website/docs/mcp_control.md b/docs/my-website/docs/mcp_control.md index 96c71ef9278..ccaa37f9497 100644 --- a/docs/my-website/docs/mcp_control.md +++ b/docs/my-website/docs/mcp_control.md @@ -323,7 +323,7 @@ curl --location '/v1/responses' \ { "type": "mcp", "server_label": "litellm", - "server_url": "/dev_group/mcp", + "server_url": "litellm_proxy", "require_approval": "never", "headers": { "x-litellm-api-key": "Bearer YOUR_LITELLM_API_KEY" @@ -335,7 +335,7 @@ curl --location '/v1/responses' \ }' ``` -This example uses URL namespacing to access all servers in the "dev_group" access group. +This example uses the `x-mcp-servers` header to access all servers in the "dev_group" access group. Use `server_url: "litellm_proxy"` when calling the proxy's `/v1/responses` endpoint—do not use the full proxy URL. @@ -423,7 +423,7 @@ curl --location '/v1/responses' \ { "type": "mcp", "server_label": "litellm", - "server_url": "/mcp/", + "server_url": "litellm_proxy", "require_approval": "never", "headers": { "x-litellm-api-key": "Bearer YOUR_LITELLM_API_KEY", @@ -436,7 +436,7 @@ curl --location '/v1/responses' \ }' ``` -This configuration restricts the request to only use tools from the specified MCP servers. +This configuration restricts the request to only use tools from the specified MCP servers. Use `server_url: "litellm_proxy"` when calling the proxy's `/v1/responses` endpoint. diff --git a/docs/my-website/docs/providers/azure_ai/azure_model_router.md b/docs/my-website/docs/providers/azure_ai/azure_model_router.md index 16bc1afb70e..9b308b709c7 100644 --- a/docs/my-website/docs/providers/azure_ai/azure_model_router.md +++ b/docs/my-website/docs/providers/azure_ai/azure_model_router.md @@ -2,6 +2,32 @@ Azure Model Router is a feature in Azure AI Foundry that automatically routes your requests to the best available model based on your requirements. This allows you to use a single endpoint that intelligently selects the optimal model for each request. +## Quick Start + +**Model pattern**: `azure_ai/model_router/` + +```python +import litellm + +response = litellm.completion( + model="azure_ai/model_router/model-router", # Replace with your deployment name + messages=[{"role": "user", "content": "Hello!"}], + api_base="https://your-endpoint.cognitiveservices.azure.com/openai/v1/", + api_key="your-api-key", +) +``` + +**Proxy config** (`config.yaml`): + +```yaml +model_list: + - model_name: model-router + litellm_params: + model: azure_ai/model_router/model-router + api_base: https://your-endpoint.cognitiveservices.azure.com/openai/deployments/model-router/chat/completions?api-version=2025-01-01-preview + api_key: your-api-key +``` + ## Key Features - **Automatic Model Selection**: Azure Model Router dynamically selects the best model for your request @@ -229,19 +255,51 @@ Cost is tracked based on the actual model used (e.g., `gpt-4.1-nano`), plus a fl ## Cost Tracking -LiteLLM automatically handles cost tracking for Azure Model Router by: +LiteLLM automatically handles cost tracking for Azure Model Router. Understanding how this works helps you interpret spend and debug billing. -1. **Detecting the actual model**: When Azure Model Router routes your request to a specific model (e.g., `gpt-4.1-nano-2025-04-14`), LiteLLM extracts this from the response -2. **Calculating accurate costs**: Costs are calculated based on: - - The actual model used (e.g., `gpt-4.1-nano` token costs) - - Plus a flat infrastructure cost of **$0.14 per million input tokens** for using the Model Router -3. **Streaming support**: Cost tracking works correctly for both streaming and non-streaming requests +### How LiteLLM Calculates Cost + +When you use Azure Model Router, LiteLLM computes **two cost components**: + +| Component | Description | When Applied | +|-----------|-------------|--------------| +| **Model Cost** | Token-based cost for the actual model that handled the request (e.g., `gpt-5-nano`, `gpt-4.1-nano`) | Always, when Azure returns the model in the response | +| **Router Flat Cost** | $0.14 per million input tokens (Azure AI Foundry infrastructure fee) | When the **request** was made via a model router endpoint | + +### Cost Calculation Flow + +1. **Request model detection**: LiteLLM records the model you requested (e.g., `azure_ai/model_router/model-router`). If it contains `model_router` or `model-router`, the request is treated as a router request. + +2. **Response model extraction**: Azure returns the actual model used in the response (e.g., `gpt-5-nano-2025-08-07`). LiteLLM uses this for the model cost lookup. + +3. **Model cost**: LiteLLM looks up the response model in its pricing table and computes cost from prompt tokens and completion tokens. + +4. **Router flat cost**: Because the original request was to a model router, LiteLLM adds the flat cost ($0.14 per M input tokens) on top of the model cost. + +5. **Total cost**: `Total = Model Cost + Router Flat Cost` + +### Configuration Requirements + +For cost tracking to work correctly: + +- **Use the full pattern**: `azure_ai/model_router/` (e.g., `azure_ai/model_router/model-router`) +- **Proxy config**: When using the LiteLLM proxy, set `model` in `litellm_params` to the full pattern so the request model is correctly identified as a router + +```yaml +# proxy_server_config.yaml +model_list: + - model_name: model-router + litellm_params: + model: azure_ai/model_router/model-router # Required for router cost detection + api_base: https://your-endpoint.cognitiveservices.azure.com/openai/deployments/model-router/chat/completions?api-version=2025-01-01-preview + api_key: your-api-key +``` ### Cost Breakdown When you use Azure Model Router, the total cost includes: -- **Model Cost**: Based on the actual model that handled your request (e.g., `gpt-4.1-nano`) +- **Model Cost**: Based on the actual model that handled your request (e.g., `gpt-5-nano`, `gpt-4.1-nano`) - **Router Flat Cost**: $0.14 per million input tokens (Azure AI Foundry infrastructure fee) ### Example Response with Cost diff --git a/docs/my-website/docs/providers/chatgpt.md b/docs/my-website/docs/providers/chatgpt.md index 156bbf99df6..222881953dc 100644 --- a/docs/my-website/docs/providers/chatgpt.md +++ b/docs/my-website/docs/providers/chatgpt.md @@ -4,12 +4,12 @@ Use ChatGPT Pro/Max subscription models through LiteLLM with OAuth device flow a | Property | Details | |-------|-------| -| Description | ChatGPT subscription access (Codex + GPT-5.2 family) via ChatGPT backend API | +| Description | ChatGPT subscription access (Codex + GPT-5.3/5.4 family) via ChatGPT backend API | | Provider Route on LiteLLM | `chatgpt/` | | Supported Endpoints | `/responses`, `/chat/completions` (bridged to Responses for supported models) | | API Reference | https://chatgpt.com | -ChatGPT subscription access is native to the Responses API. Chat Completions requests are bridged to Responses for supported models (for example `chatgpt/gpt-5.2`). +ChatGPT subscription access is native to the Responses API. Chat Completions requests are bridged to Responses for supported models (for example `chatgpt/gpt-5.4`). Notes: - The ChatGPT subscription backend rejects token limit fields (`max_tokens`, `max_output_tokens`, `max_completion_tokens`) and `metadata`. LiteLLM strips these fields for this provider. @@ -31,7 +31,7 @@ ChatGPT subscription access uses an OAuth device code flow: import litellm response = litellm.responses( - model="chatgpt/gpt-5.2-codex", + model="chatgpt/gpt-5.3-codex", input="Write a Python hello world" ) @@ -44,7 +44,7 @@ print(response) import litellm response = litellm.completion( - model="chatgpt/gpt-5.2", + model="chatgpt/gpt-5.4", messages=[{"role": "user", "content": "Write a Python hello world"}] ) @@ -55,16 +55,36 @@ print(response) ```yaml showLineNumbers title="config.yaml" model_list: - - model_name: chatgpt/gpt-5.2 + - model_name: chatgpt/gpt-5.4 model_info: mode: responses litellm_params: - model: chatgpt/gpt-5.2 - - model_name: chatgpt/gpt-5.2-codex + model: chatgpt/gpt-5.4 + - model_name: chatgpt/gpt-5.4-pro model_info: mode: responses litellm_params: - model: chatgpt/gpt-5.2-codex + model: chatgpt/gpt-5.4-pro + - model_name: chatgpt/gpt-5.3-codex + model_info: + mode: responses + litellm_params: + model: chatgpt/gpt-5.3-codex + - model_name: chatgpt/gpt-5.3-codex-spark + model_info: + mode: responses + litellm_params: + model: chatgpt/gpt-5.3-codex-spark + - model_name: chatgpt/gpt-5.3-instant + model_info: + mode: responses + litellm_params: + model: chatgpt/gpt-5.3-instant + - model_name: chatgpt/gpt-5.3-chat-latest + model_info: + mode: responses + litellm_params: + model: chatgpt/gpt-5.3-chat-latest ``` ```bash showLineNumbers title="Start LiteLLM Proxy" diff --git a/docs/my-website/docs/providers/openai.md b/docs/my-website/docs/providers/openai.md index 782c7072e50..6817c32e9b4 100644 --- a/docs/my-website/docs/providers/openai.md +++ b/docs/my-website/docs/providers/openai.md @@ -192,8 +192,12 @@ os.environ["OPENAI_BASE_URL"] = "https://your_host/v1" # OPTIONAL | gpt-5.2-2025-12-11 | `response = completion(model="gpt-5.2-2025-12-11", messages=messages)` | | gpt-5.2-chat-latest | `response = completion(model="gpt-5.2-chat-latest", messages=messages)` | | gpt-5.3-chat-latest | `response = completion(model="gpt-5.3-chat-latest", messages=messages)` | +| gpt-5.4 | `response = completion(model="gpt-5.4", messages=messages)` | +| gpt-5.4-2026-03-05 | `response = completion(model="gpt-5.4-2026-03-05", messages=messages)` | | gpt-5.2-pro | `response = completion(model="gpt-5.2-pro", messages=messages)` | | gpt-5.2-pro-2025-12-11 | `response = completion(model="gpt-5.2-pro-2025-12-11", messages=messages)` | +| gpt-5.4-pro | `response = completion(model="gpt-5.4-pro", messages=messages)` | +| gpt-5.4-pro-2026-03-05 | `response = completion(model="gpt-5.4-pro-2026-03-05", messages=messages)` | | gpt-5.1 | `response = completion(model="gpt-5.1", messages=messages)` | | gpt-5.1-codex | `response = completion(model="gpt-5.1-codex", messages=messages)` | | gpt-5.1-codex-mini | `response = completion(model="gpt-5.1-codex-mini", messages=messages)` | diff --git a/docs/my-website/docs/providers/vertex.md b/docs/my-website/docs/providers/vertex.md index 94619082e88..a3eb673f039 100644 --- a/docs/my-website/docs/providers/vertex.md +++ b/docs/my-website/docs/providers/vertex.md @@ -1472,6 +1472,82 @@ Your WIF credentials JSON file typically looks like this (for AWS federation): For more details on setting up Workload Identity Federation, see [Google Cloud WIF documentation](https://cloud.google.com/iam/docs/workload-identity-federation). +#### Explicit AWS Credentials for WIF + +By default, AWS-based WIF relies on the EC2 instance metadata service to obtain AWS credentials. This works when LiteLLM runs on an EC2 instance or ECS task with an IAM role attached. + +If your environment **does not have access to the EC2 metadata service** (e.g., running on-premises, in a container without host networking, or in a different cloud with security restrictions), you can provide explicit AWS credentials directly in the WIF credential JSON file. LiteLLM will use these to authenticate to AWS before performing the GCP token exchange. + +Add the `aws_*` keys at the **top level** of your WIF credential JSON (alongside `type`, `audience`, etc.): + +```json +{ + "type": "external_account", + "audience": "//iam.googleapis.com/projects/PROJECT_NUMBER/locations/global/workloadIdentityPools/POOL_ID/providers/PROVIDER_ID", + "subject_token_type": "urn:ietf:params:aws:token-type:aws4_request", + "service_account_impersonation_url": "https://iamcredentials.googleapis.com/v1/projects/-/serviceAccounts/SERVICE_ACCOUNT_EMAIL:generateAccessToken", + "token_url": "https://sts.googleapis.com/v1/token", + "credential_source": { + "environment_id": "aws1", + "region_url": "http://169.254.169.254/latest/meta-data/placement/availability-zone", + "url": "http://169.254.169.254/latest/meta-data/iam/security-credentials", + "regional_cred_verification_url": "https://sts.{region}.amazonaws.com?Action=GetCallerIdentity&Version=2011-06-15" + }, + "aws_role_name": "arn:aws:iam::123456789012:role/MyWifRole", + "aws_region_name": "us-east-1" +} +``` + +**Supported `aws_*` parameters:** + +| Parameter | Required | Description | +|---|---|---| +| `aws_region_name` | Yes | AWS region for credential verification (e.g. `us-east-1`) | +| `aws_role_name` | No | IAM role ARN for STS AssumeRole | +| `aws_access_key_id` | No | Static AWS access key ID | +| `aws_secret_access_key` | No | Static AWS secret access key | +| `aws_session_token` | No | Temporary session token | +| `aws_profile_name` | No | AWS CLI profile name | +| `aws_session_name` | No | Session name for AssumeRole | +| `aws_web_identity_token` | No | Web identity token for STS | +| `aws_sts_endpoint` | No | Custom STS endpoint URL | +| `aws_external_id` | No | External ID for cross-account AssumeRole | + +`aws_region_name` is always required when using explicit AWS credentials. The other parameters follow the same authentication flows as [Bedrock AWS auth](/docs/providers/bedrock#authentication) -- you can use role assumption, static keys, profiles, or web identity tokens. + + + + +```python +from litellm import completion + +response = completion( + model="vertex_ai/gemini-1.5-pro", + messages=[{"role": "user", "content": "Hello!"}], + vertex_credentials="/path/to/wif-credentials-with-aws.json", # WIF JSON with aws_* keys + vertex_project="your-gcp-project-id", + vertex_location="us-central1" +) +``` + + + + +```yaml +model_list: + - model_name: gemini-model + litellm_params: + model: vertex_ai/gemini-1.5-pro + vertex_project: your-gcp-project-id + vertex_location: us-central1 + vertex_credentials: /path/to/wif-credentials-with-aws.json # WIF JSON with aws_* keys +``` + + + + +When `aws_*` keys are present in the JSON, LiteLLM automatically uses explicit AWS authentication instead of the EC2 metadata service. When they are absent, the standard metadata-based flow is used unchanged. + ### **Environment Variables** You can set: @@ -1687,6 +1763,20 @@ litellm.vertex_location = "us-central1 # Your Location | gemini-2.5-flash-lite-preview-09-2025 | `completion('gemini-2.5-flash-lite-preview-09-2025', messages)`, `completion('vertex_ai/gemini-2.5-flash-lite-preview-09-2025', messages)` | | gemini-3.1-flash-lite-preview | `completion('gemini-3.1-flash-lite-preview', messages)`, `completion('vertex_ai/gemini-3.1-flash-lite-preview', messages)` | +## PayGo / Priority Cost Tracking + +LiteLLM automatically tracks spend for Vertex AI Gemini models using the correct pricing tier based on the response's `usageMetadata.trafficType`: + +| Vertex AI `trafficType` | LiteLLM `service_tier` | Pricing applied | +|-------------------------|-------------------------|-----------------| +| `ON_DEMAND_PRIORITY` | `priority` | PayGo / priority pricing (`input_cost_per_token_priority`, `output_cost_per_token_priority`) | +| `ON_DEMAND` | standard | Default on-demand pricing | +| `FLEX` / `BATCH` | `flex` | Batch/flex pricing | + +When you use [Vertex AI PayGo](https://cloud.google.com/vertex-ai/generative-ai/pricing) (on-demand priority) or batch workloads, LiteLLM reads `trafficType` from the response and applies the matching cost per token from the [model cost map](https://github.com/BerriAI/litellm/blob/main/model_prices_and_context_window.json). No configuration is required — spend tracking works out of the box for both standard and PayGo requests. + +See [Spend Tracking](../proxy/cost_tracking.md) for general cost tracking setup. + ## Private Service Connect (PSC) Endpoints LiteLLM supports Vertex AI models deployed to Private Service Connect (PSC) endpoints, allowing you to use custom `api_base` URLs for private deployments. diff --git a/docs/my-website/docs/proxy/cost_tracking.md b/docs/my-website/docs/proxy/cost_tracking.md index b1e5eae2a62..f28eec287d4 100644 --- a/docs/my-website/docs/proxy/cost_tracking.md +++ b/docs/my-website/docs/proxy/cost_tracking.md @@ -8,6 +8,8 @@ Track spend for keys, users, and teams across 100+ LLMs. LiteLLM automatically tracks spend for all known models. See our [model cost map](https://github.com/BerriAI/litellm/blob/main/model_prices_and_context_window.json) +Provider-specific cost tracking (e.g., [Vertex AI PayGo / priority pricing](../providers/vertex.md#paygo--priority-cost-tracking), [Bedrock service tiers](../providers/bedrock.md#usage---service-tier), [Azure base model mapping](./custom_pricing.md#set-base_model-for-cost-tracking-eg-azure-deployments)) is applied automatically when the response includes tier metadata. + :::tip Keep Pricing Data Updated [Sync model pricing data from GitHub](./sync_models_github.md) to ensure accurate cost tracking. ::: diff --git a/docs/my-website/docs/proxy/custom_pricing.md b/docs/my-website/docs/proxy/custom_pricing.md index b61da85bb1d..2a28ddbc454 100644 --- a/docs/my-website/docs/proxy/custom_pricing.md +++ b/docs/my-website/docs/proxy/custom_pricing.md @@ -104,9 +104,18 @@ There are other keys you can use to specify costs for different scenarios and mo - `input_cost_per_video_per_second` - Cost per second of video input - `input_cost_per_video_per_second_above_128k_tokens` - Video cost for large contexts - `input_cost_per_character` - Character-based pricing for some providers +- `input_cost_per_token_priority` / `output_cost_per_token_priority` - Priority/PayGo pricing (Vertex AI Gemini, Bedrock) +- `input_cost_per_token_flex` / `output_cost_per_token_flex` - Batch/flex pricing These keys evolve based on how new models handle multimodality. The latest version can be found at [https://github.com/BerriAI/litellm/blob/main/model_prices_and_context_window.json](https://github.com/BerriAI/litellm/blob/main/model_prices_and_context_window.json). +### Service Tier / PayGo Pricing (Vertex AI, Bedrock) + +For providers that support multiple pricing tiers (e.g., Vertex AI PayGo, Bedrock service tiers), LiteLLM automatically applies the correct cost based on the response: + +- **Vertex AI Gemini**: Uses `usageMetadata.trafficType` (`ON_DEMAND_PRIORITY` → priority, `FLEX`/`BATCH` → flex). See [Vertex AI - PayGo / Priority Cost Tracking](../providers/vertex.md#paygo--priority-cost-tracking). +- **Bedrock**: Uses `serviceTier` from the response. See [Bedrock - Usage - Service Tier](../providers/bedrock.md#usage---service-tier). + ## Zero-Cost Models (Bypass Budget Checks) **Use Case**: You have on-premises or free models that should be accessible even when users exceed their budget limits. diff --git a/docs/my-website/docs/proxy/forward_client_headers.md b/docs/my-website/docs/proxy/forward_client_headers.md index 17f813eabee..cf34d4f1074 100644 --- a/docs/my-website/docs/proxy/forward_client_headers.md +++ b/docs/my-website/docs/proxy/forward_client_headers.md @@ -112,6 +112,8 @@ general_settings: forward_llm_provider_auth_headers: true # Enable BYOK ``` +For **Claude Code** with `/login` and your own Anthropic key, see [Claude Code BYOK](../tutorials/claude_code_byok.md). Use `ANTHROPIC_CUSTOM_HEADERS="x-litellm-api-key: sk-12345"` to pass your LiteLLM key while your Anthropic key (from `/login`) is forwarded as `x-api-key`. + Client request: ```bash curl -X POST "http://localhost:4000/v1/messages" \ diff --git a/docs/my-website/docs/tutorials/claude_code_byok.md b/docs/my-website/docs/tutorials/claude_code_byok.md new file mode 100644 index 00000000000..e1deac623bb --- /dev/null +++ b/docs/my-website/docs/tutorials/claude_code_byok.md @@ -0,0 +1,123 @@ +# Claude Code with Bring Your Own Key (BYOK) + +Use Claude Code with your own Anthropic API key through the LiteLLM proxy. When you use Claude's `/login` with your Anthropic account, your API key is sent as `x-api-key`. With BYOK enabled, LiteLLM forwards your key to Anthropic instead of using proxy-configured keys — so you pay Anthropic directly while still benefiting from LiteLLM's routing, logging, and guardrails. + +## How It Works + +1. **Claude Code `/login`** — You sign in with your Anthropic account; Claude Code sends your Anthropic API key as `x-api-key`. +2. **LiteLLM authentication** — You pass your LiteLLM proxy key via `ANTHROPIC_CUSTOM_HEADERS` so the proxy can authenticate and track your usage. +3. **Key forwarding** — With `forward_llm_provider_auth_headers: true`, LiteLLM forwards your `x-api-key` to Anthropic, giving it precedence over any proxy-configured keys. + +## Prerequisites + +- [Claude Code](https://docs.anthropic.com/en/docs/claude-code/overview) installed +- Anthropic API key (from [console.anthropic.com](https://console.anthropic.com)) +- LiteLLM proxy with a virtual key for authentication + +## Step 1: Configure LiteLLM Proxy + +Enable forwarding of LLM provider auth headers so your Anthropic key takes precedence: + +```yaml title="config.yaml" +model_list: + - model_name: claude-sonnet-4-5 + litellm_params: + model: anthropic/claude-sonnet-4-5 + # No api_key needed — client's key will be used + +litellm_settings: + forward_llm_provider_auth_headers: true # Required for BYOK +``` + +:::info Why `forward_llm_provider_auth_headers`? + +By default, LiteLLM strips `x-api-key` from client requests for security. Setting this to `true` allows client-provided provider keys (like your Anthropic key from `/login`) to be forwarded to Anthropic, overriding any proxy-configured keys. + +::: + +## Step 2: Create a LiteLLM Virtual Key + +Create a virtual key in the LiteLLM UI or via API. +```bash +# Example: Create key via API +curl -X POST "http://localhost:4000/key/generate" \ + -H "Authorization: Bearer sk-your-master-key" \ + -H "Content-Type: application/json" \ + -d '{"key_alias": "claude-code-byok", "models": ["claude-sonnet-4-5"]}' +``` + +## Step 3: Configure Claude Code + +Set environment variables so Claude Code uses LiteLLM and sends your LiteLLM key for proxy auth: + +```bash +# Point Claude Code to your LiteLLM proxy +export ANTHROPIC_BASE_URL="http://localhost:4000" + +# Model name from your config +export ANTHROPIC_MODEL="claude-sonnet-4-5" + +# LiteLLM proxy auth — this is added to every request +# Use x-litellm-api-key so the proxy authenticates you; your Anthropic key goes via x-api-key from /login +export ANTHROPIC_CUSTOM_HEADERS="x-litellm-api-key: sk-12345" +``` + +Replace `sk-12345` with your actual LiteLLM virtual key. + +:::tip Multiple headers + +For multiple headers, use newline-separated values: + +```bash +export ANTHROPIC_CUSTOM_HEADERS="x-litellm-api-key: sk-12345 +x-litellm-user-id: my-user-id" +``` + +::: + +## Step 4: Sign In with Claude Code + +1. Launch Claude Code: + + ```bash + claude + ``` + +2. Use **`/login`** and sign in with your Anthropic account (or use your API key directly). + +3. Claude Code will send: + - `x-api-key`: Your Anthropic API key (from `/login`) + - `x-litellm-api-key`: Your LiteLLM key (from `ANTHROPIC_CUSTOM_HEADERS`) + +4. LiteLLM authenticates you via `x-litellm-api-key`, then forwards `x-api-key` to Anthropic. Your Anthropic key takes precedence over any proxy-configured key. + +## Summary + +| Header | Source | Purpose | +|--------|--------|---------| +| `x-api-key` | Claude Code `/login` (Anthropic key) | Sent to Anthropic for API calls | +| `x-litellm-api-key` | `ANTHROPIC_CUSTOM_HEADERS` | Proxy authentication, tracking, rate limits | + +## Troubleshooting + +### Requests fail with "invalid x-api-key" + +- Ensure `forward_llm_provider_auth_headers: true` is set in `litellm_settings` (or `general_settings`). +- Restart the LiteLLM proxy after changing the config. +- Verify you completed `/login` in Claude Code so your Anthropic key is being sent. + +### Proxy returns 401 + +- Check that `ANTHROPIC_CUSTOM_HEADERS` includes `x-litellm-api-key: `. +- Ensure the LiteLLM key is valid and has access to the model. + +### Proxy key is used instead of my Anthropic key + +- Confirm `forward_llm_provider_auth_headers: true` is in your config. +- The setting can be in `litellm_settings` or `general_settings` depending on your config structure. +- Enable debug logging: `LITELLM_LOG=DEBUG` to see which key is being forwarded. + +## Related + +- [Forward Client Headers](./../proxy/forward_client_headers.md) — Full BYOK and header forwarding docs +- [Claude Code Max Subscription](./claude_code_max_subscription.md) — Using Claude Code with OAuth/Max subscription through LiteLLM diff --git a/docs/my-website/img/claude_code_byok_screenshot.png b/docs/my-website/img/claude_code_byok_screenshot.png new file mode 100644 index 00000000000..2788df95c49 Binary files /dev/null and b/docs/my-website/img/claude_code_byok_screenshot.png differ diff --git a/docs/my-website/sidebars.js b/docs/my-website/sidebars.js index abf6e8a777e..104cbda55e0 100644 --- a/docs/my-website/sidebars.js +++ b/docs/my-website/sidebars.js @@ -154,6 +154,7 @@ const sidebars = { items: [ "tutorials/claude_responses_api", "tutorials/claude_code_max_subscription", + "tutorials/claude_code_byok", "tutorials/claude_code_customer_tracking", "tutorials/claude_code_prompt_cache_routing", "tutorials/claude_code_websearch", @@ -538,6 +539,7 @@ const sidebars = { items: [ "a2a", "a2a_invoking_agents", + "a2a_agent_headers", "a2a_cost_tracking", "a2a_agent_permissions", "a2a_iteration_budgets" diff --git a/enterprise/litellm_enterprise/proxy/common_utils/check_batch_cost.py b/enterprise/litellm_enterprise/proxy/common_utils/check_batch_cost.py index 4dcabb9c58b..10f7f98b719 100644 --- a/enterprise/litellm_enterprise/proxy/common_utils/check_batch_cost.py +++ b/enterprise/litellm_enterprise/proxy/common_utils/check_batch_cost.py @@ -78,8 +78,6 @@ class CheckBatchCost: "status": {"not_in": ["failed", "expired", "cancelled"]} } ) - completed_jobs = [] - for job in jobs: # get the model from the job unified_object_id = job.unified_object_id @@ -237,10 +235,16 @@ class CheckBatchCost: ) # mark the job as complete - completed_jobs.append(job) - - if len(completed_jobs) > 0: - await self.prisma_client.db.litellm_managedobjecttable.update_many( - where={"id": {"in": [job.id for job in completed_jobs]}}, - data={"batch_processed": True, "status": "complete"}, - ) + try: + await self.prisma_client.db.litellm_managedobjecttable.update( + where={"id": job.id}, + data={ + "batch_processed": True, + "status": "complete", + "file_object": response.model_dump_json(), + }, + ) + except Exception as db_err: + verbose_proxy_logger.error( + f"CheckBatchCost: failed to mark job {job.id} complete in DB: {db_err}" + ) diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260305000000_add_agent_headers/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260305000000_add_agent_headers/migration.sql new file mode 100644 index 00000000000..acb35baba96 --- /dev/null +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260305000000_add_agent_headers/migration.sql @@ -0,0 +1,5 @@ +-- Add static_headers and extra_headers to LiteLLM_AgentsTable + +ALTER TABLE "LiteLLM_AgentsTable" + ADD COLUMN IF NOT EXISTS "static_headers" JSONB DEFAULT '{}', + ADD COLUMN IF NOT EXISTS "extra_headers" TEXT[] DEFAULT ARRAY[]::TEXT[]; diff --git a/litellm/a2a_protocol/main.py b/litellm/a2a_protocol/main.py index 8ee433516b3..0067af3c7db 100644 --- a/litellm/a2a_protocol/main.py +++ b/litellm/a2a_protocol/main.py @@ -9,6 +9,7 @@ import datetime import uuid from typing import TYPE_CHECKING, Any, AsyncIterator, Coroutine, Dict, Optional, Union +import httpx import litellm from litellm._logging import verbose_logger, verbose_proxy_logger from litellm.a2a_protocol.streaming_iterator import A2AStreamingIterator @@ -212,6 +213,7 @@ async def asend_message( api_base: Optional[str] = None, litellm_params: Optional[Dict[str, Any]] = None, agent_id: Optional[str] = None, + agent_extra_headers: Optional[Dict[str, str]] = None, **kwargs: Any, ) -> LiteLLMSendMessageResponse: """ @@ -293,9 +295,12 @@ async def asend_message( "Either a2a_client or api_base is required for standard A2A flow" ) trace_id = trace_id or str(uuid.uuid4()) - extra_headers = {"X-LiteLLM-Trace-Id": trace_id} + extra_headers: Dict[str, str] = {"X-LiteLLM-Trace-Id": trace_id} if agent_id: extra_headers["X-LiteLLM-Agent-Id"] = agent_id + # Overlay agent-level headers (agent headers take precedence over LiteLLM internal ones) + if agent_extra_headers: + extra_headers.update(agent_extra_headers) a2a_client = await create_a2a_client( base_url=api_base, extra_headers=extra_headers ) @@ -442,6 +447,7 @@ async def asend_message_streaming( agent_id: Optional[str] = None, metadata: Optional[Dict[str, Any]] = None, proxy_server_request: Optional[Dict[str, Any]] = None, + agent_extra_headers: Optional[Dict[str, str]] = None, ) -> AsyncIterator[Any]: """ Async: Send a streaming message to an A2A agent. @@ -523,7 +529,17 @@ async def asend_message_streaming( raise ValueError( "Either a2a_client or api_base is required for standard A2A flow" ) - a2a_client = await create_a2a_client(base_url=api_base) + # Mirror the non-streaming path: always include trace and agent-id headers + streaming_extra_headers: Dict[str, str] = { + "X-LiteLLM-Trace-Id": str(request.id), + } + if agent_id: + streaming_extra_headers["X-LiteLLM-Agent-Id"] = agent_id + if agent_extra_headers: + streaming_extra_headers.update(agent_extra_headers) + a2a_client = await create_a2a_client( + base_url=api_base, extra_headers=streaming_extra_headers + ) # Type assertion: a2a_client is guaranteed to be non-None here assert a2a_client is not None @@ -637,17 +653,17 @@ async def create_a2a_client( verbose_logger.info(f"Creating A2A client for {base_url}") - # Use LiteLLM's cached httpx client - http_handler = get_async_httpx_client( - llm_provider=httpxSpecialProvider.A2A, - params={"timeout": timeout}, + # Always create a fresh httpx client per A2A call so that per-agent auth + # headers (extra_headers) are never shared across agents or requests. + # Mutating a cached shared client would cause headers from one agent to + # bleed into requests made to a different agent. + httpx_client = httpx.AsyncClient( + timeout=httpx.Timeout(timeout), + headers=extra_headers or {}, ) - httpx_client = http_handler.client - if extra_headers: - httpx_client.headers.update(extra_headers) verbose_proxy_logger.debug( - f"A2A client created with extra_headers={extra_headers}" + f"A2A client created with extra_headers={list(extra_headers.keys())}" ) # Resolve agent card diff --git a/litellm/caching/caching.py b/litellm/caching/caching.py index ad02d2ea891..406a4f8c98a 100644 --- a/litellm/caching/caching.py +++ b/litellm/caching/caching.py @@ -166,6 +166,14 @@ class Cache: None. Cache is set as a litellm param """ if type == LiteLLMCacheType.REDIS: + # Check REDIS_CLUSTER_NODES env var if no explicit startup nodes + if not redis_startup_nodes: + _env_cluster_nodes = litellm.get_secret("REDIS_CLUSTER_NODES") + if _env_cluster_nodes is not None and isinstance( + _env_cluster_nodes, str + ): + redis_startup_nodes = json.loads(_env_cluster_nodes) + if redis_startup_nodes: # Only pass GCP parameters if they are provided cluster_kwargs = { diff --git a/litellm/constants.py b/litellm/constants.py index c1bb7da1b73..2ae365300ef 100644 --- a/litellm/constants.py +++ b/litellm/constants.py @@ -1242,6 +1242,11 @@ X_LITELLM_DISABLE_CALLBACKS = "x-litellm-disable-callbacks" LITELLM_METADATA_FIELD = "litellm_metadata" OLD_LITELLM_METADATA_FIELD = "metadata" LITELLM_TRUNCATED_PAYLOAD_FIELD = "litellm_truncated" +LITELLM_TRUNCATION_DB_SAFEGUARD_NOTE = ( + "Truncation is a DB storage safeguard. " + "Full, untruncated data is logged to logging callbacks (OTEL, Datadog, etc.). " + "To increase the truncation limit, set `MAX_STRING_LENGTH_PROMPT_IN_DB` in your env." +) ########################### LiteLLM Proxy Specific Constants ########################### ######################################################################################## diff --git a/litellm/cost_calculator.py b/litellm/cost_calculator.py index 6354bf44943..75d45af86e6 100644 --- a/litellm/cost_calculator.py +++ b/litellm/cost_calculator.py @@ -272,6 +272,8 @@ def cost_per_token( # noqa: PLR0915 ### SERVICE TIER ### service_tier: Optional[str] = None, # for OpenAI service tier pricing response: Optional[Any] = None, + ### REQUEST MODEL ### + request_model: Optional[str] = None, # original request model for router detection ) -> Tuple[float, float]: # type: ignore """ Calculates the cost per token for a given model, prompt tokens, and completion tokens. @@ -520,7 +522,7 @@ def cost_per_token( # noqa: PLR0915 return dashscope_cost_per_token(model=model, usage=usage_block) elif custom_llm_provider == "azure_ai": return azure_ai_cost_per_token( - model=model, usage=usage_block, response_time_ms=response_time_ms + model=model, usage=usage_block, response_time_ms=response_time_ms, request_model=request_model ) else: model_info = _cached_get_model_info_helper( @@ -1457,6 +1459,11 @@ def completion_cost( # noqa: PLR0915 text=completion_string ) + # Get the original request model for router detection + request_model_for_cost = None + if litellm_logging_obj is not None: + request_model_for_cost = litellm_logging_obj.model + ( prompt_tokens_cost_usd_dollar, completion_tokens_cost_usd_dollar, @@ -1479,6 +1486,7 @@ def completion_cost( # noqa: PLR0915 rerank_billed_units=rerank_billed_units, service_tier=service_tier, response=completion_response, + request_model=request_model_for_cost, ) # Get additional costs from provider (e.g., routing fees, infrastructure costs) diff --git a/litellm/llms/azure/chat/gpt_5_transformation.py b/litellm/llms/azure/chat/gpt_5_transformation.py index a70e008d66b..ffdd52c30ab 100644 --- a/litellm/llms/azure/chat/gpt_5_transformation.py +++ b/litellm/llms/azure/chat/gpt_5_transformation.py @@ -46,7 +46,7 @@ class AzureOpenAIGPT5Config(AzureOpenAIConfig, OpenAIGPT5Config): # Only gpt-5.2+ has been verified to support logprobs on Azure. # The base OpenAI class includes logprobs for gpt-5.1+, but Azure # hasn't verified support for gpt-5.1, so remove them unless gpt-5.2/5.4+. - if self.is_model_gpt_5_1_model(model) and not self.is_model_gpt_5_2_model(model): + if self._supports_reasoning_effort_level(model, "none") and not self.is_model_gpt_5_2_model(model): params = [p for p in params if p not in ["logprobs", "top_logprobs"]] elif self.is_model_gpt_5_2_model(model): azure_supported_params = ["logprobs", "top_logprobs"] @@ -69,9 +69,9 @@ class AzureOpenAIGPT5Config(AzureOpenAIConfig, OpenAIGPT5Config): # gpt-5.1/5.2/5.4 support reasoning_effort='none', but other gpt-5 models don't # See: https://learn.microsoft.com/en-us/azure/ai-foundry/openai/how-to/reasoning - is_gpt_5_1 = self.is_model_gpt_5_1_model(model) + supports_none = self._supports_reasoning_effort_level(model, "none") - if reasoning_effort_value == "none" and not is_gpt_5_1: + if reasoning_effort_value == "none" and not supports_none: if litellm.drop_params is True or ( drop_params is not None and drop_params is True ): @@ -101,8 +101,8 @@ class AzureOpenAIGPT5Config(AzureOpenAIConfig, OpenAIGPT5Config): drop_params=drop_params, ) - # Only drop reasoning_effort='none' for non-gpt-5.1/5.2/5.4 models - if result.get("reasoning_effort") == "none" and not is_gpt_5_1: + # Only drop reasoning_effort='none' for models that don't support it + if result.get("reasoning_effort") == "none" and not supports_none: result.pop("reasoning_effort") return result diff --git a/litellm/llms/azure_ai/cost_calculator.py b/litellm/llms/azure_ai/cost_calculator.py index 999f94da182..6fb29962677 100644 --- a/litellm/llms/azure_ai/cost_calculator.py +++ b/litellm/llms/azure_ai/cost_calculator.py @@ -61,7 +61,10 @@ def calculate_azure_model_router_flat_cost(model: str, prompt_tokens: int) -> fl def cost_per_token( - model: str, usage: Usage, response_time_ms: Optional[float] = 0.0 + model: str, + usage: Usage, + response_time_ms: Optional[float] = 0.0, + request_model: Optional[str] = None, ) -> Tuple[float, float]: """ Calculate the cost per token for Azure AI models. @@ -71,9 +74,10 @@ def cost_per_token( - Plus the cost of the actual model used (handled by generic_cost_per_token) Args: - model: str, the model name without provider prefix + model: str, the model name without provider prefix (from response) usage: LiteLLM Usage block response_time_ms: Optional response time in milliseconds + request_model: Optional[str], the original request model name (to detect router usage) Returns: Tuple[float, float] - prompt_cost_in_usd, completion_cost_in_usd @@ -84,7 +88,13 @@ def cost_per_token( """ prompt_cost = 0.0 completion_cost = 0.0 - + + # Determine if this was a model router request + # Check both the response model and the request model + is_router_request = _is_azure_model_router(model) or ( + request_model is not None and _is_azure_model_router(request_model) + ) + # Calculate base cost using generic cost calculator # This may raise an exception if the model is not in the cost map try: @@ -103,19 +113,21 @@ def cost_per_token( verbose_logger.debug( f"Azure AI Model Router: model '{model}' not in cost map, calculating routing flat cost only. Error: {e}" ) - + # Add flat cost for Azure Model Router # The flat cost is defined in model_prices_and_context_window.json for azure_ai/model_router - if _is_azure_model_router(model): - router_flat_cost = calculate_azure_model_router_flat_cost(model, usage.prompt_tokens) - + if is_router_request: + # Use the request model for flat cost calculation if available, otherwise use response model + router_model_for_calc = request_model if request_model else model + router_flat_cost = calculate_azure_model_router_flat_cost(router_model_for_calc, usage.prompt_tokens) + if router_flat_cost > 0: verbose_logger.debug( f"Azure AI Model Router flat cost: ${router_flat_cost:.6f} " f"({usage.prompt_tokens} tokens × ${router_flat_cost / usage.prompt_tokens:.9f}/token)" ) - + # Add flat cost to prompt cost prompt_cost += router_flat_cost - + return prompt_cost, completion_cost diff --git a/litellm/llms/openai/chat/gpt_5_transformation.py b/litellm/llms/openai/chat/gpt_5_transformation.py index 5f0c58e78af..beb76f3d80a 100644 --- a/litellm/llms/openai/chat/gpt_5_transformation.py +++ b/litellm/llms/openai/chat/gpt_5_transformation.py @@ -1,12 +1,30 @@ """Support for OpenAI gpt-5 model family.""" -from typing import Optional +from typing import Optional, Union import litellm +from litellm.utils import _supports_factory from .gpt_transformation import OpenAIGPTConfig +def _normalize_reasoning_effort_for_chat_completion( + value: Union[str, dict, None], +) -> Optional[str]: + """Convert reasoning_effort to the string format expected by OpenAI chat completion API. + + The chat completion API expects a simple string: 'none', 'low', 'medium', 'high', or 'xhigh'. + Config/deployments may pass the Responses API format: {'effort': 'high', 'summary': 'detailed'}. + """ + if value is None: + return None + if isinstance(value, str): + return value + if isinstance(value, dict) and "effort" in value: + return value["effort"] + return None + + class OpenAIGPT5Config(OpenAIGPTConfig): """Configuration for gpt-5 models including GPT-5-Codex variants. @@ -40,47 +58,32 @@ class OpenAIGPT5Config(OpenAIGPTConfig): """Check if the model is specifically a GPT-5 Codex variant.""" return "gpt-5-codex" in model - @classmethod - def is_model_gpt_5_1_codex_max_model(cls, model: str) -> bool: - """Check if the model is the gpt-5.1-codex-max variant.""" - model_name = model.split("/")[-1] # handle provider prefixes - return model_name == "gpt-5.1-codex-max" - - @classmethod - def is_model_gpt_5_1_model(cls, model: str) -> bool: - """Check if the model is a gpt-5.1, gpt-5.2, or gpt-5.4 chat variant. - - gpt-5.1/5.2/5.4 support temperature when reasoning_effort="none", - unlike base gpt-5 which only supports temperature=1. Excludes - pro variants which keep stricter knobs and chat-only variants - which only support temperature=1. - """ - model_name = model.split("/")[-1] - is_gpt_5_1 = model_name.startswith("gpt-5.1") - is_gpt_5_2 = ( - model_name.startswith("gpt-5.2") - and "pro" not in model_name - and not model_name.startswith("gpt-5.2-chat") - ) - is_gpt_5_4 = ( - model_name.startswith("gpt-5.4") - and "pro" not in model_name - and not model_name.startswith("gpt-5.4-chat") - ) - return is_gpt_5_1 or is_gpt_5_2 or is_gpt_5_4 - - @classmethod - def is_model_gpt_5_2_pro_model(cls, model: str) -> bool: - """Check if the model is the gpt-5.2-pro snapshot/alias.""" - model_name = model.split("/")[-1] - return model_name.startswith("gpt-5.2-pro") - @classmethod def is_model_gpt_5_2_model(cls, model: str) -> bool: """Check if the model is a gpt-5.2 variant (including pro).""" model_name = model.split("/")[-1] return model_name.startswith("gpt-5.2") or model_name.startswith("gpt-5.4") + @classmethod + def is_model_gpt_5_4_model(cls, model: str) -> bool: + """Check if the model is a gpt-5.4 variant (including pro).""" + model_name = model.split("/")[-1] + return model_name.startswith("gpt-5.4") + + @classmethod + def _supports_reasoning_effort_level(cls, model: str, level: str) -> bool: + """Check if the model supports a specific reasoning_effort level. + + Looks up ``supports_{level}_reasoning_effort`` in the model map via + the shared ``_supports_factory`` helper. + Returns False for unknown models (safe fallback). + """ + return _supports_factory( + model=model, + custom_llm_provider=None, + key=f"supports_{level}_reasoning_effort", + ) + def get_supported_openai_params(self, model: str) -> list: if self.is_model_gpt_5_search_model(model): return [ @@ -118,8 +121,8 @@ class OpenAIGPT5Config(OpenAIGPTConfig): "web_search_options", ] - # gpt-5.1/5.2/5.4 support logprobs, top_p, top_logprobs when reasoning_effort="none" - if not self.is_model_gpt_5_1_model(model): + # gpt-5.1/5.2 support logprobs, top_p, top_logprobs when reasoning_effort="none" + if not self._supports_reasoning_effort_level(model, "none"): non_supported_params.extend(["logprobs", "top_p", "top_logprobs"]) return [ @@ -147,15 +150,22 @@ class OpenAIGPT5Config(OpenAIGPTConfig): drop_params=drop_params, ) - reasoning_effort = ( + # Normalize reasoning_effort: chat completion API expects a string, not a dict + # (e.g. {'effort': 'high', 'summary': 'detailed'} -> 'high') + raw_reasoning_effort = ( non_default_params.get("reasoning_effort") or optional_params.get("reasoning_effort") ) + normalized = _normalize_reasoning_effort_for_chat_completion(raw_reasoning_effort) + if raw_reasoning_effort is not None and normalized is not None: + if "reasoning_effort" in non_default_params: + non_default_params["reasoning_effort"] = normalized + if "reasoning_effort" in optional_params: + optional_params["reasoning_effort"] = normalized + + reasoning_effort = normalized or raw_reasoning_effort if reasoning_effort is not None and reasoning_effort == "xhigh": - if not ( - self.is_model_gpt_5_1_codex_max_model(model) - or self.is_model_gpt_5_2_model(model) - ): + if not self._supports_reasoning_effort_level(model, "xhigh"): if litellm.drop_params or drop_params: non_default_params.pop("reasoning_effort", None) else: @@ -175,8 +185,20 @@ class OpenAIGPT5Config(OpenAIGPTConfig): "max_tokens" ) - # gpt-5.1/5.2/5.4 support logprobs, top_p, top_logprobs only when reasoning_effort="none" - if self.is_model_gpt_5_1_model(model): + # gpt-5.4: function calls not supported when reasoning_effort != "none" + # Drop reasoning_effort when tools are present (small minority of volume) + if self.is_model_gpt_5_4_model(model): + has_tools = bool( + non_default_params.get("tools") or optional_params.get("tools") + ) + if has_tools and reasoning_effort not in (None, "none"): + non_default_params.pop("reasoning_effort", None) + optional_params.pop("reasoning_effort", None) + reasoning_effort = None + + # gpt-5.1/5.2 support logprobs, top_p, top_logprobs only when reasoning_effort="none" + supports_none = self._supports_reasoning_effort_level(model, "none") + if supports_none: sampling_params = ["logprobs", "top_logprobs", "top_p"] has_sampling = any(p in non_default_params for p in sampling_params) if has_sampling and reasoning_effort not in (None, "none"): @@ -196,10 +218,8 @@ class OpenAIGPT5Config(OpenAIGPTConfig): if "temperature" in non_default_params: temperature_value: Optional[float] = non_default_params.pop("temperature") if temperature_value is not None: - is_gpt_5_1 = self.is_model_gpt_5_1_model(model) - - # gpt-5.1 supports any temperature when reasoning_effort="none" (or not specified, as it defaults to "none") - if is_gpt_5_1 and (reasoning_effort == "none" or reasoning_effort is None): + # models supporting reasoning_effort="none" also support flexible temperature + if supports_none and (reasoning_effort == "none" or reasoning_effort is None): optional_params["temperature"] = temperature_value elif temperature_value == 1: optional_params["temperature"] = temperature_value diff --git a/litellm/llms/openai/chat/o_series_transformation.py b/litellm/llms/openai/chat/o_series_transformation.py index 6ef43ec5bfd..0c5ee90b332 100644 --- a/litellm/llms/openai/chat/o_series_transformation.py +++ b/litellm/llms/openai/chat/o_series_transformation.py @@ -131,7 +131,10 @@ class OpenAIOSeriesConfig(OpenAIGPTConfig): def is_model_o_series_model(self, model: str) -> bool: model = model.split("/")[-1] # could be "openai/o3" or "o3" - return model.startswith(("o1", "o3", "o4")) and model in litellm.open_ai_chat_completion_models + return ( + len(model) > 1 and model[0] == "o" and model[1].isdigit() + and model in litellm.open_ai_chat_completion_models + ) @overload def _transform_messages( diff --git a/litellm/llms/vertex_ai/aws_credentials_supplier.py b/litellm/llms/vertex_ai/aws_credentials_supplier.py new file mode 100644 index 00000000000..f358511311b --- /dev/null +++ b/litellm/llms/vertex_ai/aws_credentials_supplier.py @@ -0,0 +1,52 @@ +""" +Custom AWS Security Credentials Supplier for Vertex AI WIF. + +Wraps boto3/botocore credentials so that google-auth can use them +for the AWS-to-GCP Workload Identity Federation token exchange +without hitting the EC2 instance metadata service. + +Requires google-auth >= 2.29.0. +""" + +from typing import Callable + +from google.auth import aws + + +class AwsCredentialsSupplier(aws.AwsSecurityCredentialsSupplier): + """ + Supplies AWS credentials to google-auth's aws.Credentials for WIF + token exchange. + + This bypasses the default metadata-based credential retrieval, + allowing WIF to work in environments where EC2 metadata is blocked. + + Accepts a credentials_provider callable that is invoked on every + get_aws_security_credentials() call, so that refreshed/rotated + credentials are picked up automatically (important for temporary + STS tokens). + """ + + def __init__(self, credentials_provider: Callable, aws_region: str): + """ + Args: + credentials_provider: A zero-arg callable that returns a + botocore.credentials.Credentials object (with access_key, + secret_key, and token attributes). + aws_region: The AWS region string (e.g. "us-east-1"). + """ + self._credentials_provider = credentials_provider + self._region = aws_region + + def get_aws_security_credentials(self, context, request): + """Return current AWS credentials for the GCP token exchange.""" + current = self._credentials_provider() + return aws.AwsSecurityCredentials( + access_key_id=current.access_key, + secret_access_key=current.secret_key, + session_token=current.token, + ) + + def get_aws_region(self, context, request): + """Return the AWS region for credential verification.""" + return self._region 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 eb2d5ad51cb..e28b755be75 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 @@ -800,9 +800,10 @@ class VertexGeminiConfig(VertexAIBaseConfig, BaseConfig): GeminiThinkingConfig with thinkingLevel and includeThoughts """ # Check if this is gemini-3-flash which supports MINIMAL thinking level + # Covers gemini-3-flash, gemini-3-flash-preview, gemini-3.1-flash, gemini-3.1-flash-lite-preview, etc. is_gemini3flash = model and ( - "gemini-3-flash-preview" in model.lower() - or "gemini-3-flash" in model.lower() + "gemini-3-flash" in model.lower() + or "gemini-3.1-flash" in model.lower() ) is_gemini31pro = model and ( "gemini-3.1-pro-preview" in model.lower() diff --git a/litellm/llms/vertex_ai/vertex_ai_aws_wif.py b/litellm/llms/vertex_ai/vertex_ai_aws_wif.py new file mode 100644 index 00000000000..44a0016e4ec --- /dev/null +++ b/litellm/llms/vertex_ai/vertex_ai_aws_wif.py @@ -0,0 +1,125 @@ +""" +AWS Workload Identity Federation (WIF) auth for Vertex AI. + +Handles explicit AWS credentials for GCP WIF token exchange, +bypassing the EC2 instance metadata service. + +When aws_* keys are present in the WIF credential JSON, this module +uses BaseAWSLLM to obtain AWS credentials and wraps them in a custom +AwsSecurityCredentialsSupplier for google-auth. +""" + +from typing import Dict + +GOOGLE_IMPORT_ERROR_MESSAGE = ( + "Google Cloud SDK not found. Install it with: pip install 'litellm[google]' " + "or pip install google-cloud-aiplatform" +) + +# AWS params recognized in WIF credential JSON for explicit auth. +# These match the kwargs accepted by BaseAWSLLM.get_credentials(). +_AWS_CREDENTIAL_KEYS = frozenset({ + "aws_access_key_id", + "aws_secret_access_key", + "aws_session_token", + "aws_region_name", + "aws_session_name", + "aws_profile_name", + "aws_role_name", + "aws_web_identity_token", + "aws_sts_endpoint", + "aws_external_id", +}) + + +class VertexAIAwsWifAuth: + """ + Handles AWS-to-GCP Workload Identity Federation credential creation + for Vertex AI, using explicit AWS credentials rather than EC2 metadata. + """ + + @staticmethod + def extract_aws_params(json_obj: dict) -> Dict[str, str]: + """ + Extract LiteLLM-specific aws_* keys from a WIF credential JSON dict. + + Returns a dict of {param_name: value} for any recognized aws_* keys + found in the JSON. Returns empty dict if none are present. + """ + return { + key: json_obj[key] + for key in _AWS_CREDENTIAL_KEYS + if key in json_obj + } + + @staticmethod + def credentials_from_explicit_aws(json_obj, aws_params, scopes): + """ + Create GCP credentials using explicit AWS credentials for WIF. + + Uses BaseAWSLLM to obtain AWS credentials (via STS AssumeRole, profile, + static keys, etc.), then wraps them in a custom AwsSecurityCredentialsSupplier + so that google-auth bypasses the EC2 metadata service. + + Args: + json_obj: The WIF credential JSON dict (contains audience, token_url, etc.) + aws_params: Dict of aws_* params extracted from json_obj + scopes: OAuth scopes for the GCP credentials + """ + try: + from google.auth import aws + except ImportError: + raise ImportError(GOOGLE_IMPORT_ERROR_MESSAGE) + + from litellm.llms.bedrock.base_aws_llm import BaseAWSLLM + from litellm.llms.vertex_ai.aws_credentials_supplier import ( + AwsCredentialsSupplier, + ) + + # Validate region first — required for the GCP token exchange. + # Check before get_credentials() to avoid unnecessary AWS API calls + # (e.g. STS AssumeRole) on misconfiguration. + aws_region = aws_params.get("aws_region_name") + if not aws_region: + raise ValueError( + "aws_region_name is required in the WIF credential JSON " + "when using explicit AWS authentication. Add " + '"aws_region_name": "" to your credential file.' + ) + + # Build a credentials provider that re-resolves AWS creds on each call. + # This ensures rotated/refreshed STS tokens are picked up during + # long-running processes when google-auth refreshes the GCP token. + base_aws = BaseAWSLLM() + aws_params_copy = dict(aws_params) # avoid mutating caller's dict + + def _get_aws_credentials(): + return base_aws.get_credentials(**aws_params_copy) + + # Create the custom supplier with a lazy credentials provider + supplier = AwsCredentialsSupplier( + credentials_provider=_get_aws_credentials, + aws_region=aws_region, + ) + + # Build kwargs for aws.Credentials — forward optional fields from JSON + creds_kwargs = dict( + audience=json_obj.get("audience"), + subject_token_type=json_obj.get("subject_token_type"), + token_url=json_obj.get("token_url"), + credential_source=None, # Not using metadata endpoints + aws_security_credentials_supplier=supplier, + service_account_impersonation_url=json_obj.get( + "service_account_impersonation_url" + ), + ) + # Forward universe_domain if present (defaults to googleapis.com) + if "universe_domain" in json_obj: + creds_kwargs["universe_domain"] = json_obj["universe_domain"] + + creds = aws.Credentials(**creds_kwargs) + + if scopes and hasattr(creds, "requires_scopes") and creds.requires_scopes: + creds = creds.with_scopes(scopes) + + return creds diff --git a/litellm/llms/vertex_ai/vertex_llm_base.py b/litellm/llms/vertex_ai/vertex_llm_base.py index 4613b6a5715..86e14a30df4 100644 --- a/litellm/llms/vertex_ai/vertex_llm_base.py +++ b/litellm/llms/vertex_ai/vertex_llm_base.py @@ -96,10 +96,23 @@ class VertexBase: else "" ) if isinstance(environment_id, str) and "aws" in environment_id: - creds = self._credentials_from_identity_pool_with_aws( - json_obj, - scopes=["https://www.googleapis.com/auth/cloud-platform"], + # Check if explicit AWS params are in the JSON (bypasses metadata) + from litellm.llms.vertex_ai.vertex_ai_aws_wif import ( + VertexAIAwsWifAuth, ) + + aws_params = VertexAIAwsWifAuth.extract_aws_params(json_obj) + if aws_params: + creds = VertexAIAwsWifAuth.credentials_from_explicit_aws( + json_obj, + aws_params=aws_params, + scopes=["https://www.googleapis.com/auth/cloud-platform"], + ) + else: + creds = self._credentials_from_identity_pool_with_aws( + json_obj, + scopes=["https://www.googleapis.com/auth/cloud-platform"], + ) else: creds = self._credentials_from_identity_pool( json_obj, diff --git a/litellm/model_prices_and_context_window_backup.json b/litellm/model_prices_and_context_window_backup.json index 81e99f3712d..303cffb407d 100644 --- a/litellm/model_prices_and_context_window_backup.json +++ b/litellm/model_prices_and_context_window_backup.json @@ -1239,7 +1239,7 @@ "supports_vision": true, "tool_use_system_prompt_tokens": 346 }, - "apac.anthropic.claude-sonnet-4-6": { + "au.anthropic.claude-sonnet-4-6": { "cache_creation_input_token_cost": 4.125e-06, "cache_creation_input_token_cost_above_200k_tokens": 8.25e-06, "cache_read_input_token_cost": 3.3e-07, @@ -18437,6 +18437,93 @@ "max_tokens": 8191, "mode": "embedding" }, + "chatgpt/gpt-5.4": { + "litellm_provider": "chatgpt", + "max_input_tokens": 1050000, + "max_output_tokens": 128000, + "max_tokens": 128000, + "mode": "responses", + "supported_endpoints": [ + "/v1/chat/completions", + "/v1/responses" + ], + "supports_function_calling": true, + "supports_parallel_function_calling": true, + "supports_response_schema": true, + "supports_vision": true + }, + "chatgpt/gpt-5.4-pro": { + "litellm_provider": "chatgpt", + "max_input_tokens": 1050000, + "max_output_tokens": 128000, + "max_tokens": 128000, + "mode": "responses", + "supported_endpoints": [ + "/v1/responses" + ], + "supports_function_calling": true, + "supports_parallel_function_calling": true, + "supports_response_schema": true, + "supports_vision": true + }, + "chatgpt/gpt-5.3-codex": { + "litellm_provider": "chatgpt", + "max_input_tokens": 128000, + "max_output_tokens": 128000, + "max_tokens": 128000, + "mode": "responses", + "supported_endpoints": [ + "/v1/responses" + ], + "supports_function_calling": true, + "supports_parallel_function_calling": true, + "supports_response_schema": true, + "supports_vision": true + }, + "chatgpt/gpt-5.3-codex-spark": { + "litellm_provider": "chatgpt", + "max_input_tokens": 128000, + "max_output_tokens": 128000, + "max_tokens": 128000, + "mode": "responses", + "supported_endpoints": [ + "/v1/responses" + ], + "supports_function_calling": true, + "supports_parallel_function_calling": true, + "supports_response_schema": true, + "supports_vision": true + }, + "chatgpt/gpt-5.3-instant": { + "litellm_provider": "chatgpt", + "max_input_tokens": 128000, + "max_output_tokens": 64000, + "max_tokens": 64000, + "mode": "responses", + "supported_endpoints": [ + "/v1/chat/completions", + "/v1/responses" + ], + "supports_function_calling": true, + "supports_parallel_function_calling": true, + "supports_response_schema": true, + "supports_vision": true + }, + "chatgpt/gpt-5.3-chat-latest": { + "litellm_provider": "chatgpt", + "max_input_tokens": 128000, + "max_output_tokens": 64000, + "max_tokens": 64000, + "mode": "responses", + "supported_endpoints": [ + "/v1/chat/completions", + "/v1/responses" + ], + "supports_function_calling": true, + "supports_parallel_function_calling": true, + "supports_response_schema": true, + "supports_vision": true + }, "chatgpt/gpt-5.2-codex": { "litellm_provider": "chatgpt", "max_input_tokens": 128000, @@ -20506,7 +20593,9 @@ "supports_system_messages": true, "supports_tool_choice": true, "supports_service_tier": true, - "supports_vision": true + "supports_vision": true, + "supports_none_reasoning_effort": false, + "supports_xhigh_reasoning_effort": false }, "gpt-5.1": { "cache_read_input_token_cost": 1.25e-07, @@ -20542,7 +20631,10 @@ "supports_system_messages": true, "supports_tool_choice": true, "supports_service_tier": true, - "supports_vision": true + "supports_vision": true, + "supports_web_search": true, + "supports_none_reasoning_effort": true, + "supports_xhigh_reasoning_effort": false }, "gpt-5.1-2025-11-13": { "cache_read_input_token_cost": 1.25e-07, @@ -20578,7 +20670,10 @@ "supports_system_messages": true, "supports_tool_choice": true, "supports_service_tier": true, - "supports_vision": true + "supports_vision": true, + "supports_web_search": true, + "supports_none_reasoning_effort": true, + "supports_xhigh_reasoning_effort": false }, "gpt-5.1-chat-latest": { "cache_read_input_token_cost": 1.25e-07, @@ -20613,7 +20708,10 @@ "supports_response_schema": true, "supports_system_messages": true, "supports_tool_choice": false, - "supports_vision": true + "supports_vision": true, + "supports_web_search": true, + "supports_none_reasoning_effort": true, + "supports_xhigh_reasoning_effort": false }, "gpt-5.2": { "cache_read_input_token_cost": 1.75e-07, @@ -20650,7 +20748,10 @@ "supports_system_messages": true, "supports_tool_choice": true, "supports_service_tier": true, - "supports_vision": true + "supports_vision": true, + "supports_web_search": true, + "supports_none_reasoning_effort": true, + "supports_xhigh_reasoning_effort": true }, "gpt-5.2-2025-12-11": { "cache_read_input_token_cost": 1.75e-07, @@ -20687,7 +20788,10 @@ "supports_system_messages": true, "supports_tool_choice": true, "supports_service_tier": true, - "supports_vision": true + "supports_vision": true, + "supports_web_search": true, + "supports_none_reasoning_effort": true, + "supports_xhigh_reasoning_effort": true }, "gpt-5.2-chat-latest": { "cache_read_input_token_cost": 1.75e-07, @@ -20721,7 +20825,10 @@ "supports_response_schema": true, "supports_system_messages": true, "supports_tool_choice": true, - "supports_vision": true + "supports_vision": true, + "supports_web_search": true, + "supports_none_reasoning_effort": false, + "supports_xhigh_reasoning_effort": false }, "gpt-5.3-chat-latest": { "cache_read_input_token_cost": 1.75e-07, @@ -20755,7 +20862,10 @@ "supports_response_schema": true, "supports_system_messages": true, "supports_tool_choice": true, - "supports_vision": true + "supports_vision": true, + "supports_web_search": true, + "supports_none_reasoning_effort": false, + "supports_xhigh_reasoning_effort": false }, "gpt-5.2-pro": { "input_cost_per_token": 2.1e-05, @@ -20786,7 +20896,9 @@ "supports_system_messages": true, "supports_tool_choice": true, "supports_vision": true, - "supports_web_search": true + "supports_web_search": true, + "supports_none_reasoning_effort": false, + "supports_xhigh_reasoning_effort": true }, "gpt-5.2-pro-2025-12-11": { "input_cost_per_token": 2.1e-05, @@ -20817,20 +20929,82 @@ "supports_system_messages": true, "supports_tool_choice": true, "supports_vision": true, - "supports_web_search": true + "supports_web_search": true, + "supports_none_reasoning_effort": false, + "supports_xhigh_reasoning_effort": true }, "gpt-5.4": { "cache_read_input_token_cost": 2.5e-07, + "cache_read_input_token_cost_above_272k_tokens": 5e-07, + "cache_read_input_token_cost_flex": 1.3e-07, "cache_read_input_token_cost_priority": 5e-07, + "cache_read_input_token_cost_above_272k_tokens_priority": 1e-06, "input_cost_per_token": 2.5e-06, + "input_cost_per_token_above_272k_tokens": 5e-06, + "input_cost_per_token_flex": 1.25e-06, + "input_cost_per_token_batches": 1.25e-06, "input_cost_per_token_priority": 5e-06, + "input_cost_per_token_above_272k_tokens_priority": 1e-05, "litellm_provider": "openai", "max_input_tokens": 1050000, "max_output_tokens": 128000, "max_tokens": 128000, - "mode": "responses", + "mode": "chat", "output_cost_per_token": 1.5e-05, + "output_cost_per_token_above_272k_tokens": 2.25e-05, + "output_cost_per_token_flex": 7.5e-06, + "output_cost_per_token_batches": 7.5e-06, "output_cost_per_token_priority": 2.25e-05, + "output_cost_per_token_above_272k_tokens_priority": 3.375e-05, + "supported_endpoints": [ + "/v1/chat/completions", + "/v1/batch", + "/v1/responses" + ], + "supported_modalities": [ + "text", + "image" + ], + "supported_output_modalities": [ + "text" + ], + "supports_function_calling": true, + "supports_native_streaming": true, + "supports_parallel_function_calling": true, + "supports_pdf_input": true, + "supports_prompt_caching": true, + "supports_reasoning": true, + "supports_response_schema": true, + "supports_system_messages": true, + "supports_tool_choice": true, + "supports_service_tier": true, + "supports_vision": true, + "supports_none_reasoning_effort": true, + "supports_xhigh_reasoning_effort": true + }, + "gpt-5.4-2026-03-05": { + "cache_read_input_token_cost": 2.5e-07, + "cache_read_input_token_cost_above_272k_tokens": 5e-07, + "cache_read_input_token_cost_flex": 1.3e-07, + "cache_read_input_token_cost_priority": 5e-07, + "cache_read_input_token_cost_above_272k_tokens_priority": 1e-06, + "input_cost_per_token": 2.5e-06, + "input_cost_per_token_above_272k_tokens": 5e-06, + "input_cost_per_token_flex": 1.25e-06, + "input_cost_per_token_batches": 1.25e-06, + "input_cost_per_token_priority": 5e-06, + "input_cost_per_token_above_272k_tokens_priority": 1e-05, + "litellm_provider": "openai", + "max_input_tokens": 1050000, + "max_output_tokens": 128000, + "max_tokens": 128000, + "mode": "chat", + "output_cost_per_token": 1.5e-05, + "output_cost_per_token_above_272k_tokens": 2.25e-05, + "output_cost_per_token_flex": 7.5e-06, + "output_cost_per_token_batches": 7.5e-06, + "output_cost_per_token_priority": 2.25e-05, + "output_cost_per_token_above_272k_tokens_priority": 3.375e-05, "supported_endpoints": [ "/v1/chat/completions", "/v1/batch", @@ -20855,18 +21029,28 @@ "supports_service_tier": true, "supports_vision": true }, - "gpt-5.4-2026-03-05": { - "cache_read_input_token_cost": 2.5e-07, - "cache_read_input_token_cost_priority": 5e-07, - "input_cost_per_token": 2.5e-06, - "input_cost_per_token_priority": 5e-06, + "gpt-5.4-pro": { + "cache_read_input_token_cost": 3e-06, + "cache_read_input_token_cost_above_272k_tokens": 6e-06, + "cache_read_input_token_cost_priority": 6e-06, + "cache_read_input_token_cost_above_272k_tokens_priority": 1.2e-05, + "input_cost_per_token": 3e-05, + "input_cost_per_token_above_272k_tokens": 6e-05, + "input_cost_per_token_flex": 1.5e-05, + "input_cost_per_token_batches": 1.5e-05, + "input_cost_per_token_priority": 6e-05, + "input_cost_per_token_above_272k_tokens_priority": 1.2e-04, "litellm_provider": "openai", "max_input_tokens": 1050000, "max_output_tokens": 128000, "max_tokens": 128000, - "mode": "responses", - "output_cost_per_token": 1.5e-05, - "output_cost_per_token_priority": 2.25e-05, + "mode": "chat", + "output_cost_per_token": 1.8e-04, + "output_cost_per_token_above_272k_tokens": 2.7e-04, + "output_cost_per_token_flex": 9e-05, + "output_cost_per_token_batches": 9e-05, + "output_cost_per_token_priority": 2.7e-04, + "output_cost_per_token_above_272k_tokens_priority": 4.05e-04, "supported_endpoints": [ "/v1/chat/completions", "/v1/batch", @@ -20885,11 +21069,63 @@ "supports_pdf_input": true, "supports_prompt_caching": true, "supports_reasoning": true, - "supports_response_schema": true, + "supports_response_schema": false, "supports_system_messages": true, "supports_tool_choice": true, "supports_service_tier": true, - "supports_vision": true + "supports_vision": true, + "supports_web_search": true, + "supports_none_reasoning_effort": false, + "supports_xhigh_reasoning_effort": true + }, + "gpt-5.4-pro-2026-03-05": { + "cache_read_input_token_cost": 3e-06, + "cache_read_input_token_cost_above_272k_tokens": 6e-06, + "cache_read_input_token_cost_priority": 6e-06, + "cache_read_input_token_cost_above_272k_tokens_priority": 1.2e-05, + "input_cost_per_token": 3e-05, + "input_cost_per_token_above_272k_tokens": 6e-05, + "input_cost_per_token_flex": 1.5e-05, + "input_cost_per_token_batches": 1.5e-05, + "input_cost_per_token_priority": 6e-05, + "input_cost_per_token_above_272k_tokens_priority": 1.2e-04, + "litellm_provider": "openai", + "max_input_tokens": 1050000, + "max_output_tokens": 128000, + "max_tokens": 128000, + "mode": "chat", + "output_cost_per_token": 1.8e-04, + "output_cost_per_token_above_272k_tokens": 2.7e-04, + "output_cost_per_token_flex": 9e-05, + "output_cost_per_token_batches": 9e-05, + "output_cost_per_token_priority": 2.7e-04, + "output_cost_per_token_above_272k_tokens_priority": 4.05e-04, + "supported_endpoints": [ + "/v1/chat/completions", + "/v1/batch", + "/v1/responses" + ], + "supported_modalities": [ + "text", + "image" + ], + "supported_output_modalities": [ + "text" + ], + "supports_function_calling": true, + "supports_native_streaming": true, + "supports_parallel_function_calling": true, + "supports_pdf_input": true, + "supports_prompt_caching": true, + "supports_reasoning": true, + "supports_response_schema": false, + "supports_system_messages": true, + "supports_tool_choice": true, + "supports_service_tier": true, + "supports_vision": true, + "supports_web_search": true, + "supports_none_reasoning_effort": false, + "supports_xhigh_reasoning_effort": true }, "gpt-5-pro": { "input_cost_per_token": 1.5e-05, @@ -20922,7 +21158,9 @@ "supports_system_messages": true, "supports_tool_choice": true, "supports_vision": true, - "supports_web_search": true + "supports_web_search": true, + "supports_none_reasoning_effort": false, + "supports_xhigh_reasoning_effort": false }, "gpt-5-pro-2025-10-06": { "input_cost_per_token": 1.5e-05, @@ -20955,7 +21193,9 @@ "supports_system_messages": true, "supports_tool_choice": true, "supports_vision": true, - "supports_web_search": true + "supports_web_search": true, + "supports_none_reasoning_effort": false, + "supports_xhigh_reasoning_effort": false }, "gpt-5-2025-08-07": { "cache_read_input_token_cost": 1.25e-07, @@ -20994,7 +21234,9 @@ "supports_system_messages": true, "supports_tool_choice": true, "supports_service_tier": true, - "supports_vision": true + "supports_vision": true, + "supports_none_reasoning_effort": false, + "supports_xhigh_reasoning_effort": false }, "gpt-5-chat": { "cache_read_input_token_cost": 1.25e-07, @@ -21026,7 +21268,9 @@ "supports_response_schema": true, "supports_system_messages": true, "supports_tool_choice": false, - "supports_vision": true + "supports_vision": true, + "supports_none_reasoning_effort": false, + "supports_xhigh_reasoning_effort": false }, "gpt-5-chat-latest": { "cache_read_input_token_cost": 1.25e-07, @@ -21058,7 +21302,9 @@ "supports_response_schema": true, "supports_system_messages": true, "supports_tool_choice": false, - "supports_vision": true + "supports_vision": true, + "supports_none_reasoning_effort": false, + "supports_xhigh_reasoning_effort": false }, "gpt-5-codex": { "cache_read_input_token_cost": 1.25e-07, @@ -21088,7 +21334,9 @@ "supports_response_schema": true, "supports_system_messages": false, "supports_tool_choice": true, - "supports_vision": true + "supports_vision": true, + "supports_none_reasoning_effort": false, + "supports_xhigh_reasoning_effort": false }, "gpt-5.1-codex": { "cache_read_input_token_cost": 1.25e-07, @@ -21121,7 +21369,9 @@ "supports_response_schema": true, "supports_system_messages": false, "supports_tool_choice": true, - "supports_vision": true + "supports_vision": true, + "supports_none_reasoning_effort": false, + "supports_xhigh_reasoning_effort": false }, "gpt-5.1-codex-max": { "cache_read_input_token_cost": 1.25e-07, @@ -21151,7 +21401,9 @@ "supports_response_schema": true, "supports_system_messages": false, "supports_tool_choice": true, - "supports_vision": true + "supports_vision": true, + "supports_none_reasoning_effort": false, + "supports_xhigh_reasoning_effort": true }, "gpt-5.1-codex-mini": { "cache_read_input_token_cost": 2.5e-08, @@ -21184,7 +21436,9 @@ "supports_response_schema": true, "supports_system_messages": false, "supports_tool_choice": true, - "supports_vision": true + "supports_vision": true, + "supports_none_reasoning_effort": false, + "supports_xhigh_reasoning_effort": false }, "gpt-5.2-codex": { "cache_read_input_token_cost": 1.75e-07, @@ -21217,7 +21471,9 @@ "supports_response_schema": true, "supports_system_messages": false, "supports_tool_choice": true, - "supports_vision": true + "supports_vision": true, + "supports_none_reasoning_effort": false, + "supports_xhigh_reasoning_effort": true }, "gpt-5.3-codex": { "cache_read_input_token_cost": 1.75e-07, @@ -21250,7 +21506,9 @@ "supports_response_schema": true, "supports_system_messages": false, "supports_tool_choice": true, - "supports_vision": true + "supports_vision": true, + "supports_none_reasoning_effort": false, + "supports_xhigh_reasoning_effort": false }, "gpt-5-mini": { "cache_read_input_token_cost": 2.5e-08, @@ -21289,7 +21547,9 @@ "supports_system_messages": true, "supports_tool_choice": true, "supports_service_tier": true, - "supports_vision": true + "supports_vision": true, + "supports_none_reasoning_effort": false, + "supports_xhigh_reasoning_effort": false }, "gpt-5-mini-2025-08-07": { "cache_read_input_token_cost": 2.5e-08, @@ -21328,7 +21588,9 @@ "supports_system_messages": true, "supports_tool_choice": true, "supports_service_tier": true, - "supports_vision": true + "supports_vision": true, + "supports_none_reasoning_effort": false, + "supports_xhigh_reasoning_effort": false }, "gpt-5-nano": { "cache_read_input_token_cost": 5e-09, @@ -21364,7 +21626,9 @@ "supports_response_schema": true, "supports_system_messages": true, "supports_tool_choice": true, - "supports_vision": true + "supports_vision": true, + "supports_none_reasoning_effort": false, + "supports_xhigh_reasoning_effort": false }, "gpt-5-nano-2025-08-07": { "cache_read_input_token_cost": 5e-09, @@ -21399,7 +21663,9 @@ "supports_response_schema": true, "supports_system_messages": true, "supports_tool_choice": true, - "supports_vision": true + "supports_vision": true, + "supports_none_reasoning_effort": false, + "supports_xhigh_reasoning_effort": false }, "gpt-image-1": { "cache_read_input_image_token_cost": 2.5e-06, @@ -38559,7 +38825,9 @@ "supports_system_messages": true, "supports_tool_choice": true, "supports_vision": true, - "supports_web_search": true + "supports_web_search": true, + "supports_none_reasoning_effort": false, + "supports_xhigh_reasoning_effort": false }, "gpt-5-search-api-2025-10-14": { "cache_read_input_token_cost": 1.25e-07, @@ -38578,7 +38846,9 @@ "supports_system_messages": true, "supports_tool_choice": true, "supports_vision": true, - "supports_web_search": true + "supports_web_search": true, + "supports_none_reasoning_effort": false, + "supports_xhigh_reasoning_effort": false }, "gpt-realtime-mini-2025-10-06": { "cache_creation_input_audio_token_cost": 3e-07, diff --git a/litellm/proxy/_experimental/mcp_server/openapi_to_mcp_generator.py b/litellm/proxy/_experimental/mcp_server/openapi_to_mcp_generator.py index bcbf91e5c56..6ad391a5008 100644 --- a/litellm/proxy/_experimental/mcp_server/openapi_to_mcp_generator.py +++ b/litellm/proxy/_experimental/mcp_server/openapi_to_mcp_generator.py @@ -124,6 +124,8 @@ def extract_parameters(operation: Dict[str, Any]) -> tuple: # OpenAPI 3.x and 2.x parameters if "parameters" in operation: for param in operation["parameters"]: + if "name" not in param: + continue param_name = param["name"] if param.get("in") == "path": path_params.append(param_name) @@ -147,6 +149,8 @@ def build_input_schema(operation: Dict[str, Any]) -> Dict[str, Any]: # Process parameters if "parameters" in operation: for param in operation["parameters"]: + if "name" not in param: + continue param_name = param["name"] param_schema = param.get("schema", {}) param_type = param_schema.get("type", "string") diff --git a/litellm/proxy/_experimental/out/404/index.html b/litellm/proxy/_experimental/out/404/index.html index 0f45eb1aa33..37a8fe100a8 100644 --- a/litellm/proxy/_experimental/out/404/index.html +++ b/litellm/proxy/_experimental/out/404/index.html @@ -1 +1 @@ -404: This page could not be found.LiteLLM Dashboard

404

This page could not be found.

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

404

This page could not be found.

\ No newline at end of file diff --git a/litellm/proxy/_experimental/out/__next.__PAGE__.txt b/litellm/proxy/_experimental/out/__next.__PAGE__.txt index 5d8197ff593..462e7045cea 100644 --- a/litellm/proxy/_experimental/out/__next.__PAGE__.txt +++ b/litellm/proxy/_experimental/out/__next.__PAGE__.txt @@ -1,32 +1,29 @@ 1:"$Sreact.fragment" 2:I[347257,["/litellm-asset-prefix/_next/static/chunks/d96012bcfc98706a.js","/litellm-asset-prefix/_next/static/chunks/dbca964212122d58.js"],"ClientPageRoot"] -3:I[952683,["/litellm-asset-prefix/_next/static/chunks/26adfa4e8ffc85c7.js","/litellm-asset-prefix/_next/static/chunks/e8ed72789c2b42ff.js","/litellm-asset-prefix/_next/static/chunks/61f59596bf7f0628.js","/litellm-asset-prefix/_next/static/chunks/9f5ccd929375c1d6.js","/litellm-asset-prefix/_next/static/chunks/30539b80ac15aad2.js","/litellm-asset-prefix/_next/static/chunks/142704439974f6b3.js","/litellm-asset-prefix/_next/static/chunks/8b4fd43197a5dfc8.js","/litellm-asset-prefix/_next/static/chunks/1fe0596a309ad6cf.js","/litellm-asset-prefix/_next/static/chunks/7b788dd93ad868b3.js","/litellm-asset-prefix/_next/static/chunks/c979f252fa5ee77c.js","/litellm-asset-prefix/_next/static/chunks/50febaabfb896c46.js","/litellm-asset-prefix/_next/static/chunks/c4cc89d1b0a147d5.js","/litellm-asset-prefix/_next/static/chunks/fe5201571c777f09.js","/litellm-asset-prefix/_next/static/chunks/c748f222de4766db.js","/litellm-asset-prefix/_next/static/chunks/5f9c3b92a016f382.js","/litellm-asset-prefix/_next/static/chunks/fe750aa0bf04912c.js","/litellm-asset-prefix/_next/static/chunks/7d4cded1a1238581.js","/litellm-asset-prefix/_next/static/chunks/d64d74932cb225a3.js","/litellm-asset-prefix/_next/static/chunks/9ffb8ddd0c9a7c31.js","/litellm-asset-prefix/_next/static/chunks/c4fe728e74b52958.js","/litellm-asset-prefix/_next/static/chunks/1532edb438ed84bb.js","/litellm-asset-prefix/_next/static/chunks/d0d828f9a0668699.js","/litellm-asset-prefix/_next/static/chunks/88c74f8b4b20d25a.js","/litellm-asset-prefix/_next/static/chunks/25c5a08661ac2ec3.js","/litellm-asset-prefix/_next/static/chunks/134f728fa7099e3e.js","/litellm-asset-prefix/_next/static/chunks/9d6e5aad99b19216.js","/litellm-asset-prefix/_next/static/chunks/e8718f949e42598e.js","/litellm-asset-prefix/_next/static/chunks/6a51328383335d1e.js","/litellm-asset-prefix/_next/static/chunks/3b30ab8eaa03bc21.js","/litellm-asset-prefix/_next/static/chunks/99cf9cf99df5ccfc.js","/litellm-asset-prefix/_next/static/chunks/6a4eede876bb5c8f.js","/litellm-asset-prefix/_next/static/chunks/7e417dd24c8becd0.js","/litellm-asset-prefix/_next/static/chunks/c7b74067c01ee971.js","/litellm-asset-prefix/_next/static/chunks/a85adee4198d5478.js","/litellm-asset-prefix/_next/static/chunks/bff4459534c52f16.js","/litellm-asset-prefix/_next/static/chunks/39eb5927f56ccc0e.js","/litellm-asset-prefix/_next/static/chunks/ebb2b2d8175d3d2f.js","/litellm-asset-prefix/_next/static/chunks/5a5488ab3db0c3de.js","/litellm-asset-prefix/_next/static/chunks/0a65da2cd24e2ab6.js","/litellm-asset-prefix/_next/static/chunks/82dbdb17d57c6737.js","/litellm-asset-prefix/_next/static/chunks/b31a08272a82b84e.js","/litellm-asset-prefix/_next/static/chunks/496b84010c33cf69.js","/litellm-asset-prefix/_next/static/chunks/eba9ac65320061b1.js","/litellm-asset-prefix/_next/static/chunks/0eda6dc5d5f35d92.js","/litellm-asset-prefix/_next/static/chunks/96aed36e606e8582.js","/litellm-asset-prefix/_next/static/chunks/ad426ab08aee6c64.js","/litellm-asset-prefix/_next/static/chunks/2971c4658f1bcd7d.js","/litellm-asset-prefix/_next/static/chunks/06ebe9b0e9cdf241.js","/litellm-asset-prefix/_next/static/chunks/6c4c97f1ea6e7d77.js","/litellm-asset-prefix/_next/static/chunks/165d00848f04c4c9.js","/litellm-asset-prefix/_next/static/chunks/bb0a6e4a3a18721a.js","/litellm-asset-prefix/_next/static/chunks/4980372eaa37b78b.js","/litellm-asset-prefix/_next/static/chunks/8ab6e2ca95000c8e.js","/litellm-asset-prefix/_next/static/chunks/06cdd9bb80c63794.js","/litellm-asset-prefix/_next/static/chunks/66a190706fc6c35a.js","/litellm-asset-prefix/_next/static/chunks/54e29148cb2f2582.js","/litellm-asset-prefix/_next/static/chunks/fd9de419c8c0222e.js"],"default"] -1c:I[897367,["/litellm-asset-prefix/_next/static/chunks/d96012bcfc98706a.js","/litellm-asset-prefix/_next/static/chunks/dbca964212122d58.js"],"OutletBoundary"] -1d:"$Sreact.suspense" +3:I[952683,["/litellm-asset-prefix/_next/static/chunks/a7f104aa2cc7f3f0.js","/litellm-asset-prefix/_next/static/chunks/e8ed72789c2b42ff.js","/litellm-asset-prefix/_next/static/chunks/db1ebd02d726c50f.js","/litellm-asset-prefix/_next/static/chunks/142704439974f6b3.js","/litellm-asset-prefix/_next/static/chunks/30539b80ac15aad2.js","/litellm-asset-prefix/_next/static/chunks/e55394619917c445.js","/litellm-asset-prefix/_next/static/chunks/df6665addf8c6036.js","/litellm-asset-prefix/_next/static/chunks/1fe0596a309ad6cf.js","/litellm-asset-prefix/_next/static/chunks/9d9e6235c06ebb90.js","/litellm-asset-prefix/_next/static/chunks/403c4d96324c23a6.js","/litellm-asset-prefix/_next/static/chunks/308c947b873bf49b.js","/litellm-asset-prefix/_next/static/chunks/88c74f8b4b20d25a.js","/litellm-asset-prefix/_next/static/chunks/2d471965761a22ff.js","/litellm-asset-prefix/_next/static/chunks/6eb81672801a9dec.js","/litellm-asset-prefix/_next/static/chunks/3b30ab8eaa03bc21.js","/litellm-asset-prefix/_next/static/chunks/7b788dd93ad868b3.js","/litellm-asset-prefix/_next/static/chunks/5f9c3b92a016f382.js","/litellm-asset-prefix/_next/static/chunks/38605193023f8e1c.js","/litellm-asset-prefix/_next/static/chunks/d0d828f9a0668699.js","/litellm-asset-prefix/_next/static/chunks/4d3d997560b322ca.js","/litellm-asset-prefix/_next/static/chunks/4e4d0f466b5c1780.js","/litellm-asset-prefix/_next/static/chunks/d64d74932cb225a3.js","/litellm-asset-prefix/_next/static/chunks/3fb7a83546b6aa35.js","/litellm-asset-prefix/_next/static/chunks/134f728fa7099e3e.js","/litellm-asset-prefix/_next/static/chunks/9d6e5aad99b19216.js","/litellm-asset-prefix/_next/static/chunks/bb02cdce134f811b.js","/litellm-asset-prefix/_next/static/chunks/0f93c304f38c63d0.js","/litellm-asset-prefix/_next/static/chunks/130b80d41c79d98e.js","/litellm-asset-prefix/_next/static/chunks/348b31083769a7c4.js","/litellm-asset-prefix/_next/static/chunks/759173c2a452c43c.js","/litellm-asset-prefix/_next/static/chunks/4980372eaa37b78b.js","/litellm-asset-prefix/_next/static/chunks/c81bdad246412686.js","/litellm-asset-prefix/_next/static/chunks/b6cdb9a433f054f3.js","/litellm-asset-prefix/_next/static/chunks/a85adee4198d5478.js","/litellm-asset-prefix/_next/static/chunks/fcdf7322b0aa3e2e.js","/litellm-asset-prefix/_next/static/chunks/0adb91ab5f3140d5.js","/litellm-asset-prefix/_next/static/chunks/675f6c62ddae3031.js","/litellm-asset-prefix/_next/static/chunks/7e417dd24c8becd0.js","/litellm-asset-prefix/_next/static/chunks/0a65da2cd24e2ab6.js","/litellm-asset-prefix/_next/static/chunks/86c1e01d849eed8e.js","/litellm-asset-prefix/_next/static/chunks/eba9ac65320061b1.js","/litellm-asset-prefix/_next/static/chunks/85238af541b170ca.js","/litellm-asset-prefix/_next/static/chunks/8c09c924a98654d1.js","/litellm-asset-prefix/_next/static/chunks/b13b0ddeb85b5333.js","/litellm-asset-prefix/_next/static/chunks/2971c4658f1bcd7d.js","/litellm-asset-prefix/_next/static/chunks/496b84010c33cf69.js","/litellm-asset-prefix/_next/static/chunks/06ebe9b0e9cdf241.js","/litellm-asset-prefix/_next/static/chunks/6c4c97f1ea6e7d77.js","/litellm-asset-prefix/_next/static/chunks/e8718f949e42598e.js","/litellm-asset-prefix/_next/static/chunks/99cf9cf99df5ccfc.js","/litellm-asset-prefix/_next/static/chunks/bb0a6e4a3a18721a.js","/litellm-asset-prefix/_next/static/chunks/cfca40b1a4a490bf.js","/litellm-asset-prefix/_next/static/chunks/54e29148cb2f2582.js","/litellm-asset-prefix/_next/static/chunks/37c03dc421ba81f8.js"],"default"] +19:I[897367,["/litellm-asset-prefix/_next/static/chunks/d96012bcfc98706a.js","/litellm-asset-prefix/_next/static/chunks/dbca964212122d58.js"],"OutletBoundary"] +1a:"$Sreact.suspense" :HL["/litellm-asset-prefix/_next/static/chunks/3f3fa56b5786d58c.css","style"] -0:{"buildId":"U_YrOOnSehrpkdU42KJ-W","rsc":["$","$1","c",{"children":[["$","$L2",null,{"Component":"$3","serverProvidedParams":{"searchParams":{},"params":{},"promises":["$@4","$@5"]}}],[["$","link","0",{"rel":"stylesheet","href":"/litellm-asset-prefix/_next/static/chunks/3f3fa56b5786d58c.css","precedence":"next"}],["$","script","script-0",{"src":"/litellm-asset-prefix/_next/static/chunks/61f59596bf7f0628.js","async":true}],["$","script","script-1",{"src":"/litellm-asset-prefix/_next/static/chunks/9f5ccd929375c1d6.js","async":true}],["$","script","script-2",{"src":"/litellm-asset-prefix/_next/static/chunks/30539b80ac15aad2.js","async":true}],["$","script","script-3",{"src":"/litellm-asset-prefix/_next/static/chunks/142704439974f6b3.js","async":true}],["$","script","script-4",{"src":"/litellm-asset-prefix/_next/static/chunks/8b4fd43197a5dfc8.js","async":true}],["$","script","script-5",{"src":"/litellm-asset-prefix/_next/static/chunks/1fe0596a309ad6cf.js","async":true}],["$","script","script-6",{"src":"/litellm-asset-prefix/_next/static/chunks/7b788dd93ad868b3.js","async":true}],["$","script","script-7",{"src":"/litellm-asset-prefix/_next/static/chunks/c979f252fa5ee77c.js","async":true}],["$","script","script-8",{"src":"/litellm-asset-prefix/_next/static/chunks/50febaabfb896c46.js","async":true}],["$","script","script-9",{"src":"/litellm-asset-prefix/_next/static/chunks/c4cc89d1b0a147d5.js","async":true}],["$","script","script-10",{"src":"/litellm-asset-prefix/_next/static/chunks/fe5201571c777f09.js","async":true}],["$","script","script-11",{"src":"/litellm-asset-prefix/_next/static/chunks/c748f222de4766db.js","async":true}],["$","script","script-12",{"src":"/litellm-asset-prefix/_next/static/chunks/5f9c3b92a016f382.js","async":true}],["$","script","script-13",{"src":"/litellm-asset-prefix/_next/static/chunks/fe750aa0bf04912c.js","async":true}],["$","script","script-14",{"src":"/litellm-asset-prefix/_next/static/chunks/7d4cded1a1238581.js","async":true}],["$","script","script-15",{"src":"/litellm-asset-prefix/_next/static/chunks/d64d74932cb225a3.js","async":true}],["$","script","script-16",{"src":"/litellm-asset-prefix/_next/static/chunks/9ffb8ddd0c9a7c31.js","async":true}],["$","script","script-17",{"src":"/litellm-asset-prefix/_next/static/chunks/c4fe728e74b52958.js","async":true}],["$","script","script-18",{"src":"/litellm-asset-prefix/_next/static/chunks/1532edb438ed84bb.js","async":true}],["$","script","script-19",{"src":"/litellm-asset-prefix/_next/static/chunks/d0d828f9a0668699.js","async":true}],["$","script","script-20",{"src":"/litellm-asset-prefix/_next/static/chunks/88c74f8b4b20d25a.js","async":true}],["$","script","script-21",{"src":"/litellm-asset-prefix/_next/static/chunks/25c5a08661ac2ec3.js","async":true}],["$","script","script-22",{"src":"/litellm-asset-prefix/_next/static/chunks/134f728fa7099e3e.js","async":true}],["$","script","script-23",{"src":"/litellm-asset-prefix/_next/static/chunks/9d6e5aad99b19216.js","async":true}],["$","script","script-24",{"src":"/litellm-asset-prefix/_next/static/chunks/e8718f949e42598e.js","async":true}],["$","script","script-25",{"src":"/litellm-asset-prefix/_next/static/chunks/6a51328383335d1e.js","async":true}],["$","script","script-26",{"src":"/litellm-asset-prefix/_next/static/chunks/3b30ab8eaa03bc21.js","async":true}],["$","script","script-27",{"src":"/litellm-asset-prefix/_next/static/chunks/99cf9cf99df5ccfc.js","async":true}],["$","script","script-28",{"src":"/litellm-asset-prefix/_next/static/chunks/6a4eede876bb5c8f.js","async":true}],["$","script","script-29",{"src":"/litellm-asset-prefix/_next/static/chunks/7e417dd24c8becd0.js","async":true}],["$","script","script-30",{"src":"/litellm-asset-prefix/_next/static/chunks/c7b74067c01ee971.js","async":true}],["$","script","script-31",{"src":"/litellm-asset-prefix/_next/static/chunks/a85adee4198d5478.js","async":true}],["$","script","script-32",{"src":"/litellm-asset-prefix/_next/static/chunks/bff4459534c52f16.js","async":true}],["$","script","script-33",{"src":"/litellm-asset-prefix/_next/static/chunks/39eb5927f56ccc0e.js","async":true}],"$L6","$L7","$L8","$L9","$La","$Lb","$Lc","$Ld","$Le","$Lf","$L10","$L11","$L12","$L13","$L14","$L15","$L16","$L17","$L18","$L19","$L1a"],"$L1b"]}],"loading":null,"isPartial":false} +0:{"buildId":"cbFGTIkRGp63usVNisey9","rsc":["$","$1","c",{"children":[["$","$L2",null,{"Component":"$3","serverProvidedParams":{"searchParams":{},"params":{},"promises":["$@4","$@5"]}}],[["$","link","0",{"rel":"stylesheet","href":"/litellm-asset-prefix/_next/static/chunks/3f3fa56b5786d58c.css","precedence":"next"}],["$","script","script-0",{"src":"/litellm-asset-prefix/_next/static/chunks/db1ebd02d726c50f.js","async":true}],["$","script","script-1",{"src":"/litellm-asset-prefix/_next/static/chunks/142704439974f6b3.js","async":true}],["$","script","script-2",{"src":"/litellm-asset-prefix/_next/static/chunks/30539b80ac15aad2.js","async":true}],["$","script","script-3",{"src":"/litellm-asset-prefix/_next/static/chunks/e55394619917c445.js","async":true}],["$","script","script-4",{"src":"/litellm-asset-prefix/_next/static/chunks/df6665addf8c6036.js","async":true}],["$","script","script-5",{"src":"/litellm-asset-prefix/_next/static/chunks/1fe0596a309ad6cf.js","async":true}],["$","script","script-6",{"src":"/litellm-asset-prefix/_next/static/chunks/9d9e6235c06ebb90.js","async":true}],["$","script","script-7",{"src":"/litellm-asset-prefix/_next/static/chunks/403c4d96324c23a6.js","async":true}],["$","script","script-8",{"src":"/litellm-asset-prefix/_next/static/chunks/308c947b873bf49b.js","async":true}],["$","script","script-9",{"src":"/litellm-asset-prefix/_next/static/chunks/88c74f8b4b20d25a.js","async":true}],["$","script","script-10",{"src":"/litellm-asset-prefix/_next/static/chunks/2d471965761a22ff.js","async":true}],["$","script","script-11",{"src":"/litellm-asset-prefix/_next/static/chunks/6eb81672801a9dec.js","async":true}],["$","script","script-12",{"src":"/litellm-asset-prefix/_next/static/chunks/3b30ab8eaa03bc21.js","async":true}],["$","script","script-13",{"src":"/litellm-asset-prefix/_next/static/chunks/7b788dd93ad868b3.js","async":true}],["$","script","script-14",{"src":"/litellm-asset-prefix/_next/static/chunks/5f9c3b92a016f382.js","async":true}],["$","script","script-15",{"src":"/litellm-asset-prefix/_next/static/chunks/38605193023f8e1c.js","async":true}],["$","script","script-16",{"src":"/litellm-asset-prefix/_next/static/chunks/d0d828f9a0668699.js","async":true}],["$","script","script-17",{"src":"/litellm-asset-prefix/_next/static/chunks/4d3d997560b322ca.js","async":true}],["$","script","script-18",{"src":"/litellm-asset-prefix/_next/static/chunks/4e4d0f466b5c1780.js","async":true}],["$","script","script-19",{"src":"/litellm-asset-prefix/_next/static/chunks/d64d74932cb225a3.js","async":true}],["$","script","script-20",{"src":"/litellm-asset-prefix/_next/static/chunks/3fb7a83546b6aa35.js","async":true}],["$","script","script-21",{"src":"/litellm-asset-prefix/_next/static/chunks/134f728fa7099e3e.js","async":true}],["$","script","script-22",{"src":"/litellm-asset-prefix/_next/static/chunks/9d6e5aad99b19216.js","async":true}],["$","script","script-23",{"src":"/litellm-asset-prefix/_next/static/chunks/bb02cdce134f811b.js","async":true}],["$","script","script-24",{"src":"/litellm-asset-prefix/_next/static/chunks/0f93c304f38c63d0.js","async":true}],["$","script","script-25",{"src":"/litellm-asset-prefix/_next/static/chunks/130b80d41c79d98e.js","async":true}],["$","script","script-26",{"src":"/litellm-asset-prefix/_next/static/chunks/348b31083769a7c4.js","async":true}],["$","script","script-27",{"src":"/litellm-asset-prefix/_next/static/chunks/759173c2a452c43c.js","async":true}],["$","script","script-28",{"src":"/litellm-asset-prefix/_next/static/chunks/4980372eaa37b78b.js","async":true}],["$","script","script-29",{"src":"/litellm-asset-prefix/_next/static/chunks/c81bdad246412686.js","async":true}],["$","script","script-30",{"src":"/litellm-asset-prefix/_next/static/chunks/b6cdb9a433f054f3.js","async":true}],["$","script","script-31",{"src":"/litellm-asset-prefix/_next/static/chunks/a85adee4198d5478.js","async":true}],["$","script","script-32",{"src":"/litellm-asset-prefix/_next/static/chunks/fcdf7322b0aa3e2e.js","async":true}],["$","script","script-33",{"src":"/litellm-asset-prefix/_next/static/chunks/0adb91ab5f3140d5.js","async":true}],"$L6","$L7","$L8","$L9","$La","$Lb","$Lc","$Ld","$Le","$Lf","$L10","$L11","$L12","$L13","$L14","$L15","$L16","$L17"],"$L18"]}],"loading":null,"isPartial":false} 4:{} 5:"$0:rsc:props:children:0:props:serverProvidedParams:params" -6:["$","script","script-34",{"src":"/litellm-asset-prefix/_next/static/chunks/ebb2b2d8175d3d2f.js","async":true}] -7:["$","script","script-35",{"src":"/litellm-asset-prefix/_next/static/chunks/5a5488ab3db0c3de.js","async":true}] +6:["$","script","script-34",{"src":"/litellm-asset-prefix/_next/static/chunks/675f6c62ddae3031.js","async":true}] +7:["$","script","script-35",{"src":"/litellm-asset-prefix/_next/static/chunks/7e417dd24c8becd0.js","async":true}] 8:["$","script","script-36",{"src":"/litellm-asset-prefix/_next/static/chunks/0a65da2cd24e2ab6.js","async":true}] -9:["$","script","script-37",{"src":"/litellm-asset-prefix/_next/static/chunks/82dbdb17d57c6737.js","async":true}] -a:["$","script","script-38",{"src":"/litellm-asset-prefix/_next/static/chunks/b31a08272a82b84e.js","async":true}] -b:["$","script","script-39",{"src":"/litellm-asset-prefix/_next/static/chunks/496b84010c33cf69.js","async":true}] -c:["$","script","script-40",{"src":"/litellm-asset-prefix/_next/static/chunks/eba9ac65320061b1.js","async":true}] -d:["$","script","script-41",{"src":"/litellm-asset-prefix/_next/static/chunks/0eda6dc5d5f35d92.js","async":true}] -e:["$","script","script-42",{"src":"/litellm-asset-prefix/_next/static/chunks/96aed36e606e8582.js","async":true}] -f:["$","script","script-43",{"src":"/litellm-asset-prefix/_next/static/chunks/ad426ab08aee6c64.js","async":true}] -10:["$","script","script-44",{"src":"/litellm-asset-prefix/_next/static/chunks/2971c4658f1bcd7d.js","async":true}] -11:["$","script","script-45",{"src":"/litellm-asset-prefix/_next/static/chunks/06ebe9b0e9cdf241.js","async":true}] -12:["$","script","script-46",{"src":"/litellm-asset-prefix/_next/static/chunks/6c4c97f1ea6e7d77.js","async":true}] -13:["$","script","script-47",{"src":"/litellm-asset-prefix/_next/static/chunks/165d00848f04c4c9.js","async":true}] +9:["$","script","script-37",{"src":"/litellm-asset-prefix/_next/static/chunks/86c1e01d849eed8e.js","async":true}] +a:["$","script","script-38",{"src":"/litellm-asset-prefix/_next/static/chunks/eba9ac65320061b1.js","async":true}] +b:["$","script","script-39",{"src":"/litellm-asset-prefix/_next/static/chunks/85238af541b170ca.js","async":true}] +c:["$","script","script-40",{"src":"/litellm-asset-prefix/_next/static/chunks/8c09c924a98654d1.js","async":true}] +d:["$","script","script-41",{"src":"/litellm-asset-prefix/_next/static/chunks/b13b0ddeb85b5333.js","async":true}] +e:["$","script","script-42",{"src":"/litellm-asset-prefix/_next/static/chunks/2971c4658f1bcd7d.js","async":true}] +f:["$","script","script-43",{"src":"/litellm-asset-prefix/_next/static/chunks/496b84010c33cf69.js","async":true}] +10:["$","script","script-44",{"src":"/litellm-asset-prefix/_next/static/chunks/06ebe9b0e9cdf241.js","async":true}] +11:["$","script","script-45",{"src":"/litellm-asset-prefix/_next/static/chunks/6c4c97f1ea6e7d77.js","async":true}] +12:["$","script","script-46",{"src":"/litellm-asset-prefix/_next/static/chunks/e8718f949e42598e.js","async":true}] +13:["$","script","script-47",{"src":"/litellm-asset-prefix/_next/static/chunks/99cf9cf99df5ccfc.js","async":true}] 14:["$","script","script-48",{"src":"/litellm-asset-prefix/_next/static/chunks/bb0a6e4a3a18721a.js","async":true}] -15:["$","script","script-49",{"src":"/litellm-asset-prefix/_next/static/chunks/4980372eaa37b78b.js","async":true}] -16:["$","script","script-50",{"src":"/litellm-asset-prefix/_next/static/chunks/8ab6e2ca95000c8e.js","async":true}] -17:["$","script","script-51",{"src":"/litellm-asset-prefix/_next/static/chunks/06cdd9bb80c63794.js","async":true}] -18:["$","script","script-52",{"src":"/litellm-asset-prefix/_next/static/chunks/66a190706fc6c35a.js","async":true}] -19:["$","script","script-53",{"src":"/litellm-asset-prefix/_next/static/chunks/54e29148cb2f2582.js","async":true}] -1a:["$","script","script-54",{"src":"/litellm-asset-prefix/_next/static/chunks/fd9de419c8c0222e.js","async":true}] -1b:["$","$L1c",null,{"children":["$","$1d",null,{"name":"Next.MetadataOutlet","children":"$@1e"}]}] -1e:null +15:["$","script","script-49",{"src":"/litellm-asset-prefix/_next/static/chunks/cfca40b1a4a490bf.js","async":true}] +16:["$","script","script-50",{"src":"/litellm-asset-prefix/_next/static/chunks/54e29148cb2f2582.js","async":true}] +17:["$","script","script-51",{"src":"/litellm-asset-prefix/_next/static/chunks/37c03dc421ba81f8.js","async":true}] +18:["$","$L19",null,{"children":["$","$1a",null,{"name":"Next.MetadataOutlet","children":"$@1b"}]}] +1b:null diff --git a/litellm/proxy/_experimental/out/__next._full.txt b/litellm/proxy/_experimental/out/__next._full.txt index 137514a802b..fdd259a09e6 100644 --- a/litellm/proxy/_experimental/out/__next._full.txt +++ b/litellm/proxy/_experimental/out/__next._full.txt @@ -1,63 +1,61 @@ 1:"$Sreact.fragment" -2:I[71195,["/litellm-asset-prefix/_next/static/chunks/26adfa4e8ffc85c7.js","/litellm-asset-prefix/_next/static/chunks/e8ed72789c2b42ff.js"],"default"] -3:I[339756,["/litellm-asset-prefix/_next/static/chunks/d96012bcfc98706a.js","/litellm-asset-prefix/_next/static/chunks/dbca964212122d58.js"],"default"] -4:I[837457,["/litellm-asset-prefix/_next/static/chunks/d96012bcfc98706a.js","/litellm-asset-prefix/_next/static/chunks/dbca964212122d58.js"],"default"] -5:I[347257,["/litellm-asset-prefix/_next/static/chunks/d96012bcfc98706a.js","/litellm-asset-prefix/_next/static/chunks/dbca964212122d58.js"],"ClientPageRoot"] -6:I[952683,["/litellm-asset-prefix/_next/static/chunks/26adfa4e8ffc85c7.js","/litellm-asset-prefix/_next/static/chunks/e8ed72789c2b42ff.js","/litellm-asset-prefix/_next/static/chunks/61f59596bf7f0628.js","/litellm-asset-prefix/_next/static/chunks/9f5ccd929375c1d6.js","/litellm-asset-prefix/_next/static/chunks/30539b80ac15aad2.js","/litellm-asset-prefix/_next/static/chunks/142704439974f6b3.js","/litellm-asset-prefix/_next/static/chunks/8b4fd43197a5dfc8.js","/litellm-asset-prefix/_next/static/chunks/1fe0596a309ad6cf.js","/litellm-asset-prefix/_next/static/chunks/7b788dd93ad868b3.js","/litellm-asset-prefix/_next/static/chunks/c979f252fa5ee77c.js","/litellm-asset-prefix/_next/static/chunks/50febaabfb896c46.js","/litellm-asset-prefix/_next/static/chunks/c4cc89d1b0a147d5.js","/litellm-asset-prefix/_next/static/chunks/fe5201571c777f09.js","/litellm-asset-prefix/_next/static/chunks/c748f222de4766db.js","/litellm-asset-prefix/_next/static/chunks/5f9c3b92a016f382.js","/litellm-asset-prefix/_next/static/chunks/fe750aa0bf04912c.js","/litellm-asset-prefix/_next/static/chunks/7d4cded1a1238581.js","/litellm-asset-prefix/_next/static/chunks/d64d74932cb225a3.js","/litellm-asset-prefix/_next/static/chunks/9ffb8ddd0c9a7c31.js","/litellm-asset-prefix/_next/static/chunks/c4fe728e74b52958.js","/litellm-asset-prefix/_next/static/chunks/1532edb438ed84bb.js","/litellm-asset-prefix/_next/static/chunks/d0d828f9a0668699.js","/litellm-asset-prefix/_next/static/chunks/88c74f8b4b20d25a.js","/litellm-asset-prefix/_next/static/chunks/25c5a08661ac2ec3.js","/litellm-asset-prefix/_next/static/chunks/134f728fa7099e3e.js","/litellm-asset-prefix/_next/static/chunks/9d6e5aad99b19216.js","/litellm-asset-prefix/_next/static/chunks/e8718f949e42598e.js","/litellm-asset-prefix/_next/static/chunks/6a51328383335d1e.js","/litellm-asset-prefix/_next/static/chunks/3b30ab8eaa03bc21.js","/litellm-asset-prefix/_next/static/chunks/99cf9cf99df5ccfc.js","/litellm-asset-prefix/_next/static/chunks/6a4eede876bb5c8f.js","/litellm-asset-prefix/_next/static/chunks/7e417dd24c8becd0.js","/litellm-asset-prefix/_next/static/chunks/c7b74067c01ee971.js","/litellm-asset-prefix/_next/static/chunks/a85adee4198d5478.js","/litellm-asset-prefix/_next/static/chunks/bff4459534c52f16.js","/litellm-asset-prefix/_next/static/chunks/39eb5927f56ccc0e.js","/litellm-asset-prefix/_next/static/chunks/ebb2b2d8175d3d2f.js","/litellm-asset-prefix/_next/static/chunks/5a5488ab3db0c3de.js","/litellm-asset-prefix/_next/static/chunks/0a65da2cd24e2ab6.js","/litellm-asset-prefix/_next/static/chunks/82dbdb17d57c6737.js","/litellm-asset-prefix/_next/static/chunks/b31a08272a82b84e.js","/litellm-asset-prefix/_next/static/chunks/496b84010c33cf69.js","/litellm-asset-prefix/_next/static/chunks/eba9ac65320061b1.js","/litellm-asset-prefix/_next/static/chunks/0eda6dc5d5f35d92.js","/litellm-asset-prefix/_next/static/chunks/96aed36e606e8582.js","/litellm-asset-prefix/_next/static/chunks/ad426ab08aee6c64.js","/litellm-asset-prefix/_next/static/chunks/2971c4658f1bcd7d.js","/litellm-asset-prefix/_next/static/chunks/06ebe9b0e9cdf241.js","/litellm-asset-prefix/_next/static/chunks/6c4c97f1ea6e7d77.js","/litellm-asset-prefix/_next/static/chunks/165d00848f04c4c9.js","/litellm-asset-prefix/_next/static/chunks/bb0a6e4a3a18721a.js","/litellm-asset-prefix/_next/static/chunks/4980372eaa37b78b.js","/litellm-asset-prefix/_next/static/chunks/8ab6e2ca95000c8e.js","/litellm-asset-prefix/_next/static/chunks/06cdd9bb80c63794.js","/litellm-asset-prefix/_next/static/chunks/66a190706fc6c35a.js","/litellm-asset-prefix/_next/static/chunks/54e29148cb2f2582.js","/litellm-asset-prefix/_next/static/chunks/fd9de419c8c0222e.js"],"default"] -32:I[168027,[],"default"] +2:I[867271,["/litellm-asset-prefix/_next/static/chunks/a7f104aa2cc7f3f0.js","/litellm-asset-prefix/_next/static/chunks/e8ed72789c2b42ff.js"],"default"] +3:I[71195,["/litellm-asset-prefix/_next/static/chunks/a7f104aa2cc7f3f0.js","/litellm-asset-prefix/_next/static/chunks/e8ed72789c2b42ff.js"],"default"] +4:I[339756,["/litellm-asset-prefix/_next/static/chunks/d96012bcfc98706a.js","/litellm-asset-prefix/_next/static/chunks/dbca964212122d58.js"],"default"] +5:I[837457,["/litellm-asset-prefix/_next/static/chunks/d96012bcfc98706a.js","/litellm-asset-prefix/_next/static/chunks/dbca964212122d58.js"],"default"] +6:I[347257,["/litellm-asset-prefix/_next/static/chunks/d96012bcfc98706a.js","/litellm-asset-prefix/_next/static/chunks/dbca964212122d58.js"],"ClientPageRoot"] +7:I[952683,["/litellm-asset-prefix/_next/static/chunks/a7f104aa2cc7f3f0.js","/litellm-asset-prefix/_next/static/chunks/e8ed72789c2b42ff.js","/litellm-asset-prefix/_next/static/chunks/db1ebd02d726c50f.js","/litellm-asset-prefix/_next/static/chunks/142704439974f6b3.js","/litellm-asset-prefix/_next/static/chunks/30539b80ac15aad2.js","/litellm-asset-prefix/_next/static/chunks/e55394619917c445.js","/litellm-asset-prefix/_next/static/chunks/df6665addf8c6036.js","/litellm-asset-prefix/_next/static/chunks/1fe0596a309ad6cf.js","/litellm-asset-prefix/_next/static/chunks/9d9e6235c06ebb90.js","/litellm-asset-prefix/_next/static/chunks/403c4d96324c23a6.js","/litellm-asset-prefix/_next/static/chunks/308c947b873bf49b.js","/litellm-asset-prefix/_next/static/chunks/88c74f8b4b20d25a.js","/litellm-asset-prefix/_next/static/chunks/2d471965761a22ff.js","/litellm-asset-prefix/_next/static/chunks/6eb81672801a9dec.js","/litellm-asset-prefix/_next/static/chunks/3b30ab8eaa03bc21.js","/litellm-asset-prefix/_next/static/chunks/7b788dd93ad868b3.js","/litellm-asset-prefix/_next/static/chunks/5f9c3b92a016f382.js","/litellm-asset-prefix/_next/static/chunks/38605193023f8e1c.js","/litellm-asset-prefix/_next/static/chunks/d0d828f9a0668699.js","/litellm-asset-prefix/_next/static/chunks/4d3d997560b322ca.js","/litellm-asset-prefix/_next/static/chunks/4e4d0f466b5c1780.js","/litellm-asset-prefix/_next/static/chunks/d64d74932cb225a3.js","/litellm-asset-prefix/_next/static/chunks/3fb7a83546b6aa35.js","/litellm-asset-prefix/_next/static/chunks/134f728fa7099e3e.js","/litellm-asset-prefix/_next/static/chunks/9d6e5aad99b19216.js","/litellm-asset-prefix/_next/static/chunks/bb02cdce134f811b.js","/litellm-asset-prefix/_next/static/chunks/0f93c304f38c63d0.js","/litellm-asset-prefix/_next/static/chunks/130b80d41c79d98e.js","/litellm-asset-prefix/_next/static/chunks/348b31083769a7c4.js","/litellm-asset-prefix/_next/static/chunks/759173c2a452c43c.js","/litellm-asset-prefix/_next/static/chunks/4980372eaa37b78b.js","/litellm-asset-prefix/_next/static/chunks/c81bdad246412686.js","/litellm-asset-prefix/_next/static/chunks/b6cdb9a433f054f3.js","/litellm-asset-prefix/_next/static/chunks/a85adee4198d5478.js","/litellm-asset-prefix/_next/static/chunks/fcdf7322b0aa3e2e.js","/litellm-asset-prefix/_next/static/chunks/0adb91ab5f3140d5.js","/litellm-asset-prefix/_next/static/chunks/675f6c62ddae3031.js","/litellm-asset-prefix/_next/static/chunks/7e417dd24c8becd0.js","/litellm-asset-prefix/_next/static/chunks/0a65da2cd24e2ab6.js","/litellm-asset-prefix/_next/static/chunks/86c1e01d849eed8e.js","/litellm-asset-prefix/_next/static/chunks/eba9ac65320061b1.js","/litellm-asset-prefix/_next/static/chunks/85238af541b170ca.js","/litellm-asset-prefix/_next/static/chunks/8c09c924a98654d1.js","/litellm-asset-prefix/_next/static/chunks/b13b0ddeb85b5333.js","/litellm-asset-prefix/_next/static/chunks/2971c4658f1bcd7d.js","/litellm-asset-prefix/_next/static/chunks/496b84010c33cf69.js","/litellm-asset-prefix/_next/static/chunks/06ebe9b0e9cdf241.js","/litellm-asset-prefix/_next/static/chunks/6c4c97f1ea6e7d77.js","/litellm-asset-prefix/_next/static/chunks/e8718f949e42598e.js","/litellm-asset-prefix/_next/static/chunks/99cf9cf99df5ccfc.js","/litellm-asset-prefix/_next/static/chunks/bb0a6e4a3a18721a.js","/litellm-asset-prefix/_next/static/chunks/cfca40b1a4a490bf.js","/litellm-asset-prefix/_next/static/chunks/54e29148cb2f2582.js","/litellm-asset-prefix/_next/static/chunks/37c03dc421ba81f8.js"],"default"] +30:I[168027,[],"default"] :HL["/litellm-asset-prefix/_next/static/chunks/4e20891f2fd03463.css","style"] -:HL["/litellm-asset-prefix/_next/static/chunks/6fabf2cec1bd2d6e.css","style"] +:HL["/litellm-asset-prefix/_next/static/chunks/7936c9bd377ea4bf.css","style"] :HL["/litellm-asset-prefix/_next/static/media/83afe278b6a6bb3c-s.p.3a6ba036.woff2","font",{"crossOrigin":"","type":"font/woff2"}] :HL["/litellm-asset-prefix/_next/static/chunks/3f3fa56b5786d58c.css","style"] -0:{"P":null,"b":"U_YrOOnSehrpkdU42KJ-W","c":["",""],"q":"","i":false,"f":[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],[["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/litellm-asset-prefix/_next/static/chunks/4e20891f2fd03463.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","link","1",{"rel":"stylesheet","href":"/litellm-asset-prefix/_next/static/chunks/6fabf2cec1bd2d6e.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","script","script-0",{"src":"/litellm-asset-prefix/_next/static/chunks/26adfa4e8ffc85c7.js","async":true,"nonce":"$undefined"}],["$","script","script-1",{"src":"/litellm-asset-prefix/_next/static/chunks/e8ed72789c2b42ff.js","async":true,"nonce":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"className":"inter_5972bc34-module__OU16Qa__className","children":["$","$L2",null,{"children":["$","$L3",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L4",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":404}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],[]],"forbidden":"$undefined","unauthorized":"$undefined"}]}]}]}]]}],{"children":[["$","$1","c",{"children":[["$","$L5",null,{"Component":"$6","serverProvidedParams":{"searchParams":{},"params":{},"promises":["$@7","$@8"]}}],[["$","link","0",{"rel":"stylesheet","href":"/litellm-asset-prefix/_next/static/chunks/3f3fa56b5786d58c.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","script","script-0",{"src":"/litellm-asset-prefix/_next/static/chunks/61f59596bf7f0628.js","async":true,"nonce":"$undefined"}],["$","script","script-1",{"src":"/litellm-asset-prefix/_next/static/chunks/9f5ccd929375c1d6.js","async":true,"nonce":"$undefined"}],["$","script","script-2",{"src":"/litellm-asset-prefix/_next/static/chunks/30539b80ac15aad2.js","async":true,"nonce":"$undefined"}],["$","script","script-3",{"src":"/litellm-asset-prefix/_next/static/chunks/142704439974f6b3.js","async":true,"nonce":"$undefined"}],["$","script","script-4",{"src":"/litellm-asset-prefix/_next/static/chunks/8b4fd43197a5dfc8.js","async":true,"nonce":"$undefined"}],["$","script","script-5",{"src":"/litellm-asset-prefix/_next/static/chunks/1fe0596a309ad6cf.js","async":true,"nonce":"$undefined"}],["$","script","script-6",{"src":"/litellm-asset-prefix/_next/static/chunks/7b788dd93ad868b3.js","async":true,"nonce":"$undefined"}],["$","script","script-7",{"src":"/litellm-asset-prefix/_next/static/chunks/c979f252fa5ee77c.js","async":true,"nonce":"$undefined"}],["$","script","script-8",{"src":"/litellm-asset-prefix/_next/static/chunks/50febaabfb896c46.js","async":true,"nonce":"$undefined"}],["$","script","script-9",{"src":"/litellm-asset-prefix/_next/static/chunks/c4cc89d1b0a147d5.js","async":true,"nonce":"$undefined"}],["$","script","script-10",{"src":"/litellm-asset-prefix/_next/static/chunks/fe5201571c777f09.js","async":true,"nonce":"$undefined"}],["$","script","script-11",{"src":"/litellm-asset-prefix/_next/static/chunks/c748f222de4766db.js","async":true,"nonce":"$undefined"}],["$","script","script-12",{"src":"/litellm-asset-prefix/_next/static/chunks/5f9c3b92a016f382.js","async":true,"nonce":"$undefined"}],["$","script","script-13",{"src":"/litellm-asset-prefix/_next/static/chunks/fe750aa0bf04912c.js","async":true,"nonce":"$undefined"}],["$","script","script-14",{"src":"/litellm-asset-prefix/_next/static/chunks/7d4cded1a1238581.js","async":true,"nonce":"$undefined"}],["$","script","script-15",{"src":"/litellm-asset-prefix/_next/static/chunks/d64d74932cb225a3.js","async":true,"nonce":"$undefined"}],"$L9","$La","$Lb","$Lc","$Ld","$Le","$Lf","$L10","$L11","$L12","$L13","$L14","$L15","$L16","$L17","$L18","$L19","$L1a","$L1b","$L1c","$L1d","$L1e","$L1f","$L20","$L21","$L22","$L23","$L24","$L25","$L26","$L27","$L28","$L29","$L2a","$L2b","$L2c","$L2d","$L2e","$L2f"],"$L30"]}],{},null,false,false]},null,false,false],"$L31",false]],"m":"$undefined","G":["$32",[]],"S":true} -33:I[897367,["/litellm-asset-prefix/_next/static/chunks/d96012bcfc98706a.js","/litellm-asset-prefix/_next/static/chunks/dbca964212122d58.js"],"OutletBoundary"] -34:"$Sreact.suspense" -36:I[897367,["/litellm-asset-prefix/_next/static/chunks/d96012bcfc98706a.js","/litellm-asset-prefix/_next/static/chunks/dbca964212122d58.js"],"ViewportBoundary"] -38:I[897367,["/litellm-asset-prefix/_next/static/chunks/d96012bcfc98706a.js","/litellm-asset-prefix/_next/static/chunks/dbca964212122d58.js"],"MetadataBoundary"] -9:["$","script","script-16",{"src":"/litellm-asset-prefix/_next/static/chunks/9ffb8ddd0c9a7c31.js","async":true,"nonce":"$undefined"}] -a:["$","script","script-17",{"src":"/litellm-asset-prefix/_next/static/chunks/c4fe728e74b52958.js","async":true,"nonce":"$undefined"}] -b:["$","script","script-18",{"src":"/litellm-asset-prefix/_next/static/chunks/1532edb438ed84bb.js","async":true,"nonce":"$undefined"}] -c:["$","script","script-19",{"src":"/litellm-asset-prefix/_next/static/chunks/d0d828f9a0668699.js","async":true,"nonce":"$undefined"}] -d:["$","script","script-20",{"src":"/litellm-asset-prefix/_next/static/chunks/88c74f8b4b20d25a.js","async":true,"nonce":"$undefined"}] -e:["$","script","script-21",{"src":"/litellm-asset-prefix/_next/static/chunks/25c5a08661ac2ec3.js","async":true,"nonce":"$undefined"}] -f:["$","script","script-22",{"src":"/litellm-asset-prefix/_next/static/chunks/134f728fa7099e3e.js","async":true,"nonce":"$undefined"}] -10:["$","script","script-23",{"src":"/litellm-asset-prefix/_next/static/chunks/9d6e5aad99b19216.js","async":true,"nonce":"$undefined"}] -11:["$","script","script-24",{"src":"/litellm-asset-prefix/_next/static/chunks/e8718f949e42598e.js","async":true,"nonce":"$undefined"}] -12:["$","script","script-25",{"src":"/litellm-asset-prefix/_next/static/chunks/6a51328383335d1e.js","async":true,"nonce":"$undefined"}] -13:["$","script","script-26",{"src":"/litellm-asset-prefix/_next/static/chunks/3b30ab8eaa03bc21.js","async":true,"nonce":"$undefined"}] -14:["$","script","script-27",{"src":"/litellm-asset-prefix/_next/static/chunks/99cf9cf99df5ccfc.js","async":true,"nonce":"$undefined"}] -15:["$","script","script-28",{"src":"/litellm-asset-prefix/_next/static/chunks/6a4eede876bb5c8f.js","async":true,"nonce":"$undefined"}] -16:["$","script","script-29",{"src":"/litellm-asset-prefix/_next/static/chunks/7e417dd24c8becd0.js","async":true,"nonce":"$undefined"}] -17:["$","script","script-30",{"src":"/litellm-asset-prefix/_next/static/chunks/c7b74067c01ee971.js","async":true,"nonce":"$undefined"}] -18:["$","script","script-31",{"src":"/litellm-asset-prefix/_next/static/chunks/a85adee4198d5478.js","async":true,"nonce":"$undefined"}] -19:["$","script","script-32",{"src":"/litellm-asset-prefix/_next/static/chunks/bff4459534c52f16.js","async":true,"nonce":"$undefined"}] -1a:["$","script","script-33",{"src":"/litellm-asset-prefix/_next/static/chunks/39eb5927f56ccc0e.js","async":true,"nonce":"$undefined"}] -1b:["$","script","script-34",{"src":"/litellm-asset-prefix/_next/static/chunks/ebb2b2d8175d3d2f.js","async":true,"nonce":"$undefined"}] -1c:["$","script","script-35",{"src":"/litellm-asset-prefix/_next/static/chunks/5a5488ab3db0c3de.js","async":true,"nonce":"$undefined"}] -1d:["$","script","script-36",{"src":"/litellm-asset-prefix/_next/static/chunks/0a65da2cd24e2ab6.js","async":true,"nonce":"$undefined"}] -1e:["$","script","script-37",{"src":"/litellm-asset-prefix/_next/static/chunks/82dbdb17d57c6737.js","async":true,"nonce":"$undefined"}] -1f:["$","script","script-38",{"src":"/litellm-asset-prefix/_next/static/chunks/b31a08272a82b84e.js","async":true,"nonce":"$undefined"}] -20:["$","script","script-39",{"src":"/litellm-asset-prefix/_next/static/chunks/496b84010c33cf69.js","async":true,"nonce":"$undefined"}] -21:["$","script","script-40",{"src":"/litellm-asset-prefix/_next/static/chunks/eba9ac65320061b1.js","async":true,"nonce":"$undefined"}] -22:["$","script","script-41",{"src":"/litellm-asset-prefix/_next/static/chunks/0eda6dc5d5f35d92.js","async":true,"nonce":"$undefined"}] -23:["$","script","script-42",{"src":"/litellm-asset-prefix/_next/static/chunks/96aed36e606e8582.js","async":true,"nonce":"$undefined"}] -24:["$","script","script-43",{"src":"/litellm-asset-prefix/_next/static/chunks/ad426ab08aee6c64.js","async":true,"nonce":"$undefined"}] -25:["$","script","script-44",{"src":"/litellm-asset-prefix/_next/static/chunks/2971c4658f1bcd7d.js","async":true,"nonce":"$undefined"}] -26:["$","script","script-45",{"src":"/litellm-asset-prefix/_next/static/chunks/06ebe9b0e9cdf241.js","async":true,"nonce":"$undefined"}] -27:["$","script","script-46",{"src":"/litellm-asset-prefix/_next/static/chunks/6c4c97f1ea6e7d77.js","async":true,"nonce":"$undefined"}] -28:["$","script","script-47",{"src":"/litellm-asset-prefix/_next/static/chunks/165d00848f04c4c9.js","async":true,"nonce":"$undefined"}] -29:["$","script","script-48",{"src":"/litellm-asset-prefix/_next/static/chunks/bb0a6e4a3a18721a.js","async":true,"nonce":"$undefined"}] -2a:["$","script","script-49",{"src":"/litellm-asset-prefix/_next/static/chunks/4980372eaa37b78b.js","async":true,"nonce":"$undefined"}] -2b:["$","script","script-50",{"src":"/litellm-asset-prefix/_next/static/chunks/8ab6e2ca95000c8e.js","async":true,"nonce":"$undefined"}] -2c:["$","script","script-51",{"src":"/litellm-asset-prefix/_next/static/chunks/06cdd9bb80c63794.js","async":true,"nonce":"$undefined"}] -2d:["$","script","script-52",{"src":"/litellm-asset-prefix/_next/static/chunks/66a190706fc6c35a.js","async":true,"nonce":"$undefined"}] -2e:["$","script","script-53",{"src":"/litellm-asset-prefix/_next/static/chunks/54e29148cb2f2582.js","async":true,"nonce":"$undefined"}] -2f:["$","script","script-54",{"src":"/litellm-asset-prefix/_next/static/chunks/fd9de419c8c0222e.js","async":true,"nonce":"$undefined"}] -30:["$","$L33",null,{"children":["$","$34",null,{"name":"Next.MetadataOutlet","children":"$@35"}]}] -31:["$","$1","h",{"children":[null,["$","$L36",null,{"children":"$L37"}],["$","div",null,{"hidden":true,"children":["$","$L38",null,{"children":["$","$34",null,{"name":"Next.Metadata","children":"$L39"}]}]}],["$","meta",null,{"name":"next-size-adjust","content":""}]]}] -7:{} -8:"$0:f:0:1:1:children:0:props:children:0:props:serverProvidedParams:params" -37:[["$","meta","0",{"charSet":"utf-8"}],["$","meta","1",{"name":"viewport","content":"width=device-width, initial-scale=1"}]] -3a:I[27201,["/litellm-asset-prefix/_next/static/chunks/d96012bcfc98706a.js","/litellm-asset-prefix/_next/static/chunks/dbca964212122d58.js"],"IconMark"] -35:null -39:[["$","title","0",{"children":"LiteLLM Dashboard"}],["$","meta","1",{"name":"description","content":"LiteLLM Proxy Admin UI"}],["$","link","2",{"rel":"icon","href":"/favicon.ico?favicon.1d32c690.ico","sizes":"48x48","type":"image/x-icon"}],["$","link","3",{"rel":"icon","href":"./favicon.ico"}],["$","$L3a","4",{}]] +0:{"P":null,"b":"cbFGTIkRGp63usVNisey9","c":["",""],"q":"","i":false,"f":[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],[["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/litellm-asset-prefix/_next/static/chunks/4e20891f2fd03463.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","link","1",{"rel":"stylesheet","href":"/litellm-asset-prefix/_next/static/chunks/7936c9bd377ea4bf.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","script","script-0",{"src":"/litellm-asset-prefix/_next/static/chunks/a7f104aa2cc7f3f0.js","async":true,"nonce":"$undefined"}],["$","script","script-1",{"src":"/litellm-asset-prefix/_next/static/chunks/e8ed72789c2b42ff.js","async":true,"nonce":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"className":"inter_5972bc34-module__OU16Qa__className","children":["$","$L2",null,{"children":["$","$L3",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":404}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],[]],"forbidden":"$undefined","unauthorized":"$undefined"}]}]}]}]}]]}],{"children":[["$","$1","c",{"children":[["$","$L6",null,{"Component":"$7","serverProvidedParams":{"searchParams":{},"params":{},"promises":["$@8","$@9"]}}],[["$","link","0",{"rel":"stylesheet","href":"/litellm-asset-prefix/_next/static/chunks/3f3fa56b5786d58c.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","script","script-0",{"src":"/litellm-asset-prefix/_next/static/chunks/db1ebd02d726c50f.js","async":true,"nonce":"$undefined"}],["$","script","script-1",{"src":"/litellm-asset-prefix/_next/static/chunks/142704439974f6b3.js","async":true,"nonce":"$undefined"}],["$","script","script-2",{"src":"/litellm-asset-prefix/_next/static/chunks/30539b80ac15aad2.js","async":true,"nonce":"$undefined"}],["$","script","script-3",{"src":"/litellm-asset-prefix/_next/static/chunks/e55394619917c445.js","async":true,"nonce":"$undefined"}],["$","script","script-4",{"src":"/litellm-asset-prefix/_next/static/chunks/df6665addf8c6036.js","async":true,"nonce":"$undefined"}],["$","script","script-5",{"src":"/litellm-asset-prefix/_next/static/chunks/1fe0596a309ad6cf.js","async":true,"nonce":"$undefined"}],["$","script","script-6",{"src":"/litellm-asset-prefix/_next/static/chunks/9d9e6235c06ebb90.js","async":true,"nonce":"$undefined"}],["$","script","script-7",{"src":"/litellm-asset-prefix/_next/static/chunks/403c4d96324c23a6.js","async":true,"nonce":"$undefined"}],["$","script","script-8",{"src":"/litellm-asset-prefix/_next/static/chunks/308c947b873bf49b.js","async":true,"nonce":"$undefined"}],["$","script","script-9",{"src":"/litellm-asset-prefix/_next/static/chunks/88c74f8b4b20d25a.js","async":true,"nonce":"$undefined"}],["$","script","script-10",{"src":"/litellm-asset-prefix/_next/static/chunks/2d471965761a22ff.js","async":true,"nonce":"$undefined"}],["$","script","script-11",{"src":"/litellm-asset-prefix/_next/static/chunks/6eb81672801a9dec.js","async":true,"nonce":"$undefined"}],["$","script","script-12",{"src":"/litellm-asset-prefix/_next/static/chunks/3b30ab8eaa03bc21.js","async":true,"nonce":"$undefined"}],["$","script","script-13",{"src":"/litellm-asset-prefix/_next/static/chunks/7b788dd93ad868b3.js","async":true,"nonce":"$undefined"}],["$","script","script-14",{"src":"/litellm-asset-prefix/_next/static/chunks/5f9c3b92a016f382.js","async":true,"nonce":"$undefined"}],["$","script","script-15",{"src":"/litellm-asset-prefix/_next/static/chunks/38605193023f8e1c.js","async":true,"nonce":"$undefined"}],"$La","$Lb","$Lc","$Ld","$Le","$Lf","$L10","$L11","$L12","$L13","$L14","$L15","$L16","$L17","$L18","$L19","$L1a","$L1b","$L1c","$L1d","$L1e","$L1f","$L20","$L21","$L22","$L23","$L24","$L25","$L26","$L27","$L28","$L29","$L2a","$L2b","$L2c","$L2d"],"$L2e"]}],{},null,false,false]},null,false,false],"$L2f",false]],"m":"$undefined","G":["$30",[]],"S":true} +31:I[897367,["/litellm-asset-prefix/_next/static/chunks/d96012bcfc98706a.js","/litellm-asset-prefix/_next/static/chunks/dbca964212122d58.js"],"OutletBoundary"] +32:"$Sreact.suspense" +34:I[897367,["/litellm-asset-prefix/_next/static/chunks/d96012bcfc98706a.js","/litellm-asset-prefix/_next/static/chunks/dbca964212122d58.js"],"ViewportBoundary"] +36:I[897367,["/litellm-asset-prefix/_next/static/chunks/d96012bcfc98706a.js","/litellm-asset-prefix/_next/static/chunks/dbca964212122d58.js"],"MetadataBoundary"] +a:["$","script","script-16",{"src":"/litellm-asset-prefix/_next/static/chunks/d0d828f9a0668699.js","async":true,"nonce":"$undefined"}] +b:["$","script","script-17",{"src":"/litellm-asset-prefix/_next/static/chunks/4d3d997560b322ca.js","async":true,"nonce":"$undefined"}] +c:["$","script","script-18",{"src":"/litellm-asset-prefix/_next/static/chunks/4e4d0f466b5c1780.js","async":true,"nonce":"$undefined"}] +d:["$","script","script-19",{"src":"/litellm-asset-prefix/_next/static/chunks/d64d74932cb225a3.js","async":true,"nonce":"$undefined"}] +e:["$","script","script-20",{"src":"/litellm-asset-prefix/_next/static/chunks/3fb7a83546b6aa35.js","async":true,"nonce":"$undefined"}] +f:["$","script","script-21",{"src":"/litellm-asset-prefix/_next/static/chunks/134f728fa7099e3e.js","async":true,"nonce":"$undefined"}] +10:["$","script","script-22",{"src":"/litellm-asset-prefix/_next/static/chunks/9d6e5aad99b19216.js","async":true,"nonce":"$undefined"}] +11:["$","script","script-23",{"src":"/litellm-asset-prefix/_next/static/chunks/bb02cdce134f811b.js","async":true,"nonce":"$undefined"}] +12:["$","script","script-24",{"src":"/litellm-asset-prefix/_next/static/chunks/0f93c304f38c63d0.js","async":true,"nonce":"$undefined"}] +13:["$","script","script-25",{"src":"/litellm-asset-prefix/_next/static/chunks/130b80d41c79d98e.js","async":true,"nonce":"$undefined"}] +14:["$","script","script-26",{"src":"/litellm-asset-prefix/_next/static/chunks/348b31083769a7c4.js","async":true,"nonce":"$undefined"}] +15:["$","script","script-27",{"src":"/litellm-asset-prefix/_next/static/chunks/759173c2a452c43c.js","async":true,"nonce":"$undefined"}] +16:["$","script","script-28",{"src":"/litellm-asset-prefix/_next/static/chunks/4980372eaa37b78b.js","async":true,"nonce":"$undefined"}] +17:["$","script","script-29",{"src":"/litellm-asset-prefix/_next/static/chunks/c81bdad246412686.js","async":true,"nonce":"$undefined"}] +18:["$","script","script-30",{"src":"/litellm-asset-prefix/_next/static/chunks/b6cdb9a433f054f3.js","async":true,"nonce":"$undefined"}] +19:["$","script","script-31",{"src":"/litellm-asset-prefix/_next/static/chunks/a85adee4198d5478.js","async":true,"nonce":"$undefined"}] +1a:["$","script","script-32",{"src":"/litellm-asset-prefix/_next/static/chunks/fcdf7322b0aa3e2e.js","async":true,"nonce":"$undefined"}] +1b:["$","script","script-33",{"src":"/litellm-asset-prefix/_next/static/chunks/0adb91ab5f3140d5.js","async":true,"nonce":"$undefined"}] +1c:["$","script","script-34",{"src":"/litellm-asset-prefix/_next/static/chunks/675f6c62ddae3031.js","async":true,"nonce":"$undefined"}] +1d:["$","script","script-35",{"src":"/litellm-asset-prefix/_next/static/chunks/7e417dd24c8becd0.js","async":true,"nonce":"$undefined"}] +1e:["$","script","script-36",{"src":"/litellm-asset-prefix/_next/static/chunks/0a65da2cd24e2ab6.js","async":true,"nonce":"$undefined"}] +1f:["$","script","script-37",{"src":"/litellm-asset-prefix/_next/static/chunks/86c1e01d849eed8e.js","async":true,"nonce":"$undefined"}] +20:["$","script","script-38",{"src":"/litellm-asset-prefix/_next/static/chunks/eba9ac65320061b1.js","async":true,"nonce":"$undefined"}] +21:["$","script","script-39",{"src":"/litellm-asset-prefix/_next/static/chunks/85238af541b170ca.js","async":true,"nonce":"$undefined"}] +22:["$","script","script-40",{"src":"/litellm-asset-prefix/_next/static/chunks/8c09c924a98654d1.js","async":true,"nonce":"$undefined"}] +23:["$","script","script-41",{"src":"/litellm-asset-prefix/_next/static/chunks/b13b0ddeb85b5333.js","async":true,"nonce":"$undefined"}] +24:["$","script","script-42",{"src":"/litellm-asset-prefix/_next/static/chunks/2971c4658f1bcd7d.js","async":true,"nonce":"$undefined"}] +25:["$","script","script-43",{"src":"/litellm-asset-prefix/_next/static/chunks/496b84010c33cf69.js","async":true,"nonce":"$undefined"}] +26:["$","script","script-44",{"src":"/litellm-asset-prefix/_next/static/chunks/06ebe9b0e9cdf241.js","async":true,"nonce":"$undefined"}] +27:["$","script","script-45",{"src":"/litellm-asset-prefix/_next/static/chunks/6c4c97f1ea6e7d77.js","async":true,"nonce":"$undefined"}] +28:["$","script","script-46",{"src":"/litellm-asset-prefix/_next/static/chunks/e8718f949e42598e.js","async":true,"nonce":"$undefined"}] +29:["$","script","script-47",{"src":"/litellm-asset-prefix/_next/static/chunks/99cf9cf99df5ccfc.js","async":true,"nonce":"$undefined"}] +2a:["$","script","script-48",{"src":"/litellm-asset-prefix/_next/static/chunks/bb0a6e4a3a18721a.js","async":true,"nonce":"$undefined"}] +2b:["$","script","script-49",{"src":"/litellm-asset-prefix/_next/static/chunks/cfca40b1a4a490bf.js","async":true,"nonce":"$undefined"}] +2c:["$","script","script-50",{"src":"/litellm-asset-prefix/_next/static/chunks/54e29148cb2f2582.js","async":true,"nonce":"$undefined"}] +2d:["$","script","script-51",{"src":"/litellm-asset-prefix/_next/static/chunks/37c03dc421ba81f8.js","async":true,"nonce":"$undefined"}] +2e:["$","$L31",null,{"children":["$","$32",null,{"name":"Next.MetadataOutlet","children":"$@33"}]}] +2f:["$","$1","h",{"children":[null,["$","$L34",null,{"children":"$L35"}],["$","div",null,{"hidden":true,"children":["$","$L36",null,{"children":["$","$32",null,{"name":"Next.Metadata","children":"$L37"}]}]}],["$","meta",null,{"name":"next-size-adjust","content":""}]]}] +8:{} +9:"$0:f:0:1:1:children:0:props:children:0:props:serverProvidedParams:params" +35:[["$","meta","0",{"charSet":"utf-8"}],["$","meta","1",{"name":"viewport","content":"width=device-width, initial-scale=1"}]] +38:I[27201,["/litellm-asset-prefix/_next/static/chunks/d96012bcfc98706a.js","/litellm-asset-prefix/_next/static/chunks/dbca964212122d58.js"],"IconMark"] +33:null +37:[["$","title","0",{"children":"LiteLLM Dashboard"}],["$","meta","1",{"name":"description","content":"LiteLLM Proxy Admin UI"}],["$","link","2",{"rel":"icon","href":"/favicon.ico?favicon.1d32c690.ico","sizes":"48x48","type":"image/x-icon"}],["$","link","3",{"rel":"icon","href":"./favicon.ico"}],["$","$L38","4",{}]] diff --git a/litellm/proxy/_experimental/out/__next._head.txt b/litellm/proxy/_experimental/out/__next._head.txt index c38954c59a7..948f9ba24ae 100644 --- a/litellm/proxy/_experimental/out/__next._head.txt +++ b/litellm/proxy/_experimental/out/__next._head.txt @@ -3,4 +3,4 @@ 3:I[897367,["/litellm-asset-prefix/_next/static/chunks/d96012bcfc98706a.js","/litellm-asset-prefix/_next/static/chunks/dbca964212122d58.js"],"MetadataBoundary"] 4:"$Sreact.suspense" 5:I[27201,["/litellm-asset-prefix/_next/static/chunks/d96012bcfc98706a.js","/litellm-asset-prefix/_next/static/chunks/dbca964212122d58.js"],"IconMark"] -0:{"buildId":"U_YrOOnSehrpkdU42KJ-W","rsc":["$","$1","h",{"children":[null,["$","$L2",null,{"children":[["$","meta","0",{"charSet":"utf-8"}],["$","meta","1",{"name":"viewport","content":"width=device-width, initial-scale=1"}]]}],["$","div",null,{"hidden":true,"children":["$","$L3",null,{"children":["$","$4",null,{"name":"Next.Metadata","children":[["$","title","0",{"children":"LiteLLM Dashboard"}],["$","meta","1",{"name":"description","content":"LiteLLM Proxy Admin UI"}],["$","link","2",{"rel":"icon","href":"/favicon.ico?favicon.1d32c690.ico","sizes":"48x48","type":"image/x-icon"}],["$","link","3",{"rel":"icon","href":"./favicon.ico"}],["$","$L5","4",{}]]}]}]}],["$","meta",null,{"name":"next-size-adjust","content":""}]]}],"loading":null,"isPartial":false} +0:{"buildId":"cbFGTIkRGp63usVNisey9","rsc":["$","$1","h",{"children":[null,["$","$L2",null,{"children":[["$","meta","0",{"charSet":"utf-8"}],["$","meta","1",{"name":"viewport","content":"width=device-width, initial-scale=1"}]]}],["$","div",null,{"hidden":true,"children":["$","$L3",null,{"children":["$","$4",null,{"name":"Next.Metadata","children":[["$","title","0",{"children":"LiteLLM Dashboard"}],["$","meta","1",{"name":"description","content":"LiteLLM Proxy Admin UI"}],["$","link","2",{"rel":"icon","href":"/favicon.ico?favicon.1d32c690.ico","sizes":"48x48","type":"image/x-icon"}],["$","link","3",{"rel":"icon","href":"./favicon.ico"}],["$","$L5","4",{}]]}]}]}],["$","meta",null,{"name":"next-size-adjust","content":""}]]}],"loading":null,"isPartial":false} diff --git a/litellm/proxy/_experimental/out/__next._index.txt b/litellm/proxy/_experimental/out/__next._index.txt index 6eba887c4de..3e9f41c5af5 100644 --- a/litellm/proxy/_experimental/out/__next._index.txt +++ b/litellm/proxy/_experimental/out/__next._index.txt @@ -1,7 +1,8 @@ 1:"$Sreact.fragment" -2:I[71195,["/litellm-asset-prefix/_next/static/chunks/26adfa4e8ffc85c7.js","/litellm-asset-prefix/_next/static/chunks/e8ed72789c2b42ff.js"],"default"] -3:I[339756,["/litellm-asset-prefix/_next/static/chunks/d96012bcfc98706a.js","/litellm-asset-prefix/_next/static/chunks/dbca964212122d58.js"],"default"] -4:I[837457,["/litellm-asset-prefix/_next/static/chunks/d96012bcfc98706a.js","/litellm-asset-prefix/_next/static/chunks/dbca964212122d58.js"],"default"] +2:I[867271,["/litellm-asset-prefix/_next/static/chunks/a7f104aa2cc7f3f0.js","/litellm-asset-prefix/_next/static/chunks/e8ed72789c2b42ff.js"],"default"] +3:I[71195,["/litellm-asset-prefix/_next/static/chunks/a7f104aa2cc7f3f0.js","/litellm-asset-prefix/_next/static/chunks/e8ed72789c2b42ff.js"],"default"] +4:I[339756,["/litellm-asset-prefix/_next/static/chunks/d96012bcfc98706a.js","/litellm-asset-prefix/_next/static/chunks/dbca964212122d58.js"],"default"] +5:I[837457,["/litellm-asset-prefix/_next/static/chunks/d96012bcfc98706a.js","/litellm-asset-prefix/_next/static/chunks/dbca964212122d58.js"],"default"] :HL["/litellm-asset-prefix/_next/static/chunks/4e20891f2fd03463.css","style"] -:HL["/litellm-asset-prefix/_next/static/chunks/6fabf2cec1bd2d6e.css","style"] -0:{"buildId":"U_YrOOnSehrpkdU42KJ-W","rsc":["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/litellm-asset-prefix/_next/static/chunks/4e20891f2fd03463.css","precedence":"next"}],["$","link","1",{"rel":"stylesheet","href":"/litellm-asset-prefix/_next/static/chunks/6fabf2cec1bd2d6e.css","precedence":"next"}],["$","script","script-0",{"src":"/litellm-asset-prefix/_next/static/chunks/26adfa4e8ffc85c7.js","async":true}],["$","script","script-1",{"src":"/litellm-asset-prefix/_next/static/chunks/e8ed72789c2b42ff.js","async":true}]],["$","html",null,{"lang":"en","children":["$","body",null,{"className":"inter_5972bc34-module__OU16Qa__className","children":["$","$L2",null,{"children":["$","$L3",null,{"parallelRouterKey":"children","template":["$","$L4",null,{}],"notFound":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":404}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],[]]}]}]}]}]]}],"loading":null,"isPartial":false} +:HL["/litellm-asset-prefix/_next/static/chunks/7936c9bd377ea4bf.css","style"] +0:{"buildId":"cbFGTIkRGp63usVNisey9","rsc":["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/litellm-asset-prefix/_next/static/chunks/4e20891f2fd03463.css","precedence":"next"}],["$","link","1",{"rel":"stylesheet","href":"/litellm-asset-prefix/_next/static/chunks/7936c9bd377ea4bf.css","precedence":"next"}],["$","script","script-0",{"src":"/litellm-asset-prefix/_next/static/chunks/a7f104aa2cc7f3f0.js","async":true}],["$","script","script-1",{"src":"/litellm-asset-prefix/_next/static/chunks/e8ed72789c2b42ff.js","async":true}]],["$","html",null,{"lang":"en","children":["$","body",null,{"className":"inter_5972bc34-module__OU16Qa__className","children":["$","$L2",null,{"children":["$","$L3",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","template":["$","$L5",null,{}],"notFound":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":404}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],[]]}]}]}]}]}]]}],"loading":null,"isPartial":false} diff --git a/litellm/proxy/_experimental/out/__next._tree.txt b/litellm/proxy/_experimental/out/__next._tree.txt index c8f37f85225..c5889da2922 100644 --- a/litellm/proxy/_experimental/out/__next._tree.txt +++ b/litellm/proxy/_experimental/out/__next._tree.txt @@ -1,5 +1,5 @@ :HL["/litellm-asset-prefix/_next/static/chunks/4e20891f2fd03463.css","style"] -:HL["/litellm-asset-prefix/_next/static/chunks/6fabf2cec1bd2d6e.css","style"] +:HL["/litellm-asset-prefix/_next/static/chunks/7936c9bd377ea4bf.css","style"] :HL["/litellm-asset-prefix/_next/static/media/83afe278b6a6bb3c-s.p.3a6ba036.woff2","font",{"crossOrigin":"","type":"font/woff2"}] :HL["/litellm-asset-prefix/_next/static/chunks/3f3fa56b5786d58c.css","style"] -0:{"buildId":"U_YrOOnSehrpkdU42KJ-W","tree":{"name":"","paramType":null,"paramKey":"","hasRuntimePrefetch":false,"slots":{"children":{"name":"__PAGE__","paramType":null,"paramKey":"__PAGE__","hasRuntimePrefetch":false,"slots":null,"isRootLayout":false}},"isRootLayout":true},"staleTime":300} +0:{"buildId":"cbFGTIkRGp63usVNisey9","tree":{"name":"","paramType":null,"paramKey":"","hasRuntimePrefetch":false,"slots":{"children":{"name":"__PAGE__","paramType":null,"paramKey":"__PAGE__","hasRuntimePrefetch":false,"slots":null,"isRootLayout":false}},"isRootLayout":true},"staleTime":300} diff --git a/litellm/proxy/_experimental/out/_next/static/U_YrOOnSehrpkdU42KJ-W/_buildManifest.js b/litellm/proxy/_experimental/out/_next/static/cbFGTIkRGp63usVNisey9/_buildManifest.js similarity index 100% rename from litellm/proxy/_experimental/out/_next/static/U_YrOOnSehrpkdU42KJ-W/_buildManifest.js rename to litellm/proxy/_experimental/out/_next/static/cbFGTIkRGp63usVNisey9/_buildManifest.js diff --git a/litellm/proxy/_experimental/out/_next/static/U_YrOOnSehrpkdU42KJ-W/_clientMiddlewareManifest.json b/litellm/proxy/_experimental/out/_next/static/cbFGTIkRGp63usVNisey9/_clientMiddlewareManifest.json similarity index 100% rename from litellm/proxy/_experimental/out/_next/static/U_YrOOnSehrpkdU42KJ-W/_clientMiddlewareManifest.json rename to litellm/proxy/_experimental/out/_next/static/cbFGTIkRGp63usVNisey9/_clientMiddlewareManifest.json diff --git a/litellm/proxy/_experimental/out/_next/static/U_YrOOnSehrpkdU42KJ-W/_ssgManifest.js b/litellm/proxy/_experimental/out/_next/static/cbFGTIkRGp63usVNisey9/_ssgManifest.js similarity index 100% rename from litellm/proxy/_experimental/out/_next/static/U_YrOOnSehrpkdU42KJ-W/_ssgManifest.js rename to litellm/proxy/_experimental/out/_next/static/cbFGTIkRGp63usVNisey9/_ssgManifest.js diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/0161ddc92cdc26db.js b/litellm/proxy/_experimental/out/_next/static/chunks/0161ddc92cdc26db.js new file mode 100644 index 00000000000..5f62884e297 --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/0161ddc92cdc26db.js @@ -0,0 +1 @@ +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,11751,e=>{"use strict";function t(e){return""===e?null:e}e.s(["mapEmptyStringToNull",()=>t])},525720,e=>{"use strict";e.i(247167);var t=e.i(271645),a=e.i(343794),s=e.i(529681),l=e.i(908286),r=e.i(242064),i=e.i(246422),n=e.i(838378);let o=["wrap","nowrap","wrap-reverse"],d=["flex-start","flex-end","start","end","center","space-between","space-around","space-evenly","stretch","normal","left","right"],c=["center","start","end","flex-start","flex-end","self-start","self-end","baseline","normal","stretch"],m=function(e,t){let s,l,r;return(0,a.default)(Object.assign(Object.assign(Object.assign({},(s=!0===t.wrap?"wrap":t.wrap,{[`${e}-wrap-${s}`]:s&&o.includes(s)})),(l={},c.forEach(a=>{l[`${e}-align-${a}`]=t.align===a}),l[`${e}-align-stretch`]=!t.align&&!!t.vertical,l)),(r={},d.forEach(a=>{r[`${e}-justify-${a}`]=t.justify===a}),r)))},u=(0,i.genStyleHooks)("Flex",e=>{let{paddingXS:t,padding:a,paddingLG:s}=e,l=(0,n.mergeToken)(e,{flexGapSM:t,flexGap:a,flexGapLG:s});return[(e=>{let{componentCls:t}=e;return{[t]:{display:"flex",margin:0,padding:0,"&-vertical":{flexDirection:"column"},"&-rtl":{direction:"rtl"},"&:empty":{display:"none"}}}})(l),(e=>{let{componentCls:t}=e;return{[t]:{"&-gap-small":{gap:e.flexGapSM},"&-gap-middle":{gap:e.flexGap},"&-gap-large":{gap:e.flexGapLG}}}})(l),(e=>{let{componentCls:t}=e,a={};return o.forEach(e=>{a[`${t}-wrap-${e}`]={flexWrap:e}}),a})(l),(e=>{let{componentCls:t}=e,a={};return c.forEach(e=>{a[`${t}-align-${e}`]={alignItems:e}}),a})(l),(e=>{let{componentCls:t}=e,a={};return d.forEach(e=>{a[`${t}-justify-${e}`]={justifyContent:e}}),a})(l)]},()=>({}),{resetStyle:!1});var x=function(e,t){var a={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&0>t.indexOf(s)&&(a[s]=e[s]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var l=0,s=Object.getOwnPropertySymbols(e);lt.indexOf(s[l])&&Object.prototype.propertyIsEnumerable.call(e,s[l])&&(a[s[l]]=e[s[l]]);return a};let p=t.default.forwardRef((e,i)=>{let{prefixCls:n,rootClassName:o,className:d,style:c,flex:p,gap:g,vertical:h=!1,component:j="div",children:y}=e,_=x(e,["prefixCls","rootClassName","className","style","flex","gap","vertical","component","children"]),{flex:f,direction:b,getPrefixCls:v}=t.default.useContext(r.ConfigContext),N=v("flex",n),[k,T,w]=u(N),S=null!=h?h:null==f?void 0:f.vertical,I=(0,a.default)(d,o,null==f?void 0:f.className,N,T,w,m(N,e),{[`${N}-rtl`]:"rtl"===b,[`${N}-gap-${g}`]:(0,l.isPresetSize)(g),[`${N}-vertical`]:S}),C=Object.assign(Object.assign({},null==f?void 0:f.style),c);return p&&(C.flex=p),g&&!(0,l.isPresetSize)(g)&&(C.gap=g),k(t.default.createElement(j,Object.assign({ref:i,className:I,style:C},(0,s.default)(_,["justify","wrap","align"])),y))});e.s(["Flex",0,p],525720)},772345,e=>{"use strict";e.i(247167);var t=e.i(931067),a=e.i(271645);let s={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M168 504.2c1-43.7 10-86.1 26.9-126 17.3-41 42.1-77.7 73.7-109.4S337 212.3 378 195c42.4-17.9 87.4-27 133.9-27s91.5 9.1 133.8 27A341.5 341.5 0 01755 268.8c9.9 9.9 19.2 20.4 27.8 31.4l-60.2 47a8 8 0 003 14.1l175.7 43c5 1.2 9.9-2.6 9.9-7.7l.8-180.9c0-6.7-7.7-10.5-12.9-6.3l-56.4 44.1C765.8 155.1 646.2 92 511.8 92 282.7 92 96.3 275.6 92 503.8a8 8 0 008 8.2h60c4.4 0 7.9-3.5 8-7.8zm756 7.8h-60c-4.4 0-7.9 3.5-8 7.8-1 43.7-10 86.1-26.9 126-17.3 41-42.1 77.8-73.7 109.4A342.45 342.45 0 01512.1 856a342.24 342.24 0 01-243.2-100.8c-9.9-9.9-19.2-20.4-27.8-31.4l60.2-47a8 8 0 00-3-14.1l-175.7-43c-5-1.2-9.9 2.6-9.9 7.7l-.7 181c0 6.7 7.7 10.5 12.9 6.3l56.4-44.1C258.2 868.9 377.8 932 512.2 932c229.2 0 415.5-183.7 419.8-411.8a8 8 0 00-8-8.2z"}}]},name:"sync",theme:"outlined"};var l=e.i(9583),r=a.forwardRef(function(e,r){return a.createElement(l.default,(0,t.default)({},e,{ref:r,icon:s}))});e.s(["SyncOutlined",0,r],772345)},72713,e=>{"use strict";e.i(247167);var t=e.i(931067),a=e.i(271645);let s={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M880 184H712v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H384v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H144c-17.7 0-32 14.3-32 32v664c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V216c0-17.7-14.3-32-32-32zm-40 656H184V460h656v380zM184 392V256h128v48c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-48h256v48c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-48h128v136H184z"}}]},name:"calendar",theme:"outlined"};var l=e.i(9583),r=a.forwardRef(function(e,r){return a.createElement(l.default,(0,t.default)({},e,{ref:r,icon:s}))});e.s(["CalendarOutlined",0,r],72713)},962944,e=>{"use strict";e.i(247167);var t=e.i(931067),a=e.i(271645);let s={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M848 359.3H627.7L825.8 109c4.1-5.3.4-13-6.3-13H436c-2.8 0-5.5 1.5-6.9 4L170 547.5c-3.1 5.3.7 12 6.9 12h174.4l-89.4 357.6c-1.9 7.8 7.5 13.3 13.3 7.7L853.5 373c5.2-4.9 1.7-13.7-5.5-13.7zM378.2 732.5l60.3-241H281.1l189.6-327.4h224.6L487 427.4h211L378.2 732.5z"}}]},name:"thunderbolt",theme:"outlined"};var l=e.i(9583),r=a.forwardRef(function(e,r){return a.createElement(l.default,(0,t.default)({},e,{ref:r,icon:s}))});e.s(["ThunderboltOutlined",0,r],962944)},784647,304911,505022,721929,e=>{"use strict";var t=e.i(843476),a=e.i(464571),s=e.i(898586),l=e.i(592968),r=e.i(770914),i=e.i(312361),n=e.i(525720),o=e.i(447566),d=e.i(772345),c=e.i(955135),m=e.i(646563),u=e.i(771674),x=e.i(948401),p=e.i(72713),g=e.i(637235),h=e.i(962944);e.i(247167);var j=e.i(931067),y=e.i(271645);let _={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M866.9 169.9L527.1 54.1C523 52.7 517.5 52 512 52s-11 .7-15.1 2.1L157.1 169.9c-8.3 2.8-15.1 12.4-15.1 21.2v482.4c0 8.8 5.7 20.4 12.6 25.9L499.3 968c3.5 2.7 8 4.1 12.6 4.1s9.2-1.4 12.6-4.1l344.7-268.6c6.9-5.4 12.6-17 12.6-25.9V191.1c.2-8.8-6.6-18.3-14.9-21.2zM810 654.3L512 886.5 214 654.3V226.7l298-101.6 298 101.6v427.6zm-405.8-201c-3-4.1-7.8-6.6-13-6.6H336c-6.5 0-10.3 7.4-6.5 12.7l126.4 174a16.1 16.1 0 0026 0l212.6-292.7c3.8-5.3 0-12.7-6.5-12.7h-55.2c-5.1 0-10 2.5-13 6.6L468.9 542.4l-64.7-89.1z"}}]},name:"safety-certificate",theme:"outlined"};var f=e.i(9583),b=y.forwardRef(function(e,t){return y.createElement(f.default,(0,j.default)({},e,{ref:t,icon:_}))});let v={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M668.6 320c0-4.4-3.6-8-8-8h-54.5c-3 0-5.8 1.7-7.1 4.4l-84.7 168.8H511l-84.7-168.8a8 8 0 00-7.1-4.4h-55.7c-1.3 0-2.6.3-3.8 1-3.9 2.1-5.3 7-3.2 10.8l103.9 191.6h-57c-4.4 0-8 3.6-8 8v27.1c0 4.4 3.6 8 8 8h76v39h-76c-4.4 0-8 3.6-8 8v27.1c0 4.4 3.6 8 8 8h76V704c0 4.4 3.6 8 8 8h49.9c4.4 0 8-3.6 8-8v-63.5h76.3c4.4 0 8-3.6 8-8v-27.1c0-4.4-3.6-8-8-8h-76.3v-39h76.3c4.4 0 8-3.6 8-8v-27.1c0-4.4-3.6-8-8-8H564l103.7-191.6c.5-1.1.9-2.4.9-3.7zM157.9 504.2a352.7 352.7 0 01103.5-242.4c32.5-32.5 70.3-58.1 112.4-75.9 43.6-18.4 89.9-27.8 137.6-27.8 47.8 0 94.1 9.3 137.6 27.8 42.1 17.8 79.9 43.4 112.4 75.9 10 10 19.3 20.5 27.9 31.4l-50 39.1a8 8 0 003 14.1l156.8 38.3c5 1.2 9.9-2.6 9.9-7.7l.8-161.5c0-6.7-7.7-10.5-12.9-6.3l-47.8 37.4C770.7 146.3 648.6 82 511.5 82 277 82 86.3 270.1 82 503.8a8 8 0 008 8.2h60c4.3 0 7.8-3.5 7.9-7.8zM934 512h-60c-4.3 0-7.9 3.5-8 7.8a352.7 352.7 0 01-103.5 242.4 352.57 352.57 0 01-112.4 75.9c-43.6 18.4-89.9 27.8-137.6 27.8s-94.1-9.3-137.6-27.8a352.57 352.57 0 01-112.4-75.9c-10-10-19.3-20.5-27.9-31.4l49.9-39.1a8 8 0 00-3-14.1l-156.8-38.3c-5-1.2-9.9 2.6-9.9 7.7l-.8 161.7c0 6.7 7.7 10.5 12.9 6.3l47.8-37.4C253.3 877.7 375.4 942 512.5 942 747 942 937.7 753.9 942 520.2a8 8 0 00-8-8.2z"}}]},name:"transaction",theme:"outlined"};var N=y.forwardRef(function(e,t){return y.createElement(f.default,(0,j.default)({},e,{ref:t,icon:v}))}),k=e.i(262218);let{Text:T}=s.Typography;function w({userId:e}){return"default_user_id"===e?(0,t.jsx)(k.Tag,{color:"blue",children:"Default Proxy Admin"}):(0,t.jsx)(T,{children:e})}e.s(["default",()=>w],304911);let{Text:S}=s.Typography;function I({label:e,value:a,icon:s,truncate:l=!1,copyable:i=!1,defaultUserIdCheck:n=!1}){let o=!a,d=n&&"default_user_id"===a,c=d?(0,t.jsx)(w,{userId:a}):(0,t.jsx)(S,{strong:!0,copyable:!!(i&&!o&&!d)&&{tooltips:[`Copy ${e}`,"Copied!"]},ellipsis:l,style:l?{maxWidth:160,display:"block"}:void 0,children:o?"-":a});return(0,t.jsxs)("div",{children:[(0,t.jsxs)(r.Space,{size:4,children:[(0,t.jsx)(S,{type:"secondary",children:s}),(0,t.jsx)(S,{type:"secondary",style:{fontSize:12,textTransform:"uppercase",letterSpacing:"0.05em"},children:e})]}),(0,t.jsx)("div",{children:c})]})}let{Title:C,Text:A}=s.Typography;function F({data:e,onBack:s,onCreateNew:j,onRegenerate:y,onDelete:_,onResetSpend:f,canModifyKey:v=!0,backButtonText:k="Back to Keys",regenerateDisabled:T=!1,regenerateTooltip:w}){return(0,t.jsxs)("div",{children:[j&&(0,t.jsx)("div",{style:{marginBottom:16},children:(0,t.jsx)(a.Button,{type:"primary",icon:(0,t.jsx)(m.PlusOutlined,{}),onClick:j,children:"Create New Key"})}),(0,t.jsx)("div",{style:{marginBottom:16},children:(0,t.jsx)(a.Button,{type:"text",icon:(0,t.jsx)(o.ArrowLeftOutlined,{}),onClick:s,children:k})}),(0,t.jsxs)(n.Flex,{justify:"space-between",align:"start",style:{marginBottom:20},children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(C,{level:3,copyable:{tooltips:["Copy Key Alias","Copied!"]},style:{margin:0},children:e.keyName}),(0,t.jsxs)(A,{type:"secondary",copyable:{text:e.keyId,tooltips:["Copy Key ID","Copied!"]},children:["Key ID: ",e.keyId]})]}),v&&(0,t.jsxs)(r.Space,{children:[(0,t.jsx)(l.Tooltip,{title:w||"",children:(0,t.jsx)("span",{children:(0,t.jsx)(a.Button,{icon:(0,t.jsx)(d.SyncOutlined,{}),onClick:y,disabled:T,children:"Regenerate Key"})})}),f&&(0,t.jsx)(a.Button,{danger:!0,icon:(0,t.jsx)(N,{}),onClick:f,children:"Reset Spend"}),(0,t.jsx)(a.Button,{danger:!0,icon:(0,t.jsx)(c.DeleteOutlined,{}),onClick:_,children:"Delete Key"})]})]}),(0,t.jsxs)(n.Flex,{align:"stretch",gap:40,style:{marginBottom:40},children:[(0,t.jsxs)(r.Space,{direction:"vertical",size:16,children:[(0,t.jsx)(I,{label:"User Email",value:e.userEmail,icon:(0,t.jsx)(x.MailOutlined,{})}),(0,t.jsx)(I,{label:"User ID",value:e.userId,icon:(0,t.jsx)(u.UserOutlined,{}),truncate:!0,copyable:!0,defaultUserIdCheck:!0})]}),(0,t.jsx)(i.Divider,{type:"vertical",style:{height:"auto"}}),(0,t.jsxs)(r.Space,{direction:"vertical",size:16,children:[(0,t.jsx)(I,{label:"Created At",value:e.createdAt,icon:(0,t.jsx)(p.CalendarOutlined,{})}),(0,t.jsx)(I,{label:"Created By",value:e.createdBy,icon:(0,t.jsx)(b,{}),truncate:!0,copyable:!0,defaultUserIdCheck:!0})]}),(0,t.jsx)(i.Divider,{type:"vertical",style:{height:"auto"}}),(0,t.jsxs)(r.Space,{direction:"vertical",size:16,children:[(0,t.jsx)(I,{label:"Last Updated",value:e.lastUpdated,icon:(0,t.jsx)(g.ClockCircleOutlined,{})}),(0,t.jsx)(I,{label:"Last Active",value:e.lastActive,icon:(0,t.jsx)(h.ThunderboltOutlined,{})})]})]})]})}e.s(["KeyInfoHeader",()=>F],784647);var L=e.i(599724),M=e.i(389083),O=e.i(278587);let R=y.forwardRef(function(e,t){return y.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),y.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"}))});e.s(["default",0,({autoRotate:e=!1,rotationInterval:a,lastRotationAt:s,keyRotationAt:l,nextRotationAt:r,variant:i="card",className:n=""})=>{let o=e=>{let t=new Date(e),a=t.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}),s=t.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0});return`${a} at ${s}`},d=(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsx)("div",{className:"space-y-3",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(O.RefreshIcon,{className:"h-4 w-4 text-blue-600"}),(0,t.jsx)(L.Text,{className:"font-semibold text-gray-900",children:"Auto-Rotation"}),(0,t.jsx)(M.Badge,{color:e?"green":"gray",size:"xs",children:e?"Enabled":"Disabled"}),e&&a&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(L.Text,{className:"text-gray-400",children:"•"}),(0,t.jsxs)(L.Text,{className:"text-sm text-gray-600",children:["Every ",a]})]})]})}),(e||s||l||r)&&(0,t.jsxs)("div",{className:"space-y-3",children:[s&&(0,t.jsxs)("div",{className:"flex items-center gap-2 p-3 bg-gray-50 border border-gray-200 rounded-md",children:[(0,t.jsx)(R,{className:"w-4 h-4 text-gray-500"}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)(L.Text,{className:"font-medium text-gray-700",children:"Last Rotation"}),(0,t.jsx)(L.Text,{className:"text-sm text-gray-600",children:o(s)})]})]}),(l||r)&&(0,t.jsxs)("div",{className:"flex items-center gap-2 p-3 bg-gray-50 border border-gray-200 rounded-md",children:[(0,t.jsx)(R,{className:"w-4 h-4 text-gray-500"}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)(L.Text,{className:"font-medium text-gray-700",children:"Next Scheduled Rotation"}),(0,t.jsx)(L.Text,{className:"text-sm text-gray-600",children:o(r||l||"")})]})]}),e&&!s&&!l&&!r&&(0,t.jsxs)("div",{className:"flex items-center gap-2 p-3 bg-gray-50 border border-gray-100 rounded-md",children:[(0,t.jsx)(R,{className:"w-4 h-4 text-gray-500"}),(0,t.jsx)(L.Text,{className:"text-gray-600",children:"No rotation history available"})]})]}),!e&&!s&&!l&&!r&&(0,t.jsxs)("div",{className:"flex items-center gap-2 p-3 bg-gray-50 border border-gray-100 rounded-md",children:[(0,t.jsx)(O.RefreshIcon,{className:"w-4 h-4 text-gray-400"}),(0,t.jsx)(L.Text,{className:"text-gray-600",children:"Auto-rotation is not enabled for this key"})]})]});return"card"===i?(0,t.jsxs)("div",{className:`bg-white border border-gray-200 rounded-lg p-6 ${n}`,children:[(0,t.jsx)("div",{className:"flex items-center gap-2 mb-6",children:(0,t.jsxs)("div",{children:[(0,t.jsx)(L.Text,{className:"font-semibold text-gray-900",children:"Auto-Rotation"}),(0,t.jsx)(L.Text,{className:"text-xs text-gray-500",children:"Automatic key rotation settings and status for this key"})]})}),d]}):(0,t.jsxs)("div",{className:`${n}`,children:[(0,t.jsx)(L.Text,{className:"font-medium text-gray-900 mb-3",children:"Auto-Rotation"}),d]})}],505022);let D=["logging"];e.s(["extractLoggingSettings",0,e=>e&&"object"==typeof e&&Array.isArray(e.logging)?e.logging:[],"formatMetadataForDisplay",0,(e,t=2)=>JSON.stringify(e&&"object"==typeof e?Object.fromEntries(Object.entries(e).filter(([e])=>!D.includes(e))):{},null,t),"stripTagsFromMetadata",0,e=>{if(!e||"object"!=typeof e)return e;let{tags:t,...a}=e;return a}],721929)},643449,e=>{"use strict";var t=e.i(843476),a=e.i(599724),s=e.i(389083),l=e.i(810757),r=e.i(477386),i=e.i(557662);e.s(["default",0,function({loggingConfigs:e=[],disabledCallbacks:n=[],variant:o="card",className:d=""}){let c=(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(l.CogIcon,{className:"h-4 w-4 text-blue-600"}),(0,t.jsx)(a.Text,{className:"font-semibold text-gray-900",children:"Logging Integrations"}),(0,t.jsx)(s.Badge,{color:"blue",size:"xs",children:e.length})]}),e.length>0?(0,t.jsx)("div",{className:"space-y-3",children:e.map((e,r)=>{var n;let o=(n=e.callback_name,Object.entries(i.callback_map).find(([e,t])=>t===n)?.[0]||n),d=i.callbackInfo[o]?.logo;return(0,t.jsxs)("div",{className:"flex items-center justify-between p-3 rounded-lg bg-blue-50 border border-blue-200",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[d?(0,t.jsx)("img",{src:d,alt:o,className:"w-5 h-5 object-contain"}):(0,t.jsx)(l.CogIcon,{className:"h-5 w-5 text-gray-400"}),(0,t.jsxs)("div",{children:[(0,t.jsx)(a.Text,{className:"font-medium text-blue-800",children:o}),(0,t.jsxs)(a.Text,{className:"text-xs text-blue-600",children:[Object.keys(e.callback_vars).length," parameters configured"]})]})]}),(0,t.jsx)(s.Badge,{color:(e=>{switch(e){case"success":return"green";case"failure":return"red";case"success_and_failure":return"blue";default:return"gray"}})(e.callback_type),size:"sm",children:(e=>{switch(e){case"success":return"Success Only";case"failure":return"Failure Only";case"success_and_failure":return"Success & Failure";default:return e}})(e.callback_type)})]},r)})}):(0,t.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-50 border border-gray-200",children:[(0,t.jsx)(l.CogIcon,{className:"h-4 w-4 text-gray-400"}),(0,t.jsx)(a.Text,{className:"text-gray-500 text-sm",children:"No logging integrations configured"})]})]}),(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(r.BanIcon,{className:"h-4 w-4 text-red-600"}),(0,t.jsx)(a.Text,{className:"font-semibold text-gray-900",children:"Disabled Callbacks"}),(0,t.jsx)(s.Badge,{color:"red",size:"xs",children:n.length})]}),n.length>0?(0,t.jsx)("div",{className:"space-y-3",children:n.map((e,l)=>{let n=i.reverse_callback_map[e]||e,o=i.callbackInfo[n]?.logo;return(0,t.jsxs)("div",{className:"flex items-center justify-between p-3 rounded-lg bg-red-50 border border-red-200",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[o?(0,t.jsx)("img",{src:o,alt:n,className:"w-5 h-5 object-contain"}):(0,t.jsx)(r.BanIcon,{className:"h-5 w-5 text-gray-400"}),(0,t.jsxs)("div",{children:[(0,t.jsx)(a.Text,{className:"font-medium text-red-800",children:n}),(0,t.jsx)(a.Text,{className:"text-xs text-red-600",children:"Disabled for this key"})]})]}),(0,t.jsx)(s.Badge,{color:"red",size:"sm",children:"Disabled"})]},l)})}):(0,t.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-50 border border-gray-200",children:[(0,t.jsx)(r.BanIcon,{className:"h-4 w-4 text-gray-400"}),(0,t.jsx)(a.Text,{className:"text-gray-500 text-sm",children:"No callbacks disabled"})]})]})]});return"card"===o?(0,t.jsxs)("div",{className:`bg-white border border-gray-200 rounded-lg p-6 ${d}`,children:[(0,t.jsx)("div",{className:"flex items-center gap-2 mb-6",children:(0,t.jsxs)("div",{children:[(0,t.jsx)(a.Text,{className:"font-semibold text-gray-900",children:"Logging Settings"}),(0,t.jsx)(a.Text,{className:"text-xs text-gray-500",children:"Active logging integrations and disabled callbacks for this key"})]})}),c]}):(0,t.jsxs)("div",{className:`${d}`,children:[(0,t.jsx)(a.Text,{className:"font-medium text-gray-900 mb-3",children:"Logging Settings"}),c]})}])},65932,690284,e=>{"use strict";var t=e.i(954616),a=e.i(912598),s=e.i(764205),l=e.i(135214),r=e.i(207082);let i=async(e,t)=>{let a=(0,s.getProxyBaseUrl)(),l=`${a?`${a}/key/${t}/reset_spend`:`/key/${t}/reset_spend`}`,r=await fetch(l,{method:"POST",headers:{[(0,s.getGlobalLitellmHeaderName)()]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({reset_to:0})});if(!r.ok){let e=await r.json(),t=(0,s.deriveErrorMessage)(e);throw(0,s.handleError)(t),Error(t)}return r.json()};e.s(["useResetKeySpend",0,()=>{let{accessToken:e}=(0,l.default)(),s=(0,a.useQueryClient)();return(0,t.useMutation)({mutationFn:async t=>{if(!e)throw Error("Access token is required");return i(e,t)},onSuccess:()=>{s.invalidateQueries({queryKey:r.keyKeys.all})}})}],65932);var n=e.i(843476),o=e.i(994388),d=e.i(309426),c=e.i(350967),m=e.i(599724),u=e.i(779241),x=e.i(629569),p=e.i(808613),g=e.i(28651),h=e.i(212931),j=e.i(439189),y=e.i(497245),_=e.i(96226),f=e.i(435684);function b(e,t){let{years:a=0,months:s=0,weeks:l=0,days:r=0,hours:i=0,minutes:n=0,seconds:o=0}=t,d=(0,f.toDate)(e),c=s||a?(0,y.addMonths)(d,s+12*a):d,m=r||l?(0,j.addDays)(c,r+7*l):c;return(0,_.constructFrom)(e,m.getTime()+1e3*(o+60*(n+60*i)))}var v=e.i(271645),N=e.i(237016),k=e.i(727749);function T({selectedToken:e,visible:t,onClose:a,onKeyUpdate:r}){let{accessToken:i}=(0,l.default)(),[j]=p.Form.useForm(),[y,_]=(0,v.useState)(null),[f,T]=(0,v.useState)(null),[w,S]=(0,v.useState)(null),[I,C]=(0,v.useState)(!1),[A,F]=(0,v.useState)(!1),[L,M]=(0,v.useState)(null);(0,v.useEffect)(()=>{t&&e&&i&&(j.setFieldsValue({key_alias:e.key_alias,max_budget:e.max_budget,tpm_limit:e.tpm_limit,rpm_limit:e.rpm_limit,duration:e.duration||"",grace_period:""}),M(i),F(e.key_name===i))},[t,e,j,i]),(0,v.useEffect)(()=>{t||(_(null),C(!1),F(!1),M(null),j.resetFields())},[t,j]);let O=e=>{if(!e)return null;try{let t,a=new Date;if(e.endsWith("s"))t=b(a,{seconds:parseInt(e)});else if(e.endsWith("h"))t=b(a,{hours:parseInt(e)});else if(e.endsWith("d"))t=b(a,{days:parseInt(e)});else throw Error("Invalid duration format");return t.toLocaleString()}catch(e){return null}};(0,v.useEffect)(()=>{f?.duration?S(O(f.duration)):S(null)},[f?.duration]);let R=async()=>{if(e&&L){C(!0);try{let t=await j.validateFields(),a=await (0,s.regenerateKeyCall)(L,e.token||e.token_id,t);_(a.key),k.default.success("Virtual Key regenerated successfully"),console.log("Full regenerate response:",a);let l={token:a.token||a.key_id||e.token,key_name:a.key,max_budget:t.max_budget,tpm_limit:t.tpm_limit,rpm_limit:t.rpm_limit,expires:t.duration?O(t.duration):e.expires,...a};console.log("Updated key data with new token:",l),r&&r(l),C(!1)}catch(e){console.error("Error regenerating key:",e),k.default.fromBackend(e),C(!1)}}},D=()=>{_(null),C(!1),F(!1),M(null),j.resetFields(),a()};return(0,n.jsx)(h.Modal,{title:"Regenerate Virtual Key",open:t,onCancel:D,footer:y?[(0,n.jsx)(o.Button,{onClick:D,children:"Close"},"close")]:[(0,n.jsx)(o.Button,{onClick:D,className:"mr-2",children:"Cancel"},"cancel"),(0,n.jsx)(o.Button,{onClick:R,disabled:I,children:I?"Regenerating...":"Regenerate"},"regenerate")],children:y?(0,n.jsxs)(c.Grid,{numItems:1,className:"gap-2 w-full",children:[(0,n.jsx)(x.Title,{children:"Regenerated Key"}),(0,n.jsx)(d.Col,{numColSpan:1,children:(0,n.jsxs)("p",{children:["Please replace your old key with the new key generated. For security reasons,"," ",(0,n.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,n.jsxs)(d.Col,{numColSpan:1,children:[(0,n.jsx)(m.Text,{className:"mt-3",children:"Key Alias:"}),(0,n.jsx)("div",{className:"bg-gray-100 p-2 rounded mb-2",children:(0,n.jsx)("pre",{className:"break-words whitespace-normal",children:e?.key_alias||"No alias set"})}),(0,n.jsx)(m.Text,{className:"mt-3",children:"New Virtual Key:"}),(0,n.jsx)("div",{className:"bg-gray-100 p-2 rounded mb-2",children:(0,n.jsx)("pre",{className:"break-words whitespace-normal",children:y})}),(0,n.jsx)(N.CopyToClipboard,{text:y,onCopy:()=>k.default.success("Virtual Key copied to clipboard"),children:(0,n.jsx)(o.Button,{className:"mt-3",children:"Copy Virtual Key"})})]})]}):(0,n.jsxs)(p.Form,{form:j,layout:"vertical",onValuesChange:e=>{"duration"in e&&T(t=>({...t,duration:e.duration}))},children:[(0,n.jsx)(p.Form.Item,{name:"key_alias",label:"Key Alias",children:(0,n.jsx)(u.TextInput,{disabled:!0})}),(0,n.jsx)(p.Form.Item,{name:"max_budget",label:"Max Budget (USD)",children:(0,n.jsx)(g.InputNumber,{step:.01,precision:2,style:{width:"100%"}})}),(0,n.jsx)(p.Form.Item,{name:"tpm_limit",label:"TPM Limit",children:(0,n.jsx)(g.InputNumber,{style:{width:"100%"}})}),(0,n.jsx)(p.Form.Item,{name:"rpm_limit",label:"RPM Limit",children:(0,n.jsx)(g.InputNumber,{style:{width:"100%"}})}),(0,n.jsx)(p.Form.Item,{name:"duration",label:"Expire Key (eg: 30s, 30h, 30d)",className:"mt-8",children:(0,n.jsx)(u.TextInput,{placeholder:""})}),(0,n.jsxs)("div",{className:"mt-2 text-sm text-gray-500",children:["Current expiry: ",e?.expires?new Date(e.expires).toLocaleString():"Never"]}),w&&(0,n.jsxs)("div",{className:"mt-2 text-sm text-green-600",children:["New expiry: ",w]}),(0,n.jsx)(p.Form.Item,{name:"grace_period",label:"Grace Period (eg: 24h, 2d)",tooltip:"Keep the old key valid for this duration after rotation. Both keys work during this period for seamless cutover. Empty = immediate revoke.",className:"mt-8",rules:[{pattern:/^(\d+(s|m|h|d|w|mo))?$/,message:"Must be a duration like 30s, 30m, 24h, 2d, 1w, or 1mo"}],children:(0,n.jsx)(u.TextInput,{placeholder:"e.g. 24h, 2d (empty = immediate revoke)"})}),(0,n.jsx)("div",{className:"mt-2 text-sm text-gray-500",children:"Recommended: 24h to 72h for production keys to allow seamless client migration."})]})})}e.s(["RegenerateKeyModal",()=>T],690284)},183588,e=>{"use strict";var t=e.i(843476),a=e.i(266484);e.s(["default",0,({value:e,onChange:s,disabledCallbacks:l=[],onDisabledCallbacksChange:r})=>(0,t.jsx)(a.default,{value:e,onChange:s,disabledCallbacks:l,onDisabledCallbacksChange:r})])},20147,e=>{"use strict";var t=e.i(843476),a=e.i(135214),s=e.i(510674),l=e.i(292639),r=e.i(214541),i=e.i(500330),n=e.i(11751),o=e.i(530212),d=e.i(389083),c=e.i(994388),m=e.i(304967),u=e.i(350967),x=e.i(197647),p=e.i(653824),g=e.i(881073),h=e.i(404206),j=e.i(723731),y=e.i(599724),_=e.i(629569),f=e.i(808613),b=e.i(212931),v=e.i(262218),N=e.i(784647),k=e.i(271645),T=e.i(708347),w=e.i(557662),S=e.i(505022),I=e.i(127952),C=e.i(721929),A=e.i(643449),F=e.i(727749),L=e.i(764205),M=e.i(65932),O=e.i(384767),R=e.i(690284),D=e.i(190702),E=e.i(891547),B=e.i(921511),P=e.i(827252),$=e.i(779241),K=e.i(311451),U=e.i(199133),V=e.i(790848),z=e.i(592968),G=e.i(552130),W=e.i(9314),H=e.i(392110),q=e.i(844565),J=e.i(939510),Q=e.i(75921),Y=e.i(390605),X=e.i(702597),Z=e.i(435451),ee=e.i(183588),et=e.i(916940);function ea({keyData:e,onCancel:a,onSubmit:r,teams:i,accessToken:n,userID:o,userRole:d,premiumUser:m=!1}){let u=m||null!=d&&T.rolesWithWriteAccess.includes(d),[x]=f.Form.useForm(),[p,g]=(0,k.useState)([]),[h,j]=(0,k.useState)({}),y=i?.find(t=>t.team_id===e.team_id),[_,b]=(0,k.useState)([]),[v,N]=(0,k.useState)(Array.isArray(e.metadata?.litellm_disabled_callbacks)?(0,w.mapInternalToDisplayNames)(e.metadata.litellm_disabled_callbacks):[]),[S,I]=(0,k.useState)(e.auto_rotate||!1),[A,M]=(0,k.useState)(e.rotation_interval||""),[O,R]=(0,k.useState)(!1),{data:D}=(0,s.useProjects)(),{data:ea}=(0,l.useUISettings)(),es=!!ea?.values?.enable_projects_ui,el=!!e.project_id,er=(()=>{if(!e.project_id)return null;let t=D?.find(t=>t.project_id===e.project_id);return t?.project_alias?`${t.project_alias} (${e.project_id})`:e.project_id})();(0,k.useEffect)(()=>{let t=async()=>{if(o&&d&&n)try{if(null===e.team_id){let e=(await (0,L.modelAvailableCall)(n,o,d)).data.map(e=>e.id);b(e)}else if(y?.team_id){let e=await (0,X.fetchTeamModels)(o,d,n,y.team_id);b(Array.from(new Set([...y.models,...e])))}}catch(e){console.error("Error fetching models:",e)}};(async()=>{if(n)try{let e=await (0,L.getPromptsList)(n);g(e.prompts.map(e=>e.prompt_id))}catch(e){console.error("Failed to fetch prompts:",e)}})(),t()},[o,d,n,y,e.team_id]),(0,k.useEffect)(()=>{x.setFieldValue("disabled_callbacks",v)},[x,v]);let ei=e=>e&&({"24h":"daily","7d":"weekly","30d":"monthly"})[e]||null,en={...e,token:e.token||e.token_id,budget_duration:ei(e.budget_duration),metadata:(0,C.formatMetadataForDisplay)((0,C.stripTagsFromMetadata)(e.metadata)),guardrails:e.metadata?.guardrails,disable_global_guardrails:e.metadata?.disable_global_guardrails||!1,prompts:e.metadata?.prompts,tags:e.metadata?.tags,vector_stores:e.object_permission?.vector_stores||[],mcp_servers_and_groups:{servers:e.object_permission?.mcp_servers||[],accessGroups:e.object_permission?.mcp_access_groups||[]},mcp_tool_permissions:e.object_permission?.mcp_tool_permissions||{},agents_and_groups:{agents:e.object_permission?.agents||[],accessGroups:e.object_permission?.agent_access_groups||[]},logging_settings:(0,C.extractLoggingSettings)(e.metadata),disabled_callbacks:Array.isArray(e.metadata?.litellm_disabled_callbacks)?(0,w.mapInternalToDisplayNames)(e.metadata.litellm_disabled_callbacks):[],access_group_ids:e.access_group_ids||[],auto_rotate:e.auto_rotate||!1,...e.rotation_interval&&{rotation_interval:e.rotation_interval},allowed_routes:Array.isArray(e.allowed_routes)&&e.allowed_routes.length>0?e.allowed_routes.join(", "):""};(0,k.useEffect)(()=>{x.setFieldsValue({...e,token:e.token||e.token_id,budget_duration:ei(e.budget_duration),metadata:(0,C.formatMetadataForDisplay)((0,C.stripTagsFromMetadata)(e.metadata)),guardrails:e.metadata?.guardrails,disable_global_guardrails:e.metadata?.disable_global_guardrails||!1,prompts:e.metadata?.prompts,tags:e.metadata?.tags,vector_stores:e.object_permission?.vector_stores||[],mcp_servers_and_groups:{servers:e.object_permission?.mcp_servers||[],accessGroups:e.object_permission?.mcp_access_groups||[]},mcp_tool_permissions:e.object_permission?.mcp_tool_permissions||{},logging_settings:(0,C.extractLoggingSettings)(e.metadata),disabled_callbacks:Array.isArray(e.metadata?.litellm_disabled_callbacks)?(0,w.mapInternalToDisplayNames)(e.metadata.litellm_disabled_callbacks):[],access_group_ids:e.access_group_ids||[],auto_rotate:e.auto_rotate||!1,...e.rotation_interval&&{rotation_interval:e.rotation_interval},allowed_routes:Array.isArray(e.allowed_routes)&&e.allowed_routes.length>0?e.allowed_routes.join(", "):""})},[e,x]),(0,k.useEffect)(()=>{x.setFieldValue("auto_rotate",S)},[S,x]),(0,k.useEffect)(()=>{A&&x.setFieldValue("rotation_interval",A)},[A,x]),(0,k.useEffect)(()=>{(async()=>{if(n)try{let e=await (0,L.tagListCall)(n);j(e)}catch(e){F.default.fromBackend("Error fetching tags: "+e)}})()},[n]);let eo=async e=>{try{if(R(!0),"string"==typeof e.allowed_routes){let t=e.allowed_routes.trim();""===t?e.allowed_routes=[]:e.allowed_routes=t.split(",").map(e=>e.trim()).filter(e=>e.length>0)}await r(e)}finally{R(!1)}};return(0,t.jsxs)(f.Form,{form:x,onFinish:eo,initialValues:en,layout:"vertical",children:[(0,t.jsx)(f.Form.Item,{label:"Key Alias",name:"key_alias",children:(0,t.jsx)($.TextInput,{})}),(0,t.jsx)(f.Form.Item,{label:"Models",name:"models",children:(0,t.jsx)(f.Form.Item,{noStyle:!0,shouldUpdate:(e,t)=>e.allowed_routes!==t.allowed_routes||e.models!==t.models,children:({getFieldValue:e,setFieldValue:a})=>{let s=e("allowed_routes")||"",l="string"==typeof s&&""!==s.trim()?s.split(",").map(e=>e.trim()).filter(e=>e.length>0):[],r=l.includes("management_routes")||l.includes("info_routes"),i=e("models")||[];return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(U.Select,{mode:"multiple",placeholder:"Select models",style:{width:"100%"},disabled:r,value:r?[]:i,onChange:e=>a("models",e),children:[_.length>0&&(0,t.jsx)(U.Select.Option,{value:"all-team-models",children:"All Team Models"}),_.map(e=>(0,t.jsx)(U.Select.Option,{value:e,children:e},e))]}),r&&(0,t.jsx)("div",{style:{fontSize:"11px",color:"#6b7280",marginTop:"2px"},children:"Models field is disabled for this key type"})]})}})}),(0,t.jsx)(f.Form.Item,{label:"Key Type",children:(0,t.jsx)(f.Form.Item,{noStyle:!0,shouldUpdate:(e,t)=>e.allowed_routes!==t.allowed_routes,children:({getFieldValue:e,setFieldValue:a})=>{var s;let l=e("allowed_routes")||"",r=(s="string"==typeof l&&""!==l.trim()?l.split(",").map(e=>e.trim()).filter(e=>e.length>0):[])&&0!==s.length?s.includes("llm_api_routes")?"llm_api":s.includes("management_routes")?"management":s.includes("info_routes")?"read_only":"default":"default";return(0,t.jsxs)(U.Select,{placeholder:"Select key type",style:{width:"100%"},optionLabelProp:"label",value:r,onChange:e=>{switch(e){case"default":a("allowed_routes","");break;case"llm_api":a("allowed_routes","llm_api_routes");break;case"management":a("allowed_routes","management_routes"),a("models",[])}},children:[(0,t.jsx)(U.Select.Option,{value:"default",label:"Default",children:(0,t.jsxs)("div",{style:{padding:"4px 0"},children:[(0,t.jsx)("div",{style:{fontWeight:500},children:"Default"}),(0,t.jsx)("div",{style:{fontSize:"11px",color:"#6b7280",marginTop:"2px"},children:"Can call AI APIs + Management routes"})]})}),(0,t.jsx)(U.Select.Option,{value:"llm_api",label:"AI APIs",children:(0,t.jsxs)("div",{style:{padding:"4px 0"},children:[(0,t.jsx)("div",{style:{fontWeight:500},children:"AI APIs"}),(0,t.jsx)("div",{style:{fontSize:"11px",color:"#6b7280",marginTop:"2px"},children:"Can call only AI API routes (chat/completions, embeddings, etc.)"})]})}),(0,t.jsx)(U.Select.Option,{value:"management",label:"Management",children:(0,t.jsxs)("div",{style:{padding:"4px 0"},children:[(0,t.jsx)("div",{style:{fontWeight:500},children:"Management"}),(0,t.jsx)("div",{style:{fontSize:"11px",color:"#6b7280",marginTop:"2px"},children:"Can call only management routes (user/team/key management)"})]})})]})}})}),(0,t.jsx)(f.Form.Item,{label:(0,t.jsxs)("span",{children:["Allowed Routes"," ",(0,t.jsx)(z.Tooltip,{title:"List of allowed routes for the key (comma-separated). Can be specific routes (e.g., '/chat/completions') or route patterns (e.g., 'llm_api_routes', 'management_routes', '/keys/*'). Leave empty to allow all routes.",children:(0,t.jsx)(P.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"allowed_routes",children:(0,t.jsx)(K.Input,{placeholder:"Enter allowed routes (comma-separated). Special values: llm_api_routes, management_routes. Examples: llm_api_routes, /chat/completions, /keys/*. Leave empty to allow all routes"})}),(0,t.jsx)(f.Form.Item,{label:"Max Budget (USD)",name:"max_budget",children:(0,t.jsx)(Z.default,{step:.01,style:{width:"100%"},placeholder:"Enter a numerical value"})}),(0,t.jsx)(f.Form.Item,{label:"Reset Budget",name:"budget_duration",children:(0,t.jsxs)(U.Select,{placeholder:"n/a",children:[(0,t.jsx)(U.Select.Option,{value:"daily",children:"Daily"}),(0,t.jsx)(U.Select.Option,{value:"weekly",children:"Weekly"}),(0,t.jsx)(U.Select.Option,{value:"monthly",children:"Monthly"})]})}),(0,t.jsx)(f.Form.Item,{label:"TPM Limit",name:"tpm_limit",children:(0,t.jsx)(Z.default,{min:0})}),(0,t.jsx)(J.default,{type:"tpm",name:"tpm_limit_type",showDetailedDescriptions:!1}),(0,t.jsx)(f.Form.Item,{label:"RPM Limit",name:"rpm_limit",children:(0,t.jsx)(Z.default,{min:0})}),(0,t.jsx)(J.default,{type:"rpm",name:"rpm_limit_type",showDetailedDescriptions:!1}),(0,t.jsx)(f.Form.Item,{label:"Max Parallel Requests",name:"max_parallel_requests",children:(0,t.jsx)(Z.default,{min:0})}),(0,t.jsx)(f.Form.Item,{label:"Model TPM Limit",name:"model_tpm_limit",children:(0,t.jsx)(K.Input.TextArea,{rows:4,placeholder:'{"gpt-4": 100, "claude-v1": 200}'})}),(0,t.jsx)(f.Form.Item,{label:"Model RPM Limit",name:"model_rpm_limit",children:(0,t.jsx)(K.Input.TextArea,{rows:4,placeholder:'{"gpt-4": 100, "claude-v1": 200}'})}),(0,t.jsx)(f.Form.Item,{label:"Guardrails",name:"guardrails",children:n&&(0,t.jsx)(E.default,{onChange:e=>{x.setFieldValue("guardrails",e)},accessToken:n,disabled:!u})}),(0,t.jsx)(f.Form.Item,{label:(0,t.jsxs)("span",{children:["Disable Global Guardrails"," ",(0,t.jsx)(z.Tooltip,{title:"When enabled, this key will bypass any guardrails configured to run on every request (global guardrails)",children:(0,t.jsx)(P.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"disable_global_guardrails",valuePropName:"checked",children:(0,t.jsx)(V.Switch,{disabled:!u,checkedChildren:"Yes",unCheckedChildren:"No"})}),(0,t.jsx)(f.Form.Item,{label:(0,t.jsxs)("span",{children:["Policies"," ",(0,t.jsx)(z.Tooltip,{title:"Apply policies to this key to control guardrails and other settings",children:(0,t.jsx)(P.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"policies",children:n&&(0,t.jsx)(B.default,{onChange:e=>{x.setFieldValue("policies",e)},accessToken:n,disabled:!m})}),(0,t.jsx)(f.Form.Item,{label:"Tags",name:"tags",children:(0,t.jsx)(U.Select,{mode:"tags",style:{width:"100%"},placeholder:"Select or enter tags",options:Object.values(h).map(e=>({value:e.name,label:e.name,title:e.description||e.name}))})}),(0,t.jsx)(f.Form.Item,{label:"Prompts",name:"prompts",children:(0,t.jsx)(z.Tooltip,{title:m?"":"Setting prompts by key is a premium feature",placement:"top",children:(0,t.jsx)(U.Select,{mode:"tags",style:{width:"100%"},disabled:!m,placeholder:m?Array.isArray(e.metadata?.prompts)&&e.metadata.prompts.length>0?`Current: ${e.metadata.prompts.join(", ")}`:"Select or enter prompts":"Premium feature - Upgrade to set prompts by key",options:p.map(e=>({value:e,label:e}))})})}),(0,t.jsx)(f.Form.Item,{label:(0,t.jsxs)("span",{children:["Access Groups"," ",(0,t.jsx)(z.Tooltip,{title:"Assign access groups to this key. Access groups control which models, MCP servers, and agents this key can use",children:(0,t.jsx)(P.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"access_group_ids",children:(0,t.jsx)(W.default,{placeholder:"Select access groups (optional)"})}),(0,t.jsx)(f.Form.Item,{label:"Allowed Pass Through Routes",name:"allowed_passthrough_routes",children:(0,t.jsx)(z.Tooltip,{title:m?"":"Setting allowed pass through routes by key is a premium feature",placement:"top",children:(0,t.jsx)(q.default,{onChange:e=>x.setFieldValue("allowed_passthrough_routes",e),value:x.getFieldValue("allowed_passthrough_routes"),accessToken:n||"",placeholder:m?Array.isArray(e.metadata?.allowed_passthrough_routes)&&e.metadata.allowed_passthrough_routes.length>0?`Current: ${e.metadata.allowed_passthrough_routes.join(", ")}`:"Select or enter allowed pass through routes":"Premium feature - Upgrade to set allowed pass through routes by key",disabled:!m})})}),(0,t.jsx)(f.Form.Item,{label:"Vector Stores",name:"vector_stores",children:(0,t.jsx)(et.default,{onChange:e=>x.setFieldValue("vector_stores",e),value:x.getFieldValue("vector_stores"),accessToken:n||"",placeholder:"Select vector stores"})}),(0,t.jsx)(f.Form.Item,{label:"MCP Servers / Access Groups",name:"mcp_servers_and_groups",children:(0,t.jsx)(Q.default,{onChange:e=>x.setFieldValue("mcp_servers_and_groups",e),value:x.getFieldValue("mcp_servers_and_groups"),accessToken:n||"",placeholder:"Select MCP servers or access groups (optional)"})}),(0,t.jsx)(f.Form.Item,{name:"mcp_tool_permissions",initialValue:{},hidden:!0,children:(0,t.jsx)(K.Input,{type:"hidden"})}),(0,t.jsx)(f.Form.Item,{noStyle:!0,shouldUpdate:(e,t)=>e.mcp_servers_and_groups!==t.mcp_servers_and_groups||e.mcp_tool_permissions!==t.mcp_tool_permissions,children:()=>(0,t.jsx)("div",{className:"mb-6",children:(0,t.jsx)(Y.default,{accessToken:n||"",selectedServers:x.getFieldValue("mcp_servers_and_groups")?.servers||[],toolPermissions:x.getFieldValue("mcp_tool_permissions")||{},onChange:e=>x.setFieldsValue({mcp_tool_permissions:e})})})}),(0,t.jsx)(f.Form.Item,{label:"Agents / Access Groups",name:"agents_and_groups",children:(0,t.jsx)(G.default,{onChange:e=>x.setFieldValue("agents_and_groups",e),value:x.getFieldValue("agents_and_groups"),accessToken:n||"",placeholder:"Select agents or access groups (optional)"})}),(0,t.jsx)(f.Form.Item,{label:"Team ID",name:"team_id",help:es&&el?"Team is locked because this key belongs to a project":void 0,children:(0,t.jsx)(U.Select,{placeholder:"Select team",showSearch:!0,disabled:es&&el,style:{width:"100%"},filterOption:(e,t)=>{let a=i?.find(e=>e.team_id===t?.value);return!!a&&(a.team_alias?.toLowerCase().includes(e.toLowerCase())??!1)},children:i?.map(e=>(0,t.jsx)(U.Select.Option,{value:e.team_id,children:`${e.team_alias} (${e.team_id})`},e.team_id))})}),es&&el&&(0,t.jsx)(f.Form.Item,{label:"Project",children:(0,t.jsx)(K.Input,{value:er??"",disabled:!0})}),(0,t.jsx)(f.Form.Item,{label:"Logging Settings",name:"logging_settings",children:(0,t.jsx)(ee.default,{value:x.getFieldValue("logging_settings"),onChange:e=>x.setFieldValue("logging_settings",e),disabledCallbacks:v,onDisabledCallbacksChange:e=>{N((0,w.mapInternalToDisplayNames)(e)),x.setFieldValue("disabled_callbacks",e)}})}),(0,t.jsx)(f.Form.Item,{label:"Metadata",name:"metadata",children:(0,t.jsx)(K.Input.TextArea,{rows:10})}),(0,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsx)(H.default,{form:x,autoRotationEnabled:S,onAutoRotationChange:I,rotationInterval:A,onRotationIntervalChange:M}),(0,t.jsx)(f.Form.Item,{name:"duration",hidden:!0,initialValue:"",children:(0,t.jsx)(K.Input,{})})]}),(0,t.jsx)(f.Form.Item,{name:"token",hidden:!0,children:(0,t.jsx)(K.Input,{})}),(0,t.jsx)(f.Form.Item,{name:"disabled_callbacks",hidden:!0,children:(0,t.jsx)(K.Input,{})}),(0,t.jsx)(f.Form.Item,{name:"auto_rotate",hidden:!0,children:(0,t.jsx)(K.Input,{})}),(0,t.jsx)(f.Form.Item,{name:"rotation_interval",hidden:!0,children:(0,t.jsx)(K.Input,{})}),(0,t.jsx)("div",{className:"sticky z-10 bg-white p-4 border-t border-gray-200 bottom-[-1.5rem] inset-x-[-1.5rem]",children:(0,t.jsxs)("div",{className:"flex justify-end items-center gap-2",children:[(0,t.jsx)(c.Button,{variant:"secondary",onClick:a,disabled:O,children:"Cancel"}),(0,t.jsx)(c.Button,{type:"submit",loading:O,children:"Save Changes"})]})})]})}function es({onClose:e,keyData:E,teams:B,onKeyDataUpdate:P,onDelete:$,backButtonText:K="Back to Keys"}){let U,{accessToken:V,userId:z,userRole:G,premiumUser:W}=(0,a.default)(),H=W||null!=G&&T.rolesWithWriteAccess.includes(G),{teams:q}=(0,r.default)(),{data:J}=(0,s.useProjects)(),{data:Q}=(0,l.useUISettings)(),Y=!!Q?.values?.enable_projects_ui,[X,Z]=(0,k.useState)(!1),[ee]=f.Form.useForm(),[et,es]=(0,k.useState)(!1),[el,er]=(0,k.useState)(!1),[ei,en]=(0,k.useState)(""),[eo,ed]=(0,k.useState)(!1),[ec,em]=(0,k.useState)(!1),{mutate:eu,isPending:ex}=(0,M.useResetKeySpend)(),[ep,eg]=(0,k.useState)(E),[eh,ej]=(0,k.useState)(null),[ey,e_]=(0,k.useState)(!1),[ef,eb]=(0,k.useState)({}),[ev,eN]=(0,k.useState)(!1);if((0,k.useEffect)(()=>{E&&eg(E)},[E]),(0,k.useEffect)(()=>{(async()=>{let e=ep?.metadata?.policies;if(!V||!e||!Array.isArray(e)||0===e.length)return;eN(!0);let t={};try{await Promise.all(e.map(async e=>{try{let a=await (0,L.getPolicyInfoWithGuardrails)(V,e);t[e]=a.resolved_guardrails||[]}catch(a){console.error(`Failed to fetch guardrails for policy ${e}:`,a),t[e]=[]}})),eb(t)}catch(e){console.error("Failed to fetch policy guardrails:",e)}finally{eN(!1)}})()},[V,ep?.metadata?.policies]),(0,k.useEffect)(()=>{if(ey){let e=setTimeout(()=>{e_(!1)},5e3);return()=>clearTimeout(e)}},[ey]),!ep)return(0,t.jsxs)("div",{className:"p-4",children:[(0,t.jsx)(c.Button,{icon:o.ArrowLeftIcon,variant:"light",onClick:e,className:"mb-4",children:K}),(0,t.jsx)(y.Text,{children:"Key not found"})]});let ek=async e=>{try{if(!V)return;let t=e.token;if(e.key=t,H||(delete e.guardrails,delete e.prompts),e.max_budget=(0,n.mapEmptyStringToNull)(e.max_budget),void 0!==e.vector_stores&&(e.object_permission={...ep.object_permission,vector_stores:e.vector_stores||[]},delete e.vector_stores),void 0!==e.mcp_servers_and_groups){let{servers:t,accessGroups:a}=e.mcp_servers_and_groups||{servers:[],accessGroups:[]};e.object_permission={...ep.object_permission,mcp_servers:t||[],mcp_access_groups:a||[]},delete e.mcp_servers_and_groups}if(void 0!==e.mcp_tool_permissions){let t=e.mcp_tool_permissions||{};Object.keys(t).length>0&&(e.object_permission={...e.object_permission,mcp_tool_permissions:t}),delete e.mcp_tool_permissions}if(void 0!==e.agents_and_groups){let{agents:t,accessGroups:a}=e.agents_and_groups||{agents:[],accessGroups:[]};e.object_permission={...e.object_permission,agents:t||[],agent_access_groups:a||[]},delete e.agents_and_groups}if(e.max_budget=(0,n.mapEmptyStringToNull)(e.max_budget),e.tpm_limit=(0,n.mapEmptyStringToNull)(e.tpm_limit),e.rpm_limit=(0,n.mapEmptyStringToNull)(e.rpm_limit),e.max_parallel_requests=(0,n.mapEmptyStringToNull)(e.max_parallel_requests),e.metadata&&"string"==typeof e.metadata)try{let t=JSON.parse(e.metadata);"tags"in t&&delete t.tags,e.metadata={...t,...Array.isArray(e.tags)&&e.tags.length>0?{tags:e.tags}:{},...e.guardrails?.length>0?{guardrails:e.guardrails}:{},...Array.isArray(e.logging_settings)&&e.logging_settings.length>0?{logging:e.logging_settings}:{},...e.disabled_callbacks?.length>0?{litellm_disabled_callbacks:(0,w.mapDisplayToInternalNames)(e.disabled_callbacks)}:{}}}catch(e){console.error("Error parsing metadata JSON:",e),F.default.error("Invalid metadata JSON");return}else{let{tags:t,...a}=e.metadata||{};e.metadata={...a,...Array.isArray(e.tags)&&e.tags.length>0?{tags:e.tags}:{},...e.guardrails?.length>0?{guardrails:e.guardrails}:{},...Array.isArray(e.logging_settings)&&e.logging_settings.length>0?{logging:e.logging_settings}:{},...e.disabled_callbacks?.length>0?{litellm_disabled_callbacks:(0,w.mapDisplayToInternalNames)(e.disabled_callbacks)}:{}}}"tags"in e&&delete e.tags,delete e.logging_settings,e.budget_duration&&(e.budget_duration=({daily:"24h",weekly:"7d",monthly:"30d"})[e.budget_duration]);let a=await (0,L.keyUpdateCall)(V,e);eg(e=>e?{...e,...a}:void 0),P&&P(a),F.default.success("Key updated successfully"),Z(!1)}catch(e){F.default.fromBackend((0,D.parseErrorMessage)(e)),console.error("Error updating key:",e)}},eT=async()=>{try{if(er(!0),!V)return;await (0,L.keyDeleteCall)(V,ep.token||ep.token_id),F.default.success("Key deleted successfully"),$&&$(),e()}catch(e){console.error("Error deleting the key:",e),F.default.fromBackend(e)}finally{er(!1),es(!1),en("")}},ew=e=>{let t=new Date(e),a=t.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}),s=t.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0});return`${a} at ${s}`},eS=(0,T.isProxyAdminRole)(G||"")||q&&(0,T.isUserTeamAdminForSingleTeam)(q?.filter(e=>e.team_id===ep.team_id)[0]?.members_with_roles,z||"")||z===ep.user_id&&"Internal Viewer"!==G,eI=(0,T.isProxyAdminRole)(G||"")||q&&(0,T.isUserTeamAdminForSingleTeam)(q?.filter(e=>e.team_id===ep.team_id)[0]?.members_with_roles,z||"");return(0,t.jsxs)("div",{className:"w-full h-screen p-4",children:[(0,t.jsx)(N.KeyInfoHeader,{data:{keyName:ep.key_alias||"Virtual Key",keyId:ep.token_id||ep.token,userId:ep.user_id||"",userEmail:ep.user_email||"",createdBy:ep.user_email||ep.user_id||"",createdAt:ep.created_at?ew(ep.created_at):"",lastUpdated:ep.updated_at?ew(ep.updated_at):"",lastActive:ep.last_active?ew(ep.last_active):"Never"},onBack:e,onRegenerate:()=>ed(!0),onDelete:()=>es(!0),onResetSpend:eI?()=>em(!0):void 0,canModifyKey:eS,backButtonText:K,regenerateDisabled:!W,regenerateTooltip:W?void 0:"This is a LiteLLM Enterprise feature, and requires a valid key to use."}),(0,t.jsx)(R.RegenerateKeyModal,{selectedToken:ep,visible:eo,onClose:()=>ed(!1),onKeyUpdate:e=>{eg(t=>{if(t)return{...t,...e,created_at:new Date().toLocaleString()}}),ej(new Date),e_(!0),P&&P({...e,created_at:new Date().toLocaleString()})}}),(0,t.jsx)(I.default,{isOpen:et,title:"Delete Key",alertMessage:"This action is irreversible and will immediately revoke access for any applications using this key.",message:"Are you sure you want to delete this Virtual Key?",resourceInformationTitle:"Key Information",resourceInformation:[{label:"Key Alias",value:ep?.key_alias||"-"},{label:"Key ID",value:ep?.token_id||ep?.token||"-",code:!0},{label:"Team ID",value:ep?.team_id||"-",code:!0},{label:"Spend",value:ep?.spend?`$${(0,i.formatNumberWithCommas)(ep.spend,4)}`:"$0.0000"}],onCancel:()=>{es(!1),en("")},onOk:eT,confirmLoading:el,requiredConfirmation:ep?.key_alias}),(0,t.jsxs)(b.Modal,{title:"Reset Key Spend",open:ec,onOk:()=>{eu(ep.token||ep.token_id,{onSuccess:()=>{eg(e=>e?{...e,spend:0}:void 0),P&&P({spend:0}),F.default.success("Key spend reset to $0"),em(!1)},onError:e=>{F.default.fromBackend((0,D.parseErrorMessage)(e)),console.error("Error resetting key spend:",e)}})},onCancel:()=>em(!1),okText:"Reset",okButtonProps:{danger:!0},confirmLoading:ex,children:[(0,t.jsxs)("p",{children:["Reset spend for ",(0,t.jsx)("strong",{children:ep?.key_alias||ep?.token_id||"this key"})," to"," ",(0,t.jsx)("strong",{children:"$0"}),"?"]}),(0,t.jsxs)("p",{style:{color:"#666",fontSize:"0.875rem",marginTop:8},children:["Current spend: ",(0,t.jsxs)("strong",{children:["$",(0,i.formatNumberWithCommas)(ep.spend,4)]}),". Spend history is preserved in logs. This resets the current period spend counter, the same as an automatic budget reset."]})]}),(0,t.jsxs)(p.TabGroup,{children:[(0,t.jsxs)(g.TabList,{className:"mb-4",children:[(0,t.jsx)(x.Tab,{children:"Overview"}),(0,t.jsx)(x.Tab,{children:"Settings"})]}),(0,t.jsxs)(j.TabPanels,{children:[(0,t.jsx)(h.TabPanel,{children:(0,t.jsxs)(u.Grid,{numItems:1,numItemsSm:2,numItemsLg:3,className:"gap-6",children:[(0,t.jsxs)(m.Card,{children:[(0,t.jsx)(y.Text,{children:"Spend"}),(0,t.jsxs)("div",{className:"mt-2",children:[(0,t.jsxs)(_.Title,{children:["$",(0,i.formatNumberWithCommas)(ep.spend,4)]}),(0,t.jsxs)(y.Text,{children:["of"," ",null!==ep.max_budget?`$${(0,i.formatNumberWithCommas)(ep.max_budget)}`:"Unlimited"]})]})]}),(0,t.jsxs)(m.Card,{children:[(0,t.jsx)(y.Text,{children:"Rate Limits"}),(0,t.jsxs)("div",{className:"mt-2",children:[(0,t.jsxs)(y.Text,{children:["TPM: ",null!==ep.tpm_limit?ep.tpm_limit:"Unlimited"]}),(0,t.jsxs)(y.Text,{children:["RPM: ",null!==ep.rpm_limit?ep.rpm_limit:"Unlimited"]})]})]}),(0,t.jsxs)(m.Card,{children:[(0,t.jsx)(y.Text,{children:"Models"}),(0,t.jsx)("div",{className:"mt-2 flex flex-wrap gap-2",children:ep.models&&ep.models.length>0?ep.models.map((e,a)=>(0,t.jsx)(d.Badge,{color:"red",children:e},a)):(0,t.jsx)(y.Text,{children:"No models specified"})})]}),(0,t.jsx)(m.Card,{children:(0,t.jsx)(O.default,{objectPermission:ep.object_permission,variant:"inline",accessToken:V})}),(0,t.jsxs)(m.Card,{children:[(0,t.jsx)(y.Text,{className:"font-medium mb-3",children:"Guardrails"}),Array.isArray(ep.metadata?.guardrails)&&ep.metadata.guardrails.length>0?(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:ep.metadata.guardrails.map((e,a)=>(0,t.jsx)(d.Badge,{color:"blue",children:e},a))}):(0,t.jsx)(y.Text,{className:"text-gray-500",children:"No guardrails configured"}),"boolean"==typeof ep.metadata?.disable_global_guardrails&&!0===ep.metadata.disable_global_guardrails&&(0,t.jsx)("div",{className:"mt-3 pt-3 border-t border-gray-200",children:(0,t.jsx)(d.Badge,{color:"yellow",children:"Global Guardrails Disabled"})})]}),(0,t.jsxs)(m.Card,{children:[(0,t.jsx)(y.Text,{className:"font-medium mb-3",children:"Policies"}),Array.isArray(ep.metadata?.policies)&&ep.metadata.policies.length>0?(0,t.jsx)("div",{className:"space-y-4",children:ep.metadata.policies.map((e,a)=>(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(d.Badge,{color:"purple",children:e}),ev&&(0,t.jsx)(y.Text,{className:"text-xs text-gray-400",children:"Loading guardrails..."})]}),!ev&&ef[e]&&ef[e].length>0&&(0,t.jsxs)("div",{className:"ml-4 pl-3 border-l-2 border-gray-200",children:[(0,t.jsx)(y.Text,{className:"text-xs text-gray-500 mb-1",children:"Resolved Guardrails:"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-1",children:ef[e].map((e,a)=>(0,t.jsx)(d.Badge,{color:"blue",size:"xs",children:e},a))})]})]},a))}):(0,t.jsx)(y.Text,{className:"text-gray-500",children:"No policies configured"})]}),(0,t.jsx)(A.default,{loggingConfigs:(0,C.extractLoggingSettings)(ep.metadata),disabledCallbacks:Array.isArray(ep.metadata?.litellm_disabled_callbacks)?(0,w.mapInternalToDisplayNames)(ep.metadata.litellm_disabled_callbacks):[],variant:"card"}),(0,t.jsx)(S.default,{autoRotate:ep.auto_rotate,rotationInterval:ep.rotation_interval,lastRotationAt:ep.last_rotation_at,keyRotationAt:ep.key_rotation_at,nextRotationAt:ep.next_rotation_at,variant:"card"})]})}),(0,t.jsx)(h.TabPanel,{children:(0,t.jsxs)(m.Card,{className:"overflow-y-auto max-h-[65vh]",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,t.jsx)(_.Title,{children:"Key Settings"}),!X&&eS&&(0,t.jsx)(c.Button,{onClick:()=>Z(!0),children:"Edit Settings"})]}),X?(0,t.jsx)(ea,{keyData:ep,onCancel:()=>Z(!1),onSubmit:ek,teams:B,accessToken:V,userID:z,userRole:G,premiumUser:W}):(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(y.Text,{className:"font-medium",children:"Key ID"}),(0,t.jsx)(y.Text,{className:"font-mono",children:ep.token_id||ep.token})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(y.Text,{className:"font-medium",children:"Key Alias"}),(0,t.jsx)(y.Text,{children:ep.key_alias||"Not Set"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(y.Text,{className:"font-medium",children:"Secret Key"}),(0,t.jsx)(y.Text,{className:"font-mono",children:ep.key_name})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(y.Text,{className:"font-medium",children:"Team ID"}),(0,t.jsx)(y.Text,{children:ep.team_id||"Not Set"})]}),Y&&(0,t.jsxs)("div",{children:[(0,t.jsx)(y.Text,{className:"font-medium",children:"Project"}),(0,t.jsx)(y.Text,{children:ep.project_id?(U=J?.find(e=>e.project_id===ep.project_id),U?.project_alias?`${U.project_alias} (${ep.project_id})`:ep.project_id):"Not Set"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(y.Text,{className:"font-medium",children:"Organization"}),(0,t.jsx)(y.Text,{children:(ep.organization_id??ep.org_id)||"Not Set"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(y.Text,{className:"font-medium",children:"Created"}),(0,t.jsx)(y.Text,{children:ew(ep.created_at)})]}),eh&&(0,t.jsxs)("div",{children:[(0,t.jsx)(y.Text,{className:"font-medium",children:"Last Regenerated"}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(y.Text,{children:ew(eh)}),(0,t.jsx)(d.Badge,{color:"green",size:"xs",children:"Recent"})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(y.Text,{className:"font-medium",children:"Expires"}),(0,t.jsx)(y.Text,{children:ep.expires?ew(ep.expires):"Never"})]}),(0,t.jsx)(S.default,{autoRotate:ep.auto_rotate,rotationInterval:ep.rotation_interval,lastRotationAt:ep.last_rotation_at,keyRotationAt:ep.key_rotation_at,nextRotationAt:ep.next_rotation_at,variant:"inline",className:"pt-4 border-t border-gray-200"}),(0,t.jsxs)("div",{children:[(0,t.jsx)(y.Text,{className:"font-medium",children:"Spend"}),(0,t.jsxs)(y.Text,{children:["$",(0,i.formatNumberWithCommas)(ep.spend,4)," USD"]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(y.Text,{className:"font-medium",children:"Budget"}),(0,t.jsx)(y.Text,{children:null!==ep.max_budget?`$${(0,i.formatNumberWithCommas)(ep.max_budget,2)}`:"Unlimited"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(y.Text,{className:"font-medium",children:"Tags"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:Array.isArray(ep.metadata?.tags)&&ep.metadata.tags.length>0?ep.metadata.tags.map((e,a)=>(0,t.jsx)("span",{className:"px-2 mr-2 py-1 bg-blue-100 rounded text-xs",children:e},a)):"No tags specified"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(y.Text,{className:"font-medium",children:"Prompts"}),(0,t.jsx)(y.Text,{children:Array.isArray(ep.metadata?.prompts)&&ep.metadata.prompts.length>0?ep.metadata.prompts.map((e,a)=>(0,t.jsx)("span",{className:"px-2 mr-2 py-1 bg-blue-100 rounded text-xs",children:e},a)):"No prompts specified"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(y.Text,{className:"font-medium",children:"Allowed Routes"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:Array.isArray(ep.allowed_routes)&&ep.allowed_routes.length>0?ep.allowed_routes.map((e,a)=>(0,t.jsx)("span",{className:"px-2 py-1 bg-blue-100 rounded text-xs",children:e},a)):(0,t.jsx)(v.Tag,{color:"green",children:"All routes allowed"})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(y.Text,{className:"font-medium",children:"Allowed Pass Through Routes"}),(0,t.jsx)(y.Text,{children:Array.isArray(ep.metadata?.allowed_passthrough_routes)&&ep.metadata.allowed_passthrough_routes.length>0?ep.metadata.allowed_passthrough_routes.map((e,a)=>(0,t.jsx)("span",{className:"px-2 mr-2 py-1 bg-blue-100 rounded text-xs",children:e},a)):"No pass through routes specified"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(y.Text,{className:"font-medium",children:"Disable Global Guardrails"}),(0,t.jsx)(y.Text,{children:ep.metadata?.disable_global_guardrails===!0?(0,t.jsx)(d.Badge,{color:"yellow",children:"Enabled - Global guardrails bypassed"}):(0,t.jsx)(d.Badge,{color:"green",children:"Disabled - Global guardrails active"})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(y.Text,{className:"font-medium",children:"Models"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:ep.models&&ep.models.length>0?ep.models.map((e,a)=>(0,t.jsx)("span",{className:"px-2 py-1 bg-blue-100 rounded text-xs",children:e},a)):(0,t.jsx)(y.Text,{children:"No models specified"})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(y.Text,{className:"font-medium",children:"Rate Limits"}),(0,t.jsxs)(y.Text,{children:["TPM: ",null!==ep.tpm_limit?ep.tpm_limit:"Unlimited"]}),(0,t.jsxs)(y.Text,{children:["RPM: ",null!==ep.rpm_limit?ep.rpm_limit:"Unlimited"]}),(0,t.jsxs)(y.Text,{children:["Max Parallel Requests:"," ",null!==ep.max_parallel_requests?ep.max_parallel_requests:"Unlimited"]}),(0,t.jsxs)(y.Text,{children:["Model TPM Limits:"," ",ep.metadata?.model_tpm_limit?JSON.stringify(ep.metadata.model_tpm_limit):"Unlimited"]}),(0,t.jsxs)(y.Text,{children:["Model RPM Limits:"," ",ep.metadata?.model_rpm_limit?JSON.stringify(ep.metadata.model_rpm_limit):"Unlimited"]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(y.Text,{className:"font-medium",children:"Metadata"}),(0,t.jsx)("pre",{className:"bg-gray-100 p-2 rounded text-xs overflow-auto mt-1",children:(0,C.formatMetadataForDisplay)((0,C.stripTagsFromMetadata)(ep.metadata))})]}),(0,t.jsx)(O.default,{objectPermission:ep.object_permission,variant:"inline",className:"pt-4 border-t border-gray-200",accessToken:V}),(0,t.jsx)(A.default,{loggingConfigs:(0,C.extractLoggingSettings)(ep.metadata),disabledCallbacks:Array.isArray(ep.metadata?.litellm_disabled_callbacks)?(0,w.mapInternalToDisplayNames)(ep.metadata.litellm_disabled_callbacks):[],variant:"inline",className:"pt-4 border-t border-gray-200"})]})]})})]})]})]})}e.s(["default",()=>es],20147)}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/02b4612136350b79.js b/litellm/proxy/_experimental/out/_next/static/chunks/02b4612136350b79.js new file mode 100644 index 00000000000..ef9610cfa93 --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/02b4612136350b79.js @@ -0,0 +1,84 @@ +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,185357,180766,782719,969641,476993,824296,64352,230312,e=>{"use strict";var t,a,l=e.i(843476),r=e.i(808613),i=e.i(311451),s=e.i(212931),n=e.i(199133),o=e.i(262218),d=e.i(898586),c=e.i(464571),m=e.i(271645),u=e.i(727749),p=e.i(764205),g=e.i(770914),x=e.i(515831),h=e.i(175712),f=e.i(646563),y=e.i(519756);let{Text:j}=d.Typography,{Option:_}=n.Select,b=({visible:e,prebuiltPatterns:t,categories:a,selectedPatternName:r,patternAction:i,onPatternNameChange:o,onActionChange:d,onAdd:m,onCancel:u})=>(0,l.jsxs)(s.Modal,{title:"Add prebuilt pattern",open:e,onCancel:u,footer:null,width:800,children:[(0,l.jsxs)(g.Space,{direction:"vertical",style:{width:"100%"},size:"large",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)(j,{strong:!0,children:"Pattern type"}),(0,l.jsx)(n.Select,{placeholder:"Choose pattern type",value:r,onChange:o,style:{width:"100%",marginTop:8},showSearch:!0,filterOption:(e,a)=>{let l=t.find(e=>e.name===a?.value);return!!l&&(l.display_name.toLowerCase().includes(e.toLowerCase())||l.name.toLowerCase().includes(e.toLowerCase()))},children:a.map(e=>{let a=t.filter(t=>t.category===e);return 0===a.length?null:(0,l.jsx)(n.Select.OptGroup,{label:e,children:a.map(e=>(0,l.jsx)(_,{value:e.name,children:e.display_name},e.name))},e)})})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)(j,{strong:!0,children:"Action"}),(0,l.jsx)(j,{type:"secondary",style:{display:"block",marginTop:4,marginBottom:8},children:"Choose what action the guardrail should take when this pattern is detected"}),(0,l.jsxs)(n.Select,{value:i,onChange:d,style:{width:"100%"},children:[(0,l.jsx)(_,{value:"BLOCK",children:"Block"}),(0,l.jsx)(_,{value:"MASK",children:"Mask"})]})]})]}),(0,l.jsxs)("div",{style:{display:"flex",justifyContent:"flex-end",gap:"8px",marginTop:"24px"},children:[(0,l.jsx)(c.Button,{onClick:u,children:"Cancel"}),(0,l.jsx)(c.Button,{type:"primary",onClick:m,children:"Add"})]})]}),{Text:v}=d.Typography,{Option:N}=n.Select,C=({visible:e,patternName:t,patternRegex:a,patternAction:r,onNameChange:o,onRegexChange:d,onActionChange:m,onAdd:u,onCancel:p})=>(0,l.jsxs)(s.Modal,{title:"Add custom regex pattern",open:e,onCancel:p,footer:null,width:800,children:[(0,l.jsxs)(g.Space,{direction:"vertical",style:{width:"100%"},size:"large",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)(v,{strong:!0,children:"Pattern name"}),(0,l.jsx)(i.Input,{placeholder:"e.g., internal_id, employee_code",value:t,onChange:e=>o(e.target.value),style:{marginTop:8}})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)(v,{strong:!0,children:"Regex pattern"}),(0,l.jsx)(i.Input,{placeholder:"e.g., ID-[0-9]{6}",value:a,onChange:e=>d(e.target.value),style:{marginTop:8}}),(0,l.jsx)(v,{type:"secondary",style:{fontSize:12},children:"Enter a valid regular expression to match sensitive data"})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)(v,{strong:!0,children:"Action"}),(0,l.jsx)(v,{type:"secondary",style:{display:"block",marginTop:4,marginBottom:8},children:"Choose what action the guardrail should take when this pattern is detected"}),(0,l.jsxs)(n.Select,{value:r,onChange:m,style:{width:"100%"},children:[(0,l.jsx)(N,{value:"BLOCK",children:"Block"}),(0,l.jsx)(N,{value:"MASK",children:"Mask"})]})]})]}),(0,l.jsxs)("div",{style:{display:"flex",justifyContent:"flex-end",gap:"8px",marginTop:"24px"},children:[(0,l.jsx)(c.Button,{onClick:p,children:"Cancel"}),(0,l.jsx)(c.Button,{type:"primary",onClick:u,children:"Add"})]})]}),{Text:w}=d.Typography,{Option:S}=n.Select,k=({visible:e,keyword:t,action:a,description:r,onKeywordChange:o,onActionChange:d,onDescriptionChange:m,onAdd:u,onCancel:p})=>(0,l.jsxs)(s.Modal,{title:"Add blocked keyword",open:e,onCancel:p,footer:null,width:800,children:[(0,l.jsxs)(g.Space,{direction:"vertical",style:{width:"100%"},size:"large",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)(w,{strong:!0,children:"Keyword"}),(0,l.jsx)(i.Input,{placeholder:"Enter sensitive keyword or phrase",value:t,onChange:e=>o(e.target.value),style:{marginTop:8}})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)(w,{strong:!0,children:"Action"}),(0,l.jsx)(w,{type:"secondary",style:{display:"block",marginTop:4,marginBottom:8},children:"Choose what action the guardrail should take when this keyword is detected"}),(0,l.jsxs)(n.Select,{value:a,onChange:d,style:{width:"100%"},children:[(0,l.jsx)(S,{value:"BLOCK",children:"Block"}),(0,l.jsx)(S,{value:"MASK",children:"Mask"})]})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)(w,{strong:!0,children:"Description (optional)"}),(0,l.jsx)(i.Input.TextArea,{placeholder:"Explain why this keyword is sensitive",value:r,onChange:e=>m(e.target.value),rows:3,style:{marginTop:8}})]})]}),(0,l.jsxs)("div",{style:{display:"flex",justifyContent:"flex-end",gap:"8px",marginTop:"24px"},children:[(0,l.jsx)(c.Button,{onClick:p,children:"Cancel"}),(0,l.jsx)(c.Button,{type:"primary",onClick:u,children:"Add"})]})]});var I=e.i(291542),A=e.i(955135);let{Text:T}=d.Typography,{Option:O}=n.Select,P=({patterns:e,onActionChange:t,onRemove:a})=>{let r=[{title:"Type",dataIndex:"type",key:"type",width:100,render:e=>(0,l.jsx)(o.Tag,{color:"prebuilt"===e?"blue":"green",children:"prebuilt"===e?"Prebuilt":"Custom"})},{title:"Pattern name",dataIndex:"name",key:"name",render:(e,t)=>t.display_name||t.name},{title:"Regex pattern",dataIndex:"pattern",key:"pattern",render:e=>e?(0,l.jsxs)(T,{code:!0,style:{fontSize:12},children:[e.substring(0,40),"..."]}):"-"},{title:"Action",dataIndex:"action",key:"action",width:150,render:(e,a)=>(0,l.jsxs)(n.Select,{value:e,onChange:e=>t(a.id,e),style:{width:120},size:"small",children:[(0,l.jsx)(O,{value:"BLOCK",children:"Block"}),(0,l.jsx)(O,{value:"MASK",children:"Mask"})]})},{title:"",key:"actions",width:100,render:(e,t)=>(0,l.jsx)(c.Button,{type:"text",danger:!0,size:"small",icon:(0,l.jsx)(A.DeleteOutlined,{}),onClick:()=>a(t.id),children:"Delete"})}];return 0===e.length?(0,l.jsx)("div",{style:{textAlign:"center",padding:"40px 0",color:"#999"},children:"No patterns added."}):(0,l.jsx)(I.Table,{dataSource:e,columns:r,rowKey:"id",pagination:!1,size:"small"})},{Text:B}=d.Typography,{Option:L}=n.Select,F=({keywords:e,onActionChange:t,onRemove:a})=>{let r=[{title:"Keyword",dataIndex:"keyword",key:"keyword"},{title:"Action",dataIndex:"action",key:"action",width:150,render:(e,a)=>(0,l.jsxs)(n.Select,{value:e,onChange:e=>t(a.id,"action",e),style:{width:120},size:"small",children:[(0,l.jsx)(L,{value:"BLOCK",children:"Block"}),(0,l.jsx)(L,{value:"MASK",children:"Mask"})]})},{title:"Description",dataIndex:"description",key:"description",render:e=>e||"-"},{title:"",key:"actions",width:100,render:(e,t)=>(0,l.jsx)(c.Button,{type:"text",danger:!0,size:"small",icon:(0,l.jsx)(A.DeleteOutlined,{}),onClick:()=>a(t.id),children:"Delete"})}];return 0===e.length?(0,l.jsx)("div",{style:{textAlign:"center",padding:"40px 0",color:"#999"},children:"No keywords added."}):(0,l.jsx)(I.Table,{dataSource:e,columns:r,rowKey:"id",pagination:!1,size:"small"})};var $=e.i(362024),E=e.i(993914);let{Title:R,Text:M}=d.Typography,{Option:z}=n.Select,G=({availableCategories:e,selectedCategories:t,onCategoryAdd:a,onCategoryRemove:r,onCategoryUpdate:i,accessToken:s,pendingSelection:d,onPendingSelectionChange:u})=>{let[g,x]=m.default.useState(""),y=void 0!==d?d:g,j=u||x,[_,b]=m.default.useState({}),[v,N]=m.default.useState({}),[C,w]=m.default.useState({}),[S,k]=m.default.useState([]),[T,O]=m.default.useState(""),[P,B]=m.default.useState(!1),L=async e=>{if(s&&!_[e]){w(t=>({...t,[e]:!0}));try{let t=await (0,p.getCategoryYaml)(s,e),a=t.yaml_content;if("json"===t.file_type)try{let e=JSON.parse(a);a=JSON.stringify(e,null,2)}catch(t){console.warn(`Failed to format JSON for ${e}:`,t)}b(t=>({...t,[e]:a})),N(a=>({...a,[e]:t.file_type||"yaml"}))}catch(t){console.error(`Failed to fetch content for category ${e}:`,t)}finally{w(t=>({...t,[e]:!1}))}}};m.default.useEffect(()=>{if(y&&s){let e=_[y];if(e)return void O(e);B(!0),console.log(`Fetching content for category: ${y}`,{accessToken:s?"present":"missing"}),(0,p.getCategoryYaml)(s,y).then(e=>{console.log(`Successfully fetched content for ${y}:`,e);let t=e.yaml_content;if("json"===e.file_type)try{let e=JSON.parse(t);t=JSON.stringify(e,null,2)}catch(e){console.warn(`Failed to format JSON for ${y}:`,e)}O(t),b(e=>({...e,[y]:t})),N(t=>({...t,[y]:e.file_type||"yaml"}))}).catch(e=>{console.error(`Failed to fetch preview content for category ${y}:`,e),O("")}).finally(()=>{B(!1)})}else O(""),B(!1)},[y,s]);let F=[{title:"Category",dataIndex:"display_name",key:"display_name",render:(t,a)=>{let r=e.find(e=>e.name===a.category);return(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{style:{fontWeight:500},children:t}),r?.description&&(0,l.jsx)("div",{style:{fontSize:"12px",color:"#888",marginTop:"4px"},children:r.description})]})}},{title:"Action",dataIndex:"action",key:"action",width:150,render:(e,t)=>(0,l.jsxs)(n.Select,{value:e,onChange:e=>i(t.id,"action",e),style:{width:"100%"},children:[(0,l.jsx)(z,{value:"BLOCK",children:(0,l.jsx)(o.Tag,{color:"red",children:"BLOCK"})}),(0,l.jsx)(z,{value:"MASK",children:(0,l.jsx)(o.Tag,{color:"orange",children:"MASK"})})]})},{title:"Severity Threshold",dataIndex:"severity_threshold",key:"severity_threshold",width:180,render:(e,t)=>(0,l.jsxs)(n.Select,{value:e,onChange:e=>i(t.id,"severity_threshold",e),style:{width:"100%"},children:[(0,l.jsx)(z,{value:"low",children:"Low"}),(0,l.jsx)(z,{value:"medium",children:"Medium"}),(0,l.jsx)(z,{value:"high",children:"High"})]})},{title:"",key:"actions",width:80,render:(e,t)=>(0,l.jsx)(c.Button,{icon:(0,l.jsx)(A.DeleteOutlined,{}),onClick:()=>r(t.id),size:"small",children:"Remove"})}],G=e.filter(e=>!t.some(t=>t.category===e.name));return(0,l.jsxs)(h.Card,{title:(0,l.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",flexWrap:"wrap",gap:8},children:[(0,l.jsx)(R,{level:5,style:{margin:0},children:"Blocked topics"}),(0,l.jsx)(M,{type:"secondary",style:{fontSize:12,fontWeight:400},children:"Select topics to block using keyword and semantic analysis"})]}),size:"small",children:[(0,l.jsxs)("div",{style:{marginBottom:16,display:"flex",gap:8},children:[(0,l.jsx)(n.Select,{placeholder:"Select a content category",value:y||void 0,onChange:j,style:{flex:1},showSearch:!0,optionLabelProp:"label",filterOption:(e,t)=>(t?.label?.toString().toLowerCase()??"").includes(e.toLowerCase()),children:G.map(e=>(0,l.jsx)(z,{value:e.name,label:e.display_name,children:(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{style:{fontWeight:500},children:e.display_name}),(0,l.jsx)("div",{style:{fontSize:"12px",color:"#666",marginTop:"2px"},children:e.description})]})},e.name))}),(0,l.jsx)(c.Button,{type:"primary",onClick:()=>{if(!y)return;let l=e.find(e=>e.name===y);!l||t.some(e=>e.category===y)||(a({id:`category-${Date.now()}`,category:l.name,display_name:l.display_name,action:l.default_action,severity_threshold:"medium"}),j(""),O(""))},disabled:!y,icon:(0,l.jsx)(f.PlusOutlined,{}),children:"Add"})]}),y&&(0,l.jsxs)("div",{style:{marginBottom:16,padding:"12px",background:"#f9f9f9",border:"1px solid #e0e0e0",borderRadius:"4px"},children:[(0,l.jsxs)("div",{style:{marginBottom:8,fontWeight:500,fontSize:"14px"},children:["Preview: ",e.find(e=>e.name===y)?.display_name,v[y]&&(0,l.jsxs)("span",{style:{marginLeft:8,fontSize:"12px",color:"#888",fontWeight:400},children:["(",v[y]?.toUpperCase(),")"]})]}),P?(0,l.jsx)("div",{style:{padding:"16px",textAlign:"center",color:"#888"},children:"Loading content..."}):T?(0,l.jsx)("pre",{style:{background:"#fff",padding:"12px",borderRadius:"4px",overflow:"auto",maxHeight:"300px",maxWidth:"100%",fontSize:"12px",lineHeight:"1.5",margin:0,border:"1px solid #e0e0e0",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:(0,l.jsx)("code",{children:T})}):(0,l.jsx)("div",{style:{padding:"8px",textAlign:"center",color:"#888",fontSize:"12px"},children:"Unable to load category content"})]}),t.length>0?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(I.Table,{dataSource:t,columns:F,pagination:!1,size:"small",rowKey:"id"}),(0,l.jsx)("div",{style:{marginTop:16},children:(0,l.jsx)($.Collapse,{activeKey:S,onChange:e=>{let t=Array.isArray(e)?e:e?[e]:[],a=new Set(S);t.forEach(e=>{a.has(e)||_[e]||L(e)}),k(t)},ghost:!0,items:t.map(e=>{let t=(v[e.category]||"yaml").toUpperCase();return{key:e.category,label:(0,l.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8},children:[(0,l.jsx)(E.FileTextOutlined,{}),(0,l.jsxs)("span",{children:["View ",t," for ",e.display_name]})]}),children:C[e.category]?(0,l.jsx)("div",{style:{padding:"16px",textAlign:"center",color:"#888"},children:"Loading content..."}):_[e.category]?(0,l.jsx)("pre",{style:{background:"#f5f5f5",padding:"16px",borderRadius:"4px",overflow:"auto",maxHeight:"400px",fontSize:"12px",lineHeight:"1.5",margin:0},children:(0,l.jsx)("code",{children:_[e.category]})}):(0,l.jsx)("div",{style:{padding:"16px",textAlign:"center",color:"#888"},children:"Content will load when expanded"})}})})})]}):(0,l.jsx)("div",{style:{textAlign:"center",padding:"24px",color:"#888",border:"1px dashed #d9d9d9",borderRadius:"4px"},children:"No blocked topics selected. Add topics to detect and block harmful content."})]})};var D=e.i(790848),K=e.i(28651);let{Title:H,Text:q}=d.Typography,{Option:J}=n.Select,W={competitor_intent_type:"airline",brand_self:[],locations:[],policy:{competitor_comparison:"refuse",possible_competitor_comparison:"reframe"},threshold_high:.7,threshold_medium:.45,threshold_low:.3},U=({enabled:e,config:t,onChange:a,accessToken:i})=>{let s=t??W,[o,d]=(0,m.useState)([]),[c,u]=(0,m.useState)(!1);(0,m.useEffect)(()=>{"airline"===s.competitor_intent_type&&i&&0===o.length&&(u(!0),(0,p.getMajorAirlines)(i).then(e=>d(e.airlines??[])).catch(()=>d([])).finally(()=>u(!1)))},[s.competitor_intent_type,i,o.length]);let x=e=>{a(e,e?{...W}:null)},f=(t,l)=>{a(e,{...s,[t]:l})},y=(t,l)=>{a(e,{...s,policy:{...s.policy,[t]:l}})},j=(t,l)=>{a(e,{...s,[t]:l.filter(Boolean)})};return e?(0,l.jsxs)(h.Card,{title:(0,l.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,l.jsx)(H,{level:5,style:{margin:0},children:"Competitor Intent Filter"}),(0,l.jsx)(D.Switch,{checked:e,onChange:x})]}),size:"small",children:[(0,l.jsx)(q,{type:"secondary",style:{display:"block",marginBottom:16},children:"Block or reframe competitor comparison questions. Airline type uses major airlines (excluding your brand); generic requires manual competitor list."}),(0,l.jsxs)(r.Form,{layout:"vertical",size:"small",children:[(0,l.jsx)(r.Form.Item,{label:"Type",children:(0,l.jsxs)(n.Select,{value:s.competitor_intent_type,onChange:e=>f("competitor_intent_type",e),style:{width:"100%"},children:[(0,l.jsx)(J,{value:"airline",children:"Airline (auto-load competitors from IATA)"}),(0,l.jsx)(J,{value:"generic",children:"Generic (specify competitors manually)"})]})}),(0,l.jsx)(r.Form.Item,{label:"Your Brand (brand_self)",required:!0,help:"airline"===s.competitor_intent_type?"Select your airline from the list (excluded from competitors) or type to add a custom term":"Names/codes users use for your brand",children:(0,l.jsx)(n.Select,{mode:"tags",style:{width:"100%"},placeholder:c?"Loading airlines...":"airline"===s.competitor_intent_type?"Search or select airline, or type to add custom":"Type and press Enter to add",value:s.brand_self,onChange:t=>"airline"===s.competitor_intent_type&&o.length>0?(t=>{let l=t.filter(Boolean),r=[],i=new Set;for(let e of l){let t=o.find(t=>t.match.split("|")[0]?.trim().toLowerCase()===e.toLowerCase());if(t)for(let e of t.match.split("|").map(e=>e.trim().toLowerCase()).filter(Boolean))i.has(e)||(i.add(e),r.push(e));else i.has(e.toLowerCase())||(i.add(e.toLowerCase()),r.push(e))}a(e,{...s,brand_self:r})})(t??[]):j("brand_self",t??[]),tokenSeparators:[","],loading:c,showSearch:!0,filterOption:(e,t)=>(t?.label?.toString().toLowerCase()??"").includes(e.toLowerCase()),optionFilterProp:"label",options:"airline"===s.competitor_intent_type&&o.length>0?o.map(e=>{let t=e.match.split("|")[0]?.trim()??e.id,a=e.match.split("|").map(e=>e.trim().toLowerCase()).filter(Boolean);return{value:t.toLowerCase(),label:`${t}${a.length>1?` (${a.slice(1).join(", ")})`:""}`}}):void 0})}),"airline"===s.competitor_intent_type&&(0,l.jsx)(r.Form.Item,{label:"Locations (optional)",help:"Countries, cities, airports for disambiguation (e.g. qatar, doha)",children:(0,l.jsx)(n.Select,{mode:"tags",style:{width:"100%"},placeholder:"Type and press Enter to add",value:s.locations??[],onChange:e=>j("locations",e??[]),tokenSeparators:[","]})}),"generic"===s.competitor_intent_type&&(0,l.jsx)(r.Form.Item,{label:"Competitors",required:!0,help:"Competitor names to detect (required for generic type)",children:(0,l.jsx)(n.Select,{mode:"tags",style:{width:"100%"},placeholder:"Type and press Enter to add",value:s.competitors??[],onChange:e=>j("competitors",e??[]),tokenSeparators:[","]})}),(0,l.jsx)(r.Form.Item,{label:"Policy: Competitor comparison",children:(0,l.jsxs)(n.Select,{value:s.policy?.competitor_comparison??"refuse",onChange:e=>y("competitor_comparison",e),style:{width:"100%"},children:[(0,l.jsx)(J,{value:"refuse",children:"Refuse (block request)"}),(0,l.jsx)(J,{value:"reframe",children:"Reframe (suggest alternative)"})]})}),(0,l.jsx)(r.Form.Item,{label:"Policy: Possible competitor comparison",children:(0,l.jsxs)(n.Select,{value:s.policy?.possible_competitor_comparison??"reframe",onChange:e=>y("possible_competitor_comparison",e),style:{width:"100%"},children:[(0,l.jsx)(J,{value:"refuse",children:"Refuse (block request)"}),(0,l.jsx)(J,{value:"reframe",children:"Reframe (suggest alternative to backend LLM)"})]})}),(0,l.jsx)(r.Form.Item,{label:"Confidence thresholds",help:(0,l.jsxs)(l.Fragment,{children:["Classify competitor intent by confidence (0–1). Higher confidence → stronger intent.",(0,l.jsxs)("ul",{style:{marginBottom:0,marginTop:4,paddingLeft:20},children:[(0,l.jsxs)("li",{children:[(0,l.jsx)("strong",{children:"High (≥)"}),': Treat as full competitor comparison → uses "Competitor comparison" policy']}),(0,l.jsxs)("li",{children:[(0,l.jsx)("strong",{children:"Medium (≥)"}),': Treat as possible comparison → uses "Possible competitor comparison" policy']}),(0,l.jsxs)("li",{children:[(0,l.jsx)("strong",{children:"Low (≥)"}),": Log only; allow request. Below Low → allow with no action"]})]}),"Raise thresholds to be more permissive; lower them to be stricter."]}),children:(0,l.jsxs)(g.Space,{wrap:!0,children:[(0,l.jsx)(r.Form.Item,{label:"High",style:{marginBottom:0},help:"e.g. 0.7",children:(0,l.jsx)(K.InputNumber,{min:0,max:1,step:.05,value:s.threshold_high??.7,onChange:e=>f("threshold_high",e??.7),style:{width:80}})}),(0,l.jsx)(r.Form.Item,{label:"Medium",style:{marginBottom:0},help:"e.g. 0.45",children:(0,l.jsx)(K.InputNumber,{min:0,max:1,step:.05,value:s.threshold_medium??.45,onChange:e=>f("threshold_medium",e??.45),style:{width:80}})}),(0,l.jsx)(r.Form.Item,{label:"Low",style:{marginBottom:0},help:"e.g. 0.3",children:(0,l.jsx)(K.InputNumber,{min:0,max:1,step:.05,value:s.threshold_low??.3,onChange:e=>f("threshold_low",e??.3),style:{width:80}})})]})})]})]}):(0,l.jsx)(h.Card,{title:(0,l.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,l.jsx)(H,{level:5,style:{margin:0},children:"Competitor Intent Filter"}),(0,l.jsx)(D.Switch,{checked:!1,onChange:x})]}),size:"small",children:(0,l.jsx)(q,{type:"secondary",children:"Block or reframe competitor comparison questions. When enabled, airline type auto-loads competitors from IATA; generic type requires manual competitor list."})})},{Title:V,Text:Y}=d.Typography,Z=({prebuiltPatterns:e,categories:t,selectedPatterns:a,blockedWords:r,onPatternAdd:i,onPatternRemove:s,onPatternActionChange:n,onBlockedWordAdd:o,onBlockedWordRemove:d,onBlockedWordUpdate:j,onFileUpload:_,accessToken:v,showStep:N,contentCategories:w=[],selectedContentCategories:S=[],onContentCategoryAdd:I,onContentCategoryRemove:A,onContentCategoryUpdate:T,pendingCategorySelection:O,onPendingCategorySelectionChange:B,competitorIntentEnabled:L=!1,competitorIntentConfig:$=null,onCompetitorIntentChange:E})=>{let[R,M]=(0,m.useState)(!1),[z,D]=(0,m.useState)(!1),[K,H]=(0,m.useState)(!1),[q,J]=(0,m.useState)(""),[W,Z]=(0,m.useState)("BLOCK"),[Q,X]=(0,m.useState)(""),[ee,et]=(0,m.useState)(""),[ea,el]=(0,m.useState)("BLOCK"),[er,ei]=(0,m.useState)(""),[es,en]=(0,m.useState)("BLOCK"),[eo,ed]=(0,m.useState)(""),[ec,em]=(0,m.useState)(!1),eu=async e=>{em(!0);try{let t=await e.text();if(v){let e=await (0,p.validateBlockedWordsFile)(v,t);if(e.valid)_&&_(t),u.default.success(e.message||"File uploaded successfully");else{let t=e.error||e.errors&&e.errors.join(", ")||"Invalid file";u.default.error(`Validation failed: ${t}`)}}}catch(e){u.default.error(`Failed to upload file: ${e}`)}finally{em(!1)}return!1};return(0,l.jsxs)("div",{className:"space-y-6",children:[!N&&(0,l.jsx)("div",{children:(0,l.jsx)(Y,{type:"secondary",children:"Configure patterns, keywords, and content categories to detect and filter sensitive information in requests and responses."})}),(!N||"patterns"===N)&&(0,l.jsxs)(h.Card,{title:(0,l.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,l.jsx)(V,{level:5,style:{margin:0},children:"Pattern Detection"}),(0,l.jsx)(Y,{type:"secondary",style:{fontSize:14,fontWeight:400},children:"Detect sensitive information using regex patterns (SSN, credit cards, API keys, etc.)"})]}),size:"small",children:[(0,l.jsx)("div",{style:{marginBottom:16},children:(0,l.jsxs)(g.Space,{children:[(0,l.jsx)(c.Button,{type:"primary",onClick:()=>M(!0),icon:(0,l.jsx)(f.PlusOutlined,{}),children:"Add prebuilt pattern"}),(0,l.jsx)(c.Button,{onClick:()=>H(!0),icon:(0,l.jsx)(f.PlusOutlined,{}),children:"Add custom regex"})]})}),(0,l.jsx)(P,{patterns:a,onActionChange:n,onRemove:s})]}),(!N||"keywords"===N)&&(0,l.jsxs)(h.Card,{title:(0,l.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,l.jsx)(V,{level:5,style:{margin:0},children:"Blocked Keywords"}),(0,l.jsx)(Y,{type:"secondary",style:{fontSize:14,fontWeight:400},children:"Block or mask specific sensitive terms and phrases"})]}),size:"small",children:[(0,l.jsx)("div",{style:{marginBottom:16},children:(0,l.jsxs)(g.Space,{children:[(0,l.jsx)(c.Button,{type:"primary",onClick:()=>D(!0),icon:(0,l.jsx)(f.PlusOutlined,{}),children:"Add keyword"}),(0,l.jsx)(x.Upload,{beforeUpload:eu,accept:".yaml,.yml",showUploadList:!1,children:(0,l.jsx)(c.Button,{icon:(0,l.jsx)(y.UploadOutlined,{}),loading:ec,children:"Upload YAML file"})})]})}),(0,l.jsx)(F,{keywords:r,onActionChange:j,onRemove:d})]}),(!N||"competitor_intent"===N||"categories"===N)&&E&&(0,l.jsx)(U,{enabled:L,config:$,onChange:E,accessToken:v}),(!N||"categories"===N)&&w.length>0&&I&&A&&T&&(0,l.jsx)(G,{availableCategories:w,selectedCategories:S,onCategoryAdd:I,onCategoryRemove:A,onCategoryUpdate:T,accessToken:v,pendingSelection:O,onPendingSelectionChange:B}),(0,l.jsx)(b,{visible:R,prebuiltPatterns:e,categories:t,selectedPatternName:q,patternAction:W,onPatternNameChange:J,onActionChange:e=>Z(e),onAdd:()=>{if(!q)return void u.default.error("Please select a pattern");let t=e.find(e=>e.name===q);i({id:`pattern-${Date.now()}`,type:"prebuilt",name:q,display_name:t?.display_name,action:W}),M(!1),J(""),Z("BLOCK")},onCancel:()=>{M(!1),J(""),Z("BLOCK")}}),(0,l.jsx)(C,{visible:K,patternName:Q,patternRegex:ee,patternAction:ea,onNameChange:X,onRegexChange:et,onActionChange:e=>el(e),onAdd:()=>{Q&&ee?(i({id:`custom-${Date.now()}`,type:"custom",name:Q,pattern:ee,action:ea}),H(!1),X(""),et(""),el("BLOCK")):u.default.error("Please provide pattern name and regex")},onCancel:()=>{H(!1),X(""),et(""),el("BLOCK")}}),(0,l.jsx)(k,{visible:z,keyword:er,action:es,description:eo,onKeywordChange:ei,onActionChange:e=>en(e),onDescriptionChange:ed,onAdd:()=>{er?(o({id:`word-${Date.now()}`,keyword:er,action:es,description:eo||void 0}),D(!1),ei(""),ed(""),en("BLOCK")):u.default.error("Please enter a keyword")},onCancel:()=>{D(!1),ei(""),ed(""),en("BLOCK")}})]})};var Q=((t={}).PresidioPII="Presidio PII",t.Bedrock="Bedrock Guardrail",t.Lakera="Lakera",t);let X={},ee=e=>{let t={};return t.PresidioPII="Presidio PII",t.Bedrock="Bedrock Guardrail",t.Lakera="Lakera",Object.entries(e).forEach(([e,a])=>{a&&"object"==typeof a&&"ui_friendly_name"in a&&(t[e.split("_").map((e,t)=>e.charAt(0).toUpperCase()+e.slice(1)).join("")]=a.ui_friendly_name)}),X=t,t},et=()=>Object.keys(X).length>0?X:Q,ea={PresidioPII:"presidio",Bedrock:"bedrock",Lakera:"lakera_v2",LitellmContentFilter:"litellm_content_filter",ToolPermission:"tool_permission",BlockCodeExecution:"block_code_execution"},el=e=>{Object.entries(e).forEach(([e,t])=>{t&&"object"==typeof t&&"ui_friendly_name"in t&&(ea[e.split("_").map((e,t)=>e.charAt(0).toUpperCase()+e.slice(1)).join("")]=e)})},er=e=>!!e&&"Presidio PII"===et()[e],ei=e=>!!e&&"LiteLLM Content Filter"===et()[e],es="../ui/assets/logos/",en={"Zscaler AI Guard":`${es}zscaler.svg`,"Presidio PII":`${es}microsoft_azure.svg`,"Bedrock Guardrail":`${es}bedrock.svg`,Lakera:`${es}lakeraai.jpeg`,"Azure Content Safety Prompt Shield":`${es}microsoft_azure.svg`,"Azure Content Safety Text Moderation":`${es}microsoft_azure.svg`,"Aporia AI":`${es}aporia.png`,"PANW Prisma AIRS":`${es}palo_alto_networks.jpeg`,"Noma Security":`${es}noma_security.png`,"Javelin Guardrails":`${es}javelin.png`,"Pillar Guardrail":`${es}pillar.jpeg`,"Google Cloud Model Armor":`${es}google.svg`,"Guardrails AI":`${es}guardrails_ai.jpeg`,"Lasso Guardrail":`${es}lasso.png`,"Pangea Guardrail":`${es}pangea.png`,"AIM Guardrail":`${es}aim_security.jpeg`,"OpenAI Moderation":`${es}openai_small.svg`,EnkryptAI:`${es}enkrypt_ai.avif`,"Prompt Security":`${es}prompt_security.png`,"LiteLLM Content Filter":`${es}litellm_logo.jpg`},eo=e=>{if(!e)return{logo:"",displayName:"-"};let t=Object.keys(ea).find(t=>ea[t].toLowerCase()===e.toLowerCase());if(!t)return{logo:"",displayName:e};let a=et()[t];return{logo:en[a]||"",displayName:a||e}};e.s(["getGuardrailLogoAndName",0,eo,"getGuardrailProviders",0,et,"guardrailLogoMap",0,en,"guardrail_provider_map",0,ea,"populateGuardrailProviderMap",0,el,"populateGuardrailProviders",0,ee,"shouldRenderContentFilterConfigSettings",0,ei,"shouldRenderPIIConfigSettings",0,er],180766);var ed=e.i(435451);let{Title:ec}=d.Typography,em=({field:e,fieldKey:t,fullFieldKey:a,value:s})=>{let[o,d]=m.default.useState([]),[u,p]=m.default.useState(e.dict_key_options||[]);return m.default.useEffect(()=>{if(s&&"object"==typeof s){let t=Object.keys(s);d(t.map(e=>({key:e,id:`${e}_${Date.now()}_${Math.random()}`}))),p((e.dict_key_options||[]).filter(e=>!t.includes(e)))}},[s,e.dict_key_options]),(0,l.jsxs)("div",{className:"space-y-3",children:[o.map(t=>(0,l.jsxs)("div",{className:"flex items-center space-x-3 p-3 border rounded-lg",children:[(0,l.jsx)("div",{className:"w-24 font-medium text-sm",children:t.key}),(0,l.jsx)("div",{className:"flex-1",children:(0,l.jsx)(r.Form.Item,{name:Array.isArray(a)?[...a,t.key]:[a,t.key],style:{marginBottom:0},initialValue:s&&"object"==typeof s?s[t.key]:void 0,normalize:"number"===e.dict_value_type?e=>{if(null==e||""===e)return;let t=Number(e);return isNaN(t)?e:t}:void 0,children:"number"===e.dict_value_type?(0,l.jsx)(ed.default,{step:1,width:200,placeholder:`Enter ${t.key} value`}):"boolean"===e.dict_value_type?(0,l.jsxs)(n.Select,{placeholder:`Select ${t.key} value`,children:[(0,l.jsx)(n.Select.Option,{value:!0,children:"True"}),(0,l.jsx)(n.Select.Option,{value:!1,children:"False"})]}):(0,l.jsx)(i.Input,{placeholder:`Enter ${t.key} value`})})}),(0,l.jsx)(c.Button,{type:"text",danger:!0,size:"small",onClick:()=>{var e,a;return e=t.id,a=t.key,void(d(o.filter(t=>t.id!==e)),p([...u,a].sort()))},children:"Remove"})]},t.id)),u.length>0&&(0,l.jsxs)("div",{className:"flex items-center space-x-3 mt-2",children:[(0,l.jsx)(n.Select,{placeholder:"Select category to configure",style:{width:200},onSelect:e=>e&&void(!e||(d([...o,{key:e,id:`${e}_${Date.now()}`}]),p(u.filter(t=>t!==e)))),value:void 0,children:u.map(e=>(0,l.jsx)(n.Select.Option,{value:e,children:e},e))}),(0,l.jsx)("span",{className:"text-sm text-gray-500",children:"Select a category to add threshold configuration"})]})]})},eu=({optionalParams:e,parentFieldKey:t,values:a})=>e.fields&&0!==Object.keys(e.fields).length?(0,l.jsxs)("div",{className:"guardrail-optional-params",children:[(0,l.jsxs)("div",{className:"mb-8 pb-4 border-b border-gray-100",children:[(0,l.jsx)(ec,{level:3,className:"mb-2 font-semibold text-gray-900",children:"Optional Parameters"}),(0,l.jsx)("p",{className:"text-gray-600 text-sm",children:e.description||"Configure additional settings for this guardrail provider"})]}),(0,l.jsx)("div",{className:"space-y-8",children:Object.entries(e.fields).map(([e,s])=>{let o,d;return o=`${t}.${e}`,(console.log("value",d=a?.[e]),"dict"===s.type&&s.dict_key_options)?(0,l.jsxs)("div",{className:"mb-8 p-6 bg-gray-50 rounded-lg border border-gray-200",children:[(0,l.jsx)("div",{className:"mb-4 font-medium text-gray-900 text-base",children:e}),(0,l.jsx)("p",{className:"text-sm text-gray-600 mb-4",children:s.description}),(0,l.jsx)(em,{field:s,fieldKey:e,fullFieldKey:[t,e],value:d})]},o):(0,l.jsx)("div",{className:"mb-8 p-6 bg-white rounded-lg border border-gray-200 shadow-sm",children:(0,l.jsx)(r.Form.Item,{name:[t,e],label:(0,l.jsxs)("div",{className:"mb-2",children:[(0,l.jsx)("div",{className:"font-medium text-gray-900 text-base",children:e}),(0,l.jsx)("p",{className:"text-sm text-gray-600 mt-1",children:s.description})]}),rules:s.required?[{required:!0,message:`${e} is required`}]:void 0,className:"mb-0",initialValue:void 0!==d?d:s.default_value,normalize:"number"===s.type?e=>{if(null==e||""===e)return;let t=Number(e);return isNaN(t)?e:t}:void 0,children:"select"===s.type&&s.options?(0,l.jsx)(n.Select,{placeholder:s.description,children:s.options.map(e=>(0,l.jsx)(n.Select.Option,{value:e,children:e},e))}):"multiselect"===s.type&&s.options?(0,l.jsx)(n.Select,{mode:"multiple",placeholder:s.description,children:s.options.map(e=>(0,l.jsx)(n.Select.Option,{value:e,children:e},e))}):"bool"===s.type||"boolean"===s.type?(0,l.jsxs)(n.Select,{placeholder:s.description,children:[(0,l.jsx)(n.Select.Option,{value:"true",children:"True"}),(0,l.jsx)(n.Select.Option,{value:"false",children:"False"})]}):"number"===s.type?(0,l.jsx)(ed.default,{step:1,width:400,placeholder:s.description}):e.includes("password")||e.includes("secret")||e.includes("key")?(0,l.jsx)(i.Input.Password,{placeholder:s.description}):(0,l.jsx)(i.Input,{placeholder:s.description})})},o)})})]}):null;var ep=e.i(482725),eg=e.i(850627);let ex=({selectedProvider:e,accessToken:t,providerParams:a=null,value:s=null})=>{let[o,d]=(0,m.useState)(!1),[c,u]=(0,m.useState)(a),[g,x]=(0,m.useState)(null);if((0,m.useEffect)(()=>{if(a)return void u(a);let e=async()=>{if(t){d(!0),x(null);try{let e=await (0,p.getGuardrailProviderSpecificParams)(t);console.log("Provider params API response:",e),u(e),ee(e),el(e)}catch(e){console.error("Error fetching provider params:",e),x("Failed to load provider parameters")}finally{d(!1)}}};a||e()},[t,a]),!e)return null;if(o)return(0,l.jsx)(ep.Spin,{tip:"Loading provider parameters..."});if(g)return(0,l.jsx)("div",{className:"text-red-500",children:g});let h=ea[e]?.toLowerCase(),f=c&&c[h];if(console.log("Provider key:",h),console.log("Provider fields:",f),!f||0===Object.keys(f).length)return(0,l.jsx)("div",{children:"No configuration fields available for this provider."});console.log("Value:",s);let y=new Set(["patterns","blocked_words","blocked_words_file","categories","severity_threshold","pattern_redaction_format","keyword_redaction_tag"]),j=ei(e),_=(e,t="",a)=>Object.entries(e).map(([e,o])=>{let d=t?`${t}.${e}`:e,c=a?a[e]:s?.[e];if(console.log("Field value:",c),"ui_friendly_name"===e||"optional_params"===e&&"nested"===o.type&&o.fields||j&&y.has(e))return null;if("nested"===o.type&&o.fields)return(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{className:"mb-2 font-medium",children:e}),(0,l.jsx)("div",{className:"ml-4 border-l-2 border-gray-200 pl-4",children:_(o.fields,d,c)})]},d);let m="percentage"===o.type&&null==c?o.default_value??.5:void 0;return(0,l.jsx)(r.Form.Item,{name:d,label:e,tooltip:o.description,rules:o.required?[{required:!0,message:`${e} is required`}]:void 0,initialValue:m,children:"select"===o.type&&o.options?(0,l.jsx)(n.Select,{placeholder:o.description,defaultValue:c||o.default_value,children:o.options.map(e=>(0,l.jsx)(n.Select.Option,{value:e,children:e},e))}):"multiselect"===o.type&&o.options?(0,l.jsx)(n.Select,{mode:"multiple",placeholder:o.description,defaultValue:c||o.default_value,children:o.options.map(e=>(0,l.jsx)(n.Select.Option,{value:e,children:e},e))}):"bool"===o.type||"boolean"===o.type?(0,l.jsxs)(n.Select,{placeholder:o.description,defaultValue:void 0!==c?String(c):o.default_value,children:[(0,l.jsx)(n.Select.Option,{value:"true",children:"True"}),(0,l.jsx)(n.Select.Option,{value:"false",children:"False"})]}):"percentage"===o.type&&null!=o.min&&null!=o.max?(0,l.jsx)(eg.Slider,{min:o.min,max:o.max,step:o.step??.1,marks:{[o.min]:"0%",[(o.min+o.max)/2]:"50%",[o.max]:"100%"}}):"number"===o.type?(0,l.jsx)(ed.default,{step:1,width:400,placeholder:o.description,defaultValue:void 0!==c?Number(c):void 0}):e.includes("password")||e.includes("secret")||e.includes("key")?(0,l.jsx)(i.Input.Password,{placeholder:o.description,defaultValue:c||""}):(0,l.jsx)(i.Input,{placeholder:o.description,defaultValue:c||""})},d)});return(0,l.jsx)(l.Fragment,{children:_(f)})};var eh=e.i(536916),ef=e.i(592968),ey=e.i(149192),ej=e.i(741585),ej=ej,e_=e.i(724154);e.i(247167);var eb=e.i(931067);let ev={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"};var eN=e.i(9583),eC=m.forwardRef(function(e,t){return m.createElement(eN.default,(0,eb.default)({},e,{ref:t,icon:ev}))});let{Text:ew}=d.Typography,{Option:eS}=n.Select,ek=({categories:e,selectedCategories:t,onChange:a})=>(0,l.jsxs)("div",{children:[(0,l.jsxs)("div",{className:"flex items-center mb-2",children:[(0,l.jsx)(eC,{className:"text-gray-500 mr-1"}),(0,l.jsx)(ew,{className:"text-gray-500 font-medium",children:"Filter by category"})]}),(0,l.jsx)(n.Select,{mode:"multiple",placeholder:"Select categories to filter by",style:{width:"100%"},onChange:a,value:t,allowClear:!0,showSearch:!0,optionFilterProp:"children",className:"mb-4",tagRender:e=>(0,l.jsx)(o.Tag,{color:"blue",closable:e.closable,onClose:e.onClose,className:"mr-2 mb-2",children:e.label}),children:e.map(e=>(0,l.jsx)(eS,{value:e.category,children:e.category},e.category))})]}),eI=({onSelectAll:e,onUnselectAll:t,hasSelectedEntities:a})=>(0,l.jsxs)("div",{className:"bg-gray-50 p-5 rounded-lg mb-6 border border-gray-200 shadow-sm",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,l.jsxs)("div",{className:"flex items-center",children:[(0,l.jsx)(ew,{strong:!0,className:"text-gray-700 text-base",children:"Quick Actions"}),(0,l.jsx)(ef.Tooltip,{title:"Apply action to all PII types at once",children:(0,l.jsx)("div",{className:"ml-2 text-gray-400 cursor-help text-xs",children:"ⓘ"})})]}),(0,l.jsx)(c.Button,{color:"danger",variant:"outlined",onClick:t,disabled:!a,icon:(0,l.jsx)(ey.CloseOutlined,{}),children:"Unselect All"})]}),(0,l.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,l.jsx)(c.Button,{color:"primary",variant:"outlined",onClick:()=>e("MASK"),className:"h-10",block:!0,icon:(0,l.jsx)(ej.default,{}),children:"Select All & Mask"}),(0,l.jsx)(c.Button,{color:"danger",variant:"outlined",onClick:()=>e("BLOCK"),className:"h-10 hover:bg-red-100",block:!0,icon:(0,l.jsx)(e_.StopOutlined,{}),children:"Select All & Block"})]})]}),eA=({entities:e,selectedEntities:t,selectedActions:a,actions:r,onEntitySelect:i,onActionSelect:s,entityToCategoryMap:d})=>(0,l.jsxs)("div",{className:"border rounded-lg overflow-hidden shadow-sm",children:[(0,l.jsxs)("div",{className:"bg-gray-50 px-5 py-3 border-b flex",children:[(0,l.jsx)(ew,{strong:!0,className:"flex-1 text-gray-700",children:"PII Type"}),(0,l.jsx)(ew,{strong:!0,className:"w-32 text-right text-gray-700",children:"Action"})]}),(0,l.jsx)("div",{className:"max-h-[400px] overflow-y-auto",children:0===e.length?(0,l.jsx)("div",{className:"py-10 text-center text-gray-500",children:"No PII types match your filter criteria"}):e.map(e=>(0,l.jsxs)("div",{className:`px-5 py-3 flex items-center justify-between hover:bg-gray-50 border-b ${t.includes(e)?"bg-blue-50":""}`,children:[(0,l.jsxs)("div",{className:"flex items-center flex-1",children:[(0,l.jsx)(eh.Checkbox,{checked:t.includes(e),onChange:()=>i(e),className:"mr-3"}),(0,l.jsx)(ew,{className:t.includes(e)?"font-medium text-gray-900":"text-gray-700",children:e.replace(/_/g," ")}),d.get(e)&&(0,l.jsx)(o.Tag,{className:"ml-2 text-xs",color:"blue",children:d.get(e)})]}),(0,l.jsx)("div",{className:"w-32",children:(0,l.jsx)(n.Select,{value:t.includes(e)&&a[e]||"MASK",onChange:t=>s(e,t),style:{width:120},disabled:!t.includes(e),className:`${!t.includes(e)?"opacity-50":""}`,dropdownMatchSelectWidth:!1,children:r.map(e=>(0,l.jsx)(eS,{value:e,children:(0,l.jsxs)("div",{className:"flex items-center",children:[(e=>{switch(e){case"MASK":return(0,l.jsx)(ej.default,{style:{marginRight:4}});case"BLOCK":return(0,l.jsx)(e_.StopOutlined,{style:{marginRight:4}});default:return null}})(e),e]})},e))})})]},e))})]}),{Title:eT,Text:eO}=d.Typography,eP=({entities:e,actions:t,selectedEntities:a,selectedActions:r,onEntitySelect:i,onActionSelect:s,entityCategories:n=[]})=>{let[o,d]=(0,m.useState)([]),c=new Map;n.forEach(e=>{e.entities.forEach(t=>{c.set(t,e.category)})});let u=e.filter(e=>0===o.length||o.includes(c.get(e)||""));return(0,l.jsxs)("div",{className:"pii-configuration",children:[(0,l.jsxs)("div",{className:"flex justify-between items-center mb-5",children:[(0,l.jsx)("div",{className:"flex items-center",children:(0,l.jsx)(eT,{level:4,className:"!m-0 font-semibold text-gray-800",children:"Configure PII Protection"})}),(0,l.jsxs)(eO,{className:"text-gray-500",children:[a.length," items selected"]})]}),(0,l.jsxs)("div",{className:"mb-6",children:[(0,l.jsx)(ek,{categories:n,selectedCategories:o,onChange:d}),(0,l.jsx)(eI,{onSelectAll:t=>{e.forEach(e=>{a.includes(e)||i(e),s(e,t)})},onUnselectAll:()=>{a.forEach(e=>{i(e)})},hasSelectedEntities:a.length>0})]}),(0,l.jsx)(eA,{entities:u,selectedEntities:a,selectedActions:r,actions:t,onEntitySelect:i,onActionSelect:s,entityToCategoryMap:c})]})};var eB=e.i(304967),eL=e.i(599724),eF=e.i(312361),e$=e.i(21548),eE=e.i(827252);let eR={rules:[],default_action:"deny",on_disallowed_action:"block",violation_message_template:""},eM=({value:e,onChange:t,disabled:a=!1})=>{let r={...eR,...e||{},rules:e?.rules?[...e.rules]:[]},s=e=>{let a={...r,...e};t?.(a)},o=(e,t)=>{s({rules:r.rules.map((a,l)=>l===e?{...a,...t}:a)})},d=(e,t)=>{let a=r.rules[e];if(!a)return;let l=Object.entries(a.allowed_param_patterns||{});t(l);let i={};l.forEach(([e,t])=>{i[e]=t}),o(e,{allowed_param_patterns:Object.keys(i).length>0?i:void 0})};return(0,l.jsxs)(eB.Card,{children:[(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)(eL.Text,{className:"text-lg font-semibold",children:"LiteLLM Tool Permission Guardrail"}),(0,l.jsx)(eL.Text,{className:"text-sm text-gray-500",children:"Provide regex patterns (e.g., ^mcp__github_.*$) for tool names or types and optionally constrain payload fields."})]}),!a&&(0,l.jsx)(c.Button,{icon:(0,l.jsx)(f.PlusOutlined,{}),type:"primary",onClick:()=>{s({rules:[...r.rules,{id:`rule_${Math.random().toString(36).slice(2,8)}`,decision:"allow",allowed_param_patterns:void 0}]})},className:"!bg-blue-600 !text-white hover:!bg-blue-500",children:"Add Rule"})]}),(0,l.jsx)(eF.Divider,{}),0===r.rules.length?(0,l.jsx)(e$.Empty,{description:"No tool rules added yet"}):(0,l.jsx)("div",{className:"space-y-4",children:r.rules.map((e,t)=>{let m;return(0,l.jsxs)(eB.Card,{className:"bg-gray-50",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,l.jsxs)(eL.Text,{className:"font-semibold",children:["Rule ",t+1]}),(0,l.jsx)(c.Button,{icon:(0,l.jsx)(A.DeleteOutlined,{}),danger:!0,type:"text",disabled:a,onClick:()=>{s({rules:r.rules.filter((e,a)=>a!==t)})},children:"Remove"})]}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)(eL.Text,{className:"text-sm font-medium",children:"Rule ID"}),(0,l.jsx)(i.Input,{disabled:a,placeholder:"unique_rule_id",value:e.id,onChange:e=>o(t,{id:e.target.value})})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)(eL.Text,{className:"text-sm font-medium",children:"Tool Name (optional)"}),(0,l.jsx)(i.Input,{disabled:a,placeholder:"^mcp__github_.*$",value:e.tool_name??"",onChange:e=>o(t,{tool_name:""===e.target.value.trim()?void 0:e.target.value})})]})]}),(0,l.jsx)("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 mt-4",children:(0,l.jsxs)("div",{children:[(0,l.jsx)(eL.Text,{className:"text-sm font-medium",children:"Tool Type (optional)"}),(0,l.jsx)(i.Input,{disabled:a,placeholder:"^function$",value:e.tool_type??"",onChange:e=>o(t,{tool_type:""===e.target.value.trim()?void 0:e.target.value})})]})}),(0,l.jsxs)("div",{className:"mt-4 flex flex-col gap-2",children:[(0,l.jsx)(eL.Text,{className:"text-sm font-medium",children:"Decision"}),(0,l.jsxs)(n.Select,{disabled:a,value:e.decision,style:{width:200},onChange:e=>o(t,{decision:e}),children:[(0,l.jsx)(n.Select.Option,{value:"allow",children:"Allow"}),(0,l.jsx)(n.Select.Option,{value:"deny",children:"Deny"})]})]}),(0,l.jsx)("div",{className:"mt-4",children:0===(m=Object.entries(e.allowed_param_patterns||{})).length?(0,l.jsx)(c.Button,{disabled:a,size:"small",onClick:()=>o(t,{allowed_param_patterns:{"":""}}),children:"+ Restrict tool arguments (optional)"}):(0,l.jsxs)("div",{className:"space-y-2",children:[(0,l.jsx)(eL.Text,{className:"text-sm text-gray-600",children:"Argument constraints (dot or array paths)"}),m.map(([r,s],n)=>(0,l.jsxs)(g.Space,{align:"start",children:[(0,l.jsx)(i.Input,{disabled:a,placeholder:"messages[0].content",value:r,onChange:e=>{var a;return a=e.target.value,void d(t,e=>{if(!e[n])return;let[,t]=e[n];e[n]=[a,t]})}}),(0,l.jsx)(i.Input,{disabled:a,placeholder:"^email@.*$",value:s,onChange:e=>{var a;return a=e.target.value,void d(t,e=>{if(!e[n])return;let[t]=e[n];e[n]=[t,a]})}}),(0,l.jsx)(c.Button,{disabled:a,icon:(0,l.jsx)(A.DeleteOutlined,{}),danger:!0,onClick:()=>d(t,e=>{e.splice(n,1)})})]},`${e.id||t}-${n}`)),(0,l.jsx)(c.Button,{disabled:a,size:"small",onClick:()=>o(t,{allowed_param_patterns:{...e.allowed_param_patterns||{},"":""}}),children:"+ Add another constraint"})]})})]},e.id||t)})}),(0,l.jsx)(eF.Divider,{}),(0,l.jsxs)("div",{className:"grid gap-4 md:grid-cols-2",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)(eL.Text,{className:"text-sm font-medium",children:"Default action"}),(0,l.jsxs)(n.Select,{disabled:a,value:r.default_action,onChange:e=>s({default_action:e}),children:[(0,l.jsx)(n.Select.Option,{value:"allow",children:"Allow"}),(0,l.jsx)(n.Select.Option,{value:"deny",children:"Deny"})]})]}),(0,l.jsxs)("div",{children:[(0,l.jsxs)(eL.Text,{className:"text-sm font-medium flex items-center gap-1",children:["On disallowed action",(0,l.jsx)(ef.Tooltip,{title:"Block returns an error when a forbidden tool is invoked. Rewrite strips the tool call but lets the rest of the response continue.",children:(0,l.jsx)(eE.InfoCircleOutlined,{})})]}),(0,l.jsxs)(n.Select,{disabled:a,value:r.on_disallowed_action,onChange:e=>s({on_disallowed_action:e}),children:[(0,l.jsx)(n.Select.Option,{value:"block",children:"Block"}),(0,l.jsx)(n.Select.Option,{value:"rewrite",children:"Rewrite"})]})]})]}),(0,l.jsxs)("div",{className:"mt-4",children:[(0,l.jsx)(eL.Text,{className:"text-sm font-medium",children:"Violation message (optional)"}),(0,l.jsx)(i.Input.TextArea,{disabled:a,rows:3,placeholder:"This violates our org policy...",value:r.violation_message_template,onChange:e=>s({violation_message_template:e.target.value})})]})]})},{Title:ez,Text:eG,Link:eD}=d.Typography,{Option:eK}=n.Select,eH={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"};e.s(["default",0,({visible:e,onClose:t,accessToken:a,onSuccess:d,preset:g})=>{let[x]=r.Form.useForm(),[h,f]=(0,m.useState)(!1),[y,j]=(0,m.useState)(null),[_,b]=(0,m.useState)(null),[v,N]=(0,m.useState)([]),[C,w]=(0,m.useState)({}),[S,k]=(0,m.useState)(0),[I,A]=(0,m.useState)(null),[T,O]=(0,m.useState)([]),[P,B]=(0,m.useState)(2),[L,F]=(0,m.useState)({}),[$,E]=(0,m.useState)([]),[R,M]=(0,m.useState)([]),[z,G]=(0,m.useState)([]),[D,K]=(0,m.useState)(""),[H,q]=(0,m.useState)(!1),[J,W]=(0,m.useState)(null),[U,V]=(0,m.useState)(""),[Y,Q]=(0,m.useState)(void 0),[X,es]=(0,m.useState)("warn"),[eo,ed]=(0,m.useState)(""),[ec,em]=(0,m.useState)(!1),[ep,eg]=(0,m.useState)({rules:[],default_action:"deny",on_disallowed_action:"block",violation_message_template:""}),eh=(0,m.useMemo)(()=>!!y&&"tool_permission"===(ea[y]||"").toLowerCase(),[y]);(0,m.useEffect)(()=>{a&&(async()=>{try{let[e,t]=await Promise.all([(0,p.getGuardrailUISettings)(a),(0,p.getGuardrailProviderSpecificParams)(a)]);b(e),A(t),ee(t),el(t)}catch(e){console.error("Error fetching guardrail data:",e),u.default.fromBackend("Failed to load guardrail configuration")}})()},[a]),(0,m.useEffect)(()=>{if(!g||!e||!_)return;j(g.provider);let t={provider:g.provider,guardrail_name:g.guardrailNameSuggestion,mode:g.mode,default_on:g.defaultOn};if("BlockCodeExecution"===g.provider&&(t.confidence_threshold=.5),x.setFieldsValue(t),g.categoryName&&_.content_filter_settings?.content_categories){let e=_.content_filter_settings.content_categories.find(e=>e.name===g.categoryName);e&&G([{id:`category-${Date.now()}`,category:e.name,display_name:e.display_name,action:e.default_action,severity_threshold:"medium"}])}},[g,e,_]);let ef=e=>{j(e);let t={config:void 0,presidio_analyzer_api_base:void 0,presidio_anonymizer_api_base:void 0};"BlockCodeExecution"===e&&(t.confidence_threshold=.5),x.setFieldsValue(t),N([]),w({}),O([]),B(2),F({}),E([]),M([]),G([]),K(""),q(!1),W(null),eg({rules:[],default_action:"deny",on_disallowed_action:"block",violation_message_template:""})},ey=e=>{N(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},ej=(e,t)=>{w(a=>({...a,[e]:t}))},e_=async()=>{try{if(0===S&&(await x.validateFields(["guardrail_name","provider","mode","default_on"]),y)){let e=["guardrail_name","provider","mode","default_on"];"PresidioPII"===y&&e.push("presidio_analyzer_api_base","presidio_anonymizer_api_base"),await x.validateFields(e)}if(1===S&&er(y)&&0===v.length)return void u.default.fromBackend("Please select at least one PII entity to continue");k(S+1)}catch(e){console.error("Form validation failed:",e)}},eb=()=>{x.resetFields(),j(null),N([]),w({}),O([]),B(2),F({}),E([]),M([]),G([]),K(""),eg({rules:[],default_action:"deny",on_disallowed_action:"block",violation_message_template:""}),V(""),Q(void 0),es("warn"),ed(""),em(!1),k(0)},ev=()=>{eb(),t()},eN=async()=>{try{f(!0),await x.validateFields();let e=x.getFieldsValue(!0),l=ea[e.provider],r={guardrail_name:e.guardrail_name,litellm_params:{guardrail:l,mode:e.mode,default_on:e.default_on},guardrail_info:{}};if("PresidioPII"===e.provider&&v.length>0){let t={};v.forEach(e=>{t[e]=C[e]||"MASK"}),r.litellm_params.pii_entities_config=t,e.presidio_analyzer_api_base&&(r.litellm_params.presidio_analyzer_api_base=e.presidio_analyzer_api_base),e.presidio_anonymizer_api_base&&(r.litellm_params.presidio_anonymizer_api_base=e.presidio_anonymizer_api_base)}if(ei(e.provider)){let e=H&&J?.brand_self?.length>0;if(0===$.length&&0===R.length&&0===z.length&&!e){u.default.fromBackend("Please configure at least one content filter setting (category, pattern, keyword, or competitor intent)"),f(!1);return}$.length>0&&(r.litellm_params.patterns=$.map(e=>({pattern_type:"prebuilt"===e.type?"prebuilt":"regex",pattern_name:"prebuilt"===e.type?e.name:void 0,pattern:"custom"===e.type?e.pattern:void 0,name:e.name,action:e.action}))),R.length>0&&(r.litellm_params.blocked_words=R.map(e=>({keyword:e.keyword,action:e.action,description:e.description}))),z.length>0&&(r.litellm_params.categories=z.map(e=>({category:e.category,enabled:!0,action:e.action,severity_threshold:e.severity_threshold||"medium"}))),H&&J?.brand_self?.length>0&&(r.litellm_params.competitor_intent_config={competitor_intent_type:J.competitor_intent_type??"airline",brand_self:J.brand_self,locations:J.locations?.length>0?J.locations:void 0,competitors:"generic"===J.competitor_intent_type&&J.competitors?.length>0?J.competitors:void 0,policy:J.policy,threshold_high:J.threshold_high,threshold_medium:J.threshold_medium,threshold_low:J.threshold_low})}else if(e.config)try{r.guardrail_info=JSON.parse(e.config)}catch(e){u.default.fromBackend("Invalid JSON in configuration"),f(!1);return}if("tool_permission"===l){if(0===ep.rules.length){u.default.fromBackend("Add at least one tool permission rule"),f(!1);return}r.litellm_params.rules=ep.rules,r.litellm_params.default_action=ep.default_action,r.litellm_params.on_disallowed_action=ep.on_disallowed_action,ep.violation_message_template&&(r.litellm_params.violation_message_template=ep.violation_message_template)}if(ei(e.provider)&&(void 0!==Y&&Y>0&&(r.litellm_params.end_session_after_n_fails=Y),X&&"realtime"===U&&(r.litellm_params.on_violation=X),eo.trim()&&(r.litellm_params.realtime_violation_message=eo.trim())),console.log("values: ",JSON.stringify(e)),I&&y){let t=ea[y]?.toLowerCase();console.log("providerKey: ",t);let a=I[t]||{},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(t=>{let a=e[t];(null==a||""===a)&&(a=e.optional_params?.[t]),null!=a&&""!==a&&(r.litellm_params[t]=a)})}if(!a)throw Error("No access token available");console.log("Sending guardrail data:",JSON.stringify(r)),await (0,p.createGuardrailCall)(a,r),u.default.success("Guardrail created successfully"),eb(),d(),t()}catch(e){console.error("Failed to create guardrail:",e),u.default.fromBackend("Failed to create guardrail: "+(e instanceof Error?e.message:String(e)))}finally{f(!1)}},eC=e=>{if(!_||!ei(y))return null;let t=_.content_filter_settings;return t?(0,l.jsx)(Z,{prebuiltPatterns:t.prebuilt_patterns||[],categories:t.pattern_categories||[],selectedPatterns:$,blockedWords:R,onPatternAdd:e=>E([...$,e]),onPatternRemove:e=>E($.filter(t=>t.id!==e)),onPatternActionChange:(e,t)=>{E($.map(a=>a.id===e?{...a,action:t}:a))},onBlockedWordAdd:e=>M([...R,e]),onBlockedWordRemove:e=>M(R.filter(t=>t.id!==e)),onBlockedWordUpdate:(e,t,a)=>{M(R.map(l=>l.id===e?{...l,[t]:a}:l))},contentCategories:t.content_categories||[],selectedContentCategories:z,onContentCategoryAdd:e=>G([...z,e]),onContentCategoryRemove:e=>G(z.filter(t=>t.id!==e)),onContentCategoryUpdate:(e,t,a)=>{G(z.map(l=>l.id===e?{...l,[t]:a}:l))},pendingCategorySelection:D,onPendingCategorySelectionChange:K,accessToken:a,showStep:e,competitorIntentEnabled:H,competitorIntentConfig:J,onCompetitorIntentChange:(e,t)=>{q(e),W(t)}}):null},ew=ei(y)?[{title:"Basic Info",optional:!1},{title:"Topics",optional:!1},{title:"Patterns",optional:!1},{title:"Keywords",optional:!1},{title:"Endpoint Settings (Optional)",optional:!0}]:er(y)?[{title:"Basic Info",optional:!1},{title:"PII Configuration",optional:!1}]:[{title:"Basic Info",optional:!1},{title:"Provider Configuration",optional:!1}];return(0,l.jsx)(s.Modal,{title:null,open:e,onCancel:ev,footer:null,width:1e3,closable:!1,className:"top-8",styles:{body:{padding:0}},children:(0,l.jsxs)("div",{className:"flex flex-col",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between px-6 py-4 border-b border-gray-200",children:[(0,l.jsx)("h3",{className:"text-base font-semibold text-gray-900 m-0",children:"Create guardrail"}),(0,l.jsx)("button",{onClick:ev,className:"text-gray-400 hover:text-gray-600 bg-transparent border-none cursor-pointer text-base leading-none p-1",children:"✕"})]}),(0,l.jsx)("div",{className:"overflow-auto px-6 py-4",style:{maxHeight:"calc(80vh - 120px)"},children:(0,l.jsx)(r.Form,{form:x,layout:"vertical",initialValues:{mode:"pre_call",default_on:!1},children:ew.map((e,t)=>{let s=t{s&&k(t)},style:{minHeight:24},children:[(0,l.jsx)("span",{className:"text-sm",style:{fontWeight:d?600:500,color:d?"#1e293b":s?"#4f46e5":"#94a3b8"},children:e.title}),e.optional&&!d&&(0,l.jsx)("span",{className:"text-[11px] text-slate-400",children:"optional"}),s&&(0,l.jsx)("span",{className:"text-[11px] text-indigo-500 hover:underline",children:"Edit"})]}),d&&(0,l.jsx)("div",{className:"mt-3",children:(()=>{switch(S){case 0:return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(r.Form.Item,{name:"guardrail_name",label:"Guardrail Name",rules:[{required:!0,message:"Please enter a guardrail name"}],children:(0,l.jsx)(i.Input,{placeholder:"Enter a name for this guardrail"})}),(0,l.jsx)(r.Form.Item,{name:"provider",label:"Guardrail Provider",rules:[{required:!0,message:"Please select a provider"}],children:(0,l.jsx)(n.Select,{placeholder:"Select a guardrail provider",onChange:ef,labelInValue:!1,optionLabelProp:"label",dropdownRender:e=>e,showSearch:!0,children:Object.entries(et()).map(([e,t])=>(0,l.jsx)(eK,{value:e,label:(0,l.jsxs)("div",{style:{display:"flex",alignItems:"center"},children:[en[t]&&(0,l.jsx)("img",{src:en[t],alt:"",style:{height:"20px",width:"20px",marginRight:"8px",objectFit:"contain"},onError:e=>{e.currentTarget.style.display="none"}}),(0,l.jsx)("span",{children:t})]}),children:(0,l.jsxs)("div",{style:{display:"flex",alignItems:"center"},children:[en[t]&&(0,l.jsx)("img",{src:en[t],alt:"",style:{height:"20px",width:"20px",marginRight:"8px",objectFit:"contain"},onError:e=>{e.currentTarget.style.display="none"}}),(0,l.jsx)("span",{children:t})]})},e))})}),(0,l.jsx)(r.Form.Item,{name:"mode",label:"Mode",tooltip:"How the guardrail should be applied",rules:[{required:!0,message:"Please select a mode"}],children:(0,l.jsx)(n.Select,{optionLabelProp:"label",mode:"multiple",children:_?.supported_modes?.map(e=>(0,l.jsx)(eK,{value:e,label:e,children:(0,l.jsxs)("div",{children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("strong",{children:e}),"pre_call"===e&&(0,l.jsx)(o.Tag,{color:"green",style:{marginLeft:"8px"},children:"Recommended"})]}),(0,l.jsx)("div",{style:{fontSize:"12px",color:"#888"},children:eH[e]})]})},e))||(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(eK,{value:"pre_call",label:"pre_call",children:(0,l.jsxs)("div",{children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("strong",{children:"pre_call"})," ",(0,l.jsx)(o.Tag,{color:"green",children:"Recommended"})]}),(0,l.jsx)("div",{style:{fontSize:"12px",color:"#888"},children:eH.pre_call})]})}),(0,l.jsx)(eK,{value:"during_call",label:"during_call",children:(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{children:(0,l.jsx)("strong",{children:"during_call"})}),(0,l.jsx)("div",{style:{fontSize:"12px",color:"#888"},children:eH.during_call})]})}),(0,l.jsx)(eK,{value:"post_call",label:"post_call",children:(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{children:(0,l.jsx)("strong",{children:"post_call"})}),(0,l.jsx)("div",{style:{fontSize:"12px",color:"#888"},children:eH.post_call})]})}),(0,l.jsx)(eK,{value:"logging_only",label:"logging_only",children:(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{children:(0,l.jsx)("strong",{children:"logging_only"})}),(0,l.jsx)("div",{style:{fontSize:"12px",color:"#888"},children:eH.logging_only})]})})]})})}),(0,l.jsx)(r.Form.Item,{name:"default_on",label:"Always On",tooltip:"If enabled, this guardrail will be applied to all requests by default.",children:(0,l.jsxs)(n.Select,{children:[(0,l.jsx)(n.Select.Option,{value:!0,children:"Yes"}),(0,l.jsx)(n.Select.Option,{value:!1,children:"No"})]})}),!eh&&!ei(y)&&(0,l.jsx)(ex,{selectedProvider:y,accessToken:a,providerParams:I})]});case 1:if(er(y))return _&&"PresidioPII"===y?(0,l.jsx)(eP,{entities:_.supported_entities,actions:_.supported_actions,selectedEntities:v,selectedActions:C,onEntitySelect:ey,onActionSelect:ej,entityCategories:_.pii_entity_categories}):null;if(ei(y))return eC("categories");if(!y)return null;if(eh)return(0,l.jsx)(eM,{value:ep,onChange:eg});if(!I)return null;console.log("guardrail_provider_map: ",ea),console.log("selectedProvider: ",y);let e=ea[y]?.toLowerCase(),t=I&&I[e];return t&&t.optional_params?(0,l.jsx)(eu,{optionalParams:t.optional_params,parentFieldKey:"optional_params"}):null;case 2:if(ei(y))return eC("patterns");return null;case 3:if(ei(y))return eC("keywords");return null;case 4:return(0,l.jsxs)("div",{className:"space-y-6",children:[(0,l.jsx)("div",{children:(0,l.jsxs)("p",{className:"text-sm text-gray-500",children:["Configure settings for a specific call type. Most guardrails don't need this — skip it unless you're using a specific endpoint like ",(0,l.jsx)("code",{children:"/v1/realtime"}),"."]})}),(0,l.jsxs)("div",{children:[(0,l.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Call type"}),(0,l.jsx)(n.Select,{placeholder:"Select a call type",value:U||void 0,onChange:e=>{V(e),em(!1)},style:{width:260},allowClear:!0,options:[{value:"realtime",label:"/v1/realtime"}]}),(0,l.jsx)("p",{className:"text-xs text-gray-400 mt-1",children:"More call types coming soon."})]}),"realtime"===U&&(0,l.jsxs)("div",{className:"border border-gray-200 rounded-lg overflow-hidden",children:[(0,l.jsxs)("button",{type:"button",onClick:()=>em(e=>!e),className:"w-full flex items-center justify-between px-4 py-3 bg-gray-50 hover:bg-gray-100 text-sm font-medium text-gray-700",children:[(0,l.jsx)("span",{children:"/v1/realtime settings"}),(0,l.jsx)("svg",{className:`w-4 h-4 text-gray-500 transition-transform ${ec?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,l.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),ec&&(0,l.jsxs)("div",{className:"space-y-5 px-4 py-4 border-t border-gray-200",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"End session after X violations"}),(0,l.jsx)("p",{className:"text-xs text-gray-400 mb-2",children:"Automatically close the session after this many guardrail violations. Leave empty to never auto-close."}),(0,l.jsx)("input",{type:"number",min:1,placeholder:"e.g. 3",value:Y??"",onChange:e=>Q(e.target.value?parseInt(e.target.value,10):void 0),className:"border border-gray-300 rounded px-3 py-1.5 text-sm w-32"})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"On violation"}),(0,l.jsx)("div",{className:"space-y-2",children:["warn","end_session"].map(e=>(0,l.jsxs)("label",{className:"flex items-start gap-2 cursor-pointer",children:[(0,l.jsx)("input",{type:"radio",name:"on_violation",value:e,checked:X===e,onChange:()=>es(e),className:"mt-0.5"}),(0,l.jsxs)("div",{children:[(0,l.jsx)("span",{className:"text-sm font-medium text-gray-800",children:"warn"===e?"Warn":"End session"}),(0,l.jsx)("p",{className:"text-xs text-gray-400 m-0",children:"warn"===e?"Bot speaks the message, session continues":"Bot speaks the message, connection closes immediately"})]})]},e))})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Message the user hears"}),(0,l.jsx)("p",{className:"text-xs text-gray-400 mb-2",children:"What the bot says aloud when this guardrail fires. Falls back to the default violation message if empty."}),(0,l.jsx)("textarea",{rows:3,placeholder:"e.g. I'm not able to continue this conversation. Please contact us at 1-800-774-2678.",value:eo,onChange:e=>ed(e.target.value),className:"border border-gray-300 rounded px-3 py-2 text-sm w-full resize-none"})]})]})]})]});default:return null}})()})]})]},t)})})}),(0,l.jsxs)("div",{className:"flex items-center justify-end space-x-3 px-6 py-3 border-t border-gray-200",children:[(0,l.jsx)(c.Button,{onClick:ev,children:"Cancel"}),S>0&&(0,l.jsx)(c.Button,{onClick:()=>{k(S-1)},children:"Previous"}),S{let[g]=r.Form.useForm(),[x,h]=(0,m.useState)(!1),[f,y]=(0,m.useState)(c?.provider||null),[j,_]=(0,m.useState)(null),[b,v]=(0,m.useState)([]),[N,C]=(0,m.useState)({});(0,m.useEffect)(()=>{(async()=>{try{if(!a)return;let e=await (0,p.getGuardrailUISettings)(a);_(e)}catch(e){console.error("Error fetching guardrail settings:",e),u.default.fromBackend("Failed to load guardrail settings")}})()},[a]),(0,m.useEffect)(()=>{c?.pii_entities_config&&Object.keys(c.pii_entities_config).length>0&&(v(Object.keys(c.pii_entities_config)),C(c.pii_entities_config))},[c]);let w=e=>{v(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},S=(e,t)=>{C(a=>({...a,[e]:t}))},k=async()=>{try{h(!0);let e=await g.validateFields(),l=ea[e.provider],r={guardrail_id:d,guardrail:{guardrail_name:e.guardrail_name,litellm_params:{guardrail:l,mode:e.mode,default_on:e.default_on},guardrail_info:{}}};if("PresidioPII"===e.provider&&b.length>0){let e={};b.forEach(t=>{e[t]=N[t]||"MASK"}),r.guardrail.litellm_params.pii_entities_config=e}else if(e.config)try{let t=JSON.parse(e.config);"Bedrock"===e.provider&&t?(t.guardrail_id&&(r.guardrail.litellm_params.guardrailIdentifier=t.guardrail_id),t.guardrail_version&&(r.guardrail.litellm_params.guardrailVersion=t.guardrail_version)):r.guardrail.guardrail_info=t}catch(e){u.default.fromBackend("Invalid JSON in configuration"),h(!1);return}if(!a)throw Error("No access token available");console.log("Sending guardrail update data:",JSON.stringify(r));let i=`/guardrails/${d}`,s=await fetch(i,{method:"PUT",headers:{[(0,p.getGlobalLitellmHeaderName)()]:`Bearer ${a}`,"Content-Type":"application/json"},body:JSON.stringify(r)});if(!s.ok){let e=await s.text();throw Error(e||"Failed to update guardrail")}u.default.success("Guardrail updated successfully"),o(),t()}catch(e){console.error("Failed to update guardrail:",e),u.default.fromBackend("Failed to update guardrail: "+(e instanceof Error?e.message:String(e)))}finally{h(!1)}};return(0,l.jsx)(s.Modal,{title:"Edit Guardrail",open:e,onCancel:t,footer:null,width:700,children:(0,l.jsxs)(r.Form,{form:g,layout:"vertical",initialValues:c,children:[(0,l.jsx)(r.Form.Item,{name:"guardrail_name",label:"Guardrail Name",rules:[{required:!0,message:"Please enter a guardrail name"}],children:(0,l.jsx)(e8.TextInput,{placeholder:"Enter a name for this guardrail"})}),(0,l.jsx)(r.Form.Item,{name:"provider",label:"Guardrail Provider",rules:[{required:!0,message:"Please select a provider"}],children:(0,l.jsx)(n.Select,{placeholder:"Select a guardrail provider",onChange:e=>{y(e),g.setFieldsValue({config:void 0}),v([]),C({})},disabled:!0,optionLabelProp:"label",children:Object.entries(et()).map(([e,t])=>(0,l.jsx)(e9,{value:e,label:t,children:(0,l.jsxs)("div",{style:{display:"flex",alignItems:"center"},children:[en[t]&&(0,l.jsx)("img",{src:en[t],alt:"",style:{height:"20px",width:"20px",marginRight:"8px",objectFit:"contain"},onError:e=>{e.currentTarget.style.display="none"}}),(0,l.jsx)("span",{children:t})]})},e))})}),(0,l.jsx)(r.Form.Item,{name:"mode",label:"Mode",tooltip:"How the guardrail should be applied",rules:[{required:!0,message:"Please select a mode"}],children:(0,l.jsx)(n.Select,{children:j?.supported_modes?.map(e=>(0,l.jsx)(e9,{value:e,children:e},e))||(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(e9,{value:"pre_call",children:"pre_call"}),(0,l.jsx)(e9,{value:"post_call",children:"post_call"})]})})}),(0,l.jsx)(r.Form.Item,{name:"default_on",label:"Always On",tooltip:"If enabled, this guardrail will be applied to all requests by default",valuePropName:"checked",children:(0,l.jsx)(D.Switch,{})}),(()=>{if(!f)return null;if("PresidioPII"===f)return j&&f&&"PresidioPII"===f?(0,l.jsx)(eP,{entities:j.supported_entities,actions:j.supported_actions,selectedEntities:b,selectedActions:N,onEntitySelect:w,onActionSelect:S,entityCategories:j.pii_entity_categories}):null;switch(f){case"Aporia":return(0,l.jsx)(r.Form.Item,{label:"Aporia Configuration",name:"config",tooltip:"JSON configuration for Aporia",children:(0,l.jsx)(i.Input.TextArea,{rows:4,placeholder:`{ + "api_key": "your_aporia_api_key", + "project_name": "your_project_name" +}`})});case"AimSecurity":return(0,l.jsx)(r.Form.Item,{label:"Aim Security Configuration",name:"config",tooltip:"JSON configuration for Aim Security",children:(0,l.jsx)(i.Input.TextArea,{rows:4,placeholder:`{ + "api_key": "your_aim_api_key" +}`})});case"Bedrock":return(0,l.jsx)(r.Form.Item,{label:"Amazon Bedrock Configuration",name:"config",tooltip:"JSON configuration for Amazon Bedrock guardrails",children:(0,l.jsx)(i.Input.TextArea,{rows:4,placeholder:`{ + "guardrail_id": "your_guardrail_id", + "guardrail_version": "your_guardrail_version" +}`})});case"GuardrailsAI":return(0,l.jsx)(r.Form.Item,{label:"Guardrails.ai Configuration",name:"config",tooltip:"JSON configuration for Guardrails.ai",children:(0,l.jsx)(i.Input.TextArea,{rows:4,placeholder:`{ + "api_key": "your_guardrails_api_key", + "guardrail_id": "your_guardrail_id" +}`})});case"LakeraAI":return(0,l.jsx)(r.Form.Item,{label:"Lakera AI Configuration",name:"config",tooltip:"JSON configuration for Lakera AI",children:(0,l.jsx)(i.Input.TextArea,{rows:4,placeholder:`{ + "api_key": "your_lakera_api_key" +}`})});case"PromptInjection":return(0,l.jsx)(r.Form.Item,{label:"Prompt Injection Configuration",name:"config",tooltip:"JSON configuration for prompt injection detection",children:(0,l.jsx)(i.Input.TextArea,{rows:4,placeholder:`{ + "threshold": 0.8 +}`})});default:return(0,l.jsx)(r.Form.Item,{label:"Custom Configuration",name:"config",tooltip:"JSON configuration for your custom guardrail",children:(0,l.jsx)(i.Input.TextArea,{rows:4,placeholder:`{ + "key1": "value1", + "key2": "value2" +}`})})}})(),(0,l.jsxs)("div",{className:"flex justify-end space-x-2 mt-4",children:[(0,l.jsx)(eQ.Button,{variant:"secondary",onClick:t,children:"Cancel"}),(0,l.jsx)(eQ.Button,{onClick:k,loading:x,children:"Update Guardrail"})]})]})})};var tt=((a={}).DB="db",a.CONFIG="config",a);e.s(["default",0,({guardrailsList:e,isLoading:t,onDeleteClick:a,accessToken:r,onGuardrailUpdated:i,isAdmin:s=!1,onGuardrailClick:n})=>{let[o,d]=(0,m.useState)([{id:"created_at",desc:!0}]),[c,u]=(0,m.useState)(!1),[p,g]=(0,m.useState)(null),x=e=>e?new Date(e).toLocaleString():"-",h=[{header:"Guardrail ID",accessorKey:"guardrail_id",cell:e=>(0,l.jsx)(ef.Tooltip,{title:String(e.getValue()||""),children:(0,l.jsx)(eQ.Button,{size:"xs",variant:"light",className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left overflow-hidden truncate max-w-[200px]",onClick:()=>e.getValue()&&n(e.getValue()),children:e.getValue()?`${String(e.getValue()).slice(0,7)}...`:""})})},{header:"Name",accessorKey:"guardrail_name",cell:({row:e})=>{let t=e.original;return(0,l.jsx)(ef.Tooltip,{title:t.guardrail_name,children:(0,l.jsx)("span",{className:"text-xs font-medium",children:t.guardrail_name||"-"})})}},{header:"Provider",accessorKey:"litellm_params.guardrail",cell:({row:e})=>{let{logo:t,displayName:a}=eo(e.original.litellm_params.guardrail);return(0,l.jsxs)("div",{className:"flex items-center space-x-2",children:[t&&(0,l.jsx)("img",{src:t,alt:`${a} logo`,className:"w-4 h-4",onError:e=>{e.target.style.display="none"}}),(0,l.jsx)("span",{className:"text-xs",children:a})]})}},{header:"Mode",accessorKey:"litellm_params.mode",cell:({row:e})=>{let t=e.original;return(0,l.jsx)("span",{className:"text-xs",children:t.litellm_params.mode})}},{header:"Default On",accessorKey:"litellm_params.default_on",cell:({row:e})=>{let t=e.original;return(0,l.jsx)(e4.Badge,{color:t.litellm_params?.default_on?"green":"gray",className:"text-xs font-normal",size:"xs",children:t.litellm_params?.default_on?"Default On":"Default Off"})}},{header:"Created At",accessorKey:"created_at",cell:({row:e})=>{let t=e.original;return(0,l.jsx)(ef.Tooltip,{title:t.created_at,children:(0,l.jsx)("span",{className:"text-xs",children:x(t.created_at)})})}},{header:"Updated At",accessorKey:"updated_at",cell:({row:e})=>{let t=e.original;return(0,l.jsx)(ef.Tooltip,{title:t.updated_at,children:(0,l.jsx)("span",{className:"text-xs",children:x(t.updated_at)})})}},{id:"actions",header:"Actions",cell:({row:e})=>{let t=e.original,r=t.guardrail_definition_location===tt.CONFIG;return(0,l.jsx)("div",{className:"flex space-x-2",children:r?(0,l.jsx)(ef.Tooltip,{title:"Config guardrail cannot be deleted on the dashboard. Please delete it from the config file.",children:(0,l.jsx)(eZ.Icon,{"data-testid":"config-delete-icon",icon:eX.TrashIcon,size:"sm",className:"cursor-not-allowed text-gray-400",title:"Config guardrail cannot be deleted on the dashboard. Please delete it from the config file.","aria-label":"Delete guardrail (config)"})}):(0,l.jsx)(ef.Tooltip,{title:"Delete guardrail",children:(0,l.jsx)(eZ.Icon,{icon:eX.TrashIcon,size:"sm",onClick:()=>t.guardrail_id&&a(t.guardrail_id,t.guardrail_name||"Unnamed Guardrail"),className:"cursor-pointer hover:text-red-500"})})})}}],f=(0,e5.useReactTable)({data:e,columns:h,state:{sorting:o},onSortingChange:d,getCoreRowModel:(0,e6.getCoreRowModel)(),getSortedRowModel:(0,e6.getSortedRowModel)(),enableSorting:!0});return(0,l.jsxs)("div",{className:"rounded-lg custom-border relative",children:[(0,l.jsx)("div",{className:"overflow-x-auto",children:(0,l.jsxs)(eq.Table,{className:"[&_td]:py-0.5 [&_th]:py-1",children:[(0,l.jsx)(eU.TableHead,{children:f.getHeaderGroups().map(e=>(0,l.jsx)(eY.TableRow,{children:e.headers.map(e=>(0,l.jsx)(eV.TableHeaderCell,{className:`py-1 h-8 ${"actions"===e.id?"sticky right-0 bg-white shadow-[-4px_0_8px_-6px_rgba(0,0,0,0.1)]":""}`,onClick:e.column.getToggleSortingHandler(),children:(0,l.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,l.jsx)("div",{className:"flex items-center",children:e.isPlaceholder?null:(0,e5.flexRender)(e.column.columnDef.header,e.getContext())}),"actions"!==e.id&&(0,l.jsx)("div",{className:"w-4",children:e.column.getIsSorted()?({asc:(0,l.jsx)(e1.ChevronUpIcon,{className:"h-4 w-4 text-blue-500"}),desc:(0,l.jsx)(e2.ChevronDownIcon,{className:"h-4 w-4 text-blue-500"})})[e.column.getIsSorted()]:(0,l.jsx)(e0.SwitchVerticalIcon,{className:"h-4 w-4 text-gray-400"})})]})},e.id))},e.id))}),(0,l.jsx)(eJ.TableBody,{children:t?(0,l.jsx)(eY.TableRow,{children:(0,l.jsx)(eW.TableCell,{colSpan:h.length,className:"h-8 text-center",children:(0,l.jsx)("div",{className:"text-center text-gray-500",children:(0,l.jsx)("p",{children:"Loading..."})})})}):e.length>0?f.getRowModel().rows.map(e=>(0,l.jsx)(eY.TableRow,{className:"h-8",children:e.getVisibleCells().map(e=>(0,l.jsx)(eW.TableCell,{className:`py-0.5 max-h-8 overflow-hidden text-ellipsis whitespace-nowrap ${"actions"===e.column.id?"sticky right-0 bg-white shadow-[-4px_0_8px_-6px_rgba(0,0,0,0.1)]":""}`,children:(0,e5.flexRender)(e.column.columnDef.cell,e.getContext())},e.id))},e.id)):(0,l.jsx)(eY.TableRow,{children:(0,l.jsx)(eW.TableCell,{colSpan:h.length,className:"h-8 text-center",children:(0,l.jsx)("div",{className:"text-center text-gray-500",children:(0,l.jsx)("p",{children:"No guardrails found"})})})})})]})}),p&&(0,l.jsx)(te,{visible:c,onClose:()=>u(!1),accessToken:r,onSuccess:()=>{u(!1),g(null),i()},guardrailId:p.guardrail_id||"",initialValues:{guardrail_name:p.guardrail_name||"",provider:Object.keys(ea).find(e=>ea[e]===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}})]})}],782719);var ta=e.i(500330),tl=e.i(245094),ej=ej,tr=e.i(530212),ti=e.i(350967),ts=e.i(197647),tn=e.i(653824),to=e.i(881073),td=e.i(404206),tc=e.i(723731),tm=e.i(629569),tu=e.i(678784),tp=e.i(118366),tg=e.i(560445);let{Text:tx}=d.Typography,{Option:th}=n.Select,tf=({categories:e,onActionChange:t,onSeverityChange:a,onRemove:r,readOnly:i=!1})=>{let s=[{title:"Category",dataIndex:"display_name",key:"display_name",render:(e,t)=>(0,l.jsxs)("div",{children:[(0,l.jsx)(tx,{strong:!0,children:e}),e!==t.category&&(0,l.jsx)("div",{children:(0,l.jsx)(tx,{type:"secondary",style:{fontSize:12},children:t.category})})]})},{title:"Severity Threshold",dataIndex:"severity_threshold",key:"severity_threshold",width:180,render:(e,t)=>i?(0,l.jsx)(o.Tag,{color:{high:"red",medium:"orange",low:"yellow"}[e],children:e.toUpperCase()}):(0,l.jsxs)(n.Select,{value:e,onChange:e=>a?.(t.id,e),style:{width:150},size:"small",children:[(0,l.jsx)(th,{value:"high",children:"High"}),(0,l.jsx)(th,{value:"medium",children:"Medium"}),(0,l.jsx)(th,{value:"low",children:"Low"})]})},{title:"Action",dataIndex:"action",key:"action",width:150,render:(e,a)=>i?(0,l.jsx)(o.Tag,{color:"BLOCK"===e?"red":"blue",children:e}):(0,l.jsxs)(n.Select,{value:e,onChange:e=>t?.(a.id,e),style:{width:120},size:"small",children:[(0,l.jsx)(th,{value:"BLOCK",children:"Block"}),(0,l.jsx)(th,{value:"MASK",children:"Mask"})]})}];return(i||s.push({title:"",key:"actions",width:100,render:(e,t)=>(0,l.jsx)(c.Button,{type:"text",danger:!0,size:"small",icon:(0,l.jsx)(A.DeleteOutlined,{}),onClick:()=>r?.(t.id),children:"Delete"})}),0===e.length)?(0,l.jsx)("div",{style:{textAlign:"center",padding:"40px 0",color:"#999"},children:"No categories configured."}):(0,l.jsx)(I.Table,{dataSource:e,columns:s,rowKey:"id",pagination:!1,size:"small"})},ty=({patterns:e,blockedWords:t,categories:a=[],readOnly:r=!0,onPatternActionChange:i,onPatternRemove:s,onBlockedWordUpdate:n,onBlockedWordRemove:o,onCategoryActionChange:d,onCategorySeverityChange:c,onCategoryRemove:m})=>{if(0===e.length&&0===t.length&&0===a.length)return null;let u=()=>{};return(0,l.jsxs)(l.Fragment,{children:[a.length>0&&(0,l.jsxs)(eB.Card,{className:"mt-6",children:[(0,l.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,l.jsx)(eL.Text,{className:"text-lg font-semibold",children:"Content Categories"}),(0,l.jsxs)(e4.Badge,{color:"blue",children:[a.length," categories configured"]})]}),(0,l.jsx)(tf,{categories:a,onActionChange:r?void 0:d,onSeverityChange:r?void 0:c,onRemove:r?void 0:m,readOnly:r})]}),e.length>0&&(0,l.jsxs)(eB.Card,{className:"mt-6",children:[(0,l.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,l.jsx)(eL.Text,{className:"text-lg font-semibold",children:"Pattern Detection"}),(0,l.jsxs)(e4.Badge,{color:"blue",children:[e.length," patterns configured"]})]}),(0,l.jsx)(P,{patterns:e,onActionChange:r?u:i||u,onRemove:r?u:s||u})]}),t.length>0&&(0,l.jsxs)(eB.Card,{className:"mt-6",children:[(0,l.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,l.jsx)(eL.Text,{className:"text-lg font-semibold",children:"Blocked Keywords"}),(0,l.jsxs)(e4.Badge,{color:"blue",children:[t.length," keywords configured"]})]}),(0,l.jsx)(F,{keywords:t,onActionChange:r?u:n||u,onRemove:r?u:o||u})]})]})},{Text:tj}=d.Typography,t_=({guardrailData:e,guardrailSettings:t,isEditing:a,accessToken:r,onDataChange:i,onUnsavedChanges:s})=>{let[n,o]=(0,m.useState)([]),[d,c]=(0,m.useState)([]),[u,p]=(0,m.useState)([]),[g,x]=(0,m.useState)([]),[h,f]=(0,m.useState)([]),[y,j]=(0,m.useState)([]),[_,b]=(0,m.useState)(!1),[v,N]=(0,m.useState)(null),[C,w]=(0,m.useState)(!1),[S,k]=(0,m.useState)(null);(0,m.useEffect)(()=>{if(e?.litellm_params?.patterns){let t=e.litellm_params.patterns.map((e,t)=>({id:`pattern-${t}`,type:"prebuilt"===e.pattern_type?"prebuilt":"custom",name:e.pattern_name||e.name,display_name:e.display_name,pattern:e.pattern,action:e.action||"BLOCK"}));o(t),x(t)}else o([]),x([]);if(e?.litellm_params?.blocked_words){let t=e.litellm_params.blocked_words.map((e,t)=>({id:`word-${t}`,keyword:e.keyword,action:e.action||"BLOCK",description:e.description}));c(t),f(t)}else c([]),f([]);if(e?.litellm_params?.categories?.length>0){let a=t?.content_filter_settings?.content_categories?Object.fromEntries(t.content_filter_settings.content_categories.map(e=>[e.name,e])):{},l=e.litellm_params.categories.map((e,t)=>{let l=a[e.category];return{id:`category-${t}`,category:e.category,display_name:l?.display_name??e.category,action:e.action||"BLOCK",severity_threshold:e.severity_threshold||"medium"}});p(l),j(l)}else p([]),j([]);let a=e?.litellm_params?.competitor_intent_config;if(a&&"object"==typeof a){let e=!!(a.brand_self&&Array.isArray(a.brand_self)&&a.brand_self.length>0),t={competitor_intent_type:a.competitor_intent_type??"airline",brand_self:Array.isArray(a.brand_self)?a.brand_self:[],locations:Array.isArray(a.locations)?a.locations:[],competitors:Array.isArray(a.competitors)?a.competitors:[],policy:a.policy??{competitor_comparison:"refuse",possible_competitor_comparison:"reframe"},threshold_high:"number"==typeof a.threshold_high?a.threshold_high:.7,threshold_medium:"number"==typeof a.threshold_medium?a.threshold_medium:.45,threshold_low:"number"==typeof a.threshold_low?a.threshold_low:.3};b(e),N(t),w(e),k(t)}else b(!1),N(null),w(!1),k(null)},[e,t?.content_filter_settings?.content_categories]),(0,m.useEffect)(()=>{i&&i(n,d,u,_,v)},[n,d,u,_,v,i]);let I=m.default.useMemo(()=>{let e=JSON.stringify(n)!==JSON.stringify(g),t=JSON.stringify(d)!==JSON.stringify(h),a=JSON.stringify(u)!==JSON.stringify(y),l=_!==C||JSON.stringify(v)!==JSON.stringify(S);return e||t||a||l},[n,d,u,_,v,g,h,y,C,S]);return((0,m.useEffect)(()=>{a&&s&&s(I)},[I,a,s]),e?.litellm_params?.guardrail!=="litellm_content_filter")?null:a?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(eF.Divider,{orientation:"left",children:"Content Filter Configuration"}),I&&(0,l.jsx)(tg.Alert,{type:"warning",showIcon:!0,className:"mb-4",message:(0,l.jsx)(tj,{children:'You have unsaved changes to patterns or keywords. Remember to click "Save Changes" at the bottom.'})}),(0,l.jsx)("div",{className:"mb-6",children:t&&t.content_filter_settings&&(0,l.jsx)(Z,{prebuiltPatterns:t.content_filter_settings.prebuilt_patterns||[],categories:t.content_filter_settings.pattern_categories||[],selectedPatterns:n,blockedWords:d,onPatternAdd:e=>o([...n,e]),onPatternRemove:e=>o(n.filter(t=>t.id!==e)),onPatternActionChange:(e,t)=>o(n.map(a=>a.id===e?{...a,action:t}:a)),onBlockedWordAdd:e=>c([...d,e]),onBlockedWordRemove:e=>c(d.filter(t=>t.id!==e)),onBlockedWordUpdate:(e,t,a)=>c(d.map(l=>l.id===e?{...l,[t]:a}:l)),onFileUpload:e=>{console.log("File uploaded:",e)},accessToken:r,contentCategories:t.content_filter_settings.content_categories||[],selectedContentCategories:u,onContentCategoryAdd:e=>p([...u,e]),onContentCategoryRemove:e=>p(u.filter(t=>t.id!==e)),onContentCategoryUpdate:(e,t,a)=>p(u.map(l=>l.id===e?{...l,[t]:a}:l)),competitorIntentEnabled:_,competitorIntentConfig:v,onCompetitorIntentChange:(e,t)=>{b(e),N(t)}})})]}):(0,l.jsx)(ty,{patterns:n,blockedWords:d,categories:u,readOnly:!0})};var tb=e.i(788191),tv=e.i(245704),tN=e.i(518617);let tC={icon:{tag:"svg",attrs:{viewBox:"0 0 1024 1024",focusable:"false"},children:[{tag:"path",attrs:{d:"M715.8 493.5L335 165.1c-14.2-12.2-35-1.2-35 18.5v656.8c0 19.7 20.8 30.7 35 18.5l380.8-328.4c10.9-9.4 10.9-27.6 0-37z"}}]},name:"caret-right",theme:"outlined"};var tw=m.forwardRef(function(e,t){return m.createElement(eN.default,(0,eb.default)({},e,{ref:t,icon:tC}))}),tS=e.i(987432);let tk={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M892 772h-80v-80c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v80h-80c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h80v80c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8v-80h80c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8zM373.5 498.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.8-1.7-203.2 89.2-203.2 200 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.8-1.1 6.4-4.8 5.9-8.8zM824 472c0-109.4-87.9-198.3-196.9-200C516.3 270.3 424 361.2 424 472c0 62.8 29 118.8 74.2 155.5a300.95 300.95 0 00-86.4 60.4C357 742.6 326 814.8 324 891.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.5C505.8 695.7 563 672 624 672c110.4 0 200-89.5 200-200zm-109.5 90.5C690.3 586.7 658.2 600 624 600s-66.3-13.3-90.5-37.5a127.26 127.26 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-.1 34.2-13.4 66.3-37.6 90.5z"}}]},name:"usergroup-add",theme:"outlined"};var tI=m.forwardRef(function(e,t){return m.createElement(eN.default,(0,eb.default)({},e,{ref:t,icon:tk}))}),tA=e.i(872934);let{Panel:tT}=$.Collapse,{TextArea:tO}=i.Input,tP={empty:{name:"Empty Template",code:`async def apply_guardrail(inputs, request_data, input_type): + # inputs: {texts, images, tools, tool_calls, structured_messages, model} + # request_data: {model, user_id, team_id, end_user_id, metadata} + # input_type: "request" or "response" + return allow()`},blockSSN:{name:"Block SSN",code:`def apply_guardrail(inputs, request_data, input_type): + for text in inputs["texts"]: + if regex_match(text, r"\\d{3}-\\d{2}-\\d{4}"): + return block("SSN detected") + return allow()`},redactEmail:{name:"Redact Emails",code:`def apply_guardrail(inputs, request_data, input_type): + pattern = r"[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}" + modified = [] + for text in inputs["texts"]: + modified.append(regex_replace(text, pattern, "[EMAIL REDACTED]")) + return modify(texts=modified)`},blockSQL:{name:"Block SQL Injection",code:`def apply_guardrail(inputs, request_data, input_type): + if input_type != "request": + return allow() + for text in inputs["texts"]: + if contains_code_language(text, ["sql"]): + return block("SQL code not allowed") + return allow()`},validateJSON:{name:"Validate JSON",code:`def apply_guardrail(inputs, request_data, input_type): + if input_type != "response": + return allow() + + schema = {"type": "object", "required": ["name", "value"]} + + for text in inputs["texts"]: + obj = json_parse(text) + if obj is None: + return block("Invalid JSON response") + if not json_schema_valid(obj, schema): + return block("Response missing required fields") + return allow()`},externalAPI:{name:"External API Check (async)",code:`async def apply_guardrail(inputs, request_data, input_type): + # Call an external moderation API (async for non-blocking) + for text in inputs["texts"]: + response = await http_post( + "https://api.example.com/moderate", + body={"text": text, "user_id": request_data["user_id"]}, + headers={"Authorization": "Bearer YOUR_API_KEY"}, + timeout=10 + ) + + if not response["success"]: + # API call failed, allow by default or block + return allow() + + if response["body"].get("flagged"): + return block(response["body"].get("reason", "Content flagged")) + + return allow()`}},tB={"Return Values":[{name:"allow()",desc:"Let request/response through"},{name:"block(reason)",desc:"Reject with message"},{name:"modify(texts=[], images=[], tool_calls=[])",desc:"Transform content"}],"HTTP Requests (async)":[{name:"await http_request(url, method, headers, body)",desc:"Make async HTTP request"},{name:"await http_get(url, headers)",desc:"Async GET request"},{name:"await http_post(url, body, headers)",desc:"Async POST request"}],"Regex Functions":[{name:"regex_match(text, pattern)",desc:"Returns True if pattern found"},{name:"regex_replace(text, pattern, replacement)",desc:"Replace all matches"},{name:"regex_find_all(text, pattern)",desc:"Return list of matches"}],"JSON Functions":[{name:"json_parse(text)",desc:"Parse JSON string, returns None on error"},{name:"json_stringify(obj)",desc:"Convert to JSON string"},{name:"json_schema_valid(obj, schema)",desc:"Validate against JSON schema"}],"URL Functions":[{name:"extract_urls(text)",desc:"Extract all URLs from text"},{name:"is_valid_url(url)",desc:"Check if URL is valid"},{name:"all_urls_valid(text)",desc:"Check all URLs in text are valid"}],"Code Detection":[{name:"detect_code(text)",desc:"Returns True if code detected"},{name:"detect_code_languages(text)",desc:"Returns list of detected languages"},{name:'contains_code_language(text, ["sql"])',desc:"Check for specific languages"}],"Text Utilities":[{name:"contains(text, substring)",desc:"Check if substring exists"},{name:"contains_any(text, [substr1, substr2])",desc:"Check if any substring exists"},{name:"word_count(text)",desc:"Count words"},{name:"char_count(text)",desc:"Count characters"},{name:"lower(text) / upper(text) / trim(text)",desc:"String transforms"}]},tL=[{value:"pre_call",label:"pre_call (Request)"},{value:"post_call",label:"post_call (Response)"},{value:"during_call",label:"during_call (Parallel)"},{value:"logging_only",label:"logging_only"},{value:"pre_mcp_call",label:"pre_mcp_call (Before MCP Tool Call)"},{value:"post_mcp_call",label:"post_mcp_call (After MCP Tool Call)"},{value:"during_mcp_call",label:"during_mcp_call (During MCP Tool Call)"}],tF=({visible:e,onClose:t,onSuccess:a,accessToken:r,editData:i})=>{let o=!!i,[d,c]=(0,m.useState)(""),[g,x]=(0,m.useState)(["pre_call"]),[h,f]=(0,m.useState)(!1),[y,j]=(0,m.useState)("empty"),[_,b]=(0,m.useState)(tP.empty.code),[v,N]=(0,m.useState)(!1),[C,w]=(0,m.useState)(!1),[S,k]=(0,m.useState)(!1),I={texts:["Hello, my SSN is 123-45-6789"],images:[],tools:[{type:"function",function:{name:"get_weather",description:"Get the current weather in a location",parameters:{type:"object",properties:{location:{type:"string",description:"City name"}},required:["location"]}}}],tool_calls:[],structured_messages:[{role:"system",content:"You are a helpful assistant."},{role:"user",content:"Hello, my SSN is 123-45-6789"}],model:"gpt-4"},A={texts:["The weather in San Francisco is 72°F and sunny."],images:[],tools:[],tool_calls:[{id:"call_abc123",type:"function",function:{name:"get_weather",arguments:'{"location": "San Francisco"}'}}],structured_messages:[],model:"gpt-4"},T={texts:['Tool: read_wiki_structure\nArguments: {"repoName": "BerriAI/litellm"}'],images:[],tools:[{type:"function",function:{name:"read_wiki_structure",description:"Read the structure of a GitHub repository (MCP tool passed as OpenAI tool)",parameters:{type:"object",properties:{repoName:{type:"string",description:"Repository name, e.g. BerriAI/litellm"}},required:["repoName"]}}}],tool_calls:[{id:"call_mcp_001",type:"function",function:{name:"read_wiki_structure",arguments:'{"repoName": "BerriAI/litellm"}'}}],structured_messages:[{role:"user",content:'Tool: read_wiki_structure\nArguments: {"repoName": "BerriAI/litellm"}'}],model:"mcp-tool-call"},[O,P]=(0,m.useState)(JSON.stringify(I,null,2)),[B,L]=(0,m.useState)(null),[F,E]=(0,m.useState)(null),R=(0,m.useRef)(null),M=e=>null==e?["pre_call"]:Array.isArray(e)?e.length?e:["pre_call"]:[e];(0,m.useEffect)(()=>{e&&(i?(c(i.guardrail_name||""),x(M(i.litellm_params?.mode)),f(i.litellm_params?.default_on||!1),b(i.litellm_params?.custom_code||tP.empty.code),j("")):(c(""),x(["pre_call"]),f(!1),j("empty"),b(tP.empty.code)),L(null),k(!1))},[e,i]);let z=async e=>{try{await navigator.clipboard.writeText(e),E(e),setTimeout(()=>E(null),2e3)}catch(e){console.error("Failed to copy:",e)}},G=async()=>{if(!d.trim())return void u.default.fromBackend("Please enter a guardrail name");if(!_.trim())return void u.default.fromBackend("Please enter custom code");if(!r)return void u.default.fromBackend("No access token available");N(!0);try{if(o&&i){let e={litellm_params:{custom_code:_}};d!==i.guardrail_name&&(e.guardrail_name=d);let t=M(i.litellm_params?.mode);(g.length!==t.length||g.some((e,a)=>e!==t[a]))&&(e.litellm_params.mode=g),h!==i.litellm_params?.default_on&&(e.litellm_params.default_on=h),await (0,p.updateGuardrailCall)(r,i.guardrail_id,e),u.default.success("Custom code guardrail updated successfully")}else await (0,p.createGuardrailCall)(r,{guardrail_name:d,litellm_params:{guardrail:"custom_code",mode:g,default_on:h,custom_code:_},guardrail_info:{}}),u.default.success("Custom code guardrail created successfully");a(),t()}catch(e){console.error("Failed to save guardrail:",e),u.default.fromBackend(`Failed to ${o?"update":"create"} guardrail: `+(e instanceof Error?e.message:String(e)))}finally{N(!1)}},K=async()=>{if(!r)return void L({error:"No access token available"});w(!0),L(null);try{let e;try{e=JSON.parse(O)}catch(e){L({error:"Invalid test input JSON"}),w(!1);return}e.texts||(e.texts=[]);let t=["pre_call","pre_mcp_call"],a=["post_call","post_mcp_call"],l=g.some(e=>t.includes(e))?"request":g.some(e=>a.includes(e))?"response":"request",i=await (0,p.testCustomCodeGuardrail)(r,{custom_code:_,test_input:e,input_type:l,request_data:{model:"test-model",metadata:{}}});i.success&&i.result?L(i.result):i.error?L({error:i.error,error_type:i.error_type}):L({error:"Unknown error occurred"})}catch(e){console.error("Failed to test custom code:",e),L({error:e instanceof Error?e.message:"Failed to test custom code"})}finally{w(!1)}},H=_.split("\n").length;return(0,l.jsxs)(s.Modal,{open:e,onCancel:t,footer:null,width:1400,className:"custom-code-modal",closable:!0,destroyOnClose:!0,children:[(0,l.jsxs)("div",{className:"flex flex-col h-[80vh]",children:[(0,l.jsxs)("div",{className:"pb-4 border-b border-gray-200",children:[(0,l.jsx)("h2",{className:"text-xl font-semibold text-gray-900",children:o?"Edit Custom Guardrail":"Create Custom Guardrail"}),(0,l.jsx)("p",{className:"text-sm text-gray-500 mt-1",children:"Define custom logic using Python-like syntax"})]}),(0,l.jsxs)("div",{className:"flex items-center gap-4 py-4 border-b border-gray-100",children:[(0,l.jsxs)("div",{className:"flex-1 max-w-[200px]",children:[(0,l.jsx)("label",{className:"block text-xs font-medium text-gray-600 mb-1",children:"Guardrail Name"}),(0,l.jsx)(e8.TextInput,{value:d,onValueChange:c,placeholder:"e.g., block-pii-custom"})]}),(0,l.jsxs)("div",{className:"w-[280px]",children:[(0,l.jsx)("label",{className:"block text-xs font-medium text-gray-600 mb-1",children:"Mode (can select multiple)"}),(0,l.jsx)(n.Select,{mode:"multiple",value:g,onChange:x,options:tL,className:"w-full",size:"middle",placeholder:"Select modes"})]}),(0,l.jsxs)("div",{className:"w-[180px]",children:[(0,l.jsx)("label",{className:"block text-xs font-medium text-gray-600 mb-1",children:"Template"}),(0,l.jsx)(n.Select,{value:y,onChange:e=>{j(e),b(tP[e].code)},className:"w-full",size:"middle",dropdownRender:e=>(0,l.jsxs)(l.Fragment,{children:[e,(0,l.jsx)(eF.Divider,{style:{margin:"8px 0"}}),(0,l.jsxs)("div",{style:{padding:"8px 12px",cursor:"pointer",color:"#1890ff",fontSize:"12px",display:"flex",alignItems:"center",gap:"4px"},onClick:e=>{e.preventDefault(),window.open("https://models.litellm.ai/guardrails","_blank")},onMouseEnter:e=>{e.currentTarget.style.backgroundColor="#f0f0f0"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="transparent"},children:[(0,l.jsx)(tI,{}),(0,l.jsx)("span",{children:"Browse Community templates"}),(0,l.jsx)(tA.ExportOutlined,{style:{fontSize:"10px"}})]})]}),children:(0,l.jsx)(n.Select.OptGroup,{label:"STANDARD",children:Object.entries(tP).map(([e,t])=>(0,l.jsx)(n.Select.Option,{value:e,children:t.name},e))})})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2 pt-5",children:[(0,l.jsx)("span",{className:"text-sm text-gray-600",children:"Default On"}),(0,l.jsx)(D.Switch,{checked:h,onChange:f})]})]}),(0,l.jsxs)("div",{className:"flex flex-1 overflow-hidden mt-4 gap-6",children:[(0,l.jsxs)("div",{className:"flex-[2] flex flex-col min-w-0 overflow-y-auto",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between mb-2 flex-shrink-0",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wide",children:"Python Logic"}),(0,l.jsx)("span",{className:"text-xs text-gray-400",children:"Restricted environment (no imports)"})]}),(0,l.jsxs)("div",{className:"relative rounded-lg overflow-hidden border border-gray-700 bg-[#1e1e1e] flex-shrink-0",style:{minHeight:"300px",maxHeight:"400px"},children:[(0,l.jsx)("div",{className:"absolute left-0 top-0 bottom-0 w-12 bg-[#1e1e1e] border-r border-gray-700 text-right pr-3 pt-3 select-none overflow-hidden",style:{fontFamily:"'Fira Code', 'Monaco', 'Consolas', monospace",fontSize:"14px",lineHeight:"1.6"},children:Array.from({length:Math.max(H,20)},(e,t)=>(0,l.jsx)("div",{className:"text-gray-500 h-[22.4px]",children:t+1},t+1))}),(0,l.jsx)("textarea",{ref:R,value:_,onChange:e=>b(e.target.value),onKeyDown:e=>{if("Tab"===e.key){e.preventDefault();let t=e.currentTarget,a=t.selectionStart,l=t.selectionEnd;b(_.substring(0,a)+" "+_.substring(l)),setTimeout(()=>{t.selectionStart=t.selectionEnd=a+4},0)}},spellCheck:!1,className:"w-full h-full pl-14 pr-4 pt-3 pb-3 resize-none focus:outline-none bg-transparent text-gray-200",style:{fontFamily:"'Fira Code', 'Monaco', 'Consolas', monospace",fontSize:"14px",lineHeight:"1.6",tabSize:4}})]}),(0,l.jsx)($.Collapse,{activeKey:S?["test"]:[],onChange:e=>k(e.includes("test")),className:"mt-3 bg-white border border-gray-200 rounded-lg flex-shrink-0",expandIcon:({isActive:e})=>(0,l.jsx)(tw,{rotate:90*!!e}),children:(0,l.jsx)(tT,{header:(0,l.jsxs)("span",{className:"flex items-center gap-2 text-sm font-medium",children:[(0,l.jsx)(tb.PlayCircleOutlined,{className:"text-blue-500"}),"Test Your Guardrail"]}),children:(0,l.jsxs)("div",{className:"space-y-3",children:[(0,l.jsxs)("div",{children:[(0,l.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,l.jsx)("label",{className:"block text-xs font-medium text-gray-600",children:"Test Input (JSON)"}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"text-xs text-gray-500",children:"Load example:"}),(0,l.jsx)("button",{type:"button",onClick:()=>P(JSON.stringify(I,null,2)),className:"px-2 py-1 text-xs rounded border border-orange-200 bg-orange-50 text-orange-700 hover:bg-orange-100 transition-colors",children:"Pre-call"}),(0,l.jsx)("button",{type:"button",onClick:()=>P(JSON.stringify(T,null,2)),className:"px-2 py-1 text-xs rounded border border-purple-200 bg-purple-50 text-purple-700 hover:bg-purple-100 transition-colors",children:"Pre MCP"}),(0,l.jsx)("button",{type:"button",onClick:()=>P(JSON.stringify(A,null,2)),className:"px-2 py-1 text-xs rounded border border-green-200 bg-green-50 text-green-700 hover:bg-green-100 transition-colors",children:"Post-call"})]})]}),(0,l.jsx)("div",{className:"mb-2 p-2 bg-gray-50 rounded text-xs text-gray-600 border border-gray-200",children:(0,l.jsxs)("div",{className:"grid grid-cols-2 gap-x-4 gap-y-1",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("strong",{children:"texts"}),": Message content (always)"]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("strong",{children:"images"}),": Base64 images (vision)"]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("strong",{children:"tools"}),": Tool definitions ",(0,l.jsx)("span",{className:"text-orange-600",children:"(pre_call)"}),", MCP as OpenAI tool ",(0,l.jsx)("span",{className:"text-purple-600",children:"(pre_mcp_call)"})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("strong",{children:"tool_calls"}),": LLM tool calls ",(0,l.jsx)("span",{className:"text-green-600",children:"(post_call)"})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("strong",{children:"structured_messages"}),": Full messages ",(0,l.jsx)("span",{className:"text-orange-600",children:"(pre_call)"})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("strong",{children:"model"}),": Model name (always)"]})]})}),(0,l.jsx)(tO,{value:O,onChange:e=>P(e.target.value),rows:8,className:"font-mono text-xs",placeholder:'{"texts": ["test message"], ...}'})]}),(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[(0,l.jsx)(eQ.Button,{size:"xs",onClick:K,disabled:C,icon:tb.PlayCircleOutlined,children:C?"Running...":"Run Test"}),B&&(0,l.jsx)("div",{className:`flex items-center gap-2 text-sm ${B.error?"text-red-600":"allow"===B.action?"text-green-600":"block"===B.action?"text-orange-600":"text-blue-600"}`,children:B.error?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(tN.CloseCircleOutlined,{}),(0,l.jsxs)("span",{children:[B.error_type&&(0,l.jsxs)("span",{className:"font-medium",children:["[",B.error_type,"] "]}),B.error]})]}):"allow"===B.action?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(tv.CheckCircleOutlined,{})," Allowed"]}):"block"===B.action?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(tN.CloseCircleOutlined,{})," Blocked: ",B.reason]}):"modify"===B.action?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(tv.CheckCircleOutlined,{})," Modified",B.texts&&B.texts.length>0&&(0,l.jsxs)("span",{className:"text-xs text-gray-500 ml-1",children:["→ ",B.texts[0].substring(0,50),B.texts[0].length>50?"...":""]})]}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(tv.CheckCircleOutlined,{})," ",B.action||"Unknown"]})})]})]})},"test")}),(0,l.jsxs)("div",{className:"mt-3 p-4 bg-gradient-to-r from-blue-50 to-indigo-50 border border-blue-200 rounded-lg flex items-center justify-between flex-shrink-0",children:[(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[(0,l.jsx)("div",{className:"bg-blue-100 rounded-full p-2",children:(0,l.jsx)(tI,{className:"text-blue-600 text-lg"})}),(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{className:"text-sm font-medium text-gray-900",children:"Built a useful guardrail?"}),(0,l.jsx)("div",{className:"text-xs text-gray-600",children:"Share it with the community and help others build faster"})]})]}),(0,l.jsx)(eQ.Button,{size:"xs",onClick:()=>window.open("https://github.com/BerriAI/litellm-guardrails","_blank"),icon:tA.ExportOutlined,className:"bg-blue-600 hover:bg-blue-700 text-white border-0",children:"Contribute Template"})]})]}),(0,l.jsxs)("div",{className:"w-[300px] flex-shrink-0 overflow-auto border-l border-gray-200 pl-6",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,l.jsx)(tl.CodeOutlined,{className:"text-blue-500"}),(0,l.jsx)("span",{className:"font-semibold text-gray-700",children:"Available Primitives"})]}),(0,l.jsx)("p",{className:"text-xs text-gray-500 mb-3",children:"Click to copy functions to clipboard"}),(0,l.jsx)($.Collapse,{defaultActiveKey:["Return Values"],className:"primitives-collapse bg-transparent border-0",expandIconPosition:"end",children:Object.entries(tB).map(([e,t])=>(0,l.jsx)(tT,{header:(0,l.jsx)("span",{className:"text-sm font-medium text-gray-700",children:e}),className:"bg-white mb-2 rounded-lg border border-gray-200",children:(0,l.jsx)("div",{className:"space-y-2",children:t.map(e=>(0,l.jsx)("button",{onClick:()=>z(e.name),className:`w-full text-left px-2 py-2 rounded transition-colors ${F===e.name?"bg-green-100":"bg-gray-50 hover:bg-blue-50"}`,children:F===e.name?(0,l.jsxs)("span",{className:"flex items-center gap-1 text-xs font-mono text-green-700",children:[(0,l.jsx)(tv.CheckCircleOutlined,{})," Copied!"]}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("div",{className:"text-xs font-mono text-gray-800",children:e.name}),(0,l.jsx)("div",{className:"text-[10px] text-gray-500 mt-0.5",children:e.desc})]})},e.name))})},e))})]})]}),(0,l.jsxs)("div",{className:"flex items-center justify-between pt-4 mt-4 border-t border-gray-200",children:[(0,l.jsx)("span",{className:"text-xs text-gray-400",children:"Changes are auto-saved to local draft"}),(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[(0,l.jsx)(eQ.Button,{variant:"secondary",onClick:t,children:"Cancel"}),(0,l.jsx)(eQ.Button,{onClick:G,loading:v,disabled:v||!d.trim(),icon:tS.SaveOutlined,children:o?"Update Guardrail":"Save Guardrail"})]})]})]}),(0,l.jsx)("style",{children:` + .custom-code-modal .ant-modal-content { + padding: 24px; + } + .custom-code-modal .ant-modal-close { + top: 20px; + right: 20px; + } + .primitives-collapse .ant-collapse-item { + border: none !important; + } + .primitives-collapse .ant-collapse-header { + padding: 8px 12px !important; + } + .primitives-collapse .ant-collapse-content-box { + padding: 8px 12px !important; + } + `})]})};e.s(["default",0,({guardrailId:e,onClose:t,accessToken:a,isAdmin:s})=>{let[o,d]=(0,m.useState)(null),[g,x]=(0,m.useState)(null),[h,f]=(0,m.useState)(!0),[y,j]=(0,m.useState)(!1),[_]=r.Form.useForm(),[b,v]=(0,m.useState)([]),[N,C]=(0,m.useState)({}),[w,S]=(0,m.useState)(null),[k,I]=(0,m.useState)({}),[A,T]=(0,m.useState)(!1),O={rules:[],default_action:"deny",on_disallowed_action:"block",violation_message_template:""},[P,B]=(0,m.useState)(O),[L,F]=(0,m.useState)(!1),[$,E]=(0,m.useState)(!1),R=m.default.useRef({patterns:[],blockedWords:[],categories:[]}),M=(0,m.useCallback)((e,t,a,l,r)=>{R.current={patterns:e,blockedWords:t,categories:a||[],competitorIntentEnabled:l,competitorIntentConfig:r}},[]),z=async()=>{try{if(f(!0),!a)return;let t=await (0,p.getGuardrailInfo)(a,e);if(d(t),t.litellm_params?.pii_entities_config){let e=t.litellm_params.pii_entities_config;if(v([]),C({}),Object.keys(e).length>0){let t=[],a={};Object.entries(e).forEach(([e,l])=>{t.push(e),a[e]="string"==typeof l?l:"MASK"}),v(t),C(a)}}else v([]),C({})}catch(e){u.default.fromBackend("Failed to load guardrail information"),console.error("Error fetching guardrail info:",e)}finally{f(!1)}},G=async()=>{try{if(!a)return;let e=await (0,p.getGuardrailProviderSpecificParams)(a);x(e)}catch(e){console.error("Error fetching guardrail provider specific params:",e)}},D=async()=>{try{if(!a)return;let e=await (0,p.getGuardrailUISettings)(a);S(e)}catch(e){console.error("Error fetching guardrail UI settings:",e)}};(0,m.useEffect)(()=>{G()},[a]),(0,m.useEffect)(()=>{z(),D()},[e,a]),(0,m.useEffect)(()=>{o&&_&&_.setFieldsValue({guardrail_name:o.guardrail_name,...o.litellm_params,guardrail_info:o.guardrail_info?JSON.stringify(o.guardrail_info,null,2):"",...o.litellm_params?.optional_params&&{optional_params:o.litellm_params.optional_params}})},[o,g,_]);let K=(0,m.useCallback)(()=>{o?.litellm_params?.guardrail==="tool_permission"?B({rules:o.litellm_params?.rules||[],default_action:(o.litellm_params?.default_action||"deny").toLowerCase(),on_disallowed_action:(o.litellm_params?.on_disallowed_action||"block").toLowerCase(),violation_message_template:o.litellm_params?.violation_message_template||""}):B(O),F(!1)},[o]);(0,m.useEffect)(()=>{K()},[K]);let H=async t=>{try{if(!a)return;let d={litellm_params:{}};t.guardrail_name!==o.guardrail_name&&(d.guardrail_name=t.guardrail_name),t.default_on!==o.litellm_params?.default_on&&(d.litellm_params.default_on=t.default_on);let c=o.guardrail_info,m=t.guardrail_info?JSON.parse(t.guardrail_info):void 0;JSON.stringify(c)!==JSON.stringify(m)&&(d.guardrail_info=m);let x=o.litellm_params?.pii_entities_config||{},h={};if(b.forEach(e=>{h[e]=N[e]||"MASK"}),JSON.stringify(x)!==JSON.stringify(h)&&(d.litellm_params.pii_entities_config=h),o.litellm_params?.guardrail==="litellm_content_filter"&&A){var l,r,i,s,n;let e,t=(l=R.current.patterns||[],r=R.current.blockedWords||[],i=R.current.categories||[],s=R.current.competitorIntentEnabled,n=R.current.competitorIntentConfig,e={patterns:l.map(e=>({pattern_type:"prebuilt"===e.type?"prebuilt":"regex",pattern_name:"prebuilt"===e.type?e.name:void 0,pattern:"custom"===e.type?e.pattern:void 0,name:e.name,action:e.action})),blocked_words:r.map(e=>({keyword:e.keyword,action:e.action,description:e.description}))},void 0!==i&&(e.categories=i.map(e=>({category:e.category,enabled:!0,action:e.action,severity_threshold:e.severity_threshold||"medium"}))),s&&n&&n.brand_self.length>0&&(e.competitor_intent_config={competitor_intent_type:n.competitor_intent_type,brand_self:n.brand_self,locations:n.locations?.length?n.locations:void 0,competitors:"generic"===n.competitor_intent_type&&n.competitors?.length?n.competitors:void 0,policy:n.policy,threshold_high:n.threshold_high,threshold_medium:n.threshold_medium,threshold_low:n.threshold_low}),e);d.litellm_params.patterns=t.patterns,d.litellm_params.blocked_words=t.blocked_words,d.litellm_params.categories=t.categories,d.litellm_params.competitor_intent_config=t.competitor_intent_config??null}if(o.litellm_params?.guardrail==="tool_permission"){let e=o.litellm_params?.rules||[],t=P.rules||[],a=JSON.stringify(e)!==JSON.stringify(t),l=(o.litellm_params?.default_action||"deny").toLowerCase(),r=(P.default_action||"deny").toLowerCase(),i=l!==r,s=(o.litellm_params?.on_disallowed_action||"block").toLowerCase(),n=(P.on_disallowed_action||"block").toLowerCase(),c=s!==n,m=o.litellm_params?.violation_message_template||"",u=P.violation_message_template||"",p=m!==u;(L||a||i||c||p)&&(d.litellm_params.rules=t,d.litellm_params.default_action=r,d.litellm_params.on_disallowed_action=n,d.litellm_params.violation_message_template=u||null)}let f=Object.keys(ea).find(e=>ea[e]===o.litellm_params?.guardrail);console.log("values: ",JSON.stringify(t)),console.log("currentProvider: ",f);let y=o.litellm_params?.guardrail==="tool_permission";if(g&&f&&!y){let e=g[ea[f]?.toLowerCase()]||{},a=new Set;console.log("providerSpecificParams: ",JSON.stringify(e)),Object.keys(e).forEach(e=>{"optional_params"!==e&&a.add(e)}),e.optional_params&&e.optional_params.fields&&Object.keys(e.optional_params.fields).forEach(e=>{a.add(e)}),console.log("allowedParams: ",a),a.forEach(e=>{if("patterns"===e||"blocked_words"===e||"categories"===e)return;let a=t[e];(null==a||""===a)&&(a=t.optional_params?.[e]);let l=o.litellm_params?.[e];JSON.stringify(a)!==JSON.stringify(l)&&(null!=a&&""!==a?d.litellm_params[e]=a:null!=l&&""!==l&&(d.litellm_params[e]=null))})}if(0===Object.keys(d.litellm_params).length&&delete d.litellm_params,0===Object.keys(d).length){u.default.info("No changes detected"),j(!1);return}await (0,p.updateGuardrailCall)(a,e,d),u.default.success("Guardrail updated successfully"),T(!1),z(),j(!1)}catch(e){console.error("Error updating guardrail:",e),u.default.fromBackend("Failed to update guardrail")}};if(h)return(0,l.jsx)("div",{className:"p-4",children:"Loading..."});if(!o)return(0,l.jsx)("div",{className:"p-4",children:"Guardrail not found"});let q=e=>e?new Date(e).toLocaleString():"-",{logo:J,displayName:W}=eo(o.litellm_params?.guardrail||""),U=async(e,t)=>{await (0,ta.copyToClipboard)(e)&&(I(e=>({...e,[t]:!0})),setTimeout(()=>{I(e=>({...e,[t]:!1}))},2e3))},V="config"===o.guardrail_definition_location;return(0,l.jsxs)("div",{className:"p-4",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)(c.Button,{type:"text",icon:(0,l.jsx)(tr.ArrowLeftIcon,{className:"w-4 h-4"}),onClick:t,className:"mb-4",children:"Back to Guardrails"}),(0,l.jsx)(tm.Title,{children:o.guardrail_name||"Unnamed Guardrail"}),(0,l.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,l.jsx)(eL.Text,{className:"text-gray-500 font-mono",children:o.guardrail_id}),(0,l.jsx)(c.Button,{type:"text",size:"small",icon:k["guardrail-id"]?(0,l.jsx)(tu.CheckIcon,{size:12}):(0,l.jsx)(tp.CopyIcon,{size:12}),onClick:()=>U(o.guardrail_id,"guardrail-id"),className:`left-2 z-10 transition-all duration-200 ${k["guardrail-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100"}`})]})]}),(0,l.jsxs)(tn.TabGroup,{children:[(0,l.jsxs)(to.TabList,{className:"mb-4",children:[(0,l.jsx)(ts.Tab,{children:"Overview"},"overview"),s?(0,l.jsx)(ts.Tab,{children:"Settings"},"settings"):(0,l.jsx)(l.Fragment,{})]}),(0,l.jsxs)(tc.TabPanels,{children:[(0,l.jsxs)(td.TabPanel,{children:[(0,l.jsxs)(ti.Grid,{numItems:1,numItemsSm:2,numItemsLg:3,className:"gap-6",children:[(0,l.jsxs)(eB.Card,{children:[(0,l.jsx)(eL.Text,{children:"Provider"}),(0,l.jsxs)("div",{className:"mt-2 flex items-center space-x-2",children:[J&&(0,l.jsx)("img",{src:J,alt:`${W} logo`,className:"w-6 h-6",onError:e=>{e.target.style.display="none"}}),(0,l.jsx)(tm.Title,{children:W})]})]}),(0,l.jsxs)(eB.Card,{children:[(0,l.jsx)(eL.Text,{children:"Mode"}),(0,l.jsxs)("div",{className:"mt-2",children:[(0,l.jsx)(tm.Title,{children:o.litellm_params?.mode||"-"}),(0,l.jsx)(e4.Badge,{color:o.litellm_params?.default_on?"green":"gray",children:o.litellm_params?.default_on?"Default On":"Default Off"})]})]}),(0,l.jsxs)(eB.Card,{children:[(0,l.jsx)(eL.Text,{children:"Created At"}),(0,l.jsxs)("div",{className:"mt-2",children:[(0,l.jsx)(tm.Title,{children:q(o.created_at)}),(0,l.jsxs)(eL.Text,{children:["Last Updated: ",q(o.updated_at)]})]})]})]}),o.litellm_params?.pii_entities_config&&Object.keys(o.litellm_params.pii_entities_config).length>0&&(0,l.jsx)(eB.Card,{className:"mt-6",children:(0,l.jsxs)("div",{className:"flex justify-between items-center",children:[(0,l.jsx)(eL.Text,{className:"font-medium",children:"PII Protection"}),(0,l.jsxs)(e4.Badge,{color:"blue",children:[Object.keys(o.litellm_params.pii_entities_config).length," PII entities configured"]})]})}),o.litellm_params?.pii_entities_config&&Object.keys(o.litellm_params.pii_entities_config).length>0&&(0,l.jsxs)(eB.Card,{className:"mt-6",children:[(0,l.jsx)(eL.Text,{className:"mb-4 text-lg font-semibold",children:"PII Entity Configuration"}),(0,l.jsxs)("div",{className:"border rounded-lg overflow-hidden shadow-sm",children:[(0,l.jsxs)("div",{className:"bg-gray-50 px-5 py-3 border-b flex",children:[(0,l.jsx)(eL.Text,{className:"flex-1 font-semibold text-gray-700",children:"Entity Type"}),(0,l.jsx)(eL.Text,{className:"flex-1 font-semibold text-gray-700",children:"Configuration"})]}),(0,l.jsx)("div",{className:"max-h-[400px] overflow-y-auto",children:Object.entries(o.litellm_params?.pii_entities_config).map(([e,t])=>(0,l.jsxs)("div",{className:"px-5 py-3 flex border-b hover:bg-gray-50 transition-colors",children:[(0,l.jsx)(eL.Text,{className:"flex-1 font-medium text-gray-900",children:e}),(0,l.jsx)(eL.Text,{className:"flex-1",children:(0,l.jsxs)("span",{className:`inline-flex items-center gap-1.5 ${"MASK"===t?"text-blue-600":"text-red-600"}`,children:["MASK"===t?(0,l.jsx)(ej.default,{}):(0,l.jsx)(e_.StopOutlined,{}),String(t)]})})]},e))})]})]}),o.litellm_params?.guardrail==="tool_permission"&&(0,l.jsx)(eB.Card,{className:"mt-6",children:(0,l.jsx)(eM,{value:P,disabled:!0})}),o.litellm_params?.guardrail==="custom_code"&&o.litellm_params?.custom_code&&(0,l.jsxs)(eB.Card,{className:"mt-6",children:[(0,l.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(tl.CodeOutlined,{className:"text-blue-500"}),(0,l.jsx)(eL.Text,{className:"font-medium text-lg",children:"Custom Code"})]}),s&&!V&&(0,l.jsx)(c.Button,{size:"small",icon:(0,l.jsx)(tl.CodeOutlined,{}),onClick:()=>E(!0),children:"Edit Code"})]}),(0,l.jsx)("div",{className:"relative rounded-lg overflow-hidden border border-gray-700 bg-[#1e1e1e]",children:(0,l.jsx)("pre",{className:"p-4 text-sm text-gray-200 overflow-x-auto",style:{fontFamily:"'Fira Code', 'Monaco', 'Consolas', monospace"},children:(0,l.jsx)("code",{children:o.litellm_params.custom_code})})})]}),(0,l.jsx)(t_,{guardrailData:o,guardrailSettings:w,isEditing:!1,accessToken:a})]}),s&&(0,l.jsx)(td.TabPanel,{children:(0,l.jsxs)(eB.Card,{children:[(0,l.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,l.jsx)(tm.Title,{children:"Guardrail Settings"}),V&&(0,l.jsx)(ef.Tooltip,{title:"Guardrail is defined in the config file and cannot be edited.",children:(0,l.jsx)(eE.InfoCircleOutlined,{})}),!y&&!V&&(o.litellm_params?.guardrail==="custom_code"?(0,l.jsx)(c.Button,{icon:(0,l.jsx)(tl.CodeOutlined,{}),onClick:()=>E(!0),children:"Edit Code"}):(0,l.jsx)(c.Button,{onClick:()=>j(!0),children:"Edit Settings"}))]}),y?(0,l.jsxs)(r.Form,{form:_,onFinish:H,initialValues:{guardrail_name:o.guardrail_name,...o.litellm_params,guardrail_info:o.guardrail_info?JSON.stringify(o.guardrail_info,null,2):"",...o.litellm_params?.optional_params&&{optional_params:o.litellm_params.optional_params}},layout:"vertical",children:[(0,l.jsx)(r.Form.Item,{label:"Guardrail Name",name:"guardrail_name",rules:[{required:!0,message:"Please input a guardrail name"}],children:(0,l.jsx)(i.Input,{placeholder:"Enter guardrail name"})}),(0,l.jsx)(r.Form.Item,{label:"Default On",name:"default_on",children:(0,l.jsxs)(n.Select,{children:[(0,l.jsx)(n.Select.Option,{value:!0,children:"Yes"}),(0,l.jsx)(n.Select.Option,{value:!1,children:"No"})]})}),o.litellm_params?.guardrail==="presidio"&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(eF.Divider,{orientation:"left",children:"PII Protection"}),(0,l.jsx)("div",{className:"mb-6",children:w&&(0,l.jsx)(eP,{entities:w.supported_entities,actions:w.supported_actions,selectedEntities:b,selectedActions:N,onEntitySelect:e=>{v(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},onActionSelect:(e,t)=>{C(a=>({...a,[e]:t}))},entityCategories:w.pii_entity_categories})})]}),(0,l.jsx)(t_,{guardrailData:o,guardrailSettings:w,isEditing:!0,accessToken:a,onDataChange:M,onUnsavedChanges:T}),(o.litellm_params?.guardrail==="tool_permission"||g)&&(0,l.jsx)(eF.Divider,{orientation:"left",children:"Provider Settings"}),o.litellm_params?.guardrail==="tool_permission"?(0,l.jsx)(eM,{value:P,onChange:B}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(ex,{selectedProvider:Object.keys(ea).find(e=>ea[e]===o.litellm_params?.guardrail)||null,accessToken:a,providerParams:g,value:o.litellm_params}),g&&(()=>{let e=Object.keys(ea).find(e=>ea[e]===o.litellm_params?.guardrail);if(!e)return null;let t=g[ea[e]?.toLowerCase()];return t&&t.optional_params?(0,l.jsx)(eu,{optionalParams:t.optional_params,parentFieldKey:"optional_params",values:o.litellm_params}):null})()]}),(0,l.jsx)(eF.Divider,{orientation:"left",children:"Advanced Settings"}),(0,l.jsx)(r.Form.Item,{label:"Guardrail Information",name:"guardrail_info",children:(0,l.jsx)(i.Input.TextArea,{rows:5})}),(0,l.jsxs)("div",{className:"flex justify-end gap-2 mt-6",children:[(0,l.jsx)(c.Button,{onClick:()=>{j(!1),T(!1),K()},children:"Cancel"}),(0,l.jsx)(c.Button,{type:"primary",htmlType:"submit",children:"Save Changes"})]})]}):(0,l.jsxs)("div",{className:"space-y-4",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)(eL.Text,{className:"font-medium",children:"Guardrail ID"}),(0,l.jsx)("div",{className:"font-mono",children:o.guardrail_id})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)(eL.Text,{className:"font-medium",children:"Guardrail Name"}),(0,l.jsx)("div",{children:o.guardrail_name||"Unnamed Guardrail"})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)(eL.Text,{className:"font-medium",children:"Provider"}),(0,l.jsx)("div",{children:W})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)(eL.Text,{className:"font-medium",children:"Mode"}),(0,l.jsx)("div",{children:o.litellm_params?.mode||"-"})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)(eL.Text,{className:"font-medium",children:"Default On"}),(0,l.jsx)(e4.Badge,{color:o.litellm_params?.default_on?"green":"gray",children:o.litellm_params?.default_on?"Yes":"No"})]}),o.litellm_params?.pii_entities_config&&Object.keys(o.litellm_params.pii_entities_config).length>0&&(0,l.jsxs)("div",{children:[(0,l.jsx)(eL.Text,{className:"font-medium",children:"PII Protection"}),(0,l.jsx)("div",{className:"mt-2",children:(0,l.jsxs)(e4.Badge,{color:"blue",children:[Object.keys(o.litellm_params.pii_entities_config).length," PII entities configured"]})})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)(eL.Text,{className:"font-medium",children:"Created At"}),(0,l.jsx)("div",{children:q(o.created_at)})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)(eL.Text,{className:"font-medium",children:"Last Updated"}),(0,l.jsx)("div",{children:q(o.updated_at)})]}),o.litellm_params?.guardrail==="tool_permission"&&(0,l.jsx)(eM,{value:P,disabled:!0})]})]})})]})]}),(0,l.jsx)(tF,{visible:$,onClose:()=>E(!1),onSuccess:()=>{E(!1),z()},accessToken:a,editData:o?{guardrail_id:o.guardrail_id,guardrail_name:o.guardrail_name,litellm_params:o.litellm_params}:null})]})}],969641);var t$=e.i(573421),tE=e.i(19732),tR=e.i(928685),tM=e.i(166406),tz=e.i(637235),tG=e.i(755151),tD=e.i(240647);let{Text:tK}=d.Typography,tH=function({results:e,errors:t}){let[a,r]=(0,m.useState)(new Set),i=e=>{let t=new Set(a);t.has(e)?t.delete(e):t.add(e),r(t)},s=async e=>{try{if(navigator.clipboard&&window.isSecureContext)return await navigator.clipboard.writeText(e),!0;{let t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.focus(),t.select();let a=document.execCommand("copy");if(document.body.removeChild(t),!a)throw Error("execCommand failed");return!0}}catch(e){return console.error("Copy failed:",e),!1}};return e||t?(0,l.jsxs)("div",{className:"space-y-3 pt-4 border-t border-gray-200",children:[(0,l.jsx)("h3",{className:"text-sm font-semibold text-gray-900",children:"Results"}),e&&e.map(e=>{let t=a.has(e.guardrailName);return(0,l.jsx)(eB.Card,{className:"bg-green-50 border-green-200",children:(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 space-x-2 cursor-pointer flex-1",onClick:()=>i(e.guardrailName),children:[t?(0,l.jsx)(tD.RightOutlined,{className:"text-gray-500 text-xs"}):(0,l.jsx)(tG.DownOutlined,{className:"text-gray-500 text-xs"}),(0,l.jsx)(tv.CheckCircleOutlined,{className:"text-green-600 text-lg"}),(0,l.jsx)("span",{className:"text-sm font-medium text-green-800",children:e.guardrailName})]}),(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[(0,l.jsxs)("div",{className:"flex items-center space-x-1 text-xs text-gray-600",children:[(0,l.jsx)(tz.ClockCircleOutlined,{}),(0,l.jsxs)("span",{className:"font-medium",children:[e.latency,"ms"]})]}),!t&&(0,l.jsx)(eQ.Button,{size:"xs",variant:"secondary",icon:tM.CopyOutlined,onClick:async()=>{await s(e.response_text)?u.default.success("Result copied to clipboard"):u.default.fromBackend("Failed to copy result")},children:"Copy"})]})]}),!t&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"bg-white border border-green-200 rounded p-3",children:[(0,l.jsx)("label",{className:"text-xs font-medium text-gray-600 mb-2 block",children:"Output Text"}),(0,l.jsx)("div",{className:"font-mono text-sm text-gray-900 whitespace-pre-wrap break-words",children:e.response_text})]}),(0,l.jsxs)("div",{className:"text-xs text-gray-600",children:[(0,l.jsx)("span",{className:"font-medium",children:"Characters:"})," ",e.response_text.length]})]})]})},e.guardrailName)}),t&&t.map(e=>{let t=a.has(e.guardrailName);return(0,l.jsx)(eB.Card,{className:"bg-red-50 border-red-200",children:(0,l.jsxs)("div",{className:"flex items-start space-x-2",children:[(0,l.jsx)("div",{className:"cursor-pointer mt-0.5",onClick:()=>i(e.guardrailName),children:t?(0,l.jsx)(tD.RightOutlined,{className:"text-gray-500 text-xs"}):(0,l.jsx)(tG.DownOutlined,{className:"text-gray-500 text-xs"})}),(0,l.jsx)("div",{className:"text-red-600 mt-0.5",children:(0,l.jsx)("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 20 20",children:(0,l.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,l.jsxs)("div",{className:"flex-1",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,l.jsxs)("p",{className:"text-sm font-medium text-red-800 cursor-pointer",onClick:()=>i(e.guardrailName),children:[e.guardrailName," - Error"]}),(0,l.jsxs)("div",{className:"flex items-center space-x-1 text-xs text-gray-600",children:[(0,l.jsx)(tz.ClockCircleOutlined,{}),(0,l.jsxs)("span",{className:"font-medium",children:[e.latency,"ms"]})]})]}),!t&&(0,l.jsx)("p",{className:"text-sm text-red-700 mt-1",children:e.error.message})]})]})},e.guardrailName)})]}):null},{TextArea:tq}=i.Input,{Text:tJ}=d.Typography,tW=function({guardrailNames:e,onSubmit:t,isLoading:a,results:r,errors:i,onClose:s}){let[n,o]=(0,m.useState)(""),d=()=>{n.trim()?t(n):u.default.fromBackend("Please enter text to test")},c=async e=>{try{if(navigator.clipboard&&window.isSecureContext)return await navigator.clipboard.writeText(e),!0;{let t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.focus(),t.select();let a=document.execCommand("copy");if(document.body.removeChild(t),!a)throw Error("execCommand failed");return!0}}catch(e){return console.error("Copy failed:",e),!1}},p=async()=>{await c(n)?u.default.success("Input copied to clipboard"):u.default.fromBackend("Failed to copy input")};return(0,l.jsxs)("div",{className:"space-y-4 h-full flex flex-col",children:[(0,l.jsx)("div",{className:"flex items-center justify-between pb-3 border-b border-gray-200",children:(0,l.jsx)("div",{className:"flex items-center space-x-3",children:(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 Guardrails:"}),(0,l.jsx)("div",{className:"flex flex-wrap gap-2",children:e.map(e=>(0,l.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,l.jsx)("span",{className:"font-mono text-blue-700 font-medium text-sm",children:e})},e))})]}),(0,l.jsxs)("p",{className:"text-sm text-gray-500",children:["Test ",e.length>1?"guardrails":"guardrail"," and compare results"]})]})})}),(0,l.jsxs)("div",{className:"flex-1 overflow-auto space-y-4",children:[(0,l.jsxs)("div",{className:"space-y-3",children:[(0,l.jsxs)("div",{children:[(0,l.jsxs)("div",{className:"flex justify-between items-center mb-2",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Input Text"}),(0,l.jsx)(ef.Tooltip,{title:"Press Enter to submit. Use Shift+Enter for new line.",children:(0,l.jsx)(eE.InfoCircleOutlined,{className:"text-gray-400 cursor-help"})})]}),n&&(0,l.jsx)(eQ.Button,{size:"xs",variant:"secondary",icon:tM.CopyOutlined,onClick:p,children:"Copy Input"})]}),(0,l.jsx)(tq,{value:n,onChange:e=>o(e.target.value),onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||e.ctrlKey||e.metaKey||(e.preventDefault(),d())},placeholder:"Enter text to test with guardrails...",rows:8,className:"font-mono text-sm"}),(0,l.jsxs)("div",{className:"flex justify-between items-center mt-1",children:[(0,l.jsxs)(tJ,{className:"text-xs text-gray-500",children:["Press ",(0,l.jsx)("kbd",{className:"px-1 py-0.5 bg-gray-100 border border-gray-300 rounded text-xs",children:"Enter"})," to submit • ",(0,l.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,l.jsxs)(tJ,{className:"text-xs text-gray-500",children:["Characters: ",n.length]})]})]}),(0,l.jsx)("div",{className:"pt-2",children:(0,l.jsx)(eQ.Button,{onClick:d,loading:a,disabled:!n.trim(),className:"w-full",children:a?`Testing ${e.length} guardrail${e.length>1?"s":""}...`:`Test ${e.length} guardrail${e.length>1?"s":""}`})})]}),(0,l.jsx)(tH,{results:r,errors:i})]})]})};e.s(["default",0,({guardrailsList:e,isLoading:t,accessToken:a,onClose:r})=>{let[i,s]=(0,m.useState)(new Set),[n,o]=(0,m.useState)(""),[d,c]=(0,m.useState)([]),[g,x]=(0,m.useState)([]),[h,f]=(0,m.useState)(!1),y=e.filter(e=>e.guardrail_name?.toLowerCase().includes(n.toLowerCase())),j=e=>{let t=new Set(i);t.has(e)?t.delete(e):t.add(e),s(t)},_=async e=>{if(0===i.size||!a)return;f(!0),c([]),x([]);let t=[],l=[];await Promise.all(Array.from(i).map(async r=>{let i=Date.now();try{let l=await (0,p.applyGuardrail)(a,r,e,null,null),s=Date.now()-i;t.push({guardrailName:r,response_text:l.response_text,latency:s})}catch(t){let e=Date.now()-i;console.error(`Error testing guardrail ${r}:`,t),l.push({guardrailName:r,error:t,latency:e})}})),c(t),x(l),f(!1),t.length>0&&u.default.success(`${t.length} guardrail${t.length>1?"s":""} applied successfully`),l.length>0&&u.default.fromBackend(`${l.length} guardrail${l.length>1?"s":""} failed`)};return(0,l.jsx)("div",{className:"w-full h-[calc(100vh-200px)]",children:(0,l.jsx)(eB.Card,{className:"h-full",children:(0,l.jsxs)("div",{className:"flex h-full",children:[(0,l.jsxs)("div",{className:"w-1/4 border-r border-gray-200 flex flex-col overflow-hidden",children:[(0,l.jsx)("div",{className:"p-4 border-b border-gray-200",children:(0,l.jsxs)("div",{className:"mb-3",children:[(0,l.jsx)(tm.Title,{className:"text-lg font-semibold mb-3",children:"Guardrails"}),(0,l.jsx)(e8.TextInput,{icon:tR.SearchOutlined,placeholder:"Search guardrails...",value:n,onValueChange:o})]})}),(0,l.jsx)("div",{className:"flex-1 overflow-auto",children:t?(0,l.jsx)("div",{className:"flex items-center justify-center h-32",children:(0,l.jsx)(ep.Spin,{})}):0===y.length?(0,l.jsx)("div",{className:"p-4",children:(0,l.jsx)(e$.Empty,{description:n?"No guardrails match your search":"No guardrails available"})}):(0,l.jsx)(t$.List,{dataSource:y,renderItem:e=>(0,l.jsx)(t$.List.Item,{onClick:()=>{e.guardrail_name&&j(e.guardrail_name)},className:`cursor-pointer hover:bg-gray-50 transition-colors px-4 ${i.has(e.guardrail_name||"")?"bg-blue-50 border-l-4 border-l-blue-500":"border-l-4 border-l-transparent"}`,children:(0,l.jsx)(t$.List.Item.Meta,{avatar:(0,l.jsx)(eh.Checkbox,{checked:i.has(e.guardrail_name||""),onClick:t=>{t.stopPropagation(),e.guardrail_name&&j(e.guardrail_name)}}),title:(0,l.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,l.jsx)(tE.ExperimentOutlined,{className:"text-gray-400"}),(0,l.jsx)("span",{className:"font-medium text-gray-900",children:e.guardrail_name})]}),description:(0,l.jsxs)("div",{className:"text-xs space-y-1 mt-1",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("span",{className:"font-medium",children:"Type: "}),(0,l.jsx)("span",{className:"text-gray-600",children:e.litellm_params.guardrail})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("span",{className:"font-medium",children:"Mode: "}),(0,l.jsx)("span",{className:"text-gray-600",children:e.litellm_params.mode})]})]})})})})}),(0,l.jsx)("div",{className:"p-3 border-t border-gray-200 bg-gray-50",children:(0,l.jsxs)(eL.Text,{className:"text-xs text-gray-600",children:[i.size," of ",y.length," selected"]})})]}),(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)(tm.Title,{className:"text-xl font-semibold mb-0",children:"Guardrail Testing Playground"})}),(0,l.jsx)("div",{className:"flex-1 overflow-auto p-4",children:0===i.size?(0,l.jsxs)("div",{className:"h-full flex flex-col items-center justify-center text-gray-400",children:[(0,l.jsx)(tE.ExperimentOutlined,{style:{fontSize:"48px",marginBottom:"16px"}}),(0,l.jsx)(eL.Text,{className:"text-lg font-medium text-gray-600 mb-2",children:"Select Guardrails to Test"}),(0,l.jsx)(eL.Text,{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,l.jsx)("div",{className:"h-full",children:(0,l.jsx)(tW,{guardrailNames:Array.from(i),onSubmit:_,results:d.length>0?d:null,errors:g.length>0?g:null,isLoading:h,onClose:()=>s(new Set)})})})]})]})})})}],476993),e.s([],824296),e.s(["CustomCodeModal",0,tF],64352);let tU="../ui/assets/logos/",tV=[{id:"cf_denied_financial",name:"Denied Financial Advice",description:"Detects requests for personalized financial advice, investment recommendations, or financial planning.",category:"litellm",subcategory:"Content Category",logo:`${tU}litellm_logo.jpg`,tags:["Content Category","Topic Blocker"],eval:{f1:100,precision:100,recall:100,testCases:207,latency:"<0.1ms"}},{id:"cf_denied_insults",name:"Insults & Personal Attacks",description:"Detects insults, name-calling, and personal attacks directed at the chatbot, staff, or other people.",category:"litellm",subcategory:"Content Category",logo:`${tU}litellm_logo.jpg`,tags:["Content Category","Topic Blocker"],eval:{f1:100,precision:100,recall:100,testCases:299,latency:"<0.1ms"}},{id:"cf_denied_legal",name:"Denied Legal Advice",description:"Detects requests for unauthorized legal advice, case analysis, or legal recommendations.",category:"litellm",subcategory:"Content Category",logo:`${tU}litellm_logo.jpg`,tags:["Content Category","Topic Blocker"]},{id:"cf_denied_medical",name:"Denied Medical Advice",description:"Detects requests for medical diagnosis, treatment recommendations, or health advice.",category:"litellm",subcategory:"Content Category",logo:`${tU}litellm_logo.jpg`,tags:["Content Category","Topic Blocker"]},{id:"cf_harmful_violence",name:"Harmful Violence",description:"Detects content related to violence, criminal planning, attacks, and violent threats.",category:"litellm",subcategory:"Content Category",logo:`${tU}litellm_logo.jpg`,tags:["Content Category","Safety"]},{id:"cf_harmful_self_harm",name:"Harmful Self-Harm",description:"Detects content related to self-harm, suicide, and dangerous self-destructive behavior.",category:"litellm",subcategory:"Content Category",logo:`${tU}litellm_logo.jpg`,tags:["Content Category","Safety"]},{id:"cf_harmful_child_safety",name:"Harmful Child Safety",description:"Detects content that could endanger child safety or exploit minors.",category:"litellm",subcategory:"Content Category",logo:`${tU}litellm_logo.jpg`,tags:["Content Category","Safety"]},{id:"cf_harmful_illegal_weapons",name:"Harmful Illegal Weapons",description:"Detects content related to illegal weapons manufacturing, distribution, or acquisition.",category:"litellm",subcategory:"Content Category",logo:`${tU}litellm_logo.jpg`,tags:["Content Category","Safety"]},{id:"cf_bias_gender",name:"Bias: Gender",description:"Detects gender-based discrimination, stereotypes, and biased language.",category:"litellm",subcategory:"Content Category",logo:`${tU}litellm_logo.jpg`,tags:["Content Category","Bias"]},{id:"cf_bias_racial",name:"Bias: Racial",description:"Detects racial discrimination, stereotypes, and racially biased content.",category:"litellm",subcategory:"Content Category",logo:`${tU}litellm_logo.jpg`,tags:["Content Category","Bias"]},{id:"cf_bias_religious",name:"Bias: Religious",description:"Detects religious discrimination, intolerance, and religiously biased content.",category:"litellm",subcategory:"Content Category",logo:`${tU}litellm_logo.jpg`,tags:["Content Category","Bias"]},{id:"cf_bias_sexual_orientation",name:"Bias: Sexual Orientation",description:"Detects discrimination based on sexual orientation and related biased content.",category:"litellm",subcategory:"Content Category",logo:`${tU}litellm_logo.jpg`,tags:["Content Category","Bias"]},{id:"cf_prompt_injection_jailbreak",name:"Prompt Injection: Jailbreak",description:"Detects jailbreak attempts designed to bypass AI safety guidelines and restrictions.",category:"litellm",subcategory:"Content Category",logo:`${tU}litellm_logo.jpg`,tags:["Content Category","Prompt Injection"]},{id:"cf_prompt_injection_data_exfil",name:"Prompt Injection: Data Exfiltration",description:"Detects attempts to extract sensitive data through prompt manipulation.",category:"litellm",subcategory:"Content Category",logo:`${tU}litellm_logo.jpg`,tags:["Content Category","Prompt Injection"]},{id:"cf_prompt_injection_sql",name:"Prompt Injection: SQL",description:"Detects SQL injection attempts embedded in prompts.",category:"litellm",subcategory:"Content Category",logo:`${tU}litellm_logo.jpg`,tags:["Content Category","Prompt Injection"]},{id:"cf_prompt_injection_malicious_code",name:"Prompt Injection: Malicious Code",description:"Detects attempts to inject malicious code through prompts.",category:"litellm",subcategory:"Content Category",logo:`${tU}litellm_logo.jpg`,tags:["Content Category","Prompt Injection"]},{id:"cf_prompt_injection_system_prompt",name:"Prompt Injection: System Prompt",description:"Detects attempts to extract or override system prompts.",category:"litellm",subcategory:"Content Category",logo:`${tU}litellm_logo.jpg`,tags:["Content Category","Prompt Injection"]},{id:"cf_toxic_abuse",name:"Toxic & Abusive Language",description:"Detects toxic, abusive, and hateful language across multiple languages (EN, AU, DE, ES, FR).",category:"litellm",subcategory:"Content Category",logo:`${tU}litellm_logo.jpg`,tags:["Content Category","Toxicity"]},{id:"cf_patterns",name:"Pattern Matching",description:"Detect and block sensitive data patterns like SSNs, credit card numbers, API keys, and custom regex patterns.",category:"litellm",subcategory:"Patterns",logo:`${tU}litellm_logo.jpg`,tags:["PII","Regex","Data Protection"]},{id:"cf_keywords",name:"Keyword Blocking",description:"Block or mask content containing specific keywords or phrases. Upload custom word lists or add individual terms.",category:"litellm",subcategory:"Keywords",logo:`${tU}litellm_logo.jpg`,tags:["Keywords","Blocklist"]},{id:"block_code_execution",name:"Block Code Execution",description:"Detects markdown fenced code blocks in requests and responses. Block or mask executable code (e.g. Python, JavaScript, Bash) by language with configurable confidence.",category:"litellm",subcategory:"Code Safety",logo:`${tU}litellm_logo.jpg`,tags:["Code","Safety","Prompt Injection"]},{id:"cf_competitor_intent",name:"Competitor Name Blocking",description:"Block or reframe competitor comparison and ranking intent. Detect when users ask to compare or recommend competitors (airline or generic competitor lists).",category:"litellm",subcategory:"Content Category",logo:`${tU}litellm_logo.jpg`,tags:["Content Category","Competitor","Topic Blocker"]},{id:"presidio",name:"Presidio PII",description:"Microsoft Presidio for PII detection and anonymization. Supports 30+ entity types with configurable actions.",category:"partner",logo:`${tU}microsoft_azure.svg`,tags:["PII","Microsoft"],providerKey:"PresidioPII"},{id:"bedrock",name:"Bedrock Guardrail",description:"AWS Bedrock Guardrails for content filtering, topic avoidance, and sensitive information detection.",category:"partner",logo:`${tU}bedrock.svg`,tags:["AWS","Content Safety"],providerKey:"Bedrock"},{id:"lakera",name:"Lakera",description:"AI security platform protecting against prompt injections, data leakage, and harmful content.",category:"partner",logo:`${tU}lakeraai.jpeg`,tags:["Security","Prompt Injection"],providerKey:"Lakera"},{id:"openai_moderation",name:"OpenAI Moderation",description:"OpenAI's content moderation API for detecting harmful content across multiple categories.",category:"partner",logo:`${tU}openai_small.svg`,tags:["Content Moderation","OpenAI"]},{id:"google_model_armor",name:"Google Cloud Model Armor",description:"Google Cloud's model protection service for safe and responsible AI deployments.",category:"partner",logo:`${tU}google.svg`,tags:["Google Cloud","Safety"]},{id:"guardrails_ai",name:"Guardrails AI",description:"Open-source framework for adding structural, type, and quality guarantees to LLM outputs.",category:"partner",logo:`${tU}guardrails_ai.jpeg`,tags:["Open Source","Validation"]},{id:"zscaler",name:"Zscaler AI Guard",description:"Enterprise AI security from Zscaler for monitoring and protecting AI/ML workloads.",category:"partner",logo:`${tU}zscaler.svg`,tags:["Enterprise","Security"]},{id:"panw",name:"PANW Prisma AIRS",description:"Palo Alto Networks Prisma AI Runtime Security for securing AI applications in production.",category:"partner",logo:`${tU}palo_alto_networks.jpeg`,tags:["Enterprise","Security"]},{id:"noma",name:"Noma Security",description:"AI security platform for detecting and preventing AI-specific threats and vulnerabilities.",category:"partner",logo:`${tU}noma_security.png`,tags:["Security","Threat Detection"]},{id:"aporia",name:"Aporia AI",description:"Real-time AI guardrails for hallucination detection, topic control, and policy enforcement.",category:"partner",logo:`${tU}aporia.png`,tags:["Hallucination","Policy"]},{id:"aim",name:"AIM Guardrail",description:"AIM Security guardrails for comprehensive AI threat detection and mitigation.",category:"partner",logo:`${tU}aim_security.jpeg`,tags:["Security","Threat Detection"]},{id:"prompt_security",name:"Prompt Security",description:"Protect against prompt injection attacks, data leakage, and other LLM security threats.",category:"partner",logo:`${tU}prompt_security.png`,tags:["Prompt Injection","Security"]},{id:"lasso",name:"Lasso Guardrail",description:"Content moderation and safety guardrails for responsible AI deployments.",category:"partner",logo:`${tU}lasso.png`,tags:["Content Moderation"]},{id:"pangea",name:"Pangea Guardrail",description:"Pangea's AI guardrails for secure, compliant, and trustworthy AI applications.",category:"partner",logo:`${tU}pangea.png`,tags:["Compliance","Security"]},{id:"enkryptai",name:"EnkryptAI",description:"AI security and governance platform for enterprise AI safety and compliance.",category:"partner",logo:`${tU}enkrypt_ai.avif`,tags:["Enterprise","Governance"]},{id:"javelin",name:"Javelin Guardrails",description:"AI gateway with built-in guardrails for secure and compliant AI operations.",category:"partner",logo:`${tU}javelin.png`,tags:["Gateway","Security"]},{id:"pillar",name:"Pillar Guardrail",description:"AI safety platform for monitoring, testing, and securing AI systems.",category:"partner",logo:`${tU}pillar.jpeg`,tags:["Monitoring","Safety"]}];e.s(["ALL_CARDS",0,tV],230312)},826910,e=>{"use strict";var t=e.i(201072);e.s(["CheckCircleFilled",()=>t.default])},487304,988846,168118,e=>{"use strict";var t=e.i(843476),a=e.i(271645),l=e.i(994388),r=e.i(653824),i=e.i(881073),s=e.i(197647),n=e.i(723731),o=e.i(404206),d=e.i(326373),c=e.i(755151),m=e.i(646563),u=e.i(245094),p=e.i(764205),g=e.i(185357),x=e.i(782719),h=e.i(708347),f=e.i(969641),y=e.i(476993),j=e.i(727749),_=e.i(127952),b=e.i(180766);e.i(824296);var v=e.i(64352),N=e.i(311451),C=e.i(928685),w=e.i(266537),S=e.i(230312),k=e.i(826910);let I=({src:e,name:l})=>{let[r,i]=(0,a.useState)(!1);return r||!e?(0,t.jsx)("div",{style:{width:28,height:28,borderRadius:6,backgroundColor:"#e5e7eb",display:"flex",alignItems:"center",justifyContent:"center",fontSize:13,fontWeight:600,color:"#6b7280",flexShrink:0},children:l?.charAt(0)||"?"}):(0,t.jsx)("img",{src:e,alt:"",style:{width:28,height:28,borderRadius:6,objectFit:"contain",flexShrink:0},onError:()=>i(!0)})},A=({card:e,onClick:l})=>{let[r,i]=(0,a.useState)(!1);return(0,t.jsxs)("div",{onClick:l,onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),style:{borderRadius:12,border:r?"1px solid #93c5fd":"1px solid #e5e7eb",backgroundColor:"#ffffff",padding:"20px 20px 16px 20px",cursor:"pointer",transition:"border-color 0.15s, box-shadow 0.15s",display:"flex",flexDirection:"column",minHeight:170,boxShadow:r?"0 1px 6px rgba(59,130,246,0.08)":"none"},children:[(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:10},children:[(0,t.jsx)(I,{src:e.logo,name:e.name}),(0,t.jsx)("span",{style:{fontSize:14,fontWeight:600,color:"#111827",lineHeight:1.3},children:e.name})]}),(0,t.jsx)("p",{className:"line-clamp-3",style:{fontSize:12,color:"#6b7280",lineHeight:1.6,margin:0,flex:1},children:e.description}),e.eval&&(0,t.jsxs)("div",{style:{marginTop:10,display:"flex",alignItems:"center",gap:4},children:[(0,t.jsx)(k.CheckCircleFilled,{style:{color:"#16a34a",fontSize:12}}),(0,t.jsxs)("span",{style:{fontSize:11,color:"#16a34a",fontWeight:500},children:["F1: ",e.eval.f1,"% · ",e.eval.testCases," test cases"]})]})]})};var T=e.i(464571),O=e.i(447566);let P={cf_denied_financial:{provider:"LitellmContentFilter",categoryName:"denied_financial_advice",guardrailNameSuggestion:"Denied Financial Advice",mode:"pre_call",defaultOn:!1},cf_denied_legal:{provider:"LitellmContentFilter",categoryName:"denied_legal_advice",guardrailNameSuggestion:"Denied Legal Advice",mode:"pre_call",defaultOn:!1},cf_denied_medical:{provider:"LitellmContentFilter",categoryName:"denied_medical_advice",guardrailNameSuggestion:"Denied Medical Advice",mode:"pre_call",defaultOn:!1},cf_denied_insults:{provider:"LitellmContentFilter",categoryName:"denied_insults",guardrailNameSuggestion:"Insults & Personal Attacks",mode:"pre_call",defaultOn:!1},cf_harmful_violence:{provider:"LitellmContentFilter",categoryName:"harmful_violence",guardrailNameSuggestion:"Harmful Violence",mode:"pre_call",defaultOn:!1},cf_harmful_self_harm:{provider:"LitellmContentFilter",categoryName:"harmful_self_harm",guardrailNameSuggestion:"Harmful Self-Harm",mode:"pre_call",defaultOn:!1},cf_harmful_child_safety:{provider:"LitellmContentFilter",categoryName:"harmful_child_safety",guardrailNameSuggestion:"Harmful Child Safety",mode:"pre_call",defaultOn:!1},cf_harmful_illegal_weapons:{provider:"LitellmContentFilter",categoryName:"harmful_illegal_weapons",guardrailNameSuggestion:"Harmful Illegal Weapons",mode:"pre_call",defaultOn:!1},cf_bias_gender:{provider:"LitellmContentFilter",categoryName:"bias_gender",guardrailNameSuggestion:"Bias: Gender",mode:"pre_call",defaultOn:!1},cf_bias_racial:{provider:"LitellmContentFilter",categoryName:"bias_racial",guardrailNameSuggestion:"Bias: Racial",mode:"pre_call",defaultOn:!1},cf_bias_religious:{provider:"LitellmContentFilter",categoryName:"bias_religious",guardrailNameSuggestion:"Bias: Religious",mode:"pre_call",defaultOn:!1},cf_bias_sexual_orientation:{provider:"LitellmContentFilter",categoryName:"bias_sexual_orientation",guardrailNameSuggestion:"Bias: Sexual Orientation",mode:"pre_call",defaultOn:!1},cf_prompt_injection_jailbreak:{provider:"LitellmContentFilter",categoryName:"prompt_injection_jailbreak",guardrailNameSuggestion:"Prompt Injection: Jailbreak",mode:"pre_call",defaultOn:!1},cf_prompt_injection_data_exfil:{provider:"LitellmContentFilter",categoryName:"prompt_injection_data_exfiltration",guardrailNameSuggestion:"Prompt Injection: Data Exfiltration",mode:"pre_call",defaultOn:!1},cf_prompt_injection_sql:{provider:"LitellmContentFilter",categoryName:"prompt_injection_sql",guardrailNameSuggestion:"Prompt Injection: SQL",mode:"pre_call",defaultOn:!1},cf_prompt_injection_malicious_code:{provider:"LitellmContentFilter",categoryName:"prompt_injection_malicious_code",guardrailNameSuggestion:"Prompt Injection: Malicious Code",mode:"pre_call",defaultOn:!1},cf_prompt_injection_system_prompt:{provider:"LitellmContentFilter",categoryName:"prompt_injection_system_prompt",guardrailNameSuggestion:"Prompt Injection: System Prompt",mode:"pre_call",defaultOn:!1},cf_toxic_abuse:{provider:"LitellmContentFilter",categoryName:"harm_toxic_abuse",guardrailNameSuggestion:"Toxic & Abusive Language",mode:"pre_call",defaultOn:!1},cf_patterns:{provider:"LitellmContentFilter",guardrailNameSuggestion:"Pattern Matching",mode:"pre_call",defaultOn:!1},cf_keywords:{provider:"LitellmContentFilter",guardrailNameSuggestion:"Keyword Blocking",mode:"pre_call",defaultOn:!1},block_code_execution:{provider:"BlockCodeExecution",guardrailNameSuggestion:"Block Code Execution",mode:"pre_call",defaultOn:!1},cf_competitor_intent:{provider:"LitellmContentFilter",guardrailNameSuggestion:"Competitor Name Blocking",mode:"pre_call",defaultOn:!1},presidio:{provider:"PresidioPII",guardrailNameSuggestion:"Presidio PII",mode:"pre_call",defaultOn:!1},bedrock:{provider:"Bedrock",guardrailNameSuggestion:"Bedrock Guardrail",mode:"pre_call",defaultOn:!1},lakera:{provider:"Lakera",guardrailNameSuggestion:"Lakera",mode:"pre_call",defaultOn:!1},openai_moderation:{provider:"OpenaiModeration",guardrailNameSuggestion:"OpenAI Moderation",mode:"pre_call",defaultOn:!1},google_model_armor:{provider:"ModelArmor",guardrailNameSuggestion:"Google Cloud Model Armor",mode:"pre_call",defaultOn:!1},guardrails_ai:{provider:"GuardrailsAi",guardrailNameSuggestion:"Guardrails AI",mode:"pre_call",defaultOn:!1},zscaler:{provider:"ZscalerAiGuard",guardrailNameSuggestion:"Zscaler AI Guard",mode:"pre_call",defaultOn:!1},panw:{provider:"PanwPrismaAirs",guardrailNameSuggestion:"PANW Prisma AIRS",mode:"pre_call",defaultOn:!1},noma:{provider:"Noma",guardrailNameSuggestion:"Noma Security",mode:"pre_call",defaultOn:!1},aporia:{provider:"AporiaAi",guardrailNameSuggestion:"Aporia AI",mode:"pre_call",defaultOn:!1},aim:{provider:"Aim",guardrailNameSuggestion:"AIM Guardrail",mode:"pre_call",defaultOn:!1},prompt_security:{provider:"PromptSecurity",guardrailNameSuggestion:"Prompt Security",mode:"pre_call",defaultOn:!1},lasso:{provider:"Lasso",guardrailNameSuggestion:"Lasso Guardrail",mode:"pre_call",defaultOn:!1},pangea:{provider:"Pangea",guardrailNameSuggestion:"Pangea Guardrail",mode:"pre_call",defaultOn:!1},enkryptai:{provider:"Enkryptai",guardrailNameSuggestion:"EnkryptAI",mode:"pre_call",defaultOn:!1},javelin:{provider:"Javelin",guardrailNameSuggestion:"Javelin Guardrails",mode:"pre_call",defaultOn:!1},pillar:{provider:"Pillar",guardrailNameSuggestion:"Pillar Guardrail",mode:"pre_call",defaultOn:!1}},B=({card:e,onBack:l,accessToken:r,onGuardrailCreated:i})=>{let[s,n]=(0,a.useState)(!1),[o,d]=(0,a.useState)("overview"),c=[{property:"Provider",value:"litellm"===e.category?"LiteLLM Content Filter":"Partner Guardrail"},...e.subcategory?[{property:"Subcategory",value:e.subcategory}]:[],..."litellm"===e.category?[{property:"Cost",value:"$0 / request"}]:[],..."litellm"===e.category?[{property:"External Dependencies",value:"None"}]:[],..."litellm"===e.category?[{property:"Latency",value:e.eval?.latency||"<1ms"}]:[]],m=e.eval?[{metric:"Precision",value:`${e.eval.precision}%`},{metric:"Recall",value:`${e.eval.recall}%`},{metric:"F1 Score",value:`${e.eval.f1}%`},{metric:"Test Cases",value:String(e.eval.testCases)},{metric:"False Positives",value:"0"},{metric:"False Negatives",value:"0"},{metric:"Latency (p50)",value:e.eval.latency}]:[],u=[{key:"overview",label:"Overview"},...e.eval?[{key:"eval",label:"Eval Results"}]:[]];return(0,t.jsxs)("div",{style:{maxWidth:960,margin:"0 auto"},children:[(0,t.jsxs)("div",{onClick:l,style:{display:"inline-flex",alignItems:"center",gap:6,color:"#5f6368",cursor:"pointer",fontSize:14,marginBottom:24},children:[(0,t.jsx)(O.ArrowLeftOutlined,{style:{fontSize:11}}),(0,t.jsx)("span",{children:e.name})]}),(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:16,marginBottom:8},children:[(0,t.jsx)("img",{src:e.logo,alt:"",style:{width:40,height:40,borderRadius:8,objectFit:"contain"},onError:e=>{e.target.style.display="none"}}),(0,t.jsx)("h1",{style:{fontSize:28,fontWeight:400,color:"#202124",margin:0,lineHeight:1.2},children:e.name})]}),(0,t.jsx)("p",{style:{fontSize:14,color:"#5f6368",margin:"0 0 20px 0",lineHeight:1.6},children:e.description}),(0,t.jsx)("div",{style:{display:"flex",gap:10,marginBottom:32},children:(0,t.jsx)(T.Button,{onClick:()=>n(!0),style:{borderRadius:20,padding:"4px 20px",height:36,borderColor:"#dadce0",color:"#1a73e8",fontWeight:500,fontSize:14},children:"Create Guardrail"})}),(0,t.jsx)("div",{style:{borderBottom:"1px solid #dadce0",marginBottom:28},children:(0,t.jsx)("div",{style:{display:"flex",gap:0},children:u.map(e=>(0,t.jsx)("div",{onClick:()=>d(e.key),style:{padding:"12px 20px",fontSize:14,color:o===e.key?"#1a73e8":"#5f6368",borderBottom:o===e.key?"3px solid #1a73e8":"3px solid transparent",cursor:"pointer",fontWeight:o===e.key?500:400,marginBottom:-1},children:e.label},e.key))})}),"overview"===o&&(0,t.jsxs)("div",{style:{display:"flex",gap:64},children:[(0,t.jsxs)("div",{style:{flex:1,minWidth:0},children:[(0,t.jsx)("h2",{style:{fontSize:18,fontWeight:400,color:"#202124",margin:"0 0 12px 0"},children:"Overview"}),(0,t.jsx)("p",{style:{fontSize:14,color:"#3c4043",lineHeight:1.7,margin:"0 0 32px 0"},children:e.description}),(0,t.jsx)("h2",{style:{fontSize:18,fontWeight:400,color:"#202124",margin:"0 0 4px 0"},children:"Guardrail Details"}),(0,t.jsx)("p",{style:{fontSize:13,color:"#5f6368",margin:"0 0 16px 0"},children:"Details are as follows"}),(0,t.jsxs)("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:14},children:[(0,t.jsx)("thead",{children:(0,t.jsxs)("tr",{style:{borderBottom:"1px solid #dadce0"},children:[(0,t.jsx)("th",{style:{textAlign:"left",padding:"12px 0",color:"#5f6368",fontWeight:500,width:200},children:"Property"}),(0,t.jsx)("th",{style:{textAlign:"left",padding:"12px 0",color:"#5f6368",fontWeight:500},children:e.name})]})}),(0,t.jsx)("tbody",{children:c.map((e,a)=>(0,t.jsxs)("tr",{style:{borderBottom:"1px solid #f1f3f4"},children:[(0,t.jsx)("td",{style:{padding:"12px 0",color:"#3c4043"},children:e.property}),(0,t.jsx)("td",{style:{padding:"12px 0",color:"#202124"},children:e.value})]},a))})]})]}),(0,t.jsxs)("div",{style:{width:240,flexShrink:0},children:[(0,t.jsxs)("div",{style:{marginBottom:28},children:[(0,t.jsx)("div",{style:{fontSize:12,color:"#5f6368",marginBottom:4},children:"Guardrail ID"}),(0,t.jsxs)("div",{style:{fontSize:13,color:"#202124",wordBreak:"break-all"},children:["litellm/",e.id]})]}),(0,t.jsxs)("div",{style:{marginBottom:28},children:[(0,t.jsx)("div",{style:{fontSize:12,color:"#5f6368",marginBottom:4},children:"Type"}),(0,t.jsx)("div",{style:{fontSize:13,color:"#202124"},children:"litellm"===e.category?"Content Filter":"Partner"})]}),e.tags.length>0&&(0,t.jsxs)("div",{style:{marginBottom:28},children:[(0,t.jsx)("div",{style:{fontSize:12,color:"#5f6368",marginBottom:8},children:"Tags"}),(0,t.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:e.tags.map(e=>(0,t.jsx)("span",{style:{fontSize:12,padding:"4px 12px",borderRadius:16,border:"1px solid #dadce0",color:"#3c4043",backgroundColor:"#fff"},children:e},e))})]})]})]}),"eval"===o&&(0,t.jsxs)("div",{children:[(0,t.jsx)("h2",{style:{fontSize:18,fontWeight:400,color:"#202124",margin:"0 0 16px 0"},children:"Eval Results"}),(0,t.jsxs)("table",{style:{width:"100%",maxWidth:560,borderCollapse:"collapse",fontSize:14},children:[(0,t.jsx)("thead",{children:(0,t.jsxs)("tr",{style:{backgroundColor:"#f8f9fa",borderBottom:"1px solid #dadce0"},children:[(0,t.jsx)("th",{style:{textAlign:"left",padding:"12px 16px",color:"#5f6368",fontWeight:500},children:"Metric"}),(0,t.jsx)("th",{style:{textAlign:"left",padding:"12px 16px",color:"#5f6368",fontWeight:500},children:"Value"})]})}),(0,t.jsx)("tbody",{children:m.map((e,a)=>(0,t.jsxs)("tr",{style:{borderBottom:"1px solid #f1f3f4"},children:[(0,t.jsx)("td",{style:{padding:"12px 16px",color:"#3c4043"},children:e.metric}),(0,t.jsx)("td",{style:{padding:"12px 16px",color:"#202124",fontWeight:500},children:e.value})]},a))})]})]}),(0,t.jsx)(g.default,{visible:s,onClose:()=>n(!1),accessToken:r,onSuccess:()=>{n(!1),i()},preset:P[e.id]})]})},L=({accessToken:e,onGuardrailCreated:l})=>{let[r,i]=(0,a.useState)(""),[s,n]=(0,a.useState)(null),[o,d]=(0,a.useState)(!1),c=S.ALL_CARDS.filter(e=>{if(!r)return!0;let t=r.toLowerCase();return e.name.toLowerCase().includes(t)||e.description.toLowerCase().includes(t)||e.tags.some(e=>e.toLowerCase().includes(t))}),m=c.filter(e=>"litellm"===e.category),u=c.filter(e=>"partner"===e.category);return s?(0,t.jsx)(B,{card:s,onBack:()=>n(null),accessToken:e,onGuardrailCreated:l}):(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{style:{marginBottom:24},children:(0,t.jsx)(N.Input,{size:"large",placeholder:"Search guardrails",prefix:(0,t.jsx)(C.SearchOutlined,{style:{color:"#9ca3af"}}),value:r,onChange:e=>i(e.target.value),style:{borderRadius:8}})}),(0,t.jsxs)("div",{style:{marginBottom:40},children:[(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:4},children:[(0,t.jsx)("h2",{style:{fontSize:20,fontWeight:600,color:"#111827",margin:0},children:"LiteLLM Content Filter"}),(0,t.jsx)("span",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:14,color:"#1a73e8",cursor:"pointer"},onClick:()=>d(!o),children:o?(0,t.jsx)(t.Fragment,{children:"Show less"}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(w.ArrowRightOutlined,{style:{fontSize:12}}),`Show all (${m.length})`]})})]}),(0,t.jsx)("p",{style:{fontSize:13,color:"#6b7280",margin:"4px 0 20px 0"},children:"Built-in guardrails powered by LiteLLM. Zero latency, no external dependencies, no additional cost."}),(0,t.jsx)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(220px, 1fr))",gap:16},children:(o?m:m.slice(0,10)).map(e=>(0,t.jsx)(A,{card:e,onClick:()=>n(e)},e.id))})]}),(0,t.jsxs)("div",{style:{marginBottom:40},children:[(0,t.jsx)("h2",{style:{fontSize:20,fontWeight:600,color:"#111827",margin:"0 0 4px 0"},children:"Partner Guardrails"}),(0,t.jsx)("p",{style:{fontSize:13,color:"#6b7280",margin:"4px 0 20px 0"},children:"Third-party guardrail integrations from leading AI security providers."}),(0,t.jsx)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(220px, 1fr))",gap:16},children:u.map(e=>(0,t.jsx)(A,{card:e,onClick:()=>n(e)},e.id))})]})]})};var F=e.i(54943);e.s(["SearchIcon",()=>F.default],988846);var F=F,$=e.i(837007),E=e.i(631171),E=E,R=e.i(399219),R=R,M=e.i(995926),z=e.i(678784),G=e.i(634831),D=e.i(438100),K=e.i(302202),H=e.i(361653),H=H,q=e.i(879664);e.s(["InfoIcon",()=>q.default],168118);var q=q;function J(e){var t;let a=e.litellm_params??{},l=e.guardrail_info??{},r=a.headers,i=Array.isArray(r)?r.map(e=>({key:(e.key??e.name??"").toString(),value:String(e.value??"")})):"object"==typeof r&&null!==r?Object.entries(r).map(([e,t])=>({key:e,value:String(t??"")})):[],s=a.api_base??a.url??"",n=l.model??a.model??"—",o=a.forward_api_key??!0,d=Array.isArray(a.extra_headers)?a.extra_headers.filter(e=>"string"==typeof e):[];return{id:e.guardrail_id,team:e.team_id??"—",name:e.guardrail_name,endpoint:s,status:"pending_review"===(t=e.status)?"pending":"active"===t||"rejected"===t?t:"active",model:n,forwardKey:o,description:l.description??"",method:a.method??"POST",customHeaders:i,extraHeaders:d,submittedAt:function(e){if(!e)return"—";try{let t=new Date(e);return isNaN(t.getTime())?e:t.toISOString().slice(0,10)}catch{return e}}(e.submitted_at),submittedBy:e.submitted_by_email??e.submitted_by_user_id??"—",mode:a.mode,unreachable_fallback:a.unreachable_fallback,additionalProviderParams:a.additional_provider_specific_params,guardrailType:a.guardrail}}let W={active:{label:"Active",bg:"bg-green-50",text:"text-green-700",dot:"bg-green-500"},pending:{label:"Pending Review",bg:"bg-yellow-50",text:"text-yellow-700",dot:"bg-yellow-500"},rejected:{label:"Rejected",bg:"bg-red-50",text:"text-red-700",dot:"bg-red-500"}},U={"ML Platform":"bg-purple-100 text-purple-700","Data Science":"bg-blue-100 text-blue-700",Security:"bg-red-100 text-red-700","Customer Success":"bg-orange-100 text-orange-700",Legal:"bg-gray-100 text-gray-700",Finance:"bg-green-100 text-green-700"};function V({label:e,value:a,color:l}){return(0,t.jsxs)("div",{className:"bg-white border border-gray-200 rounded-lg px-4 py-3",children:[(0,t.jsx)("div",{className:`text-2xl font-bold ${l}`,children:a}),(0,t.jsx)("div",{className:"text-xs text-gray-500 mt-0.5",children:e})]})}function Y({enabled:e,onToggle:a}){return(0,t.jsx)("button",{type:"button",onClick:a,role:"switch","aria-checked":e,className:`relative inline-flex h-5 w-9 items-center rounded-full transition-colors focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-1 ${e?"bg-blue-500":"bg-gray-200"}`,children:(0,t.jsx)("span",{className:`inline-block h-3.5 w-3.5 transform rounded-full bg-white shadow transition-transform ${e?"translate-x-4":"translate-x-0.5"}`})})}function Z({guardrail:e,isSelected:a,isHeadersExpanded:l,onSelect:r,onToggleForwardKey:i,onToggleHeaders:s,onApprove:n,onReject:o}){let d=W[e.status],c=U[e.team]??"bg-gray-100 text-gray-700";return(0,t.jsxs)("div",{className:`bg-white border rounded-lg p-4 transition-all ${a?"border-blue-400 ring-1 ring-blue-200":"border-gray-200"}`,children:[(0,t.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-1.5 flex-wrap",children:[(0,t.jsxs)("span",{className:`text-xs font-medium px-2 py-0.5 rounded-full ${c}`,children:["Team: ",e.team]}),(0,t.jsxs)("span",{className:`inline-flex items-center gap-1.5 text-xs font-medium px-2 py-0.5 rounded-full ${d.bg} ${d.text}`,children:[(0,t.jsx)("span",{className:`w-1.5 h-1.5 rounded-full ${d.dot}`}),d.label]})]}),(0,t.jsx)("h3",{className:"text-sm font-semibold text-gray-900 mb-1",children:e.name}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mb-2 line-clamp-1",children:e.description}),(0,t.jsxs)("div",{className:"flex items-center gap-1.5 mb-2",children:[(0,t.jsx)(K.ServerIcon,{className:"h-3.5 w-3.5 text-gray-400 flex-shrink-0"}),(0,t.jsx)("code",{className:"text-xs text-gray-500 font-mono truncate",children:e.endpoint})]}),(0,t.jsxs)("div",{className:"flex items-center gap-4 text-xs text-gray-500",children:[(0,t.jsxs)("span",{children:["Model: ",(0,t.jsx)("span",{className:"font-medium text-gray-700",children:e.model})]}),(0,t.jsxs)("span",{children:["Submitted:"," ",(0,t.jsx)("span",{className:"font-medium text-gray-700",children:e.submittedAt})]})]})]}),(0,t.jsxs)("div",{className:"flex flex-col items-end gap-2 flex-shrink-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"text-xs text-gray-500 whitespace-nowrap",children:"Forward API Key"}),(0,t.jsx)(Y,{enabled:e.forwardKey,onToggle:i})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[(0,t.jsx)("button",{type:"button",onClick:r,className:"text-xs border border-gray-300 text-gray-600 hover:bg-gray-50 px-3 py-1.5 rounded-md transition-colors font-medium",children:a?"Close":"Review"}),"pending"===e.status&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("button",{type:"button",onClick:n,className:"text-xs bg-green-500 hover:bg-green-600 text-white px-3 py-1.5 rounded-md transition-colors font-medium",children:"Approve"}),(0,t.jsx)("button",{type:"button",onClick:o,className:"text-xs border border-red-300 text-red-600 hover:bg-red-50 px-3 py-1.5 rounded-md transition-colors font-medium",children:"Reject"})]})]})]})]}),(0,t.jsxs)("div",{className:"mt-3 pt-3 border-t border-gray-100",children:[(0,t.jsxs)("button",{type:"button",onClick:s,className:"flex items-center gap-1.5 text-xs text-gray-500 hover:text-gray-700 transition-colors",children:[l?(0,t.jsx)(R.default,{className:"h-3.5 w-3.5"}):(0,t.jsx)(E.default,{className:"h-3.5 w-3.5"}),"Static headers",e.customHeaders.length>0&&(0,t.jsx)("span",{className:"ml-1 bg-gray-100 text-gray-600 rounded-full px-1.5 py-0.5 text-xs",children:e.customHeaders.length})]}),l&&(0,t.jsx)("div",{className:"mt-2",children:0===e.customHeaders.length?(0,t.jsx)("p",{className:"text-xs text-gray-400 italic",children:"No static headers configured."}):(0,t.jsx)("div",{className:"space-y-1",children:e.customHeaders.map((e,a)=>(0,t.jsxs)("div",{className:"flex items-center gap-2 text-xs font-mono",children:[(0,t.jsx)("span",{className:"text-gray-500 bg-gray-50 border border-gray-200 rounded px-2 py-0.5",children:e.key}),(0,t.jsx)("span",{className:"text-gray-400",children:":"}),(0,t.jsx)("span",{className:"text-gray-700 bg-gray-50 border border-gray-200 rounded px-2 py-0.5",children:e.value})]},`${e.key}-${a}`))})})]})]})}function Q({label:e,children:a}){return(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"text-xs font-semibold text-gray-500 mb-1",children:e}),(0,t.jsx)("div",{children:a})]})}function X({guardrail:e,onClose:l,onApprove:r,onReject:i,onToggleForwardKey:s,onUpdateCustomHeaders:n,onUpdateExtraHeaders:o}){let[d,c]=(0,a.useState)(!1),[m,u]=(0,a.useState)(""),[p,g]=(0,a.useState)(""),[x,h]=(0,a.useState)(""),f=W[e.status],y=U[e.team]??"bg-gray-100 text-gray-700";return(0,t.jsx)("div",{className:"w-96 flex-shrink-0 bg-white overflow-auto",children:(0,t.jsxs)("div",{className:"p-5",children:[(0,t.jsxs)("div",{className:"flex items-start justify-between mb-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,t.jsxs)("span",{className:`text-xs font-medium px-2 py-0.5 rounded-full ${y}`,children:["Team: ",e.team]}),(0,t.jsxs)("span",{className:`inline-flex items-center gap-1.5 text-xs font-medium px-2 py-0.5 rounded-full ${f.bg} ${f.text}`,children:[(0,t.jsx)("span",{className:`w-1.5 h-1.5 rounded-full ${f.dot}`}),f.label]})]}),(0,t.jsx)("h2",{className:"text-base font-semibold text-gray-900",children:e.name}),(0,t.jsxs)("p",{className:"text-xs text-gray-500 mt-0.5",children:["Submitted by ",e.submittedBy," on ",e.submittedAt]})]}),(0,t.jsx)("button",{type:"button",onClick:l,className:"text-gray-400 hover:text-gray-600 transition-colors","aria-label":"Close detail panel",children:(0,t.jsx)(M.XIcon,{className:"h-4 w-4"})})]}),(0,t.jsx)("p",{className:"text-sm text-gray-600 mb-5",children:e.description}),(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)(Q,{label:"Endpoint",children:(0,t.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,t.jsx)("code",{className:"text-xs font-mono text-gray-700 break-all",children:e.endpoint}),(0,t.jsx)("a",{href:e.endpoint,target:"_blank",rel:"noopener noreferrer",className:"text-gray-400 hover:text-blue-500 flex-shrink-0",children:(0,t.jsx)(G.ExternalLinkIcon,{className:"h-3.5 w-3.5"})})]})}),(0,t.jsx)(Q,{label:"Method",children:(0,t.jsx)("span",{className:"text-xs font-mono font-medium text-gray-700 bg-gray-100 px-2 py-0.5 rounded",children:e.method})}),(0,t.jsxs)("div",{className:"border border-blue-100 bg-blue-50 rounded-lg p-3",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,t.jsx)(D.KeyIcon,{className:"h-3.5 w-3.5 text-blue-500"}),(0,t.jsx)("span",{className:"text-xs font-semibold text-blue-800",children:"Forward LiteLLM API Key"})]}),(0,t.jsx)(Y,{enabled:e.forwardKey,onToggle:s})]}),(0,t.jsxs)("p",{className:"text-xs text-blue-700 leading-relaxed",children:["When enabled, the caller's LiteLLM API key is forwarded as an"," ",(0,t.jsx)("code",{className:"font-mono bg-blue-100 px-1 rounded",children:"Authorization"})," ","header to your guardrail endpoint. This allows your guardrail to authenticate model calls using the original caller's credentials."]})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center gap-1.5 mb-2",children:[(0,t.jsx)("span",{className:"text-xs font-semibold text-gray-700",children:"Static headers"}),e.customHeaders.length>0&&(0,t.jsx)("span",{className:"bg-gray-100 text-gray-600 rounded-full px-1.5 py-0.5 text-xs",children:e.customHeaders.length})]}),(0,t.jsx)("p",{className:"text-xs text-gray-400 mb-2",children:"Sent with every request to the guardrail."}),0===e.customHeaders.length?(0,t.jsx)("p",{className:"text-xs text-gray-400 italic mb-2",children:"No static headers configured."}):(0,t.jsx)("ul",{className:"list-none space-y-1 mb-2",children:e.customHeaders.map((a,l)=>(0,t.jsxs)("li",{className:"flex items-center justify-between gap-2 text-xs font-mono bg-gray-50 border border-gray-200 rounded px-2 py-1.5",children:[(0,t.jsxs)("span",{className:"text-gray-700 truncate",children:[a.key,": ",a.value]}),(0,t.jsx)("button",{type:"button",onClick:()=>n(e.customHeaders.filter((e,t)=>t!==l)),className:"text-gray-400 hover:text-red-600 flex-shrink-0","aria-label":`Remove ${a.key}`,children:(0,t.jsx)(M.XIcon,{className:"h-3.5 w-3.5"})})]},`${a.key}-${l}`))}),(0,t.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-end",children:[(0,t.jsx)("input",{type:"text",value:p,onChange:e=>g(e.target.value),placeholder:"Header name (e.g. X-API-Key)",className:"flex-1 min-w-0 text-xs font-mono border border-gray-200 rounded px-2 py-1.5 text-gray-700 placeholder-gray-400 focus:outline-none focus:ring-1 focus:ring-blue-500",onKeyDown:t=>{if("Enter"===t.key){t.preventDefault();let a=p.trim(),l=x.trim();a&&!e.customHeaders.some(e=>e.key.toLowerCase()===a.toLowerCase())&&(n([...e.customHeaders,{key:a,value:l}]),g(""),h(""))}}}),(0,t.jsx)("input",{type:"text",value:x,onChange:e=>h(e.target.value),placeholder:"Value",className:"flex-1 min-w-0 text-xs font-mono border border-gray-200 rounded px-2 py-1.5 text-gray-700 placeholder-gray-400 focus:outline-none focus:ring-1 focus:ring-blue-500",onKeyDown:t=>{if("Enter"===t.key){t.preventDefault();let a=p.trim(),l=x.trim();a&&!e.customHeaders.some(e=>e.key.toLowerCase()===a.toLowerCase())&&(n([...e.customHeaders,{key:a,value:l}]),g(""),h(""))}}}),(0,t.jsx)("button",{type:"button",onClick:()=>{let t=p.trim(),a=x.trim();t&&!e.customHeaders.some(e=>e.key.toLowerCase()===t.toLowerCase())&&(n([...e.customHeaders,{key:t,value:a}]),g(""),h(""))},className:"text-xs font-medium text-blue-600 hover:text-blue-700 border border-blue-200 bg-blue-50 hover:bg-blue-100 px-2 py-1.5 rounded transition-colors flex-shrink-0",children:"Add"})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center gap-1.5 mb-2",children:[(0,t.jsx)("span",{className:"text-xs font-semibold text-gray-700",children:"Forward client headers"}),e.extraHeaders.length>0&&(0,t.jsx)("span",{className:"bg-gray-100 text-gray-600 rounded-full px-1.5 py-0.5 text-xs",children:e.extraHeaders.length})]}),(0,t.jsx)("p",{className:"text-xs text-gray-400 mb-2",children:"Allowed header names to forward from the client request to the guardrail (e.g. x-request-id)."}),0===e.extraHeaders.length?(0,t.jsx)("p",{className:"text-xs text-gray-400 italic mb-2",children:"No forward client headers configured."}):(0,t.jsx)("ul",{className:"list-none space-y-1 mb-2",children:e.extraHeaders.map((a,l)=>(0,t.jsxs)("li",{className:"flex items-center justify-between gap-2 text-xs font-mono bg-gray-50 border border-gray-200 rounded px-2 py-1.5",children:[(0,t.jsx)("span",{className:"text-gray-700 truncate",children:a}),(0,t.jsx)("button",{type:"button",onClick:()=>o(e.extraHeaders.filter((e,t)=>t!==l)),className:"text-gray-400 hover:text-red-600 flex-shrink-0","aria-label":`Remove ${a}`,children:(0,t.jsx)(M.XIcon,{className:"h-3.5 w-3.5"})})]},`${a}-${l}`))}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)("input",{type:"text",value:m,onChange:e=>u(e.target.value),placeholder:"e.g. x-request-id",className:"flex-1 min-w-0 text-xs font-mono border border-gray-200 rounded px-2 py-1.5 text-gray-700 placeholder-gray-400 focus:outline-none focus:ring-1 focus:ring-blue-500",onKeyDown:t=>{if("Enter"===t.key){t.preventDefault();let a=m.trim().toLowerCase();a&&!e.extraHeaders.map(e=>e.toLowerCase()).includes(a)&&(o([...e.extraHeaders,a]),u(""))}}}),(0,t.jsx)("button",{type:"button",onClick:()=>{let t=m.trim().toLowerCase();t&&!e.extraHeaders.map(e=>e.toLowerCase()).includes(t)&&(o([...e.extraHeaders,t]),u(""))},className:"text-xs font-medium text-blue-600 hover:text-blue-700 border border-blue-200 bg-blue-50 hover:bg-blue-100 px-2 py-1.5 rounded transition-colors",children:"Add"})]})]}),(0,t.jsxs)("div",{className:"border border-gray-200 rounded-lg overflow-hidden",children:[(0,t.jsxs)("button",{type:"button",onClick:()=>c(!d),className:"w-full flex items-center justify-between px-3 py-2 text-left text-xs font-semibold text-gray-700 bg-gray-50 hover:bg-gray-100 transition-colors",children:[(0,t.jsx)("span",{children:"Equivalent config"}),d?(0,t.jsx)(R.default,{className:"h-3.5 w-3.5 text-gray-500"}):(0,t.jsx)(E.default,{className:"h-3.5 w-3.5 text-gray-500"})]}),d&&(0,t.jsx)("pre",{className:"p-3 text-xs font-mono text-gray-700 bg-white border-t border-gray-200 overflow-x-auto whitespace-pre-wrap break-all",children:function(e){let t=["litellm_settings:"," guardrails:",` - guardrail_name: "${e.name.replace(/"/g,'\\"')}"`," litellm_params:",` guardrail: ${e.guardrailType??"generic_guardrail_api"}`,` mode: ${e.mode??"pre_call"} # or post_call, during_call`,` api_base: ${e.endpoint||"https://your-guardrail-api.com"}`," api_key: os.environ/YOUR_GUARDRAIL_API_KEY # optional",` unreachable_fallback: ${e.unreachable_fallback??"fail_closed"} # default: fail_closed. Set to fail_open to proceed if the guardrail endpoint is unreachable.`,` forward_api_key: ${e.forwardKey}`];if(e.model&&"—"!==e.model&&t.push(` model: "${e.model}" # LLM model name sent to the guardrail for context`),e.customHeaders.length>0)for(let a of(t.push(" headers: # static headers (sent with every request)"),e.customHeaders))t.push(` ${a.key}: "${String(a.value).replace(/"/g,'\\"')}"`);if(e.extraHeaders.length>0)for(let a of(t.push(" extra_headers: # forward these client request headers to the guardrail"),e.extraHeaders))t.push(` - ${a}`);if(e.additionalProviderParams&&Object.keys(e.additionalProviderParams).length>0)for(let[a,l]of(t.push(" additional_provider_specific_params:"),Object.entries(e.additionalProviderParams))){let e="string"==typeof l?`"${l}"`:String(l);t.push(` ${a}: ${e}`)}return t.join("\n")}(e)})]}),(0,t.jsxs)("div",{className:"flex items-start gap-2 bg-gray-50 border border-gray-200 rounded-lg p-3",children:[(0,t.jsx)(q.default,{className:"h-3.5 w-3.5 text-gray-400 flex-shrink-0 mt-0.5"}),(0,t.jsxs)("p",{className:"text-xs text-gray-500 leading-relaxed",children:["This guardrail runs on a separate instance. It receives the user request and forwards the result to the next step in the pipeline. See"," ",(0,t.jsx)("a",{href:"https://docs.litellm.ai/docs/adding_provider/generic_guardrail_api",target:"_blank",rel:"noopener noreferrer",className:"text-blue-500 hover:underline",children:"LiteLLM Generic Guardrail API docs"})," ","for configuration details."]})]})]}),(0,t.jsxs)("div",{className:"mt-5 pt-4 border-t border-gray-100 space-y-2",children:[(0,t.jsxs)("button",{type:"button",className:"w-full flex items-center justify-center gap-2 border border-gray-300 text-gray-700 hover:bg-gray-50 text-sm font-medium py-2 rounded-md transition-colors",children:[(0,t.jsx)(G.ExternalLinkIcon,{className:"h-4 w-4"}),"Test Endpoint"]}),"pending"===e.status&&(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsxs)("button",{type:"button",onClick:r,className:"flex-1 flex items-center justify-center gap-1.5 bg-green-500 hover:bg-green-600 text-white text-sm font-medium py-2 rounded-md transition-colors",children:[(0,t.jsx)(z.CheckIcon,{className:"h-4 w-4"}),"Approve"]}),(0,t.jsxs)("button",{type:"button",onClick:i,className:"flex-1 flex items-center justify-center gap-1.5 border border-red-300 text-red-600 hover:bg-red-50 text-sm font-medium py-2 rounded-md transition-colors",children:[(0,t.jsx)(M.XIcon,{className:"h-4 w-4"}),"Reject"]})]})]})]})})}function ee({action:e,guardrailName:a,onConfirm:l,onCancel:r}){let i="approve"===e;return(0,t.jsx)("div",{className:"fixed inset-0 bg-black/30 flex items-center justify-center z-50",children:(0,t.jsxs)("div",{className:"bg-white rounded-xl shadow-xl p-6 max-w-sm w-full mx-4",children:[(0,t.jsx)("div",{className:`w-10 h-10 rounded-full flex items-center justify-center mb-4 ${i?"bg-green-100":"bg-red-100"}`,children:i?(0,t.jsx)(z.CheckIcon,{className:"h-5 w-5 text-green-600"}):(0,t.jsx)(H.default,{className:"h-5 w-5 text-red-600"})}),(0,t.jsx)("h3",{className:"text-base font-semibold text-gray-900 mb-1",children:i?"Approve Guardrail":"Reject Guardrail"}),(0,t.jsxs)("p",{className:"text-sm text-gray-500 mb-5",children:["Are you sure you want to ",e," ",(0,t.jsxs)("span",{className:"font-medium text-gray-700",children:['"',a,'"']}),"?"," ",i?"This will make it active and available for use.":"This will mark it as rejected and notify the team."]}),(0,t.jsxs)("div",{className:"flex gap-3",children:[(0,t.jsx)("button",{type:"button",onClick:r,className:"flex-1 border border-gray-300 text-gray-700 hover:bg-gray-50 text-sm font-medium py-2 rounded-md transition-colors",children:"Cancel"}),(0,t.jsx)("button",{type:"button",onClick:l,className:`flex-1 text-white text-sm font-medium py-2 rounded-md transition-colors ${i?"bg-green-500 hover:bg-green-600":"bg-red-500 hover:bg-red-600"}`,children:i?"Approve":"Reject"})]})]})})}function et({accessToken:e}){let[l,r]=(0,a.useState)([]),[i,s]=(0,a.useState)({total:0,pending_review:0,active:0,rejected:0}),[n,o]=(0,a.useState)(""),[d,c]=(0,a.useState)("all"),[m,u]=(0,a.useState)(null),[g,x]=(0,a.useState)(new Set),[h,f]=(0,a.useState)(null),[y,_]=(0,a.useState)(!0),[b,v]=(0,a.useState)(null),[N,C]=(0,a.useState)("");(0,a.useEffect)(()=>{let e=setTimeout(()=>C(n),300);return()=>clearTimeout(e)},[n]);let w=(0,a.useCallback)(async()=>{if(!e)return void _(!1);_(!0),v(null);try{let t="all"===d?void 0:"pending"===d?"pending_review":d,a=await (0,p.listGuardrailSubmissions)(e,{status:t,search:N.trim()||void 0});r(a.submissions.map(J)),s(a.summary)}catch(e){v(e instanceof Error?e.message:"Failed to load submissions"),r([])}finally{_(!1)}},[e,d,N]);(0,a.useEffect)(()=>{w()},[w]);let S=l.find(e=>e.id===m)??null,k=i.total,I=i.pending_review,A=i.active,T=i.rejected;async function O(t){if(!e)return;let a=l.find(e=>e.id===t);if(!a)return;let i=!a.forwardKey;try{await (0,p.updateGuardrailCall)(e,t,{litellm_params:{forward_api_key:i}}),r(e=>e.map(e=>e.id===t?{...e,forwardKey:i}:e)),j.default.success(i?"Forward API key enabled":"Forward API key disabled")}catch{j.default.fromBackend("Failed to update forward API key")}}async function P(t,a){if(!e)return;let l={};for(let{key:e,value:t}of a)e.trim()&&(l[e.trim()]=t);try{await (0,p.updateGuardrailCall)(e,t,{litellm_params:{headers:l}}),r(e=>e.map(e=>e.id===t?{...e,customHeaders:a.filter(e=>e.key.trim())}:e)),j.default.success("Static headers updated")}catch{j.default.fromBackend("Failed to update static headers")}}async function B(t,a){if(e)try{await (0,p.updateGuardrailCall)(e,t,{litellm_params:{extra_headers:a}}),r(e=>e.map(e=>e.id===t?{...e,extraHeaders:a}:e)),j.default.success("Forward client headers updated")}catch{j.default.fromBackend("Failed to update forward client headers")}}async function L(t){if(e)try{await (0,p.approveGuardrailSubmission)(e,t),f(null),m===t&&u(null),await w(),j.default.success("Guardrail approved")}catch{j.default.fromBackend("Failed to approve guardrail")}}async function E(t){if(e)try{await (0,p.rejectGuardrailSubmission)(e,t),f(null),m===t&&u(null),await w(),j.default.success("Guardrail rejected")}catch{j.default.fromBackend("Failed to reject guardrail")}}return(0,t.jsxs)("div",{className:"flex h-full",children:[(0,t.jsxs)("div",{className:`flex-1 min-w-0 p-6 overflow-auto ${S?"border-r border-gray-200":""}`,children:[(0,t.jsxs)("div",{className:"grid grid-cols-4 gap-4 mb-6",children:[(0,t.jsx)(V,{label:"Total Submitted",value:k,color:"text-gray-900"}),(0,t.jsx)(V,{label:"Pending Review",value:I,color:"text-yellow-600"}),(0,t.jsx)(V,{label:"Active",value:A,color:"text-green-600"}),(0,t.jsx)(V,{label:"Rejected",value:T,color:"text-red-600"})]}),(0,t.jsxs)("div",{className:"flex items-center gap-3 mb-5",children:[(0,t.jsxs)("div",{className:"relative flex-1 max-w-xs",children:[(0,t.jsx)(F.default,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400"}),(0,t.jsx)("input",{type:"text",placeholder:"Search guardrails...",value:n,onChange:e=>o(e.target.value),className:"w-full pl-9 pr-4 py-2 border border-gray-200 rounded-md text-sm text-gray-700 placeholder-gray-400 focus:outline-none focus:ring-1 focus:ring-blue-500 focus:border-blue-500"})]}),(0,t.jsxs)("select",{value:d,onChange:e=>c(e.target.value),className:"border border-gray-200 rounded-md px-3 py-2 text-sm text-gray-700 focus:outline-none focus:ring-1 focus:ring-blue-500 focus:border-blue-500 bg-white",children:[(0,t.jsx)("option",{value:"all",children:"All Status"}),(0,t.jsx)("option",{value:"pending",children:"Pending Review"}),(0,t.jsx)("option",{value:"active",children:"Active"}),(0,t.jsx)("option",{value:"rejected",children:"Rejected"})]}),(0,t.jsxs)("button",{type:"button",className:"ml-auto flex items-center gap-2 bg-blue-500 hover:bg-blue-600 text-white text-sm font-medium px-4 py-2 rounded-md transition-colors",children:[(0,t.jsx)($.PlusIcon,{className:"h-4 w-4"}),"Add Guardrail"]})]}),(0,t.jsxs)("div",{className:"space-y-3",children:[y&&(0,t.jsx)("div",{className:"text-center py-12 text-gray-500 text-sm",children:"Loading submissions…"}),b&&(0,t.jsx)("div",{className:"text-center py-12 text-red-600 text-sm",children:b}),!y&&!b&&0===l.length&&(0,t.jsx)("div",{className:"text-center py-12 text-gray-400 text-sm",children:"No guardrails match your filters."}),!y&&!b&&l.map(e=>(0,t.jsx)(Z,{guardrail:e,isSelected:m===e.id,isHeadersExpanded:g.has(e.id),onSelect:()=>u(m===e.id?null:e.id),onToggleForwardKey:()=>O(e.id),onToggleHeaders:()=>{var t;return t=e.id,void x(e=>{let a=new Set(e);return a.has(t)?a.delete(t):a.add(t),a})},onApprove:()=>f({id:e.id,action:"approve"}),onReject:()=>f({id:e.id,action:"reject"})},e.id))]})]}),S&&(0,t.jsx)(X,{guardrail:S,onClose:()=>u(null),onApprove:()=>f({id:S.id,action:"approve"}),onReject:()=>f({id:S.id,action:"reject"}),onToggleForwardKey:()=>O(S.id),onUpdateCustomHeaders:e=>P(S.id,e),onUpdateExtraHeaders:e=>B(S.id,e)}),h&&(0,t.jsx)(ee,{action:h.action,guardrailName:l.find(e=>e.id===h.id)?.name??"",onConfirm:()=>"approve"===h.action?L(h.id):E(h.id),onCancel:()=>f(null)})]})}e.s(["default",0,({accessToken:e,userRole:N})=>{let[C,w]=(0,a.useState)([]),[S,k]=(0,a.useState)(!1),[I,A]=(0,a.useState)(!1),[T,O]=(0,a.useState)(!1),[P,B]=(0,a.useState)(!1),[F,$]=(0,a.useState)(null),[E,R]=(0,a.useState)(!1),[M,z]=(0,a.useState)(null),[G,D]=(0,a.useState)(0),K=!!N&&(0,h.isAdminRole)(N),H=async()=>{if(e){O(!0);try{let t=await (0,p.getGuardrailsList)(e);console.log(`guardrails: ${JSON.stringify(t)}`),w(t.guardrails)}catch(e){console.error("Error fetching guardrails:",e)}finally{O(!1)}}};(0,a.useEffect)(()=>{H()},[e]);let q=()=>{H()},J=async()=>{if(F&&e){B(!0);try{await (0,p.deleteGuardrailCall)(e,F.guardrail_id),j.default.success(`Guardrail "${F.guardrail_name}" deleted successfully`),await H()}catch(e){console.error("Error deleting guardrail:",e),j.default.fromBackend("Failed to delete guardrail")}finally{B(!1),R(!1),$(null)}}},W=F&&F.litellm_params?(0,b.getGuardrailLogoAndName)(F.litellm_params.guardrail).displayName:void 0;return(0,t.jsx)("div",{className:"w-full mx-auto flex-auto overflow-y-auto m-8 p-2",children:(0,t.jsxs)(r.TabGroup,{index:G,onIndexChange:D,children:[(0,t.jsxs)(i.TabList,{className:"mb-4",children:[(0,t.jsx)(s.Tab,{children:"Guardrail Garden"}),(0,t.jsx)(s.Tab,{children:"Guardrails"}),(0,t.jsx)(s.Tab,{disabled:!e||0===C.length,children:"Test Playground"}),(0,t.jsx)(s.Tab,{children:"Team Guardrails"})]}),(0,t.jsxs)(n.TabPanels,{children:[(0,t.jsx)(o.TabPanel,{children:(0,t.jsx)(L,{accessToken:e,onGuardrailCreated:q})}),(0,t.jsxs)(o.TabPanel,{children:[(0,t.jsx)("div",{className:"flex justify-between items-center mb-4",children:(0,t.jsx)(d.Dropdown,{menu:{items:[{key:"provider",icon:(0,t.jsx)(m.PlusOutlined,{}),label:"Add Provider Guardrail",onClick:()=>{M&&z(null),k(!0)}},{key:"custom_code",icon:(0,t.jsx)(u.CodeOutlined,{}),label:"Create Custom Code Guardrail",onClick:()=>{M&&z(null),A(!0)}}]},trigger:["click"],disabled:!e,children:(0,t.jsxs)(l.Button,{disabled:!e,children:["+ Add New Guardrail ",(0,t.jsx)(c.DownOutlined,{className:"ml-2"})]})})}),M?(0,t.jsx)(f.default,{guardrailId:M,onClose:()=>z(null),accessToken:e,isAdmin:K}):(0,t.jsx)(x.default,{guardrailsList:C,isLoading:T,onDeleteClick:(e,t)=>{$(C.find(t=>t.guardrail_id===e)||null),R(!0)},accessToken:e,onGuardrailUpdated:H,isAdmin:K,onGuardrailClick:e=>z(e)}),(0,t.jsx)(g.default,{visible:S,onClose:()=>{k(!1)},accessToken:e,onSuccess:q}),(0,t.jsx)(v.CustomCodeModal,{visible:I,onClose:()=>{A(!1)},accessToken:e,onSuccess:q}),(0,t.jsx)(_.default,{isOpen:E,title:"Delete Guardrail",message:`Are you sure you want to delete guardrail: ${F?.guardrail_name}? This action cannot be undone.`,resourceInformationTitle:"Guardrail Information",resourceInformation:[{label:"Name",value:F?.guardrail_name},{label:"ID",value:F?.guardrail_id,code:!0},{label:"Provider",value:W},{label:"Mode",value:F?.litellm_params.mode},{label:"Default On",value:F?.litellm_params.default_on?"Yes":"No"}],onCancel:()=>{R(!1),$(null)},onOk:J,confirmLoading:P})]}),(0,t.jsx)(o.TabPanel,{children:(0,t.jsx)(y.default,{guardrailsList:C,isLoading:T,accessToken:e,onClose:()=>D(0)})}),(0,t.jsx)(o.TabPanel,{children:(0,t.jsx)(et,{accessToken:e})})]})]})})}],487304)}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/02b5f26d5e34d4ec.js b/litellm/proxy/_experimental/out/_next/static/chunks/02b5f26d5e34d4ec.js deleted file mode 100644 index 9dd4e60c412..00000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/02b5f26d5e34d4ec.js +++ /dev/null @@ -1,8 +0,0 @@ -(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,434626,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"}))});e.s(["ExternalLinkIcon",0,r],434626)},902555,e=>{"use strict";var t=e.i(843476),r=e.i(591935),a=e.i(122577),o=e.i(278587),l=e.i(68155),n=e.i(360820),i=e.i(871943),s=e.i(434626),d=e.i(592968),c=e.i(115504),m=e.i(752978);function g({icon:e,onClick:r,className:a,disabled:o,dataTestId:l}){return o?(0,t.jsx)(m.Icon,{icon:e,size:"sm",className:"opacity-50 cursor-not-allowed","data-testid":l}):(0,t.jsx)(m.Icon,{icon:e,size:"sm",onClick:r,className:(0,c.cx)("cursor-pointer",a),"data-testid":l})}let u={Edit:{icon:r.PencilAltIcon,className:"hover:text-blue-600"},Delete:{icon:l.TrashIcon,className:"hover:text-red-600"},Test:{icon:a.PlayIcon,className:"hover:text-blue-600"},Regenerate:{icon:o.RefreshIcon,className:"hover:text-green-600"},Up:{icon:n.ChevronUpIcon,className:"hover:text-blue-600"},Down:{icon:i.ChevronDownIcon,className:"hover:text-blue-600"},Open:{icon:s.ExternalLinkIcon,className:"hover:text-green-600"}};function b({onClick:e,tooltipText:r,disabled:a=!1,disabledTooltipText:o,dataTestId:l,variant:n}){let{icon:i,className:s}=u[n];return(0,t.jsx)(d.Tooltip,{title:a?o:r,children:(0,t.jsx)("span",{children:(0,t.jsx)(g,{icon:i,onClick:e,className:s,disabled:a,dataTestId:l})})})}e.s(["default",()=>b],902555)},122577,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14.752 11.168l-3.197-2.132A1 1 0 0010 9.87v4.263a1 1 0 001.555.832l3.197-2.132a1 1 0 000-1.664z"}),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}))});e.s(["PlayIcon",0,r],122577)},728889,e=>{"use strict";var t=e.i(290571),r=e.i(271645),a=e.i(829087),o=e.i(480731),l=e.i(444755),n=e.i(673706),i=e.i(95779);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"}},d={xs:{height:"h-3",width:"w-3"},sm:{height:"h-5",width:"w-5"},md:{height:"h-5",width:"w-5"},lg:{height:"h-7",width:"w-7"},xl:{height:"h-9",width:"w-9"}},c={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:""}},m=(0,n.makeClassName)("Icon"),g=r.default.forwardRef((e,g)=>{let{icon:u,variant:b="simple",tooltip:h,size:f=o.Sizes.SM,color:p,className:C}=e,k=(0,t.__rest)(e,["icon","variant","tooltip","size","color","className"]),x=((e,t)=>{switch(e){case"simple":return{textColor:t?(0,n.getColorClassNames)(t,i.colorPalette.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:"",borderColor:"",ringColor:""};case"light":return{textColor:t?(0,n.getColorClassNames)(t,i.colorPalette.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:t?(0,l.tremorTwMerge)((0,n.getColorClassNames)(t,i.colorPalette.background).bgColor,"bg-opacity-20"):"bg-tremor-brand-muted dark:bg-dark-tremor-brand-muted",borderColor:"",ringColor:""};case"shadow":return{textColor:t?(0,n.getColorClassNames)(t,i.colorPalette.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:t?(0,l.tremorTwMerge)((0,n.getColorClassNames)(t,i.colorPalette.background).bgColor,"bg-opacity-20"):"bg-tremor-background dark:bg-dark-tremor-background",borderColor:"border-tremor-border dark:border-dark-tremor-border",ringColor:""};case"solid":return{textColor:t?(0,n.getColorClassNames)(t,i.colorPalette.text).textColor:"text-tremor-brand-inverted dark:text-dark-tremor-brand-inverted",bgColor:t?(0,l.tremorTwMerge)((0,n.getColorClassNames)(t,i.colorPalette.background).bgColor,"bg-opacity-20"):"bg-tremor-brand dark:bg-dark-tremor-brand",borderColor:"border-tremor-brand-inverted dark:border-dark-tremor-brand-inverted",ringColor:"ring-tremor-ring dark:ring-dark-tremor-ring"};case"outlined":return{textColor:t?(0,n.getColorClassNames)(t,i.colorPalette.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:t?(0,l.tremorTwMerge)((0,n.getColorClassNames)(t,i.colorPalette.background).bgColor,"bg-opacity-20"):"bg-tremor-background dark:bg-dark-tremor-background",borderColor:t?(0,n.getColorClassNames)(t,i.colorPalette.ring).borderColor:"border-tremor-brand-subtle dark:border-dark-tremor-brand-subtle",ringColor:t?(0,l.tremorTwMerge)((0,n.getColorClassNames)(t,i.colorPalette.ring).ringColor,"ring-opacity-40"):"ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted"}}})(b,p),{tooltipProps:w,getReferenceProps:v}=(0,a.useTooltip)();return r.default.createElement("span",Object.assign({ref:(0,n.mergeRefs)([g,w.refs.setReference]),className:(0,l.tremorTwMerge)(m("root"),"inline-flex shrink-0 items-center justify-center",x.bgColor,x.textColor,x.borderColor,x.ringColor,c[b].rounded,c[b].border,c[b].shadow,c[b].ring,s[f].paddingX,s[f].paddingY,C)},v,k),r.default.createElement(a.default,Object.assign({text:h},w)),r.default.createElement(u,{className:(0,l.tremorTwMerge)(m("icon"),"shrink-0",d[f].height,d[f].width)}))});g.displayName="Icon",e.s(["default",()=>g],728889)},752978,e=>{"use strict";var t=e.i(728889);e.s(["Icon",()=>t.default])},591935,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"}))});e.s(["PencilAltIcon",0,r],591935)},360820,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"}))});e.s(["ChevronUpIcon",0,r],360820)},871943,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"}))});e.s(["ChevronDownIcon",0,r],871943)},185793,e=>{"use strict";e.i(247167);var t=e.i(271645),r=e.i(343794),a=e.i(242064),o=e.i(529681);let l=e=>{let{prefixCls:a,className:o,style:l,size:n,shape:i}=e,s=(0,r.default)({[`${a}-lg`]:"large"===n,[`${a}-sm`]:"small"===n}),d=(0,r.default)({[`${a}-circle`]:"circle"===i,[`${a}-square`]:"square"===i,[`${a}-round`]:"round"===i}),c=t.useMemo(()=>"number"==typeof n?{width:n,height:n,lineHeight:`${n}px`}:{},[n]);return t.createElement("span",{className:(0,r.default)(a,s,d,o),style:Object.assign(Object.assign({},c),l)})};e.i(296059);var n=e.i(694758),i=e.i(915654),s=e.i(246422),d=e.i(838378);let c=new n.Keyframes("ant-skeleton-loading",{"0%":{backgroundPosition:"100% 50%"},"100%":{backgroundPosition:"0 50%"}}),m=e=>({height:e,lineHeight:(0,i.unit)(e)}),g=e=>Object.assign({width:e},m(e)),u=(e,t)=>Object.assign({width:t(e).mul(5).equal(),minWidth:t(e).mul(5).equal()},m(e)),b=e=>Object.assign({width:e},m(e)),h=(e,t,r)=>{let{skeletonButtonCls:a}=e;return{[`${r}${a}-circle`]:{width:t,minWidth:t,borderRadius:"50%"},[`${r}${a}-round`]:{borderRadius:t}}},f=(e,t)=>Object.assign({width:t(e).mul(2).equal(),minWidth:t(e).mul(2).equal()},m(e)),p=(0,s.genStyleHooks)("Skeleton",e=>{let{componentCls:t,calc:r}=e;return(e=>{let{componentCls:t,skeletonAvatarCls:r,skeletonTitleCls:a,skeletonParagraphCls:o,skeletonButtonCls:l,skeletonInputCls:n,skeletonImageCls:i,controlHeight:s,controlHeightLG:d,controlHeightSM:m,gradientFromColor:p,padding:C,marginSM:k,borderRadius:x,titleHeight:w,blockRadius:v,paragraphLiHeight:N,controlHeightXS:$,paragraphMarginTop:j}=e;return{[t]:{display:"table",width:"100%",[`${t}-header`]:{display:"table-cell",paddingInlineEnd:C,verticalAlign:"top",[r]:Object.assign({display:"inline-block",verticalAlign:"top",background:p},g(s)),[`${r}-circle`]:{borderRadius:"50%"},[`${r}-lg`]:Object.assign({},g(d)),[`${r}-sm`]:Object.assign({},g(m))},[`${t}-content`]:{display:"table-cell",width:"100%",verticalAlign:"top",[a]:{width:"100%",height:w,background:p,borderRadius:v,[`+ ${o}`]:{marginBlockStart:m}},[o]:{padding:0,"> li":{width:"100%",height:N,listStyle:"none",background:p,borderRadius:v,"+ li":{marginBlockStart:$}}},[`${o}> li:last-child:not(:first-child):not(:nth-child(2))`]:{width:"61%"}},[`&-round ${t}-content`]:{[`${a}, ${o} > li`]:{borderRadius:x}}},[`${t}-with-avatar ${t}-content`]:{[a]:{marginBlockStart:k,[`+ ${o}`]:{marginBlockStart:j}}},[`${t}${t}-element`]:Object.assign(Object.assign(Object.assign(Object.assign({display:"inline-block",width:"auto"},(e=>{let{borderRadiusSM:t,skeletonButtonCls:r,controlHeight:a,controlHeightLG:o,controlHeightSM:l,gradientFromColor:n,calc:i}=e;return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({[r]:Object.assign({display:"inline-block",verticalAlign:"top",background:n,borderRadius:t,width:i(a).mul(2).equal(),minWidth:i(a).mul(2).equal()},f(a,i))},h(e,a,r)),{[`${r}-lg`]:Object.assign({},f(o,i))}),h(e,o,`${r}-lg`)),{[`${r}-sm`]:Object.assign({},f(l,i))}),h(e,l,`${r}-sm`))})(e)),(e=>{let{skeletonAvatarCls:t,gradientFromColor:r,controlHeight:a,controlHeightLG:o,controlHeightSM:l}=e;return{[t]:Object.assign({display:"inline-block",verticalAlign:"top",background:r},g(a)),[`${t}${t}-circle`]:{borderRadius:"50%"},[`${t}${t}-lg`]:Object.assign({},g(o)),[`${t}${t}-sm`]:Object.assign({},g(l))}})(e)),(e=>{let{controlHeight:t,borderRadiusSM:r,skeletonInputCls:a,controlHeightLG:o,controlHeightSM:l,gradientFromColor:n,calc:i}=e;return{[a]:Object.assign({display:"inline-block",verticalAlign:"top",background:n,borderRadius:r},u(t,i)),[`${a}-lg`]:Object.assign({},u(o,i)),[`${a}-sm`]:Object.assign({},u(l,i))}})(e)),(e=>{let{skeletonImageCls:t,imageSizeBase:r,gradientFromColor:a,borderRadiusSM:o,calc:l}=e;return{[t]:Object.assign(Object.assign({display:"inline-flex",alignItems:"center",justifyContent:"center",verticalAlign:"middle",background:a,borderRadius:o},b(l(r).mul(2).equal())),{[`${t}-path`]:{fill:"#bfbfbf"},[`${t}-svg`]:Object.assign(Object.assign({},b(r)),{maxWidth:l(r).mul(4).equal(),maxHeight:l(r).mul(4).equal()}),[`${t}-svg${t}-svg-circle`]:{borderRadius:"50%"}}),[`${t}${t}-circle`]:{borderRadius:"50%"}}})(e)),[`${t}${t}-block`]:{width:"100%",[l]:{width:"100%"},[n]:{width:"100%"}},[`${t}${t}-active`]:{[` - ${a}, - ${o} > li, - ${r}, - ${l}, - ${n}, - ${i} - `]:Object.assign({},{background:e.skeletonLoadingBackground,backgroundSize:"400% 100%",animationName:c,animationDuration:e.skeletonLoadingMotionDuration,animationTimingFunction:"ease",animationIterationCount:"infinite"})}}})((0,d.mergeToken)(e,{skeletonAvatarCls:`${t}-avatar`,skeletonTitleCls:`${t}-title`,skeletonParagraphCls:`${t}-paragraph`,skeletonButtonCls:`${t}-button`,skeletonInputCls:`${t}-input`,skeletonImageCls:`${t}-image`,imageSizeBase:r(e.controlHeight).mul(1.5).equal(),borderRadius:100,skeletonLoadingBackground:`linear-gradient(90deg, ${e.gradientFromColor} 25%, ${e.gradientToColor} 37%, ${e.gradientFromColor} 63%)`,skeletonLoadingMotionDuration:"1.4s"}))},e=>{let{colorFillContent:t,colorFill:r}=e;return{color:t,colorGradientEnd:r,gradientFromColor:t,gradientToColor:r,titleHeight:e.controlHeight/2,blockRadius:e.borderRadiusSM,paragraphMarginTop:e.marginLG+e.marginXXS,paragraphLiHeight:e.controlHeight/2}},{deprecatedTokens:[["color","gradientFromColor"],["colorGradientEnd","gradientToColor"]]}),C=e=>{let{prefixCls:a,className:o,style:l,rows:n=0}=e,i=Array.from({length:n}).map((r,a)=>t.createElement("li",{key:a,style:{width:((e,t)=>{let{width:r,rows:a=2}=t;return Array.isArray(r)?r[e]:a-1===e?r:void 0})(a,e)}}));return t.createElement("ul",{className:(0,r.default)(a,o),style:l},i)},k=({prefixCls:e,className:a,width:o,style:l})=>t.createElement("h3",{className:(0,r.default)(e,a),style:Object.assign({width:o},l)});function x(e){return e&&"object"==typeof e?e:{}}let w=e=>{let{prefixCls:o,loading:n,className:i,rootClassName:s,style:d,children:c,avatar:m=!1,title:g=!0,paragraph:u=!0,active:b,round:h}=e,{getPrefixCls:f,direction:w,className:v,style:N}=(0,a.useComponentConfig)("skeleton"),$=f("skeleton",o),[j,T,y]=p($);if(n||!("loading"in e)){let e,a,o=!!m,n=!!g,c=!!u;if(o){let r=Object.assign(Object.assign({prefixCls:`${$}-avatar`},n&&!c?{size:"large",shape:"square"}:{size:"large",shape:"circle"}),x(m));e=t.createElement("div",{className:`${$}-header`},t.createElement(l,Object.assign({},r)))}if(n||c){let e,r;if(n){let r=Object.assign(Object.assign({prefixCls:`${$}-title`},!o&&c?{width:"38%"}:o&&c?{width:"50%"}:{}),x(g));e=t.createElement(k,Object.assign({},r))}if(c){let e,a=Object.assign(Object.assign({prefixCls:`${$}-paragraph`},(e={},o&&n||(e.width="61%"),!o&&n?e.rows=3:e.rows=2,e)),x(u));r=t.createElement(C,Object.assign({},a))}a=t.createElement("div",{className:`${$}-content`},e,r)}let f=(0,r.default)($,{[`${$}-with-avatar`]:o,[`${$}-active`]:b,[`${$}-rtl`]:"rtl"===w,[`${$}-round`]:h},v,i,s,T,y);return j(t.createElement("div",{className:f,style:Object.assign(Object.assign({},N),d)},e,a))}return null!=c?c:null};w.Button=e=>{let{prefixCls:n,className:i,rootClassName:s,active:d,block:c=!1,size:m="default"}=e,{getPrefixCls:g}=t.useContext(a.ConfigContext),u=g("skeleton",n),[b,h,f]=p(u),C=(0,o.default)(e,["prefixCls"]),k=(0,r.default)(u,`${u}-element`,{[`${u}-active`]:d,[`${u}-block`]:c},i,s,h,f);return b(t.createElement("div",{className:k},t.createElement(l,Object.assign({prefixCls:`${u}-button`,size:m},C))))},w.Avatar=e=>{let{prefixCls:n,className:i,rootClassName:s,active:d,shape:c="circle",size:m="default"}=e,{getPrefixCls:g}=t.useContext(a.ConfigContext),u=g("skeleton",n),[b,h,f]=p(u),C=(0,o.default)(e,["prefixCls","className"]),k=(0,r.default)(u,`${u}-element`,{[`${u}-active`]:d},i,s,h,f);return b(t.createElement("div",{className:k},t.createElement(l,Object.assign({prefixCls:`${u}-avatar`,shape:c,size:m},C))))},w.Input=e=>{let{prefixCls:n,className:i,rootClassName:s,active:d,block:c,size:m="default"}=e,{getPrefixCls:g}=t.useContext(a.ConfigContext),u=g("skeleton",n),[b,h,f]=p(u),C=(0,o.default)(e,["prefixCls"]),k=(0,r.default)(u,`${u}-element`,{[`${u}-active`]:d,[`${u}-block`]:c},i,s,h,f);return b(t.createElement("div",{className:k},t.createElement(l,Object.assign({prefixCls:`${u}-input`,size:m},C))))},w.Image=e=>{let{prefixCls:o,className:l,rootClassName:n,style:i,active:s}=e,{getPrefixCls:d}=t.useContext(a.ConfigContext),c=d("skeleton",o),[m,g,u]=p(c),b=(0,r.default)(c,`${c}-element`,{[`${c}-active`]:s},l,n,g,u);return m(t.createElement("div",{className:b},t.createElement("div",{className:(0,r.default)(`${c}-image`,l),style:i},t.createElement("svg",{viewBox:"0 0 1098 1024",xmlns:"http://www.w3.org/2000/svg",className:`${c}-image-svg`},t.createElement("title",null,"Image placeholder"),t.createElement("path",{d:"M365.714286 329.142857q0 45.714286-32.036571 77.677714t-77.677714 32.036571-77.677714-32.036571-32.036571-77.677714 32.036571-77.677714 77.677714-32.036571 77.677714 32.036571 32.036571 77.677714zM950.857143 548.571429l0 256-804.571429 0 0-109.714286 182.857143-182.857143 91.428571 91.428571 292.571429-292.571429zM1005.714286 146.285714l-914.285714 0q-7.460571 0-12.873143 5.412571t-5.412571 12.873143l0 694.857143q0 7.460571 5.412571 12.873143t12.873143 5.412571l914.285714 0q7.460571 0 12.873143-5.412571t5.412571-12.873143l0-694.857143q0-7.460571-5.412571-12.873143t-12.873143-5.412571zM1097.142857 164.571429l0 694.857143q0 37.741714-26.843429 64.585143t-64.585143 26.843429l-914.285714 0q-37.741714 0-64.585143-26.843429t-26.843429-64.585143l0-694.857143q0-37.741714 26.843429-64.585143t64.585143-26.843429l914.285714 0q37.741714 0 64.585143 26.843429t26.843429 64.585143z",className:`${c}-image-path`})))))},w.Node=e=>{let{prefixCls:o,className:l,rootClassName:n,style:i,active:s,children:d}=e,{getPrefixCls:c}=t.useContext(a.ConfigContext),m=c("skeleton",o),[g,u,b]=p(m),h=(0,r.default)(m,`${m}-element`,{[`${m}-active`]:s},u,l,n,b);return g(t.createElement("div",{className:h},t.createElement("div",{className:(0,r.default)(`${m}-image`,l),style:i},d)))},e.s(["default",0,w],185793)},599724,936325,e=>{"use strict";var t=e.i(95779),r=e.i(444755),a=e.i(673706),o=e.i(271645);let l=o.default.forwardRef((e,l)=>{let{color:n,className:i,children:s}=e;return o.default.createElement("p",{ref:l,className:(0,r.tremorTwMerge)("text-tremor-default",n?(0,a.getColorClassNames)(n,t.colorPalette.text).textColor:(0,r.tremorTwMerge)("text-tremor-content","dark:text-dark-tremor-content"),i)},s)});l.displayName="Text",e.s(["default",()=>l],936325),e.s(["Text",()=>l],599724)},994388,e=>{"use strict";var t=e.i(290571),r=e.i(829087),a=e.i(271645);let o=["preEnter","entering","entered","preExit","exiting","exited","unmounted"],l=e=>({_s:e,status:o[e],isEnter:e<3,isMounted:6!==e,isResolved:2===e||e>4}),n=e=>e?6:5,i=(e,t,r,a,o)=>{clearTimeout(a.current);let n=l(e);t(n),r.current=n,o&&o({current:n})};var s=e.i(480731),d=e.i(444755),c=e.i(673706);let m=e=>{var r=(0,t.__rest)(e,[]);return a.default.createElement("svg",Object.assign({},r,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"}),a.default.createElement("path",{fill:"none",d:"M0 0h24v24H0z"}),a.default.createElement("path",{d:"M18.364 5.636L16.95 7.05A7 7 0 1 0 19 12h2a9 9 0 1 1-2.636-6.364z"}))};var g=e.i(95779);let u={xs:{height:"h-4",width:"w-4"},sm:{height:"h-5",width:"w-5"},md:{height:"h-5",width:"w-5"},lg:{height:"h-6",width:"w-6"},xl:{height:"h-6",width:"w-6"}},b=(e,t)=>{switch(e){case"primary":return{textColor:t?(0,c.getColorClassNames)("white").textColor:"text-tremor-brand-inverted dark:text-dark-tremor-brand-inverted",hoverTextColor:t?(0,c.getColorClassNames)("white").textColor:"text-tremor-brand-inverted dark:text-dark-tremor-brand-inverted",bgColor:t?(0,c.getColorClassNames)(t,g.colorPalette.background).bgColor:"bg-tremor-brand dark:bg-dark-tremor-brand",hoverBgColor:t?(0,c.getColorClassNames)(t,g.colorPalette.darkBackground).hoverBgColor:"hover:bg-tremor-brand-emphasis dark:hover:bg-dark-tremor-brand-emphasis",borderColor:t?(0,c.getColorClassNames)(t,g.colorPalette.border).borderColor:"border-tremor-brand dark:border-dark-tremor-brand",hoverBorderColor:t?(0,c.getColorClassNames)(t,g.colorPalette.darkBorder).hoverBorderColor:"hover:border-tremor-brand-emphasis dark:hover:border-dark-tremor-brand-emphasis"};case"secondary":return{textColor:t?(0,c.getColorClassNames)(t,g.colorPalette.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",hoverTextColor:t?(0,c.getColorClassNames)(t,g.colorPalette.text).textColor:"hover:text-tremor-brand-emphasis dark:hover:text-dark-tremor-brand-emphasis",bgColor:(0,c.getColorClassNames)("transparent").bgColor,hoverBgColor:t?(0,d.tremorTwMerge)((0,c.getColorClassNames)(t,g.colorPalette.background).hoverBgColor,"hover:bg-opacity-20 dark:hover:bg-opacity-20"):"hover:bg-tremor-brand-faint dark:hover:bg-dark-tremor-brand-faint",borderColor:t?(0,c.getColorClassNames)(t,g.colorPalette.border).borderColor:"border-tremor-brand dark:border-dark-tremor-brand"};case"light":return{textColor:t?(0,c.getColorClassNames)(t,g.colorPalette.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",hoverTextColor:t?(0,c.getColorClassNames)(t,g.colorPalette.darkText).hoverTextColor:"hover:text-tremor-brand-emphasis dark:hover:text-dark-tremor-brand-emphasis",bgColor:(0,c.getColorClassNames)("transparent").bgColor,borderColor:"",hoverBorderColor:""}}},h=(0,c.makeClassName)("Button"),f=({loading:e,iconSize:t,iconPosition:r,Icon:o,needMargin:l,transitionStatus:n})=>{let i=l?r===s.HorizontalPositions.Left?(0,d.tremorTwMerge)("-ml-1","mr-1.5"):(0,d.tremorTwMerge)("-mr-1","ml-1.5"):"",c=(0,d.tremorTwMerge)("w-0 h-0"),g={default:c,entering:c,entered:t,exiting:t,exited:c};return e?a.default.createElement(m,{className:(0,d.tremorTwMerge)(h("icon"),"animate-spin shrink-0",i,g.default,g[n]),style:{transition:"width 150ms"}}):a.default.createElement(o,{className:(0,d.tremorTwMerge)(h("icon"),"shrink-0",t,i)})},p=a.default.forwardRef((e,o)=>{let{icon:m,iconPosition:g=s.HorizontalPositions.Left,size:p=s.Sizes.SM,color:C,variant:k="primary",disabled:x,loading:w=!1,loadingText:v,children:N,tooltip:$,className:j}=e,T=(0,t.__rest)(e,["icon","iconPosition","size","color","variant","disabled","loading","loadingText","children","tooltip","className"]),y=w||x,E=void 0!==m||w,O=w&&v,M=!(!N&&!O),R=(0,d.tremorTwMerge)(u[p].height,u[p].width),P="light"!==k?(0,d.tremorTwMerge)("rounded-tremor-default border","shadow-tremor-input","dark:shadow-dark-tremor-input"):"",z=b(k,C),B=("light"!==k?{xs:{paddingX:"px-2.5",paddingY:"py-1.5",fontSize:"text-xs"},sm:{paddingX:"px-4",paddingY:"py-2",fontSize:"text-sm"},md:{paddingX:"px-4",paddingY:"py-2",fontSize:"text-md"},lg:{paddingX:"px-4",paddingY:"py-2.5",fontSize:"text-lg"},xl:{paddingX:"px-4",paddingY:"py-3",fontSize:"text-xl"}}:{xs:{paddingX:"",paddingY:"",fontSize:"text-xs"},sm:{paddingX:"",paddingY:"",fontSize:"text-sm"},md:{paddingX:"",paddingY:"",fontSize:"text-md"},lg:{paddingX:"",paddingY:"",fontSize:"text-lg"},xl:{paddingX:"",paddingY:"",fontSize:"text-xl"}})[p],{tooltipProps:S,getReferenceProps:I}=(0,r.useTooltip)(300),[L,H]=(({enter:e=!0,exit:t=!0,preEnter:r,preExit:o,timeout:s,initialEntered:d,mountOnEnter:c,unmountOnExit:m,onStateChange:g}={})=>{let[u,b]=(0,a.useState)(()=>l(d?2:n(c))),h=(0,a.useRef)(u),f=(0,a.useRef)(0),[p,C]="object"==typeof s?[s.enter,s.exit]:[s,s],k=(0,a.useCallback)(()=>{let e=((e,t)=>{switch(e){case 1:case 0:return 2;case 4:case 3:return n(t)}})(h.current._s,m);e&&i(e,b,h,f,g)},[g,m]);return[u,(0,a.useCallback)(a=>{let l=e=>{switch(i(e,b,h,f,g),e){case 1:p>=0&&(f.current=((...e)=>setTimeout(...e))(k,p));break;case 4:C>=0&&(f.current=((...e)=>setTimeout(...e))(k,C));break;case 0:case 3:f.current=((...e)=>setTimeout(...e))(()=>{isNaN(document.body.offsetTop)||l(e+1)},0)}},s=h.current.isEnter;"boolean"!=typeof a&&(a=!s),a?s||l(e?+!r:2):s&&l(t?o?3:4:n(m))},[k,g,e,t,r,o,p,C,m]),k]})({timeout:50});return(0,a.useEffect)(()=>{H(w)},[w]),a.default.createElement("button",Object.assign({ref:(0,c.mergeRefs)([o,S.refs.setReference]),className:(0,d.tremorTwMerge)(h("root"),"shrink-0 inline-flex justify-center items-center group font-medium outline-none",P,B.paddingX,B.paddingY,B.fontSize,z.textColor,z.bgColor,z.borderColor,z.hoverBorderColor,y?"opacity-50 cursor-not-allowed":(0,d.tremorTwMerge)(b(k,C).hoverTextColor,b(k,C).hoverBgColor,b(k,C).hoverBorderColor),j),disabled:y},I,T),a.default.createElement(r.default,Object.assign({text:$},S)),E&&g!==s.HorizontalPositions.Right?a.default.createElement(f,{loading:w,iconSize:R,iconPosition:g,Icon:m,transitionStatus:L.status,needMargin:M}):null,O||N?a.default.createElement("span",{className:(0,d.tremorTwMerge)(h("text"),"text-tremor-default whitespace-nowrap")},O?v:N):null,E&&g===s.HorizontalPositions.Right?a.default.createElement(f,{loading:w,iconSize:R,iconPosition:g,Icon:m,transitionStatus:L.status,needMargin:M}):null)});p.displayName="Button",e.s(["Button",()=>p],994388)},304967,e=>{"use strict";var t=e.i(290571),r=e.i(271645),a=e.i(480731),o=e.i(95779),l=e.i(444755),n=e.i(673706);let i=(0,n.makeClassName)("Card"),s=r.default.forwardRef((e,s)=>{let{decoration:d="",decorationColor:c,children:m,className:g}=e,u=(0,t.__rest)(e,["decoration","decorationColor","children","className"]);return r.default.createElement("div",Object.assign({ref:s,className:(0,l.tremorTwMerge)(i("root"),"relative w-full text-left ring-1 rounded-tremor-default p-6","bg-tremor-background ring-tremor-ring shadow-tremor-card","dark:bg-dark-tremor-background dark:ring-dark-tremor-ring dark:shadow-dark-tremor-card",c?(0,n.getColorClassNames)(c,o.colorPalette.border).borderColor:"border-tremor-brand dark:border-dark-tremor-brand",(e=>{if(!e)return"";switch(e){case a.HorizontalPositions.Left:return"border-l-4";case a.VerticalPositions.Top:return"border-t-4";case a.HorizontalPositions.Right:return"border-r-4";case a.VerticalPositions.Bottom:return"border-b-4";default:return""}})(d),g)},u),m)});s.displayName="Card",e.s(["Card",()=>s],304967)},269200,e=>{"use strict";var t=e.i(290571),r=e.i(271645),a=e.i(444755);let o=(0,e.i(673706).makeClassName)("Table"),l=r.default.forwardRef((e,l)=>{let{children:n,className:i}=e,s=(0,t.__rest)(e,["children","className"]);return r.default.createElement("div",{className:(0,a.tremorTwMerge)(o("root"),"overflow-auto",i)},r.default.createElement("table",Object.assign({ref:l,className:(0,a.tremorTwMerge)(o("table"),"w-full text-tremor-default","text-tremor-content","dark:text-dark-tremor-content")},s),n))});l.displayName="Table",e.s(["Table",()=>l],269200)},942232,e=>{"use strict";var t=e.i(290571),r=e.i(271645),a=e.i(444755);let o=(0,e.i(673706).makeClassName)("TableBody"),l=r.default.forwardRef((e,l)=>{let{children:n,className:i}=e,s=(0,t.__rest)(e,["children","className"]);return r.default.createElement(r.default.Fragment,null,r.default.createElement("tbody",Object.assign({ref:l,className:(0,a.tremorTwMerge)(o("root"),"align-top divide-y","divide-tremor-border","dark:divide-dark-tremor-border",i)},s),n))});l.displayName="TableBody",e.s(["TableBody",()=>l],942232)},977572,e=>{"use strict";var t=e.i(290571),r=e.i(271645),a=e.i(444755);let o=(0,e.i(673706).makeClassName)("TableCell"),l=r.default.forwardRef((e,l)=>{let{children:n,className:i}=e,s=(0,t.__rest)(e,["children","className"]);return r.default.createElement(r.default.Fragment,null,r.default.createElement("td",Object.assign({ref:l,className:(0,a.tremorTwMerge)(o("root"),"align-middle whitespace-nowrap text-left p-4",i)},s),n))});l.displayName="TableCell",e.s(["TableCell",()=>l],977572)},427612,e=>{"use strict";var t=e.i(290571),r=e.i(271645),a=e.i(444755);let o=(0,e.i(673706).makeClassName)("TableHead"),l=r.default.forwardRef((e,l)=>{let{children:n,className:i}=e,s=(0,t.__rest)(e,["children","className"]);return r.default.createElement(r.default.Fragment,null,r.default.createElement("thead",Object.assign({ref:l,className:(0,a.tremorTwMerge)(o("root"),"text-left","text-tremor-content","dark:text-dark-tremor-content",i)},s),n))});l.displayName="TableHead",e.s(["TableHead",()=>l],427612)},64848,e=>{"use strict";var t=e.i(290571),r=e.i(271645),a=e.i(444755);let o=(0,e.i(673706).makeClassName)("TableHeaderCell"),l=r.default.forwardRef((e,l)=>{let{children:n,className:i}=e,s=(0,t.__rest)(e,["children","className"]);return r.default.createElement(r.default.Fragment,null,r.default.createElement("th",Object.assign({ref:l,className:(0,a.tremorTwMerge)(o("root"),"whitespace-nowrap text-left font-semibold top-0 px-4 py-3.5","text-tremor-content-strong","dark:text-dark-tremor-content-strong",i)},s),n))});l.displayName="TableHeaderCell",e.s(["TableHeaderCell",()=>l],64848)},496020,e=>{"use strict";var t=e.i(290571),r=e.i(271645),a=e.i(444755);let o=(0,e.i(673706).makeClassName)("TableRow"),l=r.default.forwardRef((e,l)=>{let{children:n,className:i}=e,s=(0,t.__rest)(e,["children","className"]);return r.default.createElement(r.default.Fragment,null,r.default.createElement("tr",Object.assign({ref:l,className:(0,a.tremorTwMerge)(o("row"),i)},s),n))});l.displayName="TableRow",e.s(["TableRow",()=>l],496020)},68155,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"}))});e.s(["TrashIcon",0,r],68155)},278587,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"}))});e.s(["RefreshIcon",0,r],278587)},207670,e=>{"use strict";function t(){for(var e,t,r=0,a="",o=arguments.length;rt,"default",0,t])}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/04a69f0d1ec0d10f.js b/litellm/proxy/_experimental/out/_next/static/chunks/04a69f0d1ec0d10f.js deleted file mode 100644 index 1a69797101f..00000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/04a69f0d1ec0d10f.js +++ /dev/null @@ -1 +0,0 @@ -(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,94629,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7 16V4m0 0L3 8m4-4l4 4m6 0v12m0 0l4-4m-4 4l-4-4"}))});e.s(["SwitchVerticalIcon",0,r],94629)},992571,e=>{"use strict";var t=e.i(619273);function r(e){return{onFetch:(r,n)=>{let s=r.options,o=r.fetchOptions?.meta?.fetchMore?.direction,l=r.state.data?.pages||[],u=r.state.data?.pageParams||[],c={pages:[],pageParams:[]},d=0,h=async()=>{let n=!1,h=(0,t.ensureQueryFn)(r.options,r.fetchOptions),m=async(e,i,a)=>{let s;if(n)return Promise.reject();if(null==i&&e.pages.length)return Promise.resolve(e);let o=(s={client:r.client,queryKey:r.queryKey,pageParam:i,direction:a?"backward":"forward",meta:r.options.meta},(0,t.addConsumeAwareSignal)(s,()=>r.signal,()=>n=!0),s),l=await h(o),{maxPages:u}=r.options,c=a?t.addToStart:t.addToEnd;return{pages:c(e.pages,l,u),pageParams:c(e.pageParams,i,u)}};if(o&&l.length){let e="backward"===o,t={pages:l,pageParams:u},r=(e?a:i)(s,t);c=await m(t,r,e)}else{let t=e??l.length;do{let e=0===d?u[0]??s.initialPageParam:i(s,c);if(d>0&&null==e)break;c=await m(c,e),d++}while(dr.options.persister?.(h,{client:r.client,queryKey:r.queryKey,meta:r.options.meta,signal:r.signal},n):r.fetchFn=h}}}function i(e,{pages:t,pageParams:r}){let i=t.length-1;return t.length>0?e.getNextPageParam(t[i],t,r[i],r):void 0}function a(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}function n(e,t){return!!t&&null!=i(e,t)}function s(e,t){return!!t&&!!e.getPreviousPageParam&&null!=a(e,t)}e.s(["hasNextPage",()=>n,"hasPreviousPage",()=>s,"infiniteQueryBehavior",()=>r])},114272,e=>{"use strict";var t=e.i(540143),r=e.i(88587),i=e.i(936553),a=class extends r.Removable{#e;#t;#r;#i;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#r=e.mutationCache,this.#t=[],this.state=e.state||n(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#r.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#r.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#t.length||("pending"===this.state.status?this.scheduleGc():this.#r.remove(this))}continue(){return this.#i?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#a({type:"continue"})},r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#i=(0,i.createRetryer)({fn:()=>this.options.mutationFn?this.options.mutationFn(e,r):Promise.reject(Error("No mutationFn found")),onFail:(e,t)=>{this.#a({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#a({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#r.canRun(this)});let a="pending"===this.state.status,n=!this.#i.canStart();try{if(a)t();else{this.#a({type:"pending",variables:e,isPaused:n}),this.#r.config.onMutate&&await this.#r.config.onMutate(e,this,r);let t=await this.options.onMutate?.(e,r);t!==this.state.context&&this.#a({type:"pending",context:t,variables:e,isPaused:n})}let i=await this.#i.start();return await this.#r.config.onSuccess?.(i,e,this.state.context,this,r),await this.options.onSuccess?.(i,e,this.state.context,r),await this.#r.config.onSettled?.(i,null,this.state.variables,this.state.context,this,r),await this.options.onSettled?.(i,null,e,this.state.context,r),this.#a({type:"success",data:i}),i}catch(t){try{await this.#r.config.onError?.(t,e,this.state.context,this,r)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,r)}catch(e){Promise.reject(e)}try{await this.#r.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,r)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,r)}catch(e){Promise.reject(e)}throw this.#a({type:"error",error:t}),t}finally{this.#r.runNext(this)}}#a(e){this.state=(t=>{switch(e.type){case"failed":return{...t,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...t,isPaused:!0};case"continue":return{...t,isPaused:!1};case"pending":return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}})(this.state),t.notifyManager.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#r.notify({mutation:this,type:"updated",action:e})})}};function n(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}e.s(["Mutation",()=>a,"getDefaultState",()=>n])},317751,e=>{"use strict";var t=e.i(619273),r=e.i(286491),i=e.i(540143),a=e.i(915823),n=class extends a.Subscribable{constructor(e={}){super(),this.config=e,this.#n=new Map}#n;build(e,i,a){let n=i.queryKey,s=i.queryHash??(0,t.hashQueryKeyByOptions)(n,i),o=this.get(s);return o||(o=new r.Query({client:e,queryKey:n,queryHash:s,options:e.defaultQueryOptions(i),state:a,defaultOptions:e.getQueryDefaults(n)}),this.add(o)),o}add(e){this.#n.has(e.queryHash)||(this.#n.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){let t=this.#n.get(e.queryHash);t&&(e.destroy(),t===e&&this.#n.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){i.notifyManager.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#n.get(e)}getAll(){return[...this.#n.values()]}find(e){let r={exact:!0,...e};return this.getAll().find(e=>(0,t.matchQuery)(r,e))}findAll(e={}){let r=this.getAll();return Object.keys(e).length>0?r.filter(r=>(0,t.matchQuery)(e,r)):r}notify(e){i.notifyManager.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){i.notifyManager.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){i.notifyManager.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},s=e.i(114272),o=a,l=class extends o.Subscribable{constructor(e={}){super(),this.config=e,this.#s=new Set,this.#o=new Map,this.#l=0}#s;#o;#l;build(e,t,r){let i=new s.Mutation({client:e,mutationCache:this,mutationId:++this.#l,options:e.defaultMutationOptions(t),state:r});return this.add(i),i}add(e){this.#s.add(e);let t=u(e);if("string"==typeof t){let r=this.#o.get(t);r?r.push(e):this.#o.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#s.delete(e)){let t=u(e);if("string"==typeof t){let r=this.#o.get(t);if(r)if(r.length>1){let t=r.indexOf(e);-1!==t&&r.splice(t,1)}else r[0]===e&&this.#o.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){let t=u(e);if("string"!=typeof t)return!0;{let r=this.#o.get(t),i=r?.find(e=>"pending"===e.state.status);return!i||i===e}}runNext(e){let t=u(e);if("string"!=typeof t)return Promise.resolve();{let r=this.#o.get(t)?.find(t=>t!==e&&t.state.isPaused);return r?.continue()??Promise.resolve()}}clear(){i.notifyManager.batch(()=>{this.#s.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#s.clear(),this.#o.clear()})}getAll(){return Array.from(this.#s)}find(e){let r={exact:!0,...e};return this.getAll().find(e=>(0,t.matchMutation)(r,e))}findAll(e={}){return this.getAll().filter(r=>(0,t.matchMutation)(e,r))}notify(e){i.notifyManager.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return i.notifyManager.batch(()=>Promise.all(e.map(e=>e.continue().catch(t.noop))))}};function u(e){return e.options.scope?.id}var c=e.i(175555),d=e.i(814448),h=e.i(992571),m=class{#u;#r;#c;#d;#h;#m;#f;#p;constructor(e={}){this.#u=e.queryCache||new n,this.#r=e.mutationCache||new l,this.#c=e.defaultOptions||{},this.#d=new Map,this.#h=new Map,this.#m=0}mount(){this.#m++,1===this.#m&&(this.#f=c.focusManager.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#u.onFocus())}),this.#p=d.onlineManager.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#u.onOnline())}))}unmount(){this.#m--,0===this.#m&&(this.#f?.(),this.#f=void 0,this.#p?.(),this.#p=void 0)}isFetching(e){return this.#u.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#r.findAll({...e,status:"pending"}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#u.get(t.queryHash)?.state.data}ensureQueryData(e){let r=this.defaultQueryOptions(e),i=this.#u.build(this,r),a=i.state.data;return void 0===a?this.fetchQuery(e):(e.revalidateIfStale&&i.isStaleByTime((0,t.resolveStaleTime)(r.staleTime,i))&&this.prefetchQuery(r),Promise.resolve(a))}getQueriesData(e){return this.#u.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,r,i){let a=this.defaultQueryOptions({queryKey:e}),n=this.#u.get(a.queryHash),s=n?.state.data,o=(0,t.functionalUpdate)(r,s);if(void 0!==o)return this.#u.build(this,a).setData(o,{...i,manual:!0})}setQueriesData(e,t,r){return i.notifyManager.batch(()=>this.#u.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,r)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#u.get(t.queryHash)?.state}removeQueries(e){let t=this.#u;i.notifyManager.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let r=this.#u;return i.notifyManager.batch(()=>(r.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,r={}){let a={revert:!0,...r};return Promise.all(i.notifyManager.batch(()=>this.#u.findAll(e).map(e=>e.cancel(a)))).then(t.noop).catch(t.noop)}invalidateQueries(e,t={}){return i.notifyManager.batch(()=>(this.#u.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType==="none")?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t))}refetchQueries(e,r={}){let a={...r,cancelRefetch:r.cancelRefetch??!0};return Promise.all(i.notifyManager.batch(()=>this.#u.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let r=e.fetch(void 0,a);return a.throwOnError||(r=r.catch(t.noop)),"paused"===e.state.fetchStatus?Promise.resolve():r}))).then(t.noop)}fetchQuery(e){let r=this.defaultQueryOptions(e);void 0===r.retry&&(r.retry=!1);let i=this.#u.build(this,r);return i.isStaleByTime((0,t.resolveStaleTime)(r.staleTime,i))?i.fetch(r):Promise.resolve(i.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(t.noop).catch(t.noop)}fetchInfiniteQuery(e){return e.behavior=(0,h.infiniteQueryBehavior)(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(t.noop).catch(t.noop)}ensureInfiniteQueryData(e){return e.behavior=(0,h.infiniteQueryBehavior)(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return d.onlineManager.isOnline()?this.#r.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#u}getMutationCache(){return this.#r}getDefaultOptions(){return this.#c}setDefaultOptions(e){this.#c=e}setQueryDefaults(e,r){this.#d.set((0,t.hashKey)(e),{queryKey:e,defaultOptions:r})}getQueryDefaults(e){let r=[...this.#d.values()],i={};return r.forEach(r=>{(0,t.partialMatchKey)(e,r.queryKey)&&Object.assign(i,r.defaultOptions)}),i}setMutationDefaults(e,r){this.#h.set((0,t.hashKey)(e),{mutationKey:e,defaultOptions:r})}getMutationDefaults(e){let r=[...this.#h.values()],i={};return r.forEach(r=>{(0,t.partialMatchKey)(e,r.mutationKey)&&Object.assign(i,r.defaultOptions)}),i}defaultQueryOptions(e){if(e._defaulted)return e;let r={...this.#c.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return r.queryHash||(r.queryHash=(0,t.hashQueryKeyByOptions)(r.queryKey,r)),void 0===r.refetchOnReconnect&&(r.refetchOnReconnect="always"!==r.networkMode),void 0===r.throwOnError&&(r.throwOnError=!!r.suspense),!r.networkMode&&r.persister&&(r.networkMode="offlineFirst"),r.queryFn===t.skipToken&&(r.enabled=!1),r}defaultMutationOptions(e){return e?._defaulted?e:{...this.#c.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#u.clear(),this.#r.clear()}};e.s(["QueryClient",()=>m],317751)},646563,e=>{"use strict";var t=e.i(959013);e.s(["PlusOutlined",()=>t.default])},244451,e=>{"use strict";let t;e.i(247167);var r=e.i(271645),i=e.i(343794),a=e.i(242064),n=e.i(763731),s=e.i(174428);let o=80*Math.PI,l=e=>{let{dotClassName:t,style:a,hasCircleCls:n}=e;return r.createElement("circle",{className:(0,i.default)(`${t}-circle`,{[`${t}-circle-bg`]:n}),r:40,cx:50,cy:50,strokeWidth:20,style:a})},u=({percent:e,prefixCls:t})=>{let a=`${t}-dot`,n=`${a}-holder`,u=`${n}-hidden`,[c,d]=r.useState(!1);(0,s.default)(()=>{0!==e&&d(!0)},[0!==e]);let h=Math.max(Math.min(e,100),0);if(!c)return null;let m={strokeDashoffset:`${o/4}`,strokeDasharray:`${o*h/100} ${o*(100-h)/100}`};return r.createElement("span",{className:(0,i.default)(n,`${a}-progress`,h<=0&&u)},r.createElement("svg",{viewBox:"0 0 100 100",role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":h},r.createElement(l,{dotClassName:a,hasCircleCls:!0}),r.createElement(l,{dotClassName:a,style:m})))};function c(e){let{prefixCls:t,percent:a=0}=e,n=`${t}-dot`,s=`${n}-holder`,o=`${s}-hidden`;return r.createElement(r.Fragment,null,r.createElement("span",{className:(0,i.default)(s,a>0&&o)},r.createElement("span",{className:(0,i.default)(n,`${t}-dot-spin`)},[1,2,3,4].map(e=>r.createElement("i",{className:`${t}-dot-item`,key:e})))),r.createElement(u,{prefixCls:t,percent:a}))}function d(e){var t;let{prefixCls:a,indicator:s,percent:o}=e,l=`${a}-dot`;return s&&r.isValidElement(s)?(0,n.cloneElement)(s,{className:(0,i.default)(null==(t=s.props)?void 0:t.className,l),percent:o}):r.createElement(c,{prefixCls:a,percent:o})}e.i(296059);var h=e.i(694758),m=e.i(183293),f=e.i(246422),p=e.i(838378);let g=new h.Keyframes("antSpinMove",{to:{opacity:1}}),y=new h.Keyframes("antRotate",{to:{transform:"rotate(405deg)"}}),v=(0,f.genStyleHooks)("Spin",e=>(e=>{let{componentCls:t,calc:r}=e;return{[t]:Object.assign(Object.assign({},(0,m.resetComponent)(e)),{position:"absolute",display:"none",color:e.colorPrimary,fontSize:0,textAlign:"center",verticalAlign:"middle",opacity:0,transition:`transform ${e.motionDurationSlow} ${e.motionEaseInOutCirc}`,"&-spinning":{position:"relative",display:"inline-block",opacity:1},[`${t}-text`]:{fontSize:e.fontSize,paddingTop:r(r(e.dotSize).sub(e.fontSize)).div(2).add(2).equal()},"&-fullscreen":{position:"fixed",width:"100vw",height:"100vh",backgroundColor:e.colorBgMask,zIndex:e.zIndexPopupBase,inset:0,display:"flex",alignItems:"center",flexDirection:"column",justifyContent:"center",opacity:0,visibility:"hidden",transition:`all ${e.motionDurationMid}`,"&-show":{opacity:1,visibility:"visible"},[t]:{[`${t}-dot-holder`]:{color:e.colorWhite},[`${t}-text`]:{color:e.colorTextLightSolid}}},"&-nested-loading":{position:"relative",[`> div > ${t}`]:{position:"absolute",top:0,insetInlineStart:0,zIndex:4,display:"block",width:"100%",height:"100%",maxHeight:e.contentHeight,[`${t}-dot`]:{position:"absolute",top:"50%",insetInlineStart:"50%",margin:r(e.dotSize).mul(-1).div(2).equal()},[`${t}-text`]:{position:"absolute",top:"50%",width:"100%",textShadow:`0 1px 2px ${e.colorBgContainer}`},[`&${t}-show-text ${t}-dot`]:{marginTop:r(e.dotSize).div(2).mul(-1).sub(10).equal()},"&-sm":{[`${t}-dot`]:{margin:r(e.dotSizeSM).mul(-1).div(2).equal()},[`${t}-text`]:{paddingTop:r(r(e.dotSizeSM).sub(e.fontSize)).div(2).add(2).equal()},[`&${t}-show-text ${t}-dot`]:{marginTop:r(e.dotSizeSM).div(2).mul(-1).sub(10).equal()}},"&-lg":{[`${t}-dot`]:{margin:r(e.dotSizeLG).mul(-1).div(2).equal()},[`${t}-text`]:{paddingTop:r(r(e.dotSizeLG).sub(e.fontSize)).div(2).add(2).equal()},[`&${t}-show-text ${t}-dot`]:{marginTop:r(e.dotSizeLG).div(2).mul(-1).sub(10).equal()}}},[`${t}-container`]:{position:"relative",transition:`opacity ${e.motionDurationSlow}`,"&::after":{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,zIndex:10,width:"100%",height:"100%",background:e.colorBgContainer,opacity:0,transition:`all ${e.motionDurationSlow}`,content:'""',pointerEvents:"none"}},[`${t}-blur`]:{clear:"both",opacity:.5,userSelect:"none",pointerEvents:"none","&::after":{opacity:.4,pointerEvents:"auto"}}},"&-tip":{color:e.spinDotDefault},[`${t}-dot-holder`]:{width:"1em",height:"1em",fontSize:e.dotSize,display:"inline-block",transition:`transform ${e.motionDurationSlow} ease, opacity ${e.motionDurationSlow} ease`,transformOrigin:"50% 50%",lineHeight:1,color:e.colorPrimary,"&-hidden":{transform:"scale(0.3)",opacity:0}},[`${t}-dot-progress`]:{position:"absolute",inset:0},[`${t}-dot`]:{position:"relative",display:"inline-block",fontSize:e.dotSize,width:"1em",height:"1em","&-item":{position:"absolute",display:"block",width:r(e.dotSize).sub(r(e.marginXXS).div(2)).div(2).equal(),height:r(e.dotSize).sub(r(e.marginXXS).div(2)).div(2).equal(),background:"currentColor",borderRadius:"100%",transform:"scale(0.75)",transformOrigin:"50% 50%",opacity:.3,animationName:g,animationDuration:"1s",animationIterationCount:"infinite",animationTimingFunction:"linear",animationDirection:"alternate","&:nth-child(1)":{top:0,insetInlineStart:0,animationDelay:"0s"},"&:nth-child(2)":{top:0,insetInlineEnd:0,animationDelay:"0.4s"},"&:nth-child(3)":{insetInlineEnd:0,bottom:0,animationDelay:"0.8s"},"&:nth-child(4)":{bottom:0,insetInlineStart:0,animationDelay:"1.2s"}},"&-spin":{transform:"rotate(45deg)",animationName:y,animationDuration:"1.2s",animationIterationCount:"infinite",animationTimingFunction:"linear"},"&-circle":{strokeLinecap:"round",transition:["stroke-dashoffset","stroke-dasharray","stroke","stroke-width","opacity"].map(t=>`${t} ${e.motionDurationSlow} ease`).join(","),fillOpacity:0,stroke:"currentcolor"},"&-circle-bg":{stroke:e.colorFillSecondary}},[`&-sm ${t}-dot`]:{"&, &-holder":{fontSize:e.dotSizeSM}},[`&-sm ${t}-dot-holder`]:{i:{width:r(r(e.dotSizeSM).sub(r(e.marginXXS).div(2))).div(2).equal(),height:r(r(e.dotSizeSM).sub(r(e.marginXXS).div(2))).div(2).equal()}},[`&-lg ${t}-dot`]:{"&, &-holder":{fontSize:e.dotSizeLG}},[`&-lg ${t}-dot-holder`]:{i:{width:r(r(e.dotSizeLG).sub(e.marginXXS)).div(2).equal(),height:r(r(e.dotSizeLG).sub(e.marginXXS)).div(2).equal()}},[`&${t}-show-text ${t}-text`]:{display:"block"}})}})((0,p.mergeToken)(e,{spinDotDefault:e.colorTextDescription})),e=>{let{controlHeightLG:t,controlHeight:r}=e;return{contentHeight:400,dotSize:t/2,dotSizeSM:.35*t,dotSizeLG:r}}),b=[[30,.05],[70,.03],[96,.01]];var w=function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&0>t.indexOf(i)&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,i=Object.getOwnPropertySymbols(e);at.indexOf(i[a])&&Object.prototype.propertyIsEnumerable.call(e,i[a])&&(r[i[a]]=e[i[a]]);return r};let x=e=>{var n;let{prefixCls:s,spinning:o=!0,delay:l=0,className:u,rootClassName:c,size:h="default",tip:m,wrapperClassName:f,style:p,children:g,fullscreen:y=!1,indicator:x,percent:C}=e,S=w(e,["prefixCls","spinning","delay","className","rootClassName","size","tip","wrapperClassName","style","children","fullscreen","indicator","percent"]),{getPrefixCls:E,direction:M,className:k,style:O,indicator:T}=(0,a.useComponentConfig)("spin"),P=E("spin",s),[N,q,D]=v(P),[$,I]=r.useState(()=>o&&(!o||!l||!!Number.isNaN(Number(l)))),R=function(e,t){let[i,a]=r.useState(0),n=r.useRef(null),s="auto"===t;return r.useEffect(()=>(s&&e&&(a(0),n.current=setInterval(()=>{a(e=>{let t=100-e;for(let r=0;r{n.current&&(clearInterval(n.current),n.current=null)}),[s,e]),s?i:t}($,C);r.useEffect(()=>{if(o){let e=function(e,t,r){var i,a=r||{},n=a.noTrailing,s=void 0!==n&&n,o=a.noLeading,l=void 0!==o&&o,u=a.debounceMode,c=void 0===u?void 0:u,d=!1,h=0;function m(){i&&clearTimeout(i)}function f(){for(var r=arguments.length,a=Array(r),n=0;ne?l?(h=Date.now(),s||(i=setTimeout(c?p:f,e))):f():!0!==s&&(i=setTimeout(c?p:f,void 0===c?e-u:e)))}return f.cancel=function(e){var t=(e||{}).upcomingOnly;m(),d=!(void 0!==t&&t)},f}(l,()=>{I(!0)},{debounceMode:false});return e(),()=>{var t;null==(t=null==e?void 0:e.cancel)||t.call(e)}}I(!1)},[l,o]);let L=r.useMemo(()=>void 0!==g&&!y,[g,y]),F=(0,i.default)(P,k,{[`${P}-sm`]:"small"===h,[`${P}-lg`]:"large"===h,[`${P}-spinning`]:$,[`${P}-show-text`]:!!m,[`${P}-rtl`]:"rtl"===M},u,!y&&c,q,D),j=(0,i.default)(`${P}-container`,{[`${P}-blur`]:$}),_=null!=(n=null!=x?x:T)?n:t,Q=Object.assign(Object.assign({},O),p),A=r.createElement("div",Object.assign({},S,{style:Q,className:F,"aria-live":"polite","aria-busy":$}),r.createElement(d,{prefixCls:P,indicator:_,percent:R}),m&&(L||y)?r.createElement("div",{className:`${P}-text`},m):null);return N(L?r.createElement("div",Object.assign({},S,{className:(0,i.default)(`${P}-nested-loading`,f,q,D)}),$&&r.createElement("div",{key:"loading"},A),r.createElement("div",{className:j,key:"container"},g)):y?r.createElement("div",{className:(0,i.default)(`${P}-fullscreen`,{[`${P}-fullscreen-show`]:$},c,q,D)},A):A)};x.setDefaultIndicator=e=>{t=e},e.s(["default",0,x],244451)},482725,e=>{"use strict";var t=e.i(244451);e.s(["Spin",()=>t.default])},350967,46757,e=>{"use strict";var t=e.i(290571),r=e.i(444755),i=e.i(673706),a=e.i(271645);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"},s={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"},o={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"},u={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"},c={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"},h={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"};e.s(["colSpan",()=>u,"colSpanLg",()=>h,"colSpanMd",()=>d,"colSpanSm",()=>c,"gridCols",()=>n,"gridColsLg",()=>l,"gridColsMd",()=>o,"gridColsSm",()=>s],46757);let m=(0,i.makeClassName)("Grid"),f=(e,t)=>e&&Object.keys(t).includes(String(e))?t[e]:"",p=a.default.forwardRef((e,i)=>{let{numItems:u=1,numItemsSm:c,numItemsMd:d,numItemsLg:h,children:p,className:g}=e,y=(0,t.__rest)(e,["numItems","numItemsSm","numItemsMd","numItemsLg","children","className"]),v=f(u,n),b=f(c,s),w=f(d,o),x=f(h,l),C=(0,r.tremorTwMerge)(v,b,w,x);return a.default.createElement("div",Object.assign({ref:i,className:(0,r.tremorTwMerge)(m("root"),"grid",C,g)},y),p)});p.displayName="Grid",e.s(["Grid",()=>p],350967)},530212,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 19l-7-7m0 0l7-7m-7 7h18"}))});e.s(["ArrowLeftIcon",0,r],530212)},981339,e=>{"use strict";var t=e.i(185793);e.s(["Skeleton",()=>t.default])},500330,e=>{"use strict";var t=e.i(727749);function r(e,t){let r=structuredClone(e);for(let[e,i]of Object.entries(t))e in r&&(r[e]=i);return r}let i=(e,t=0,r=!1,i=!0)=>{if(null==e||!Number.isFinite(e)||0===e&&!i)return"-";let a={minimumFractionDigits:t,maximumFractionDigits:t};if(!r)return e.toLocaleString("en-US",a);let n=e<0?"-":"",s=Math.abs(e),o=s,l="";return s>=1e6?(o=s/1e6,l="M"):s>=1e3&&(o=s/1e3,l="K"),`${n}${o.toLocaleString("en-US",a)}${l}`},a=async(e,r="Copied to clipboard")=>{if(!e)return!1;if(!navigator||!navigator.clipboard||!navigator.clipboard.writeText)return n(e,r);try{return await navigator.clipboard.writeText(e),t.default.success(r),!0}catch(t){return console.error("Clipboard API failed: ",t),n(e,r)}},n=(e,r)=>{try{let i=document.createElement("textarea");i.value=e,i.style.position="fixed",i.style.left="-999999px",i.style.top="-999999px",i.setAttribute("readonly",""),document.body.appendChild(i),i.focus(),i.select();let a=document.execCommand("copy");if(document.body.removeChild(i),a)return t.default.success(r),!0;throw Error("execCommand failed")}catch(e){return t.default.fromBackend("Failed to copy to clipboard"),console.error("Failed to copy: ",e),!1}};e.s(["copyToClipboard",0,a,"formatNumberWithCommas",0,i,"getSpendString",0,(e,t=6)=>{if(null==e||!Number.isFinite(e)||0===e)return"-";let r=i(e,t,!1,!1);if(0===Number(r.replace(/,/g,""))){let e=(1/10**t).toFixed(t);return`< $${e}`}return`$${r}`},"updateExistingKeys",()=>r])},270345,e=>{"use strict";var t=e.i(764205);let r=async(e,r,i,a)=>"Admin"!=i&&"Admin Viewer"!=i?await (0,t.teamListCall)(e,a?.organization_id||null,r):await (0,t.teamListCall)(e,a?.organization_id||null);e.s(["fetchTeams",0,r])},214541,e=>{"use strict";var t=e.i(271645),r=e.i(135214),i=e.i(270345);e.s(["default",0,()=>{let[e,a]=(0,t.useState)([]),{accessToken:n,userId:s,userRole:o}=(0,r.default)();return(0,t.useEffect)(()=>{(async()=>{a(await (0,i.fetchTeams)(n,s,o,null))})()},[n,s,o]),{teams:e,setTeams:a}}])},152473,e=>{"use strict";var t=e.i(271645);let r={enabled:!0,leading:!1,trailing:!0,wait:0,onExecute:()=>{}};class i{constructor(e,t){this.fn=e,this._canLeadingExecute=!0,this._isPending=!1,this._executionCount=0,this._options={...r,...t}}setOptions(e){return this._options={...this._options,...e},this._options.enabled||(this._isPending=!1),this._options}getOptions(){return this._options}maybeExecute(...e){this._options.leading&&this._canLeadingExecute&&(this.executeFunction(...e),this._canLeadingExecute=!1),(this._options.leading||this._options.trailing)&&(this._isPending=!0),this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=setTimeout(()=>{this._canLeadingExecute=!0,this._isPending=!1,this._options.trailing&&this.executeFunction(...e)},this._options.wait)}executeFunction(...e){this._options.enabled&&(this.fn(...e),this._executionCount++,this._options.onExecute(this))}cancel(){this._timeoutId&&(clearTimeout(this._timeoutId),this._canLeadingExecute=!0,this._isPending=!1)}getExecutionCount(){return this._executionCount}getIsPending(){return this._options.enabled&&this._isPending}}function a(e,r){let[a,n]=(0,t.useState)(e),s=function(e,r){let[a]=(0,t.useState)(()=>{var t;return Object.getOwnPropertyNames(Object.getPrototypeOf(t=new i(e,r))).filter(e=>"function"==typeof t[e]).reduce((e,r)=>{let i=t[r];return"function"==typeof i&&(e[r]=i.bind(t)),e},{})});return a.setOptions(r),a}(n,r);return[a,s.maybeExecute,s]}e.s(["useDebouncedState",()=>a],152473)},78085,e=>{"use strict";var t=e.i(290571),r=e.i(103471),i=e.i(888288),a=e.i(271645),n=e.i(444755),s=e.i(673706);let o=(0,s.makeClassName)("Textarea"),l=a.default.forwardRef((e,l)=>{let{value:u,defaultValue:c="",placeholder:d="Type...",error:h=!1,errorMessage:m,disabled:f=!1,className:p,onChange:g,onValueChange:y,autoHeight:v=!1}=e,b=(0,t.__rest)(e,["value","defaultValue","placeholder","error","errorMessage","disabled","className","onChange","onValueChange","autoHeight"]),[w,x]=(0,i.default)(c,u),C=(0,a.useRef)(null),S=(0,r.hasValue)(w);return(0,a.useEffect)(()=>{let e=C.current;if(v&&e){e.style.height="60px";let t=e.scrollHeight;e.style.height=t+"px"}},[v,C,w]),a.default.createElement(a.default.Fragment,null,a.default.createElement("textarea",Object.assign({ref:(0,s.mergeRefs)([C,l]),value:w,placeholder:d,disabled:f,className:(0,n.tremorTwMerge)(o("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,r.getSelectButtonColors)(S,f,h),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==y||y(e.target.value)}},b)),h&&m?a.default.createElement("p",{className:(0,n.tremorTwMerge)(o("errorMessage"),"text-sm text-red-500 mt-1")},m):null)});l.displayName="Textarea",e.s(["Textarea",()=>l],78085)},114600,e=>{"use strict";var t=e.i(290571),r=e.i(444755),i=e.i(673706),a=e.i(271645);let n=(0,i.makeClassName)("Divider"),s=a.default.forwardRef((e,i)=>{let{className:s,children:o}=e,l=(0,t.__rest)(e,["className","children"]);return a.default.createElement("div",Object.assign({ref:i,className:(0,r.tremorTwMerge)(n("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",s)},l),o?a.default.createElement(a.default.Fragment,null,a.default.createElement("div",{className:(0,r.tremorTwMerge)("w-full h-[1px] bg-tremor-border dark:bg-dark-tremor-border")}),a.default.createElement("div",{className:(0,r.tremorTwMerge)("text-inherit whitespace-nowrap")},o),a.default.createElement("div",{className:(0,r.tremorTwMerge)("w-full h-[1px] bg-tremor-border dark:bg-dark-tremor-border")})):a.default.createElement("div",{className:(0,r.tremorTwMerge)("w-full h-[1px] bg-tremor-border dark:bg-dark-tremor-border")}))});s.displayName="Divider",e.s(["Divider",()=>s],114600)},367240,54943,555436,e=>{"use strict";var t=e.i(475254);let r=(0,t.default)("rotate-ccw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);e.s(["RotateCcw",()=>r],367240);let i=(0,t.default)("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]);e.s(["default",()=>i],54943),e.s(["Search",()=>i],555436)},655913,38419,78334,e=>{"use strict";var t=e.i(843476),r=e.i(115504),i=e.i(311451),a=e.i(374009),n=e.i(271645);e.s(["FilterInput",0,({placeholder:e,value:s,onChange:o,icon:l,className:u})=>{let[c,d]=(0,n.useState)(s);(0,n.useEffect)(()=>{d(s)},[s]);let h=(0,n.useMemo)(()=>(0,a.default)(e=>o(e),300),[o]);(0,n.useEffect)(()=>()=>{h.cancel()},[h]);let m=(0,n.useCallback)(e=>{let t=e.target.value;d(t),h(t)},[h]);return(0,t.jsx)(i.Input,{placeholder:e,value:c,onChange:m,prefix:l?(0,t.jsx)(l,{size:16,className:"text-gray-500"}):void 0,className:(0,r.cx)("w-64",u)})}],655913);var s=e.i(906579),o=e.i(464571);let l=(0,e.i(475254).default)("funnel",[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]]);e.s(["FiltersButton",0,({onClick:e,active:r,hasActiveFilters:i,label:a="Filters"})=>(0,t.jsx)(s.Badge,{color:"blue",dot:i,children:(0,t.jsx)(o.Button,{type:"default",onClick:e,icon:(0,t.jsx)(l,{size:16}),className:r?"bg-gray-100":"",children:a})})],38419);var u=e.i(367240);e.s(["ResetFiltersButton",0,({onClick:e,label:r="Reset Filters"})=>(0,t.jsx)(o.Button,{type:"default",onClick:e,icon:(0,t.jsx)(u.RotateCcw,{size:16}),children:r})],78334)},846753,e=>{"use strict";let t=(0,e.i(475254).default)("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"}]]);e.s(["default",()=>t])},284614,e=>{"use strict";var t=e.i(846753);e.s(["User",()=>t.default])},757440,e=>{"use strict";var t=e.i(290571),r=e.i(271645);let i=e=>{var i=(0,t.__rest)(e,[]);return r.default.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},i),r.default.createElement("path",{d:"M11.9999 13.1714L16.9497 8.22168L18.3639 9.63589L11.9999 15.9999L5.63599 9.63589L7.0502 8.22168L11.9999 13.1714Z"}))};e.s(["default",()=>i])},446428,854056,e=>{"use strict";let t;var r=e.i(290571),i=e.i(271645);let a=e=>{var t=(0,r.__rest)(e,[]);return i.default.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),i.default.createElement("path",{d:"M12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22ZM12 10.5858L9.17157 7.75736L7.75736 9.17157L10.5858 12L7.75736 14.8284L9.17157 16.2426L12 13.4142L14.8284 16.2426L16.2426 14.8284L13.4142 12L16.2426 9.17157L14.8284 7.75736L12 10.5858Z"}))};e.s(["default",()=>a],446428);var n=e.i(746725),s=e.i(914189),o=e.i(553521),l=e.i(835696),u=e.i(941444),c=e.i(178677),d=e.i(294316),h=e.i(83733),m=e.i(233137),f=e.i(732607),p=e.i(397701),g=e.i(700020);function y(e){var t;return!!(e.enter||e.enterFrom||e.enterTo||e.leave||e.leaveFrom||e.leaveTo)||(null!=(t=e.as)?t:S)!==i.Fragment||1===i.default.Children.count(e.children)}let v=(0,i.createContext)(null);v.displayName="TransitionContext";var b=((t=b||{}).Visible="visible",t.Hidden="hidden",t);let w=(0,i.createContext)(null);function x(e){return"children"in e?x(e.children):e.current.filter(({el:e})=>null!==e.current).filter(({state:e})=>"visible"===e).length>0}function C(e,t){let r=(0,u.useLatestValue)(e),a=(0,i.useRef)([]),l=(0,o.useIsMounted)(),c=(0,n.useDisposables)(),d=(0,s.useEvent)((e,t=g.RenderStrategy.Hidden)=>{let i=a.current.findIndex(({el:t})=>t===e);-1!==i&&((0,p.match)(t,{[g.RenderStrategy.Unmount](){a.current.splice(i,1)},[g.RenderStrategy.Hidden](){a.current[i].state="hidden"}}),c.microTask(()=>{var e;!x(a)&&l.current&&(null==(e=r.current)||e.call(r))}))}),h=(0,s.useEvent)(e=>{let t=a.current.find(({el:t})=>t===e);return t?"visible"!==t.state&&(t.state="visible"):a.current.push({el:e,state:"visible"}),()=>d(e,g.RenderStrategy.Unmount)}),m=(0,i.useRef)([]),f=(0,i.useRef)(Promise.resolve()),y=(0,i.useRef)({enter:[],leave:[]}),v=(0,s.useEvent)((e,r,i)=>{m.current.splice(0),t&&(t.chains.current[r]=t.chains.current[r].filter(([t])=>t!==e)),null==t||t.chains.current[r].push([e,new Promise(e=>{m.current.push(e)})]),null==t||t.chains.current[r].push([e,new Promise(e=>{Promise.all(y.current[r].map(([e,t])=>t)).then(()=>e())})]),"enter"===r?f.current=f.current.then(()=>null==t?void 0:t.wait.current).then(()=>i(r)):i(r)}),b=(0,s.useEvent)((e,t,r)=>{Promise.all(y.current[t].splice(0).map(([e,t])=>t)).then(()=>{var e;null==(e=m.current.shift())||e()}).then(()=>r(t))});return(0,i.useMemo)(()=>({children:a,register:h,unregister:d,onStart:v,onStop:b,wait:f,chains:y}),[h,d,a,v,b,y,f])}w.displayName="NestingContext";let S=i.Fragment,E=g.RenderFeatures.RenderStrategy,M=(0,g.forwardRefWithAs)(function(e,t){let{show:r,appear:a=!1,unmount:n=!0,...o}=e,u=(0,i.useRef)(null),h=y(e),f=(0,d.useSyncRefs)(...h?[u,t]:null===t?[]:[t]);(0,c.useServerHandoffComplete)();let p=(0,m.useOpenClosed)();if(void 0===r&&null!==p&&(r=(p&m.State.Open)===m.State.Open),void 0===r)throw Error("A is used but it is missing a `show={true | false}` prop.");let[b,S]=(0,i.useState)(r?"visible":"hidden"),M=C(()=>{r||S("hidden")}),[O,T]=(0,i.useState)(!0),P=(0,i.useRef)([r]);(0,l.useIsoMorphicEffect)(()=>{!1!==O&&P.current[P.current.length-1]!==r&&(P.current.push(r),T(!1))},[P,r]);let N=(0,i.useMemo)(()=>({show:r,appear:a,initial:O}),[r,a,O]);(0,l.useIsoMorphicEffect)(()=>{r?S("visible"):x(M)||null===u.current||S("hidden")},[r,M]);let q={unmount:n},D=(0,s.useEvent)(()=>{var t;O&&T(!1),null==(t=e.beforeEnter)||t.call(e)}),$=(0,s.useEvent)(()=>{var t;O&&T(!1),null==(t=e.beforeLeave)||t.call(e)}),I=(0,g.useRender)();return i.default.createElement(w.Provider,{value:M},i.default.createElement(v.Provider,{value:N},I({ourProps:{...q,as:i.Fragment,children:i.default.createElement(k,{ref:f,...q,...o,beforeEnter:D,beforeLeave:$})},theirProps:{},defaultTag:i.Fragment,features:E,visible:"visible"===b,name:"Transition"})))}),k=(0,g.forwardRefWithAs)(function(e,t){var r,a;let{transition:n=!0,beforeEnter:o,afterEnter:u,beforeLeave:b,afterLeave:M,enter:k,enterFrom:O,enterTo:T,entered:P,leave:N,leaveFrom:q,leaveTo:D,...$}=e,[I,R]=(0,i.useState)(null),L=(0,i.useRef)(null),F=y(e),j=(0,d.useSyncRefs)(...F?[L,t,R]:null===t?[]:[t]),_=null==(r=$.unmount)||r?g.RenderStrategy.Unmount:g.RenderStrategy.Hidden,{show:Q,appear:A,initial:z}=function(){let e=(0,i.useContext)(v);if(null===e)throw Error("A is used but it is missing a parent or .");return e}(),[B,H]=(0,i.useState)(Q?"visible":"hidden"),K=function(){let e=(0,i.useContext)(w);if(null===e)throw Error("A is used but it is missing a parent or .");return e}(),{register:V,unregister:G}=K;(0,l.useIsoMorphicEffect)(()=>V(L),[V,L]),(0,l.useIsoMorphicEffect)(()=>{if(_===g.RenderStrategy.Hidden&&L.current)return Q&&"visible"!==B?void H("visible"):(0,p.match)(B,{hidden:()=>G(L),visible:()=>V(L)})},[B,L,V,G,Q,_]);let X=(0,c.useServerHandoffComplete)();(0,l.useIsoMorphicEffect)(()=>{if(F&&X&&"visible"===B&&null===L.current)throw Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[L,B,X,F]);let U=z&&!A,W=A&&Q&&z,Z=(0,i.useRef)(!1),J=C(()=>{Z.current||(H("hidden"),G(L))},K),Y=(0,s.useEvent)(e=>{Z.current=!0,J.onStart(L,e?"enter":"leave",e=>{"enter"===e?null==o||o():"leave"===e&&(null==b||b())})}),ee=(0,s.useEvent)(e=>{let t=e?"enter":"leave";Z.current=!1,J.onStop(L,t,e=>{"enter"===e?null==u||u():"leave"===e&&(null==M||M())}),"leave"!==t||x(J)||(H("hidden"),G(L))});(0,i.useEffect)(()=>{F&&n||(Y(Q),ee(Q))},[Q,F,n]);let et=!(!n||!F||!X||U),[,er]=(0,h.useTransition)(et,I,Q,{start:Y,end:ee}),ei=(0,g.compact)({ref:j,className:(null==(a=(0,f.classNames)($.className,W&&k,W&&O,er.enter&&k,er.enter&&er.closed&&O,er.enter&&!er.closed&&T,er.leave&&N,er.leave&&!er.closed&&q,er.leave&&er.closed&&D,!er.transition&&Q&&P))?void 0:a.trim())||void 0,...(0,h.transitionDataAttributes)(er)}),ea=0;"visible"===B&&(ea|=m.State.Open),"hidden"===B&&(ea|=m.State.Closed),er.enter&&(ea|=m.State.Opening),er.leave&&(ea|=m.State.Closing);let en=(0,g.useRender)();return i.default.createElement(w.Provider,{value:J},i.default.createElement(m.OpenClosedProvider,{value:ea},en({ourProps:ei,theirProps:$,defaultTag:S,features:E,visible:"visible"===B,name:"Transition.Child"})))}),O=(0,g.forwardRefWithAs)(function(e,t){let r=null!==(0,i.useContext)(v),a=null!==(0,m.useOpenClosed)();return i.default.createElement(i.default.Fragment,null,!r&&a?i.default.createElement(M,{ref:t,...e}):i.default.createElement(k,{ref:t,...e}))}),T=Object.assign(M,{Child:O,Root:M});e.s(["Transition",()=>T],854056)},206929,e=>{"use strict";var t=e.i(290571),r=e.i(757440),i=e.i(271645),a=e.i(446428),n=e.i(444755),s=e.i(673706),o=e.i(103471),l=e.i(495470),u=e.i(854056),c=e.i(888288);let d=(0,s.makeClassName)("Select"),h=i.default.forwardRef((e,s)=>{let{defaultValue:h="",value:m,onValueChange:f,placeholder:p="Select...",disabled:g=!1,icon:y,enableClear:v=!1,required:b,children:w,name:x,error:C=!1,errorMessage:S,className:E,id:M}=e,k=(0,t.__rest)(e,["defaultValue","value","onValueChange","placeholder","disabled","icon","enableClear","required","children","name","error","errorMessage","className","id"]),O=(0,i.useRef)(null),T=i.Children.toArray(w),[P,N]=(0,c.default)(h,m),q=(0,i.useMemo)(()=>{let e=i.default.Children.toArray(w).filter(i.isValidElement);return(0,o.constructValueToNameMapping)(e)},[w]);return i.default.createElement("div",{className:(0,n.tremorTwMerge)("w-full min-w-[10rem] text-tremor-default",E)},i.default.createElement("div",{className:"relative"},i.default.createElement("select",{title:"select-hidden",required:b,className:(0,n.tremorTwMerge)("h-full w-full absolute left-0 top-0 -z-10 opacity-0"),value:P,onChange:e=>{e.preventDefault()},name:x,disabled:g,id:M,onFocus:()=>{let e=O.current;e&&e.focus()}},i.default.createElement("option",{className:"hidden",value:"",disabled:!0,hidden:!0},p),T.map(e=>{let t=e.props.value,r=e.props.children;return i.default.createElement("option",{className:"hidden",key:t,value:t},r)})),i.default.createElement(l.Listbox,Object.assign({as:"div",ref:s,defaultValue:P,value:P,onChange:e=>{null==f||f(e),N(e)},disabled:g,id:M},k),({value:e})=>{var t;return i.default.createElement(i.default.Fragment,null,i.default.createElement(l.ListboxButton,{ref:O,className:(0,n.tremorTwMerge)("w-full outline-none text-left whitespace-nowrap truncate rounded-tremor-default focus:ring-2 transition duration-100 border pr-8 py-2","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-10":"pl-3",(0,o.getSelectButtonColors)((0,o.hasValue)(e),g,C))},y&&i.default.createElement("span",{className:(0,n.tremorTwMerge)("absolute inset-y-0 left-0 flex items-center ml-px pl-2.5")},i.default.createElement(y,{className:(0,n.tremorTwMerge)(d("Icon"),"flex-none h-5 w-5","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")})),i.default.createElement("span",{className:"w-[90%] block truncate"},e&&null!=(t=q.get(e))?t:p),i.default.createElement("span",{className:(0,n.tremorTwMerge)("absolute inset-y-0 right-0 flex items-center mr-3")},i.default.createElement(r.default,{className:(0,n.tremorTwMerge)(d("arrowDownIcon"),"flex-none h-5 w-5","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")}))),v&&P?i.default.createElement("button",{type:"button",className:(0,n.tremorTwMerge)("absolute inset-y-0 right-0 flex items-center mr-8"),onClick:e=>{e.preventDefault(),N(""),null==f||f("")}},i.default.createElement(a.default,{className:(0,n.tremorTwMerge)(d("clearIcon"),"flex-none h-4 w-4","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")})):null,i.default.createElement(u.Transition,{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"},i.default.createElement(l.ListboxOptions,{anchor:"bottom start",className:(0,n.tremorTwMerge)("z-10 w-[var(--button-width)] divide-y overflow-y-auto outline-none rounded-tremor-default max-h-[228px] border [--anchor-gap:4px]","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")},w)))})),C&&S?i.default.createElement("p",{className:(0,n.tremorTwMerge)("errorMessage","text-sm text-rose-500 mt-1")},S):null)});h.displayName="Select",e.s(["Select",()=>h],206929)},502275,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}))});e.s(["InformationCircleIcon",0,r],502275)},198134,e=>{"use strict";var t=e.i(843476),r=e.i(910119),i=e.i(135214),a=e.i(214541),n=e.i(271645),s=e.i(317751),o=e.i(912598);e.s(["default",0,()=>{let{accessToken:e,userRole:l,userId:u,token:c}=(0,i.default)(),[d,h]=(0,n.useState)([]),{teams:m}=(0,a.default)(),f=new s.QueryClient;return(0,t.jsx)(o.QueryClientProvider,{client:f,children:(0,t.jsx)(r.default,{accessToken:e,token:c,keys:d,userRole:l,userID:u,teams:m,setKeys:h})})}])}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/052676b05389fa51.js b/litellm/proxy/_experimental/out/_next/static/chunks/052676b05389fa51.js deleted file mode 100644 index cb9137c0039..00000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/052676b05389fa51.js +++ /dev/null @@ -1 +0,0 @@ -(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,988297,e=>{"use strict";var s=e.i(271645);let a=s.forwardRef(function(e,a){return s.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:a},e),s.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4v16m8-8H4"}))});e.s(["PlusIcon",0,a],988297)},500727,e=>{"use strict";var s=e.i(266027),a=e.i(243652),t=e.i(764205),l=e.i(135214);let r=(0,a.createQueryKeys)("mcpServers");e.s(["useMCPServers",0,()=>{let{accessToken:e}=(0,l.default)();return(0,s.useQuery)({queryKey:r.list({}),queryFn:async()=>await (0,t.fetchMCPServers)(e),enabled:!!e})}])},841947,e=>{"use strict";let s=(0,e.i(475254).default)("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);e.s(["default",()=>s])},916940,e=>{"use strict";var s=e.i(843476),a=e.i(271645),t=e.i(199133),l=e.i(764205);e.s(["default",0,({onChange:e,value:r,className:i,accessToken:n,placeholder:c="Select vector stores",disabled:o=!1})=>{let[d,u]=(0,a.useState)([]),[m,p]=(0,a.useState)(!1);return(0,a.useEffect)(()=>{(async()=>{if(n){p(!0);try{let e=await (0,l.vectorStoreListCall)(n);e.data&&u(e.data)}catch(e){console.error("Error fetching vector stores:",e)}finally{p(!1)}}})()},[n]),(0,s.jsx)("div",{children:(0,s.jsx)(t.Select,{mode:"multiple",placeholder:c,onChange:e,value:r,loading:m,className:i,allowClear:!0,options:d.map(e=>({label:`${e.vector_store_name||e.vector_store_id} (${e.vector_store_id})`,value:e.vector_store_id,title:e.vector_store_description||e.vector_store_id})),optionFilterProp:"label",showSearch:!0,style:{width:"100%"},disabled:o})})}])},797672,e=>{"use strict";var s=e.i(271645);let a=s.forwardRef(function(e,a){return s.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:a},e),s.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"}))});e.s(["PencilIcon",0,a],797672)},653496,e=>{"use strict";var s=e.i(721369);e.s(["Tabs",()=>s.default])},689020,e=>{"use strict";var s=e.i(764205);let a=async e=>{try{let a=await (0,s.modelHubCall)(e);if(console.log("model_info:",a),a?.data.length>0){let e=a.data.map(e=>({model_group:e.model_group,mode:e?.mode}));return e.sort((e,s)=>e.model_group.localeCompare(s.model_group)),e}return[]}catch(e){throw console.error("Error fetching model info:",e),e}};e.s(["fetchAvailableModels",0,a])},981339,e=>{"use strict";var s=e.i(185793);e.s(["Skeleton",()=>s.default])},500330,e=>{"use strict";var s=e.i(727749);function a(e,s){let a=structuredClone(e);for(let[e,t]of Object.entries(s))e in a&&(a[e]=t);return a}let t=(e,s=0,a=!1,t=!0)=>{if(null==e||!Number.isFinite(e)||0===e&&!t)return"-";let l={minimumFractionDigits:s,maximumFractionDigits:s};if(!a)return e.toLocaleString("en-US",l);let r=e<0?"-":"",i=Math.abs(e),n=i,c="";return i>=1e6?(n=i/1e6,c="M"):i>=1e3&&(n=i/1e3,c="K"),`${r}${n.toLocaleString("en-US",l)}${c}`},l=async(e,a="Copied to clipboard")=>{if(!e)return!1;if(!navigator||!navigator.clipboard||!navigator.clipboard.writeText)return r(e,a);try{return await navigator.clipboard.writeText(e),s.default.success(a),!0}catch(s){return console.error("Clipboard API failed: ",s),r(e,a)}},r=(e,a)=>{try{let t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.left="-999999px",t.style.top="-999999px",t.setAttribute("readonly",""),document.body.appendChild(t),t.focus(),t.select();let l=document.execCommand("copy");if(document.body.removeChild(t),l)return s.default.success(a),!0;throw Error("execCommand failed")}catch(e){return s.default.fromBackend("Failed to copy to clipboard"),console.error("Failed to copy: ",e),!1}};e.s(["copyToClipboard",0,l,"formatNumberWithCommas",0,t,"getSpendString",0,(e,s=6)=>{if(null==e||!Number.isFinite(e)||0===e)return"-";let a=t(e,s,!1,!1);if(0===Number(a.replace(/,/g,""))){let e=(1/10**s).toFixed(s);return`< $${e}`}return`$${a}`},"updateExistingKeys",()=>a])},557662,e=>{"use strict";let s="../ui/assets/logos/",a=[{id:"arize",displayName:"Arize",logo:`${s}arize.png`,supports_key_team_logging:!0,dynamic_params:{arize_api_key:"password",arize_space_id:"password"},description:"Arize Logging Integration"},{id:"braintrust",displayName:"Braintrust",logo:`${s}braintrust.png`,supports_key_team_logging:!1,dynamic_params:{braintrust_api_key:"password",braintrust_project_name:"text"},description:"Braintrust Logging Integration"},{id:"custom_callback_api",displayName:"Custom Callback API",logo:`${s}custom.svg`,supports_key_team_logging:!0,dynamic_params:{custom_callback_api_url:"text",custom_callback_api_headers:"text"},description:"Custom Callback API Logging Integration"},{id:"datadog",displayName:"Datadog",logo:`${s}datadog.png`,supports_key_team_logging:!1,dynamic_params:{dd_api_key:"password",dd_site:"text"},description:"Datadog Logging Integration"},{id:"lago",displayName:"Lago",logo:`${s}lago.svg`,supports_key_team_logging:!1,dynamic_params:{lago_api_url:"text",lago_api_key:"password"},description:"Lago Billing Logging Integration"},{id:"langfuse",displayName:"Langfuse",logo:`${s}langfuse.png`,supports_key_team_logging:!0,dynamic_params:{langfuse_public_key:"text",langfuse_secret_key:"password",langfuse_host:"text"},description:"Langfuse v2 Logging Integration"},{id:"langfuse_otel",displayName:"Langfuse OTEL",logo:`${s}langfuse.png`,supports_key_team_logging:!0,dynamic_params:{langfuse_public_key:"text",langfuse_secret_key:"password",langfuse_host:"text"},description:"Langfuse v3 OTEL Logging Integration"},{id:"langsmith",displayName:"LangSmith",logo:`${s}langsmith.png`,supports_key_team_logging:!0,dynamic_params:{langsmith_api_key:"password",langsmith_project:"text",langsmith_base_url:"text",langsmith_sampling_rate:"number"},description:"Langsmith Logging Integration"},{id:"openmeter",displayName:"OpenMeter",logo:`${s}openmeter.png`,supports_key_team_logging:!1,dynamic_params:{openmeter_api_key:"password",openmeter_base_url:"text"},description:"OpenMeter Logging Integration"},{id:"otel",displayName:"Open Telemetry",logo:`${s}otel.png`,supports_key_team_logging:!1,dynamic_params:{otel_endpoint:"text",otel_headers:"text"},description:"OpenTelemetry Logging Integration"},{id:"s3",displayName:"S3",logo:`${s}aws.svg`,supports_key_team_logging:!1,dynamic_params:{s3_bucket_name:"text",aws_access_key_id:"password",aws_secret_access_key:"password",aws_region:"text"},description:"S3 Bucket (AWS) Logging Integration"},{id:"SQS",displayName:"SQS",logo:`${s}aws.svg`,supports_key_team_logging:!1,dynamic_params:{sqs_queue_url:"text",aws_access_key_id:"password",aws_secret_access_key:"password",aws_region:"text"},description:"SQS Queue (AWS) Logging Integration"}],t=a.reduce((e,s)=>(e[s.displayName]=s,e),{}),l=a.reduce((e,s)=>(e[s.displayName]=s.id,e),{}),r=a.reduce((e,s)=>(e[s.id]=s.displayName,e),{});e.s(["callbackInfo",0,t,"callback_map",0,l,"mapDisplayToInternalNames",0,e=>e.map(e=>l[e]||e),"mapInternalToDisplayNames",0,e=>e.map(e=>r[e]||e),"reverse_callback_map",0,r])},810757,477386,e=>{"use strict";var s=e.i(271645);let a=s.forwardRef(function(e,a){return s.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:a},e),s.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),s.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}))});e.s(["CogIcon",0,a],810757);let t=s.forwardRef(function(e,a){return s.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:a},e),s.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M18.364 18.364A9 9 0 005.636 5.636m12.728 12.728A9 9 0 015.636 5.636m12.728 12.728L5.636 5.636"}))});e.s(["BanIcon",0,t],477386)},552130,e=>{"use strict";var s=e.i(843476),a=e.i(271645),t=e.i(199133),l=e.i(764205);e.s(["default",0,({onChange:e,value:r,className:i,accessToken:n,placeholder:c="Select agents",disabled:o=!1})=>{let[d,u]=(0,a.useState)([]),[m,p]=(0,a.useState)([]),[g,x]=(0,a.useState)(!1);(0,a.useEffect)(()=>{(async()=>{if(n){x(!0);try{let e=await (0,l.getAgentsList)(n),s=e?.agents||[];u(s);let a=new Set;s.forEach(e=>{let s=e.agent_access_groups;s&&Array.isArray(s)&&s.forEach(e=>a.add(e))}),p(Array.from(a))}catch(e){console.error("Error fetching agents:",e)}finally{x(!1)}}})()},[n]);let h=[...m.map(e=>({label:e,value:`group:${e}`,isAccessGroup:!0,searchText:`${e} Access Group`})),...d.map(e=>({label:`${e.agent_name||e.agent_id}`,value:e.agent_id,isAccessGroup:!1,searchText:`${e.agent_name||e.agent_id} ${e.agent_id} Agent`}))],f=[...r?.agents||[],...(r?.accessGroups||[]).map(e=>`group:${e}`)];return(0,s.jsx)("div",{children:(0,s.jsx)(t.Select,{mode:"multiple",placeholder:c,onChange:s=>{e({agents:s.filter(e=>!e.startsWith("group:")),accessGroups:s.filter(e=>e.startsWith("group:")).map(e=>e.replace("group:",""))})},value:f,loading:g,className:i,allowClear:!0,showSearch:!0,style:{width:"100%"},disabled:o,filterOption:(e,s)=>(h.find(e=>e.value===s?.value)?.searchText||"").toLowerCase().includes(e.toLowerCase()),children:h.map(e=>(0,s.jsx)(t.Select.Option,{value:e.value,label:e.label,children:(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[(0,s.jsx)("span",{style:{display:"inline-block",width:8,height:8,borderRadius:"50%",background:e.isAccessGroup?"#52c41a":"#722ed1",flexShrink:0}}),(0,s.jsx)("span",{style:{flex:1},children:e.label}),(0,s.jsx)("span",{style:{color:e.isAccessGroup?"#52c41a":"#722ed1",fontSize:"12px",fontWeight:500,opacity:.8},children:e.isAccessGroup?"Access Group":"Agent"})]})},e.value))})})}])},9314,263147,e=>{"use strict";var s=e.i(843476),a=e.i(199133),t=e.i(981339),l=e.i(645526),r=e.i(599724),i=e.i(266027),n=e.i(243652),c=e.i(764205),o=e.i(708347),d=e.i(135214);let u=(0,n.createQueryKeys)("accessGroups"),m=async e=>{let s=(0,c.getProxyBaseUrl)(),a=`${s}/v1/access_group`,t=await fetch(a,{method:"GET",headers:{[(0,c.getGlobalLitellmHeaderName)()]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!t.ok){let e=await t.json(),s=(0,c.deriveErrorMessage)(e);throw(0,c.handleError)(s),Error(s)}return t.json()},p=()=>{let{accessToken:e,userRole:s}=(0,d.default)();return(0,i.useQuery)({queryKey:u.list({}),queryFn:async()=>m(e),enabled:!!e&&o.all_admin_roles.includes(s||"")})};e.s(["accessGroupKeys",0,u,"useAccessGroups",0,p],263147),e.s(["default",0,({value:e,onChange:i,placeholder:n="Select access groups",disabled:c=!1,style:o,className:d,showLabel:u=!1,labelText:m="Access Group",allowClear:g=!0})=>{let{data:x,isLoading:h,isError:f}=p();if(h)return(0,s.jsxs)("div",{children:[u&&(0,s.jsxs)(r.Text,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,s.jsx)(l.TeamOutlined,{className:"mr-2"})," ",m]}),(0,s.jsx)(t.Skeleton.Input,{active:!0,block:!0,style:{height:32,...o}})]});let b=(x??[]).map(e=>({label:(0,s.jsxs)("span",{children:[(0,s.jsx)("span",{className:"font-medium",children:e.access_group_name})," ",(0,s.jsxs)("span",{className:"text-gray-400 text-xs",children:["(",e.access_group_id,")"]})]}),value:e.access_group_id,selectedLabel:e.access_group_name,searchText:`${e.access_group_name} ${e.access_group_id}`}));return(0,s.jsxs)("div",{children:[u&&(0,s.jsxs)(r.Text,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,s.jsx)(l.TeamOutlined,{className:"mr-2"})," ",m]}),(0,s.jsx)(a.Select,{mode:"multiple",value:e,placeholder:n,onChange:i,disabled:c,allowClear:g,showSearch:!0,style:{width:"100%",...o},className:`rounded-md ${d??""}`,notFoundContent:f?(0,s.jsx)("span",{className:"text-red-500",children:"Failed to load access groups"}):"No access groups found",filterOption:(e,s)=>(b.find(e=>e.value===s?.value)?.searchText??"").toLowerCase().includes(e.toLowerCase()),optionLabelProp:"selectedLabel",options:b.map(e=>({label:e.label,value:e.value,selectedLabel:e.selectedLabel}))})]})}],9314)},844565,e=>{"use strict";var s=e.i(843476),a=e.i(271645),t=e.i(199133),l=e.i(764205);e.s(["default",0,({onChange:e,value:r,className:i,accessToken:n,placeholder:c="Select pass through routes",disabled:o=!1,teamId:d})=>{let[u,m]=(0,a.useState)([]),[p,g]=(0,a.useState)(!1);return(0,a.useEffect)(()=>{(async()=>{if(n){g(!0);try{let e=await (0,l.getPassThroughEndpointsCall)(n,d);if(e.endpoints){let s=e.endpoints.flatMap(e=>{let s=e.path,a=e.methods;return a&&a.length>0?a.map(e=>({label:`${e} ${s}`,value:s})):[{label:s,value:s}]});m(s)}}catch(e){console.error("Error fetching pass through routes:",e)}finally{g(!1)}}})()},[n,d]),(0,s.jsx)(t.Select,{mode:"tags",placeholder:c,onChange:e,value:r,loading:p,className:i,allowClear:!0,options:u,optionFilterProp:"label",showSearch:!0,style:{width:"100%"},disabled:o})}])},75921,e=>{"use strict";var s=e.i(843476),a=e.i(266027),t=e.i(243652),l=e.i(764205),r=e.i(135214);let i=(0,t.createQueryKeys)("mcpAccessGroups");var n=e.i(500727),c=e.i(199133);e.s(["default",0,({onChange:e,value:t,className:o,accessToken:d,placeholder:u="Select MCP servers",disabled:m=!1})=>{let{data:p=[],isLoading:g}=(0,n.useMCPServers)(),{data:x=[],isLoading:h}=(()=>{let{accessToken:e}=(0,r.default)();return(0,a.useQuery)({queryKey:i.list({}),queryFn:async()=>await (0,l.fetchMCPAccessGroups)(e),enabled:!!e})})(),f=[...x.map(e=>({label:e,value:e,isAccessGroup:!0,searchText:`${e} Access Group`})),...p.map(e=>({label:`${e.server_name||e.server_id} (${e.server_id})`,value:e.server_id,isAccessGroup:!1,searchText:`${e.server_name||e.server_id} ${e.server_id} MCP Server`}))],b=[...t?.servers||[],...t?.accessGroups||[]];return(0,s.jsx)("div",{children:(0,s.jsx)(c.Select,{mode:"multiple",placeholder:u,onChange:s=>{e({servers:s.filter(e=>!x.includes(e)),accessGroups:s.filter(e=>x.includes(e))})},value:b,loading:g||h,className:o,allowClear:!0,showSearch:!0,style:{width:"100%"},disabled:m,filterOption:(e,s)=>(f.find(e=>e.value===s?.value)?.searchText||"").toLowerCase().includes(e.toLowerCase()),children:f.map(e=>(0,s.jsx)(c.Select.Option,{value:e.value,label:e.label,children:(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[(0,s.jsx)("span",{style:{display:"inline-block",width:8,height:8,borderRadius:"50%",background:e.isAccessGroup?"#52c41a":"#1890ff",flexShrink:0}}),(0,s.jsx)("span",{style:{flex:1},children:e.label}),(0,s.jsx)("span",{style:{color:e.isAccessGroup?"#52c41a":"#1890ff",fontSize:"12px",fontWeight:500,opacity:.8},children:e.isAccessGroup?"Access Group":"MCP Server"})]})},e.value))})})}],75921)},390605,995926,e=>{"use strict";var s=e.i(843476),a=e.i(271645),t=e.i(764205),l=e.i(599724),r=e.i(482725),i=e.i(536916),n=e.i(841947);e.s(["XIcon",()=>n.default],995926);var n=n,c=e.i(500727);e.s(["default",0,({accessToken:e,selectedServers:o,toolPermissions:d,onChange:u,disabled:m=!1})=>{let{data:p=[]}=(0,c.useMCPServers)(),[g,x]=(0,a.useState)({}),[h,f]=(0,a.useState)({}),[b,y]=(0,a.useState)({}),v=(0,a.useMemo)(()=>0===o.length?[]:p.filter(e=>o.includes(e.server_id)),[p,o]),_=async s=>{f(e=>({...e,[s]:!0})),y(e=>({...e,[s]:""}));try{let a=await (0,t.listMCPTools)(e,s);a.error?(y(e=>({...e,[s]:a.message||"Failed to fetch tools"})),x(e=>({...e,[s]:[]}))):x(e=>({...e,[s]:a.tools||[]}))}catch(e){console.error(`Error fetching tools for server ${s}:`,e),y(e=>({...e,[s]:"Failed to fetch tools"})),x(e=>({...e,[s]:[]}))}finally{f(e=>({...e,[s]:!1}))}};return((0,a.useEffect)(()=>{v.forEach(e=>{g[e.server_id]||h[e.server_id]||_(e.server_id)})},[v]),0===o.length)?null:(0,s.jsx)("div",{className:"space-y-4",children:v.map(e=>{let a=e.server_name||e.alias||e.server_id,t=g[e.server_id]||[],c=d[e.server_id]||[],o=h[e.server_id],p=b[e.server_id];return(0,s.jsxs)("div",{className:"border rounded-lg bg-gray-50",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between p-4 border-b bg-white rounded-t-lg",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(l.Text,{className:"font-semibold text-gray-900",children:a}),e.description&&(0,s.jsx)(l.Text,{className:"text-sm text-gray-500",children:e.description})]}),(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)("button",{type:"button",className:"text-sm text-blue-600 hover:text-blue-700 font-medium",onClick:()=>{var s;let a;return a=g[s=e.server_id]||[],void u({...d,[s]:a.map(e=>e.name)})},disabled:m||o,children:"Select All"}),(0,s.jsx)("button",{type:"button",className:"text-sm text-blue-600 hover:text-blue-700 font-medium",onClick:()=>{var s;return s=e.server_id,void u({...d,[s]:[]})},disabled:m||o,children:"Deselect All"}),(0,s.jsx)("button",{type:"button",className:"text-gray-400 hover:text-gray-600",onClick:()=>{},children:(0,s.jsx)(n.default,{className:"w-4 h-4"})})]})]}),(0,s.jsxs)("div",{className:"p-4",children:[(0,s.jsx)(l.Text,{className:"text-sm font-medium text-gray-700 mb-3",children:"Available Tools"}),o&&(0,s.jsxs)("div",{className:"flex items-center justify-center py-8",children:[(0,s.jsx)(r.Spin,{size:"large"}),(0,s.jsx)(l.Text,{className:"ml-3 text-gray-500",children:"Loading tools..."})]}),p&&!o&&(0,s.jsxs)("div",{className:"p-4 bg-red-50 border border-red-200 rounded-lg text-center",children:[(0,s.jsx)(l.Text,{className:"text-red-600 font-medium",children:"Unable to load tools"}),(0,s.jsx)(l.Text,{className:"text-sm text-red-500 mt-1",children:p})]}),!o&&!p&&t.length>0&&(0,s.jsx)("div",{className:"space-y-2",children:t.map(a=>{let t=c.includes(a.name);return(0,s.jsxs)("div",{className:"flex items-start gap-2",children:[(0,s.jsx)(i.Checkbox,{checked:t,onChange:()=>{var s,t;let l,r;return s=e.server_id,t=a.name,r=(l=d[s]||[]).includes(t)?l.filter(e=>e!==t):[...l,t],void u({...d,[s]:r})},disabled:m}),(0,s.jsx)("div",{className:"flex-1 min-w-0",children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(l.Text,{className:"font-medium text-gray-900",children:a.name}),(0,s.jsxs)(l.Text,{className:"text-sm text-gray-500",children:["- ",a.description||"No description"]})]})})]},a.name)})}),!o&&!p&&0===t.length&&(0,s.jsx)("div",{className:"text-center py-6",children:(0,s.jsx)(l.Text,{className:"text-gray-500",children:"No tools available"})})]})]},e.server_id)})})}],390605)},266484,e=>{"use strict";var s=e.i(843476),a=e.i(199133),t=e.i(592968),l=e.i(312361),r=e.i(827252),i=e.i(994388),n=e.i(304967),c=e.i(779241),o=e.i(988297),d=e.i(68155),u=e.i(810757),m=e.i(477386),p=e.i(557662),g=e.i(435451);let{Option:x}=a.Select;e.s(["default",0,({value:e=[],onChange:h,disabledCallbacks:f=[],onDisabledCallbacksChange:b})=>{let y=Object.entries(p.callbackInfo).filter(([e,s])=>s.supports_key_team_logging).map(([e,s])=>e),v=Object.keys(p.callbackInfo),_=e=>{h?.(e)},j=(s,a,t)=>{let l=[...e];if("callback_name"===a){let e=p.callback_map[t]||t;l[s]={...l[s],[a]:e,callback_vars:{}}}else l[s]={...l[s],[a]:t};_(l)},N=(s,a,t)=>{let l=[...e];l[s]={...l[s],callback_vars:{...l[s].callback_vars,[a]:t}},_(l)};return(0,s.jsxs)("div",{className:"space-y-6",children:[(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)(m.BanIcon,{className:"w-5 h-5 text-red-500"}),(0,s.jsx)("span",{className:"text-base font-semibold text-gray-800",children:"Disabled Callbacks"}),(0,s.jsx)(t.Tooltip,{title:"Select callbacks to disable for this key. Disabled callbacks will not receive any logging data.",children:(0,s.jsx)(r.InfoCircleOutlined,{className:"text-gray-400 cursor-help"})})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Disabled Callbacks"}),(0,s.jsx)(a.Select,{mode:"multiple",placeholder:"Select callbacks to disable",value:f,onChange:e=>{let s=(0,p.mapDisplayToInternalNames)(e);b?.(s)},style:{width:"100%"},optionLabelProp:"label",children:v.map(e=>{let a=p.callbackInfo[e]?.logo,l=p.callbackInfo[e]?.description;return(0,s.jsx)(x,{value:e,label:e,children:(0,s.jsx)(t.Tooltip,{title:l,placement:"right",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[a&&(0,s.jsx)("img",{src:a,alt:e,className:"w-4 h-4 object-contain",onError:s=>{let a=s.target,t=a.parentElement;if(t){let s=document.createElement("div");s.className="w-4 h-4 rounded-full bg-gray-200 flex items-center justify-center text-xs",s.textContent=e.charAt(0),t.replaceChild(s,a)}}}),(0,s.jsx)("span",{children:e})]})})},e)})}),(0,s.jsx)("div",{className:"text-xs text-gray-500",children:"Select callbacks that should be disabled for this key. These callbacks will not receive any logging data."})]})]}),(0,s.jsx)(l.Divider,{}),(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)(u.CogIcon,{className:"w-5 h-5 text-blue-500"}),(0,s.jsx)("span",{className:"text-base font-semibold text-gray-800",children:"Logging Integrations"}),(0,s.jsx)(t.Tooltip,{title:"Configure callback logging integrations for this team.",children:(0,s.jsx)(r.InfoCircleOutlined,{className:"text-gray-400 cursor-help"})})]}),(0,s.jsx)(i.Button,{variant:"secondary",onClick:()=>{_([...e,{callback_name:"",callback_type:"success",callback_vars:{}}])},icon:o.PlusIcon,size:"sm",className:"hover:border-blue-400 hover:text-blue-500",type:"button",children:"Add Integration"})]}),(0,s.jsx)("div",{className:"space-y-4",children:e.map((l,o)=>{let u=l.callback_name?Object.entries(p.callback_map).find(([e,s])=>s===l.callback_name)?.[0]:void 0,m=u?p.callbackInfo[u]?.logo:null;return(0,s.jsxs)(n.Card,{className:"border border-gray-200 shadow-sm hover:shadow-md transition-shadow duration-200",decoration:"top",decorationColor:"blue",children:[(0,s.jsxs)("div",{className:"flex justify-between items-start mb-4",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[m&&(0,s.jsx)("img",{src:m,alt:u,className:"w-5 h-5 object-contain"}),(0,s.jsxs)("span",{className:"text-sm font-medium",children:[u||"New Integration"," Configuration"]})]}),(0,s.jsx)(i.Button,{variant:"light",onClick:()=>{_(e.filter((e,s)=>s!==o))},icon:d.TrashIcon,size:"xs",color:"red",className:"hover:bg-red-50",type:"button",children:"Remove"})]}),(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Integration Type"}),(0,s.jsx)(a.Select,{value:u,placeholder:"Select integration",onChange:e=>j(o,"callback_name",e),className:"w-full",optionLabelProp:"label",children:y.map(e=>{let a=p.callbackInfo[e]?.logo,l=p.callbackInfo[e]?.description;return(0,s.jsx)(x,{value:e,label:e,children:(0,s.jsx)(t.Tooltip,{title:l,placement:"right",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[a&&(0,s.jsx)("img",{src:a,alt:e,className:"w-4 h-4 object-contain",onError:s=>{let a=s.target,t=a.parentElement;if(t){let s=document.createElement("div");s.className="w-4 h-4 rounded-full bg-gray-200 flex items-center justify-center text-xs",s.textContent=e.charAt(0),t.replaceChild(s,a)}}}),(0,s.jsx)("span",{children:e})]})})},e)})})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Event Type"}),(0,s.jsxs)(a.Select,{value:l.callback_type,onChange:e=>j(o,"callback_type",e),className:"w-full",children:[(0,s.jsx)(x,{value:"success",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),(0,s.jsx)("span",{children:"Success Only"})]})}),(0,s.jsx)(x,{value:"failure",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-red-500 rounded-full"}),(0,s.jsx)("span",{children:"Failure Only"})]})}),(0,s.jsx)(x,{value:"success_and_failure",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-blue-500 rounded-full"}),(0,s.jsx)("span",{children:"Success & Failure"})]})})]})]})]}),((e,a)=>{if(!e.callback_name)return null;let l=Object.entries(p.callback_map).find(([s,a])=>a===e.callback_name)?.[0];if(!l)return null;let i=p.callbackInfo[l]?.dynamic_params||{};return 0===Object.keys(i).length?null:(0,s.jsxs)("div",{className:"mt-6 pt-4 border-t border-gray-100",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2 mb-4",children:[(0,s.jsx)("div",{className:"w-3 h-3 bg-blue-100 rounded-full flex items-center justify-center",children:(0,s.jsx)("div",{className:"w-1.5 h-1.5 bg-blue-500 rounded-full"})}),(0,s.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Integration Parameters"})]}),(0,s.jsx)("div",{className:"grid grid-cols-1 gap-4",children:Object.entries(i).map(([l,i])=>(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)("label",{className:"text-sm font-medium text-gray-700 capitalize flex items-center space-x-1",children:[(0,s.jsx)("span",{children:l.replace(/_/g," ")}),(0,s.jsx)(t.Tooltip,{title:`Environment variable reference recommended: os.environ/${l.toUpperCase()}`,children:(0,s.jsx)(r.InfoCircleOutlined,{className:"text-gray-400 cursor-help text-xs"})}),"password"===i&&(0,s.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-yellow-100 text-yellow-800",children:"Sensitive"}),"number"===i&&(0,s.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-yellow-100 text-yellow-800",children:"Number"})]}),"number"===i&&(0,s.jsx)("span",{className:"text-xs text-gray-500",children:"Value must be between 0 and 1"}),"number"===i?(0,s.jsx)(g.default,{step:.01,width:400,placeholder:`os.environ/${l.toUpperCase()}`,value:e.callback_vars[l]||"",onChange:e=>N(a,l,e.target.value)}):(0,s.jsx)(c.TextInput,{type:"password"===i?"password":"text",placeholder:`os.environ/${l.toUpperCase()}`,value:e.callback_vars[l]||"",onChange:e=>N(a,l,e.target.value)})]},l))})]})})(l,o)]})]},o)})}),0===e.length&&(0,s.jsxs)("div",{className:"text-center py-12 text-gray-500 border-2 border-dashed border-gray-200 rounded-lg bg-gray-50/50",children:[(0,s.jsx)(u.CogIcon,{className:"w-12 h-12 text-gray-300 mb-3 mx-auto"}),(0,s.jsx)("div",{className:"text-base font-medium mb-1",children:"No logging integrations configured"}),(0,s.jsx)("div",{className:"text-sm text-gray-400",children:'Click "Add Integration" to configure logging for this team'})]})]})}])}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/056b4991f668b494.js b/litellm/proxy/_experimental/out/_next/static/chunks/056b4991f668b494.js new file mode 100644 index 00000000000..3ee19c75340 --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/056b4991f668b494.js @@ -0,0 +1 @@ +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,233525,(e,c,u)=>{"use strict";Object.defineProperty(u,"__esModule",{value:!0}),Object.defineProperty(u,"warnOnce",{enumerable:!0,get:function(){return r}});let r=e=>{}},349356,e=>{e.v({AElig:"Æ",AMP:"&",Aacute:"Á",Acirc:"Â",Agrave:"À",Aring:"Å",Atilde:"Ã",Auml:"Ä",COPY:"©",Ccedil:"Ç",ETH:"Ð",Eacute:"É",Ecirc:"Ê",Egrave:"È",Euml:"Ë",GT:">",Iacute:"Í",Icirc:"Î",Igrave:"Ì",Iuml:"Ï",LT:"<",Ntilde:"Ñ",Oacute:"Ó",Ocirc:"Ô",Ograve:"Ò",Oslash:"Ø",Otilde:"Õ",Ouml:"Ö",QUOT:'"',REG:"®",THORN:"Þ",Uacute:"Ú",Ucirc:"Û",Ugrave:"Ù",Uuml:"Ü",Yacute:"Ý",aacute:"á",acirc:"â",acute:"´",aelig:"æ",agrave:"à",amp:"&",aring:"å",atilde:"ã",auml:"ä",brvbar:"¦",ccedil:"ç",cedil:"¸",cent:"¢",copy:"©",curren:"¤",deg:"°",divide:"÷",eacute:"é",ecirc:"ê",egrave:"è",eth:"ð",euml:"ë",frac12:"½",frac14:"¼",frac34:"¾",gt:">",iacute:"í",icirc:"î",iexcl:"¡",igrave:"ì",iquest:"¿",iuml:"ï",laquo:"«",lt:"<",macr:"¯",micro:"µ",middot:"·",nbsp:" ",not:"¬",ntilde:"ñ",oacute:"ó",ocirc:"ô",ograve:"ò",ordf:"ª",ordm:"º",oslash:"ø",otilde:"õ",ouml:"ö",para:"¶",plusmn:"±",pound:"£",quot:'"',raquo:"»",reg:"®",sect:"§",shy:"­",sup1:"¹",sup2:"²",sup3:"³",szlig:"ß",thorn:"þ",times:"×",uacute:"ú",ucirc:"û",ugrave:"ù",uml:"¨",uuml:"ü",yacute:"ý",yen:"¥",yuml:"ÿ"})},137429,e=>{e.v({0:"�",128:"€",130:"‚",131:"ƒ",132:"„",133:"…",134:"†",135:"‡",136:"ˆ",137:"‰",138:"Š",139:"‹",140:"Œ",142:"Ž",145:"‘",146:"’",147:"“",148:"”",149:"•",150:"–",151:"—",152:"˜",153:"™",154:"š",155:"›",156:"œ",158:"ž",159:"Ÿ"})},928685,e=>{"use strict";var c=e.i(38953);e.s(["SearchOutlined",()=>c.default])},86408,e=>{"use strict";var c=e.i(843476),u=e.i(271645),r=e.i(618566),t=e.i(934879);function a(){let e=(0,r.useSearchParams)().get("key"),[a,i]=(0,u.useState)(null);return console.log("PublicModelHubTable accessToken:",a),(0,u.useEffect)(()=>{e&&i(e)},[e]),(0,c.jsx)(t.default,{accessToken:a,publicPage:!0,premiumUser:!1,userRole:null})}function i(){return(0,c.jsx)(u.Suspense,{fallback:(0,c.jsx)("div",{className:"flex items-center justify-center min-h-screen",children:"Loading..."}),children:(0,c.jsx)(a,{})})}e.s(["default",()=>i])}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/99be180c22b927f8.js b/litellm/proxy/_experimental/out/_next/static/chunks/066f513556b1bb0b.js similarity index 57% rename from litellm/proxy/_experimental/out/_next/static/chunks/99be180c22b927f8.js rename to litellm/proxy/_experimental/out/_next/static/chunks/066f513556b1bb0b.js index 15be99fa3d9..d4952ece733 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/99be180c22b927f8.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/066f513556b1bb0b.js @@ -155,7 +155,7 @@ main();`}})())},[d,p,u,e,l,n]),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(r.Butt "required": ["location"] } } -}`,eo=({visible:e,initialJson:r,onSave:l,onClose:n})=>{let[o,i]=(0,s.useState)(r||en),[c,d]=(0,s.useState)(null),m=()=>{d(null),n()};return(0,t.jsx)(a.Modal,{title:(0,t.jsx)("div",{className:"flex items-center justify-between",children:(0,t.jsx)("span",{className:"text-lg font-medium",children:"Add Tool"})}),open:e,onCancel:m,width:800,footer:[(0,t.jsx)(z.Button,{onClick:m,children:"Cancel"},"cancel"),(0,t.jsx)(z.Button,{type:"primary",onClick:()=>{try{JSON.parse(o),d(null),l(o)}catch(e){d("Invalid JSON format. Please check your syntax.")}},children:"Add"},"save")],children:(0,t.jsxs)("div",{className:"space-y-3",children:[c&&(0,t.jsx)("div",{className:"p-3 bg-red-50 border border-red-200 rounded text-red-600 text-sm",children:c}),(0,t.jsx)("textarea",{value:o,onChange:e=>i(e.target.value),className:"w-full min-h-[400px] px-4 py-3 border border-gray-300 rounded-lg text-sm font-mono focus:outline-none focus:ring-2 focus:ring-blue-500 resize-none",placeholder:"Paste your tool JSON here..."})]})})};var ei=e.i(311451),ec=e.i(475254);let ed=(0,ec.default)("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);e.s(["default",()=>ed],180127),e.s(["ArrowLeftIcon",()=>ed],516430);let em=(0,ec.default)("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]),ep=(0,ec.default)("clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]),ex=({promptName:e,onNameChange:s,onBack:a,onSave:l,isSaving:n,editMode:o=!1,onShowHistory:i,version:c,promptModel:d="gpt-4o",promptVariables:m={},accessToken:p,proxySettings:x})=>(0,t.jsxs)("div",{className:"bg-white border-b border-gray-200 px-6 py-3 flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-3",children:[(0,t.jsx)(r.Button,{icon:ed,variant:"light",onClick:a,size:"xs",children:"Back"}),(0,t.jsx)(ei.Input,{value:e,onChange:e=>s(e.target.value),className:"text-base font-medium border-none shadow-none",style:{width:"200px"}}),c&&(0,t.jsx)("span",{className:"px-2 py-0.5 text-xs bg-blue-100 text-blue-700 rounded font-medium",children:c}),(0,t.jsx)("span",{className:"px-2 py-0.5 text-xs bg-gray-100 text-gray-600 rounded",children:"Draft"}),(0,t.jsx)("span",{className:"text-xs text-gray-400",children:"Unsaved changes"})]}),(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)(Y,{promptId:e,model:d,promptVariables:m,accessToken:p,version:c?.replace("v","")||"1",proxySettings:x}),o&&i&&(0,t.jsx)(r.Button,{icon:ep,variant:"secondary",onClick:i,children:"History"}),(0,t.jsx)(r.Button,{icon:em,onClick:l,loading:n,disabled:n,children:o?"Update":"Save"})]})]});var eu=e.i(903446),eu=eu,eh=e.i(992619);let eg=({model:e,temperature:r=1,maxTokens:a=1e3,accessToken:l,onModelChange:n,onTemperatureChange:o,onMaxTokensChange:i})=>{let[c,d]=(0,s.useState)(!1);return(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"w-[300px]",children:(0,t.jsx)(eh.default,{accessToken:l||"",value:e,onChange:n,showLabel:!1})}),(0,t.jsxs)("button",{onClick:()=>d(!c),className:"flex items-center gap-2 px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg hover:bg-gray-50",children:[(0,t.jsx)(eu.default,{size:16}),(0,t.jsx)("span",{children:"Parameters"})]}),c&&(0,t.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black bg-opacity-30",children:(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow-xl p-6 w-96",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,t.jsx)("h3",{className:"text-lg font-semibold",children:"Model Parameters"}),(0,t.jsx)("button",{onClick:()=>d(!1),className:"text-gray-400 hover:text-gray-600",children:"✕"})]}),(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)("div",{children:(0,t.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,t.jsx)(I.Text,{className:"text-sm text-gray-700",children:"Temperature"}),(0,t.jsx)(ei.Input,{type:"number",size:"small",min:0,max:2,step:.1,value:r,onChange:e=>o(parseFloat(e.target.value)||0),className:"w-20"})]})}),(0,t.jsx)("div",{children:(0,t.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,t.jsx)(I.Text,{className:"text-sm text-gray-700",children:"Max Tokens"}),(0,t.jsx)(ei.Input,{type:"number",size:"small",min:1,max:32768,value:a,onChange:e=>i(parseInt(e.target.value)||1e3),className:"w-24"})]})})]})]})})]})};var ef=e.i(603908),ef=ef;let ej=(0,ec.default)("trash",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}]]),ev=({tools:e,onAddTool:s,onEditTool:r,onRemoveTool:a})=>(0,t.jsxs)($.Card,{className:"p-3",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,t.jsx)(I.Text,{className:"text-sm font-medium",children:"Tools"}),(0,t.jsxs)("button",{onClick:s,className:"text-xs text-blue-600 hover:text-blue-700 flex items-center",children:[(0,t.jsx)(ef.default,{size:14,className:"mr-1"}),"Add"]})]}),0===e.length?(0,t.jsx)(I.Text,{className:"text-gray-500 text-xs",children:"No tools added"}):(0,t.jsx)("div",{className:"space-y-2",children:e.map((e,s)=>(0,t.jsxs)("div",{className:"flex items-center justify-between p-2 bg-gray-50 border border-gray-200 rounded",children:[(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("div",{className:"font-medium text-xs truncate",children:e.name}),(0,t.jsx)("div",{className:"text-xs text-gray-500 truncate",children:e.description})]}),(0,t.jsxs)("div",{className:"flex items-center space-x-1 ml-2",children:[(0,t.jsx)("button",{onClick:()=>r(s),className:"text-xs text-blue-600 hover:text-blue-700",children:"Edit"}),(0,t.jsx)("button",{onClick:()=>a(s),className:"text-gray-400 hover:text-red-500",children:(0,t.jsx)(ej,{size:14})})]})]},s))})]});var ey=e.i(282786),eb=e.i(262218),eN=e.i(751904);let{TextArea:ew}=ei.Input,eC=({value:e,onChange:r,placeholder:a,rows:l=4,className:n})=>{let[o,i]=(0,s.useState)(null),[c,d]=(0,s.useState)(""),m=()=>{c.trim()&&o&&(r(e.substring(0,o.start)+`{{${c}}}`+e.substring(o.end)),i(null),d(""))},p=(()=>{let t,s=/\{\{(\w+)\}\}/g,r=[];for(;null!==(t=s.exec(e));)r.push({name:t[1],start:t.index,end:t.index+t[0].length});return r})();return(0,t.jsxs)("div",{className:`variable-textarea-container ${n}`,children:[(0,t.jsx)("style",{children:` +}`,eo=({visible:e,initialJson:r,onSave:l,onClose:n})=>{let[o,i]=(0,s.useState)(r||en),[c,d]=(0,s.useState)(null),m=()=>{d(null),n()};return(0,t.jsx)(a.Modal,{title:(0,t.jsx)("div",{className:"flex items-center justify-between",children:(0,t.jsx)("span",{className:"text-lg font-medium",children:"Add Tool"})}),open:e,onCancel:m,width:800,footer:[(0,t.jsx)(z.Button,{onClick:m,children:"Cancel"},"cancel"),(0,t.jsx)(z.Button,{type:"primary",onClick:()=>{try{JSON.parse(o),d(null),l(o)}catch(e){d("Invalid JSON format. Please check your syntax.")}},children:"Add"},"save")],children:(0,t.jsxs)("div",{className:"space-y-3",children:[c&&(0,t.jsx)("div",{className:"p-3 bg-red-50 border border-red-200 rounded text-red-600 text-sm",children:c}),(0,t.jsx)("textarea",{value:o,onChange:e=>i(e.target.value),className:"w-full min-h-[400px] px-4 py-3 border border-gray-300 rounded-lg text-sm font-mono focus:outline-none focus:ring-2 focus:ring-blue-500 resize-none",placeholder:"Paste your tool JSON here..."})]})})};var ei=e.i(311451),ec=e.i(475254);let ed=(0,ec.default)("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);e.s(["default",()=>ed],180127),e.s(["ArrowLeftIcon",()=>ed],516430);let em=(0,ec.default)("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]),ep=(0,ec.default)("clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]),ex=({promptName:e,onNameChange:s,onBack:a,onSave:l,isSaving:n,editMode:o=!1,onShowHistory:i,version:c,promptModel:d="gpt-4o",promptVariables:m={},accessToken:p,proxySettings:x})=>(0,t.jsxs)("div",{className:"bg-white border-b border-gray-200 px-6 py-3 flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-3",children:[(0,t.jsx)(r.Button,{icon:ed,variant:"light",onClick:a,size:"xs",children:"Back"}),(0,t.jsx)(ei.Input,{value:e,onChange:e=>s(e.target.value),className:"text-base font-medium border-none shadow-none",style:{width:"200px"}}),c&&(0,t.jsx)("span",{className:"px-2 py-0.5 text-xs bg-blue-100 text-blue-700 rounded font-medium",children:c}),(0,t.jsx)("span",{className:"px-2 py-0.5 text-xs bg-gray-100 text-gray-600 rounded",children:"Draft"}),(0,t.jsx)("span",{className:"text-xs text-gray-400",children:"Unsaved changes"})]}),(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)(Y,{promptId:e,model:d,promptVariables:m,accessToken:p,version:c?.replace("v","")||"1",proxySettings:x}),o&&i&&(0,t.jsx)(r.Button,{icon:ep,variant:"secondary",onClick:i,children:"History"}),(0,t.jsx)(r.Button,{icon:em,onClick:l,loading:n,disabled:n,children:o?"Update":"Save"})]})]});var eu=e.i(903446),eu=eu,eh=e.i(992619);let eg=({model:e,temperature:r=1,maxTokens:a=1e3,accessToken:l,onModelChange:n,onTemperatureChange:o,onMaxTokensChange:i})=>{let[c,d]=(0,s.useState)(!1);return(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"w-[300px]",children:(0,t.jsx)(eh.default,{accessToken:l||"",value:e,onChange:n,showLabel:!1})}),(0,t.jsxs)("button",{onClick:()=>d(!c),className:"flex items-center gap-2 px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg hover:bg-gray-50",children:[(0,t.jsx)(eu.default,{size:16}),(0,t.jsx)("span",{children:"Parameters"})]}),c&&(0,t.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black bg-opacity-30",children:(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow-xl p-6 w-96",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,t.jsx)("h3",{className:"text-lg font-semibold",children:"Model Parameters"}),(0,t.jsx)("button",{onClick:()=>d(!1),className:"text-gray-400 hover:text-gray-600",children:"✕"})]}),(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)("div",{children:(0,t.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,t.jsx)(I.Text,{className:"text-sm text-gray-700",children:"Temperature"}),(0,t.jsx)(ei.Input,{type:"number",size:"small",min:0,max:2,step:.1,value:r,onChange:e=>o(parseFloat(e.target.value)||0),className:"w-20"})]})}),(0,t.jsx)("div",{children:(0,t.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,t.jsx)(I.Text,{className:"text-sm text-gray-700",children:"Max Tokens"}),(0,t.jsx)(ei.Input,{type:"number",size:"small",min:1,max:32768,value:a,onChange:e=>i(parseInt(e.target.value)||1e3),className:"w-24"})]})})]})]})})]})};var ef=e.i(837007);let ej=(0,ec.default)("trash",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}]]),ev=({tools:e,onAddTool:s,onEditTool:r,onRemoveTool:a})=>(0,t.jsxs)($.Card,{className:"p-3",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,t.jsx)(I.Text,{className:"text-sm font-medium",children:"Tools"}),(0,t.jsxs)("button",{onClick:s,className:"text-xs text-blue-600 hover:text-blue-700 flex items-center",children:[(0,t.jsx)(ef.PlusIcon,{size:14,className:"mr-1"}),"Add"]})]}),0===e.length?(0,t.jsx)(I.Text,{className:"text-gray-500 text-xs",children:"No tools added"}):(0,t.jsx)("div",{className:"space-y-2",children:e.map((e,s)=>(0,t.jsxs)("div",{className:"flex items-center justify-between p-2 bg-gray-50 border border-gray-200 rounded",children:[(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("div",{className:"font-medium text-xs truncate",children:e.name}),(0,t.jsx)("div",{className:"text-xs text-gray-500 truncate",children:e.description})]}),(0,t.jsxs)("div",{className:"flex items-center space-x-1 ml-2",children:[(0,t.jsx)("button",{onClick:()=>r(s),className:"text-xs text-blue-600 hover:text-blue-700",children:"Edit"}),(0,t.jsx)("button",{onClick:()=>a(s),className:"text-gray-400 hover:text-red-500",children:(0,t.jsx)(ej,{size:14})})]})]},s))})]});var ey=e.i(282786),eb=e.i(262218),eN=e.i(751904);let{TextArea:ew}=ei.Input,eC=({value:e,onChange:r,placeholder:a,rows:l=4,className:n})=>{let[o,i]=(0,s.useState)(null),[c,d]=(0,s.useState)(""),m=()=>{c.trim()&&o&&(r(e.substring(0,o.start)+`{{${c}}}`+e.substring(o.end)),i(null),d(""))},p=(()=>{let t,s=/\{\{(\w+)\}\}/g,r=[];for(;null!==(t=s.exec(e));)r.push({name:t[1],start:t.index,end:t.index+t[0].length});return r})();return(0,t.jsxs)("div",{className:`variable-textarea-container ${n}`,children:[(0,t.jsx)("style",{children:` .variable-highlight-text { color: #f97316; background-color: #fff7ed; @@ -164,4 +164,4 @@ main();`}})())},[d,p,u,e,l,n]),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(r.Butt border: 1px solid #fed7aa; font-family: monospace; } - `}),(0,t.jsx)(ew,{value:e,onChange:e=>r(e.target.value),placeholder:a,rows:l,className:"font-sans"}),p.length>0&&(0,t.jsxs)("div",{className:"mt-2 flex flex-wrap gap-2 items-center",children:[(0,t.jsx)("span",{className:"text-xs text-gray-500 mr-1",children:"Detected variables:"}),p.map((e,s)=>(0,t.jsx)(ey.Popover,{content:(0,t.jsxs)("div",{className:"p-2",style:{minWidth:"200px"},children:[(0,t.jsx)("div",{className:"text-xs text-gray-500 mb-2",children:"Edit variable name"}),(0,t.jsx)(ei.Input,{size:"small",value:c,onChange:e=>d(e.target.value),onPressEnter:m,placeholder:"Variable name",autoFocus:!0}),(0,t.jsxs)("div",{className:"flex gap-2 mt-2",children:[(0,t.jsx)("button",{onClick:m,className:"text-xs px-2 py-1 bg-blue-500 text-white rounded hover:bg-blue-600",children:"Save"}),(0,t.jsx)("button",{onClick:()=>{i(null),d("")},className:"text-xs px-2 py-1 bg-gray-200 text-gray-700 rounded hover:bg-gray-300",children:"Cancel"})]})]}),open:o?.start===e.start,onOpenChange:e=>{e||(i(null),d(""))},trigger:"click",children:(0,t.jsx)(eb.Tag,{color:"orange",className:"cursor-pointer hover:opacity-80 transition-all m-0",icon:(0,t.jsx)(eN.EditOutlined,{}),onClick:()=>{i({oldName:e.name,start:e.start,end:e.end}),d(e.name)},children:e.name})},`${e.start}-${s}`))]})]})},e_=({value:e,onChange:s})=>(0,t.jsxs)($.Card,{className:"p-3",children:[(0,t.jsx)(I.Text,{className:"block mb-2 text-sm font-medium",children:"Developer message"}),(0,t.jsx)(I.Text,{className:"text-gray-500 text-xs mb-2",children:"Optional system instructions for the model"}),(0,t.jsx)(eC,{value:e,onChange:s,rows:3,placeholder:"e.g., You are a helpful assistant..."})]});var ef=ef;let ek=(0,ec.default)("grip-vertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]),{Option:eT}=W.Select,eS=({messages:e,onAddMessage:r,onUpdateMessage:a,onRemoveMessage:l,onMoveMessage:n})=>{let[o,i]=(0,s.useState)(null),[c,d]=(0,s.useState)(null),m=()=>{i(null),d(null)};return(0,t.jsxs)($.Card,{className:"p-3",children:[(0,t.jsxs)("div",{className:"mb-2",children:[(0,t.jsx)(I.Text,{className:"text-sm font-medium",children:"Prompt messages"}),(0,t.jsxs)(I.Text,{className:"text-gray-500 text-xs mt-1",children:["Use ",(0,t.jsx)("code",{className:"bg-gray-100 px-1 rounded text-xs",children:"{{variable}}"})," syntax for template variables"]})]}),(0,t.jsx)("div",{className:"space-y-2",children:e.map((s,r)=>(0,t.jsxs)("div",{draggable:!0,onDragStart:()=>{i(r)},onDragOver:e=>{e.preventDefault(),d(r)},onDrop:e=>{e.preventDefault(),null!==o&&o!==r&&n(o,r),i(null),d(null)},onDragEnd:m,className:`border border-gray-300 rounded overflow-hidden bg-white transition-all ${o===r?"opacity-50":""} ${c===r&&o!==r?"border-blue-500 border-2":""}`,children:[(0,t.jsxs)("div",{className:"bg-gray-50 px-2 py-1.5 border-b border-gray-300 flex items-center justify-between",children:[(0,t.jsxs)(W.Select,{value:s.role,onChange:e=>a(r,"role",e),style:{width:100},size:"small",bordered:!1,children:[(0,t.jsx)(eT,{value:"user",children:"User"}),(0,t.jsx)(eT,{value:"assistant",children:"Assistant"}),(0,t.jsx)(eT,{value:"system",children:"System"})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[e.length>1&&(0,t.jsx)("button",{onClick:()=>l(r),className:"text-gray-400 hover:text-red-500",children:(0,t.jsx)(ej,{size:14})}),(0,t.jsx)("div",{className:"cursor-grab active:cursor-grabbing text-gray-400 hover:text-gray-600",children:(0,t.jsx)(ek,{size:16})})]})]}),(0,t.jsx)("div",{className:"p-2",children:(0,t.jsx)(eC,{value:s.content,onChange:e=>a(r,"content",e),rows:3,placeholder:"Enter prompt content..."})})]},r))}),(0,t.jsxs)("button",{onClick:r,className:"mt-2 text-xs text-blue-600 hover:text-blue-700 flex items-center",children:[(0,t.jsx)(ef.default,{size:14,className:"mr-1"}),"Add message"]})]})};var e$=e.i(447593);let eP=({extractedVariables:e,variables:s,onVariableChange:r})=>0===e.length?null:(0,t.jsxs)("div",{className:"p-4 border-b border-gray-200 bg-blue-50",children:[(0,t.jsx)("h3",{className:"text-sm font-semibold text-gray-700 mb-3",children:"Fill in template variables to start testing"}),(0,t.jsx)("div",{className:"space-y-2",children:e.map(e=>(0,t.jsxs)("div",{children:[(0,t.jsxs)("label",{className:"block text-xs text-gray-600 mb-1 font-medium",children:["{{",e,"}}"]}),(0,t.jsx)(ei.Input,{value:s[e]||"",onChange:t=>r(e,t.target.value),placeholder:`Enter value for ${e}`,size:"small"})]},e))})]});var eI=e.i(56456),eO=e.i(482725),eB=e.i(983561);let eE=({hasVariables:e})=>(0,t.jsxs)("div",{className:"h-full flex flex-col items-center justify-center text-gray-400",children:[(0,t.jsx)(eB.RobotOutlined,{style:{fontSize:"48px",marginBottom:"16px"}}),(0,t.jsx)("span",{className:"text-base",children:e?"Fill in the variables above, then type a message to start testing":"Type a message below to start testing your prompt"})]});var eD=e.i(771674),eA=e.i(918789),eL=e.i(989022);let eM=({message:e})=>(0,t.jsx)("div",{className:`mb-4 flex ${"user"===e.role?"justify-end":"justify-start"}`,children:(0,t.jsxs)("div",{className:"max-w-[85%] rounded-lg shadow-sm p-3.5 px-4",style:{backgroundColor:"user"===e.role?"#f0f8ff":"#ffffff",border:"user"===e.role?"1px solid #e6f0fa":"1px solid #f0f0f0"},children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-1.5",children:[(0,t.jsx)("div",{className:"flex items-center justify-center w-6 h-6 rounded-full mr-1",style:{backgroundColor:"user"===e.role?"#e6f0fa":"#f5f5f5"},children:"user"===e.role?(0,t.jsx)(eD.UserOutlined,{style:{fontSize:"12px",color:"#2563eb"}}):(0,t.jsx)(eB.RobotOutlined,{style:{fontSize:"12px",color:"#4b5563"}})}),(0,t.jsx)("strong",{className:"text-sm capitalize",children:e.role}),"assistant"===e.role&&e.model&&(0,t.jsx)("span",{className:"text-xs px-2 py-0.5 rounded bg-gray-100 text-gray-600 font-normal",children:e.model})]}),(0,t.jsxs)("div",{className:"whitespace-pre-wrap break-words max-w-full message-content",style:{wordWrap:"break-word",overflowWrap:"break-word",wordBreak:"break-word",hyphens:"auto"},children:["assistant"===e.role?(0,t.jsx)(eA.default,{components:{code({node:e,inline:s,className:r,children:a,...l}){let n=/language-(\w+)/.exec(r||"");return!s&&n?(0,t.jsx)(G.Prism,{style:X.coy,language:n[1],PreTag:"div",className:"rounded-md my-2",wrapLines:!0,wrapLongLines:!0,...l,children:String(a).replace(/\n$/,"")}):(0,t.jsx)("code",{className:`${r} px-1.5 py-0.5 rounded bg-gray-100 text-sm font-mono`,style:{wordBreak:"break-word"},...l,children:a})},pre:({node:e,...s})=>(0,t.jsx)("pre",{style:{overflowX:"auto",maxWidth:"100%"},...s})},children:e.content}):(0,t.jsx)("div",{className:"whitespace-pre-wrap",children:e.content}),"assistant"===e.role&&(e.timeToFirstToken||e.totalLatency||e.usage)&&(0,t.jsx)(eL.default,{timeToFirstToken:e.timeToFirstToken,totalLatency:e.totalLatency,usage:e.usage})]})]})}),ez=({messages:e,isLoading:s,hasVariables:r,messagesEndRef:a})=>{let l=(0,t.jsx)(eI.LoadingOutlined,{style:{fontSize:24},spin:!0});return(0,t.jsxs)("div",{className:"flex-1 overflow-y-auto p-4 pb-0",children:[0===e.length&&(0,t.jsx)(eE,{hasVariables:r}),e.map((e,s)=>(0,t.jsx)(eM,{message:e},s)),s&&(0,t.jsx)("div",{className:"flex justify-center items-center my-4",children:(0,t.jsx)(eO.Spin,{indicator:l})}),(0,t.jsx)("div",{ref:a,style:{height:"1px"}})]})},eR=({extractedVariables:e,variables:s})=>{let r=e.filter(e=>!s[e]||""===s[e].trim());return 0===r.length?null:(0,t.jsx)("div",{className:"mb-3 p-3 bg-yellow-50 border border-yellow-200 rounded-lg",children:(0,t.jsxs)("div",{className:"flex items-start gap-2",children:[(0,t.jsx)("span",{className:"text-yellow-600 text-sm",children:"⚠️"}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)("p",{className:"text-sm text-yellow-800 font-medium mb-1",children:"Please fill in all template variables above"}),(0,t.jsxs)("p",{className:"text-xs text-yellow-700",children:["Missing: ",r.map(e=>`{{${e}}}`).join(", ")]})]})]})})};var eF=e.i(132104);let{TextArea:eU}=ei.Input,eJ=({inputMessage:e,isLoading:s,isDisabled:a,onInputChange:l,onSend:n,onKeyDown:o,onCancel:i})=>(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsxs)("div",{className:"flex items-center flex-1 bg-white border border-gray-300 rounded-xl px-3 py-1 min-h-[44px]",children:[(0,t.jsx)(eU,{value:e,onChange:e=>l(e.target.value),onKeyDown:o,placeholder:"Type your message... (Shift+Enter for new line)",disabled:s,className:"flex-1",autoSize:{minRows:1,maxRows:4},style:{resize:"none",border:"none",boxShadow:"none",background:"transparent",padding:"4px 0",fontSize:"14px",lineHeight:"20px"}}),(0,t.jsx)(r.Button,{onClick:n,disabled:a,className:"flex-shrink-0 ml-2 !w-8 !h-8 !min-w-8 !p-0 !rounded-full !bg-blue-600 hover:!bg-blue-700 disabled:!bg-gray-300 !border-none !text-white disabled:!text-gray-500 !flex !items-center !justify-center",children:(0,t.jsx)(eF.ArrowUpOutlined,{style:{fontSize:"14px"}})})]}),s&&(0,t.jsx)(r.Button,{onClick:i,className:"bg-red-50 hover:bg-red-100 text-red-600 border-red-200",children:"Cancel"})]}),eV=({prompt:e,accessToken:a})=>{let{isLoading:n,messages:o,inputMessage:i,variables:c,variablesFilled:d,extractedVariables:m,allVariablesFilled:p,messagesEndRef:x,setInputMessage:u,handleSendMessage:h,handleCancelRequest:g,handleClearConversation:f,handleKeyDown:j,handleVariableChange:v}=((e,t)=>{let[r,a]=(0,s.useState)(!1),[n,o]=(0,s.useState)([]),[i,c]=(0,s.useState)(""),[d,m]=(0,s.useState)({}),[p,x]=(0,s.useState)(!1),[u,h]=(0,s.useState)(null),g=(0,s.useRef)(null),f=b(e),j=f.every(e=>d[e]&&""!==d[e].trim());(0,s.useEffect)(()=>{g.current&&setTimeout(()=>{g.current?.scrollIntoView({behavior:"smooth",block:"end"})},100)},[n]);let v=async()=>{let s;if(!t)return void H.default.fromBackend("Access token is required");if(f.length>0&&!j)return void H.default.fromBackend("Please fill in all template variables");if(!i.trim())return;!p&&f.length>0&&x(!0);let r={role:"user",content:i};o(e=>[...e,r]),c("");let m=new AbortController;h(m),a(!0);let u=Date.now();try{let r,a,c=N(e),p=(0,l.getProxyBaseUrl)(),x={dotprompt_content:c};0===n.length?x.prompt_variables=d:x.conversation_history=[...n.map(e=>({role:e.role,content:e.content})),{role:"user",content:i}];let h=await fetch(`${p}/prompts/test`,{method:"POST",headers:{[(0,l.getGlobalLitellmHeaderName)()]:`Bearer ${t}`,"Content-Type":"application/json"},body:JSON.stringify(x),signal:m.signal});if(!h.ok){let e=await h.text();throw Error(`HTTP error! status: ${h.status}, ${e}`)}if(!h.body)throw Error("No response body");let g=h.body.getReader(),f=new TextDecoder,j="";for(o(e=>[...e,{role:"assistant",content:""}]);;){let{done:e,value:t}=await g.read();if(e)break;for(let e of f.decode(t).split("\n"))if(e.startsWith("data: ")){let t=e.slice(6);if("[DONE]"===t)continue;try{let e=JSON.parse(t);!r&&e.model&&(r=e.model),e.usage&&(a=e.usage);let l=e.choices?.[0]?.delta?.content;l&&(s||(s=Date.now()-u),j+=l,o(e=>{let t=[...e];return t[t.length-1]={role:"assistant",content:j,model:r,timeToFirstToken:s},t}))}catch(e){console.error("Error parsing chunk:",e)}}}let v=Date.now()-u;o(e=>{let t=[...e];return t[t.length-1]={...t[t.length-1],totalLatency:v,usage:a},t})}catch(e){"AbortError"===e.name?console.log("Request was cancelled"):(console.error("Error testing prompt:",e),o(t=>{let s=t[t.length-1];return s&&"assistant"===s.role&&""===s.content?[...t.slice(0,-1),{role:"assistant",content:`Error: ${e.message}`}]:[...t,{role:"assistant",content:`Error: ${e.message}`}]}))}finally{a(!1),h(null)}};return{isLoading:r,messages:n,inputMessage:i,variables:d,variablesFilled:p,extractedVariables:f,allVariablesFilled:j,messagesEndRef:g,setInputMessage:c,handleSendMessage:v,handleCancelRequest:()=>{u&&(u.abort(),h(null),a(!1),H.default.info("Request cancelled"))},handleClearConversation:()=>{o([]),x(!1),H.default.success("Chat history cleared.")},handleKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),v())},handleVariableChange:(e,t)=>{m({...d,[e]:t})}}})(e,a);return(0,t.jsxs)("div",{className:"flex flex-col h-full bg-white",children:[!d&&(0,t.jsx)(eP,{extractedVariables:m,variables:c,onVariableChange:v}),o.length>0&&(0,t.jsx)("div",{className:"p-3 border-b border-gray-200 bg-white flex justify-end",children:(0,t.jsx)(r.Button,{onClick:f,className:"bg-gray-100 hover:bg-gray-200 text-gray-700 border-gray-300",icon:e$.ClearOutlined,children:"Clear Chat"})}),(0,t.jsx)(ez,{messages:o,isLoading:n,hasVariables:m.length>0,messagesEndRef:x}),(0,t.jsxs)("div",{className:"p-4 border-t border-gray-200 bg-white",children:[(0,t.jsx)(eR,{extractedVariables:m,variables:c}),(0,t.jsx)(eJ,{inputMessage:i,isLoading:n,isDisabled:n||!i.trim()||m.length>0&&!p,onInputChange:u,onSend:h,onKeyDown:j,onCancel:g})]})]})},eH=({visible:e,promptName:s,isSaving:l,onNameChange:n,onPublish:o,onCancel:i})=>(0,t.jsx)(a.Modal,{title:"Publish Prompt",open:e,onCancel:i,footer:[(0,t.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,t.jsx)(r.Button,{variant:"secondary",onClick:i,children:"Cancel"}),(0,t.jsx)(r.Button,{onClick:o,loading:l,children:"Publish"})]},"footer")],children:(0,t.jsxs)("div",{className:"py-4",children:[(0,t.jsx)(I.Text,{className:"mb-2",children:"Name"}),(0,t.jsx)(ei.Input,{value:s,onChange:e=>n(e.target.value),placeholder:"Enter prompt name",onPressEnter:o,autoFocus:!0}),(0,t.jsx)(I.Text,{className:"text-gray-500 text-xs mt-2",children:"Published prompts can be used in API calls and are versioned for easy tracking."})]})}),eW=({prompt:e})=>{let s=N(e);return(0,t.jsxs)("div",{className:"p-6",children:[(0,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-gray-700 mb-2",children:"Generated .prompt file"}),(0,t.jsx)("p",{className:"text-xs text-gray-500",children:"This is the dotprompt format that will be saved to the database"})]}),(0,t.jsx)("div",{className:"bg-gray-50 border border-gray-200 rounded-lg p-4 overflow-auto",children:(0,t.jsx)("pre",{className:"text-sm text-gray-900 font-mono whitespace-pre-wrap",children:s})})]})};var eK=e.i(608856),eq=e.i(573421),eG=e.i(981339);let{Text:eX}=e.i(898586).Typography,eY=({isOpen:e,onClose:r,accessToken:a,promptId:n,activeVersionId:o,onSelectVersion:i})=>{let[c,d]=(0,s.useState)([]),[m,p]=(0,s.useState)(!1);(0,s.useEffect)(()=>{e&&a&&n&&x()},[e,a,n]);let x=async()=>{p(!0);try{let e=n.includes(".v")?n.split(".v")[0]:n,t=await (0,l.getPromptVersions)(a,e);d(t.prompts)}catch(e){console.error("Error fetching prompt versions:",e)}finally{p(!1)}},u=e=>{if(e.version)return`v${e.version}`;let t=e.litellm_params?.prompt_id||e.prompt_id;return t.includes(".v")?`v${t.split(".v")[1]}`:t.includes("_v")?`v${t.split("_v")[1]}`:"v1"};return(0,t.jsx)(eK.Drawer,{title:"Version History",placement:"right",onClose:r,open:e,width:400,mask:!1,maskClosable:!1,children:m?(0,t.jsx)(eG.Skeleton,{active:!0,paragraph:{rows:4}}):0===c.length?(0,t.jsx)("div",{className:"text-center py-8 text-gray-500",children:"No version history available."}):(0,t.jsx)(eq.List,{dataSource:c,renderItem:(e,s)=>{var r;let a=e.version||parseInt(u(e).replace("v","")),l=null;o&&(o.includes(".v")?l=parseInt(o.split(".v")[1]):o.includes("_v")&&(l=parseInt(o.split("_v")[1])));let n=l?a===l:0===s;return(0,t.jsxs)("div",{className:`mb-4 p-4 rounded-lg border cursor-pointer transition-all hover:shadow-md ${n?"border-blue-500 bg-blue-50":"border-gray-200 bg-white hover:border-blue-300"}`,onClick:()=>i?.(e),children:[(0,t.jsxs)("div",{className:"flex justify-between items-start mb-2",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(eb.Tag,{className:"m-0",children:u(e)}),0===s&&(0,t.jsx)(eb.Tag,{color:"blue",className:"m-0",children:"Latest"})]}),n&&(0,t.jsx)(eb.Tag,{color:"green",className:"m-0",children:"Active"})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)(eX,{className:"text-sm text-gray-600 font-medium",children:(r=e.created_at)?new Date(r).toLocaleString():"-"}),(0,t.jsx)(eX,{type:"secondary",className:"text-xs",children:e.prompt_info?.prompt_type==="db"?"Saved to Database":"Config Prompt"})]})]},`${e.prompt_id}-v${e.version||a}`)}})})},eZ=({onClose:e,onSuccess:r,accessToken:a,initialPromptData:n})=>{let[o,i]=(0,s.useState)((()=>{if(n)try{return C(n)}catch(e){console.error("Error parsing existing prompt:",e),H.default.fromBackend("Failed to parse prompt data")}return{name:"New prompt",model:"gpt-4o",config:{temperature:1,max_tokens:1e3},tools:[],developerMessage:"",messages:[{role:"user",content:"Enter task specifics. Use {{template_variables}} for dynamic inputs"}]}})()),[c,d]=(0,s.useState)(!!n),[m,p]=(0,s.useState)(!1),[x,u]=(0,s.useState)((()=>{if(!n?.prompt_spec)return;let e=n.prompt_spec.prompt_id,t=n.prompt_spec.version||n.prompt_spec.litellm_params?.prompt_id;return"number"==typeof t?`${e}.v${t}`:"string"==typeof t&&(t.includes(".v")||t.includes("_v"))?t:e})()),[h,g]=(0,s.useState)(!1),[f,j]=(0,s.useState)(!1),[v,y]=(0,s.useState)(null),[b,w]=(0,s.useState)(!1),[_,k]=(0,s.useState)("pretty"),T=e=>{void 0!==e?y(e):y(null),g(!0)},S=async()=>{if(!a)return void H.default.fromBackend("Access token is required");if(!o.name||""===o.name.trim())return void H.default.fromBackend("Please enter a valid prompt name");w(!0);try{let t=o.name.replace(/[^a-zA-Z0-9_-]/g,"_").toLowerCase(),s=N(o),i={prompt_id:t,litellm_params:{prompt_integration:"dotprompt",prompt_id:t,dotprompt_content:s},prompt_info:{prompt_type:"db"}};c&&n?.prompt_spec?.prompt_id?(await (0,l.updatePromptCall)(a,n.prompt_spec.prompt_id,i),H.default.success("Prompt updated successfully!")):(await (0,l.createPromptCall)(a,i),H.default.success("Prompt created successfully!")),r(),e()}catch(e){console.error("Error saving prompt:",e),H.default.fromBackend(c?"Failed to update prompt":"Failed to save prompt")}finally{w(!1),j(!1)}},$=x&&x.includes(".v")?`v${x.split(".v")[1]}`:null;return(0,t.jsxs)("div",{className:"flex h-full bg-white",children:[(0,t.jsxs)("div",{className:"flex-1 flex flex-col",children:[(0,t.jsx)(ex,{promptName:o.name,onNameChange:e=>i({...o,name:e}),onBack:e,onSave:()=>{o.name&&""!==o.name.trim()&&"New prompt"!==o.name?S():j(!0)},isSaving:b,editMode:c,onShowHistory:()=>p(!0),version:$,promptModel:o.model,promptVariables:(()=>{let e,t={},s=[o.developerMessage,...o.messages.map(e=>e.content)].join(" "),r=/\{\{(\w+)\}\}/g;for(;null!==(e=r.exec(s));){let s=e[1];t[s]||(t[s]=`example_${s}`)}return t})(),accessToken:a}),(0,t.jsxs)("div",{className:"flex-1 flex overflow-hidden",children:[(0,t.jsxs)("div",{className:"w-1/2 overflow-y-auto bg-white border-r border-gray-200 flex-shrink-0",children:[(0,t.jsxs)("div",{className:"border-b border-gray-200 bg-white px-6 py-4 flex items-center gap-3",children:[(0,t.jsx)(eg,{model:o.model,temperature:o.config.temperature,maxTokens:o.config.max_tokens,accessToken:a,onModelChange:e=>i({...o,model:e}),onTemperatureChange:e=>i({...o,config:{...o.config,temperature:e}}),onMaxTokensChange:e=>i({...o,config:{...o.config,max_tokens:e}})}),(0,t.jsxs)("div",{className:"ml-auto inline-flex items-center bg-gray-200 rounded-full p-0.5",children:[(0,t.jsx)("button",{className:`px-3 py-1 text-xs font-medium rounded-full transition-colors ${"pretty"===_?"bg-white text-gray-900 shadow-sm":"text-gray-600"}`,onClick:()=>k("pretty"),children:"PRETTY"}),(0,t.jsx)("button",{className:`px-3 py-1 text-xs font-medium rounded-full transition-colors ${"dotprompt"===_?"bg-white text-gray-900 shadow-sm":"text-gray-600"}`,onClick:()=>k("dotprompt"),children:"DOTPROMPT"})]})]}),"pretty"===_?(0,t.jsxs)("div",{className:"p-6 space-y-4 pb-20",children:[(0,t.jsx)(ev,{tools:o.tools,onAddTool:()=>T(),onEditTool:T,onRemoveTool:e=>{i({...o,tools:o.tools.filter((t,s)=>s!==e)})}}),(0,t.jsx)(e_,{value:o.developerMessage,onChange:e=>i({...o,developerMessage:e})}),(0,t.jsx)(eS,{messages:o.messages,onAddMessage:()=>{i({...o,messages:[...o.messages,{role:"user",content:""}]})},onUpdateMessage:(e,t,s)=>{let r=[...o.messages];r[e][t]=s,i({...o,messages:r})},onRemoveMessage:e=>{o.messages.length>1&&i({...o,messages:o.messages.filter((t,s)=>s!==e)})},onMoveMessage:(e,t)=>{let s=[...o.messages],[r]=s.splice(e,1);s.splice(t,0,r),i({...o,messages:s})}})]}):(0,t.jsx)(eW,{prompt:o})]}),(0,t.jsx)("div",{className:"w-1/2 flex-shrink-0",children:(0,t.jsx)(eV,{prompt:o,accessToken:a})})]})]}),(0,t.jsx)(eH,{visible:f,promptName:o.name,isSaving:b,onNameChange:e=>i({...o,name:e}),onPublish:S,onCancel:()=>j(!1)}),h&&(0,t.jsx)(eo,{visible:h,initialJson:null!==v?o.tools[v].json:"",onSave:e=>{try{let t=JSON.parse(e),s={name:t.function?.name||"Unnamed Tool",description:t.function?.description||"",json:e};if(null!==v){let e=[...o.tools];e[v]=s,i({...o,tools:e})}else i({...o,tools:[...o.tools,s]});g(!1),y(null)}catch(e){H.default.fromBackend("Invalid JSON format")}},onClose:()=>{g(!1),y(null)}}),(0,t.jsx)(eY,{isOpen:m,onClose:()=>p(!1),accessToken:a,promptId:n?.prompt_spec?.prompt_id||o.name,activeVersionId:x,onSelectVersion:e=>{try{let t=C({prompt_spec:e});i(t);let s=e.version||1;u(`${e.prompt_id}.v${s}`)}catch(e){console.error("Error loading version:",e),H.default.fromBackend("Failed to load prompt version")}}})]})};var eQ=e.i(708347);e.s(["default",0,({accessToken:e,userRole:n})=>{let[o,i]=(0,s.useState)([]),[c,d]=(0,s.useState)(!1),[m,p]=(0,s.useState)(null),[x,u]=(0,s.useState)(!1),[h,g]=(0,s.useState)(!1),[f,j]=(0,s.useState)(null),[v,y]=(0,s.useState)(!1),[b,N]=(0,s.useState)(null),w=!!n&&(0,eQ.isAdminRole)(n),C=async()=>{if(e){d(!0);try{let t=await (0,l.getPromptsList)(e);console.log(`prompts: ${JSON.stringify(t)}`),i(t.prompts)}catch(e){console.error("Error fetching prompts:",e)}finally{d(!1)}}};(0,s.useEffect)(()=>{C()},[e]);let _=()=>{C(),g(!1),j(null),p(null)},k=async()=>{if(b&&e){y(!0);try{await (0,l.deletePromptCall)(e,b.id),H.default.success(`Prompt "${b.name}" deleted successfully`),C()}catch(e){console.error("Error deleting prompt:",e),H.default.fromBackend("Failed to delete prompt")}finally{y(!1),N(null)}}};return(0,t.jsxs)("div",{className:"w-full mx-auto flex-auto overflow-y-auto m-8 p-2",children:[h?(0,t.jsx)(eZ,{onClose:()=>{g(!1),j(null)},onSuccess:_,accessToken:e,initialPromptData:f}):m?(0,t.jsx)(Z,{promptId:m,onClose:()=>p(null),accessToken:e,isAdmin:w,onDelete:C,onEdit:e=>{j(e),g(!0)}}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"flex justify-between items-center mb-4",children:(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(r.Button,{onClick:()=>{m&&p(null),j(null),g(!0)},disabled:!e,children:"+ Add New Prompt"}),(0,t.jsx)(r.Button,{onClick:()=>{m&&p(null),u(!0)},disabled:!e,variant:"secondary",children:"Upload .prompt File"})]})}),(0,t.jsx)(S,{promptsList:o,isLoading:c,onPromptClick:e=>{p(e)},onDeleteClick:(e,t)=>{N({id:e,name:t})},accessToken:e,isAdmin:w})]}),(0,t.jsx)(el,{visible:x,onClose:()=>{u(!1)},accessToken:e,onSuccess:_}),b&&(0,t.jsxs)(a.Modal,{title:"Delete Prompt",open:null!==b,onOk:k,onCancel:()=>{N(null)},confirmLoading:v,okText:"Delete",okButtonProps:{danger:!0},children:[(0,t.jsxs)("p",{children:["Are you sure you want to delete prompt: ",b.name," ?"]}),(0,t.jsx)("p",{children:"This action cannot be undone."})]})]})}],191403)}]); \ No newline at end of file + `}),(0,t.jsx)(ew,{value:e,onChange:e=>r(e.target.value),placeholder:a,rows:l,className:"font-sans"}),p.length>0&&(0,t.jsxs)("div",{className:"mt-2 flex flex-wrap gap-2 items-center",children:[(0,t.jsx)("span",{className:"text-xs text-gray-500 mr-1",children:"Detected variables:"}),p.map((e,s)=>(0,t.jsx)(ey.Popover,{content:(0,t.jsxs)("div",{className:"p-2",style:{minWidth:"200px"},children:[(0,t.jsx)("div",{className:"text-xs text-gray-500 mb-2",children:"Edit variable name"}),(0,t.jsx)(ei.Input,{size:"small",value:c,onChange:e=>d(e.target.value),onPressEnter:m,placeholder:"Variable name",autoFocus:!0}),(0,t.jsxs)("div",{className:"flex gap-2 mt-2",children:[(0,t.jsx)("button",{onClick:m,className:"text-xs px-2 py-1 bg-blue-500 text-white rounded hover:bg-blue-600",children:"Save"}),(0,t.jsx)("button",{onClick:()=>{i(null),d("")},className:"text-xs px-2 py-1 bg-gray-200 text-gray-700 rounded hover:bg-gray-300",children:"Cancel"})]})]}),open:o?.start===e.start,onOpenChange:e=>{e||(i(null),d(""))},trigger:"click",children:(0,t.jsx)(eb.Tag,{color:"orange",className:"cursor-pointer hover:opacity-80 transition-all m-0",icon:(0,t.jsx)(eN.EditOutlined,{}),onClick:()=>{i({oldName:e.name,start:e.start,end:e.end}),d(e.name)},children:e.name})},`${e.start}-${s}`))]})]})},e_=({value:e,onChange:s})=>(0,t.jsxs)($.Card,{className:"p-3",children:[(0,t.jsx)(I.Text,{className:"block mb-2 text-sm font-medium",children:"Developer message"}),(0,t.jsx)(I.Text,{className:"text-gray-500 text-xs mb-2",children:"Optional system instructions for the model"}),(0,t.jsx)(eC,{value:e,onChange:s,rows:3,placeholder:"e.g., You are a helpful assistant..."})]}),ek=(0,ec.default)("grip-vertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]),{Option:eT}=W.Select,eS=({messages:e,onAddMessage:r,onUpdateMessage:a,onRemoveMessage:l,onMoveMessage:n})=>{let[o,i]=(0,s.useState)(null),[c,d]=(0,s.useState)(null),m=()=>{i(null),d(null)};return(0,t.jsxs)($.Card,{className:"p-3",children:[(0,t.jsxs)("div",{className:"mb-2",children:[(0,t.jsx)(I.Text,{className:"text-sm font-medium",children:"Prompt messages"}),(0,t.jsxs)(I.Text,{className:"text-gray-500 text-xs mt-1",children:["Use ",(0,t.jsx)("code",{className:"bg-gray-100 px-1 rounded text-xs",children:"{{variable}}"})," syntax for template variables"]})]}),(0,t.jsx)("div",{className:"space-y-2",children:e.map((s,r)=>(0,t.jsxs)("div",{draggable:!0,onDragStart:()=>{i(r)},onDragOver:e=>{e.preventDefault(),d(r)},onDrop:e=>{e.preventDefault(),null!==o&&o!==r&&n(o,r),i(null),d(null)},onDragEnd:m,className:`border border-gray-300 rounded overflow-hidden bg-white transition-all ${o===r?"opacity-50":""} ${c===r&&o!==r?"border-blue-500 border-2":""}`,children:[(0,t.jsxs)("div",{className:"bg-gray-50 px-2 py-1.5 border-b border-gray-300 flex items-center justify-between",children:[(0,t.jsxs)(W.Select,{value:s.role,onChange:e=>a(r,"role",e),style:{width:100},size:"small",bordered:!1,children:[(0,t.jsx)(eT,{value:"user",children:"User"}),(0,t.jsx)(eT,{value:"assistant",children:"Assistant"}),(0,t.jsx)(eT,{value:"system",children:"System"})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[e.length>1&&(0,t.jsx)("button",{onClick:()=>l(r),className:"text-gray-400 hover:text-red-500",children:(0,t.jsx)(ej,{size:14})}),(0,t.jsx)("div",{className:"cursor-grab active:cursor-grabbing text-gray-400 hover:text-gray-600",children:(0,t.jsx)(ek,{size:16})})]})]}),(0,t.jsx)("div",{className:"p-2",children:(0,t.jsx)(eC,{value:s.content,onChange:e=>a(r,"content",e),rows:3,placeholder:"Enter prompt content..."})})]},r))}),(0,t.jsxs)("button",{onClick:r,className:"mt-2 text-xs text-blue-600 hover:text-blue-700 flex items-center",children:[(0,t.jsx)(ef.PlusIcon,{size:14,className:"mr-1"}),"Add message"]})]})};var e$=e.i(447593);let eP=({extractedVariables:e,variables:s,onVariableChange:r})=>0===e.length?null:(0,t.jsxs)("div",{className:"p-4 border-b border-gray-200 bg-blue-50",children:[(0,t.jsx)("h3",{className:"text-sm font-semibold text-gray-700 mb-3",children:"Fill in template variables to start testing"}),(0,t.jsx)("div",{className:"space-y-2",children:e.map(e=>(0,t.jsxs)("div",{children:[(0,t.jsxs)("label",{className:"block text-xs text-gray-600 mb-1 font-medium",children:["{{",e,"}}"]}),(0,t.jsx)(ei.Input,{value:s[e]||"",onChange:t=>r(e,t.target.value),placeholder:`Enter value for ${e}`,size:"small"})]},e))})]});var eI=e.i(56456),eO=e.i(482725),eB=e.i(983561);let eE=({hasVariables:e})=>(0,t.jsxs)("div",{className:"h-full flex flex-col items-center justify-center text-gray-400",children:[(0,t.jsx)(eB.RobotOutlined,{style:{fontSize:"48px",marginBottom:"16px"}}),(0,t.jsx)("span",{className:"text-base",children:e?"Fill in the variables above, then type a message to start testing":"Type a message below to start testing your prompt"})]});var eD=e.i(771674),eA=e.i(918789),eL=e.i(989022);let eM=({message:e})=>(0,t.jsx)("div",{className:`mb-4 flex ${"user"===e.role?"justify-end":"justify-start"}`,children:(0,t.jsxs)("div",{className:"max-w-[85%] rounded-lg shadow-sm p-3.5 px-4",style:{backgroundColor:"user"===e.role?"#f0f8ff":"#ffffff",border:"user"===e.role?"1px solid #e6f0fa":"1px solid #f0f0f0"},children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-1.5",children:[(0,t.jsx)("div",{className:"flex items-center justify-center w-6 h-6 rounded-full mr-1",style:{backgroundColor:"user"===e.role?"#e6f0fa":"#f5f5f5"},children:"user"===e.role?(0,t.jsx)(eD.UserOutlined,{style:{fontSize:"12px",color:"#2563eb"}}):(0,t.jsx)(eB.RobotOutlined,{style:{fontSize:"12px",color:"#4b5563"}})}),(0,t.jsx)("strong",{className:"text-sm capitalize",children:e.role}),"assistant"===e.role&&e.model&&(0,t.jsx)("span",{className:"text-xs px-2 py-0.5 rounded bg-gray-100 text-gray-600 font-normal",children:e.model})]}),(0,t.jsxs)("div",{className:"whitespace-pre-wrap break-words max-w-full message-content",style:{wordWrap:"break-word",overflowWrap:"break-word",wordBreak:"break-word",hyphens:"auto"},children:["assistant"===e.role?(0,t.jsx)(eA.default,{components:{code({node:e,inline:s,className:r,children:a,...l}){let n=/language-(\w+)/.exec(r||"");return!s&&n?(0,t.jsx)(G.Prism,{style:X.coy,language:n[1],PreTag:"div",className:"rounded-md my-2",wrapLines:!0,wrapLongLines:!0,...l,children:String(a).replace(/\n$/,"")}):(0,t.jsx)("code",{className:`${r} px-1.5 py-0.5 rounded bg-gray-100 text-sm font-mono`,style:{wordBreak:"break-word"},...l,children:a})},pre:({node:e,...s})=>(0,t.jsx)("pre",{style:{overflowX:"auto",maxWidth:"100%"},...s})},children:e.content}):(0,t.jsx)("div",{className:"whitespace-pre-wrap",children:e.content}),"assistant"===e.role&&(e.timeToFirstToken||e.totalLatency||e.usage)&&(0,t.jsx)(eL.default,{timeToFirstToken:e.timeToFirstToken,totalLatency:e.totalLatency,usage:e.usage})]})]})}),ez=({messages:e,isLoading:s,hasVariables:r,messagesEndRef:a})=>{let l=(0,t.jsx)(eI.LoadingOutlined,{style:{fontSize:24},spin:!0});return(0,t.jsxs)("div",{className:"flex-1 overflow-y-auto p-4 pb-0",children:[0===e.length&&(0,t.jsx)(eE,{hasVariables:r}),e.map((e,s)=>(0,t.jsx)(eM,{message:e},s)),s&&(0,t.jsx)("div",{className:"flex justify-center items-center my-4",children:(0,t.jsx)(eO.Spin,{indicator:l})}),(0,t.jsx)("div",{ref:a,style:{height:"1px"}})]})},eR=({extractedVariables:e,variables:s})=>{let r=e.filter(e=>!s[e]||""===s[e].trim());return 0===r.length?null:(0,t.jsx)("div",{className:"mb-3 p-3 bg-yellow-50 border border-yellow-200 rounded-lg",children:(0,t.jsxs)("div",{className:"flex items-start gap-2",children:[(0,t.jsx)("span",{className:"text-yellow-600 text-sm",children:"⚠️"}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)("p",{className:"text-sm text-yellow-800 font-medium mb-1",children:"Please fill in all template variables above"}),(0,t.jsxs)("p",{className:"text-xs text-yellow-700",children:["Missing: ",r.map(e=>`{{${e}}}`).join(", ")]})]})]})})};var eF=e.i(132104);let{TextArea:eU}=ei.Input,eJ=({inputMessage:e,isLoading:s,isDisabled:a,onInputChange:l,onSend:n,onKeyDown:o,onCancel:i})=>(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsxs)("div",{className:"flex items-center flex-1 bg-white border border-gray-300 rounded-xl px-3 py-1 min-h-[44px]",children:[(0,t.jsx)(eU,{value:e,onChange:e=>l(e.target.value),onKeyDown:o,placeholder:"Type your message... (Shift+Enter for new line)",disabled:s,className:"flex-1",autoSize:{minRows:1,maxRows:4},style:{resize:"none",border:"none",boxShadow:"none",background:"transparent",padding:"4px 0",fontSize:"14px",lineHeight:"20px"}}),(0,t.jsx)(r.Button,{onClick:n,disabled:a,className:"flex-shrink-0 ml-2 !w-8 !h-8 !min-w-8 !p-0 !rounded-full !bg-blue-600 hover:!bg-blue-700 disabled:!bg-gray-300 !border-none !text-white disabled:!text-gray-500 !flex !items-center !justify-center",children:(0,t.jsx)(eF.ArrowUpOutlined,{style:{fontSize:"14px"}})})]}),s&&(0,t.jsx)(r.Button,{onClick:i,className:"bg-red-50 hover:bg-red-100 text-red-600 border-red-200",children:"Cancel"})]}),eV=({prompt:e,accessToken:a})=>{let{isLoading:n,messages:o,inputMessage:i,variables:c,variablesFilled:d,extractedVariables:m,allVariablesFilled:p,messagesEndRef:x,setInputMessage:u,handleSendMessage:h,handleCancelRequest:g,handleClearConversation:f,handleKeyDown:j,handleVariableChange:v}=((e,t)=>{let[r,a]=(0,s.useState)(!1),[n,o]=(0,s.useState)([]),[i,c]=(0,s.useState)(""),[d,m]=(0,s.useState)({}),[p,x]=(0,s.useState)(!1),[u,h]=(0,s.useState)(null),g=(0,s.useRef)(null),f=b(e),j=f.every(e=>d[e]&&""!==d[e].trim());(0,s.useEffect)(()=>{g.current&&setTimeout(()=>{g.current?.scrollIntoView({behavior:"smooth",block:"end"})},100)},[n]);let v=async()=>{let s;if(!t)return void H.default.fromBackend("Access token is required");if(f.length>0&&!j)return void H.default.fromBackend("Please fill in all template variables");if(!i.trim())return;!p&&f.length>0&&x(!0);let r={role:"user",content:i};o(e=>[...e,r]),c("");let m=new AbortController;h(m),a(!0);let u=Date.now();try{let r,a,c=N(e),p=(0,l.getProxyBaseUrl)(),x={dotprompt_content:c};0===n.length?x.prompt_variables=d:x.conversation_history=[...n.map(e=>({role:e.role,content:e.content})),{role:"user",content:i}];let h=await fetch(`${p}/prompts/test`,{method:"POST",headers:{[(0,l.getGlobalLitellmHeaderName)()]:`Bearer ${t}`,"Content-Type":"application/json"},body:JSON.stringify(x),signal:m.signal});if(!h.ok){let e=await h.text();throw Error(`HTTP error! status: ${h.status}, ${e}`)}if(!h.body)throw Error("No response body");let g=h.body.getReader(),f=new TextDecoder,j="";for(o(e=>[...e,{role:"assistant",content:""}]);;){let{done:e,value:t}=await g.read();if(e)break;for(let e of f.decode(t).split("\n"))if(e.startsWith("data: ")){let t=e.slice(6);if("[DONE]"===t)continue;try{let e=JSON.parse(t);!r&&e.model&&(r=e.model),e.usage&&(a=e.usage);let l=e.choices?.[0]?.delta?.content;l&&(s||(s=Date.now()-u),j+=l,o(e=>{let t=[...e];return t[t.length-1]={role:"assistant",content:j,model:r,timeToFirstToken:s},t}))}catch(e){console.error("Error parsing chunk:",e)}}}let v=Date.now()-u;o(e=>{let t=[...e];return t[t.length-1]={...t[t.length-1],totalLatency:v,usage:a},t})}catch(e){"AbortError"===e.name?console.log("Request was cancelled"):(console.error("Error testing prompt:",e),o(t=>{let s=t[t.length-1];return s&&"assistant"===s.role&&""===s.content?[...t.slice(0,-1),{role:"assistant",content:`Error: ${e.message}`}]:[...t,{role:"assistant",content:`Error: ${e.message}`}]}))}finally{a(!1),h(null)}};return{isLoading:r,messages:n,inputMessage:i,variables:d,variablesFilled:p,extractedVariables:f,allVariablesFilled:j,messagesEndRef:g,setInputMessage:c,handleSendMessage:v,handleCancelRequest:()=>{u&&(u.abort(),h(null),a(!1),H.default.info("Request cancelled"))},handleClearConversation:()=>{o([]),x(!1),H.default.success("Chat history cleared.")},handleKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),v())},handleVariableChange:(e,t)=>{m({...d,[e]:t})}}})(e,a);return(0,t.jsxs)("div",{className:"flex flex-col h-full bg-white",children:[!d&&(0,t.jsx)(eP,{extractedVariables:m,variables:c,onVariableChange:v}),o.length>0&&(0,t.jsx)("div",{className:"p-3 border-b border-gray-200 bg-white flex justify-end",children:(0,t.jsx)(r.Button,{onClick:f,className:"bg-gray-100 hover:bg-gray-200 text-gray-700 border-gray-300",icon:e$.ClearOutlined,children:"Clear Chat"})}),(0,t.jsx)(ez,{messages:o,isLoading:n,hasVariables:m.length>0,messagesEndRef:x}),(0,t.jsxs)("div",{className:"p-4 border-t border-gray-200 bg-white",children:[(0,t.jsx)(eR,{extractedVariables:m,variables:c}),(0,t.jsx)(eJ,{inputMessage:i,isLoading:n,isDisabled:n||!i.trim()||m.length>0&&!p,onInputChange:u,onSend:h,onKeyDown:j,onCancel:g})]})]})},eH=({visible:e,promptName:s,isSaving:l,onNameChange:n,onPublish:o,onCancel:i})=>(0,t.jsx)(a.Modal,{title:"Publish Prompt",open:e,onCancel:i,footer:[(0,t.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,t.jsx)(r.Button,{variant:"secondary",onClick:i,children:"Cancel"}),(0,t.jsx)(r.Button,{onClick:o,loading:l,children:"Publish"})]},"footer")],children:(0,t.jsxs)("div",{className:"py-4",children:[(0,t.jsx)(I.Text,{className:"mb-2",children:"Name"}),(0,t.jsx)(ei.Input,{value:s,onChange:e=>n(e.target.value),placeholder:"Enter prompt name",onPressEnter:o,autoFocus:!0}),(0,t.jsx)(I.Text,{className:"text-gray-500 text-xs mt-2",children:"Published prompts can be used in API calls and are versioned for easy tracking."})]})}),eW=({prompt:e})=>{let s=N(e);return(0,t.jsxs)("div",{className:"p-6",children:[(0,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-gray-700 mb-2",children:"Generated .prompt file"}),(0,t.jsx)("p",{className:"text-xs text-gray-500",children:"This is the dotprompt format that will be saved to the database"})]}),(0,t.jsx)("div",{className:"bg-gray-50 border border-gray-200 rounded-lg p-4 overflow-auto",children:(0,t.jsx)("pre",{className:"text-sm text-gray-900 font-mono whitespace-pre-wrap",children:s})})]})};var eK=e.i(608856),eq=e.i(573421),eG=e.i(981339);let{Text:eX}=e.i(898586).Typography,eY=({isOpen:e,onClose:r,accessToken:a,promptId:n,activeVersionId:o,onSelectVersion:i})=>{let[c,d]=(0,s.useState)([]),[m,p]=(0,s.useState)(!1);(0,s.useEffect)(()=>{e&&a&&n&&x()},[e,a,n]);let x=async()=>{p(!0);try{let e=n.includes(".v")?n.split(".v")[0]:n,t=await (0,l.getPromptVersions)(a,e);d(t.prompts)}catch(e){console.error("Error fetching prompt versions:",e)}finally{p(!1)}},u=e=>{if(e.version)return`v${e.version}`;let t=e.litellm_params?.prompt_id||e.prompt_id;return t.includes(".v")?`v${t.split(".v")[1]}`:t.includes("_v")?`v${t.split("_v")[1]}`:"v1"};return(0,t.jsx)(eK.Drawer,{title:"Version History",placement:"right",onClose:r,open:e,width:400,mask:!1,maskClosable:!1,children:m?(0,t.jsx)(eG.Skeleton,{active:!0,paragraph:{rows:4}}):0===c.length?(0,t.jsx)("div",{className:"text-center py-8 text-gray-500",children:"No version history available."}):(0,t.jsx)(eq.List,{dataSource:c,renderItem:(e,s)=>{var r;let a=e.version||parseInt(u(e).replace("v","")),l=null;o&&(o.includes(".v")?l=parseInt(o.split(".v")[1]):o.includes("_v")&&(l=parseInt(o.split("_v")[1])));let n=l?a===l:0===s;return(0,t.jsxs)("div",{className:`mb-4 p-4 rounded-lg border cursor-pointer transition-all hover:shadow-md ${n?"border-blue-500 bg-blue-50":"border-gray-200 bg-white hover:border-blue-300"}`,onClick:()=>i?.(e),children:[(0,t.jsxs)("div",{className:"flex justify-between items-start mb-2",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(eb.Tag,{className:"m-0",children:u(e)}),0===s&&(0,t.jsx)(eb.Tag,{color:"blue",className:"m-0",children:"Latest"})]}),n&&(0,t.jsx)(eb.Tag,{color:"green",className:"m-0",children:"Active"})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)(eX,{className:"text-sm text-gray-600 font-medium",children:(r=e.created_at)?new Date(r).toLocaleString():"-"}),(0,t.jsx)(eX,{type:"secondary",className:"text-xs",children:e.prompt_info?.prompt_type==="db"?"Saved to Database":"Config Prompt"})]})]},`${e.prompt_id}-v${e.version||a}`)}})})},eZ=({onClose:e,onSuccess:r,accessToken:a,initialPromptData:n})=>{let[o,i]=(0,s.useState)((()=>{if(n)try{return C(n)}catch(e){console.error("Error parsing existing prompt:",e),H.default.fromBackend("Failed to parse prompt data")}return{name:"New prompt",model:"gpt-4o",config:{temperature:1,max_tokens:1e3},tools:[],developerMessage:"",messages:[{role:"user",content:"Enter task specifics. Use {{template_variables}} for dynamic inputs"}]}})()),[c,d]=(0,s.useState)(!!n),[m,p]=(0,s.useState)(!1),[x,u]=(0,s.useState)((()=>{if(!n?.prompt_spec)return;let e=n.prompt_spec.prompt_id,t=n.prompt_spec.version||n.prompt_spec.litellm_params?.prompt_id;return"number"==typeof t?`${e}.v${t}`:"string"==typeof t&&(t.includes(".v")||t.includes("_v"))?t:e})()),[h,g]=(0,s.useState)(!1),[f,j]=(0,s.useState)(!1),[v,y]=(0,s.useState)(null),[b,w]=(0,s.useState)(!1),[_,k]=(0,s.useState)("pretty"),T=e=>{void 0!==e?y(e):y(null),g(!0)},S=async()=>{if(!a)return void H.default.fromBackend("Access token is required");if(!o.name||""===o.name.trim())return void H.default.fromBackend("Please enter a valid prompt name");w(!0);try{let t=o.name.replace(/[^a-zA-Z0-9_-]/g,"_").toLowerCase(),s=N(o),i={prompt_id:t,litellm_params:{prompt_integration:"dotprompt",prompt_id:t,dotprompt_content:s},prompt_info:{prompt_type:"db"}};c&&n?.prompt_spec?.prompt_id?(await (0,l.updatePromptCall)(a,n.prompt_spec.prompt_id,i),H.default.success("Prompt updated successfully!")):(await (0,l.createPromptCall)(a,i),H.default.success("Prompt created successfully!")),r(),e()}catch(e){console.error("Error saving prompt:",e),H.default.fromBackend(c?"Failed to update prompt":"Failed to save prompt")}finally{w(!1),j(!1)}},$=x&&x.includes(".v")?`v${x.split(".v")[1]}`:null;return(0,t.jsxs)("div",{className:"flex h-full bg-white",children:[(0,t.jsxs)("div",{className:"flex-1 flex flex-col",children:[(0,t.jsx)(ex,{promptName:o.name,onNameChange:e=>i({...o,name:e}),onBack:e,onSave:()=>{o.name&&""!==o.name.trim()&&"New prompt"!==o.name?S():j(!0)},isSaving:b,editMode:c,onShowHistory:()=>p(!0),version:$,promptModel:o.model,promptVariables:(()=>{let e,t={},s=[o.developerMessage,...o.messages.map(e=>e.content)].join(" "),r=/\{\{(\w+)\}\}/g;for(;null!==(e=r.exec(s));){let s=e[1];t[s]||(t[s]=`example_${s}`)}return t})(),accessToken:a}),(0,t.jsxs)("div",{className:"flex-1 flex overflow-hidden",children:[(0,t.jsxs)("div",{className:"w-1/2 overflow-y-auto bg-white border-r border-gray-200 flex-shrink-0",children:[(0,t.jsxs)("div",{className:"border-b border-gray-200 bg-white px-6 py-4 flex items-center gap-3",children:[(0,t.jsx)(eg,{model:o.model,temperature:o.config.temperature,maxTokens:o.config.max_tokens,accessToken:a,onModelChange:e=>i({...o,model:e}),onTemperatureChange:e=>i({...o,config:{...o.config,temperature:e}}),onMaxTokensChange:e=>i({...o,config:{...o.config,max_tokens:e}})}),(0,t.jsxs)("div",{className:"ml-auto inline-flex items-center bg-gray-200 rounded-full p-0.5",children:[(0,t.jsx)("button",{className:`px-3 py-1 text-xs font-medium rounded-full transition-colors ${"pretty"===_?"bg-white text-gray-900 shadow-sm":"text-gray-600"}`,onClick:()=>k("pretty"),children:"PRETTY"}),(0,t.jsx)("button",{className:`px-3 py-1 text-xs font-medium rounded-full transition-colors ${"dotprompt"===_?"bg-white text-gray-900 shadow-sm":"text-gray-600"}`,onClick:()=>k("dotprompt"),children:"DOTPROMPT"})]})]}),"pretty"===_?(0,t.jsxs)("div",{className:"p-6 space-y-4 pb-20",children:[(0,t.jsx)(ev,{tools:o.tools,onAddTool:()=>T(),onEditTool:T,onRemoveTool:e=>{i({...o,tools:o.tools.filter((t,s)=>s!==e)})}}),(0,t.jsx)(e_,{value:o.developerMessage,onChange:e=>i({...o,developerMessage:e})}),(0,t.jsx)(eS,{messages:o.messages,onAddMessage:()=>{i({...o,messages:[...o.messages,{role:"user",content:""}]})},onUpdateMessage:(e,t,s)=>{let r=[...o.messages];r[e][t]=s,i({...o,messages:r})},onRemoveMessage:e=>{o.messages.length>1&&i({...o,messages:o.messages.filter((t,s)=>s!==e)})},onMoveMessage:(e,t)=>{let s=[...o.messages],[r]=s.splice(e,1);s.splice(t,0,r),i({...o,messages:s})}})]}):(0,t.jsx)(eW,{prompt:o})]}),(0,t.jsx)("div",{className:"w-1/2 flex-shrink-0",children:(0,t.jsx)(eV,{prompt:o,accessToken:a})})]})]}),(0,t.jsx)(eH,{visible:f,promptName:o.name,isSaving:b,onNameChange:e=>i({...o,name:e}),onPublish:S,onCancel:()=>j(!1)}),h&&(0,t.jsx)(eo,{visible:h,initialJson:null!==v?o.tools[v].json:"",onSave:e=>{try{let t=JSON.parse(e),s={name:t.function?.name||"Unnamed Tool",description:t.function?.description||"",json:e};if(null!==v){let e=[...o.tools];e[v]=s,i({...o,tools:e})}else i({...o,tools:[...o.tools,s]});g(!1),y(null)}catch(e){H.default.fromBackend("Invalid JSON format")}},onClose:()=>{g(!1),y(null)}}),(0,t.jsx)(eY,{isOpen:m,onClose:()=>p(!1),accessToken:a,promptId:n?.prompt_spec?.prompt_id||o.name,activeVersionId:x,onSelectVersion:e=>{try{let t=C({prompt_spec:e});i(t);let s=e.version||1;u(`${e.prompt_id}.v${s}`)}catch(e){console.error("Error loading version:",e),H.default.fromBackend("Failed to load prompt version")}}})]})};var eQ=e.i(708347);e.s(["default",0,({accessToken:e,userRole:n})=>{let[o,i]=(0,s.useState)([]),[c,d]=(0,s.useState)(!1),[m,p]=(0,s.useState)(null),[x,u]=(0,s.useState)(!1),[h,g]=(0,s.useState)(!1),[f,j]=(0,s.useState)(null),[v,y]=(0,s.useState)(!1),[b,N]=(0,s.useState)(null),w=!!n&&(0,eQ.isAdminRole)(n),C=async()=>{if(e){d(!0);try{let t=await (0,l.getPromptsList)(e);console.log(`prompts: ${JSON.stringify(t)}`),i(t.prompts)}catch(e){console.error("Error fetching prompts:",e)}finally{d(!1)}}};(0,s.useEffect)(()=>{C()},[e]);let _=()=>{C(),g(!1),j(null),p(null)},k=async()=>{if(b&&e){y(!0);try{await (0,l.deletePromptCall)(e,b.id),H.default.success(`Prompt "${b.name}" deleted successfully`),C()}catch(e){console.error("Error deleting prompt:",e),H.default.fromBackend("Failed to delete prompt")}finally{y(!1),N(null)}}};return(0,t.jsxs)("div",{className:"w-full mx-auto flex-auto overflow-y-auto m-8 p-2",children:[h?(0,t.jsx)(eZ,{onClose:()=>{g(!1),j(null)},onSuccess:_,accessToken:e,initialPromptData:f}):m?(0,t.jsx)(Z,{promptId:m,onClose:()=>p(null),accessToken:e,isAdmin:w,onDelete:C,onEdit:e=>{j(e),g(!0)}}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"flex justify-between items-center mb-4",children:(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(r.Button,{onClick:()=>{m&&p(null),j(null),g(!0)},disabled:!e,children:"+ Add New Prompt"}),(0,t.jsx)(r.Button,{onClick:()=>{m&&p(null),u(!0)},disabled:!e,variant:"secondary",children:"Upload .prompt File"})]})}),(0,t.jsx)(S,{promptsList:o,isLoading:c,onPromptClick:e=>{p(e)},onDeleteClick:(e,t)=>{N({id:e,name:t})},accessToken:e,isAdmin:w})]}),(0,t.jsx)(el,{visible:x,onClose:()=>{u(!1)},accessToken:e,onSuccess:_}),b&&(0,t.jsxs)(a.Modal,{title:"Delete Prompt",open:null!==b,onOk:k,onCancel:()=>{N(null)},confirmLoading:v,okText:"Delete",okButtonProps:{danger:!0},children:[(0,t.jsxs)("p",{children:["Are you sure you want to delete prompt: ",b.name," ?"]}),(0,t.jsx)("p",{children:"This action cannot be undone."})]})]})}],191403)}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/0691430f3293d02d.js b/litellm/proxy/_experimental/out/_next/static/chunks/0691430f3293d02d.js deleted file mode 100644 index 1e9e7af9828..00000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/0691430f3293d02d.js +++ /dev/null @@ -1 +0,0 @@ -(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,988297,e=>{"use strict";var s=e.i(271645);let a=s.forwardRef(function(e,a){return s.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:a},e),s.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4v16m8-8H4"}))});e.s(["PlusIcon",0,a],988297)},500727,e=>{"use strict";var s=e.i(266027),a=e.i(243652),t=e.i(764205),l=e.i(135214);let r=(0,a.createQueryKeys)("mcpServers");e.s(["useMCPServers",0,()=>{let{accessToken:e}=(0,l.default)();return(0,s.useQuery)({queryKey:r.list({}),queryFn:async()=>await (0,t.fetchMCPServers)(e),enabled:!!e})}])},841947,e=>{"use strict";let s=(0,e.i(475254).default)("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);e.s(["default",()=>s])},916940,e=>{"use strict";var s=e.i(843476),a=e.i(271645),t=e.i(199133),l=e.i(764205);e.s(["default",0,({onChange:e,value:r,className:i,accessToken:n,placeholder:c="Select vector stores",disabled:o=!1})=>{let[d,u]=(0,a.useState)([]),[m,p]=(0,a.useState)(!1);return(0,a.useEffect)(()=>{(async()=>{if(n){p(!0);try{let e=await (0,l.vectorStoreListCall)(n);e.data&&u(e.data)}catch(e){console.error("Error fetching vector stores:",e)}finally{p(!1)}}})()},[n]),(0,s.jsx)("div",{children:(0,s.jsx)(t.Select,{mode:"multiple",placeholder:c,onChange:e,value:r,loading:m,className:i,allowClear:!0,options:d.map(e=>({label:`${e.vector_store_name||e.vector_store_id} (${e.vector_store_id})`,value:e.vector_store_id,title:e.vector_store_description||e.vector_store_id})),optionFilterProp:"label",showSearch:!0,style:{width:"100%"},disabled:o})})}])},797672,e=>{"use strict";var s=e.i(271645);let a=s.forwardRef(function(e,a){return s.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:a},e),s.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"}))});e.s(["PencilIcon",0,a],797672)},653496,e=>{"use strict";var s=e.i(721369);e.s(["Tabs",()=>s.default])},689020,e=>{"use strict";var s=e.i(764205);let a=async e=>{try{let a=await (0,s.modelHubCall)(e);if(console.log("model_info:",a),a?.data.length>0){let e=a.data.map(e=>({model_group:e.model_group,mode:e?.mode}));return e.sort((e,s)=>e.model_group.localeCompare(s.model_group)),e}return[]}catch(e){throw console.error("Error fetching model info:",e),e}};e.s(["fetchAvailableModels",0,a])},981339,e=>{"use strict";var s=e.i(185793);e.s(["Skeleton",()=>s.default])},500330,e=>{"use strict";var s=e.i(727749);function a(e,s){let a=structuredClone(e);for(let[e,t]of Object.entries(s))e in a&&(a[e]=t);return a}let t=(e,s=0,a=!1,t=!0)=>{if(null==e||!Number.isFinite(e)||0===e&&!t)return"-";let l={minimumFractionDigits:s,maximumFractionDigits:s};if(!a)return e.toLocaleString("en-US",l);let r=e<0?"-":"",i=Math.abs(e),n=i,c="";return i>=1e6?(n=i/1e6,c="M"):i>=1e3&&(n=i/1e3,c="K"),`${r}${n.toLocaleString("en-US",l)}${c}`},l=async(e,a="Copied to clipboard")=>{if(!e)return!1;if(!navigator||!navigator.clipboard||!navigator.clipboard.writeText)return r(e,a);try{return await navigator.clipboard.writeText(e),s.default.success(a),!0}catch(s){return console.error("Clipboard API failed: ",s),r(e,a)}},r=(e,a)=>{try{let t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.left="-999999px",t.style.top="-999999px",t.setAttribute("readonly",""),document.body.appendChild(t),t.focus(),t.select();let l=document.execCommand("copy");if(document.body.removeChild(t),l)return s.default.success(a),!0;throw Error("execCommand failed")}catch(e){return s.default.fromBackend("Failed to copy to clipboard"),console.error("Failed to copy: ",e),!1}};e.s(["copyToClipboard",0,l,"formatNumberWithCommas",0,t,"getSpendString",0,(e,s=6)=>{if(null==e||!Number.isFinite(e)||0===e)return"-";let a=t(e,s,!1,!1);if(0===Number(a.replace(/,/g,""))){let e=(1/10**s).toFixed(s);return`< $${e}`}return`$${a}`},"updateExistingKeys",()=>a])},552130,e=>{"use strict";var s=e.i(843476),a=e.i(271645),t=e.i(199133),l=e.i(764205);e.s(["default",0,({onChange:e,value:r,className:i,accessToken:n,placeholder:c="Select agents",disabled:o=!1})=>{let[d,u]=(0,a.useState)([]),[m,p]=(0,a.useState)([]),[g,x]=(0,a.useState)(!1);(0,a.useEffect)(()=>{(async()=>{if(n){x(!0);try{let e=await (0,l.getAgentsList)(n),s=e?.agents||[];u(s);let a=new Set;s.forEach(e=>{let s=e.agent_access_groups;s&&Array.isArray(s)&&s.forEach(e=>a.add(e))}),p(Array.from(a))}catch(e){console.error("Error fetching agents:",e)}finally{x(!1)}}})()},[n]);let h=[...m.map(e=>({label:e,value:`group:${e}`,isAccessGroup:!0,searchText:`${e} Access Group`})),...d.map(e=>({label:`${e.agent_name||e.agent_id}`,value:e.agent_id,isAccessGroup:!1,searchText:`${e.agent_name||e.agent_id} ${e.agent_id} Agent`}))],f=[...r?.agents||[],...(r?.accessGroups||[]).map(e=>`group:${e}`)];return(0,s.jsx)("div",{children:(0,s.jsx)(t.Select,{mode:"multiple",placeholder:c,onChange:s=>{e({agents:s.filter(e=>!e.startsWith("group:")),accessGroups:s.filter(e=>e.startsWith("group:")).map(e=>e.replace("group:",""))})},value:f,loading:g,className:i,allowClear:!0,showSearch:!0,style:{width:"100%"},disabled:o,filterOption:(e,s)=>(h.find(e=>e.value===s?.value)?.searchText||"").toLowerCase().includes(e.toLowerCase()),children:h.map(e=>(0,s.jsx)(t.Select.Option,{value:e.value,label:e.label,children:(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[(0,s.jsx)("span",{style:{display:"inline-block",width:8,height:8,borderRadius:"50%",background:e.isAccessGroup?"#52c41a":"#722ed1",flexShrink:0}}),(0,s.jsx)("span",{style:{flex:1},children:e.label}),(0,s.jsx)("span",{style:{color:e.isAccessGroup?"#52c41a":"#722ed1",fontSize:"12px",fontWeight:500,opacity:.8},children:e.isAccessGroup?"Access Group":"Agent"})]})},e.value))})})}])},557662,e=>{"use strict";let s="../ui/assets/logos/",a=[{id:"arize",displayName:"Arize",logo:`${s}arize.png`,supports_key_team_logging:!0,dynamic_params:{arize_api_key:"password",arize_space_id:"password"},description:"Arize Logging Integration"},{id:"braintrust",displayName:"Braintrust",logo:`${s}braintrust.png`,supports_key_team_logging:!1,dynamic_params:{braintrust_api_key:"password",braintrust_project_name:"text"},description:"Braintrust Logging Integration"},{id:"custom_callback_api",displayName:"Custom Callback API",logo:`${s}custom.svg`,supports_key_team_logging:!0,dynamic_params:{custom_callback_api_url:"text",custom_callback_api_headers:"text"},description:"Custom Callback API Logging Integration"},{id:"datadog",displayName:"Datadog",logo:`${s}datadog.png`,supports_key_team_logging:!1,dynamic_params:{dd_api_key:"password",dd_site:"text"},description:"Datadog Logging Integration"},{id:"lago",displayName:"Lago",logo:`${s}lago.svg`,supports_key_team_logging:!1,dynamic_params:{lago_api_url:"text",lago_api_key:"password"},description:"Lago Billing Logging Integration"},{id:"langfuse",displayName:"Langfuse",logo:`${s}langfuse.png`,supports_key_team_logging:!0,dynamic_params:{langfuse_public_key:"text",langfuse_secret_key:"password",langfuse_host:"text"},description:"Langfuse v2 Logging Integration"},{id:"langfuse_otel",displayName:"Langfuse OTEL",logo:`${s}langfuse.png`,supports_key_team_logging:!0,dynamic_params:{langfuse_public_key:"text",langfuse_secret_key:"password",langfuse_host:"text"},description:"Langfuse v3 OTEL Logging Integration"},{id:"langsmith",displayName:"LangSmith",logo:`${s}langsmith.png`,supports_key_team_logging:!0,dynamic_params:{langsmith_api_key:"password",langsmith_project:"text",langsmith_base_url:"text",langsmith_sampling_rate:"number"},description:"Langsmith Logging Integration"},{id:"openmeter",displayName:"OpenMeter",logo:`${s}openmeter.png`,supports_key_team_logging:!1,dynamic_params:{openmeter_api_key:"password",openmeter_base_url:"text"},description:"OpenMeter Logging Integration"},{id:"otel",displayName:"Open Telemetry",logo:`${s}otel.png`,supports_key_team_logging:!1,dynamic_params:{otel_endpoint:"text",otel_headers:"text"},description:"OpenTelemetry Logging Integration"},{id:"s3",displayName:"S3",logo:`${s}aws.svg`,supports_key_team_logging:!1,dynamic_params:{s3_bucket_name:"text",aws_access_key_id:"password",aws_secret_access_key:"password",aws_region:"text"},description:"S3 Bucket (AWS) Logging Integration"},{id:"SQS",displayName:"SQS",logo:`${s}aws.svg`,supports_key_team_logging:!1,dynamic_params:{sqs_queue_url:"text",aws_access_key_id:"password",aws_secret_access_key:"password",aws_region:"text"},description:"SQS Queue (AWS) Logging Integration"}],t=a.reduce((e,s)=>(e[s.displayName]=s,e),{}),l=a.reduce((e,s)=>(e[s.displayName]=s.id,e),{}),r=a.reduce((e,s)=>(e[s.id]=s.displayName,e),{});e.s(["callbackInfo",0,t,"callback_map",0,l,"mapDisplayToInternalNames",0,e=>e.map(e=>l[e]||e),"mapInternalToDisplayNames",0,e=>e.map(e=>r[e]||e),"reverse_callback_map",0,r])},9314,263147,e=>{"use strict";var s=e.i(843476),a=e.i(199133),t=e.i(981339),l=e.i(645526),r=e.i(599724),i=e.i(266027),n=e.i(243652),c=e.i(764205),o=e.i(708347),d=e.i(135214);let u=(0,n.createQueryKeys)("accessGroups"),m=async e=>{let s=(0,c.getProxyBaseUrl)(),a=`${s}/v1/access_group`,t=await fetch(a,{method:"GET",headers:{[(0,c.getGlobalLitellmHeaderName)()]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!t.ok){let e=await t.json(),s=(0,c.deriveErrorMessage)(e);throw(0,c.handleError)(s),Error(s)}return t.json()},p=()=>{let{accessToken:e,userRole:s}=(0,d.default)();return(0,i.useQuery)({queryKey:u.list({}),queryFn:async()=>m(e),enabled:!!e&&o.all_admin_roles.includes(s||"")})};e.s(["accessGroupKeys",0,u,"useAccessGroups",0,p],263147),e.s(["default",0,({value:e,onChange:i,placeholder:n="Select access groups",disabled:c=!1,style:o,className:d,showLabel:u=!1,labelText:m="Access Group",allowClear:g=!0})=>{let{data:x,isLoading:h,isError:f}=p();if(h)return(0,s.jsxs)("div",{children:[u&&(0,s.jsxs)(r.Text,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,s.jsx)(l.TeamOutlined,{className:"mr-2"})," ",m]}),(0,s.jsx)(t.Skeleton.Input,{active:!0,block:!0,style:{height:32,...o}})]});let b=(x??[]).map(e=>({label:(0,s.jsxs)("span",{children:[(0,s.jsx)("span",{className:"font-medium",children:e.access_group_name})," ",(0,s.jsxs)("span",{className:"text-gray-400 text-xs",children:["(",e.access_group_id,")"]})]}),value:e.access_group_id,selectedLabel:e.access_group_name,searchText:`${e.access_group_name} ${e.access_group_id}`}));return(0,s.jsxs)("div",{children:[u&&(0,s.jsxs)(r.Text,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,s.jsx)(l.TeamOutlined,{className:"mr-2"})," ",m]}),(0,s.jsx)(a.Select,{mode:"multiple",value:e,placeholder:n,onChange:i,disabled:c,allowClear:g,showSearch:!0,style:{width:"100%",...o},className:`rounded-md ${d??""}`,notFoundContent:f?(0,s.jsx)("span",{className:"text-red-500",children:"Failed to load access groups"}):"No access groups found",filterOption:(e,s)=>(b.find(e=>e.value===s?.value)?.searchText??"").toLowerCase().includes(e.toLowerCase()),optionLabelProp:"selectedLabel",options:b.map(e=>({label:e.label,value:e.value,selectedLabel:e.selectedLabel}))})]})}],9314)},844565,e=>{"use strict";var s=e.i(843476),a=e.i(271645),t=e.i(199133),l=e.i(764205);e.s(["default",0,({onChange:e,value:r,className:i,accessToken:n,placeholder:c="Select pass through routes",disabled:o=!1,teamId:d})=>{let[u,m]=(0,a.useState)([]),[p,g]=(0,a.useState)(!1);return(0,a.useEffect)(()=>{(async()=>{if(n){g(!0);try{let e=await (0,l.getPassThroughEndpointsCall)(n,d);if(e.endpoints){let s=e.endpoints.flatMap(e=>{let s=e.path,a=e.methods;return a&&a.length>0?a.map(e=>({label:`${e} ${s}`,value:s})):[{label:s,value:s}]});m(s)}}catch(e){console.error("Error fetching pass through routes:",e)}finally{g(!1)}}})()},[n,d]),(0,s.jsx)(t.Select,{mode:"tags",placeholder:c,onChange:e,value:r,loading:p,className:i,allowClear:!0,options:u,optionFilterProp:"label",showSearch:!0,style:{width:"100%"},disabled:o})}])},810757,477386,e=>{"use strict";var s=e.i(271645);let a=s.forwardRef(function(e,a){return s.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:a},e),s.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),s.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}))});e.s(["CogIcon",0,a],810757);let t=s.forwardRef(function(e,a){return s.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:a},e),s.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M18.364 18.364A9 9 0 005.636 5.636m12.728 12.728A9 9 0 015.636 5.636m12.728 12.728L5.636 5.636"}))});e.s(["BanIcon",0,t],477386)},266484,e=>{"use strict";var s=e.i(843476),a=e.i(199133),t=e.i(592968),l=e.i(312361),r=e.i(827252),i=e.i(994388),n=e.i(304967),c=e.i(779241),o=e.i(988297),d=e.i(68155),u=e.i(810757),m=e.i(477386),p=e.i(557662),g=e.i(435451);let{Option:x}=a.Select;e.s(["default",0,({value:e=[],onChange:h,disabledCallbacks:f=[],onDisabledCallbacksChange:b})=>{let y=Object.entries(p.callbackInfo).filter(([e,s])=>s.supports_key_team_logging).map(([e,s])=>e),v=Object.keys(p.callbackInfo),_=e=>{h?.(e)},j=(s,a,t)=>{let l=[...e];if("callback_name"===a){let e=p.callback_map[t]||t;l[s]={...l[s],[a]:e,callback_vars:{}}}else l[s]={...l[s],[a]:t};_(l)},N=(s,a,t)=>{let l=[...e];l[s]={...l[s],callback_vars:{...l[s].callback_vars,[a]:t}},_(l)};return(0,s.jsxs)("div",{className:"space-y-6",children:[(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)(m.BanIcon,{className:"w-5 h-5 text-red-500"}),(0,s.jsx)("span",{className:"text-base font-semibold text-gray-800",children:"Disabled Callbacks"}),(0,s.jsx)(t.Tooltip,{title:"Select callbacks to disable for this key. Disabled callbacks will not receive any logging data.",children:(0,s.jsx)(r.InfoCircleOutlined,{className:"text-gray-400 cursor-help"})})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Disabled Callbacks"}),(0,s.jsx)(a.Select,{mode:"multiple",placeholder:"Select callbacks to disable",value:f,onChange:e=>{let s=(0,p.mapDisplayToInternalNames)(e);b?.(s)},style:{width:"100%"},optionLabelProp:"label",children:v.map(e=>{let a=p.callbackInfo[e]?.logo,l=p.callbackInfo[e]?.description;return(0,s.jsx)(x,{value:e,label:e,children:(0,s.jsx)(t.Tooltip,{title:l,placement:"right",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[a&&(0,s.jsx)("img",{src:a,alt:e,className:"w-4 h-4 object-contain",onError:s=>{let a=s.target,t=a.parentElement;if(t){let s=document.createElement("div");s.className="w-4 h-4 rounded-full bg-gray-200 flex items-center justify-center text-xs",s.textContent=e.charAt(0),t.replaceChild(s,a)}}}),(0,s.jsx)("span",{children:e})]})})},e)})}),(0,s.jsx)("div",{className:"text-xs text-gray-500",children:"Select callbacks that should be disabled for this key. These callbacks will not receive any logging data."})]})]}),(0,s.jsx)(l.Divider,{}),(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)(u.CogIcon,{className:"w-5 h-5 text-blue-500"}),(0,s.jsx)("span",{className:"text-base font-semibold text-gray-800",children:"Logging Integrations"}),(0,s.jsx)(t.Tooltip,{title:"Configure callback logging integrations for this team.",children:(0,s.jsx)(r.InfoCircleOutlined,{className:"text-gray-400 cursor-help"})})]}),(0,s.jsx)(i.Button,{variant:"secondary",onClick:()=>{_([...e,{callback_name:"",callback_type:"success",callback_vars:{}}])},icon:o.PlusIcon,size:"sm",className:"hover:border-blue-400 hover:text-blue-500",type:"button",children:"Add Integration"})]}),(0,s.jsx)("div",{className:"space-y-4",children:e.map((l,o)=>{let u=l.callback_name?Object.entries(p.callback_map).find(([e,s])=>s===l.callback_name)?.[0]:void 0,m=u?p.callbackInfo[u]?.logo:null;return(0,s.jsxs)(n.Card,{className:"border border-gray-200 shadow-sm hover:shadow-md transition-shadow duration-200",decoration:"top",decorationColor:"blue",children:[(0,s.jsxs)("div",{className:"flex justify-between items-start mb-4",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[m&&(0,s.jsx)("img",{src:m,alt:u,className:"w-5 h-5 object-contain"}),(0,s.jsxs)("span",{className:"text-sm font-medium",children:[u||"New Integration"," Configuration"]})]}),(0,s.jsx)(i.Button,{variant:"light",onClick:()=>{_(e.filter((e,s)=>s!==o))},icon:d.TrashIcon,size:"xs",color:"red",className:"hover:bg-red-50",type:"button",children:"Remove"})]}),(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Integration Type"}),(0,s.jsx)(a.Select,{value:u,placeholder:"Select integration",onChange:e=>j(o,"callback_name",e),className:"w-full",optionLabelProp:"label",children:y.map(e=>{let a=p.callbackInfo[e]?.logo,l=p.callbackInfo[e]?.description;return(0,s.jsx)(x,{value:e,label:e,children:(0,s.jsx)(t.Tooltip,{title:l,placement:"right",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[a&&(0,s.jsx)("img",{src:a,alt:e,className:"w-4 h-4 object-contain",onError:s=>{let a=s.target,t=a.parentElement;if(t){let s=document.createElement("div");s.className="w-4 h-4 rounded-full bg-gray-200 flex items-center justify-center text-xs",s.textContent=e.charAt(0),t.replaceChild(s,a)}}}),(0,s.jsx)("span",{children:e})]})})},e)})})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Event Type"}),(0,s.jsxs)(a.Select,{value:l.callback_type,onChange:e=>j(o,"callback_type",e),className:"w-full",children:[(0,s.jsx)(x,{value:"success",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),(0,s.jsx)("span",{children:"Success Only"})]})}),(0,s.jsx)(x,{value:"failure",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-red-500 rounded-full"}),(0,s.jsx)("span",{children:"Failure Only"})]})}),(0,s.jsx)(x,{value:"success_and_failure",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-blue-500 rounded-full"}),(0,s.jsx)("span",{children:"Success & Failure"})]})})]})]})]}),((e,a)=>{if(!e.callback_name)return null;let l=Object.entries(p.callback_map).find(([s,a])=>a===e.callback_name)?.[0];if(!l)return null;let i=p.callbackInfo[l]?.dynamic_params||{};return 0===Object.keys(i).length?null:(0,s.jsxs)("div",{className:"mt-6 pt-4 border-t border-gray-100",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2 mb-4",children:[(0,s.jsx)("div",{className:"w-3 h-3 bg-blue-100 rounded-full flex items-center justify-center",children:(0,s.jsx)("div",{className:"w-1.5 h-1.5 bg-blue-500 rounded-full"})}),(0,s.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Integration Parameters"})]}),(0,s.jsx)("div",{className:"grid grid-cols-1 gap-4",children:Object.entries(i).map(([l,i])=>(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)("label",{className:"text-sm font-medium text-gray-700 capitalize flex items-center space-x-1",children:[(0,s.jsx)("span",{children:l.replace(/_/g," ")}),(0,s.jsx)(t.Tooltip,{title:`Environment variable reference recommended: os.environ/${l.toUpperCase()}`,children:(0,s.jsx)(r.InfoCircleOutlined,{className:"text-gray-400 cursor-help text-xs"})}),"password"===i&&(0,s.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-yellow-100 text-yellow-800",children:"Sensitive"}),"number"===i&&(0,s.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-yellow-100 text-yellow-800",children:"Number"})]}),"number"===i&&(0,s.jsx)("span",{className:"text-xs text-gray-500",children:"Value must be between 0 and 1"}),"number"===i?(0,s.jsx)(g.default,{step:.01,width:400,placeholder:`os.environ/${l.toUpperCase()}`,value:e.callback_vars[l]||"",onChange:e=>N(a,l,e.target.value)}):(0,s.jsx)(c.TextInput,{type:"password"===i?"password":"text",placeholder:`os.environ/${l.toUpperCase()}`,value:e.callback_vars[l]||"",onChange:e=>N(a,l,e.target.value)})]},l))})]})})(l,o)]})]},o)})}),0===e.length&&(0,s.jsxs)("div",{className:"text-center py-12 text-gray-500 border-2 border-dashed border-gray-200 rounded-lg bg-gray-50/50",children:[(0,s.jsx)(u.CogIcon,{className:"w-12 h-12 text-gray-300 mb-3 mx-auto"}),(0,s.jsx)("div",{className:"text-base font-medium mb-1",children:"No logging integrations configured"}),(0,s.jsx)("div",{className:"text-sm text-gray-400",children:'Click "Add Integration" to configure logging for this team'})]})]})}])},75921,e=>{"use strict";var s=e.i(843476),a=e.i(266027),t=e.i(243652),l=e.i(764205),r=e.i(135214);let i=(0,t.createQueryKeys)("mcpAccessGroups");var n=e.i(500727),c=e.i(199133);e.s(["default",0,({onChange:e,value:t,className:o,accessToken:d,placeholder:u="Select MCP servers",disabled:m=!1})=>{let{data:p=[],isLoading:g}=(0,n.useMCPServers)(),{data:x=[],isLoading:h}=(()=>{let{accessToken:e}=(0,r.default)();return(0,a.useQuery)({queryKey:i.list({}),queryFn:async()=>await (0,l.fetchMCPAccessGroups)(e),enabled:!!e})})(),f=[...x.map(e=>({label:e,value:e,isAccessGroup:!0,searchText:`${e} Access Group`})),...p.map(e=>({label:`${e.server_name||e.server_id} (${e.server_id})`,value:e.server_id,isAccessGroup:!1,searchText:`${e.server_name||e.server_id} ${e.server_id} MCP Server`}))],b=[...t?.servers||[],...t?.accessGroups||[]];return(0,s.jsx)("div",{children:(0,s.jsx)(c.Select,{mode:"multiple",placeholder:u,onChange:s=>{e({servers:s.filter(e=>!x.includes(e)),accessGroups:s.filter(e=>x.includes(e))})},value:b,loading:g||h,className:o,allowClear:!0,showSearch:!0,style:{width:"100%"},disabled:m,filterOption:(e,s)=>(f.find(e=>e.value===s?.value)?.searchText||"").toLowerCase().includes(e.toLowerCase()),children:f.map(e=>(0,s.jsx)(c.Select.Option,{value:e.value,label:e.label,children:(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[(0,s.jsx)("span",{style:{display:"inline-block",width:8,height:8,borderRadius:"50%",background:e.isAccessGroup?"#52c41a":"#1890ff",flexShrink:0}}),(0,s.jsx)("span",{style:{flex:1},children:e.label}),(0,s.jsx)("span",{style:{color:e.isAccessGroup?"#52c41a":"#1890ff",fontSize:"12px",fontWeight:500,opacity:.8},children:e.isAccessGroup?"Access Group":"MCP Server"})]})},e.value))})})}],75921)},390605,995926,e=>{"use strict";var s=e.i(843476),a=e.i(271645),t=e.i(764205),l=e.i(599724),r=e.i(482725),i=e.i(536916),n=e.i(841947);e.s(["XIcon",()=>n.default],995926);var n=n,c=e.i(500727);e.s(["default",0,({accessToken:e,selectedServers:o,toolPermissions:d,onChange:u,disabled:m=!1})=>{let{data:p=[]}=(0,c.useMCPServers)(),[g,x]=(0,a.useState)({}),[h,f]=(0,a.useState)({}),[b,y]=(0,a.useState)({}),v=(0,a.useMemo)(()=>0===o.length?[]:p.filter(e=>o.includes(e.server_id)),[p,o]),_=async s=>{f(e=>({...e,[s]:!0})),y(e=>({...e,[s]:""}));try{let a=await (0,t.listMCPTools)(e,s);a.error?(y(e=>({...e,[s]:a.message||"Failed to fetch tools"})),x(e=>({...e,[s]:[]}))):x(e=>({...e,[s]:a.tools||[]}))}catch(e){console.error(`Error fetching tools for server ${s}:`,e),y(e=>({...e,[s]:"Failed to fetch tools"})),x(e=>({...e,[s]:[]}))}finally{f(e=>({...e,[s]:!1}))}};return((0,a.useEffect)(()=>{v.forEach(e=>{g[e.server_id]||h[e.server_id]||_(e.server_id)})},[v]),0===o.length)?null:(0,s.jsx)("div",{className:"space-y-4",children:v.map(e=>{let a=e.server_name||e.alias||e.server_id,t=g[e.server_id]||[],c=d[e.server_id]||[],o=h[e.server_id],p=b[e.server_id];return(0,s.jsxs)("div",{className:"border rounded-lg bg-gray-50",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between p-4 border-b bg-white rounded-t-lg",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(l.Text,{className:"font-semibold text-gray-900",children:a}),e.description&&(0,s.jsx)(l.Text,{className:"text-sm text-gray-500",children:e.description})]}),(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)("button",{type:"button",className:"text-sm text-blue-600 hover:text-blue-700 font-medium",onClick:()=>{var s;let a;return a=g[s=e.server_id]||[],void u({...d,[s]:a.map(e=>e.name)})},disabled:m||o,children:"Select All"}),(0,s.jsx)("button",{type:"button",className:"text-sm text-blue-600 hover:text-blue-700 font-medium",onClick:()=>{var s;return s=e.server_id,void u({...d,[s]:[]})},disabled:m||o,children:"Deselect All"}),(0,s.jsx)("button",{type:"button",className:"text-gray-400 hover:text-gray-600",onClick:()=>{},children:(0,s.jsx)(n.default,{className:"w-4 h-4"})})]})]}),(0,s.jsxs)("div",{className:"p-4",children:[(0,s.jsx)(l.Text,{className:"text-sm font-medium text-gray-700 mb-3",children:"Available Tools"}),o&&(0,s.jsxs)("div",{className:"flex items-center justify-center py-8",children:[(0,s.jsx)(r.Spin,{size:"large"}),(0,s.jsx)(l.Text,{className:"ml-3 text-gray-500",children:"Loading tools..."})]}),p&&!o&&(0,s.jsxs)("div",{className:"p-4 bg-red-50 border border-red-200 rounded-lg text-center",children:[(0,s.jsx)(l.Text,{className:"text-red-600 font-medium",children:"Unable to load tools"}),(0,s.jsx)(l.Text,{className:"text-sm text-red-500 mt-1",children:p})]}),!o&&!p&&t.length>0&&(0,s.jsx)("div",{className:"space-y-2",children:t.map(a=>{let t=c.includes(a.name);return(0,s.jsxs)("div",{className:"flex items-start gap-2",children:[(0,s.jsx)(i.Checkbox,{checked:t,onChange:()=>{var s,t;let l,r;return s=e.server_id,t=a.name,r=(l=d[s]||[]).includes(t)?l.filter(e=>e!==t):[...l,t],void u({...d,[s]:r})},disabled:m}),(0,s.jsx)("div",{className:"flex-1 min-w-0",children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(l.Text,{className:"font-medium text-gray-900",children:a.name}),(0,s.jsxs)(l.Text,{className:"text-sm text-gray-500",children:["- ",a.description||"No description"]})]})})]},a.name)})}),!o&&!p&&0===t.length&&(0,s.jsx)("div",{className:"text-center py-6",children:(0,s.jsx)(l.Text,{className:"text-gray-500",children:"No tools available"})})]})]},e.server_id)})})}],390605)}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/06cdd9bb80c63794.js b/litellm/proxy/_experimental/out/_next/static/chunks/06cdd9bb80c63794.js deleted file mode 100644 index 561fad46613..00000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/06cdd9bb80c63794.js +++ /dev/null @@ -1,84 +0,0 @@ -(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,826910,e=>{"use strict";var t=e.i(201072);e.s(["CheckCircleFilled",()=>t.default])},185357,180766,782719,969641,476993,824296,64352,266537,230312,e=>{"use strict";var t,a,l=e.i(843476),r=e.i(808613),i=e.i(311451),s=e.i(212931),n=e.i(199133),o=e.i(262218),d=e.i(898586),c=e.i(464571),m=e.i(271645),u=e.i(727749),p=e.i(764205),g=e.i(770914),x=e.i(515831),h=e.i(175712),f=e.i(646563),y=e.i(519756);let{Text:j}=d.Typography,{Option:_}=n.Select,v=({visible:e,prebuiltPatterns:t,categories:a,selectedPatternName:r,patternAction:i,onPatternNameChange:o,onActionChange:d,onAdd:m,onCancel:u})=>(0,l.jsxs)(s.Modal,{title:"Add prebuilt pattern",open:e,onCancel:u,footer:null,width:800,children:[(0,l.jsxs)(g.Space,{direction:"vertical",style:{width:"100%"},size:"large",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)(j,{strong:!0,children:"Pattern type"}),(0,l.jsx)(n.Select,{placeholder:"Choose pattern type",value:r,onChange:o,style:{width:"100%",marginTop:8},showSearch:!0,filterOption:(e,a)=>{let l=t.find(e=>e.name===a?.value);return!!l&&(l.display_name.toLowerCase().includes(e.toLowerCase())||l.name.toLowerCase().includes(e.toLowerCase()))},children:a.map(e=>{let a=t.filter(t=>t.category===e);return 0===a.length?null:(0,l.jsx)(n.Select.OptGroup,{label:e,children:a.map(e=>(0,l.jsx)(_,{value:e.name,children:e.display_name},e.name))},e)})})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)(j,{strong:!0,children:"Action"}),(0,l.jsx)(j,{type:"secondary",style:{display:"block",marginTop:4,marginBottom:8},children:"Choose what action the guardrail should take when this pattern is detected"}),(0,l.jsxs)(n.Select,{value:i,onChange:d,style:{width:"100%"},children:[(0,l.jsx)(_,{value:"BLOCK",children:"Block"}),(0,l.jsx)(_,{value:"MASK",children:"Mask"})]})]})]}),(0,l.jsxs)("div",{style:{display:"flex",justifyContent:"flex-end",gap:"8px",marginTop:"24px"},children:[(0,l.jsx)(c.Button,{onClick:u,children:"Cancel"}),(0,l.jsx)(c.Button,{type:"primary",onClick:m,children:"Add"})]})]}),{Text:b}=d.Typography,{Option:C}=n.Select,S=({visible:e,patternName:t,patternRegex:a,patternAction:r,onNameChange:o,onRegexChange:d,onActionChange:m,onAdd:u,onCancel:p})=>(0,l.jsxs)(s.Modal,{title:"Add custom regex pattern",open:e,onCancel:p,footer:null,width:800,children:[(0,l.jsxs)(g.Space,{direction:"vertical",style:{width:"100%"},size:"large",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)(b,{strong:!0,children:"Pattern name"}),(0,l.jsx)(i.Input,{placeholder:"e.g., internal_id, employee_code",value:t,onChange:e=>o(e.target.value),style:{marginTop:8}})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)(b,{strong:!0,children:"Regex pattern"}),(0,l.jsx)(i.Input,{placeholder:"e.g., ID-[0-9]{6}",value:a,onChange:e=>d(e.target.value),style:{marginTop:8}}),(0,l.jsx)(b,{type:"secondary",style:{fontSize:12},children:"Enter a valid regular expression to match sensitive data"})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)(b,{strong:!0,children:"Action"}),(0,l.jsx)(b,{type:"secondary",style:{display:"block",marginTop:4,marginBottom:8},children:"Choose what action the guardrail should take when this pattern is detected"}),(0,l.jsxs)(n.Select,{value:r,onChange:m,style:{width:"100%"},children:[(0,l.jsx)(C,{value:"BLOCK",children:"Block"}),(0,l.jsx)(C,{value:"MASK",children:"Mask"})]})]})]}),(0,l.jsxs)("div",{style:{display:"flex",justifyContent:"flex-end",gap:"8px",marginTop:"24px"},children:[(0,l.jsx)(c.Button,{onClick:p,children:"Cancel"}),(0,l.jsx)(c.Button,{type:"primary",onClick:u,children:"Add"})]})]}),{Text:N}=d.Typography,{Option:w}=n.Select,k=({visible:e,keyword:t,action:a,description:r,onKeywordChange:o,onActionChange:d,onDescriptionChange:m,onAdd:u,onCancel:p})=>(0,l.jsxs)(s.Modal,{title:"Add blocked keyword",open:e,onCancel:p,footer:null,width:800,children:[(0,l.jsxs)(g.Space,{direction:"vertical",style:{width:"100%"},size:"large",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)(N,{strong:!0,children:"Keyword"}),(0,l.jsx)(i.Input,{placeholder:"Enter sensitive keyword or phrase",value:t,onChange:e=>o(e.target.value),style:{marginTop:8}})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)(N,{strong:!0,children:"Action"}),(0,l.jsx)(N,{type:"secondary",style:{display:"block",marginTop:4,marginBottom:8},children:"Choose what action the guardrail should take when this keyword is detected"}),(0,l.jsxs)(n.Select,{value:a,onChange:d,style:{width:"100%"},children:[(0,l.jsx)(w,{value:"BLOCK",children:"Block"}),(0,l.jsx)(w,{value:"MASK",children:"Mask"})]})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)(N,{strong:!0,children:"Description (optional)"}),(0,l.jsx)(i.Input.TextArea,{placeholder:"Explain why this keyword is sensitive",value:r,onChange:e=>m(e.target.value),rows:3,style:{marginTop:8}})]})]}),(0,l.jsxs)("div",{style:{display:"flex",justifyContent:"flex-end",gap:"8px",marginTop:"24px"},children:[(0,l.jsx)(c.Button,{onClick:p,children:"Cancel"}),(0,l.jsx)(c.Button,{type:"primary",onClick:u,children:"Add"})]})]});var I=e.i(291542),O=e.i(955135);let{Text:T}=d.Typography,{Option:A}=n.Select,P=({patterns:e,onActionChange:t,onRemove:a})=>{let r=[{title:"Type",dataIndex:"type",key:"type",width:100,render:e=>(0,l.jsx)(o.Tag,{color:"prebuilt"===e?"blue":"green",children:"prebuilt"===e?"Prebuilt":"Custom"})},{title:"Pattern name",dataIndex:"name",key:"name",render:(e,t)=>t.display_name||t.name},{title:"Regex pattern",dataIndex:"pattern",key:"pattern",render:e=>e?(0,l.jsxs)(T,{code:!0,style:{fontSize:12},children:[e.substring(0,40),"..."]}):"-"},{title:"Action",dataIndex:"action",key:"action",width:150,render:(e,a)=>(0,l.jsxs)(n.Select,{value:e,onChange:e=>t(a.id,e),style:{width:120},size:"small",children:[(0,l.jsx)(A,{value:"BLOCK",children:"Block"}),(0,l.jsx)(A,{value:"MASK",children:"Mask"})]})},{title:"",key:"actions",width:100,render:(e,t)=>(0,l.jsx)(c.Button,{type:"text",danger:!0,size:"small",icon:(0,l.jsx)(O.DeleteOutlined,{}),onClick:()=>a(t.id),children:"Delete"})}];return 0===e.length?(0,l.jsx)("div",{style:{textAlign:"center",padding:"40px 0",color:"#999"},children:"No patterns added."}):(0,l.jsx)(I.Table,{dataSource:e,columns:r,rowKey:"id",pagination:!1,size:"small"})},{Text:B}=d.Typography,{Option:L}=n.Select,F=({keywords:e,onActionChange:t,onRemove:a})=>{let r=[{title:"Keyword",dataIndex:"keyword",key:"keyword"},{title:"Action",dataIndex:"action",key:"action",width:150,render:(e,a)=>(0,l.jsxs)(n.Select,{value:e,onChange:e=>t(a.id,"action",e),style:{width:120},size:"small",children:[(0,l.jsx)(L,{value:"BLOCK",children:"Block"}),(0,l.jsx)(L,{value:"MASK",children:"Mask"})]})},{title:"Description",dataIndex:"description",key:"description",render:e=>e||"-"},{title:"",key:"actions",width:100,render:(e,t)=>(0,l.jsx)(c.Button,{type:"text",danger:!0,size:"small",icon:(0,l.jsx)(O.DeleteOutlined,{}),onClick:()=>a(t.id),children:"Delete"})}];return 0===e.length?(0,l.jsx)("div",{style:{textAlign:"center",padding:"40px 0",color:"#999"},children:"No keywords added."}):(0,l.jsx)(I.Table,{dataSource:e,columns:r,rowKey:"id",pagination:!1,size:"small"})};var E=e.i(362024),z=e.i(993914);let{Title:M,Text:$}=d.Typography,{Option:R}=n.Select,G=({availableCategories:e,selectedCategories:t,onCategoryAdd:a,onCategoryRemove:r,onCategoryUpdate:i,accessToken:s,pendingSelection:d,onPendingSelectionChange:u})=>{let[g,x]=m.default.useState(""),y=void 0!==d?d:g,j=u||x,[_,v]=m.default.useState({}),[b,C]=m.default.useState({}),[S,N]=m.default.useState({}),[w,k]=m.default.useState([]),[T,A]=m.default.useState(""),[P,B]=m.default.useState(!1),L=async e=>{if(s&&!_[e]){N(t=>({...t,[e]:!0}));try{let t=await (0,p.getCategoryYaml)(s,e),a=t.yaml_content;if("json"===t.file_type)try{let e=JSON.parse(a);a=JSON.stringify(e,null,2)}catch(t){console.warn(`Failed to format JSON for ${e}:`,t)}v(t=>({...t,[e]:a})),C(a=>({...a,[e]:t.file_type||"yaml"}))}catch(t){console.error(`Failed to fetch content for category ${e}:`,t)}finally{N(t=>({...t,[e]:!1}))}}};m.default.useEffect(()=>{if(y&&s){let e=_[y];if(e)return void A(e);B(!0),console.log(`Fetching content for category: ${y}`,{accessToken:s?"present":"missing"}),(0,p.getCategoryYaml)(s,y).then(e=>{console.log(`Successfully fetched content for ${y}:`,e);let t=e.yaml_content;if("json"===e.file_type)try{let e=JSON.parse(t);t=JSON.stringify(e,null,2)}catch(e){console.warn(`Failed to format JSON for ${y}:`,e)}A(t),v(e=>({...e,[y]:t})),C(t=>({...t,[y]:e.file_type||"yaml"}))}).catch(e=>{console.error(`Failed to fetch preview content for category ${y}:`,e),A("")}).finally(()=>{B(!1)})}else A(""),B(!1)},[y,s]);let F=[{title:"Category",dataIndex:"display_name",key:"display_name",render:(t,a)=>{let r=e.find(e=>e.name===a.category);return(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{style:{fontWeight:500},children:t}),r?.description&&(0,l.jsx)("div",{style:{fontSize:"12px",color:"#888",marginTop:"4px"},children:r.description})]})}},{title:"Action",dataIndex:"action",key:"action",width:150,render:(e,t)=>(0,l.jsxs)(n.Select,{value:e,onChange:e=>i(t.id,"action",e),style:{width:"100%"},children:[(0,l.jsx)(R,{value:"BLOCK",children:(0,l.jsx)(o.Tag,{color:"red",children:"BLOCK"})}),(0,l.jsx)(R,{value:"MASK",children:(0,l.jsx)(o.Tag,{color:"orange",children:"MASK"})})]})},{title:"Severity Threshold",dataIndex:"severity_threshold",key:"severity_threshold",width:180,render:(e,t)=>(0,l.jsxs)(n.Select,{value:e,onChange:e=>i(t.id,"severity_threshold",e),style:{width:"100%"},children:[(0,l.jsx)(R,{value:"low",children:"Low"}),(0,l.jsx)(R,{value:"medium",children:"Medium"}),(0,l.jsx)(R,{value:"high",children:"High"})]})},{title:"",key:"actions",width:80,render:(e,t)=>(0,l.jsx)(c.Button,{icon:(0,l.jsx)(O.DeleteOutlined,{}),onClick:()=>r(t.id),size:"small",children:"Remove"})}],G=e.filter(e=>!t.some(t=>t.category===e.name));return(0,l.jsxs)(h.Card,{title:(0,l.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",flexWrap:"wrap",gap:8},children:[(0,l.jsx)(M,{level:5,style:{margin:0},children:"Blocked topics"}),(0,l.jsx)($,{type:"secondary",style:{fontSize:12,fontWeight:400},children:"Select topics to block using keyword and semantic analysis"})]}),size:"small",children:[(0,l.jsxs)("div",{style:{marginBottom:16,display:"flex",gap:8},children:[(0,l.jsx)(n.Select,{placeholder:"Select a content category",value:y||void 0,onChange:j,style:{flex:1},showSearch:!0,optionLabelProp:"label",filterOption:(e,t)=>(t?.label?.toString().toLowerCase()??"").includes(e.toLowerCase()),children:G.map(e=>(0,l.jsx)(R,{value:e.name,label:e.display_name,children:(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{style:{fontWeight:500},children:e.display_name}),(0,l.jsx)("div",{style:{fontSize:"12px",color:"#666",marginTop:"2px"},children:e.description})]})},e.name))}),(0,l.jsx)(c.Button,{type:"primary",onClick:()=>{if(!y)return;let l=e.find(e=>e.name===y);!l||t.some(e=>e.category===y)||(a({id:`category-${Date.now()}`,category:l.name,display_name:l.display_name,action:l.default_action,severity_threshold:"medium"}),j(""),A(""))},disabled:!y,icon:(0,l.jsx)(f.PlusOutlined,{}),children:"Add"})]}),y&&(0,l.jsxs)("div",{style:{marginBottom:16,padding:"12px",background:"#f9f9f9",border:"1px solid #e0e0e0",borderRadius:"4px"},children:[(0,l.jsxs)("div",{style:{marginBottom:8,fontWeight:500,fontSize:"14px"},children:["Preview: ",e.find(e=>e.name===y)?.display_name,b[y]&&(0,l.jsxs)("span",{style:{marginLeft:8,fontSize:"12px",color:"#888",fontWeight:400},children:["(",b[y]?.toUpperCase(),")"]})]}),P?(0,l.jsx)("div",{style:{padding:"16px",textAlign:"center",color:"#888"},children:"Loading content..."}):T?(0,l.jsx)("pre",{style:{background:"#fff",padding:"12px",borderRadius:"4px",overflow:"auto",maxHeight:"300px",maxWidth:"100%",fontSize:"12px",lineHeight:"1.5",margin:0,border:"1px solid #e0e0e0",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:(0,l.jsx)("code",{children:T})}):(0,l.jsx)("div",{style:{padding:"8px",textAlign:"center",color:"#888",fontSize:"12px"},children:"Unable to load category content"})]}),t.length>0?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(I.Table,{dataSource:t,columns:F,pagination:!1,size:"small",rowKey:"id"}),(0,l.jsx)("div",{style:{marginTop:16},children:(0,l.jsx)(E.Collapse,{activeKey:w,onChange:e=>{let t=Array.isArray(e)?e:e?[e]:[],a=new Set(w);t.forEach(e=>{a.has(e)||_[e]||L(e)}),k(t)},ghost:!0,items:t.map(e=>{let t=(b[e.category]||"yaml").toUpperCase();return{key:e.category,label:(0,l.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8},children:[(0,l.jsx)(z.FileTextOutlined,{}),(0,l.jsxs)("span",{children:["View ",t," for ",e.display_name]})]}),children:S[e.category]?(0,l.jsx)("div",{style:{padding:"16px",textAlign:"center",color:"#888"},children:"Loading content..."}):_[e.category]?(0,l.jsx)("pre",{style:{background:"#f5f5f5",padding:"16px",borderRadius:"4px",overflow:"auto",maxHeight:"400px",fontSize:"12px",lineHeight:"1.5",margin:0},children:(0,l.jsx)("code",{children:_[e.category]})}):(0,l.jsx)("div",{style:{padding:"16px",textAlign:"center",color:"#888"},children:"Content will load when expanded"})}})})})]}):(0,l.jsx)("div",{style:{textAlign:"center",padding:"24px",color:"#888",border:"1px dashed #d9d9d9",borderRadius:"4px"},children:"No blocked topics selected. Add topics to detect and block harmful content."})]})};var D=e.i(790848),K=e.i(28651);let{Title:J,Text:q}=d.Typography,{Option:W}=n.Select,H={competitor_intent_type:"airline",brand_self:[],locations:[],policy:{competitor_comparison:"refuse",possible_competitor_comparison:"reframe"},threshold_high:.7,threshold_medium:.45,threshold_low:.3},U=({enabled:e,config:t,onChange:a,accessToken:i})=>{let s=t??H,[o,d]=(0,m.useState)([]),[c,u]=(0,m.useState)(!1);(0,m.useEffect)(()=>{"airline"===s.competitor_intent_type&&i&&0===o.length&&(u(!0),(0,p.getMajorAirlines)(i).then(e=>d(e.airlines??[])).catch(()=>d([])).finally(()=>u(!1)))},[s.competitor_intent_type,i,o.length]);let x=e=>{a(e,e?{...H}:null)},f=(t,l)=>{a(e,{...s,[t]:l})},y=(t,l)=>{a(e,{...s,policy:{...s.policy,[t]:l}})},j=(t,l)=>{a(e,{...s,[t]:l.filter(Boolean)})};return e?(0,l.jsxs)(h.Card,{title:(0,l.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,l.jsx)(J,{level:5,style:{margin:0},children:"Competitor Intent Filter"}),(0,l.jsx)(D.Switch,{checked:e,onChange:x})]}),size:"small",children:[(0,l.jsx)(q,{type:"secondary",style:{display:"block",marginBottom:16},children:"Block or reframe competitor comparison questions. Airline type uses major airlines (excluding your brand); generic requires manual competitor list."}),(0,l.jsxs)(r.Form,{layout:"vertical",size:"small",children:[(0,l.jsx)(r.Form.Item,{label:"Type",children:(0,l.jsxs)(n.Select,{value:s.competitor_intent_type,onChange:e=>f("competitor_intent_type",e),style:{width:"100%"},children:[(0,l.jsx)(W,{value:"airline",children:"Airline (auto-load competitors from IATA)"}),(0,l.jsx)(W,{value:"generic",children:"Generic (specify competitors manually)"})]})}),(0,l.jsx)(r.Form.Item,{label:"Your Brand (brand_self)",required:!0,help:"airline"===s.competitor_intent_type?"Select your airline from the list (excluded from competitors) or type to add a custom term":"Names/codes users use for your brand",children:(0,l.jsx)(n.Select,{mode:"tags",style:{width:"100%"},placeholder:c?"Loading airlines...":"airline"===s.competitor_intent_type?"Search or select airline, or type to add custom":"Type and press Enter to add",value:s.brand_self,onChange:t=>"airline"===s.competitor_intent_type&&o.length>0?(t=>{let l=t.filter(Boolean),r=[],i=new Set;for(let e of l){let t=o.find(t=>t.match.split("|")[0]?.trim().toLowerCase()===e.toLowerCase());if(t)for(let e of t.match.split("|").map(e=>e.trim().toLowerCase()).filter(Boolean))i.has(e)||(i.add(e),r.push(e));else i.has(e.toLowerCase())||(i.add(e.toLowerCase()),r.push(e))}a(e,{...s,brand_self:r})})(t??[]):j("brand_self",t??[]),tokenSeparators:[","],loading:c,showSearch:!0,filterOption:(e,t)=>(t?.label?.toString().toLowerCase()??"").includes(e.toLowerCase()),optionFilterProp:"label",options:"airline"===s.competitor_intent_type&&o.length>0?o.map(e=>{let t=e.match.split("|")[0]?.trim()??e.id,a=e.match.split("|").map(e=>e.trim().toLowerCase()).filter(Boolean);return{value:t.toLowerCase(),label:`${t}${a.length>1?` (${a.slice(1).join(", ")})`:""}`}}):void 0})}),"airline"===s.competitor_intent_type&&(0,l.jsx)(r.Form.Item,{label:"Locations (optional)",help:"Countries, cities, airports for disambiguation (e.g. qatar, doha)",children:(0,l.jsx)(n.Select,{mode:"tags",style:{width:"100%"},placeholder:"Type and press Enter to add",value:s.locations??[],onChange:e=>j("locations",e??[]),tokenSeparators:[","]})}),"generic"===s.competitor_intent_type&&(0,l.jsx)(r.Form.Item,{label:"Competitors",required:!0,help:"Competitor names to detect (required for generic type)",children:(0,l.jsx)(n.Select,{mode:"tags",style:{width:"100%"},placeholder:"Type and press Enter to add",value:s.competitors??[],onChange:e=>j("competitors",e??[]),tokenSeparators:[","]})}),(0,l.jsx)(r.Form.Item,{label:"Policy: Competitor comparison",children:(0,l.jsxs)(n.Select,{value:s.policy?.competitor_comparison??"refuse",onChange:e=>y("competitor_comparison",e),style:{width:"100%"},children:[(0,l.jsx)(W,{value:"refuse",children:"Refuse (block request)"}),(0,l.jsx)(W,{value:"reframe",children:"Reframe (suggest alternative)"})]})}),(0,l.jsx)(r.Form.Item,{label:"Policy: Possible competitor comparison",children:(0,l.jsxs)(n.Select,{value:s.policy?.possible_competitor_comparison??"reframe",onChange:e=>y("possible_competitor_comparison",e),style:{width:"100%"},children:[(0,l.jsx)(W,{value:"refuse",children:"Refuse (block request)"}),(0,l.jsx)(W,{value:"reframe",children:"Reframe (suggest alternative to backend LLM)"})]})}),(0,l.jsx)(r.Form.Item,{label:"Confidence thresholds",help:(0,l.jsxs)(l.Fragment,{children:["Classify competitor intent by confidence (0–1). Higher confidence → stronger intent.",(0,l.jsxs)("ul",{style:{marginBottom:0,marginTop:4,paddingLeft:20},children:[(0,l.jsxs)("li",{children:[(0,l.jsx)("strong",{children:"High (≥)"}),': Treat as full competitor comparison → uses "Competitor comparison" policy']}),(0,l.jsxs)("li",{children:[(0,l.jsx)("strong",{children:"Medium (≥)"}),': Treat as possible comparison → uses "Possible competitor comparison" policy']}),(0,l.jsxs)("li",{children:[(0,l.jsx)("strong",{children:"Low (≥)"}),": Log only; allow request. Below Low → allow with no action"]})]}),"Raise thresholds to be more permissive; lower them to be stricter."]}),children:(0,l.jsxs)(g.Space,{wrap:!0,children:[(0,l.jsx)(r.Form.Item,{label:"High",style:{marginBottom:0},help:"e.g. 0.7",children:(0,l.jsx)(K.InputNumber,{min:0,max:1,step:.05,value:s.threshold_high??.7,onChange:e=>f("threshold_high",e??.7),style:{width:80}})}),(0,l.jsx)(r.Form.Item,{label:"Medium",style:{marginBottom:0},help:"e.g. 0.45",children:(0,l.jsx)(K.InputNumber,{min:0,max:1,step:.05,value:s.threshold_medium??.45,onChange:e=>f("threshold_medium",e??.45),style:{width:80}})}),(0,l.jsx)(r.Form.Item,{label:"Low",style:{marginBottom:0},help:"e.g. 0.3",children:(0,l.jsx)(K.InputNumber,{min:0,max:1,step:.05,value:s.threshold_low??.3,onChange:e=>f("threshold_low",e??.3),style:{width:80}})})]})})]})]}):(0,l.jsx)(h.Card,{title:(0,l.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,l.jsx)(J,{level:5,style:{margin:0},children:"Competitor Intent Filter"}),(0,l.jsx)(D.Switch,{checked:!1,onChange:x})]}),size:"small",children:(0,l.jsx)(q,{type:"secondary",children:"Block or reframe competitor comparison questions. When enabled, airline type auto-loads competitors from IATA; generic type requires manual competitor list."})})},{Title:V,Text:Y}=d.Typography,Z=({prebuiltPatterns:e,categories:t,selectedPatterns:a,blockedWords:r,onPatternAdd:i,onPatternRemove:s,onPatternActionChange:n,onBlockedWordAdd:o,onBlockedWordRemove:d,onBlockedWordUpdate:j,onFileUpload:_,accessToken:b,showStep:C,contentCategories:N=[],selectedContentCategories:w=[],onContentCategoryAdd:I,onContentCategoryRemove:O,onContentCategoryUpdate:T,pendingCategorySelection:A,onPendingCategorySelectionChange:B,competitorIntentEnabled:L=!1,competitorIntentConfig:E=null,onCompetitorIntentChange:z})=>{let[M,$]=(0,m.useState)(!1),[R,D]=(0,m.useState)(!1),[K,J]=(0,m.useState)(!1),[q,W]=(0,m.useState)(""),[H,Z]=(0,m.useState)("BLOCK"),[Q,X]=(0,m.useState)(""),[ee,et]=(0,m.useState)(""),[ea,el]=(0,m.useState)("BLOCK"),[er,ei]=(0,m.useState)(""),[es,en]=(0,m.useState)("BLOCK"),[eo,ed]=(0,m.useState)(""),[ec,em]=(0,m.useState)(!1),eu=async e=>{em(!0);try{let t=await e.text();if(b){let e=await (0,p.validateBlockedWordsFile)(b,t);if(e.valid)_&&_(t),u.default.success(e.message||"File uploaded successfully");else{let t=e.error||e.errors&&e.errors.join(", ")||"Invalid file";u.default.error(`Validation failed: ${t}`)}}}catch(e){u.default.error(`Failed to upload file: ${e}`)}finally{em(!1)}return!1};return(0,l.jsxs)("div",{className:"space-y-6",children:[!C&&(0,l.jsx)("div",{children:(0,l.jsx)(Y,{type:"secondary",children:"Configure patterns, keywords, and content categories to detect and filter sensitive information in requests and responses."})}),(!C||"patterns"===C)&&(0,l.jsxs)(h.Card,{title:(0,l.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,l.jsx)(V,{level:5,style:{margin:0},children:"Pattern Detection"}),(0,l.jsx)(Y,{type:"secondary",style:{fontSize:14,fontWeight:400},children:"Detect sensitive information using regex patterns (SSN, credit cards, API keys, etc.)"})]}),size:"small",children:[(0,l.jsx)("div",{style:{marginBottom:16},children:(0,l.jsxs)(g.Space,{children:[(0,l.jsx)(c.Button,{type:"primary",onClick:()=>$(!0),icon:(0,l.jsx)(f.PlusOutlined,{}),children:"Add prebuilt pattern"}),(0,l.jsx)(c.Button,{onClick:()=>J(!0),icon:(0,l.jsx)(f.PlusOutlined,{}),children:"Add custom regex"})]})}),(0,l.jsx)(P,{patterns:a,onActionChange:n,onRemove:s})]}),(!C||"keywords"===C)&&(0,l.jsxs)(h.Card,{title:(0,l.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,l.jsx)(V,{level:5,style:{margin:0},children:"Blocked Keywords"}),(0,l.jsx)(Y,{type:"secondary",style:{fontSize:14,fontWeight:400},children:"Block or mask specific sensitive terms and phrases"})]}),size:"small",children:[(0,l.jsx)("div",{style:{marginBottom:16},children:(0,l.jsxs)(g.Space,{children:[(0,l.jsx)(c.Button,{type:"primary",onClick:()=>D(!0),icon:(0,l.jsx)(f.PlusOutlined,{}),children:"Add keyword"}),(0,l.jsx)(x.Upload,{beforeUpload:eu,accept:".yaml,.yml",showUploadList:!1,children:(0,l.jsx)(c.Button,{icon:(0,l.jsx)(y.UploadOutlined,{}),loading:ec,children:"Upload YAML file"})})]})}),(0,l.jsx)(F,{keywords:r,onActionChange:j,onRemove:d})]}),(!C||"competitor_intent"===C||"categories"===C)&&z&&(0,l.jsx)(U,{enabled:L,config:E,onChange:z,accessToken:b}),(!C||"categories"===C)&&N.length>0&&I&&O&&T&&(0,l.jsx)(G,{availableCategories:N,selectedCategories:w,onCategoryAdd:I,onCategoryRemove:O,onCategoryUpdate:T,accessToken:b,pendingSelection:A,onPendingSelectionChange:B}),(0,l.jsx)(v,{visible:M,prebuiltPatterns:e,categories:t,selectedPatternName:q,patternAction:H,onPatternNameChange:W,onActionChange:e=>Z(e),onAdd:()=>{if(!q)return void u.default.error("Please select a pattern");let t=e.find(e=>e.name===q);i({id:`pattern-${Date.now()}`,type:"prebuilt",name:q,display_name:t?.display_name,action:H}),$(!1),W(""),Z("BLOCK")},onCancel:()=>{$(!1),W(""),Z("BLOCK")}}),(0,l.jsx)(S,{visible:K,patternName:Q,patternRegex:ee,patternAction:ea,onNameChange:X,onRegexChange:et,onActionChange:e=>el(e),onAdd:()=>{Q&&ee?(i({id:`custom-${Date.now()}`,type:"custom",name:Q,pattern:ee,action:ea}),J(!1),X(""),et(""),el("BLOCK")):u.default.error("Please provide pattern name and regex")},onCancel:()=>{J(!1),X(""),et(""),el("BLOCK")}}),(0,l.jsx)(k,{visible:R,keyword:er,action:es,description:eo,onKeywordChange:ei,onActionChange:e=>en(e),onDescriptionChange:ed,onAdd:()=>{er?(o({id:`word-${Date.now()}`,keyword:er,action:es,description:eo||void 0}),D(!1),ei(""),ed(""),en("BLOCK")):u.default.error("Please enter a keyword")},onCancel:()=>{D(!1),ei(""),ed(""),en("BLOCK")}})]})};var Q=((t={}).PresidioPII="Presidio PII",t.Bedrock="Bedrock Guardrail",t.Lakera="Lakera",t);let X={},ee=e=>{let t={};return t.PresidioPII="Presidio PII",t.Bedrock="Bedrock Guardrail",t.Lakera="Lakera",Object.entries(e).forEach(([e,a])=>{a&&"object"==typeof a&&"ui_friendly_name"in a&&(t[e.split("_").map((e,t)=>e.charAt(0).toUpperCase()+e.slice(1)).join("")]=a.ui_friendly_name)}),X=t,t},et=()=>Object.keys(X).length>0?X:Q,ea={PresidioPII:"presidio",Bedrock:"bedrock",Lakera:"lakera_v2",LitellmContentFilter:"litellm_content_filter",ToolPermission:"tool_permission",BlockCodeExecution:"block_code_execution"},el=e=>{Object.entries(e).forEach(([e,t])=>{t&&"object"==typeof t&&"ui_friendly_name"in t&&(ea[e.split("_").map((e,t)=>e.charAt(0).toUpperCase()+e.slice(1)).join("")]=e)})},er=e=>!!e&&"Presidio PII"===et()[e],ei=e=>!!e&&"LiteLLM Content Filter"===et()[e],es="../ui/assets/logos/",en={"Zscaler AI Guard":`${es}zscaler.svg`,"Presidio PII":`${es}microsoft_azure.svg`,"Bedrock Guardrail":`${es}bedrock.svg`,Lakera:`${es}lakeraai.jpeg`,"Azure Content Safety Prompt Shield":`${es}microsoft_azure.svg`,"Azure Content Safety Text Moderation":`${es}microsoft_azure.svg`,"Aporia AI":`${es}aporia.png`,"PANW Prisma AIRS":`${es}palo_alto_networks.jpeg`,"Noma Security":`${es}noma_security.png`,"Javelin Guardrails":`${es}javelin.png`,"Pillar Guardrail":`${es}pillar.jpeg`,"Google Cloud Model Armor":`${es}google.svg`,"Guardrails AI":`${es}guardrails_ai.jpeg`,"Lasso Guardrail":`${es}lasso.png`,"Pangea Guardrail":`${es}pangea.png`,"AIM Guardrail":`${es}aim_security.jpeg`,"OpenAI Moderation":`${es}openai_small.svg`,EnkryptAI:`${es}enkrypt_ai.avif`,"Prompt Security":`${es}prompt_security.png`,"LiteLLM Content Filter":`${es}litellm_logo.jpg`},eo=e=>{if(!e)return{logo:"",displayName:"-"};let t=Object.keys(ea).find(t=>ea[t].toLowerCase()===e.toLowerCase());if(!t)return{logo:"",displayName:e};let a=et()[t];return{logo:en[a]||"",displayName:a||e}};e.s(["getGuardrailLogoAndName",0,eo,"getGuardrailProviders",0,et,"guardrailLogoMap",0,en,"guardrail_provider_map",0,ea,"populateGuardrailProviderMap",0,el,"populateGuardrailProviders",0,ee,"shouldRenderContentFilterConfigSettings",0,ei,"shouldRenderPIIConfigSettings",0,er],180766);var ed=e.i(435451);let{Title:ec}=d.Typography,em=({field:e,fieldKey:t,fullFieldKey:a,value:s})=>{let[o,d]=m.default.useState([]),[u,p]=m.default.useState(e.dict_key_options||[]);return m.default.useEffect(()=>{if(s&&"object"==typeof s){let t=Object.keys(s);d(t.map(e=>({key:e,id:`${e}_${Date.now()}_${Math.random()}`}))),p((e.dict_key_options||[]).filter(e=>!t.includes(e)))}},[s,e.dict_key_options]),(0,l.jsxs)("div",{className:"space-y-3",children:[o.map(t=>(0,l.jsxs)("div",{className:"flex items-center space-x-3 p-3 border rounded-lg",children:[(0,l.jsx)("div",{className:"w-24 font-medium text-sm",children:t.key}),(0,l.jsx)("div",{className:"flex-1",children:(0,l.jsx)(r.Form.Item,{name:Array.isArray(a)?[...a,t.key]:[a,t.key],style:{marginBottom:0},initialValue:s&&"object"==typeof s?s[t.key]:void 0,normalize:"number"===e.dict_value_type?e=>{if(null==e||""===e)return;let t=Number(e);return isNaN(t)?e:t}:void 0,children:"number"===e.dict_value_type?(0,l.jsx)(ed.default,{step:1,width:200,placeholder:`Enter ${t.key} value`}):"boolean"===e.dict_value_type?(0,l.jsxs)(n.Select,{placeholder:`Select ${t.key} value`,children:[(0,l.jsx)(n.Select.Option,{value:!0,children:"True"}),(0,l.jsx)(n.Select.Option,{value:!1,children:"False"})]}):(0,l.jsx)(i.Input,{placeholder:`Enter ${t.key} value`})})}),(0,l.jsx)(c.Button,{type:"text",danger:!0,size:"small",onClick:()=>{var e,a;return e=t.id,a=t.key,void(d(o.filter(t=>t.id!==e)),p([...u,a].sort()))},children:"Remove"})]},t.id)),u.length>0&&(0,l.jsxs)("div",{className:"flex items-center space-x-3 mt-2",children:[(0,l.jsx)(n.Select,{placeholder:"Select category to configure",style:{width:200},onSelect:e=>e&&void(!e||(d([...o,{key:e,id:`${e}_${Date.now()}`}]),p(u.filter(t=>t!==e)))),value:void 0,children:u.map(e=>(0,l.jsx)(n.Select.Option,{value:e,children:e},e))}),(0,l.jsx)("span",{className:"text-sm text-gray-500",children:"Select a category to add threshold configuration"})]})]})},eu=({optionalParams:e,parentFieldKey:t,values:a})=>e.fields&&0!==Object.keys(e.fields).length?(0,l.jsxs)("div",{className:"guardrail-optional-params",children:[(0,l.jsxs)("div",{className:"mb-8 pb-4 border-b border-gray-100",children:[(0,l.jsx)(ec,{level:3,className:"mb-2 font-semibold text-gray-900",children:"Optional Parameters"}),(0,l.jsx)("p",{className:"text-gray-600 text-sm",children:e.description||"Configure additional settings for this guardrail provider"})]}),(0,l.jsx)("div",{className:"space-y-8",children:Object.entries(e.fields).map(([e,s])=>{let o,d;return o=`${t}.${e}`,(console.log("value",d=a?.[e]),"dict"===s.type&&s.dict_key_options)?(0,l.jsxs)("div",{className:"mb-8 p-6 bg-gray-50 rounded-lg border border-gray-200",children:[(0,l.jsx)("div",{className:"mb-4 font-medium text-gray-900 text-base",children:e}),(0,l.jsx)("p",{className:"text-sm text-gray-600 mb-4",children:s.description}),(0,l.jsx)(em,{field:s,fieldKey:e,fullFieldKey:[t,e],value:d})]},o):(0,l.jsx)("div",{className:"mb-8 p-6 bg-white rounded-lg border border-gray-200 shadow-sm",children:(0,l.jsx)(r.Form.Item,{name:[t,e],label:(0,l.jsxs)("div",{className:"mb-2",children:[(0,l.jsx)("div",{className:"font-medium text-gray-900 text-base",children:e}),(0,l.jsx)("p",{className:"text-sm text-gray-600 mt-1",children:s.description})]}),rules:s.required?[{required:!0,message:`${e} is required`}]:void 0,className:"mb-0",initialValue:void 0!==d?d:s.default_value,normalize:"number"===s.type?e=>{if(null==e||""===e)return;let t=Number(e);return isNaN(t)?e:t}:void 0,children:"select"===s.type&&s.options?(0,l.jsx)(n.Select,{placeholder:s.description,children:s.options.map(e=>(0,l.jsx)(n.Select.Option,{value:e,children:e},e))}):"multiselect"===s.type&&s.options?(0,l.jsx)(n.Select,{mode:"multiple",placeholder:s.description,children:s.options.map(e=>(0,l.jsx)(n.Select.Option,{value:e,children:e},e))}):"bool"===s.type||"boolean"===s.type?(0,l.jsxs)(n.Select,{placeholder:s.description,children:[(0,l.jsx)(n.Select.Option,{value:"true",children:"True"}),(0,l.jsx)(n.Select.Option,{value:"false",children:"False"})]}):"number"===s.type?(0,l.jsx)(ed.default,{step:1,width:400,placeholder:s.description}):e.includes("password")||e.includes("secret")||e.includes("key")?(0,l.jsx)(i.Input.Password,{placeholder:s.description}):(0,l.jsx)(i.Input,{placeholder:s.description})})},o)})})]}):null;var ep=e.i(482725),eg=e.i(850627);let ex=({selectedProvider:e,accessToken:t,providerParams:a=null,value:s=null})=>{let[o,d]=(0,m.useState)(!1),[c,u]=(0,m.useState)(a),[g,x]=(0,m.useState)(null);if((0,m.useEffect)(()=>{if(a)return void u(a);let e=async()=>{if(t){d(!0),x(null);try{let e=await (0,p.getGuardrailProviderSpecificParams)(t);console.log("Provider params API response:",e),u(e),ee(e),el(e)}catch(e){console.error("Error fetching provider params:",e),x("Failed to load provider parameters")}finally{d(!1)}}};a||e()},[t,a]),!e)return null;if(o)return(0,l.jsx)(ep.Spin,{tip:"Loading provider parameters..."});if(g)return(0,l.jsx)("div",{className:"text-red-500",children:g});let h=ea[e]?.toLowerCase(),f=c&&c[h];if(console.log("Provider key:",h),console.log("Provider fields:",f),!f||0===Object.keys(f).length)return(0,l.jsx)("div",{children:"No configuration fields available for this provider."});console.log("Value:",s);let y=new Set(["patterns","blocked_words","blocked_words_file","categories","severity_threshold","pattern_redaction_format","keyword_redaction_tag"]),j=ei(e),_=(e,t="",a)=>Object.entries(e).map(([e,o])=>{let d=t?`${t}.${e}`:e,c=a?a[e]:s?.[e];if(console.log("Field value:",c),"ui_friendly_name"===e||"optional_params"===e&&"nested"===o.type&&o.fields||j&&y.has(e))return null;if("nested"===o.type&&o.fields)return(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{className:"mb-2 font-medium",children:e}),(0,l.jsx)("div",{className:"ml-4 border-l-2 border-gray-200 pl-4",children:_(o.fields,d,c)})]},d);let m="percentage"===o.type&&null==c?o.default_value??.5:void 0;return(0,l.jsx)(r.Form.Item,{name:d,label:e,tooltip:o.description,rules:o.required?[{required:!0,message:`${e} is required`}]:void 0,initialValue:m,children:"select"===o.type&&o.options?(0,l.jsx)(n.Select,{placeholder:o.description,defaultValue:c||o.default_value,children:o.options.map(e=>(0,l.jsx)(n.Select.Option,{value:e,children:e},e))}):"multiselect"===o.type&&o.options?(0,l.jsx)(n.Select,{mode:"multiple",placeholder:o.description,defaultValue:c||o.default_value,children:o.options.map(e=>(0,l.jsx)(n.Select.Option,{value:e,children:e},e))}):"bool"===o.type||"boolean"===o.type?(0,l.jsxs)(n.Select,{placeholder:o.description,defaultValue:void 0!==c?String(c):o.default_value,children:[(0,l.jsx)(n.Select.Option,{value:"true",children:"True"}),(0,l.jsx)(n.Select.Option,{value:"false",children:"False"})]}):"percentage"===o.type&&null!=o.min&&null!=o.max?(0,l.jsx)(eg.Slider,{min:o.min,max:o.max,step:o.step??.1,marks:{[o.min]:"0%",[(o.min+o.max)/2]:"50%",[o.max]:"100%"}}):"number"===o.type?(0,l.jsx)(ed.default,{step:1,width:400,placeholder:o.description,defaultValue:void 0!==c?Number(c):void 0}):e.includes("password")||e.includes("secret")||e.includes("key")?(0,l.jsx)(i.Input.Password,{placeholder:o.description,defaultValue:c||""}):(0,l.jsx)(i.Input,{placeholder:o.description,defaultValue:c||""})},d)});return(0,l.jsx)(l.Fragment,{children:_(f)})};var eh=e.i(536916),ef=e.i(592968),ey=e.i(149192),ej=e.i(741585),ej=ej,e_=e.i(724154);e.i(247167);var ev=e.i(931067);let eb={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"};var eC=e.i(9583),eS=m.forwardRef(function(e,t){return m.createElement(eC.default,(0,ev.default)({},e,{ref:t,icon:eb}))});let{Text:eN}=d.Typography,{Option:ew}=n.Select,ek=({categories:e,selectedCategories:t,onChange:a})=>(0,l.jsxs)("div",{children:[(0,l.jsxs)("div",{className:"flex items-center mb-2",children:[(0,l.jsx)(eS,{className:"text-gray-500 mr-1"}),(0,l.jsx)(eN,{className:"text-gray-500 font-medium",children:"Filter by category"})]}),(0,l.jsx)(n.Select,{mode:"multiple",placeholder:"Select categories to filter by",style:{width:"100%"},onChange:a,value:t,allowClear:!0,showSearch:!0,optionFilterProp:"children",className:"mb-4",tagRender:e=>(0,l.jsx)(o.Tag,{color:"blue",closable:e.closable,onClose:e.onClose,className:"mr-2 mb-2",children:e.label}),children:e.map(e=>(0,l.jsx)(ew,{value:e.category,children:e.category},e.category))})]}),eI=({onSelectAll:e,onUnselectAll:t,hasSelectedEntities:a})=>(0,l.jsxs)("div",{className:"bg-gray-50 p-5 rounded-lg mb-6 border border-gray-200 shadow-sm",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,l.jsxs)("div",{className:"flex items-center",children:[(0,l.jsx)(eN,{strong:!0,className:"text-gray-700 text-base",children:"Quick Actions"}),(0,l.jsx)(ef.Tooltip,{title:"Apply action to all PII types at once",children:(0,l.jsx)("div",{className:"ml-2 text-gray-400 cursor-help text-xs",children:"ⓘ"})})]}),(0,l.jsx)(c.Button,{color:"danger",variant:"outlined",onClick:t,disabled:!a,icon:(0,l.jsx)(ey.CloseOutlined,{}),children:"Unselect All"})]}),(0,l.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,l.jsx)(c.Button,{color:"primary",variant:"outlined",onClick:()=>e("MASK"),className:"h-10",block:!0,icon:(0,l.jsx)(ej.default,{}),children:"Select All & Mask"}),(0,l.jsx)(c.Button,{color:"danger",variant:"outlined",onClick:()=>e("BLOCK"),className:"h-10 hover:bg-red-100",block:!0,icon:(0,l.jsx)(e_.StopOutlined,{}),children:"Select All & Block"})]})]}),eO=({entities:e,selectedEntities:t,selectedActions:a,actions:r,onEntitySelect:i,onActionSelect:s,entityToCategoryMap:d})=>(0,l.jsxs)("div",{className:"border rounded-lg overflow-hidden shadow-sm",children:[(0,l.jsxs)("div",{className:"bg-gray-50 px-5 py-3 border-b flex",children:[(0,l.jsx)(eN,{strong:!0,className:"flex-1 text-gray-700",children:"PII Type"}),(0,l.jsx)(eN,{strong:!0,className:"w-32 text-right text-gray-700",children:"Action"})]}),(0,l.jsx)("div",{className:"max-h-[400px] overflow-y-auto",children:0===e.length?(0,l.jsx)("div",{className:"py-10 text-center text-gray-500",children:"No PII types match your filter criteria"}):e.map(e=>(0,l.jsxs)("div",{className:`px-5 py-3 flex items-center justify-between hover:bg-gray-50 border-b ${t.includes(e)?"bg-blue-50":""}`,children:[(0,l.jsxs)("div",{className:"flex items-center flex-1",children:[(0,l.jsx)(eh.Checkbox,{checked:t.includes(e),onChange:()=>i(e),className:"mr-3"}),(0,l.jsx)(eN,{className:t.includes(e)?"font-medium text-gray-900":"text-gray-700",children:e.replace(/_/g," ")}),d.get(e)&&(0,l.jsx)(o.Tag,{className:"ml-2 text-xs",color:"blue",children:d.get(e)})]}),(0,l.jsx)("div",{className:"w-32",children:(0,l.jsx)(n.Select,{value:t.includes(e)&&a[e]||"MASK",onChange:t=>s(e,t),style:{width:120},disabled:!t.includes(e),className:`${!t.includes(e)?"opacity-50":""}`,dropdownMatchSelectWidth:!1,children:r.map(e=>(0,l.jsx)(ew,{value:e,children:(0,l.jsxs)("div",{className:"flex items-center",children:[(e=>{switch(e){case"MASK":return(0,l.jsx)(ej.default,{style:{marginRight:4}});case"BLOCK":return(0,l.jsx)(e_.StopOutlined,{style:{marginRight:4}});default:return null}})(e),e]})},e))})})]},e))})]}),{Title:eT,Text:eA}=d.Typography,eP=({entities:e,actions:t,selectedEntities:a,selectedActions:r,onEntitySelect:i,onActionSelect:s,entityCategories:n=[]})=>{let[o,d]=(0,m.useState)([]),c=new Map;n.forEach(e=>{e.entities.forEach(t=>{c.set(t,e.category)})});let u=e.filter(e=>0===o.length||o.includes(c.get(e)||""));return(0,l.jsxs)("div",{className:"pii-configuration",children:[(0,l.jsxs)("div",{className:"flex justify-between items-center mb-5",children:[(0,l.jsx)("div",{className:"flex items-center",children:(0,l.jsx)(eT,{level:4,className:"!m-0 font-semibold text-gray-800",children:"Configure PII Protection"})}),(0,l.jsxs)(eA,{className:"text-gray-500",children:[a.length," items selected"]})]}),(0,l.jsxs)("div",{className:"mb-6",children:[(0,l.jsx)(ek,{categories:n,selectedCategories:o,onChange:d}),(0,l.jsx)(eI,{onSelectAll:t=>{e.forEach(e=>{a.includes(e)||i(e),s(e,t)})},onUnselectAll:()=>{a.forEach(e=>{i(e)})},hasSelectedEntities:a.length>0})]}),(0,l.jsx)(eO,{entities:u,selectedEntities:a,selectedActions:r,actions:t,onEntitySelect:i,onActionSelect:s,entityToCategoryMap:c})]})};var eB=e.i(304967),eL=e.i(599724),eF=e.i(312361),eE=e.i(21548),ez=e.i(827252);let eM={rules:[],default_action:"deny",on_disallowed_action:"block",violation_message_template:""},e$=({value:e,onChange:t,disabled:a=!1})=>{let r={...eM,...e||{},rules:e?.rules?[...e.rules]:[]},s=e=>{let a={...r,...e};t?.(a)},o=(e,t)=>{s({rules:r.rules.map((a,l)=>l===e?{...a,...t}:a)})},d=(e,t)=>{let a=r.rules[e];if(!a)return;let l=Object.entries(a.allowed_param_patterns||{});t(l);let i={};l.forEach(([e,t])=>{i[e]=t}),o(e,{allowed_param_patterns:Object.keys(i).length>0?i:void 0})};return(0,l.jsxs)(eB.Card,{children:[(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)(eL.Text,{className:"text-lg font-semibold",children:"LiteLLM Tool Permission Guardrail"}),(0,l.jsx)(eL.Text,{className:"text-sm text-gray-500",children:"Provide regex patterns (e.g., ^mcp__github_.*$) for tool names or types and optionally constrain payload fields."})]}),!a&&(0,l.jsx)(c.Button,{icon:(0,l.jsx)(f.PlusOutlined,{}),type:"primary",onClick:()=>{s({rules:[...r.rules,{id:`rule_${Math.random().toString(36).slice(2,8)}`,decision:"allow",allowed_param_patterns:void 0}]})},className:"!bg-blue-600 !text-white hover:!bg-blue-500",children:"Add Rule"})]}),(0,l.jsx)(eF.Divider,{}),0===r.rules.length?(0,l.jsx)(eE.Empty,{description:"No tool rules added yet"}):(0,l.jsx)("div",{className:"space-y-4",children:r.rules.map((e,t)=>{let m;return(0,l.jsxs)(eB.Card,{className:"bg-gray-50",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,l.jsxs)(eL.Text,{className:"font-semibold",children:["Rule ",t+1]}),(0,l.jsx)(c.Button,{icon:(0,l.jsx)(O.DeleteOutlined,{}),danger:!0,type:"text",disabled:a,onClick:()=>{s({rules:r.rules.filter((e,a)=>a!==t)})},children:"Remove"})]}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)(eL.Text,{className:"text-sm font-medium",children:"Rule ID"}),(0,l.jsx)(i.Input,{disabled:a,placeholder:"unique_rule_id",value:e.id,onChange:e=>o(t,{id:e.target.value})})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)(eL.Text,{className:"text-sm font-medium",children:"Tool Name (optional)"}),(0,l.jsx)(i.Input,{disabled:a,placeholder:"^mcp__github_.*$",value:e.tool_name??"",onChange:e=>o(t,{tool_name:""===e.target.value.trim()?void 0:e.target.value})})]})]}),(0,l.jsx)("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 mt-4",children:(0,l.jsxs)("div",{children:[(0,l.jsx)(eL.Text,{className:"text-sm font-medium",children:"Tool Type (optional)"}),(0,l.jsx)(i.Input,{disabled:a,placeholder:"^function$",value:e.tool_type??"",onChange:e=>o(t,{tool_type:""===e.target.value.trim()?void 0:e.target.value})})]})}),(0,l.jsxs)("div",{className:"mt-4 flex flex-col gap-2",children:[(0,l.jsx)(eL.Text,{className:"text-sm font-medium",children:"Decision"}),(0,l.jsxs)(n.Select,{disabled:a,value:e.decision,style:{width:200},onChange:e=>o(t,{decision:e}),children:[(0,l.jsx)(n.Select.Option,{value:"allow",children:"Allow"}),(0,l.jsx)(n.Select.Option,{value:"deny",children:"Deny"})]})]}),(0,l.jsx)("div",{className:"mt-4",children:0===(m=Object.entries(e.allowed_param_patterns||{})).length?(0,l.jsx)(c.Button,{disabled:a,size:"small",onClick:()=>o(t,{allowed_param_patterns:{"":""}}),children:"+ Restrict tool arguments (optional)"}):(0,l.jsxs)("div",{className:"space-y-2",children:[(0,l.jsx)(eL.Text,{className:"text-sm text-gray-600",children:"Argument constraints (dot or array paths)"}),m.map(([r,s],n)=>(0,l.jsxs)(g.Space,{align:"start",children:[(0,l.jsx)(i.Input,{disabled:a,placeholder:"messages[0].content",value:r,onChange:e=>{var a;return a=e.target.value,void d(t,e=>{if(!e[n])return;let[,t]=e[n];e[n]=[a,t]})}}),(0,l.jsx)(i.Input,{disabled:a,placeholder:"^email@.*$",value:s,onChange:e=>{var a;return a=e.target.value,void d(t,e=>{if(!e[n])return;let[t]=e[n];e[n]=[t,a]})}}),(0,l.jsx)(c.Button,{disabled:a,icon:(0,l.jsx)(O.DeleteOutlined,{}),danger:!0,onClick:()=>d(t,e=>{e.splice(n,1)})})]},`${e.id||t}-${n}`)),(0,l.jsx)(c.Button,{disabled:a,size:"small",onClick:()=>o(t,{allowed_param_patterns:{...e.allowed_param_patterns||{},"":""}}),children:"+ Add another constraint"})]})})]},e.id||t)})}),(0,l.jsx)(eF.Divider,{}),(0,l.jsxs)("div",{className:"grid gap-4 md:grid-cols-2",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)(eL.Text,{className:"text-sm font-medium",children:"Default action"}),(0,l.jsxs)(n.Select,{disabled:a,value:r.default_action,onChange:e=>s({default_action:e}),children:[(0,l.jsx)(n.Select.Option,{value:"allow",children:"Allow"}),(0,l.jsx)(n.Select.Option,{value:"deny",children:"Deny"})]})]}),(0,l.jsxs)("div",{children:[(0,l.jsxs)(eL.Text,{className:"text-sm font-medium flex items-center gap-1",children:["On disallowed action",(0,l.jsx)(ef.Tooltip,{title:"Block returns an error when a forbidden tool is invoked. Rewrite strips the tool call but lets the rest of the response continue.",children:(0,l.jsx)(ez.InfoCircleOutlined,{})})]}),(0,l.jsxs)(n.Select,{disabled:a,value:r.on_disallowed_action,onChange:e=>s({on_disallowed_action:e}),children:[(0,l.jsx)(n.Select.Option,{value:"block",children:"Block"}),(0,l.jsx)(n.Select.Option,{value:"rewrite",children:"Rewrite"})]})]})]}),(0,l.jsxs)("div",{className:"mt-4",children:[(0,l.jsx)(eL.Text,{className:"text-sm font-medium",children:"Violation message (optional)"}),(0,l.jsx)(i.Input.TextArea,{disabled:a,rows:3,placeholder:"This violates our org policy...",value:r.violation_message_template,onChange:e=>s({violation_message_template:e.target.value})})]})]})},{Title:eR,Text:eG,Link:eD}=d.Typography,{Option:eK}=n.Select,eJ={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"};e.s(["default",0,({visible:e,onClose:t,accessToken:a,onSuccess:d,preset:g})=>{let[x]=r.Form.useForm(),[h,f]=(0,m.useState)(!1),[y,j]=(0,m.useState)(null),[_,v]=(0,m.useState)(null),[b,C]=(0,m.useState)([]),[S,N]=(0,m.useState)({}),[w,k]=(0,m.useState)(0),[I,O]=(0,m.useState)(null),[T,A]=(0,m.useState)([]),[P,B]=(0,m.useState)(2),[L,F]=(0,m.useState)({}),[E,z]=(0,m.useState)([]),[M,$]=(0,m.useState)([]),[R,G]=(0,m.useState)([]),[D,K]=(0,m.useState)(""),[J,q]=(0,m.useState)(!1),[W,H]=(0,m.useState)(null),[U,V]=(0,m.useState)(""),[Y,Q]=(0,m.useState)(void 0),[X,es]=(0,m.useState)("warn"),[eo,ed]=(0,m.useState)(""),[ec,em]=(0,m.useState)(!1),[ep,eg]=(0,m.useState)({rules:[],default_action:"deny",on_disallowed_action:"block",violation_message_template:""}),eh=(0,m.useMemo)(()=>!!y&&"tool_permission"===(ea[y]||"").toLowerCase(),[y]);(0,m.useEffect)(()=>{a&&(async()=>{try{let[e,t]=await Promise.all([(0,p.getGuardrailUISettings)(a),(0,p.getGuardrailProviderSpecificParams)(a)]);v(e),O(t),ee(t),el(t)}catch(e){console.error("Error fetching guardrail data:",e),u.default.fromBackend("Failed to load guardrail configuration")}})()},[a]),(0,m.useEffect)(()=>{if(!g||!e||!_)return;j(g.provider);let t={provider:g.provider,guardrail_name:g.guardrailNameSuggestion,mode:g.mode,default_on:g.defaultOn};if("BlockCodeExecution"===g.provider&&(t.confidence_threshold=.5),x.setFieldsValue(t),g.categoryName&&_.content_filter_settings?.content_categories){let e=_.content_filter_settings.content_categories.find(e=>e.name===g.categoryName);e&&G([{id:`category-${Date.now()}`,category:e.name,display_name:e.display_name,action:e.default_action,severity_threshold:"medium"}])}},[g,e,_]);let ef=e=>{j(e);let t={config:void 0,presidio_analyzer_api_base:void 0,presidio_anonymizer_api_base:void 0};"BlockCodeExecution"===e&&(t.confidence_threshold=.5),x.setFieldsValue(t),C([]),N({}),A([]),B(2),F({}),z([]),$([]),G([]),K(""),q(!1),H(null),eg({rules:[],default_action:"deny",on_disallowed_action:"block",violation_message_template:""})},ey=e=>{C(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},ej=(e,t)=>{N(a=>({...a,[e]:t}))},e_=async()=>{try{if(0===w&&(await x.validateFields(["guardrail_name","provider","mode","default_on"]),y)){let e=["guardrail_name","provider","mode","default_on"];"PresidioPII"===y&&e.push("presidio_analyzer_api_base","presidio_anonymizer_api_base"),await x.validateFields(e)}if(1===w&&er(y)&&0===b.length)return void u.default.fromBackend("Please select at least one PII entity to continue");k(w+1)}catch(e){console.error("Form validation failed:",e)}},ev=()=>{x.resetFields(),j(null),C([]),N({}),A([]),B(2),F({}),z([]),$([]),G([]),K(""),eg({rules:[],default_action:"deny",on_disallowed_action:"block",violation_message_template:""}),V(""),Q(void 0),es("warn"),ed(""),em(!1),k(0)},eb=()=>{ev(),t()},eC=async()=>{try{f(!0),await x.validateFields();let e=x.getFieldsValue(!0),l=ea[e.provider],r={guardrail_name:e.guardrail_name,litellm_params:{guardrail:l,mode:e.mode,default_on:e.default_on},guardrail_info:{}};if("PresidioPII"===e.provider&&b.length>0){let t={};b.forEach(e=>{t[e]=S[e]||"MASK"}),r.litellm_params.pii_entities_config=t,e.presidio_analyzer_api_base&&(r.litellm_params.presidio_analyzer_api_base=e.presidio_analyzer_api_base),e.presidio_anonymizer_api_base&&(r.litellm_params.presidio_anonymizer_api_base=e.presidio_anonymizer_api_base)}if(ei(e.provider)){let e=J&&W?.brand_self?.length>0;if(0===E.length&&0===M.length&&0===R.length&&!e){u.default.fromBackend("Please configure at least one content filter setting (category, pattern, keyword, or competitor intent)"),f(!1);return}E.length>0&&(r.litellm_params.patterns=E.map(e=>({pattern_type:"prebuilt"===e.type?"prebuilt":"regex",pattern_name:"prebuilt"===e.type?e.name:void 0,pattern:"custom"===e.type?e.pattern:void 0,name:e.name,action:e.action}))),M.length>0&&(r.litellm_params.blocked_words=M.map(e=>({keyword:e.keyword,action:e.action,description:e.description}))),R.length>0&&(r.litellm_params.categories=R.map(e=>({category:e.category,enabled:!0,action:e.action,severity_threshold:e.severity_threshold||"medium"}))),J&&W?.brand_self?.length>0&&(r.litellm_params.competitor_intent_config={competitor_intent_type:W.competitor_intent_type??"airline",brand_self:W.brand_self,locations:W.locations?.length>0?W.locations:void 0,competitors:"generic"===W.competitor_intent_type&&W.competitors?.length>0?W.competitors:void 0,policy:W.policy,threshold_high:W.threshold_high,threshold_medium:W.threshold_medium,threshold_low:W.threshold_low})}else if(e.config)try{r.guardrail_info=JSON.parse(e.config)}catch(e){u.default.fromBackend("Invalid JSON in configuration"),f(!1);return}if("tool_permission"===l){if(0===ep.rules.length){u.default.fromBackend("Add at least one tool permission rule"),f(!1);return}r.litellm_params.rules=ep.rules,r.litellm_params.default_action=ep.default_action,r.litellm_params.on_disallowed_action=ep.on_disallowed_action,ep.violation_message_template&&(r.litellm_params.violation_message_template=ep.violation_message_template)}if(ei(e.provider)&&(void 0!==Y&&Y>0&&(r.litellm_params.end_session_after_n_fails=Y),X&&"realtime"===U&&(r.litellm_params.on_violation=X),eo.trim()&&(r.litellm_params.realtime_violation_message=eo.trim())),console.log("values: ",JSON.stringify(e)),I&&y){let t=ea[y]?.toLowerCase();console.log("providerKey: ",t);let a=I[t]||{},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(t=>{let a=e[t];(null==a||""===a)&&(a=e.optional_params?.[t]),null!=a&&""!==a&&(r.litellm_params[t]=a)})}if(!a)throw Error("No access token available");console.log("Sending guardrail data:",JSON.stringify(r)),await (0,p.createGuardrailCall)(a,r),u.default.success("Guardrail created successfully"),ev(),d(),t()}catch(e){console.error("Failed to create guardrail:",e),u.default.fromBackend("Failed to create guardrail: "+(e instanceof Error?e.message:String(e)))}finally{f(!1)}},eS=e=>{if(!_||!ei(y))return null;let t=_.content_filter_settings;return t?(0,l.jsx)(Z,{prebuiltPatterns:t.prebuilt_patterns||[],categories:t.pattern_categories||[],selectedPatterns:E,blockedWords:M,onPatternAdd:e=>z([...E,e]),onPatternRemove:e=>z(E.filter(t=>t.id!==e)),onPatternActionChange:(e,t)=>{z(E.map(a=>a.id===e?{...a,action:t}:a))},onBlockedWordAdd:e=>$([...M,e]),onBlockedWordRemove:e=>$(M.filter(t=>t.id!==e)),onBlockedWordUpdate:(e,t,a)=>{$(M.map(l=>l.id===e?{...l,[t]:a}:l))},contentCategories:t.content_categories||[],selectedContentCategories:R,onContentCategoryAdd:e=>G([...R,e]),onContentCategoryRemove:e=>G(R.filter(t=>t.id!==e)),onContentCategoryUpdate:(e,t,a)=>{G(R.map(l=>l.id===e?{...l,[t]:a}:l))},pendingCategorySelection:D,onPendingCategorySelectionChange:K,accessToken:a,showStep:e,competitorIntentEnabled:J,competitorIntentConfig:W,onCompetitorIntentChange:(e,t)=>{q(e),H(t)}}):null},eN=ei(y)?[{title:"Basic Info",optional:!1},{title:"Topics",optional:!1},{title:"Patterns",optional:!1},{title:"Keywords",optional:!1},{title:"Endpoint Settings (Optional)",optional:!0}]:er(y)?[{title:"Basic Info",optional:!1},{title:"PII Configuration",optional:!1}]:[{title:"Basic Info",optional:!1},{title:"Provider Configuration",optional:!1}];return(0,l.jsx)(s.Modal,{title:null,open:e,onCancel:eb,footer:null,width:1e3,closable:!1,className:"top-8",styles:{body:{padding:0}},children:(0,l.jsxs)("div",{className:"flex flex-col",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between px-6 py-4 border-b border-gray-200",children:[(0,l.jsx)("h3",{className:"text-base font-semibold text-gray-900 m-0",children:"Create guardrail"}),(0,l.jsx)("button",{onClick:eb,className:"text-gray-400 hover:text-gray-600 bg-transparent border-none cursor-pointer text-base leading-none p-1",children:"✕"})]}),(0,l.jsx)("div",{className:"overflow-auto px-6 py-4",style:{maxHeight:"calc(80vh - 120px)"},children:(0,l.jsx)(r.Form,{form:x,layout:"vertical",initialValues:{mode:"pre_call",default_on:!1},children:eN.map((e,t)=>{let s=t{s&&k(t)},style:{minHeight:24},children:[(0,l.jsx)("span",{className:"text-sm",style:{fontWeight:d?600:500,color:d?"#1e293b":s?"#4f46e5":"#94a3b8"},children:e.title}),e.optional&&!d&&(0,l.jsx)("span",{className:"text-[11px] text-slate-400",children:"optional"}),s&&(0,l.jsx)("span",{className:"text-[11px] text-indigo-500 hover:underline",children:"Edit"})]}),d&&(0,l.jsx)("div",{className:"mt-3",children:(()=>{switch(w){case 0:return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(r.Form.Item,{name:"guardrail_name",label:"Guardrail Name",rules:[{required:!0,message:"Please enter a guardrail name"}],children:(0,l.jsx)(i.Input,{placeholder:"Enter a name for this guardrail"})}),(0,l.jsx)(r.Form.Item,{name:"provider",label:"Guardrail Provider",rules:[{required:!0,message:"Please select a provider"}],children:(0,l.jsx)(n.Select,{placeholder:"Select a guardrail provider",onChange:ef,labelInValue:!1,optionLabelProp:"label",dropdownRender:e=>e,showSearch:!0,children:Object.entries(et()).map(([e,t])=>(0,l.jsx)(eK,{value:e,label:(0,l.jsxs)("div",{style:{display:"flex",alignItems:"center"},children:[en[t]&&(0,l.jsx)("img",{src:en[t],alt:"",style:{height:"20px",width:"20px",marginRight:"8px",objectFit:"contain"},onError:e=>{e.currentTarget.style.display="none"}}),(0,l.jsx)("span",{children:t})]}),children:(0,l.jsxs)("div",{style:{display:"flex",alignItems:"center"},children:[en[t]&&(0,l.jsx)("img",{src:en[t],alt:"",style:{height:"20px",width:"20px",marginRight:"8px",objectFit:"contain"},onError:e=>{e.currentTarget.style.display="none"}}),(0,l.jsx)("span",{children:t})]})},e))})}),(0,l.jsx)(r.Form.Item,{name:"mode",label:"Mode",tooltip:"How the guardrail should be applied",rules:[{required:!0,message:"Please select a mode"}],children:(0,l.jsx)(n.Select,{optionLabelProp:"label",mode:"multiple",children:_?.supported_modes?.map(e=>(0,l.jsx)(eK,{value:e,label:e,children:(0,l.jsxs)("div",{children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("strong",{children:e}),"pre_call"===e&&(0,l.jsx)(o.Tag,{color:"green",style:{marginLeft:"8px"},children:"Recommended"})]}),(0,l.jsx)("div",{style:{fontSize:"12px",color:"#888"},children:eJ[e]})]})},e))||(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(eK,{value:"pre_call",label:"pre_call",children:(0,l.jsxs)("div",{children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("strong",{children:"pre_call"})," ",(0,l.jsx)(o.Tag,{color:"green",children:"Recommended"})]}),(0,l.jsx)("div",{style:{fontSize:"12px",color:"#888"},children:eJ.pre_call})]})}),(0,l.jsx)(eK,{value:"during_call",label:"during_call",children:(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{children:(0,l.jsx)("strong",{children:"during_call"})}),(0,l.jsx)("div",{style:{fontSize:"12px",color:"#888"},children:eJ.during_call})]})}),(0,l.jsx)(eK,{value:"post_call",label:"post_call",children:(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{children:(0,l.jsx)("strong",{children:"post_call"})}),(0,l.jsx)("div",{style:{fontSize:"12px",color:"#888"},children:eJ.post_call})]})}),(0,l.jsx)(eK,{value:"logging_only",label:"logging_only",children:(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{children:(0,l.jsx)("strong",{children:"logging_only"})}),(0,l.jsx)("div",{style:{fontSize:"12px",color:"#888"},children:eJ.logging_only})]})})]})})}),(0,l.jsx)(r.Form.Item,{name:"default_on",label:"Always On",tooltip:"If enabled, this guardrail will be applied to all requests by default.",children:(0,l.jsxs)(n.Select,{children:[(0,l.jsx)(n.Select.Option,{value:!0,children:"Yes"}),(0,l.jsx)(n.Select.Option,{value:!1,children:"No"})]})}),!eh&&!ei(y)&&(0,l.jsx)(ex,{selectedProvider:y,accessToken:a,providerParams:I})]});case 1:if(er(y))return _&&"PresidioPII"===y?(0,l.jsx)(eP,{entities:_.supported_entities,actions:_.supported_actions,selectedEntities:b,selectedActions:S,onEntitySelect:ey,onActionSelect:ej,entityCategories:_.pii_entity_categories}):null;if(ei(y))return eS("categories");if(!y)return null;if(eh)return(0,l.jsx)(e$,{value:ep,onChange:eg});if(!I)return null;console.log("guardrail_provider_map: ",ea),console.log("selectedProvider: ",y);let e=ea[y]?.toLowerCase(),t=I&&I[e];return t&&t.optional_params?(0,l.jsx)(eu,{optionalParams:t.optional_params,parentFieldKey:"optional_params"}):null;case 2:if(ei(y))return eS("patterns");return null;case 3:if(ei(y))return eS("keywords");return null;case 4:return(0,l.jsxs)("div",{className:"space-y-6",children:[(0,l.jsx)("div",{children:(0,l.jsxs)("p",{className:"text-sm text-gray-500",children:["Configure settings for a specific call type. Most guardrails don't need this — skip it unless you're using a specific endpoint like ",(0,l.jsx)("code",{children:"/v1/realtime"}),"."]})}),(0,l.jsxs)("div",{children:[(0,l.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Call type"}),(0,l.jsx)(n.Select,{placeholder:"Select a call type",value:U||void 0,onChange:e=>{V(e),em(!1)},style:{width:260},allowClear:!0,options:[{value:"realtime",label:"/v1/realtime"}]}),(0,l.jsx)("p",{className:"text-xs text-gray-400 mt-1",children:"More call types coming soon."})]}),"realtime"===U&&(0,l.jsxs)("div",{className:"border border-gray-200 rounded-lg overflow-hidden",children:[(0,l.jsxs)("button",{type:"button",onClick:()=>em(e=>!e),className:"w-full flex items-center justify-between px-4 py-3 bg-gray-50 hover:bg-gray-100 text-sm font-medium text-gray-700",children:[(0,l.jsx)("span",{children:"/v1/realtime settings"}),(0,l.jsx)("svg",{className:`w-4 h-4 text-gray-500 transition-transform ${ec?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,l.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),ec&&(0,l.jsxs)("div",{className:"space-y-5 px-4 py-4 border-t border-gray-200",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"End session after X violations"}),(0,l.jsx)("p",{className:"text-xs text-gray-400 mb-2",children:"Automatically close the session after this many guardrail violations. Leave empty to never auto-close."}),(0,l.jsx)("input",{type:"number",min:1,placeholder:"e.g. 3",value:Y??"",onChange:e=>Q(e.target.value?parseInt(e.target.value,10):void 0),className:"border border-gray-300 rounded px-3 py-1.5 text-sm w-32"})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"On violation"}),(0,l.jsx)("div",{className:"space-y-2",children:["warn","end_session"].map(e=>(0,l.jsxs)("label",{className:"flex items-start gap-2 cursor-pointer",children:[(0,l.jsx)("input",{type:"radio",name:"on_violation",value:e,checked:X===e,onChange:()=>es(e),className:"mt-0.5"}),(0,l.jsxs)("div",{children:[(0,l.jsx)("span",{className:"text-sm font-medium text-gray-800",children:"warn"===e?"Warn":"End session"}),(0,l.jsx)("p",{className:"text-xs text-gray-400 m-0",children:"warn"===e?"Bot speaks the message, session continues":"Bot speaks the message, connection closes immediately"})]})]},e))})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Message the user hears"}),(0,l.jsx)("p",{className:"text-xs text-gray-400 mb-2",children:"What the bot says aloud when this guardrail fires. Falls back to the default violation message if empty."}),(0,l.jsx)("textarea",{rows:3,placeholder:"e.g. I'm not able to continue this conversation. Please contact us at 1-800-774-2678.",value:eo,onChange:e=>ed(e.target.value),className:"border border-gray-300 rounded px-3 py-2 text-sm w-full resize-none"})]})]})]})]});default:return null}})()})]})]},t)})})}),(0,l.jsxs)("div",{className:"flex items-center justify-end space-x-3 px-6 py-3 border-t border-gray-200",children:[(0,l.jsx)(c.Button,{onClick:eb,children:"Cancel"}),w>0&&(0,l.jsx)(c.Button,{onClick:()=>{k(w-1)},children:"Previous"}),w{let[g]=r.Form.useForm(),[x,h]=(0,m.useState)(!1),[f,y]=(0,m.useState)(c?.provider||null),[j,_]=(0,m.useState)(null),[v,b]=(0,m.useState)([]),[C,S]=(0,m.useState)({});(0,m.useEffect)(()=>{(async()=>{try{if(!a)return;let e=await (0,p.getGuardrailUISettings)(a);_(e)}catch(e){console.error("Error fetching guardrail settings:",e),u.default.fromBackend("Failed to load guardrail settings")}})()},[a]),(0,m.useEffect)(()=>{c?.pii_entities_config&&Object.keys(c.pii_entities_config).length>0&&(b(Object.keys(c.pii_entities_config)),S(c.pii_entities_config))},[c]);let N=e=>{b(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},w=(e,t)=>{S(a=>({...a,[e]:t}))},k=async()=>{try{h(!0);let e=await g.validateFields(),l=ea[e.provider],r={guardrail_id:d,guardrail:{guardrail_name:e.guardrail_name,litellm_params:{guardrail:l,mode:e.mode,default_on:e.default_on},guardrail_info:{}}};if("PresidioPII"===e.provider&&v.length>0){let e={};v.forEach(t=>{e[t]=C[t]||"MASK"}),r.guardrail.litellm_params.pii_entities_config=e}else if(e.config)try{let t=JSON.parse(e.config);"Bedrock"===e.provider&&t?(t.guardrail_id&&(r.guardrail.litellm_params.guardrailIdentifier=t.guardrail_id),t.guardrail_version&&(r.guardrail.litellm_params.guardrailVersion=t.guardrail_version)):r.guardrail.guardrail_info=t}catch(e){u.default.fromBackend("Invalid JSON in configuration"),h(!1);return}if(!a)throw Error("No access token available");console.log("Sending guardrail update data:",JSON.stringify(r));let i=`/guardrails/${d}`,s=await fetch(i,{method:"PUT",headers:{[(0,p.getGlobalLitellmHeaderName)()]:`Bearer ${a}`,"Content-Type":"application/json"},body:JSON.stringify(r)});if(!s.ok){let e=await s.text();throw Error(e||"Failed to update guardrail")}u.default.success("Guardrail updated successfully"),o(),t()}catch(e){console.error("Failed to update guardrail:",e),u.default.fromBackend("Failed to update guardrail: "+(e instanceof Error?e.message:String(e)))}finally{h(!1)}};return(0,l.jsx)(s.Modal,{title:"Edit Guardrail",open:e,onCancel:t,footer:null,width:700,children:(0,l.jsxs)(r.Form,{form:g,layout:"vertical",initialValues:c,children:[(0,l.jsx)(r.Form.Item,{name:"guardrail_name",label:"Guardrail Name",rules:[{required:!0,message:"Please enter a guardrail name"}],children:(0,l.jsx)(e5.TextInput,{placeholder:"Enter a name for this guardrail"})}),(0,l.jsx)(r.Form.Item,{name:"provider",label:"Guardrail Provider",rules:[{required:!0,message:"Please select a provider"}],children:(0,l.jsx)(n.Select,{placeholder:"Select a guardrail provider",onChange:e=>{y(e),g.setFieldsValue({config:void 0}),b([]),S({})},disabled:!0,optionLabelProp:"label",children:Object.entries(et()).map(([e,t])=>(0,l.jsx)(e9,{value:e,label:t,children:(0,l.jsxs)("div",{style:{display:"flex",alignItems:"center"},children:[en[t]&&(0,l.jsx)("img",{src:en[t],alt:"",style:{height:"20px",width:"20px",marginRight:"8px",objectFit:"contain"},onError:e=>{e.currentTarget.style.display="none"}}),(0,l.jsx)("span",{children:t})]})},e))})}),(0,l.jsx)(r.Form.Item,{name:"mode",label:"Mode",tooltip:"How the guardrail should be applied",rules:[{required:!0,message:"Please select a mode"}],children:(0,l.jsx)(n.Select,{children:j?.supported_modes?.map(e=>(0,l.jsx)(e9,{value:e,children:e},e))||(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(e9,{value:"pre_call",children:"pre_call"}),(0,l.jsx)(e9,{value:"post_call",children:"post_call"})]})})}),(0,l.jsx)(r.Form.Item,{name:"default_on",label:"Always On",tooltip:"If enabled, this guardrail will be applied to all requests by default",valuePropName:"checked",children:(0,l.jsx)(D.Switch,{})}),(()=>{if(!f)return null;if("PresidioPII"===f)return j&&f&&"PresidioPII"===f?(0,l.jsx)(eP,{entities:j.supported_entities,actions:j.supported_actions,selectedEntities:v,selectedActions:C,onEntitySelect:N,onActionSelect:w,entityCategories:j.pii_entity_categories}):null;switch(f){case"Aporia":return(0,l.jsx)(r.Form.Item,{label:"Aporia Configuration",name:"config",tooltip:"JSON configuration for Aporia",children:(0,l.jsx)(i.Input.TextArea,{rows:4,placeholder:`{ - "api_key": "your_aporia_api_key", - "project_name": "your_project_name" -}`})});case"AimSecurity":return(0,l.jsx)(r.Form.Item,{label:"Aim Security Configuration",name:"config",tooltip:"JSON configuration for Aim Security",children:(0,l.jsx)(i.Input.TextArea,{rows:4,placeholder:`{ - "api_key": "your_aim_api_key" -}`})});case"Bedrock":return(0,l.jsx)(r.Form.Item,{label:"Amazon Bedrock Configuration",name:"config",tooltip:"JSON configuration for Amazon Bedrock guardrails",children:(0,l.jsx)(i.Input.TextArea,{rows:4,placeholder:`{ - "guardrail_id": "your_guardrail_id", - "guardrail_version": "your_guardrail_version" -}`})});case"GuardrailsAI":return(0,l.jsx)(r.Form.Item,{label:"Guardrails.ai Configuration",name:"config",tooltip:"JSON configuration for Guardrails.ai",children:(0,l.jsx)(i.Input.TextArea,{rows:4,placeholder:`{ - "api_key": "your_guardrails_api_key", - "guardrail_id": "your_guardrail_id" -}`})});case"LakeraAI":return(0,l.jsx)(r.Form.Item,{label:"Lakera AI Configuration",name:"config",tooltip:"JSON configuration for Lakera AI",children:(0,l.jsx)(i.Input.TextArea,{rows:4,placeholder:`{ - "api_key": "your_lakera_api_key" -}`})});case"PromptInjection":return(0,l.jsx)(r.Form.Item,{label:"Prompt Injection Configuration",name:"config",tooltip:"JSON configuration for prompt injection detection",children:(0,l.jsx)(i.Input.TextArea,{rows:4,placeholder:`{ - "threshold": 0.8 -}`})});default:return(0,l.jsx)(r.Form.Item,{label:"Custom Configuration",name:"config",tooltip:"JSON configuration for your custom guardrail",children:(0,l.jsx)(i.Input.TextArea,{rows:4,placeholder:`{ - "key1": "value1", - "key2": "value2" -}`})})}})(),(0,l.jsxs)("div",{className:"flex justify-end space-x-2 mt-4",children:[(0,l.jsx)(eQ.Button,{variant:"secondary",onClick:t,children:"Cancel"}),(0,l.jsx)(eQ.Button,{onClick:k,loading:x,children:"Update Guardrail"})]})]})})};var tt=((a={}).DB="db",a.CONFIG="config",a);e.s(["default",0,({guardrailsList:e,isLoading:t,onDeleteClick:a,accessToken:r,onGuardrailUpdated:i,isAdmin:s=!1,onGuardrailClick:n})=>{let[o,d]=(0,m.useState)([{id:"created_at",desc:!0}]),[c,u]=(0,m.useState)(!1),[p,g]=(0,m.useState)(null),x=e=>e?new Date(e).toLocaleString():"-",h=[{header:"Guardrail ID",accessorKey:"guardrail_id",cell:e=>(0,l.jsx)(ef.Tooltip,{title:String(e.getValue()||""),children:(0,l.jsx)(eQ.Button,{size:"xs",variant:"light",className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left overflow-hidden truncate max-w-[200px]",onClick:()=>e.getValue()&&n(e.getValue()),children:e.getValue()?`${String(e.getValue()).slice(0,7)}...`:""})})},{header:"Name",accessorKey:"guardrail_name",cell:({row:e})=>{let t=e.original;return(0,l.jsx)(ef.Tooltip,{title:t.guardrail_name,children:(0,l.jsx)("span",{className:"text-xs font-medium",children:t.guardrail_name||"-"})})}},{header:"Provider",accessorKey:"litellm_params.guardrail",cell:({row:e})=>{let{logo:t,displayName:a}=eo(e.original.litellm_params.guardrail);return(0,l.jsxs)("div",{className:"flex items-center space-x-2",children:[t&&(0,l.jsx)("img",{src:t,alt:`${a} logo`,className:"w-4 h-4",onError:e=>{e.target.style.display="none"}}),(0,l.jsx)("span",{className:"text-xs",children:a})]})}},{header:"Mode",accessorKey:"litellm_params.mode",cell:({row:e})=>{let t=e.original;return(0,l.jsx)("span",{className:"text-xs",children:t.litellm_params.mode})}},{header:"Default On",accessorKey:"litellm_params.default_on",cell:({row:e})=>{let t=e.original;return(0,l.jsx)(e4.Badge,{color:t.litellm_params?.default_on?"green":"gray",className:"text-xs font-normal",size:"xs",children:t.litellm_params?.default_on?"Default On":"Default Off"})}},{header:"Created At",accessorKey:"created_at",cell:({row:e})=>{let t=e.original;return(0,l.jsx)(ef.Tooltip,{title:t.created_at,children:(0,l.jsx)("span",{className:"text-xs",children:x(t.created_at)})})}},{header:"Updated At",accessorKey:"updated_at",cell:({row:e})=>{let t=e.original;return(0,l.jsx)(ef.Tooltip,{title:t.updated_at,children:(0,l.jsx)("span",{className:"text-xs",children:x(t.updated_at)})})}},{id:"actions",header:"Actions",cell:({row:e})=>{let t=e.original,r=t.guardrail_definition_location===tt.CONFIG;return(0,l.jsx)("div",{className:"flex space-x-2",children:r?(0,l.jsx)(ef.Tooltip,{title:"Config guardrail cannot be deleted on the dashboard. Please delete it from the config file.",children:(0,l.jsx)(eZ.Icon,{"data-testid":"config-delete-icon",icon:eX.TrashIcon,size:"sm",className:"cursor-not-allowed text-gray-400",title:"Config guardrail cannot be deleted on the dashboard. Please delete it from the config file.","aria-label":"Delete guardrail (config)"})}):(0,l.jsx)(ef.Tooltip,{title:"Delete guardrail",children:(0,l.jsx)(eZ.Icon,{icon:eX.TrashIcon,size:"sm",onClick:()=>t.guardrail_id&&a(t.guardrail_id,t.guardrail_name||"Unnamed Guardrail"),className:"cursor-pointer hover:text-red-500"})})})}}],f=(0,e8.useReactTable)({data:e,columns:h,state:{sorting:o},onSortingChange:d,getCoreRowModel:(0,e6.getCoreRowModel)(),getSortedRowModel:(0,e6.getSortedRowModel)(),enableSorting:!0});return(0,l.jsxs)("div",{className:"rounded-lg custom-border relative",children:[(0,l.jsx)("div",{className:"overflow-x-auto",children:(0,l.jsxs)(eq.Table,{className:"[&_td]:py-0.5 [&_th]:py-1",children:[(0,l.jsx)(eU.TableHead,{children:f.getHeaderGroups().map(e=>(0,l.jsx)(eY.TableRow,{children:e.headers.map(e=>(0,l.jsx)(eV.TableHeaderCell,{className:`py-1 h-8 ${"actions"===e.id?"sticky right-0 bg-white shadow-[-4px_0_8px_-6px_rgba(0,0,0,0.1)]":""}`,onClick:e.column.getToggleSortingHandler(),children:(0,l.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,l.jsx)("div",{className:"flex items-center",children:e.isPlaceholder?null:(0,e8.flexRender)(e.column.columnDef.header,e.getContext())}),"actions"!==e.id&&(0,l.jsx)("div",{className:"w-4",children:e.column.getIsSorted()?({asc:(0,l.jsx)(e1.ChevronUpIcon,{className:"h-4 w-4 text-blue-500"}),desc:(0,l.jsx)(e2.ChevronDownIcon,{className:"h-4 w-4 text-blue-500"})})[e.column.getIsSorted()]:(0,l.jsx)(e0.SwitchVerticalIcon,{className:"h-4 w-4 text-gray-400"})})]})},e.id))},e.id))}),(0,l.jsx)(eW.TableBody,{children:t?(0,l.jsx)(eY.TableRow,{children:(0,l.jsx)(eH.TableCell,{colSpan:h.length,className:"h-8 text-center",children:(0,l.jsx)("div",{className:"text-center text-gray-500",children:(0,l.jsx)("p",{children:"Loading..."})})})}):e.length>0?f.getRowModel().rows.map(e=>(0,l.jsx)(eY.TableRow,{className:"h-8",children:e.getVisibleCells().map(e=>(0,l.jsx)(eH.TableCell,{className:`py-0.5 max-h-8 overflow-hidden text-ellipsis whitespace-nowrap ${"actions"===e.column.id?"sticky right-0 bg-white shadow-[-4px_0_8px_-6px_rgba(0,0,0,0.1)]":""}`,children:(0,e8.flexRender)(e.column.columnDef.cell,e.getContext())},e.id))},e.id)):(0,l.jsx)(eY.TableRow,{children:(0,l.jsx)(eH.TableCell,{colSpan:h.length,className:"h-8 text-center",children:(0,l.jsx)("div",{className:"text-center text-gray-500",children:(0,l.jsx)("p",{children:"No guardrails found"})})})})})]})}),p&&(0,l.jsx)(te,{visible:c,onClose:()=>u(!1),accessToken:r,onSuccess:()=>{u(!1),g(null),i()},guardrailId:p.guardrail_id||"",initialValues:{guardrail_name:p.guardrail_name||"",provider:Object.keys(ea).find(e=>ea[e]===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}})]})}],782719);var ta=e.i(500330),tl=e.i(245094),ej=ej,tr=e.i(530212),ti=e.i(350967),ts=e.i(197647),tn=e.i(653824),to=e.i(881073),td=e.i(404206),tc=e.i(723731),tm=e.i(629569),tu=e.i(678784),tp=e.i(118366),tg=e.i(560445);let{Text:tx}=d.Typography,{Option:th}=n.Select,tf=({categories:e,onActionChange:t,onSeverityChange:a,onRemove:r,readOnly:i=!1})=>{let s=[{title:"Category",dataIndex:"display_name",key:"display_name",render:(e,t)=>(0,l.jsxs)("div",{children:[(0,l.jsx)(tx,{strong:!0,children:e}),e!==t.category&&(0,l.jsx)("div",{children:(0,l.jsx)(tx,{type:"secondary",style:{fontSize:12},children:t.category})})]})},{title:"Severity Threshold",dataIndex:"severity_threshold",key:"severity_threshold",width:180,render:(e,t)=>i?(0,l.jsx)(o.Tag,{color:{high:"red",medium:"orange",low:"yellow"}[e],children:e.toUpperCase()}):(0,l.jsxs)(n.Select,{value:e,onChange:e=>a?.(t.id,e),style:{width:150},size:"small",children:[(0,l.jsx)(th,{value:"high",children:"High"}),(0,l.jsx)(th,{value:"medium",children:"Medium"}),(0,l.jsx)(th,{value:"low",children:"Low"})]})},{title:"Action",dataIndex:"action",key:"action",width:150,render:(e,a)=>i?(0,l.jsx)(o.Tag,{color:"BLOCK"===e?"red":"blue",children:e}):(0,l.jsxs)(n.Select,{value:e,onChange:e=>t?.(a.id,e),style:{width:120},size:"small",children:[(0,l.jsx)(th,{value:"BLOCK",children:"Block"}),(0,l.jsx)(th,{value:"MASK",children:"Mask"})]})}];return(i||s.push({title:"",key:"actions",width:100,render:(e,t)=>(0,l.jsx)(c.Button,{type:"text",danger:!0,size:"small",icon:(0,l.jsx)(O.DeleteOutlined,{}),onClick:()=>r?.(t.id),children:"Delete"})}),0===e.length)?(0,l.jsx)("div",{style:{textAlign:"center",padding:"40px 0",color:"#999"},children:"No categories configured."}):(0,l.jsx)(I.Table,{dataSource:e,columns:s,rowKey:"id",pagination:!1,size:"small"})},ty=({patterns:e,blockedWords:t,categories:a=[],readOnly:r=!0,onPatternActionChange:i,onPatternRemove:s,onBlockedWordUpdate:n,onBlockedWordRemove:o,onCategoryActionChange:d,onCategorySeverityChange:c,onCategoryRemove:m})=>{if(0===e.length&&0===t.length&&0===a.length)return null;let u=()=>{};return(0,l.jsxs)(l.Fragment,{children:[a.length>0&&(0,l.jsxs)(eB.Card,{className:"mt-6",children:[(0,l.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,l.jsx)(eL.Text,{className:"text-lg font-semibold",children:"Content Categories"}),(0,l.jsxs)(e4.Badge,{color:"blue",children:[a.length," categories configured"]})]}),(0,l.jsx)(tf,{categories:a,onActionChange:r?void 0:d,onSeverityChange:r?void 0:c,onRemove:r?void 0:m,readOnly:r})]}),e.length>0&&(0,l.jsxs)(eB.Card,{className:"mt-6",children:[(0,l.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,l.jsx)(eL.Text,{className:"text-lg font-semibold",children:"Pattern Detection"}),(0,l.jsxs)(e4.Badge,{color:"blue",children:[e.length," patterns configured"]})]}),(0,l.jsx)(P,{patterns:e,onActionChange:r?u:i||u,onRemove:r?u:s||u})]}),t.length>0&&(0,l.jsxs)(eB.Card,{className:"mt-6",children:[(0,l.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,l.jsx)(eL.Text,{className:"text-lg font-semibold",children:"Blocked Keywords"}),(0,l.jsxs)(e4.Badge,{color:"blue",children:[t.length," keywords configured"]})]}),(0,l.jsx)(F,{keywords:t,onActionChange:r?u:n||u,onRemove:r?u:o||u})]})]})},{Text:tj}=d.Typography,t_=({guardrailData:e,guardrailSettings:t,isEditing:a,accessToken:r,onDataChange:i,onUnsavedChanges:s})=>{let[n,o]=(0,m.useState)([]),[d,c]=(0,m.useState)([]),[u,p]=(0,m.useState)([]),[g,x]=(0,m.useState)([]),[h,f]=(0,m.useState)([]),[y,j]=(0,m.useState)([]),[_,v]=(0,m.useState)(!1),[b,C]=(0,m.useState)(null),[S,N]=(0,m.useState)(!1),[w,k]=(0,m.useState)(null);(0,m.useEffect)(()=>{if(e?.litellm_params?.patterns){let t=e.litellm_params.patterns.map((e,t)=>({id:`pattern-${t}`,type:"prebuilt"===e.pattern_type?"prebuilt":"custom",name:e.pattern_name||e.name,display_name:e.display_name,pattern:e.pattern,action:e.action||"BLOCK"}));o(t),x(t)}else o([]),x([]);if(e?.litellm_params?.blocked_words){let t=e.litellm_params.blocked_words.map((e,t)=>({id:`word-${t}`,keyword:e.keyword,action:e.action||"BLOCK",description:e.description}));c(t),f(t)}else c([]),f([]);if(e?.litellm_params?.categories?.length>0){let a=t?.content_filter_settings?.content_categories?Object.fromEntries(t.content_filter_settings.content_categories.map(e=>[e.name,e])):{},l=e.litellm_params.categories.map((e,t)=>{let l=a[e.category];return{id:`category-${t}`,category:e.category,display_name:l?.display_name??e.category,action:e.action||"BLOCK",severity_threshold:e.severity_threshold||"medium"}});p(l),j(l)}else p([]),j([]);let a=e?.litellm_params?.competitor_intent_config;if(a&&"object"==typeof a){let e=!!(a.brand_self&&Array.isArray(a.brand_self)&&a.brand_self.length>0),t={competitor_intent_type:a.competitor_intent_type??"airline",brand_self:Array.isArray(a.brand_self)?a.brand_self:[],locations:Array.isArray(a.locations)?a.locations:[],competitors:Array.isArray(a.competitors)?a.competitors:[],policy:a.policy??{competitor_comparison:"refuse",possible_competitor_comparison:"reframe"},threshold_high:"number"==typeof a.threshold_high?a.threshold_high:.7,threshold_medium:"number"==typeof a.threshold_medium?a.threshold_medium:.45,threshold_low:"number"==typeof a.threshold_low?a.threshold_low:.3};v(e),C(t),N(e),k(t)}else v(!1),C(null),N(!1),k(null)},[e,t?.content_filter_settings?.content_categories]),(0,m.useEffect)(()=>{i&&i(n,d,u,_,b)},[n,d,u,_,b,i]);let I=m.default.useMemo(()=>{let e=JSON.stringify(n)!==JSON.stringify(g),t=JSON.stringify(d)!==JSON.stringify(h),a=JSON.stringify(u)!==JSON.stringify(y),l=_!==S||JSON.stringify(b)!==JSON.stringify(w);return e||t||a||l},[n,d,u,_,b,g,h,y,S,w]);return((0,m.useEffect)(()=>{a&&s&&s(I)},[I,a,s]),e?.litellm_params?.guardrail!=="litellm_content_filter")?null:a?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(eF.Divider,{orientation:"left",children:"Content Filter Configuration"}),I&&(0,l.jsx)(tg.Alert,{type:"warning",showIcon:!0,className:"mb-4",message:(0,l.jsx)(tj,{children:'You have unsaved changes to patterns or keywords. Remember to click "Save Changes" at the bottom.'})}),(0,l.jsx)("div",{className:"mb-6",children:t&&t.content_filter_settings&&(0,l.jsx)(Z,{prebuiltPatterns:t.content_filter_settings.prebuilt_patterns||[],categories:t.content_filter_settings.pattern_categories||[],selectedPatterns:n,blockedWords:d,onPatternAdd:e=>o([...n,e]),onPatternRemove:e=>o(n.filter(t=>t.id!==e)),onPatternActionChange:(e,t)=>o(n.map(a=>a.id===e?{...a,action:t}:a)),onBlockedWordAdd:e=>c([...d,e]),onBlockedWordRemove:e=>c(d.filter(t=>t.id!==e)),onBlockedWordUpdate:(e,t,a)=>c(d.map(l=>l.id===e?{...l,[t]:a}:l)),onFileUpload:e=>{console.log("File uploaded:",e)},accessToken:r,contentCategories:t.content_filter_settings.content_categories||[],selectedContentCategories:u,onContentCategoryAdd:e=>p([...u,e]),onContentCategoryRemove:e=>p(u.filter(t=>t.id!==e)),onContentCategoryUpdate:(e,t,a)=>p(u.map(l=>l.id===e?{...l,[t]:a}:l)),competitorIntentEnabled:_,competitorIntentConfig:b,onCompetitorIntentChange:(e,t)=>{v(e),C(t)}})})]}):(0,l.jsx)(ty,{patterns:n,blockedWords:d,categories:u,readOnly:!0})};var tv=e.i(788191),tb=e.i(245704),tC=e.i(518617);let tS={icon:{tag:"svg",attrs:{viewBox:"0 0 1024 1024",focusable:"false"},children:[{tag:"path",attrs:{d:"M715.8 493.5L335 165.1c-14.2-12.2-35-1.2-35 18.5v656.8c0 19.7 20.8 30.7 35 18.5l380.8-328.4c10.9-9.4 10.9-27.6 0-37z"}}]},name:"caret-right",theme:"outlined"};var tN=m.forwardRef(function(e,t){return m.createElement(eC.default,(0,ev.default)({},e,{ref:t,icon:tS}))}),tw=e.i(987432);let tk={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M892 772h-80v-80c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v80h-80c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h80v80c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8v-80h80c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8zM373.5 498.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.8-1.7-203.2 89.2-203.2 200 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.8-1.1 6.4-4.8 5.9-8.8zM824 472c0-109.4-87.9-198.3-196.9-200C516.3 270.3 424 361.2 424 472c0 62.8 29 118.8 74.2 155.5a300.95 300.95 0 00-86.4 60.4C357 742.6 326 814.8 324 891.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.5C505.8 695.7 563 672 624 672c110.4 0 200-89.5 200-200zm-109.5 90.5C690.3 586.7 658.2 600 624 600s-66.3-13.3-90.5-37.5a127.26 127.26 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-.1 34.2-13.4 66.3-37.6 90.5z"}}]},name:"usergroup-add",theme:"outlined"};var tI=m.forwardRef(function(e,t){return m.createElement(eC.default,(0,ev.default)({},e,{ref:t,icon:tk}))}),tO=e.i(872934);let{Panel:tT}=E.Collapse,{TextArea:tA}=i.Input,tP={empty:{name:"Empty Template",code:`async def apply_guardrail(inputs, request_data, input_type): - # inputs: {texts, images, tools, tool_calls, structured_messages, model} - # request_data: {model, user_id, team_id, end_user_id, metadata} - # input_type: "request" or "response" - return allow()`},blockSSN:{name:"Block SSN",code:`def apply_guardrail(inputs, request_data, input_type): - for text in inputs["texts"]: - if regex_match(text, r"\\d{3}-\\d{2}-\\d{4}"): - return block("SSN detected") - return allow()`},redactEmail:{name:"Redact Emails",code:`def apply_guardrail(inputs, request_data, input_type): - pattern = r"[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}" - modified = [] - for text in inputs["texts"]: - modified.append(regex_replace(text, pattern, "[EMAIL REDACTED]")) - return modify(texts=modified)`},blockSQL:{name:"Block SQL Injection",code:`def apply_guardrail(inputs, request_data, input_type): - if input_type != "request": - return allow() - for text in inputs["texts"]: - if contains_code_language(text, ["sql"]): - return block("SQL code not allowed") - return allow()`},validateJSON:{name:"Validate JSON",code:`def apply_guardrail(inputs, request_data, input_type): - if input_type != "response": - return allow() - - schema = {"type": "object", "required": ["name", "value"]} - - for text in inputs["texts"]: - obj = json_parse(text) - if obj is None: - return block("Invalid JSON response") - if not json_schema_valid(obj, schema): - return block("Response missing required fields") - return allow()`},externalAPI:{name:"External API Check (async)",code:`async def apply_guardrail(inputs, request_data, input_type): - # Call an external moderation API (async for non-blocking) - for text in inputs["texts"]: - response = await http_post( - "https://api.example.com/moderate", - body={"text": text, "user_id": request_data["user_id"]}, - headers={"Authorization": "Bearer YOUR_API_KEY"}, - timeout=10 - ) - - if not response["success"]: - # API call failed, allow by default or block - return allow() - - if response["body"].get("flagged"): - return block(response["body"].get("reason", "Content flagged")) - - return allow()`}},tB={"Return Values":[{name:"allow()",desc:"Let request/response through"},{name:"block(reason)",desc:"Reject with message"},{name:"modify(texts=[], images=[], tool_calls=[])",desc:"Transform content"}],"HTTP Requests (async)":[{name:"await http_request(url, method, headers, body)",desc:"Make async HTTP request"},{name:"await http_get(url, headers)",desc:"Async GET request"},{name:"await http_post(url, body, headers)",desc:"Async POST request"}],"Regex Functions":[{name:"regex_match(text, pattern)",desc:"Returns True if pattern found"},{name:"regex_replace(text, pattern, replacement)",desc:"Replace all matches"},{name:"regex_find_all(text, pattern)",desc:"Return list of matches"}],"JSON Functions":[{name:"json_parse(text)",desc:"Parse JSON string, returns None on error"},{name:"json_stringify(obj)",desc:"Convert to JSON string"},{name:"json_schema_valid(obj, schema)",desc:"Validate against JSON schema"}],"URL Functions":[{name:"extract_urls(text)",desc:"Extract all URLs from text"},{name:"is_valid_url(url)",desc:"Check if URL is valid"},{name:"all_urls_valid(text)",desc:"Check all URLs in text are valid"}],"Code Detection":[{name:"detect_code(text)",desc:"Returns True if code detected"},{name:"detect_code_languages(text)",desc:"Returns list of detected languages"},{name:'contains_code_language(text, ["sql"])',desc:"Check for specific languages"}],"Text Utilities":[{name:"contains(text, substring)",desc:"Check if substring exists"},{name:"contains_any(text, [substr1, substr2])",desc:"Check if any substring exists"},{name:"word_count(text)",desc:"Count words"},{name:"char_count(text)",desc:"Count characters"},{name:"lower(text) / upper(text) / trim(text)",desc:"String transforms"}]},tL=[{value:"pre_call",label:"pre_call (Request)"},{value:"post_call",label:"post_call (Response)"},{value:"during_call",label:"during_call (Parallel)"},{value:"logging_only",label:"logging_only"},{value:"pre_mcp_call",label:"pre_mcp_call (Before MCP Tool Call)"},{value:"post_mcp_call",label:"post_mcp_call (After MCP Tool Call)"},{value:"during_mcp_call",label:"during_mcp_call (During MCP Tool Call)"}],tF=({visible:e,onClose:t,onSuccess:a,accessToken:r,editData:i})=>{let o=!!i,[d,c]=(0,m.useState)(""),[g,x]=(0,m.useState)(["pre_call"]),[h,f]=(0,m.useState)(!1),[y,j]=(0,m.useState)("empty"),[_,v]=(0,m.useState)(tP.empty.code),[b,C]=(0,m.useState)(!1),[S,N]=(0,m.useState)(!1),[w,k]=(0,m.useState)(!1),I={texts:["Hello, my SSN is 123-45-6789"],images:[],tools:[{type:"function",function:{name:"get_weather",description:"Get the current weather in a location",parameters:{type:"object",properties:{location:{type:"string",description:"City name"}},required:["location"]}}}],tool_calls:[],structured_messages:[{role:"system",content:"You are a helpful assistant."},{role:"user",content:"Hello, my SSN is 123-45-6789"}],model:"gpt-4"},O={texts:["The weather in San Francisco is 72°F and sunny."],images:[],tools:[],tool_calls:[{id:"call_abc123",type:"function",function:{name:"get_weather",arguments:'{"location": "San Francisco"}'}}],structured_messages:[],model:"gpt-4"},T={texts:['Tool: read_wiki_structure\nArguments: {"repoName": "BerriAI/litellm"}'],images:[],tools:[{type:"function",function:{name:"read_wiki_structure",description:"Read the structure of a GitHub repository (MCP tool passed as OpenAI tool)",parameters:{type:"object",properties:{repoName:{type:"string",description:"Repository name, e.g. BerriAI/litellm"}},required:["repoName"]}}}],tool_calls:[{id:"call_mcp_001",type:"function",function:{name:"read_wiki_structure",arguments:'{"repoName": "BerriAI/litellm"}'}}],structured_messages:[{role:"user",content:'Tool: read_wiki_structure\nArguments: {"repoName": "BerriAI/litellm"}'}],model:"mcp-tool-call"},[A,P]=(0,m.useState)(JSON.stringify(I,null,2)),[B,L]=(0,m.useState)(null),[F,z]=(0,m.useState)(null),M=(0,m.useRef)(null),$=e=>null==e?["pre_call"]:Array.isArray(e)?e.length?e:["pre_call"]:[e];(0,m.useEffect)(()=>{e&&(i?(c(i.guardrail_name||""),x($(i.litellm_params?.mode)),f(i.litellm_params?.default_on||!1),v(i.litellm_params?.custom_code||tP.empty.code),j("")):(c(""),x(["pre_call"]),f(!1),j("empty"),v(tP.empty.code)),L(null),k(!1))},[e,i]);let R=async e=>{try{await navigator.clipboard.writeText(e),z(e),setTimeout(()=>z(null),2e3)}catch(e){console.error("Failed to copy:",e)}},G=async()=>{if(!d.trim())return void u.default.fromBackend("Please enter a guardrail name");if(!_.trim())return void u.default.fromBackend("Please enter custom code");if(!r)return void u.default.fromBackend("No access token available");C(!0);try{if(o&&i){let e={litellm_params:{custom_code:_}};d!==i.guardrail_name&&(e.guardrail_name=d);let t=$(i.litellm_params?.mode);(g.length!==t.length||g.some((e,a)=>e!==t[a]))&&(e.litellm_params.mode=g),h!==i.litellm_params?.default_on&&(e.litellm_params.default_on=h),await (0,p.updateGuardrailCall)(r,i.guardrail_id,e),u.default.success("Custom code guardrail updated successfully")}else await (0,p.createGuardrailCall)(r,{guardrail_name:d,litellm_params:{guardrail:"custom_code",mode:g,default_on:h,custom_code:_},guardrail_info:{}}),u.default.success("Custom code guardrail created successfully");a(),t()}catch(e){console.error("Failed to save guardrail:",e),u.default.fromBackend(`Failed to ${o?"update":"create"} guardrail: `+(e instanceof Error?e.message:String(e)))}finally{C(!1)}},K=async()=>{if(!r)return void L({error:"No access token available"});N(!0),L(null);try{let e;try{e=JSON.parse(A)}catch(e){L({error:"Invalid test input JSON"}),N(!1);return}e.texts||(e.texts=[]);let t=["pre_call","pre_mcp_call"],a=["post_call","post_mcp_call"],l=g.some(e=>t.includes(e))?"request":g.some(e=>a.includes(e))?"response":"request",i=await (0,p.testCustomCodeGuardrail)(r,{custom_code:_,test_input:e,input_type:l,request_data:{model:"test-model",metadata:{}}});i.success&&i.result?L(i.result):i.error?L({error:i.error,error_type:i.error_type}):L({error:"Unknown error occurred"})}catch(e){console.error("Failed to test custom code:",e),L({error:e instanceof Error?e.message:"Failed to test custom code"})}finally{N(!1)}},J=_.split("\n").length;return(0,l.jsxs)(s.Modal,{open:e,onCancel:t,footer:null,width:1400,className:"custom-code-modal",closable:!0,destroyOnClose:!0,children:[(0,l.jsxs)("div",{className:"flex flex-col h-[80vh]",children:[(0,l.jsxs)("div",{className:"pb-4 border-b border-gray-200",children:[(0,l.jsx)("h2",{className:"text-xl font-semibold text-gray-900",children:o?"Edit Custom Guardrail":"Create Custom Guardrail"}),(0,l.jsx)("p",{className:"text-sm text-gray-500 mt-1",children:"Define custom logic using Python-like syntax"})]}),(0,l.jsxs)("div",{className:"flex items-center gap-4 py-4 border-b border-gray-100",children:[(0,l.jsxs)("div",{className:"flex-1 max-w-[200px]",children:[(0,l.jsx)("label",{className:"block text-xs font-medium text-gray-600 mb-1",children:"Guardrail Name"}),(0,l.jsx)(e5.TextInput,{value:d,onValueChange:c,placeholder:"e.g., block-pii-custom"})]}),(0,l.jsxs)("div",{className:"w-[280px]",children:[(0,l.jsx)("label",{className:"block text-xs font-medium text-gray-600 mb-1",children:"Mode (can select multiple)"}),(0,l.jsx)(n.Select,{mode:"multiple",value:g,onChange:x,options:tL,className:"w-full",size:"middle",placeholder:"Select modes"})]}),(0,l.jsxs)("div",{className:"w-[180px]",children:[(0,l.jsx)("label",{className:"block text-xs font-medium text-gray-600 mb-1",children:"Template"}),(0,l.jsx)(n.Select,{value:y,onChange:e=>{j(e),v(tP[e].code)},className:"w-full",size:"middle",dropdownRender:e=>(0,l.jsxs)(l.Fragment,{children:[e,(0,l.jsx)(eF.Divider,{style:{margin:"8px 0"}}),(0,l.jsxs)("div",{style:{padding:"8px 12px",cursor:"pointer",color:"#1890ff",fontSize:"12px",display:"flex",alignItems:"center",gap:"4px"},onClick:e=>{e.preventDefault(),window.open("https://models.litellm.ai/guardrails","_blank")},onMouseEnter:e=>{e.currentTarget.style.backgroundColor="#f0f0f0"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="transparent"},children:[(0,l.jsx)(tI,{}),(0,l.jsx)("span",{children:"Browse Community templates"}),(0,l.jsx)(tO.ExportOutlined,{style:{fontSize:"10px"}})]})]}),children:(0,l.jsx)(n.Select.OptGroup,{label:"STANDARD",children:Object.entries(tP).map(([e,t])=>(0,l.jsx)(n.Select.Option,{value:e,children:t.name},e))})})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2 pt-5",children:[(0,l.jsx)("span",{className:"text-sm text-gray-600",children:"Default On"}),(0,l.jsx)(D.Switch,{checked:h,onChange:f})]})]}),(0,l.jsxs)("div",{className:"flex flex-1 overflow-hidden mt-4 gap-6",children:[(0,l.jsxs)("div",{className:"flex-[2] flex flex-col min-w-0 overflow-y-auto",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between mb-2 flex-shrink-0",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wide",children:"Python Logic"}),(0,l.jsx)("span",{className:"text-xs text-gray-400",children:"Restricted environment (no imports)"})]}),(0,l.jsxs)("div",{className:"relative rounded-lg overflow-hidden border border-gray-700 bg-[#1e1e1e] flex-shrink-0",style:{minHeight:"300px",maxHeight:"400px"},children:[(0,l.jsx)("div",{className:"absolute left-0 top-0 bottom-0 w-12 bg-[#1e1e1e] border-r border-gray-700 text-right pr-3 pt-3 select-none overflow-hidden",style:{fontFamily:"'Fira Code', 'Monaco', 'Consolas', monospace",fontSize:"14px",lineHeight:"1.6"},children:Array.from({length:Math.max(J,20)},(e,t)=>(0,l.jsx)("div",{className:"text-gray-500 h-[22.4px]",children:t+1},t+1))}),(0,l.jsx)("textarea",{ref:M,value:_,onChange:e=>v(e.target.value),onKeyDown:e=>{if("Tab"===e.key){e.preventDefault();let t=e.currentTarget,a=t.selectionStart,l=t.selectionEnd;v(_.substring(0,a)+" "+_.substring(l)),setTimeout(()=>{t.selectionStart=t.selectionEnd=a+4},0)}},spellCheck:!1,className:"w-full h-full pl-14 pr-4 pt-3 pb-3 resize-none focus:outline-none bg-transparent text-gray-200",style:{fontFamily:"'Fira Code', 'Monaco', 'Consolas', monospace",fontSize:"14px",lineHeight:"1.6",tabSize:4}})]}),(0,l.jsx)(E.Collapse,{activeKey:w?["test"]:[],onChange:e=>k(e.includes("test")),className:"mt-3 bg-white border border-gray-200 rounded-lg flex-shrink-0",expandIcon:({isActive:e})=>(0,l.jsx)(tN,{rotate:90*!!e}),children:(0,l.jsx)(tT,{header:(0,l.jsxs)("span",{className:"flex items-center gap-2 text-sm font-medium",children:[(0,l.jsx)(tv.PlayCircleOutlined,{className:"text-blue-500"}),"Test Your Guardrail"]}),children:(0,l.jsxs)("div",{className:"space-y-3",children:[(0,l.jsxs)("div",{children:[(0,l.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,l.jsx)("label",{className:"block text-xs font-medium text-gray-600",children:"Test Input (JSON)"}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"text-xs text-gray-500",children:"Load example:"}),(0,l.jsx)("button",{type:"button",onClick:()=>P(JSON.stringify(I,null,2)),className:"px-2 py-1 text-xs rounded border border-orange-200 bg-orange-50 text-orange-700 hover:bg-orange-100 transition-colors",children:"Pre-call"}),(0,l.jsx)("button",{type:"button",onClick:()=>P(JSON.stringify(T,null,2)),className:"px-2 py-1 text-xs rounded border border-purple-200 bg-purple-50 text-purple-700 hover:bg-purple-100 transition-colors",children:"Pre MCP"}),(0,l.jsx)("button",{type:"button",onClick:()=>P(JSON.stringify(O,null,2)),className:"px-2 py-1 text-xs rounded border border-green-200 bg-green-50 text-green-700 hover:bg-green-100 transition-colors",children:"Post-call"})]})]}),(0,l.jsx)("div",{className:"mb-2 p-2 bg-gray-50 rounded text-xs text-gray-600 border border-gray-200",children:(0,l.jsxs)("div",{className:"grid grid-cols-2 gap-x-4 gap-y-1",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("strong",{children:"texts"}),": Message content (always)"]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("strong",{children:"images"}),": Base64 images (vision)"]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("strong",{children:"tools"}),": Tool definitions ",(0,l.jsx)("span",{className:"text-orange-600",children:"(pre_call)"}),", MCP as OpenAI tool ",(0,l.jsx)("span",{className:"text-purple-600",children:"(pre_mcp_call)"})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("strong",{children:"tool_calls"}),": LLM tool calls ",(0,l.jsx)("span",{className:"text-green-600",children:"(post_call)"})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("strong",{children:"structured_messages"}),": Full messages ",(0,l.jsx)("span",{className:"text-orange-600",children:"(pre_call)"})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("strong",{children:"model"}),": Model name (always)"]})]})}),(0,l.jsx)(tA,{value:A,onChange:e=>P(e.target.value),rows:8,className:"font-mono text-xs",placeholder:'{"texts": ["test message"], ...}'})]}),(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[(0,l.jsx)(eQ.Button,{size:"xs",onClick:K,disabled:S,icon:tv.PlayCircleOutlined,children:S?"Running...":"Run Test"}),B&&(0,l.jsx)("div",{className:`flex items-center gap-2 text-sm ${B.error?"text-red-600":"allow"===B.action?"text-green-600":"block"===B.action?"text-orange-600":"text-blue-600"}`,children:B.error?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(tC.CloseCircleOutlined,{}),(0,l.jsxs)("span",{children:[B.error_type&&(0,l.jsxs)("span",{className:"font-medium",children:["[",B.error_type,"] "]}),B.error]})]}):"allow"===B.action?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(tb.CheckCircleOutlined,{})," Allowed"]}):"block"===B.action?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(tC.CloseCircleOutlined,{})," Blocked: ",B.reason]}):"modify"===B.action?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(tb.CheckCircleOutlined,{})," Modified",B.texts&&B.texts.length>0&&(0,l.jsxs)("span",{className:"text-xs text-gray-500 ml-1",children:["→ ",B.texts[0].substring(0,50),B.texts[0].length>50?"...":""]})]}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(tb.CheckCircleOutlined,{})," ",B.action||"Unknown"]})})]})]})},"test")}),(0,l.jsxs)("div",{className:"mt-3 p-4 bg-gradient-to-r from-blue-50 to-indigo-50 border border-blue-200 rounded-lg flex items-center justify-between flex-shrink-0",children:[(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[(0,l.jsx)("div",{className:"bg-blue-100 rounded-full p-2",children:(0,l.jsx)(tI,{className:"text-blue-600 text-lg"})}),(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{className:"text-sm font-medium text-gray-900",children:"Built a useful guardrail?"}),(0,l.jsx)("div",{className:"text-xs text-gray-600",children:"Share it with the community and help others build faster"})]})]}),(0,l.jsx)(eQ.Button,{size:"xs",onClick:()=>window.open("https://github.com/BerriAI/litellm-guardrails","_blank"),icon:tO.ExportOutlined,className:"bg-blue-600 hover:bg-blue-700 text-white border-0",children:"Contribute Template"})]})]}),(0,l.jsxs)("div",{className:"w-[300px] flex-shrink-0 overflow-auto border-l border-gray-200 pl-6",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,l.jsx)(tl.CodeOutlined,{className:"text-blue-500"}),(0,l.jsx)("span",{className:"font-semibold text-gray-700",children:"Available Primitives"})]}),(0,l.jsx)("p",{className:"text-xs text-gray-500 mb-3",children:"Click to copy functions to clipboard"}),(0,l.jsx)(E.Collapse,{defaultActiveKey:["Return Values"],className:"primitives-collapse bg-transparent border-0",expandIconPosition:"end",children:Object.entries(tB).map(([e,t])=>(0,l.jsx)(tT,{header:(0,l.jsx)("span",{className:"text-sm font-medium text-gray-700",children:e}),className:"bg-white mb-2 rounded-lg border border-gray-200",children:(0,l.jsx)("div",{className:"space-y-2",children:t.map(e=>(0,l.jsx)("button",{onClick:()=>R(e.name),className:`w-full text-left px-2 py-2 rounded transition-colors ${F===e.name?"bg-green-100":"bg-gray-50 hover:bg-blue-50"}`,children:F===e.name?(0,l.jsxs)("span",{className:"flex items-center gap-1 text-xs font-mono text-green-700",children:[(0,l.jsx)(tb.CheckCircleOutlined,{})," Copied!"]}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("div",{className:"text-xs font-mono text-gray-800",children:e.name}),(0,l.jsx)("div",{className:"text-[10px] text-gray-500 mt-0.5",children:e.desc})]})},e.name))})},e))})]})]}),(0,l.jsxs)("div",{className:"flex items-center justify-between pt-4 mt-4 border-t border-gray-200",children:[(0,l.jsx)("span",{className:"text-xs text-gray-400",children:"Changes are auto-saved to local draft"}),(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[(0,l.jsx)(eQ.Button,{variant:"secondary",onClick:t,children:"Cancel"}),(0,l.jsx)(eQ.Button,{onClick:G,loading:b,disabled:b||!d.trim(),icon:tw.SaveOutlined,children:o?"Update Guardrail":"Save Guardrail"})]})]})]}),(0,l.jsx)("style",{children:` - .custom-code-modal .ant-modal-content { - padding: 24px; - } - .custom-code-modal .ant-modal-close { - top: 20px; - right: 20px; - } - .primitives-collapse .ant-collapse-item { - border: none !important; - } - .primitives-collapse .ant-collapse-header { - padding: 8px 12px !important; - } - .primitives-collapse .ant-collapse-content-box { - padding: 8px 12px !important; - } - `})]})};e.s(["default",0,({guardrailId:e,onClose:t,accessToken:a,isAdmin:s})=>{let[o,d]=(0,m.useState)(null),[g,x]=(0,m.useState)(null),[h,f]=(0,m.useState)(!0),[y,j]=(0,m.useState)(!1),[_]=r.Form.useForm(),[v,b]=(0,m.useState)([]),[C,S]=(0,m.useState)({}),[N,w]=(0,m.useState)(null),[k,I]=(0,m.useState)({}),[O,T]=(0,m.useState)(!1),A={rules:[],default_action:"deny",on_disallowed_action:"block",violation_message_template:""},[P,B]=(0,m.useState)(A),[L,F]=(0,m.useState)(!1),[E,z]=(0,m.useState)(!1),M=m.default.useRef({patterns:[],blockedWords:[],categories:[]}),$=(0,m.useCallback)((e,t,a,l,r)=>{M.current={patterns:e,blockedWords:t,categories:a||[],competitorIntentEnabled:l,competitorIntentConfig:r}},[]),R=async()=>{try{if(f(!0),!a)return;let t=await (0,p.getGuardrailInfo)(a,e);if(d(t),t.litellm_params?.pii_entities_config){let e=t.litellm_params.pii_entities_config;if(b([]),S({}),Object.keys(e).length>0){let t=[],a={};Object.entries(e).forEach(([e,l])=>{t.push(e),a[e]="string"==typeof l?l:"MASK"}),b(t),S(a)}}else b([]),S({})}catch(e){u.default.fromBackend("Failed to load guardrail information"),console.error("Error fetching guardrail info:",e)}finally{f(!1)}},G=async()=>{try{if(!a)return;let e=await (0,p.getGuardrailProviderSpecificParams)(a);x(e)}catch(e){console.error("Error fetching guardrail provider specific params:",e)}},D=async()=>{try{if(!a)return;let e=await (0,p.getGuardrailUISettings)(a);w(e)}catch(e){console.error("Error fetching guardrail UI settings:",e)}};(0,m.useEffect)(()=>{G()},[a]),(0,m.useEffect)(()=>{R(),D()},[e,a]),(0,m.useEffect)(()=>{o&&_&&_.setFieldsValue({guardrail_name:o.guardrail_name,...o.litellm_params,guardrail_info:o.guardrail_info?JSON.stringify(o.guardrail_info,null,2):"",...o.litellm_params?.optional_params&&{optional_params:o.litellm_params.optional_params}})},[o,g,_]);let K=(0,m.useCallback)(()=>{o?.litellm_params?.guardrail==="tool_permission"?B({rules:o.litellm_params?.rules||[],default_action:(o.litellm_params?.default_action||"deny").toLowerCase(),on_disallowed_action:(o.litellm_params?.on_disallowed_action||"block").toLowerCase(),violation_message_template:o.litellm_params?.violation_message_template||""}):B(A),F(!1)},[o]);(0,m.useEffect)(()=>{K()},[K]);let J=async t=>{try{if(!a)return;let d={litellm_params:{}};t.guardrail_name!==o.guardrail_name&&(d.guardrail_name=t.guardrail_name),t.default_on!==o.litellm_params?.default_on&&(d.litellm_params.default_on=t.default_on);let c=o.guardrail_info,m=t.guardrail_info?JSON.parse(t.guardrail_info):void 0;JSON.stringify(c)!==JSON.stringify(m)&&(d.guardrail_info=m);let x=o.litellm_params?.pii_entities_config||{},h={};if(v.forEach(e=>{h[e]=C[e]||"MASK"}),JSON.stringify(x)!==JSON.stringify(h)&&(d.litellm_params.pii_entities_config=h),o.litellm_params?.guardrail==="litellm_content_filter"&&O){var l,r,i,s,n;let e,t=(l=M.current.patterns||[],r=M.current.blockedWords||[],i=M.current.categories||[],s=M.current.competitorIntentEnabled,n=M.current.competitorIntentConfig,e={patterns:l.map(e=>({pattern_type:"prebuilt"===e.type?"prebuilt":"regex",pattern_name:"prebuilt"===e.type?e.name:void 0,pattern:"custom"===e.type?e.pattern:void 0,name:e.name,action:e.action})),blocked_words:r.map(e=>({keyword:e.keyword,action:e.action,description:e.description}))},void 0!==i&&(e.categories=i.map(e=>({category:e.category,enabled:!0,action:e.action,severity_threshold:e.severity_threshold||"medium"}))),s&&n&&n.brand_self.length>0&&(e.competitor_intent_config={competitor_intent_type:n.competitor_intent_type,brand_self:n.brand_self,locations:n.locations?.length?n.locations:void 0,competitors:"generic"===n.competitor_intent_type&&n.competitors?.length?n.competitors:void 0,policy:n.policy,threshold_high:n.threshold_high,threshold_medium:n.threshold_medium,threshold_low:n.threshold_low}),e);d.litellm_params.patterns=t.patterns,d.litellm_params.blocked_words=t.blocked_words,d.litellm_params.categories=t.categories,d.litellm_params.competitor_intent_config=t.competitor_intent_config??null}if(o.litellm_params?.guardrail==="tool_permission"){let e=o.litellm_params?.rules||[],t=P.rules||[],a=JSON.stringify(e)!==JSON.stringify(t),l=(o.litellm_params?.default_action||"deny").toLowerCase(),r=(P.default_action||"deny").toLowerCase(),i=l!==r,s=(o.litellm_params?.on_disallowed_action||"block").toLowerCase(),n=(P.on_disallowed_action||"block").toLowerCase(),c=s!==n,m=o.litellm_params?.violation_message_template||"",u=P.violation_message_template||"",p=m!==u;(L||a||i||c||p)&&(d.litellm_params.rules=t,d.litellm_params.default_action=r,d.litellm_params.on_disallowed_action=n,d.litellm_params.violation_message_template=u||null)}let f=Object.keys(ea).find(e=>ea[e]===o.litellm_params?.guardrail);console.log("values: ",JSON.stringify(t)),console.log("currentProvider: ",f);let y=o.litellm_params?.guardrail==="tool_permission";if(g&&f&&!y){let e=g[ea[f]?.toLowerCase()]||{},a=new Set;console.log("providerSpecificParams: ",JSON.stringify(e)),Object.keys(e).forEach(e=>{"optional_params"!==e&&a.add(e)}),e.optional_params&&e.optional_params.fields&&Object.keys(e.optional_params.fields).forEach(e=>{a.add(e)}),console.log("allowedParams: ",a),a.forEach(e=>{if("patterns"===e||"blocked_words"===e||"categories"===e)return;let a=t[e];(null==a||""===a)&&(a=t.optional_params?.[e]);let l=o.litellm_params?.[e];JSON.stringify(a)!==JSON.stringify(l)&&(null!=a&&""!==a?d.litellm_params[e]=a:null!=l&&""!==l&&(d.litellm_params[e]=null))})}if(0===Object.keys(d.litellm_params).length&&delete d.litellm_params,0===Object.keys(d).length){u.default.info("No changes detected"),j(!1);return}await (0,p.updateGuardrailCall)(a,e,d),u.default.success("Guardrail updated successfully"),T(!1),R(),j(!1)}catch(e){console.error("Error updating guardrail:",e),u.default.fromBackend("Failed to update guardrail")}};if(h)return(0,l.jsx)("div",{className:"p-4",children:"Loading..."});if(!o)return(0,l.jsx)("div",{className:"p-4",children:"Guardrail not found"});let q=e=>e?new Date(e).toLocaleString():"-",{logo:W,displayName:H}=eo(o.litellm_params?.guardrail||""),U=async(e,t)=>{await (0,ta.copyToClipboard)(e)&&(I(e=>({...e,[t]:!0})),setTimeout(()=>{I(e=>({...e,[t]:!1}))},2e3))},V="config"===o.guardrail_definition_location;return(0,l.jsxs)("div",{className:"p-4",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)(c.Button,{type:"text",icon:(0,l.jsx)(tr.ArrowLeftIcon,{className:"w-4 h-4"}),onClick:t,className:"mb-4",children:"Back to Guardrails"}),(0,l.jsx)(tm.Title,{children:o.guardrail_name||"Unnamed Guardrail"}),(0,l.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,l.jsx)(eL.Text,{className:"text-gray-500 font-mono",children:o.guardrail_id}),(0,l.jsx)(c.Button,{type:"text",size:"small",icon:k["guardrail-id"]?(0,l.jsx)(tu.CheckIcon,{size:12}):(0,l.jsx)(tp.CopyIcon,{size:12}),onClick:()=>U(o.guardrail_id,"guardrail-id"),className:`left-2 z-10 transition-all duration-200 ${k["guardrail-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100"}`})]})]}),(0,l.jsxs)(tn.TabGroup,{children:[(0,l.jsxs)(to.TabList,{className:"mb-4",children:[(0,l.jsx)(ts.Tab,{children:"Overview"},"overview"),s?(0,l.jsx)(ts.Tab,{children:"Settings"},"settings"):(0,l.jsx)(l.Fragment,{})]}),(0,l.jsxs)(tc.TabPanels,{children:[(0,l.jsxs)(td.TabPanel,{children:[(0,l.jsxs)(ti.Grid,{numItems:1,numItemsSm:2,numItemsLg:3,className:"gap-6",children:[(0,l.jsxs)(eB.Card,{children:[(0,l.jsx)(eL.Text,{children:"Provider"}),(0,l.jsxs)("div",{className:"mt-2 flex items-center space-x-2",children:[W&&(0,l.jsx)("img",{src:W,alt:`${H} logo`,className:"w-6 h-6",onError:e=>{e.target.style.display="none"}}),(0,l.jsx)(tm.Title,{children:H})]})]}),(0,l.jsxs)(eB.Card,{children:[(0,l.jsx)(eL.Text,{children:"Mode"}),(0,l.jsxs)("div",{className:"mt-2",children:[(0,l.jsx)(tm.Title,{children:o.litellm_params?.mode||"-"}),(0,l.jsx)(e4.Badge,{color:o.litellm_params?.default_on?"green":"gray",children:o.litellm_params?.default_on?"Default On":"Default Off"})]})]}),(0,l.jsxs)(eB.Card,{children:[(0,l.jsx)(eL.Text,{children:"Created At"}),(0,l.jsxs)("div",{className:"mt-2",children:[(0,l.jsx)(tm.Title,{children:q(o.created_at)}),(0,l.jsxs)(eL.Text,{children:["Last Updated: ",q(o.updated_at)]})]})]})]}),o.litellm_params?.pii_entities_config&&Object.keys(o.litellm_params.pii_entities_config).length>0&&(0,l.jsx)(eB.Card,{className:"mt-6",children:(0,l.jsxs)("div",{className:"flex justify-between items-center",children:[(0,l.jsx)(eL.Text,{className:"font-medium",children:"PII Protection"}),(0,l.jsxs)(e4.Badge,{color:"blue",children:[Object.keys(o.litellm_params.pii_entities_config).length," PII entities configured"]})]})}),o.litellm_params?.pii_entities_config&&Object.keys(o.litellm_params.pii_entities_config).length>0&&(0,l.jsxs)(eB.Card,{className:"mt-6",children:[(0,l.jsx)(eL.Text,{className:"mb-4 text-lg font-semibold",children:"PII Entity Configuration"}),(0,l.jsxs)("div",{className:"border rounded-lg overflow-hidden shadow-sm",children:[(0,l.jsxs)("div",{className:"bg-gray-50 px-5 py-3 border-b flex",children:[(0,l.jsx)(eL.Text,{className:"flex-1 font-semibold text-gray-700",children:"Entity Type"}),(0,l.jsx)(eL.Text,{className:"flex-1 font-semibold text-gray-700",children:"Configuration"})]}),(0,l.jsx)("div",{className:"max-h-[400px] overflow-y-auto",children:Object.entries(o.litellm_params?.pii_entities_config).map(([e,t])=>(0,l.jsxs)("div",{className:"px-5 py-3 flex border-b hover:bg-gray-50 transition-colors",children:[(0,l.jsx)(eL.Text,{className:"flex-1 font-medium text-gray-900",children:e}),(0,l.jsx)(eL.Text,{className:"flex-1",children:(0,l.jsxs)("span",{className:`inline-flex items-center gap-1.5 ${"MASK"===t?"text-blue-600":"text-red-600"}`,children:["MASK"===t?(0,l.jsx)(ej.default,{}):(0,l.jsx)(e_.StopOutlined,{}),String(t)]})})]},e))})]})]}),o.litellm_params?.guardrail==="tool_permission"&&(0,l.jsx)(eB.Card,{className:"mt-6",children:(0,l.jsx)(e$,{value:P,disabled:!0})}),o.litellm_params?.guardrail==="custom_code"&&o.litellm_params?.custom_code&&(0,l.jsxs)(eB.Card,{className:"mt-6",children:[(0,l.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(tl.CodeOutlined,{className:"text-blue-500"}),(0,l.jsx)(eL.Text,{className:"font-medium text-lg",children:"Custom Code"})]}),s&&!V&&(0,l.jsx)(c.Button,{size:"small",icon:(0,l.jsx)(tl.CodeOutlined,{}),onClick:()=>z(!0),children:"Edit Code"})]}),(0,l.jsx)("div",{className:"relative rounded-lg overflow-hidden border border-gray-700 bg-[#1e1e1e]",children:(0,l.jsx)("pre",{className:"p-4 text-sm text-gray-200 overflow-x-auto",style:{fontFamily:"'Fira Code', 'Monaco', 'Consolas', monospace"},children:(0,l.jsx)("code",{children:o.litellm_params.custom_code})})})]}),(0,l.jsx)(t_,{guardrailData:o,guardrailSettings:N,isEditing:!1,accessToken:a})]}),s&&(0,l.jsx)(td.TabPanel,{children:(0,l.jsxs)(eB.Card,{children:[(0,l.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,l.jsx)(tm.Title,{children:"Guardrail Settings"}),V&&(0,l.jsx)(ef.Tooltip,{title:"Guardrail is defined in the config file and cannot be edited.",children:(0,l.jsx)(ez.InfoCircleOutlined,{})}),!y&&!V&&(o.litellm_params?.guardrail==="custom_code"?(0,l.jsx)(c.Button,{icon:(0,l.jsx)(tl.CodeOutlined,{}),onClick:()=>z(!0),children:"Edit Code"}):(0,l.jsx)(c.Button,{onClick:()=>j(!0),children:"Edit Settings"}))]}),y?(0,l.jsxs)(r.Form,{form:_,onFinish:J,initialValues:{guardrail_name:o.guardrail_name,...o.litellm_params,guardrail_info:o.guardrail_info?JSON.stringify(o.guardrail_info,null,2):"",...o.litellm_params?.optional_params&&{optional_params:o.litellm_params.optional_params}},layout:"vertical",children:[(0,l.jsx)(r.Form.Item,{label:"Guardrail Name",name:"guardrail_name",rules:[{required:!0,message:"Please input a guardrail name"}],children:(0,l.jsx)(i.Input,{placeholder:"Enter guardrail name"})}),(0,l.jsx)(r.Form.Item,{label:"Default On",name:"default_on",children:(0,l.jsxs)(n.Select,{children:[(0,l.jsx)(n.Select.Option,{value:!0,children:"Yes"}),(0,l.jsx)(n.Select.Option,{value:!1,children:"No"})]})}),o.litellm_params?.guardrail==="presidio"&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(eF.Divider,{orientation:"left",children:"PII Protection"}),(0,l.jsx)("div",{className:"mb-6",children:N&&(0,l.jsx)(eP,{entities:N.supported_entities,actions:N.supported_actions,selectedEntities:v,selectedActions:C,onEntitySelect:e=>{b(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},onActionSelect:(e,t)=>{S(a=>({...a,[e]:t}))},entityCategories:N.pii_entity_categories})})]}),(0,l.jsx)(t_,{guardrailData:o,guardrailSettings:N,isEditing:!0,accessToken:a,onDataChange:$,onUnsavedChanges:T}),(o.litellm_params?.guardrail==="tool_permission"||g)&&(0,l.jsx)(eF.Divider,{orientation:"left",children:"Provider Settings"}),o.litellm_params?.guardrail==="tool_permission"?(0,l.jsx)(e$,{value:P,onChange:B}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(ex,{selectedProvider:Object.keys(ea).find(e=>ea[e]===o.litellm_params?.guardrail)||null,accessToken:a,providerParams:g,value:o.litellm_params}),g&&(()=>{let e=Object.keys(ea).find(e=>ea[e]===o.litellm_params?.guardrail);if(!e)return null;let t=g[ea[e]?.toLowerCase()];return t&&t.optional_params?(0,l.jsx)(eu,{optionalParams:t.optional_params,parentFieldKey:"optional_params",values:o.litellm_params}):null})()]}),(0,l.jsx)(eF.Divider,{orientation:"left",children:"Advanced Settings"}),(0,l.jsx)(r.Form.Item,{label:"Guardrail Information",name:"guardrail_info",children:(0,l.jsx)(i.Input.TextArea,{rows:5})}),(0,l.jsxs)("div",{className:"flex justify-end gap-2 mt-6",children:[(0,l.jsx)(c.Button,{onClick:()=>{j(!1),T(!1),K()},children:"Cancel"}),(0,l.jsx)(c.Button,{type:"primary",htmlType:"submit",children:"Save Changes"})]})]}):(0,l.jsxs)("div",{className:"space-y-4",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)(eL.Text,{className:"font-medium",children:"Guardrail ID"}),(0,l.jsx)("div",{className:"font-mono",children:o.guardrail_id})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)(eL.Text,{className:"font-medium",children:"Guardrail Name"}),(0,l.jsx)("div",{children:o.guardrail_name||"Unnamed Guardrail"})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)(eL.Text,{className:"font-medium",children:"Provider"}),(0,l.jsx)("div",{children:H})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)(eL.Text,{className:"font-medium",children:"Mode"}),(0,l.jsx)("div",{children:o.litellm_params?.mode||"-"})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)(eL.Text,{className:"font-medium",children:"Default On"}),(0,l.jsx)(e4.Badge,{color:o.litellm_params?.default_on?"green":"gray",children:o.litellm_params?.default_on?"Yes":"No"})]}),o.litellm_params?.pii_entities_config&&Object.keys(o.litellm_params.pii_entities_config).length>0&&(0,l.jsxs)("div",{children:[(0,l.jsx)(eL.Text,{className:"font-medium",children:"PII Protection"}),(0,l.jsx)("div",{className:"mt-2",children:(0,l.jsxs)(e4.Badge,{color:"blue",children:[Object.keys(o.litellm_params.pii_entities_config).length," PII entities configured"]})})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)(eL.Text,{className:"font-medium",children:"Created At"}),(0,l.jsx)("div",{children:q(o.created_at)})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)(eL.Text,{className:"font-medium",children:"Last Updated"}),(0,l.jsx)("div",{children:q(o.updated_at)})]}),o.litellm_params?.guardrail==="tool_permission"&&(0,l.jsx)(e$,{value:P,disabled:!0})]})]})})]})]}),(0,l.jsx)(tF,{visible:E,onClose:()=>z(!1),onSuccess:()=>{z(!1),R()},accessToken:a,editData:o?{guardrail_id:o.guardrail_id,guardrail_name:o.guardrail_name,litellm_params:o.litellm_params}:null})]})}],969641);var tE=e.i(573421),tz=e.i(19732),tM=e.i(928685),t$=e.i(166406),tR=e.i(637235),tG=e.i(755151),tD=e.i(240647);let{Text:tK}=d.Typography,tJ=function({results:e,errors:t}){let[a,r]=(0,m.useState)(new Set),i=e=>{let t=new Set(a);t.has(e)?t.delete(e):t.add(e),r(t)},s=async e=>{try{if(navigator.clipboard&&window.isSecureContext)return await navigator.clipboard.writeText(e),!0;{let t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.focus(),t.select();let a=document.execCommand("copy");if(document.body.removeChild(t),!a)throw Error("execCommand failed");return!0}}catch(e){return console.error("Copy failed:",e),!1}};return e||t?(0,l.jsxs)("div",{className:"space-y-3 pt-4 border-t border-gray-200",children:[(0,l.jsx)("h3",{className:"text-sm font-semibold text-gray-900",children:"Results"}),e&&e.map(e=>{let t=a.has(e.guardrailName);return(0,l.jsx)(eB.Card,{className:"bg-green-50 border-green-200",children:(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 space-x-2 cursor-pointer flex-1",onClick:()=>i(e.guardrailName),children:[t?(0,l.jsx)(tD.RightOutlined,{className:"text-gray-500 text-xs"}):(0,l.jsx)(tG.DownOutlined,{className:"text-gray-500 text-xs"}),(0,l.jsx)(tb.CheckCircleOutlined,{className:"text-green-600 text-lg"}),(0,l.jsx)("span",{className:"text-sm font-medium text-green-800",children:e.guardrailName})]}),(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[(0,l.jsxs)("div",{className:"flex items-center space-x-1 text-xs text-gray-600",children:[(0,l.jsx)(tR.ClockCircleOutlined,{}),(0,l.jsxs)("span",{className:"font-medium",children:[e.latency,"ms"]})]}),!t&&(0,l.jsx)(eQ.Button,{size:"xs",variant:"secondary",icon:t$.CopyOutlined,onClick:async()=>{await s(e.response_text)?u.default.success("Result copied to clipboard"):u.default.fromBackend("Failed to copy result")},children:"Copy"})]})]}),!t&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"bg-white border border-green-200 rounded p-3",children:[(0,l.jsx)("label",{className:"text-xs font-medium text-gray-600 mb-2 block",children:"Output Text"}),(0,l.jsx)("div",{className:"font-mono text-sm text-gray-900 whitespace-pre-wrap break-words",children:e.response_text})]}),(0,l.jsxs)("div",{className:"text-xs text-gray-600",children:[(0,l.jsx)("span",{className:"font-medium",children:"Characters:"})," ",e.response_text.length]})]})]})},e.guardrailName)}),t&&t.map(e=>{let t=a.has(e.guardrailName);return(0,l.jsx)(eB.Card,{className:"bg-red-50 border-red-200",children:(0,l.jsxs)("div",{className:"flex items-start space-x-2",children:[(0,l.jsx)("div",{className:"cursor-pointer mt-0.5",onClick:()=>i(e.guardrailName),children:t?(0,l.jsx)(tD.RightOutlined,{className:"text-gray-500 text-xs"}):(0,l.jsx)(tG.DownOutlined,{className:"text-gray-500 text-xs"})}),(0,l.jsx)("div",{className:"text-red-600 mt-0.5",children:(0,l.jsx)("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 20 20",children:(0,l.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,l.jsxs)("div",{className:"flex-1",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,l.jsxs)("p",{className:"text-sm font-medium text-red-800 cursor-pointer",onClick:()=>i(e.guardrailName),children:[e.guardrailName," - Error"]}),(0,l.jsxs)("div",{className:"flex items-center space-x-1 text-xs text-gray-600",children:[(0,l.jsx)(tR.ClockCircleOutlined,{}),(0,l.jsxs)("span",{className:"font-medium",children:[e.latency,"ms"]})]})]}),!t&&(0,l.jsx)("p",{className:"text-sm text-red-700 mt-1",children:e.error.message})]})]})},e.guardrailName)})]}):null},{TextArea:tq}=i.Input,{Text:tW}=d.Typography,tH=function({guardrailNames:e,onSubmit:t,isLoading:a,results:r,errors:i,onClose:s}){let[n,o]=(0,m.useState)(""),d=()=>{n.trim()?t(n):u.default.fromBackend("Please enter text to test")},c=async e=>{try{if(navigator.clipboard&&window.isSecureContext)return await navigator.clipboard.writeText(e),!0;{let t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.focus(),t.select();let a=document.execCommand("copy");if(document.body.removeChild(t),!a)throw Error("execCommand failed");return!0}}catch(e){return console.error("Copy failed:",e),!1}},p=async()=>{await c(n)?u.default.success("Input copied to clipboard"):u.default.fromBackend("Failed to copy input")};return(0,l.jsxs)("div",{className:"space-y-4 h-full flex flex-col",children:[(0,l.jsx)("div",{className:"flex items-center justify-between pb-3 border-b border-gray-200",children:(0,l.jsx)("div",{className:"flex items-center space-x-3",children:(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 Guardrails:"}),(0,l.jsx)("div",{className:"flex flex-wrap gap-2",children:e.map(e=>(0,l.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,l.jsx)("span",{className:"font-mono text-blue-700 font-medium text-sm",children:e})},e))})]}),(0,l.jsxs)("p",{className:"text-sm text-gray-500",children:["Test ",e.length>1?"guardrails":"guardrail"," and compare results"]})]})})}),(0,l.jsxs)("div",{className:"flex-1 overflow-auto space-y-4",children:[(0,l.jsxs)("div",{className:"space-y-3",children:[(0,l.jsxs)("div",{children:[(0,l.jsxs)("div",{className:"flex justify-between items-center mb-2",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Input Text"}),(0,l.jsx)(ef.Tooltip,{title:"Press Enter to submit. Use Shift+Enter for new line.",children:(0,l.jsx)(ez.InfoCircleOutlined,{className:"text-gray-400 cursor-help"})})]}),n&&(0,l.jsx)(eQ.Button,{size:"xs",variant:"secondary",icon:t$.CopyOutlined,onClick:p,children:"Copy Input"})]}),(0,l.jsx)(tq,{value:n,onChange:e=>o(e.target.value),onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||e.ctrlKey||e.metaKey||(e.preventDefault(),d())},placeholder:"Enter text to test with guardrails...",rows:8,className:"font-mono text-sm"}),(0,l.jsxs)("div",{className:"flex justify-between items-center mt-1",children:[(0,l.jsxs)(tW,{className:"text-xs text-gray-500",children:["Press ",(0,l.jsx)("kbd",{className:"px-1 py-0.5 bg-gray-100 border border-gray-300 rounded text-xs",children:"Enter"})," to submit • ",(0,l.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,l.jsxs)(tW,{className:"text-xs text-gray-500",children:["Characters: ",n.length]})]})]}),(0,l.jsx)("div",{className:"pt-2",children:(0,l.jsx)(eQ.Button,{onClick:d,loading:a,disabled:!n.trim(),className:"w-full",children:a?`Testing ${e.length} guardrail${e.length>1?"s":""}...`:`Test ${e.length} guardrail${e.length>1?"s":""}`})})]}),(0,l.jsx)(tJ,{results:r,errors:i})]})]})};e.s(["default",0,({guardrailsList:e,isLoading:t,accessToken:a,onClose:r})=>{let[i,s]=(0,m.useState)(new Set),[n,o]=(0,m.useState)(""),[d,c]=(0,m.useState)([]),[g,x]=(0,m.useState)([]),[h,f]=(0,m.useState)(!1),y=e.filter(e=>e.guardrail_name?.toLowerCase().includes(n.toLowerCase())),j=e=>{let t=new Set(i);t.has(e)?t.delete(e):t.add(e),s(t)},_=async e=>{if(0===i.size||!a)return;f(!0),c([]),x([]);let t=[],l=[];await Promise.all(Array.from(i).map(async r=>{let i=Date.now();try{let l=await (0,p.applyGuardrail)(a,r,e,null,null),s=Date.now()-i;t.push({guardrailName:r,response_text:l.response_text,latency:s})}catch(t){let e=Date.now()-i;console.error(`Error testing guardrail ${r}:`,t),l.push({guardrailName:r,error:t,latency:e})}})),c(t),x(l),f(!1),t.length>0&&u.default.success(`${t.length} guardrail${t.length>1?"s":""} applied successfully`),l.length>0&&u.default.fromBackend(`${l.length} guardrail${l.length>1?"s":""} failed`)};return(0,l.jsx)("div",{className:"w-full h-[calc(100vh-200px)]",children:(0,l.jsx)(eB.Card,{className:"h-full",children:(0,l.jsxs)("div",{className:"flex h-full",children:[(0,l.jsxs)("div",{className:"w-1/4 border-r border-gray-200 flex flex-col overflow-hidden",children:[(0,l.jsx)("div",{className:"p-4 border-b border-gray-200",children:(0,l.jsxs)("div",{className:"mb-3",children:[(0,l.jsx)(tm.Title,{className:"text-lg font-semibold mb-3",children:"Guardrails"}),(0,l.jsx)(e5.TextInput,{icon:tM.SearchOutlined,placeholder:"Search guardrails...",value:n,onValueChange:o})]})}),(0,l.jsx)("div",{className:"flex-1 overflow-auto",children:t?(0,l.jsx)("div",{className:"flex items-center justify-center h-32",children:(0,l.jsx)(ep.Spin,{})}):0===y.length?(0,l.jsx)("div",{className:"p-4",children:(0,l.jsx)(eE.Empty,{description:n?"No guardrails match your search":"No guardrails available"})}):(0,l.jsx)(tE.List,{dataSource:y,renderItem:e=>(0,l.jsx)(tE.List.Item,{onClick:()=>{e.guardrail_name&&j(e.guardrail_name)},className:`cursor-pointer hover:bg-gray-50 transition-colors px-4 ${i.has(e.guardrail_name||"")?"bg-blue-50 border-l-4 border-l-blue-500":"border-l-4 border-l-transparent"}`,children:(0,l.jsx)(tE.List.Item.Meta,{avatar:(0,l.jsx)(eh.Checkbox,{checked:i.has(e.guardrail_name||""),onClick:t=>{t.stopPropagation(),e.guardrail_name&&j(e.guardrail_name)}}),title:(0,l.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,l.jsx)(tz.ExperimentOutlined,{className:"text-gray-400"}),(0,l.jsx)("span",{className:"font-medium text-gray-900",children:e.guardrail_name})]}),description:(0,l.jsxs)("div",{className:"text-xs space-y-1 mt-1",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("span",{className:"font-medium",children:"Type: "}),(0,l.jsx)("span",{className:"text-gray-600",children:e.litellm_params.guardrail})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("span",{className:"font-medium",children:"Mode: "}),(0,l.jsx)("span",{className:"text-gray-600",children:e.litellm_params.mode})]})]})})})})}),(0,l.jsx)("div",{className:"p-3 border-t border-gray-200 bg-gray-50",children:(0,l.jsxs)(eL.Text,{className:"text-xs text-gray-600",children:[i.size," of ",y.length," selected"]})})]}),(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)(tm.Title,{className:"text-xl font-semibold mb-0",children:"Guardrail Testing Playground"})}),(0,l.jsx)("div",{className:"flex-1 overflow-auto p-4",children:0===i.size?(0,l.jsxs)("div",{className:"h-full flex flex-col items-center justify-center text-gray-400",children:[(0,l.jsx)(tz.ExperimentOutlined,{style:{fontSize:"48px",marginBottom:"16px"}}),(0,l.jsx)(eL.Text,{className:"text-lg font-medium text-gray-600 mb-2",children:"Select Guardrails to Test"}),(0,l.jsx)(eL.Text,{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,l.jsx)("div",{className:"h-full",children:(0,l.jsx)(tH,{guardrailNames:Array.from(i),onSubmit:_,results:d.length>0?d:null,errors:g.length>0?g:null,isLoading:h,onClose:()=>s(new Set)})})})]})]})})})}],476993),e.s([],824296),e.s(["CustomCodeModal",0,tF],64352);let tU={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M869 487.8L491.2 159.9c-2.9-2.5-6.6-3.9-10.5-3.9h-88.5c-7.4 0-10.8 9.2-5.2 14l350.2 304H152c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h585.1L386.9 854c-5.6 4.9-2.2 14 5.2 14h91.5c1.9 0 3.8-.7 5.2-2L869 536.2a32.07 32.07 0 000-48.4z"}}]},name:"arrow-right",theme:"outlined"};var tV=m.forwardRef(function(e,t){return m.createElement(eC.default,(0,ev.default)({},e,{ref:t,icon:tU}))});e.s(["ArrowRightOutlined",0,tV],266537);let tY="../ui/assets/logos/",tZ=[{id:"cf_denied_financial",name:"Denied Financial Advice",description:"Detects requests for personalized financial advice, investment recommendations, or financial planning.",category:"litellm",subcategory:"Content Category",logo:`${tY}litellm_logo.jpg`,tags:["Content Category","Topic Blocker"],eval:{f1:100,precision:100,recall:100,testCases:207,latency:"<0.1ms"}},{id:"cf_denied_insults",name:"Insults & Personal Attacks",description:"Detects insults, name-calling, and personal attacks directed at the chatbot, staff, or other people.",category:"litellm",subcategory:"Content Category",logo:`${tY}litellm_logo.jpg`,tags:["Content Category","Topic Blocker"],eval:{f1:100,precision:100,recall:100,testCases:299,latency:"<0.1ms"}},{id:"cf_denied_legal",name:"Denied Legal Advice",description:"Detects requests for unauthorized legal advice, case analysis, or legal recommendations.",category:"litellm",subcategory:"Content Category",logo:`${tY}litellm_logo.jpg`,tags:["Content Category","Topic Blocker"]},{id:"cf_denied_medical",name:"Denied Medical Advice",description:"Detects requests for medical diagnosis, treatment recommendations, or health advice.",category:"litellm",subcategory:"Content Category",logo:`${tY}litellm_logo.jpg`,tags:["Content Category","Topic Blocker"]},{id:"cf_harmful_violence",name:"Harmful Violence",description:"Detects content related to violence, criminal planning, attacks, and violent threats.",category:"litellm",subcategory:"Content Category",logo:`${tY}litellm_logo.jpg`,tags:["Content Category","Safety"]},{id:"cf_harmful_self_harm",name:"Harmful Self-Harm",description:"Detects content related to self-harm, suicide, and dangerous self-destructive behavior.",category:"litellm",subcategory:"Content Category",logo:`${tY}litellm_logo.jpg`,tags:["Content Category","Safety"]},{id:"cf_harmful_child_safety",name:"Harmful Child Safety",description:"Detects content that could endanger child safety or exploit minors.",category:"litellm",subcategory:"Content Category",logo:`${tY}litellm_logo.jpg`,tags:["Content Category","Safety"]},{id:"cf_harmful_illegal_weapons",name:"Harmful Illegal Weapons",description:"Detects content related to illegal weapons manufacturing, distribution, or acquisition.",category:"litellm",subcategory:"Content Category",logo:`${tY}litellm_logo.jpg`,tags:["Content Category","Safety"]},{id:"cf_bias_gender",name:"Bias: Gender",description:"Detects gender-based discrimination, stereotypes, and biased language.",category:"litellm",subcategory:"Content Category",logo:`${tY}litellm_logo.jpg`,tags:["Content Category","Bias"]},{id:"cf_bias_racial",name:"Bias: Racial",description:"Detects racial discrimination, stereotypes, and racially biased content.",category:"litellm",subcategory:"Content Category",logo:`${tY}litellm_logo.jpg`,tags:["Content Category","Bias"]},{id:"cf_bias_religious",name:"Bias: Religious",description:"Detects religious discrimination, intolerance, and religiously biased content.",category:"litellm",subcategory:"Content Category",logo:`${tY}litellm_logo.jpg`,tags:["Content Category","Bias"]},{id:"cf_bias_sexual_orientation",name:"Bias: Sexual Orientation",description:"Detects discrimination based on sexual orientation and related biased content.",category:"litellm",subcategory:"Content Category",logo:`${tY}litellm_logo.jpg`,tags:["Content Category","Bias"]},{id:"cf_prompt_injection_jailbreak",name:"Prompt Injection: Jailbreak",description:"Detects jailbreak attempts designed to bypass AI safety guidelines and restrictions.",category:"litellm",subcategory:"Content Category",logo:`${tY}litellm_logo.jpg`,tags:["Content Category","Prompt Injection"]},{id:"cf_prompt_injection_data_exfil",name:"Prompt Injection: Data Exfiltration",description:"Detects attempts to extract sensitive data through prompt manipulation.",category:"litellm",subcategory:"Content Category",logo:`${tY}litellm_logo.jpg`,tags:["Content Category","Prompt Injection"]},{id:"cf_prompt_injection_sql",name:"Prompt Injection: SQL",description:"Detects SQL injection attempts embedded in prompts.",category:"litellm",subcategory:"Content Category",logo:`${tY}litellm_logo.jpg`,tags:["Content Category","Prompt Injection"]},{id:"cf_prompt_injection_malicious_code",name:"Prompt Injection: Malicious Code",description:"Detects attempts to inject malicious code through prompts.",category:"litellm",subcategory:"Content Category",logo:`${tY}litellm_logo.jpg`,tags:["Content Category","Prompt Injection"]},{id:"cf_prompt_injection_system_prompt",name:"Prompt Injection: System Prompt",description:"Detects attempts to extract or override system prompts.",category:"litellm",subcategory:"Content Category",logo:`${tY}litellm_logo.jpg`,tags:["Content Category","Prompt Injection"]},{id:"cf_toxic_abuse",name:"Toxic & Abusive Language",description:"Detects toxic, abusive, and hateful language across multiple languages (EN, AU, DE, ES, FR).",category:"litellm",subcategory:"Content Category",logo:`${tY}litellm_logo.jpg`,tags:["Content Category","Toxicity"]},{id:"cf_patterns",name:"Pattern Matching",description:"Detect and block sensitive data patterns like SSNs, credit card numbers, API keys, and custom regex patterns.",category:"litellm",subcategory:"Patterns",logo:`${tY}litellm_logo.jpg`,tags:["PII","Regex","Data Protection"]},{id:"cf_keywords",name:"Keyword Blocking",description:"Block or mask content containing specific keywords or phrases. Upload custom word lists or add individual terms.",category:"litellm",subcategory:"Keywords",logo:`${tY}litellm_logo.jpg`,tags:["Keywords","Blocklist"]},{id:"block_code_execution",name:"Block Code Execution",description:"Detects markdown fenced code blocks in requests and responses. Block or mask executable code (e.g. Python, JavaScript, Bash) by language with configurable confidence.",category:"litellm",subcategory:"Code Safety",logo:`${tY}litellm_logo.jpg`,tags:["Code","Safety","Prompt Injection"]},{id:"cf_competitor_intent",name:"Competitor Name Blocking",description:"Block or reframe competitor comparison and ranking intent. Detect when users ask to compare or recommend competitors (airline or generic competitor lists).",category:"litellm",subcategory:"Content Category",logo:`${tY}litellm_logo.jpg`,tags:["Content Category","Competitor","Topic Blocker"]},{id:"presidio",name:"Presidio PII",description:"Microsoft Presidio for PII detection and anonymization. Supports 30+ entity types with configurable actions.",category:"partner",logo:`${tY}microsoft_azure.svg`,tags:["PII","Microsoft"],providerKey:"PresidioPII"},{id:"bedrock",name:"Bedrock Guardrail",description:"AWS Bedrock Guardrails for content filtering, topic avoidance, and sensitive information detection.",category:"partner",logo:`${tY}bedrock.svg`,tags:["AWS","Content Safety"],providerKey:"Bedrock"},{id:"lakera",name:"Lakera",description:"AI security platform protecting against prompt injections, data leakage, and harmful content.",category:"partner",logo:`${tY}lakeraai.jpeg`,tags:["Security","Prompt Injection"],providerKey:"Lakera"},{id:"openai_moderation",name:"OpenAI Moderation",description:"OpenAI's content moderation API for detecting harmful content across multiple categories.",category:"partner",logo:`${tY}openai_small.svg`,tags:["Content Moderation","OpenAI"]},{id:"google_model_armor",name:"Google Cloud Model Armor",description:"Google Cloud's model protection service for safe and responsible AI deployments.",category:"partner",logo:`${tY}google.svg`,tags:["Google Cloud","Safety"]},{id:"guardrails_ai",name:"Guardrails AI",description:"Open-source framework for adding structural, type, and quality guarantees to LLM outputs.",category:"partner",logo:`${tY}guardrails_ai.jpeg`,tags:["Open Source","Validation"]},{id:"zscaler",name:"Zscaler AI Guard",description:"Enterprise AI security from Zscaler for monitoring and protecting AI/ML workloads.",category:"partner",logo:`${tY}zscaler.svg`,tags:["Enterprise","Security"]},{id:"panw",name:"PANW Prisma AIRS",description:"Palo Alto Networks Prisma AI Runtime Security for securing AI applications in production.",category:"partner",logo:`${tY}palo_alto_networks.jpeg`,tags:["Enterprise","Security"]},{id:"noma",name:"Noma Security",description:"AI security platform for detecting and preventing AI-specific threats and vulnerabilities.",category:"partner",logo:`${tY}noma_security.png`,tags:["Security","Threat Detection"]},{id:"aporia",name:"Aporia AI",description:"Real-time AI guardrails for hallucination detection, topic control, and policy enforcement.",category:"partner",logo:`${tY}aporia.png`,tags:["Hallucination","Policy"]},{id:"aim",name:"AIM Guardrail",description:"AIM Security guardrails for comprehensive AI threat detection and mitigation.",category:"partner",logo:`${tY}aim_security.jpeg`,tags:["Security","Threat Detection"]},{id:"prompt_security",name:"Prompt Security",description:"Protect against prompt injection attacks, data leakage, and other LLM security threats.",category:"partner",logo:`${tY}prompt_security.png`,tags:["Prompt Injection","Security"]},{id:"lasso",name:"Lasso Guardrail",description:"Content moderation and safety guardrails for responsible AI deployments.",category:"partner",logo:`${tY}lasso.png`,tags:["Content Moderation"]},{id:"pangea",name:"Pangea Guardrail",description:"Pangea's AI guardrails for secure, compliant, and trustworthy AI applications.",category:"partner",logo:`${tY}pangea.png`,tags:["Compliance","Security"]},{id:"enkryptai",name:"EnkryptAI",description:"AI security and governance platform for enterprise AI safety and compliance.",category:"partner",logo:`${tY}enkrypt_ai.avif`,tags:["Enterprise","Governance"]},{id:"javelin",name:"Javelin Guardrails",description:"AI gateway with built-in guardrails for secure and compliant AI operations.",category:"partner",logo:`${tY}javelin.png`,tags:["Gateway","Security"]},{id:"pillar",name:"Pillar Guardrail",description:"AI safety platform for monitoring, testing, and securing AI systems.",category:"partner",logo:`${tY}pillar.jpeg`,tags:["Monitoring","Safety"]}];e.s(["ALL_CARDS",0,tZ],230312)},487304,e=>{"use strict";var t=e.i(843476),a=e.i(271645),l=e.i(994388),r=e.i(653824),i=e.i(881073),s=e.i(197647),n=e.i(723731),o=e.i(404206),d=e.i(326373),c=e.i(755151),m=e.i(646563),u=e.i(245094),p=e.i(764205),g=e.i(185357),x=e.i(782719),h=e.i(708347),f=e.i(969641),y=e.i(476993),j=e.i(727749),_=e.i(127952),v=e.i(180766);e.i(824296);var b=e.i(64352),C=e.i(311451),S=e.i(928685),N=e.i(266537),w=e.i(230312),k=e.i(826910);let I=({src:e,name:l})=>{let[r,i]=(0,a.useState)(!1);return r||!e?(0,t.jsx)("div",{style:{width:28,height:28,borderRadius:6,backgroundColor:"#e5e7eb",display:"flex",alignItems:"center",justifyContent:"center",fontSize:13,fontWeight:600,color:"#6b7280",flexShrink:0},children:l?.charAt(0)||"?"}):(0,t.jsx)("img",{src:e,alt:"",style:{width:28,height:28,borderRadius:6,objectFit:"contain",flexShrink:0},onError:()=>i(!0)})},O=({card:e,onClick:l})=>{let[r,i]=(0,a.useState)(!1);return(0,t.jsxs)("div",{onClick:l,onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),style:{borderRadius:12,border:r?"1px solid #93c5fd":"1px solid #e5e7eb",backgroundColor:"#ffffff",padding:"20px 20px 16px 20px",cursor:"pointer",transition:"border-color 0.15s, box-shadow 0.15s",display:"flex",flexDirection:"column",minHeight:170,boxShadow:r?"0 1px 6px rgba(59,130,246,0.08)":"none"},children:[(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:10},children:[(0,t.jsx)(I,{src:e.logo,name:e.name}),(0,t.jsx)("span",{style:{fontSize:14,fontWeight:600,color:"#111827",lineHeight:1.3},children:e.name})]}),(0,t.jsx)("p",{className:"line-clamp-3",style:{fontSize:12,color:"#6b7280",lineHeight:1.6,margin:0,flex:1},children:e.description}),e.eval&&(0,t.jsxs)("div",{style:{marginTop:10,display:"flex",alignItems:"center",gap:4},children:[(0,t.jsx)(k.CheckCircleFilled,{style:{color:"#16a34a",fontSize:12}}),(0,t.jsxs)("span",{style:{fontSize:11,color:"#16a34a",fontWeight:500},children:["F1: ",e.eval.f1,"% · ",e.eval.testCases," test cases"]})]})]})};var T=e.i(464571),A=e.i(447566);let P={cf_denied_financial:{provider:"LitellmContentFilter",categoryName:"denied_financial_advice",guardrailNameSuggestion:"Denied Financial Advice",mode:"pre_call",defaultOn:!1},cf_denied_legal:{provider:"LitellmContentFilter",categoryName:"denied_legal_advice",guardrailNameSuggestion:"Denied Legal Advice",mode:"pre_call",defaultOn:!1},cf_denied_medical:{provider:"LitellmContentFilter",categoryName:"denied_medical_advice",guardrailNameSuggestion:"Denied Medical Advice",mode:"pre_call",defaultOn:!1},cf_denied_insults:{provider:"LitellmContentFilter",categoryName:"denied_insults",guardrailNameSuggestion:"Insults & Personal Attacks",mode:"pre_call",defaultOn:!1},cf_harmful_violence:{provider:"LitellmContentFilter",categoryName:"harmful_violence",guardrailNameSuggestion:"Harmful Violence",mode:"pre_call",defaultOn:!1},cf_harmful_self_harm:{provider:"LitellmContentFilter",categoryName:"harmful_self_harm",guardrailNameSuggestion:"Harmful Self-Harm",mode:"pre_call",defaultOn:!1},cf_harmful_child_safety:{provider:"LitellmContentFilter",categoryName:"harmful_child_safety",guardrailNameSuggestion:"Harmful Child Safety",mode:"pre_call",defaultOn:!1},cf_harmful_illegal_weapons:{provider:"LitellmContentFilter",categoryName:"harmful_illegal_weapons",guardrailNameSuggestion:"Harmful Illegal Weapons",mode:"pre_call",defaultOn:!1},cf_bias_gender:{provider:"LitellmContentFilter",categoryName:"bias_gender",guardrailNameSuggestion:"Bias: Gender",mode:"pre_call",defaultOn:!1},cf_bias_racial:{provider:"LitellmContentFilter",categoryName:"bias_racial",guardrailNameSuggestion:"Bias: Racial",mode:"pre_call",defaultOn:!1},cf_bias_religious:{provider:"LitellmContentFilter",categoryName:"bias_religious",guardrailNameSuggestion:"Bias: Religious",mode:"pre_call",defaultOn:!1},cf_bias_sexual_orientation:{provider:"LitellmContentFilter",categoryName:"bias_sexual_orientation",guardrailNameSuggestion:"Bias: Sexual Orientation",mode:"pre_call",defaultOn:!1},cf_prompt_injection_jailbreak:{provider:"LitellmContentFilter",categoryName:"prompt_injection_jailbreak",guardrailNameSuggestion:"Prompt Injection: Jailbreak",mode:"pre_call",defaultOn:!1},cf_prompt_injection_data_exfil:{provider:"LitellmContentFilter",categoryName:"prompt_injection_data_exfiltration",guardrailNameSuggestion:"Prompt Injection: Data Exfiltration",mode:"pre_call",defaultOn:!1},cf_prompt_injection_sql:{provider:"LitellmContentFilter",categoryName:"prompt_injection_sql",guardrailNameSuggestion:"Prompt Injection: SQL",mode:"pre_call",defaultOn:!1},cf_prompt_injection_malicious_code:{provider:"LitellmContentFilter",categoryName:"prompt_injection_malicious_code",guardrailNameSuggestion:"Prompt Injection: Malicious Code",mode:"pre_call",defaultOn:!1},cf_prompt_injection_system_prompt:{provider:"LitellmContentFilter",categoryName:"prompt_injection_system_prompt",guardrailNameSuggestion:"Prompt Injection: System Prompt",mode:"pre_call",defaultOn:!1},cf_toxic_abuse:{provider:"LitellmContentFilter",categoryName:"harm_toxic_abuse",guardrailNameSuggestion:"Toxic & Abusive Language",mode:"pre_call",defaultOn:!1},cf_patterns:{provider:"LitellmContentFilter",guardrailNameSuggestion:"Pattern Matching",mode:"pre_call",defaultOn:!1},cf_keywords:{provider:"LitellmContentFilter",guardrailNameSuggestion:"Keyword Blocking",mode:"pre_call",defaultOn:!1},block_code_execution:{provider:"BlockCodeExecution",guardrailNameSuggestion:"Block Code Execution",mode:"pre_call",defaultOn:!1},cf_competitor_intent:{provider:"LitellmContentFilter",guardrailNameSuggestion:"Competitor Name Blocking",mode:"pre_call",defaultOn:!1},presidio:{provider:"PresidioPII",guardrailNameSuggestion:"Presidio PII",mode:"pre_call",defaultOn:!1},bedrock:{provider:"Bedrock",guardrailNameSuggestion:"Bedrock Guardrail",mode:"pre_call",defaultOn:!1},lakera:{provider:"Lakera",guardrailNameSuggestion:"Lakera",mode:"pre_call",defaultOn:!1},openai_moderation:{provider:"OpenaiModeration",guardrailNameSuggestion:"OpenAI Moderation",mode:"pre_call",defaultOn:!1},google_model_armor:{provider:"ModelArmor",guardrailNameSuggestion:"Google Cloud Model Armor",mode:"pre_call",defaultOn:!1},guardrails_ai:{provider:"GuardrailsAi",guardrailNameSuggestion:"Guardrails AI",mode:"pre_call",defaultOn:!1},zscaler:{provider:"ZscalerAiGuard",guardrailNameSuggestion:"Zscaler AI Guard",mode:"pre_call",defaultOn:!1},panw:{provider:"PanwPrismaAirs",guardrailNameSuggestion:"PANW Prisma AIRS",mode:"pre_call",defaultOn:!1},noma:{provider:"Noma",guardrailNameSuggestion:"Noma Security",mode:"pre_call",defaultOn:!1},aporia:{provider:"AporiaAi",guardrailNameSuggestion:"Aporia AI",mode:"pre_call",defaultOn:!1},aim:{provider:"Aim",guardrailNameSuggestion:"AIM Guardrail",mode:"pre_call",defaultOn:!1},prompt_security:{provider:"PromptSecurity",guardrailNameSuggestion:"Prompt Security",mode:"pre_call",defaultOn:!1},lasso:{provider:"Lasso",guardrailNameSuggestion:"Lasso Guardrail",mode:"pre_call",defaultOn:!1},pangea:{provider:"Pangea",guardrailNameSuggestion:"Pangea Guardrail",mode:"pre_call",defaultOn:!1},enkryptai:{provider:"Enkryptai",guardrailNameSuggestion:"EnkryptAI",mode:"pre_call",defaultOn:!1},javelin:{provider:"Javelin",guardrailNameSuggestion:"Javelin Guardrails",mode:"pre_call",defaultOn:!1},pillar:{provider:"Pillar",guardrailNameSuggestion:"Pillar Guardrail",mode:"pre_call",defaultOn:!1}},B=({card:e,onBack:l,accessToken:r,onGuardrailCreated:i})=>{let[s,n]=(0,a.useState)(!1),[o,d]=(0,a.useState)("overview"),c=[{property:"Provider",value:"litellm"===e.category?"LiteLLM Content Filter":"Partner Guardrail"},...e.subcategory?[{property:"Subcategory",value:e.subcategory}]:[],..."litellm"===e.category?[{property:"Cost",value:"$0 / request"}]:[],..."litellm"===e.category?[{property:"External Dependencies",value:"None"}]:[],..."litellm"===e.category?[{property:"Latency",value:e.eval?.latency||"<1ms"}]:[]],m=e.eval?[{metric:"Precision",value:`${e.eval.precision}%`},{metric:"Recall",value:`${e.eval.recall}%`},{metric:"F1 Score",value:`${e.eval.f1}%`},{metric:"Test Cases",value:String(e.eval.testCases)},{metric:"False Positives",value:"0"},{metric:"False Negatives",value:"0"},{metric:"Latency (p50)",value:e.eval.latency}]:[],u=[{key:"overview",label:"Overview"},...e.eval?[{key:"eval",label:"Eval Results"}]:[]];return(0,t.jsxs)("div",{style:{maxWidth:960,margin:"0 auto"},children:[(0,t.jsxs)("div",{onClick:l,style:{display:"inline-flex",alignItems:"center",gap:6,color:"#5f6368",cursor:"pointer",fontSize:14,marginBottom:24},children:[(0,t.jsx)(A.ArrowLeftOutlined,{style:{fontSize:11}}),(0,t.jsx)("span",{children:e.name})]}),(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:16,marginBottom:8},children:[(0,t.jsx)("img",{src:e.logo,alt:"",style:{width:40,height:40,borderRadius:8,objectFit:"contain"},onError:e=>{e.target.style.display="none"}}),(0,t.jsx)("h1",{style:{fontSize:28,fontWeight:400,color:"#202124",margin:0,lineHeight:1.2},children:e.name})]}),(0,t.jsx)("p",{style:{fontSize:14,color:"#5f6368",margin:"0 0 20px 0",lineHeight:1.6},children:e.description}),(0,t.jsx)("div",{style:{display:"flex",gap:10,marginBottom:32},children:(0,t.jsx)(T.Button,{onClick:()=>n(!0),style:{borderRadius:20,padding:"4px 20px",height:36,borderColor:"#dadce0",color:"#1a73e8",fontWeight:500,fontSize:14},children:"Create Guardrail"})}),(0,t.jsx)("div",{style:{borderBottom:"1px solid #dadce0",marginBottom:28},children:(0,t.jsx)("div",{style:{display:"flex",gap:0},children:u.map(e=>(0,t.jsx)("div",{onClick:()=>d(e.key),style:{padding:"12px 20px",fontSize:14,color:o===e.key?"#1a73e8":"#5f6368",borderBottom:o===e.key?"3px solid #1a73e8":"3px solid transparent",cursor:"pointer",fontWeight:o===e.key?500:400,marginBottom:-1},children:e.label},e.key))})}),"overview"===o&&(0,t.jsxs)("div",{style:{display:"flex",gap:64},children:[(0,t.jsxs)("div",{style:{flex:1,minWidth:0},children:[(0,t.jsx)("h2",{style:{fontSize:18,fontWeight:400,color:"#202124",margin:"0 0 12px 0"},children:"Overview"}),(0,t.jsx)("p",{style:{fontSize:14,color:"#3c4043",lineHeight:1.7,margin:"0 0 32px 0"},children:e.description}),(0,t.jsx)("h2",{style:{fontSize:18,fontWeight:400,color:"#202124",margin:"0 0 4px 0"},children:"Guardrail Details"}),(0,t.jsx)("p",{style:{fontSize:13,color:"#5f6368",margin:"0 0 16px 0"},children:"Details are as follows"}),(0,t.jsxs)("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:14},children:[(0,t.jsx)("thead",{children:(0,t.jsxs)("tr",{style:{borderBottom:"1px solid #dadce0"},children:[(0,t.jsx)("th",{style:{textAlign:"left",padding:"12px 0",color:"#5f6368",fontWeight:500,width:200},children:"Property"}),(0,t.jsx)("th",{style:{textAlign:"left",padding:"12px 0",color:"#5f6368",fontWeight:500},children:e.name})]})}),(0,t.jsx)("tbody",{children:c.map((e,a)=>(0,t.jsxs)("tr",{style:{borderBottom:"1px solid #f1f3f4"},children:[(0,t.jsx)("td",{style:{padding:"12px 0",color:"#3c4043"},children:e.property}),(0,t.jsx)("td",{style:{padding:"12px 0",color:"#202124"},children:e.value})]},a))})]})]}),(0,t.jsxs)("div",{style:{width:240,flexShrink:0},children:[(0,t.jsxs)("div",{style:{marginBottom:28},children:[(0,t.jsx)("div",{style:{fontSize:12,color:"#5f6368",marginBottom:4},children:"Guardrail ID"}),(0,t.jsxs)("div",{style:{fontSize:13,color:"#202124",wordBreak:"break-all"},children:["litellm/",e.id]})]}),(0,t.jsxs)("div",{style:{marginBottom:28},children:[(0,t.jsx)("div",{style:{fontSize:12,color:"#5f6368",marginBottom:4},children:"Type"}),(0,t.jsx)("div",{style:{fontSize:13,color:"#202124"},children:"litellm"===e.category?"Content Filter":"Partner"})]}),e.tags.length>0&&(0,t.jsxs)("div",{style:{marginBottom:28},children:[(0,t.jsx)("div",{style:{fontSize:12,color:"#5f6368",marginBottom:8},children:"Tags"}),(0,t.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:e.tags.map(e=>(0,t.jsx)("span",{style:{fontSize:12,padding:"4px 12px",borderRadius:16,border:"1px solid #dadce0",color:"#3c4043",backgroundColor:"#fff"},children:e},e))})]})]})]}),"eval"===o&&(0,t.jsxs)("div",{children:[(0,t.jsx)("h2",{style:{fontSize:18,fontWeight:400,color:"#202124",margin:"0 0 16px 0"},children:"Eval Results"}),(0,t.jsxs)("table",{style:{width:"100%",maxWidth:560,borderCollapse:"collapse",fontSize:14},children:[(0,t.jsx)("thead",{children:(0,t.jsxs)("tr",{style:{backgroundColor:"#f8f9fa",borderBottom:"1px solid #dadce0"},children:[(0,t.jsx)("th",{style:{textAlign:"left",padding:"12px 16px",color:"#5f6368",fontWeight:500},children:"Metric"}),(0,t.jsx)("th",{style:{textAlign:"left",padding:"12px 16px",color:"#5f6368",fontWeight:500},children:"Value"})]})}),(0,t.jsx)("tbody",{children:m.map((e,a)=>(0,t.jsxs)("tr",{style:{borderBottom:"1px solid #f1f3f4"},children:[(0,t.jsx)("td",{style:{padding:"12px 16px",color:"#3c4043"},children:e.metric}),(0,t.jsx)("td",{style:{padding:"12px 16px",color:"#202124",fontWeight:500},children:e.value})]},a))})]})]}),(0,t.jsx)(g.default,{visible:s,onClose:()=>n(!1),accessToken:r,onSuccess:()=>{n(!1),i()},preset:P[e.id]})]})},L=({accessToken:e,onGuardrailCreated:l})=>{let[r,i]=(0,a.useState)(""),[s,n]=(0,a.useState)(null),[o,d]=(0,a.useState)(!1),c=w.ALL_CARDS.filter(e=>{if(!r)return!0;let t=r.toLowerCase();return e.name.toLowerCase().includes(t)||e.description.toLowerCase().includes(t)||e.tags.some(e=>e.toLowerCase().includes(t))}),m=c.filter(e=>"litellm"===e.category),u=c.filter(e=>"partner"===e.category);return s?(0,t.jsx)(B,{card:s,onBack:()=>n(null),accessToken:e,onGuardrailCreated:l}):(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{style:{marginBottom:24},children:(0,t.jsx)(C.Input,{size:"large",placeholder:"Search guardrails",prefix:(0,t.jsx)(S.SearchOutlined,{style:{color:"#9ca3af"}}),value:r,onChange:e=>i(e.target.value),style:{borderRadius:8}})}),(0,t.jsxs)("div",{style:{marginBottom:40},children:[(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:4},children:[(0,t.jsx)("h2",{style:{fontSize:20,fontWeight:600,color:"#111827",margin:0},children:"LiteLLM Content Filter"}),(0,t.jsx)("span",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:14,color:"#1a73e8",cursor:"pointer"},onClick:()=>d(!o),children:o?(0,t.jsx)(t.Fragment,{children:"Show less"}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(N.ArrowRightOutlined,{style:{fontSize:12}}),`Show all (${m.length})`]})})]}),(0,t.jsx)("p",{style:{fontSize:13,color:"#6b7280",margin:"4px 0 20px 0"},children:"Built-in guardrails powered by LiteLLM. Zero latency, no external dependencies, no additional cost."}),(0,t.jsx)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(220px, 1fr))",gap:16},children:(o?m:m.slice(0,10)).map(e=>(0,t.jsx)(O,{card:e,onClick:()=>n(e)},e.id))})]}),(0,t.jsxs)("div",{style:{marginBottom:40},children:[(0,t.jsx)("h2",{style:{fontSize:20,fontWeight:600,color:"#111827",margin:"0 0 4px 0"},children:"Partner Guardrails"}),(0,t.jsx)("p",{style:{fontSize:13,color:"#6b7280",margin:"4px 0 20px 0"},children:"Third-party guardrail integrations from leading AI security providers."}),(0,t.jsx)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(220px, 1fr))",gap:16},children:u.map(e=>(0,t.jsx)(O,{card:e,onClick:()=>n(e)},e.id))})]})]})};e.s(["default",0,({accessToken:e,userRole:C})=>{let[S,N]=(0,a.useState)([]),[w,k]=(0,a.useState)(!1),[I,O]=(0,a.useState)(!1),[T,A]=(0,a.useState)(!1),[P,B]=(0,a.useState)(!1),[F,E]=(0,a.useState)(null),[z,M]=(0,a.useState)(!1),[$,R]=(0,a.useState)(null),[G,D]=(0,a.useState)(0),K=!!C&&(0,h.isAdminRole)(C),J=async()=>{if(e){A(!0);try{let t=await (0,p.getGuardrailsList)(e);console.log(`guardrails: ${JSON.stringify(t)}`),N(t.guardrails)}catch(e){console.error("Error fetching guardrails:",e)}finally{A(!1)}}};(0,a.useEffect)(()=>{J()},[e]);let q=()=>{J()},W=async()=>{if(F&&e){B(!0);try{await (0,p.deleteGuardrailCall)(e,F.guardrail_id),j.default.success(`Guardrail "${F.guardrail_name}" deleted successfully`),await J()}catch(e){console.error("Error deleting guardrail:",e),j.default.fromBackend("Failed to delete guardrail")}finally{B(!1),M(!1),E(null)}}},H=F&&F.litellm_params?(0,v.getGuardrailLogoAndName)(F.litellm_params.guardrail).displayName:void 0;return(0,t.jsx)("div",{className:"w-full mx-auto flex-auto overflow-y-auto m-8 p-2",children:(0,t.jsxs)(r.TabGroup,{index:G,onIndexChange:D,children:[(0,t.jsxs)(i.TabList,{className:"mb-4",children:[(0,t.jsx)(s.Tab,{children:"Guardrail Garden"}),(0,t.jsx)(s.Tab,{children:"Guardrails"}),(0,t.jsx)(s.Tab,{disabled:!e||0===S.length,children:"Test Playground"})]}),(0,t.jsxs)(n.TabPanels,{children:[(0,t.jsx)(o.TabPanel,{children:(0,t.jsx)(L,{accessToken:e,onGuardrailCreated:q})}),(0,t.jsxs)(o.TabPanel,{children:[(0,t.jsx)("div",{className:"flex justify-between items-center mb-4",children:(0,t.jsx)(d.Dropdown,{menu:{items:[{key:"provider",icon:(0,t.jsx)(m.PlusOutlined,{}),label:"Add Provider Guardrail",onClick:()=>{$&&R(null),k(!0)}},{key:"custom_code",icon:(0,t.jsx)(u.CodeOutlined,{}),label:"Create Custom Code Guardrail",onClick:()=>{$&&R(null),O(!0)}}]},trigger:["click"],disabled:!e,children:(0,t.jsxs)(l.Button,{disabled:!e,children:["+ Add New Guardrail ",(0,t.jsx)(c.DownOutlined,{className:"ml-2"})]})})}),$?(0,t.jsx)(f.default,{guardrailId:$,onClose:()=>R(null),accessToken:e,isAdmin:K}):(0,t.jsx)(x.default,{guardrailsList:S,isLoading:T,onDeleteClick:(e,t)=>{E(S.find(t=>t.guardrail_id===e)||null),M(!0)},accessToken:e,onGuardrailUpdated:J,isAdmin:K,onGuardrailClick:e=>R(e)}),(0,t.jsx)(g.default,{visible:w,onClose:()=>{k(!1)},accessToken:e,onSuccess:q}),(0,t.jsx)(b.CustomCodeModal,{visible:I,onClose:()=>{O(!1)},accessToken:e,onSuccess:q}),(0,t.jsx)(_.default,{isOpen:z,title:"Delete Guardrail",message:`Are you sure you want to delete guardrail: ${F?.guardrail_name}? This action cannot be undone.`,resourceInformationTitle:"Guardrail Information",resourceInformation:[{label:"Name",value:F?.guardrail_name},{label:"ID",value:F?.guardrail_id,code:!0},{label:"Provider",value:H},{label:"Mode",value:F?.litellm_params.mode},{label:"Default On",value:F?.litellm_params.default_on?"Yes":"No"}],onCancel:()=>{M(!1),E(null)},onOk:W,confirmLoading:P})]}),(0,t.jsx)(o.TabPanel,{children:(0,t.jsx)(y.default,{guardrailsList:S,isLoading:T,accessToken:e,onClose:()=>D(0)})})]})]})})}],487304)}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/06fcc87de3bb3ff8.js b/litellm/proxy/_experimental/out/_next/static/chunks/06fcc87de3bb3ff8.js deleted file mode 100644 index d0df9d2d7bd..00000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/06fcc87de3bb3ff8.js +++ /dev/null @@ -1 +0,0 @@ -(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,21548,e=>{"use strict";var t=e.i(616303);e.s(["Empty",()=>t.default])},954616,e=>{"use strict";var t=e.i(271645),r=e.i(114272),n=e.i(540143),i=e.i(915823),s=e.i(619273),a=class extends i.Subscribable{#e;#t=void 0;#r;#n;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}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,s.shallowEqualObjects)(this.options,t)||this.#e.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#r,observer:this}),t?.mutationKey&&this.options.mutationKey&&(0,s.hashKey)(t.mutationKey)!==(0,s.hashKey)(this.options.mutationKey)?this.reset():this.#r?.state.status==="pending"&&this.#r.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#r?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#s(e)}getCurrentResult(){return this.#t}reset(){this.#r?.removeObserver(this),this.#r=void 0,this.#i(),this.#s()}mutate(e,t){return this.#n=t,this.#r?.removeObserver(this),this.#r=this.#e.getMutationCache().build(this.#e,this.options),this.#r.addObserver(this),this.#r.execute(e)}#i(){let e=this.#r?.state??(0,r.getDefaultState)();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}}#s(e){n.notifyManager.batch(()=>{if(this.#n&&this.hasListeners()){let t=this.#t.variables,r=this.#t.context,n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type==="success"){try{this.#n.onSuccess?.(e.data,t,r,n)}catch(e){Promise.reject(e)}try{this.#n.onSettled?.(e.data,null,t,r,n)}catch(e){Promise.reject(e)}}else if(e?.type==="error"){try{this.#n.onError?.(e.error,t,r,n)}catch(e){Promise.reject(e)}try{this.#n.onSettled?.(void 0,e.error,t,r,n)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},o=e.i(912598);function l(e,r){let i=(0,o.useQueryClient)(r),[l]=t.useState(()=>new a(i,e));t.useEffect(()=>{l.setOptions(e)},[l,e]);let u=t.useSyncExternalStore(t.useCallback(e=>l.subscribe(n.notifyManager.batchCalls(e)),[l]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),c=t.useCallback((e,t)=>{l.mutate(e,t).catch(s.noop)},[l]);if(u.error&&(0,s.shouldThrowError)(l.options.throwOnError,[u.error]))throw u.error;return{...u,mutate:c,mutateAsync:u.mutate}}e.s(["useMutation",()=>l],954616)},992571,e=>{"use strict";var t=e.i(619273);function r(e){return{onFetch:(r,s)=>{let a=r.options,o=r.fetchOptions?.meta?.fetchMore?.direction,l=r.state.data?.pages||[],u=r.state.data?.pageParams||[],c={pages:[],pageParams:[]},d=0,h=async()=>{let s=!1,h=(0,t.ensureQueryFn)(r.options,r.fetchOptions),f=async(e,n,i)=>{let a;if(s)return Promise.reject();if(null==n&&e.pages.length)return Promise.resolve(e);let o=(a={client:r.client,queryKey:r.queryKey,pageParam:n,direction:i?"backward":"forward",meta:r.options.meta},(0,t.addConsumeAwareSignal)(a,()=>r.signal,()=>s=!0),a),l=await h(o),{maxPages:u}=r.options,c=i?t.addToStart:t.addToEnd;return{pages:c(e.pages,l,u),pageParams:c(e.pageParams,n,u)}};if(o&&l.length){let e="backward"===o,t={pages:l,pageParams:u},r=(e?i:n)(a,t);c=await f(t,r,e)}else{let t=e??l.length;do{let e=0===d?u[0]??a.initialPageParam:n(a,c);if(d>0&&null==e)break;c=await f(c,e),d++}while(dr.options.persister?.(h,{client:r.client,queryKey:r.queryKey,meta:r.options.meta,signal:r.signal},s):r.fetchFn=h}}}function n(e,{pages:t,pageParams:r}){let n=t.length-1;return t.length>0?e.getNextPageParam(t[n],t,r[n],r):void 0}function i(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}function s(e,t){return!!t&&null!=n(e,t)}function a(e,t){return!!t&&!!e.getPreviousPageParam&&null!=i(e,t)}e.s(["hasNextPage",()=>s,"hasPreviousPage",()=>a,"infiniteQueryBehavior",()=>r])},114272,e=>{"use strict";var t=e.i(540143),r=e.i(88587),n=e.i(936553),i=class extends r.Removable{#e;#a;#o;#l;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#o=e.mutationCache,this.#a=[],this.state=e.state||s(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#a.includes(e)||(this.#a.push(e),this.clearGcTimeout(),this.#o.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#a=this.#a.filter(t=>t!==e),this.scheduleGc(),this.#o.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#a.length||("pending"===this.state.status?this.scheduleGc():this.#o.remove(this))}continue(){return this.#l?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#u({type:"continue"})},r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#l=(0,n.createRetryer)({fn:()=>this.options.mutationFn?this.options.mutationFn(e,r):Promise.reject(Error("No mutationFn found")),onFail:(e,t)=>{this.#u({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#u({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#o.canRun(this)});let i="pending"===this.state.status,s=!this.#l.canStart();try{if(i)t();else{this.#u({type:"pending",variables:e,isPaused:s}),this.#o.config.onMutate&&await this.#o.config.onMutate(e,this,r);let t=await this.options.onMutate?.(e,r);t!==this.state.context&&this.#u({type:"pending",context:t,variables:e,isPaused:s})}let n=await this.#l.start();return await this.#o.config.onSuccess?.(n,e,this.state.context,this,r),await this.options.onSuccess?.(n,e,this.state.context,r),await this.#o.config.onSettled?.(n,null,this.state.variables,this.state.context,this,r),await this.options.onSettled?.(n,null,e,this.state.context,r),this.#u({type:"success",data:n}),n}catch(t){try{await this.#o.config.onError?.(t,e,this.state.context,this,r)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,r)}catch(e){Promise.reject(e)}try{await this.#o.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,r)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,r)}catch(e){Promise.reject(e)}throw this.#u({type:"error",error:t}),t}finally{this.#o.runNext(this)}}#u(e){this.state=(t=>{switch(e.type){case"failed":return{...t,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...t,isPaused:!0};case"continue":return{...t,isPaused:!1};case"pending":return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}})(this.state),t.notifyManager.batch(()=>{this.#a.forEach(t=>{t.onMutationUpdate(e)}),this.#o.notify({mutation:this,type:"updated",action:e})})}};function s(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}e.s(["Mutation",()=>i,"getDefaultState",()=>s])},757440,e=>{"use strict";var t=e.i(290571),r=e.i(271645);let n=e=>{var n=(0,t.__rest)(e,[]);return r.default.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},n),r.default.createElement("path",{d:"M11.9999 13.1714L16.9497 8.22168L18.3639 9.63589L11.9999 15.9999L5.63599 9.63589L7.0502 8.22168L11.9999 13.1714Z"}))};e.s(["default",()=>n])},446428,854056,e=>{"use strict";let t;var r=e.i(290571),n=e.i(271645);let i=e=>{var t=(0,r.__rest)(e,[]);return n.default.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),n.default.createElement("path",{d:"M12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22ZM12 10.5858L9.17157 7.75736L7.75736 9.17157L10.5858 12L7.75736 14.8284L9.17157 16.2426L12 13.4142L14.8284 16.2426L16.2426 14.8284L13.4142 12L16.2426 9.17157L14.8284 7.75736L12 10.5858Z"}))};e.s(["default",()=>i],446428);var s=e.i(746725),a=e.i(914189),o=e.i(553521),l=e.i(835696),u=e.i(941444),c=e.i(178677),d=e.i(294316),h=e.i(83733),f=e.i(233137),m=e.i(732607),p=e.i(397701),v=e.i(700020);function g(e){var t;return!!(e.enter||e.enterFrom||e.enterTo||e.leave||e.leaveFrom||e.leaveTo)||(null!=(t=e.as)?t:x)!==n.Fragment||1===n.default.Children.count(e.children)}let y=(0,n.createContext)(null);y.displayName="TransitionContext";var b=((t=b||{}).Visible="visible",t.Hidden="hidden",t);let w=(0,n.createContext)(null);function C(e){return"children"in e?C(e.children):e.current.filter(({el:e})=>null!==e.current).filter(({state:e})=>"visible"===e).length>0}function S(e,t){let r=(0,u.useLatestValue)(e),i=(0,n.useRef)([]),l=(0,o.useIsMounted)(),c=(0,s.useDisposables)(),d=(0,a.useEvent)((e,t=v.RenderStrategy.Hidden)=>{let n=i.current.findIndex(({el:t})=>t===e);-1!==n&&((0,p.match)(t,{[v.RenderStrategy.Unmount](){i.current.splice(n,1)},[v.RenderStrategy.Hidden](){i.current[n].state="hidden"}}),c.microTask(()=>{var e;!C(i)&&l.current&&(null==(e=r.current)||e.call(r))}))}),h=(0,a.useEvent)(e=>{let t=i.current.find(({el:t})=>t===e);return t?"visible"!==t.state&&(t.state="visible"):i.current.push({el:e,state:"visible"}),()=>d(e,v.RenderStrategy.Unmount)}),f=(0,n.useRef)([]),m=(0,n.useRef)(Promise.resolve()),g=(0,n.useRef)({enter:[],leave:[]}),y=(0,a.useEvent)((e,r,n)=>{f.current.splice(0),t&&(t.chains.current[r]=t.chains.current[r].filter(([t])=>t!==e)),null==t||t.chains.current[r].push([e,new Promise(e=>{f.current.push(e)})]),null==t||t.chains.current[r].push([e,new Promise(e=>{Promise.all(g.current[r].map(([e,t])=>t)).then(()=>e())})]),"enter"===r?m.current=m.current.then(()=>null==t?void 0:t.wait.current).then(()=>n(r)):n(r)}),b=(0,a.useEvent)((e,t,r)=>{Promise.all(g.current[t].splice(0).map(([e,t])=>t)).then(()=>{var e;null==(e=f.current.shift())||e()}).then(()=>r(t))});return(0,n.useMemo)(()=>({children:i,register:h,unregister:d,onStart:y,onStop:b,wait:m,chains:g}),[h,d,i,y,b,g,m])}w.displayName="NestingContext";let x=n.Fragment,O=v.RenderFeatures.RenderStrategy,E=(0,v.forwardRefWithAs)(function(e,t){let{show:r,appear:i=!1,unmount:s=!0,...o}=e,u=(0,n.useRef)(null),h=g(e),m=(0,d.useSyncRefs)(...h?[u,t]:null===t?[]:[t]);(0,c.useServerHandoffComplete)();let p=(0,f.useOpenClosed)();if(void 0===r&&null!==p&&(r=(p&f.State.Open)===f.State.Open),void 0===r)throw Error("A is used but it is missing a `show={true | false}` prop.");let[b,x]=(0,n.useState)(r?"visible":"hidden"),E=S(()=>{r||x("hidden")}),[R,j]=(0,n.useState)(!0),P=(0,n.useRef)([r]);(0,l.useIsoMorphicEffect)(()=>{!1!==R&&P.current[P.current.length-1]!==r&&(P.current.push(r),j(!1))},[P,r]);let k=(0,n.useMemo)(()=>({show:r,appear:i,initial:R}),[r,i,R]);(0,l.useIsoMorphicEffect)(()=>{r?x("visible"):C(E)||null===u.current||x("hidden")},[r,E]);let N={unmount:s},M=(0,a.useEvent)(()=>{var t;R&&j(!1),null==(t=e.beforeEnter)||t.call(e)}),T=(0,a.useEvent)(()=>{var t;R&&j(!1),null==(t=e.beforeLeave)||t.call(e)}),F=(0,v.useRender)();return n.default.createElement(w.Provider,{value:E},n.default.createElement(y.Provider,{value:k},F({ourProps:{...N,as:n.Fragment,children:n.default.createElement(_,{ref:m,...N,...o,beforeEnter:M,beforeLeave:T})},theirProps:{},defaultTag:n.Fragment,features:O,visible:"visible"===b,name:"Transition"})))}),_=(0,v.forwardRefWithAs)(function(e,t){var r,i;let{transition:s=!0,beforeEnter:o,afterEnter:u,beforeLeave:b,afterLeave:E,enter:_,enterFrom:R,enterTo:j,entered:P,leave:k,leaveFrom:N,leaveTo:M,...T}=e,[F,z]=(0,n.useState)(null),I=(0,n.useRef)(null),$=g(e),L=(0,d.useSyncRefs)(...$?[I,t,z]:null===t?[]:[t]),A=null==(r=T.unmount)||r?v.RenderStrategy.Unmount:v.RenderStrategy.Hidden,{show:B,appear:D,initial:V}=function(){let e=(0,n.useContext)(y);if(null===e)throw Error("A is used but it is missing a parent or .");return e}(),[K,H]=(0,n.useState)(B?"visible":"hidden"),U=function(){let e=(0,n.useContext)(w);if(null===e)throw Error("A is used but it is missing a parent or .");return e}(),{register:W,unregister:q}=U;(0,l.useIsoMorphicEffect)(()=>W(I),[W,I]),(0,l.useIsoMorphicEffect)(()=>{if(A===v.RenderStrategy.Hidden&&I.current)return B&&"visible"!==K?void H("visible"):(0,p.match)(K,{hidden:()=>q(I),visible:()=>W(I)})},[K,I,W,q,B,A]);let G=(0,c.useServerHandoffComplete)();(0,l.useIsoMorphicEffect)(()=>{if($&&G&&"visible"===K&&null===I.current)throw Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[I,K,G,$]);let Q=V&&!D,Z=D&&B&&V,X=(0,n.useRef)(!1),Y=S(()=>{X.current||(H("hidden"),q(I))},U),J=(0,a.useEvent)(e=>{X.current=!0,Y.onStart(I,e?"enter":"leave",e=>{"enter"===e?null==o||o():"leave"===e&&(null==b||b())})}),ee=(0,a.useEvent)(e=>{let t=e?"enter":"leave";X.current=!1,Y.onStop(I,t,e=>{"enter"===e?null==u||u():"leave"===e&&(null==E||E())}),"leave"!==t||C(Y)||(H("hidden"),q(I))});(0,n.useEffect)(()=>{$&&s||(J(B),ee(B))},[B,$,s]);let et=!(!s||!$||!G||Q),[,er]=(0,h.useTransition)(et,F,B,{start:J,end:ee}),en=(0,v.compact)({ref:L,className:(null==(i=(0,m.classNames)(T.className,Z&&_,Z&&R,er.enter&&_,er.enter&&er.closed&&R,er.enter&&!er.closed&&j,er.leave&&k,er.leave&&!er.closed&&N,er.leave&&er.closed&&M,!er.transition&&B&&P))?void 0:i.trim())||void 0,...(0,h.transitionDataAttributes)(er)}),ei=0;"visible"===K&&(ei|=f.State.Open),"hidden"===K&&(ei|=f.State.Closed),er.enter&&(ei|=f.State.Opening),er.leave&&(ei|=f.State.Closing);let es=(0,v.useRender)();return n.default.createElement(w.Provider,{value:Y},n.default.createElement(f.OpenClosedProvider,{value:ei},es({ourProps:en,theirProps:T,defaultTag:x,features:O,visible:"visible"===K,name:"Transition.Child"})))}),R=(0,v.forwardRefWithAs)(function(e,t){let r=null!==(0,n.useContext)(y),i=null!==(0,f.useOpenClosed)();return n.default.createElement(n.default.Fragment,null,!r&&i?n.default.createElement(E,{ref:t,...e}):n.default.createElement(_,{ref:t,...e}))}),j=Object.assign(E,{Child:R,Root:E});e.s(["Transition",()=>j],854056)},206929,e=>{"use strict";var t=e.i(290571),r=e.i(757440),n=e.i(271645),i=e.i(446428),s=e.i(444755),a=e.i(673706),o=e.i(103471),l=e.i(495470),u=e.i(854056),c=e.i(888288);let d=(0,a.makeClassName)("Select"),h=n.default.forwardRef((e,a)=>{let{defaultValue:h="",value:f,onValueChange:m,placeholder:p="Select...",disabled:v=!1,icon:g,enableClear:y=!1,required:b,children:w,name:C,error:S=!1,errorMessage:x,className:O,id:E}=e,_=(0,t.__rest)(e,["defaultValue","value","onValueChange","placeholder","disabled","icon","enableClear","required","children","name","error","errorMessage","className","id"]),R=(0,n.useRef)(null),j=n.Children.toArray(w),[P,k]=(0,c.default)(h,f),N=(0,n.useMemo)(()=>{let e=n.default.Children.toArray(w).filter(n.isValidElement);return(0,o.constructValueToNameMapping)(e)},[w]);return n.default.createElement("div",{className:(0,s.tremorTwMerge)("w-full min-w-[10rem] text-tremor-default",O)},n.default.createElement("div",{className:"relative"},n.default.createElement("select",{title:"select-hidden",required:b,className:(0,s.tremorTwMerge)("h-full w-full absolute left-0 top-0 -z-10 opacity-0"),value:P,onChange:e=>{e.preventDefault()},name:C,disabled:v,id:E,onFocus:()=>{let e=R.current;e&&e.focus()}},n.default.createElement("option",{className:"hidden",value:"",disabled:!0,hidden:!0},p),j.map(e=>{let t=e.props.value,r=e.props.children;return n.default.createElement("option",{className:"hidden",key:t,value:t},r)})),n.default.createElement(l.Listbox,Object.assign({as:"div",ref:a,defaultValue:P,value:P,onChange:e=>{null==m||m(e),k(e)},disabled:v,id:E},_),({value:e})=>{var t;return n.default.createElement(n.default.Fragment,null,n.default.createElement(l.ListboxButton,{ref:R,className:(0,s.tremorTwMerge)("w-full outline-none text-left whitespace-nowrap truncate rounded-tremor-default focus:ring-2 transition duration-100 border pr-8 py-2","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",g?"pl-10":"pl-3",(0,o.getSelectButtonColors)((0,o.hasValue)(e),v,S))},g&&n.default.createElement("span",{className:(0,s.tremorTwMerge)("absolute inset-y-0 left-0 flex items-center ml-px pl-2.5")},n.default.createElement(g,{className:(0,s.tremorTwMerge)(d("Icon"),"flex-none h-5 w-5","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")})),n.default.createElement("span",{className:"w-[90%] block truncate"},e&&null!=(t=N.get(e))?t:p),n.default.createElement("span",{className:(0,s.tremorTwMerge)("absolute inset-y-0 right-0 flex items-center mr-3")},n.default.createElement(r.default,{className:(0,s.tremorTwMerge)(d("arrowDownIcon"),"flex-none h-5 w-5","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")}))),y&&P?n.default.createElement("button",{type:"button",className:(0,s.tremorTwMerge)("absolute inset-y-0 right-0 flex items-center mr-8"),onClick:e=>{e.preventDefault(),k(""),null==m||m("")}},n.default.createElement(i.default,{className:(0,s.tremorTwMerge)(d("clearIcon"),"flex-none h-4 w-4","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")})):null,n.default.createElement(u.Transition,{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"},n.default.createElement(l.ListboxOptions,{anchor:"bottom start",className:(0,s.tremorTwMerge)("z-10 w-[var(--button-width)] divide-y overflow-y-auto outline-none rounded-tremor-default max-h-[228px] border [--anchor-gap:4px]","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")},w)))})),S&&x?n.default.createElement("p",{className:(0,s.tremorTwMerge)("errorMessage","text-sm text-rose-500 mt-1")},x):null)});h.displayName="Select",e.s(["Select",()=>h],206929)},37091,e=>{"use strict";var t=e.i(290571),r=e.i(95779),n=e.i(444755),i=e.i(673706),s=e.i(271645);let a=s.default.forwardRef((e,a)=>{let{color:o,children:l,className:u}=e,c=(0,t.__rest)(e,["color","children","className"]);return s.default.createElement("p",Object.assign({ref:a,className:(0,n.tremorTwMerge)(o?(0,i.getColorClassNames)(o,r.colorPalette.lightText).textColor:"text-tremor-content-emphasis dark:text-dark-tremor-content-emphasis",u)},c),l)});a.displayName="Subtitle",e.s(["Subtitle",()=>a],37091)},829672,836938,310730,e=>{"use strict";e.i(247167);var t=e.i(271645),r=e.i(343794),n=e.i(914949),i=e.i(404948);let s=e=>e?"function"==typeof e?e():e:null;e.s(["getRenderPropValue",0,s],836938);var a=e.i(613541),o=e.i(763731),l=e.i(242064),u=e.i(491816);e.i(793154);var c=e.i(880476),d=e.i(183293),h=e.i(717356),f=e.i(320560),m=e.i(307358),p=e.i(246422),v=e.i(838378),g=e.i(617933);let y=(0,p.genStyleHooks)("Popover",e=>{let{colorBgElevated:t,colorText:r}=e,n=(0,v.mergeToken)(e,{popoverBg:t,popoverColor:r});return[(e=>{let{componentCls:t,popoverColor:r,titleMinWidth:n,fontWeightStrong:i,innerPadding:s,boxShadowSecondary:a,colorTextHeading:o,borderRadiusLG:l,zIndexPopup:u,titleMarginBottom:c,colorBgElevated:h,popoverBg:m,titleBorderBottom:p,innerContentPadding:v,titlePadding:g}=e;return[{[t]:Object.assign(Object.assign({},(0,d.resetComponent)(e)),{position:"absolute",top:0,left:{_skip_check_:!0,value:0},zIndex:u,fontWeight:"normal",whiteSpace:"normal",textAlign:"start",cursor:"auto",userSelect:"text","--valid-offset-x":"var(--arrow-offset-horizontal, var(--arrow-x))",transformOrigin:"var(--valid-offset-x, 50%) var(--arrow-y, 50%)","--antd-arrow-background-color":h,width:"max-content",maxWidth:"100vw","&-rtl":{direction:"rtl"},"&-hidden":{display:"none"},[`${t}-content`]:{position:"relative"},[`${t}-inner`]:{backgroundColor:m,backgroundClip:"padding-box",borderRadius:l,boxShadow:a,padding:s},[`${t}-title`]:{minWidth:n,marginBottom:c,color:o,fontWeight:i,borderBottom:p,padding:g},[`${t}-inner-content`]:{color:r,padding:v}})},(0,f.default)(e,"var(--antd-arrow-background-color)"),{[`${t}-pure`]:{position:"relative",maxWidth:"none",margin:e.sizePopupArrow,display:"inline-block",[`${t}-content`]:{display:"inline-block"}}}]})(n),(e=>{let{componentCls:t}=e;return{[t]:g.PresetColors.map(r=>{let n=e[`${r}6`];return{[`&${t}-${r}`]:{"--antd-arrow-background-color":n,[`${t}-inner`]:{backgroundColor:n},[`${t}-arrow`]:{background:"transparent"}}}})}})(n),(0,h.initZoomMotion)(n,"zoom-big")]},e=>{let{lineWidth:t,controlHeight:r,fontHeight:n,padding:i,wireframe:s,zIndexPopupBase:a,borderRadiusLG:o,marginXS:l,lineType:u,colorSplit:c,paddingSM:d}=e,h=r-n;return Object.assign(Object.assign(Object.assign({titleMinWidth:177,zIndexPopup:a+30},(0,m.getArrowToken)(e)),(0,f.getArrowOffsetToken)({contentRadius:o,limitVerticalRadius:!0})),{innerPadding:12*!s,titleMarginBottom:s?0:l,titlePadding:s?`${h/2}px ${i}px ${h/2-t}px`:0,titleBorderBottom:s?`${t}px ${u} ${c}`:"none",innerContentPadding:s?`${d}px ${i}px`:0})},{resetStyle:!1,deprecatedTokens:[["width","titleMinWidth"],["minWidth","titleMinWidth"]]});var b=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,n=Object.getOwnPropertySymbols(e);it.indexOf(n[i])&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r};let w=({title:e,content:r,prefixCls:n})=>e||r?t.createElement(t.Fragment,null,e&&t.createElement("div",{className:`${n}-title`},e),r&&t.createElement("div",{className:`${n}-inner-content`},r)):null,C=e=>{let{hashId:n,prefixCls:i,className:a,style:o,placement:l="top",title:u,content:d,children:h}=e,f=s(u),m=s(d),p=(0,r.default)(n,i,`${i}-pure`,`${i}-placement-${l}`,a);return t.createElement("div",{className:p,style:o},t.createElement("div",{className:`${i}-arrow`}),t.createElement(c.Popup,Object.assign({},e,{className:n,prefixCls:i}),h||t.createElement(w,{prefixCls:i,title:f,content:m})))},S=e=>{let{prefixCls:n,className:i}=e,s=b(e,["prefixCls","className"]),{getPrefixCls:a}=t.useContext(l.ConfigContext),o=a("popover",n),[u,c,d]=y(o);return u(t.createElement(C,Object.assign({},s,{prefixCls:o,hashId:c,className:(0,r.default)(i,d)})))};e.s(["Overlay",0,w,"default",0,S],310730);var x=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,n=Object.getOwnPropertySymbols(e);it.indexOf(n[i])&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r};let O=t.forwardRef((e,c)=>{var d,h;let{prefixCls:f,title:m,content:p,overlayClassName:v,placement:g="top",trigger:b="hover",children:C,mouseEnterDelay:S=.1,mouseLeaveDelay:O=.1,onOpenChange:E,overlayStyle:_={},styles:R,classNames:j}=e,P=x(e,["prefixCls","title","content","overlayClassName","placement","trigger","children","mouseEnterDelay","mouseLeaveDelay","onOpenChange","overlayStyle","styles","classNames"]),{getPrefixCls:k,className:N,style:M,classNames:T,styles:F}=(0,l.useComponentConfig)("popover"),z=k("popover",f),[I,$,L]=y(z),A=k(),B=(0,r.default)(v,$,L,N,T.root,null==j?void 0:j.root),D=(0,r.default)(T.body,null==j?void 0:j.body),[V,K]=(0,n.default)(!1,{value:null!=(d=e.open)?d:e.visible,defaultValue:null!=(h=e.defaultOpen)?h:e.defaultVisible}),H=(e,t)=>{K(e,!0),null==E||E(e,t)},U=s(m),W=s(p);return I(t.createElement(u.default,Object.assign({placement:g,trigger:b,mouseEnterDelay:S,mouseLeaveDelay:O},P,{prefixCls:z,classNames:{root:B,body:D},styles:{root:Object.assign(Object.assign(Object.assign(Object.assign({},F.root),M),_),null==R?void 0:R.root),body:Object.assign(Object.assign({},F.body),null==R?void 0:R.body)},ref:c,open:V,onOpenChange:e=>{H(e)},overlay:U||W?t.createElement(w,{prefixCls:z,title:U,content:W}):null,transitionName:(0,a.getTransitionName)(A,"zoom-big",P.transitionName),"data-popover-inject":!0}),(0,o.cloneElement)(C,{onKeyDown:e=>{var r,n;(0,t.isValidElement)(C)&&(null==(n=null==C?void 0:(r=C.props).onKeyDown)||n.call(r,e)),e.keyCode===i.default.ESC&&H(!1,e)}})))});O._InternalPanelDoNotUseOrYouWillBeFired=S,e.s(["default",0,O],829672)},282786,e=>{"use strict";var t=e.i(829672);e.s(["Popover",()=>t.default])},362024,e=>{"use strict";var t=e.i(988122);e.s(["Collapse",()=>t.default])},240647,e=>{"use strict";var t=e.i(286612);e.s(["RightOutlined",()=>t.default])},516015,(e,t,r)=>{},898547,(e,t,r)=>{var n=e.i(247167);e.r(516015);var i=e.r(271645),s=i&&"object"==typeof i&&"default"in i?i:{default:i},a=void 0!==n.default&&n.default.env&&!0,o=function(e){return"[object String]"===Object.prototype.toString.call(e)},l=function(){function e(e){var t=void 0===e?{}:e,r=t.name,n=void 0===r?"stylesheet":r,i=t.optimizeForSpeed,s=void 0===i?a:i;u(o(n),"`name` must be a string"),this._name=n,this._deletedRulePlaceholder="#"+n+"-deleted-rule____{}",u("boolean"==typeof s,"`optimizeForSpeed` must be a boolean"),this._optimizeForSpeed=s,this._serverSheet=void 0,this._tags=[],this._injected=!1,this._rulesCount=0;var l="u">typeof window&&document.querySelector('meta[property="csp-nonce"]');this._nonce=l?l.getAttribute("content"):null}var t,r=e.prototype;return r.setOptimizeForSpeed=function(e){u("boolean"==typeof e,"`setOptimizeForSpeed` accepts a boolean"),u(0===this._rulesCount,"optimizeForSpeed cannot be when rules have already been inserted"),this.flush(),this._optimizeForSpeed=e,this.inject()},r.isOptimizeForSpeed=function(){return this._optimizeForSpeed},r.inject=function(){var e=this;if(u(!this._injected,"sheet already injected"),this._injected=!0,"u">typeof window&&this._optimizeForSpeed){this._tags[0]=this.makeStyleTag(this._name),this._optimizeForSpeed="insertRule"in this.getSheet(),this._optimizeForSpeed||(a||console.warn("StyleSheet: optimizeForSpeed mode not supported falling back to standard mode."),this.flush(),this._injected=!0);return}this._serverSheet={cssRules:[],insertRule:function(t,r){return"number"==typeof r?e._serverSheet.cssRules[r]={cssText:t}:e._serverSheet.cssRules.push({cssText:t}),r},deleteRule:function(t){e._serverSheet.cssRules[t]=null}}},r.getSheetForTag=function(e){if(e.sheet)return e.sheet;for(var t=0;ttypeof window?this.getSheet():this._serverSheet;if(t.trim()||(t=this._deletedRulePlaceholder),!r.cssRules[e])return e;r.deleteRule(e);try{r.insertRule(t,e)}catch(n){a||console.warn("StyleSheet: illegal rule: \n\n"+t+"\n\nSee https://stackoverflow.com/q/20007992 for more info"),r.insertRule(this._deletedRulePlaceholder,e)}}else{var n=this._tags[e];u(n,"old rule at index `"+e+"` not found"),n.textContent=t}return e},r.deleteRule=function(e){if("u"typeof window?(this._tags.forEach(function(e){return e&&e.parentNode.removeChild(e)}),this._tags=[]):this._serverSheet.cssRules=[]},r.cssRules=function(){var e=this;return"u">>0},d={};function h(e,t){if(!t)return"jsx-"+e;var r=String(t),n=e+r;return d[n]||(d[n]="jsx-"+c(e+"-"+r)),d[n]}function f(e,t){"u"typeof window&&!this._fromServer&&(this._fromServer=this.selectFromServer(),this._instancesCounts=Object.keys(this._fromServer).reduce(function(e,t){return e[t]=0,e},{}));var r=this.getIdAndRules(e),n=r.styleId,i=r.rules;if(n in this._instancesCounts){this._instancesCounts[n]+=1;return}var s=i.map(function(e){return t._sheet.insertRule(e)}).filter(function(e){return -1!==e});this._indices[n]=s,this._instancesCounts[n]=1},t.remove=function(e){var t=this,r=this.getIdAndRules(e).styleId;if(function(e,t){if(!e)throw Error("StyleSheetRegistry: "+t+".")}(r in this._instancesCounts,"styleId: `"+r+"` not found"),this._instancesCounts[r]-=1,this._instancesCounts[r]<1){var n=this._fromServer&&this._fromServer[r];n?(n.parentNode.removeChild(n),delete this._fromServer[r]):(this._indices[r].forEach(function(e){return t._sheet.deleteRule(e)}),delete this._indices[r]),delete this._instancesCounts[r]}},t.update=function(e,t){this.add(t),this.remove(e)},t.flush=function(){this._sheet.flush(),this._sheet.inject(),this._fromServer=void 0,this._indices={},this._instancesCounts={}},t.cssRules=function(){var e=this,t=this._fromServer?Object.keys(this._fromServer).map(function(t){return[t,e._fromServer[t]]}):[],r=this._sheet.cssRules();return t.concat(Object.keys(this._indices).map(function(t){return[t,e._indices[t].map(function(e){return r[e].cssText}).join(e._optimizeForSpeed?"":"\n")]}).filter(function(e){return!!e[1]}))},t.styles=function(e){var t,r;return t=this.cssRules(),void 0===(r=e)&&(r={}),t.map(function(e){var t=e[0],n=e[1];return s.default.createElement("style",{id:"__"+t,key:"__"+t,nonce:r.nonce?r.nonce:void 0,dangerouslySetInnerHTML:{__html:n}})})},t.getIdAndRules=function(e){var t=e.children,r=e.dynamic,n=e.id;if(r){var i=h(n,r);return{styleId:i,rules:Array.isArray(t)?t.map(function(e){return f(i,e)}):[f(i,t)]}}return{styleId:h(n),rules:Array.isArray(t)?t:[t]}},t.selectFromServer=function(){return Array.prototype.slice.call(document.querySelectorAll('[id^="__jsx-"]')).reduce(function(e,t){return e[t.id.slice(2)]=t,e},{})},e}(),p=i.createContext(null);function v(){return new m}function g(){return i.useContext(p)}p.displayName="StyleSheetContext";var y=s.default.useInsertionEffect||s.default.useLayoutEffect,b="u">typeof window?v():void 0;function w(e){var t=b||g();return t&&("u"{t.exports=e.r(898547).style},502275,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}))});e.s(["InformationCircleIcon",0,r],502275)},418371,e=>{"use strict";var t=e.i(843476),r=e.i(271645),n=e.i(916925);e.s(["ProviderLogo",0,({provider:e,className:i="w-4 h-4"})=>{let[s,a]=(0,r.useState)(!1),{logo:o}=(0,n.getProviderLogoAndName)(e);return s||!o?(0,t.jsx)("div",{className:`${i} rounded-full bg-gray-200 flex items-center justify-center text-xs`,children:e?.charAt(0)||"-"}):(0,t.jsx)("img",{src:o,alt:`${e} logo`,className:i,onError:()=>a(!0)})}])},368670,e=>{"use strict";var t=e.i(764205),r=e.i(266027);let n=(0,e.i(243652).createQueryKeys)("modelCostMap");e.s(["useModelCostMap",0,()=>(0,r.useQuery)({queryKey:n.list({}),queryFn:async()=>await (0,t.modelCostMap)(),staleTime:6e4,gcTime:6e4})])},178654,621192,e=>{"use strict";let t=e.i(211576).Col;e.s(["Col",0,t],178654);let r=e.i(264042).Row;e.s(["Row",0,r],621192)},564897,e=>{"use strict";e.i(247167);var t=e.i(931067),r=e.i(271645);let n={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M696 480H328c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h368c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8z"}},{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}}]},name:"minus-circle",theme:"outlined"};var i=e.i(9583),s=r.forwardRef(function(e,s){return r.createElement(i.default,(0,t.default)({},e,{ref:s,icon:n}))});e.s(["MinusCircleOutlined",0,s],564897)},750113,e=>{"use strict";var t=e.i(684024);e.s(["QuestionCircleOutlined",()=>t.default])},475647,286536,77705,e=>{"use strict";e.i(247167);var t=e.i(931067),r=e.i(271645);let n={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"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"};var i=e.i(9583),s=r.forwardRef(function(e,s){return r.createElement(i.default,(0,t.default)({},e,{ref:s,icon:n}))});e.s(["PlusCircleOutlined",0,s],475647);var a=e.i(475254);let o=(0,a.default)("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);e.s(["Eye",()=>o],286536);let l=(0,a.default)("eye-off",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);e.s(["EyeOff",()=>l],77705)},987432,e=>{"use strict";e.i(247167);var t=e.i(931067),r=e.i(271645);let n={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M893.3 293.3L730.7 130.7c-7.5-7.5-16.7-13-26.7-16V112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V338.5c0-17-6.7-33.2-18.7-45.2zM384 184h256v104H384V184zm456 656H184V184h136v136c0 17.7 14.3 32 32 32h320c17.7 0 32-14.3 32-32V205.8l136 136V840zM512 442c-79.5 0-144 64.5-144 144s64.5 144 144 144 144-64.5 144-144-64.5-144-144-144zm0 224c-44.2 0-80-35.8-80-80s35.8-80 80-80 80 35.8 80 80-35.8 80-80 80z"}}]},name:"save",theme:"outlined"};var i=e.i(9583),s=r.forwardRef(function(e,s){return r.createElement(i.default,(0,t.default)({},e,{ref:s,icon:n}))});e.s(["SaveOutlined",0,s],987432)},211576,e=>{"use strict";var t=e.i(131757);e.s(["Col",()=>t.default])},724154,e=>{"use strict";e.i(247167);var t=e.i(931067),r=e.i(271645);let n={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"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"};var i=e.i(9583),s=r.forwardRef(function(e,s){return r.createElement(i.default,(0,t.default)({},e,{ref:s,icon:n}))});e.s(["StopOutlined",0,s],724154)},446891,836991,153472,e=>{"use strict";var t,r,n=e.i(843476),i=e.i(464571),s=e.i(326373),a=e.i(94629),o=e.i(360820),l=e.i(871943),u=e.i(271645);let c=u.forwardRef(function(e,t){return u.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),u.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"}))});e.s(["XIcon",0,c],836991),e.s(["TableHeaderSortDropdown",0,({sortState:e,onSortChange:t})=>{let r=[{key:"asc",label:"Ascending",icon:(0,n.jsx)(o.ChevronUpIcon,{className:"h-4 w-4"})},{key:"desc",label:"Descending",icon:(0,n.jsx)(l.ChevronDownIcon,{className:"h-4 w-4"})},{key:"reset",label:"Reset",icon:(0,n.jsx)(c,{className:"h-4 w-4"})}];return(0,n.jsx)(s.Dropdown,{menu:{items:r,onClick:({key:e})=>{"asc"===e?t("asc"):"desc"===e?t("desc"):"reset"===e&&t(!1)},selectable:!0,selectedKeys:e?[e]:[]},trigger:["click"],autoAdjustOverflow:!0,children:(0,n.jsx)(i.Button,{type:"text",onClick:e=>e.stopPropagation(),icon:"asc"===e?(0,n.jsx)(o.ChevronUpIcon,{className:"h-4 w-4"}):"desc"===e?(0,n.jsx)(l.ChevronDownIcon,{className:"h-4 w-4"}):(0,n.jsx)(a.SwitchVerticalIcon,{className:"h-4 w-4"}),className:e?"text-blue-500 hover:text-blue-600":"text-gray-400 hover:text-blue-500"})})}],446891);var d=e.i(266027),h=e.i(954616),f=e.i(243652),m=e.i(135214),p=e.i(764205),v=((t={}).GENERAL_SETTINGS="general_settings",t),g=((r={}).MAXIMUM_SPEND_LOGS_RETENTION_PERIOD="maximum_spend_logs_retention_period",r);let y=async(e,t)=>{try{let r=p.proxyBaseUrl?`${p.proxyBaseUrl}/config/list?config_type=${t}`:`/config/list?config_type=${t}`,n=await fetch(r,{method:"GET",headers:{[(0,p.getGlobalLitellmHeaderName)()]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=(0,p.deriveErrorMessage)(e);throw(0,p.handleError)(t),Error(t)}return await n.json()}catch(e){throw console.error(`Failed to get proxy config for ${t}:`,e),e}},b=(0,f.createQueryKeys)("proxyConfig"),w=async(e,t)=>{try{let r=p.proxyBaseUrl?`${p.proxyBaseUrl}/config/field/delete`:"/config/field/delete",n=await fetch(r,{method:"POST",headers:{[(0,p.getGlobalLitellmHeaderName)()]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){let e=await n.json(),t=(0,p.deriveErrorMessage)(e);throw(0,p.handleError)(t),Error(t)}return await n.json()}catch(e){throw console.error(`Failed to delete proxy config field ${t.field_name}:`,e),e}};e.s(["ConfigType",()=>v,"GeneralSettingsFieldName",()=>g,"useDeleteProxyConfigField",0,()=>{let{accessToken:e}=(0,m.default)();return(0,h.useMutation)({mutationFn:async t=>{if(!e)throw Error("Access token is required");return await w(e,t)}})},"useProxyConfig",0,e=>{let{accessToken:t}=(0,m.default)();return(0,d.useQuery)({queryKey:b.list({filters:{configType:e}}),queryFn:async()=>await y(t,e),enabled:!!t})}],153472)},883552,e=>{"use strict";e.i(247167);var t=e.i(271645),r=e.i(562901),n=e.i(343794),i=e.i(914949),s=e.i(529681),a=e.i(242064),o=e.i(829672),l=e.i(285781),u=e.i(836938),c=e.i(920228),d=e.i(62405),h=e.i(408850),f=e.i(87414),m=e.i(310730);let p=(0,e.i(246422).genStyleHooks)("Popconfirm",e=>(e=>{let{componentCls:t,iconCls:r,antCls:n,zIndexPopup:i,colorText:s,colorWarning:a,marginXXS:o,marginXS:l,fontSize:u,fontWeightStrong:c,colorTextHeading:d}=e;return{[t]:{zIndex:i,[`&${n}-popover`]:{fontSize:u},[`${t}-message`]:{marginBottom:l,display:"flex",flexWrap:"nowrap",alignItems:"start",[`> ${t}-message-icon ${r}`]:{color:a,fontSize:u,lineHeight:1,marginInlineEnd:l},[`${t}-title`]:{fontWeight:c,color:d,"&:only-child":{fontWeight:"normal"}},[`${t}-description`]:{marginTop:o,color:s}},[`${t}-buttons`]:{textAlign:"end",whiteSpace:"nowrap",button:{marginInlineStart:l}}}}})(e),e=>{let{zIndexPopupBase:t}=e;return{zIndexPopup:t+60}},{resetStyle:!1});var v=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,n=Object.getOwnPropertySymbols(e);it.indexOf(n[i])&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r};let g=e=>{let{prefixCls:n,okButtonProps:i,cancelButtonProps:s,title:o,description:m,cancelText:p,okText:v,okType:g="primary",icon:y=t.createElement(r.default,null),showCancel:b=!0,close:w,onConfirm:C,onCancel:S,onPopupClick:x}=e,{getPrefixCls:O}=t.useContext(a.ConfigContext),[E]=(0,h.useLocale)("Popconfirm",f.default.Popconfirm),_=(0,u.getRenderPropValue)(o),R=(0,u.getRenderPropValue)(m);return t.createElement("div",{className:`${n}-inner-content`,onClick:x},t.createElement("div",{className:`${n}-message`},y&&t.createElement("span",{className:`${n}-message-icon`},y),t.createElement("div",{className:`${n}-message-text`},_&&t.createElement("div",{className:`${n}-title`},_),R&&t.createElement("div",{className:`${n}-description`},R))),t.createElement("div",{className:`${n}-buttons`},b&&t.createElement(c.default,Object.assign({onClick:S,size:"small"},s),p||(null==E?void 0:E.cancelText)),t.createElement(l.default,{buttonProps:Object.assign(Object.assign({size:"small"},(0,d.convertLegacyProps)(g)),i),actionFn:C,close:w,prefixCls:O("btn"),quitOnNullishReturnValue:!0,emitEvent:!0},v||(null==E?void 0:E.okText))))};var y=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,n=Object.getOwnPropertySymbols(e);it.indexOf(n[i])&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r};let b=t.forwardRef((e,l)=>{var u,c;let{prefixCls:d,placement:h="top",trigger:f="click",okType:m="primary",icon:v=t.createElement(r.default,null),children:b,overlayClassName:w,onOpenChange:C,onVisibleChange:S,overlayStyle:x,styles:O,classNames:E}=e,_=y(e,["prefixCls","placement","trigger","okType","icon","children","overlayClassName","onOpenChange","onVisibleChange","overlayStyle","styles","classNames"]),{getPrefixCls:R,className:j,style:P,classNames:k,styles:N}=(0,a.useComponentConfig)("popconfirm"),[M,T]=(0,i.default)(!1,{value:null!=(u=e.open)?u:e.visible,defaultValue:null!=(c=e.defaultOpen)?c:e.defaultVisible}),F=(e,t)=>{T(e,!0),null==S||S(e),null==C||C(e,t)},z=R("popconfirm",d),I=(0,n.default)(z,j,w,k.root,null==E?void 0:E.root),$=(0,n.default)(k.body,null==E?void 0:E.body),[L]=p(z);return L(t.createElement(o.default,Object.assign({},(0,s.default)(_,["title"]),{trigger:f,placement:h,onOpenChange:(t,r)=>{let{disabled:n=!1}=e;n||F(t,r)},open:M,ref:l,classNames:{root:I,body:$},styles:{root:Object.assign(Object.assign(Object.assign(Object.assign({},N.root),P),x),null==O?void 0:O.root),body:Object.assign(Object.assign({},N.body),null==O?void 0:O.body)},content:t.createElement(g,Object.assign({okType:m,icon:v},e,{prefixCls:z,close:e=>{F(!1,e)},onConfirm:t=>{var r;return null==(r=e.onConfirm)?void 0:r.call(void 0,t)},onCancel:t=>{var r;F(!1,t),null==(r=e.onCancel)||r.call(void 0,t)}})),"data-popover-inject":!0}),b))});b._InternalPanelDoNotUseOrYouWillBeFired=e=>{let{prefixCls:r,placement:i,className:s,style:o}=e,l=v(e,["prefixCls","placement","className","style"]),{getPrefixCls:u}=t.useContext(a.ConfigContext),c=u("popconfirm",r),[d]=p(c);return d(t.createElement(m.default,{placement:i,className:(0,n.default)(c,s),style:o,content:t.createElement(g,Object.assign({prefixCls:c},l))}))},e.s(["Popconfirm",0,b],883552)},664307,e=>{"use strict";var t=e.i(843476),r=e.i(135214),n=e.i(214541),i=e.i(271645),s=e.i(161059);e.s(["default",0,()=>{let{token:e,premiumUser:a}=(0,r.default)(),[o,l]=(0,i.useState)([]),{teams:u}=(0,n.default)();return(0,t.jsx)(s.default,{token:e,modelData:{data:[]},keys:o,setModelData:()=>{},premiumUser:a,teams:u})}])},601236,e=>{e.v(e=>Promise.resolve().then(()=>e(764205)))}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/082f482bd4c6ecfb.js b/litellm/proxy/_experimental/out/_next/static/chunks/082f482bd4c6ecfb.js deleted file mode 100644 index dd3e9f482f2..00000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/082f482bd4c6ecfb.js +++ /dev/null @@ -1,17 +0,0 @@ -(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,91500,124608,422233,235267,318059,953860,434788,512882,584976,e=>{"use strict";let t,s,r,a;e.i(247167);var n,i,o,l,c,d,u,m,p,h,f,g,y,x,b,v,w,_,j,S,N,k,E,C,T,A,P,O,R,I,M,L,$,U,D,B,q,z,F,W,H,J,G,V,K,X,Y,Q,Z,ee=e.i(931067),et=e.i(271645);let es={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M531.3 574.4l.3-1.4c5.8-23.9 13.1-53.7 7.4-80.7-3.8-21.3-19.5-29.6-32.9-30.2-15.8-.7-29.9 8.3-33.4 21.4-6.6 24-.7 56.8 10.1 98.6-13.6 32.4-35.3 79.5-51.2 107.5-29.6 15.3-69.3 38.9-75.2 68.7-1.2 5.5.2 12.5 3.5 18.8 3.7 7 9.6 12.4 16.5 15 3 1.1 6.6 2 10.8 2 17.6 0 46.1-14.2 84.1-79.4 5.8-1.9 11.8-3.9 17.6-5.9 27.2-9.2 55.4-18.8 80.9-23.1 28.2 15.1 60.3 24.8 82.1 24.8 21.6 0 30.1-12.8 33.3-20.5 5.6-13.5 2.9-30.5-6.2-39.6-13.2-13-45.3-16.4-95.3-10.2-24.6-15-40.7-35.4-52.4-65.8zM421.6 726.3c-13.9 20.2-24.4 30.3-30.1 34.7 6.7-12.3 19.8-25.3 30.1-34.7zm87.6-235.5c5.2 8.9 4.5 35.8.5 49.4-4.9-19.9-5.6-48.1-2.7-51.4.8.1 1.5.7 2.2 2zm-1.6 120.5c10.7 18.5 24.2 34.4 39.1 46.2-21.6 4.9-41.3 13-58.9 20.2-4.2 1.7-8.3 3.4-12.3 5 13.3-24.1 24.4-51.4 32.1-71.4zm155.6 65.5c.1.2.2.5-.4.9h-.2l-.2.3c-.8.5-9 5.3-44.3-8.6 40.6-1.9 45 7.3 45.1 7.4zm191.4-388.2L639.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-pdf",theme:"outlined"};var er=e.i(9583),ea=et.forwardRef(function(e,t){return et.createElement(er.default,(0,ee.default)({},e,{ref:t,icon:es}))});e.s(["FilePdfOutlined",0,ea],91500);let en={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M928 160H96c-17.7 0-32 14.3-32 32v640c0 17.7 14.3 32 32 32h832c17.7 0 32-14.3 32-32V192c0-17.7-14.3-32-32-32zm-40 632H136v-39.9l138.5-164.3 150.1 178L658.1 489 888 761.6V792zm0-129.8L664.2 396.8c-3.2-3.8-9-3.8-12.2 0L424.6 666.4l-144-170.7c-3.2-3.8-9-3.8-12.2 0L136 652.7V232h752v430.2zM304 456a88 88 0 100-176 88 88 0 000 176zm0-116c15.5 0 28 12.5 28 28s-12.5 28-28 28-28-12.5-28-28 12.5-28 28-28z"}}]},name:"picture",theme:"outlined"};var ei=et.forwardRef(function(e,t){return et.createElement(er.default,(0,ee.default)({},e,{ref:t,icon:en}))});e.s(["PictureOutlined",0,ei],124608);let eo="u">typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),el=new Uint8Array(16),ec=[];for(let e=0;e<256;++e)ec.push((e+256).toString(16).slice(1));let ed=function(e,s,r){if(eo&&!s&&!e)return eo();let a=(e=e||{}).random??e.rng?.()??function(){if(!t){if("u"= 16");if(a[6]=15&a[6]|64,a[8]=63&a[8]|128,s){if((r=r||0)<0||r+16>s.length)throw RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let e=0;e<16;++e)s[r+e]=a[e];return s}return function(e,t=0){return(ec[e[t+0]]+ec[e[t+1]]+ec[e[t+2]]+ec[e[t+3]]+"-"+ec[e[t+4]]+ec[e[t+5]]+"-"+ec[e[t+6]]+ec[e[t+7]]+"-"+ec[e[t+8]]+ec[e[t+9]]+"-"+ec[e[t+10]]+ec[e[t+11]]+ec[e[t+12]]+ec[e[t+13]]+ec[e[t+14]]+ec[e[t+15]]).toLowerCase()}(a)};e.s(["v4",0,ed],422233);var eu=e.i(843476),em=e.i(808613),ep=e.i(311451),eh=e.i(28651),ef=e.i(199133),eg=e.i(592968),ey=e.i(827252);function ex(e){if(!e)return[];if(Array.isArray(e))return e.map(e=>eb(e)).filter(e=>void 0!==e);let t=eb(e);return void 0!==t?[t]:[]}function eb(e,t){if(!e)return;let s=void 0!==t?t:e.default;if("object"===e.type){let t="object"!=typeof s||null===s||Array.isArray(s)?{}:{...s};return e.properties&&Object.entries(e.properties).forEach(([e,s])=>{t[e]=eb(s,t[e])}),t}if("array"===e.type){if(Array.isArray(s)){let t=e.items;if(!t)return s;if(0===s.length){let e=ex(t);return e.length?e:s}return Array.isArray(t)?s.map((e,s)=>eb(t[s]??t[t.length-1],e)):s.map(e=>eb(t,e))}return void 0!==s?s:ex(e.items)}if(void 0!==s)return s;switch(e.type){case"integer":case"number":return 0;case"boolean":return!1;default:return""}}let ev=e=>{let t=eb(e);if("object"===e.type||"array"===e.type){let s="array"===e.type?[]:{};return JSON.stringify(t??s,null,2)}return t},ew=(0,et.forwardRef)(({tool:e,className:t},s)=>{let[r]=em.Form.useForm(),a=(0,et.useMemo)(()=>"string"==typeof e.inputSchema?{type:"object",properties:{input:{type:"string",description:"Input for this tool"}},required:["input"]}:e.inputSchema,[e.inputSchema]),n=(0,et.useMemo)(()=>a.properties?.params?.type==="object"&&a.properties.params.properties?{type:"object",properties:a.properties.params.properties,required:a.properties.params.required||[]}:a,[a]);return((0,et.useImperativeHandle)(s,()=>({getSubmitValues:async()=>{var e;let t;return e=await r.validateFields(),t={},Object.entries(e).forEach(([e,s])=>{let r=n.properties?.[e];if(r&&null!=s&&""!==s)switch(r.type){case"boolean":t[e]="true"===s||!0===s;break;case"number":case"integer":{let a=Number(s);t[e]=Number.isNaN(a)?s:"integer"===r.type?Math.trunc(a):a;break}case"object":case"array":try{let a="string"==typeof s?JSON.parse(s):s,n="object"===r.type&&null!==a&&"object"==typeof a&&!Array.isArray(a),i="array"===r.type&&Array.isArray(a);"object"===r.type&&n||"array"===r.type&&i?t[e]=a:t[e]=s}catch{t[e]=s}break;case"string":t[e]=String(s);break;default:t[e]=s}else null!=s&&""!==s&&(t[e]=s)}),a.properties?.params?.type==="object"&&a.properties.params.properties?{params:t}:t}})),et.default.useEffect(()=>{if(r.resetFields(),!n.properties)return;let e={};Object.entries(n.properties).forEach(([t,s])=>{e[t]=ev(s)}),r.setFieldsValue(e)},[r,n,e]),"string"==typeof e.inputSchema)?(0,eu.jsx)(em.Form,{form:r,layout:"vertical",className:t,children:(0,eu.jsx)(em.Form.Item,{label:(0,eu.jsxs)("span",{className:"text-sm font-medium text-gray-700",children:["Input ",(0,eu.jsx)("span",{className:"text-red-500",children:"*"})]}),name:"input",rules:[{required:!0,message:"Please enter input for this tool"}],children:(0,eu.jsx)(ep.Input,{placeholder:"Enter input for this tool"})})}):n.properties?(0,eu.jsx)(em.Form,{form:r,layout:"vertical",className:t,children:Object.entries(n.properties).map(([t,s])=>{let r=ev(s),a=`${e.name}-${t}`;return(0,eu.jsx)(em.Form.Item,{label:(0,eu.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:[t," ",n.required?.includes(t)&&(0,eu.jsx)("span",{className:"text-red-500",children:"*"}),s.description&&(0,eu.jsx)(eg.Tooltip,{title:s.description,children:(0,eu.jsx)(ey.InfoCircleOutlined,{className:"ml-2 text-gray-400 hover:text-gray-600"})})]}),name:t,initialValue:r,rules:[{required:n.required?.includes(t),message:`Please enter ${t}`},..."object"===s.type||"array"===s.type?[{validator:(e,r)=>{if((null==r||""===r)&&!n.required?.includes(t))return Promise.resolve();try{let e="string"==typeof r?JSON.parse(r):r,t="object"===s.type&&null!==e&&"object"==typeof e&&!Array.isArray(e),a="array"===s.type&&Array.isArray(e);if("object"===s.type&&t||"array"===s.type&&a)return Promise.resolve();return Promise.reject(Error("object"===s.type?"Please enter a JSON object":"Please enter a JSON array"))}catch{return Promise.reject(Error("Invalid JSON"))}}}]:[]],children:"string"===s.type&&s.enum?(0,eu.jsx)(ef.Select,{placeholder:`Select ${t}`,allowClear:!n.required?.includes(t),options:s.enum.map(e=>({value:e,label:e}))}):"string"!==s.type||s.enum?"number"===s.type||"integer"===s.type?(0,eu.jsx)(eh.InputNumber,{step:"integer"===s.type?1:void 0,placeholder:s.description||`Enter ${t}`,className:"w-full",style:{width:"100%"}}):"boolean"===s.type?(0,eu.jsx)(ef.Select,{placeholder:`Select ${t}`,allowClear:!n.required?.includes(t),options:[{value:!0,label:"True"},{value:!1,label:"False"}]}):"object"===s.type||"array"===s.type?(0,eu.jsx)(ep.Input.TextArea,{rows:"object"===s.type?4:3,placeholder:s.description||("object"===s.type?`Enter JSON object for ${t}`:`Enter JSON array for ${t}`),spellCheck:!1,className:"font-mono"}):(0,eu.jsx)(ep.Input,{placeholder:s.description||`Enter ${t}`,allowClear:!0}):(0,eu.jsx)(ep.Input,{placeholder:s.description||`Enter ${t}`,allowClear:!0})},a)})}):(0,eu.jsx)(em.Form,{form:r,layout:"vertical",className:t,children:(0,eu.jsx)("div",{className:"py-4 text-center text-sm text-gray-500",children:"No parameters required for this tool."})})});ew.displayName="MCPToolArgumentsForm",e.s(["default",0,ew],235267);var e_=e.i(764205);e.s(["default",0,({onChange:e,value:t,className:s,accessToken:r})=>{let[a,n]=(0,et.useState)([]),[i,o]=(0,et.useState)(!1);return(0,et.useEffect)(()=>{(async()=>{if(r)try{let e=await (0,e_.tagListCall)(r);console.log("List tags response:",e),n(Object.values(e))}catch(e){console.error("Error fetching tags:",e)}finally{o(!1)}})()},[r]),(0,eu.jsx)(ef.Select,{mode:"tags",showSearch:!0,placeholder:"Select or create tags",onChange:e,value:t,loading:i,className:s,options:a.map(e=>({label:e.name,value:e.name,title:e.description||e.name})),optionFilterProp:"label",tokenSeparators:[","],maxTagCount:"responsive",allowClear:!0,style:{width:"100%"}})}],318059);let ej=e=>{if(!e)return;let t={};if(e.id&&(t.taskId=e.id),e.contextId&&(t.contextId=e.contextId),e.status&&(t.status={state:e.status.state,timestamp:e.status.timestamp},e.status.message?.parts)){let s=e.status.message.parts.filter(e=>"text"===e.kind&&e.text).map(e=>e.text).join(" ");s&&(t.status.message=s)}return e.metadata&&"object"==typeof e.metadata&&(t.metadata=e.metadata),Object.keys(t).length>0?t:void 0},eS=async(e,t,s,r,a,n,i,o,l,c)=>{let d=l||(0,e_.getProxyBaseUrl)(),u=d?`${d}/a2a/${e}/message/send`:`/a2a/${e}/message/send`,m={jsonrpc:"2.0",id:ed(),method:"message/send",params:{message:{kind:"message",messageId:ed().replace(/-/g,""),role:"user",parts:[{kind:"text",text:t}]}}};c&&c.length>0&&(m.params.metadata={guardrails:c});let p=performance.now();try{let t=await fetch(u,{method:"POST",headers:{[(0,e_.getGlobalLitellmHeaderName)()]:`Bearer ${r}`,"Content-Type":"application/json"},body:JSON.stringify(m),signal:a}),l=performance.now()-p;if(n&&n(l),!t.ok){let e=await t.json();throw Error(e.error?.message||e.detail||`HTTP ${t.status}`)}let c=await t.json(),d=performance.now()-p;if(i&&i(d),c.error)throw Error(c.error.message);let h=c.result;if(h){let t="",r=ej(h);if(r&&o&&o(r),h.artifacts&&Array.isArray(h.artifacts)){for(let e of h.artifacts)if(e.parts&&Array.isArray(e.parts))for(let s of e.parts)"text"===s.kind&&s.text&&(t+=s.text)}else if(h.parts&&Array.isArray(h.parts))for(let e of h.parts)"text"===e.kind&&e.text&&(t+=e.text);else if(h.status?.message?.parts)for(let e of h.status.message.parts)"text"===e.kind&&e.text&&(t+=e.text);t?s(t,`a2a_agent/${e}`):(console.warn("Could not extract text from A2A response, showing raw JSON:",h),s(JSON.stringify(h,null,2),`a2a_agent/${e}`))}}catch(e){if(a?.aborted)return void console.log("A2A request was cancelled");throw console.error("A2A send message error:",e),e}},eN=async(e,t,s,r,a,n,i,o,l)=>{let c,d=l||(0,e_.getProxyBaseUrl)(),u=d?`${d}/a2a/${e}`:`/a2a/${e}`,m=ed(),p=ed().replace(/-/g,""),h=performance.now(),f=!1,g="";try{let l=await fetch(u,{method:"POST",headers:{[(0,e_.getGlobalLitellmHeaderName)()]:`Bearer ${r}`,"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",id:m,method:"message/stream",params:{message:{kind:"message",messageId:p,role:"user",parts:[{kind:"text",text:t}]}}}),signal:a});if(!l.ok){let e=await l.json();throw Error(e.error?.message||e.detail||`HTTP ${l.status}`)}let d=l.body?.getReader();if(!d)throw Error("No response body");let y=new TextDecoder,x="",b=!1;for(;!b;){let t=await d.read();b=t.done;let r=t.value;if(b)break;let a=(x+=y.decode(r,{stream:!0})).split("\n");for(let t of(x=a.pop()||"",a))if(t.trim())try{let r=JSON.parse(t);if(!f){f=!0;let e=performance.now()-h;n&&n(e)}let a=r.result;if(a){let t=ej(a);t&&(c={...c,...t});let r=a.kind;if("artifact-update"===r&&a.artifact){let t=a.artifact;if(t.parts&&Array.isArray(t.parts))for(let r of t.parts)"text"===r.kind&&r.text&&(g+=r.text,s(g,`a2a_agent/${e}`))}else if(a.artifacts&&Array.isArray(a.artifacts)){for(let t of a.artifacts)if(t.parts&&Array.isArray(t.parts))for(let r of t.parts)"text"===r.kind&&r.text&&(g+=r.text,s(g,`a2a_agent/${e}`))}else if("status-update"===r);else if(a.parts&&Array.isArray(a.parts))for(let t of a.parts)"text"===t.kind&&t.text&&(g+=t.text,s(g,`a2a_agent/${e}`))}if(r.error){let e=r.error.message||"Unknown A2A error";throw Error(e)}}catch(e){if(e instanceof Error&&e.message&&!e.message.includes("JSON"))throw e;t.trim().length>0&&console.warn("Failed to parse A2A streaming chunk:",t,e)}}let v=performance.now()-h;i&&i(v),c&&o&&o(c)}catch(e){if(a?.aborted)return void console.log("A2A streaming request was cancelled");throw console.error("A2A stream message error:",e),e}};function ek(e,t,s,r,a){if("m"===r)throw TypeError("Private method is not writable");if("a"===r&&!a)throw TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?a.call(e,s):a?a.value=s:t.set(e,s),s}function eE(e,t,s,r){if("a"===s&&!r)throw TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?r:"a"===s?r.call(e):r?r.value:t.get(e)}e.s(["makeA2ASendMessageRequest",0,eS,"makeA2AStreamMessageRequest",0,eN],953860);let eC=function(){let{crypto:e}=globalThis;if(e?.randomUUID)return eC=e.randomUUID.bind(e),e.randomUUID();let t=new Uint8Array(1),s=e?()=>e.getRandomValues(t)[0]:()=>255*Math.random()&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,e=>(e^s()&15>>e/4).toString(16))};function eT(e){return"object"==typeof e&&null!==e&&("name"in e&&"AbortError"===e.name||"message"in e&&String(e.message).includes("FetchRequestCanceledException"))}let eA=e=>{if(e instanceof Error)return e;if("object"==typeof e&&null!==e){try{if("[object Error]"===Object.prototype.toString.call(e)){let t=Error(e.message,e.cause?{cause:e.cause}:{});return e.stack&&(t.stack=e.stack),e.cause&&!t.cause&&(t.cause=e.cause),e.name&&(t.name=e.name),t}}catch{}try{return Error(JSON.stringify(e))}catch{}}return Error(e)};class eP extends Error{}class eO extends eP{constructor(e,t,s,r){super(`${eO.makeMessage(e,t,s)}`),this.status=e,this.headers=r,this.requestID=r?.get("request-id"),this.error=t}static makeMessage(e,t,s){let r=t?.message?"string"==typeof t.message?t.message:JSON.stringify(t.message):t?JSON.stringify(t):s;return e&&r?`${e} ${r}`:e?`${e} status code (no body)`:r||"(no status code or body)"}static generate(e,t,s,r){return e&&r?400===e?new eL(e,t,s,r):401===e?new e$(e,t,s,r):403===e?new eU(e,t,s,r):404===e?new eD(e,t,s,r):409===e?new eB(e,t,s,r):422===e?new eq(e,t,s,r):429===e?new ez(e,t,s,r):e>=500?new eF(e,t,s,r):new eO(e,t,s,r):new eI({message:s,cause:eA(t)})}}class eR extends eO{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}}class eI extends eO{constructor({message:e,cause:t}){super(void 0,void 0,e||"Connection error.",void 0),t&&(this.cause=t)}}class eM extends eI{constructor({message:e}={}){super({message:e??"Request timed out."})}}class eL extends eO{}class e$ extends eO{}class eU extends eO{}class eD extends eO{}class eB extends eO{}class eq extends eO{}class ez extends eO{}class eF extends eO{}let eW=/^[a-z][a-z0-9+.-]*:/i;function eH(e){return"object"!=typeof e?{}:e??{}}let eJ=e=>{try{return JSON.parse(e)}catch(e){return}},eG={off:0,error:200,warn:300,info:400,debug:500},eV=(e,t,s)=>{if(e){if(Object.prototype.hasOwnProperty.call(eG,e))return e;eZ(s).warn(`${t} was set to ${JSON.stringify(e)}, expected one of ${JSON.stringify(Object.keys(eG))}`)}};function eK(){}function eX(e,t,s){return!t||eG[e]>eG[s]?eK:t[e].bind(t)}let eY={error:eK,warn:eK,info:eK,debug:eK},eQ=new WeakMap;function eZ(e){let t=e.logger,s=e.logLevel??"off";if(!t)return eY;let r=eQ.get(t);if(r&&r[0]===s)return r[1];let a={error:eX("error",t,s),warn:eX("warn",t,s),info:eX("info",t,s),debug:eX("debug",t,s)};return eQ.set(t,[s,a]),a}let e0=e=>(e.options&&(e.options={...e.options},delete e.options.headers),e.headers&&(e.headers=Object.fromEntries((e.headers instanceof Headers?[...e.headers]:Object.entries(e.headers)).map(([e,t])=>[e,"x-api-key"===e.toLowerCase()||"authorization"===e.toLowerCase()||"cookie"===e.toLowerCase()||"set-cookie"===e.toLowerCase()?"***":t]))),"retryOfRequestLogID"in e&&(e.retryOfRequestLogID&&(e.retryOf=e.retryOfRequestLogID),delete e.retryOfRequestLogID),e),e1="0.54.0",e2=e=>"x32"===e?"x32":"x86_64"===e||"x64"===e?"x64":"arm"===e?"arm":"aarch64"===e||"arm64"===e?"arm64":e?`other:${e}`:"unknown",e4=e=>(e=e.toLowerCase()).includes("ios")?"iOS":"android"===e?"Android":"darwin"===e?"MacOS":"win32"===e?"Windows":"freebsd"===e?"FreeBSD":"openbsd"===e?"OpenBSD":"linux"===e?"Linux":e?`Other:${e}`:"Unknown";function e3(...e){let t=globalThis.ReadableStream;if(void 0===t)throw Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new t(...e)}function e5(e){let t=Symbol.asyncIterator in e?e[Symbol.asyncIterator]():e[Symbol.iterator]();return e3({start(){},async pull(e){let{done:s,value:r}=await t.next();s?e.close():e.enqueue(r)},async cancel(){await t.return?.()}})}function e6(e){if(e[Symbol.asyncIterator])return e;let t=e.getReader();return{async next(){try{let e=await t.read();return e?.done&&t.releaseLock(),e}catch(e){throw t.releaseLock(),e}},async return(){let e=t.cancel();return t.releaseLock(),await e,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function e8(e){if(null===e||"object"!=typeof e)return;if(e[Symbol.asyncIterator])return void await e[Symbol.asyncIterator]().return?.();let t=e.getReader(),s=t.cancel();t.releaseLock(),await s}let e7=({headers:e,body:t})=>({bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(t)});function e9(e){let t;return(r??(r=(t=new globalThis.TextEncoder).encode.bind(t)))(e)}function te(e){let t;return(a??(a=(t=new globalThis.TextDecoder).decode.bind(t)))(e)}class tt{constructor(){n.set(this,void 0),i.set(this,void 0),ek(this,n,new Uint8Array,"f"),ek(this,i,null,"f")}decode(e){let t;if(null==e)return[];let s=e instanceof ArrayBuffer?new Uint8Array(e):"string"==typeof e?e9(e):e;ek(this,n,function(e){let t=0;for(let s of e)t+=s.length;let s=new Uint8Array(t),r=0;for(let t of e)s.set(t,r),r+=t.length;return s}([eE(this,n,"f"),s]),"f");let r=[];for(;null!=(t=function(e,t){for(let s=t??0;s({next:()=>{if(0===r.length){let r=s.next();e.push(r),t.push(r)}return r.shift()}});return[new ts(()=>r(e),this.controller),new ts(()=>r(t),this.controller)]}toReadableStream(){let e,t=this;return e3({async start(){e=t[Symbol.asyncIterator]()},async pull(t){try{let{value:s,done:r}=await e.next();if(r)return t.close();let a=e9(JSON.stringify(s)+"\n");t.enqueue(a)}catch(e){t.error(e)}},async cancel(){await e.return?.()}})}}async function*tr(e,t){if(!e.body){if(t.abort(),void 0!==globalThis.navigator&&"ReactNative"===globalThis.navigator.product)throw new eP("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api");throw new eP("Attempted to iterate over a response with no body")}let s=new tn,r=new tt;for await(let t of ta(e6(e.body)))for(let e of r.decode(t)){let t=s.decode(e);t&&(yield t)}for(let e of r.flush()){let t=s.decode(e);t&&(yield t)}}async function*ta(e){let t=new Uint8Array;for await(let s of e){let e;if(null==s)continue;let r=s instanceof ArrayBuffer?new Uint8Array(s):"string"==typeof s?e9(s):s,a=new Uint8Array(t.length+r.length);for(a.set(t),a.set(r,t.length),t=a;-1!==(e=function(e){for(let t=0;t0&&(yield t)}class tn{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(e){var t;let s;if(e.endsWith("\r")&&(e=e.substring(0,e.length-1)),!e){if(!this.event&&!this.data.length)return null;let e={event:this.event,data:this.data.join("\n"),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],e}if(this.chunks.push(e),e.startsWith(":"))return null;let[r,a,n]=-1!==(s=(t=e).indexOf(":"))?[t.substring(0,s),":",t.substring(s+1)]:[t,"",""];return n.startsWith(" ")&&(n=n.substring(1)),"event"===r?this.event=n:"data"===r&&this.data.push(n),null}}async function ti(e,t){let{response:s,requestLogID:r,retryOfRequestLogID:a,startTime:n}=t,i=await (async()=>{if(t.options.stream)return(eZ(e).debug("response",s.status,s.url,s.headers,s.body),t.options.__streamClass)?t.options.__streamClass.fromSSEResponse(s,t.controller):ts.fromSSEResponse(s,t.controller);if(204===s.status)return null;if(t.options.__binaryResponse)return s;let r=s.headers.get("content-type"),a=r?.split(";")[0]?.trim();return a?.includes("application/json")||a?.endsWith("+json")?to(await s.json(),s):await s.text()})();return eZ(e).debug(`[${r}] response parsed`,e0({retryOfRequestLogID:a,url:s.url,status:s.status,body:i,durationMs:Date.now()-n})),i}function to(e,t){return!e||"object"!=typeof e||Array.isArray(e)?e:Object.defineProperty(e,"_request_id",{value:t.headers.get("request-id"),enumerable:!1})}class tl extends Promise{constructor(e,t,s=ti){super(e=>{e(null)}),this.responsePromise=t,this.parseResponse=s,o.set(this,void 0),ek(this,o,e,"f")}_thenUnwrap(e){return new tl(eE(this,o,"f"),this.responsePromise,async(t,s)=>to(e(await this.parseResponse(t,s),s),s.response))}asResponse(){return this.responsePromise.then(e=>e.response)}async withResponse(){let[e,t]=await Promise.all([this.parse(),this.asResponse()]);return{data:e,response:t,request_id:t.headers.get("request-id")}}parse(){return this.parsedPromise||(this.parsedPromise=this.responsePromise.then(e=>this.parseResponse(eE(this,o,"f"),e))),this.parsedPromise}then(e,t){return this.parse().then(e,t)}catch(e){return this.parse().catch(e)}finally(e){return this.parse().finally(e)}}o=new WeakMap;class tc{constructor(e,t,s,r){l.set(this,void 0),ek(this,l,e,"f"),this.options=r,this.response=t,this.body=s}hasNextPage(){return!!this.getPaginatedItems().length&&null!=this.nextPageRequestOptions()}async getNextPage(){let e=this.nextPageRequestOptions();if(!e)throw new eP("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");return await eE(this,l,"f").requestAPIList(this.constructor,e)}async *iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async *[(l=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let t of e.getPaginatedItems())yield t}}class td extends tl{constructor(e,t,s){super(e,t,async(e,t)=>new s(e,t.response,await ti(e,t),t.options))}async *[Symbol.asyncIterator](){for await(let e of(await this))yield e}}class tu extends tc{constructor(e,t,s,r){super(e,t,s,r),this.data=s.data||[],this.has_more=s.has_more||!1,this.first_id=s.first_id||null,this.last_id=s.last_id||null}getPaginatedItems(){return this.data??[]}hasNextPage(){return!1!==this.has_more&&super.hasNextPage()}nextPageRequestOptions(){if(this.options.query?.before_id){let e=this.first_id;return e?{...this.options,query:{...eH(this.options.query),before_id:e}}:null}let e=this.last_id;return e?{...this.options,query:{...eH(this.options.query),after_id:e}}:null}}let tm=()=>{if("u"parseInt(e.versions.node.split("."))?" Update to Node 20 LTS or newer, or set `globalThis.File` to `import('node:buffer').File`.":""))}};function tp(e,t,s){return tm(),new File(e,t??"unknown_file",s)}function th(e){return("object"==typeof e&&null!==e&&("name"in e&&e.name&&String(e.name)||"url"in e&&e.url&&String(e.url)||"filename"in e&&e.filename&&String(e.filename)||"path"in e&&e.path&&String(e.path))||"").split(/[\\/]/).pop()||void 0}let tf=e=>null!=e&&"object"==typeof e&&"function"==typeof e[Symbol.asyncIterator],tg=async(e,t)=>({...e,body:await tx(e.body,t)}),ty=new WeakMap,tx=async(e,t)=>{if(!await function(e){let t="function"==typeof e?e:e.fetch,s=ty.get(t);if(s)return s;let r=(async()=>{try{let e="Response"in t?t.Response:(await t("data:,")).constructor,s=new FormData;if(s.toString()===await new e(s).text())return!1;return!0}catch{return!0}})();return ty.set(t,r),r}(t))throw TypeError("The provided fetch function does not support file uploads with the current global FormData class.");let s=new FormData;return await Promise.all(Object.entries(e||{}).map(([e,t])=>tb(s,e,t))),s},tb=async(e,t,s)=>{if(void 0!==s){if(null==s)throw TypeError(`Received null for "${t}"; to pass null in FormData, you must use the string 'null'`);if("string"==typeof s||"number"==typeof s||"boolean"==typeof s)e.append(t,String(s));else if(s instanceof Response){let r={},a=s.headers.get("Content-Type");a&&(r={type:a}),e.append(t,tp([await s.blob()],th(s),r))}else if(tf(s))e.append(t,tp([await new Response(e5(s)).blob()],th(s)));else{let r;if((r=s)instanceof Blob&&"name"in r)e.append(t,tp([s],th(s),{type:s.type}));else if(Array.isArray(s))await Promise.all(s.map(s=>tb(e,t+"[]",s)));else if("object"==typeof s)await Promise.all(Object.entries(s).map(([s,r])=>tb(e,`${t}[${s}]`,r)));else throw TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${s} instead`)}}},tv=e=>null!=e&&"object"==typeof e&&"number"==typeof e.size&&"string"==typeof e.type&&"function"==typeof e.text&&"function"==typeof e.slice&&"function"==typeof e.arrayBuffer;async function tw(e,t,s){let r,a;if(tm(),e=await e,t||(t=th(e)),null!=(r=e)&&"object"==typeof r&&"string"==typeof r.name&&"number"==typeof r.lastModified&&tv(r))return e instanceof File&&null==t&&null==s?e:tp([await e.arrayBuffer()],t??e.name,{type:e.type,lastModified:e.lastModified,...s});if(null!=(a=e)&&"object"==typeof a&&"string"==typeof a.url&&"function"==typeof a.blob){let r=await e.blob();return t||(t=new URL(e.url).pathname.split(/[\\/]/).pop()),tp(await t_(r),t,s)}let n=await t_(e);if(!s?.type){let e=n.find(e=>"object"==typeof e&&"type"in e&&e.type);"string"==typeof e&&(s={...s,type:e})}return tp(n,t,s)}async function t_(e){let t=[];if("string"==typeof e||ArrayBuffer.isView(e)||e instanceof ArrayBuffer)t.push(e);else if(tv(e))t.push(e instanceof Blob?e:await e.arrayBuffer());else if(tf(e))for await(let s of e)t.push(...await t_(s));else{let t=e?.constructor?.name;throw Error(`Unexpected data type: ${typeof e}${t?`; constructor: ${t}`:""}${function(e){if("object"!=typeof e||null===e)return"";let t=Object.getOwnPropertyNames(e);return`; props: [${t.map(e=>`"${e}"`).join(", ")}]`}(e)}`)}return t}class tj{constructor(e){this._client=e}}let tS=Symbol.for("brand.privateNullableHeaders"),tN=Array.isArray,tk=e=>{let t=new Headers,s=new Set;for(let r of e){let e=new Set;for(let[a,n]of function*(e){let t;if(!e)return;if(tS in e){let{values:t,nulls:s}=e;for(let e of(yield*t.entries(),s))yield[e,null];return}let s=!1;for(let r of(e instanceof Headers?t=e.entries():tN(e)?t=e:(s=!0,t=Object.entries(e??{})),t)){let e=r[0];if("string"!=typeof e)throw TypeError("expected header name to be a string");let t=tN(r[1])?r[1]:[r[1]],a=!1;for(let r of t)void 0!==r&&(s&&!a&&(a=!0,yield[e,null]),yield[e,r])}}(r)){let r=a.toLowerCase();e.has(r)||(t.delete(a),e.add(r)),null===n?(t.delete(a),s.add(r)):(t.append(a,n),s.delete(r))}}return{[tS]:!0,values:t,nulls:s}};function tE(e){return e.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}let tC=((e=tE)=>function(t,...s){let r;if(1===t.length)return t[0];let a=!1,n=t.reduce((t,r,n)=>(/[?#]/.test(r)&&(a=!0),t+r+(n===s.length?"":(a?encodeURIComponent:e)(String(s[n])))),""),i=n.split(/[?#]/,1)[0],o=[],l=/(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi;for(;null!==(r=l.exec(i));)o.push({start:r.index,length:r[0].length});if(o.length>0){let e=0,t=o.reduce((t,s)=>{let r=" ".repeat(s.start-e),a="^".repeat(s.length);return e=s.start+s.length,t+r+a},"");throw new eP(`Path parameters result in path with invalid segments: -${n} -${t}`)}return n})(tE);class tT extends tj{list(e={},t){let{betas:s,...r}=e??{};return this._client.getAPIList("/v1/files",tu,{query:r,...t,headers:tk([{"anthropic-beta":[...s??[],"files-api-2025-04-14"].toString()},t?.headers])})}delete(e,t={},s){let{betas:r}=t??{};return this._client.delete(tC`/v1/files/${e}`,{...s,headers:tk([{"anthropic-beta":[...r??[],"files-api-2025-04-14"].toString()},s?.headers])})}download(e,t={},s){let{betas:r}=t??{};return this._client.get(tC`/v1/files/${e}/content`,{...s,headers:tk([{"anthropic-beta":[...r??[],"files-api-2025-04-14"].toString(),Accept:"application/binary"},s?.headers]),__binaryResponse:!0})}retrieveMetadata(e,t={},s){let{betas:r}=t??{};return this._client.get(tC`/v1/files/${e}`,{...s,headers:tk([{"anthropic-beta":[...r??[],"files-api-2025-04-14"].toString()},s?.headers])})}upload(e,t){let{betas:s,...r}=e;return this._client.post("/v1/files",tg({body:r,...t,headers:tk([{"anthropic-beta":[...s??[],"files-api-2025-04-14"].toString()},t?.headers])},this._client))}}class tA extends tj{retrieve(e,t={},s){let{betas:r}=t??{};return this._client.get(tC`/v1/models/${e}?beta=true`,{...s,headers:tk([{...r?.toString()!=null?{"anthropic-beta":r?.toString()}:void 0},s?.headers])})}list(e={},t){let{betas:s,...r}=e??{};return this._client.getAPIList("/v1/models?beta=true",tu,{query:r,...t,headers:tk([{...s?.toString()!=null?{"anthropic-beta":s?.toString()}:void 0},t?.headers])})}}class tP{constructor(e,t){this.iterator=e,this.controller=t}async *decoder(){let e=new tt;for await(let t of this.iterator)for(let s of e.decode(t))yield JSON.parse(s);for(let t of e.flush())yield JSON.parse(t)}[Symbol.asyncIterator](){return this.decoder()}static fromResponse(e,t){if(!e.body){if(t.abort(),void 0!==globalThis.navigator&&"ReactNative"===globalThis.navigator.product)throw new eP("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api");throw new eP("Attempted to iterate over a response with no body")}return new tP(e6(e.body),t)}}class tO extends tj{create(e,t){let{betas:s,...r}=e;return this._client.post("/v1/messages/batches?beta=true",{body:r,...t,headers:tk([{"anthropic-beta":[...s??[],"message-batches-2024-09-24"].toString()},t?.headers])})}retrieve(e,t={},s){let{betas:r}=t??{};return this._client.get(tC`/v1/messages/batches/${e}?beta=true`,{...s,headers:tk([{"anthropic-beta":[...r??[],"message-batches-2024-09-24"].toString()},s?.headers])})}list(e={},t){let{betas:s,...r}=e??{};return this._client.getAPIList("/v1/messages/batches?beta=true",tu,{query:r,...t,headers:tk([{"anthropic-beta":[...s??[],"message-batches-2024-09-24"].toString()},t?.headers])})}delete(e,t={},s){let{betas:r}=t??{};return this._client.delete(tC`/v1/messages/batches/${e}?beta=true`,{...s,headers:tk([{"anthropic-beta":[...r??[],"message-batches-2024-09-24"].toString()},s?.headers])})}cancel(e,t={},s){let{betas:r}=t??{};return this._client.post(tC`/v1/messages/batches/${e}/cancel?beta=true`,{...s,headers:tk([{"anthropic-beta":[...r??[],"message-batches-2024-09-24"].toString()},s?.headers])})}async results(e,t={},s){let r=await this.retrieve(e);if(!r.results_url)throw new eP(`No batch \`results_url\`; Has it finished processing? ${r.processing_status} - ${r.id}`);let{betas:a}=t??{};return this._client.get(r.results_url,{...s,headers:tk([{"anthropic-beta":[...a??[],"message-batches-2024-09-24"].toString(),Accept:"application/binary"},s?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((e,t)=>tP.fromResponse(t.response,t.controller))}}let tR=e=>{if(0===e.length)return e;let t=e[e.length-1];switch(t.type){case"separator":return tR(e=e.slice(0,e.length-1));case"number":let s=t.value[t.value.length-1];if("."===s||"-"===s)return tR(e=e.slice(0,e.length-1));case"string":let r=e[e.length-2];if(r?.type==="delimiter"||r?.type==="brace"&&"{"===r.value)return tR(e=e.slice(0,e.length-1));break;case"delimiter":return tR(e=e.slice(0,e.length-1))}return e},tI=e=>{var t;let s,r;return JSON.parse((t=tR((e=>{let t=0,s=[];for(;t{"brace"===e.type&&("{"===e.value?s.push("}"):s.splice(s.lastIndexOf("}"),1)),"paren"===e.type&&("["===e.value?s.push("]"):s.splice(s.lastIndexOf("]"),1))}),s.length>0&&s.reverse().map(e=>{"}"===e?t.push({type:"brace",value:"}"}):"]"===e&&t.push({type:"paren",value:"]"})}),r="",t.map(e=>{"string"===e.type?r+='"'+e.value+'"':r+=e.value}),r))},tM="__json_buf";function tL(e){return"tool_use"===e.type||"server_tool_use"===e.type||"mcp_tool_use"===e.type}class t${constructor(){c.add(this),this.messages=[],this.receivedMessages=[],d.set(this,void 0),this.controller=new AbortController,u.set(this,void 0),m.set(this,()=>{}),p.set(this,()=>{}),h.set(this,void 0),f.set(this,()=>{}),g.set(this,()=>{}),y.set(this,{}),x.set(this,!1),b.set(this,!1),v.set(this,!1),w.set(this,!1),_.set(this,void 0),j.set(this,void 0),k.set(this,e=>{if(ek(this,b,!0,"f"),eT(e)&&(e=new eR),e instanceof eR)return ek(this,v,!0,"f"),this._emit("abort",e);if(e instanceof eP)return this._emit("error",e);if(e instanceof Error){let t=new eP(e.message);return t.cause=e,this._emit("error",t)}return this._emit("error",new eP(String(e)))}),ek(this,u,new Promise((e,t)=>{ek(this,m,e,"f"),ek(this,p,t,"f")}),"f"),ek(this,h,new Promise((e,t)=>{ek(this,f,e,"f"),ek(this,g,t,"f")}),"f"),eE(this,u,"f").catch(()=>{}),eE(this,h,"f").catch(()=>{})}get response(){return eE(this,_,"f")}get request_id(){return eE(this,j,"f")}async withResponse(){let e=await eE(this,u,"f");if(!e)throw Error("Could not resolve a `Response` object");return{data:this,response:e,request_id:e.headers.get("request-id")}}static fromReadableStream(e){let t=new t$;return t._run(()=>t._fromReadableStream(e)),t}static createMessage(e,t,s){let r=new t$;for(let e of t.messages)r._addMessageParam(e);return r._run(()=>r._createMessage(e,{...t,stream:!0},{...s,headers:{...s?.headers,"X-Stainless-Helper-Method":"stream"}})),r}_run(e){e().then(()=>{this._emitFinal(),this._emit("end")},eE(this,k,"f"))}_addMessageParam(e){this.messages.push(e)}_addMessage(e,t=!0){this.receivedMessages.push(e),t&&this._emit("message",e)}async _createMessage(e,t,s){let r=s?.signal;r&&(r.aborted&&this.controller.abort(),r.addEventListener("abort",()=>this.controller.abort())),eE(this,c,"m",E).call(this);let{response:a,data:n}=await e.create({...t,stream:!0},{...s,signal:this.controller.signal}).withResponse();for await(let e of(this._connected(a),n))eE(this,c,"m",C).call(this,e);if(n.controller.signal?.aborted)throw new eR;eE(this,c,"m",T).call(this)}_connected(e){this.ended||(ek(this,_,e,"f"),ek(this,j,e?.headers.get("request-id"),"f"),eE(this,m,"f").call(this,e),this._emit("connect"))}get ended(){return eE(this,x,"f")}get errored(){return eE(this,b,"f")}get aborted(){return eE(this,v,"f")}abort(){this.controller.abort()}on(e,t){return(eE(this,y,"f")[e]||(eE(this,y,"f")[e]=[])).push({listener:t}),this}off(e,t){let s=eE(this,y,"f")[e];if(!s)return this;let r=s.findIndex(e=>e.listener===t);return r>=0&&s.splice(r,1),this}once(e,t){return(eE(this,y,"f")[e]||(eE(this,y,"f")[e]=[])).push({listener:t,once:!0}),this}emitted(e){return new Promise((t,s)=>{ek(this,w,!0,"f"),"error"!==e&&this.once("error",s),this.once(e,t)})}async done(){ek(this,w,!0,"f"),await eE(this,h,"f")}get currentMessage(){return eE(this,d,"f")}async finalMessage(){return await this.done(),eE(this,c,"m",S).call(this)}async finalText(){return await this.done(),eE(this,c,"m",N).call(this)}_emit(e,...t){if(eE(this,x,"f"))return;"end"===e&&(ek(this,x,!0,"f"),eE(this,f,"f").call(this));let s=eE(this,y,"f")[e];if(s&&(eE(this,y,"f")[e]=s.filter(e=>!e.once),s.forEach(({listener:e})=>e(...t))),"abort"===e){let e=t[0];eE(this,w,"f")||s?.length||Promise.reject(e),eE(this,p,"f").call(this,e),eE(this,g,"f").call(this,e),this._emit("end");return}if("error"===e){let e=t[0];eE(this,w,"f")||s?.length||Promise.reject(e),eE(this,p,"f").call(this,e),eE(this,g,"f").call(this,e),this._emit("end")}}_emitFinal(){this.receivedMessages.at(-1)&&this._emit("finalMessage",eE(this,c,"m",S).call(this))}async _fromReadableStream(e,t){let s=t?.signal;s&&(s.aborted&&this.controller.abort(),s.addEventListener("abort",()=>this.controller.abort())),eE(this,c,"m",E).call(this),this._connected(null);let r=ts.fromReadableStream(e,this.controller);for await(let e of r)eE(this,c,"m",C).call(this,e);if(r.controller.signal?.aborted)throw new eR;eE(this,c,"m",T).call(this)}[(d=new WeakMap,u=new WeakMap,m=new WeakMap,p=new WeakMap,h=new WeakMap,f=new WeakMap,g=new WeakMap,y=new WeakMap,x=new WeakMap,b=new WeakMap,v=new WeakMap,w=new WeakMap,_=new WeakMap,j=new WeakMap,k=new WeakMap,c=new WeakSet,S=function(){if(0===this.receivedMessages.length)throw new eP("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},N=function(){if(0===this.receivedMessages.length)throw new eP("stream ended without producing a Message with role=assistant");let e=this.receivedMessages.at(-1).content.filter(e=>"text"===e.type).map(e=>e.text);if(0===e.length)throw new eP("stream ended without producing a content block with type=text");return e.join(" ")},E=function(){this.ended||ek(this,d,void 0,"f")},C=function(e){if(this.ended)return;let t=eE(this,c,"m",A).call(this,e);switch(this._emit("streamEvent",e,t),e.type){case"content_block_delta":{let s=t.content.at(-1);switch(e.delta.type){case"text_delta":"text"===s.type&&this._emit("text",e.delta.text,s.text||"");break;case"citations_delta":"text"===s.type&&this._emit("citation",e.delta.citation,s.citations??[]);break;case"input_json_delta":tL(s)&&s.input&&this._emit("inputJson",e.delta.partial_json,s.input);break;case"thinking_delta":"thinking"===s.type&&this._emit("thinking",e.delta.thinking,s.thinking);break;case"signature_delta":"thinking"===s.type&&this._emit("signature",s.signature);break;default:tU(e.delta)}break}case"message_stop":this._addMessageParam(t),this._addMessage(t,!0);break;case"content_block_stop":this._emit("contentBlock",t.content.at(-1));break;case"message_start":ek(this,d,t,"f")}},T=function(){if(this.ended)throw new eP("stream has ended, this shouldn't happen");let e=eE(this,d,"f");if(!e)throw new eP("request ended without sending any chunks");return ek(this,d,void 0,"f"),e},A=function(e){let t=eE(this,d,"f");if("message_start"===e.type){if(t)throw new eP(`Unexpected event order, got ${e.type} before receiving "message_stop"`);return e.message}if(!t)throw new eP(`Unexpected event order, got ${e.type} before "message_start"`);switch(e.type){case"message_stop":case"content_block_stop":return t;case"message_delta":return t.container=e.delta.container,t.stop_reason=e.delta.stop_reason,t.stop_sequence=e.delta.stop_sequence,t.usage.output_tokens=e.usage.output_tokens,null!=e.usage.input_tokens&&(t.usage.input_tokens=e.usage.input_tokens),null!=e.usage.cache_creation_input_tokens&&(t.usage.cache_creation_input_tokens=e.usage.cache_creation_input_tokens),null!=e.usage.cache_read_input_tokens&&(t.usage.cache_read_input_tokens=e.usage.cache_read_input_tokens),null!=e.usage.server_tool_use&&(t.usage.server_tool_use=e.usage.server_tool_use),t;case"content_block_start":return t.content.push(e.content_block),t;case"content_block_delta":{let s=t.content.at(e.index);switch(e.delta.type){case"text_delta":s?.type==="text"&&(s.text+=e.delta.text);break;case"citations_delta":s?.type==="text"&&(s.citations??(s.citations=[]),s.citations.push(e.delta.citation));break;case"input_json_delta":if(s&&tL(s)){let t=s[tM]||"";if(Object.defineProperty(s,tM,{value:t+=e.delta.partial_json,enumerable:!1,writable:!0}),t)try{s.input=tI(t)}catch(s){let e=new eP(`Unable to parse tool parameter JSON from model. Please retry your request or adjust your prompt. Error: ${s}. JSON: ${t}`);eE(this,k,"f").call(this,e)}}break;case"thinking_delta":s?.type==="thinking"&&(s.thinking+=e.delta.thinking);break;case"signature_delta":s?.type==="thinking"&&(s.signature=e.delta.signature);break;default:tU(e.delta)}return t}}},Symbol.asyncIterator)](){let e=[],t=[],s=!1;return this.on("streamEvent",s=>{let r=t.shift();r?r.resolve(s):e.push(s)}),this.on("end",()=>{for(let e of(s=!0,t))e.resolve(void 0);t.length=0}),this.on("abort",e=>{for(let r of(s=!0,t))r.reject(e);t.length=0}),this.on("error",e=>{for(let r of(s=!0,t))r.reject(e);t.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:s?{value:void 0,done:!0}:new Promise((e,s)=>t.push({resolve:e,reject:s})).then(e=>e?{value:e,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}toReadableStream(){return new ts(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}function tU(e){}let tD={"claude-opus-4-20250514":8192,"claude-opus-4-0":8192,"claude-4-opus-20250514":8192,"anthropic.claude-opus-4-20250514-v1:0":8192,"claude-opus-4@20250514":8192},tB={"claude-1.3":"November 6th, 2024","claude-1.3-100k":"November 6th, 2024","claude-instant-1.1":"November 6th, 2024","claude-instant-1.1-100k":"November 6th, 2024","claude-instant-1.2":"November 6th, 2024","claude-3-sonnet-20240229":"July 21st, 2025","claude-2.1":"July 21st, 2025","claude-2.0":"July 21st, 2025"};class tq extends tj{constructor(){super(...arguments),this.batches=new tO(this._client)}create(e,t){let{betas:s,...r}=e;r.model in tB&&console.warn(`The model '${r.model}' is deprecated and will reach end-of-life on ${tB[r.model]} -Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);let a=this._client._options.timeout;if(!r.stream&&null==a){let e=tD[r.model]??void 0;a=this._client.calculateNonstreamingTimeout(r.max_tokens,e)}return this._client.post("/v1/messages?beta=true",{body:r,timeout:a??6e5,...t,headers:tk([{...s?.toString()!=null?{"anthropic-beta":s?.toString()}:void 0},t?.headers]),stream:e.stream??!1})}stream(e,t){return t$.createMessage(this,e,t)}countTokens(e,t){let{betas:s,...r}=e;return this._client.post("/v1/messages/count_tokens?beta=true",{body:r,...t,headers:tk([{"anthropic-beta":[...s??[],"token-counting-2024-11-01"].toString()},t?.headers])})}}tq.Batches=tO;class tz extends tj{constructor(){super(...arguments),this.models=new tA(this._client),this.messages=new tq(this._client),this.files=new tT(this._client)}}tz.Models=tA,tz.Messages=tq,tz.Files=tT;class tF extends tj{create(e,t){let{betas:s,...r}=e;return this._client.post("/v1/complete",{body:r,timeout:this._client._options.timeout??6e5,...t,headers:tk([{...s?.toString()!=null?{"anthropic-beta":s?.toString()}:void 0},t?.headers]),stream:e.stream??!1})}}let tW="__json_buf";function tH(e){return"tool_use"===e.type||"server_tool_use"===e.type}class tJ{constructor(){P.add(this),this.messages=[],this.receivedMessages=[],O.set(this,void 0),this.controller=new AbortController,R.set(this,void 0),I.set(this,()=>{}),M.set(this,()=>{}),L.set(this,void 0),$.set(this,()=>{}),U.set(this,()=>{}),D.set(this,{}),B.set(this,!1),q.set(this,!1),z.set(this,!1),F.set(this,!1),W.set(this,void 0),H.set(this,void 0),V.set(this,e=>{if(ek(this,q,!0,"f"),eT(e)&&(e=new eR),e instanceof eR)return ek(this,z,!0,"f"),this._emit("abort",e);if(e instanceof eP)return this._emit("error",e);if(e instanceof Error){let t=new eP(e.message);return t.cause=e,this._emit("error",t)}return this._emit("error",new eP(String(e)))}),ek(this,R,new Promise((e,t)=>{ek(this,I,e,"f"),ek(this,M,t,"f")}),"f"),ek(this,L,new Promise((e,t)=>{ek(this,$,e,"f"),ek(this,U,t,"f")}),"f"),eE(this,R,"f").catch(()=>{}),eE(this,L,"f").catch(()=>{})}get response(){return eE(this,W,"f")}get request_id(){return eE(this,H,"f")}async withResponse(){let e=await eE(this,R,"f");if(!e)throw Error("Could not resolve a `Response` object");return{data:this,response:e,request_id:e.headers.get("request-id")}}static fromReadableStream(e){let t=new tJ;return t._run(()=>t._fromReadableStream(e)),t}static createMessage(e,t,s){let r=new tJ;for(let e of t.messages)r._addMessageParam(e);return r._run(()=>r._createMessage(e,{...t,stream:!0},{...s,headers:{...s?.headers,"X-Stainless-Helper-Method":"stream"}})),r}_run(e){e().then(()=>{this._emitFinal(),this._emit("end")},eE(this,V,"f"))}_addMessageParam(e){this.messages.push(e)}_addMessage(e,t=!0){this.receivedMessages.push(e),t&&this._emit("message",e)}async _createMessage(e,t,s){let r=s?.signal;r&&(r.aborted&&this.controller.abort(),r.addEventListener("abort",()=>this.controller.abort())),eE(this,P,"m",K).call(this);let{response:a,data:n}=await e.create({...t,stream:!0},{...s,signal:this.controller.signal}).withResponse();for await(let e of(this._connected(a),n))eE(this,P,"m",X).call(this,e);if(n.controller.signal?.aborted)throw new eR;eE(this,P,"m",Y).call(this)}_connected(e){this.ended||(ek(this,W,e,"f"),ek(this,H,e?.headers.get("request-id"),"f"),eE(this,I,"f").call(this,e),this._emit("connect"))}get ended(){return eE(this,B,"f")}get errored(){return eE(this,q,"f")}get aborted(){return eE(this,z,"f")}abort(){this.controller.abort()}on(e,t){return(eE(this,D,"f")[e]||(eE(this,D,"f")[e]=[])).push({listener:t}),this}off(e,t){let s=eE(this,D,"f")[e];if(!s)return this;let r=s.findIndex(e=>e.listener===t);return r>=0&&s.splice(r,1),this}once(e,t){return(eE(this,D,"f")[e]||(eE(this,D,"f")[e]=[])).push({listener:t,once:!0}),this}emitted(e){return new Promise((t,s)=>{ek(this,F,!0,"f"),"error"!==e&&this.once("error",s),this.once(e,t)})}async done(){ek(this,F,!0,"f"),await eE(this,L,"f")}get currentMessage(){return eE(this,O,"f")}async finalMessage(){return await this.done(),eE(this,P,"m",J).call(this)}async finalText(){return await this.done(),eE(this,P,"m",G).call(this)}_emit(e,...t){if(eE(this,B,"f"))return;"end"===e&&(ek(this,B,!0,"f"),eE(this,$,"f").call(this));let s=eE(this,D,"f")[e];if(s&&(eE(this,D,"f")[e]=s.filter(e=>!e.once),s.forEach(({listener:e})=>e(...t))),"abort"===e){let e=t[0];eE(this,F,"f")||s?.length||Promise.reject(e),eE(this,M,"f").call(this,e),eE(this,U,"f").call(this,e),this._emit("end");return}if("error"===e){let e=t[0];eE(this,F,"f")||s?.length||Promise.reject(e),eE(this,M,"f").call(this,e),eE(this,U,"f").call(this,e),this._emit("end")}}_emitFinal(){this.receivedMessages.at(-1)&&this._emit("finalMessage",eE(this,P,"m",J).call(this))}async _fromReadableStream(e,t){let s=t?.signal;s&&(s.aborted&&this.controller.abort(),s.addEventListener("abort",()=>this.controller.abort())),eE(this,P,"m",K).call(this),this._connected(null);let r=ts.fromReadableStream(e,this.controller);for await(let e of r)eE(this,P,"m",X).call(this,e);if(r.controller.signal?.aborted)throw new eR;eE(this,P,"m",Y).call(this)}[(O=new WeakMap,R=new WeakMap,I=new WeakMap,M=new WeakMap,L=new WeakMap,$=new WeakMap,U=new WeakMap,D=new WeakMap,B=new WeakMap,q=new WeakMap,z=new WeakMap,F=new WeakMap,W=new WeakMap,H=new WeakMap,V=new WeakMap,P=new WeakSet,J=function(){if(0===this.receivedMessages.length)throw new eP("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},G=function(){if(0===this.receivedMessages.length)throw new eP("stream ended without producing a Message with role=assistant");let e=this.receivedMessages.at(-1).content.filter(e=>"text"===e.type).map(e=>e.text);if(0===e.length)throw new eP("stream ended without producing a content block with type=text");return e.join(" ")},K=function(){this.ended||ek(this,O,void 0,"f")},X=function(e){if(this.ended)return;let t=eE(this,P,"m",Q).call(this,e);switch(this._emit("streamEvent",e,t),e.type){case"content_block_delta":{let s=t.content.at(-1);switch(e.delta.type){case"text_delta":"text"===s.type&&this._emit("text",e.delta.text,s.text||"");break;case"citations_delta":"text"===s.type&&this._emit("citation",e.delta.citation,s.citations??[]);break;case"input_json_delta":tH(s)&&s.input&&this._emit("inputJson",e.delta.partial_json,s.input);break;case"thinking_delta":"thinking"===s.type&&this._emit("thinking",e.delta.thinking,s.thinking);break;case"signature_delta":"thinking"===s.type&&this._emit("signature",s.signature);break;default:tG(e.delta)}break}case"message_stop":this._addMessageParam(t),this._addMessage(t,!0);break;case"content_block_stop":this._emit("contentBlock",t.content.at(-1));break;case"message_start":ek(this,O,t,"f")}},Y=function(){if(this.ended)throw new eP("stream has ended, this shouldn't happen");let e=eE(this,O,"f");if(!e)throw new eP("request ended without sending any chunks");return ek(this,O,void 0,"f"),e},Q=function(e){let t=eE(this,O,"f");if("message_start"===e.type){if(t)throw new eP(`Unexpected event order, got ${e.type} before receiving "message_stop"`);return e.message}if(!t)throw new eP(`Unexpected event order, got ${e.type} before "message_start"`);switch(e.type){case"message_stop":case"content_block_stop":return t;case"message_delta":return t.stop_reason=e.delta.stop_reason,t.stop_sequence=e.delta.stop_sequence,t.usage.output_tokens=e.usage.output_tokens,null!=e.usage.input_tokens&&(t.usage.input_tokens=e.usage.input_tokens),null!=e.usage.cache_creation_input_tokens&&(t.usage.cache_creation_input_tokens=e.usage.cache_creation_input_tokens),null!=e.usage.cache_read_input_tokens&&(t.usage.cache_read_input_tokens=e.usage.cache_read_input_tokens),null!=e.usage.server_tool_use&&(t.usage.server_tool_use=e.usage.server_tool_use),t;case"content_block_start":return t.content.push(e.content_block),t;case"content_block_delta":{let s=t.content.at(e.index);switch(e.delta.type){case"text_delta":s?.type==="text"&&(s.text+=e.delta.text);break;case"citations_delta":s?.type==="text"&&(s.citations??(s.citations=[]),s.citations.push(e.delta.citation));break;case"input_json_delta":if(s&&tH(s)){let t=s[tW]||"";Object.defineProperty(s,tW,{value:t+=e.delta.partial_json,enumerable:!1,writable:!0}),t&&(s.input=tI(t))}break;case"thinking_delta":s?.type==="thinking"&&(s.thinking+=e.delta.thinking);break;case"signature_delta":s?.type==="thinking"&&(s.signature=e.delta.signature);break;default:tG(e.delta)}return t}}},Symbol.asyncIterator)](){let e=[],t=[],s=!1;return this.on("streamEvent",s=>{let r=t.shift();r?r.resolve(s):e.push(s)}),this.on("end",()=>{for(let e of(s=!0,t))e.resolve(void 0);t.length=0}),this.on("abort",e=>{for(let r of(s=!0,t))r.reject(e);t.length=0}),this.on("error",e=>{for(let r of(s=!0,t))r.reject(e);t.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:s?{value:void 0,done:!0}:new Promise((e,s)=>t.push({resolve:e,reject:s})).then(e=>e?{value:e,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}toReadableStream(){return new ts(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}function tG(e){}class tV extends tj{create(e,t){return this._client.post("/v1/messages/batches",{body:e,...t})}retrieve(e,t){return this._client.get(tC`/v1/messages/batches/${e}`,t)}list(e={},t){return this._client.getAPIList("/v1/messages/batches",tu,{query:e,...t})}delete(e,t){return this._client.delete(tC`/v1/messages/batches/${e}`,t)}cancel(e,t){return this._client.post(tC`/v1/messages/batches/${e}/cancel`,t)}async results(e,t){let s=await this.retrieve(e);if(!s.results_url)throw new eP(`No batch \`results_url\`; Has it finished processing? ${s.processing_status} - ${s.id}`);return this._client.get(s.results_url,{...t,headers:tk([{Accept:"application/binary"},t?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((e,t)=>tP.fromResponse(t.response,t.controller))}}class tK extends tj{constructor(){super(...arguments),this.batches=new tV(this._client)}create(e,t){e.model in tX&&console.warn(`The model '${e.model}' is deprecated and will reach end-of-life on ${tX[e.model]} -Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);let s=this._client._options.timeout;if(!e.stream&&null==s){let t=tD[e.model]??void 0;s=this._client.calculateNonstreamingTimeout(e.max_tokens,t)}return this._client.post("/v1/messages",{body:e,timeout:s??6e5,...t,stream:e.stream??!1})}stream(e,t){return tJ.createMessage(this,e,t)}countTokens(e,t){return this._client.post("/v1/messages/count_tokens",{body:e,...t})}}let tX={"claude-1.3":"November 6th, 2024","claude-1.3-100k":"November 6th, 2024","claude-instant-1.1":"November 6th, 2024","claude-instant-1.1-100k":"November 6th, 2024","claude-instant-1.2":"November 6th, 2024","claude-3-sonnet-20240229":"July 21st, 2025","claude-2.1":"July 21st, 2025","claude-2.0":"July 21st, 2025"};tK.Batches=tV;class tY extends tj{retrieve(e,t={},s){let{betas:r}=t??{};return this._client.get(tC`/v1/models/${e}`,{...s,headers:tk([{...r?.toString()!=null?{"anthropic-beta":r?.toString()}:void 0},s?.headers])})}list(e={},t){let{betas:s,...r}=e??{};return this._client.getAPIList("/v1/models",tu,{query:r,...t,headers:tk([{...s?.toString()!=null?{"anthropic-beta":s?.toString()}:void 0},t?.headers])})}}let tQ=e=>void 0!==globalThis.process?globalThis.process.env?.[e]?.trim()??void 0:void 0!==globalThis.Deno?globalThis.Deno.env?.get?.(e)?.trim():void 0;class tZ{constructor({baseURL:e=tQ("ANTHROPIC_BASE_URL"),apiKey:t=tQ("ANTHROPIC_API_KEY")??null,authToken:s=tQ("ANTHROPIC_AUTH_TOKEN")??null,...r}={}){Z.set(this,void 0);const a={apiKey:t,authToken:s,...r,baseURL:e||"https://api.anthropic.com"};if(!a.dangerouslyAllowBrowser&&"u">typeof window&&void 0!==window.document&&"u">typeof navigator)throw new eP("It looks like you're running in a browser-like environment.\n\nThis is disabled by default, as it risks exposing your secret API credentials to attackers.\nIf you understand the risks and have appropriate mitigations in place,\nyou can set the `dangerouslyAllowBrowser` option to `true`, e.g.,\n\nnew Anthropic({ apiKey, dangerouslyAllowBrowser: true });\n");this.baseURL=a.baseURL,this.timeout=a.timeout??t0.DEFAULT_TIMEOUT,this.logger=a.logger??console;const n="warn";this.logLevel=n,this.logLevel=eV(a.logLevel,"ClientOptions.logLevel",this)??eV(tQ("ANTHROPIC_LOG"),"process.env['ANTHROPIC_LOG']",this)??n,this.fetchOptions=a.fetchOptions,this.maxRetries=a.maxRetries??2,this.fetch=a.fetch??function(){if("u">typeof fetch)return fetch;throw Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new Anthropic({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}(),ek(this,Z,e7,"f"),this._options=a,this.apiKey=t,this.authToken=s}withOptions(e){return new this.constructor({...this._options,baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetchOptions:this.fetchOptions,apiKey:this.apiKey,authToken:this.authToken,...e})}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:e,nulls:t}){if(!(this.apiKey&&e.get("x-api-key")||t.has("x-api-key")||this.authToken&&e.get("authorization"))&&!t.has("authorization"))throw Error('Could not resolve authentication method. Expected either apiKey or authToken to be set. Or for one of the "X-Api-Key" or "Authorization" headers to be explicitly omitted')}authHeaders(e){return tk([this.apiKeyAuth(e),this.bearerAuth(e)])}apiKeyAuth(e){if(null!=this.apiKey)return tk([{"X-Api-Key":this.apiKey}])}bearerAuth(e){if(null!=this.authToken)return tk([{Authorization:`Bearer ${this.authToken}`}])}stringifyQuery(e){return Object.entries(e).filter(([e,t])=>void 0!==t).map(([e,t])=>{if("string"==typeof t||"number"==typeof t||"boolean"==typeof t)return`${encodeURIComponent(e)}=${encodeURIComponent(t)}`;if(null===t)return`${encodeURIComponent(e)}=`;throw new eP(`Cannot stringify type ${typeof t}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`)}).join("&")}getUserAgent(){return`${this.constructor.name}/JS ${e1}`}defaultIdempotencyKey(){return`stainless-node-retry-${eC()}`}makeStatusError(e,t,s,r){return eO.generate(e,t,s,r)}buildURL(e,t){let s=new URL(eW.test(e)?e:this.baseURL+(this.baseURL.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),r=this.defaultQuery();return!function(e){if(!e)return!0;for(let t in e)return!1;return!0}(r)&&(t={...r,...t}),"object"==typeof t&&t&&!Array.isArray(t)&&(s.search=this.stringifyQuery(t)),s.toString()}_calculateNonstreamingTimeout(e){if(3600*e/128e3>600)throw new eP("Streaming is strongly recommended for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#streaming-responses for more details");return 6e5}async prepareOptions(e){}async prepareRequest(e,{url:t,options:s}){}get(e,t){return this.methodRequest("get",e,t)}post(e,t){return this.methodRequest("post",e,t)}patch(e,t){return this.methodRequest("patch",e,t)}put(e,t){return this.methodRequest("put",e,t)}delete(e,t){return this.methodRequest("delete",e,t)}methodRequest(e,t,s){return this.request(Promise.resolve(s).then(s=>({method:e,path:t,...s})))}request(e,t=null){return new tl(this,this.makeRequest(e,t,void 0))}async makeRequest(e,t,s){let r=await e,a=r.maxRetries??this.maxRetries;null==t&&(t=a),await this.prepareOptions(r);let{req:n,url:i,timeout:o}=this.buildRequest(r,{retryCount:a-t});await this.prepareRequest(n,{url:i,options:r});let l="log_"+(0x1000000*Math.random()|0).toString(16).padStart(6,"0"),c=void 0===s?"":`, retryOf: ${s}`,d=Date.now();if(eZ(this).debug(`[${l}] sending request`,e0({retryOfRequestLogID:s,method:r.method,url:i,options:r,headers:n.headers})),r.signal?.aborted)throw new eR;let u=new AbortController,m=await this.fetchWithTimeout(i,n,o,u).catch(eA),p=Date.now();if(m instanceof Error){let e=`retrying, ${t} attempts remaining`;if(r.signal?.aborted)throw new eR;let a=eT(m)||/timed? ?out/i.test(String(m)+("cause"in m?String(m.cause):""));if(t)return eZ(this).info(`[${l}] connection ${a?"timed out":"failed"} - ${e}`),eZ(this).debug(`[${l}] connection ${a?"timed out":"failed"} (${e})`,e0({retryOfRequestLogID:s,url:i,durationMs:p-d,message:m.message})),this.retryRequest(r,t,s??l);if(eZ(this).info(`[${l}] connection ${a?"timed out":"failed"} - error; no more retries left`),eZ(this).debug(`[${l}] connection ${a?"timed out":"failed"} (error; no more retries left)`,e0({retryOfRequestLogID:s,url:i,durationMs:p-d,message:m.message})),a)throw new eM;throw new eI({cause:m})}let h=[...m.headers.entries()].filter(([e])=>"request-id"===e).map(([e,t])=>", "+e+": "+JSON.stringify(t)).join(""),f=`[${l}${c}${h}] ${n.method} ${i} ${m.ok?"succeeded":"failed"} with status ${m.status} in ${p-d}ms`;if(!m.ok){let e=this.shouldRetry(m);if(t&&e){let e=`retrying, ${t} attempts remaining`;return await e8(m.body),eZ(this).info(`${f} - ${e}`),eZ(this).debug(`[${l}] response error (${e})`,e0({retryOfRequestLogID:s,url:m.url,status:m.status,headers:m.headers,durationMs:p-d})),this.retryRequest(r,t,s??l,m.headers)}let a=e?"error; no more retries left":"error; not retryable";eZ(this).info(`${f} - ${a}`);let n=await m.text().catch(e=>eA(e).message),i=eJ(n),o=i?void 0:n;throw eZ(this).debug(`[${l}] response error (${a})`,e0({retryOfRequestLogID:s,url:m.url,status:m.status,headers:m.headers,message:o,durationMs:Date.now()-d})),this.makeStatusError(m.status,i,o,m.headers)}return eZ(this).info(f),eZ(this).debug(`[${l}] response start`,e0({retryOfRequestLogID:s,url:m.url,status:m.status,headers:m.headers,durationMs:p-d})),{response:m,options:r,controller:u,requestLogID:l,retryOfRequestLogID:s,startTime:d}}getAPIList(e,t,s){return this.requestAPIList(t,{method:"get",path:e,...s})}requestAPIList(e,t){return new td(this,this.makeRequest(t,null,void 0),e)}async fetchWithTimeout(e,t,s,r){let{signal:a,method:n,...i}=t||{};a&&a.addEventListener("abort",()=>r.abort());let o=setTimeout(()=>r.abort(),s),l=globalThis.ReadableStream&&i.body instanceof globalThis.ReadableStream||"object"==typeof i.body&&null!==i.body&&Symbol.asyncIterator in i.body,c={signal:r.signal,...l?{duplex:"half"}:{},method:"GET",...i};n&&(c.method=n.toUpperCase());try{return await this.fetch.call(void 0,e,c)}finally{clearTimeout(o)}}shouldRetry(e){let t=e.headers.get("x-should-retry");return"true"===t||"false"!==t&&(408===e.status||409===e.status||429===e.status||!!(e.status>=500))}async retryRequest(e,t,s,r){let a,n,i=r?.get("retry-after-ms");if(i){let e=parseFloat(i);Number.isNaN(e)||(a=e)}let o=r?.get("retry-after");if(o&&!a){let e=parseFloat(o);a=Number.isNaN(e)?Date.parse(o)-Date.now():1e3*e}if(!(a&&0<=a&&a<6e4)){let s=e.maxRetries??this.maxRetries;a=this.calculateDefaultRetryTimeoutMillis(t,s)}return await (n=a,new Promise(e=>setTimeout(e,n))),this.makeRequest(e,t-1,s)}calculateDefaultRetryTimeoutMillis(e,t){return Math.min(.5*Math.pow(2,t-e),8)*(1-.25*Math.random())*1e3}calculateNonstreamingTimeout(e,t){if(36e5*e/128e3>6e5||null!=t&&e>t)throw new eP("Streaming is strongly recommended for operations that may token longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#long-requests for more details");return 6e5}buildRequest(e,{retryCount:t=0}={}){let s={...e},{method:r,path:a,query:n}=s,i=this.buildURL(a,n);"timeout"in s&&((e,t)=>{if("number"!=typeof t||!Number.isInteger(t))throw new eP(`${e} must be an integer`);if(t<0)throw new eP(`${e} must be a positive integer`)})("timeout",s.timeout),s.timeout=s.timeout??this.timeout;let{bodyHeaders:o,body:l}=this.buildBody({options:s}),c=this.buildHeaders({options:e,method:r,bodyHeaders:o,retryCount:t});return{req:{method:r,headers:c,...s.signal&&{signal:s.signal},...globalThis.ReadableStream&&l instanceof globalThis.ReadableStream&&{duplex:"half"},...l&&{body:l},...this.fetchOptions??{},...s.fetchOptions??{}},url:i,timeout:s.timeout}}buildHeaders({options:e,method:t,bodyHeaders:r,retryCount:a}){let n={};this.idempotencyHeader&&"get"!==t&&(e.idempotencyKey||(e.idempotencyKey=this.defaultIdempotencyKey()),n[this.idempotencyHeader]=e.idempotencyKey);let i=tk([n,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(a),...e.timeout?{"X-Stainless-Timeout":String(Math.trunc(e.timeout/1e3))}:{},...s??(s=(()=>{let e="u">typeof Deno&&null!=Deno.build?"deno":"u">typeof EdgeRuntime?"edge":"[object process]"===Object.prototype.toString.call(void 0!==globalThis.process?globalThis.process:0)?"node":"unknown";if("deno"===e)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":e1,"X-Stainless-OS":e4(Deno.build.os),"X-Stainless-Arch":e2(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":"string"==typeof Deno.version?Deno.version:Deno.version?.deno??"unknown"};if("u">typeof EdgeRuntime)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":e1,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if("node"===e)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":e1,"X-Stainless-OS":e4(globalThis.process.platform??"unknown"),"X-Stainless-Arch":e2(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let t=function(){if("u"0&&(g["x-litellm-tags"]=a.join(","));let y=new t0({apiKey:r,baseURL:f,dangerouslyAllowBrowser:!0,defaultHeaders:g});try{let r=Date.now(),a=!1,p={model:s,messages:e.map(e=>({role:e.role,content:e.content})),stream:!0,max_tokens:1024,litellm_trace_id:c};for await(let e of(d&&(p.vector_store_ids=d),u&&(p.guardrails=u),m&&(p.policies=m),y.messages.stream(p,{signal:n}))){if(console.log("Stream event:",e),"content_block_delta"===e.type){let n=e.delta;if(!a){a=!0;let e=Date.now()-r;console.log("First token received! Time:",e,"ms"),o&&o(e)}"text_delta"===n.type?t("assistant",n.text,s):"reasoning_delta"===n.type&&i&&i(n.text)}if("message_delta"===e.type&&e.usage&&l){let t=e.usage;console.log("Usage data found:",t);let s={completionTokens:t.output_tokens,promptTokens:t.input_tokens,totalTokens:t.input_tokens+t.output_tokens};l(s)}}}catch(e){throw n?.aborted?console.log("Anthropic messages request was cancelled"):t4.default.fromBackend(`Error occurred while generating model response. Please try again. Error: ${e}`),e}}e.s(["makeAnthropicMessagesRequest",()=>t3],434788);var t5=e.i(356449);async function t6(e,t,s,r,a,n,i,o,l,c){console.log=function(){},console.log("isLocal:",!1);let d=c||(0,e_.getProxyBaseUrl)(),u=new t5.default.OpenAI({apiKey:a,baseURL:d,dangerouslyAllowBrowser:!0,defaultHeaders:n&&n.length>0?{"x-litellm-tags":n.join(",")}:void 0});try{let a=await u.audio.speech.create({model:r,input:e,voice:t,...o?{response_format:o}:{},...l?{speed:l}:{}},{signal:i}),n=await a.blob(),c=URL.createObjectURL(n);s(c,r)}catch(e){throw i?.aborted?console.log("Audio speech request was cancelled"):t4.default.fromBackend(`Error occurred while generating speech. Please try again. Error: ${e}`),e}}async function t8(e,t,s,r,a,n,i,o,l,c,d){console.log=function(){},console.log("isLocal:",!1);let u=d||(0,e_.getProxyBaseUrl)(),m=new t5.default.OpenAI({apiKey:r,baseURL:u,dangerouslyAllowBrowser:!0,defaultHeaders:a&&a.length>0?{"x-litellm-tags":a.join(",")}:void 0});try{console.log("Processing audio file for transcription:",e.name);let r=await m.audio.transcriptions.create({model:s,file:e,...i?{language:i}:{},...o?{prompt:o}:{},...l?{response_format:l}:{},...void 0!==c?{temperature:c}:{}},{signal:n});if(console.log("Transcription response:",r),r&&r.text)t(r.text,s),t4.default.success("Audio transcribed successfully");else throw Error("No transcription text in response")}catch(e){if(console.error("Error making audio transcription request:",e),n?.aborted)console.log("Audio transcription request was cancelled");else{let t="Failed to transcribe audio";e?.error?.message?t=e.error.message:e?.message&&(t=e.message),t4.default.fromBackend(`Audio transcription failed: ${t}`)}throw e}}e.s(["makeOpenAIAudioSpeechRequest",()=>t6],512882),e.s(["makeOpenAIAudioTranscriptionRequest",()=>t8],584976)},254530,e=>{"use strict";var t=e.i(356449),s=e.i(764205);async function r(e,r,a,n,i,o,l,c,d,u,m,p,h,f,g,y,x,b,v,w,_,j,S,N){console.log=function(){},console.log("isLocal:",!1);let k=w||(0,s.getProxyBaseUrl)(),E={};i&&i.length>0&&(E["x-litellm-tags"]=i.join(","));let C=new t.default.OpenAI({apiKey:n,baseURL:k,dangerouslyAllowBrowser:!0,defaultHeaders:E});try{let t,s=Date.now(),n=!1,i={},w=!1,k=[];for await(let v of(f&&f.length>0&&(f.includes("__all__")?k.push({type:"mcp",server_label:"litellm",server_url:"litellm_proxy/mcp",require_approval:"never"}):f.forEach(e=>{let t=_?.find(t=>t.server_id===e),s=t?.alias||t?.server_name||e,r=j?.[e]||[];k.push({type:"mcp",server_label:"litellm",server_url:`litellm_proxy/mcp/${s}`,require_approval:"never",...r.length>0?{allowed_tools:r}:{}})})),await C.chat.completions.create({model:a,stream:!0,stream_options:{include_usage:!0},litellm_trace_id:u,messages:e,...m?{vector_store_ids:m}:{},...p?{guardrails:p}:{},...h?{policies:h}:{},...k.length>0?{tools:k,tool_choice:"auto"}:{},...void 0!==x?{temperature:x}:{},...void 0!==b?{max_tokens:b}:{},...N?{mock_testing_fallbacks:!0}:{}},{signal:o}))){console.log("Stream chunk:",v);let e=v.choices[0]?.delta;if(console.log("Delta content:",v.choices[0]?.delta?.content),console.log("Delta reasoning content:",e?.reasoning_content),!n&&(v.choices[0]?.delta?.content||e&&e.reasoning_content)&&(n=!0,t=Date.now()-s,console.log("First token received! Time:",t,"ms"),c?(console.log("Calling onTimingData with:",t),c(t)):console.log("onTimingData callback is not defined!")),v.choices[0]?.delta?.content){let e=v.choices[0].delta.content;r(e,v.model)}if(e&&e.image&&g&&(console.log("Image generated:",e.image),g(e.image.url,v.model)),e&&e.reasoning_content){let t=e.reasoning_content;l&&l(t)}if(e&&e.provider_specific_fields?.search_results&&y&&(console.log("Search results found:",e.provider_specific_fields.search_results),y(e.provider_specific_fields.search_results)),e&&e.provider_specific_fields){let t=e.provider_specific_fields;if(t.mcp_list_tools&&!i.mcp_list_tools&&(i.mcp_list_tools=t.mcp_list_tools,S&&!w)){w=!0;let e={type:"response.output_item.done",item_id:"mcp_list_tools",item:{type:"mcp_list_tools",tools:t.mcp_list_tools.map(e=>({name:e.function?.name||e.name||"",description:e.function?.description||e.description||"",input_schema:e.function?.parameters||e.input_schema||{}}))},timestamp:Date.now()};S(e),console.log("MCP list_tools event sent:",e)}t.mcp_tool_calls&&(i.mcp_tool_calls=t.mcp_tool_calls),t.mcp_call_results&&(i.mcp_call_results=t.mcp_call_results),(t.mcp_list_tools||t.mcp_tool_calls||t.mcp_call_results)&&console.log("MCP metadata found in chunk:",{mcp_list_tools:t.mcp_list_tools?"present":"absent",mcp_tool_calls:t.mcp_tool_calls?"present":"absent",mcp_call_results:t.mcp_call_results?"present":"absent"})}if(v.usage&&d){console.log("Usage data found:",v.usage);let e={completionTokens:v.usage.completion_tokens,promptTokens:v.usage.prompt_tokens,totalTokens:v.usage.total_tokens};v.usage.completion_tokens_details?.reasoning_tokens&&(e.reasoningTokens=v.usage.completion_tokens_details.reasoning_tokens),void 0!==v.usage.cost&&null!==v.usage.cost&&(e.cost=parseFloat(v.usage.cost)),d(e)}}S&&(i.mcp_tool_calls||i.mcp_call_results)&&i.mcp_tool_calls&&i.mcp_tool_calls.length>0&&i.mcp_tool_calls.forEach((e,t)=>{let s=e.function?.name||e.name||"",r=e.function?.arguments||e.arguments||"{}",a=i.mcp_call_results?.find(t=>t.tool_call_id===e.id||t.tool_call_id===e.call_id)||i.mcp_call_results?.[t],n={type:"response.output_item.done",item:{type:"mcp_call",name:s,arguments:"string"==typeof r?r:JSON.stringify(r),output:a?.result?"string"==typeof a.result?a.result:JSON.stringify(a.result):void 0},item_id:e.id||e.call_id,timestamp:Date.now()};S(n),console.log("MCP call event sent:",n)});let E=Date.now();v&&v(E-s)}catch(e){throw o?.aborted&&console.log("Chat completion request was cancelled"),e}}e.s(["makeOpenAIChatCompletionRequest",()=>r])},720762,e=>{"use strict";var t=e.i(727749),s=e.i(764205);async function r(e,r,a,n,i,o){if(!n)throw Error("Virtual Key is required");console.log=function(){};let l=o||(0,s.getProxyBaseUrl)(),c={};i&&i.length>0&&(c["x-litellm-tags"]=i.join(","));try{let t=l.endsWith("/")?l.slice(0,-1):l,i=`${t}/embeddings`,o=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json",[(0,s.getGlobalLitellmHeaderName)()]:`Bearer ${n}`,...c},body:JSON.stringify({model:a,input:e})});if(!o.ok){let e=await o.text();throw Error(e||`Request failed with status ${o.status}`)}let d=await o.json(),u=d?.data?.[0]?.embedding;if(!u)throw Error("No embedding returned from server");r(JSON.stringify(u),d?.model??a)}catch(e){throw t.default.fromBackend(`Error occurred while making embeddings request. Please try again. Error: ${e}`),e}}e.s(["makeOpenAIEmbeddingsRequest",()=>r])},921687,e=>{"use strict";var t=e.i(764205);let s=async(e,s)=>{try{let r=s||(0,t.getProxyBaseUrl)(),a=r?`${r}/v1/agents`:"/v1/agents",n=await fetch(a,{method:"GET",headers:{[(0,t.getGlobalLitellmHeaderName)()]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json();throw Error(e.detail||"Failed to fetch agents")}let i=await n.json();return console.log("Fetched agents:",i),i.sort((e,t)=>{let s=e.agent_name||e.agent_id,r=t.agent_name||t.agent_id;return s.localeCompare(r)}),i}catch(e){throw console.error("Error fetching agents:",e),e}},r=async(e,s,r,a)=>{try{let a=await (0,t.modelInfoCall)(e,s,r,1,200),n=a?.data??[],i=(Array.isArray(n)?n:[]).filter(e=>"string"==typeof e?.litellm_params?.model&&e.litellm_params.model.startsWith("litellm_agent/")).map(e=>({model_name:e.model_name??e.model_group??"",litellm_params:{...e.litellm_params,model:e.litellm_params.model,litellm_system_prompt:e.litellm_params?.litellm_system_prompt,tools:Array.isArray(e.litellm_params?.tools)?e.litellm_params.tools:void 0},model_info:e.model_info??null}));return i.sort((e,t)=>e.model_name.localeCompare(t.model_name)),i}catch(e){throw console.error("Error fetching agent models:",e),e}};e.s(["fetchAvailableAgentModels",0,r,"fetchAvailableAgents",0,s])},488143,(e,t,s)=>{"use strict";function r({widthInt:e,heightInt:t,blurWidth:s,blurHeight:r,blurDataURL:a,objectFit:n}){let i=s?40*s:e,o=r?40*r:t,l=i&&o?`viewBox='0 0 ${i} ${o}'`:"";return`%3Csvg xmlns='http://www.w3.org/2000/svg' ${l}%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='${l?"none":"contain"===n?"xMidYMid":"cover"===n?"xMidYMid slice":"none"}' style='filter: url(%23b);' href='${a}'/%3E%3C/svg%3E`}Object.defineProperty(s,"__esModule",{value:!0}),Object.defineProperty(s,"getImageBlurSvg",{enumerable:!0,get:function(){return r}})},987690,(e,t,s)=>{"use strict";Object.defineProperty(s,"__esModule",{value:!0});var r={VALID_LOADERS:function(){return n},imageConfigDefault:function(){return i}};for(var a in r)Object.defineProperty(s,a,{enumerable:!0,get:r[a]});let n=["default","imgix","cloudinary","akamai","custom"],i={deviceSizes:[640,750,828,1080,1200,1920,2048,3840],imageSizes:[32,48,64,96,128,256,384],path:"/_next/image",loader:"default",loaderFile:"",domains:[],disableStaticImages:!1,minimumCacheTTL:14400,formats:["image/webp"],maximumRedirects:3,maximumResponseBody:5e7,dangerouslyAllowLocalIP:!1,dangerouslyAllowSVG:!1,contentSecurityPolicy:"script-src 'none'; frame-src 'none'; sandbox;",contentDispositionType:"attachment",localPatterns:void 0,remotePatterns:[],qualities:[75],unoptimized:!1}},908927,(e,t,s)=>{"use strict";Object.defineProperty(s,"__esModule",{value:!0}),Object.defineProperty(s,"getImgProps",{enumerable:!0,get:function(){return c}}),e.r(233525);let r=e.r(543369),a=e.r(488143),n=e.r(987690),i=["-moz-initial","fill","none","scale-down",void 0];function o(e){return void 0!==e.default}function l(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 c({src:e,sizes:t,unoptimized:s=!1,priority:c=!1,preload:d=!1,loading:u,className:m,quality:p,width:h,height:f,fill:g=!1,style:y,overrideSrc:x,onLoad:b,onLoadingComplete:v,placeholder:w="empty",blurDataURL:_,fetchPriority:j,decoding:S="async",layout:N,objectFit:k,objectPosition:E,lazyBoundary:C,lazyRoot:T,...A},P){var O;let R,I,M,{imgConf:L,showAltText:$,blurComplete:U,defaultLoader:D}=P,B=L||n.imageConfigDefault;if("allSizes"in B)R=B;else{let e=[...B.deviceSizes,...B.imageSizes].sort((e,t)=>e-t),t=B.deviceSizes.sort((e,t)=>e-t),s=B.qualities?.sort((e,t)=>e-t);R={...B,allSizes:e,deviceSizes:t,qualities:s}}if(void 0===D)throw Object.defineProperty(Error("images.loaderFile detected but the file is missing default export.\nRead more: https://nextjs.org/docs/messages/invalid-images-config"),"__NEXT_ERROR_CODE",{value:"E163",enumerable:!1,configurable:!0});let q=A.loader||D;delete A.loader,delete A.srcSet;let z="__next_img_default"in q;if(z){if("custom"===R.loader)throw Object.defineProperty(Error(`Image with src "${e}" is missing "loader" prop. -Read more: https://nextjs.org/docs/messages/next-image-missing-loader`),"__NEXT_ERROR_CODE",{value:"E252",enumerable:!1,configurable:!0})}else{let e=q;q=t=>{let{config:s,...r}=t;return e(r)}}if(N){"fill"===N&&(g=!0);let e={intrinsic:{maxWidth:"100%",height:"auto"},responsive:{width:"100%",height:"auto"}}[N];e&&(y={...y,...e});let s={responsive:"100vw",fill:"100vw"}[N];s&&!t&&(t=s)}let F="",W=l(h),H=l(f);if((O=e)&&"object"==typeof O&&(o(O)||void 0!==O.src)){let t=o(e)?e.default:e;if(!t.src)throw Object.defineProperty(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(t)}`),"__NEXT_ERROR_CODE",{value:"E460",enumerable:!1,configurable:!0});if(!t.height||!t.width)throw Object.defineProperty(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(t)}`),"__NEXT_ERROR_CODE",{value:"E48",enumerable:!1,configurable:!0});if(I=t.blurWidth,M=t.blurHeight,_=_||t.blurDataURL,F=t.src,!g)if(W||H){if(W&&!H){let e=W/t.width;H=Math.round(t.height*e)}else if(!W&&H){let e=H/t.height;W=Math.round(t.width*e)}}else W=t.width,H=t.height}let J=!c&&!d&&("lazy"===u||void 0===u);(!(e="string"==typeof e?e:F)||e.startsWith("data:")||e.startsWith("blob:"))&&(s=!0,J=!1),R.unoptimized&&(s=!0),z&&!R.dangerouslyAllowSVG&&e.split("?",1)[0].endsWith(".svg")&&(s=!0);let G=l(p),V=Object.assign(g?{position:"absolute",height:"100%",width:"100%",left:0,top:0,right:0,bottom:0,objectFit:k,objectPosition:E}:{},$?{}:{color:"transparent"},y),K=U||"empty"===w?null:"blur"===w?`url("data:image/svg+xml;charset=utf-8,${(0,a.getImageBlurSvg)({widthInt:W,heightInt:H,blurWidth:I,blurHeight:M,blurDataURL:_||"",objectFit:V.objectFit})}")`:`url("${w}")`,X=i.includes(V.objectFit)?"fill"===V.objectFit?"100% 100%":"cover":V.objectFit,Y=K?{backgroundSize:X,backgroundPosition:V.objectPosition||"50% 50%",backgroundRepeat:"no-repeat",backgroundImage:K}:{},Q=function({config:e,src:t,unoptimized:s,width:a,quality:n,sizes:i,loader:o}){if(s){let e=(0,r.getDeploymentId)();if(t.startsWith("/")&&!t.startsWith("//")&&e){let s=t.includes("?")?"&":"?";t=`${t}${s}dpl=${e}`}return{src:t,srcSet:void 0,sizes:void 0}}let{widths:l,kind:c}=function({deviceSizes:e,allSizes:t},s,r){if(r){let s=/(^|\s)(1?\d?\d)vw/g,a=[];for(let e;e=s.exec(r);)a.push(parseInt(e[2]));if(a.length){let s=.01*Math.min(...a);return{widths:t.filter(t=>t>=e[0]*s),kind:"w"}}return{widths:t,kind:"w"}}return"number"!=typeof s?{widths:e,kind:"w"}:{widths:[...new Set([s,2*s].map(e=>t.find(t=>t>=e)||t[t.length-1]))],kind:"x"}}(e,a,i),d=l.length-1;return{sizes:i||"w"!==c?i:"100vw",srcSet:l.map((s,r)=>`${o({config:e,src:t,quality:n,width:s})} ${"w"===c?s:r+1}${c}`).join(", "),src:o({config:e,src:t,quality:n,width:l[d]})}}({config:R,src:e,unoptimized:s,width:W,quality:G,sizes:t,loader:q}),Z=J?"lazy":u;return{props:{...A,loading:Z,fetchPriority:j,width:W,height:H,decoding:S,className:m,style:{...V,...Y},sizes:Q.sizes,srcSet:Q.srcSet,src:x||Q.src},meta:{unoptimized:s,preload:d||c,placeholder:w,fill:g}}}},898879,(e,t,s)=>{"use strict";Object.defineProperty(s,"__esModule",{value:!0}),Object.defineProperty(s,"default",{enumerable:!0,get:function(){return o}});let r=e.r(271645),a="u"{}:r.useLayoutEffect,i=a?()=>{}:r.useEffect;function o(e){let{headManager:t,reduceComponentsToState:s}=e;function o(){if(t&&t.mountedInstances){let e=r.Children.toArray(Array.from(t.mountedInstances).filter(Boolean));t.updateHead(s(e))}}return a&&(t?.mountedInstances?.add(e.children),o()),n(()=>(t?.mountedInstances?.add(e.children),()=>{t?.mountedInstances?.delete(e.children)})),n(()=>(t&&(t._pendingUpdate=o),()=>{t&&(t._pendingUpdate=o)})),i(()=>(t&&t._pendingUpdate&&(t._pendingUpdate(),t._pendingUpdate=null),()=>{t&&t._pendingUpdate&&(t._pendingUpdate(),t._pendingUpdate=null)})),null}},325633,(e,t,s)=>{"use strict";Object.defineProperty(s,"__esModule",{value:!0});var r={default:function(){return f},defaultHead:function(){return u}};for(var a in r)Object.defineProperty(s,a,{enumerable:!0,get:r[a]});let n=e.r(563141),i=e.r(151836),o=e.r(843476),l=i._(e.r(271645)),c=n._(e.r(898879)),d=e.r(742732);function u(){return[(0,o.jsx)("meta",{charSet:"utf-8"},"charset"),(0,o.jsx)("meta",{name:"viewport",content:"width=device-width"},"viewport")]}function m(e,t){return"string"==typeof t||"number"==typeof t?e:t.type===l.default.Fragment?e.concat(l.default.Children.toArray(t.props.children).reduce((e,t)=>"string"==typeof t||"number"==typeof t?e:e.concat(t),[])):e.concat(t)}e.r(233525);let p=["name","httpEquiv","charSet","itemProp"];function h(e){let t,s,r,a;return e.reduce(m,[]).reverse().concat(u().reverse()).filter((t=new Set,s=new Set,r=new Set,a={},e=>{let n=!0,i=!1;if(e.key&&"number"!=typeof e.key&&e.key.indexOf("$")>0){i=!0;let s=e.key.slice(e.key.indexOf("$")+1);t.has(s)?n=!1:t.add(s)}switch(e.type){case"title":case"base":s.has(e.type)?n=!1:s.add(e.type);break;case"meta":for(let t=0,s=p.length;t{let s=e.key||t;return l.default.cloneElement(e,{key:s})})}let f=function({children:e}){let t=(0,l.useContext)(d.HeadManagerContext);return(0,o.jsx)(c.default,{reduceComponentsToState:h,headManager:t,children:e})};("function"==typeof s.default||"object"==typeof s.default&&null!==s.default)&&void 0===s.default.__esModule&&(Object.defineProperty(s.default,"__esModule",{value:!0}),Object.assign(s.default,s),t.exports=s.default)},918556,(e,t,s)=>{"use strict";Object.defineProperty(s,"__esModule",{value:!0}),Object.defineProperty(s,"ImageConfigContext",{enumerable:!0,get:function(){return n}});let r=e.r(563141)._(e.r(271645)),a=e.r(987690),n=r.default.createContext(a.imageConfigDefault)},65856,(e,t,s)=>{"use strict";Object.defineProperty(s,"__esModule",{value:!0}),Object.defineProperty(s,"RouterContext",{enumerable:!0,get:function(){return r}});let r=e.r(563141)._(e.r(271645)).default.createContext(null)},670965,(e,t,s)=>{"use strict";function r(e,t){let s=e||75;return t?.qualities?.length?t.qualities.reduce((e,t)=>Math.abs(t-s){"use strict";Object.defineProperty(s,"__esModule",{value:!0}),Object.defineProperty(s,"default",{enumerable:!0,get:function(){return i}});let r=e.r(670965),a=e.r(543369);function n({config:e,src:t,width:s,quality:n}){if(t.startsWith("/")&&t.includes("?")&&e.localPatterns?.length===1&&"**"===e.localPatterns[0].pathname&&""===e.localPatterns[0].search)throw Object.defineProperty(Error(`Image with src "${t}" is using a query string which is not configured in images.localPatterns. -Read more: https://nextjs.org/docs/messages/next-image-unconfigured-localpatterns`),"__NEXT_ERROR_CODE",{value:"E871",enumerable:!1,configurable:!0});let i=(0,r.findClosestQuality)(n,e),o=(0,a.getDeploymentId)();return`${e.path}?url=${encodeURIComponent(t)}&w=${s}&q=${i}${t.startsWith("/")&&o?`&dpl=${o}`:""}`}n.__next_img_default=!0;let i=n},605500,(e,t,s)=>{"use strict";Object.defineProperty(s,"__esModule",{value:!0}),Object.defineProperty(s,"Image",{enumerable:!0,get:function(){return v}});let r=e.r(563141),a=e.r(151836),n=e.r(843476),i=a._(e.r(271645)),o=r._(e.r(174080)),l=r._(e.r(325633)),c=e.r(908927),d=e.r(987690),u=e.r(918556);e.r(233525);let m=e.r(65856),p=r._(e.r(1948)),h=e.r(818581),f={deviceSizes:[640,750,828,1080,1200,1920,2048,3840],imageSizes:[32,48,64,96,128,256,384],qualities:[75],path:"/_next/image",loader:"default",dangerouslyAllowSVG:!1,unoptimized:!1};function g(e,t,s,r,a,n,i){let o=e?.src;e&&e["data-loaded-src"]!==o&&(e["data-loaded-src"]=o,("decode"in e?e.decode():Promise.resolve()).catch(()=>{}).then(()=>{if(e.parentElement&&e.isConnected){if("empty"!==t&&a(!0),s?.current){let t=new Event("load");Object.defineProperty(t,"target",{writable:!1,value:e});let r=!1,a=!1;s.current({...t,nativeEvent:t,currentTarget:e,target:e,isDefaultPrevented:()=>r,isPropagationStopped:()=>a,persist:()=>{},preventDefault:()=>{r=!0,t.preventDefault()},stopPropagation:()=>{a=!0,t.stopPropagation()}})}r?.current&&r.current(e)}}))}function y(e){return i.use?{fetchPriority:e}:{fetchpriority:e}}"u"{let E=(0,i.useCallback)(e=>{e&&(S&&(e.src=e.src),e.complete&&g(e,u,x,b,v,p,_))},[e,u,x,b,v,S,p,_]),C=(0,h.useMergedRef)(k,E);return(0,n.jsx)("img",{...N,...y(d),loading:m,width:a,height:r,decoding:o,"data-nimg":f?"fill":"1",className:l,style:c,sizes:s,srcSet:t,src:e,ref:C,onLoad:e=>{g(e.currentTarget,u,x,b,v,p,_)},onError:e=>{w(!0),"empty"!==u&&v(!0),S&&S(e)}})});function b({isAppRouter:e,imgAttributes:t}){let s={as:"image",imageSrcSet:t.srcSet,imageSizes:t.sizes,crossOrigin:t.crossOrigin,referrerPolicy:t.referrerPolicy,...y(t.fetchPriority)};return e&&o.default.preload?(o.default.preload(t.src,s),null):(0,n.jsx)(l.default,{children:(0,n.jsx)("link",{rel:"preload",href:t.srcSet?void 0:t.src,...s},"__nimg-"+t.src+t.srcSet+t.sizes)})}let v=(0,i.forwardRef)((e,t)=>{let s=(0,i.useContext)(m.RouterContext),r=(0,i.useContext)(u.ImageConfigContext),a=(0,i.useMemo)(()=>{let e=f||r||d.imageConfigDefault,t=[...e.deviceSizes,...e.imageSizes].sort((e,t)=>e-t),s=e.deviceSizes.sort((e,t)=>e-t),a=e.qualities?.sort((e,t)=>e-t);return{...e,allSizes:t,deviceSizes:s,qualities:a,localPatterns:"u"{h.current=o},[o]);let g=(0,i.useRef)(l);(0,i.useEffect)(()=>{g.current=l},[l]);let[y,v]=(0,i.useState)(!1),[w,_]=(0,i.useState)(!1),{props:j,meta:S}=(0,c.getImgProps)(e,{defaultLoader:p.default,imgConf:a,blurComplete:y,showAltText:w});return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(x,{...j,unoptimized:S.unoptimized,placeholder:S.placeholder,fill:S.fill,onLoadRef:h,onLoadingCompleteRef:g,setBlurComplete:v,setShowAltText:_,sizesInput:e.sizes,ref:t}),S.preload?(0,n.jsx)(b,{isAppRouter:!s,imgAttributes:j}):null]})});("function"==typeof s.default||"object"==typeof s.default&&null!==s.default)&&void 0===s.default.__esModule&&(Object.defineProperty(s.default,"__esModule",{value:!0}),Object.assign(s.default,s),t.exports=s.default)},794909,(e,t,s)=>{"use strict";Object.defineProperty(s,"__esModule",{value:!0});var r={default:function(){return d},getImageProps:function(){return c}};for(var a in r)Object.defineProperty(s,a,{enumerable:!0,get:r[a]});let n=e.r(563141),i=e.r(908927),o=e.r(605500),l=n._(e.r(1948));function c(e){let{props:t}=(0,i.getImgProps)(e,{defaultLoader:l.default,imgConf:{deviceSizes:[640,750,828,1080,1200,1920,2048,3840],imageSizes:[32,48,64,96,128,256,384],qualities:[75],path:"/_next/image",loader:"default",dangerouslyAllowSVG:!1,unoptimized:!1}});for(let[e,s]of Object.entries(t))void 0===s&&delete t[e];return{props:t}}let d=o.Image},657688,(e,t,s)=>{t.exports=e.r(794909)},220486,964421,843153,761793,966988,152401,e=>{"use strict";var t=e.i(843476),s=e.i(218129),r=e.i(132104),a=e.i(447593),n=e.i(245094),i=e.i(210612),o=e.i(955135),l=e.i(91500),c=e.i(827252),d=e.i(438957),u=e.i(596239),m=e.i(56456),p=e.i(124608),h=e.i(983561),f=e.i(602073),g=e.i(313603),y=e.i(782273),x=e.i(232164),b=e.i(366308),v=e.i(771674),w=e.i(304967),_=e.i(599724),j=e.i(779241),S=e.i(629569),N=e.i(994388),k=e.i(464571),E=e.i(311451),C=e.i(212931),T=e.i(282786),A=e.i(199133),P=e.i(482725),O=e.i(592968),R=e.i(898586),I=e.i(515831),M=e.i(271645),L=e.i(918789),$=e.i(650056),U=e.i(219470),D=e.i(422233),B=e.i(122550),q=e.i(891547),z=e.i(921511),F=e.i(235267),W=e.i(727749),H=e.i(764205),J=e.i(318059),G=e.i(916940),V=e.i(953860),K=e.i(434788),X=e.i(512882),Y=e.i(584976),Q=e.i(254530),Z=e.i(720762),ee=e.i(921687),et=e.i(689020);e.i(247167);var es=e.i(356449);async function er(e,t,s,r,a,n,i,o){console.log=function(){},console.log("isLocal:",!1);let l=o||(0,H.getProxyBaseUrl)(),c=new es.default.OpenAI({apiKey:a,baseURL:l,dangerouslyAllowBrowser:!0,defaultHeaders:n&&n.length>0?{"x-litellm-tags":n.join(",")}:void 0});try{let a=Array.isArray(e)?e:[e],n=[];for(let e=0;e1&&W.default.success(`Successfully processed ${n.length} images`)}catch(e){if(console.error("Error making image edit request:",e),i?.aborted)console.log("Image edits request was cancelled");else{let t="Failed to edit image(s)";e?.error?.message?t=e.error.message:e?.message&&(t=e.message),W.default.fromBackend(`Image edit failed: ${t}`)}throw e}}async function ea(e,t,s,r,a,n,i){console.log=function(){},console.log("isLocal:",!1);let o=i||(0,H.getProxyBaseUrl)(),l=new es.default.OpenAI({apiKey:r,baseURL:o,dangerouslyAllowBrowser:!0,defaultHeaders:a&&a.length>0?{"x-litellm-tags":a.join(",")}:void 0});try{let r=await l.images.generate({model:s,prompt:e},{signal:n});if(console.log(r.data),r.data&&r.data[0])if(r.data[0].url)t(r.data[0].url,s);else if(r.data[0].b64_json){let e=r.data[0].b64_json;t(`data:image/png;base64,${e}`,s)}else throw Error("No image data found in response");else throw Error("Invalid response format")}catch(e){throw n?.aborted?console.log("Image generation request was cancelled"):W.default.fromBackend(`Error occurred while generating image. Please try again. Error: ${e}`),e}}async function en(e,t,s,r,a=[],n,i,o,l,c,d,u,m,p,h,f,g,y,x,b,v,w){if(!r)throw Error("Virtual Key is required");if(!s||""===s.trim())throw Error("Model is required. Please select a model before sending a request.");console.log=function(){};let _=b||(0,H.getProxyBaseUrl)(),j={};a&&a.length>0&&(j["x-litellm-tags"]=a.join(","));let S=new es.default.OpenAI({apiKey:r,baseURL:_,dangerouslyAllowBrowser:!0,defaultHeaders:j});try{let r=Date.now(),a=!1,b=e.map(e=>(Array.isArray(e.content),{role:e.role,content:e.content,type:"message"})),_=[];p&&p.length>0&&(p.includes("__all__")?_.push({type:"mcp",server_label:"litellm",server_url:"litellm_proxy/mcp",require_approval:"never"}):p.forEach(e=>{let t=v?.find(t=>t.server_id===e),s=t?.alias||t?.server_name||e,r=w?.[e]||[];_.push({type:"mcp",server_label:"litellm",server_url:`litellm_proxy/mcp/${s}`,require_approval:"never",...r.length>0?{allowed_tools:r}:{}})})),y&&_.push({type:"code_interpreter",container:{type:"auto"}});let j=await S.responses.create({model:s,input:b,stream:!0,litellm_trace_id:c,...h?{previous_response_id:h}:{},...d?{vector_store_ids:d}:{},...u?{guardrails:u}:{},...m?{policies:m}:{},..._.length>0?{tools:_,tool_choice:"auto"}:{}},{signal:n}),E="",C={code:"",containerId:""};for await(let e of j)if(console.log("Response event:",e),"object"==typeof e&&null!==e){if((e.type?.startsWith("response.mcp_")||"response.output_item.done"===e.type&&(e.item?.type==="mcp_list_tools"||e.item?.type==="mcp_call"))&&(console.log("MCP event received:",e),g)){let t={type:e.type,sequence_number:e.sequence_number,output_index:e.output_index,item_id:e.item_id||e.item?.id,item:e.item,delta:e.delta,arguments:e.arguments,timestamp:Date.now()};g(t)}"response.output_item.done"===e.type&&e.item?.type==="mcp_call"&&e.item?.name&&(E=e.item.name,console.log("MCP tool used:",E)),N=C;var N,k=C="response.output_item.done"===e.type&&e.item?.type==="code_interpreter_call"?(console.log("Code interpreter call completed:",e.item),{code:e.item.code||"",containerId:e.item.container_id||""}):N;if("response.output_item.done"===e.type&&e.item?.type==="message"&&e.item?.content&&x){for(let t of e.item.content)if("output_text"===t.type&&t.annotations){let e=t.annotations.filter(e=>"container_file_citation"===e.type);(e.length>0||k.code)&&x({code:k.code,containerId:k.containerId,annotations:e})}}if("response.role.delta"===e.type)continue;if("response.output_text.delta"===e.type&&"string"==typeof e.delta){let n=e.delta;if(console.log("Text delta",n),n.trim().length>0&&(t("assistant",n,s),!a)){a=!0;let e=Date.now()-r;console.log("First token received! Time:",e,"ms"),o&&o(e)}}if("response.reasoning.delta"===e.type&&"delta"in e){let t=e.delta;"string"==typeof t&&i&&i(t)}if("response.completed"===e.type&&"response"in e){let t=e.response,s=t.usage;if(console.log("Usage data:",s),console.log("Response completed event:",t),t.id&&f&&(console.log("Response ID for session management:",t.id),f(t.id)),s&&l){console.log("Usage data:",s);let e={completionTokens:s.output_tokens,promptTokens:s.input_tokens,totalTokens:s.total_tokens};s.completion_tokens_details?.reasoning_tokens&&(e.reasoningTokens=s.completion_tokens_details.reasoning_tokens),l(e,E)}}}return j}catch(e){throw n?.aborted?console.log("Responses API request was cancelled"):W.default.fromBackend(`Error occurred while generating model response. Please try again. Error: ${e}`),e}}var ei=e.i(245704),eo=e.i(637235),el=e.i(270377),ec=e.i(166406),ed=e.i(755151),eu=e.i(240647),em=e.i(993914);let ep=(e,t=8)=>e?e.length>t?`${e.substring(0,t)}…`:e:null,eh=e=>{navigator.clipboard.writeText(e)},ef=({a2aMetadata:e,timeToFirstToken:s,totalLatency:r})=>{let[a,n]=(0,M.useState)(!1);if(!e&&!s&&!r)return null;let{taskId:i,contextId:o,status:l,metadata:c}=e||{},d=(e=>{if(!e)return null;try{return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}catch{return e}})(l?.timestamp);return(0,t.jsxs)("div",{className:"a2a-metrics mt-3 pt-2 border-t border-gray-200 text-xs",children:[(0,t.jsxs)("div",{className:"flex items-center mb-2 text-gray-600",children:[(0,t.jsx)(h.RobotOutlined,{className:"mr-1.5 text-blue-500"}),(0,t.jsx)("span",{className:"font-medium text-gray-700",children:"A2A Metadata"})]}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-gray-500 ml-4",children:[l?.state&&(0,t.jsxs)("span",{className:`inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium ${(e=>{switch(e){case"completed":return"bg-green-100 text-green-700";case"working":case"submitted":return"bg-blue-100 text-blue-700";case"failed":case"canceled":return"bg-red-100 text-red-700";default:return"bg-gray-100 text-gray-700"}})(l.state)}`,children:[(e=>{switch(e){case"completed":return(0,t.jsx)(ei.CheckCircleOutlined,{className:"text-green-500"});case"working":case"submitted":return(0,t.jsx)(m.LoadingOutlined,{className:"text-blue-500"});case"failed":case"canceled":return(0,t.jsx)(el.ExclamationCircleOutlined,{className:"text-red-500"});default:return(0,t.jsx)(eo.ClockCircleOutlined,{className:"text-gray-500"})}})(l.state),(0,t.jsx)("span",{className:"ml-1 capitalize",children:l.state})]}),d&&(0,t.jsx)(O.Tooltip,{title:l?.timestamp,children:(0,t.jsxs)("span",{className:"flex items-center",children:[(0,t.jsx)(eo.ClockCircleOutlined,{className:"mr-1"}),d]})}),void 0!==r&&(0,t.jsx)(O.Tooltip,{title:"Total latency",children:(0,t.jsxs)("span",{className:"flex items-center text-blue-600",children:[(0,t.jsx)(eo.ClockCircleOutlined,{className:"mr-1"}),(r/1e3).toFixed(2),"s"]})}),void 0!==s&&(0,t.jsx)(O.Tooltip,{title:"Time to first token",children:(0,t.jsxs)("span",{className:"flex items-center text-green-600",children:["TTFT: ",(s/1e3).toFixed(2),"s"]})})]}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-3 text-gray-500 ml-4 mt-1.5",children:[i&&(0,t.jsx)(O.Tooltip,{title:`Click to copy: ${i}`,children:(0,t.jsxs)("span",{className:"flex items-center cursor-pointer hover:text-gray-700",onClick:()=>eh(i),children:[(0,t.jsx)(em.FileTextOutlined,{className:"mr-1"}),"Task: ",ep(i),(0,t.jsx)(ec.CopyOutlined,{className:"ml-1 text-gray-400 hover:text-gray-600"})]})}),o&&(0,t.jsx)(O.Tooltip,{title:`Click to copy: ${o}`,children:(0,t.jsxs)("span",{className:"flex items-center cursor-pointer hover:text-gray-700",onClick:()=>eh(o),children:[(0,t.jsx)(u.LinkOutlined,{className:"mr-1"}),"Session: ",ep(o),(0,t.jsx)(ec.CopyOutlined,{className:"ml-1 text-gray-400 hover:text-gray-600"})]})}),(c||l?.message)&&(0,t.jsxs)(k.Button,{type:"text",size:"small",className:"text-xs text-blue-500 hover:text-blue-700 p-0 h-auto",onClick:()=>n(!a),children:[a?(0,t.jsx)(ed.DownOutlined,{}):(0,t.jsx)(eu.RightOutlined,{}),(0,t.jsx)("span",{className:"ml-1",children:"Details"})]})]}),a&&(0,t.jsxs)("div",{className:"mt-2 ml-4 p-3 bg-gray-50 rounded-md text-gray-600 border border-gray-200",children:[l?.message&&(0,t.jsxs)("div",{className:"mb-2",children:[(0,t.jsx)("span",{className:"font-medium text-gray-700",children:"Status Message:"}),(0,t.jsx)("span",{className:"ml-2",children:l.message})]}),i&&(0,t.jsxs)("div",{className:"mb-1.5 flex items-center",children:[(0,t.jsx)("span",{className:"font-medium text-gray-700 w-24",children:"Task ID:"}),(0,t.jsx)("code",{className:"ml-2 px-2 py-1 bg-white border border-gray-200 rounded text-xs font-mono",children:i}),(0,t.jsx)(ec.CopyOutlined,{className:"ml-2 cursor-pointer text-gray-400 hover:text-blue-500",onClick:()=>eh(i)})]}),o&&(0,t.jsxs)("div",{className:"mb-1.5 flex items-center",children:[(0,t.jsx)("span",{className:"font-medium text-gray-700 w-24",children:"Session ID:"}),(0,t.jsx)("code",{className:"ml-2 px-2 py-1 bg-white border border-gray-200 rounded text-xs font-mono",children:o}),(0,t.jsx)(ec.CopyOutlined,{className:"ml-2 cursor-pointer text-gray-400 hover:text-blue-500",onClick:()=>eh(o)})]}),c&&Object.keys(c).length>0&&(0,t.jsxs)("div",{className:"mt-3",children:[(0,t.jsx)("span",{className:"font-medium text-gray-700",children:"Custom Metadata:"}),(0,t.jsx)("pre",{className:"mt-1.5 p-2 bg-white border border-gray-200 rounded text-xs font-mono overflow-x-auto whitespace-pre-wrap",children:JSON.stringify(c,null,2)})]})]})]})};var eg=e.i(536916),ey=e.i(28651),ex=e.i(850627);let eb=({temperature:e=1,maxTokens:s=2048,useAdvancedParams:r,onTemperatureChange:a,onMaxTokensChange:n,onUseAdvancedParamsChange:i,mockTestFallbacks:o,onMockTestFallbacksChange:l})=>{let[d,u]=(0,M.useState)(!1),m=void 0!==r?r:d,[p,h]=(0,M.useState)(e),[f,g]=(0,M.useState)(s);(0,M.useEffect)(()=>{h(e)},[e]),(0,M.useEffect)(()=>{g(s)},[s]);let y=e=>{let t=e??1;h(t),a?.(t)},x=e=>{let t=e??1e3;g(t),n?.(t)},b=m?"text-gray-700":"text-gray-400";return(0,t.jsxs)("div",{className:"space-y-4 p-4 w-80",children:[(0,t.jsx)(eg.Checkbox,{checked:m,onChange:e=>{var t;return t=e.target.checked,void(i?i(t):u(t))},children:(0,t.jsx)("span",{className:"font-medium",children:"Use Advanced Parameters"})}),l&&(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsx)(eg.Checkbox,{checked:o??!1,onChange:e=>l(e.target.checked),children:(0,t.jsx)("span",{className:"font-medium",children:"Simulate failure to test fallbacks"})}),(0,t.jsx)(T.Popover,{trigger:"hover",placement:"right",content:(0,t.jsxs)("div",{style:{maxWidth:340},children:[(0,t.jsx)(R.Typography.Paragraph,{className:"text-sm",style:{marginBottom:8},children:"Causes the first request to fail so the router tries fallbacks (if configured). Use this to verify your fallback setup."}),(0,t.jsxs)(R.Typography.Paragraph,{className:"text-sm",style:{marginBottom:0},children:["Behavior can differ when keys, teams, or router settings are configured."," ",(0,t.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/keys_teams_router_settings",target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-800",children:"Learn more"})]})]}),children:(0,t.jsx)(c.InfoCircleOutlined,{className:"text-xs text-gray-400 cursor-pointer shrink-0 hover:text-gray-600","aria-label":"Help: Simulate failure to test fallbacks"})})]}),(0,t.jsxs)("div",{className:"space-y-4 transition-opacity duration-200",style:{opacity:m?1:.4},children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsx)(_.Text,{className:`text-sm ${b}`,children:"Temperature"}),(0,t.jsx)(O.Tooltip,{title:"Controls randomness. Lower values make output more deterministic, higher values more creative.",children:(0,t.jsx)(c.InfoCircleOutlined,{className:`text-xs ${b} cursor-help`})})]}),(0,t.jsx)(ey.InputNumber,{min:0,max:2,step:.1,value:p,onChange:y,disabled:!m,precision:1,className:"w-20"})]}),(0,t.jsx)(ex.Slider,{min:0,max:2,step:.1,value:p,onChange:y,disabled:!m,marks:{0:"0",1:"1.0",2:"2.0"}})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsx)(_.Text,{className:`text-sm ${b}`,children:"Max Tokens"}),(0,t.jsx)(O.Tooltip,{title:"Maximum number of tokens to generate in the response.",children:(0,t.jsx)(c.InfoCircleOutlined,{className:`text-xs ${b} cursor-help`})})]}),(0,t.jsx)(ey.InputNumber,{min:1,max:32768,step:1,value:f,onChange:x,disabled:!m})]}),(0,t.jsx)(ex.Slider,{min:1,max:32768,step:1,value:f,onChange:x,disabled:!m,marks:{1:"1",32768:"32768"}})]})]})]})},ev=({message:e})=>e.isAudio&&"string"==typeof e.content?(0,t.jsx)("div",{className:"mb-2",children:(0,t.jsx)("audio",{controls:!0,src:e.content,className:"max-w-full",style:{maxWidth:"500px"},children:"Your browser does not support the audio element."})}):null;var ew=e.i(785913);let e_={ALLOY:"Alloy - Professional and confident",ASH:"Ash - Casual and relaxed",BALAD:"Ballad - Smooth and melodic",CORAL:"Coral - Warm and engaging",ECHO:"Echo - Friendly and conversational",FABLE:"Fable - Wise and measured",NOVA:"Nova - Friendly and conversational",ONYX:"Onyx - Deep and authoritative",SAGE:"Sage - Wise and measured",SHIMMER:"Shimmer - Bright and cheerful"},ej=Object.entries({ALLOY:"alloy",ASH:"ash",BALAD:"ballad",CORAL:"coral",ECHO:"echo",FABLE:"fable",NOVA:"nova",ONYX:"onyx",SAGE:"sage",SHIMMER:"shimmer"}).map(([e,t])=>({value:t,label:e_[e]})),eS=[{value:ew.EndpointType.CHAT,label:"/v1/chat/completions"},{value:ew.EndpointType.RESPONSES,label:"/v1/responses"},{value:ew.EndpointType.ANTHROPIC_MESSAGES,label:"/v1/messages"},{value:ew.EndpointType.IMAGE,label:"/v1/images/generations"},{value:ew.EndpointType.IMAGE_EDITS,label:"/v1/images/edits"},{value:ew.EndpointType.EMBEDDINGS,label:"/v1/embeddings"},{value:ew.EndpointType.SPEECH,label:"/v1/audio/speech"},{value:ew.EndpointType.TRANSCRIPTION,label:"/v1/audio/transcriptions"},{value:ew.EndpointType.A2A_AGENTS,label:"/v1/a2a/message/send"},{value:ew.EndpointType.MCP,label:"/mcp-rest/tools/call"},{value:ew.EndpointType.REALTIME,label:"/v1/realtime"}];var eN=e.i(657688);let ek=async(e,t)=>({role:"user",content:[{type:"text",text:e},{type:"image_url",image_url:{url:await new Promise((e,s)=>{let r=new FileReader;r.onload=()=>{e(r.result)},r.onerror=s,r.readAsDataURL(t)})}}]}),eE=(e,t,s,r)=>{let a="";t&&r&&(a=r.toLowerCase().endsWith(".pdf")?"[PDF attached]":"[Image attached]");let n={role:"user",content:t?`${e} ${a}`:e};return t&&s&&(n.imagePreviewUrl=s),n},eC=e=>"user"===e.role&&"string"==typeof e.content&&(e.content.includes("[Image attached]")||e.content.includes("[PDF attached]"))&&!!e.imagePreviewUrl;e.s(["createChatDisplayMessage",0,eE,"createChatMultimodalMessage",0,ek,"shouldShowChatAttachedImage",0,eC],964421);let eT=({message:e})=>{if(!eC(e))return null;let s="string"==typeof e.content&&e.content.includes("[PDF attached]");return(0,t.jsx)("div",{className:"mb-2",children:s?(0,t.jsx)("div",{className:"w-64 h-32 rounded-md border border-gray-200 bg-red-50 flex items-center justify-center",children:(0,t.jsx)(l.FilePdfOutlined,{style:{fontSize:"48px",color:"#dc2626"}})}):(0,t.jsx)(eN.default,{src:e.imagePreviewUrl||"",alt:"User uploaded image",width:256,height:200,className:"max-w-64 rounded-md border border-gray-200 shadow-sm",style:{maxHeight:"200px",width:"auto",height:"auto"}})})};e.s(["default",0,eT],843153);var eA=e.i(955719),eA=eA;let{Dragger:eP}=I.Upload,eO=({chatUploadedImage:e,chatImagePreviewUrl:s,onImageUpload:r,onRemoveImage:a})=>(0,t.jsx)(t.Fragment,{children:!e&&(0,t.jsx)(eP,{beforeUpload:r,accept:"image/*,.pdf",showUploadList:!1,className:"inline-block",style:{padding:0,border:"none",background:"none"},children:(0,t.jsx)(O.Tooltip,{title:"Attach image or PDF",children:(0,t.jsx)("button",{type:"button",className:"flex items-center justify-center w-8 h-8 text-gray-400 hover:text-gray-600 hover:bg-gray-100 rounded-md transition-colors",children:(0,t.jsx)(eA.default,{style:{fontSize:"16px"}})})})})});e.s(["default",0,eO],761793);var eR=e.i(362024),eI=e.i(737434),eM=e.i(931067);let eL={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M553.1 509.1l-77.8 99.2-41.1-52.4a8 8 0 00-12.6 0l-99.8 127.2a7.98 7.98 0 006.3 12.9H696c6.7 0 10.4-7.7 6.3-12.9l-136.5-174a8.1 8.1 0 00-12.7 0zM360 442a40 40 0 1080 0 40 40 0 10-80 0zm494.6-153.4L639.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-image",theme:"outlined"};var e$=e.i(9583),eU=M.forwardRef(function(e,t){return M.createElement(e$.default,(0,eM.default)({},e,{ref:t,icon:eL}))});let eD=({code:e,containerId:s,annotations:r=[],accessToken:a})=>{let[i,o]=(0,M.useState)({}),[l,c]=(0,M.useState)({}),d=(0,H.getProxyBaseUrl)();(0,M.useEffect)(()=>{let e=async()=>{for(let e of r)if((e.filename?.toLowerCase().endsWith(".png")||e.filename?.toLowerCase().endsWith(".jpg")||e.filename?.toLowerCase().endsWith(".jpeg")||e.filename?.toLowerCase().endsWith(".gif"))&&e.container_id&&e.file_id){c(t=>({...t,[e.file_id]:!0}));try{let t=await fetch(`${d}/v1/containers/${e.container_id}/files/${e.file_id}/content`,{headers:{[(0,H.getGlobalLitellmHeaderName)()]:`Bearer ${a}`}});if(t.ok){let s=await t.blob(),r=URL.createObjectURL(s);o(t=>({...t,[e.file_id]:r}))}}catch(e){console.error("Error fetching image:",e)}finally{c(t=>({...t,[e.file_id]:!1}))}}};return r.length>0&&a&&e(),()=>{Object.values(i).forEach(e=>URL.revokeObjectURL(e))}},[r,a,d]);let u=async e=>{try{let t=await fetch(`${d}/v1/containers/${e.container_id}/files/${e.file_id}/content`,{headers:{[(0,H.getGlobalLitellmHeaderName)()]:`Bearer ${a}`}});if(t.ok){let s=await t.blob(),r=URL.createObjectURL(s),a=document.createElement("a");a.href=r,a.download=e.filename||`file_${e.file_id}`,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(r)}}catch(e){console.error("Error downloading file:",e)}},p=r.filter(e=>e.filename?.toLowerCase().endsWith(".png")||e.filename?.toLowerCase().endsWith(".jpg")||e.filename?.toLowerCase().endsWith(".jpeg")||e.filename?.toLowerCase().endsWith(".gif")),h=r.filter(e=>!e.filename?.toLowerCase().endsWith(".png")&&!e.filename?.toLowerCase().endsWith(".jpg")&&!e.filename?.toLowerCase().endsWith(".jpeg")&&!e.filename?.toLowerCase().endsWith(".gif"));return e||0!==r.length?(0,t.jsxs)("div",{className:"mt-3 space-y-3",children:[e&&(0,t.jsx)(eR.Collapse,{size:"small",items:[{key:"code",label:(0,t.jsxs)("span",{className:"flex items-center gap-2 text-sm text-gray-600",children:[(0,t.jsx)(n.CodeOutlined,{})," Python Code Executed"]}),children:(0,t.jsx)($.Prism,{language:"python",style:U.coy,customStyle:{margin:0,borderRadius:"6px",fontSize:"12px",maxHeight:"300px",overflow:"auto"},children:e})}]}),p.map(e=>(0,t.jsx)("div",{className:"rounded-lg border border-gray-200 overflow-hidden",children:l[e.file_id]?(0,t.jsxs)("div",{className:"flex items-center justify-center p-8 bg-gray-50",children:[(0,t.jsx)(P.Spin,{indicator:(0,t.jsx)(m.LoadingOutlined,{spin:!0})}),(0,t.jsx)("span",{className:"ml-2 text-sm text-gray-500",children:"Loading image..."})]}):i[e.file_id]?(0,t.jsxs)("div",{children:[(0,t.jsx)("img",{src:i[e.file_id],alt:e.filename||"Generated chart",className:"max-w-full",style:{maxHeight:"400px"}}),(0,t.jsxs)("div",{className:"flex items-center justify-between px-3 py-2 bg-gray-50 border-t border-gray-200",children:[(0,t.jsxs)("span",{className:"text-xs text-gray-500 flex items-center gap-1",children:[(0,t.jsx)(eU,{})," ",e.filename]}),(0,t.jsxs)("button",{onClick:()=>u(e),className:"text-xs text-blue-500 hover:text-blue-700 flex items-center gap-1",children:[(0,t.jsx)(eI.DownloadOutlined,{})," Download"]})]})]}):(0,t.jsx)("div",{className:"flex items-center justify-center p-4 bg-gray-50",children:(0,t.jsx)("span",{className:"text-sm text-gray-400",children:"Image not available"})})},e.file_id)),h.length>0&&(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:h.map(e=>(0,t.jsxs)("button",{onClick:()=>u(e),className:"flex items-center gap-2 px-3 py-2 bg-gray-50 border border-gray-200 rounded-lg hover:bg-gray-100 transition-colors",children:[(0,t.jsx)(em.FileTextOutlined,{className:"text-blue-500"}),(0,t.jsx)("span",{className:"text-sm",children:e.filename}),(0,t.jsx)(eI.DownloadOutlined,{className:"text-gray-400"})]},e.file_id))})]}):null};var eB=e.i(790848),eq=e.i(998573);let ez=({enabled:e,onEnabledChange:s,selectedModel:r,disabled:a=!1})=>{let i=(e=>{if(!e)return!1;let t=e.toLowerCase();return t.startsWith("openai/")||t.startsWith("gpt-")||t.startsWith("o1")||t.startsWith("o3")||t.includes("openai")})(r);return(0,t.jsxs)("div",{className:"border border-gray-200 rounded-lg p-3 bg-gradient-to-r from-blue-50 to-purple-50",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(n.CodeOutlined,{className:"text-blue-500"}),(0,t.jsx)(_.Text,{className:"font-medium text-gray-700",children:"Code Interpreter"}),(0,t.jsx)(O.Tooltip,{title:"Run Python code to generate files, charts, and analyze data. Container is created automatically.",children:(0,t.jsx)(c.InfoCircleOutlined,{className:"text-gray-400 text-xs"})})]}),(0,t.jsx)(eB.Switch,{checked:e&&i,onChange:e=>{e&&!i?eq.message.warning("Code Interpreter is only available for OpenAI models"):s(e)},disabled:a||!i,size:"small",className:e&&i?"bg-blue-500":""})]}),!i&&(0,t.jsx)("div",{className:"mt-2 pt-2 border-t border-gray-200",children:(0,t.jsxs)("div",{className:"flex items-start gap-2",children:[(0,t.jsx)(el.ExclamationCircleOutlined,{className:"text-amber-500 mt-0.5"}),(0,t.jsxs)("div",{className:"text-xs text-gray-600",children:[(0,t.jsx)("span",{children:"Code Interpreter is currently only supported for OpenAI models. "}),(0,t.jsx)("a",{href:"https://github.com/BerriAI/litellm/issues/new?template=feature_request.yml",target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-800 underline",children:"Request support for other providers"})]})]})})]})};var eF=e.i(190272);let eW=({endpointType:e,onEndpointChange:s,className:r})=>(0,t.jsx)("div",{className:r,children:(0,t.jsx)(A.Select,{showSearch:!0,value:e,style:{width:"100%"},onChange:s,options:eS,className:"rounded-md",filterOption:(e,t)=>(t?.label??"").toLowerCase().includes(e.toLowerCase())||(t?.value??"").toLowerCase().includes(e.toLowerCase())})});var eH=e.i(437902);let{Text:eJ}=R.Typography,{Panel:eG}=eR.Collapse,eV=({events:e,className:s})=>{if(console.log("MCPEventsDisplay: Received events:",e),!e||0===e.length)return console.log("MCPEventsDisplay: No events, returning null"),null;let r=e.find(e=>"response.output_item.done"===e.type&&e.item?.type==="mcp_list_tools"&&e.item.tools&&e.item.tools.length>0),a=e.filter(e=>"response.output_item.done"===e.type&&e.item?.type==="mcp_call");return(console.log("MCPEventsDisplay: toolsEvent:",r),console.log("MCPEventsDisplay: mcpCallEvents:",a),r||0!==a.length)?(0,t.jsxs)("div",{className:`jsx-32b14b04f420f3ac mcp-events-display ${s||""}`,children:[(0,t.jsx)(eH.default,{id:"32b14b04f420f3ac",children:".openai-mcp-tools.jsx-32b14b04f420f3ac{margin:0;padding:0;position:relative}.openai-mcp-tools.jsx-32b14b04f420f3ac .ant-collapse.jsx-32b14b04f420f3ac,.openai-mcp-tools.jsx-32b14b04f420f3ac .ant-collapse-item.jsx-32b14b04f420f3ac{background:0 0!important;border:none!important}.openai-mcp-tools.jsx-32b14b04f420f3ac .ant-collapse-header.jsx-32b14b04f420f3ac{color:#9ca3af!important;background:0 0!important;border:none!important;min-height:20px!important;padding:0 0 0 20px!important;font-size:14px!important;font-weight:400!important;line-height:20px!important}.openai-mcp-tools.jsx-32b14b04f420f3ac .ant-collapse-header.jsx-32b14b04f420f3ac:hover{color:#6b7280!important;background:0 0!important}.openai-mcp-tools.jsx-32b14b04f420f3ac .ant-collapse-content.jsx-32b14b04f420f3ac{background:0 0!important;border:none!important}.openai-mcp-tools.jsx-32b14b04f420f3ac .ant-collapse-content-box.jsx-32b14b04f420f3ac{padding:4px 0 0 20px!important}.openai-mcp-tools.jsx-32b14b04f420f3ac .ant-collapse-expand-icon.jsx-32b14b04f420f3ac{color:#9ca3af!important;justify-content:center!important;align-items:center!important;width:16px!important;height:16px!important;font-size:10px!important;display:flex!important;position:absolute!important;top:2px!important;left:2px!important}.openai-mcp-tools.jsx-32b14b04f420f3ac .ant-collapse-expand-icon.jsx-32b14b04f420f3ac:hover{color:#6b7280!important}.openai-vertical-line.jsx-32b14b04f420f3ac{opacity:.8;background-color:#f3f4f6;width:.5px;position:absolute;top:18px;bottom:0;left:9px}.tool-item.jsx-32b14b04f420f3ac{color:#4b5563;z-index:1;background:#fff;margin:0;padding:0;font-family:ui-monospace,SFMono-Regular,SF Mono,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:13px;line-height:18px;position:relative}.mcp-section.jsx-32b14b04f420f3ac{z-index:1;background:#fff;margin-bottom:12px;position:relative}.mcp-section.jsx-32b14b04f420f3ac:last-child{margin-bottom:0}.mcp-section-header.jsx-32b14b04f420f3ac{color:#6b7280;margin-bottom:4px;font-size:13px;font-weight:500}.mcp-code-block.jsx-32b14b04f420f3ac{background:#f9fafb;border:1px solid #f3f4f6;border-radius:6px;padding:8px;font-size:12px}.mcp-json.jsx-32b14b04f420f3ac{color:#374151;white-space:pre-wrap;word-wrap:break-word;margin:0;font-family:ui-monospace,SFMono-Regular,SF Mono,Monaco,Consolas,Liberation Mono,Courier New,monospace}.mcp-approved.jsx-32b14b04f420f3ac{color:#6b7280;align-items:center;font-size:13px;display:flex}.mcp-checkmark.jsx-32b14b04f420f3ac{color:#10b981;margin-right:6px;font-weight:700}.mcp-response-content.jsx-32b14b04f420f3ac{color:#374151;white-space:pre-wrap;font-family:ui-monospace,SFMono-Regular,SF Mono,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:13px;line-height:1.5}"}),(0,t.jsxs)("div",{className:"jsx-32b14b04f420f3ac openai-mcp-tools",children:[(0,t.jsx)("div",{className:"jsx-32b14b04f420f3ac openai-vertical-line"}),(0,t.jsxs)(eR.Collapse,{ghost:!0,size:"small",expandIconPosition:"start",defaultActiveKey:r?["list-tools"]:a.map((e,t)=>`mcp-call-${t}`),children:[r&&(0,t.jsx)(eG,{header:"List tools",children:(0,t.jsx)("div",{className:"jsx-32b14b04f420f3ac",children:r.item?.tools?.map((e,s)=>(0,t.jsx)("div",{className:"jsx-32b14b04f420f3ac tool-item",children:e.name},s))})},"list-tools"),a.map((e,s)=>(0,t.jsx)(eG,{header:e.item?.name||"Tool call",children:(0,t.jsxs)("div",{className:"jsx-32b14b04f420f3ac",children:[(0,t.jsxs)("div",{className:"jsx-32b14b04f420f3ac mcp-section",children:[(0,t.jsx)("div",{className:"jsx-32b14b04f420f3ac mcp-section-header",children:"Request"}),(0,t.jsx)("div",{className:"jsx-32b14b04f420f3ac mcp-code-block",children:e.item?.arguments&&(0,t.jsx)("pre",{className:"jsx-32b14b04f420f3ac mcp-json",children:(()=>{try{return JSON.stringify(JSON.parse(e.item.arguments),null,2)}catch(t){return e.item.arguments}})()})})]}),(0,t.jsx)("div",{className:"jsx-32b14b04f420f3ac mcp-section",children:(0,t.jsxs)("div",{className:"jsx-32b14b04f420f3ac mcp-approved",children:[(0,t.jsx)("span",{className:"jsx-32b14b04f420f3ac mcp-checkmark",children:"✓"})," Approved"]})}),e.item?.output&&(0,t.jsxs)("div",{className:"jsx-32b14b04f420f3ac mcp-section",children:[(0,t.jsx)("div",{className:"jsx-32b14b04f420f3ac mcp-section-header",children:"Response"}),(0,t.jsx)("div",{className:"jsx-32b14b04f420f3ac mcp-response-content",children:e.item.output})]})]})},`mcp-call-${s}`))]})]})]}):(console.log("MCPEventsDisplay: No valid events found, returning null"),null)};var eK=e.i(812618);let eX=({reasoningContent:e})=>{let[s,r]=(0,M.useState)(!0);return e?(0,t.jsxs)("div",{className:"reasoning-content mt-1 mb-2",children:[(0,t.jsxs)(k.Button,{type:"text",className:"flex items-center text-xs text-gray-500 hover:text-gray-700",onClick:()=>r(!s),icon:(0,t.jsx)(eK.BulbOutlined,{}),children:[s?"Hide reasoning":"Show reasoning",s?(0,t.jsx)(ed.DownOutlined,{className:"ml-1"}):(0,t.jsx)(eu.RightOutlined,{className:"ml-1"})]}),s&&(0,t.jsx)("div",{className:"mt-2 p-3 bg-gray-50 border border-gray-200 rounded-md text-sm text-gray-700",children:(0,t.jsx)(L.default,{components:{code({node:e,inline:s,className:r,children:a,...n}){let i=/language-(\w+)/.exec(r||"");return!s&&i?(0,t.jsx)($.Prism,{style:U.coy,language:i[1],PreTag:"div",className:"rounded-md my-2",...n,children:String(a).replace(/\n$/,"")}):(0,t.jsx)("code",{className:`${r} px-1.5 py-0.5 rounded bg-gray-100 text-sm font-mono`,...n,children:a})}},children:e})})]}):null};e.s(["default",0,eX],966988);var eY=e.i(989022);let eQ=async(e,t)=>{let s=await new Promise((e,s)=>{let r=new FileReader;r.onload=()=>{e(r.result.split(",")[1])},r.onerror=s,r.readAsDataURL(t)}),r=t.type||(t.name.toLowerCase().endsWith(".pdf")?"application/pdf":"image/jpeg");return{role:"user",content:[{type:"input_text",text:e},{type:"input_image",image_url:`data:${r};base64,${s}`}]}},eZ=(e,t,s,r)=>{let a="";t&&r&&(a=r.toLowerCase().endsWith(".pdf")?"[PDF attached]":"[Image attached]");let n={role:"user",content:t?`${e} ${a}`:e};return t&&s&&(n.imagePreviewUrl=s),n},e0=({message:e})=>{if(!("user"===e.role&&"string"==typeof e.content&&(e.content.includes("[Image attached]")||e.content.includes("[PDF attached]"))&&e.imagePreviewUrl))return null;let s="string"==typeof e.content&&e.content.includes("[PDF attached]");return(0,t.jsx)("div",{className:"mb-2",children:s?(0,t.jsx)("div",{className:"w-64 h-32 rounded-md border border-gray-200 bg-red-50 flex items-center justify-center",children:(0,t.jsx)(l.FilePdfOutlined,{style:{fontSize:"48px",color:"#dc2626"}})}):(0,t.jsx)("img",{src:e.imagePreviewUrl,alt:"User uploaded image",className:"max-w-64 rounded-md border border-gray-200 shadow-sm",style:{maxHeight:"200px"}})})};var eA=eA;let{Dragger:e1}=I.Upload,e2=({responsesUploadedImage:e,responsesImagePreviewUrl:s,onImageUpload:r,onRemoveImage:a})=>(0,t.jsx)(t.Fragment,{children:!e&&(0,t.jsx)(e1,{beforeUpload:r,accept:"image/*,.pdf",showUploadList:!1,className:"inline-block",style:{padding:0,border:"none",background:"none"},children:(0,t.jsx)(O.Tooltip,{title:"Attach image or PDF",children:(0,t.jsx)("button",{type:"button",className:"flex items-center justify-center w-8 h-8 text-gray-400 hover:text-gray-600 hover:bg-gray-100 rounded-md transition-colors",children:(0,t.jsx)(eA.default,{style:{fontSize:"16px"}})})})})});function e4({searchResults:e}){let[s,r]=(0,M.useState)(!0),[a,n]=(0,M.useState)({});if(!e||0===e.length)return null;let o=e.reduce((e,t)=>e+t.data.length,0);return(0,t.jsxs)("div",{className:"search-results-content mt-1 mb-2",children:[(0,t.jsxs)(k.Button,{type:"text",className:"flex items-center text-xs text-gray-500 hover:text-gray-700",onClick:()=>r(!s),icon:(0,t.jsx)(i.DatabaseOutlined,{}),children:[s?"Hide sources":`Show sources (${o})`,s?(0,t.jsx)(ed.DownOutlined,{className:"ml-1"}):(0,t.jsx)(eu.RightOutlined,{className:"ml-1"})]}),s&&(0,t.jsx)("div",{className:"mt-2 p-3 bg-gray-50 border border-gray-200 rounded-md text-sm",children:(0,t.jsx)("div",{className:"space-y-3",children:e.map((e,s)=>(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"text-xs text-gray-600 mb-2 flex items-center gap-2",children:[(0,t.jsx)("span",{className:"font-medium",children:"Query:"}),(0,t.jsxs)("span",{className:"italic",children:['"',e.search_query,'"']}),(0,t.jsx)("span",{className:"text-gray-400",children:"•"}),(0,t.jsxs)("span",{className:"text-gray-500",children:[e.data.length," result",1!==e.data.length?"s":""]})]}),(0,t.jsx)("div",{className:"space-y-2",children:e.data.map((e,r)=>{let i=a[`${s}-${r}`]||!1;return(0,t.jsxs)("div",{className:"border border-gray-200 rounded-md overflow-hidden bg-white",children:[(0,t.jsx)("div",{className:"flex items-center justify-between p-2 cursor-pointer hover:bg-gray-50 transition-colors",onClick:()=>{let e;return e=`${s}-${r}`,void n(t=>({...t,[e]:!t[e]}))},children:(0,t.jsxs)("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[(0,t.jsx)("svg",{className:`w-4 h-4 text-gray-400 transition-transform flex-shrink-0 ${i?"transform rotate-90":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),(0,t.jsx)(em.FileTextOutlined,{className:"text-gray-400 flex-shrink-0",style:{fontSize:"12px"}}),(0,t.jsx)("span",{className:"text-xs font-medium text-gray-700 truncate",children:e.filename||e.file_id||`Result ${r+1}`}),(0,t.jsx)("span",{className:"text-xs px-2 py-0.5 rounded bg-blue-100 text-blue-700 font-mono flex-shrink-0",children:e.score.toFixed(3)})]})}),i&&(0,t.jsx)("div",{className:"border-t border-gray-200 bg-white",children:(0,t.jsxs)("div",{className:"p-3 space-y-2",children:[e.content.map((e,s)=>(0,t.jsx)("div",{children:(0,t.jsx)("div",{className:"text-xs font-mono bg-gray-50 p-2 rounded text-gray-800 whitespace-pre-wrap break-words",children:e.text})},s)),e.attributes&&Object.keys(e.attributes).length>0&&(0,t.jsxs)("div",{className:"mt-2 pt-2 border-t border-gray-100",children:[(0,t.jsx)("div",{className:"text-xs text-gray-500 mb-1 font-medium",children:"Metadata:"}),(0,t.jsx)("div",{className:"space-y-1",children:Object.entries(e.attributes).map(([e,s])=>(0,t.jsxs)("div",{className:"text-xs flex gap-2",children:[(0,t.jsxs)("span",{className:"text-gray-500 font-medium",children:[e,":"]}),(0,t.jsx)("span",{className:"text-gray-700 font-mono break-all",children:String(s)})]},e))})]})]})})]},r)})})]},s))})})]})}e.s(["SearchResultsDisplay",()=>e4],152401);let e3=({endpointType:e,responsesSessionId:s,useApiSessionManagement:r,onToggleSessionManagement:a})=>e!==ew.EndpointType.RESPONSES?null:(0,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Session Management"}),(0,t.jsx)(O.Tooltip,{title:"Choose between LiteLLM API session management (using previous_response_id) or UI-based session management (using chat history)",children:(0,t.jsx)(c.InfoCircleOutlined,{className:"text-gray-400",style:{fontSize:"12px"}})})]}),(0,t.jsx)(eB.Switch,{checked:r,onChange:a,checkedChildren:"API",unCheckedChildren:"UI",size:"small"})]}),(0,t.jsxs)("div",{className:`text-xs p-2 rounded-md ${s?"bg-green-50 text-green-700 border border-green-200":"bg-blue-50 text-blue-700 border border-blue-200"}`,children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsx)(c.InfoCircleOutlined,{style:{fontSize:"12px"}}),(()=>{if(!s)return r?"API Session: Ready":"UI Session: Ready";let e=r?"Response ID":"UI Session",t=s.slice(0,10);return`${e}: ${t}...`})()]}),s&&(0,t.jsx)(O.Tooltip,{title:(0,t.jsxs)("div",{className:"text-xs",children:[(0,t.jsx)("div",{className:"mb-1",children:"Copy response ID to continue session:"}),(0,t.jsx)("div",{className:"bg-gray-800 text-gray-100 p-2 rounded font-mono text-xs whitespace-pre-wrap",children:`curl -X POST "your-proxy-url/v1/responses" \\ - -H "Authorization: Bearer your-api-key" \\ - -H "Content-Type: application/json" \\ - -d '{ - "model": "your-model", - "input": [{"role": "user", "content": "your message", "type": "message"}], - "previous_response_id": "${s}", - "stream": true - }'`})]}),overlayStyle:{maxWidth:"500px"},children:(0,t.jsx)("button",{onClick:()=>{s&&(navigator.clipboard.writeText(s),W.default.success("Response ID copied to clipboard!"))},className:"ml-2 p-1 hover:bg-green-100 rounded transition-colors",children:(0,t.jsx)(ec.CopyOutlined,{style:{fontSize:"12px"}})})})]}),(0,t.jsx)("div",{className:"text-xs opacity-75 mt-1",children:s?r?"LiteLLM API session active - context maintained server-side":"UI session active - context maintained client-side":r?"LiteLLM will manage session using previous_response_id":"UI will manage session using chat history"})]})]});var e5={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"defs",attrs:{},children:[{tag:"style",attrs:{}}]},{tag:"path",attrs:{d:"M682 455V311l-76 76v68c-.1 50.7-42 92.1-94 92a95.8 95.8 0 01-52-15l-54 55c29.1 22.4 65.9 36 106 36 93.8 0 170-75.1 170-168z"}},{tag:"path",attrs:{d:"M833 446h-60c-4.4 0-8 3.6-8 8 0 140.3-113.7 254-254 254-63 0-120.7-23-165-61l-54 54a334.01 334.01 0 00179 81v102H326c-13.9 0-24.9 14.3-25 32v36c.1 4.4 2.9 8 6 8h408c3.2 0 6-3.6 6-8v-36c0-17.7-11-32-25-32H547V782c165.3-17.9 294-157.9 294-328 0-4.4-3.6-8-8-8zm13.1-377.7l-43.5-41.9a8 8 0 00-11.2.1l-129 129C634.3 101.2 577 64 511 64c-93.9 0-170 75.3-170 168v224c0 6.7.4 13.3 1.2 19.8l-68 68A252.33 252.33 0 01258 454c-.2-4.4-3.8-8-8-8h-60c-4.4 0-8 3.6-8 8 0 53 12.5 103 34.6 147.4l-137 137a8.03 8.03 0 000 11.3l42.7 42.7c3.1 3.1 8.2 3.1 11.3 0L846.2 79.8l.1-.1c3.1-3.2 3-8.3-.2-11.4zM417 401V232c0-50.6 41.9-92 94-92 46 0 84.1 32.3 92.3 74.7L417 401z"}}]},name:"audio-muted",theme:"outlined"},e6=M.forwardRef(function(e,t){return M.createElement(e$.default,(0,eM.default)({},e,{ref:t,icon:e5}))}),e8=e.i(793916),e7=e.i(518617),e9=e.i(84899);let{Text:te}=R.Typography,tt=({accessToken:e,selectedModel:s,customProxyBaseUrl:r,selectedGuardrails:a})=>{let[n,i]=(0,M.useState)([]),[o,l]=(0,M.useState)(""),[c,d]=(0,M.useState)(!1),[u,m]=(0,M.useState)(!1),[p,h]=(0,M.useState)(!1),[f,g]=(0,M.useState)("alloy"),x=(0,M.useRef)(null),b=(0,M.useRef)(null),v=(0,M.useRef)(null),w=(0,M.useRef)(null);(0,M.useRef)([]),(0,M.useRef)(!1);let _=(0,M.useRef)(null),j=(0,M.useRef)(0),S=(0,M.useCallback)(()=>{_.current?.scrollIntoView({behavior:"smooth"})},[]);(0,M.useEffect)(()=>{S()},[n,S]);let N=(0,M.useCallback)((e,t)=>{i(s=>[...s,{role:e,content:t,timestamp:new Date}])},[]),C=(0,M.useCallback)(e=>{i(t=>{let s=t[t.length-1];return s&&"assistant"===s.role?[...t.slice(0,-1),{...s,content:s.content+e}]:[...t,{role:"assistant",content:e,timestamp:new Date}]})},[]),T=(0,M.useCallback)(e=>{let t=atob(e),s=new Uint8Array(t.length);for(let e=0;e{if(!x.current){if(!s)return void N("status","Please select a model first");m(!0);try{b.current=new AudioContext({sampleRate:24e3});let t=(r||(0,H.getProxyBaseUrl)()).replace(/^http/,"ws"),n=`${t}/v1/realtime?model=${encodeURIComponent(s)}`;a&&a.length>0&&(n+=`&guardrails=${encodeURIComponent(a.join(","))}`);let o=new WebSocket(n,["realtime",`openai-insecure-api-key.${e}`]);o.onopen=()=>{d(!0),m(!1),N("status","Connected to realtime API")},o.onmessage=async e=>{try{let t=e.data;t instanceof Blob?t=await t.text():t instanceof ArrayBuffer&&(t=new TextDecoder().decode(t));let s=JSON.parse(t),r=s.type;"session.created"===r?o.send(JSON.stringify({type:"session.update",session:{modalities:["text","audio"],voice:f,input_audio_format:"pcm16",output_audio_format:"pcm16",input_audio_transcription:{model:"gpt-4o-mini-transcribe"},turn_detection:null}})):"session.updated"===r||("response.audio.delta"===r?s.delta&&T(s.delta):"response.audio_transcript.delta"===r||"response.text.delta"===r?s.delta&&C(s.delta):"conversation.item.input_audio_transcription.completed"===r?s.transcript&&N("user",s.transcript):"response.done"===r?i(e=>{let t=e[e.length-1];if(t&&"assistant"===t.role&&t.content)return e;let r=s.response?.output||[],a=[];for(let e of r)for(let t of e.content||[]){let e=t.text||t.transcript;e&&a.push(e)}return a.length>0?[...e,{role:"assistant",content:a.join(""),timestamp:new Date}]:e}):"error"===r&&N("status",`Error: ${s.error?.message||JSON.stringify(s.error)}`))}catch{}},o.onerror=()=>{N("status","WebSocket error"),d(!1),m(!1)},o.onclose=()=>{N("status","Disconnected"),d(!1),m(!1),x.current=null},x.current=o}catch(e){N("status",`Connection failed: ${e.message}`),m(!1)}}},[e,s,f,r,a,N,C,T]),O=(0,M.useCallback)(()=>{I(),x.current?.close(),x.current=null,b.current?.close(),b.current=null,j.current=0,L.current=!1,d(!1)},[]),R=(0,M.useCallback)(async()=>{if(x.current&&x.current.readyState===WebSocket.OPEN){x.current.send(JSON.stringify({type:"session.update",session:{modalities:["text","audio"],voice:f,input_audio_format:"pcm16",output_audio_format:"pcm16",input_audio_transcription:{model:"gpt-4o-mini-transcribe"},turn_detection:{type:"server_vad"}}}));try{let e=await navigator.mediaDevices.getUserMedia({audio:!0});v.current=e;let t=b.current||new AudioContext({sampleRate:24e3});b.current=t;let s=t.createMediaStreamSource(e),r=t.createScriptProcessor(4096,1,1);w.current=r,r.onaudioprocess=e=>{let s;if(!x.current||x.current.readyState!==WebSocket.OPEN)return;let r=e.inputBuffer.getChannelData(0),a=t.sampleRate;if(24e3!==a){let e=a/24e3,t=Math.round(r.length/e);s=new Float32Array(t);for(let a=0;a{w.current?.disconnect(),w.current=null,v.current?.getTracks().forEach(e=>e.stop()),v.current=null,h(!1)},[]),L=(0,M.useRef)(!1),$=(0,M.useCallback)(()=>{!x.current||x.current.readyState!==WebSocket.OPEN||L.current||(L.current=!0,x.current.send(JSON.stringify({type:"session.update",session:{modalities:["text","audio"],voice:f,input_audio_format:"pcm16",output_audio_format:"pcm16",input_audio_transcription:{model:"gpt-4o-mini-transcribe"},turn_detection:null}})))},[f]),U=(0,M.useCallback)(()=>{if(!o.trim()||!x.current||x.current.readyState!==WebSocket.OPEN)return;let e=o.trim();N("user",e),l(""),x.current.send(JSON.stringify({type:"conversation.item.create",item:{type:"message",role:"user",content:[{type:"input_text",text:e}]}})),x.current.send(JSON.stringify({type:"response.create"}))},[o,N,$]);return(0,M.useEffect)(()=>()=>{x.current?.close(),b.current?.close(),v.current?.getTracks().forEach(e=>e.stop())},[]),(0,t.jsxs)("div",{className:"flex flex-col h-full",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-200 bg-gray-50",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)(y.SoundOutlined,{className:"text-lg text-blue-500"}),(0,t.jsx)(te,{className:"font-semibold text-gray-800",children:"Realtime Voice Chat"}),(0,t.jsx)("span",{className:`inline-block w-2 h-2 rounded-full ${c?"bg-green-500":"bg-gray-300"}`}),(0,t.jsx)(te,{className:"text-xs text-gray-500",children:c?"Connected":u?"Connecting...":"Disconnected"})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(A.Select,{size:"small",value:f,onChange:g,options:ej,style:{width:220},disabled:c}),c?(0,t.jsx)(k.Button,{danger:!0,onClick:O,size:"small",icon:(0,t.jsx)(e7.CloseCircleOutlined,{}),children:"Disconnect"}):(0,t.jsx)(k.Button,{type:"primary",onClick:P,loading:u,size:"small",children:"Connect"})]})]}),(0,t.jsxs)("div",{className:"flex-1 overflow-y-auto p-4 space-y-3",children:[0===n.length&&!c&&(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center h-full text-gray-400 gap-3",children:[(0,t.jsx)(y.SoundOutlined,{style:{fontSize:48}}),(0,t.jsx)(te,{className:"text-lg text-gray-500",children:"Realtime Voice Playground"}),(0,t.jsxs)(te,{className:"text-sm text-gray-400 text-center max-w-md",children:["Click ",(0,t.jsx)("b",{children:"Connect"})," to start a realtime session. You can speak using your microphone or type messages. The AI will respond with voice and text."]})]}),n.map((e,s)=>(0,t.jsx)("div",{className:`flex ${"user"===e.role?"justify-end":"status"===e.role?"justify-center":"justify-start"}`,children:"status"===e.role?(0,t.jsx)("div",{className:"text-xs text-gray-400 italic px-3 py-1",children:e.content}):(0,t.jsxs)("div",{className:`max-w-[75%] rounded-2xl px-4 py-2.5 ${"user"===e.role?"bg-blue-500 text-white rounded-br-md":"bg-gray-100 text-gray-800 rounded-bl-md"}`,children:[(0,t.jsx)("div",{className:"text-xs font-medium mb-0.5 opacity-70",children:"user"===e.role?"You":"AI"}),(0,t.jsx)("div",{className:"text-sm whitespace-pre-wrap",children:e.content})]})},s)),(0,t.jsx)("div",{ref:_})]}),c&&(0,t.jsxs)("div",{className:"border-t border-gray-200 p-3 bg-white",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(k.Button,{shape:"circle",size:"large",type:p?"primary":"default",danger:p,icon:p?(0,t.jsx)(e6,{}):(0,t.jsx)(e8.AudioOutlined,{}),onClick:p?I:R,title:p?"Stop recording":"Start recording",className:p?"animate-pulse":""}),(0,t.jsx)(E.Input,{placeholder:"Type a message or use the mic...",value:o,onChange:e=>l(e.target.value),onPressEnter:U,className:"flex-1",size:"large"}),(0,t.jsx)(k.Button,{type:"primary",icon:(0,t.jsx)(e9.SendOutlined,{}),onClick:U,disabled:!o.trim(),size:"large"})]}),p&&(0,t.jsxs)("div",{className:"mt-2 flex items-center gap-2 text-red-500 text-xs",children:[(0,t.jsx)("span",{className:"inline-block w-2 h-2 rounded-full bg-red-500 animate-pulse"}),"Listening — speak into your microphone. Server VAD will detect when you stop."]})]})]})},{TextArea:ts}=E.Input,{Dragger:tr}=I.Upload,ta=new Set([ew.EndpointType.CHAT,ew.EndpointType.RESPONSES,ew.EndpointType.MCP]);e.s(["default",0,({accessToken:e,token:E,userRole:I,userID:es,disabledPersonalKeyCreation:ei,proxySettings:eo,simplified:el=!1,fixedModel:ec})=>{let ed,[eu,em]=(0,M.useState)([]),[ep,eh]=(0,M.useState)(()=>{let e=sessionStorage.getItem("selectedMCPServers");try{return e?JSON.parse(e):[]}catch(e){return console.error("Error parsing selectedMCPServers from sessionStorage",e),[]}}),[eg,ey]=(0,M.useState)(!1),[ex,e_]=(0,M.useState)({}),[eS,eN]=(0,M.useState)(void 0),eC=(0,M.useRef)(null),[eA,eP]=(0,M.useState)(()=>{let e=sessionStorage.getItem("mcpServerToolRestrictions");try{return e?JSON.parse(e):{}}catch(e){return console.error("Error parsing mcpServerToolRestrictions from sessionStorage",e),{}}}),[eR,eI]=(0,M.useState)(()=>{let e=sessionStorage.getItem("apiKeySource");if(e)try{return JSON.parse(e)}catch(e){console.error("Error parsing apiKeySource from sessionStorage",e)}return ei?"custom":"session"}),[eM,eL]=(0,M.useState)(()=>sessionStorage.getItem("apiKey")||""),[e$,eU]=(0,M.useState)(()=>sessionStorage.getItem("customProxyBaseUrl")||""),[eB,eq]=(0,M.useState)(""),[eH,eJ]=(0,M.useState)(()=>{if(el)return[];try{let e=sessionStorage.getItem("chatHistory");return e?JSON.parse(e):[]}catch(e){return console.error("Error parsing chatHistory from sessionStorage",e),[]}}),[eG,eK]=(0,M.useState)(el?ec:void 0),[e1,e5]=(0,M.useState)(!1),[e6,e8]=(0,M.useState)([]),[e7,e9]=(0,M.useState)([]),[te,tn]=(0,M.useState)(void 0),ti=(0,M.useRef)(null),[to,tl]=(0,M.useState)(()=>sessionStorage.getItem("endpointType")||ew.EndpointType.CHAT),[tc,td]=(0,M.useState)(!1),tu=(0,M.useRef)(null),[tm,tp]=(0,M.useState)(()=>{let e=sessionStorage.getItem("selectedTags");try{return e?JSON.parse(e):[]}catch(e){return console.error("Error parsing selectedTags from sessionStorage",e),[]}}),[th,tf]=(0,M.useState)(()=>{let e=sessionStorage.getItem("selectedVoice");if(!e)return"alloy";try{return JSON.parse(e)}catch{return e}}),[tg,ty]=(0,M.useState)(()=>{let e=sessionStorage.getItem("selectedVectorStores");try{return e?JSON.parse(e):[]}catch(e){return console.error("Error parsing selectedVectorStores from sessionStorage",e),[]}}),[tx,tb]=(0,M.useState)(()=>{let e=sessionStorage.getItem("selectedGuardrails");try{return e?JSON.parse(e):[]}catch(e){return console.error("Error parsing selectedGuardrails from sessionStorage",e),[]}}),[tv,tw]=(0,M.useState)(()=>{let e=sessionStorage.getItem("selectedPolicies");try{return e?JSON.parse(e):[]}catch(e){return console.error("Error parsing selectedPolicies from sessionStorage",e),[]}}),[t_,tj]=(0,M.useState)(()=>sessionStorage.getItem("messageTraceId")||null),[tS,tN]=(0,M.useState)(()=>sessionStorage.getItem("responsesSessionId")||null),[tk,tE]=(0,M.useState)(()=>{let e=sessionStorage.getItem("useApiSessionManagement");return!e||JSON.parse(e)}),[tC,tT]=(0,M.useState)([]),[tA,tP]=(0,M.useState)([]),[tO,tR]=(0,M.useState)(null),[tI,tM]=(0,M.useState)(null),[tL,t$]=(0,M.useState)(null),[tU,tD]=(0,M.useState)(null),[tB,tq]=(0,M.useState)(null),[tz,tF]=(0,M.useState)(!1),[tW,tH]=(0,M.useState)(""),[tJ,tG]=(0,M.useState)("openai"),[tV,tK]=(0,M.useState)([]),[tX,tY]=(0,M.useState)(1),[tQ,tZ]=(0,M.useState)(2048),[t0,t1]=(0,M.useState)(!1),[t2,t4]=(0,M.useState)(!1),t3=function(){let[e,t]=(0,M.useState)(()=>{let e=sessionStorage.getItem("codeInterpreterEnabled");return!!e&&JSON.parse(e)}),[s,r]=(0,M.useState)(null),a=(0,M.useCallback)(e=>{t(e),sessionStorage.setItem("codeInterpreterEnabled",JSON.stringify(e))},[]),n=(0,M.useCallback)(()=>{r(null)},[]),i=(0,M.useCallback)(()=>{a(!e)},[e,a]);return{enabled:e,result:s,setEnabled:a,setResult:r,clearResult:n,toggle:i}}(),t5=(0,M.useRef)(null),t6=async()=>{let t="session"===eR?e:eM;if(t){ey(!0);try{let e=await (0,H.fetchMCPServers)(t);em(Array.isArray(e)?e:e.data||[])}catch(e){console.error("Error fetching MCP servers:",e)}finally{ey(!1)}}};(0,M.useEffect)(()=>{el&&ec&&(eK(ec),tl(ew.EndpointType.CHAT))},[el,ec]);let t8=async t=>{let s="session"===eR?e:eM;if(s&&!ex[t])try{let e=await (0,H.listMCPTools)(s,t);e_(s=>({...s,[t]:e.tools||[]}))}catch(e){console.error(`Error fetching tools for server ${t}:`,e)}};(0,M.useEffect)(()=>{if(tz){let t=(0,eF.generateCodeSnippet)({apiKeySource:eR,accessToken:e,apiKey:eM,inputMessage:eB,chatHistory:eH,selectedTags:tm,selectedVectorStores:tg,selectedGuardrails:tx,selectedPolicies:tv,selectedMCPServers:ep,mcpServers:eu,mcpServerToolRestrictions:eA,endpointType:to,selectedModel:eG,selectedSdk:tJ,selectedVoice:th,proxySettings:eo});tH(t)}},[tz,tJ,eR,e,eM,eB,eH,tm,tg,tx,tv,ep,eu,eA,to,eG,eo]),(0,M.useEffect)(()=>{if(el)return;let e=setTimeout(()=>{sessionStorage.setItem("chatHistory",JSON.stringify(eH))},500);return()=>{clearTimeout(e)}},[eH,el]),(0,M.useEffect)(()=>{sessionStorage.setItem("apiKeySource",JSON.stringify(eR)),sessionStorage.setItem("apiKey",eM),sessionStorage.setItem("endpointType",to),sessionStorage.setItem("selectedTags",JSON.stringify(tm)),sessionStorage.setItem("selectedVectorStores",JSON.stringify(tg)),sessionStorage.setItem("selectedGuardrails",JSON.stringify(tx)),sessionStorage.setItem("selectedPolicies",JSON.stringify(tv)),sessionStorage.setItem("selectedMCPServers",JSON.stringify(ep)),sessionStorage.setItem("mcpServerToolRestrictions",JSON.stringify(eA)),sessionStorage.setItem("selectedVoice",th),sessionStorage.removeItem("selectedMCPTools"),el||(eG?sessionStorage.setItem("selectedModel",eG):sessionStorage.removeItem("selectedModel")),t_?sessionStorage.setItem("messageTraceId",t_):sessionStorage.removeItem("messageTraceId"),tS?sessionStorage.setItem("responsesSessionId",tS):sessionStorage.removeItem("responsesSessionId"),sessionStorage.setItem("useApiSessionManagement",JSON.stringify(tk))},[el,eR,eM,eG,to,tm,tg,tx,tv,t_,tS,tk,ep,eA,th]),(0,M.useEffect)(()=>{let t="session"===eR?e:eM;if(!t||!E||!I||!es)return void console.log("userApiKey or token or userRole or userID is missing = ",t,E,I,es);let s=async()=>{try{if(!t)return void console.log("userApiKey is missing");let e=await (0,et.fetchAvailableModels)(t);console.log("Fetched models:",e),e8(e);let s=e.some(e=>e.model_group===eG);e.length&&s||eK(void 0)}catch(e){console.error("Error fetching model info:",e)}};el||s(),t6()},[e,es,I,eR,eM,E,el]),(0,M.useEffect)(()=>{to!==ew.EndpointType.MCP||1!==ep.length||"__all__"===ep[0]||ex[ep[0]]||t8(ep[0])},[to,ep,ex]),(0,M.useEffect)(()=>{let t="session"===eR?e:eM;t&&to===ew.EndpointType.A2A_AGENTS&&(async()=>{try{let e=await (0,ee.fetchAvailableAgents)(t,e$||void 0);e9(e),te&&!e.some(e=>e.agent_name===te)&&tn(void 0)}catch(e){console.error("Error fetching agents:",e)}})()},[e,eR,eM,to,e$,te]),(0,M.useEffect)(()=>{t5.current&&setTimeout(()=>{t5.current?.scrollIntoView({behavior:"smooth",block:"end"})},100)},[eH]);let t7=(e,t,s)=>{console.log("updateTextUI called with:",e,t,s),eJ(r=>{let a=r[r.length-1];if(!a||a.role!==e||a.isImage||a.isAudio)return[...r,{role:e,content:t,model:s}];{let e={...a,content:a.content+t,model:a.model??s};return[...r.slice(0,-1),e]}})},t9=e=>{eJ(t=>{let s=t[t.length-1];return!s||"assistant"!==s.role||s.isImage||s.isAudio?t.length>0&&"user"===t[t.length-1].role?[...t,{role:"assistant",content:"",reasoningContent:e}]:t:[...t.slice(0,t.length-1),{...s,reasoningContent:(s.reasoningContent||"")+e}]})},se=e=>{console.log("updateTimingData called with:",e),eJ(t=>{let s=t[t.length-1];if(console.log("Current last message:",s),s&&"assistant"===s.role){console.log("Updating assistant message with timeToFirstToken:",e);let r=[...t.slice(0,t.length-1),{...s,timeToFirstToken:e}];return console.log("Updated chat history:",r),r}return s&&"user"===s.role?(console.log("Creating new assistant message with timeToFirstToken:",e),[...t,{role:"assistant",content:"",timeToFirstToken:e}]):(console.log("No appropriate message found to update timing"),t)})},st=(e,t)=>{console.log("Received usage data:",e),eJ(s=>{let r=s[s.length-1];if(r&&"assistant"===r.role){console.log("Updating message with usage data:",e);let a={...r,usage:e,toolName:t};return console.log("Updated message:",a),[...s.slice(0,s.length-1),a]}return s})},ss=e=>{console.log("Received A2A metadata:",e),eJ(t=>{let s=t[t.length-1];if(s&&"assistant"===s.role){let r={...s,a2aMetadata:e};return[...t.slice(0,t.length-1),r]}return t})},sr=e=>{eJ(t=>{let s=t[t.length-1];return s&&"assistant"===s.role?[...t.slice(0,t.length-1),{...s,totalLatency:e}]:t})},sa=e=>{console.log("Received search results:",e),eJ(t=>{let s=t[t.length-1];if(s&&"assistant"===s.role){console.log("Updating message with search results");let r={...s,searchResults:e};return[...t.slice(0,t.length-1),r]}return t})},sn=e=>{console.log("Received response ID for session management:",e),tk&&tN(e)},si=e=>{console.log("ChatUI: Received MCP event:",e),tK(t=>{if(e.item_id&&t.some(t=>t.item_id===e.item_id&&t.type===e.type&&(t.sequence_number===e.sequence_number||void 0===t.sequence_number&&void 0===e.sequence_number)))return console.log("ChatUI: Duplicate MCP event, skipping"),t;let s=[...t,e];return console.log("ChatUI: Updated MCP events:",s),s})},so=(e,t)=>{eJ(s=>[...s,{role:"assistant",content:e,model:t,isImage:!0}])},sl=(e,t)=>{eJ(s=>{let r=s[s.length-1];if(!r||"assistant"!==r.role||r.isImage||r.isAudio)return[...s,{role:"assistant",content:"",model:t,image:{url:e,detail:"auto"}}];{let a={...r,image:{url:e,detail:"auto"},model:r.model??t};return[...s.slice(0,-1),a]}})},sc=e=>{tT(t=>[...t,e]);let t=URL.createObjectURL(e);return tP(e=>[...e,t]),!1},sd=()=>{tA.forEach(e=>{URL.revokeObjectURL(e)}),tT([]),tP([])},su=()=>{tI&&URL.revokeObjectURL(tI),tR(null),tM(null)},sm=()=>{tU&&URL.revokeObjectURL(tU),t$(null),tD(null)},sp=()=>{tq(null)},sh=async()=>{let t;if(""===eB.trim()&&to!==ew.EndpointType.TRANSCRIPTION&&to!==ew.EndpointType.MCP)return;if(to===ew.EndpointType.IMAGE_EDITS&&0===tC.length)return void W.default.fromBackend("Please upload at least one image for editing");if(to===ew.EndpointType.TRANSCRIPTION&&!tB)return void W.default.fromBackend("Please upload an audio file for transcription");if(to===ew.EndpointType.A2A_AGENTS&&!te)return void W.default.fromBackend("Please select an agent to send a message");let s={};if(to===ew.EndpointType.MCP){if(!(1===ep.length&&"__all__"!==ep[0]?ep[0]:null))return void W.default.fromBackend("Please select an MCP server to test");if(!eS)return void W.default.fromBackend("Please select an MCP tool to call");if(!(ex[ep[0]]||[]).find(e=>e.name===eS))return void W.default.fromBackend("Please wait for tool schema to load");try{s=await eC.current?.getSubmitValues()??{}}catch(e){W.default.fromBackend(e instanceof Error?e.message:"Please fill in all required parameters");return}}if([ew.EndpointType.CHAT,ew.EndpointType.IMAGE,ew.EndpointType.SPEECH,ew.EndpointType.IMAGE_EDITS,ew.EndpointType.RESPONSES,ew.EndpointType.ANTHROPIC_MESSAGES,ew.EndpointType.EMBEDDINGS,ew.EndpointType.TRANSCRIPTION].includes(to)&&!eG)return void W.default.fromBackend("Please select a model before sending a request");if(!E||!I||!es)return;let r=el||"session"===eR?e:eM;if(!r)return void W.default.fromBackend("Please provide a Virtual Key or select Current UI Session");tu.current=new AbortController;let a=tu.current.signal;if(to===ew.EndpointType.RESPONSES&&tO)try{t=await eQ(eB,tO)}catch(e){W.default.fromBackend("Failed to process image. Please try again.");return}else if(to===ew.EndpointType.CHAT&&tL)try{t=await ek(eB,tL)}catch(e){W.default.fromBackend("Failed to process image. Please try again.");return}else t={role:"user",content:eB};let n=t_||(0,D.v4)();t_||tj(n),eJ([...eH,to===ew.EndpointType.RESPONSES&&tO?eZ(eB,!0,tI||void 0,tO.name):to===ew.EndpointType.CHAT&&tL?eE(eB,!0,tU||void 0,tL.name):to===ew.EndpointType.TRANSCRIPTION&&tB?eZ(eB?`🎵 Audio file: ${tB.name} -Prompt: ${eB}`:`🎵 Audio file: ${tB.name}`,!1):to===ew.EndpointType.MCP&&eS?eZ(`🔧 MCP Tool: ${eS} -Arguments: ${JSON.stringify(s,null,2)}`,!1):eZ(eB,!1)]),tK([]),t3.clearResult(),td(!0);try{if(eG)if(to===ew.EndpointType.CHAT){let e=[...eH.filter(e=>!e.isImage&&!e.isAudio).map(({role:e,content:t})=>({role:e,content:"string"==typeof t?t:""})),t],s=el&&eo?eo.LITELLM_UI_API_DOC_BASE_URL??eo.PROXY_BASE_URL??void 0:e$||void 0;await (0,Q.makeOpenAIChatCompletionRequest)(e,(e,t)=>t7("assistant",e,t),eG,r,tm,a,t9,se,st,n,tg.length>0?tg:void 0,tx.length>0?tx:void 0,tv.length>0?tv:void 0,ep,sl,sa,t0?tX:void 0,t0?tQ:void 0,sr,s,eu,eA,si,t2)}else if(to===ew.EndpointType.IMAGE)await ea(eB,(e,t)=>so(e,t),eG,r,tm,a,e$||void 0);else if(to===ew.EndpointType.SPEECH)await (0,X.makeOpenAIAudioSpeechRequest)(eB,th,(e,t)=>{eJ(s=>[...s,{role:"assistant",content:e,model:t,isAudio:!0}])},eG||"",r,tm,a,void 0,void 0,e$||void 0);else if(to===ew.EndpointType.IMAGE_EDITS)tC.length>0&&await er(1===tC.length?tC[0]:tC,eB,(e,t)=>so(e,t),eG,r,tm,a,e$||void 0);else if(to===ew.EndpointType.RESPONSES){let e;e=tk&&tS?[t]:[...eH.filter(e=>!e.isImage&&!e.isAudio).map(({role:e,content:t})=>({role:e,content:t})),t],await en(e,(e,t,s)=>t7(e,t,s),eG,r,tm,a,t9,se,st,n,tg.length>0?tg:void 0,tx.length>0?tx:void 0,tv.length>0?tv:void 0,ep,tk?tS:null,sn,si,t3.enabled,t3.setResult,e$||void 0,eu,eA)}else if(to===ew.EndpointType.ANTHROPIC_MESSAGES){let e=[...eH.filter(e=>!e.isImage&&!e.isAudio).map(({role:e,content:t})=>({role:e,content:t})),t];await (0,K.makeAnthropicMessagesRequest)(e,(e,t,s)=>t7(e,t,s),eG,r,tm,a,t9,se,st,n,tg.length>0?tg:void 0,tx.length>0?tx:void 0,tv.length>0?tv:void 0,ep,e$||void 0)}else to===ew.EndpointType.EMBEDDINGS?await (0,Z.makeOpenAIEmbeddingsRequest)(eB,(e,t)=>{eJ(s=>[...s,{role:"assistant",content:(0,B.truncateString)(e,100),model:t,isEmbeddings:!0}])},eG,r,tm,e$||void 0):to===ew.EndpointType.TRANSCRIPTION&&tB&&await (0,Y.makeOpenAIAudioTranscriptionRequest)(tB,(e,t)=>t7("assistant",e,t),eG,r,tm,a,void 0,void 0,void 0,void 0,e$||void 0);if(to===ew.EndpointType.MCP){let e=1===ep.length&&"__all__"!==ep[0]?ep[0]:null;if(e&&eS){let t=await (0,H.callMCPTool)(r,e,eS,s,tx.length>0?{guardrails:tx}:void 0),a=t?.content?.length>0?JSON.stringify(t.content.map(e=>"text"===e.type?e.text:e).filter(Boolean),null,2):JSON.stringify(t,null,2);t7("assistant",a||"Tool executed successfully.")}}to===ew.EndpointType.A2A_AGENTS&&te&&await (0,V.makeA2ASendMessageRequest)(te,eB,(e,t)=>t7("assistant",e,t),r,a,se,sr,ss,e$||void 0,tx.length>0?tx:void 0)}catch(e){a.aborted?console.log("Request was cancelled"):(console.error("Error fetching response",e),t7("assistant","Error fetching response:"+e))}finally{td(!1),tu.current=null,to===ew.EndpointType.IMAGE_EDITS&&sd(),to===ew.EndpointType.RESPONSES&&tO&&su(),to===ew.EndpointType.CHAT&&tL&&sm(),to===ew.EndpointType.TRANSCRIPTION&&tB&&sp()}eq("")};if(I&&"Admin Viewer"===I){let{Title:e,Paragraph:s}=R.Typography;return(0,t.jsxs)("div",{children:[(0,t.jsx)(e,{level:1,children:"Access Denied"}),(0,t.jsx)(s,{children:"Ask your proxy admin for access to test models"})]})}let sf=(0,t.jsx)(m.LoadingOutlined,{style:{fontSize:24},spin:!0});return(0,t.jsxs)("div",{className:`w-full bg-white ${el?"h-full flex flex-col":"p-4 pb-0"}`,children:[(0,t.jsx)(w.Card,{className:`w-full rounded-xl shadow-md overflow-hidden ${el?"h-full flex flex-col":""}`,children:(0,t.jsxs)("div",{className:`flex w-full gap-4 ${el?"h-full":"h-[80vh]"}`,children:[!el&&(0,t.jsxs)("div",{className:"w-1/4 p-4 bg-gray-50 overflow-y-auto",children:[(0,t.jsx)(S.Title,{className:"text-xl font-semibold mb-6 mt-2",children:"Configurations"}),(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)(_.Text,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,t.jsx)(d.KeyOutlined,{className:"mr-2"})," Virtual Key Source"]}),(0,t.jsx)(A.Select,{disabled:ei,value:eR,style:{width:"100%"},onChange:e=>{eI(e)},options:[{value:"session",label:"Current UI Session"},{value:"custom",label:"Virtual Key"}],className:"rounded-md"}),"custom"===eR&&(0,t.jsx)(j.TextInput,{className:"mt-2",placeholder:"Enter custom Virtual Key",type:"password",onValueChange:eL,value:eM,icon:d.KeyOutlined})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,t.jsxs)(_.Text,{className:"font-medium block text-gray-700 flex items-center",children:[(0,t.jsx)(g.SettingOutlined,{className:"mr-2"})," Custom Proxy Base URL"]}),eo?.LITELLM_UI_API_DOC_BASE_URL&&!e$&&(0,t.jsx)(k.Button,{type:"link",size:"small",icon:(0,t.jsx)(u.LinkOutlined,{}),onClick:()=>{eU(eo.LITELLM_UI_API_DOC_BASE_URL||""),sessionStorage.setItem("customProxyBaseUrl",eo.LITELLM_UI_API_DOC_BASE_URL||"")},className:"text-gray-500 hover:text-gray-700",children:"Fill"}),e$&&(0,t.jsx)(k.Button,{type:"link",size:"small",icon:(0,t.jsx)(a.ClearOutlined,{}),onClick:()=>{eU(""),sessionStorage.removeItem("customProxyBaseUrl")},className:"text-gray-500 hover:text-gray-700",children:"Clear"})]}),(0,t.jsx)(j.TextInput,{placeholder:"Optional: Enter custom proxy URL (e.g., http://localhost:5000)",onValueChange:e=>{eU(e),sessionStorage.setItem("customProxyBaseUrl",e)},value:e$,icon:s.ApiOutlined}),e$&&(0,t.jsxs)(_.Text,{className:"text-xs text-gray-500 mt-1",children:["API calls will be sent to: ",e$]})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)(_.Text,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,t.jsx)(s.ApiOutlined,{className:"mr-2"})," Endpoint Type"]}),(0,t.jsx)(eW,{endpointType:to,onEndpointChange:e=>{tl(e),eK(void 0),tn(void 0),e5(!1),eN(void 0),e===ew.EndpointType.MCP&&eh(e=>1===e.length&&"__all__"!==e[0]?e:[]);try{sessionStorage.removeItem("selectedModel"),sessionStorage.removeItem("selectedAgent")}catch{}},className:"mb-4"}),to===ew.EndpointType.SPEECH&&(0,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsxs)(_.Text,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,t.jsx)(y.SoundOutlined,{className:"mr-2"}),"Voice"]}),(0,t.jsx)(A.Select,{value:th,onChange:e=>{tf(e),sessionStorage.setItem("selectedVoice",e)},style:{width:"100%"},className:"rounded-md",options:ej})]}),(0,t.jsx)(e3,{endpointType:to,responsesSessionId:tS,useApiSessionManagement:tk,onToggleSessionManagement:e=>{tE(e),e||tN(null)}})]}),to!==ew.EndpointType.A2A_AGENTS&&to!==ew.EndpointType.MCP&&(0,t.jsxs)("div",{children:[(0,t.jsxs)(_.Text,{className:"font-medium block mb-2 text-gray-700 flex items-center justify-between",children:[(0,t.jsxs)("span",{className:"flex items-center",children:[(0,t.jsx)(h.RobotOutlined,{className:"mr-2"})," Select Model"]}),(()=>{if(!eG||"custom"===eG)return!1;let e=e6.find(e=>e.model_group===eG);return!!e&&(!e.mode||"chat"===e.mode)})()?(0,t.jsx)(T.Popover,{content:(0,t.jsx)(eb,{temperature:tX,maxTokens:tQ,useAdvancedParams:t0,onTemperatureChange:tY,onMaxTokensChange:tZ,onUseAdvancedParamsChange:t1,mockTestFallbacks:t2,onMockTestFallbacksChange:t4}),title:"Model Settings",trigger:"click",placement:"right",children:(0,t.jsx)(k.Button,{type:"text",size:"small",icon:(0,t.jsx)(g.SettingOutlined,{}),className:"text-gray-500 hover:text-gray-700","aria-label":"Model Settings","data-testid":"model-settings-button"})}):(0,t.jsx)(O.Tooltip,{title:"Advanced parameters are only supported for chat models currently",children:(0,t.jsx)(k.Button,{type:"text",size:"small",icon:(0,t.jsx)(g.SettingOutlined,{}),className:"text-gray-300 cursor-not-allowed",disabled:!0})})]}),(0,t.jsx)(A.Select,{value:eG,placeholder:"Select a Model",onChange:e=>{console.log(`selected ${e}`),eK(e),e5("custom"===e)},options:[{value:"custom",label:"Enter custom model",key:"custom"},...Array.from(new Set(e6.filter(e=>{if(!e.mode)return!0;let t=(0,ew.getEndpointType)(e.mode);return to===ew.EndpointType.RESPONSES||to===ew.EndpointType.ANTHROPIC_MESSAGES?t===to||t===ew.EndpointType.CHAT:to===ew.EndpointType.IMAGE_EDITS?t===to||t===ew.EndpointType.IMAGE:t===to}).map(e=>e.model_group))).map((e,t)=>({value:e,label:e,key:t}))],style:{width:"100%"},showSearch:!0,className:"rounded-md"}),e1&&(0,t.jsx)(j.TextInput,{className:"mt-2",placeholder:"Enter custom model name",onValueChange:e=>{ti.current&&clearTimeout(ti.current),ti.current=setTimeout(()=>{eK(e)},500)}})]}),to===ew.EndpointType.A2A_AGENTS&&(0,t.jsxs)("div",{children:[(0,t.jsxs)(_.Text,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,t.jsx)(h.RobotOutlined,{className:"mr-2"})," Select Agent"]}),(0,t.jsx)(A.Select,{value:te,placeholder:"Select an Agent",onChange:e=>tn(e),options:e7.map(e=>({value:e.agent_name,label:e.agent_name||e.agent_id,key:e.agent_id})),style:{width:"100%"},showSearch:!0,className:"rounded-md",optionLabelProp:"label",children:e7.map(e=>(0,t.jsx)(A.Select.Option,{value:e.agent_name,label:e.agent_name||e.agent_id,children:(0,t.jsxs)("div",{className:"flex flex-col py-1",children:[(0,t.jsx)("span",{className:"font-medium",children:e.agent_name||e.agent_id}),e.agent_card_params?.description&&(0,t.jsx)("span",{className:"text-xs text-gray-500 mt-1",children:e.agent_card_params.description})]})},e.agent_id))}),0===e7.length&&(0,t.jsx)(_.Text,{className:"text-xs text-gray-500 mt-2 block",children:"No agents found. Create agents via /v1/agents endpoint."})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)(_.Text,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,t.jsx)(x.TagsOutlined,{className:"mr-2"})," Tags"]}),(0,t.jsx)(J.default,{value:tm,onChange:tp,className:"mb-4",accessToken:e||""})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)(_.Text,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,t.jsx)(b.ToolOutlined,{className:"mr-2"}),to===ew.EndpointType.MCP?"MCP Server":"MCP Servers",(0,t.jsx)(O.Tooltip,{className:"ml-1",title:to===ew.EndpointType.MCP?"Select an MCP server to test tools directly.":"Select MCP servers to use in your conversation.",children:(0,t.jsx)(c.InfoCircleOutlined,{})})]}),(0,t.jsxs)(A.Select,{mode:to===ew.EndpointType.MCP?void 0:"multiple",style:{width:"100%"},placeholder:to===ew.EndpointType.MCP?"Select MCP server":"Select MCP servers",value:to===ew.EndpointType.MCP?"__all__"!==ep[0]&&1===ep.length?ep[0]:void 0:ep,onChange:e=>{to===ew.EndpointType.MCP?(eh(e?[e]:[]),eN(void 0),e&&!ex[e]&&t8(e)):e.includes("__all__")?(eh(["__all__"]),eP({})):(eh(e),eP(t=>{let s={...t};return Object.keys(s).forEach(t=>{e.includes(t)||delete s[t]}),s}),e.forEach(e=>{ex[e]||t8(e)}))},loading:eg,className:"mb-2",allowClear:!0,optionLabelProp:"label",disabled:!ta.has(to),maxTagCount:to===ew.EndpointType.MCP?1:"responsive",children:[to!==ew.EndpointType.MCP&&(0,t.jsx)(A.Select.Option,{value:"__all__",label:"All MCP Servers",children:(0,t.jsxs)("div",{className:"flex flex-col py-1",children:[(0,t.jsx)("span",{className:"font-medium",children:"All MCP Servers"}),(0,t.jsx)("span",{className:"text-xs text-gray-500 mt-1",children:"Use all available MCP servers"})]})},"__all__"),eu.map(e=>(0,t.jsx)(A.Select.Option,{value:e.server_id,label:e.alias||e.server_name||e.server_id,disabled:to!==ew.EndpointType.MCP&&ep.includes("__all__"),children:(0,t.jsxs)("div",{className:"flex flex-col py-1",children:[(0,t.jsx)("span",{className:"font-medium",children:e.alias||e.server_name||e.server_id}),e.description&&(0,t.jsx)("span",{className:"text-xs text-gray-500 mt-1",children:e.description})]})},e.server_id))]}),to===ew.EndpointType.MCP&&1===ep.length&&"__all__"!==ep[0]&&(0,t.jsxs)("div",{className:"mt-3",children:[(0,t.jsx)(_.Text,{className:"text-xs text-gray-600 mb-1 block",children:"Select Tool"}),(0,t.jsx)(A.Select,{style:{width:"100%"},placeholder:"Select a tool to call",value:eS,onChange:e=>eN(e),options:(ex[ep[0]]||[]).map(e=>({value:e.name,label:e.name})),allowClear:!0,className:"rounded-md"})]}),ep.length>0&&!ep.includes("__all__")&&to!==ew.EndpointType.MCP&&ta.has(to)&&(0,t.jsx)("div",{className:"mt-3 space-y-2",children:ep.map(e=>{let s=eu.find(t=>t.server_id===e),r=ex[e]||[];return 0===r.length?null:(0,t.jsxs)("div",{className:"border rounded p-2",children:[(0,t.jsxs)(_.Text,{className:"text-xs text-gray-600 mb-1",children:["Limit tools for ",s?.alias||s?.server_name||e,":"]}),(0,t.jsx)(A.Select,{mode:"multiple",size:"small",style:{width:"100%"},placeholder:"All tools (default)",value:eA[e]||[],onChange:t=>{eP(s=>({...s,[e]:t}))},options:r.map(e=>({value:e.name,label:e.name})),maxTagCount:2})]},e)})})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)(_.Text,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,t.jsx)(i.DatabaseOutlined,{className:"mr-2"})," Vector Store",(0,t.jsx)(O.Tooltip,{className:"ml-1",title:(0,t.jsxs)("span",{children:["Select vector store(s) to use for this LLM API call. You can set up your vector store"," ",(0,t.jsx)("a",{href:"?page=vector-stores",style:{color:"#1890ff"},children:"here"}),"."]}),children:(0,t.jsx)(c.InfoCircleOutlined,{})})]}),(0,t.jsx)(G.default,{value:tg,onChange:ty,className:"mb-4",accessToken:e||""})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)(_.Text,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,t.jsx)(f.SafetyOutlined,{className:"mr-2"})," Guardrails",(0,t.jsx)(O.Tooltip,{className:"ml-1",title:(0,t.jsxs)("span",{children:["Select guardrail(s) to use for this LLM API call. You can set up your guardrails"," ",(0,t.jsx)("a",{href:"?page=guardrails",style:{color:"#1890ff"},children:"here"}),"."]}),children:(0,t.jsx)(c.InfoCircleOutlined,{})})]}),(0,t.jsx)(q.default,{value:tx,onChange:tb,className:"mb-4",accessToken:e||""})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)(_.Text,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,t.jsx)(f.SafetyOutlined,{className:"mr-2"})," Policies",(0,t.jsx)(O.Tooltip,{className:"ml-1",title:(0,t.jsxs)("span",{children:["Select policy/policies to apply to this LLM API call. Policies define which guardrails are applied based on conditions. You can set up your policies"," ",(0,t.jsx)("a",{href:"?page=policies",style:{color:"#1890ff"},children:"here"}),"."]}),children:(0,t.jsx)(c.InfoCircleOutlined,{})})]}),(0,t.jsx)(z.default,{value:tv,onChange:tw,className:"mb-4",accessToken:e||""})]}),to===ew.EndpointType.RESPONSES&&(0,t.jsx)("div",{children:(0,t.jsx)(ez,{accessToken:"session"===eR?e||"":eM,enabled:t3.enabled,onEnabledChange:t3.setEnabled,selectedContainerId:null,onContainerChange:()=>{},selectedModel:eG||""})})]})]}),(0,t.jsx)("div",{className:`flex flex-col bg-white ${el?"flex-1 w-full":"w-3/4"}`,children:to===ew.EndpointType.REALTIME?(0,t.jsx)(tt,{accessToken:"session"===eR?e||"":eM,selectedModel:eG||"",customProxyBaseUrl:e$||void 0,selectedGuardrails:tx.length>0?tx:void 0}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"p-4 border-b border-gray-200 flex justify-between items-center",children:[(0,t.jsx)(S.Title,{className:"text-xl font-semibold mb-0",children:el?"Chat":"Test Key"}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(N.Button,{onClick:()=>{eH.forEach(e=>{e.isAudio&&"string"==typeof e.content&&URL.revokeObjectURL(e.content)}),eJ([]),tj(null),tN(null),tK([]),sd(),su(),sm(),sp(),el||(sessionStorage.removeItem("chatHistory"),sessionStorage.removeItem("messageTraceId"),sessionStorage.removeItem("responsesSessionId")),W.default.success("Chat history cleared.")},className:"bg-gray-100 hover:bg-gray-200 text-gray-700 border-gray-300",icon:a.ClearOutlined,children:"Clear Chat"}),!el&&(0,t.jsx)(N.Button,{onClick:()=>tF(!0),className:"bg-gray-100 hover:bg-gray-200 text-gray-700 border-gray-300",icon:n.CodeOutlined,children:"Get Code"})]})]}),(0,t.jsxs)("div",{className:"flex-1 overflow-auto p-4 pb-0",children:[0===eH.length&&(0,t.jsxs)("div",{className:"h-full flex flex-col items-center justify-center text-gray-400",children:[(0,t.jsx)(h.RobotOutlined,{style:{fontSize:"48px",marginBottom:"16px"}}),(0,t.jsx)(_.Text,{children:"Start a conversation, generate an image, or handle audio"})]}),eH.map((s,r)=>(0,t.jsx)("div",{children:(0,t.jsx)("div",{className:`mb-4 ${"user"===s.role?"text-right":"text-left"}`,children:(0,t.jsxs)("div",{className:"inline-block max-w-[80%] rounded-lg shadow-sm p-3.5 px-4",style:{backgroundColor:"user"===s.role?"#f0f8ff":"#ffffff",border:"user"===s.role?"1px solid #e6f0fa":"1px solid #f0f0f0",textAlign:"left"},children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-1.5",children:[(0,t.jsx)("div",{className:"flex items-center justify-center w-6 h-6 rounded-full mr-1",style:{backgroundColor:"user"===s.role?"#e6f0fa":"#f5f5f5"},children:"user"===s.role?(0,t.jsx)(v.UserOutlined,{style:{fontSize:"12px",color:"#2563eb"}}):(0,t.jsx)(h.RobotOutlined,{style:{fontSize:"12px",color:"#4b5563"}})}),(0,t.jsx)("strong",{className:"text-sm capitalize",children:s.role}),"assistant"===s.role&&s.model&&(0,t.jsx)("span",{className:"text-xs px-2 py-0.5 rounded bg-gray-100 text-gray-600 font-normal",children:s.model})]}),s.reasoningContent&&(0,t.jsx)(eX,{reasoningContent:s.reasoningContent}),"assistant"===s.role&&r===eH.length-1&&tV.length>0&&(to===ew.EndpointType.RESPONSES||to===ew.EndpointType.CHAT)&&(0,t.jsx)("div",{className:"mb-3",children:(0,t.jsx)(eV,{events:tV})}),"assistant"===s.role&&s.searchResults&&(0,t.jsx)(e4,{searchResults:s.searchResults}),"assistant"===s.role&&r===eH.length-1&&t3.result&&to===ew.EndpointType.RESPONSES&&(0,t.jsx)(eD,{code:t3.result.code,containerId:t3.result.containerId,annotations:t3.result.annotations,accessToken:"session"===eR?e||"":eM}),(0,t.jsxs)("div",{className:"whitespace-pre-wrap break-words max-w-full message-content",style:{wordWrap:"break-word",overflowWrap:"break-word",wordBreak:"break-word",hyphens:"auto"},children:[s.isImage?(0,t.jsx)("img",{src:"string"==typeof s.content?s.content:"",alt:"Generated image",className:"max-w-full rounded-md border border-gray-200 shadow-sm",style:{maxHeight:"500px"}}):s.isAudio?(0,t.jsx)(ev,{message:s}):(0,t.jsxs)(t.Fragment,{children:[to===ew.EndpointType.RESPONSES&&(0,t.jsx)(e0,{message:s}),to===ew.EndpointType.CHAT&&(0,t.jsx)(eT,{message:s}),(0,t.jsx)(L.default,{components:{code({node:e,inline:s,className:r,children:a,...n}){let i=/language-(\w+)/.exec(r||"");return!s&&i?(0,t.jsx)($.Prism,{style:U.coy,language:i[1],PreTag:"div",className:"rounded-md my-2",wrapLines:!0,wrapLongLines:!0,...n,children:String(a).replace(/\n$/,"")}):(0,t.jsx)("code",{className:`${r} px-1.5 py-0.5 rounded bg-gray-100 text-sm font-mono`,style:{wordBreak:"break-word"},...n,children:a})},pre:({node:e,...s})=>(0,t.jsx)("pre",{style:{overflowX:"auto",maxWidth:"100%"},...s})},children:"string"==typeof s.content?s.content:""}),s.image&&(0,t.jsx)("div",{className:"mt-3",children:(0,t.jsx)("img",{src:s.image.url,alt:"Generated image",className:"max-w-full rounded-md border border-gray-200 shadow-sm",style:{maxHeight:"500px"}})})]}),"assistant"===s.role&&(s.timeToFirstToken||s.totalLatency||s.usage)&&!s.a2aMetadata&&(0,t.jsx)(eY.default,{timeToFirstToken:s.timeToFirstToken,totalLatency:s.totalLatency,usage:s.usage,toolName:s.toolName}),"assistant"===s.role&&s.a2aMetadata&&(0,t.jsx)(ef,{a2aMetadata:s.a2aMetadata,timeToFirstToken:s.timeToFirstToken,totalLatency:s.totalLatency})]})]})})},r)),tc&&tV.length>0&&(to===ew.EndpointType.RESPONSES||to===ew.EndpointType.CHAT)&&eH.length>0&&"user"===eH[eH.length-1].role&&(0,t.jsx)("div",{className:"text-left mb-4",children:(0,t.jsxs)("div",{className:"inline-block max-w-[80%] rounded-lg shadow-sm p-3.5 px-4",style:{backgroundColor:"#ffffff",border:"1px solid #f0f0f0",textAlign:"left"},children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-1.5",children:[(0,t.jsx)("div",{className:"flex items-center justify-center w-6 h-6 rounded-full mr-1",style:{backgroundColor:"#f5f5f5"},children:(0,t.jsx)(h.RobotOutlined,{style:{fontSize:"12px",color:"#4b5563"}})}),(0,t.jsx)("strong",{className:"text-sm capitalize",children:"Assistant"})]}),(0,t.jsx)(eV,{events:tV})]})}),tc&&(0,t.jsx)("div",{className:"flex justify-center items-center my-4",children:(0,t.jsx)(P.Spin,{indicator:sf})}),(0,t.jsx)("div",{ref:t5,style:{height:"1px"}})]}),(0,t.jsxs)("div",{className:"p-4 border-t border-gray-200 bg-white",children:[to===ew.EndpointType.IMAGE_EDITS&&(0,t.jsx)("div",{className:"mb-4",children:0===tC.length?(0,t.jsxs)(tr,{beforeUpload:sc,accept:"image/*",showUploadList:!1,children:[(0,t.jsx)("p",{className:"ant-upload-drag-icon",children:(0,t.jsx)(p.PictureOutlined,{style:{fontSize:"24px",color:"#666"}})}),(0,t.jsx)("p",{className:"ant-upload-text text-sm",children:"Click or drag images to upload"}),(0,t.jsx)("p",{className:"ant-upload-hint text-xs text-gray-500",children:"Support for PNG, JPG, JPEG formats. Multiple images supported."})]}):(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[tC.map((e,s)=>(0,t.jsxs)("div",{className:"relative inline-block",children:[(0,t.jsx)("img",{src:tA[s]||"",alt:`Upload preview ${s+1}`,className:"max-w-32 max-h-32 rounded-md border border-gray-200 object-cover"}),(0,t.jsx)("button",{className:"absolute top-1 right-1 bg-white shadow-sm border border-gray-200 rounded px-1 py-1 text-red-500 hover:bg-red-50 text-xs",onClick:()=>{tA[s]&&URL.revokeObjectURL(tA[s]),tT(e=>e.filter((e,t)=>t!==s)),tP(e=>e.filter((e,t)=>t!==s))},children:(0,t.jsx)(o.DeleteOutlined,{})})]},s)),(0,t.jsxs)("div",{className:"flex items-center justify-center w-32 h-32 border-2 border-dashed border-gray-300 rounded-md hover:border-gray-400 cursor-pointer",onClick:()=>document.getElementById("additional-image-upload")?.click(),children:[(0,t.jsxs)("div",{className:"text-center",children:[(0,t.jsx)(p.PictureOutlined,{style:{fontSize:"24px",color:"#666"}}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Add more"})]}),(0,t.jsx)("input",{id:"additional-image-upload",type:"file",accept:"image/*",multiple:!0,style:{display:"none"},onChange:e=>{Array.from(e.target.files||[]).forEach(e=>sc(e))}})]})]})}),to===ew.EndpointType.TRANSCRIPTION&&(0,t.jsx)("div",{className:"mb-4",children:tB?(0,t.jsxs)("div",{className:"flex items-center gap-3 p-3 bg-gray-50 rounded-lg border border-gray-200",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 flex-1",children:[(0,t.jsx)(y.SoundOutlined,{style:{fontSize:"20px",color:"#666"}}),(0,t.jsx)("span",{className:"text-sm font-medium",children:tB.name}),(0,t.jsxs)("span",{className:"text-xs text-gray-500",children:["(",(tB.size/1024/1024).toFixed(2)," MB)"]})]}),(0,t.jsxs)("button",{className:"bg-white shadow-sm border border-gray-200 rounded px-2 py-1 text-red-500 hover:bg-red-50 text-xs",onClick:sp,children:[(0,t.jsx)(o.DeleteOutlined,{})," Remove"]})]}):(0,t.jsxs)(tr,{beforeUpload:e=>(tq(e),!1),accept:"audio/*,.mp3,.mp4,.mpeg,.mpga,.m4a,.wav,.webm",showUploadList:!1,children:[(0,t.jsx)("p",{className:"ant-upload-drag-icon",children:(0,t.jsx)(y.SoundOutlined,{style:{fontSize:"24px",color:"#666"}})}),(0,t.jsx)("p",{className:"ant-upload-text text-sm",children:"Click or drag audio file to upload"}),(0,t.jsx)("p",{className:"ant-upload-hint text-xs text-gray-500",children:"Support for MP3, MP4, MPEG, MPGA, M4A, WAV, WEBM formats. Max file size: 25 MB."})]})}),to===ew.EndpointType.RESPONSES&&tO&&(0,t.jsx)("div",{className:"mb-2",children:(0,t.jsxs)("div",{className:"flex items-center gap-3 p-3 bg-gray-50 rounded-lg border border-gray-200",children:[(0,t.jsx)("div",{className:"relative inline-block",children:tO.name.toLowerCase().endsWith(".pdf")?(0,t.jsx)("div",{className:"w-10 h-10 rounded-md bg-red-500 flex items-center justify-center",children:(0,t.jsx)(l.FilePdfOutlined,{style:{fontSize:"16px",color:"white"}})}):(0,t.jsx)("img",{src:tI||"",alt:"Upload preview",className:"w-10 h-10 rounded-md border border-gray-200 object-cover"})}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("div",{className:"text-sm font-medium text-gray-900 truncate",children:tO.name}),(0,t.jsx)("div",{className:"text-xs text-gray-500",children:tO.name.toLowerCase().endsWith(".pdf")?"PDF":"Image"})]}),(0,t.jsx)("button",{className:"flex items-center justify-center w-6 h-6 text-gray-400 hover:text-gray-600 hover:bg-gray-200 rounded-full transition-colors",onClick:su,children:(0,t.jsx)(o.DeleteOutlined,{style:{fontSize:"12px"}})})]})}),to===ew.EndpointType.CHAT&&tL&&(0,t.jsx)("div",{className:"mb-2",children:(0,t.jsxs)("div",{className:"flex items-center gap-3 p-3 bg-gray-50 rounded-lg border border-gray-200",children:[(0,t.jsx)("div",{className:"relative inline-block",children:tL.name.toLowerCase().endsWith(".pdf")?(0,t.jsx)("div",{className:"w-10 h-10 rounded-md bg-red-500 flex items-center justify-center",children:(0,t.jsx)(l.FilePdfOutlined,{style:{fontSize:"16px",color:"white"}})}):(0,t.jsx)("img",{src:tU||"",alt:"Upload preview",className:"w-10 h-10 rounded-md border border-gray-200 object-cover"})}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("div",{className:"text-sm font-medium text-gray-900 truncate",children:tL.name}),(0,t.jsx)("div",{className:"text-xs text-gray-500",children:tL.name.toLowerCase().endsWith(".pdf")?"PDF":"Image"})]}),(0,t.jsx)("button",{className:"flex items-center justify-center w-6 h-6 text-gray-400 hover:text-gray-600 hover:bg-gray-200 rounded-full transition-colors",onClick:sm,children:(0,t.jsx)(o.DeleteOutlined,{style:{fontSize:"12px"}})})]})}),to===ew.EndpointType.RESPONSES&&t3.enabled&&(0,t.jsxs)("div",{className:"mb-2 space-y-2",children:[(0,t.jsxs)("div",{className:"px-3 py-2 bg-gradient-to-r from-blue-50 to-purple-50 rounded-lg border border-blue-200 flex items-center justify-between",children:[(0,t.jsx)("div",{className:"flex items-center gap-2",children:tc?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(m.LoadingOutlined,{className:"text-blue-500",spin:!0}),(0,t.jsx)("span",{className:"text-sm text-blue-700 font-medium",children:"Running Python code..."})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.CodeOutlined,{className:"text-blue-500"}),(0,t.jsx)("span",{className:"text-sm text-blue-700 font-medium",children:"Code Interpreter Active"})]})}),(0,t.jsx)("button",{className:"text-xs text-blue-500 hover:text-blue-700",onClick:()=>t3.setEnabled(!1),children:"Disable"})]}),!tc&&(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:["Generate sample sales data CSV and create a chart","Create a PNG bar chart comparing AI gateway providers including LiteLLM","Generate a CSV of LLM pricing data and visualize it as a line chart"].map((e,s)=>(0,t.jsx)("button",{className:"text-xs px-3 py-1.5 bg-white border border-gray-200 rounded-full hover:bg-blue-50 hover:border-blue-300 hover:text-blue-600 transition-colors",onClick:()=>eq(e),children:e},s))})]}),0===eH.length&&!tc&&to!==ew.EndpointType.MCP&&(0,t.jsx)("div",{className:"flex items-center gap-2 mb-3 overflow-x-auto",children:(to===ew.EndpointType.A2A_AGENTS?["What can you help me with?","Tell me about yourself","What tasks can you perform?"]:["Write me a poem","Explain quantum computing","Draft a polite email requesting a meeting"]).map(e=>(0,t.jsx)("button",{type:"button",className:"shrink-0 rounded-full border border-gray-200 px-3 py-1 text-xs font-medium text-gray-600 transition-colors hover:bg-blue-50 hover:border-blue-300 hover:text-blue-600 cursor-pointer",onClick:()=>eq(e),children:e},e))}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsxs)("div",{className:"flex items-center flex-1 bg-white border border-gray-300 rounded-xl px-3 py-1 min-h-[44px]",children:[(0,t.jsxs)("div",{className:"flex-shrink-0 mr-2 flex items-center gap-1",children:[to===ew.EndpointType.RESPONSES&&!tO&&(0,t.jsx)(e2,{responsesUploadedImage:tO,responsesImagePreviewUrl:tI,onImageUpload:e=>(tR(e),tM(URL.createObjectURL(e)),!1),onRemoveImage:su}),to===ew.EndpointType.CHAT&&!tL&&(0,t.jsx)(eO,{chatUploadedImage:tL,chatImagePreviewUrl:tU,onImageUpload:e=>(t$(e),tD(URL.createObjectURL(e)),!1),onRemoveImage:sm}),to===ew.EndpointType.RESPONSES&&(0,t.jsx)(O.Tooltip,{title:t3.enabled?"Code Interpreter enabled (click to disable)":"Enable Code Interpreter",children:(0,t.jsx)("button",{className:`p-1.5 rounded-md transition-colors ${t3.enabled?"bg-blue-100 text-blue-600":"text-gray-400 hover:text-gray-600 hover:bg-gray-100"}`,onClick:()=>{t3.toggle(),t3.enabled||W.default.success("Code Interpreter enabled!")},children:(0,t.jsx)(n.CodeOutlined,{style:{fontSize:"16px"}})})})]}),to===ew.EndpointType.MCP&&1===ep.length&&"__all__"!==ep[0]&&eS?(0,t.jsx)("div",{className:"flex-1 overflow-y-auto max-h-48 min-h-[44px] p-2 border border-gray-200 rounded-lg bg-gray-50/50",children:(ed=(ex[ep[0]]||[]).find(e=>e.name===eS))?(0,t.jsx)(F.default,{ref:eC,tool:ed,className:"space-y-2"}):(0,t.jsx)("div",{className:"flex items-center justify-center h-10 text-sm text-gray-500",children:"Loading tool schema..."})}):(0,t.jsx)(ts,{value:eB,onChange:e=>eq(e.target.value),onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),sh())},placeholder:to===ew.EndpointType.CHAT||to===ew.EndpointType.EMBEDDINGS||to===ew.EndpointType.RESPONSES||to===ew.EndpointType.ANTHROPIC_MESSAGES?"Type your message... (Shift+Enter for new line)":to===ew.EndpointType.A2A_AGENTS?"Send a message to the A2A agent...":to===ew.EndpointType.IMAGE_EDITS?"Describe how you want to edit the image...":to===ew.EndpointType.SPEECH?"Enter text to convert to speech...":to===ew.EndpointType.TRANSCRIPTION?"Optional: Add context or prompt for transcription...":"Describe the image you want to generate...",disabled:tc,className:"flex-1",autoSize:{minRows:1,maxRows:4},style:{resize:"none",border:"none",boxShadow:"none",background:"transparent",padding:"4px 0",fontSize:"14px",lineHeight:"20px"}}),(0,t.jsx)(N.Button,{onClick:sh,disabled:tc||(to===ew.EndpointType.MCP?!(1===ep.length&&"__all__"!==ep[0]&&eS):to===ew.EndpointType.TRANSCRIPTION?!tB:!eB.trim()),className:"flex-shrink-0 ml-2 !w-8 !h-8 !min-w-8 !p-0 !rounded-full !bg-blue-600 hover:!bg-blue-700 disabled:!bg-gray-300 !border-none !text-white disabled:!text-gray-500 !flex !items-center !justify-center",children:(0,t.jsx)(r.ArrowUpOutlined,{style:{fontSize:"14px"}})})]}),tc&&(0,t.jsx)(N.Button,{onClick:()=>{tu.current&&(tu.current.abort(),tu.current=null,td(!1),W.default.info("Request cancelled"))},className:"bg-red-50 hover:bg-red-100 text-red-600 border-red-200",icon:o.DeleteOutlined,children:"Cancel"})]})]})]})})]})}),(0,t.jsxs)(C.Modal,{title:"Generated Code",open:tz,onCancel:()=>tF(!1),footer:null,width:800,children:[(0,t.jsxs)("div",{className:"flex justify-between items-end my-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(_.Text,{className:"font-medium block mb-1 text-gray-700",children:"SDK Type"}),(0,t.jsx)(A.Select,{value:tJ,onChange:e=>tG(e),style:{width:150},options:[{value:"openai",label:"OpenAI SDK"},{value:"azure",label:"Azure SDK"}]})]}),(0,t.jsx)(k.Button,{onClick:()=>{navigator.clipboard.writeText(tW),W.default.success("Copied to clipboard!")},children:"Copy to Clipboard"})]}),(0,t.jsx)($.Prism,{language:"python",style:U.coy,wrapLines:!0,wrapLongLines:!0,className:"rounded-md",customStyle:{maxHeight:"60vh",overflowY:"auto"},children:tW})]})]})}],220486)}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/0a55aff89c1ec2e4.js b/litellm/proxy/_experimental/out/_next/static/chunks/0a55aff89c1ec2e4.js new file mode 100644 index 00000000000..cbd60e721c7 --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/0a55aff89c1ec2e4.js @@ -0,0 +1,420 @@ +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,190272,785913,e=>{"use strict";var t,i,o=((t={}).AUDIO_SPEECH="audio_speech",t.AUDIO_TRANSCRIPTION="audio_transcription",t.IMAGE_GENERATION="image_generation",t.VIDEO_GENERATION="video_generation",t.CHAT="chat",t.RESPONSES="responses",t.IMAGE_EDITS="image_edits",t.ANTHROPIC_MESSAGES="anthropic_messages",t.EMBEDDING="embedding",t),r=((i={}).IMAGE="image",i.VIDEO="video",i.CHAT="chat",i.RESPONSES="responses",i.IMAGE_EDITS="image_edits",i.ANTHROPIC_MESSAGES="anthropic_messages",i.EMBEDDINGS="embeddings",i.SPEECH="speech",i.TRANSCRIPTION="transcription",i.A2A_AGENTS="a2a_agents",i.MCP="mcp",i.REALTIME="realtime",i);let a={image_generation:"image",video_generation:"video",chat:"chat",responses:"responses",image_edits:"image_edits",anthropic_messages:"anthropic_messages",audio_speech:"speech",audio_transcription:"transcription",embedding:"embeddings"};e.s(["EndpointType",()=>r,"getEndpointType",0,e=>{if(console.log("getEndpointType:",e),Object.values(o).includes(e)){let t=a[e];return console.log("endpointType:",t),t}return"chat"}],785913),e.s(["generateCodeSnippet",0,e=>{let t,{apiKeySource:i,accessToken:o,apiKey:a,inputMessage:n,chatHistory:s,selectedTags:l,selectedVectorStores:c,selectedGuardrails:d,selectedPolicies:u,selectedMCPServers:p,mcpServers:m,mcpServerToolRestrictions:g,selectedVoice:f,endpointType:h,selectedModel:_,selectedSdk:v,proxySettings:b}=e,x="session"===i?o:a,y=window.location.origin,w=b?.LITELLM_UI_API_DOC_BASE_URL;w&&w.trim()?y=w:b?.PROXY_BASE_URL&&(y=b.PROXY_BASE_URL);let S=n||"Your prompt here",j=S.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n"),k=s.filter(e=>!e.isImage).map(({role:e,content:t})=>({role:e,content:t})),C={};l.length>0&&(C.tags=l),c.length>0&&(C.vector_stores=c),d.length>0&&(C.guardrails=d),u.length>0&&(C.policies=u);let O=_||"your-model-name",N="azure"===v?`import openai + +client = openai.AzureOpenAI( + api_key="${x||"YOUR_LITELLM_API_KEY"}", + azure_endpoint="${y}", + api_version="2024-02-01" +)`:`import openai + +client = openai.OpenAI( + api_key="${x||"YOUR_LITELLM_API_KEY"}", + base_url="${y}" +)`;switch(h){case r.CHAT:{let e=Object.keys(C).length>0,i="";if(e){let e=JSON.stringify({metadata:C},null,2).split("\n").map(e=>" ".repeat(4)+e).join("\n").trim();i=`, + extra_body=${e}`}let o=k.length>0?k:[{role:"user",content:S}];t=` +import base64 + +# Helper function to encode images to base64 +def encode_image(image_path): + with open(image_path, "rb") as image_file: + return base64.b64encode(image_file.read()).decode('utf-8') + +# Example with text only +response = client.chat.completions.create( + model="${O}", + messages=${JSON.stringify(o,null,4)}${i} +) + +print(response) + +# Example with image or PDF (uncomment and provide file path to use) +# base64_file = encode_image("path/to/your/file.jpg") # or .pdf +# response_with_file = client.chat.completions.create( +# model="${O}", +# messages=[ +# { +# "role": "user", +# "content": [ +# { +# "type": "text", +# "text": "${j}" +# }, +# { +# "type": "image_url", +# "image_url": { +# "url": f"data:image/jpeg;base64,{base64_file}" # or data:application/pdf;base64,{base64_file} +# } +# } +# ] +# } +# ]${i} +# ) +# print(response_with_file) +`;break}case r.RESPONSES:{let e=Object.keys(C).length>0,i="";if(e){let e=JSON.stringify({metadata:C},null,2).split("\n").map(e=>" ".repeat(4)+e).join("\n").trim();i=`, + extra_body=${e}`}let o=k.length>0?k:[{role:"user",content:S}];t=` +import base64 + +# Helper function to encode images to base64 +def encode_image(image_path): + with open(image_path, "rb") as image_file: + return base64.b64encode(image_file.read()).decode('utf-8') + +# Example with text only +response = client.responses.create( + model="${O}", + input=${JSON.stringify(o,null,4)}${i} +) + +print(response.output_text) + +# Example with image or PDF (uncomment and provide file path to use) +# base64_file = encode_image("path/to/your/file.jpg") # or .pdf +# response_with_file = client.responses.create( +# model="${O}", +# input=[ +# { +# "role": "user", +# "content": [ +# {"type": "input_text", "text": "${j}"}, +# { +# "type": "input_image", +# "image_url": f"data:image/jpeg;base64,{base64_file}", # or data:application/pdf;base64,{base64_file} +# }, +# ], +# } +# ]${i} +# ) +# print(response_with_file.output_text) +`;break}case r.IMAGE:t="azure"===v?` +# NOTE: The Azure SDK does not have a direct equivalent to the multi-modal 'responses.create' method shown for OpenAI. +# This snippet uses 'client.images.generate' and will create a new image based on your prompt. +# It does not use the uploaded image, as 'client.images.generate' does not support image inputs in this context. +import os +import requests +import json +import time +from PIL import Image + +result = client.images.generate( + model="${O}", + prompt="${n}", + n=1 +) + +json_response = json.loads(result.model_dump_json()) + +# Set the directory for the stored image +image_dir = os.path.join(os.curdir, 'images') + +# If the directory doesn't exist, create it +if not os.path.isdir(image_dir): + os.mkdir(image_dir) + +# Initialize the image path +image_filename = f"generated_image_{int(time.time())}.png" +image_path = os.path.join(image_dir, image_filename) + +try: + # Retrieve the generated image + if json_response.get("data") && len(json_response["data"]) > 0 && json_response["data"][0].get("url"): + image_url = json_response["data"][0]["url"] + generated_image = requests.get(image_url).content + with open(image_path, "wb") as image_file: + image_file.write(generated_image) + + print(f"Image saved to {image_path}") + # Display the image + image = Image.open(image_path) + image.show() + else: + print("Could not find image URL in response.") + print("Full response:", json_response) +except Exception as e: + print(f"An error occurred: {e}") + print("Full response:", json_response) +`:` +import base64 +import os +import time +import json +from PIL import Image +import requests + +# Helper function to encode images to base64 +def encode_image(image_path): + with open(image_path, "rb") as image_file: + return base64.b64encode(image_file.read()).decode('utf-8') + +# Helper function to create a file (simplified for this example) +def create_file(image_path): + # In a real implementation, this would upload the file to OpenAI + # For this example, we'll just return a placeholder ID + return f"file_{os.path.basename(image_path).replace('.', '_')}" + +# The prompt entered by the user +prompt = "${j}" + +# Encode images to base64 +base64_image1 = encode_image("body-lotion.png") +base64_image2 = encode_image("soap.png") + +# Create file IDs +file_id1 = create_file("body-lotion.png") +file_id2 = create_file("incense-kit.png") + +response = client.responses.create( + model="${O}", + input=[ + { + "role": "user", + "content": [ + {"type": "input_text", "text": prompt}, + { + "type": "input_image", + "image_url": f"data:image/jpeg;base64,{base64_image1}", + }, + { + "type": "input_image", + "image_url": f"data:image/jpeg;base64,{base64_image2}", + }, + { + "type": "input_image", + "file_id": file_id1, + }, + { + "type": "input_image", + "file_id": file_id2, + } + ], + } + ], + tools=[{"type": "image_generation"}], +) + +# Process the response +image_generation_calls = [ + output + for output in response.output + if output.type == "image_generation_call" +] + +image_data = [output.result for output in image_generation_calls] + +if image_data: + image_base64 = image_data[0] + image_filename = f"edited_image_{int(time.time())}.png" + with open(image_filename, "wb") as f: + f.write(base64.b64decode(image_base64)) + print(f"Image saved to {image_filename}") +else: + # If no image is generated, there might be a text response with an explanation + text_response = [output.text for output in response.output if hasattr(output, 'text')] + if text_response: + print("No image generated. Model response:") + print("\\n".join(text_response)) + else: + print("No image data found in response.") + print("Full response for debugging:") + print(response) +`;break;case r.IMAGE_EDITS:t="azure"===v?` +import base64 +import os +import time +import json +from PIL import Image +import requests + +# Helper function to encode images to base64 +def encode_image(image_path): + with open(image_path, "rb") as image_file: + return base64.b64encode(image_file.read()).decode('utf-8') + +# The prompt entered by the user +prompt = "${j}" + +# Encode images to base64 +base64_image1 = encode_image("body-lotion.png") +base64_image2 = encode_image("soap.png") + +# Create file IDs +file_id1 = create_file("body-lotion.png") +file_id2 = create_file("incense-kit.png") + +response = client.responses.create( + model="${O}", + input=[ + { + "role": "user", + "content": [ + {"type": "input_text", "text": prompt}, + { + "type": "input_image", + "image_url": f"data:image/jpeg;base64,{base64_image1}", + }, + { + "type": "input_image", + "image_url": f"data:image/jpeg;base64,{base64_image2}", + }, + { + "type": "input_image", + "file_id": file_id1, + }, + { + "type": "input_image", + "file_id": file_id2, + } + ], + } + ], + tools=[{"type": "image_generation"}], +) + +# Process the response +image_generation_calls = [ + output + for output in response.output + if output.type == "image_generation_call" +] + +image_data = [output.result for output in image_generation_calls] + +if image_data: + image_base64 = image_data[0] + image_filename = f"edited_image_{int(time.time())}.png" + with open(image_filename, "wb") as f: + f.write(base64.b64decode(image_base64)) + print(f"Image saved to {image_filename}") +else: + # If no image is generated, there might be a text response with an explanation + text_response = [output.text for output in response.output if hasattr(output, 'text')] + if text_response: + print("No image generated. Model response:") + print("\\n".join(text_response)) + else: + print("No image data found in response.") + print("Full response for debugging:") + print(response) +`:` +import base64 +import os +import time + +# Helper function to encode images to base64 +def encode_image(image_path): + with open(image_path, "rb") as image_file: + return base64.b64encode(image_file.read()).decode('utf-8') + +# Helper function to create a file (simplified for this example) +def create_file(image_path): + # In a real implementation, this would upload the file to OpenAI + # For this example, we'll just return a placeholder ID + return f"file_{os.path.basename(image_path).replace('.', '_')}" + +# The prompt entered by the user +prompt = "${j}" + +# Encode images to base64 +base64_image1 = encode_image("body-lotion.png") +base64_image2 = encode_image("soap.png") + +# Create file IDs +file_id1 = create_file("body-lotion.png") +file_id2 = create_file("incense-kit.png") + +response = client.responses.create( + model="${O}", + input=[ + { + "role": "user", + "content": [ + {"type": "input_text", "text": prompt}, + { + "type": "input_image", + "image_url": f"data:image/jpeg;base64,{base64_image1}", + }, + { + "type": "input_image", + "image_url": f"data:image/jpeg;base64,{base64_image2}", + }, + { + "type": "input_image", + "file_id": file_id1, + }, + { + "type": "input_image", + "file_id": file_id2, + } + ], + } + ], + tools=[{"type": "image_generation"}], +) + +# Process the response +image_generation_calls = [ + output + for output in response.output + if output.type == "image_generation_call" +] + +image_data = [output.result for output in image_generation_calls] + +if image_data: + image_base64 = image_data[0] + image_filename = f"edited_image_{int(time.time())}.png" + with open(image_filename, "wb") as f: + f.write(base64.b64decode(image_base64)) + print(f"Image saved to {image_filename}") +else: + # If no image is generated, there might be a text response with an explanation + text_response = [output.text for output in response.output if hasattr(output, 'text')] + if text_response: + print("No image generated. Model response:") + print("\\n".join(text_response)) + else: + print("No image data found in response.") + print("Full response for debugging:") + print(response) +`;break;case r.EMBEDDINGS:t=` +response = client.embeddings.create( + input="${n||"Your string here"}", + model="${O}", + encoding_format="base64" # or "float" +) + +print(response.data[0].embedding) +`;break;case r.TRANSCRIPTION:t=` +# Open the audio file +audio_file = open("path/to/your/audio/file.mp3", "rb") + +# Make the transcription request +response = client.audio.transcriptions.create( + model="${O}", + file=audio_file${n?`, + prompt="${n.replace(/"/g,'\\"')}"`:""} +) + +print(response.text) +`;break;case r.SPEECH:t=` +# Make the text-to-speech request +response = client.audio.speech.create( + model="${O}", + input="${n||"Your text to convert to speech here"}", + voice="${f}" # Options: alloy, ash, ballad, coral, echo, fable, nova, onyx, sage, shimmer +) + +# Save the audio to a file +output_filename = "output_speech.mp3" +response.stream_to_file(output_filename) +print(f"Audio saved to {output_filename}") + +# Optional: Customize response format and speed +# response = client.audio.speech.create( +# model="${O}", +# input="${n||"Your text to convert to speech here"}", +# voice="alloy", +# response_format="mp3", # Options: mp3, opus, aac, flac, wav, pcm +# speed=1.0 # Range: 0.25 to 4.0 +# ) +# response.stream_to_file("output_speech.mp3") +`;break;default:t="\n# Code generation for this endpoint is not implemented yet."}return`${N} +${t}`}],190272)},516015,(e,t,i)=>{},898547,(e,t,i)=>{var o=e.i(247167);e.r(516015);var r=e.r(271645),a=r&&"object"==typeof r&&"default"in r?r:{default:r},n=void 0!==o.default&&o.default.env&&!0,s=function(e){return"[object String]"===Object.prototype.toString.call(e)},l=function(){function e(e){var t=void 0===e?{}:e,i=t.name,o=void 0===i?"stylesheet":i,r=t.optimizeForSpeed,a=void 0===r?n:r;c(s(o),"`name` must be a string"),this._name=o,this._deletedRulePlaceholder="#"+o+"-deleted-rule____{}",c("boolean"==typeof a,"`optimizeForSpeed` must be a boolean"),this._optimizeForSpeed=a,this._serverSheet=void 0,this._tags=[],this._injected=!1,this._rulesCount=0;var l="u">typeof window&&document.querySelector('meta[property="csp-nonce"]');this._nonce=l?l.getAttribute("content"):null}var t,i=e.prototype;return i.setOptimizeForSpeed=function(e){c("boolean"==typeof e,"`setOptimizeForSpeed` accepts a boolean"),c(0===this._rulesCount,"optimizeForSpeed cannot be when rules have already been inserted"),this.flush(),this._optimizeForSpeed=e,this.inject()},i.isOptimizeForSpeed=function(){return this._optimizeForSpeed},i.inject=function(){var e=this;if(c(!this._injected,"sheet already injected"),this._injected=!0,"u">typeof window&&this._optimizeForSpeed){this._tags[0]=this.makeStyleTag(this._name),this._optimizeForSpeed="insertRule"in this.getSheet(),this._optimizeForSpeed||(n||console.warn("StyleSheet: optimizeForSpeed mode not supported falling back to standard mode."),this.flush(),this._injected=!0);return}this._serverSheet={cssRules:[],insertRule:function(t,i){return"number"==typeof i?e._serverSheet.cssRules[i]={cssText:t}:e._serverSheet.cssRules.push({cssText:t}),i},deleteRule:function(t){e._serverSheet.cssRules[t]=null}}},i.getSheetForTag=function(e){if(e.sheet)return e.sheet;for(var t=0;ttypeof window?this.getSheet():this._serverSheet;if(t.trim()||(t=this._deletedRulePlaceholder),!i.cssRules[e])return e;i.deleteRule(e);try{i.insertRule(t,e)}catch(o){n||console.warn("StyleSheet: illegal rule: \n\n"+t+"\n\nSee https://stackoverflow.com/q/20007992 for more info"),i.insertRule(this._deletedRulePlaceholder,e)}}else{var o=this._tags[e];c(o,"old rule at index `"+e+"` not found"),o.textContent=t}return e},i.deleteRule=function(e){if("u"typeof window?(this._tags.forEach(function(e){return e&&e.parentNode.removeChild(e)}),this._tags=[]):this._serverSheet.cssRules=[]},i.cssRules=function(){var e=this;return"u">>0},u={};function p(e,t){if(!t)return"jsx-"+e;var i=String(t),o=e+i;return u[o]||(u[o]="jsx-"+d(e+"-"+i)),u[o]}function m(e,t){"u"typeof window&&!this._fromServer&&(this._fromServer=this.selectFromServer(),this._instancesCounts=Object.keys(this._fromServer).reduce(function(e,t){return e[t]=0,e},{}));var i=this.getIdAndRules(e),o=i.styleId,r=i.rules;if(o in this._instancesCounts){this._instancesCounts[o]+=1;return}var a=r.map(function(e){return t._sheet.insertRule(e)}).filter(function(e){return -1!==e});this._indices[o]=a,this._instancesCounts[o]=1},t.remove=function(e){var t=this,i=this.getIdAndRules(e).styleId;if(function(e,t){if(!e)throw Error("StyleSheetRegistry: "+t+".")}(i in this._instancesCounts,"styleId: `"+i+"` not found"),this._instancesCounts[i]-=1,this._instancesCounts[i]<1){var o=this._fromServer&&this._fromServer[i];o?(o.parentNode.removeChild(o),delete this._fromServer[i]):(this._indices[i].forEach(function(e){return t._sheet.deleteRule(e)}),delete this._indices[i]),delete this._instancesCounts[i]}},t.update=function(e,t){this.add(t),this.remove(e)},t.flush=function(){this._sheet.flush(),this._sheet.inject(),this._fromServer=void 0,this._indices={},this._instancesCounts={}},t.cssRules=function(){var e=this,t=this._fromServer?Object.keys(this._fromServer).map(function(t){return[t,e._fromServer[t]]}):[],i=this._sheet.cssRules();return t.concat(Object.keys(this._indices).map(function(t){return[t,e._indices[t].map(function(e){return i[e].cssText}).join(e._optimizeForSpeed?"":"\n")]}).filter(function(e){return!!e[1]}))},t.styles=function(e){var t,i;return t=this.cssRules(),void 0===(i=e)&&(i={}),t.map(function(e){var t=e[0],o=e[1];return a.default.createElement("style",{id:"__"+t,key:"__"+t,nonce:i.nonce?i.nonce:void 0,dangerouslySetInnerHTML:{__html:o}})})},t.getIdAndRules=function(e){var t=e.children,i=e.dynamic,o=e.id;if(i){var r=p(o,i);return{styleId:r,rules:Array.isArray(t)?t.map(function(e){return m(r,e)}):[m(r,t)]}}return{styleId:p(o),rules:Array.isArray(t)?t:[t]}},t.selectFromServer=function(){return Array.prototype.slice.call(document.querySelectorAll('[id^="__jsx-"]')).reduce(function(e,t){return e[t.id.slice(2)]=t,e},{})},e}(),f=r.createContext(null);function h(){return new g}function _(){return r.useContext(f)}f.displayName="StyleSheetContext";var v=a.default.useInsertionEffect||a.default.useLayoutEffect,b="u">typeof window?h():void 0;function x(e){var t=b||_();return t&&("u"{t.exports=e.r(898547).style},132104,e=>{"use strict";e.i(247167);var t=e.i(931067),i=e.i(271645);let o={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M868 545.5L536.1 163a31.96 31.96 0 00-48.3 0L156 545.5a7.97 7.97 0 006 13.2h81c4.6 0 9-2 12.1-5.5L474 300.9V864c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V300.9l218.9 252.3c3 3.5 7.4 5.5 12.1 5.5h81c6.8 0 10.5-8 6-13.2z"}}]},name:"arrow-up",theme:"outlined"};var r=e.i(9583),a=i.forwardRef(function(e,a){return i.createElement(r.default,(0,t.default)({},e,{ref:a,icon:o}))});e.s(["ArrowUpOutlined",0,a],132104)},447593,989022,e=>{"use strict";e.i(247167);var t=e.i(931067),i=e.i(271645),o={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"defs",attrs:{},children:[{tag:"style",attrs:{}}]},{tag:"path",attrs:{d:"M899.1 869.6l-53-305.6H864c14.4 0 26-11.6 26-26V346c0-14.4-11.6-26-26-26H618V138c0-14.4-11.6-26-26-26H432c-14.4 0-26 11.6-26 26v182H160c-14.4 0-26 11.6-26 26v192c0 14.4 11.6 26 26 26h17.9l-53 305.6a25.95 25.95 0 0025.6 30.4h723c1.5 0 3-.1 4.4-.4a25.88 25.88 0 0021.2-30zM204 390h272V182h72v208h272v104H204V390zm468 440V674c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v156H416V674c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v156H202.8l45.1-260H776l45.1 260H672z"}}]},name:"clear",theme:"outlined"},r=e.i(9583),a=i.forwardRef(function(e,a){return i.createElement(r.default,(0,t.default)({},e,{ref:a,icon:o}))});e.s(["ClearOutlined",0,a],447593);var n=e.i(843476),s=e.i(592968),l=e.i(637235);let c={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M872 394c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8H708V152c0-4.4-3.6-8-8-8h-64c-4.4 0-8 3.6-8 8v166H400V152c0-4.4-3.6-8-8-8h-64c-4.4 0-8 3.6-8 8v166H152c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h168v236H152c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h168v166c0 4.4 3.6 8 8 8h64c4.4 0 8-3.6 8-8V706h228v166c0 4.4 3.6 8 8 8h64c4.4 0 8-3.6 8-8V706h164c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8H708V394h164zM628 630H400V394h228v236z"}}]},name:"number",theme:"outlined"};var d=i.forwardRef(function(e,o){return i.createElement(r.default,(0,t.default)({},e,{ref:o,icon:c}))});let u={icon:{tag:"svg",attrs:{"fill-rule":"evenodd",viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M880 912H144c-17.7 0-32-14.3-32-32V144c0-17.7 14.3-32 32-32h360c4.4 0 8 3.6 8 8v56c0 4.4-3.6 8-8 8H184v656h656V520c0-4.4 3.6-8 8-8h56c4.4 0 8 3.6 8 8v360c0 17.7-14.3 32-32 32zM653.3 424.6l52.2 52.2a8.01 8.01 0 01-4.7 13.6l-179.4 21c-5.1.6-9.5-3.7-8.9-8.9l21-179.4c.8-6.6 8.9-9.4 13.6-4.7l52.4 52.4 256.2-256.2c3.1-3.1 8.2-3.1 11.3 0l42.4 42.4c3.1 3.1 3.1 8.2 0 11.3L653.3 424.6z"}}]},name:"import",theme:"outlined"};var p=i.forwardRef(function(e,o){return i.createElement(r.default,(0,t.default)({},e,{ref:o,icon:u}))}),m=e.i(872934),g=e.i(812618),f=e.i(366308),h=e.i(458505);e.s(["default",0,({timeToFirstToken:e,totalLatency:t,usage:i,toolName:o})=>e||t||i?(0,n.jsxs)("div",{className:"response-metrics mt-2 pt-2 border-t border-gray-100 text-xs text-gray-500 flex flex-wrap gap-3",children:[void 0!==e&&(0,n.jsx)(s.Tooltip,{title:"Time to first token",children:(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsx)(l.ClockCircleOutlined,{className:"mr-1"}),(0,n.jsxs)("span",{children:["TTFT: ",(e/1e3).toFixed(2),"s"]})]})}),void 0!==t&&(0,n.jsx)(s.Tooltip,{title:"Total latency",children:(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsx)(l.ClockCircleOutlined,{className:"mr-1"}),(0,n.jsxs)("span",{children:["Total Latency: ",(t/1e3).toFixed(2),"s"]})]})}),i?.promptTokens!==void 0&&(0,n.jsx)(s.Tooltip,{title:"Prompt tokens",children:(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsx)(p,{className:"mr-1"}),(0,n.jsxs)("span",{children:["In: ",i.promptTokens]})]})}),i?.completionTokens!==void 0&&(0,n.jsx)(s.Tooltip,{title:"Completion tokens",children:(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsx)(m.ExportOutlined,{className:"mr-1"}),(0,n.jsxs)("span",{children:["Out: ",i.completionTokens]})]})}),i?.reasoningTokens!==void 0&&(0,n.jsx)(s.Tooltip,{title:"Reasoning tokens",children:(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsx)(g.BulbOutlined,{className:"mr-1"}),(0,n.jsxs)("span",{children:["Reasoning: ",i.reasoningTokens]})]})}),i?.totalTokens!==void 0&&(0,n.jsx)(s.Tooltip,{title:"Total tokens",children:(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsx)(d,{className:"mr-1"}),(0,n.jsxs)("span",{children:["Total: ",i.totalTokens]})]})}),i?.cost!==void 0&&(0,n.jsx)(s.Tooltip,{title:"Cost",children:(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsx)(h.DollarOutlined,{className:"mr-1"}),(0,n.jsxs)("span",{children:["$",i.cost.toFixed(6)]})]})}),o&&(0,n.jsx)(s.Tooltip,{title:"Tool used",children:(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsx)(f.ToolOutlined,{className:"mr-1"}),(0,n.jsxs)("span",{children:["Tool: ",o]})]})})]}):null],989022)},254530,e=>{"use strict";var t=e.i(356449),i=e.i(764205);async function o(e,o,r,a,n,s,l,c,d,u,p,m,g,f,h,_,v,b,x,y,w,S,j,k){console.log=function(){},console.log("isLocal:",!1);let C=y||(0,i.getProxyBaseUrl)(),O={};n&&n.length>0&&(O["x-litellm-tags"]=n.join(","));let N=new t.default.OpenAI({apiKey:a,baseURL:C,dangerouslyAllowBrowser:!0,defaultHeaders:O});try{let t,i=Date.now(),a=!1,n={},y=!1,C=[];for await(let x of(f&&f.length>0&&(f.includes("__all__")?C.push({type:"mcp",server_label:"litellm",server_url:"litellm_proxy/mcp",require_approval:"never"}):f.forEach(e=>{let t=w?.find(t=>t.server_id===e),i=t?.alias||t?.server_name||e,o=S?.[e]||[];C.push({type:"mcp",server_label:"litellm",server_url:`litellm_proxy/mcp/${i}`,require_approval:"never",...o.length>0?{allowed_tools:o}:{}})})),await N.chat.completions.create({model:r,stream:!0,stream_options:{include_usage:!0},litellm_trace_id:u,messages:e,...p?{vector_store_ids:p}:{},...m?{guardrails:m}:{},...g?{policies:g}:{},...C.length>0?{tools:C,tool_choice:"auto"}:{},...void 0!==v?{temperature:v}:{},...void 0!==b?{max_tokens:b}:{},...k?{mock_testing_fallbacks:!0}:{}},{signal:s}))){console.log("Stream chunk:",x);let e=x.choices[0]?.delta;if(console.log("Delta content:",x.choices[0]?.delta?.content),console.log("Delta reasoning content:",e?.reasoning_content),!a&&(x.choices[0]?.delta?.content||e&&e.reasoning_content)&&(a=!0,t=Date.now()-i,console.log("First token received! Time:",t,"ms"),c?(console.log("Calling onTimingData with:",t),c(t)):console.log("onTimingData callback is not defined!")),x.choices[0]?.delta?.content){let e=x.choices[0].delta.content;o(e,x.model)}if(e&&e.image&&h&&(console.log("Image generated:",e.image),h(e.image.url,x.model)),e&&e.reasoning_content){let t=e.reasoning_content;l&&l(t)}if(e&&e.provider_specific_fields?.search_results&&_&&(console.log("Search results found:",e.provider_specific_fields.search_results),_(e.provider_specific_fields.search_results)),e&&e.provider_specific_fields){let t=e.provider_specific_fields;if(t.mcp_list_tools&&!n.mcp_list_tools&&(n.mcp_list_tools=t.mcp_list_tools,j&&!y)){y=!0;let e={type:"response.output_item.done",item_id:"mcp_list_tools",item:{type:"mcp_list_tools",tools:t.mcp_list_tools.map(e=>({name:e.function?.name||e.name||"",description:e.function?.description||e.description||"",input_schema:e.function?.parameters||e.input_schema||{}}))},timestamp:Date.now()};j(e),console.log("MCP list_tools event sent:",e)}t.mcp_tool_calls&&(n.mcp_tool_calls=t.mcp_tool_calls),t.mcp_call_results&&(n.mcp_call_results=t.mcp_call_results),(t.mcp_list_tools||t.mcp_tool_calls||t.mcp_call_results)&&console.log("MCP metadata found in chunk:",{mcp_list_tools:t.mcp_list_tools?"present":"absent",mcp_tool_calls:t.mcp_tool_calls?"present":"absent",mcp_call_results:t.mcp_call_results?"present":"absent"})}if(x.usage&&d){console.log("Usage data found:",x.usage);let e={completionTokens:x.usage.completion_tokens,promptTokens:x.usage.prompt_tokens,totalTokens:x.usage.total_tokens};x.usage.completion_tokens_details?.reasoning_tokens&&(e.reasoningTokens=x.usage.completion_tokens_details.reasoning_tokens),void 0!==x.usage.cost&&null!==x.usage.cost&&(e.cost=parseFloat(x.usage.cost)),d(e)}}j&&(n.mcp_tool_calls||n.mcp_call_results)&&n.mcp_tool_calls&&n.mcp_tool_calls.length>0&&n.mcp_tool_calls.forEach((e,t)=>{let i=e.function?.name||e.name||"",o=e.function?.arguments||e.arguments||"{}",r=n.mcp_call_results?.find(t=>t.tool_call_id===e.id||t.tool_call_id===e.call_id)||n.mcp_call_results?.[t],a={type:"response.output_item.done",item:{type:"mcp_call",name:i,arguments:"string"==typeof o?o:JSON.stringify(o),output:r?.result?"string"==typeof r.result?r.result:JSON.stringify(r.result):void 0},item_id:e.id||e.call_id,timestamp:Date.now()};j(a),console.log("MCP call event sent:",a)});let O=Date.now();x&&x(O-i)}catch(e){throw s?.aborted&&console.log("Chat completion request was cancelled"),e}}e.s(["makeOpenAIChatCompletionRequest",()=>o])},966988,e=>{"use strict";var t=e.i(843476),i=e.i(271645),o=e.i(464571),r=e.i(918789),a=e.i(650056),n=e.i(219470),s=e.i(755151),l=e.i(240647),c=e.i(812618);e.s(["default",0,({reasoningContent:e})=>{let[d,u]=(0,i.useState)(!0);return e?(0,t.jsxs)("div",{className:"reasoning-content mt-1 mb-2",children:[(0,t.jsxs)(o.Button,{type:"text",className:"flex items-center text-xs text-gray-500 hover:text-gray-700",onClick:()=>u(!d),icon:(0,t.jsx)(c.BulbOutlined,{}),children:[d?"Hide reasoning":"Show reasoning",d?(0,t.jsx)(s.DownOutlined,{className:"ml-1"}):(0,t.jsx)(l.RightOutlined,{className:"ml-1"})]}),d&&(0,t.jsx)("div",{className:"mt-2 p-3 bg-gray-50 border border-gray-200 rounded-md text-sm text-gray-700",children:(0,t.jsx)(r.default,{components:{code({node:e,inline:i,className:o,children:r,...s}){let l=/language-(\w+)/.exec(o||"");return!i&&l?(0,t.jsx)(a.Prism,{style:n.coy,language:l[1],PreTag:"div",className:"rounded-md my-2",...s,children:String(r).replace(/\n$/,"")}):(0,t.jsx)("code",{className:`${o} px-1.5 py-0.5 rounded bg-gray-100 text-sm font-mono`,...s,children:r})}},children:e})})]}):null}])},362024,e=>{"use strict";var t=e.i(988122);e.s(["Collapse",()=>t.default])},166406,e=>{"use strict";var t=e.i(190144);e.s(["CopyOutlined",()=>t.default])},240647,e=>{"use strict";var t=e.i(286612);e.s(["RightOutlined",()=>t.default])},829672,836938,310730,e=>{"use strict";e.i(247167);var t=e.i(271645),i=e.i(343794),o=e.i(914949),r=e.i(404948);let a=e=>e?"function"==typeof e?e():e:null;e.s(["getRenderPropValue",0,a],836938);var n=e.i(613541),s=e.i(763731),l=e.i(242064),c=e.i(491816);e.i(793154);var d=e.i(880476),u=e.i(183293),p=e.i(717356),m=e.i(320560),g=e.i(307358),f=e.i(246422),h=e.i(838378),_=e.i(617933);let v=(0,f.genStyleHooks)("Popover",e=>{let{colorBgElevated:t,colorText:i}=e,o=(0,h.mergeToken)(e,{popoverBg:t,popoverColor:i});return[(e=>{let{componentCls:t,popoverColor:i,titleMinWidth:o,fontWeightStrong:r,innerPadding:a,boxShadowSecondary:n,colorTextHeading:s,borderRadiusLG:l,zIndexPopup:c,titleMarginBottom:d,colorBgElevated:p,popoverBg:g,titleBorderBottom:f,innerContentPadding:h,titlePadding:_}=e;return[{[t]:Object.assign(Object.assign({},(0,u.resetComponent)(e)),{position:"absolute",top:0,left:{_skip_check_:!0,value:0},zIndex:c,fontWeight:"normal",whiteSpace:"normal",textAlign:"start",cursor:"auto",userSelect:"text","--valid-offset-x":"var(--arrow-offset-horizontal, var(--arrow-x))",transformOrigin:"var(--valid-offset-x, 50%) var(--arrow-y, 50%)","--antd-arrow-background-color":p,width:"max-content",maxWidth:"100vw","&-rtl":{direction:"rtl"},"&-hidden":{display:"none"},[`${t}-content`]:{position:"relative"},[`${t}-inner`]:{backgroundColor:g,backgroundClip:"padding-box",borderRadius:l,boxShadow:n,padding:a},[`${t}-title`]:{minWidth:o,marginBottom:d,color:s,fontWeight:r,borderBottom:f,padding:_},[`${t}-inner-content`]:{color:i,padding:h}})},(0,m.default)(e,"var(--antd-arrow-background-color)"),{[`${t}-pure`]:{position:"relative",maxWidth:"none",margin:e.sizePopupArrow,display:"inline-block",[`${t}-content`]:{display:"inline-block"}}}]})(o),(e=>{let{componentCls:t}=e;return{[t]:_.PresetColors.map(i=>{let o=e[`${i}6`];return{[`&${t}-${i}`]:{"--antd-arrow-background-color":o,[`${t}-inner`]:{backgroundColor:o},[`${t}-arrow`]:{background:"transparent"}}}})}})(o),(0,p.initZoomMotion)(o,"zoom-big")]},e=>{let{lineWidth:t,controlHeight:i,fontHeight:o,padding:r,wireframe:a,zIndexPopupBase:n,borderRadiusLG:s,marginXS:l,lineType:c,colorSplit:d,paddingSM:u}=e,p=i-o;return Object.assign(Object.assign(Object.assign({titleMinWidth:177,zIndexPopup:n+30},(0,g.getArrowToken)(e)),(0,m.getArrowOffsetToken)({contentRadius:s,limitVerticalRadius:!0})),{innerPadding:12*!a,titleMarginBottom:a?0:l,titlePadding:a?`${p/2}px ${r}px ${p/2-t}px`:0,titleBorderBottom:a?`${t}px ${c} ${d}`:"none",innerContentPadding:a?`${u}px ${r}px`:0})},{resetStyle:!1,deprecatedTokens:[["width","titleMinWidth"],["minWidth","titleMinWidth"]]});var b=function(e,t){var i={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>t.indexOf(o)&&(i[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])&&(i[o[r]]=e[o[r]]);return i};let x=({title:e,content:i,prefixCls:o})=>e||i?t.createElement(t.Fragment,null,e&&t.createElement("div",{className:`${o}-title`},e),i&&t.createElement("div",{className:`${o}-inner-content`},i)):null,y=e=>{let{hashId:o,prefixCls:r,className:n,style:s,placement:l="top",title:c,content:u,children:p}=e,m=a(c),g=a(u),f=(0,i.default)(o,r,`${r}-pure`,`${r}-placement-${l}`,n);return t.createElement("div",{className:f,style:s},t.createElement("div",{className:`${r}-arrow`}),t.createElement(d.Popup,Object.assign({},e,{className:o,prefixCls:r}),p||t.createElement(x,{prefixCls:r,title:m,content:g})))},w=e=>{let{prefixCls:o,className:r}=e,a=b(e,["prefixCls","className"]),{getPrefixCls:n}=t.useContext(l.ConfigContext),s=n("popover",o),[c,d,u]=v(s);return c(t.createElement(y,Object.assign({},a,{prefixCls:s,hashId:d,className:(0,i.default)(r,u)})))};e.s(["Overlay",0,x,"default",0,w],310730);var S=function(e,t){var i={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>t.indexOf(o)&&(i[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])&&(i[o[r]]=e[o[r]]);return i};let j=t.forwardRef((e,d)=>{var u,p;let{prefixCls:m,title:g,content:f,overlayClassName:h,placement:_="top",trigger:b="hover",children:y,mouseEnterDelay:w=.1,mouseLeaveDelay:j=.1,onOpenChange:k,overlayStyle:C={},styles:O,classNames:N}=e,z=S(e,["prefixCls","title","content","overlayClassName","placement","trigger","children","mouseEnterDelay","mouseLeaveDelay","onOpenChange","overlayStyle","styles","classNames"]),{getPrefixCls:E,className:T,style:R,classNames:I,styles:M}=(0,l.useComponentConfig)("popover"),A=E("popover",m),[$,L,P]=v(A),H=E(),B=(0,i.default)(h,L,P,T,I.root,null==N?void 0:N.root),F=(0,i.default)(I.body,null==N?void 0:N.body),[V,D]=(0,o.default)(!1,{value:null!=(u=e.open)?u:e.visible,defaultValue:null!=(p=e.defaultOpen)?p:e.defaultVisible}),W=(e,t)=>{D(e,!0),null==k||k(e,t)},U=a(g),q=a(f);return $(t.createElement(c.default,Object.assign({placement:_,trigger:b,mouseEnterDelay:w,mouseLeaveDelay:j},z,{prefixCls:A,classNames:{root:B,body:F},styles:{root:Object.assign(Object.assign(Object.assign(Object.assign({},M.root),R),C),null==O?void 0:O.root),body:Object.assign(Object.assign({},M.body),null==O?void 0:O.body)},ref:d,open:V,onOpenChange:e=>{W(e)},overlay:U||q?t.createElement(x,{prefixCls:A,title:U,content:q}):null,transitionName:(0,n.getTransitionName)(H,"zoom-big",z.transitionName),"data-popover-inject":!0}),(0,s.cloneElement)(y,{onKeyDown:e=>{var i,o;(0,t.isValidElement)(y)&&(null==(o=null==y?void 0:(i=y.props).onKeyDown)||o.call(i,e)),e.keyCode===r.default.ESC&&W(!1,e)}})))});j._InternalPanelDoNotUseOrYouWillBeFired=w,e.s(["default",0,j],829672)},282786,e=>{"use strict";var t=e.i(829672);e.s(["Popover",()=>t.default])},219470,812618,e=>{"use strict";e.s(["coy",0,{'code[class*="language-"]':{color:"black",background:"none",fontFamily:"Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace",fontSize:"1em",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",wordWrap:"normal",lineHeight:"1.5",MozTabSize:"4",OTabSize:"4",tabSize:"4",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none",maxHeight:"inherit",height:"inherit",padding:"0 1em",display:"block",overflow:"auto"},'pre[class*="language-"]':{color:"black",background:"none",fontFamily:"Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace",fontSize:"1em",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",wordWrap:"normal",lineHeight:"1.5",MozTabSize:"4",OTabSize:"4",tabSize:"4",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none",position:"relative",margin:".5em 0",overflow:"visible",padding:"1px",backgroundColor:"#fdfdfd",WebkitBoxSizing:"border-box",MozBoxSizing:"border-box",boxSizing:"border-box",marginBottom:"1em"},'pre[class*="language-"] > code':{position:"relative",zIndex:"1",borderLeft:"10px solid #358ccb",boxShadow:"-1px 0px 0px 0px #358ccb, 0px 0px 0px 1px #dfdfdf",backgroundColor:"#fdfdfd",backgroundImage:"linear-gradient(transparent 50%, rgba(69, 142, 209, 0.04) 50%)",backgroundSize:"3em 3em",backgroundOrigin:"content-box",backgroundAttachment:"local"},':not(pre) > code[class*="language-"]':{backgroundColor:"#fdfdfd",WebkitBoxSizing:"border-box",MozBoxSizing:"border-box",boxSizing:"border-box",marginBottom:"1em",position:"relative",padding:".2em",borderRadius:"0.3em",color:"#c92c2c",border:"1px solid rgba(0, 0, 0, 0.1)",display:"inline",whiteSpace:"normal"},'pre[class*="language-"]:before':{content:"''",display:"block",position:"absolute",bottom:"0.75em",left:"0.18em",width:"40%",height:"20%",maxHeight:"13em",boxShadow:"0px 13px 8px #979797",WebkitTransform:"rotate(-2deg)",MozTransform:"rotate(-2deg)",msTransform:"rotate(-2deg)",OTransform:"rotate(-2deg)",transform:"rotate(-2deg)"},'pre[class*="language-"]:after':{content:"''",display:"block",position:"absolute",bottom:"0.75em",left:"auto",width:"40%",height:"20%",maxHeight:"13em",boxShadow:"0px 13px 8px #979797",WebkitTransform:"rotate(2deg)",MozTransform:"rotate(2deg)",msTransform:"rotate(2deg)",OTransform:"rotate(2deg)",transform:"rotate(2deg)",right:"0.75em"},comment:{color:"#7D8B99"},"block-comment":{color:"#7D8B99"},prolog:{color:"#7D8B99"},doctype:{color:"#7D8B99"},cdata:{color:"#7D8B99"},punctuation:{color:"#5F6364"},property:{color:"#c92c2c"},tag:{color:"#c92c2c"},boolean:{color:"#c92c2c"},number:{color:"#c92c2c"},"function-name":{color:"#c92c2c"},constant:{color:"#c92c2c"},symbol:{color:"#c92c2c"},deleted:{color:"#c92c2c"},selector:{color:"#2f9c0a"},"attr-name":{color:"#2f9c0a"},string:{color:"#2f9c0a"},char:{color:"#2f9c0a"},function:{color:"#2f9c0a"},builtin:{color:"#2f9c0a"},inserted:{color:"#2f9c0a"},operator:{color:"#a67f59",background:"rgba(255, 255, 255, 0.5)"},entity:{color:"#a67f59",background:"rgba(255, 255, 255, 0.5)",cursor:"help"},url:{color:"#a67f59",background:"rgba(255, 255, 255, 0.5)"},variable:{color:"#a67f59",background:"rgba(255, 255, 255, 0.5)"},atrule:{color:"#1990b8"},"attr-value":{color:"#1990b8"},keyword:{color:"#1990b8"},"class-name":{color:"#1990b8"},regex:{color:"#e90"},important:{color:"#e90",fontWeight:"normal"},".language-css .token.string":{color:"#a67f59",background:"rgba(255, 255, 255, 0.5)"},".style .token.string":{color:"#a67f59",background:"rgba(255, 255, 255, 0.5)"},bold:{fontWeight:"bold"},italic:{fontStyle:"italic"},namespace:{Opacity:".7"},'pre[class*="language-"].line-numbers.line-numbers':{paddingLeft:"0"},'pre[class*="language-"].line-numbers.line-numbers code':{paddingLeft:"3.8em"},'pre[class*="language-"].line-numbers.line-numbers .line-numbers-rows':{left:"0"},'pre[class*="language-"][data-line]':{paddingTop:"0",paddingBottom:"0",paddingLeft:"0"},"pre[data-line] code":{position:"relative",paddingLeft:"4em"},"pre .line-highlight":{marginTop:"0"}}],219470),e.i(247167);var t=e.i(931067),i=e.i(271645);let o={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M632 888H392c-4.4 0-8 3.6-8 8v32c0 17.7 14.3 32 32 32h192c17.7 0 32-14.3 32-32v-32c0-4.4-3.6-8-8-8zM512 64c-181.1 0-328 146.9-328 328 0 121.4 66 227.4 164 284.1V792c0 17.7 14.3 32 32 32h264c17.7 0 32-14.3 32-32V676.1c98-56.7 164-162.7 164-284.1 0-181.1-146.9-328-328-328zm127.9 549.8L604 634.6V752H420V634.6l-35.9-20.8C305.4 568.3 256 484.5 256 392c0-141.4 114.6-256 256-256s256 114.6 256 256c0 92.5-49.4 176.3-128.1 221.8z"}}]},name:"bulb",theme:"outlined"};var r=e.i(9583),a=i.forwardRef(function(e,a){return i.createElement(r.default,(0,t.default)({},e,{ref:a,icon:o}))});e.s(["BulbOutlined",0,a],812618)},84899,e=>{"use strict";e.i(247167);var t=e.i(931067),i=e.i(271645),o={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"},r=e.i(9583),a=i.forwardRef(function(e,a){return i.createElement(r.default,(0,t.default)({},e,{ref:a,icon:o}))});e.s(["SendOutlined",0,a],84899)},872934,e=>{"use strict";e.i(247167);var t=e.i(931067),i=e.i(271645);let o={icon:{tag:"svg",attrs:{"fill-rule":"evenodd",viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M880 912H144c-17.7 0-32-14.3-32-32V144c0-17.7 14.3-32 32-32h360c4.4 0 8 3.6 8 8v56c0 4.4-3.6 8-8 8H184v656h656V520c0-4.4 3.6-8 8-8h56c4.4 0 8 3.6 8 8v360c0 17.7-14.3 32-32 32zM770.87 199.13l-52.2-52.2a8.01 8.01 0 014.7-13.6l179.4-21c5.1-.6 9.5 3.7 8.9 8.9l-21 179.4c-.8 6.6-8.9 9.4-13.6 4.7l-52.4-52.4-256.2 256.2a8.03 8.03 0 01-11.3 0l-42.4-42.4a8.03 8.03 0 010-11.3l256.1-256.3z"}}]},name:"export",theme:"outlined"};var r=e.i(9583),a=i.forwardRef(function(e,a){return i.createElement(r.default,(0,t.default)({},e,{ref:a,icon:o}))});e.s(["ExportOutlined",0,a],872934)},518617,e=>{"use strict";e.i(247167);var t=e.i(931067),i=e.i(271645);let o={icon:{tag:"svg",attrs:{"fill-rule":"evenodd",viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64c247.4 0 448 200.6 448 448S759.4 960 512 960 64 759.4 64 512 264.6 64 512 64zm0 76c-205.4 0-372 166.6-372 372s166.6 372 372 372 372-166.6 372-372-166.6-372-372-372zm128.01 198.83c.03 0 .05.01.09.06l45.02 45.01a.2.2 0 01.05.09.12.12 0 010 .07c0 .02-.01.04-.05.08L557.25 512l127.87 127.86a.27.27 0 01.05.06v.02a.12.12 0 010 .07c0 .03-.01.05-.05.09l-45.02 45.02a.2.2 0 01-.09.05.12.12 0 01-.07 0c-.02 0-.04-.01-.08-.05L512 557.25 384.14 685.12c-.04.04-.06.05-.08.05a.12.12 0 01-.07 0c-.03 0-.05-.01-.09-.05l-45.02-45.02a.2.2 0 01-.05-.09.12.12 0 010-.07c0-.02.01-.04.06-.08L466.75 512 338.88 384.14a.27.27 0 01-.05-.06l-.01-.02a.12.12 0 010-.07c0-.03.01-.05.05-.09l45.02-45.02a.2.2 0 01.09-.05.12.12 0 01.07 0c.02 0 .04.01.08.06L512 466.75l127.86-127.86c.04-.05.06-.06.08-.06a.12.12 0 01.07 0z"}}]},name:"close-circle",theme:"outlined"};var r=e.i(9583),a=i.forwardRef(function(e,a){return i.createElement(r.default,(0,t.default)({},e,{ref:a,icon:o}))});e.s(["CloseCircleOutlined",0,a],518617)},891547,e=>{"use strict";var t=e.i(843476),i=e.i(271645),o=e.i(199133),r=e.i(764205);e.s(["default",0,({onChange:e,value:a,className:n,accessToken:s,disabled:l})=>{let[c,d]=(0,i.useState)([]),[u,p]=(0,i.useState)(!1);return(0,i.useEffect)(()=>{(async()=>{if(s){p(!0);try{let e=await (0,r.getGuardrailsList)(s);console.log("Guardrails response:",e),e.guardrails&&(console.log("Guardrails data:",e.guardrails),d(e.guardrails))}catch(e){console.error("Error fetching guardrails:",e)}finally{p(!1)}}})()},[s]),(0,t.jsx)("div",{children:(0,t.jsx)(o.Select,{mode:"multiple",disabled:l,placeholder:l?"Setting guardrails is a premium feature.":"Select guardrails",onChange:t=>{console.log("Selected guardrails:",t),e(t)},value:a,loading:u,className:n,allowClear:!0,options:c.map(e=>(console.log("Mapping guardrail:",e),{label:`${e.guardrail_name}`,value:e.guardrail_name})),optionFilterProp:"label",showSearch:!0,style:{width:"100%"}})})}])},921511,e=>{"use strict";var t=e.i(843476),i=e.i(271645),o=e.i(199133),r=e.i(764205);function a(e){return e.filter(e=>(e.version_status??"draft")!=="draft").map(e=>{var t;let i=e.version_number??1,o=e.version_status??"draft";return{label:`${e.policy_name} — v${i} (${o})${e.description?` — ${e.description}`:""}`,value:"production"===o?e.policy_name:e.policy_id?(t=e.policy_id,`policy_${t}`):e.policy_name}})}e.s(["default",0,({onChange:e,value:n,className:s,accessToken:l,disabled:c,onPoliciesLoaded:d})=>{let[u,p]=(0,i.useState)([]),[m,g]=(0,i.useState)(!1);return(0,i.useEffect)(()=>{(async()=>{if(l){g(!0);try{let e=await (0,r.getPoliciesList)(l);e.policies&&(p(e.policies),d?.(e.policies))}catch(e){console.error("Error fetching policies:",e)}finally{g(!1)}}})()},[l,d]),(0,t.jsx)("div",{children:(0,t.jsx)(o.Select,{mode:"multiple",disabled:c,placeholder:c?"Setting policies is a premium feature.":"Select policies (production or published versions)",onChange:t=>{e(t)},value:n,loading:m,className:s,allowClear:!0,options:a(u),optionFilterProp:"label",showSearch:!0,style:{width:"100%"}})})},"getPolicyOptionEntries",()=>a])},916940,e=>{"use strict";var t=e.i(843476),i=e.i(271645),o=e.i(199133),r=e.i(764205);e.s(["default",0,({onChange:e,value:a,className:n,accessToken:s,placeholder:l="Select vector stores",disabled:c=!1})=>{let[d,u]=(0,i.useState)([]),[p,m]=(0,i.useState)(!1);return(0,i.useEffect)(()=>{(async()=>{if(s){m(!0);try{let e=await (0,r.vectorStoreListCall)(s);e.data&&u(e.data)}catch(e){console.error("Error fetching vector stores:",e)}finally{m(!1)}}})()},[s]),(0,t.jsx)("div",{children:(0,t.jsx)(o.Select,{mode:"multiple",placeholder:l,onChange:e,value:a,loading:p,className:n,allowClear:!0,options:d.map(e=>({label:`${e.vector_store_name||e.vector_store_id} (${e.vector_store_id})`,value:e.vector_store_id,title:e.vector_store_description||e.vector_store_id})),optionFilterProp:"label",showSearch:!0,style:{width:"100%"},disabled:c})})}])},689020,e=>{"use strict";var t=e.i(764205);let i=async e=>{try{let i=await (0,t.modelHubCall)(e);if(console.log("model_info:",i),i?.data.length>0){let e=i.data.map(e=>({model_group:e.model_group,mode:e?.mode}));return e.sort((e,t)=>e.model_group.localeCompare(t.model_group)),e}return[]}catch(e){throw console.error("Error fetching model info:",e),e}};e.s(["fetchAvailableModels",0,i])},983561,e=>{"use strict";e.i(247167);var t=e.i(931067),i=e.i(271645);let 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"};var r=e.i(9583),a=i.forwardRef(function(e,a){return i.createElement(r.default,(0,t.default)({},e,{ref:a,icon:o}))});e.s(["RobotOutlined",0,a],983561)},737434,e=>{"use strict";var t=e.i(184163);e.s(["DownloadOutlined",()=>t.default])},447566,e=>{"use strict";e.i(247167);var t=e.i(931067),i=e.i(271645);let o={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M872 474H286.9l350.2-304c5.6-4.9 2.2-14-5.2-14h-88.5c-3.9 0-7.6 1.4-10.5 3.9L155 487.8a31.96 31.96 0 000 48.3L535.1 866c1.5 1.3 3.3 2 5.2 2h91.5c7.4 0 10.8-9.2 5.2-14L286.9 550H872c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z"}}]},name:"arrow-left",theme:"outlined"};var r=e.i(9583),a=i.forwardRef(function(e,a){return i.createElement(r.default,(0,t.default)({},e,{ref:a,icon:o}))});e.s(["ArrowLeftOutlined",0,a],447566)},637235,e=>{"use strict";e.i(247167);var t=e.i(931067),i=e.i(271645);let o={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}},{tag:"path",attrs:{d:"M686.7 638.6L544.1 535.5V288c0-4.4-3.6-8-8-8H488c-4.4 0-8 3.6-8 8v275.4c0 2.6 1.2 5 3.3 6.5l165.4 120.6c3.6 2.6 8.6 1.8 11.2-1.7l28.6-39c2.6-3.7 1.8-8.7-1.8-11.2z"}}]},name:"clock-circle",theme:"outlined"};var r=e.i(9583),a=i.forwardRef(function(e,a){return i.createElement(r.default,(0,t.default)({},e,{ref:a,icon:o}))});e.s(["ClockCircleOutlined",0,a],637235)},782273,793916,e=>{"use strict";e.i(247167);var t=e.i(931067),i=e.i(271645);let o={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M625.9 115c-5.9 0-11.9 1.6-17.4 5.3L254 352H90c-8.8 0-16 7.2-16 16v288c0 8.8 7.2 16 16 16h164l354.5 231.7c5.5 3.6 11.6 5.3 17.4 5.3 16.7 0 32.1-13.3 32.1-32.1V147.1c0-18.8-15.4-32.1-32.1-32.1zM586 803L293.4 611.7l-18-11.7H146V424h129.4l17.9-11.7L586 221v582zm348-327H806c-8.8 0-16 7.2-16 16v40c0 8.8 7.2 16 16 16h128c8.8 0 16-7.2 16-16v-40c0-8.8-7.2-16-16-16zm-41.9 261.8l-110.3-63.7a15.9 15.9 0 00-21.7 5.9l-19.9 34.5c-4.4 7.6-1.8 17.4 5.8 21.8L856.3 800a15.9 15.9 0 0021.7-5.9l19.9-34.5c4.4-7.6 1.7-17.4-5.8-21.8zM760 344a15.9 15.9 0 0021.7 5.9L892 286.2c7.6-4.4 10.2-14.2 5.8-21.8L878 230a15.9 15.9 0 00-21.7-5.9L746 287.8a15.99 15.99 0 00-5.8 21.8L760 344z"}}]},name:"sound",theme:"outlined"};var r=e.i(9583),a=i.forwardRef(function(e,a){return i.createElement(r.default,(0,t.default)({},e,{ref:a,icon:o}))});e.s(["SoundOutlined",0,a],782273);let n={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M842 454c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8 0 140.3-113.7 254-254 254S258 594.3 258 454c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8 0 168.7 126.6 307.9 290 327.6V884H326.7c-13.7 0-24.7 14.3-24.7 32v36c0 4.4 2.8 8 6.2 8h407.6c3.4 0 6.2-3.6 6.2-8v-36c0-17.7-11-32-24.7-32H548V782.1c165.3-18 294-158 294-328.1zM512 624c93.9 0 170-75.2 170-168V232c0-92.8-76.1-168-170-168s-170 75.2-170 168v224c0 92.8 76.1 168 170 168zm-94-392c0-50.6 41.9-92 94-92s94 41.4 94 92v224c0 50.6-41.9 92-94 92s-94-41.4-94-92V232z"}}]},name:"audio",theme:"outlined"};var s=i.forwardRef(function(e,o){return i.createElement(r.default,(0,t.default)({},e,{ref:o,icon:n}))});e.s(["AudioOutlined",0,s],793916)},149192,e=>{"use strict";var t=e.i(864517);e.s(["CloseOutlined",()=>t.default])},492030,e=>{"use strict";var t=e.i(121229);e.s(["CheckOutlined",()=>t.default])},596239,e=>{"use strict";e.i(247167);var t=e.i(931067),i=e.i(271645);let o={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M574 665.4a8.03 8.03 0 00-11.3 0L446.5 781.6c-53.8 53.8-144.6 59.5-204 0-59.5-59.5-53.8-150.2 0-204l116.2-116.2c3.1-3.1 3.1-8.2 0-11.3l-39.8-39.8a8.03 8.03 0 00-11.3 0L191.4 526.5c-84.6 84.6-84.6 221.5 0 306s221.5 84.6 306 0l116.2-116.2c3.1-3.1 3.1-8.2 0-11.3L574 665.4zm258.6-474c-84.6-84.6-221.5-84.6-306 0L410.3 307.6a8.03 8.03 0 000 11.3l39.7 39.7c3.1 3.1 8.2 3.1 11.3 0l116.2-116.2c53.8-53.8 144.6-59.5 204 0 59.5 59.5 53.8 150.2 0 204L665.3 562.6a8.03 8.03 0 000 11.3l39.8 39.8c3.1 3.1 8.2 3.1 11.3 0l116.2-116.2c84.5-84.6 84.5-221.5 0-306.1zM610.1 372.3a8.03 8.03 0 00-11.3 0L372.3 598.7a8.03 8.03 0 000 11.3l39.6 39.6c3.1 3.1 8.2 3.1 11.3 0l226.4-226.4c3.1-3.1 3.1-8.2 0-11.3l-39.5-39.6z"}}]},name:"link",theme:"outlined"};var r=e.i(9583),a=i.forwardRef(function(e,a){return i.createElement(r.default,(0,t.default)({},e,{ref:a,icon:o}))});e.s(["LinkOutlined",0,a],596239)},458505,e=>{"use strict";e.i(247167);var t=e.i(931067),i=e.i(271645);let o={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372zm47.7-395.2l-25.4-5.9V348.6c38 5.2 61.5 29 65.5 58.2.5 4 3.9 6.9 7.9 6.9h44.9c4.7 0 8.4-4.1 8-8.8-6.1-62.3-57.4-102.3-125.9-109.2V263c0-4.4-3.6-8-8-8h-28.1c-4.4 0-8 3.6-8 8v33c-70.8 6.9-126.2 46-126.2 119 0 67.6 49.8 100.2 102.1 112.7l24.7 6.3v142.7c-44.2-5.9-69-29.5-74.1-61.3-.6-3.8-4-6.6-7.9-6.6H363c-4.7 0-8.4 4-8 8.7 4.5 55 46.2 105.6 135.2 112.1V761c0 4.4 3.6 8 8 8h28.4c4.4 0 8-3.6 8-8.1l-.2-31.7c78.3-6.9 134.3-48.8 134.3-124-.1-69.4-44.2-100.4-109-116.4zm-68.6-16.2c-5.6-1.6-10.3-3.1-15-5-33.8-12.2-49.5-31.9-49.5-57.3 0-36.3 27.5-57 64.5-61.7v124zM534.3 677V543.3c3.1.9 5.9 1.6 8.8 2.2 47.3 14.4 63.2 34.4 63.2 65.1 0 39.1-29.4 62.6-72 66.4z"}}]},name:"dollar",theme:"outlined"};var r=e.i(9583),a=i.forwardRef(function(e,a){return i.createElement(r.default,(0,t.default)({},e,{ref:a,icon:o}))});e.s(["DollarOutlined",0,a],458505)},245704,e=>{"use strict";e.i(247167);var t=e.i(931067),i=e.i(271645);let o={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M699 353h-46.9c-10.2 0-19.9 4.9-25.9 13.3L469 584.3l-71.2-98.8c-6-8.3-15.6-13.3-25.9-13.3H325c-6.5 0-10.3 7.4-6.5 12.7l124.6 172.8a31.8 31.8 0 0051.7 0l210.6-292c3.9-5.3.1-12.7-6.4-12.7z"}},{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}}]},name:"check-circle",theme:"outlined"};var r=e.i(9583),a=i.forwardRef(function(e,a){return i.createElement(r.default,(0,t.default)({},e,{ref:a,icon:o}))});e.s(["CheckCircleOutlined",0,a],245704)},245094,e=>{"use strict";e.i(247167);var t=e.i(931067),i=e.i(271645);let o={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M516 673c0 4.4 3.4 8 7.5 8h185c4.1 0 7.5-3.6 7.5-8v-48c0-4.4-3.4-8-7.5-8h-185c-4.1 0-7.5 3.6-7.5 8v48zm-194.9 6.1l192-161c3.8-3.2 3.8-9.1 0-12.3l-192-160.9A7.95 7.95 0 00308 351v62.7c0 2.4 1 4.6 2.9 6.1L420.7 512l-109.8 92.2a8.1 8.1 0 00-2.9 6.1V673c0 6.8 7.9 10.5 13.1 6.1zM880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z"}}]},name:"code",theme:"outlined"};var r=e.i(9583),a=i.forwardRef(function(e,a){return i.createElement(r.default,(0,t.default)({},e,{ref:a,icon:o}))});e.s(["CodeOutlined",0,a],245094)},611052,e=>{"use strict";var t=e.i(843476),i=e.i(271645),o=e.i(212931),r=e.i(311451),a=e.i(790848),n=e.i(998573),s=e.i(438957);e.i(247167);var l=e.i(931067);let c={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M832 464h-68V240c0-70.7-57.3-128-128-128H388c-70.7 0-128 57.3-128 128v224h-68c-17.7 0-32 14.3-32 32v384c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V496c0-17.7-14.3-32-32-32zM332 240c0-30.9 25.1-56 56-56h248c30.9 0 56 25.1 56 56v224H332V240zm460 600H232V536h560v304zM484 701v53c0 4.4 3.6 8 8 8h40c4.4 0 8-3.6 8-8v-53a48.01 48.01 0 10-56 0z"}}]},name:"lock",theme:"outlined"};var d=e.i(9583),u=i.forwardRef(function(e,t){return i.createElement(d.default,(0,l.default)({},e,{ref:t,icon:c}))}),p=e.i(492030),m=e.i(266537),g=e.i(447566),f=e.i(149192),h=e.i(596239);e.s(["ByokCredentialModal",0,({server:e,open:l,onClose:c,onSuccess:d,accessToken:_})=>{let[v,b]=(0,i.useState)(1),[x,y]=(0,i.useState)(""),[w,S]=(0,i.useState)(!0),[j,k]=(0,i.useState)(!1),C=e.alias||e.server_name||"Service",O=C.charAt(0).toUpperCase(),N=()=>{b(1),y(""),S(!0),k(!1),c()},z=async()=>{if(!x.trim())return void n.message.error("Please enter your API key");k(!0);try{let t=await fetch(`/v1/mcp/server/${e.server_id}/user-credential`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${_}`},body:JSON.stringify({credential:x.trim(),save:w})});if(!t.ok){let e=await t.json();throw Error(e?.detail?.error||"Failed to save credential")}n.message.success(`Connected to ${C}`),d(e.server_id),N()}catch(e){n.message.error(e.message||"Failed to connect")}finally{k(!1)}};return(0,t.jsx)(o.Modal,{open:l,onCancel:N,footer:null,width:480,closeIcon:null,className:"byok-modal",children:(0,t.jsxs)("div",{className:"relative p-2",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[2===v?(0,t.jsxs)("button",{onClick:()=>b(1),className:"flex items-center gap-1 text-gray-500 hover:text-gray-800 text-sm",children:[(0,t.jsx)(g.ArrowLeftOutlined,{})," Back"]}):(0,t.jsx)("div",{}),(0,t.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,t.jsx)("div",{className:`w-2 h-2 rounded-full ${1===v?"bg-blue-500":"bg-gray-300"}`}),(0,t.jsx)("div",{className:`w-2 h-2 rounded-full ${2===v?"bg-blue-500":"bg-gray-300"}`})]}),(0,t.jsx)("button",{onClick:N,className:"text-gray-400 hover:text-gray-600",children:(0,t.jsx)(f.CloseOutlined,{})})]}),1===v?(0,t.jsxs)("div",{className:"text-center",children:[(0,t.jsxs)("div",{className:"flex items-center justify-center gap-3 mb-6",children:[(0,t.jsx)("div",{className:"w-14 h-14 rounded-xl bg-gradient-to-br from-teal-400 to-cyan-600 flex items-center justify-center text-white font-bold text-xl shadow",children:"L"}),(0,t.jsx)(m.ArrowRightOutlined,{className:"text-gray-400 text-lg"}),(0,t.jsx)("div",{className:"w-14 h-14 rounded-xl bg-gradient-to-br from-blue-600 to-indigo-800 flex items-center justify-center text-white font-bold text-xl shadow",children:O})]}),(0,t.jsxs)("h2",{className:"text-2xl font-bold text-gray-900 mb-2",children:["Connect ",C]}),(0,t.jsxs)("p",{className:"text-gray-500 mb-6",children:["LiteLLM needs access to ",C," to complete your request."]}),(0,t.jsx)("div",{className:"bg-gray-50 rounded-xl p-4 text-left mb-4",children:(0,t.jsxs)("div",{className:"flex items-start gap-3",children:[(0,t.jsx)("div",{className:"mt-0.5",children:(0,t.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",className:"text-gray-500",children:[(0,t.jsx)("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",stroke:"currentColor",strokeWidth:"2"}),(0,t.jsx)("path",{d:"M8 4v16M16 4v16",stroke:"currentColor",strokeWidth:"2"})]})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"font-semibold text-gray-800 mb-1",children:"How it works"}),(0,t.jsxs)("p",{className:"text-gray-500 text-sm",children:["LiteLLM acts as a secure bridge. Your requests are routed through our MCP client directly to"," ",C,"'s API."]})]})]})}),e.byok_description&&e.byok_description.length>0&&(0,t.jsxs)("div",{className:"bg-gray-50 rounded-xl p-4 text-left mb-6",children:[(0,t.jsxs)("p",{className:"text-xs font-semibold text-gray-500 uppercase tracking-widest mb-3 flex items-center gap-2",children:[(0,t.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",className:"text-green-500",children:[(0,t.jsx)("path",{d:"M12 2L12 22M2 12L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),(0,t.jsx)("circle",{cx:"12",cy:"12",r:"9",stroke:"currentColor",strokeWidth:"2"})]}),"Requested Access"]}),(0,t.jsx)("ul",{className:"space-y-2",children:e.byok_description.map((e,i)=>(0,t.jsxs)("li",{className:"flex items-center gap-2 text-sm text-gray-700",children:[(0,t.jsx)(p.CheckOutlined,{className:"text-green-500 flex-shrink-0"}),e]},i))})]}),(0,t.jsxs)("button",{onClick:()=>b(2),className:"w-full bg-gray-900 hover:bg-gray-700 text-white font-medium py-3 px-6 rounded-xl flex items-center justify-center gap-2 transition-colors",children:["Continue to Authentication ",(0,t.jsx)(m.ArrowRightOutlined,{})]}),(0,t.jsx)("button",{onClick:N,className:"mt-3 w-full text-gray-400 hover:text-gray-600 text-sm py-2",children:"Cancel"})]}):(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"w-12 h-12 rounded-full bg-blue-50 flex items-center justify-center mb-4",children:(0,t.jsx)(s.KeyOutlined,{className:"text-blue-400 text-xl"})}),(0,t.jsx)("h2",{className:"text-2xl font-bold text-gray-900 mb-2",children:"Provide API Key"}),(0,t.jsxs)("p",{className:"text-gray-500 mb-6",children:["Enter your ",C," API key to authorize this connection."]}),(0,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsxs)("label",{className:"block text-sm font-semibold text-gray-800 mb-2",children:[C," API Key"]}),(0,t.jsx)(r.Input.Password,{placeholder:"Enter your API key",value:x,onChange:e=>y(e.target.value),size:"large",className:"rounded-lg"}),e.byok_api_key_help_url&&(0,t.jsxs)("a",{href:e.byok_api_key_help_url,target:"_blank",rel:"noopener noreferrer",className:"text-blue-500 hover:text-blue-700 text-sm mt-2 flex items-center gap-1",children:["Where do I find my API key? ",(0,t.jsx)(h.LinkOutlined,{})]})]}),(0,t.jsxs)("div",{className:"bg-gray-50 rounded-xl p-4 flex items-center justify-between mb-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",className:"text-gray-500",children:(0,t.jsx)("path",{d:"M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z",fill:"currentColor"})}),(0,t.jsx)("span",{className:"text-sm font-medium text-gray-800",children:"Save key for future use"})]}),(0,t.jsx)(a.Switch,{checked:w,onChange:S})]}),(0,t.jsxs)("div",{className:"bg-blue-50 rounded-xl p-4 flex items-start gap-3 mb-6",children:[(0,t.jsx)(u,{className:"text-blue-400 mt-0.5 flex-shrink-0"}),(0,t.jsx)("p",{className:"text-sm text-blue-700",children:"Your key is stored securely and transmitted over HTTPS. It is never shared with third parties."})]}),(0,t.jsxs)("button",{onClick:z,disabled:j,className:"w-full bg-blue-500 hover:bg-blue-600 disabled:opacity-60 text-white font-medium py-3 px-6 rounded-xl flex items-center justify-center gap-2 transition-colors",children:[(0,t.jsx)(u,{})," Connect & Authorize"]})]})]})})}],611052)}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/0adb91ab5f3140d5.js b/litellm/proxy/_experimental/out/_next/static/chunks/0adb91ab5f3140d5.js new file mode 100644 index 00000000000..a8ed71a7b20 --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/0adb91ab5f3140d5.js @@ -0,0 +1,3 @@ +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,894660,283086,195116,e=>{"use strict";var t=e.i(801312);e.s(["LeftOutlined",()=>t.default],894660);var s=e.i(475254);let a=(0,s.default)("sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);e.s(["Sparkles",()=>a],283086);let l=(0,s.default)("wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);e.s(["Wrench",()=>l],195116)},97859,e=>{"use strict";e.s(["AGENT_CALL_TYPES",0,["asend_message"],"ERROR_CODE_OPTIONS",0,[{label:"400 - Bad Request",value:"400"},{label:"401 - Invalid Authentication",value:"401"},{label:"403 - Permission Denied",value:"403"},{label:"404 - Not Found",value:"404"},{label:"408 - Request Timeout",value:"408"},{label:"422 - Unprocessable Entity",value:"422"},{label:"429 - Rate Limited",value:"429"},{label:"500 - Internal Server Error",value:"500"},{label:"502 - Bad Gateway",value:"502"},{label:"503 - Service Unavailable",value:"503"},{label:"529 - Overloaded",value:"529"}],"MCP_CALL_TYPES",0,["call_mcp_tool","list_mcp_tools"],"QUICK_SELECT_OPTIONS",0,[{label:"Last 15 Minutes",value:15,unit:"minutes"},{label:"Last Hour",value:1,unit:"hours"},{label:"Last 4 Hours",value:4,unit:"hours"},{label:"Last 24 Hours",value:24,unit:"hours"},{label:"Last 7 Days",value:7,unit:"days"}]])},257486,624001,207066,337767,237062,e=>{"use strict";var t=e.i(97859);function s(e,s){let a=(s||"").trim();if(t.MCP_CALL_TYPES.includes(e))return a.replace(/^mcp:\s*/i,"").split("/").pop()||a||"mcp_tool";let l=(a.split("/").pop()||a).replace(/-20\d{6}.*$/i,"").replace(/:.*$/,""),r=l.match(/claude-[a-z0-9-]+/i);return r?r[0]:l||"llm_call"}e.s(["getEventDisplayName",()=>s],257486);var a=e.i(843476),l=e.i(464571),r=e.i(770914),i=e.i(262218),n=e.i(592968),o=e.i(898586),d=e.i(149192),c=e.i(536591);e.s(["UpOutlined",()=>c.default],624001);var c=c,m=e.i(755151),x=e.i(166540),u=e.i(916925);let p="16px 24px",h="Escape",g="monospace",f="#f0f0f0",y="#fff";e.s(["API_BASE_MAX_WIDTH",0,200,"COLOR_BACKGROUND",0,y,"COLOR_BG_LIGHT",0,"#fafafa","COLOR_BORDER",0,f,"DEFAULT_MAX_WIDTH",0,180,"DRAWER_CONTENT_PADDING",0,"24px","DRAWER_HEADER_PADDING",0,p,"DRAWER_WIDTH",0,"60%","FONT_FAMILY_MONO",0,g,"FONT_SIZE_HEADER",0,16,"FONT_SIZE_MEDIUM",0,13,"FONT_SIZE_SMALL",0,12,"JSON_MAX_HEIGHT",0,400,"KEY_ESCAPE",0,h,"KEY_J_LOWER",0,"j","KEY_J_UPPER",0,"J","KEY_K_LOWER",0,"k","KEY_K_UPPER",0,"K","METADATA_MAX_HEIGHT",0,300,"SPACING_LARGE",0,12,"SPACING_MEDIUM",0,8,"SPACING_SMALL",0,4,"SPACING_XLARGE",0,16,"TAB_REQUEST",0,"request","TAB_RESPONSE",0,"response"],207066);let{Text:j}=o.Typography;function b({log:e,onClose:t,onPrevious:s,onNext:l,statusLabel:r,statusColor:i,environment:n}){let o=e.custom_llm_provider||"",d=o?(0,u.getProviderLogoAndName)(o):null;return(0,a.jsxs)("div",{style:{padding:p,borderBottom:`1px solid ${f}`,backgroundColor:y,position:"sticky",top:0,zIndex:10},children:[(0,a.jsx)(v,{model:e.model,providerLogo:d?.logo,providerName:d?.displayName}),(0,a.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:8},children:[(0,a.jsx)(_,{requestId:e.request_id}),(0,a.jsx)(N,{onPrevious:s,onNext:l,onClose:t})]}),(0,a.jsx)(w,{log:e,statusLabel:r,statusColor:i,environment:n})]})}function v({model:e,providerLogo:t,providerName:s}){return(0,a.jsxs)(r.Space,{size:8,style:{marginBottom:8},children:[t&&(0,a.jsx)("img",{src:t,alt:s||"Provider",style:{width:24,height:24},onError:e=>{e.target.style.display="none"}}),(0,a.jsxs)(r.Space,{size:8,direction:"horizontal",children:[(0,a.jsx)(j,{strong:!0,style:{fontSize:14},children:e}),s&&(0,a.jsx)(j,{type:"secondary",style:{fontSize:12},children:s})]})]})}function _({requestId:e}){return(0,a.jsx)("div",{style:{flex:1,minWidth:0},children:(0,a.jsx)(n.Tooltip,{title:e,children:(0,a.jsx)(j,{strong:!0,copyable:{text:e,tooltips:["Copy Request ID","Copied!"]},style:{fontSize:16,fontFamily:g,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"block"},children:e})})})}function N({onPrevious:e,onNext:t,onClose:s}){let i={border:"1px solid #d9d9d9",borderRadius:4,padding:"0 4px",fontSize:12,fontFamily:"monospace",marginLeft:4,background:"#fafafa"};return(0,a.jsxs)(r.Space,{size:4,split:(0,a.jsx)("div",{style:{width:1,height:20,background:f}}),children:[(0,a.jsxs)(l.Button,{type:"text",size:"small",onClick:e,children:[(0,a.jsx)(c.default,{}),(0,a.jsx)("span",{style:i,children:"K"})]}),(0,a.jsxs)(l.Button,{type:"text",size:"small",onClick:t,children:[(0,a.jsx)(m.DownOutlined,{}),(0,a.jsx)("span",{style:i,children:"J"})]}),(0,a.jsx)(n.Tooltip,{title:"ESC to close",children:(0,a.jsx)(l.Button,{type:"text",icon:(0,a.jsx)(d.CloseOutlined,{}),onClick:s})})]})}function w({log:e,statusLabel:t,statusColor:s,environment:l}){return(0,a.jsxs)(r.Space,{size:12,children:[(0,a.jsx)(i.Tag,{color:s,children:t}),(0,a.jsxs)(i.Tag,{children:["Env: ",l]}),(0,a.jsxs)(r.Space,{size:8,children:[(0,a.jsx)(j,{type:"secondary",style:{fontSize:13},children:(0,x.default)(e.startTime).format("MMM D, YYYY h:mm:ss A")}),(0,a.jsxs)(j,{type:"secondary",style:{fontSize:13},children:["(",(0,x.default)(e.startTime).fromNow(),")"]})]})]})}e.s(["DrawerHeader",()=>b],337767);var S=e.i(271645);function k({isOpen:e,currentLog:t,allLogs:s,onClose:a,onSelectLog:l}){(0,S.useEffect)(()=>{let t=t=>{var s;if(!((s=t.target)instanceof HTMLInputElement||s instanceof HTMLTextAreaElement)&&e)switch(t.key){case h:a();break;case"j":case"J":i();break;case"k":case"K":r()}};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[e,t,s]);let r=()=>{if(!t||!s.length||!l)return;let e=s.findIndex(e=>e.request_id===t.request_id);e{if(!t||!s.length||!l)return;let e=s.findIndex(e=>e.request_id===t.request_id);e>0&&l(s[e-1])};return{selectNextLog:r,selectPreviousLog:i}}e.s(["useKeyboardNavigation",()=>k],237062)},517442,e=>{"use strict";var t=e.i(843476),s=e.i(271645),a=e.i(592968);let l=e=>e>=.8?"text-green-600":"text-yellow-600",r=({entities:e})=>{let[a,r]=(0,s.useState)(!0),[i,n]=(0,s.useState)({});return e&&0!==e.length?(0,t.jsxs)("div",{className:"mt-4",children:[(0,t.jsxs)("div",{className:"flex items-center mb-2 cursor-pointer",onClick:()=>r(!a),children:[(0,t.jsx)("svg",{className:`w-5 h-5 mr-2 transition-transform ${a?"transform rotate-90":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),(0,t.jsxs)("h4",{className:"font-medium",children:["Detected Entities (",e.length,")"]})]}),a&&(0,t.jsx)("div",{className:"space-y-2",children:e.map((e,s)=>{let a=i[s]||!1;return(0,t.jsxs)("div",{className:"border rounded-lg overflow-hidden",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between p-3 bg-gray-50 cursor-pointer hover:bg-gray-100",onClick:()=>{n(e=>({...e,[s]:!e[s]}))},children:[(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("svg",{className:`w-5 h-5 mr-2 transition-transform ${a?"transform rotate-90":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),(0,t.jsx)("span",{className:"font-medium mr-2",children:e.entity_type}),(0,t.jsxs)("span",{className:`font-mono ${l(e.score)}`,children:["Score: ",e.score.toFixed(2)]})]}),(0,t.jsxs)("span",{className:"text-xs text-gray-500",children:["Position: ",e.start,"-",e.end]})]}),a&&(0,t.jsx)("div",{className:"p-3 border-t bg-white",children:(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4 mb-2",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Entity Type:"}),(0,t.jsx)("span",{children:e.entity_type})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Position:"}),(0,t.jsxs)("span",{children:["Characters ",e.start,"-",e.end]})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Confidence:"}),(0,t.jsx)("span",{className:l(e.score),children:e.score.toFixed(2)})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[e.recognition_metadata&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Recognizer:"}),(0,t.jsx)("span",{children:e.recognition_metadata.recognizer_name})]}),(0,t.jsxs)("div",{className:"flex overflow-hidden",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Identifier:"}),(0,t.jsx)("span",{className:"truncate text-xs font-mono",children:e.recognition_metadata.recognizer_identifier})]})]}),e.analysis_explanation&&(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Explanation:"}),(0,t.jsx)("span",{children:e.analysis_explanation})]})]})]})})]},s)})})]}):null},i=(e,s="slate")=>(0,t.jsx)("span",{className:`px-2 py-1 rounded-md text-xs font-medium inline-block ${{green:"bg-green-100 text-green-800",red:"bg-red-100 text-red-800",blue:"bg-blue-50 text-blue-700",slate:"bg-slate-100 text-slate-800",amber:"bg-amber-100 text-amber-800"}[s]}`,children:e}),n=e=>e?i("detected","red"):i("not detected","slate"),o=({title:e,count:a,defaultOpen:l=!0,right:r,children:i})=>{let[n,o]=(0,s.useState)(l);return(0,t.jsxs)("div",{className:"border rounded-lg overflow-hidden",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between p-3 bg-gray-50 cursor-pointer hover:bg-gray-100",onClick:()=>o(e=>!e),children:[(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("svg",{className:`w-5 h-5 mr-2 transition-transform ${n?"transform rotate-90":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),(0,t.jsxs)("h5",{className:"font-medium",children:[e," ","number"==typeof a&&(0,t.jsxs)("span",{className:"text-gray-500 font-normal",children:["(",a,")"]})]})]}),(0,t.jsx)("div",{children:r})]}),n&&(0,t.jsx)("div",{className:"p-3 border-t bg-white",children:i})]})},d=({label:e,children:s,mono:a})=>(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:e}),(0,t.jsx)("span",{className:a?"font-mono text-sm break-all":"",children:s})]}),c=()=>(0,t.jsx)("div",{className:"my-3 border-t"}),m=({response:e})=>{if(!e)return null;let s=e.outputs??e.output??[],a="GUARDRAIL_INTERVENED"===e.action?"red":"green",l=(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[e.guardrailCoverage?.textCharacters&&i(`text guarded ${e.guardrailCoverage.textCharacters.guarded??0}/${e.guardrailCoverage.textCharacters.total??0}`,"blue"),e.guardrailCoverage?.images&&i(`images guarded ${e.guardrailCoverage.images.guarded??0}/${e.guardrailCoverage.images.total??0}`,"blue")]}),r=e.usage&&(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:Object.entries(e.usage).map(([e,s])=>"number"==typeof s?(0,t.jsxs)("span",{className:"px-2 py-1 bg-slate-100 text-slate-800 rounded-md text-xs font-medium",children:[e,": ",s]},e):null)});return(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"border rounded-lg p-4",children:[(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(d,{label:"Action:",children:i(e.action??"N/A",a)}),e.actionReason&&(0,t.jsx)(d,{label:"Action Reason:",children:e.actionReason}),e.blockedResponse&&(0,t.jsx)(d,{label:"Blocked Response:",children:(0,t.jsx)("span",{className:"italic",children:e.blockedResponse})})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(d,{label:"Coverage:",children:l}),(0,t.jsx)(d,{label:"Usage:",children:r})]})]}),s.length>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(c,{}),(0,t.jsx)("h4",{className:"font-medium mb-2",children:"Outputs"}),(0,t.jsx)("div",{className:"space-y-2",children:s.map((e,s)=>(0,t.jsx)("div",{className:"p-3 bg-gray-50 rounded-md",children:(0,t.jsx)("div",{className:"text-sm whitespace-pre-wrap",children:e.text??(0,t.jsx)("em",{children:"(non-text output)"})})},s))})]})]}),e.assessments?.length?(0,t.jsx)("div",{className:"space-y-3",children:e.assessments.map((e,s)=>{let a=(0,t.jsxs)("div",{className:"flex flex-wrap gap-1",children:[e.wordPolicy&&i("word","slate"),e.contentPolicy&&i("content","slate"),e.topicPolicy&&i("topic","slate"),e.sensitiveInformationPolicy&&i("sensitive-info","slate"),e.contextualGroundingPolicy&&i("contextual-grounding","slate"),e.automatedReasoningPolicy&&i("automated-reasoning","slate")]});return(0,t.jsxs)(o,{title:`Assessment #${s+1}`,defaultOpen:!0,right:(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[e.invocationMetrics?.guardrailProcessingLatency!=null&&i(`${e.invocationMetrics.guardrailProcessingLatency} ms`,"amber"),a]}),children:[e.wordPolicy&&(0,t.jsxs)("div",{className:"mb-3",children:[(0,t.jsx)("h6",{className:"font-medium mb-2",children:"Word Policy"}),(e.wordPolicy.customWords?.length??0)>0&&(0,t.jsx)(o,{title:"Custom Words",defaultOpen:!0,children:(0,t.jsx)("div",{className:"space-y-2",children:e.wordPolicy.customWords.map((e,s)=>(0,t.jsxs)("div",{className:"flex justify-between items-center p-2 bg-gray-50 rounded",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[i(e.action??"N/A",e.detected?"red":"slate"),(0,t.jsx)("span",{className:"font-mono text-sm break-all",children:e.match})]}),n(e.detected)]},s))})}),(e.wordPolicy.managedWordLists?.length??0)>0&&(0,t.jsx)(o,{title:"Managed Word Lists",defaultOpen:!1,children:(0,t.jsx)("div",{className:"space-y-2",children:e.wordPolicy.managedWordLists.map((e,s)=>(0,t.jsxs)("div",{className:"flex justify-between items-center p-2 bg-gray-50 rounded",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[i(e.action??"N/A",e.detected?"red":"slate"),(0,t.jsx)("span",{className:"font-mono text-sm break-all",children:e.match}),e.type&&i(e.type,"slate")]}),n(e.detected)]},s))})})]}),e.contentPolicy?.filters?.length?(0,t.jsxs)("div",{className:"mb-3",children:[(0,t.jsx)("h6",{className:"font-medium mb-2",children:"Content Policy"}),(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)("table",{className:"min-w-full text-sm",children:[(0,t.jsx)("thead",{children:(0,t.jsxs)("tr",{className:"text-left text-gray-600",children:[(0,t.jsx)("th",{className:"py-1 pr-4",children:"Type"}),(0,t.jsx)("th",{className:"py-1 pr-4",children:"Action"}),(0,t.jsx)("th",{className:"py-1 pr-4",children:"Detected"}),(0,t.jsx)("th",{className:"py-1 pr-4",children:"Strength"}),(0,t.jsx)("th",{className:"py-1 pr-4",children:"Confidence"})]})}),(0,t.jsx)("tbody",{children:e.contentPolicy.filters.map((e,s)=>(0,t.jsxs)("tr",{className:"border-t",children:[(0,t.jsx)("td",{className:"py-1 pr-4",children:e.type??"—"}),(0,t.jsx)("td",{className:"py-1 pr-4",children:i(e.action??"—",e.detected?"red":"slate")}),(0,t.jsx)("td",{className:"py-1 pr-4",children:n(e.detected)}),(0,t.jsx)("td",{className:"py-1 pr-4",children:e.filterStrength??"—"}),(0,t.jsx)("td",{className:"py-1 pr-4",children:e.confidence??"—"})]},s))})]})})]}):null,e.contextualGroundingPolicy?.filters?.length?(0,t.jsxs)("div",{className:"mb-3",children:[(0,t.jsx)("h6",{className:"font-medium mb-2",children:"Contextual Grounding"}),(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)("table",{className:"min-w-full text-sm",children:[(0,t.jsx)("thead",{children:(0,t.jsxs)("tr",{className:"text-left text-gray-600",children:[(0,t.jsx)("th",{className:"py-1 pr-4",children:"Type"}),(0,t.jsx)("th",{className:"py-1 pr-4",children:"Action"}),(0,t.jsx)("th",{className:"py-1 pr-4",children:"Detected"}),(0,t.jsx)("th",{className:"py-1 pr-4",children:"Score"}),(0,t.jsx)("th",{className:"py-1 pr-4",children:"Threshold"})]})}),(0,t.jsx)("tbody",{children:e.contextualGroundingPolicy.filters.map((e,s)=>(0,t.jsxs)("tr",{className:"border-t",children:[(0,t.jsx)("td",{className:"py-1 pr-4",children:e.type??"—"}),(0,t.jsx)("td",{className:"py-1 pr-4",children:i(e.action??"—",e.detected?"red":"slate")}),(0,t.jsx)("td",{className:"py-1 pr-4",children:n(e.detected)}),(0,t.jsx)("td",{className:"py-1 pr-4",children:e.score??"—"}),(0,t.jsx)("td",{className:"py-1 pr-4",children:e.threshold??"—"})]},s))})]})})]}):null,e.sensitiveInformationPolicy&&(0,t.jsxs)("div",{className:"mb-3",children:[(0,t.jsx)("h6",{className:"font-medium mb-2",children:"Sensitive Information"}),(e.sensitiveInformationPolicy.piiEntities?.length??0)>0&&(0,t.jsx)(o,{title:"PII Entities",defaultOpen:!0,children:(0,t.jsx)("div",{className:"space-y-2",children:e.sensitiveInformationPolicy.piiEntities.map((e,s)=>(0,t.jsxs)("div",{className:"flex justify-between items-center p-2 bg-gray-50 rounded",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[i(e.action??"N/A",e.detected?"red":"slate"),e.type&&i(e.type,"slate"),(0,t.jsx)("span",{className:"font-mono text-xs break-all",children:e.match})]}),n(e.detected)]},s))})}),(e.sensitiveInformationPolicy.regexes?.length??0)>0&&(0,t.jsx)(o,{title:"Custom Regexes",defaultOpen:!1,children:(0,t.jsx)("div",{className:"space-y-2",children:e.sensitiveInformationPolicy.regexes.map((e,s)=>(0,t.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between p-2 bg-gray-50 rounded gap-1",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[i(e.action??"N/A",e.detected?"red":"slate"),(0,t.jsx)("span",{className:"font-medium",children:e.name??"regex"}),(0,t.jsx)("span",{className:"font-mono text-xs break-all",children:e.regex})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[n(e.detected),e.match&&(0,t.jsx)("span",{className:"font-mono text-xs break-all",children:e.match})]})]},s))})})]}),e.topicPolicy?.topics?.length?(0,t.jsxs)("div",{className:"mb-3",children:[(0,t.jsx)("h6",{className:"font-medium mb-2",children:"Topic Policy"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:e.topicPolicy.topics.map((e,s)=>(0,t.jsx)("div",{className:"px-3 py-1.5 bg-gray-50 rounded-md text-xs",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[i(e.action??"N/A",e.detected?"red":"slate"),(0,t.jsx)("span",{className:"font-medium",children:e.name??"topic"}),e.type&&i(e.type,"slate"),n(e.detected)]})},s))})]}):null,e.invocationMetrics&&(0,t.jsx)(o,{title:"Invocation Metrics",defaultOpen:!1,children:(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(d,{label:"Latency (ms)",children:e.invocationMetrics.guardrailProcessingLatency??"—"}),(0,t.jsx)(d,{label:"Coverage:",children:(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[e.invocationMetrics.guardrailCoverage?.textCharacters&&i(`text ${e.invocationMetrics.guardrailCoverage.textCharacters.guarded??0}/${e.invocationMetrics.guardrailCoverage.textCharacters.total??0}`,"blue"),e.invocationMetrics.guardrailCoverage?.images&&i(`images ${e.invocationMetrics.guardrailCoverage.images.guarded??0}/${e.invocationMetrics.guardrailCoverage.images.total??0}`,"blue")]})})]}),(0,t.jsx)("div",{className:"space-y-2",children:(0,t.jsx)(d,{label:"Usage:",children:(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:e.invocationMetrics.usage&&Object.entries(e.invocationMetrics.usage).map(([e,s])=>"number"==typeof s?(0,t.jsxs)("span",{className:"px-2 py-1 bg-slate-100 text-slate-800 rounded-md text-xs font-medium",children:[e,": ",s]},e):null)})})})]})}),e.automatedReasoningPolicy?.findings?.length?(0,t.jsx)(o,{title:"Automated Reasoning Findings",defaultOpen:!1,children:(0,t.jsx)("div",{className:"space-y-2",children:e.automatedReasoningPolicy.findings.map((e,s)=>(0,t.jsx)("pre",{className:"bg-gray-50 rounded p-2 text-xs overflow-x-auto",children:JSON.stringify(e,null,2)},s))})}):null]},s)})}):null,(0,t.jsx)(o,{title:"Raw Bedrock Guardrail Response",defaultOpen:!1,children:(0,t.jsx)("pre",{className:"bg-gray-50 rounded p-3 text-xs overflow-x-auto",children:JSON.stringify(e,null,2)})})]})},x=(e,s="slate")=>(0,t.jsx)("span",{className:`px-2 py-1 rounded-md text-xs font-medium inline-block ${{green:"bg-green-100 text-green-800",red:"bg-red-100 text-red-800",blue:"bg-blue-50 text-blue-700",slate:"bg-slate-100 text-slate-800",amber:"bg-amber-100 text-amber-800"}[s]}`,children:e}),u=({title:e,count:a,defaultOpen:l=!0,children:r})=>{let[i,n]=(0,s.useState)(l);return(0,t.jsxs)("div",{className:"border rounded-lg overflow-hidden",children:[(0,t.jsx)("div",{className:"flex items-center justify-between p-3 bg-gray-50 cursor-pointer hover:bg-gray-100",onClick:()=>n(e=>!e),children:(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("svg",{className:`w-5 h-5 mr-2 transition-transform ${i?"transform rotate-90":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),(0,t.jsxs)("h5",{className:"font-medium",children:[e," ","number"==typeof a&&(0,t.jsxs)("span",{className:"text-gray-500 font-normal",children:["(",a,")"]})]})]})}),i&&(0,t.jsx)("div",{className:"p-3 border-t bg-white",children:r})]})},p=({label:e,children:s,mono:a})=>(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:e}),(0,t.jsx)("span",{className:a?"font-mono text-sm break-all":"",children:s})]}),h=({response:e})=>{if(!e||"string"==typeof e)return"string"==typeof e&&e?(0,t.jsx)("div",{className:"bg-white rounded-lg border border-red-200 p-4",children:(0,t.jsxs)("div",{className:"text-red-800",children:[(0,t.jsx)("h5",{className:"font-medium mb-2",children:"Error"}),(0,t.jsx)("p",{className:"text-sm",children:e})]})}):null;let s=Array.isArray(e)?e:[];if(0===s.length)return(0,t.jsx)("div",{className:"bg-white rounded-lg border border-gray-200 p-4",children:(0,t.jsx)("div",{className:"text-gray-600 text-sm",children:"No detections found"})});let a=s.filter(e=>"pattern"===e.type),l=s.filter(e=>"blocked_word"===e.type),r=s.filter(e=>"category_keyword"===e.type),i=s.filter(e=>"BLOCK"===e.action).length,n=s.filter(e=>"MASK"===e.action).length,o=s.length;return(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)("div",{className:"bg-white rounded-lg border border-gray-200 p-4",children:(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(p,{label:"Total Detections:",children:(0,t.jsx)("span",{className:"font-semibold",children:o})}),(0,t.jsx)(p,{label:"Actions:",children:(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[i>0&&x(`${i} blocked`,"red"),n>0&&x(`${n} masked`,"blue"),0===i&&0===n&&x("passed","green")]})})]}),(0,t.jsx)("div",{className:"space-y-2",children:(0,t.jsx)(p,{label:"By Type:",children:(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[a.length>0&&x(`${a.length} patterns`,"slate"),l.length>0&&x(`${l.length} keywords`,"slate"),r.length>0&&x(`${r.length} categories`,"slate")]})})})]})}),a.length>0&&(0,t.jsx)(u,{title:"Patterns Matched",count:a.length,defaultOpen:!0,children:(0,t.jsx)("div",{className:"space-y-2",children:a.map((e,s)=>(0,t.jsx)("div",{className:"p-3 bg-gray-50 rounded-md",children:(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsx)("div",{className:"space-y-1",children:(0,t.jsx)(p,{label:"Pattern:",children:e.pattern_name||"unknown"})}),(0,t.jsx)("div",{className:"space-y-1",children:(0,t.jsx)(p,{label:"Action:",children:x(e.action,"BLOCK"===e.action?"red":"blue")})})]})},s))})}),l.length>0&&(0,t.jsx)(u,{title:"Blocked Words Detected",count:l.length,defaultOpen:!0,children:(0,t.jsx)("div",{className:"space-y-2",children:l.map((e,s)=>(0,t.jsx)("div",{className:"p-3 bg-gray-50 rounded-md",children:(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)(p,{label:"Keyword:",mono:!0,children:e.keyword||"unknown"}),e.description&&(0,t.jsx)(p,{label:"Description:",children:e.description})]}),(0,t.jsx)("div",{className:"space-y-1",children:(0,t.jsx)(p,{label:"Action:",children:x(e.action,"BLOCK"===e.action?"red":"blue")})})]})},s))})}),r.length>0&&(0,t.jsx)(u,{title:"Category Keywords Detected",count:r.length,defaultOpen:!0,children:(0,t.jsx)("div",{className:"space-y-2",children:r.map((e,s)=>(0,t.jsx)("div",{className:"p-3 bg-gray-50 rounded-md",children:(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)(p,{label:"Category:",children:e.category||"unknown"}),(0,t.jsx)(p,{label:"Keyword:",mono:!0,children:e.keyword||"unknown"}),e.severity&&(0,t.jsx)(p,{label:"Severity:",children:x(e.severity,"high"===e.severity?"red":"medium"===e.severity?"amber":"slate")})]}),(0,t.jsx)("div",{className:"space-y-1",children:(0,t.jsx)(p,{label:"Action:",children:x(e.action,"BLOCK"===e.action?"red":"blue")})})]})},s))})}),(0,t.jsx)(u,{title:"Raw Detection Data",defaultOpen:!1,children:(0,t.jsx)("pre",{className:"bg-gray-50 rounded p-3 text-xs overflow-x-auto",children:JSON.stringify(s,null,2)})})]})};var g=e.i(764205);let f=()=>(0,t.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[(0,t.jsx)("circle",{cx:"8",cy:"8",r:"7",stroke:"#16A34A",strokeWidth:"1.5",fill:"#F0FDF4"}),(0,t.jsx)("path",{d:"M5 8l2 2 4-4",stroke:"#16A34A",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),y=()=>(0,t.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[(0,t.jsx)("circle",{cx:"8",cy:"8",r:"7",stroke:"#DC2626",strokeWidth:"1.5",fill:"#FEF2F2"}),(0,t.jsx)("path",{d:"M6 6l4 4M10 6l-4 4",stroke:"#DC2626",strokeWidth:"1.5",strokeLinecap:"round"})]}),j=()=>(0,t.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",className:"animate-spin",children:[(0,t.jsx)("circle",{cx:"8",cy:"8",r:"6",stroke:"#D1D5DB",strokeWidth:"2"}),(0,t.jsx)("path",{d:"M8 2a6 6 0 0 1 6 6",stroke:"#6366F1",strokeWidth:"2",strokeLinecap:"round"})]}),b=({title:e,data:l,loading:r,error:i})=>{let[n,o]=(0,s.useState)(!1);return(0,t.jsxs)("div",{className:"border border-gray-200 rounded-lg bg-white",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 cursor-pointer hover:bg-gray-50 transition-colors",onClick:()=>o(!n),children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[r?(0,t.jsx)(j,{}):i?(0,t.jsx)(a.Tooltip,{title:i,children:(0,t.jsx)("span",{className:"text-gray-400 text-sm",children:"--"})}):l?.compliant?(0,t.jsx)(f,{}):(0,t.jsx)(y,{}),(0,t.jsx)("span",{className:"font-medium text-sm text-gray-900",children:e})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[!r&&!i&&l&&(0,t.jsx)("span",{className:`px-2 py-0.5 rounded text-[11px] font-semibold uppercase ${l.compliant?"bg-green-100 text-green-700 border border-green-200":"bg-red-100 text-red-700 border border-red-200"}`,children:l.compliant?"COMPLIANT":"NON-COMPLIANT"}),i&&(0,t.jsx)("span",{className:"px-2 py-0.5 rounded text-[11px] font-medium bg-gray-100 text-gray-500 border border-gray-200",children:"UNAVAILABLE"}),(0,t.jsx)("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",className:`transition-transform ${n?"rotate-180":""}`,children:(0,t.jsx)("path",{d:"M6 8l4 4 4-4",stroke:"#6B7280",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]})]}),n&&(0,t.jsxs)("div",{className:"border-t border-gray-100 px-4 py-3",children:[r&&(0,t.jsx)("p",{className:"text-sm text-gray-500",children:"Checking compliance..."}),i&&(0,t.jsx)("p",{className:"text-sm text-red-600",children:i}),l&&(0,t.jsx)("div",{className:"space-y-2",children:l.checks.map((e,s)=>(0,t.jsxs)("div",{className:"flex items-start gap-2",children:[(0,t.jsx)("div",{className:"flex-shrink-0 mt-0.5",children:e.passed?(0,t.jsx)(f,{}):(0,t.jsx)(y,{})}),(0,t.jsxs)("div",{className:"min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"text-sm font-medium text-gray-900",children:e.check_name}),(0,t.jsx)("span",{className:"text-[10px] font-mono text-gray-400",children:e.article})]}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-0.5",children:e.detail})]})]},s))})]})]})},v=({accessToken:e,logEntry:a})=>{let[l,r]=(0,s.useState)(null),[i,n]=(0,s.useState)(null),[o,d]=(0,s.useState)(!1),[c,m]=(0,s.useState)(!1),[x,u]=(0,s.useState)(null),[p,h]=(0,s.useState)(null);return(0,s.useEffect)(()=>{if(!e||!a.request_id)return;let t={request_id:a.request_id,user_id:a.user,model:a.model,timestamp:a.startTime,guardrail_information:a.metadata?.guardrail_information};d(!0),u(null),(0,g.checkEuAiActCompliance)(e,t).then(r).catch(e=>u(e.message||"Failed to check EU AI Act compliance")).finally(()=>d(!1)),m(!0),h(null),(0,g.checkGdprCompliance)(e,t).then(n).catch(e=>h(e.message||"Failed to check GDPR compliance")).finally(()=>m(!1))},[e,a]),(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider mb-4",children:"Regulatory Compliance"}),(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)(b,{title:"EU AI Act",data:l,loading:o,error:x}),(0,t.jsx)(b,{title:"GDPR",data:i,loading:c,error:p})]})]})},_=new Set(["presidio","bedrock","litellm_content_filter"]),N=e=>Object.values(e.masked_entity_count||{}).reduce((e,t)=>e+("number"==typeof t?t:0),0),w=e=>"success"===(e.guardrail_status??"").toLowerCase(),S=e=>e.policy_template||e.guardrail_name,k=()=>(0,t.jsxs)("svg",{width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",children:[(0,t.jsx)("circle",{cx:"20",cy:"20",r:"20",fill:"#EEF2FF"}),(0,t.jsx)("path",{d:"M20 10l8 4v6c0 5.25-3.4 10.15-8 11.5C15.4 30.15 12 25.25 12 20v-6l8-4z",stroke:"#6366F1",strokeWidth:"1.5",fill:"none"}),(0,t.jsx)("path",{d:"M16 20l3 3 5-6",stroke:"#6366F1",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]}),C=({className:e})=>(0,t.jsxs)("svg",{width:"22",height:"22",viewBox:"0 0 22 22",fill:"none",className:e,children:[(0,t.jsx)("circle",{cx:"11",cy:"11",r:"10",stroke:"#16A34A",strokeWidth:"1.5",fill:"#F0FDF4"}),(0,t.jsx)("path",{d:"M7 11l3 3 5-6",stroke:"#16A34A",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),T=({className:e})=>(0,t.jsxs)("svg",{width:"22",height:"22",viewBox:"0 0 22 22",fill:"none",className:e,children:[(0,t.jsx)("circle",{cx:"11",cy:"11",r:"10",stroke:"#DC2626",strokeWidth:"1.5",fill:"#FEF2F2"}),(0,t.jsx)("path",{d:"M8 8l6 6M14 8l-6 6",stroke:"#DC2626",strokeWidth:"1.5",strokeLinecap:"round"})]}),L=()=>(0,t.jsxs)("svg",{width:"22",height:"22",viewBox:"0 0 22 22",fill:"none",children:[(0,t.jsx)("circle",{cx:"11",cy:"11",r:"10",stroke:"#3B82F6",strokeWidth:"1.5",fill:"#EFF6FF"}),(0,t.jsx)("path",{d:"M9 7.5l6 3.5-6 3.5V7.5z",fill:"#3B82F6"})]}),M=()=>(0,t.jsx)("svg",{width:"22",height:"22",viewBox:"0 0 22 22",fill:"none",children:(0,t.jsx)("circle",{cx:"11",cy:"11",r:"5",fill:"#9CA3AF"})}),E=({expanded:e})=>(0,t.jsx)("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",className:`transition-transform ${e?"rotate-180":""}`,children:(0,t.jsx)("path",{d:"M6 8l4 4 4-4",stroke:"#6B7280",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),A=()=>(0,t.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:(0,t.jsx)("path",{d:"M8 2v8m0 0l-3-3m3 3l3-3M3 12h10",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),D=({matchDetails:e})=>e&&0!==e.length?(0,t.jsxs)("div",{className:"mt-3",children:[(0,t.jsxs)("h5",{className:"text-sm font-medium mb-2 text-gray-700",children:["Match Details (",e.length,")"]}),(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)("table",{className:"w-full text-sm",children:[(0,t.jsx)("thead",{children:(0,t.jsxs)("tr",{className:"border-b text-left text-gray-500",children:[(0,t.jsx)("th",{className:"pb-2 pr-4 font-medium",children:"Type"}),(0,t.jsx)("th",{className:"pb-2 pr-4 font-medium",children:"Method"}),(0,t.jsx)("th",{className:"pb-2 pr-4 font-medium",children:"Action"}),(0,t.jsx)("th",{className:"pb-2 font-medium",children:"Detail"})]})}),(0,t.jsx)("tbody",{children:e.map((e,s)=>(0,t.jsxs)("tr",{className:"border-b border-gray-100",children:[(0,t.jsx)("td",{className:"py-2 pr-4",children:e.type}),(0,t.jsx)("td",{className:"py-2 pr-4",children:(0,t.jsx)("span",{className:"px-2 py-0.5 bg-slate-100 text-slate-700 rounded text-xs",children:e.detection_method??"-"})}),(0,t.jsx)("td",{className:"py-2 pr-4",children:(0,t.jsx)("span",{className:`px-2 py-0.5 rounded text-xs font-medium ${"BLOCK"===e.action_taken?"bg-red-100 text-red-800":"bg-blue-50 text-blue-700"}`,children:e.action_taken??"-"})}),(0,t.jsxs)("td",{className:"py-2 font-mono text-xs text-gray-600 break-all",children:[e.category?`[${e.category}] `:"",e.snippet??"-"]})]},s))})]})})]}):null,I=({response:e})=>{let[a,l]=(0,s.useState)(!1);return(0,t.jsx)("div",{className:"mt-3",children:(0,t.jsxs)("div",{className:"border rounded-lg overflow-hidden",children:[(0,t.jsx)("div",{className:"flex items-center justify-between p-3 bg-gray-50 cursor-pointer hover:bg-gray-100",onClick:()=>l(!a),children:(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)(E,{expanded:a}),(0,t.jsx)("h5",{className:"font-medium text-sm ml-1",children:"Raw Guardrail Response"})]})}),a&&(0,t.jsx)("div",{className:"p-3 border-t bg-white",children:(0,t.jsx)("pre",{className:"bg-gray-50 rounded p-3 text-xs overflow-x-auto",children:JSON.stringify(e,null,2)})})]})})},O=({entries:e})=>{let a=(0,s.useMemo)(()=>[...e].sort((e,t)=>(e.start_time??0)-(t.start_time??0)),[e]),l=(0,s.useMemo)(()=>{if(0===a.length)return[];let e=a[0].start_time,t=[];t.push({type:"request",label:"Request received",offsetMs:0});let s=a.filter(e=>"pre_call"===e.guardrail_mode),l=a.filter(e=>"post_call"===e.guardrail_mode||"logging_only"===e.guardrail_mode),r=a.filter(e=>"during_call"===e.guardrail_mode);for(let a of s){let s=Math.round((a.end_time-e)*1e3);t.push({type:"guardrail",label:`Pre-call guardrail: ${S(a)}`,offsetMs:s,status:w(a)?"PASSED":"FAILED",isSuccess:w(a)})}let i=s.length>0?Math.max(...s.map(e=>e.end_time)):e,n=Math.round((((l.length>0?Math.min(...l.map(e=>e.start_time)):void 0)??i+1)-e)*1e3);for(let s of(t.push({type:"llm",label:"LLM call",offsetMs:n}),r)){let a=Math.round((s.end_time-e)*1e3);t.push({type:"guardrail",label:`During-call guardrail: ${S(s)}`,offsetMs:a,status:w(s)?"PASSED":"FAILED",isSuccess:w(s)})}for(let s of l){let a=Math.round((s.end_time-e)*1e3);t.push({type:"guardrail",label:`Post-call guardrail: ${S(s)}`,offsetMs:a,status:w(s)?"PASSED":"FAILED",isSuccess:w(s)})}let o=Math.round((Math.max(...a.map(e=>e.end_time))-e)*1e3)+1;return t.push({type:"response",label:"Response returned",offsetMs:o}),t},[a]);return(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider mb-4",children:"Request Lifecycle"}),(0,t.jsx)("div",{className:"relative",children:l.map((e,s)=>(0,t.jsxs)("div",{className:"flex items-start gap-3 relative",children:[(0,t.jsxs)("div",{className:"flex flex-col items-center",children:[(0,t.jsx)("div",{className:"flex-shrink-0",children:"request"===e.type||"response"===e.type?(0,t.jsx)(M,{}):"llm"===e.type?(0,t.jsx)(L,{}):e.isSuccess?(0,t.jsx)(C,{}):(0,t.jsx)(T,{})}),s{var l;let i,[n,o]=(0,s.useState)(!1),d=w(e),c=N(e),x=S(e),u=(i=Math.round(1e3*e.duration),`${i}ms`),p=null==(l=e.guardrail_mode)||""===l?"—":("string"==typeof l?l:String(l)).replace(/_/g,"-").toUpperCase(),g=(e=>{if(!w(e))return null;if(null!=e.risk_score)return e.risk_score;let t=N(e),s=e.patterns_checked??0,a=e.confidence_score??0;if(0===s&&0===a)return 0;let l=7*(s>0?t/s:0)+3*a;return t>0&&l<2&&(l=2),Math.min(10,Math.round(10*l)/10)})(e),f=e.guardrail_provider??"presidio",y=e.guardrail_response,j=Array.isArray(y)?y:[],b="bedrock"!==f||null===y||"object"!=typeof y||Array.isArray(y)?void 0:y,v=null!=e.patterns_checked?`${c}/${e.patterns_checked} matched`:c>0?`${c} matched`:null;return(0,t.jsxs)("div",{className:"border border-gray-200 rounded-lg bg-white",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 px-4 py-3 cursor-pointer hover:bg-gray-50 transition-colors",onClick:()=>o(!n),children:[(0,t.jsx)("div",{className:"flex-shrink-0",children:d?(0,t.jsx)(C,{}):(0,t.jsx)(T,{})}),(0,t.jsxs)("div",{className:"flex items-center gap-2 flex-wrap flex-1 min-w-0",children:[(0,t.jsx)("span",{className:"font-semibold text-gray-900 text-sm truncate",children:x}),(0,t.jsx)("span",{className:"px-2 py-0.5 border border-blue-200 bg-blue-50 text-blue-700 rounded text-[11px] font-semibold uppercase flex-shrink-0",children:p}),(0,t.jsx)("span",{className:`px-2 py-0.5 rounded text-[11px] font-semibold uppercase flex-shrink-0 ${d?"bg-green-100 text-green-700 border border-green-200":"bg-red-100 text-red-700 border border-red-200"}`,children:d?"PASSED":"FAILED"}),v&&(0,t.jsx)("span",{className:`px-2 py-0.5 rounded text-[11px] font-medium flex-shrink-0 ${0===c?"bg-green-50 text-green-700 border border-green-200":"bg-amber-50 text-amber-700 border border-amber-200"}`,children:v}),null!=e.confidence_score&&(0,t.jsxs)("span",{className:"px-2 py-0.5 bg-gray-100 text-gray-600 border border-gray-200 rounded text-[11px] font-medium flex-shrink-0",children:[(100*e.confidence_score).toFixed(0),"% conf"]}),null!=g&&d&&(0,t.jsx)(a.Tooltip,{title:`Risk score: ${g}/10`,children:(0,t.jsxs)("span",{className:`px-2 py-0.5 border rounded text-[11px] font-semibold flex-shrink-0 ${g<=3?"text-green-600 bg-green-50 border-green-200":g<=6?"text-amber-600 bg-amber-50 border-amber-200":"text-red-600 bg-red-50 border-red-200"}`,children:["Risk ",g,"/10"]})})]}),(0,t.jsxs)("div",{className:"flex items-center gap-3 flex-shrink-0",children:[(0,t.jsx)("span",{className:"text-sm text-gray-500 font-mono",children:u}),e.detection_method&&(0,t.jsx)("span",{className:"px-2 py-0.5 bg-gray-100 text-gray-600 border border-gray-200 rounded text-[11px] font-medium",children:e.detection_method.split(",")[0].trim()}),(0,t.jsx)(E,{expanded:n})]})]}),n&&(0,t.jsxs)("div",{className:"border-t border-gray-100 px-4 py-3",children:[e.classification&&(0,t.jsxs)("div",{className:"mb-3 bg-gray-50 rounded-lg p-3 space-y-1",children:[(0,t.jsx)("h5",{className:"text-sm font-medium text-gray-700 mb-2",children:"Classification"}),e.classification.category&&(0,t.jsxs)("div",{className:"flex text-sm",children:[(0,t.jsx)("span",{className:"font-medium w-1/3 text-gray-500",children:"Category:"}),(0,t.jsx)("span",{children:e.classification.category})]}),e.classification.article_reference&&(0,t.jsxs)("div",{className:"flex text-sm",children:[(0,t.jsx)("span",{className:"font-medium w-1/3 text-gray-500",children:"Reference:"}),(0,t.jsx)("span",{className:"font-mono",children:e.classification.article_reference})]}),null!=e.classification.confidence&&(0,t.jsxs)("div",{className:"flex text-sm",children:[(0,t.jsx)("span",{className:"font-medium w-1/3 text-gray-500",children:"Confidence:"}),(0,t.jsxs)("span",{children:[(100*e.classification.confidence).toFixed(0),"%"]})]}),e.classification.reason&&(0,t.jsxs)("div",{className:"flex text-sm",children:[(0,t.jsx)("span",{className:"font-medium w-1/3 text-gray-500",children:"Reason:"}),(0,t.jsx)("span",{children:e.classification.reason})]})]}),e.match_details&&e.match_details.length>0&&(0,t.jsx)(D,{matchDetails:e.match_details}),c>0&&(0,t.jsxs)("div",{className:"mt-3",children:[(0,t.jsx)("h5",{className:"text-sm font-medium text-gray-700 mb-2",children:"Masked Entities"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:Object.entries(e.masked_entity_count||{}).map(([e,s])=>(0,t.jsxs)("span",{className:"px-2 py-1 bg-blue-50 text-blue-700 rounded text-xs font-medium",children:[e,": ",s]},e))})]}),"presidio"===f&&j.length>0&&(0,t.jsx)("div",{className:"mt-3",children:(0,t.jsx)(r,{entities:j})}),"bedrock"===f&&b&&(0,t.jsx)("div",{className:"mt-3",children:(0,t.jsx)(m,{response:b})}),"litellm_content_filter"===f&&y&&(0,t.jsx)("div",{className:"mt-3",children:(0,t.jsx)(h,{response:y})}),f&&!_.has(f)&&y&&(0,t.jsx)(I,{response:y})]})]})};e.s(["default",0,({data:e,accessToken:a,logEntry:l})=>{let r=(0,s.useMemo)(()=>Array.isArray(e)?e.filter(e=>!!e):e?[e]:[],[e]),i=r.filter(w).length,n=i===r.length,o=(0,s.useMemo)(()=>Math.round(1e3*r.reduce((e,t)=>e+(t.duration??0),0)),[r]);return((0,s.useMemo)(()=>Array.from(new Set(r.map(e=>e.policy_template).filter(Boolean))),[r]),0===r.length)?null:(0,t.jsxs)("div",{className:"bg-white rounded-xl border border-gray-200 shadow-sm w-full max-w-full overflow-hidden mb-6",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between px-6 py-4 border-b border-gray-100",children:[(0,t.jsxs)("div",{className:"flex items-center gap-4",children:[(0,t.jsx)(k,{}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h3",{className:"text-lg font-semibold text-gray-900",children:"Guardrails & Policy Compliance"}),(0,t.jsxs)("div",{className:"flex items-center gap-2 mt-0.5",children:[(0,t.jsxs)("span",{className:"text-sm text-gray-500",children:[r.length," guardrail",1!==r.length?"s":""," evaluated"]}),(0,t.jsx)("span",{className:"text-gray-300",children:"|"}),(0,t.jsxs)("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-semibold ${n?"bg-green-50 text-green-700 border border-green-200":"bg-red-50 text-red-700 border border-red-200"}`,children:[n?(0,t.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:(0,t.jsx)("path",{d:"M3 6l2.5 2.5L9 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}):null,i," Passed"]})]})]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-6",children:[(0,t.jsx)("div",{className:"text-right",children:(0,t.jsxs)("div",{className:"text-sm font-medium text-gray-900",children:["Total: ",o,"ms overhead"]})}),(0,t.jsxs)("button",{onClick:()=>{let e=new Blob([JSON.stringify(r,null,2)],{type:"application/json"}),t=URL.createObjectURL(e),s=document.createElement("a");s.href=t,s.download=`guardrail-compliance-log-${new Date().toISOString().slice(0,10)}.json`,s.click(),URL.revokeObjectURL(t)},className:"inline-flex items-center gap-2 px-4 py-2 border border-gray-300 rounded-lg text-sm font-medium text-gray-700 bg-white hover:bg-gray-50 transition-colors",children:[(0,t.jsx)(A,{}),"Export Compliance Log"]})]})]}),a&&l&&(0,t.jsx)("div",{className:"px-6 py-4 border-b border-gray-100",children:(0,t.jsx)(v,{accessToken:a,logEntry:l})}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("div",{className:"w-[340px] flex-shrink-0 border-r border-gray-100 px-6 py-5",children:(0,t.jsx)(O,{entries:r})}),(0,t.jsxs)("div",{className:"flex-1 px-6 py-5 min-w-0",children:[(0,t.jsx)("h4",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider mb-4",children:"Evaluation Details"}),(0,t.jsx)("div",{className:"space-y-3",children:r.map((e,s)=>(0,t.jsx)(z,{entry:e},`${e.guardrail_name??"guardrail"}-${s}`))})]})]})]})}],517442)},70635,e=>{"use strict";var t=e.i(843476),s=e.i(362024),a=e.i(500330);let l=e=>null==e?"-":`$${(0,a.formatNumberWithCommas)(e,8)}`,r=e=>null==e?"-":`${(100*e).toFixed(2)}%`;e.s(["CostBreakdownViewer",0,({costBreakdown:e,totalSpend:a,promptTokens:i,completionTokens:n,cacheHit:o})=>{let d=o?.toLowerCase()==="true",c=void 0!==i||void 0!==n;if(!(e?.input_cost!==void 0||e?.output_cost!==void 0||c||e&&(void 0!==e.discount_percent&&0!==e.discount_percent||void 0!==e.discount_amount&&0!==e.discount_amount||void 0!==e.margin_percent&&0!==e.margin_percent||void 0!==e.margin_fixed_amount&&0!==e.margin_fixed_amount||void 0!==e.margin_total_amount&&0!==e.margin_total_amount)))return null;let m=e&&(void 0!==e.discount_percent&&0!==e.discount_percent||void 0!==e.discount_amount&&0!==e.discount_amount),x=e&&(void 0!==e.margin_percent&&0!==e.margin_percent||void 0!==e.margin_fixed_amount&&0!==e.margin_fixed_amount||void 0!==e.margin_total_amount&&0!==e.margin_total_amount),u=d?0:e?.input_cost,p=d?0:e?.output_cost,h=d?0:e?.original_cost,g=d?0:e?.total_cost??a;return(0,t.jsx)("div",{className:"bg-white rounded-lg shadow w-full max-w-full overflow-hidden mb-6",children:(0,t.jsx)(s.Collapse,{expandIconPosition:"start",items:[{key:"1",label:(0,t.jsxs)("div",{className:"flex items-center justify-between w-full",children:[(0,t.jsx)("h3",{className:"text-lg font-medium text-gray-900",children:"Cost Breakdown"}),(0,t.jsxs)("div",{className:"flex items-center space-x-2 mr-4",children:[(0,t.jsx)("span",{className:"text-sm text-gray-500",children:"Total:"}),(0,t.jsxs)("span",{className:"text-sm font-semibold text-gray-900",children:[l(a),d&&" (Cached)"]})]})]}),children:(0,t.jsxs)("div",{className:"p-6 space-y-4",children:[(0,t.jsxs)("div",{className:"space-y-2 max-w-2xl",children:[(0,t.jsxs)("div",{className:"flex text-sm",children:[(0,t.jsx)("span",{className:"text-gray-600 font-medium w-1/3",children:"Input Cost:"}),(0,t.jsxs)("span",{className:"text-gray-900",children:[l(u),void 0!==i&&(0,t.jsxs)("span",{className:"text-gray-500 font-normal ml-1",children:["(",i.toLocaleString()," prompt tokens)"]})]})]}),(0,t.jsxs)("div",{className:"flex text-sm",children:[(0,t.jsx)("span",{className:"text-gray-600 font-medium w-1/3",children:"Output Cost:"}),(0,t.jsxs)("span",{className:"text-gray-900",children:[l(p),void 0!==n&&(0,t.jsxs)("span",{className:"text-gray-500 font-normal ml-1",children:["(",n.toLocaleString()," completion tokens)"]})]})]}),e?.tool_usage_cost!==void 0&&e.tool_usage_cost>0&&(0,t.jsxs)("div",{className:"flex text-sm",children:[(0,t.jsx)("span",{className:"text-gray-600 font-medium w-1/3",children:"Tool Usage Cost:"}),(0,t.jsx)("span",{className:"text-gray-900",children:l(e.tool_usage_cost)})]}),e?.additional_costs&&Object.keys(e.additional_costs).length>0&&(0,t.jsx)(t.Fragment,{children:Object.entries(e.additional_costs).map(([e,s])=>(0,t.jsxs)("div",{className:"flex text-sm",children:[(0,t.jsxs)("span",{className:"text-gray-600 font-medium w-1/3",children:[e,":"]}),(0,t.jsx)("span",{className:"text-gray-900",children:l(s)})]},e))})]}),!d&&(0,t.jsx)("div",{className:"pt-2 border-t border-gray-100 max-w-2xl",children:(0,t.jsxs)("div",{className:"flex text-sm font-semibold",children:[(0,t.jsx)("span",{className:"text-gray-900 w-1/3",children:"Original LLM Cost:"}),(0,t.jsx)("span",{className:"text-gray-900",children:l(h)})]})}),(m||x)&&(0,t.jsxs)("div",{className:"pt-2 space-y-2 max-w-2xl",children:[m&&(0,t.jsxs)("div",{className:"space-y-2",children:[void 0!==e.discount_percent&&0!==e.discount_percent&&(0,t.jsxs)("div",{className:"flex text-sm text-gray-600",children:[(0,t.jsxs)("span",{className:"font-medium w-1/3",children:["Discount (",r(e.discount_percent),"):"]}),(0,t.jsxs)("span",{className:"text-gray-900",children:["-",l(e.discount_amount)]})]}),void 0!==e.discount_amount&&void 0===e.discount_percent&&(0,t.jsxs)("div",{className:"flex text-sm text-gray-600",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Discount Amount:"}),(0,t.jsxs)("span",{className:"text-gray-900",children:["-",l(e.discount_amount)]})]})]}),x&&(0,t.jsxs)("div",{className:"space-y-2",children:[void 0!==e.margin_percent&&0!==e.margin_percent&&(0,t.jsxs)("div",{className:"flex text-sm text-gray-600",children:[(0,t.jsxs)("span",{className:"font-medium w-1/3",children:["Margin (",r(e.margin_percent),"):"]}),(0,t.jsxs)("span",{className:"text-gray-900",children:["+",l((e.margin_total_amount||0)-(e.margin_fixed_amount||0))]})]}),void 0!==e.margin_fixed_amount&&0!==e.margin_fixed_amount&&(0,t.jsxs)("div",{className:"flex text-sm text-gray-600",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Margin:"}),(0,t.jsxs)("span",{className:"text-gray-900",children:["+",l(e.margin_fixed_amount)]})]})]})]}),(0,t.jsx)("div",{className:"mt-4 pt-4 border-t border-gray-200 max-w-2xl",children:(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("span",{className:"font-bold text-sm text-gray-900 w-1/3",children:"Final Calculated Cost:"}),(0,t.jsxs)("span",{className:"text-sm font-bold text-gray-900",children:[l(g),d&&" (Cached)"]})]})})]})}]})})}])},70969,e=>{"use strict";var t=e.i(843476);e.s(["ConfigInfoMessage",0,({show:e,onOpenSettings:s})=>e?(0,t.jsxs)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4 flex items-start",children:[(0,t.jsx)("div",{className:"text-blue-500 mr-3 flex-shrink-0 mt-0.5",children:(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,t.jsx)("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),(0,t.jsx)("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"})]})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:"text-sm font-medium text-blue-800",children:"Request/Response Data Not Available"}),(0,t.jsxs)("p",{className:"text-sm text-blue-700 mt-1",children:["To view request and response details, enable prompt storage in your LiteLLM configuration by adding the following to your ",(0,t.jsx)("code",{className:"bg-blue-100 px-1 py-0.5 rounded",children:"proxy_config.yaml"})," file",s&&(0,t.jsxs)(t.Fragment,{children:[" or"," ",(0,t.jsx)("button",{onClick:s,className:"text-blue-600 hover:text-blue-800 underline font-medium",children:"open the settings"})," ","to configure this directly."]})]}),(0,t.jsx)("pre",{className:"mt-2 bg-white p-3 rounded border border-blue-200 text-xs font-mono overflow-auto",children:`general_settings: + store_model_in_db: true + store_prompts_in_spend_logs: true`}),(0,t.jsx)("p",{className:"text-xs text-blue-700 mt-2",children:"Note: This will only affect new requests after the configuration change."})]})]}):null])},3565,331052,867612,502626,e=>{"use strict";var t=e.i(843476),s=e.i(271645),a=e.i(464571),l=e.i(608856),r=e.i(492030),i=e.i(166406),n=e.i(894660),o=e.i(240647),d=e.i(531245),c=e.i(283086),m=e.i(195116),x=e.i(97859),u=e.i(257486),p=e.i(337767),h=e.i(237062),g=e.i(898586),f=e.i(869216),y=e.i(175712),j=e.i(262218),b=e.i(653496),v=e.i(560445),_=e.i(362024),N=e.i(91739),w=e.i(770914),S=e.i(482725),k=e.i(166540),C=e.i(500330),T=e.i(517442),L=e.i(70635),M=e.i(70969),E=e.i(916925);function A({data:e}){let[a,l]=(0,s.useState)({});if(!e||0===e.length)return null;let r=e=>new Date(1e3*e).toLocaleString();return(0,t.jsx)("div",{className:"bg-white rounded-lg shadow w-full max-w-full overflow-hidden mb-6",children:(0,t.jsx)(_.Collapse,{defaultActiveKey:["1"],expandIconPosition:"start",items:[{key:"1",label:(0,t.jsx)("h3",{className:"text-lg font-medium text-gray-900",children:"Vector Store Requests"}),children:(0,t.jsx)("div",{className:"p-4",children:e.map((e,s)=>{var i,n;return(0,t.jsxs)("div",{className:"mb-6 last:mb-0",children:[(0,t.jsx)("div",{className:"bg-white rounded-lg border p-4 mb-4",children:(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Query:"}),(0,t.jsx)("span",{className:"font-mono",children:e.query})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Vector Store ID:"}),(0,t.jsx)("span",{className:"font-mono",children:e.vector_store_id})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Provider:"}),(0,t.jsx)("span",{className:"flex items-center",children:(()=>{let{logo:s,displayName:a}=(0,E.getProviderLogoAndName)(e.custom_llm_provider);return(0,t.jsxs)(t.Fragment,{children:[s&&(0,t.jsx)("img",{src:s,alt:`${a} logo`,className:"h-5 w-5 mr-2"}),a]})})()})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Start Time:"}),(0,t.jsx)("span",{children:r(e.start_time)})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"End Time:"}),(0,t.jsx)("span",{children:r(e.end_time)})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Duration:"}),(0,t.jsx)("span",{children:(i=e.start_time,n=e.end_time,`${((n-i)*1e3).toFixed(2)}ms`)})]})]})]})}),(0,t.jsx)("h4",{className:"font-medium mb-2",children:"Search Results"}),(0,t.jsx)("div",{className:"space-y-2",children:e.vector_store_search_response.data.map((e,r)=>{let i=a[`${s}-${r}`]||!1;return(0,t.jsxs)("div",{className:"border rounded-lg overflow-hidden",children:[(0,t.jsxs)("div",{className:"flex items-center p-3 bg-gray-50 cursor-pointer",onClick:()=>{let e;return e=`${s}-${r}`,void l(t=>({...t,[e]:!t[e]}))},children:[(0,t.jsx)("svg",{className:`w-5 h-5 mr-2 transition-transform ${i?"transform rotate-90":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsxs)("span",{className:"font-medium mr-2",children:["Result ",r+1]}),(0,t.jsxs)("span",{className:"text-gray-500 text-sm",children:["Score: ",(0,t.jsx)("span",{className:"font-mono",children:e.score.toFixed(4)})]})]})]}),i&&(0,t.jsx)("div",{className:"p-3 border-t bg-white",children:e.content.map((e,s)=>(0,t.jsxs)("div",{className:"mb-2 last:mb-0",children:[(0,t.jsx)("div",{className:"text-xs text-gray-500 mb-1",children:e.type}),(0,t.jsx)("pre",{className:"text-xs font-mono whitespace-pre-wrap break-all bg-gray-50 p-2 rounded",children:e.text})]},s))})]},r)})})]},s)})})}]})})}e.s(["VectorStoreViewer",()=>A],331052);var D=e.i(592968),I=e.i(207066);let{Text:O}=g.Typography;function z({value:e,maxWidth:s=I.DEFAULT_MAX_WIDTH}){return e?(0,t.jsx)(D.Tooltip,{title:e,children:(0,t.jsx)(O,{copyable:{text:e,tooltips:["Copy","Copied!"]},style:{maxWidth:s,display:"inline-block",verticalAlign:"bottom",fontFamily:I.FONT_FAMILY_MONO,fontSize:I.FONT_SIZE_SMALL},ellipsis:!0,children:e})}):(0,t.jsx)(O,{type:"secondary",children:"-"})}let{Text:R}=g.Typography;function P({prompt:e=0,completion:s=0,total:a=0}){return(0,t.jsxs)(R,{children:[a.toLocaleString()," (",e.toLocaleString()," prompt tokens + ",s.toLocaleString()," completion tokens)"]})}let B=e=>!!e&&e instanceof Date,F=e=>"object"==typeof e&&null!==e,q=e=>!!e&&e instanceof Object&&"function"==typeof e;function H(e,t){return void 0===t&&(t=!1),!e||t?`"${e}"`:e}function $(e){let{field:t,value:a,data:l,lastElement:r,openBracket:i,closeBracket:n,level:o,style:d,shouldExpandNode:c,clickToExpandNode:m,outerRef:x,beforeExpandChange:u}=e,p=(0,s.useRef)(!1),[h,g]=(0,s.useState)(()=>c(o,a,t)),f=(0,s.useRef)(null);(0,s.useEffect)(()=>{p.current?g(c(o,a,t)):p.current=!0},[c]);let y=(0,s.useId)();if(0===l.length)return function(e){let{field:t,openBracket:a,closeBracket:l,lastElement:r,style:i}=e;return(0,s.createElement)("div",{className:i.basicChildStyle,role:"treeitem","aria-selected":void 0},(t||""===t)&&(0,s.createElement)("span",{className:i.label},H(t,i.quotesForFieldNames),":"),(0,s.createElement)("span",{className:i.punctuation},a),(0,s.createElement)("span",{className:i.punctuation},l),!r&&(0,s.createElement)("span",{className:i.punctuation},","))}({field:t,openBracket:i,closeBracket:n,lastElement:r,style:d});let j=h?d.collapseIcon:d.expandIcon,b=h?d.ariaLables.collapseJson:d.ariaLables.expandJson,v=o+1,_=l.length-1,N=e=>{h!==e&&(!u||u({level:o,value:a,field:t,newExpandValue:e}))&&g(e)},w=e=>{if("ArrowRight"===e.key||"ArrowLeft"===e.key)e.preventDefault(),N("ArrowRight"===e.key);else if("ArrowUp"===e.key||"ArrowDown"===e.key){e.preventDefault();let t="ArrowUp"===e.key?-1:1;if(!x.current)return;let s=x.current.querySelectorAll("[role=button]"),a=-1;for(let e=0;e{var e;N(!h);let t=f.current;if(!t)return;let s=null==(e=x.current)?void 0:e.querySelector('[role=button][tabindex="0"]');s&&(s.tabIndex=-1),t.tabIndex=0,t.focus()};return(0,s.createElement)("div",{className:d.basicChildStyle,role:"treeitem","aria-expanded":h,"aria-selected":void 0},(0,s.createElement)("span",{className:j,onClick:S,onKeyDown:w,role:"button","aria-label":b,"aria-expanded":h,"aria-controls":h?y:void 0,ref:f,tabIndex:0===o?0:-1}),(t||""===t)&&(m?(0,s.createElement)("span",{className:d.clickableLabel,onClick:S,onKeyDown:w},H(t,d.quotesForFieldNames),":"):(0,s.createElement)("span",{className:d.label},H(t,d.quotesForFieldNames),":")),(0,s.createElement)("span",{className:d.punctuation},i),h?(0,s.createElement)("ul",{id:y,role:"group",className:d.childFieldsContainer},l.map((e,t)=>(0,s.createElement)(W,{key:e[0]||t,field:e[0],value:e[1],style:d,lastElement:t===_,level:v,shouldExpandNode:c,clickToExpandNode:m,beforeExpandChange:u,outerRef:x}))):(0,s.createElement)("span",{className:d.collapsedContent,onClick:S,onKeyDown:w}),(0,s.createElement)("span",{className:d.punctuation},n),!r&&(0,s.createElement)("span",{className:d.punctuation},","))}function Y(e){let{field:t,value:s,style:a,lastElement:l,shouldExpandNode:r,clickToExpandNode:i,level:n,outerRef:o,beforeExpandChange:d}=e;return $({field:t,value:s,lastElement:l||!1,level:n,openBracket:"{",closeBracket:"}",style:a,shouldExpandNode:r,clickToExpandNode:i,data:Object.keys(s).map(e=>[e,s[e]]),outerRef:o,beforeExpandChange:d})}function K(e){let{field:t,value:s,style:a,lastElement:l,level:r,shouldExpandNode:i,clickToExpandNode:n,outerRef:o,beforeExpandChange:d}=e;return $({field:t,value:s,lastElement:l||!1,level:r,openBracket:"[",closeBracket:"]",style:a,shouldExpandNode:i,clickToExpandNode:n,data:s.map(e=>[void 0,e]),outerRef:o,beforeExpandChange:d})}function V(e){let t,{field:a,value:l,style:r,lastElement:i}=e,n=r.otherValue;if(null===l)t="null",n=r.nullValue;else if(void 0===l)t="undefined",n=r.undefinedValue;else if("string"==typeof l||l instanceof String){var o;o=!r.noQuotesForStringValues,t=r.stringifyStringValues?JSON.stringify(l):o?`"${l}"`:l,n=r.stringValue}else if("boolean"==typeof l||l instanceof Boolean)t=l?"true":"false",n=r.booleanValue;else if("number"==typeof l||l instanceof Number)t=l.toString(),n=r.numberValue;else"bigint"==typeof l||l instanceof BigInt?(t=`${l.toString()}n`,n=r.numberValue):t=B(l)?l.toISOString():q(l)?"function() { }":l.toString();return(0,s.createElement)("div",{className:r.basicChildStyle,role:"treeitem","aria-selected":void 0},(a||""===a)&&(0,s.createElement)("span",{className:r.label},H(a,r.quotesForFieldNames),":"),(0,s.createElement)("span",{className:n},t),!i&&(0,s.createElement)("span",{className:r.punctuation},","))}function W(e){let t=e.value;return Array.isArray(t)?(0,s.createElement)(K,Object.assign({},e)):!F(t)||B(t)||q(t)?(0,s.createElement)(V,Object.assign({},e)):(0,s.createElement)(Y,Object.assign({},e))}let U={container:"_2IvMF _GzYRV",basicChildStyle:"_2bkNM",childFieldsContainer:"_1BXBN",label:"_1MGIk",clickableLabel:"_2YKJg _1MGIk _1MFti",nullValue:"_2T6PJ",undefinedValue:"_1Gho6",stringValue:"_vGjyY",booleanValue:"_3zQKs",numberValue:"_1bQdo",otherValue:"_1xvuR",punctuation:"_3uHL6 _3eOF8",collapseIcon:"_oLqym _f10Tu _1MFti _1LId0",expandIcon:"_2AXVT _f10Tu _1MFti _1UmXx",collapsedContent:"_2KJWg _1pNG9 _1MFti",noQuotesForStringValues:!1,quotesForFieldNames:!1,ariaLables:{collapseJson:"collapse JSON",expandJson:"expand JSON"},stringifyStringValues:!1},G=()=>!0,J=e=>{let{data:t,style:a=U,shouldExpandNode:l=G,clickToExpandNode:r=!1,beforeExpandChange:i,compactTopLevel:n,...o}=e,d=(0,s.useRef)(null);return(0,s.createElement)("div",Object.assign({"aria-label":"JSON view"},o,{className:a.container,ref:d,role:"tree"}),n&&F(t)?Object.entries(t).map(e=>{let[t,n]=e;return(0,s.createElement)(W,{key:t,field:t,value:n,style:{...U,...a},lastElement:!0,level:1,shouldExpandNode:l,clickToExpandNode:r,beforeExpandChange:i,outerRef:d})}):(0,s.createElement)(W,{value:t,style:{...U,...a},lastElement:!0,level:0,shouldExpandNode:l,clickToExpandNode:r,outerRef:d,beforeExpandChange:i}))};e.s(["JsonView",()=>J,"defaultStyles",()=>U],867612);let{Text:Q}=g.Typography;function X({data:e}){return e?(0,t.jsx)("div",{style:{maxHeight:I.JSON_MAX_HEIGHT,overflow:"auto",background:I.COLOR_BG_LIGHT,padding:I.SPACING_LARGE,borderRadius:4},children:(0,t.jsx)("div",{className:"[&_[role='tree']]:bg-white [&_[role='tree']]:text-slate-900",children:(0,t.jsx)(J,{data:e,style:U,clickToExpandNode:!0})})}):(0,t.jsx)(Q,{type:"secondary",children:"No data"})}function Z(e){if("string"==typeof e)try{return JSON.parse(e)}catch{}return e}function ee(e){return Array.isArray(e)?e:e?[e]:[]}function et(e){if("string"==typeof e)try{return JSON.parse(e)}catch{}return e}var es=e.i(366308),ea=e.i(755151),el=e.i(291542);let{Text:er}=g.Typography;function ei({tool:e}){let s=Object.entries(e.parameters?.properties||{}).map(([t,s])=>({key:t,name:t,type:s.type||"any",description:s.description||"-",required:e.parameters?.required?.includes(t)||!1})),a=[{title:"Parameter",dataIndex:"name",key:"name",render:(e,s)=>(0,t.jsxs)(er,{code:!0,children:[e,s.required&&(0,t.jsx)(er,{type:"danger",children:"*"})]})},{title:"Type",dataIndex:"type",key:"type",render:e=>(0,t.jsx)(er,{code:!0,style:{color:"#1890ff"},children:e})},{title:"Description",dataIndex:"description",key:"description",render:e=>(0,t.jsx)(er,{type:"secondary",children:e})}];return(0,t.jsxs)("div",{children:[e.description&&(0,t.jsx)("div",{style:{marginBottom:16},children:(0,t.jsx)(er,{style:{lineHeight:1.6,whiteSpace:"pre-wrap"},children:e.description})}),s.length>0&&(0,t.jsxs)("div",{children:[(0,t.jsx)(er,{type:"secondary",style:{fontSize:12,display:"block",marginBottom:8},children:"Parameters"}),(0,t.jsx)(el.Table,{dataSource:s,columns:a,pagination:!1,size:"small",bordered:!0})]}),e.called&&e.callData&&(0,t.jsxs)("div",{style:{marginTop:16},children:[(0,t.jsx)(er,{type:"secondary",style:{fontSize:12,display:"block",marginBottom:8},children:"Called With"}),(0,t.jsx)("div",{style:{background:"#f6ffed",border:"1px solid #b7eb8f",borderRadius:4,padding:12},children:(0,t.jsx)("pre",{style:{margin:0,fontSize:12,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:JSON.stringify(e.callData.arguments,null,2)})})]})]})}function en({tool:e}){let s={type:"function",function:{name:e.name,description:e.description,parameters:e.parameters}};return(0,t.jsx)("pre",{style:{margin:0,whiteSpace:"pre-wrap",wordBreak:"break-word",fontSize:12,background:"#fafafa",padding:12,borderRadius:4,maxHeight:300,overflow:"auto"},children:JSON.stringify(s,null,2)})}let{Text:eo}=g.Typography;function ed({tool:e}){let[a,l]=(0,s.useState)("formatted");return(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:12},children:[(0,t.jsx)(eo,{type:"secondary",style:{fontSize:12},children:"Description"}),(0,t.jsxs)(N.Radio.Group,{size:"small",value:a,onChange:e=>l(e.target.value),children:[(0,t.jsx)(N.Radio.Button,{value:"formatted",children:"Formatted"}),(0,t.jsx)(N.Radio.Button,{value:"json",children:"JSON"})]})]}),"formatted"===a?(0,t.jsx)(ei,{tool:e}):(0,t.jsx)(en,{tool:e})]})}let{Text:ec}=g.Typography;function em({tool:e}){let[a,l]=(0,s.useState)(!1);return(0,t.jsxs)("div",{style:{border:"1px solid #f0f0f0",borderRadius:8,overflow:"hidden"},children:[(0,t.jsxs)("div",{onClick:()=>l(!a),style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 16px",cursor:"pointer",background:a?"#fafafa":"#fff",transition:"background 0.2s"},children:[(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10},children:[(0,t.jsx)(es.ToolOutlined,{style:{color:"#8c8c8c",fontSize:14}}),(0,t.jsxs)(ec,{style:{fontSize:14},children:[e.index,". ",e.name]})]}),(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8},children:[(0,t.jsx)(j.Tag,{color:e.called?"blue":"default",children:e.called?"called":"not called"}),a?(0,t.jsx)(ea.DownOutlined,{style:{fontSize:12,color:"#8c8c8c"}}):(0,t.jsx)(o.RightOutlined,{style:{fontSize:12,color:"#8c8c8c"}})]})]}),a&&(0,t.jsx)("div",{style:{padding:"16px",borderTop:"1px solid #f0f0f0",background:"#fff"},children:(0,t.jsx)(ed,{tool:e})})]})}let{Text:ex}=g.Typography;function eu({log:e}){let s=function(e){let t,s=!(t=et(e.proxy_server_request||e.messages))||Array.isArray(t)?[]:"object"==typeof t&&t.tools&&Array.isArray(t.tools)?t.tools:[];if(0===s.length)return[];let a=function(e){let t=et(e.response);if(!t||"object"!=typeof t)return[];let s=t.choices;if(Array.isArray(s)&&s.length>0){let e=s[0].message;if(e&&Array.isArray(e.tool_calls))return e.tool_calls}if(Array.isArray(t.content)){let e=t.content.filter(e=>"tool_use"===e.type);if(e.length>0)return e.map(e=>({id:e.id,type:"function",function:{name:e.name,arguments:JSON.stringify(e.input||{})}}))}if(Array.isArray(t.tool_calls))return t.tool_calls;if(Array.isArray(t.results)){let e=[];for(let s of t.results)if("response.done"===s.type&&s.response?.output)for(let t of s.response.output)"function_call"===t.type&&e.push({id:t.call_id||"",type:"function",function:{name:t.name||"",arguments:t.arguments||"{}"}});if(e.length>0)return e}return[]}(e),l=new Set(a.map(e=>e.function?.name).filter(Boolean)),r=new Map;return a.forEach(e=>{let t=e.function?.name;t&&r.set(t,{id:e.id,name:t,arguments:function(e){try{return JSON.parse(e)}catch{return{}}}(e.function?.arguments||"{}")})}),s.map((e,t)=>{let s=e.function?.name||e.name||`Tool ${t+1}`;return{index:t+1,name:s,description:e.function?.description||e.description||"",parameters:e.function?.parameters||e.input_schema||{},called:l.has(s),callData:r.get(s)}})}(e);if(0===s.length)return null;let a=s.length,l=s.filter(e=>e.called).length,r=s.slice(0,2).map(e=>e.name).join(", "),i=s.length>2;return(0,t.jsx)("div",{className:"bg-white rounded-lg shadow w-full max-w-full overflow-hidden mb-6",children:(0,t.jsx)(_.Collapse,{expandIconPosition:"start",items:[{key:"1",label:(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:12,flexWrap:"wrap"},children:[(0,t.jsx)("h3",{className:"text-lg font-medium text-gray-900",children:"Tools"}),(0,t.jsxs)(ex,{type:"secondary",style:{fontSize:14},children:[a," provided, ",l," called"]}),(0,t.jsxs)(ex,{type:"secondary",style:{fontSize:14},children:["• ",r,i&&"..."]})]}),children:(0,t.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:8},children:s.map(e=>(0,t.jsx)(em,{tool:e},e.name))})}]})})}let ep=e=>{if(!e)return{};if("string"==typeof e)try{return JSON.parse(e)}catch{return{raw:e}}return e};var eh=e.i(998573),eg=e.i(264843),ef=e.i(624001);let{Text:ey}=g.Typography;function ej({type:e,tokens:s,cost:l,onCopy:r,isCollapsed:n,onToggleCollapse:o,turnCount:d}){return(0,t.jsxs)("div",{onClick:o,style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"10px 16px",borderBottom:n?"none":"1px solid #f0f0f0",background:"#fafafa",cursor:o?"pointer":"default",transition:"background 0.15s ease"},onMouseEnter:e=>{o&&(e.currentTarget.style.background="#f5f5f5")},onMouseLeave:e=>{e.currentTarget.style.background="#fafafa"},children:[(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:16},children:[o&&(0,t.jsx)("div",{style:{display:"flex",alignItems:"center"},children:n?(0,t.jsx)(ea.DownOutlined,{style:{fontSize:10,color:"#8c8c8c"}}):(0,t.jsx)(ef.UpOutlined,{style:{fontSize:10,color:"#8c8c8c"}})}),(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8},children:["input"===e?(0,t.jsx)(eg.MessageOutlined,{style:{color:"#8c8c8c",fontSize:14}}):(0,t.jsx)("span",{style:{fontSize:14,filter:"grayscale(1)",opacity:.6},children:"✨"}),(0,t.jsx)(ey,{style:{fontWeight:500,fontSize:14},children:"input"===e?"Input":"Output"})]}),void 0!==s&&(0,t.jsxs)(ey,{type:"secondary",style:{fontSize:12},children:["Tokens: ",s.toLocaleString()]}),void 0!==l&&(0,t.jsxs)(ey,{type:"secondary",style:{fontSize:12},children:["Cost: $",l.toFixed(6)]}),void 0!==d&&d>0&&(0,t.jsxs)(ey,{type:"secondary",style:{fontSize:12},children:["Turns: ",d]})]}),(0,t.jsx)(D.Tooltip,{title:"Copy",children:(0,t.jsx)(a.Button,{type:"text",size:"small",icon:(0,t.jsx)(i.CopyOutlined,{}),onClick:e=>{e.stopPropagation(),r()}})})]})}let{Text:eb}=g.Typography;function ev({label:e,content:a,defaultExpanded:l=!1}){let[r,i]=(0,s.useState)(l),[n,d]=(0,s.useState)(!1),c=a?.length||0;return a&&0!==c?(0,t.jsxs)("div",{style:{marginBottom:8},children:[(0,t.jsxs)("div",{onClick:()=>i(!r),onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),style:{display:"flex",alignItems:"center",gap:6,cursor:"pointer",padding:"4px 0",borderRadius:4,background:n?"#f5f5f5":"transparent",transition:"background 0.15s ease",marginBottom:4*!!r},children:[r?(0,t.jsx)(ea.DownOutlined,{style:{fontSize:10,color:"#8c8c8c"}}):(0,t.jsx)(o.RightOutlined,{style:{fontSize:10,color:"#8c8c8c"}}),(0,t.jsx)(eb,{type:"secondary",style:{fontSize:10,letterSpacing:"0.5px",textTransform:"uppercase"},children:e}),(0,t.jsxs)(eb,{type:"secondary",style:{fontSize:10},children:["(",c.toLocaleString()," chars)"]})]}),(0,t.jsx)("div",{style:{maxHeight:r?"2000px":"0px",overflow:"hidden",transition:"max-height 0.2s ease-out, opacity 0.2s ease-out",opacity:+!!r},children:(0,t.jsx)("div",{style:{paddingLeft:16,fontSize:13,lineHeight:1.7,color:"#262626",borderLeft:"1px solid #f0f0f0",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:a})})]}):null}let{Text:e_}=g.Typography;function eN({tool:e,compact:s=!1}){return(0,t.jsxs)("div",{style:{background:"#f8f9fa",border:"1px solid #e9ecef",borderRadius:6,padding:s?"6px 10px":"10px 14px",marginTop:8,fontFamily:"monospace",fontSize:12,position:"relative"},children:[(0,t.jsx)("div",{style:{position:"absolute",top:-8,left:12,background:"#fff",padding:"0 6px",fontSize:10,color:"#8c8c8c",border:"1px solid #e9ecef",borderRadius:3},children:"function"}),(0,t.jsx)(e_,{strong:!0,style:{fontSize:13,display:"block",marginBottom:6},children:e.name}),Object.keys(e.arguments).length>0&&(0,t.jsx)("div",{children:Object.entries(e.arguments).map(([e,s])=>(0,t.jsxs)("div",{style:{marginBottom:2},children:[(0,t.jsxs)(e_,{type:"secondary",style:{fontSize:12},children:[e,":"," "]}),(0,t.jsx)(e_,{style:{fontSize:12},children:JSON.stringify(s)})]},e))})]})}let{Text:ew}=g.Typography;function eS({label:e,content:s,toolCalls:a,isCompact:l=!1}){let r=s&&"null"!==s&&s.length>0?s:null,i=a&&a.length>0;return r||i?(0,t.jsxs)("div",{style:{marginBottom:8*!!l},children:[(0,t.jsx)(ew,{type:"secondary",style:{fontSize:10,letterSpacing:"0.5px",textTransform:"uppercase",display:"block",marginBottom:3},children:e}),r&&(0,t.jsx)("div",{style:{fontSize:13,lineHeight:1.7,color:"#262626",whiteSpace:"pre-wrap",wordBreak:"break-word",marginBottom:6*!!i},children:r}),i&&(0,t.jsx)("div",{children:a.map((e,s)=>(0,t.jsx)(eN,{tool:e,compact:l},e.id||s))})]}):null}let{Text:ek}=g.Typography;function eC({messages:e}){let[a,l]=(0,s.useState)(!1),[r,i]=(0,s.useState)(!1);return 0===e.length?null:(0,t.jsxs)("div",{style:{marginBottom:8},children:[(0,t.jsxs)("div",{onClick:()=>l(!a),onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),style:{display:"flex",alignItems:"center",gap:6,cursor:"pointer",padding:"4px 0",borderRadius:4,background:r?"#f5f5f5":"transparent",transition:"background 0.15s ease",marginBottom:4*!!a},children:[a?(0,t.jsx)(ea.DownOutlined,{style:{fontSize:10,color:"#8c8c8c"}}):(0,t.jsx)(o.RightOutlined,{style:{fontSize:10,color:"#8c8c8c"}}),(0,t.jsxs)(ek,{type:"secondary",style:{fontSize:10,letterSpacing:"0.5px",textTransform:"uppercase"},children:["HISTORY (",e.length," message",1!==e.length?"s":"",")"]})]}),(0,t.jsx)("div",{style:{maxHeight:a?"2000px":"0px",overflow:"hidden",transition:"max-height 0.2s ease-out, opacity 0.2s ease-out",opacity:+!!a},children:(0,t.jsx)("div",{style:{paddingLeft:16,borderLeft:"1px solid #f0f0f0"},children:e.map((e,s)=>(0,t.jsx)(eS,{label:e.role.toUpperCase(),content:e.content,toolCalls:e.toolCalls,isCompact:!0},s))})})]})}function eT({messages:e,promptTokens:a,inputCost:l}){let[r,i]=(0,s.useState)(!1);if(0===e.length)return null;let n=e.find(e=>"system"===e.role),o=e.filter(e=>"system"!==e.role),d=o.length>0?o[o.length-1]:null,c=o.slice(0,-1);return(0,t.jsxs)("div",{style:{border:"1px solid #f0f0f0",borderRadius:6,marginBottom:8,overflow:"hidden"},children:[(0,t.jsx)(ej,{type:"input",tokens:a,cost:l,onCopy:()=>{let e=d?.content||"";navigator.clipboard.writeText(e),eh.message.success("Input copied")},isCollapsed:r,onToggleCollapse:()=>i(!r)}),(0,t.jsx)("div",{style:{maxHeight:r?"0px":"10000px",overflow:"hidden",transition:"max-height 0.3s ease-out, opacity 0.3s ease-out",opacity:+!r},children:(0,t.jsxs)("div",{style:{padding:"12px 16px"},children:[n&&(0,t.jsx)(ev,{label:"SYSTEM",content:n.content,defaultExpanded:!!(n.content&&n.content.length<200)}),c.length>0&&(0,t.jsx)(eC,{messages:c}),d&&(0,t.jsx)(eS,{label:d.role.toUpperCase(),content:d.content,toolCalls:d.toolCalls})]})})]})}let{Text:eL}=g.Typography;function eM({message:e,completionTokens:a,outputCost:l}){let[r,i]=(0,s.useState)(!1),n=()=>{if(!e)return;let t=e.content||"";navigator.clipboard.writeText(t),eh.message.success("Output copied")};return e?(0,t.jsxs)("div",{style:{border:"1px solid #f0f0f0",borderRadius:6,overflow:"hidden"},children:[(0,t.jsx)(ej,{type:"output",tokens:a,cost:l,onCopy:n,isCollapsed:r,onToggleCollapse:()=>i(!r)}),(0,t.jsx)("div",{style:{maxHeight:r?"0px":"10000px",overflow:"hidden",transition:"max-height 0.3s ease-out, opacity 0.3s ease-out",opacity:+!r},children:(0,t.jsx)("div",{style:{padding:"12px 16px"},children:(0,t.jsx)(eS,{label:"ASSISTANT",content:e.content,toolCalls:e.toolCalls})})})]}):(0,t.jsxs)("div",{style:{border:"1px solid #f0f0f0",borderRadius:6,overflow:"hidden"},children:[(0,t.jsx)(ej,{type:"output",tokens:a,cost:l,onCopy:n,isCollapsed:r,onToggleCollapse:()=>i(!r)}),(0,t.jsx)("div",{style:{maxHeight:r?"0px":"10000px",overflow:"hidden",transition:"max-height 0.3s ease-out, opacity 0.3s ease-out",opacity:+!r},children:(0,t.jsx)("div",{style:{padding:"12px 16px"},children:(0,t.jsx)(eL,{type:"secondary",style:{fontSize:13,fontStyle:"italic"},children:"No response data available"})})})]})}var eE=e.i(782273),eA=e.i(313603),eD=e.i(793916);let{Text:eI}=g.Typography;function eO({response:e,metrics:s}){let a=e?.results||[],l=e?.usage,r=a.find(e=>"session.created"===e.type||"session.updated"===e.type),i=a.filter(e=>"response.done"===e.type);return(0,t.jsxs)("div",{children:[r?.session&&(0,t.jsx)(ez,{session:r.session,turnCount:i.length}),i.length>0&&(0,t.jsx)(eR,{responses:i.map(e=>e.response).filter(Boolean),totalUsage:l,metrics:s}),!r&&0===i.length&&(0,t.jsx)("div",{style:{border:"1px solid #f0f0f0",borderRadius:6,padding:"16px",color:"#8c8c8c",fontStyle:"italic",fontSize:13},children:"No recognized realtime events found"})]})}function ez({session:e,turnCount:a}){let[l,r]=(0,s.useState)(!0);return(0,t.jsxs)("div",{style:{border:"1px solid #f0f0f0",borderRadius:6,marginBottom:8,overflow:"hidden"},children:[(0,t.jsx)("div",{onClick:()=>r(!l),style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"10px 16px",borderBottom:l?"none":"1px solid #f0f0f0",background:"#fafafa",cursor:"pointer",transition:"background 0.15s ease"},onMouseEnter:e=>{e.currentTarget.style.background="#f5f5f5"},onMouseLeave:e=>{e.currentTarget.style.background="#fafafa"},children:(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:16},children:[(0,t.jsx)("div",{style:{display:"flex",alignItems:"center"},children:l?(0,t.jsx)(ea.DownOutlined,{style:{fontSize:10,color:"#8c8c8c"}}):(0,t.jsx)(ef.UpOutlined,{style:{fontSize:10,color:"#8c8c8c"}})}),(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8},children:[(0,t.jsx)(eA.SettingOutlined,{style:{color:"#8c8c8c",fontSize:14}}),(0,t.jsx)(eI,{style:{fontWeight:500,fontSize:14},children:"Session"})]}),(0,t.jsx)(eI,{type:"secondary",style:{fontSize:12},children:e.model}),a>0&&(0,t.jsxs)(j.Tag,{color:"purple",style:{margin:0,fontWeight:500},children:[a," ",1===a?"turn":"turns"]}),e.voice&&(0,t.jsxs)(j.Tag,{color:"blue",style:{margin:0},children:[(0,t.jsx)(eE.SoundOutlined,{})," ",e.voice]}),e.modalities&&(0,t.jsx)("div",{style:{display:"flex",gap:4},children:e.modalities.map(e=>(0,t.jsxs)(j.Tag,{style:{margin:0},children:["audio"===e?(0,t.jsx)(eD.AudioOutlined,{}):(0,t.jsx)(eg.MessageOutlined,{})," ",e]},e))})]})}),(0,t.jsx)("div",{style:{maxHeight:l?"0px":"10000px",overflow:"hidden",transition:"max-height 0.3s ease-out, opacity 0.3s ease-out",opacity:+!l},children:(0,t.jsxs)("div",{style:{padding:"12px 16px"},children:[(0,t.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"8px 24px",fontSize:13},children:[(0,t.jsx)(eq,{label:"Model",value:e.model}),(0,t.jsx)(eq,{label:"Voice",value:e.voice}),(0,t.jsx)(eq,{label:"Temperature",value:e.temperature}),(0,t.jsx)(eq,{label:"Max Output Tokens",value:e.max_response_output_tokens}),(0,t.jsx)(eq,{label:"Input Audio Format",value:e.input_audio_format}),(0,t.jsx)(eq,{label:"Output Audio Format",value:e.output_audio_format}),e.turn_detection&&(0,t.jsx)(eq,{label:"Turn Detection",value:e.turn_detection.type}),e.tools&&e.tools.length>0&&(0,t.jsx)(eq,{label:"Tools",value:`${e.tools.length} tool(s)`})]}),e.instructions&&(0,t.jsxs)("div",{style:{marginTop:12},children:[(0,t.jsx)(eI,{type:"secondary",style:{fontSize:10,letterSpacing:"0.5px",textTransform:"uppercase",display:"block",marginBottom:4},children:"Instructions"}),(0,t.jsx)("div",{style:{fontSize:12,lineHeight:1.6,color:"#595959",background:"#fafafa",padding:"8px 12px",borderRadius:4,border:"1px solid #f0f0f0",whiteSpace:"pre-wrap",wordBreak:"break-word",maxHeight:120,overflowY:"auto"},children:e.instructions})]})]})})]})}function eR({responses:e,totalUsage:a,metrics:l}){let[r,i]=(0,s.useState)(!1),n=a?.total_tokens,o=e.length;return(0,t.jsxs)("div",{style:{border:"1px solid #f0f0f0",borderRadius:6,overflow:"hidden"},children:[(0,t.jsx)(ej,{type:"output",tokens:l?.completion_tokens??n,cost:l?.output_cost,onCopy:()=>{let t=e.flatMap(e=>(e.output||[]).flatMap(e=>(e.content||[]).map(t=>`${e.role}: ${t.transcript||t.text||""}`))).join("\n");navigator.clipboard.writeText(t)},isCollapsed:r,onToggleCollapse:()=>i(!r),turnCount:o}),(0,t.jsx)("div",{style:{maxHeight:r?"0px":"10000px",overflow:"hidden",transition:"max-height 0.3s ease-out, opacity 0.3s ease-out",opacity:+!r},children:(0,t.jsx)("div",{style:{padding:"12px 16px"},children:e.map((e,s)=>(0,t.jsx)(eP,{response:e,index:s},e.id||s))})})]})}function eP({response:e,index:s}){let a=e.output||[],l=e.usage;return(0,t.jsxs)("div",{style:{marginBottom:12,paddingBottom:12,borderBottom:"1px solid #f5f5f5"},children:[(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[(0,t.jsx)(j.Tag,{color:"completed"===e.status?"green":"orange",style:{margin:0},children:e.status||"unknown"}),l&&(0,t.jsxs)(eI,{type:"secondary",style:{fontSize:11},children:[l.input_tokens??0," in / ",l.output_tokens??0," out tokens"]}),e.conversation_id&&(0,t.jsx)(D.Tooltip,{title:e.conversation_id,children:(0,t.jsxs)(eI,{type:"secondary",style:{fontSize:11,cursor:"help"},children:["conv: ",e.conversation_id.slice(0,12),"..."]})})]}),a.map((e,s)=>(0,t.jsx)(eB,{output:e},e.id||s)),l?.input_token_details&&(0,t.jsx)(eF,{label:"Input",details:l.input_token_details}),l?.output_token_details&&(0,t.jsx)(eF,{label:"Output",details:l.output_token_details})]})}function eB({output:e}){let s=e.content||[];return s.some(e=>e.transcript||e.text)?(0,t.jsxs)("div",{style:{marginBottom:8},children:[(0,t.jsx)(eI,{type:"secondary",style:{fontSize:10,letterSpacing:"0.5px",textTransform:"uppercase",display:"block",marginBottom:3},children:e.role?.toUpperCase()||"ASSISTANT"}),s.map((e,s)=>{let a=e.transcript||e.text;return a?(0,t.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",gap:8,marginBottom:4},children:["audio"===e.type&&(0,t.jsx)(eD.AudioOutlined,{style:{color:"#8c8c8c",fontSize:12,marginTop:3,flexShrink:0}}),"text"===e.type&&(0,t.jsx)(eg.MessageOutlined,{style:{color:"#8c8c8c",fontSize:12,marginTop:3,flexShrink:0}}),(0,t.jsx)("div",{style:{fontSize:13,lineHeight:1.7,color:"#262626",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:a})]},s):null})]}):null}function eF({label:e,details:s}){let a=Object.entries(s).filter(([,e])=>"number"==typeof e||"object"==typeof e&&null!==e);return 0===a.length?null:(0,t.jsxs)("div",{style:{marginTop:4},children:[(0,t.jsxs)(eI,{type:"secondary",style:{fontSize:10,letterSpacing:"0.5px",textTransform:"uppercase"},children:[e," Token Breakdown"]}),(0,t.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:8,marginTop:4},children:a.map(([e,s])=>"number"==typeof s?(0,t.jsxs)(j.Tag,{style:{margin:0},children:[e.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase()),": ",s.toLocaleString()]},e):null)})]})}function eq({label:e,value:s}){return null==s?null:(0,t.jsxs)("div",{children:[(0,t.jsx)(eI,{type:"secondary",style:{fontSize:11},children:e}),(0,t.jsx)("div",{style:{fontSize:13,color:"#262626"},children:String(s)})]})}function eH({request:e,response:s,metrics:a}){let l,r,i;if(s&&s.results&&Array.isArray(s.results)&&0!==s.results.length&&s.results.some(e=>"session.created"===e.type||"session.updated"===e.type||"response.done"===e.type))return(0,t.jsx)(eO,{response:s,metrics:a});let{requestMessages:n,responseMessage:o}=(l=[],e?.messages&&Array.isArray(e.messages)&&e.messages.forEach(e=>{let t;l.push({role:e.role||"user",content:"string"==typeof(t=e.content)?t:Array.isArray(t)?t.map(e=>"string"==typeof e?e:"text"===e.type?e.text:"image_url"===e.type?"[Image]":JSON.stringify(e)).join("\n"):JSON.stringify(t),toolCallId:e.tool_call_id})}),r=null,(i=s?.choices?.[0]?.message)&&(r={role:i.role||"assistant",content:i.content||"",toolCalls:(e=>{if(e&&Array.isArray(e))return e.map(e=>({id:e.id||"",name:e.function?.name||"unknown",arguments:ep(e.function?.arguments)}))})(i.tool_calls)}),{requestMessages:l,responseMessage:r});return(0,t.jsxs)("div",{children:[(0,t.jsx)(eT,{messages:n,promptTokens:a?.prompt_tokens,inputCost:a?.input_cost}),(0,t.jsx)(eM,{message:o,completionTokens:a?.completion_tokens,outputCost:a?.output_cost})]})}let{Text:e$}=g.Typography;function eY({logEntry:e,onOpenSettings:s,isLoadingDetails:a=!1,accessToken:l}){var r,i;let n=e.metadata||{},o="failure"===n.status,d=o?n.error_information:null,c=!!(r=e.messages)&&(Array.isArray(r)?r.length>0:"object"==typeof r&&Object.keys(r).length>0),m=!!(i=e.response)&&Object.keys(Z(i)).length>0,x=!c&&!m&&!o&&!a,u=n?.guardrail_information,p=ee(u),h=p.length>0,g=p.reduce((e,t)=>{let s=t?.masked_entity_count;return s?e+Object.values(s).reduce((e,t)=>"number"==typeof t?e+t:e,0):e},0),j=0===p.length?"-":1===p.length?p[0]?.guardrail_name??"-":`${p.length} guardrails`,b=n.vector_store_request_metadata&&Array.isArray(n.vector_store_request_metadata)&&n.vector_store_request_metadata.length>0;return(0,t.jsxs)("div",{style:{padding:`${I.DRAWER_CONTENT_PADDING} ${I.DRAWER_CONTENT_PADDING} 0`},children:[o&&d&&(0,t.jsx)(v.Alert,{type:"error",showIcon:!0,message:"Request Failed",description:(0,t.jsx)(eK,{errorInfo:d}),className:"mb-6"}),e.request_tags&&Object.keys(e.request_tags).length>0&&(0,t.jsx)(eV,{tags:e.request_tags}),(0,t.jsx)("div",{className:"bg-white rounded-lg shadow w-full max-w-full overflow-hidden mb-6",children:(0,t.jsx)(y.Card,{title:"Request Details",size:"small",bordered:!1,style:{marginBottom:0},children:(0,t.jsxs)(f.Descriptions,{column:2,size:"small",children:[(0,t.jsx)(f.Descriptions.Item,{label:"Model",children:e.model}),(0,t.jsx)(f.Descriptions.Item,{label:"Provider",children:e.custom_llm_provider||"-"}),(0,t.jsx)(f.Descriptions.Item,{label:"Call Type",children:e.call_type}),(0,t.jsx)(f.Descriptions.Item,{label:"Model ID",children:(0,t.jsx)(z,{value:e.model_id})}),(0,t.jsx)(f.Descriptions.Item,{label:"API Base",children:(0,t.jsx)(z,{value:e.api_base,maxWidth:I.API_BASE_MAX_WIDTH})}),e.requester_ip_address&&(0,t.jsx)(f.Descriptions.Item,{label:"IP Address",children:e.requester_ip_address}),h&&(0,t.jsx)(f.Descriptions.Item,{label:"Guardrail",children:(0,t.jsx)(eW,{label:j,maskedCount:g})})]})})}),(0,t.jsx)(eU,{logEntry:e,metadata:n}),(0,t.jsx)(L.CostBreakdownViewer,{costBreakdown:n?.cost_breakdown,totalSpend:e.spend??0,promptTokens:e.prompt_tokens,completionTokens:e.completion_tokens,cacheHit:e.cache_hit}),(0,t.jsx)(eu,{log:e}),x&&(0,t.jsx)("div",{className:"mb-6",children:(0,t.jsx)(M.ConfigInfoMessage,{show:x,onOpenSettings:s})}),a?(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow w-full max-w-full overflow-hidden mb-6 p-8 text-center",children:[(0,t.jsx)(S.Spin,{size:"default"}),(0,t.jsx)("div",{style:{marginTop:8,color:"#999"},children:"Loading request & response data..."})]}):(0,t.jsx)(eG,{hasResponse:m,hasError:o,getRawRequest:()=>Z(e.proxy_server_request||e.messages),getFormattedResponse:()=>o&&d?{error:{message:d.error_message||"An error occurred",type:d.error_class||"error",code:d.error_code||"unknown",param:null}}:Z(e.response),logEntry:e}),h&&(0,t.jsx)("div",{id:"guardrail-section",children:(0,t.jsx)(T.default,{data:u,accessToken:l??null,logEntry:{request_id:e.request_id,user:e.user,model:e.model,startTime:e.startTime,metadata:e.metadata}})}),b&&(0,t.jsx)(A,{data:n.vector_store_request_metadata}),e.metadata&&Object.keys(e.metadata).length>0&&(0,t.jsx)(eQ,{metadata:e.metadata}),(0,t.jsx)("div",{style:{height:I.DRAWER_CONTENT_PADDING}})]})}function eK({errorInfo:e}){return(0,t.jsxs)("div",{children:[e.error_code&&(0,t.jsxs)("div",{children:[(0,t.jsx)(e$,{strong:!0,children:"Error Code:"})," ",e.error_code]}),e.error_message&&(0,t.jsxs)("div",{children:[(0,t.jsx)(e$,{strong:!0,children:"Message:"})," ",e.error_message]})]})}function eV({tags:e}){return(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow w-full max-w-full overflow-hidden p-4 mb-6",children:[(0,t.jsx)(e$,{strong:!0,style:{display:"block",marginBottom:8,fontSize:16},children:"Tags"}),(0,t.jsx)(w.Space,{size:I.SPACING_MEDIUM,wrap:!0,children:Object.entries(e).map(([e,s])=>(0,t.jsxs)(j.Tag,{children:[e,": ",String(s)]},e))})]})}function eW({label:e,maskedCount:s}){return(0,t.jsxs)(w.Space,{size:I.SPACING_MEDIUM,children:[(0,t.jsx)("a",{onClick:()=>{let e=document.getElementById("guardrail-section");e&&e.scrollIntoView({behavior:"smooth"})},style:{cursor:"pointer"},children:e}),s>0&&(0,t.jsxs)(j.Tag,{color:"blue",children:[s," masked"]})]})}function eU({logEntry:e,metadata:s}){let a=e.completionStartTime,l=a&&a!==e.endTime?new Date(a).getTime()-new Date(e.startTime).getTime():null,r=e.cache_hit||s?.additional_usage_values?.cache_read_input_tokens&&s.additional_usage_values.cache_read_input_tokens>0,i=String(e.cache_hit??"None"),n="true"===i.toLowerCase()?"green":"false"===i.toLowerCase()?"red":"default";return(0,t.jsx)("div",{className:"bg-white rounded-lg shadow w-full max-w-full overflow-hidden mb-6",children:(0,t.jsx)(y.Card,{title:"Metrics",size:"small",style:{marginBottom:0},children:(0,t.jsxs)(f.Descriptions,{column:2,size:"small",children:[(0,t.jsx)(f.Descriptions.Item,{label:"Tokens",children:(0,t.jsx)(P,{prompt:e.prompt_tokens,completion:e.completion_tokens,total:e.total_tokens})}),(0,t.jsxs)(f.Descriptions.Item,{label:"Cost",children:["$",(0,C.formatNumberWithCommas)(e.spend||0,8)]}),(0,t.jsxs)(f.Descriptions.Item,{label:"Duration",children:[null!=e.request_duration_ms?(e.request_duration_ms/1e3).toFixed(3):"-"," s"]}),null!=l&&l>0&&(0,t.jsxs)(f.Descriptions.Item,{label:"Time to First Token",children:[(l/1e3).toFixed(3)," s"]}),r&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(f.Descriptions.Item,{label:"Cache Hit",children:(0,t.jsx)(j.Tag,{color:n,children:i})}),s?.additional_usage_values?.cache_read_input_tokens>0&&(0,t.jsx)(f.Descriptions.Item,{label:"Cache Read Tokens",children:(0,C.formatNumberWithCommas)(s.additional_usage_values.cache_read_input_tokens)}),s?.additional_usage_values?.cache_creation_input_tokens>0&&(0,t.jsx)(f.Descriptions.Item,{label:"Cache Creation Tokens",children:(0,C.formatNumberWithCommas)(s.additional_usage_values.cache_creation_input_tokens)})]}),s?.litellm_overhead_time_ms!==void 0&&null!==s.litellm_overhead_time_ms&&(0,t.jsxs)(f.Descriptions.Item,{label:"LiteLLM Overhead",children:[s.litellm_overhead_time_ms.toFixed(2)," ms"]}),(0,t.jsx)(f.Descriptions.Item,{label:"Retries",children:s?.attempted_retries!==void 0&&s?.attempted_retries!==null?s.attempted_retries>0?(0,t.jsxs)(t.Fragment,{children:[s.attempted_retries,void 0!==s.max_retries&&null!==s.max_retries?` / ${s.max_retries}`:""]}):(0,t.jsx)(j.Tag,{color:"green",children:"None"}):"-"}),(0,t.jsx)(f.Descriptions.Item,{label:"Start Time",children:(0,k.default)(e.startTime).format("YYYY-MM-DDTHH:mm:ss.SSS[Z]")}),(0,t.jsx)(f.Descriptions.Item,{label:"End Time",children:(0,k.default)(e.endTime).format("YYYY-MM-DDTHH:mm:ss.SSS[Z]")})]})})})}function eG({hasResponse:e,hasError:a,getRawRequest:l,getFormattedResponse:r,logEntry:i}){let[n,o]=(0,s.useState)(I.TAB_REQUEST),[d,c]=(0,s.useState)("pretty"),m=i.spend??0,x=i.prompt_tokens||0,u=i.completion_tokens||0,p=x+u,h=i.metadata?.cost_breakdown,g=h?.input_cost!==void 0&&h?.output_cost!==void 0,f=g?h.input_cost??0:p>0?m*x/p:0,y=g?h.output_cost??0:p>0?m*u/p:0;return(0,t.jsx)("div",{className:"bg-white rounded-lg shadow w-full max-w-full overflow-hidden mb-6",children:(0,t.jsx)(_.Collapse,{defaultActiveKey:["1"],expandIconPosition:"start",items:[{key:"1",label:(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%"},onClick:e=>{e.target.closest(".ant-radio-group")&&e.stopPropagation()},children:[(0,t.jsx)("h3",{className:"text-lg font-medium text-gray-900",style:{margin:0},children:"Request & Response"}),(0,t.jsxs)(N.Radio.Group,{size:"small",value:d,onChange:e=>c(e.target.value),children:[(0,t.jsx)(N.Radio.Button,{value:"pretty",children:"Pretty"}),(0,t.jsx)(N.Radio.Button,{value:"json",children:"JSON"})]})]}),children:(0,t.jsx)("div",{children:"pretty"===d?(0,t.jsx)(eH,{request:l(),response:r(),metrics:{prompt_tokens:x,completion_tokens:u,input_cost:f,output_cost:y}}):(0,t.jsx)(b.Tabs,{activeKey:n,onChange:e=>o(e),tabBarExtraContent:(0,t.jsx)(e$,{copyable:{text:JSON.stringify(n===I.TAB_REQUEST?l():r(),null,2),tooltips:["Copy JSON","Copied!"]},disabled:n===I.TAB_RESPONSE&&!e&&!a}),items:[{key:I.TAB_REQUEST,label:"Request",children:(0,t.jsx)("div",{style:{paddingTop:I.SPACING_XLARGE,paddingBottom:I.SPACING_XLARGE},children:(0,t.jsx)(X,{data:l(),mode:"formatted"})})},{key:I.TAB_RESPONSE,label:"Response",children:(0,t.jsx)("div",{style:{paddingTop:I.SPACING_XLARGE,paddingBottom:I.SPACING_XLARGE},children:e||a?(0,t.jsx)(X,{data:r(),mode:"formatted"}):(0,t.jsx)("div",{style:{textAlign:"center",padding:20,color:"#999",fontStyle:"italic"},children:"Response data not available"})})}]})})}]})})}function eJ({guardrailEntries:e}){let s=e.every(e=>{let t=e?.guardrail_status||e?.status;return"pass"===t||"passed"===t||"success"===t});return(0,t.jsx)("div",{style:{textAlign:"left",marginBottom:12},children:(0,t.jsxs)("div",{onClick:()=>{let e=document.getElementById("guardrail-section");e&&e.scrollIntoView({behavior:"smooth"})},style:{display:"inline-flex",alignItems:"center",gap:6,padding:"4px 12px",borderRadius:16,cursor:"pointer",fontSize:13,fontWeight:500,backgroundColor:s?"#f0fdf4":"#fef2f2",color:s?"#15803d":"#b91c1c",border:`1px solid ${s?"#bbf7d0":"#fecaca"}`},children:[s?"✓":"✗"," ",e.length," guardrail",1!==e.length?"s":""," evaluated",(0,t.jsx)("span",{style:{fontSize:11,opacity:.7},children:"↓"})]})})}function eQ({metadata:e}){return(0,t.jsx)("div",{className:"bg-white rounded-lg shadow w-full max-w-full overflow-hidden mb-6",children:(0,t.jsx)(_.Collapse,{defaultActiveKey:["1"],expandIconPosition:"start",items:[{key:"1",label:(0,t.jsx)("h3",{className:"text-lg font-medium text-gray-900",children:"Metadata"}),children:(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{style:{display:"flex",justifyContent:"flex-end",marginBottom:8},children:(0,t.jsx)(e$,{copyable:{text:JSON.stringify(e,null,2),tooltips:["Copy Metadata","Copied!"]}})}),(0,t.jsx)("pre",{style:{maxHeight:I.METADATA_MAX_HEIGHT,overflowY:"auto",fontSize:I.FONT_SIZE_SMALL,fontFamily:I.FONT_FAMILY_MONO,whiteSpace:"pre-wrap",wordBreak:"break-all",margin:0},children:JSON.stringify(e,null,2)})]})}]})})}var eX=e.i(764205),eZ=e.i(266027),e0=e.i(135214);function e1({row:e,isSelected:s,onClick:a}){let l=x.MCP_CALL_TYPES.includes(e.call_type),r=x.AGENT_CALL_TYPES.includes(e.call_type),i=null!=e.request_duration_ms?(e.request_duration_ms/1e3).toFixed(3):e.startTime&&e.endTime?((Date.parse(e.endTime)-Date.parse(e.startTime))/1e3).toFixed(3):"-";return(0,t.jsxs)("button",{type:"button",className:`w-full text-left pl-8 pr-2 py-1 transition-colors ${s?"bg-blue-50":"hover:bg-slate-100"}`,onClick:a,children:[(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[l?(0,t.jsx)(m.Wrench,{size:12,className:"text-slate-500 flex-shrink-0"}):r?(0,t.jsx)(d.Bot,{size:12,className:"text-slate-500 flex-shrink-0"}):(0,t.jsx)(c.Sparkles,{size:12,className:"text-slate-500 flex-shrink-0"}),(0,t.jsx)("span",{className:"text-xs font-medium text-slate-900 truncate",children:(0,u.getEventDisplayName)(e.call_type,e.model)})]}),(0,t.jsxs)("div",{className:"text-[10px] text-slate-500 mt-0 flex items-center gap-1.5 font-mono",children:[(0,t.jsxs)("span",{children:[i,"s"]}),e.spend?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{children:"·"}),(0,t.jsx)("span",{children:(0,C.getSpendString)(e.spend)})]}):null,e.total_tokens?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{children:"·"}),(0,t.jsxs)("span",{children:[e.total_tokens," tok"]})]}):null]})]})}function e2({open:e,onClose:d,logEntry:c,sessionId:m,accessToken:u,onOpenSettings:g,allLogs:f=[],onSelectLog:y,startTime:j}){let b=!!m,[v,_]=(0,s.useState)(null),[N,w]=(0,s.useState)(!1),[S,k]=(0,s.useState)(!1),{data:T=[]}=(0,eZ.useQuery)({queryKey:["sessionLogs",m],queryFn:async()=>{if(!m||!u)return[];let e=await (0,eX.sessionSpendLogsCall)(u,m);return(e.data||e||[]).map(e=>({...e,request_duration_ms:e.request_duration_ms??Date.parse(e.endTime)-Date.parse(e.startTime)})).sort((e,t)=>{let s=+!!x.MCP_CALL_TYPES.includes(e.call_type),a=+!!x.MCP_CALL_TYPES.includes(t.call_type);return s!==a?s-a:new Date(e.startTime).getTime()-new Date(t.startTime).getTime()})},enabled:!!(e&&b&&m&&u)}),L=(0,s.useMemo)(()=>b?T.length?v?T.find(e=>e.request_id===v)||T[0]:c?.request_id&&T.find(e=>e.request_id===c.request_id)||T[0]:null:c,[b,c,v,T]);(0,s.useEffect)(()=>{b&&T.length&&(v&&T.some(e=>e.request_id===v)||_(c?.request_id&&T.some(e=>e.request_id===c.request_id)?c.request_id:T[0].request_id))},[b,c,v,T]),(0,s.useEffect)(()=>{e?w(!1):(b&&_(null),k(!1))},[e,b]);let{selectNextLog:M,selectPreviousLog:E}=(0,h.useKeyboardNavigation)({isOpen:e,currentLog:L,allLogs:b?T:f,onClose:d,onSelectLog:e=>{b&&_(e.request_id),y?.(e)}}),A=((e,t,s)=>{let{accessToken:a}=(0,e0.default)();return(0,eZ.useQuery)({queryKey:["logDetails",e,t,a],queryFn:async()=>a&&e&&t?await (0,eX.uiSpendLogDetailsCall)(a,e,t):null,enabled:s&&!!a&&!!e&&!!t,staleTime:6e5,gcTime:6e5})})(L?.request_id,j,e&&!!L?.request_id),D=A.data,O=A.isLoading,z=(0,s.useMemo)(()=>L?{...L,messages:D?.messages||L.messages,response:D?.response||L.response,proxy_server_request:D?.proxy_server_request||L.proxy_server_request}:null,[L,D]),R=L?.metadata||{},P="failure"===R.status?"Failure":"Success",B="failure"===R.status?"error":"success",F=R?.user_api_key_team_alias||"default",q=T.reduce((e,t)=>e+(t.spend||0),0),H=T.length>0?new Date(Math.min(...T.map(e=>new Date(e.startTime).getTime()))):null,$=T.length>0?new Date(Math.max(...T.map(e=>new Date(e.endTime).getTime()))):null,Y=H&&$?(($.getTime()-H.getTime())/1e3).toFixed(2):"0.00",K=T.filter(e=>!x.MCP_CALL_TYPES.includes(e.call_type)&&!x.AGENT_CALL_TYPES.includes(e.call_type)).length,V=T.filter(e=>x.AGENT_CALL_TYPES.includes(e.call_type)).length,W=T.filter(e=>x.MCP_CALL_TYPES.includes(e.call_type)).length,U=b?T:L?[L]:[],G=b?m||"":L?.request_id||"",J=G.length>14?`${G.slice(0,11)}...`:G,Q=async()=>{if(G)try{await navigator.clipboard.writeText(G),k(!0),setTimeout(()=>k(!1),1200)}catch{}};return L&&z?(0,t.jsx)(l.Drawer,{title:null,placement:"right",onClose:d,open:e,width:I.DRAWER_WIDTH,closable:!1,mask:!0,maskClosable:!0,styles:{body:{padding:0,overflow:"hidden"},header:{display:"none"}},children:(0,t.jsxs)("div",{style:{height:"100%"},className:"flex relative",children:[N?(0,t.jsx)(a.Button,{type:"text",size:"small",icon:(0,t.jsx)(o.RightOutlined,{}),onClick:()=>w(!1),className:"absolute top-2 left-2 z-20 !bg-white !border !border-slate-200 !rounded-md","aria-label":"Expand trace sidebar"}):(0,t.jsx)(a.Button,{type:"text",size:"small",icon:(0,t.jsx)(n.LeftOutlined,{}),onClick:()=>w(!0),className:"absolute top-2 left-2 z-20 !bg-white !border !border-slate-200 !rounded-md","aria-label":"Collapse trace sidebar"}),!N&&(0,t.jsxs)("div",{className:"border-r border-slate-200 bg-slate-50 flex flex-col",style:{width:224},children:[(0,t.jsxs)("div",{className:"pl-12 pr-3 py-2 border-b border-slate-200 bg-white",children:[(0,t.jsx)("div",{className:"flex items-start justify-between gap-2",children:(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"text-[10px] uppercase tracking-wide text-slate-500",children:b?"Session":"Trace"}),(0,t.jsxs)("div",{className:"font-mono text-[12px] text-slate-900 leading-tight flex items-center gap-1",children:[(0,t.jsx)("span",{className:"truncate",children:J}),(0,t.jsx)("button",{type:"button",onClick:Q,className:"text-slate-400 hover:text-slate-600","aria-label":"Copy trace id",children:S?(0,t.jsx)(r.CheckOutlined,{className:"text-[11px]"}):(0,t.jsx)(i.CopyOutlined,{className:"text-[11px]"})})]})]})}),(0,t.jsxs)("div",{className:"mt-1 text-[11px] text-slate-500 font-mono",children:[U.length," req",[b?K:U.filter(e=>!x.MCP_CALL_TYPES.includes(e.call_type)&&!x.AGENT_CALL_TYPES.includes(e.call_type)).length,b?V:U.filter(e=>x.AGENT_CALL_TYPES.includes(e.call_type)).length,b?W:U.filter(e=>x.MCP_CALL_TYPES.includes(e.call_type)).length].map((e,s)=>{let a=[" LLM"," Agent"," MCP"][s];return e>0?(0,t.jsxs)("span",{children:[(0,t.jsx)("span",{className:"mx-1.5",children:"·"}),e,a]},a):null}),(0,t.jsx)("span",{className:"mx-1.5",children:"·"}),b?(0,C.getSpendString)(q):(0,C.getSpendString)(L.spend||0),b&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"mx-1.5",children:"·"}),Y,"s"]})]})]}),(0,t.jsxs)("div",{className:"flex-1 overflow-y-auto",children:[ee(R?.guardrail_information).length>0&&(0,t.jsx)("div",{className:"px-3 pt-2",children:(0,t.jsx)(eJ,{guardrailEntries:ee(R?.guardrail_information)})}),b?(0,t.jsx)("div",{className:"py-1",children:(0,t.jsxs)("div",{className:"relative pl-2",children:[(0,t.jsx)("div",{className:"absolute left-4 top-1 bottom-1 border-l border-slate-300"}),U.map((e,s)=>{let a=s===U.length-1;return(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)("div",{className:"absolute left-4 top-3 w-3 border-t border-slate-300"}),a&&(0,t.jsx)("div",{className:"absolute left-4 top-3 bottom-0 w-px bg-slate-50"}),(0,t.jsx)(e1,{row:e,isSelected:e.request_id===L.request_id,onClick:()=>{_(e.request_id),y?.(e)}})]},e.request_id)})]})}):(0,t.jsx)("div",{className:"py-1",children:U.map(e=>(0,t.jsx)(e1,{row:e,isSelected:e.request_id===L.request_id,onClick:()=>y?.(e)},e.request_id))})]})]}),(0,t.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[(0,t.jsx)(p.DrawerHeader,{log:L,onClose:d,onPrevious:E,onNext:M,statusLabel:P,statusColor:B,environment:F}),(0,t.jsx)("div",{className:"flex-1 overflow-y-auto",children:(0,t.jsx)(eY,{logEntry:z,onOpenSettings:g,isLoadingDetails:O,accessToken:u??null})})]})]})}):null}e.s(["LogDetailsDrawer",()=>e2],502626),e.s([],3565)},95684,e=>{"use strict";var t=e.i(165370);e.s(["Pagination",()=>t.default])},307582,e=>{"use strict";var t=e.i(843476);e.s(["TimeCell",0,({utcTime:e})=>(0,t.jsx)("span",{style:{fontFamily:"monospace",width:"180px",display:"inline-block"},children:(e=>{try{return new Date(e).toLocaleString("en-US",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!0}).replace(",","")}catch(e){return"Error converting time"}})(e)})])},93648,245767,291950,e=>{"use strict";var t=e.i(843476),s=e.i(271645),a=e.i(207082),l=e.i(500330),r=e.i(871943),i=e.i(360820),n=e.i(94629),o=e.i(152990),d=e.i(682830),c=e.i(269200),m=e.i(942232),x=e.i(977572),u=e.i(427612),p=e.i(64848),h=e.i(496020),g=e.i(592968);function f({keys:e,totalCount:a,isLoading:f,isFetching:y,pageIndex:j,pageSize:b,onPageChange:v}){let[_,N]=(0,s.useState)([{id:"deleted_at",desc:!0}]),[w,S]=(0,s.useState)({pageIndex:j,pageSize:b});s.default.useEffect(()=>{S({pageIndex:j,pageSize:b})},[j,b]);let k=[{id:"token",accessorKey:"token",header:"Key ID",size:150,maxSize:250,cell:e=>{let s=e.getValue();return(0,t.jsx)(g.Tooltip,{title:s,children:(0,t.jsx)("span",{className:"font-mono text-blue-500 text-xs truncate block max-w-[250px]",children:s||"-"})})}},{id:"key_alias",accessorKey:"key_alias",header:"Key Alias",size:150,maxSize:200,cell:e=>{let s=e.getValue();return(0,t.jsx)(g.Tooltip,{title:s,children:(0,t.jsx)("span",{className:"font-mono text-xs truncate block max-w-[200px]",children:s??"-"})})}},{id:"team_alias",accessorKey:"team_alias",header:"Team Alias",size:120,maxSize:180,cell:e=>{let s=e.getValue();return(0,t.jsx)("span",{className:"truncate block max-w-[180px]",children:s||"-"})}},{id:"spend",accessorKey:"spend",header:"Spend (USD)",size:100,maxSize:140,cell:e=>(0,t.jsx)("span",{className:"block max-w-[140px]",children:(0,l.formatNumberWithCommas)(e.getValue(),4)})},{id:"max_budget",accessorKey:"max_budget",header:"Budget (USD)",size:110,maxSize:150,cell:e=>{let s=e.getValue();return(0,t.jsx)("span",{className:"block max-w-[150px]",children:null===s?"Unlimited":`$${(0,l.formatNumberWithCommas)(s)}`})}},{id:"user_email",accessorKey:"user_email",header:"User Email",size:160,maxSize:250,cell:e=>{let s=e.getValue();return(0,t.jsx)(g.Tooltip,{title:s,children:(0,t.jsx)("span",{className:"font-mono text-xs truncate block max-w-[250px]",children:s??"-"})})}},{id:"user_id",accessorKey:"user_id",header:"User ID",size:120,maxSize:200,cell:e=>{let s=e.getValue();return(0,t.jsx)(g.Tooltip,{title:s||void 0,children:(0,t.jsx)("span",{className:"truncate block max-w-[200px]",children:s||"-"})})}},{id:"created_at",accessorKey:"created_at",header:"Created At",size:120,maxSize:140,cell:e=>{let s=e.getValue();return(0,t.jsx)("span",{className:"block max-w-[140px]",children:s?new Date(s).toLocaleDateString():"-"})}},{id:"created_by",accessorKey:"created_by",header:"Created By",size:120,maxSize:180,cell:e=>{let s=e.row.original.created_by;return(0,t.jsx)(g.Tooltip,{title:s||void 0,children:(0,t.jsx)("span",{className:"truncate block max-w-[180px]",children:s||"-"})})}},{id:"deleted_at",accessorKey:"deleted_at",header:"Deleted At",size:120,maxSize:140,cell:e=>{let s=e.row.original.deleted_at;return(0,t.jsx)("span",{className:"block max-w-[140px]",children:s?new Date(s).toLocaleDateString():"-"})}},{id:"deleted_by",accessorKey:"deleted_by",header:"Deleted By",size:120,maxSize:180,cell:e=>{let s=e.row.original.deleted_by;return(0,t.jsx)(g.Tooltip,{title:s||void 0,children:(0,t.jsx)("span",{className:"truncate block max-w-[180px]",children:s||"-"})})}}],C=(0,o.useReactTable)({data:e,columns:k,columnResizeMode:"onChange",columnResizeDirection:"ltr",state:{sorting:_,pagination:w},onSortingChange:N,onPaginationChange:e=>{let t="function"==typeof e?e(w):e;S(t),v(t.pageIndex)},getCoreRowModel:(0,d.getCoreRowModel)(),getSortedRowModel:(0,d.getSortedRowModel)(),getPaginationRowModel:(0,d.getPaginationRowModel)(),enableSorting:!0,manualSorting:!1,manualPagination:!0,pageCount:Math.ceil(a/b)}),{pageIndex:T}=C.getState().pagination,L=T*b+1,M=Math.min((T+1)*b,a),E=`${L} - ${M}`;return(0,t.jsx)("div",{className:"w-full h-full overflow-hidden",children:(0,t.jsxs)("div",{className:"border-b py-4 flex-1 overflow-hidden",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between w-full mb-4",children:[f||y?(0,t.jsx)("span",{className:"inline-flex text-sm text-gray-700",children:"Loading..."}):(0,t.jsxs)("span",{className:"inline-flex text-sm text-gray-700",children:["Showing ",E," of ",a," results"]}),(0,t.jsxs)("div",{className:"inline-flex items-center gap-2",children:[f||y?(0,t.jsx)("span",{className:"text-sm text-gray-700",children:"Loading..."}):(0,t.jsxs)("span",{className:"text-sm text-gray-700",children:["Page ",T+1," of ",C.getPageCount()]}),(0,t.jsx)("button",{onClick:()=>C.previousPage(),disabled:f||y||!C.getCanPreviousPage(),className:"px-3 py-1 text-sm border rounded-md hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed",children:"Previous"}),(0,t.jsx)("button",{onClick:()=>C.nextPage(),disabled:f||y||!C.getCanNextPage(),className:"px-3 py-1 text-sm border rounded-md hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed",children:"Next"})]})]}),(0,t.jsx)("div",{className:"h-[75vh] overflow-auto",children:(0,t.jsx)("div",{className:"rounded-lg custom-border relative",children:(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)(c.Table,{className:"[&_td]:py-0.5 [&_th]:py-1",style:{width:C.getCenterTotalSize()},children:[(0,t.jsx)(u.TableHead,{children:C.getHeaderGroups().map(e=>(0,t.jsx)(h.TableRow,{children:e.headers.map(e=>(0,t.jsx)(p.TableHeaderCell,{"data-header-id":e.id,className:"py-1 h-8 relative hover:bg-gray-50",style:{width:e.getSize(),maxWidth:e.column.columnDef.maxSize,position:"relative"},onMouseEnter:()=>{let t=document.querySelector(`[data-header-id="${e.id}"] .resizer`);t&&(t.style.opacity="0.5")},onMouseLeave:()=>{let t=document.querySelector(`[data-header-id="${e.id}"] .resizer`);t&&!e.column.getIsResizing()&&(t.style.opacity="0")},onClick:e.column.getToggleSortingHandler(),children:(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,t.jsx)("div",{className:"flex items-center",children:e.isPlaceholder?null:(0,o.flexRender)(e.column.columnDef.header,e.getContext())}),(0,t.jsx)("div",{className:"w-4",children:e.column.getIsSorted()?({asc:(0,t.jsx)(i.ChevronUpIcon,{className:"h-4 w-4 text-blue-500"}),desc:(0,t.jsx)(r.ChevronDownIcon,{className:"h-4 w-4 text-blue-500"})})[e.column.getIsSorted()]:(0,t.jsx)(n.SwitchVerticalIcon,{className:"h-4 w-4 text-gray-400"})}),(0,t.jsx)("div",{onDoubleClick:()=>e.column.resetSize(),onMouseDown:e.getResizeHandler(),onTouchStart:e.getResizeHandler(),className:`resizer ${C.options.columnResizeDirection} ${e.column.getIsResizing()?"isResizing":""}`,style:{position:"absolute",right:0,top:0,height:"100%",width:"5px",background:e.column.getIsResizing()?"#3b82f6":"transparent",cursor:"col-resize",userSelect:"none",touchAction:"none",opacity:+!!e.column.getIsResizing()}})]})},e.id))},e.id))}),(0,t.jsx)(m.TableBody,{children:f||y?(0,t.jsx)(h.TableRow,{children:(0,t.jsx)(x.TableCell,{colSpan:k.length,className:"h-8 text-center",children:(0,t.jsx)("div",{className:"text-center text-gray-500",children:(0,t.jsx)("p",{children:"🚅 Loading keys..."})})})}):e.length>0?C.getRowModel().rows.map(e=>(0,t.jsx)(h.TableRow,{className:"h-8",children:e.getVisibleCells().map(e=>(0,t.jsx)(x.TableCell,{style:{width:e.column.getSize(),maxWidth:e.column.columnDef.maxSize,whiteSpace:"pre-wrap",overflow:"hidden"},className:"py-0.5 max-h-8 overflow-hidden text-ellipsis whitespace-nowrap",children:(0,o.flexRender)(e.column.columnDef.cell,e.getContext())},e.id))},e.id)):(0,t.jsx)(h.TableRow,{children:(0,t.jsx)(x.TableCell,{colSpan:k.length,className:"h-8 text-center",children:(0,t.jsx)("div",{className:"text-center text-gray-500",children:(0,t.jsx)("p",{children:"No deleted keys found"})})})})})]})})})})]})})}function y(){let[e,l]=(0,s.useState)(0),[r]=(0,s.useState)(50),{data:i,isPending:n,isFetching:o}=(0,a.useDeletedKeys)(e+1,r);return(0,t.jsx)(f,{keys:i?.keys||[],totalCount:i?.total_count||0,isLoading:n,isFetching:o,pageIndex:e,pageSize:r,onPageChange:l})}e.s(["default",()=>y],93648);var j=e.i(785242),b=e.i(389083),v=e.i(599724),_=e.i(355619);function N({teams:e,isLoading:a,isFetching:f}){let[y,j]=(0,s.useState)([{id:"deleted_at",desc:!0}]),N=[{id:"team_alias",accessorKey:"team_alias",header:"Team Name",size:150,maxSize:200,cell:e=>{let s=e.getValue();return(0,t.jsx)(g.Tooltip,{title:s||void 0,children:(0,t.jsx)("span",{className:"truncate block max-w-[200px]",children:s||"-"})})}},{id:"team_id",accessorKey:"team_id",header:"Team ID",size:150,maxSize:250,cell:e=>{let s=e.getValue();return(0,t.jsx)(g.Tooltip,{title:s,children:(0,t.jsx)("span",{className:"font-mono text-blue-500 text-xs truncate block max-w-[250px]",children:s||"-"})})}},{id:"created_at",accessorKey:"created_at",header:"Created",size:120,maxSize:140,cell:e=>{let s=e.getValue();return(0,t.jsx)("span",{className:"block max-w-[140px]",children:s?new Date(s).toLocaleDateString():"-"})}},{id:"spend",accessorKey:"spend",header:"Spend (USD)",size:100,maxSize:140,cell:e=>{let s=e.row.original.spend;return(0,t.jsx)("span",{className:"block max-w-[140px]",children:void 0!==s?(0,l.formatNumberWithCommas)(s,4):"-"})}},{id:"max_budget",accessorKey:"max_budget",header:"Budget (USD)",size:110,maxSize:150,cell:e=>{let s=e.getValue();return(0,t.jsx)("span",{className:"block max-w-[150px]",children:null==s?"No limit":`$${(0,l.formatNumberWithCommas)(s)}`})}},{id:"models",accessorKey:"models",header:"Models",size:200,maxSize:300,cell:e=>{let s=e.getValue();return Array.isArray(s)&&0!==s.length?(0,t.jsxs)("div",{className:"flex flex-wrap gap-1 max-w-[300px]",children:[s.slice(0,3).map((e,s)=>"all-proxy-models"===e?(0,t.jsx)(b.Badge,{size:"xs",color:"red",children:(0,t.jsx)(v.Text,{children:"All Proxy Models"})},s):(0,t.jsx)(b.Badge,{size:"xs",color:"blue",children:(0,t.jsx)(v.Text,{children:e.length>30?`${(0,_.getModelDisplayName)(e).slice(0,30)}...`:(0,_.getModelDisplayName)(e)})},s)),s.length>3&&(0,t.jsx)(b.Badge,{size:"xs",color:"gray",children:(0,t.jsxs)(v.Text,{children:["+",s.length-3," ",s.length-3==1?"more model":"more models"]})})]}):(0,t.jsx)(b.Badge,{size:"xs",color:"red",children:(0,t.jsx)(v.Text,{children:"All Proxy Models"})})}},{id:"organization_id",accessorKey:"organization_id",header:"Organization",size:150,maxSize:200,cell:e=>{let s=e.getValue();return(0,t.jsx)(g.Tooltip,{title:s||void 0,children:(0,t.jsx)("span",{className:"truncate block max-w-[200px]",children:s||"-"})})}},{id:"deleted_at",accessorKey:"deleted_at",header:"Deleted At",size:120,maxSize:140,cell:e=>{let s=e.row.original.deleted_at;return(0,t.jsx)("span",{className:"block max-w-[140px]",children:s?new Date(s).toLocaleDateString():"-"})}},{id:"deleted_by",accessorKey:"deleted_by",header:"Deleted By",size:120,maxSize:180,cell:e=>{let s=e.row.original.deleted_by;return(0,t.jsx)(g.Tooltip,{title:s||void 0,children:(0,t.jsx)("span",{className:"truncate block max-w-[180px]",children:s||"-"})})}}],w=(0,o.useReactTable)({data:e,columns:N,columnResizeMode:"onChange",columnResizeDirection:"ltr",state:{sorting:y},onSortingChange:j,getCoreRowModel:(0,d.getCoreRowModel)(),getSortedRowModel:(0,d.getSortedRowModel)(),enableSorting:!0,manualSorting:!1});return(0,t.jsx)("div",{className:"w-full h-full overflow-hidden",children:(0,t.jsxs)("div",{className:"border-b py-4 flex-1 overflow-hidden",children:[(0,t.jsx)("div",{className:"flex items-center justify-between w-full mb-4",children:a||f?(0,t.jsx)("span",{className:"inline-flex text-sm text-gray-700",children:"Loading..."}):(0,t.jsxs)("span",{className:"inline-flex text-sm text-gray-700",children:["Showing ",e.length," ",1===e.length?"team":"teams"]})}),(0,t.jsx)("div",{className:"h-[75vh] overflow-auto",children:(0,t.jsx)("div",{className:"rounded-lg custom-border relative",children:(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)(c.Table,{className:"[&_td]:py-0.5 [&_th]:py-1",style:{width:w.getCenterTotalSize()},children:[(0,t.jsx)(u.TableHead,{children:w.getHeaderGroups().map(e=>(0,t.jsx)(h.TableRow,{children:e.headers.map(e=>(0,t.jsx)(p.TableHeaderCell,{"data-header-id":e.id,className:"py-1 h-8 relative hover:bg-gray-50",style:{width:e.getSize(),maxWidth:e.column.columnDef.maxSize,position:"relative"},onMouseEnter:()=>{let t=document.querySelector(`[data-header-id="${e.id}"] .resizer`);t&&(t.style.opacity="0.5")},onMouseLeave:()=>{let t=document.querySelector(`[data-header-id="${e.id}"] .resizer`);t&&!e.column.getIsResizing()&&(t.style.opacity="0")},onClick:e.column.getToggleSortingHandler(),children:(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,t.jsx)("div",{className:"flex items-center",children:e.isPlaceholder?null:(0,o.flexRender)(e.column.columnDef.header,e.getContext())}),(0,t.jsx)("div",{className:"w-4",children:e.column.getIsSorted()?({asc:(0,t.jsx)(i.ChevronUpIcon,{className:"h-4 w-4 text-blue-500"}),desc:(0,t.jsx)(r.ChevronDownIcon,{className:"h-4 w-4 text-blue-500"})})[e.column.getIsSorted()]:(0,t.jsx)(n.SwitchVerticalIcon,{className:"h-4 w-4 text-gray-400"})}),(0,t.jsx)("div",{onDoubleClick:()=>e.column.resetSize(),onMouseDown:e.getResizeHandler(),onTouchStart:e.getResizeHandler(),className:`resizer ${w.options.columnResizeDirection} ${e.column.getIsResizing()?"isResizing":""}`,style:{position:"absolute",right:0,top:0,height:"100%",width:"5px",background:e.column.getIsResizing()?"#3b82f6":"transparent",cursor:"col-resize",userSelect:"none",touchAction:"none",opacity:+!!e.column.getIsResizing()}})]})},e.id))},e.id))}),(0,t.jsx)(m.TableBody,{children:a||f?(0,t.jsx)(h.TableRow,{children:(0,t.jsx)(x.TableCell,{colSpan:N.length,className:"h-8 text-center",children:(0,t.jsx)("div",{className:"text-center text-gray-500",children:(0,t.jsx)("p",{children:"🚅 Loading teams..."})})})}):e.length>0?w.getRowModel().rows.map(e=>(0,t.jsx)(h.TableRow,{className:"h-8",children:e.getVisibleCells().map(e=>(0,t.jsx)(x.TableCell,{style:{width:e.column.getSize(),maxWidth:e.column.columnDef.maxSize,whiteSpace:"pre-wrap",overflow:"hidden"},className:"py-0.5 max-h-8 overflow-hidden text-ellipsis whitespace-nowrap",children:(0,o.flexRender)(e.column.columnDef.cell,e.getContext())},e.id))},e.id)):(0,t.jsx)(h.TableRow,{children:(0,t.jsx)(x.TableCell,{colSpan:N.length,className:"h-8 text-center",children:(0,t.jsx)("div",{className:"text-center text-gray-500",children:(0,t.jsx)("p",{children:"No deleted teams found"})})})})})]})})})})]})})}function w(){let{data:e,isPending:s,isFetching:a}=(0,j.useDeletedTeams)(1,100);return(0,t.jsx)(N,{teams:e||[],isLoading:s,isFetching:a})}e.s(["default",()=>w],245767);var S=e.i(625901),k=e.i(56456),C=e.i(152473),T=e.i(199133),L=e.i(770914);let{Text:M}=e.i(898586).Typography;e.s(["PaginatedModelSelect",0,({value:e,onChange:a,placeholder:l="Select a model",style:r,pageSize:i=50,allowClear:n=!0,disabled:o=!1})=>{let[d,c]=(0,s.useState)(""),[m,x]=(0,C.useDebouncedState)("",{wait:300}),{data:u,fetchNextPage:p,hasNextPage:h,isFetchingNextPage:g,isLoading:f}=(0,S.useInfiniteModelInfo)(i,m||void 0),y=(0,s.useMemo)(()=>{if(!u?.pages)return[];let e=new Set,t=[];for(let s of u.pages)for(let a of s.data){let s=a.model_info?.id??"",l=a.model_name??"";!s||e.has(s)||(e.add(s),t.push({label:l?`${l} (${s})`:s,value:s,modelName:l,modelId:s}))}return t},[u]);return(0,t.jsx)(T.Select,{value:e||void 0,onChange:e=>{let t="string"==typeof e?e:Array.isArray(e)?e[0]??"":"";a?.(t)},placeholder:l,style:{width:"100%",...r},allowClear:n,disabled:o,showSearch:!0,filterOption:!1,onSearch:e=>{c(e),x(e)},searchValue:d,onPopupScroll:e=>{let t=e.currentTarget;(t.scrollTop+t.clientHeight)/t.scrollHeight>=.8&&h&&!g&&p()},loading:f,notFoundContent:f?(0,t.jsx)(k.LoadingOutlined,{spin:!0}):"No models found",options:y,optionRender:e=>{let{modelName:s,modelId:a}=e.data;return(0,t.jsx)(t.Fragment,{children:s?(0,t.jsxs)(L.Space,{direction:"vertical",children:[(0,t.jsxs)(L.Space,{direction:"horizontal",children:[(0,t.jsx)(M,{strong:!0,children:"Model name:"}),(0,t.jsx)(M,{ellipsis:!0,children:s})]}),(0,t.jsxs)(M,{ellipsis:!0,type:"secondary",children:["Model ID: ",a]})]}):(0,t.jsxs)(M,{ellipsis:!0,type:"secondary",children:["Model ID: ",a]})})},popupRender:e=>(0,t.jsxs)(t.Fragment,{children:[e,g&&(0,t.jsx)("div",{style:{textAlign:"center",padding:8},children:(0,t.jsx)(k.LoadingOutlined,{spin:!0})})]})})}],291950)},942161,e=>{"use strict";var t=e.i(843476),s=e.i(271645),a=e.i(266027),l=e.i(619273),r=e.i(291542),i=e.i(262218),n=e.i(311451),o=e.i(199133),d=e.i(464571),c=e.i(95684),m=e.i(482725),x=e.i(91979),u=e.i(56456),p=e.i(166540),h=e.i(764205),g=e.i(608856),f=e.i(898586),y=e.i(149192),j=e.i(166406),b=e.i(492030),v=e.i(304911);let{Text:_}=f.Typography,N={LiteLLM_VerificationToken:"Keys",LiteLLM_TeamTable:"Teams",LiteLLM_UserTable:"Users",LiteLLM_OrganizationTable:"Organizations",LiteLLM_ProxyModelTable:"Models"},w={created:"green",updated:"blue",deleted:"red",rotated:"orange"};function S({label:e,value:a}){let[l,r]=(0,s.useState)(!1),i=(0,s.useCallback)(async()=>{try{let e=JSON.stringify(a,null,2);if(navigator.clipboard&&window.isSecureContext)await navigator.clipboard.writeText(e);else{let t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.focus(),t.select(),document.execCommand("copy"),document.body.removeChild(t)}r(!0),setTimeout(()=>r(!1),2e3)}catch(e){console.error("Copy failed:",e)}},[a]);return(0,t.jsxs)("div",{className:"bg-white rounded border overflow-hidden",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center px-3 py-2 border-b bg-gray-50",children:[(0,t.jsx)("span",{className:"text-xs font-semibold text-gray-600",children:e}),(0,t.jsx)("button",{onClick:i,className:"p-1 hover:bg-gray-200 rounded text-gray-500 hover:text-gray-700 transition-colors",title:"Copy JSON",children:l?(0,t.jsx)(b.CheckOutlined,{className:"text-green-600"}):(0,t.jsx)(j.CopyOutlined,{})})]}),(0,t.jsx)("pre",{className:"p-3 bg-white text-xs font-mono overflow-auto max-h-96 whitespace-pre-wrap break-all m-0",children:JSON.stringify(a,null,2)})]})}function k({label:e,value:s}){return(0,t.jsxs)("div",{className:"flex items-start gap-2 py-1.5",children:[(0,t.jsx)("span",{className:"text-xs text-gray-500 w-36 shrink-0",children:e}),(0,t.jsx)("span",{className:"text-xs text-gray-900 break-all",children:s})]})}function C({log:e}){let{action:s,table_name:a,before_value:l,updated_values:r}=e,i="LiteLLM_VerificationToken"===a,n="updated"===s||"rotated"===s,o=l,d=r;if(n&&l&&r){let e={},t={};new Set([...Object.keys(l),...Object.keys(r)]).forEach(s=>{JSON.stringify(l[s])!==JSON.stringify(r[s])&&(s in l&&(e[s]=l[s]),s in r&&(t[s]=r[s]))}),Object.keys(l).forEach(s=>{s in r||s in e||(e[s]=l[s],t[s]=void 0)}),Object.keys(r).forEach(s=>{s in l||s in t||(t[s]=r[s],e[s]=void 0)}),o=Object.keys(e).length>0?e:{note:"No differing fields detected"},d=Object.keys(t).length>0?t:{note:"No differing fields detected"}}let c=(e,s)=>{if(!s||0===Object.keys(s).length)return(0,t.jsxs)("div",{className:"bg-white rounded border overflow-hidden",children:[(0,t.jsx)("div",{className:"flex items-center px-3 py-2 border-b bg-gray-50",children:(0,t.jsx)("span",{className:"text-xs font-semibold text-gray-600",children:e})}),(0,t.jsx)("p",{className:"px-3 py-3 text-xs text-gray-400 italic m-0",children:"N/A"})]});if(i&&n){let a=["token","spend","max_budget"];if(Object.keys(s).every(e=>a.includes(e))&&!("note"in s))return(0,t.jsxs)("div",{className:"bg-white rounded border overflow-hidden",children:[(0,t.jsx)("div",{className:"flex items-center px-3 py-2 border-b bg-gray-50",children:(0,t.jsx)("span",{className:"text-xs font-semibold text-gray-600",children:e})}),(0,t.jsxs)("div",{className:"px-3 py-3 space-y-1 text-xs",children:[void 0!==s.token&&(0,t.jsxs)("p",{children:[(0,t.jsx)("span",{className:"text-gray-500",children:"Token:"})," ",s.token??"N/A"]}),void 0!==s.spend&&(0,t.jsxs)("p",{children:[(0,t.jsx)("span",{className:"text-gray-500",children:"Spend:"})," $",Number(s.spend).toFixed(6)]}),void 0!==s.max_budget&&(0,t.jsxs)("p",{children:[(0,t.jsx)("span",{className:"text-gray-500",children:"Max Budget:"})," $",Number(s.max_budget).toFixed(6)]})]})]})}return(0,t.jsx)(S,{label:e,value:s})};return(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mt-4",children:[c("Before",o),c("After",d)]})}function T({open:e,onClose:s,log:a}){if(!a)return null;let l=N[a.table_name]??a.table_name,r=w[a.action]??"default";return(0,t.jsxs)(g.Drawer,{placement:"right",width:"60%",open:e,onClose:s,closable:!1,mask:!0,maskClosable:!0,styles:{body:{padding:0,display:"flex",flexDirection:"column"},header:{display:"none"}},children:[(0,t.jsxs)("div",{className:"flex items-center justify-between px-6 py-4 border-b bg-white shrink-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)(i.Tag,{color:r,className:"capitalize m-0",children:a.action}),(0,t.jsx)("span",{className:"text-sm text-gray-500",children:p.default.utc(a.updated_at).local().format("MMM D, YYYY HH:mm:ss")})]}),(0,t.jsx)("button",{onClick:s,className:"w-8 h-8 flex items-center justify-center rounded hover:bg-gray-100 text-gray-500","aria-label":"Close",children:(0,t.jsx)(y.CloseOutlined,{})})]}),(0,t.jsxs)("div",{className:"px-6 py-5",children:[(0,t.jsxs)("div",{className:"bg-gray-50 border rounded-lg p-4 mb-5",children:[(0,t.jsx)("p",{className:"text-xs font-semibold text-gray-700 mb-2 uppercase tracking-wide",children:"Details"}),(0,t.jsx)(k,{label:"Table",value:l}),(0,t.jsx)(k,{label:"Object ID",value:(0,t.jsx)(_,{copyable:!0,className:"font-mono text-xs",children:a.object_id})}),(0,t.jsx)(k,{label:"Changed By",value:(0,t.jsx)(v.default,{userId:a.changed_by})}),(0,t.jsx)(k,{label:"API Key (Hash)",value:a.changed_by_api_key?(0,t.jsx)(_,{copyable:!0,className:"font-mono text-xs break-all",children:a.changed_by_api_key}):"—"})]}),(0,t.jsx)(C,{log:a})]})]})}let{Search:L}=n.Input,M={LiteLLM_VerificationToken:"Keys",LiteLLM_TeamTable:"Teams",LiteLLM_UserTable:"Users",LiteLLM_OrganizationTable:"Organizations",LiteLLM_ProxyModelTable:"Models"},E={created:"green",updated:"blue",deleted:"red",rotated:"orange"};function A({userID:e,userRole:n,token:g,accessToken:f,isActive:y,premiumUser:j}){let[b,_]=(0,s.useState)(1),[N,w]=(0,s.useState)(""),[S,k]=(0,s.useState)(""),[C,A]=(0,s.useState)(""),[D,I]=(0,s.useState)(""),[O,z]=(0,s.useState)(void 0),[R,P]=(0,s.useState)(void 0),[B,F]=(0,s.useState)(null),[q,H]=(0,s.useState)(!1),$=(0,a.useQuery)({queryKey:["audit_logs",b,50,N,S,C,D,O,R],queryFn:async()=>f&&g&&n&&e?(0,h.uiAuditLogsCall)({accessToken:f,page:b,page_size:50,params:{object_id:N||void 0,changed_by:S||void 0,object_key_hash:C||void 0,object_team_id:D||void 0,action:O||void 0,table_name:R||void 0,sort_by:"updated_at",sort_order:"desc"}}):{audit_logs:[],total:0,page:1,page_size:50,total_pages:0},enabled:!!f&&!!g&&!!n&&!!e&&y,placeholderData:l.keepPreviousData}),Y=[{title:"Timestamp",dataIndex:"updated_at",key:"updated_at",width:200,render:e=>(0,t.jsx)("span",{className:"font-mono text-xs whitespace-nowrap",children:p.default.utc(e).local().format("MMM D, YYYY HH:mm:ss")})},{title:"Action",dataIndex:"action",key:"action",width:100,render:e=>(0,t.jsx)(i.Tag,{color:E[e]??"default",className:"capitalize",children:e})},{title:"Table",dataIndex:"table_name",key:"table_name",width:130,render:e=>M[e]??e},{title:"Object ID",dataIndex:"object_id",key:"object_id",render:e=>(0,t.jsx)("span",{className:"font-mono text-xs",children:e})},{title:"Changed By",dataIndex:"changed_by",key:"changed_by",width:200,render:e=>(0,t.jsx)(v.default,{userId:e})},{title:"API Key (Hash)",dataIndex:"changed_by_api_key",key:"changed_by_api_key",width:140,render:e=>e?(0,t.jsxs)("span",{className:"font-mono text-xs",children:[e.slice(0,12),"…"]}):"—"}];if(!j)return(0,t.jsxs)("div",{style:{textAlign:"center",marginTop:"20px"},children:[(0,t.jsx)("h1",{style:{display:"block",marginBottom:"10px"},children:"✨ Enterprise Feature."}),(0,t.jsx)("p",{style:{display:"block",marginBottom:"10px"},children:"This is a LiteLLM Enterprise feature, and requires a valid key to use."}),(0,t.jsx)("p",{style:{display:"block",marginBottom:"20px",fontStyle:"italic"},children:"Here's a preview of what Audit Logs offer:"}),(0,t.jsx)("img",{src:"../ui/assets/audit-logs-preview.png",alt:"Audit Logs Preview",style:{maxWidth:"100%",maxHeight:"700px",borderRadius:"8px",boxShadow:"0 4px 8px rgba(0,0,0,0.1)",margin:"0 auto"},onError:e=>{e.target.style.display="none"}})]});let K=$.data?.audit_logs??[],V=$.data?.total??0;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow",children:[(0,t.jsxs)("div",{className:"border-b px-6 py-4",children:[(0,t.jsx)("div",{className:"flex items-center justify-between mb-4",children:(0,t.jsx)("h1",{className:"text-xl font-semibold",children:"Audit Logs"})}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,t.jsx)(L,{placeholder:"Object ID",allowClear:!0,style:{width:200},onSearch:e=>{w(e),_(1)},onChange:e=>{e.target.value||(w(""),_(1))}}),(0,t.jsx)(L,{placeholder:"Changed By",allowClear:!0,style:{width:180},onSearch:e=>{k(e),_(1)},onChange:e=>{e.target.value||(k(""),_(1))}}),(0,t.jsx)(L,{placeholder:"Team ID",allowClear:!0,style:{width:180},onSearch:e=>{I(e),_(1)},onChange:e=>{e.target.value||(I(""),_(1))}}),(0,t.jsx)(L,{placeholder:"Key Hash",allowClear:!0,style:{width:180},onSearch:e=>{A(e),_(1)},onChange:e=>{e.target.value||(A(""),_(1))}}),(0,t.jsx)(o.Select,{placeholder:"All Actions",allowClear:!0,style:{width:140},options:[{label:"Created",value:"created"},{label:"Updated",value:"updated"},{label:"Deleted",value:"deleted"},{label:"Rotated",value:"rotated"}],onChange:e=>{z(e),_(1)}}),(0,t.jsx)(o.Select,{placeholder:"All Tables",allowClear:!0,style:{width:150},options:[{label:"Keys",value:"LiteLLM_VerificationToken"},{label:"Teams",value:"LiteLLM_TeamTable"},{label:"Users",value:"LiteLLM_UserTable"},{label:"Organizations",value:"LiteLLM_OrganizationTable"},{label:"Models",value:"LiteLLM_ProxyModelTable"}],onChange:e=>{P(e),_(1)}}),(0,t.jsxs)("div",{className:"ml-auto flex items-center gap-2",children:[(0,t.jsx)(d.Button,{icon:(0,t.jsx)(x.ReloadOutlined,{spin:$.isFetching}),onClick:()=>$.refetch(),disabled:$.isFetching}),(0,t.jsx)(c.Pagination,{current:b,pageSize:50,total:V,showTotal:e=>`${e} total`,showSizeChanger:!1,size:"small",onChange:e=>_(e)})]})]})]}),(0,t.jsx)(r.Table,{columns:Y,dataSource:K,rowKey:"id",loading:{spinning:$.isLoading,indicator:(0,t.jsx)(m.Spin,{indicator:(0,t.jsx)(u.LoadingOutlined,{spin:!0}),size:"small"})},size:"small",pagination:!1,onRow:e=>({onClick:()=>{F(e),H(!0)},style:{cursor:"pointer"}})})]}),(0,t.jsx)(T,{open:q,onClose:()=>H(!1),log:B})]})}e.s(["default",()=>A],942161)},245099,e=>{"use strict";var t=e.i(843476),s=e.i(500330),a=(e.i(389083),e.i(994388)),l=e.i(592968);e.i(271645);var r=e.i(916925),i=e.i(446891),n=e.i(307582),o=e.i(97859);let d=({size:e=12})=>(0,t.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"flex-shrink-0 text-gray-400",children:(0,t.jsx)("path",{d:"M12 3l1.912 5.813a2 2 0 0 0 1.275 1.275L21 12l-5.813 1.912a2 2 0 0 0-1.275 1.275L12 21l-1.912-5.813a2 2 0 0 0-1.275-1.275L3 12l5.813-1.912a2 2 0 0 0 1.275-1.275L12 3z"})}),c=({size:e=10})=>(0,t.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"flex-shrink-0",children:(0,t.jsx)("path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"})}),m=({size:e=12})=>(0,t.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"flex-shrink-0",children:[(0,t.jsx)("path",{d:"M12 8V4H8"}),(0,t.jsx)("rect",{width:"16",height:"12",x:"4",y:"8",rx:"2"}),(0,t.jsx)("path",{d:"M2 14h2"}),(0,t.jsx)("path",{d:"M20 14h2"}),(0,t.jsx)("path",{d:"M15 13v2"}),(0,t.jsx)("path",{d:"M9 13v2"})]}),x=({count:e})=>(0,t.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 bg-blue-50 text-blue-700 border border-blue-200 rounded-full text-[11px] font-medium whitespace-nowrap",children:[(0,t.jsx)(d,{}),null!=e?e:"LLM"]}),u=({count:e})=>(0,t.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 bg-amber-50 text-amber-700 border border-amber-200 rounded-full text-[11px] font-medium whitespace-nowrap",children:[(0,t.jsx)(c,{}),null!=e?e:"MCP"]}),p=({count:e})=>(0,t.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 bg-violet-50 text-violet-700 border border-violet-200 rounded-full text-[11px] font-medium whitespace-nowrap",children:[(0,t.jsx)(m,{}),null!=e?e:"Agent"]}),h=({label:e,field:s,sortBy:a,sortOrder:l,onSortChange:r})=>(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsx)("span",{children:e}),(0,t.jsx)(i.TableHeaderSortDropdown,{sortState:a===s&&l,onSortChange:e=>{!1===e?r("startTime","desc"):r(s,e)}})]}),g=e=>[{header:e?()=>(0,t.jsx)(h,{label:"Time",field:"startTime",sortBy:e.sortBy,sortOrder:e.sortOrder,onSortChange:e.onSortChange}):"Time",accessorKey:"startTime",cell:e=>(0,t.jsx)(n.TimeCell,{utcTime:e.getValue()})},{header:"Type",id:"type",cell:e=>{let s=e.row.original,a=s.session_total_count||1,r=o.MCP_CALL_TYPES.includes(s.call_type),i=o.AGENT_CALL_TYPES.includes(s.call_type),n=s.session_llm_count??(r||i?0:a),h=s.session_agent_count??(i?a:0),g=s.session_mcp_count??(r?a:0);if(r)return(0,t.jsx)(u,{});if(i&&a<=1)return(0,t.jsx)(p,{});if(a<=1)return(0,t.jsx)(x,{});let f=(0,t.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 bg-blue-50 text-blue-700 border border-blue-200 rounded-full text-[11px] font-medium whitespace-nowrap",children:[(0,t.jsx)(d,{}),(0,t.jsx)("span",{children:a}),h>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"text-blue-300",children:"·"}),(0,t.jsx)(m,{size:10})]}),g>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"text-blue-300",children:"·"}),(0,t.jsx)(c,{})]})]}),y=[n>0&&`${n} LLM`,h>0&&`${h} Agent`,g>0&&`${g} MCP`].filter(Boolean);return(0,t.jsx)(l.Tooltip,{title:y.join(" • "),children:f})}},{header:"Status",accessorKey:"metadata.status",cell:e=>{let s="failure"!==(e.getValue()||"Success").toLowerCase();return(0,t.jsx)("span",{className:`px-2 py-1 rounded-md text-xs font-medium inline-block text-center w-16 ${s?"bg-green-100 text-green-800":"bg-red-100 text-red-800"}`,children:s?"Success":"Failure"})}},{header:"Session ID",accessorKey:"session_id",cell:e=>{let s=String(e.getValue()||""),r=e.row.original.onSessionClick;return(0,t.jsx)(l.Tooltip,{title:String(e.getValue()||""),children:(0,t.jsx)(a.Button,{size:"xs",variant:"light",className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal text-xs max-w-[15ch] truncate block",onClick:()=>r?.(s),children:String(e.getValue()||"")})})}},{header:"Request ID",accessorKey:"request_id",cell:e=>(0,t.jsx)(l.Tooltip,{title:String(e.getValue()||""),children:(0,t.jsx)("span",{className:"font-mono text-xs max-w-[15ch] truncate block",children:String(e.getValue()||"")})})},{header:e?()=>(0,t.jsx)(h,{label:"Cost",field:"spend",sortBy:e.sortBy,sortOrder:e.sortOrder,onSortChange:e.onSortChange}):"Cost",accessorKey:"spend",cell:e=>{let a=e.row.original,r=a.mcp_tool_call_count||0,i=a.mcp_tool_call_spend||0;return(0,t.jsxs)("div",{className:"flex flex-col",children:[(0,t.jsx)(l.Tooltip,{title:`$${String(e.getValue()||0)}`,children:(0,t.jsx)("span",{children:(0,s.getSpendString)(e.getValue()||0)})}),r>0&&i>0&&(0,t.jsxs)("span",{className:"text-[10px] text-amber-600",children:["incl. ",(0,s.getSpendString)(i)," from ",r," MCP"]})]})}},{header:e?()=>(0,t.jsx)(h,{label:"Duration (s)",field:"request_duration_ms",sortBy:e.sortBy,sortOrder:e.sortOrder,onSortChange:e.onSortChange}):"Duration (s)",accessorKey:"request_duration_ms",cell:e=>{let s=e.getValue();if(null==s)return(0,t.jsx)("span",{children:"-"});let a=(s/1e3).toFixed(2);return(0,t.jsx)(l.Tooltip,{title:`${s}ms`,children:(0,t.jsx)("span",{className:"max-w-[15ch] truncate block",children:a})})}},{header:"TTFT (s)",accessorKey:"completionStartTime",cell:e=>{let s=e.row.original,a=e.getValue();if(!a||a===s.endTime)return(0,t.jsx)("span",{children:"-"});let r=new Date(a).getTime()-new Date(s.startTime).getTime();if(r<=0)return(0,t.jsx)("span",{children:"-"});let i=(r/1e3).toFixed(2);return(0,t.jsx)(l.Tooltip,{title:`${r}ms`,children:(0,t.jsx)("span",{className:"max-w-[15ch] truncate block",children:i})})}},{header:"Team Name",accessorKey:"metadata.user_api_key_team_alias",cell:e=>(0,t.jsx)(l.Tooltip,{title:String(e.getValue()||"-"),children:(0,t.jsx)("span",{className:"max-w-[15ch] truncate block",children:String(e.getValue()||"-")})})},{header:"Key Hash",accessorKey:"metadata.user_api_key",cell:e=>{let s=String(e.getValue()||"-"),a=e.row.original.onKeyHashClick;return(0,t.jsx)(l.Tooltip,{title:s,children:(0,t.jsx)("span",{className:"font-mono max-w-[15ch] truncate block cursor-pointer hover:text-blue-600",onClick:()=>a?.(s),children:s})})}},{header:"Key Name",accessorKey:"metadata.user_api_key_alias",cell:e=>(0,t.jsx)(l.Tooltip,{title:String(e.getValue()||"-"),children:(0,t.jsx)("span",{className:"max-w-[15ch] truncate block",children:String(e.getValue()||"-")})})},{header:"Model",accessorKey:"model",cell:e=>{let s=e.row.original,a=s.custom_llm_provider,i=String(e.getValue()||"");return(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[a&&(0,t.jsx)("img",{src:s.metadata?.mcp_tool_call_metadata?.mcp_server_logo_url?s.metadata.mcp_tool_call_metadata.mcp_server_logo_url:a?(0,r.getProviderLogoAndName)(a).logo:"",alt:"",className:"w-4 h-4",onError:e=>{e.target.style.display="none"}}),(0,t.jsx)(l.Tooltip,{title:i,children:(0,t.jsx)("span",{className:"max-w-[15ch] truncate block",children:i})})]})}},{header:e?()=>(0,t.jsx)(h,{label:"Tokens",field:"total_tokens",sortBy:e.sortBy,sortOrder:e.sortOrder,onSortChange:e.onSortChange}):"Tokens",accessorKey:"total_tokens",cell:e=>{let s=e.row.original;return(0,t.jsxs)("span",{className:"text-sm",children:[String(s.total_tokens||"0"),(0,t.jsxs)("span",{className:"text-gray-400 text-xs ml-1",children:["(",String(s.prompt_tokens||"0"),"+",String(s.completion_tokens||"0"),")"]})]})}},{header:"Internal User",accessorKey:"user",cell:e=>(0,t.jsx)(l.Tooltip,{title:String(e.getValue()||"-"),children:(0,t.jsx)("span",{className:"max-w-[15ch] truncate block",children:String(e.getValue()||"-")})})},{header:"End User",accessorKey:"end_user",cell:e=>(0,t.jsx)(l.Tooltip,{title:String(e.getValue()||"-"),children:(0,t.jsx)("span",{className:"max-w-[15ch] truncate block",children:String(e.getValue()||"-")})})},{header:"Tags",accessorKey:"request_tags",cell:e=>{let s=e.getValue();if(!s||0===Object.keys(s).length)return"-";let a=Object.entries(s),r=a[0],i=a.slice(1);return(0,t.jsx)("div",{className:"flex flex-wrap gap-1",children:(0,t.jsx)(l.Tooltip,{title:(0,t.jsx)("div",{className:"flex flex-col gap-1",children:a.map(([e,s])=>(0,t.jsxs)("span",{children:[e,": ",String(s)]},e))}),children:(0,t.jsxs)("span",{className:"px-2 py-1 bg-gray-100 rounded-full text-xs",children:[r[0],": ",String(r[1]),i.length>0&&` +${i.length}`]})})})}}];g(),e.s(["createColumns",0,g],245099)},339086,504809,e=>{"use strict";e.i(843476);var t=e.i(271645);e.s([],339086);var s=e.i(166540),a=e.i(764205),l=e.i(266027),r=e.i(633627),i=e.i(374009),n=e.i(700514);let o="Team ID",d="Key Hash",c="Request ID",m="Model",x="User ID",u="End User",p="Status",h="Key Alias",g="Error Code",f="Error Message";function y({logs:e,accessToken:y,startTime:j,endTime:b,pageSize:v=n.defaultPageSize,isCustomDate:_,setCurrentPage:N,userID:w,userRole:S,sortBy:k="startTime",sortOrder:C="desc",currentPage:T=1}){let L=(0,t.useMemo)(()=>({[o]:"",[d]:"",[c]:"",[m]:"",[x]:"",[u]:"",[p]:"",[h]:"",[g]:"",[f]:""}),[]),[M,E]=(0,t.useState)(L),[A,D]=(0,t.useState)({data:[],total:0,page:1,page_size:50,total_pages:0}),I=(0,t.useRef)(0),O=(0,t.useCallback)(async(e,t=1)=>{if(!y)return;console.log("Filters being sent to API:",e);let l=Date.now();I.current=l;let r=(0,s.default)(j).utc().format("YYYY-MM-DD HH:mm:ss"),i=_?(0,s.default)(b).utc().format("YYYY-MM-DD HH:mm:ss"):(0,s.default)().utc().format("YYYY-MM-DD HH:mm:ss");try{let s=await (0,a.uiSpendLogsCall)({accessToken:y,start_date:r,end_date:i,page:t,page_size:v,params:{api_key:e[d]||void 0,team_id:e[o]||void 0,request_id:e[c]||void 0,user_id:e[x]||void 0,end_user:e[u]||void 0,status_filter:e[p]||void 0,model_id:e[m]||void 0,key_alias:e[h]||void 0,error_code:e[g]||void 0,error_message:e[f]||void 0,sort_by:k,sort_order:C}});l===I.current&&s.data&&D(s)}catch(e){console.error("Error searching users:",e)}},[y,j,b,_,v,k,C]),z=(0,t.useMemo)(()=>(0,i.default)((e,t)=>O(e,t),300),[O]);(0,t.useEffect)(()=>()=>z.cancel(),[z]);let R=(0,t.useMemo)(()=>!!(M[h]||M[d]||M[c]||M[x]||M[u]||M[g]||M[f]||M[m]),[M]);(0,t.useEffect)(()=>{R&&y&&(z.cancel(),O(M,T))},[k,C,T,j,b,_]);let P=(0,t.useMemo)(()=>{if(!e||!e.data)return{data:[],total:0,page:1,page_size:50,total_pages:0};if(R)return e;let t=[...e.data];return M[o]&&(t=t.filter(e=>e.team_id===M[o])),M[p]&&(t=t.filter(e=>"success"===M[p]?!e.status||"success"===e.status:e.status===M[p])),M[m]&&(t=t.filter(e=>e.model_id===M[m])),M[d]&&(t=t.filter(e=>e.api_key===M[d])),M[u]&&(t=t.filter(e=>e.end_user===M[u])),M[g]&&(t=t.filter(e=>{let t=(e.metadata||{}).error_information;return t&&t.error_code===M[g]})),{data:t,total:e.total,page:e.page,page_size:e.page_size,total_pages:e.total_pages}},[e,M,R]),B=(0,t.useMemo)(()=>R?A&&A.data&&A.data.length>0?A:e||{data:[],total:0,page:1,page_size:50,total_pages:0}:P,[R,A,P,e]),{data:F}=(0,l.useQuery)({queryKey:["allTeamsForLogFilters",y],queryFn:async()=>y&&await (0,r.fetchAllTeams)(y)||[],enabled:!!y});return{filters:M,filteredLogs:B,hasBackendFilters:R,allTeams:F,handleFilterChange:e=>{E(t=>{let s={...t,...e};for(let e of Object.keys(L))e in s||(s[e]=L[e]);return JSON.stringify(s)!==JSON.stringify(t)&&(N(1),z(s,1)),s})},handleFilterReset:()=>{E(L),D({data:[],total:0,page:1,page_size:50,total_pages:0}),z(L,1)}}}e.s(["useLogFilterLogic",()=>y],504809)},936190,e=>{"use strict";var t=e.i(843476),s=e.i(619273),a=e.i(266027),l=e.i(912598),r=e.i(166540),i=e.i(271645);e.i(517442),e.i(500330),e.i(122550);var n=e.i(313603),o=e.i(772345),d=e.i(793130),c=e.i(197647),m=e.i(653824),x=e.i(881073),u=e.i(404206),p=e.i(723731),h=e.i(464571),g=e.i(708347),f=e.i(93648),y=e.i(245767),j=e.i(50882),b=e.i(291950),v=e.i(969550),_=e.i(764205),N=e.i(20147),w=e.i(942161),S=e.i(245099);e.i(70969);var k=e.i(97859);e.i(70635),e.i(339086);var C=e.i(504809);e.i(3565);var T=e.i(502626),L=e.i(727749);e.i(867612);var M=e.i(153472),E=e.i(954616),A=e.i(135214);let D=async(e,t)=>{let s=(0,_.getProxyBaseUrl)(),a=s?`${s}/config/update`:"/config/update",l=await fetch(a,{method:"POST",headers:{[(0,_.getGlobalLitellmHeaderName)()]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({general_settings:{store_prompts_in_spend_logs:t.store_prompts_in_spend_logs,...t.maximum_spend_logs_retention_period&&{maximum_spend_logs_retention_period:t.maximum_spend_logs_retention_period}}})});if(!l.ok){let e=await l.json().catch(()=>({}));throw Error(e?.error?.message||e?.message||e?.detail||"Failed to update spend logs settings")}return await l.json()};var I=e.i(190702),O=e.i(637235),z=e.i(808613),R=e.i(311451),P=e.i(212931),B=e.i(981339),F=e.i(770914),q=e.i(790848),H=e.i(898586);let $=({isVisible:e,onCancel:s,onSuccess:a})=>{let[l]=z.Form.useForm(),{mutateAsync:r,isPending:n}=(()=>{let{accessToken:e}=(0,A.default)();return(0,E.useMutation)({mutationFn:async t=>{if(!e)throw Error("Access token is required");return await D(e,t)}})})(),{mutateAsync:o,isPending:d}=(0,M.useDeleteProxyConfigField)(),{data:c,isLoading:m,refetch:x}=(0,M.useProxyConfig)(M.ConfigType.GENERAL_SETTINGS),u=z.Form.useWatch("store_prompts_in_spend_logs",l);(0,i.useEffect)(()=>{e&&x()},[e,x]);let p=(0,i.useMemo)(()=>{if(!c)return{store_prompts_in_spend_logs:!1,maximum_spend_logs_retention_period:void 0};let e=c.find(e=>"store_prompts_in_spend_logs"===e.field_name),t=c.find(e=>"maximum_spend_logs_retention_period"===e.field_name);return{store_prompts_in_spend_logs:e?.field_value??!1,maximum_spend_logs_retention_period:t?.field_value??void 0}},[c]),g=async e=>{try{let t=e.maximum_spend_logs_retention_period;if(!t||"string"==typeof t&&""===t.trim())try{await o({config_type:M.ConfigType.GENERAL_SETTINGS,field_name:M.GeneralSettingsFieldName.MAXIMUM_SPEND_LOGS_RETENTION_PERIOD})}catch(e){console.warn("Failed to delete retention period field (may not exist):",e)}let s={store_prompts_in_spend_logs:e.store_prompts_in_spend_logs,...t&&"string"==typeof t&&""!==t.trim()&&{maximum_spend_logs_retention_period:t}};await r(s,{onSuccess:()=>{L.default.success("Spend logs settings updated successfully"),x(),a?.()},onError:e=>{L.default.fromBackend("Failed to save spend logs settings: "+(0,I.parseErrorMessage)(e))}})}catch(e){L.default.fromBackend("Failed to save spend logs settings: "+(0,I.parseErrorMessage)(e))}},f=()=>{l.resetFields(),s()};return(0,t.jsx)(P.Modal,{title:(0,t.jsx)(H.Typography.Title,{level:5,children:"Spend Logs Settings"}),open:e,footer:(0,t.jsxs)(F.Space,{children:[(0,t.jsx)(h.Button,{onClick:f,disabled:n||d||m,children:"Cancel"}),(0,t.jsx)(h.Button,{type:"primary",loading:n||d,disabled:m,onClick:()=>l.submit(),children:n||d?"Saving...":"Save Settings"})]}),onCancel:f,children:(0,t.jsxs)(z.Form,{form:l,layout:"horizontal",onFinish:g,initialValues:p,children:[(0,t.jsx)(z.Form.Item,{label:"Store Prompts in Spend Logs",name:"store_prompts_in_spend_logs",tooltip:c?.find(e=>"store_prompts_in_spend_logs"===e.field_name)?.field_description||"When enabled, prompts will be stored in spend logs for tracking and analysis purposes.",valuePropName:"checked",children:(0,t.jsx)("div",{children:m?(0,t.jsx)(B.Skeleton.Input,{active:!0,block:!0}):(0,t.jsx)(q.Switch,{checked:u??!1,onChange:e=>l.setFieldValue("store_prompts_in_spend_logs",e)})})}),(0,t.jsx)(z.Form.Item,{label:"Maximum Spend Logs Retention Period (Optional)",name:"maximum_spend_logs_retention_period",tooltip:c?.find(e=>"maximum_spend_logs_retention_period"===e.field_name)?.field_description||"Set the maximum retention period for spend logs (e.g., '7d' for 7 days, '30d' for 30 days). Leave empty for no limit.",children:m?(0,t.jsx)(B.Skeleton.Input,{active:!0,block:!0}):(0,t.jsx)(R.Input,{placeholder:"e.g., 7d, 30d",prefix:(0,t.jsx)(O.ClockCircleOutlined,{})})})]},c?JSON.stringify(p):"loading")})};var Y=e.i(149121);function K({accessToken:e,token:L,userRole:M,userID:E,allTeams:A,premiumUser:D}){let[I,O]=(0,i.useState)(""),[z,R]=(0,i.useState)(!1),[P,B]=(0,i.useState)(!1),[F,q]=(0,i.useState)(1),[H]=(0,i.useState)(50),K=(0,i.useRef)(null),V=(0,i.useRef)(null),W=(0,i.useRef)(null),[U,G]=(0,i.useState)((0,r.default)().subtract(24,"hours").format("YYYY-MM-DDTHH:mm")),[J,Q]=(0,i.useState)((0,r.default)().format("YYYY-MM-DDTHH:mm")),[X,Z]=(0,i.useState)(!1),[ee,et]=(0,i.useState)(!1),[es,ea]=(0,i.useState)(""),[el,er]=(0,i.useState)(""),[ei,en]=(0,i.useState)(""),[eo,ed]=(0,i.useState)(""),[ec,em]=(0,i.useState)(""),[ex,eu]=(0,i.useState)(null),[ep,eh]=(0,i.useState)(null),[eg,ef]=(0,i.useState)(""),[ey,ej]=(0,i.useState)(""),[eb,ev]=(0,i.useState)(M&&g.internalUserRoles.includes(M)),[e_,eN]=(0,i.useState)("request logs"),[ew,eS]=(0,i.useState)(null),[ek,eC]=(0,i.useState)(!1),[eT,eL]=(0,i.useState)(null),[eM,eE]=(0,i.useState)(!1),[eA,eD]=(0,i.useState)("startTime"),[eI,eO]=(0,i.useState)("desc"),[ez,eR]=(0,i.useState)(!0);(0,l.useQueryClient)();let[eP,eB]=(0,i.useState)(()=>{let e=sessionStorage.getItem("isLiveTail");return null===e||JSON.parse(e)});(0,i.useEffect)(()=>{sessionStorage.setItem("isLiveTail",JSON.stringify(eP))},[eP]);let[eF,eq]=(0,i.useState)({value:24,unit:"hours"});(0,i.useEffect)(()=>{(async()=>{ep&&e&&eu({...(await (0,_.keyInfoV1Call)(e,ep)).info,token:ep,api_key:ep})})()},[ep,e]),(0,i.useEffect)(()=>{function e(e){K.current&&!K.current.contains(e.target)&&B(!1),V.current&&!V.current.contains(e.target)&&R(!1),W.current&&!W.current.contains(e.target)&&et(!1)}return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]),(0,i.useEffect)(()=>{M&&g.internalUserRoles.includes(M)&&ev(!0)},[M]);let eH=(0,a.useQuery)({queryKey:["logs","table",F,H,U,J,ei,eo,eb?E:null,eg,ec,eA,eI],queryFn:async()=>{if(!e||!L||!M||!E)return{data:[],total:0,page:1,page_size:H,total_pages:0};let t=(0,r.default)(U).utc().format("YYYY-MM-DD HH:mm:ss"),s=X?(0,r.default)(J).utc().format("YYYY-MM-DD HH:mm:ss"):(0,r.default)().utc().format("YYYY-MM-DD HH:mm:ss");return await (0,_.uiSpendLogsCall)({accessToken:e,start_date:t,end_date:s,page:F,page_size:H,params:{api_key:eo||void 0,team_id:ei||void 0,user_id:eb?E??void 0:void 0,end_user:ey||void 0,status_filter:eg||void 0,model_id:ec||void 0,sort_by:eA,sort_order:eI}})},enabled:!!e&&!!L&&!!M&&!!E&&"request logs"===e_&&ez,refetchInterval:!!eP&&1===F&&15e3,placeholderData:s.keepPreviousData,refetchIntervalInBackground:!0}),e$=(0,i.useDeferredValue)(eH.isFetching),eY=eH.isFetching||e$,eK=eH.data||{data:[],total:0,page:1,page_size:H||10,total_pages:1},{filters:eV,filteredLogs:eW,hasBackendFilters:eU,allTeams:eG,handleFilterChange:eJ,handleFilterReset:eQ}=(0,C.useLogFilterLogic)({logs:eK,accessToken:e,startTime:U,endTime:J,pageSize:H,isCustomDate:X,setCurrentPage:q,userID:E,userRole:M,sortBy:eA,sortOrder:eI,currentPage:F}),eX=(0,i.useCallback)(()=>{eQ(),G((0,r.default)().subtract(24,"hours").format("YYYY-MM-DDTHH:mm")),Q((0,r.default)().format("YYYY-MM-DDTHH:mm")),Z(!1),eq({value:24,unit:"hours"}),q(1)},[eQ]);if((0,i.useEffect)(()=>{eR(!eU)},[eU]),(0,i.useEffect)(()=>{e&&(eV["Team ID"]?en(eV["Team ID"]):en(""),ef(eV.Status||""),em(eV.Model||""),ej(eV["End User"]||""),ed(eV["Key Hash"]||""))},[eV,e]),!e||!L||!M||!E)return null;let eZ=eW.data.filter(e=>!I||e.request_id.includes(I)||e.model.includes(I)||e.user&&e.user.includes(I)),e0=eZ.reduce((e,t)=>(t.session_id&&(e[t.session_id]||(e[t.session_id]={llm:0,agent:0,mcp:0}),k.MCP_CALL_TYPES.includes(t.call_type)?e[t.session_id].mcp+=1:k.AGENT_CALL_TYPES.includes(t.call_type)?e[t.session_id].agent+=1:e[t.session_id].llm+=1),e),{}),e1=new Map;for(let e of eZ){if(!e.session_id||1>=(e.session_total_count||1))continue;let t=k.MCP_CALL_TYPES.includes(e.call_type),s=e1.get(e.session_id);s&&(!s.isMcp||t)||e1.set(e.session_id,{requestId:e.request_id,isMcp:t})}let e2=eZ.map(e=>{let t=e.session_id?e0[e.session_id]:void 0;return{...e,request_duration_ms:e.request_duration_ms,session_llm_count:t?.llm??void 0,session_mcp_count:t?.mcp??void 0,session_agent_count:t?.agent??void 0,onKeyHashClick:e=>eh(e),onSessionClick:t=>{t&&(eL(t),eS(e),eC(!0))}}}).filter(e=>!e.session_id||1>=(e.session_total_count||1)||e1.get(e.session_id)?.requestId===e.request_id)||[],e5=[{name:"Team ID",label:"Team ID",isSearchable:!0,searchFn:async e=>A&&0!==A.length?A.filter(t=>t.team_id.toLowerCase().includes(e.toLowerCase())||t.team_alias&&t.team_alias.toLowerCase().includes(e.toLowerCase())).map(e=>({label:`${e.team_alias||e.team_id} (${e.team_id})`,value:e.team_id})):[]},{name:"Status",label:"Status",isSearchable:!1,options:[{label:"Success",value:"success"},{label:"Failure",value:"failure"}]},{name:"Model",label:"Model",customComponent:b.PaginatedModelSelect},{name:"Key Alias",label:"Key Alias",customComponent:j.PaginatedKeyAliasSelect},{name:"End User",label:"End User",isSearchable:!0,searchFn:async t=>{if(!e)return[];let s=await (0,_.allEndUsersCall)(e);return(s?.map(e=>e.user_id)||[]).filter(e=>e.toLowerCase().includes(t.toLowerCase())).map(e=>({label:e,value:e}))}},{name:"Error Code",label:"Error Code",isSearchable:!0,searchFn:async e=>{if(!e)return k.ERROR_CODE_OPTIONS;let t=e.toLowerCase(),s=k.ERROR_CODE_OPTIONS.filter(e=>e.label.toLowerCase().includes(t));return!k.ERROR_CODE_OPTIONS.some(t=>t.value===e.trim())&&e.trim()&&s.push({label:`Use custom code: ${e.trim()}`,value:e.trim()}),s}},{name:"Key Hash",label:"Key Hash",isSearchable:!1},{name:"Error Message",label:"Error Message",isSearchable:!1}],e4=k.QUICK_SELECT_OPTIONS.find(e=>e.value===eF.value&&e.unit===eF.unit),e6=X?((e,t,s)=>{if(e)return`${(0,r.default)(t).format("MMM D, h:mm A")} - ${(0,r.default)(s).format("MMM D, h:mm A")}`;let a=(0,r.default)(),l=(0,r.default)(t),i=a.diff(l,"minutes");if(i>=0&&i<2)return"Last 1 Minute";if(i>=2&&i<16)return"Last 15 Minutes";if(i>=16&&i<61)return"Last Hour";let n=a.diff(l,"hours");return n>=1&&n<5?"Last 4 Hours":n>=5&&n<25?"Last 24 Hours":n>=25&&n<169?"Last 7 Days":`${l.format("MMM D")} - ${a.format("MMM D")}`})(X,U,J):e4?.label;return(0,t.jsxs)("div",{className:"w-full max-w-screen p-6 overflow-x-hidden box-border",children:[(0,t.jsxs)(m.TabGroup,{defaultIndex:0,onIndexChange:e=>eN(0===e?"request logs":"audit logs"),children:[(0,t.jsxs)(x.TabList,{children:[(0,t.jsx)(c.Tab,{children:"Request Logs"}),(0,t.jsx)(c.Tab,{children:"Audit Logs"}),(0,t.jsx)(c.Tab,{children:"Deleted Keys"}),(0,t.jsx)(c.Tab,{children:"Deleted Teams"})]}),(0,t.jsxs)(p.TabPanels,{children:[(0,t.jsxs)(u.TabPanel,{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,t.jsx)("h1",{className:"text-xl font-semibold",children:"Request Logs"}),(0,t.jsx)(h.Button,{icon:(0,t.jsx)(n.SettingOutlined,{}),onClick:()=>eE(!0),title:"Spend Logs Settings"})]}),ex&&ep&&ex.api_key===ep?(0,t.jsx)(N.default,{keyId:ep,keyData:ex,teams:A,onClose:()=>eh(null),backButtonText:"Back to Logs"}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(v.default,{options:e5,onApplyFilters:eJ,onResetFilters:eX}),(0,t.jsx)($,{isVisible:eM,onCancel:()=>eE(!1),onSuccess:()=>eE(!1)}),(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow w-full max-w-full box-border",children:[(0,t.jsx)("div",{className:"border-b px-6 py-4 w-full max-w-full box-border",children:(0,t.jsxs)("div",{className:"flex flex-col md:flex-row items-start md:items-center justify-between space-y-4 md:space-y-0 w-full max-w-full box-border",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-3 w-full max-w-full box-border",children:[(0,t.jsxs)("div",{className:"relative w-64 min-w-0 flex-shrink-0",children:[(0,t.jsx)("input",{type:"text",placeholder:"Search by Request 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:I,onChange:e=>O(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)("div",{className:"flex items-center gap-2 min-w-0 flex-shrink",children:[(0,t.jsxs)("div",{className:"relative z-50",ref:W,children:[(0,t.jsxs)("button",{onClick:()=>et(!ee),className:"px-3 py-2 text-sm border rounded-md hover:bg-gray-50 flex items-center gap-2",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:"M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"})}),e6]}),ee&&(0,t.jsx)("div",{className:"absolute right-0 mt-2 w-64 bg-white rounded-lg shadow-lg border p-2 z-50",children:(0,t.jsxs)("div",{className:"space-y-1",children:[k.QUICK_SELECT_OPTIONS.map(e=>(0,t.jsx)("button",{className:`w-full px-3 py-2 text-left text-sm hover:bg-gray-50 rounded-md ${e6===e.label?"bg-blue-50 text-blue-600":""}`,onClick:()=>{q(1),Q((0,r.default)().format("YYYY-MM-DDTHH:mm")),G((0,r.default)().subtract(e.value,e.unit).format("YYYY-MM-DDTHH:mm")),eq({value:e.value,unit:e.unit}),Z(!1),et(!1)},children:e.label},e.label)),(0,t.jsx)("div",{className:"border-t my-2"}),(0,t.jsx)("button",{className:`w-full px-3 py-2 text-left text-sm hover:bg-gray-50 rounded-md ${X?"bg-blue-50 text-blue-600":""}`,onClick:()=>Z(!X),children:"Custom Range"})]})})]}),(0,t.jsx)(()=>(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"text-sm font-medium text-gray-900",children:"Live Tail"}),(0,t.jsx)(d.Switch,{color:"green",checked:eP,defaultChecked:!0,onChange:eB})]}),{}),(0,t.jsx)(h.Button,{type:"default",icon:(0,t.jsx)(o.SyncOutlined,{spin:eY}),onClick:()=>{eH.refetch()},disabled:eY,title:"Fetch data",children:eY?"Fetching":"Fetch"})]}),X&&(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{children:(0,t.jsx)("input",{type:"datetime-local",value:U,onChange:e=>{G(e.target.value),q(1)},className:"px-3 py-2 border rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"})}),(0,t.jsx)("span",{className:"text-gray-500",children:"to"}),(0,t.jsx)("div",{children:(0,t.jsx)("input",{type:"datetime-local",value:J,onChange:e=>{Q(e.target.value),q(1)},className:"px-3 py-2 border rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"})})]})]}),(0,t.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,t.jsxs)("span",{className:"text-sm text-gray-700 whitespace-nowrap",children:["Showing ",eH.isLoading?"...":eW?(F-1)*H+1:0," -"," ",eH.isLoading?"...":eW?Math.min(F*H,eW.total):0," ","of ",eH.isLoading?"...":eW?eW.total:0," results"]}),(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsxs)("span",{className:"text-sm text-gray-700 min-w-[90px]",children:["Page ",eH.isLoading?"...":F," of"," ",eH.isLoading?"...":eW?eW.total_pages:1]}),(0,t.jsx)("button",{onClick:()=>q(e=>Math.max(1,e-1)),disabled:eH.isLoading||1===F,className:"px-3 py-1 text-sm border rounded-md hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed",children:"Previous"}),(0,t.jsx)("button",{onClick:()=>q(e=>Math.min(eW.total_pages||1,e+1)),disabled:eH.isLoading||F===(eW.total_pages||1),className:"px-3 py-1 text-sm border rounded-md hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed",children:"Next"})]})]})]})}),eP&&1===F&&ez&&(0,t.jsxs)("div",{className:"mb-4 px-4 py-2 bg-green-50 border border-greem-200 rounded-md flex items-center justify-between",children:[(0,t.jsx)("div",{className:"flex items-center gap-2",children:(0,t.jsx)("span",{className:"text-sm text-green-700",children:"Auto-refreshing every 15 seconds"})}),(0,t.jsx)("button",{onClick:()=>eB(!1),className:"text-sm text-green-600 hover:text-green-800",children:"Stop"})]}),(0,t.jsx)(Y.DataTable,{columns:(0,S.createColumns)({sortBy:eA,sortOrder:eI,onSortChange:(e,t)=>{eD(e),eO(t),q(1)}}),data:e2,onRowClick:e=>{if(e.session_id&&(e.session_total_count||1)>1){eL(e.session_id),eS(e),eC(!0);return}eL(null),eS(e),eC(!0)},isLoading:eH.isLoading})]})]})]}),(0,t.jsx)(u.TabPanel,{children:(0,t.jsx)(w.default,{userID:E,userRole:M,token:L,accessToken:e,isActive:"audit logs"===e_,premiumUser:D})}),(0,t.jsx)(u.TabPanel,{children:(0,t.jsx)(f.default,{})}),(0,t.jsx)(u.TabPanel,{children:(0,t.jsx)(y.default,{})})]})]}),(0,t.jsx)(T.LogDetailsDrawer,{open:ek,onClose:()=>{eC(!1),eL(null)},logEntry:ew,sessionId:eT,accessToken:e,onOpenSettings:()=>eE(!0),allLogs:e2,onSelectLog:e=>{eS(e)},startTime:(0,r.default)(U).utc().format("YYYY-MM-DD HH:mm:ss")})]})}e.i(331052),e.s(["default",()=>K],936190)}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/0eda6dc5d5f35d92.js b/litellm/proxy/_experimental/out/_next/static/chunks/0eda6dc5d5f35d92.js deleted file mode 100644 index 19122cffa20..00000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/0eda6dc5d5f35d92.js +++ /dev/null @@ -1,10 +0,0 @@ -(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,161059,147612,e=>{"use strict";var t=e.i(843476),l=e.i(764205),s=e.i(266027),a=e.i(243652),r=e.i(135214);let i=(0,a.createQueryKeys)("credentials"),o=()=>{let{accessToken:e}=(0,r.default)();return(0,s.useQuery)({queryKey:i.list({}),queryFn:async()=>await (0,l.credentialListCall)(e),enabled:!!e})};var n=e.i(368670),d=e.i(625901),c=e.i(292639),m=e.i(785242),u=e.i(152990),h=e.i(682830),x=e.i(271645),p=e.i(269200),g=e.i(427612),f=e.i(64848),j=e.i(942232),_=e.i(496020),y=e.i(977572),b=e.i(446891);function v({data:e=[],columns:l,isLoading:s=!1,sorting:a=[],onSortingChange:r,pagination:i,onPaginationChange:o,enablePagination:n=!1}){let[d]=x.default.useState("onChange"),[c,m]=x.default.useState({}),[v,N]=x.default.useState({}),w=(0,u.useReactTable)({data:e,columns:l,state:{sorting:a,columnSizing:c,columnVisibility:v,...n&&i?{pagination:i}:{}},columnResizeMode:d,onSortingChange:r,onColumnSizingChange:m,onColumnVisibilityChange:N,...n&&o?{onPaginationChange:o}:{},getCoreRowModel:(0,h.getCoreRowModel)(),...n?{getPaginationRowModel:(0,h.getPaginationRowModel)()}:{},enableSorting:!0,enableColumnResizing:!0,manualSorting:!0,defaultColumn:{minSize:40,maxSize:500}});return(0,t.jsx)("div",{className:"rounded-lg custom-border relative",children:(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsx)("div",{className:"relative min-w-full",children:(0,t.jsxs)(p.Table,{className:"[&_td]:py-2 [&_th]:py-2",style:{width:w.getTotalSize(),minWidth:"100%",tableLayout:"fixed"},children:[(0,t.jsx)(g.TableHead,{children:w.getHeaderGroups().map(e=>(0,t.jsx)(_.TableRow,{children:e.headers.map(e=>(0,t.jsxs)(f.TableHeaderCell,{className:`py-1 h-8 relative ${"actions"===e.id?"sticky right-0 bg-white shadow-[-4px_0_8px_-6px_rgba(0,0,0,0.1)] w-[120px] ml-8":""} ${e.column.columnDef.meta?.className||""}`,style:{width:"actions"===e.id?120:e.getSize(),position:"actions"===e.id?"sticky":"relative",right:"actions"===e.id?0:"auto"},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,u.flexRender)(e.column.columnDef.header,e.getContext())}),"actions"!==e.id&&e.column.getCanSort()&&r&&(0,t.jsx)(b.TableHeaderSortDropdown,{sortState:!1!==e.column.getIsSorted()&&e.column.getIsSorted(),onSortChange:t=>{!1===t?r([]):r([{id:e.column.id,desc:"desc"===t}])},columnId:e.column.id})]}),e.column.getCanResize()&&(0,t.jsx)("div",{onMouseDown:e.getResizeHandler(),onTouchStart:e.getResizeHandler(),className:`absolute right-0 top-0 h-full w-2 cursor-col-resize select-none touch-none ${e.column.getIsResizing()?"bg-blue-500":"hover:bg-blue-200"}`})]},e.id))},e.id))}),(0,t.jsx)(j.TableBody,{children:s?(0,t.jsx)(_.TableRow,{children:(0,t.jsx)(y.TableCell,{colSpan:l.length,className:"h-8 text-center",children:(0,t.jsx)("div",{className:"text-center text-gray-500",children:(0,t.jsx)("p",{children:"🚅 Loading models..."})})})}):w.getRowModel().rows.length>0?w.getRowModel().rows.map(e=>(0,t.jsx)(_.TableRow,{children:e.getVisibleCells().map(e=>(0,t.jsx)(y.TableCell,{className:`py-0.5 overflow-hidden ${"actions"===e.column.id?"sticky right-0 bg-white shadow-[-4px_0_8px_-6px_rgba(0,0,0,0.1)] w-[120px] ml-8":""} ${e.column.columnDef.meta?.className||""}`,style:{width:"actions"===e.column.id?120:e.column.getSize(),position:"actions"===e.column.id?"sticky":"relative",right:"actions"===e.column.id?0:"auto"},children:(0,u.flexRender)(e.column.columnDef.cell,e.getContext())},e.id))},e.id)):(0,t.jsx)(_.TableRow,{children:(0,t.jsx)(y.TableCell,{colSpan:l.length,className:"h-8 text-center",children:(0,t.jsx)("div",{className:"text-center text-gray-500",children:(0,t.jsx)("p",{children:"No models found"})})})})})]})})})})}var N=e.i(751904),w=e.i(827252),C=e.i(772345),S=e.i(68155),k=e.i(389083),T=e.i(994388),F=e.i(752978),I=e.i(312361),P=e.i(525720),M=e.i(282786),A=e.i(770914),E=e.i(592968),L=e.i(898586),R=e.i(418371);let{Text:O,Title:B}=L.Typography,z=(0,t.jsxs)(A.Space,{direction:"vertical",size:12,children:[(0,t.jsx)(O,{strong:!0,style:{fontSize:13},children:"Credential types"}),(0,t.jsxs)(A.Space,{direction:"vertical",size:8,children:[(0,t.jsx)(P.Flex,{align:"center",gap:8,children:(0,t.jsxs)(A.Space,{direction:"vertical",children:[(0,t.jsxs)(P.Flex,{align:"center",gap:8,children:[(0,t.jsx)(C.SyncOutlined,{style:{color:"#1890ff"}}),(0,t.jsx)(B,{level:5,style:{margin:0,color:"#1890ff"},children:"Reusable"})]}),(0,t.jsx)(O,{type:"secondary",children:"Credentials saved in LiteLLM that can be added to models repeatedly."})]})}),(0,t.jsx)(I.Divider,{size:"small"}),(0,t.jsx)(P.Flex,{align:"center",gap:8,children:(0,t.jsxs)(A.Space,{direction:"vertical",size:8,children:[(0,t.jsxs)(P.Flex,{align:"center",gap:8,children:[(0,t.jsx)(N.EditOutlined,{style:{color:"#8c8c8c",fontSize:14,flexShrink:0}}),(0,t.jsx)(B,{level:5,style:{margin:0},children:"Manual"})]}),(0,t.jsx)(O,{type:"secondary",children:"Credentials added directly during model creation or defined in the config file."})]})})]})]}),q=e=>e?.model_info?.team_public_model_name?e.model_info.team_public_model_name:e?.model_name||"-";var V=e.i(313603),D=e.i(350967),H=e.i(404206),$=e.i(906579),G=e.i(464571),U=e.i(199133),J=e.i(981339),K=e.i(153472),W=e.i(954616);let Q=async(e,t)=>{let s=(0,l.getProxyBaseUrl)(),a=s?`${s}/config/field/update`:"/config/field/update",r=await fetch(a,{method:"POST",headers:{[(0,l.getGlobalLitellmHeaderName)()]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({field_name:"store_model_in_db",field_value:t.store_model_in_db,config_type:"general_settings"})});if(!r.ok){let e=await r.json().catch(()=>({}));throw Error(e?.error?.message||e?.message||e?.detail||"Failed to update model storage settings")}return await r.json()};var Y=e.i(727749),X=e.i(190702),Z=e.i(808613),ee=e.i(212931),et=e.i(790848);let el=({isVisible:e,onCancel:l,onSuccess:s})=>{let[a]=Z.Form.useForm(),{mutateAsync:i,isPending:o}=(()=>{let{accessToken:e}=(0,r.default)();return(0,W.useMutation)({mutationFn:async t=>{if(!e)throw Error("Access token is required");return await Q(e,t)}})})(),{data:n,isLoading:d,refetch:c}=(0,K.useProxyConfig)(K.ConfigType.GENERAL_SETTINGS);(0,x.useEffect)(()=>{e&&c()},[e,c]);let m=(0,x.useMemo)(()=>{if(!n)return{store_model_in_db:!1};let e=n.find(e=>"store_model_in_db"===e.field_name);return{store_model_in_db:e?.field_value??!1}},[n]),u=async e=>{try{await i(e,{onSuccess:()=>{Y.default.success("Model storage settings updated successfully"),c(),s?.()},onError:e=>{Y.default.fromBackend("Failed to save model storage settings: "+(0,X.parseErrorMessage)(e))}})}catch(e){Y.default.fromBackend("Failed to save model storage settings: "+(0,X.parseErrorMessage)(e))}},h=()=>{a.resetFields(),l()};return(0,t.jsx)(ee.Modal,{title:(0,t.jsx)(L.Typography.Title,{level:5,children:"Model Settings"}),open:e,footer:(0,t.jsxs)(A.Space,{children:[(0,t.jsx)(G.Button,{onClick:h,disabled:o||d,children:"Cancel"}),(0,t.jsx)(G.Button,{type:"primary",loading:o,disabled:d,onClick:()=>a.submit(),children:o?"Saving...":"Save Settings"})]}),onCancel:h,children:(0,t.jsx)(Z.Form,{form:a,layout:"horizontal",onFinish:u,initialValues:m,children:(0,t.jsx)(Z.Form.Item,{label:"Store Model in DB",name:"store_model_in_db",tooltip:n?.find(e=>"store_model_in_db"===e.field_name)?.field_description||"If enabled, models and config are stored in and loaded from the database.",valuePropName:"checked",children:d?(0,t.jsx)(J.Skeleton.Input,{active:!0,block:!0}):(0,t.jsx)(et.Switch,{})})},n?JSON.stringify(m):"loading")})};var es=e.i(374009);let ea=(e,t)=>{if(!e?.data)return{data:[]};let l=JSON.parse(JSON.stringify(e.data));for(let e=0;e"model"!==e&&"api_base"!==e))),l[e].provider=o,l[e].input_cost=n,l[e].output_cost=d,l[e].litellm_model_name=a,null!=l[e].input_cost&&(l[e].input_cost=(1e6*Number(l[e].input_cost)).toFixed(2)),null!=l[e].output_cost&&(l[e].output_cost=(1e6*Number(l[e].output_cost)).toFixed(2)),l[e].max_tokens=c,l[e].max_input_tokens=m,l[e].api_base=s?.litellm_params?.api_base,l[e].cleanedLitellmParams=u}return{data:l}},{Text:er}=L.Typography,ei=({selectedModelGroup:e,setSelectedModelGroup:l,availableModelGroups:s,availableModelAccessGroups:a,setSelectedModelId:i,setSelectedTeamId:o})=>{let{data:c,isLoading:u}=(0,n.useModelCostMap)(),{userId:h,userRole:p,premiumUser:g}=(0,r.default)(),{data:f,isLoading:j}=(0,m.useTeams)(),[_,y]=(0,x.useState)(""),[b,I]=(0,x.useState)(""),[L,B]=(0,x.useState)("current_team"),[K,W]=(0,x.useState)("personal"),[Q,Y]=(0,x.useState)(!1),[X,Z]=(0,x.useState)(null),[ee,et]=(0,x.useState)(new Set),[ei,eo]=(0,x.useState)(1),[en]=(0,x.useState)(50),[ed,ec]=(0,x.useState)({pageIndex:0,pageSize:50}),[em,eu]=(0,x.useState)([]),[eh,ex]=(0,x.useState)(!1),ep=(0,x.useMemo)(()=>(0,es.default)(e=>{I(e),eo(1),ec(e=>({...e,pageIndex:0}))},200),[]);(0,x.useEffect)(()=>(ep(_),()=>{ep.cancel()}),[_,ep]);let eg="personal"===K?void 0:K.team_id,ef=(0,x.useMemo)(()=>{if(0===em.length)return;let e=em[0];return({input_cost:"costs",model_info_db_model:"status",model_info_created_by:"created_at",model_info_updated_at:"updated_at"})[e.id]||e.id},[em]),ej=(0,x.useMemo)(()=>{if(0!==em.length)return em[0].desc?"desc":"asc"},[em]),{data:e_,isLoading:ey}=(0,d.useModelsInfo)(ei,en,b||void 0,void 0,eg,ef,ej),eb=ey||u,ev=e=>null!=c&&"object"==typeof c&&e in c?c[e].litellm_provider:"openai",eN=(0,x.useMemo)(()=>e_?ea(e_,ev):{data:[]},[e_,c]),ew=(0,x.useMemo)(()=>e_?{total_count:e_.total_count??0,current_page:e_.current_page??1,total_pages:e_.total_pages??1,size:e_.size??en}:{total_count:0,current_page:1,total_pages:1,size:en},[e_,en]),eC=(0,x.useMemo)(()=>eN&&eN.data&&0!==eN.data.length?eN.data.filter(t=>{let l="all"===e||t.model_name===e||!e||"wildcard"===e&&t.model_name?.includes("*"),s="all"===X||t.model_info.access_groups?.includes(X)||!X;return l&&s}):[],[eN,e,X]);return(0,x.useEffect)(()=>{ec(e=>({...e,pageIndex:0})),eo(1)},[e,X]),(0,x.useEffect)(()=>{eo(1),ec(e=>({...e,pageIndex:0}))},[eg]),(0,x.useEffect)(()=>{eo(1),ec(e=>({...e,pageIndex:0}))},[em]),(0,t.jsxs)(H.TabPanel,{children:[(0,t.jsx)(D.Grid,{children:(0,t.jsx)("div",{className:"flex flex-col space-y-4",children:(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow",children:[(0,t.jsxs)("div",{className:"border-b px-6 py-4 bg-gray-50",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex items-center gap-4",children:[(0,t.jsx)(er,{className:"text-lg font-semibold text-gray-900",children:"Current Team:"}),(0,t.jsx)("div",{className:"w-80",children:eb?(0,t.jsx)(J.Skeleton.Input,{active:!0,block:!0,size:"large"}):(0,t.jsx)(U.Select,{style:{width:"100%"},size:"large",defaultValue:"personal",value:"personal"===K?"personal":K.team_id,onChange:e=>{if("personal"===e)W("personal"),eo(1),ec(e=>({...e,pageIndex:0}));else{let t=f?.find(t=>t.team_id===e);t&&(W(t),eo(1),ec(e=>({...e,pageIndex:0})))}},loading:j,options:[{value:"personal",label:(0,t.jsxs)(A.Space,{direction:"horizontal",align:"center",children:[(0,t.jsx)($.Badge,{color:"blue",size:"small"}),(0,t.jsx)(er,{style:{fontSize:16},children:"Personal"})]})},...f?.filter(e=>e.team_id).map(e=>({value:e.team_id,label:(0,t.jsxs)(A.Space,{direction:"horizontal",align:"center",children:[(0,t.jsx)($.Badge,{color:"green",size:"small"}),(0,t.jsx)(er,{ellipsis:!0,style:{fontSize:16},children:e.team_alias?e.team_alias:e.team_id})]})}))??[]]})})]}),(0,t.jsxs)("div",{className:"flex items-center gap-4",children:[(0,t.jsx)(er,{className:"text-lg font-semibold text-gray-900",children:"View:"}),(0,t.jsx)("div",{className:"w-64",children:eb?(0,t.jsx)(J.Skeleton.Input,{active:!0,block:!0,size:"large"}):(0,t.jsx)(U.Select,{style:{width:"100%"},size:"large",defaultValue:"current_team",value:L,onChange:e=>B(e),options:[{value:"current_team",label:(0,t.jsxs)(A.Space,{direction:"horizontal",align:"center",children:[(0,t.jsx)($.Badge,{color:"purple",size:"small"}),(0,t.jsx)(er,{style:{fontSize:16},children:"Current Team Models"})]})},{value:"all",label:(0,t.jsxs)(A.Space,{direction:"horizontal",align:"center",children:[(0,t.jsx)($.Badge,{color:"gray",size:"small"}),(0,t.jsx)(er,{style:{fontSize:16},children:"All Available Models"})]})}]})})]})]}),"current_team"===L&&(0,t.jsxs)("div",{className:"flex items-start gap-2 mt-3",children:[(0,t.jsx)(w.InfoCircleOutlined,{className:"text-gray-400 mt-0.5 flex-shrink-0 text-xs"}),(0,t.jsx)("div",{className:"text-xs text-gray-500",children:"personal"===K?(0,t.jsxs)("span",{children:["To access these models: Create a Virtual Key without selecting a team on the"," ",(0,t.jsx)("a",{href:"/public?login=success&page=api-keys",className:"text-gray-600 hover:text-gray-800 underline",children:"Virtual Keys page"})]}):(0,t.jsxs)("span",{children:['To access these models: Create a Virtual Key and select Team as "',"string"!=typeof K?K.team_alias||K.team_id:"",'" on the'," ",(0,t.jsx)("a",{href:"/public?login=success&page=api-keys",className:"text-gray-600 hover:text-gray-800 underline",children:"Virtual Keys page"})]})})]})]}),(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 items-center justify-between gap-3",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 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:_,onChange:e=>y(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 ${Q?"bg-gray-100":""}`,onClick:()=>Y(!Q),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"]}),(0,t.jsxs)("button",{className:"px-3 py-2 text-sm border rounded-md hover:bg-gray-50 flex items-center gap-2",onClick:()=>{y(""),l("all"),Z(null),W("personal"),B("current_team"),eo(1),ec({pageIndex:0,pageSize:50}),eu([])},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"]})]}),(0,t.jsx)(G.Button,{icon:(0,t.jsx)(V.SettingOutlined,{}),onClick:()=>ex(!0),title:"Model Settings"})]}),Q&&(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-3 mt-3",children:[(0,t.jsx)("div",{className:"w-64",children:(0,t.jsx)(U.Select,{className:"w-full",value:e??"all",onChange:e=>l("all"===e?"all":e),placeholder:"Filter by Public Model Name",showSearch:!0,options:[{value:"all",label:"All Models"},{value:"wildcard",label:"Wildcard Models (*)"},...s.map((e,t)=>({value:e,label:e}))]})}),(0,t.jsx)("div",{className:"w-64",children:(0,t.jsx)(U.Select,{className:"w-full",value:X??"all",onChange:e=>Z("all"===e?null:e),placeholder:"Filter by Model Access Group",showSearch:!0,options:[{value:"all",label:"All Model Access Groups"},...a.map((e,t)=>({value:e,label:e}))]})})]}),(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[eb?(0,t.jsx)(J.Skeleton.Input,{active:!0,style:{width:184,height:20}}):(0,t.jsx)("span",{className:"text-sm text-gray-700",children:ew.total_count>0?`Showing ${(ei-1)*en+1} - ${Math.min(ei*en,ew.total_count)} of ${ew.total_count} results`:"Showing 0 results"}),(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[eb?(0,t.jsx)(J.Skeleton.Button,{active:!0,style:{width:84,height:30}}):(0,t.jsx)("button",{onClick:()=>{eo(ei-1),ec(e=>({...e,pageIndex:0}))},disabled:1===ei,className:`px-3 py-1 text-sm border rounded-md ${1===ei?"bg-gray-100 text-gray-400 cursor-not-allowed":"hover:bg-gray-50"}`,children:"Previous"}),eb?(0,t.jsx)(J.Skeleton.Button,{active:!0,style:{width:56,height:30}}):(0,t.jsx)("button",{onClick:()=>{eo(ei+1),ec(e=>({...e,pageIndex:0}))},disabled:ei>=ew.total_pages,className:`px-3 py-1 text-sm border rounded-md ${ei>=ew.total_pages?"bg-gray-100 text-gray-400 cursor-not-allowed":"hover:bg-gray-50"}`,children:"Next"})]})]})]})}),(0,t.jsx)(v,{columns:[{header:()=>(0,t.jsx)("span",{className:"text-sm font-semibold",children:"Model ID"}),accessorKey:"model_info.id",enableSorting:!1,size:130,minSize:80,cell:({row:e})=>{let l=e.original;return(0,t.jsx)(E.Tooltip,{title:l.model_info.id,children:(0,t.jsx)(O,{ellipsis:!0,className:"text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs cursor-pointer w-full block",style:{fontSize:14,padding:"1px 8px"},onClick:()=>i(l.model_info.id),children:l.model_info.id})})}},{header:()=>(0,t.jsx)("span",{className:"text-sm font-semibold",children:"Model Information"}),accessorKey:"model_name",size:250,minSize:120,cell:({row:e})=>{let l=e.original,s=q(e.original)||"-",a=(0,t.jsxs)(A.Space,{direction:"vertical",size:12,style:{minWidth:220},children:[(0,t.jsxs)(P.Flex,{align:"center",gap:8,children:[(0,t.jsx)(R.ProviderLogo,{provider:l.provider}),(0,t.jsx)(O,{type:"secondary",style:{fontSize:12},ellipsis:!0,children:l.provider||"Unknown provider"})]}),(0,t.jsxs)(A.Space,{direction:"vertical",size:6,children:[(0,t.jsxs)(A.Space,{direction:"vertical",size:2,style:{width:"100%"},children:[(0,t.jsx)(O,{type:"secondary",style:{fontSize:11},children:"Public Model Name"}),(0,t.jsx)(O,{strong:!0,style:{fontSize:13,maxWidth:480},ellipsis:!0,title:s,children:s})]}),(0,t.jsxs)(A.Space,{direction:"vertical",size:2,children:[(0,t.jsx)(O,{type:"secondary",style:{fontSize:11},children:"LiteLLM Model Name"}),(0,t.jsx)(O,{style:{fontSize:13},copyable:{text:l.litellm_model_name||"-"},ellipsis:!0,title:l.litellm_model_name||"-",children:l.litellm_model_name||"-"})]})]})]});return(0,t.jsx)(M.Popover,{content:a,placement:"right",arrow:{pointAtCenter:!0},styles:{root:{maxWidth:500}},children:(0,t.jsxs)("div",{className:"flex items-start space-x-2 min-w-0 w-full cursor-pointer",children:[(0,t.jsx)("div",{className:"flex-shrink-0 mt-0.5",children:l.provider?(0,t.jsx)(R.ProviderLogo,{provider:l.provider}):(0,t.jsx)("div",{className:"w-4 h-4 rounded-full bg-gray-200 flex items-center justify-center text-xs",children:"-"})}),(0,t.jsxs)("div",{className:"flex flex-col min-w-0 flex-1",children:[(0,t.jsx)(O,{ellipsis:!0,className:"text-gray-900",style:{fontSize:12,fontWeight:500,lineHeight:"16px"},children:s}),(0,t.jsx)(O,{ellipsis:!0,type:"secondary",style:{fontSize:12,lineHeight:"16px",marginTop:2},children:l.litellm_model_name||"-"})]})]})})}},{header:()=>(0,t.jsxs)("span",{className:"flex items-center gap-1",children:[(0,t.jsx)("span",{className:"text-sm font-semibold",children:"Credentials"}),(0,t.jsx)(M.Popover,{content:z,placement:"bottom",arrow:{pointAtCenter:!0},children:(0,t.jsx)(w.InfoCircleOutlined,{className:"cursor-pointer text-gray-400 hover:text-gray-600",style:{fontSize:12}})})]}),accessorKey:"litellm_credential_name",enableSorting:!1,size:180,minSize:100,cell:({row:e})=>{let l=e.original,s=l.litellm_params?.litellm_credential_name,a=!!s;return(0,t.jsx)("div",{className:"flex items-center space-x-2 min-w-0 w-full",children:a?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(C.SyncOutlined,{className:"flex-shrink-0",style:{color:"#1890ff",fontSize:14}}),(0,t.jsx)("span",{className:"text-xs truncate text-blue-600",title:s,children:s})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(N.EditOutlined,{className:"flex-shrink-0",style:{color:"#8c8c8c",fontSize:14}}),(0,t.jsx)("span",{className:"text-xs text-gray-500",children:"Manual"})]})})}},{header:()=>(0,t.jsx)("span",{className:"text-sm font-semibold",children:"Created By"}),accessorKey:"model_info.created_by",sortingFn:"datetime",size:160,minSize:100,cell:({row:e})=>{let l=e.original,s=!l.model_info?.db_model,a=l.model_info.created_by,r=l.model_info.created_at?new Date(l.model_info.created_at).toLocaleDateString():null;return(0,t.jsxs)("div",{className:"flex flex-col min-w-0 w-full",children:[(0,t.jsx)("div",{className:"text-xs font-medium text-gray-900 truncate",title:s?"Defined in config":a||"Unknown",children:s?"Defined in config":a||"Unknown"}),(0,t.jsx)("div",{className:"text-xs text-gray-500 truncate mt-0.5",title:s?"Config file":r||"Unknown date",children:s?"-":r||"Unknown date"})]})}},{header:()=>(0,t.jsx)("span",{className:"text-sm font-semibold",children:"Updated At"}),accessorKey:"model_info.updated_at",sortingFn:"datetime",size:120,minSize:80,cell:({row:e})=>{let l=e.original;return(0,t.jsx)("span",{className:"text-xs",children:l.model_info.updated_at?new Date(l.model_info.updated_at).toLocaleDateString():"-"})}},{header:()=>(0,t.jsx)("span",{className:"text-sm font-semibold",children:"Costs"}),accessorKey:"input_cost",size:120,minSize:80,cell:({row:e})=>{let l=e.original,s=l.input_cost,a=l.output_cost;return null==s&&null==a?(0,t.jsx)("div",{className:"w-full",children:(0,t.jsx)("span",{className:"text-xs text-gray-400",children:"-"})}):(0,t.jsx)(E.Tooltip,{title:"Cost per 1M tokens",children:(0,t.jsxs)("div",{className:"flex flex-col min-w-0 w-full",children:[null!=s&&(0,t.jsxs)("div",{className:"text-xs font-medium text-gray-900 truncate",children:["In: $",s]}),null!=a&&(0,t.jsxs)("div",{className:"text-xs text-gray-500 truncate mt-0.5",children:["Out: $",a]})]})})}},{header:()=>(0,t.jsx)("span",{className:"text-sm font-semibold",children:"Team ID"}),accessorKey:"model_info.team_id",enableSorting:!1,size:130,minSize:80,cell:({row:e})=>{let l=e.original;return l.model_info.team_id?(0,t.jsx)("div",{className:"overflow-hidden w-full",children:(0,t.jsx)(E.Tooltip,{title:l.model_info.team_id,children:(0,t.jsxs)(T.Button,{size:"xs",variant:"light",className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left overflow-hidden truncate w-full",onClick:()=>o(l.model_info.team_id),children:[l.model_info.team_id.slice(0,7),"..."]})})}):"-"}},{header:()=>(0,t.jsx)("span",{className:"text-sm font-semibold",children:"Model Access Group"}),accessorKey:"model_info.model_access_group",enableSorting:!1,size:180,minSize:100,cell:({row:e})=>{let l=e.original,s=l.model_info.access_groups;if(!s||0===s.length)return"-";let a=l.model_info.id,r=ee.has(a),i=s.length>1;return(0,t.jsxs)("div",{className:"flex items-center gap-1 overflow-hidden w-full",children:[(0,t.jsx)(k.Badge,{size:"xs",color:"blue",className:"text-xs px-1.5 py-0.5 h-5 leading-tight flex-shrink-0",children:s[0]}),(r||!i&&2===s.length)&&s.slice(1).map((e,l)=>(0,t.jsx)(k.Badge,{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,t.jsx)("button",{onClick:e=>{let t;e.stopPropagation(),t=new Set(ee),r?t.delete(a):t.add(a),et(t)},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:r?"−":`+${s.length-1}`})]})}},{header:()=>(0,t.jsx)("span",{className:"text-sm font-semibold",children:"Status"}),accessorKey:"model_info.db_model",size:120,minSize:80,cell:({row:e})=>{let l=e.original;return(0,t.jsx)("div",{className:` - inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium - ${l.model_info.db_model?"bg-blue-50 text-blue-600":"bg-gray-100 text-gray-600"} - `,children:l.model_info.db_model?"DB Model":"Config Model"})}},{id:"actions",header:()=>(0,t.jsx)("span",{className:"text-sm font-semibold",children:"Actions"}),size:60,minSize:40,enableResizing:!1,cell:({row:e})=>{let l=e.original,s="Admin"===p||l.model_info?.created_by===h,a=!l.model_info?.db_model;return(0,t.jsx)("div",{className:"flex items-center justify-end gap-2 pr-4",children:a?(0,t.jsx)(E.Tooltip,{title:"Config model cannot be deleted on the dashboard. Please delete it from the config file.",children:(0,t.jsx)(F.Icon,{icon:S.TrashIcon,size:"sm",className:"opacity-50 cursor-not-allowed"})}):(0,t.jsx)(E.Tooltip,{title:"Delete model",children:(0,t.jsx)(F.Icon,{icon:S.TrashIcon,size:"sm",onClick:()=>{s&&i(l.model_info.id)},className:s?"cursor-pointer hover:text-red-600":"opacity-50 cursor-not-allowed"})})})}}],data:eC,isLoading:ey,sorting:em,onSortingChange:eu,pagination:ed,onPaginationChange:ec,enablePagination:!0})]})})}),(0,t.jsx)(el,{isVisible:eh,onCancel:()=>ex(!1),onSuccess:()=>ex(!1)})]})};var eo=e.i(206929),en=e.i(35983),ed=e.i(599724),ec=e.i(629569),em=e.i(28651);let eu={"BadRequestError (400)":"BadRequestErrorRetries","AuthenticationError (401)":"AuthenticationErrorRetries","TimeoutError (408)":"TimeoutErrorRetries","RateLimitError (429)":"RateLimitErrorRetries","ContentPolicyViolationError (400)":"ContentPolicyViolationErrorRetries","InternalServerError (500)":"InternalServerErrorRetries"},eh=({selectedModelGroup:e,setSelectedModelGroup:l,availableModelGroups:s,globalRetryPolicy:a,setGlobalRetryPolicy:r,defaultRetry:i,modelGroupRetryPolicy:o,setModelGroupRetryPolicy:n,handleSaveRetrySettings:d})=>(0,t.jsxs)(H.TabPanel,{children:[(0,t.jsx)("div",{className:"flex items-center gap-4 mb-6",children:(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)(ed.Text,{children:"Retry Policy Scope:"}),(0,t.jsxs)(eo.Select,{className:"ml-2 w-48",defaultValue:"global",value:"global"===e?"global":e||s[0],onValueChange:e=>l(e),children:[(0,t.jsx)(en.SelectItem,{value:"global",children:"Global Default"}),s.map((e,s)=>(0,t.jsx)(en.SelectItem,{value:e,onClick:()=>l(e),children:e},s))]})]})}),"global"===e?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(ec.Title,{children:"Global Retry Policy"}),(0,t.jsx)(ed.Text,{className:"mb-6",children:"Default retry settings applied to all model groups unless overridden"})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(ec.Title,{children:["Retry Policy for ",e]}),(0,t.jsx)(ed.Text,{className:"mb-6",children:"Model-specific retry settings. Falls back to global defaults if not set."})]}),eu&&(0,t.jsx)("table",{children:(0,t.jsx)("tbody",{children:Object.entries(eu).map(([l,s],d)=>{let c;if("global"===e)c=a?.[s]??i;else{let t=o?.[e]?.[s];c=null!=t?t:a?.[s]??i}return(0,t.jsxs)("tr",{className:"flex justify-between items-center mt-2",children:[(0,t.jsxs)("td",{children:[(0,t.jsx)(ed.Text,{children:l}),"global"!==e&&(0,t.jsxs)(ed.Text,{className:"text-xs text-gray-500 ml-2",children:["(Global: ",a?.[s]??i,")"]})]}),(0,t.jsx)("td",{children:(0,t.jsx)(em.InputNumber,{className:"ml-5",value:c,min:0,step:1,onChange:t=>{"global"===e?r(e=>null==t?e:{...e??{},[s]:t}):n(l=>{let a=l?.[e]??{};return{...l??{},[e]:{...a,[s]:t}}})}})})]},d)})})}),(0,t.jsx)(T.Button,{className:"mt-6 mr-8",onClick:d,children:"Save"})]});var ex=e.i(883552),ep=e.i(262218),eg=e.i(175712),ef=e.i(91979),ej=e.i(637235),e_=e.i(724154);e.i(247167);var ey=e.i(931067);let eb={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M811.4 418.7C765.6 297.9 648.9 212 512.2 212S258.8 297.8 213 418.6C127.3 441.1 64 519.1 64 612c0 110.5 89.5 200 199.9 200h496.2C870.5 812 960 722.5 960 612c0-92.7-63.1-170.7-148.6-193.3zm36.3 281a123.07 123.07 0 01-87.6 36.3H263.9c-33.1 0-64.2-12.9-87.6-36.3A123.3 123.3 0 01140 612c0-28 9.1-54.3 26.2-76.3a125.7 125.7 0 0166.1-43.7l37.9-9.9 13.9-36.6c8.6-22.8 20.6-44.1 35.7-63.4a245.6 245.6 0 0152.4-49.9c41.1-28.9 89.5-44.2 140-44.2s98.9 15.3 140 44.2c19.9 14 37.5 30.8 52.4 49.9 15.1 19.3 27.1 40.7 35.7 63.4l13.8 36.5 37.8 10c54.3 14.5 92.1 63.8 92.1 120 0 33.1-12.9 64.3-36.3 87.7z"}}]},name:"cloud",theme:"outlined"};var ev=e.i(9583),eN=x.forwardRef(function(e,t){return x.createElement(ev.default,(0,ey.default)({},e,{ref:t,icon:eb}))}),ew=e.i(210612),eC=e.i(285027);let{Text:eS}=L.Typography,ek=({accessToken:e,onReloadSuccess:s,buttonText:a="Reload Price Data",showIcon:r=!0,size:i="middle",type:o="primary",className:n=""})=>{let[d,c]=(0,x.useState)(!1),[m,u]=(0,x.useState)(!1),[h,p]=(0,x.useState)(!1),[g,f]=(0,x.useState)(!1),[j,_]=(0,x.useState)(6),[y,b]=(0,x.useState)(null),[v,N]=(0,x.useState)(!1),[C,S]=(0,x.useState)(null),[k,T]=(0,x.useState)(!1);(0,x.useEffect)(()=>{F(),P();let e=setInterval(()=>{F(),P()},3e4);return()=>clearInterval(e)},[e]);let F=async()=>{if(e){N(!0);try{console.log("Fetching reload status...");let t=await (0,l.getModelCostMapReloadStatus)(e);console.log("Received status:",t),b(t)}catch(e){console.error("Failed to fetch reload status:",e),b({scheduled:!1,interval_hours:null,last_run:null,next_run:null})}finally{N(!1)}}},P=async()=>{if(e){T(!0);try{let t=await (0,l.getModelCostMapSource)(e);S(t)}catch(e){console.error("Failed to fetch cost map source info:",e)}finally{T(!1)}}},M=async()=>{if(!e)return void Y.default.fromBackend("No access token available");c(!0);try{let t=await (0,l.reloadModelCostMap)(e);"success"===t.status?(Y.default.success(`Price data reloaded successfully! ${t.models_count||0} models updated.`),s?.(),await F(),await P()):Y.default.fromBackend("Failed to reload price data")}catch(e){console.error("Error reloading price data:",e),Y.default.fromBackend("Failed to reload price data. Please try again.")}finally{c(!1)}},L=async()=>{if(!e)return void Y.default.fromBackend("No access token available");if(j<=0)return void Y.default.fromBackend("Hours must be greater than 0");u(!0);try{let t=await (0,l.scheduleModelCostMapReload)(e,j);"success"===t.status?(Y.default.success(`Periodic reload scheduled for every ${j} hours`),f(!1),await F()):Y.default.fromBackend("Failed to schedule periodic reload")}catch(e){console.error("Error scheduling reload:",e),Y.default.fromBackend("Failed to schedule periodic reload. Please try again.")}finally{u(!1)}},R=async()=>{if(!e)return void Y.default.fromBackend("No access token available");p(!0);try{let t=await (0,l.cancelModelCostMapReload)(e);"success"===t.status?(Y.default.success("Periodic reload cancelled successfully"),await F()):Y.default.fromBackend("Failed to cancel periodic reload")}catch(e){console.error("Error cancelling reload:",e),Y.default.fromBackend("Failed to cancel periodic reload. Please try again.")}finally{p(!1)}},O=e=>{if(!e)return"Never";try{return new Date(e).toLocaleString()}catch{return e}};return(0,t.jsxs)("div",{className:n,children:[(0,t.jsxs)(A.Space,{direction:"horizontal",size:"middle",style:{marginBottom:16},children:[(0,t.jsx)(ex.Popconfirm,{title:"Hard Refresh Price Data",description:"This will immediately fetch the latest pricing information from the remote source. Continue?",onConfirm:M,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,t.jsx)(G.Button,{type:o,size:i,loading:d,icon:r?(0,t.jsx)(ef.ReloadOutlined,{}):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:a})}),y?.scheduled?(0,t.jsx)(G.Button,{type:"default",size:i,danger:!0,icon:(0,t.jsx)(e_.StopOutlined,{}),loading:h,onClick:R,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,t.jsx)(G.Button,{type:"default",size:i,icon:(0,t.jsx)(ej.ClockCircleOutlined,{}),onClick:()=>f(!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"})]}),C&&(0,t.jsx)(eg.Card,{size:"small",style:{backgroundColor:"remote"===C.source?"#f0f7ff":"#fff8f0",border:`1px solid ${"remote"===C.source?"#bae0ff":"#ffd591"}`,borderRadius:8,marginBottom:12},children:(0,t.jsxs)(A.Space,{direction:"vertical",size:"small",style:{width:"100%"},children:[(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8},children:["remote"===C.source?(0,t.jsx)(eN,{style:{color:"#1677ff",fontSize:16}}):(0,t.jsx)(ew.DatabaseOutlined,{style:{color:"#fa8c16",fontSize:16}}),(0,t.jsx)(eS,{strong:!0,style:{fontSize:"13px"},children:"Pricing Data Source"}),(0,t.jsx)(ep.Tag,{color:"remote"===C.source?"blue":"orange",style:{marginLeft:"auto",fontWeight:600,textTransform:"uppercase",fontSize:"11px"},children:"remote"===C.source?"Remote":"Local"})]}),(0,t.jsx)(I.Divider,{style:{margin:"6px 0"}}),(0,t.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,t.jsx)(eS,{type:"secondary",style:{fontSize:"12px"},children:"Models loaded:"}),(0,t.jsx)(eS,{strong:!0,style:{fontSize:"12px"},children:C.model_count.toLocaleString()})]}),C.url&&(0,t.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:8},children:[(0,t.jsx)(eS,{type:"secondary",style:{fontSize:"12px",whiteSpace:"nowrap"},children:"remote"===C.source?"Loaded from:":"Attempted URL:"}),(0,t.jsx)(E.Tooltip,{title:C.url,children:(0,t.jsx)(eS,{style:{fontSize:"11px",maxWidth:240,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"block",color:"#1677ff",cursor:"default"},children:C.url})})]}),C.is_env_forced&&(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,marginTop:2},children:[(0,t.jsx)(w.InfoCircleOutlined,{style:{color:"#fa8c16",fontSize:12}}),(0,t.jsxs)(eS,{type:"secondary",style:{fontSize:"11px"},children:["Local mode forced via ",(0,t.jsx)("code",{children:"LITELLM_LOCAL_MODEL_COST_MAP=True"})]})]}),C.fallback_reason&&(0,t.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",gap:6,backgroundColor:"#fff7e6",border:"1px solid #ffd591",borderRadius:4,padding:"4px 8px",marginTop:2},children:[(0,t.jsx)(eC.WarningOutlined,{style:{color:"#fa8c16",fontSize:12,marginTop:2}}),(0,t.jsxs)(eS,{style:{fontSize:"11px",color:"#614700"},children:["Fell back to local: ",C.fallback_reason]})]})]})}),y&&(0,t.jsx)(eg.Card,{size:"small",style:{backgroundColor:"#f8f9fa",border:"1px solid #e9ecef",borderRadius:8},children:(0,t.jsxs)(A.Space,{direction:"vertical",size:"small",style:{width:"100%"},children:[y.scheduled?(0,t.jsx)("div",{children:(0,t.jsxs)(ep.Tag,{color:"green",icon:(0,t.jsx)(ej.ClockCircleOutlined,{}),children:["Scheduled every ",y.interval_hours," hours"]})}):(0,t.jsx)(eS,{type:"secondary",children:"No periodic reload scheduled"}),(0,t.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,t.jsx)(eS,{type:"secondary",style:{fontSize:"12px"},children:"Last run:"}),(0,t.jsx)(eS,{style:{fontSize:"12px"},children:O(y.last_run)})]}),y.scheduled&&(0,t.jsxs)(t.Fragment,{children:[y.next_run&&(0,t.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,t.jsx)(eS,{type:"secondary",style:{fontSize:"12px"},children:"Next run:"}),(0,t.jsx)(eS,{style:{fontSize:"12px"},children:O(y.next_run)})]}),(0,t.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,t.jsx)(eS,{type:"secondary",style:{fontSize:"12px"},children:"Status:"}),(0,t.jsx)(ep.Tag,{color:y?.scheduled?y.last_run?"success":"processing":"default",children:y?.scheduled?y.last_run?"Active":"Ready":"Not scheduled"})]})]})]})}),(0,t.jsxs)(ee.Modal,{title:"Set Up Periodic Reload",open:g,onOk:L,onCancel:()=>f(!1),confirmLoading:m,okText:"Schedule",cancelText:"Cancel",okButtonProps:{style:{backgroundColor:"#6366f1",borderColor:"#6366f1",color:"white"}},children:[(0,t.jsx)("div",{style:{marginBottom:16},children:(0,t.jsx)(eS,{children:"Set up automatic reload of price data every:"})}),(0,t.jsx)("div",{style:{marginBottom:16},children:(0,t.jsx)(em.InputNumber,{min:1,max:168,value:j,onChange:e=>_(e||6),addonAfter:"hours",style:{width:"100%"}})}),(0,t.jsx)("div",{children:(0,t.jsxs)(eS,{type:"secondary",children:["This will automatically fetch the latest pricing data from the remote source every ",j," hours."]})})]})]})},eT=()=>{let{accessToken:e}=(0,r.default)(),{refetch:l}=(0,n.useModelCostMap)();return(0,t.jsx)(H.TabPanel,{children:(0,t.jsxs)("div",{className:"p-6",children:[(0,t.jsxs)("div",{className:"mb-6",children:[(0,t.jsx)(ec.Title,{children:"Price Data Management"}),(0,t.jsx)(ed.Text,{className:"text-tremor-content",children:"Manage model pricing data and configure automatic reload schedules"})]}),(0,t.jsx)(ek,{accessToken:e,onReloadSuccess:()=>{l()},buttonText:"Reload Price Data",size:"middle",type:"primary",className:"w-full"})]})})};var eF=e.i(916925);let eI=async(e,t,l)=>{try{console.log("handling submit for formValues:",e);let t=e.model_mappings||[];if("model_mappings"in e&&delete e.model_mappings,e.model&&e.model.includes("all-wildcard")){let l=e.custom_llm_provider,s=(eF.provider_map[l]??l.toLowerCase())+"/*";e.model_name=s,t.push({public_name:s,litellm_model:s}),e.model=s}let l=[];for(let s of t){let t={},a={},r=s.public_name;for(let[l,r]of(t.model=s.litellm_model,void 0!==e.input_cost_per_token&&null!==e.input_cost_per_token&&""!==e.input_cost_per_token&&(e.input_cost_per_token=Number(e.input_cost_per_token)/1e6),void 0!==e.output_cost_per_token&&null!==e.output_cost_per_token&&""!==e.output_cost_per_token&&(e.output_cost_per_token=Number(e.output_cost_per_token)/1e6),t.model=s.litellm_model,console.log("formValues add deployment:",e),Object.entries(e)))if(""!==r&&"custom_pricing"!==l&&"pricing_model"!==l&&"cache_control"!==l)if("model_name"==l)t.model=r;else if("custom_llm_provider"==l){console.log("custom_llm_provider:",r);let e=eF.provider_map[r]??r.toLowerCase();t.custom_llm_provider=e,console.log("custom_llm_provider mappingResult:",e)}else if("model"==l)continue;else if("base_model"===l)a[l]=r;else if("team_id"===l)a.team_id=r;else if("model_access_group"===l)a.access_groups=r;else if("mode"==l)console.log("placing mode in modelInfo"),a.mode=r,delete t.mode;else if("custom_model_name"===l)t.model=r;else if("litellm_extra_params"==l){console.log("litellm_extra_params:",r);let e={};if(r&&void 0!=r){try{e=JSON.parse(r)}catch(e){throw Y.default.fromBackend("Failed to parse LiteLLM Extra Params: "+e),Error("Failed to parse litellm_extra_params: "+e)}for(let[l,s]of Object.entries(e))t[l]=s}}else if("model_info_params"==l){console.log("model_info_params:",r);let e={};if(r&&void 0!=r){try{e=JSON.parse(r)}catch(e){throw Y.default.fromBackend("Failed to parse LiteLLM Extra Params: "+e),Error("Failed to parse litellm_extra_params: "+e)}for(let[t,l]of Object.entries(e))a[t]=l}}else if("input_cost_per_token"===l||"output_cost_per_token"===l||"input_cost_per_second"===l){null!=r&&""!==r&&(t[l]=Number(r));continue}else t[l]=r;l.push({litellmParamsObj:t,modelInfoObj:a,modelName:r})}return l}catch(e){Y.default.fromBackend("Failed to create model: "+e)}},eP=async(e,t,s,a)=>{try{let r=await eI(e,t,s);if(!r||0===r.length)return;for(let e of r){let{litellmParamsObj:s,modelInfoObj:a,modelName:r}=e,i={model_name:r,litellm_params:s,model_info:a},o=await (0,l.modelCreateCall)(t,i);console.log(`response for model create call: ${o.data}`)}a&&a(),s.resetFields()}catch(e){Y.default.fromBackend("Failed to add model: "+e)}};var eM=e.i(591935),eA=e.i(304967),eE=e.i(127952),eL=e.i(779241);let eR=(0,a.createQueryKeys)("providerFields"),eO=()=>(0,s.useQuery)({queryKey:eR.list({}),queryFn:async()=>await (0,l.getProviderCreateMetadata)(),staleTime:864e5,gcTime:864e5});var eB=e.i(519756),ez=e.i(178654),eq=e.i(311451),eV=e.i(621192),eD=e.i(515831);let{Link:eH}=L.Typography,e$=e=>{let t="password"===e.field_type?"password":"select"===e.field_type?"select":"upload"===e.field_type?"upload":"textarea"===e.field_type?"textarea":"text";return{key:e.key,label:e.label,placeholder:e.placeholder??void 0,tooltip:e.tooltip??void 0,required:e.required??!1,type:t,options:e.options??void 0,defaultValue:e.default_value??void 0}},eG={},eU=({selectedProvider:e,uploadProps:l})=>{let s=eF.Providers[e],a=Z.Form.useFormInstance(),{data:r,isLoading:i,error:o}=eO(),n=x.default.useMemo(()=>{if(!r)return null;let e={};return r.forEach(t=>{let l=t.provider_display_name,s=t.credential_fields.map(e$);e[l]=s,t.provider&&(e[t.provider]=s),t.litellm_provider&&(e[t.litellm_provider]=s)}),e},[r]);x.default.useEffect(()=>{n&&Object.assign(eG,n)},[n]);let d=x.default.useMemo(()=>{let t=eG[s]??eG[e];if(t)return t;if(!r)return[];let l=r.find(t=>t.provider_display_name===s||t.provider===e||t.litellm_provider===e);if(!l)return[];let a=l.credential_fields.map(e$);return eG[l.provider_display_name]=a,l.provider&&(eG[l.provider]=a),l.litellm_provider&&(eG[l.litellm_provider]=a),a},[s,e,r]),c={name:"file",accept:".json",beforeUpload:e=>{if("application/json"===e.type){let t=new FileReader;t.onload=e=>{if(e.target){let t=e.target.result;console.log(`Setting field value from JSON, length: ${t.length}`),a.setFieldsValue({vertex_credentials:t}),console.log("Form values after setting:",a.getFieldsValue())}},t.readAsText(e)}return!1},onChange(e){console.log("Upload onChange triggered in ProviderSpecificFields"),console.log("Current form values:",a.getFieldsValue()),"uploading"!==e.file.status&&console.log(e.file,e.fileList)}};return(0,t.jsxs)(t.Fragment,{children:[i&&0===d.length&&(0,t.jsx)(eV.Row,{children:(0,t.jsx)(ez.Col,{span:24,children:(0,t.jsx)(ed.Text,{className:"mb-2",children:"Loading provider fields..."})})}),o&&0===d.length&&(0,t.jsx)(eV.Row,{children:(0,t.jsx)(ez.Col,{span:24,children:(0,t.jsx)(ed.Text,{className:"mb-2 text-red-500",children:o instanceof Error?o.message:"Failed to load provider credential fields"})})}),d.map(e=>(0,t.jsxs)(x.default.Fragment,{children:[(0,t.jsx)(Z.Form.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,t.jsx)(U.Select,{placeholder:e.placeholder,defaultValue:e.defaultValue,children:e.options?.map(e=>(0,t.jsx)(U.Select.Option,{value:e,children:e},e))}):"upload"===e.type?(0,t.jsx)(eD.Upload,{...c,onChange:t=>{l?.onChange&&l.onChange(t),setTimeout(()=>{let t=a.getFieldValue(e.key);console.log(`${e.key} value after upload:`,JSON.stringify(t))},500)},children:(0,t.jsx)(G.Button,{icon:(0,t.jsx)(eB.UploadOutlined,{}),children:"Click to Upload"})}):"textarea"===e.type?(0,t.jsx)(eq.Input.TextArea,{placeholder:e.placeholder,defaultValue:e.defaultValue,rows:6,style:{fontFamily:"monospace",fontSize:"12px"}}):(0,t.jsx)(eL.TextInput,{placeholder:e.placeholder,type:"password"===e.type?"password":"text",defaultValue:e.defaultValue})}),"vertex_credentials"===e.key&&(0,t.jsx)(eV.Row,{children:(0,t.jsx)(ez.Col,{children:(0,t.jsx)(ed.Text,{className:"mb-3 mt-1",children:"Give a gcp service account(.json file)"})})}),"base_model"===e.key&&(0,t.jsxs)(eV.Row,{children:[(0,t.jsx)(ez.Col,{span:10}),(0,t.jsx)(ez.Col,{span:10,children:(0,t.jsxs)(ed.Text,{className:"mb-2",children:["The actual model your azure deployment uses. Used for accurate cost tracking. Select name from"," ",(0,t.jsx)(eH,{href:"https://github.com/BerriAI/litellm/blob/main/model_prices_and_context_window.json",target:"_blank",children:"here"})]})})]})]},e.key))]})},{Link:eJ}=L.Typography,eK=({open:e,onCancel:l,onAddCredential:s,uploadProps:a})=>{let[r]=Z.Form.useForm(),[i,o]=(0,x.useState)(eF.Providers.OpenAI);return(0,t.jsx)(ee.Modal,{title:"Add New Credential",open:e,onCancel:()=>{l(),r.resetFields()},footer:null,width:600,children:(0,t.jsxs)(Z.Form,{form:r,onFinish:e=>{s(Object.entries(e).reduce((e,[t,l])=>(""!==l&&null!=l&&(e[t]=l),e),{})),r.resetFields()},layout:"vertical",children:[(0,t.jsx)(Z.Form.Item,{label:"Credential Name:",name:"credential_name",rules:[{required:!0,message:"Credential name is required"}],children:(0,t.jsx)(eL.TextInput,{placeholder:"Enter a friendly name for these credentials"})}),(0,t.jsx)(Z.Form.Item,{rules:[{required:!0,message:"Required"}],label:"Provider:",name:"custom_llm_provider",tooltip:"Helper to auto-populate provider specific fields",children:(0,t.jsx)(U.Select,{showSearch:!0,onChange:e=>{o(e),r.setFieldValue("custom_llm_provider",e)},children:Object.entries(eF.Providers).map(([e,l])=>(0,t.jsx)(U.Select.Option,{value:e,children:(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)("img",{src:eF.providerLogoMap[l],alt:`${e} logo`,className:"w-5 h-5",onError:e=>{let t=e.target,s=t.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=l.charAt(0),s.replaceChild(e,t)}}}),(0,t.jsx)("span",{children:l})]})},e))})}),(0,t.jsx)(eU,{selectedProvider:i,uploadProps:a}),(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsx)(E.Tooltip,{title:"Get help on our github",children:(0,t.jsx)(eJ,{href:"https://github.com/BerriAI/litellm/issues",children:"Need Help?"})}),(0,t.jsxs)("div",{children:[(0,t.jsx)(G.Button,{onClick:()=>{l(),r.resetFields()},style:{marginRight:10},children:"Cancel"}),(0,t.jsx)(G.Button,{htmlType:"submit",children:"Add Credential"})]})]})]})})},{Link:eW}=L.Typography;function eQ({open:e,onCancel:l,onUpdateCredential:s,uploadProps:a,existingCredential:r}){let[i]=Z.Form.useForm(),[o,n]=(0,x.useState)(eF.Providers.Anthropic);return(0,x.useEffect)(()=>{if(r){let e=Object.entries(r.credential_values||{}).reduce((e,[t,l])=>(e[t]=l??null,e),{});i.setFieldsValue({credential_name:r.credential_name,custom_llm_provider:r.credential_info.custom_llm_provider,...e}),n(r.credential_info.custom_llm_provider)}},[r]),(0,t.jsx)(ee.Modal,{title:"Edit Credential",open:e,onCancel:()=>{l(),i.resetFields()},footer:null,width:600,destroyOnHidden:!0,children:(0,t.jsxs)(Z.Form,{form:i,onFinish:e=>{s(Object.entries(e).reduce((e,[t,l])=>(""!==l&&null!=l&&(e[t]=l),e),{})),i.resetFields()},layout:"vertical",children:[(0,t.jsx)(Z.Form.Item,{label:"Credential Name:",name:"credential_name",rules:[{required:!0,message:"Credential name is required"}],initialValue:r?.credential_name,children:(0,t.jsx)(eL.TextInput,{placeholder:"Enter a friendly name for these credentials",disabled:!!r?.credential_name})}),(0,t.jsx)(Z.Form.Item,{rules:[{required:!0,message:"Required"}],label:"Provider:",name:"custom_llm_provider",tooltip:"Helper to auto-populate provider specific fields",children:(0,t.jsx)(U.Select,{showSearch:!0,onChange:e=>{n(e),i.setFieldValue("custom_llm_provider",e)},children:Object.entries(eF.Providers).map(([e,l])=>(0,t.jsx)(U.Select.Option,{value:e,children:(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)("img",{src:eF.providerLogoMap[l],alt:`${e} logo`,className:"w-5 h-5",onError:e=>{let t=e.target,s=t.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=l.charAt(0),s.replaceChild(e,t)}}}),(0,t.jsx)("span",{children:l})]})},e))})}),(0,t.jsx)(eU,{selectedProvider:o,uploadProps:a}),(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsx)(E.Tooltip,{title:"Get help on our github",children:(0,t.jsx)(eW,{href:"https://github.com/BerriAI/litellm/issues",children:"Need Help?"})}),(0,t.jsxs)("div",{children:[(0,t.jsx)(G.Button,{onClick:()=>{l(),i.resetFields()},style:{marginRight:10},children:"Cancel"}),(0,t.jsx)(G.Button,{htmlType:"submit",children:"Update Credential"})]})]})]})})}let eY=({uploadProps:e})=>{let{accessToken:s}=(0,r.default)(),{data:a,refetch:i}=o(),n=a?.credentials||[],[d,c]=(0,x.useState)(!1),[m,u]=(0,x.useState)(!1),[h,b]=(0,x.useState)(null),[v,N]=(0,x.useState)(null),[w,C]=(0,x.useState)(!1),[F,I]=(0,x.useState)(!1),[P]=Z.Form.useForm(),M=["credential_name","custom_llm_provider"],A=async e=>{if(!s)return;let t=Object.entries(e).filter(([e])=>!M.includes(e)).reduce((e,[t,l])=>({...e,[t]:l}),{}),a={credential_name:e.credential_name,credential_values:t,credential_info:{custom_llm_provider:e.custom_llm_provider}};await (0,l.credentialUpdateCall)(s,e.credential_name,a),Y.default.success("Credential updated successfully"),u(!1),await i()},E=async e=>{if(!s)return;let t=Object.entries(e).filter(([e])=>!M.includes(e)).reduce((e,[t,l])=>({...e,[t]:l}),{}),a={credential_name:e.credential_name,credential_values:t,credential_info:{custom_llm_provider:e.custom_llm_provider}};await (0,l.credentialCreateCall)(s,a),Y.default.success("Credential added successfully"),c(!1),await i()},L=async()=>{if(s&&v){I(!0);try{await (0,l.credentialDeleteCall)(s,v.credential_name),Y.default.success("Credential deleted successfully"),await i()}catch(e){Y.default.error("Failed to delete credential")}finally{N(null),C(!1),I(!1)}}};return(0,t.jsxs)("div",{className:"w-full mx-auto flex-auto overflow-y-auto p-2",children:[(0,t.jsx)(T.Button,{onClick:()=>c(!0),children:"Add Credential"}),(0,t.jsx)("div",{className:"flex justify-between items-center mt-4 mb-4",children:(0,t.jsx)(ed.Text,{children:"Configured credentials for different AI providers. Add and manage your API credentials."})}),(0,t.jsx)(eA.Card,{children:(0,t.jsxs)(p.Table,{children:[(0,t.jsx)(g.TableHead,{children:(0,t.jsxs)(_.TableRow,{children:[(0,t.jsx)(f.TableHeaderCell,{children:"Credential Name"}),(0,t.jsx)(f.TableHeaderCell,{children:"Provider"}),(0,t.jsx)(f.TableHeaderCell,{children:"Actions"})]})}),(0,t.jsx)(j.TableBody,{children:n&&0!==n.length?n.map((e,l)=>{var s;let a,r;return(0,t.jsxs)(_.TableRow,{children:[(0,t.jsx)(y.TableCell,{children:e.credential_name}),(0,t.jsx)(y.TableCell,{children:(s=e.credential_info?.custom_llm_provider||"-",r=(a={openai:"blue",azure:"indigo",anthropic:"purple",default:"gray"})[s.toLowerCase()]||a.default,(0,t.jsx)(k.Badge,{color:r,size:"xs",children:s}))}),(0,t.jsxs)(y.TableCell,{children:[(0,t.jsx)(T.Button,{icon:eM.PencilAltIcon,variant:"light",size:"sm",onClick:()=>{b(e),u(!0)}}),(0,t.jsx)(T.Button,{icon:S.TrashIcon,variant:"light",size:"sm",onClick:()=>{N(e),C(!0)},className:"ml-2"})]})]},l)}):(0,t.jsx)(_.TableRow,{children:(0,t.jsx)(y.TableCell,{colSpan:4,className:"text-center py-4 text-gray-500",children:"No credentials configured"})})})]})}),d&&(0,t.jsx)(eK,{onAddCredential:E,open:d,onCancel:()=>c(!1),uploadProps:e}),m&&(0,t.jsx)(eQ,{open:m,existingCredential:h,onUpdateCredential:A,uploadProps:e,onCancel:()=>u(!1)}),(0,t.jsx)(eE.default,{isOpen:w,onCancel:()=>{N(null),C(!1)},onOk:L,title:"Delete Credential?",message:"Are you sure you want to delete this credential? This action cannot be undone and may break existing integrations.",resourceInformationTitle:"Credential Information",resourceInformation:[{label:"Credential Name",value:v?.credential_name},{label:"Provider",value:v?.credential_info?.custom_llm_provider||"-"}],confirmLoading:F,requiredConfirmation:v?.credential_name})]})};var eX=e.i(708347),eZ=e.i(278587),e0=e.i(912598),e1=e.i(309426),e2=e.i(197647),e4=e.i(653824),e5=e.i(881073),e6=e.i(723731),e3=e.i(475647),e8=e.i(91739),e7=e.i(437902),e9=e.i(166406);let{Text:te}=L.Typography,tt=({formValues:e,accessToken:s,testMode:a,modelName:r="this model",onClose:i,onTestComplete:o})=>{var n,d,c;let m,u,[h,p]=x.default.useState(null),[g,f]=x.default.useState(null),[j,_]=x.default.useState(null),[y,b]=x.default.useState(!0),[v,N]=x.default.useState(!1),[C,S]=x.default.useState(!1),k=async()=>{b(!0),S(!1),p(null),f(null),_(null),N(!1),await new Promise(e=>setTimeout(e,100));try{console.log("Testing connection with form values:",e);let t=await eI(e,s,null);if(!t){console.log("No result from prepareModelAddRequest"),p("Failed to prepare model data. Please check your form inputs."),N(!1),b(!1);return}console.log("Result from prepareModelAddRequest:",t);let{litellmParamsObj:a,modelInfoObj:r,modelName:i}=t[0],o=await (0,l.testConnectionRequest)(s,a,r,r?.mode);if("success"===o.status)Y.default.success("Connection test successful!"),p(null),N(!0);else{let e=o.result?.error||o.message||"Unknown error";p(e),f(a),_(o.result?.raw_request_typed_dict),N(!1)}}catch(e){console.error("Test connection error:",e),p(e instanceof Error?e.message:String(e)),N(!1)}finally{b(!1),o&&o()}};x.default.useEffect(()=>{let e=setTimeout(()=>{k()},200);return()=>clearTimeout(e)},[]);let T=e=>e?e.split("stack trace:")[0].trim().replace(/^litellm\.(.*?)Error: /,""):"Unknown error",F="string"==typeof h?T(h):h?.message?T(h.message):"Unknown error",P=j?(n=j.raw_request_api_base,d=j.raw_request_body,c=j.raw_request_headers||{},m=JSON.stringify(d,null,2).split("\n").map(e=>` ${e}`).join("\n"),u=Object.entries(c).map(([e,t])=>`-H '${e}: ${t}'`).join(" \\\n "),`curl -X POST \\ - ${n} \\ - ${u?`${u} \\ - `:""}-H 'Content-Type: application/json' \\ - -d '{ -${m} - }'`):"";return(0,t.jsxs)("div",{style:{padding:"24px",borderRadius:"8px",backgroundColor:"#fff"},children:[y?(0,t.jsxs)("div",{style:{textAlign:"center",padding:"32px 20px"},className:"jsx-dc9a0e2d897fe63b",children:[(0,t.jsx)("div",{style:{marginBottom:"16px"},className:"jsx-dc9a0e2d897fe63b loading-spinner",children:(0,t.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,t.jsxs)(te,{style:{fontSize:"16px"},children:["Testing connection to ",r,"..."]}),(0,t.jsx)(e7.default,{id:"dc9a0e2d897fe63b",children:"@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}"})]}):v?(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"32px 20px"},children:[(0,t.jsx)("div",{style:{color:"#52c41a",fontSize:"24px",display:"flex",alignItems:"center"},children:(0,t.jsx)("svg",{viewBox:"64 64 896 896",focusable:"false","data-icon":"check-circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",children:(0,t.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,t.jsxs)(te,{type:"success",style:{fontSize:"18px",fontWeight:500,marginLeft:"10px"},children:["Connection to ",r," successful!"]})]}):(0,t.jsx)(t.Fragment,{children:(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",marginBottom:"20px"},children:[(0,t.jsx)(eC.WarningOutlined,{style:{color:"#ff4d4f",fontSize:"24px",marginRight:"12px"}}),(0,t.jsxs)(te,{type:"danger",style:{fontSize:"18px",fontWeight:500},children:["Connection to ",r," failed"]})]}),(0,t.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,t.jsxs)(te,{strong:!0,style:{display:"block",marginBottom:"8px"},children:["Error:"," "]}),(0,t.jsx)(te,{type:"danger",style:{fontSize:"14px",lineHeight:"1.5"},children:F}),h&&(0,t.jsx)("div",{style:{marginTop:"12px"},children:(0,t.jsx)(G.Button,{type:"link",onClick:()=>S(!C),style:{paddingLeft:0,height:"auto"},children:C?"Hide Details":"Show Details"})})]}),C&&(0,t.jsxs)("div",{style:{marginBottom:"20px"},children:[(0,t.jsx)(te,{strong:!0,style:{display:"block",marginBottom:"8px",fontSize:"15px"},children:"Troubleshooting Details"}),(0,t.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 h?h:JSON.stringify(h,null,2)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(te,{strong:!0,style:{display:"block",marginBottom:"8px",fontSize:"15px"},children:"API Request"}),(0,t.jsx)("pre",{style:{backgroundColor:"#f5f5f5",padding:"16px",borderRadius:"8px",fontSize:"13px",maxHeight:"250px",overflow:"auto",border:"1px solid #e8e8e8",lineHeight:"1.5"},children:P||"No request data available"}),(0,t.jsx)(G.Button,{style:{marginTop:"8px"},icon:(0,t.jsx)(e9.CopyOutlined,{}),onClick:()=>{navigator.clipboard.writeText(P||""),Y.default.success("Copied to clipboard")},children:"Copy to Clipboard"})]})]})}),(0,t.jsx)(I.Divider,{style:{margin:"24px 0 16px"}}),(0,t.jsx)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:(0,t.jsx)(G.Button,{type:"link",href:"https://docs.litellm.ai/docs/providers",target:"_blank",icon:(0,t.jsx)(w.InfoCircleOutlined,{}),children:"View Documentation"})})]})},tl=async(e,t,s,a)=>{try{let r;console.log("=== AUTO ROUTER SUBMIT HANDLER CALLED ==="),console.log("handling auto router submit for formValues:",e),console.log("Model type:",e.model_type),"complexity_router"===e.model_type?(console.log("Creating complexity router configuration"),r={model_name:e.auto_router_name,litellm_params:{model:"auto_router/complexity_router",complexity_router_config:e.complexity_router_config,complexity_router_default_model:e.auto_router_default_model},model_info:{}},console.log("Complexity router config:",e.complexity_router_config)):(console.log("Creating semantic router configuration"),r={model_name:e.auto_router_name,litellm_params:{model:`auto_router/${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?r.litellm_params.auto_router_embedding_model=e.auto_router_embedding_model:e.custom_embedding_model&&(r.litellm_params.auto_router_embedding_model=e.custom_embedding_model),console.log("Semantic router config (stringified):",r.litellm_params.auto_router_config)),e.team_id&&(r.model_info.team_id=e.team_id),e.model_access_group&&e.model_access_group.length>0&&(r.model_info.access_groups=e.model_access_group),console.log("Auto router configuration to be created:",r),console.log("Calling modelCreateCall...");let i=await (0,l.modelCreateCall)(t,r);console.log("response for auto router create call:",i);let o="complexity_router"===e.model_type?"Complexity Router":"Semantic Router";Y.default.success(`Successfully created ${o}: ${e.auto_router_name}`),s.resetFields(),a&&a()}catch(e){console.error("Failed to add auto router:",e),Y.default.fromBackend("Failed to add auto router: "+e)}};var ts=e.i(689020),ta=e.i(955135),tr=e.i(646563),ti=e.i(362024),to=e.i(21548);let{Text:tn}=L.Typography,{TextArea:td}=eq.Input,tc=({modelInfo:e,value:l,onChange:s})=>{let[a,r]=(0,x.useState)([]),[i,o]=(0,x.useState)(!1),[n,d]=(0,x.useState)([]);(0,x.useEffect)(()=>{let e=l?.routes;if(e){let t=[];r(l=>e.map((e,s)=>{let a=l[s],r=a?.id||e.id||`route-${s}-${Date.now()}`;return t.push(r),{id:r,model:e.name||e.model||"",utterances:e.utterances||[],description:e.description||"",score_threshold:e.score_threshold??.5}})),d(t)}else r([]),d([])},[l]);let c=(e,t,l)=>{let s=a.map(s=>s.id===e?{...s,[t]:l}:s);r(s),m(s)},m=e=>{let t={routes:e.map(e=>({name:e.model,utterances:e.utterances,description:e.description,score_threshold:e.score_threshold}))};s?.(t)},u=e.map(e=>({value:e.model_group,label:e.model_group}));return(0,t.jsxs)("div",{className:"w-full max-w-none",children:[(0,t.jsxs)(P.Flex,{justify:"space-between",align:"center",gap:"middle",style:{width:"100%",marginBottom:24},children:[(0,t.jsxs)(A.Space,{align:"center",children:[(0,t.jsx)(L.Typography.Title,{level:4,style:{margin:0},children:"Routes Configuration"}),(0,t.jsx)(E.Tooltip,{title:"Configure routing logic to automatically select the best model based on user input patterns",children:(0,t.jsx)(w.InfoCircleOutlined,{className:"text-gray-400"})})]}),(0,t.jsx)(G.Button,{type:"primary",icon:(0,t.jsx)(tr.PlusOutlined,{}),onClick:()=>{let e=`route-${Date.now()}`,t=[...a,{id:e,model:"",utterances:[],description:"",score_threshold:.5}];r(t),m(t),d(t=>[...t,e])},className:"bg-blue-600 hover:bg-blue-700",children:"Add Route"})]}),0===a.length?(0,t.jsx)(eg.Card,{children:(0,t.jsx)(to.Empty,{description:'No routes configured. Click "Add Route" to get started.'})}):(0,t.jsx)(ti.Collapse,{activeKey:n,onChange:e=>d(Array.isArray(e)?e:[e].filter(Boolean)),style:{width:"100%"},items:a.map((e,l)=>({key:e.id,label:(0,t.jsxs)(tn,{style:{fontSize:16},children:["Route ",l+1,": ",e.model||"Unnamed"]}),extra:(0,t.jsx)(G.Button,{type:"text",danger:!0,size:"small",icon:(0,t.jsx)(ta.DeleteOutlined,{}),onClick:t=>{var l;let s;t.stopPropagation(),l=e.id,r(s=a.filter(e=>e.id!==l)),m(s),d(e=>e.filter(e=>e!==l))}}),children:(0,t.jsxs)(eg.Card,{children:[(0,t.jsxs)("div",{className:"mb-4 w-full",children:[(0,t.jsx)(tn,{className:"text-sm font-medium mb-2 block",children:"Model"}),(0,t.jsx)(U.Select,{value:e.model,onChange:t=>c(e.id,"model",t),placeholder:"Select model",showSearch:!0,style:{width:"100%"},options:u})]}),(0,t.jsxs)("div",{className:"mb-4 w-full",children:[(0,t.jsx)(tn,{className:"text-sm font-medium mb-2 block",children:"Description"}),(0,t.jsx)(td,{value:e.description,onChange:t=>c(e.id,"description",t.target.value),placeholder:"Describe when this route should be used...",rows:2,style:{width:"100%"}})]}),(0,t.jsxs)("div",{className:"mb-4 w-full",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,t.jsx)(tn,{className:"text-sm font-medium",children:"Score Threshold"}),(0,t.jsx)(E.Tooltip,{title:"Minimum similarity score to route to this model (0-1)",children:(0,t.jsx)(w.InfoCircleOutlined,{className:"text-gray-400"})})]}),(0,t.jsx)(em.InputNumber,{value:e.score_threshold,onChange:t=>c(e.id,"score_threshold",t||0),min:0,max:1,step:.1,style:{width:"100%"},placeholder:"0.5"})]}),(0,t.jsxs)("div",{className:"w-full",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,t.jsx)(tn,{className:"text-sm font-medium",children:"Example Utterances"}),(0,t.jsx)(E.Tooltip,{title:"Training examples for this route. Type an utterance and press Enter to add it.",children:(0,t.jsx)(w.InfoCircleOutlined,{className:"text-gray-400"})})]}),(0,t.jsx)(tn,{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,t.jsx)(U.Select,{mode:"tags",value:e.utterances,onChange:t=>c(e.id,"utterances",t),placeholder:"Type an utterance and press Enter...",style:{width:"100%"},tokenSeparators:["\n"],maxTagCount:"responsive",allowClear:!0})]})]},e.id)}))}),(0,t.jsx)(I.Divider,{}),(0,t.jsxs)("div",{className:"flex justify-between items-center mb-4 w-full",children:[(0,t.jsx)(tn,{className:"text-lg font-semibold",children:"JSON Preview"}),(0,t.jsx)(G.Button,{type:"link",onClick:()=>o(!i),className:"text-blue-600 p-0",children:i?"Hide":"Show"})]}),i&&(0,t.jsx)(eg.Card,{className:"bg-gray-50 w-full",children:(0,t.jsx)("pre",{className:"text-sm overflow-auto max-h-64 w-full",children:JSON.stringify({routes:a.map(e=>({name:e.model,utterances:e.utterances,description:e.description,score_threshold:e.score_threshold}))},null,2)})})]})},{Text:tm}=L.Typography,tu={SIMPLE:{label:"Simple",description:"Basic questions, greetings, simple factual queries",examples:'"Hello!", "What is Python?", "Thanks!"'},MEDIUM:{label:"Medium",description:"Standard queries requiring some reasoning or explanation",examples:'"Explain how REST APIs work", "Debug this error"'},COMPLEX:{label:"Complex",description:"Technical, multi-part requests requiring deep knowledge",examples:'"Design a microservices architecture", "Implement a rate limiter"'},REASONING:{label:"Reasoning",description:"Chain-of-thought, analysis, explicit reasoning requests",examples:'"Think step by step...", "Analyze the pros and cons..."'}},th=({modelInfo:e,value:l,onChange:s})=>{let a=e.map(e=>({value:e.model_group,label:e.model_group}));return(0,t.jsxs)("div",{className:"w-full max-w-none",children:[(0,t.jsxs)(A.Space,{align:"center",style:{marginBottom:16},children:[(0,t.jsx)(L.Typography.Title,{level:4,style:{margin:0},children:"Complexity Tier Configuration"}),(0,t.jsx)(E.Tooltip,{title:"Map each complexity tier to a model. Simple queries use cheaper/faster models, complex queries use more capable models.",children:(0,t.jsx)(w.InfoCircleOutlined,{className:"text-gray-400"})})]}),(0,t.jsx)(tm,{type:"secondary",style:{display:"block",marginBottom:24},children:"The complexity router automatically classifies requests by complexity using rule-based scoring (no API calls, <1ms latency). Configure which model handles each tier."}),(0,t.jsx)(eg.Card,{children:Object.keys(tu).map((e,r)=>{let i=tu[e];return(0,t.jsxs)("div",{children:[r>0&&(0,t.jsx)(I.Divider,{style:{margin:"16px 0"}}),(0,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,t.jsxs)(tm,{strong:!0,style:{fontSize:16},children:[i.label," Tier"]}),(0,t.jsx)(E.Tooltip,{title:i.description,children:(0,t.jsx)(w.InfoCircleOutlined,{className:"text-gray-400"})})]}),(0,t.jsxs)(tm,{type:"secondary",style:{display:"block",marginBottom:8,fontSize:12},children:["Examples: ",i.examples]}),(0,t.jsx)(U.Select,{value:l[e],onChange:t=>{s({...l,[e]:t})},placeholder:`Select model for ${i.label.toLowerCase()} queries`,showSearch:!0,style:{width:"100%"},options:a})]})]},e)})}),(0,t.jsx)(I.Divider,{}),(0,t.jsxs)(eg.Card,{className:"bg-gray-50",children:[(0,t.jsx)(tm,{strong:!0,style:{display:"block",marginBottom:8},children:"How Classification Works"}),(0,t.jsx)(tm,{type:"secondary",style:{fontSize:13},children:"The router scores each request across 7 dimensions: token count, code presence, reasoning markers, technical terms, simple indicators, multi-step patterns, and question complexity. The weighted score determines the tier:"}),(0,t.jsxs)("ul",{style:{marginTop:8,marginBottom:0,paddingLeft:20,fontSize:13,color:"rgba(0, 0, 0, 0.45)"},children:[(0,t.jsxs)("li",{children:[(0,t.jsx)("strong",{children:"SIMPLE"}),": Score < 0.15"]}),(0,t.jsxs)("li",{children:[(0,t.jsx)("strong",{children:"MEDIUM"}),": Score 0.15 - 0.35"]}),(0,t.jsxs)("li",{children:[(0,t.jsx)("strong",{children:"COMPLEX"}),": Score 0.35 - 0.60"]}),(0,t.jsxs)("li",{children:[(0,t.jsx)("strong",{children:"REASONING"}),": Score > 0.60 (or 2+ reasoning markers)"]})]})]})]})};var tx=e.i(962944);let tp={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M740 161c-61.8 0-112 50.2-112 112 0 50.1 33.1 92.6 78.5 106.9v95.9L320 602.4V318.1c44.2-15 76-56.9 76-106.1 0-61.8-50.2-112-112-112s-112 50.2-112 112c0 49.2 31.8 91 76 106.1V706c-44.2 15-76 56.9-76 106.1 0 61.8 50.2 112 112 112s112-50.2 112-112c0-49.2-31.8-91-76-106.1v-27.8l423.5-138.7a50.52 50.52 0 0034.9-48.2V378.2c42.9-15.8 73.6-57 73.6-105.2 0-61.8-50.2-112-112-112zm-504 51a48.01 48.01 0 0196 0 48.01 48.01 0 01-96 0zm96 600a48.01 48.01 0 01-96 0 48.01 48.01 0 0196 0zm408-491a48.01 48.01 0 010-96 48.01 48.01 0 010 96z"}}]},name:"branches",theme:"outlined"};var tg=x.forwardRef(function(e,t){return x.createElement(ev.default,(0,ey.default)({},e,{ref:t,icon:tp}))});let{Title:tf,Link:tj}=L.Typography,t_=({form:e,handleOk:s,accessToken:a,userRole:r})=>{let[i,o]=(0,x.useState)(!1),[n,d]=(0,x.useState)(!1),[c,m]=(0,x.useState)(""),[u,h]=(0,x.useState)([]),[p,g]=(0,x.useState)([]),[f,j]=(0,x.useState)(!1),[_,y]=(0,x.useState)(!1),[b,v]=(0,x.useState)("complexity"),[N,w]=(0,x.useState)(null),[C,S]=(0,x.useState)({SIMPLE:"",MEDIUM:"",COMPLEX:"",REASONING:""});(0,x.useEffect)(()=>{(async()=>{h((await (0,l.modelAvailableCall)(a,"","",!1,null,!0,!0)).data.map(e=>e.id))})()},[a]),(0,x.useEffect)(()=>{(async()=>{try{let e=await (0,ts.fetchAvailableModels)(a);console.log("Fetched models for auto router:",e),g(e)}catch(e){console.error("Error fetching model info for auto router:",e)}})()},[a]);let k=eX.all_admin_roles.includes(r),T=async()=>{d(!0),m(`test-${Date.now()}`),o(!0)},F=()=>{console.log("Auto router submit triggered!"),console.log("Router type:",b);let t=e.getFieldsValue();if(console.log("Form values:",t),!t.auto_router_name)return void Y.default.fromBackend("Please enter an Auto Router Name");if("complexity"===b){if(0===Object.values(C).filter(Boolean).length)return void Y.default.fromBackend("Please select at least one model for a complexity tier");let l=C.MEDIUM||C.SIMPLE||C.COMPLEX||C.REASONING;e.setFieldsValue({custom_llm_provider:"auto_router",model:t.auto_router_name,api_key:"not_required_for_auto_router",auto_router_default_model:l}),e.validateFields(["auto_router_name"]).then(r=>{console.log("Complexity router validation passed");let i={...r,auto_router_name:t.auto_router_name,auto_router_default_model:l,model_type:"complexity_router",complexity_router_config:{tiers:C},model_access_group:t.model_access_group};console.log("Final submit values:",i),tl(i,a,e,s)}).catch(e=>{console.error("Validation failed:",e),Y.default.fromBackend("Please fill in all required fields")})}else{if(!t.auto_router_default_model)return void Y.default.fromBackend("Please select a Default Model");if(e.setFieldsValue({custom_llm_provider:"auto_router",model:t.auto_router_name,api_key:"not_required_for_auto_router"}),!N||!N.routes||0===N.routes.length)return void Y.default.fromBackend("Please configure at least one route for the auto router");if(N.routes.filter(e=>!e.name||!e.description||0===e.utterances.length).length>0)return void Y.default.fromBackend("Please ensure all routes have a target model, description, and at least one utterance");e.validateFields().then(t=>{console.log("Form validation passed, submitting with values:",t);let l={...t,auto_router_config:N,model_type:"semantic_router"};console.log("Final submit values:",l),tl(l,a,e,s)}).catch(e=>{console.error("Validation failed:",e);let t=e.errorFields||[];if(t.length>0){let e=t.map(e=>{let t=e.name[0];return({auto_router_name:"Auto Router Name",auto_router_default_model:"Default Model",auto_router_embedding_model:"Embedding Model"})[t]||t});Y.default.fromBackend(`Please fill in the following required fields: ${e.join(", ")}`)}else Y.default.fromBackend("Please fill in all required fields")})}};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(tf,{level:2,children:"Add Auto Router"}),(0,t.jsx)(ed.Text,{className:"text-gray-600 mb-6",children:"Create an auto router that automatically selects the best model based on request complexity or semantic matching."}),(0,t.jsx)(eg.Card,{className:"mb-4",children:(0,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsx)(ed.Text,{className:"text-sm font-medium mb-2 block",children:"Router Type"}),(0,t.jsx)(e8.Radio.Group,{value:b,onChange:e=>v(e.target.value),className:"w-full",children:(0,t.jsxs)(A.Space,{direction:"vertical",className:"w-full",children:[(0,t.jsxs)(e8.Radio,{value:"complexity",className:"w-full",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(tx.ThunderboltOutlined,{className:"text-yellow-500"}),(0,t.jsx)("span",{className:"font-medium",children:"Complexity Router"}),(0,t.jsx)($.Badge,{count:"Recommended",style:{backgroundColor:"#52c41a",fontSize:"10px",padding:"0 6px"}})]}),(0,t.jsxs)("div",{className:"text-xs text-gray-500 ml-6 mt-1",children:["Automatically routes based on request complexity. No training data needed — just pick 4 models and go.",(0,t.jsx)("br",{}),(0,t.jsx)("span",{className:"text-green-600",children:"✓ Zero API calls"})," · ",(0,t.jsx)("span",{className:"text-green-600",children:"✓ <1ms latency"})," · ",(0,t.jsx)("span",{className:"text-green-600",children:"✓ No cost"})]})]}),(0,t.jsxs)(e8.Radio,{value:"semantic",className:"w-full mt-2",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(tg,{className:"text-blue-500"}),(0,t.jsx)("span",{className:"font-medium",children:"Semantic Router"})]}),(0,t.jsx)("div",{className:"text-xs text-gray-500 ml-6 mt-1",children:"Routes based on semantic similarity to example utterances. Requires embedding model and training examples."})]})]})})]})}),(0,t.jsx)(eg.Card,{children:(0,t.jsxs)(Z.Form,{form:e,onFinish:F,labelCol:{span:10},wrapperCol:{span:16},labelAlign:"left",children:[(0,t.jsx)(Z.Form.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,t.jsx)(eL.TextInput,{placeholder:"e.g., smart_router, auto_router_1"})}),"complexity"===b?(0,t.jsx)("div",{className:"w-full mb-4",children:(0,t.jsx)(th,{modelInfo:p,value:C,onChange:e=>{S(e)}})}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"w-full mb-4",children:(0,t.jsx)(tc,{modelInfo:p,value:N,onChange:t=>{w(t),e.setFieldValue("auto_router_config",t)}})}),(0,t.jsx)(Z.Form.Item,{rules:[{required:"semantic"===b,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,t.jsx)(U.Select,{placeholder:"Select a default model",onChange:e=>{j("custom"===e)},options:[...Array.from(new Set(p.map(e=>e.model_group))).map(e=>({value:e,label:e})),{value:"custom",label:"Enter custom model name"}],style:{width:"100%"},showSearch:!0})}),(0,t.jsx)(Z.Form.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,t.jsx)(U.Select,{value:e.getFieldValue("auto_router_embedding_model"),placeholder:"Select an embedding model (optional)",onChange:t=>{y("custom"===t),e.setFieldValue("auto_router_embedding_model",t)},options:[...Array.from(new Set(p.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,t.jsxs)("div",{className:"flex items-center my-4",children:[(0,t.jsx)("div",{className:"flex-grow border-t border-gray-200"}),(0,t.jsx)("span",{className:"px-4 text-gray-500 text-sm",children:"Additional Settings"}),(0,t.jsx)("div",{className:"flex-grow border-t border-gray-200"})]}),k&&(0,t.jsx)(Z.Form.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,t.jsx)(U.Select,{mode:"tags",showSearch:!0,placeholder:"Select existing groups or type to create new ones",optionFilterProp:"children",tokenSeparators:[","],options:u.map(e=>({value:e,label:e})),maxTagCount:"responsive",allowClear:!0})}),(0,t.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,t.jsx)(E.Tooltip,{title:"Get help on our github",children:(0,t.jsx)(L.Typography.Link,{href:"https://github.com/BerriAI/litellm/issues",children:"Need Help?"})}),(0,t.jsxs)("div",{className:"space-x-2",children:[(0,t.jsx)(G.Button,{onClick:T,loading:n,children:"Test Connection"}),(0,t.jsx)(G.Button,{type:"primary",onClick:()=>{console.log("Add Auto Router button clicked!"),F()},children:"Add Auto Router"})]})]})]})}),(0,t.jsx)(ee.Modal,{title:"Connection Test Results",open:i,onCancel:()=>{o(!1),d(!1)},footer:[(0,t.jsx)(G.Button,{onClick:()=>{o(!1),d(!1)},children:"Close"},"close")],width:700,children:i&&(0,t.jsx)(tt,{formValues:e.getFieldsValue(),accessToken:a,testMode:"chat",modelName:e.getFieldValue("auto_router_name"),onClose:()=>{o(!1),d(!1)},onTestComplete:()=>d(!1)},c)})]})},ty=(0,a.createQueryKeys)("guardrails"),tb=(0,a.createQueryKeys)("tags");var tv=e.i(793130),tN=e.i(560445),tw=e.i(663435),tC=e.i(677667),tS=e.i(898667),tk=e.i(130643),tT=e.i(635432),tF=e.i(564897),tI=e.i(435451);let{Text:tP}=L.Typography,tM=({form:e,showCacheControl:l,onCacheControlChange:s})=>{let a=t=>{let l=e.getFieldValue("litellm_extra_params");try{let s=l?JSON.parse(l):{};t.length>0?s.cache_control_injection_points=t:delete s.cache_control_injection_points,Object.keys(s).length>0?e.setFieldValue("litellm_extra_params",JSON.stringify(s,null,2)):e.setFieldValue("litellm_extra_params","")}catch(e){console.error("Error updating cache control points:",e)}};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(Z.Form.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,t.jsx)(et.Switch,{onChange:s,className:"bg-gray-600"})}),l&&(0,t.jsxs)("div",{className:"ml-6 pl-4 border-l-2 border-gray-200",children:[(0,t.jsx)(tP,{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,t.jsx)(Z.Form.List,{name:"cache_control_injection_points",initialValue:[{location:"message"}],children:(l,{add:s,remove:r})=>(0,t.jsxs)(t.Fragment,{children:[l.map((s,i)=>(0,t.jsxs)("div",{className:"flex items-center mb-4 gap-4",children:[(0,t.jsx)(Z.Form.Item,{...s,label:"Type",name:[s.name,"location"],initialValue:"message",className:"mb-0",style:{width:"180px"},children:(0,t.jsx)(U.Select,{disabled:!0,options:[{value:"message",label:"Message"}]})}),(0,t.jsx)(Z.Form.Item,{...s,label:"Role",name:[s.name,"role"],className:"mb-0",style:{width:"180px"},tooltip:"LiteLLM will mark all messages of this role as cacheable",children:(0,t.jsx)(U.Select,{placeholder:"Select a role",allowClear:!0,options:[{value:"user",label:"User"},{value:"system",label:"System"},{value:"assistant",label:"Assistant"}],onChange:()=>{a(e.getFieldValue("cache_control_points"))}})}),(0,t.jsx)(Z.Form.Item,{...s,label:"Index",name:[s.name,"index"],className:"mb-0",style:{width:"180px"},tooltip:"(Optional) If set litellm will mark the message at this index as cacheable",children:(0,t.jsx)(tI.default,{type:"number",placeholder:"Optional",step:1,onChange:()=>{a(e.getFieldValue("cache_control_points"))}})}),l.length>1&&(0,t.jsx)(tF.MinusCircleOutlined,{className:"text-red-500 cursor-pointer text-lg ml-12",onClick:()=>{r(s.name),setTimeout(()=>{a(e.getFieldValue("cache_control_points"))},0)}})]},s.key)),(0,t.jsx)(Z.Form.Item,{children:(0,t.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:()=>s(),children:[(0,t.jsx)(tr.PlusOutlined,{className:"mr-2"}),"Add Injection Point"]})})]})})]})]})};var tA=e.i(122550);let{Link:tE}=L.Typography,tL=({showAdvancedSettings:e,setShowAdvancedSettings:l,teams:s,guardrailsList:a,tagsList:r})=>{let[i]=Z.Form.useForm(),[o,n]=x.default.useState(!1),[d,c]=x.default.useState("per_token"),[m,u]=x.default.useState(!1),h=(e,t)=>t&&(isNaN(Number(t))||0>Number(t))?Promise.reject("Please enter a valid positive number"):Promise.resolve();return(0,t.jsx)(t.Fragment,{children:(0,t.jsxs)(tC.Accordion,{className:"mt-2 mb-4",children:[(0,t.jsx)(tS.AccordionHeader,{children:(0,t.jsx)("b",{children:"Advanced Settings"})}),(0,t.jsx)(tk.AccordionBody,{children:(0,t.jsxs)("div",{className:"bg-white rounded-lg",children:[(0,t.jsx)(Z.Form.Item,{label:"Custom Pricing",name:"custom_pricing",valuePropName:"checked",className:"mb-4",children:(0,t.jsx)(et.Switch,{onChange:e=>{n(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,t.jsx)(Z.Form.Item,{label:(0,t.jsxs)("span",{children:["Guardrails"," ",(0,t.jsx)(E.Tooltip,{title:"Apply safety guardrails to this key to filter content or enforce policies",children:(0,t.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/guardrails/quick_start",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:(0,t.jsx)(w.InfoCircleOutlined,{style:{marginLeft:"4px"}})})})]}),name:"guardrails",className:"mt-4",help:"Select existing guardrails. Go to 'Guardrails' tab to create new guardrails.",children:(0,t.jsx)(U.Select,{mode:"tags",style:{width:"100%"},placeholder:"Select or enter guardrails",options:a.map(e=>({value:e,label:e}))})}),(0,t.jsx)(Z.Form.Item,{label:"Tags",name:"tags",className:"mb-4",children:(0,t.jsx)(U.Select,{mode:"tags",style:{width:"100%"},placeholder:"Select or enter tags",options:Object.values(r).map(e=>({value:e.name,label:e.name,title:e.description||e.name}))})}),o&&(0,t.jsxs)("div",{className:"ml-6 pl-4 border-l-2 border-gray-200",children:[(0,t.jsx)(Z.Form.Item,{label:"Pricing Model",name:"pricing_model",className:"mb-4",children:(0,t.jsx)(U.Select,{defaultValue:"per_token",onChange:e=>c(e),options:[{value:"per_token",label:"Per Million Tokens"},{value:"per_second",label:"Per Second"}]})}),"per_token"===d?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(Z.Form.Item,{label:"Input Cost (per 1M tokens)",name:"input_cost_per_token",rules:[{validator:h}],className:"mb-4",children:(0,t.jsx)(eL.TextInput,{})}),(0,t.jsx)(Z.Form.Item,{label:"Output Cost (per 1M tokens)",name:"output_cost_per_token",rules:[{validator:h}],className:"mb-4",children:(0,t.jsx)(eL.TextInput,{})})]}):(0,t.jsx)(Z.Form.Item,{label:"Cost Per Second",name:"input_cost_per_second",rules:[{validator:h}],className:"mb-4",children:(0,t.jsx)(eL.TextInput,{})})]}),(0,t.jsx)(Z.Form.Item,{label:"Use in pass through routes",name:"use_in_pass_through",valuePropName:"checked",className:"mb-4 mt-4",tooltip:(0,t.jsxs)("span",{children:["Allow using these credentials in pass through routes."," ",(0,t.jsx)(tE,{href:"https://docs.litellm.ai/docs/pass_through/vertex_ai",target:"_blank",children:"Learn more"})]}),children:(0,t.jsx)(et.Switch,{onChange:e=>{let t=i.getFieldValue("litellm_extra_params");try{let l=t?JSON.parse(t):{};e?l.use_in_pass_through=!0:delete l.use_in_pass_through,Object.keys(l).length>0?i.setFieldValue("litellm_extra_params",JSON.stringify(l,null,2)):i.setFieldValue("litellm_extra_params","")}catch(t){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,t.jsx)(tM,{form:i,showCacheControl:m,onCacheControlChange:e=>{if(u(e),!e){let e=i.getFieldValue("litellm_extra_params");try{let t=e?JSON.parse(e):{};delete t.cache_control_injection_points,Object.keys(t).length>0?i.setFieldValue("litellm_extra_params",JSON.stringify(t,null,2)):i.setFieldValue("litellm_extra_params","")}catch(e){i.setFieldValue("litellm_extra_params","")}}}}),(0,t.jsx)(Z.Form.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:tA.formItemValidateJSON}],children:(0,t.jsx)(tT.default,{rows:4,placeholder:'{ "rpm": 100, "timeout": 0, "stream_timeout": 0 }'})}),(0,t.jsxs)(eV.Row,{className:"mb-4",children:[(0,t.jsx)(ez.Col,{span:10}),(0,t.jsx)(ez.Col,{span:10,children:(0,t.jsxs)(ed.Text,{className:"text-gray-600 text-sm",children:["Pass JSON of litellm supported params"," ",(0,t.jsx)(tE,{href:"https://docs.litellm.ai/docs/completion/input",target:"_blank",children:"litellm.completion() call"})]})})]}),(0,t.jsx)(Z.Form.Item,{label:"Model Info",name:"model_info_params",tooltip:"Optional model info params. Returned when calling `/model/info` endpoint.",className:"mb-0",rules:[{validator:tA.formItemValidateJSON}],children:(0,t.jsx)(tT.default,{rows:4,placeholder:'{ "mode": "chat" }'})})]})})]})})};var tR=e.i(291542),tO=e.i(750113);let tB=({content:e,children:l,width:s="auto",className:a=""})=>{let[r,i]=(0,x.useState)(!1),[o,n]=(0,x.useState)("top"),d=(0,x.useRef)(null);return(0,t.jsxs)("div",{className:"relative inline-block",ref:d,children:[l||(0,t.jsx)(tO.QuestionCircleOutlined,{className:"ml-1 text-gray-500 cursor-help",onMouseEnter:()=>{if(d.current){let e=d.current.getBoundingClientRect(),t=e.top,l=window.innerHeight-e.bottom;t<300&&l>300?n("bottom"):n("top")}i(!0)},onMouseLeave:()=>i(!1)}),r&&(0,t.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 ${a}`,style:{["top"===o?"bottom":"top"]:"100%",width:s,marginBottom:"top"===o?"8px":"0",marginTop:"bottom"===o?"8px":"0"},children:[e,(0,t.jsx)("div",{className:"absolute left-1/2 -translate-x-1/2 w-0 h-0",style:{top:"top"===o?"100%":"auto",bottom:"bottom"===o?"100%":"auto",borderTop:"top"===o?"6px solid rgba(0, 0, 0, 0.9)":"6px solid transparent",borderBottom:"bottom"===o?"6px solid rgba(0, 0, 0, 0.9)":"6px solid transparent",borderLeft:"6px solid transparent",borderRight:"6px solid transparent"}})]})]})},tz=()=>{let e=Z.Form.useFormInstance(),[l,s]=(0,x.useState)(0),a=Z.Form.useWatch("model",e)||[],r=Array.isArray(a)?a:[a],i=Z.Form.useWatch("custom_model_name",e),o=!r.includes("all-wildcard"),n=Z.Form.useWatch("custom_llm_provider",e);if((0,x.useEffect)(()=>{if(i&&r.includes("custom")){let t=(e.getFieldValue("model_mappings")||[]).map(e=>"custom"===e.public_name||"custom"===e.litellm_model?n===eF.Providers.Azure?{public_name:i,litellm_model:`azure/${i}`}:{public_name:i,litellm_model:i}:e);e.setFieldValue("model_mappings",t),s(e=>e+1)}},[i,r,n,e]),(0,x.useEffect)(()=>{if(r.length>0&&!r.includes("all-wildcard")){let t=e.getFieldValue("model_mappings")||[];if(t.length!==r.length||!r.every(e=>t.some(t=>"custom"===e?"custom"===t.litellm_model||t.litellm_model===i:n===eF.Providers.Azure?t.litellm_model===`azure/${e}`:t.litellm_model===e))){let t=r.map(e=>"custom"===e&&i?n===eF.Providers.Azure?{public_name:i,litellm_model:`azure/${i}`}:{public_name:i,litellm_model:i}:n===eF.Providers.Azure?{public_name:e,litellm_model:`azure/${e}`}:{public_name:e,litellm_model:e});e.setFieldValue("model_mappings",t),s(e=>e+1)}}},[r,i,n,e]),!o)return null;let d=(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"mb-2 font-normal",children:"The name you specify in your API calls to LiteLLM Proxy"}),(0,t.jsxs)("div",{className:"mb-2 font-normal",children:[(0,t.jsx)("strong",{children:"Example:"})," If you name your public model"," ",(0,t.jsx)("code",{className:"bg-gray-700 px-1 py-0.5 rounded text-xs",children:"example-name"}),", and choose"," ",(0,t.jsx)("code",{className:"bg-gray-700 px-1 py-0.5 rounded text-xs",children:"openai/qwen-plus-latest"})," as the LiteLLM model"]}),(0,t.jsxs)("div",{className:"mb-2 font-normal",children:[(0,t.jsx)("strong",{children:"Usage:"})," You make an API call to the LiteLLM proxy with"," ",(0,t.jsx)("code",{className:"bg-gray-700 px-1 py-0.5 rounded text-xs",children:'model = "example-name"'})]}),(0,t.jsxs)("div",{className:"font-normal",children:[(0,t.jsx)("strong",{children:"Result:"})," LiteLLM sends"," ",(0,t.jsx)("code",{className:"bg-gray-700 px-1 py-0.5 rounded text-xs",children:"qwen-plus-latest"})," to the provider"]})]}),c=(0,t.jsx)("div",{children:"The model name LiteLLM will send to the LLM API"}),m=[{title:(0,t.jsxs)("span",{className:"flex items-center",children:["Public Model Name",(0,t.jsx)(tB,{content:d,width:"500px"})]}),dataIndex:"public_name",key:"public_name",render:(l,s,a)=>(0,t.jsx)(eL.TextInput,{value:l,onChange:t=>{let l=t.target.value,s=[...e.getFieldValue("model_mappings")],r=n===eF.Providers.Anthropic,i=l.endsWith("-1m"),o=e.getFieldValue("litellm_extra_params"),d=!o||""===o.trim(),c=l;if(r&&i&&d){let t=JSON.stringify({extra_headers:{"anthropic-beta":"context-1m-2025-08-07"}},null,2);e.setFieldValue("litellm_extra_params",t),c=l.slice(0,-3)}s[a].public_name=c,e.setFieldValue("model_mappings",s)}})},{title:(0,t.jsxs)("span",{className:"flex items-center",children:["LiteLLM Model Name",(0,t.jsx)(tB,{content:c,width:"360px"})]}),dataIndex:"litellm_model",key:"litellm_model"}];return(0,t.jsx)(t.Fragment,{children:(0,t.jsx)(Z.Form.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,t)=>{if(!t||0===t.length)throw Error("At least one model mapping is required");if(t.filter(e=>!e.public_name||""===e.public_name.trim()).length>0)throw Error("All model mappings must have valid public names")}}],children:(0,t.jsx)(tR.Table,{dataSource:e.getFieldValue("model_mappings"),columns:m,pagination:!1,size:"small"},l)})})},tq=({selectedProvider:e,providerModels:l,getPlaceholder:s})=>{let a=Z.Form.useFormInstance(),r=t=>{let l=t.target.value,s=(a.getFieldValue("model_mappings")||[]).map(t=>"custom"===t.public_name||"custom"===t.litellm_model?e===eF.Providers.Azure?{public_name:l,litellm_model:`azure/${l}`}:{public_name:l,litellm_model:l}:t);a.setFieldsValue({model_mappings:s})};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(Z.Form.Item,{label:"LiteLLM Model Name(s)",tooltip:"The model name LiteLLM will send to the LLM API",className:"mb-0",children:[(0,t.jsx)(Z.Form.Item,{name:"model",rules:[{required:!0,message:`Please enter ${e===eF.Providers.Azure?"a deployment name":"at least one model"}.`}],noStyle:!0,children:e===eF.Providers.Azure||e===eF.Providers.OpenAI_Compatible||e===eF.Providers.Ollama?(0,t.jsx)(t.Fragment,{children:(0,t.jsx)(eL.TextInput,{placeholder:s(e),onChange:e===eF.Providers.Azure?e=>{let t=e.target.value,l=t?[{public_name:t,litellm_model:`azure/${t}`}]:[];a.setFieldsValue({model:t,model_mappings:l})}:void 0})}):l.length>0?(0,t.jsx)(U.Select,{mode:"multiple",allowClear:!0,showSearch:!0,placeholder:"Select models",onChange:t=>{let l=Array.isArray(t)?t:[t];if(l.includes("all-wildcard"))a.setFieldsValue({model_name:void 0,model_mappings:[]});else if(JSON.stringify(a.getFieldValue("model"))!==JSON.stringify(l)){let t=l.map(t=>e===eF.Providers.Azure?{public_name:t,litellm_model:`azure/${t}`}:{public_name:t,litellm_model:t});a.setFieldsValue({model:l,model_mappings:t})}},optionFilterProp:"children",filterOption:(e,t)=>(t?.label??"").toLowerCase().includes(e.toLowerCase()),options:[{label:"Custom Model Name (Enter below)",value:"custom"},{label:`All ${e} Models (Wildcard)`,value:"all-wildcard"},...l.map(e=>({label:e,value:e}))],style:{width:"100%"}}):(0,t.jsx)(eL.TextInput,{placeholder:s(e)})}),(0,t.jsx)(Z.Form.Item,{noStyle:!0,shouldUpdate:(e,t)=>e.model!==t.model,children:({getFieldValue:l})=>{let s=l("model")||[];return(Array.isArray(s)?s:[s]).includes("custom")&&(0,t.jsx)(Z.Form.Item,{name:"custom_model_name",rules:[{required:!0,message:"Please enter a custom model name."}],className:"mt-2",children:(0,t.jsx)(eL.TextInput,{placeholder:e===eF.Providers.Azure?"Enter Azure deployment name":"Enter custom model name",onChange:r})})}})]}),(0,t.jsxs)(eV.Row,{children:[(0,t.jsx)(ez.Col,{span:10}),(0,t.jsx)(ez.Col,{span:14,children:(0,t.jsx)(ed.Text,{className:"mb-3 mt-1",children:e===eF.Providers.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"})})]})]})},tV=[{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:"video_generation",label:"Video Generation - /videos"},{value:"rerank",label:"Rerank - /rerank"},{value:"realtime",label:"Realtime - /realtime"},{value:"batch",label:"Batch - /batch"},{value:"ocr",label:"OCR - /ocr"}],{Title:tD,Link:tH}=L.Typography,t$=({form:e,handleOk:a,selectedProvider:i,setSelectedProvider:o,providerModels:n,setProviderModelsFn:d,getPlaceholder:c,uploadProps:m,showAdvancedSettings:u,setShowAdvancedSettings:h,teams:p,credentials:g})=>{let[f,j]=(0,x.useState)("chat"),[_,y]=(0,x.useState)(!1),[b,v]=(0,x.useState)(!1),[N,w]=(0,x.useState)(""),{accessToken:C,userRole:S,premiumUser:k,userId:T}=(0,r.default)(),{data:F,isLoading:I,error:P}=eO(),{data:M,isLoading:A,error:O}=(()=>{let{accessToken:e,userId:t,userRole:a}=(0,r.default)();return(0,s.useQuery)({queryKey:ty.list({}),queryFn:async()=>(await (0,l.getGuardrailsList)(e)).guardrails.map(e=>e.guardrail_name),enabled:!!(e&&t&&a)})})(),{data:B,isLoading:z,error:q}=(()=>{let{accessToken:e,userId:t,userRole:a}=(0,r.default)();return(0,s.useQuery)({queryKey:tb.list({}),queryFn:async()=>await (0,l.tagListCall)(e),enabled:!!(e&&t&&a)})})(),V=async()=>{v(!0),w(`test-${Date.now()}`),y(!0)},[D,H]=(0,x.useState)(!1),[$,J]=(0,x.useState)([]),[K,W]=(0,x.useState)(null);(0,x.useEffect)(()=>{(async()=>{J((await (0,l.modelAvailableCall)(C,"","",!1,null,!0,!0)).data.map(e=>e.id))})()},[C]);let Q=(0,x.useMemo)(()=>F?[...F].sort((e,t)=>e.provider_display_name.localeCompare(t.provider_display_name)):[],[F]),Y=P?P instanceof Error?P.message:"Failed to load providers":null,X=eX.all_admin_roles.includes(S),et=(0,eX.isUserTeamAdminForAnyTeam)(p,T);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(tD,{level:2,children:"Add Model"}),(0,t.jsx)(eg.Card,{children:(0,t.jsx)(Z.Form,{form:e,onFinish:async e=>{console.log("🔥 Form onFinish triggered with values:",e),await a().then(()=>{W(null)})},onFinishFailed:e=>{console.log("💥 Form onFinishFailed triggered:",e)},labelCol:{span:10},wrapperCol:{span:16},labelAlign:"left",children:(0,t.jsxs)(t.Fragment,{children:[et&&!X&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(Z.Form.Item,{label:"Select Team",name:"team_id",rules:[{required:!0,message:"Please select a team to continue"}],tooltip:"Select the team for which you want to add this model",children:(0,t.jsx)(tw.default,{teams:p,onChange:e=>{W(e)}})}),!K&&(0,t.jsx)(tN.Alert,{message:"Team Selection Required",description:"As a team admin, you need to select your team first before adding models.",type:"info",showIcon:!0,className:"mb-4"})]}),(X||et&&K)&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(Z.Form.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,t.jsxs)(U.Select,{virtual:!1,showSearch:!0,loading:I,placeholder:I?"Loading providers...":"Select a provider",optionFilterProp:"data-label",onChange:t=>{o(t),d(t),e.setFieldsValue({custom_llm_provider:t}),e.setFieldsValue({model:[],model_name:void 0})},children:[Y&&0===Q.length&&(0,t.jsx)(U.Select.Option,{value:"",children:Y},"__error"),Q.map(e=>{let l=e.provider_display_name,s=e.provider;return eF.providerLogoMap[l],(0,t.jsx)(U.Select.Option,{value:s,"data-label":l,children:(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)(R.ProviderLogo,{provider:s,className:"w-5 h-5"}),(0,t.jsx)("span",{children:l})]})},s)})]})}),(0,t.jsx)(tq,{selectedProvider:i,providerModels:n,getPlaceholder:c}),(0,t.jsx)(tz,{}),(0,t.jsx)(Z.Form.Item,{label:"Mode",name:"mode",className:"mb-1",children:(0,t.jsx)(U.Select,{style:{width:"100%"},value:f,onChange:e=>j(e),options:tV})}),(0,t.jsxs)(eV.Row,{children:[(0,t.jsx)(ez.Col,{span:10}),(0,t.jsx)(ez.Col,{span:10,children:(0,t.jsxs)(ed.Text,{className:"mb-5 mt-1",children:[(0,t.jsx)("strong",{children:"Optional"})," - LiteLLM endpoint to use when health checking this model"," ",(0,t.jsx)(tH,{href:"https://docs.litellm.ai/docs/proxy/health#health",target:"_blank",children:"Learn more"})]})})]}),(0,t.jsx)("div",{className:"mb-4",children:(0,t.jsx)(L.Typography.Text,{className:"text-sm text-gray-500 mb-2",children:"Either select existing credentials OR enter new provider credentials below"})}),(0,t.jsx)(Z.Form.Item,{label:"Existing Credentials",name:"litellm_credential_name",initialValue:null,children:(0,t.jsx)(U.Select,{showSearch:!0,placeholder:"Select or search for existing credentials",optionFilterProp:"children",filterOption:(e,t)=>(t?.label??"").toLowerCase().includes(e.toLowerCase()),options:[{value:null,label:"None"},...g.map(e=>({value:e.credential_name,label:e.credential_name}))],allowClear:!0})}),(0,t.jsx)(Z.Form.Item,{noStyle:!0,shouldUpdate:(e,t)=>e.litellm_credential_name!==t.litellm_credential_name||e.provider!==t.provider,children:({getFieldValue:e})=>{let l=e("litellm_credential_name");return(console.log("🔑 Credential Name Changed:",l),l)?null:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex items-center my-4",children:[(0,t.jsx)("div",{className:"flex-grow border-t border-gray-200"}),(0,t.jsx)("span",{className:"px-4 text-gray-500 text-sm",children:"OR"}),(0,t.jsx)("div",{className:"flex-grow border-t border-gray-200"})]}),(0,t.jsx)(eU,{selectedProvider:i,uploadProps:m})]})}}),(0,t.jsxs)("div",{className:"flex items-center my-4",children:[(0,t.jsx)("div",{className:"flex-grow border-t border-gray-200"}),(0,t.jsx)("span",{className:"px-4 text-gray-500 text-sm",children:"Additional Model Info Settings"}),(0,t.jsx)("div",{className:"flex-grow border-t border-gray-200"})]}),(X||!et)&&(0,t.jsx)(Z.Form.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,t.jsx)(E.Tooltip,{title:k?"":"This is an enterprise-only feature. Upgrade to premium to restrict model+credential combinations to a specific team.",placement:"top",children:(0,t.jsx)(tv.Switch,{checked:D,onChange:t=>{H(t),t||e.setFieldValue("team_id",void 0)},disabled:!k})})}),D&&(X||!et)&&(0,t.jsx)(Z.Form.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:D&&!X,message:"Please select a team."}],children:(0,t.jsx)(tw.default,{teams:p,disabled:!k})}),X&&(0,t.jsx)(t.Fragment,{children:(0,t.jsx)(Z.Form.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,t.jsx)(U.Select,{mode:"tags",showSearch:!0,placeholder:"Select existing groups or type to create new ones",optionFilterProp:"children",tokenSeparators:[","],options:$.map(e=>({value:e,label:e})),maxTagCount:"responsive",allowClear:!0})})}),(0,t.jsx)(tL,{showAdvancedSettings:u,setShowAdvancedSettings:h,teams:p,guardrailsList:M||[],tagsList:B||{}})]}),(0,t.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,t.jsx)(E.Tooltip,{title:"Get help on our github",children:(0,t.jsx)(L.Typography.Link,{href:"https://github.com/BerriAI/litellm/issues",children:"Need Help?"})}),(0,t.jsxs)("div",{className:"space-x-2",children:[(0,t.jsx)(G.Button,{onClick:V,loading:b,children:"Test Connect"}),(0,t.jsx)(G.Button,{htmlType:"submit",children:"Add Model"})]})]})]})})}),(0,t.jsx)(ee.Modal,{title:"Connection Test Results",open:_,onCancel:()=>{y(!1),v(!1)},footer:[(0,t.jsx)(G.Button,{onClick:()=>{y(!1),v(!1)},children:"Close"},"close")],width:700,children:_&&(0,t.jsx)(tt,{formValues:e.getFieldsValue(),accessToken:C,testMode:f,modelName:e.getFieldValue("model_name")||e.getFieldValue("model"),onClose:()=>{y(!1),v(!1)},onTestComplete:()=>v(!1)},N)})]})},tG=({form:e,handleOk:l,selectedProvider:s,setSelectedProvider:a,providerModels:r,setProviderModelsFn:i,getPlaceholder:o,uploadProps:n,showAdvancedSettings:d,setShowAdvancedSettings:c,teams:m,credentials:u,accessToken:h,userRole:x})=>{let[p]=Z.Form.useForm();return(0,t.jsx)(t.Fragment,{children:(0,t.jsxs)(e4.TabGroup,{className:"w-full",children:[(0,t.jsxs)(e5.TabList,{className:"mb-4",children:[(0,t.jsx)(e2.Tab,{children:"Add Model"}),(0,t.jsx)(e2.Tab,{children:"Add Auto Router"})]}),(0,t.jsxs)(e6.TabPanels,{children:[(0,t.jsx)(H.TabPanel,{children:(0,t.jsx)(t$,{form:e,handleOk:l,selectedProvider:s,setSelectedProvider:a,providerModels:r,setProviderModelsFn:i,getPlaceholder:o,uploadProps:n,showAdvancedSettings:d,setShowAdvancedSettings:c,teams:m,credentials:u})}),(0,t.jsx)(H.TabPanel,{children:(0,t.jsx)(t_,{form:p,handleOk:()=>{p.validateFields().then(e=>{tl(e,h,p,l)}).catch(e=>{console.error("Validation failed:",e)})},accessToken:h,userRole:x})})]})]})})};var tU=e.i(798496),tJ=e.i(536916),tK=e.i(502275),tW=e.i(122577);let tQ=[{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"}],tY=({accessToken:e,modelData:s,all_models_on_proxy:a,getDisplayModelName:r,setSelectedModelId:i,teams:o})=>{let n,d,c,m,[u,h]=(0,x.useState)({}),[p,g]=(0,x.useState)([]),[f,j]=(0,x.useState)(!1),[_,y]=(0,x.useState)(!1),[b,v]=(0,x.useState)(null),[N,w]=(0,x.useState)(!1),[C,S]=(0,x.useState)(null);(0,x.useRef)(null),(0,x.useEffect)(()=>{e&&s?.data&&(async()=>{let t={};s.data.forEach(e=>{let l=e.model_info?.id;l&&(t[l]={status:"none",lastCheck:"None",lastSuccess:"None",loading:!1,error:void 0,fullError:void 0,successResponse:void 0})});try{let a=await (0,l.latestHealthChecksCall)(e);a&&a.latest_health_checks&&"object"==typeof a.latest_health_checks&&Object.entries(a.latest_health_checks).forEach(([e,l])=>{if(!l||!s.data.some(t=>t.model_info?.id===e))return;let a=l.error_message||void 0;t[e]={status:l.status||"unknown",lastCheck:l.checked_at?new Date(l.checked_at).toLocaleString():"None",lastSuccess:"healthy"===l.status&&l.checked_at?new Date(l.checked_at).toLocaleString():"None",loading:!1,error:a?F(a):void 0,fullError:a,successResponse:"healthy"===l.status?l:void 0}})}catch(e){console.warn("Failed to load health check history (using default states):",e)}h(t)})()},[e,s]);let F=e=>{if(!e)return"Health check failed";let t="string"==typeof e?e:JSON.stringify(e),l=t.match(/(\w+Error):\s*(\d{3})/i);if(l)return`${l[1]}: ${l[2]}`;let s=t.match(/(AuthenticationError|RateLimitError|BadRequestError|InternalServerError|TimeoutError|NotFoundError|ForbiddenError|ServiceUnavailableError|BadGatewayError|ContentPolicyViolationError|\w+Error)/i),a=t.match(/\b(400|401|403|404|408|429|500|502|503|504)\b/);if(s&&a)return`${s[1]}: ${a[1]}`;if(a){let e=a[1];return`${({400:"BadRequestError",401:"AuthenticationError",403:"ForbiddenError",404:"NotFoundError",408:"TimeoutError",429:"RateLimitError",500:"InternalServerError",502:"BadGatewayError",503:"ServiceUnavailableError",504:"GatewayTimeoutError"})[e]}: ${e}`}if(s){let e=s[1],t={AuthenticationError:"401",RateLimitError:"429",BadRequestError:"400",InternalServerError:"500",TimeoutError:"408",NotFoundError:"404",ForbiddenError:"403",ServiceUnavailableError:"503",BadGatewayError:"502",GatewayTimeoutError:"504",ContentPolicyViolationError:"400"}[e];return t?`${e}: ${t}`:e}for(let{pattern:e,replacement:l}of tQ)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 r=t.replace(/[\n\r]+/g," ").replace(/\s+/g," ").trim(),i=r.split(/[.!?]/),o=i[0]?.trim();return o&&o.length>0?o.length>100?o.substring(0,97)+"...":o:r.length>100?r.substring(0,97)+"...":r},I=async t=>{if(e){h(e=>({...e,[t]:{...e[t],loading:!0,status:"checking"}}));try{let s=await (0,l.individualModelHealthCheckCall)(e,t),a=new Date().toLocaleString();if(s.unhealthy_count>0&&s.unhealthy_endpoints&&s.unhealthy_endpoints.length>0){let e=s.unhealthy_endpoints[0]?.error||"Health check failed",l=F(e);h(s=>({...s,[t]:{status:"unhealthy",lastCheck:a,lastSuccess:s[t]?.lastSuccess||"None",loading:!1,error:l,fullError:e}}))}else h(e=>({...e,[t]:{status:"healthy",lastCheck:a,lastSuccess:a,loading:!1,successResponse:s}}));try{let s=await (0,l.latestHealthChecksCall)(e),a=s.latest_health_checks?.[t];if(a){let e=a.error_message||void 0;h(l=>({...l,[t]:{status:a.status||l[t]?.status||"unknown",lastCheck:a.checked_at?new Date(a.checked_at).toLocaleString():l[t]?.lastCheck||"None",lastSuccess:"healthy"===a.status&&a.checked_at?new Date(a.checked_at).toLocaleString():l[t]?.lastSuccess||"None",loading:!1,error:e?F(e):l[t]?.error,fullError:e||l[t]?.fullError,successResponse:"healthy"===a.status?a:l[t]?.successResponse}}))}}catch(e){console.debug("Could not fetch updated status from database (non-critical):",e)}}catch(a){let e=new Date().toLocaleString(),l=a instanceof Error?a.message:String(a),s=F(l);h(a=>({...a,[t]:{status:"unhealthy",lastCheck:e,lastSuccess:a[t]?.lastSuccess||"None",loading:!1,error:s,fullError:l}}))}}},P=async()=>{let t=p.length>0?p:a,s=t.reduce((e,t)=>(e[t]={...u[t],loading:!0,status:"checking"},e),{});h(e=>({...e,...s}));let r={},i=t.map(async t=>{if(e)try{let s=await (0,l.individualModelHealthCheckCall)(e,t);r[t]=s;let a=new Date().toLocaleString();if(s.unhealthy_count>0&&s.unhealthy_endpoints&&s.unhealthy_endpoints.length>0){let e=s.unhealthy_endpoints[0]?.error||"Health check failed",l=F(e);h(s=>({...s,[t]:{status:"unhealthy",lastCheck:a,lastSuccess:s[t]?.lastSuccess||"None",loading:!1,error:l,fullError:e}}))}else h(e=>({...e,[t]:{status:"healthy",lastCheck:a,lastSuccess:a,loading:!1,successResponse:s}}))}catch(a){console.error(`Health check failed for model id ${t}:`,a);let e=new Date().toLocaleString(),l=a instanceof Error?a.message:String(a),s=F(l);h(a=>({...a,[t]:{status:"unhealthy",lastCheck:e,lastSuccess:a[t]?.lastSuccess||"None",loading:!1,error:s,fullError:l}}))}});await Promise.allSettled(i);try{if(!e)return;let s=await (0,l.latestHealthChecksCall)(e);s.latest_health_checks&&Object.entries(s.latest_health_checks).forEach(([e,l])=>{if(t.includes(e)&&l){let t=l.error_message||void 0;h(s=>{let a=s[e];return{...s,[e]:{status:l.status||a?.status||"unknown",lastCheck:l.checked_at?new Date(l.checked_at).toLocaleString():a?.lastCheck||"None",lastSuccess:"healthy"===l.status&&l.checked_at?new Date(l.checked_at).toLocaleString():a?.lastSuccess||"None",loading:!1,error:t?F(t):a?.error,fullError:t||a?.fullError,successResponse:"healthy"===l.status?l:a?.successResponse}}})}})}catch(e){console.warn("Failed to fetch updated health statuses from database (non-critical):",e)}},M=e=>{j(e),e?g(a):g([])},A=()=>{y(!1),v(null)},L=()=>{w(!1),S(null)};return(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"mb-6",children:(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(ec.Title,{children:"Model Health Status"}),(0,t.jsx)(ed.Text,{className:"text-gray-600 mt-1",children:"Run health checks on individual models to verify they are working correctly"})]}),(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[p.length>0&&(0,t.jsx)(T.Button,{size:"sm",variant:"light",onClick:()=>M(!1),className:"px-3 py-1 text-sm",children:"Clear Selection"}),(0,t.jsx)(T.Button,{size:"sm",variant:"secondary",onClick:P,disabled:Object.values(u).some(e=>e.loading),className:"px-3 py-1 text-sm",children:p.length>0&&p.length{t?g(t=>[...t,e]):(g(t=>t.filter(t=>t!==e)),j(!1))},d=e=>{switch(e){case"healthy":return(0,t.jsx)(k.Badge,{color:"emerald",children:"healthy"});case"unhealthy":return(0,t.jsx)(k.Badge,{color:"red",children:"unhealthy"});case"checking":return(0,t.jsx)(k.Badge,{color:"blue",children:"checking"});case"none":return(0,t.jsx)(k.Badge,{color:"gray",children:"none"});default:return(0,t.jsx)(k.Badge,{color:"gray",children:"unknown"})}},c=(e,t,l)=>{v({modelName:e,cleanedError:t,fullError:l}),y(!0)},m=(e,t)=>{S({modelName:e,response:t}),w(!0)},[{header:()=>(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(tJ.Checkbox,{checked:f,indeterminate:p.length>0&&!f,onChange:e=>M(e.target.checked),onClick:e=>e.stopPropagation()}),(0,t.jsx)("span",{children:"Model ID"})]}),accessorKey:"model_info.id",enableSorting:!0,sortingFn:"alphanumeric",cell:({row:e})=>{let l=e.original,s=l.model_info?.id??"",a=p.includes(s);return(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(tJ.Checkbox,{checked:a,onChange:e=>n(s,e.target.checked),onClick:e=>e.stopPropagation()}),(0,t.jsx)(E.Tooltip,{title:l.model_info.id,children:(0,t.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:()=>i&&i(l.model_info.id),children:l.model_info.id})})]})}},{header:"Model Name",accessorKey:"model_name",enableSorting:!0,sortingFn:"alphanumeric",cell:({row:e})=>{let l=e.original,s=r(l)||l.model_name;return(0,t.jsx)("div",{className:"font-medium text-sm",children:(0,t.jsx)(E.Tooltip,{title:s,children:(0,t.jsx)("div",{className:"truncate max-w-[200px]",children:s})})})}},{header:"Team Alias",accessorKey:"model_info.team_id",enableSorting:!0,sortingFn:"alphanumeric",cell:({row:e})=>{let l=e.original,s=l.model_info?.team_id;if(!s)return(0,t.jsx)("span",{className:"text-gray-400 text-sm",children:"-"});let a=o?.find(e=>e.team_id===s),r=a?.team_alias||s;return(0,t.jsx)("div",{className:"text-sm",children:(0,t.jsx)(E.Tooltip,{title:r,children:(0,t.jsx)("div",{className:"truncate max-w-[150px]",children:r})})})}},{header:"Health Status",accessorKey:"health_status",enableSorting:!0,sortingFn:(e,t,l)=>{let s=e.getValue("health_status")||"unknown",a=t.getValue("health_status")||"unknown",r={healthy:0,checking:1,unknown:2,unhealthy:3};return(r[s]??4)-(r[a]??4)},cell:({row:e})=>{let l=e.original,s={status:l.health_status,loading:l.health_loading,error:l.health_error};if(s.loading)return(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsxs)("div",{className:"flex space-x-1",children:[(0,t.jsx)("div",{className:"w-2 h-2 bg-indigo-500 rounded-full animate-pulse"}),(0,t.jsx)("div",{className:"w-2 h-2 bg-indigo-500 rounded-full animate-pulse",style:{animationDelay:"0.2s"}}),(0,t.jsx)("div",{className:"w-2 h-2 bg-indigo-500 rounded-full animate-pulse",style:{animationDelay:"0.4s"}})]}),(0,t.jsx)(ed.Text,{className:"text-gray-600 text-sm",children:"Checking..."})]});let a=l.model_info?.id??"",i=r(l)||l.model_name,o="healthy"===s.status&&u[a]?.successResponse;return(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[d(s.status),o&&m&&(0,t.jsx)(E.Tooltip,{title:"View response details",placement:"top",children:(0,t.jsx)("button",{onClick:()=>m(i,u[a]?.successResponse),className:"p-1 text-green-600 hover:text-green-800 hover:bg-green-50 rounded cursor-pointer transition-colors",children:(0,t.jsx)(tK.InformationCircleIcon,{className:"h-4 w-4"})})})]})}},{header:"Error Details",accessorKey:"health_error",enableSorting:!1,cell:({row:e})=>{let l=e.original,s=l.model_info?.id??"",a=r(l)||l.model_name,i=u[s];if(!i?.error)return(0,t.jsx)(ed.Text,{className:"text-gray-400 text-sm",children:"No errors"});let o=i.error,n=i.fullError||i.error;return(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)("div",{className:"max-w-[200px]",children:(0,t.jsx)(E.Tooltip,{title:o,placement:"top",children:(0,t.jsx)(ed.Text,{className:"text-red-600 text-sm truncate",children:o})})}),c&&n!==o&&(0,t.jsx)(E.Tooltip,{title:"View full error details",placement:"top",children:(0,t.jsx)("button",{onClick:()=>c(a,o,n),className:"p-1 text-red-600 hover:text-red-800 hover:bg-red-50 rounded cursor-pointer transition-colors",children:(0,t.jsx)(tK.InformationCircleIcon,{className:"h-4 w-4"})})})]})}},{header:"Last Check",accessorKey:"last_check",enableSorting:!0,sortingFn:(e,t,l)=>{let s=e.getValue("last_check")||"Never checked",a=t.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),i=new Date(a);return isNaN(r.getTime())&&isNaN(i.getTime())?0:isNaN(r.getTime())?1:isNaN(i.getTime())?-1:i.getTime()-r.getTime()},cell:({row:e})=>{let l=e.original;return(0,t.jsx)(ed.Text,{className:"text-gray-600 text-sm",children:l.health_loading?"Check in progress...":l.last_check})}},{header:"Last Success",accessorKey:"last_success",enableSorting:!0,sortingFn:(e,t,l)=>{let s=e.getValue("last_success")||"Never succeeded",a=t.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),i=new Date(a);return isNaN(r.getTime())&&isNaN(i.getTime())?0:isNaN(r.getTime())?1:isNaN(i.getTime())?-1:i.getTime()-r.getTime()},cell:({row:e})=>{let l=e.original,s=u[l.model_info?.id??""],a=s?.lastSuccess||"None";return(0,t.jsx)(ed.Text,{className:"text-gray-600 text-sm",children:a})}},{header:"Actions",id:"actions",cell:({row:e})=>{let l=e.original,s=l.model_info?.id??"",a=l.health_status&&"none"!==l.health_status,r=l.health_loading?"Checking...":a?"Re-run Health Check":"Run Health Check";return(0,t.jsx)(E.Tooltip,{title:r,placement:"top",children:(0,t.jsx)("button",{"data-testid":"run-health-check-btn",className:`p-2 rounded-md transition-colors ${l.health_loading?"text-gray-400 cursor-not-allowed bg-gray-100":"text-indigo-600 hover:text-indigo-700 hover:bg-indigo-50"}`,onClick:()=>{l.health_loading||I(s)},disabled:l.health_loading,children:l.health_loading?(0,t.jsxs)("div",{className:"flex space-x-1",children:[(0,t.jsx)("div",{className:"w-1 h-1 bg-gray-400 rounded-full animate-pulse"}),(0,t.jsx)("div",{className:"w-1 h-1 bg-gray-400 rounded-full animate-pulse",style:{animationDelay:"0.2s"}}),(0,t.jsx)("div",{className:"w-1 h-1 bg-gray-400 rounded-full animate-pulse",style:{animationDelay:"0.4s"}})]}):a?(0,t.jsx)(eZ.RefreshIcon,{className:"h-4 w-4"}):(0,t.jsx)(tW.PlayIcon,{className:"h-4 w-4"})})})},enableSorting:!1}]),data:s.data.map(e=>{let t=e.model_info?.id,l=(t?u[t]:null)||{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})}),(0,t.jsx)(ee.Modal,{title:b?`Health Check Error - ${b.modelName}`:"Error Details",open:_,onCancel:A,footer:[(0,t.jsx)(G.Button,{onClick:A,children:"Close"},"close")],width:800,children:b&&(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(ed.Text,{className:"font-medium",children:"Error:"}),(0,t.jsx)("div",{className:"mt-2 p-3 bg-red-50 border border-red-200 rounded-md",children:(0,t.jsx)(ed.Text,{className:"text-red-800",children:b.cleanedError})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(ed.Text,{className:"font-medium",children:"Full Error Details:"}),(0,t.jsx)("div",{className:"mt-2 p-3 bg-gray-50 border border-gray-200 rounded-md max-h-96 overflow-y-auto",children:(0,t.jsx)("pre",{className:"text-sm text-gray-800 whitespace-pre-wrap",children:b.fullError})})]})]})}),(0,t.jsx)(ee.Modal,{title:C?`Health Check Response - ${C.modelName}`:"Response Details",open:N,onCancel:L,footer:[(0,t.jsx)(G.Button,{onClick:L,children:"Close"},"close")],width:800,children:C&&(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(ed.Text,{className:"font-medium",children:"Status:"}),(0,t.jsx)("div",{className:"mt-2 p-3 bg-green-50 border border-green-200 rounded-md",children:(0,t.jsx)(ed.Text,{className:"text-green-800",children:"Health check passed successfully"})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(ed.Text,{className:"font-medium",children:"Response Details:"}),(0,t.jsx)("div",{className:"mt-2 p-3 bg-gray-50 border border-gray-200 rounded-md max-h-96 overflow-y-auto",children:(0,t.jsx)("pre",{className:"text-sm text-gray-800 whitespace-pre-wrap",children:JSON.stringify(C.response,null,2)})})]})]})})]})};var tX=e.i(250980),tZ=e.i(797672),t0=e.i(871943),t1=e.i(502547);let t2=({accessToken:e,initialModelGroupAlias:s={},onAliasUpdate:a})=>{let[r,i]=(0,x.useState)([]),[o,n]=(0,x.useState)({aliasName:"",targetModelGroup:""}),[d,c]=(0,x.useState)(null),[m,u]=(0,x.useState)(!0);(0,x.useEffect)(()=>{i(Object.entries(s).map(([e,t],l)=>({id:`${l}-${e}`,aliasName:e,targetModelGroup:"string"==typeof t?t:t?.model??""})))},[s]);let h=async t=>{if(!e)return console.error("Access token is missing"),!1;try{let s={};return t.forEach(e=>{s[e.aliasName]=e.targetModelGroup}),console.log("Saving model group alias:",s),await (0,l.setCallbacksCall)(e,{router_settings:{model_group_alias:s}}),a&&a(s),!0}catch(e){return console.error("Failed to save model group alias settings:",e),Y.default.fromBackend("Failed to save model group alias settings"),!1}},b=async()=>{if(!o.aliasName||!o.targetModelGroup)return void Y.default.fromBackend("Please provide both alias name and target model group");if(r.some(e=>e.aliasName===o.aliasName))return void Y.default.fromBackend("An alias with this name already exists");let e=[...r,{id:`${Date.now()}-${o.aliasName}`,aliasName:o.aliasName,targetModelGroup:o.targetModelGroup}];await h(e)&&(i(e),n({aliasName:"",targetModelGroup:""}),Y.default.success("Alias added successfully"))},v=async()=>{if(!d)return;if(!d.aliasName||!d.targetModelGroup)return void Y.default.fromBackend("Please provide both alias name and target model group");if(r.some(e=>e.id!==d.id&&e.aliasName===d.aliasName))return void Y.default.fromBackend("An alias with this name already exists");let e=r.map(e=>e.id===d.id?d:e);await h(e)&&(i(e),c(null),Y.default.success("Alias updated successfully"))},N=()=>{c(null)},w=async e=>{let t=r.filter(t=>t.id!==e);await h(t)&&(i(t),Y.default.success("Alias deleted successfully"))},C=r.reduce((e,t)=>(e[t.aliasName]=t.targetModelGroup,e),{});return(0,t.jsxs)(eA.Card,{className:"mb-6",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between cursor-pointer",onClick:()=>u(!m),children:[(0,t.jsxs)("div",{className:"flex flex-col",children:[(0,t.jsx)(ec.Title,{className:"mb-0",children:"Model Group Alias Settings"}),(0,t.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,t.jsx)("div",{className:"flex items-center",children:m?(0,t.jsx)(t0.ChevronDownIcon,{className:"w-5 h-5 text-gray-500"}):(0,t.jsx)(t1.ChevronRightIcon,{className:"w-5 h-5 text-gray-500"})})]}),m&&(0,t.jsxs)("div",{className:"mt-4",children:[(0,t.jsxs)("div",{className:"mb-6",children:[(0,t.jsx)(ed.Text,{className:"text-sm font-medium text-gray-700 mb-2",children:"Add New Alias"}),(0,t.jsxs)("div",{className:"grid grid-cols-3 gap-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-xs text-gray-500 mb-1",children:"Alias Name"}),(0,t.jsx)("input",{type:"text",value:o.aliasName,onChange:e=>n({...o,aliasName:e.target.value}),placeholder:"e.g., gpt-4o",className:"w-full px-3 py-2 border border-gray-300 rounded-md text-sm"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-xs text-gray-500 mb-1",children:"Target Model Group"}),(0,t.jsx)("input",{type:"text",value:o.targetModelGroup,onChange:e=>n({...o,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,t.jsx)("div",{className:"flex items-end",children:(0,t.jsxs)("button",{onClick:b,disabled:!o.aliasName||!o.targetModelGroup,className:`flex items-center px-4 py-2 rounded-md text-sm ${!o.aliasName||!o.targetModelGroup?"bg-gray-300 text-gray-500 cursor-not-allowed":"bg-green-600 text-white hover:bg-green-700"}`,children:[(0,t.jsx)(tX.PlusCircleIcon,{className:"w-4 h-4 mr-1"}),"Add Alias"]})})]})]}),(0,t.jsx)(ed.Text,{className:"text-sm font-medium text-gray-700 mb-2",children:"Manage Existing Aliases"}),(0,t.jsx)("div",{className:"rounded-lg custom-border relative mb-6",children:(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)(p.Table,{className:"[&_td]:py-0.5 [&_th]:py-1",children:[(0,t.jsx)(g.TableHead,{children:(0,t.jsxs)(_.TableRow,{children:[(0,t.jsx)(f.TableHeaderCell,{className:"py-1 h-8",children:"Alias Name"}),(0,t.jsx)(f.TableHeaderCell,{className:"py-1 h-8",children:"Target Model Group"}),(0,t.jsx)(f.TableHeaderCell,{className:"py-1 h-8",children:"Actions"})]})}),(0,t.jsxs)(j.TableBody,{children:[r.map(e=>(0,t.jsx)(_.TableRow,{className:"h-8",children:d&&d.id===e.id?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(y.TableCell,{className:"py-0.5",children:(0,t.jsx)("input",{type:"text",value:d.aliasName,onChange:e=>c({...d,aliasName:e.target.value}),className:"w-full px-2 py-1 border border-gray-300 rounded-md text-sm"})}),(0,t.jsx)(y.TableCell,{className:"py-0.5",children:(0,t.jsx)("input",{type:"text",value:d.targetModelGroup,onChange:e=>c({...d,targetModelGroup:e.target.value}),className:"w-full px-2 py-1 border border-gray-300 rounded-md text-sm"})}),(0,t.jsx)(y.TableCell,{className:"py-0.5 whitespace-nowrap",children:(0,t.jsxs)("div",{className:"flex space-x-2",children:[(0,t.jsx)("button",{onClick:v,className:"text-xs bg-blue-50 text-blue-600 px-2 py-1 rounded hover:bg-blue-100",children:"Save"}),(0,t.jsx)("button",{onClick:N,className:"text-xs bg-gray-50 text-gray-600 px-2 py-1 rounded hover:bg-gray-100",children:"Cancel"})]})})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(y.TableCell,{className:"py-0.5 text-sm text-gray-900",children:e.aliasName}),(0,t.jsx)(y.TableCell,{className:"py-0.5 text-sm text-gray-500",children:e.targetModelGroup}),(0,t.jsx)(y.TableCell,{className:"py-0.5 whitespace-nowrap",children:(0,t.jsxs)("div",{className:"flex space-x-2",children:[(0,t.jsx)("button",{onClick:()=>{c({...e})},className:"text-xs bg-blue-50 text-blue-600 px-2 py-1 rounded hover:bg-blue-100",children:(0,t.jsx)(tZ.PencilIcon,{className:"w-3 h-3"})}),(0,t.jsx)("button",{onClick:()=>w(e.id),className:"text-xs bg-red-50 text-red-600 px-2 py-1 rounded hover:bg-red-100",children:(0,t.jsx)(S.TrashIcon,{className:"w-3 h-3"})})]})})]})},e.id)),0===r.length&&(0,t.jsx)(_.TableRow,{children:(0,t.jsx)(y.TableCell,{colSpan:3,className:"py-0.5 text-sm text-gray-500 text-center",children:"No aliases added yet. Add a new alias above."})})]})]})})}),(0,t.jsxs)(eA.Card,{children:[(0,t.jsx)(ec.Title,{className:"mb-4",children:"Configuration Example"}),(0,t.jsx)(ed.Text,{className:"text-gray-600 mb-4",children:"Here's how your current aliases would look in the config.yaml:"}),(0,t.jsx)("div",{className:"bg-gray-100 rounded-lg p-4 font-mono text-sm",children:(0,t.jsxs)("div",{className:"text-gray-700",children:["router_settings:",(0,t.jsx)("br",{}),"  model_group_alias:",0===Object.keys(C).length?(0,t.jsxs)("span",{className:"text-gray-500",children:[(0,t.jsx)("br",{}),"    # No aliases configured yet"]}):Object.entries(C).map(([e,l])=>(0,t.jsxs)("span",{children:[(0,t.jsx)("br",{}),'    "',e,'": "',l,'"']},e))]})})]})]})]})};var t4=e.i(530212);let t5=x.forwardRef(function(e,t){return x.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),x.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z"}))});var t6=e.i(678784),t3=e.i(118366),t8=e.i(500330);let t7=({isVisible:e,onCancel:s,onSuccess:a,modelData:r,accessToken:i,userRole:o})=>{let[n]=Z.Form.useForm(),[d,c]=(0,x.useState)(!1),[m,u]=(0,x.useState)([]),[h,p]=(0,x.useState)([]),[g,f]=(0,x.useState)(!1),[j,_]=(0,x.useState)(!1),[y,b]=(0,x.useState)(null);(0,x.useEffect)(()=>{e&&r&&v()},[e,r]),(0,x.useEffect)(()=>{let t=async()=>{if(i)try{let e=await (0,l.modelAvailableCall)(i,"","",!1,null,!0,!0);u(e.data.map(e=>e.id))}catch(e){console.error("Error fetching model access groups:",e)}},s=async()=>{if(i)try{let e=await (0,ts.fetchAvailableModels)(i);p(e)}catch(e){console.error("Error fetching model info:",e)}};e&&(t(),s())},[e,i]);let v=()=>{try{let e=null;r.litellm_params?.auto_router_config&&(e="string"==typeof r.litellm_params.auto_router_config?JSON.parse(r.litellm_params.auto_router_config):r.litellm_params.auto_router_config),b(e),n.setFieldsValue({auto_router_name:r.model_name,auto_router_default_model:r.litellm_params?.auto_router_default_model||"",auto_router_embedding_model:r.litellm_params?.auto_router_embedding_model||"",model_access_group:r.model_info?.access_groups||[]});let t=new Set(h.map(e=>e.model_group));f(!t.has(r.litellm_params?.auto_router_default_model)),_(!t.has(r.litellm_params?.auto_router_embedding_model))}catch(e){console.error("Error parsing auto router config:",e),Y.default.fromBackend("Error loading auto router configuration")}},N=async()=>{try{c(!0);let e=await n.validateFields(),t={...r.litellm_params,auto_router_config:JSON.stringify(y),auto_router_default_model:e.auto_router_default_model,auto_router_embedding_model:e.auto_router_embedding_model||void 0},o={...r.model_info,access_groups:e.model_access_group||[]},d={model_name:e.auto_router_name,litellm_params:t,model_info:o};await (0,l.modelPatchUpdateCall)(i,d,r.model_info.id);let m={...r,model_name:e.auto_router_name,litellm_params:t,model_info:o};Y.default.success("Auto router configuration updated successfully"),a(m),s()}catch(e){console.error("Error updating auto router:",e),Y.default.fromBackend("Failed to update auto router configuration")}finally{c(!1)}},w=h.map(e=>({value:e.model_group,label:e.model_group}));return(0,t.jsx)(ee.Modal,{title:"Edit Auto Router Configuration",open:e,onCancel:s,footer:[(0,t.jsx)(G.Button,{onClick:s,children:"Cancel"},"cancel"),(0,t.jsx)(G.Button,{loading:d,onClick:N,children:"Save Changes"},"submit")],width:1e3,destroyOnHidden:!0,children:(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsx)(ed.Text,{className:"text-gray-600",children:"Edit the auto router configuration including routing logic, default models, and access settings."}),(0,t.jsxs)(Z.Form,{form:n,layout:"vertical",className:"space-y-4",children:[(0,t.jsx)(Z.Form.Item,{label:"Auto Router Name",name:"auto_router_name",rules:[{required:!0,message:"Auto router name is required"}],children:(0,t.jsx)(eL.TextInput,{placeholder:"e.g., auto_router_1, smart_routing"})}),(0,t.jsx)("div",{className:"w-full",children:(0,t.jsx)(tc,{modelInfo:h,value:y,onChange:e=>{b(e)}})}),(0,t.jsx)(Z.Form.Item,{label:"Default Model",name:"auto_router_default_model",rules:[{required:!0,message:"Default model is required"}],children:(0,t.jsx)(U.Select,{placeholder:"Select a default model",onChange:e=>{f("custom"===e)},options:[...w,{value:"custom",label:"Enter custom model name"}],showSearch:!0})}),(0,t.jsx)(Z.Form.Item,{label:"Embedding Model",name:"auto_router_embedding_model",children:(0,t.jsx)(U.Select,{placeholder:"Select an embedding model (optional)",onChange:e=>{_("custom"===e)},options:[...w,{value:"custom",label:"Enter custom model name"}],showSearch:!0,allowClear:!0})}),"Admin"===o&&(0,t.jsx)(Z.Form.Item,{label:"Model Access Groups",name:"model_access_group",tooltip:"Control who can access this auto router",children:(0,t.jsx)(U.Select,{mode:"tags",showSearch:!0,placeholder:"Select existing groups or type to create new ones",optionFilterProp:"children",tokenSeparators:[","],options:m.map(e=>({value:e,label:e})),maxTagCount:"responsive",allowClear:!0})})]})]})})},{Title:t9,Link:le}=L.Typography,lt=({isVisible:e,onCancel:l,onAddCredential:s,existingCredential:a,setIsCredentialModalOpen:r})=>{let[i]=Z.Form.useForm();return console.log(`existingCredential in add credentials tab: ${JSON.stringify(a)}`),(0,t.jsx)(ee.Modal,{title:"Reuse Credentials",open:e,onCancel:()=>{l(),i.resetFields()},footer:null,width:600,children:(0,t.jsxs)(Z.Form,{form:i,onFinish:e=>{s(e),i.resetFields(),r(!1)},layout:"vertical",children:[(0,t.jsx)(Z.Form.Item,{label:"Credential Name:",name:"credential_name",rules:[{required:!0,message:"Credential name is required"}],initialValue:a?.credential_name,children:(0,t.jsx)(eL.TextInput,{placeholder:"Enter a friendly name for these credentials"})}),Object.entries(a?.credential_values||{}).map(([e,l])=>(0,t.jsx)(Z.Form.Item,{label:e,name:e,initialValue:l,children:(0,t.jsx)(eL.TextInput,{placeholder:`Enter ${e}`,disabled:!0})},e)),(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsx)(E.Tooltip,{title:"Get help on our github",children:(0,t.jsx)(le,{href:"https://github.com/BerriAI/litellm/issues",children:"Need Help?"})}),(0,t.jsxs)("div",{children:[(0,t.jsx)(G.Button,{onClick:()=>{l(),i.resetFields()},style:{marginRight:10},children:"Cancel"}),(0,t.jsx)(G.Button,{htmlType:"submit",children:"Reuse Credentials"})]})]})]})})};function ll({modelId:e,onClose:s,accessToken:a,userID:r,userRole:i,onModelUpdate:o,modelAccessGroups:c}){let m,[u]=Z.Form.useForm(),[h,p]=(0,x.useState)(null),[g,f]=(0,x.useState)(!1),[j,_]=(0,x.useState)(!1),[y,b]=(0,x.useState)(!1),[v,N]=(0,x.useState)(!1),[C,k]=(0,x.useState)(!1),[F,I]=(0,x.useState)(!1),[P,M]=(0,x.useState)(null),[A,L]=(0,x.useState)(!1),[R,O]=(0,x.useState)({}),[B,z]=(0,x.useState)(!1),[V,$]=(0,x.useState)([]),[J,K]=(0,x.useState)({}),{data:W,isLoading:Q}=(0,d.useModelsInfo)(1,50,void 0,e),{data:X}=(0,n.useModelCostMap)(),{data:et}=(0,d.useModelHub)(),el=e=>null!=X&&"object"==typeof X&&e in X?X[e].litellm_provider:"openai",es=(0,x.useMemo)(()=>W?.data&&0!==W.data.length&&ea(W,el).data[0]||null,[W,X]),er=("Admin"===i||es?.model_info?.created_by===r)&&es?.model_info?.db_model,ei="Admin"===i,eo=es?.litellm_params?.auto_router_config!=null,en=es?.litellm_params?.litellm_credential_name!=null&&es?.litellm_params?.litellm_credential_name!=void 0;(0,x.useEffect)(()=>{if(es&&!h){let e=es;e.litellm_model_name||(e={...e,litellm_model_name:e?.litellm_params?.litellm_model_name??e?.litellm_params?.model??e?.model_info?.key??null}),p(e),e?.litellm_params?.cache_control_injection_points&&L(!0)}},[es,h]),(0,x.useEffect)(()=>{let t=async()=>{if(!a||es)return;let t=(await (0,l.modelInfoV1Call)(a,e)).data[0];t&&!t.litellm_model_name&&(t={...t,litellm_model_name:t?.litellm_params?.litellm_model_name??t?.litellm_params?.model??t?.model_info?.key??null}),p(t),t?.litellm_params?.cache_control_injection_points&&L(!0)},s=async()=>{if(a)try{let e=(await (0,l.getGuardrailsList)(a)).guardrails.map(e=>e.guardrail_name);$(e)}catch(e){console.error("Failed to fetch guardrails:",e)}},r=async()=>{if(a)try{let e=await (0,l.tagListCall)(a);K(e)}catch(e){console.error("Failed to fetch tags:",e)}};(async()=>{if(!a||en)return;let t=await (0,l.credentialGetCall)(a,null,e);M({credential_name:t.credential_name,credential_values:t.credential_values,credential_info:t.credential_info})})(),t(),s(),r()},[a,e]);let em=async t=>{if(!a)return;let s={credential_name:t.credential_name,model_id:e,credential_info:{custom_llm_provider:h.litellm_params?.custom_llm_provider}};Y.default.info("Storing credential.."),await (0,l.credentialCreateCall)(a,s),Y.default.success("Credential stored successfully")},eu=async t=>{try{let s;if(!a)return;k(!0);let r={};try{r=t.litellm_extra_params?JSON.parse(t.litellm_extra_params):{}}catch(e){Y.default.fromBackend("Invalid JSON in LiteLLM Params"),k(!1);return}let i={...t.litellm_params,...r,model:t.litellm_model_name,api_base:t.api_base,custom_llm_provider:t.custom_llm_provider,organization:t.organization,tpm:t.tpm,rpm:t.rpm,max_retries:t.max_retries,timeout:t.timeout,stream_timeout:t.stream_timeout,input_cost_per_token:t.input_cost/1e6,output_cost_per_token:t.output_cost/1e6,tags:t.tags};t.guardrails&&(i.guardrails=t.guardrails),t.cache_control&&t.cache_control_injection_points?.length>0?i.cache_control_injection_points=t.cache_control_injection_points:delete i.cache_control_injection_points;try{s=t.model_info?JSON.parse(t.model_info):es.model_info,t.model_access_group&&(s={...s,access_groups:t.model_access_group}),void 0!==t.health_check_model&&(s={...s,health_check_model:t.health_check_model})}catch(e){Y.default.fromBackend("Invalid JSON in Model Info");return}let n={model_name:t.model_name,litellm_params:i,model_info:s};await (0,l.modelPatchUpdateCall)(a,n,e);let d={...h,model_name:t.model_name,litellm_model_name:t.litellm_model_name,litellm_params:i,model_info:s};p(d),o&&o(d),Y.default.success("Model settings updated successfully"),N(!1),I(!1)}catch(e){console.error("Error updating model:",e),Y.default.fromBackend("Failed to update model settings")}finally{k(!1)}};if(Q)return(0,t.jsxs)("div",{className:"p-4",children:[(0,t.jsx)(T.Button,{icon:t4.ArrowLeftIcon,variant:"light",onClick:s,className:"mb-4",children:"Back to Models"}),(0,t.jsx)(ed.Text,{children:"Loading..."})]});if(!es)return(0,t.jsxs)("div",{className:"p-4",children:[(0,t.jsx)(T.Button,{icon:t4.ArrowLeftIcon,variant:"light",onClick:s,className:"mb-4",children:"Back to Models"}),(0,t.jsx)(ed.Text,{children:"Model not found"})]});let eh=async()=>{if(a)try{Y.default.info("Testing connection...");let e=await (0,l.testConnectionRequest)(a,{custom_llm_provider:h.litellm_params.custom_llm_provider,litellm_credential_name:h.litellm_params.litellm_credential_name,model:h.litellm_model_name},{mode:h.model_info?.mode},h.model_info?.mode);if("success"===e.status)Y.default.success("Connection test successful!");else throw Error(e?.result?.error||e?.message||"Unknown error")}catch(e){e instanceof Error?Y.default.error("Error testing connection: "+(0,tA.truncateString)(e.message,100)):Y.default.error("Error testing connection: "+String(e))}},ex=async()=>{try{if(_(!0),!a)return;await (0,l.modelDeleteCall)(a,e),Y.default.success("Model deleted successfully"),o&&o({deleted:!0,model_info:{id:e}}),s()}catch(e){console.error("Error deleting the model:",e),Y.default.fromBackend("Failed to delete model")}finally{_(!1),f(!1)}},ep=async(e,t)=>{await (0,t8.copyToClipboard)(e)&&(O(e=>({...e,[t]:!0})),setTimeout(()=>{O(e=>({...e,[t]:!1}))},2e3))},eg=es.litellm_model_name.includes("*");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)(T.Button,{icon:t4.ArrowLeftIcon,variant:"light",onClick:s,className:"mb-4",children:"Back to Models"}),(0,t.jsxs)(ec.Title,{children:["Public Model Name: ",q(es)]}),(0,t.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,t.jsx)(ed.Text,{className:"text-gray-500 font-mono",children:es.model_info.id}),(0,t.jsx)(G.Button,{type:"text",size:"small",icon:R["model-id"]?(0,t.jsx)(t6.CheckIcon,{size:12}):(0,t.jsx)(t3.CopyIcon,{size:12}),onClick:()=>ep(es.model_info.id,"model-id"),className:`left-2 z-10 transition-all duration-200 ${R["model-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",{className:"flex gap-2",children:[(0,t.jsx)(T.Button,{variant:"secondary",icon:eZ.RefreshIcon,onClick:eh,className:"flex items-center gap-2","data-testid":"test-connection-button",children:"Test Connection"}),(0,t.jsx)(T.Button,{icon:t5,variant:"secondary",onClick:()=>b(!0),className:"flex items-center",disabled:!ei,"data-testid":"reuse-credentials-button",children:"Re-use Credentials"}),(0,t.jsx)(T.Button,{icon:S.TrashIcon,variant:"secondary",onClick:()=>f(!0),className:"flex items-center text-red-500 border-red-500 hover:text-red-700",disabled:!er,"data-testid":"delete-model-button",children:"Delete Model"})]})]}),(0,t.jsxs)(e4.TabGroup,{children:[(0,t.jsxs)(e5.TabList,{className:"mb-6",children:[(0,t.jsx)(e2.Tab,{children:"Overview"}),(0,t.jsx)(e2.Tab,{children:"Raw JSON"})]}),(0,t.jsxs)(e6.TabPanels,{children:[(0,t.jsxs)(H.TabPanel,{children:[(0,t.jsxs)(D.Grid,{numItems:1,numItemsSm:2,numItemsLg:3,className:"gap-6 mb-6",children:[(0,t.jsxs)(eA.Card,{children:[(0,t.jsx)(ed.Text,{children:"Provider"}),(0,t.jsxs)("div",{className:"mt-2 flex items-center space-x-2",children:[es.provider&&(0,t.jsx)("img",{src:(0,eF.getProviderLogoAndName)(es.provider).logo,alt:`${es.provider} logo`,className:"w-4 h-4",onError:e=>{let t=e.currentTarget,l=t.parentElement;if(l&&l.contains(t))try{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=es.provider?.charAt(0)||"-",l.replaceChild(e,t)}catch(e){console.error("Failed to replace provider logo fallback:",e)}}}),(0,t.jsx)(ec.Title,{children:es.provider||"Not Set"})]})]}),(0,t.jsxs)(eA.Card,{children:[(0,t.jsx)(ed.Text,{children:"LiteLLM Model"}),(0,t.jsx)("div",{className:"mt-2 overflow-hidden",children:(0,t.jsx)(E.Tooltip,{title:es.litellm_model_name||"Not Set",children:(0,t.jsx)("div",{className:"break-all text-sm font-medium leading-relaxed cursor-pointer",children:es.litellm_model_name||"Not Set"})})})]}),(0,t.jsxs)(eA.Card,{children:[(0,t.jsx)(ed.Text,{children:"Pricing"}),(0,t.jsxs)("div",{className:"mt-2",children:[(0,t.jsxs)(ed.Text,{children:["Input: $",es.input_cost,"/1M tokens"]}),(0,t.jsxs)(ed.Text,{children:["Output: $",es.output_cost,"/1M tokens"]})]})]})]}),(0,t.jsxs)("div",{className:"mb-6 text-sm text-gray-500 flex items-center gap-x-6",children:[(0,t.jsxs)("div",{className:"flex items-center gap-x-2",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:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})}),"Created At"," ",es.model_info.created_at?new Date(es.model_info.created_at).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):"Not Set"]}),(0,t.jsxs)("div",{className:"flex items-center gap-x-2",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:"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 ",es.model_info.created_by||"Not Set"]})]}),(0,t.jsxs)(eA.Card,{children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,t.jsx)(ec.Title,{children:"Model Settings"}),(0,t.jsxs)("div",{className:"flex gap-2",children:[eo&&er&&!F&&(0,t.jsx)(T.Button,{onClick:()=>z(!0),className:"flex items-center",children:"Edit Auto Router"}),er?!F&&(0,t.jsx)(T.Button,{onClick:()=>I(!0),className:"flex items-center",children:"Edit Settings"}):(0,t.jsx)(E.Tooltip,{title:"Only DB models can be edited. You must be an admin or the creator of the model to edit it.",children:(0,t.jsx)(w.InfoCircleOutlined,{})})]})]}),h?(0,t.jsx)(Z.Form,{form:u,onFinish:eu,initialValues:{model_name:h.model_name,litellm_model_name:h.litellm_model_name,api_base:h.litellm_params.api_base,custom_llm_provider:h.litellm_params.custom_llm_provider,organization:h.litellm_params.organization,tpm:h.litellm_params.tpm,rpm:h.litellm_params.rpm,max_retries:h.litellm_params.max_retries,timeout:h.litellm_params.timeout,stream_timeout:h.litellm_params.stream_timeout,input_cost:h.litellm_params.input_cost_per_token?1e6*h.litellm_params.input_cost_per_token:h.model_info?.input_cost_per_token*1e6||null,output_cost:h.litellm_params?.output_cost_per_token?1e6*h.litellm_params.output_cost_per_token:h.model_info?.output_cost_per_token*1e6||null,cache_control:!!h.litellm_params?.cache_control_injection_points,cache_control_injection_points:h.litellm_params?.cache_control_injection_points||[],model_access_group:Array.isArray(h.model_info?.access_groups)?h.model_info.access_groups:[],guardrails:Array.isArray(h.litellm_params?.guardrails)?h.litellm_params.guardrails:[],tags:Array.isArray(h.litellm_params?.tags)?h.litellm_params.tags:[],health_check_model:eg?h.model_info?.health_check_model:null,litellm_extra_params:JSON.stringify(h.litellm_params||{},null,2)},layout:"vertical",onValuesChange:()=>N(!0),children:(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(ed.Text,{className:"font-medium",children:"Model Name"}),F?(0,t.jsx)(Z.Form.Item,{name:"model_name",className:"mb-0",children:(0,t.jsx)(eL.TextInput,{placeholder:"Enter model name"})}):(0,t.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:h.model_name})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(ed.Text,{className:"font-medium",children:"LiteLLM Model Name"}),F?(0,t.jsx)(Z.Form.Item,{name:"litellm_model_name",className:"mb-0",children:(0,t.jsx)(eL.TextInput,{placeholder:"Enter LiteLLM model name"})}):(0,t.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:h.litellm_model_name})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(ed.Text,{className:"font-medium",children:"Input Cost (per 1M tokens)"}),F?(0,t.jsx)(Z.Form.Item,{name:"input_cost",className:"mb-0",children:(0,t.jsx)(tI.default,{placeholder:"Enter input cost"})}):(0,t.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:h?.litellm_params?.input_cost_per_token?(h.litellm_params?.input_cost_per_token*1e6).toFixed(4):h?.model_info?.input_cost_per_token?(1e6*h.model_info.input_cost_per_token).toFixed(4):"Not Set"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(ed.Text,{className:"font-medium",children:"Output Cost (per 1M tokens)"}),F?(0,t.jsx)(Z.Form.Item,{name:"output_cost",className:"mb-0",children:(0,t.jsx)(tI.default,{placeholder:"Enter output cost"})}):(0,t.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:h?.litellm_params?.output_cost_per_token?(1e6*h.litellm_params.output_cost_per_token).toFixed(4):h?.model_info?.output_cost_per_token?(1e6*h.model_info.output_cost_per_token).toFixed(4):"Not Set"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(ed.Text,{className:"font-medium",children:"API Base"}),F?(0,t.jsx)(Z.Form.Item,{name:"api_base",className:"mb-0",children:(0,t.jsx)(eL.TextInput,{placeholder:"Enter API base"})}):(0,t.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:h.litellm_params?.api_base||"Not Set"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(ed.Text,{className:"font-medium",children:"Custom LLM Provider"}),F?(0,t.jsx)(Z.Form.Item,{name:"custom_llm_provider",className:"mb-0",children:(0,t.jsx)(eL.TextInput,{placeholder:"Enter custom LLM provider"})}):(0,t.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:h.litellm_params?.custom_llm_provider||"Not Set"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(ed.Text,{className:"font-medium",children:"Organization"}),F?(0,t.jsx)(Z.Form.Item,{name:"organization",className:"mb-0",children:(0,t.jsx)(eL.TextInput,{placeholder:"Enter organization"})}):(0,t.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:h.litellm_params?.organization||"Not Set"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(ed.Text,{className:"font-medium",children:"TPM (Tokens per Minute)"}),F?(0,t.jsx)(Z.Form.Item,{name:"tpm",className:"mb-0",children:(0,t.jsx)(tI.default,{placeholder:"Enter TPM"})}):(0,t.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:h.litellm_params?.tpm||"Not Set"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(ed.Text,{className:"font-medium",children:"RPM (Requests per Minute)"}),F?(0,t.jsx)(Z.Form.Item,{name:"rpm",className:"mb-0",children:(0,t.jsx)(tI.default,{placeholder:"Enter RPM"})}):(0,t.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:h.litellm_params?.rpm||"Not Set"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(ed.Text,{className:"font-medium",children:"Max Retries"}),F?(0,t.jsx)(Z.Form.Item,{name:"max_retries",className:"mb-0",children:(0,t.jsx)(tI.default,{placeholder:"Enter max retries"})}):(0,t.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:h.litellm_params?.max_retries||"Not Set"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(ed.Text,{className:"font-medium",children:"Timeout (seconds)"}),F?(0,t.jsx)(Z.Form.Item,{name:"timeout",className:"mb-0",children:(0,t.jsx)(tI.default,{placeholder:"Enter timeout"})}):(0,t.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:h.litellm_params?.timeout||"Not Set"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(ed.Text,{className:"font-medium",children:"Stream Timeout (seconds)"}),F?(0,t.jsx)(Z.Form.Item,{name:"stream_timeout",className:"mb-0",children:(0,t.jsx)(tI.default,{placeholder:"Enter stream timeout"})}):(0,t.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:h.litellm_params?.stream_timeout||"Not Set"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(ed.Text,{className:"font-medium",children:"Model Access Groups"}),F?(0,t.jsx)(Z.Form.Item,{name:"model_access_group",className:"mb-0",children:(0,t.jsx)(U.Select,{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:c?.map(e=>({value:e,label:e}))})}):(0,t.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:h.model_info?.access_groups?Array.isArray(h.model_info.access_groups)?h.model_info.access_groups.length>0?(0,t.jsx)("div",{className:"flex flex-wrap gap-1",children:h.model_info.access_groups.map((e,l)=>(0,t.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":h.model_info.access_groups:"Not Set"})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)(ed.Text,{className:"font-medium",children:["Guardrails",(0,t.jsx)(E.Tooltip,{title:"Apply safety guardrails to this model to filter content or enforce policies",children:(0,t.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/guardrails/quick_start",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:(0,t.jsx)(w.InfoCircleOutlined,{style:{marginLeft:"4px"}})})})]}),F?(0,t.jsx)(Z.Form.Item,{name:"guardrails",className:"mb-0",children:(0,t.jsx)(U.Select,{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:V.map(e=>({value:e,label:e}))})}):(0,t.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:h.litellm_params?.guardrails?Array.isArray(h.litellm_params.guardrails)?h.litellm_params.guardrails.length>0?(0,t.jsx)("div",{className:"flex flex-wrap gap-1",children:h.litellm_params.guardrails.map((e,l)=>(0,t.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":h.litellm_params.guardrails:"Not Set"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(ed.Text,{className:"font-medium",children:"Tags"}),F?(0,t.jsx)(Z.Form.Item,{name:"tags",className:"mb-0",children:(0,t.jsx)(U.Select,{mode:"tags",showSearch:!0,placeholder:"Select existing tags or type to create new ones",optionFilterProp:"children",tokenSeparators:[","],maxTagCount:"responsive",allowClear:!0,style:{width:"100%"},options:Object.values(J).map(e=>({value:e.name,label:e.name,title:e.description||e.name}))})}):(0,t.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:h.litellm_params?.tags?Array.isArray(h.litellm_params.tags)?h.litellm_params.tags.length>0?(0,t.jsx)("div",{className:"flex flex-wrap gap-1",children:h.litellm_params.tags.map((e,l)=>(0,t.jsx)("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-purple-100 text-purple-800",children:e},l))}):"No tags assigned":h.litellm_params.tags:"Not Set"})]}),eg&&(0,t.jsxs)("div",{children:[(0,t.jsx)(ed.Text,{className:"font-medium",children:"Health Check Model"}),F?(0,t.jsx)(Z.Form.Item,{name:"health_check_model",className:"mb-0",children:(0,t.jsx)(U.Select,{showSearch:!0,placeholder:"Select existing health check model",optionFilterProp:"children",allowClear:!0,options:(m=es.litellm_model_name.split("/")[0],et?.data?.filter(e=>e.providers?.includes(m)&&e.model_group!==es.litellm_model_name).map(e=>({value:e.model_group,label:e.model_group}))||[])})}):(0,t.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:h.model_info?.health_check_model||"Not Set"})]}),F?(0,t.jsx)(tM,{form:u,showCacheControl:A,onCacheControlChange:e=>L(e)}):(0,t.jsxs)("div",{children:[(0,t.jsx)(ed.Text,{className:"font-medium",children:"Cache Control"}),(0,t.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:h.litellm_params?.cache_control_injection_points?(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{children:"Enabled"}),(0,t.jsx)("div",{className:"mt-2",children:h.litellm_params.cache_control_injection_points.map((e,l)=>(0,t.jsxs)("div",{className:"text-sm text-gray-600 mb-1",children:["Location: ",e.location,",",e.role&&(0,t.jsxs)("span",{children:[" Role: ",e.role]}),void 0!==e.index&&(0,t.jsxs)("span",{children:[" Index: ",e.index]})]},l))})]}):"Disabled"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(ed.Text,{className:"font-medium",children:"Model Info"}),F?(0,t.jsx)(Z.Form.Item,{name:"model_info",className:"mb-0",children:(0,t.jsx)(eq.Input.TextArea,{rows:4,placeholder:'{"gpt-4": 100, "claude-v1": 200}',defaultValue:JSON.stringify(es.model_info,null,2)})}):(0,t.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(0,t.jsx)("pre",{className:"bg-gray-100 p-2 rounded text-xs overflow-auto mt-1",children:JSON.stringify(h.model_info,null,2)})})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)(ed.Text,{className:"font-medium",children:["LiteLLM Params",(0,t.jsx)(E.Tooltip,{title:"Optional litellm params used for making a litellm.completion() call. Some params are automatically added by LiteLLM.",children:(0,t.jsx)("a",{href:"https://docs.litellm.ai/docs/completion/input",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:(0,t.jsx)(w.InfoCircleOutlined,{style:{marginLeft:"4px"}})})})]}),F?(0,t.jsx)(Z.Form.Item,{name:"litellm_extra_params",rules:[{validator:tA.formItemValidateJSON}],children:(0,t.jsx)(eq.Input.TextArea,{rows:4,placeholder:'{ "rpm": 100, "timeout": 0, "stream_timeout": 0 }'})}):(0,t.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(0,t.jsx)("pre",{className:"bg-gray-100 p-2 rounded text-xs overflow-auto mt-1",children:JSON.stringify(h.litellm_params,null,2)})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(ed.Text,{className:"font-medium",children:"Team ID"}),(0,t.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:es.model_info.team_id||"Not Set"})]})]}),F&&(0,t.jsxs)("div",{className:"mt-6 flex justify-end gap-2",children:[(0,t.jsx)(T.Button,{variant:"secondary",onClick:()=>{u.resetFields(),N(!1),I(!1)},disabled:C,children:"Cancel"}),(0,t.jsx)(T.Button,{variant:"primary",onClick:()=>u.submit(),loading:C,children:"Save Changes"})]})]})}):(0,t.jsx)(ed.Text,{children:"Loading..."})]})]}),(0,t.jsx)(H.TabPanel,{children:(0,t.jsx)(eA.Card,{children:(0,t.jsx)("pre",{className:"bg-gray-100 p-4 rounded text-xs overflow-auto",children:JSON.stringify(es,null,2)})})})]})]}),(0,t.jsx)(eE.default,{isOpen:g,title:"Delete Model",alertMessage:"This action cannot be undone.",message:"Are you sure you want to delete this model?",resourceInformationTitle:"Model Information",resourceInformation:[{label:"Model Name",value:es?.model_name||"Not Set"},{label:"LiteLLM Model Name",value:es?.litellm_model_name||"Not Set"},{label:"Provider",value:es?.provider||"Not Set"},{label:"Created By",value:es?.model_info?.created_by||"Not Set"}],onCancel:()=>f(!1),onOk:ex,confirmLoading:j}),y&&!en?(0,t.jsx)(lt,{isVisible:y,onCancel:()=>b(!1),onAddCredential:em,existingCredential:P,setIsCredentialModalOpen:b}):(0,t.jsx)(ee.Modal,{open:y,onCancel:()=>b(!1),title:"Using Existing Credential",children:(0,t.jsx)(ed.Text,{children:es.litellm_params.litellm_credential_name})}),(0,t.jsx)(t7,{isVisible:B,onCancel:()=>z(!1),onSuccess:e=>{p(e),o&&o(e)},modelData:h||es,accessToken:a||"",userRole:i||""})]})}var ls=e.i(37091),la=e.i(218129);let lr=({value:e={},onChange:l})=>{let[s,a]=(0,x.useState)(Object.entries(e)),r=(e,t,r)=>{let i=[...s];i[e]=[t,r],a(i),l?.(Object.fromEntries(i))};return(0,t.jsxs)("div",{children:[s.map(([e,i],o)=>(0,t.jsxs)(A.Space,{style:{display:"flex",marginBottom:8},align:"center",children:[(0,t.jsx)(eL.TextInput,{placeholder:"Header Name",value:e,onChange:e=>r(o,e.target.value,i)}),(0,t.jsx)(eL.TextInput,{placeholder:"Header Value",value:i,onChange:t=>r(o,e,t.target.value)}),(0,t.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%"},children:(0,t.jsx)(tF.MinusCircleOutlined,{onClick:()=>{let e;a(e=s.filter((e,t)=>t!==o)),l?.(Object.fromEntries(e))},style:{cursor:"pointer"}})})]},o)),(0,t.jsx)(G.Button,{type:"dashed",onClick:()=>{a([...s,["",""]])},icon:(0,t.jsx)(tr.PlusOutlined,{}),children:"Add Header"})]})},li=({value:e={},onChange:l})=>{let[s,a]=(0,x.useState)(Object.entries(e)),r=(e,t,r)=>{let i=[...s];i[e]=[t,r],a(i),l?.(Object.fromEntries(i))};return(0,t.jsxs)("div",{children:[s.map(([e,i],o)=>(0,t.jsxs)(A.Space,{style:{display:"flex",marginBottom:8},align:"center",children:[(0,t.jsx)(eL.TextInput,{placeholder:"Parameter Name (e.g., version)",value:e,onChange:e=>r(o,e.target.value,i)}),(0,t.jsx)(eL.TextInput,{placeholder:"Parameter Value (e.g., v1)",value:i,onChange:t=>r(o,e,t.target.value)}),(0,t.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%"},children:(0,t.jsx)(tF.MinusCircleOutlined,{onClick:()=>{let e;a(e=s.filter((e,t)=>t!==o)),l?.(Object.fromEntries(e))},style:{cursor:"pointer"}})})]},o)),(0,t.jsx)(G.Button,{type:"dashed",onClick:()=>{a([...s,["",""]])},icon:(0,t.jsx)(tr.PlusOutlined,{}),children:"Add Query Parameter"})]})};var lo=e.i(240647);let ln=({pathValue:e,targetValue:s,includeSubpath:a})=>{let r=(0,l.getProxyBaseUrl)();return e&&s?(0,t.jsxs)(eA.Card,{className:"p-5",children:[(0,t.jsx)(ec.Title,{className:"text-lg font-semibold text-gray-900 mb-2",children:"Route Preview"}),(0,t.jsx)(ls.Subtitle,{className:"text-gray-600 mb-5",children:"How your requests will be routed"}),(0,t.jsxs)("div",{className:"space-y-5",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"text-base font-semibold text-gray-900 mb-3",children:"Basic routing:"}),(0,t.jsxs)("div",{className:"flex items-center gap-4",children:[(0,t.jsxs)("div",{className:"flex-1 bg-gray-50 border border-gray-200 rounded-lg p-3",children:[(0,t.jsx)("div",{className:"text-sm text-gray-600 mb-2",children:"Your endpoint"}),(0,t.jsx)("code",{className:"font-mono text-sm text-gray-900",children:e?`${r}${e}`:""})]}),(0,t.jsx)("div",{className:"text-gray-400",children:(0,t.jsx)(lo.RightOutlined,{className:"text-lg"})}),(0,t.jsxs)("div",{className:"flex-1 bg-gray-50 border border-gray-200 rounded-lg p-3",children:[(0,t.jsx)("div",{className:"text-sm text-gray-600 mb-2",children:"Forwards to"}),(0,t.jsx)("code",{className:"font-mono text-sm text-gray-900",children:s})]})]})]}),a&&(0,t.jsx)(t.Fragment,{children:(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"text-base font-semibold text-gray-900 mb-3",children:"With subpaths:"}),(0,t.jsxs)("div",{className:"flex items-center gap-4",children:[(0,t.jsxs)("div",{className:"flex-1 bg-gray-50 border border-gray-200 rounded-lg p-3",children:[(0,t.jsx)("div",{className:"text-sm text-gray-600 mb-2",children:"Your endpoint + subpath"}),(0,t.jsxs)("code",{className:"font-mono text-sm text-gray-900",children:[e&&`${r}${e}`,(0,t.jsx)("span",{className:"text-blue-600",children:"/v1/text-to-image/base/model"})]})]}),(0,t.jsx)("div",{className:"text-gray-400",children:(0,t.jsx)(lo.RightOutlined,{className:"text-lg"})}),(0,t.jsxs)("div",{className:"flex-1 bg-gray-50 border border-gray-200 rounded-lg p-3",children:[(0,t.jsx)("div",{className:"text-sm text-gray-600 mb-2",children:"Forwards to"}),(0,t.jsxs)("code",{className:"font-mono text-sm text-gray-900",children:[s,(0,t.jsx)("span",{className:"text-blue-600",children:"/v1/text-to-image/base/model"})]})]})]}),(0,t.jsxs)("div",{className:"mt-3 text-sm text-gray-600",children:["Any path after ",e," will be appended to the target URL"]})]})}),!a&&(0,t.jsx)("div",{className:"mt-4 p-3 bg-blue-50 rounded-md border border-blue-200",children:(0,t.jsxs)("div",{className:"flex items-start",children:[(0,t.jsx)(w.InfoCircleOutlined,{className:"text-blue-500 mt-0.5 mr-2 flex-shrink-0"}),(0,t.jsxs)("div",{className:"text-sm text-blue-700",children:[(0,t.jsx)("span",{className:"font-medium",children:"Not seeing the routing you wanted?"})," Try enabling - Include Subpaths - above - this allows subroutes like"," ",(0,t.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},ld=({premiumUser:e,authEnabled:l,onAuthChange:s})=>(0,t.jsxs)(eA.Card,{className:"p-6",children:[(0,t.jsx)(ec.Title,{className:"text-lg font-semibold text-gray-900 mb-2",children:"Security"}),(0,t.jsx)(ls.Subtitle,{className:"text-gray-600 mb-4",children:"When enabled, requests to this endpoint will require a valid LiteLLM Virtual Key"}),e?(0,t.jsx)(Z.Form.Item,{name:"auth",valuePropName:"checked",className:"mb-0",children:(0,t.jsx)(et.Switch,{checked:l,onChange:e=>{s(e)}})}):(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center mb-3",children:[(0,t.jsx)(et.Switch,{disabled:!0,checked:!1,style:{outline:"2px solid #d1d5db",outlineOffset:"2px"}}),(0,t.jsx)("span",{className:"ml-2 text-sm text-gray-400",children:"Authentication (Premium)"})]}),(0,t.jsx)("div",{className:"p-3 bg-yellow-50 border border-yellow-200 rounded-lg",children:(0,t.jsxs)(ed.Text,{className:"text-sm text-yellow-800",children:["Setting authentication for pass-through endpoints is a LiteLLM Enterprise feature. Get a trial key"," ",(0,t.jsx)("a",{href:"https://www.litellm.ai/#pricing",target:"_blank",rel:"noopener noreferrer",className:"underline",children:"here"}),"."]})})]})]});var lc=e.i(891547);let lm=({accessToken:e,value:l={},onChange:s,disabled:a=!1})=>{let[r,i]=(0,x.useState)(Object.keys(l)),[o,n]=(0,x.useState)(l);(0,x.useEffect)(()=>{n(l),i(Object.keys(l))},[l]);let d=(e,t,l)=>{let a=o[e]||{},r={...o,[e]:{...a,[t]:l.length>0?l:void 0}};r[e]?.request_fields||r[e]?.response_fields||(r[e]=null),n(r),s&&s(r)};return(0,t.jsxs)(eA.Card,{className:"p-6",children:[(0,t.jsx)(ec.Title,{className:"text-lg font-semibold text-gray-900 mb-2",children:"Guardrails"}),(0,t.jsx)(ls.Subtitle,{className:"text-gray-600 mb-6",children:"Configure guardrails to enforce policies on requests and responses. Guardrails are opt-in for passthrough endpoints."}),(0,t.jsx)(tN.Alert,{message:(0,t.jsxs)("span",{children:["Field-Level Targeting"," ",(0,t.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/pass_through_guardrails#field-level-targeting",target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-800 underline",children:"(Learn More)"})]}),description:(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("div",{children:"Optionally specify which fields to check. If left empty, the entire request/response is sent to the guardrail."}),(0,t.jsxs)("div",{className:"text-xs space-y-1 mt-2",children:[(0,t.jsx)("div",{className:"font-medium",children:"Common Examples:"}),(0,t.jsxs)("div",{children:["• ",(0,t.jsx)("code",{className:"bg-gray-100 px-1 rounded",children:"query"})," - Single field"]}),(0,t.jsxs)("div",{children:["• ",(0,t.jsx)("code",{className:"bg-gray-100 px-1 rounded",children:"documents[*].text"})," - All text in documents array"]}),(0,t.jsxs)("div",{children:["• ",(0,t.jsx)("code",{className:"bg-gray-100 px-1 rounded",children:"messages[*].content"})," - All message contents"]})]})]}),type:"info",showIcon:!0,className:"mb-4"}),(0,t.jsx)(Z.Form.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Select Guardrails",(0,t.jsx)(E.Tooltip,{title:"Choose which guardrails should run on this endpoint. Org/team/key level guardrails will also be included.",children:(0,t.jsx)(w.InfoCircleOutlined,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),children:(0,t.jsx)(lc.default,{accessToken:e,value:r,onChange:e=>{i(e);let t={};e.forEach(e=>{t[e]=o[e]||null}),n(t),s&&s(t)},disabled:a})}),r.length>0&&(0,t.jsxs)("div",{className:"mt-6 space-y-4",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,t.jsx)("div",{className:"text-sm font-medium text-gray-700",children:"Field Targeting (Optional)"}),(0,t.jsx)("div",{className:"text-xs text-gray-500",children:"💡 Tip: Leave empty to check entire payload"})]}),r.map(e=>(0,t.jsxs)(eA.Card,{className:"p-4 bg-gray-50",children:[(0,t.jsx)("div",{className:"text-sm font-medium text-gray-900 mb-3",children:e}),(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,t.jsxs)("label",{className:"text-xs text-gray-600 flex items-center",children:["Request Fields (pre_call)",(0,t.jsx)(E.Tooltip,{title:(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"font-medium mb-1",children:"Specify which request fields to check"}),(0,t.jsxs)("div",{className:"text-xs space-y-1",children:[(0,t.jsx)("div",{children:"Examples:"}),(0,t.jsx)("div",{children:"• query"}),(0,t.jsx)("div",{children:"• documents[*].text"}),(0,t.jsx)("div",{children:"• messages[*].content"})]})]}),children:(0,t.jsx)(w.InfoCircleOutlined,{className:"ml-1 text-gray-400"})})]}),(0,t.jsxs)("div",{className:"flex gap-1",children:[(0,t.jsx)("button",{type:"button",onClick:()=>{let t=o[e]?.request_fields||[];d(e,"request_fields",[...t,"query"])},className:"text-xs px-2 py-1 bg-white border border-gray-300 rounded hover:bg-gray-50",disabled:a,children:"+ query"}),(0,t.jsx)("button",{type:"button",onClick:()=>{let t=o[e]?.request_fields||[];d(e,"request_fields",[...t,"documents[*]"])},className:"text-xs px-2 py-1 bg-white border border-gray-300 rounded hover:bg-gray-50",disabled:a,children:"+ documents[*]"})]})]}),(0,t.jsx)(U.Select,{mode:"tags",style:{width:"100%"},placeholder:"Type field name or use + buttons above (e.g., query, documents[*].text)",value:o[e]?.request_fields||[],onChange:t=>d(e,"request_fields",t),disabled:a,tokenSeparators:[","]})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,t.jsxs)("label",{className:"text-xs text-gray-600 flex items-center",children:["Response Fields (post_call)",(0,t.jsx)(E.Tooltip,{title:(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"font-medium mb-1",children:"Specify which response fields to check"}),(0,t.jsxs)("div",{className:"text-xs space-y-1",children:[(0,t.jsx)("div",{children:"Examples:"}),(0,t.jsx)("div",{children:"• results[*].text"}),(0,t.jsx)("div",{children:"• choices[*].message.content"})]})]}),children:(0,t.jsx)(w.InfoCircleOutlined,{className:"ml-1 text-gray-400"})})]}),(0,t.jsx)("div",{className:"flex gap-1",children:(0,t.jsx)("button",{type:"button",onClick:()=>{let t=o[e]?.response_fields||[];d(e,"response_fields",[...t,"results[*]"])},className:"text-xs px-2 py-1 bg-white border border-gray-300 rounded hover:bg-gray-50",disabled:a,children:"+ results[*]"})})]}),(0,t.jsx)(U.Select,{mode:"tags",style:{width:"100%"},placeholder:"Type field name or use + buttons above (e.g., results[*].text)",value:o[e]?.response_fields||[],onChange:t=>d(e,"response_fields",t),disabled:a,tokenSeparators:[","]})]})]})]},e))]})]})},{Option:lu}=U.Select,lh=["GET","POST","PUT","DELETE","PATCH"],lx=({accessToken:e,setPassThroughItems:s,passThroughItems:a,premiumUser:r=!1})=>{let[i]=Z.Form.useForm(),[o,n]=(0,x.useState)(!1),[d,c]=(0,x.useState)(!1),[m,u]=(0,x.useState)(""),[h,p]=(0,x.useState)(""),[g,f]=(0,x.useState)(""),[j,_]=(0,x.useState)(!0),[y,b]=(0,x.useState)(!1),[v,N]=(0,x.useState)([]),[C,S]=(0,x.useState)({}),k=()=>{i.resetFields(),p(""),f(""),_(!0),N([]),S({}),n(!1)},F=async t=>{console.log("addPassThrough called with:",t),c(!0);try{!r&&"auth"in t&&delete t.auth,C&&Object.keys(C).length>0&&(t.guardrails=C),v&&v.length>0&&(t.methods=v),console.log(`formValues: ${JSON.stringify(t)}`);let o=(await (0,l.createPassThroughEndpoint)(e,t)).endpoints[0],d=[...a,o];s(d),Y.default.success("Pass-through endpoint created successfully"),i.resetFields(),p(""),f(""),_(!0),N([]),S({}),n(!1)}catch(e){Y.default.fromBackend("Error creating pass-through endpoint: "+e)}finally{c(!1)}};return(0,t.jsxs)("div",{children:[(0,t.jsx)(T.Button,{className:"mx-auto mb-4 mt-4",onClick:()=>n(!0),children:"+ Add Pass-Through Endpoint"}),(0,t.jsx)(ee.Modal,{title:(0,t.jsxs)("div",{className:"flex items-center space-x-3 pb-4 border-b border-gray-100",children:[(0,t.jsx)(la.ApiOutlined,{className:"text-xl text-blue-500"}),(0,t.jsx)("h2",{className:"text-xl font-semibold text-gray-900",children:"Add Pass-Through Endpoint"})]}),open:o,width:1e3,onCancel:k,footer:null,className:"top-8",styles:{body:{padding:"24px"},header:{padding:"24px 24px 0 24px",border:"none"}},children:(0,t.jsxs)("div",{className:"mt-6",children:[(0,t.jsx)(tN.Alert,{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,t.jsxs)(Z.Form,{form:i,onFinish:F,layout:"vertical",className:"space-y-6",initialValues:{include_subpath:!0,path:h,target:g},children:[(0,t.jsxs)(eA.Card,{className:"p-5",children:[(0,t.jsx)(ec.Title,{className:"text-lg font-semibold text-gray-900 mb-2",children:"Route Configuration"}),(0,t.jsx)(ls.Subtitle,{className:"text-gray-600 mb-5",children:"Configure how requests to your domain will be forwarded to the target API"}),(0,t.jsxs)("div",{className:"space-y-5",children:[(0,t.jsx)(Z.Form.Item,{label:(0,t.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,t.jsx)("div",{className:"text-xs text-gray-500 mt-1",children:"Example: /bria, /adobe-photoshop, /elasticsearch"}),className:"mb-4",children:(0,t.jsx)("div",{className:"flex items-center",children:(0,t.jsx)(eL.TextInput,{placeholder:"bria",value:h,onChange:e=>{var t;let l;return l=t=e.target.value,void(t&&!t.startsWith("/")&&(l="/"+t),p(l),i.setFieldsValue({path:l}))},className:"flex-1"})})}),(0,t.jsx)(Z.Form.Item,{label:(0,t.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,t.jsx)("div",{className:"text-xs text-gray-500 mt-1",children:"Example:https://engine.prod.bria-api.com"}),className:"mb-4",children:(0,t.jsx)(eL.TextInput,{placeholder:"https://engine.prod.bria-api.com",value:g,onChange:e=>{f(e.target.value),i.setFieldsValue({target:e.target.value})}})}),(0,t.jsx)(Z.Form.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["HTTP Methods (Optional)",(0,t.jsx)(E.Tooltip,{title:"Select specific HTTP methods. Leave empty to support all methods (GET, POST, PUT, DELETE, PATCH). Useful when the same path needs different targets for different methods.",children:(0,t.jsx)(w.InfoCircleOutlined,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"methods",extra:(0,t.jsx)("div",{className:"text-xs text-gray-500 mt-1",children:0===v.length?"All HTTP methods supported (default)":`Only ${v.join(", ")} requests will be routed to this endpoint`}),className:"mb-4",children:(0,t.jsx)(U.Select,{mode:"multiple",placeholder:"Select methods (leave empty for all)",value:v,onChange:N,allowClear:!0,style:{width:"100%"},children:lh.map(e=>(0,t.jsx)(lu,{value:e,children:e},e))})}),(0,t.jsxs)("div",{className:"flex items-center justify-between py-3",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"text-sm font-medium text-gray-700",children:"Include Subpaths"}),(0,t.jsx)("div",{className:"text-xs text-gray-500 mt-0.5",children:"Forward all subpaths to the target API (recommended for REST APIs)"})]}),(0,t.jsx)(Z.Form.Item,{name:"include_subpath",valuePropName:"checked",className:"mb-0",children:(0,t.jsx)(tv.Switch,{checked:j,onChange:_})})]})]})]}),(0,t.jsx)(ln,{pathValue:h,targetValue:g,includeSubpath:j}),(0,t.jsxs)(eA.Card,{className:"p-6",children:[(0,t.jsx)(ec.Title,{className:"text-lg font-semibold text-gray-900 mb-2",children:"Headers"}),(0,t.jsx)(ls.Subtitle,{className:"text-gray-600 mb-6",children:"Add headers that will be sent with every request to the target API"}),(0,t.jsx)(Z.Form.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Authentication Headers",(0,t.jsx)(E.Tooltip,{title:"Authentication and other headers to forward with requests",children:(0,t.jsx)(w.InfoCircleOutlined,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"headers",rules:[{required:!0,message:"Please configure the headers"}],extra:(0,t.jsxs)("div",{className:"text-xs text-gray-500 mt-2",children:[(0,t.jsx)("div",{className:"font-medium mb-1",children:"Add authentication tokens and other required headers"}),(0,t.jsx)("div",{children:"Common examples: auth_token, Authorization, x-api-key"})]}),children:(0,t.jsx)(lr,{})})]}),(0,t.jsxs)(eA.Card,{className:"p-6",children:[(0,t.jsx)(ec.Title,{className:"text-lg font-semibold text-gray-900 mb-2",children:"Default Query Parameters"}),(0,t.jsx)(ls.Subtitle,{className:"text-gray-600 mb-6",children:"Add query parameters that will be automatically sent with every request to the target API"}),(0,t.jsx)(Z.Form.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Default Query Parameters (Optional)",(0,t.jsx)(E.Tooltip,{title:"Query parameters that will be added to all requests. Clients can override these by providing their own values.",children:(0,t.jsx)(w.InfoCircleOutlined,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"default_query_params",extra:(0,t.jsxs)("div",{className:"text-xs text-gray-500 mt-2",children:[(0,t.jsx)("div",{className:"font-medium mb-1",children:"Parameters are sent with all GET, POST, PUT, PATCH requests"}),(0,t.jsx)("div",{children:"Client parameters override defaults. Examples: version=v1, format=json, key=default"})]}),children:(0,t.jsx)(li,{})})]}),(0,t.jsx)(ld,{premiumUser:r,authEnabled:y,onAuthChange:e=>{b(e),i.setFieldsValue({auth:e})}}),(0,t.jsx)(lm,{accessToken:e,value:C,onChange:S}),(0,t.jsxs)(eA.Card,{className:"p-6",children:[(0,t.jsx)(ec.Title,{className:"text-lg font-semibold text-gray-900 mb-2",children:"Billing"}),(0,t.jsx)(ls.Subtitle,{className:"text-gray-600 mb-6",children:"Optional cost tracking for this endpoint"}),(0,t.jsx)(Z.Form.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Cost Per Request (USD)",(0,t.jsx)(E.Tooltip,{title:"Optional: Track costs for requests to this endpoint",children:(0,t.jsx)(w.InfoCircleOutlined,{className:"ml-2 text-gray-400 hover:text-gray-600"})})]}),name:"cost_per_request",extra:(0,t.jsx)("div",{className:"text-xs text-gray-500 mt-2",children:"The cost charged for each request through this endpoint"}),children:(0,t.jsx)(tI.default,{min:0,step:.001,precision:4,placeholder:"2.0000",size:"large"})})]}),(0,t.jsxs)("div",{className:"flex items-center justify-end space-x-3 pt-6 border-t border-gray-100",children:[(0,t.jsx)(T.Button,{variant:"secondary",onClick:k,children:"Cancel"}),(0,t.jsx)(T.Button,{variant:"primary",loading:d,onClick:()=>{console.log("Submit button clicked"),i.submit()},children:d?"Creating...":"Add Pass-Through Endpoint"})]})]})]})})]})};var lp=e.i(286536),lg=e.i(77705);let lf=["GET","POST","PUT","DELETE","PATCH"],{Option:lj}=U.Select,l_=({value:e})=>{let[l,s]=(0,x.useState)(!1),a=JSON.stringify(e,null,2);return(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)("pre",{className:"font-mono text-xs bg-gray-50 p-2 rounded max-w-md overflow-auto",children:l?a:"••••••••"}),(0,t.jsx)("button",{onClick:()=>s(!l),className:"p-1 hover:bg-gray-100 rounded",type:"button",children:l?(0,t.jsx)(lg.EyeOff,{className:"w-4 h-4 text-gray-500"}):(0,t.jsx)(lp.Eye,{className:"w-4 h-4 text-gray-500"})})]})},ly=({endpointData:e,onClose:s,accessToken:a,isAdmin:r,premiumUser:i=!1,onEndpointUpdated:o})=>{let[n,d]=(0,x.useState)(e),[c,m]=(0,x.useState)(!1),[u,h]=(0,x.useState)(!1),[p,g]=(0,x.useState)(e?.auth||!1),[f,j]=(0,x.useState)(e?.methods||[]),[_,y]=(0,x.useState)(e?.guardrails||{}),[b]=Z.Form.useForm(),v=async e=>{try{if(!a||!n?.id)return;let t={};if(e.headers)try{t="string"==typeof e.headers?JSON.parse(e.headers):e.headers}catch(e){Y.default.fromBackend("Invalid JSON format for headers");return}let s={path:n.path,target:e.target,headers:t,include_subpath:e.include_subpath,cost_per_request:e.cost_per_request,auth:i?e.auth:void 0,methods:f&&f.length>0?f:void 0,guardrails:_&&Object.keys(_).length>0?_:void 0};await (0,l.updatePassThroughEndpoint)(a,n.id,s),d({...n,...s}),h(!1),o&&o()}catch(e){console.error("Error updating endpoint:",e),Y.default.fromBackend("Failed to update pass through endpoint")}},N=async()=>{try{if(!a||!n?.id)return;await (0,l.deletePassThroughEndpointsCall)(a,n.id),Y.default.success("Pass through endpoint deleted successfully"),s(),o&&o()}catch(e){console.error("Error deleting endpoint:",e),Y.default.fromBackend("Failed to delete pass through endpoint")}};return c?(0,t.jsx)("div",{className:"p-4",children:"Loading..."}):n?(0,t.jsxs)("div",{className:"p-4",children:[(0,t.jsx)("div",{className:"flex justify-between items-center mb-6",children:(0,t.jsxs)("div",{children:[(0,t.jsx)(G.Button,{onClick:s,className:"mb-4",children:"← Back"}),(0,t.jsxs)(ec.Title,{children:["Pass Through Endpoint: ",n.path]}),(0,t.jsx)(ed.Text,{className:"text-gray-500 font-mono",children:n.id})]})}),(0,t.jsxs)(e4.TabGroup,{children:[(0,t.jsxs)(e5.TabList,{className:"mb-4",children:[(0,t.jsx)(e2.Tab,{children:"Overview"},"overview"),r?(0,t.jsx)(e2.Tab,{children:"Settings"},"settings"):(0,t.jsx)(t.Fragment,{})]}),(0,t.jsxs)(e6.TabPanels,{children:[(0,t.jsxs)(H.TabPanel,{children:[(0,t.jsxs)(D.Grid,{numItems:1,numItemsSm:2,numItemsLg:3,className:"gap-6",children:[(0,t.jsxs)(eA.Card,{children:[(0,t.jsx)(ed.Text,{children:"Path"}),(0,t.jsx)("div",{className:"mt-2",children:(0,t.jsx)(ec.Title,{className:"font-mono",children:n.path})})]}),(0,t.jsxs)(eA.Card,{children:[(0,t.jsx)(ed.Text,{children:"Target"}),(0,t.jsx)("div",{className:"mt-2",children:(0,t.jsx)(ec.Title,{children:n.target})})]}),(0,t.jsxs)(eA.Card,{children:[(0,t.jsx)(ed.Text,{children:"Configuration"}),(0,t.jsxs)("div",{className:"mt-2 space-y-2",children:[(0,t.jsx)("div",{children:(0,t.jsx)(k.Badge,{color:n.include_subpath?"green":"gray",children:n.include_subpath?"Include Subpath":"Exact Path"})}),(0,t.jsx)("div",{children:(0,t.jsx)(k.Badge,{color:n.auth?"blue":"gray",children:n.auth?"Auth Required":"No Auth"})}),n.methods&&n.methods.length>0&&(0,t.jsxs)("div",{children:[(0,t.jsx)(ed.Text,{className:"text-xs text-gray-500",children:"HTTP Methods:"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-1 mt-1",children:n.methods.map(e=>(0,t.jsx)(k.Badge,{color:"indigo",size:"sm",children:e},e))})]}),(!n.methods||0===n.methods.length)&&(0,t.jsx)("div",{children:(0,t.jsx)(ed.Text,{className:"text-xs text-gray-500",children:"All HTTP methods supported"})}),void 0!==n.cost_per_request&&(0,t.jsx)("div",{children:(0,t.jsxs)(ed.Text,{children:["Cost per request: $",n.cost_per_request]})})]})]})]}),(0,t.jsx)("div",{className:"mt-6",children:(0,t.jsx)(ln,{pathValue:n.path,targetValue:n.target,includeSubpath:n.include_subpath||!1})}),n.headers&&Object.keys(n.headers).length>0&&(0,t.jsxs)(eA.Card,{className:"mt-6",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsx)(ed.Text,{className:"font-medium",children:"Headers"}),(0,t.jsxs)(k.Badge,{color:"blue",children:[Object.keys(n.headers).length," headers configured"]})]}),(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsx)(l_,{value:n.headers})})]}),n.guardrails&&Object.keys(n.guardrails).length>0&&(0,t.jsxs)(eA.Card,{className:"mt-6",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsx)(ed.Text,{className:"font-medium",children:"Guardrails"}),(0,t.jsxs)(k.Badge,{color:"purple",children:[Object.keys(n.guardrails).length," guardrails configured"]})]}),(0,t.jsx)("div",{className:"mt-4 space-y-2",children:Object.entries(n.guardrails).map(([e,l])=>(0,t.jsxs)("div",{className:"p-3 bg-gray-50 rounded",children:[(0,t.jsx)("div",{className:"font-medium text-sm",children:e}),l&&(l.request_fields||l.response_fields)&&(0,t.jsxs)("div",{className:"mt-2 text-xs text-gray-600 space-y-1",children:[l.request_fields&&(0,t.jsxs)("div",{children:["Request fields: ",l.request_fields.join(", ")]}),l.response_fields&&(0,t.jsxs)("div",{children:["Response fields: ",l.response_fields.join(", ")]})]}),!l&&(0,t.jsx)("div",{className:"text-xs text-gray-600 mt-1",children:"Uses entire payload"})]},e))})]})]}),r&&(0,t.jsx)(H.TabPanel,{children:(0,t.jsxs)(eA.Card,{children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,t.jsx)(ec.Title,{children:"Pass Through Endpoint Settings"}),(0,t.jsx)("div",{className:"space-x-2",children:!u&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(T.Button,{onClick:()=>h(!0),children:"Edit Settings"}),(0,t.jsx)(T.Button,{onClick:N,variant:"secondary",color:"red",children:"Delete Endpoint"})]})})]}),u?(0,t.jsxs)(Z.Form,{form:b,onFinish:v,initialValues:{target:n.target,headers:n.headers?JSON.stringify(n.headers,null,2):"",include_subpath:n.include_subpath||!1,cost_per_request:n.cost_per_request,auth:n.auth||!1,methods:n.methods||[]},layout:"vertical",children:[(0,t.jsx)(Z.Form.Item,{label:"Target URL",name:"target",rules:[{required:!0,message:"Please input a target URL"}],children:(0,t.jsx)(eL.TextInput,{placeholder:"https://api.example.com"})}),(0,t.jsx)(Z.Form.Item,{label:"Headers (JSON)",name:"headers",children:(0,t.jsx)(eq.Input.TextArea,{rows:5,placeholder:'{"Authorization": "Bearer your-token", "Content-Type": "application/json"}'})}),(0,t.jsx)(Z.Form.Item,{label:"HTTP Methods (Optional)",name:"methods",extra:0===f.length?"All HTTP methods supported (default)":`Only ${f.join(", ")} requests will be routed to this endpoint`,children:(0,t.jsx)(U.Select,{mode:"multiple",placeholder:"Select methods (leave empty for all)",value:f,onChange:j,allowClear:!0,style:{width:"100%"},children:lf.map(e=>(0,t.jsx)(lj,{value:e,children:e},e))})}),(0,t.jsx)(Z.Form.Item,{label:"Include Subpath",name:"include_subpath",valuePropName:"checked",children:(0,t.jsx)(et.Switch,{})}),(0,t.jsx)(Z.Form.Item,{label:"Cost per Request",name:"cost_per_request",children:(0,t.jsx)(em.InputNumber,{min:0,step:.01,precision:2,placeholder:"0.00",addonBefore:"$"})}),(0,t.jsx)(ld,{premiumUser:i,authEnabled:p,onAuthChange:e=>{g(e),b.setFieldsValue({auth:e})}}),(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsx)(lm,{accessToken:a||"",value:_,onChange:y})}),(0,t.jsxs)("div",{className:"flex justify-end gap-2 mt-6",children:[(0,t.jsx)(G.Button,{onClick:()=>h(!1),children:"Cancel"}),(0,t.jsx)(T.Button,{children:"Save Changes"})]})]}):(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(ed.Text,{className:"font-medium",children:"Path"}),(0,t.jsx)("div",{className:"font-mono",children:n.path})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(ed.Text,{className:"font-medium",children:"Target URL"}),(0,t.jsx)("div",{children:n.target})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(ed.Text,{className:"font-medium",children:"Include Subpath"}),(0,t.jsx)(k.Badge,{color:n.include_subpath?"green":"gray",children:n.include_subpath?"Yes":"No"})]}),void 0!==n.cost_per_request&&(0,t.jsxs)("div",{children:[(0,t.jsx)(ed.Text,{className:"font-medium",children:"Cost per Request"}),(0,t.jsxs)("div",{children:["$",n.cost_per_request]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(ed.Text,{className:"font-medium",children:"Authentication Required"}),(0,t.jsx)(k.Badge,{color:n.auth?"green":"gray",children:n.auth?"Yes":"No"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(ed.Text,{className:"font-medium",children:"Headers"}),n.headers&&Object.keys(n.headers).length>0?(0,t.jsx)("div",{className:"mt-2",children:(0,t.jsx)(l_,{value:n.headers})}):(0,t.jsx)("div",{className:"text-gray-500",children:"No headers configured"})]})]})]})})]})]})]}):(0,t.jsx)("div",{className:"p-4",children:"Pass through endpoint not found"})};var lb=e.i(149121);let lv=({value:e})=>{let[l,s]=(0,x.useState)(!1),a=JSON.stringify(e);return(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)("span",{className:"font-mono text-xs",children:l?a:"••••••••"}),(0,t.jsx)("button",{onClick:()=>s(!l),className:"p-1 hover:bg-gray-100 rounded",type:"button",children:l?(0,t.jsx)(lg.EyeOff,{className:"w-4 h-4 text-gray-500"}):(0,t.jsx)(lp.Eye,{className:"w-4 h-4 text-gray-500"})})]})},lN=({accessToken:e,userRole:s,userID:a,modelData:r,premiumUser:i})=>{let[o,n]=(0,x.useState)([]),[d,c]=(0,x.useState)(null),[m,u]=(0,x.useState)(!1),[h,p]=(0,x.useState)(null);(0,x.useEffect)(()=>{e&&s&&a&&(0,l.getPassThroughEndpointsCall)(e).then(e=>{n(e.endpoints)})},[e,s,a]);let g=async e=>{p(e),u(!0)},f=async()=>{if(null!=h&&e){try{await (0,l.deletePassThroughEndpointsCall)(e,h);let t=o.filter(e=>e.id!==h);n(t),Y.default.success("Endpoint deleted successfully.")}catch(e){console.error("Error deleting the endpoint:",e),Y.default.fromBackend("Error deleting the endpoint: "+e)}u(!1),p(null)}},j=[{header:"ID",accessorKey:"id",cell:e=>(0,t.jsx)(E.Tooltip,{title:e.row.original.id,children:(0,t.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&&c(e.row.original.id),children:e.row.original.id})})},{header:"Path",accessorKey:"path"},{header:"Target",accessorKey:"target",cell:e=>(0,t.jsx)(ed.Text,{children:e.getValue()})},{header:()=>(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsx)("span",{children:"Methods"}),(0,t.jsx)(E.Tooltip,{title:"HTTP methods supported by this endpoint",children:(0,t.jsx)(tK.InformationCircleIcon,{className:"w-4 h-4 text-gray-400 cursor-help"})})]}),accessorKey:"methods",cell:e=>{let l=e.getValue();return l&&0!==l.length?(0,t.jsx)("div",{className:"flex flex-wrap gap-1",children:l.map(e=>(0,t.jsx)($.Badge,{color:"indigo",className:"text-xs",children:e},e))}):(0,t.jsx)($.Badge,{color:"blue",children:"ALL"})}},{header:()=>(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsx)("span",{children:"Authentication"}),(0,t.jsx)(E.Tooltip,{title:"LiteLLM Virtual Key required to call endpoint",children:(0,t.jsx)(tK.InformationCircleIcon,{className:"w-4 h-4 text-gray-400 cursor-help"})})]}),accessorKey:"auth",cell:e=>(0,t.jsx)($.Badge,{color:e.getValue()?"green":"gray",children:e.getValue()?"Yes":"No"})},{header:"Headers",accessorKey:"headers",cell:e=>(0,t.jsx)(lv,{value:e.getValue()||{}})},{header:"Actions",id:"actions",cell:({row:e})=>(0,t.jsxs)("div",{className:"flex space-x-1",children:[(0,t.jsx)(F.Icon,{icon:eM.PencilAltIcon,size:"sm",onClick:()=>e.original.id&&c(e.original.id),title:"Edit"}),(0,t.jsx)(F.Icon,{icon:S.TrashIcon,size:"sm",onClick:()=>{var t;return t=e.original.id,e.index,void g(t)},title:"Delete"})]})}];if(!e)return null;if(d){console.log("selectedEndpointId",d),console.log("generalSettings",o);let a=o.find(e=>e.id===d);return a?(0,t.jsx)(ly,{endpointData:a,onClose:()=>c(null),accessToken:e,isAdmin:"Admin"===s||"admin"===s,premiumUser:i,onEndpointUpdated:()=>{e&&(0,l.getPassThroughEndpointsCall)(e).then(e=>{n(e.endpoints)})}}):(0,t.jsx)("div",{children:"Endpoint not found"})}return(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(ec.Title,{children:"Pass Through Endpoints"}),(0,t.jsx)(ed.Text,{className:"text-tremor-content",children:"Configure and manage your pass-through endpoints"})]}),(0,t.jsx)(lx,{accessToken:e,setPassThroughItems:n,passThroughItems:o,premiumUser:i}),(0,t.jsx)(lb.DataTable,{data:o,columns:j,renderSubComponent:()=>(0,t.jsx)("div",{}),getRowCanExpand:()=>!1,isLoading:!1,noDataMessage:"No pass-through endpoints configured"}),m&&(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 Pass-Through Endpoint"}),(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 pass-through endpoint? This action cannot be undone."})})]})})}),(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)(T.Button,{onClick:f,color:"red",className:"ml-2",children:"Delete"}),(0,t.jsx)(T.Button,{onClick:()=>{u(!1),p(null)},children:"Cancel"})]})]})]})})]})};e.s(["default",0,lN],147612);var lw=e.i(56567);e.s(["default",0,({premiumUser:e,teams:s})=>{let{accessToken:a,token:i,userRole:m,userId:u}=(0,r.default)(),[h]=Z.Form.useForm(),[p,g]=(0,x.useState)(""),[f,j]=(0,x.useState)([]),[_,y]=(0,x.useState)(eF.Providers.Anthropic),[b,v]=(0,x.useState)(null),[N,w]=(0,x.useState)(null),[C,S]=(0,x.useState)(null),[k,T]=(0,x.useState)(0),[I,P]=(0,x.useState)({}),[M,A]=(0,x.useState)(!1),[E,R]=(0,x.useState)(null),[O,B]=(0,x.useState)(null),[z,V]=(0,x.useState)(0),$=(0,e0.useQueryClient)(),{data:G,isLoading:U,refetch:J}=(0,d.useModelsInfo)(),{data:K,isLoading:W}=(0,n.useModelCostMap)(),{data:Q,isLoading:X}=o(),ee=Q?.credentials||[],{data:et,isLoading:el}=(0,c.useUISettings)(),es=(0,x.useMemo)(()=>{if(!G?.data)return[];let e=new Set;for(let t of G.data)e.add(t.model_name);return Array.from(e).sort()},[G?.data]),er=(0,x.useMemo)(()=>{if(!G?.data)return[];let e=new Set;for(let t of G.data){let l=t.model_info;if(l?.access_groups)for(let t of l.access_groups)e.add(t)}return Array.from(e)},[G?.data]),eo=(0,x.useMemo)(()=>G?.data?G.data.map(e=>e.model_name):[],[G?.data]),en=(0,x.useMemo)(()=>G?.data?G.data.map(e=>e.model_info?.id).filter(e=>!!e):[],[G?.data]),ec=e=>null!=K&&"object"==typeof K&&e in K?K[e].litellm_provider:"openai",em=(0,x.useMemo)(()=>G?.data?ea(G,ec):{data:[]},[G?.data,ec]),eu=m&&(0,eX.isProxyAdminRole)(m),ex=m&&eX.internalUserRoles.includes(m),ep=u&&(0,eX.isUserTeamAdminForAnyTeam)(s,u),eg=ex&&et?.values?.disable_model_add_for_internal_users===!0,ef=!eu&&(eg||!ep),ej={name:"file",accept:".json",pastable:!1,beforeUpload:e=>{if("application/json"===e.type){let t=new FileReader;t.onload=e=>{if(e.target){let t=e.target.result;h.setFieldsValue({vertex_credentials:t})}},t.readAsText(e)}return!1},onChange(e){"done"===e.file.status?Y.default.success(`${e.file.name} file uploaded successfully`):"error"===e.file.status&&Y.default.fromBackend(`${e.file.name} file upload failed.`)}},e_=()=>{g(new Date().toLocaleString()),$.invalidateQueries({queryKey:["models","list"]}),J()},ey=async()=>{if(a)try{let e={router_settings:{}};"global"===b?(C&&(e.router_settings.retry_policy=C),Y.default.success("Global retry settings saved successfully")):(N&&(e.router_settings.model_group_retry_policy=N),Y.default.success(`Retry settings saved successfully for ${b}`)),await (0,l.setCallbacksCall)(a,e)}catch(e){Y.default.fromBackend("Failed to save retry settings")}};if((0,x.useEffect)(()=>{if(!a||!i||!m||!u||!G)return;let e=async()=>{try{let e=(await (0,l.getCallbacksCall)(a,u,m)).router_settings,t=e.model_group_retry_policy,s=e.num_retries;w(t),S(e.retry_policy),T(s);let r=e.model_group_alias||{};P(r)}catch(e){console.error("Error fetching model data:",e)}};a&&i&&m&&u&&G&&e()},[a,i,m,u,G]),m&&"Admin Viewer"==m){let{Title:e,Paragraph:l}=L.Typography;return(0,t.jsxs)("div",{children:[(0,t.jsx)(e,{level:1,children:"Access Denied"}),(0,t.jsx)(l,{children:"Ask your proxy admin for access to view all models"})]})}let eb=async()=>{try{let e=await h.validateFields();await eP(e,a,h,e_)}catch(t){let e=t.errorFields?.map(e=>`${e.name.join(".")}: ${e.errors.join(", ")}`).join(" | ")||"Unknown validation error";Y.default.fromBackend(`Please fill in the following required fields: ${e}`)}};return(Object.keys(eF.Providers).find(e=>eF.Providers[e]===_),O)?(0,t.jsx)("div",{className:"w-full h-full",children:(0,t.jsx)(lw.default,{teamId:O,onClose:()=>B(null),accessToken:a,is_team_admin:"Admin"===m,is_proxy_admin:"Proxy Admin"===m,userModels:eo,editTeam:!1,onUpdate:e_,premiumUser:e})}):(0,t.jsx)("div",{className:"w-full mx-4 h-[75vh]",children:(0,t.jsx)(D.Grid,{numItems:1,className:"gap-2 p-8 w-full mt-2",children:(0,t.jsxs)(e1.Col,{numColSpan:1,className:"flex flex-col gap-2",children:[(0,t.jsx)("div",{className:"flex justify-between items-center mb-4",children:(0,t.jsxs)("div",{children:[(0,t.jsx)("h2",{className:"text-lg font-semibold",children:"Model Management"}),eX.all_admin_roles.includes(m)?(0,t.jsx)("p",{className:"text-sm text-gray-600",children:"Add and manage models for the proxy"}):(0,t.jsx)("p",{className:"text-sm text-gray-600",children:"Add models for teams you are an admin for."})]})}),(0,t.jsxs)("div",{className:"mb-4 px-4 py-3 bg-blue-50 rounded-lg border border-blue-100 flex items-center gap-4",children:[(0,t.jsx)("div",{className:"flex-shrink-0 w-10 h-10 bg-white rounded-full flex items-center justify-center border border-blue-200",children:(0,t.jsx)(e3.PlusCircleOutlined,{style:{fontSize:"18px",color:"#6366f1"}})}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("h4",{className:"text-gray-900 font-semibold text-sm m-0",children:"Missing a provider?"}),(0,t.jsx)("p",{className:"text-gray-500 text-xs m-0 mt-0.5",children:"The LiteLLM engineering team is constantly adding support for new LLM models, providers, endpoints. If you don't see the one you need, let us know and we'll prioritize it."})]}),(0,t.jsxs)("a",{href:"https://models.litellm.ai/?request=true",target:"_blank",rel:"noopener noreferrer",className:"flex-shrink-0 inline-flex items-center gap-2 px-4 py-2 bg-[#6366f1] hover:bg-[#5558e3] text-white text-sm font-medium rounded-lg transition-colors",children:["Request Provider",(0,t.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})]})]}),E&&!(U||W||X||el)?(0,t.jsx)(ll,{modelId:E,onClose:()=>{R(null)},accessToken:a,userID:u,userRole:m,onModelUpdate:e=>{$.invalidateQueries({queryKey:["models","list"]}),e_()},modelAccessGroups:er}):(0,t.jsxs)(e4.TabGroup,{index:z,onIndexChange:V,className:"gap-2 h-[75vh] w-full ",children:[(0,t.jsxs)(e5.TabList,{className:"flex justify-between mt-2 w-full items-center",children:[(0,t.jsxs)("div",{className:"flex",children:[eX.all_admin_roles.includes(m)?(0,t.jsx)(e2.Tab,{children:"All Models"}):(0,t.jsx)(e2.Tab,{children:"Your Models"}),!ef&&(0,t.jsx)(e2.Tab,{children:"Add Model"}),eX.all_admin_roles.includes(m)&&(0,t.jsx)(e2.Tab,{children:"LLM Credentials"}),eX.all_admin_roles.includes(m)&&(0,t.jsx)(e2.Tab,{children:"Pass-Through Endpoints"}),eX.all_admin_roles.includes(m)&&(0,t.jsx)(e2.Tab,{children:"Health Status"}),eX.all_admin_roles.includes(m)&&(0,t.jsx)(e2.Tab,{children:"Model Retry Settings"}),eX.all_admin_roles.includes(m)&&(0,t.jsx)(e2.Tab,{children:"Model Group Alias"}),eX.all_admin_roles.includes(m)&&(0,t.jsx)(e2.Tab,{children:"Price Data Reload"})]}),(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[p&&(0,t.jsxs)(ed.Text,{children:["Last Refreshed: ",p]}),(0,t.jsx)(F.Icon,{icon:eZ.RefreshIcon,variant:"shadow",size:"xs",className:"self-center",onClick:e_})]})]}),(0,t.jsxs)(e6.TabPanels,{children:[(0,t.jsx)(ei,{selectedModelGroup:b,setSelectedModelGroup:v,availableModelGroups:es,availableModelAccessGroups:er,setSelectedModelId:R,setSelectedTeamId:B}),!ef&&(0,t.jsx)(H.TabPanel,{className:"h-full",children:(0,t.jsx)(tG,{form:h,handleOk:eb,selectedProvider:_,setSelectedProvider:y,providerModels:f,setProviderModelsFn:e=>{j((0,eF.getProviderModels)(e,K))},getPlaceholder:eF.getPlaceholder,uploadProps:ej,showAdvancedSettings:M,setShowAdvancedSettings:A,teams:s,credentials:ee,accessToken:a,userRole:m})}),(0,t.jsx)(H.TabPanel,{children:(0,t.jsx)(eY,{uploadProps:ej})}),(0,t.jsx)(H.TabPanel,{children:(0,t.jsx)(lN,{accessToken:a,userRole:m,userID:u,modelData:em,premiumUser:e})}),(0,t.jsx)(H.TabPanel,{children:(0,t.jsx)(tY,{accessToken:a,modelData:em,all_models_on_proxy:en,getDisplayModelName:q,setSelectedModelId:R,teams:s})}),(0,t.jsx)(eh,{selectedModelGroup:b,setSelectedModelGroup:v,availableModelGroups:es,globalRetryPolicy:C,setGlobalRetryPolicy:S,defaultRetry:k,modelGroupRetryPolicy:N,setModelGroupRetryPolicy:w,handleSaveRetrySettings:ey}),(0,t.jsx)(H.TabPanel,{children:(0,t.jsx)(t2,{accessToken:a,initialModelGroupAlias:I,onAliasUpdate:P})}),(0,t.jsx)(eT,{})]})]})]})})})}],161059)}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/0ee6fa13c7ff04d1.js b/litellm/proxy/_experimental/out/_next/static/chunks/0ee6fa13c7ff04d1.js new file mode 100644 index 00000000000..1914e3d9985 --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/0ee6fa13c7ff04d1.js @@ -0,0 +1,8 @@ +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,738014,e=>{"use strict";var t=e.i(135214),a=e.i(764205),r=e.i(266027);let l=(0,e.i(243652).createQueryKeys)("users");e.s(["useCurrentUser",0,()=>{let{accessToken:e,userId:i,userRole:n}=(0,t.default)();return(0,r.useQuery)({queryKey:l.detail(i),queryFn:async()=>{let t=await (0,a.userInfoCall)(e,i,n,!1,null,null);return console.log(`userInfo: ${JSON.stringify(t)}`),t.user_info},enabled:!!(e&&i&&n)})}])},906579,e=>{"use strict";e.i(247167);var t=e.i(271645),a=e.i(343794),r=e.i(361275),l=e.i(702779),i=e.i(763731),n=e.i(242064);e.i(296059);var s=e.i(915654),o=e.i(694758),c=e.i(183293),d=e.i(403541),u=e.i(246422),m=e.i(838378);let g=new o.Keyframes("antStatusProcessing",{"0%":{transform:"scale(0.8)",opacity:.5},"100%":{transform:"scale(2.4)",opacity:0}}),f=new o.Keyframes("antZoomBadgeIn",{"0%":{transform:"scale(0) translate(50%, -50%)",opacity:0},"100%":{transform:"scale(1) translate(50%, -50%)"}}),b=new o.Keyframes("antZoomBadgeOut",{"0%":{transform:"scale(1) translate(50%, -50%)"},"100%":{transform:"scale(0) translate(50%, -50%)",opacity:0}}),p=new o.Keyframes("antNoWrapperZoomBadgeIn",{"0%":{transform:"scale(0)",opacity:0},"100%":{transform:"scale(1)"}}),h=new o.Keyframes("antNoWrapperZoomBadgeOut",{"0%":{transform:"scale(1)"},"100%":{transform:"scale(0)",opacity:0}}),v=new o.Keyframes("antBadgeLoadingCircle",{"0%":{transformOrigin:"50%"},"100%":{transform:"translate(50%, -50%) rotate(360deg)",transformOrigin:"50%"}}),y=e=>{let{fontHeight:t,lineWidth:a,marginXS:r,colorBorderBg:l}=e,i=e.colorTextLightSolid,n=e.colorError,s=e.colorErrorHover;return(0,m.mergeToken)(e,{badgeFontHeight:t,badgeShadowSize:a,badgeTextColor:i,badgeColor:n,badgeColorHover:s,badgeShadowColor:l,badgeProcessingDuration:"1.2s",badgeRibbonOffset:r,badgeRibbonCornerTransform:"scaleY(0.75)",badgeRibbonCornerFilter:"brightness(75%)"})},x=e=>{let{fontSize:t,lineHeight:a,fontSizeSM:r,lineWidth:l}=e;return{indicatorZIndex:"auto",indicatorHeight:Math.round(t*a)-2*l,indicatorHeightSM:t,dotSize:r/2,textFontSize:r,textFontSizeSM:r,textFontWeight:"normal",statusSize:r/2}},w=(0,u.genStyleHooks)("Badge",e=>(e=>{let{componentCls:t,iconCls:a,antCls:r,badgeShadowSize:l,textFontSize:i,textFontSizeSM:n,statusSize:o,dotSize:u,textFontWeight:m,indicatorHeight:y,indicatorHeightSM:x,marginXS:w,calc:j}=e,$=`${r}-scroll-number`,C=(0,d.genPresetColor)(e,(e,{darkColor:a})=>({[`&${t} ${t}-color-${e}`]:{background:a,[`&:not(${t}-count)`]:{color:a},"a:hover &":{background:a}}}));return{[t]:Object.assign(Object.assign(Object.assign(Object.assign({},(0,c.resetComponent)(e)),{position:"relative",display:"inline-block",width:"fit-content",lineHeight:1,[`${t}-count`]:{display:"inline-flex",justifyContent:"center",zIndex:e.indicatorZIndex,minWidth:y,height:y,color:e.badgeTextColor,fontWeight:m,fontSize:i,lineHeight:(0,s.unit)(y),whiteSpace:"nowrap",textAlign:"center",background:e.badgeColor,borderRadius:j(y).div(2).equal(),boxShadow:`0 0 0 ${(0,s.unit)(l)} ${e.badgeShadowColor}`,transition:`background ${e.motionDurationMid}`,a:{color:e.badgeTextColor},"a:hover":{color:e.badgeTextColor},"a:hover &":{background:e.badgeColorHover}},[`${t}-count-sm`]:{minWidth:x,height:x,fontSize:n,lineHeight:(0,s.unit)(x),borderRadius:j(x).div(2).equal()},[`${t}-multiple-words`]:{padding:`0 ${(0,s.unit)(e.paddingXS)}`,bdi:{unicodeBidi:"plaintext"}},[`${t}-dot`]:{zIndex:e.indicatorZIndex,width:u,minWidth:u,height:u,background:e.badgeColor,borderRadius:"100%",boxShadow:`0 0 0 ${(0,s.unit)(l)} ${e.badgeShadowColor}`},[`${t}-count, ${t}-dot, ${$}-custom-component`]:{position:"absolute",top:0,insetInlineEnd:0,transform:"translate(50%, -50%)",transformOrigin:"100% 0%",[`&${a}-spin`]:{animationName:v,animationDuration:"1s",animationIterationCount:"infinite",animationTimingFunction:"linear"}},[`&${t}-status`]:{lineHeight:"inherit",verticalAlign:"baseline",[`${t}-status-dot`]:{position:"relative",top:-1,display:"inline-block",width:o,height:o,verticalAlign:"middle",borderRadius:"50%"},[`${t}-status-success`]:{backgroundColor:e.colorSuccess},[`${t}-status-processing`]:{overflow:"visible",color:e.colorInfo,backgroundColor:e.colorInfo,borderColor:"currentcolor","&::after":{position:"absolute",top:0,insetInlineStart:0,width:"100%",height:"100%",borderWidth:l,borderStyle:"solid",borderColor:"inherit",borderRadius:"50%",animationName:g,animationDuration:e.badgeProcessingDuration,animationIterationCount:"infinite",animationTimingFunction:"ease-in-out",content:'""'}},[`${t}-status-default`]:{backgroundColor:e.colorTextPlaceholder},[`${t}-status-error`]:{backgroundColor:e.colorError},[`${t}-status-warning`]:{backgroundColor:e.colorWarning},[`${t}-status-text`]:{marginInlineStart:w,color:e.colorText,fontSize:e.fontSize}}}),C),{[`${t}-zoom-appear, ${t}-zoom-enter`]:{animationName:f,animationDuration:e.motionDurationSlow,animationTimingFunction:e.motionEaseOutBack,animationFillMode:"both"},[`${t}-zoom-leave`]:{animationName:b,animationDuration:e.motionDurationSlow,animationTimingFunction:e.motionEaseOutBack,animationFillMode:"both"},[`&${t}-not-a-wrapper`]:{[`${t}-zoom-appear, ${t}-zoom-enter`]:{animationName:p,animationDuration:e.motionDurationSlow,animationTimingFunction:e.motionEaseOutBack},[`${t}-zoom-leave`]:{animationName:h,animationDuration:e.motionDurationSlow,animationTimingFunction:e.motionEaseOutBack},[`&:not(${t}-status)`]:{verticalAlign:"middle"},[`${$}-custom-component, ${t}-count`]:{transform:"none"},[`${$}-custom-component, ${$}`]:{position:"relative",top:"auto",display:"block",transformOrigin:"50% 50%"}},[$]:{overflow:"hidden",transition:`all ${e.motionDurationMid} ${e.motionEaseOutBack}`,[`${$}-only`]:{position:"relative",display:"inline-block",height:y,transition:`all ${e.motionDurationSlow} ${e.motionEaseOutBack}`,WebkitTransformStyle:"preserve-3d",WebkitBackfaceVisibility:"hidden",[`> p${$}-only-unit`]:{height:y,margin:0,WebkitTransformStyle:"preserve-3d",WebkitBackfaceVisibility:"hidden"}},[`${$}-symbol`]:{verticalAlign:"top"}},"&-rtl":{direction:"rtl",[`${t}-count, ${t}-dot, ${$}-custom-component`]:{transform:"translate(-50%, -50%)"}}})}})(y(e)),x),j=(0,u.genStyleHooks)(["Badge","Ribbon"],e=>(e=>{let{antCls:t,badgeFontHeight:a,marginXS:r,badgeRibbonOffset:l,calc:i}=e,n=`${t}-ribbon`,o=`${t}-ribbon-wrapper`,u=(0,d.genPresetColor)(e,(e,{darkColor:t})=>({[`&${n}-color-${e}`]:{background:t,color:t}}));return{[o]:{position:"relative"},[n]:Object.assign(Object.assign(Object.assign(Object.assign({},(0,c.resetComponent)(e)),{position:"absolute",top:r,padding:`0 ${(0,s.unit)(e.paddingXS)}`,color:e.colorPrimary,lineHeight:(0,s.unit)(a),whiteSpace:"nowrap",backgroundColor:e.colorPrimary,borderRadius:e.borderRadiusSM,[`${n}-text`]:{color:e.badgeTextColor},[`${n}-corner`]:{position:"absolute",top:"100%",width:l,height:l,color:"currentcolor",border:`${(0,s.unit)(i(l).div(2).equal())} solid`,transform:e.badgeRibbonCornerTransform,transformOrigin:"top",filter:e.badgeRibbonCornerFilter}}),u),{[`&${n}-placement-end`]:{insetInlineEnd:i(l).mul(-1).equal(),borderEndEndRadius:0,[`${n}-corner`]:{insetInlineEnd:0,borderInlineEndColor:"transparent",borderBlockEndColor:"transparent"}},[`&${n}-placement-start`]:{insetInlineStart:i(l).mul(-1).equal(),borderEndStartRadius:0,[`${n}-corner`]:{insetInlineStart:0,borderBlockEndColor:"transparent",borderInlineStartColor:"transparent"}},"&-rtl":{direction:"rtl"}})}})(y(e)),x),$=e=>{let r,{prefixCls:l,value:i,current:n,offset:s=0}=e;return s&&(r={position:"absolute",top:`${s}00%`,left:0}),t.createElement("span",{style:r,className:(0,a.default)(`${l}-only-unit`,{current:n})},i)},C=e=>{let a,r,{prefixCls:l,count:i,value:n}=e,s=Number(n),o=Math.abs(i),[c,d]=t.useState(s),[u,m]=t.useState(o),g=()=>{d(s),m(o)};if(t.useEffect(()=>{let e=setTimeout(g,1e3);return()=>clearTimeout(e)},[s]),c===s||Number.isNaN(s)||Number.isNaN(c))a=[t.createElement($,Object.assign({},e,{key:s,current:!0}))],r={transition:"none"};else{a=[];let l=s+10,i=[];for(let e=s;e<=l;e+=1)i.push(e);let n=ue%10===c);a=(n<0?i.slice(0,d+1):i.slice(d)).map((a,r)=>t.createElement($,Object.assign({},e,{key:a,value:a%10,offset:n<0?r-d:r,current:r===d}))),r={transform:`translateY(${-function(e,t,a){let r=e,l=0;for(;(r+10)%10!==t;)r+=a,l+=a;return l}(c,s,n)}00%)`}}return t.createElement("span",{className:`${l}-only`,style:r,onTransitionEnd:g},a)};var O=function(e,t){var a={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(a[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var l=0,r=Object.getOwnPropertySymbols(e);lt.indexOf(r[l])&&Object.prototype.propertyIsEnumerable.call(e,r[l])&&(a[r[l]]=e[r[l]]);return a};let k=t.forwardRef((e,r)=>{let{prefixCls:l,count:s,className:o,motionClassName:c,style:d,title:u,show:m,component:g="sup",children:f}=e,b=O(e,["prefixCls","count","className","motionClassName","style","title","show","component","children"]),{getPrefixCls:p}=t.useContext(n.ConfigContext),h=p("scroll-number",l),v=Object.assign(Object.assign({},b),{"data-show":m,style:d,className:(0,a.default)(h,o,c),title:u}),y=s;if(s&&Number(s)%1==0){let e=String(s).split("");y=t.createElement("bdi",null,e.map((a,r)=>t.createElement(C,{prefixCls:h,count:Number(s),value:a,key:e.length-r})))}return((null==d?void 0:d.borderColor)&&(v.style=Object.assign(Object.assign({},d),{boxShadow:`0 0 0 1px ${d.borderColor} inset`})),f)?(0,i.cloneElement)(f,e=>({className:(0,a.default)(`${h}-custom-component`,null==e?void 0:e.className,c)})):t.createElement(g,Object.assign({},v,{ref:r}),y)});var N=function(e,t){var a={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(a[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var l=0,r=Object.getOwnPropertySymbols(e);lt.indexOf(r[l])&&Object.prototype.propertyIsEnumerable.call(e,r[l])&&(a[r[l]]=e[r[l]]);return a};let E=t.forwardRef((e,s)=>{var o,c,d,u,m;let{prefixCls:g,scrollNumberPrefixCls:f,children:b,status:p,text:h,color:v,count:y=null,overflowCount:x=99,dot:j=!1,size:$="default",title:C,offset:O,style:E,className:S,rootClassName:T,classNames:I,styles:M,showZero:R=!1}=e,_=N(e,["prefixCls","scrollNumberPrefixCls","children","status","text","color","count","overflowCount","dot","size","title","offset","style","className","rootClassName","classNames","styles","showZero"]),{getPrefixCls:P,direction:F,badge:q}=t.useContext(n.ConfigContext),z=P("badge",g),[B,A,D]=w(z),L=y>x?`${x}+`:y,H="0"===L||0===L||"0"===h||0===h,K=null===y||H&&!R,Q=(null!=p||null!=v)&&K,W=null!=p||!H,U=j&&!H,V=U?"":L,Z=(0,t.useMemo)(()=>((null==V||""===V)&&(null==h||""===h)||H&&!R)&&!U,[V,H,R,U,h]),G=(0,t.useRef)(y);Z||(G.current=y);let X=G.current,J=(0,t.useRef)(V);Z||(J.current=V);let Y=J.current,ee=(0,t.useRef)(U);Z||(ee.current=U);let et=(0,t.useMemo)(()=>{if(!O)return Object.assign(Object.assign({},null==q?void 0:q.style),E);let e={marginTop:O[1]};return"rtl"===F?e.left=Number.parseInt(O[0],10):e.right=-Number.parseInt(O[0],10),Object.assign(Object.assign(Object.assign({},e),null==q?void 0:q.style),E)},[F,O,E,null==q?void 0:q.style]),ea=null!=C?C:"string"==typeof X||"number"==typeof X?X:void 0,er=!Z&&(0===h?R:!!h&&!0!==h),el=er?t.createElement("span",{className:`${z}-status-text`},h):null,ei=X&&"object"==typeof X?(0,i.cloneElement)(X,e=>({style:Object.assign(Object.assign({},et),e.style)})):void 0,en=(0,l.isPresetColor)(v,!1),es=(0,a.default)(null==I?void 0:I.indicator,null==(o=null==q?void 0:q.classNames)?void 0:o.indicator,{[`${z}-status-dot`]:Q,[`${z}-status-${p}`]:!!p,[`${z}-color-${v}`]:en}),eo={};v&&!en&&(eo.color=v,eo.background=v);let ec=(0,a.default)(z,{[`${z}-status`]:Q,[`${z}-not-a-wrapper`]:!b,[`${z}-rtl`]:"rtl"===F},S,T,null==q?void 0:q.className,null==(c=null==q?void 0:q.classNames)?void 0:c.root,null==I?void 0:I.root,A,D);if(!b&&Q&&(h||W||!K)){let e=et.color;return B(t.createElement("span",Object.assign({},_,{className:ec,style:Object.assign(Object.assign(Object.assign({},null==M?void 0:M.root),null==(d=null==q?void 0:q.styles)?void 0:d.root),et)}),t.createElement("span",{className:es,style:Object.assign(Object.assign(Object.assign({},null==M?void 0:M.indicator),null==(u=null==q?void 0:q.styles)?void 0:u.indicator),eo)}),er&&t.createElement("span",{style:{color:e},className:`${z}-status-text`},h)))}return B(t.createElement("span",Object.assign({ref:s},_,{className:ec,style:Object.assign(Object.assign({},null==(m=null==q?void 0:q.styles)?void 0:m.root),null==M?void 0:M.root)}),b,t.createElement(r.default,{visible:!Z,motionName:`${z}-zoom`,motionAppear:!1,motionDeadline:1e3},({className:e})=>{var r,l;let i=P("scroll-number",f),n=ee.current,s=(0,a.default)(null==I?void 0:I.indicator,null==(r=null==q?void 0:q.classNames)?void 0:r.indicator,{[`${z}-dot`]:n,[`${z}-count`]:!n,[`${z}-count-sm`]:"small"===$,[`${z}-multiple-words`]:!n&&Y&&Y.toString().length>1,[`${z}-status-${p}`]:!!p,[`${z}-color-${v}`]:en}),o=Object.assign(Object.assign(Object.assign({},null==M?void 0:M.indicator),null==(l=null==q?void 0:q.styles)?void 0:l.indicator),et);return v&&!en&&((o=o||{}).background=v),t.createElement(k,{prefixCls:i,show:!Z,motionClassName:e,className:s,count:Y,title:ea,style:o,key:"scrollNumber"},ei)}),el))});E.Ribbon=e=>{let{className:r,prefixCls:i,style:s,color:o,children:c,text:d,placement:u="end",rootClassName:m}=e,{getPrefixCls:g,direction:f}=t.useContext(n.ConfigContext),b=g("ribbon",i),p=`${b}-wrapper`,[h,v,y]=j(b,p),x=(0,l.isPresetColor)(o,!1),w=(0,a.default)(b,`${b}-placement-${u}`,{[`${b}-rtl`]:"rtl"===f,[`${b}-color-${o}`]:x},r),$={},C={};return o&&!x&&($.background=o,C.color=o),h(t.createElement("div",{className:(0,a.default)(p,m,v,y)},c,t.createElement("div",{className:(0,a.default)(w,v),style:Object.assign(Object.assign({},$),s)},t.createElement("span",{className:`${b}-text`},d),t.createElement("div",{className:`${b}-corner`,style:C}))))},e.s(["Badge",0,E],906579)},621482,e=>{"use strict";var t=e.i(869230),a=e.i(992571),r=class extends t.QueryObserver{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){super.setOptions({...e,behavior:(0,a.infiniteQueryBehavior)()})}getOptimisticResult(e){return e.behavior=(0,a.infiniteQueryBehavior)(),super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,t){let{state:r}=e,l=super.createResult(e,t),{isFetching:i,isRefetching:n,isError:s,isRefetchError:o}=l,c=r.fetchMeta?.fetchMore?.direction,d=s&&"forward"===c,u=i&&"forward"===c,m=s&&"backward"===c,g=i&&"backward"===c;return{...l,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:(0,a.hasNextPage)(t,r.data),hasPreviousPage:(0,a.hasPreviousPage)(t,r.data),isFetchNextPageError:d,isFetchingNextPage:u,isFetchPreviousPageError:m,isFetchingPreviousPage:g,isRefetchError:o&&!d&&!m,isRefetching:n&&!u&&!g}}},l=e.i(469637);function i(e,t){return(0,l.useBaseQuery)(e,r,t)}e.s(["useInfiniteQuery",()=>i],621482)},785242,e=>{"use strict";var t=e.i(619273),a=e.i(266027),r=e.i(912598),l=e.i(135214),i=e.i(270345),n=e.i(243652),s=e.i(764205);let o=(0,n.createQueryKeys)("teams"),c=async(e,t,a,r={})=>{try{let l=(0,s.getProxyBaseUrl)(),i=new URLSearchParams(Object.entries({team_id:r.teamID,organization_id:r.organizationID,team_alias:r.team_alias,user_id:r.userID,page:t,page_size:a,sort_by:r.sortBy,sort_order:r.sortOrder,status:"deleted"}).filter(([,e])=>null!=e).map(([e,t])=>[e,String(t)])),n=`${l?`${l}/v2/team/list`:"/v2/team/list"}?${i}`,o=await fetch(n,{method:"GET",headers:{[(0,s.getGlobalLitellmHeaderName)()]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!o.ok){let e=await o.json(),t=(0,s.deriveErrorMessage)(e);throw(0,s.handleError)(t),Error(t)}let c=await o.json();if(console.log("/team/list?status=deleted API Response:",c),c&&"object"==typeof c&&"teams"in c)return c.teams;return c}catch(e){throw console.error("Failed to list deleted teams:",e),e}},d=(0,n.createQueryKeys)("deletedTeams");e.s(["useDeletedTeams",0,(e,r,i={})=>{let{accessToken:n}=(0,l.default)();return(0,a.useQuery)({queryKey:d.list({page:e,limit:r,...i}),queryFn:async()=>await c(n,e,r,i),enabled:!!n,staleTime:3e4,placeholderData:t.keepPreviousData})},"useTeam",0,e=>{let{accessToken:t}=(0,l.default)(),i=(0,r.useQueryClient)();return(0,a.useQuery)({queryKey:o.detail(e),enabled:!!(t&&e),queryFn:async()=>{if(!t||!e)throw Error("Missing auth or teamId");return(0,s.teamInfoCall)(t,e)},initialData:()=>{if(!e)return;let t=i.getQueryData(o.list({}));return t?.find(t=>t.team_id===e)}})},"useTeams",0,()=>{let{accessToken:e,userId:t,userRole:r}=(0,l.default)();return(0,a.useQuery)({queryKey:o.list({}),queryFn:async()=>await (0,i.fetchTeams)(e,t,r,null),enabled:!!e})}])},109799,e=>{"use strict";var t=e.i(135214),a=e.i(764205),r=e.i(266027),l=e.i(912598);let i=(0,e.i(243652).createQueryKeys)("organizations");e.s(["useOrganization",0,e=>{let n=(0,l.useQueryClient)(),{accessToken:s}=(0,t.default)();return(0,r.useQuery)({queryKey:i.detail(e),enabled:!!(s&&e),queryFn:async()=>{if(!s||!e)throw Error("Missing auth or teamId");return(0,a.organizationInfoCall)(s,e)},initialData:()=>{if(!e)return;let t=n.getQueryData(i.list({}));return t?.find(t=>t.organization_id===e)}})},"useOrganizations",0,()=>{let{accessToken:e,userId:l,userRole:n}=(0,t.default)();return(0,r.useQuery)({queryKey:i.list({}),queryFn:async()=>await (0,a.organizationListCall)(e),enabled:!!(e&&l&&n)})}])},625901,e=>{"use strict";var t=e.i(266027),a=e.i(621482),r=e.i(243652),l=e.i(764205),i=e.i(135214);let n=(0,r.createQueryKeys)("models"),s=(0,r.createQueryKeys)("modelHub"),o=(0,r.createQueryKeys)("allProxyModels");(0,r.createQueryKeys)("selectedTeamModels");let c=(0,r.createQueryKeys)("infiniteModels");e.s(["useAllProxyModels",0,()=>{let{accessToken:e,userId:a,userRole:r}=(0,i.default)();return(0,t.useQuery)({queryKey:o.list({}),queryFn:async()=>await (0,l.modelAvailableCall)(e,a,r,!0,null,!0,!1,"expand"),enabled:!!(e&&a&&r)})},"useInfiniteModelInfo",0,(e=50,t)=>{let{accessToken:r,userId:n,userRole:s}=(0,i.default)();return(0,a.useInfiniteQuery)({queryKey:c.list({filters:{...n&&{userId:n},...s&&{userRole:s},size:e,...t&&{search:t}}}),queryFn:async({pageParam:a})=>await (0,l.modelInfoCall)(r,n,s,a,e,t),initialPageParam:1,getNextPageParam:e=>{if(e.current_page{let{accessToken:e}=(0,i.default)();return(0,t.useQuery)({queryKey:s.list({}),queryFn:async()=>await (0,l.modelHubCall)(e),enabled:!!e})},"useModelsInfo",0,(e=1,a=50,r,s,o,c,d)=>{let{accessToken:u,userId:m,userRole:g}=(0,i.default)();return(0,t.useQuery)({queryKey:n.list({filters:{...m&&{userId:m},...g&&{userRole:g},page:e,size:a,...r&&{search:r},...s&&{modelId:s},...o&&{teamId:o},...c&&{sortBy:c},...d&&{sortOrder:d}}}),queryFn:async()=>await (0,l.modelInfoCall)(u,m,g,e,a,r,s,o,c,d),enabled:!!(u&&m&&g)})}])},434626,e=>{"use strict";var t=e.i(271645);let a=t.forwardRef(function(e,a){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:a},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"}))});e.s(["ExternalLinkIcon",0,a],434626)},902555,e=>{"use strict";var t=e.i(843476),a=e.i(591935),r=e.i(122577),l=e.i(278587),i=e.i(68155),n=e.i(360820),s=e.i(871943),o=e.i(434626),c=e.i(592968),d=e.i(115504),u=e.i(752978);function m({icon:e,onClick:a,className:r,disabled:l,dataTestId:i}){return l?(0,t.jsx)(u.Icon,{icon:e,size:"sm",className:"opacity-50 cursor-not-allowed","data-testid":i}):(0,t.jsx)(u.Icon,{icon:e,size:"sm",onClick:a,className:(0,d.cx)("cursor-pointer",r),"data-testid":i})}let g={Edit:{icon:a.PencilAltIcon,className:"hover:text-blue-600"},Delete:{icon:i.TrashIcon,className:"hover:text-red-600"},Test:{icon:r.PlayIcon,className:"hover:text-blue-600"},Regenerate:{icon:l.RefreshIcon,className:"hover:text-green-600"},Up:{icon:n.ChevronUpIcon,className:"hover:text-blue-600"},Down:{icon:s.ChevronDownIcon,className:"hover:text-blue-600"},Open:{icon:o.ExternalLinkIcon,className:"hover:text-green-600"}};function f({onClick:e,tooltipText:a,disabled:r=!1,disabledTooltipText:l,dataTestId:i,variant:n}){let{icon:s,className:o}=g[n];return(0,t.jsx)(c.Tooltip,{title:r?l:a,children:(0,t.jsx)("span",{children:(0,t.jsx)(m,{icon:s,onClick:e,className:o,disabled:r,dataTestId:i})})})}e.s(["default",()=>f],902555)},122577,e=>{"use strict";var t=e.i(271645);let a=t.forwardRef(function(e,a){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:a},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14.752 11.168l-3.197-2.132A1 1 0 0010 9.87v4.263a1 1 0 001.555.832l3.197-2.132a1 1 0 000-1.664z"}),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}))});e.s(["PlayIcon",0,a],122577)},591935,e=>{"use strict";var t=e.i(271645);let a=t.forwardRef(function(e,a){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:a},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"}))});e.s(["PencilAltIcon",0,a],591935)},360820,e=>{"use strict";var t=e.i(271645);let a=t.forwardRef(function(e,a){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:a},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"}))});e.s(["ChevronUpIcon",0,a],360820)},871943,e=>{"use strict";var t=e.i(271645);let a=t.forwardRef(function(e,a){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:a},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"}))});e.s(["ChevronDownIcon",0,a],871943)},185793,e=>{"use strict";e.i(247167);var t=e.i(271645),a=e.i(343794),r=e.i(242064),l=e.i(529681);let i=e=>{let{prefixCls:r,className:l,style:i,size:n,shape:s}=e,o=(0,a.default)({[`${r}-lg`]:"large"===n,[`${r}-sm`]:"small"===n}),c=(0,a.default)({[`${r}-circle`]:"circle"===s,[`${r}-square`]:"square"===s,[`${r}-round`]:"round"===s}),d=t.useMemo(()=>"number"==typeof n?{width:n,height:n,lineHeight:`${n}px`}:{},[n]);return t.createElement("span",{className:(0,a.default)(r,o,c,l),style:Object.assign(Object.assign({},d),i)})};e.i(296059);var n=e.i(694758),s=e.i(915654),o=e.i(246422),c=e.i(838378);let d=new n.Keyframes("ant-skeleton-loading",{"0%":{backgroundPosition:"100% 50%"},"100%":{backgroundPosition:"0 50%"}}),u=e=>({height:e,lineHeight:(0,s.unit)(e)}),m=e=>Object.assign({width:e},u(e)),g=(e,t)=>Object.assign({width:t(e).mul(5).equal(),minWidth:t(e).mul(5).equal()},u(e)),f=e=>Object.assign({width:e},u(e)),b=(e,t,a)=>{let{skeletonButtonCls:r}=e;return{[`${a}${r}-circle`]:{width:t,minWidth:t,borderRadius:"50%"},[`${a}${r}-round`]:{borderRadius:t}}},p=(e,t)=>Object.assign({width:t(e).mul(2).equal(),minWidth:t(e).mul(2).equal()},u(e)),h=(0,o.genStyleHooks)("Skeleton",e=>{let{componentCls:t,calc:a}=e;return(e=>{let{componentCls:t,skeletonAvatarCls:a,skeletonTitleCls:r,skeletonParagraphCls:l,skeletonButtonCls:i,skeletonInputCls:n,skeletonImageCls:s,controlHeight:o,controlHeightLG:c,controlHeightSM:u,gradientFromColor:h,padding:v,marginSM:y,borderRadius:x,titleHeight:w,blockRadius:j,paragraphLiHeight:$,controlHeightXS:C,paragraphMarginTop:O}=e;return{[t]:{display:"table",width:"100%",[`${t}-header`]:{display:"table-cell",paddingInlineEnd:v,verticalAlign:"top",[a]:Object.assign({display:"inline-block",verticalAlign:"top",background:h},m(o)),[`${a}-circle`]:{borderRadius:"50%"},[`${a}-lg`]:Object.assign({},m(c)),[`${a}-sm`]:Object.assign({},m(u))},[`${t}-content`]:{display:"table-cell",width:"100%",verticalAlign:"top",[r]:{width:"100%",height:w,background:h,borderRadius:j,[`+ ${l}`]:{marginBlockStart:u}},[l]:{padding:0,"> li":{width:"100%",height:$,listStyle:"none",background:h,borderRadius:j,"+ li":{marginBlockStart:C}}},[`${l}> li:last-child:not(:first-child):not(:nth-child(2))`]:{width:"61%"}},[`&-round ${t}-content`]:{[`${r}, ${l} > li`]:{borderRadius:x}}},[`${t}-with-avatar ${t}-content`]:{[r]:{marginBlockStart:y,[`+ ${l}`]:{marginBlockStart:O}}},[`${t}${t}-element`]:Object.assign(Object.assign(Object.assign(Object.assign({display:"inline-block",width:"auto"},(e=>{let{borderRadiusSM:t,skeletonButtonCls:a,controlHeight:r,controlHeightLG:l,controlHeightSM:i,gradientFromColor:n,calc:s}=e;return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({[a]:Object.assign({display:"inline-block",verticalAlign:"top",background:n,borderRadius:t,width:s(r).mul(2).equal(),minWidth:s(r).mul(2).equal()},p(r,s))},b(e,r,a)),{[`${a}-lg`]:Object.assign({},p(l,s))}),b(e,l,`${a}-lg`)),{[`${a}-sm`]:Object.assign({},p(i,s))}),b(e,i,`${a}-sm`))})(e)),(e=>{let{skeletonAvatarCls:t,gradientFromColor:a,controlHeight:r,controlHeightLG:l,controlHeightSM:i}=e;return{[t]:Object.assign({display:"inline-block",verticalAlign:"top",background:a},m(r)),[`${t}${t}-circle`]:{borderRadius:"50%"},[`${t}${t}-lg`]:Object.assign({},m(l)),[`${t}${t}-sm`]:Object.assign({},m(i))}})(e)),(e=>{let{controlHeight:t,borderRadiusSM:a,skeletonInputCls:r,controlHeightLG:l,controlHeightSM:i,gradientFromColor:n,calc:s}=e;return{[r]:Object.assign({display:"inline-block",verticalAlign:"top",background:n,borderRadius:a},g(t,s)),[`${r}-lg`]:Object.assign({},g(l,s)),[`${r}-sm`]:Object.assign({},g(i,s))}})(e)),(e=>{let{skeletonImageCls:t,imageSizeBase:a,gradientFromColor:r,borderRadiusSM:l,calc:i}=e;return{[t]:Object.assign(Object.assign({display:"inline-flex",alignItems:"center",justifyContent:"center",verticalAlign:"middle",background:r,borderRadius:l},f(i(a).mul(2).equal())),{[`${t}-path`]:{fill:"#bfbfbf"},[`${t}-svg`]:Object.assign(Object.assign({},f(a)),{maxWidth:i(a).mul(4).equal(),maxHeight:i(a).mul(4).equal()}),[`${t}-svg${t}-svg-circle`]:{borderRadius:"50%"}}),[`${t}${t}-circle`]:{borderRadius:"50%"}}})(e)),[`${t}${t}-block`]:{width:"100%",[i]:{width:"100%"},[n]:{width:"100%"}},[`${t}${t}-active`]:{[` + ${r}, + ${l} > li, + ${a}, + ${i}, + ${n}, + ${s} + `]:Object.assign({},{background:e.skeletonLoadingBackground,backgroundSize:"400% 100%",animationName:d,animationDuration:e.skeletonLoadingMotionDuration,animationTimingFunction:"ease",animationIterationCount:"infinite"})}}})((0,c.mergeToken)(e,{skeletonAvatarCls:`${t}-avatar`,skeletonTitleCls:`${t}-title`,skeletonParagraphCls:`${t}-paragraph`,skeletonButtonCls:`${t}-button`,skeletonInputCls:`${t}-input`,skeletonImageCls:`${t}-image`,imageSizeBase:a(e.controlHeight).mul(1.5).equal(),borderRadius:100,skeletonLoadingBackground:`linear-gradient(90deg, ${e.gradientFromColor} 25%, ${e.gradientToColor} 37%, ${e.gradientFromColor} 63%)`,skeletonLoadingMotionDuration:"1.4s"}))},e=>{let{colorFillContent:t,colorFill:a}=e;return{color:t,colorGradientEnd:a,gradientFromColor:t,gradientToColor:a,titleHeight:e.controlHeight/2,blockRadius:e.borderRadiusSM,paragraphMarginTop:e.marginLG+e.marginXXS,paragraphLiHeight:e.controlHeight/2}},{deprecatedTokens:[["color","gradientFromColor"],["colorGradientEnd","gradientToColor"]]}),v=e=>{let{prefixCls:r,className:l,style:i,rows:n=0}=e,s=Array.from({length:n}).map((a,r)=>t.createElement("li",{key:r,style:{width:((e,t)=>{let{width:a,rows:r=2}=t;return Array.isArray(a)?a[e]:r-1===e?a:void 0})(r,e)}}));return t.createElement("ul",{className:(0,a.default)(r,l),style:i},s)},y=({prefixCls:e,className:r,width:l,style:i})=>t.createElement("h3",{className:(0,a.default)(e,r),style:Object.assign({width:l},i)});function x(e){return e&&"object"==typeof e?e:{}}let w=e=>{let{prefixCls:l,loading:n,className:s,rootClassName:o,style:c,children:d,avatar:u=!1,title:m=!0,paragraph:g=!0,active:f,round:b}=e,{getPrefixCls:p,direction:w,className:j,style:$}=(0,r.useComponentConfig)("skeleton"),C=p("skeleton",l),[O,k,N]=h(C);if(n||!("loading"in e)){let e,r,l=!!u,n=!!m,d=!!g;if(l){let a=Object.assign(Object.assign({prefixCls:`${C}-avatar`},n&&!d?{size:"large",shape:"square"}:{size:"large",shape:"circle"}),x(u));e=t.createElement("div",{className:`${C}-header`},t.createElement(i,Object.assign({},a)))}if(n||d){let e,a;if(n){let a=Object.assign(Object.assign({prefixCls:`${C}-title`},!l&&d?{width:"38%"}:l&&d?{width:"50%"}:{}),x(m));e=t.createElement(y,Object.assign({},a))}if(d){let e,r=Object.assign(Object.assign({prefixCls:`${C}-paragraph`},(e={},l&&n||(e.width="61%"),!l&&n?e.rows=3:e.rows=2,e)),x(g));a=t.createElement(v,Object.assign({},r))}r=t.createElement("div",{className:`${C}-content`},e,a)}let p=(0,a.default)(C,{[`${C}-with-avatar`]:l,[`${C}-active`]:f,[`${C}-rtl`]:"rtl"===w,[`${C}-round`]:b},j,s,o,k,N);return O(t.createElement("div",{className:p,style:Object.assign(Object.assign({},$),c)},e,r))}return null!=d?d:null};w.Button=e=>{let{prefixCls:n,className:s,rootClassName:o,active:c,block:d=!1,size:u="default"}=e,{getPrefixCls:m}=t.useContext(r.ConfigContext),g=m("skeleton",n),[f,b,p]=h(g),v=(0,l.default)(e,["prefixCls"]),y=(0,a.default)(g,`${g}-element`,{[`${g}-active`]:c,[`${g}-block`]:d},s,o,b,p);return f(t.createElement("div",{className:y},t.createElement(i,Object.assign({prefixCls:`${g}-button`,size:u},v))))},w.Avatar=e=>{let{prefixCls:n,className:s,rootClassName:o,active:c,shape:d="circle",size:u="default"}=e,{getPrefixCls:m}=t.useContext(r.ConfigContext),g=m("skeleton",n),[f,b,p]=h(g),v=(0,l.default)(e,["prefixCls","className"]),y=(0,a.default)(g,`${g}-element`,{[`${g}-active`]:c},s,o,b,p);return f(t.createElement("div",{className:y},t.createElement(i,Object.assign({prefixCls:`${g}-avatar`,shape:d,size:u},v))))},w.Input=e=>{let{prefixCls:n,className:s,rootClassName:o,active:c,block:d,size:u="default"}=e,{getPrefixCls:m}=t.useContext(r.ConfigContext),g=m("skeleton",n),[f,b,p]=h(g),v=(0,l.default)(e,["prefixCls"]),y=(0,a.default)(g,`${g}-element`,{[`${g}-active`]:c,[`${g}-block`]:d},s,o,b,p);return f(t.createElement("div",{className:y},t.createElement(i,Object.assign({prefixCls:`${g}-input`,size:u},v))))},w.Image=e=>{let{prefixCls:l,className:i,rootClassName:n,style:s,active:o}=e,{getPrefixCls:c}=t.useContext(r.ConfigContext),d=c("skeleton",l),[u,m,g]=h(d),f=(0,a.default)(d,`${d}-element`,{[`${d}-active`]:o},i,n,m,g);return u(t.createElement("div",{className:f},t.createElement("div",{className:(0,a.default)(`${d}-image`,i),style:s},t.createElement("svg",{viewBox:"0 0 1098 1024",xmlns:"http://www.w3.org/2000/svg",className:`${d}-image-svg`},t.createElement("title",null,"Image placeholder"),t.createElement("path",{d:"M365.714286 329.142857q0 45.714286-32.036571 77.677714t-77.677714 32.036571-77.677714-32.036571-32.036571-77.677714 32.036571-77.677714 77.677714-32.036571 77.677714 32.036571 32.036571 77.677714zM950.857143 548.571429l0 256-804.571429 0 0-109.714286 182.857143-182.857143 91.428571 91.428571 292.571429-292.571429zM1005.714286 146.285714l-914.285714 0q-7.460571 0-12.873143 5.412571t-5.412571 12.873143l0 694.857143q0 7.460571 5.412571 12.873143t12.873143 5.412571l914.285714 0q7.460571 0 12.873143-5.412571t5.412571-12.873143l0-694.857143q0-7.460571-5.412571-12.873143t-12.873143-5.412571zM1097.142857 164.571429l0 694.857143q0 37.741714-26.843429 64.585143t-64.585143 26.843429l-914.285714 0q-37.741714 0-64.585143-26.843429t-26.843429-64.585143l0-694.857143q0-37.741714 26.843429-64.585143t64.585143-26.843429l914.285714 0q37.741714 0 64.585143 26.843429t26.843429 64.585143z",className:`${d}-image-path`})))))},w.Node=e=>{let{prefixCls:l,className:i,rootClassName:n,style:s,active:o,children:c}=e,{getPrefixCls:d}=t.useContext(r.ConfigContext),u=d("skeleton",l),[m,g,f]=h(u),b=(0,a.default)(u,`${u}-element`,{[`${u}-active`]:o},g,i,n,f);return m(t.createElement("div",{className:b},t.createElement("div",{className:(0,a.default)(`${u}-image`,i),style:s},c)))},e.s(["default",0,w],185793)},959013,e=>{"use strict";e.i(247167);var t=e.i(931067),a=e.i(271645);let r={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"}},{tag:"path",attrs:{d:"M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z"}}]},name:"plus",theme:"outlined"};var l=e.i(9583),i=a.forwardRef(function(e,i){return a.createElement(l.default,(0,t.default)({},e,{ref:i,icon:r}))});e.s(["default",0,i],959013)},269200,e=>{"use strict";var t=e.i(290571),a=e.i(271645),r=e.i(444755);let l=(0,e.i(673706).makeClassName)("Table"),i=a.default.forwardRef((e,i)=>{let{children:n,className:s}=e,o=(0,t.__rest)(e,["children","className"]);return a.default.createElement("div",{className:(0,r.tremorTwMerge)(l("root"),"overflow-auto",s)},a.default.createElement("table",Object.assign({ref:i,className:(0,r.tremorTwMerge)(l("table"),"w-full text-tremor-default","text-tremor-content","dark:text-dark-tremor-content")},o),n))});i.displayName="Table",e.s(["Table",()=>i],269200)},427612,e=>{"use strict";var t=e.i(290571),a=e.i(271645),r=e.i(444755);let l=(0,e.i(673706).makeClassName)("TableHead"),i=a.default.forwardRef((e,i)=>{let{children:n,className:s}=e,o=(0,t.__rest)(e,["children","className"]);return a.default.createElement(a.default.Fragment,null,a.default.createElement("thead",Object.assign({ref:i,className:(0,r.tremorTwMerge)(l("root"),"text-left","text-tremor-content","dark:text-dark-tremor-content",s)},o),n))});i.displayName="TableHead",e.s(["TableHead",()=>i],427612)},64848,e=>{"use strict";var t=e.i(290571),a=e.i(271645),r=e.i(444755);let l=(0,e.i(673706).makeClassName)("TableHeaderCell"),i=a.default.forwardRef((e,i)=>{let{children:n,className:s}=e,o=(0,t.__rest)(e,["children","className"]);return a.default.createElement(a.default.Fragment,null,a.default.createElement("th",Object.assign({ref:i,className:(0,r.tremorTwMerge)(l("root"),"whitespace-nowrap text-left font-semibold top-0 px-4 py-3.5","text-tremor-content-strong","dark:text-dark-tremor-content-strong",s)},o),n))});i.displayName="TableHeaderCell",e.s(["TableHeaderCell",()=>i],64848)},942232,e=>{"use strict";var t=e.i(290571),a=e.i(271645),r=e.i(444755);let l=(0,e.i(673706).makeClassName)("TableBody"),i=a.default.forwardRef((e,i)=>{let{children:n,className:s}=e,o=(0,t.__rest)(e,["children","className"]);return a.default.createElement(a.default.Fragment,null,a.default.createElement("tbody",Object.assign({ref:i,className:(0,r.tremorTwMerge)(l("root"),"align-top divide-y","divide-tremor-border","dark:divide-dark-tremor-border",s)},o),n))});i.displayName="TableBody",e.s(["TableBody",()=>i],942232)},496020,e=>{"use strict";var t=e.i(290571),a=e.i(271645),r=e.i(444755);let l=(0,e.i(673706).makeClassName)("TableRow"),i=a.default.forwardRef((e,i)=>{let{children:n,className:s}=e,o=(0,t.__rest)(e,["children","className"]);return a.default.createElement(a.default.Fragment,null,a.default.createElement("tr",Object.assign({ref:i,className:(0,r.tremorTwMerge)(l("row"),s)},o),n))});i.displayName="TableRow",e.s(["TableRow",()=>i],496020)},977572,e=>{"use strict";var t=e.i(290571),a=e.i(271645),r=e.i(444755);let l=(0,e.i(673706).makeClassName)("TableCell"),i=a.default.forwardRef((e,i)=>{let{children:n,className:s}=e,o=(0,t.__rest)(e,["children","className"]);return a.default.createElement(a.default.Fragment,null,a.default.createElement("td",Object.assign({ref:i,className:(0,r.tremorTwMerge)(l("root"),"align-middle whitespace-nowrap text-left p-4",s)},o),n))});i.displayName="TableCell",e.s(["TableCell",()=>i],977572)},68155,e=>{"use strict";var t=e.i(271645);let a=t.forwardRef(function(e,a){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:a},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"}))});e.s(["TrashIcon",0,a],68155)},278587,e=>{"use strict";var t=e.i(271645);let a=t.forwardRef(function(e,a){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:a},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"}))});e.s(["RefreshIcon",0,a],278587)},207670,e=>{"use strict";function t(){for(var e,t,a=0,r="",l=arguments.length;at,"default",0,t])},907308,e=>{"use strict";var t=e.i(843476),a=e.i(271645),r=e.i(212931),l=e.i(808613),i=e.i(464571),n=e.i(199133),s=e.i(592968),o=e.i(374009),c=e.i(764205);e.s(["default",0,({isVisible:e,onCancel:d,onSubmit:u,accessToken:m,title:g="Add Team Member",roles:f=[{label:"admin",value:"admin",description:"Admin role. Can create team keys, add members, and manage settings."},{label:"user",value:"user",description:"User role. Can view team info, but not manage it."}],defaultRole:b="user"})=>{let[p]=l.Form.useForm(),[h,v]=(0,a.useState)([]),[y,x]=(0,a.useState)(!1),[w,j]=(0,a.useState)("user_email"),$=async(e,t)=>{if(!e)return void v([]);x(!0);try{let a=new URLSearchParams;if(a.append(t,e),null==m)return;let r=(await (0,c.userFilterUICall)(m,a)).map(e=>({label:"user_email"===t?`${e.user_email}`:`${e.user_id}`,value:"user_email"===t?e.user_email:e.user_id,user:e}));v(r)}catch(e){console.error("Error fetching users:",e)}finally{x(!1)}},C=(0,a.useCallback)((0,o.default)((e,t)=>$(e,t),300),[]),O=(e,t)=>{j(t),C(e,t)},k=(e,t)=>{let a=t.user;p.setFieldsValue({user_email:a.user_email,user_id:a.user_id,role:p.getFieldValue("role")})};return(0,t.jsx)(r.Modal,{title:g,open:e,onCancel:()=>{p.resetFields(),v([]),d()},footer:null,width:800,children:(0,t.jsxs)(l.Form,{form:p,onFinish:u,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",initialValues:{role:b},children:[(0,t.jsx)(l.Form.Item,{label:"Email",name:"user_email",className:"mb-4",children:(0,t.jsx)(n.Select,{showSearch:!0,className:"w-full",placeholder:"Search by email",filterOption:!1,onSearch:e=>O(e,"user_email"),onSelect:(e,t)=>k(e,t),options:"user_email"===w?h:[],loading:y,allowClear:!0})}),(0,t.jsx)("div",{className:"text-center mb-4",children:"OR"}),(0,t.jsx)(l.Form.Item,{label:"User ID",name:"user_id",className:"mb-4",children:(0,t.jsx)(n.Select,{showSearch:!0,className:"w-full",placeholder:"Search by user ID",filterOption:!1,onSearch:e=>O(e,"user_id"),onSelect:(e,t)=>k(e,t),options:"user_id"===w?h:[],loading:y,allowClear:!0})}),(0,t.jsx)(l.Form.Item,{label:"Member Role",name:"role",className:"mb-4",children:(0,t.jsx)(n.Select,{defaultValue:b,children:f.map(e=>(0,t.jsx)(n.Select.Option,{value:e.value,children:(0,t.jsxs)(s.Tooltip,{title:e.description,children:[(0,t.jsx)("span",{className:"font-medium",children:e.label}),(0,t.jsxs)("span",{className:"ml-2 text-gray-500 text-sm",children:["- ",e.description]})]})},e.value))})}),(0,t.jsx)("div",{className:"text-right mt-4",children:(0,t.jsx)(i.Button,{type:"default",htmlType:"submit",children:"Add Member"})})]})})}])},162386,e=>{"use strict";var t=e.i(843476),a=e.i(625901),r=e.i(109799),l=e.i(785242),i=e.i(738014),n=e.i(199133),s=e.i(981339),o=e.i(592968);let c={label:"All Proxy Models",value:"all-proxy-models"},d={label:"No Default Models",value:"no-default-models"},u=[c,d],m={user:({allProxyModels:e,userModels:t,options:a})=>t&&a?.includeUserModels?t:[],team:({allProxyModels:e,selectedOrganization:t,userModels:a})=>t?t.models.includes(c.value)||0===t.models.length?e:e.filter(e=>t.models.includes(e)):e??[],organization:({allProxyModels:e})=>e,global:({allProxyModels:e})=>e};e.s(["ModelSelect",0,e=>{let{teamID:g,organizationID:f,options:b,context:p,dataTestId:h,value:v=[],onChange:y,style:x}=e,{includeUserModels:w,showAllTeamModelsOption:j,showAllProxyModelsOverride:$,includeSpecialOptions:C}=b||{},{data:O,isLoading:k}=(0,a.useAllProxyModels)(),{data:N,isLoading:E}=(0,l.useTeam)(g),{data:S,isLoading:T}=(0,r.useOrganization)(f),{data:I,isLoading:M}=(0,i.useCurrentUser)(),R=e=>u.some(t=>t.value===e),_=v.some(R),P=S?.models.includes(c.value)||S?.models.length===0;if(k||E||T||M)return(0,t.jsx)(s.Skeleton.Input,{active:!0,block:!0});let{wildcard:F,regular:q}=(e=>{let t=[],a=[];for(let r of e)r.endsWith("/*")?t.push(r):a.push(r);return{wildcard:t,regular:a}})(((e,t,a)=>{let r=Array.from(new Map(e.map(e=>[e.id,e])).values()).map(e=>e.id);if(t.options?.showAllProxyModelsOverride)return r;let l=m[t.context];return l?l({allProxyModels:r,...a,options:t.options}):[]})(O?.data??[],e,{selectedTeam:N,selectedOrganization:S,userModels:I?.models}));return(0,t.jsx)(n.Select,{"data-testid":h,value:v,onChange:e=>{let t=e.filter(R);y(t.length>0?[t[t.length-1]]:e)},style:x,options:[C?{label:(0,t.jsx)("span",{children:"Special Options"}),title:"Special Options",options:[...$||P&&C||"global"===p?[{label:(0,t.jsx)("span",{children:"All Proxy Models"}),value:c.value,disabled:v.length>0&&v.some(e=>R(e)&&e!==c.value),key:c.value}]:[],{label:(0,t.jsx)("span",{children:"No Default Models"}),value:d.value,disabled:v.length>0&&v.some(e=>R(e)&&e!==d.value),key:d.value}]}:[],...F.length>0?[{label:(0,t.jsx)("span",{children:"Wildcard Options"}),title:"Wildcard Options",options:F.map(e=>{let a=e.replace("/*",""),r=a.charAt(0).toUpperCase()+a.slice(1);return{label:(0,t.jsx)("span",{children:`All ${r} models`}),value:e,disabled:_}})}]:[],{label:(0,t.jsx)("span",{children:"Models"}),title:"Models",options:q.map(e=>({label:(0,t.jsx)("span",{children:e}),value:e,disabled:_}))}],mode:"multiple",placeholder:"Select Models",allowClear:!0,maxTagCount:"responsive",maxTagPlaceholder:e=>(0,t.jsx)(o.Tooltip,{styles:{root:{pointerEvents:"none"}},title:e.map(({value:e})=>e).join(", "),children:(0,t.jsxs)("span",{children:["+",e.length," more"]})})})}],162386)},276173,e=>{"use strict";var t=e.i(843476),a=e.i(599724),r=e.i(779241),l=e.i(464571),i=e.i(808613),n=e.i(212931),s=e.i(199133),o=e.i(271645),c=e.i(435451);e.s(["default",0,({visible:e,onCancel:d,onSubmit:u,initialData:m,mode:g,config:f})=>{let b,[p]=i.Form.useForm(),[h,v]=(0,o.useState)(!1);console.log("Initial Data:",m),(0,o.useEffect)(()=>{if(e)if("edit"===g&&m){let e={...m,role:m.role||f.defaultRole,max_budget_in_team:m.max_budget_in_team||null,tpm_limit:m.tpm_limit||null,rpm_limit:m.rpm_limit||null};console.log("Setting form values:",e),p.setFieldsValue(e)}else p.resetFields(),p.setFieldsValue({role:f.defaultRole||f.roleOptions[0]?.value})},[e,m,g,p,f.defaultRole,f.roleOptions]);let y=async e=>{try{v(!0);let t=Object.entries(e).reduce((e,[t,a])=>{if("string"==typeof a){let r=a.trim();return""===r&&("max_budget_in_team"===t||"tpm_limit"===t||"rpm_limit"===t)?{...e,[t]:null}:{...e,[t]:r}}return{...e,[t]:a}},{});console.log("Submitting form data:",t),await Promise.resolve(u(t)),p.resetFields()}catch(e){console.error("Form submission error:",e)}finally{v(!1)}};return(0,t.jsx)(n.Modal,{title:f.title||("add"===g?"Add Member":"Edit Member"),open:e,width:1e3,footer:null,onCancel:d,children:(0,t.jsxs)(i.Form,{form:p,onFinish:y,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[f.showEmail&&(0,t.jsx)(i.Form.Item,{label:"Email",name:"user_email",className:"mb-4",rules:[{type:"email",message:"Please enter a valid email!"}],children:(0,t.jsx)(r.TextInput,{placeholder:"user@example.com"})}),f.showEmail&&f.showUserId&&(0,t.jsx)("div",{className:"text-center mb-4",children:(0,t.jsx)(a.Text,{children:"OR"})}),f.showUserId&&(0,t.jsx)(i.Form.Item,{label:"User ID",name:"user_id",className:"mb-4",children:(0,t.jsx)(r.TextInput,{placeholder:"user_123"})}),(0,t.jsx)(i.Form.Item,{label:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{children:"Role"}),"edit"===g&&m&&(0,t.jsxs)("span",{className:"text-gray-500 text-sm",children:["(Current: ",(b=m.role,f.roleOptions.find(e=>e.value===b)?.label||b),")"]})]}),name:"role",className:"mb-4",rules:[{required:!0,message:"Please select a role!"}],children:(0,t.jsx)(s.Select,{children:"edit"===g&&m?[...f.roleOptions.filter(e=>e.value===m.role),...f.roleOptions.filter(e=>e.value!==m.role)].map(e=>(0,t.jsx)(s.Select.Option,{value:e.value,children:e.label},e.value)):f.roleOptions.map(e=>(0,t.jsx)(s.Select.Option,{value:e.value,children:e.label},e.value))})}),f.additionalFields?.map(e=>(0,t.jsx)(i.Form.Item,{label:e.label,name:e.name,className:"mb-4",rules:e.rules,children:(e=>{switch(e.type){case"input":return(0,t.jsx)(r.TextInput,{placeholder:e.placeholder});case"numerical":return(0,t.jsx)(c.default,{step:e.step||1,min:e.min||0,style:{width:"100%"},placeholder:e.placeholder||"Enter a numerical value"});case"select":return(0,t.jsx)(s.Select,{children:e.options?.map(e=>(0,t.jsx)(s.Select.Option,{value:e.value,children:e.label},e.value))});default:return null}})(e)},e.name)),(0,t.jsxs)("div",{className:"text-right mt-6",children:[(0,t.jsx)(l.Button,{onClick:d,className:"mr-2",disabled:h,children:"Cancel"}),(0,t.jsx)(l.Button,{type:"default",htmlType:"submit",loading:h,children:"add"===g?h?"Adding...":"Add Member":h?"Saving...":"Save Changes"})]})]})})}])},294612,e=>{"use strict";var t=e.i(843476),a=e.i(100486),r=e.i(827252),l=e.i(213205),i=e.i(771674),n=e.i(464571),s=e.i(770914),o=e.i(291542),c=e.i(262218),d=e.i(592968),u=e.i(898586),m=e.i(902555);let{Text:g}=u.Typography;function f({members:e,canEdit:u,onEdit:f,onDelete:b,onAddMember:p,roleColumnTitle:h="Role",roleTooltip:v,extraColumns:y=[],showDeleteForMember:x,emptyText:w}){let j=[{title:"User Email",dataIndex:"user_email",key:"user_email",render:e=>(0,t.jsx)(g,{children:e||"-"})},{title:"User ID",dataIndex:"user_id",key:"user_id",render:e=>"default_user_id"===e?(0,t.jsx)(c.Tag,{color:"blue",children:"Default Proxy Admin"}):(0,t.jsx)(g,{children:e||"-"})},{title:v?(0,t.jsxs)(s.Space,{direction:"horizontal",children:[h,(0,t.jsx)(d.Tooltip,{title:v,children:(0,t.jsx)(r.InfoCircleOutlined,{})})]}):h,dataIndex:"role",key:"role",render:e=>(0,t.jsxs)(s.Space,{children:[e?.toLowerCase()==="admin"||e?.toLowerCase()==="org_admin"?(0,t.jsx)(a.CrownOutlined,{}):(0,t.jsx)(i.UserOutlined,{}),(0,t.jsx)(g,{style:{textTransform:"capitalize"},children:e||"-"})]})},...y,{title:"Actions",key:"actions",fixed:"right",width:120,render:(e,a)=>u?(0,t.jsxs)(s.Space,{children:[(0,t.jsx)(m.default,{variant:"Edit",tooltipText:"Edit member",dataTestId:"edit-member",onClick:()=>f(a)}),(!x||x(a))&&(0,t.jsx)(m.default,{variant:"Delete",tooltipText:"Delete member",dataTestId:"delete-member",onClick:()=>b(a)})]}):null}];return(0,t.jsxs)(s.Space,{direction:"vertical",style:{width:"100%"},children:[(0,t.jsx)(o.Table,{columns:j,dataSource:e,rowKey:e=>e.user_id??e.user_email??JSON.stringify(e),pagination:!1,size:"small",scroll:{x:"max-content"},locale:w?{emptyText:w}:void 0}),p&&u&&(0,t.jsx)(n.Button,{icon:(0,t.jsx)(l.UserAddOutlined,{}),type:"primary",onClick:p,children:"Add Member"})]})}e.s(["default",()=>f])}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/0f93c304f38c63d0.js b/litellm/proxy/_experimental/out/_next/static/chunks/0f93c304f38c63d0.js new file mode 100644 index 00000000000..e001e03620c --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/0f93c304f38c63d0.js @@ -0,0 +1 @@ +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,399219,e=>{"use strict";let t=(0,e.i(475254).default)("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);e.s(["default",()=>t])},477189,e=>{"use strict";e.i(247167);var t=e.i(931067),s=e.i(271645);let r={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"};var i=e.i(9583),l=s.forwardRef(function(e,l){return s.createElement(i.default,(0,t.default)({},e,{ref:l,icon:r}))});e.s(["AppstoreOutlined",0,l],477189)},878894,664659,531278,e=>{"use strict";var t=e.i(582458);e.s(["AlertTriangle",()=>t.default],878894);var s=e.i(631171);e.s(["ChevronDown",()=>s.default],664659);let r=(0,e.i(475254).default)("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);e.s(["Loader2",()=>r],531278)},582458,e=>{"use strict";let t=(0,e.i(475254).default)("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"}]]);e.s(["default",()=>t])},19732,631171,e=>{"use strict";e.i(247167);var t=e.i(931067),s=e.i(271645);let r={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"};var i=e.i(9583),l=s.forwardRef(function(e,l){return s.createElement(i.default,(0,t.default)({},e,{ref:l,icon:r}))});e.s(["ExperimentOutlined",0,l],19732);let a=(0,e.i(475254).default)("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);e.s(["default",()=>a],631171)},299251,e=>{"use strict";e.i(247167);var t=e.i(931067),s=e.i(271645);let r={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"};var i=e.i(9583),l=s.forwardRef(function(e,l){return s.createElement(i.default,(0,t.default)({},e,{ref:l,icon:r}))});e.s(["BankOutlined",0,l],299251)},153702,e=>{"use strict";e.i(247167);var t=e.i(931067),s=e.i(271645);let r={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"};var i=e.i(9583),l=s.forwardRef(function(e,l){return s.createElement(i.default,(0,t.default)({},e,{ref:l,icon:r}))});e.s(["BarChartOutlined",0,l],153702)},777579,e=>{"use strict";e.i(247167);var t=e.i(931067),s=e.i(271645);let r={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"};var i=e.i(9583),l=s.forwardRef(function(e,l){return s.createElement(i.default,(0,t.default)({},e,{ref:l,icon:r}))});e.s(["LineChartOutlined",0,l],777579)},457202,e=>{"use strict";e.i(247167);var t=e.i(931067),s=e.i(271645);let r={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M296 250c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h384c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H296zm184 144H296c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8zm-48 458H208V148h560v320c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V108c0-17.7-14.3-32-32-32H168c-17.7 0-32 14.3-32 32v784c0 17.7 14.3 32 32 32h264c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm440-88H728v-36.6c46.3-13.8 80-56.6 80-107.4 0-61.9-50.1-112-112-112s-112 50.1-112 112c0 50.7 33.7 93.6 80 107.4V764H520c-8.8 0-16 7.2-16 16v152c0 8.8 7.2 16 16 16h352c8.8 0 16-7.2 16-16V780c0-8.8-7.2-16-16-16zM646 620c0-27.6 22.4-50 50-50s50 22.4 50 50-22.4 50-50 50-50-22.4-50-50zm180 266H566v-60h260v60z"}}]},name:"audit",theme:"outlined"};var i=e.i(9583),l=s.forwardRef(function(e,l){return s.createElement(i.default,(0,t.default)({},e,{ref:l,icon:r}))});e.s(["AuditOutlined",0,l],457202)},182399,e=>{"use strict";e.i(247167);var t=e.i(931067),s=e.i(271645);let r={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"};var i=e.i(9583),l=s.forwardRef(function(e,l){return s.createElement(i.default,(0,t.default)({},e,{ref:l,icon:r}))});e.s(["BlockOutlined",0,l],182399)},592143,e=>{"use strict";var t=e.i(609587);e.s(["ConfigProvider",()=>t.default])},372943,899268,e=>{"use strict";e.i(247167);var t=e.i(8211),s=e.i(271645),r=e.i(343794),i=e.i(529681),l=e.i(242064),a=e.i(704914),n=e.i(876556),o=e.i(290224),c=e.i(251224),d=function(e,t){var s={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(s[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(e);it.indexOf(r[i])&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(s[r[i]]=e[r[i]]);return s};function u({suffixCls:e,tagName:t,displayName:r}){return r=>s.forwardRef((i,l)=>s.createElement(r,Object.assign({ref:l,suffixCls:e,tagName:t},i)))}let m=s.forwardRef((e,t)=>{let{prefixCls:i,suffixCls:a,className:n,tagName:o}=e,u=d(e,["prefixCls","suffixCls","className","tagName"]),{getPrefixCls:m}=s.useContext(l.ConfigContext),g=m("layout",i),[p,h,x]=(0,c.default)(g),_=a?`${g}-${a}`:g;return p(s.createElement(o,Object.assign({className:(0,r.default)(i||_,n,h,x),ref:t},u)))}),g=s.forwardRef((e,u)=>{let{direction:m}=s.useContext(l.ConfigContext),[g,p]=s.useState([]),{prefixCls:h,className:x,rootClassName:_,children:f,hasSider:y,tagName:j,style:v}=e,b=d(e,["prefixCls","className","rootClassName","children","hasSider","tagName","style"]),S=(0,i.default)(b,["suffixCls"]),{getPrefixCls:w,className:k,style:N}=(0,l.useComponentConfig)("layout"),C=w("layout",h),I="boolean"==typeof y?y:!!g.length||(0,n.default)(f).some(e=>e.type===o.default),[T,O,E]=(0,c.default)(C),L=(0,r.default)(C,{[`${C}-has-sider`]:I,[`${C}-rtl`]:"rtl"===m},k,x,_,O,E),M=s.useMemo(()=>({siderHook:{addSider:e=>{p(s=>[].concat((0,t.default)(s),[e]))},removeSider:e=>{p(t=>t.filter(t=>t!==e))}}}),[]);return T(s.createElement(a.LayoutContext.Provider,{value:M},s.createElement(j,Object.assign({ref:u,className:L,style:Object.assign(Object.assign({},N),v)},S),f)))}),p=u({tagName:"div",displayName:"Layout"})(g),h=u({suffixCls:"header",tagName:"header",displayName:"Header"})(m),x=u({suffixCls:"footer",tagName:"footer",displayName:"Footer"})(m),_=u({suffixCls:"content",tagName:"main",displayName:"Content"})(m);p.Header=h,p.Footer=x,p.Content=_,p.Sider=o.default,p._InternalSiderContext=o.SiderContext,e.s(["Layout",0,p],372943);var f=e.i(60699);e.s(["Menu",()=>f.default],899268)},87316,655900,299023,25652,882293,e=>{"use strict";var t=e.i(475254);let s=(0,t.default)("calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);e.s(["Calendar",()=>s],87316);var r=e.i(399219);e.s(["ChevronUp",()=>r.default],655900);let i=(0,t.default)("minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);e.s(["Minus",()=>i],299023);let l=(0,t.default)("trending-up",[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]]);e.s(["TrendingUp",()=>l],25652);let a=(0,t.default)("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"}]]);e.s(["UserCheck",()=>a],882293)},761911,98740,e=>{"use strict";let t=(0,e.i(475254).default)("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"}]]);e.s(["default",()=>t],98740),e.s(["Users",()=>t],761911)},190983,e=>{"use strict";var t=e.i(843476),s=e.i(371401);e.i(389083);var r=e.i(878894),i=e.i(87316);e.i(664659),e.i(655900);var l=e.i(531278),a=e.i(299023),n=e.i(25652),o=e.i(882293),c=e.i(761911),d=e.i(271645),u=e.i(764205);let m=(...e)=>e.filter(Boolean).join(" ");function g({accessToken:e,width:g=220}){let p=(0,s.useDisableUsageIndicator)(),[h,x]=(0,d.useState)(!1),[_,f]=(0,d.useState)(!1),[y,j]=(0,d.useState)(null),[v,b]=(0,d.useState)(null),[S,w]=(0,d.useState)(!1),[k,N]=(0,d.useState)(null);(0,d.useEffect)(()=>{(async()=>{if(e){w(!0),N(null);try{let[t,s]=await Promise.all([(0,u.getRemainingUsers)(e),(0,u.getLicenseInfo)(e).catch(()=>null)]);j(t),b(s)}catch(e){console.error("Failed to fetch usage data:",e),N("Failed to load usage data")}finally{w(!1)}}})()},[e]);let C=v?.expiration_date?(e=>{if(!e)return null;let t=new Date(e+"T00:00:00Z"),s=new Date;return s.setHours(0,0,0,0),Math.ceil((t.getTime()-s.getTime())/864e5)})(v.expiration_date):null,I=null!==C&&C<0,T=null!==C&&C>=0&&C<30,{isOverLimit:O,isNearLimit:E,usagePercentage:L,userMetrics:M,teamMetrics:A}=(e=>{if(!e)return{isOverLimit:!1,isNearLimit:!1,usagePercentage:0,userMetrics:{isOverLimit:!1,isNearLimit:!1,usagePercentage:0},teamMetrics:{isOverLimit:!1,isNearLimit:!1,usagePercentage:0}};let t=e.total_users?e.total_users_used/e.total_users*100:0,s=t>100,r=t>=80&&t<=100,i=e.total_teams?e.total_teams_used/e.total_teams*100:0,l=i>100,a=i>=80&&i<=100,n=s||l;return{isOverLimit:n,isNearLimit:(r||a)&&!n,usagePercentage:Math.max(t,i),userMetrics:{isOverLimit:s,isNearLimit:r,usagePercentage:t},teamMetrics:{isOverLimit:l,isNearLimit:a,usagePercentage:i}}})(y),P=O||E||I||T,z=O||I,F=(E||T)&&!z;return p||!e||y?.total_users===null&&y?.total_teams===null?null:(0,t.jsx)("div",{className:"fixed bottom-4 left-4 z-50",style:{width:`${Math.min(g,220)}px`},children:(0,t.jsx)(()=>_?(0,t.jsx)("button",{onClick:()=>f(!1),className:m("bg-white border border-gray-200 rounded-lg shadow-sm p-3 hover:shadow-md transition-all w-full"),title:"Show usage details",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(c.Users,{className:"h-4 w-4 flex-shrink-0"}),P&&(0,t.jsx)("span",{className:"flex-shrink-0",children:z?(0,t.jsx)(r.AlertTriangle,{className:"h-3 w-3"}):F?(0,t.jsx)(n.TrendingUp,{className:"h-3 w-3"}):null}),(0,t.jsxs)("div",{className:"flex items-center gap-2 text-sm font-medium truncate",children:[y&&null!==y.total_users&&(0,t.jsxs)("span",{className:m("flex-shrink-0 px-1.5 py-0.5 rounded text-xs border",M.isOverLimit&&"bg-red-50 text-red-700 border-red-200",M.isNearLimit&&"bg-yellow-50 text-yellow-700 border-yellow-200",!M.isOverLimit&&!M.isNearLimit&&"bg-gray-50 text-gray-700 border-gray-200"),children:["U: ",y.total_users_used,"/",y.total_users]}),y&&null!==y.total_teams&&(0,t.jsxs)("span",{className:m("flex-shrink-0 px-1.5 py-0.5 rounded text-xs border",A.isOverLimit&&"bg-red-50 text-red-700 border-red-200",A.isNearLimit&&"bg-yellow-50 text-yellow-700 border-yellow-200",!A.isOverLimit&&!A.isNearLimit&&"bg-gray-50 text-gray-700 border-gray-200"),children:["T: ",y.total_teams_used,"/",y.total_teams]}),v?.expiration_date&&null!==C&&(0,t.jsx)("span",{className:m("flex-shrink-0 px-1.5 py-0.5 rounded text-xs border",I&&"bg-red-50 text-red-700 border-red-200",T&&"bg-yellow-50 text-yellow-700 border-yellow-200",!I&&!T&&"bg-gray-50 text-gray-700 border-gray-200"),children:C<0?"Exp!":`${C}d`}),!y||null===y.total_users&&null===y.total_teams&&!v&&(0,t.jsx)("span",{className:"truncate",children:"Usage"})]})]})}):S?(0,t.jsx)("div",{className:"bg-white border border-gray-200 rounded-lg shadow-sm p-4 w-full",children:(0,t.jsxs)("div",{className:"flex items-center justify-center gap-2 py-2",children:[(0,t.jsx)(l.Loader2,{className:"h-4 w-4 animate-spin"}),(0,t.jsx)("span",{className:"text-sm text-gray-500 truncate",children:"Loading..."})]})}):k||!y?(0,t.jsx)("div",{className:"bg-white border border-gray-200 rounded-lg shadow-sm p-4 group w-full",children:(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,t.jsx)("div",{className:"flex-1 min-w-0",children:(0,t.jsx)("span",{className:"text-sm text-gray-500 truncate block",children:k||"No data"})}),(0,t.jsx)("button",{onClick:()=>f(!0),className:"opacity-0 group-hover:opacity-100 p-1 hover:bg-gray-100 rounded transition-all flex-shrink-0",title:"Minimize",children:(0,t.jsx)(a.Minus,{className:"h-3 w-3 text-gray-400"})})]})}):(0,t.jsxs)("div",{className:m("bg-white border rounded-lg shadow-sm p-3 transition-all duration-200 group w-full"),children:[(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2 mb-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[(0,t.jsx)(c.Users,{className:"h-4 w-4 flex-shrink-0"}),(0,t.jsx)("span",{className:"font-medium text-sm truncate",children:"Usage"})]}),(0,t.jsx)("button",{onClick:()=>f(!0),className:"opacity-0 group-hover:opacity-100 p-1 hover:bg-gray-100 rounded transition-all flex-shrink-0",title:"Minimize",children:(0,t.jsx)(a.Minus,{className:"h-3 w-3 text-gray-400"})})]}),(0,t.jsxs)("div",{className:"space-y-3 text-sm",children:[v?.has_license&&v.expiration_date&&(0,t.jsxs)("div",{className:m("space-y-1 border rounded-md p-2",I&&"border-red-200 bg-red-50",T&&"border-yellow-200 bg-yellow-50"),children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 text-xs text-gray-600 mb-1",children:[(0,t.jsx)(i.Calendar,{className:"h-3 w-3"}),(0,t.jsx)("span",{className:"font-medium",children:"License"}),(0,t.jsx)("span",{className:m("ml-1 px-1.5 py-0.5 rounded border",I&&"bg-red-50 text-red-700 border-red-200",T&&"bg-yellow-50 text-yellow-700 border-yellow-200",!I&&!T&&"bg-gray-50 text-gray-600 border-gray-200"),children:I?"Expired":T?"Expiring soon":"OK"})]}),(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsx)("span",{className:"text-gray-600 text-xs",children:"Status:"}),(0,t.jsx)("span",{className:m("font-medium text-right",I&&"text-red-600",T&&"text-yellow-600"),children:(e=>{if(null===e)return"No expiration";if(e<0)return"Expired";if(0===e)return"Expires today";if(1===e)return"1 day remaining";if(e<30)return`${e} days remaining`;if(e<60)return"1 month remaining";let t=Math.floor(e/30);return`${t} months remaining`})(C)})]}),v.license_type&&(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsx)("span",{className:"text-gray-600 text-xs",children:"Type:"}),(0,t.jsx)("span",{className:"font-medium text-right capitalize",children:v.license_type})]})]}),null!==y.total_users&&(0,t.jsxs)("div",{className:m("space-y-1 border rounded-md p-2",M.isOverLimit&&"border-red-200 bg-red-50",M.isNearLimit&&"border-yellow-200 bg-yellow-50"),children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 text-xs text-gray-600 mb-1",children:[(0,t.jsx)(c.Users,{className:"h-3 w-3"}),(0,t.jsx)("span",{className:"font-medium",children:"Users"}),(0,t.jsx)("span",{className:m("ml-1 px-1.5 py-0.5 rounded border",M.isOverLimit&&"bg-red-50 text-red-700 border-red-200",M.isNearLimit&&"bg-yellow-50 text-yellow-700 border-yellow-200",!M.isOverLimit&&!M.isNearLimit&&"bg-gray-50 text-gray-600 border-gray-200"),children:M.isOverLimit?"Over limit":M.isNearLimit?"Near limit":"OK"})]}),(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsx)("span",{className:"text-gray-600 text-xs",children:"Used:"}),(0,t.jsxs)("span",{className:"font-medium text-right",children:[y.total_users_used,"/",y.total_users]})]}),(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsx)("span",{className:"text-gray-600 text-xs",children:"Remaining:"}),(0,t.jsx)("span",{className:m("font-medium text-right",M.isOverLimit&&"text-red-600",M.isNearLimit&&"text-yellow-600"),children:y.total_users_remaining})]}),(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsx)("span",{className:"text-gray-600 text-xs",children:"Usage:"}),(0,t.jsxs)("span",{className:"font-medium text-right",children:[Math.round(M.usagePercentage),"%"]})]}),(0,t.jsx)("div",{className:"w-full bg-gray-200 rounded-full h-2",children:(0,t.jsx)("div",{className:m("h-2 rounded-full transition-all duration-300",M.isOverLimit&&"bg-red-500",M.isNearLimit&&"bg-yellow-500",!M.isOverLimit&&!M.isNearLimit&&"bg-green-500"),style:{width:`${Math.min(M.usagePercentage,100)}%`}})})]}),null!==y.total_teams&&(0,t.jsxs)("div",{className:m("space-y-1 border rounded-md p-2",A.isOverLimit&&"border-red-200 bg-red-50",A.isNearLimit&&"border-yellow-200 bg-yellow-50"),children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 text-xs text-gray-600 mb-1",children:[(0,t.jsx)(o.UserCheck,{className:"h-3 w-3"}),(0,t.jsx)("span",{className:"font-medium",children:"Teams"}),(0,t.jsx)("span",{className:m("ml-1 px-1.5 py-0.5 rounded border",A.isOverLimit&&"bg-red-50 text-red-700 border-red-200",A.isNearLimit&&"bg-yellow-50 text-yellow-700 border-yellow-200",!A.isOverLimit&&!A.isNearLimit&&"bg-gray-50 text-gray-600 border-gray-200"),children:A.isOverLimit?"Over limit":A.isNearLimit?"Near limit":"OK"})]}),(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsx)("span",{className:"text-gray-600 text-xs",children:"Used:"}),(0,t.jsxs)("span",{className:"font-medium text-right",children:[y.total_teams_used,"/",y.total_teams]})]}),(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsx)("span",{className:"text-gray-600 text-xs",children:"Remaining:"}),(0,t.jsx)("span",{className:m("font-medium text-right",A.isOverLimit&&"text-red-600",A.isNearLimit&&"text-yellow-600"),children:y.total_teams_remaining})]}),(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsx)("span",{className:"text-gray-600 text-xs",children:"Usage:"}),(0,t.jsxs)("span",{className:"font-medium text-right",children:[Math.round(A.usagePercentage),"%"]})]}),(0,t.jsx)("div",{className:"w-full bg-gray-200 rounded-full h-2",children:(0,t.jsx)("div",{className:m("h-2 rounded-full transition-all duration-300",A.isOverLimit&&"bg-red-500",A.isNearLimit&&"bg-yellow-500",!A.isOverLimit&&!A.isNearLimit&&"bg-green-500"),style:{width:`${Math.min(A.usagePercentage,100)}%`}})})]})]})]}),{})})}e.s(["default",()=>g])},475647,286536,77705,e=>{"use strict";e.i(247167);var t=e.i(931067),s=e.i(271645);let r={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"};var i=e.i(9583),l=s.forwardRef(function(e,l){return s.createElement(i.default,(0,t.default)({},e,{ref:l,icon:r}))});e.s(["PlusCircleOutlined",0,l],475647);var a=e.i(475254);let n=(0,a.default)("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);e.s(["Eye",()=>n],286536);let o=(0,a.default)("eye-off",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);e.s(["EyeOff",()=>o],77705)},366283,e=>{"use strict";var t=e.i(290571),s=e.i(271645),r=e.i(95779),i=e.i(444755),l=e.i(673706);let a=(0,l.makeClassName)("Callout"),n=s.default.forwardRef((e,n)=>{let{title:o,icon:c,color:d,className:u,children:m}=e,g=(0,t.__rest)(e,["title","icon","color","className","children"]);return s.default.createElement("div",Object.assign({ref:n,className:(0,i.tremorTwMerge)(a("root"),"flex flex-col overflow-hidden rounded-tremor-default text-tremor-default border-l-4 py-3 pr-3 pl-4",d?(0,i.tremorTwMerge)((0,l.getColorClassNames)(d,r.colorPalette.background).bgColor,(0,l.getColorClassNames)(d,r.colorPalette.darkBorder).borderColor,(0,l.getColorClassNames)(d,r.colorPalette.darkText).textColor,"dark:bg-opacity-10 bg-opacity-10"):(0,i.tremorTwMerge)("bg-tremor-brand-faint border-tremor-brand-emphasis text-tremor-brand-emphasis","dark:bg-dark-tremor-brand-muted/70 dark:border-dark-tremor-brand-emphasis dark:text-dark-tremor-brand-emphasis"),u)},g),s.default.createElement("div",{className:(0,i.tremorTwMerge)(a("header"),"flex items-start")},c?s.default.createElement(c,{className:(0,i.tremorTwMerge)(a("icon"),"flex-none h-5 w-5 mr-1.5")}):null,s.default.createElement("h4",{className:(0,i.tremorTwMerge)(a("title"),"font-semibold")},o)),s.default.createElement("p",{className:(0,i.tremorTwMerge)(a("body"),"overflow-y-auto",m?"mt-2":"")},m))});n.displayName="Callout",e.s(["Callout",()=>n],366283)},439061,234779,374615,330995,e=>{"use strict";e.i(247167);var t=e.i(931067),s=e.i(271645);let r={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"};var i=e.i(9583),l=s.forwardRef(function(e,l){return s.createElement(i.default,(0,t.default)({},e,{ref:l,icon:r}))});e.s(["BgColorsOutlined",0,l],439061);let a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M832 64H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V96c0-17.7-14.3-32-32-32zm-260 72h96v209.9L621.5 312 572 347.4V136zm220 752H232V136h280v296.9c0 3.3 1 6.6 3 9.3a15.9 15.9 0 0022.3 3.7l83.8-59.9 81.4 59.4c2.7 2 6 3.1 9.4 3.1 8.8 0 16-7.2 16-16V136h64v752z"}}]},name:"book",theme:"outlined"};var n=s.forwardRef(function(e,r){return s.createElement(i.default,(0,t.default)({},e,{ref:r,icon:a}))});e.s(["BookOutlined",0,n],234779);let o={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M928 160H96c-17.7 0-32 14.3-32 32v640c0 17.7 14.3 32 32 32h832c17.7 0 32-14.3 32-32V192c0-17.7-14.3-32-32-32zm-792 72h752v120H136V232zm752 560H136V440h752v352zm-237-64h165c4.4 0 8-3.6 8-8v-72c0-4.4-3.6-8-8-8H651c-4.4 0-8 3.6-8 8v72c0 4.4 3.6 8 8 8z"}}]},name:"credit-card",theme:"outlined"};var c=s.forwardRef(function(e,r){return s.createElement(i.default,(0,t.default)({},e,{ref:r,icon:o}))});e.s(["CreditCardOutlined",0,c],374615);var d=e.i(366845);e.s(["FolderOutlined",()=>d.default],330995)},844444,e=>{"use strict";var t=e.i(843476),s=e.i(906579),r=e.i(271645),i=e.i(115571);function l(e){let t=t=>{"disableShowNewBadge"===t.key&&e()},s=t=>{let{key:s}=t.detail;"disableShowNewBadge"===s&&e()};return window.addEventListener("storage",t),window.addEventListener(i.LOCAL_STORAGE_EVENT,s),()=>{window.removeEventListener("storage",t),window.removeEventListener(i.LOCAL_STORAGE_EVENT,s)}}function a(){return"true"===(0,i.getLocalStorageItem)("disableShowNewBadge")}function n({children:e,dot:i=!1}){return(0,r.useSyncExternalStore)(l,a)?e?(0,t.jsx)(t.Fragment,{children:e}):null:e?(0,t.jsx)(s.Badge,{color:"blue",count:i?void 0:"New",dot:i,children:e}):(0,t.jsx)(s.Badge,{color:"blue",count:i?void 0:"New",dot:i})}e.s(["default",()=>n],844444)},111672,e=>{"use strict";var t=e.i(843476),s=e.i(109799),r=e.i(785242),i=e.i(135214),l=e.i(218129),a=e.i(477189),n=e.i(457202),o=e.i(299251),c=e.i(153702),d=e.i(439061),u=e.i(182399),m=e.i(234779),g=e.i(374615),p=e.i(210612),h=e.i(19732),x=e.i(993914),_=e.i(330995),f=e.i(438957),y=e.i(777579),j=e.i(788191),v=e.i(983561),b=e.i(602073),S=e.i(928685),w=e.i(313603),k=e.i(232164),N=e.i(645526),C=e.i(366308),I=e.i(771674),T=e.i(592143),O=e.i(372943),E=e.i(899268),L=e.i(271645),M=e.i(708347),A=e.i(844444),P=e.i(190983);let{Sider:z}=O.Layout,F=[{groupLabel:"AI GATEWAY",items:[{key:"api-keys",page:"api-keys",label:"Virtual Keys",icon:(0,t.jsx)(f.KeyOutlined,{})},{key:"llm-playground",page:"llm-playground",label:"Playground",icon:(0,t.jsx)(j.PlayCircleOutlined,{}),roles:M.rolesWithWriteAccess},{key:"models",page:"models",label:"Models + Endpoints",icon:(0,t.jsx)(u.BlockOutlined,{}),roles:M.rolesWithWriteAccess},{key:"agents",page:"agents",label:"Agents",icon:(0,t.jsx)(v.RobotOutlined,{}),roles:M.rolesWithWriteAccess},{key:"mcp-servers",page:"mcp-servers",label:"MCP Servers",icon:(0,t.jsx)(C.ToolOutlined,{})},{key:"guardrails",page:"guardrails",label:"Guardrails",icon:(0,t.jsx)(b.SafetyOutlined,{}),roles:M.all_admin_roles},{key:"policies",page:"policies",label:(0,t.jsx)("span",{className:"flex items-center gap-4",children:"Policies"}),icon:(0,t.jsx)(n.AuditOutlined,{}),roles:M.all_admin_roles},{key:"tools",page:"tools",label:"Tools",icon:(0,t.jsx)(C.ToolOutlined,{}),children:[{key:"search-tools",page:"search-tools",label:"Search Tools",icon:(0,t.jsx)(S.SearchOutlined,{})},{key:"vector-stores",page:"vector-stores",label:"Vector Stores",icon:(0,t.jsx)(p.DatabaseOutlined,{})},{key:"tool-policies",page:"tool-policies",label:"Tool Policies",icon:(0,t.jsx)(b.SafetyOutlined,{})}]}]},{groupLabel:"OBSERVABILITY",items:[{key:"new_usage",page:"new_usage",icon:(0,t.jsx)(c.BarChartOutlined,{}),roles:[...M.all_admin_roles,...M.internalUserRoles],label:"Usage"},{key:"logs",page:"logs",label:"Logs",icon:(0,t.jsx)(y.LineChartOutlined,{})},{key:"guardrails-monitor",page:"guardrails-monitor",label:"Guardrails Monitor",icon:(0,t.jsx)(b.SafetyOutlined,{}),roles:[...M.all_admin_roles,...M.internalUserRoles]}]},{groupLabel:"ACCESS CONTROL",items:[{key:"teams",page:"teams",label:"Teams",icon:(0,t.jsx)(N.TeamOutlined,{})},{key:"projects",page:"projects",label:(0,t.jsxs)("span",{className:"flex items-center gap-2",children:["Projects ",(0,t.jsx)(A.default,{})]}),icon:(0,t.jsx)(_.FolderOutlined,{}),roles:M.all_admin_roles},{key:"users",page:"users",label:"Internal Users",icon:(0,t.jsx)(I.UserOutlined,{}),roles:M.all_admin_roles},{key:"organizations",page:"organizations",label:"Organizations",icon:(0,t.jsx)(o.BankOutlined,{}),roles:M.all_admin_roles},{key:"access-groups",page:"access-groups",label:"Access Groups",icon:(0,t.jsx)(u.BlockOutlined,{}),roles:M.all_admin_roles},{key:"budgets",page:"budgets",label:"Budgets",icon:(0,t.jsx)(g.CreditCardOutlined,{}),roles:M.all_admin_roles}]},{groupLabel:"DEVELOPER TOOLS",items:[{key:"api_ref",page:"api_ref",label:"API Reference",icon:(0,t.jsx)(l.ApiOutlined,{})},{key:"model-hub-table",page:"model-hub-table",label:"AI Hub",icon:(0,t.jsx)(a.AppstoreOutlined,{})},{key:"learning-resources",page:"learning-resources",label:"Learning Resources",icon:(0,t.jsx)(m.BookOutlined,{}),external_url:"https://models.litellm.ai/cookbook"},{key:"experimental",page:"experimental",label:"Experimental",icon:(0,t.jsx)(h.ExperimentOutlined,{}),children:[{key:"caching",page:"caching",label:"Caching",icon:(0,t.jsx)(p.DatabaseOutlined,{}),roles:M.all_admin_roles},{key:"prompts",page:"prompts",label:"Prompts",icon:(0,t.jsx)(x.FileTextOutlined,{}),roles:M.all_admin_roles},{key:"transform-request",page:"transform-request",label:"API Playground",icon:(0,t.jsx)(l.ApiOutlined,{}),roles:[...M.all_admin_roles,...M.internalUserRoles]},{key:"tag-management",page:"tag-management",label:"Tag Management",icon:(0,t.jsx)(k.TagsOutlined,{}),roles:M.all_admin_roles},{key:"claude-code-plugins",page:"claude-code-plugins",label:"Claude Code Plugins",icon:(0,t.jsx)(C.ToolOutlined,{}),roles:M.all_admin_roles},{key:"4",page:"usage",label:"Old Usage",icon:(0,t.jsx)(c.BarChartOutlined,{})}]}]},{groupLabel:"SETTINGS",roles:M.all_admin_roles,items:[{key:"settings",page:"settings",label:(0,t.jsxs)("span",{className:"flex items-center gap-2",children:["Settings ",(0,t.jsx)(A.default,{})]}),icon:(0,t.jsx)(w.SettingOutlined,{}),roles:M.all_admin_roles,children:[{key:"router-settings",page:"router-settings",label:"Router Settings",icon:(0,t.jsx)(w.SettingOutlined,{}),roles:M.all_admin_roles},{key:"logging-and-alerts",page:"logging-and-alerts",label:"Logging & Alerts",icon:(0,t.jsx)(w.SettingOutlined,{}),roles:M.all_admin_roles},{key:"admin-panel",page:"admin-panel",label:(0,t.jsxs)("span",{className:"flex items-center gap-2",children:["Admin Settings ",(0,t.jsx)(A.default,{dot:!0,children:(0,t.jsx)("span",{})})]}),icon:(0,t.jsx)(w.SettingOutlined,{}),roles:M.all_admin_roles},{key:"cost-tracking",page:"cost-tracking",label:"Cost Tracking",icon:(0,t.jsx)(c.BarChartOutlined,{}),roles:M.all_admin_roles},{key:"ui-theme",page:"ui-theme",label:"UI Theme",icon:(0,t.jsx)(d.BgColorsOutlined,{}),roles:M.all_admin_roles}]}]}];e.s(["default",0,({setPage:e,defaultSelectedKey:l,collapsed:a=!1,enabledPagesInternalUsers:n,enableProjectsUI:o,disableAgentsForInternalUsers:c,allowAgentsForTeamAdmins:d,disableVectorStoresForInternalUsers:u,allowVectorStoresForTeamAdmins:m})=>{let g,{userId:p,accessToken:h,userRole:x}=(0,i.default)(),{data:_}=(0,s.useOrganizations)(),{data:f}=(0,r.useTeams)(),y=(0,L.useMemo)(()=>!!p&&!!_&&_.some(e=>e.members?.some(e=>e.user_id===p&&"org_admin"===e.user_role)),[p,_]),j=(0,L.useMemo)(()=>(0,M.isUserTeamAdminForAnyTeam)(f??null,p??""),[f,p]),v=t=>{let s=new URLSearchParams(window.location.search);s.set("page",t),window.history.pushState(null,"",`?${s.toString()}`),e(t)},b=(e,s,r)=>{if(r)return(0,t.jsx)("a",{href:r,target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),style:{color:"inherit",textDecoration:"none"},children:e});let i=new URLSearchParams(window.location.search);i.set("page",s);let l=`?${i.toString()}`;return(0,t.jsx)("a",{href:l,onClick:e=>{e.metaKey||e.ctrlKey||e.shiftKey||1===e.button?e.stopPropagation():e.preventDefault()},style:{color:"inherit",textDecoration:"none"},children:e})},S=e=>{let t=(0,M.isAdminRole)(x);return null!=n&&console.log("[LeftNav] Filtering with enabled pages:",{userRole:x,isAdmin:t,enabledPagesInternalUsers:n}),e.map(e=>({...e,children:e.children?S(e.children):void 0})).filter(e=>{if("organizations"===e.key){if(!(!e.roles||e.roles.includes(x)||y))return!1;if(!t&&null!=n){let t=n.includes(e.page);return console.log(`[LeftNav] Page "${e.page}" (${e.key}): ${t?"VISIBLE":"HIDDEN"}`),t}return!0}if("projects"===e.key&&!o||!t&&"agents"===e.key&&c&&!(d&&j)||!t&&"vector-stores"===e.key&&u&&!(m&&j)||e.roles&&!e.roles.includes(x))return!1;if(!t&&null!=n){if(e.children&&e.children.length>0&&e.children.some(e=>n.includes(e.page)))return console.log(`[LeftNav] Parent "${e.page}" (${e.key}): VISIBLE (has visible children)`),!0;let t=n.includes(e.page);return console.log(`[LeftNav] Page "${e.page}" (${e.key}): ${t?"VISIBLE":"HIDDEN"}`),t}return!0})},w=(e=>{for(let t of F)for(let s of t.items){if(s.page===e)return s.key;if(s.children){let t=s.children.find(t=>t.page===e);if(t)return t.key}}return"api-keys"})(l);return(0,t.jsx)(O.Layout,{children:(0,t.jsxs)(z,{theme:"light",width:220,collapsed:a,collapsedWidth:80,collapsible:!0,trigger:null,style:{transition:"all 0.3s cubic-bezier(0.4, 0, 0.2, 1)",position:"relative"},children:[(0,t.jsx)(T.ConfigProvider,{theme:{components:{Menu:{iconSize:15,fontSize:13,itemMarginInline:4,itemPaddingInline:8,itemHeight:30,itemBorderRadius:6,subMenuItemBorderRadius:6,groupTitleFontSize:10,groupTitleLineHeight:1.5}}},children:(0,t.jsx)(E.Menu,{mode:"inline",selectedKeys:[w],defaultOpenKeys:[],inlineCollapsed:a,className:"custom-sidebar-menu",style:{borderRight:0,backgroundColor:"transparent",fontSize:"13px",paddingTop:"4px"},items:(g=[],F.forEach(e=>{if(e.roles&&!e.roles.includes(x))return;let s=S(e.items);0!==s.length&&g.push({type:"group",label:a?null:(0,t.jsx)("span",{style:{fontSize:"10px",fontWeight:600,color:"#6b7280",letterSpacing:"0.05em",padding:"12px 0 4px 12px",display:"block",marginBottom:"2px"},children:e.groupLabel}),children:s.map(e=>({key:e.key,icon:e.icon,label:b(e.label,e.page,e.external_url),children:e.children?.map(e=>({key:e.key,icon:e.icon,label:b(e.label,e.page,e.external_url),onClick:()=>{e.external_url?window.open(e.external_url,"_blank"):v(e.page)}})),onClick:e.children?void 0:()=>{e.external_url?window.open(e.external_url,"_blank"):v(e.page)}}))})}),g)})}),(0,M.isAdminRole)(x)&&!a&&(0,t.jsx)(P.default,{accessToken:h,width:220})]})})},"menuGroups",()=>F])},461451,37329,100070,e=>{"use strict";var t=e.i(843476),s=e.i(271645),r=e.i(304967),i=e.i(629569),l=e.i(599724),a=e.i(350967),n=e.i(994388),o=e.i(366283),c=e.i(779241),d=e.i(114600),u=e.i(808613),m=e.i(764205),g=e.i(237016),p=e.i(596239),h=e.i(438957),x=e.i(166406),_=e.i(270377),f=e.i(475647),y=e.i(190702),j=e.i(727749);e.s(["default",0,({accessToken:e,userID:v,proxySettings:b})=>{let[S]=u.Form.useForm(),[w,k]=(0,s.useState)(!1),[N,C]=(0,s.useState)(null),[I,T]=(0,s.useState)("");(0,s.useEffect)(()=>{let e="";T(e=b&&b.PROXY_BASE_URL&&void 0!==b.PROXY_BASE_URL?b.PROXY_BASE_URL:window.location.origin)},[b]);let O=`${I}/scim/v2`,E=async t=>{if(!e||!v)return void j.default.fromBackend("You need to be logged in to create a SCIM token");try{k(!0);let s={key_alias:t.key_alias||"SCIM Access Token",team_id:null,models:[],allowed_routes:["/scim/*"]},r=await (0,m.keyCreateCall)(e,v,s);C(r),j.default.success("SCIM token created successfully")}catch(e){console.error("Error creating SCIM token:",e),j.default.fromBackend("Failed to create SCIM token: "+(0,y.parseErrorMessage)(e))}finally{k(!1)}};return(0,t.jsx)(a.Grid,{numItems:1,children:(0,t.jsxs)(r.Card,{children:[(0,t.jsx)("div",{className:"flex items-center mb-4",children:(0,t.jsx)(i.Title,{children:"SCIM Configuration"})}),(0,t.jsx)(l.Text,{className:"text-gray-600",children:"System for Cross-domain Identity Management (SCIM) allows you to automatically provision and manage users and groups in LiteLLM."}),(0,t.jsx)(d.Divider,{}),(0,t.jsxs)("div",{className:"space-y-8",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center mb-2",children:[(0,t.jsx)("div",{className:"flex items-center justify-center w-6 h-6 rounded-full bg-blue-100 text-blue-700 mr-2",children:"1"}),(0,t.jsxs)(i.Title,{className:"text-lg flex items-center",children:[(0,t.jsx)(p.LinkOutlined,{className:"h-5 w-5 mr-2"}),"SCIM Tenant URL"]})]}),(0,t.jsx)(l.Text,{className:"text-gray-600 mb-3",children:"Use this URL in your identity provider SCIM integration settings."}),(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)(c.TextInput,{value:O,disabled:!0,className:"flex-grow"}),(0,t.jsx)(g.CopyToClipboard,{text:O,onCopy:()=>j.default.success("URL copied to clipboard"),children:(0,t.jsxs)(n.Button,{variant:"primary",className:"ml-2 flex items-center",children:[(0,t.jsx)(x.CopyOutlined,{className:"h-4 w-4 mr-1"}),"Copy"]})})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center mb-2",children:[(0,t.jsx)("div",{className:"flex items-center justify-center w-6 h-6 rounded-full bg-blue-100 text-blue-700 mr-2",children:"2"}),(0,t.jsxs)(i.Title,{className:"text-lg flex items-center",children:[(0,t.jsx)(h.KeyOutlined,{className:"h-5 w-5 mr-2"}),"Authentication Token"]})]}),(0,t.jsx)(o.Callout,{title:"Using SCIM",color:"blue",className:"mb-4",children:"You need a SCIM token to authenticate with the SCIM API. Create one below and use it in your SCIM provider configuration."}),N?(0,t.jsxs)(r.Card,{className:"border border-yellow-300 bg-yellow-50",children:[(0,t.jsxs)("div",{className:"flex items-center mb-2 text-yellow-800",children:[(0,t.jsx)(_.ExclamationCircleOutlined,{className:"h-5 w-5 mr-2"}),(0,t.jsx)(i.Title,{className:"text-lg text-yellow-800",children:"Your SCIM Token"})]}),(0,t.jsx)(l.Text,{className:"text-yellow-800 mb-4 font-medium",children:"Make sure to copy this token now. You will not be able to see it again."}),(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)(c.TextInput,{value:N.key,className:"flex-grow mr-2 bg-white",type:"password",disabled:!0}),(0,t.jsx)(g.CopyToClipboard,{text:N.key,onCopy:()=>j.default.success("Token copied to clipboard"),children:(0,t.jsxs)(n.Button,{variant:"primary",className:"flex items-center",children:[(0,t.jsx)(x.CopyOutlined,{className:"h-4 w-4 mr-1"}),"Copy"]})})]}),(0,t.jsxs)(n.Button,{className:"mt-4 flex items-center",variant:"secondary",onClick:()=>C(null),children:[(0,t.jsx)(f.PlusCircleOutlined,{className:"h-4 w-4 mr-1"}),"Create Another Token"]})]}):(0,t.jsx)("div",{className:"bg-gray-50 p-4 rounded-lg",children:(0,t.jsxs)(u.Form,{form:S,onFinish:E,layout:"vertical",children:[(0,t.jsx)(u.Form.Item,{name:"key_alias",label:"Token Name",rules:[{required:!0,message:"Please enter a name for your token"}],children:(0,t.jsx)(c.TextInput,{placeholder:"SCIM Access Token"})}),(0,t.jsx)(u.Form.Item,{children:(0,t.jsxs)(n.Button,{variant:"primary",type:"submit",loading:w,className:"flex items-center",children:[(0,t.jsx)(h.KeyOutlined,{className:"h-4 w-4 mr-1"}),"Create SCIM Token"]})})]})})]})]})]})})}],461451);var v=e.i(135214),b=e.i(266027),S=e.i(243652);let w=(0,S.createQueryKeys)("sso"),k=()=>{let{accessToken:e,userId:t,userRole:s}=(0,v.default)();return(0,b.useQuery)({queryKey:w.detail("settings"),queryFn:async()=>await (0,m.getSSOSettings)(e),enabled:!!(e&&t&&s)})};var N=e.i(464571),C=e.i(175712),I=e.i(869216),T=e.i(770914),O=e.i(262218),E=e.i(898586),L=e.i(688511),M=e.i(98919),A=e.i(727612);let P={google:"https://artificialanalysis.ai/img/logos/google_small.svg",microsoft:"https://upload.wikimedia.org/wikipedia/commons/a/a8/Microsoft_Azure_Logo.svg",okta:"https://www.okta.com/sites/default/files/Okta_Logo_BrightBlue_Medium.png",generic:""},z={google:"Google SSO",microsoft:"Microsoft SSO",okta:"Okta / Auth0 SSO",generic:"Generic SSO"},F={internal_user_viewer:"Internal Viewer",internal_user:"Internal User",proxy_admin_viewer:"Proxy Admin Viewer",proxy_admin:"Proxy Admin"};var U=e.i(212931),R=e.i(536916),B=e.i(311451),D=e.i(199133);let V={google:{envVarMap:{google_client_id:"GOOGLE_CLIENT_ID",google_client_secret:"GOOGLE_CLIENT_SECRET"},fields:[{label:"Google Client ID",name:"google_client_id"},{label:"Google Client Secret",name:"google_client_secret"}]},microsoft:{envVarMap:{microsoft_client_id:"MICROSOFT_CLIENT_ID",microsoft_client_secret:"MICROSOFT_CLIENT_SECRET",microsoft_tenant:"MICROSOFT_TENANT"},fields:[{label:"Microsoft Client ID",name:"microsoft_client_id"},{label:"Microsoft Client Secret",name:"microsoft_client_secret"},{label:"Microsoft Tenant",name:"microsoft_tenant"}]},okta:{envVarMap:{generic_client_id:"GENERIC_CLIENT_ID",generic_client_secret:"GENERIC_CLIENT_SECRET",generic_authorization_endpoint:"GENERIC_AUTHORIZATION_ENDPOINT",generic_token_endpoint:"GENERIC_TOKEN_ENDPOINT",generic_userinfo_endpoint:"GENERIC_USERINFO_ENDPOINT"},fields:[{label:"Generic Client ID",name:"generic_client_id"},{label:"Generic Client Secret",name:"generic_client_secret"},{label:"Authorization Endpoint",name:"generic_authorization_endpoint",placeholder:"https://your-domain/authorize"},{label:"Token Endpoint",name:"generic_token_endpoint",placeholder:"https://your-domain/token"},{label:"Userinfo Endpoint",name:"generic_userinfo_endpoint",placeholder:"https://your-domain/userinfo"}]},generic:{envVarMap:{generic_client_id:"GENERIC_CLIENT_ID",generic_client_secret:"GENERIC_CLIENT_SECRET",generic_authorization_endpoint:"GENERIC_AUTHORIZATION_ENDPOINT",generic_token_endpoint:"GENERIC_TOKEN_ENDPOINT",generic_userinfo_endpoint:"GENERIC_USERINFO_ENDPOINT"},fields:[{label:"Generic Client ID",name:"generic_client_id"},{label:"Generic Client Secret",name:"generic_client_secret"},{label:"Authorization Endpoint",name:"generic_authorization_endpoint"},{label:"Token Endpoint",name:"generic_token_endpoint"},{label:"Userinfo Endpoint",name:"generic_userinfo_endpoint"}]}},G=({form:e,onFormSubmit:s})=>(0,t.jsx)("div",{children:(0,t.jsxs)(u.Form,{form:e,onFinish:s,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,t.jsx)(u.Form.Item,{label:"SSO Provider",name:"sso_provider",rules:[{required:!0,message:"Please select an SSO provider"}],children:(0,t.jsx)(D.Select,{children:Object.entries(P).map(([e,s])=>(0,t.jsx)(D.Select.Option,{value:e,children:(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",padding:"4px 0"},children:[s&&(0,t.jsx)("img",{src:s,alt:e,style:{height:24,width:24,marginRight:12,objectFit:"contain"}}),(0,t.jsx)("span",{children:z[e]||e.charAt(0).toUpperCase()+e.slice(1)+" SSO"})]})},e))})}),(0,t.jsx)(u.Form.Item,{noStyle:!0,shouldUpdate:(e,t)=>e.sso_provider!==t.sso_provider,children:({getFieldValue:e})=>{let s,r=e("sso_provider");return r&&(s=V[r])?s.fields.map(e=>(0,t.jsx)(u.Form.Item,{label:e.label,name:e.name,rules:[{required:!0,message:`Please enter the ${e.label.toLowerCase()}`}],children:e.name.includes("client")?(0,t.jsx)(B.Input.Password,{}):(0,t.jsx)(c.TextInput,{placeholder:e.placeholder})},e.name)):null}}),(0,t.jsx)(u.Form.Item,{label:"Proxy Admin Email",name:"user_email",rules:[{required:!0,message:"Please enter the email of the proxy admin"}],children:(0,t.jsx)(c.TextInput,{})}),(0,t.jsx)(u.Form.Item,{label:"Proxy Base URL",name:"proxy_base_url",normalize:e=>e?.trim(),rules:[{required:!0,message:"Please enter the proxy base url"},{pattern:/^https?:\/\/.+/,message:"URL must start with http:// or https://"},{validator:(e,t)=>t&&/^https?:\/\/.+/.test(t)&&t.endsWith("/")?Promise.reject("URL must not end with a trailing slash"):Promise.resolve()}],children:(0,t.jsx)(c.TextInput,{placeholder:"https://example.com"})}),(0,t.jsx)(u.Form.Item,{noStyle:!0,shouldUpdate:(e,t)=>e.sso_provider!==t.sso_provider,children:({getFieldValue:e})=>{let s=e("sso_provider");return"okta"===s||"generic"===s?(0,t.jsx)(u.Form.Item,{label:"Use Role Mappings",name:"use_role_mappings",valuePropName:"checked",children:(0,t.jsx)(R.Checkbox,{})}):null}}),(0,t.jsx)(u.Form.Item,{noStyle:!0,shouldUpdate:(e,t)=>e.use_role_mappings!==t.use_role_mappings||e.sso_provider!==t.sso_provider,children:({getFieldValue:e})=>{let s=e("use_role_mappings"),r=e("sso_provider");return s&&("okta"===r||"generic"===r)?(0,t.jsx)(u.Form.Item,{label:"Group Claim",name:"group_claim",rules:[{required:!0,message:"Please enter the group claim"}],children:(0,t.jsx)(c.TextInput,{})}):null}}),(0,t.jsx)(u.Form.Item,{noStyle:!0,shouldUpdate:(e,t)=>e.use_role_mappings!==t.use_role_mappings||e.sso_provider!==t.sso_provider,children:({getFieldValue:e})=>{let s=e("use_role_mappings"),r=e("sso_provider");return s&&("okta"===r||"generic"===r)?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(u.Form.Item,{label:"Default Role",name:"default_role",initialValue:"Internal User",children:(0,t.jsxs)(D.Select,{children:[(0,t.jsx)(D.Select.Option,{value:"internal_user_viewer",children:"Internal Viewer"}),(0,t.jsx)(D.Select.Option,{value:"internal_user",children:"Internal User"}),(0,t.jsx)(D.Select.Option,{value:"proxy_admin_viewer",children:"Admin Viewer"}),(0,t.jsx)(D.Select.Option,{value:"proxy_admin",children:"Proxy Admin"})]})}),(0,t.jsx)(u.Form.Item,{label:"Proxy Admin Teams",name:"proxy_admin_teams",children:(0,t.jsx)(c.TextInput,{})}),(0,t.jsx)(u.Form.Item,{label:"Admin Viewer Teams",name:"admin_viewer_teams",children:(0,t.jsx)(c.TextInput,{})}),(0,t.jsx)(u.Form.Item,{label:"Internal User Teams",name:"internal_user_teams",children:(0,t.jsx)(c.TextInput,{})}),(0,t.jsx)(u.Form.Item,{label:"Internal Viewer Teams",name:"internal_viewer_teams",children:(0,t.jsx)(c.TextInput,{})})]}):null}}),(0,t.jsx)(u.Form.Item,{noStyle:!0,shouldUpdate:(e,t)=>e.sso_provider!==t.sso_provider,children:({getFieldValue:e})=>{let s=e("sso_provider");return"okta"===s||"generic"===s?(0,t.jsx)(u.Form.Item,{label:"Use Team Mappings",name:"use_team_mappings",valuePropName:"checked",children:(0,t.jsx)(R.Checkbox,{})}):null}}),(0,t.jsx)(u.Form.Item,{noStyle:!0,shouldUpdate:(e,t)=>e.use_team_mappings!==t.use_team_mappings||e.sso_provider!==t.sso_provider,children:({getFieldValue:e})=>{let s=e("use_team_mappings"),r=e("sso_provider");return s&&("okta"===r||"generic"===r)?(0,t.jsx)(u.Form.Item,{label:"Team IDs JWT Field",name:"team_ids_jwt_field",rules:[{required:!0,message:"Please enter the team IDs JWT field"}],children:(0,t.jsx)(c.TextInput,{})}):null}})]})});var H=e.i(954616);let q=()=>{let{accessToken:e}=(0,v.default)();return(0,H.useMutation)({mutationFn:async t=>{if(!e)throw Error("Access token is required");return await (0,m.updateSSOSettings)(e,t)}})},$=e=>{let{proxy_admin_teams:t,admin_viewer_teams:s,internal_user_teams:r,internal_viewer_teams:i,default_role:l,group_claim:a,use_role_mappings:n,use_team_mappings:o,team_ids_jwt_field:c,...d}=e,u={...d},m=d.sso_provider;if(n&&("okta"===m||"generic"===m)){let e=e=>e&&""!==e.trim()?e.split(",").map(e=>e.trim()).filter(e=>e.length>0):[];u.role_mappings={provider:"generic",group_claim:a,default_role:({internal_user_viewer:"internal_user_viewer",internal_user:"internal_user",proxy_admin_viewer:"proxy_admin_viewer",proxy_admin:"proxy_admin"})[l]||"internal_user",roles:{proxy_admin:e(t),proxy_admin_viewer:e(s),internal_user:e(r),internal_user_viewer:e(i)}}}return o&&("okta"===m||"generic"===m)&&(u.team_mappings={team_ids_jwt_field:c}),u},K=e=>e.google_client_id?"google":e.microsoft_client_id?"microsoft":e.generic_client_id?e.generic_authorization_endpoint?.includes("okta")||e.generic_authorization_endpoint?.includes("auth0")?"okta":"generic":null,W=({isVisible:e,onCancel:s,onSuccess:r})=>{let[i]=u.Form.useForm(),{mutateAsync:l,isPending:a}=q(),n=async e=>{let t=$(e);await l(t,{onSuccess:()=>{j.default.success("SSO settings added successfully"),r()},onError:e=>{j.default.fromBackend("Failed to save SSO settings: "+(0,y.parseErrorMessage)(e))}})},o=()=>{i.resetFields(),s()};return(0,t.jsx)(U.Modal,{title:"Add SSO",open:e,width:800,footer:(0,t.jsxs)(T.Space,{children:[(0,t.jsx)(N.Button,{onClick:o,disabled:a,children:"Cancel"}),(0,t.jsx)(N.Button,{loading:a,onClick:()=>i.submit(),children:a?"Adding...":"Add SSO"})]}),onCancel:o,children:(0,t.jsx)(G,{form:i,onFormSubmit:n})})};var Y=e.i(127952);let J=({isVisible:e,onCancel:s,onSuccess:r})=>{let{data:i}=k(),{mutateAsync:l,isPending:a}=q(),n=async()=>{await l({google_client_id:null,google_client_secret:null,microsoft_client_id:null,microsoft_client_secret:null,microsoft_tenant:null,generic_client_id:null,generic_client_secret:null,generic_authorization_endpoint:null,generic_token_endpoint:null,generic_userinfo_endpoint:null,proxy_base_url:null,user_email:null,sso_provider:null,role_mappings:null,team_mappings:null},{onSuccess:()=>{j.default.success("SSO settings cleared successfully"),s(),r()},onError:e=>{j.default.fromBackend("Failed to clear SSO settings: "+(0,y.parseErrorMessage)(e))}})};return(0,t.jsx)(Y.default,{isOpen:e,title:"Confirm Clear SSO Settings",alertMessage:"This action cannot be undone.",message:"Are you sure you want to clear all SSO settings? Users will no longer be able to login using SSO after this change.",resourceInformationTitle:"SSO Settings",resourceInformation:[{label:"Provider",value:i?.values&&K(i?.values)||"Generic"}],onCancel:s,onOk:n,confirmLoading:a})},Q=({isVisible:e,onCancel:r,onSuccess:i})=>{let[l]=u.Form.useForm(),a=k(),{mutateAsync:n,isPending:o}=q();(0,s.useEffect)(()=>{if(e&&a.data&&a.data.values){let e=a.data;console.log("Raw SSO data received:",e),console.log("SSO values:",e.values),console.log("user_email from API:",e.values.user_email);let t=null;e.values.google_client_id?t="google":e.values.microsoft_client_id?t="microsoft":e.values.generic_client_id&&(t=e.values.generic_authorization_endpoint?.includes("okta")||e.values.generic_authorization_endpoint?.includes("auth0")?"okta":"generic");let s={};if(e.values.role_mappings){let t=e.values.role_mappings,r=e=>e&&0!==e.length?e.join(", "):"";s={use_role_mappings:!0,group_claim:t.group_claim,default_role:t.default_role||"internal_user",proxy_admin_teams:r(t.roles?.proxy_admin),admin_viewer_teams:r(t.roles?.proxy_admin_viewer),internal_user_teams:r(t.roles?.internal_user),internal_viewer_teams:r(t.roles?.internal_user_viewer)}}let r={};e.values.team_mappings&&(r={use_team_mappings:!0,team_ids_jwt_field:e.values.team_mappings.team_ids_jwt_field});let i={sso_provider:t,...e.values,...s,...r};console.log("Setting form values:",i),l.resetFields(),setTimeout(()=>{l.setFieldsValue(i),console.log("Form values set, current form values:",l.getFieldsValue())},100)}},[e,a.data,l]);let c=async e=>{try{let t=$(e);await n(t,{onSuccess:()=>{j.default.success("SSO settings updated successfully"),i()},onError:e=>{j.default.fromBackend("Failed to save SSO settings: "+(0,y.parseErrorMessage)(e))}})}catch(e){j.default.fromBackend("Failed to process SSO settings: "+(0,y.parseErrorMessage)(e))}},d=()=>{l.resetFields(),r()};return(0,t.jsx)(U.Modal,{title:"Edit SSO Settings",open:e,width:800,footer:(0,t.jsxs)(T.Space,{children:[(0,t.jsx)(N.Button,{onClick:d,disabled:o,children:"Cancel"}),(0,t.jsx)(N.Button,{loading:o,onClick:()=>l.submit(),children:o?"Saving...":"Save"})]}),onCancel:d,children:(0,t.jsx)(G,{form:l,onFormSubmit:c})})};var Z=e.i(286536),X=e.i(77705);function ee({defaultHidden:e=!0,value:r}){let[i,l]=(0,s.useState)(e);return(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"font-mono text-gray-600 flex-1",children:r?i?"•".repeat(r.length):r:(0,t.jsx)("span",{className:"text-gray-400 italic",children:"Not configured"})}),r&&(0,t.jsx)(N.Button,{type:"text",size:"small",icon:i?(0,t.jsx)(Z.Eye,{className:"w-4 h-4"}):(0,t.jsx)(X.EyeOff,{className:"w-4 h-4"}),onClick:()=>l(!i),className:"text-gray-400 hover:text-gray-600"})]})}var et=e.i(312361),es=e.i(291542),er=e.i(761911);let{Title:ei,Text:el}=E.Typography;function ea({roleMappings:e}){if(!e)return null;let s=[{title:"Role",dataIndex:"role",key:"role",render:e=>(0,t.jsx)(el,{strong:!0,children:F[e]})},{title:"Mapped Groups",dataIndex:"groups",key:"groups",render:e=>(0,t.jsx)(t.Fragment,{children:e.length>0?e.map((e,s)=>(0,t.jsx)(O.Tag,{color:"blue",children:e},s)):(0,t.jsx)(el,{className:"text-gray-400 italic",children:"No groups mapped"})})}];return(0,t.jsxs)(C.Card,{children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)(er.Users,{className:"w-6 h-6 text-gray-400 mb-2"}),(0,t.jsx)(ei,{level:3,children:"Role Mappings"})]}),(0,t.jsxs)("div",{className:"space-y-8",children:[(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(ei,{level:5,children:"Group Claim"}),(0,t.jsx)("div",{children:(0,t.jsx)(el,{code:!0,children:e.group_claim})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(ei,{level:5,children:"Default Role"}),(0,t.jsx)("div",{children:(0,t.jsx)(el,{strong:!0,children:F[e.default_role]})})]})]}),(0,t.jsx)(et.Divider,{}),(0,t.jsx)(es.Table,{columns:s,dataSource:Object.entries(e.roles).map(([e,t])=>({role:e,groups:t})),pagination:!1,bordered:!0,size:"small",className:"w-full"})]})]})}var en=e.i(21548);let{Title:eo,Paragraph:ec}=E.Typography;function ed({onAdd:e}){return(0,t.jsx)("div",{className:"bg-white p-12 rounded-lg border border-dashed border-gray-300 text-center w-full",children:(0,t.jsx)(en.Empty,{image:en.Empty.PRESENTED_IMAGE_SIMPLE,description:(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(eo,{level:4,children:"No SSO Configuration Found"}),(0,t.jsx)(ec,{type:"secondary",className:"max-w-md mx-auto",children:"Configure Single Sign-On (SSO) to enable seamless authentication for your team members using your identity provider."})]}),children:(0,t.jsx)(N.Button,{type:"primary",size:"large",onClick:e,className:"flex items-center gap-2 mx-auto mt-4",children:"Configure SSO"})})})}var eu=e.i(981339);let{Title:em,Text:eg}=E.Typography;function ep(){return(0,t.jsx)(C.Card,{children:(0,t.jsxs)(T.Space,{direction:"vertical",size:"large",className:"w-full",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)(M.Shield,{className:"w-6 h-6 text-gray-400"}),(0,t.jsxs)("div",{children:[(0,t.jsx)(em,{level:3,children:"SSO Configuration"}),(0,t.jsx)(eg,{type:"secondary",children:"Manage Single Sign-On authentication settings"})]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)(eu.Skeleton.Button,{active:!0,size:"default",style:{width:170,height:32}}),(0,t.jsx)(eu.Skeleton.Button,{active:!0,size:"default",style:{width:190,height:32}})]})]}),(0,t.jsxs)(I.Descriptions,{bordered:!0,...{column:{xxl:1,xl:1,lg:1,md:1,sm:1,xs:1}},children:[(0,t.jsx)(I.Descriptions.Item,{label:(0,t.jsx)(eu.Skeleton.Node,{active:!0,style:{width:80,height:16}}),children:(0,t.jsx)("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:(0,t.jsx)(eu.Skeleton.Node,{active:!0,style:{width:100,height:16}})})}),(0,t.jsx)(I.Descriptions.Item,{label:(0,t.jsx)(eu.Skeleton.Node,{active:!0,style:{width:80,height:16}}),children:(0,t.jsx)(eu.Skeleton.Node,{active:!0,style:{width:200,height:16}})}),(0,t.jsx)(I.Descriptions.Item,{label:(0,t.jsx)(eu.Skeleton.Node,{active:!0,style:{width:80,height:16}}),children:(0,t.jsx)(eu.Skeleton.Node,{active:!0,style:{width:250,height:16}})}),(0,t.jsx)(I.Descriptions.Item,{label:(0,t.jsx)(eu.Skeleton.Node,{active:!0,style:{width:80,height:16}}),children:(0,t.jsx)(eu.Skeleton.Node,{active:!0,style:{width:180,height:16}})}),(0,t.jsx)(I.Descriptions.Item,{label:(0,t.jsx)(eu.Skeleton.Node,{active:!0,style:{width:80,height:16}}),children:(0,t.jsx)(eu.Skeleton.Node,{active:!0,style:{width:220,height:16}})})]})]})})}let{Title:eh,Text:ex}=E.Typography;function e_(){let{data:e,refetch:r,isLoading:i}=k(),[l,a]=(0,s.useState)(!1),[n,o]=(0,s.useState)(!1),[c,d]=(0,s.useState)(!1),u=!!e?.values.google_client_id||!!e?.values.microsoft_client_id||!!e?.values.generic_client_id,m=e?.values?K(e.values):null,g=!!e?.values.role_mappings,p=!!e?.values.team_mappings,h=e=>(0,t.jsx)(ex,{className:"font-mono text-gray-600 text-sm",copyable:!!e,children:e||"-"}),x=e=>e||(0,t.jsx)("span",{className:"text-gray-400 italic",children:"Not configured"}),_=e=>e.team_mappings?.team_ids_jwt_field?(0,t.jsx)(O.Tag,{children:e.team_mappings.team_ids_jwt_field}):(0,t.jsx)("span",{className:"text-gray-400 italic",children:"Not configured"}),f={column:{xxl:1,xl:1,lg:1,md:1,sm:1,xs:1}},y={google:{providerText:z.google,fields:[{label:"Client ID",render:e=>(0,t.jsx)(ee,{value:e.google_client_id})},{label:"Client Secret",render:e=>(0,t.jsx)(ee,{value:e.google_client_secret})},{label:"Proxy Base URL",render:e=>x(e.proxy_base_url)}]},microsoft:{providerText:z.microsoft,fields:[{label:"Client ID",render:e=>(0,t.jsx)(ee,{value:e.microsoft_client_id})},{label:"Client Secret",render:e=>(0,t.jsx)(ee,{value:e.microsoft_client_secret})},{label:"Tenant",render:e=>x(e.microsoft_tenant)},{label:"Proxy Base URL",render:e=>x(e.proxy_base_url)}]},okta:{providerText:z.okta,fields:[{label:"Client ID",render:e=>(0,t.jsx)(ee,{value:e.generic_client_id})},{label:"Client Secret",render:e=>(0,t.jsx)(ee,{value:e.generic_client_secret})},{label:"Authorization Endpoint",render:e=>h(e.generic_authorization_endpoint)},{label:"Token Endpoint",render:e=>h(e.generic_token_endpoint)},{label:"User Info Endpoint",render:e=>h(e.generic_userinfo_endpoint)},{label:"Proxy Base URL",render:e=>x(e.proxy_base_url)},p?{label:"Team IDs JWT Field",render:e=>_(e)}:null]},generic:{providerText:z.generic,fields:[{label:"Client ID",render:e=>(0,t.jsx)(ee,{value:e.generic_client_id})},{label:"Client Secret",render:e=>(0,t.jsx)(ee,{value:e.generic_client_secret})},{label:"Authorization Endpoint",render:e=>h(e.generic_authorization_endpoint)},{label:"Token Endpoint",render:e=>h(e.generic_token_endpoint)},{label:"User Info Endpoint",render:e=>h(e.generic_userinfo_endpoint)},{label:"Proxy Base URL",render:e=>x(e.proxy_base_url)},p?{label:"Team IDs JWT Field",render:e=>_(e)}:null]}};return(0,t.jsxs)(t.Fragment,{children:[i?(0,t.jsx)(ep,{}):(0,t.jsxs)(T.Space,{direction:"vertical",size:"large",className:"w-full",children:[(0,t.jsx)(C.Card,{children:(0,t.jsxs)(T.Space,{direction:"vertical",size:"large",className:"w-full",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)(M.Shield,{className:"w-6 h-6 text-gray-400"}),(0,t.jsxs)("div",{children:[(0,t.jsx)(eh,{level:3,children:"SSO Configuration"}),(0,t.jsx)(ex,{type:"secondary",children:"Manage Single Sign-On authentication settings"})]})]}),(0,t.jsx)("div",{className:"flex items-center gap-3",children:u&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(N.Button,{icon:(0,t.jsx)(L.Edit,{className:"w-4 h-4"}),onClick:()=>d(!0),children:"Edit SSO Settings"}),(0,t.jsx)(N.Button,{danger:!0,icon:(0,t.jsx)(A.Trash2,{className:"w-4 h-4"}),onClick:()=>a(!0),children:"Delete SSO Settings"})]})})]}),u?(()=>{if(!e?.values||!m)return null;let{values:s}=e,r=y[m];return r?(0,t.jsxs)(I.Descriptions,{bordered:!0,...f,children:[(0,t.jsx)(I.Descriptions.Item,{label:"Provider",children:(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[P[m]&&(0,t.jsx)("img",{src:P[m],alt:m,style:{height:24,width:24,objectFit:"contain"}}),(0,t.jsx)("span",{children:r.providerText})]})}),r.fields.map((e,r)=>e&&(0,t.jsx)(I.Descriptions.Item,{label:e.label,children:e.render(s)},r))]}):null})():(0,t.jsx)(ed,{onAdd:()=>o(!0)})]})}),g&&(0,t.jsx)(ea,{roleMappings:e?.values.role_mappings})]}),(0,t.jsx)(J,{isVisible:l,onCancel:()=>a(!1),onSuccess:()=>r()}),(0,t.jsx)(W,{isVisible:n,onCancel:()=>o(!1),onSuccess:()=>{o(!1),r()}}),(0,t.jsx)(Q,{isVisible:c,onCancel:()=>d(!1),onSuccess:()=>{d(!1),r()}})]})}e.s(["default",()=>e_],37329);var ef=e.i(912598);let ey=(0,S.createQueryKeys)("uiSettings");e.s(["useUpdateUISettings",0,e=>{let t=(0,ef.useQueryClient)();return(0,H.useMutation)({mutationFn:async t=>{if(!e)throw Error("Access token is required");return(0,m.updateUiSettings)(e,t)},onSuccess:()=>{t.invalidateQueries({queryKey:ey.all})}})}],100070)},105278,e=>{"use strict";var t=e.i(843476),s=e.i(135214),r=e.i(994388),i=e.i(366283),l=e.i(304967),a=e.i(269200),n=e.i(942232),o=e.i(977572),c=e.i(427612),d=e.i(64848),u=e.i(496020),m=e.i(560445),g=e.i(464571),p=e.i(808613),h=e.i(311451),x=e.i(212931),_=e.i(770914),f=e.i(653496),y=e.i(898586),j=e.i(271645),v=e.i(844444),b=e.i(700514),S=e.i(727749),w=e.i(764205),k=e.i(461451),N=e.i(37329),C=e.i(292639),I=e.i(100070),T=e.i(111672);let O={"api-keys":"Manage virtual keys for API access and authentication","llm-playground":"Interactive playground for testing LLM requests",models:"Configure and manage LLM models and endpoints",agents:"Create and manage AI agents","mcp-servers":"Configure Model Context Protocol servers",guardrails:"Set up content moderation and safety guardrails",policies:"Define access control and usage policies","search-tools":"Configure RAG search and retrieval tools","tool-policies":"Configure tool use policies and permissions","vector-stores":"Manage vector databases for embeddings",new_usage:"View usage analytics and metrics",logs:"Access request and response logs","guardrails-monitor":"Monitor guardrail performance and view logs",users:"Manage internal user accounts and permissions",teams:"Create and manage teams for access control",organizations:"Manage organizations and their members",projects:"Manage projects within teams","access-groups":"Manage access groups for role-based permissions",budgets:"Set and monitor spending budgets",api_ref:"Browse API documentation and endpoints","model-hub-table":"Explore available AI models and providers","learning-resources":"Access tutorials and documentation",caching:"Configure response caching settings","transform-request":"Set up request transformation rules","cost-tracking":"Track and analyze API costs","ui-theme":"Customize dashboard appearance","tag-management":"Organize resources with tags",prompts:"Manage and version prompt templates","claude-code-plugins":"Configure Claude Code plugins",usage:"View legacy usage dashboard","router-settings":"Configure routing and load balancing settings","logging-and-alerts":"Set up logging and alert configurations","admin-panel":"Access admin panel and settings"};var E=e.i(708347);let L=e=>!e||0===e.length||e.some(e=>E.internalUserRoles.includes(e));var M=e.i(536916),A=e.i(362024),P=e.i(262218);function z({enabledPagesInternalUsers:e,enabledPagesPropertyDescription:s,isUpdating:r,onUpdate:i}){let l=null!=e,a=(0,j.useMemo)(()=>{let e;return e=[],T.menuGroups.forEach(t=>{t.items.forEach(s=>{if(s.page&&"tools"!==s.page&&"experimental"!==s.page&&"settings"!==s.page&&L(s.roles)){let r="string"==typeof s.label?s.label:s.key;e.push({page:s.page,label:r,group:t.groupLabel,description:O[s.page]||"No description available"})}if(s.children){let r="string"==typeof s.label?s.label:s.key;s.children.forEach(s=>{if(L(s.roles)){let i="string"==typeof s.label?s.label:s.key;e.push({page:s.page,label:i,group:`${t.groupLabel} > ${r}`,description:O[s.page]||"No description available"})}})}})}),e},[]),n=(0,j.useMemo)(()=>{let e={};return a.forEach(t=>{e[t.group]||(e[t.group]=[]),e[t.group].push(t)}),e},[a]),[o,c]=(0,j.useState)(e||[]);return(0,j.useMemo)(()=>{e?c(e):c([])},[e]),(0,t.jsxs)(_.Space,{direction:"vertical",size:"middle",style:{width:"100%"},children:[(0,t.jsxs)(_.Space,{direction:"vertical",size:4,children:[(0,t.jsxs)(_.Space,{align:"center",children:[(0,t.jsx)(y.Typography.Text,{strong:!0,children:"Internal User Page Visibility"}),!l&&(0,t.jsx)(P.Tag,{color:"default",style:{marginLeft:"8px"},children:"Not set (all pages visible)"}),l&&(0,t.jsxs)(P.Tag,{color:"blue",style:{marginLeft:"8px"},children:[o.length," page",1!==o.length?"s":""," selected"]})]}),s&&(0,t.jsx)(y.Typography.Text,{type:"secondary",children:s}),(0,t.jsx)(y.Typography.Text,{type:"secondary",style:{fontSize:"12px",fontStyle:"italic"},children:"By default, all pages are visible to internal users. Select specific pages to restrict visibility."}),(0,t.jsx)(y.Typography.Text,{type:"secondary",style:{fontSize:"12px",color:"#8b5cf6"},children:"Note: Only pages accessible to internal user roles are shown here. Admin-only pages are excluded as they cannot be made visible to internal users regardless of this setting."})]}),(0,t.jsx)(A.Collapse,{items:[{key:"page-visibility",label:"Configure Page Visibility",children:(0,t.jsxs)(_.Space,{direction:"vertical",size:"middle",style:{width:"100%"},children:[(0,t.jsx)(M.Checkbox.Group,{value:o,onChange:c,style:{width:"100%"},children:(0,t.jsx)(_.Space,{direction:"vertical",size:"middle",style:{width:"100%"},children:Object.entries(n).map(([e,s])=>(0,t.jsxs)("div",{children:[(0,t.jsx)(y.Typography.Text,{strong:!0,style:{fontSize:"11px",color:"#6b7280",letterSpacing:"0.05em",display:"block",marginBottom:"8px"},children:e}),(0,t.jsx)(_.Space,{direction:"vertical",size:"small",style:{marginLeft:"16px",width:"100%"},children:s.map(e=>(0,t.jsx)("div",{style:{marginBottom:"4px"},children:(0,t.jsx)(M.Checkbox,{value:e.page,children:(0,t.jsxs)(_.Space,{direction:"vertical",size:0,children:[(0,t.jsx)(y.Typography.Text,{children:e.label}),(0,t.jsx)(y.Typography.Text,{type:"secondary",style:{fontSize:"12px"},children:e.description})]})})},e.page))})]},e))})}),(0,t.jsxs)(_.Space,{children:[(0,t.jsx)(g.Button,{type:"primary",onClick:()=>{i({enabled_ui_pages_internal_users:o.length>0?o:null})},loading:r,disabled:r,children:"Save Page Visibility Settings"}),l&&(0,t.jsx)(g.Button,{onClick:()=>{c([]),i({enabled_ui_pages_internal_users:null})},loading:r,disabled:r,children:"Reset to Default (All Pages)"})]})]})}]})]})}var F=e.i(175712),U=e.i(312361),R=e.i(981339),B=e.i(790848);function D(){let{accessToken:e}=(0,s.default)(),{data:r,isLoading:i,isError:l,error:a}=(0,C.useUISettings)(),{mutate:n,isPending:o,error:c}=(0,I.useUpdateUISettings)(e),d=r?.field_schema,u=d?.properties?.disable_model_add_for_internal_users,g=d?.properties?.disable_team_admin_delete_team_user,p=d?.properties?.require_auth_for_public_ai_hub,h=d?.properties?.forward_client_headers_to_llm_api,x=d?.properties?.enable_projects_ui,f=d?.properties?.enabled_ui_pages_internal_users,j=d?.properties?.disable_agents_for_internal_users,v=d?.properties?.allow_agents_for_team_admins,b=d?.properties?.disable_vector_stores_for_internal_users,w=d?.properties?.allow_vector_stores_for_team_admins,k=r?.values??{},N=!!k.disable_model_add_for_internal_users,T=!!k.disable_team_admin_delete_team_user,O=!!k.disable_agents_for_internal_users,E=!!k.disable_vector_stores_for_internal_users;return(0,t.jsx)(F.Card,{title:"UI Settings",children:i?(0,t.jsx)(R.Skeleton,{active:!0}):l?(0,t.jsx)(m.Alert,{type:"error",message:"Could not load UI settings",description:a instanceof Error?a.message:void 0}):(0,t.jsxs)(_.Space,{direction:"vertical",size:"large",style:{width:"100%"},children:[d?.description&&(0,t.jsx)(y.Typography.Paragraph,{style:{marginBottom:0},children:d.description}),c&&(0,t.jsx)(m.Alert,{type:"error",message:"Could not update UI settings",description:c instanceof Error?c.message:void 0}),(0,t.jsxs)(_.Space,{align:"start",size:"middle",children:[(0,t.jsx)(B.Switch,{checked:N,disabled:o,loading:o,onChange:e=>{n({disable_model_add_for_internal_users:e},{onSuccess:()=>{S.default.success("UI settings updated successfully")},onError:e=>{S.default.fromBackend(e)}})},"aria-label":u?.description??"Disable model add for internal users"}),(0,t.jsxs)(_.Space,{direction:"vertical",size:4,children:[(0,t.jsx)(y.Typography.Text,{strong:!0,children:"Disable model add for internal users"}),u?.description&&(0,t.jsx)(y.Typography.Text,{type:"secondary",children:u.description})]})]}),(0,t.jsxs)(_.Space,{align:"start",size:"middle",children:[(0,t.jsx)(B.Switch,{checked:T,disabled:o,loading:o,onChange:e=>{n({disable_team_admin_delete_team_user:e},{onSuccess:()=>{S.default.success("UI settings updated successfully")},onError:e=>{S.default.fromBackend(e)}})},"aria-label":g?.description??"Disable team admin delete team user"}),(0,t.jsxs)(_.Space,{direction:"vertical",size:4,children:[(0,t.jsx)(y.Typography.Text,{strong:!0,children:"Disable team admin delete team user"}),g?.description&&(0,t.jsx)(y.Typography.Text,{type:"secondary",children:g.description})]})]}),(0,t.jsxs)(_.Space,{align:"start",size:"middle",children:[(0,t.jsx)(B.Switch,{checked:k.require_auth_for_public_ai_hub,disabled:o,loading:o,onChange:e=>{n({require_auth_for_public_ai_hub:e},{onSuccess:()=>{S.default.success("UI settings updated successfully")},onError:e=>{S.default.fromBackend(e)}})},"aria-label":p?.description??"Require authentication for public AI Hub"}),(0,t.jsxs)(_.Space,{direction:"vertical",size:4,children:[(0,t.jsx)(y.Typography.Text,{strong:!0,children:"Require authentication for public AI Hub"}),p?.description&&(0,t.jsx)(y.Typography.Text,{type:"secondary",children:p.description})]})]}),(0,t.jsxs)(_.Space,{align:"start",size:"middle",children:[(0,t.jsx)(B.Switch,{checked:!!k.forward_client_headers_to_llm_api,disabled:o,loading:o,onChange:e=>{n({forward_client_headers_to_llm_api:e},{onSuccess:()=>{S.default.success("UI settings updated successfully")},onError:e=>{S.default.fromBackend(e)}})},"aria-label":h?.description??"Forward client headers to LLM API"}),(0,t.jsxs)(_.Space,{direction:"vertical",size:4,children:[(0,t.jsx)(y.Typography.Text,{strong:!0,children:"Forward client headers to LLM API"}),(0,t.jsx)(y.Typography.Text,{type:"secondary",children:h?.description??"If enabled, forwards client headers (e.g. Authorization) to the LLM API. Required for Claude Code with Max subscription."})]})]}),(0,t.jsxs)(_.Space,{align:"start",size:"middle",children:[(0,t.jsx)(B.Switch,{checked:!!k.enable_projects_ui,disabled:o,loading:o,onChange:e=>{n({enable_projects_ui:e},{onSuccess:()=>{S.default.success("UI settings updated successfully. Refreshing page..."),setTimeout(()=>window.location.reload(),1e3)},onError:e=>{S.default.fromBackend(e)}})},"aria-label":x?.description??"Enable Projects UI"}),(0,t.jsxs)(_.Space,{direction:"vertical",size:4,children:[(0,t.jsx)(y.Typography.Text,{strong:!0,children:"[BETA] Enable Projects (page will refresh)"}),(0,t.jsx)(y.Typography.Text,{type:"secondary",children:x?.description??"If enabled, shows the Projects feature in the UI sidebar and the project field in key management."})]})]}),(0,t.jsx)(U.Divider,{}),(0,t.jsxs)(_.Space,{align:"start",size:"middle",children:[(0,t.jsx)(B.Switch,{checked:O,disabled:o,loading:o,onChange:e=>{n({disable_agents_for_internal_users:e},{onSuccess:()=>{S.default.success("UI settings updated successfully")},onError:e=>{S.default.fromBackend(e)}})},"aria-label":j?.description??"Disable agents for internal users"}),(0,t.jsxs)(_.Space,{direction:"vertical",size:4,children:[(0,t.jsx)(y.Typography.Text,{strong:!0,children:"Disable agents for internal users"}),j?.description&&(0,t.jsx)(y.Typography.Text,{type:"secondary",children:j.description})]})]}),(0,t.jsxs)(_.Space,{align:"start",size:"middle",style:{marginLeft:32},children:[(0,t.jsx)(B.Switch,{checked:!!k.allow_agents_for_team_admins,disabled:o||!O,loading:o,onChange:e=>{n({allow_agents_for_team_admins:e},{onSuccess:()=>{S.default.success("UI settings updated successfully")},onError:e=>{S.default.fromBackend(e)}})},"aria-label":v?.description??"Allow agents for team admins"}),(0,t.jsxs)(_.Space,{direction:"vertical",size:4,children:[(0,t.jsx)(y.Typography.Text,{strong:!0,type:O?void 0:"secondary",children:"Allow agents for team admins"}),v?.description&&(0,t.jsx)(y.Typography.Text,{type:"secondary",children:v.description})]})]}),(0,t.jsx)(U.Divider,{}),(0,t.jsxs)(_.Space,{align:"start",size:"middle",children:[(0,t.jsx)(B.Switch,{checked:E,disabled:o,loading:o,onChange:e=>{n({disable_vector_stores_for_internal_users:e},{onSuccess:()=>{S.default.success("UI settings updated successfully")},onError:e=>{S.default.fromBackend(e)}})},"aria-label":b?.description??"Disable vector stores for internal users"}),(0,t.jsxs)(_.Space,{direction:"vertical",size:4,children:[(0,t.jsx)(y.Typography.Text,{strong:!0,children:"Disable vector stores for internal users"}),b?.description&&(0,t.jsx)(y.Typography.Text,{type:"secondary",children:b.description})]})]}),(0,t.jsxs)(_.Space,{align:"start",size:"middle",style:{marginLeft:32},children:[(0,t.jsx)(B.Switch,{checked:!!k.allow_vector_stores_for_team_admins,disabled:o||!E,loading:o,onChange:e=>{n({allow_vector_stores_for_team_admins:e},{onSuccess:()=>{S.default.success("UI settings updated successfully")},onError:e=>{S.default.fromBackend(e)}})},"aria-label":w?.description??"Allow vector stores for team admins"}),(0,t.jsxs)(_.Space,{direction:"vertical",size:4,children:[(0,t.jsx)(y.Typography.Text,{strong:!0,type:E?void 0:"secondary",children:"Allow vector stores for team admins"}),w?.description&&(0,t.jsx)(y.Typography.Text,{type:"secondary",children:w.description})]})]}),(0,t.jsx)(U.Divider,{}),(0,t.jsx)(z,{enabledPagesInternalUsers:k.enabled_ui_pages_internal_users,enabledPagesPropertyDescription:f?.description,isUpdating:o,onUpdate:e=>{n(e,{onSuccess:()=>{S.default.success("Page visibility settings updated successfully")},onError:e=>{S.default.fromBackend(e)}})}})]})})}var V=e.i(199133),G=e.i(599724),H=e.i(779241),q=e.i(190702);let $={google:"https://artificialanalysis.ai/img/logos/google_small.svg",microsoft:"https://upload.wikimedia.org/wikipedia/commons/a/a8/Microsoft_Azure_Logo.svg",okta:"https://www.okta.com/sites/default/files/Okta_Logo_BrightBlue_Medium.png",generic:""},K={google:{envVarMap:{google_client_id:"GOOGLE_CLIENT_ID",google_client_secret:"GOOGLE_CLIENT_SECRET"},fields:[{label:"Google Client ID",name:"google_client_id"},{label:"Google Client Secret",name:"google_client_secret"}]},microsoft:{envVarMap:{microsoft_client_id:"MICROSOFT_CLIENT_ID",microsoft_client_secret:"MICROSOFT_CLIENT_SECRET",microsoft_tenant:"MICROSOFT_TENANT"},fields:[{label:"Microsoft Client ID",name:"microsoft_client_id"},{label:"Microsoft Client Secret",name:"microsoft_client_secret"},{label:"Microsoft Tenant",name:"microsoft_tenant"}]},okta:{envVarMap:{generic_client_id:"GENERIC_CLIENT_ID",generic_client_secret:"GENERIC_CLIENT_SECRET",generic_authorization_endpoint:"GENERIC_AUTHORIZATION_ENDPOINT",generic_token_endpoint:"GENERIC_TOKEN_ENDPOINT",generic_userinfo_endpoint:"GENERIC_USERINFO_ENDPOINT"},fields:[{label:"Generic Client ID",name:"generic_client_id"},{label:"Generic Client Secret",name:"generic_client_secret"},{label:"Authorization Endpoint",name:"generic_authorization_endpoint",placeholder:"https://your-domain/authorize"},{label:"Token Endpoint",name:"generic_token_endpoint",placeholder:"https://your-domain/token"},{label:"Userinfo Endpoint",name:"generic_userinfo_endpoint",placeholder:"https://your-domain/userinfo"}]},generic:{envVarMap:{generic_client_id:"GENERIC_CLIENT_ID",generic_client_secret:"GENERIC_CLIENT_SECRET",generic_authorization_endpoint:"GENERIC_AUTHORIZATION_ENDPOINT",generic_token_endpoint:"GENERIC_TOKEN_ENDPOINT",generic_userinfo_endpoint:"GENERIC_USERINFO_ENDPOINT"},fields:[{label:"Generic Client ID",name:"generic_client_id"},{label:"Generic Client Secret",name:"generic_client_secret"},{label:"Authorization Endpoint",name:"generic_authorization_endpoint"},{label:"Token Endpoint",name:"generic_token_endpoint"},{label:"Userinfo Endpoint",name:"generic_userinfo_endpoint"}]}},W=({isAddSSOModalVisible:e,isInstructionsModalVisible:s,handleAddSSOOk:r,handleAddSSOCancel:i,handleShowInstructions:l,handleInstructionsOk:a,handleInstructionsCancel:n,form:o,accessToken:c,ssoConfigured:d=!1})=>{let[u,m]=(0,j.useState)(!1);(0,j.useEffect)(()=>{(async()=>{if(e&&c)try{let e=await (0,w.getSSOSettings)(c);if(console.log("Raw SSO data received:",e),e&&e.values){console.log("SSO values:",e.values),console.log("user_email from API:",e.values.user_email);let t=null;e.values.google_client_id?t="google":e.values.microsoft_client_id?t="microsoft":e.values.generic_client_id&&(t=e.values.generic_authorization_endpoint?.includes("okta")||e.values.generic_authorization_endpoint?.includes("auth0")?"okta":"generic");let s={};if(e.values.role_mappings){let t=e.values.role_mappings,r=e=>e&&0!==e.length?e.join(", "):"";s={use_role_mappings:!0,group_claim:t.group_claim,default_role:t.default_role||"internal_user",proxy_admin_teams:r(t.roles?.proxy_admin),admin_viewer_teams:r(t.roles?.proxy_admin_viewer),internal_user_teams:r(t.roles?.internal_user),internal_viewer_teams:r(t.roles?.internal_user_viewer)}}let r={sso_provider:t,proxy_base_url:e.values.proxy_base_url,user_email:e.values.user_email,...e.values,...s};console.log("Setting form values:",r),o.resetFields(),setTimeout(()=>{o.setFieldsValue(r),console.log("Form values set, current form values:",o.getFieldsValue())},100)}}catch(e){console.error("Failed to load SSO settings:",e)}})()},[e,c,o]);let _=async e=>{if(!c)return void S.default.fromBackend("No access token available");try{let{proxy_admin_teams:t,admin_viewer_teams:s,internal_user_teams:r,internal_viewer_teams:i,default_role:a,group_claim:n,use_role_mappings:o,...d}=e,u={...d};if(o){let e=e=>e&&""!==e.trim()?e.split(",").map(e=>e.trim()).filter(e=>e.length>0):[];u.role_mappings={provider:"generic",group_claim:n,default_role:({internal_user_viewer:"internal_user_viewer",internal_user:"internal_user",proxy_admin_viewer:"proxy_admin_viewer",proxy_admin:"proxy_admin"})[a]||"internal_user",roles:{proxy_admin:e(t),proxy_admin_viewer:e(s),internal_user:e(r),internal_user_viewer:e(i)}}}await (0,w.updateSSOSettings)(c,u),l(e)}catch(e){S.default.fromBackend("Failed to save SSO settings: "+(0,q.parseErrorMessage)(e))}},f=async()=>{if(!c)return void S.default.fromBackend("No access token available");try{await (0,w.updateSSOSettings)(c,{google_client_id:null,google_client_secret:null,microsoft_client_id:null,microsoft_client_secret:null,microsoft_tenant:null,generic_client_id:null,generic_client_secret:null,generic_authorization_endpoint:null,generic_token_endpoint:null,generic_userinfo_endpoint:null,proxy_base_url:null,user_email:null,sso_provider:null,role_mappings:null}),o.resetFields(),m(!1),r(),S.default.success("SSO settings cleared successfully")}catch(e){console.error("Failed to clear SSO settings:",e),S.default.fromBackend("Failed to clear SSO settings")}};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(x.Modal,{title:d?"Edit SSO Settings":"Add SSO",open:e,width:800,footer:null,onOk:r,onCancel:i,children:(0,t.jsxs)(p.Form,{form:o,onFinish:_,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(p.Form.Item,{label:"SSO Provider",name:"sso_provider",rules:[{required:!0,message:"Please select an SSO provider"}],children:(0,t.jsx)(V.Select,{children:Object.entries($).map(([e,s])=>(0,t.jsx)(V.Select.Option,{value:e,children:(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",padding:"4px 0"},children:[s&&(0,t.jsx)("img",{src:s,alt:e,style:{height:24,width:24,marginRight:12,objectFit:"contain"}}),(0,t.jsxs)("span",{children:["okta"===e.toLowerCase()?"Okta / Auth0":e.charAt(0).toUpperCase()+e.slice(1)," ","SSO"]})]})},e))})}),(0,t.jsx)(p.Form.Item,{noStyle:!0,shouldUpdate:(e,t)=>e.sso_provider!==t.sso_provider,children:({getFieldValue:e})=>{let s,r=e("sso_provider");return r&&(s=K[r])?s.fields.map(e=>(0,t.jsx)(p.Form.Item,{label:e.label,name:e.name,rules:[{required:!0,message:`Please enter the ${e.label.toLowerCase()}`}],children:e.name.includes("client")?(0,t.jsx)(h.Input.Password,{}):(0,t.jsx)(H.TextInput,{placeholder:e.placeholder})},e.name)):null}}),(0,t.jsx)(p.Form.Item,{label:"Proxy Admin Email",name:"user_email",rules:[{required:!0,message:"Please enter the email of the proxy admin"}],children:(0,t.jsx)(H.TextInput,{})}),(0,t.jsx)(p.Form.Item,{label:"Proxy Base URL",name:"proxy_base_url",normalize:e=>e?.trim(),rules:[{required:!0,message:"Please enter the proxy base url"},{pattern:/^https?:\/\/.+/,message:"URL must start with http:// or https://"},{validator:(e,t)=>t&&/^https?:\/\/.+/.test(t)&&t.endsWith("/")?Promise.reject("URL must not end with a trailing slash"):Promise.resolve()}],children:(0,t.jsx)(H.TextInput,{placeholder:"https://example.com"})}),(0,t.jsx)(p.Form.Item,{noStyle:!0,shouldUpdate:(e,t)=>e.sso_provider!==t.sso_provider,children:({getFieldValue:e})=>{let s=e("sso_provider");return"okta"===s||"generic"===s?(0,t.jsx)(p.Form.Item,{label:"Use Role Mappings",name:"use_role_mappings",valuePropName:"checked",children:(0,t.jsx)(M.Checkbox,{})}):null}}),(0,t.jsx)(p.Form.Item,{noStyle:!0,shouldUpdate:(e,t)=>e.use_role_mappings!==t.use_role_mappings,children:({getFieldValue:e})=>e("use_role_mappings")?(0,t.jsx)(p.Form.Item,{label:"Group Claim",name:"group_claim",rules:[{required:!0,message:"Please enter the group claim"}],children:(0,t.jsx)(H.TextInput,{})}):null}),(0,t.jsx)(p.Form.Item,{noStyle:!0,shouldUpdate:(e,t)=>e.use_role_mappings!==t.use_role_mappings,children:({getFieldValue:e})=>e("use_role_mappings")?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(p.Form.Item,{label:"Default Role",name:"default_role",initialValue:"Internal User",children:(0,t.jsxs)(V.Select,{children:[(0,t.jsx)(V.Select.Option,{value:"internal_user_viewer",children:"Internal Viewer"}),(0,t.jsx)(V.Select.Option,{value:"internal_user",children:"Internal User"}),(0,t.jsx)(V.Select.Option,{value:"proxy_admin_viewer",children:"Admin Viewer"}),(0,t.jsx)(V.Select.Option,{value:"proxy_admin",children:"Proxy Admin"})]})}),(0,t.jsx)(p.Form.Item,{label:"Proxy Admin Teams",name:"proxy_admin_teams",children:(0,t.jsx)(H.TextInput,{})}),(0,t.jsx)(p.Form.Item,{label:"Admin Viewer Teams",name:"admin_viewer_teams",children:(0,t.jsx)(H.TextInput,{})}),(0,t.jsx)(p.Form.Item,{label:"Internal User Teams",name:"internal_user_teams",children:(0,t.jsx)(H.TextInput,{})}),(0,t.jsx)(p.Form.Item,{label:"Internal Viewer Teams",name:"internal_viewer_teams",children:(0,t.jsx)(H.TextInput,{})})]}):null})]}),(0,t.jsxs)("div",{style:{textAlign:"right",marginTop:"10px",display:"flex",justifyContent:"flex-end",alignItems:"center",gap:"8px"},children:[d&&(0,t.jsx)(g.Button,{onClick:()=>m(!0),style:{backgroundColor:"#6366f1",borderColor:"#6366f1",color:"white"},onMouseEnter:e=>{e.currentTarget.style.backgroundColor="#5558eb",e.currentTarget.style.borderColor="#5558eb"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="#6366f1",e.currentTarget.style.borderColor="#6366f1"},children:"Clear"}),(0,t.jsx)(g.Button,{htmlType:"submit",children:"Save"})]})]})}),(0,t.jsxs)(x.Modal,{title:"Confirm Clear SSO Settings",open:u,onOk:f,onCancel:()=>m(!1),okText:"Yes, Clear",cancelText:"Cancel",okButtonProps:{danger:!0,style:{backgroundColor:"#dc2626",borderColor:"#dc2626"}},children:[(0,t.jsx)("p",{children:"Are you sure you want to clear all SSO settings? This action cannot be undone."}),(0,t.jsx)("p",{children:"Users will no longer be able to login using SSO after this change."})]}),(0,t.jsxs)(x.Modal,{title:"SSO Setup Instructions",open:s,width:800,footer:null,onOk:a,onCancel:n,children:[(0,t.jsx)("p",{children:"Follow these steps to complete the SSO setup:"}),(0,t.jsx)(G.Text,{className:"mt-2",children:"1. DO NOT Exit this TAB"}),(0,t.jsx)(G.Text,{className:"mt-2",children:"2. Open a new tab, visit your proxy base url"}),(0,t.jsx)(G.Text,{className:"mt-2",children:"3. Confirm your SSO is configured correctly and you can login on the new Tab"}),(0,t.jsx)(G.Text,{className:"mt-2",children:"4. If Step 3 is successful, you can close this tab"}),(0,t.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,t.jsx)(g.Button,{onClick:a,children:"Done"})})]})]})},Y=({accessToken:e,onSuccess:s})=>{let[r]=p.Form.useForm(),[i,l]=(0,j.useState)(!1);(0,j.useEffect)(()=>{(async()=>{if(e)try{let t=await (0,w.getSSOSettings)(e);if(t&&t.values){let e=t.values.ui_access_mode,s={};e&&"object"==typeof e?s={ui_access_mode_type:e.type,restricted_sso_group:e.restricted_sso_group,sso_group_jwt_field:e.sso_group_jwt_field}:"string"==typeof e&&(s={ui_access_mode_type:e,restricted_sso_group:t.values.restricted_sso_group,sso_group_jwt_field:t.values.team_ids_jwt_field||t.values.sso_group_jwt_field}),r.setFieldsValue(s)}}catch(e){console.error("Failed to load UI access settings:",e)}})()},[e,r]);let a=async t=>{if(!e)return void S.default.fromBackend("No access token available");l(!0);try{let r;r="all_authenticated_users"===t.ui_access_mode_type?{ui_access_mode:"none"}:{ui_access_mode:{type:t.ui_access_mode_type,restricted_sso_group:t.restricted_sso_group,sso_group_jwt_field:t.sso_group_jwt_field}},await (0,w.updateSSOSettings)(e,r),s()}catch(e){console.error("Failed to save UI access settings:",e),S.default.fromBackend("Failed to save UI access settings")}finally{l(!1)}};return(0,t.jsxs)("div",{style:{padding:"16px"},children:[(0,t.jsx)("div",{style:{marginBottom:"16px"},children:(0,t.jsx)(G.Text,{style:{fontSize:"14px",color:"#6b7280"},children:"Configure who can access the UI interface and how group information is extracted from JWT tokens."})}),(0,t.jsxs)(p.Form,{form:r,onFinish:a,layout:"vertical",children:[(0,t.jsx)(p.Form.Item,{label:"UI Access Mode",name:"ui_access_mode_type",tooltip:"Controls who can access the UI interface",children:(0,t.jsxs)(V.Select,{placeholder:"Select access mode",children:[(0,t.jsx)(V.Select.Option,{value:"all_authenticated_users",children:"All Authenticated Users"}),(0,t.jsx)(V.Select.Option,{value:"restricted_sso_group",children:"Restricted SSO Group"})]})}),(0,t.jsx)(p.Form.Item,{noStyle:!0,shouldUpdate:(e,t)=>e.ui_access_mode_type!==t.ui_access_mode_type,children:({getFieldValue:e})=>"restricted_sso_group"===e("ui_access_mode_type")?(0,t.jsx)(p.Form.Item,{label:"Restricted SSO Group",name:"restricted_sso_group",rules:[{required:!0,message:"Please enter the restricted SSO group"}],children:(0,t.jsx)(H.TextInput,{placeholder:"ui-access-group"})}):null}),(0,t.jsx)(p.Form.Item,{label:"SSO Group JWT Field",name:"sso_group_jwt_field",tooltip:"JWT field name that contains team/group information. Use dot notation to access nested fields.",children:(0,t.jsx)(H.TextInput,{placeholder:"groups"})}),(0,t.jsx)("div",{style:{textAlign:"right",marginTop:"16px"},children:(0,t.jsx)(g.Button,{type:"primary",htmlType:"submit",loading:i,style:{backgroundColor:"#6366f1",borderColor:"#6366f1"},children:"Update UI Access Control"})})]})]})},{Title:J,Paragraph:Q,Text:Z}=y.Typography;e.s(["default",0,({proxySettings:e})=>{let{premiumUser:y,accessToken:C,userId:I}=(0,s.default)(),[T]=p.Form.useForm(),[O,E]=(0,j.useState)(!1),[L,M]=(0,j.useState)(!1),[A,P]=(0,j.useState)(!1),[z,F]=(0,j.useState)(!1),[U,R]=(0,j.useState)(!1),[B,V]=(0,j.useState)(!1),[G,H]=(0,j.useState)([]),[q,$]=(0,j.useState)(null),[K,X]=(0,j.useState)(!1),ee=(0,b.useBaseUrl)(),et="All IP Addresses Allowed",es=ee;es+="/fallback/login";let er=async()=>{if(C)try{let e=await (0,w.getSSOSettings)(C);if(e&&e.values){let t=e.values.google_client_id&&e.values.google_client_secret,s=e.values.microsoft_client_id&&e.values.microsoft_client_secret,r=e.values.generic_client_id&&e.values.generic_client_secret;X(t||s||r)}else X(!1)}catch(e){console.error("Error checking SSO configuration:",e),X(!1)}},ei=async()=>{try{if(!0!==y)return void S.default.fromBackend("This feature is only available for premium users. Please upgrade your account.");if(C){let e=await (0,w.getAllowedIPs)(C);H(e&&e.length>0?e:[et])}else H([et])}catch(e){console.error("Error fetching allowed IPs:",e),S.default.fromBackend(`Failed to fetch allowed IPs ${e}`),H([et])}finally{!0===y&&P(!0)}},el=async e=>{try{if(C){await (0,w.addAllowedIP)(C,e.ip);let t=await (0,w.getAllowedIPs)(C);H(t),S.default.success("IP address added successfully")}}catch(e){console.error("Error adding IP:",e),S.default.fromBackend(`Failed to add IP address ${e}`)}finally{F(!1)}},ea=async e=>{$(e),R(!0)},en=async()=>{if(q&&C)try{await (0,w.deleteAllowedIP)(C,q);let e=await (0,w.getAllowedIPs)(C);H(e.length>0?e:[et]),S.default.success("IP address deleted successfully")}catch(e){console.error("Error deleting IP:",e),S.default.fromBackend(`Failed to delete IP address ${e}`)}finally{R(!1),$(null)}};(0,j.useEffect)(()=>{er()},[C,y,er]);let eo=()=>{V(!1)},ec=[{key:"sso-settings",label:"SSO Settings",children:(0,t.jsx)(N.default,{})},{key:"security-settings",label:"Security Settings",children:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(l.Card,{children:[(0,t.jsx)(J,{level:4,children:" ✨ Security Settings"}),(0,t.jsx)(m.Alert,{message:"SSO Configuration Deprecated",description:"Editing SSO Settings on this page is deprecated and will be removed in a future version. Please use the SSO Settings tab for SSO configuration.",type:"warning",showIcon:!0}),(0,t.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:"1rem",marginTop:"1rem",marginLeft:"0.5rem"},children:[(0,t.jsx)("div",{children:(0,t.jsx)(r.Button,{style:{width:"150px"},onClick:()=>E(!0),children:K?"Edit SSO Settings":"Add SSO"})}),(0,t.jsx)("div",{children:(0,t.jsx)(r.Button,{style:{width:"150px"},onClick:ei,children:"Allowed IPs"})}),(0,t.jsx)("div",{children:(0,t.jsx)(r.Button,{style:{width:"150px"},onClick:()=>!0===y?V(!0):S.default.fromBackend("Only premium users can configure UI access control"),children:"UI Access Control"})})]})]}),(0,t.jsxs)("div",{className:"flex justify-start mb-4",children:[(0,t.jsx)(W,{isAddSSOModalVisible:O,isInstructionsModalVisible:L,handleAddSSOOk:()=>{E(!1),T.resetFields(),C&&y&&er()},handleAddSSOCancel:()=>{E(!1),T.resetFields()},handleShowInstructions:e=>{E(!1),M(!0)},handleInstructionsOk:()=>{M(!1),C&&y&&er()},handleInstructionsCancel:()=>{M(!1),C&&y&&er()},form:T,accessToken:C,ssoConfigured:K}),(0,t.jsx)(x.Modal,{title:"Manage Allowed IP Addresses",width:800,open:A,onCancel:()=>P(!1),footer:[(0,t.jsx)(r.Button,{className:"mx-1",onClick:()=>F(!0),children:"Add IP Address"},"add"),(0,t.jsx)(r.Button,{onClick:()=>P(!1),children:"Close"},"close")],children:(0,t.jsxs)(a.Table,{children:[(0,t.jsx)(c.TableHead,{children:(0,t.jsxs)(u.TableRow,{children:[(0,t.jsx)(d.TableHeaderCell,{children:"IP Address"}),(0,t.jsx)(d.TableHeaderCell,{className:"text-right",children:"Action"})]})}),(0,t.jsx)(n.TableBody,{children:G.map((e,s)=>(0,t.jsxs)(u.TableRow,{children:[(0,t.jsx)(o.TableCell,{children:e}),(0,t.jsx)(o.TableCell,{className:"text-right",children:e!==et&&(0,t.jsx)(r.Button,{onClick:()=>ea(e),color:"red",size:"xs",children:"Delete"})})]},s))})]})}),(0,t.jsx)(x.Modal,{title:"Add Allowed IP Address",open:z,onCancel:()=>F(!1),footer:null,children:(0,t.jsxs)(p.Form,{onFinish:el,children:[(0,t.jsx)(p.Form.Item,{name:"ip",rules:[{required:!0,message:"Please enter an IP address"}],children:(0,t.jsx)(h.Input,{placeholder:"Enter IP address"})}),(0,t.jsx)(p.Form.Item,{children:(0,t.jsx)(g.Button,{htmlType:"submit",children:"Add IP Address"})})]})}),(0,t.jsx)(x.Modal,{title:"Confirm Delete",open:U,onCancel:()=>R(!1),onOk:en,footer:[(0,t.jsx)(r.Button,{className:"mx-1",onClick:()=>en(),children:"Yes"},"delete"),(0,t.jsx)(r.Button,{onClick:()=>R(!1),children:"Close"},"close")],children:(0,t.jsxs)(Z,{children:["Are you sure you want to delete the IP address: ",q,"?"]})}),(0,t.jsx)(x.Modal,{title:"UI Access Control Settings",open:B,width:600,footer:null,onOk:eo,onCancel:()=>{V(!1)},children:(0,t.jsx)(Y,{accessToken:C,onSuccess:()=>{eo(),S.default.success("UI Access Control settings updated successfully")}})})]}),(0,t.jsxs)(i.Callout,{title:"Login without SSO",color:"teal",children:["If you need to login without sso, you can access"," ",(0,t.jsxs)("a",{href:es,target:"_blank",rel:"noopener noreferrer",children:[(0,t.jsx)("b",{children:es})," "]})]})]})},{key:"scim",label:"SCIM",children:(0,t.jsx)(k.default,{accessToken:C,userID:I,proxySettings:e})},{key:"ui-settings",label:(0,t.jsx)(_.Space,{children:(0,t.jsxs)(Z,{children:["UI Settings ",(0,t.jsx)(v.default,{})]})}),children:(0,t.jsx)(D,{})}];return(0,t.jsxs)("div",{className:"w-full m-2 mt-2 p-8",children:[(0,t.jsx)(J,{level:4,children:"Admin Access "}),(0,t.jsx)(Q,{children:"Go to 'Internal Users' page to add other admins."}),(0,t.jsx)(f.Tabs,{items:ec})]})}],105278)}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/10a902acb31b2e0d.js b/litellm/proxy/_experimental/out/_next/static/chunks/10a902acb31b2e0d.js deleted file mode 100644 index d3d34f99a65..00000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/10a902acb31b2e0d.js +++ /dev/null @@ -1 +0,0 @@ -(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,964306,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z"}))});e.s(["XCircleIcon",0,r],964306)},860585,e=>{"use strict";var t=e.i(843476),r=e.i(199133);let{Option:s}=r.Select;e.s(["default",0,({value:e,onChange:i,className:n="",style:a={}})=>(0,t.jsxs)(r.Select,{style:{width:"100%",...a},value:e||void 0,onChange:i,className:n,placeholder:"n/a",allowClear:!0,children:[(0,t.jsx)(s,{value:"24h",children:"daily"}),(0,t.jsx)(s,{value:"7d",children:"weekly"}),(0,t.jsx)(s,{value:"30d",children:"monthly"})]}),"getBudgetDurationLabel",0,e=>e?({"24h":"daily","7d":"weekly","30d":"monthly"})[e]||e:"Not set"])},743151,(e,t,r)=>{"use strict";function s(e){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(r,"__esModule",{value:!0}),r.CopyToClipboard=void 0;var i=l(e.r(271645)),n=l(e.r(844343)),a=["text","onCopy","options","children"];function l(e){return e&&e.__esModule?e:{default:e}}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,s)}return r}function d(e){for(var t=1;t=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(s=0;s=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}(e,a),s=i.default.Children.only(t);return i.default.cloneElement(s,d(d({},r),{},{onClick:this.onClick}))}}],function(e,t){for(var r=0;r{"use strict";var s=e.r(743151).CopyToClipboard;s.CopyToClipboard=s,t.exports=s},737434,e=>{"use strict";var t=e.i(184163);e.s(["DownloadOutlined",()=>t.default])},59935,(e,t,r)=>{var s;let i;e.e,s=function e(){var t,r="u">typeof self?self:"u">typeof window?window:void 0!==r?r:{},s=!r.document&&!!r.postMessage,i=r.IS_PAPA_WORKER||!1,n={},a=0,l={};function o(e){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},(function(e){var t=b(e);t.chunkSize=parseInt(t.chunkSize),e.step||e.chunk||(t.chunkSize=null),this._handle=new m(t),(this._handle.streamer=this)._config=t}).call(this,e),this.parseChunk=function(e,t){var s=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0=this._config.preview,i)r.postMessage({results:n,workerId:l.WORKER_ID,finished:s});else if(v(this._config.chunk)&&!t){if(this._config.chunk(n,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);this._completeResults=n=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(n.data),this._completeResults.errors=this._completeResults.errors.concat(n.errors),this._completeResults.meta=n.meta),this._completed||!s||!v(this._config.complete)||n&&n.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),s||n&&n.meta.paused||this._nextChunk(),n}this._halted=!0},this._sendError=function(e){v(this._config.error)?this._config.error(e):i&&this._config.error&&r.postMessage({workerId:l.WORKER_ID,error:e,finished:!1})}}function d(e){var t;(e=e||{}).chunkSize||(e.chunkSize=l.RemoteChunkSize),o.call(this,e),this._nextChunk=s?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(e){this._input=e,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(t=new XMLHttpRequest,this._config.withCredentials&&(t.withCredentials=this._config.withCredentials),s||(t.onload=_(this._chunkLoaded,this),t.onerror=_(this._chunkError,this)),t.open(this._config.downloadRequestBody?"POST":"GET",this._input,!s),this._config.downloadRequestHeaders){var e,r,i=this._config.downloadRequestHeaders;for(r in i)t.setRequestHeader(r,i[r])}this._config.chunkSize&&(e=this._start+this._config.chunkSize-1,t.setRequestHeader("Range","bytes="+this._start+"-"+e));try{t.send(this._config.downloadRequestBody)}catch(e){this._chunkError(e.message)}s&&0===t.status&&this._chunkError()}},this._chunkLoaded=function(){let e;4===t.readyState&&(t.status<200||400<=t.status?this._chunkError():(this._start+=this._config.chunkSize||t.responseText.length,this._finished=!this._config.chunkSize||this._start>=(null!==(e=(e=t).getResponseHeader("Content-Range"))?parseInt(e.substring(e.lastIndexOf("/")+1)):-1),this.parseChunk(t.responseText)))},this._chunkError=function(e){e=t.statusText||e,this._sendError(Error(e))}}function c(e){(e=e||{}).chunkSize||(e.chunkSize=l.LocalChunkSize),o.call(this,e);var t,r,s="u">typeof FileReader;this.stream=function(e){this._input=e,r=e.slice||e.webkitSlice||e.mozSlice,s?((t=new FileReader).onload=_(this._chunkLoaded,this),t.onerror=_(this._chunkError,this)):t=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount=this._input.size,this.parseChunk(e.target.result)},this._chunkError=function(){this._sendError(t.error)}}function u(e){var t;o.call(this,e=e||{}),this.stream=function(e){return t=e,this._nextChunk()},this._nextChunk=function(){var e,r;if(!this._finished)return t=(e=this._config.chunkSize)?(r=t.substring(0,e),t.substring(e)):(r=t,""),this._finished=!t,this.parseChunk(r)}}function h(e){o.call(this,e=e||{});var t=[],r=!0,s=!1;this.pause=function(){o.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){o.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(e){this._input=e,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){s&&1===t.length&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),t.length?this.parseChunk(t.shift()):r=!0},this._streamData=_(function(e){try{t.push("string"==typeof e?e:e.toString(this._config.encoding)),r&&(r=!1,this._checkIsFinished(),this.parseChunk(t.shift()))}catch(e){this._streamError(e)}},this),this._streamError=_(function(e){this._streamCleanUp(),this._sendError(e)},this),this._streamEnd=_(function(){this._streamCleanUp(),s=!0,this._streamData("")},this),this._streamCleanUp=_(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function m(e){var t,r,s,i,n=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,a=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,o=this,d=0,c=0,u=!1,h=!1,m=[],x={data:[],errors:[],meta:{}};function g(t){return"greedy"===e.skipEmptyLines?""===t.join("").trim():1===t.length&&0===t[0].length}function y(){if(x&&s&&(j("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+l.DefaultDelimiter+"'"),s=!1),e.skipEmptyLines&&(x.data=x.data.filter(function(e){return!g(e)})),_()){if(x)if(Array.isArray(x.data[0])){for(var t,r=0;_()&&r(e.dynamicTypingFunction&&void 0===e.dynamicTyping[t]&&(e.dynamicTyping[t]=e.dynamicTypingFunction(t)),!0===(e.dynamicTyping[t]||e.dynamicTyping))?"true"===r||"TRUE"===r||"false"!==r&&"FALSE"!==r&&((e=>{if(n.test(e)&&-0x20000000000000<(e=parseFloat(e))&&e<0x20000000000000)return 1})(r)?parseFloat(r):a.test(r)?new Date(r):""===r?null:r):r)(l=e.header?i>=m.length?"__parsed_extra":m[i]:l,o=e.transform?e.transform(o,l):o);"__parsed_extra"===l?(s[l]=s[l]||[],s[l].push(o)):s[l]=o}return e.header&&(i>m.length?j("FieldMismatch","TooManyFields","Too many fields: expected "+m.length+" fields but parsed "+i,c+r):ie.preview?r.abort():(x.data=x.data[0],i(x,o))))}),this.parse=function(i,n,a){var o=e.quoteChar||'"',o=(e.newline||(e.newline=this.guessLineEndings(i,o)),s=!1,e.delimiter?v(e.delimiter)&&(e.delimiter=e.delimiter(i),x.meta.delimiter=e.delimiter):((o=((t,r,s,i,n)=>{var a,o,d,c;n=n||[","," ","|",";",l.RECORD_SEP,l.UNIT_SEP];for(var u=0;u=r.length/2?"\r\n":"\r"}}function f(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function p(e){var t=(e=e||{}).delimiter,r=e.newline,s=e.comments,i=e.step,n=e.preview,a=e.fastMode,o=null,d=!1,c=null==e.quoteChar?'"':e.quoteChar,u=c;if(void 0!==e.escapeChar&&(u=e.escapeChar),("string"!=typeof t||-1=n)return A(!0);break}k.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:w.length,index:h}),T++}}else if(s&&0===C.length&&l.substring(h,h+_)===s){if(-1===R)return A();h=R+b,R=l.indexOf(r,h),E=l.indexOf(t,h)}else if(-1!==E&&(E=n)return A(!0)}return P();function U(e){w.push(e),N=h}function D(e){return -1!==e&&(e=l.substring(T+1,e))&&""===e.trim()?e.length:0}function P(e){return x||(void 0===e&&(e=l.substring(h)),C.push(e),h=g,U(C),j&&B()),A()}function F(e){h=e,U(C),C=[],R=l.indexOf(r,h)}function A(s){if(e.header&&!p&&w.length&&!d){var i=w[0],n=Object.create(null),a=new Set(i);let t=!1;for(let r=0;r{if("object"==typeof t){if("string"!=typeof t.delimiter||l.BAD_DELIMITERS.filter(function(e){return -1!==t.delimiter.indexOf(e)}).length||(i=t.delimiter),("boolean"==typeof t.quotes||"function"==typeof t.quotes||Array.isArray(t.quotes))&&(r=t.quotes),"boolean"!=typeof t.skipEmptyLines&&"string"!=typeof t.skipEmptyLines||(d=t.skipEmptyLines),"string"==typeof t.newline&&(n=t.newline),"string"==typeof t.quoteChar&&(a=t.quoteChar),"boolean"==typeof t.header&&(s=t.header),Array.isArray(t.columns)){if(0===t.columns.length)throw Error("Option columns is empty");c=t.columns}void 0!==t.escapeChar&&(o=t.escapeChar+a),t.escapeFormulae instanceof RegExp?u=t.escapeFormulae:"boolean"==typeof t.escapeFormulae&&t.escapeFormulae&&(u=/^[=+\-@\t\r].*$/)}})(),RegExp(f(a),"g"));if("string"==typeof e&&(e=JSON.parse(e)),Array.isArray(e)){if(!e.length||Array.isArray(e[0]))return m(null,e,d);if("object"==typeof e[0])return m(c||Object.keys(e[0]),e,d)}else if("object"==typeof e)return"string"==typeof e.data&&(e.data=JSON.parse(e.data)),Array.isArray(e.data)&&(e.fields||(e.fields=e.meta&&e.meta.fields||c),e.fields||(e.fields=Array.isArray(e.data[0])?e.fields:"object"==typeof e.data[0]?Object.keys(e.data[0]):[]),Array.isArray(e.data[0])||"object"==typeof e.data[0]||(e.data=[e.data])),m(e.fields||[],e.data||[],d);throw Error("Unable to serialize unrecognized input");function m(e,t,r){var a="",l=("string"==typeof e&&(e=JSON.parse(e)),"string"==typeof t&&(t=JSON.parse(t)),Array.isArray(e)&&0{for(var r=0;r{"use strict";var t=e.i(843476),r=e.i(827252),s=e.i(213205),i=e.i(912598),n=e.i(677667),a=e.i(130643),l=e.i(898667),o=e.i(994388),d=e.i(35983),c=e.i(779241),u=e.i(560445),h=e.i(464571),m=e.i(808613),f=e.i(311451),p=e.i(212931),x=e.i(199133),g=e.i(770914),y=e.i(592968),b=e.i(898586),_=e.i(271645),v=e.i(599724),j=e.i(291542),w=e.i(515831),k=e.i(519756),C=e.i(737434),N=e.i(285027),S=e.i(993914),O=e.i(955135);e.i(247167);var E=e.i(931067);let R={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494zM472 744a40 40 0 1080 0 40 40 0 10-80 0zm16-104h48c4.4 0 8-3.6 8-8V448c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v184c0 4.4 3.6 8 8 8z"}}]},name:"file-exclamation",theme:"outlined"};var I=e.i(9583),T=_.forwardRef(function(e,t){return _.createElement(I.default,(0,E.default)({},e,{ref:t,icon:R}))}),L=e.i(764205),U=e.i(59935),D=e.i(220508),P=e.i(964306);let F=_.forwardRef(function(e,t){return _.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),_.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"}))});var A=e.i(237016),B=e.i(727749);let M=({accessToken:e,teams:r,possibleUIRoles:s,onUsersCreated:i})=>{let[n,a]=(0,_.useState)(!1),[l,d]=(0,_.useState)([]),[c,u]=(0,_.useState)(!1),[h,m]=(0,_.useState)(null),[f,x]=(0,_.useState)(null),[g,y]=(0,_.useState)(null),[E,R]=(0,_.useState)(null),[I,M]=(0,_.useState)(null),[V,z]=(0,_.useState)("http://localhost:4000");(0,_.useEffect)(()=>{(async()=>{try{let t=await (0,L.getProxyUISettings)(e);M(t)}catch(e){console.error("Error fetching UI settings:",e)}})(),z(new URL("/",window.location.href).toString())},[e]);let $=async()=>{u(!0);let t=l.map(e=>({...e,status:"pending"}));d(t);let r=!1;for(let s=0;se.trim()).filter(Boolean),0===t.teams.length&&delete t.teams),i.models&&"string"==typeof i.models&&""!==i.models.trim()&&(t.models=i.models.split(",").map(e=>e.trim()).filter(Boolean),0===t.models.length&&delete t.models),i.max_budget&&""!==i.max_budget.toString().trim()){let e=parseFloat(i.max_budget.toString());!isNaN(e)&&e>0&&(t.max_budget=e)}i.budget_duration&&""!==i.budget_duration.trim()&&(t.budget_duration=i.budget_duration.trim()),i.metadata&&"string"==typeof i.metadata&&""!==i.metadata.trim()&&(t.metadata=i.metadata.trim()),console.log("Sending user data:",t);let n=await (0,L.userCreateCall)(e,null,t);if(console.log("Full response:",n),n&&(n.key||n.user_id)){r=!0,console.log("Success case triggered");let t=n.data?.user_id||n.user_id;try{if(I?.SSO_ENABLED){let e=new URL("/ui",V).toString();d(t=>t.map((t,r)=>r===s?{...t,status:"success",key:n.key||n.user_id,invitation_link:e}:t))}else{let r=await (0,L.invitationCreateCall)(e,t),i=new URL(`/ui?invitation_id=${r.id}`,V).toString();d(e=>e.map((e,t)=>t===s?{...e,status:"success",key:n.key||n.user_id,invitation_link:i}:e))}}catch(e){console.error("Error creating invitation:",e),d(e=>e.map((e,t)=>t===s?{...e,status:"success",key:n.key||n.user_id,error:"User created but failed to generate invitation link"}:e))}}else{console.log("Error case triggered");let e=n?.error||"Failed to create user";console.log("Error message:",e),d(t=>t.map((t,r)=>r===s?{...t,status:"failed",error:e}:t))}}catch(t){console.error("Caught error:",t);let e=t?.response?.data?.error||t?.message||String(t);d(t=>t.map((t,r)=>r===s?{...t,status:"failed",error:e}:t))}}u(!1),r&&i&&i()},q=[{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,r)=>r.isValid?r.status&&"pending"!==r.status?"success"===r.status?(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)(D.CheckCircleIcon,{className:"h-5 w-5 text-green-500 mr-2"}),(0,t.jsx)("span",{className:"text-green-500",children:"Success"})]}),r.invitation_link&&(0,t.jsx)("div",{className:"mt-1",children:(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("span",{className:"text-xs text-gray-500 truncate max-w-[150px]",children:r.invitation_link}),(0,t.jsx)(A.CopyToClipboard,{text:r.invitation_link,onCopy:()=>B.default.success("Invitation link copied!"),children:(0,t.jsx)("button",{className:"ml-1 text-blue-500 text-xs hover:text-blue-700",children:"Copy"})})]})})]}):(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)(P.XCircleIcon,{className:"h-5 w-5 text-red-500 mr-2"}),(0,t.jsx)("span",{className:"text-red-500",children:"Failed"})]}),r.error&&(0,t.jsx)("span",{className:"text-sm text-red-500 ml-7",children:JSON.stringify(r.error)})]}):(0,t.jsx)("span",{className:"text-gray-500",children:"Pending"}):(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)(P.XCircleIcon,{className:"h-5 w-5 text-red-500 mr-2"}),(0,t.jsx)("span",{className:"text-red-500",children:"Invalid"})]}),r.error&&(0,t.jsx)("span",{className:"text-sm text-red-500 ml-7",children:r.error})]})}];return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.Button,{className:"mb-0",onClick:()=>a(!0),children:"+ Bulk Invite Users"}),(0,t.jsx)(p.Modal,{title:"Bulk Invite Users",open:n,width:800,onCancel:()=>a(!1),bodyStyle:{maxHeight:"70vh",overflow:"auto"},footer:null,children:(0,t.jsx)("div",{className:"flex flex-col",children:0===l.length?(0,t.jsxs)("div",{className:"mb-6",children:[(0,t.jsxs)("div",{className:"flex items-center mb-4",children:[(0,t.jsx)("div",{className:"w-8 h-8 rounded-full bg-blue-500 text-white flex items-center justify-center mr-3",children:"1"}),(0,t.jsx)("h3",{className:"text-lg font-medium",children:"Download and fill the template"})]}),(0,t.jsxs)("div",{className:"ml-11 mb-6",children:[(0,t.jsx)("p",{className:"mb-4",children:"Add multiple users at once by following these steps:"}),(0,t.jsxs)("ol",{className:"list-decimal list-inside space-y-2 ml-2 mb-4",children:[(0,t.jsx)("li",{children:"Download our CSV template"}),(0,t.jsx)("li",{children:"Add your users' information to the spreadsheet"}),(0,t.jsx)("li",{children:"Save the file and upload it here"}),(0,t.jsx)("li",{children:"After creation, download the results file containing the Virtual Keys for each user"})]}),(0,t.jsxs)("div",{className:"bg-gray-50 p-4 rounded-md border border-gray-200 mb-4",children:[(0,t.jsx)("h4",{className:"font-medium mb-2",children:"Template Column Names"}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[(0,t.jsxs)("div",{className:"flex items-start",children:[(0,t.jsx)("div",{className:"w-3 h-3 rounded-full bg-red-500 mt-1.5 mr-2 flex-shrink-0"}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"font-medium",children:"user_email"}),(0,t.jsx)("p",{className:"text-sm text-gray-600",children:"User's email address (required)"})]})]}),(0,t.jsxs)("div",{className:"flex items-start",children:[(0,t.jsx)("div",{className:"w-3 h-3 rounded-full bg-red-500 mt-1.5 mr-2 flex-shrink-0"}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"font-medium",children:"user_role"}),(0,t.jsx)("p",{className:"text-sm text-gray-600",children:'User\'s role (one of: "proxy_admin", "proxy_admin_viewer", "internal_user", "internal_user_viewer")'})]})]}),(0,t.jsxs)("div",{className:"flex items-start",children:[(0,t.jsx)("div",{className:"w-3 h-3 rounded-full bg-gray-300 mt-1.5 mr-2 flex-shrink-0"}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"font-medium",children:"teams"}),(0,t.jsx)("p",{className:"text-sm text-gray-600",children:'Comma-separated team IDs (e.g., "team-1,team-2")'})]})]}),(0,t.jsxs)("div",{className:"flex items-start",children:[(0,t.jsx)("div",{className:"w-3 h-3 rounded-full bg-gray-300 mt-1.5 mr-2 flex-shrink-0"}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"font-medium",children:"max_budget"}),(0,t.jsx)("p",{className:"text-sm text-gray-600",children:'Maximum budget as a number (e.g., "100")'})]})]}),(0,t.jsxs)("div",{className:"flex items-start",children:[(0,t.jsx)("div",{className:"w-3 h-3 rounded-full bg-gray-300 mt-1.5 mr-2 flex-shrink-0"}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"font-medium",children:"budget_duration"}),(0,t.jsx)("p",{className:"text-sm text-gray-600",children:'Budget reset period (e.g., "30d", "1mo")'})]})]}),(0,t.jsxs)("div",{className:"flex items-start",children:[(0,t.jsx)("div",{className:"w-3 h-3 rounded-full bg-gray-300 mt-1.5 mr-2 flex-shrink-0"}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"font-medium",children:"models"}),(0,t.jsx)("p",{className:"text-sm text-gray-600",children:'Comma-separated allowed models (e.g., "gpt-3.5-turbo,gpt-4")'})]})]})]})]}),(0,t.jsxs)(o.Button,{onClick:()=>{let e=new Blob([U.default.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"}),t=window.URL.createObjectURL(e),r=document.createElement("a");r.href=t,r.download="bulk_users_template.csv",document.body.appendChild(r),r.click(),document.body.removeChild(r),window.URL.revokeObjectURL(t)},size:"lg",className:"w-full md:w-auto",children:[(0,t.jsx)(C.DownloadOutlined,{className:"mr-2"})," Download CSV Template"]})]}),(0,t.jsxs)("div",{className:"flex items-center mb-4",children:[(0,t.jsx)("div",{className:"w-8 h-8 rounded-full bg-blue-500 text-white flex items-center justify-center mr-3",children:"2"}),(0,t.jsx)("h3",{className:"text-lg font-medium",children:"Upload your completed CSV"})]}),(0,t.jsxs)("div",{className:"ml-11",children:[E?(0,t.jsxs)("div",{className:`mb-4 p-4 rounded-md border ${g?"bg-red-50 border-red-200":"bg-blue-50 border-blue-200"}`,children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex items-center",children:[g?(0,t.jsx)(T,{className:"text-red-500 text-xl mr-3"}):(0,t.jsx)(S.FileTextOutlined,{className:"text-blue-500 text-xl mr-3"}),(0,t.jsxs)("div",{children:[(0,t.jsx)(b.Typography.Text,{strong:!0,className:g?"text-red-800":"text-blue-800",children:E.name}),(0,t.jsxs)(b.Typography.Text,{className:`block text-xs ${g?"text-red-600":"text-blue-600"}`,children:[(E.size/1024).toFixed(1)," KB • ",new Date().toLocaleDateString()]})]})]}),(0,t.jsxs)(o.Button,{size:"xs",variant:"secondary",onClick:()=>{R(null),d([]),m(null),x(null),y(null)},className:"flex items-center",children:[(0,t.jsx)(O.DeleteOutlined,{className:"mr-1"})," Remove"]})]}),g?(0,t.jsxs)("div",{className:"mt-3 text-red-600 text-sm flex items-start",children:[(0,t.jsx)(N.WarningOutlined,{className:"mr-2 mt-0.5"}),(0,t.jsx)("span",{children:g})]}):!f&&(0,t.jsxs)("div",{className:"mt-3 flex items-center",children:[(0,t.jsx)("div",{className:"w-full bg-gray-200 rounded-full h-1.5",children:(0,t.jsx)("div",{className:"bg-blue-500 h-1.5 rounded-full w-full animate-pulse"})}),(0,t.jsx)("span",{className:"ml-2 text-xs text-blue-600",children:"Processing..."})]})]}):(0,t.jsx)(w.Upload,{beforeUpload:e=>((m(null),x(null),y(null),R(e),"text/csv"===e.type||e.name.endsWith(".csv"))?e.size>5242880?y(`File is too large (${(e.size/1048576).toFixed(1)} MB). Please upload a CSV file smaller than 5MB.`):U.default.parse(e,{complete:e=>{if(!e.data||0===e.data.length){x("The CSV file appears to be empty. Please upload a file with data."),d([]);return}if(1===e.data.length){x("The CSV file only contains headers but no user data. Please add user data to your CSV."),d([]);return}let t=e.data[0];if(0===t.length||1===t.length&&""===t[0]){x("The CSV file doesn't contain any column headers. Please make sure your CSV has headers."),d([]);return}let s=["user_email","user_role"].filter(e=>!t.includes(e));if(s.length>0){x(`Your CSV is missing these required columns: ${s.join(", ")}. Please add these columns to your CSV file.`),d([]);return}try{let s=e.data.slice(1).map((e,s)=>{if(0===e.length||1===e.length&&""===e[0])return null;if(e.length=parseFloat(i.max_budget.toString())&&n.push("Max budget must be greater than 0")),i.budget_duration&&!i.budget_duration.match(/^\d+[dhmwy]$|^\d+mo$/)&&n.push(`Invalid budget duration format "${i.budget_duration}". Use format like "30d", "1mo", "2w", "6h"`),i.teams&&"string"==typeof i.teams&&r&&r.length>0){let e=r.map(e=>e.team_id),t=i.teams.split(",").map(e=>e.trim()).filter(t=>!e.includes(t));t.length>0&&n.push(`Unknown team(s): ${t.join(", ")}`)}return n.length>0&&(i.isValid=!1,i.error=n.join(", ")),i}).filter(Boolean),i=s.filter(e=>e.isValid);d(s),0===s.length?x("No valid data rows found in the CSV file. Please check your file format."):0===i.length?m("No valid users found in the CSV. Please check the errors below and fix your CSV file."):i.length{m(`Failed to parse CSV file: ${e.message}`),d([])},header:!1}):(y(`Invalid file type: ${e.name}. Please upload a CSV file (.csv extension).`),B.default.fromBackend("Invalid file type. Please upload a CSV file.")),!1),accept:".csv",maxCount:1,showUploadList:!1,children:(0,t.jsxs)("div",{className:"border-2 border-dashed border-gray-300 rounded-lg p-8 text-center hover:border-blue-500 transition-colors cursor-pointer",children:[(0,t.jsx)(k.UploadOutlined,{className:"text-3xl text-gray-400 mb-2"}),(0,t.jsx)("p",{className:"mb-1",children:"Drag and drop your CSV file here"}),(0,t.jsx)("p",{className:"text-sm text-gray-500 mb-3",children:"or"}),(0,t.jsx)(o.Button,{size:"sm",children:"Browse files"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-4",children:"Only CSV files (.csv) are supported"})]})}),f&&(0,t.jsx)("div",{className:"mb-4 p-4 bg-yellow-50 border border-yellow-200 rounded-md",children:(0,t.jsxs)("div",{className:"flex items-start",children:[(0,t.jsx)(F,{className:"h-5 w-5 text-yellow-500 mr-2 mt-0.5"}),(0,t.jsxs)("div",{children:[(0,t.jsx)(b.Typography.Text,{strong:!0,className:"text-yellow-800",children:"CSV Structure Error"}),(0,t.jsx)(b.Typography.Paragraph,{className:"text-yellow-700 mt-1 mb-0",children:f}),(0,t.jsx)(b.Typography.Paragraph,{className:"text-yellow-700 mt-2 mb-0",children:"Please download our template and ensure your CSV follows the required format."})]})]})})]})]}):(0,t.jsxs)("div",{className:"mb-6",children:[(0,t.jsxs)("div",{className:"flex items-center mb-4",children:[(0,t.jsx)("div",{className:"w-8 h-8 rounded-full bg-blue-500 text-white flex items-center justify-center mr-3",children:"3"}),(0,t.jsx)("h3",{className:"text-lg font-medium",children:l.some(e=>"success"===e.status||"failed"===e.status)?"User Creation Results":"Review and create users"})]}),h&&(0,t.jsx)("div",{className:"ml-11 mb-4 p-4 bg-red-50 border border-red-200 rounded-md",children:(0,t.jsxs)("div",{className:"flex items-start",children:[(0,t.jsx)(N.WarningOutlined,{className:"text-red-500 mr-2 mt-1"}),(0,t.jsxs)("div",{children:[(0,t.jsx)(v.Text,{className:"text-red-600 font-medium",children:h}),l.some(e=>!e.isValid)&&(0,t.jsxs)("ul",{className:"mt-2 list-disc list-inside text-red-600 text-sm",children:[(0,t.jsx)("li",{children:"Check the table below for specific errors in each row"}),(0,t.jsx)("li",{children:"Common issues include invalid email formats, missing required fields, or incorrect role values"}),(0,t.jsx)("li",{children:"Fix these issues in your CSV file and upload again"})]})]})]})}),(0,t.jsxs)("div",{className:"ml-11",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-3",children:[(0,t.jsx)("div",{className:"flex items-center",children:l.some(e=>"success"===e.status||"failed"===e.status)?(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)(v.Text,{className:"text-lg font-medium mr-3",children:"Creation Summary"}),(0,t.jsxs)(v.Text,{className:"text-sm bg-green-100 text-green-800 px-2 py-1 rounded mr-2",children:[l.filter(e=>"success"===e.status).length," Successful"]}),l.some(e=>"failed"===e.status)&&(0,t.jsxs)(v.Text,{className:"text-sm bg-red-100 text-red-800 px-2 py-1 rounded",children:[l.filter(e=>"failed"===e.status).length," Failed"]})]}):(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)(v.Text,{className:"text-lg font-medium mr-3",children:"User Preview"}),(0,t.jsxs)(v.Text,{className:"text-sm bg-blue-100 text-blue-800 px-2 py-1 rounded",children:[l.filter(e=>e.isValid).length," of ",l.length," users valid"]})]})}),!l.some(e=>"success"===e.status||"failed"===e.status)&&(0,t.jsxs)("div",{className:"flex space-x-3",children:[(0,t.jsx)(o.Button,{onClick:()=>{d([]),m(null)},variant:"secondary",children:"Back"}),(0,t.jsx)(o.Button,{onClick:$,disabled:0===l.filter(e=>e.isValid).length||c,children:c?"Creating...":`Create ${l.filter(e=>e.isValid).length} Users`})]})]}),l.some(e=>"success"===e.status)&&(0,t.jsx)("div",{className:"mb-4 p-4 bg-blue-50 border border-blue-200 rounded-md",children:(0,t.jsxs)("div",{className:"flex items-start",children:[(0,t.jsx)("div",{className:"mr-3 mt-1",children:(0,t.jsx)(D.CheckCircleIcon,{className:"h-5 w-5 text-blue-500"})}),(0,t.jsxs)("div",{children:[(0,t.jsx)(v.Text,{className:"font-medium text-blue-800",children:"User creation complete"}),(0,t.jsxs)(v.Text,{className:"block text-sm text-blue-700 mt-1",children:[(0,t.jsx)("span",{className:"font-medium",children:"Next step:"})," Download the credentials file containing Virtual Keys and invitation links. Users will need these Virtual Keys to make LLM requests through LiteLLM."]})]})]})}),(0,t.jsx)(j.Table,{dataSource:l,columns:q,size:"small",pagination:{pageSize:5},scroll:{y:300},rowClassName:e=>e.isValid?"":"bg-red-50"}),!l.some(e=>"success"===e.status||"failed"===e.status)&&(0,t.jsxs)("div",{className:"flex justify-end mt-4",children:[(0,t.jsx)(o.Button,{onClick:()=>{d([]),m(null)},variant:"secondary",className:"mr-3",children:"Back"}),(0,t.jsx)(o.Button,{onClick:$,disabled:0===l.filter(e=>e.isValid).length||c,children:c?"Creating...":`Create ${l.filter(e=>e.isValid).length} Users`})]}),l.some(e=>"success"===e.status||"failed"===e.status)&&(0,t.jsxs)("div",{className:"flex justify-end mt-4",children:[(0,t.jsx)(o.Button,{onClick:()=>{d([]),m(null)},variant:"secondary",className:"mr-3",children:"Start New Bulk Import"}),(0,t.jsxs)(o.Button,{onClick:()=>{let e=l.map(e=>({user_email:e.user_email,user_role:e.user_role,status:e.status,key:e.key||"",invitation_link:e.invitation_link||"",error:e.error||""})),t=new Blob([U.default.unparse(e)],{type:"text/csv"}),r=window.URL.createObjectURL(t),s=document.createElement("a");s.href=r,s.download="bulk_users_results.csv",document.body.appendChild(s),s.click(),document.body.removeChild(s),window.URL.revokeObjectURL(r)},variant:"primary",className:"flex items-center",children:[(0,t.jsx)(C.DownloadOutlined,{className:"mr-2"})," Download User Credentials"]})]})]})]})})})]})};var V=e.i(663435),z=e.i(355619);function $({isInvitationLinkModalVisible:e,setIsInvitationLinkModalVisible:r,baseUrl:s,invitationLinkData:i,modalType:n="invitation"}){let{Title:a,Paragraph:l}=b.Typography,d=()=>{if(!s)return"";let e=new URL(s).pathname,t=e&&"/"!==e?`${e}/ui`:"ui";if(i?.has_user_setup_sso)return new URL(t,s).toString();let r=`${t}?invitation_id=${i?.id}`;return"resetPassword"===n&&(r+="&action=reset_password"),new URL(r,s).toString()};return(0,t.jsxs)(p.Modal,{title:"invitation"===n?"Invitation Link":"Reset Password Link",open:e,width:800,footer:null,onOk:()=>{r(!1)},onCancel:()=>{r(!1)},children:[(0,t.jsx)(l,{children:"invitation"===n?"Copy and send the generated link to onboard this user to the proxy.":"Copy and send the generated link to the user to reset their password."}),(0,t.jsxs)("div",{className:"flex justify-between pt-5 pb-2",children:[(0,t.jsx)(v.Text,{className:"text-base",children:"User ID"}),(0,t.jsx)(v.Text,{children:i?.user_id})]}),(0,t.jsxs)("div",{className:"flex justify-between pt-5 pb-2",children:[(0,t.jsx)(v.Text,{children:"invitation"===n?"Invitation Link":"Reset Password Link"}),(0,t.jsx)(v.Text,{children:(0,t.jsx)(v.Text,{children:d()})})]}),(0,t.jsx)("div",{className:"flex justify-end mt-5",children:(0,t.jsx)(A.CopyToClipboard,{text:d(),onCopy:()=>B.default.success("Copied!"),children:(0,t.jsx)(o.Button,{variant:"primary",children:"invitation"===n?"Copy invitation link":"Copy password reset link"})})})]})}e.s(["default",()=>$],172372);let{Option:q}=x.Select,{Text:K,Link:W,Title:H}=b.Typography;e.s(["CreateUserButton",0,({userID:e,accessToken:b,teams:v,possibleUIRoles:j,onUserCreated:w,isEmbedded:k=!1})=>{let C=(0,i.useQueryClient)(),[N,S]=(0,_.useState)(null),[O]=m.Form.useForm(),[E,R]=(0,_.useState)(!1),[I,T]=(0,_.useState)(!1),[U,D]=(0,_.useState)([]),[P,F]=(0,_.useState)(!1),[A,q]=(0,_.useState)(null),[H,Q]=(0,_.useState)(null);(0,_.useEffect)(()=>{let t=async()=>{try{let t=await (0,L.modelAvailableCall)(b,e,"any"),r=[];for(let e=0;e{try{B.default.info("Making API Call"),k||R(!0),t.models&&0!==t.models.length||"proxy_admin"===t.user_role||(t.models=["no-default-models"]);let r=await (0,L.userCreateCall)(b,null,t);await C.invalidateQueries({queryKey:["userList"]}),T(!0);let s=r.data?.user_id||r.user_id;if(w&&k){w(s),O.resetFields();return}if(N?.SSO_ENABLED){let t={id:"u">typeof crypto&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){let t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)}),user_id:s,is_accepted:!1,accepted_at:null,expires_at:new Date(Date.now()+6048e5),created_at:new Date,created_by:e,updated_at:new Date,updated_by:e,has_user_setup_sso:!0};q(t),F(!0)}else(0,L.invitationCreateCall)(b,s).then(e=>{e.has_user_setup_sso=!1,q(e),F(!0)});B.default.success("API user Created"),O.resetFields(),localStorage.removeItem("userData"+e)}catch(t){let e=t.response?.data?.detail||t?.message||"Error creating the user";B.default.fromBackend(e),console.error("Error creating the user:",t)}};return k?(0,t.jsxs)(m.Form,{form:O,onFinish:J,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,t.jsx)(u.Alert,{message:"Email invitations",description:(0,t.jsxs)(t.Fragment,{children:["New users receive an email invite only when an email integration (SMTP, Resend, or SendGrid) is configured."," ",(0,t.jsx)(W,{href:"https://docs.litellm.ai/docs/proxy/email",target:"_blank",children:"Learn how to set up email notifications"})]}),type:"info",showIcon:!0,className:"mb-4"}),(0,t.jsx)(m.Form.Item,{label:"User Email",name:"user_email",children:(0,t.jsx)(c.TextInput,{placeholder:""})}),(0,t.jsx)(m.Form.Item,{label:"User Role",name:"user_role",children:(0,t.jsx)(x.Select,{children:j&&Object.entries(j).map(([e,{ui_label:r,description:s}])=>(0,t.jsx)(d.SelectItem,{value:e,title:r,children:(0,t.jsxs)("div",{className:"flex",children:[r," ",(0,t.jsx)(K,{className:"ml-2",style:{color:"gray",fontSize:"12px"},children:s})]})},e))})}),(0,t.jsx)(m.Form.Item,{label:"Team",name:"team_id",children:(0,t.jsx)(x.Select,{placeholder:"Select Team",style:{width:"100%"},children:(0,t.jsx)(V.default,{teams:v})})}),(0,t.jsx)(m.Form.Item,{label:"Metadata",name:"metadata",children:(0,t.jsx)(f.Input.TextArea,{rows:4,placeholder:"Enter metadata as JSON"})}),(0,t.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,t.jsx)(h.Button,{htmlType:"submit",children:"Create User"})})]}):(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(o.Button,{className:"mb-0",onClick:()=>R(!0),children:"+ Invite User"}),(0,t.jsx)(M,{accessToken:b,teams:v,possibleUIRoles:j}),(0,t.jsxs)(p.Modal,{title:"Invite User",open:E,width:800,footer:null,onOk:()=>{R(!1),O.resetFields()},onCancel:()=>{R(!1),T(!1),O.resetFields()},children:[(0,t.jsxs)(g.Space,{direction:"vertical",size:"middle",children:[(0,t.jsx)(K,{className:"mb-1",children:"Create a User who can own keys"}),(0,t.jsx)(u.Alert,{message:"Email invitations",description:(0,t.jsxs)(t.Fragment,{children:["New users receive an email invite only when an email integration (SMTP, Resend, or SendGrid) is configured."," ",(0,t.jsx)(W,{href:"https://docs.litellm.ai/docs/proxy/email",target:"_blank",children:"Learn how to set up email notifications"})]}),type:"info",showIcon:!0,className:"mb-4"})]}),(0,t.jsxs)(m.Form,{form:O,onFinish:J,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,t.jsx)(m.Form.Item,{label:"User Email",name:"user_email",children:(0,t.jsx)(f.Input,{})}),(0,t.jsx)(m.Form.Item,{label:(0,t.jsxs)("span",{children:["Global Proxy Role"," ",(0,t.jsx)(y.Tooltip,{title:"This role is independent of any team/org specific roles. Configure Team / Organization Admins in the Settings",children:(0,t.jsx)(r.InfoCircleOutlined,{})})]}),name:"user_role",children:(0,t.jsx)(x.Select,{children:j&&Object.entries(j).map(([e,{ui_label:r,description:s}])=>(0,t.jsxs)(d.SelectItem,{value:e,title:r,children:[(0,t.jsx)(K,{children:r}),(0,t.jsxs)(K,{type:"secondary",children:[" - ",s]})]},e))})}),(0,t.jsx)(m.Form.Item,{label:"Team",className:"gap-2",name:"team_id",help:"If selected, user will be added as a 'user' role to the team.",children:(0,t.jsx)(V.default,{teams:v})}),(0,t.jsx)(m.Form.Item,{label:"Metadata",name:"metadata",children:(0,t.jsx)(f.Input.TextArea,{rows:4,placeholder:"Enter metadata as JSON"})}),(0,t.jsxs)(n.Accordion,{children:[(0,t.jsx)(l.AccordionHeader,{children:(0,t.jsx)(K,{strong:!0,children:"Personal Key Creation"})}),(0,t.jsx)(a.AccordionBody,{children:(0,t.jsx)(m.Form.Item,{className:"gap-2",label:(0,t.jsxs)("span",{children:["Models"," ",(0,t.jsx)(y.Tooltip,{title:"Models user has access to, outside of team scope.",children:(0,t.jsx)(r.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"models",help:"Models user has access to, outside of team scope.",children:(0,t.jsxs)(x.Select,{mode:"multiple",placeholder:"Select models",style:{width:"100%"},children:[(0,t.jsx)(x.Select.Option,{value:"all-proxy-models",children:"All Proxy Models"},"all-proxy-models"),(0,t.jsx)(x.Select.Option,{value:"no-default-models",children:"No Default Models"},"no-default-models"),U.map(e=>(0,t.jsx)(x.Select.Option,{value:e,children:(0,z.getModelDisplayName)(e)},e))]})})})]}),(0,t.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,t.jsx)(h.Button,{type:"primary",icon:(0,t.jsx)(s.UserAddOutlined,{}),htmlType:"submit",children:"Invite User"})})]})]}),I&&(0,t.jsx)($,{isInvitationLinkModalVisible:P,setIsInvitationLinkModalVisible:F,baseUrl:H||"",invitationLinkData:A})]})}],371455)}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/1153e633ed18e0bd.js b/litellm/proxy/_experimental/out/_next/static/chunks/1153e633ed18e0bd.js deleted file mode 100644 index 5936ae08d64..00000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/1153e633ed18e0bd.js +++ /dev/null @@ -1,17 +0,0 @@ -(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,869216,e=>{"use strict";e.i(247167);var t=e.i(271645),r=e.i(343794),a=e.i(908206),o=e.i(242064),l=e.i(517455),n=e.i(150073);let i={xxl:3,xl:3,lg:3,md:3,sm:2,xs:1},s=t.default.createContext({});var d=e.i(876556),c=function(e,t){var r={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&0>t.indexOf(a)&&(r[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,a=Object.getOwnPropertySymbols(e);ot.indexOf(a[o])&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(r[a[o]]=e[a[o]]);return r},g=function(e,t){var r={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&0>t.indexOf(a)&&(r[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,a=Object.getOwnPropertySymbols(e);ot.indexOf(a[o])&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(r[a[o]]=e[a[o]]);return r};let m=e=>{let{itemPrefixCls:a,component:o,span:l,className:n,style:i,labelStyle:d,contentStyle:c,bordered:g,label:m,content:u,colon:b,type:p,styles:f}=e,{classNames:h}=t.useContext(s),x=Object.assign(Object.assign({},d),null==f?void 0:f.label),C=Object.assign(Object.assign({},c),null==f?void 0:f.content);if(g)return t.createElement(o,{colSpan:l,style:i,className:(0,r.default)(n,{[`${a}-item-${p}`]:"label"===p||"content"===p,[null==h?void 0:h.label]:(null==h?void 0:h.label)&&"label"===p,[null==h?void 0:h.content]:(null==h?void 0:h.content)&&"content"===p})},null!=m&&t.createElement("span",{style:x},m),null!=u&&t.createElement("span",{style:C},u));return t.createElement(o,{colSpan:l,style:i,className:(0,r.default)(`${a}-item`,n)},t.createElement("div",{className:`${a}-item-container`},null!=m&&t.createElement("span",{style:x,className:(0,r.default)(`${a}-item-label`,null==h?void 0:h.label,{[`${a}-item-no-colon`]:!b})},m),null!=u&&t.createElement("span",{style:C,className:(0,r.default)(`${a}-item-content`,null==h?void 0:h.content)},u)))};function u(e,{colon:r,prefixCls:a,bordered:o},{component:l,type:n,showLabel:i,showContent:s,labelStyle:d,contentStyle:c,styles:g}){return e.map(({label:e,children:u,prefixCls:b=a,className:p,style:f,labelStyle:h,contentStyle:x,span:C=1,key:$,styles:v},y)=>"string"==typeof l?t.createElement(m,{key:`${n}-${$||y}`,className:p,style:f,styles:{label:Object.assign(Object.assign(Object.assign(Object.assign({},d),null==g?void 0:g.label),h),null==v?void 0:v.label),content:Object.assign(Object.assign(Object.assign(Object.assign({},c),null==g?void 0:g.content),x),null==v?void 0:v.content)},span:C,colon:r,component:l,itemPrefixCls:b,bordered:o,label:i?e:null,content:s?u:null,type:n}):[t.createElement(m,{key:`label-${$||y}`,className:p,style:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},d),null==g?void 0:g.label),f),h),null==v?void 0:v.label),span:1,colon:r,component:l[0],itemPrefixCls:b,bordered:o,label:e,type:"label"}),t.createElement(m,{key:`content-${$||y}`,className:p,style:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},c),null==g?void 0:g.content),f),x),null==v?void 0:v.content),span:2*C-1,component:l[1],itemPrefixCls:b,bordered:o,content:u,type:"content"})])}let b=e=>{let r=t.useContext(s),{prefixCls:a,vertical:o,row:l,index:n,bordered:i}=e;return o?t.createElement(t.Fragment,null,t.createElement("tr",{key:`label-${n}`,className:`${a}-row`},u(l,e,Object.assign({component:"th",type:"label",showLabel:!0},r))),t.createElement("tr",{key:`content-${n}`,className:`${a}-row`},u(l,e,Object.assign({component:"td",type:"content",showContent:!0},r)))):t.createElement("tr",{key:n,className:`${a}-row`},u(l,e,Object.assign({component:i?["th","td"]:"td",type:"item",showLabel:!0,showContent:!0},r)))};e.i(296059);var p=e.i(915654),f=e.i(183293),h=e.i(246422),x=e.i(838378);let C=(0,h.genStyleHooks)("Descriptions",e=>(e=>{let{componentCls:t,extraColor:r,itemPaddingBottom:a,itemPaddingEnd:o,colonMarginRight:l,colonMarginLeft:n,titleMarginBottom:i}=e;return{[t]:Object.assign(Object.assign(Object.assign({},(0,f.resetComponent)(e)),(e=>{let{componentCls:t,labelBg:r}=e;return{[`&${t}-bordered`]:{[`> ${t}-view`]:{border:`${(0,p.unit)(e.lineWidth)} ${e.lineType} ${e.colorSplit}`,"> table":{tableLayout:"auto"},[`${t}-row`]:{borderBottom:`${(0,p.unit)(e.lineWidth)} ${e.lineType} ${e.colorSplit}`,"&:first-child":{"> th:first-child, > td:first-child":{borderStartStartRadius:e.borderRadiusLG}},"&:last-child":{borderBottom:"none","> th:first-child, > td:first-child":{borderEndStartRadius:e.borderRadiusLG}},[`> ${t}-item-label, > ${t}-item-content`]:{padding:`${(0,p.unit)(e.padding)} ${(0,p.unit)(e.paddingLG)}`,borderInlineEnd:`${(0,p.unit)(e.lineWidth)} ${e.lineType} ${e.colorSplit}`,"&:last-child":{borderInlineEnd:"none"}},[`> ${t}-item-label`]:{color:e.colorTextSecondary,backgroundColor:r,"&::after":{display:"none"}}}},[`&${t}-middle`]:{[`${t}-row`]:{[`> ${t}-item-label, > ${t}-item-content`]:{padding:`${(0,p.unit)(e.paddingSM)} ${(0,p.unit)(e.paddingLG)}`}}},[`&${t}-small`]:{[`${t}-row`]:{[`> ${t}-item-label, > ${t}-item-content`]:{padding:`${(0,p.unit)(e.paddingXS)} ${(0,p.unit)(e.padding)}`}}}}}})(e)),{"&-rtl":{direction:"rtl"},[`${t}-header`]:{display:"flex",alignItems:"center",marginBottom:i},[`${t}-title`]:Object.assign(Object.assign({},f.textEllipsis),{flex:"auto",color:e.titleColor,fontWeight:e.fontWeightStrong,fontSize:e.fontSizeLG,lineHeight:e.lineHeightLG}),[`${t}-extra`]:{marginInlineStart:"auto",color:r,fontSize:e.fontSize},[`${t}-view`]:{width:"100%",borderRadius:e.borderRadiusLG,table:{width:"100%",tableLayout:"fixed",borderCollapse:"collapse"}},[`${t}-row`]:{"> th, > td":{paddingBottom:a,paddingInlineEnd:o},"> th:last-child, > td:last-child":{paddingInlineEnd:0},"&:last-child":{borderBottom:"none","> th, > td":{paddingBottom:0}}},[`${t}-item-label`]:{color:e.labelColor,fontWeight:"normal",fontSize:e.fontSize,lineHeight:e.lineHeight,textAlign:"start","&::after":{content:'":"',position:"relative",top:-.5,marginInline:`${(0,p.unit)(n)} ${(0,p.unit)(l)}`},[`&${t}-item-no-colon::after`]:{content:'""'}},[`${t}-item-no-label`]:{"&::after":{margin:0,content:'""'}},[`${t}-item-content`]:{display:"table-cell",flex:1,color:e.contentColor,fontSize:e.fontSize,lineHeight:e.lineHeight,wordBreak:"break-word",overflowWrap:"break-word"},[`${t}-item`]:{paddingBottom:0,verticalAlign:"top","&-container":{display:"flex",[`${t}-item-label`]:{display:"inline-flex",alignItems:"baseline"},[`${t}-item-content`]:{display:"inline-flex",alignItems:"baseline",minWidth:"1em"}}},"&-middle":{[`${t}-row`]:{"> th, > td":{paddingBottom:e.paddingSM}}},"&-small":{[`${t}-row`]:{"> th, > td":{paddingBottom:e.paddingXS}}}})}})((0,x.mergeToken)(e,{})),e=>({labelBg:e.colorFillAlter,labelColor:e.colorTextTertiary,titleColor:e.colorText,titleMarginBottom:e.fontSizeSM*e.lineHeightSM,itemPaddingBottom:e.padding,itemPaddingEnd:e.padding,colonMarginRight:e.marginXS,colonMarginLeft:e.marginXXS/2,contentColor:e.colorText,extraColor:e.colorText}));var $=function(e,t){var r={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&0>t.indexOf(a)&&(r[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,a=Object.getOwnPropertySymbols(e);ot.indexOf(a[o])&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(r[a[o]]=e[a[o]]);return r};let v=e=>{let m,{prefixCls:u,title:p,extra:f,column:h,colon:x=!0,bordered:v,layout:y,children:O,className:k,rootClassName:j,style:w,size:N,labelStyle:S,contentStyle:E,styles:T,items:z,classNames:P}=e,B=$(e,["prefixCls","title","extra","column","colon","bordered","layout","children","className","rootClassName","style","size","labelStyle","contentStyle","styles","items","classNames"]),{getPrefixCls:M,direction:R,className:H,style:L,classNames:I,styles:X}=(0,o.useComponentConfig)("descriptions"),A=M("descriptions",u),G=(0,n.default)(),W=t.useMemo(()=>{var e;return"number"==typeof h?h:null!=(e=(0,a.matchScreen)(G,Object.assign(Object.assign({},i),h)))?e:3},[G,h]),q=(m=t.useMemo(()=>z||(0,d.default)(O).map(e=>Object.assign(Object.assign({},null==e?void 0:e.props),{key:e.key})),[z,O]),t.useMemo(()=>m.map(e=>{var{span:t}=e,r=c(e,["span"]);return"filled"===t?Object.assign(Object.assign({},r),{filled:!0}):Object.assign(Object.assign({},r),{span:"number"==typeof t?t:(0,a.matchScreen)(G,t)})}),[m,G])),F=(0,l.default)(N),_=((e,r)=>{let[a,o]=(0,t.useMemo)(()=>{let t,a,o,l;return t=[],a=[],o=!1,l=0,r.filter(e=>e).forEach(r=>{let{filled:n}=r,i=g(r,["filled"]);if(n){a.push(i),t.push(a),a=[],l=0;return}let s=e-l;(l+=r.span||1)>=e?(l>e?(o=!0,a.push(Object.assign(Object.assign({},i),{span:s}))):a.push(i),t.push(a),a=[],l=0):a.push(i)}),a.length>0&&t.push(a),[t=t.map(t=>{let r=t.reduce((e,t)=>e+(t.span||1),0);if(r({labelStyle:S,contentStyle:E,styles:{content:Object.assign(Object.assign({},X.content),null==T?void 0:T.content),label:Object.assign(Object.assign({},X.label),null==T?void 0:T.label)},classNames:{label:(0,r.default)(I.label,null==P?void 0:P.label),content:(0,r.default)(I.content,null==P?void 0:P.content)}}),[S,E,T,P,I,X]);return D(t.createElement(s.Provider,{value:V},t.createElement("div",Object.assign({className:(0,r.default)(A,H,I.root,null==P?void 0:P.root,{[`${A}-${F}`]:F&&"default"!==F,[`${A}-bordered`]:!!v,[`${A}-rtl`]:"rtl"===R},k,j,Y,K),style:Object.assign(Object.assign(Object.assign(Object.assign({},L),X.root),null==T?void 0:T.root),w)},B),(p||f)&&t.createElement("div",{className:(0,r.default)(`${A}-header`,I.header,null==P?void 0:P.header),style:Object.assign(Object.assign({},X.header),null==T?void 0:T.header)},p&&t.createElement("div",{className:(0,r.default)(`${A}-title`,I.title,null==P?void 0:P.title),style:Object.assign(Object.assign({},X.title),null==T?void 0:T.title)},p),f&&t.createElement("div",{className:(0,r.default)(`${A}-extra`,I.extra,null==P?void 0:P.extra),style:Object.assign(Object.assign({},X.extra),null==T?void 0:T.extra)},f)),t.createElement("div",{className:`${A}-view`},t.createElement("table",null,t.createElement("tbody",null,_.map((e,r)=>t.createElement(b,{key:r,index:r,colon:x,prefixCls:A,vertical:"vertical"===y,bordered:v,row:e}))))))))};v.Item=({children:e})=>e,e.s(["Descriptions",0,v],869216)},270377,e=>{"use strict";e.i(247167);var t=e.i(931067),r=e.i(271645);let a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"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"};var o=e.i(9583),l=r.forwardRef(function(e,l){return r.createElement(o.default,(0,t.default)({},e,{ref:l,icon:a}))});e.s(["ExclamationCircleOutlined",0,l],270377)},175712,e=>{"use strict";e.i(247167);var t=e.i(271645),r=e.i(343794),a=e.i(529681),o=e.i(242064),l=e.i(517455),n=e.i(185793),i=e.i(721369),s=function(e,t){var r={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&0>t.indexOf(a)&&(r[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,a=Object.getOwnPropertySymbols(e);ot.indexOf(a[o])&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(r[a[o]]=e[a[o]]);return r};let d=e=>{var{prefixCls:a,className:l,hoverable:n=!0}=e,i=s(e,["prefixCls","className","hoverable"]);let{getPrefixCls:d}=t.useContext(o.ConfigContext),c=d("card",a),g=(0,r.default)(`${c}-grid`,l,{[`${c}-grid-hoverable`]:n});return t.createElement("div",Object.assign({},i,{className:g}))};e.i(296059);var c=e.i(915654),g=e.i(183293),m=e.i(246422),u=e.i(838378);let b=(0,m.genStyleHooks)("Card",e=>{let t=(0,u.mergeToken)(e,{cardShadow:e.boxShadowCard,cardHeadPadding:e.padding,cardPaddingBase:e.paddingLG,cardActionsIconSize:e.fontSize});return[(e=>{let{componentCls:t,cardShadow:r,cardHeadPadding:a,colorBorderSecondary:o,boxShadowTertiary:l,bodyPadding:n,extraColor:i}=e;return{[t]:Object.assign(Object.assign({},(0,g.resetComponent)(e)),{position:"relative",background:e.colorBgContainer,borderRadius:e.borderRadiusLG,[`&:not(${t}-bordered)`]:{boxShadow:l},[`${t}-head`]:(e=>{let{antCls:t,componentCls:r,headerHeight:a,headerPadding:o,tabsMarginBottom:l}=e;return Object.assign(Object.assign({display:"flex",justifyContent:"center",flexDirection:"column",minHeight:a,marginBottom:-1,padding:`0 ${(0,c.unit)(o)}`,color:e.colorTextHeading,fontWeight:e.fontWeightStrong,fontSize:e.headerFontSize,background:e.headerBg,borderBottom:`${(0,c.unit)(e.lineWidth)} ${e.lineType} ${e.colorBorderSecondary}`,borderRadius:`${(0,c.unit)(e.borderRadiusLG)} ${(0,c.unit)(e.borderRadiusLG)} 0 0`},(0,g.clearFix)()),{"&-wrapper":{width:"100%",display:"flex",alignItems:"center"},"&-title":Object.assign(Object.assign({display:"inline-block",flex:1},g.textEllipsis),{[` - > ${r}-typography, - > ${r}-typography-edit-content - `]:{insetInlineStart:0,marginTop:0,marginBottom:0}}),[`${t}-tabs-top`]:{clear:"both",marginBottom:l,color:e.colorText,fontWeight:"normal",fontSize:e.fontSize,"&-bar":{borderBottom:`${(0,c.unit)(e.lineWidth)} ${e.lineType} ${e.colorBorderSecondary}`}}})})(e),[`${t}-extra`]:{marginInlineStart:"auto",color:i,fontWeight:"normal",fontSize:e.fontSize},[`${t}-body`]:{padding:n,borderRadius:`0 0 ${(0,c.unit)(e.borderRadiusLG)} ${(0,c.unit)(e.borderRadiusLG)}`},[`${t}-grid`]:(e=>{let{cardPaddingBase:t,colorBorderSecondary:r,cardShadow:a,lineWidth:o}=e;return{width:"33.33%",padding:t,border:0,borderRadius:0,boxShadow:` - ${(0,c.unit)(o)} 0 0 0 ${r}, - 0 ${(0,c.unit)(o)} 0 0 ${r}, - ${(0,c.unit)(o)} ${(0,c.unit)(o)} 0 0 ${r}, - ${(0,c.unit)(o)} 0 0 0 ${r} inset, - 0 ${(0,c.unit)(o)} 0 0 ${r} inset; - `,transition:`all ${e.motionDurationMid}`,"&-hoverable:hover":{position:"relative",zIndex:1,boxShadow:a}}})(e),[`${t}-cover`]:{"> *":{display:"block",width:"100%",borderRadius:`${(0,c.unit)(e.borderRadiusLG)} ${(0,c.unit)(e.borderRadiusLG)} 0 0`}},[`${t}-actions`]:(e=>{let{componentCls:t,iconCls:r,actionsLiMargin:a,cardActionsIconSize:o,colorBorderSecondary:l,actionsBg:n}=e;return Object.assign(Object.assign({margin:0,padding:0,listStyle:"none",background:n,borderTop:`${(0,c.unit)(e.lineWidth)} ${e.lineType} ${l}`,display:"flex",borderRadius:`0 0 ${(0,c.unit)(e.borderRadiusLG)} ${(0,c.unit)(e.borderRadiusLG)}`},(0,g.clearFix)()),{"& > li":{margin:a,color:e.colorTextDescription,textAlign:"center","> span":{position:"relative",display:"block",minWidth:e.calc(e.cardActionsIconSize).mul(2).equal(),fontSize:e.fontSize,lineHeight:e.lineHeight,cursor:"pointer","&:hover":{color:e.colorPrimary,transition:`color ${e.motionDurationMid}`},[`a:not(${t}-btn), > ${r}`]:{display:"inline-block",width:"100%",color:e.colorIcon,lineHeight:(0,c.unit)(e.fontHeight),transition:`color ${e.motionDurationMid}`,"&:hover":{color:e.colorPrimary}},[`> ${r}`]:{fontSize:o,lineHeight:(0,c.unit)(e.calc(o).mul(e.lineHeight).equal())}},"&:not(:last-child)":{borderInlineEnd:`${(0,c.unit)(e.lineWidth)} ${e.lineType} ${l}`}}})})(e),[`${t}-meta`]:Object.assign(Object.assign({margin:`${(0,c.unit)(e.calc(e.marginXXS).mul(-1).equal())} 0`,display:"flex"},(0,g.clearFix)()),{"&-avatar":{paddingInlineEnd:e.padding},"&-detail":{overflow:"hidden",flex:1,"> div:not(:last-child)":{marginBottom:e.marginXS}},"&-title":Object.assign({color:e.colorTextHeading,fontWeight:e.fontWeightStrong,fontSize:e.fontSizeLG},g.textEllipsis),"&-description":{color:e.colorTextDescription}})}),[`${t}-bordered`]:{border:`${(0,c.unit)(e.lineWidth)} ${e.lineType} ${o}`,[`${t}-cover`]:{marginTop:-1,marginInlineStart:-1,marginInlineEnd:-1}},[`${t}-hoverable`]:{cursor:"pointer",transition:`box-shadow ${e.motionDurationMid}, border-color ${e.motionDurationMid}`,"&:hover":{borderColor:"transparent",boxShadow:r}},[`${t}-contain-grid`]:{borderRadius:`${(0,c.unit)(e.borderRadiusLG)} ${(0,c.unit)(e.borderRadiusLG)} 0 0 `,[`${t}-body`]:{display:"flex",flexWrap:"wrap"},[`&:not(${t}-loading) ${t}-body`]:{marginBlockStart:e.calc(e.lineWidth).mul(-1).equal(),marginInlineStart:e.calc(e.lineWidth).mul(-1).equal(),padding:0}},[`${t}-contain-tabs`]:{[`> div${t}-head`]:{minHeight:0,[`${t}-head-title, ${t}-extra`]:{paddingTop:a}}},[`${t}-type-inner`]:(e=>{let{componentCls:t,colorFillAlter:r,headerPadding:a,bodyPadding:o}=e;return{[`${t}-head`]:{padding:`0 ${(0,c.unit)(a)}`,background:r,"&-title":{fontSize:e.fontSize}},[`${t}-body`]:{padding:`${(0,c.unit)(e.padding)} ${(0,c.unit)(o)}`}}})(e),[`${t}-loading`]:(e=>{let{componentCls:t}=e;return{overflow:"hidden",[`${t}-body`]:{userSelect:"none"}}})(e),[`${t}-rtl`]:{direction:"rtl"}}})(t),(e=>{let{componentCls:t,bodyPaddingSM:r,headerPaddingSM:a,headerHeightSM:o,headerFontSizeSM:l}=e;return{[`${t}-small`]:{[`> ${t}-head`]:{minHeight:o,padding:`0 ${(0,c.unit)(a)}`,fontSize:l,[`> ${t}-head-wrapper`]:{[`> ${t}-extra`]:{fontSize:e.fontSize}}},[`> ${t}-body`]:{padding:r}},[`${t}-small${t}-contain-tabs`]:{[`> ${t}-head`]:{[`${t}-head-title, ${t}-extra`]:{paddingTop:0,display:"flex",alignItems:"center"}}}}})(t)]},e=>{var t,r;return{headerBg:"transparent",headerFontSize:e.fontSizeLG,headerFontSizeSM:e.fontSize,headerHeight:e.fontSizeLG*e.lineHeightLG+2*e.padding,headerHeightSM:e.fontSize*e.lineHeight+2*e.paddingXS,actionsBg:e.colorBgContainer,actionsLiMargin:`${e.paddingSM}px 0`,tabsMarginBottom:-e.padding-e.lineWidth,extraColor:e.colorText,bodyPaddingSM:12,headerPaddingSM:12,bodyPadding:null!=(t=e.bodyPadding)?t:e.paddingLG,headerPadding:null!=(r=e.headerPadding)?r:e.paddingLG}});var p=e.i(792812),f=function(e,t){var r={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&0>t.indexOf(a)&&(r[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,a=Object.getOwnPropertySymbols(e);ot.indexOf(a[o])&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(r[a[o]]=e[a[o]]);return r};let h=e=>{let{actionClasses:r,actions:a=[],actionStyle:o}=e;return t.createElement("ul",{className:r,style:o},a.map((e,r)=>{let o=`action-${r}`;return t.createElement("li",{style:{width:`${100/a.length}%`},key:o},t.createElement("span",null,e))}))},x=t.forwardRef((e,s)=>{let c,{prefixCls:g,className:m,rootClassName:u,style:x,extra:C,headStyle:$={},bodyStyle:v={},title:y,loading:O,bordered:k,variant:j,size:w,type:N,cover:S,actions:E,tabList:T,children:z,activeTabKey:P,defaultActiveTabKey:B,tabBarExtraContent:M,hoverable:R,tabProps:H={},classNames:L,styles:I}=e,X=f(e,["prefixCls","className","rootClassName","style","extra","headStyle","bodyStyle","title","loading","bordered","variant","size","type","cover","actions","tabList","children","activeTabKey","defaultActiveTabKey","tabBarExtraContent","hoverable","tabProps","classNames","styles"]),{getPrefixCls:A,direction:G,card:W}=t.useContext(o.ConfigContext),[q]=(0,p.default)("card",j,k),F=e=>{var t;return(0,r.default)(null==(t=null==W?void 0:W.classNames)?void 0:t[e],null==L?void 0:L[e])},_=e=>{var t;return Object.assign(Object.assign({},null==(t=null==W?void 0:W.styles)?void 0:t[e]),null==I?void 0:I[e])},D=t.useMemo(()=>{let e=!1;return t.Children.forEach(z,t=>{(null==t?void 0:t.type)===d&&(e=!0)}),e},[z]),Y=A("card",g),[K,V,Q]=b(Y),U=t.createElement(n.default,{loading:!0,active:!0,paragraph:{rows:4},title:!1},z),J=void 0!==P,Z=Object.assign(Object.assign({},H),{[J?"activeKey":"defaultActiveKey"]:J?P:B,tabBarExtraContent:M}),ee=(0,l.default)(w),et=ee&&"default"!==ee?ee:"large",er=T?t.createElement(i.default,Object.assign({size:et},Z,{className:`${Y}-head-tabs`,onChange:t=>{var r;null==(r=e.onTabChange)||r.call(e,t)},items:T.map(e=>{var{tab:t}=e;return Object.assign({label:t},f(e,["tab"]))})})):null;if(y||C||er){let e=(0,r.default)(`${Y}-head`,F("header")),a=(0,r.default)(`${Y}-head-title`,F("title")),o=(0,r.default)(`${Y}-extra`,F("extra")),l=Object.assign(Object.assign({},$),_("header"));c=t.createElement("div",{className:e,style:l},t.createElement("div",{className:`${Y}-head-wrapper`},y&&t.createElement("div",{className:a,style:_("title")},y),C&&t.createElement("div",{className:o,style:_("extra")},C)),er)}let ea=(0,r.default)(`${Y}-cover`,F("cover")),eo=S?t.createElement("div",{className:ea,style:_("cover")},S):null,el=(0,r.default)(`${Y}-body`,F("body")),en=Object.assign(Object.assign({},v),_("body")),ei=t.createElement("div",{className:el,style:en},O?U:z),es=(0,r.default)(`${Y}-actions`,F("actions")),ed=(null==E?void 0:E.length)?t.createElement(h,{actionClasses:es,actionStyle:_("actions"),actions:E}):null,ec=(0,a.default)(X,["onTabChange"]),eg=(0,r.default)(Y,null==W?void 0:W.className,{[`${Y}-loading`]:O,[`${Y}-bordered`]:"borderless"!==q,[`${Y}-hoverable`]:R,[`${Y}-contain-grid`]:D,[`${Y}-contain-tabs`]:null==T?void 0:T.length,[`${Y}-${ee}`]:ee,[`${Y}-type-${N}`]:!!N,[`${Y}-rtl`]:"rtl"===G},m,u,V,Q),em=Object.assign(Object.assign({},null==W?void 0:W.style),x);return K(t.createElement("div",Object.assign({ref:s},ec,{className:eg,style:em}),c,eo,ei,ed))});var C=function(e,t){var r={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&0>t.indexOf(a)&&(r[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,a=Object.getOwnPropertySymbols(e);ot.indexOf(a[o])&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(r[a[o]]=e[a[o]]);return r};x.Grid=d,x.Meta=e=>{let{prefixCls:a,className:l,avatar:n,title:i,description:s}=e,d=C(e,["prefixCls","className","avatar","title","description"]),{getPrefixCls:c}=t.useContext(o.ConfigContext),g=c("card",a),m=(0,r.default)(`${g}-meta`,l),u=n?t.createElement("div",{className:`${g}-meta-avatar`},n):null,b=i?t.createElement("div",{className:`${g}-meta-title`},i):null,p=s?t.createElement("div",{className:`${g}-meta-description`},s):null,f=b||p?t.createElement("div",{className:`${g}-meta-detail`},b,p):null;return t.createElement("div",Object.assign({},d,{className:m}),u,f)},e.s(["Card",0,x],175712)},127952,368869,e=>{"use strict";var t=e.i(843476),r=e.i(560445),a=e.i(175712),o=e.i(869216),l=e.i(311451),n=e.i(212931),i=e.i(898586);e.i(296059);var s=e.i(868297),d=e.i(732961),c=e.i(289882),g=e.i(170517),m=e.i(628882),u=e.i(320890),b=e.i(104458),p=e.i(722319),f=e.i(8398),h=e.i(279728);e.i(765846);var x=e.i(602716),C=e.i(328052);e.i(262370);var $=e.i(135551);let v=(e,t)=>new $.FastColor(e).setA(t).toRgbString(),y=(e,t)=>new $.FastColor(e).lighten(t).toHexString(),O=e=>{let t=(0,x.generate)(e,{theme:"dark"});return{1:t[0],2:t[1],3:t[2],4:t[3],5:t[6],6:t[5],7:t[4],8:t[6],9:t[5],10:t[4]}},k=(e,t)=>{let r=e||"#000",a=t||"#fff";return{colorBgBase:r,colorTextBase:a,colorText:v(a,.85),colorTextSecondary:v(a,.65),colorTextTertiary:v(a,.45),colorTextQuaternary:v(a,.25),colorFill:v(a,.18),colorFillSecondary:v(a,.12),colorFillTertiary:v(a,.08),colorFillQuaternary:v(a,.04),colorBgSolid:v(a,.95),colorBgSolidHover:v(a,1),colorBgSolidActive:v(a,.9),colorBgElevated:y(r,12),colorBgContainer:y(r,8),colorBgLayout:y(r,0),colorBgSpotlight:y(r,26),colorBgBlur:v(a,.04),colorBorder:y(r,26),colorBorderSecondary:y(r,19)}},j={defaultSeed:u.defaultConfig.token,useToken:function(){let[e,t,r]=(0,b.useToken)();return{theme:e,token:t,hashId:r}},defaultAlgorithm:p.default,darkAlgorithm:(e,t)=>{let r=Object.keys(g.defaultPresetColors).map(t=>{let r=(0,x.generate)(e[t],{theme:"dark"});return Array.from({length:10},()=>1).reduce((e,a,o)=>(e[`${t}-${o+1}`]=r[o],e[`${t}${o+1}`]=r[o],e),{})}).reduce((e,t)=>e=Object.assign(Object.assign({},e),t),{}),a=null!=t?t:(0,p.default)(e),o=(0,C.default)(e,{generateColorPalettes:O,generateNeutralColorPalettes:k});return Object.assign(Object.assign(Object.assign(Object.assign({},a),r),o),{colorPrimaryBg:o.colorPrimaryBorder,colorPrimaryBgHover:o.colorPrimaryBorderHover})},compactAlgorithm:(e,t)=>{let r=null!=t?t:(0,p.default)(e),a=r.fontSizeSM,o=r.controlHeight-4;return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},r),function(e){let{sizeUnit:t,sizeStep:r}=e,a=r-2;return{sizeXXL:t*(a+10),sizeXL:t*(a+6),sizeLG:t*(a+2),sizeMD:t*(a+2),sizeMS:t*(a+1),size:t*a,sizeSM:t*a,sizeXS:t*(a-1),sizeXXS:t*(a-1)}}(null!=t?t:e)),(0,h.default)(a)),{controlHeight:o}),(0,f.default)(Object.assign(Object.assign({},r),{controlHeight:o})))},getDesignToken:e=>{let t=(null==e?void 0:e.algorithm)?(0,s.createTheme)(e.algorithm):c.default,r=Object.assign(Object.assign({},g.default),null==e?void 0:e.token);return(0,d.getComputedToken)(r,{override:null==e?void 0:e.token},t,m.default)},defaultConfig:u.defaultConfig,_internalContext:u.DesignTokenContext};e.s(["theme",0,j],368869);var w=e.i(270377),N=e.i(271645);function S({isOpen:e,title:s,alertMessage:d,message:c,resourceInformationTitle:g,resourceInformation:m,onCancel:u,onOk:b,confirmLoading:p,requiredConfirmation:f}){let{Title:h,Text:x}=i.Typography,{token:C}=j.useToken(),[$,v]=(0,N.useState)("");return(0,N.useEffect)(()=>{e&&v("")},[e]),(0,t.jsx)(n.Modal,{title:s,open:e,onOk:b,onCancel:u,confirmLoading:p,okText:p?"Deleting...":"Delete",cancelText:"Cancel",okButtonProps:{danger:!0,disabled:!!f&&$!==f||p},cancelButtonProps:{disabled:p},children:(0,t.jsxs)("div",{className:"space-y-4",children:[d&&(0,t.jsx)(r.Alert,{message:d,type:"warning"}),(0,t.jsx)(a.Card,{title:g,className:"mt-4",styles:{body:{padding:"16px"},header:{backgroundColor:C.colorErrorBg,borderColor:C.colorErrorBorder}},style:{backgroundColor:C.colorErrorBg,borderColor:C.colorErrorBorder},children:(0,t.jsx)(o.Descriptions,{column:1,size:"small",children:m&&m.map(({label:e,value:r,...a})=>(0,t.jsx)(o.Descriptions.Item,{label:(0,t.jsx)("span",{className:"font-semibold",children:e}),children:(0,t.jsx)(x,{...a,children:r??"-"})},e))})}),(0,t.jsx)("div",{children:(0,t.jsx)(x,{children:c})}),f&&(0,t.jsxs)("div",{className:"mb-6 mt-4 pt-4 border-t border-gray-200 dark:border-gray-700",children:[(0,t.jsxs)(x,{className:"block text-base font-medium text-gray-700 dark:text-gray-300 mb-2",children:[(0,t.jsx)(x,{children:"Type "}),(0,t.jsx)(x,{strong:!0,type:"danger",children:f}),(0,t.jsx)(x,{children:" to confirm deletion:"})]}),(0,t.jsx)(l.Input,{value:$,onChange:e=>v(e.target.value),placeholder:f,className:"rounded-md",prefix:(0,t.jsx)(w.ExclamationCircleOutlined,{style:{color:C.colorError}}),autoFocus:!0})]})]})})}e.s(["default",()=>S],127952)},185793,e=>{"use strict";e.i(247167);var t=e.i(271645),r=e.i(343794),a=e.i(242064),o=e.i(529681);let l=e=>{let{prefixCls:a,className:o,style:l,size:n,shape:i}=e,s=(0,r.default)({[`${a}-lg`]:"large"===n,[`${a}-sm`]:"small"===n}),d=(0,r.default)({[`${a}-circle`]:"circle"===i,[`${a}-square`]:"square"===i,[`${a}-round`]:"round"===i}),c=t.useMemo(()=>"number"==typeof n?{width:n,height:n,lineHeight:`${n}px`}:{},[n]);return t.createElement("span",{className:(0,r.default)(a,s,d,o),style:Object.assign(Object.assign({},c),l)})};e.i(296059);var n=e.i(694758),i=e.i(915654),s=e.i(246422),d=e.i(838378);let c=new n.Keyframes("ant-skeleton-loading",{"0%":{backgroundPosition:"100% 50%"},"100%":{backgroundPosition:"0 50%"}}),g=e=>({height:e,lineHeight:(0,i.unit)(e)}),m=e=>Object.assign({width:e},g(e)),u=(e,t)=>Object.assign({width:t(e).mul(5).equal(),minWidth:t(e).mul(5).equal()},g(e)),b=e=>Object.assign({width:e},g(e)),p=(e,t,r)=>{let{skeletonButtonCls:a}=e;return{[`${r}${a}-circle`]:{width:t,minWidth:t,borderRadius:"50%"},[`${r}${a}-round`]:{borderRadius:t}}},f=(e,t)=>Object.assign({width:t(e).mul(2).equal(),minWidth:t(e).mul(2).equal()},g(e)),h=(0,s.genStyleHooks)("Skeleton",e=>{let{componentCls:t,calc:r}=e;return(e=>{let{componentCls:t,skeletonAvatarCls:r,skeletonTitleCls:a,skeletonParagraphCls:o,skeletonButtonCls:l,skeletonInputCls:n,skeletonImageCls:i,controlHeight:s,controlHeightLG:d,controlHeightSM:g,gradientFromColor:h,padding:x,marginSM:C,borderRadius:$,titleHeight:v,blockRadius:y,paragraphLiHeight:O,controlHeightXS:k,paragraphMarginTop:j}=e;return{[t]:{display:"table",width:"100%",[`${t}-header`]:{display:"table-cell",paddingInlineEnd:x,verticalAlign:"top",[r]:Object.assign({display:"inline-block",verticalAlign:"top",background:h},m(s)),[`${r}-circle`]:{borderRadius:"50%"},[`${r}-lg`]:Object.assign({},m(d)),[`${r}-sm`]:Object.assign({},m(g))},[`${t}-content`]:{display:"table-cell",width:"100%",verticalAlign:"top",[a]:{width:"100%",height:v,background:h,borderRadius:y,[`+ ${o}`]:{marginBlockStart:g}},[o]:{padding:0,"> li":{width:"100%",height:O,listStyle:"none",background:h,borderRadius:y,"+ li":{marginBlockStart:k}}},[`${o}> li:last-child:not(:first-child):not(:nth-child(2))`]:{width:"61%"}},[`&-round ${t}-content`]:{[`${a}, ${o} > li`]:{borderRadius:$}}},[`${t}-with-avatar ${t}-content`]:{[a]:{marginBlockStart:C,[`+ ${o}`]:{marginBlockStart:j}}},[`${t}${t}-element`]:Object.assign(Object.assign(Object.assign(Object.assign({display:"inline-block",width:"auto"},(e=>{let{borderRadiusSM:t,skeletonButtonCls:r,controlHeight:a,controlHeightLG:o,controlHeightSM:l,gradientFromColor:n,calc:i}=e;return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({[r]:Object.assign({display:"inline-block",verticalAlign:"top",background:n,borderRadius:t,width:i(a).mul(2).equal(),minWidth:i(a).mul(2).equal()},f(a,i))},p(e,a,r)),{[`${r}-lg`]:Object.assign({},f(o,i))}),p(e,o,`${r}-lg`)),{[`${r}-sm`]:Object.assign({},f(l,i))}),p(e,l,`${r}-sm`))})(e)),(e=>{let{skeletonAvatarCls:t,gradientFromColor:r,controlHeight:a,controlHeightLG:o,controlHeightSM:l}=e;return{[t]:Object.assign({display:"inline-block",verticalAlign:"top",background:r},m(a)),[`${t}${t}-circle`]:{borderRadius:"50%"},[`${t}${t}-lg`]:Object.assign({},m(o)),[`${t}${t}-sm`]:Object.assign({},m(l))}})(e)),(e=>{let{controlHeight:t,borderRadiusSM:r,skeletonInputCls:a,controlHeightLG:o,controlHeightSM:l,gradientFromColor:n,calc:i}=e;return{[a]:Object.assign({display:"inline-block",verticalAlign:"top",background:n,borderRadius:r},u(t,i)),[`${a}-lg`]:Object.assign({},u(o,i)),[`${a}-sm`]:Object.assign({},u(l,i))}})(e)),(e=>{let{skeletonImageCls:t,imageSizeBase:r,gradientFromColor:a,borderRadiusSM:o,calc:l}=e;return{[t]:Object.assign(Object.assign({display:"inline-flex",alignItems:"center",justifyContent:"center",verticalAlign:"middle",background:a,borderRadius:o},b(l(r).mul(2).equal())),{[`${t}-path`]:{fill:"#bfbfbf"},[`${t}-svg`]:Object.assign(Object.assign({},b(r)),{maxWidth:l(r).mul(4).equal(),maxHeight:l(r).mul(4).equal()}),[`${t}-svg${t}-svg-circle`]:{borderRadius:"50%"}}),[`${t}${t}-circle`]:{borderRadius:"50%"}}})(e)),[`${t}${t}-block`]:{width:"100%",[l]:{width:"100%"},[n]:{width:"100%"}},[`${t}${t}-active`]:{[` - ${a}, - ${o} > li, - ${r}, - ${l}, - ${n}, - ${i} - `]:Object.assign({},{background:e.skeletonLoadingBackground,backgroundSize:"400% 100%",animationName:c,animationDuration:e.skeletonLoadingMotionDuration,animationTimingFunction:"ease",animationIterationCount:"infinite"})}}})((0,d.mergeToken)(e,{skeletonAvatarCls:`${t}-avatar`,skeletonTitleCls:`${t}-title`,skeletonParagraphCls:`${t}-paragraph`,skeletonButtonCls:`${t}-button`,skeletonInputCls:`${t}-input`,skeletonImageCls:`${t}-image`,imageSizeBase:r(e.controlHeight).mul(1.5).equal(),borderRadius:100,skeletonLoadingBackground:`linear-gradient(90deg, ${e.gradientFromColor} 25%, ${e.gradientToColor} 37%, ${e.gradientFromColor} 63%)`,skeletonLoadingMotionDuration:"1.4s"}))},e=>{let{colorFillContent:t,colorFill:r}=e;return{color:t,colorGradientEnd:r,gradientFromColor:t,gradientToColor:r,titleHeight:e.controlHeight/2,blockRadius:e.borderRadiusSM,paragraphMarginTop:e.marginLG+e.marginXXS,paragraphLiHeight:e.controlHeight/2}},{deprecatedTokens:[["color","gradientFromColor"],["colorGradientEnd","gradientToColor"]]}),x=e=>{let{prefixCls:a,className:o,style:l,rows:n=0}=e,i=Array.from({length:n}).map((r,a)=>t.createElement("li",{key:a,style:{width:((e,t)=>{let{width:r,rows:a=2}=t;return Array.isArray(r)?r[e]:a-1===e?r:void 0})(a,e)}}));return t.createElement("ul",{className:(0,r.default)(a,o),style:l},i)},C=({prefixCls:e,className:a,width:o,style:l})=>t.createElement("h3",{className:(0,r.default)(e,a),style:Object.assign({width:o},l)});function $(e){return e&&"object"==typeof e?e:{}}let v=e=>{let{prefixCls:o,loading:n,className:i,rootClassName:s,style:d,children:c,avatar:g=!1,title:m=!0,paragraph:u=!0,active:b,round:p}=e,{getPrefixCls:f,direction:v,className:y,style:O}=(0,a.useComponentConfig)("skeleton"),k=f("skeleton",o),[j,w,N]=h(k);if(n||!("loading"in e)){let e,a,o=!!g,n=!!m,c=!!u;if(o){let r=Object.assign(Object.assign({prefixCls:`${k}-avatar`},n&&!c?{size:"large",shape:"square"}:{size:"large",shape:"circle"}),$(g));e=t.createElement("div",{className:`${k}-header`},t.createElement(l,Object.assign({},r)))}if(n||c){let e,r;if(n){let r=Object.assign(Object.assign({prefixCls:`${k}-title`},!o&&c?{width:"38%"}:o&&c?{width:"50%"}:{}),$(m));e=t.createElement(C,Object.assign({},r))}if(c){let e,a=Object.assign(Object.assign({prefixCls:`${k}-paragraph`},(e={},o&&n||(e.width="61%"),!o&&n?e.rows=3:e.rows=2,e)),$(u));r=t.createElement(x,Object.assign({},a))}a=t.createElement("div",{className:`${k}-content`},e,r)}let f=(0,r.default)(k,{[`${k}-with-avatar`]:o,[`${k}-active`]:b,[`${k}-rtl`]:"rtl"===v,[`${k}-round`]:p},y,i,s,w,N);return j(t.createElement("div",{className:f,style:Object.assign(Object.assign({},O),d)},e,a))}return null!=c?c:null};v.Button=e=>{let{prefixCls:n,className:i,rootClassName:s,active:d,block:c=!1,size:g="default"}=e,{getPrefixCls:m}=t.useContext(a.ConfigContext),u=m("skeleton",n),[b,p,f]=h(u),x=(0,o.default)(e,["prefixCls"]),C=(0,r.default)(u,`${u}-element`,{[`${u}-active`]:d,[`${u}-block`]:c},i,s,p,f);return b(t.createElement("div",{className:C},t.createElement(l,Object.assign({prefixCls:`${u}-button`,size:g},x))))},v.Avatar=e=>{let{prefixCls:n,className:i,rootClassName:s,active:d,shape:c="circle",size:g="default"}=e,{getPrefixCls:m}=t.useContext(a.ConfigContext),u=m("skeleton",n),[b,p,f]=h(u),x=(0,o.default)(e,["prefixCls","className"]),C=(0,r.default)(u,`${u}-element`,{[`${u}-active`]:d},i,s,p,f);return b(t.createElement("div",{className:C},t.createElement(l,Object.assign({prefixCls:`${u}-avatar`,shape:c,size:g},x))))},v.Input=e=>{let{prefixCls:n,className:i,rootClassName:s,active:d,block:c,size:g="default"}=e,{getPrefixCls:m}=t.useContext(a.ConfigContext),u=m("skeleton",n),[b,p,f]=h(u),x=(0,o.default)(e,["prefixCls"]),C=(0,r.default)(u,`${u}-element`,{[`${u}-active`]:d,[`${u}-block`]:c},i,s,p,f);return b(t.createElement("div",{className:C},t.createElement(l,Object.assign({prefixCls:`${u}-input`,size:g},x))))},v.Image=e=>{let{prefixCls:o,className:l,rootClassName:n,style:i,active:s}=e,{getPrefixCls:d}=t.useContext(a.ConfigContext),c=d("skeleton",o),[g,m,u]=h(c),b=(0,r.default)(c,`${c}-element`,{[`${c}-active`]:s},l,n,m,u);return g(t.createElement("div",{className:b},t.createElement("div",{className:(0,r.default)(`${c}-image`,l),style:i},t.createElement("svg",{viewBox:"0 0 1098 1024",xmlns:"http://www.w3.org/2000/svg",className:`${c}-image-svg`},t.createElement("title",null,"Image placeholder"),t.createElement("path",{d:"M365.714286 329.142857q0 45.714286-32.036571 77.677714t-77.677714 32.036571-77.677714-32.036571-32.036571-77.677714 32.036571-77.677714 77.677714-32.036571 77.677714 32.036571 32.036571 77.677714zM950.857143 548.571429l0 256-804.571429 0 0-109.714286 182.857143-182.857143 91.428571 91.428571 292.571429-292.571429zM1005.714286 146.285714l-914.285714 0q-7.460571 0-12.873143 5.412571t-5.412571 12.873143l0 694.857143q0 7.460571 5.412571 12.873143t12.873143 5.412571l914.285714 0q7.460571 0 12.873143-5.412571t5.412571-12.873143l0-694.857143q0-7.460571-5.412571-12.873143t-12.873143-5.412571zM1097.142857 164.571429l0 694.857143q0 37.741714-26.843429 64.585143t-64.585143 26.843429l-914.285714 0q-37.741714 0-64.585143-26.843429t-26.843429-64.585143l0-694.857143q0-37.741714 26.843429-64.585143t64.585143-26.843429l914.285714 0q37.741714 0 64.585143 26.843429t26.843429 64.585143z",className:`${c}-image-path`})))))},v.Node=e=>{let{prefixCls:o,className:l,rootClassName:n,style:i,active:s,children:d}=e,{getPrefixCls:c}=t.useContext(a.ConfigContext),g=c("skeleton",o),[m,u,b]=h(g),p=(0,r.default)(g,`${g}-element`,{[`${g}-active`]:s},u,l,n,b);return m(t.createElement("div",{className:p},t.createElement("div",{className:(0,r.default)(`${g}-image`,l),style:i},d)))},e.s(["default",0,v],185793)},599724,936325,e=>{"use strict";var t=e.i(95779),r=e.i(444755),a=e.i(673706),o=e.i(271645);let l=o.default.forwardRef((e,l)=>{let{color:n,className:i,children:s}=e;return o.default.createElement("p",{ref:l,className:(0,r.tremorTwMerge)("text-tremor-default",n?(0,a.getColorClassNames)(n,t.colorPalette.text).textColor:(0,r.tremorTwMerge)("text-tremor-content","dark:text-dark-tremor-content"),i)},s)});l.displayName="Text",e.s(["default",()=>l],936325),e.s(["Text",()=>l],599724)},304967,e=>{"use strict";var t=e.i(290571),r=e.i(271645),a=e.i(480731),o=e.i(95779),l=e.i(444755),n=e.i(673706);let i=(0,n.makeClassName)("Card"),s=r.default.forwardRef((e,s)=>{let{decoration:d="",decorationColor:c,children:g,className:m}=e,u=(0,t.__rest)(e,["decoration","decorationColor","children","className"]);return r.default.createElement("div",Object.assign({ref:s,className:(0,l.tremorTwMerge)(i("root"),"relative w-full text-left ring-1 rounded-tremor-default p-6","bg-tremor-background ring-tremor-ring shadow-tremor-card","dark:bg-dark-tremor-background dark:ring-dark-tremor-ring dark:shadow-dark-tremor-card",c?(0,n.getColorClassNames)(c,o.colorPalette.border).borderColor:"border-tremor-brand dark:border-dark-tremor-brand",(e=>{if(!e)return"";switch(e){case a.HorizontalPositions.Left:return"border-l-4";case a.VerticalPositions.Top:return"border-t-4";case a.HorizontalPositions.Right:return"border-r-4";case a.VerticalPositions.Bottom:return"border-b-4";default:return""}})(d),m)},u),g)});s.displayName="Card",e.s(["Card",()=>s],304967)},994388,e=>{"use strict";var t=e.i(290571),r=e.i(829087),a=e.i(271645);let o=["preEnter","entering","entered","preExit","exiting","exited","unmounted"],l=e=>({_s:e,status:o[e],isEnter:e<3,isMounted:6!==e,isResolved:2===e||e>4}),n=e=>e?6:5,i=(e,t,r,a,o)=>{clearTimeout(a.current);let n=l(e);t(n),r.current=n,o&&o({current:n})};var s=e.i(480731),d=e.i(444755),c=e.i(673706);let g=e=>{var r=(0,t.__rest)(e,[]);return a.default.createElement("svg",Object.assign({},r,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"}),a.default.createElement("path",{fill:"none",d:"M0 0h24v24H0z"}),a.default.createElement("path",{d:"M18.364 5.636L16.95 7.05A7 7 0 1 0 19 12h2a9 9 0 1 1-2.636-6.364z"}))};var m=e.i(95779);let u={xs:{height:"h-4",width:"w-4"},sm:{height:"h-5",width:"w-5"},md:{height:"h-5",width:"w-5"},lg:{height:"h-6",width:"w-6"},xl:{height:"h-6",width:"w-6"}},b=(e,t)=>{switch(e){case"primary":return{textColor:t?(0,c.getColorClassNames)("white").textColor:"text-tremor-brand-inverted dark:text-dark-tremor-brand-inverted",hoverTextColor:t?(0,c.getColorClassNames)("white").textColor:"text-tremor-brand-inverted dark:text-dark-tremor-brand-inverted",bgColor:t?(0,c.getColorClassNames)(t,m.colorPalette.background).bgColor:"bg-tremor-brand dark:bg-dark-tremor-brand",hoverBgColor:t?(0,c.getColorClassNames)(t,m.colorPalette.darkBackground).hoverBgColor:"hover:bg-tremor-brand-emphasis dark:hover:bg-dark-tremor-brand-emphasis",borderColor:t?(0,c.getColorClassNames)(t,m.colorPalette.border).borderColor:"border-tremor-brand dark:border-dark-tremor-brand",hoverBorderColor:t?(0,c.getColorClassNames)(t,m.colorPalette.darkBorder).hoverBorderColor:"hover:border-tremor-brand-emphasis dark:hover:border-dark-tremor-brand-emphasis"};case"secondary":return{textColor:t?(0,c.getColorClassNames)(t,m.colorPalette.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",hoverTextColor:t?(0,c.getColorClassNames)(t,m.colorPalette.text).textColor:"hover:text-tremor-brand-emphasis dark:hover:text-dark-tremor-brand-emphasis",bgColor:(0,c.getColorClassNames)("transparent").bgColor,hoverBgColor:t?(0,d.tremorTwMerge)((0,c.getColorClassNames)(t,m.colorPalette.background).hoverBgColor,"hover:bg-opacity-20 dark:hover:bg-opacity-20"):"hover:bg-tremor-brand-faint dark:hover:bg-dark-tremor-brand-faint",borderColor:t?(0,c.getColorClassNames)(t,m.colorPalette.border).borderColor:"border-tremor-brand dark:border-dark-tremor-brand"};case"light":return{textColor:t?(0,c.getColorClassNames)(t,m.colorPalette.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",hoverTextColor:t?(0,c.getColorClassNames)(t,m.colorPalette.darkText).hoverTextColor:"hover:text-tremor-brand-emphasis dark:hover:text-dark-tremor-brand-emphasis",bgColor:(0,c.getColorClassNames)("transparent").bgColor,borderColor:"",hoverBorderColor:""}}},p=(0,c.makeClassName)("Button"),f=({loading:e,iconSize:t,iconPosition:r,Icon:o,needMargin:l,transitionStatus:n})=>{let i=l?r===s.HorizontalPositions.Left?(0,d.tremorTwMerge)("-ml-1","mr-1.5"):(0,d.tremorTwMerge)("-mr-1","ml-1.5"):"",c=(0,d.tremorTwMerge)("w-0 h-0"),m={default:c,entering:c,entered:t,exiting:t,exited:c};return e?a.default.createElement(g,{className:(0,d.tremorTwMerge)(p("icon"),"animate-spin shrink-0",i,m.default,m[n]),style:{transition:"width 150ms"}}):a.default.createElement(o,{className:(0,d.tremorTwMerge)(p("icon"),"shrink-0",t,i)})},h=a.default.forwardRef((e,o)=>{let{icon:g,iconPosition:m=s.HorizontalPositions.Left,size:h=s.Sizes.SM,color:x,variant:C="primary",disabled:$,loading:v=!1,loadingText:y,children:O,tooltip:k,className:j}=e,w=(0,t.__rest)(e,["icon","iconPosition","size","color","variant","disabled","loading","loadingText","children","tooltip","className"]),N=v||$,S=void 0!==g||v,E=v&&y,T=!(!O&&!E),z=(0,d.tremorTwMerge)(u[h].height,u[h].width),P="light"!==C?(0,d.tremorTwMerge)("rounded-tremor-default border","shadow-tremor-input","dark:shadow-dark-tremor-input"):"",B=b(C,x),M=("light"!==C?{xs:{paddingX:"px-2.5",paddingY:"py-1.5",fontSize:"text-xs"},sm:{paddingX:"px-4",paddingY:"py-2",fontSize:"text-sm"},md:{paddingX:"px-4",paddingY:"py-2",fontSize:"text-md"},lg:{paddingX:"px-4",paddingY:"py-2.5",fontSize:"text-lg"},xl:{paddingX:"px-4",paddingY:"py-3",fontSize:"text-xl"}}:{xs:{paddingX:"",paddingY:"",fontSize:"text-xs"},sm:{paddingX:"",paddingY:"",fontSize:"text-sm"},md:{paddingX:"",paddingY:"",fontSize:"text-md"},lg:{paddingX:"",paddingY:"",fontSize:"text-lg"},xl:{paddingX:"",paddingY:"",fontSize:"text-xl"}})[h],{tooltipProps:R,getReferenceProps:H}=(0,r.useTooltip)(300),[L,I]=(({enter:e=!0,exit:t=!0,preEnter:r,preExit:o,timeout:s,initialEntered:d,mountOnEnter:c,unmountOnExit:g,onStateChange:m}={})=>{let[u,b]=(0,a.useState)(()=>l(d?2:n(c))),p=(0,a.useRef)(u),f=(0,a.useRef)(0),[h,x]="object"==typeof s?[s.enter,s.exit]:[s,s],C=(0,a.useCallback)(()=>{let e=((e,t)=>{switch(e){case 1:case 0:return 2;case 4:case 3:return n(t)}})(p.current._s,g);e&&i(e,b,p,f,m)},[m,g]);return[u,(0,a.useCallback)(a=>{let l=e=>{switch(i(e,b,p,f,m),e){case 1:h>=0&&(f.current=((...e)=>setTimeout(...e))(C,h));break;case 4:x>=0&&(f.current=((...e)=>setTimeout(...e))(C,x));break;case 0:case 3:f.current=((...e)=>setTimeout(...e))(()=>{isNaN(document.body.offsetTop)||l(e+1)},0)}},s=p.current.isEnter;"boolean"!=typeof a&&(a=!s),a?s||l(e?+!r:2):s&&l(t?o?3:4:n(g))},[C,m,e,t,r,o,h,x,g]),C]})({timeout:50});return(0,a.useEffect)(()=>{I(v)},[v]),a.default.createElement("button",Object.assign({ref:(0,c.mergeRefs)([o,R.refs.setReference]),className:(0,d.tremorTwMerge)(p("root"),"shrink-0 inline-flex justify-center items-center group font-medium outline-none",P,M.paddingX,M.paddingY,M.fontSize,B.textColor,B.bgColor,B.borderColor,B.hoverBorderColor,N?"opacity-50 cursor-not-allowed":(0,d.tremorTwMerge)(b(C,x).hoverTextColor,b(C,x).hoverBgColor,b(C,x).hoverBorderColor),j),disabled:N},H,w),a.default.createElement(r.default,Object.assign({text:k},R)),S&&m!==s.HorizontalPositions.Right?a.default.createElement(f,{loading:v,iconSize:z,iconPosition:m,Icon:g,transitionStatus:L.status,needMargin:T}):null,E||O?a.default.createElement("span",{className:(0,d.tremorTwMerge)(p("text"),"text-tremor-default whitespace-nowrap")},E?y:O):null,S&&m===s.HorizontalPositions.Right?a.default.createElement(f,{loading:v,iconSize:z,iconPosition:m,Icon:g,transitionStatus:L.status,needMargin:T}):null)});h.displayName="Button",e.s(["Button",()=>h],994388)},269200,e=>{"use strict";var t=e.i(290571),r=e.i(271645),a=e.i(444755);let o=(0,e.i(673706).makeClassName)("Table"),l=r.default.forwardRef((e,l)=>{let{children:n,className:i}=e,s=(0,t.__rest)(e,["children","className"]);return r.default.createElement("div",{className:(0,a.tremorTwMerge)(o("root"),"overflow-auto",i)},r.default.createElement("table",Object.assign({ref:l,className:(0,a.tremorTwMerge)(o("table"),"w-full text-tremor-default","text-tremor-content","dark:text-dark-tremor-content")},s),n))});l.displayName="Table",e.s(["Table",()=>l],269200)},427612,e=>{"use strict";var t=e.i(290571),r=e.i(271645),a=e.i(444755);let o=(0,e.i(673706).makeClassName)("TableHead"),l=r.default.forwardRef((e,l)=>{let{children:n,className:i}=e,s=(0,t.__rest)(e,["children","className"]);return r.default.createElement(r.default.Fragment,null,r.default.createElement("thead",Object.assign({ref:l,className:(0,a.tremorTwMerge)(o("root"),"text-left","text-tremor-content","dark:text-dark-tremor-content",i)},s),n))});l.displayName="TableHead",e.s(["TableHead",()=>l],427612)},496020,e=>{"use strict";var t=e.i(290571),r=e.i(271645),a=e.i(444755);let o=(0,e.i(673706).makeClassName)("TableRow"),l=r.default.forwardRef((e,l)=>{let{children:n,className:i}=e,s=(0,t.__rest)(e,["children","className"]);return r.default.createElement(r.default.Fragment,null,r.default.createElement("tr",Object.assign({ref:l,className:(0,a.tremorTwMerge)(o("row"),i)},s),n))});l.displayName="TableRow",e.s(["TableRow",()=>l],496020)},64848,e=>{"use strict";var t=e.i(290571),r=e.i(271645),a=e.i(444755);let o=(0,e.i(673706).makeClassName)("TableHeaderCell"),l=r.default.forwardRef((e,l)=>{let{children:n,className:i}=e,s=(0,t.__rest)(e,["children","className"]);return r.default.createElement(r.default.Fragment,null,r.default.createElement("th",Object.assign({ref:l,className:(0,a.tremorTwMerge)(o("root"),"whitespace-nowrap text-left font-semibold top-0 px-4 py-3.5","text-tremor-content-strong","dark:text-dark-tremor-content-strong",i)},s),n))});l.displayName="TableHeaderCell",e.s(["TableHeaderCell",()=>l],64848)},977572,e=>{"use strict";var t=e.i(290571),r=e.i(271645),a=e.i(444755);let o=(0,e.i(673706).makeClassName)("TableCell"),l=r.default.forwardRef((e,l)=>{let{children:n,className:i}=e,s=(0,t.__rest)(e,["children","className"]);return r.default.createElement(r.default.Fragment,null,r.default.createElement("td",Object.assign({ref:l,className:(0,a.tremorTwMerge)(o("root"),"align-middle whitespace-nowrap text-left p-4",i)},s),n))});l.displayName="TableCell",e.s(["TableCell",()=>l],977572)},942232,e=>{"use strict";var t=e.i(290571),r=e.i(271645),a=e.i(444755);let o=(0,e.i(673706).makeClassName)("TableBody"),l=r.default.forwardRef((e,l)=>{let{children:n,className:i}=e,s=(0,t.__rest)(e,["children","className"]);return r.default.createElement(r.default.Fragment,null,r.default.createElement("tbody",Object.assign({ref:l,className:(0,a.tremorTwMerge)(o("root"),"align-top divide-y","divide-tremor-border","dark:divide-dark-tremor-border",i)},s),n))});l.displayName="TableBody",e.s(["TableBody",()=>l],942232)},68155,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"}))});e.s(["TrashIcon",0,r],68155)},728889,e=>{"use strict";var t=e.i(290571),r=e.i(271645),a=e.i(829087),o=e.i(480731),l=e.i(444755),n=e.i(673706),i=e.i(95779);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"}},d={xs:{height:"h-3",width:"w-3"},sm:{height:"h-5",width:"w-5"},md:{height:"h-5",width:"w-5"},lg:{height:"h-7",width:"w-7"},xl:{height:"h-9",width:"w-9"}},c={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:""}},g=(0,n.makeClassName)("Icon"),m=r.default.forwardRef((e,m)=>{let{icon:u,variant:b="simple",tooltip:p,size:f=o.Sizes.SM,color:h,className:x}=e,C=(0,t.__rest)(e,["icon","variant","tooltip","size","color","className"]),$=((e,t)=>{switch(e){case"simple":return{textColor:t?(0,n.getColorClassNames)(t,i.colorPalette.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:"",borderColor:"",ringColor:""};case"light":return{textColor:t?(0,n.getColorClassNames)(t,i.colorPalette.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:t?(0,l.tremorTwMerge)((0,n.getColorClassNames)(t,i.colorPalette.background).bgColor,"bg-opacity-20"):"bg-tremor-brand-muted dark:bg-dark-tremor-brand-muted",borderColor:"",ringColor:""};case"shadow":return{textColor:t?(0,n.getColorClassNames)(t,i.colorPalette.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:t?(0,l.tremorTwMerge)((0,n.getColorClassNames)(t,i.colorPalette.background).bgColor,"bg-opacity-20"):"bg-tremor-background dark:bg-dark-tremor-background",borderColor:"border-tremor-border dark:border-dark-tremor-border",ringColor:""};case"solid":return{textColor:t?(0,n.getColorClassNames)(t,i.colorPalette.text).textColor:"text-tremor-brand-inverted dark:text-dark-tremor-brand-inverted",bgColor:t?(0,l.tremorTwMerge)((0,n.getColorClassNames)(t,i.colorPalette.background).bgColor,"bg-opacity-20"):"bg-tremor-brand dark:bg-dark-tremor-brand",borderColor:"border-tremor-brand-inverted dark:border-dark-tremor-brand-inverted",ringColor:"ring-tremor-ring dark:ring-dark-tremor-ring"};case"outlined":return{textColor:t?(0,n.getColorClassNames)(t,i.colorPalette.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:t?(0,l.tremorTwMerge)((0,n.getColorClassNames)(t,i.colorPalette.background).bgColor,"bg-opacity-20"):"bg-tremor-background dark:bg-dark-tremor-background",borderColor:t?(0,n.getColorClassNames)(t,i.colorPalette.ring).borderColor:"border-tremor-brand-subtle dark:border-dark-tremor-brand-subtle",ringColor:t?(0,l.tremorTwMerge)((0,n.getColorClassNames)(t,i.colorPalette.ring).ringColor,"ring-opacity-40"):"ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted"}}})(b,h),{tooltipProps:v,getReferenceProps:y}=(0,a.useTooltip)();return r.default.createElement("span",Object.assign({ref:(0,n.mergeRefs)([m,v.refs.setReference]),className:(0,l.tremorTwMerge)(g("root"),"inline-flex shrink-0 items-center justify-center",$.bgColor,$.textColor,$.borderColor,$.ringColor,c[b].rounded,c[b].border,c[b].shadow,c[b].ring,s[f].paddingX,s[f].paddingY,x)},y,C),r.default.createElement(a.default,Object.assign({text:p},v)),r.default.createElement(u,{className:(0,l.tremorTwMerge)(g("icon"),"shrink-0",d[f].height,d[f].width)}))});m.displayName="Icon",e.s(["default",()=>m],728889)},752978,e=>{"use strict";var t=e.i(728889);e.s(["Icon",()=>t.default])}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/12cfe6b38b49e029.js b/litellm/proxy/_experimental/out/_next/static/chunks/12cfe6b38b49e029.js deleted file mode 100644 index 2a7d4a866fb..00000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/12cfe6b38b49e029.js +++ /dev/null @@ -1 +0,0 @@ -(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,988297,e=>{"use strict";var s=e.i(271645);let a=s.forwardRef(function(e,a){return s.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:a},e),s.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4v16m8-8H4"}))});e.s(["PlusIcon",0,a],988297)},500727,e=>{"use strict";var s=e.i(266027),a=e.i(243652),t=e.i(764205),l=e.i(135214);let r=(0,a.createQueryKeys)("mcpServers");e.s(["useMCPServers",0,()=>{let{accessToken:e}=(0,l.default)();return(0,s.useQuery)({queryKey:r.list({}),queryFn:async()=>await (0,t.fetchMCPServers)(e),enabled:!!e})}])},841947,e=>{"use strict";let s=(0,e.i(475254).default)("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);e.s(["default",()=>s])},916940,e=>{"use strict";var s=e.i(843476),a=e.i(271645),t=e.i(199133),l=e.i(764205);e.s(["default",0,({onChange:e,value:r,className:i,accessToken:n,placeholder:c="Select vector stores",disabled:o=!1})=>{let[d,u]=(0,a.useState)([]),[m,p]=(0,a.useState)(!1);return(0,a.useEffect)(()=>{(async()=>{if(n){p(!0);try{let e=await (0,l.vectorStoreListCall)(n);e.data&&u(e.data)}catch(e){console.error("Error fetching vector stores:",e)}finally{p(!1)}}})()},[n]),(0,s.jsx)("div",{children:(0,s.jsx)(t.Select,{mode:"multiple",placeholder:c,onChange:e,value:r,loading:m,className:i,allowClear:!0,options:d.map(e=>({label:`${e.vector_store_name||e.vector_store_id} (${e.vector_store_id})`,value:e.vector_store_id,title:e.vector_store_description||e.vector_store_id})),optionFilterProp:"label",showSearch:!0,style:{width:"100%"},disabled:o})})}])},797672,e=>{"use strict";var s=e.i(271645);let a=s.forwardRef(function(e,a){return s.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:a},e),s.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"}))});e.s(["PencilIcon",0,a],797672)},653496,e=>{"use strict";var s=e.i(721369);e.s(["Tabs",()=>s.default])},689020,e=>{"use strict";var s=e.i(764205);let a=async e=>{try{let a=await (0,s.modelHubCall)(e);if(console.log("model_info:",a),a?.data.length>0){let e=a.data.map(e=>({model_group:e.model_group,mode:e?.mode}));return e.sort((e,s)=>e.model_group.localeCompare(s.model_group)),e}return[]}catch(e){throw console.error("Error fetching model info:",e),e}};e.s(["fetchAvailableModels",0,a])},981339,e=>{"use strict";var s=e.i(185793);e.s(["Skeleton",()=>s.default])},500330,e=>{"use strict";var s=e.i(727749);function a(e,s){let a=structuredClone(e);for(let[e,t]of Object.entries(s))e in a&&(a[e]=t);return a}let t=(e,s=0,a=!1,t=!0)=>{if(null==e||!Number.isFinite(e)||0===e&&!t)return"-";let l={minimumFractionDigits:s,maximumFractionDigits:s};if(!a)return e.toLocaleString("en-US",l);let r=e<0?"-":"",i=Math.abs(e),n=i,c="";return i>=1e6?(n=i/1e6,c="M"):i>=1e3&&(n=i/1e3,c="K"),`${r}${n.toLocaleString("en-US",l)}${c}`},l=async(e,a="Copied to clipboard")=>{if(!e)return!1;if(!navigator||!navigator.clipboard||!navigator.clipboard.writeText)return r(e,a);try{return await navigator.clipboard.writeText(e),s.default.success(a),!0}catch(s){return console.error("Clipboard API failed: ",s),r(e,a)}},r=(e,a)=>{try{let t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.left="-999999px",t.style.top="-999999px",t.setAttribute("readonly",""),document.body.appendChild(t),t.focus(),t.select();let l=document.execCommand("copy");if(document.body.removeChild(t),l)return s.default.success(a),!0;throw Error("execCommand failed")}catch(e){return s.default.fromBackend("Failed to copy to clipboard"),console.error("Failed to copy: ",e),!1}};e.s(["copyToClipboard",0,l,"formatNumberWithCommas",0,t,"getSpendString",0,(e,s=6)=>{if(null==e||!Number.isFinite(e)||0===e)return"-";let a=t(e,s,!1,!1);if(0===Number(a.replace(/,/g,""))){let e=(1/10**s).toFixed(s);return`< $${e}`}return`$${a}`},"updateExistingKeys",()=>a])},9314,263147,e=>{"use strict";var s=e.i(843476),a=e.i(199133),t=e.i(981339),l=e.i(645526),r=e.i(599724),i=e.i(266027),n=e.i(243652),c=e.i(764205),o=e.i(708347),d=e.i(135214);let u=(0,n.createQueryKeys)("accessGroups"),m=async e=>{let s=(0,c.getProxyBaseUrl)(),a=`${s}/v1/access_group`,t=await fetch(a,{method:"GET",headers:{[(0,c.getGlobalLitellmHeaderName)()]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!t.ok){let e=await t.json(),s=(0,c.deriveErrorMessage)(e);throw(0,c.handleError)(s),Error(s)}return t.json()},p=()=>{let{accessToken:e,userRole:s}=(0,d.default)();return(0,i.useQuery)({queryKey:u.list({}),queryFn:async()=>m(e),enabled:!!e&&o.all_admin_roles.includes(s||"")})};e.s(["accessGroupKeys",0,u,"useAccessGroups",0,p],263147),e.s(["default",0,({value:e,onChange:i,placeholder:n="Select access groups",disabled:c=!1,style:o,className:d,showLabel:u=!1,labelText:m="Access Group",allowClear:g=!0})=>{let{data:x,isLoading:h,isError:f}=p();if(h)return(0,s.jsxs)("div",{children:[u&&(0,s.jsxs)(r.Text,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,s.jsx)(l.TeamOutlined,{className:"mr-2"})," ",m]}),(0,s.jsx)(t.Skeleton.Input,{active:!0,block:!0,style:{height:32,...o}})]});let b=(x??[]).map(e=>({label:(0,s.jsxs)("span",{children:[(0,s.jsx)("span",{className:"font-medium",children:e.access_group_name})," ",(0,s.jsxs)("span",{className:"text-gray-400 text-xs",children:["(",e.access_group_id,")"]})]}),value:e.access_group_id,selectedLabel:e.access_group_name,searchText:`${e.access_group_name} ${e.access_group_id}`}));return(0,s.jsxs)("div",{children:[u&&(0,s.jsxs)(r.Text,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,s.jsx)(l.TeamOutlined,{className:"mr-2"})," ",m]}),(0,s.jsx)(a.Select,{mode:"multiple",value:e,placeholder:n,onChange:i,disabled:c,allowClear:g,showSearch:!0,style:{width:"100%",...o},className:`rounded-md ${d??""}`,notFoundContent:f?(0,s.jsx)("span",{className:"text-red-500",children:"Failed to load access groups"}):"No access groups found",filterOption:(e,s)=>(b.find(e=>e.value===s?.value)?.searchText??"").toLowerCase().includes(e.toLowerCase()),optionLabelProp:"selectedLabel",options:b.map(e=>({label:e.label,value:e.value,selectedLabel:e.selectedLabel}))})]})}],9314)},552130,e=>{"use strict";var s=e.i(843476),a=e.i(271645),t=e.i(199133),l=e.i(764205);e.s(["default",0,({onChange:e,value:r,className:i,accessToken:n,placeholder:c="Select agents",disabled:o=!1})=>{let[d,u]=(0,a.useState)([]),[m,p]=(0,a.useState)([]),[g,x]=(0,a.useState)(!1);(0,a.useEffect)(()=>{(async()=>{if(n){x(!0);try{let e=await (0,l.getAgentsList)(n),s=e?.agents||[];u(s);let a=new Set;s.forEach(e=>{let s=e.agent_access_groups;s&&Array.isArray(s)&&s.forEach(e=>a.add(e))}),p(Array.from(a))}catch(e){console.error("Error fetching agents:",e)}finally{x(!1)}}})()},[n]);let h=[...m.map(e=>({label:e,value:`group:${e}`,isAccessGroup:!0,searchText:`${e} Access Group`})),...d.map(e=>({label:`${e.agent_name||e.agent_id}`,value:e.agent_id,isAccessGroup:!1,searchText:`${e.agent_name||e.agent_id} ${e.agent_id} Agent`}))],f=[...r?.agents||[],...(r?.accessGroups||[]).map(e=>`group:${e}`)];return(0,s.jsx)("div",{children:(0,s.jsx)(t.Select,{mode:"multiple",placeholder:c,onChange:s=>{e({agents:s.filter(e=>!e.startsWith("group:")),accessGroups:s.filter(e=>e.startsWith("group:")).map(e=>e.replace("group:",""))})},value:f,loading:g,className:i,allowClear:!0,showSearch:!0,style:{width:"100%"},disabled:o,filterOption:(e,s)=>(h.find(e=>e.value===s?.value)?.searchText||"").toLowerCase().includes(e.toLowerCase()),children:h.map(e=>(0,s.jsx)(t.Select.Option,{value:e.value,label:e.label,children:(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[(0,s.jsx)("span",{style:{display:"inline-block",width:8,height:8,borderRadius:"50%",background:e.isAccessGroup?"#52c41a":"#722ed1",flexShrink:0}}),(0,s.jsx)("span",{style:{flex:1},children:e.label}),(0,s.jsx)("span",{style:{color:e.isAccessGroup?"#52c41a":"#722ed1",fontSize:"12px",fontWeight:500,opacity:.8},children:e.isAccessGroup?"Access Group":"Agent"})]})},e.value))})})}])},844565,e=>{"use strict";var s=e.i(843476),a=e.i(271645),t=e.i(199133),l=e.i(764205);e.s(["default",0,({onChange:e,value:r,className:i,accessToken:n,placeholder:c="Select pass through routes",disabled:o=!1,teamId:d})=>{let[u,m]=(0,a.useState)([]),[p,g]=(0,a.useState)(!1);return(0,a.useEffect)(()=>{(async()=>{if(n){g(!0);try{let e=await (0,l.getPassThroughEndpointsCall)(n,d);if(e.endpoints){let s=e.endpoints.flatMap(e=>{let s=e.path,a=e.methods;return a&&a.length>0?a.map(e=>({label:`${e} ${s}`,value:s})):[{label:s,value:s}]});m(s)}}catch(e){console.error("Error fetching pass through routes:",e)}finally{g(!1)}}})()},[n,d]),(0,s.jsx)(t.Select,{mode:"tags",placeholder:c,onChange:e,value:r,loading:p,className:i,allowClear:!0,options:u,optionFilterProp:"label",showSearch:!0,style:{width:"100%"},disabled:o})}])},810757,477386,e=>{"use strict";var s=e.i(271645);let a=s.forwardRef(function(e,a){return s.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:a},e),s.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),s.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}))});e.s(["CogIcon",0,a],810757);let t=s.forwardRef(function(e,a){return s.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:a},e),s.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M18.364 18.364A9 9 0 005.636 5.636m12.728 12.728A9 9 0 015.636 5.636m12.728 12.728L5.636 5.636"}))});e.s(["BanIcon",0,t],477386)},557662,e=>{"use strict";let s="../ui/assets/logos/",a=[{id:"arize",displayName:"Arize",logo:`${s}arize.png`,supports_key_team_logging:!0,dynamic_params:{arize_api_key:"password",arize_space_id:"password"},description:"Arize Logging Integration"},{id:"braintrust",displayName:"Braintrust",logo:`${s}braintrust.png`,supports_key_team_logging:!1,dynamic_params:{braintrust_api_key:"password",braintrust_project_name:"text"},description:"Braintrust Logging Integration"},{id:"custom_callback_api",displayName:"Custom Callback API",logo:`${s}custom.svg`,supports_key_team_logging:!0,dynamic_params:{custom_callback_api_url:"text",custom_callback_api_headers:"text"},description:"Custom Callback API Logging Integration"},{id:"datadog",displayName:"Datadog",logo:`${s}datadog.png`,supports_key_team_logging:!1,dynamic_params:{dd_api_key:"password",dd_site:"text"},description:"Datadog Logging Integration"},{id:"lago",displayName:"Lago",logo:`${s}lago.svg`,supports_key_team_logging:!1,dynamic_params:{lago_api_url:"text",lago_api_key:"password"},description:"Lago Billing Logging Integration"},{id:"langfuse",displayName:"Langfuse",logo:`${s}langfuse.png`,supports_key_team_logging:!0,dynamic_params:{langfuse_public_key:"text",langfuse_secret_key:"password",langfuse_host:"text"},description:"Langfuse v2 Logging Integration"},{id:"langfuse_otel",displayName:"Langfuse OTEL",logo:`${s}langfuse.png`,supports_key_team_logging:!0,dynamic_params:{langfuse_public_key:"text",langfuse_secret_key:"password",langfuse_host:"text"},description:"Langfuse v3 OTEL Logging Integration"},{id:"langsmith",displayName:"LangSmith",logo:`${s}langsmith.png`,supports_key_team_logging:!0,dynamic_params:{langsmith_api_key:"password",langsmith_project:"text",langsmith_base_url:"text",langsmith_sampling_rate:"number"},description:"Langsmith Logging Integration"},{id:"openmeter",displayName:"OpenMeter",logo:`${s}openmeter.png`,supports_key_team_logging:!1,dynamic_params:{openmeter_api_key:"password",openmeter_base_url:"text"},description:"OpenMeter Logging Integration"},{id:"otel",displayName:"Open Telemetry",logo:`${s}otel.png`,supports_key_team_logging:!1,dynamic_params:{otel_endpoint:"text",otel_headers:"text"},description:"OpenTelemetry Logging Integration"},{id:"s3",displayName:"S3",logo:`${s}aws.svg`,supports_key_team_logging:!1,dynamic_params:{s3_bucket_name:"text",aws_access_key_id:"password",aws_secret_access_key:"password",aws_region:"text"},description:"S3 Bucket (AWS) Logging Integration"},{id:"SQS",displayName:"SQS",logo:`${s}aws.svg`,supports_key_team_logging:!1,dynamic_params:{sqs_queue_url:"text",aws_access_key_id:"password",aws_secret_access_key:"password",aws_region:"text"},description:"SQS Queue (AWS) Logging Integration"}],t=a.reduce((e,s)=>(e[s.displayName]=s,e),{}),l=a.reduce((e,s)=>(e[s.displayName]=s.id,e),{}),r=a.reduce((e,s)=>(e[s.id]=s.displayName,e),{});e.s(["callbackInfo",0,t,"callback_map",0,l,"mapDisplayToInternalNames",0,e=>e.map(e=>l[e]||e),"mapInternalToDisplayNames",0,e=>e.map(e=>r[e]||e),"reverse_callback_map",0,r])},75921,e=>{"use strict";var s=e.i(843476),a=e.i(266027),t=e.i(243652),l=e.i(764205),r=e.i(135214);let i=(0,t.createQueryKeys)("mcpAccessGroups");var n=e.i(500727),c=e.i(199133);e.s(["default",0,({onChange:e,value:t,className:o,accessToken:d,placeholder:u="Select MCP servers",disabled:m=!1})=>{let{data:p=[],isLoading:g}=(0,n.useMCPServers)(),{data:x=[],isLoading:h}=(()=>{let{accessToken:e}=(0,r.default)();return(0,a.useQuery)({queryKey:i.list({}),queryFn:async()=>await (0,l.fetchMCPAccessGroups)(e),enabled:!!e})})(),f=[...x.map(e=>({label:e,value:e,isAccessGroup:!0,searchText:`${e} Access Group`})),...p.map(e=>({label:`${e.server_name||e.server_id} (${e.server_id})`,value:e.server_id,isAccessGroup:!1,searchText:`${e.server_name||e.server_id} ${e.server_id} MCP Server`}))],b=[...t?.servers||[],...t?.accessGroups||[]];return(0,s.jsx)("div",{children:(0,s.jsx)(c.Select,{mode:"multiple",placeholder:u,onChange:s=>{e({servers:s.filter(e=>!x.includes(e)),accessGroups:s.filter(e=>x.includes(e))})},value:b,loading:g||h,className:o,allowClear:!0,showSearch:!0,style:{width:"100%"},disabled:m,filterOption:(e,s)=>(f.find(e=>e.value===s?.value)?.searchText||"").toLowerCase().includes(e.toLowerCase()),children:f.map(e=>(0,s.jsx)(c.Select.Option,{value:e.value,label:e.label,children:(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[(0,s.jsx)("span",{style:{display:"inline-block",width:8,height:8,borderRadius:"50%",background:e.isAccessGroup?"#52c41a":"#1890ff",flexShrink:0}}),(0,s.jsx)("span",{style:{flex:1},children:e.label}),(0,s.jsx)("span",{style:{color:e.isAccessGroup?"#52c41a":"#1890ff",fontSize:"12px",fontWeight:500,opacity:.8},children:e.isAccessGroup?"Access Group":"MCP Server"})]})},e.value))})})}],75921)},390605,995926,e=>{"use strict";var s=e.i(843476),a=e.i(271645),t=e.i(764205),l=e.i(599724),r=e.i(482725),i=e.i(536916),n=e.i(841947);e.s(["XIcon",()=>n.default],995926);var n=n,c=e.i(500727);e.s(["default",0,({accessToken:e,selectedServers:o,toolPermissions:d,onChange:u,disabled:m=!1})=>{let{data:p=[]}=(0,c.useMCPServers)(),[g,x]=(0,a.useState)({}),[h,f]=(0,a.useState)({}),[b,y]=(0,a.useState)({}),v=(0,a.useMemo)(()=>0===o.length?[]:p.filter(e=>o.includes(e.server_id)),[p,o]),_=async s=>{f(e=>({...e,[s]:!0})),y(e=>({...e,[s]:""}));try{let a=await (0,t.listMCPTools)(e,s);a.error?(y(e=>({...e,[s]:a.message||"Failed to fetch tools"})),x(e=>({...e,[s]:[]}))):x(e=>({...e,[s]:a.tools||[]}))}catch(e){console.error(`Error fetching tools for server ${s}:`,e),y(e=>({...e,[s]:"Failed to fetch tools"})),x(e=>({...e,[s]:[]}))}finally{f(e=>({...e,[s]:!1}))}};return((0,a.useEffect)(()=>{v.forEach(e=>{g[e.server_id]||h[e.server_id]||_(e.server_id)})},[v]),0===o.length)?null:(0,s.jsx)("div",{className:"space-y-4",children:v.map(e=>{let a=e.server_name||e.alias||e.server_id,t=g[e.server_id]||[],c=d[e.server_id]||[],o=h[e.server_id],p=b[e.server_id];return(0,s.jsxs)("div",{className:"border rounded-lg bg-gray-50",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between p-4 border-b bg-white rounded-t-lg",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(l.Text,{className:"font-semibold text-gray-900",children:a}),e.description&&(0,s.jsx)(l.Text,{className:"text-sm text-gray-500",children:e.description})]}),(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)("button",{type:"button",className:"text-sm text-blue-600 hover:text-blue-700 font-medium",onClick:()=>{var s;let a;return a=g[s=e.server_id]||[],void u({...d,[s]:a.map(e=>e.name)})},disabled:m||o,children:"Select All"}),(0,s.jsx)("button",{type:"button",className:"text-sm text-blue-600 hover:text-blue-700 font-medium",onClick:()=>{var s;return s=e.server_id,void u({...d,[s]:[]})},disabled:m||o,children:"Deselect All"}),(0,s.jsx)("button",{type:"button",className:"text-gray-400 hover:text-gray-600",onClick:()=>{},children:(0,s.jsx)(n.default,{className:"w-4 h-4"})})]})]}),(0,s.jsxs)("div",{className:"p-4",children:[(0,s.jsx)(l.Text,{className:"text-sm font-medium text-gray-700 mb-3",children:"Available Tools"}),o&&(0,s.jsxs)("div",{className:"flex items-center justify-center py-8",children:[(0,s.jsx)(r.Spin,{size:"large"}),(0,s.jsx)(l.Text,{className:"ml-3 text-gray-500",children:"Loading tools..."})]}),p&&!o&&(0,s.jsxs)("div",{className:"p-4 bg-red-50 border border-red-200 rounded-lg text-center",children:[(0,s.jsx)(l.Text,{className:"text-red-600 font-medium",children:"Unable to load tools"}),(0,s.jsx)(l.Text,{className:"text-sm text-red-500 mt-1",children:p})]}),!o&&!p&&t.length>0&&(0,s.jsx)("div",{className:"space-y-2",children:t.map(a=>{let t=c.includes(a.name);return(0,s.jsxs)("div",{className:"flex items-start gap-2",children:[(0,s.jsx)(i.Checkbox,{checked:t,onChange:()=>{var s,t;let l,r;return s=e.server_id,t=a.name,r=(l=d[s]||[]).includes(t)?l.filter(e=>e!==t):[...l,t],void u({...d,[s]:r})},disabled:m}),(0,s.jsx)("div",{className:"flex-1 min-w-0",children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(l.Text,{className:"font-medium text-gray-900",children:a.name}),(0,s.jsxs)(l.Text,{className:"text-sm text-gray-500",children:["- ",a.description||"No description"]})]})})]},a.name)})}),!o&&!p&&0===t.length&&(0,s.jsx)("div",{className:"text-center py-6",children:(0,s.jsx)(l.Text,{className:"text-gray-500",children:"No tools available"})})]})]},e.server_id)})})}],390605)},266484,e=>{"use strict";var s=e.i(843476),a=e.i(199133),t=e.i(592968),l=e.i(312361),r=e.i(827252),i=e.i(994388),n=e.i(304967),c=e.i(779241),o=e.i(988297),d=e.i(68155),u=e.i(810757),m=e.i(477386),p=e.i(557662),g=e.i(435451);let{Option:x}=a.Select;e.s(["default",0,({value:e=[],onChange:h,disabledCallbacks:f=[],onDisabledCallbacksChange:b})=>{let y=Object.entries(p.callbackInfo).filter(([e,s])=>s.supports_key_team_logging).map(([e,s])=>e),v=Object.keys(p.callbackInfo),_=e=>{h?.(e)},j=(s,a,t)=>{let l=[...e];if("callback_name"===a){let e=p.callback_map[t]||t;l[s]={...l[s],[a]:e,callback_vars:{}}}else l[s]={...l[s],[a]:t};_(l)},N=(s,a,t)=>{let l=[...e];l[s]={...l[s],callback_vars:{...l[s].callback_vars,[a]:t}},_(l)};return(0,s.jsxs)("div",{className:"space-y-6",children:[(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)(m.BanIcon,{className:"w-5 h-5 text-red-500"}),(0,s.jsx)("span",{className:"text-base font-semibold text-gray-800",children:"Disabled Callbacks"}),(0,s.jsx)(t.Tooltip,{title:"Select callbacks to disable for this key. Disabled callbacks will not receive any logging data.",children:(0,s.jsx)(r.InfoCircleOutlined,{className:"text-gray-400 cursor-help"})})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Disabled Callbacks"}),(0,s.jsx)(a.Select,{mode:"multiple",placeholder:"Select callbacks to disable",value:f,onChange:e=>{let s=(0,p.mapDisplayToInternalNames)(e);b?.(s)},style:{width:"100%"},optionLabelProp:"label",children:v.map(e=>{let a=p.callbackInfo[e]?.logo,l=p.callbackInfo[e]?.description;return(0,s.jsx)(x,{value:e,label:e,children:(0,s.jsx)(t.Tooltip,{title:l,placement:"right",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[a&&(0,s.jsx)("img",{src:a,alt:e,className:"w-4 h-4 object-contain",onError:s=>{let a=s.target,t=a.parentElement;if(t){let s=document.createElement("div");s.className="w-4 h-4 rounded-full bg-gray-200 flex items-center justify-center text-xs",s.textContent=e.charAt(0),t.replaceChild(s,a)}}}),(0,s.jsx)("span",{children:e})]})})},e)})}),(0,s.jsx)("div",{className:"text-xs text-gray-500",children:"Select callbacks that should be disabled for this key. These callbacks will not receive any logging data."})]})]}),(0,s.jsx)(l.Divider,{}),(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)(u.CogIcon,{className:"w-5 h-5 text-blue-500"}),(0,s.jsx)("span",{className:"text-base font-semibold text-gray-800",children:"Logging Integrations"}),(0,s.jsx)(t.Tooltip,{title:"Configure callback logging integrations for this team.",children:(0,s.jsx)(r.InfoCircleOutlined,{className:"text-gray-400 cursor-help"})})]}),(0,s.jsx)(i.Button,{variant:"secondary",onClick:()=>{_([...e,{callback_name:"",callback_type:"success",callback_vars:{}}])},icon:o.PlusIcon,size:"sm",className:"hover:border-blue-400 hover:text-blue-500",type:"button",children:"Add Integration"})]}),(0,s.jsx)("div",{className:"space-y-4",children:e.map((l,o)=>{let u=l.callback_name?Object.entries(p.callback_map).find(([e,s])=>s===l.callback_name)?.[0]:void 0,m=u?p.callbackInfo[u]?.logo:null;return(0,s.jsxs)(n.Card,{className:"border border-gray-200 shadow-sm hover:shadow-md transition-shadow duration-200",decoration:"top",decorationColor:"blue",children:[(0,s.jsxs)("div",{className:"flex justify-between items-start mb-4",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[m&&(0,s.jsx)("img",{src:m,alt:u,className:"w-5 h-5 object-contain"}),(0,s.jsxs)("span",{className:"text-sm font-medium",children:[u||"New Integration"," Configuration"]})]}),(0,s.jsx)(i.Button,{variant:"light",onClick:()=>{_(e.filter((e,s)=>s!==o))},icon:d.TrashIcon,size:"xs",color:"red",className:"hover:bg-red-50",type:"button",children:"Remove"})]}),(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Integration Type"}),(0,s.jsx)(a.Select,{value:u,placeholder:"Select integration",onChange:e=>j(o,"callback_name",e),className:"w-full",optionLabelProp:"label",children:y.map(e=>{let a=p.callbackInfo[e]?.logo,l=p.callbackInfo[e]?.description;return(0,s.jsx)(x,{value:e,label:e,children:(0,s.jsx)(t.Tooltip,{title:l,placement:"right",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[a&&(0,s.jsx)("img",{src:a,alt:e,className:"w-4 h-4 object-contain",onError:s=>{let a=s.target,t=a.parentElement;if(t){let s=document.createElement("div");s.className="w-4 h-4 rounded-full bg-gray-200 flex items-center justify-center text-xs",s.textContent=e.charAt(0),t.replaceChild(s,a)}}}),(0,s.jsx)("span",{children:e})]})})},e)})})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Event Type"}),(0,s.jsxs)(a.Select,{value:l.callback_type,onChange:e=>j(o,"callback_type",e),className:"w-full",children:[(0,s.jsx)(x,{value:"success",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),(0,s.jsx)("span",{children:"Success Only"})]})}),(0,s.jsx)(x,{value:"failure",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-red-500 rounded-full"}),(0,s.jsx)("span",{children:"Failure Only"})]})}),(0,s.jsx)(x,{value:"success_and_failure",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-blue-500 rounded-full"}),(0,s.jsx)("span",{children:"Success & Failure"})]})})]})]})]}),((e,a)=>{if(!e.callback_name)return null;let l=Object.entries(p.callback_map).find(([s,a])=>a===e.callback_name)?.[0];if(!l)return null;let i=p.callbackInfo[l]?.dynamic_params||{};return 0===Object.keys(i).length?null:(0,s.jsxs)("div",{className:"mt-6 pt-4 border-t border-gray-100",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2 mb-4",children:[(0,s.jsx)("div",{className:"w-3 h-3 bg-blue-100 rounded-full flex items-center justify-center",children:(0,s.jsx)("div",{className:"w-1.5 h-1.5 bg-blue-500 rounded-full"})}),(0,s.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Integration Parameters"})]}),(0,s.jsx)("div",{className:"grid grid-cols-1 gap-4",children:Object.entries(i).map(([l,i])=>(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)("label",{className:"text-sm font-medium text-gray-700 capitalize flex items-center space-x-1",children:[(0,s.jsx)("span",{children:l.replace(/_/g," ")}),(0,s.jsx)(t.Tooltip,{title:`Environment variable reference recommended: os.environ/${l.toUpperCase()}`,children:(0,s.jsx)(r.InfoCircleOutlined,{className:"text-gray-400 cursor-help text-xs"})}),"password"===i&&(0,s.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-yellow-100 text-yellow-800",children:"Sensitive"}),"number"===i&&(0,s.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-yellow-100 text-yellow-800",children:"Number"})]}),"number"===i&&(0,s.jsx)("span",{className:"text-xs text-gray-500",children:"Value must be between 0 and 1"}),"number"===i?(0,s.jsx)(g.default,{step:.01,width:400,placeholder:`os.environ/${l.toUpperCase()}`,value:e.callback_vars[l]||"",onChange:e=>N(a,l,e.target.value)}):(0,s.jsx)(c.TextInput,{type:"password"===i?"password":"text",placeholder:`os.environ/${l.toUpperCase()}`,value:e.callback_vars[l]||"",onChange:e=>N(a,l,e.target.value)})]},l))})]})})(l,o)]})]},o)})}),0===e.length&&(0,s.jsxs)("div",{className:"text-center py-12 text-gray-500 border-2 border-dashed border-gray-200 rounded-lg bg-gray-50/50",children:[(0,s.jsx)(u.CogIcon,{className:"w-12 h-12 text-gray-300 mb-3 mx-auto"}),(0,s.jsx)("div",{className:"text-base font-medium mb-1",children:"No logging integrations configured"}),(0,s.jsx)("div",{className:"text-sm text-gray-400",children:'Click "Add Integration" to configure logging for this team'})]})]})}])}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/130a7121f486aeba.js b/litellm/proxy/_experimental/out/_next/static/chunks/130a7121f486aeba.js deleted file mode 100644 index 150769a7fe4..00000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/130a7121f486aeba.js +++ /dev/null @@ -1 +0,0 @@ -(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,349356,e=>{e.v({AElig:"Æ",AMP:"&",Aacute:"Á",Acirc:"Â",Agrave:"À",Aring:"Å",Atilde:"Ã",Auml:"Ä",COPY:"©",Ccedil:"Ç",ETH:"Ð",Eacute:"É",Ecirc:"Ê",Egrave:"È",Euml:"Ë",GT:">",Iacute:"Í",Icirc:"Î",Igrave:"Ì",Iuml:"Ï",LT:"<",Ntilde:"Ñ",Oacute:"Ó",Ocirc:"Ô",Ograve:"Ò",Oslash:"Ø",Otilde:"Õ",Ouml:"Ö",QUOT:'"',REG:"®",THORN:"Þ",Uacute:"Ú",Ucirc:"Û",Ugrave:"Ù",Uuml:"Ü",Yacute:"Ý",aacute:"á",acirc:"â",acute:"´",aelig:"æ",agrave:"à",amp:"&",aring:"å",atilde:"ã",auml:"ä",brvbar:"¦",ccedil:"ç",cedil:"¸",cent:"¢",copy:"©",curren:"¤",deg:"°",divide:"÷",eacute:"é",ecirc:"ê",egrave:"è",eth:"ð",euml:"ë",frac12:"½",frac14:"¼",frac34:"¾",gt:">",iacute:"í",icirc:"î",iexcl:"¡",igrave:"ì",iquest:"¿",iuml:"ï",laquo:"«",lt:"<",macr:"¯",micro:"µ",middot:"·",nbsp:" ",not:"¬",ntilde:"ñ",oacute:"ó",ocirc:"ô",ograve:"ò",ordf:"ª",ordm:"º",oslash:"ø",otilde:"õ",ouml:"ö",para:"¶",plusmn:"±",pound:"£",quot:'"',raquo:"»",reg:"®",sect:"§",shy:"­",sup1:"¹",sup2:"²",sup3:"³",szlig:"ß",thorn:"þ",times:"×",uacute:"ú",ucirc:"û",ugrave:"ù",uml:"¨",uuml:"ü",yacute:"ý",yen:"¥",yuml:"ÿ"})},137429,e=>{e.v({0:"�",128:"€",130:"‚",131:"ƒ",132:"„",133:"…",134:"†",135:"‡",136:"ˆ",137:"‰",138:"Š",139:"‹",140:"Œ",142:"Ž",145:"‘",146:"’",147:"“",148:"”",149:"•",150:"–",151:"—",152:"˜",153:"™",154:"š",155:"›",156:"œ",158:"ž",159:"Ÿ"})},916925,e=>{"use strict";var t,r=((t={}).A2A_Agent="A2A Agent",t.AIML="AI/ML API",t.Bedrock="Amazon Bedrock",t.Anthropic="Anthropic",t.AssemblyAI="AssemblyAI",t.SageMaker="AWS SageMaker",t.Azure="Azure",t.Azure_AI_Studio="Azure AI Foundry (Studio)",t.Cerebras="Cerebras",t.Cohere="Cohere",t.Dashscope="Dashscope",t.Databricks="Databricks (Qwen API)",t.DeepInfra="DeepInfra",t.Deepgram="Deepgram",t.Deepseek="Deepseek",t.ElevenLabs="ElevenLabs",t.FalAI="Fal AI",t.FireworksAI="Fireworks AI",t.Google_AI_Studio="Google AI Studio",t.GradientAI="GradientAI",t.Groq="Groq",t.Hosted_Vllm="vllm",t.Infinity="Infinity",t.JinaAI="Jina AI",t.MiniMax="MiniMax",t.MistralAI="Mistral AI",t.Ollama="Ollama",t.OpenAI="OpenAI",t.OpenAI_Compatible="OpenAI-Compatible Endpoints (Together AI, etc.)",t.OpenAI_Text="OpenAI Text Completion",t.OpenAI_Text_Compatible="OpenAI-Compatible Text Completion Models (Together AI, etc.)",t.Openrouter="Openrouter",t.Oracle="Oracle Cloud Infrastructure (OCI)",t.Perplexity="Perplexity",t.RunwayML="RunwayML",t.Sambanova="Sambanova",t.Snowflake="Snowflake",t.TogetherAI="TogetherAI",t.Triton="Triton",t.Vertex_AI="Vertex AI (Anthropic, Gemini, etc.)",t.VolcEngine="VolcEngine",t.Voyage="Voyage AI",t.xAI="xAI",t.SAP="SAP Generative AI Hub",t.Watsonx="Watsonx",t);let n={A2A_Agent:"a2a_agent",AIML:"aiml",OpenAI:"openai",OpenAI_Text:"text-completion-openai",Azure:"azure",Azure_AI_Studio:"azure_ai",Anthropic:"anthropic",Google_AI_Studio:"gemini",Bedrock:"bedrock",Groq:"groq",MiniMax:"minimax",MistralAI:"mistral",Cohere:"cohere",OpenAI_Compatible:"openai",OpenAI_Text_Compatible:"text-completion-openai",Vertex_AI:"vertex_ai",Databricks:"databricks",Dashscope:"dashscope",xAI:"xai",Deepseek:"deepseek",Ollama:"ollama",AssemblyAI:"assemblyai",Cerebras:"cerebras",Sambanova:"sambanova",Perplexity:"perplexity",RunwayML:"runwayml",TogetherAI:"together_ai",Openrouter:"openrouter",Oracle:"oci",Snowflake:"snowflake",FireworksAI:"fireworks_ai",GradientAI:"gradient_ai",Triton:"triton",Deepgram:"deepgram",ElevenLabs:"elevenlabs",FalAI:"fal_ai",SageMaker:"sagemaker_chat",Voyage:"voyage",JinaAI:"jina_ai",VolcEngine:"volcengine",DeepInfra:"deepinfra",Hosted_Vllm:"hosted_vllm",Infinity:"infinity",SAP:"sap",Watsonx:"watsonx"},o="../ui/assets/logos/",i={"A2A Agent":`${o}a2a_agent.png`,"AI/ML API":`${o}aiml_api.svg`,Anthropic:`${o}anthropic.svg`,AssemblyAI:`${o}assemblyai_small.png`,Azure:`${o}microsoft_azure.svg`,"Azure AI Foundry (Studio)":`${o}microsoft_azure.svg`,"Amazon Bedrock":`${o}bedrock.svg`,"AWS SageMaker":`${o}bedrock.svg`,Cerebras:`${o}cerebras.svg`,Cohere:`${o}cohere.svg`,"Databricks (Qwen API)":`${o}databricks.svg`,Dashscope:`${o}dashscope.svg`,Deepseek:`${o}deepseek.svg`,"Fireworks AI":`${o}fireworks.svg`,Groq:`${o}groq.svg`,"Google AI Studio":`${o}google.svg`,vllm:`${o}vllm.png`,Infinity:`${o}infinity.png`,MiniMax:`${o}minimax.svg`,"Mistral AI":`${o}mistral.svg`,Ollama:`${o}ollama.svg`,OpenAI:`${o}openai_small.svg`,"OpenAI Text Completion":`${o}openai_small.svg`,"OpenAI-Compatible Text Completion Models (Together AI, etc.)":`${o}openai_small.svg`,"OpenAI-Compatible Endpoints (Together AI, etc.)":`${o}openai_small.svg`,Openrouter:`${o}openrouter.svg`,"Oracle Cloud Infrastructure (OCI)":`${o}oracle.svg`,Perplexity:`${o}perplexity-ai.svg`,RunwayML:`${o}runwayml.png`,Sambanova:`${o}sambanova.svg`,Snowflake:`${o}snowflake.svg`,TogetherAI:`${o}togetherai.svg`,"Vertex AI (Anthropic, Gemini, etc.)":`${o}google.svg`,xAI:`${o}xai.svg`,GradientAI:`${o}gradientai.svg`,Triton:`${o}nvidia_triton.png`,Deepgram:`${o}deepgram.png`,ElevenLabs:`${o}elevenlabs.png`,"Fal AI":`${o}fal_ai.jpg`,"Voyage AI":`${o}voyage.webp`,"Jina AI":`${o}jina.png`,VolcEngine:`${o}volcengine.png`,DeepInfra:`${o}deepinfra.png`,"SAP Generative AI Hub":`${o}sap.png`};e.s(["Providers",()=>r,"getPlaceholder",0,e=>{if("AI/ML API"===e)return"aiml/flux-pro/v1.1";if("Vertex AI (Anthropic, Gemini, etc.)"===e)return"gemini-pro";if("Anthropic"==e)return"claude-3-opus";if("Amazon Bedrock"==e)return"claude-3-opus";if("AWS SageMaker"==e)return"sagemaker/jumpstart-dft-meta-textgeneration-llama-2-7b";else if("Google AI Studio"==e)return"gemini-pro";else if("Azure AI Foundry (Studio)"==e)return"azure_ai/command-r-plus";else if("Azure"==e)return"my-deployment";else if("Oracle Cloud Infrastructure (OCI)"==e)return"oci/xai.grok-4";else if("Snowflake"==e)return"snowflake/mistral-7b";else if("Voyage AI"==e)return"voyage/";else if("Jina AI"==e)return"jina_ai/";else if("VolcEngine"==e)return"volcengine/";else if("DeepInfra"==e)return"deepinfra/";else if("Fal AI"==e)return"fal_ai/fal-ai/flux-pro/v1.1-ultra";else if("RunwayML"==e)return"runwayml/gen4_turbo";else if("Watsonx"===e)return"watsonx/ibm/granite-3-3-8b-instruct";else return"gpt-3.5-turbo"},"getProviderLogoAndName",0,e=>{if(!e)return{logo:"",displayName:"-"};if("gemini"===e.toLowerCase()){let e="Google AI Studio";return{logo:i[e],displayName:e}}let t=Object.keys(n).find(t=>n[t].toLowerCase()===e.toLowerCase());if(!t)return{logo:"",displayName:e};let o=r[t];return{logo:i[o],displayName:o}},"getProviderModels",0,(e,t)=>{console.log(`Provider key: ${e}`);let r=n[e];console.log(`Provider mapped to: ${r}`);let o=[];return e&&"object"==typeof t&&(Object.entries(t).forEach(([e,t])=>{if(null!==t&&"object"==typeof t&&"litellm_provider"in t){let n=t.litellm_provider;(n===r||"string"==typeof n&&n.includes(r))&&o.push(e)}}),"Cohere"==e&&(console.log("Adding cohere chat models"),Object.entries(t).forEach(([e,t])=>{null!==t&&"object"==typeof t&&"litellm_provider"in t&&"cohere_chat"===t.litellm_provider&&o.push(e)})),"AWS SageMaker"==e&&(console.log("Adding sagemaker chat models"),Object.entries(t).forEach(([e,t])=>{null!==t&&"object"==typeof t&&"litellm_provider"in t&&"sagemaker_chat"===t.litellm_provider&&o.push(e)}))),o},"providerLogoMap",0,i,"provider_map",0,n])},166406,e=>{"use strict";var t=e.i(190144);e.s(["CopyOutlined",()=>t.default])},309821,e=>{"use strict";e.i(247167);var t=e.i(271645);e.i(262370);var r=e.i(135551),n=e.i(201072),o=e.i(121229),i=e.i(726289),a=e.i(864517),l=e.i(343794),s=e.i(529681),c=e.i(242064),d=e.i(931067),u=e.i(209428),m=e.i(703923),p={percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,trailColor:"#D9D9D9",trailWidth:1,gapPosition:"bottom"},g=function(){var e=(0,t.useRef)([]),r=(0,t.useRef)(null);return(0,t.useEffect)(function(){var t=Date.now(),n=!1;e.current.forEach(function(e){if(e){n=!0;var o=e.style;o.transitionDuration=".3s, .3s, .3s, .06s",r.current&&t-r.current<100&&(o.transitionDuration="0s, 0s")}}),n&&(r.current=Date.now())}),e.current},f=e.i(410160),h=e.i(392221),v=e.i(654310),b=0,y=(0,v.default)();let $=function(e){var r=t.useState(),n=(0,h.default)(r,2),o=n[0],i=n[1];return t.useEffect(function(){var e;i("rc_progress_".concat((y?(e=b,b+=1):e="TEST_OR_SSR",e)))},[]),e||o};var x=function(e){var r=e.bg,n=e.children;return t.createElement("div",{style:{width:"100%",height:"100%",background:r}},n)};function k(e,t){return Object.keys(e).map(function(r){var n=parseFloat(r),o="".concat(Math.floor(n*t),"%");return"".concat(e[r]," ").concat(o)})}var C=t.forwardRef(function(e,r){var n=e.prefixCls,o=e.color,i=e.gradientId,a=e.radius,l=e.style,s=e.ptg,c=e.strokeLinecap,d=e.strokeWidth,u=e.size,m=e.gapDegree,p=o&&"object"===(0,f.default)(o),g=u/2,h=t.createElement("circle",{className:"".concat(n,"-circle-path"),r:a,cx:g,cy:g,stroke:p?"#FFF":void 0,strokeLinecap:c,strokeWidth:d,opacity:+(0!==s),style:l,ref:r});if(!p)return h;var v="".concat(i,"-conic"),b=k(o,(360-m)/360),y=k(o,1),$="conic-gradient(from ".concat(m?"".concat(180+m/2,"deg"):"0deg",", ").concat(b.join(", "),")"),C="linear-gradient(to ".concat(m?"bottom":"top",", ").concat(y.join(", "),")");return t.createElement(t.Fragment,null,t.createElement("mask",{id:v},h),t.createElement("foreignObject",{x:0,y:0,width:u,height:u,mask:"url(#".concat(v,")")},t.createElement(x,{bg:C},t.createElement(x,{bg:$}))))}),S=function(e,t,r,n,o,i,a,l,s,c){var d=arguments.length>10&&void 0!==arguments[10]?arguments[10]:0,u=(100-n)/100*t;return"round"===s&&100!==n&&(u+=c/2)>=t&&(u=t-.01),{stroke:"string"==typeof l?l:void 0,strokeDasharray:"".concat(t,"px ").concat(e),strokeDashoffset:u+d,transform:"rotate(".concat(o+r/100*360*((360-i)/360)+(0===i?0:({bottom:0,top:180,left:90,right:-90})[a]),"deg)"),transformOrigin:"".concat(50,"px ").concat(50,"px"),transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s, opacity .3s ease 0s",fillOpacity:0}},A=["id","prefixCls","steps","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"];function O(e){var t=null!=e?e:[];return Array.isArray(t)?t:[t]}let w=function(e){var r,n,o,i,a=(0,u.default)((0,u.default)({},p),e),s=a.id,c=a.prefixCls,h=a.steps,v=a.strokeWidth,b=a.trailWidth,y=a.gapDegree,x=void 0===y?0:y,k=a.gapPosition,w=a.trailColor,I=a.strokeLinecap,E=a.style,j=a.className,z=a.strokeColor,M=a.percent,T=(0,m.default)(a,A),N=$(s),P="".concat(N,"-gradient"),B=50-v/2,_=2*Math.PI*B,W=x>0?90+x/2:-90,H=(360-x)/360*_,L="object"===(0,f.default)(h)?h:{count:h,gap:2},D=L.count,V=L.gap,R=O(M),F=O(z),G=F.find(function(e){return e&&"object"===(0,f.default)(e)}),X=G&&"object"===(0,f.default)(G)?"butt":I,q=S(_,H,0,100,W,x,k,w,X,v),U=g();return t.createElement("svg",(0,d.default)({className:(0,l.default)("".concat(c,"-circle"),j),viewBox:"0 0 ".concat(100," ").concat(100),style:E,id:s,role:"presentation"},T),!D&&t.createElement("circle",{className:"".concat(c,"-circle-trail"),r:B,cx:50,cy:50,stroke:w,strokeLinecap:X,strokeWidth:b||v,style:q}),D?(r=Math.round(D*(R[0]/100)),n=100/D,o=0,Array(D).fill(null).map(function(e,i){var a=i<=r-1?F[0]:w,l=a&&"object"===(0,f.default)(a)?"url(#".concat(P,")"):void 0,s=S(_,H,o,n,W,x,k,a,"butt",v,V);return o+=(H-s.strokeDashoffset+V)*100/H,t.createElement("circle",{key:i,className:"".concat(c,"-circle-path"),r:B,cx:50,cy:50,stroke:l,strokeWidth:v,opacity:1,style:s,ref:function(e){U[i]=e}})})):(i=0,R.map(function(e,r){var n=F[r]||F[F.length-1],o=S(_,H,i,e,W,x,k,n,X,v);return i+=e,t.createElement(C,{key:r,color:n,ptg:e,radius:B,prefixCls:c,gradientId:P,style:o,strokeLinecap:X,strokeWidth:v,gapDegree:x,ref:function(e){U[r]=e},size:100})}).reverse()))};var I=e.i(491816);e.i(765846);var E=e.i(896091);function j(e){return!e||e<0?0:e>100?100:e}function z({success:e,successPercent:t}){let r=t;return e&&"progress"in e&&(r=e.progress),e&&"percent"in e&&(r=e.percent),r}let M=(e,t,r)=>{var n,o,i,a;let l=-1,s=-1;if("step"===t){let t=r.steps,n=r.strokeWidth;"string"==typeof e||void 0===e?(l="small"===e?2:14,s=null!=n?n:8):"number"==typeof e?[l,s]=[e,e]:[l=14,s=8]=Array.isArray(e)?e:[e.width,e.height],l*=t}else if("line"===t){let t=null==r?void 0:r.strokeWidth;"string"==typeof e||void 0===e?s=t||("small"===e?6:8):"number"==typeof e?[l,s]=[e,e]:[l=-1,s=8]=Array.isArray(e)?e:[e.width,e.height]}else("circle"===t||"dashboard"===t)&&("string"==typeof e||void 0===e?[l,s]="small"===e?[60,60]:[120,120]:"number"==typeof e?[l,s]=[e,e]:Array.isArray(e)&&(l=null!=(o=null!=(n=e[0])?n:e[1])?o:120,s=null!=(a=null!=(i=e[0])?i:e[1])?a:120));return[l,s]},T=e=>{let{prefixCls:r,trailColor:n=null,strokeLinecap:o="round",gapPosition:i,gapDegree:a,width:s=120,type:c,children:d,success:u,size:m=s,steps:p}=e,[g,f]=M(m,"circle"),{strokeWidth:h}=e;void 0===h&&(h=Math.max(3/g*100,6));let v=t.useMemo(()=>a||0===a?a:"dashboard"===c?75:void 0,[a,c]),b=(({percent:e,success:t,successPercent:r})=>{let n=j(z({success:t,successPercent:r}));return[n,j(j(e)-n)]})(e),y="[object Object]"===Object.prototype.toString.call(e.strokeColor),$=(({success:e={},strokeColor:t})=>{let{strokeColor:r}=e;return[r||E.presetPrimaryColors.green,t||null]})({success:u,strokeColor:e.strokeColor}),x=(0,l.default)(`${r}-inner`,{[`${r}-circle-gradient`]:y}),k=t.createElement(w,{steps:p,percent:p?b[1]:b,strokeWidth:h,trailWidth:h,strokeColor:p?$[1]:$,strokeLinecap:o,trailColor:n,prefixCls:r,gapDegree:v,gapPosition:i||"dashboard"===c&&"bottom"||void 0}),C=g<=20,S=t.createElement("div",{className:x,style:{width:g,height:f,fontSize:.15*g+6}},k,!C&&d);return C?t.createElement(I.default,{title:d},S):S};e.i(296059);var N=e.i(694758),P=e.i(915654),B=e.i(183293),_=e.i(246422),W=e.i(838378);let H="--progress-line-stroke-color",L="--progress-percent",D=e=>{let t=e?"100%":"-100%";return new N.Keyframes(`antProgress${e?"RTL":"LTR"}Active`,{"0%":{transform:`translateX(${t}) scaleX(0)`,opacity:.1},"20%":{transform:`translateX(${t}) scaleX(0)`,opacity:.5},to:{transform:"translateX(0) scaleX(1)",opacity:0}})},V=(0,_.genStyleHooks)("Progress",e=>{let t=e.calc(e.marginXXS).div(2).equal(),r=(0,W.mergeToken)(e,{progressStepMarginInlineEnd:t,progressStepMinWidth:t,progressActiveMotionDuration:"2.4s"});return[(e=>{let{componentCls:t,iconCls:r}=e;return{[t]:Object.assign(Object.assign({},(0,B.resetComponent)(e)),{display:"inline-block","&-rtl":{direction:"rtl"},"&-line":{position:"relative",width:"100%",fontSize:e.fontSize},[`${t}-outer`]:{display:"inline-flex",alignItems:"center",width:"100%"},[`${t}-inner`]:{position:"relative",display:"inline-block",width:"100%",flex:1,overflow:"hidden",verticalAlign:"middle",backgroundColor:e.remainingColor,borderRadius:e.lineBorderRadius},[`${t}-inner:not(${t}-circle-gradient)`]:{[`${t}-circle-path`]:{stroke:e.defaultColor}},[`${t}-success-bg, ${t}-bg`]:{position:"relative",background:e.defaultColor,borderRadius:e.lineBorderRadius,transition:`all ${e.motionDurationSlow} ${e.motionEaseInOutCirc}`},[`${t}-layout-bottom`]:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",[`${t}-text`]:{width:"max-content",marginInlineStart:0,marginTop:e.marginXXS}},[`${t}-bg`]:{overflow:"hidden","&::after":{content:'""',background:{_multi_value_:!0,value:["inherit",`var(${H})`]},height:"100%",width:`calc(1 / var(${L}) * 100%)`,display:"block"},[`&${t}-bg-inner`]:{minWidth:"max-content","&::after":{content:"none"},[`${t}-text-inner`]:{color:e.colorWhite,[`&${t}-text-bright`]:{color:"rgba(0, 0, 0, 0.45)"}}}},[`${t}-success-bg`]:{position:"absolute",insetBlockStart:0,insetInlineStart:0,backgroundColor:e.colorSuccess},[`${t}-text`]:{display:"inline-block",marginInlineStart:e.marginXS,color:e.colorText,lineHeight:1,width:"2em",whiteSpace:"nowrap",textAlign:"start",verticalAlign:"middle",wordBreak:"normal",[r]:{fontSize:e.fontSize},[`&${t}-text-outer`]:{width:"max-content"},[`&${t}-text-outer${t}-text-start`]:{width:"max-content",marginInlineStart:0,marginInlineEnd:e.marginXS}},[`${t}-text-inner`]:{display:"flex",justifyContent:"center",alignItems:"center",width:"100%",height:"100%",marginInlineStart:0,padding:`0 ${(0,P.unit)(e.paddingXXS)}`,[`&${t}-text-start`]:{justifyContent:"start"},[`&${t}-text-end`]:{justifyContent:"end"}},[`&${t}-status-active`]:{[`${t}-bg::before`]:{position:"absolute",inset:0,backgroundColor:e.colorBgContainer,borderRadius:e.lineBorderRadius,opacity:0,animationName:D(),animationDuration:e.progressActiveMotionDuration,animationTimingFunction:e.motionEaseOutQuint,animationIterationCount:"infinite",content:'""'}},[`&${t}-rtl${t}-status-active`]:{[`${t}-bg::before`]:{animationName:D(!0)}},[`&${t}-status-exception`]:{[`${t}-bg`]:{backgroundColor:e.colorError},[`${t}-text`]:{color:e.colorError}},[`&${t}-status-exception ${t}-inner:not(${t}-circle-gradient)`]:{[`${t}-circle-path`]:{stroke:e.colorError}},[`&${t}-status-success`]:{[`${t}-bg`]:{backgroundColor:e.colorSuccess},[`${t}-text`]:{color:e.colorSuccess}},[`&${t}-status-success ${t}-inner:not(${t}-circle-gradient)`]:{[`${t}-circle-path`]:{stroke:e.colorSuccess}}})}})(r),(e=>{let{componentCls:t,iconCls:r}=e;return{[t]:{[`${t}-circle-trail`]:{stroke:e.remainingColor},[`&${t}-circle ${t}-inner`]:{position:"relative",lineHeight:1,backgroundColor:"transparent"},[`&${t}-circle ${t}-text`]:{position:"absolute",insetBlockStart:"50%",insetInlineStart:0,width:"100%",margin:0,padding:0,color:e.circleTextColor,fontSize:e.circleTextFontSize,lineHeight:1,whiteSpace:"normal",textAlign:"center",transform:"translateY(-50%)",[r]:{fontSize:e.circleIconFontSize}},[`${t}-circle&-status-exception`]:{[`${t}-text`]:{color:e.colorError}},[`${t}-circle&-status-success`]:{[`${t}-text`]:{color:e.colorSuccess}}},[`${t}-inline-circle`]:{lineHeight:1,[`${t}-inner`]:{verticalAlign:"bottom"}}}})(r),(e=>{let{componentCls:t}=e;return{[t]:{[`${t}-steps`]:{display:"inline-block","&-outer":{display:"flex",flexDirection:"row",alignItems:"center"},"&-item":{flexShrink:0,minWidth:e.progressStepMinWidth,marginInlineEnd:e.progressStepMarginInlineEnd,backgroundColor:e.remainingColor,transition:`all ${e.motionDurationSlow}`,"&-active":{backgroundColor:e.defaultColor}}}}}})(r),(e=>{let{componentCls:t,iconCls:r}=e;return{[t]:{[`${t}-small&-line, ${t}-small&-line ${t}-text ${r}`]:{fontSize:e.fontSizeSM}}}})(r)]},e=>({circleTextColor:e.colorText,defaultColor:e.colorInfo,remainingColor:e.colorFillSecondary,lineBorderRadius:100,circleTextFontSize:"1em",circleIconFontSize:`${e.fontSize/e.fontSizeSM}em`}));var R=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 o=0,n=Object.getOwnPropertySymbols(e);ot.indexOf(n[o])&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r};let F=e=>{let{prefixCls:r,direction:n,percent:o,size:i,strokeWidth:a,strokeColor:s,strokeLinecap:c="round",children:d,trailColor:u=null,percentPosition:m,success:p}=e,{align:g,type:f}=m,h=s&&"string"!=typeof s?((e,t)=>{let{from:r=E.presetPrimaryColors.blue,to:n=E.presetPrimaryColors.blue,direction:o="rtl"===t?"to left":"to right"}=e,i=R(e,["from","to","direction"]);if(0!==Object.keys(i).length){let e,t=(e=[],Object.keys(i).forEach(t=>{let r=Number.parseFloat(t.replace(/%/g,""));Number.isNaN(r)||e.push({key:r,value:i[t]})}),(e=e.sort((e,t)=>e.key-t.key)).map(({key:e,value:t})=>`${t} ${e}%`).join(", ")),r=`linear-gradient(${o}, ${t})`;return{background:r,[H]:r}}let a=`linear-gradient(${o}, ${r}, ${n})`;return{background:a,[H]:a}})(s,n):{[H]:s,background:s},v="square"===c||"butt"===c?0:void 0,[b,y]=M(null!=i?i:[-1,a||("small"===i?6:8)],"line",{strokeWidth:a}),$=Object.assign(Object.assign({width:`${j(o)}%`,height:y,borderRadius:v},h),{[L]:j(o)/100}),x=z(e),k={width:`${j(x)}%`,height:y,borderRadius:v,backgroundColor:null==p?void 0:p.strokeColor},C=t.createElement("div",{className:`${r}-inner`,style:{backgroundColor:u||void 0,borderRadius:v}},t.createElement("div",{className:(0,l.default)(`${r}-bg`,`${r}-bg-${f}`),style:$},"inner"===f&&d),void 0!==x&&t.createElement("div",{className:`${r}-success-bg`,style:k})),S="outer"===f&&"start"===g,A="outer"===f&&"end"===g;return"outer"===f&&"center"===g?t.createElement("div",{className:`${r}-layout-bottom`},C,d):t.createElement("div",{className:`${r}-outer`,style:{width:b<0?"100%":b}},S&&d,C,A&&d)},G=e=>{let{size:r,steps:n,rounding:o=Math.round,percent:i=0,strokeWidth:a=8,strokeColor:s,trailColor:c=null,prefixCls:d,children:u}=e,m=o(i/100*n),[p,g]=M(null!=r?r:["small"===r?2:14,a],"step",{steps:n,strokeWidth:a}),f=p/n,h=Array.from({length:n});for(let e=0;et.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,n=Object.getOwnPropertySymbols(e);ot.indexOf(n[o])&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r};let q=["normal","exception","active","success"],U=t.forwardRef((e,d)=>{let u,{prefixCls:m,className:p,rootClassName:g,steps:f,strokeColor:h,percent:v=0,size:b="default",showInfo:y=!0,type:$="line",status:x,format:k,style:C,percentPosition:S={}}=e,A=X(e,["prefixCls","className","rootClassName","steps","strokeColor","percent","size","showInfo","type","status","format","style","percentPosition"]),{align:O="end",type:w="outer"}=S,I=Array.isArray(h)?h[0]:h,E="string"==typeof h||Array.isArray(h)?h:void 0,N=t.useMemo(()=>{if(I){let e="string"==typeof I?I:Object.values(I)[0];return new r.FastColor(e).isLight()}return!1},[h]),P=t.useMemo(()=>{var t,r;let n=z(e);return Number.parseInt(void 0!==n?null==(t=null!=n?n:0)?void 0:t.toString():null==(r=null!=v?v:0)?void 0:r.toString(),10)},[v,e.success,e.successPercent]),B=t.useMemo(()=>!q.includes(x)&&P>=100?"success":x||"normal",[x,P]),{getPrefixCls:_,direction:W,progress:H}=t.useContext(c.ConfigContext),L=_("progress",m),[D,R,U]=V(L),J="line"===$,K=J&&!f,Y=t.useMemo(()=>{let r;if(!y)return null;let s=z(e),c=k||(e=>`${e}%`),d=J&&N&&"inner"===w;return"inner"===w||k||"exception"!==B&&"success"!==B?r=c(j(v),j(s)):"exception"===B?r=J?t.createElement(i.default,null):t.createElement(a.default,null):"success"===B&&(r=J?t.createElement(n.default,null):t.createElement(o.default,null)),t.createElement("span",{className:(0,l.default)(`${L}-text`,{[`${L}-text-bright`]:d,[`${L}-text-${O}`]:K,[`${L}-text-${w}`]:K}),title:"string"==typeof r?r:void 0},r)},[y,v,P,B,$,L,k]);"line"===$?u=f?t.createElement(G,Object.assign({},e,{strokeColor:E,prefixCls:L,steps:"object"==typeof f?f.count:f}),Y):t.createElement(F,Object.assign({},e,{strokeColor:I,prefixCls:L,direction:W,percentPosition:{align:O,type:w}}),Y):("circle"===$||"dashboard"===$)&&(u=t.createElement(T,Object.assign({},e,{strokeColor:I,prefixCls:L,progressStatus:B}),Y));let Q=(0,l.default)(L,`${L}-status-${B}`,{[`${L}-${"dashboard"===$&&"circle"||$}`]:"line"!==$,[`${L}-inline-circle`]:"circle"===$&&M(b,"circle")[0]<=20,[`${L}-line`]:K,[`${L}-line-align-${O}`]:K,[`${L}-line-position-${w}`]:K,[`${L}-steps`]:f,[`${L}-show-info`]:y,[`${L}-${b}`]:"string"==typeof b,[`${L}-rtl`]:"rtl"===W},null==H?void 0:H.className,p,g,R,U);return D(t.createElement("div",Object.assign({ref:d,style:Object.assign(Object.assign({},null==H?void 0:H.style),C),className:Q,role:"progressbar","aria-valuenow":P,"aria-valuemin":0,"aria-valuemax":100},(0,s.default)(A,["trailColor","strokeWidth","width","gapDegree","gapPosition","strokeLinecap","success","successPercent"])),u))});e.s(["default",0,U],309821)},94629,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7 16V4m0 0L3 8m4-4l4 4m6 0v12m0 0l4-4m-4 4l-4-4"}))});e.s(["SwitchVerticalIcon",0,r],94629)},751904,e=>{"use strict";var t=e.i(401361);e.s(["EditOutlined",()=>t.default])},118366,e=>{"use strict";var t=e.i(991124);e.s(["CopyIcon",()=>t.default])},991124,e=>{"use strict";let t=(0,e.i(475254).default)("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"}]]);e.s(["default",()=>t])},678784,678745,e=>{"use strict";let t=(0,e.i(475254).default)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);e.s(["default",()=>t],678745),e.s(["CheckIcon",()=>t],678784)},211576,e=>{"use strict";var t=e.i(131757);e.s(["Col",()=>t.default])},573421,e=>{"use strict";e.i(247167);var t=e.i(8211),r=e.i(271645),n=e.i(343794),o=e.i(887719),i=e.i(908206),a=e.i(242064),l=e.i(721132),s=e.i(517455),c=e.i(264042),d=e.i(150073),u=e.i(165370),m=e.i(244451);let p=r.default.createContext({});p.Consumer;var g=e.i(763731),f=e.i(211576),h=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 o=0,n=Object.getOwnPropertySymbols(e);ot.indexOf(n[o])&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r};let v=r.default.forwardRef((e,t)=>{let o,{prefixCls:i,children:l,actions:s,extra:c,styles:d,className:u,classNames:m,colStyle:v}=e,b=h(e,["prefixCls","children","actions","extra","styles","className","classNames","colStyle"]),{grid:y,itemLayout:$}=(0,r.useContext)(p),{getPrefixCls:x,list:k}=(0,r.useContext)(a.ConfigContext),C=e=>{var t,r;return(0,n.default)(null==(r=null==(t=null==k?void 0:k.item)?void 0:t.classNames)?void 0:r[e],null==m?void 0:m[e])},S=e=>{var t,r;return Object.assign(Object.assign({},null==(r=null==(t=null==k?void 0:k.item)?void 0:t.styles)?void 0:r[e]),null==d?void 0:d[e])},A=x("list",i),O=s&&s.length>0&&r.default.createElement("ul",{className:(0,n.default)(`${A}-item-action`,C("actions")),key:"actions",style:S("actions")},s.map((e,t)=>r.default.createElement("li",{key:`${A}-item-action-${t}`},e,t!==s.length-1&&r.default.createElement("em",{className:`${A}-item-action-split`})))),w=r.default.createElement(y?"div":"li",Object.assign({},b,y?{}:{ref:t},{className:(0,n.default)(`${A}-item`,{[`${A}-item-no-flex`]:!("vertical"===$?!!c:(o=!1,r.Children.forEach(l,e=>{"string"==typeof e&&(o=!0)}),!(o&&r.Children.count(l)>1)))},u)}),"vertical"===$&&c?[r.default.createElement("div",{className:`${A}-item-main`,key:"content"},l,O),r.default.createElement("div",{className:(0,n.default)(`${A}-item-extra`,C("extra")),key:"extra",style:S("extra")},c)]:[l,O,(0,g.cloneElement)(c,{key:"extra"})]);return y?r.default.createElement(f.Col,{ref:t,flex:1,style:v},w):w});v.Meta=e=>{var{prefixCls:t,className:o,avatar:i,title:l,description:s}=e,c=h(e,["prefixCls","className","avatar","title","description"]);let{getPrefixCls:d}=(0,r.useContext)(a.ConfigContext),u=d("list",t),m=(0,n.default)(`${u}-item-meta`,o),p=r.default.createElement("div",{className:`${u}-item-meta-content`},l&&r.default.createElement("h4",{className:`${u}-item-meta-title`},l),s&&r.default.createElement("div",{className:`${u}-item-meta-description`},s));return r.default.createElement("div",Object.assign({},c,{className:m}),i&&r.default.createElement("div",{className:`${u}-item-meta-avatar`},i),(l||s)&&p)},e.i(296059);var b=e.i(915654),y=e.i(183293),$=e.i(246422),x=e.i(838378);let k=(0,$.genStyleHooks)("List",e=>{let t=(0,x.mergeToken)(e,{listBorderedCls:`${e.componentCls}-bordered`,minHeight:e.controlHeightLG});return[(e=>{let{componentCls:t,antCls:r,controlHeight:n,minHeight:o,paddingSM:i,marginLG:a,padding:l,itemPadding:s,colorPrimary:c,itemPaddingSM:d,itemPaddingLG:u,paddingXS:m,margin:p,colorText:g,colorTextDescription:f,motionDurationSlow:h,lineWidth:v,headerBg:$,footerBg:x,emptyTextPadding:k,metaMarginBottom:C,avatarMarginRight:S,titleMarginBottom:A,descriptionFontSize:O}=e;return{[t]:Object.assign(Object.assign({},(0,y.resetComponent)(e)),{position:"relative","--rc-virtual-list-scrollbar-bg":e.colorSplit,"*":{outline:"none"},[`${t}-header`]:{background:$},[`${t}-footer`]:{background:x},[`${t}-header, ${t}-footer`]:{paddingBlock:i},[`${t}-pagination`]:{marginBlockStart:a,[`${r}-pagination-options`]:{textAlign:"start"}},[`${t}-spin`]:{minHeight:o,textAlign:"center"},[`${t}-items`]:{margin:0,padding:0,listStyle:"none"},[`${t}-item`]:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:s,color:g,[`${t}-item-meta`]:{display:"flex",flex:1,alignItems:"flex-start",maxWidth:"100%",[`${t}-item-meta-avatar`]:{marginInlineEnd:S},[`${t}-item-meta-content`]:{flex:"1 0",width:0,color:g},[`${t}-item-meta-title`]:{margin:`0 0 ${(0,b.unit)(e.marginXXS)} 0`,color:g,fontSize:e.fontSize,lineHeight:e.lineHeight,"> a":{color:g,transition:`all ${h}`,"&:hover":{color:c}}},[`${t}-item-meta-description`]:{color:f,fontSize:O,lineHeight:e.lineHeight}},[`${t}-item-action`]:{flex:"0 0 auto",marginInlineStart:e.marginXXL,padding:0,fontSize:0,listStyle:"none","& > li":{position:"relative",display:"inline-block",padding:`0 ${(0,b.unit)(m)}`,color:f,fontSize:e.fontSize,lineHeight:e.lineHeight,textAlign:"center","&:first-child":{paddingInlineStart:0}},[`${t}-item-action-split`]:{position:"absolute",insetBlockStart:"50%",insetInlineEnd:0,width:v,height:e.calc(e.fontHeight).sub(e.calc(e.marginXXS).mul(2)).equal(),transform:"translateY(-50%)",backgroundColor:e.colorSplit}}},[`${t}-empty`]:{padding:`${(0,b.unit)(l)} 0`,color:f,fontSize:e.fontSizeSM,textAlign:"center"},[`${t}-empty-text`]:{padding:k,color:e.colorTextDisabled,fontSize:e.fontSize,textAlign:"center"},[`${t}-item-no-flex`]:{display:"block"}}),[`${t}-grid ${r}-col > ${t}-item`]:{display:"block",maxWidth:"100%",marginBlockEnd:p,paddingBlock:0,borderBlockEnd:"none"},[`${t}-vertical ${t}-item`]:{alignItems:"initial",[`${t}-item-main`]:{display:"block",flex:1},[`${t}-item-extra`]:{marginInlineStart:a},[`${t}-item-meta`]:{marginBlockEnd:C,[`${t}-item-meta-title`]:{marginBlockStart:0,marginBlockEnd:A,color:g,fontSize:e.fontSizeLG,lineHeight:e.lineHeightLG}},[`${t}-item-action`]:{marginBlockStart:l,marginInlineStart:"auto","> li":{padding:`0 ${(0,b.unit)(l)}`,"&:first-child":{paddingInlineStart:0}}}},[`${t}-split ${t}-item`]:{borderBlockEnd:`${(0,b.unit)(e.lineWidth)} ${e.lineType} ${e.colorSplit}`,"&:last-child":{borderBlockEnd:"none"}},[`${t}-split ${t}-header`]:{borderBlockEnd:`${(0,b.unit)(e.lineWidth)} ${e.lineType} ${e.colorSplit}`},[`${t}-split${t}-empty ${t}-footer`]:{borderTop:`${(0,b.unit)(e.lineWidth)} ${e.lineType} ${e.colorSplit}`},[`${t}-loading ${t}-spin-nested-loading`]:{minHeight:n},[`${t}-split${t}-something-after-last-item ${r}-spin-container > ${t}-items > ${t}-item:last-child`]:{borderBlockEnd:`${(0,b.unit)(e.lineWidth)} ${e.lineType} ${e.colorSplit}`},[`${t}-lg ${t}-item`]:{padding:u},[`${t}-sm ${t}-item`]:{padding:d},[`${t}:not(${t}-vertical)`]:{[`${t}-item-no-flex`]:{[`${t}-item-action`]:{float:"right"}}}}})(t),(e=>{let{listBorderedCls:t,componentCls:r,paddingLG:n,margin:o,itemPaddingSM:i,itemPaddingLG:a,marginLG:l,borderRadiusLG:s}=e,c=(0,b.unit)(e.calc(s).sub(e.lineWidth).equal());return{[t]:{border:`${(0,b.unit)(e.lineWidth)} ${e.lineType} ${e.colorBorder}`,borderRadius:s,[`${r}-header`]:{borderRadius:`${c} ${c} 0 0`},[`${r}-footer`]:{borderRadius:`0 0 ${c} ${c}`},[`${r}-header,${r}-footer,${r}-item`]:{paddingInline:n},[`${r}-pagination`]:{margin:`${(0,b.unit)(o)} ${(0,b.unit)(l)}`}},[`${t}${r}-sm`]:{[`${r}-item,${r}-header,${r}-footer`]:{padding:i}},[`${t}${r}-lg`]:{[`${r}-item,${r}-header,${r}-footer`]:{padding:a}}}})(t),(e=>{let{componentCls:t,screenSM:r,screenMD:n,marginLG:o,marginSM:i,margin:a}=e;return{[`@media screen and (max-width:${n}px)`]:{[t]:{[`${t}-item`]:{[`${t}-item-action`]:{marginInlineStart:o}}},[`${t}-vertical`]:{[`${t}-item`]:{[`${t}-item-extra`]:{marginInlineStart:o}}}},[`@media screen and (max-width: ${r}px)`]:{[t]:{[`${t}-item`]:{flexWrap:"wrap",[`${t}-action`]:{marginInlineStart:i}}},[`${t}-vertical`]:{[`${t}-item`]:{flexWrap:"wrap-reverse",[`${t}-item-main`]:{minWidth:e.contentWidth},[`${t}-item-extra`]:{margin:`auto auto ${(0,b.unit)(a)}`}}}}}})(t)]},e=>({contentWidth:220,itemPadding:`${(0,b.unit)(e.paddingContentVertical)} 0`,itemPaddingSM:`${(0,b.unit)(e.paddingContentVerticalSM)} ${(0,b.unit)(e.paddingContentHorizontal)}`,itemPaddingLG:`${(0,b.unit)(e.paddingContentVerticalLG)} ${(0,b.unit)(e.paddingContentHorizontalLG)}`,headerBg:"transparent",footerBg:"transparent",emptyTextPadding:e.padding,metaMarginBottom:e.padding,avatarMarginRight:e.padding,titleMarginBottom:e.paddingSM,descriptionFontSize:e.fontSize}));var C=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 o=0,n=Object.getOwnPropertySymbols(e);ot.indexOf(n[o])&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r};let S=r.forwardRef(function(e,g){let{pagination:f=!1,prefixCls:h,bordered:v=!1,split:b=!0,className:y,rootClassName:$,style:x,children:S,itemLayout:A,loadMore:O,grid:w,dataSource:I=[],size:E,header:j,footer:z,loading:M=!1,rowKey:T,renderItem:N,locale:P}=e,B=C(e,["pagination","prefixCls","bordered","split","className","rootClassName","style","children","itemLayout","loadMore","grid","dataSource","size","header","footer","loading","rowKey","renderItem","locale"]),_=f&&"object"==typeof f?f:{},[W,H]=r.useState(_.defaultCurrent||1),[L,D]=r.useState(_.defaultPageSize||10),{getPrefixCls:V,direction:R,className:F,style:G}=(0,a.useComponentConfig)("list"),{renderEmpty:X}=r.useContext(a.ConfigContext),q=e=>(t,r)=>{var n;H(t),D(r),f&&(null==(n=null==f?void 0:f[e])||n.call(f,t,r))},U=q("onChange"),J=q("onShowSizeChange"),K=!!(O||f||z),Y=V("list",h),[Q,Z,ee]=k(Y),et=M;"boolean"==typeof et&&(et={spinning:et});let er=!!(null==et?void 0:et.spinning),en=(0,s.default)(E),eo="";switch(en){case"large":eo="lg";break;case"small":eo="sm"}let ei=(0,n.default)(Y,{[`${Y}-vertical`]:"vertical"===A,[`${Y}-${eo}`]:eo,[`${Y}-split`]:b,[`${Y}-bordered`]:v,[`${Y}-loading`]:er,[`${Y}-grid`]:!!w,[`${Y}-something-after-last-item`]:K,[`${Y}-rtl`]:"rtl"===R},F,y,$,Z,ee),ea=(0,o.default)({current:1,total:0,position:"bottom"},{total:I.length,current:W,pageSize:L},f||{}),el=Math.ceil(ea.total/ea.pageSize);ea.current=Math.min(ea.current,el);let es=f&&r.createElement("div",{className:(0,n.default)(`${Y}-pagination`)},r.createElement(u.default,Object.assign({align:"end"},ea,{onChange:U,onShowSizeChange:J}))),ec=(0,t.default)(I);f&&I.length>(ea.current-1)*ea.pageSize&&(ec=(0,t.default)(I).splice((ea.current-1)*ea.pageSize,ea.pageSize));let ed=Object.keys(w||{}).some(e=>["xs","sm","md","lg","xl","xxl"].includes(e)),eu=(0,d.default)(ed),em=r.useMemo(()=>{for(let e=0;e{if(!w)return;let e=em&&w[em]?w[em]:w.column;if(e)return{width:`${100/e}%`,maxWidth:`${100/e}%`}},[JSON.stringify(w),em]),eg=er&&r.createElement("div",{style:{minHeight:53}});if(ec.length>0){let e=ec.map((e,t)=>{let n;return N?((n="function"==typeof T?T(e):T?e[T]:e.key)||(n=`list-item-${t}`),r.createElement(r.Fragment,{key:n},N(e,t))):null});eg=w?r.createElement(c.Row,{gutter:w.gutter},r.Children.map(e,e=>r.createElement("div",{key:null==e?void 0:e.key,style:ep},e))):r.createElement("ul",{className:`${Y}-items`},e)}else S||er||(eg=r.createElement("div",{className:`${Y}-empty-text`},(null==P?void 0:P.emptyText)||(null==X?void 0:X("List"))||r.createElement(l.default,{componentName:"List"})));let ef=ea.position,eh=r.useMemo(()=>({grid:w,itemLayout:A}),[JSON.stringify(w),A]);return Q(r.createElement(p.Provider,{value:eh},r.createElement("div",Object.assign({ref:g,style:Object.assign(Object.assign({},G),x),className:ei},B),("top"===ef||"both"===ef)&&es,j&&r.createElement("div",{className:`${Y}-header`},j),r.createElement(m.default,Object.assign({},et),eg,S),z&&r.createElement("div",{className:`${Y}-footer`},z),O||("bottom"===ef||"both"===ef)&&es)))});S.Item=v,e.s(["List",0,S],573421)},219470,e=>{"use strict";e.s(["coy",0,{'code[class*="language-"]':{color:"black",background:"none",fontFamily:"Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace",fontSize:"1em",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",wordWrap:"normal",lineHeight:"1.5",MozTabSize:"4",OTabSize:"4",tabSize:"4",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none",maxHeight:"inherit",height:"inherit",padding:"0 1em",display:"block",overflow:"auto"},'pre[class*="language-"]':{color:"black",background:"none",fontFamily:"Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace",fontSize:"1em",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",wordWrap:"normal",lineHeight:"1.5",MozTabSize:"4",OTabSize:"4",tabSize:"4",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none",position:"relative",margin:".5em 0",overflow:"visible",padding:"1px",backgroundColor:"#fdfdfd",WebkitBoxSizing:"border-box",MozBoxSizing:"border-box",boxSizing:"border-box",marginBottom:"1em"},'pre[class*="language-"] > code':{position:"relative",zIndex:"1",borderLeft:"10px solid #358ccb",boxShadow:"-1px 0px 0px 0px #358ccb, 0px 0px 0px 1px #dfdfdf",backgroundColor:"#fdfdfd",backgroundImage:"linear-gradient(transparent 50%, rgba(69, 142, 209, 0.04) 50%)",backgroundSize:"3em 3em",backgroundOrigin:"content-box",backgroundAttachment:"local"},':not(pre) > code[class*="language-"]':{backgroundColor:"#fdfdfd",WebkitBoxSizing:"border-box",MozBoxSizing:"border-box",boxSizing:"border-box",marginBottom:"1em",position:"relative",padding:".2em",borderRadius:"0.3em",color:"#c92c2c",border:"1px solid rgba(0, 0, 0, 0.1)",display:"inline",whiteSpace:"normal"},'pre[class*="language-"]:before':{content:"''",display:"block",position:"absolute",bottom:"0.75em",left:"0.18em",width:"40%",height:"20%",maxHeight:"13em",boxShadow:"0px 13px 8px #979797",WebkitTransform:"rotate(-2deg)",MozTransform:"rotate(-2deg)",msTransform:"rotate(-2deg)",OTransform:"rotate(-2deg)",transform:"rotate(-2deg)"},'pre[class*="language-"]:after':{content:"''",display:"block",position:"absolute",bottom:"0.75em",left:"auto",width:"40%",height:"20%",maxHeight:"13em",boxShadow:"0px 13px 8px #979797",WebkitTransform:"rotate(2deg)",MozTransform:"rotate(2deg)",msTransform:"rotate(2deg)",OTransform:"rotate(2deg)",transform:"rotate(2deg)",right:"0.75em"},comment:{color:"#7D8B99"},"block-comment":{color:"#7D8B99"},prolog:{color:"#7D8B99"},doctype:{color:"#7D8B99"},cdata:{color:"#7D8B99"},punctuation:{color:"#5F6364"},property:{color:"#c92c2c"},tag:{color:"#c92c2c"},boolean:{color:"#c92c2c"},number:{color:"#c92c2c"},"function-name":{color:"#c92c2c"},constant:{color:"#c92c2c"},symbol:{color:"#c92c2c"},deleted:{color:"#c92c2c"},selector:{color:"#2f9c0a"},"attr-name":{color:"#2f9c0a"},string:{color:"#2f9c0a"},char:{color:"#2f9c0a"},function:{color:"#2f9c0a"},builtin:{color:"#2f9c0a"},inserted:{color:"#2f9c0a"},operator:{color:"#a67f59",background:"rgba(255, 255, 255, 0.5)"},entity:{color:"#a67f59",background:"rgba(255, 255, 255, 0.5)",cursor:"help"},url:{color:"#a67f59",background:"rgba(255, 255, 255, 0.5)"},variable:{color:"#a67f59",background:"rgba(255, 255, 255, 0.5)"},atrule:{color:"#1990b8"},"attr-value":{color:"#1990b8"},keyword:{color:"#1990b8"},"class-name":{color:"#1990b8"},regex:{color:"#e90"},important:{color:"#e90",fontWeight:"normal"},".language-css .token.string":{color:"#a67f59",background:"rgba(255, 255, 255, 0.5)"},".style .token.string":{color:"#a67f59",background:"rgba(255, 255, 255, 0.5)"},bold:{fontWeight:"bold"},italic:{fontStyle:"italic"},namespace:{Opacity:".7"},'pre[class*="language-"].line-numbers.line-numbers':{paddingLeft:"0"},'pre[class*="language-"].line-numbers.line-numbers code':{paddingLeft:"3.8em"},'pre[class*="language-"].line-numbers.line-numbers .line-numbers-rows':{left:"0"},'pre[class*="language-"][data-line]':{paddingTop:"0",paddingBottom:"0",paddingLeft:"0"},"pre[data-line] code":{position:"relative",paddingLeft:"4em"},"pre .line-highlight":{marginTop:"0"}}],219470)},447593,e=>{"use strict";e.i(247167);var t=e.i(931067),r=e.i(271645),n={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"defs",attrs:{},children:[{tag:"style",attrs:{}}]},{tag:"path",attrs:{d:"M899.1 869.6l-53-305.6H864c14.4 0 26-11.6 26-26V346c0-14.4-11.6-26-26-26H618V138c0-14.4-11.6-26-26-26H432c-14.4 0-26 11.6-26 26v182H160c-14.4 0-26 11.6-26 26v192c0 14.4 11.6 26 26 26h17.9l-53 305.6a25.95 25.95 0 0025.6 30.4h723c1.5 0 3-.1 4.4-.4a25.88 25.88 0 0021.2-30zM204 390h272V182h72v208h272v104H204V390zm468 440V674c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v156H416V674c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v156H202.8l45.1-260H776l45.1 260H672z"}}]},name:"clear",theme:"outlined"},o=e.i(9583),i=r.forwardRef(function(e,i){return r.createElement(o.default,(0,t.default)({},e,{ref:i,icon:n}))});e.s(["ClearOutlined",0,i],447593)},589362,464398,e=>{"use strict";e.i(247167);var t=e.i(931067),r=e.i(271645);let n={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M872 394c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8H708V152c0-4.4-3.6-8-8-8h-64c-4.4 0-8 3.6-8 8v166H400V152c0-4.4-3.6-8-8-8h-64c-4.4 0-8 3.6-8 8v166H152c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h168v236H152c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h168v166c0 4.4 3.6 8 8 8h64c4.4 0 8-3.6 8-8V706h228v166c0 4.4 3.6 8 8 8h64c4.4 0 8-3.6 8-8V706h164c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8H708V394h164zM628 630H400V394h228v236z"}}]},name:"number",theme:"outlined"};var o=e.i(9583),i=r.forwardRef(function(e,i){return r.createElement(o.default,(0,t.default)({},e,{ref:i,icon:n}))});e.s(["NumberOutlined",0,i],589362);let a={icon:{tag:"svg",attrs:{"fill-rule":"evenodd",viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M880 912H144c-17.7 0-32-14.3-32-32V144c0-17.7 14.3-32 32-32h360c4.4 0 8 3.6 8 8v56c0 4.4-3.6 8-8 8H184v656h656V520c0-4.4 3.6-8 8-8h56c4.4 0 8 3.6 8 8v360c0 17.7-14.3 32-32 32zM653.3 424.6l52.2 52.2a8.01 8.01 0 01-4.7 13.6l-179.4 21c-5.1.6-9.5-3.7-8.9-8.9l21-179.4c.8-6.6 8.9-9.4 13.6-4.7l52.4 52.4 256.2-256.2c3.1-3.1 8.2-3.1 11.3 0l42.4 42.4c3.1 3.1 3.1 8.2 0 11.3L653.3 424.6z"}}]},name:"import",theme:"outlined"};var l=r.forwardRef(function(e,n){return r.createElement(o.default,(0,t.default)({},e,{ref:n,icon:a}))});e.s(["ImportOutlined",0,l],464398)},812618,e=>{"use strict";e.i(247167);var t=e.i(931067),r=e.i(271645);let n={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M632 888H392c-4.4 0-8 3.6-8 8v32c0 17.7 14.3 32 32 32h192c17.7 0 32-14.3 32-32v-32c0-4.4-3.6-8-8-8zM512 64c-181.1 0-328 146.9-328 328 0 121.4 66 227.4 164 284.1V792c0 17.7 14.3 32 32 32h264c17.7 0 32-14.3 32-32V676.1c98-56.7 164-162.7 164-284.1 0-181.1-146.9-328-328-328zm127.9 549.8L604 634.6V752H420V634.6l-35.9-20.8C305.4 568.3 256 484.5 256 392c0-141.4 114.6-256 256-256s256 114.6 256 256c0 92.5-49.4 176.3-128.1 221.8z"}}]},name:"bulb",theme:"outlined"};var o=e.i(9583),i=r.forwardRef(function(e,i){return r.createElement(o.default,(0,t.default)({},e,{ref:i,icon:n}))});e.s(["BulbOutlined",0,i],812618)},989022,e=>{"use strict";var t=e.i(843476),r=e.i(592968),n=e.i(637235),o=e.i(589362),i=e.i(464398),a=e.i(872934),l=e.i(812618),s=e.i(366308),c=e.i(458505);e.s(["default",0,({timeToFirstToken:e,totalLatency:d,usage:u,toolName:m})=>e||d||u?(0,t.jsxs)("div",{className:"response-metrics mt-2 pt-2 border-t border-gray-100 text-xs text-gray-500 flex flex-wrap gap-3",children:[void 0!==e&&(0,t.jsx)(r.Tooltip,{title:"Time to first token",children:(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)(n.ClockCircleOutlined,{className:"mr-1"}),(0,t.jsxs)("span",{children:["TTFT: ",(e/1e3).toFixed(2),"s"]})]})}),void 0!==d&&(0,t.jsx)(r.Tooltip,{title:"Total latency",children:(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)(n.ClockCircleOutlined,{className:"mr-1"}),(0,t.jsxs)("span",{children:["Total Latency: ",(d/1e3).toFixed(2),"s"]})]})}),u?.promptTokens!==void 0&&(0,t.jsx)(r.Tooltip,{title:"Prompt tokens",children:(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)(i.ImportOutlined,{className:"mr-1"}),(0,t.jsxs)("span",{children:["In: ",u.promptTokens]})]})}),u?.completionTokens!==void 0&&(0,t.jsx)(r.Tooltip,{title:"Completion tokens",children:(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)(a.ExportOutlined,{className:"mr-1"}),(0,t.jsxs)("span",{children:["Out: ",u.completionTokens]})]})}),u?.reasoningTokens!==void 0&&(0,t.jsx)(r.Tooltip,{title:"Reasoning tokens",children:(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)(l.BulbOutlined,{className:"mr-1"}),(0,t.jsxs)("span",{children:["Reasoning: ",u.reasoningTokens]})]})}),u?.totalTokens!==void 0&&(0,t.jsx)(r.Tooltip,{title:"Total tokens",children:(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)(o.NumberOutlined,{className:"mr-1"}),(0,t.jsxs)("span",{children:["Total: ",u.totalTokens]})]})}),u?.cost!==void 0&&(0,t.jsx)(r.Tooltip,{title:"Cost",children:(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)(c.DollarOutlined,{className:"mr-1"}),(0,t.jsxs)("span",{children:["$",u.cost.toFixed(6)]})]})}),m&&(0,t.jsx)(r.Tooltip,{title:"Tool used",children:(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)(s.ToolOutlined,{className:"mr-1"}),(0,t.jsxs)("span",{children:["Tool: ",m]})]})})]}):null])},132104,e=>{"use strict";e.i(247167);var t=e.i(931067),r=e.i(271645);let n={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M868 545.5L536.1 163a31.96 31.96 0 00-48.3 0L156 545.5a7.97 7.97 0 006 13.2h81c4.6 0 9-2 12.1-5.5L474 300.9V864c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V300.9l218.9 252.3c3 3.5 7.4 5.5 12.1 5.5h81c6.8 0 10.5-8 6-13.2z"}}]},name:"arrow-up",theme:"outlined"};var o=e.i(9583),i=r.forwardRef(function(e,i){return r.createElement(o.default,(0,t.default)({},e,{ref:i,icon:n}))});e.s(["ArrowUpOutlined",0,i],132104)},829672,836938,310730,e=>{"use strict";e.i(247167);var t=e.i(271645),r=e.i(343794),n=e.i(914949),o=e.i(404948);let i=e=>e?"function"==typeof e?e():e:null;e.s(["getRenderPropValue",0,i],836938);var a=e.i(613541),l=e.i(763731),s=e.i(242064),c=e.i(491816);e.i(793154);var d=e.i(880476),u=e.i(183293),m=e.i(717356),p=e.i(320560),g=e.i(307358),f=e.i(246422),h=e.i(838378),v=e.i(617933);let b=(0,f.genStyleHooks)("Popover",e=>{let{colorBgElevated:t,colorText:r}=e,n=(0,h.mergeToken)(e,{popoverBg:t,popoverColor:r});return[(e=>{let{componentCls:t,popoverColor:r,titleMinWidth:n,fontWeightStrong:o,innerPadding:i,boxShadowSecondary:a,colorTextHeading:l,borderRadiusLG:s,zIndexPopup:c,titleMarginBottom:d,colorBgElevated:m,popoverBg:g,titleBorderBottom:f,innerContentPadding:h,titlePadding:v}=e;return[{[t]:Object.assign(Object.assign({},(0,u.resetComponent)(e)),{position:"absolute",top:0,left:{_skip_check_:!0,value:0},zIndex:c,fontWeight:"normal",whiteSpace:"normal",textAlign:"start",cursor:"auto",userSelect:"text","--valid-offset-x":"var(--arrow-offset-horizontal, var(--arrow-x))",transformOrigin:"var(--valid-offset-x, 50%) var(--arrow-y, 50%)","--antd-arrow-background-color":m,width:"max-content",maxWidth:"100vw","&-rtl":{direction:"rtl"},"&-hidden":{display:"none"},[`${t}-content`]:{position:"relative"},[`${t}-inner`]:{backgroundColor:g,backgroundClip:"padding-box",borderRadius:s,boxShadow:a,padding:i},[`${t}-title`]:{minWidth:n,marginBottom:d,color:l,fontWeight:o,borderBottom:f,padding:v},[`${t}-inner-content`]:{color:r,padding:h}})},(0,p.default)(e,"var(--antd-arrow-background-color)"),{[`${t}-pure`]:{position:"relative",maxWidth:"none",margin:e.sizePopupArrow,display:"inline-block",[`${t}-content`]:{display:"inline-block"}}}]})(n),(e=>{let{componentCls:t}=e;return{[t]:v.PresetColors.map(r=>{let n=e[`${r}6`];return{[`&${t}-${r}`]:{"--antd-arrow-background-color":n,[`${t}-inner`]:{backgroundColor:n},[`${t}-arrow`]:{background:"transparent"}}}})}})(n),(0,m.initZoomMotion)(n,"zoom-big")]},e=>{let{lineWidth:t,controlHeight:r,fontHeight:n,padding:o,wireframe:i,zIndexPopupBase:a,borderRadiusLG:l,marginXS:s,lineType:c,colorSplit:d,paddingSM:u}=e,m=r-n;return Object.assign(Object.assign(Object.assign({titleMinWidth:177,zIndexPopup:a+30},(0,g.getArrowToken)(e)),(0,p.getArrowOffsetToken)({contentRadius:l,limitVerticalRadius:!0})),{innerPadding:12*!i,titleMarginBottom:i?0:s,titlePadding:i?`${m/2}px ${o}px ${m/2-t}px`:0,titleBorderBottom:i?`${t}px ${c} ${d}`:"none",innerContentPadding:i?`${u}px ${o}px`:0})},{resetStyle:!1,deprecatedTokens:[["width","titleMinWidth"],["minWidth","titleMinWidth"]]});var y=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 o=0,n=Object.getOwnPropertySymbols(e);ot.indexOf(n[o])&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r};let $=({title:e,content:r,prefixCls:n})=>e||r?t.createElement(t.Fragment,null,e&&t.createElement("div",{className:`${n}-title`},e),r&&t.createElement("div",{className:`${n}-inner-content`},r)):null,x=e=>{let{hashId:n,prefixCls:o,className:a,style:l,placement:s="top",title:c,content:u,children:m}=e,p=i(c),g=i(u),f=(0,r.default)(n,o,`${o}-pure`,`${o}-placement-${s}`,a);return t.createElement("div",{className:f,style:l},t.createElement("div",{className:`${o}-arrow`}),t.createElement(d.Popup,Object.assign({},e,{className:n,prefixCls:o}),m||t.createElement($,{prefixCls:o,title:p,content:g})))},k=e=>{let{prefixCls:n,className:o}=e,i=y(e,["prefixCls","className"]),{getPrefixCls:a}=t.useContext(s.ConfigContext),l=a("popover",n),[c,d,u]=b(l);return c(t.createElement(x,Object.assign({},i,{prefixCls:l,hashId:d,className:(0,r.default)(o,u)})))};e.s(["Overlay",0,$,"default",0,k],310730);var C=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 o=0,n=Object.getOwnPropertySymbols(e);ot.indexOf(n[o])&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r};let S=t.forwardRef((e,d)=>{var u,m;let{prefixCls:p,title:g,content:f,overlayClassName:h,placement:v="top",trigger:y="hover",children:x,mouseEnterDelay:k=.1,mouseLeaveDelay:S=.1,onOpenChange:A,overlayStyle:O={},styles:w,classNames:I}=e,E=C(e,["prefixCls","title","content","overlayClassName","placement","trigger","children","mouseEnterDelay","mouseLeaveDelay","onOpenChange","overlayStyle","styles","classNames"]),{getPrefixCls:j,className:z,style:M,classNames:T,styles:N}=(0,s.useComponentConfig)("popover"),P=j("popover",p),[B,_,W]=b(P),H=j(),L=(0,r.default)(h,_,W,z,T.root,null==I?void 0:I.root),D=(0,r.default)(T.body,null==I?void 0:I.body),[V,R]=(0,n.default)(!1,{value:null!=(u=e.open)?u:e.visible,defaultValue:null!=(m=e.defaultOpen)?m:e.defaultVisible}),F=(e,t)=>{R(e,!0),null==A||A(e,t)},G=i(g),X=i(f);return B(t.createElement(c.default,Object.assign({placement:v,trigger:y,mouseEnterDelay:k,mouseLeaveDelay:S},E,{prefixCls:P,classNames:{root:L,body:D},styles:{root:Object.assign(Object.assign(Object.assign(Object.assign({},N.root),M),O),null==w?void 0:w.root),body:Object.assign(Object.assign({},N.body),null==w?void 0:w.body)},ref:d,open:V,onOpenChange:e=>{F(e)},overlay:G||X?t.createElement($,{prefixCls:P,title:G,content:X}):null,transitionName:(0,a.getTransitionName)(H,"zoom-big",E.transitionName),"data-popover-inject":!0}),(0,l.cloneElement)(x,{onKeyDown:e=>{var r,n;(0,t.isValidElement)(x)&&(null==(n=null==x?void 0:(r=x.props).onKeyDown)||n.call(r,e)),e.keyCode===o.default.ESC&&F(!1,e)}})))});S._InternalPanelDoNotUseOrYouWillBeFired=k,e.s(["default",0,S],829672)},282786,e=>{"use strict";var t=e.i(829672);e.s(["Popover",()=>t.default])},458505,e=>{"use strict";e.i(247167);var t=e.i(931067),r=e.i(271645);let n={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372zm47.7-395.2l-25.4-5.9V348.6c38 5.2 61.5 29 65.5 58.2.5 4 3.9 6.9 7.9 6.9h44.9c4.7 0 8.4-4.1 8-8.8-6.1-62.3-57.4-102.3-125.9-109.2V263c0-4.4-3.6-8-8-8h-28.1c-4.4 0-8 3.6-8 8v33c-70.8 6.9-126.2 46-126.2 119 0 67.6 49.8 100.2 102.1 112.7l24.7 6.3v142.7c-44.2-5.9-69-29.5-74.1-61.3-.6-3.8-4-6.6-7.9-6.6H363c-4.7 0-8.4 4-8 8.7 4.5 55 46.2 105.6 135.2 112.1V761c0 4.4 3.6 8 8 8h28.4c4.4 0 8-3.6 8-8.1l-.2-31.7c78.3-6.9 134.3-48.8 134.3-124-.1-69.4-44.2-100.4-109-116.4zm-68.6-16.2c-5.6-1.6-10.3-3.1-15-5-33.8-12.2-49.5-31.9-49.5-57.3 0-36.3 27.5-57 64.5-61.7v124zM534.3 677V543.3c3.1.9 5.9 1.6 8.8 2.2 47.3 14.4 63.2 34.4 63.2 65.1 0 39.1-29.4 62.6-72 66.4z"}}]},name:"dollar",theme:"outlined"};var o=e.i(9583),i=r.forwardRef(function(e,i){return r.createElement(o.default,(0,t.default)({},e,{ref:i,icon:n}))});e.s(["DollarOutlined",0,i],458505)},245094,e=>{"use strict";e.i(247167);var t=e.i(931067),r=e.i(271645);let n={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M516 673c0 4.4 3.4 8 7.5 8h185c4.1 0 7.5-3.6 7.5-8v-48c0-4.4-3.4-8-7.5-8h-185c-4.1 0-7.5 3.6-7.5 8v48zm-194.9 6.1l192-161c3.8-3.2 3.8-9.1 0-12.3l-192-160.9A7.95 7.95 0 00308 351v62.7c0 2.4 1 4.6 2.9 6.1L420.7 512l-109.8 92.2a8.1 8.1 0 00-2.9 6.1V673c0 6.8 7.9 10.5 13.1 6.1zM880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z"}}]},name:"code",theme:"outlined"};var o=e.i(9583),i=r.forwardRef(function(e,i){return r.createElement(o.default,(0,t.default)({},e,{ref:i,icon:n}))});e.s(["CodeOutlined",0,i],245094)},872934,e=>{"use strict";e.i(247167);var t=e.i(931067),r=e.i(271645);let n={icon:{tag:"svg",attrs:{"fill-rule":"evenodd",viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M880 912H144c-17.7 0-32-14.3-32-32V144c0-17.7 14.3-32 32-32h360c4.4 0 8 3.6 8 8v56c0 4.4-3.6 8-8 8H184v656h656V520c0-4.4 3.6-8 8-8h56c4.4 0 8 3.6 8 8v360c0 17.7-14.3 32-32 32zM770.87 199.13l-52.2-52.2a8.01 8.01 0 014.7-13.6l179.4-21c5.1-.6 9.5 3.7 8.9 8.9l-21 179.4c-.8 6.6-8.9 9.4-13.6 4.7l-52.4-52.4-256.2 256.2a8.03 8.03 0 01-11.3 0l-42.4-42.4a8.03 8.03 0 010-11.3l256.1-256.3z"}}]},name:"export",theme:"outlined"};var o=e.i(9583),i=r.forwardRef(function(e,i){return r.createElement(o.default,(0,t.default)({},e,{ref:i,icon:n}))});e.s(["ExportOutlined",0,i],872934)},903446,e=>{"use strict";let t=(0,e.i(475254).default)("settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);e.s(["default",()=>t])},675879,e=>{"use strict";var t=e.i(843476),r=e.i(191403),n=e.i(135214);e.s(["default",0,()=>{let{accessToken:e}=(0,n.default)();return(0,t.jsx)(r.default,{accessToken:e})}])}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/130b80d41c79d98e.js b/litellm/proxy/_experimental/out/_next/static/chunks/130b80d41c79d98e.js new file mode 100644 index 00000000000..34a8b2172fe --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/130b80d41c79d98e.js @@ -0,0 +1,139 @@ +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,233525,(e,t,l)=>{"use strict";Object.defineProperty(l,"__esModule",{value:!0}),Object.defineProperty(l,"warnOnce",{enumerable:!0,get:function(){return a}});let a=e=>{}},349356,e=>{e.v({AElig:"Æ",AMP:"&",Aacute:"Á",Acirc:"Â",Agrave:"À",Aring:"Å",Atilde:"Ã",Auml:"Ä",COPY:"©",Ccedil:"Ç",ETH:"Ð",Eacute:"É",Ecirc:"Ê",Egrave:"È",Euml:"Ë",GT:">",Iacute:"Í",Icirc:"Î",Igrave:"Ì",Iuml:"Ï",LT:"<",Ntilde:"Ñ",Oacute:"Ó",Ocirc:"Ô",Ograve:"Ò",Oslash:"Ø",Otilde:"Õ",Ouml:"Ö",QUOT:'"',REG:"®",THORN:"Þ",Uacute:"Ú",Ucirc:"Û",Ugrave:"Ù",Uuml:"Ü",Yacute:"Ý",aacute:"á",acirc:"â",acute:"´",aelig:"æ",agrave:"à",amp:"&",aring:"å",atilde:"ã",auml:"ä",brvbar:"¦",ccedil:"ç",cedil:"¸",cent:"¢",copy:"©",curren:"¤",deg:"°",divide:"÷",eacute:"é",ecirc:"ê",egrave:"è",eth:"ð",euml:"ë",frac12:"½",frac14:"¼",frac34:"¾",gt:">",iacute:"í",icirc:"î",iexcl:"¡",igrave:"ì",iquest:"¿",iuml:"ï",laquo:"«",lt:"<",macr:"¯",micro:"µ",middot:"·",nbsp:" ",not:"¬",ntilde:"ñ",oacute:"ó",ocirc:"ô",ograve:"ò",ordf:"ª",ordm:"º",oslash:"ø",otilde:"õ",ouml:"ö",para:"¶",plusmn:"±",pound:"£",quot:'"',raquo:"»",reg:"®",sect:"§",shy:"­",sup1:"¹",sup2:"²",sup3:"³",szlig:"ß",thorn:"þ",times:"×",uacute:"ú",ucirc:"û",ugrave:"ù",uml:"¨",uuml:"ü",yacute:"ý",yen:"¥",yuml:"ÿ"})},137429,e=>{e.v({0:"�",128:"€",130:"‚",131:"ƒ",132:"„",133:"…",134:"†",135:"‡",136:"ˆ",137:"‰",138:"Š",139:"‹",140:"Œ",142:"Ž",145:"‘",146:"’",147:"“",148:"”",149:"•",150:"–",151:"—",152:"˜",153:"™",154:"š",155:"›",156:"œ",158:"ž",159:"Ÿ"})},21548,e=>{"use strict";var t=e.i(616303);e.s(["Empty",()=>t.default])},114600,e=>{"use strict";var t=e.i(290571),l=e.i(444755),a=e.i(673706),s=e.i(271645);let r=(0,a.makeClassName)("Divider"),i=s.default.forwardRef((e,a)=>{let{className:i,children:n}=e,o=(0,t.__rest)(e,["className","children"]);return s.default.createElement("div",Object.assign({ref:a,className:(0,l.tremorTwMerge)(r("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",i)},o),n?s.default.createElement(s.default.Fragment,null,s.default.createElement("div",{className:(0,l.tremorTwMerge)("w-full h-[1px] bg-tremor-border dark:bg-dark-tremor-border")}),s.default.createElement("div",{className:(0,l.tremorTwMerge)("text-inherit whitespace-nowrap")},n),s.default.createElement("div",{className:(0,l.tremorTwMerge)("w-full h-[1px] bg-tremor-border dark:bg-dark-tremor-border")})):s.default.createElement("div",{className:(0,l.tremorTwMerge)("w-full h-[1px] bg-tremor-border dark:bg-dark-tremor-border")}))});i.displayName="Divider",e.s(["Divider",()=>i],114600)},883552,e=>{"use strict";e.i(247167);var t=e.i(271645),l=e.i(562901),a=e.i(343794),s=e.i(914949),r=e.i(529681),i=e.i(242064),n=e.i(829672),o=e.i(285781),c=e.i(836938),d=e.i(920228),u=e.i(62405),m=e.i(408850),h=e.i(87414),g=e.i(310730);let x=(0,e.i(246422).genStyleHooks)("Popconfirm",e=>(e=>{let{componentCls:t,iconCls:l,antCls:a,zIndexPopup:s,colorText:r,colorWarning:i,marginXXS:n,marginXS:o,fontSize:c,fontWeightStrong:d,colorTextHeading:u}=e;return{[t]:{zIndex:s,[`&${a}-popover`]:{fontSize:c},[`${t}-message`]:{marginBottom:o,display:"flex",flexWrap:"nowrap",alignItems:"start",[`> ${t}-message-icon ${l}`]:{color:i,fontSize:c,lineHeight:1,marginInlineEnd:o},[`${t}-title`]:{fontWeight:d,color:u,"&:only-child":{fontWeight:"normal"}},[`${t}-description`]:{marginTop:n,color:r}},[`${t}-buttons`]:{textAlign:"end",whiteSpace:"nowrap",button:{marginInlineStart:o}}}}})(e),e=>{let{zIndexPopupBase:t}=e;return{zIndexPopup:t+60}},{resetStyle:!1});var p=function(e,t){var l={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&0>t.indexOf(a)&&(l[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var s=0,a=Object.getOwnPropertySymbols(e);st.indexOf(a[s])&&Object.prototype.propertyIsEnumerable.call(e,a[s])&&(l[a[s]]=e[a[s]]);return l};let f=e=>{let{prefixCls:a,okButtonProps:s,cancelButtonProps:r,title:n,description:g,cancelText:x,okText:p,okType:f="primary",icon:b=t.createElement(l.default,null),showCancel:y=!0,close:j,onConfirm:v,onCancel:w,onPopupClick:_}=e,{getPrefixCls:N}=t.useContext(i.ConfigContext),[k]=(0,m.useLocale)("Popconfirm",h.default.Popconfirm),C=(0,c.getRenderPropValue)(n),S=(0,c.getRenderPropValue)(g);return t.createElement("div",{className:`${a}-inner-content`,onClick:_},t.createElement("div",{className:`${a}-message`},b&&t.createElement("span",{className:`${a}-message-icon`},b),t.createElement("div",{className:`${a}-message-text`},C&&t.createElement("div",{className:`${a}-title`},C),S&&t.createElement("div",{className:`${a}-description`},S))),t.createElement("div",{className:`${a}-buttons`},y&&t.createElement(d.default,Object.assign({onClick:w,size:"small"},r),x||(null==k?void 0:k.cancelText)),t.createElement(o.default,{buttonProps:Object.assign(Object.assign({size:"small"},(0,u.convertLegacyProps)(f)),s),actionFn:v,close:j,prefixCls:N("btn"),quitOnNullishReturnValue:!0,emitEvent:!0},p||(null==k?void 0:k.okText))))};var b=function(e,t){var l={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&0>t.indexOf(a)&&(l[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var s=0,a=Object.getOwnPropertySymbols(e);st.indexOf(a[s])&&Object.prototype.propertyIsEnumerable.call(e,a[s])&&(l[a[s]]=e[a[s]]);return l};let y=t.forwardRef((e,o)=>{var c,d;let{prefixCls:u,placement:m="top",trigger:h="click",okType:g="primary",icon:p=t.createElement(l.default,null),children:y,overlayClassName:j,onOpenChange:v,onVisibleChange:w,overlayStyle:_,styles:N,classNames:k}=e,C=b(e,["prefixCls","placement","trigger","okType","icon","children","overlayClassName","onOpenChange","onVisibleChange","overlayStyle","styles","classNames"]),{getPrefixCls:S,className:T,style:I,classNames:E,styles:A}=(0,i.useComponentConfig)("popconfirm"),[D,M]=(0,s.default)(!1,{value:null!=(c=e.open)?c:e.visible,defaultValue:null!=(d=e.defaultOpen)?d:e.defaultVisible}),P=(e,t)=>{M(e,!0),null==w||w(e),null==v||v(e,t)},B=S("popconfirm",u),O=(0,a.default)(B,T,j,E.root,null==k?void 0:k.root),R=(0,a.default)(E.body,null==k?void 0:k.body),[L]=x(B);return L(t.createElement(n.default,Object.assign({},(0,r.default)(C,["title"]),{trigger:h,placement:m,onOpenChange:(t,l)=>{let{disabled:a=!1}=e;a||P(t,l)},open:D,ref:o,classNames:{root:O,body:R},styles:{root:Object.assign(Object.assign(Object.assign(Object.assign({},A.root),I),_),null==N?void 0:N.root),body:Object.assign(Object.assign({},A.body),null==N?void 0:N.body)},content:t.createElement(f,Object.assign({okType:g,icon:p},e,{prefixCls:B,close:e=>{P(!1,e)},onConfirm:t=>{var l;return null==(l=e.onConfirm)?void 0:l.call(void 0,t)},onCancel:t=>{var l;P(!1,t),null==(l=e.onCancel)||l.call(void 0,t)}})),"data-popover-inject":!0}),y))});y._InternalPanelDoNotUseOrYouWillBeFired=e=>{let{prefixCls:l,placement:s,className:r,style:n}=e,o=p(e,["prefixCls","placement","className","style"]),{getPrefixCls:c}=t.useContext(i.ConfigContext),d=c("popconfirm",l),[u]=x(d);return u(t.createElement(g.default,{placement:s,className:(0,a.default)(d,r),style:n,content:t.createElement(f,Object.assign({prefixCls:d},o))}))},e.s(["Popconfirm",0,y],883552)},724154,e=>{"use strict";e.i(247167);var t=e.i(931067),l=e.i(271645);let a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"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"};var s=e.i(9583),r=l.forwardRef(function(e,r){return l.createElement(s.default,(0,t.default)({},e,{ref:r,icon:a}))});e.s(["StopOutlined",0,r],724154)},178654,621192,e=>{"use strict";let t=e.i(211576).Col;e.s(["Col",0,t],178654);let l=e.i(264042).Row;e.s(["Row",0,l],621192)},564897,e=>{"use strict";e.i(247167);var t=e.i(931067),l=e.i(271645);let a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M696 480H328c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h368c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8z"}},{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}}]},name:"minus-circle",theme:"outlined"};var s=e.i(9583),r=l.forwardRef(function(e,r){return l.createElement(s.default,(0,t.default)({},e,{ref:r,icon:a}))});e.s(["MinusCircleOutlined",0,r],564897)},750113,e=>{"use strict";var t=e.i(684024);e.s(["QuestionCircleOutlined",()=>t.default])},546467,e=>{"use strict";let t=(0,e.i(475254).default)("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);e.s(["default",()=>t])},987432,e=>{"use strict";e.i(247167);var t=e.i(931067),l=e.i(271645);let a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M893.3 293.3L730.7 130.7c-7.5-7.5-16.7-13-26.7-16V112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V338.5c0-17-6.7-33.2-18.7-45.2zM384 184h256v104H384V184zm456 656H184V184h136v136c0 17.7 14.3 32 32 32h320c17.7 0 32-14.3 32-32V205.8l136 136V840zM512 442c-79.5 0-144 64.5-144 144s64.5 144 144 144 144-64.5 144-144-64.5-144-144-144zm0 224c-44.2 0-80-35.8-80-80s35.8-80 80-80 80 35.8 80 80-35.8 80-80 80z"}}]},name:"save",theme:"outlined"};var s=e.i(9583),r=l.forwardRef(function(e,r){return l.createElement(s.default,(0,t.default)({},e,{ref:r,icon:a}))});e.s(["SaveOutlined",0,r],987432)},211576,e=>{"use strict";var t=e.i(131757);e.s(["Col",()=>t.default])},928685,e=>{"use strict";var t=e.i(38953);e.s(["SearchOutlined",()=>t.default])},788191,e=>{"use strict";e.i(247167);var t=e.i(931067),l=e.i(271645);let a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"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"};var s=e.i(9583),r=l.forwardRef(function(e,r){return l.createElement(s.default,(0,t.default)({},e,{ref:r,icon:a}))});e.s(["PlayCircleOutlined",0,r],788191)},634831,438100,302202,e=>{"use strict";var t=e.i(546467);e.s(["ExternalLinkIcon",()=>t.default],634831);var l=e.i(475254);let a=(0,l.default)("key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]]);e.s(["KeyIcon",()=>a],438100);let s=(0,l.default)("server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);e.s(["ServerIcon",()=>s],302202)},446891,836991,153472,e=>{"use strict";var t,l,a=e.i(843476),s=e.i(464571),r=e.i(326373),i=e.i(94629),n=e.i(360820),o=e.i(871943),c=e.i(271645);let d=c.forwardRef(function(e,t){return c.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),c.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"}))});e.s(["XIcon",0,d],836991),e.s(["TableHeaderSortDropdown",0,({sortState:e,onSortChange:t})=>{let l=[{key:"asc",label:"Ascending",icon:(0,a.jsx)(n.ChevronUpIcon,{className:"h-4 w-4"})},{key:"desc",label:"Descending",icon:(0,a.jsx)(o.ChevronDownIcon,{className:"h-4 w-4"})},{key:"reset",label:"Reset",icon:(0,a.jsx)(d,{className:"h-4 w-4"})}];return(0,a.jsx)(r.Dropdown,{menu:{items:l,onClick:({key:e})=>{"asc"===e?t("asc"):"desc"===e?t("desc"):"reset"===e&&t(!1)},selectable:!0,selectedKeys:e?[e]:[]},trigger:["click"],autoAdjustOverflow:!0,children:(0,a.jsx)(s.Button,{type:"text",onClick:e=>e.stopPropagation(),icon:"asc"===e?(0,a.jsx)(n.ChevronUpIcon,{className:"h-4 w-4"}):"desc"===e?(0,a.jsx)(o.ChevronDownIcon,{className:"h-4 w-4"}):(0,a.jsx)(i.SwitchVerticalIcon,{className:"h-4 w-4"}),className:e?"text-blue-500 hover:text-blue-600":"text-gray-400 hover:text-blue-500"})})}],446891);var u=e.i(266027),m=e.i(954616),h=e.i(243652),g=e.i(135214),x=e.i(764205),p=((t={}).GENERAL_SETTINGS="general_settings",t),f=((l={}).MAXIMUM_SPEND_LOGS_RETENTION_PERIOD="maximum_spend_logs_retention_period",l);let b=async(e,t)=>{try{let l=x.proxyBaseUrl?`${x.proxyBaseUrl}/config/list?config_type=${t}`:`/config/list?config_type=${t}`,a=await fetch(l,{method:"GET",headers:{[(0,x.getGlobalLitellmHeaderName)()]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!a.ok){let e=await a.json(),t=(0,x.deriveErrorMessage)(e);throw(0,x.handleError)(t),Error(t)}return await a.json()}catch(e){throw console.error(`Failed to get proxy config for ${t}:`,e),e}},y=(0,h.createQueryKeys)("proxyConfig"),j=async(e,t)=>{try{let l=x.proxyBaseUrl?`${x.proxyBaseUrl}/config/field/delete`:"/config/field/delete",a=await fetch(l,{method:"POST",headers:{[(0,x.getGlobalLitellmHeaderName)()]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!a.ok){let e=await a.json(),t=(0,x.deriveErrorMessage)(e);throw(0,x.handleError)(t),Error(t)}return await a.json()}catch(e){throw console.error(`Failed to delete proxy config field ${t.field_name}:`,e),e}};e.s(["ConfigType",()=>p,"GeneralSettingsFieldName",()=>f,"useDeleteProxyConfigField",0,()=>{let{accessToken:e}=(0,g.default)();return(0,m.useMutation)({mutationFn:async t=>{if(!e)throw Error("Access token is required");return await j(e,t)}})},"useProxyConfig",0,e=>{let{accessToken:t}=(0,g.default)();return(0,u.useQuery)({queryKey:y.list({filters:{configType:e}}),queryFn:async()=>await b(t,e),enabled:!!t})}],153472)},418371,e=>{"use strict";var t=e.i(843476),l=e.i(271645),a=e.i(916925);e.s(["ProviderLogo",0,({provider:e,className:s="w-4 h-4"})=>{let[r,i]=(0,l.useState)(!1),{logo:n}=(0,a.getProviderLogoAndName)(e);return r||!n?(0,t.jsx)("div",{className:`${s} rounded-full bg-gray-200 flex items-center justify-center text-xs`,children:e?.charAt(0)||"-"}):(0,t.jsx)("img",{src:n,alt:`${e} logo`,className:s,onError:()=>i(!0)})}])},149121,e=>{"use strict";var t=e.i(843476),l=e.i(271645),a=e.i(152990),s=e.i(682830),r=e.i(269200),i=e.i(427612),n=e.i(64848),o=e.i(942232),c=e.i(496020),d=e.i(977572);function u({data:e=[],columns:u,onRowClick:m,renderSubComponent:h,renderChildRows:g,getRowCanExpand:x,isLoading:p=!1,loadingMessage:f="🚅 Loading logs...",noDataMessage:b="No logs found",enableSorting:y=!1}){let j=!!(h||g)&&!!x,[v,w]=(0,l.useState)([]),_=(0,a.useReactTable)({data:e,columns:u,...y&&{state:{sorting:v},onSortingChange:w,enableSortingRemoval:!1},...j&&{getRowCanExpand:x},getRowId:(e,t)=>e?.request_id??String(t),getCoreRowModel:(0,s.getCoreRowModel)(),...y&&{getSortedRowModel:(0,s.getSortedRowModel)()},...j&&{getExpandedRowModel:(0,s.getExpandedRowModel)()}});return(0,t.jsx)("div",{className:"rounded-lg custom-border overflow-x-auto w-full max-w-full box-border",children:(0,t.jsxs)(r.Table,{className:"[&_td]:py-0.5 [&_th]:py-1 table-fixed w-full box-border",style:{minWidth:"400px"},children:[(0,t.jsx)(i.TableHead,{children:_.getHeaderGroups().map(e=>(0,t.jsx)(c.TableRow,{children:e.headers.map(e=>{let l=y&&e.column.getCanSort(),s=e.column.getIsSorted();return(0,t.jsx)(n.TableHeaderCell,{className:`py-1 h-8 ${l?"cursor-pointer select-none hover:bg-gray-50":""}`,onClick:l?e.column.getToggleSortingHandler():void 0,children:e.isPlaceholder?null:(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.flexRender)(e.column.columnDef.header,e.getContext()),l&&(0,t.jsx)("span",{className:"text-gray-400",children:"asc"===s?"↑":"desc"===s?"↓":"⇅"})]})},e.id)})},e.id))}),(0,t.jsx)(o.TableBody,{children:p?(0,t.jsx)(c.TableRow,{children:(0,t.jsx)(d.TableCell,{colSpan:u.length,className:"h-8 text-center",children:(0,t.jsx)("div",{className:"text-center text-gray-500",children:(0,t.jsx)("p",{children:f})})})}):_.getRowModel().rows.length>0?_.getRowModel().rows.map(e=>(0,t.jsxs)(l.Fragment,{children:[(0,t.jsx)(c.TableRow,{className:`h-8 ${m?"cursor-pointer hover:bg-gray-50":""}`,onClick:()=>m?.(e.original),children:e.getVisibleCells().map(e=>(0,t.jsx)(d.TableCell,{className:"py-0.5 max-h-8 overflow-hidden text-ellipsis whitespace-nowrap",children:(0,a.flexRender)(e.column.columnDef.cell,e.getContext())},e.id))}),j&&e.getIsExpanded()&&g&&g({row:e}),j&&e.getIsExpanded()&&h&&!g&&(0,t.jsx)(c.TableRow,{children:(0,t.jsx)(d.TableCell,{colSpan:e.getVisibleCells().length,className:"p-0",children:(0,t.jsx)("div",{className:"w-full max-w-full overflow-hidden box-border",children:h({row:e})})})})]},e.id)):(0,t.jsx)(c.TableRow,{children:(0,t.jsx)(d.TableCell,{colSpan:u.length,className:"h-8 text-center",children:(0,t.jsx)("div",{className:"text-center text-gray-500",children:(0,t.jsx)("p",{children:b})})})})})]})})}e.s(["DataTable",()=>u])},37091,e=>{"use strict";var t=e.i(290571),l=e.i(95779),a=e.i(444755),s=e.i(673706),r=e.i(271645);let i=r.default.forwardRef((e,i)=>{let{color:n,children:o,className:c}=e,d=(0,t.__rest)(e,["color","children","className"]);return r.default.createElement("p",Object.assign({ref:i,className:(0,a.tremorTwMerge)(n?(0,s.getColorClassNames)(n,l.colorPalette.lightText).textColor:"text-tremor-content-emphasis dark:text-dark-tremor-content-emphasis",c)},d),o)});i.displayName="Subtitle",e.s(["Subtitle",()=>i],37091)},571303,e=>{"use strict";var t=e.i(843476),l=e.i(271645),a=e.i(115504);function s({className:e="",...s}){var r,i;let n=(0,l.useId)();return r=()=>{let e=document.getAnimations().filter(e=>e instanceof CSSAnimation&&"spin"===e.animationName),t=e.find(e=>e.effect.target?.getAttribute("data-spinner-id")===n),l=e.find(e=>e.effect instanceof KeyframeEffect&&e.effect.target?.getAttribute("data-spinner-id")!==n);t&&l&&(t.currentTime=l.currentTime)},i=[n],(0,l.useLayoutEffect)(r,i),(0,t.jsxs)("svg",{"data-spinner-id":n,className:(0,a.cx)("pointer-events-none size-12 animate-spin text-current",e),fill:"none",viewBox:"0 0 24 24",...s,children:[(0,t.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,t.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})}e.s(["UiLoadingSpinner",()=>s],571303)},936578,e=>{"use strict";var t=e.i(843476),l=e.i(115504),a=e.i(571303);function s(){return(0,t.jsxs)("div",{className:(0,l.cx)("h-screen","flex items-center justify-center gap-4"),children:[(0,t.jsx)("div",{className:"text-lg font-medium py-2 pr-4 border-r border-r-gray-200",children:"🚅 LiteLLM"}),(0,t.jsxs)("div",{className:"flex items-center justify-center gap-2",children:[(0,t.jsx)(a.UiLoadingSpinner,{className:"size-4"}),(0,t.jsx)("span",{className:"text-gray-600 text-sm",children:"Loading..."})]})]})}e.s(["default",()=>s])},208075,e=>{"use strict";var t=e.i(843476),l=e.i(271645),a=e.i(304967),s=e.i(629569),r=e.i(599724),i=e.i(779241),n=e.i(994388),o=e.i(275144),c=e.i(764205),d=e.i(727749);e.s(["default",0,({userID:e,userRole:u,accessToken:m})=>{let{logoUrl:h,setLogoUrl:g,faviconUrl:x,setFaviconUrl:p}=(0,o.useTheme)(),[f,b]=(0,l.useState)(""),[y,j]=(0,l.useState)(""),[v,w]=(0,l.useState)(!1);(0,l.useEffect)(()=>{m&&_()},[m]);let _=async()=>{try{let e=(0,c.getProxyBaseUrl)(),t=e?`${e}/get/ui_theme_settings`:"/get/ui_theme_settings",l=await fetch(t,{method:"GET",headers:{[(0,c.getGlobalLitellmHeaderName)()]:`Bearer ${m}`,"Content-Type":"application/json"}});if(l.ok){let e=await l.json();b(e.values?.logo_url||""),j(e.values?.favicon_url||""),g(e.values?.logo_url||null),p(e.values?.favicon_url||null)}}catch(e){console.error("Error fetching theme settings:",e)}},N=async()=>{w(!0);try{let e=(0,c.getProxyBaseUrl)(),t=e?`${e}/update/ui_theme_settings`:"/update/ui_theme_settings";if((await fetch(t,{method:"PATCH",headers:{[(0,c.getGlobalLitellmHeaderName)()]:`Bearer ${m}`,"Content-Type":"application/json"},body:JSON.stringify({logo_url:f||null,favicon_url:y||null})})).ok)d.default.success("Theme settings updated successfully!"),g(f||null),p(y||null);else throw Error("Failed to update settings")}catch(e){console.error("Error updating theme settings:",e),d.default.fromBackend("Failed to update theme settings")}finally{w(!1)}},k=async()=>{b(""),j(""),g(null),p(null),w(!0);try{let e=(0,c.getProxyBaseUrl)(),t=e?`${e}/update/ui_theme_settings`:"/update/ui_theme_settings";if((await fetch(t,{method:"PATCH",headers:{[(0,c.getGlobalLitellmHeaderName)()]:`Bearer ${m}`,"Content-Type":"application/json"},body:JSON.stringify({logo_url:null,favicon_url:null})})).ok)d.default.success("Theme settings reset to default!");else throw Error("Failed to reset")}catch(e){console.error("Error resetting theme settings:",e),d.default.fromBackend("Failed to reset theme settings")}finally{w(!1)}};return m?(0,t.jsxs)("div",{className:"w-full mx-auto max-w-4xl px-6 py-8",children:[(0,t.jsxs)("div",{className:"mb-8",children:[(0,t.jsx)(s.Title,{className:"text-2xl font-bold mb-2",children:"UI Theme Customization"}),(0,t.jsx)(r.Text,{className:"text-gray-600",children:"Customize your LiteLLM admin dashboard with a custom logo and favicon."})]}),(0,t.jsx)(a.Card,{className:"shadow-sm p-6",children:(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(r.Text,{className:"text-sm font-medium text-gray-700 mb-2 block",children:"Custom Logo URL"}),(0,t.jsx)(i.TextInput,{placeholder:"https://example.com/logo.png",value:f,onValueChange:e=>{b(e),g(e||null)},className:"w-full"}),(0,t.jsx)(r.Text,{className:"text-xs text-gray-500 mt-1",children:"Enter a URL for your custom logo or leave empty for default"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(r.Text,{className:"text-sm font-medium text-gray-700 mb-2 block",children:"Custom Favicon URL"}),(0,t.jsx)(i.TextInput,{placeholder:"https://example.com/favicon.ico",value:y,onValueChange:e=>{j(e),p(e||null)},className:"w-full"}),(0,t.jsx)(r.Text,{className:"text-xs text-gray-500 mt-1",children:"Enter a URL for your custom favicon (.ico, .png, or .svg) or leave empty for default"})]}),(0,t.jsxs)("div",{className:"flex gap-3 pt-4",children:[(0,t.jsx)(n.Button,{onClick:N,loading:v,disabled:v,color:"indigo",children:"Save Changes"}),(0,t.jsx)(n.Button,{onClick:k,loading:v,disabled:v,variant:"secondary",color:"gray",children:"Reset to Default"})]})]})})]}):null}])},662316,e=>{"use strict";var t=e.i(843476),l=e.i(271645),a=e.i(464571),s=e.i(166406),r=e.i(629569),i=e.i(764205),n=e.i(727749);e.s(["default",0,({accessToken:e})=>{let[o,c]=(0,l.useState)(`{ + "model": "openai/gpt-4o", + "messages": [ + { + "role": "system", + "content": "You are a helpful assistant." + }, + { + "role": "user", + "content": "Explain quantum computing in simple terms" + } + ], + "temperature": 0.7, + "max_tokens": 500, + "stream": true +}`),[d,u]=(0,l.useState)(""),[m,h]=(0,l.useState)(!1),g=async()=>{h(!0);try{let s;try{s=JSON.parse(o)}catch(e){n.default.fromBackend("Invalid JSON in request body"),h(!1);return}let r={call_type:"completion",request_body:s};if(!e){n.default.fromBackend("No access token found"),h(!1);return}let c=await (0,i.transformRequestCall)(e,r);if(c.raw_request_api_base&&c.raw_request_body){var t,l,a;let e,s,r=(t=c.raw_request_api_base,l=c.raw_request_body,a=c.raw_request_headers||{},e=JSON.stringify(l,null,2).split("\n").map(e=>` ${e}`).join("\n"),s=Object.entries(a).map(([e,t])=>`-H '${e}: ${t}'`).join(" \\\n "),`curl -X POST \\ + ${t} \\ + ${s?`${s} \\ + `:""}-H 'Content-Type: application/json' \\ + -d '{ +${e} + }'`);u(r),n.default.success("Request transformed successfully")}else{let e="string"==typeof c?c:JSON.stringify(c);u(e),n.default.info("Transformed request received in unexpected format")}}catch(e){console.error("Error transforming request:",e),n.default.fromBackend("Failed to transform request")}finally{h(!1)}};return(0,t.jsxs)("div",{className:"w-full m-2",style:{overflow:"hidden"},children:[(0,t.jsx)(r.Title,{children:"Playground"}),(0,t.jsx)("p",{className:"text-sm text-gray-500",children:"See how LiteLLM transforms your request for the specified provider."}),(0,t.jsxs)("div",{style:{display:"flex",gap:"16px",width:"100%",minWidth:0,overflow:"hidden"},className:"mt-4",children:[(0,t.jsxs)("div",{style:{flex:"1 1 50%",display:"flex",flexDirection:"column",border:"1px solid #e8e8e8",borderRadius:"8px",padding:"24px",overflow:"hidden",maxHeight:"600px",minWidth:0},children:[(0,t.jsxs)("div",{style:{marginBottom:"24px"},children:[(0,t.jsx)("h2",{style:{fontSize:"24px",fontWeight:"bold",margin:"0 0 4px 0"},children:"Original Request"}),(0,t.jsx)("p",{style:{color:"#666",margin:0},children:"The request you would send to LiteLLM /chat/completions endpoint."})]}),(0,t.jsx)("textarea",{style:{flex:"1 1 auto",width:"100%",minHeight:"240px",padding:"16px",border:"1px solid #e8e8e8",borderRadius:"6px",fontFamily:"monospace",fontSize:"14px",resize:"none",marginBottom:"24px",overflow:"auto"},value:o,onChange:e=>c(e.target.value),onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&"Enter"===e.key&&(e.preventDefault(),g())},placeholder:"Press Cmd/Ctrl + Enter to transform"}),(0,t.jsx)("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:"auto"},children:(0,t.jsxs)(a.Button,{type:"primary",style:{backgroundColor:"#000",display:"flex",alignItems:"center",gap:"8px"},onClick:g,loading:m,children:[(0,t.jsx)("span",{children:"Transform"}),(0,t.jsx)("span",{children:"→"})]})})]}),(0,t.jsxs)("div",{style:{flex:"1 1 50%",display:"flex",flexDirection:"column",border:"1px solid #e8e8e8",borderRadius:"8px",padding:"24px",overflow:"hidden",maxHeight:"800px",minWidth:0},children:[(0,t.jsxs)("div",{style:{marginBottom:"24px"},children:[(0,t.jsx)("h2",{style:{fontSize:"24px",fontWeight:"bold",margin:"0 0 4px 0"},children:"Transformed Request"}),(0,t.jsx)("p",{style:{color:"#666",margin:0},children:"How LiteLLM transforms your request for the specified provider."}),(0,t.jsx)("br",{}),(0,t.jsx)("p",{style:{color:"#666",margin:0},className:"text-xs",children:"Note: Sensitive headers are not shown."})]}),(0,t.jsxs)("div",{style:{position:"relative",backgroundColor:"#f5f5f5",borderRadius:"6px",flex:"1 1 auto",display:"flex",flexDirection:"column",overflow:"hidden"},children:[(0,t.jsx)("pre",{style:{padding:"16px",fontFamily:"monospace",fontSize:"14px",margin:0,overflow:"auto",flex:"1 1 auto"},children:d||`curl -X POST \\ + https://api.openai.com/v1/chat/completions \\ + -H 'Authorization: Bearer sk-xxx' \\ + -H 'Content-Type: application/json' \\ + -d '{ + "model": "gpt-4", + "messages": [ + { + "role": "system", + "content": "You are a helpful assistant." + } + ], + "temperature": 0.7 + }'`}),(0,t.jsx)(a.Button,{type:"text",icon:(0,t.jsx)(s.CopyOutlined,{}),style:{position:"absolute",right:"8px",top:"8px"},size:"small",onClick:()=>{navigator.clipboard.writeText(d||""),n.default.success("Copied to clipboard")}})]})]})]}),(0,t.jsx)("div",{className:"mt-4 text-right w-full",children:(0,t.jsxs)("p",{className:"text-sm text-gray-500",children:["Found an error? File an issue"," ",(0,t.jsx)("a",{href:"https://github.com/BerriAI/litellm/issues",target:"_blank",rel:"noopener noreferrer",children:"here"}),"."]})})]})}])},673709,e=>{"use strict";var t=e.i(843476),l=e.i(271645),a=e.i(678784);let s=(0,e.i(475254).default)("clipboard",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}]]);var r=e.i(650056);let i={'code[class*="language-"]':{background:"hsl(230, 1%, 98%)",color:"hsl(230, 8%, 24%)",fontFamily:'"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"2",OTabSize:"2",tabSize:"2",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none"},'pre[class*="language-"]':{background:"hsl(230, 1%, 98%)",color:"hsl(230, 8%, 24%)",fontFamily:'"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"2",OTabSize:"2",tabSize:"2",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none",padding:"1em",margin:"0.5em 0",overflow:"auto",borderRadius:"0.3em"},'code[class*="language-"]::-moz-selection':{background:"hsl(230, 1%, 90%)",color:"inherit"},'code[class*="language-"] *::-moz-selection':{background:"hsl(230, 1%, 90%)",color:"inherit"},'pre[class*="language-"] *::-moz-selection':{background:"hsl(230, 1%, 90%)",color:"inherit"},'code[class*="language-"]::selection':{background:"hsl(230, 1%, 90%)",color:"inherit"},'code[class*="language-"] *::selection':{background:"hsl(230, 1%, 90%)",color:"inherit"},'pre[class*="language-"] *::selection':{background:"hsl(230, 1%, 90%)",color:"inherit"},':not(pre) > code[class*="language-"]':{padding:"0.2em 0.3em",borderRadius:"0.3em",whiteSpace:"normal"},comment:{color:"hsl(230, 4%, 64%)",fontStyle:"italic"},prolog:{color:"hsl(230, 4%, 64%)"},cdata:{color:"hsl(230, 4%, 64%)"},doctype:{color:"hsl(230, 8%, 24%)"},punctuation:{color:"hsl(230, 8%, 24%)"},entity:{color:"hsl(230, 8%, 24%)",cursor:"help"},"attr-name":{color:"hsl(35, 99%, 36%)"},"class-name":{color:"hsl(35, 99%, 36%)"},boolean:{color:"hsl(35, 99%, 36%)"},constant:{color:"hsl(35, 99%, 36%)"},number:{color:"hsl(35, 99%, 36%)"},atrule:{color:"hsl(35, 99%, 36%)"},keyword:{color:"hsl(301, 63%, 40%)"},property:{color:"hsl(5, 74%, 59%)"},tag:{color:"hsl(5, 74%, 59%)"},symbol:{color:"hsl(5, 74%, 59%)"},deleted:{color:"hsl(5, 74%, 59%)"},important:{color:"hsl(5, 74%, 59%)"},selector:{color:"hsl(119, 34%, 47%)"},string:{color:"hsl(119, 34%, 47%)"},char:{color:"hsl(119, 34%, 47%)"},builtin:{color:"hsl(119, 34%, 47%)"},inserted:{color:"hsl(119, 34%, 47%)"},regex:{color:"hsl(119, 34%, 47%)"},"attr-value":{color:"hsl(119, 34%, 47%)"},"attr-value > .token.punctuation":{color:"hsl(119, 34%, 47%)"},variable:{color:"hsl(221, 87%, 60%)"},operator:{color:"hsl(221, 87%, 60%)"},function:{color:"hsl(221, 87%, 60%)"},url:{color:"hsl(198, 99%, 37%)"},"attr-value > .token.punctuation.attr-equals":{color:"hsl(230, 8%, 24%)"},"special-attr > .token.attr-value > .token.value.css":{color:"hsl(230, 8%, 24%)"},".language-css .token.selector":{color:"hsl(5, 74%, 59%)"},".language-css .token.property":{color:"hsl(230, 8%, 24%)"},".language-css .token.function":{color:"hsl(198, 99%, 37%)"},".language-css .token.url > .token.function":{color:"hsl(198, 99%, 37%)"},".language-css .token.url > .token.string.url":{color:"hsl(119, 34%, 47%)"},".language-css .token.important":{color:"hsl(301, 63%, 40%)"},".language-css .token.atrule .token.rule":{color:"hsl(301, 63%, 40%)"},".language-javascript .token.operator":{color:"hsl(301, 63%, 40%)"},".language-javascript .token.template-string > .token.interpolation > .token.interpolation-punctuation.punctuation":{color:"hsl(344, 84%, 43%)"},".language-json .token.operator":{color:"hsl(230, 8%, 24%)"},".language-json .token.null.keyword":{color:"hsl(35, 99%, 36%)"},".language-markdown .token.url":{color:"hsl(230, 8%, 24%)"},".language-markdown .token.url > .token.operator":{color:"hsl(230, 8%, 24%)"},".language-markdown .token.url-reference.url > .token.string":{color:"hsl(230, 8%, 24%)"},".language-markdown .token.url > .token.content":{color:"hsl(221, 87%, 60%)"},".language-markdown .token.url > .token.url":{color:"hsl(198, 99%, 37%)"},".language-markdown .token.url-reference.url":{color:"hsl(198, 99%, 37%)"},".language-markdown .token.blockquote.punctuation":{color:"hsl(230, 4%, 64%)",fontStyle:"italic"},".language-markdown .token.hr.punctuation":{color:"hsl(230, 4%, 64%)",fontStyle:"italic"},".language-markdown .token.code-snippet":{color:"hsl(119, 34%, 47%)"},".language-markdown .token.bold .token.content":{color:"hsl(35, 99%, 36%)"},".language-markdown .token.italic .token.content":{color:"hsl(301, 63%, 40%)"},".language-markdown .token.strike .token.content":{color:"hsl(5, 74%, 59%)"},".language-markdown .token.strike .token.punctuation":{color:"hsl(5, 74%, 59%)"},".language-markdown .token.list.punctuation":{color:"hsl(5, 74%, 59%)"},".language-markdown .token.title.important > .token.punctuation":{color:"hsl(5, 74%, 59%)"},bold:{fontWeight:"bold"},italic:{fontStyle:"italic"},namespace:{Opacity:"0.8"},"token.tab:not(:empty):before":{color:"hsla(230, 8%, 24%, 0.2)"},"token.cr:before":{color:"hsla(230, 8%, 24%, 0.2)"},"token.lf:before":{color:"hsla(230, 8%, 24%, 0.2)"},"token.space:before":{color:"hsla(230, 8%, 24%, 0.2)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item":{marginRight:"0.4em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button":{background:"hsl(230, 1%, 90%)",color:"hsl(230, 6%, 44%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a":{background:"hsl(230, 1%, 90%)",color:"hsl(230, 6%, 44%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span":{background:"hsl(230, 1%, 90%)",color:"hsl(230, 6%, 44%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:hover":{background:"hsl(230, 1%, 78%)",color:"hsl(230, 8%, 24%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:focus":{background:"hsl(230, 1%, 78%)",color:"hsl(230, 8%, 24%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:hover":{background:"hsl(230, 1%, 78%)",color:"hsl(230, 8%, 24%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:focus":{background:"hsl(230, 1%, 78%)",color:"hsl(230, 8%, 24%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:hover":{background:"hsl(230, 1%, 78%)",color:"hsl(230, 8%, 24%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:focus":{background:"hsl(230, 1%, 78%)",color:"hsl(230, 8%, 24%)"},".line-highlight.line-highlight":{background:"hsla(230, 8%, 24%, 0.05)"},".line-highlight.line-highlight:before":{background:"hsl(230, 1%, 90%)",color:"hsl(230, 8%, 24%)",padding:"0.1em 0.6em",borderRadius:"0.3em",boxShadow:"0 2px 0 0 rgba(0, 0, 0, 0.2)"},".line-highlight.line-highlight[data-end]:after":{background:"hsl(230, 1%, 90%)",color:"hsl(230, 8%, 24%)",padding:"0.1em 0.6em",borderRadius:"0.3em",boxShadow:"0 2px 0 0 rgba(0, 0, 0, 0.2)"},"pre[id].linkable-line-numbers.linkable-line-numbers span.line-numbers-rows > span:hover:before":{backgroundColor:"hsla(230, 8%, 24%, 0.05)"},".line-numbers.line-numbers .line-numbers-rows":{borderRightColor:"hsla(230, 8%, 24%, 0.2)"},".command-line .command-line-prompt":{borderRightColor:"hsla(230, 8%, 24%, 0.2)"},".line-numbers .line-numbers-rows > span:before":{color:"hsl(230, 1%, 62%)"},".command-line .command-line-prompt > span:before":{color:"hsl(230, 1%, 62%)"},".rainbow-braces .token.token.punctuation.brace-level-1":{color:"hsl(5, 74%, 59%)"},".rainbow-braces .token.token.punctuation.brace-level-5":{color:"hsl(5, 74%, 59%)"},".rainbow-braces .token.token.punctuation.brace-level-9":{color:"hsl(5, 74%, 59%)"},".rainbow-braces .token.token.punctuation.brace-level-2":{color:"hsl(119, 34%, 47%)"},".rainbow-braces .token.token.punctuation.brace-level-6":{color:"hsl(119, 34%, 47%)"},".rainbow-braces .token.token.punctuation.brace-level-10":{color:"hsl(119, 34%, 47%)"},".rainbow-braces .token.token.punctuation.brace-level-3":{color:"hsl(221, 87%, 60%)"},".rainbow-braces .token.token.punctuation.brace-level-7":{color:"hsl(221, 87%, 60%)"},".rainbow-braces .token.token.punctuation.brace-level-11":{color:"hsl(221, 87%, 60%)"},".rainbow-braces .token.token.punctuation.brace-level-4":{color:"hsl(301, 63%, 40%)"},".rainbow-braces .token.token.punctuation.brace-level-8":{color:"hsl(301, 63%, 40%)"},".rainbow-braces .token.token.punctuation.brace-level-12":{color:"hsl(301, 63%, 40%)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)":{backgroundColor:"hsla(353, 100%, 66%, 0.15)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)":{backgroundColor:"hsla(353, 100%, 66%, 0.15)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix) *::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix) *::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)":{backgroundColor:"hsla(137, 100%, 55%, 0.15)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)":{backgroundColor:"hsla(137, 100%, 55%, 0.15)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix) *::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix) *::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},".prism-previewer.prism-previewer:before":{borderColor:"hsl(0, 0, 95%)"},".prism-previewer-gradient.prism-previewer-gradient div":{borderColor:"hsl(0, 0, 95%)",borderRadius:"0.3em"},".prism-previewer-color.prism-previewer-color:before":{borderRadius:"0.3em"},".prism-previewer-easing.prism-previewer-easing:before":{borderRadius:"0.3em"},".prism-previewer.prism-previewer:after":{borderTopColor:"hsl(0, 0, 95%)"},".prism-previewer-flipped.prism-previewer-flipped.after":{borderBottomColor:"hsl(0, 0, 95%)"},".prism-previewer-angle.prism-previewer-angle:before":{background:"hsl(0, 0%, 100%)"},".prism-previewer-time.prism-previewer-time:before":{background:"hsl(0, 0%, 100%)"},".prism-previewer-easing.prism-previewer-easing":{background:"hsl(0, 0%, 100%)"},".prism-previewer-angle.prism-previewer-angle circle":{stroke:"hsl(230, 8%, 24%)",strokeOpacity:"1"},".prism-previewer-time.prism-previewer-time circle":{stroke:"hsl(230, 8%, 24%)",strokeOpacity:"1"},".prism-previewer-easing.prism-previewer-easing circle":{stroke:"hsl(230, 8%, 24%)",fill:"transparent"},".prism-previewer-easing.prism-previewer-easing path":{stroke:"hsl(230, 8%, 24%)"},".prism-previewer-easing.prism-previewer-easing line":{stroke:"hsl(230, 8%, 24%)"}};e.s(["default",0,({code:e,language:n})=>{let[o,c]=(0,l.useState)(!1);return(0,t.jsxs)("div",{className:"relative rounded-lg border border-gray-200 overflow-hidden",children:[(0,t.jsx)("button",{onClick:()=>{navigator.clipboard.writeText(e),c(!0),setTimeout(()=>c(!1),2e3)},className:"absolute top-3 right-3 p-2 rounded-md bg-gray-100 hover:bg-gray-200 text-gray-600 z-10","aria-label":"Copy code",children:o?(0,t.jsx)(a.CheckIcon,{size:16}):(0,t.jsx)(s,{size:16})}),(0,t.jsx)(r.Prism,{language:n,style:i,customStyle:{margin:0,padding:"1.5rem",borderRadius:"0.5rem",fontSize:"0.9rem",backgroundColor:"#fafafa"},showLineNumbers:!0,children:e})]})}],673709)},794357,778917,e=>{"use strict";var t=e.i(843476),l=e.i(599724),a=e.i(197647),s=e.i(653824),r=e.i(881073),i=e.i(404206),n=e.i(723731),o=e.i(350967),c=e.i(673709),d=e.i(546467);e.s(["ExternalLink",()=>d.default],778917);var d=d;let u=({href:e,className:l})=>(0,t.jsxs)("a",{href:e,target:"_blank",rel:"noopener noreferrer",title:"Open documentation in a new tab",className:function(...e){return e.filter(Boolean).join(" ")}("inline-flex items-center gap-2 rounded-xl border border-zinc-200 bg-white/80 px-3.5 py-2 text-sm font-medium text-zinc-700 shadow-sm","hover:bg-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 active:translate-y-[0.5px]",l),children:[(0,t.jsx)("span",{children:"API Reference Docs"}),(0,t.jsx)(d.default,{"aria-hidden":!0,className:"h-4 w-4 opacity-80"}),(0,t.jsx)("span",{className:"sr-only",children:"(opens in a new tab)"})]});e.s(["default",0,({proxySettings:e})=>{let d="",m=e?.LITELLM_UI_API_DOC_BASE_URL;return m&&m.trim()?d=m:e?.PROXY_BASE_URL&&(d=e.PROXY_BASE_URL),(0,t.jsx)(t.Fragment,{children:(0,t.jsx)(o.Grid,{className:"gap-2 p-8 h-[80vh] w-full mt-2",children:(0,t.jsxs)("div",{className:"mb-5",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)("p",{className:"text-2xl text-tremor-content-strong dark:text-dark-tremor-content-strong font-semibold",children:"OpenAI Compatible Proxy: API Reference"}),(0,t.jsx)(u,{className:"ml-3 shrink-0",href:"https://docs.litellm.ai/docs/proxy/user_keys"})]}),(0,t.jsxs)(l.Text,{className:"mt-2 mb-2",children:["LiteLLM is OpenAI Compatible. This means your API Key works with the OpenAI SDK. Just replace the base_url to point to your litellm proxy. Example Below"," "]}),(0,t.jsxs)(s.TabGroup,{children:[(0,t.jsxs)(r.TabList,{children:[(0,t.jsx)(a.Tab,{children:"OpenAI Python SDK"}),(0,t.jsx)(a.Tab,{children:"LlamaIndex"}),(0,t.jsx)(a.Tab,{children:"Langchain Py"})]}),(0,t.jsxs)(n.TabPanels,{children:[(0,t.jsx)(i.TabPanel,{children:(0,t.jsx)(c.default,{language:"python",code:`import openai +client = openai.OpenAI( + api_key="your_api_key", + base_url="${d}" # LiteLLM Proxy is OpenAI compatible, Read More: https://docs.litellm.ai/docs/proxy/user_keys +) + +response = client.chat.completions.create( + model="gpt-3.5-turbo", # model to send to the proxy + messages = [ + { + "role": "user", + "content": "this is a test request, write a short poem" + } + ] +) + +print(response)`})}),(0,t.jsx)(i.TabPanel,{children:(0,t.jsx)(c.default,{language:"python",code:`import os, dotenv + +from llama_index.llms import AzureOpenAI +from llama_index.embeddings import AzureOpenAIEmbedding +from llama_index import VectorStoreIndex, SimpleDirectoryReader, ServiceContext + +llm = AzureOpenAI( + engine="azure-gpt-3.5", # model_name on litellm proxy + temperature=0.0, + azure_endpoint="${d}", # litellm proxy endpoint + api_key="sk-1234", # litellm proxy API Key + api_version="2023-07-01-preview", +) + +embed_model = AzureOpenAIEmbedding( + deployment_name="azure-embedding-model", + azure_endpoint="${d}", + api_key="sk-1234", + api_version="2023-07-01-preview", +) + +documents = SimpleDirectoryReader("llama_index_data").load_data() +service_context = ServiceContext.from_defaults(llm=llm, embed_model=embed_model) +index = VectorStoreIndex.from_documents(documents, service_context=service_context) + +query_engine = index.as_query_engine() +response = query_engine.query("What did the author do growing up?") +print(response)`})}),(0,t.jsx)(i.TabPanel,{children:(0,t.jsx)(c.default,{language:"python",code:`from langchain.chat_models import ChatOpenAI +from langchain.prompts.chat import ( + ChatPromptTemplate, + HumanMessagePromptTemplate, + SystemMessagePromptTemplate, +) +from langchain.schema import HumanMessage, SystemMessage + +chat = ChatOpenAI( + openai_api_base="${d}", + model = "gpt-3.5-turbo", + temperature=0.1 +) + +messages = [ + SystemMessage( + content="You are a helpful assistant that im using to make a test request to." + ), + HumanMessage( + content="test from litellm. tell me why it's amazing in 1 sentence" + ), +] +response = chat(messages) + +print(response)`})})]})]})]})})})}],794357)},584578,e=>{"use strict";var t=e.i(764205);let l=async(e,l,a,s,r)=>{let i;i="Admin"!=a&&"Admin Viewer"!=a?await (0,t.teamListCall)(e,s?.organization_id||null,l):await (0,t.teamListCall)(e,s?.organization_id||null),console.log(`givenTeams: ${i}`),r(i)};e.s(["fetchTeams",0,l])},747871,e=>{"use strict";var t=e.i(843476),l=e.i(271645),a=e.i(269200),s=e.i(942232),r=e.i(977572),i=e.i(427612),n=e.i(64848),o=e.i(496020),c=e.i(304967),d=e.i(994388),u=e.i(599724),m=e.i(389083),h=e.i(764205),g=e.i(727749);e.s(["default",0,({accessToken:e,userID:x})=>{let[p,f]=(0,l.useState)([]);(0,l.useEffect)(()=>{(async()=>{if(e&&x)try{let t=await (0,h.availableTeamListCall)(e);f(t)}catch(e){console.error("Error fetching available teams:",e)}})()},[e,x]);let b=async t=>{if(e&&x)try{await (0,h.teamMemberAddCall)(e,t,{user_id:x,role:"user"}),g.default.success("Successfully joined team"),f(e=>e.filter(e=>e.team_id!==t))}catch(e){console.error("Error joining team:",e),g.default.fromBackend("Failed to join team")}};return(0,t.jsx)(c.Card,{className:"w-full mx-auto flex-auto overflow-y-auto max-h-[50vh]",children:(0,t.jsxs)(a.Table,{children:[(0,t.jsx)(i.TableHead,{children:(0,t.jsxs)(o.TableRow,{children:[(0,t.jsx)(n.TableHeaderCell,{children:"Team Name"}),(0,t.jsx)(n.TableHeaderCell,{children:"Description"}),(0,t.jsx)(n.TableHeaderCell,{children:"Members"}),(0,t.jsx)(n.TableHeaderCell,{children:"Models"}),(0,t.jsx)(n.TableHeaderCell,{children:"Actions"})]})}),(0,t.jsxs)(s.TableBody,{children:[p.map(e=>(0,t.jsxs)(o.TableRow,{children:[(0,t.jsx)(r.TableCell,{children:(0,t.jsx)(u.Text,{children:e.team_alias})}),(0,t.jsx)(r.TableCell,{children:(0,t.jsx)(u.Text,{children:e.description||"No description available"})}),(0,t.jsx)(r.TableCell,{children:(0,t.jsxs)(u.Text,{children:[e.members_with_roles.length," members"]})}),(0,t.jsx)(r.TableCell,{children:(0,t.jsx)("div",{className:"flex flex-col",children:e.models&&0!==e.models.length?e.models.map((e,l)=>(0,t.jsx)(m.Badge,{size:"xs",className:"mb-1",color:"blue",children:(0,t.jsx)(u.Text,{children:e.length>30?`${e.slice(0,30)}...`:e})},l)):(0,t.jsx)(m.Badge,{size:"xs",color:"red",children:(0,t.jsx)(u.Text,{children:"All Proxy Models"})})})}),(0,t.jsx)(r.TableCell,{children:(0,t.jsx)(d.Button,{size:"xs",variant:"secondary",onClick:()=>b(e.team_id),children:"Join Team"})})]},e.team_id)),0===p.length&&(0,t.jsx)(o.TableRow,{children:(0,t.jsx)(r.TableCell,{colSpan:5,className:"text-center",children:(0,t.jsxs)(u.Text,{children:["No available teams to join. See how to set available teams"," ",(0,t.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/self_serve#all-settings-for-self-serve--sso-flow",target:"_blank",rel:"noopener noreferrer",className:"text-blue-500 hover:text-blue-700 underline",children:"here"}),"."]})})})]})]})})}])},468133,e=>{"use strict";var t=e.i(843476),l=e.i(271645),a=e.i(304967),s=e.i(629569),r=e.i(599724),i=e.i(114600),n=e.i(994388),o=e.i(779241),c=e.i(898586),d=e.i(482725),u=e.i(790848),m=e.i(199133),h=e.i(764205),g=e.i(860585),x=e.i(355619),p=e.i(727749),f=e.i(162386);e.s(["default",0,({accessToken:e,userID:b,userRole:y})=>{let[j,v]=(0,l.useState)(!0),[w,_]=(0,l.useState)(null),[N,k]=(0,l.useState)(!1),[C,S]=(0,l.useState)({}),[T,I]=(0,l.useState)(!1),[E,A]=(0,l.useState)([]),{Paragraph:D}=c.Typography,{Option:M}=m.Select;(0,l.useEffect)(()=>{(async()=>{if(!e)return v(!1);try{let t=await (0,h.getDefaultTeamSettings)(e);if(_(t),S(t.values||{}),e)try{let t=await (0,h.modelAvailableCall)(e,b,y);if(t&&t.data){let e=t.data.map(e=>e.id);A(e)}}catch(e){console.error("Error fetching available models:",e)}}catch(e){console.error("Error fetching team SSO settings:",e),p.default.fromBackend("Failed to fetch team settings")}finally{v(!1)}})()},[e]);let P=async()=>{if(e){I(!0);try{let t=await (0,h.updateDefaultTeamSettings)(e,C);_({...w,values:t.settings}),k(!1),p.default.success("Default team settings updated successfully")}catch(e){console.error("Error updating team settings:",e),p.default.fromBackend("Failed to update team settings")}finally{I(!1)}}},B=(e,t)=>{S(l=>({...l,[e]:t}))};return j?(0,t.jsx)("div",{className:"flex justify-center items-center h-64",children:(0,t.jsx)(d.Spin,{size:"large"})}):w?(0,t.jsxs)(a.Card,{children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,t.jsx)(s.Title,{className:"text-xl",children:"Default Team Settings"}),!j&&w&&(N?(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(n.Button,{variant:"secondary",onClick:()=>{k(!1),S(w.values||{})},disabled:T,children:"Cancel"}),(0,t.jsx)(n.Button,{onClick:P,loading:T,children:"Save Changes"})]}):(0,t.jsx)(n.Button,{onClick:()=>k(!0),children:"Edit Settings"}))]}),(0,t.jsx)(r.Text,{children:"These settings will be applied by default when creating new teams."}),w?.field_schema?.description&&(0,t.jsx)(D,{className:"mb-4 mt-2",children:w.field_schema.description}),(0,t.jsx)(i.Divider,{}),(0,t.jsx)("div",{className:"mt-4 space-y-4",children:(()=>{let{values:e,field_schema:l}=w;return l&&l.properties?Object.entries(l.properties).map(([l,a])=>{let s=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)(r.Text,{className:"font-medium text-lg",children:i}),(0,t.jsx)(D,{className:"text-sm text-gray-500 mt-1",children:a.description||"No description available"}),N?(0,t.jsx)("div",{className:"mt-2",children:((e,l,a)=>{let s=l.type;if("budget_duration"===e)return(0,t.jsx)(g.default,{value:C[e]||null,onChange:t=>B(e,t),className:"mt-2"});if("boolean"===s)return(0,t.jsx)("div",{className:"mt-2",children:(0,t.jsx)(u.Switch,{checked:!!C[e],onChange:t=>B(e,t)})});if("array"===s&&l.items?.enum)return(0,t.jsx)(m.Select,{mode:"multiple",style:{width:"100%"},value:C[e]||[],onChange:t=>B(e,t),className:"mt-2",children:l.items.enum.map(e=>(0,t.jsx)(M,{value:e,children:e},e))});if("models"===e)return(0,t.jsx)(f.ModelSelect,{value:C[e]||[],onChange:t=>B(e,t),context:"global",style:{width:"100%"},options:{includeSpecialOptions:!0}});if("string"===s&&l.enum)return(0,t.jsx)(m.Select,{style:{width:"100%"},value:C[e]||"",onChange:t=>B(e,t),className:"mt-2",children:l.enum.map(e=>(0,t.jsx)(M,{value:e,children:e},e))});else return(0,t.jsx)(o.TextInput,{value:void 0!==C[e]?String(C[e]):"",onChange:t=>B(e,t.target.value),placeholder:l.description||"",className:"mt-2"})})(l,a,0)}):(0,t.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:((e,l)=>{if(null==l)return(0,t.jsx)("span",{className:"text-gray-400",children:"Not set"});if("budget_duration"===e)return(0,t.jsx)("span",{children:(0,g.getBudgetDurationLabel)(l)});if("boolean"==typeof l)return(0,t.jsx)("span",{children:l?"Enabled":"Disabled"});if("models"===e&&Array.isArray(l))return 0===l.length?(0,t.jsx)("span",{className:"text-gray-400",children:"None"}):(0,t.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:l.map((e,l)=>(0,t.jsx)("span",{className:"px-2 py-1 bg-blue-100 rounded text-xs",children:(0,x.getModelDisplayName)(e)},l))});if("object"==typeof l)return Array.isArray(l)?0===l.length?(0,t.jsx)("span",{className:"text-gray-400",children:"None"}):(0,t.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:l.map((e,l)=>(0,t.jsx)("span",{className:"px-2 py-1 bg-blue-100 rounded text-xs",children:"object"==typeof e?JSON.stringify(e):String(e)},l))}):(0,t.jsx)("pre",{className:"bg-gray-100 p-2 rounded text-xs overflow-auto mt-1",children:JSON.stringify(l,null,2)});return(0,t.jsx)("span",{children:String(l)})})(l,s)})]},l)}):(0,t.jsx)(r.Text,{children:"No schema information available"})})()})]}):(0,t.jsx)(a.Card,{children:(0,t.jsx)(r.Text,{children:"No team settings available or you do not have permission to view them."})})}])},646050,e=>{"use strict";var t=e.i(843476),l=e.i(994388),a=e.i(304967),s=e.i(197647),r=e.i(653824),i=e.i(269200),n=e.i(942232),o=e.i(977572),c=e.i(427612),d=e.i(64848),u=e.i(496020),m=e.i(881073),h=e.i(404206),g=e.i(723731),x=e.i(599724),p=e.i(271645),f=e.i(650056),b=e.i(127952),y=e.i(902555),j=e.i(727749),v=e.i(764205),w=e.i(779241),_=e.i(677667),N=e.i(898667),k=e.i(130643),C=e.i(464571),S=e.i(212931),T=e.i(808613),I=e.i(28651),E=e.i(199133);let A=({isModalVisible:e,accessToken:l,setIsModalVisible:a,setBudgetList:s})=>{let[r]=T.Form.useForm(),i=async e=>{if(null!=l&&void 0!=l)try{j.default.info("Making API Call");let t=await (0,v.budgetCreateCall)(l,e);console.log("key create Response:",t),s(e=>e?[...e,t]:[t]),j.default.success("Budget Created"),r.resetFields()}catch(e){console.error("Error creating the key:",e),j.default.fromBackend(`Error creating the key: ${e}`)}};return(0,t.jsx)(S.Modal,{title:"Create Budget",open:e,width:800,footer:null,onOk:()=>{a(!1),r.resetFields()},onCancel:()=>{a(!1),r.resetFields()},children:(0,t.jsxs)(T.Form,{form:r,onFinish:i,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(T.Form.Item,{label:"Budget ID",name:"budget_id",rules:[{required:!0,message:"Please input a human-friendly name for the budget"}],help:"A human-friendly name for the budget",children:(0,t.jsx)(w.TextInput,{placeholder:""})}),(0,t.jsx)(T.Form.Item,{label:"Max Tokens per minute",name:"tpm_limit",help:"Default is model limit.",children:(0,t.jsx)(I.InputNumber,{step:1,precision:2,width:200})}),(0,t.jsx)(T.Form.Item,{label:"Max Requests per minute",name:"rpm_limit",help:"Default is model limit.",children:(0,t.jsx)(I.InputNumber,{step:1,precision:2,width:200})}),(0,t.jsxs)(_.Accordion,{className:"mt-20 mb-8",children:[(0,t.jsx)(N.AccordionHeader,{children:(0,t.jsx)("b",{children:"Optional Settings"})}),(0,t.jsxs)(k.AccordionBody,{children:[(0,t.jsx)(T.Form.Item,{label:"Max Budget (USD)",name:"max_budget",children:(0,t.jsx)(I.InputNumber,{step:.01,precision:2,width:200})}),(0,t.jsx)(T.Form.Item,{className:"mt-8",label:"Reset Budget",name:"budget_duration",children:(0,t.jsxs)(E.Select,{defaultValue:null,placeholder:"n/a",children:[(0,t.jsx)(E.Select.Option,{value:"24h",children:"daily"}),(0,t.jsx)(E.Select.Option,{value:"7d",children:"weekly"}),(0,t.jsx)(E.Select.Option,{value:"30d",children:"monthly"})]})})]})]})]}),(0,t.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,t.jsx)(C.Button,{htmlType:"submit",children:"Create Budget"})})]})})},D=({isModalVisible:e,accessToken:l,setIsModalVisible:a,setBudgetList:s,existingBudget:r,handleUpdateCall:i})=>{console.log("existingBudget",r);let[n]=T.Form.useForm();(0,p.useEffect)(()=>{n.setFieldsValue(r)},[r,n]);let o=async e=>{if(null!=l&&void 0!=l)try{j.default.info("Making API Call"),a(!0);let t=await (0,v.budgetUpdateCall)(l,e);s(e=>e?[...e,t]:[t]),j.default.success("Budget Updated"),n.resetFields(),i()}catch(e){console.error("Error creating the key:",e),j.default.fromBackend(`Error creating the key: ${e}`)}};return(0,t.jsx)(S.Modal,{title:"Edit Budget",open:e,width:800,footer:null,onOk:()=>{a(!1),n.resetFields()},onCancel:()=>{a(!1),n.resetFields()},children:(0,t.jsxs)(T.Form,{form:n,onFinish:o,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",initialValues:r,children:[(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(T.Form.Item,{label:"Budget ID",name:"budget_id",rules:[{required:!0,message:"Please input a human-friendly name for the budget"}],help:"A human-friendly name for the budget",children:(0,t.jsx)(w.TextInput,{placeholder:""})}),(0,t.jsx)(T.Form.Item,{label:"Max Tokens per minute",name:"tpm_limit",help:"Default is model limit.",children:(0,t.jsx)(I.InputNumber,{step:1,precision:2,width:200})}),(0,t.jsx)(T.Form.Item,{label:"Max Requests per minute",name:"rpm_limit",help:"Default is model limit.",children:(0,t.jsx)(I.InputNumber,{step:1,precision:2,width:200})}),(0,t.jsxs)(_.Accordion,{className:"mt-20 mb-8",children:[(0,t.jsx)(N.AccordionHeader,{children:(0,t.jsx)("b",{children:"Optional Settings"})}),(0,t.jsxs)(k.AccordionBody,{children:[(0,t.jsx)(T.Form.Item,{label:"Max Budget (USD)",name:"max_budget",children:(0,t.jsx)(I.InputNumber,{step:.01,precision:2,width:200})}),(0,t.jsx)(T.Form.Item,{className:"mt-8",label:"Reset Budget",name:"budget_duration",children:(0,t.jsxs)(E.Select,{defaultValue:null,placeholder:"n/a",children:[(0,t.jsx)(E.Select.Option,{value:"24h",children:"daily"}),(0,t.jsx)(E.Select.Option,{value:"7d",children:"weekly"}),(0,t.jsx)(E.Select.Option,{value:"30d",children:"monthly"})]})})]})]})]}),(0,t.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,t.jsx)(C.Button,{htmlType:"submit",children:"Save"})})]})})},M=` +curl -X POST --location '/end_user/new' \\ + +-H 'Authorization: Bearer ' \\ + +-H 'Content-Type: application/json' \\ + +-d '{"user_id": "my-customer-id', "budget_id": ""}' # 👈 KEY CHANGE + +`,P=` +curl -X POST --location '/chat/completions' \\ + +-H 'Authorization: Bearer ' \\ + +-H 'Content-Type: application/json' \\ + +-d '{ + "model": "gpt-3.5-turbo', + "messages":[{"role": "user", "content": "Hey, how's it going?"}], + "user": "my-customer-id" +}' # 👈 KEY CHANGE + +`,B=`from openai import OpenAI +client = OpenAI( + base_url="", + api_key="" +) + +completion = client.chat.completions.create( + model="gpt-3.5-turbo", + messages=[ + {"role": "system", "content": "You are a helpful assistant."}, + {"role": "user", "content": "Hello!"} + ], + user="my-customer-id" +) + +print(completion.choices[0].message)`;e.s(["default",0,({accessToken:e})=>{let[w,_]=(0,p.useState)(!1),[N,k]=(0,p.useState)(!1),[C,S]=(0,p.useState)(null),[T,I]=(0,p.useState)([]),[E,O]=(0,p.useState)(!1),[R,L]=(0,p.useState)(!1);(0,p.useEffect)(()=>{e&&(0,v.getBudgetList)(e).then(e=>{I(e)})},[e]);let F=async t=>{null!=e&&(S(t),k(!0))},z=async()=>{if(C&&null!=e){O(!0);try{await (0,v.budgetDeleteCall)(e,C.budget_id),j.default.success("Budget deleted."),await H()}catch(e){console.error("Error deleting budget:",e),"function"==typeof j.default.fromBackend?j.default.fromBackend("Failed to delete budget"):j.default.info("Failed to delete budget")}finally{O(!1),L(!1),S(null)}}},H=async()=>{null!=e&&(0,v.getBudgetList)(e).then(e=>{I(e)})};return(0,t.jsxs)("div",{className:"w-full mx-auto flex-auto overflow-y-auto m-8 p-2",children:[(0,t.jsx)(l.Button,{size:"sm",variant:"primary",className:"mb-2",onClick:()=>_(!0),children:"+ Create Budget"}),(0,t.jsxs)(r.TabGroup,{children:[(0,t.jsxs)(m.TabList,{children:[(0,t.jsx)(s.Tab,{children:"Budgets"}),(0,t.jsx)(s.Tab,{children:"Examples"})]}),(0,t.jsxs)(g.TabPanels,{children:[(0,t.jsx)(h.TabPanel,{children:(0,t.jsxs)("div",{className:"mt-6",children:[(0,t.jsx)(A,{accessToken:e,isModalVisible:w,setIsModalVisible:_,setBudgetList:I}),C&&(0,t.jsx)(D,{accessToken:e,isModalVisible:N,setIsModalVisible:k,setBudgetList:I,existingBudget:C,handleUpdateCall:H}),(0,t.jsxs)(a.Card,{children:[(0,t.jsx)(x.Text,{children:"Create a budget to assign to customers."}),(0,t.jsxs)(i.Table,{children:[(0,t.jsx)(c.TableHead,{children:(0,t.jsxs)(u.TableRow,{children:[(0,t.jsx)(d.TableHeaderCell,{children:"Budget ID"}),(0,t.jsx)(d.TableHeaderCell,{children:"Max Budget"}),(0,t.jsx)(d.TableHeaderCell,{children:"TPM"}),(0,t.jsx)(d.TableHeaderCell,{children:"RPM"})]})}),(0,t.jsx)(n.TableBody,{children:T.slice().sort((e,t)=>new Date(t.updated_at).getTime()-new Date(e.updated_at).getTime()).map((e,l)=>(0,t.jsxs)(u.TableRow,{children:[(0,t.jsx)(o.TableCell,{children:e.budget_id}),(0,t.jsx)(o.TableCell,{children:e.max_budget?e.max_budget:"n/a"}),(0,t.jsx)(o.TableCell,{children:e.tpm_limit?e.tpm_limit:"n/a"}),(0,t.jsx)(o.TableCell,{children:e.rpm_limit?e.rpm_limit:"n/a"}),(0,t.jsx)(y.default,{variant:"Edit",tooltipText:"Edit budget",onClick:()=>F(e),dataTestId:"edit-budget-button"}),(0,t.jsx)(y.default,{variant:"Delete",tooltipText:"Delete budget",onClick:()=>{S(e),L(!0)},dataTestId:"delete-budget-button"})]},l))})]})]}),(0,t.jsx)(b.default,{isOpen:R,title:"Delete Budget?",message:"Are you sure you want to delete this budget? This action cannot be undone.",resourceInformationTitle:"Budget Information",resourceInformation:[{label:"Budget ID",value:C?.budget_id,code:!0},{label:"Max Budget",value:C?.max_budget},{label:"TPM",value:C?.tpm_limit},{label:"RPM",value:C?.rpm_limit}],onCancel:()=>{L(!1)},onOk:z,confirmLoading:E})]})}),(0,t.jsx)(h.TabPanel,{children:(0,t.jsxs)("div",{className:"mt-6",children:[(0,t.jsx)(x.Text,{className:"text-base",children:"How to use budget id"}),(0,t.jsxs)(r.TabGroup,{children:[(0,t.jsxs)(m.TabList,{children:[(0,t.jsx)(s.Tab,{children:"Assign Budget to Customer"}),(0,t.jsx)(s.Tab,{children:"Test it (Curl)"}),(0,t.jsx)(s.Tab,{children:"Test it (OpenAI SDK)"})]}),(0,t.jsxs)(g.TabPanels,{children:[(0,t.jsx)(h.TabPanel,{children:(0,t.jsx)(f.Prism,{language:"bash",children:M})}),(0,t.jsx)(h.TabPanel,{children:(0,t.jsx)(f.Prism,{language:"bash",children:P})}),(0,t.jsx)(h.TabPanel,{children:(0,t.jsx)(f.Prism,{language:"python",children:B})})]})]})]})})]})]})]})}],646050)},704308,e=>{"use strict";var t=e.i(843476),l=e.i(271645),a=e.i(994388),s=e.i(212931),r=e.i(764205),i=e.i(808613),n=e.i(311451),o=e.i(199133),c=e.i(998573),d=e.i(209261);let{TextArea:u}=n.Input,{Option:m}=o.Select,h=["Development","Productivity","Learning","Security","Data & Analytics","Integration","Testing","Documentation"],g=({visible:e,onClose:g,accessToken:x,onSuccess:p})=>{let[f]=i.Form.useForm(),[b,y]=(0,l.useState)(!1),[j,v]=(0,l.useState)("github"),w=async e=>{if(!x)return void c.message.error("No access token available");if(!(0,d.validatePluginName)(e.name))return void c.message.error("Plugin name must be kebab-case (lowercase letters, numbers, and hyphens only)");if(e.version&&!(0,d.isValidSemanticVersion)(e.version))return void c.message.error("Version must be in semantic versioning format (e.g., 1.0.0)");if(e.authorEmail&&!(0,d.isValidEmail)(e.authorEmail))return void c.message.error("Invalid email format");if(e.homepage&&!(0,d.isValidUrl)(e.homepage))return void c.message.error("Invalid homepage URL format");y(!0);try{let t={name:e.name.trim(),source:"github"===j?{source:"github",repo:e.repo.trim()}:{source:"url",url:e.url.trim()}};e.version&&(t.version=e.version.trim()),e.description&&(t.description=e.description.trim()),(e.authorName||e.authorEmail)&&(t.author={},e.authorName&&(t.author.name=e.authorName.trim()),e.authorEmail&&(t.author.email=e.authorEmail.trim())),e.homepage&&(t.homepage=e.homepage.trim()),e.category&&(t.category=e.category),e.keywords&&(t.keywords=(0,d.parseKeywords)(e.keywords)),await (0,r.registerClaudeCodePlugin)(x,t),c.message.success("Plugin registered successfully"),f.resetFields(),v("github"),p(),g()}catch(e){console.error("Error registering plugin:",e),c.message.error("Failed to register plugin")}finally{y(!1)}},_=()=>{f.resetFields(),v("github"),g()};return(0,t.jsx)(s.Modal,{title:"Add New Claude Code Plugin",open:e,onCancel:_,footer:null,width:700,className:"top-8",children:(0,t.jsxs)(i.Form,{form:f,layout:"vertical",onFinish:w,className:"mt-4",children:[(0,t.jsx)(i.Form.Item,{label:"Plugin Name",name:"name",rules:[{required:!0,message:"Please enter plugin name"},{pattern:/^[a-z0-9-]+$/,message:"Name must be kebab-case (lowercase, numbers, hyphens only)"}],tooltip:"Unique identifier in kebab-case format (e.g., my-awesome-plugin)",children:(0,t.jsx)(n.Input,{placeholder:"my-awesome-plugin",className:"rounded-lg"})}),(0,t.jsx)(i.Form.Item,{label:"Source Type",name:"sourceType",initialValue:"github",rules:[{required:!0,message:"Please select source type"}],children:(0,t.jsxs)(o.Select,{onChange:e=>{v(e),f.setFieldsValue({repo:void 0,url:void 0})},className:"rounded-lg",children:[(0,t.jsx)(m,{value:"github",children:"GitHub"}),(0,t.jsx)(m,{value:"url",children:"URL"})]})}),"github"===j&&(0,t.jsx)(i.Form.Item,{label:"GitHub Repository",name:"repo",rules:[{required:!0,message:"Please enter repository"},{pattern:/^[a-zA-Z0-9_-]+\/[a-zA-Z0-9_-]+$/,message:"Repository must be in format: org/repo"}],tooltip:"Format: organization/repository (e.g., anthropics/claude-code)",children:(0,t.jsx)(n.Input,{placeholder:"anthropics/claude-code",className:"rounded-lg"})}),"url"===j&&(0,t.jsx)(i.Form.Item,{label:"Git URL",name:"url",rules:[{required:!0,message:"Please enter git URL"}],tooltip:"Full git URL to the repository",children:(0,t.jsx)(n.Input,{type:"url",placeholder:"https://github.com/org/repo.git",className:"rounded-lg"})}),(0,t.jsx)(i.Form.Item,{label:"Version (Optional)",name:"version",tooltip:"Semantic version (e.g., 1.0.0)",children:(0,t.jsx)(n.Input,{placeholder:"1.0.0",className:"rounded-lg"})}),(0,t.jsx)(i.Form.Item,{label:"Description (Optional)",name:"description",tooltip:"Brief description of what the plugin does",children:(0,t.jsx)(u,{rows:3,placeholder:"A plugin that helps with...",maxLength:500,className:"rounded-lg"})}),(0,t.jsx)(i.Form.Item,{label:"Category (Optional)",name:"category",tooltip:"Select a category or enter a custom one",children:(0,t.jsx)(o.Select,{placeholder:"Select or type a category",allowClear:!0,showSearch:!0,optionFilterProp:"children",className:"rounded-lg",children:h.map(e=>(0,t.jsx)(m,{value:e,children:e},e))})}),(0,t.jsx)(i.Form.Item,{label:"Keywords (Optional)",name:"keywords",tooltip:"Comma-separated list of keywords for search",children:(0,t.jsx)(n.Input,{placeholder:"search, web, api",className:"rounded-lg"})}),(0,t.jsx)(i.Form.Item,{label:"Author Name (Optional)",name:"authorName",tooltip:"Name of the plugin author or organization",children:(0,t.jsx)(n.Input,{placeholder:"Your Name or Organization",className:"rounded-lg"})}),(0,t.jsx)(i.Form.Item,{label:"Author Email (Optional)",name:"authorEmail",rules:[{type:"email",message:"Please enter a valid email"}],tooltip:"Contact email for the plugin author",children:(0,t.jsx)(n.Input,{type:"email",placeholder:"author@example.com",className:"rounded-lg"})}),(0,t.jsx)(i.Form.Item,{label:"Homepage (Optional)",name:"homepage",rules:[{type:"url",message:"Please enter a valid URL"}],tooltip:"URL to the plugin's homepage or documentation",children:(0,t.jsx)(n.Input,{type:"url",placeholder:"https://example.com",className:"rounded-lg"})}),(0,t.jsx)(i.Form.Item,{className:"mb-0 mt-6",children:(0,t.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,t.jsx)(a.Button,{variant:"secondary",onClick:_,disabled:b,children:"Cancel"}),(0,t.jsx)(a.Button,{type:"submit",loading:b,children:b?"Registering...":"Register Plugin"})]})})]})})};var x=e.i(166406),p=e.i(871943),f=e.i(360820),b=e.i(94629),y=e.i(68155),j=e.i(152990),v=e.i(682830),w=e.i(389083),_=e.i(269200),N=e.i(942232),k=e.i(977572),C=e.i(427612),S=e.i(64848),T=e.i(496020),I=e.i(790848),E=e.i(592968),A=e.i(727749);let D=({pluginsList:e,isLoading:s,onDeleteClick:i,accessToken:n,onPluginUpdated:o,isAdmin:c,onPluginClick:u})=>{let[m,h]=(0,l.useState)([{id:"created_at",desc:!0}]),[g,D]=(0,l.useState)(null),M=async e=>{if(n){D(e.id);try{e.enabled?(await (0,r.disableClaudeCodePlugin)(n,e.name),A.default.success(`Plugin "${e.name}" disabled`)):(await (0,r.enableClaudeCodePlugin)(n,e.name),A.default.success(`Plugin "${e.name}" enabled`)),o()}catch(e){A.default.error("Failed to toggle plugin status")}finally{D(null)}}},P=[{header:"Plugin Name",accessorKey:"name",cell:({row:e})=>{let l=e.original,s=l.name||"";return(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(E.Tooltip,{title:s,children:(0,t.jsx)(a.Button,{size:"xs",variant:"light",className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left overflow-hidden truncate min-w-[150px] justify-start",onClick:()=>u(l.id),children:s})}),(0,t.jsx)(E.Tooltip,{title:"Copy Plugin ID",children:(0,t.jsx)(x.CopyOutlined,{onClick:e=>{var t;e.stopPropagation(),t=l.id,navigator.clipboard.writeText(t),A.default.success("Copied to clipboard!")},className:"cursor-pointer text-gray-500 hover:text-blue-500 text-xs"})})]})}},{header:"Version",accessorKey:"version",cell:({row:e})=>{let l=e.original.version||"N/A";return(0,t.jsx)("span",{className:"text-xs text-gray-600",children:l})}},{header:"Description",accessorKey:"description",cell:({row:e})=>{let l=e.original.description||"No description";return(0,t.jsx)(E.Tooltip,{title:l,children:(0,t.jsx)("span",{className:"text-xs text-gray-600 block max-w-[300px] truncate",children:l})})}},{header:"Category",accessorKey:"category",cell:({row:e})=>{let l=e.original.category;if(!l)return(0,t.jsx)(w.Badge,{color:"gray",className:"text-xs font-normal",size:"xs",children:"Uncategorized"});let a=(0,d.getCategoryBadgeColor)(l);return(0,t.jsx)(w.Badge,{color:a,className:"text-xs font-normal",size:"xs",children:l})}},{header:"Enabled",accessorKey:"enabled",cell:({row:e})=>{let l=e.original;return(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(w.Badge,{color:l.enabled?"green":"gray",className:"text-xs font-normal",size:"xs",children:l.enabled?"Yes":"No"}),c&&(0,t.jsx)(E.Tooltip,{title:l.enabled?"Disable plugin":"Enable plugin",children:(0,t.jsx)(I.Switch,{size:"small",checked:l.enabled,loading:g===l.id,onChange:()=>M(l)})})]})}},{header:"Created At",accessorKey:"created_at",cell:({row:e})=>{var l;let a=e.original;return(0,t.jsx)(E.Tooltip,{title:a.created_at,children:(0,t.jsx)("span",{className:"text-xs",children:(l=a.created_at)?new Date(l).toLocaleString():"-"})})}},...c?[{header:"Actions",id:"actions",enableSorting:!1,cell:({row:e})=>{let l=e.original;return(0,t.jsx)("div",{className:"flex items-center gap-1",children:(0,t.jsx)(E.Tooltip,{title:"Delete plugin",children:(0,t.jsx)(a.Button,{size:"xs",variant:"light",color:"red",onClick:e=>{e.stopPropagation(),i(l.name,l.name)},icon:y.TrashIcon,className:"text-red-500 hover:text-red-700 hover:bg-red-50"})})})}}]:[]],B=(0,j.useReactTable)({data:e,columns:P,state:{sorting:m},onSortingChange:h,getCoreRowModel:(0,v.getCoreRowModel)(),getSortedRowModel:(0,v.getSortedRowModel)(),enableSorting:!0});return(0,t.jsx)("div",{className:"rounded-lg custom-border relative",children:(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)(_.Table,{className:"[&_td]:py-0.5 [&_th]:py-1",children:[(0,t.jsx)(C.TableHead,{children:B.getHeaderGroups().map(e=>(0,t.jsx)(T.TableRow,{children:e.headers.map(e=>(0,t.jsx)(S.TableHeaderCell,{className:`py-1 h-8 ${"actions"===e.id?"sticky right-0 bg-white shadow-[-4px_0_8px_-6px_rgba(0,0,0,0.1)]":""}`,onClick:e.column.getCanSort()?e.column.getToggleSortingHandler():void 0,children:(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,t.jsx)("div",{className:"flex items-center",children:e.isPlaceholder?null:(0,j.flexRender)(e.column.columnDef.header,e.getContext())}),e.column.getCanSort()&&(0,t.jsx)("div",{className:"w-4",children:e.column.getIsSorted()?({asc:(0,t.jsx)(f.ChevronUpIcon,{className:"h-4 w-4 text-blue-500"}),desc:(0,t.jsx)(p.ChevronDownIcon,{className:"h-4 w-4 text-blue-500"})})[e.column.getIsSorted()]:(0,t.jsx)(b.SwitchVerticalIcon,{className:"h-4 w-4 text-gray-400"})})]})},e.id))},e.id))}),(0,t.jsx)(N.TableBody,{children:s?(0,t.jsx)(T.TableRow,{children:(0,t.jsx)(k.TableCell,{colSpan:P.length,className:"h-8 text-center",children:(0,t.jsx)("div",{className:"text-center text-gray-500",children:(0,t.jsx)("p",{children:"Loading..."})})})}):e&&e.length>0?B.getRowModel().rows.map(e=>(0,t.jsx)(T.TableRow,{className:"h-8",children:e.getVisibleCells().map(e=>(0,t.jsx)(k.TableCell,{className:`py-0.5 max-h-8 overflow-hidden text-ellipsis whitespace-nowrap ${"actions"===e.column.id?"sticky right-0 bg-white shadow-[-4px_0_8px_-6px_rgba(0,0,0,0.1)]":""}`,children:(0,j.flexRender)(e.column.columnDef.cell,e.getContext())},e.id))},e.id)):(0,t.jsx)(T.TableRow,{children:(0,t.jsx)(k.TableCell,{colSpan:P.length,className:"h-8 text-center",children:(0,t.jsx)("div",{className:"text-center text-gray-500",children:(0,t.jsx)("p",{children:"No plugins found. Add one to get started."})})})})})]})})})};var M=e.i(708347),P=e.i(530212),B=e.i(434626),O=e.i(304967),R=e.i(350967),L=e.i(599724),F=e.i(629569),z=e.i(482725);let H=({pluginId:e,onClose:s,accessToken:i,isAdmin:n,onPluginUpdated:o})=>{let[c,u]=(0,l.useState)(null),[m,h]=(0,l.useState)(!0),[g,p]=(0,l.useState)(!1);(0,l.useEffect)(()=>{f()},[e,i]);let f=async()=>{if(i){h(!0);try{let t=await (0,r.getClaudeCodePluginDetails)(i,e);u(t.plugin)}catch(e){console.error("Error fetching plugin info:",e),A.default.error("Failed to load plugin information")}finally{h(!1)}}},b=async()=>{if(i&&c){p(!0);try{c.enabled?(await (0,r.disableClaudeCodePlugin)(i,c.name),A.default.success(`Plugin "${c.name}" disabled`)):(await (0,r.enableClaudeCodePlugin)(i,c.name),A.default.success(`Plugin "${c.name}" enabled`)),o(),f()}catch(e){A.default.error("Failed to toggle plugin status")}finally{p(!1)}}},y=e=>{navigator.clipboard.writeText(e),A.default.success("Copied to clipboard!")};if(m)return(0,t.jsx)("div",{className:"flex items-center justify-center p-8",children:(0,t.jsx)(z.Spin,{size:"large"})});if(!c)return(0,t.jsxs)("div",{className:"p-8 text-center text-gray-500",children:[(0,t.jsx)("p",{children:"Plugin not found"}),(0,t.jsx)(a.Button,{className:"mt-4",onClick:s,children:"Go Back"})]});let j=(0,d.formatInstallCommand)(c),v=(0,d.getSourceLink)(c.source),_=(0,d.getCategoryBadgeColor)(c.category);return(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 mb-6",children:[(0,t.jsx)(P.ArrowLeftIcon,{className:"h-5 w-5 cursor-pointer text-gray-500 hover:text-gray-700",onClick:s}),(0,t.jsx)("h2",{className:"text-2xl font-bold",children:c.name}),c.version&&(0,t.jsxs)(w.Badge,{color:"blue",size:"xs",children:["v",c.version]}),c.category&&(0,t.jsx)(w.Badge,{color:_,size:"xs",children:c.category}),(0,t.jsx)(w.Badge,{color:c.enabled?"green":"gray",size:"xs",children:c.enabled?"Enabled":"Disabled"})]}),(0,t.jsx)(O.Card,{children:(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)(L.Text,{className:"text-gray-600 text-xs mb-2",children:"Install Command"}),(0,t.jsx)("div",{className:"font-mono bg-gray-100 px-3 py-2 rounded text-sm",children:j})]}),(0,t.jsx)(E.Tooltip,{title:"Copy install command",children:(0,t.jsx)(a.Button,{size:"xs",variant:"secondary",icon:x.CopyOutlined,onClick:()=>y(j),className:"ml-4",children:"Copy"})})]})}),(0,t.jsxs)(O.Card,{children:[(0,t.jsx)(F.Title,{children:"Plugin Details"}),(0,t.jsxs)(R.Grid,{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6 mt-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(L.Text,{className:"text-gray-600 text-xs",children:"Plugin ID"}),(0,t.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[(0,t.jsx)(L.Text,{className:"font-mono text-xs",children:c.id}),(0,t.jsx)(x.CopyOutlined,{className:"cursor-pointer text-gray-500 hover:text-blue-500 text-xs",onClick:()=>y(c.id)})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(L.Text,{className:"text-gray-600 text-xs",children:"Name"}),(0,t.jsx)(L.Text,{className:"font-semibold mt-1",children:c.name})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(L.Text,{className:"text-gray-600 text-xs",children:"Version"}),(0,t.jsx)(L.Text,{className:"font-semibold mt-1",children:c.version||"N/A"})]}),(0,t.jsxs)("div",{className:"col-span-2",children:[(0,t.jsx)(L.Text,{className:"text-gray-600 text-xs",children:"Source"}),(0,t.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[(0,t.jsx)(L.Text,{className:"font-semibold",children:(0,d.getSourceDisplayText)(c.source)}),v&&(0,t.jsx)("a",{href:v,target:"_blank",rel:"noopener noreferrer",className:"text-blue-500 hover:text-blue-700",children:(0,t.jsx)(B.ExternalLinkIcon,{className:"h-4 w-4"})})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(L.Text,{className:"text-gray-600 text-xs",children:"Category"}),(0,t.jsx)("div",{className:"mt-1",children:c.category?(0,t.jsx)(w.Badge,{color:_,size:"xs",children:c.category}):(0,t.jsx)(L.Text,{className:"text-gray-400",children:"Uncategorized"})})]}),n&&(0,t.jsxs)("div",{className:"col-span-3",children:[(0,t.jsx)(L.Text,{className:"text-gray-600 text-xs",children:"Status"}),(0,t.jsxs)("div",{className:"flex items-center gap-3 mt-2",children:[(0,t.jsx)(I.Switch,{checked:c.enabled,loading:g,onChange:b}),(0,t.jsx)(L.Text,{className:"text-sm",children:c.enabled?"Plugin is enabled and visible in marketplace":"Plugin is disabled and hidden from marketplace"})]})]})]})]}),c.description&&(0,t.jsxs)(O.Card,{children:[(0,t.jsx)(F.Title,{children:"Description"}),(0,t.jsx)(L.Text,{className:"mt-2",children:c.description})]}),c.keywords&&c.keywords.length>0&&(0,t.jsxs)(O.Card,{children:[(0,t.jsx)(F.Title,{children:"Keywords"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2 mt-2",children:c.keywords.map((e,l)=>(0,t.jsx)(w.Badge,{color:"gray",size:"xs",children:e},l))})]}),c.author&&(0,t.jsxs)(O.Card,{children:[(0,t.jsx)(F.Title,{children:"Author Information"}),(0,t.jsxs)(R.Grid,{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 mt-4",children:[c.author.name&&(0,t.jsxs)("div",{children:[(0,t.jsx)(L.Text,{className:"text-gray-600 text-xs",children:"Name"}),(0,t.jsx)(L.Text,{className:"font-semibold mt-1",children:c.author.name})]}),c.author.email&&(0,t.jsxs)("div",{children:[(0,t.jsx)(L.Text,{className:"text-gray-600 text-xs",children:"Email"}),(0,t.jsx)(L.Text,{className:"font-semibold mt-1",children:(0,t.jsx)("a",{href:`mailto:${c.author.email}`,className:"text-blue-500 hover:text-blue-700",children:c.author.email})})]})]})]}),c.homepage&&(0,t.jsxs)(O.Card,{children:[(0,t.jsx)(F.Title,{children:"Homepage"}),(0,t.jsxs)("a",{href:c.homepage,target:"_blank",rel:"noopener noreferrer",className:"text-blue-500 hover:text-blue-700 flex items-center gap-2 mt-2",children:[c.homepage,(0,t.jsx)(B.ExternalLinkIcon,{className:"h-4 w-4"})]})]}),(0,t.jsxs)(O.Card,{children:[(0,t.jsx)(F.Title,{children:"Metadata"}),(0,t.jsxs)(R.Grid,{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 mt-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(L.Text,{className:"text-gray-600 text-xs",children:"Created At"}),(0,t.jsx)(L.Text,{className:"font-semibold mt-1",children:(0,d.formatDateString)(c.created_at)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(L.Text,{className:"text-gray-600 text-xs",children:"Updated At"}),(0,t.jsx)(L.Text,{className:"font-semibold mt-1",children:(0,d.formatDateString)(c.updated_at)})]}),c.created_by&&(0,t.jsxs)("div",{className:"col-span-2",children:[(0,t.jsx)(L.Text,{className:"text-gray-600 text-xs",children:"Created By"}),(0,t.jsx)(L.Text,{className:"font-semibold mt-1",children:c.created_by})]})]})]})]})};e.s(["default",0,({accessToken:e,userRole:i})=>{let[n,o]=(0,l.useState)([]),[c,d]=(0,l.useState)(!1),[u,m]=(0,l.useState)(!1),[h,x]=(0,l.useState)(!1),[p,f]=(0,l.useState)(null),[b,y]=(0,l.useState)(null),j=!!i&&(0,M.isAdminRole)(i),v=async()=>{if(e){m(!0);try{let t=await (0,r.getClaudeCodePluginsList)(e,!1);console.log(`Claude Code plugins: ${JSON.stringify(t)}`),o(t.plugins)}catch(e){console.error("Error fetching Claude Code plugins:",e)}finally{m(!1)}}};(0,l.useEffect)(()=>{v()},[e]);let w=async()=>{if(p&&e){x(!0);try{await (0,r.deleteClaudeCodePlugin)(e,p.name),A.default.success(`Plugin "${p.displayName}" deleted successfully`),v()}catch(e){console.error("Error deleting plugin:",e),A.default.error("Failed to delete plugin")}finally{x(!1),f(null)}}};return(0,t.jsxs)("div",{className:"w-full mx-auto flex-auto overflow-y-auto m-8 p-2",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-2 mb-4",children:[(0,t.jsx)("h1",{className:"text-2xl font-bold",children:"Claude Code Plugins"}),(0,t.jsxs)("p",{className:"text-sm text-gray-600",children:["Manage Claude Code marketplace plugins. Add, enable, disable, or delete plugins that will be available in your marketplace catalog. Enabled plugins will appear in the public marketplace at"," ",(0,t.jsx)("code",{className:"bg-gray-100 px-1 rounded",children:"/claude-code/marketplace.json"}),"."]}),(0,t.jsx)("div",{className:"mt-2",children:(0,t.jsx)(a.Button,{onClick:()=>{b&&y(null),d(!0)},disabled:!e||!j,children:"+ Add New Plugin"})})]}),b?(0,t.jsx)(H,{pluginId:b,onClose:()=>y(null),accessToken:e,isAdmin:j,onPluginUpdated:v}):(0,t.jsx)(D,{pluginsList:n,isLoading:u,onDeleteClick:(e,t)=>{f({name:e,displayName:t})},accessToken:e,onPluginUpdated:v,isAdmin:j,onPluginClick:e=>y(e)}),(0,t.jsx)(g,{visible:c,onClose:()=>{d(!1)},accessToken:e,onSuccess:()=>{v()}}),p&&(0,t.jsxs)(s.Modal,{title:"Delete Plugin",open:null!==p,onOk:w,onCancel:()=>{f(null)},confirmLoading:h,okText:"Delete",okButtonProps:{danger:!0},children:[(0,t.jsxs)("p",{children:["Are you sure you want to delete plugin:"," ",(0,t.jsx)("strong",{children:p.displayName}),"?"]}),(0,t.jsx)("p",{children:"This action cannot be undone."})]})]})}],704308)},735042,e=>{"use strict";e.i(247167);var t=e.i(843476),l=e.i(584935),a=e.i(290571),s=e.i(271645),r=e.i(95779),i=e.i(444755),n=e.i(673706);let o=(0,n.makeClassName)("BarList");function c(e,t){let{data:l=[],color:c,valueFormatter:d=n.defaultValueFormatter,showAnimation:u=!1,onValueChange:m,sortOrder:h="descending",className:g}=e,x=(0,a.__rest)(e,["data","color","valueFormatter","showAnimation","onValueChange","sortOrder","className"]),p=m?"button":"div",f=s.default.useMemo(()=>"none"===h?l:[...l].sort((e,t)=>"ascending"===h?e.value-t.value:t.value-e.value),[l,h]),b=s.default.useMemo(()=>{let e=Math.max(...f.map(e=>e.value),0);return f.map(t=>0===t.value?0:Math.max(t.value/e*100,2))},[f]);return s.default.createElement("div",Object.assign({ref:t,className:(0,i.tremorTwMerge)(o("root"),"flex justify-between space-x-6",g),"aria-sort":h},x),s.default.createElement("div",{className:(0,i.tremorTwMerge)(o("bars"),"relative w-full space-y-1.5")},f.map((e,t)=>{var l,a,d;let h=e.icon;return s.default.createElement(p,{key:null!=(l=e.key)?l:t,onClick:()=>{null==m||m(e)},className:(0,i.tremorTwMerge)(o("bar"),"group w-full flex items-center rounded-tremor-small",m?["cursor-pointer","hover:bg-tremor-background-muted dark:hover:bg-dark-tremor-background-subtle/40"]:"")},s.default.createElement("div",{className:(0,i.tremorTwMerge)("flex items-center rounded transition-all bg-opacity-40","h-8",e.color||c?[(0,n.getColorClassNames)(null!=(a=e.color)?a:c,r.colorPalette.background).bgColor,m?"group-hover:bg-opacity-30":""]:"bg-tremor-brand-subtle dark:bg-dark-tremor-brand-subtle/60",!m||e.color||c?"":"group-hover:bg-tremor-brand-subtle/30 group-hover:dark:bg-dark-tremor-brand-subtle/70",t===f.length-1?"mb-0":"",u?"duration-500":""),style:{width:`${b[t]}%`,transition:u?"all 1s":""}},s.default.createElement("div",{className:(0,i.tremorTwMerge)("absolute left-2 pr-4 flex max-w-full")},h?s.default.createElement(h,{className:(0,i.tremorTwMerge)(o("barIcon"),"flex-none h-5 w-5 mr-2","text-tremor-content","dark:text-dark-tremor-content")}):null,e.href?s.default.createElement("a",{href:e.href,target:null!=(d=e.target)?d:"_blank",rel:"noreferrer",className:(0,i.tremorTwMerge)(o("barLink"),"whitespace-nowrap hover:underline truncate text-tremor-default",m?"cursor-pointer":"","text-tremor-content-emphasis","dark:text-dark-tremor-content-emphasis"),onClick:e=>e.stopPropagation()},e.name):s.default.createElement("p",{className:(0,i.tremorTwMerge)(o("barText"),"whitespace-nowrap truncate text-tremor-default","text-tremor-content-emphasis","dark:text-dark-tremor-content-emphasis")},e.name))))})),s.default.createElement("div",{className:o("labels")},f.map((e,t)=>{var l;return s.default.createElement("div",{key:null!=(l=e.key)?l:t,className:(0,i.tremorTwMerge)(o("labelWrapper"),"flex justify-end items-center","h-8",t===f.length-1?"mb-0":"mb-1.5")},s.default.createElement("p",{className:(0,i.tremorTwMerge)(o("labelText"),"whitespace-nowrap leading-none truncate text-tremor-default","text-tremor-content-emphasis","dark:text-dark-tremor-content-emphasis")},d(e.value)))})))}c.displayName="BarList";let d=s.default.forwardRef(c);var u=e.i(304967),m=e.i(629569),h=e.i(269200),g=e.i(427612),x=e.i(64848),p=e.i(496020),f=e.i(977572),b=e.i(942232),y=e.i(37091),j=e.i(617802),v=e.i(144267),w=e.i(350967),_=e.i(309426),N=e.i(599724),k=e.i(404206),C=e.i(723731),S=e.i(653824),T=e.i(881073),I=e.i(197647),E=e.i(206929),A=e.i(35983),D=e.i(413990),M=e.i(476961),P=e.i(994388),B=e.i(621642),O=e.i(25080),R=e.i(764205),L=e.i(1023),F=e.i(500330);console.log("process.env.NODE_ENV","production");let z=e=>null!==e&&("Admin"===e||"Admin Viewer"===e);e.s(["default",0,({accessToken:e,token:a,userRole:r,userID:i,keys:n,premiumUser:o})=>{let c=new Date,[H,$]=(0,s.useState)([]),[V,U]=(0,s.useState)([]),[q,K]=(0,s.useState)([]),[G,W]=(0,s.useState)([]),[J,Y]=(0,s.useState)([]),[Q,X]=(0,s.useState)([]),[Z,ee]=(0,s.useState)([]),[et,el]=(0,s.useState)([]),[ea,es]=(0,s.useState)([]),[er,ei]=(0,s.useState)([]),[en,eo]=(0,s.useState)({}),[ec,ed]=(0,s.useState)([]),[eu,em]=(0,s.useState)(""),[eh,eg]=(0,s.useState)(["all-tags"]),[ex,ep]=(0,s.useState)({from:new Date(Date.now()-6048e5),to:new Date}),[ef,eb]=(0,s.useState)(null),[ey,ej]=(0,s.useState)(0),ev=new Date(c.getFullYear(),c.getMonth(),1),ew=new Date(c.getFullYear(),c.getMonth()+1,0),e_=eI(ev),eN=eI(ew);function ek(e){return new Intl.NumberFormat("en-US",{maximumFractionDigits:0,notation:"compact",compactDisplay:"short"}).format(e)}console.log("keys in usage",n),console.log("premium user in usage",o);let eC=async()=>{if(e)try{let t=await (0,R.getProxyUISettings)(e);return console.log("usage tab: proxy_settings",t),t}catch(e){console.error("Error fetching proxy settings:",e)}};(0,s.useEffect)(()=>{eT(ex.from,ex.to)},[ex,eh]);let eS=async(t,l,a)=>{if(!t||!l||!e)return;console.log("uiSelectedKey",a);let s=await (0,R.adminTopEndUsersCall)(e,a,t.toISOString(),l.toISOString());console.log("End user data updated successfully",s),W(s)},eT=async(t,l)=>{if(!t||!l||!e)return;let a=await eC();a?.DISABLE_EXPENSIVE_DB_QUERIES||(X((await (0,R.tagsSpendLogsCall)(e,t.toISOString(),l.toISOString(),0===eh.length?void 0:eh)).spend_per_tag),console.log("Tag spend data updated successfully"))};function eI(e){let t=e.getFullYear(),l=e.getMonth()+1,a=e.getDate();return`${t}-${l<10?"0"+l:l}-${a<10?"0"+a:a}`}console.log(`Start date is ${e_}`),console.log(`End date is ${eN}`);let eE=async(e,t,l)=>{try{let l=await e();t(l)}catch(e){console.error(l,e)}},eA=(e,t,l,a)=>{let s=[],r=new Date(t),i=new Map(e.map(e=>{let t=(e=>{if(e.includes("-"))return e;{let[t,l]=e.split(" ");return new Date(new Date().getFullYear(),new Date(`${t} 01 2024`).getMonth(),parseInt(l)).toISOString().split("T")[0]}})(e.date);return[t,{...e,date:t}]}));for(;r<=l;){let e=r.toISOString().split("T")[0];if(i.has(e))s.push(i.get(e));else{let t={date:e,api_requests:0,total_tokens:0};a.forEach(e=>{t[e]||(t[e]=0)}),s.push(t)}r.setDate(r.getDate()+1)}return s},eD=async()=>{if(e)try{let t=await (0,R.adminSpendLogsCall)(e),l=new Date,a=new Date(l.getFullYear(),l.getMonth(),1),s=new Date(l.getFullYear(),l.getMonth()+1,0),r=eA(t,a,s,[]),i=Number(r.reduce((e,t)=>e+(t.spend||0),0).toFixed(2));ej(i),$(r)}catch(e){console.error("Error fetching overall spend:",e)}},eM=async()=>{e&&await eE(async()=>(await (0,R.adminTopKeysCall)(e)).map(e=>({key:e.api_key.substring(0,10),api_key:e.api_key,key_alias:e.key_alias,spend:Number(e.total_spend.toFixed(2))})),U,"Error fetching top keys")},eP=async()=>{e&&await eE(async()=>(await (0,R.adminTopModelsCall)(e)).map(e=>({key:e.model,spend:(0,F.formatNumberWithCommas)(e.total_spend,2)})),K,"Error fetching top models")},eB=async()=>{e&&await eE(async()=>{let t=await (0,R.teamSpendLogsCall)(e),l=new Date,a=new Date(l.getFullYear(),l.getMonth(),1),s=new Date(l.getFullYear(),l.getMonth()+1,0);return Y(eA(t.daily_spend,a,s,t.teams)),el(t.teams),t.total_spend_per_team.map(e=>({name:e.team_id||"",value:(0,F.formatNumberWithCommas)(e.total_spend||0,2)}))},es,"Error fetching team spend")},eO=async()=>{if(e)try{let t=await (0,R.adminGlobalActivity)(e,e_,eN),l=new Date,a=new Date(l.getFullYear(),l.getMonth(),1),s=new Date(l.getFullYear(),l.getMonth()+1,0),r=eA(t.daily_data||[],a,s,["api_requests","total_tokens"]);eo({...t,daily_data:r})}catch(e){console.error("Error fetching global activity:",e)}},eR=async()=>{if(e)try{let t=await (0,R.adminGlobalActivityPerModel)(e,e_,eN),l=new Date,a=new Date(l.getFullYear(),l.getMonth(),1),s=new Date(l.getFullYear(),l.getMonth()+1,0),r=t.map(e=>({...e,daily_data:eA(e.daily_data||[],a,s,["api_requests","total_tokens"])}));ed(r)}catch(e){console.error("Error fetching global activity per model:",e)}};return((0,s.useEffect)(()=>{(async()=>{if(e&&a&&r&&i){let t=await eC();!(t&&(eb(t),t?.DISABLE_EXPENSIVE_DB_QUERIES))&&(console.log("fetching data - valiue of proxySettings",ef),eD(),eE(()=>e&&a?(0,R.adminspendByProvider)(e,a,e_,eN):Promise.reject("No access token or token"),ei,"Error fetching provider spend"),eM(),eP(),eO(),eR(),z(r)&&(eB(),e&&eE(async()=>(await (0,R.allTagNamesCall)(e)).tag_names,ee,"Error fetching tag names"),e&&eE(()=>(0,R.tagsSpendLogsCall)(e,ex.from?.toISOString(),ex.to?.toISOString(),void 0),e=>X(e.spend_per_tag),"Error fetching top tags"),e&&eE(()=>(0,R.adminTopEndUsersCall)(e,null,void 0,void 0),W,"Error fetching top end users")))}})()},[e,a,r,i,e_,eN]),ef?.DISABLE_EXPENSIVE_DB_QUERIES)?(0,t.jsx)("div",{style:{width:"100%"},className:"p-8",children:(0,t.jsxs)(u.Card,{children:[(0,t.jsx)(m.Title,{children:"Database Query Limit Reached"}),(0,t.jsxs)(N.Text,{className:"mt-4",children:["SpendLogs in DB has ",ef.NUM_SPEND_LOGS_ROWS," rows.",(0,t.jsx)("br",{}),"Please follow our guide to view usage when SpendLogs has more than 1M rows."]}),(0,t.jsx)(P.Button,{className:"mt-4",children:(0,t.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/spending_monitoring",target:"_blank",children:"View Usage Guide"})})]})}):(0,t.jsx)("div",{style:{width:"100%"},className:"p-8",children:(0,t.jsxs)(S.TabGroup,{children:[(0,t.jsxs)(T.TabList,{className:"mt-2",children:[(0,t.jsx)(I.Tab,{children:"All Up"}),z(r)?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(I.Tab,{children:"Team Based Usage"}),(0,t.jsx)(I.Tab,{children:"Customer Usage"}),(0,t.jsx)(I.Tab,{children:"Tag Based Usage"})]}):(0,t.jsx)(t.Fragment,{children:(0,t.jsx)("div",{})})]}),(0,t.jsxs)(C.TabPanels,{children:[(0,t.jsx)(k.TabPanel,{children:(0,t.jsxs)(S.TabGroup,{children:[(0,t.jsxs)(T.TabList,{variant:"solid",className:"mt-1",children:[(0,t.jsx)(I.Tab,{children:"Cost"}),(0,t.jsx)(I.Tab,{children:"Activity"})]}),(0,t.jsxs)(C.TabPanels,{children:[(0,t.jsx)(k.TabPanel,{children:(0,t.jsxs)(w.Grid,{numItems:2,className:"gap-2 h-[100vh] w-full",children:[(0,t.jsxs)(_.Col,{numColSpan:2,children:[(0,t.jsxs)(N.Text,{className:"text-tremor-default text-tremor-content dark:text-dark-tremor-content mb-2 mt-2 text-lg",children:["Project Spend ",new Date().toLocaleString("default",{month:"long"})," 1 -"," ",new Date(new Date().getFullYear(),new Date().getMonth()+1,0).getDate()]}),(0,t.jsx)(j.default,{userSpend:ey,selectedTeam:null,userMaxBudget:null})]}),(0,t.jsx)(_.Col,{numColSpan:2,children:(0,t.jsxs)(u.Card,{children:[(0,t.jsx)(m.Title,{children:"Monthly Spend"}),(0,t.jsx)(l.BarChart,{data:H,index:"date",categories:["spend"],colors:["cyan"],valueFormatter:e=>`$ ${(0,F.formatNumberWithCommas)(e,2)}`,yAxisWidth:100,tickGap:5})]})}),(0,t.jsx)(_.Col,{numColSpan:1,children:(0,t.jsxs)(u.Card,{className:"h-full",children:[(0,t.jsx)(m.Title,{children:"Top Virtual Keys"}),(0,t.jsx)(L.default,{topKeys:V,teams:null,topKeysLimit:5,setTopKeysLimit:()=>{}})]})}),(0,t.jsx)(_.Col,{numColSpan:1,children:(0,t.jsxs)(u.Card,{className:"h-full",children:[(0,t.jsx)(m.Title,{children:"Top Models"}),(0,t.jsx)(l.BarChart,{className:"mt-4 h-40",data:q,index:"key",categories:["spend"],colors:["cyan"],yAxisWidth:200,layout:"vertical",showXAxis:!1,showLegend:!1,valueFormatter:e=>`$${(0,F.formatNumberWithCommas)(e,2)}`})]})}),(0,t.jsx)(_.Col,{numColSpan:1}),(0,t.jsx)(_.Col,{numColSpan:2,children:(0,t.jsxs)(u.Card,{className:"mb-2",children:[(0,t.jsx)(m.Title,{children:"Spend by Provider"}),(0,t.jsx)(t.Fragment,{children:(0,t.jsxs)(w.Grid,{numItems:2,children:[(0,t.jsx)(_.Col,{numColSpan:1,children:(0,t.jsx)(D.DonutChart,{className:"mt-4 h-40",variant:"pie",data:er,index:"provider",category:"spend",colors:["cyan"],valueFormatter:e=>`$${(0,F.formatNumberWithCommas)(e,2)}`})}),(0,t.jsx)(_.Col,{numColSpan:1,children:(0,t.jsxs)(h.Table,{children:[(0,t.jsx)(g.TableHead,{children:(0,t.jsxs)(p.TableRow,{children:[(0,t.jsx)(x.TableHeaderCell,{children:"Provider"}),(0,t.jsx)(x.TableHeaderCell,{children:"Spend"})]})}),(0,t.jsx)(b.TableBody,{children:er.map(e=>(0,t.jsxs)(p.TableRow,{children:[(0,t.jsx)(f.TableCell,{children:e.provider}),(0,t.jsx)(f.TableCell,{children:1e-5>parseFloat(e.spend.toFixed(2))?"less than 0.00":(0,F.formatNumberWithCommas)(e.spend,2)})]},e.provider))})]})})]})})]})})]})}),(0,t.jsx)(k.TabPanel,{children:(0,t.jsxs)(w.Grid,{numItems:1,className:"gap-2 h-[75vh] w-full",children:[(0,t.jsxs)(u.Card,{children:[(0,t.jsx)(m.Title,{children:"All Up"}),(0,t.jsxs)(w.Grid,{numItems:2,children:[(0,t.jsxs)(_.Col,{children:[(0,t.jsxs)(y.Subtitle,{style:{fontSize:"15px",fontWeight:"normal",color:"#535452"},children:["API Requests ",ek(en.sum_api_requests)]}),(0,t.jsx)(M.AreaChart,{className:"h-40",data:en.daily_data,valueFormatter:ek,index:"date",colors:["cyan"],categories:["api_requests"],onValueChange:e=>console.log(e)})]}),(0,t.jsxs)(_.Col,{children:[(0,t.jsxs)(y.Subtitle,{style:{fontSize:"15px",fontWeight:"normal",color:"#535452"},children:["Tokens ",ek(en.sum_total_tokens)]}),(0,t.jsx)(l.BarChart,{className:"h-40",data:en.daily_data,valueFormatter:ek,index:"date",colors:["cyan"],categories:["total_tokens"],onValueChange:e=>console.log(e)})]})]})]}),(0,t.jsx)(t.Fragment,{children:ec.map((e,a)=>(0,t.jsxs)(u.Card,{children:[(0,t.jsx)(m.Title,{children:e.model}),(0,t.jsxs)(w.Grid,{numItems:2,children:[(0,t.jsxs)(_.Col,{children:[(0,t.jsxs)(y.Subtitle,{style:{fontSize:"15px",fontWeight:"normal",color:"#535452"},children:["API Requests ",ek(e.sum_api_requests)]}),(0,t.jsx)(M.AreaChart,{className:"h-40",data:e.daily_data,index:"date",colors:["cyan"],categories:["api_requests"],valueFormatter:ek,onValueChange:e=>console.log(e)})]}),(0,t.jsxs)(_.Col,{children:[(0,t.jsxs)(y.Subtitle,{style:{fontSize:"15px",fontWeight:"normal",color:"#535452"},children:["Tokens ",ek(e.sum_total_tokens)]}),(0,t.jsx)(l.BarChart,{className:"h-40",data:e.daily_data,index:"date",colors:["cyan"],categories:["total_tokens"],valueFormatter:ek,onValueChange:e=>console.log(e)})]})]})]},a))})]})})]})]})}),(0,t.jsx)(k.TabPanel,{children:(0,t.jsxs)(w.Grid,{numItems:2,className:"gap-2 h-[75vh] w-full",children:[(0,t.jsxs)(_.Col,{numColSpan:2,children:[(0,t.jsxs)(u.Card,{className:"mb-2",children:[(0,t.jsx)(m.Title,{children:"Total Spend Per Team"}),(0,t.jsx)(d,{data:ea})]}),(0,t.jsxs)(u.Card,{children:[(0,t.jsx)(m.Title,{children:"Daily Spend Per Team"}),(0,t.jsx)(l.BarChart,{className:"h-72",data:J,showLegend:!0,index:"date",categories:et,yAxisWidth:80,stack:!0})]})]}),(0,t.jsx)(_.Col,{numColSpan:2})]})}),(0,t.jsxs)(k.TabPanel,{children:[(0,t.jsxs)("p",{className:"mb-2 text-gray-500 italic text-[12px]",children:["Customers of your LLM API calls. Tracked when a `user` param is passed in your LLM calls"," ",(0,t.jsx)("a",{className:"text-blue-500",href:"https://docs.litellm.ai/docs/proxy/users",target:"_blank",children:"docs here"})]}),(0,t.jsxs)(w.Grid,{numItems:2,children:[(0,t.jsx)(_.Col,{children:(0,t.jsx)(v.default,{value:ex,onValueChange:e=>{ep(e),eS(e.from,e.to,null)}})}),(0,t.jsxs)(_.Col,{children:[(0,t.jsx)(N.Text,{children:"Select Key"}),(0,t.jsxs)(E.Select,{defaultValue:"all-keys",children:[(0,t.jsx)(A.SelectItem,{value:"all-keys",onClick:()=>{eS(ex.from,ex.to,null)},children:"All Keys"},"all-keys"),n?.map((e,l)=>e&&null!==e.key_alias&&e.key_alias.length>0?(0,t.jsx)(A.SelectItem,{value:String(l),onClick:()=>{eS(ex.from,ex.to,e.token)},children:e.key_alias},l):null)]})]})]}),(0,t.jsx)(u.Card,{className:"mt-4",children:(0,t.jsxs)(h.Table,{className:"max-h-[70vh] min-h-[500px]",children:[(0,t.jsx)(g.TableHead,{children:(0,t.jsxs)(p.TableRow,{children:[(0,t.jsx)(x.TableHeaderCell,{children:"Customer"}),(0,t.jsx)(x.TableHeaderCell,{children:"Spend"}),(0,t.jsx)(x.TableHeaderCell,{children:"Total Events"})]})}),(0,t.jsx)(b.TableBody,{children:G?.map((e,l)=>(0,t.jsxs)(p.TableRow,{children:[(0,t.jsx)(f.TableCell,{children:e.end_user}),(0,t.jsx)(f.TableCell,{children:(0,F.formatNumberWithCommas)(e.total_spend,2)}),(0,t.jsx)(f.TableCell,{children:e.total_count})]},l))})]})})]}),(0,t.jsxs)(k.TabPanel,{children:[(0,t.jsxs)(w.Grid,{numItems:2,children:[(0,t.jsx)(_.Col,{numColSpan:1,children:(0,t.jsx)(v.default,{className:"mb-4",value:ex,onValueChange:e=>{ep(e),eT(e.from,e.to)}})}),(0,t.jsx)(_.Col,{children:o?(0,t.jsx)("div",{children:(0,t.jsxs)(B.MultiSelect,{value:eh,onValueChange:e=>eg(e),children:[(0,t.jsx)(O.MultiSelectItem,{value:"all-tags",onClick:()=>eg(["all-tags"]),children:"All Tags"},"all-tags"),Z&&Z.filter(e=>"all-tags"!==e).map((e,l)=>(0,t.jsx)(O.MultiSelectItem,{value:String(e),children:e},e))]})}):(0,t.jsx)("div",{children:(0,t.jsxs)(B.MultiSelect,{value:eh,onValueChange:e=>eg(e),children:[(0,t.jsx)(O.MultiSelectItem,{value:"all-tags",onClick:()=>eg(["all-tags"]),children:"All Tags"},"all-tags"),Z&&Z.filter(e=>"all-tags"!==e).map((e,l)=>(0,t.jsxs)(A.SelectItem,{value:String(e),disabled:!0,children:["✨ ",e," (Enterprise only Feature)"]},e))]})})})]}),(0,t.jsxs)(w.Grid,{numItems:2,className:"gap-2 h-[75vh] w-full mb-4",children:[(0,t.jsx)(_.Col,{numColSpan:2,children:(0,t.jsxs)(u.Card,{children:[(0,t.jsx)(m.Title,{children:"Spend Per Tag"}),(0,t.jsxs)(N.Text,{children:["Get Started by Tracking cost per tag"," ",(0,t.jsx)("a",{className:"text-blue-500",href:"https://docs.litellm.ai/docs/proxy/cost_tracking",target:"_blank",children:"here"})]}),(0,t.jsx)(l.BarChart,{className:"h-72",data:Q,index:"name",categories:["spend"],colors:["cyan"]})]})}),(0,t.jsx)(_.Col,{numColSpan:2})]})]})]})]})})}],735042)},345244,e=>{"use strict";var t=e.i(843476),l=e.i(271645),a=e.i(752978),s=e.i(994388),r=e.i(309426),i=e.i(599724),n=e.i(350967),o=e.i(278587),c=e.i(304967),d=e.i(629569),u=e.i(389083),m=e.i(677667),h=e.i(898667),g=e.i(130643),x=e.i(808613),p=e.i(311451),f=e.i(199133),b=e.i(592968),y=e.i(827252),j=e.i(702597),v=e.i(355619),w=e.i(764205),_=e.i(727749),N=e.i(435451),k=e.i(860585),C=e.i(500330),S=e.i(678784),T=e.i(118366),I=e.i(464571);let E=({tagId:e,onClose:a,accessToken:r,is_admin:n,editTag:o})=>{let[E]=x.Form.useForm(),[A,D]=(0,l.useState)(null),[M,P]=(0,l.useState)(o),[B,O]=(0,l.useState)([]),[R,L]=(0,l.useState)({}),F=async(e,t)=>{await (0,C.copyToClipboard)(e)&&(L(e=>({...e,[t]:!0})),setTimeout(()=>{L(e=>({...e,[t]:!1}))},2e3))},z=async()=>{if(r)try{let t=(await (0,w.tagInfoCall)(r,[e]))[e];t&&(D(t),o&&E.setFieldsValue({name:t.name,description:t.description,models:t.models,max_budget:t.litellm_budget_table?.max_budget,budget_duration:t.litellm_budget_table?.budget_duration}))}catch(e){console.error("Error fetching tag details:",e),_.default.fromBackend("Error fetching tag details: "+e)}};(0,l.useEffect)(()=>{z()},[e,r]),(0,l.useEffect)(()=>{r&&(0,j.fetchUserModels)("dummy-user","Admin",r,O)},[r]);let H=async e=>{if(r)try{await (0,w.tagUpdateCall)(r,{name:e.name,description:e.description,models:e.models,max_budget:e.max_budget,tpm_limit:e.tpm_limit,rpm_limit:e.rpm_limit,budget_duration:e.budget_duration}),_.default.success("Tag updated successfully"),P(!1),z()}catch(e){console.error("Error updating tag:",e),_.default.fromBackend("Error updating tag: "+e)}};return A?(0,t.jsxs)("div",{className:"p-4",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-6",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(s.Button,{onClick:a,className:"mb-4",children:"← Back to Tags"}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(i.Text,{className:"font-medium",children:"Tag Name:"}),(0,t.jsx)("span",{className:"font-mono px-2 py-1 bg-gray-100 rounded text-sm border border-gray-200",children:A.name}),(0,t.jsx)(I.Button,{type:"text",size:"small",icon:R["tag-name"]?(0,t.jsx)(S.CheckIcon,{size:12}):(0,t.jsx)(T.CopyIcon,{size:12}),onClick:()=>F(A.name,"tag-name"),className:`transition-all duration-200 ${R["tag-name"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100"}`})]}),(0,t.jsx)(i.Text,{className:"text-gray-500",children:A.description||"No description"})]}),n&&!M&&(0,t.jsx)(s.Button,{onClick:()=>P(!0),children:"Edit Tag"})]}),M?(0,t.jsx)(c.Card,{children:(0,t.jsxs)(x.Form,{form:E,onFinish:H,layout:"vertical",initialValues:A,children:[(0,t.jsx)(x.Form.Item,{label:"Tag Name",name:"name",rules:[{required:!0,message:"Please input a tag name"}],children:(0,t.jsx)(p.Input,{className:"rounded-md border-gray-300"})}),(0,t.jsx)(x.Form.Item,{label:"Description",name:"description",children:(0,t.jsx)(p.Input.TextArea,{rows:4})}),(0,t.jsx)(x.Form.Item,{label:(0,t.jsxs)("span",{children:["Allowed Models",(0,t.jsx)(b.Tooltip,{title:"Select which models are allowed to process this type of data",children:(0,t.jsx)(y.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"models",children:(0,t.jsx)(f.Select,{mode:"multiple",placeholder:"Select Models",children:B.map(e=>(0,t.jsx)(f.Select.Option,{value:e,children:(0,v.getModelDisplayName)(e)},e))})}),(0,t.jsxs)(m.Accordion,{className:"mt-4 mb-4",children:[(0,t.jsx)(h.AccordionHeader,{children:(0,t.jsx)(d.Title,{className:"m-0",children:"Budget & Rate Limits"})}),(0,t.jsxs)(g.AccordionBody,{children:[(0,t.jsx)(x.Form.Item,{label:(0,t.jsxs)("span",{children:["Max Budget (USD)"," ",(0,t.jsx)(b.Tooltip,{title:"Maximum amount in USD this tag can spend",children:(0,t.jsx)(y.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"max_budget",children:(0,t.jsx)(N.default,{step:.01,precision:2,width:200})}),(0,t.jsx)(x.Form.Item,{label:(0,t.jsxs)("span",{children:["Reset Budget"," ",(0,t.jsx)(b.Tooltip,{title:"How often the budget should reset",children:(0,t.jsx)(y.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"budget_duration",children:(0,t.jsx)(k.default,{onChange:e=>E.setFieldValue("budget_duration",e)})}),(0,t.jsx)("div",{className:"mt-4 p-3 bg-gray-50 rounded-md border border-gray-200",children:(0,t.jsxs)("p",{className:"text-sm text-gray-600",children:["TPM/RPM limits for tags are not currently supported. If you need this feature, please"," ",(0,t.jsx)("a",{href:"https://github.com/BerriAI/litellm/issues/new",target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-800 underline",children:"create a GitHub issue"}),"."]})})]})]}),(0,t.jsxs)("div",{className:"flex justify-end space-x-2",children:[(0,t.jsx)(s.Button,{onClick:()=>P(!1),children:"Cancel"}),(0,t.jsx)(s.Button,{type:"submit",children:"Save Changes"})]})]})}):(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)(c.Card,{children:[(0,t.jsx)(d.Title,{children:"Tag Details"}),(0,t.jsxs)("div",{className:"space-y-4 mt-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(i.Text,{className:"font-medium",children:"Name"}),(0,t.jsx)(i.Text,{children:A.name})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(i.Text,{className:"font-medium",children:"Description"}),(0,t.jsx)(i.Text,{children:A.description||"-"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(i.Text,{className:"font-medium",children:"Allowed Models"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2 mt-2",children:A.models&&0!==A.models.length?A.models.map(e=>(0,t.jsx)(u.Badge,{color:"blue",children:(0,t.jsx)(b.Tooltip,{title:`ID: ${e}`,children:A.model_info?.[e]||e})},e)):(0,t.jsx)(u.Badge,{color:"red",children:"All Models"})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(i.Text,{className:"font-medium",children:"Created"}),(0,t.jsx)(i.Text,{children:A.created_at?new Date(A.created_at).toLocaleString():"-"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(i.Text,{className:"font-medium",children:"Last Updated"}),(0,t.jsx)(i.Text,{children:A.updated_at?new Date(A.updated_at).toLocaleString():"-"})]})]})]}),A.litellm_budget_table&&(0,t.jsxs)(c.Card,{children:[(0,t.jsx)(d.Title,{children:"Budget & Rate Limits"}),(0,t.jsxs)("div",{className:"space-y-4 mt-4",children:[void 0!==A.litellm_budget_table.max_budget&&null!==A.litellm_budget_table.max_budget&&(0,t.jsxs)("div",{children:[(0,t.jsx)(i.Text,{className:"font-medium",children:"Max Budget"}),(0,t.jsxs)(i.Text,{children:["$",A.litellm_budget_table.max_budget]})]}),A.litellm_budget_table.budget_duration&&(0,t.jsxs)("div",{children:[(0,t.jsx)(i.Text,{className:"font-medium",children:"Budget Duration"}),(0,t.jsx)(i.Text,{children:A.litellm_budget_table.budget_duration})]}),void 0!==A.litellm_budget_table.tpm_limit&&null!==A.litellm_budget_table.tpm_limit&&(0,t.jsxs)("div",{children:[(0,t.jsx)(i.Text,{className:"font-medium",children:"TPM Limit"}),(0,t.jsx)(i.Text,{children:A.litellm_budget_table.tpm_limit.toLocaleString()})]}),void 0!==A.litellm_budget_table.rpm_limit&&null!==A.litellm_budget_table.rpm_limit&&(0,t.jsxs)("div",{children:[(0,t.jsx)(i.Text,{className:"font-medium",children:"RPM Limit"}),(0,t.jsx)(i.Text,{children:A.litellm_budget_table.rpm_limit.toLocaleString()})]})]})]})]})]}):(0,t.jsx)("div",{children:"Loading..."})};var A=e.i(871943),D=e.i(360820),M=e.i(591935),P=e.i(94629),B=e.i(68155),O=e.i(152990),R=e.i(682830),L=e.i(269200),F=e.i(942232),z=e.i(977572),H=e.i(427612),$=e.i(64848),V=e.i(496020);let U="This is just a spend tag that was passed dynamically in a request. It does not control any LLM models.",q=({data:e,onEdit:r,onDelete:n,onSelectTag:o})=>{let[c,d]=l.default.useState([{id:"created_at",desc:!0}]),m=[{header:"Tag Name",accessorKey:"name",cell:({row:e})=>{let l=e.original,a=l.description===U;return(0,t.jsx)("div",{className:"overflow-hidden",children:(0,t.jsx)(b.Tooltip,{title:a?"You cannot view the information of a dynamically generated spend tag":l.name,children:(0,t.jsx)(s.Button,{size:"xs",variant:"light",className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5",onClick:()=>o(l.name),disabled:a,children:l.name})})})}},{header:"Description",accessorKey:"description",cell:({row:e})=>{let l=e.original;return(0,t.jsx)(b.Tooltip,{title:l.description,children:(0,t.jsx)("span",{className:"text-xs",children:l.description||"-"})})}},{header:"Allowed Models",accessorKey:"models",cell:({row:e})=>{let l=e.original;return(0,t.jsx)("div",{style:{display:"flex",flexDirection:"column"},children:l?.models?.length===0?(0,t.jsx)(u.Badge,{size:"xs",className:"mb-1",color:"red",children:"All Models"}):l?.models?.map(e=>(0,t.jsx)(u.Badge,{size:"xs",className:"mb-1",color:"blue",children:(0,t.jsx)(b.Tooltip,{title:`ID: ${e}`,children:(0,t.jsx)(i.Text,{children:l.model_info?.[e]||e})})},e))})}},{header:"Created",accessorKey:"created_at",sortingFn:"datetime",cell:({row:e})=>{let l=e.original;return(0,t.jsx)("span",{className:"text-xs",children:new Date(l.created_at).toLocaleDateString()})}},{id:"actions",header:"Actions",cell:({row:e})=>{let l=e.original,s=l.description===U;return(0,t.jsxs)("div",{className:"flex space-x-2",children:[s?(0,t.jsx)(b.Tooltip,{title:"Dynamically generated spend tags cannot be edited",children:(0,t.jsx)(a.Icon,{icon:M.PencilAltIcon,size:"sm",className:"opacity-50 cursor-not-allowed","aria-label":"Edit tag (disabled)"})}):(0,t.jsx)(b.Tooltip,{title:"Edit tag",children:(0,t.jsx)(a.Icon,{icon:M.PencilAltIcon,size:"sm",onClick:()=>r(l),className:"cursor-pointer hover:text-blue-500"})}),s?(0,t.jsx)(b.Tooltip,{title:"Dynamically generated spend tags cannot be deleted",children:(0,t.jsx)(a.Icon,{icon:B.TrashIcon,size:"sm",className:"opacity-50 cursor-not-allowed","aria-label":"Delete tag (disabled)"})}):(0,t.jsx)(b.Tooltip,{title:"Delete tag",children:(0,t.jsx)(a.Icon,{icon:B.TrashIcon,size:"sm",onClick:()=>n(l.name),className:"cursor-pointer hover:text-red-500"})})]})}}],h=(0,O.useReactTable)({data:e,columns:m,state:{sorting:c},onSortingChange:d,getCoreRowModel:(0,R.getCoreRowModel)(),getSortedRowModel:(0,R.getSortedRowModel)(),enableSorting:!0});return(0,t.jsx)("div",{className:"rounded-lg custom-border relative",children:(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)(L.Table,{className:"[&_td]:py-0.5 [&_th]:py-1",children:[(0,t.jsx)(H.TableHead,{children:h.getHeaderGroups().map(e=>(0,t.jsx)(V.TableRow,{children:e.headers.map(e=>(0,t.jsx)($.TableHeaderCell,{className:`py-1 h-8 ${"actions"===e.id?"sticky right-0 bg-white shadow-[-4px_0_8px_-6px_rgba(0,0,0,0.1)]":""}`,onClick:e.column.getToggleSortingHandler(),children:(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,t.jsx)("div",{className:"flex items-center",children:e.isPlaceholder?null:(0,O.flexRender)(e.column.columnDef.header,e.getContext())}),"actions"!==e.id&&(0,t.jsx)("div",{className:"w-4",children:e.column.getIsSorted()?({asc:(0,t.jsx)(D.ChevronUpIcon,{className:"h-4 w-4 text-blue-500"}),desc:(0,t.jsx)(A.ChevronDownIcon,{className:"h-4 w-4 text-blue-500"})})[e.column.getIsSorted()]:(0,t.jsx)(P.SwitchVerticalIcon,{className:"h-4 w-4 text-gray-400"})})]})},e.id))},e.id))}),(0,t.jsx)(F.TableBody,{children:h.getRowModel().rows.length>0?h.getRowModel().rows.map(e=>(0,t.jsx)(V.TableRow,{className:"h-8",children:e.getVisibleCells().map(e=>(0,t.jsx)(z.TableCell,{className:`py-0.5 max-h-8 overflow-hidden text-ellipsis whitespace-nowrap ${"actions"===e.column.id?"sticky right-0 bg-white shadow-[-4px_0_8px_-6px_rgba(0,0,0,0.1)]":""}`,children:(0,O.flexRender)(e.column.columnDef.cell,e.getContext())},e.id))},e.id)):(0,t.jsx)(V.TableRow,{children:(0,t.jsx)(z.TableCell,{colSpan:m.length,className:"h-8 text-center",children:(0,t.jsx)("div",{className:"text-center text-gray-500",children:(0,t.jsx)("p",{children:"No tags found"})})})})})]})})})};var K=e.i(779241),G=e.i(212931);let W=({visible:e,onCancel:l,onSubmit:a,availableModels:r})=>{let[i]=x.Form.useForm();return(0,t.jsx)(G.Modal,{title:"Create New Tag",open:e,width:800,footer:null,onCancel:()=>{i.resetFields(),l()},children:(0,t.jsxs)(x.Form,{form:i,onFinish:e=>{a(e),i.resetFields()},labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,t.jsx)(x.Form.Item,{label:"Tag Name",name:"tag_name",rules:[{required:!0,message:"Please input a tag name"}],children:(0,t.jsx)(K.TextInput,{})}),(0,t.jsx)(x.Form.Item,{label:"Description",name:"description",children:(0,t.jsx)(p.Input.TextArea,{rows:4})}),(0,t.jsx)(x.Form.Item,{label:(0,t.jsxs)("span",{children:["Allowed Models",(0,t.jsx)(b.Tooltip,{title:"Select which models are allowed to process requests from this tag",children:(0,t.jsx)(y.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"allowed_llms",children:(0,t.jsx)(f.Select,{mode:"multiple",placeholder:"Select Models",children:r.map(e=>(0,t.jsx)(f.Select.Option,{value:e.model_info.id,children:(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{children:e.model_name}),(0,t.jsxs)("span",{className:"text-gray-400 ml-2",children:["(",e.model_info.id,")"]})]})},e.model_info.id))})}),(0,t.jsxs)(m.Accordion,{className:"mt-4 mb-4",children:[(0,t.jsx)(h.AccordionHeader,{children:(0,t.jsx)(d.Title,{className:"m-0",children:"Budget & Rate Limits (Optional)"})}),(0,t.jsxs)(g.AccordionBody,{children:[(0,t.jsx)(x.Form.Item,{className:"mt-4",label:(0,t.jsxs)("span",{children:["Max Budget (USD)"," ",(0,t.jsx)(b.Tooltip,{title:"Maximum amount in USD this tag can spend. When reached, requests with this tag will be blocked",children:(0,t.jsx)(y.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"max_budget",children:(0,t.jsx)(N.default,{step:.01,precision:2,width:200})}),(0,t.jsx)(x.Form.Item,{className:"mt-4",label:(0,t.jsxs)("span",{children:["Reset Budget"," ",(0,t.jsx)(b.Tooltip,{title:"How often the budget should reset. For example, setting 'daily' will reset the budget every 24 hours",children:(0,t.jsx)(y.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"budget_duration",children:(0,t.jsx)(k.default,{onChange:e=>i.setFieldValue("budget_duration",e)})}),(0,t.jsx)("div",{className:"mt-4 p-3 bg-gray-50 rounded-md border border-gray-200",children:(0,t.jsxs)("p",{className:"text-sm text-gray-600",children:["TPM/RPM limits for tags are not currently supported. If you need this feature, please"," ",(0,t.jsx)("a",{href:"https://github.com/BerriAI/litellm/issues/new",target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-800 underline",children:"create a GitHub issue"}),"."]})})]})]}),(0,t.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,t.jsx)(s.Button,{type:"submit",children:"Create Tag"})})]})})};e.s(["default",0,({accessToken:e,userID:c,userRole:d})=>{let[u,m]=(0,l.useState)([]),[h,g]=(0,l.useState)(!1),[x,p]=(0,l.useState)(null),[f,b]=(0,l.useState)(!1),[y,j]=(0,l.useState)(!1),[v,N]=(0,l.useState)(null),[k,C]=(0,l.useState)(""),[S,T]=(0,l.useState)([]),I=async()=>{if(e)try{let t=await (0,w.tagListCall)(e);console.log("List tags response:",t),m(Object.values(t))}catch(e){console.error("Error fetching tags:",e),_.default.fromBackend("Error fetching tags: "+e)}},A=async t=>{if(e)try{await (0,w.tagCreateCall)(e,{name:t.tag_name,description:t.description,models:t.allowed_llms,max_budget:t.max_budget,soft_budget:t.soft_budget,tpm_limit:t.tpm_limit,rpm_limit:t.rpm_limit,budget_duration:t.budget_duration}),_.default.success("Tag created successfully"),g(!1),I()}catch(e){console.error("Error creating tag:",e),_.default.fromBackend("Error creating tag: "+e)}},D=async e=>{N(e),j(!0)},M=async()=>{if(e&&v){try{await (0,w.tagDeleteCall)(e,v),_.default.success("Tag deleted successfully"),I()}catch(e){console.error("Error deleting tag:",e),_.default.fromBackend("Error deleting tag: "+e)}j(!1),N(null)}};return(0,l.useEffect)(()=>{c&&d&&e&&(async()=>{try{let t=await (0,w.modelInfoCall)(e,c,d);t&&t.data&&T(t.data)}catch(e){console.error("Error fetching models:",e),_.default.fromBackend("Error fetching models: "+e)}})()},[e,c,d]),(0,l.useEffect)(()=>{I()},[e]),(0,t.jsx)("div",{className:"w-full mx-4 h-[75vh]",children:x?(0,t.jsx)(E,{tagId:x,onClose:()=>{p(null),b(!1)},accessToken:e,is_admin:"Admin"===d,editTag:f}):(0,t.jsxs)("div",{className:"gap-2 p-8 h-[75vh] w-full mt-2",children:[(0,t.jsxs)("div",{className:"flex justify-between mt-2 w-full items-center mb-4",children:[(0,t.jsx)("h1",{children:"Tag Management"}),(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[k&&(0,t.jsxs)(i.Text,{children:["Last Refreshed: ",k]}),(0,t.jsx)(a.Icon,{icon:o.RefreshIcon,variant:"shadow",size:"xs",className:"self-center cursor-pointer",onClick:()=>{I(),C(new Date().toLocaleString())}})]})]}),(0,t.jsxs)(i.Text,{className:"mb-4",children:["Click on a tag name to view and edit its details.",(0,t.jsxs)("p",{children:["You can use tags to restrict the usage of certain LLMs based on tags passed in the request. Read more about tag routing"," ",(0,t.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/tag_routing",target:"_blank",rel:"noopener noreferrer",children:"here"}),"."]})]}),(0,t.jsx)(s.Button,{className:"mb-4",onClick:()=>g(!0),children:"+ Create New Tag"}),(0,t.jsx)(n.Grid,{numItems:1,className:"gap-2 pt-2 pb-2 h-[75vh] w-full mt-2",children:(0,t.jsx)(r.Col,{numColSpan:1,children:(0,t.jsx)(q,{data:u,onEdit:e=>{p(e.name),b(!0)},onDelete:D,onSelectTag:p})})}),(0,t.jsx)(W,{visible:h,onCancel:()=>g(!1),onSubmit:A,availableModels:S}),y&&(0,t.jsx)("div",{className:"fixed z-10 inset-0 overflow-y-auto",children:(0,t.jsxs)("div",{className:"flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0",children:[(0,t.jsx)("div",{className:"fixed inset-0 transition-opacity","aria-hidden":"true",children:(0,t.jsx)("div",{className:"absolute inset-0 bg-gray-500 opacity-75"})}),(0,t.jsxs)("div",{className:"inline-block align-bottom bg-white rounded-lg text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg sm:w-full",children:[(0,t.jsx)("div",{className:"bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4",children:(0,t.jsx)("div",{className:"sm:flex sm:items-start",children:(0,t.jsxs)("div",{className:"mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left",children:[(0,t.jsx)("h3",{className:"text-lg leading-6 font-medium text-gray-900",children:"Delete Tag"}),(0,t.jsx)("div",{className:"mt-2",children:(0,t.jsx)("p",{className:"text-sm text-gray-500",children:"Are you sure you want to delete this tag?"})})]})})}),(0,t.jsxs)("div",{className:"bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse",children:[(0,t.jsx)(s.Button,{onClick:M,color:"red",className:"ml-2",children:"Delete"}),(0,t.jsx)(s.Button,{onClick:()=>{j(!1),N(null)},children:"Cancel"})]})]})]})})]})})}],345244)},368670,e=>{"use strict";var t=e.i(764205),l=e.i(266027);let a=(0,e.i(243652).createQueryKeys)("modelCostMap");e.s(["useModelCostMap",0,()=>(0,l.useQuery)({queryKey:a.list({}),queryFn:async()=>await (0,t.modelCostMap)(),staleTime:6e4,gcTime:6e4})])},226898,972520,e=>{"use strict";var t=e.i(843476),l=e.i(271645),a=e.i(304967),s=e.i(269200),r=e.i(427612),i=e.i(496020),n=e.i(389083),o=e.i(64848),c=e.i(977572),d=e.i(942232),u=e.i(599724),m=e.i(994388),h=e.i(752978),g=e.i(793130),x=e.i(404206),p=e.i(723731),f=e.i(653824),b=e.i(881073),y=e.i(197647),j=e.i(764205),v=e.i(28651),w=e.i(68155),_=e.i(220508),N=e.i(727749),k=e.i(158392);let C=({accessToken:e,userRole:a,userID:s,modelData:r})=>{let[i,n]=(0,l.useState)({routerSettings:{},selectedStrategy:null,enableTagFiltering:!1}),[o,c]=(0,l.useState)([]),[d,u]=(0,l.useState)({}),[h,g]=(0,l.useState)({});return((0,l.useEffect)(()=>{e&&a&&s&&((0,j.getCallbacksCall)(e,s,a).then(e=>{console.log("callbacks",e);let t=e.router_settings;"model_group_retry_policy"in t&&delete t.model_group_retry_policy;let l=t.routing_strategy||null;n(e=>({...e,routerSettings:t,selectedStrategy:l}))}),(0,j.getRouterSettingsCall)(e).then(e=>{if(console.log("router settings from API",e),e.fields){let t={};e.fields.forEach(e=>{t[e.field_name]={ui_field_name:e.ui_field_name,field_description:e.field_description,options:e.options,link:e.link}}),u(t);let l=e.fields.find(e=>"routing_strategy"===e.field_name);l?.options&&c(l.options),e.routing_strategy_descriptions&&g(e.routing_strategy_descriptions);let a=e.fields.find(e=>"enable_tag_filtering"===e.field_name);a?.field_value!==null&&a?.field_value!==void 0&&n(e=>({...e,enableTagFiltering:a.field_value}))}}))},[e,a,s]),e)?(0,t.jsxs)("div",{className:"w-full",children:[(0,t.jsx)(k.default,{value:i,onChange:n,routerFieldsMetadata:d,availableRoutingStrategies:o,routingStrategyDescriptions:h}),(0,t.jsxs)("div",{className:"border-t border-gray-200 pt-6 flex justify-end gap-3",children:[(0,t.jsx)(m.Button,{variant:"secondary",size:"sm",onClick:()=>window.location.reload(),className:"text-sm",children:"Reset"}),(0,t.jsx)(m.Button,{size:"sm",onClick:()=>{if(!e)return;let t=i.routerSettings;console.log("router_settings",t);let l=new Set(["allowed_fails","cooldown_time","num_retries","timeout","retry_after"]),a=new Set(["model_group_alias","retry_policy"]),s=Object.fromEntries(Object.entries({...t,enable_tag_filtering:i.enableTagFiltering}).map(([e,t])=>{if("routing_strategy_args"!==e&&"routing_strategy"!==e&&"enable_tag_filtering"!==e){let s=document.querySelector(`input[name="${e}"]`),r=((e,t,s)=>{if(void 0===t)return s;let r=t.trim();if("null"===r.toLowerCase())return null;if(l.has(e)){let e=Number(r);return Number.isNaN(e)?s:e}if(a.has(e)){if(""===r)return null;try{return JSON.parse(r)}catch{return s}}return"true"===r.toLowerCase()||"false"!==r.toLowerCase()&&r})(e,s?.value,t);return[e,r]}if("routing_strategy"===e)return[e,i.selectedStrategy];if("enable_tag_filtering"===e)return[e,i.enableTagFiltering];if("routing_strategy_args"===e&&"latency-based-routing"===i.selectedStrategy){let e={},t=document.querySelector('input[name="lowest_latency_buffer"]'),l=document.querySelector('input[name="ttl"]');return t?.value&&(e.lowest_latency_buffer=Number(t.value)),l?.value&&(e.ttl=Number(l.value)),console.log(`setRoutingStrategyArgs: ${e}`),["routing_strategy_args",e]}return null}).filter(e=>null!=e));console.log("updatedVariables",s);try{(0,j.setCallbacksCall)(e,{router_settings:s})}catch(e){N.default.fromBackend("Failed to update router settings: "+e)}N.default.success("router settings updated successfully")},className:"text-sm font-medium",children:"Save Changes"})]})]}):null};e.i(247167);var S=e.i(368670);let T=l.forwardRef(function(e,t){return l.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),l.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14 5l7 7m0 0l-7 7m7-7H3"}))});var I=e.i(122577),E=e.i(592968),A=e.i(898586),D=e.i(356449),M=e.i(127952),P=e.i(418371),B=e.i(464571),O=e.i(998573),R=e.i(689020),L=e.i(212931);let F=(0,e.i(475254).default)("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);function z({open:e,onCancel:l,children:a}){return(0,t.jsx)(L.Modal,{title:(0,t.jsx)("div",{className:"pb-4 border-b border-gray-100",children:(0,t.jsxs)("div",{className:"flex items-center gap-2 text-gray-800",children:[(0,t.jsx)("div",{className:"p-2 bg-indigo-50 rounded-lg",children:(0,t.jsx)(F,{className:"w-5 h-5 text-indigo-600"})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h2",{className:"text-lg font-bold m-0",children:"Configure Model Fallbacks"}),(0,t.jsx)("p",{className:"text-sm text-gray-500 font-normal m-0",children:"Manage multiple fallback chains for different models (up to 5 groups at a time)"})]})]})}),open:e,width:900,footer:null,onCancel:l,maskClosable:!1,className:"top-8",styles:{body:{padding:"24px"},header:{padding:"24px 24px 0 24px",border:"none"}},children:(0,t.jsx)("div",{className:"mt-6",children:a})})}e.s(["ArrowRight",()=>F],972520);var H=e.i(419470);function $({models:e,accessToken:a,value:s=[],onChange:r}){let[i,n]=(0,l.useState)(!1),[o,c]=(0,l.useState)([]),[d,u]=(0,l.useState)(0),[h,g]=(0,l.useState)(!1),[x,p]=(0,l.useState)([{id:"1",primaryModel:null,fallbackModels:[]}]);(0,l.useEffect)(()=>{i&&(p([{id:"1",primaryModel:null,fallbackModels:[]}]),u(e=>e+1))},[i]),(0,l.useEffect)(()=>{let e=async()=>{try{let e=await (0,R.fetchAvailableModels)(a);console.log("Fetched models for fallbacks:",e),c(e)}catch(e){console.error("Error fetching model info for fallbacks:",e)}};i&&e()},[a,i]);let f=Array.from(new Set(o.map(e=>e.model_group))).sort(),b=()=>{n(!1),p([{id:"1",primaryModel:null,fallbackModels:[]}])},y=async()=>{let e=x.filter(e=>!e.primaryModel||0===e.fallbackModels.length);if(e.length>0)return void O.message.error(`Please complete configuration for all groups. ${e.length} group(s) incomplete.`);let t=[...s||[],...x.map(e=>({[e.primaryModel]:e.fallbackModels}))];if(r){g(!0);try{await r(t),N.default.success(`${x.length} fallback configuration(s) added successfully!`),b()}catch(e){console.error("Error saving fallbacks:",e)}finally{g(!1)}}else N.default.fromBackend("onChange callback not provided")};return(0,t.jsxs)("div",{children:[(0,t.jsx)(m.Button,{className:"mx-auto",onClick:()=>n(!0),icon:()=>(0,t.jsx)("span",{className:"mr-1",children:"+"}),children:"Add Fallbacks"}),(0,t.jsxs)(z,{open:i,onCancel:b,children:[(0,t.jsx)(H.FallbackSelectionForm,{groups:x,onGroupsChange:p,availableModels:f,maxFallbacks:10,maxGroups:5},d),x.length>0&&(0,t.jsxs)("div",{className:"flex items-center justify-end space-x-3 pt-6 mt-6 border-t border-gray-100",children:[(0,t.jsx)(B.Button,{type:"default",onClick:b,disabled:h,children:"Cancel"}),(0,t.jsx)(B.Button,{type:"default",onClick:y,disabled:0===x.length||h,loading:h,children:h?"Saving Configuration...":"Save All Configurations"})]})]})]})}let V="inline-flex items-center gap-2 px-2.5 py-1 rounded-md border border-gray-200 bg-gray-50 text-sm font-medium text-gray-800 shrink-0";async function U(e,l){console.log=function(){};let a=window.location.origin,s=new D.default.OpenAI({apiKey:l,baseURL:a,dangerouslyAllowBrowser:!0});try{N.default.info("Testing fallback model response...");let l=await s.chat.completions.create({model:e,messages:[{role:"user",content:"Hi, this is a test message"}],mock_testing_fallbacks:!0});N.default.success((0,t.jsxs)("span",{children:["Test model=",(0,t.jsx)("strong",{children:e}),", received model=",(0,t.jsx)("strong",{children:l.model}),". See"," ",(0,t.jsx)("a",{href:"#",onClick:()=>window.open("https://docs.litellm.ai/docs/proxy/reliability","_blank"),style:{textDecoration:"underline",color:"blue"},children:"curl"})]}))}catch(e){N.default.fromBackend(`Error occurred while generating model response. Please try again. Error: ${e}`)}}let q=({accessToken:e,userRole:a,userID:n,modelData:u})=>{let[m,g]=(0,l.useState)({}),[x,p]=(0,l.useState)(!1),[f,b]=(0,l.useState)(null),[y,v]=(0,l.useState)(!1),{data:_}=(0,S.useModelCostMap)(),k=e=>null!=_&&"object"==typeof _&&e in _?_[e].litellm_provider??"":"";(0,l.useEffect)(()=>{e&&a&&n&&(0,j.getCallbacksCall)(e,n,a).then(e=>{console.log("callbacks",e);let t=e.router_settings;"model_group_retry_policy"in t&&delete t.model_group_retry_policy,g(t)})},[e,a,n]);let C=e=>{b(e),v(!0)},D=async()=>{if(!f||!e)return;let t=Object.keys(f)[0];if(!t)return;p(!0);let l=m.fallbacks.map(e=>{let l={...e};return t in l&&Array.isArray(l[t])&&delete l[t],l}).filter(e=>Object.keys(e).length>0),a={...m,fallbacks:l};try{await (0,j.setCallbacksCall)(e,{router_settings:a}),g(a),N.default.success("Router settings updated successfully")}catch(e){N.default.fromBackend("Failed to update router settings: "+e)}finally{p(!1),v(!1),b(null)}};if(!e)return null;let B=async t=>{if(!e)return;let l={...m,fallbacks:t};try{await (0,j.setCallbacksCall)(e,{router_settings:l}),g(l)}catch(t){throw N.default.fromBackend("Failed to update router settings: "+t),e&&a&&n&&(0,j.getCallbacksCall)(e,n,a).then(e=>{let t=e.router_settings;"model_group_retry_policy"in t&&delete t.model_group_retry_policy,g(t)}),t}},O=Array.isArray(m.fallbacks)&&m.fallbacks.length>0;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)($,{models:u?.data?u.data.map(e=>e.model_name):[],accessToken:e||"",value:m.fallbacks||[],onChange:B}),O?(0,t.jsxs)(s.Table,{children:[(0,t.jsx)(r.TableHead,{children:(0,t.jsxs)(i.TableRow,{children:[(0,t.jsx)(o.TableHeaderCell,{children:"Model Name"}),(0,t.jsx)(o.TableHeaderCell,{children:"Fallbacks"}),(0,t.jsx)(o.TableHeaderCell,{children:"Actions"})]})}),(0,t.jsx)(d.TableBody,{children:m.fallbacks.map((a,s)=>Object.entries(a).map(([r,n])=>{let o;return(0,t.jsxs)(i.TableRow,{children:[(0,t.jsx)(c.TableCell,{className:"align-top",children:(o=k?.(r)??r,(0,t.jsxs)("span",{className:V,children:[(0,t.jsx)(P.ProviderLogo,{provider:o,className:"w-4 h-4 shrink-0"}),(0,t.jsx)("span",{children:r})]}))}),(0,t.jsx)(c.TableCell,{className:"align-top",children:function(e,a,s){let r=Array.isArray(a)?a:[];if(0===r.length)return null;let i=({modelName:e})=>{let l=s?.(e)??e;return(0,t.jsxs)("span",{className:V,children:[(0,t.jsx)(P.ProviderLogo,{provider:l,className:"w-4 h-4 shrink-0"}),(0,t.jsx)("span",{children:e})]})};return(0,t.jsxs)("span",{className:"grid grid-cols-[auto_1fr] items-start gap-x-2 w-full min-w-0",children:[(0,t.jsx)("span",{className:"inline-flex items-center justify-center w-8 h-8 shrink-0 self-start text-blue-600","aria-hidden":!0,children:(0,t.jsx)(T,{className:"w-5 h-5 stroke-[2.5]"})}),(0,t.jsx)("span",{className:"flex flex-wrap items-start gap-1 min-w-0",children:r.map((e,a)=>(0,t.jsxs)(l.default.Fragment,{children:[a>0&&(0,t.jsx)(h.Icon,{icon:T,size:"xs",className:"shrink-0 text-gray-400"}),(0,t.jsx)(i,{modelName:e})]},e))})]})}(0,Array.isArray(n)?n:[],k)}),(0,t.jsxs)(c.TableCell,{className:"align-top",children:[(0,t.jsx)(E.Tooltip,{title:"Test fallback",children:(0,t.jsx)(h.Icon,{icon:I.PlayIcon,size:"sm",onClick:()=>U(Object.keys(a)[0],e||""),className:"cursor-pointer hover:text-blue-600"})}),(0,t.jsx)(E.Tooltip,{title:"Delete fallback",children:(0,t.jsx)("span",{"data-testid":"delete-fallback-button",role:"button",tabIndex:0,onClick:()=>C(a),onKeyDown:e=>"Enter"===e.key&&C(a),className:"cursor-pointer inline-flex",children:(0,t.jsx)(h.Icon,{icon:w.TrashIcon,size:"sm",className:"hover:text-red-600"})})})]})]},s.toString()+r)}))})]}):(0,t.jsx)("div",{className:"rounded-lg border border-gray-200 bg-gray-50 px-4 py-6 text-center",children:(0,t.jsx)(A.Typography.Text,{type:"secondary",children:"No fallbacks configured. Add fallbacks to automatically try another model when the primary fails."})}),(0,t.jsx)(M.default,{isOpen:y,title:"Delete Fallback?",message:"Are you sure you want to delete this fallback? This action cannot be undone.",resourceInformationTitle:"Fallback Information",resourceInformation:[{label:"Model Name",value:f?Object.keys(f)[0]:"",code:!0}],onCancel:()=>{v(!1),b(null)},onOk:D,confirmLoading:x})]})};e.s(["default",0,({accessToken:e,userRole:N,userID:k,modelData:S})=>{let[T,I]=(0,l.useState)([]);(0,l.useEffect)(()=>{e&&(0,j.getGeneralSettingsCall)(e).then(e=>{I(e)})},[e]);let E=(e,t)=>{I(T.map(l=>l.field_name===e?{...l,field_value:t}:l))};return e?(0,t.jsx)("div",{className:"w-full",children:(0,t.jsxs)(f.TabGroup,{className:"h-[75vh] w-full",children:[(0,t.jsxs)(b.TabList,{variant:"line",defaultValue:"1",className:"px-8 pt-4",children:[(0,t.jsx)(y.Tab,{value:"1",children:"Loadbalancing"}),(0,t.jsx)(y.Tab,{value:"2",children:"Fallbacks"}),(0,t.jsx)(y.Tab,{value:"3",children:"General"})]}),(0,t.jsxs)(p.TabPanels,{className:"px-8 py-6",children:[(0,t.jsx)(x.TabPanel,{children:(0,t.jsx)(C,{accessToken:e,userRole:N,userID:k,modelData:S})}),(0,t.jsx)(x.TabPanel,{children:(0,t.jsx)(q,{accessToken:e,userRole:N,userID:k,modelData:S})}),(0,t.jsx)(x.TabPanel,{children:(0,t.jsx)(a.Card,{children:(0,t.jsxs)(s.Table,{children:[(0,t.jsx)(r.TableHead,{children:(0,t.jsxs)(i.TableRow,{children:[(0,t.jsx)(o.TableHeaderCell,{children:"Setting"}),(0,t.jsx)(o.TableHeaderCell,{children:"Value"}),(0,t.jsx)(o.TableHeaderCell,{children:"Status"}),(0,t.jsx)(o.TableHeaderCell,{children:"Action"})]})}),(0,t.jsx)(d.TableBody,{children:T.filter(e=>"TypedDictionary"!==e.field_type).map((l,a)=>(0,t.jsxs)(i.TableRow,{children:[(0,t.jsxs)(c.TableCell,{children:[(0,t.jsx)(u.Text,{children:l.field_name}),(0,t.jsx)("p",{style:{fontSize:"0.65rem",color:"#808080",fontStyle:"italic"},className:"mt-1",children:l.field_description})]}),(0,t.jsx)(c.TableCell,{children:"Integer"==l.field_type?(0,t.jsx)(v.InputNumber,{step:1,value:l.field_value,onChange:e=>E(l.field_name,e)}):"Boolean"==l.field_type?(0,t.jsx)(g.Switch,{checked:!0===l.field_value||"true"===l.field_value,onChange:e=>E(l.field_name,e)}):null}),(0,t.jsx)(c.TableCell,{children:!0==l.stored_in_db?(0,t.jsx)(n.Badge,{icon:_.CheckCircleIcon,className:"text-white",children:"In DB"}):!1==l.stored_in_db?(0,t.jsx)(n.Badge,{className:"text-gray bg-white outline",children:"In Config"}):(0,t.jsx)(n.Badge,{className:"text-gray bg-white outline",children:"Not Set"})}),(0,t.jsxs)(c.TableCell,{children:[(0,t.jsx)(m.Button,{onClick:()=>((t,l)=>{if(!e)return;let a=T[l].field_value;if(null!=a&&void 0!=a)try{(0,j.updateConfigFieldSetting)(e,t,a);let l=T.map(e=>e.field_name===t?{...e,stored_in_db:!0}:e);I(l)}catch(e){}})(l.field_name,a),children:"Update"}),(0,t.jsx)(h.Icon,{icon:w.TrashIcon,color:"red",onClick:()=>((t,l)=>{if(e)try{(0,j.deleteConfigFieldSetting)(e,t);let l=T.map(e=>e.field_name===t?{...e,stored_in_db:null,field_value:null}:e);I(l)}catch(e){}})(l.field_name,0),children:"Reset"})]})]},a))})]})})})]})]})}):null}],226898)},566606,e=>{"use strict";var t=e.i(843476),l=e.i(271645),a=e.i(618566),s=e.i(947293),r=e.i(764205),i=e.i(954616),n=e.i(266027),o=e.i(612256);let c=(0,e.i(243652).createQueryKeys)("onboarding");var d=e.i(482725),u=e.i(56456);function m(){return(0,t.jsx)("div",{className:"mx-auto w-full max-w-md mt-10 flex justify-center",children:(0,t.jsx)(d.Spin,{indicator:(0,t.jsx)(u.LoadingOutlined,{spin:!0}),size:"large"})})}var h=e.i(560445),g=e.i(464571);function x(){return(0,t.jsxs)("div",{className:"mx-auto w-full max-w-md mt-10",children:[(0,t.jsx)(h.Alert,{type:"error",message:"Failed to load invitation",description:"The invitation link may be invalid or expired.",showIcon:!0}),(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsx)(g.Button,{href:"/ui/login",children:"Back to Login"})})]})}var p=e.i(175712),f=e.i(808613),b=e.i(311451),y=e.i(898586);function j({variant:e,userEmail:a,isPending:s,claimError:r,onSubmit:i}){let[n]=f.Form.useForm();return l.default.useEffect(()=>{a&&n.setFieldValue("user_email",a)},[a,n]),(0,t.jsx)("div",{className:"mx-auto w-full max-w-md mt-10",children:(0,t.jsxs)(p.Card,{children:[(0,t.jsx)(y.Typography.Title,{level:5,className:"text-center mb-5",children:"🚅 LiteLLM"}),(0,t.jsx)(y.Typography.Title,{level:3,children:"reset_password"===e?"Reset Password":"Sign Up"}),(0,t.jsx)(y.Typography.Text,{children:"reset_password"===e?"Reset your password to access Admin UI.":"Claim your user account to login to Admin UI."}),"signup"===e&&(0,t.jsx)(h.Alert,{className:"mt-4",type:"info",message:"SSO",description:(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsx)("span",{children:"SSO is under the Enterprise Tier."}),(0,t.jsx)(g.Button,{type:"primary",size:"small",href:"https://forms.gle/W3U4PZpJGFHWtHyA9",target:"_blank",children:"Get Free Trial"})]}),showIcon:!0}),(0,t.jsxs)(f.Form,{className:"mt-10 mb-5",layout:"vertical",form:n,onFinish:e=>i({password:e.password}),children:[(0,t.jsx)(f.Form.Item,{label:"Email Address",name:"user_email",children:(0,t.jsx)(b.Input,{type:"email",disabled:!0})}),(0,t.jsx)(f.Form.Item,{label:"Password",name:"password",rules:[{required:!0,message:"password required to sign up"}],help:"reset_password"===e?"Enter your new password":"Create a password for your account",children:(0,t.jsx)(b.Input.Password,{})}),r&&(0,t.jsx)(h.Alert,{type:"error",message:r,showIcon:!0,className:"mb-4"}),(0,t.jsx)("div",{className:"mt-10",children:(0,t.jsx)(g.Button,{htmlType:"submit",loading:s,children:"reset_password"===e?"Reset Password":"Sign Up"})})]})]})})}function v({variant:e}){let d=(0,a.useSearchParams)().get("invitation_id"),[u,h]=l.default.useState(null),{data:g,isLoading:p,isError:f}=(e=>{let{isLoading:t}=(0,o.useUIConfig)();return(0,n.useQuery)({queryKey:c.detail(e??""),queryFn:async()=>{if(!e)throw Error("inviteId is required");return(0,r.getOnboardingCredentials)(e)},enabled:!!e&&!t})})(d),{mutate:b,isPending:y}=(0,i.useMutation)({mutationFn:async({accessToken:e,inviteId:t,userId:l,password:a})=>await (0,r.claimOnboardingToken)(e,t,l,a)}),v=g?.token?(0,s.jwtDecode)(g.token):null,w=v?.user_email??"",_=v?.user_id??null,N=v?.key??null,k=g?.token??null;return p?(0,t.jsx)(m,{}):f?(0,t.jsx)(x,{}):(0,t.jsx)(j,{variant:e,userEmail:w,isPending:y,claimError:u,onSubmit:e=>{N&&k&&_&&d&&(h(null),b({accessToken:N,inviteId:d,userId:_,password:e.password},{onSuccess:()=>{document.cookie=`token=${k}; path=/; SameSite=Lax`;let e=(0,r.getProxyBaseUrl)();window.location.href=e?`${e}/ui/?login=success`:"/ui/?login=success"},onError:e=>{h(e.message||"Failed to submit. Please try again.")}}))}})}function w(){let e=(0,a.useSearchParams)().get("action");return(0,t.jsx)(v,{variant:"reset_password"===e?"reset_password":"signup"})}function _(){return(0,t.jsx)(l.Suspense,{fallback:(0,t.jsx)("div",{className:"flex items-center justify-center min-h-screen",children:"Loading..."}),children:(0,t.jsx)(w,{})})}e.s(["default",()=>_],566606)},152473,e=>{"use strict";var t=e.i(271645);let l={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={...l,...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 s(e,l){let[s,r]=(0,t.useState)(e),i=function(e,l){let[s]=(0,t.useState)(()=>{var t;return Object.getOwnPropertyNames(Object.getPrototypeOf(t=new a(e,l))).filter(e=>"function"==typeof t[e]).reduce((e,l)=>{let a=t[l];return"function"==typeof a&&(e[l]=a.bind(t)),e},{})});return s.setOptions(l),s}(r,l);return[s,i.maybeExecute,i]}e.s(["useDebouncedState",()=>s],152473)},700514,e=>{"use strict";var t=e.i(271645);e.s(["defaultPageSize",0,25,"useBaseUrl",0,()=>{let[e,l]=(0,t.useState)("http://localhost:4000");return(0,t.useEffect)(()=>{{let{protocol:e,host:t}=window.location;l(`${e}//${t}`)}},[]),e}])},50882,e=>{"use strict";var t=e.i(843476),l=e.i(621482),a=e.i(243652),s=e.i(764205),r=e.i(135214);let i=(0,a.createQueryKeys)("infiniteKeyAliases");var n=e.i(56456),o=e.i(152473),c=e.i(199133),d=e.i(271645);e.s(["PaginatedKeyAliasSelect",0,({value:e,onChange:a,placeholder:u="Select a key alias",style:m,pageSize:h=50,allowClear:g=!0,disabled:x=!1})=>{let[p,f]=(0,d.useState)(""),[b,y]=(0,o.useDebouncedState)("",{wait:300}),{data:j,fetchNextPage:v,hasNextPage:w,isFetchingNextPage:_,isLoading:N}=((e=50,t)=>{let{accessToken:a}=(0,r.default)();return(0,l.useInfiniteQuery)({queryKey:i.list({filters:{size:e,...t&&{search:t}}}),queryFn:async({pageParam:l})=>await (0,s.keyAliasesCall)(a,l,e,t),initialPageParam:1,getNextPageParam:e=>{if(e.current_page{if(!j?.pages)return[];let e=new Set,t=[];for(let l of j.pages)for(let a of l.aliases)!a||e.has(a)||(e.add(a),t.push({label:a,value:a}));return t},[j]);return(0,t.jsx)(c.Select,{value:e||void 0,onChange:e=>{a?.(e??"")},placeholder:u,style:{width:"100%",...m},allowClear:g,disabled:x,showSearch:!0,filterOption:!1,onSearch:e=>{f(e),y(e)},searchValue:p,onPopupScroll:e=>{let t=e.currentTarget;(t.scrollTop+t.clientHeight)/t.scrollHeight>=.8&&w&&!_&&v()},loading:N,notFoundContent:N?(0,t.jsx)(n.LoadingOutlined,{spin:!0}):"No key aliases found",options:k,popupRender:e=>(0,t.jsxs)(t.Fragment,{children:[e,_&&(0,t.jsx)("div",{style:{textAlign:"center",padding:8},children:(0,t.jsx)(n.LoadingOutlined,{spin:!0})})]})})}],50882)},693569,e=>{"use strict";var t=e.i(843476),l=e.i(268004),a=e.i(309426),s=e.i(350967),r=e.i(898586),i=e.i(947293),n=e.i(618566),o=e.i(271645),c=e.i(566606),d=e.i(584578),u=e.i(764205),m=e.i(702597),h=e.i(207082),g=e.i(500330),x=e.i(871943),p=e.i(502547),f=e.i(360820),b=e.i(94629),y=e.i(152990),j=e.i(682830),v=e.i(389083),w=e.i(994388),_=e.i(752978),N=e.i(269200),k=e.i(942232),C=e.i(977572),S=e.i(427612),T=e.i(64848),I=e.i(496020),E=e.i(599724),A=e.i(827252),D=e.i(282786),M=e.i(981339),P=e.i(592968),B=e.i(355619),O=e.i(633627),R=e.i(374009),L=e.i(700514),F=e.i(135214),z=e.i(50882),H=e.i(969550),$=e.i(20147);function V({teams:e,organizations:l,onSortChange:a,currentSort:s}){let[r,i]=(0,o.useState)(null),[n,c]=o.default.useState(()=>s?[{id:s.sortBy,desc:"desc"===s.sortOrder}]:[{id:"created_at",desc:!0}]),[d,m]=o.default.useState({pageIndex:0,pageSize:50}),V=n.length>0?n[0].id:null,U=n.length>0?n[0].desc?"desc":"asc":null,{data:q,isPending:K,isFetching:G,refetch:W}=(0,h.useKeys)(d.pageIndex+1,d.pageSize,{sortBy:V||void 0,sortOrder:U||void 0}),[J,Y]=(0,o.useState)({}),{filters:Q,filteredKeys:X,filteredTotalCount:Z,allTeams:ee,allOrganizations:et,handleFilterChange:el,handleFilterReset:ea}=function({keys:e,teams:t,organizations:l}){let a={"Team ID":"","Organization ID":"","Key Alias":"","User ID":"","Sort By":"created_at","Sort Order":"desc"},{accessToken:s}=(0,F.default)(),[r,i]=(0,o.useState)(a),[n,c]=(0,o.useState)(t||[]),[d,m]=(0,o.useState)(l||[]),[h,g]=(0,o.useState)(e),[x,p]=(0,o.useState)(null),f=(0,o.useRef)(0),b=(0,o.useCallback)((0,R.default)(async e=>{if(!s)return;let t=Date.now();f.current=t;try{let l=await (0,u.keyListCall)(s,e["Organization ID"]||null,e["Team ID"]||null,e["Key Alias"]||null,e["User ID"]||null,e["Key Hash"]||null,1,L.defaultPageSize,e["Sort By"]||null,e["Sort Order"]||null);t===f.current&&l&&(g(l.keys),p(l.total_count??null),console.log("called from debouncedSearch filters:",JSON.stringify(e)),console.log("called from debouncedSearch data:",JSON.stringify(l)))}catch(e){console.error("Error searching users:",e)}},300),[s]);return(0,o.useEffect)(()=>{if(!e)return void g([]);let t=[...e];r["Team ID"]&&(t=t.filter(e=>e.team_id===r["Team ID"])),r["Organization ID"]&&(t=t.filter(e=>(e.organization_id??e.org_id)===r["Organization ID"])),g(t)},[e,r]),(0,o.useEffect)(()=>{let e=async()=>{let e=await (0,O.fetchAllTeams)(s);e.length>0&&c(e);let t=await (0,O.fetchAllOrganizations)(s);t.length>0&&m(t)};s&&e()},[s]),(0,o.useEffect)(()=>{t&&t.length>0&&c(e=>e.length{l&&l.length>0&&m(e=>e.length{i({"Team ID":e["Team ID"]||"","Organization ID":e["Organization ID"]||"","Key Alias":e["Key Alias"]||"","User ID":e["User ID"]||"","Sort By":e["Sort By"]||"created_at","Sort Order":e["Sort Order"]||"desc"}),t||b({...r,...e})},handleFilterReset:()=>{i(a),p(null),b(a)}}}({keys:q?.keys||[],teams:e,organizations:l}),es=Z??q?.total_count??0;(0,o.useEffect)(()=>{if(W){let e=()=>{W()};return window.addEventListener("storage",e),()=>{window.removeEventListener("storage",e)}}},[W]);let er=(0,o.useMemo)(()=>[{id:"expander",header:()=>null,size:40,enableSorting:!1,cell:({row:e})=>e.getCanExpand()?(0,t.jsx)("button",{onClick:e.getToggleExpandedHandler(),style:{cursor:"pointer"},children:e.getIsExpanded()?"▼":"▶"}):null},{id:"token",accessorKey:"token",header:"Key ID",size:100,enableSorting:!0,cell:e=>{let l=e.getValue(),a=e.cell.column.getSize();return(0,t.jsx)(P.Tooltip,{title:l,children:(0,t.jsx)(w.Button,{size:"xs",variant:"light",className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left overflow-hidden truncate block",style:{maxWidth:a,overflow:"hidden"},onClick:()=>i(e.row.original),children:l??"-"})})}},{id:"key_alias",accessorKey:"key_alias",header:"Key Alias",size:150,enableSorting:!0,cell:e=>{let l=e.getValue(),a=e.cell.column.getSize();return(0,t.jsx)(P.Tooltip,{title:l,children:(0,t.jsx)("span",{className:"font-mono text-xs truncate block",style:{maxWidth:a,overflow:"hidden"},children:l??"-"})})}},{id:"key_name",accessorKey:"key_name",header:"Secret Key",size:120,enableSorting:!1,cell:e=>(0,t.jsx)("span",{className:"font-mono text-xs",children:e.getValue()})},{id:"team_alias",accessorKey:"team_id",header:"Team Alias",size:120,enableSorting:!1,cell:({row:t,getValue:l})=>{let a=l(),s=e?.find(e=>e.team_id===a);return s?.team_alias||"Unknown"}},{id:"team_id",accessorKey:"team_id",header:"Team ID",size:80,enableSorting:!1,cell:e=>{let l=e.getValue(),a=e.cell.column.getSize();return(0,t.jsx)(P.Tooltip,{title:l,children:(0,t.jsx)("span",{className:"font-mono text-xs truncate block",style:{maxWidth:a,overflow:"hidden"},children:l??"-"})})}},{id:"organization_id",accessorKey:"org_id",header:"Organization ID",size:140,enableSorting:!1,cell:e=>e.getValue()?e.renderValue():"-"},{id:"user_email",accessorKey:"user",header:"User Email",size:160,enableSorting:!1,cell:e=>{let l=e.getValue(),a=l?.user_email,s=e.cell.column.getSize();return(0,t.jsx)(P.Tooltip,{title:a,children:(0,t.jsx)("span",{className:"font-mono text-xs truncate block",style:{maxWidth:s,overflow:"hidden"},children:a??"-"})})}},{id:"user_id",accessorKey:"user_id",header:"User ID",size:70,enableSorting:!1,cell:e=>{let l=e.getValue(),a="default_user_id"===l?"Default Proxy Admin":l,s=e.cell.column.getSize();return(0,t.jsx)(P.Tooltip,{title:a,children:(0,t.jsx)("span",{className:"font-mono text-xs truncate block",style:{maxWidth:s,overflow:"hidden"},children:a??"-"})})}},{id:"created_at",accessorKey:"created_at",header:"Created At",size:120,enableSorting:!0,cell:e=>{let t=e.getValue();return t?new Date(t).toLocaleDateString():"-"}},{id:"created_by",accessorKey:"created_by",header:"Created By",size:70,enableSorting:!1,cell:e=>{let l=e.getValue(),a="default_user_id"===l?"Default Proxy Admin":l,s=e.cell.column.getSize();return(0,t.jsx)(P.Tooltip,{title:a,children:(0,t.jsx)("span",{className:"font-mono text-xs truncate block",style:{maxWidth:s,overflow:"hidden"},children:a??"-"})})}},{id:"updated_at",accessorKey:"updated_at",header:"Updated At",size:120,enableSorting:!0,cell:e=>{let t=e.getValue();return t?new Date(t).toLocaleDateString():"Never"}},{id:"last_active",accessorKey:"last_active",header:()=>(0,t.jsxs)("span",{className:"flex items-center gap-1",children:["Last Active",(0,t.jsx)(D.Popover,{content:"This is a new field and is not backfilled. Only new key usage will update this value.",trigger:"hover",children:(0,t.jsx)(A.InfoCircleOutlined,{className:"text-gray-400 text-xs cursor-help"})})]}),size:130,enableSorting:!1,cell:e=>{let l=e.getValue();if(!l)return"Unknown";let a=new Date(l);return(0,t.jsx)(P.Tooltip,{title:a.toLocaleString(void 0,{dateStyle:"medium",timeStyle:"long"}),children:(0,t.jsx)("span",{children:a.toLocaleDateString()})})}},{id:"expires",accessorKey:"expires",header:"Expires",size:120,enableSorting:!1,cell:e=>{let t=e.getValue();return t?new Date(t).toLocaleDateString():"Never"}},{id:"spend",accessorKey:"spend",header:"Spend (USD)",size:100,enableSorting:!0,cell:e=>(0,g.formatNumberWithCommas)(e.getValue(),4)},{id:"max_budget",accessorKey:"max_budget",header:"Budget (USD)",size:110,enableSorting:!0,cell:e=>{let t=e.getValue();return null===t?"Unlimited":`$${(0,g.formatNumberWithCommas)(t)}`}},{id:"budget_reset_at",accessorKey:"budget_reset_at",header:"Budget Reset",size:130,enableSorting:!1,cell:e=>{let t=e.getValue();return t?new Date(t).toLocaleString():"Never"}},{id:"models",accessorKey:"models",header:"Models",size:200,enableSorting:!1,cell:e=>{let l=e.getValue();return(0,t.jsx)("div",{className:"flex flex-col py-2",children:Array.isArray(l)?(0,t.jsx)("div",{className:"flex flex-col",children:0===l.length?(0,t.jsx)(v.Badge,{size:"xs",className:"mb-1",color:"red",children:(0,t.jsx)(E.Text,{children:"All Proxy Models"})}):(0,t.jsx)(t.Fragment,{children:(0,t.jsxs)("div",{className:"flex items-start",children:[l.length>3&&(0,t.jsx)("div",{children:(0,t.jsx)(_.Icon,{icon:J[e.row.id]?x.ChevronDownIcon:p.ChevronRightIcon,className:"cursor-pointer",size:"xs",onClick:()=>{Y(t=>({...t,[e.row.id]:!t[e.row.id]}))}})}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-1",children:[l.slice(0,3).map((e,l)=>"all-proxy-models"===e?(0,t.jsx)(v.Badge,{size:"xs",color:"red",children:(0,t.jsx)(E.Text,{children:"All Proxy Models"})},l):(0,t.jsx)(v.Badge,{size:"xs",color:"blue",children:(0,t.jsx)(E.Text,{children:e.length>30?`${(0,B.getModelDisplayName)(e).slice(0,30)}...`:(0,B.getModelDisplayName)(e)})},l)),l.length>3&&!J[e.row.id]&&(0,t.jsx)(v.Badge,{size:"xs",color:"gray",className:"cursor-pointer",children:(0,t.jsxs)(E.Text,{children:["+",l.length-3," ",l.length-3==1?"more model":"more models"]})}),J[e.row.id]&&(0,t.jsx)("div",{className:"flex flex-wrap gap-1",children:l.slice(3).map((e,l)=>"all-proxy-models"===e?(0,t.jsx)(v.Badge,{size:"xs",color:"red",children:(0,t.jsx)(E.Text,{children:"All Proxy Models"})},l+3):(0,t.jsx)(v.Badge,{size:"xs",color:"blue",children:(0,t.jsx)(E.Text,{children:e.length>30?`${(0,B.getModelDisplayName)(e).slice(0,30)}...`:(0,B.getModelDisplayName)(e)})},l+3))})]})]})})}):null})}},{id:"rate_limits",header:"Rate Limits",size:140,enableSorting:!1,cell:({row:e})=>{let l=e.original;return(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{children:["TPM: ",null!==l.tpm_limit?l.tpm_limit:"Unlimited"]}),(0,t.jsxs)("div",{children:["RPM: ",null!==l.rpm_limit?l.rpm_limit:"Unlimited"]})]})}}],[]),ei=[{name:"Team ID",label:"Team ID",isSearchable:!0,searchFn:async e=>ee&&0!==ee.length?ee.filter(t=>t.team_id.toLowerCase().includes(e.toLowerCase())||t.team_alias&&t.team_alias.toLowerCase().includes(e.toLowerCase())).map(e=>({label:`${e.team_alias||e.team_id} (${e.team_id})`,value:e.team_id})):[]},{name:"Organization ID",label:"Organization ID",isSearchable:!0,searchFn:async e=>et&&0!==et.length?et.filter(t=>t.organization_id?.toLowerCase().includes(e.toLowerCase())??!1).filter(e=>null!==e.organization_id&&void 0!==e.organization_id).map(e=>({label:`${e.organization_id||"Unknown"} (${e.organization_id})`,value:e.organization_id})):[]},{name:"Key Alias",label:"Key Alias",customComponent:z.PaginatedKeyAliasSelect},{name:"User ID",label:"User ID",isSearchable:!1},{name:"Key Hash",label:"Key Hash",isSearchable:!1}];console.log(`keys: ${JSON.stringify(q)}`);let en=(0,y.useReactTable)({data:X,columns:er.filter(e=>"expander"!==e.id),columnResizeMode:"onChange",columnResizeDirection:"ltr",state:{sorting:n,pagination:d},onSortingChange:e=>{let t="function"==typeof e?e(n):e;if(console.log(`newSorting: ${JSON.stringify(t)}`),c(t),t&&t.length>0){let e=t[0],l=e.id,s=e.desc?"desc":"asc";console.log(`sortBy: ${l}, sortOrder: ${s}`),el({...Q,"Sort By":l,"Sort Order":s},!0),a?.(l,s)}},onPaginationChange:m,getCoreRowModel:(0,j.getCoreRowModel)(),getSortedRowModel:(0,j.getSortedRowModel)(),getPaginationRowModel:(0,j.getPaginationRowModel)(),enableSorting:!0,manualSorting:!1,manualPagination:!0,pageCount:Math.ceil(es/d.pageSize)});o.default.useEffect(()=>{s&&c([{id:s.sortBy,desc:"desc"===s.sortOrder}])},[s]);let{pageIndex:eo,pageSize:ec}=en.getState().pagination,ed=Math.min((eo+1)*ec,es),eu=`${eo*ec+1} - ${ed}`;return(0,t.jsx)("div",{className:"w-full h-full overflow-hidden",children:r?(0,t.jsx)($.default,{keyId:r.token,onClose:()=>i(null),keyData:r,teams:ee,onDelete:W}):(0,t.jsxs)("div",{className:"border-b py-4 flex-1 overflow-hidden",children:[(0,t.jsx)("div",{className:"w-full mb-6",children:(0,t.jsx)(H.default,{options:ei,onApplyFilters:el,initialValues:Q,onResetFilters:ea})}),(0,t.jsxs)("div",{className:"flex items-center justify-between w-full mb-4",children:[K||G?(0,t.jsx)(M.Skeleton.Node,{active:!0,style:{width:200,height:20}}):(0,t.jsxs)("span",{className:"inline-flex text-sm text-gray-700",children:["Showing ",eu," of ",es," results"]}),(0,t.jsxs)("div",{className:"inline-flex items-center gap-2",children:[K||G?(0,t.jsx)(M.Skeleton.Node,{active:!0,style:{width:74,height:20}}):(0,t.jsxs)("span",{className:"text-sm text-gray-700",children:["Page ",eo+1," of ",en.getPageCount()]}),K||G?(0,t.jsx)(M.Skeleton.Button,{active:!0,size:"small",style:{width:84,height:30}}):(0,t.jsx)("button",{onClick:()=>en.previousPage(),disabled:K||G||!en.getCanPreviousPage(),className:"px-3 py-1 text-sm border rounded-md hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed",children:"Previous"}),K||G?(0,t.jsx)(M.Skeleton.Button,{active:!0,size:"small",style:{width:58,height:30}}):(0,t.jsx)("button",{onClick:()=>en.nextPage(),disabled:K||G||!en.getCanNextPage(),className:"px-3 py-1 text-sm border rounded-md hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed",children:"Next"})]})]}),(0,t.jsx)("div",{className:"h-[75vh] overflow-auto",children:(0,t.jsx)("div",{className:"rounded-lg custom-border relative",children:(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)(N.Table,{className:"[&_td]:py-0.5 [&_th]:py-1",style:{width:en.getCenterTotalSize()},children:[(0,t.jsx)(S.TableHead,{children:en.getHeaderGroups().map(e=>(0,t.jsx)(I.TableRow,{children:e.headers.map(e=>(0,t.jsx)(T.TableHeaderCell,{"data-header-id":e.id,className:`py-1 h-8 relative hover:bg-gray-50 ${"actions"===e.id?"sticky right-0 bg-white shadow-[-4px_0_8px_-6px_rgba(0,0,0,0.1)]":""}`,style:{width:e.getSize(),position:"relative",cursor:e.column.getCanSort()?"pointer":"default"},onMouseEnter:()=>{let t=document.querySelector(`[data-header-id="${e.id}"] .resizer`);t&&(t.style.opacity="0.5")},onMouseLeave:()=>{let t=document.querySelector(`[data-header-id="${e.id}"] .resizer`);t&&!e.column.getIsResizing()&&(t.style.opacity="0")},onClick:e.column.getCanSort()?e.column.getToggleSortingHandler():void 0,children:(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,t.jsx)("div",{className:"flex items-center",children:e.isPlaceholder?null:(0,y.flexRender)(e.column.columnDef.header,e.getContext())}),"actions"!==e.id&&e.column.getCanSort()&&(0,t.jsx)("div",{className:"w-4",children:e.column.getIsSorted()?({asc:(0,t.jsx)(f.ChevronUpIcon,{className:"h-4 w-4 text-blue-500"}),desc:(0,t.jsx)(x.ChevronDownIcon,{className:"h-4 w-4 text-blue-500"})})[e.column.getIsSorted()]:(0,t.jsx)(b.SwitchVerticalIcon,{className:"h-4 w-4 text-gray-400"})}),(0,t.jsx)("div",{onDoubleClick:()=>e.column.resetSize(),onMouseDown:e.getResizeHandler(),onTouchStart:e.getResizeHandler(),className:`resizer ${en.options.columnResizeDirection} ${e.column.getIsResizing()?"isResizing":""}`,style:{position:"absolute",right:0,top:0,height:"100%",width:"5px",background:e.column.getIsResizing()?"#3b82f6":"transparent",cursor:"col-resize",userSelect:"none",touchAction:"none",opacity:+!!e.column.getIsResizing()}})]})},e.id))},e.id))}),(0,t.jsx)(k.TableBody,{children:K||G?(0,t.jsx)(I.TableRow,{children:(0,t.jsx)(C.TableCell,{colSpan:er.length,className:"h-8 text-center",children:(0,t.jsx)("div",{className:"text-center text-gray-500",children:(0,t.jsx)("p",{children:"🚅 Loading keys..."})})})}):X.length>0?en.getRowModel().rows.map(e=>(0,t.jsx)(I.TableRow,{className:"h-8",children:e.getVisibleCells().map(e=>(0,t.jsx)(C.TableCell,{style:{width:e.column.getSize(),maxWidth:"8-x",whiteSpace:"pre-wrap",overflow:"hidden"},className:`py-0.5 max-h-8 overflow-hidden text-ellipsis whitespace-nowrap ${"models"===e.column.id&&Array.isArray(e.getValue())&&e.getValue().length>3?"px-0":""}`,children:(0,y.flexRender)(e.column.columnDef.cell,e.getContext())},e.id))},e.id)):(0,t.jsx)(I.TableRow,{children:(0,t.jsx)(C.TableCell,{colSpan:er.length,className:"h-8 text-center",children:(0,t.jsx)("div",{className:"text-center text-gray-500",children:(0,t.jsx)("p",{children:"No keys found"})})})})})]})})})})]})})}e.s(["default",0,({userID:e,userRole:h,teams:g,keys:x,setUserRole:p,userEmail:f,setUserEmail:b,setTeams:y,setKeys:j,premiumUser:v,organizations:w,addKey:_,createClicked:N})=>{let k,[C,S]=(0,o.useState)(null),[T,I]=(0,o.useState)(null),E=(0,n.useSearchParams)(),A=(console.log("COOKIES",document.cookie),(k=document.cookie.split("; ").find(e=>e.startsWith("token=")))?k.split("=")[1]:null),D=E.get("invitation_id"),[M,P]=(0,o.useState)(null),[B,O]=(0,o.useState)(null),[R,L]=(0,o.useState)([]),[F,z]=(0,o.useState)(null),[H,$]=(0,o.useState)(null);if((0,o.useEffect)(()=>{let e=()=>{sessionStorage.clear()};return window.addEventListener("beforeunload",e),()=>window.removeEventListener("beforeunload",e)},[]),(0,o.useEffect)(()=>{if(A){let e=(0,i.jwtDecode)(A);if(e){if(console.log("Decoded token:",e),console.log("Decoded key:",e.key),P(e.key),e.user_role){let t=function(e){if(!e)return"Undefined Role";switch(console.log(`Received user role: ${e}`),e.toLowerCase()){case"app_owner":case"demo_app_owner":return"App Owner";case"app_admin":case"proxy_admin":return"Admin";case"proxy_admin_viewer":return"Admin Viewer";case"app_user":return"App User";case"internal_user":return"Internal User";case"internal_user_viewer":return"Internal Viewer";default:return"Unknown Role"}}(e.user_role);console.log("Decoded user_role:",t),p(t)}else console.log("User role not defined");e.user_email?b(e.user_email):console.log(`User Email is not set ${e}`)}}if(e&&M&&h&&!x&&!C){let t=sessionStorage.getItem("userModels"+e);t?L(JSON.parse(t)):(console.log(`currentOrg: ${JSON.stringify(T)}`),(async()=>{try{let t=await (0,u.getProxyUISettings)(M);z(t);let l=await (0,u.userInfoCall)(M,e,h,!1,null,null);S(l.user_info),console.log(`userSpendData: ${JSON.stringify(C)}`),l?.teams[0].keys?j(l.keys.concat(l.teams.filter(t=>"Admin"===h||t.user_id===e).flatMap(e=>e.keys))):j(l.keys),sessionStorage.setItem("userData"+e,JSON.stringify(l.keys)),sessionStorage.setItem("userSpendData"+e,JSON.stringify(l.user_info));let a=(await (0,u.modelAvailableCall)(M,e,h)).data.map(e=>e.id);console.log("available_model_names:",a),L(a),console.log("userModels:",R),sessionStorage.setItem("userModels"+e,JSON.stringify(a))}catch(e){console.error("There was an error fetching the data",e),e.message.includes("Invalid proxy server token passed")&&U()}})(),(0,d.fetchTeams)(M,e,h,T,y))}},[e,A,M,x,h]),(0,o.useEffect)(()=>{M&&(async()=>{try{let e=await (0,u.keyInfoCall)(M,[M]);console.log("keyInfo: ",e)}catch(e){e.message.includes("Invalid proxy server token passed")&&U()}})()},[M]),(0,o.useEffect)(()=>{console.log(`currentOrg: ${JSON.stringify(T)}, accessToken: ${M}, userID: ${e}, userRole: ${h}`),M&&(console.log("fetching teams"),(0,d.fetchTeams)(M,e,h,T,y))},[T]),(0,o.useEffect)(()=>{if(null!==x&&null!=H&&null!==H.team_id){let e=0;for(let t of(console.log(`keys: ${JSON.stringify(x)}`),x))H.hasOwnProperty("team_id")&&null!==t.team_id&&t.team_id===H.team_id&&(e+=t.spend);console.log(`sum: ${e}`),O(e)}else if(null!==x){let e=0;for(let t of x)e+=t.spend;O(e)}},[H]),null!=D)return(0,t.jsx)(c.default,{});function U(){(0,l.clearTokenCookies)();let e=(0,u.getProxyBaseUrl)();console.log("proxyBaseUrl:",e);let t=e?`${e}/sso/key/generate`:"/sso/key/generate";return console.log("Full URL:",t),window.location.href=t,null}if(null==A)return console.log("All cookies before redirect:",document.cookie),U(),null;try{let e=(0,i.jwtDecode)(A);console.log("Decoded token:",e);let t=e.exp,l=Math.floor(Date.now()/1e3);if(t&&l>=t)return console.log("Token expired, redirecting to login"),U(),null}catch(e){return console.error("Error decoding token:",e),(0,l.clearTokenCookies)(),U(),null}if(null==M)return null;if(null==e)return(0,t.jsx)("h1",{children:"User ID is not set"});if(null==h&&p("App Owner"),h&&"Admin Viewer"==h){let{Title:e,Paragraph:l}=r.Typography;return(0,t.jsxs)("div",{children:[(0,t.jsx)(e,{level:1,children:"Access Denied"}),(0,t.jsx)(l,{children:"Ask your proxy admin for access to create keys"})]})}return console.log("inside user dashboard, selected team",H),console.log("All cookies after redirect:",document.cookie),(0,t.jsx)("div",{className:"w-full mx-4 h-[75vh]",children:(0,t.jsx)(s.Grid,{numItems:1,className:"gap-2 p-8 w-full mt-2",children:(0,t.jsxs)(a.Col,{numColSpan:1,className:"flex flex-col gap-2",children:[(0,t.jsx)(m.default,{team:H,teams:g,data:x,addKey:_},H?H.team_id:null),(0,t.jsx)(V,{teams:g,organizations:w})]})})})}],693569)},559061,e=>{"use strict";var t=e.i(843476),l=e.i(584935),a=e.i(304967),s=e.i(309426),r=e.i(350967),i=e.i(752978),n=e.i(621642),o=e.i(25080),c=e.i(37091),d=e.i(197647),u=e.i(653824),m=e.i(881073),h=e.i(404206),g=e.i(723731),x=e.i(599724),p=e.i(271645),f=e.i(727749),b=e.i(144267),y=e.i(278587),j=e.i(764205),v=e.i(994388),w=e.i(220508),_=e.i(964306);let N=p.forwardRef(function(e,t){return p.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),p.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"}))}),k=({responseTimeMs:e})=>null==e?null:(0,t.jsxs)("div",{className:"flex items-center space-x-1 text-xs text-gray-500 font-mono",children:[(0,t.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,t.jsx)("path",{d:"M12 6V12L16 14M12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),(0,t.jsxs)("span",{children:[e.toFixed(0),"ms"]})]}),C=e=>{let t=e;if("string"==typeof t)try{t=JSON.parse(t)}catch{}return t},S=({label:e,value:l})=>{let[a,s]=p.default.useState(!1),[r,i]=p.default.useState(!1),n=l?.toString()||"N/A",o=n.length>50?n.substring(0,50)+"...":n;return(0,t.jsx)("tr",{className:"hover:bg-gray-50",children:(0,t.jsx)("td",{className:"px-4 py-2 align-top",colSpan:2,children:(0,t.jsxs)("div",{className:"flex items-center justify-between group",children:[(0,t.jsxs)("div",{className:"flex items-center flex-1",children:[(0,t.jsx)("button",{onClick:()=>s(!a),className:"text-gray-400 hover:text-gray-600 mr-2",children:a?"▼":"▶"}),(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"text-sm text-gray-600",children:e}),(0,t.jsx)("pre",{className:"mt-1 text-sm font-mono text-gray-800 whitespace-pre-wrap",children:a?n:o})]})]}),(0,t.jsx)("button",{onClick:()=>{navigator.clipboard.writeText(n),i(!0),setTimeout(()=>i(!1),2e3)},className:"opacity-0 group-hover:opacity-100 text-gray-400 hover:text-gray-600",children:(0,t.jsx)(N,{className:"h-4 w-4"})})]})})})},T=({response:e})=>{let l=null,a={},s={};try{if(e?.error)try{let t="string"==typeof e.error.message?JSON.parse(e.error.message):e.error.message;l={message:t?.message||"Unknown error",traceback:t?.traceback||"No traceback available",litellm_params:t?.litellm_cache_params||{},health_check_cache_params:t?.health_check_cache_params||{}},a=C(l.litellm_params)||{},s=C(l.health_check_cache_params)||{}}catch(t){console.warn("Error parsing error details:",t),l={message:String(e.error.message||"Unknown error"),traceback:"Error parsing details",litellm_params:{},health_check_cache_params:{}}}else a=C(e?.litellm_cache_params)||{},s=C(e?.health_check_cache_params)||{}}catch(e){console.warn("Error in response parsing:",e),a={},s={}}let r={redis_host:s?.redis_client?.connection_pool?.connection_kwargs?.host||s?.redis_async_client?.connection_pool?.connection_kwargs?.host||s?.connection_kwargs?.host||s?.host||"N/A",redis_port:s?.redis_client?.connection_pool?.connection_kwargs?.port||s?.redis_async_client?.connection_pool?.connection_kwargs?.port||s?.connection_kwargs?.port||s?.port||"N/A",redis_version:s?.redis_version||"N/A",startup_nodes:(()=>{try{if(s?.redis_kwargs?.startup_nodes)return JSON.stringify(s.redis_kwargs.startup_nodes);let e=s?.redis_client?.connection_pool?.connection_kwargs?.host||s?.redis_async_client?.connection_pool?.connection_kwargs?.host,t=s?.redis_client?.connection_pool?.connection_kwargs?.port||s?.redis_async_client?.connection_pool?.connection_kwargs?.port;return e&&t?JSON.stringify([{host:e,port:t}]):"N/A"}catch(e){return"N/A"}})(),namespace:s?.namespace||"N/A"};return(0,t.jsx)("div",{className:"bg-white rounded-lg shadow",children:(0,t.jsxs)(u.TabGroup,{children:[(0,t.jsxs)(m.TabList,{className:"border-b border-gray-200 px-4",children:[(0,t.jsx)(d.Tab,{className:"px-4 py-2 text-sm font-medium text-gray-600 hover:text-gray-800",children:"Summary"}),(0,t.jsx)(d.Tab,{className:"px-4 py-2 text-sm font-medium text-gray-600 hover:text-gray-800",children:"Raw Response"})]}),(0,t.jsxs)(g.TabPanels,{children:[(0,t.jsx)(h.TabPanel,{className:"p-4",children:(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center mb-6",children:[e?.status==="healthy"?(0,t.jsx)(w.CheckCircleIcon,{className:"h-5 w-5 text-green-500 mr-2"}):(0,t.jsx)(_.XCircleIcon,{className:"h-5 w-5 text-red-500 mr-2"}),(0,t.jsxs)(x.Text,{className:`text-sm font-medium ${e?.status==="healthy"?"text-green-500":"text-red-500"}`,children:["Cache Status: ",e?.status||"unhealthy"]})]}),(0,t.jsx)("table",{className:"w-full border-collapse",children:(0,t.jsxs)("tbody",{children:[l&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("tr",{children:(0,t.jsx)("td",{colSpan:2,className:"pt-4 pb-2 font-semibold text-red-600",children:"Error Details"})}),(0,t.jsx)(S,{label:"Error Message",value:l.message}),(0,t.jsx)(S,{label:"Traceback",value:l.traceback})]}),(0,t.jsx)("tr",{children:(0,t.jsx)("td",{colSpan:2,className:"pt-4 pb-2 font-semibold",children:"Cache Details"})}),(0,t.jsx)(S,{label:"Cache Configuration",value:String(a?.type)}),(0,t.jsx)(S,{label:"Ping Response",value:String(e.ping_response)}),(0,t.jsx)(S,{label:"Set Cache Response",value:e.set_cache_response||"N/A"}),(0,t.jsx)(S,{label:"litellm_settings.cache_params",value:JSON.stringify(a,null,2)}),a?.type==="redis"&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("tr",{children:(0,t.jsx)("td",{colSpan:2,className:"pt-4 pb-2 font-semibold",children:"Redis Details"})}),(0,t.jsx)(S,{label:"Redis Host",value:r.redis_host||"N/A"}),(0,t.jsx)(S,{label:"Redis Port",value:r.redis_port||"N/A"}),(0,t.jsx)(S,{label:"Redis Version",value:r.redis_version||"N/A"}),(0,t.jsx)(S,{label:"Startup Nodes",value:r.startup_nodes||"N/A"}),(0,t.jsx)(S,{label:"Namespace",value:r.namespace||"N/A"})]})]})})]})}),(0,t.jsx)(h.TabPanel,{className:"p-4",children:(0,t.jsx)("div",{className:"bg-gray-50 rounded-md p-4 font-mono text-sm",children:(0,t.jsx)("pre",{className:"whitespace-pre-wrap break-words overflow-auto max-h-[500px]",children:(()=>{try{let t={...e,litellm_cache_params:a,health_check_cache_params:s},l=JSON.parse(JSON.stringify(t,(e,t)=>{if("string"==typeof t)try{return JSON.parse(t)}catch{}return t}));return JSON.stringify(l,null,2)}catch(e){return"Error formatting JSON: "+e.message}})()})})})]})]})})},I=({accessToken:e,healthCheckResponse:l,runCachingHealthCheck:a,responseTimeMs:s})=>{let[r,i]=p.default.useState(null),[n,o]=p.default.useState(!1),c=async()=>{o(!0);let e=performance.now();await a(),i(performance.now()-e),o(!1)};return(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)(v.Button,{onClick:c,disabled:n,className:"bg-indigo-600 hover:bg-indigo-700 disabled:bg-indigo-400 text-white text-sm px-4 py-2 rounded-md",children:n?"Running Health Check...":"Run Health Check"}),(0,t.jsx)(k,{responseTimeMs:r})]}),l&&(0,t.jsx)(T,{response:l})]})};var E=e.i(677667),A=e.i(898667),D=e.i(130643),M=e.i(206929),P=e.i(35983);let B=({redisType:e,redisTypeDescriptions:l,onTypeChange:a})=>(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Redis Type"}),(0,t.jsxs)(M.Select,{value:e,onValueChange:a,children:[(0,t.jsx)(P.SelectItem,{value:"node",children:"Node (Single Instance)"}),(0,t.jsx)(P.SelectItem,{value:"cluster",children:"Cluster"}),(0,t.jsx)(P.SelectItem,{value:"sentinel",children:"Sentinel"}),(0,t.jsx)(P.SelectItem,{value:"semantic",children:"Semantic"})]}),(0,t.jsx)("p",{className:"text-xs text-gray-500",children:l[e]||"Select the type of Redis deployment you're using"})]});var O=e.i(135214),R=e.i(620250),L=e.i(779241),F=e.i(199133),z=e.i(689020),H=e.i(435451);let $=({field:e,currentValue:l})=>{let[a,s]=(0,p.useState)([]),[r,i]=(0,p.useState)(l||""),{accessToken:n}=(0,O.default)();if((0,p.useEffect)(()=>{n&&(async()=>{try{let e=await (0,z.fetchAvailableModels)(n);console.log("Fetched models for selector:",e),e.length>0&&s(e)}catch(e){console.error("Error fetching model info:",e)}})()},[n]),"Boolean"===e.field_type)return(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-sm font-medium text-gray-700",children:e.ui_field_name}),(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("input",{type:"checkbox",name:e.field_name,defaultChecked:!0===l||"true"===l,className:"h-4 w-4 text-indigo-600 focus:ring-indigo-500 border-gray-300 rounded"}),(0,t.jsx)("span",{className:"ml-2 text-sm text-gray-500",children:e.field_description})]})]});if("Integer"===e.field_type||"Float"===e.field_type)return(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-sm font-medium text-gray-700",children:e.ui_field_name}),(0,t.jsx)(H.default,{name:e.field_name,type:"number",defaultValue:l,placeholder:e.field_description}),(0,t.jsx)("p",{className:"text-xs text-gray-500",children:e.field_description})]});if("List"===e.field_type)return(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-sm font-medium text-gray-700",children:e.ui_field_name}),(0,t.jsx)("textarea",{name:e.field_name,defaultValue:"object"==typeof l?JSON.stringify(l,null,2):l,placeholder:e.field_description,className:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500",rows:4}),(0,t.jsx)("p",{className:"text-xs text-gray-500",children:e.field_description})]});if("Models_Select"===e.field_type){let l=a.filter(e=>"embedding"===e.mode).map(e=>({value:e.model_group,label:e.model_group}));return(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-sm font-medium text-gray-700",children:e.ui_field_name}),(0,t.jsx)(F.Select,{value:r,onChange:i,showSearch:!0,placeholder:"Search and select a model...",options:l,style:{width:"100%"},className:"rounded-md",filterOption:(e,t)=>(t?.label??"").toLowerCase().includes(e.toLowerCase())}),(0,t.jsx)("input",{type:"hidden",name:e.field_name,value:r}),e.field_description&&(0,t.jsx)("p",{className:"text-xs text-gray-500",children:e.field_description})]})}if("Integer"===e.field_type||"Float"===e.field_type)return(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-sm font-medium text-gray-700",children:e.ui_field_name}),(0,t.jsx)(R.NumberInput,{name:e.field_name,defaultValue:l,placeholder:e.field_description,step:"Float"===e.field_type?.01:1}),e.field_description&&(0,t.jsx)("p",{className:"text-xs text-gray-500",children:e.field_description})]});let o="password"===e.field_name||e.field_name.includes("password")?"password":"text";return(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-sm font-medium text-gray-700",children:e.ui_field_name}),(0,t.jsx)(L.TextInput,{name:e.field_name,type:o,defaultValue:l,placeholder:e.field_description}),e.field_description&&(0,t.jsx)("p",{className:"text-xs text-gray-500",children:e.field_description})]})},V=(e,t)=>e.find(e=>e.field_name===t),U=(e,t)=>{let l={type:"redis"};return e.forEach(e=>{if("redis_type"===e.field_name||null!==e.redis_type&&void 0!==e.redis_type&&e.redis_type!==t)return;let a=e.field_name,s=null;if("Boolean"===e.field_type){let e=document.querySelector(`input[name="${a}"]`);e?.checked!==void 0&&(s=e.checked)}else if("List"===e.field_type){let e=document.querySelector(`textarea[name="${a}"]`);if(e?.value)try{s=JSON.parse(e.value)}catch(e){console.error(`Invalid JSON for ${a}:`,e)}}else{let t=document.querySelector(`input[name="${a}"]`);if(t?.value){let l=t.value.trim();if(""!==l)if("Integer"===e.field_type){let e=Number(l);isNaN(e)||(s=e)}else if("Float"===e.field_type){let e=Number(l);isNaN(e)||(s=e)}else s=l}}null!=s&&(l[a]=s)}),l},q=({accessToken:e,userRole:l,userID:a})=>{let s,r,i,n,o,[c,d]=(0,p.useState)({}),[u,m]=(0,p.useState)([]),[h,g]=(0,p.useState)({}),[x,b]=(0,p.useState)("node"),[y,w]=(0,p.useState)(!1),[_,N]=(0,p.useState)(!1),k=(0,p.useCallback)(async()=>{try{let t=await (0,j.getCacheSettingsCall)(e);console.log("cache settings from API",t),t.fields&&m(t.fields),t.current_values&&(d(t.current_values),t.current_values.redis_type&&b(t.current_values.redis_type)),t.redis_type_descriptions&&g(t.redis_type_descriptions)}catch(e){console.error("Failed to load cache settings:",e),f.default.fromBackend("Failed to load cache settings")}},[e]);(0,p.useEffect)(()=>{e&&k()},[e,k]);let C=async()=>{if(e){w(!0);try{let t=U(u,x),l=await (0,j.testCacheConnectionCall)(e,t);"success"===l.status?f.default.success("Cache connection test successful!"):f.default.fromBackend(`Connection test failed: ${l.message||l.error}`)}catch(e){console.error("Test connection error:",e),f.default.fromBackend(`Connection test failed: ${e.message||"Unknown error"}`)}finally{w(!1)}}},S=async()=>{if(e){N(!0);try{let t=U(u,x);"semantic"===x&&(t.type="redis-semantic"),await (0,j.updateCacheSettingsCall)(e,t),f.default.success("Cache settings updated successfully"),await k()}catch(e){console.error("Failed to save cache settings:",e),f.default.fromBackend("Failed to update cache settings")}finally{N(!1)}}};if(!e)return null;let{basicFields:T,sslFields:I,cacheManagementFields:M,gcpFields:P,clusterFields:O,sentinelFields:R,semanticFields:L}=(s=["host","port","password","username"].map(e=>V(u,e)).filter(Boolean),r=["ssl","ssl_cert_reqs","ssl_check_hostname"].map(e=>V(u,e)).filter(Boolean),i=["namespace","ttl","max_connections"].map(e=>V(u,e)).filter(Boolean),n=["gcp_service_account","gcp_ssl_ca_certs"].map(e=>V(u,e)).filter(Boolean),o=u.filter(e=>"cluster"===e.redis_type),{basicFields:s,sslFields:r,cacheManagementFields:i,gcpFields:n,clusterFields:o,sentinelFields:u.filter(e=>"sentinel"===e.redis_type),semanticFields:u.filter(e=>"semantic"===e.redis_type)});return(0,t.jsxs)("div",{className:"w-full space-y-8 py-2",children:[(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"max-w-3xl",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Cache Settings"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Configure Redis cache for LiteLLM"})]}),(0,t.jsx)(B,{redisType:x,redisTypeDescriptions:h,onTypeChange:b}),(0,t.jsxs)("div",{className:"space-y-6 pt-4 border-t border-gray-200",children:[(0,t.jsx)("h4",{className:"text-sm font-medium text-gray-900",children:"Connection Settings"}),(0,t.jsx)("div",{className:"grid grid-cols-1 gap-6 sm:grid-cols-2",children:T.map(e=>{if(!e)return null;let l=c[e.field_name]??e.field_default??"";return(0,t.jsx)($,{field:e,currentValue:l},e.field_name)})})]}),"cluster"===x&&O.length>0&&(0,t.jsxs)("div",{className:"space-y-6 pt-4 border-t border-gray-200",children:[(0,t.jsx)("h4",{className:"text-sm font-medium text-gray-900",children:"Cluster Configuration"}),(0,t.jsx)("div",{className:"grid grid-cols-1 gap-6",children:O.map(e=>{let l=c[e.field_name]??e.field_default??"";return(0,t.jsx)($,{field:e,currentValue:l},e.field_name)})})]}),"sentinel"===x&&R.length>0&&(0,t.jsxs)("div",{className:"space-y-6 pt-4 border-t border-gray-200",children:[(0,t.jsx)("h4",{className:"text-sm font-medium text-gray-900",children:"Sentinel Configuration"}),(0,t.jsx)("div",{className:"grid grid-cols-1 gap-6 sm:grid-cols-2",children:R.map(e=>{let l=c[e.field_name]??e.field_default??"";return(0,t.jsx)($,{field:e,currentValue:l},e.field_name)})})]}),"semantic"===x&&L.length>0&&(0,t.jsxs)("div",{className:"space-y-6 pt-4 border-t border-gray-200",children:[(0,t.jsx)("h4",{className:"text-sm font-medium text-gray-900",children:"Semantic Configuration"}),(0,t.jsx)("div",{className:"grid grid-cols-1 gap-6 sm:grid-cols-2",children:L.map(e=>{let l=c[e.field_name]??e.field_default??"";return(0,t.jsx)($,{field:e,currentValue:l},e.field_name)})})]}),(0,t.jsxs)(E.Accordion,{className:"mt-4",children:[(0,t.jsx)(A.AccordionHeader,{children:(0,t.jsx)("span",{className:"text-sm font-medium text-gray-900",children:"Advanced Settings"})}),(0,t.jsx)(D.AccordionBody,{children:(0,t.jsxs)("div",{className:"space-y-6",children:[I.length>0&&(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)("h5",{className:"text-sm font-medium text-gray-700",children:"SSL Settings"}),(0,t.jsx)("div",{className:"grid grid-cols-1 gap-6 sm:grid-cols-2",children:I.map(e=>{if(!e)return null;let l=c[e.field_name]??e.field_default??"";return(0,t.jsx)($,{field:e,currentValue:l},e.field_name)})})]}),M.length>0&&(0,t.jsxs)("div",{className:"space-y-4 pt-4 border-t border-gray-200",children:[(0,t.jsx)("h5",{className:"text-sm font-medium text-gray-700",children:"Cache Management"}),(0,t.jsx)("div",{className:"grid grid-cols-1 gap-6 sm:grid-cols-2",children:M.map(e=>{if(!e)return null;let l=c[e.field_name]??e.field_default??"";return(0,t.jsx)($,{field:e,currentValue:l},e.field_name)})})]}),P.length>0&&(0,t.jsxs)("div",{className:"space-y-4 pt-4 border-t border-gray-200",children:[(0,t.jsx)("h5",{className:"text-sm font-medium text-gray-700",children:"GCP Authentication"}),(0,t.jsx)("div",{className:"grid grid-cols-1 gap-6 sm:grid-cols-2",children:P.map(e=>{if(!e)return null;let l=c[e.field_name]??e.field_default??"";return(0,t.jsx)($,{field:e,currentValue:l},e.field_name)})})]})]})})]})]}),(0,t.jsxs)("div",{className:"border-t border-gray-200 pt-6 flex justify-end gap-3",children:[(0,t.jsx)(v.Button,{variant:"secondary",size:"sm",onClick:C,disabled:y,className:"text-sm",children:y?"Testing...":"Test Connection"}),(0,t.jsx)(v.Button,{size:"sm",onClick:S,disabled:_,className:"text-sm font-medium",children:_?"Saving...":"Save Changes"})]})]})},K=e=>{if(e)return e.toISOString().split("T")[0]};function G(e){return new Intl.NumberFormat("en-US",{maximumFractionDigits:0,notation:"compact",compactDisplay:"short"}).format(e)}e.s(["default",0,({accessToken:e,token:v,userRole:w,userID:_,premiumUser:N})=>{let[k,C]=(0,p.useState)([]),[S,T]=(0,p.useState)([]),[E,A]=(0,p.useState)([]),[D,M]=(0,p.useState)([]),[P,B]=(0,p.useState)("0"),[O,R]=(0,p.useState)("0"),[L,F]=(0,p.useState)("0"),[z,H]=(0,p.useState)({from:new Date(Date.now()-6048e5),to:new Date}),[$,V]=(0,p.useState)(""),[U,W]=(0,p.useState)("");(0,p.useEffect)(()=>{e&&z&&((async()=>{M(await (0,j.adminGlobalCacheActivity)(e,K(z.from),K(z.to)))})(),V(new Date().toLocaleString()))},[e]);let J=Array.from(new Set(D.map(e=>e?.api_key??""))),Y=Array.from(new Set(D.map(e=>e?.model??"")));Array.from(new Set(D.map(e=>e?.call_type??"")));let Q=async(t,l)=>{t&&l&&e&&M(await (0,j.adminGlobalCacheActivity)(e,K(t),K(l)))};(0,p.useEffect)(()=>{console.log("DATA IN CACHE DASHBOARD",D);let e=D;S.length>0&&(e=e.filter(e=>S.includes(e.api_key))),E.length>0&&(e=e.filter(e=>E.includes(e.model))),console.log("before processed data in cache dashboard",e);let t=0,l=0,a=0,s=e.reduce((e,s)=>{console.log("Processing item:",s),s.call_type||(console.log("Item has no call_type:",s),s.call_type="Unknown"),t+=(s.total_rows||0)-(s.cache_hit_true_rows||0),l+=s.cache_hit_true_rows||0,a+=s.cached_completion_tokens||0;let r=e.find(e=>e.name===s.call_type);return r?(r["LLM API requests"]+=(s.total_rows||0)-(s.cache_hit_true_rows||0),r["Cache hit"]+=s.cache_hit_true_rows||0,r["Cached Completion Tokens"]+=s.cached_completion_tokens||0,r["Generated Completion Tokens"]+=s.generated_completion_tokens||0):e.push({name:s.call_type,"LLM API requests":(s.total_rows||0)-(s.cache_hit_true_rows||0),"Cache hit":s.cache_hit_true_rows||0,"Cached Completion Tokens":s.cached_completion_tokens||0,"Generated Completion Tokens":s.generated_completion_tokens||0}),e},[]);B(G(l)),R(G(a));let r=l+t;r>0?F((l/r*100).toFixed(2)):F("0"),C(s),console.log("PROCESSED DATA IN CACHE DASHBOARD",s)},[S,E,z,D]);let X=async()=>{try{f.default.info("Running cache health check..."),W("");let t=await (0,j.cachingHealthCheckCall)(null!==e?e:"");console.log("CACHING HEALTH CHECK RESPONSE",t),W(t)}catch(t){let e;if(console.error("Error running health check:",t),t&&t.message)try{let l=JSON.parse(t.message);l.error&&(l=l.error),e=l}catch(l){e={message:t.message}}else e={message:"Unknown error occurred"};W({error:e})}};return(0,t.jsxs)(u.TabGroup,{className:"gap-2 p-8 h-full w-full mt-2 mb-8",children:[(0,t.jsxs)(m.TabList,{className:"flex justify-between mt-2 w-full items-center",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)(d.Tab,{children:"Cache Analytics"}),(0,t.jsx)(d.Tab,{children:"Cache Health"}),(0,t.jsx)(d.Tab,{children:"Cache Settings"})]}),(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[$&&(0,t.jsxs)(x.Text,{children:["Last Refreshed: ",$]}),(0,t.jsx)(i.Icon,{icon:y.RefreshIcon,variant:"shadow",size:"xs",className:"self-center",onClick:()=>{V(new Date().toLocaleString())}})]})]}),(0,t.jsxs)(g.TabPanels,{children:[(0,t.jsx)(h.TabPanel,{children:(0,t.jsxs)(a.Card,{children:[(0,t.jsxs)(r.Grid,{numItems:3,className:"gap-4 mt-4",children:[(0,t.jsx)(s.Col,{children:(0,t.jsx)(n.MultiSelect,{placeholder:"Select Virtual Keys",value:S,onValueChange:T,children:J.map(e=>(0,t.jsx)(o.MultiSelectItem,{value:e,children:e},e))})}),(0,t.jsx)(s.Col,{children:(0,t.jsx)(n.MultiSelect,{placeholder:"Select Models",value:E,onValueChange:A,children:Y.map(e=>(0,t.jsx)(o.MultiSelectItem,{value:e,children:e},e))})}),(0,t.jsx)(s.Col,{children:(0,t.jsx)(b.default,{value:z,onValueChange:e=>{H(e),Q(e.from,e.to)}})})]}),(0,t.jsxs)("div",{className:"grid grid-cols-1 gap-6 sm:grid-cols-2 lg:grid-cols-3 mt-4",children:[(0,t.jsxs)(a.Card,{children:[(0,t.jsx)("p",{className:"text-tremor-default font-medium text-tremor-content dark:text-dark-tremor-content",children:"Cache Hit Ratio"}),(0,t.jsx)("div",{className:"mt-2 flex items-baseline space-x-2.5",children:(0,t.jsxs)("p",{className:"text-tremor-metric font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:[L,"%"]})})]}),(0,t.jsxs)(a.Card,{children:[(0,t.jsx)("p",{className:"text-tremor-default font-medium text-tremor-content dark:text-dark-tremor-content",children:"Cache Hits"}),(0,t.jsx)("div",{className:"mt-2 flex items-baseline space-x-2.5",children:(0,t.jsx)("p",{className:"text-tremor-metric font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:P})})]}),(0,t.jsxs)(a.Card,{children:[(0,t.jsx)("p",{className:"text-tremor-default font-medium text-tremor-content dark:text-dark-tremor-content",children:"Cached Tokens"}),(0,t.jsx)("div",{className:"mt-2 flex items-baseline space-x-2.5",children:(0,t.jsx)("p",{className:"text-tremor-metric font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:O})})]})]}),(0,t.jsx)(c.Subtitle,{className:"mt-4",children:"Cache Hits vs API Requests"}),(0,t.jsx)(l.BarChart,{title:"Cache Hits vs API Requests",data:k,stack:!0,index:"name",valueFormatter:G,categories:["LLM API requests","Cache hit"],colors:["sky","teal"],yAxisWidth:48}),(0,t.jsx)(c.Subtitle,{className:"mt-4",children:"Cached Completion Tokens vs Generated Completion Tokens"}),(0,t.jsx)(l.BarChart,{className:"mt-6",data:k,stack:!0,index:"name",valueFormatter:G,categories:["Generated Completion Tokens","Cached Completion Tokens"],colors:["sky","teal"],yAxisWidth:48})]})}),(0,t.jsx)(h.TabPanel,{children:(0,t.jsx)(I,{accessToken:e,healthCheckResponse:U,runCachingHealthCheck:X})}),(0,t.jsx)(h.TabPanel,{children:(0,t.jsx)(q,{accessToken:e,userRole:w,userID:_})})]})]})}],559061)},601236,e=>{e.v(e=>Promise.resolve().then(()=>e(764205)))}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/1422c542f7b74d5e.js b/litellm/proxy/_experimental/out/_next/static/chunks/1422c542f7b74d5e.js deleted file mode 100644 index b0a21845070..00000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/1422c542f7b74d5e.js +++ /dev/null @@ -1 +0,0 @@ -(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,916925,e=>{"use strict";var t,a=((t={}).A2A_Agent="A2A Agent",t.AIML="AI/ML API",t.Bedrock="Amazon Bedrock",t.Anthropic="Anthropic",t.AssemblyAI="AssemblyAI",t.SageMaker="AWS SageMaker",t.Azure="Azure",t.Azure_AI_Studio="Azure AI Foundry (Studio)",t.Cerebras="Cerebras",t.Cohere="Cohere",t.Dashscope="Dashscope",t.Databricks="Databricks (Qwen API)",t.DeepInfra="DeepInfra",t.Deepgram="Deepgram",t.Deepseek="Deepseek",t.ElevenLabs="ElevenLabs",t.FalAI="Fal AI",t.FireworksAI="Fireworks AI",t.Google_AI_Studio="Google AI Studio",t.GradientAI="GradientAI",t.Groq="Groq",t.Hosted_Vllm="vllm",t.Infinity="Infinity",t.JinaAI="Jina AI",t.MiniMax="MiniMax",t.MistralAI="Mistral AI",t.Ollama="Ollama",t.OpenAI="OpenAI",t.OpenAI_Compatible="OpenAI-Compatible Endpoints (Together AI, etc.)",t.OpenAI_Text="OpenAI Text Completion",t.OpenAI_Text_Compatible="OpenAI-Compatible Text Completion Models (Together AI, etc.)",t.Openrouter="Openrouter",t.Oracle="Oracle Cloud Infrastructure (OCI)",t.Perplexity="Perplexity",t.RunwayML="RunwayML",t.Sambanova="Sambanova",t.Snowflake="Snowflake",t.TogetherAI="TogetherAI",t.Triton="Triton",t.Vertex_AI="Vertex AI (Anthropic, Gemini, etc.)",t.VolcEngine="VolcEngine",t.Voyage="Voyage AI",t.xAI="xAI",t.SAP="SAP Generative AI Hub",t.Watsonx="Watsonx",t);let n={A2A_Agent:"a2a_agent",AIML:"aiml",OpenAI:"openai",OpenAI_Text:"text-completion-openai",Azure:"azure",Azure_AI_Studio:"azure_ai",Anthropic:"anthropic",Google_AI_Studio:"gemini",Bedrock:"bedrock",Groq:"groq",MiniMax:"minimax",MistralAI:"mistral",Cohere:"cohere",OpenAI_Compatible:"openai",OpenAI_Text_Compatible:"text-completion-openai",Vertex_AI:"vertex_ai",Databricks:"databricks",Dashscope:"dashscope",xAI:"xai",Deepseek:"deepseek",Ollama:"ollama",AssemblyAI:"assemblyai",Cerebras:"cerebras",Sambanova:"sambanova",Perplexity:"perplexity",RunwayML:"runwayml",TogetherAI:"together_ai",Openrouter:"openrouter",Oracle:"oci",Snowflake:"snowflake",FireworksAI:"fireworks_ai",GradientAI:"gradient_ai",Triton:"triton",Deepgram:"deepgram",ElevenLabs:"elevenlabs",FalAI:"fal_ai",SageMaker:"sagemaker_chat",Voyage:"voyage",JinaAI:"jina_ai",VolcEngine:"volcengine",DeepInfra:"deepinfra",Hosted_Vllm:"hosted_vllm",Infinity:"infinity",SAP:"sap",Watsonx:"watsonx"},o="../ui/assets/logos/",r={"A2A Agent":`${o}a2a_agent.png`,"AI/ML API":`${o}aiml_api.svg`,Anthropic:`${o}anthropic.svg`,AssemblyAI:`${o}assemblyai_small.png`,Azure:`${o}microsoft_azure.svg`,"Azure AI Foundry (Studio)":`${o}microsoft_azure.svg`,"Amazon Bedrock":`${o}bedrock.svg`,"AWS SageMaker":`${o}bedrock.svg`,Cerebras:`${o}cerebras.svg`,Cohere:`${o}cohere.svg`,"Databricks (Qwen API)":`${o}databricks.svg`,Dashscope:`${o}dashscope.svg`,Deepseek:`${o}deepseek.svg`,"Fireworks AI":`${o}fireworks.svg`,Groq:`${o}groq.svg`,"Google AI Studio":`${o}google.svg`,vllm:`${o}vllm.png`,Infinity:`${o}infinity.png`,MiniMax:`${o}minimax.svg`,"Mistral AI":`${o}mistral.svg`,Ollama:`${o}ollama.svg`,OpenAI:`${o}openai_small.svg`,"OpenAI Text Completion":`${o}openai_small.svg`,"OpenAI-Compatible Text Completion Models (Together AI, etc.)":`${o}openai_small.svg`,"OpenAI-Compatible Endpoints (Together AI, etc.)":`${o}openai_small.svg`,Openrouter:`${o}openrouter.svg`,"Oracle Cloud Infrastructure (OCI)":`${o}oracle.svg`,Perplexity:`${o}perplexity-ai.svg`,RunwayML:`${o}runwayml.png`,Sambanova:`${o}sambanova.svg`,Snowflake:`${o}snowflake.svg`,TogetherAI:`${o}togetherai.svg`,"Vertex AI (Anthropic, Gemini, etc.)":`${o}google.svg`,xAI:`${o}xai.svg`,GradientAI:`${o}gradientai.svg`,Triton:`${o}nvidia_triton.png`,Deepgram:`${o}deepgram.png`,ElevenLabs:`${o}elevenlabs.png`,"Fal AI":`${o}fal_ai.jpg`,"Voyage AI":`${o}voyage.webp`,"Jina AI":`${o}jina.png`,VolcEngine:`${o}volcengine.png`,DeepInfra:`${o}deepinfra.png`,"SAP Generative AI Hub":`${o}sap.png`};e.s(["Providers",()=>a,"getPlaceholder",0,e=>{if("AI/ML API"===e)return"aiml/flux-pro/v1.1";if("Vertex AI (Anthropic, Gemini, etc.)"===e)return"gemini-pro";if("Anthropic"==e)return"claude-3-opus";if("Amazon Bedrock"==e)return"claude-3-opus";if("AWS SageMaker"==e)return"sagemaker/jumpstart-dft-meta-textgeneration-llama-2-7b";else if("Google AI Studio"==e)return"gemini-pro";else if("Azure AI Foundry (Studio)"==e)return"azure_ai/command-r-plus";else if("Azure"==e)return"my-deployment";else if("Oracle Cloud Infrastructure (OCI)"==e)return"oci/xai.grok-4";else if("Snowflake"==e)return"snowflake/mistral-7b";else if("Voyage AI"==e)return"voyage/";else if("Jina AI"==e)return"jina_ai/";else if("VolcEngine"==e)return"volcengine/";else if("DeepInfra"==e)return"deepinfra/";else if("Fal AI"==e)return"fal_ai/fal-ai/flux-pro/v1.1-ultra";else if("RunwayML"==e)return"runwayml/gen4_turbo";else if("Watsonx"===e)return"watsonx/ibm/granite-3-3-8b-instruct";else return"gpt-3.5-turbo"},"getProviderLogoAndName",0,e=>{if(!e)return{logo:"",displayName:"-"};if("gemini"===e.toLowerCase()){let e="Google AI Studio";return{logo:r[e],displayName:e}}let t=Object.keys(n).find(t=>n[t].toLowerCase()===e.toLowerCase());if(!t)return{logo:"",displayName:e};let o=a[t];return{logo:r[o],displayName:o}},"getProviderModels",0,(e,t)=>{console.log(`Provider key: ${e}`);let a=n[e];console.log(`Provider mapped to: ${a}`);let o=[];return e&&"object"==typeof t&&(Object.entries(t).forEach(([e,t])=>{if(null!==t&&"object"==typeof t&&"litellm_provider"in t){let n=t.litellm_provider;(n===a||"string"==typeof n&&n.includes(a))&&o.push(e)}}),"Cohere"==e&&(console.log("Adding cohere chat models"),Object.entries(t).forEach(([e,t])=>{null!==t&&"object"==typeof t&&"litellm_provider"in t&&"cohere_chat"===t.litellm_provider&&o.push(e)})),"AWS SageMaker"==e&&(console.log("Adding sagemaker chat models"),Object.entries(t).forEach(([e,t])=>{null!==t&&"object"==typeof t&&"litellm_provider"in t&&"sagemaker_chat"===t.litellm_provider&&o.push(e)}))),o},"providerLogoMap",0,r,"provider_map",0,n])},94629,e=>{"use strict";var t=e.i(271645);let a=t.forwardRef(function(e,a){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:a},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7 16V4m0 0L3 8m4-4l4 4m6 0v12m0 0l4-4m-4 4l-4-4"}))});e.s(["SwitchVerticalIcon",0,a],94629)},166406,e=>{"use strict";var t=e.i(190144);e.s(["CopyOutlined",()=>t.default])},362024,e=>{"use strict";var t=e.i(988122);e.s(["Collapse",()=>t.default])},240647,e=>{"use strict";var t=e.i(286612);e.s(["RightOutlined",()=>t.default])},782273,793916,e=>{"use strict";e.i(247167);var t=e.i(931067),a=e.i(271645);let n={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M625.9 115c-5.9 0-11.9 1.6-17.4 5.3L254 352H90c-8.8 0-16 7.2-16 16v288c0 8.8 7.2 16 16 16h164l354.5 231.7c5.5 3.6 11.6 5.3 17.4 5.3 16.7 0 32.1-13.3 32.1-32.1V147.1c0-18.8-15.4-32.1-32.1-32.1zM586 803L293.4 611.7l-18-11.7H146V424h129.4l17.9-11.7L586 221v582zm348-327H806c-8.8 0-16 7.2-16 16v40c0 8.8 7.2 16 16 16h128c8.8 0 16-7.2 16-16v-40c0-8.8-7.2-16-16-16zm-41.9 261.8l-110.3-63.7a15.9 15.9 0 00-21.7 5.9l-19.9 34.5c-4.4 7.6-1.8 17.4 5.8 21.8L856.3 800a15.9 15.9 0 0021.7-5.9l19.9-34.5c4.4-7.6 1.7-17.4-5.8-21.8zM760 344a15.9 15.9 0 0021.7 5.9L892 286.2c7.6-4.4 10.2-14.2 5.8-21.8L878 230a15.9 15.9 0 00-21.7-5.9L746 287.8a15.99 15.99 0 00-5.8 21.8L760 344z"}}]},name:"sound",theme:"outlined"};var o=e.i(9583),r=a.forwardRef(function(e,r){return a.createElement(o.default,(0,t.default)({},e,{ref:r,icon:n}))});e.s(["SoundOutlined",0,r],782273);let l={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M842 454c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8 0 140.3-113.7 254-254 254S258 594.3 258 454c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8 0 168.7 126.6 307.9 290 327.6V884H326.7c-13.7 0-24.7 14.3-24.7 32v36c0 4.4 2.8 8 6.2 8h407.6c3.4 0 6.2-3.6 6.2-8v-36c0-17.7-11-32-24.7-32H548V782.1c165.3-18 294-158 294-328.1zM512 624c93.9 0 170-75.2 170-168V232c0-92.8-76.1-168-170-168s-170 75.2-170 168v224c0 92.8 76.1 168 170 168zm-94-392c0-50.6 41.9-92 94-92s94 41.4 94 92v224c0 50.6-41.9 92-94 92s-94-41.4-94-92V232z"}}]},name:"audio",theme:"outlined"};var i=a.forwardRef(function(e,n){return a.createElement(o.default,(0,t.default)({},e,{ref:n,icon:l}))});e.s(["AudioOutlined",0,i],793916)},149192,e=>{"use strict";var t=e.i(864517);e.s(["CloseOutlined",()=>t.default])},608856,e=>{"use strict";e.i(247167);var t=e.i(271645),a=e.i(343794),n=e.i(209428),o=e.i(392221),r=e.i(951160),l=e.i(174428),i=t.createContext(null),s=t.createContext({}),c=e.i(211577),u=e.i(931067),d=e.i(361275),p=e.i(404948),f=e.i(244009),m=e.i(703923),g=e.i(611935),v=["prefixCls","className","containerRef"];let b=function(e){var n=e.prefixCls,o=e.className,r=e.containerRef,l=(0,m.default)(e,v),i=t.useContext(s).panel,c=(0,g.useComposeRef)(i,r);return t.createElement("div",(0,u.default)({className:(0,a.default)("".concat(n,"-content"),o),role:"dialog",ref:c},(0,f.default)(e,{aria:!0}),{"aria-modal":"true"},l))};var h=e.i(883110);function y(e){return"string"==typeof e&&String(Number(e))===e?((0,h.default)(!1,"Invalid value type of `width` or `height` which should be number type instead."),Number(e)):e}e.i(654310);var A={width:0,height:0,overflow:"hidden",outline:"none",position:"absolute"},I=t.forwardRef(function(e,r){var l,s,m,g=e.prefixCls,v=e.open,h=e.placement,I=e.inline,x=e.push,w=e.forceRender,k=e.autoFocus,C=e.keyboard,$=e.classNames,O=e.rootClassName,S=e.rootStyle,E=e.zIndex,_=e.className,M=e.id,j=e.style,D=e.motion,N=e.width,L=e.height,z=e.children,P=e.mask,R=e.maskClosable,T=e.maskMotion,V=e.maskClassName,G=e.maskStyle,F=e.afterOpenChange,H=e.onClose,W=e.onMouseEnter,B=e.onMouseOver,K=e.onMouseLeave,U=e.onClick,q=e.onKeyDown,J=e.onKeyUp,X=e.styles,Y=e.drawerRender,Q=t.useRef(),Z=t.useRef(),ee=t.useRef();t.useImperativeHandle(r,function(){return Q.current}),t.useEffect(function(){if(v&&k){var e;null==(e=Q.current)||e.focus({preventScroll:!0})}},[v]);var et=t.useState(!1),ea=(0,o.default)(et,2),en=ea[0],eo=ea[1],er=t.useContext(i),el=null!=(l=null!=(s=null==(m="boolean"==typeof x?x?{}:{distance:0}:x||{})?void 0:m.distance)?s:null==er?void 0:er.pushDistance)?l:180,ei=t.useMemo(function(){return{pushDistance:el,push:function(){eo(!0)},pull:function(){eo(!1)}}},[el]);t.useEffect(function(){var e,t;v?null==er||null==(e=er.push)||e.call(er):null==er||null==(t=er.pull)||t.call(er)},[v]),t.useEffect(function(){return function(){var e;null==er||null==(e=er.pull)||e.call(er)}},[]);var es=t.createElement(d.default,(0,u.default)({key:"mask"},T,{visible:P&&v}),function(e,o){var r=e.className,l=e.style;return t.createElement("div",{className:(0,a.default)("".concat(g,"-mask"),r,null==$?void 0:$.mask,V),style:(0,n.default)((0,n.default)((0,n.default)({},l),G),null==X?void 0:X.mask),onClick:R&&v?H:void 0,ref:o})}),ec="function"==typeof D?D(h):D,eu={};if(en&&el)switch(h){case"top":eu.transform="translateY(".concat(el,"px)");break;case"bottom":eu.transform="translateY(".concat(-el,"px)");break;case"left":eu.transform="translateX(".concat(el,"px)");break;default:eu.transform="translateX(".concat(-el,"px)")}"left"===h||"right"===h?eu.width=y(N):eu.height=y(L);var ed={onMouseEnter:W,onMouseOver:B,onMouseLeave:K,onClick:U,onKeyDown:q,onKeyUp:J},ep=t.createElement(d.default,(0,u.default)({key:"panel"},ec,{visible:v,forceRender:w,onVisibleChanged:function(e){null==F||F(e)},removeOnLeave:!1,leavedClassName:"".concat(g,"-content-wrapper-hidden")}),function(o,r){var l=o.className,i=o.style,s=t.createElement(b,(0,u.default)({id:M,containerRef:r,prefixCls:g,className:(0,a.default)(_,null==$?void 0:$.content),style:(0,n.default)((0,n.default)({},j),null==X?void 0:X.content)},(0,f.default)(e,{aria:!0}),ed),z);return t.createElement("div",(0,u.default)({className:(0,a.default)("".concat(g,"-content-wrapper"),null==$?void 0:$.wrapper,l),style:(0,n.default)((0,n.default)((0,n.default)({},eu),i),null==X?void 0:X.wrapper)},(0,f.default)(e,{data:!0})),Y?Y(s):s)}),ef=(0,n.default)({},S);return E&&(ef.zIndex=E),t.createElement(i.Provider,{value:ei},t.createElement("div",{className:(0,a.default)(g,"".concat(g,"-").concat(h),O,(0,c.default)((0,c.default)({},"".concat(g,"-open"),v),"".concat(g,"-inline"),I)),style:ef,tabIndex:-1,ref:Q,onKeyDown:function(e){var t,a,n=e.keyCode,o=e.shiftKey;switch(n){case p.default.TAB:n===p.default.TAB&&(o||document.activeElement!==ee.current?o&&document.activeElement===Z.current&&(null==(a=ee.current)||a.focus({preventScroll:!0})):null==(t=Z.current)||t.focus({preventScroll:!0}));break;case p.default.ESC:H&&C&&(e.stopPropagation(),H(e))}}},es,t.createElement("div",{tabIndex:0,ref:Z,style:A,"aria-hidden":"true","data-sentinel":"start"}),ep,t.createElement("div",{tabIndex:0,ref:ee,style:A,"aria-hidden":"true","data-sentinel":"end"})))});let x=function(e){var a=e.open,i=e.prefixCls,c=e.placement,u=e.autoFocus,d=e.keyboard,p=e.width,f=e.mask,m=void 0===f||f,g=e.maskClosable,v=e.getContainer,b=e.forceRender,h=e.afterOpenChange,y=e.destroyOnClose,A=e.onMouseEnter,x=e.onMouseOver,w=e.onMouseLeave,k=e.onClick,C=e.onKeyDown,$=e.onKeyUp,O=e.panelRef,S=t.useState(!1),E=(0,o.default)(S,2),_=E[0],M=E[1],j=t.useState(!1),D=(0,o.default)(j,2),N=D[0],L=D[1];(0,l.default)(function(){L(!0)},[]);var z=!!N&&void 0!==a&&a,P=t.useRef(),R=t.useRef();(0,l.default)(function(){z&&(R.current=document.activeElement)},[z]);var T=t.useMemo(function(){return{panel:O}},[O]);if(!b&&!_&&!z&&y)return null;var V=(0,n.default)((0,n.default)({},e),{},{open:z,prefixCls:void 0===i?"rc-drawer":i,placement:void 0===c?"right":c,autoFocus:void 0===u||u,keyboard:void 0===d||d,width:void 0===p?378:p,mask:m,maskClosable:void 0===g||g,inline:!1===v,afterOpenChange:function(e){var t,a;M(e),null==h||h(e),e||!R.current||null!=(t=P.current)&&t.contains(R.current)||null==(a=R.current)||a.focus({preventScroll:!0})},ref:P},{onMouseEnter:A,onMouseOver:x,onMouseLeave:w,onClick:k,onKeyDown:C,onKeyUp:$});return t.createElement(s.Provider,{value:T},t.createElement(r.default,{open:z||b||_,autoDestroy:!1,getContainer:v,autoLock:m&&(z||_)},t.createElement(I,V)))};var w=e.i(981444),k=e.i(617206),C=e.i(122767),$=e.i(613541),O=e.i(340010),S=e.i(242064),E=e.i(922611),_=e.i(563113),M=e.i(185793);let j=e=>{var n,o,r,l;let i,{prefixCls:s,ariaId:c,title:u,footer:d,extra:p,closable:f,loading:m,onClose:g,headerStyle:v,bodyStyle:b,footerStyle:h,children:y,classNames:A,styles:I}=e,x=(0,S.useComponentConfig)("drawer");i=!1===f?void 0:void 0===f||!0===f?"start":(null==f?void 0:f.placement)==="end"?"end":"start";let w=t.useCallback(e=>t.createElement("button",{type:"button",onClick:g,className:(0,a.default)(`${s}-close`,{[`${s}-close-${i}`]:"end"===i})},e),[g,s,i]),[k,C]=(0,_.useClosable)((0,_.pickClosable)(e),(0,_.pickClosable)(x),{closable:!0,closeIconRender:w});return t.createElement(t.Fragment,null,u||k?t.createElement("div",{style:Object.assign(Object.assign(Object.assign({},null==(r=x.styles)?void 0:r.header),v),null==I?void 0:I.header),className:(0,a.default)(`${s}-header`,{[`${s}-header-close-only`]:k&&!u&&!p},null==(l=x.classNames)?void 0:l.header,null==A?void 0:A.header)},t.createElement("div",{className:`${s}-header-title`},"start"===i&&C,u&&t.createElement("div",{className:`${s}-title`,id:c},u)),p&&t.createElement("div",{className:`${s}-extra`},p),"end"===i&&C):null,t.createElement("div",{className:(0,a.default)(`${s}-body`,null==A?void 0:A.body,null==(n=x.classNames)?void 0:n.body),style:Object.assign(Object.assign(Object.assign({},null==(o=x.styles)?void 0:o.body),b),null==I?void 0:I.body)},m?t.createElement(M.default,{active:!0,title:!1,paragraph:{rows:5},className:`${s}-body-skeleton`}):y),(()=>{var e,n;if(!d)return null;let o=`${s}-footer`;return t.createElement("div",{className:(0,a.default)(o,null==(e=x.classNames)?void 0:e.footer,null==A?void 0:A.footer),style:Object.assign(Object.assign(Object.assign({},null==(n=x.styles)?void 0:n.footer),h),null==I?void 0:I.footer)},d)})())};e.i(296059);var D=e.i(915654),N=e.i(183293),L=e.i(246422),z=e.i(838378);let P=(e,t)=>({"&-enter, &-appear":Object.assign(Object.assign({},e),{"&-active":t}),"&-leave":Object.assign(Object.assign({},t),{"&-active":e})}),R=(e,t)=>Object.assign({"&-enter, &-appear, &-leave":{"&-start":{transition:"none"},"&-active":{transition:`all ${t}`}}},P({opacity:e},{opacity:1})),T=(0,L.genStyleHooks)("Drawer",e=>{let t=(0,z.mergeToken)(e,{});return[(e=>{let{borderRadiusSM:t,componentCls:a,zIndexPopup:n,colorBgMask:o,colorBgElevated:r,motionDurationSlow:l,motionDurationMid:i,paddingXS:s,padding:c,paddingLG:u,fontSizeLG:d,lineHeightLG:p,lineWidth:f,lineType:m,colorSplit:g,marginXS:v,colorIcon:b,colorIconHover:h,colorBgTextHover:y,colorBgTextActive:A,colorText:I,fontWeightStrong:x,footerPaddingBlock:w,footerPaddingInline:k,calc:C}=e,$=`${a}-content-wrapper`;return{[a]:{position:"fixed",inset:0,zIndex:n,pointerEvents:"none",color:I,"&-pure":{position:"relative",background:r,display:"flex",flexDirection:"column",[`&${a}-left`]:{boxShadow:e.boxShadowDrawerLeft},[`&${a}-right`]:{boxShadow:e.boxShadowDrawerRight},[`&${a}-top`]:{boxShadow:e.boxShadowDrawerUp},[`&${a}-bottom`]:{boxShadow:e.boxShadowDrawerDown}},"&-inline":{position:"absolute"},[`${a}-mask`]:{position:"absolute",inset:0,zIndex:n,background:o,pointerEvents:"auto"},[$]:{position:"absolute",zIndex:n,maxWidth:"100vw",transition:`all ${l}`,"&-hidden":{display:"none"}},[`&-left > ${$}`]:{top:0,bottom:0,left:{_skip_check_:!0,value:0},boxShadow:e.boxShadowDrawerLeft},[`&-right > ${$}`]:{top:0,right:{_skip_check_:!0,value:0},bottom:0,boxShadow:e.boxShadowDrawerRight},[`&-top > ${$}`]:{top:0,insetInline:0,boxShadow:e.boxShadowDrawerUp},[`&-bottom > ${$}`]:{bottom:0,insetInline:0,boxShadow:e.boxShadowDrawerDown},[`${a}-content`]:{display:"flex",flexDirection:"column",width:"100%",height:"100%",overflow:"auto",background:r,pointerEvents:"auto"},[`${a}-header`]:{display:"flex",flex:0,alignItems:"center",padding:`${(0,D.unit)(c)} ${(0,D.unit)(u)}`,fontSize:d,lineHeight:p,borderBottom:`${(0,D.unit)(f)} ${m} ${g}`,"&-title":{display:"flex",flex:1,alignItems:"center",minWidth:0,minHeight:0}},[`${a}-extra`]:{flex:"none"},[`${a}-close`]:Object.assign({display:"inline-flex",width:C(d).add(s).equal(),height:C(d).add(s).equal(),borderRadius:t,justifyContent:"center",alignItems:"center",color:b,fontWeight:x,fontSize:d,fontStyle:"normal",lineHeight:1,textAlign:"center",textTransform:"none",textDecoration:"none",background:"transparent",border:0,cursor:"pointer",transition:`all ${i}`,textRendering:"auto",[`&${a}-close-end`]:{marginInlineStart:v},[`&:not(${a}-close-end)`]:{marginInlineEnd:v},"&:hover":{color:h,backgroundColor:y,textDecoration:"none"},"&:active":{backgroundColor:A}},(0,N.genFocusStyle)(e)),[`${a}-title`]:{flex:1,margin:0,fontWeight:e.fontWeightStrong,fontSize:d,lineHeight:p},[`${a}-body`]:{flex:1,minWidth:0,minHeight:0,padding:u,overflow:"auto",[`${a}-body-skeleton`]:{width:"100%",height:"100%",display:"flex",justifyContent:"center"}},[`${a}-footer`]:{flexShrink:0,padding:`${(0,D.unit)(w)} ${(0,D.unit)(k)}`,borderTop:`${(0,D.unit)(f)} ${m} ${g}`},"&-rtl":{direction:"rtl"}}}})(t),(e=>{let{componentCls:t,motionDurationSlow:a}=e;return{[t]:{[`${t}-mask-motion`]:R(0,a),[`${t}-panel-motion`]:["left","right","top","bottom"].reduce((e,t)=>{let n;return Object.assign(Object.assign({},e),{[`&-${t}`]:[R(.7,a),P({transform:(n="100%",({left:`translateX(-${n})`,right:`translateX(${n})`,top:`translateY(-${n})`,bottom:`translateY(${n})`})[t])},{transform:"none"})]})},{})}}})(t)]},e=>({zIndexPopup:e.zIndexPopupBase,footerPaddingBlock:e.paddingXS,footerPaddingInline:e.padding}));var V=function(e,t){var a={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(a[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,n=Object.getOwnPropertySymbols(e);ot.indexOf(n[o])&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(a[n[o]]=e[n[o]]);return a};let G={distance:180},F=e=>{let{rootClassName:n,width:o,height:r,size:l="default",mask:i=!0,push:s=G,open:c,afterOpenChange:u,onClose:d,prefixCls:p,getContainer:f,panelRef:m=null,style:v,className:b,"aria-labelledby":h,visible:y,afterVisibleChange:A,maskStyle:I,drawerStyle:_,contentWrapperStyle:M,destroyOnClose:D,destroyOnHidden:N}=e,L=V(e,["rootClassName","width","height","size","mask","push","open","afterOpenChange","onClose","prefixCls","getContainer","panelRef","style","className","aria-labelledby","visible","afterVisibleChange","maskStyle","drawerStyle","contentWrapperStyle","destroyOnClose","destroyOnHidden"]),z=(0,w.default)(),P=L.title?z:void 0,{getPopupContainer:R,getPrefixCls:F,direction:H,className:W,style:B,classNames:K,styles:U}=(0,S.useComponentConfig)("drawer"),q=F("drawer",p),[J,X,Y]=T(q),Q=void 0===f&&R?()=>R(document.body):f,Z=(0,a.default)({"no-mask":!i,[`${q}-rtl`]:"rtl"===H},n,X,Y),ee=t.useMemo(()=>null!=o?o:"large"===l?736:378,[o,l]),et=t.useMemo(()=>null!=r?r:"large"===l?736:378,[r,l]),ea={motionName:(0,$.getTransitionName)(q,"mask-motion"),motionAppear:!0,motionEnter:!0,motionLeave:!0,motionDeadline:500},en=(0,E.usePanelRef)(),eo=(0,g.composeRef)(m,en),[er,el]=(0,C.useZIndex)("Drawer",L.zIndex),{classNames:ei={},styles:es={}}=L;return J(t.createElement(k.default,{form:!0,space:!0},t.createElement(O.default.Provider,{value:el},t.createElement(x,Object.assign({prefixCls:q,onClose:d,maskMotion:ea,motion:e=>({motionName:(0,$.getTransitionName)(q,`panel-motion-${e}`),motionAppear:!0,motionEnter:!0,motionLeave:!0,motionDeadline:500})},L,{classNames:{mask:(0,a.default)(ei.mask,K.mask),content:(0,a.default)(ei.content,K.content),wrapper:(0,a.default)(ei.wrapper,K.wrapper)},styles:{mask:Object.assign(Object.assign(Object.assign({},es.mask),I),U.mask),content:Object.assign(Object.assign(Object.assign({},es.content),_),U.content),wrapper:Object.assign(Object.assign(Object.assign({},es.wrapper),M),U.wrapper)},open:null!=c?c:y,mask:i,push:s,width:ee,height:et,style:Object.assign(Object.assign({},B),v),className:(0,a.default)(W,b),rootClassName:Z,getContainer:Q,afterOpenChange:null!=u?u:A,panelRef:eo,zIndex:er,"aria-labelledby":null!=h?h:P,destroyOnClose:null!=N?N:D}),t.createElement(j,Object.assign({prefixCls:q},L,{ariaId:P,onClose:d}))))))};F._InternalPanelDoNotUseOrYouWillBeFired=e=>{let{prefixCls:n,style:o,className:r,placement:l="right"}=e,i=V(e,["prefixCls","style","className","placement"]),{getPrefixCls:s}=t.useContext(S.ConfigContext),c=s("drawer",n),[u,d,p]=T(c),f=(0,a.default)(c,`${c}-pure`,`${c}-${l}`,d,p,r);return u(t.createElement("div",{className:f,style:o},t.createElement(j,Object.assign({prefixCls:c},i))))},e.s(["Drawer",0,F],608856)},799062,e=>{"use strict";var t=e.i(843476),a=e.i(936190),n=e.i(135214),o=e.i(214541),r=e.i(317751),l=e.i(912598);e.s(["default",0,()=>{let{accessToken:e,token:i,userRole:s,userId:c,premiumUser:u}=(0,n.default)(),{teams:d}=(0,o.default)(),p=new r.QueryClient;return(0,t.jsx)(l.QueryClientProvider,{client:p,children:(0,t.jsx)(a.default,{accessToken:e,token:i,userRole:s,userID:c,allTeams:d||[],premiumUser:u})})}])},601236,e=>{e.v(e=>Promise.resolve().then(()=>e(764205)))}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/14e3a24b6a339e4a.js b/litellm/proxy/_experimental/out/_next/static/chunks/14e3a24b6a339e4a.js deleted file mode 100644 index 509745f3c4c..00000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/14e3a24b6a339e4a.js +++ /dev/null @@ -1 +0,0 @@ -(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,983561,e=>{"use strict";e.i(247167);var a=e.i(931067),l=e.i(271645);let t={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M300 328a60 60 0 10120 0 60 60 0 10-120 0zM852 64H172c-17.7 0-32 14.3-32 32v660c0 17.7 14.3 32 32 32h680c17.7 0 32-14.3 32-32V96c0-17.7-14.3-32-32-32zm-32 660H204V128h616v596zM604 328a60 60 0 10120 0 60 60 0 10-120 0zm250.2 556H169.8c-16.5 0-29.8 14.3-29.8 32v36c0 4.4 3.3 8 7.4 8h729.1c4.1 0 7.4-3.6 7.4-8v-36c.1-17.7-13.2-32-29.7-32zM664 508H360c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h304c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z"}}]},name:"robot",theme:"outlined"};var s=e.i(9583),r=l.forwardRef(function(e,r){return l.createElement(s.default,(0,a.default)({},e,{ref:r,icon:t}))});e.s(["RobotOutlined",0,r],983561)},992619,e=>{"use strict";var a=e.i(843476),l=e.i(271645),t=e.i(779241),s=e.i(599724),r=e.i(199133),i=e.i(983561),n=e.i(689020);e.s(["default",0,({accessToken:e,value:d,placeholder:o="Select a Model",onChange:c,disabled:m=!1,style:u,className:x,showLabel:g=!0,labelText:h="Select Model"})=>{let[b,f]=(0,l.useState)(d),[p,y]=(0,l.useState)(!1),[j,v]=(0,l.useState)([]),N=(0,l.useRef)(null);return(0,l.useEffect)(()=>{f(d)},[d]),(0,l.useEffect)(()=>{e&&(async()=>{try{let a=await (0,n.fetchAvailableModels)(e);console.log("Fetched models for selector:",a),a.length>0&&v(a)}catch(e){console.error("Error fetching model info:",e)}})()},[e]),(0,a.jsxs)("div",{children:[g&&(0,a.jsxs)(s.Text,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,a.jsx)(i.RobotOutlined,{className:"mr-2"})," ",h]}),(0,a.jsx)(r.Select,{value:b,placeholder:o,onChange:e=>{"custom"===e?(y(!0),f(void 0)):(y(!1),f(e),c&&c(e))},options:[...Array.from(new Set(j.map(e=>e.model_group))).map((e,a)=>({value:e,label:e,key:a})),{value:"custom",label:"Enter custom model",key:"custom"}],style:{width:"100%",...u},showSearch:!0,className:`rounded-md ${x||""}`,disabled:m}),p&&(0,a.jsx)(t.TextInput,{className:"mt-2",placeholder:"Enter custom model name",onValueChange:e=>{N.current&&clearTimeout(N.current),N.current=setTimeout(()=>{f(e),c&&c(e)},500)},disabled:m})]})}])},533882,e=>{"use strict";var a=e.i(843476),l=e.i(271645),t=e.i(250980),s=e.i(797672),r=e.i(68155),i=e.i(304967),n=e.i(629569),d=e.i(599724),o=e.i(269200),c=e.i(427612),m=e.i(64848),u=e.i(942232),x=e.i(496020),g=e.i(977572),h=e.i(992619),b=e.i(727749);e.s(["default",0,({accessToken:e,initialModelAliases:f={},onAliasUpdate:p,showExampleConfig:y=!0})=>{let[j,v]=(0,l.useState)([]),[N,w]=(0,l.useState)({aliasName:"",targetModel:""}),[k,C]=(0,l.useState)(null);(0,l.useEffect)(()=>{v(Object.entries(f).map(([e,a],l)=>({id:`${l}-${e}`,aliasName:e,targetModel:a})))},[f]);let M=()=>{if(!k)return;if(!k.aliasName||!k.targetModel)return void b.default.fromBackend("Please provide both alias name and target model");if(j.some(e=>e.id!==k.id&&e.aliasName===k.aliasName))return void b.default.fromBackend("An alias with this name already exists");let e=j.map(e=>e.id===k.id?k:e);v(e),C(null);let a={};e.forEach(e=>{a[e.aliasName]=e.targetModel}),p&&p(a),b.default.success("Alias updated successfully")},S=()=>{C(null)},T=j.reduce((e,a)=>(e[a.aliasName]=a.targetModel,e),{});return(0,a.jsxs)("div",{className:"mt-4",children:[(0,a.jsxs)("div",{className:"mb-6",children:[(0,a.jsx)(d.Text,{className:"text-sm font-medium text-gray-700 mb-2",children:"Add New Alias"}),(0,a.jsxs)("div",{className:"grid grid-cols-3 gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-xs text-gray-500 mb-1",children:"Alias Name"}),(0,a.jsx)("input",{type:"text",value:N.aliasName,onChange:e=>w({...N,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,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-xs text-gray-500 mb-1",children:"Target Model"}),(0,a.jsx)(h.default,{accessToken:e,value:N.targetModel,placeholder:"Select target model",onChange:e=>w({...N,targetModel:e}),showLabel:!1})]}),(0,a.jsx)("div",{className:"flex items-end",children:(0,a.jsxs)("button",{onClick:()=>{if(!N.aliasName||!N.targetModel)return void b.default.fromBackend("Please provide both alias name and target model");if(j.some(e=>e.aliasName===N.aliasName))return void b.default.fromBackend("An alias with this name already exists");let e=[...j,{id:`${Date.now()}-${N.aliasName}`,aliasName:N.aliasName,targetModel:N.targetModel}];v(e),w({aliasName:"",targetModel:""});let a={};e.forEach(e=>{a[e.aliasName]=e.targetModel}),p&&p(a),b.default.success("Alias added successfully")},disabled:!N.aliasName||!N.targetModel,className:`flex items-center px-4 py-2 rounded-md text-sm ${!N.aliasName||!N.targetModel?"bg-gray-300 text-gray-500 cursor-not-allowed":"bg-green-600 text-white hover:bg-green-700"}`,children:[(0,a.jsx)(t.PlusCircleIcon,{className:"w-4 h-4 mr-1"}),"Add Alias"]})})]})]}),(0,a.jsx)(d.Text,{className:"text-sm font-medium text-gray-700 mb-2",children:"Manage Existing Aliases"}),(0,a.jsx)("div",{className:"rounded-lg custom-border relative mb-6",children:(0,a.jsx)("div",{className:"overflow-x-auto",children:(0,a.jsxs)(o.Table,{className:"[&_td]:py-0.5 [&_th]:py-1",children:[(0,a.jsx)(c.TableHead,{children:(0,a.jsxs)(x.TableRow,{children:[(0,a.jsx)(m.TableHeaderCell,{className:"py-1 h-8",children:"Alias Name"}),(0,a.jsx)(m.TableHeaderCell,{className:"py-1 h-8",children:"Target Model"}),(0,a.jsx)(m.TableHeaderCell,{className:"py-1 h-8",children:"Actions"})]})}),(0,a.jsxs)(u.TableBody,{children:[j.map(l=>(0,a.jsx)(x.TableRow,{className:"h-8",children:k&&k.id===l.id?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(g.TableCell,{className:"py-0.5",children:(0,a.jsx)("input",{type:"text",value:k.aliasName,onChange:e=>C({...k,aliasName:e.target.value}),className:"w-full px-2 py-1 border border-gray-300 rounded-md text-sm"})}),(0,a.jsx)(g.TableCell,{className:"py-0.5",children:(0,a.jsx)(h.default,{accessToken:e,value:k.targetModel,onChange:e=>C({...k,targetModel:e}),showLabel:!1,style:{height:"32px"}})}),(0,a.jsx)(g.TableCell,{className:"py-0.5 whitespace-nowrap",children:(0,a.jsxs)("div",{className:"flex space-x-2",children:[(0,a.jsx)("button",{onClick:M,className:"text-xs bg-blue-50 text-blue-600 px-2 py-1 rounded hover:bg-blue-100",children:"Save"}),(0,a.jsx)("button",{onClick:S,className:"text-xs bg-gray-50 text-gray-600 px-2 py-1 rounded hover:bg-gray-100",children:"Cancel"})]})})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(g.TableCell,{className:"py-0.5 text-sm text-gray-900",children:l.aliasName}),(0,a.jsx)(g.TableCell,{className:"py-0.5 text-sm text-gray-500",children:l.targetModel}),(0,a.jsx)(g.TableCell,{className:"py-0.5 whitespace-nowrap",children:(0,a.jsxs)("div",{className:"flex space-x-2",children:[(0,a.jsx)("button",{onClick:()=>{C({...l})},className:"text-xs bg-blue-50 text-blue-600 px-2 py-1 rounded hover:bg-blue-100",children:(0,a.jsx)(s.PencilIcon,{className:"w-3 h-3"})}),(0,a.jsx)("button",{onClick:()=>{var e;let a,t;return e=l.id,v(a=j.filter(a=>a.id!==e)),t={},void(a.forEach(e=>{t[e.aliasName]=e.targetModel}),p&&p(t),b.default.success("Alias deleted successfully"))},className:"text-xs bg-red-50 text-red-600 px-2 py-1 rounded hover:bg-red-100",children:(0,a.jsx)(r.TrashIcon,{className:"w-3 h-3"})})]})})]})},l.id)),0===j.length&&(0,a.jsx)(x.TableRow,{children:(0,a.jsx)(g.TableCell,{colSpan:3,className:"py-0.5 text-sm text-gray-500 text-center",children:"No aliases added yet. Add a new alias above."})})]})]})})}),y&&(0,a.jsxs)(i.Card,{children:[(0,a.jsx)(n.Title,{className:"mb-4",children:"Configuration Example"}),(0,a.jsx)(d.Text,{className:"text-gray-600 mb-4",children:"Here's how your current aliases would look in the config:"}),(0,a.jsx)("div",{className:"bg-gray-100 rounded-lg p-4 font-mono text-sm",children:(0,a.jsxs)("div",{className:"text-gray-700",children:["model_aliases:",0===Object.keys(T).length?(0,a.jsxs)("span",{className:"text-gray-500",children:[(0,a.jsx)("br",{}),"  # No aliases configured yet"]}):Object.entries(T).map(([e,l])=>(0,a.jsxs)("span",{children:[(0,a.jsx)("br",{}),'  "',e,'": "',l,'"']},e))]})})]})]})}])},651904,e=>{"use strict";var a=e.i(843476),l=e.i(599724),t=e.i(266484);e.s(["default",0,function({value:e,onChange:s,premiumUser:r=!1,disabledCallbacks:i=[],onDisabledCallbacksChange:n}){return r?(0,a.jsx)(t.default,{value:e,onChange:s,disabledCallbacks:i,onDisabledCallbacksChange:n}):(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex flex-wrap gap-2 mb-3",children:[(0,a.jsx)("div",{className:"inline-flex items-center px-3 py-1.5 rounded-lg bg-green-50 border border-green-200 text-green-800 text-sm font-medium opacity-50",children:"✨ langfuse-logging"}),(0,a.jsx)("div",{className:"inline-flex items-center px-3 py-1.5 rounded-lg bg-green-50 border border-green-200 text-green-800 text-sm font-medium opacity-50",children:"✨ datadog-logging"})]}),(0,a.jsx)("div",{className:"p-3 bg-yellow-50 border border-yellow-200 rounded-lg",children:(0,a.jsxs)(l.Text,{className:"text-sm text-yellow-800",children:["Setting Key/Team logging settings is a LiteLLM Enterprise feature. Global Logging Settings are available for all free users. Get a trial key"," ",(0,a.jsx)("a",{href:"https://www.litellm.ai/#pricing",target:"_blank",rel:"noopener noreferrer",className:"underline",children:"here"}),"."]})})]})}])},603908,e=>{"use strict";let a=(0,e.i(475254).default)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);e.s(["default",()=>a])},107233,37727,e=>{"use strict";var a=e.i(603908);e.s(["Plus",()=>a.default],107233);var l=e.i(841947);e.s(["X",()=>l.default],37727)},220508,e=>{"use strict";var a=e.i(271645);let l=a.forwardRef(function(e,l){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:l},e),a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"}))});e.s(["CheckCircleIcon",0,l],220508)},793130,e=>{"use strict";var a=e.i(290571),l=e.i(429427),t=e.i(371330),s=e.i(271645),r=e.i(394487),i=e.i(503269),n=e.i(214520),d=e.i(746725),o=e.i(914189),c=e.i(144279),m=e.i(294316),u=e.i(601893),x=e.i(140721),g=e.i(942803),h=e.i(233538),b=e.i(694421),f=e.i(700020),p=e.i(35889),y=e.i(998348),j=e.i(722678);let v=(0,s.createContext)(null);v.displayName="GroupContext";let N=s.Fragment,w=Object.assign((0,f.forwardRefWithAs)(function(e,a){var N;let w=(0,s.useId)(),k=(0,g.useProvidedId)(),C=(0,u.useDisabled)(),{id:M=k||`headlessui-switch-${w}`,disabled:S=C||!1,checked:T,defaultChecked:_,onChange:E,name:F,value:R,form:P,autoFocus:A=!1,...D}=e,L=(0,s.useContext)(v),[O,B]=(0,s.useState)(null),I=(0,s.useRef)(null),$=(0,m.useSyncRefs)(I,a,null===L?null:L.setSwitch,B),H=(0,n.useDefaultValue)(_),[z,K]=(0,i.useControllable)(T,E,null!=H&&H),q=(0,d.useDisposables)(),[G,V]=(0,s.useState)(!1),U=(0,o.useEvent)(()=>{V(!0),null==K||K(!z),q.nextFrame(()=>{V(!1)})}),J=(0,o.useEvent)(e=>{if((0,h.isDisabledReactIssue7711)(e.currentTarget))return e.preventDefault();e.preventDefault(),U()}),W=(0,o.useEvent)(e=>{e.key===y.Keys.Space?(e.preventDefault(),U()):e.key===y.Keys.Enter&&(0,b.attemptSubmit)(e.currentTarget)}),X=(0,o.useEvent)(e=>e.preventDefault()),Y=(0,j.useLabelledBy)(),Q=(0,p.useDescribedBy)(),{isFocusVisible:Z,focusProps:ee}=(0,l.useFocusRing)({autoFocus:A}),{isHovered:ea,hoverProps:el}=(0,t.useHover)({isDisabled:S}),{pressed:et,pressProps:es}=(0,r.useActivePress)({disabled:S}),er=(0,s.useMemo)(()=>({checked:z,disabled:S,hover:ea,focus:Z,active:et,autofocus:A,changing:G}),[z,ea,Z,et,S,G,A]),ei=(0,f.mergeProps)({id:M,ref:$,role:"switch",type:(0,c.useResolveButtonType)(e,O),tabIndex:-1===e.tabIndex?0:null!=(N=e.tabIndex)?N:0,"aria-checked":z,"aria-labelledby":Y,"aria-describedby":Q,disabled:S||void 0,autoFocus:A,onClick:J,onKeyUp:W,onKeyPress:X},ee,el,es),en=(0,s.useCallback)(()=>{if(void 0!==H)return null==K?void 0:K(H)},[K,H]),ed=(0,f.useRender)();return s.default.createElement(s.default.Fragment,null,null!=F&&s.default.createElement(x.FormFields,{disabled:S,data:{[F]:R||"on"},overrides:{type:"checkbox",checked:z},form:P,onReset:en}),ed({ourProps:ei,theirProps:D,slot:er,defaultTag:"button",name:"Switch"}))}),{Group:function(e){var a;let[l,t]=(0,s.useState)(null),[r,i]=(0,j.useLabels)(),[n,d]=(0,p.useDescriptions)(),o=(0,s.useMemo)(()=>({switch:l,setSwitch:t}),[l,t]),c=(0,f.useRender)();return s.default.createElement(d,{name:"Switch.Description",value:n},s.default.createElement(i,{name:"Switch.Label",value:r,props:{htmlFor:null==(a=o.switch)?void 0:a.id,onClick(e){l&&(e.currentTarget instanceof HTMLLabelElement&&e.preventDefault(),l.click(),l.focus({preventScroll:!0}))}}},s.default.createElement(v.Provider,{value:o},c({ourProps:{},theirProps:e,slot:{},defaultTag:N,name:"Switch.Group"}))))},Label:j.Label,Description:p.Description});var k=e.i(888288),C=e.i(95779),M=e.i(444755),S=e.i(673706),T=e.i(829087);let _=(0,S.makeClassName)("Switch"),E=s.default.forwardRef((e,l)=>{let{checked:t,defaultChecked:r=!1,onChange:i,color:n,name:d,error:o,errorMessage:c,disabled:m,required:u,tooltip:x,id:g}=e,h=(0,a.__rest)(e,["checked","defaultChecked","onChange","color","name","error","errorMessage","disabled","required","tooltip","id"]),b={bgColor:n?(0,S.getColorClassNames)(n,C.colorPalette.background).bgColor:"bg-tremor-brand dark:bg-dark-tremor-brand",ringColor:n?(0,S.getColorClassNames)(n,C.colorPalette.ring).ringColor:"ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted"},[f,p]=(0,k.default)(r,t),[y,j]=(0,s.useState)(!1),{tooltipProps:v,getReferenceProps:N}=(0,T.useTooltip)(300);return s.default.createElement("div",{className:"flex flex-row items-center justify-start"},s.default.createElement(T.default,Object.assign({text:x},v)),s.default.createElement("div",Object.assign({ref:(0,S.mergeRefs)([l,v.refs.setReference]),className:(0,M.tremorTwMerge)(_("root"),"flex flex-row relative h-5")},h,N),s.default.createElement("input",{type:"checkbox",className:(0,M.tremorTwMerge)(_("input"),"absolute w-5 h-5 cursor-pointer left-0 top-0 opacity-0"),name:d,required:u,checked:f,onChange:e=>{e.preventDefault()}}),s.default.createElement(w,{checked:f,onChange:e=>{p(e),null==i||i(e)},disabled:m,className:(0,M.tremorTwMerge)(_("switch"),"w-10 h-5 group relative inline-flex shrink-0 cursor-pointer items-center justify-center rounded-tremor-full","focus:outline-none",m?"cursor-not-allowed":""),onFocus:()=>j(!0),onBlur:()=>j(!1),id:g},s.default.createElement("span",{className:(0,M.tremorTwMerge)(_("sr-only"),"sr-only")},"Switch ",f?"on":"off"),s.default.createElement("span",{"aria-hidden":"true",className:(0,M.tremorTwMerge)(_("background"),f?b.bgColor:"bg-tremor-border dark:bg-dark-tremor-border","pointer-events-none absolute mx-auto h-3 w-9 rounded-tremor-full transition-colors duration-100 ease-in-out")}),s.default.createElement("span",{"aria-hidden":"true",className:(0,M.tremorTwMerge)(_("round"),f?(0,M.tremorTwMerge)(b.bgColor,"translate-x-5 border-tremor-background dark:border-dark-tremor-background"):"translate-x-0 bg-tremor-border dark:bg-dark-tremor-border border-tremor-background dark:border-dark-tremor-background","pointer-events-none absolute left-0 inline-block h-5 w-5 transform rounded-tremor-full border-2 shadow-tremor-input duration-100 ease-in-out transition",y?(0,M.tremorTwMerge)("ring-2",b.ringColor):"")}))),o&&c?s.default.createElement("p",{className:(0,M.tremorTwMerge)(_("errorMessage"),"text-sm text-red-500 mt-1 ")},c):null)});E.displayName="Switch",e.s(["Switch",()=>E],793130)},158392,419470,e=>{"use strict";var a=e.i(843476),l=e.i(779241);let t={ttl:3600,lowest_latency_buffer:0},s=({routingStrategyArgs:e})=>{let s={ttl:"Sliding window to look back over when calculating the average latency of a deployment. Default - 1 hour (in seconds).",lowest_latency_buffer:"Shuffle between deployments within this % of the lowest latency. Default - 0 (i.e. always pick lowest latency)."};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{className:"max-w-3xl",children:[(0,a.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Latency-Based Configuration"}),(0,a.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Fine-tune latency-based routing behavior"})]}),(0,a.jsx)("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2 xl:grid-cols-3",children:Object.entries(e||t).map(([e,t])=>(0,a.jsx)("div",{className:"space-y-2",children:(0,a.jsxs)("label",{className:"block",children:[(0,a.jsx)("span",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:e.replace(/_/g," ")}),(0,a.jsx)("p",{className:"text-xs text-gray-500 mt-0.5 mb-2",children:s[e]||""}),(0,a.jsx)(l.TextInput,{name:e,defaultValue:"object"==typeof t?JSON.stringify(t,null,2):t?.toString(),className:"font-mono text-sm w-full"})]})},e))})]}),(0,a.jsx)("div",{className:"border-t border-gray-200"})]})},r=({routerSettings:e,routerFieldsMetadata:t})=>(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{className:"max-w-3xl",children:[(0,a.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Reliability & Retries"}),(0,a.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Configure retry logic and failure handling"})]}),(0,a.jsx)("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2 xl:grid-cols-3",children:Object.entries(e).filter(([e,a])=>"fallbacks"!=e&&"context_window_fallbacks"!=e&&"routing_strategy_args"!=e&&"routing_strategy"!=e&&"enable_tag_filtering"!=e).map(([e,s])=>(0,a.jsx)("div",{className:"space-y-2",children:(0,a.jsxs)("label",{className:"block",children:[(0,a.jsx)("span",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:t[e]?.ui_field_name||e}),(0,a.jsx)("p",{className:"text-xs text-gray-500 mt-0.5 mb-2",children:t[e]?.field_description||""}),(0,a.jsx)(l.TextInput,{name:e,defaultValue:null==s||"null"===s?"":"object"==typeof s?JSON.stringify(s,null,2):s?.toString()||"",placeholder:"—",className:"font-mono text-sm w-full"})]})},e))})]});var i=e.i(199133);let n=({selectedStrategy:e,availableStrategies:l,routingStrategyDescriptions:t,routerFieldsMetadata:s,onStrategyChange:r})=>(0,a.jsxs)("div",{className:"space-y-2 max-w-3xl",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:s.routing_strategy?.ui_field_name||"Routing Strategy"}),(0,a.jsx)("p",{className:"text-xs text-gray-500 mt-0.5 mb-2",children:s.routing_strategy?.field_description||""})]}),(0,a.jsx)("div",{className:"routing-strategy-select max-w-3xl",children:(0,a.jsx)(i.Select,{value:e,onChange:r,style:{width:"100%"},size:"large",children:l.map(e=>(0,a.jsx)(i.Select.Option,{value:e,label:e,children:(0,a.jsxs)("div",{className:"flex flex-col gap-0.5 py-1",children:[(0,a.jsx)("span",{className:"font-mono text-sm font-medium",children:e}),t[e]&&(0,a.jsx)("span",{className:"text-xs text-gray-500 font-normal",children:t[e]})]})},e))})})]});var d=e.i(793130);let o=({enabled:e,routerFieldsMetadata:l,onToggle:t})=>(0,a.jsx)("div",{className:"space-y-3 max-w-3xl",children:(0,a.jsxs)("div",{className:"flex items-start justify-between",children:[(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("label",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:l.enable_tag_filtering?.ui_field_name||"Enable Tag Filtering"}),(0,a.jsxs)("p",{className:"text-xs text-gray-500 mt-0.5",children:[l.enable_tag_filtering?.field_description||"",l.enable_tag_filtering?.link&&(0,a.jsxs)(a.Fragment,{children:[" ",(0,a.jsx)("a",{href:l.enable_tag_filtering.link,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-800 underline",children:"Learn more"})]})]})]}),(0,a.jsx)(d.Switch,{checked:e,onChange:t,className:"ml-4"})]})});e.s(["default",0,({value:e,onChange:l,routerFieldsMetadata:t,availableRoutingStrategies:i,routingStrategyDescriptions:d})=>(0,a.jsxs)("div",{className:"w-full space-y-8 py-2",children:[(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{className:"max-w-3xl",children:[(0,a.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Routing Settings"}),(0,a.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Configure how requests are routed to deployments"})]}),i.length>0&&(0,a.jsx)(n,{selectedStrategy:e.selectedStrategy||e.routerSettings.routing_strategy||null,availableStrategies:i,routingStrategyDescriptions:d,routerFieldsMetadata:t,onStrategyChange:a=>{l({...e,selectedStrategy:a})}}),(0,a.jsx)(o,{enabled:e.enableTagFiltering,routerFieldsMetadata:t,onToggle:a=>{l({...e,enableTagFiltering:a})}})]}),(0,a.jsx)("div",{className:"border-t border-gray-200"}),"latency-based-routing"===e.selectedStrategy&&(0,a.jsx)(s,{routingStrategyArgs:e.routerSettings.routing_strategy_args}),(0,a.jsx)(r,{routerSettings:e.routerSettings,routerFieldsMetadata:t})]})],158392);var c=e.i(994388),m=e.i(998573),u=e.i(653496),x=e.i(107233),g=e.i(271645),h=e.i(592968),b=e.i(475254);let f=(0,b.default)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]),p=(0,b.default)("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);var y=e.i(37727);function j({group:e,onChange:l,availableModels:t,maxFallbacks:s}){let r=t.filter(a=>a!==e.primaryModel),n=e.fallbackModels.length{let t=[...e.fallbackModels];t.includes(a)&&(t=t.filter(e=>e!==a)),l({...e,primaryModel:a,fallbackModels:t})},showSearch:!0,filterOption:(e,a)=>(a?.label??"").toLowerCase().includes(e.toLowerCase()),options:t.map(e=>({label:e,value:e}))}),!e.primaryModel&&(0,a.jsxs)("div",{className:"mt-2 flex items-center gap-2 text-amber-600 text-xs bg-amber-50 p-2 rounded",children:[(0,a.jsx)(f,{className:"w-4 h-4"}),(0,a.jsx)("span",{children:"Select a model to begin configuring fallbacks"})]})]}),(0,a.jsx)("div",{className:"flex items-center justify-center -my-4 z-10",children:(0,a.jsxs)("div",{className:"bg-indigo-50 text-indigo-500 px-4 py-1 rounded-full text-xs font-bold border border-indigo-100 flex items-center gap-2 shadow-sm",children:[(0,a.jsx)(p,{className:"w-4 h-4"}),"IF FAILS, TRY..."]})}),(0,a.jsxs)("div",{className:`transition-opacity duration-300 ${!e.primaryModel?"opacity-50 pointer-events-none":"opacity-100"}`,children:[(0,a.jsxs)("label",{className:"block text-sm font-semibold text-gray-700 mb-2",children:["Fallback Chain ",(0,a.jsx)("span",{className:"text-red-500",children:"*"}),(0,a.jsxs)("span",{className:"text-xs text-gray-500 font-normal ml-2",children:["(Max ",s," fallbacks at a time)"]})]}),(0,a.jsxs)("div",{className:"bg-gray-50 rounded-xl p-4 border border-gray-200",children:[(0,a.jsxs)("div",{className:"mb-4",children:[(0,a.jsx)(i.Select,{mode:"multiple",className:"w-full",size:"large",placeholder:n?"Select fallback models to add...":`Maximum ${s} fallbacks reached`,value:e.fallbackModels,onChange:a=>{let t=a.slice(0,s);l({...e,fallbackModels:t})},disabled:!e.primaryModel,options:r.map(e=>({label:e,value:e})),optionRender:(l,t)=>{let s=e.fallbackModels.includes(l.value),r=s?e.fallbackModels.indexOf(l.value)+1:null;return(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[s&&null!==r&&(0,a.jsx)("span",{className:"flex items-center justify-center w-5 h-5 rounded bg-indigo-100 text-indigo-600 text-xs font-bold",children:r}),(0,a.jsx)("span",{children:l.label})]})},maxTagCount:"responsive",maxTagPlaceholder:e=>(0,a.jsx)(h.Tooltip,{styles:{root:{pointerEvents:"none"}},title:e.map(({value:e})=>e).join(", "),children:(0,a.jsxs)("span",{children:["+",e.length," more"]})}),showSearch:!0,filterOption:(e,a)=>(a?.label??"").toLowerCase().includes(e.toLowerCase())}),(0,a.jsx)("p",{className:"text-xs text-gray-500 mt-1 ml-1",children:n?`Search and select multiple models. Selected models will appear below in order. (${e.fallbackModels.length}/${s} used)`:`Maximum ${s} fallbacks reached. Remove some to add more.`})]}),(0,a.jsx)("div",{className:"space-y-2 min-h-[100px]",children:0===e.fallbackModels.length?(0,a.jsxs)("div",{className:"h-32 border-2 border-dashed border-gray-300 rounded-lg flex flex-col items-center justify-center text-gray-400",children:[(0,a.jsx)("span",{className:"text-sm",children:"No fallback models selected"}),(0,a.jsx)("span",{className:"text-xs mt-1",children:"Add models from the dropdown above"})]}):e.fallbackModels.map((t,s)=>(0,a.jsxs)("div",{className:"group flex items-center justify-between p-3 bg-white rounded-lg border border-gray-200 hover:border-indigo-300 hover:shadow-sm transition-all",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"flex items-center justify-center w-6 h-6 rounded bg-gray-100 text-gray-400 group-hover:text-indigo-500 group-hover:bg-indigo-50",children:(0,a.jsx)("span",{className:"text-xs font-bold",children:s+1})}),(0,a.jsx)("div",{children:(0,a.jsx)("span",{className:"font-medium text-gray-800",children:t})})]}),(0,a.jsx)("button",{type:"button",onClick:()=>{let a;return a=e.fallbackModels.filter((e,a)=>a!==s),void l({...e,fallbackModels:a})},className:"opacity-0 group-hover:opacity-100 transition-opacity text-gray-400 hover:text-red-500 p-1",children:(0,a.jsx)(y.X,{className:"w-4 h-4"})})]},`${t}-${s}`))})]})]})]})}function v({groups:e,onGroupsChange:l,availableModels:t,maxFallbacks:s=10,maxGroups:r=5}){let[i,n]=(0,g.useState)(e.length>0?e[0].id:"1");(0,g.useEffect)(()=>{e.length>0?e.some(e=>e.id===i)||n(e[0].id):n("1")},[e]);let d=()=>{if(e.length>=r)return;let a=Date.now().toString();l([...e,{id:a,primaryModel:null,fallbackModels:[]}]),n(a)},o=a=>{l(e.map(e=>e.id===a.id?a:e))},h=e.map((l,r)=>{let i=l.primaryModel?l.primaryModel:`Group ${r+1}`;return{key:l.id,label:i,closable:e.length>1,children:(0,a.jsx)(j,{group:l,onChange:o,availableModels:t,maxFallbacks:s})}});return 0===e.length?(0,a.jsxs)("div",{className:"text-center py-12 bg-gray-50 rounded-lg border border-dashed border-gray-300",children:[(0,a.jsx)("p",{className:"text-gray-500 mb-4",children:"No fallback groups configured"}),(0,a.jsx)(c.Button,{variant:"primary",onClick:d,icon:()=>(0,a.jsx)(x.Plus,{className:"w-4 h-4"}),children:"Create First Group"})]}):(0,a.jsx)(u.Tabs,{type:"editable-card",activeKey:i,onChange:n,onEdit:(a,t)=>{"add"===t?d():"remove"===t&&e.length>1&&(a=>{if(1===e.length)return m.message.warning("At least one group is required");let t=e.filter(e=>e.id!==a);l(t),i===a&&t.length>0&&n(t[t.length-1].id)})(a)},items:h,className:"fallback-tabs",tabBarStyle:{marginBottom:0},hideAdd:e.length>=r})}e.s(["FallbackSelectionForm",()=>v],419470)}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/150c552ddd2c95ab.js b/litellm/proxy/_experimental/out/_next/static/chunks/150c552ddd2c95ab.js deleted file mode 100644 index 0d6550ea646..00000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/150c552ddd2c95ab.js +++ /dev/null @@ -1 +0,0 @@ -(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,244451,e=>{"use strict";let t;e.i(247167);var a=e.i(271645),s=e.i(343794),l=e.i(242064),r=e.i(763731),i=e.i(174428);let n=80*Math.PI,o=e=>{let{dotClassName:t,style:l,hasCircleCls:r}=e;return a.createElement("circle",{className:(0,s.default)(`${t}-circle`,{[`${t}-circle-bg`]:r}),r:40,cx:50,cy:50,strokeWidth:20,style:l})},c=({percent:e,prefixCls:t})=>{let l=`${t}-dot`,r=`${l}-holder`,c=`${r}-hidden`,[d,m]=a.useState(!1);(0,i.default)(()=>{0!==e&&m(!0)},[0!==e]);let u=Math.max(Math.min(e,100),0);if(!d)return null;let g={strokeDashoffset:`${n/4}`,strokeDasharray:`${n*u/100} ${n*(100-u)/100}`};return a.createElement("span",{className:(0,s.default)(r,`${l}-progress`,u<=0&&c)},a.createElement("svg",{viewBox:"0 0 100 100",role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":u},a.createElement(o,{dotClassName:l,hasCircleCls:!0}),a.createElement(o,{dotClassName:l,style:g})))};function d(e){let{prefixCls:t,percent:l=0}=e,r=`${t}-dot`,i=`${r}-holder`,n=`${i}-hidden`;return a.createElement(a.Fragment,null,a.createElement("span",{className:(0,s.default)(i,l>0&&n)},a.createElement("span",{className:(0,s.default)(r,`${t}-dot-spin`)},[1,2,3,4].map(e=>a.createElement("i",{className:`${t}-dot-item`,key:e})))),a.createElement(c,{prefixCls:t,percent:l}))}function m(e){var t;let{prefixCls:l,indicator:i,percent:n}=e,o=`${l}-dot`;return i&&a.isValidElement(i)?(0,r.cloneElement)(i,{className:(0,s.default)(null==(t=i.props)?void 0:t.className,o),percent:n}):a.createElement(d,{prefixCls:l,percent:n})}e.i(296059);var u=e.i(694758),g=e.i(183293),p=e.i(246422),x=e.i(838378);let h=new u.Keyframes("antSpinMove",{to:{opacity:1}}),f=new u.Keyframes("antRotate",{to:{transform:"rotate(405deg)"}}),v=(0,p.genStyleHooks)("Spin",e=>(e=>{let{componentCls:t,calc:a}=e;return{[t]:Object.assign(Object.assign({},(0,g.resetComponent)(e)),{position:"absolute",display:"none",color:e.colorPrimary,fontSize:0,textAlign:"center",verticalAlign:"middle",opacity:0,transition:`transform ${e.motionDurationSlow} ${e.motionEaseInOutCirc}`,"&-spinning":{position:"relative",display:"inline-block",opacity:1},[`${t}-text`]:{fontSize:e.fontSize,paddingTop:a(a(e.dotSize).sub(e.fontSize)).div(2).add(2).equal()},"&-fullscreen":{position:"fixed",width:"100vw",height:"100vh",backgroundColor:e.colorBgMask,zIndex:e.zIndexPopupBase,inset:0,display:"flex",alignItems:"center",flexDirection:"column",justifyContent:"center",opacity:0,visibility:"hidden",transition:`all ${e.motionDurationMid}`,"&-show":{opacity:1,visibility:"visible"},[t]:{[`${t}-dot-holder`]:{color:e.colorWhite},[`${t}-text`]:{color:e.colorTextLightSolid}}},"&-nested-loading":{position:"relative",[`> div > ${t}`]:{position:"absolute",top:0,insetInlineStart:0,zIndex:4,display:"block",width:"100%",height:"100%",maxHeight:e.contentHeight,[`${t}-dot`]:{position:"absolute",top:"50%",insetInlineStart:"50%",margin:a(e.dotSize).mul(-1).div(2).equal()},[`${t}-text`]:{position:"absolute",top:"50%",width:"100%",textShadow:`0 1px 2px ${e.colorBgContainer}`},[`&${t}-show-text ${t}-dot`]:{marginTop:a(e.dotSize).div(2).mul(-1).sub(10).equal()},"&-sm":{[`${t}-dot`]:{margin:a(e.dotSizeSM).mul(-1).div(2).equal()},[`${t}-text`]:{paddingTop:a(a(e.dotSizeSM).sub(e.fontSize)).div(2).add(2).equal()},[`&${t}-show-text ${t}-dot`]:{marginTop:a(e.dotSizeSM).div(2).mul(-1).sub(10).equal()}},"&-lg":{[`${t}-dot`]:{margin:a(e.dotSizeLG).mul(-1).div(2).equal()},[`${t}-text`]:{paddingTop:a(a(e.dotSizeLG).sub(e.fontSize)).div(2).add(2).equal()},[`&${t}-show-text ${t}-dot`]:{marginTop:a(e.dotSizeLG).div(2).mul(-1).sub(10).equal()}}},[`${t}-container`]:{position:"relative",transition:`opacity ${e.motionDurationSlow}`,"&::after":{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,zIndex:10,width:"100%",height:"100%",background:e.colorBgContainer,opacity:0,transition:`all ${e.motionDurationSlow}`,content:'""',pointerEvents:"none"}},[`${t}-blur`]:{clear:"both",opacity:.5,userSelect:"none",pointerEvents:"none","&::after":{opacity:.4,pointerEvents:"auto"}}},"&-tip":{color:e.spinDotDefault},[`${t}-dot-holder`]:{width:"1em",height:"1em",fontSize:e.dotSize,display:"inline-block",transition:`transform ${e.motionDurationSlow} ease, opacity ${e.motionDurationSlow} ease`,transformOrigin:"50% 50%",lineHeight:1,color:e.colorPrimary,"&-hidden":{transform:"scale(0.3)",opacity:0}},[`${t}-dot-progress`]:{position:"absolute",inset:0},[`${t}-dot`]:{position:"relative",display:"inline-block",fontSize:e.dotSize,width:"1em",height:"1em","&-item":{position:"absolute",display:"block",width:a(e.dotSize).sub(a(e.marginXXS).div(2)).div(2).equal(),height:a(e.dotSize).sub(a(e.marginXXS).div(2)).div(2).equal(),background:"currentColor",borderRadius:"100%",transform:"scale(0.75)",transformOrigin:"50% 50%",opacity:.3,animationName:h,animationDuration:"1s",animationIterationCount:"infinite",animationTimingFunction:"linear",animationDirection:"alternate","&:nth-child(1)":{top:0,insetInlineStart:0,animationDelay:"0s"},"&:nth-child(2)":{top:0,insetInlineEnd:0,animationDelay:"0.4s"},"&:nth-child(3)":{insetInlineEnd:0,bottom:0,animationDelay:"0.8s"},"&:nth-child(4)":{bottom:0,insetInlineStart:0,animationDelay:"1.2s"}},"&-spin":{transform:"rotate(45deg)",animationName:f,animationDuration:"1.2s",animationIterationCount:"infinite",animationTimingFunction:"linear"},"&-circle":{strokeLinecap:"round",transition:["stroke-dashoffset","stroke-dasharray","stroke","stroke-width","opacity"].map(t=>`${t} ${e.motionDurationSlow} ease`).join(","),fillOpacity:0,stroke:"currentcolor"},"&-circle-bg":{stroke:e.colorFillSecondary}},[`&-sm ${t}-dot`]:{"&, &-holder":{fontSize:e.dotSizeSM}},[`&-sm ${t}-dot-holder`]:{i:{width:a(a(e.dotSizeSM).sub(a(e.marginXXS).div(2))).div(2).equal(),height:a(a(e.dotSizeSM).sub(a(e.marginXXS).div(2))).div(2).equal()}},[`&-lg ${t}-dot`]:{"&, &-holder":{fontSize:e.dotSizeLG}},[`&-lg ${t}-dot-holder`]:{i:{width:a(a(e.dotSizeLG).sub(e.marginXXS)).div(2).equal(),height:a(a(e.dotSizeLG).sub(e.marginXXS)).div(2).equal()}},[`&${t}-show-text ${t}-text`]:{display:"block"}})}})((0,x.mergeToken)(e,{spinDotDefault:e.colorTextDescription})),e=>{let{controlHeightLG:t,controlHeight:a}=e;return{contentHeight:400,dotSize:t/2,dotSizeSM:.35*t,dotSizeLG:a}}),b=[[30,.05],[70,.03],[96,.01]];var y=function(e,t){var a={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&0>t.indexOf(s)&&(a[s]=e[s]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var l=0,s=Object.getOwnPropertySymbols(e);lt.indexOf(s[l])&&Object.prototype.propertyIsEnumerable.call(e,s[l])&&(a[s[l]]=e[s[l]]);return a};let N=e=>{var r;let{prefixCls:i,spinning:n=!0,delay:o=0,className:c,rootClassName:d,size:u="default",tip:g,wrapperClassName:p,style:x,children:h,fullscreen:f=!1,indicator:N,percent:j}=e,w=y(e,["prefixCls","spinning","delay","className","rootClassName","size","tip","wrapperClassName","style","children","fullscreen","indicator","percent"]),{getPrefixCls:S,direction:$,className:k,style:C,indicator:M}=(0,l.useComponentConfig)("spin"),T=S("spin",i),[E,z,A]=v(T),[I,_]=a.useState(()=>n&&(!n||!o||!!Number.isNaN(Number(o)))),O=function(e,t){let[s,l]=a.useState(0),r=a.useRef(null),i="auto"===t;return a.useEffect(()=>(i&&e&&(l(0),r.current=setInterval(()=>{l(e=>{let t=100-e;for(let a=0;a{r.current&&(clearInterval(r.current),r.current=null)}),[i,e]),i?s:t}(I,j);a.useEffect(()=>{if(n){let e=function(e,t,a){var s,l=a||{},r=l.noTrailing,i=void 0!==r&&r,n=l.noLeading,o=void 0!==n&&n,c=l.debounceMode,d=void 0===c?void 0:c,m=!1,u=0;function g(){s&&clearTimeout(s)}function p(){for(var a=arguments.length,l=Array(a),r=0;re?o?(u=Date.now(),i||(s=setTimeout(d?x:p,e))):p():!0!==i&&(s=setTimeout(d?x:p,void 0===d?e-c:e)))}return p.cancel=function(e){var t=(e||{}).upcomingOnly;g(),m=!(void 0!==t&&t)},p}(o,()=>{_(!0)},{debounceMode:false});return e(),()=>{var t;null==(t=null==e?void 0:e.cancel)||t.call(e)}}_(!1)},[o,n]);let D=a.useMemo(()=>void 0!==h&&!f,[h,f]),L=(0,s.default)(T,k,{[`${T}-sm`]:"small"===u,[`${T}-lg`]:"large"===u,[`${T}-spinning`]:I,[`${T}-show-text`]:!!g,[`${T}-rtl`]:"rtl"===$},c,!f&&d,z,A),P=(0,s.default)(`${T}-container`,{[`${T}-blur`]:I}),B=null!=(r=null!=N?N:M)?r:t,G=Object.assign(Object.assign({},C),x),R=a.createElement("div",Object.assign({},w,{style:G,className:L,"aria-live":"polite","aria-busy":I}),a.createElement(m,{prefixCls:T,indicator:B,percent:O}),g&&(D||f)?a.createElement("div",{className:`${T}-text`},g):null);return E(D?a.createElement("div",Object.assign({},w,{className:(0,s.default)(`${T}-nested-loading`,p,z,A)}),I&&a.createElement("div",{key:"loading"},R),a.createElement("div",{className:P,key:"container"},h)):f?a.createElement("div",{className:(0,s.default)(`${T}-fullscreen`,{[`${T}-fullscreen-show`]:I},d,z,A)},R):R)};N.setDefaultIndicator=e=>{t=e},e.s(["default",0,N],244451)},482725,e=>{"use strict";var t=e.i(244451);e.s(["Spin",()=>t.default])},350967,46757,e=>{"use strict";var t=e.i(290571),a=e.i(444755),s=e.i(673706),l=e.i(271645);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"},i={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"},n={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"},o={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"},c={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"},m={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"};e.s(["colSpan",()=>c,"colSpanLg",()=>u,"colSpanMd",()=>m,"colSpanSm",()=>d,"gridCols",()=>r,"gridColsLg",()=>o,"gridColsMd",()=>n,"gridColsSm",()=>i],46757);let g=(0,s.makeClassName)("Grid"),p=(e,t)=>e&&Object.keys(t).includes(String(e))?t[e]:"",x=l.default.forwardRef((e,s)=>{let{numItems:c=1,numItemsSm:d,numItemsMd:m,numItemsLg:u,children:x,className:h}=e,f=(0,t.__rest)(e,["numItems","numItemsSm","numItemsMd","numItemsLg","children","className"]),v=p(c,r),b=p(d,i),y=p(m,n),N=p(u,o),j=(0,a.tremorTwMerge)(v,b,y,N);return l.default.createElement("div",Object.assign({ref:s,className:(0,a.tremorTwMerge)(g("root"),"grid",j,h)},f),x)});x.displayName="Grid",e.s(["Grid",()=>x],350967)},530212,e=>{"use strict";var t=e.i(271645);let a=t.forwardRef(function(e,a){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:a},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 19l-7-7m0 0l7-7m-7 7h18"}))});e.s(["ArrowLeftIcon",0,a],530212)},981339,e=>{"use strict";var t=e.i(185793);e.s(["Skeleton",()=>t.default])},500330,e=>{"use strict";var t=e.i(727749);function a(e,t){let a=structuredClone(e);for(let[e,s]of Object.entries(t))e in a&&(a[e]=s);return a}let s=(e,t=0,a=!1,s=!0)=>{if(null==e||!Number.isFinite(e)||0===e&&!s)return"-";let l={minimumFractionDigits:t,maximumFractionDigits:t};if(!a)return e.toLocaleString("en-US",l);let r=e<0?"-":"",i=Math.abs(e),n=i,o="";return i>=1e6?(n=i/1e6,o="M"):i>=1e3&&(n=i/1e3,o="K"),`${r}${n.toLocaleString("en-US",l)}${o}`},l=async(e,a="Copied to clipboard")=>{if(!e)return!1;if(!navigator||!navigator.clipboard||!navigator.clipboard.writeText)return r(e,a);try{return await navigator.clipboard.writeText(e),t.default.success(a),!0}catch(t){return console.error("Clipboard API failed: ",t),r(e,a)}},r=(e,a)=>{try{let s=document.createElement("textarea");s.value=e,s.style.position="fixed",s.style.left="-999999px",s.style.top="-999999px",s.setAttribute("readonly",""),document.body.appendChild(s),s.focus(),s.select();let l=document.execCommand("copy");if(document.body.removeChild(s),l)return t.default.success(a),!0;throw Error("execCommand failed")}catch(e){return t.default.fromBackend("Failed to copy to clipboard"),console.error("Failed to copy: ",e),!1}};e.s(["copyToClipboard",0,l,"formatNumberWithCommas",0,s,"getSpendString",0,(e,t=6)=>{if(null==e||!Number.isFinite(e)||0===e)return"-";let a=s(e,t,!1,!1);if(0===Number(a.replace(/,/g,""))){let e=(1/10**t).toFixed(t);return`< $${e}`}return`$${a}`},"updateExistingKeys",()=>a])},689020,e=>{"use strict";var t=e.i(764205);let a=async e=>{try{let a=await (0,t.modelHubCall)(e);if(console.log("model_info:",a),a?.data.length>0){let e=a.data.map(e=>({model_group:e.model_group,mode:e?.mode}));return e.sort((e,t)=>e.model_group.localeCompare(t.model_group)),e}return[]}catch(e){throw console.error("Error fetching model info:",e),e}};e.s(["fetchAvailableModels",0,a])},983561,e=>{"use strict";e.i(247167);var t=e.i(931067),a=e.i(271645);let s={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M300 328a60 60 0 10120 0 60 60 0 10-120 0zM852 64H172c-17.7 0-32 14.3-32 32v660c0 17.7 14.3 32 32 32h680c17.7 0 32-14.3 32-32V96c0-17.7-14.3-32-32-32zm-32 660H204V128h616v596zM604 328a60 60 0 10120 0 60 60 0 10-120 0zm250.2 556H169.8c-16.5 0-29.8 14.3-29.8 32v36c0 4.4 3.3 8 7.4 8h729.1c4.1 0 7.4-3.6 7.4-8v-36c.1-17.7-13.2-32-29.7-32zM664 508H360c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h304c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z"}}]},name:"robot",theme:"outlined"};var l=e.i(9583),r=a.forwardRef(function(e,r){return a.createElement(l.default,(0,t.default)({},e,{ref:r,icon:s}))});e.s(["RobotOutlined",0,r],983561)},992619,e=>{"use strict";var t=e.i(843476),a=e.i(271645),s=e.i(779241),l=e.i(599724),r=e.i(199133),i=e.i(983561),n=e.i(689020);e.s(["default",0,({accessToken:e,value:o,placeholder:c="Select a Model",onChange:d,disabled:m=!1,style:u,className:g,showLabel:p=!0,labelText:x="Select Model"})=>{let[h,f]=(0,a.useState)(o),[v,b]=(0,a.useState)(!1),[y,N]=(0,a.useState)([]),j=(0,a.useRef)(null);return(0,a.useEffect)(()=>{f(o)},[o]),(0,a.useEffect)(()=>{e&&(async()=>{try{let t=await (0,n.fetchAvailableModels)(e);console.log("Fetched models for selector:",t),t.length>0&&N(t)}catch(e){console.error("Error fetching model info:",e)}})()},[e]),(0,t.jsxs)("div",{children:[p&&(0,t.jsxs)(l.Text,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,t.jsx)(i.RobotOutlined,{className:"mr-2"})," ",x]}),(0,t.jsx)(r.Select,{value:h,placeholder:c,onChange:e=>{"custom"===e?(b(!0),f(void 0)):(b(!1),f(e),d&&d(e))},options:[...Array.from(new Set(y.map(e=>e.model_group))).map((e,t)=>({value:e,label:e,key:t})),{value:"custom",label:"Enter custom model",key:"custom"}],style:{width:"100%",...u},showSearch:!0,className:`rounded-md ${g||""}`,disabled:m}),v&&(0,t.jsx)(s.TextInput,{className:"mt-2",placeholder:"Enter custom model name",onValueChange:e=>{j.current&&clearTimeout(j.current),j.current=setTimeout(()=>{f(e),d&&d(e)},500)},disabled:m})]})}])},651904,e=>{"use strict";var t=e.i(843476),a=e.i(599724),s=e.i(266484);e.s(["default",0,function({value:e,onChange:l,premiumUser:r=!1,disabledCallbacks:i=[],onDisabledCallbacksChange:n}){return r?(0,t.jsx)(s.default,{value:e,onChange:l,disabledCallbacks:i,onDisabledCallbacksChange:n}):(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex flex-wrap gap-2 mb-3",children:[(0,t.jsx)("div",{className:"inline-flex items-center px-3 py-1.5 rounded-lg bg-green-50 border border-green-200 text-green-800 text-sm font-medium opacity-50",children:"✨ langfuse-logging"}),(0,t.jsx)("div",{className:"inline-flex items-center px-3 py-1.5 rounded-lg bg-green-50 border border-green-200 text-green-800 text-sm font-medium opacity-50",children:"✨ datadog-logging"})]}),(0,t.jsx)("div",{className:"p-3 bg-yellow-50 border border-yellow-200 rounded-lg",children:(0,t.jsxs)(a.Text,{className:"text-sm text-yellow-800",children:["Setting Key/Team logging settings is a LiteLLM Enterprise feature. Global Logging Settings are available for all free users. Get a trial key"," ",(0,t.jsx)("a",{href:"https://www.litellm.ai/#pricing",target:"_blank",rel:"noopener noreferrer",className:"underline",children:"here"}),"."]})})]})}])},533882,e=>{"use strict";var t=e.i(843476),a=e.i(271645),s=e.i(250980),l=e.i(797672),r=e.i(68155),i=e.i(304967),n=e.i(629569),o=e.i(599724),c=e.i(269200),d=e.i(427612),m=e.i(64848),u=e.i(942232),g=e.i(496020),p=e.i(977572),x=e.i(992619),h=e.i(727749);e.s(["default",0,({accessToken:e,initialModelAliases:f={},onAliasUpdate:v,showExampleConfig:b=!0})=>{let[y,N]=(0,a.useState)([]),[j,w]=(0,a.useState)({aliasName:"",targetModel:""}),[S,$]=(0,a.useState)(null);(0,a.useEffect)(()=>{N(Object.entries(f).map(([e,t],a)=>({id:`${a}-${e}`,aliasName:e,targetModel:t})))},[f]);let k=()=>{if(!S)return;if(!S.aliasName||!S.targetModel)return void h.default.fromBackend("Please provide both alias name and target model");if(y.some(e=>e.id!==S.id&&e.aliasName===S.aliasName))return void h.default.fromBackend("An alias with this name already exists");let e=y.map(e=>e.id===S.id?S:e);N(e),$(null);let t={};e.forEach(e=>{t[e.aliasName]=e.targetModel}),v&&v(t),h.default.success("Alias updated successfully")},C=()=>{$(null)},M=y.reduce((e,t)=>(e[t.aliasName]=t.targetModel,e),{});return(0,t.jsxs)("div",{className:"mt-4",children:[(0,t.jsxs)("div",{className:"mb-6",children:[(0,t.jsx)(o.Text,{className:"text-sm font-medium text-gray-700 mb-2",children:"Add New Alias"}),(0,t.jsxs)("div",{className:"grid grid-cols-3 gap-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-xs text-gray-500 mb-1",children:"Alias Name"}),(0,t.jsx)("input",{type:"text",value:j.aliasName,onChange:e=>w({...j,aliasName:e.target.value}),placeholder:"e.g., gpt-4o",className:"w-full px-3 py-2 border border-gray-300 rounded-md text-sm"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-xs text-gray-500 mb-1",children:"Target Model"}),(0,t.jsx)(x.default,{accessToken:e,value:j.targetModel,placeholder:"Select target model",onChange:e=>w({...j,targetModel:e}),showLabel:!1})]}),(0,t.jsx)("div",{className:"flex items-end",children:(0,t.jsxs)("button",{onClick:()=>{if(!j.aliasName||!j.targetModel)return void h.default.fromBackend("Please provide both alias name and target model");if(y.some(e=>e.aliasName===j.aliasName))return void h.default.fromBackend("An alias with this name already exists");let e=[...y,{id:`${Date.now()}-${j.aliasName}`,aliasName:j.aliasName,targetModel:j.targetModel}];N(e),w({aliasName:"",targetModel:""});let t={};e.forEach(e=>{t[e.aliasName]=e.targetModel}),v&&v(t),h.default.success("Alias added successfully")},disabled:!j.aliasName||!j.targetModel,className:`flex items-center px-4 py-2 rounded-md text-sm ${!j.aliasName||!j.targetModel?"bg-gray-300 text-gray-500 cursor-not-allowed":"bg-green-600 text-white hover:bg-green-700"}`,children:[(0,t.jsx)(s.PlusCircleIcon,{className:"w-4 h-4 mr-1"}),"Add Alias"]})})]})]}),(0,t.jsx)(o.Text,{className:"text-sm font-medium text-gray-700 mb-2",children:"Manage Existing Aliases"}),(0,t.jsx)("div",{className:"rounded-lg custom-border relative mb-6",children:(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)(c.Table,{className:"[&_td]:py-0.5 [&_th]:py-1",children:[(0,t.jsx)(d.TableHead,{children:(0,t.jsxs)(g.TableRow,{children:[(0,t.jsx)(m.TableHeaderCell,{className:"py-1 h-8",children:"Alias Name"}),(0,t.jsx)(m.TableHeaderCell,{className:"py-1 h-8",children:"Target Model"}),(0,t.jsx)(m.TableHeaderCell,{className:"py-1 h-8",children:"Actions"})]})}),(0,t.jsxs)(u.TableBody,{children:[y.map(a=>(0,t.jsx)(g.TableRow,{className:"h-8",children:S&&S.id===a.id?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(p.TableCell,{className:"py-0.5",children:(0,t.jsx)("input",{type:"text",value:S.aliasName,onChange:e=>$({...S,aliasName:e.target.value}),className:"w-full px-2 py-1 border border-gray-300 rounded-md text-sm"})}),(0,t.jsx)(p.TableCell,{className:"py-0.5",children:(0,t.jsx)(x.default,{accessToken:e,value:S.targetModel,onChange:e=>$({...S,targetModel:e}),showLabel:!1,style:{height:"32px"}})}),(0,t.jsx)(p.TableCell,{className:"py-0.5 whitespace-nowrap",children:(0,t.jsxs)("div",{className:"flex space-x-2",children:[(0,t.jsx)("button",{onClick:k,className:"text-xs bg-blue-50 text-blue-600 px-2 py-1 rounded hover:bg-blue-100",children:"Save"}),(0,t.jsx)("button",{onClick:C,className:"text-xs bg-gray-50 text-gray-600 px-2 py-1 rounded hover:bg-gray-100",children:"Cancel"})]})})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(p.TableCell,{className:"py-0.5 text-sm text-gray-900",children:a.aliasName}),(0,t.jsx)(p.TableCell,{className:"py-0.5 text-sm text-gray-500",children:a.targetModel}),(0,t.jsx)(p.TableCell,{className:"py-0.5 whitespace-nowrap",children:(0,t.jsxs)("div",{className:"flex space-x-2",children:[(0,t.jsx)("button",{onClick:()=>{$({...a})},className:"text-xs bg-blue-50 text-blue-600 px-2 py-1 rounded hover:bg-blue-100",children:(0,t.jsx)(l.PencilIcon,{className:"w-3 h-3"})}),(0,t.jsx)("button",{onClick:()=>{var e;let t,s;return e=a.id,N(t=y.filter(t=>t.id!==e)),s={},void(t.forEach(e=>{s[e.aliasName]=e.targetModel}),v&&v(s),h.default.success("Alias deleted successfully"))},className:"text-xs bg-red-50 text-red-600 px-2 py-1 rounded hover:bg-red-100",children:(0,t.jsx)(r.TrashIcon,{className:"w-3 h-3"})})]})})]})},a.id)),0===y.length&&(0,t.jsx)(g.TableRow,{children:(0,t.jsx)(p.TableCell,{colSpan:3,className:"py-0.5 text-sm text-gray-500 text-center",children:"No aliases added yet. Add a new alias above."})})]})]})})}),b&&(0,t.jsxs)(i.Card,{children:[(0,t.jsx)(n.Title,{className:"mb-4",children:"Configuration Example"}),(0,t.jsx)(o.Text,{className:"text-gray-600 mb-4",children:"Here's how your current aliases would look in the config:"}),(0,t.jsx)("div",{className:"bg-gray-100 rounded-lg p-4 font-mono text-sm",children:(0,t.jsxs)("div",{className:"text-gray-700",children:["model_aliases:",0===Object.keys(M).length?(0,t.jsxs)("span",{className:"text-gray-500",children:[(0,t.jsx)("br",{}),"  # No aliases configured yet"]}):Object.entries(M).map(([e,a])=>(0,t.jsxs)("span",{children:[(0,t.jsx)("br",{}),'  "',e,'": "',a,'"']},e))]})})]})]})}])},384767,e=>{"use strict";var t=e.i(843476),a=e.i(599724),s=e.i(271645),l=e.i(389083);let r=s.forwardRef(function(e,t){return s.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),s.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 7v10c0 2.21 3.582 4 8 4s8-1.79 8-4V7M4 7c0 2.21 3.582 4 8 4s8-1.79 8-4M4 7c0-2.21 3.582-4 8-4s8 1.79 8 4m0 5c0 2.21-3.582 4-8 4s-8-1.79-8-4"}))});var i=e.i(764205);let n=function({vectorStores:e,accessToken:n}){let[o,c]=(0,s.useState)([]);return(0,s.useEffect)(()=>{(async()=>{if(n&&0!==e.length)try{let e=await (0,i.vectorStoreListCall)(n);e.data&&c(e.data.map(e=>({vector_store_id:e.vector_store_id,vector_store_name:e.vector_store_name})))}catch(e){console.error("Error fetching vector stores:",e)}})()},[n,e.length]),(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(r,{className:"h-4 w-4 text-blue-600"}),(0,t.jsx)(a.Text,{className:"font-semibold text-gray-900",children:"Vector Stores"}),(0,t.jsx)(l.Badge,{color:"blue",size:"xs",children:e.length})]}),e.length>0?(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:e.map((e,a)=>{let s;return(0,t.jsx)("div",{className:"inline-flex items-center px-3 py-1.5 rounded-lg bg-blue-50 border border-blue-200 text-blue-800 text-sm font-medium",children:(s=o.find(t=>t.vector_store_id===e))?`${s.vector_store_name||s.vector_store_id} (${s.vector_store_id})`:e},a)})}):(0,t.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-50 border border-gray-200",children:[(0,t.jsx)(r,{className:"h-4 w-4 text-gray-400"}),(0,t.jsx)(a.Text,{className:"text-gray-500 text-sm",children:"No vector stores configured"})]})]})},o=s.forwardRef(function(e,t){return s.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),s.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 12h14M5 12a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v4a2 2 0 01-2 2M5 12a2 2 0 00-2 2v4a2 2 0 002 2h14a2 2 0 002-2v-4a2 2 0 00-2-2m-2-4h.01M17 16h.01"}))});var c=e.i(871943),d=e.i(502547),m=e.i(592968);let u=function({mcpServers:r,mcpAccessGroups:n=[],mcpToolPermissions:u={},accessToken:g}){let[p,x]=(0,s.useState)([]),[h,f]=(0,s.useState)([]),[v,b]=(0,s.useState)(new Set);(0,s.useEffect)(()=>{(async()=>{if(g&&r.length>0)try{let e=await (0,i.fetchMCPServers)(g);e&&Array.isArray(e)?x(e):e.data&&Array.isArray(e.data)&&x(e.data)}catch(e){console.error("Error fetching MCP servers:",e)}})()},[g,r.length]),(0,s.useEffect)(()=>{(async()=>{if(g&&n.length>0)try{let t=await e.A(601236).then(e=>e.fetchMCPAccessGroups(g));f(Array.isArray(t)?t:t.data||[])}catch(e){console.error("Error fetching MCP access groups:",e)}})()},[g,n.length]);let y=[...r.map(e=>({type:"server",value:e})),...n.map(e=>({type:"accessGroup",value:e}))],N=y.length;return(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(o,{className:"h-4 w-4 text-blue-600"}),(0,t.jsx)(a.Text,{className:"font-semibold text-gray-900",children:"MCP Servers"}),(0,t.jsx)(l.Badge,{color:"blue",size:"xs",children:N})]}),N>0?(0,t.jsx)("div",{className:"max-h-[400px] overflow-y-auto space-y-2 pr-1",children:y.map((e,a)=>{let s="server"===e.type?u[e.value]:void 0,l=s&&s.length>0,r=v.has(e.value);return(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{onClick:()=>{var t;return l&&(t=e.value,void b(e=>{let a=new Set(e);return a.has(t)?a.delete(t):a.add(t),a}))},className:`flex items-center gap-3 py-2 px-3 rounded-lg border border-gray-200 transition-all ${l?"cursor-pointer hover:bg-gray-50 hover:border-gray-300":"bg-white"}`,children:[(0,t.jsx)("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:"server"===e.type?(0,t.jsx)(m.Tooltip,{title:`Full ID: ${e.value}`,placement:"top",children:(0,t.jsxs)("div",{className:"inline-flex items-center gap-2 min-w-0",children:[(0,t.jsx)("span",{className:"inline-block w-1.5 h-1.5 bg-blue-500 rounded-full flex-shrink-0"}),(0,t.jsx)("span",{className:"text-sm font-medium text-gray-900 truncate",children:(e=>{let t=p.find(t=>t.server_id===e);if(t){let a=e.length>7?`${e.slice(0,3)}...${e.slice(-4)}`:e;return`${t.alias} (${a})`}return e})(e.value)})]})}):(0,t.jsxs)("div",{className:"inline-flex items-center gap-2 min-w-0",children:[(0,t.jsx)("span",{className:"inline-block w-1.5 h-1.5 bg-green-500 rounded-full flex-shrink-0"}),(0,t.jsx)("span",{className:"text-sm font-medium text-gray-900 truncate",children:e.value}),(0,t.jsx)("span",{className:"ml-1 px-1.5 py-0.5 text-[9px] font-semibold text-green-600 bg-green-50 border border-green-200 rounded uppercase tracking-wide flex-shrink-0",children:"Group"})]})}),l&&(0,t.jsxs)("div",{className:"flex items-center gap-1 flex-shrink-0 whitespace-nowrap",children:[(0,t.jsx)("span",{className:"text-xs font-medium text-gray-600",children:s.length}),(0,t.jsx)("span",{className:"text-xs text-gray-500",children:1===s.length?"tool":"tools"}),r?(0,t.jsx)(c.ChevronDownIcon,{className:"h-3.5 w-3.5 text-gray-400 ml-0.5"}):(0,t.jsx)(d.ChevronRightIcon,{className:"h-3.5 w-3.5 text-gray-400 ml-0.5"})]})]}),l&&r&&(0,t.jsx)("div",{className:"ml-4 pl-4 border-l-2 border-blue-200 pb-1",children:(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5",children:s.map((e,a)=>(0,t.jsx)("span",{className:"inline-flex items-center px-2.5 py-1 rounded-lg bg-blue-50 border border-blue-200 text-blue-800 text-xs font-medium",children:e},a))})})]},a)})}):(0,t.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-50 border border-gray-200",children:[(0,t.jsx)(o,{className:"h-4 w-4 text-gray-400"}),(0,t.jsx)(a.Text,{className:"text-gray-500 text-sm",children:"No MCP servers or access groups configured"})]})]})},g=s.forwardRef(function(e,t){return s.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),s.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z"}))}),p=function({agents:e,agentAccessGroups:r=[],accessToken:n}){let[o,c]=(0,s.useState)([]);(0,s.useEffect)(()=>{(async()=>{if(n&&e.length>0)try{let e=await (0,i.getAgentsList)(n);e&&e.agents&&Array.isArray(e.agents)&&c(e.agents)}catch(e){console.error("Error fetching agents:",e)}})()},[n,e.length]);let d=[...e.map(e=>({type:"agent",value:e})),...r.map(e=>({type:"accessGroup",value:e}))],u=d.length;return(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(g,{className:"h-4 w-4 text-purple-600"}),(0,t.jsx)(a.Text,{className:"font-semibold text-gray-900",children:"Agents"}),(0,t.jsx)(l.Badge,{color:"purple",size:"xs",children:u})]}),u>0?(0,t.jsx)("div",{className:"max-h-[400px] overflow-y-auto space-y-2 pr-1",children:d.map((e,a)=>(0,t.jsx)("div",{className:"space-y-2",children:(0,t.jsx)("div",{className:"flex items-center gap-3 py-2 px-3 rounded-lg border border-gray-200 bg-white",children:(0,t.jsx)("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:"agent"===e.type?(0,t.jsx)(m.Tooltip,{title:`Full ID: ${e.value}`,placement:"top",children:(0,t.jsxs)("div",{className:"inline-flex items-center gap-2 min-w-0",children:[(0,t.jsx)("span",{className:"inline-block w-1.5 h-1.5 bg-purple-500 rounded-full flex-shrink-0"}),(0,t.jsx)("span",{className:"text-sm font-medium text-gray-900 truncate",children:(e=>{let t=o.find(t=>t.agent_id===e);if(t){let a=e.length>7?`${e.slice(0,3)}...${e.slice(-4)}`:e;return`${t.agent_name} (${a})`}return e})(e.value)})]})}):(0,t.jsxs)("div",{className:"inline-flex items-center gap-2 min-w-0",children:[(0,t.jsx)("span",{className:"inline-block w-1.5 h-1.5 bg-green-500 rounded-full flex-shrink-0"}),(0,t.jsx)("span",{className:"text-sm font-medium text-gray-900 truncate",children:e.value}),(0,t.jsx)("span",{className:"ml-1 px-1.5 py-0.5 text-[9px] font-semibold text-green-600 bg-green-50 border border-green-200 rounded uppercase tracking-wide flex-shrink-0",children:"Group"})]})})})},a))}):(0,t.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-50 border border-gray-200",children:[(0,t.jsx)(g,{className:"h-4 w-4 text-gray-400"}),(0,t.jsx)(a.Text,{className:"text-gray-500 text-sm",children:"No agents or access groups configured"})]})]})};e.s(["default",0,function({objectPermission:e,variant:s="card",className:l="",accessToken:r}){let i=e?.vector_stores||[],o=e?.mcp_servers||[],c=e?.mcp_access_groups||[],d=e?.mcp_tool_permissions||{},m=e?.agents||[],g=e?.agent_access_groups||[],x=(0,t.jsxs)("div",{className:"card"===s?"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6":"space-y-4",children:[(0,t.jsx)(n,{vectorStores:i,accessToken:r}),(0,t.jsx)(u,{mcpServers:o,mcpAccessGroups:c,mcpToolPermissions:d,accessToken:r}),(0,t.jsx)(p,{agents:m,agentAccessGroups:g,accessToken:r})]});return"card"===s?(0,t.jsxs)("div",{className:`bg-white border border-gray-200 rounded-lg p-6 ${l}`,children:[(0,t.jsx)("div",{className:"flex items-center gap-2 mb-6",children:(0,t.jsxs)("div",{children:[(0,t.jsx)(a.Text,{className:"font-semibold text-gray-900",children:"Object Permissions"}),(0,t.jsx)(a.Text,{className:"text-xs text-gray-500",children:"Access control for Vector Stores and MCP Servers"})]})}),x]}):(0,t.jsxs)("div",{className:`${l}`,children:[(0,t.jsx)(a.Text,{className:"font-medium text-gray-900 mb-3",children:"Object Permissions"}),x]})}],384767)}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/1532edb438ed84bb.js b/litellm/proxy/_experimental/out/_next/static/chunks/1532edb438ed84bb.js deleted file mode 100644 index 8d138308ef6..00000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/1532edb438ed84bb.js +++ /dev/null @@ -1,13 +0,0 @@ -(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,245094,e=>{"use strict";e.i(247167);var t=e.i(931067),n=e.i(271645);let a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M516 673c0 4.4 3.4 8 7.5 8h185c4.1 0 7.5-3.6 7.5-8v-48c0-4.4-3.4-8-7.5-8h-185c-4.1 0-7.5 3.6-7.5 8v48zm-194.9 6.1l192-161c3.8-3.2 3.8-9.1 0-12.3l-192-160.9A7.95 7.95 0 00308 351v62.7c0 2.4 1 4.6 2.9 6.1L420.7 512l-109.8 92.2a8.1 8.1 0 00-2.9 6.1V673c0 6.8 7.9 10.5 13.1 6.1zM880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z"}}]},name:"code",theme:"outlined"};var r=e.i(9583),l=n.forwardRef(function(e,l){return n.createElement(r.default,(0,t.default)({},e,{ref:l,icon:a}))});e.s(["CodeOutlined",0,l],245094)},245704,e=>{"use strict";e.i(247167);var t=e.i(931067),n=e.i(271645);let 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"};var r=e.i(9583),l=n.forwardRef(function(e,l){return n.createElement(r.default,(0,t.default)({},e,{ref:l,icon:a}))});e.s(["CheckCircleOutlined",0,l],245704)},850627,e=>{"use strict";e.i(247167);var t=e.i(271645),n=e.i(343794),a=e.i(209428),r=e.i(211577),l=e.i(8211),o=e.i(410160),u=e.i(392221),i=e.i(175066),c=e.i(914949),s=e.i(929123),d=e.i(883110),f=e.i(931067),v=e.i(703923),g=e.i(174080);function m(e,t,n,a){var r=(t-n)/(a-n),l={};switch(e){case"rtl":l.right="".concat(100*r,"%"),l.transform="translateX(50%)";break;case"btt":l.bottom="".concat(100*r,"%"),l.transform="translateY(50%)";break;case"ttb":l.top="".concat(100*r,"%"),l.transform="translateY(-50%)";break;default:l.left="".concat(100*r,"%"),l.transform="translateX(-50%)"}return l}function h(e,t){return Array.isArray(e)?e[t]:e}var b=e.i(404948),p=t.createContext({min:0,max:0,direction:"ltr",step:1,includedStart:0,includedEnd:0,tabIndex:0,keyboard:!0,styles:{},classNames:{}}),C=t.createContext({}),k=["prefixCls","value","valueIndex","onStartMove","onDelete","style","render","dragging","draggingDelete","onOffsetChange","onChangeComplete","onFocus","onMouseEnter"],y=t.forwardRef(function(e,l){var o,u=e.prefixCls,i=e.value,c=e.valueIndex,s=e.onStartMove,d=e.onDelete,g=e.style,C=e.render,y=e.dragging,x=e.draggingDelete,E=e.onOffsetChange,S=e.onChangeComplete,$=e.onFocus,M=e.onMouseEnter,w=(0,v.default)(e,k),O=t.useContext(p),B=O.min,R=O.max,D=O.direction,j=O.disabled,H=O.keyboard,P=O.range,F=O.tabIndex,N=O.ariaLabelForHandle,I=O.ariaLabelledByForHandle,L=O.ariaRequired,T=O.ariaValueTextFormatterForHandle,q=O.styles,A=O.classNames,z="".concat(u,"-handle"),V=function(e){j||s(e,c)},W=m(D,i,B,R),X={};null!==c&&(X={tabIndex:j?null:h(F,c),role:"slider","aria-valuemin":B,"aria-valuemax":R,"aria-valuenow":i,"aria-disabled":j,"aria-label":h(N,c),"aria-labelledby":h(I,c),"aria-required":h(L,c),"aria-valuetext":null==(o=h(T,c))?void 0:o(i),"aria-orientation":"ltr"===D||"rtl"===D?"horizontal":"vertical",onMouseDown:V,onTouchStart:V,onFocus:function(e){null==$||$(e,c)},onMouseEnter:function(e){M(e,c)},onKeyDown:function(e){if(!j&&H){var t=null;switch(e.which||e.keyCode){case b.default.LEFT:t="ltr"===D||"btt"===D?-1:1;break;case b.default.RIGHT:t="ltr"===D||"btt"===D?1:-1;break;case b.default.UP:t="ttb"!==D?1:-1;break;case b.default.DOWN:t="ttb"!==D?-1:1;break;case b.default.HOME:t="min";break;case b.default.END:t="max";break;case b.default.PAGE_UP:t=2;break;case b.default.PAGE_DOWN:t=-2;break;case b.default.BACKSPACE:case b.default.DELETE:null==d||d(c)}null!==t&&(e.preventDefault(),E(t,c))}},onKeyUp:function(e){switch(e.which||e.keyCode){case b.default.LEFT:case b.default.RIGHT:case b.default.UP:case b.default.DOWN:case b.default.HOME:case b.default.END:case b.default.PAGE_UP:case b.default.PAGE_DOWN:null==S||S()}}});var G=t.createElement("div",(0,f.default)({ref:l,className:(0,n.default)(z,(0,r.default)((0,r.default)((0,r.default)({},"".concat(z,"-").concat(c+1),null!==c&&P),"".concat(z,"-dragging"),y),"".concat(z,"-dragging-delete"),x),A.handle),style:(0,a.default)((0,a.default)((0,a.default)({},W),g),q.handle)},X,w));return C&&(G=C(G,{index:c,prefixCls:u,value:i,dragging:y,draggingDelete:x})),G}),x=["prefixCls","style","onStartMove","onOffsetChange","values","handleRender","activeHandleRender","draggingIndex","draggingDelete","onFocus"],E=t.forwardRef(function(e,n){var r=e.prefixCls,l=e.style,o=e.onStartMove,i=e.onOffsetChange,c=e.values,s=e.handleRender,d=e.activeHandleRender,m=e.draggingIndex,b=e.draggingDelete,p=e.onFocus,C=(0,v.default)(e,x),k=t.useRef({}),E=t.useState(!1),S=(0,u.default)(E,2),$=S[0],M=S[1],w=t.useState(-1),O=(0,u.default)(w,2),B=O[0],R=O[1],D=function(e){R(e),M(!0)};t.useImperativeHandle(n,function(){return{focus:function(e){var t;null==(t=k.current[e])||t.focus()},hideHelp:function(){(0,g.flushSync)(function(){M(!1)})}}});var j=(0,a.default)({prefixCls:r,onStartMove:o,onOffsetChange:i,render:s,onFocus:function(e,t){D(t),null==p||p(e)},onMouseEnter:function(e,t){D(t)}},C);return t.createElement(t.Fragment,null,c.map(function(e,n){var a=m===n;return t.createElement(y,(0,f.default)({ref:function(e){e?k.current[n]=e:delete k.current[n]},dragging:a,draggingDelete:a&&b,style:h(l,n),key:n,value:e,valueIndex:n},j))}),d&&$&&t.createElement(y,(0,f.default)({key:"a11y"},j,{value:c[B],valueIndex:null,dragging:-1!==m,draggingDelete:b,render:d,style:{pointerEvents:"none"},tabIndex:null,"aria-hidden":!0})))});let S=function(e){var l=e.prefixCls,o=e.style,u=e.children,i=e.value,c=e.onClick,s=t.useContext(p),d=s.min,f=s.max,v=s.direction,g=s.includedStart,h=s.includedEnd,b=s.included,C="".concat(l,"-text"),k=m(v,i,d,f);return t.createElement("span",{className:(0,n.default)(C,(0,r.default)({},"".concat(C,"-active"),b&&g<=i&&i<=h)),style:(0,a.default)((0,a.default)({},k),o),onMouseDown:function(e){e.stopPropagation()},onClick:function(){c(i)}},u)},$=function(e){var n=e.prefixCls,a=e.marks,r=e.onClick,l="".concat(n,"-mark");return a.length?t.createElement("div",{className:l},a.map(function(e){var n=e.value,a=e.style,o=e.label;return t.createElement(S,{key:n,prefixCls:l,style:a,value:n,onClick:r},o)})):null},M=function(e){var l=e.prefixCls,o=e.value,u=e.style,i=e.activeStyle,c=t.useContext(p),s=c.min,d=c.max,f=c.direction,v=c.included,g=c.includedStart,h=c.includedEnd,b="".concat(l,"-dot"),C=v&&g<=o&&o<=h,k=(0,a.default)((0,a.default)({},m(f,o,s,d)),"function"==typeof u?u(o):u);return C&&(k=(0,a.default)((0,a.default)({},k),"function"==typeof i?i(o):i)),t.createElement("span",{className:(0,n.default)(b,(0,r.default)({},"".concat(b,"-active"),C)),style:k})},w=function(e){var n=e.prefixCls,a=e.marks,r=e.dots,l=e.style,o=e.activeStyle,u=t.useContext(p),i=u.min,c=u.max,s=u.step,d=t.useMemo(function(){var e=new Set;if(a.forEach(function(t){e.add(t.value)}),r&&null!==s)for(var t=i;t<=c;)e.add(t),t+=s;return Array.from(e)},[i,c,s,r,a]);return t.createElement("div",{className:"".concat(n,"-step")},d.map(function(e){return t.createElement(M,{prefixCls:n,key:e,value:e,style:l,activeStyle:o})}))},O=function(e){var l=e.prefixCls,o=e.style,u=e.start,i=e.end,c=e.index,s=e.onStartMove,d=e.replaceCls,f=t.useContext(p),v=f.direction,g=f.min,m=f.max,h=f.disabled,b=f.range,C=f.classNames,k="".concat(l,"-track"),y=(u-g)/(m-g),x=(i-g)/(m-g),E=function(e){!h&&s&&s(e,-1)},S={};switch(v){case"rtl":S.right="".concat(100*y,"%"),S.width="".concat(100*x-100*y,"%");break;case"btt":S.bottom="".concat(100*y,"%"),S.height="".concat(100*x-100*y,"%");break;case"ttb":S.top="".concat(100*y,"%"),S.height="".concat(100*x-100*y,"%");break;default:S.left="".concat(100*y,"%"),S.width="".concat(100*x-100*y,"%")}var $=d||(0,n.default)(k,(0,r.default)((0,r.default)({},"".concat(k,"-").concat(c+1),null!==c&&b),"".concat(l,"-track-draggable"),s),C.track);return t.createElement("div",{className:$,style:(0,a.default)((0,a.default)({},S),o),onMouseDown:E,onTouchStart:E})},B=function(e){var r=e.prefixCls,l=e.style,o=e.values,u=e.startPoint,i=e.onStartMove,c=t.useContext(p),s=c.included,d=c.range,f=c.min,v=c.styles,g=c.classNames,m=t.useMemo(function(){if(!d){if(0===o.length)return[];var e=null!=u?u:f,t=o[0];return[{start:Math.min(e,t),end:Math.max(e,t)}]}for(var n=[],a=0;a130&&g=0&&en},[en,eN]),eL=t.useMemo(function(){return Object.keys(ev||{}).map(function(e){var n=ev[e],a={value:Number(e)};return n&&"object"===(0,o.default)(n)&&!t.isValidElement(n)&&("label"in n||"style"in n)?(a.style=n.style,a.label=n.label):a.label=n,a}).filter(function(e){var t=e.label;return t||"number"==typeof t}).sort(function(e,t){return e.value-t.value})},[ev]),eT=(v=void 0===ee||ee,g=t.useCallback(function(e){return Math.max(eP,Math.min(eF,e))},[eP,eF]),m=t.useCallback(function(e){if(null!==eN){var t=eP+Math.round((g(e)-eP)/eN)*eN,n=function(e){return(String(e).split(".")[1]||"").length},a=Math.max(n(eN),n(eF),n(eP)),r=Number(t.toFixed(a));return eP<=r&&r<=eF?r:null}return null},[eN,eP,eF,g]),h=t.useCallback(function(e){var t=g(e),n=eL.map(function(e){return e.value});null!==eN&&n.push(m(e)),n.push(eP,eF);var a=n[0],r=eF-eP;return n.forEach(function(e){var n=Math.abs(t-e);n<=r&&(a=e,r=n)}),a},[eP,eF,eL,eN,g,m]),b=function e(t,n,a){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"unit";if("number"==typeof n){var o,u=t[a],i=u+n,c=[];eL.forEach(function(e){c.push(e.value)}),c.push(eP,eF),c.push(m(u));var s=n>0?1:-1;"unit"===r?c.push(m(u+s*eN)):c.push(m(i)),c=c.filter(function(e){return null!==e}).filter(function(e){return n<0?e<=u:e>=u}),"unit"===r&&(c=c.filter(function(e){return e!==u}));var d="unit"===r?u:i,f=Math.abs((o=c[0])-d);if(c.forEach(function(e){var t=Math.abs(e-d);t1){var v=(0,l.default)(t);return v[a]=o,e(v,n-s,a,r)}return o}return"min"===n?eP:"max"===n?eF:void 0},C=function(e,t,n){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"unit",r=e[n],l=b(e,t,n,a);return{value:l,changed:l!==r}},k=function(e){return null===eI&&0===e||"number"==typeof eI&&e3&&void 0!==arguments[3]?arguments[3]:"unit",r=e.map(h),l=r[n],o=b(r,t,n,a);if(r[n]=o,!1===v){var u=eI||0;n>0&&r[n-1]!==l&&(r[n]=Math.max(r[n],r[n-1]+u)),n0;d-=1)for(var f=!0;k(r[d]-r[d-1])&&f;){var g=C(r,-1,d-1);r[d-1]=g.value,f=g.changed}for(var m=r.length-1;m>0;m-=1)for(var p=!0;k(r[m]-r[m-1])&&p;){var y=C(r,-1,m-1);r[m-1]=y.value,p=y.changed}for(var x=0;x=0?K+1:2;for(a=a.slice(0,o);a.length=0&&eS.current.focus(e)}e8(null)},[e5]);var e9=t.useMemo(function(){return(!eD||null!==eN)&&eD},[eD,eN]),te=(0,i.default)(function(e,t){e3(e,t),null==J||J(eU(eY))}),tt=-1!==eZ;t.useEffect(function(){if(!tt){var e=eY.lastIndexOf(e0);eS.current.focus(e)}},[tt]);var tn=t.useMemo(function(){return(0,l.default)(e2).sort(function(e,t){return e-t})},[e2]),ta=t.useMemo(function(){return eB?[tn[0],tn[tn.length-1]]:[eP,tn[0]]},[tn,eB,eP]),tr=(0,u.default)(ta,2),tl=tr[0],to=tr[1];t.useImperativeHandle(f,function(){return{focus:function(){eS.current.focus(0)},blur:function(){var e,t=document.activeElement;null!=(e=e$.current)&&e.contains(t)&&(null==t||t.blur())}}}),t.useEffect(function(){I&&eS.current.focus(0)},[]);var tu=t.useMemo(function(){return{min:eP,max:eF,direction:eM,disabled:P,keyboard:N,step:eN,included:eo,includedStart:tl,includedEnd:to,range:eB,tabIndex:eC,ariaLabelForHandle:ek,ariaLabelledByForHandle:ey,ariaRequired:ex,ariaValueTextFormatterForHandle:eE,styles:R||{},classNames:O||{}}},[eP,eF,eM,P,N,eN,eo,tl,to,eB,eC,ek,ey,ex,eE,R,O]);return t.createElement(p.Provider,{value:tu},t.createElement("div",{ref:e$,className:(0,n.default)(x,S,(0,r.default)((0,r.default)((0,r.default)((0,r.default)({},"".concat(x,"-disabled"),P),"".concat(x,"-vertical"),er),"".concat(x,"-horizontal"),!er),"".concat(x,"-with-marks"),eL.length)),style:M,onMouseDown:function(e){e.preventDefault();var t,n=e$.current.getBoundingClientRect(),a=n.width,r=n.height,l=n.left,o=n.top,u=n.bottom,i=n.right,c=e.clientX,s=e.clientY;switch(eM){case"btt":t=(u-s)/r;break;case"ttb":t=(s-o)/r;break;case"rtl":t=(i-c)/a;break;default:t=(c-l)/a}e4(eA(eP+t*(eF-eP)),e)},id:D},t.createElement("div",{className:(0,n.default)("".concat(x,"-rail"),null==O?void 0:O.rail),style:(0,a.default)((0,a.default)({},es),null==R?void 0:R.rail)}),!1!==eb&&t.createElement(B,{prefixCls:x,style:ei,values:eY,startPoint:eu,onStartMove:e9?te:void 0}),t.createElement(w,{prefixCls:x,marks:eL,dots:eg,style:ed,activeStyle:ef}),t.createElement(E,{ref:eS,prefixCls:x,style:ec,values:e2,draggingIndex:eZ,draggingDelete:e1,onStartMove:te,onOffsetChange:function(e,t){if(!P){var n=ez(eY,e,t);null==J||J(eU(eY)),eK(n.values),e8(n.value)}},onFocus:L,onBlur:T,handleRender:em,activeHandleRender:eh,onChangeComplete:e_,onDelete:eR?function(e){if(!P&&eR&&!(eY.length<=ej)){var t=(0,l.default)(eY);t.splice(e,1),null==J||J(eU(t)),eK(t);var n=Math.max(0,e-1);eS.current.hideHelp(),eS.current.focus(n)}}:void 0}),t.createElement($,{prefixCls:x,marks:eL,onClick:e4})))}),P=e.i(963188),F=e.i(937328);let N=(0,t.createContext)({});var I=e.i(611935),L=e.i(491816);let T=t.forwardRef((e,n)=>{let{open:a,draggingDelete:r,value:l}=e,o=(0,t.useRef)(null),u=a&&!r,i=(0,t.useRef)(null);function c(){P.default.cancel(i.current),i.current=null}return t.useEffect(()=>(u?i.current=(0,P.default)(()=>{var e;null==(e=o.current)||e.forceAlign(),i.current=null}):c(),c),[u,e.title,l]),t.createElement(L.default,Object.assign({ref:(0,I.composeRef)(o,n)},e,{open:u}))});e.i(296059);var q=e.i(915654);e.i(262370);var A=e.i(135551),z=e.i(183293),V=e.i(246422),W=e.i(838378);let X=(e,t)=>{let{componentCls:n,railSize:a,handleSize:r,dotSize:l,marginFull:o,calc:u}=e,i=t?"width":"height",c=t?"height":"width",s=t?"insetBlockStart":"insetInlineStart",d=t?"top":"insetInlineStart",f=u(a).mul(3).sub(r).div(2).equal(),v=u(r).sub(a).div(2).equal(),g=t?{borderWidth:`${(0,q.unit)(v)} 0`,transform:`translateY(${(0,q.unit)(u(v).mul(-1).equal())})`}:{borderWidth:`0 ${(0,q.unit)(v)}`,transform:`translateX(${(0,q.unit)(e.calc(v).mul(-1).equal())})`};return{[t?"paddingBlock":"paddingInline"]:a,[c]:u(a).mul(3).equal(),[`${n}-rail`]:{[i]:"100%",[c]:a},[`${n}-track,${n}-tracks`]:{[c]:a},[`${n}-track-draggable`]:Object.assign({},g),[`${n}-handle`]:{[s]:f},[`${n}-mark`]:{insetInlineStart:0,top:0,[d]:u(a).mul(3).add(t?0:o).equal(),[i]:"100%"},[`${n}-step`]:{insetInlineStart:0,top:0,[d]:a,[i]:"100%",[c]:a},[`${n}-dot`]:{position:"absolute",[s]:u(a).sub(l).div(2).equal()}}},G=(0,V.genStyleHooks)("Slider",e=>{let t=(0,W.mergeToken)(e,{marginPart:e.calc(e.controlHeight).sub(e.controlSize).div(2).equal(),marginFull:e.calc(e.controlSize).div(2).equal(),marginPartWithMark:e.calc(e.controlHeightLG).sub(e.controlSize).equal()});return[(e=>{let{componentCls:t,antCls:n,controlSize:a,dotSize:r,marginFull:l,marginPart:o,colorFillContentHover:u,handleColorDisabled:i,calc:c,handleSize:s,handleSizeHover:d,handleActiveColor:f,handleActiveOutlineColor:v,handleLineWidth:g,handleLineWidthHover:m,motionDurationMid:h}=e;return{[t]:Object.assign(Object.assign({},(0,z.resetComponent)(e)),{position:"relative",height:a,margin:`${(0,q.unit)(o)} ${(0,q.unit)(l)}`,padding:0,cursor:"pointer",touchAction:"none","&-vertical":{margin:`${(0,q.unit)(l)} ${(0,q.unit)(o)}`},[`${t}-rail`]:{position:"absolute",backgroundColor:e.railBg,borderRadius:e.borderRadiusXS,transition:`background-color ${h}`},[`${t}-track,${t}-tracks`]:{position:"absolute",transition:`background-color ${h}`},[`${t}-track`]:{backgroundColor:e.trackBg,borderRadius:e.borderRadiusXS},[`${t}-track-draggable`]:{boxSizing:"content-box",backgroundClip:"content-box",border:"solid rgba(0,0,0,0)"},"&:hover":{[`${t}-rail`]:{backgroundColor:e.railHoverBg},[`${t}-track`]:{backgroundColor:e.trackHoverBg},[`${t}-dot`]:{borderColor:u},[`${t}-handle::after`]:{boxShadow:`0 0 0 ${(0,q.unit)(g)} ${e.colorPrimaryBorderHover}`},[`${t}-dot-active`]:{borderColor:e.dotActiveBorderColor}},[`${t}-handle`]:{position:"absolute",width:s,height:s,outline:"none",userSelect:"none","&-dragging-delete":{opacity:0},"&::before":{content:'""',position:"absolute",insetInlineStart:c(g).mul(-1).equal(),insetBlockStart:c(g).mul(-1).equal(),width:c(s).add(c(g).mul(2)).equal(),height:c(s).add(c(g).mul(2)).equal(),backgroundColor:"transparent"},"&::after":{content:'""',position:"absolute",insetBlockStart:0,insetInlineStart:0,width:s,height:s,backgroundColor:e.colorBgElevated,boxShadow:`0 0 0 ${(0,q.unit)(g)} ${e.handleColor}`,outline:"0px solid transparent",borderRadius:"50%",cursor:"pointer",transition:` - inset-inline-start ${h}, - inset-block-start ${h}, - width ${h}, - height ${h}, - box-shadow ${h}, - outline ${h} - `},"&:hover, &:active, &:focus":{"&::before":{insetInlineStart:c(d).sub(s).div(2).add(m).mul(-1).equal(),insetBlockStart:c(d).sub(s).div(2).add(m).mul(-1).equal(),width:c(d).add(c(m).mul(2)).equal(),height:c(d).add(c(m).mul(2)).equal()},"&::after":{boxShadow:`0 0 0 ${(0,q.unit)(m)} ${f}`,outline:`6px solid ${v}`,width:d,height:d,insetInlineStart:e.calc(s).sub(d).div(2).equal(),insetBlockStart:e.calc(s).sub(d).div(2).equal()}}},[`&-lock ${t}-handle`]:{"&::before, &::after":{transition:"none"}},[`${t}-mark`]:{position:"absolute",fontSize:e.fontSize},[`${t}-mark-text`]:{position:"absolute",display:"inline-block",color:e.colorTextDescription,textAlign:"center",wordBreak:"keep-all",cursor:"pointer",userSelect:"none","&-active":{color:e.colorText}},[`${t}-step`]:{position:"absolute",background:"transparent",pointerEvents:"none"},[`${t}-dot`]:{position:"absolute",width:r,height:r,backgroundColor:e.colorBgElevated,border:`${(0,q.unit)(g)} solid ${e.dotBorderColor}`,borderRadius:"50%",cursor:"pointer",transition:`border-color ${e.motionDurationSlow}`,pointerEvents:"auto","&-active":{borderColor:e.dotActiveBorderColor}},[`&${t}-disabled`]:{cursor:"not-allowed",[`${t}-rail`]:{backgroundColor:`${e.railBg} !important`},[`${t}-track`]:{backgroundColor:`${e.trackBgDisabled} !important`},[` - ${t}-dot - `]:{backgroundColor:e.colorBgElevated,borderColor:e.trackBgDisabled,boxShadow:"none",cursor:"not-allowed"},[`${t}-handle::after`]:{backgroundColor:e.colorBgElevated,cursor:"not-allowed",width:s,height:s,boxShadow:`0 0 0 ${(0,q.unit)(g)} ${i}`,insetInlineStart:0,insetBlockStart:0},[` - ${t}-mark-text, - ${t}-dot - `]:{cursor:"not-allowed !important"}},[`&-tooltip ${n}-tooltip-inner`]:{minWidth:"unset"}})}})(t),(e=>{let{componentCls:t,marginPartWithMark:n}=e;return{[`${t}-horizontal`]:Object.assign(Object.assign({},X(e,!0)),{[`&${t}-with-marks`]:{marginBottom:n}})}})(t),(e=>{let{componentCls:t}=e;return{[`${t}-vertical`]:Object.assign(Object.assign({},X(e,!1)),{height:"100%"})}})(t)]},e=>{let t=e.controlHeightLG/4,n=e.controlHeightSM/2,a=e.lineWidth+1,r=e.lineWidth+1.5,l=e.colorPrimary,o=new A.FastColor(l).setA(.2).toRgbString();return{controlSize:t,railSize:4,handleSize:t,handleSizeHover:n,dotSize:8,handleLineWidth:a,handleLineWidthHover:r,railBg:e.colorFillTertiary,railHoverBg:e.colorFillSecondary,trackBg:e.colorPrimaryBorder,trackHoverBg:e.colorPrimaryBorderHover,handleColor:e.colorPrimaryBorder,handleActiveColor:l,handleActiveOutlineColor:o,handleColorDisabled:new A.FastColor(e.colorTextDisabled).onBackground(e.colorBgContainer).toHexString(),dotBorderColor:e.colorBorderSecondary,dotActiveBorderColor:e.colorPrimaryBorder,trackBgDisabled:e.colorBgContainerDisabled}});function Y(){let[e,n]=t.useState(!1),a=t.useRef(null),r=()=>{P.default.cancel(a.current)};return t.useEffect(()=>r,[]),[e,e=>{r(),e?n(e):a.current=(0,P.default)(()=>{n(e)})}]}var U=e.i(242064),K=function(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&0>t.indexOf(a)&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var r=0,a=Object.getOwnPropertySymbols(e);rt.indexOf(a[r])&&Object.prototype.propertyIsEnumerable.call(e,a[r])&&(n[a[r]]=e[a[r]]);return n};let _=t.default.forwardRef((e,a)=>{let{prefixCls:r,range:l,className:o,rootClassName:u,style:i,disabled:c,tooltipPrefixCls:s,tipFormatter:d,tooltipVisible:f,getTooltipPopupContainer:v,tooltipPlacement:g,tooltip:m={},onChangeComplete:h,classNames:b,styles:p}=e,C=K(e,["prefixCls","range","className","rootClassName","style","disabled","tooltipPrefixCls","tipFormatter","tooltipVisible","getTooltipPopupContainer","tooltipPlacement","tooltip","onChangeComplete","classNames","styles"]),{vertical:k}=e,{getPrefixCls:y,direction:x,className:E,style:S,classNames:$,styles:M,getPopupContainer:w}=(0,U.useComponentConfig)("slider"),O=t.default.useContext(F.default),{handleRender:B,direction:R}=t.default.useContext(N),D="rtl"===(R||x),[j,I]=Y(),[L,q]=Y(),A=Object.assign({},m),{open:z,placement:V,getPopupContainer:W,prefixCls:X,formatter:_}=A,J=null!=z?z:f,Q=(j||L)&&!1!==J,Z=_||null===_?_:d||null===d?d:e=>"number"==typeof e?e.toString():"",[ee,et]=Y(),en=(e,t)=>e||(t?D?"left":"right":"top"),ea=y("slider",r),[er,el,eo]=G(ea),eu=(0,n.default)(o,E,$.root,null==b?void 0:b.root,u,{[`${ea}-rtl`]:D,[`${ea}-lock`]:ee},el,eo);D&&!C.vertical&&(C.reverse=!C.reverse),t.default.useEffect(()=>{let e=()=>{(0,P.default)(()=>{q(!1)},1)};return document.addEventListener("mouseup",e),()=>{document.removeEventListener("mouseup",e)}},[]);let ei=l&&!J,ec=B||((e,n)=>{let{index:a}=n,r=e.props;function l(e,t,n){var a,l;n&&(null==(a=C[e])||a.call(C,t)),null==(l=r[e])||l.call(r,t)}let o=Object.assign(Object.assign({},r),{onMouseEnter:e=>{I(!0),l("onMouseEnter",e)},onMouseLeave:e=>{I(!1),l("onMouseLeave",e)},onMouseDown:e=>{q(!0),et(!0),l("onMouseDown",e)},onFocus:e=>{var t;q(!0),null==(t=C.onFocus)||t.call(C,e),l("onFocus",e,!0)},onBlur:e=>{var t;q(!1),null==(t=C.onBlur)||t.call(C,e),l("onBlur",e,!0)}}),u=t.default.cloneElement(e,o),i=(!!J||Q)&&null!==Z;return ei?u:t.default.createElement(T,Object.assign({},A,{prefixCls:y("tooltip",null!=X?X:s),title:Z?Z(n.value):"",value:n.value,open:i,placement:en(null!=V?V:g,k),key:a,classNames:{root:`${ea}-tooltip`},getPopupContainer:W||v||w}),u)}),es=ei?(e,n)=>{let a=t.default.cloneElement(e,{style:Object.assign(Object.assign({},e.props.style),{visibility:"hidden"})});return t.default.createElement(T,Object.assign({},A,{prefixCls:y("tooltip",null!=X?X:s),title:Z?Z(n.value):"",open:null!==Z&&Q,placement:en(null!=V?V:g,k),key:"tooltip",classNames:{root:`${ea}-tooltip`},getPopupContainer:W||v||w,draggingDelete:n.draggingDelete}),a)}:void 0,ed=Object.assign(Object.assign(Object.assign(Object.assign({},M.root),S),null==p?void 0:p.root),i),ef=Object.assign(Object.assign({},M.tracks),null==p?void 0:p.tracks),ev=(0,n.default)($.tracks,null==b?void 0:b.tracks);return er(t.default.createElement(H,Object.assign({},C,{classNames:Object.assign({handle:(0,n.default)($.handle,null==b?void 0:b.handle),rail:(0,n.default)($.rail,null==b?void 0:b.rail),track:(0,n.default)($.track,null==b?void 0:b.track)},ev?{tracks:ev}:{}),styles:Object.assign({handle:Object.assign(Object.assign({},M.handle),null==p?void 0:p.handle),rail:Object.assign(Object.assign({},M.rail),null==p?void 0:p.rail),track:Object.assign(Object.assign({},M.track),null==p?void 0:p.track)},Object.keys(ef).length?{tracks:ef}:{}),step:C.step,range:l,className:eu,style:ed,disabled:null!=c?c:O,ref:a,prefixCls:ea,handleRender:ec,activeHandleRender:es,onChangeComplete:e=>{null==h||h(e),et(!1)}})))});e.s(["Slider",0,_],850627)}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/165d00848f04c4c9.js b/litellm/proxy/_experimental/out/_next/static/chunks/165d00848f04c4c9.js deleted file mode 100644 index 30965bc352a..00000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/165d00848f04c4c9.js +++ /dev/null @@ -1,231 +0,0 @@ -(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,952683,e=>{"use strict";var t=e.i(843476),s=e.i(794357),a=e.i(111672),l=e.i(764205),r=e.i(135214),i=e.i(271645);let n=({setPage:e,defaultSelectedKey:s,sidebarCollapsed:n})=>{let{accessToken:o}=(0,r.default)(),[d,c]=(0,i.useState)(null),[m,u]=(0,i.useState)(!1);return(0,i.useEffect)(()=>{(async()=>{if(!o)return console.log("[SidebarProvider] No access token, skipping UI settings fetch");try{console.log("[SidebarProvider] Fetching UI settings from /get/ui_settings");let e=await (0,l.getUISettings)(o);console.log("[SidebarProvider] UI settings response:",e),e?.values?.enabled_ui_pages_internal_users!==void 0?(console.log("[SidebarProvider] Setting enabled pages:",e.values.enabled_ui_pages_internal_users),c(e.values.enabled_ui_pages_internal_users)):console.log("[SidebarProvider] No enabled_ui_pages_internal_users in response (all pages visible by default)"),e?.values?.enable_projects_ui!==void 0&&u(!!e.values.enable_projects_ui)}catch(e){console.error("[SidebarProvider] Failed to fetch UI settings:",e)}})()},[o]),(0,t.jsx)(a.default,{setPage:e,defaultSelectedKey:s,collapsed:n,enabledPagesInternalUsers:d,enableProjectsUI:m})};var o=e.i(161059),d=e.i(213970),c=e.i(105278),m=e.i(994388),u=e.i(212931),x=e.i(560445),p=e.i(808613),h=e.i(998573),g=e.i(199133),j=e.i(311451),y=e.i(280898),f=e.i(91739),b=e.i(262218),_=e.i(312361),v=e.i(826910),N=e.i(438957),w=e.i(983561),k=e.i(477189),C=e.i(827252),S=e.i(364769),T=e.i(355619),I=e.i(790848),F=e.i(362024),A=e.i(464571),P=e.i(646563),L=e.i(564897);let M={basic:{key:"basic",title:"Basic Information",defaultExpanded:!0,fields:[{name:"name",label:"Display Name",type:"text",required:!0,placeholder:"e.g., Customer Support Agent"},{name:"description",label:"Description",type:"textarea",required:!0,placeholder:"Describe what this agent does...",rows:3},{name:"url",label:"URL",type:"url",required:!1,placeholder:"http://localhost:9999/",tooltip:"Base URL where the agent is hosted (optional)"},{name:"version",label:"Version",type:"text",placeholder:"1.0.0",defaultValue:"1.0.0"},{name:"protocolVersion",label:"Protocol Version",type:"text",placeholder:"1.0",defaultValue:"1.0"}]},skills:{key:"skills",title:"Skills",fields:[{name:"skills",label:"Skills",type:"list",defaultValue:[]}]},capabilities:{key:"capabilities",title:"Capabilities",fields:[{name:"streaming",label:"Streaming",type:"switch",defaultValue:!1},{name:"pushNotifications",label:"Push Notifications",type:"switch"},{name:"stateTransitionHistory",label:"State Transition History",type:"switch"}]},optional:{key:"optional",title:"Optional Settings",fields:[{name:"iconUrl",label:"Icon URL",type:"url",placeholder:"https://example.com/icon.png"},{name:"documentationUrl",label:"Documentation URL",type:"url",placeholder:"https://docs.example.com"},{name:"supportsAuthenticatedExtendedCard",label:"Supports Authenticated Extended Card",type:"switch"}]},litellm:{key:"litellm",title:"LiteLLM Parameters",fields:[{name:"model",label:"Model (Optional)",type:"text"},{name:"make_public",label:"Make Public",type:"switch"}]},cost:{key:"cost",title:"Cost Configuration",fields:[{name:"cost_per_query",label:"Cost Per Query ($)",type:"text",placeholder:"0.0",tooltip:"Fixed cost per query"},{name:"input_cost_per_token",label:"Input Cost Per Token ($)",type:"text",placeholder:"0.000001",tooltip:"Cost per input token"},{name:"output_cost_per_token",label:"Output Cost Per Token ($)",type:"text",placeholder:"0.000002",tooltip:"Cost per output token"}]}},D="Skill ID",E=!0,O="e.g., hello_world",z="Skill Name",R=!0,B="e.g., Returns hello world",q="Description",$=!0,U="What this skill does",V=2,G="Tags (comma-separated)",H=!0,K="e.g., hello world, greeting",W="Examples (comma-separated)",Q="e.g., hi, hello world",Y=(e,t)=>{let s={agent_name:e.agent_name,agent_card_params:{protocolVersion:e.protocolVersion||"1.0",name:e.name||e.agent_name,description:e.description||"",url:e.url||"",version:e.version||"1.0.0",defaultInputModes:t?.agent_card_params?.defaultInputModes||["text"],defaultOutputModes:t?.agent_card_params?.defaultOutputModes||["text"],capabilities:{streaming:!0===e.streaming,...void 0!==e.pushNotifications&&{pushNotifications:e.pushNotifications},...void 0!==e.stateTransitionHistory&&{stateTransitionHistory:e.stateTransitionHistory}},skills:e.skills||[],...e.iconUrl&&{iconUrl:e.iconUrl},...e.documentationUrl&&{documentationUrl:e.documentationUrl},...void 0!==e.supportsAuthenticatedExtendedCard&&{supportsAuthenticatedExtendedCard:e.supportsAuthenticatedExtendedCard}}},a={};return e.model&&(a.model=e.model),void 0!==e.make_public&&(a.make_public=e.make_public),e.cost_per_query&&(a.cost_per_query=parseFloat(e.cost_per_query)),e.input_cost_per_token&&(a.input_cost_per_token=parseFloat(e.input_cost_per_token)),e.output_cost_per_token&&(a.output_cost_per_token=parseFloat(e.output_cost_per_token)),Object.keys(a).length>0&&(s.litellm_params=a),s},J=e=>{let t=e.agent_card_params?.skills?.map(e=>({...e,tags:e.tags,examples:e.examples||[]}))||[];return{agent_name:e.agent_name,name:e.agent_card_params?.name,description:e.agent_card_params?.description,url:e.agent_card_params?.url,version:e.agent_card_params?.version,protocolVersion:e.agent_card_params?.protocolVersion,streaming:e.agent_card_params?.capabilities?.streaming,pushNotifications:e.agent_card_params?.capabilities?.pushNotifications,stateTransitionHistory:e.agent_card_params?.capabilities?.stateTransitionHistory,skills:t,iconUrl:e.agent_card_params?.iconUrl,documentationUrl:e.agent_card_params?.documentationUrl,supportsAuthenticatedExtendedCard:e.agent_card_params?.supportsAuthenticatedExtendedCard,model:e.litellm_params?.model,make_public:e.litellm_params?.make_public,cost_per_query:e.litellm_params?.cost_per_query,input_cost_per_token:e.litellm_params?.input_cost_per_token,output_cost_per_token:e.litellm_params?.output_cost_per_token}},X=()=>(0,t.jsx)(t.Fragment,{children:M.cost.fields.map(e=>(0,t.jsx)(p.Form.Item,{label:e.label,name:e.name,tooltip:e.tooltip,children:(0,t.jsx)(j.Input,{placeholder:e.placeholder,type:"number",step:"0.000001"})},e.name))}),{Panel:Z}=F.Collapse,ee=({showAgentName:e=!0,visiblePanels:s})=>{let a=e=>!s||s.includes(e);return(0,t.jsxs)(t.Fragment,{children:[e&&(0,t.jsx)(p.Form.Item,{label:"Agent Name",name:"agent_name",rules:[{required:!0,message:"Please enter a unique agent name"}],tooltip:"Unique identifier for the agent",children:(0,t.jsx)(j.Input,{placeholder:"e.g., customer-support-agent"})}),(0,t.jsxs)(F.Collapse,{defaultActiveKey:["basic"],style:{marginBottom:16},children:[a(M.basic.key)&&(0,t.jsx)(Z,{header:`${M.basic.title} (Required)`,children:M.basic.fields.map(e=>(0,t.jsx)(p.Form.Item,{label:e.label,name:e.name,rules:e.required?[{required:!0,message:`Please enter ${e.label.toLowerCase()}`}]:void 0,tooltip:e.tooltip,children:"textarea"===e.type?(0,t.jsx)(j.Input.TextArea,{rows:e.rows,placeholder:e.placeholder}):(0,t.jsx)(j.Input,{placeholder:e.placeholder})},e.name))},M.basic.key),a(M.skills.key)&&(0,t.jsx)(Z,{header:`${M.skills.title} (Required)`,children:(0,t.jsx)(p.Form.List,{name:"skills",children:(e,{add:s,remove:a})=>(0,t.jsxs)(t.Fragment,{children:[e.map(e=>(0,t.jsxs)("div",{style:{marginBottom:16,padding:16,border:"1px solid #d9d9d9",borderRadius:4},children:[(0,t.jsx)(p.Form.Item,{...e,label:D,name:[e.name,"id"],rules:[{required:E,message:"Required"}],children:(0,t.jsx)(j.Input,{placeholder:O})}),(0,t.jsx)(p.Form.Item,{...e,label:z,name:[e.name,"name"],rules:[{required:R,message:"Required"}],children:(0,t.jsx)(j.Input,{placeholder:B})}),(0,t.jsx)(p.Form.Item,{...e,label:q,name:[e.name,"description"],rules:[{required:$,message:"Required"}],children:(0,t.jsx)(j.Input.TextArea,{rows:V,placeholder:U})}),(0,t.jsx)(p.Form.Item,{...e,label:G,name:[e.name,"tags"],rules:[{required:H,message:"Required"}],getValueFromEvent:e=>e.target.value.split(",").map(e=>e.trim()),getValueProps:e=>({value:Array.isArray(e)?e.join(", "):e}),children:(0,t.jsx)(j.Input,{placeholder:K})}),(0,t.jsx)(p.Form.Item,{...e,label:W,name:[e.name,"examples"],getValueFromEvent:e=>e.target.value.split(",").map(e=>e.trim()).filter(e=>e),getValueProps:e=>({value:Array.isArray(e)?e.join(", "):""}),children:(0,t.jsx)(j.Input,{placeholder:Q})}),(0,t.jsx)(A.Button,{type:"link",danger:!0,onClick:()=>a(e.name),icon:(0,t.jsx)(L.MinusCircleOutlined,{}),children:"Remove Skill"})]},e.key)),(0,t.jsx)(A.Button,{type:"dashed",onClick:()=>s(),icon:(0,t.jsx)(P.PlusOutlined,{}),style:{width:"100%"},children:"Add Skill"})]})})},M.skills.key),a(M.capabilities.key)&&(0,t.jsx)(Z,{header:M.capabilities.title,children:M.capabilities.fields.map(e=>(0,t.jsx)(p.Form.Item,{label:e.label,name:e.name,valuePropName:"checked",children:(0,t.jsx)(I.Switch,{})},e.name))},M.capabilities.key),a(M.optional.key)&&(0,t.jsx)(Z,{header:M.optional.title,children:M.optional.fields.map(e=>(0,t.jsx)(p.Form.Item,{label:e.label,name:e.name,valuePropName:"switch"===e.type?"checked":void 0,children:"switch"===e.type?(0,t.jsx)(I.Switch,{}):(0,t.jsx)(j.Input,{placeholder:e.placeholder})},e.name))},M.optional.key),a(M.cost.key)&&(0,t.jsx)(Z,{header:M.cost.title,children:(0,t.jsx)(X,{})},M.cost.key),a(M.litellm.key)&&(0,t.jsx)(Z,{header:M.litellm.title,children:M.litellm.fields.map(e=>(0,t.jsx)(p.Form.Item,{label:e.label,name:e.name,valuePropName:"switch"===e.type?"checked":void 0,children:"switch"===e.type?(0,t.jsx)(I.Switch,{}):(0,t.jsx)(j.Input,{placeholder:e.placeholder})},e.name))},M.litellm.key)]})]})},{Panel:et}=F.Collapse,es=(e,t)=>{let s={...t.litellm_params_template||{}};for(let a of t.credential_fields){let t=e[a.key];t&&!1!==a.include_in_litellm_params&&(s[a.key]=t)}if(e.cost_per_query&&(s.cost_per_query=parseFloat(e.cost_per_query)),e.input_cost_per_token&&(s.input_cost_per_token=parseFloat(e.input_cost_per_token)),e.output_cost_per_token&&(s.output_cost_per_token=parseFloat(e.output_cost_per_token)),t.model_template){let a=t.model_template;for(let s of t.credential_fields){let t=`{${s.key}}`;a.includes(t)&&e[s.key]&&(a=a.replace(t,e[s.key]))}s.model=a}return{agent_name:e.agent_name,agent_card_params:{protocolVersion:"1.0",name:e.display_name||e.agent_name,description:e.description||`${t.agent_type_display_name} agent`,url:e.api_base||"",version:"1.0.0",defaultInputModes:["text"],defaultOutputModes:["text"],capabilities:{streaming:!0},skills:[{id:"chat",name:"Chat",description:"General chat capability",tags:["chat","conversation"]}]},litellm_params:s}},ea=({agentTypeInfo:e})=>(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(p.Form.Item,{label:"Agent Name",name:"agent_name",rules:[{required:!0,message:"Please enter a unique agent name"}],tooltip:"Unique identifier for the agent",children:(0,t.jsx)(j.Input,{placeholder:"e.g., my-langgraph-agent"})}),(0,t.jsx)(p.Form.Item,{label:"Description",name:"description",tooltip:"Brief description of what this agent does",children:(0,t.jsx)(j.Input.TextArea,{rows:2,placeholder:"Describe what this agent does..."})}),e.credential_fields.map(e=>(0,t.jsx)(p.Form.Item,{label:e.label,name:e.key,rules:e.required?[{required:!0,message:`Please enter ${e.label}`}]:void 0,tooltip:e.tooltip,initialValue:e.default_value,children:"password"===e.field_type?(0,t.jsx)(j.Input.Password,{placeholder:e.placeholder||""}):"textarea"===e.field_type?(0,t.jsx)(j.Input.TextArea,{rows:3,placeholder:e.placeholder||""}):"select"===e.field_type&&e.options?(0,t.jsx)(g.Select,{placeholder:e.placeholder||"",children:e.options.map(e=>(0,t.jsx)(g.Select.Option,{value:e,children:e},e))}):(0,t.jsx)(j.Input,{placeholder:e.placeholder||""})},e.key)),(0,t.jsx)(F.Collapse,{style:{marginBottom:16},children:(0,t.jsx)(et,{header:M.cost.title,children:(0,t.jsx)(X,{})},M.cost.key)})]});var el=e.i(75921),er=e.i(390605);let{Step:ei}=y.Steps,en="custom",eo=({visible:e,onClose:s,accessToken:a,onSuccess:n})=>{let o,d,{userId:c,userRole:x}=(0,r.default)(),[I]=p.Form.useForm(),[F,A]=(0,i.useState)(0),[P,L]=(0,i.useState)(!1),[D,E]=(0,i.useState)("a2a"),[O,z]=(0,i.useState)([]),[R,B]=(0,i.useState)(!1),[q,$]=(0,i.useState)("create_new"),[U,V]=(0,i.useState)(""),[G,H]=(0,i.useState)([]),[K,W]=(0,i.useState)([]),[Q,J]=(0,i.useState)(null),[X,Z]=(0,i.useState)(!1),[et,eo]=(0,i.useState)([]),[ed,ec]=(0,i.useState)(!1),[em,eu]=(0,i.useState)(""),[ex,ep]=(0,i.useState)(null),[eh,eg]=(0,i.useState)(null);(0,i.useEffect)(()=>{(async()=>{B(!0);try{let e=await (0,l.getAgentCreateMetadata)();z(e)}catch(e){console.error("Error fetching agent metadata:",e)}finally{B(!1)}})()},[]),(0,i.useEffect)(()=>{2===F&&a&&0===K.length&&(async()=>{Z(!0);try{let e=await (0,l.keyListCall)(a,null,null,null,null,null,1,100);W(e?.keys||[])}catch(e){console.error("Error fetching keys:",e)}finally{Z(!1)}})()},[F,a]),(0,i.useEffect)(()=>{if(2!==F||!a||!c||!x)return;let e=!1;return ec(!0),(0,l.modelAvailableCall)(a,c,x).then(t=>{e||eo((t?.data??(Array.isArray(t)?t:[])).map(e=>e.id??e.model_name).filter(Boolean))}).catch(t=>{e||console.error("Error fetching models:",t)}).finally(()=>{e||ec(!1)}),()=>{e=!0}},[F,a,c,x]);let ej=O.find(e=>e.agent_type===D),ey=async()=>{try{if(0===F){await I.validateFields(["agent_name"]);let e=I.getFieldValue("agent_name");e&&!U&&V(`${e}-key`)}A(e=>e+1)}catch{}},ef=async()=>{if(!a)return void h.message.error("No access token available");L(!0);try{await I.validateFields();let e={...I.getFieldsValue(!0)},t=(e=>{if(D===en)return{agent_name:e.agent_name,agent_card_params:{protocolVersion:"1.0",name:e.agent_name,description:e.description||"",url:"",version:"1.0.0",defaultInputModes:["text"],defaultOutputModes:["text"],capabilities:{streaming:!1},skills:[]}};if("a2a"===D)return Y(e);if(ej?.use_a2a_form_fields){let t=Y(e);for(let s of(ej.litellm_params_template&&(t.litellm_params={...t.litellm_params,...ej.litellm_params_template}),ej.credential_fields)){let a=e[s.key];a&&!1!==s.include_in_litellm_params&&(t.litellm_params[s.key]=a)}return t}return ej?es(e,ej):null})(e);if(!t){h.message.error("Failed to build agent data"),L(!1);return}let s=e.allowed_mcp_servers_and_groups,r=e.mcp_tool_permissions||{};(s&&(s.servers?.length>0||s.accessGroups?.length>0)||Object.keys(r).length>0)&&(t.object_permission={},s?.servers?.length>0&&(t.object_permission.mcp_servers=s.servers),s?.accessGroups?.length>0&&(t.object_permission.mcp_access_groups=s.accessGroups),Object.keys(r).length>0&&(t.object_permission.mcp_tool_permissions=r));let i=await (0,l.createAgentCall)(a,t),o=i.agent_id,d=i.agent_name||e.agent_name||o;if(eu(d),"create_new"===q&&U){let e=await (0,l.keyCreateForAgentCall)(a,o,U,G);ep(e.key||null)}else if("existing_key"===q){if(!Q){h.message.error("Please select an existing key to assign"),L(!1);return}await (0,l.keyUpdateCall)(a,{key:Q,agent_id:o});let e=K.find(e=>e.token===Q);eg(e?.key_alias||Q.slice(0,12)+"…")}A(3),n()}catch(t){console.error("Error creating agent:",t);let e=t instanceof Error?t.message:String(t);h.message.error(e?`Failed to create agent: ${e}`:"Failed to create agent")}finally{L(!1)}},eb=()=>{I.resetFields(),E("a2a"),A(0),$("create_new"),V(""),H([]),J(null),eu(""),ep(null),eg(null),s()},e_=e=>{E(e),I.resetFields()},ev=D===en?null:ej?.logo_url||O.find(e=>"a2a"===e.agent_type)?.logo_url;return(0,t.jsx)(u.Modal,{title:(0,t.jsxs)("div",{className:"flex items-center space-x-3 pb-4 border-b border-gray-100",children:[ev&&F<1&&(0,t.jsx)("img",{src:ev,alt:"Agent",className:"w-6 h-6 object-contain"}),(0,t.jsx)("h2",{className:"text-xl font-semibold text-gray-900",children:"Add New Agent"})]}),open:e,onCancel:eb,footer:null,width:900,className:"top-8",styles:{body:{padding:"24px"},header:{padding:"24px 24px 0 24px",border:"none"}},children:(0,t.jsxs)("div",{className:"mt-4",children:[(0,t.jsxs)(y.Steps,{current:F,size:"small",className:"mb-8",children:[(0,t.jsx)(ei,{title:"Configure"}),(0,t.jsx)(ei,{title:"MCP Tools"}),(0,t.jsx)(ei,{title:"Assign Key"}),(0,t.jsx)(ei,{title:"Ready"})]}),(0,t.jsxs)(p.Form,{form:I,layout:"vertical",initialValues:"a2a"===D?{...(o={defaultInputModes:["text"],defaultOutputModes:["text"]},Object.values(M).forEach(e=>{e.fields.forEach(e=>{void 0!==e.defaultValue&&(o[e.name]=e.defaultValue)})}),o),allowed_mcp_servers_and_groups:{servers:[],accessGroups:[]},mcp_tool_permissions:{}}:{allowed_mcp_servers_and_groups:{servers:[],accessGroups:[]},mcp_tool_permissions:{}},className:"space-y-4",children:[0===F&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(p.Form.Item,{label:(0,t.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Agent Type"}),required:!0,tooltip:"Select the type of agent you want to create",children:(0,t.jsx)(g.Select,{value:D,onChange:e_,size:"large",style:{width:"100%"},optionLabelProp:"label",dropdownRender:e=>(0,t.jsxs)(t.Fragment,{children:[e,(0,t.jsx)(_.Divider,{style:{margin:"4px 0"}}),(0,t.jsxs)("div",{className:"px-2 py-1",children:[(0,t.jsx)("div",{className:"text-xs text-gray-400 font-medium mb-1 uppercase tracking-wide px-2",children:"Not listed?"}),(0,t.jsxs)("div",{className:`flex items-center gap-3 px-2 py-2 rounded cursor-pointer transition-colors ${D===en?"bg-amber-50":"hover:bg-amber-50"}`,onClick:()=>e_(en),children:[(0,t.jsx)(k.AppstoreOutlined,{className:"text-amber-600 text-lg"}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"font-medium text-amber-700",children:"Custom / Other"}),(0,t.jsx)(b.Tag,{color:"orange",style:{fontSize:10,padding:"0 4px"},children:"GENERIC"})]}),(0,t.jsx)("div",{className:"text-xs text-amber-600",children:"For agents that don't follow a standard protocol — just needs a virtual key"})]})]})]})]}),children:O.map(e=>(0,t.jsx)(g.Select.Option,{value:e.agent_type,label:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("img",{src:e.logo_url||"",alt:"",className:"w-4 h-4 object-contain"}),(0,t.jsx)("span",{children:e.agent_type_display_name})]}),children:(0,t.jsxs)("div",{className:"flex items-center gap-3 py-1",children:[(0,t.jsx)("img",{src:e.logo_url||"",alt:e.agent_type_display_name,className:"w-5 h-5 object-contain"}),(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"font-medium",children:e.agent_type_display_name}),e.description&&(0,t.jsx)("div",{className:"text-xs text-gray-500",children:e.description})]})]})},e.agent_type))})}),(0,t.jsx)("div",{className:"mt-4",children:D===en?(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)(p.Form.Item,{label:"Agent Name",name:"agent_name",rules:[{required:!0,message:"Please enter an agent name"}],children:(0,t.jsx)(j.Input,{placeholder:"e.g. my-custom-agent"})}),(0,t.jsx)(p.Form.Item,{label:"Description",name:"description",children:(0,t.jsx)(j.Input.TextArea,{placeholder:"Describe what this agent does…",rows:3})})]}):"a2a"===D?(0,t.jsx)(ee,{showAgentName:!0}):ej?.use_a2a_form_fields?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(ee,{showAgentName:!0}),ej.credential_fields.length>0&&(0,t.jsxs)("div",{className:"mt-4 p-4 border border-gray-200 rounded-lg",children:[(0,t.jsxs)("h4",{className:"text-sm font-medium text-gray-700 mb-3",children:[ej.agent_type_display_name," Settings"]}),ej.credential_fields.map(e=>(0,t.jsx)(p.Form.Item,{label:e.label,name:e.key,rules:e.required?[{required:!0,message:`Please enter ${e.label}`}]:void 0,tooltip:e.tooltip,initialValue:e.default_value,children:"password"===e.field_type?(0,t.jsx)(j.Input.Password,{placeholder:e.placeholder||""}):(0,t.jsx)(j.Input,{placeholder:e.placeholder||""})},e.key))]})]}):ej?(0,t.jsx)(ea,{agentTypeInfo:ej}):null})]}),1===F&&(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)("p",{className:"text-sm text-gray-600",children:"Optionally restrict which MCP servers and tools this agent can use. Leave empty to allow all (subject to key/team permissions)."}),(0,t.jsx)(p.Form.Item,{label:(0,t.jsxs)("span",{children:["Allowed MCP Servers"," ",(0,t.jsx)(C.InfoCircleOutlined,{title:"Select which MCP servers or access groups this agent can access",style:{marginLeft:"4px"}})]}),name:"allowed_mcp_servers_and_groups",initialValue:{servers:[],accessGroups:[]},children:(0,t.jsx)(el.default,{onChange:e=>I.setFieldValue("allowed_mcp_servers_and_groups",e),value:I.getFieldValue("allowed_mcp_servers_and_groups")||{servers:[],accessGroups:[]},accessToken:a??"",placeholder:"Select MCP servers or access groups (optional)"})}),(0,t.jsx)(p.Form.Item,{name:"mcp_tool_permissions",initialValue:{},hidden:!0,children:(0,t.jsx)(j.Input,{type:"hidden"})}),(0,t.jsx)(p.Form.Item,{noStyle:!0,shouldUpdate:(e,t)=>e.allowed_mcp_servers_and_groups!==t.allowed_mcp_servers_and_groups||e.mcp_tool_permissions!==t.mcp_tool_permissions,children:()=>(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsx)(er.default,{accessToken:a??"",selectedServers:I.getFieldValue("allowed_mcp_servers_and_groups")?.servers??[],toolPermissions:I.getFieldValue("mcp_tool_permissions")??{},onChange:e=>I.setFieldsValue({mcp_tool_permissions:e})})})})]}),2===F&&(d=I.getFieldValue("agent_name")||"your-agent",(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"flex justify-center mb-6",children:(0,t.jsx)(b.Tag,{icon:(0,t.jsx)(w.RobotOutlined,{}),color:"purple",className:"px-3 py-1 text-sm",children:d})}),(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)("div",{className:`p-4 border-2 rounded-lg cursor-pointer transition-colors ${"create_new"===q?"border-indigo-600 bg-indigo-50":"border-gray-200 bg-white hover:border-gray-300"}`,onClick:()=>$("create_new"),children:(0,t.jsxs)("div",{className:"flex items-start justify-between",children:[(0,t.jsxs)("div",{className:"flex items-start gap-3 flex-1",children:[(0,t.jsx)(f.Radio,{value:"create_new",checked:"create_new"===q,onChange:()=>$("create_new")}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(N.KeyOutlined,{className:"text-indigo-600"}),(0,t.jsx)("span",{className:"font-medium text-gray-900",children:"Create a new key for this agent"})]}),(0,t.jsx)("p",{className:"text-sm text-gray-500 mt-1",children:"A dedicated key scoped to this agent."}),"create_new"===q&&(0,t.jsxs)("div",{className:"mt-3 space-y-3",onClick:e=>e.stopPropagation(),children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-sm text-gray-600 block mb-1",children:"Key Name"}),(0,t.jsx)(j.Input,{value:U,onChange:e=>V(e.target.value),placeholder:"e.g. my-agent-key"})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("label",{className:"text-sm text-gray-600 block mb-1",children:["Allowed Models ",(0,t.jsx)("span",{className:"text-gray-400",children:"(optional — leave empty for all models)"})]}),(0,t.jsx)(g.Select,{mode:"tags",style:{width:"100%"},placeholder:ed?"Loading models...":"e.g. gpt-4o, claude-3-5-sonnet",value:G,onChange:H,tokenSeparators:[","],loading:ed,showSearch:!0,options:et.map(e=>({label:(0,T.getModelDisplayName)(e),value:e}))})]})]})]})]}),(0,t.jsx)(b.Tag,{color:"green",children:"Recommended"})]})}),(0,t.jsx)("div",{className:`p-4 border-2 rounded-lg cursor-pointer transition-colors ${"existing_key"===q?"border-indigo-600 bg-indigo-50":"border-gray-200 bg-white hover:border-gray-300"}`,onClick:()=>$("existing_key"),children:(0,t.jsxs)("div",{className:"flex items-start gap-3",children:[(0,t.jsx)(f.Radio,{value:"existing_key",checked:"existing_key"===q,onChange:()=>$("existing_key")}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(N.KeyOutlined,{className:"text-gray-500"}),(0,t.jsx)("span",{className:"font-medium text-gray-900",children:"Assign an existing key"})]}),(0,t.jsx)("p",{className:"text-sm text-gray-500 mt-1",children:"Re-assign a key you already have to this agent."}),"existing_key"===q&&(0,t.jsx)("div",{className:"mt-3",onClick:e=>e.stopPropagation(),children:(0,t.jsx)(g.Select,{showSearch:!0,style:{width:"100%"},placeholder:"Search by key name…",loading:X,value:Q,onChange:e=>J(e),filterOption:(e,t)=>(t?.label??"").toLowerCase().includes(e.toLowerCase()),options:K.map(e=>({label:e.key_alias||e.token?.slice(0,12)+"…",value:e.token}))})})]})]})})]}),(0,t.jsx)("div",{className:"text-center mt-4",children:(0,t.jsx)("button",{type:"button",className:"text-sm text-gray-500 underline hover:text-gray-700",onClick:()=>$("skip"),children:"Skip for now — I'll assign a key later"})})]})),3===F&&(0,t.jsxs)("div",{className:"text-center py-6",children:[(0,t.jsx)(v.CheckCircleFilled,{className:"text-5xl text-green-500 mb-4",style:{fontSize:48}}),(0,t.jsx)("h3",{className:"text-xl font-semibold text-gray-900 mb-2",children:"Agent Created!"}),(0,t.jsx)("div",{className:"flex justify-center mb-4",children:(0,t.jsx)(b.Tag,{icon:(0,t.jsx)(w.RobotOutlined,{}),color:"purple",className:"px-3 py-1 text-sm",children:em})}),ex&&(0,t.jsx)("div",{className:"mt-4 text-left max-w-md mx-auto",children:(0,t.jsx)(S.default,{apiKey:ex})}),eh&&(0,t.jsxs)("p",{className:"text-sm text-gray-600 mt-2",children:["Key ",(0,t.jsx)("span",{className:"font-medium",children:eh})," has been assigned to this agent."]}),!ex&&!eh&&"skip"===q&&(0,t.jsx)("p",{className:"text-sm text-gray-500 mt-2",children:"No key assigned. You can create one from the Virtual Keys page."})]})]}),(0,t.jsxs)("div",{className:"flex items-center justify-between pt-6 border-t border-gray-100 mt-6",children:[(0,t.jsx)("div",{children:F>0&&F<3&&(0,t.jsx)("button",{type:"button",onClick:()=>{A(e=>Math.max(0,e-1))},className:"text-sm text-gray-600 border border-gray-300 rounded px-4 py-2 hover:bg-gray-50",children:"← Back"})}),(0,t.jsxs)("div",{className:"flex gap-3",children:[F<3&&(0,t.jsx)(m.Button,{variant:"secondary",onClick:eb,children:"Cancel"}),0===F&&(0,t.jsx)(m.Button,{variant:"primary",onClick:ey,children:"Next →"}),1===F&&(0,t.jsx)(m.Button,{variant:"primary",onClick:ey,children:"Next →"}),2===F&&(0,t.jsx)(m.Button,{variant:"primary",loading:P,onClick:ef,children:P?"Creating...":"Create Agent →"}),3===F&&(0,t.jsx)(m.Button,{variant:"primary",onClick:eb,children:"Done"})]})]})]})})};var ed=e.i(981339),ec=e.i(175712),em=e.i(906579),eu=e.i(592968),ex=e.i(166406),ep=e.i(285027),eh=e.i(955135);let eg=({agent:e,keyInfo:s,onAgentClick:a,onDeleteClick:l,isAdmin:r})=>{let i=e.agent_card_params?.description||"No description",n=e.agent_card_params?.url,o=s?.has_key??!1,d=o?(0,t.jsx)(em.Badge,{status:"success",text:"Active"}):(0,t.jsx)(em.Badge,{status:"warning",text:"Needs Setup"});return(0,t.jsxs)(ec.Card,{hoverable:!0,className:"h-full flex flex-col",styles:{body:{flex:1,display:"flex",flexDirection:"column"}},onClick:()=>a(e.agent_id),children:[(0,t.jsxs)("div",{className:"flex items-start justify-between gap-2 mb-2",children:[(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,t.jsx)("span",{className:"font-medium text-gray-900 truncate",children:e.agent_name}),(0,t.jsx)(eu.Tooltip,{title:"Copy Agent ID",children:(0,t.jsx)(ex.CopyOutlined,{onClick:t=>{var s;return s=e.agent_id,void(t.stopPropagation(),navigator.clipboard.writeText(s))},className:"cursor-pointer text-gray-400 hover:text-blue-500 text-xs shrink-0"})})]}),(0,t.jsx)("div",{className:"mt-1",children:d})]}),r&&l&&(0,t.jsx)(eu.Tooltip,{title:"Delete agent",children:(0,t.jsx)(A.Button,{type:"text",size:"small",danger:!0,icon:(0,t.jsx)(eh.DeleteOutlined,{}),onClick:t=>{t.stopPropagation(),l(e.agent_id,e.agent_name)},className:"shrink-0 -mr-1"})})]}),(0,t.jsx)("p",{className:"text-sm text-gray-600 line-clamp-2 flex-1 mb-3",children:i}),n&&(0,t.jsx)("p",{className:"text-xs text-gray-500 truncate mb-2",title:n,children:n}),(0,t.jsx)("div",{className:"mt-auto pt-3 border-t border-gray-100 text-xs",children:o?(0,t.jsxs)("div",{className:"flex items-center gap-1.5 text-gray-600",children:[(0,t.jsx)(N.KeyOutlined,{}),(0,t.jsx)("span",{children:s?.key_alias||s?.token_prefix||"Key assigned"})]}):(0,t.jsxs)("div",{className:"flex items-center gap-1.5 text-amber-600",children:[(0,t.jsx)(ep.WarningOutlined,{}),(0,t.jsx)("span",{children:"No key assigned"})]})})]})},ej=({agentsList:e,keyInfoMap:s,isLoading:a,onDeleteClick:l,accessToken:r,onAgentUpdated:i,isAdmin:n,onAgentClick:o})=>a?(0,t.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:[1,2,3].map(e=>(0,t.jsx)(ed.Skeleton,{active:!0,paragraph:{rows:3}},e))}):e&&0!==e.length?(0,t.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:e.map(e=>(0,t.jsx)(eg,{agent:e,keyInfo:s[e.agent_id],onAgentClick:o,onDeleteClick:n?l:void 0,accessToken:r,isAdmin:n,onAgentUpdated:i},e.agent_id))}):(0,t.jsx)("div",{className:"rounded-lg border border-gray-200 bg-gray-50/50 py-12 text-center",children:(0,t.jsx)("p",{className:"text-gray-500",children:n?"No agents found. Create one to get started.":"No agents found. Contact an admin to create agents."})});var ey=e.i(708347),ef=e.i(304967),eb=e.i(629569),e_=e.i(599724),ev=e.i(197647),eN=e.i(653824),ew=e.i(881073),ek=e.i(404206),eC=e.i(723731),eS=e.i(482725),eT=e.i(869216),eI=e.i(530212);let eF=({agent:e})=>{let s=e.litellm_params;return s?.cost_per_query===void 0&&s?.input_cost_per_token===void 0&&s?.output_cost_per_token===void 0?null:(0,t.jsxs)("div",{style:{marginTop:24},children:[(0,t.jsx)(eb.Title,{children:"Cost Configuration"}),(0,t.jsxs)(eT.Descriptions,{bordered:!0,column:1,style:{marginTop:16},children:[void 0!==s.cost_per_query&&(0,t.jsxs)(eT.Descriptions.Item,{label:"Cost Per Query",children:["$",s.cost_per_query]}),void 0!==s.input_cost_per_token&&(0,t.jsxs)(eT.Descriptions.Item,{label:"Input Cost Per Token",children:["$",s.input_cost_per_token]}),void 0!==s.output_cost_per_token&&(0,t.jsxs)(eT.Descriptions.Item,{label:"Output Cost Per Token",children:["$",s.output_cost_per_token]})]})]})},eA=e=>{let t=e.litellm_params?.model||"",s=e.litellm_params?.custom_llm_provider;return"langgraph"===s?"langgraph":"azure_ai"===s?"azure_ai_foundry":"bedrock"===s?"bedrock_agentcore":t.startsWith("langgraph/")?"langgraph":t.startsWith("azure_ai/agents/")?"azure_ai_foundry":t.startsWith("bedrock/agentcore/")?"bedrock_agentcore":"a2a"},eP=(e,t)=>{let s={agent_name:e.agent_name,description:e.agent_card_params?.description||""};for(let a of t.credential_fields)if(!1!==a.include_in_litellm_params)s[a.key]=e.litellm_params?.[a.key]||a.default_value||"";else if(t.model_template&&e.litellm_params?.model){let l=e.litellm_params.model,r=t.model_template.split("/"),i=l.split("/");r.forEach((e,t)=>{e===`{${a.key}}`&&i[t]&&(s[a.key]=i[t])})}return s.cost_per_query=e.litellm_params?.cost_per_query,s.input_cost_per_token=e.litellm_params?.input_cost_per_token,s.output_cost_per_token=e.litellm_params?.output_cost_per_token,s},eL=({agentId:e,onClose:s,accessToken:a,isAdmin:r})=>{let[n,o]=(0,i.useState)(null),[d,c]=(0,i.useState)(!0),[u,x]=(0,i.useState)(!1),[g,y]=(0,i.useState)(!1),[f]=p.Form.useForm(),[b,_]=(0,i.useState)([]),[v,N]=(0,i.useState)("a2a");(0,i.useEffect)(()=>{(async()=>{try{let e=await (0,l.getAgentCreateMetadata)();_(e)}catch(e){console.error("Error fetching agent metadata:",e)}})()},[]),(0,i.useEffect)(()=>{w()},[e,a]);let w=async()=>{if(a){c(!0);try{let t=await (0,l.getAgentInfo)(a,e);o(t);let s=eA(t);if(N(s),"a2a"===s)f.setFieldsValue(J(t));else{let e=b.find(e=>e.agent_type===s);e?f.setFieldsValue(eP(t,e)):f.setFieldsValue(J(t))}}catch(e){console.error("Error fetching agent info:",e),h.message.error("Failed to load agent information")}finally{c(!1)}}};(0,i.useEffect)(()=>{if(n&&b.length>0){let e=eA(n);if("a2a"!==e){let t=b.find(t=>t.agent_type===e);t&&f.setFieldsValue(eP(n,t))}}},[b,n]);let k=b.find(e=>e.agent_type===v),C=async t=>{if(a&&n){y(!0);try{let s;"a2a"===v?s=Y(t,n):k?(s=es(t,k)).agent_name=t.agent_name:s=Y(t,n),await (0,l.patchAgentCall)(a,e,s),h.message.success("Agent updated successfully"),x(!1),w()}catch(e){console.error("Error updating agent:",e),h.message.error("Failed to update agent")}finally{y(!1)}}};if(d)return(0,t.jsx)("div",{className:"p-4",children:(0,t.jsx)("div",{className:"flex justify-center items-center h-64",children:(0,t.jsx)(eS.Spin,{size:"large"})})});if(!n)return(0,t.jsxs)("div",{className:"p-4",children:[(0,t.jsx)("div",{className:"text-center",children:"Agent not found"}),(0,t.jsx)(m.Button,{onClick:s,className:"mt-4",children:"Back to Agents List"})]});let S=e=>e?new Date(e).toLocaleString():"-";return(0,t.jsxs)("div",{className:"p-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(m.Button,{icon:eI.ArrowLeftIcon,variant:"light",onClick:s,className:"mb-4",children:"Back to Agents"}),(0,t.jsx)(eb.Title,{children:n.agent_name||"Unnamed Agent"}),(0,t.jsx)(e_.Text,{className:"text-gray-500 font-mono",children:n.agent_id})]}),(0,t.jsxs)(eN.TabGroup,{children:[(0,t.jsxs)(ew.TabList,{className:"mb-4",children:[(0,t.jsx)(ev.Tab,{children:"Overview"},"overview"),r?(0,t.jsx)(ev.Tab,{children:"Settings"},"settings"):(0,t.jsx)(t.Fragment,{})]}),(0,t.jsxs)(eC.TabPanels,{children:[(0,t.jsxs)(ek.TabPanel,{children:[(0,t.jsxs)(eT.Descriptions,{bordered:!0,column:1,children:[(0,t.jsx)(eT.Descriptions.Item,{label:"Agent ID",children:n.agent_id}),(0,t.jsx)(eT.Descriptions.Item,{label:"Agent Name",children:n.agent_name}),(0,t.jsx)(eT.Descriptions.Item,{label:"Display Name",children:n.agent_card_params?.name||"-"}),(0,t.jsx)(eT.Descriptions.Item,{label:"Description",children:n.agent_card_params?.description||"-"}),(0,t.jsx)(eT.Descriptions.Item,{label:"URL",children:n.agent_card_params?.url||"-"}),(0,t.jsx)(eT.Descriptions.Item,{label:"Version",children:n.agent_card_params?.version||"-"}),(0,t.jsx)(eT.Descriptions.Item,{label:"Protocol Version",children:n.agent_card_params?.protocolVersion||"-"}),(0,t.jsx)(eT.Descriptions.Item,{label:"Streaming",children:n.agent_card_params?.capabilities?.streaming?"Yes":"No"}),n.agent_card_params?.capabilities?.pushNotifications&&(0,t.jsx)(eT.Descriptions.Item,{label:"Push Notifications",children:"Yes"}),n.agent_card_params?.capabilities?.stateTransitionHistory&&(0,t.jsx)(eT.Descriptions.Item,{label:"State Transition History",children:"Yes"}),(0,t.jsxs)(eT.Descriptions.Item,{label:"Skills",children:[n.agent_card_params?.skills?.length||0," configured"]}),n.litellm_params?.model&&(0,t.jsx)(eT.Descriptions.Item,{label:"Model",children:n.litellm_params.model}),n.litellm_params?.make_public!==void 0&&(0,t.jsx)(eT.Descriptions.Item,{label:"Make Public",children:n.litellm_params.make_public?"Yes":"No"}),n.agent_card_params?.iconUrl&&(0,t.jsx)(eT.Descriptions.Item,{label:"Icon URL",children:n.agent_card_params.iconUrl}),n.agent_card_params?.documentationUrl&&(0,t.jsx)(eT.Descriptions.Item,{label:"Documentation URL",children:n.agent_card_params.documentationUrl}),(0,t.jsx)(eT.Descriptions.Item,{label:"Created At",children:S(n.created_at)}),(0,t.jsx)(eT.Descriptions.Item,{label:"Updated At",children:S(n.updated_at)})]}),n.object_permission&&(n.object_permission.mcp_servers?.length||n.object_permission.mcp_access_groups?.length||n.object_permission.mcp_tool_permissions&&Object.keys(n.object_permission.mcp_tool_permissions).length>0)&&(0,t.jsxs)("div",{style:{marginTop:24},children:[(0,t.jsx)(eb.Title,{children:"MCP Tool Permissions"}),(0,t.jsxs)(eT.Descriptions,{bordered:!0,column:1,style:{marginTop:16},children:[n.object_permission.mcp_servers&&n.object_permission.mcp_servers.length>0&&(0,t.jsx)(eT.Descriptions.Item,{label:"MCP Servers",children:n.object_permission.mcp_servers.join(", ")}),n.object_permission.mcp_access_groups&&n.object_permission.mcp_access_groups.length>0&&(0,t.jsx)(eT.Descriptions.Item,{label:"MCP Access Groups",children:n.object_permission.mcp_access_groups.join(", ")}),n.object_permission.mcp_tool_permissions&&Object.keys(n.object_permission.mcp_tool_permissions).length>0&&(0,t.jsx)(eT.Descriptions.Item,{label:"Tool permissions per server",children:(0,t.jsx)("div",{className:"space-y-1",children:Object.entries(n.object_permission.mcp_tool_permissions).map(([e,s])=>(0,t.jsxs)("div",{children:[(0,t.jsxs)("span",{className:"font-medium",children:[e,":"]})," ",Array.isArray(s)?s.join(", "):String(s)]},e))})})]})]}),(0,t.jsx)(eF,{agent:n}),n.agent_card_params?.skills&&n.agent_card_params.skills.length>0&&(0,t.jsxs)("div",{style:{marginTop:24},children:[(0,t.jsx)(eb.Title,{children:"Skills"}),(0,t.jsx)(eT.Descriptions,{bordered:!0,column:1,style:{marginTop:16},children:n.agent_card_params.skills.map((e,s)=>(0,t.jsx)(eT.Descriptions.Item,{label:e.name||`Skill ${s+1}`,children:(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("strong",{children:"ID:"})," ",e.id]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("strong",{children:"Description:"})," ",e.description]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("strong",{children:"Tags:"})," ",Array.isArray(e.tags)?e.tags.join(", "):e.tags]}),e.examples&&e.examples.length>0&&(0,t.jsxs)("div",{children:[(0,t.jsx)("strong",{children:"Examples:"})," ",Array.isArray(e.examples)?e.examples.join(", "):e.examples]})]})},s))})]})]}),r&&(0,t.jsx)(ek.TabPanel,{children:(0,t.jsxs)(ef.Card,{children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,t.jsx)(eb.Title,{children:"Agent Settings"}),!u&&(0,t.jsx)(m.Button,{onClick:()=>x(!0),children:"Edit Settings"})]}),u?(0,t.jsxs)(p.Form,{form:f,layout:"vertical",onFinish:C,children:[(0,t.jsx)(p.Form.Item,{label:"Agent ID",children:(0,t.jsx)(j.Input,{value:n.agent_id,disabled:!0})}),"a2a"===v?(0,t.jsx)(ee,{showAgentName:!0}):k?(0,t.jsx)(ea,{agentTypeInfo:k}):(0,t.jsx)(ee,{showAgentName:!0}),(0,t.jsxs)("div",{className:"flex justify-end gap-2 mt-6",children:[(0,t.jsx)(A.Button,{onClick:()=>{x(!1),w()},children:"Cancel"}),(0,t.jsx)(m.Button,{loading:g,children:"Save Changes"})]})]}):(0,t.jsx)(e_.Text,{children:'Click "Edit Settings" to modify agent configuration.'})]})})]})]})]})};var eM=e.i(727749);let eD=({accessToken:e,userRole:s})=>{let[a,r]=(0,i.useState)([]),[n,o]=(0,i.useState)({}),[d,c]=(0,i.useState)(!1),[p,h]=(0,i.useState)(!1),[g,j]=(0,i.useState)(!1),[y,f]=(0,i.useState)(null),[b,_]=(0,i.useState)(null),v=!!s&&(0,ey.isAdminRole)(s),N=async()=>{if(e){h(!0);try{let t=await (0,l.getAgentsList)(e);r(t.agents||[])}catch(e){console.error("Error fetching agents:",e)}finally{h(!1)}}},w=async()=>{if(e)try{let{keys:t=[]}=await (0,l.keyListCall)(e,null,null,null,null,null,1,500),s={};for(let e of t){let t=e.agent_id;t&&!s[t]&&(s[t]={has_key:!0,key_alias:e.key_alias,token_prefix:e.token?`${e.token.slice(0,8)}…`:void 0})}o(s)}catch(e){console.error("Error fetching keys for agents:",e)}};(0,i.useEffect)(()=>{N()},[e]),(0,i.useEffect)(()=>{e&&a.length>0?w():0===a.length&&o({})},[e,a.length]);let k=async()=>{if(y&&e){j(!0);try{await (0,l.deleteAgentCall)(e,y.id),eM.default.success(`Agent "${y.name}" deleted successfully`),N()}catch(e){console.error("Error deleting agent:",e),eM.default.fromBackend("Failed to delete agent")}finally{j(!1),f(null)}}};return(0,t.jsxs)("div",{className:"w-full mx-auto flex-auto overflow-y-auto m-8 p-2",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-2 mb-4",children:[(0,t.jsx)("h1",{className:"text-2xl font-bold",children:"Agents"}),(0,t.jsx)("p",{className:"text-sm text-gray-600",children:"List of A2A-spec agents that are available to be used in your organization. Go to AI Hub, to make agents public."}),(0,t.jsx)(x.Alert,{message:"Why do agents need keys?",description:"Keys scope access to an agent and allow it to call MCP tools. Assign a key when creating an agent or from the Virtual Keys page.",type:"info",showIcon:!0,className:"mb-3"}),v&&(0,t.jsx)("div",{className:"mt-2",children:(0,t.jsx)(m.Button,{onClick:()=>{b&&_(null),c(!0)},disabled:!e,children:"+ Add New Agent"})})]}),b?(0,t.jsx)(eL,{agentId:b,onClose:()=>_(null),accessToken:e,isAdmin:v}):(0,t.jsx)(ej,{agentsList:a,keyInfoMap:n,isLoading:p,onDeleteClick:(e,t)=>{f({id:e,name:t})},accessToken:e,onAgentUpdated:N,isAdmin:v,onAgentClick:e=>_(e)}),(0,t.jsx)(eo,{visible:d,onClose:()=>{c(!1)},accessToken:e,onSuccess:()=>{N()}}),y&&(0,t.jsxs)(u.Modal,{title:"Delete Agent",open:null!==y,onOk:k,onCancel:()=>{f(null)},confirmLoading:g,okText:"Delete",okButtonProps:{danger:!0},children:[(0,t.jsxs)("p",{children:["Are you sure you want to delete agent: ",y.name,"?"]}),(0,t.jsx)("p",{children:"This action cannot be undone."})]})]})};var eE=e.i(646050),eO=e.i(559061),ez=e.i(704308),eR=e.i(584578),eB=e.i(936578),eq=e.i(677667),e$=e.i(898667),eU=e.i(130643),eV=e.i(779241),eG=e.i(752978),eH=e.i(68155),eK=e.i(591935);let eW=i.forwardRef(function(e,t){return i.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),i.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"}))});var eQ=e.i(836991),eY=e.i(269200),eJ=e.i(427612),eX=e.i(496020),eZ=e.i(64848),e0=e.i(942232),e1=e.i(977572);function e2({data:e,columns:s,isLoading:a=!1,loadingMessage:l="Loading...",emptyMessage:r="No data",getRowKey:i}){return(0,t.jsxs)(eY.Table,{children:[(0,t.jsx)(eJ.TableHead,{children:(0,t.jsx)(eX.TableRow,{children:s.map((e,s)=>(0,t.jsx)(eZ.TableHeaderCell,{style:{width:e.width},children:e.header},s))})}),(0,t.jsx)(e0.TableBody,{children:a?(0,t.jsx)(eX.TableRow,{children:(0,t.jsx)(e1.TableCell,{colSpan:s.length,className:"text-center",children:(0,t.jsx)(e_.Text,{className:"text-gray-500",children:l})})}):e.length>0?e.map((e,a)=>(0,t.jsx)(eX.TableRow,{children:s.map((s,a)=>(0,t.jsx)(e1.TableCell,{children:s.cell?s.cell(e):String(e[s.accessor]??"")},a))},i?i(e,a):a)):(0,t.jsx)(eX.TableRow,{children:(0,t.jsx)(e1.TableCell,{colSpan:s.length,className:"text-center",children:(0,t.jsx)(e_.Text,{className:"text-gray-500",children:r})})})})]})}var e4=e.i(916925);let e5=e=>{let t=Object.keys(e4.provider_map).find(t=>e4.provider_map[t]===e);if(t){let e=e4.Providers[t],s=e4.providerLogoMap[e];return{displayName:e,logo:s,enumKey:t}}return{displayName:e,logo:"",enumKey:null}},e6=e=>e4.provider_map[e]||null,e3=(e,t)=>{let s=e.target,a=s.parentElement;if(a){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),a.replaceChild(e,s)}},e8=({discountConfig:e,onDiscountChange:s,onRemoveProvider:a})=>{let[l,r]=(0,i.useState)(null),[n,o]=(0,i.useState)(""),d=e=>{let t=parseFloat(n);!isNaN(t)&&t>=0&&t<=100&&s(e,(t/100).toString()),r(null),o("")},c=()=>{r(null),o("")},m=Object.entries(e).map(([e,t])=>({provider:e,discount:t})).sort((e,t)=>{let s=e5(e.provider).displayName,a=e5(t.provider).displayName;return s.localeCompare(a)});return(0,t.jsx)(e2,{data:m,columns:[{header:"Provider",cell:e=>{let{displayName:s,logo:a}=e5(e.provider);return(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[a&&(0,t.jsx)("img",{src:a,alt:`${s} logo`,className:"w-5 h-5",onError:e=>e3(e,s)}),(0,t.jsx)("span",{className:"font-medium",children:s})]})}},{header:"Discount Percentage",cell:e=>(0,t.jsx)("div",{className:"flex items-center gap-2",children:l===e.provider?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(eV.TextInput,{value:n,onValueChange:o,onKeyDown:t=>{var s;return s=e.provider,void("Enter"===t.key?d(s):"Escape"===t.key&&c())},placeholder:"5",className:"w-20",autoFocus:!0}),(0,t.jsx)("span",{className:"text-gray-600",children:"%"}),(0,t.jsx)(eG.Icon,{icon:eW,size:"sm",onClick:()=>d(e.provider),className:"cursor-pointer text-green-600 hover:text-green-700"}),(0,t.jsx)(eG.Icon,{icon:eQ.XIcon,size:"sm",onClick:c,className:"cursor-pointer text-gray-600 hover:text-gray-700"})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(e_.Text,{className:"font-medium",children:[(100*e.discount).toFixed(1),"%"]}),(0,t.jsx)(eG.Icon,{icon:eK.PencilAltIcon,size:"sm",onClick:()=>{var t,s;return t=e.provider,s=e.discount,void(r(t),o((100*s).toString()))},className:"cursor-pointer text-blue-600 hover:text-blue-700"})]})}),width:"250px"},{header:"Actions",cell:e=>{let{displayName:s}=e5(e.provider);return(0,t.jsx)(eG.Icon,{icon:eH.TrashIcon,size:"sm",onClick:()=>a(e.provider,s),className:"cursor-pointer hover:text-red-600"})},width:"80px"}],getRowKey:e=>e.provider,emptyMessage:"No provider discounts configured"})},e7=({discountConfig:e,selectedProvider:s,newDiscount:a,onProviderChange:l,onDiscountChange:r,onAddProvider:i})=>(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsx)(p.Form.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Provider",(0,t.jsx)(eu.Tooltip,{title:"Select the LLM provider you want to configure a discount for",children:(0,t.jsx)(C.InfoCircleOutlined,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),rules:[{required:!0,message:"Please select a provider"}],children:(0,t.jsx)(g.Select,{showSearch:!0,placeholder:"Select provider",value:s,onChange:l,style:{width:"100%"},size:"large",optionFilterProp:"children",filterOption:(e,t)=>String(t?.label??"").toLowerCase().includes(e.toLowerCase()),children:Object.entries(e4.Providers).map(([s,a])=>{let l=e4.provider_map[s];return l&&e[l]?null:(0,t.jsx)(g.Select.Option,{value:s,label:a,children:(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)("img",{src:e4.providerLogoMap[a],alt:`${s} logo`,className:"w-5 h-5",onError:e=>e3(e,a)}),(0,t.jsx)("span",{children:a})]})},s)})})}),(0,t.jsx)(p.Form.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Discount Percentage",(0,t.jsx)(eu.Tooltip,{title:"Enter a percentage value (e.g., 5 for 5% discount)",children:(0,t.jsx)(C.InfoCircleOutlined,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),rules:[{required:!0,message:"Please enter a discount percentage"}],children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(eV.TextInput,{placeholder:"5",value:a,onValueChange:r,className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500 flex-1"}),(0,t.jsx)("span",{className:"text-gray-600",children:"%"})]})}),(0,t.jsx)("div",{className:"flex items-center justify-end space-x-3 pt-6 border-t border-gray-100",children:(0,t.jsx)(m.Button,{variant:"primary",onClick:i,disabled:!s||!a,children:"Add Provider Discount"})})]}),e9=({marginConfig:e,onMarginChange:s,onRemoveProvider:a})=>{let[l,r]=(0,i.useState)(null),[n,o]=(0,i.useState)(""),[d,c]=(0,i.useState)(""),m=()=>{r(null),o(""),c("")},u=Object.entries(e).map(([e,t])=>({provider:e,margin:t})).sort((e,t)=>{if("global"===e.provider)return -1;if("global"===t.provider)return 1;let s=e5(e.provider).displayName,a=e5(t.provider).displayName;return s.localeCompare(a)});return(0,t.jsx)(e2,{data:u,columns:[{header:"Provider",cell:e=>{if("global"===e.provider)return(0,t.jsx)("div",{className:"flex items-center space-x-2",children:(0,t.jsx)("span",{className:"font-medium",children:"Global (All Providers)"})});let{displayName:s,logo:a}=e5(e.provider);return(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[a&&(0,t.jsx)("img",{src:a,alt:`${s} logo`,className:"w-5 h-5",onError:e=>e3(e,s)}),(0,t.jsx)("span",{className:"font-medium",children:s})]})}},{header:"Margin",cell:e=>(0,t.jsx)("div",{className:"flex items-center gap-2",children:l===e.provider?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(eV.TextInput,{value:n,onValueChange:o,placeholder:"10",className:"w-20",autoFocus:!0}),(0,t.jsx)("span",{className:"text-gray-600",children:"%"}),(0,t.jsx)("span",{className:"text-gray-400",children:"+"}),(0,t.jsx)("span",{className:"text-gray-600",children:"$"}),(0,t.jsx)(eV.TextInput,{value:d,onValueChange:c,placeholder:"0.001",className:"w-24"})]}),(0,t.jsx)(eG.Icon,{icon:eW,size:"sm",onClick:()=>{var t;let a,l;return t=e.provider,a=n?parseFloat(n):void 0,l=d?parseFloat(d):void 0,void(void 0!==a&&!isNaN(a)&&a>=0&&a<=1e3?void 0!==l&&!isNaN(l)&&l>=0?s(t,{percentage:a/100,fixed_amount:l}):s(t,a/100):void 0!==l&&!isNaN(l)&&l>=0&&s(t,{fixed_amount:l}),r(null),o(""),c(""))},className:"cursor-pointer text-green-600 hover:text-green-700"}),(0,t.jsx)(eG.Icon,{icon:eQ.XIcon,size:"sm",onClick:m,className:"cursor-pointer text-gray-600 hover:text-gray-700"})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(e_.Text,{className:"font-medium",children:(e=>{if("number"==typeof e)return`${(100*e).toFixed(1)}%`;let t=[];return void 0!==e.percentage&&t.push(`${(100*e.percentage).toFixed(1)}%`),void 0!==e.fixed_amount&&t.push(`$${e.fixed_amount.toFixed(6)}`),t.join(" + ")||"0%"})(e.margin)}),(0,t.jsx)(eG.Icon,{icon:eK.PencilAltIcon,size:"sm",onClick:()=>{var t,s;return t=e.provider,s=e.margin,void(r(t),"number"==typeof s?(o((100*s).toString()),c("")):(o(s.percentage?(100*s.percentage).toString():""),c(s.fixed_amount?s.fixed_amount.toString():"")))},className:"cursor-pointer text-blue-600 hover:text-blue-700"})]})}),width:"350px"},{header:"Actions",cell:e=>{let s="global"===e.provider?"Global":e5(e.provider).displayName;return(0,t.jsx)(eG.Icon,{icon:eH.TrashIcon,size:"sm",onClick:()=>a(e.provider,s),className:"cursor-pointer hover:text-red-600"})},width:"80px"}],getRowKey:e=>e.provider,emptyMessage:"No provider margins configured"})},te=({marginConfig:e,selectedProvider:s,marginType:a,percentageValue:l,fixedAmountValue:r,onProviderChange:i,onMarginTypeChange:n,onPercentageChange:o,onFixedAmountChange:d,onAddProvider:c})=>(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsx)(p.Form.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Provider",(0,t.jsx)(eu.Tooltip,{title:"Select 'Global' to apply margin to all providers, or select a specific provider",children:(0,t.jsx)(C.InfoCircleOutlined,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),rules:[{required:!0,message:"Please select a provider"}],children:(0,t.jsxs)(g.Select,{showSearch:!0,placeholder:"Select provider or 'Global'",value:s,onChange:i,style:{width:"100%"},size:"large",optionFilterProp:"children",filterOption:(e,t)=>String(t?.label??"").toLowerCase().includes(e.toLowerCase()),children:[(0,t.jsx)(g.Select.Option,{value:"global",label:"Global (All Providers)",children:(0,t.jsx)("div",{className:"flex items-center space-x-2",children:(0,t.jsx)("span",{className:"font-medium",children:"Global (All Providers)"})})},"global"),Object.entries(e4.Providers).map(([s,a])=>{let l=e4.provider_map[s];return l&&e[l]?null:(0,t.jsx)(g.Select.Option,{value:s,label:a,children:(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)("img",{src:e4.providerLogoMap[a],alt:`${s} logo`,className:"w-5 h-5",onError:e=>e3(e,a)}),(0,t.jsx)("span",{children:a})]})},s)})]})}),(0,t.jsx)(p.Form.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Margin Type",(0,t.jsx)(eu.Tooltip,{title:"Choose how to apply the margin: percentage-based or fixed amount",children:(0,t.jsx)(C.InfoCircleOutlined,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),rules:[{required:!0,message:"Please select a margin type"}],children:(0,t.jsxs)(f.Radio.Group,{value:a,onChange:e=>n(e.target.value),className:"w-full",children:[(0,t.jsx)(f.Radio,{value:"percentage",children:"Percentage-based"}),(0,t.jsx)(f.Radio,{value:"fixed",children:"Fixed Amount"})]})}),"percentage"===a&&(0,t.jsx)(p.Form.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Margin Percentage",(0,t.jsx)(eu.Tooltip,{title:"Enter a percentage value (e.g., 10 for 10% margin)",children:(0,t.jsx)(C.InfoCircleOutlined,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),rules:[{required:!0,message:"Please enter a margin percentage"},{validator:(e,t)=>{if(!t)return Promise.reject(Error("Please enter a margin percentage"));let s=parseFloat(t);return isNaN(s)||s<0||s>1e3?Promise.reject(Error("Percentage must be between 0 and 1000")):Promise.resolve()}}],children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(eV.TextInput,{placeholder:"10",value:l,onValueChange:o,className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500 flex-1"}),(0,t.jsx)("span",{className:"text-gray-600",children:"%"})]})}),"fixed"===a&&(0,t.jsx)(p.Form.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Fixed Margin Amount",(0,t.jsx)(eu.Tooltip,{title:"Enter a fixed amount in USD (e.g., 0.001 for $0.001 per request)",children:(0,t.jsx)(C.InfoCircleOutlined,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),rules:[{required:!0,message:"Please enter a fixed amount"},{validator:(e,t)=>{if(!t)return Promise.reject(Error("Please enter a fixed amount"));let s=parseFloat(t);return isNaN(s)||s<0?Promise.reject(Error("Fixed amount must be non-negative")):Promise.resolve()}}],children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"text-gray-600",children:"$"}),(0,t.jsx)(eV.TextInput,{placeholder:"0.001",value:r,onValueChange:d,className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500 flex-1"})]})}),(0,t.jsx)("div",{className:"flex items-center justify-end space-x-3 pt-6 border-t border-gray-100",children:(0,t.jsx)(m.Button,{variant:"primary",onClick:c,disabled:!s||"percentage"===a&&!l||"fixed"===a&&!r,children:"Add Provider Margin"})})]});var tt=e.i(291542),ts=e.i(28651);e.i(247167),e.i(62664);var ta=e.i(697539),tl=e.i(963188),tr=e.i(763731),ti=e.i(343794),tn=e.i(244009),to=e.i(242064),td=e.i(185793);let tc=e=>{let t,{value:s,formatter:a,precision:l,decimalSeparator:r,groupSeparator:n="",prefixCls:o}=e;if("function"==typeof a)t=a(s);else{let e=String(s),a=e.match(/^(-?)(\d*)(\.(\d+))?$/);if(a&&"-"!==e){let e=a[1],s=a[2]||"0",d=a[4]||"";s=s.replace(/\B(?=(\d{3})+(?!\d))/g,n),"number"==typeof l&&(d=d.padEnd(l,"0").slice(0,l>0?l:0)),d&&(d=`${r}${d}`),t=[i.createElement("span",{key:"int",className:`${o}-content-value-int`},e,s),d&&i.createElement("span",{key:"decimal",className:`${o}-content-value-decimal`},d)]}else t=e}return i.createElement("span",{className:`${o}-content-value`},t)};var tm=e.i(183293),tu=e.i(246422),tx=e.i(838378);let tp=(0,tu.genStyleHooks)("Statistic",e=>(e=>{let{componentCls:t,marginXXS:s,padding:a,colorTextDescription:l,titleFontSize:r,colorTextHeading:i,contentFontSize:n,fontFamily:o}=e;return{[t]:Object.assign(Object.assign({},(0,tm.resetComponent)(e)),{[`${t}-title`]:{marginBottom:s,color:l,fontSize:r},[`${t}-skeleton`]:{paddingTop:a},[`${t}-content`]:{color:i,fontSize:n,fontFamily:o,[`${t}-content-value`]:{display:"inline-block",direction:"ltr"},[`${t}-content-prefix, ${t}-content-suffix`]:{display:"inline-block"},[`${t}-content-prefix`]:{marginInlineEnd:s},[`${t}-content-suffix`]:{marginInlineStart:s}}})}})((0,tx.mergeToken)(e,{})),e=>{let{fontSizeHeading3:t,fontSize:s}=e;return{titleFontSize:s,contentFontSize:t}});var th=function(e,t){var s={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&0>t.indexOf(a)&&(s[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var l=0,a=Object.getOwnPropertySymbols(e);lt.indexOf(a[l])&&Object.prototype.propertyIsEnumerable.call(e,a[l])&&(s[a[l]]=e[a[l]]);return s};let tg=i.forwardRef((e,t)=>{let{prefixCls:s,className:a,rootClassName:l,style:r,valueStyle:n,value:o=0,title:d,valueRender:c,prefix:m,suffix:u,loading:x=!1,formatter:p,precision:h,decimalSeparator:g=".",groupSeparator:j=",",onMouseEnter:y,onMouseLeave:f}=e,b=th(e,["prefixCls","className","rootClassName","style","valueStyle","value","title","valueRender","prefix","suffix","loading","formatter","precision","decimalSeparator","groupSeparator","onMouseEnter","onMouseLeave"]),{getPrefixCls:_,direction:v,className:N,style:w}=(0,to.useComponentConfig)("statistic"),k=_("statistic",s),[C,S,T]=tp(k),I=i.createElement(tc,{decimalSeparator:g,groupSeparator:j,prefixCls:k,formatter:p,precision:h,value:o}),F=(0,ti.default)(k,{[`${k}-rtl`]:"rtl"===v},N,a,l,S,T),A=i.useRef(null);i.useImperativeHandle(t,()=>({nativeElement:A.current}));let P=(0,tn.default)(b,{aria:!0,data:!0});return C(i.createElement("div",Object.assign({},P,{ref:A,className:F,style:Object.assign(Object.assign({},w),r),onMouseEnter:y,onMouseLeave:f}),d&&i.createElement("div",{className:`${k}-title`},d),i.createElement(td.default,{paragraph:!1,loading:x,className:`${k}-skeleton`,active:!0},i.createElement("div",{style:n,className:`${k}-content`},m&&i.createElement("span",{className:`${k}-content-prefix`},m),c?c(I):I,u&&i.createElement("span",{className:`${k}-content-suffix`},u)))))}),tj=[["Y",31536e6],["M",2592e6],["D",864e5],["H",36e5],["m",6e4],["s",1e3],["S",1]];var ty=function(e,t){var s={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&0>t.indexOf(a)&&(s[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var l=0,a=Object.getOwnPropertySymbols(e);lt.indexOf(a[l])&&Object.prototype.propertyIsEnumerable.call(e,a[l])&&(s[a[l]]=e[a[l]]);return s};let tf=e=>{let{value:t,format:s="HH:mm:ss",onChange:a,onFinish:l,type:r}=e,n=ty(e,["value","format","onChange","onFinish","type"]),o="countdown"===r,[d,c]=i.useState(null),m=(0,ta.useEvent)(()=>{let e=Date.now(),s=new Date(t).getTime();return c({}),null==a||a(o?s-e:e-s),!o||!(s{let e,t=()=>{e=(0,tl.default)(()=>{m()&&t()})};return t(),()=>tl.default.cancel(e)},[t,o]),i.useEffect(()=>{c({})},[]),i.createElement(tg,Object.assign({},n,{value:t,valueRender:e=>(0,tr.cloneElement)(e,{title:void 0}),formatter:(e,t)=>d?function(e,t,s){let a,l,r,i,n,o,{format:d=""}=t,c=new Date(e).getTime(),m=Date.now();return a=s?Math.max(c-m,0):Math.max(m-c,0),l=/\[[^\]]*]/g,r=(d.match(l)||[]).map(e=>e.slice(1,-1)),i=d.replace(l,"[]"),n=tj.reduce((e,[t,s])=>{if(e.includes(t)){let l=Math.floor(a/s);return a-=l*s,e.replace(RegExp(`${t}+`,"g"),e=>{let t=e.length;return l.toString().padStart(t,"0")})}return e},i),o=0,n.replace(l,()=>{let e=r[o];return o+=1,e})}(e,Object.assign(Object.assign({},t),{format:s}),o):"-"}))},tb=i.memo(e=>i.createElement(tf,Object.assign({},e,{type:"countdown"})));tg.Timer=tf,tg.Countdown=tb;var t_=e.i(621192),tv=e.i(178654),tN=e.i(56456),tw=e.i(755151),tk=e.i(240647),tC=e.i(500330),tS=e.i(737434),tT=e.i(91500),tI=e.i(931067);let tF={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 42h216v494zM514.1 580.1l-61.8-102.4c-2.2-3.6-6.1-5.8-10.3-5.8h-38.4c-2.3 0-4.5.6-6.4 1.9-5.6 3.5-7.3 10.9-3.7 16.6l82.3 130.4-83.4 132.8a12.04 12.04 0 0010.2 18.4h34.5c4.2 0 8-2.2 10.2-5.7L510 664.8l62.3 101.4c2.2 3.6 6.1 5.7 10.2 5.7H620c2.3 0 4.5-.7 6.5-1.9 5.6-3.6 7.2-11 3.6-16.6l-84-130.4 85.3-132.5a12.04 12.04 0 00-10.1-18.5h-35.7c-4.2 0-8.1 2.2-10.3 5.8l-61.2 102.3z"}}]},name:"file-excel",theme:"outlined"};var tA=e.i(9583),tP=i.forwardRef(function(e,t){return i.createElement(tA.default,(0,tI.default)({},e,{ref:t,icon:tF}))});let tL=e=>null==e?"-":0===e?"$0.00":e<.01?`$${e.toFixed(6)}`:e<1?`$${e.toFixed(4)}`:`$${(0,tC.formatNumberWithCommas)(e,2)}`,tM=e=>null==e?"-":(0,tC.formatNumberWithCommas)(e,0),tD=({multiResult:e})=>{let[s,a]=(0,i.useState)(!1),l=(0,i.useRef)(null),r=e.entries.some(e=>null!==e.result);return((0,i.useEffect)(()=>{let e=e=>{l.current&&!l.current.contains(e.target)&&a(!1)};return s&&document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[s]),r)?(0,t.jsxs)("div",{className:"relative inline-block",ref:l,children:[(0,t.jsx)(m.Button,{size:"xs",variant:"secondary",icon:tS.DownloadOutlined,onClick:()=>a(!s),children:"Export"}),s&&(0,t.jsxs)("div",{className:"absolute right-0 mt-1 w-44 bg-white rounded-lg shadow-lg border border-gray-200 py-1 z-50",children:[(0,t.jsxs)("button",{className:"flex items-center w-full px-4 py-2 text-sm text-gray-700 hover:bg-gray-50 transition-colors",onClick:()=>{(e=>{let t=window.open("","_blank");if(!t)return alert("Please allow popups to export PDF");let s=e.entries.filter(e=>null!==e.result),a=s.length,l=` - - - - Multi-Model Cost Estimate Report - - - -

LLM Cost Estimate Report

-

${a} model${1!==a?"s":""} configured

- -
-

Combined Totals

-
-
-
Total Per Request
-
${tL(e.totals.cost_per_request)}
-
-
-
Total Daily
-
${tL(e.totals.daily_cost)}
-
-
-
Total Monthly
-
${tL(e.totals.monthly_cost)}
-
-
- ${e.totals.margin_per_request>0?` -
-
-
Margin/Request
-
${tL(e.totals.margin_per_request)}
-
-
-
Daily Margin
-
${tL(e.totals.daily_margin)}
-
-
-
Monthly Margin
-
${tL(e.totals.monthly_margin)}
-
-
- `:""} -
- -

Model Breakdown

- ${s.map(e=>{let t;return t=e.result,` -
-

${t.model} ${t.provider?`(${t.provider})`:""}

- -
-

Input Tokens per Request: ${tM(t.input_tokens)}

-

Output Tokens per Request: ${tM(t.output_tokens)}

- ${t.num_requests_per_day?`

Requests per Day: ${tM(t.num_requests_per_day)}

`:""} - ${t.num_requests_per_month?`

Requests per Month: ${tM(t.num_requests_per_month)}

`:""} -
- - - - - - ${null!==t.daily_cost?"":""} - ${null!==t.monthly_cost?"":""} - - - - - ${null!==t.daily_cost?``:""} - ${null!==t.monthly_cost?``:""} - - - - - ${null!==t.daily_cost?``:""} - ${null!==t.monthly_cost?``:""} - - - - - ${null!==t.daily_cost?``:""} - ${null!==t.monthly_cost?``:""} - - - - - ${null!==t.daily_cost?``:""} - ${null!==t.monthly_cost?``:""} - -
Cost TypePer RequestDailyMonthly
Input Cost${tL(t.input_cost_per_request)}${tL(t.daily_input_cost)}${tL(t.monthly_input_cost)}
Output Cost${tL(t.output_cost_per_request)}${tL(t.daily_output_cost)}${tL(t.monthly_output_cost)}
Margin/Fee${tL(t.margin_cost_per_request)}${tL(t.daily_margin_cost)}${tL(t.monthly_margin_cost)}
Total${tL(t.cost_per_request)}${tL(t.daily_cost)}${tL(t.monthly_cost)}
-
- `}).join("")} - - - - - `;t.document.write(l),t.document.close(),t.onload=()=>{t.print()}})(e),a(!1)},children:[(0,t.jsx)(tT.FilePdfOutlined,{className:"mr-3 text-red-500"}),"Export as PDF"]}),(0,t.jsxs)("button",{className:"flex items-center w-full px-4 py-2 text-sm text-gray-700 hover:bg-gray-50 transition-colors",onClick:()=>{(e=>{let t=e.entries.filter(e=>null!==e.result),s=[["LLM Multi-Model Cost Estimate Report"],["Generated",new Date().toLocaleString()],[""]];for(let a of(s.push(["COMBINED TOTALS"],["Total Per Request",e.totals.cost_per_request.toString()],["Total Daily",e.totals.daily_cost?.toString()||"-"],["Total Monthly",e.totals.monthly_cost?.toString()||"-"],["Margin Per Request",e.totals.margin_per_request.toString()],["Daily Margin",e.totals.daily_margin?.toString()||"-"],["Monthly Margin",e.totals.monthly_margin?.toString()||"-"],[""]),s.push(["Model","Provider","Input Tokens","Output Tokens","Requests/Day","Requests/Month","Cost/Request","Daily Cost","Monthly Cost","Input Cost/Req","Output Cost/Req","Margin/Req"]),t)){let e=a.result;s.push([e.model,e.provider||"-",e.input_tokens.toString(),e.output_tokens.toString(),e.num_requests_per_day?.toString()||"-",e.num_requests_per_month?.toString()||"-",e.cost_per_request.toString(),e.daily_cost?.toString()||"-",e.monthly_cost?.toString()||"-",e.input_cost_per_request.toString(),e.output_cost_per_request.toString(),e.margin_cost_per_request.toString()])}let a=new Blob([s.map(e=>e.map(e=>`"${e}"`).join(",")).join("\n")],{type:"text/csv;charset=utf-8;"}),l=window.URL.createObjectURL(a),r=document.createElement("a");r.href=l,r.download=`cost_estimate_multi_model_${new Date().toISOString().split("T")[0]}.csv`,document.body.appendChild(r),r.click(),document.body.removeChild(r),window.URL.revokeObjectURL(l)})(e),a(!1)},children:[(0,t.jsx)(tP,{className:"mr-3 text-green-600"}),"Export as CSV"]})]})]}):null},tE=e=>null==e?"-":0===e?"$0":e<1e-4?`$${e.toExponential(2)}`:e<1?`$${e.toFixed(4)}`:`$${(0,tC.formatNumberWithCommas)(e,2,!0)}`,tO=({result:e,loading:s,timePeriod:a})=>{let l="day"===a?"Daily":"Monthly",r="day"===a?e.daily_cost:e.monthly_cost,i="day"===a?e.daily_input_cost:e.monthly_input_cost,n="day"===a?e.daily_output_cost:e.monthly_output_cost,o="day"===a?e.daily_margin_cost:e.monthly_margin_cost,d="day"===a?e.num_requests_per_day:e.num_requests_per_month;return(0,t.jsxs)("div",{className:"space-y-3 bg-gray-50 p-4 rounded-lg",children:[s&&(0,t.jsxs)("div",{className:"flex items-center gap-2 text-gray-500 text-sm",children:[(0,t.jsx)(eS.Spin,{indicator:(0,t.jsx)(tN.LoadingOutlined,{spin:!0}),size:"small"}),(0,t.jsx)("span",{children:"Updating..."})]}),(0,t.jsxs)("div",{className:"grid grid-cols-4 gap-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(e_.Text,{className:"text-xs text-gray-500 block",children:"Total/Request"}),(0,t.jsx)(e_.Text,{className:"text-base font-semibold text-blue-600",children:tE(e.cost_per_request)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(e_.Text,{className:"text-xs text-gray-500 block",children:"Input Cost"}),(0,t.jsx)(e_.Text,{className:"text-sm",children:tE(e.input_cost_per_request)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(e_.Text,{className:"text-xs text-gray-500 block",children:"Output Cost"}),(0,t.jsx)(e_.Text,{className:"text-sm",children:tE(e.output_cost_per_request)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(e_.Text,{className:"text-xs text-gray-500 block",children:"Margin Fee"}),(0,t.jsx)(e_.Text,{className:`text-sm ${e.margin_cost_per_request>0?"text-amber-600":""}`,children:tE(e.margin_cost_per_request)})]})]}),null!==r&&(0,t.jsxs)("div",{className:"grid grid-cols-4 gap-4 pt-2 border-t border-gray-200",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)(e_.Text,{className:"text-xs text-gray-500 block",children:[l," Total (",null==d?"-":(0,tC.formatNumberWithCommas)(d,0,!0)," req)"]}),(0,t.jsx)(e_.Text,{className:`text-base font-semibold ${"day"===a?"text-green-600":"text-purple-600"}`,children:tE(r)})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)(e_.Text,{className:"text-xs text-gray-500 block",children:[l," Input"]}),(0,t.jsx)(e_.Text,{className:"text-sm",children:tE(i)})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)(e_.Text,{className:"text-xs text-gray-500 block",children:[l," Output"]}),(0,t.jsx)(e_.Text,{className:"text-sm",children:tE(n)})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)(e_.Text,{className:"text-xs text-gray-500 block",children:[l," Margin Fee"]}),(0,t.jsx)(e_.Text,{className:`text-sm ${(o??0)>0?"text-amber-600":""}`,children:tE(o)})]})]}),(e.input_cost_per_token||e.output_cost_per_token)&&(0,t.jsxs)("div",{className:"text-xs text-gray-400 pt-2 border-t border-gray-200",children:["Token Pricing: "," ",e.input_cost_per_token&&(0,t.jsxs)("span",{children:["Input $",(0,tC.formatNumberWithCommas)(1e6*e.input_cost_per_token,2),"/1M"]}),e.input_cost_per_token&&e.output_cost_per_token&&" | ",e.output_cost_per_token&&(0,t.jsxs)("span",{children:["Output $",(0,tC.formatNumberWithCommas)(1e6*e.output_cost_per_token,2),"/1M"]})]})]})},tz=({multiResult:e,timePeriod:s})=>{let[a,l]=(0,i.useState)(new Set),r=e.entries.filter(e=>null!==e.result),n=e.entries.filter(e=>e.loading),o=e.entries.filter(e=>null!==e.error),d=r.length>0,c=n.length>0,u=o.length>0;if(!d&&!c&&!u)return(0,t.jsx)("div",{className:"py-6 text-center border border-dashed border-gray-300 rounded-lg bg-gray-50",children:(0,t.jsx)(e_.Text,{className:"text-gray-500",children:"Select models above to see cost estimates"})});if(!d&&c&&!u)return(0,t.jsxs)("div",{className:"py-6 text-center",children:[(0,t.jsx)(eS.Spin,{indicator:(0,t.jsx)(tN.LoadingOutlined,{spin:!0})}),(0,t.jsx)(e_.Text,{className:"text-gray-500 block mt-2",children:"Calculating costs..."})]});if(!d&&u)return(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)(_.Divider,{className:"my-4"}),(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)(e_.Text,{className:"text-base font-semibold text-gray-900",children:"Cost Estimates"}),c&&(0,t.jsx)(eS.Spin,{indicator:(0,t.jsx)(tN.LoadingOutlined,{spin:!0}),size:"small"})]}),o.map(e=>(0,t.jsxs)("div",{className:"text-sm text-red-600 bg-red-50 p-3 rounded-lg border border-red-200",children:[(0,t.jsxs)("span",{className:"font-medium",children:[e.entry.model||"Unknown model",": "]}),e.error]},e.entry.id))]});let x=e.totals.margin_per_request>0,p="day"===s?"Daily":"Monthly",h=[{title:"Model",dataIndex:"model",key:"model",render:(e,s)=>(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"font-medium text-sm",children:e}),s.provider&&(0,t.jsx)(b.Tag,{color:"blue",className:"text-xs",children:s.provider}),s.loading&&(0,t.jsx)(eS.Spin,{indicator:(0,t.jsx)(tN.LoadingOutlined,{spin:!0}),size:"small"})]}),s.error&&(0,t.jsxs)("div",{className:"text-xs text-red-600 bg-red-50 px-2 py-1 rounded",children:["⚠️ ",s.error]}),s.hasZeroCost&&!s.error&&(0,t.jsx)("div",{className:"text-xs text-amber-600 bg-amber-50 px-2 py-1 rounded",children:"⚠️ No pricing data found for this model. Set base_model in config."})]})},{title:"Per Request",dataIndex:"cost_per_request",key:"cost_per_request",align:"right",render:(e,s)=>s.error?(0,t.jsx)("span",{className:"text-gray-400",children:"-"}):(0,t.jsx)("span",{className:"font-mono text-sm",children:tE(e)})},{title:"Margin Fee",dataIndex:"margin_cost_per_request",key:"margin_cost_per_request",align:"right",render:(e,s)=>s.error?(0,t.jsx)("span",{className:"text-gray-400",children:"-"}):(0,t.jsx)("span",{className:`font-mono text-sm ${(e??0)>0?"text-amber-600":"text-gray-400"}`,children:tE(e)})},{title:p,dataIndex:"day"===s?"daily_cost":"monthly_cost",key:"period_cost",align:"right",render:(e,s)=>s.error?(0,t.jsx)("span",{className:"text-gray-400",children:"-"}):(0,t.jsx)("span",{className:"font-mono text-sm",children:tE(e)})},{title:"",key:"expand",width:40,render:(e,s)=>s.error?null:(0,t.jsx)(m.Button,{size:"xs",variant:"light",onClick:()=>{var e;return e=s.id,void l(t=>{let s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s})},className:"text-gray-400 hover:text-gray-600",children:a.has(s.id)?(0,t.jsx)(tw.DownOutlined,{}):(0,t.jsx)(tk.RightOutlined,{})})}],g=e.entries.filter(e=>e.entry.model).map(e=>({key:e.entry.id,id:e.entry.id,model:e.result?.model||e.entry.model,provider:e.result?.provider,cost_per_request:e.result?.cost_per_request??null,margin_cost_per_request:e.result?.margin_cost_per_request??null,daily_cost:e.result?.daily_cost??null,monthly_cost:e.result?.monthly_cost??null,error:e.error,loading:e.loading,hasZeroCost:e.result&&0===e.result.cost_per_request}));return(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)(_.Divider,{className:"my-4"}),(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)(e_.Text,{className:"text-base font-semibold text-gray-900",children:"Cost Estimates"}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[c&&(0,t.jsx)(eS.Spin,{indicator:(0,t.jsx)(tN.LoadingOutlined,{spin:!0}),size:"small"}),(0,t.jsx)(tD,{multiResult:e})]})]}),(0,t.jsxs)(ec.Card,{size:"small",className:"bg-gradient-to-r from-slate-50 to-blue-50 border-slate-200",children:[(0,t.jsxs)(t_.Row,{gutter:[16,8],children:[(0,t.jsx)(tv.Col,{xs:24,sm:12,children:(0,t.jsx)(tg,{title:(0,t.jsx)("span",{className:"text-xs",children:"Total Per Request"}),value:tE(e.totals.cost_per_request),valueStyle:{color:"#1890ff",fontSize:"18px",fontFamily:"monospace"}})}),(0,t.jsx)(tv.Col,{xs:24,sm:12,children:(0,t.jsx)(tg,{title:(0,t.jsxs)("span",{className:"text-xs",children:["Total ",p]}),value:tE("day"===s?e.totals.daily_cost:e.totals.monthly_cost),valueStyle:{color:"day"===s?"#52c41a":"#722ed1",fontSize:"18px",fontFamily:"monospace"}})})]}),x&&(0,t.jsxs)(t_.Row,{gutter:[16,8],className:"mt-3 pt-3 border-t border-slate-200",children:[(0,t.jsxs)(tv.Col,{xs:24,sm:12,children:[(0,t.jsx)("div",{className:"text-xs text-gray-500",children:"Margin Fee/Request"}),(0,t.jsx)("div",{className:"text-sm font-mono text-amber-600",children:tE(e.totals.margin_per_request)})]}),(0,t.jsxs)(tv.Col,{xs:24,sm:12,children:[(0,t.jsxs)("div",{className:"text-xs text-gray-500",children:[p," Margin Fee"]}),(0,t.jsx)("div",{className:"text-sm font-mono text-amber-600",children:tE("day"===s?e.totals.daily_margin:e.totals.monthly_margin)})]})]})]}),g.length>0&&(0,t.jsx)(tt.Table,{columns:h,dataSource:g,pagination:!1,size:"small",className:"border border-gray-200 rounded-lg",expandable:{expandedRowKeys:Array.from(a),expandedRowRender:e=>{let a=r.find(t=>t.entry.id===e.id);return a?.result?(0,t.jsx)("div",{className:"py-2",children:(0,t.jsx)(tO,{result:a.result,loading:a.loading,timePeriod:s})}):null},showExpandColumn:!1}})]})},tR=()=>({id:`entry-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,model:"",input_tokens:1e3,output_tokens:500,num_requests_per_day:void 0,num_requests_per_month:void 0}),tB=({accessToken:e,models:s})=>{let[a,r]=(0,i.useState)([tR()]),[n,o]=(0,i.useState)("month"),{debouncedFetchForEntry:d,removeEntry:c,getMultiModelResult:m}=function(e){let[t,s]=(0,i.useState)(new Map),a=(0,i.useRef)(new Map),r=(0,i.useCallback)(async t=>{if(!e||!t.model)return void s(e=>{let s=new Map(e);return s.set(t.id,{entry:t,result:null,loading:!1,error:null}),s});s(e=>{let s=new Map(e),a=s.get(t.id);return s.set(t.id,{entry:t,result:a?.result??null,loading:!0,error:null}),s});try{let a=(0,l.getProxyBaseUrl)(),r=a?`${a}/cost/estimate`:"/cost/estimate",i={model:t.model,input_tokens:t.input_tokens||0,output_tokens:t.output_tokens||0,num_requests_per_day:t.num_requests_per_day||null,num_requests_per_month:t.num_requests_per_month||null},n=await fetch(r,{method:"POST",headers:{[(0,l.getGlobalLitellmHeaderName)()]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(i)});if(n.ok){let e=await n.json();s(s=>{let a=new Map(s);return a.set(t.id,{entry:t,result:e,loading:!1,error:null}),a})}else{let e=await n.json(),a=e.detail?.error||e.detail||"Failed to estimate cost";s(e=>{let s=new Map(e);return s.set(t.id,{entry:t,result:null,loading:!1,error:a}),s})}}catch(e){console.error("Error estimating cost:",e),s(e=>{let s=new Map(e);return s.set(t.id,{entry:t,result:null,loading:!1,error:"Network error"}),s})}},[e]),n=(0,i.useCallback)(e=>{let t=a.current.get(e.id);t&&clearTimeout(t);let s=setTimeout(()=>{r(e)},500);a.current.set(e.id,s)},[r]),o=(0,i.useCallback)(e=>{let t=a.current.get(e);t&&(clearTimeout(t),a.current.delete(e)),s(t=>{let s=new Map(t);return s.delete(e),s})},[]);return(0,i.useEffect)(()=>{let e=a.current;return()=>{e.forEach(e=>clearTimeout(e)),e.clear()}},[]),{debouncedFetchForEntry:n,removeEntry:o,getMultiModelResult:(0,i.useCallback)(e=>{let s=e.map(e=>{let s=t.get(e.id);return{entry:e,result:s?.result??null,loading:s?.loading??!1,error:s?.error??null}}),a=0,l=null,r=null,i=0,n=null,o=null;for(let e of s)e.result&&(a+=e.result.cost_per_request,i+=e.result.margin_cost_per_request,null!==e.result.daily_cost&&(l=(l??0)+e.result.daily_cost),null!==e.result.daily_margin_cost&&(n=(n??0)+e.result.daily_margin_cost),null!==e.result.monthly_cost&&(r=(r??0)+e.result.monthly_cost),null!==e.result.monthly_margin_cost&&(o=(o??0)+e.result.monthly_margin_cost));return{entries:s,totals:{cost_per_request:a,daily_cost:l,monthly_cost:r,margin_per_request:i,daily_margin:n,monthly_margin:o}}},[t])}}(e),u=(0,i.useCallback)((e,t,s)=>{r(a=>{let l=a.map(a=>a.id===e?{...a,[t]:s}:a),r=l.find(t=>t.id===e);return r&&r.model&&d(r),l})},[d]),x=(0,i.useCallback)(e=>{o(e),r(t=>t.map(t=>({...t,num_requests_per_day:"day"===e?t.num_requests_per_day:void 0,num_requests_per_month:"month"===e?t.num_requests_per_month:void 0})))},[]),p=(0,i.useCallback)(()=>{r(e=>[...e,tR()])},[]),h=(0,i.useCallback)(e=>{r(t=>t.filter(t=>t.id!==e)),c(e)},[c]),j=m(a),y=[{title:"Model",dataIndex:"model",key:"model",width:"35%",render:(e,a)=>(0,t.jsx)(g.Select,{showSearch:!0,placeholder:"Select a model",value:a.model||void 0,onChange:e=>u(a.id,"model",e),optionFilterProp:"label",filterOption:(e,t)=>String(t?.label??"").toLowerCase().includes(e.toLowerCase()),options:s.map(e=>({value:e,label:e})),style:{width:"100%"},size:"small"})},{title:"Input Tokens",dataIndex:"input_tokens",key:"input_tokens",width:"18%",render:(e,s)=>(0,t.jsx)(ts.InputNumber,{min:0,value:s.input_tokens,onChange:e=>u(s.id,"input_tokens",e??0),style:{width:"100%"},size:"small",formatter:e=>`${e}`.replace(/\B(?=(\d{3})+(?!\d))/g,",")})},{title:"Output Tokens",dataIndex:"output_tokens",key:"output_tokens",width:"18%",render:(e,s)=>(0,t.jsx)(ts.InputNumber,{min:0,value:s.output_tokens,onChange:e=>u(s.id,"output_tokens",e??0),style:{width:"100%"},size:"small",formatter:e=>`${e}`.replace(/\B(?=(\d{3})+(?!\d))/g,",")})},{title:`Requests/${"day"===n?"Day":"Month"}`,dataIndex:"day"===n?"num_requests_per_day":"num_requests_per_month",key:"num_requests",width:"20%",render:(e,s)=>(0,t.jsx)(ts.InputNumber,{min:0,value:"day"===n?s.num_requests_per_day:s.num_requests_per_month,onChange:e=>u(s.id,"day"===n?"num_requests_per_day":"num_requests_per_month",e??void 0),style:{width:"100%"},size:"small",placeholder:"-",formatter:e=>e?`${e}`.replace(/\B(?=(\d{3})+(?!\d))/g,","):""})},{title:"",key:"actions",width:50,render:(e,s)=>(0,t.jsx)(A.Button,{type:"text",icon:(0,t.jsx)(eh.DeleteOutlined,{}),onClick:()=>h(s.id),disabled:1===a.length,danger:!0,size:"small"})}];return(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)("div",{className:"flex items-center justify-end mb-2",children:(0,t.jsxs)(f.Radio.Group,{value:n,onChange:e=>x(e.target.value),size:"small",optionType:"button",buttonStyle:"solid",children:[(0,t.jsx)(f.Radio.Button,{value:"day",children:"Per Day"}),(0,t.jsx)(f.Radio.Button,{value:"month",children:"Per Month"})]})}),(0,t.jsx)(tt.Table,{columns:y,dataSource:a,rowKey:"id",pagination:!1,size:"small",footer:()=>(0,t.jsx)(A.Button,{type:"dashed",onClick:p,icon:(0,t.jsx)(P.PlusOutlined,{}),className:"w-full",children:"Add Another Model"})}),(0,t.jsx)(tz,{multiResult:j,timePeriod:n})]})};var tq=e.i(270377),t$=e.i(778917),tU=e.i(664659);let tV=({items:e,children:s="Docs",className:a=""})=>{let[l,r]=(0,i.useState)(!1),n=(0,i.useRef)(null);return(0,i.useEffect)(()=>{let e=e=>{n.current&&!n.current.contains(e.target)&&r(!1)};return l&&document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[l]),(0,t.jsxs)("div",{className:`relative inline-block ${a}`,ref:n,children:[(0,t.jsxs)("button",{type:"button",onClick:()=>r(!l),className:"inline-flex items-center gap-1 text-gray-500 hover:text-gray-700 text-xs transition-colors focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-1 rounded px-2 py-1","aria-expanded":l,"aria-haspopup":"true",children:[(0,t.jsx)("span",{children:s}),(0,t.jsx)(tU.ChevronDown,{className:`h-3 w-3 transition-transform ${l?"rotate-180":""}`,"aria-hidden":"true"})]}),l&&(0,t.jsx)("div",{className:"absolute right-0 mt-1 w-56 bg-white rounded-lg shadow-lg border border-gray-200 py-1 z-50",children:e.map((e,s)=>(0,t.jsxs)("a",{href:e.href,target:"_blank",rel:"noopener noreferrer",className:"flex items-center justify-between px-4 py-2 text-sm text-gray-700 hover:bg-gray-50 transition-colors",onClick:()=>r(!1),children:[(0,t.jsx)("span",{children:e.label}),(0,t.jsx)(t$.ExternalLink,{className:"h-3.5 w-3.5 text-gray-400 flex-shrink-0 ml-2","aria-hidden":"true"})]},s))})]})};var tG=e.i(673709);let tH=()=>{let[e,s]=(0,i.useState)(""),[a,l]=(0,i.useState)(""),r=(0,i.useMemo)(()=>{let t=parseFloat(e),s=parseFloat(a);if(isNaN(t)||isNaN(s)||0===t||0===s)return null;let l=t+s,r=s/l*100;return{originalCost:l.toFixed(10),finalCost:t.toFixed(10),discountAmount:s.toFixed(10),discountPercentage:r.toFixed(2)}},[e,a]);return(0,t.jsxs)("div",{className:"space-y-4 pt-2",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(e_.Text,{className:"font-medium text-gray-900 text-sm mb-1",children:"Cost Calculation"}),(0,t.jsxs)(e_.Text,{className:"text-xs text-gray-600",children:["Discounts are applied to provider costs: ",(0,t.jsx)("code",{className:"bg-gray-100 px-1.5 py-0.5 rounded text-xs",children:"final_cost = base_cost × (1 - discount%/100)"})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(e_.Text,{className:"font-medium text-gray-900 text-sm mb-1",children:"Example"}),(0,t.jsx)(e_.Text,{className:"text-xs text-gray-600",children:"A 5% discount on a $10.00 request results in: $10.00 × (1 - 0.05) = $9.50"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(e_.Text,{className:"font-medium text-gray-900 text-sm mb-1",children:"Valid Range"}),(0,t.jsx)(e_.Text,{className:"text-xs text-gray-600",children:"Discount percentages must be between 0% and 100%"})]}),(0,t.jsxs)("div",{className:"pt-4 border-t border-gray-200",children:[(0,t.jsx)(e_.Text,{className:"font-medium text-gray-900 text-sm mb-2",children:"Validating Discounts"}),(0,t.jsx)(e_.Text,{className:"text-xs text-gray-600 mb-3",children:"Make a test request and check the response headers to verify discounts are applied:"}),(0,t.jsx)(tG.default,{language:"bash",code:`curl -X POST -i http://your-proxy:4000/chat/completions \\ - -H "Content-Type: application/json" \\ - -H "Authorization: Bearer sk-1234" \\ - -d '{ - "model": "gemini/gemini-2.5-pro", - "messages": [{"role": "user", "content": "Hello"}] - }'`}),(0,t.jsx)(e_.Text,{className:"text-xs text-gray-600 mt-3 mb-2",children:"Look for these headers in the response:"}),(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsxs)("div",{className:"flex items-start gap-3",children:[(0,t.jsx)("code",{className:"bg-gray-100 px-2 py-1 rounded text-xs font-mono text-gray-800 whitespace-nowrap",children:"x-litellm-response-cost"}),(0,t.jsx)(e_.Text,{className:"text-xs text-gray-600",children:"Final cost after discount"})]}),(0,t.jsxs)("div",{className:"flex items-start gap-3",children:[(0,t.jsx)("code",{className:"bg-gray-100 px-2 py-1 rounded text-xs font-mono text-gray-800 whitespace-nowrap",children:"x-litellm-response-cost-original"}),(0,t.jsx)(e_.Text,{className:"text-xs text-gray-600",children:"Original cost before discount"})]}),(0,t.jsxs)("div",{className:"flex items-start gap-3",children:[(0,t.jsx)("code",{className:"bg-gray-100 px-2 py-1 rounded text-xs font-mono text-gray-800 whitespace-nowrap",children:"x-litellm-response-cost-discount-amount"}),(0,t.jsx)(e_.Text,{className:"text-xs text-gray-600",children:"Amount discounted"})]})]})]}),(0,t.jsxs)("div",{className:"pt-4 border-t border-gray-200",children:[(0,t.jsx)(e_.Text,{className:"font-medium text-gray-900 text-sm mb-3",children:"Discount Calculator"}),(0,t.jsx)(e_.Text,{className:"text-xs text-gray-600 mb-3",children:"Enter values from your response headers to verify the discount:"}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-xs font-medium text-gray-700 mb-1",children:"Response Cost (x-litellm-response-cost)"}),(0,t.jsx)(eV.TextInput,{placeholder:"0.0171938125",value:e,onValueChange:s,className:"text-sm"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-xs font-medium text-gray-700 mb-1",children:"Discount Amount (x-litellm-response-cost-discount-amount)"}),(0,t.jsx)(eV.TextInput,{placeholder:"0.0009049375",value:a,onValueChange:l,className:"text-sm"})]})]}),r&&(0,t.jsxs)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4",children:[(0,t.jsx)(e_.Text,{className:"text-sm font-medium text-blue-900 mb-2",children:"Calculated Results"}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)(e_.Text,{className:"text-xs text-blue-800",children:"Original Cost:"}),(0,t.jsxs)("code",{className:"text-xs font-mono text-blue-900",children:["$",r.originalCost]})]}),(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)(e_.Text,{className:"text-xs text-blue-800",children:"Final Cost:"}),(0,t.jsxs)("code",{className:"text-xs font-mono text-blue-900",children:["$",r.finalCost]})]}),(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)(e_.Text,{className:"text-xs text-blue-800",children:"Discount Amount:"}),(0,t.jsxs)("code",{className:"text-xs font-mono text-blue-900",children:["$",r.discountAmount]})]}),(0,t.jsxs)("div",{className:"flex items-center justify-between pt-2 border-t border-blue-300",children:[(0,t.jsx)(e_.Text,{className:"text-xs font-semibold text-blue-900",children:"Discount Applied:"}),(0,t.jsxs)(e_.Text,{className:"text-sm font-bold text-blue-900",children:[r.discountPercentage,"%"]})]})]})]})]})]})};var tK=e.i(689020);let tW=[{label:"Custom pricing for models",href:"https://docs.litellm.ai/docs/proxy/custom_pricing"},{label:"Spend tracking",href:"https://docs.litellm.ai/docs/proxy/cost_tracking"}],tQ=({userID:e,userRole:s,accessToken:a})=>{let[r,n]=(0,i.useState)(void 0),[o,d]=(0,i.useState)(""),[c,x]=(0,i.useState)(!0),[h,g]=(0,i.useState)(!1),[j,y]=(0,i.useState)(!1),[f,b]=(0,i.useState)(void 0),[_,v]=(0,i.useState)("percentage"),[N,w]=(0,i.useState)(""),[k,C]=(0,i.useState)(""),[S,T]=(0,i.useState)([]),[I]=p.Form.useForm(),[F]=p.Form.useForm(),[A,P]=u.Modal.useModal(),L="proxy_admin"===s||"Admin"===s,{discountConfig:M,fetchDiscountConfig:D,handleAddProvider:E,handleRemoveProvider:O,handleDiscountChange:z}=function({accessToken:e}){let[t,s]=(0,i.useState)({}),a=(0,i.useCallback)(async()=>{try{let t=(0,l.getProxyBaseUrl)(),a=t?`${t}/config/cost_discount_config`:"/config/cost_discount_config",r=await fetch(a,{method:"GET",headers:{[(0,l.getGlobalLitellmHeaderName)()]:`Bearer ${e}`,"Content-Type":"application/json"}});if(r.ok){let e=await r.json();s(e.values||{})}else console.error("Failed to fetch discount config")}catch(e){console.error("Error fetching discount config:",e),eM.default.fromBackend("Failed to fetch discount configuration")}},[e]),r=(0,i.useCallback)(async t=>{try{let s=(0,l.getProxyBaseUrl)(),r=s?`${s}/config/cost_discount_config`:"/config/cost_discount_config",i=await fetch(r,{method:"PATCH",headers:{[(0,l.getGlobalLitellmHeaderName)()]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(i.ok)eM.default.success("Discount configuration updated successfully"),await a();else{let e=await i.json(),t=e.detail?.error||e.detail||"Failed to update settings";eM.default.fromBackend(t)}}catch(e){console.error("Error updating discount config:",e),eM.default.fromBackend("Failed to update discount configuration")}},[e,a]),n=(0,i.useCallback)(async(e,a)=>{if(!e||!a)return eM.default.fromBackend("Please select a provider and enter discount percentage"),!1;let l=parseFloat(a);if(isNaN(l)||l<0||l>100)return eM.default.fromBackend("Discount must be between 0% and 100%"),!1;let i=e6(e);if(!i)return eM.default.fromBackend("Invalid provider selected"),!1;if(t[i])return eM.default.fromBackend(`Discount for ${e4.Providers[e]} already exists. Edit it in the table above.`),!1;let n={...t,[i]:l/100};return s(n),await r(n),!0},[t,r]),o=(0,i.useCallback)(async e=>{let a={...t};delete a[e],s(a),await r(a)},[t,r]),d=(0,i.useCallback)(async(e,a)=>{let l=parseFloat(a);if(!isNaN(l)&&l>=0&&l<=1){let a={...t,[e]:l};s(a),await r(a)}},[t,r]);return{discountConfig:t,setDiscountConfig:s,fetchDiscountConfig:a,saveDiscountConfig:r,handleAddProvider:n,handleRemoveProvider:o,handleDiscountChange:d}}({accessToken:a}),{marginConfig:R,fetchMarginConfig:B,handleAddMargin:q,handleRemoveMargin:$,handleMarginChange:U}=function({accessToken:e}){let[t,s]=(0,i.useState)({}),a=(0,i.useCallback)(async()=>{try{let t=(0,l.getProxyBaseUrl)(),a=t?`${t}/config/cost_margin_config`:"/config/cost_margin_config",r=await fetch(a,{method:"GET",headers:{[(0,l.getGlobalLitellmHeaderName)()]:`Bearer ${e}`,"Content-Type":"application/json"}});if(r.ok){let e=await r.json();s(e.values||{})}else console.error("Failed to fetch margin config")}catch(e){console.error("Error fetching margin config:",e),eM.default.fromBackend("Failed to fetch margin configuration")}},[e]),r=(0,i.useCallback)(async t=>{try{let s=(0,l.getProxyBaseUrl)(),r=s?`${s}/config/cost_margin_config`:"/config/cost_margin_config",i=await fetch(r,{method:"PATCH",headers:{[(0,l.getGlobalLitellmHeaderName)()]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(i.ok)eM.default.success("Margin configuration updated successfully"),await a();else{let e=await i.json(),t=e.detail?.error||e.detail||"Failed to update settings";eM.default.fromBackend(t)}}catch(e){console.error("Error updating margin config:",e),eM.default.fromBackend("Failed to update margin configuration")}},[e,a]),n=(0,i.useCallback)(async e=>{let a,l,{selectedProvider:i,marginType:n,percentageValue:o,fixedAmountValue:d}=e;if(!i)return eM.default.fromBackend("Please select a provider"),!1;if("global"===i)a="global";else{let e=e6(i);if(!e)return eM.default.fromBackend("Invalid provider selected"),!1;a=e}if(t[a]){let e="global"===a?"Global":e4.Providers[i];return eM.default.fromBackend(`Margin for ${e} already exists. Edit it in the table above.`),!1}if("percentage"===n){let e=parseFloat(o);if(isNaN(e)||e<0||e>1e3)return eM.default.fromBackend("Percentage must be between 0% and 1000%"),!1;l=e/100}else{let e=parseFloat(d);if(isNaN(e)||e<0)return eM.default.fromBackend("Fixed amount must be non-negative"),!1;l={fixed_amount:e}}let c={...t,[a]:l};return s(c),await r(c),!0},[t,r]),o=(0,i.useCallback)(async e=>{let a={...t};delete a[e],s(a),await r(a)},[t,r]),d=(0,i.useCallback)(async(e,a)=>{let l={...t,[e]:a};s(l),await r(l)},[t,r]);return{marginConfig:t,setMarginConfig:s,fetchMarginConfig:a,saveMarginConfig:r,handleAddMargin:n,handleRemoveMargin:o,handleMarginChange:d}}({accessToken:a});(0,i.useEffect)(()=>{a&&(Promise.all([D(),B()]).finally(()=>{x(!1)}),(async()=>{try{let e=await (0,tK.fetchAvailableModels)(a);T(e.map(e=>e.model_group))}catch(e){console.error("Error fetching models:",e)}})())},[a,D,B]);let V=async()=>{await E(r,o)&&(n(void 0),d(""),g(!1))},G=async(e,s)=>{A.confirm({title:"Remove Provider Discount",icon:(0,t.jsx)(tq.ExclamationCircleOutlined,{}),content:`Are you sure you want to remove the discount for ${s}?`,okText:"Remove",okType:"danger",cancelText:"Cancel",onOk:()=>O(e)})},H=async()=>{await q({selectedProvider:f,marginType:_,percentageValue:N,fixedAmountValue:k})&&(b(void 0),w(""),C(""),v("percentage"),y(!1))},K=async(e,s)=>{A.confirm({title:"Remove Provider Margin",icon:(0,t.jsx)(tq.ExclamationCircleOutlined,{}),content:`Are you sure you want to remove the margin for ${s}?`,okText:"Remove",okType:"danger",cancelText:"Cancel",onOk:()=>$(e)})};return a?(0,t.jsxs)("div",{className:"w-full p-8",children:[P,(0,t.jsx)("div",{className:"flex flex-col md:flex-row items-start md:items-center justify-between mb-6",children:(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(eb.Title,{children:"Cost Tracking Settings"}),(0,t.jsx)(tV,{items:tW})]}),(0,t.jsx)(e_.Text,{className:"text-gray-500 mt-1",children:"Configure cost discounts and margins for different LLM providers. Changes are saved automatically."})]})}),(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow w-full max-w-full space-y-4",children:[L&&(0,t.jsxs)(eq.Accordion,{children:[(0,t.jsx)(e$.AccordionHeader,{className:"px-6 py-4",children:(0,t.jsxs)("div",{className:"flex flex-col items-start w-full",children:[(0,t.jsx)(e_.Text,{className:"text-lg font-semibold text-gray-900",children:"Provider Discounts"}),(0,t.jsx)(e_.Text,{className:"text-sm text-gray-500 mt-1",children:"Apply percentage-based discounts to reduce costs for specific providers"})]})}),(0,t.jsx)(eU.AccordionBody,{className:"px-0",children:(0,t.jsxs)(eN.TabGroup,{children:[(0,t.jsxs)(ew.TabList,{className:"px-6 pt-4",children:[(0,t.jsx)(ev.Tab,{children:"Discounts"}),(0,t.jsx)(ev.Tab,{children:"Test It"})]}),(0,t.jsxs)(eC.TabPanels,{children:[(0,t.jsx)(ek.TabPanel,{children:(0,t.jsxs)("div",{className:"p-6",children:[(0,t.jsx)("div",{className:"flex justify-end mb-4",children:(0,t.jsx)(m.Button,{onClick:()=>g(!0),children:"+ Add Provider Discount"})}),c?(0,t.jsx)("div",{className:"py-12 text-center",children:(0,t.jsx)(e_.Text,{className:"text-gray-500",children:"Loading configuration..."})}):Object.keys(M).length>0?(0,t.jsx)(e8,{discountConfig:M,onDiscountChange:z,onRemoveProvider:G}):(0,t.jsxs)("div",{className:"py-16 px-6 text-center",children:[(0,t.jsx)("svg",{className:"mx-auto h-12 w-12 text-gray-400 mb-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M12 8c-1.657 0-3 .895-3 2s1.343 2 3 2 3 .895 3 2-1.343 2-3 2m0-8c1.11 0 2.08.402 2.599 1M12 8V7m0 1v8m0 0v1m0-1c-1.11 0-2.08-.402-2.599-1M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),(0,t.jsx)(e_.Text,{className:"text-gray-700 font-medium mb-2",children:"No provider discounts configured"}),(0,t.jsx)(e_.Text,{className:"text-gray-500 text-sm",children:'Click "Add Provider Discount" to get started'})]})]})}),(0,t.jsx)(ek.TabPanel,{children:(0,t.jsx)("div",{className:"px-6 pb-4",children:(0,t.jsx)(tH,{})})})]})]})})]}),L&&(0,t.jsxs)(eq.Accordion,{children:[(0,t.jsx)(e$.AccordionHeader,{className:"px-6 py-4",children:(0,t.jsxs)("div",{className:"flex flex-col items-start w-full",children:[(0,t.jsx)(e_.Text,{className:"text-lg font-semibold text-gray-900",children:"Fee/Price Margin"}),(0,t.jsx)(e_.Text,{className:"text-sm text-gray-500 mt-1",children:"Add fees or margins to LLM costs for internal billing and cost recovery"})]})}),(0,t.jsx)(eU.AccordionBody,{className:"px-0",children:(0,t.jsxs)("div",{className:"p-6",children:[(0,t.jsx)("div",{className:"flex justify-end mb-4",children:(0,t.jsx)(m.Button,{onClick:()=>y(!0),children:"+ Add Provider Margin"})}),c?(0,t.jsx)("div",{className:"py-12 text-center",children:(0,t.jsx)(e_.Text,{className:"text-gray-500",children:"Loading configuration..."})}):Object.keys(R).length>0?(0,t.jsx)(e9,{marginConfig:R,onMarginChange:U,onRemoveProvider:K}):(0,t.jsxs)("div",{className:"py-16 px-6 text-center",children:[(0,t.jsx)("svg",{className:"mx-auto h-12 w-12 text-gray-400 mb-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M12 8c-1.657 0-3 .895-3 2s1.343 2 3 2 3 .895 3 2-1.343 2-3 2m0-8c1.11 0 2.08.402 2.599 1M12 8V7m0 1v8m0 0v1m0-1c-1.11 0-2.08-.402-2.599-1M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),(0,t.jsx)(e_.Text,{className:"text-gray-700 font-medium mb-2",children:"No provider margins configured"}),(0,t.jsx)(e_.Text,{className:"text-gray-500 text-sm",children:'Click "Add Provider Margin" to get started'})]})]})})]}),(0,t.jsxs)(eq.Accordion,{defaultOpen:!0,children:[(0,t.jsx)(e$.AccordionHeader,{className:"px-6 py-4",children:(0,t.jsxs)("div",{className:"flex flex-col items-start w-full",children:[(0,t.jsx)(e_.Text,{className:"text-lg font-semibold text-gray-900",children:"Pricing Calculator"}),(0,t.jsx)(e_.Text,{className:"text-sm text-gray-500 mt-1",children:"Estimate LLM costs based on expected token usage and request volume"})]})}),(0,t.jsx)(eU.AccordionBody,{className:"px-0",children:(0,t.jsx)("div",{className:"p-6",children:(0,t.jsx)(tB,{accessToken:a,models:S})})})]})]}),(0,t.jsx)(u.Modal,{title:(0,t.jsx)("div",{className:"flex items-center space-x-3 pb-4 border-b border-gray-100",children:(0,t.jsx)("h2",{className:"text-xl font-semibold text-gray-900",children:"Add Provider Discount"})}),open:h,width:1e3,onCancel:()=>{g(!1),I.resetFields(),n(void 0),d("")},footer:null,className:"top-8",styles:{body:{padding:"24px"},header:{padding:"24px 24px 0 24px",border:"none"}},children:(0,t.jsxs)("div",{className:"mt-6",children:[(0,t.jsx)(e_.Text,{className:"text-sm text-gray-600 mb-6",children:"Select a provider and set its discount percentage. Enter a value between 0% and 100% (e.g., 5 for a 5% discount)."}),(0,t.jsx)(p.Form,{form:I,onFinish:()=>{V()},layout:"vertical",className:"space-y-6",children:(0,t.jsx)(e7,{discountConfig:M,selectedProvider:r,newDiscount:o,onProviderChange:n,onDiscountChange:d,onAddProvider:V})})]})}),(0,t.jsx)(u.Modal,{title:(0,t.jsx)("div",{className:"flex items-center space-x-3 pb-4 border-b border-gray-100",children:(0,t.jsx)("h2",{className:"text-xl font-semibold text-gray-900",children:"Add Provider Margin"})}),open:j,width:1e3,onCancel:()=>{y(!1),F.resetFields(),b(void 0),w(""),C(""),v("percentage")},footer:null,className:"top-8",styles:{body:{padding:"24px"},header:{padding:"24px 24px 0 24px",border:"none"}},children:(0,t.jsxs)("div",{className:"mt-6",children:[(0,t.jsx)(e_.Text,{className:"text-sm text-gray-600 mb-6",children:'Select a provider (or "Global" for all providers) and configure the margin. You can use percentage-based or fixed amount.'}),(0,t.jsx)(p.Form,{form:F,layout:"vertical",className:"space-y-6",children:(0,t.jsx)(te,{marginConfig:R,selectedProvider:f,marginType:_,percentageValue:N,fixedAmountValue:k,onProviderChange:b,onMarginTypeChange:v,onPercentageChange:w,onFixedAmountChange:C,onAddProvider:H})})]})})]}):null};var tY=e.i(226898),tJ=e.i(973706),tX=e.i(447566),tZ=e.i(602073),t0=e.i(313603),t1=e.i(266027),t2=e.i(309426),t4=e.i(350967),t5=e.i(653496),t6=e.i(149192),t3=e.i(788191);let t8=`Evaluate whether this guardrail's decision was correct. -Analyze the user input, the guardrail action taken, and determine if it was appropriate. - -Consider: -— Was the user's intent genuinely harmful or policy-violating? -— Was the guardrail's action (block / flag / pass) appropriate? -— Could this be a false positive or false negative? - -Return a structured verdict with confidence and justification.`,t7=`{ - "verdict": "correct" | "false_positive" | "false_negative", - "confidence": 0.0, - "justification": "string", - "risk_category": "string", - "suggested_action": "keep" | "adjust threshold" | "add allowlist" -} -`;function t9({open:e,onClose:s,guardrailName:a,accessToken:l,onRunEvaluation:r}){let[n,o]=(0,i.useState)(t8),[d,c]=(0,i.useState)(t7),[m,x]=(0,i.useState)(null),[p,h]=(0,i.useState)([]),[y,f]=(0,i.useState)(!1);(0,i.useEffect)(()=>{if(!e||!l)return void h([]);let t=!1;return f(!0),(0,tK.fetchAvailableModels)(l).then(e=>{t||h(e)}).catch(()=>{t||h([])}).finally(()=>{t||f(!1)}),()=>{t=!0}},[e,l]);let b=p.map(e=>({value:e.model_group,label:e.model_group}));return(0,t.jsxs)(u.Modal,{title:"Evaluation Settings",open:e,onCancel:s,width:640,footer:null,closeIcon:(0,t.jsx)(t6.CloseOutlined,{}),destroyOnClose:!0,children:[(0,t.jsx)("p",{className:"text-sm text-gray-500 mb-4",children:a?`Configure AI evaluation for ${a}`:"Configure AI evaluation for re-running on logs"}),(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-1.5",children:[(0,t.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Evaluation Prompt"}),(0,t.jsx)("button",{type:"button",onClick:()=>o(t8),className:"text-xs text-indigo-600 hover:text-indigo-700",children:"Reset to default"})]}),(0,t.jsx)(j.Input.TextArea,{value:n,onChange:e=>o(e.target.value),rows:6,className:"font-mono text-sm"}),(0,t.jsx)("p",{className:"text-xs text-gray-400 mt-1",children:"System prompt sent to the evaluation model. Output is structured via response_format."})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1.5",children:"Response Schema"}),(0,t.jsx)("p",{className:"text-xs text-gray-400 mb-1",children:"response_format: json_schema"}),(0,t.jsx)(j.Input.TextArea,{value:d,onChange:e=>c(e.target.value),rows:6,className:"font-mono text-sm"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1.5",children:"Model"}),(0,t.jsx)(g.Select,{placeholder:y?"Loading models…":"Select a model",value:m??void 0,onChange:x,options:b,style:{width:"100%"},showSearch:!0,optionFilterProp:"label",loading:y,notFoundContent:l?"No models available":"Sign in to see models"})]})]}),(0,t.jsxs)("div",{className:"flex items-center justify-end gap-2 mt-6 pt-4 border-t border-gray-100",children:[(0,t.jsx)(A.Button,{onClick:s,children:"Cancel"}),(0,t.jsx)(A.Button,{type:"primary",icon:(0,t.jsx)(t3.PlayCircleOutlined,{}),onClick:()=>{m&&(r?.({prompt:n,schema:d,model:m}),s())},disabled:!m,children:"Run Evaluation"})]})]})}var se=e.i(245704),st=e.i(166540);e.i(3565);var ss=e.i(502626);let sa={blocked:{icon:t6.CloseOutlined,color:"text-red-600",bg:"bg-red-50",border:"border-red-200",label:"Blocked"},passed:{icon:se.CheckCircleOutlined,color:"text-green-600",bg:"bg-green-50",border:"border-green-200",label:"Passed"},flagged:{icon:ep.WarningOutlined,color:"text-amber-600",bg:"bg-amber-50",border:"border-amber-200",label:"Flagged"}};function sl({guardrailName:e,filterAction:s="all",logs:a=[],logsLoading:r=!1,totalLogs:n,accessToken:o=null,startDate:d="",endDate:c=""}){let[m,u]=(0,i.useState)(10),[x,p]=(0,i.useState)(s),[h,g]=(0,i.useState)(null),[j,y]=(0,i.useState)(!1),f=a.filter(e=>"all"===x||e.action===x).slice(0,m),b=n??a.length,_=d?(0,st.default)(d).utc().format("YYYY-MM-DD HH:mm:ss"):(0,st.default)().subtract(24,"hours").utc().format("YYYY-MM-DD HH:mm:ss"),v=c?(0,st.default)(c).utc().endOf("day").format("YYYY-MM-DD HH:mm:ss"):(0,st.default)().utc().format("YYYY-MM-DD HH:mm:ss"),{data:N}=(0,t1.useQuery)({queryKey:["spend-log-by-request",h,_,v],queryFn:async()=>o&&h?await (0,l.uiSpendLogsCall)({accessToken:o,start_date:_,end_date:v,page:1,page_size:10,params:{request_id:h}}):null,enabled:!!(o&&h&&j)}),w=N?.data?.[0]??null;return(0,t.jsxs)("div",{className:"bg-white border border-gray-200 rounded-lg",children:[(0,t.jsx)("div",{className:"p-4 border-b border-gray-200",children:(0,t.jsxs)("div",{className:"flex items-center justify-between flex-wrap gap-3",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h3",{className:"text-base font-semibold text-gray-900",children:e?`Logs — ${e}`:"Request Logs"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-0.5",children:r?"Loading…":a.length>0?`Showing ${f.length} of ${b} entries`:"No logs for this period. Select a guardrail and date range."})]}),a.length>0&&(0,t.jsxs)("div",{className:"flex items-center gap-4",children:[(0,t.jsx)("div",{className:"flex items-center gap-1",children:["all","blocked","flagged","passed"].map(e=>(0,t.jsx)(A.Button,{type:x===e?"primary":"default",size:"small",onClick:()=>p(e),children:e.charAt(0).toUpperCase()+e.slice(1)},e))}),(0,t.jsx)("div",{className:"h-4 w-px bg-gray-200"}),(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsx)("span",{className:"text-xs text-gray-500 mr-1",children:"Sample:"}),[10,50,100].map(e=>(0,t.jsx)(A.Button,{type:m===e?"primary":"default",size:"small",onClick:()=>u(e),children:e},e))]})]})]})}),r&&(0,t.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,t.jsx)(eS.Spin,{})}),!r&&0===f.length&&(0,t.jsx)("div",{className:"py-12 text-center text-sm text-gray-500",children:"No logs to display. Adjust filters or date range."}),!r&&f.length>0&&(0,t.jsx)("div",{className:"divide-y divide-gray-100",children:f.map(e=>{let s=sa[e.action],a=s.icon;return(0,t.jsxs)("button",{type:"button",onClick:()=>{g(e.id),y(!0)},className:"w-full text-left px-4 py-3 hover:bg-gray-50 transition-colors flex items-start gap-3",children:[(0,t.jsx)(a,{className:`w-4 h-4 mt-0.5 flex-shrink-0 ${s.color}`}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-1 flex-wrap",children:[(0,t.jsx)("span",{className:`inline-flex items-center px-2 py-0.5 text-xs font-medium rounded border ${s.bg} ${s.color} ${s.border}`,children:s.label}),(0,t.jsx)("span",{className:"text-xs text-gray-400",children:e.timestamp}),(0,t.jsx)("span",{className:"text-xs text-gray-400",children:"·"}),e.model&&(0,t.jsx)("span",{className:"text-xs text-gray-500",children:e.model})]}),(0,t.jsx)("p",{className:"text-sm text-gray-800 truncate",children:e.input_snippet??e.input??"—"})]}),(0,t.jsx)(tw.DownOutlined,{className:"w-4 h-4 text-gray-400 flex-shrink-0 mt-1"})]},e.id)})}),(0,t.jsx)(ss.LogDetailsDrawer,{open:j,onClose:()=>{y(!1),g(null)},logEntry:w,accessToken:o,allLogs:w?[w]:[],startTime:_})]})}function sr({label:e,value:s,valueColor:a="text-gray-900",icon:l,subtitle:r}){return(0,t.jsxs)("div",{className:"h-full bg-white border border-gray-200 rounded-lg p-5 flex flex-col",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,t.jsx)("span",{className:"text-sm font-medium text-gray-600",children:e}),l&&(0,t.jsx)("span",{className:"text-gray-400",children:l})]}),(0,t.jsx)("div",{className:`text-3xl font-semibold ${a} tracking-tight`,children:s}),r&&(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:r})]})}let si={healthy:{bg:"bg-green-50",text:"text-green-700",dot:"bg-green-500"},warning:{bg:"bg-amber-50",text:"text-amber-700",dot:"bg-amber-500"},critical:{bg:"bg-red-50",text:"text-red-700",dot:"bg-red-500"}};function sn({guardrailId:e,onBack:s,accessToken:a=null,startDate:r,endDate:n}){let[o,d]=(0,i.useState)("overview"),[c,m]=(0,i.useState)(!1),[u,x]=(0,i.useState)(1),{data:p,isLoading:h,error:g}=(0,t1.useQuery)({queryKey:["guardrails-usage-detail",e,r,n],queryFn:()=>(0,l.getGuardrailsUsageDetail)(a,e,r,n),enabled:!!a&&!!e}),{data:j,isLoading:y}=(0,t1.useQuery)({queryKey:["guardrails-usage-logs",e,u,50],queryFn:()=>(0,l.getGuardrailsUsageLogs)(a,{guardrailId:e,page:u,pageSize:50,startDate:r,endDate:n}),enabled:!!a&&!!e}),f=(0,i.useMemo)(()=>(j?.logs??[]).map(e=>({id:e.id,timestamp:e.timestamp,action:e.action,score:e.score,model:e.model,input_snippet:e.input_snippet,output_snippet:e.output_snippet,reason:e.reason})),[j?.logs]),b=p?{name:p.guardrail_name,description:p.description??"",status:p.status,provider:p.provider,type:p.type,requestsEvaluated:p.requestsEvaluated,failRate:p.failRate,avgScore:p.avgScore,avgLatency:p.avgLatency}:{name:e,description:"",status:"healthy",provider:"—",type:"—",requestsEvaluated:0,failRate:0,avgScore:void 0,avgLatency:void 0},_=si[b.status]??si.healthy;return h&&!p?(0,t.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,t.jsx)(eS.Spin,{size:"large"})}):g&&!p?(0,t.jsxs)("div",{children:[(0,t.jsx)(A.Button,{type:"link",icon:(0,t.jsx)(tX.ArrowLeftOutlined,{}),onClick:s,className:"pl-0 mb-4",children:"Back to Overview"}),(0,t.jsx)("p",{className:"text-red-600",children:"Failed to load guardrail details."})]}):(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"mb-6",children:[(0,t.jsx)(A.Button,{type:"link",icon:(0,t.jsx)(tX.ArrowLeftOutlined,{}),onClick:s,className:"pl-0 mb-4",children:"Back to Overview"}),(0,t.jsxs)("div",{className:"flex items-start justify-between",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 mb-1",children:[(0,t.jsx)(tZ.SafetyOutlined,{className:"text-xl text-gray-400"}),(0,t.jsx)("h1",{className:"text-xl font-semibold text-gray-900",children:b.name}),(0,t.jsxs)("span",{className:`inline-flex items-center gap-1.5 px-2.5 py-0.5 text-xs font-medium rounded-full ${_.bg} ${_.text}`,children:[(0,t.jsx)("span",{className:`w-1.5 h-1.5 rounded-full ${_.dot}`}),b.status.charAt(0).toUpperCase()+b.status.slice(1)]})]}),(0,t.jsx)("p",{className:"text-sm text-gray-500 ml-8",children:b.description})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"inline-flex items-center px-2.5 py-1 text-xs font-medium rounded-md bg-indigo-50 text-indigo-700 border border-indigo-200",children:b.provider}),(0,t.jsx)(A.Button,{type:"default",icon:(0,t.jsx)(t0.SettingOutlined,{}),onClick:()=>m(!0),title:"Evaluation settings"})]})]})]}),(0,t.jsx)(t5.Tabs,{activeKey:o,onChange:d,items:[{key:"overview",label:"Overview"},{key:"logs",label:"Logs"}]}),"overview"===o&&(0,t.jsxs)("div",{className:"space-y-6 mt-4",children:[(0,t.jsxs)(t4.Grid,{numItems:2,numItemsMd:5,className:"gap-4",children:[(0,t.jsx)(t2.Col,{children:(0,t.jsx)(sr,{label:"Requests Evaluated",value:b.requestsEvaluated.toLocaleString()})}),(0,t.jsx)(t2.Col,{children:(0,t.jsx)(sr,{label:"Fail Rate",value:`${b.failRate}%`,valueColor:b.failRate>15?"text-red-600":b.failRate>5?"text-amber-600":"text-green-600",subtitle:`${Math.round(b.requestsEvaluated*b.failRate/100).toLocaleString()} blocked`,icon:b.failRate>15?(0,t.jsx)(ep.WarningOutlined,{className:"text-red-400"}):void 0})}),(0,t.jsx)(t2.Col,{children:(0,t.jsx)(sr,{label:"Avg. latency added",value:null!=b.avgLatency?`${Math.round(b.avgLatency)}ms`:"—",valueColor:null!=b.avgLatency?b.avgLatency>150?"text-red-600":b.avgLatency>50?"text-amber-600":"text-green-600":"text-gray-500",subtitle:null!=b.avgLatency?"Per request (avg)":"No data"})})]}),(0,t.jsx)(sl,{guardrailName:b.name,filterAction:"all",logs:f,logsLoading:y,totalLogs:j?.total??0,accessToken:a,startDate:r,endDate:n})]}),"logs"===o&&(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsx)(sl,{guardrailName:b.name,logs:f,logsLoading:y,totalLogs:j?.total??0,accessToken:a,startDate:r,endDate:n})}),(0,t.jsx)(t9,{open:c,onClose:()=>m(!1),guardrailName:b.name,accessToken:a})]})}let so={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M917 211.1l-199.2 24c-6.6.8-9.4 8.9-4.7 13.6l59.3 59.3-226 226-101.8-101.7c-6.3-6.3-16.4-6.2-22.6 0L100.3 754.1a8.03 8.03 0 000 11.3l45 45.2c3.1 3.1 8.2 3.1 11.3 0L433.3 534 535 635.7c6.3 6.2 16.4 6.2 22.6 0L829 364.5l59.3 59.3a8.01 8.01 0 0013.6-4.7l24-199.2c.7-5.1-3.7-9.5-8.9-8.8z"}}]},name:"rise",theme:"outlined"};var sd=i.forwardRef(function(e,t){return i.createElement(tA.default,(0,tI.default)({},e,{ref:t,icon:so}))}),sc=e.i(584935);function sm({data:e}){let s=e&&e.length>0?e:[];return(0,t.jsxs)(ef.Card,{className:"bg-white border border-gray-200",children:[(0,t.jsx)(eb.Title,{className:"text-base font-semibold text-gray-900 mb-4",children:"Request Outcomes Over Time"}),(0,t.jsx)("div",{className:"h-80 min-h-[280px]",children:s.length>0?(0,t.jsx)(sc.BarChart,{data:s,index:"date",categories:["passed","blocked"],colors:["green","red"],valueFormatter:e=>e.toLocaleString(),yAxisWidth:48,showLegend:!0,stack:!0}):(0,t.jsx)("div",{className:"flex items-center justify-center h-full text-sm text-gray-500",children:"No chart data for this period"})})]})}let su={Bedrock:"bg-orange-100 text-orange-700 border-orange-200","Google Cloud":"bg-sky-100 text-sky-700 border-sky-200",LiteLLM:"bg-indigo-100 text-indigo-700 border-indigo-200",Custom:"bg-gray-100 text-gray-600 border-gray-200"};function sx({accessToken:e=null,startDate:s,endDate:a,onSelectGuardrail:r}){let[n,o]=(0,i.useState)("failRate"),[d,c]=(0,i.useState)("desc"),[m,u]=(0,i.useState)(!1),{data:x,isLoading:p,error:h}=(0,t1.useQuery)({queryKey:["guardrails-usage-overview",s,a],queryFn:()=>(0,l.getGuardrailsUsageOverview)(e,s,a),enabled:!!e}),g=x?.rows??[],j=(0,i.useMemo)(()=>{let e,t,s,a;return x?{totalRequests:x.totalRequests??0,totalBlocked:x.totalBlocked??0,passRate:String(x.passRate??0),avgLatency:g.length?Math.round(g.reduce((e,t)=>e+(t.avgLatency??0),0)/g.length):0,count:g.length}:(e=g.reduce((e,t)=>e+t.requestsEvaluated,0),t=g.reduce((e,t)=>e+Math.round(t.requestsEvaluated*t.failRate/100),0),s=e>0?((1-t/e)*100).toFixed(1):"0",{totalRequests:e,totalBlocked:t,passRate:s,avgLatency:(a=g.filter(e=>null!=e.avgLatency)).length>0?Math.round(a.reduce((e,t)=>e+(t.avgLatency??0),0)/a.length):0,count:g.length})},[x,g]),y=x?.chart,f=(0,i.useMemo)(()=>[...g].sort((e,t)=>{let s="desc"===d?-1:1,a=e[n]??0,l=t[n]??0;return(Number(a)-Number(l))*s}),[g,n,d]),b=[{title:"Guardrail",dataIndex:"name",key:"name",render:(e,s)=>(0,t.jsx)("button",{type:"button",className:"text-sm font-medium text-gray-900 hover:text-indigo-600 text-left",onClick:()=>r(s.id),children:e})},{title:"Provider",dataIndex:"provider",key:"provider",render:e=>(0,t.jsx)("span",{className:`inline-flex items-center px-2 py-0.5 text-xs font-medium rounded border ${su[e]??su.Custom}`,children:e})},{title:"Requests",dataIndex:"requestsEvaluated",key:"requestsEvaluated",align:"right",sorter:!0,sortOrder:"requestsEvaluated"===n?"desc"===d?"descend":"ascend":null,render:e=>e.toLocaleString()},{title:"Fail Rate",dataIndex:"failRate",key:"failRate",align:"right",sorter:!0,sortOrder:"failRate"===n?"desc"===d?"descend":"ascend":null,render:(e,s)=>(0,t.jsxs)("span",{className:e>15?"text-red-600":e>5?"text-amber-600":"text-green-600",children:[e,"%","up"===s.trend&&(0,t.jsx)("span",{className:"ml-1 text-xs text-red-400",children:"↑"}),"down"===s.trend&&(0,t.jsx)("span",{className:"ml-1 text-xs text-green-400",children:"↓"})]})},{title:"Avg. latency added",dataIndex:"avgLatency",key:"avgLatency",align:"right",sorter:!0,sortOrder:"avgLatency"===n?"desc"===d?"descend":"ascend":null,render:e=>(0,t.jsx)("span",{className:null==e?"text-gray-400":e>150?"text-red-600":e>50?"text-amber-600":"text-green-600",children:null!=e?`${e}ms`:"—"})},{title:"Status",dataIndex:"status",key:"status",align:"center",render:e=>(0,t.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[(0,t.jsx)("span",{className:`w-2 h-2 rounded-full ${"healthy"===e?"bg-green-500":"warning"===e?"bg-amber-500":"bg-red-500"}`}),(0,t.jsx)("span",{className:"text-xs text-gray-600 capitalize",children:e})]})}],_=["failRate","requestsEvaluated","avgLatency"];return(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-start justify-between mb-5",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,t.jsx)(tZ.SafetyOutlined,{className:"text-lg text-indigo-500"}),(0,t.jsx)("h1",{className:"text-xl font-semibold text-gray-900",children:"Guardrails Monitor"})]}),(0,t.jsx)("p",{className:"text-sm text-gray-500",children:"Monitor guardrail performance across all requests"})]}),(0,t.jsx)("div",{className:"flex items-center gap-3",children:(0,t.jsx)(A.Button,{type:"default",icon:(0,t.jsx)(tS.DownloadOutlined,{}),title:"Coming soon",children:"Export Data"})})]}),(0,t.jsxs)(t4.Grid,{numItems:2,numItemsLg:5,className:"gap-4 mb-6 items-stretch",children:[(0,t.jsx)(t2.Col,{className:"flex flex-col",children:(0,t.jsx)(sr,{label:"Total Evaluations",value:j.totalRequests.toLocaleString()})}),(0,t.jsx)(t2.Col,{className:"flex flex-col",children:(0,t.jsx)(sr,{label:"Blocked Requests",value:j.totalBlocked.toLocaleString(),valueColor:"text-red-600",icon:(0,t.jsx)(ep.WarningOutlined,{className:"text-red-400"})})}),(0,t.jsx)(t2.Col,{className:"flex flex-col",children:(0,t.jsx)(sr,{label:"Pass Rate",value:`${j.passRate}%`,valueColor:"text-green-600",icon:(0,t.jsx)(sd,{className:"text-green-400"})})}),(0,t.jsx)(t2.Col,{className:"flex flex-col",children:(0,t.jsx)(sr,{label:"Avg. latency added",value:`${j.avgLatency}ms`,valueColor:j.avgLatency>150?"text-red-600":j.avgLatency>50?"text-amber-600":"text-green-600"})}),(0,t.jsx)(t2.Col,{className:"flex flex-col",children:(0,t.jsx)(sr,{label:"Active Guardrails",value:j.count})})]}),(0,t.jsx)("div",{className:"mb-6",children:(0,t.jsx)(sm,{data:y})}),(0,t.jsxs)(ef.Card,{className:"bg-white border border-gray-200 rounded-lg",children:[(p||h)&&(0,t.jsxs)("div",{className:"px-6 py-4 border-b border-gray-200 flex items-center gap-2",children:[p&&(0,t.jsx)(eS.Spin,{size:"small"}),h&&(0,t.jsx)("span",{className:"text-sm text-red-600",children:"Failed to load data. Try again."})]}),(0,t.jsxs)("div",{className:"px-6 py-4 border-b border-gray-200 flex items-start justify-between gap-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(eb.Title,{className:"text-base font-semibold text-gray-900",children:"Guardrail Performance"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-0.5",children:"Click a guardrail to view details, logs, and configuration"})]}),(0,t.jsx)("div",{className:"flex items-center gap-2",children:(0,t.jsx)(A.Button,{type:"default",icon:(0,t.jsx)(t0.SettingOutlined,{}),onClick:()=>u(!0),title:"Evaluation settings"})})]}),(0,t.jsx)(tt.Table,{columns:b,dataSource:f,rowKey:"id",pagination:!1,loading:p,onChange:(e,t,s)=>{s?.field&&_.includes(s.field)&&(o(s.field),c("ascend"===s.order?"asc":"desc"))},locale:0!==g.length||p?void 0:{emptyText:"No data for this period"},onRow:e=>({onClick:()=>r(e.id),style:{cursor:"pointer"}})})]}),(0,t.jsx)(t9,{open:m,onClose:()=>u(!1),accessToken:e})]})}let sp=new Date,sh=new Date;function sg({accessToken:e=null}){let[s,a]=(0,i.useState)({type:"overview"}),r=(0,i.useMemo)(()=>new Date(sh),[]),n=(0,i.useMemo)(()=>new Date(sp),[]),[o,d]=(0,i.useState)({from:r,to:n}),c=o.from?(0,l.formatDate)(o.from):"",m=o.to?(0,l.formatDate)(o.to):"",u=(0,i.useCallback)(e=>{d(e)},[]);return(0,t.jsxs)("div",{className:"p-6 w-full min-w-0 flex-1",children:[(0,t.jsx)("div",{className:"flex items-center justify-end mb-4",children:(0,t.jsx)(tJ.default,{value:o,onValueChange:u,label:"",showTimeRange:!1})}),"overview"===s.type?(0,t.jsx)(sx,{accessToken:e,startDate:c,endDate:m,onSelectGuardrail:e=>{a({type:"detail",guardrailId:e})}}):(0,t.jsx)(sn,{guardrailId:s.guardrailId,onBack:()=>{a({type:"overview"})},accessToken:e,startDate:c,endDate:m})]})}sh.setDate(sh.getDate()-7);var sj=e.i(487304),sy=e.i(760221);e.i(111790);var sf=e.i(280881),sb=e.i(934879),s_=e.i(402874),sv=e.i(797305),sN=e.i(109799),sw=e.i(747871),sk=e.i(56567),sC=e.i(468133),sS=e.i(871943),sT=e.i(502547),sI=e.i(278587),sF=e.i(655913),sA=e.i(38419),sP=e.i(78334),sL=e.i(555436),sM=e.i(284614),sD=e.i(389083),sE=e.i(206929),sO=e.i(35983),sz=e.i(898586),sR=e.i(9314),sB=e.i(552130),sq=e.i(533882),s$=e.i(651904),sU=e.i(460285),sV=e.i(435451),sG=e.i(916940),sH=e.i(127952),sK=e.i(902555),sW=e.i(162386);let sQ=(e,t,s)=>"Admin"===e||!!s&&!!t&&s.some(e=>e.members?.some(e=>e.user_id===t&&"org_admin"===e.user_role)),sY=(e,t,s)=>"Admin"===e?s||[]:s&&t?s.filter(e=>e.members?.some(e=>e.user_id===t&&"org_admin"===e.user_role)):[],sJ=({teams:e,searchParams:s,accessToken:a,setTeams:r,userID:n,userRole:o,organizations:d,premiumUser:c=!1})=>{let x,h,y,f;console.log(`organizations: ${JSON.stringify(d)}`);let{data:b}=(0,sN.useOrganizations)(),[_,v]=(0,i.useState)(""),[N,w]=(0,i.useState)(null),[k,S]=(0,i.useState)(null),[F,P]=(0,i.useState)(!1),[L,M]=(0,i.useState)({team_id:"",team_alias:"",organization_id:"",sort_by:"created_at",sort_order:"desc"});(0,i.useEffect)(()=>{console.log(`inside useeffect - ${_}`),a&&(0,eR.fetchTeams)(a,n,o,N,r),e6()},[_]);let[D]=p.Form.useForm(),[E]=p.Form.useForm(),{Title:O,Paragraph:z}=sz.Typography,[R,B]=(0,i.useState)(""),[q,$]=(0,i.useState)(!1),[U,V]=(0,i.useState)(null),[G,H]=(0,i.useState)(null),[K,W]=(0,i.useState)(!1),[Q,Y]=(0,i.useState)(!1),[J,X]=(0,i.useState)(!1),[Z,ee]=(0,i.useState)(!1),[et,es]=(0,i.useState)([]),[ea,ei]=(0,i.useState)(!1),[en,eo]=(0,i.useState)(null),[ed,ec]=(0,i.useState)([]),[em,ex]=(0,i.useState)({}),[ep,eh]=(0,i.useState)(!1),[eg,ej]=(0,i.useState)([]),[eb,eS]=(0,i.useState)([]),[eT,eI]=(0,i.useState)({}),[eF,eA]=(0,i.useState)([]),[eP,eL]=(0,i.useState)([]),[eD,eE]=(0,i.useState)(!1),[eO,ez]=(0,i.useState)({}),[eB,eH]=(0,i.useState)(null),[eK,eW]=(0,i.useState)(0);(0,i.useEffect)(()=>{let e;console.log(`currentOrgForCreateTeam: ${k}`);let t=(e=[],k&&k.models.length>0?(console.log(`organization.models: ${k.models}`),e=k.models):e=et,(0,T.unfurlWildcardModelsInList)(e,et));console.log(`models: ${t}`),ec(t),D.setFieldValue("models",[])},[k,et]),(0,i.useEffect)(()=>{if(Q){let e=sY(o,n,d);if(1===e.length){let t=e[0];D.setFieldValue("organization_id",t.organization_id),S(t)}else D.setFieldValue("organization_id",N?.organization_id||null),S(N)}},[Q,o,n,d,N]),(0,i.useEffect)(()=>{let e=async()=>{try{if(null==a)return;let e=(await (0,l.getPoliciesList)(a)).policies.map(e=>e.policy_name);eS(e)}catch(e){console.error("Failed to fetch policies:",e)}};(async()=>{try{if(null==a)return;let e=(await (0,l.getGuardrailsList)(a)).guardrails.map(e=>e.guardrail_name);ej(e)}catch(e){console.error("Failed to fetch guardrails:",e)}})(),e()},[a]);let eQ=async()=>{try{if(null==a)return;let e=await (0,l.fetchMCPAccessGroups)(a);eL(e)}catch(e){console.error("Failed to fetch MCP access groups:",e)}};(0,i.useEffect)(()=>{eQ()},[a]),(0,i.useEffect)(()=>{e&&ex(e.reduce((e,t)=>(e[t.team_id]={keys:t.keys||[],team_info:{members_with_roles:t.members_with_roles||[]}},e),{}))},[e]);let e2=async e=>{eo(e),ei(!0)},e4=async()=>{if(null!=en&&null!=e&&null!=a)try{eh(!0),await (0,l.teamDeleteCall)(a,en.team_id),await (0,eR.fetchTeams)(a,n,o,N,r),eM.default.success("Team deleted successfully")}catch(e){eM.default.fromBackend("Error deleting the team: "+e)}finally{eh(!1),ei(!1),eo(null)}};(0,i.useEffect)(()=>{(async()=>{try{if(null===n||null===o||null===a)return;let e=await (0,T.fetchAvailableModelsForTeamOrKey)(n,o,a);e&&es(e)}catch(e){console.error("Error fetching user models:",e)}})()},[a,n,o,e]);let e5=async t=>{try{if(console.log(`formValues: ${JSON.stringify(t)}`),null!=a){let s=t?.team_alias,i=e?.map(e=>e.team_alias)??[],n=t?.organization_id||N?.organization_id;if(""===n||"string"!=typeof n?t.organization_id=null:t.organization_id=n.trim(),i.includes(s))throw Error(`Team alias ${s} already exists, please pick another alias`);if(eM.default.info("Creating Team"),eF.length>0){let e={};if(t.metadata)try{e=JSON.parse(t.metadata)}catch(e){console.warn("Invalid JSON in metadata field, starting with empty object")}e={...e,logging:eF.filter(e=>e.callback_name)},t.metadata=JSON.stringify(e)}if(t.secret_manager_settings&&"string"==typeof t.secret_manager_settings)if(""===t.secret_manager_settings.trim())delete t.secret_manager_settings;else try{t.secret_manager_settings=JSON.parse(t.secret_manager_settings)}catch(e){throw Error("Failed to parse secret manager settings: "+e)}if(t.allowed_vector_store_ids&&t.allowed_vector_store_ids.length>0||t.allowed_mcp_servers_and_groups&&(t.allowed_mcp_servers_and_groups.servers?.length>0||t.allowed_mcp_servers_and_groups.accessGroups?.length>0||t.allowed_mcp_servers_and_groups.toolPermissions)){if(t.object_permission={},t.allowed_vector_store_ids&&t.allowed_vector_store_ids.length>0&&(t.object_permission.vector_stores=t.allowed_vector_store_ids,delete t.allowed_vector_store_ids),t.allowed_mcp_servers_and_groups){let{servers:e,accessGroups:s}=t.allowed_mcp_servers_and_groups;e&&e.length>0&&(t.object_permission.mcp_servers=e),s&&s.length>0&&(t.object_permission.mcp_access_groups=s),delete t.allowed_mcp_servers_and_groups}t.mcp_tool_permissions&&Object.keys(t.mcp_tool_permissions).length>0&&(t.object_permission||(t.object_permission={}),t.object_permission.mcp_tool_permissions=t.mcp_tool_permissions,delete t.mcp_tool_permissions)}if(t.allowed_mcp_access_groups&&t.allowed_mcp_access_groups.length>0&&(t.object_permission||(t.object_permission={}),t.object_permission.mcp_access_groups=t.allowed_mcp_access_groups,delete t.allowed_mcp_access_groups),t.allowed_agents_and_groups){let{agents:e,accessGroups:s}=t.allowed_agents_and_groups;t.object_permission||(t.object_permission={}),e&&e.length>0&&(t.object_permission.agents=e),s&&s.length>0&&(t.object_permission.agent_access_groups=s),delete t.allowed_agents_and_groups}Object.keys(eO).length>0&&(t.model_aliases=eO),eB?.router_settings&&Object.values(eB.router_settings).some(e=>null!=e&&""!==e)&&(t.router_settings=eB.router_settings);let o=await (0,l.teamCreateCall)(a,t);null!==e?r([...e,o]):r([o]),console.log(`response for team create call: ${o}`),eM.default.success("Team created"),D.resetFields(),eA([]),ez({}),eH(null),eW(e=>e+1),Y(!1)}}catch(e){console.error("Error creating the team:",e),eM.default.fromBackend("Error creating the team: "+e)}},e6=()=>{v(new Date().toLocaleString())},e3=(e,t)=>{let s={...L,[e]:t};M(s),a&&(0,l.v2TeamListCall)(a,s.organization_id||null,null,s.team_id||null,s.team_alias||null).then(e=>{e&&e.teams&&r(e.teams)}).catch(e=>{console.error("Error fetching teams:",e)})};return(0,t.jsx)("div",{className:"w-full mx-4 h-[75vh]",children:(0,t.jsx)(t4.Grid,{numItems:1,className:"gap-2 p-8 w-full mt-2",children:(0,t.jsxs)(t2.Col,{numColSpan:1,className:"flex flex-col gap-2",children:[sQ(o,n,d)&&(0,t.jsx)(m.Button,{className:"w-fit",onClick:()=>Y(!0),children:"+ Create New Team"}),G?(0,t.jsx)(sk.default,{teamId:G,onUpdate:e=>{r(t=>{if(null==t)return t;let s=t.map(t=>e.team_id===t.team_id?(0,tC.updateExistingKeys)(t,e):t);return a&&(0,eR.fetchTeams)(a,n,o,N,r),s})},onClose:()=>{H(null),W(!1)},accessToken:a,is_team_admin:(e=>{if(null==e||null==e.members_with_roles)return!1;for(let t=0;te.team_id===G)),is_proxy_admin:"Admin"==o,userModels:et,editTeam:K,premiumUser:c}):(0,t.jsxs)(eN.TabGroup,{className:"gap-2 h-[75vh] w-full",children:[(0,t.jsxs)(ew.TabList,{className:"flex justify-between mt-2 w-full items-center",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)(ev.Tab,{children:"Your Teams"}),(0,t.jsx)(ev.Tab,{children:"Available Teams"}),(0,ey.isProxyAdminRole)(o||"")&&(0,t.jsx)(ev.Tab,{children:"Default Team Settings"})]}),(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[_&&(0,t.jsxs)(e_.Text,{children:["Last Refreshed: ",_]}),(0,t.jsx)(eG.Icon,{icon:sI.RefreshIcon,variant:"shadow",size:"xs",className:"self-center",onClick:e6})]})]}),(0,t.jsxs)(eC.TabPanels,{children:[(0,t.jsxs)(ek.TabPanel,{children:[(0,t.jsxs)(e_.Text,{children:["Click on “Team ID” to view team details ",(0,t.jsx)("b",{children:"and"})," manage team members."]}),(0,t.jsx)(t4.Grid,{numItems:1,className:"gap-2 pt-2 pb-2 h-[75vh] w-full mt-2",children:(0,t.jsx)(t2.Col,{numColSpan:1,children:(0,t.jsxs)(ef.Card,{className:"w-full mx-auto flex-auto overflow-hidden overflow-y-auto max-h-[50vh]",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.jsx)(sF.FilterInput,{placeholder:"Search by Team Name...",value:L.team_alias,onChange:e=>e3("team_alias",e),icon:sL.Search}),(0,t.jsx)(sA.FiltersButton,{onClick:()=>P(!F),active:F,hasActiveFilters:!!(L.team_id||L.team_alias||L.organization_id)}),(0,t.jsx)(sP.ResetFiltersButton,{onClick:()=>{M({team_id:"",team_alias:"",organization_id:"",sort_by:"created_at",sort_order:"desc"}),a&&(0,l.v2TeamListCall)(a,null,n||null,null,null).then(e=>{e&&e.teams&&r(e.teams)}).catch(e=>{console.error("Error fetching teams:",e)})}})]}),F&&(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-3 mt-3",children:[(0,t.jsx)(sF.FilterInput,{placeholder:"Enter Team ID",value:L.team_id,onChange:e=>e3("team_id",e),icon:sM.User}),(0,t.jsx)("div",{className:"w-64",children:(0,t.jsx)(sE.Select,{value:L.organization_id||"",onValueChange:e=>e3("organization_id",e),placeholder:"Select Organization",children:d?.map(e=>(0,t.jsx)(sO.SelectItem,{value:e.organization_id||"",children:e.organization_alias||e.organization_id},e.organization_id))})})]})]})}),(0,t.jsxs)(eY.Table,{children:[(0,t.jsx)(eJ.TableHead,{children:(0,t.jsxs)(eX.TableRow,{children:[(0,t.jsx)(eZ.TableHeaderCell,{children:"Team Name"}),(0,t.jsx)(eZ.TableHeaderCell,{children:"Team ID"}),(0,t.jsx)(eZ.TableHeaderCell,{children:"Created"}),(0,t.jsx)(eZ.TableHeaderCell,{children:"Spend (USD)"}),(0,t.jsx)(eZ.TableHeaderCell,{children:"Budget (USD)"}),(0,t.jsx)(eZ.TableHeaderCell,{children:"Models"}),(0,t.jsx)(eZ.TableHeaderCell,{children:"Organization"}),(0,t.jsx)(eZ.TableHeaderCell,{children:"Info"}),(0,t.jsx)(eZ.TableHeaderCell,{children:"Actions"})]})}),(0,t.jsx)(e0.TableBody,{children:e&&e.length>0?e.filter(e=>!N||e.organization_id===N.organization_id).sort((e,t)=>new Date(t.created_at).getTime()-new Date(e.created_at).getTime()).map(e=>(0,t.jsxs)(eX.TableRow,{children:[(0,t.jsx)(e1.TableCell,{style:{maxWidth:"4px",whiteSpace:"pre-wrap",overflow:"hidden"},children:e.team_alias}),(0,t.jsx)(e1.TableCell,{children:(0,t.jsx)("div",{className:"overflow-hidden",children:(0,t.jsx)(eu.Tooltip,{title:e.team_id,children:(0,t.jsxs)(m.Button,{size:"xs",variant:"light",className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left overflow-hidden truncate max-w-[200px]",onClick:()=>{H(e.team_id)},children:[e.team_id.slice(0,7),"..."]})})})}),(0,t.jsx)(e1.TableCell,{style:{maxWidth:"4px",whiteSpace:"pre-wrap",overflow:"hidden"},children:e.created_at?new Date(e.created_at).toLocaleDateString():"N/A"}),(0,t.jsx)(e1.TableCell,{style:{maxWidth:"4px",whiteSpace:"pre-wrap",overflow:"hidden"},children:(0,tC.formatNumberWithCommas)(e.spend,4)}),(0,t.jsx)(e1.TableCell,{style:{maxWidth:"4px",whiteSpace:"pre-wrap",overflow:"hidden"},children:null!==e.max_budget&&void 0!==e.max_budget?e.max_budget:"No limit"}),(0,t.jsx)(e1.TableCell,{style:{maxWidth:"8-x",whiteSpace:"pre-wrap",overflow:"hidden"},className:e.models.length>3?"px-0":"",children:(0,t.jsx)("div",{className:"flex flex-col",children:Array.isArray(e.models)?(0,t.jsx)("div",{className:"flex flex-col",children:0===e.models.length?(0,t.jsx)(sD.Badge,{size:"xs",className:"mb-1",color:"red",children:(0,t.jsx)(e_.Text,{children:"All Proxy Models"})}):(0,t.jsx)(t.Fragment,{children:(0,t.jsxs)("div",{className:"flex items-start",children:[e.models.length>3&&(0,t.jsx)("div",{children:(0,t.jsx)(eG.Icon,{icon:eT[e.team_id]?sS.ChevronDownIcon:sT.ChevronRightIcon,className:"cursor-pointer",size:"xs",onClick:()=>{eI(t=>({...t,[e.team_id]:!t[e.team_id]}))}})}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-1",children:[e.models.slice(0,3).map((e,s)=>"all-proxy-models"===e?(0,t.jsx)(sD.Badge,{size:"xs",color:"red",children:(0,t.jsx)(e_.Text,{children:"All Proxy Models"})},s):(0,t.jsx)(sD.Badge,{size:"xs",color:"blue",children:(0,t.jsx)(e_.Text,{children:e.length>30?`${(0,T.getModelDisplayName)(e).slice(0,30)}...`:(0,T.getModelDisplayName)(e)})},s)),e.models.length>3&&!eT[e.team_id]&&(0,t.jsx)(sD.Badge,{size:"xs",color:"gray",className:"cursor-pointer",children:(0,t.jsxs)(e_.Text,{children:["+",e.models.length-3," ",e.models.length-3==1?"more model":"more models"]})}),eT[e.team_id]&&(0,t.jsx)("div",{className:"flex flex-wrap gap-1",children:e.models.slice(3).map((e,s)=>"all-proxy-models"===e?(0,t.jsx)(sD.Badge,{size:"xs",color:"red",children:(0,t.jsx)(e_.Text,{children:"All Proxy Models"})},s+3):(0,t.jsx)(sD.Badge,{size:"xs",color:"blue",children:(0,t.jsx)(e_.Text,{children:e.length>30?`${(0,T.getModelDisplayName)(e).slice(0,30)}...`:(0,T.getModelDisplayName)(e)})},s+3))})]})]})})}):null})}),(0,t.jsx)(e1.TableCell,{children:((e,t)=>{if(!e||!t)return e||"N/A";let s=t.find(t=>t.organization_id===e);return s?.organization_alias||e})(e.organization_id,b||d)}),(0,t.jsxs)(e1.TableCell,{children:[(0,t.jsxs)(e_.Text,{children:[em&&e.team_id&&em[e.team_id]&&em[e.team_id].keys&&em[e.team_id].keys.length," ","Keys"]}),(0,t.jsxs)(e_.Text,{children:[em&&e.team_id&&em[e.team_id]&&em[e.team_id].team_info&&em[e.team_id].team_info.members_with_roles&&em[e.team_id].team_info.members_with_roles.length," ","Members"]})]}),(0,t.jsx)(e1.TableCell,{children:"Admin"==o?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(sK.default,{variant:"Edit",onClick:()=>{H(e.team_id),W(!0)},dataTestId:"edit-team-button",tooltipText:"Edit team"}),(0,t.jsx)(sK.default,{variant:"Delete",onClick:()=>e2(e),dataTestId:"delete-team-button",tooltipText:"Delete team"})]}):null})]},e.team_id)):(0,t.jsx)(eX.TableRow,{children:(0,t.jsx)(e1.TableCell,{colSpan:9,className:"text-center",children:(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center py-4",children:[(0,t.jsx)(e_.Text,{className:"text-lg font-medium mb-2",children:"No teams found"}),(0,t.jsx)(e_.Text,{className:"text-sm",children:"Adjust your filters or create a new team"})]})})})})]}),(0,t.jsx)(sH.default,{isOpen:ea,title:"Delete Team?",alertMessage:en?.keys?.length===0?void 0:`Warning: This team has ${en?.keys?.length} keys associated with it. Deleting the team will also delete all associated keys. This action is irreversible.`,message:"Are you sure you want to delete this team and all its keys? This action cannot be undone.",resourceInformationTitle:"Team Information",resourceInformation:[{label:"Team ID",value:en?.team_id,code:!0},{label:"Team Name",value:en?.team_alias},{label:"Keys",value:en?.keys?.length},{label:"Members",value:en?.members_with_roles?.length}],requiredConfirmation:en?.team_alias,onCancel:()=>{ei(!1),eo(null)},onOk:e4,confirmLoading:ep})]})})})]}),(0,t.jsx)(ek.TabPanel,{children:(0,t.jsx)(sw.default,{accessToken:a,userID:n})}),(0,ey.isProxyAdminRole)(o||"")&&(0,t.jsx)(ek.TabPanel,{children:(0,t.jsx)(sC.default,{accessToken:a,userID:n||"",userRole:o||""})})]})]}),sQ(o,n,d)&&(0,t.jsx)(u.Modal,{title:"Create Team",open:Q,width:1e3,footer:null,onOk:()=>{Y(!1),D.resetFields(),eA([]),ez({}),eH(null),eW(e=>e+1)},onCancel:()=>{Y(!1),D.resetFields(),eA([]),ez({}),eH(null),eW(e=>e+1)},children:(0,t.jsxs)(p.Form,{form:D,onFinish:e5,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(p.Form.Item,{label:"Team Name",name:"team_alias",rules:[{required:!0,message:"Please input a team name"}],children:(0,t.jsx)(eV.TextInput,{placeholder:""})}),(x=sY(o,n,d),h="Admin"!==o,y=1===x.length,f=0===x.length,(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(p.Form.Item,{label:(0,t.jsxs)("span",{children:["Organization"," ",(0,t.jsx)(eu.Tooltip,{title:(0,t.jsxs)("span",{children:["Organizations can have multiple teams. Learn more about"," ",(0,t.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/user_management_heirarchy",target:"_blank",rel:"noopener noreferrer",style:{color:"#1890ff",textDecoration:"underline"},onClick:e=>e.stopPropagation(),children:"user management hierarchy"})]}),children:(0,t.jsx)(C.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"organization_id",initialValue:N?N.organization_id:null,className:"mt-8",rules:h?[{required:!0,message:"Please select an organization"}]:[],help:y?"You can only create teams within this organization":h?"required":"",children:(0,t.jsx)(g.Select,{showSearch:!0,allowClear:!h,disabled:y,placeholder:f?"No organizations available":"Search or select an Organization",onChange:e=>{D.setFieldValue("organization_id",e),S(x?.find(t=>t.organization_id===e)||null)},filterOption:(e,t)=>!!t&&(t.children?.toString()||"").toLowerCase().includes(e.toLowerCase()),optionFilterProp:"children",children:x?.map(e=>(0,t.jsxs)(g.Select.Option,{value:e.organization_id,children:[(0,t.jsx)("span",{className:"font-medium",children:e.organization_alias})," ",(0,t.jsxs)("span",{className:"text-gray-500",children:["(",e.organization_id,")"]})]},e.organization_id))})}),h&&!y&&x.length>1&&(0,t.jsx)("div",{className:"mb-8 p-4 bg-blue-50 border border-blue-200 rounded-md",children:(0,t.jsx)(e_.Text,{className:"text-blue-800 text-sm",children:"Please select an organization to create a team for. You can only create teams within organizations where you are an admin."})})]})),(0,t.jsx)(p.Form.Item,{label:(0,t.jsxs)("span",{children:["Models"," ",(0,t.jsx)(eu.Tooltip,{title:"These are the models that your selected team has access to",children:(0,t.jsx)(C.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),rules:[{required:!0,message:"Please select at least one model"}],name:"models",children:(0,t.jsx)(sW.ModelSelect,{value:D.getFieldValue("models")||[],onChange:e=>D.setFieldValue("models",e),organizationID:D.getFieldValue("organization_id"),options:{includeSpecialOptions:!0,showAllProxyModelsOverride:!D.getFieldValue("organization_id")},context:"team",dataTestId:"create-team-models-select"})}),(0,t.jsx)(p.Form.Item,{label:"Max Budget (USD)",name:"max_budget",children:(0,t.jsx)(sV.default,{step:.01,precision:2,width:200})}),(0,t.jsx)(p.Form.Item,{className:"mt-8",label:"Reset Budget",name:"budget_duration",children:(0,t.jsxs)(g.Select,{defaultValue:null,placeholder:"n/a",children:[(0,t.jsx)(g.Select.Option,{value:"24h",children:"daily"}),(0,t.jsx)(g.Select.Option,{value:"7d",children:"weekly"}),(0,t.jsx)(g.Select.Option,{value:"30d",children:"monthly"})]})}),(0,t.jsx)(p.Form.Item,{label:"Tokens per minute Limit (TPM)",name:"tpm_limit",children:(0,t.jsx)(sV.default,{step:1,width:400})}),(0,t.jsx)(p.Form.Item,{label:"Requests per minute Limit (RPM)",name:"rpm_limit",children:(0,t.jsx)(sV.default,{step:1,width:400})}),(0,t.jsxs)(eq.Accordion,{className:"mt-20 mb-8",onClick:()=>{eD||(eQ(),eE(!0))},children:[(0,t.jsx)(e$.AccordionHeader,{children:(0,t.jsx)("b",{children:"Additional Settings"})}),(0,t.jsxs)(eU.AccordionBody,{children:[(0,t.jsx)(p.Form.Item,{label:"Team ID",name:"team_id",help:"ID of the team you want to create. If not provided, it will be generated automatically.",children:(0,t.jsx)(eV.TextInput,{onChange:e=>{e.target.value=e.target.value.trim()}})}),(0,t.jsx)(p.Form.Item,{label:"Team Member Budget (USD)",name:"team_member_budget",normalize:e=>e?Number(e):void 0,tooltip:"This is the individual budget for a user in the team.",children:(0,t.jsx)(sV.default,{step:.01,precision:2,width:200})}),(0,t.jsx)(p.Form.Item,{label:"Team Member Key Duration (eg: 1d, 1mo)",name:"team_member_key_duration",tooltip:"Set a limit to the duration of a team member's key. Format: 30s (seconds), 30m (minutes), 30h (hours), 30d (days), 1mo (month)",children:(0,t.jsx)(eV.TextInput,{placeholder:"e.g., 30d"})}),(0,t.jsx)(p.Form.Item,{label:"Team Member RPM Limit",name:"team_member_rpm_limit",tooltip:"The RPM (Requests Per Minute) limit for individual team members",children:(0,t.jsx)(sV.default,{step:1,width:400})}),(0,t.jsx)(p.Form.Item,{label:"Team Member TPM Limit",name:"team_member_tpm_limit",tooltip:"The TPM (Tokens Per Minute) limit for individual team members",children:(0,t.jsx)(sV.default,{step:1,width:400})}),(0,t.jsx)(p.Form.Item,{label:"Metadata",name:"metadata",help:"Additional team metadata. Enter metadata as JSON object.",children:(0,t.jsx)(j.Input.TextArea,{rows:4})}),(0,t.jsx)(p.Form.Item,{label:"Secret Manager Settings",name:"secret_manager_settings",help:c?"Enter secret manager configuration as a JSON object.":"Premium feature - Upgrade to manage secret manager settings.",rules:[{validator:async(e,t)=>{if(!t)return Promise.resolve();try{return JSON.parse(t),Promise.resolve()}catch(e){return Promise.reject(Error("Please enter valid JSON"))}}}],children:(0,t.jsx)(j.Input.TextArea,{rows:4,placeholder:'{"namespace": "admin", "mount": "secret", "path_prefix": "litellm"}',disabled:!c})}),(0,t.jsx)(p.Form.Item,{label:(0,t.jsxs)("span",{children:["Guardrails"," ",(0,t.jsx)(eu.Tooltip,{title:"Setup your first guardrail",children:(0,t.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/guardrails/quick_start",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:(0,t.jsx)(C.InfoCircleOutlined,{style:{marginLeft:"4px"}})})})]}),name:"guardrails",className:"mt-8",help:"Select existing guardrails or enter new ones",children:(0,t.jsx)(g.Select,{mode:"tags",style:{width:"100%"},placeholder:"Select or enter guardrails",options:eg.map(e=>({value:e,label:e}))})}),(0,t.jsx)(p.Form.Item,{label:(0,t.jsxs)("span",{children:["Disable Global Guardrails"," ",(0,t.jsx)(eu.Tooltip,{title:"When enabled, this team will bypass any guardrails configured to run on every request (global guardrails)",children:(0,t.jsx)(C.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"disable_global_guardrails",className:"mt-4",valuePropName:"checked",help:"Bypass global guardrails for this team",children:(0,t.jsx)(I.Switch,{disabled:!c,checkedChildren:c?"Yes":"Premium feature - Upgrade to disable global guardrails by team",unCheckedChildren:c?"No":"Premium feature - Upgrade to disable global guardrails by team"})}),(0,t.jsx)(p.Form.Item,{label:(0,t.jsxs)("span",{children:["Policies"," ",(0,t.jsx)(eu.Tooltip,{title:"Apply policies to this team to control guardrails and other settings",children:(0,t.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/guardrails/guardrail_policies",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:(0,t.jsx)(C.InfoCircleOutlined,{style:{marginLeft:"4px"}})})})]}),name:"policies",className:"mt-8",help:"Select existing policies or enter new ones",children:(0,t.jsx)(g.Select,{mode:"tags",style:{width:"100%"},placeholder:"Select or enter policies",options:eb.map(e=>({value:e,label:e}))})}),(0,t.jsx)(p.Form.Item,{label:(0,t.jsxs)("span",{children:["Access Groups"," ",(0,t.jsx)(eu.Tooltip,{title:"Assign access groups to this team. Access groups control which models, MCP servers, and agents this team can use",children:(0,t.jsx)(C.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"access_group_ids",className:"mt-8",help:"Select access groups to assign to this team",children:(0,t.jsx)(sR.default,{placeholder:"Select access groups (optional)"})}),(0,t.jsx)(p.Form.Item,{label:(0,t.jsxs)("span",{children:["Allowed Vector Stores"," ",(0,t.jsx)(eu.Tooltip,{title:"Select which vector stores this team can access by default. Leave empty for access to all vector stores",children:(0,t.jsx)(C.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"allowed_vector_store_ids",className:"mt-8",help:"Select vector stores this team can access. Leave empty for access to all vector stores",children:(0,t.jsx)(sG.default,{onChange:e=>D.setFieldValue("allowed_vector_store_ids",e),value:D.getFieldValue("allowed_vector_store_ids"),accessToken:a||"",placeholder:"Select vector stores (optional)"})})]})]}),(0,t.jsxs)(eq.Accordion,{className:"mt-8 mb-8",children:[(0,t.jsx)(e$.AccordionHeader,{children:(0,t.jsx)("b",{children:"MCP Settings"})}),(0,t.jsxs)(eU.AccordionBody,{children:[(0,t.jsx)(p.Form.Item,{label:(0,t.jsxs)("span",{children:["Allowed MCP Servers"," ",(0,t.jsx)(eu.Tooltip,{title:"Select which MCP servers or access groups this team can access",children:(0,t.jsx)(C.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"allowed_mcp_servers_and_groups",className:"mt-4",help:"Select MCP servers or access groups this team can access",children:(0,t.jsx)(el.default,{onChange:e=>D.setFieldValue("allowed_mcp_servers_and_groups",e),value:D.getFieldValue("allowed_mcp_servers_and_groups"),accessToken:a||"",placeholder:"Select MCP servers or access groups (optional)"})}),(0,t.jsx)(p.Form.Item,{name:"mcp_tool_permissions",initialValue:{},hidden:!0,children:(0,t.jsx)(j.Input,{type:"hidden"})}),(0,t.jsx)(p.Form.Item,{noStyle:!0,shouldUpdate:(e,t)=>e.allowed_mcp_servers_and_groups!==t.allowed_mcp_servers_and_groups||e.mcp_tool_permissions!==t.mcp_tool_permissions,children:()=>(0,t.jsx)("div",{className:"mt-6",children:(0,t.jsx)(er.default,{accessToken:a||"",selectedServers:D.getFieldValue("allowed_mcp_servers_and_groups")?.servers||[],toolPermissions:D.getFieldValue("mcp_tool_permissions")||{},onChange:e=>D.setFieldsValue({mcp_tool_permissions:e})})})})]})]}),(0,t.jsxs)(eq.Accordion,{className:"mt-8 mb-8",children:[(0,t.jsx)(e$.AccordionHeader,{children:(0,t.jsx)("b",{children:"Agent Settings"})}),(0,t.jsx)(eU.AccordionBody,{children:(0,t.jsx)(p.Form.Item,{label:(0,t.jsxs)("span",{children:["Allowed Agents"," ",(0,t.jsx)(eu.Tooltip,{title:"Select which agents or access groups this team can access",children:(0,t.jsx)(C.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"allowed_agents_and_groups",className:"mt-4",help:"Select agents or access groups this team can access",children:(0,t.jsx)(sB.default,{onChange:e=>D.setFieldValue("allowed_agents_and_groups",e),value:D.getFieldValue("allowed_agents_and_groups"),accessToken:a||"",placeholder:"Select agents or access groups (optional)"})})})]}),(0,t.jsxs)(eq.Accordion,{className:"mt-8 mb-8",children:[(0,t.jsx)(e$.AccordionHeader,{children:(0,t.jsx)("b",{children:"Logging Settings"})}),(0,t.jsx)(eU.AccordionBody,{children:(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsx)(s$.default,{value:eF,onChange:eA,premiumUser:c})})})]}),(0,t.jsxs)(eq.Accordion,{className:"mt-8 mb-8",children:[(0,t.jsx)(e$.AccordionHeader,{children:(0,t.jsx)("b",{children:"Router Settings"})}),(0,t.jsx)(eU.AccordionBody,{children:(0,t.jsx)("div",{className:"mt-4 w-full",children:(0,t.jsx)(sU.default,{accessToken:a||"",value:eB||void 0,onChange:eH,modelData:et.length>0?{data:et.map(e=>({model_name:e}))}:void 0},eK)})})]},`router-settings-accordion-${eK}`),(0,t.jsxs)(eq.Accordion,{className:"mt-8 mb-8",children:[(0,t.jsx)(e$.AccordionHeader,{children:(0,t.jsx)("b",{children:"Model Aliases"})}),(0,t.jsx)(eU.AccordionBody,{children:(0,t.jsxs)("div",{className:"mt-4",children:[(0,t.jsx)(e_.Text,{className:"text-sm text-gray-600 mb-4",children:"Create custom aliases for models that can be used by team members in API calls. This allows you to create shortcuts for specific models."}),(0,t.jsx)(sq.default,{accessToken:a||"",initialModelAliases:eO,onAliasUpdate:ez,showExampleConfig:!1})]})})]})]}),(0,t.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,t.jsx)(A.Button,{htmlType:"submit",children:"Create Team"})})]})})]})})})};var sX=e.i(702597),sZ=e.i(846835),s0=e.i(147612),s1=e.i(191403),s2=e.i(976883),s4=e.i(657688),s5=e.i(437902);let{Text:s6}=sz.Typography,s3=({litellmParams:e,accessToken:s,onTestComplete:a})=>{let[r,n]=(0,i.useState)(!0),[o,d]=(0,i.useState)(null),[c,m]=(0,i.useState)(!1);(0,i.useEffect)(()=>{(async()=>{n(!0);try{let t=await (0,l.testSearchToolConnection)(s,e);d(t),"success"===t.status&&eM.default.success("Connection test successful!")}catch(e){d({status:"error",message:e instanceof Error?e.message:"Unknown error occurred",error_type:"NetworkError"})}finally{n(!1),a&&a()}})()},[s,e,a]);let u=o?.message?(e=>{if(!e)return"Unknown error";let t=e.split("stack trace:")[0].trim().replace(/^litellm\.(.*?)Error:\s*/,"").replace(/^AuthenticationError:\s*/,"");if(t.includes("")||t.includes("(.*?)<\/title>/);return e?e[1]:t.includes("401")||t.includes("Authorization Required")?"Authentication failed: Invalid API key or credentials":"Authentication error - please check your API key"}return t.length>200?t.substring(0,200)+"...":t})(o.message):"Unknown error";return r?(0,t.jsx)("div",{style:{padding:"24px",borderRadius:"8px",backgroundColor:"#fff"},children:(0,t.jsxs)("div",{style:{textAlign:"center",padding:"32px 20px"},className:"jsx-dc9a0e2d897fe63b",children:[(0,t.jsx)("div",{style:{marginBottom:"16px"},className:"jsx-dc9a0e2d897fe63b loading-spinner",children:(0,t.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,t.jsxs)(s6,{style:{fontSize:"16px"},children:["Testing connection to ",e.search_provider||"search provider","..."]}),(0,t.jsx)(s5.default,{id:"dc9a0e2d897fe63b",children:"@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}"})]})}):o?(0,t.jsxs)("div",{style:{padding:"24px",borderRadius:"8px",backgroundColor:"#fff"},children:["success"===o.status?(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"32px 20px"},children:[(0,t.jsx)("div",{style:{color:"#52c41a",fontSize:"24px",display:"flex",alignItems:"center"},children:(0,t.jsx)("svg",{viewBox:"64 64 896 896",focusable:"false","data-icon":"check-circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",children:(0,t.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,t.jsxs)("div",{style:{marginLeft:"12px"},children:[(0,t.jsxs)(s6,{type:"success",style:{fontSize:"18px",fontWeight:500,display:"block"},children:["Connection to ",e.search_provider," successful!"]}),o.test_query&&(0,t.jsxs)(s6,{style:{fontSize:"14px",color:"#666",marginTop:"8px",display:"block"},children:["Test query: ",(0,t.jsx)("code",{style:{backgroundColor:"#f0f0f0",padding:"2px 6px",borderRadius:"4px"},children:o.test_query})]}),void 0!==o.results_count&&(0,t.jsxs)(s6,{style:{fontSize:"14px",color:"#666",display:"block"},children:["Results retrieved: ",o.results_count]})]})]}):(0,t.jsx)(t.Fragment,{children:(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",marginBottom:"20px"},children:[(0,t.jsx)(ep.WarningOutlined,{style:{color:"#ff4d4f",fontSize:"24px",marginRight:"12px"}}),(0,t.jsxs)(s6,{type:"danger",style:{fontSize:"18px",fontWeight:500},children:["Connection to ",e.search_provider||"search provider"," failed"]})]}),(0,t.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,t.jsxs)(s6,{strong:!0,style:{display:"block",marginBottom:"8px"},children:["Error:"," "]}),(0,t.jsx)(s6,{type:"danger",style:{fontSize:"14px",lineHeight:"1.5"},children:u}),o.error_type&&(0,t.jsx)("div",{style:{marginTop:"8px"},children:(0,t.jsxs)(s6,{style:{fontSize:"13px",color:"#666"},children:["Error type:"," ",(0,t.jsx)("code",{style:{backgroundColor:"#ffebee",padding:"2px 6px",borderRadius:"4px",color:"#d32f2f"},children:o.error_type})]})}),o.message&&(0,t.jsx)("div",{style:{marginTop:"12px"},children:(0,t.jsx)(A.Button,{type:"link",onClick:()=>m(!c),style:{paddingLeft:0,height:"auto"},children:c?"Hide Details":"Show Details"})})]}),c&&(0,t.jsxs)("div",{style:{marginBottom:"20px"},children:[(0,t.jsx)(s6,{strong:!0,style:{display:"block",marginBottom:"8px",fontSize:"15px"},children:"Full Error Details"}),(0,t.jsx)("pre",{style:{backgroundColor:"#f5f5f5",padding:"16px",borderRadius:"8px",fontSize:"13px",maxHeight:"200px",overflow:"auto",border:"1px solid #e8e8e8",lineHeight:"1.5",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:o.message})]}),(0,t.jsxs)("div",{style:{backgroundColor:"#fffbf0",border:"1px solid #ffe58f",borderLeft:"4px solid #faad14",borderRadius:"8px",padding:"16px"},children:[(0,t.jsx)(s6,{strong:!0,style:{display:"block",marginBottom:"8px",color:"#d48806"},children:"Troubleshooting tips:"}),(0,t.jsxs)("ul",{style:{margin:"8px 0",paddingLeft:"20px",color:"#ad6800"},children:[(0,t.jsx)("li",{style:{marginBottom:"6px"},children:"Verify your API key is correct and active"}),(0,t.jsx)("li",{style:{marginBottom:"6px"},children:"Check if the search provider service is operational"}),(0,t.jsx)("li",{style:{marginBottom:"6px"},children:"Ensure you have sufficient credits/quota with the provider"}),(0,t.jsx)("li",{style:{marginBottom:"6px"},children:"Review the provider's documentation for any additional requirements"})]})]})]})}),(0,t.jsx)(_.Divider,{style:{margin:"24px 0 16px"}}),(0,t.jsx)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:(0,t.jsx)(A.Button,{type:"link",href:"https://docs.litellm.ai/docs/search",target:"_blank",icon:(0,t.jsx)(C.InfoCircleOutlined,{}),children:"View Search Documentation"})})]}):null},{TextArea:s8}=j.Input,s7=({providerName:e,displayName:s})=>(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center"},children:[(0,t.jsx)(s4.default,{src:`../ui/assets/logos/${e}.png`,alt:"",width:20,height:20,style:{marginRight:"8px",objectFit:"contain"},onError:e=>{e.currentTarget.style.display="none"}}),(0,t.jsx)("span",{children:s})]}),s9=({userRole:e,accessToken:s,onCreateSuccess:a,isModalVisible:r,setModalVisible:n})=>{let[o]=p.Form.useForm(),[d,c]=(0,i.useState)(!1),[x,h]=(0,i.useState)({}),[j,y]=(0,i.useState)(!1),[f,b]=(0,i.useState)(!1),[_,v]=(0,i.useState)(""),{data:N,isLoading:w}=(0,t1.useQuery)({queryKey:["searchProviders"],queryFn:()=>{if(!s)throw Error("Access Token required");return(0,l.fetchAvailableSearchProviders)(s)},enabled:!!s&&r}),k=N?.providers||[],S=async e=>{c(!0);try{let t={search_tool_name:e.search_tool_name,litellm_params:{search_provider:e.search_provider,api_key:e.api_key,api_base:e.api_base,timeout:e.timeout?parseFloat(e.timeout):void 0,max_retries:e.max_retries?parseInt(e.max_retries):void 0},search_tool_info:e.description?{description:e.description}:void 0};if(console.log("Creating search tool with payload:",t),null!=s){let e=await (0,l.createSearchTool)(s,t);eM.default.success("Search tool created successfully"),o.resetFields(),h({}),n(!1),a(e)}}catch(e){eM.default.error("Error creating search tool: "+e)}finally{c(!1)}},T=async()=>{try{await o.validateFields(["search_provider","api_key"]),b(!0),v(`test-${Date.now()}`),y(!0)}catch(e){eM.default.error("Please fill in Search Provider and API Key before testing")}};return(i.default.useEffect(()=>{r||h({})},[r]),(0,ey.isAdminRole)(e))?(0,t.jsxs)(u.Modal,{title:(0,t.jsxs)("div",{className:"flex items-center space-x-3 pb-4 border-b border-gray-100",children:[(0,t.jsx)("span",{className:"text-2xl",children:"🔍"}),(0,t.jsx)("h2",{className:"text-xl font-semibold text-gray-900",children:"Add New Search Tool"})]}),open:r,width:800,onCancel:()=>{o.resetFields(),h({}),n(!1)},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)(p.Form,{form:o,onFinish:S,onValuesChange:(e,t)=>h(t),layout:"vertical",className:"space-y-6",children:[(0,t.jsxs)("div",{className:"grid grid-cols-1 gap-6",children:[(0,t.jsx)(p.Form.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Search Tool Name",(0,t.jsx)(eu.Tooltip,{title:"A unique name to identify this search tool configuration (e.g., 'perplexity-search', 'tavily-news-search').",children:(0,t.jsx)(C.InfoCircleOutlined,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"search_tool_name",rules:[{required:!0,message:"Please enter a search tool name"},{pattern:/^[a-zA-Z0-9_-]+$/,message:"Name can only contain letters, numbers, hyphens, and underscores"}],children:(0,t.jsx)(eV.TextInput,{placeholder:"e.g., perplexity-search, my-tavily-tool",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,t.jsx)(p.Form.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Search Provider",(0,t.jsx)(eu.Tooltip,{title:"Select the search provider you want to use. Each provider has different capabilities and pricing.",children:(0,t.jsx)(C.InfoCircleOutlined,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"search_provider",rules:[{required:!0,message:"Please select a search provider"}],children:(0,t.jsx)(g.Select,{placeholder:"Select a search provider",className:"rounded-lg",size:"large",loading:w,showSearch:!0,optionFilterProp:"children",optionLabelProp:"label",children:k.map(e=>(0,t.jsx)(g.Select.Option,{value:e.provider_name,label:(0,t.jsx)(s7,{providerName:e.provider_name,displayName:e.ui_friendly_name}),children:(0,t.jsx)(s7,{providerName:e.provider_name,displayName:e.ui_friendly_name})},e.provider_name))})}),(0,t.jsx)(p.Form.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["API Key",(0,t.jsx)(eu.Tooltip,{title:"The API key for authenticating with the search provider. This will be securely stored.",children:(0,t.jsx)(C.InfoCircleOutlined,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"api_key",rules:[{required:!1,message:"Please enter an API key"}],children:(0,t.jsx)(eV.TextInput,{type:"password",placeholder:"Enter your API key",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,t.jsx)(p.Form.Item,{label:(0,t.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Description (Optional)"}),name:"description",children:(0,t.jsx)(s8,{rows:3,placeholder:"Brief description of this search tool's purpose",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})})]}),(0,t.jsxs)("div",{className:"flex justify-between items-center pt-6 border-t border-gray-100",children:[(0,t.jsx)(eu.Tooltip,{title:"Get help on our github",children:(0,t.jsx)(sz.Typography.Link,{href:"https://github.com/BerriAI/litellm/issues",target:"_blank",children:"Need Help?"})}),(0,t.jsxs)("div",{className:"space-x-2",children:[(0,t.jsx)(m.Button,{onClick:T,loading:f,children:"Test Connection"}),(0,t.jsx)(m.Button,{loading:d,type:"submit",children:"Add Search Tool"})]})]})]})}),(0,t.jsx)(u.Modal,{title:"Connection Test Results",open:j,onCancel:()=>{y(!1),b(!1)},footer:[(0,t.jsx)(m.Button,{onClick:()=>{y(!1),b(!1)},children:"Close"},"close")],width:700,children:j&&s&&(0,t.jsx)(s3,{litellmParams:{search_provider:x.search_provider,api_key:x.api_key,api_base:x.api_base},accessToken:s,onTestComplete:()=>b(!1)},_)})]}):null};var ae=e.i(678784),at=e.i(118366),as=e.i(928685);let{Text:aa}=sz.Typography,al=({searchToolName:e,accessToken:s,className:a=""})=>{let[r,n]=(0,i.useState)(""),[o,d]=(0,i.useState)(!1),[c,m]=(0,i.useState)([]),[u,x]=(0,i.useState)({}),[p,g]=(0,i.useState)(!1),y=async()=>{if(!r.trim())return void h.message.warning("Please enter a search query");d(!0);let t=performance.now();try{let a=await (0,l.searchToolQueryCall)(s,e,r),i=performance.now(),n=Math.round(i-t),o={query:r,response:a,timestamp:Date.now(),latency:n};m(e=>[o,...e])}catch(e){console.error("Error querying search tool:",e),eM.default.fromBackend("Failed to query search tool")}finally{d(!1)}},f=e=>new Date(e).toLocaleString(),b=(0,t.jsx)(tN.LoadingOutlined,{style:{fontSize:24},spin:!0}),_=c.length>0?c[0]:null;return(0,t.jsxs)(ef.Card,{className:"mt-6",children:[(0,t.jsx)("div",{className:"mb-6",children:(0,t.jsx)(eb.Title,{children:"Test Search Tool"})}),(0,t.jsxs)("div",{className:"flex flex-col",style:{minHeight:"600px"},children:[(0,t.jsx)("div",{className:"mb-6",children:(0,t.jsxs)("div",{className:"flex items-stretch gap-3",children:[(0,t.jsxs)("div",{className:"flex items-center flex-1 bg-white rounded-lg px-4 transition-all duration-200",style:{border:p?"2px solid #3b82f6":"2px solid #e5e7eb",boxShadow:p?"0 0 0 3px rgba(59, 130, 246, 0.1)":"0 1px 2px 0 rgba(0, 0, 0, 0.05)",height:"48px"},children:[(0,t.jsx)(as.SearchOutlined,{className:"text-gray-400 mr-3",style:{fontSize:"18px"}}),(0,t.jsx)(j.Input,{value:r,onChange:e=>n(e.target.value),onFocus:()=>g(!0),onBlur:()=>g(!1),onPressEnter:e=>{e.shiftKey||(e.preventDefault(),y())},placeholder:"Enter your search query...",disabled:o,bordered:!1,style:{fontSize:"15px",padding:0,height:"100%",boxShadow:"none"}})]}),(0,t.jsx)(A.Button,{type:"primary",onClick:y,disabled:o||!r.trim(),icon:(0,t.jsx)(as.SearchOutlined,{}),loading:o,style:{height:"48px",paddingLeft:"24px",paddingRight:"24px",borderRadius:"8px",fontWeight:500,fontSize:"15px",backgroundColor:o||!r.trim()?void 0:"#1890ff",borderColor:o||!r.trim()?void 0:"#1890ff",boxShadow:"0 1px 2px 0 rgba(0, 0, 0, 0.05)"},children:"Search"})]})}),(0,t.jsx)("div",{className:"flex-1",children:_||o?(0,t.jsxs)("div",{children:[o&&(0,t.jsxs)("div",{className:"flex flex-col justify-center items-center py-16",children:[(0,t.jsx)(eS.Spin,{indicator:b}),(0,t.jsx)(aa,{className:"mt-4 text-gray-600 font-medium",children:"Searching..."})]}),_&&!o&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"mb-6 p-4 bg-blue-50 border border-blue-200 rounded-lg",style:{boxShadow:"0 1px 2px 0 rgba(0, 0, 0, 0.05)"},children:(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)(aa,{className:"text-xs font-semibold text-gray-500 uppercase tracking-wide",children:"Search Query"}),(0,t.jsx)("div",{className:"text-base font-semibold text-gray-900 mt-1.5",children:_.query})]}),(0,t.jsxs)("div",{className:"text-right ml-4",children:[(0,t.jsx)(aa,{className:"text-xs text-gray-500",children:f(_.timestamp)}),(0,t.jsxs)("div",{className:"flex items-center gap-3 mt-1",children:[(0,t.jsxs)("div",{className:"text-sm font-semibold text-blue-600",children:[_.response?.results?.length||0," ",_.response?.results?.length===1?"result":"results"]}),void 0!==_.latency&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"text-gray-400",children:"•"}),(0,t.jsxs)("div",{className:"text-sm font-semibold text-green-600",children:[_.latency,"ms"]})]})]})]})]})}),_.response&&_.response.results&&_.response.results.length>0?(0,t.jsx)("div",{className:"space-y-3",children:_.response.results.map((e,s)=>{let a=u[`0-${s}`]||!1;return(0,t.jsx)("div",{className:"bg-white border border-gray-200 rounded-lg overflow-hidden transition-all duration-200",style:{boxShadow:"0 1px 2px 0 rgba(0, 0, 0, 0.05)"},onMouseEnter:e=>{e.currentTarget.style.boxShadow="0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",e.currentTarget.style.borderColor="#e0e7ff"},onMouseLeave:e=>{e.currentTarget.style.boxShadow="0 1px 2px 0 rgba(0, 0, 0, 0.05)",e.currentTarget.style.borderColor="#e5e7eb"},children:(0,t.jsxs)("div",{className:"p-5",children:[(0,t.jsxs)("div",{className:"flex items-start justify-between gap-3 mb-2",children:[(0,t.jsx)("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"text-lg font-semibold text-blue-600 hover:text-blue-700 flex-1 leading-snug",style:{textDecoration:"none"},onMouseEnter:e=>e.currentTarget.style.textDecoration="underline",onMouseLeave:e=>e.currentTarget.style.textDecoration="none",children:e.title}),(0,t.jsx)(A.Button,{type:"text",size:"small",className:"flex-shrink-0",icon:(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:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})}),onClick:()=>window.open(e.url,"_blank"),style:{color:"#6b7280"}})]}),(0,t.jsx)("div",{className:"text-sm text-green-700 mb-3 truncate font-medium",children:e.url}),(0,t.jsx)("div",{className:"text-sm text-gray-700 leading-relaxed",children:a?e.snippet:`${e.snippet.substring(0,200)}${e.snippet.length>200?"...":""}`}),e.snippet.length>200&&(0,t.jsx)(A.Button,{type:"link",size:"small",className:"mt-3 p-0 h-auto",onClick:()=>{let e;return e=`0-${s}`,void x(t=>({...t,[e]:!t[e]}))},style:{fontSize:"13px",fontWeight:500,color:"#3b82f6"},children:a?"Show less":"Show more"})]})},s)})}):(0,t.jsxs)("div",{className:"text-center py-12 bg-gray-50 border border-gray-200 rounded-lg",children:[(0,t.jsx)("div",{className:"flex items-center justify-center w-16 h-16 rounded-full bg-gray-100 mx-auto mb-4",children:(0,t.jsx)(as.SearchOutlined,{style:{fontSize:"24px",color:"#9ca3af"}})}),(0,t.jsx)(aa,{className:"text-gray-600 font-medium",children:"No results found"}),(0,t.jsx)(aa,{className:"text-sm text-gray-500 mt-1",children:"Try a different search query"})]})]}),c.length>1&&(0,t.jsxs)("div",{className:"mt-8 pt-6 border-t border-gray-200",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,t.jsx)(aa,{className:"text-sm font-semibold text-gray-700",children:"Previous Searches"}),(0,t.jsx)(A.Button,{onClick:()=>{m([]),x({}),eM.default.success("Search history cleared")},size:"small",type:"link",style:{fontSize:"13px",fontWeight:500},children:"Clear All"})]}),(0,t.jsx)("div",{className:"space-y-2",children:c.slice(1,6).map((e,s)=>(0,t.jsxs)("div",{className:"p-3 bg-gray-50 border border-gray-200 rounded-lg cursor-pointer transition-all duration-200 hover:bg-gray-100 hover:border-gray-300",onClick:()=>{n(e.query)},children:[(0,t.jsx)("div",{className:"text-sm font-medium text-gray-800 truncate",children:e.query}),(0,t.jsxs)("div",{className:"text-xs text-gray-500 mt-1.5 flex items-center gap-2",children:[(0,t.jsxs)("span",{className:"font-medium text-blue-600",children:[e.response?.results?.length||0," ",e.response?.results?.length===1?"result":"results"]}),void 0!==e.latency&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{children:"•"}),(0,t.jsxs)("span",{className:"font-medium text-green-600",children:[e.latency,"ms"]})]}),(0,t.jsx)("span",{children:"•"}),(0,t.jsx)("span",{children:f(e.timestamp)})]})]},s+1))})]})]}):(0,t.jsxs)("div",{className:"h-full flex flex-col items-center justify-center p-8",children:[(0,t.jsx)("div",{className:"flex items-center justify-center w-24 h-24 rounded-full bg-gray-100 mb-6",children:(0,t.jsx)(as.SearchOutlined,{style:{fontSize:"48px",color:"#9ca3af"}})}),(0,t.jsx)(aa,{className:"text-lg text-gray-600 font-medium",children:"Test your search tool"}),(0,t.jsx)(aa,{className:"text-sm text-gray-500 mt-2",children:"Enter a query above to see search results"})]})})]})]})},ar=({searchTool:e,onBack:s,isEditing:a,accessToken:l,availableProviders:r})=>{var n;let o,[d,c]=(0,i.useState)({}),u=async(e,t)=>{await (0,tC.copyToClipboard)(e)&&(c(e=>({...e,[t]:!0})),setTimeout(()=>{c(e=>({...e,[t]:!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)(m.Button,{icon:eI.ArrowLeftIcon,variant:"light",className:"mb-4",onClick:s,children:"Back to All Search Tools"}),(0,t.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,t.jsx)(eb.Title,{children:e.search_tool_name}),(0,t.jsx)(A.Button,{type:"text",size:"small",icon:d["search-tool-name"]?(0,t.jsx)(ae.CheckIcon,{size:12}):(0,t.jsx)(at.CopyIcon,{size:12}),onClick:()=>u(e.search_tool_name,"search-tool-name"),className:`left-2 z-10 transition-all duration-200 ${d["search-tool-name"]?"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)(e_.Text,{className:"text-gray-500 font-mono",children:e.search_tool_id}),(0,t.jsx)(A.Button,{type:"text",size:"small",icon:d["search-tool-id"]?(0,t.jsx)(ae.CheckIcon,{size:12}):(0,t.jsx)(at.CopyIcon,{size:12}),onClick:()=>u(e.search_tool_id,"search-tool-id"),className:`left-2 z-10 transition-all duration-200 ${d["search-tool-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100"}`})]})]})}),(0,t.jsxs)(t4.Grid,{numItems:1,numItemsSm:2,numItemsLg:3,className:"gap-6",children:[(0,t.jsxs)(ef.Card,{children:[(0,t.jsx)(e_.Text,{children:"Provider"}),(0,t.jsx)("div",{className:"mt-2",children:(0,t.jsx)(eb.Title,{children:(n=e.litellm_params.search_provider,o=r.find(e=>e.provider_name===n),o?.ui_friendly_name||n)})})]}),(0,t.jsxs)(ef.Card,{children:[(0,t.jsx)(e_.Text,{children:"API Key"}),(0,t.jsx)("div",{className:"mt-2",children:(0,t.jsx)(e_.Text,{children:e.litellm_params.api_key?"****":"Not set"})})]}),(0,t.jsxs)(ef.Card,{children:[(0,t.jsx)(e_.Text,{children:"Created At"}),(0,t.jsx)("div",{className:"mt-2",children:(0,t.jsx)(e_.Text,{children:e.created_at?new Date(e.created_at).toLocaleString():"Unknown"})})]})]}),e.search_tool_info?.description&&(0,t.jsxs)(ef.Card,{className:"mt-6",children:[(0,t.jsx)(e_.Text,{children:"Description"}),(0,t.jsx)("div",{className:"mt-2",children:(0,t.jsx)(e_.Text,{children:e.search_tool_info.description})})]}),(0,t.jsx)("div",{className:"mt-6",children:l&&(0,t.jsx)(al,{searchToolName:e.search_tool_name,accessToken:l})})]})},ai=({accessToken:e,userRole:s,userID:a})=>{let{data:r,isLoading:n,refetch:o}=(0,t1.useQuery)({queryKey:["searchTools"],queryFn:()=>{if(!e)throw Error("Access Token required");return(0,l.fetchSearchTools)(e).then(e=>e.search_tools||[])},enabled:!!e}),{data:d,isLoading:c}=(0,t1.useQuery)({queryKey:["searchProviders"],queryFn:()=>{if(!e)throw Error("Access Token required");return(0,l.fetchAvailableSearchProviders)(e)},enabled:!!e}),x=d?.providers||[],[h,y]=(0,i.useState)(null),[f,_]=(0,i.useState)(!1),[v,N]=(0,i.useState)(!1),[w,k]=(0,i.useState)(null),[C,S]=(0,i.useState)(!1),[T,I]=(0,i.useState)(!1),[F,A]=(0,i.useState)(!1),[P]=p.Form.useForm(),L=i.default.useMemo(()=>{let e,s,a;return e=e=>{k(e),S(!1)},s=e=>{let t=r?.find(t=>t.search_tool_id===e);t&&(P.setFieldsValue({search_tool_name:t.search_tool_name,search_provider:t.litellm_params.search_provider,api_key:t.litellm_params.api_key,api_base:t.litellm_params.api_base,timeout:t.litellm_params.timeout,max_retries:t.litellm_params.max_retries,description:t.search_tool_info?.description}),k(e),A(!0))},a=M,[{title:"Search Tool ID",dataIndex:"search_tool_id",key:"search_tool_id",render:(s,a)=>a.is_from_config?(0,t.jsx)("span",{className:"text-xs",children:"-"}):(0,t.jsx)("button",{onClick:()=>e(a.search_tool_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 cursor-pointer max-w-40",children:(0,t.jsx)("span",{className:"truncate block",children:a.search_tool_id})})},{title:"Name",dataIndex:"search_tool_name",key:"search_tool_name",render:e=>(0,t.jsx)("span",{className:"font-medium",children:e})},{title:"Provider",key:"provider",render:(e,s)=>{let a=s.litellm_params.search_provider,l=x.find(e=>e.provider_name===a),r=l?.ui_friendly_name||a;return(0,t.jsx)("span",{className:"text-sm",children:r})}},{title:"Created At",dataIndex:"created_at",key:"created_at",render:(e,s)=>(0,t.jsx)("span",{className:"text-xs",children:s.created_at?new Date(s.created_at).toLocaleDateString():"-"})},{title:"Updated At",dataIndex:"updated_at",key:"updated_at",render:(e,s)=>(0,t.jsx)("span",{className:"text-xs",children:s.updated_at?new Date(s.updated_at).toLocaleDateString():"-"})},{title:"Source",key:"source",render:(e,s)=>{let a=s.is_from_config??!1;return(0,t.jsx)(b.Tag,{color:a?"default":"blue",children:a?"Config":"DB"})}},{title:"Actions",key:"actions",render:(e,l)=>{let r=l.search_tool_id,i=l.is_from_config??!1;return(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(sK.default,{variant:"Edit",tooltipText:"Edit search tool",disabled:i,disabledTooltipText:"Config search tool cannot be edited on the dashboard. Please edit it from the config file.",onClick:()=>{r&&!i&&s(r)}}),(0,t.jsx)(sK.default,{variant:"Delete",tooltipText:"Delete search tool",disabled:i,disabledTooltipText:"Config search tool cannot be deleted on the dashboard. Please delete it from the config file.",onClick:()=>{r&&!i&&a(r)}})]})}}]},[x,r,P]);function M(e){y(e),_(!0)}let D=async()=>{if(null!=h&&null!=e){N(!0);try{await (0,l.deleteSearchTool)(e,h),eM.default.success("Deleted search tool successfully"),_(!1),y(null),o()}catch(e){console.error("Error deleting the search tool:",e),eM.default.error("Failed to delete search tool")}finally{N(!1)}}},E=r?.find(e=>e.search_tool_id===h),O=E?x.find(e=>e.provider_name===E.litellm_params.search_provider):null,z=async()=>{if(e&&w)try{let t=await P.validateFields(),s={search_tool_name:t.search_tool_name,litellm_params:{search_provider:t.search_provider,api_key:t.api_key,api_base:t.api_base,timeout:t.timeout?parseFloat(t.timeout):void 0,max_retries:t.max_retries?parseInt(t.max_retries):void 0},search_tool_info:t.description?{description:t.description}:void 0};await (0,l.updateSearchTool)(e,w,s),eM.default.success("Search tool updated successfully"),A(!1),P.resetFields(),k(null),o()}catch(e){console.error("Failed to update search tool:",e),eM.default.error("Failed to update search tool")}};return e&&s&&a?(0,t.jsxs)("div",{className:"w-full h-full p-6",children:[(0,t.jsx)(sH.default,{isOpen:f,title:"Delete Search Tool",message:"Are you sure you want to delete this search tool? This action cannot be undone.",resourceInformationTitle:"Search Tool Information",resourceInformation:E?[{label:"Name",value:E.search_tool_name},{label:"ID",value:E.search_tool_id,code:!0},{label:"Provider",value:O?.ui_friendly_name||E.litellm_params.search_provider},{label:"Description",value:E.search_tool_info?.description||"-"}]:[],onCancel:()=>{_(!1),y(null)},onOk:D,confirmLoading:v}),(0,t.jsx)(s9,{userRole:s,accessToken:e,onCreateSuccess:e=>{I(!1),o()},isModalVisible:T,setModalVisible:I}),(0,t.jsx)(u.Modal,{title:"Edit Search Tool",open:F,onOk:z,onCancel:()=>{A(!1),P.resetFields(),k(null)},width:600,children:(0,t.jsxs)(p.Form,{form:P,layout:"vertical",children:[(0,t.jsx)(p.Form.Item,{name:"search_tool_name",label:"Search Tool Name",rules:[{required:!0,message:"Please enter a search tool name"}],children:(0,t.jsx)(j.Input,{placeholder:"e.g., my-perplexity-search"})}),(0,t.jsx)(p.Form.Item,{name:"search_provider",label:"Search Provider",rules:[{required:!0,message:"Please select a search provider"}],children:(0,t.jsx)(g.Select,{placeholder:"Select a search provider",loading:c,children:x.map(e=>(0,t.jsx)(g.Select.Option,{value:e.provider_name,children:e.ui_friendly_name},e.provider_name))})}),(0,t.jsx)(p.Form.Item,{name:"api_key",label:"API Key",extra:"API key for the search provider",children:(0,t.jsx)(j.Input.Password,{placeholder:"Enter API key"})}),(0,t.jsx)(p.Form.Item,{name:"description",label:"Description",children:(0,t.jsx)(j.Input.TextArea,{rows:3,placeholder:"Description of this search tool"})})]})}),(0,t.jsx)(eb.Title,{children:"Search Tools"}),(0,t.jsx)(e_.Text,{className:"text-tremor-content mt-2",children:"Configure and manage your search providers"}),(0,ey.isAdminRole)(s)&&(0,t.jsx)(m.Button,{className:"mt-4 mb-4",onClick:()=>I(!0),children:"+ Add New Search Tool"}),(0,t.jsx)(()=>w?(0,t.jsx)(ar,{searchTool:r?.find(e=>e.search_tool_id===w)||{search_tool_id:"",search_tool_name:"",litellm_params:{search_provider:""}},onBack:()=>{S(!1),k(null),o()},isEditing:C,accessToken:e,availableProviders:x}):(0,t.jsx)("div",{className:"w-full h-full",children:(0,t.jsx)(eS.Spin,{spinning:n,indicator:(0,t.jsx)(tN.LoadingOutlined,{spin:!0}),size:"large",children:(0,t.jsx)(tt.Table,{bordered:!0,dataSource:r||[],columns:L,rowKey:e=>e.search_tool_id||e.search_tool_name,pagination:!1,locale:{emptyText:"No search tools configured"},size:"small"})})}),{})]}):(console.log("Missing required authentication parameters",{accessToken:e,userRole:s,userID:a}),(0,t.jsx)("div",{className:"p-6 text-center text-gray-500",children:"Missing required authentication parameters."}))};var an=e.i(700904),ao=e.i(686311),ad=e.i(37727),ac=e.i(643531),am=e.i(636772),au=e.i(115571);function ax({onOpen:e,onDismiss:s,isVisible:a,title:l,description:r,buttonText:n,icon:o,accentColor:d,buttonStyle:c}){let m=(0,am.useDisableShowPrompts)(),[u,x]=(0,i.useState)(100),[p,h]=(0,i.useState)(!1);return((0,i.useEffect)(()=>{if(!a){x(100),h(!1);return}let e=Date.now(),t=setInterval(()=>{let s=Math.max(0,100-(Date.now()-e)/15e3*100);x(s),s<=0&&clearInterval(t)},50);return()=>clearInterval(t)},[a]),(0,i.useEffect)(()=>{if(p){let e=setTimeout(()=>{h(!1),s()},5e3);return()=>clearTimeout(e)}},[p,s]),p)?(0,t.jsx)("div",{className:`fixed bottom-6 right-6 z-40 w-80 bg-white rounded-lg shadow-xl border border-gray-200 overflow-hidden transform transition-all duration-300 ease-out ${a?"translate-y-0 opacity-100 scale-100":"translate-y-4 opacity-0 scale-95"}`,children:(0,t.jsx)("div",{className:"p-4",children:(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"flex-shrink-0 w-8 h-8 rounded-full bg-green-100 flex items-center justify-center",children:(0,t.jsx)(ac.Check,{className:"h-5 w-5 text-green-600"})}),(0,t.jsx)("div",{className:"flex-1",children:(0,t.jsx)("p",{className:"text-sm text-gray-700 font-medium",children:"Got it, we will not ask again. Reactivate this at any time in the User Menu."})})]})})}):!a||m?null:(0,t.jsxs)("div",{className:`fixed bottom-6 right-6 z-40 w-80 bg-white rounded-lg shadow-xl border border-gray-200 overflow-hidden transform transition-all duration-300 ease-out ${a?"translate-y-0 opacity-100 scale-100":"translate-y-4 opacity-0 scale-95"}`,children:[(0,t.jsx)("div",{className:"h-1 bg-gray-100 w-full",children:(0,t.jsx)("div",{className:"h-full transition-all duration-100 ease-linear",style:{width:`${u}%`,backgroundColor:d}})}),(0,t.jsxs)("div",{className:"p-4",children:[(0,t.jsxs)("div",{className:"flex items-start justify-between mb-2",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",style:{color:d},children:[(0,t.jsx)(o,{className:"h-5 w-5"}),(0,t.jsx)("span",{className:"font-semibold text-sm",children:l})]}),(0,t.jsx)("button",{onClick:s,className:"text-gray-400 hover:text-gray-600 transition-colors p-0.5 rounded hover:bg-gray-100",children:(0,t.jsx)(ad.X,{className:"h-4 w-4"})})]}),(0,t.jsx)("p",{className:"text-sm text-gray-600 mb-3",children:r}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(A.Button,{type:"primary",block:!0,onClick:e,style:c,children:n}),(0,t.jsx)(A.Button,{variant:"outlined",danger:!0,block:!0,onClick:()=>{(0,au.setLocalStorageItem)("disableShowPrompts","true"),(0,au.emitLocalStorageChange)("disableShowPrompts"),h(!0)},className:"text-xs",children:"Don't ask me again"})]})]})]})}function ap({onOpen:e,onDismiss:s,isVisible:a}){return(0,t.jsx)(ax,{onOpen:e,onDismiss:s,isVisible:a,title:"Quick feedback",description:"Help us improve LiteLLM! Share your experience in 5 quick questions.",buttonText:"Share feedback",icon:ao.MessageSquare,accentColor:"#3b82f6"})}var ah=e.i(972520),ag=e.i(180127),ag=ag,aj=e.i(770914),ay=e.i(497650),af=e.i(536916);let ab=[{id:"oss_adoption",label:"OSS Adoption",description:"Stars, contributors, forks, community support"},{id:"ai_integration",label:"AI Integration",description:"LiteLLM had the logging/guardrail integration we needed - Langfuse, OTEL, S3 logging, Azure Content Safety guardrails"},{id:"unified_api",label:"Unified API",description:"LiteLLM had the best OpenAI-compatible API across providers - OpenAI, Anthropic, Gemini, etc."},{id:"breadth_of_models",label:"Breadth of Models/Providers",description:"LiteLLM had the provider + endpoint combinations we needed - /ocr endpoint with Mistral OCR, /batches endppint with Bedrock API, etc."},{id:"other",label:"Other",description:"Something else not listed above"}];function a_({isOpen:e,onClose:s,onComplete:a}){let[l,r]=(0,i.useState)(1),[n,o]=(0,i.useState)({usingAtCompany:null,companyName:"",startDate:"",reasons:[],otherReason:"",email:""}),[d,c]=(0,i.useState)(!1),m=!0===n.usingAtCompany?5:4;if(!e)return null;let u=async()=>{c(!0);try{let e={oss_adoption:"OSS Adoption (stars, contributors, forks)",ai_integration:"AI Integration (Langfuse, OTEL, S3, Azure Content Safety)",unified_api:"Unified API (OpenAI-compatible)",breadth_of_models:"Breadth of Models/Providers (/ocr, /batches, Bedrock, Azure OCR)"},t=n.reasons.map(t=>"other"===t&&n.otherReason?`Other: ${n.otherReason}`:e[t]||t),s=new URLSearchParams({"entry.2015264290":n.usingAtCompany?"Yes":"No","entry.1876243786":n.companyName||"","entry.1282591459":n.startDate,"entry.393456108":t.join(", "),"entry.928142208":n.email||""});await fetch("https://feedback.litellm.ai/survey",{method:"POST",mode:"no-cors",body:s})}catch(e){console.error("Failed to submit survey:",e)}c(!1),a()},x=(e,t)=>{o(s=>({...s,[e]:t}))},p=e=>{o(t=>({...t,reasons:t.reasons.includes(e)?t.reasons.filter(t=>t!==e):[...t.reasons,e]}))},h=()=>{if(!1===n.usingAtCompany){if(1===l)return 1;if(3===l)return 2;if(4===l)return 3;if(5===l)return 4}return l},g=5===l;return(0,t.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 sm:p-6",children:[(0,t.jsx)("div",{className:"fixed inset-0 bg-black/40 backdrop-blur-sm",onClick:s}),(0,t.jsxs)("div",{className:"relative w-full max-w-lg bg-white rounded-xl shadow-2xl overflow-hidden flex flex-col max-h-[90vh] transform transition-all duration-300 ease-out",children:[(0,t.jsxs)("div",{className:"px-6 py-4 border-b border-gray-100 flex items-center justify-between bg-gray-50/50",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 text-blue-600",children:[(0,t.jsx)(ao.MessageSquare,{className:"h-5 w-5"}),(0,t.jsx)("span",{className:"font-semibold text-sm tracking-wide uppercase",children:"Quick Feedback"})]}),(0,t.jsx)("button",{onClick:s,className:"text-gray-400 hover:text-gray-600 transition-colors p-1 rounded-full hover:bg-gray-100",children:(0,t.jsx)(ad.X,{className:"h-5 w-5"})})]}),(0,t.jsx)(ay.Progress,{percent:h()/m*100,showInfo:!1,strokeColor:"#2563eb",className:"m-0"}),(0,t.jsx)("div",{className:"p-8 flex-1 overflow-y-auto",children:1===l?(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsx)("h2",{className:"text-2xl font-bold text-gray-900",children:"Are you using LiteLLM at your company?"}),(0,t.jsx)("p",{className:"text-gray-500",children:"Help us understand how our product is being used in professional environments."}),(0,t.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 pt-4",children:[(0,t.jsxs)("button",{onClick:()=>x("usingAtCompany",!0),className:`p-6 rounded-lg border-2 text-left transition-all ${!0===n.usingAtCompany?"border-blue-600 bg-blue-50 ring-1 ring-blue-600":"border-gray-200 hover:border-blue-300 hover:bg-gray-50"}`,children:[(0,t.jsx)("span",{className:"block text-lg font-semibold text-gray-900 mb-1",children:"Yes"}),(0,t.jsx)("span",{className:"text-sm text-gray-500",children:"We use it for work"})]}),(0,t.jsxs)("button",{onClick:()=>x("usingAtCompany",!1),className:`p-6 rounded-lg border-2 text-left transition-all ${!1===n.usingAtCompany?"border-blue-600 bg-blue-50 ring-1 ring-blue-600":"border-gray-200 hover:border-blue-300 hover:bg-gray-50"}`,children:[(0,t.jsx)("span",{className:"block text-lg font-semibold text-gray-900 mb-1",children:"No"}),(0,t.jsx)("span",{className:"text-sm text-gray-500",children:"Personal project / Hobby"})]})]})]}):2===l&&!0===n.usingAtCompany?(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsx)("h2",{className:"text-2xl font-bold text-gray-900",children:"What company are you using LiteLLM at?"}),(0,t.jsx)("p",{className:"text-gray-500",children:"This helps us understand our user base better."}),(0,t.jsx)(j.Input,{size:"large",placeholder:"Enter your company name",value:n.companyName,onChange:e=>x("companyName",e.target.value),autoFocus:!0})]}):3===l?(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsx)("h2",{className:"text-2xl font-bold text-gray-900",children:"When did you start using LiteLLM?"}),(0,t.jsx)(f.Radio.Group,{value:n.startDate,onChange:e=>x("startDate",e.target.value),className:"w-full",children:(0,t.jsx)(aj.Space,{direction:"vertical",className:"w-full",children:["Less than a month ago","1-3 months ago","3-6 months ago","More than 6 months ago"].map(e=>(0,t.jsx)("label",{className:`flex items-center p-4 rounded-lg border cursor-pointer transition-all w-full ${n.startDate===e?"border-blue-600 bg-blue-50 ring-1 ring-blue-600":"border-gray-200 hover:bg-gray-50"}`,children:(0,t.jsx)(f.Radio,{value:e,children:e})},e))})})]}):4===l?(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsx)("h2",{className:"text-2xl font-bold text-gray-900",children:"Why did you pick LiteLLM over other AI Gateways?"}),(0,t.jsx)("p",{className:"text-gray-500",children:"Select all that apply."}),(0,t.jsx)("div",{className:"space-y-3",children:ab.map(e=>{let s=n.reasons.includes(e.id);return(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{role:"button",tabIndex:0,onClick:()=>p(e.id),onKeyDown:t=>{("Enter"===t.key||" "===t.key)&&(t.preventDefault(),p(e.id))},className:`flex items-start p-4 rounded-lg border cursor-pointer transition-all ${s?"border-blue-600 bg-blue-50 ring-1 ring-blue-600":"border-gray-200 hover:bg-gray-50"}`,children:[(0,t.jsx)(af.Checkbox,{checked:s,className:"mt-0.5 pointer-events-none"}),(0,t.jsxs)("div",{className:"ml-3",children:[(0,t.jsx)("span",{className:"block font-medium text-gray-900",children:e.label}),(0,t.jsx)("span",{className:"text-sm text-gray-500",children:e.description})]})]}),"other"===e.id&&s&&(0,t.jsx)(j.Input,{className:"mt-2 ml-7",placeholder:"Please specify...",value:n.otherReason,onChange:e=>x("otherReason",e.target.value),onClick:e=>e.stopPropagation(),autoFocus:!0})]},e.id)})})]}):5===l?(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsx)("h2",{className:"text-2xl font-bold text-gray-900",children:"Want to share more?"}),(0,t.jsx)("p",{className:"text-gray-500",children:"Leave your email and we may reach out to learn more about your experience. This is completely optional."}),(0,t.jsx)(j.Input,{size:"large",type:"email",placeholder:"your@email.com (optional)",value:n.email,onChange:e=>x("email",e.target.value),autoFocus:!0}),(0,t.jsx)("p",{className:"text-xs text-gray-400",children:"We will only use this to follow up on your feedback. No spam, ever."})]}):null}),(0,t.jsxs)("div",{className:"px-6 py-4 bg-gray-50 border-t border-gray-200 flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"text-sm text-gray-500 font-medium",children:["Step ",h()," of ",m]}),(0,t.jsxs)("div",{className:"flex gap-3",children:[l>1&&(0,t.jsx)(A.Button,{onClick:()=>{3===l&&!1===n.usingAtCompany?r(1):r(l-1)},disabled:d,icon:(0,t.jsx)(ag.default,{className:"h-4 w-4"}),children:"Back"}),(0,t.jsxs)(A.Button,{type:"primary",onClick:()=>{1===l&&!1===n.usingAtCompany?r(3):l<5?r(l+1):u()},disabled:!(1===l?null!==n.usingAtCompany:2===l?n.companyName.trim().length>0:3===l?""!==n.startDate:4===l?n.reasons.includes("other")?n.reasons.length>0&&n.otherReason.trim().length>0:n.reasons.length>0:5===l)||d,loading:d,className:"min-w-[100px]",children:[g?"Submit":"Next",!g&&(0,t.jsx)(ah.ArrowRight,{className:"ml-2 h-4 w-4"})]})]})]})]})]})}var av=e.i(758472);function aN({onOpen:e,onDismiss:s,isVisible:a}){return(0,t.jsx)(ax,{onOpen:e,onDismiss:s,isVisible:a,title:"Claude Code Feedback",description:"Help us improve your Claude Code experience with LiteLLM! Share your feedback in 4 quick questions.",buttonText:"Share feedback",icon:av.Code,accentColor:"#7c3aed",buttonStyle:{backgroundColor:"#7c3aed",borderColor:"#7c3aed"}})}function aw({isOpen:e,onClose:s,onComplete:a}){return e?(0,t.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 sm:p-6",children:[(0,t.jsx)("div",{className:"fixed inset-0 bg-black/40 backdrop-blur-sm",onClick:s}),(0,t.jsxs)("div",{className:"relative w-full max-w-md bg-white rounded-xl shadow-2xl overflow-hidden transform transition-all duration-300 ease-out",children:[(0,t.jsxs)("div",{className:"px-6 py-4 border-b border-gray-100 flex items-center justify-between bg-gray-50/50",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 text-purple-600",children:[(0,t.jsx)(av.Code,{className:"h-5 w-5"}),(0,t.jsx)("span",{className:"font-semibold text-sm tracking-wide uppercase",children:"Claude Code Feedback"})]}),(0,t.jsx)("button",{onClick:s,className:"text-gray-400 hover:text-gray-600 transition-colors p-1 rounded-full hover:bg-gray-100",children:(0,t.jsx)(ad.X,{className:"h-5 w-5"})})]}),(0,t.jsxs)("div",{className:"p-8",children:[(0,t.jsx)("h2",{className:"text-2xl font-bold text-gray-900 mb-4",children:"Help us improve your experience"}),(0,t.jsx)("p",{className:"text-gray-600 mb-6",children:"We'd love to hear about your experience using LiteLLM with Claude Code. Your feedback helps us improve the product for everyone."}),(0,t.jsx)("p",{className:"text-sm text-gray-500 mb-6",children:"This brief survey takes about 2-3 minutes to complete."}),(0,t.jsx)(A.Button,{type:"primary",size:"large",block:!0,onClick:()=>{window.open("https://forms.gle/LZeJQ3XytBakckYa9","_blank","noopener,noreferrer"),a()},icon:(0,t.jsx)(t$.ExternalLink,{className:"h-4 w-4"}),style:{backgroundColor:"#7c3aed",borderColor:"#7c3aed"},children:"Open Feedback Form"})]})]})]}):null}var ak=e.i(345244),aC=e.i(662316),aS=e.i(208075),aT=e.i(735042),aI=e.i(693569),aF=e.i(263147),aA=e.i(954616),aP=e.i(912598);let aL=async(e,t)=>{let s=(0,l.getProxyBaseUrl)(),a=`${s}/v1/access_group/${encodeURIComponent(t)}`,r=await fetch(a,{method:"DELETE",headers:{[(0,l.getGlobalLitellmHeaderName)()]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=(0,l.deriveErrorMessage)(e);throw(0,l.handleError)(t),Error(t)}};var aM=e.i(152990),aD=e.i(682830),aE=e.i(525720),aO=e.i(372943),az=e.i(165370),az=az,aR=e.i(368869),aB=e.i(657150),aB=aB,aq=e.i(475254);let a$=(0,aq.default)("layers",[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]]);var aU=e.i(54943),aU=aU,aV=e.i(302202),aG=e.i(446891);let aH=async(e,t)=>{let s=(0,l.getProxyBaseUrl)(),a=`${s}/v1/access_group/${encodeURIComponent(t)}`,r=await fetch(a,{method:"GET",headers:{[(0,l.getGlobalLitellmHeaderName)()]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=(0,l.deriveErrorMessage)(e);throw(0,l.handleError)(t),Error(t)}return r.json()};var aK=e.i(21548),aW=e.i(573421),aQ=e.i(516430),aB=aB,aY=e.i(823429),aY=aY,aJ=e.i(438100),aX=e.i(98740),aX=aX,aZ=e.i(304911),a0=e.i(289793),a1=e.i(500727),aB=aB,a2=e.i(879664),a2=a2;let{TextArea:a4}=j.Input;function a5({form:e,isNameDisabled:s=!1}){let{data:a}=(0,a0.useAgents)(),{data:l}=(0,a1.useMCPServers)(),r=a?.agents??[],i=[{key:"1",label:(0,t.jsxs)(aj.Space,{align:"center",size:4,children:[(0,t.jsx)(a2.default,{size:16}),"General Info"]}),children:(0,t.jsxs)("div",{style:{paddingTop:16},children:[(0,t.jsx)(p.Form.Item,{name:"name",label:"Group Name",rules:[{required:!0,message:"Please enter the access group name"}],children:(0,t.jsx)(j.Input,{placeholder:"e.g. Engineering Team",disabled:s})}),(0,t.jsx)(p.Form.Item,{name:"description",label:"Description",children:(0,t.jsx)(a4,{rows:4,placeholder:"Describe the purpose of this access group..."})})]})},{key:"2",label:(0,t.jsxs)(aj.Space,{align:"center",size:4,children:[(0,t.jsx)(a$,{size:16}),"Models"]}),children:(0,t.jsx)("div",{style:{paddingTop:16},children:(0,t.jsx)(p.Form.Item,{name:"modelIds",label:"Allowed Models",children:(0,t.jsx)(sW.ModelSelect,{context:"global",value:e.getFieldValue("modelIds")??[],onChange:t=>e.setFieldsValue({modelIds:t}),style:{width:"100%"}})})})},{key:"3",label:(0,t.jsxs)(aj.Space,{align:"center",size:4,children:[(0,t.jsx)(aV.ServerIcon,{size:16}),"MCP Servers"]}),children:(0,t.jsx)("div",{style:{paddingTop:16},children:(0,t.jsx)(p.Form.Item,{name:"mcpServerIds",label:"Allowed MCP Servers",children:(0,t.jsx)(g.Select,{mode:"multiple",placeholder:"Select MCP servers",style:{width:"100%"},optionFilterProp:"label",allowClear:!0,options:(l??[]).map(e=>({label:e.server_name??e.server_id,value:e.server_id}))})})})},{key:"4",label:(0,t.jsxs)(aj.Space,{align:"center",size:4,children:[(0,t.jsx)(aB.default,{size:16}),"Agents"]}),children:(0,t.jsx)("div",{style:{paddingTop:16},children:(0,t.jsx)(p.Form.Item,{name:"agentIds",label:"Allowed Agents",children:(0,t.jsx)(g.Select,{mode:"multiple",placeholder:"Select agents",style:{width:"100%"},optionFilterProp:"label",allowClear:!0,options:r.map(e=>({label:e.agent_name,value:e.agent_id}))})})})}];return(0,t.jsx)(p.Form,{form:e,layout:"vertical",name:"access_group_form",initialValues:{modelIds:[],mcpServerIds:[],agentIds:[]},children:(0,t.jsx)(t5.Tabs,{defaultActiveKey:"1",items:i})})}let a6=async(e,t,s)=>{let a=(0,l.getProxyBaseUrl)(),r=`${a}/v1/access_group/${encodeURIComponent(t)}`,i=await fetch(r,{method:"PUT",headers:{[(0,l.getGlobalLitellmHeaderName)()]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(s)});if(!i.ok){let e=await i.json(),t=(0,l.deriveErrorMessage)(e);throw(0,l.handleError)(t),Error(t)}return i.json()};function a3({visible:e,accessGroup:s,onCancel:a,onSuccess:l}){let[n]=p.Form.useForm(),o=(()=>{let{accessToken:e}=(0,r.default)(),t=(0,aP.useQueryClient)();return(0,aA.useMutation)({mutationFn:async({accessGroupId:t,params:s})=>{if(!e)throw Error("Access token is required");return a6(e,t,s)},onSuccess:(e,{accessGroupId:s})=>{t.invalidateQueries({queryKey:aF.accessGroupKeys.all}),t.invalidateQueries({queryKey:aF.accessGroupKeys.detail(s)})}})})();return(0,i.useEffect)(()=>{e&&s&&n.setFieldsValue({name:s.access_group_name,description:s.description??"",modelIds:s.access_model_names??[],mcpServerIds:s.access_mcp_server_ids??[],agentIds:s.access_agent_ids??[]})},[e,s,n]),(0,t.jsx)(u.Modal,{title:"Edit Access Group",open:e,onOk:()=>{n.validateFields().then(e=>{let t={access_group_name:e.name,description:e.description,access_model_names:e.modelIds,access_mcp_server_ids:e.mcpServerIds,access_agent_ids:e.agentIds};o.mutate({accessGroupId:s.access_group_id,params:t},{onSuccess:()=>{h.message.success("Access group updated successfully"),l?.(),a()}})}).catch(e=>{console.log("Validate Failed:",e)})},onCancel:a,width:700,okText:"Save Changes",cancelText:"Cancel",confirmLoading:o.isPending,destroyOnHidden:!0,children:(0,t.jsx)(a5,{form:n})})}let{Title:a8,Text:a7}=sz.Typography,{Content:a9}=aO.Layout;function le({accessGroupId:e,onBack:s}){let{data:a,isLoading:l}=(e=>{let{accessToken:t,userRole:s}=(0,r.default)(),a=(0,aP.useQueryClient)();return(0,t1.useQuery)({queryKey:aF.accessGroupKeys.detail(e),queryFn:async()=>aH(t,e),enabled:!!(t&&e)&&ey.all_admin_roles.includes(s||""),initialData:()=>{if(!e)return;let t=a.getQueryData(aF.accessGroupKeys.list({}));return t?.find(t=>t.access_group_id===e)}})})(e),{token:n}=aR.theme.useToken(),[o,d]=(0,i.useState)(!1),[c,m]=(0,i.useState)(!1),[u,x]=(0,i.useState)(!1);if(l)return(0,t.jsx)(a9,{style:{padding:n.paddingLG,paddingInline:2*n.paddingLG},children:(0,t.jsx)(aE.Flex,{justify:"center",align:"center",style:{minHeight:300},children:(0,t.jsx)(eS.Spin,{size:"large"})})});if(!a)return(0,t.jsxs)(a9,{style:{padding:n.paddingLG,paddingInline:2*n.paddingLG},children:[(0,t.jsx)(A.Button,{icon:(0,t.jsx)(aQ.ArrowLeftIcon,{size:16}),onClick:s,type:"text",style:{marginBottom:16}}),(0,t.jsx)(aK.Empty,{description:"Access group not found"})]});let p=a.access_model_names??[],h=a.access_mcp_server_ids??[],g=a.access_agent_ids??[],j=a.assigned_key_ids??[],y=a.assigned_team_ids??[],f=c?j:j.slice(0,5),_=u?y:y.slice(0,5),v=[{key:"models",label:(0,t.jsxs)(aE.Flex,{align:"center",gap:8,children:[(0,t.jsx)(a$,{size:16}),"Models",(0,t.jsx)(b.Tag,{style:{marginInlineEnd:0},children:p?.length})]}),children:p?.length>0?(0,t.jsx)(aW.List,{grid:{gutter:16,xs:1,sm:2,md:3,lg:4},dataSource:p,renderItem:e=>(0,t.jsx)(aW.List.Item,{children:(0,t.jsx)(ec.Card,{size:"small",children:(0,t.jsx)(a7,{code:!0,children:e})})})}):(0,t.jsx)(aK.Empty,{description:"No models assigned to this group"})},{key:"mcp",label:(0,t.jsxs)(aE.Flex,{align:"center",gap:8,children:[(0,t.jsx)(aV.ServerIcon,{size:16}),"MCP Servers",(0,t.jsx)(b.Tag,{children:h?.length})]}),children:h?.length>0?(0,t.jsx)(aW.List,{grid:{gutter:16,xs:1,sm:2,md:3,lg:4},dataSource:h,renderItem:e=>(0,t.jsx)(aW.List.Item,{children:(0,t.jsx)(ec.Card,{size:"small",children:(0,t.jsx)(a7,{code:!0,children:e})})})}):(0,t.jsx)(aK.Empty,{description:"No MCP servers assigned to this group"})},{key:"agents",label:(0,t.jsxs)(aE.Flex,{align:"center",gap:8,children:[(0,t.jsx)(aB.default,{size:16}),"Agents",(0,t.jsx)(b.Tag,{children:g?.length})]}),children:g?.length>0?(0,t.jsx)(aW.List,{grid:{gutter:16,xs:1,sm:2,md:3,lg:4},dataSource:g,renderItem:e=>(0,t.jsx)(aW.List.Item,{children:(0,t.jsx)(ec.Card,{size:"small",children:(0,t.jsx)(a7,{code:!0,children:e})})})}):(0,t.jsx)(aK.Empty,{description:"No agents assigned to this group"})}];return(0,t.jsxs)(a9,{style:{padding:n.paddingLG,paddingInline:2*n.paddingLG},children:[(0,t.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:24},children:[(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:16},children:[(0,t.jsx)(A.Button,{icon:(0,t.jsx)(aQ.ArrowLeftIcon,{size:16}),onClick:s,type:"text"}),(0,t.jsxs)("div",{children:[(0,t.jsx)(a8,{level:2,style:{margin:0},children:a.access_group_name}),(0,t.jsxs)(a7,{type:"secondary",children:["ID: ",(0,t.jsx)(a7,{copyable:!0,children:a.access_group_id})]})]})]}),(0,t.jsx)(A.Button,{type:"primary",icon:(0,t.jsx)(aY.default,{size:16}),onClick:()=>{d(!0)},children:"Edit Access Group"})]}),(0,t.jsx)(t_.Row,{style:{marginBottom:24},children:(0,t.jsx)(ec.Card,{children:(0,t.jsxs)(eT.Descriptions,{title:"Group Details",column:1,children:[(0,t.jsx)(eT.Descriptions.Item,{label:"Description",children:a.description||"—"}),(0,t.jsxs)(eT.Descriptions.Item,{label:"Created",children:[new Date(a.created_at).toLocaleString(),a.created_by&&(0,t.jsxs)(a7,{children:[" ","by"," ",(0,t.jsx)(aZ.default,{userId:a.created_by})]})]}),(0,t.jsxs)(eT.Descriptions.Item,{label:"Last Updated",children:[new Date(a.updated_at).toLocaleString(),a.updated_by&&(0,t.jsxs)(a7,{children:[" ","by"," ",(0,t.jsx)(aZ.default,{userId:a.updated_by})]})]})]})})}),(0,t.jsxs)(t_.Row,{gutter:[16,16],style:{marginBottom:24},children:[(0,t.jsx)(tv.Col,{xs:24,lg:12,children:(0,t.jsx)(ec.Card,{title:(0,t.jsxs)(aE.Flex,{align:"center",gap:8,children:[(0,t.jsx)(aJ.KeyIcon,{size:16}),"Attached Keys",(0,t.jsx)(b.Tag,{children:j?.length})]}),extra:j?.length>5?(0,t.jsx)(A.Button,{type:"link",onClick:()=>m(!c),children:c?"Show Less":`View All (${j?.length})`}):null,children:j?.length>0?(0,t.jsx)(aE.Flex,{wrap:"wrap",gap:8,children:f.map(e=>(0,t.jsx)(b.Tag,{children:(0,t.jsx)(a7,{code:!0,style:{fontSize:12},children:e.length>20?`${e.slice(0,10)}...${e.slice(-6)}`:e})},e))}):(0,t.jsx)(aK.Empty,{description:"No keys attached",image:aK.Empty.PRESENTED_IMAGE_SIMPLE})})}),(0,t.jsx)(tv.Col,{xs:24,lg:12,children:(0,t.jsx)(ec.Card,{title:(0,t.jsxs)(aE.Flex,{align:"center",gap:8,children:[(0,t.jsx)(aX.default,{size:16}),"Attached Teams",(0,t.jsx)(b.Tag,{children:y?.length})]}),extra:y?.length>5?(0,t.jsx)(A.Button,{type:"link",onClick:()=>x(!u),children:u?"Show Less":`View All (${y?.length})`}):null,children:y?.length>0?(0,t.jsx)(aE.Flex,{wrap:"wrap",gap:8,children:_.map(e=>(0,t.jsx)(b.Tag,{children:(0,t.jsx)(a7,{code:!0,style:{fontSize:12},children:e})},e))}):(0,t.jsx)(aK.Empty,{description:"No teams attached",image:aK.Empty.PRESENTED_IMAGE_SIMPLE})})})]}),(0,t.jsx)(ec.Card,{children:(0,t.jsx)(t5.Tabs,{defaultActiveKey:"models",items:v})}),(0,t.jsx)(a3,{visible:o,accessGroup:a,onCancel:()=>d(!1)})]})}let lt=async(e,t)=>{let s=(0,l.getProxyBaseUrl)(),a=`${s}/v1/access_group`,r=await fetch(a,{method:"POST",headers:{[(0,l.getGlobalLitellmHeaderName)()]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!r.ok){let e=await r.json(),t=(0,l.deriveErrorMessage)(e);throw(0,l.handleError)(t),Error(t)}return r.json()};function ls({visible:e,onCancel:s,onSuccess:a}){let[l]=p.Form.useForm(),i=(()=>{let{accessToken:e}=(0,r.default)(),t=(0,aP.useQueryClient)();return(0,aA.useMutation)({mutationFn:async t=>{if(!e)throw Error("Access token is required");return lt(e,t)},onSuccess:()=>{t.invalidateQueries({queryKey:aF.accessGroupKeys.all})}})})();return(0,t.jsx)(u.Modal,{title:"Create Access Group",open:e,onOk:()=>{l.validateFields().then(e=>{let t={access_group_name:e.name,description:e.description,access_model_names:e.modelIds,access_mcp_server_ids:e.mcpServerIds,access_agent_ids:e.agentIds};i.mutate(t,{onSuccess:()=>{h.message.success("Access group created successfully"),l.resetFields(),a?.(),s()}})}).catch(e=>{console.log("Validate Failed:",e)})},onCancel:s,width:700,okText:"Create Group",cancelText:"Cancel",confirmLoading:i.isPending,destroyOnClose:!0,children:(0,t.jsx)(a5,{form:l})})}let{Title:la,Text:ll}=sz.Typography,{Content:lr}=aO.Layout;function li(e){return{id:e.access_group_id,name:e.access_group_name,description:e.description??"",modelIds:e.access_model_names,mcpServerIds:e.access_mcp_server_ids,agentIds:e.access_agent_ids,keyIds:e.assigned_key_ids,teamIds:e.assigned_team_ids,createdAt:e.created_at,createdBy:e.created_by??"",updatedAt:e.updated_at,updatedBy:e.updated_by??""}}function ln(){let{token:e}=aR.theme.useToken(),{data:s,isLoading:a}=(0,aF.useAccessGroups)(),l=(0,i.useMemo)(()=>(s??[]).map(li),[s]),[n,o]=(0,i.useState)(null),[d,c]=(0,i.useState)(!1),[m,u]=(0,i.useState)(""),[x,p]=(0,i.useState)(1),[h,g]=(0,i.useState)([]),[y,f]=(0,i.useState)(null),_=(()=>{let{accessToken:e}=(0,r.default)(),t=(0,aP.useQueryClient)();return(0,aA.useMutation)({mutationFn:async t=>{if(!e)throw Error("Access token is required");return aL(e,t)},onSuccess:()=>{t.invalidateQueries({queryKey:aF.accessGroupKeys.all})}})})();(0,i.useEffect)(()=>{p(1)},[m]);let v=(0,i.useMemo)(()=>l.filter(e=>e.name.toLowerCase().includes(m.toLowerCase())||e.id.toLowerCase().includes(m.toLowerCase())||e.description.toLowerCase().includes(m.toLowerCase())),[l,m]),N=(0,i.useMemo)(()=>[{id:"id",accessorKey:"id",header:()=>(0,t.jsx)("span",{children:"ID"}),enableSorting:!1,size:170,cell:({row:e})=>{let s=e.original;return(0,t.jsx)(eu.Tooltip,{title:s.id,children:(0,t.jsx)(ll,{ellipsis:!0,className:"text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs cursor-pointer",style:{fontSize:14,padding:"1px 8px"},onClick:()=>o(s.id),children:s.id})})}},{id:"name",accessorKey:"name",header:()=>(0,t.jsx)("span",{children:"Name"}),enableSorting:!0,cell:({getValue:e})=>e()},{id:"resources",header:()=>(0,t.jsx)("span",{children:"Resources"}),enableSorting:!1,cell:({row:e})=>{let s=e.original,a=s.modelIds??[],l=s.mcpServerIds??[],r=s.agentIds??[];return(0,t.jsxs)(aE.Flex,{gap:12,align:"center",children:[(0,t.jsx)(eu.Tooltip,{title:`${a?.length} Models`,children:(0,t.jsx)(b.Tag,{color:"blue",style:{fontSize:14,padding:"2px 8px",margin:0},children:(0,t.jsxs)(aE.Flex,{align:"center",gap:6,children:[(0,t.jsx)(a$,{size:14}),a?.length]})})}),(0,t.jsx)(eu.Tooltip,{title:`${l?.length} MCP Servers`,children:(0,t.jsx)(b.Tag,{color:"cyan",style:{fontSize:14,padding:"2px 8px",margin:0},children:(0,t.jsxs)(aE.Flex,{align:"center",gap:6,children:[(0,t.jsx)(aV.ServerIcon,{size:14}),l?.length]})})}),(0,t.jsx)(eu.Tooltip,{title:`${r?.length} Agents`,children:(0,t.jsx)(b.Tag,{color:"purple",style:{fontSize:14,padding:"2px 8px",margin:0},children:(0,t.jsxs)(aE.Flex,{align:"center",gap:6,children:[(0,t.jsx)(aB.default,{size:14}),r?.length]})})})]})}},{id:"createdAt",accessorKey:"createdAt",header:()=>(0,t.jsx)("span",{children:"Created"}),enableSorting:!0,sortingFn:"datetime",cell:({getValue:e})=>new Date(e()).toLocaleDateString(),meta:{responsive:["lg"]}},{id:"updatedAt",accessorKey:"updatedAt",header:()=>(0,t.jsx)("span",{children:"Updated"}),enableSorting:!1,cell:({getValue:e})=>new Date(e()).toLocaleDateString(),meta:{responsive:["xl"]}},{id:"actions",header:()=>(0,t.jsx)("span",{children:"Actions"}),enableSorting:!1,cell:({row:e})=>(0,t.jsx)(aj.Space,{children:(0,t.jsx)(sK.default,{variant:"Delete",tooltipText:"Delete access group",onClick:()=>f(e.original)})})}],[]),w=(0,aM.useReactTable)({data:v,columns:N,state:{sorting:h},onSortingChange:g,getCoreRowModel:(0,aD.getCoreRowModel)(),getSortedRowModel:(0,aD.getSortedRowModel)(),getRowId:e=>e.id}),k=w.getRowModel().rows,C=k.slice((x-1)*10,10*x),S=(0,i.useMemo)(()=>new Map(C.map(e=>[e.original.id,e])),[C]),T=(w.getHeaderGroups()[0]?.headers??[]).map(e=>{let s=e.column.getCanSort(),a=e.column.getIsSorted(),l=e.column.columnDef.meta,r={title:(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:4},children:[e.isPlaceholder?null:(0,aM.flexRender)(e.column.columnDef.header,e.getContext()),s&&(0,t.jsx)(aG.TableHeaderSortDropdown,{sortState:!1!==a&&a,onSortChange:t=>{g(!1===t?[]:[{id:e.column.id,desc:"desc"===t}])},columnId:e.column.id})]}),key:e.id,width:e.column.columnDef.size,render:(t,s)=>{let a=S.get(s.id);if(!a)return null;let l=a.getVisibleCells().find(t=>t.column.id===e.id);return l?(0,aM.flexRender)(l.column.columnDef.cell,l.getContext()):null}};return l?.responsive&&(r.responsive=l.responsive),r}),I=C.map(e=>e.original);return n?(0,t.jsx)(le,{accessGroupId:n,onBack:()=>o(null)}):(0,t.jsxs)(lr,{style:{padding:e.paddingLG,paddingInline:2*e.paddingLG},children:[(0,t.jsxs)(aE.Flex,{justify:"space-between",align:"center",style:{marginBottom:16},children:[(0,t.jsxs)(aj.Space,{direction:"vertical",size:0,children:[(0,t.jsx)(la,{level:2,style:{margin:0},children:"Access Groups"}),(0,t.jsx)(ll,{type:"secondary",children:"Manage resource permissions for your organization"})]}),(0,t.jsx)(A.Button,{type:"primary",icon:(0,t.jsx)(P.PlusOutlined,{}),onClick:()=>c(!0),children:"Create Access Group"})]}),(0,t.jsxs)(ec.Card,{styles:{body:{padding:0}},children:[(0,t.jsxs)(aE.Flex,{justify:"space-between",align:"center",style:{padding:"12px 16px"},children:[(0,t.jsx)(j.Input,{prefix:(0,t.jsx)(aU.default,{size:16}),placeholder:"Search groups by name, ID, or description...",style:{maxWidth:400},value:m,onChange:e=>u(e.target.value),allowClear:!0}),(0,t.jsx)(az.default,{current:x,total:k?.length,pageSize:10,onChange:e=>p(e),size:"small",showTotal:e=>`${e} groups`,showSizeChanger:!1})]}),(0,t.jsx)(tt.Table,{columns:T,dataSource:I,rowKey:"id",loading:a,pagination:!1})]}),(0,t.jsx)(ls,{visible:d,onCancel:()=>c(!1)}),(0,t.jsx)(sH.default,{isOpen:!!y,title:"Delete Access Group",message:"Are you sure you want to delete this access group? This action cannot be undone.",resourceInformationTitle:"Access Group Information",resourceInformation:[{label:"ID",value:y?.id,code:!0},{label:"Name",value:y?.name},{label:"Description",value:y?.description||"—"}],onCancel:()=>f(null),onOk:()=>{y&&_.mutate(y.id,{onSuccess:()=>{f(null)}})},confirmLoading:_.isPending})]})}var lo=e.i(510674);let ld=async(e,t)=>{let s=(0,l.getProxyBaseUrl)(),a=`${s}/project/delete`,r=await fetch(a,{method:"DELETE",headers:{[(0,l.getGlobalLitellmHeaderName)()]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({project_ids:t})});if(!r.ok){let e=await r.json(),t=(0,l.deriveErrorMessage)(e);throw(0,l.handleError)(t),Error(t)}};var lc=e.i(785242),az=az,aU=aU;let lm={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M484 443.1V528h-84.5c-4.1 0-7.5 3.1-7.5 7v42c0 3.8 3.4 7 7.5 7H484v84.9c0 3.9 3.2 7.1 7 7.1h42c3.9 0 7-3.2 7-7.1V584h84.5c4.1 0 7.5-3.2 7.5-7v-42c0-3.9-3.4-7-7.5-7H540v-84.9c0-3.9-3.1-7.1-7-7.1h-42c-3.8 0-7 3.2-7 7.1zm396-144.7H521L403.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-add",theme:"outlined"};var lu=i.forwardRef(function(e,t){return i.createElement(tA.default,(0,tI.default)({},e,{ref:t,icon:lm}))});let lx=async(e,t)=>{let s=(0,l.getProxyBaseUrl)(),a=`${s}/project/new`,r=await fetch(a,{method:"POST",headers:{[(0,l.getGlobalLitellmHeaderName)()]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!r.ok){let e=await r.json(),t=(0,l.deriveErrorMessage)(e);throw(0,l.handleError)(t),Error(t)}return r.json()};function lp({form:e}){let{accessToken:s,userId:a,userRole:l}=(0,r.default)(),{data:n}=(0,lc.useTeams)(),[o,d]=(0,i.useState)(null),[c,m]=(0,i.useState)([]),u=p.Form.useWatch("team_id",e);return(0,i.useEffect)(()=>{if(u&&n){let e=n.find(e=>e.team_id===u)??null;e&&e.team_id!==o?.team_id&&d(e)}},[u,n,o?.team_id]),(0,i.useEffect)(()=>{a&&l&&s&&o?(0,sX.fetchTeamModels)(a,l,s,o.team_id).then(e=>{m(Array.from(new Set([...o.models??[],...e])))}):m([])},[o,s,a,l]),(0,t.jsxs)(p.Form,{form:e,layout:"vertical",name:"project_form",initialValues:{isBlocked:!1},style:{marginTop:24},children:[(0,t.jsx)(sz.Typography.Text,{strong:!0,style:{fontSize:13,color:"#374151",textTransform:"uppercase",letterSpacing:"0.05em"},children:"Basic Information"}),(0,t.jsx)(_.Divider,{style:{marginTop:8,marginBottom:16}}),(0,t.jsxs)(t_.Row,{gutter:24,children:[(0,t.jsx)(tv.Col,{span:12,children:(0,t.jsx)(p.Form.Item,{name:"project_alias",label:"Project Name",rules:[{required:!0,message:"Please enter a project name"}],children:(0,t.jsx)(j.Input,{placeholder:"e.g. Customer Support Bot"})})}),(0,t.jsx)(tv.Col,{span:12,children:(0,t.jsx)(p.Form.Item,{name:"team_id",label:"Team",rules:[{required:!0,message:"Please select a team"}],children:(0,t.jsx)(g.Select,{showSearch:!0,placeholder:"Search or select a team",onChange:t=>{d(n?.find(e=>e.team_id===t)??null),e.setFieldValue("models",[])},allowClear:!0,optionLabelProp:"label",filterOption:(e,t)=>{let s=n?.find(e=>e.team_id===t?.value);if(!s)return!1;let a=e.toLowerCase().trim();return(s.team_alias||"").toLowerCase().includes(a)||s.team_id.toLowerCase().includes(a)},children:n?.map(e=>(0,t.jsxs)(g.Select.Option,{value:e.team_id,label:e.team_alias||e.team_id,children:[(0,t.jsx)("span",{style:{fontWeight:500},children:e.team_alias})," ",(0,t.jsxs)("span",{style:{color:"#9ca3af"},children:["(",e.team_id,")"]})]},e.team_id))})})})]}),(0,t.jsx)(t_.Row,{children:(0,t.jsx)(tv.Col,{span:24,children:(0,t.jsx)(p.Form.Item,{name:"description",label:"Description",children:(0,t.jsx)(j.Input.TextArea,{placeholder:"Describe the purpose of this project",rows:3})})})}),(0,t.jsx)(t_.Row,{children:(0,t.jsx)(tv.Col,{span:24,children:(0,t.jsx)(p.Form.Item,{name:"models",label:"Allowed Models (scoped to selected team's models)",help:o?void 0:"Select a team first to see available models",children:(0,t.jsxs)(g.Select,{mode:"multiple",placeholder:o?"Select models":"Select a team first",disabled:!o,allowClear:!0,maxTagCount:"responsive",onChange:t=>{t.includes("all-team-models")&&e.setFieldsValue({models:["all-team-models"]})},children:[(0,t.jsx)(g.Select.Option,{value:"all-team-models",children:"All Team Models"},"all-team-models"),c.map(e=>(0,t.jsx)(g.Select.Option,{value:e,children:(0,T.getModelDisplayName)(e)},e))]})})})}),(0,t.jsx)(t_.Row,{gutter:24,children:(0,t.jsx)(tv.Col,{span:12,children:(0,t.jsx)(p.Form.Item,{name:"max_budget",label:"Max Budget (USD)",children:(0,t.jsx)(ts.InputNumber,{prefix:"$",style:{width:"100%"},placeholder:"0.00",min:0,precision:2})})})}),(0,t.jsx)(t_.Row,{children:(0,t.jsx)(tv.Col,{span:24,children:(0,t.jsx)(F.Collapse,{ghost:!0,style:{background:"#f9fafb",borderRadius:8,border:"1px solid #e5e7eb"},items:[{key:"1",label:(0,t.jsx)(sz.Typography.Text,{strong:!0,style:{color:"#374151"},children:"Advanced Settings"}),children:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(aE.Flex,{align:"center",gap:12,children:[(0,t.jsx)(sz.Typography.Text,{strong:!0,children:"Block Project"}),(0,t.jsx)(p.Form.Item,{name:"isBlocked",valuePropName:"checked",noStyle:!0,children:(0,t.jsx)(I.Switch,{})})]}),(0,t.jsx)(p.Form.Item,{noStyle:!0,shouldUpdate:(e,t)=>e.isBlocked!==t.isBlocked,children:({getFieldValue:e})=>e("isBlocked")?(0,t.jsx)(x.Alert,{banner:!0,type:"warning",showIcon:!0,message:"All API requests using keys under this project will be rejected.",style:{marginTop:12}}):null}),(0,t.jsx)(_.Divider,{}),(0,t.jsx)(sz.Typography.Text,{strong:!0,style:{display:"block",marginBottom:12},children:"Model-Specific Limits"}),(0,t.jsx)(p.Form.List,{name:"modelLimits",children:(s,{add:a,remove:l})=>(0,t.jsxs)(t.Fragment,{children:[s.map(({key:s,name:a,...r})=>(0,t.jsxs)(aj.Space,{style:{display:"flex",marginBottom:8},align:"baseline",children:[(0,t.jsx)(p.Form.Item,{...r,name:[a,"model"],rules:[{required:!0,message:"Missing model"},{validator:(t,s)=>s&&(e.getFieldValue("modelLimits")??[]).filter(e=>e?.model===s).length>1?Promise.reject(Error("Duplicate model")):Promise.resolve()}],children:(0,t.jsx)(j.Input,{placeholder:"Model name (e.g. gpt-4)"})}),(0,t.jsx)(p.Form.Item,{...r,name:[a,"tpm"],children:(0,t.jsx)(ts.InputNumber,{placeholder:"TPM Limit",min:0})}),(0,t.jsx)(p.Form.Item,{...r,name:[a,"rpm"],children:(0,t.jsx)(ts.InputNumber,{placeholder:"RPM Limit",min:0})}),(0,t.jsx)(L.MinusCircleOutlined,{onClick:()=>l(a),style:{color:"#ef4444"}})]},s)),(0,t.jsx)(p.Form.Item,{children:(0,t.jsx)(A.Button,{type:"dashed",onClick:()=>a(),block:!0,icon:(0,t.jsx)(P.PlusOutlined,{}),children:"Add Model Limit"})})]})}),(0,t.jsx)(_.Divider,{}),(0,t.jsx)(sz.Typography.Text,{strong:!0,style:{display:"block",marginBottom:12},children:"Metadata"}),(0,t.jsx)(p.Form.List,{name:"metadata",children:(s,{add:a,remove:l})=>(0,t.jsxs)(t.Fragment,{children:[s.map(({key:s,name:a,...r})=>(0,t.jsxs)(aj.Space,{style:{display:"flex",marginBottom:8},align:"baseline",children:[(0,t.jsx)(p.Form.Item,{...r,name:[a,"key"],rules:[{required:!0,message:"Missing key"},{validator:(t,s)=>s&&(e.getFieldValue("metadata")??[]).filter(e=>e?.key===s).length>1?Promise.reject(Error("Duplicate key")):Promise.resolve()}],children:(0,t.jsx)(j.Input,{placeholder:"Key"})}),(0,t.jsx)(p.Form.Item,{...r,name:[a,"value"],rules:[{required:!0,message:"Missing value"}],children:(0,t.jsx)(j.Input,{placeholder:"Value"})}),(0,t.jsx)(L.MinusCircleOutlined,{onClick:()=>l(a),style:{color:"#ef4444"}})]},s)),(0,t.jsx)(p.Form.Item,{children:(0,t.jsx)(A.Button,{type:"dashed",onClick:()=>a(),block:!0,icon:(0,t.jsx)(P.PlusOutlined,{}),children:"Add Key-Value Pair"})})]})})]})}]})})})]})}function lh(e){let t={},s={};for(let a of e.modelLimits??[])a.model&&(null!=a.rpm&&(t[a.model]=a.rpm),null!=a.tpm&&(s[a.model]=a.tpm));let a={};for(let t of e.metadata??[])t.key&&(a[t.key]=t.value);return{project_alias:e.project_alias,description:e.description,models:e.models??[],max_budget:e.max_budget,blocked:e.isBlocked??!1,...Object.keys(t).length>0&&{model_rpm_limit:t},...Object.keys(s).length>0&&{model_tpm_limit:s},...Object.keys(a).length>0&&{metadata:a}}}function lg({isOpen:e,onClose:s}){let[a]=p.Form.useForm(),l=(()=>{let{accessToken:e}=(0,r.default)(),t=(0,aP.useQueryClient)();return(0,aA.useMutation)({mutationFn:async t=>{if(!e)throw Error("Access token is required");return lx(e,t)},onSuccess:()=>{t.invalidateQueries({queryKey:lo.projectKeys.all})}})})(),i=async()=>{try{let e=await a.validateFields(),t={...lh(e),team_id:e.team_id};l.mutate(t,{onSuccess:()=>{h.message.success("Project created successfully"),a.resetFields(),s()},onError:e=>{h.message.error(e.message||"Failed to create project")}})}catch(e){console.error("Validation failed:",e)}},n=()=>{a.resetFields(),s()};return(0,t.jsx)(u.Modal,{title:(0,t.jsx)(sz.Typography.Text,{strong:!0,style:{fontSize:18},children:"Create New Project"}),open:e,onCancel:n,width:720,destroyOnHidden:!0,footer:[(0,t.jsx)(A.Button,{onClick:n,children:"Cancel"},"cancel"),(0,t.jsx)(A.Button,{type:"primary",icon:(0,t.jsx)(lu,{}),loading:l.isPending,onClick:i,children:"Create Project"},"submit")],children:(0,t.jsx)(lp,{form:a})})}let lj=async(e,t)=>{let s=(0,l.getProxyBaseUrl)(),a=`${s}/project/info?project_id=${encodeURIComponent(t)}`,r=await fetch(a,{method:"GET",headers:{[(0,l.getGlobalLitellmHeaderName)()]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=(0,l.deriveErrorMessage)(e);throw(0,l.handleError)(t),Error(t)}return r.json()},ly=(0,aq.default)("dollar-sign",[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]]);var aY=aY,aX=aX,lf=e.i(987432);let lb=async(e,t,s)=>{let a=(0,l.getProxyBaseUrl)(),r=`${a}/project/update`,i=await fetch(r,{method:"POST",headers:{[(0,l.getGlobalLitellmHeaderName)()]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({project_id:t,...s})});if(!i.ok){let e=await i.json(),t=(0,l.deriveErrorMessage)(e);throw(0,l.handleError)(t),Error(t)}return i.json()};function l_({isOpen:e,project:s,onClose:a,onSuccess:l}){let[n]=p.Form.useForm(),o=(()=>{let{accessToken:e}=(0,r.default)(),t=(0,aP.useQueryClient)();return(0,aA.useMutation)({mutationFn:async({projectId:t,params:s})=>{if(!e)throw Error("Access token is required");return lb(e,t,s)},onSuccess:()=>{t.invalidateQueries({queryKey:lo.projectKeys.all})}})})();(0,i.useEffect)(()=>{if(e&&s){let e=s.metadata??{},t=e.model_rpm_limit??{},a=e.model_tpm_limit??{},l=[];for(let e of new Set([...Object.keys(t),...Object.keys(a)]))l.push({model:e,rpm:t[e],tpm:a[e]});let r=new Set(["model_rpm_limit","model_tpm_limit"]),i=[];for(let[t,s]of Object.entries(e))r.has(t)||i.push({key:t,value:String(s)});n.setFieldsValue({project_alias:s.project_alias??"",team_id:s.team_id??"",description:s.description??"",models:s.models??[],max_budget:s.litellm_budget_table?.max_budget??void 0,isBlocked:s.blocked,modelLimits:l.length>0?l:void 0,metadata:i.length>0?i:void 0})}},[e,s,n]);let d=async()=>{try{let e=await n.validateFields(),t={...lh(e),team_id:e.team_id};o.mutate({projectId:s.project_id,params:t},{onSuccess:()=>{h.message.success("Project updated successfully"),l?.(),a()},onError:e=>{h.message.error(e.message||"Failed to update project")}})}catch(e){console.error("Validation failed:",e)}};return(0,t.jsx)(u.Modal,{title:(0,t.jsx)(sz.Typography.Text,{strong:!0,style:{fontSize:18},children:"Edit Project"}),open:e,onCancel:a,width:720,destroyOnHidden:!0,footer:[(0,t.jsx)(A.Button,{onClick:a,children:"Cancel"},"cancel"),(0,t.jsx)(A.Button,{type:"primary",icon:(0,t.jsx)(lf.SaveOutlined,{}),loading:o.isPending,onClick:d,children:"Save Changes"},"submit")],children:(0,t.jsx)(lp,{form:n})})}var lv=e.i(207082),az=az,aU=aU;let lN=[{title:"Key Name",dataIndex:"key_alias",key:"key_alias",render:e=>e||"—"},{title:"Owner",key:"owner",render:(e,s)=>{let a=s.user?.user_email??s.user_id??null;return a?(0,t.jsx)(eu.Tooltip,{title:a,children:(0,t.jsx)(aZ.default,{userId:a})}):"—"}},{title:"Created",dataIndex:"created_at",key:"created_at",render:e=>e?new Date(e).toLocaleDateString():"—"},{title:"Last Active",dataIndex:"last_active",key:"last_active",render:e=>e?new Date(e).toLocaleDateString():"Never"}];function lw({keys:e,loading:s}){return(0,t.jsx)(tt.Table,{columns:lN,dataSource:e,rowKey:"token",loading:s,pagination:!1,size:"small",locale:{emptyText:(0,t.jsx)(aK.Empty,{description:"No keys found",image:aK.Empty.PRESENTED_IMAGE_SIMPLE})}})}function lk({projectId:e}){let[s,a]=(0,i.useState)(1),[l,r]=(0,i.useState)(""),{data:n,isLoading:o}=(0,lv.useKeys)(s,5,{projectID:e,selectedKeyAlias:l||null});(0,i.useEffect)(()=>{a(1)},[l]);let d=n?.keys??[],c=n?.total_count??0;return(0,t.jsxs)(ec.Card,{title:(0,t.jsxs)(aE.Flex,{align:"center",gap:8,children:[(0,t.jsx)(aJ.KeyIcon,{size:16}),"Keys"]}),style:{height:"100%"},children:[(0,t.jsxs)(aE.Flex,{justify:"space-between",align:"center",style:{marginBottom:12},children:[(0,t.jsx)(j.Input,{prefix:(0,t.jsx)(aU.default,{size:14}),placeholder:"Filter by key name...",style:{maxWidth:220},value:l,onChange:e=>r(e.target.value),allowClear:!0,size:"small"}),(0,t.jsx)(az.default,{current:s,total:c,pageSize:5,onChange:a,size:"small",showSizeChanger:!1,showTotal:e=>`${e} keys`})]}),(0,t.jsx)(lw,{keys:d,loading:!!o&&{indicator:(0,t.jsx)(eS.Spin,{indicator:(0,t.jsx)(tN.LoadingOutlined,{spin:!0})})}})]})}let{Title:lC,Text:lS}=sz.Typography,{Content:lT}=aO.Layout;function lI({projectId:e,onBack:s}){let a,l,n,o,{data:d,isLoading:c}=(e=>{let{accessToken:t,userRole:s}=(0,r.default)(),a=(0,aP.useQueryClient)();return(0,t1.useQuery)({queryKey:lo.projectKeys.detail(e),queryFn:async()=>lj(t,e),enabled:!!(t&&e)&&ey.all_admin_roles.includes(s||""),initialData:()=>{if(!e)return;let t=a.getQueryData(lo.projectKeys.list({}));return t?.find(t=>t.project_id===e)}})})(e),{data:m}=(0,lc.useTeam)(d?.team_id??void 0),u=m?.team_info??m,{token:x}=aR.theme.useToken(),[p,h]=(0,i.useState)(!1),g=d?.spend??0,j=d?.litellm_budget_table?.max_budget??null,y=null!=j&&j>0,f=y?Math.min(g/j*100,100):0,_=(0,i.useMemo)(()=>Object.entries(d?.model_spend??{}).map(([e,t])=>({model:e,spend:t})).sort((e,t)=>t.spend-e.spend),[d?.model_spend]);return c?(0,t.jsx)(lT,{style:{padding:x.paddingLG,paddingInline:2*x.paddingLG},children:(0,t.jsx)(aE.Flex,{justify:"center",align:"center",style:{minHeight:300},children:(0,t.jsx)(eS.Spin,{indicator:(0,t.jsx)(tN.LoadingOutlined,{spin:!0}),size:"large"})})}):d?(0,t.jsxs)(lT,{style:{padding:x.paddingLG,paddingInline:2*x.paddingLG},children:[(0,t.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:24},children:[(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:16},children:[(0,t.jsx)(A.Button,{icon:(0,t.jsx)(aQ.ArrowLeftIcon,{size:16}),onClick:s,type:"text"}),(0,t.jsxs)("div",{children:[(0,t.jsxs)(aE.Flex,{align:"center",gap:8,children:[(0,t.jsx)(lC,{level:2,style:{margin:0},children:d.project_alias??d.project_id}),(0,t.jsx)(b.Tag,{color:d.blocked?"red":"green",children:d.blocked?"Blocked":"Active"})]}),(0,t.jsxs)(lS,{type:"secondary",children:["ID: ",(0,t.jsx)(lS,{copyable:!0,children:d.project_id})]})]})]}),(0,t.jsx)(A.Button,{type:"primary",icon:(0,t.jsx)(aY.default,{size:16}),onClick:()=>h(!0),children:"Edit Project"})]}),(0,t.jsx)(t_.Row,{style:{marginBottom:24},children:(0,t.jsx)(ec.Card,{children:(0,t.jsxs)(eT.Descriptions,{title:"Project Details",column:1,children:[(0,t.jsx)(eT.Descriptions.Item,{label:"Description",children:d.description||"—"}),(0,t.jsxs)(eT.Descriptions.Item,{label:"Created",children:[new Date(d.created_at).toLocaleString(),d.created_by&&(0,t.jsxs)(lS,{children:[" ","by"," ",(0,t.jsx)(aZ.default,{userId:d.created_by})]})]}),(0,t.jsxs)(eT.Descriptions.Item,{label:"Last Updated",children:[new Date(d.updated_at).toLocaleString(),d.updated_by&&(0,t.jsxs)(lS,{children:[" ","by"," ",(0,t.jsx)(aZ.default,{userId:d.updated_by})]})]})]})})}),(0,t.jsxs)(t_.Row,{gutter:[16,16],style:{marginBottom:24},children:[(0,t.jsx)(tv.Col,{xs:24,lg:8,children:(0,t.jsx)(ec.Card,{title:(0,t.jsxs)(aE.Flex,{align:"center",gap:8,children:[(0,t.jsx)(ly,{size:16}),"Budget"]}),style:{height:"100%"},children:(0,t.jsxs)(aE.Flex,{vertical:!0,gap:16,children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)(lS,{strong:!0,style:{fontSize:28,lineHeight:1},children:["$",g.toFixed(2)]}),(0,t.jsx)("br",{}),(0,t.jsx)(lS,{type:"secondary",children:y?`of $${j.toFixed(2)} budget`:"No budget limit"})]}),y&&(0,t.jsxs)("div",{children:[(0,t.jsx)(ay.Progress,{percent:Math.round(10*f)/10,strokeColor:f>=90?"#f5222d":f>=70?"#faad14":"#52c41a",showInfo:!1}),(0,t.jsxs)(lS,{type:"secondary",style:{fontSize:12},children:[(Math.round(10*f)/10).toFixed(1),"% utilized"]})]})]})})}),(0,t.jsx)(tv.Col,{xs:24,lg:16,children:(0,t.jsx)(ec.Card,{title:"Spend by Model",style:{height:"100%"},children:_.length>0?(0,t.jsx)(sc.BarChart,{data:_,index:"model",categories:["spend"],colors:["cyan"],layout:"vertical",valueFormatter:e=>`$${e.toFixed(4)}`,yAxisWidth:140,showLegend:!1,style:{height:Math.max(40*_.length,120)}}):(0,t.jsx)(aK.Empty,{description:"No model spend recorded yet",image:aK.Empty.PRESENTED_IMAGE_SIMPLE})})})]}),(0,t.jsxs)(t_.Row,{gutter:[16,16],style:{marginBottom:24},children:[(0,t.jsx)(tv.Col,{xs:24,lg:12,children:(0,t.jsx)(lk,{projectId:d.project_id})}),(0,t.jsx)(tv.Col,{xs:24,lg:12,children:(0,t.jsx)(ec.Card,{title:(0,t.jsxs)(aE.Flex,{align:"center",gap:8,children:[(0,t.jsx)(aX.default,{size:16}),"Team"]}),style:{height:"100%"},children:u?(a=u.max_budget??null,l=u.spend??0,o=(n=null!=a&&a>0)?Math.min(l/a*100,100):0,(0,t.jsxs)(aE.Flex,{vertical:!0,gap:12,children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(lS,{strong:!0,style:{fontSize:16},children:u.team_alias||u.team_id}),(0,t.jsx)("br",{}),(0,t.jsxs)(lS,{type:"secondary",style:{fontSize:12},children:["ID:"," ",(0,t.jsx)(lS,{copyable:!0,style:{fontSize:12},children:u.team_id})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(lS,{type:"secondary",style:{fontSize:12,display:"block",marginBottom:4},children:"Models"}),(u.models?.length??0)>0?(0,t.jsx)(aE.Flex,{wrap:"wrap",gap:4,style:{maxHeight:60,overflow:"hidden"},children:u.models?.map(e=>(0,t.jsx)(b.Tag,{style:{margin:0},children:e},e))}):(0,t.jsx)(lS,{type:"secondary",children:"All models"})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)(aE.Flex,{justify:"space-between",align:"center",style:{marginBottom:2},children:[(0,t.jsx)(lS,{type:"secondary",style:{fontSize:12},children:"Spend"}),(0,t.jsxs)(lS,{style:{fontSize:12},children:["$",l.toFixed(2),n?(0,t.jsxs)(lS,{type:"secondary",style:{fontSize:12},children:[" ","/ $",a.toFixed(2)]}):(0,t.jsxs)(lS,{type:"secondary",style:{fontSize:12},children:[" ","(Unlimited)"]})]})]}),n&&(0,t.jsx)(ay.Progress,{percent:Math.round(10*o)/10,strokeColor:o>=90?"#f5222d":o>=70?"#faad14":"#52c41a",size:"small",showInfo:!1})]}),(0,t.jsxs)(aE.Flex,{justify:"space-between",children:[(0,t.jsx)(lS,{type:"secondary",style:{fontSize:12},children:"Members"}),(0,t.jsx)(lS,{style:{fontSize:12},children:u.members_with_roles?.length??0})]})]})):d.team_id?(0,t.jsx)(aE.Flex,{justify:"center",align:"center",style:{padding:16},children:(0,t.jsx)(eS.Spin,{indicator:(0,t.jsx)(tN.LoadingOutlined,{spin:!0}),size:"small"})}):(0,t.jsx)(aK.Empty,{description:"No team assigned",image:aK.Empty.PRESENTED_IMAGE_SIMPLE})})})]}),(0,t.jsx)(l_,{isOpen:p,project:d,onClose:()=>h(!1)})]}):(0,t.jsxs)(lT,{style:{padding:x.paddingLG,paddingInline:2*x.paddingLG},children:[(0,t.jsx)(A.Button,{icon:(0,t.jsx)(aQ.ArrowLeftIcon,{size:16}),onClick:s,type:"text",style:{marginBottom:16}}),(0,t.jsx)(aK.Empty,{description:"Project not found"})]})}let{Title:lF,Text:lA}=sz.Typography,{Content:lP}=aO.Layout;function lL(){let{token:e}=aR.theme.useToken(),{data:s,isLoading:a}=(0,lo.useProjects)(),{data:l,isLoading:n}=(0,lc.useTeams)(),o=(()=>{let{accessToken:e}=(0,r.default)(),t=(0,aP.useQueryClient)();return(0,aA.useMutation)({mutationFn:async t=>{if(!e)throw Error("Access token is required");return ld(e,t)},onSuccess:()=>{t.invalidateQueries({queryKey:lo.projectKeys.all})}})})(),[d,c]=(0,i.useState)(null),[m,u]=(0,i.useState)(!1),[p,g]=(0,i.useState)(null),[y,f]=(0,i.useState)(""),[_,v]=(0,i.useState)(1);(0,i.useEffect)(()=>{v(1)},[y]);let N=(0,i.useMemo)(()=>{let e=new Map;for(let t of l??[])e.set(t.team_id,t.team_alias??t.team_id);return e},[l]),w=(0,i.useMemo)(()=>{let e=s??[];if(!y)return e;let t=y.toLowerCase();return e.filter(e=>{let s=N.get(e.team_id??"")??"";return(e.project_alias??"").toLowerCase().includes(t)||e.project_id.toLowerCase().includes(t)||(e.description??"").toLowerCase().includes(t)||s.toLowerCase().includes(t)})},[s,y,N]),k=[{title:"ID",dataIndex:"project_id",key:"project_id",width:170,render:e=>(0,t.jsx)(eu.Tooltip,{title:e,children:(0,t.jsx)(lA,{ellipsis:!0,className:"text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs cursor-pointer",style:{fontSize:14,padding:"1px 8px"},onClick:()=>c(e),children:e})})},{title:"Name",dataIndex:"project_alias",key:"project_alias",sorter:(e,t)=>(e.project_alias??"").localeCompare(t.project_alias??""),render:e=>e??"—"},{title:"Team",key:"team",sorter:(e,t)=>{let s=N.get(e.team_id??"")??"",a=N.get(t.team_id??"")??"";return s.localeCompare(a)},render:(e,s)=>{if(!s.team_id)return"—";let a=N.get(s.team_id);return a||(n?(0,t.jsx)(eS.Spin,{indicator:(0,t.jsx)(tN.LoadingOutlined,{spin:!0}),size:"small"}):s.team_id)}},{title:"Models",key:"models",render:(e,s)=>{let a=s.models??[];return(0,t.jsx)(eu.Tooltip,{title:a.length>0?a.join(", "):"No models",children:(0,t.jsx)(b.Tag,{color:"blue",style:{fontSize:14,padding:"2px 8px",margin:0},children:(0,t.jsxs)(aE.Flex,{align:"center",gap:6,children:[(0,t.jsx)(a$,{size:14}),a.length]})})})}},{title:"Status",dataIndex:"blocked",key:"status",render:e=>(0,t.jsx)(b.Tag,{color:e?"red":"green",children:e?"Blocked":"Active"})},{title:"Created",dataIndex:"created_at",key:"created_at",sorter:(e,t)=>new Date(e.created_at).getTime()-new Date(t.created_at).getTime(),responsive:["lg"],render:e=>new Date(e).toLocaleDateString()},{title:"Updated",dataIndex:"updated_at",key:"updated_at",responsive:["xl"],render:e=>new Date(e).toLocaleDateString()},{title:"Actions",key:"actions",width:80,render:(e,s)=>(0,t.jsx)(sK.default,{variant:"Delete",tooltipText:"Delete project",onClick:()=>g(s)})}];return d?(0,t.jsx)(lI,{projectId:d,onBack:()=>c(null)}):(0,t.jsxs)(lP,{style:{padding:e.paddingLG,paddingInline:2*e.paddingLG},children:[(0,t.jsx)(x.Alert,{message:"Projects is currently in beta. Features and behavior may change without notice.",type:"warning",showIcon:!0,style:{marginBottom:16}}),(0,t.jsxs)(aE.Flex,{justify:"space-between",align:"center",style:{marginBottom:16},children:[(0,t.jsxs)(aj.Space,{direction:"vertical",size:0,children:[(0,t.jsx)(lF,{level:2,style:{margin:0},children:"[BETA] Projects"}),(0,t.jsx)(lA,{type:"secondary",children:"Manage projects within your teams"})]}),(0,t.jsx)(A.Button,{type:"primary",icon:(0,t.jsx)(P.PlusOutlined,{}),onClick:()=>u(!0),children:"Create Project"})]}),(0,t.jsxs)(ec.Card,{styles:{body:{padding:0}},children:[(0,t.jsxs)(aE.Flex,{justify:"space-between",align:"center",style:{padding:"12px 16px"},children:[(0,t.jsx)(j.Input,{prefix:(0,t.jsx)(aU.default,{size:16}),placeholder:"Search projects by name, ID, description, or team...",style:{maxWidth:400},value:y,onChange:e=>f(e.target.value),allowClear:!0}),(0,t.jsx)(az.default,{current:_,total:w.length,pageSize:10,onChange:e=>v(e),size:"small",showTotal:e=>`${e} projects`,showSizeChanger:!1})]}),(0,t.jsx)(tt.Table,{columns:k,dataSource:w.slice((_-1)*10,10*_),rowKey:"project_id",loading:a,pagination:!1})]}),(0,t.jsx)(lg,{isOpen:m,onClose:()=>u(!1)}),(0,t.jsx)(sH.default,{isOpen:null!==p,title:"Delete Project",alertMessage:"This action is irreversible. All keys must be unlinked from this project before it can be deleted.",message:"Are you sure you want to delete this project?",resourceInformationTitle:"Project Information",resourceInformation:[{label:"Name",value:p?.project_alias||"—"},{label:"Project ID",value:p?.project_id,code:!0},{label:"Team",value:N.get(p?.team_id??"")||p?.team_id||"—"}],onCancel:()=>g(null),onOk:()=>{p&&o.mutate([p.project_id],{onSuccess:()=>{h.message.success("Project deleted successfully"),g(null)},onError:e=>{h.message.error(e.message||"Failed to delete project")}})},confirmLoading:o.isPending,requiredConfirmation:p?.project_alias??void 0})]})}var lM=e.i(241902),lD=e.i(969550),lE=e.i(307582);let lO=[{value:"trusted",label:"trusted",color:"#065f46",bg:"#d1fae5",border:"#6ee7b7"},{value:"blocked",label:"blocked",color:"#991b1b",bg:"#fee2e2",border:"#fca5a5"}],lz=({value:e,toolName:s,saving:a,onChange:l})=>(lO.find(t=>t.value===e)??lO[1],(0,t.jsx)(g.Select,{size:"small",value:e,disabled:a,loading:a,onChange:e=>l(s,e),onClick:e=>e.stopPropagation(),style:{minWidth:110,fontWeight:500},popupMatchSelectWidth:!1,options:lO.map(e=>({value:e.value,label:(0,t.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:12,fontWeight:500,color:e.color},children:[(0,t.jsx)("span",{style:{width:8,height:8,borderRadius:"50%",backgroundColor:e.color,display:"inline-block",flexShrink:0}}),e.label]})}))})),lR=({accessToken:e})=>{let[s,a]=(0,i.useState)([]),[r,n]=(0,i.useState)(!0),[o,d]=(0,i.useState)(!1),[c,m]=(0,i.useState)(null),[u,x]=(0,i.useState)(null),[p,h]=(0,i.useState)(""),[g,j]=(0,i.useState)("created_at"),[y,f]=(0,i.useState)("desc"),[b,_]=(0,i.useState)(1),[v,N]=(0,i.useState)(!0),[w,k]=(0,i.useState)({}),C=(0,i.useDeferredValue)(o),S=o||C,T=(0,i.useCallback)(async()=>{if(e){d(!0),m(null);try{let t=await (0,l.fetchToolsList)(e);a(t)}catch(e){m(e.message??"Failed to load tools")}finally{d(!1),n(!1)}}},[e]);(0,i.useEffect)(()=>{T()},[T]),(0,i.useEffect)(()=>{if(!v)return;let e=setInterval(T,15e3);return()=>clearInterval(e)},[v,T]);let F=async(t,s)=>{if(e){x(t);try{await (0,l.updateToolPolicy)(e,t,s),a(e=>e.map(e=>e.tool_name===t?{...e,call_policy:s}:e))}catch(e){alert(`Failed to update policy: ${e.message}`)}finally{x(null)}}},A=Array.from(new Set(s.map(e=>e.team_id).filter(Boolean))).map(e=>({label:e,value:e})),P=Array.from(new Set(s.map(e=>e.key_alias).filter(Boolean))).map(e=>({label:e,value:e})),L=[{name:"Policy",label:"Policy",options:lO.map(e=>({label:e.label,value:e.value}))},{name:"Team Name",label:"Team Name",options:A},{name:"Key Name",label:"Key Name",options:P}],M=({label:e,field:s})=>(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsx)("span",{children:e}),(0,t.jsx)(aG.TableHeaderSortDropdown,{sortState:g===s&&y,onSortChange:e=>{!1===e?(j("created_at"),f("desc")):(j(s),f(e)),_(1)}})]}),D=s.filter(e=>{if(p){let t=p.toLowerCase();if(!(e.tool_name.toLowerCase().includes(t)||(e.team_id??"").toLowerCase().includes(t)||(e.key_alias??"").toLowerCase().includes(t)||(e.key_hash??"").toLowerCase().includes(t)||e.call_policy.toLowerCase().includes(t)))return!1}return(!w.Policy||e.call_policy===w.Policy)&&(!w["Team Name"]||e.team_id===w["Team Name"])&&(!w["Key Name"]||e.key_alias===w["Key Name"])}),E=[...D].sort((e,t)=>{let s=e[g]??"",a=t[g]??"";return sa?"desc"===y?-1:1:0}),O=Math.max(1,Math.ceil(E.length/50)),z=E.slice((b-1)*50,50*b);return(0,t.jsxs)("div",{className:"p-6 w-full",children:[(0,t.jsx)("h1",{className:"text-2xl font-semibold text-gray-900 mb-6",children:"Tool Policies"}),(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow w-full max-w-full box-border",children:[(0,t.jsxs)("div",{className:"border-b px-6 py-4 w-full max-w-full box-border",children:[(0,t.jsxs)("div",{className:"flex flex-col md:flex-row items-start md:items-center justify-between space-y-4 md:space-y-0 w-full max-w-full box-border",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 Tool Name",className:"w-full px-3 py-2 pl-8 border rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500",value:p,onChange:e=>{h(e.target.value),_(1)}}),(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)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"text-sm font-medium text-gray-900",children:"Live Tail"}),(0,t.jsx)(I.Switch,{checked:v,onChange:N})]}),(0,t.jsxs)("button",{onClick:T,disabled:S,className:"flex items-center gap-1.5 px-3 py-2 text-sm border rounded-md hover:bg-gray-50 disabled:opacity-60",children:[(0,t.jsx)("svg",{className:`w-4 h-4 ${S?"animate-spin":""}`,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"})}),S?"Fetching":"Fetch"]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-4 text-sm text-gray-600 whitespace-nowrap",children:[(0,t.jsxs)("span",{children:["Showing ",0===D.length?0:(b-1)*50+1," -"," ",Math.min(50*b,D.length)," of ",D.length," results"]}),(0,t.jsxs)("span",{children:["Page ",b," of ",O]}),(0,t.jsxs)("div",{className:"flex gap-1",children:[(0,t.jsx)("button",{onClick:()=>_(e=>Math.max(1,e-1)),disabled:1===b,className:"px-3 py-1.5 border rounded-md text-sm hover:bg-gray-50 disabled:opacity-40",children:"Previous"}),(0,t.jsx)("button",{onClick:()=>_(e=>Math.min(O,e+1)),disabled:b===O,className:"px-3 py-1.5 border rounded-md text-sm hover:bg-gray-50 disabled:opacity-40",children:"Next"})]})]})]}),(0,t.jsx)("div",{className:"mt-3",children:(0,t.jsx)(lD.default,{options:L,onApplyFilters:e=>{k(e),_(1)},onResetFilters:()=>{k({}),_(1)},buttonLabel:"Filters"})})]}),v&&(0,t.jsxs)("div",{className:"bg-green-50 border-b border-green-100 px-6 py-2 flex items-center justify-between",children:[(0,t.jsx)("span",{className:"text-sm text-green-700",children:"Auto-refreshing every 15 seconds"}),(0,t.jsx)("button",{onClick:()=>N(!1),className:"text-xs text-green-600 underline",children:"Stop"})]}),c&&(0,t.jsx)("div",{className:"mx-6 mt-4 p-3 bg-red-50 border border-red-200 rounded text-sm text-red-700",children:c}),(0,t.jsxs)(eY.Table,{className:"[&_td]:py-0.5 [&_th]:py-1 w-full",children:[(0,t.jsx)(eJ.TableHead,{children:(0,t.jsxs)(eX.TableRow,{children:[(0,t.jsx)(eZ.TableHeaderCell,{className:"py-1 h-8",children:(0,t.jsx)(M,{label:"Discovered",field:"created_at"})}),(0,t.jsx)(eZ.TableHeaderCell,{className:"py-1 h-8",children:(0,t.jsx)(M,{label:"Tool Name",field:"tool_name"})}),(0,t.jsx)(eZ.TableHeaderCell,{className:"py-1 h-8",children:(0,t.jsx)(M,{label:"Policy",field:"call_policy"})}),(0,t.jsx)(eZ.TableHeaderCell,{className:"py-1 h-8",children:(0,t.jsx)(M,{label:"# Calls",field:"call_count"})}),(0,t.jsx)(eZ.TableHeaderCell,{className:"py-1 h-8",children:(0,t.jsx)(M,{label:"Team Name",field:"team_id"})}),(0,t.jsx)(eZ.TableHeaderCell,{className:"py-1 h-8",children:"Key Hash"}),(0,t.jsx)(eZ.TableHeaderCell,{className:"py-1 h-8",children:(0,t.jsx)(M,{label:"Key Name",field:"key_alias"})}),(0,t.jsx)(eZ.TableHeaderCell,{className:"py-1 h-8",children:"Origin"})]})}),(0,t.jsx)(e0.TableBody,{children:r?(0,t.jsx)(eX.TableRow,{children:(0,t.jsx)(e1.TableCell,{colSpan:8,className:"h-8 text-center text-gray-500",children:"Loading tools…"})}):0===z.length?(0,t.jsx)(eX.TableRow,{children:(0,t.jsx)(e1.TableCell,{colSpan:8,className:"h-8 text-center text-gray-500",children:"No tools discovered yet. Make a chat completion that returns tool_calls to start auto-discovery."})}):z.map(e=>(0,t.jsxs)(eX.TableRow,{className:"h-8 hover:bg-gray-50",children:[(0,t.jsx)(e1.TableCell,{className:"py-0.5 max-h-8 overflow-hidden whitespace-nowrap",children:(0,t.jsx)(lE.TimeCell,{utcTime:e.created_at??""})}),(0,t.jsx)(e1.TableCell,{className:"py-0.5 max-h-8 overflow-hidden",children:(0,t.jsx)(eu.Tooltip,{title:e.tool_name,children:(0,t.jsx)("span",{className:"font-mono text-xs max-w-[20ch] truncate block font-medium",children:e.tool_name})})}),(0,t.jsx)(e1.TableCell,{className:"py-0.5 max-h-8",children:(0,t.jsx)(lz,{value:e.call_policy,toolName:e.tool_name,saving:u===e.tool_name,onChange:F})}),(0,t.jsx)(e1.TableCell,{className:"py-0.5 max-h-8 text-right tabular-nums text-sm font-mono text-gray-700",children:(e.call_count??0).toLocaleString()}),(0,t.jsx)(e1.TableCell,{className:"py-0.5 max-h-8 overflow-hidden whitespace-nowrap",children:(0,t.jsx)(eu.Tooltip,{title:e.team_id??"-",children:(0,t.jsx)("span",{className:"max-w-[15ch] truncate block",children:e.team_id??"-"})})}),(0,t.jsx)(e1.TableCell,{className:"py-0.5 max-h-8 overflow-hidden whitespace-nowrap",children:(0,t.jsx)(eu.Tooltip,{title:e.key_hash??"-",children:(0,t.jsx)("span",{className:"font-mono max-w-[15ch] truncate block text-blue-600",children:e.key_hash??"-"})})}),(0,t.jsx)(e1.TableCell,{className:"py-0.5 max-h-8 overflow-hidden whitespace-nowrap",children:(0,t.jsx)(eu.Tooltip,{title:e.key_alias??"-",children:(0,t.jsx)("span",{className:"max-w-[15ch] truncate block",children:e.key_alias??"-"})})}),(0,t.jsx)(e1.TableCell,{className:"py-0.5 max-h-8 overflow-hidden whitespace-nowrap",children:(0,t.jsx)(eu.Tooltip,{title:e.origin??"-",children:(0,t.jsx)("span",{className:"max-w-[15ch] truncate block",children:e.origin??"-"})})})]},e.tool_id))})]}),O>1&&(0,t.jsxs)("div",{className:"border-t px-6 py-3 flex items-center justify-between text-sm text-gray-600",children:[(0,t.jsxs)("span",{children:["Showing ",(b-1)*50+1," - ",Math.min(50*b,E.length)," of"," ",E.length]}),(0,t.jsxs)("div",{className:"flex gap-1",children:[(0,t.jsx)("button",{onClick:()=>_(e=>Math.max(1,e-1)),disabled:1===b,className:"px-3 py-1.5 border rounded-md hover:bg-gray-50 disabled:opacity-40",children:"Previous"}),(0,t.jsx)("button",{onClick:()=>_(e=>Math.min(O,e+1)),disabled:b===O,className:"px-3 py-1.5 border rounded-md hover:bg-gray-50 disabled:opacity-40",children:"Next"})]})]})]})]})};var lB=e.i(936190),lq=e.i(910119),l$=e.i(275144),lU=e.i(161281),lV=e.i(317751),lG=e.i(947293),lH=e.i(618566),lK=e.i(592143);function lW(e,t="/"){document.cookie=`${e}=; Max-Age=0; Path=${t}`}let lQ=new lV.QueryClient;function lY(){let[e,a]=(0,i.useState)(""),[r,m]=(0,i.useState)(!1),[u,x]=(0,i.useState)(!1),[p,h]=(0,i.useState)(null),[g,j]=(0,i.useState)(null),[y,f]=(0,i.useState)([]),[b,_]=(0,i.useState)([]),[v,N]=(0,i.useState)([]),[w,k]=(0,i.useState)({PROXY_BASE_URL:"",PROXY_LOGOUT_URL:""}),[C,S]=(0,i.useState)(!0),T=(0,lH.useSearchParams)(),[I,F]=(0,i.useState)({data:[]}),[A,P]=(0,i.useState)(null),[L,M]=(0,i.useState)(!1),[D,E]=(0,i.useState)(!0),[O,z]=(0,i.useState)(null),[R,B]=(0,i.useState)(!0),[q,$]=(0,i.useState)(!1),[U,V]=(0,i.useState)(!1),[G,H]=(0,i.useState)(!1),[K,W]=(0,i.useState)(!1),[Q,Y]=(0,i.useState)(!1),J=T.get("invitation_id"),[X,Z]=(0,i.useState)(()=>T.get("page")||"api-keys"),[ee,et]=(0,i.useState)(null),[es,ea]=(0,i.useState)(!1),el=e=>{f(t=>t?[...t,e]:[e]),M(()=>!L)},er=!1===D&&null===A&&null===J;return((0,i.useEffect)(()=>{let e=!1;return(async()=>{try{await (0,l.getUiConfig)()}catch{}if(e)return;let t=function(e){let t=document.cookie.split("; ").find(t=>t.startsWith(e+"="));if(!t)return null;let s=t.slice(e.length+1);try{return decodeURIComponent(s)}catch{return s}}("token"),s=t&&!(0,lU.isJwtExpired)(t)?t:null;t&&!s&&lW("token","/"),e||(P(s),E(!1))})(),()=>{e=!0}},[]),(0,i.useEffect)(()=>{if(er){let e=(l.proxyBaseUrl||"")+"/ui/login";window.location.replace(e)}},[er]),(0,i.useEffect)(()=>{if(!A)return;if((0,lU.isJwtExpired)(A)){lW("token","/"),P(null);return}let e=null;try{e=(0,lG.jwtDecode)(A)}catch{lW("token","/"),P(null);return}if(e){if(et(e.key),x(e.disabled_non_admin_personal_key_creation),e.user_role){let t=function(e){if(!e)return"Undefined Role";switch(e.toLowerCase()){case"app_owner":case"demo_app_owner":return"App Owner";case"app_admin":case"proxy_admin":return"Admin";case"proxy_admin_viewer":return"Admin Viewer";case"org_admin":return"Org Admin";case"internal_user":return"Internal User";case"internal_user_viewer":case"internal_viewer":return"Internal Viewer";case"app_user":return"App User";default:return"Unknown Role"}}(e.user_role);a(t),"Admin Viewer"==t&&Z("usage")}e.user_email&&h(e.user_email),e.login_method&&S("username_password"==e.login_method),e.premium_user&&m(e.premium_user),e.auth_header_name&&(0,l.setGlobalLitellmHeaderName)(e.auth_header_name),e.user_id&&z(e.user_id)}},[A]),(0,i.useEffect)(()=>{ee&&O&&e&&(0,sX.fetchUserModels)(O,e,ee,N),ee&&O&&e&&(0,eR.fetchTeams)(ee,O,e,null,j),ee&&(0,sZ.fetchOrganizations)(ee,_)},[ee,O,e]),(0,i.useEffect)(()=>{ee&&A&&(async()=>{try{let e=await (0,l.getInProductNudgesCall)(ee),t=e?.is_claude_code_enabled||!1;V(t),t&&(H(!0),B(!1))}catch(e){console.error("Failed to fetch in-product nudges:",e)}})()},[ee,A]),(0,i.useEffect)(()=>{if(R&&!q){let e=setTimeout(()=>{B(!1)},15e3);return()=>clearTimeout(e)}},[R,q]),(0,i.useEffect)(()=>{if(G&&!K){let e=setTimeout(()=>{H(!1)},15e3);return()=>clearTimeout(e)}},[G,K]),D||er)?(0,t.jsx)(eB.default,{}):(0,t.jsx)(i.Suspense,{fallback:(0,t.jsx)(eB.default,{}),children:(0,t.jsx)(aP.QueryClientProvider,{client:lQ,children:(0,t.jsx)(lK.ConfigProvider,{theme:{algorithm:Q?aR.theme.darkAlgorithm:aR.theme.defaultAlgorithm},children:(0,t.jsx)(l$.ThemeProvider,{accessToken:ee,children:J?(0,t.jsx)(aI.default,{userID:O,userRole:e,premiumUser:r,teams:g,keys:y,setUserRole:a,userEmail:p,setUserEmail:h,setTeams:j,setKeys:f,organizations:b,addKey:el,createClicked:L}):(0,t.jsxs)("div",{className:"flex flex-col min-h-screen",children:[(0,t.jsx)(s_.default,{userID:O,userRole:e,premiumUser:r,userEmail:p,setProxySettings:k,proxySettings:w,accessToken:ee,isPublicPage:!1,sidebarCollapsed:es,onToggleSidebar:()=>{ea(!es)},isDarkMode:Q,toggleDarkMode:()=>{Y(!Q)}}),(0,t.jsxs)("div",{className:"flex flex-1",children:[(0,t.jsx)("div",{className:"mt-2",children:(0,t.jsx)(n,{setPage:e=>{let t=new URLSearchParams(T);t.set("page",e),window.history.pushState(null,"",`?${t.toString()}`),Z(e)},defaultSelectedKey:X,sidebarCollapsed:es})}),"api-keys"==X?(0,t.jsx)(aI.default,{userID:O,userRole:e,premiumUser:r,teams:g,keys:y,setUserRole:a,userEmail:p,setUserEmail:h,setTeams:j,setKeys:f,organizations:b,addKey:el,createClicked:L}):"models"==X?(0,t.jsx)(o.default,{token:A,keys:y,modelData:I,setModelData:F,premiumUser:r,teams:g}):"llm-playground"==X?(0,t.jsx)(d.default,{}):"users"==X?(0,t.jsx)(lq.default,{userID:O,userRole:e,token:A,keys:y,teams:g,accessToken:ee,setKeys:f}):"teams"==X?(0,t.jsx)(sJ,{teams:g,setTeams:j,accessToken:ee,userID:O,userRole:e,organizations:b,premiumUser:r,searchParams:T}):"organizations"==X?(0,t.jsx)(sZ.default,{organizations:b,setOrganizations:_,userModels:v,accessToken:ee,userRole:e,premiumUser:r}):"admin-panel"==X?(0,t.jsx)(c.default,{proxySettings:w}):"api_ref"==X?(0,t.jsx)(s.default,{proxySettings:w}):"logging-and-alerts"==X?(0,t.jsx)(an.default,{userID:O,userRole:e,accessToken:ee,premiumUser:r}):"budgets"==X?(0,t.jsx)(eE.default,{accessToken:ee}):"guardrails"==X?(0,t.jsx)(sj.default,{accessToken:ee,userRole:e}):"policies"==X?(0,t.jsx)(sy.default,{accessToken:ee,userRole:e}):"agents"==X?(0,t.jsx)(eD,{accessToken:ee,userRole:e}):"prompts"==X?(0,t.jsx)(s1.default,{accessToken:ee,userRole:e}):"transform-request"==X?(0,t.jsx)(aC.default,{accessToken:ee}):"router-settings"==X?(0,t.jsx)(tY.default,{userID:O,userRole:e,accessToken:ee,modelData:I}):"ui-theme"==X?(0,t.jsx)(aS.default,{userID:O,userRole:e,accessToken:ee}):"cost-tracking"==X?(0,t.jsx)(tQ,{userID:O,userRole:e,accessToken:ee}):"model-hub-table"==X?(0,ey.isAdminRole)(e)?(0,t.jsx)(sb.default,{accessToken:ee,publicPage:!1,premiumUser:r,userRole:e}):(0,t.jsx)(s2.default,{accessToken:ee,isEmbedded:!0}):"caching"==X?(0,t.jsx)(eO.default,{userID:O,userRole:e,token:A,accessToken:ee,premiumUser:r}):"pass-through-settings"==X?(0,t.jsx)(s0.default,{userID:O,userRole:e,accessToken:ee,modelData:I,premiumUser:r}):"logs"==X?(0,t.jsx)(lB.default,{userID:O,userRole:e,token:A,accessToken:ee,allTeams:g??[],premiumUser:r}):"mcp-servers"==X?(0,t.jsx)(sf.MCPServers,{accessToken:ee,userRole:e,userID:O}):"search-tools"==X?(0,t.jsx)(ai,{accessToken:ee,userRole:e,userID:O}):"tag-management"==X?(0,t.jsx)(ak.default,{accessToken:ee,userRole:e,userID:O}):"claude-code-plugins"==X?(0,t.jsx)(ez.default,{accessToken:ee,userRole:e}):"access-groups"==X?(0,t.jsx)(ln,{}):"projects"==X?(0,t.jsx)(lL,{}):"vector-stores"==X?(0,t.jsx)(lM.default,{accessToken:ee,userRole:e,userID:O}):"tool-policies"==X?(0,t.jsx)(lR,{accessToken:ee,userRole:e}):"guardrails-monitor"==X?(0,t.jsx)(sg,{accessToken:ee}):"new_usage"==X?(0,t.jsx)(sv.default,{teams:g??[],organizations:b??[]}):(0,t.jsx)(aT.default,{userID:O,userRole:e,token:A,accessToken:ee,keys:y,premiumUser:r})]}),(0,t.jsx)(ap,{isVisible:R,onOpen:()=>{B(!1),$(!0)},onDismiss:()=>{B(!1)}}),(0,t.jsx)(a_,{isOpen:q,onClose:()=>{$(!1),B(!0)},onComplete:()=>{$(!1)}}),(0,t.jsx)(aN,{isVisible:G,onOpen:()=>{H(!1),W(!0)},onDismiss:()=>{H(!1)}}),(0,t.jsx)(aw,{isOpen:K,onClose:()=>{W(!1),H(!0)},onComplete:()=>{W(!1)}})]})})})})})}function lJ(){return(0,t.jsx)(i.Suspense,{fallback:(0,t.jsx)(eB.default,{}),children:(0,t.jsx)(lY,{})})}e.s(["default",()=>lJ],952683)}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/1736d3b163900b37.js b/litellm/proxy/_experimental/out/_next/static/chunks/1736d3b163900b37.js deleted file mode 100644 index 518c1878c15..00000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/1736d3b163900b37.js +++ /dev/null @@ -1,3 +0,0 @@ -(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,788191,e=>{"use strict";e.i(247167);var t=e.i(931067),a=e.i(271645);let r={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"};var i=e.i(9583),s=a.forwardRef(function(e,s){return a.createElement(i.default,(0,t.default)({},e,{ref:s,icon:r}))});e.s(["PlayCircleOutlined",0,s],788191)},372943,899268,e=>{"use strict";e.i(247167);var t=e.i(8211),a=e.i(271645),r=e.i(343794),i=e.i(529681),s=e.i(242064),l=e.i(704914),n=e.i(876556),c=e.i(290224),o=e.i(251224),d=function(e,t){var a={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(a[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(e);it.indexOf(r[i])&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(a[r[i]]=e[r[i]]);return a};function m({suffixCls:e,tagName:t,displayName:r}){return r=>a.forwardRef((i,s)=>a.createElement(r,Object.assign({ref:s,suffixCls:e,tagName:t},i)))}let u=a.forwardRef((e,t)=>{let{prefixCls:i,suffixCls:l,className:n,tagName:c}=e,m=d(e,["prefixCls","suffixCls","className","tagName"]),{getPrefixCls:u}=a.useContext(s.ConfigContext),f=u("layout",i),[g,h,p]=(0,o.default)(f),x=l?`${f}-${l}`:f;return g(a.createElement(c,Object.assign({className:(0,r.default)(i||x,n,h,p),ref:t},m)))}),f=a.forwardRef((e,m)=>{let{direction:u}=a.useContext(s.ConfigContext),[f,g]=a.useState([]),{prefixCls:h,className:p,rootClassName:x,children:v,hasSider:y,tagName:b,style:w}=e,N=d(e,["prefixCls","className","rootClassName","children","hasSider","tagName","style"]),j=(0,i.default)(N,["suffixCls"]),{getPrefixCls:z,className:L,style:M}=(0,s.useComponentConfig)("layout"),O=z("layout",h),C="boolean"==typeof y?y:!!f.length||(0,n.default)(v).some(e=>e.type===c.default),[k,$,E]=(0,o.default)(O),H=(0,r.default)(O,{[`${O}-has-sider`]:C,[`${O}-rtl`]:"rtl"===u},L,p,x,$,E),_=a.useMemo(()=>({siderHook:{addSider:e=>{g(a=>[].concat((0,t.default)(a),[e]))},removeSider:e=>{g(t=>t.filter(t=>t!==e))}}}),[]);return k(a.createElement(l.LayoutContext.Provider,{value:_},a.createElement(b,Object.assign({ref:m,className:H,style:Object.assign(Object.assign({},M),w)},j),v)))}),g=m({tagName:"div",displayName:"Layout"})(f),h=m({suffixCls:"header",tagName:"header",displayName:"Header"})(u),p=m({suffixCls:"footer",tagName:"footer",displayName:"Footer"})(u),x=m({suffixCls:"content",tagName:"main",displayName:"Content"})(u);g.Header=h,g.Footer=p,g.Content=x,g.Sider=c.default,g._InternalSiderContext=c.SiderContext,e.s(["Layout",0,g],372943);var v=e.i(60699);e.s(["Menu",()=>v.default],899268)},592143,e=>{"use strict";var t=e.i(609587);e.s(["ConfigProvider",()=>t.default])},182399,e=>{"use strict";e.i(247167);var t=e.i(931067),a=e.i(271645);let r={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"};var i=e.i(9583),s=a.forwardRef(function(e,s){return a.createElement(i.default,(0,t.default)({},e,{ref:s,icon:r}))});e.s(["BlockOutlined",0,s],182399)},477189,457202,e=>{"use strict";e.i(247167);var t=e.i(931067),a=e.i(271645);let r={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"};var i=e.i(9583),s=a.forwardRef(function(e,s){return a.createElement(i.default,(0,t.default)({},e,{ref:s,icon:r}))});e.s(["AppstoreOutlined",0,s],477189);let l={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M296 250c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h384c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H296zm184 144H296c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8zm-48 458H208V148h560v320c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V108c0-17.7-14.3-32-32-32H168c-17.7 0-32 14.3-32 32v784c0 17.7 14.3 32 32 32h264c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm440-88H728v-36.6c46.3-13.8 80-56.6 80-107.4 0-61.9-50.1-112-112-112s-112 50.1-112 112c0 50.7 33.7 93.6 80 107.4V764H520c-8.8 0-16 7.2-16 16v152c0 8.8 7.2 16 16 16h352c8.8 0 16-7.2 16-16V780c0-8.8-7.2-16-16-16zM646 620c0-27.6 22.4-50 50-50s50 22.4 50 50-22.4 50-50 50-50-22.4-50-50zm180 266H566v-60h260v60z"}}]},name:"audit",theme:"outlined"};var n=a.forwardRef(function(e,r){return a.createElement(i.default,(0,t.default)({},e,{ref:r,icon:l}))});e.s(["AuditOutlined",0,n],457202)},87316,655900,299023,25652,882293,e=>{"use strict";var t=e.i(475254);let a=(0,t.default)("calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);e.s(["Calendar",()=>a],87316);let r=(0,t.default)("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);e.s(["ChevronUp",()=>r],655900);let i=(0,t.default)("minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);e.s(["Minus",()=>i],299023);let s=(0,t.default)("trending-up",[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]]);e.s(["TrendingUp",()=>s],25652);let l=(0,t.default)("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"}]]);e.s(["UserCheck",()=>l],882293)},761911,98740,e=>{"use strict";let t=(0,e.i(475254).default)("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"}]]);e.s(["default",()=>t],98740),e.s(["Users",()=>t],761911)},190983,e=>{"use strict";var t=e.i(843476),a=e.i(371401);e.i(389083);var r=e.i(878894),i=e.i(87316);e.i(664659),e.i(655900);var s=e.i(531278),l=e.i(299023),n=e.i(25652),c=e.i(882293),o=e.i(761911),d=e.i(271645),m=e.i(764205);let u=(...e)=>e.filter(Boolean).join(" ");function f({accessToken:e,width:f=220}){let g=(0,a.useDisableUsageIndicator)(),[h,p]=(0,d.useState)(!1),[x,v]=(0,d.useState)(!1),[y,b]=(0,d.useState)(null),[w,N]=(0,d.useState)(null),[j,z]=(0,d.useState)(!1),[L,M]=(0,d.useState)(null);(0,d.useEffect)(()=>{(async()=>{if(e){z(!0),M(null);try{let[t,a]=await Promise.all([(0,m.getRemainingUsers)(e),(0,m.getLicenseInfo)(e).catch(()=>null)]);b(t),N(a)}catch(e){console.error("Failed to fetch usage data:",e),M("Failed to load usage data")}finally{z(!1)}}})()},[e]);let O=w?.expiration_date?(e=>{if(!e)return null;let t=new Date(e+"T00:00:00Z"),a=new Date;return a.setHours(0,0,0,0),Math.ceil((t.getTime()-a.getTime())/864e5)})(w.expiration_date):null,C=null!==O&&O<0,k=null!==O&&O>=0&&O<30,{isOverLimit:$,isNearLimit:E,usagePercentage:H,userMetrics:_,teamMetrics:S}=(e=>{if(!e)return{isOverLimit:!1,isNearLimit:!1,usagePercentage:0,userMetrics:{isOverLimit:!1,isNearLimit:!1,usagePercentage:0},teamMetrics:{isOverLimit:!1,isNearLimit:!1,usagePercentage:0}};let t=e.total_users?e.total_users_used/e.total_users*100:0,a=t>100,r=t>=80&&t<=100,i=e.total_teams?e.total_teams_used/e.total_teams*100:0,s=i>100,l=i>=80&&i<=100,n=a||s;return{isOverLimit:n,isNearLimit:(r||l)&&!n,usagePercentage:Math.max(t,i),userMetrics:{isOverLimit:a,isNearLimit:r,usagePercentage:t},teamMetrics:{isOverLimit:s,isNearLimit:l,usagePercentage:i}}})(y),V=$||E||C||k,R=$||C,T=(E||k)&&!R;return g||!e||y?.total_users===null&&y?.total_teams===null?null:(0,t.jsx)("div",{className:"fixed bottom-4 left-4 z-50",style:{width:`${Math.min(f,220)}px`},children:(0,t.jsx)(()=>x?(0,t.jsx)("button",{onClick:()=>v(!1),className:u("bg-white border border-gray-200 rounded-lg shadow-sm p-3 hover:shadow-md transition-all w-full"),title:"Show usage details",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(o.Users,{className:"h-4 w-4 flex-shrink-0"}),V&&(0,t.jsx)("span",{className:"flex-shrink-0",children:R?(0,t.jsx)(r.AlertTriangle,{className:"h-3 w-3"}):T?(0,t.jsx)(n.TrendingUp,{className:"h-3 w-3"}):null}),(0,t.jsxs)("div",{className:"flex items-center gap-2 text-sm font-medium truncate",children:[y&&null!==y.total_users&&(0,t.jsxs)("span",{className:u("flex-shrink-0 px-1.5 py-0.5 rounded text-xs border",_.isOverLimit&&"bg-red-50 text-red-700 border-red-200",_.isNearLimit&&"bg-yellow-50 text-yellow-700 border-yellow-200",!_.isOverLimit&&!_.isNearLimit&&"bg-gray-50 text-gray-700 border-gray-200"),children:["U: ",y.total_users_used,"/",y.total_users]}),y&&null!==y.total_teams&&(0,t.jsxs)("span",{className:u("flex-shrink-0 px-1.5 py-0.5 rounded text-xs border",S.isOverLimit&&"bg-red-50 text-red-700 border-red-200",S.isNearLimit&&"bg-yellow-50 text-yellow-700 border-yellow-200",!S.isOverLimit&&!S.isNearLimit&&"bg-gray-50 text-gray-700 border-gray-200"),children:["T: ",y.total_teams_used,"/",y.total_teams]}),w?.expiration_date&&null!==O&&(0,t.jsx)("span",{className:u("flex-shrink-0 px-1.5 py-0.5 rounded text-xs border",C&&"bg-red-50 text-red-700 border-red-200",k&&"bg-yellow-50 text-yellow-700 border-yellow-200",!C&&!k&&"bg-gray-50 text-gray-700 border-gray-200"),children:O<0?"Exp!":`${O}d`}),!y||null===y.total_users&&null===y.total_teams&&!w&&(0,t.jsx)("span",{className:"truncate",children:"Usage"})]})]})}):j?(0,t.jsx)("div",{className:"bg-white border border-gray-200 rounded-lg shadow-sm p-4 w-full",children:(0,t.jsxs)("div",{className:"flex items-center justify-center gap-2 py-2",children:[(0,t.jsx)(s.Loader2,{className:"h-4 w-4 animate-spin"}),(0,t.jsx)("span",{className:"text-sm text-gray-500 truncate",children:"Loading..."})]})}):L||!y?(0,t.jsx)("div",{className:"bg-white border border-gray-200 rounded-lg shadow-sm p-4 group w-full",children:(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,t.jsx)("div",{className:"flex-1 min-w-0",children:(0,t.jsx)("span",{className:"text-sm text-gray-500 truncate block",children:L||"No data"})}),(0,t.jsx)("button",{onClick:()=>v(!0),className:"opacity-0 group-hover:opacity-100 p-1 hover:bg-gray-100 rounded transition-all flex-shrink-0",title:"Minimize",children:(0,t.jsx)(l.Minus,{className:"h-3 w-3 text-gray-400"})})]})}):(0,t.jsxs)("div",{className:u("bg-white border rounded-lg shadow-sm p-3 transition-all duration-200 group w-full"),children:[(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2 mb-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[(0,t.jsx)(o.Users,{className:"h-4 w-4 flex-shrink-0"}),(0,t.jsx)("span",{className:"font-medium text-sm truncate",children:"Usage"})]}),(0,t.jsx)("button",{onClick:()=>v(!0),className:"opacity-0 group-hover:opacity-100 p-1 hover:bg-gray-100 rounded transition-all flex-shrink-0",title:"Minimize",children:(0,t.jsx)(l.Minus,{className:"h-3 w-3 text-gray-400"})})]}),(0,t.jsxs)("div",{className:"space-y-3 text-sm",children:[w?.has_license&&w.expiration_date&&(0,t.jsxs)("div",{className:u("space-y-1 border rounded-md p-2",C&&"border-red-200 bg-red-50",k&&"border-yellow-200 bg-yellow-50"),children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 text-xs text-gray-600 mb-1",children:[(0,t.jsx)(i.Calendar,{className:"h-3 w-3"}),(0,t.jsx)("span",{className:"font-medium",children:"License"}),(0,t.jsx)("span",{className:u("ml-1 px-1.5 py-0.5 rounded border",C&&"bg-red-50 text-red-700 border-red-200",k&&"bg-yellow-50 text-yellow-700 border-yellow-200",!C&&!k&&"bg-gray-50 text-gray-600 border-gray-200"),children:C?"Expired":k?"Expiring soon":"OK"})]}),(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsx)("span",{className:"text-gray-600 text-xs",children:"Status:"}),(0,t.jsx)("span",{className:u("font-medium text-right",C&&"text-red-600",k&&"text-yellow-600"),children:(e=>{if(null===e)return"No expiration";if(e<0)return"Expired";if(0===e)return"Expires today";if(1===e)return"1 day remaining";if(e<30)return`${e} days remaining`;if(e<60)return"1 month remaining";let t=Math.floor(e/30);return`${t} months remaining`})(O)})]}),w.license_type&&(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsx)("span",{className:"text-gray-600 text-xs",children:"Type:"}),(0,t.jsx)("span",{className:"font-medium text-right capitalize",children:w.license_type})]})]}),null!==y.total_users&&(0,t.jsxs)("div",{className:u("space-y-1 border rounded-md p-2",_.isOverLimit&&"border-red-200 bg-red-50",_.isNearLimit&&"border-yellow-200 bg-yellow-50"),children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 text-xs text-gray-600 mb-1",children:[(0,t.jsx)(o.Users,{className:"h-3 w-3"}),(0,t.jsx)("span",{className:"font-medium",children:"Users"}),(0,t.jsx)("span",{className:u("ml-1 px-1.5 py-0.5 rounded border",_.isOverLimit&&"bg-red-50 text-red-700 border-red-200",_.isNearLimit&&"bg-yellow-50 text-yellow-700 border-yellow-200",!_.isOverLimit&&!_.isNearLimit&&"bg-gray-50 text-gray-600 border-gray-200"),children:_.isOverLimit?"Over limit":_.isNearLimit?"Near limit":"OK"})]}),(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsx)("span",{className:"text-gray-600 text-xs",children:"Used:"}),(0,t.jsxs)("span",{className:"font-medium text-right",children:[y.total_users_used,"/",y.total_users]})]}),(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsx)("span",{className:"text-gray-600 text-xs",children:"Remaining:"}),(0,t.jsx)("span",{className:u("font-medium text-right",_.isOverLimit&&"text-red-600",_.isNearLimit&&"text-yellow-600"),children:y.total_users_remaining})]}),(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsx)("span",{className:"text-gray-600 text-xs",children:"Usage:"}),(0,t.jsxs)("span",{className:"font-medium text-right",children:[Math.round(_.usagePercentage),"%"]})]}),(0,t.jsx)("div",{className:"w-full bg-gray-200 rounded-full h-2",children:(0,t.jsx)("div",{className:u("h-2 rounded-full transition-all duration-300",_.isOverLimit&&"bg-red-500",_.isNearLimit&&"bg-yellow-500",!_.isOverLimit&&!_.isNearLimit&&"bg-green-500"),style:{width:`${Math.min(_.usagePercentage,100)}%`}})})]}),null!==y.total_teams&&(0,t.jsxs)("div",{className:u("space-y-1 border rounded-md p-2",S.isOverLimit&&"border-red-200 bg-red-50",S.isNearLimit&&"border-yellow-200 bg-yellow-50"),children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 text-xs text-gray-600 mb-1",children:[(0,t.jsx)(c.UserCheck,{className:"h-3 w-3"}),(0,t.jsx)("span",{className:"font-medium",children:"Teams"}),(0,t.jsx)("span",{className:u("ml-1 px-1.5 py-0.5 rounded border",S.isOverLimit&&"bg-red-50 text-red-700 border-red-200",S.isNearLimit&&"bg-yellow-50 text-yellow-700 border-yellow-200",!S.isOverLimit&&!S.isNearLimit&&"bg-gray-50 text-gray-600 border-gray-200"),children:S.isOverLimit?"Over limit":S.isNearLimit?"Near limit":"OK"})]}),(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsx)("span",{className:"text-gray-600 text-xs",children:"Used:"}),(0,t.jsxs)("span",{className:"font-medium text-right",children:[y.total_teams_used,"/",y.total_teams]})]}),(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsx)("span",{className:"text-gray-600 text-xs",children:"Remaining:"}),(0,t.jsx)("span",{className:u("font-medium text-right",S.isOverLimit&&"text-red-600",S.isNearLimit&&"text-yellow-600"),children:y.total_teams_remaining})]}),(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsx)("span",{className:"text-gray-600 text-xs",children:"Usage:"}),(0,t.jsxs)("span",{className:"font-medium text-right",children:[Math.round(S.usagePercentage),"%"]})]}),(0,t.jsx)("div",{className:"w-full bg-gray-200 rounded-full h-2",children:(0,t.jsx)("div",{className:u("h-2 rounded-full transition-all duration-300",S.isOverLimit&&"bg-red-500",S.isNearLimit&&"bg-yellow-500",!S.isOverLimit&&!S.isNearLimit&&"bg-green-500"),style:{width:`${Math.min(S.usagePercentage,100)}%`}})})]})]})]}),{})})}e.s(["default",()=>f])},582458,e=>{"use strict";let t=(0,e.i(475254).default)("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"}]]);e.s(["default",()=>t])},19732,e=>{"use strict";e.i(247167);var t=e.i(931067),a=e.i(271645);let r={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"};var i=e.i(9583),s=a.forwardRef(function(e,s){return a.createElement(i.default,(0,t.default)({},e,{ref:s,icon:r}))});e.s(["ExperimentOutlined",0,s],19732)},218129,e=>{"use strict";e.i(247167);var t=e.i(931067),a=e.i(271645);let r={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M917.7 148.8l-42.4-42.4c-1.6-1.6-3.6-2.3-5.7-2.3s-4.1.8-5.7 2.3l-76.1 76.1a199.27 199.27 0 00-112.1-34.3c-51.2 0-102.4 19.5-141.5 58.6L432.3 308.7a8.03 8.03 0 000 11.3L704 591.7c1.6 1.6 3.6 2.3 5.7 2.3 2 0 4.1-.8 5.7-2.3l101.9-101.9c68.9-69 77-175.7 24.3-253.5l76.1-76.1c3.1-3.2 3.1-8.3 0-11.4zM769.1 441.7l-59.4 59.4-186.8-186.8 59.4-59.4c24.9-24.9 58.1-38.7 93.4-38.7 35.3 0 68.4 13.7 93.4 38.7 24.9 24.9 38.7 58.1 38.7 93.4 0 35.3-13.8 68.4-38.7 93.4zm-190.2 105a8.03 8.03 0 00-11.3 0L501 613.3 410.7 523l66.7-66.7c3.1-3.1 3.1-8.2 0-11.3L441 408.6a8.03 8.03 0 00-11.3 0L363 475.3l-43-43a7.85 7.85 0 00-5.7-2.3c-2 0-4.1.8-5.7 2.3L206.8 534.2c-68.9 69-77 175.7-24.3 253.5l-76.1 76.1a8.03 8.03 0 000 11.3l42.4 42.4c1.6 1.6 3.6 2.3 5.7 2.3s4.1-.8 5.7-2.3l76.1-76.1c33.7 22.9 72.9 34.3 112.1 34.3 51.2 0 102.4-19.5 141.5-58.6l101.9-101.9c3.1-3.1 3.1-8.2 0-11.3l-43-43 66.7-66.7c3.1-3.1 3.1-8.2 0-11.3l-36.6-36.2zM441.7 769.1a131.32 131.32 0 01-93.4 38.7c-35.3 0-68.4-13.7-93.4-38.7a131.32 131.32 0 01-38.7-93.4c0-35.3 13.7-68.4 38.7-93.4l59.4-59.4 186.8 186.8-59.4 59.4z"}}]},name:"api",theme:"outlined"};var i=e.i(9583),s=a.forwardRef(function(e,s){return a.createElement(i.default,(0,t.default)({},e,{ref:s,icon:r}))});e.s(["ApiOutlined",0,s],218129)},210612,e=>{"use strict";e.i(247167);var t=e.i(931067),a=e.i(271645);let r={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M832 64H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V96c0-17.7-14.3-32-32-32zm-600 72h560v208H232V136zm560 480H232V408h560v208zm0 272H232V680h560v208zM304 240a40 40 0 1080 0 40 40 0 10-80 0zm0 272a40 40 0 1080 0 40 40 0 10-80 0zm0 272a40 40 0 1080 0 40 40 0 10-80 0z"}}]},name:"database",theme:"outlined"};var i=e.i(9583),s=a.forwardRef(function(e,s){return a.createElement(i.default,(0,t.default)({},e,{ref:s,icon:r}))});e.s(["DatabaseOutlined",0,s],210612)},313603,e=>{"use strict";e.i(247167);var t=e.i(931067),a=e.i(271645);let r={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M924.8 625.7l-65.5-56c3.1-19 4.7-38.4 4.7-57.8s-1.6-38.8-4.7-57.8l65.5-56a32.03 32.03 0 009.3-35.2l-.9-2.6a443.74 443.74 0 00-79.7-137.9l-1.8-2.1a32.12 32.12 0 00-35.1-9.5l-81.3 28.9c-30-24.6-63.5-44-99.7-57.6l-15.7-85a32.05 32.05 0 00-25.8-25.7l-2.7-.5c-52.1-9.4-106.9-9.4-159 0l-2.7.5a32.05 32.05 0 00-25.8 25.7l-15.8 85.4a351.86 351.86 0 00-99 57.4l-81.9-29.1a32 32 0 00-35.1 9.5l-1.8 2.1a446.02 446.02 0 00-79.7 137.9l-.9 2.6c-4.5 12.5-.8 26.5 9.3 35.2l66.3 56.6c-3.1 18.8-4.6 38-4.6 57.1 0 19.2 1.5 38.4 4.6 57.1L99 625.5a32.03 32.03 0 00-9.3 35.2l.9 2.6c18.1 50.4 44.9 96.9 79.7 137.9l1.8 2.1a32.12 32.12 0 0035.1 9.5l81.9-29.1c29.8 24.5 63.1 43.9 99 57.4l15.8 85.4a32.05 32.05 0 0025.8 25.7l2.7.5a449.4 449.4 0 00159 0l2.7-.5a32.05 32.05 0 0025.8-25.7l15.7-85a350 350 0 0099.7-57.6l81.3 28.9a32 32 0 0035.1-9.5l1.8-2.1c34.8-41.1 61.6-87.5 79.7-137.9l.9-2.6c4.5-12.3.8-26.3-9.3-35zM788.3 465.9c2.5 15.1 3.8 30.6 3.8 46.1s-1.3 31-3.8 46.1l-6.6 40.1 74.7 63.9a370.03 370.03 0 01-42.6 73.6L721 702.8l-31.4 25.8c-23.9 19.6-50.5 35-79.3 45.8l-38.1 14.3-17.9 97a377.5 377.5 0 01-85 0l-17.9-97.2-37.8-14.5c-28.5-10.8-55-26.2-78.7-45.7l-31.4-25.9-93.4 33.2c-17-22.9-31.2-47.6-42.6-73.6l75.5-64.5-6.5-40c-2.4-14.9-3.7-30.3-3.7-45.5 0-15.3 1.2-30.6 3.7-45.5l6.5-40-75.5-64.5c11.3-26.1 25.6-50.7 42.6-73.6l93.4 33.2 31.4-25.9c23.7-19.5 50.2-34.9 78.7-45.7l37.9-14.3 17.9-97.2c28.1-3.2 56.8-3.2 85 0l17.9 97 38.1 14.3c28.7 10.8 55.4 26.2 79.3 45.8l31.4 25.8 92.8-32.9c17 22.9 31.2 47.6 42.6 73.6L781.8 426l6.5 39.9zM512 326c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm79.2 255.2A111.6 111.6 0 01512 614c-29.9 0-58-11.7-79.2-32.8A111.6 111.6 0 01400 502c0-29.9 11.7-58 32.8-79.2C454 401.6 482.1 390 512 390c29.9 0 58 11.6 79.2 32.8A111.6 111.6 0 01624 502c0 29.9-11.7 58-32.8 79.2z"}}]},name:"setting",theme:"outlined"};var i=e.i(9583),s=a.forwardRef(function(e,s){return a.createElement(i.default,(0,t.default)({},e,{ref:s,icon:r}))});e.s(["SettingOutlined",0,s],313603)},232164,e=>{"use strict";e.i(247167);var t=e.i(931067),a=e.i(271645);let r={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M483.2 790.3L861.4 412c1.7-1.7 2.5-4 2.3-6.3l-25.5-301.4c-.7-7.8-6.8-13.9-14.6-14.6L522.2 64.3c-2.3-.2-4.7.6-6.3 2.3L137.7 444.8a8.03 8.03 0 000 11.3l334.2 334.2c3.1 3.2 8.2 3.2 11.3 0zm62.6-651.7l224.6 19 19 224.6L477.5 694 233.9 450.5l311.9-311.9zm60.16 186.23a48 48 0 1067.88-67.89 48 48 0 10-67.88 67.89zM889.7 539.8l-39.6-39.5a8.03 8.03 0 00-11.3 0l-362 361.3-237.6-237a8.03 8.03 0 00-11.3 0l-39.6 39.5a8.03 8.03 0 000 11.3l243.2 242.8 39.6 39.5c3.1 3.1 8.2 3.1 11.3 0l407.3-406.6c3.1-3.1 3.1-8.2 0-11.3z"}}]},name:"tags",theme:"outlined"};var i=e.i(9583),s=a.forwardRef(function(e,s){return a.createElement(i.default,(0,t.default)({},e,{ref:s,icon:r}))});e.s(["TagsOutlined",0,s],232164)},366308,e=>{"use strict";e.i(247167);var t=e.i(931067),a=e.i(271645);let r={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M876.6 239.5c-.5-.9-1.2-1.8-2-2.5-5-5-13.1-5-18.1 0L684.2 409.3l-67.9-67.9L788.7 169c.8-.8 1.4-1.6 2-2.5 3.6-6.1 1.6-13.9-4.5-17.5-98.2-58-226.8-44.7-311.3 39.7-67 67-89.2 162-66.5 247.4l-293 293c-3 3-2.8 7.9.3 11l169.7 169.7c3.1 3.1 8.1 3.3 11 .3l292.9-292.9c85.5 22.8 180.5.7 247.6-66.4 84.4-84.5 97.7-213.1 39.7-311.3zM786 499.8c-58.1 58.1-145.3 69.3-214.6 33.6l-8.8 8.8-.1-.1-274 274.1-79.2-79.2 230.1-230.1s0 .1.1.1l52.8-52.8c-35.7-69.3-24.5-156.5 33.6-214.6a184.2 184.2 0 01144-53.5L537 318.9a32.05 32.05 0 000 45.3l124.5 124.5a32.05 32.05 0 0045.3 0l132.8-132.8c3.7 51.8-14.4 104.8-53.6 143.9z"}}]},name:"tool",theme:"outlined"};var i=e.i(9583),s=a.forwardRef(function(e,s){return a.createElement(i.default,(0,t.default)({},e,{ref:s,icon:r}))});e.s(["ToolOutlined",0,s],366308)},438957,e=>{"use strict";e.i(247167);var t=e.i(931067),a=e.i(271645);let r={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M608 112c-167.9 0-304 136.1-304 304 0 70.3 23.9 135 63.9 186.5l-41.1 41.1-62.3-62.3a8.15 8.15 0 00-11.4 0l-39.8 39.8a8.15 8.15 0 000 11.4l62.3 62.3-44.9 44.9-62.3-62.3a8.15 8.15 0 00-11.4 0l-39.8 39.8a8.15 8.15 0 000 11.4l62.3 62.3-65.3 65.3a8.03 8.03 0 000 11.3l42.3 42.3c3.1 3.1 8.2 3.1 11.3 0l253.6-253.6A304.06 304.06 0 00608 720c167.9 0 304-136.1 304-304S775.9 112 608 112zm161.2 465.2C726.2 620.3 668.9 644 608 644c-60.9 0-118.2-23.7-161.2-66.8-43.1-43-66.8-100.3-66.8-161.2 0-60.9 23.7-118.2 66.8-161.2 43-43.1 100.3-66.8 161.2-66.8 60.9 0 118.2 23.7 161.2 66.8 43.1 43 66.8 100.3 66.8 161.2 0 60.9-23.7 118.2-66.8 161.2z"}}]},name:"key",theme:"outlined"};var i=e.i(9583),s=a.forwardRef(function(e,s){return a.createElement(i.default,(0,t.default)({},e,{ref:s,icon:r}))});e.s(["KeyOutlined",0,s],438957)},878894,664659,531278,e=>{"use strict";var t=e.i(582458);e.s(["AlertTriangle",()=>t.default],878894);var a=e.i(475254);let r=(0,a.default)("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);e.s(["ChevronDown",()=>r],664659);let i=(0,a.default)("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);e.s(["Loader2",()=>i],531278)},645526,e=>{"use strict";e.i(247167);var t=e.i(931067),a=e.i(271645);let r={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M824.2 699.9a301.55 301.55 0 00-86.4-60.4C783.1 602.8 812 546.8 812 484c0-110.8-92.4-201.7-203.2-200-109.1 1.7-197 90.6-197 200 0 62.8 29 118.8 74.2 155.5a300.95 300.95 0 00-86.4 60.4C345 754.6 314 826.8 312 903.8a8 8 0 008 8.2h56c4.3 0 7.9-3.4 8-7.7 1.9-58 25.4-112.3 66.7-153.5A226.62 226.62 0 01612 684c60.9 0 118.2 23.7 161.3 66.8C814.5 792 838 846.3 840 904.3c.1 4.3 3.7 7.7 8 7.7h56a8 8 0 008-8.2c-2-77-33-149.2-87.8-203.9zM612 612c-34.2 0-66.4-13.3-90.5-37.5a126.86 126.86 0 01-37.5-91.8c.3-32.8 13.4-64.5 36.3-88 24-24.6 56.1-38.3 90.4-38.7 33.9-.3 66.8 12.9 91 36.6 24.8 24.3 38.4 56.8 38.4 91.4 0 34.2-13.3 66.3-37.5 90.5A127.3 127.3 0 01612 612zM361.5 510.4c-.9-8.7-1.4-17.5-1.4-26.4 0-15.9 1.5-31.4 4.3-46.5.7-3.6-1.2-7.3-4.5-8.8-13.6-6.1-26.1-14.5-36.9-25.1a127.54 127.54 0 01-38.7-95.4c.9-32.1 13.8-62.6 36.3-85.6 24.7-25.3 57.9-39.1 93.2-38.7 31.9.3 62.7 12.6 86 34.4 7.9 7.4 14.7 15.6 20.4 24.4 2 3.1 5.9 4.4 9.3 3.2 17.6-6.1 36.2-10.4 55.3-12.4 5.6-.6 8.8-6.6 6.3-11.6-32.5-64.3-98.9-108.7-175.7-109.9-110.9-1.7-203.3 89.2-203.3 199.9 0 62.8 28.9 118.8 74.2 155.5-31.8 14.7-61.1 35-86.5 60.4-54.8 54.7-85.8 126.9-87.8 204a8 8 0 008 8.2h56.1c4.3 0 7.9-3.4 8-7.7 1.9-58 25.4-112.3 66.7-153.5 29.4-29.4 65.4-49.8 104.7-59.7 3.9-1 6.5-4.7 6-8.7z"}}]},name:"team",theme:"outlined"};var i=e.i(9583),s=a.forwardRef(function(e,s){return a.createElement(i.default,(0,t.default)({},e,{ref:s,icon:r}))});e.s(["TeamOutlined",0,s],645526)},560445,e=>{"use strict";e.i(247167);var t=e.i(271645),a=e.i(201072),r=e.i(726289),i=e.i(864517),s=e.i(562901),l=e.i(779573),n=e.i(343794),c=e.i(361275),o=e.i(244009),d=e.i(611935),m=e.i(763731),u=e.i(242064);e.i(296059);var f=e.i(915654),g=e.i(183293),h=e.i(246422);let p=(e,t,a,r,i)=>({background:e,border:`${(0,f.unit)(r.lineWidth)} ${r.lineType} ${t}`,[`${i}-icon`]:{color:a}}),x=(0,h.genStyleHooks)("Alert",e=>[(e=>{let{componentCls:t,motionDurationSlow:a,marginXS:r,marginSM:i,fontSize:s,fontSizeLG:l,lineHeight:n,borderRadiusLG:c,motionEaseInOutCirc:o,withDescriptionIconSize:d,colorText:m,colorTextHeading:u,withDescriptionPadding:f,defaultPadding:h}=e;return{[t]:Object.assign(Object.assign({},(0,g.resetComponent)(e)),{position:"relative",display:"flex",alignItems:"center",padding:h,wordWrap:"break-word",borderRadius:c,[`&${t}-rtl`]:{direction:"rtl"},[`${t}-content`]:{flex:1,minWidth:0},[`${t}-icon`]:{marginInlineEnd:r,lineHeight:0},"&-description":{display:"none",fontSize:s,lineHeight:n},"&-message":{color:u},[`&${t}-motion-leave`]:{overflow:"hidden",opacity:1,transition:`max-height ${a} ${o}, opacity ${a} ${o}, - padding-top ${a} ${o}, padding-bottom ${a} ${o}, - margin-bottom ${a} ${o}`},[`&${t}-motion-leave-active`]:{maxHeight:0,marginBottom:"0 !important",paddingTop:0,paddingBottom:0,opacity:0}}),[`${t}-with-description`]:{alignItems:"flex-start",padding:f,[`${t}-icon`]:{marginInlineEnd:i,fontSize:d,lineHeight:0},[`${t}-message`]:{display:"block",marginBottom:r,color:u,fontSize:l},[`${t}-description`]:{display:"block",color:m}},[`${t}-banner`]:{marginBottom:0,border:"0 !important",borderRadius:0}}})(e),(e=>{let{componentCls:t,colorSuccess:a,colorSuccessBorder:r,colorSuccessBg:i,colorWarning:s,colorWarningBorder:l,colorWarningBg:n,colorError:c,colorErrorBorder:o,colorErrorBg:d,colorInfo:m,colorInfoBorder:u,colorInfoBg:f}=e;return{[t]:{"&-success":p(i,r,a,e,t),"&-info":p(f,u,m,e,t),"&-warning":p(n,l,s,e,t),"&-error":Object.assign(Object.assign({},p(d,o,c,e,t)),{[`${t}-description > pre`]:{margin:0,padding:0}})}}})(e),(e=>{let{componentCls:t,iconCls:a,motionDurationMid:r,marginXS:i,fontSizeIcon:s,colorIcon:l,colorIconHover:n}=e;return{[t]:{"&-action":{marginInlineStart:i},[`${t}-close-icon`]:{marginInlineStart:i,padding:0,overflow:"hidden",fontSize:s,lineHeight:(0,f.unit)(s),backgroundColor:"transparent",border:"none",outline:"none",cursor:"pointer",[`${a}-close`]:{color:l,transition:`color ${r}`,"&:hover":{color:n}}},"&-close-text":{color:l,transition:`color ${r}`,"&:hover":{color:n}}}}})(e)],e=>({withDescriptionIconSize:e.fontSizeHeading3,defaultPadding:`${e.paddingContentVerticalSM}px 12px`,withDescriptionPadding:`${e.paddingMD}px ${e.paddingContentHorizontalLG}px`}));var v=function(e,t){var a={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(a[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(e);it.indexOf(r[i])&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(a[r[i]]=e[r[i]]);return a};let y={success:a.default,info:l.default,error:r.default,warning:s.default},b=e=>{let{icon:a,prefixCls:r,type:i}=e,s=y[i]||null;return a?(0,m.replaceElement)(a,t.createElement("span",{className:`${r}-icon`},a),()=>({className:(0,n.default)(`${r}-icon`,a.props.className)})):t.createElement(s,{className:`${r}-icon`})},w=e=>{let{isClosable:a,prefixCls:r,closeIcon:s,handleClose:l,ariaProps:n}=e,c=!0===s||void 0===s?t.createElement(i.default,null):s;return a?t.createElement("button",Object.assign({type:"button",onClick:l,className:`${r}-close-icon`,tabIndex:0},n),c):null},N=t.forwardRef((e,a)=>{let{description:r,prefixCls:i,message:s,banner:l,className:m,rootClassName:f,style:g,onMouseEnter:h,onMouseLeave:p,onClick:y,afterClose:N,showIcon:j,closable:z,closeText:L,closeIcon:M,action:O,id:C}=e,k=v(e,["description","prefixCls","message","banner","className","rootClassName","style","onMouseEnter","onMouseLeave","onClick","afterClose","showIcon","closable","closeText","closeIcon","action","id"]),[$,E]=t.useState(!1),H=t.useRef(null);t.useImperativeHandle(a,()=>({nativeElement:H.current}));let{getPrefixCls:_,direction:S,closable:V,closeIcon:R,className:T,style:P}=(0,u.useComponentConfig)("alert"),B=_("alert",i),[A,I,U]=x(B),D=t=>{var a;E(!0),null==(a=e.onClose)||a.call(e,t)},F=t.useMemo(()=>void 0!==e.type?e.type:l?"warning":"info",[e.type,l]),X=t.useMemo(()=>"object"==typeof z&&!!z.closeIcon||!!L||("boolean"==typeof z?z:!1!==M&&null!=M||!!V),[L,M,z,V]),K=!!l&&void 0===j||j,Y=(0,n.default)(B,`${B}-${F}`,{[`${B}-with-description`]:!!r,[`${B}-no-icon`]:!K,[`${B}-banner`]:!!l,[`${B}-rtl`]:"rtl"===S},T,m,f,U,I),q=(0,o.default)(k,{aria:!0,data:!0}),W=t.useMemo(()=>"object"==typeof z&&z.closeIcon?z.closeIcon:L||(void 0!==M?M:"object"==typeof V&&V.closeIcon?V.closeIcon:R),[M,z,V,L,R]),G=t.useMemo(()=>{let e=null!=z?z:V;if("object"==typeof e){let{closeIcon:t}=e;return v(e,["closeIcon"])}return{}},[z,V]);return A(t.createElement(c.default,{visible:!$,motionName:`${B}-motion`,motionAppear:!1,motionEnter:!1,onLeaveStart:e=>({maxHeight:e.offsetHeight}),onLeaveEnd:N},({className:a,style:i},l)=>t.createElement("div",Object.assign({id:C,ref:(0,d.composeRef)(H,l),"data-show":!$,className:(0,n.default)(Y,a),style:Object.assign(Object.assign(Object.assign({},P),g),i),onMouseEnter:h,onMouseLeave:p,onClick:y,role:"alert"},q),K?t.createElement(b,{description:r,icon:e.icon,prefixCls:B,type:F}):null,t.createElement("div",{className:`${B}-content`},s?t.createElement("div",{className:`${B}-message`},s):null,r?t.createElement("div",{className:`${B}-description`},r):null),O?t.createElement("div",{className:`${B}-action`},O):null,t.createElement(w,{isClosable:X,prefixCls:B,closeIcon:W,handleClose:D,ariaProps:G}))))});var j=e.i(278409),z=e.i(233848),L=e.i(487806),M=e.i(479671),O=e.i(480002),C=e.i(868917);let k=function(e){function a(){var e,t,r;return(0,j.default)(this,a),t=a,r=arguments,t=(0,L.default)(t),(e=(0,O.default)(this,(0,M.default)()?Reflect.construct(t,r||[],(0,L.default)(this).constructor):t.apply(this,r))).state={error:void 0,info:{componentStack:""}},e}return(0,C.default)(a,e),(0,z.default)(a,[{key:"componentDidCatch",value:function(e,t){this.setState({error:e,info:t})}},{key:"render",value:function(){let{message:e,description:a,id:r,children:i}=this.props,{error:s,info:l}=this.state,n=(null==l?void 0:l.componentStack)||null,c=void 0===e?(s||"").toString():e;return s?t.createElement(N,{id:r,type:"error",message:c,description:t.createElement("pre",{style:{fontSize:"0.9em",overflowX:"auto"}},void 0===a?n:a)}):i}}])}(t.Component);N.ErrorBoundary=k,e.s(["Alert",0,N],560445)},389083,e=>{"use strict";var t=e.i(290571),a=e.i(271645),r=e.i(829087),i=e.i(480731),s=e.i(95779),l=e.i(444755),n=e.i(673706);let c={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"}},o={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"}},d=(0,n.makeClassName)("Badge"),m=a.default.forwardRef((e,m)=>{let{color:u,icon:f,size:g=i.Sizes.SM,tooltip:h,className:p,children:x}=e,v=(0,t.__rest)(e,["color","icon","size","tooltip","className","children"]),y=f||null,{tooltipProps:b,getReferenceProps:w}=(0,r.useTooltip)();return a.default.createElement("span",Object.assign({ref:(0,n.mergeRefs)([m,b.refs.setReference]),className:(0,l.tremorTwMerge)(d("root"),"w-max shrink-0 inline-flex justify-center items-center cursor-default rounded-tremor-small ring-1 ring-inset",u?(0,l.tremorTwMerge)((0,n.getColorClassNames)(u,s.colorPalette.background).bgColor,(0,n.getColorClassNames)(u,s.colorPalette.iconText).textColor,(0,n.getColorClassNames)(u,s.colorPalette.iconRing).ringColor,"bg-opacity-10 ring-opacity-20","dark:bg-opacity-5 dark:ring-opacity-60"):(0,l.tremorTwMerge)("bg-tremor-brand-faint text-tremor-brand-emphasis ring-tremor-brand/20","dark:bg-dark-tremor-brand-muted/50 dark:text-dark-tremor-brand dark:ring-dark-tremor-subtle/20"),c[g].paddingX,c[g].paddingY,c[g].fontSize,p)},w,v),a.default.createElement(r.default,Object.assign({text:h},b)),y?a.default.createElement(y,{className:(0,l.tremorTwMerge)(d("icon"),"shrink-0 -ml-1 mr-1.5",o[g].height,o[g].width)}):null,a.default.createElement("span",{className:(0,l.tremorTwMerge)(d("text"),"whitespace-nowrap")},x))});m.displayName="Badge",e.s(["Badge",()=>m],389083)},708347,e=>{"use strict";let t=["Admin","Admin Viewer","proxy_admin","proxy_admin_viewer","org_admin"],a=(e,t)=>null!=e&&e.some(e=>e.user_id===t&&"admin"===e.role);e.s(["all_admin_roles",0,t,"internalUserRoles",0,["Internal User","Internal Viewer"],"isAdminRole",0,e=>t.includes(e),"isProxyAdminRole",0,e=>"proxy_admin"===e||"Admin"===e,"isUserTeamAdminForAnyTeam",0,(e,t)=>null!=e&&e.some(e=>a(e.members_with_roles,t)),"isUserTeamAdminForSingleTeam",0,a,"rolesWithWriteAccess",0,["Internal User","Admin","proxy_admin"]])},993914,e=>{"use strict";e.i(247167);var t=e.i(931067),a=e.i(271645);let r={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494zM504 618H320c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8zM312 490v48c0 4.4 3.6 8 8 8h384c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H320c-4.4 0-8 3.6-8 8z"}}]},name:"file-text",theme:"outlined"};var i=e.i(9583),s=a.forwardRef(function(e,s){return a.createElement(i.default,(0,t.default)({},e,{ref:s,icon:r}))});e.s(["FileTextOutlined",0,s],993914)},153702,e=>{"use strict";e.i(247167);var t=e.i(931067),a=e.i(271645);let r={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"};var i=e.i(9583),s=a.forwardRef(function(e,s){return a.createElement(i.default,(0,t.default)({},e,{ref:s,icon:r}))});e.s(["BarChartOutlined",0,s],153702)},299251,e=>{"use strict";e.i(247167);var t=e.i(931067),a=e.i(271645);let r={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"};var i=e.i(9583),s=a.forwardRef(function(e,s){return a.createElement(i.default,(0,t.default)({},e,{ref:s,icon:r}))});e.s(["BankOutlined",0,s],299251)},777579,e=>{"use strict";e.i(247167);var t=e.i(931067),a=e.i(271645);let r={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"};var i=e.i(9583),s=a.forwardRef(function(e,s){return a.createElement(i.default,(0,t.default)({},e,{ref:s,icon:r}))});e.s(["LineChartOutlined",0,s],777579)}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/1a87dd202db8e85d.js b/litellm/proxy/_experimental/out/_next/static/chunks/1a87dd202db8e85d.js new file mode 100644 index 00000000000..26999d732c0 --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/1a87dd202db8e85d.js @@ -0,0 +1 @@ +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,355619,e=>{"use strict";var s=e.i(764205);let t=async(e,t,l)=>{try{if(null===e||null===t)return;if(null!==l){let a=(await (0,s.modelAvailableCall)(l,e,t,!0,null,!0)).data.map(e=>e.id),r=[],i=[];return a.forEach(e=>{e.endsWith("/*")?r.push(e):i.push(e)}),[...r,...i]}}catch(e){console.error("Error fetching user models:",e)}};e.s(["fetchAvailableModelsForTeamOrKey",0,t,"getModelDisplayName",0,e=>{if("all-proxy-models"===e)return"All Proxy Models";if(e.endsWith("/*")){let s=e.replace("/*","");return`All ${s} models`}return e},"unfurlWildcardModelsInList",0,(e,s)=>{let t=[],l=[];return console.log("teamModels",e),console.log("allModels",s),e.forEach(e=>{if(e.endsWith("/*")){let a=e.replace("/*",""),r=s.filter(e=>e.startsWith(a+"/"));l.push(...r),t.push(e)}else l.push(e)}),[...t,...l].filter((e,s,t)=>t.indexOf(e)===s)}])},860585,e=>{"use strict";var s=e.i(843476),t=e.i(199133);let{Option:l}=t.Select;e.s(["default",0,({value:e,onChange:a,className:r="",style:i={}})=>(0,s.jsxs)(t.Select,{style:{width:"100%",...i},value:e||void 0,onChange:a,className:r,placeholder:"n/a",allowClear:!0,children:[(0,s.jsx)(l,{value:"24h",children:"daily"}),(0,s.jsx)(l,{value:"7d",children:"weekly"}),(0,s.jsx)(l,{value:"30d",children:"monthly"})]}),"getBudgetDurationLabel",0,e=>e?({"24h":"daily","7d":"weekly","30d":"monthly"})[e]||e:"Not set"])},663435,e=>{"use strict";var s=e.i(843476),t=e.i(199133);e.s(["default",0,({teams:e,value:l,onChange:a,disabled:r,loading:i})=>(0,s.jsx)(t.Select,{showSearch:!0,placeholder:"Search or select a team",value:l,onChange:a,disabled:r,loading:i,allowClear:!0,filterOption:(s,t)=>{if(!t)return!1;let l=e?.find(e=>e.team_id===t.key);if(!l)return!1;let a=s.toLowerCase().trim(),r=(l.team_alias||"").toLowerCase(),i=(l.team_id||"").toLowerCase();return r.includes(a)||i.includes(a)},optionFilterProp:"children",children:e?.map(e=>(0,s.jsxs)(t.Select.Option,{value:e.team_id,children:[(0,s.jsx)("span",{className:"font-medium",children:e.team_alias})," ",(0,s.jsxs)("span",{className:"text-gray-500",children:["(",e.team_id,")"]})]},e.team_id))})])},213205,e=>{"use strict";e.i(247167);var s=e.i(931067),t=e.i(271645);let l={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M678.3 642.4c24.2-13 51.9-20.4 81.4-20.4h.1c3 0 4.4-3.6 2.2-5.6a371.67 371.67 0 00-103.7-65.8c-.4-.2-.8-.3-1.2-.5C719.2 505 759.6 431.7 759.6 349c0-137-110.8-248-247.5-248S264.7 212 264.7 349c0 82.7 40.4 156 102.6 201.1-.4.2-.8.3-1.2.5-44.7 18.9-84.8 46-119.3 80.6a373.42 373.42 0 00-80.4 119.5A373.6 373.6 0 00137 888.8a8 8 0 008 8.2h59.9c4.3 0 7.9-3.5 8-7.8 2-77.2 32.9-149.5 87.6-204.3C357 628.2 432.2 597 512.2 597c56.7 0 111.1 15.7 158 45.1a8.1 8.1 0 008.1.3zM512.2 521c-45.8 0-88.9-17.9-121.4-50.4A171.2 171.2 0 01340.5 349c0-45.9 17.9-89.1 50.3-121.6S466.3 177 512.2 177s88.9 17.9 121.4 50.4A171.2 171.2 0 01683.9 349c0 45.9-17.9 89.1-50.3 121.6C601.1 503.1 558 521 512.2 521zM880 759h-84v-84c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v84h-84c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h84v84c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-84h84c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8z"}}]},name:"user-add",theme:"outlined"};var a=e.i(9583),r=t.forwardRef(function(e,r){return t.createElement(a.default,(0,s.default)({},e,{ref:r,icon:l}))});e.s(["UserAddOutlined",0,r],213205)},285027,e=>{"use strict";e.i(247167);var s=e.i(931067),t=e.i(271645);let l={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M464 720a48 48 0 1096 0 48 48 0 10-96 0zm16-304v184c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V416c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8zm475.7 440l-416-720c-6.2-10.7-16.9-16-27.7-16s-21.6 5.3-27.7 16l-416 720C56 877.4 71.4 904 96 904h832c24.6 0 40-26.6 27.7-48zm-783.5-27.9L512 239.9l339.8 588.2H172.2z"}}]},name:"warning",theme:"outlined"};var a=e.i(9583),r=t.forwardRef(function(e,r){return t.createElement(a.default,(0,s.default)({},e,{ref:r,icon:l}))});e.s(["WarningOutlined",0,r],285027)},447082,e=>{"use strict";var s=e.i(843476),t=e.i(271645),l=e.i(994388),a=e.i(599724),r=e.i(212931),i=e.i(291542),n=e.i(515831),d=e.i(898586),o=e.i(519756),c=e.i(737434),m=e.i(285027),u=e.i(993914),x=e.i(955135);e.i(247167);var h=e.i(931067);let f={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494zM472 744a40 40 0 1080 0 40 40 0 10-80 0zm16-104h48c4.4 0 8-3.6 8-8V448c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v184c0 4.4 3.6 8 8 8z"}}]},name:"file-exclamation",theme:"outlined"};var p=e.i(9583),g=t.forwardRef(function(e,s){return t.createElement(p.default,(0,h.default)({},e,{ref:s,icon:f}))}),j=e.i(764205),v=e.i(59935),b=e.i(220508),y=e.i(964306);let w=t.forwardRef(function(e,s){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:s},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"}))});var N=e.i(237016),_=e.i(727749);e.s(["default",0,({accessToken:e,teams:h,possibleUIRoles:f,onUsersCreated:p})=>{let[C,S]=(0,t.useState)(!1),[k,I]=(0,t.useState)([]),[U,T]=(0,t.useState)(!1),[L,V]=(0,t.useState)(null),[B,O]=(0,t.useState)(null),[M,F]=(0,t.useState)(null),[E,P]=(0,t.useState)(null),[R,A]=(0,t.useState)(null),[D,$]=(0,t.useState)("http://localhost:4000");(0,t.useEffect)(()=>{(async()=>{try{let s=await (0,j.getProxyUISettings)(e);A(s)}catch(e){console.error("Error fetching UI settings:",e)}})(),$(new URL("/",window.location.href).toString())},[e]);let z=async()=>{T(!0);let s=k.map(e=>({...e,status:"pending"}));I(s);let t=!1;for(let l=0;le.trim()).filter(Boolean),0===s.teams.length&&delete s.teams),a.models&&"string"==typeof a.models&&""!==a.models.trim()&&(s.models=a.models.split(",").map(e=>e.trim()).filter(Boolean),0===s.models.length&&delete s.models),a.max_budget&&""!==a.max_budget.toString().trim()){let e=parseFloat(a.max_budget.toString());!isNaN(e)&&e>0&&(s.max_budget=e)}a.budget_duration&&""!==a.budget_duration.trim()&&(s.budget_duration=a.budget_duration.trim()),a.metadata&&"string"==typeof a.metadata&&""!==a.metadata.trim()&&(s.metadata=a.metadata.trim()),console.log("Sending user data:",s);let r=await (0,j.userCreateCall)(e,null,s);if(console.log("Full response:",r),r&&(r.key||r.user_id)){t=!0,console.log("Success case triggered");let s=r.data?.user_id||r.user_id;try{if(R?.SSO_ENABLED){let e=new URL("/ui",D).toString();I(s=>s.map((s,t)=>t===l?{...s,status:"success",key:r.key||r.user_id,invitation_link:e}:s))}else{let t=await (0,j.invitationCreateCall)(e,s),a=new URL(`/ui?invitation_id=${t.id}`,D).toString();I(e=>e.map((e,s)=>s===l?{...e,status:"success",key:r.key||r.user_id,invitation_link:a}:e))}}catch(e){console.error("Error creating invitation:",e),I(e=>e.map((e,s)=>s===l?{...e,status:"success",key:r.key||r.user_id,error:"User created but failed to generate invitation link"}:e))}}else{console.log("Error case triggered");let e=r?.error||"Failed to create user";console.log("Error message:",e),I(s=>s.map((s,t)=>t===l?{...s,status:"failed",error:e}:s))}}catch(s){console.error("Caught error:",s);let e=s?.response?.data?.error||s?.message||String(s);I(s=>s.map((s,t)=>t===l?{...s,status:"failed",error:e}:s))}}T(!1),t&&p&&p()},W=[{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,t)=>t.isValid?t.status&&"pending"!==t.status?"success"===t.status?(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center",children:[(0,s.jsx)(b.CheckCircleIcon,{className:"h-5 w-5 text-green-500 mr-2"}),(0,s.jsx)("span",{className:"text-green-500",children:"Success"})]}),t.invitation_link&&(0,s.jsx)("div",{className:"mt-1",children:(0,s.jsxs)("div",{className:"flex items-center",children:[(0,s.jsx)("span",{className:"text-xs text-gray-500 truncate max-w-[150px]",children:t.invitation_link}),(0,s.jsx)(N.CopyToClipboard,{text:t.invitation_link,onCopy:()=>_.default.success("Invitation link copied!"),children:(0,s.jsx)("button",{className:"ml-1 text-blue-500 text-xs hover:text-blue-700",children:"Copy"})})]})})]}):(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center",children:[(0,s.jsx)(y.XCircleIcon,{className:"h-5 w-5 text-red-500 mr-2"}),(0,s.jsx)("span",{className:"text-red-500",children:"Failed"})]}),t.error&&(0,s.jsx)("span",{className:"text-sm text-red-500 ml-7",children:JSON.stringify(t.error)})]}):(0,s.jsx)("span",{className:"text-gray-500",children:"Pending"}):(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center",children:[(0,s.jsx)(y.XCircleIcon,{className:"h-5 w-5 text-red-500 mr-2"}),(0,s.jsx)("span",{className:"text-red-500",children:"Invalid"})]}),t.error&&(0,s.jsx)("span",{className:"text-sm text-red-500 ml-7",children:t.error})]})}];return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(l.Button,{className:"mb-0",onClick:()=>S(!0),children:"+ Bulk Invite Users"}),(0,s.jsx)(r.Modal,{title:"Bulk Invite Users",open:C,width:800,onCancel:()=>S(!1),bodyStyle:{maxHeight:"70vh",overflow:"auto"},footer:null,children:(0,s.jsx)("div",{className:"flex flex-col",children:0===k.length?(0,s.jsxs)("div",{className:"mb-6",children:[(0,s.jsxs)("div",{className:"flex items-center mb-4",children:[(0,s.jsx)("div",{className:"w-8 h-8 rounded-full bg-blue-500 text-white flex items-center justify-center mr-3",children:"1"}),(0,s.jsx)("h3",{className:"text-lg font-medium",children:"Download and fill the template"})]}),(0,s.jsxs)("div",{className:"ml-11 mb-6",children:[(0,s.jsx)("p",{className:"mb-4",children:"Add multiple users at once by following these steps:"}),(0,s.jsxs)("ol",{className:"list-decimal list-inside space-y-2 ml-2 mb-4",children:[(0,s.jsx)("li",{children:"Download our CSV template"}),(0,s.jsx)("li",{children:"Add your users' information to the spreadsheet"}),(0,s.jsx)("li",{children:"Save the file and upload it here"}),(0,s.jsx)("li",{children:"After creation, download the results file containing the Virtual Keys for each user"})]}),(0,s.jsxs)("div",{className:"bg-gray-50 p-4 rounded-md border border-gray-200 mb-4",children:[(0,s.jsx)("h4",{className:"font-medium mb-2",children:"Template Column Names"}),(0,s.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[(0,s.jsxs)("div",{className:"flex items-start",children:[(0,s.jsx)("div",{className:"w-3 h-3 rounded-full bg-red-500 mt-1.5 mr-2 flex-shrink-0"}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"font-medium",children:"user_email"}),(0,s.jsx)("p",{className:"text-sm text-gray-600",children:"User's email address (required)"})]})]}),(0,s.jsxs)("div",{className:"flex items-start",children:[(0,s.jsx)("div",{className:"w-3 h-3 rounded-full bg-red-500 mt-1.5 mr-2 flex-shrink-0"}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"font-medium",children:"user_role"}),(0,s.jsx)("p",{className:"text-sm text-gray-600",children:'User\'s role (one of: "proxy_admin", "proxy_admin_viewer", "internal_user", "internal_user_viewer")'})]})]}),(0,s.jsxs)("div",{className:"flex items-start",children:[(0,s.jsx)("div",{className:"w-3 h-3 rounded-full bg-gray-300 mt-1.5 mr-2 flex-shrink-0"}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"font-medium",children:"teams"}),(0,s.jsx)("p",{className:"text-sm text-gray-600",children:'Comma-separated team IDs (e.g., "team-1,team-2")'})]})]}),(0,s.jsxs)("div",{className:"flex items-start",children:[(0,s.jsx)("div",{className:"w-3 h-3 rounded-full bg-gray-300 mt-1.5 mr-2 flex-shrink-0"}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"font-medium",children:"max_budget"}),(0,s.jsx)("p",{className:"text-sm text-gray-600",children:'Maximum budget as a number (e.g., "100")'})]})]}),(0,s.jsxs)("div",{className:"flex items-start",children:[(0,s.jsx)("div",{className:"w-3 h-3 rounded-full bg-gray-300 mt-1.5 mr-2 flex-shrink-0"}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"font-medium",children:"budget_duration"}),(0,s.jsx)("p",{className:"text-sm text-gray-600",children:'Budget reset period (e.g., "30d", "1mo")'})]})]}),(0,s.jsxs)("div",{className:"flex items-start",children:[(0,s.jsx)("div",{className:"w-3 h-3 rounded-full bg-gray-300 mt-1.5 mr-2 flex-shrink-0"}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"font-medium",children:"models"}),(0,s.jsx)("p",{className:"text-sm text-gray-600",children:'Comma-separated allowed models (e.g., "gpt-3.5-turbo,gpt-4")'})]})]})]})]}),(0,s.jsxs)(l.Button,{onClick:()=>{let e=new Blob([v.default.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,s.jsx)(c.DownloadOutlined,{className:"mr-2"})," Download CSV Template"]})]}),(0,s.jsxs)("div",{className:"flex items-center mb-4",children:[(0,s.jsx)("div",{className:"w-8 h-8 rounded-full bg-blue-500 text-white flex items-center justify-center mr-3",children:"2"}),(0,s.jsx)("h3",{className:"text-lg font-medium",children:"Upload your completed CSV"})]}),(0,s.jsxs)("div",{className:"ml-11",children:[E?(0,s.jsxs)("div",{className:`mb-4 p-4 rounded-md border ${M?"bg-red-50 border-red-200":"bg-blue-50 border-blue-200"}`,children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"flex items-center",children:[M?(0,s.jsx)(g,{className:"text-red-500 text-xl mr-3"}):(0,s.jsx)(u.FileTextOutlined,{className:"text-blue-500 text-xl mr-3"}),(0,s.jsxs)("div",{children:[(0,s.jsx)(d.Typography.Text,{strong:!0,className:M?"text-red-800":"text-blue-800",children:E.name}),(0,s.jsxs)(d.Typography.Text,{className:`block text-xs ${M?"text-red-600":"text-blue-600"}`,children:[(E.size/1024).toFixed(1)," KB • ",new Date().toLocaleDateString()]})]})]}),(0,s.jsxs)(l.Button,{size:"xs",variant:"secondary",onClick:()=>{P(null),I([]),V(null),O(null),F(null)},className:"flex items-center",children:[(0,s.jsx)(x.DeleteOutlined,{className:"mr-1"})," Remove"]})]}),M?(0,s.jsxs)("div",{className:"mt-3 text-red-600 text-sm flex items-start",children:[(0,s.jsx)(m.WarningOutlined,{className:"mr-2 mt-0.5"}),(0,s.jsx)("span",{children:M})]}):!B&&(0,s.jsxs)("div",{className:"mt-3 flex items-center",children:[(0,s.jsx)("div",{className:"w-full bg-gray-200 rounded-full h-1.5",children:(0,s.jsx)("div",{className:"bg-blue-500 h-1.5 rounded-full w-full animate-pulse"})}),(0,s.jsx)("span",{className:"ml-2 text-xs text-blue-600",children:"Processing..."})]})]}):(0,s.jsx)(n.Upload,{beforeUpload:e=>((V(null),O(null),F(null),P(e),"text/csv"===e.type||e.name.endsWith(".csv"))?e.size>5242880?F(`File is too large (${(e.size/1048576).toFixed(1)} MB). Please upload a CSV file smaller than 5MB.`):v.default.parse(e,{complete:e=>{if(!e.data||0===e.data.length){O("The CSV file appears to be empty. Please upload a file with data."),I([]);return}if(1===e.data.length){O("The CSV file only contains headers but no user data. Please add user data to your CSV."),I([]);return}let s=e.data[0];if(0===s.length||1===s.length&&""===s[0]){O("The CSV file doesn't contain any column headers. Please make sure your CSV has headers."),I([]);return}let t=["user_email","user_role"].filter(e=>!s.includes(e));if(t.length>0){O(`Your CSV is missing these required columns: ${t.join(", ")}. Please add these columns to your CSV file.`),I([]);return}try{let t=e.data.slice(1).map((e,t)=>{if(0===e.length||1===e.length&&""===e[0])return null;if(e.length=parseFloat(l.max_budget.toString())&&a.push("Max budget must be greater than 0")),l.budget_duration&&!l.budget_duration.match(/^\d+[dhmwy]$|^\d+mo$/)&&a.push(`Invalid budget duration format "${l.budget_duration}". Use format like "30d", "1mo", "2w", "6h"`),l.teams&&"string"==typeof l.teams&&h&&h.length>0){let e=h.map(e=>e.team_id),s=l.teams.split(",").map(e=>e.trim()).filter(s=>!e.includes(s));s.length>0&&a.push(`Unknown team(s): ${s.join(", ")}`)}return a.length>0&&(l.isValid=!1,l.error=a.join(", ")),l}).filter(Boolean),l=t.filter(e=>e.isValid);I(t),0===t.length?O("No valid data rows found in the CSV file. Please check your file format."):0===l.length?V("No valid users found in the CSV. Please check the errors below and fix your CSV file."):l.length{V(`Failed to parse CSV file: ${e.message}`),I([])},header:!1}):(F(`Invalid file type: ${e.name}. Please upload a CSV file (.csv extension).`),_.default.fromBackend("Invalid file type. Please upload a CSV file.")),!1),accept:".csv",maxCount:1,showUploadList:!1,children:(0,s.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,s.jsx)(o.UploadOutlined,{className:"text-3xl text-gray-400 mb-2"}),(0,s.jsx)("p",{className:"mb-1",children:"Drag and drop your CSV file here"}),(0,s.jsx)("p",{className:"text-sm text-gray-500 mb-3",children:"or"}),(0,s.jsx)(l.Button,{size:"sm",children:"Browse files"}),(0,s.jsx)("p",{className:"text-xs text-gray-500 mt-4",children:"Only CSV files (.csv) are supported"})]})}),B&&(0,s.jsx)("div",{className:"mb-4 p-4 bg-yellow-50 border border-yellow-200 rounded-md",children:(0,s.jsxs)("div",{className:"flex items-start",children:[(0,s.jsx)(w,{className:"h-5 w-5 text-yellow-500 mr-2 mt-0.5"}),(0,s.jsxs)("div",{children:[(0,s.jsx)(d.Typography.Text,{strong:!0,className:"text-yellow-800",children:"CSV Structure Error"}),(0,s.jsx)(d.Typography.Paragraph,{className:"text-yellow-700 mt-1 mb-0",children:B}),(0,s.jsx)(d.Typography.Paragraph,{className:"text-yellow-700 mt-2 mb-0",children:"Please download our template and ensure your CSV follows the required format."})]})]})})]})]}):(0,s.jsxs)("div",{className:"mb-6",children:[(0,s.jsxs)("div",{className:"flex items-center mb-4",children:[(0,s.jsx)("div",{className:"w-8 h-8 rounded-full bg-blue-500 text-white flex items-center justify-center mr-3",children:"3"}),(0,s.jsx)("h3",{className:"text-lg font-medium",children:k.some(e=>"success"===e.status||"failed"===e.status)?"User Creation Results":"Review and create users"})]}),L&&(0,s.jsx)("div",{className:"ml-11 mb-4 p-4 bg-red-50 border border-red-200 rounded-md",children:(0,s.jsxs)("div",{className:"flex items-start",children:[(0,s.jsx)(m.WarningOutlined,{className:"text-red-500 mr-2 mt-1"}),(0,s.jsxs)("div",{children:[(0,s.jsx)(a.Text,{className:"text-red-600 font-medium",children:L}),k.some(e=>!e.isValid)&&(0,s.jsxs)("ul",{className:"mt-2 list-disc list-inside text-red-600 text-sm",children:[(0,s.jsx)("li",{children:"Check the table below for specific errors in each row"}),(0,s.jsx)("li",{children:"Common issues include invalid email formats, missing required fields, or incorrect role values"}),(0,s.jsx)("li",{children:"Fix these issues in your CSV file and upload again"})]})]})]})}),(0,s.jsxs)("div",{className:"ml-11",children:[(0,s.jsxs)("div",{className:"flex justify-between items-center mb-3",children:[(0,s.jsx)("div",{className:"flex items-center",children:k.some(e=>"success"===e.status||"failed"===e.status)?(0,s.jsxs)("div",{className:"flex items-center",children:[(0,s.jsx)(a.Text,{className:"text-lg font-medium mr-3",children:"Creation Summary"}),(0,s.jsxs)(a.Text,{className:"text-sm bg-green-100 text-green-800 px-2 py-1 rounded mr-2",children:[k.filter(e=>"success"===e.status).length," Successful"]}),k.some(e=>"failed"===e.status)&&(0,s.jsxs)(a.Text,{className:"text-sm bg-red-100 text-red-800 px-2 py-1 rounded",children:[k.filter(e=>"failed"===e.status).length," Failed"]})]}):(0,s.jsxs)("div",{className:"flex items-center",children:[(0,s.jsx)(a.Text,{className:"text-lg font-medium mr-3",children:"User Preview"}),(0,s.jsxs)(a.Text,{className:"text-sm bg-blue-100 text-blue-800 px-2 py-1 rounded",children:[k.filter(e=>e.isValid).length," of ",k.length," users valid"]})]})}),!k.some(e=>"success"===e.status||"failed"===e.status)&&(0,s.jsxs)("div",{className:"flex space-x-3",children:[(0,s.jsx)(l.Button,{onClick:()=>{I([]),V(null)},variant:"secondary",children:"Back"}),(0,s.jsx)(l.Button,{onClick:z,disabled:0===k.filter(e=>e.isValid).length||U,children:U?"Creating...":`Create ${k.filter(e=>e.isValid).length} Users`})]})]}),k.some(e=>"success"===e.status)&&(0,s.jsx)("div",{className:"mb-4 p-4 bg-blue-50 border border-blue-200 rounded-md",children:(0,s.jsxs)("div",{className:"flex items-start",children:[(0,s.jsx)("div",{className:"mr-3 mt-1",children:(0,s.jsx)(b.CheckCircleIcon,{className:"h-5 w-5 text-blue-500"})}),(0,s.jsxs)("div",{children:[(0,s.jsx)(a.Text,{className:"font-medium text-blue-800",children:"User creation complete"}),(0,s.jsxs)(a.Text,{className:"block text-sm text-blue-700 mt-1",children:[(0,s.jsx)("span",{className:"font-medium",children:"Next step:"})," Download the credentials file containing Virtual Keys and invitation links. Users will need these Virtual Keys to make LLM requests through LiteLLM."]})]})]})}),(0,s.jsx)(i.Table,{dataSource:k,columns:W,size:"small",pagination:{pageSize:5},scroll:{y:300},rowClassName:e=>e.isValid?"":"bg-red-50"}),!k.some(e=>"success"===e.status||"failed"===e.status)&&(0,s.jsxs)("div",{className:"flex justify-end mt-4",children:[(0,s.jsx)(l.Button,{onClick:()=>{I([]),V(null)},variant:"secondary",className:"mr-3",children:"Back"}),(0,s.jsx)(l.Button,{onClick:z,disabled:0===k.filter(e=>e.isValid).length||U,children:U?"Creating...":`Create ${k.filter(e=>e.isValid).length} Users`})]}),k.some(e=>"success"===e.status||"failed"===e.status)&&(0,s.jsxs)("div",{className:"flex justify-end mt-4",children:[(0,s.jsx)(l.Button,{onClick:()=>{I([]),V(null)},variant:"secondary",className:"mr-3",children:"Start New Bulk Import"}),(0,s.jsxs)(l.Button,{onClick:()=>{let e=k.map(e=>({user_email:e.user_email,user_role:e.user_role,status:e.status,key:e.key||"",invitation_link:e.invitation_link||"",error:e.error||""})),s=new Blob([v.default.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,s.jsx)(c.DownloadOutlined,{className:"mr-2"})," Download User Credentials"]})]})]})]})})})]})}],447082)},371455,172372,e=>{"use strict";var s=e.i(843476),t=e.i(827252),l=e.i(213205),a=e.i(912598),r=e.i(677667),i=e.i(130643),n=e.i(898667),d=e.i(994388),o=e.i(35983),c=e.i(779241),m=e.i(560445),u=e.i(464571),x=e.i(808613),h=e.i(311451),f=e.i(212931),p=e.i(199133),g=e.i(770914),j=e.i(592968),v=e.i(898586),b=e.i(271645),y=e.i(447082),w=e.i(663435),N=e.i(355619),_=e.i(727749),C=e.i(764205),S=e.i(237016),k=e.i(599724);function I({isInvitationLinkModalVisible:e,setIsInvitationLinkModalVisible:t,baseUrl:l,invitationLinkData:a,modalType:r="invitation"}){let{Title:i,Paragraph:n}=v.Typography,o=()=>{if(!l)return"";let e=new URL(l).pathname,s=e&&"/"!==e?`${e}/ui`:"ui";if(a?.has_user_setup_sso)return new URL(s,l).toString();let t=`${s}?invitation_id=${a?.id}`;return"resetPassword"===r&&(t+="&action=reset_password"),new URL(t,l).toString()};return(0,s.jsxs)(f.Modal,{title:"invitation"===r?"Invitation Link":"Reset Password Link",open:e,width:800,footer:null,onOk:()=>{t(!1)},onCancel:()=>{t(!1)},children:[(0,s.jsx)(n,{children:"invitation"===r?"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,s.jsxs)("div",{className:"flex justify-between pt-5 pb-2",children:[(0,s.jsx)(k.Text,{className:"text-base",children:"User ID"}),(0,s.jsx)(k.Text,{children:a?.user_id})]}),(0,s.jsxs)("div",{className:"flex justify-between pt-5 pb-2",children:[(0,s.jsx)(k.Text,{children:"invitation"===r?"Invitation Link":"Reset Password Link"}),(0,s.jsx)(k.Text,{children:(0,s.jsx)(k.Text,{children:o()})})]}),(0,s.jsx)("div",{className:"flex justify-end mt-5",children:(0,s.jsx)(S.CopyToClipboard,{text:o(),onCopy:()=>_.default.success("Copied!"),children:(0,s.jsx)(d.Button,{variant:"primary",children:"invitation"===r?"Copy invitation link":"Copy password reset link"})})})]})}e.s(["default",()=>I],172372);let{Option:U}=p.Select,{Text:T,Link:L,Title:V}=v.Typography;e.s(["CreateUserButton",0,({userID:e,accessToken:v,teams:S,possibleUIRoles:k,onUserCreated:U,isEmbedded:V=!1})=>{let B=(0,a.useQueryClient)(),[O,M]=(0,b.useState)(null),[F]=x.Form.useForm(),[E,P]=(0,b.useState)(!1),[R,A]=(0,b.useState)(!1),[D,$]=(0,b.useState)([]),[z,W]=(0,b.useState)(!1),[K,q]=(0,b.useState)(null),[H,G]=(0,b.useState)(null);(0,b.useEffect)(()=>{let s=async()=>{try{let s=await (0,C.modelAvailableCall)(v,e,"any"),t=[];for(let e=0;e{try{_.default.info("Making API Call"),V||P(!0),s.models&&0!==s.models.length||"proxy_admin"===s.user_role||(s.models=["no-default-models"]);let t=await (0,C.userCreateCall)(v,null,s);await B.invalidateQueries({queryKey:["userList"]}),A(!0);let l=t.data?.user_id||t.user_id;if(U&&V){U(l),F.resetFields();return}if(O?.SSO_ENABLED){let s={id:"u">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)}),user_id:l,is_accepted:!1,accepted_at:null,expires_at:new Date(Date.now()+6048e5),created_at:new Date,created_by:e,updated_at:new Date,updated_by:e,has_user_setup_sso:!0};q(s),W(!0)}else(0,C.invitationCreateCall)(v,l).then(e=>{e.has_user_setup_sso=!1,q(e),W(!0)});_.default.success("API user Created"),F.resetFields(),localStorage.removeItem("userData"+e)}catch(s){let e=s.response?.data?.detail||s?.message||"Error creating the user";_.default.fromBackend(e),console.error("Error creating the user:",s)}};return V?(0,s.jsxs)(x.Form,{form:F,onFinish:J,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,s.jsx)(m.Alert,{message:"Email invitations",description:(0,s.jsxs)(s.Fragment,{children:["New users receive an email invite only when an email integration (SMTP, Resend, or SendGrid) is configured."," ",(0,s.jsx)(L,{href:"https://docs.litellm.ai/docs/proxy/email",target:"_blank",children:"Learn how to set up email notifications"})]}),type:"info",showIcon:!0,className:"mb-4"}),(0,s.jsx)(x.Form.Item,{label:"User Email",name:"user_email",children:(0,s.jsx)(c.TextInput,{placeholder:""})}),(0,s.jsx)(x.Form.Item,{label:"User Role",name:"user_role",children:(0,s.jsx)(p.Select,{children:k&&Object.entries(k).map(([e,{ui_label:t,description:l}])=>(0,s.jsx)(o.SelectItem,{value:e,title:t,children:(0,s.jsxs)("div",{className:"flex",children:[t," ",(0,s.jsx)(T,{className:"ml-2",style:{color:"gray",fontSize:"12px"},children:l})]})},e))})}),(0,s.jsx)(x.Form.Item,{label:"Team",name:"team_id",children:(0,s.jsx)(p.Select,{placeholder:"Select Team",style:{width:"100%"},children:(0,s.jsx)(w.default,{teams:S})})}),(0,s.jsx)(x.Form.Item,{label:"Metadata",name:"metadata",children:(0,s.jsx)(h.Input.TextArea,{rows:4,placeholder:"Enter metadata as JSON"})}),(0,s.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,s.jsx)(u.Button,{htmlType:"submit",children:"Create User"})})]}):(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(d.Button,{className:"mb-0",onClick:()=>P(!0),children:"+ Invite User"}),(0,s.jsx)(y.default,{accessToken:v,teams:S,possibleUIRoles:k}),(0,s.jsxs)(f.Modal,{title:"Invite User",open:E,width:800,footer:null,onOk:()=>{P(!1),F.resetFields()},onCancel:()=>{P(!1),A(!1),F.resetFields()},children:[(0,s.jsxs)(g.Space,{direction:"vertical",size:"middle",children:[(0,s.jsx)(T,{className:"mb-1",children:"Create a User who can own keys"}),(0,s.jsx)(m.Alert,{message:"Email invitations",description:(0,s.jsxs)(s.Fragment,{children:["New users receive an email invite only when an email integration (SMTP, Resend, or SendGrid) is configured."," ",(0,s.jsx)(L,{href:"https://docs.litellm.ai/docs/proxy/email",target:"_blank",children:"Learn how to set up email notifications"})]}),type:"info",showIcon:!0,className:"mb-4"})]}),(0,s.jsxs)(x.Form,{form:F,onFinish:J,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,s.jsx)(x.Form.Item,{label:"User Email",name:"user_email",children:(0,s.jsx)(h.Input,{})}),(0,s.jsx)(x.Form.Item,{label:(0,s.jsxs)("span",{children:["Global Proxy Role"," ",(0,s.jsx)(j.Tooltip,{title:"This role is independent of any team/org specific roles. Configure Team / Organization Admins in the Settings",children:(0,s.jsx)(t.InfoCircleOutlined,{})})]}),name:"user_role",children:(0,s.jsx)(p.Select,{children:k&&Object.entries(k).map(([e,{ui_label:t,description:l}])=>(0,s.jsxs)(o.SelectItem,{value:e,title:t,children:[(0,s.jsx)(T,{children:t}),(0,s.jsxs)(T,{type:"secondary",children:[" - ",l]})]},e))})}),(0,s.jsx)(x.Form.Item,{label:"Team",className:"gap-2",name:"team_id",help:"If selected, user will be added as a 'user' role to the team.",children:(0,s.jsx)(w.default,{teams:S})}),(0,s.jsx)(x.Form.Item,{label:"Metadata",name:"metadata",children:(0,s.jsx)(h.Input.TextArea,{rows:4,placeholder:"Enter metadata as JSON"})}),(0,s.jsxs)(r.Accordion,{children:[(0,s.jsx)(n.AccordionHeader,{children:(0,s.jsx)(T,{strong:!0,children:"Personal Key Creation"})}),(0,s.jsx)(i.AccordionBody,{children:(0,s.jsx)(x.Form.Item,{className:"gap-2",label:(0,s.jsxs)("span",{children:["Models"," ",(0,s.jsx)(j.Tooltip,{title:"Models user has access to, outside of team scope.",children:(0,s.jsx)(t.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"models",help:"Models user has access to, outside of team scope.",children:(0,s.jsxs)(p.Select,{mode:"multiple",placeholder:"Select models",style:{width:"100%"},children:[(0,s.jsx)(p.Select.Option,{value:"all-proxy-models",children:"All Proxy Models"},"all-proxy-models"),(0,s.jsx)(p.Select.Option,{value:"no-default-models",children:"No Default Models"},"no-default-models"),D.map(e=>(0,s.jsx)(p.Select.Option,{value:e,children:(0,N.getModelDisplayName)(e)},e))]})})})]}),(0,s.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,s.jsx)(u.Button,{type:"primary",icon:(0,s.jsx)(l.UserAddOutlined,{}),htmlType:"submit",children:"Invite User"})})]})]}),R&&(0,s.jsx)(I,{isInvitationLinkModalVisible:z,setIsInvitationLinkModalVisible:W,baseUrl:H||"",invitationLinkData:K})]})}],371455)}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/1ae216e2208b329b.js b/litellm/proxy/_experimental/out/_next/static/chunks/1ae216e2208b329b.js new file mode 100644 index 00000000000..944b348e216 --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/1ae216e2208b329b.js @@ -0,0 +1,10 @@ +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,56456,e=>{"use strict";var t=e.i(739295);e.s(["LoadingOutlined",()=>t.default])},244451,e=>{"use strict";let t;e.i(247167);var i=e.i(271645),n=e.i(343794),a=e.i(242064),r=e.i(763731),o=e.i(174428);let s=80*Math.PI,l=e=>{let{dotClassName:t,style:a,hasCircleCls:r}=e;return i.createElement("circle",{className:(0,n.default)(`${t}-circle`,{[`${t}-circle-bg`]:r}),r:40,cx:50,cy:50,strokeWidth:20,style:a})},d=({percent:e,prefixCls:t})=>{let a=`${t}-dot`,r=`${a}-holder`,d=`${r}-hidden`,[c,u]=i.useState(!1);(0,o.default)(()=>{0!==e&&u(!0)},[0!==e]);let m=Math.max(Math.min(e,100),0);if(!c)return null;let p={strokeDashoffset:`${s/4}`,strokeDasharray:`${s*m/100} ${s*(100-m)/100}`};return i.createElement("span",{className:(0,n.default)(r,`${a}-progress`,m<=0&&d)},i.createElement("svg",{viewBox:"0 0 100 100",role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":m},i.createElement(l,{dotClassName:a,hasCircleCls:!0}),i.createElement(l,{dotClassName:a,style:p})))};function c(e){let{prefixCls:t,percent:a=0}=e,r=`${t}-dot`,o=`${r}-holder`,s=`${o}-hidden`;return i.createElement(i.Fragment,null,i.createElement("span",{className:(0,n.default)(o,a>0&&s)},i.createElement("span",{className:(0,n.default)(r,`${t}-dot-spin`)},[1,2,3,4].map(e=>i.createElement("i",{className:`${t}-dot-item`,key:e})))),i.createElement(d,{prefixCls:t,percent:a}))}function u(e){var t;let{prefixCls:a,indicator:o,percent:s}=e,l=`${a}-dot`;return o&&i.isValidElement(o)?(0,r.cloneElement)(o,{className:(0,n.default)(null==(t=o.props)?void 0:t.className,l),percent:s}):i.createElement(c,{prefixCls:a,percent:s})}e.i(296059);var m=e.i(694758),p=e.i(183293),h=e.i(246422),g=e.i(838378);let b=new m.Keyframes("antSpinMove",{to:{opacity:1}}),f=new m.Keyframes("antRotate",{to:{transform:"rotate(405deg)"}}),y=(0,h.genStyleHooks)("Spin",e=>(e=>{let{componentCls:t,calc:i}=e;return{[t]:Object.assign(Object.assign({},(0,p.resetComponent)(e)),{position:"absolute",display:"none",color:e.colorPrimary,fontSize:0,textAlign:"center",verticalAlign:"middle",opacity:0,transition:`transform ${e.motionDurationSlow} ${e.motionEaseInOutCirc}`,"&-spinning":{position:"relative",display:"inline-block",opacity:1},[`${t}-text`]:{fontSize:e.fontSize,paddingTop:i(i(e.dotSize).sub(e.fontSize)).div(2).add(2).equal()},"&-fullscreen":{position:"fixed",width:"100vw",height:"100vh",backgroundColor:e.colorBgMask,zIndex:e.zIndexPopupBase,inset:0,display:"flex",alignItems:"center",flexDirection:"column",justifyContent:"center",opacity:0,visibility:"hidden",transition:`all ${e.motionDurationMid}`,"&-show":{opacity:1,visibility:"visible"},[t]:{[`${t}-dot-holder`]:{color:e.colorWhite},[`${t}-text`]:{color:e.colorTextLightSolid}}},"&-nested-loading":{position:"relative",[`> div > ${t}`]:{position:"absolute",top:0,insetInlineStart:0,zIndex:4,display:"block",width:"100%",height:"100%",maxHeight:e.contentHeight,[`${t}-dot`]:{position:"absolute",top:"50%",insetInlineStart:"50%",margin:i(e.dotSize).mul(-1).div(2).equal()},[`${t}-text`]:{position:"absolute",top:"50%",width:"100%",textShadow:`0 1px 2px ${e.colorBgContainer}`},[`&${t}-show-text ${t}-dot`]:{marginTop:i(e.dotSize).div(2).mul(-1).sub(10).equal()},"&-sm":{[`${t}-dot`]:{margin:i(e.dotSizeSM).mul(-1).div(2).equal()},[`${t}-text`]:{paddingTop:i(i(e.dotSizeSM).sub(e.fontSize)).div(2).add(2).equal()},[`&${t}-show-text ${t}-dot`]:{marginTop:i(e.dotSizeSM).div(2).mul(-1).sub(10).equal()}},"&-lg":{[`${t}-dot`]:{margin:i(e.dotSizeLG).mul(-1).div(2).equal()},[`${t}-text`]:{paddingTop:i(i(e.dotSizeLG).sub(e.fontSize)).div(2).add(2).equal()},[`&${t}-show-text ${t}-dot`]:{marginTop:i(e.dotSizeLG).div(2).mul(-1).sub(10).equal()}}},[`${t}-container`]:{position:"relative",transition:`opacity ${e.motionDurationSlow}`,"&::after":{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,zIndex:10,width:"100%",height:"100%",background:e.colorBgContainer,opacity:0,transition:`all ${e.motionDurationSlow}`,content:'""',pointerEvents:"none"}},[`${t}-blur`]:{clear:"both",opacity:.5,userSelect:"none",pointerEvents:"none","&::after":{opacity:.4,pointerEvents:"auto"}}},"&-tip":{color:e.spinDotDefault},[`${t}-dot-holder`]:{width:"1em",height:"1em",fontSize:e.dotSize,display:"inline-block",transition:`transform ${e.motionDurationSlow} ease, opacity ${e.motionDurationSlow} ease`,transformOrigin:"50% 50%",lineHeight:1,color:e.colorPrimary,"&-hidden":{transform:"scale(0.3)",opacity:0}},[`${t}-dot-progress`]:{position:"absolute",inset:0},[`${t}-dot`]:{position:"relative",display:"inline-block",fontSize:e.dotSize,width:"1em",height:"1em","&-item":{position:"absolute",display:"block",width:i(e.dotSize).sub(i(e.marginXXS).div(2)).div(2).equal(),height:i(e.dotSize).sub(i(e.marginXXS).div(2)).div(2).equal(),background:"currentColor",borderRadius:"100%",transform:"scale(0.75)",transformOrigin:"50% 50%",opacity:.3,animationName:b,animationDuration:"1s",animationIterationCount:"infinite",animationTimingFunction:"linear",animationDirection:"alternate","&:nth-child(1)":{top:0,insetInlineStart:0,animationDelay:"0s"},"&:nth-child(2)":{top:0,insetInlineEnd:0,animationDelay:"0.4s"},"&:nth-child(3)":{insetInlineEnd:0,bottom:0,animationDelay:"0.8s"},"&:nth-child(4)":{bottom:0,insetInlineStart:0,animationDelay:"1.2s"}},"&-spin":{transform:"rotate(45deg)",animationName:f,animationDuration:"1.2s",animationIterationCount:"infinite",animationTimingFunction:"linear"},"&-circle":{strokeLinecap:"round",transition:["stroke-dashoffset","stroke-dasharray","stroke","stroke-width","opacity"].map(t=>`${t} ${e.motionDurationSlow} ease`).join(","),fillOpacity:0,stroke:"currentcolor"},"&-circle-bg":{stroke:e.colorFillSecondary}},[`&-sm ${t}-dot`]:{"&, &-holder":{fontSize:e.dotSizeSM}},[`&-sm ${t}-dot-holder`]:{i:{width:i(i(e.dotSizeSM).sub(i(e.marginXXS).div(2))).div(2).equal(),height:i(i(e.dotSizeSM).sub(i(e.marginXXS).div(2))).div(2).equal()}},[`&-lg ${t}-dot`]:{"&, &-holder":{fontSize:e.dotSizeLG}},[`&-lg ${t}-dot-holder`]:{i:{width:i(i(e.dotSizeLG).sub(e.marginXXS)).div(2).equal(),height:i(i(e.dotSizeLG).sub(e.marginXXS)).div(2).equal()}},[`&${t}-show-text ${t}-text`]:{display:"block"}})}})((0,g.mergeToken)(e,{spinDotDefault:e.colorTextDescription})),e=>{let{controlHeightLG:t,controlHeight:i}=e;return{contentHeight:400,dotSize:t/2,dotSizeSM:.35*t,dotSizeLG:i}}),v=[[30,.05],[70,.03],[96,.01]];var $=function(e,t){var i={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(i[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])&&(i[n[a]]=e[n[a]]);return i};let S=e=>{var r;let{prefixCls:o,spinning:s=!0,delay:l=0,className:d,rootClassName:c,size:m="default",tip:p,wrapperClassName:h,style:g,children:b,fullscreen:f=!1,indicator:S,percent:x}=e,w=$(e,["prefixCls","spinning","delay","className","rootClassName","size","tip","wrapperClassName","style","children","fullscreen","indicator","percent"]),{getPrefixCls:O,direction:j,className:E,style:z,indicator:C}=(0,a.useComponentConfig)("spin"),N=O("spin",o),[M,T,k]=y(N),[I,P]=i.useState(()=>s&&(!s||!l||!!Number.isNaN(Number(l)))),L=function(e,t){let[n,a]=i.useState(0),r=i.useRef(null),o="auto"===t;return i.useEffect(()=>(o&&e&&(a(0),r.current=setInterval(()=>{a(e=>{let t=100-e;for(let i=0;i{r.current&&(clearInterval(r.current),r.current=null)}),[o,e]),o?n:t}(I,x);i.useEffect(()=>{if(s){let e=function(e,t,i){var n,a=i||{},r=a.noTrailing,o=void 0!==r&&r,s=a.noLeading,l=void 0!==s&&s,d=a.debounceMode,c=void 0===d?void 0:d,u=!1,m=0;function p(){n&&clearTimeout(n)}function h(){for(var i=arguments.length,a=Array(i),r=0;re?l?(m=Date.now(),o||(n=setTimeout(c?g:h,e))):h():!0!==o&&(n=setTimeout(c?g:h,void 0===c?e-d:e)))}return h.cancel=function(e){var t=(e||{}).upcomingOnly;p(),u=!(void 0!==t&&t)},h}(l,()=>{P(!0)},{debounceMode:false});return e(),()=>{var t;null==(t=null==e?void 0:e.cancel)||t.call(e)}}P(!1)},[l,s]);let R=i.useMemo(()=>void 0!==b&&!f,[b,f]),D=(0,n.default)(N,E,{[`${N}-sm`]:"small"===m,[`${N}-lg`]:"large"===m,[`${N}-spinning`]:I,[`${N}-show-text`]:!!p,[`${N}-rtl`]:"rtl"===j},d,!f&&c,T,k),B=(0,n.default)(`${N}-container`,{[`${N}-blur`]:I}),G=null!=(r=null!=S?S:C)?r:t,q=Object.assign(Object.assign({},z),g),H=i.createElement("div",Object.assign({},w,{style:q,className:D,"aria-live":"polite","aria-busy":I}),i.createElement(u,{prefixCls:N,indicator:G,percent:L}),p&&(R||f)?i.createElement("div",{className:`${N}-text`},p):null);return M(R?i.createElement("div",Object.assign({},w,{className:(0,n.default)(`${N}-nested-loading`,h,T,k)}),I&&i.createElement("div",{key:"loading"},H),i.createElement("div",{className:B,key:"container"},b)):f?i.createElement("div",{className:(0,n.default)(`${N}-fullscreen`,{[`${N}-fullscreen-show`]:I},c,T,k)},H):H)};S.setDefaultIndicator=e=>{t=e},e.s(["default",0,S],244451)},482725,e=>{"use strict";var t=e.i(244451);e.s(["Spin",()=>t.default])},175712,e=>{"use strict";e.i(247167);var t=e.i(271645),i=e.i(343794),n=e.i(529681),a=e.i(242064),r=e.i(517455),o=e.i(185793),s=e.i(721369),l=function(e,t){var i={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(i[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])&&(i[n[a]]=e[n[a]]);return i};let d=e=>{var{prefixCls:n,className:r,hoverable:o=!0}=e,s=l(e,["prefixCls","className","hoverable"]);let{getPrefixCls:d}=t.useContext(a.ConfigContext),c=d("card",n),u=(0,i.default)(`${c}-grid`,r,{[`${c}-grid-hoverable`]:o});return t.createElement("div",Object.assign({},s,{className:u}))};e.i(296059);var c=e.i(915654),u=e.i(183293),m=e.i(246422),p=e.i(838378);let h=(0,m.genStyleHooks)("Card",e=>{let t=(0,p.mergeToken)(e,{cardShadow:e.boxShadowCard,cardHeadPadding:e.padding,cardPaddingBase:e.paddingLG,cardActionsIconSize:e.fontSize});return[(e=>{let{componentCls:t,cardShadow:i,cardHeadPadding:n,colorBorderSecondary:a,boxShadowTertiary:r,bodyPadding:o,extraColor:s}=e;return{[t]:Object.assign(Object.assign({},(0,u.resetComponent)(e)),{position:"relative",background:e.colorBgContainer,borderRadius:e.borderRadiusLG,[`&:not(${t}-bordered)`]:{boxShadow:r},[`${t}-head`]:(e=>{let{antCls:t,componentCls:i,headerHeight:n,headerPadding:a,tabsMarginBottom:r}=e;return Object.assign(Object.assign({display:"flex",justifyContent:"center",flexDirection:"column",minHeight:n,marginBottom:-1,padding:`0 ${(0,c.unit)(a)}`,color:e.colorTextHeading,fontWeight:e.fontWeightStrong,fontSize:e.headerFontSize,background:e.headerBg,borderBottom:`${(0,c.unit)(e.lineWidth)} ${e.lineType} ${e.colorBorderSecondary}`,borderRadius:`${(0,c.unit)(e.borderRadiusLG)} ${(0,c.unit)(e.borderRadiusLG)} 0 0`},(0,u.clearFix)()),{"&-wrapper":{width:"100%",display:"flex",alignItems:"center"},"&-title":Object.assign(Object.assign({display:"inline-block",flex:1},u.textEllipsis),{[` + > ${i}-typography, + > ${i}-typography-edit-content + `]:{insetInlineStart:0,marginTop:0,marginBottom:0}}),[`${t}-tabs-top`]:{clear:"both",marginBottom:r,color:e.colorText,fontWeight:"normal",fontSize:e.fontSize,"&-bar":{borderBottom:`${(0,c.unit)(e.lineWidth)} ${e.lineType} ${e.colorBorderSecondary}`}}})})(e),[`${t}-extra`]:{marginInlineStart:"auto",color:s,fontWeight:"normal",fontSize:e.fontSize},[`${t}-body`]:{padding:o,borderRadius:`0 0 ${(0,c.unit)(e.borderRadiusLG)} ${(0,c.unit)(e.borderRadiusLG)}`},[`${t}-grid`]:(e=>{let{cardPaddingBase:t,colorBorderSecondary:i,cardShadow:n,lineWidth:a}=e;return{width:"33.33%",padding:t,border:0,borderRadius:0,boxShadow:` + ${(0,c.unit)(a)} 0 0 0 ${i}, + 0 ${(0,c.unit)(a)} 0 0 ${i}, + ${(0,c.unit)(a)} ${(0,c.unit)(a)} 0 0 ${i}, + ${(0,c.unit)(a)} 0 0 0 ${i} inset, + 0 ${(0,c.unit)(a)} 0 0 ${i} inset; + `,transition:`all ${e.motionDurationMid}`,"&-hoverable:hover":{position:"relative",zIndex:1,boxShadow:n}}})(e),[`${t}-cover`]:{"> *":{display:"block",width:"100%",borderRadius:`${(0,c.unit)(e.borderRadiusLG)} ${(0,c.unit)(e.borderRadiusLG)} 0 0`}},[`${t}-actions`]:(e=>{let{componentCls:t,iconCls:i,actionsLiMargin:n,cardActionsIconSize:a,colorBorderSecondary:r,actionsBg:o}=e;return Object.assign(Object.assign({margin:0,padding:0,listStyle:"none",background:o,borderTop:`${(0,c.unit)(e.lineWidth)} ${e.lineType} ${r}`,display:"flex",borderRadius:`0 0 ${(0,c.unit)(e.borderRadiusLG)} ${(0,c.unit)(e.borderRadiusLG)}`},(0,u.clearFix)()),{"& > li":{margin:n,color:e.colorTextDescription,textAlign:"center","> span":{position:"relative",display:"block",minWidth:e.calc(e.cardActionsIconSize).mul(2).equal(),fontSize:e.fontSize,lineHeight:e.lineHeight,cursor:"pointer","&:hover":{color:e.colorPrimary,transition:`color ${e.motionDurationMid}`},[`a:not(${t}-btn), > ${i}`]:{display:"inline-block",width:"100%",color:e.colorIcon,lineHeight:(0,c.unit)(e.fontHeight),transition:`color ${e.motionDurationMid}`,"&:hover":{color:e.colorPrimary}},[`> ${i}`]:{fontSize:a,lineHeight:(0,c.unit)(e.calc(a).mul(e.lineHeight).equal())}},"&:not(:last-child)":{borderInlineEnd:`${(0,c.unit)(e.lineWidth)} ${e.lineType} ${r}`}}})})(e),[`${t}-meta`]:Object.assign(Object.assign({margin:`${(0,c.unit)(e.calc(e.marginXXS).mul(-1).equal())} 0`,display:"flex"},(0,u.clearFix)()),{"&-avatar":{paddingInlineEnd:e.padding},"&-detail":{overflow:"hidden",flex:1,"> div:not(:last-child)":{marginBottom:e.marginXS}},"&-title":Object.assign({color:e.colorTextHeading,fontWeight:e.fontWeightStrong,fontSize:e.fontSizeLG},u.textEllipsis),"&-description":{color:e.colorTextDescription}})}),[`${t}-bordered`]:{border:`${(0,c.unit)(e.lineWidth)} ${e.lineType} ${a}`,[`${t}-cover`]:{marginTop:-1,marginInlineStart:-1,marginInlineEnd:-1}},[`${t}-hoverable`]:{cursor:"pointer",transition:`box-shadow ${e.motionDurationMid}, border-color ${e.motionDurationMid}`,"&:hover":{borderColor:"transparent",boxShadow:i}},[`${t}-contain-grid`]:{borderRadius:`${(0,c.unit)(e.borderRadiusLG)} ${(0,c.unit)(e.borderRadiusLG)} 0 0 `,[`${t}-body`]:{display:"flex",flexWrap:"wrap"},[`&:not(${t}-loading) ${t}-body`]:{marginBlockStart:e.calc(e.lineWidth).mul(-1).equal(),marginInlineStart:e.calc(e.lineWidth).mul(-1).equal(),padding:0}},[`${t}-contain-tabs`]:{[`> div${t}-head`]:{minHeight:0,[`${t}-head-title, ${t}-extra`]:{paddingTop:n}}},[`${t}-type-inner`]:(e=>{let{componentCls:t,colorFillAlter:i,headerPadding:n,bodyPadding:a}=e;return{[`${t}-head`]:{padding:`0 ${(0,c.unit)(n)}`,background:i,"&-title":{fontSize:e.fontSize}},[`${t}-body`]:{padding:`${(0,c.unit)(e.padding)} ${(0,c.unit)(a)}`}}})(e),[`${t}-loading`]:(e=>{let{componentCls:t}=e;return{overflow:"hidden",[`${t}-body`]:{userSelect:"none"}}})(e),[`${t}-rtl`]:{direction:"rtl"}}})(t),(e=>{let{componentCls:t,bodyPaddingSM:i,headerPaddingSM:n,headerHeightSM:a,headerFontSizeSM:r}=e;return{[`${t}-small`]:{[`> ${t}-head`]:{minHeight:a,padding:`0 ${(0,c.unit)(n)}`,fontSize:r,[`> ${t}-head-wrapper`]:{[`> ${t}-extra`]:{fontSize:e.fontSize}}},[`> ${t}-body`]:{padding:i}},[`${t}-small${t}-contain-tabs`]:{[`> ${t}-head`]:{[`${t}-head-title, ${t}-extra`]:{paddingTop:0,display:"flex",alignItems:"center"}}}}})(t)]},e=>{var t,i;return{headerBg:"transparent",headerFontSize:e.fontSizeLG,headerFontSizeSM:e.fontSize,headerHeight:e.fontSizeLG*e.lineHeightLG+2*e.padding,headerHeightSM:e.fontSize*e.lineHeight+2*e.paddingXS,actionsBg:e.colorBgContainer,actionsLiMargin:`${e.paddingSM}px 0`,tabsMarginBottom:-e.padding-e.lineWidth,extraColor:e.colorText,bodyPaddingSM:12,headerPaddingSM:12,bodyPadding:null!=(t=e.bodyPadding)?t:e.paddingLG,headerPadding:null!=(i=e.headerPadding)?i:e.paddingLG}});var g=e.i(792812),b=function(e,t){var i={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(i[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])&&(i[n[a]]=e[n[a]]);return i};let f=e=>{let{actionClasses:i,actions:n=[],actionStyle:a}=e;return t.createElement("ul",{className:i,style:a},n.map((e,i)=>{let a=`action-${i}`;return t.createElement("li",{style:{width:`${100/n.length}%`},key:a},t.createElement("span",null,e))}))},y=t.forwardRef((e,l)=>{let c,{prefixCls:u,className:m,rootClassName:p,style:y,extra:v,headStyle:$={},bodyStyle:S={},title:x,loading:w,bordered:O,variant:j,size:E,type:z,cover:C,actions:N,tabList:M,children:T,activeTabKey:k,defaultActiveTabKey:I,tabBarExtraContent:P,hoverable:L,tabProps:R={},classNames:D,styles:B}=e,G=b(e,["prefixCls","className","rootClassName","style","extra","headStyle","bodyStyle","title","loading","bordered","variant","size","type","cover","actions","tabList","children","activeTabKey","defaultActiveTabKey","tabBarExtraContent","hoverable","tabProps","classNames","styles"]),{getPrefixCls:q,direction:H,card:F}=t.useContext(a.ConfigContext),[W]=(0,g.default)("card",j,O),A=e=>{var t;return(0,i.default)(null==(t=null==F?void 0:F.classNames)?void 0:t[e],null==D?void 0:D[e])},K=e=>{var t;return Object.assign(Object.assign({},null==(t=null==F?void 0:F.styles)?void 0:t[e]),null==B?void 0:B[e])},X=t.useMemo(()=>{let e=!1;return t.Children.forEach(T,t=>{(null==t?void 0:t.type)===d&&(e=!0)}),e},[T]),U=q("card",u),[_,Q,V]=h(U),J=t.createElement(o.default,{loading:!0,active:!0,paragraph:{rows:4},title:!1},T),Z=void 0!==k,Y=Object.assign(Object.assign({},R),{[Z?"activeKey":"defaultActiveKey"]:Z?k:I,tabBarExtraContent:P}),ee=(0,r.default)(E),et=ee&&"default"!==ee?ee:"large",ei=M?t.createElement(s.default,Object.assign({size:et},Y,{className:`${U}-head-tabs`,onChange:t=>{var i;null==(i=e.onTabChange)||i.call(e,t)},items:M.map(e=>{var{tab:t}=e;return Object.assign({label:t},b(e,["tab"]))})})):null;if(x||v||ei){let e=(0,i.default)(`${U}-head`,A("header")),n=(0,i.default)(`${U}-head-title`,A("title")),a=(0,i.default)(`${U}-extra`,A("extra")),r=Object.assign(Object.assign({},$),K("header"));c=t.createElement("div",{className:e,style:r},t.createElement("div",{className:`${U}-head-wrapper`},x&&t.createElement("div",{className:n,style:K("title")},x),v&&t.createElement("div",{className:a,style:K("extra")},v)),ei)}let en=(0,i.default)(`${U}-cover`,A("cover")),ea=C?t.createElement("div",{className:en,style:K("cover")},C):null,er=(0,i.default)(`${U}-body`,A("body")),eo=Object.assign(Object.assign({},S),K("body")),es=t.createElement("div",{className:er,style:eo},w?J:T),el=(0,i.default)(`${U}-actions`,A("actions")),ed=(null==N?void 0:N.length)?t.createElement(f,{actionClasses:el,actionStyle:K("actions"),actions:N}):null,ec=(0,n.default)(G,["onTabChange"]),eu=(0,i.default)(U,null==F?void 0:F.className,{[`${U}-loading`]:w,[`${U}-bordered`]:"borderless"!==W,[`${U}-hoverable`]:L,[`${U}-contain-grid`]:X,[`${U}-contain-tabs`]:null==M?void 0:M.length,[`${U}-${ee}`]:ee,[`${U}-type-${z}`]:!!z,[`${U}-rtl`]:"rtl"===H},m,p,Q,V),em=Object.assign(Object.assign({},null==F?void 0:F.style),y);return _(t.createElement("div",Object.assign({ref:l},ec,{className:eu,style:em}),c,ea,es,ed))});var v=function(e,t){var i={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(i[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])&&(i[n[a]]=e[n[a]]);return i};y.Grid=d,y.Meta=e=>{let{prefixCls:n,className:r,avatar:o,title:s,description:l}=e,d=v(e,["prefixCls","className","avatar","title","description"]),{getPrefixCls:c}=t.useContext(a.ConfigContext),u=c("card",n),m=(0,i.default)(`${u}-meta`,r),p=o?t.createElement("div",{className:`${u}-meta-avatar`},o):null,h=s?t.createElement("div",{className:`${u}-meta-title`},s):null,g=l?t.createElement("div",{className:`${u}-meta-description`},l):null,b=h||g?t.createElement("div",{className:`${u}-meta-detail`},h,g):null;return t.createElement("div",Object.assign({},d,{className:m}),p,b)},e.s(["Card",0,y],175712)},954616,e=>{"use strict";var t=e.i(271645),i=e.i(114272),n=e.i(540143),a=e.i(915823),r=e.i(619273),o=class extends a.Subscribable{#e;#t=void 0;#i;#n;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#a()}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,r.shallowEqualObjects)(this.options,t)||this.#e.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#i,observer:this}),t?.mutationKey&&this.options.mutationKey&&(0,r.hashKey)(t.mutationKey)!==(0,r.hashKey)(this.options.mutationKey)?this.reset():this.#i?.state.status==="pending"&&this.#i.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#i?.removeObserver(this)}onMutationUpdate(e){this.#a(),this.#r(e)}getCurrentResult(){return this.#t}reset(){this.#i?.removeObserver(this),this.#i=void 0,this.#a(),this.#r()}mutate(e,t){return this.#n=t,this.#i?.removeObserver(this),this.#i=this.#e.getMutationCache().build(this.#e,this.options),this.#i.addObserver(this),this.#i.execute(e)}#a(){let e=this.#i?.state??(0,i.getDefaultState)();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}}#r(e){n.notifyManager.batch(()=>{if(this.#n&&this.hasListeners()){let t=this.#t.variables,i=this.#t.context,n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type==="success"){try{this.#n.onSuccess?.(e.data,t,i,n)}catch(e){Promise.reject(e)}try{this.#n.onSettled?.(e.data,null,t,i,n)}catch(e){Promise.reject(e)}}else if(e?.type==="error"){try{this.#n.onError?.(e.error,t,i,n)}catch(e){Promise.reject(e)}try{this.#n.onSettled?.(void 0,e.error,t,i,n)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},s=e.i(912598);function l(e,i){let a=(0,s.useQueryClient)(i),[l]=t.useState(()=>new o(a,e));t.useEffect(()=>{l.setOptions(e)},[l,e]);let d=t.useSyncExternalStore(t.useCallback(e=>l.subscribe(n.notifyManager.batchCalls(e)),[l]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),c=t.useCallback((e,t)=>{l.mutate(e,t).catch(r.noop)},[l]);if(d.error&&(0,r.shouldThrowError)(l.options.throwOnError,[d.error]))throw d.error;return{...d,mutate:c,mutateAsync:d.mutate}}e.s(["useMutation",()=>l],954616)},566606,e=>{"use strict";var t=e.i(843476),i=e.i(271645),n=e.i(618566),a=e.i(947293),r=e.i(764205),o=e.i(954616),s=e.i(266027),l=e.i(612256);let d=(0,e.i(243652).createQueryKeys)("onboarding");var c=e.i(482725),u=e.i(56456);function m(){return(0,t.jsx)("div",{className:"mx-auto w-full max-w-md mt-10 flex justify-center",children:(0,t.jsx)(c.Spin,{indicator:(0,t.jsx)(u.LoadingOutlined,{spin:!0}),size:"large"})})}var p=e.i(560445),h=e.i(464571);function g(){return(0,t.jsxs)("div",{className:"mx-auto w-full max-w-md mt-10",children:[(0,t.jsx)(p.Alert,{type:"error",message:"Failed to load invitation",description:"The invitation link may be invalid or expired.",showIcon:!0}),(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsx)(h.Button,{href:"/ui/login",children:"Back to Login"})})]})}var b=e.i(175712),f=e.i(808613),y=e.i(311451),v=e.i(898586);function $({variant:e,userEmail:n,isPending:a,claimError:r,onSubmit:o}){let[s]=f.Form.useForm();return i.default.useEffect(()=>{n&&s.setFieldValue("user_email",n)},[n,s]),(0,t.jsx)("div",{className:"mx-auto w-full max-w-md mt-10",children:(0,t.jsxs)(b.Card,{children:[(0,t.jsx)(v.Typography.Title,{level:5,className:"text-center mb-5",children:"🚅 LiteLLM"}),(0,t.jsx)(v.Typography.Title,{level:3,children:"reset_password"===e?"Reset Password":"Sign Up"}),(0,t.jsx)(v.Typography.Text,{children:"reset_password"===e?"Reset your password to access Admin UI.":"Claim your user account to login to Admin UI."}),"signup"===e&&(0,t.jsx)(p.Alert,{className:"mt-4",type:"info",message:"SSO",description:(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsx)("span",{children:"SSO is under the Enterprise Tier."}),(0,t.jsx)(h.Button,{type:"primary",size:"small",href:"https://forms.gle/W3U4PZpJGFHWtHyA9",target:"_blank",children:"Get Free Trial"})]}),showIcon:!0}),(0,t.jsxs)(f.Form,{className:"mt-10 mb-5",layout:"vertical",form:s,onFinish:e=>o({password:e.password}),children:[(0,t.jsx)(f.Form.Item,{label:"Email Address",name:"user_email",children:(0,t.jsx)(y.Input,{type:"email",disabled:!0})}),(0,t.jsx)(f.Form.Item,{label:"Password",name:"password",rules:[{required:!0,message:"password required to sign up"}],help:"reset_password"===e?"Enter your new password":"Create a password for your account",children:(0,t.jsx)(y.Input.Password,{})}),r&&(0,t.jsx)(p.Alert,{type:"error",message:r,showIcon:!0,className:"mb-4"}),(0,t.jsx)("div",{className:"mt-10",children:(0,t.jsx)(h.Button,{htmlType:"submit",loading:a,children:"reset_password"===e?"Reset Password":"Sign Up"})})]})]})})}function S({variant:e}){let c=(0,n.useSearchParams)().get("invitation_id"),[u,p]=i.default.useState(null),{data:h,isLoading:b,isError:f}=(e=>{let{isLoading:t}=(0,l.useUIConfig)();return(0,s.useQuery)({queryKey:d.detail(e??""),queryFn:async()=>{if(!e)throw Error("inviteId is required");return(0,r.getOnboardingCredentials)(e)},enabled:!!e&&!t})})(c),{mutate:y,isPending:v}=(0,o.useMutation)({mutationFn:async({accessToken:e,inviteId:t,userId:i,password:n})=>await (0,r.claimOnboardingToken)(e,t,i,n)}),S=h?.token?(0,a.jwtDecode)(h.token):null,x=S?.user_email??"",w=S?.user_id??null,O=S?.key??null,j=h?.token??null;return b?(0,t.jsx)(m,{}):f?(0,t.jsx)(g,{}):(0,t.jsx)($,{variant:e,userEmail:x,isPending:v,claimError:u,onSubmit:e=>{O&&j&&w&&c&&(p(null),y({accessToken:O,inviteId:c,userId:w,password:e.password},{onSuccess:()=>{document.cookie=`token=${j}; path=/; SameSite=Lax`;let e=(0,r.getProxyBaseUrl)();window.location.href=e?`${e}/ui/?login=success`:"/ui/?login=success"},onError:e=>{p(e.message||"Failed to submit. Please try again.")}}))}})}function x(){let e=(0,n.useSearchParams)().get("action");return(0,t.jsx)(S,{variant:"reset_password"===e?"reset_password":"signup"})}function w(){return(0,t.jsx)(i.Suspense,{fallback:(0,t.jsx)("div",{className:"flex items-center justify-center min-h-screen",children:"Loading..."}),children:(0,t.jsx)(x,{})})}e.s(["default",()=>w],566606)}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/1bc3743fc8144fee.js b/litellm/proxy/_experimental/out/_next/static/chunks/1bc3743fc8144fee.js new file mode 100644 index 00000000000..4718a04b56b --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/1bc3743fc8144fee.js @@ -0,0 +1 @@ +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,916925,e=>{"use strict";var t,r=((t={}).A2A_Agent="A2A Agent",t.AI21="Ai21",t.AI21_CHAT="Ai21 Chat",t.AIML="AI/ML API",t.AIOHTTP_OPENAI="Aiohttp Openai",t.Anthropic="Anthropic",t.ANTHROPIC_TEXT="Anthropic Text",t.AssemblyAI="AssemblyAI",t.AUTO_ROUTER="Auto Router",t.Bedrock="Amazon Bedrock",t.BedrockMantle="Amazon Bedrock Mantle",t.SageMaker="AWS SageMaker",t.Azure="Azure",t.Azure_AI_Studio="Azure AI Foundry (Studio)",t.AZURE_TEXT="Azure Text",t.BASETEN="Baseten",t.BYTEZ="Bytez",t.Cerebras="Cerebras",t.CLARIFAI="Clarifai",t.CLOUDFLARE="Cloudflare",t.CODESTRAL="Codestral",t.Cohere="Cohere",t.COHERE_CHAT="Cohere Chat",t.COMETAPI="Cometapi",t.COMPACTIFAI="Compactifai",t.Cursor="Cursor",t.Dashscope="Dashscope",t.Databricks="Databricks (Qwen API)",t.DATAROBOT="Datarobot",t.DeepInfra="DeepInfra",t.Deepgram="Deepgram",t.Deepseek="Deepseek",t.DOCKER_MODEL_RUNNER="Docker Model Runner",t.DOTPROMPT="Dotprompt",t.ElevenLabs="ElevenLabs",t.EMPOWER="Empower",t.FalAI="Fal AI",t.FEATHERLESS_AI="Featherless Ai",t.FireworksAI="Fireworks AI",t.FRIENDLIAI="Friendliai",t.GALADRIEL="Galadriel",t.GITHUB_COPILOT="Github Copilot",t.Google_AI_Studio="Google AI Studio",t.GradientAI="GradientAI",t.Groq="Groq",t.HEROKU="Heroku",t.Hosted_Vllm="vllm",t.HUGGINGFACE="Huggingface",t.HYPERBOLIC="Hyperbolic",t.Infinity="Infinity",t.JinaAI="Jina AI",t.LAMBDA_AI="Lambda Ai",t.LEMONADE="Lemonade",t.LLAMAFILE="Llamafile",t.LM_STUDIO="Lm Studio",t.LLAMA="Meta Llama",t.MARITALK="Maritalk",t.MiniMax="MiniMax",t.MistralAI="Mistral AI",t.MOONSHOT="Moonshot",t.MORPH="Morph",t.NEBIUS="Nebius",t.NLP_CLOUD="Nlp Cloud",t.NOVITA="Novita",t.NSCALE="Nscale",t.NVIDIA_NIM="Nvidia Nim",t.Ollama="Ollama",t.OLLAMA_CHAT="Ollama Chat",t.OOBABOOGA="Oobabooga",t.OpenAI="OpenAI",t.OPENAI_LIKE="Openai Like",t.OpenAI_Compatible="OpenAI-Compatible Endpoints (Together AI, etc.)",t.OpenAI_Text="OpenAI Text Completion",t.OpenAI_Text_Compatible="OpenAI-Compatible Text Completion Models (Together AI, etc.)",t.Openrouter="Openrouter",t.Oracle="Oracle Cloud Infrastructure (OCI)",t.OVHCLOUD="Ovhcloud",t.Perplexity="Perplexity",t.PETALS="Petals",t.PG_VECTOR="Pg Vector",t.PREDIBASE="Predibase",t.RECRAFT="Recraft",t.REPLICATE="Replicate",t.RunwayML="RunwayML",t.SAGEMAKER_LEGACY="Sagemaker",t.Sambanova="Sambanova",t.SAP="SAP Generative AI Hub",t.Snowflake="Snowflake",t.TEXT_COMPLETION_CODESTRAL="Text-Completion-Codestral",t.TogetherAI="TogetherAI",t.TOPAZ="Topaz",t.Triton="Triton",t.V0="V0",t.VERCEL_AI_GATEWAY="Vercel Ai Gateway",t.Vertex_AI="Vertex AI (Anthropic, Gemini, etc.)",t.VERTEX_AI_BETA="Vertex Ai Beta",t.VLLM="Vllm",t.VolcEngine="VolcEngine",t.Voyage="Voyage AI",t.WANDB="Wandb",t.WATSONX="Watsonx",t.WATSONX_TEXT="Watsonx Text",t.xAI="xAI",t.XINFERENCE="Xinference",t);let a={A2A_Agent:"a2a_agent",AI21:"ai21",AI21_CHAT:"ai21_chat",AIML:"aiml",AIOHTTP_OPENAI:"aiohttp_openai",Anthropic:"anthropic",ANTHROPIC_TEXT:"anthropic_text",AssemblyAI:"assemblyai",AUTO_ROUTER:"auto_router",Azure:"azure",Azure_AI_Studio:"azure_ai",AZURE_TEXT:"azure_text",BASETEN:"baseten",Bedrock:"bedrock",BedrockMantle:"bedrock_mantle",BYTEZ:"bytez",Cerebras:"cerebras",CLARIFAI:"clarifai",CLOUDFLARE:"cloudflare",CODESTRAL:"codestral",Cohere:"cohere",COHERE_CHAT:"cohere_chat",COMETAPI:"cometapi",COMPACTIFAI:"compactifai",Cursor:"cursor",Dashscope:"dashscope",Databricks:"databricks",DATAROBOT:"datarobot",DeepInfra:"deepinfra",Deepgram:"deepgram",Deepseek:"deepseek",DOCKER_MODEL_RUNNER:"docker_model_runner",DOTPROMPT:"dotprompt",ElevenLabs:"elevenlabs",EMPOWER:"empower",FalAI:"fal_ai",FEATHERLESS_AI:"featherless_ai",FireworksAI:"fireworks_ai",FRIENDLIAI:"friendliai",GALADRIEL:"galadriel",GITHUB_COPILOT:"github_copilot",Google_AI_Studio:"gemini",GradientAI:"gradient_ai",Groq:"groq",HEROKU:"heroku",Hosted_Vllm:"hosted_vllm",HUGGINGFACE:"huggingface",HYPERBOLIC:"hyperbolic",Infinity:"infinity",JinaAI:"jina_ai",LAMBDA_AI:"lambda_ai",LEMONADE:"lemonade",LLAMAFILE:"llamafile",LLAMA:"meta_llama",LM_STUDIO:"lm_studio",MARITALK:"maritalk",MiniMax:"minimax",MistralAI:"mistral",MOONSHOT:"moonshot",MORPH:"morph",NEBIUS:"nebius",NLP_CLOUD:"nlp_cloud",NOVITA:"novita",NSCALE:"nscale",NVIDIA_NIM:"nvidia_nim",Ollama:"ollama",OLLAMA_CHAT:"ollama_chat",OOBABOOGA:"oobabooga",OpenAI:"openai",OPENAI_LIKE:"openai_like",OpenAI_Compatible:"openai",OpenAI_Text:"text-completion-openai",OpenAI_Text_Compatible:"text-completion-openai",Openrouter:"openrouter",Oracle:"oci",OVHCLOUD:"ovhcloud",Perplexity:"perplexity",PETALS:"petals",PG_VECTOR:"pg_vector",PREDIBASE:"predibase",RECRAFT:"recraft",REPLICATE:"replicate",RunwayML:"runwayml",SAGEMAKER_LEGACY:"sagemaker",SageMaker:"sagemaker_chat",Sambanova:"sambanova",SAP:"sap",Snowflake:"snowflake",TEXT_COMPLETION_CODESTRAL:"text-completion-codestral",TogetherAI:"together_ai",TOPAZ:"topaz",Triton:"triton",V0:"v0",VERCEL_AI_GATEWAY:"vercel_ai_gateway",Vertex_AI:"vertex_ai",VERTEX_AI_BETA:"vertex_ai_beta",VLLM:"vllm",VolcEngine:"volcengine",Voyage:"voyage",WANDB:"wandb",WATSONX:"watsonx",WATSONX_TEXT:"watsonx_text",xAI:"xai",XINFERENCE:"xinference"},o="../ui/assets/logos/",i={"A2A Agent":`${o}a2a_agent.png`,Ai21:`${o}ai21.svg`,"Ai21 Chat":`${o}ai21.svg`,"AI/ML API":`${o}aiml_api.svg`,"Aiohttp Openai":`${o}openai_small.svg`,Anthropic:`${o}anthropic.svg`,"Anthropic Text":`${o}anthropic.svg`,AssemblyAI:`${o}assemblyai_small.png`,Azure:`${o}microsoft_azure.svg`,"Azure AI Foundry (Studio)":`${o}microsoft_azure.svg`,"Azure Text":`${o}microsoft_azure.svg`,Baseten:`${o}baseten.svg`,"Amazon Bedrock":`${o}bedrock.svg`,"Amazon Bedrock Mantle":`${o}bedrock.svg`,"AWS SageMaker":`${o}bedrock.svg`,Cerebras:`${o}cerebras.svg`,Cloudflare:`${o}cloudflare.svg`,Codestral:`${o}mistral.svg`,Cohere:`${o}cohere.svg`,"Cohere Chat":`${o}cohere.svg`,Cometapi:`${o}cometapi.svg`,Cursor:`${o}cursor.svg`,"Databricks (Qwen API)":`${o}databricks.svg`,Dashscope:`${o}dashscope.svg`,Deepseek:`${o}deepseek.svg`,Deepgram:`${o}deepgram.png`,DeepInfra:`${o}deepinfra.png`,ElevenLabs:`${o}elevenlabs.png`,"Fal AI":`${o}fal_ai.jpg`,"Featherless Ai":`${o}featherless.svg`,"Fireworks AI":`${o}fireworks.svg`,Friendliai:`${o}friendli.svg`,"Github Copilot":`${o}github_copilot.svg`,"Google AI Studio":`${o}google.svg`,GradientAI:`${o}gradientai.svg`,Groq:`${o}groq.svg`,vllm:`${o}vllm.png`,Huggingface:`${o}huggingface.svg`,Hyperbolic:`${o}hyperbolic.svg`,Infinity:`${o}infinity.png`,"Jina AI":`${o}jina.png`,"Lambda Ai":`${o}lambda.svg`,"Lm Studio":`${o}lmstudio.svg`,"Meta Llama":`${o}meta_llama.svg`,MiniMax:`${o}minimax.svg`,"Mistral AI":`${o}mistral.svg`,Moonshot:`${o}moonshot.svg`,Morph:`${o}morph.svg`,Nebius:`${o}nebius.svg`,Novita:`${o}novita.svg`,"Nvidia Nim":`${o}nvidia_nim.svg`,Ollama:`${o}ollama.svg`,"Ollama Chat":`${o}ollama.svg`,Oobabooga:`${o}openai_small.svg`,OpenAI:`${o}openai_small.svg`,"Openai Like":`${o}openai_small.svg`,"OpenAI Text Completion":`${o}openai_small.svg`,"OpenAI-Compatible Text Completion Models (Together AI, etc.)":`${o}openai_small.svg`,"OpenAI-Compatible Endpoints (Together AI, etc.)":`${o}openai_small.svg`,Openrouter:`${o}openrouter.svg`,"Oracle Cloud Infrastructure (OCI)":`${o}oracle.svg`,Perplexity:`${o}perplexity-ai.svg`,Recraft:`${o}recraft.svg`,Replicate:`${o}replicate.svg`,RunwayML:`${o}runwayml.png`,Sagemaker:`${o}bedrock.svg`,Sambanova:`${o}sambanova.svg`,"SAP Generative AI Hub":`${o}sap.png`,Snowflake:`${o}snowflake.svg`,"Text-Completion-Codestral":`${o}mistral.svg`,TogetherAI:`${o}togetherai.svg`,Topaz:`${o}topaz.svg`,Triton:`${o}nvidia_triton.png`,V0:`${o}v0.svg`,"Vercel Ai Gateway":`${o}vercel.svg`,"Vertex AI (Anthropic, Gemini, etc.)":`${o}google.svg`,"Vertex Ai Beta":`${o}google.svg`,Vllm:`${o}vllm.png`,VolcEngine:`${o}volcengine.png`,"Voyage AI":`${o}voyage.webp`,Watsonx:`${o}watsonx.svg`,"Watsonx Text":`${o}watsonx.svg`,xAI:`${o}xai.svg`,Xinference:`${o}xinference.svg`};e.s(["Providers",()=>r,"getPlaceholder",0,e=>{if("AI/ML API"===e)return"aiml/flux-pro/v1.1";if("Vertex AI (Anthropic, Gemini, etc.)"===e)return"gemini-pro";if("Anthropic"==e)return"claude-3-opus";if("Amazon Bedrock"==e)return"claude-3-opus";if("AWS SageMaker"==e)return"sagemaker/jumpstart-dft-meta-textgeneration-llama-2-7b";else if("Google AI Studio"==e)return"gemini-pro";else if("Azure AI Foundry (Studio)"==e)return"azure_ai/command-r-plus";else if("Azure"==e)return"my-deployment";else if("Oracle Cloud Infrastructure (OCI)"==e)return"oci/xai.grok-4";else if("Snowflake"==e)return"snowflake/mistral-7b";else if("Voyage AI"==e)return"voyage/";else if("Jina AI"==e)return"jina_ai/";else if("VolcEngine"==e)return"volcengine/";else if("DeepInfra"==e)return"deepinfra/";else if("Fal AI"==e)return"fal_ai/fal-ai/flux-pro/v1.1-ultra";else if("RunwayML"==e)return"runwayml/gen4_turbo";else if("Watsonx"===e)return"watsonx/ibm/granite-3-3-8b-instruct";else if("Cursor"===e)return"cursor/claude-4-sonnet";else return"gpt-3.5-turbo"},"getProviderLogoAndName",0,e=>{if(!e)return{logo:"",displayName:"-"};if("gemini"===e.toLowerCase()){let e="Google AI Studio";return{logo:i[e],displayName:e}}let t=Object.keys(a).find(t=>a[t].toLowerCase()===e.toLowerCase());if(!t)return{logo:"",displayName:e};let o=r[t];return{logo:i[o],displayName:o}},"getProviderModels",0,(e,t)=>{console.log(`Provider key: ${e}`);let r=a[e];console.log(`Provider mapped to: ${r}`);let o=[];return e&&"object"==typeof t&&(Object.entries(t).forEach(([e,t])=>{if(null!==t&&"object"==typeof t&&"litellm_provider"in t){let a=t.litellm_provider;(a===r||"string"==typeof a&&a.includes(r))&&o.push(e)}}),"Cohere"==e&&(console.log("Adding cohere chat models"),Object.entries(t).forEach(([e,t])=>{null!==t&&"object"==typeof t&&"litellm_provider"in t&&"cohere_chat"===t.litellm_provider&&o.push(e)})),"AWS SageMaker"==e&&(console.log("Adding sagemaker chat models"),Object.entries(t).forEach(([e,t])=>{null!==t&&"object"==typeof t&&"litellm_provider"in t&&"sagemaker_chat"===t.litellm_provider&&o.push(e)}))),o},"providerLogoMap",0,i,"provider_map",0,a])},362024,e=>{"use strict";var t=e.i(988122);e.s(["Collapse",()=>t.default])},152473,e=>{"use strict";var t=e.i(271645);let r={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={...r,...t}}setOptions(e){return this._options={...this._options,...e},this._options.enabled||(this._isPending=!1),this._options}getOptions(){return this._options}maybeExecute(...e){this._options.leading&&this._canLeadingExecute&&(this.executeFunction(...e),this._canLeadingExecute=!1),(this._options.leading||this._options.trailing)&&(this._isPending=!0),this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=setTimeout(()=>{this._canLeadingExecute=!0,this._isPending=!1,this._options.trailing&&this.executeFunction(...e)},this._options.wait)}executeFunction(...e){this._options.enabled&&(this.fn(...e),this._executionCount++,this._options.onExecute(this))}cancel(){this._timeoutId&&(clearTimeout(this._timeoutId),this._canLeadingExecute=!0,this._isPending=!1)}getExecutionCount(){return this._executionCount}getIsPending(){return this._options.enabled&&this._isPending}}function o(e,r){let[o,i]=(0,t.useState)(e),n=function(e,r){let[o]=(0,t.useState)(()=>{var t;return Object.getOwnPropertyNames(Object.getPrototypeOf(t=new a(e,r))).filter(e=>"function"==typeof t[e]).reduce((e,r)=>{let a=t[r];return"function"==typeof a&&(e[r]=a.bind(t)),e},{})});return o.setOptions(r),o}(i,r);return[o,n.maybeExecute,n]}e.s(["useDebouncedState",()=>o],152473)},738014,e=>{"use strict";var t=e.i(135214),r=e.i(764205),a=e.i(266027);let o=(0,e.i(243652).createQueryKeys)("users");e.s(["useCurrentUser",0,()=>{let{accessToken:e,userId:i,userRole:n}=(0,t.default)();return(0,a.useQuery)({queryKey:o.detail(i),queryFn:async()=>{let t=await (0,r.userInfoCall)(e,i,n,!1,null,null);return console.log(`userInfo: ${JSON.stringify(t)}`),t.user_info},enabled:!!(e&&i&&n)})}])},906579,e=>{"use strict";e.i(247167);var t=e.i(271645),r=e.i(343794),a=e.i(361275),o=e.i(702779),i=e.i(763731),n=e.i(242064);e.i(296059);var s=e.i(915654),l=e.i(694758),c=e.i(183293),u=e.i(403541),d=e.i(246422),m=e.i(838378);let g=new l.Keyframes("antStatusProcessing",{"0%":{transform:"scale(0.8)",opacity:.5},"100%":{transform:"scale(2.4)",opacity:0}}),p=new l.Keyframes("antZoomBadgeIn",{"0%":{transform:"scale(0) translate(50%, -50%)",opacity:0},"100%":{transform:"scale(1) translate(50%, -50%)"}}),h=new l.Keyframes("antZoomBadgeOut",{"0%":{transform:"scale(1) translate(50%, -50%)"},"100%":{transform:"scale(0) translate(50%, -50%)",opacity:0}}),f=new l.Keyframes("antNoWrapperZoomBadgeIn",{"0%":{transform:"scale(0)",opacity:0},"100%":{transform:"scale(1)"}}),b=new l.Keyframes("antNoWrapperZoomBadgeOut",{"0%":{transform:"scale(1)"},"100%":{transform:"scale(0)",opacity:0}}),v=new l.Keyframes("antBadgeLoadingCircle",{"0%":{transformOrigin:"50%"},"100%":{transform:"translate(50%, -50%) rotate(360deg)",transformOrigin:"50%"}}),A=e=>{let{fontHeight:t,lineWidth:r,marginXS:a,colorBorderBg:o}=e,i=e.colorTextLightSolid,n=e.colorError,s=e.colorErrorHover;return(0,m.mergeToken)(e,{badgeFontHeight:t,badgeShadowSize:r,badgeTextColor:i,badgeColor:n,badgeColorHover:s,badgeShadowColor:o,badgeProcessingDuration:"1.2s",badgeRibbonOffset:a,badgeRibbonCornerTransform:"scaleY(0.75)",badgeRibbonCornerFilter:"brightness(75%)"})},y=e=>{let{fontSize:t,lineHeight:r,fontSizeSM:a,lineWidth:o}=e;return{indicatorZIndex:"auto",indicatorHeight:Math.round(t*r)-2*o,indicatorHeightSM:t,dotSize:a/2,textFontSize:a,textFontSizeSM:a,textFontWeight:"normal",statusSize:a/2}},O=(0,d.genStyleHooks)("Badge",e=>(e=>{let{componentCls:t,iconCls:r,antCls:a,badgeShadowSize:o,textFontSize:i,textFontSizeSM:n,statusSize:l,dotSize:d,textFontWeight:m,indicatorHeight:A,indicatorHeightSM:y,marginXS:O,calc:C}=e,x=`${a}-scroll-number`,I=(0,u.genPresetColor)(e,(e,{darkColor:r})=>({[`&${t} ${t}-color-${e}`]:{background:r,[`&:not(${t}-count)`]:{color:r},"a:hover &":{background:r}}}));return{[t]:Object.assign(Object.assign(Object.assign(Object.assign({},(0,c.resetComponent)(e)),{position:"relative",display:"inline-block",width:"fit-content",lineHeight:1,[`${t}-count`]:{display:"inline-flex",justifyContent:"center",zIndex:e.indicatorZIndex,minWidth:A,height:A,color:e.badgeTextColor,fontWeight:m,fontSize:i,lineHeight:(0,s.unit)(A),whiteSpace:"nowrap",textAlign:"center",background:e.badgeColor,borderRadius:C(A).div(2).equal(),boxShadow:`0 0 0 ${(0,s.unit)(o)} ${e.badgeShadowColor}`,transition:`background ${e.motionDurationMid}`,a:{color:e.badgeTextColor},"a:hover":{color:e.badgeTextColor},"a:hover &":{background:e.badgeColorHover}},[`${t}-count-sm`]:{minWidth:y,height:y,fontSize:n,lineHeight:(0,s.unit)(y),borderRadius:C(y).div(2).equal()},[`${t}-multiple-words`]:{padding:`0 ${(0,s.unit)(e.paddingXS)}`,bdi:{unicodeBidi:"plaintext"}},[`${t}-dot`]:{zIndex:e.indicatorZIndex,width:d,minWidth:d,height:d,background:e.badgeColor,borderRadius:"100%",boxShadow:`0 0 0 ${(0,s.unit)(o)} ${e.badgeShadowColor}`},[`${t}-count, ${t}-dot, ${x}-custom-component`]:{position:"absolute",top:0,insetInlineEnd:0,transform:"translate(50%, -50%)",transformOrigin:"100% 0%",[`&${r}-spin`]:{animationName:v,animationDuration:"1s",animationIterationCount:"infinite",animationTimingFunction:"linear"}},[`&${t}-status`]:{lineHeight:"inherit",verticalAlign:"baseline",[`${t}-status-dot`]:{position:"relative",top:-1,display:"inline-block",width:l,height:l,verticalAlign:"middle",borderRadius:"50%"},[`${t}-status-success`]:{backgroundColor:e.colorSuccess},[`${t}-status-processing`]:{overflow:"visible",color:e.colorInfo,backgroundColor:e.colorInfo,borderColor:"currentcolor","&::after":{position:"absolute",top:0,insetInlineStart:0,width:"100%",height:"100%",borderWidth:o,borderStyle:"solid",borderColor:"inherit",borderRadius:"50%",animationName:g,animationDuration:e.badgeProcessingDuration,animationIterationCount:"infinite",animationTimingFunction:"ease-in-out",content:'""'}},[`${t}-status-default`]:{backgroundColor:e.colorTextPlaceholder},[`${t}-status-error`]:{backgroundColor:e.colorError},[`${t}-status-warning`]:{backgroundColor:e.colorWarning},[`${t}-status-text`]:{marginInlineStart:O,color:e.colorText,fontSize:e.fontSize}}}),I),{[`${t}-zoom-appear, ${t}-zoom-enter`]:{animationName:p,animationDuration:e.motionDurationSlow,animationTimingFunction:e.motionEaseOutBack,animationFillMode:"both"},[`${t}-zoom-leave`]:{animationName:h,animationDuration:e.motionDurationSlow,animationTimingFunction:e.motionEaseOutBack,animationFillMode:"both"},[`&${t}-not-a-wrapper`]:{[`${t}-zoom-appear, ${t}-zoom-enter`]:{animationName:f,animationDuration:e.motionDurationSlow,animationTimingFunction:e.motionEaseOutBack},[`${t}-zoom-leave`]:{animationName:b,animationDuration:e.motionDurationSlow,animationTimingFunction:e.motionEaseOutBack},[`&:not(${t}-status)`]:{verticalAlign:"middle"},[`${x}-custom-component, ${t}-count`]:{transform:"none"},[`${x}-custom-component, ${x}`]:{position:"relative",top:"auto",display:"block",transformOrigin:"50% 50%"}},[x]:{overflow:"hidden",transition:`all ${e.motionDurationMid} ${e.motionEaseOutBack}`,[`${x}-only`]:{position:"relative",display:"inline-block",height:A,transition:`all ${e.motionDurationSlow} ${e.motionEaseOutBack}`,WebkitTransformStyle:"preserve-3d",WebkitBackfaceVisibility:"hidden",[`> p${x}-only-unit`]:{height:A,margin:0,WebkitTransformStyle:"preserve-3d",WebkitBackfaceVisibility:"hidden"}},[`${x}-symbol`]:{verticalAlign:"top"}},"&-rtl":{direction:"rtl",[`${t}-count, ${t}-dot, ${x}-custom-component`]:{transform:"translate(-50%, -50%)"}}})}})(A(e)),y),C=(0,d.genStyleHooks)(["Badge","Ribbon"],e=>(e=>{let{antCls:t,badgeFontHeight:r,marginXS:a,badgeRibbonOffset:o,calc:i}=e,n=`${t}-ribbon`,l=`${t}-ribbon-wrapper`,d=(0,u.genPresetColor)(e,(e,{darkColor:t})=>({[`&${n}-color-${e}`]:{background:t,color:t}}));return{[l]:{position:"relative"},[n]:Object.assign(Object.assign(Object.assign(Object.assign({},(0,c.resetComponent)(e)),{position:"absolute",top:a,padding:`0 ${(0,s.unit)(e.paddingXS)}`,color:e.colorPrimary,lineHeight:(0,s.unit)(r),whiteSpace:"nowrap",backgroundColor:e.colorPrimary,borderRadius:e.borderRadiusSM,[`${n}-text`]:{color:e.badgeTextColor},[`${n}-corner`]:{position:"absolute",top:"100%",width:o,height:o,color:"currentcolor",border:`${(0,s.unit)(i(o).div(2).equal())} solid`,transform:e.badgeRibbonCornerTransform,transformOrigin:"top",filter:e.badgeRibbonCornerFilter}}),d),{[`&${n}-placement-end`]:{insetInlineEnd:i(o).mul(-1).equal(),borderEndEndRadius:0,[`${n}-corner`]:{insetInlineEnd:0,borderInlineEndColor:"transparent",borderBlockEndColor:"transparent"}},[`&${n}-placement-start`]:{insetInlineStart:i(o).mul(-1).equal(),borderEndStartRadius:0,[`${n}-corner`]:{insetInlineStart:0,borderBlockEndColor:"transparent",borderInlineStartColor:"transparent"}},"&-rtl":{direction:"rtl"}})}})(A(e)),y),x=e=>{let a,{prefixCls:o,value:i,current:n,offset:s=0}=e;return s&&(a={position:"absolute",top:`${s}00%`,left:0}),t.createElement("span",{style:a,className:(0,r.default)(`${o}-only-unit`,{current:n})},i)},I=e=>{let r,a,{prefixCls:o,count:i,value:n}=e,s=Number(n),l=Math.abs(i),[c,u]=t.useState(s),[d,m]=t.useState(l),g=()=>{u(s),m(l)};if(t.useEffect(()=>{let e=setTimeout(g,1e3);return()=>clearTimeout(e)},[s]),c===s||Number.isNaN(s)||Number.isNaN(c))r=[t.createElement(x,Object.assign({},e,{key:s,current:!0}))],a={transition:"none"};else{r=[];let o=s+10,i=[];for(let e=s;e<=o;e+=1)i.push(e);let n=de%10===c);r=(n<0?i.slice(0,u+1):i.slice(u)).map((r,a)=>t.createElement(x,Object.assign({},e,{key:r,value:r%10,offset:n<0?a-u:a,current:a===u}))),a={transform:`translateY(${-function(e,t,r){let a=e,o=0;for(;(a+10)%10!==t;)a+=r,o+=r;return o}(c,s,n)}00%)`}}return t.createElement("span",{className:`${o}-only`,style:a,onTransitionEnd:g},r)};var E=function(e,t){var r={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&0>t.indexOf(a)&&(r[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,a=Object.getOwnPropertySymbols(e);ot.indexOf(a[o])&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(r[a[o]]=e[a[o]]);return r};let _=t.forwardRef((e,a)=>{let{prefixCls:o,count:s,className:l,motionClassName:c,style:u,title:d,show:m,component:g="sup",children:p}=e,h=E(e,["prefixCls","count","className","motionClassName","style","title","show","component","children"]),{getPrefixCls:f}=t.useContext(n.ConfigContext),b=f("scroll-number",o),v=Object.assign(Object.assign({},h),{"data-show":m,style:u,className:(0,r.default)(b,l,c),title:d}),A=s;if(s&&Number(s)%1==0){let e=String(s).split("");A=t.createElement("bdi",null,e.map((r,a)=>t.createElement(I,{prefixCls:b,count:Number(s),value:r,key:e.length-a})))}return((null==u?void 0:u.borderColor)&&(v.style=Object.assign(Object.assign({},u),{boxShadow:`0 0 0 1px ${u.borderColor} inset`})),p)?(0,i.cloneElement)(p,e=>({className:(0,r.default)(`${b}-custom-component`,null==e?void 0:e.className,c)})):t.createElement(g,Object.assign({},v,{ref:a}),A)});var $=function(e,t){var r={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&0>t.indexOf(a)&&(r[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,a=Object.getOwnPropertySymbols(e);ot.indexOf(a[o])&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(r[a[o]]=e[a[o]]);return r};let T=t.forwardRef((e,s)=>{var l,c,u,d,m;let{prefixCls:g,scrollNumberPrefixCls:p,children:h,status:f,text:b,color:v,count:A=null,overflowCount:y=99,dot:C=!1,size:x="default",title:I,offset:E,style:T,className:w,rootClassName:N,classNames:S,styles:M,showZero:R=!1}=e,k=$(e,["prefixCls","scrollNumberPrefixCls","children","status","text","color","count","overflowCount","dot","size","title","offset","style","className","rootClassName","classNames","styles","showZero"]),{getPrefixCls:P,direction:L,badge:j}=t.useContext(n.ConfigContext),D=P("badge",g),[B,F,z]=O(D),H=A>y?`${y}+`:A,G="0"===H||0===H||"0"===b||0===b,V=null===A||G&&!R,W=(null!=f||null!=v)&&V,K=null!=f||!G,U=C&&!G,q=U?"":H,X=(0,t.useMemo)(()=>((null==q||""===q)&&(null==b||""===b)||G&&!R)&&!U,[q,G,R,U,b]),Q=(0,t.useRef)(A);X||(Q.current=A);let Z=Q.current,Y=(0,t.useRef)(q);X||(Y.current=q);let J=Y.current,ee=(0,t.useRef)(U);X||(ee.current=U);let et=(0,t.useMemo)(()=>{if(!E)return Object.assign(Object.assign({},null==j?void 0:j.style),T);let e={marginTop:E[1]};return"rtl"===L?e.left=Number.parseInt(E[0],10):e.right=-Number.parseInt(E[0],10),Object.assign(Object.assign(Object.assign({},e),null==j?void 0:j.style),T)},[L,E,T,null==j?void 0:j.style]),er=null!=I?I:"string"==typeof Z||"number"==typeof Z?Z:void 0,ea=!X&&(0===b?R:!!b&&!0!==b),eo=ea?t.createElement("span",{className:`${D}-status-text`},b):null,ei=Z&&"object"==typeof Z?(0,i.cloneElement)(Z,e=>({style:Object.assign(Object.assign({},et),e.style)})):void 0,en=(0,o.isPresetColor)(v,!1),es=(0,r.default)(null==S?void 0:S.indicator,null==(l=null==j?void 0:j.classNames)?void 0:l.indicator,{[`${D}-status-dot`]:W,[`${D}-status-${f}`]:!!f,[`${D}-color-${v}`]:en}),el={};v&&!en&&(el.color=v,el.background=v);let ec=(0,r.default)(D,{[`${D}-status`]:W,[`${D}-not-a-wrapper`]:!h,[`${D}-rtl`]:"rtl"===L},w,N,null==j?void 0:j.className,null==(c=null==j?void 0:j.classNames)?void 0:c.root,null==S?void 0:S.root,F,z);if(!h&&W&&(b||K||!V)){let e=et.color;return B(t.createElement("span",Object.assign({},k,{className:ec,style:Object.assign(Object.assign(Object.assign({},null==M?void 0:M.root),null==(u=null==j?void 0:j.styles)?void 0:u.root),et)}),t.createElement("span",{className:es,style:Object.assign(Object.assign(Object.assign({},null==M?void 0:M.indicator),null==(d=null==j?void 0:j.styles)?void 0:d.indicator),el)}),ea&&t.createElement("span",{style:{color:e},className:`${D}-status-text`},b)))}return B(t.createElement("span",Object.assign({ref:s},k,{className:ec,style:Object.assign(Object.assign({},null==(m=null==j?void 0:j.styles)?void 0:m.root),null==M?void 0:M.root)}),h,t.createElement(a.default,{visible:!X,motionName:`${D}-zoom`,motionAppear:!1,motionDeadline:1e3},({className:e})=>{var a,o;let i=P("scroll-number",p),n=ee.current,s=(0,r.default)(null==S?void 0:S.indicator,null==(a=null==j?void 0:j.classNames)?void 0:a.indicator,{[`${D}-dot`]:n,[`${D}-count`]:!n,[`${D}-count-sm`]:"small"===x,[`${D}-multiple-words`]:!n&&J&&J.toString().length>1,[`${D}-status-${f}`]:!!f,[`${D}-color-${v}`]:en}),l=Object.assign(Object.assign(Object.assign({},null==M?void 0:M.indicator),null==(o=null==j?void 0:j.styles)?void 0:o.indicator),et);return v&&!en&&((l=l||{}).background=v),t.createElement(_,{prefixCls:i,show:!X,motionClassName:e,className:s,count:J,title:er,style:l,key:"scrollNumber"},ei)}),eo))});T.Ribbon=e=>{let{className:a,prefixCls:i,style:s,color:l,children:c,text:u,placement:d="end",rootClassName:m}=e,{getPrefixCls:g,direction:p}=t.useContext(n.ConfigContext),h=g("ribbon",i),f=`${h}-wrapper`,[b,v,A]=C(h,f),y=(0,o.isPresetColor)(l,!1),O=(0,r.default)(h,`${h}-placement-${d}`,{[`${h}-rtl`]:"rtl"===p,[`${h}-color-${l}`]:y},a),x={},I={};return l&&!y&&(x.background=l,I.color=l),b(t.createElement("div",{className:(0,r.default)(f,m,v,A)},c,t.createElement("div",{className:(0,r.default)(O,v),style:Object.assign(Object.assign({},x),s)},t.createElement("span",{className:`${h}-text`},u),t.createElement("div",{className:`${h}-corner`,style:I}))))},e.s(["Badge",0,T],906579)},621482,e=>{"use strict";var t=e.i(869230),r=e.i(992571),a=class extends t.QueryObserver{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){super.setOptions({...e,behavior:(0,r.infiniteQueryBehavior)()})}getOptimisticResult(e){return e.behavior=(0,r.infiniteQueryBehavior)(),super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,t){let{state:a}=e,o=super.createResult(e,t),{isFetching:i,isRefetching:n,isError:s,isRefetchError:l}=o,c=a.fetchMeta?.fetchMore?.direction,u=s&&"forward"===c,d=i&&"forward"===c,m=s&&"backward"===c,g=i&&"backward"===c;return{...o,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:(0,r.hasNextPage)(t,a.data),hasPreviousPage:(0,r.hasPreviousPage)(t,a.data),isFetchNextPageError:u,isFetchingNextPage:d,isFetchPreviousPageError:m,isFetchingPreviousPage:g,isRefetchError:l&&!u&&!m,isRefetching:n&&!d&&!g}}},o=e.i(469637);function i(e,t){return(0,o.useBaseQuery)(e,a,t)}e.s(["useInfiniteQuery",()=>i],621482)},785242,e=>{"use strict";var t=e.i(619273),r=e.i(266027),a=e.i(912598),o=e.i(135214),i=e.i(270345),n=e.i(243652),s=e.i(764205);let l=(0,n.createQueryKeys)("teams"),c=async(e,t,r,a={})=>{try{let o=(0,s.getProxyBaseUrl)(),i=new URLSearchParams(Object.entries({team_id:a.teamID,organization_id:a.organizationID,team_alias:a.team_alias,user_id:a.userID,page:t,page_size:r,sort_by:a.sortBy,sort_order:a.sortOrder,status:"deleted"}).filter(([,e])=>null!=e).map(([e,t])=>[e,String(t)])),n=`${o?`${o}/v2/team/list`:"/v2/team/list"}?${i}`,l=await fetch(n,{method:"GET",headers:{[(0,s.getGlobalLitellmHeaderName)()]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!l.ok){let e=await l.json(),t=(0,s.deriveErrorMessage)(e);throw(0,s.handleError)(t),Error(t)}let c=await l.json();if(console.log("/team/list?status=deleted API Response:",c),c&&"object"==typeof c&&"teams"in c)return c.teams;return c}catch(e){throw console.error("Failed to list deleted teams:",e),e}},u=(0,n.createQueryKeys)("deletedTeams");e.s(["useDeletedTeams",0,(e,a,i={})=>{let{accessToken:n}=(0,o.default)();return(0,r.useQuery)({queryKey:u.list({page:e,limit:a,...i}),queryFn:async()=>await c(n,e,a,i),enabled:!!n,staleTime:3e4,placeholderData:t.keepPreviousData})},"useTeam",0,e=>{let{accessToken:t}=(0,o.default)(),i=(0,a.useQueryClient)();return(0,r.useQuery)({queryKey:l.detail(e),enabled:!!(t&&e),queryFn:async()=>{if(!t||!e)throw Error("Missing auth or teamId");return(0,s.teamInfoCall)(t,e)},initialData:()=>{if(!e)return;let t=i.getQueryData(l.list({}));return t?.find(t=>t.team_id===e)}})},"useTeams",0,()=>{let{accessToken:e,userId:t,userRole:a}=(0,o.default)();return(0,r.useQuery)({queryKey:l.list({}),queryFn:async()=>await (0,i.fetchTeams)(e,t,a,null),enabled:!!e})}])},980187,e=>{"use strict";e.s(["createTeamAliasMap",0,e=>e?e.reduce((e,t)=>(e[t.team_id]=t.team_alias,e),{}):{},"resolveTeamAliasFromTeamID",0,(e,t)=>{let r=t.find(t=>t.team_id===e);return r?r.team_alias:null}])},571303,e=>{"use strict";var t=e.i(843476),r=e.i(271645),a=e.i(115504);function o({className:e="",...o}){var i,n;let s=(0,r.useId)();return i=()=>{let e=document.getAnimations().filter(e=>e instanceof CSSAnimation&&"spin"===e.animationName),t=e.find(e=>e.effect.target?.getAttribute("data-spinner-id")===s),r=e.find(e=>e.effect instanceof KeyframeEffect&&e.effect.target?.getAttribute("data-spinner-id")!==s);t&&r&&(t.currentTime=r.currentTime)},n=[s],(0,r.useLayoutEffect)(i,n),(0,t.jsxs)("svg",{"data-spinner-id":s,className:(0,a.cx)("pointer-events-none size-12 animate-spin text-current",e),fill:"none",viewBox:"0 0 24 24",...o,children:[(0,t.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,t.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})}e.s(["UiLoadingSpinner",()=>o],571303)},366283,e=>{"use strict";var t=e.i(290571),r=e.i(271645),a=e.i(95779),o=e.i(444755),i=e.i(673706);let n=(0,i.makeClassName)("Callout"),s=r.default.forwardRef((e,s)=>{let{title:l,icon:c,color:u,className:d,children:m}=e,g=(0,t.__rest)(e,["title","icon","color","className","children"]);return r.default.createElement("div",Object.assign({ref:s,className:(0,o.tremorTwMerge)(n("root"),"flex flex-col overflow-hidden rounded-tremor-default text-tremor-default border-l-4 py-3 pr-3 pl-4",u?(0,o.tremorTwMerge)((0,i.getColorClassNames)(u,a.colorPalette.background).bgColor,(0,i.getColorClassNames)(u,a.colorPalette.darkBorder).borderColor,(0,i.getColorClassNames)(u,a.colorPalette.darkText).textColor,"dark:bg-opacity-10 bg-opacity-10"):(0,o.tremorTwMerge)("bg-tremor-brand-faint border-tremor-brand-emphasis text-tremor-brand-emphasis","dark:bg-dark-tremor-brand-muted/70 dark:border-dark-tremor-brand-emphasis dark:text-dark-tremor-brand-emphasis"),d)},g),r.default.createElement("div",{className:(0,o.tremorTwMerge)(n("header"),"flex items-start")},c?r.default.createElement(c,{className:(0,o.tremorTwMerge)(n("icon"),"flex-none h-5 w-5 mr-1.5")}):null,r.default.createElement("h4",{className:(0,o.tremorTwMerge)(n("title"),"font-semibold")},l)),r.default.createElement("p",{className:(0,o.tremorTwMerge)(n("body"),"overflow-y-auto",m?"mt-2":"")},m))});s.displayName="Callout",e.s(["Callout",()=>s],366283)},418371,e=>{"use strict";var t=e.i(843476),r=e.i(271645),a=e.i(916925);e.s(["ProviderLogo",0,({provider:e,className:o="w-4 h-4"})=>{let[i,n]=(0,r.useState)(!1),{logo:s}=(0,a.getProviderLogoAndName)(e);return i||!s?(0,t.jsx)("div",{className:`${o} rounded-full bg-gray-200 flex items-center justify-center text-xs`,children:e?.charAt(0)||"-"}):(0,t.jsx)("img",{src:s,alt:`${e} logo`,className:o,onError:()=>n(!0)})}])},37091,e=>{"use strict";var t=e.i(290571),r=e.i(95779),a=e.i(444755),o=e.i(673706),i=e.i(271645);let n=i.default.forwardRef((e,n)=>{let{color:s,children:l,className:c}=e,u=(0,t.__rest)(e,["color","children","className"]);return i.default.createElement("p",Object.assign({ref:n,className:(0,a.tremorTwMerge)(s?(0,o.getColorClassNames)(s,r.colorPalette.lightText).textColor:"text-tremor-content-emphasis dark:text-dark-tremor-content-emphasis",c)},u),l)});n.displayName="Subtitle",e.s(["Subtitle",()=>n],37091)},214541,e=>{"use strict";var t=e.i(271645),r=e.i(135214),a=e.i(270345);e.s(["default",0,()=>{let[e,o]=(0,t.useState)([]),{accessToken:i,userId:n,userRole:s}=(0,r.default)();return(0,t.useEffect)(()=>{(async()=>{o(await (0,a.fetchTeams)(i,n,s,null))})()},[i,n,s]),{teams:e,setTeams:o}}])},439189,435684,96226,497245,e=>{"use strict";function t(e){let t=Object.prototype.toString.call(e);return e instanceof Date||"object"==typeof e&&"[object Date]"===t?new e.constructor(+e):new Date("number"==typeof e||"[object Number]"===t||"string"==typeof e||"[object String]"===t?e:NaN)}function r(e,t){return e instanceof Date?new e.constructor(t):new Date(t)}function a(e,a){let o=t(e);return isNaN(a)?r(e,NaN):(a&&o.setDate(o.getDate()+a),o)}function o(e,a){let o=t(e);if(isNaN(a))return r(e,NaN);if(!a)return o;let i=o.getDate(),n=r(e,o.getTime());return(n.setMonth(o.getMonth()+a+1,0),i>=n.getDate())?n:(o.setFullYear(n.getFullYear(),n.getMonth(),i),o)}e.s(["toDate",()=>t],435684),e.s(["constructFrom",()=>r],96226),e.s(["addDays",()=>a],439189),e.s(["addMonths",()=>o],497245)},954616,e=>{"use strict";var t=e.i(271645),r=e.i(114272),a=e.i(540143),o=e.i(915823),i=e.i(619273),n=class extends o.Subscribable{#e;#t=void 0;#r;#a;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,i.shallowEqualObjects)(this.options,t)||this.#e.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#r,observer:this}),t?.mutationKey&&this.options.mutationKey&&(0,i.hashKey)(t.mutationKey)!==(0,i.hashKey)(this.options.mutationKey)?this.reset():this.#r?.state.status==="pending"&&this.#r.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#r?.removeObserver(this)}onMutationUpdate(e){this.#o(),this.#i(e)}getCurrentResult(){return this.#t}reset(){this.#r?.removeObserver(this),this.#r=void 0,this.#o(),this.#i()}mutate(e,t){return this.#a=t,this.#r?.removeObserver(this),this.#r=this.#e.getMutationCache().build(this.#e,this.options),this.#r.addObserver(this),this.#r.execute(e)}#o(){let e=this.#r?.state??(0,r.getDefaultState)();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}}#i(e){a.notifyManager.batch(()=>{if(this.#a&&this.hasListeners()){let t=this.#t.variables,r=this.#t.context,a={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type==="success"){try{this.#a.onSuccess?.(e.data,t,r,a)}catch(e){Promise.reject(e)}try{this.#a.onSettled?.(e.data,null,t,r,a)}catch(e){Promise.reject(e)}}else if(e?.type==="error"){try{this.#a.onError?.(e.error,t,r,a)}catch(e){Promise.reject(e)}try{this.#a.onSettled?.(void 0,e.error,t,r,a)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},s=e.i(912598);function l(e,r){let o=(0,s.useQueryClient)(r),[l]=t.useState(()=>new n(o,e));t.useEffect(()=>{l.setOptions(e)},[l,e]);let c=t.useSyncExternalStore(t.useCallback(e=>l.subscribe(a.notifyManager.batchCalls(e)),[l]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),u=t.useCallback((e,t)=>{l.mutate(e,t).catch(i.noop)},[l]);if(c.error&&(0,i.shouldThrowError)(l.options.throwOnError,[c.error]))throw c.error;return{...c,mutate:u,mutateAsync:c.mutate}}e.s(["useMutation",()=>l],954616)},891547,e=>{"use strict";var t=e.i(843476),r=e.i(271645),a=e.i(199133),o=e.i(764205);e.s(["default",0,({onChange:e,value:i,className:n,accessToken:s,disabled:l})=>{let[c,u]=(0,r.useState)([]),[d,m]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{(async()=>{if(s){m(!0);try{let e=await (0,o.getGuardrailsList)(s);console.log("Guardrails response:",e),e.guardrails&&(console.log("Guardrails data:",e.guardrails),u(e.guardrails))}catch(e){console.error("Error fetching guardrails:",e)}finally{m(!1)}}})()},[s]),(0,t.jsx)("div",{children:(0,t.jsx)(a.Select,{mode:"multiple",disabled:l,placeholder:l?"Setting guardrails is a premium feature.":"Select guardrails",onChange:t=>{console.log("Selected guardrails:",t),e(t)},value:i,loading:d,className:n,allowClear:!0,options:c.map(e=>(console.log("Mapping guardrail:",e),{label:`${e.guardrail_name}`,value:e.guardrail_name})),optionFilterProp:"label",showSearch:!0,style:{width:"100%"}})})}])},921511,e=>{"use strict";var t=e.i(843476),r=e.i(271645),a=e.i(199133),o=e.i(764205);function i(e){return e.filter(e=>(e.version_status??"draft")!=="draft").map(e=>{var t;let r=e.version_number??1,a=e.version_status??"draft";return{label:`${e.policy_name} — v${r} (${a})${e.description?` — ${e.description}`:""}`,value:"production"===a?e.policy_name:e.policy_id?(t=e.policy_id,`policy_${t}`):e.policy_name}})}e.s(["default",0,({onChange:e,value:n,className:s,accessToken:l,disabled:c,onPoliciesLoaded:u})=>{let[d,m]=(0,r.useState)([]),[g,p]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{(async()=>{if(l){p(!0);try{let e=await (0,o.getPoliciesList)(l);e.policies&&(m(e.policies),u?.(e.policies))}catch(e){console.error("Error fetching policies:",e)}finally{p(!1)}}})()},[l,u]),(0,t.jsx)("div",{children:(0,t.jsx)(a.Select,{mode:"multiple",disabled:c,placeholder:c?"Setting policies is a premium feature.":"Select policies (production or published versions)",onChange:t=>{e(t)},value:n,loading:g,className:s,allowClear:!0,options:i(d),optionFilterProp:"label",showSearch:!0,style:{width:"100%"}})})},"getPolicyOptionEntries",()=>i])},637235,e=>{"use strict";e.i(247167);var t=e.i(931067),r=e.i(271645);let a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}},{tag:"path",attrs:{d:"M686.7 638.6L544.1 535.5V288c0-4.4-3.6-8-8-8H488c-4.4 0-8 3.6-8 8v275.4c0 2.6 1.2 5 3.3 6.5l165.4 120.6c3.6 2.6 8.6 1.8 11.2-1.7l28.6-39c2.6-3.7 1.8-8.7-1.8-11.2z"}}]},name:"clock-circle",theme:"outlined"};var o=e.i(9583),i=r.forwardRef(function(e,i){return r.createElement(o.default,(0,t.default)({},e,{ref:i,icon:a}))});e.s(["ClockCircleOutlined",0,i],637235)},646563,e=>{"use strict";var t=e.i(959013);e.s(["PlusOutlined",()=>t.default])},447566,e=>{"use strict";e.i(247167);var t=e.i(931067),r=e.i(271645);let a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M872 474H286.9l350.2-304c5.6-4.9 2.2-14-5.2-14h-88.5c-3.9 0-7.6 1.4-10.5 3.9L155 487.8a31.96 31.96 0 000 48.3L535.1 866c1.5 1.3 3.3 2 5.2 2h91.5c7.4 0 10.8-9.2 5.2-14L286.9 550H872c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z"}}]},name:"arrow-left",theme:"outlined"};var o=e.i(9583),i=r.forwardRef(function(e,i){return r.createElement(o.default,(0,t.default)({},e,{ref:i,icon:a}))});e.s(["ArrowLeftOutlined",0,i],447566)},149121,e=>{"use strict";var t=e.i(843476),r=e.i(271645),a=e.i(152990),o=e.i(682830),i=e.i(269200),n=e.i(427612),s=e.i(64848),l=e.i(942232),c=e.i(496020),u=e.i(977572);function d({data:e=[],columns:d,onRowClick:m,renderSubComponent:g,renderChildRows:p,getRowCanExpand:h,isLoading:f=!1,loadingMessage:b="🚅 Loading logs...",noDataMessage:v="No logs found",enableSorting:A=!1}){let y=!!(g||p)&&!!h,[O,C]=(0,r.useState)([]),x=(0,a.useReactTable)({data:e,columns:d,...A&&{state:{sorting:O},onSortingChange:C,enableSortingRemoval:!1},...y&&{getRowCanExpand:h},getRowId:(e,t)=>e?.request_id??String(t),getCoreRowModel:(0,o.getCoreRowModel)(),...A&&{getSortedRowModel:(0,o.getSortedRowModel)()},...y&&{getExpandedRowModel:(0,o.getExpandedRowModel)()}});return(0,t.jsx)("div",{className:"rounded-lg custom-border overflow-x-auto w-full max-w-full box-border",children:(0,t.jsxs)(i.Table,{className:"[&_td]:py-0.5 [&_th]:py-1 table-fixed w-full box-border",style:{minWidth:"400px"},children:[(0,t.jsx)(n.TableHead,{children:x.getHeaderGroups().map(e=>(0,t.jsx)(c.TableRow,{children:e.headers.map(e=>{let r=A&&e.column.getCanSort(),o=e.column.getIsSorted();return(0,t.jsx)(s.TableHeaderCell,{className:`py-1 h-8 ${r?"cursor-pointer select-none hover:bg-gray-50":""}`,onClick:r?e.column.getToggleSortingHandler():void 0,children:e.isPlaceholder?null:(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.flexRender)(e.column.columnDef.header,e.getContext()),r&&(0,t.jsx)("span",{className:"text-gray-400",children:"asc"===o?"↑":"desc"===o?"↓":"⇅"})]})},e.id)})},e.id))}),(0,t.jsx)(l.TableBody,{children:f?(0,t.jsx)(c.TableRow,{children:(0,t.jsx)(u.TableCell,{colSpan:d.length,className:"h-8 text-center",children:(0,t.jsx)("div",{className:"text-center text-gray-500",children:(0,t.jsx)("p",{children:b})})})}):x.getRowModel().rows.length>0?x.getRowModel().rows.map(e=>(0,t.jsxs)(r.Fragment,{children:[(0,t.jsx)(c.TableRow,{className:`h-8 ${m?"cursor-pointer hover:bg-gray-50":""}`,onClick:()=>m?.(e.original),children:e.getVisibleCells().map(e=>(0,t.jsx)(u.TableCell,{className:"py-0.5 max-h-8 overflow-hidden text-ellipsis whitespace-nowrap",children:(0,a.flexRender)(e.column.columnDef.cell,e.getContext())},e.id))}),y&&e.getIsExpanded()&&p&&p({row:e}),y&&e.getIsExpanded()&&g&&!p&&(0,t.jsx)(c.TableRow,{children:(0,t.jsx)(u.TableCell,{colSpan:e.getVisibleCells().length,className:"p-0",children:(0,t.jsx)("div",{className:"w-full max-w-full overflow-hidden box-border",children:g({row:e})})})})]},e.id)):(0,t.jsx)(c.TableRow,{children:(0,t.jsx)(u.TableCell,{colSpan:d.length,className:"h-8 text-center",children:(0,t.jsx)("div",{className:"text-center text-gray-500",children:(0,t.jsx)("p",{children:v})})})})})]})})}e.s(["DataTable",()=>d])},986888,e=>{"use strict";var t=e.i(843476),r=e.i(797305),a=e.i(135214),o=e.i(214541);e.s(["default",0,()=>{let{accessToken:e,userRole:i,userId:n,premiumUser:s}=(0,a.default)(),{teams:l}=(0,o.default)();return(0,t.jsx)(r.default,{teams:l??[],organizations:[]})}])},601236,e=>{e.v(e=>Promise.resolve().then(()=>e(764205)))}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/1d3826d625e92c33.js b/litellm/proxy/_experimental/out/_next/static/chunks/1d3826d625e92c33.js deleted file mode 100644 index 45ddb350696..00000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/1d3826d625e92c33.js +++ /dev/null @@ -1,2 +0,0 @@ -(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,309426,e=>{"use strict";var t=e.i(290571),r=e.i(444755),n=e.i(673706),l=e.i(271645),o=e.i(46757);let a=(0,n.makeClassName)("Col"),s=l.default.forwardRef((e,n)=>{let s,u,i,c,{numColSpan:d=1,numColSpanSm:f,numColSpanMd:p,numColSpanLg:m,children:v,className:b}=e,g=(0,t.__rest)(e,["numColSpan","numColSpanSm","numColSpanMd","numColSpanLg","children","className"]),h=(e,t)=>e&&Object.keys(t).includes(String(e))?t[e]:"";return l.default.createElement("div",Object.assign({ref:n,className:(0,r.tremorTwMerge)(a("root"),(s=h(d,o.colSpan),u=h(f,o.colSpanSm),i=h(p,o.colSpanMd),c=h(m,o.colSpanLg),(0,r.tremorTwMerge)(s,u,i,c)),b)},g),v)});s.displayName="Col",e.s(["Col",()=>s],309426)},435451,620250,e=>{"use strict";var t=e.i(843476),r=e.i(290571),n=e.i(271645);let l=e=>{var t=(0,r.__rest)(e,[]);return n.default.createElement("svg",Object.assign({},t,{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2.5"}),n.default.createElement("path",{d:"M12 4v16m8-8H4"}))},o=e=>{var t=(0,r.__rest)(e,[]);return n.default.createElement("svg",Object.assign({},t,{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2.5"}),n.default.createElement("path",{d:"M20 12H4"}))};var a=e.i(444755),s=e.i(673706),u=e.i(677955);let i="flex mx-auto text-tremor-content-subtle dark:text-dark-tremor-content-subtle",c="cursor-pointer hover:text-tremor-content dark:hover:text-dark-tremor-content",d=n.default.forwardRef((e,t)=>{let{onSubmit:d,enableStepper:f=!0,disabled:p,onValueChange:m,onChange:v}=e,b=(0,r.__rest)(e,["onSubmit","enableStepper","disabled","onValueChange","onChange"]),g=(0,n.useRef)(null),[h,y]=n.default.useState(!1),E=n.default.useCallback(()=>{y(!0)},[]),C=n.default.useCallback(()=>{y(!1)},[]),[S,x]=n.default.useState(!1),k=n.default.useCallback(()=>{x(!0)},[]),w=n.default.useCallback(()=>{x(!1)},[]);return n.default.createElement(u.default,Object.assign({type:"number",ref:(0,s.mergeRefs)([g,t]),disabled:p,makeInputClassName:(0,s.makeClassName)("NumberInput"),onKeyDown:e=>{var t;if("Enter"===e.key&&!e.ctrlKey&&!e.altKey&&!e.shiftKey){let e=null==(t=g.current)?void 0:t.value;null==d||d(parseFloat(null!=e?e:""))}"ArrowDown"===e.key&&E(),"ArrowUp"===e.key&&k()},onKeyUp:e=>{"ArrowDown"===e.key&&C(),"ArrowUp"===e.key&&w()},onChange:e=>{p||(null==m||m(parseFloat(e.target.value)),null==v||v(e))},stepper:f?n.default.createElement("div",{className:(0,a.tremorTwMerge)("flex justify-center align-middle")},n.default.createElement("div",{tabIndex:-1,onClick:e=>e.preventDefault(),onMouseDown:e=>e.preventDefault(),onTouchStart:e=>{e.cancelable&&e.preventDefault()},onMouseUp:()=>{var e,t;p||(null==(e=g.current)||e.stepDown(),null==(t=g.current)||t.dispatchEvent(new Event("input",{bubbles:!0})))},className:(0,a.tremorTwMerge)(!p&&c,i,"group py-[10px] px-2.5 border-l border-tremor-border dark:border-dark-tremor-border")},n.default.createElement(o,{"data-testid":"step-down",className:(h?"scale-95":"")+" h-4 w-4 duration-75 transition group-active:scale-95"})),n.default.createElement("div",{tabIndex:-1,onClick:e=>e.preventDefault(),onMouseDown:e=>e.preventDefault(),onTouchStart:e=>{e.cancelable&&e.preventDefault()},onMouseUp:()=>{var e,t;p||(null==(e=g.current)||e.stepUp(),null==(t=g.current)||t.dispatchEvent(new Event("input",{bubbles:!0})))},className:(0,a.tremorTwMerge)(!p&&c,i,"group py-[10px] px-2.5 border-l border-tremor-border dark:border-dark-tremor-border")},n.default.createElement(l,{"data-testid":"step-up",className:(S?"scale-95":"")+" h-4 w-4 duration-75 transition group-active:scale-95"}))):null},b))});d.displayName="NumberInput",e.s(["NumberInput",()=>d],620250),e.s(["default",0,({step:e=.01,style:r={width:"100%"},placeholder:n="Enter a numerical value",min:l,max:o,onChange:a,...s})=>(0,t.jsx)(d,{onWheel:e=>e.currentTarget.blur(),step:e,style:r,placeholder:n,min:l,max:o,onChange:a,...s})],435451)},677667,674175,886148,543086,e=>{"use strict";let t,r;var n,l=e.i(290571),o=e.i(429427),a=e.i(371330),s=e.i(271645),u=e.i(394487),i=e.i(914189),c=e.i(144279),d=e.i(294316),f=e.i(83733);let p=(0,s.createContext)(()=>{});function m({value:e,children:t}){return s.default.createElement(p.Provider,{value:e},t)}e.s(["CloseProvider",()=>m],674175);var v=e.i(233137),b=e.i(233538),g=e.i(397701),h=e.i(402155),y=e.i(700020);let E=null!=(n=s.default.startTransition)?n:function(e){e()};var C=e.i(998348),S=((t=S||{})[t.Open=0]="Open",t[t.Closed=1]="Closed",t),x=((r=x||{})[r.ToggleDisclosure=0]="ToggleDisclosure",r[r.CloseDisclosure=1]="CloseDisclosure",r[r.SetButtonId=2]="SetButtonId",r[r.SetPanelId=3]="SetPanelId",r[r.SetButtonElement=4]="SetButtonElement",r[r.SetPanelElement=5]="SetPanelElement",r);let k={0:e=>({...e,disclosureState:(0,g.match)(e.disclosureState,{0:1,1:0})}),1:e=>1===e.disclosureState?e:{...e,disclosureState:1},2:(e,t)=>e.buttonId===t.buttonId?e:{...e,buttonId:t.buttonId},3:(e,t)=>e.panelId===t.panelId?e:{...e,panelId:t.panelId},4:(e,t)=>e.buttonElement===t.element?e:{...e,buttonElement:t.element},5:(e,t)=>e.panelElement===t.element?e:{...e,panelElement:t.element}},w=(0,s.createContext)(null);function T(e){let t=(0,s.useContext)(w);if(null===t){let t=Error(`<${e} /> is missing a parent component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,T),t}return t}w.displayName="DisclosureContext";let O=(0,s.createContext)(null);O.displayName="DisclosureAPIContext";let D=(0,s.createContext)(null);function I(e,t){return(0,g.match)(t.type,k,e,t)}D.displayName="DisclosurePanelContext";let P=s.Fragment,N=y.RenderFeatures.RenderStrategy|y.RenderFeatures.Static,M=Object.assign((0,y.forwardRefWithAs)(function(e,t){let{defaultOpen:r=!1,...n}=e,l=(0,s.useRef)(null),o=(0,d.useSyncRefs)(t,(0,d.optionalRef)(e=>{l.current=e},void 0===e.as||e.as===s.Fragment)),a=(0,s.useReducer)(I,{disclosureState:+!r,buttonElement:null,panelElement:null,buttonId:null,panelId:null}),[{disclosureState:u,buttonId:c},f]=a,p=(0,i.useEvent)(e=>{f({type:1});let t=(0,h.getOwnerDocument)(l);if(!t||!c)return;let r=e?e instanceof HTMLElement?e:e.current instanceof HTMLElement?e.current:t.getElementById(c):t.getElementById(c);null==r||r.focus()}),b=(0,s.useMemo)(()=>({close:p}),[p]),E=(0,s.useMemo)(()=>({open:0===u,close:p}),[u,p]),C=(0,y.useRender)();return s.default.createElement(w.Provider,{value:a},s.default.createElement(O.Provider,{value:b},s.default.createElement(m,{value:p},s.default.createElement(v.OpenClosedProvider,{value:(0,g.match)(u,{0:v.State.Open,1:v.State.Closed})},C({ourProps:{ref:o},theirProps:n,slot:E,defaultTag:P,name:"Disclosure"})))))}),{Button:(0,y.forwardRefWithAs)(function(e,t){let r=(0,s.useId)(),{id:n=`headlessui-disclosure-button-${r}`,disabled:l=!1,autoFocus:f=!1,...p}=e,[m,v]=T("Disclosure.Button"),g=(0,s.useContext)(D),h=null!==g&&g===m.panelId,E=(0,s.useRef)(null),S=(0,d.useSyncRefs)(E,t,(0,i.useEvent)(e=>{if(!h)return v({type:4,element:e})}));(0,s.useEffect)(()=>{if(!h)return v({type:2,buttonId:n}),()=>{v({type:2,buttonId:null})}},[n,v,h]);let x=(0,i.useEvent)(e=>{var t;if(h){if(1===m.disclosureState)return;switch(e.key){case C.Keys.Space:case C.Keys.Enter:e.preventDefault(),e.stopPropagation(),v({type:0}),null==(t=m.buttonElement)||t.focus()}}else switch(e.key){case C.Keys.Space:case C.Keys.Enter:e.preventDefault(),e.stopPropagation(),v({type:0})}}),k=(0,i.useEvent)(e=>{e.key===C.Keys.Space&&e.preventDefault()}),w=(0,i.useEvent)(e=>{var t;(0,b.isDisabledReactIssue7711)(e.currentTarget)||l||(h?(v({type:0}),null==(t=m.buttonElement)||t.focus()):v({type:0}))}),{isFocusVisible:O,focusProps:I}=(0,o.useFocusRing)({autoFocus:f}),{isHovered:P,hoverProps:N}=(0,a.useHover)({isDisabled:l}),{pressed:M,pressProps:A}=(0,u.useActivePress)({disabled:l}),R=(0,s.useMemo)(()=>({open:0===m.disclosureState,hover:P,active:M,disabled:l,focus:O,autofocus:f}),[m,P,M,O,l,f]),F=(0,c.useResolveButtonType)(e,m.buttonElement),j=h?(0,y.mergeProps)({ref:S,type:F,disabled:l||void 0,autoFocus:f,onKeyDown:x,onClick:w},I,N,A):(0,y.mergeProps)({ref:S,id:n,type:F,"aria-expanded":0===m.disclosureState,"aria-controls":m.panelElement?m.panelId:void 0,disabled:l||void 0,autoFocus:f,onKeyDown:x,onKeyUp:k,onClick:w},I,N,A);return(0,y.useRender)()({ourProps:j,theirProps:p,slot:R,defaultTag:"button",name:"Disclosure.Button"})}),Panel:(0,y.forwardRefWithAs)(function(e,t){let r=(0,s.useId)(),{id:n=`headlessui-disclosure-panel-${r}`,transition:l=!1,...o}=e,[a,u]=T("Disclosure.Panel"),{close:c}=function e(t){let r=(0,s.useContext)(O);if(null===r){let r=Error(`<${t} /> is missing a parent component.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,e),r}return r}("Disclosure.Panel"),[p,m]=(0,s.useState)(null),b=(0,d.useSyncRefs)(t,(0,i.useEvent)(e=>{E(()=>u({type:5,element:e}))}),m);(0,s.useEffect)(()=>(u({type:3,panelId:n}),()=>{u({type:3,panelId:null})}),[n,u]);let g=(0,v.useOpenClosed)(),[h,C]=(0,f.useTransition)(l,p,null!==g?(g&v.State.Open)===v.State.Open:0===a.disclosureState),S=(0,s.useMemo)(()=>({open:0===a.disclosureState,close:c}),[a.disclosureState,c]),x={ref:b,id:n,...(0,f.transitionDataAttributes)(C)},k=(0,y.useRender)();return s.default.createElement(v.ResetOpenClosedProvider,null,s.default.createElement(D.Provider,{value:a.panelId},k({ourProps:x,theirProps:o,slot:S,defaultTag:"div",features:N,visible:h,name:"Disclosure.Panel"})))})});e.s(["Disclosure",()=>M],886148);let A=(0,s.createContext)(void 0);var R=e.i(444755);let F=(0,e.i(673706).makeClassName)("Accordion"),j=(0,s.createContext)({isOpen:!1}),L=s.default.forwardRef((e,t)=>{var r;let{defaultOpen:n=!1,children:o,className:a}=e,u=(0,l.__rest)(e,["defaultOpen","children","className"]),i=null!=(r=(0,s.useContext)(A))?r:(0,R.tremorTwMerge)("rounded-tremor-default border");return s.default.createElement(M,Object.assign({as:"div",ref:t,className:(0,R.tremorTwMerge)(F("root"),"overflow-hidden","bg-tremor-background border-tremor-border","dark:bg-dark-tremor-background dark:border-dark-tremor-border",i,a),defaultOpen:n},u),({open:e})=>s.default.createElement(j.Provider,{value:{isOpen:e}},o))});L.displayName="Accordion",e.s(["OpenContext",()=>j,"default",()=>L],543086),e.s(["Accordion",()=>L],677667)},130643,e=>{"use strict";var t=e.i(290571),r=e.i(271645),n=e.i(886148),l=e.i(444755);let o=(0,e.i(673706).makeClassName)("AccordionBody"),a=r.default.forwardRef((e,a)=>{let{children:s,className:u}=e,i=(0,t.__rest)(e,["children","className"]);return r.default.createElement(n.Disclosure.Panel,Object.assign({ref:a,className:(0,l.tremorTwMerge)(o("root"),"w-full text-tremor-default px-4 pb-3","text-tremor-content","dark:text-dark-tremor-content",u)},i),s)});a.displayName="AccordionBody",e.s(["AccordionBody",()=>a],130643)},898667,e=>{"use strict";var t=e.i(290571),r=e.i(271645),n=e.i(886148);let l=e=>{var n=(0,t.__rest)(e,[]);return r.default.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},n),r.default.createElement("path",{d:"M11.9999 10.8284L7.0502 15.7782L5.63599 14.364L11.9999 8L18.3639 14.364L16.9497 15.7782L11.9999 10.8284Z"}))};var o=e.i(543086),a=e.i(444755);let s=(0,e.i(673706).makeClassName)("AccordionHeader"),u=r.default.forwardRef((e,u)=>{let{children:i,className:c}=e,d=(0,t.__rest)(e,["children","className"]),{isOpen:f}=(0,r.useContext)(o.OpenContext);return r.default.createElement(n.Disclosure.Button,Object.assign({ref:u,className:(0,a.tremorTwMerge)(s("root"),"w-full flex items-center justify-between px-4 py-3","text-tremor-content-emphasis","dark:text-dark-tremor-content-emphasis",c)},d),r.default.createElement("div",{className:(0,a.tremorTwMerge)(s("children"),"flex flex-1 text-inherit mr-4")},i),r.default.createElement("div",null,r.default.createElement(l,{className:(0,a.tremorTwMerge)(s("arrowIcon"),"h-5 w-5 -mr-1","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle",f?"transition-all":"transition-all -rotate-180")})))});u.displayName="AccordionHeader",e.s(["AccordionHeader",()=>u],898667)},83733,233137,e=>{"use strict";let t,r;var n,l,o=e.i(247167),a=e.i(271645),s=e.i(544508),u=e.i(746725),i=e.i(835696);void 0!==o.default&&"u">typeof globalThis&&"u">typeof Element&&(null==(n=null==o.default?void 0:o.default.env)?void 0:n.NODE_ENV)==="test"&&void 0===(null==(l=null==Element?void 0:Element.prototype)?void 0:l.getAnimations)&&(Element.prototype.getAnimations=function(){return console.warn(["Headless UI has polyfilled `Element.prototype.getAnimations` for your tests.","Please install a proper polyfill e.g. `jsdom-testing-mocks`, to silence these warnings.","","Example usage:","```js","import { mockAnimationsApi } from 'jsdom-testing-mocks'","mockAnimationsApi()","```"].join(` -`)),[]});var c=((t=c||{})[t.None=0]="None",t[t.Closed=1]="Closed",t[t.Enter=2]="Enter",t[t.Leave=4]="Leave",t);function d(e){let t={};for(let r in e)!0===e[r]&&(t[`data-${r}`]="");return t}function f(e,t,r,n){let[l,o]=(0,a.useState)(r),{hasFlag:c,addFlag:d,removeFlag:f}=function(e=0){let[t,r]=(0,a.useState)(e),n=(0,a.useCallback)(e=>r(e),[t]),l=(0,a.useCallback)(e=>r(t=>t|e),[t]),o=(0,a.useCallback)(e=>(t&e)===e,[t]);return{flags:t,setFlag:n,addFlag:l,hasFlag:o,removeFlag:(0,a.useCallback)(e=>r(t=>t&~e),[r]),toggleFlag:(0,a.useCallback)(e=>r(t=>t^e),[r])}}(e&&l?3:0),p=(0,a.useRef)(!1),m=(0,a.useRef)(!1),v=(0,u.useDisposables)();return(0,i.useIsoMorphicEffect)(()=>{var l;if(e){if(r&&o(!0),!t){r&&d(3);return}return null==(l=null==n?void 0:n.start)||l.call(n,r),function(e,{prepare:t,run:r,done:n,inFlight:l}){let o=(0,s.disposables)();return function(e,{inFlight:t,prepare:r}){if(null!=t&&t.current)return r();let n=e.style.transition;e.style.transition="none",r(),e.offsetHeight,e.style.transition=n}(e,{prepare:t,inFlight:l}),o.nextFrame(()=>{r(),o.requestAnimationFrame(()=>{o.add(function(e,t){var r,n;let l=(0,s.disposables)();if(!e)return l.dispose;let o=!1;l.add(()=>{o=!0});let a=null!=(n=null==(r=e.getAnimations)?void 0:r.call(e).filter(e=>e instanceof CSSTransition))?n:[];return 0===a.length?t():Promise.allSettled(a.map(e=>e.finished)).then(()=>{o||t()}),l.dispose}(e,n))})}),o.dispose}(t,{inFlight:p,prepare(){m.current?m.current=!1:m.current=p.current,p.current=!0,m.current||(r?(d(3),f(4)):(d(4),f(2)))},run(){m.current?r?(f(3),d(4)):(f(4),d(3)):r?f(1):d(1)},done(){var e;m.current&&"function"==typeof t.getAnimations&&t.getAnimations().length>0||(p.current=!1,f(7),r||o(!1),null==(e=null==n?void 0:n.end)||e.call(n,r))}})}},[e,r,t,v]),e?[l,{closed:c(1),enter:c(2),leave:c(4),transition:c(2)||c(4)}]:[r,{closed:void 0,enter:void 0,leave:void 0,transition:void 0}]}e.s(["transitionDataAttributes",()=>d,"useTransition",()=>f],83733);let p=(0,a.createContext)(null);p.displayName="OpenClosedContext";var m=((r=m||{})[r.Open=1]="Open",r[r.Closed=2]="Closed",r[r.Closing=4]="Closing",r[r.Opening=8]="Opening",r);function v(){return(0,a.useContext)(p)}function b({value:e,children:t}){return a.default.createElement(p.Provider,{value:e},t)}function g({children:e}){return a.default.createElement(p.Provider,{value:null},e)}e.s(["OpenClosedProvider",()=>b,"ResetOpenClosedProvider",()=>g,"State",()=>m,"useOpenClosed",()=>v],233137)},888288,e=>{"use strict";var t=e.i(271645);let r=(e,r)=>{let n=void 0!==r,[l,o]=(0,t.useState)(e);return[n?r:l,e=>{n||o(e)}]};e.s(["default",()=>r])},233538,e=>{"use strict";function t(e){let t=e.parentElement,r=null;for(;t&&!(t instanceof HTMLFieldSetElement);)t instanceof HTMLLegendElement&&(r=t),t=t.parentElement;let n=(null==t?void 0:t.getAttribute("disabled"))==="";return!(n&&function(e){if(!e)return!1;let t=e.previousElementSibling;for(;null!==t;){if(t instanceof HTMLLegendElement)return!1;t=t.previousElementSibling}return!0}(r))&&n}e.s(["isDisabledReactIssue7711",()=>t])},503269,214520,601893,694421,140721,942803,35889,722678,e=>{"use strict";var t=e.i(271645),r=e.i(914189);function n(e,n,l){let[o,a]=(0,t.useState)(l),s=void 0!==e,u=(0,t.useRef)(s),i=(0,t.useRef)(!1),c=(0,t.useRef)(!1);return!s||u.current||i.current?s||!u.current||c.current||(c.current=!0,u.current=s,console.error("A component is changing from controlled to uncontrolled. This may be caused by the value changing from a defined value to undefined, which should not happen.")):(i.current=!0,u.current=s,console.error("A component is changing from uncontrolled to controlled. This may be caused by the value changing from undefined to a defined value, which should not happen.")),[s?e:o,(0,r.useEvent)(e=>(s||a(e),null==n?void 0:n(e)))]}function l(e){let[r]=(0,t.useState)(e);return r}e.s(["useControllable",()=>n],503269),e.s(["useDefaultValue",()=>l],214520);let o=(0,t.createContext)(void 0);function a(){return(0,t.useContext)(o)}e.s(["useDisabled",()=>a],601893);var s=e.i(174080),u=e.i(746725);function i(e={},t=null,r=[]){for(let[n,l]of Object.entries(e))!function e(t,r,n){if(Array.isArray(n))for(let[l,o]of n.entries())e(t,c(r,l.toString()),o);else n instanceof Date?t.push([r,n.toISOString()]):"boolean"==typeof n?t.push([r,n?"1":"0"]):"string"==typeof n?t.push([r,n]):"number"==typeof n?t.push([r,`${n}`]):null==n?t.push([r,""]):i(n,r,t)}(r,c(t,n),l);return r}function c(e,t){return e?e+"["+t+"]":t}function d(e){var t,r;let n=null!=(t=null==e?void 0:e.form)?t:e.closest("form");if(n){for(let t of n.elements)if(t!==e&&("INPUT"===t.tagName&&"submit"===t.type||"BUTTON"===t.tagName&&"submit"===t.type||"INPUT"===t.nodeName&&"image"===t.type))return void t.click();null==(r=n.requestSubmit)||r.call(n)}}e.s(["attemptSubmit",()=>d,"objectToFormEntries",()=>i],694421);var f=e.i(700020),p=e.i(2788);let m=(0,t.createContext)(null);function v({children:e}){let r=(0,t.useContext)(m);if(!r)return t.default.createElement(t.default.Fragment,null,e);let{target:n}=r;return n?(0,s.createPortal)(t.default.createElement(t.default.Fragment,null,e),n):null}function b({data:e,form:r,disabled:n,onReset:l,overrides:o}){let[a,s]=(0,t.useState)(null),c=(0,u.useDisposables)();return(0,t.useEffect)(()=>{if(l&&a)return c.addEventListener(a,"reset",l)},[a,r,l]),t.default.createElement(v,null,t.default.createElement(g,{setForm:s,formId:r}),i(e).map(([e,l])=>t.default.createElement(p.Hidden,{features:p.HiddenFeatures.Hidden,...(0,f.compact)({key:e,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:r,disabled:n,name:e,value:l,...o})})))}function g({setForm:e,formId:r}){return(0,t.useEffect)(()=>{if(r){let t=document.getElementById(r);t&&e(t)}},[e,r]),r?null:t.default.createElement(p.Hidden,{features:p.HiddenFeatures.Hidden,as:"input",type:"hidden",hidden:!0,readOnly:!0,ref:t=>{if(!t)return;let r=t.closest("form");r&&e(r)}})}e.s(["FormFields",()=>b],140721);let h=(0,t.createContext)(void 0);function y(){return(0,t.useContext)(h)}e.s(["useProvidedId",()=>y],942803);var E=e.i(835696),C=e.i(294316);let S=(0,t.createContext)(null);function x(){var e,r;return null!=(r=null==(e=(0,t.useContext)(S))?void 0:e.value)?r:void 0}function k(){let[e,n]=(0,t.useState)([]);return[e.length>0?e.join(" "):void 0,(0,t.useMemo)(()=>function(e){let l=(0,r.useEvent)(e=>(n(t=>[...t,e]),()=>n(t=>{let r=t.slice(),n=r.indexOf(e);return -1!==n&&r.splice(n,1),r}))),o=(0,t.useMemo)(()=>({register:l,slot:e.slot,name:e.name,props:e.props,value:e.value}),[l,e.slot,e.name,e.props,e.value]);return t.default.createElement(S.Provider,{value:o},e.children)},[n])]}S.displayName="DescriptionContext";let w=Object.assign((0,f.forwardRefWithAs)(function(e,r){let n=(0,t.useId)(),l=a(),{id:o=`headlessui-description-${n}`,...s}=e,u=function e(){let r=(0,t.useContext)(S);if(null===r){let t=Error("You used a component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,e),t}return r}(),i=(0,C.useSyncRefs)(r);(0,E.useIsoMorphicEffect)(()=>u.register(o),[o,u.register]);let c=l||!1,d=(0,t.useMemo)(()=>({...u.slot,disabled:c}),[u.slot,c]),p={ref:i,...u.props,id:o};return(0,f.useRender)()({ourProps:p,theirProps:s,slot:d,defaultTag:"p",name:u.name||"Description"})}),{});e.s(["Description",()=>w,"useDescribedBy",()=>x,"useDescriptions",()=>k],35889);let T=(0,t.createContext)(null);function O(e){var r,n,l;let o=null!=(n=null==(r=(0,t.useContext)(T))?void 0:r.value)?n:void 0;return(null!=(l=null==e?void 0:e.length)?l:0)>0?[o,...e].filter(Boolean).join(" "):o}function D({inherit:e=!1}={}){let n=O(),[l,o]=(0,t.useState)([]),a=e?[n,...l].filter(Boolean):l;return[a.length>0?a.join(" "):void 0,(0,t.useMemo)(()=>function(e){let n=(0,r.useEvent)(e=>(o(t=>[...t,e]),()=>o(t=>{let r=t.slice(),n=r.indexOf(e);return -1!==n&&r.splice(n,1),r}))),l=(0,t.useMemo)(()=>({register:n,slot:e.slot,name:e.name,props:e.props,value:e.value}),[n,e.slot,e.name,e.props,e.value]);return t.default.createElement(T.Provider,{value:l},e.children)},[o])]}T.displayName="LabelContext";let I=Object.assign((0,f.forwardRefWithAs)(function(e,n){var l;let o=(0,t.useId)(),s=function e(){let r=(0,t.useContext)(T);if(null===r){let t=Error("You used a