diff --git a/.circleci/config.yml b/.circleci/config.yml index 23a62df478..38e6d1fc33 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -28,34 +28,28 @@ commands: - setup_google_dns - restore_cache: keys: - - v2-litellm-deps-{{ checksum "requirements.txt" }}-{{ checksum ".circleci/config.yml" }} - - v2-litellm-deps- + - v3-litellm-uv-deps-{{ checksum "requirements.txt" }}-{{ checksum ".circleci/config.yml" }} - run: name: Install Dependencies command: | - python -m pip install --upgrade pip - python -m pip install -r requirements.txt - pip install "pytest-mock==3.12.0" - pip install "pytest==7.3.1" - pip install "pytest-retry==1.6.3" - pip install "pytest-cov==5.0.0" - pip install "pytest-asyncio==0.21.1" - pip install "respx==0.22.0" - pip install "hypercorn==0.17.3" - pip install "pydantic==2.11.0" - pip install "mcp==1.25.0" - pip install "requests-mock>=1.12.1" - pip install "responses==0.25.7" - pip install "pytest-xdist==3.6.1" - pip install "pytest-timeout==2.2.0" - pip install "semantic_router==0.1.10" - pip install "fastapi-offline==1.7.3" - pip install "a2a" + python -m pip install --upgrade pip uv + # Use uv for the heavy requirements.txt (10-100x faster than pip) + uv pip install --system -r requirements.txt + # Use pip for test deps (small set, avoids uv strict-resolution + # conflicts with transitive dep pins like openai<2 and pydantic>=2.11.5) + pip install "pytest-mock==3.12.0" "pytest==7.3.1" "pytest-retry==1.6.3" \ + "pytest-asyncio==0.21.1" "respx==0.22.0" "hypercorn==0.17.3" \ + "pydantic==2.11.0" "mcp==1.25.0" "requests-mock>=1.12.1" \ + "responses==0.25.7" "pytest-xdist==3.6.1" "pytest-timeout==2.2.0" \ + "pytest-cov==5.0.0" "semantic_router==0.1.10" "fastapi-offline==1.7.3" \ + "a2a" - setup_litellm_enterprise_pip - save_cache: paths: - - ~/.cache/pip - key: v2-litellm-deps-{{ checksum "requirements.txt" }}-{{ checksum ".circleci/config.yml" }} + - ~/.local/lib + - ~/.local/bin + - ~/.cache/uv + key: v3-litellm-uv-deps-{{ checksum "requirements.txt" }}-{{ checksum ".circleci/config.yml" }} jobs: # Add Windows testing job @@ -100,8 +94,8 @@ jobs: - run: name: Install Dependencies command: | - python -m pip install --upgrade pip - python -m pip install -r requirements.txt + python -m pip install --upgrade pip uv + uv pip install --system -r requirements.txt pip uninstall fastuuid -y pip install "mypy==1.18.2" - run: @@ -120,6 +114,7 @@ jobs: username: ${DOCKERHUB_USERNAME} password: ${DOCKERHUB_PASSWORD} working_directory: ~/project + resource_class: medium steps: - checkout - setup_google_dns @@ -154,50 +149,17 @@ jobs: command: | python -m pip install --upgrade pip python -m pip install -r .circleci/requirements.txt - pip install "pytest==7.3.1" - pip install "pytest-retry==1.6.3" - pip install "pytest-asyncio==0.21.1" - pip install "pytest-cov==5.0.0" - pip install "mypy==1.18.2" - pip install "google-generativeai==0.3.2" - pip install "google-cloud-aiplatform==1.43.0" - pip install pyarrow - pip install "boto3==1.36.0" - pip install "aioboto3==13.4.0" - pip install langchain - pip install lunary==0.2.5 - pip install "azure-identity==1.16.1" - pip install "langfuse==2.59.7" - pip install "logfire==0.29.0" - pip install numpydoc - pip install traceloop-sdk==0.21.1 - pip install opentelemetry-api==1.25.0 - pip install opentelemetry-sdk==1.25.0 - pip install opentelemetry-exporter-otlp==1.25.0 - pip install openai==1.100.1 - pip install prisma==0.11.0 - pip install "detect_secrets==1.5.0" - pip install "httpx==0.24.1" - pip install "respx==0.22.0" - pip install fastapi - pip install "gunicorn==21.2.0" - pip install "anyio==4.2.0" - pip install "aiodynamo==23.10.1" - pip install "asyncio==3.4.3" - pip install "apscheduler==3.10.4" - pip install "PyGithub==1.59.1" - pip install argon2-cffi - pip install "pytest-mock==3.12.0" - pip install python-multipart - pip install google-cloud-aiplatform - pip install prometheus-client==0.20.0 - pip install "pydantic==2.10.2" - pip install "diskcache==5.6.1" - pip install "Pillow==10.3.0" - pip install "jsonschema==4.22.0" - pip install "pytest-xdist==3.6.1" - pip install "pytest-timeout==2.2.0" - pip install "websockets==13.1.0" + pip install "pytest==7.3.1" "pytest-retry==1.6.3" "pytest-asyncio==0.21.1" "pytest-cov==5.0.0" \ + "mypy==1.18.2" "google-generativeai==0.3.2" "google-cloud-aiplatform==1.43.0" pyarrow \ + "boto3==1.36.0" "aioboto3==13.4.0" langchain lunary==0.2.5 \ + "azure-identity==1.16.1" "langfuse==2.59.7" "logfire==0.29.0" numpydoc \ + traceloop-sdk==0.21.1 openai==1.100.1 prisma==0.11.0 \ + "detect_secrets==1.5.0" "respx==0.22.0" fastapi \ + "gunicorn==21.2.0" "aiodynamo==23.10.1" "asyncio==3.4.3" \ + "apscheduler==3.10.4" "PyGithub==1.59.1" argon2-cffi "pytest-mock==3.12.0" \ + python-multipart prometheus-client==0.20.0 "pydantic==2.10.2" \ + "diskcache==5.6.1" "Pillow==10.3.0" "jsonschema==4.22.0" \ + "pytest-xdist==3.6.1" "pytest-timeout==2.2.0" "websockets==13.1.0" pip install semantic_router --no-deps pip install aurelio_sdk --no-deps pip uninstall posthog -y @@ -243,7 +205,7 @@ jobs: -n 4 \ --timeout=300 \ --timeout_method=thread" - no_output_timeout: 120m + no_output_timeout: 15m - run: name: Rename the coverage files command: | @@ -282,50 +244,17 @@ jobs: command: | python -m pip install --upgrade pip python -m pip install -r .circleci/requirements.txt - pip install "pytest==7.3.1" - pip install "pytest-retry==1.6.3" - pip install "pytest-asyncio==0.21.1" - pip install "pytest-cov==5.0.0" - pip install "mypy==1.18.2" - pip install "google-generativeai==0.3.2" - pip install "google-cloud-aiplatform==1.43.0" - pip install pyarrow - pip install "boto3==1.36.0" - pip install "aioboto3==13.4.0" - pip install langchain - pip install lunary==0.2.5 - pip install "azure-identity==1.16.1" - pip install "langfuse==2.59.7" - pip install "logfire==0.29.0" - pip install numpydoc - pip install traceloop-sdk==0.21.1 - pip install opentelemetry-api==1.25.0 - pip install opentelemetry-sdk==1.25.0 - pip install opentelemetry-exporter-otlp==1.25.0 - pip install openai==1.100.1 - pip install prisma==0.11.0 - pip install "detect_secrets==1.5.0" - pip install "httpx==0.24.1" - pip install "respx==0.22.0" - pip install fastapi - pip install "gunicorn==21.2.0" - pip install "anyio==4.2.0" - pip install "aiodynamo==23.10.1" - pip install "asyncio==3.4.3" - pip install "apscheduler==3.10.4" - pip install "PyGithub==1.59.1" - pip install argon2-cffi - pip install "pytest-mock==3.12.0" - pip install python-multipart - pip install google-cloud-aiplatform - pip install prometheus-client==0.20.0 - pip install "pydantic==2.10.2" - pip install "diskcache==5.6.1" - pip install "Pillow==10.3.0" - pip install "jsonschema==4.22.0" - pip install "pytest-xdist==3.6.1" - pip install "pytest-timeout==2.2.0" - pip install "websockets==13.1.0" + pip install "pytest==7.3.1" "pytest-retry==1.6.3" "pytest-asyncio==0.21.1" "pytest-cov==5.0.0" \ + "mypy==1.18.2" "google-generativeai==0.3.2" "google-cloud-aiplatform==1.43.0" pyarrow \ + "boto3==1.36.0" "aioboto3==13.4.0" langchain lunary==0.2.5 \ + "azure-identity==1.16.1" "langfuse==2.59.7" "logfire==0.29.0" numpydoc \ + traceloop-sdk==0.21.1 openai==1.100.1 prisma==0.11.0 \ + "detect_secrets==1.5.0" "respx==0.22.0" fastapi \ + "gunicorn==21.2.0" "aiodynamo==23.10.1" "asyncio==3.4.3" \ + "apscheduler==3.10.4" "PyGithub==1.59.1" argon2-cffi "pytest-mock==3.12.0" \ + python-multipart prometheus-client==0.20.0 "pydantic==2.10.2" \ + "diskcache==5.6.1" "Pillow==10.3.0" "jsonschema==4.22.0" \ + "pytest-xdist==3.6.1" "pytest-timeout==2.2.0" "websockets==13.1.0" pip install semantic_router --no-deps pip install aurelio_sdk --no-deps pip uninstall posthog -y @@ -371,7 +300,7 @@ jobs: -n 4 \ --timeout=300 \ --timeout_method=thread" - no_output_timeout: 120m + no_output_timeout: 15m - run: name: Rename the coverage files command: | @@ -393,6 +322,7 @@ jobs: username: ${DOCKERHUB_USERNAME} password: ${DOCKERHUB_PASSWORD} working_directory: ~/project + resource_class: medium steps: - checkout @@ -471,29 +401,20 @@ jobs: command: | pwd ls - python -m pytest -vv tests/local_testing --cov=litellm --cov-report=xml -x --junitxml=test-results/junit.xml --durations=5 -k "langfuse" - no_output_timeout: 120m - - run: - name: Rename the coverage files - command: | - mv coverage.xml langfuse_coverage.xml - mv .coverage langfuse_coverage - + python -m pytest -v tests/local_testing -x --junitxml=test-results/junit.xml --durations=5 -k "langfuse" + no_output_timeout: 15m # Store test results - store_test_results: path: test-results - - persist_to_workspace: - root: . - paths: - - langfuse_coverage.xml - - langfuse_coverage caching_unit_tests: docker: - image: cimg/python:3.11 auth: username: ${DOCKERHUB_USERNAME} password: ${DOCKERHUB_PASSWORD} + resource_class: large working_directory: ~/project + parallelism: 2 steps: - checkout @@ -511,7 +432,8 @@ jobs: - restore_cache: keys: - - v1-dependencies-{{ checksum ".circleci/requirements.txt" }} + - v2-caching-deps-{{ checksum ".circleci/requirements.txt" }} + - v2-caching-deps- - run: name: Install Dependencies command: | @@ -559,11 +481,13 @@ jobs: pip install "Pillow==10.3.0" pip install "jsonschema==4.22.0" pip install "websockets==13.1.0" + pip install "pytest-xdist==3.6.1" - setup_litellm_enterprise_pip - save_cache: paths: - - ./venv - key: v1-dependencies-{{ checksum ".circleci/requirements.txt" }} + - /home/circleci/.pyenv/versions + - /home/circleci/.local + key: v2-caching-deps-{{ checksum ".circleci/requirements.txt" }} - run: name: Run prisma ./docker/entrypoint.sh command: | @@ -578,22 +502,23 @@ jobs: command: | pwd ls - python -m pytest -vv tests/local_testing --cov=litellm --cov-report=xml -x --junitxml=test-results/junit.xml --durations=5 -k "caching or cache" - no_output_timeout: 120m - - run: - name: Rename the coverage files - command: | - mv coverage.xml caching_coverage.xml - mv .coverage caching_coverage + mkdir -p test-results + + TEST_FILES=$(circleci tests glob "tests/local_testing/**/test_*.py") + + echo "$TEST_FILES" | circleci tests run \ + --split-by=timings \ + --verbose \ + --command="xargs python -m pytest \ + -v \ + --junitxml=test-results/junit.xml \ + --durations=5 \ + -k 'caching or cache'" + no_output_timeout: 15m # Store test results - store_test_results: path: test-results - - persist_to_workspace: - root: . - paths: - - caching_coverage.xml - - caching_coverage auth_ui_unit_tests: docker: - image: cimg/python:3.11 @@ -608,12 +533,12 @@ jobs: - run: name: Install Dependencies command: | - python -m pip install --upgrade pip - python -m pip install -r requirements.txt + python -m pip install --upgrade pip uv + uv pip install --system -r requirements.txt pip install "pytest==7.3.1" pip install "pytest-retry==1.6.3" pip install "pytest-asyncio==0.21.1" - pip install "pytest-cov==5.0.0" + pip install "pytest-xdist==3.6.1" - save_cache: paths: - ./venv @@ -631,25 +556,13 @@ jobs: command: | pwd ls - python -m pytest -vv tests/proxy_admin_ui_tests -x --cov=litellm --cov-report=xml --junitxml=test-results/junit.xml --durations=5 - no_output_timeout: 120m - - - run: - name: Rename the coverage files - command: | - mv coverage.xml auth_ui_unit_tests_coverage.xml - mv .coverage auth_ui_unit_tests_coverage + python -m pytest -v tests/proxy_admin_ui_tests -x --junitxml=test-results/junit.xml --durations=5 -n 2 + no_output_timeout: 15m # Store test results - store_test_results: path: test-results - - persist_to_workspace: - root: . - paths: - - auth_ui_unit_tests_coverage.xml - - auth_ui_unit_tests_coverage - litellm_router_testing: # Runs all tests with the "router" keyword docker: - image: cimg/python:3.11 @@ -657,22 +570,32 @@ jobs: username: ${DOCKERHUB_USERNAME} password: ${DOCKERHUB_PASSWORD} working_directory: ~/project + resource_class: large + parallelism: 4 steps: - checkout - setup_google_dns + - restore_cache: + keys: + - v1-router-testing-deps-{{ checksum "requirements.txt" }} - run: name: Install Dependencies command: | - python -m pip install --upgrade pip - python -m pip install -r requirements.txt + python -m pip install --upgrade pip uv + uv pip install --system -r requirements.txt pip install "pytest==7.3.1" pip install "respx==0.22.0" - pip install "pytest-cov==5.0.0" pip install "pytest-retry==1.6.3" pip install "pytest-asyncio==0.21.1" pip install "pytest-xdist==3.6.1" + pip install "pytest-timeout==2.2.0" pip install semantic_router --no-deps pip install aurelio_sdk --no-deps + - save_cache: + paths: + - /home/circleci/.pyenv + - /home/circleci/.local + key: v1-router-testing-deps-{{ checksum "requirements.txt" }} # Run pytest and generate JUnit XML report - setup_litellm_enterprise_pip - run: @@ -680,23 +603,23 @@ jobs: command: | pwd ls - python -m pytest tests/local_testing --cov=litellm --cov-report=xml -vv -k "router" -v --junitxml=test-results/junit.xml --durations=5 - no_output_timeout: 120m - - run: - name: Rename the coverage files - command: | - mv coverage.xml litellm_router_coverage.xml - mv .coverage litellm_router_coverage + TEST_FILES=$(circleci tests glob "tests/local_testing/**/test_*.py") + + echo "$TEST_FILES" | circleci tests run \ + --split-by=timings \ + --verbose \ + --command="xargs python -m pytest \ + -v \ + -k 'router' \ + -n 4 \ + --junitxml=test-results/junit.xml \ + --durations=5 \ + --timeout=300 --timeout_method=thread" + no_output_timeout: 15m # Store test results - store_test_results: path: test-results - - persist_to_workspace: - root: . - paths: - - litellm_router_coverage.xml - - litellm_router_coverage - litellm_router_unit_testing: # Runs all tests with the "router" keyword docker: - image: cimg/python:3.11 @@ -704,23 +627,31 @@ jobs: username: ${DOCKERHUB_USERNAME} password: ${DOCKERHUB_PASSWORD} working_directory: ~/project + resource_class: large steps: - checkout - setup_google_dns + - restore_cache: + keys: + - v1-router-unit-deps-{{ checksum "requirements.txt" }} - run: name: Install Dependencies command: | - python -m pip install --upgrade pip - python -m pip install -r requirements.txt + python -m pip install --upgrade pip uv + uv pip install --system -r requirements.txt pip install "pytest==7.3.1" pip install "respx==0.22.0" - pip install "pytest-cov==5.0.0" pip install "pytest-retry==1.6.3" pip install "pytest-asyncio==0.21.1" pip install semantic_router --no-deps pip install aurelio_sdk --no-deps pip install "pytest-xdist==3.6.1" + - save_cache: + paths: + - /home/circleci/.pyenv + - /home/circleci/.local + key: v1-router-unit-deps-{{ checksum "requirements.txt" }} # Run pytest and generate JUnit XML report - setup_litellm_enterprise_pip - run: @@ -728,27 +659,26 @@ jobs: command: | pwd ls - python -m pytest -vv tests/router_unit_tests --cov=litellm --cov-report=xml -x -s --junitxml=test-results/junit.xml --durations=5 - no_output_timeout: 120m - - run: - name: Rename the coverage files - command: | - mv coverage.xml litellm_router_unit_coverage.xml - mv .coverage litellm_router_unit_coverage + python -m pytest -v tests/router_unit_tests -x --junitxml=test-results/junit.xml --durations=5 -n 4 + no_output_timeout: 15m # Store test results - store_test_results: path: test-results - - - persist_to_workspace: - root: . - paths: - - litellm_router_unit_coverage.xml - - litellm_router_unit_coverage litellm_security_tests: - machine: - image: ubuntu-2204:2023.10.1 + docker: + - image: cimg/python:3.13 + auth: + username: ${DOCKERHUB_USERNAME} + password: ${DOCKERHUB_PASSWORD} + - image: cimg/postgres:14.0 + environment: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + POSTGRES_DB: circle_test resource_class: xlarge working_directory: ~/project + environment: + DATABASE_URL: "postgresql://postgres:postgres@localhost:5432/circle_test" steps: - checkout - setup_google_dns @@ -756,87 +686,33 @@ jobs: name: Show git commit hash command: | echo "Git commit hash: $CIRCLE_SHA1" - - run: - name: Install Docker CLI (In case it's not already installed) - command: | - curl -fsSL https://get.docker.com | sh - sudo usermod -aG docker $USER - docker version - - run: - name: Install Python 3.13 - command: | - curl https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh --output miniconda.sh - bash miniconda.sh -b -p $HOME/miniconda - export PATH="$HOME/miniconda/bin:$PATH" - conda init bash - source ~/.bashrc - conda create -n myenv python=3.13 -y - conda activate myenv - python --version + - setup_remote_docker: + docker_layer_caching: true + - restore_cache: + keys: + - v3-litellm-uv-deps-{{ checksum "requirements.txt" }}-{{ checksum ".circleci/config.yml" }} - run: name: Install Dependencies command: | - export PATH="$HOME/miniconda/bin:$PATH" - source $HOME/miniconda/etc/profile.d/conda.sh - conda activate myenv - python --version - which python - pip install --upgrade typing-extensions>=4.12.0 - pip install "pytest==7.3.1" - pip install "pytest-asyncio==0.21.1" - pip install aiohttp - python -m pip install --upgrade pip - python -m pip install -r requirements.txt - pip install "pytest==7.3.1" - pip install "pytest-retry==1.6.3" - pip install "pytest-mock==3.12.0" - pip install "pytest-asyncio==0.21.1" - pip install "mypy==1.18.2" - pip install "google-generativeai==0.3.2" - pip install "google-cloud-aiplatform==1.43.0" - pip install pyarrow - pip install "boto3==1.36.0" - pip install "aioboto3==13.4.0" - pip install langchain - pip install "langfuse>=2.0.0" - pip install "logfire==0.29.0" - pip install numpydoc - pip install prisma - pip install fastapi - pip install jsonschema - pip install "httpx==0.24.1" - pip install "gunicorn==21.2.0" - pip install "anyio==3.7.1" - pip install "aiodynamo==23.10.1" - pip install "asyncio==3.4.3" - pip install "PyGithub==1.59.1" - pip install "openai==1.100.1" - pip install "pytest-cov==5.0.0" - pip install "apscheduler" + python -m pip install --upgrade pip uv + uv pip install --system -r requirements.txt + pip install "pytest==7.3.1" "pytest-retry==1.6.3" "pytest-mock==3.12.0" \ + "pytest-asyncio==0.21.1" "pytest-cov==5.0.0" + - save_cache: + paths: + - ~/.local/lib + - ~/.local/bin + - ~/.cache/uv + key: v3-litellm-uv-deps-{{ checksum "requirements.txt" }}-{{ checksum ".circleci/config.yml" }} - run: name: Install dockerize command: | wget https://github.com/jwilder/dockerize/releases/download/v0.6.1/dockerize-linux-amd64-v0.6.1.tar.gz sudo tar -C /usr/local/bin -xzvf dockerize-linux-amd64-v0.6.1.tar.gz rm dockerize-linux-amd64-v0.6.1.tar.gz - - run: - name: Start PostgreSQL Database - command: | - docker run -d \ - --name postgres-db \ - -e POSTGRES_USER=postgres \ - -e POSTGRES_PASSWORD=postgres \ - -e POSTGRES_DB=circle_test \ - -p 5432:5432 \ - postgres:14 - run: name: Wait for PostgreSQL to be ready command: dockerize -wait tcp://localhost:5432 -timeout 1m - - run: - name: Set DATABASE_URL environment variable - command: | - echo 'export DATABASE_URL="postgresql://postgres:postgres@localhost:5432/circle_test"' >> $BASH_ENV - source $BASH_ENV - run: name: Run Security Scans command: | @@ -845,9 +721,6 @@ jobs: - run: name: Run prisma ./docker/entrypoint.sh command: | - export PATH="$HOME/miniconda/bin:$PATH" - source $HOME/miniconda/etc/profile.d/conda.sh - conda activate myenv set +e chmod +x docker/entrypoint.sh ./docker/entrypoint.sh @@ -856,26 +729,11 @@ jobs: - run: name: Run tests command: | - export PATH="$HOME/miniconda/bin:$PATH" - source $HOME/miniconda/etc/profile.d/conda.sh - conda activate myenv - pwd - ls - python -m pytest tests/proxy_security_tests --cov=litellm --cov-report=xml -vv -x -v --junitxml=test-results/junit.xml --durations=5 - no_output_timeout: 120m - - run: - name: Rename the coverage files - command: | - mv coverage.xml litellm_security_tests_coverage.xml - mv .coverage litellm_security_tests_coverage + python -m pytest tests/proxy_security_tests -v -x --junitxml=test-results/junit.xml --durations=5 + no_output_timeout: 15m # Store test results - store_test_results: path: test-results - - persist_to_workspace: - root: . - paths: - - litellm_security_tests_coverage.xml - - litellm_security_tests_coverage # Split proxy unit tests into 3 jobs for faster execution and better debugging # test_key_generate_prisma runs separately without parallel execution to avoid event loop issues with logging worker litellm_proxy_unit_testing_key_generation: @@ -885,7 +743,7 @@ jobs: username: ${DOCKERHUB_USERNAME} password: ${DOCKERHUB_PASSWORD} working_directory: ~/project - resource_class: large + resource_class: medium steps: - checkout - setup_google_dns @@ -971,7 +829,7 @@ jobs: ls # Run without -n flag to avoid pytest-xdist event loop conflicts with logging worker python -m pytest tests/proxy_unit_tests/test_key_generate_prisma.py --cov=litellm --cov-report=xml --junitxml=test-results/junit-key-generation.xml --durations=10 --timeout=300 -vv --log-cli-level=INFO - no_output_timeout: 120m + no_output_timeout: 15m - run: name: Rename the coverage files command: | @@ -991,7 +849,7 @@ jobs: username: ${DOCKERHUB_USERNAME} password: ${DOCKERHUB_PASSWORD} working_directory: ~/project - resource_class: large + resource_class: xlarge steps: - checkout - setup_google_dns @@ -1072,25 +930,14 @@ jobs: ./docker/entrypoint.sh set -e - run: - name: Run proxy unit tests (part 1 - auth checks only, key generation in separate job) + name: Run proxy unit tests (part 1 - auth checks) command: | pwd ls - # Run auth tests with parallel execution (test_key_generate_prisma moved to separate job to avoid event loop issues) - python -m pytest tests/proxy_unit_tests/test_auth_checks.py tests/proxy_unit_tests/test_user_api_key_auth.py --cov=litellm --cov-report=xml --junitxml=test-results/junit-part1.xml --durations=10 -n 8 --timeout=300 -vv --log-cli-level=INFO - no_output_timeout: 120m - - run: - name: Rename the coverage files - command: | - mv coverage.xml litellm_proxy_unit_tests_part1_coverage.xml - mv .coverage litellm_proxy_unit_tests_part1_coverage + python -m pytest tests/proxy_unit_tests/test_auth_checks.py tests/proxy_unit_tests/test_user_api_key_auth.py --junitxml=test-results/junit-part1.xml --durations=10 -n 8 --timeout=300 -v + no_output_timeout: 15m - store_test_results: path: test-results - - persist_to_workspace: - root: . - paths: - - litellm_proxy_unit_tests_part1_coverage.xml - - litellm_proxy_unit_tests_part1_coverage litellm_proxy_unit_testing_part2: docker: - image: cimg/python:3.11 @@ -1098,7 +945,7 @@ jobs: username: ${DOCKERHUB_USERNAME} password: ${DOCKERHUB_PASSWORD} working_directory: ~/project - resource_class: large + resource_class: xlarge steps: - checkout - setup_google_dns @@ -1183,20 +1030,10 @@ jobs: command: | pwd ls - python -m pytest tests/proxy_unit_tests --ignore=tests/proxy_unit_tests/test_key_generate_prisma.py --ignore=tests/proxy_unit_tests/test_auth_checks.py --ignore=tests/proxy_unit_tests/test_user_api_key_auth.py --cov=litellm --cov-report=xml --junitxml=test-results/junit-part2.xml --durations=10 -n 4 --timeout=300 -vv --log-cli-level=INFO - no_output_timeout: 120m - - run: - name: Rename the coverage files - command: | - mv coverage.xml litellm_proxy_unit_tests_part2_coverage.xml - mv .coverage litellm_proxy_unit_tests_part2_coverage + python -m pytest tests/proxy_unit_tests --ignore=tests/proxy_unit_tests/test_key_generate_prisma.py --ignore=tests/proxy_unit_tests/test_auth_checks.py --ignore=tests/proxy_unit_tests/test_user_api_key_auth.py --junitxml=test-results/junit-part2.xml --durations=10 -n 8 --timeout=300 -v + no_output_timeout: 15m - store_test_results: path: test-results - - persist_to_workspace: - root: . - paths: - - litellm_proxy_unit_tests_part2_coverage.xml - - litellm_proxy_unit_tests_part2_coverage litellm_assistants_api_testing: # Runs all tests with the "assistants" keyword docker: - image: cimg/python:3.13.1 @@ -1204,6 +1041,7 @@ jobs: username: ${DOCKERHUB_USERNAME} password: ${DOCKERHUB_PASSWORD} working_directory: ~/project + resource_class: medium steps: - checkout @@ -1211,15 +1049,13 @@ jobs: - run: name: Install Dependencies command: | - python -m pip install --upgrade pip - pip install wheel - pip install --upgrade pip wheel setuptools - python -m pip install -r requirements.txt + python -m pip install --upgrade pip uv + pip install wheel setuptools + uv pip install --system -r requirements.txt pip install "pytest==7.3.1" pip install "respx==0.22.0" pip install "pytest-retry==1.6.3" pip install "pytest-asyncio==0.21.1" - pip install "pytest-cov==5.0.0" # Run pytest and generate JUnit XML report - setup_litellm_enterprise_pip - run: @@ -1227,21 +1063,11 @@ jobs: command: | pwd ls - python -m pytest tests/local_testing/ -vv -k "assistants" --cov=litellm --cov-report=xml -x -s -v --junitxml=test-results/junit.xml --durations=5 - no_output_timeout: 120m - - run: - name: Rename the coverage files - command: | - mv coverage.xml litellm_assistants_api_coverage.xml - mv .coverage litellm_assistants_api_coverage + python -m pytest tests/local_testing/ -v -k "assistants" -x --junitxml=test-results/junit.xml --durations=5 + no_output_timeout: 15m # Store test results - store_test_results: path: test-results - - persist_to_workspace: - root: . - paths: - - litellm_assistants_api_coverage.xml - - litellm_assistants_api_coverage llm_translation_testing: docker: - image: cimg/python:3.11 @@ -1249,22 +1075,30 @@ jobs: username: ${DOCKERHUB_USERNAME} password: ${DOCKERHUB_PASSWORD} working_directory: ~/project + resource_class: large steps: - checkout - setup_google_dns + - restore_cache: + keys: + - v1-llm-translation-deps-{{ checksum "requirements.txt" }} - run: name: Install Dependencies command: | - python -m pip install --upgrade pip - python -m pip install -r requirements.txt + python -m pip install --upgrade pip uv + uv pip install --system -r requirements.txt pip install "pytest==7.3.1" pip install "pytest-retry==1.6.3" - pip install "pytest-cov==5.0.0" pip install "pytest-asyncio==0.21.1" pip install "respx==0.22.0" pip install "pytest-xdist==3.6.1" pip install "pytest-timeout==2.2.0" + - save_cache: + paths: + - /home/circleci/.pyenv + - /home/circleci/.local + key: v1-llm-translation-deps-{{ checksum "requirements.txt" }} # Run pytest and generate JUnit XML report - run: name: Run tests @@ -1281,22 +1115,12 @@ jobs: for dir in "${IGNORE_DIRS[@]}"; do IGNORE_ARGS="$IGNORE_ARGS --ignore=$dir" done - python -m pytest -vv tests/llm_translation $IGNORE_ARGS --cov=litellm --cov-report=xml -v --junitxml=test-results/junit.xml --durations=20 -n 4 --timeout=120 --timeout_method=thread - no_output_timeout: 120m - - run: - name: Rename the coverage files - command: | - mv coverage.xml llm_translation_coverage.xml - mv .coverage llm_translation_coverage + python -m pytest -v tests/llm_translation $IGNORE_ARGS --junitxml=test-results/junit.xml --durations=20 -n 8 --timeout=120 --timeout_method=thread + no_output_timeout: 15m # Store test results - store_test_results: path: test-results - - persist_to_workspace: - root: . - paths: - - llm_translation_coverage.xml - - llm_translation_coverage realtime_translation_testing: docker: - image: cimg/python:3.11 @@ -1311,16 +1135,9 @@ jobs: - run: name: Install Dependencies command: | - python -m pip install --upgrade pip - python -m pip install -r requirements.txt - pip install "pytest==7.3.1" - pip install "pytest-retry==1.6.3" - pip install "pytest-cov==5.0.0" - pip install "pytest-asyncio==0.21.1" - pip install "respx==0.22.0" - pip install "pytest-xdist==3.6.1" - pip install "pytest-timeout==2.2.0" - pip install "websockets" + python -m pip install --upgrade pip uv + uv pip install --system -r requirements.txt + pip install "pytest==7.3.1" "pytest-retry==1.6.3" "pytest-cov==5.0.0" "pytest-asyncio==0.21.1" "respx==0.22.0" "pytest-xdist==3.6.1" "pytest-timeout==2.2.0" "websockets" # Run pytest and generate JUnit XML report - run: name: Run realtime tests @@ -1330,7 +1147,7 @@ jobs: # Add --timeout to kill hanging tests after 120s (2 min) # Add --durations=20 to show 20 slowest tests for debugging python -m pytest -vv tests/llm_translation/realtime --cov=litellm --cov-report=xml -v --junitxml=test-results/junit.xml --durations=20 -n 4 --timeout=120 --timeout_method=thread - no_output_timeout: 120m + no_output_timeout: 15m - run: name: Rename the coverage files command: | @@ -1359,8 +1176,8 @@ jobs: - run: name: Install Dependencies command: | - python -m pip install --upgrade pip - python -m pip install -r requirements.txt + python -m pip install --upgrade pip uv + uv pip install --system -r requirements.txt pip install "pytest==7.3.1" pip install "pytest-retry==1.6.3" pip install "pytest-cov==5.0.0" @@ -1368,14 +1185,15 @@ jobs: pip install "respx==0.22.0" pip install "pydantic==2.11.0" pip install "mcp==1.25.0" + pip install "pytest-xdist==3.6.1" # Run pytest and generate JUnit XML report - run: name: Run tests command: | pwd ls - python -m pytest -vv tests/mcp_tests --cov=litellm --cov-report=xml -x -s -v --junitxml=test-results/junit.xml --durations=5 - no_output_timeout: 120m + python -m pytest -vv tests/mcp_tests --cov=litellm --cov-report=xml -x -s -v --junitxml=test-results/junit.xml --durations=5 -n 2 + no_output_timeout: 15m - run: name: Rename the coverage files command: | @@ -1404,8 +1222,8 @@ jobs: - run: name: Install Dependencies command: | - python -m pip install --upgrade pip - python -m pip install -r requirements.txt + python -m pip install --upgrade pip uv + uv pip install --system -r requirements.txt pip install "pytest==7.3.1" pip install "pytest-retry==1.6.3" pip install "pytest-cov==5.0.0" @@ -1420,7 +1238,7 @@ jobs: pwd ls python -m pytest -vv tests/agent_tests --ignore=tests/agent_tests/local_only_agent_tests --cov=litellm --cov-report=xml -x -s -v --junitxml=test-results/junit.xml --durations=5 - no_output_timeout: 120m + no_output_timeout: 15m - run: name: Rename the coverage files command: | @@ -1449,8 +1267,8 @@ jobs: - run: name: Install Dependencies command: | - python -m pip install --upgrade pip - python -m pip install -r requirements.txt + python -m pip install --upgrade pip uv + uv pip install --system -r requirements.txt pip install "pytest==7.3.1" pip install "pytest-retry==1.6.3" pip install "pytest-cov==5.0.0" @@ -1458,15 +1276,18 @@ jobs: pip install "respx==0.22.0" pip install "pydantic==2.10.2" pip install "boto3==1.36.0" - pip install "semantic_router==0.1.10" + pip install "semantic_router==0.1.10" --no-deps + pip install aurelio_sdk + pip install "pytest-xdist==3.6.1" + pip install "pytest-timeout==2.2.0" # Run pytest and generate JUnit XML report - run: name: Run tests command: | pwd ls - python -m pytest -vv tests/guardrails_tests --cov=litellm --cov-report=xml -x -s -v --junitxml=test-results/junit.xml --durations=5 - no_output_timeout: 120m + LITELLM_LOG=WARNING python -m pytest tests/guardrails_tests -vv --cov=litellm --cov-report=xml --junitxml=test-results/junit.xml --durations=5 -n 2 --timeout=120 --timeout_method=thread + no_output_timeout: 15m - run: name: Rename the coverage files command: | @@ -1496,8 +1317,8 @@ jobs: - run: name: Install Dependencies command: | - python -m pip install --upgrade pip - python -m pip install -r requirements.txt + python -m pip install --upgrade pip uv + uv pip install --system -r requirements.txt pip install "pytest==7.3.1" pip install "pytest-retry==1.6.3" pip install "pytest-cov==5.0.0" @@ -1511,7 +1332,7 @@ jobs: pwd ls python -m pytest -vv tests/unified_google_tests --cov=litellm --cov-report=xml -x -s -v --junitxml=test-results/junit.xml --durations=5 - no_output_timeout: 120m + no_output_timeout: 15m - run: name: Rename the coverage files command: | @@ -1534,42 +1355,41 @@ jobs: username: ${DOCKERHUB_USERNAME} password: ${DOCKERHUB_PASSWORD} working_directory: ~/project + resource_class: large steps: - checkout - setup_google_dns + - restore_cache: + keys: + - v1-llm-responses-deps-{{ checksum "requirements.txt" }} - run: name: Install Dependencies command: | - python -m pip install --upgrade pip - python -m pip install -r requirements.txt + python -m pip install --upgrade pip uv + uv pip install --system -r requirements.txt pip install "pytest==7.3.1" pip install "pytest-retry==1.6.3" - pip install "pytest-cov==5.0.0" pip install "pytest-asyncio==0.21.1" pip install "respx==0.22.0" + pip install "pytest-xdist==3.6.1" + - save_cache: + paths: + - /home/circleci/.pyenv + - /home/circleci/.local + key: v1-llm-responses-deps-{{ checksum "requirements.txt" }} # Run pytest and generate JUnit XML report - run: name: Run tests command: | pwd ls - python -m pytest -vv tests/llm_responses_api_testing --cov=litellm --cov-report=xml -x -s -v --junitxml=test-results/junit.xml --durations=5 - no_output_timeout: 120m - - run: - name: Rename the coverage files - command: | - mv coverage.xml llm_responses_api_coverage.xml - mv .coverage llm_responses_api_coverage + python -m pytest -v tests/llm_responses_api_testing -x --junitxml=test-results/junit.xml --durations=5 -n 8 + no_output_timeout: 15m # Store test results - store_test_results: path: test-results - - persist_to_workspace: - root: . - paths: - - llm_responses_api_coverage.xml - - llm_responses_api_coverage ocr_testing: docker: - image: cimg/python:3.11 @@ -1584,21 +1404,17 @@ jobs: - run: name: Install Dependencies command: | - python -m pip install --upgrade pip - python -m pip install -r requirements.txt - pip install "pytest==7.3.1" - pip install "pytest-retry==1.6.3" - pip install "pytest-cov==5.0.0" - pip install "pytest-asyncio==0.21.1" - pip install "respx==0.22.0" + python -m pip install --upgrade pip uv + uv pip install --system -r requirements.txt + pip install "pytest==7.3.1" "pytest-retry==1.6.3" "pytest-cov==5.0.0" "pytest-asyncio==0.21.1" "respx==0.22.0" "pytest-xdist==3.6.1" # Run pytest and generate JUnit XML report - run: name: Run tests command: | pwd ls - python -m pytest -vv tests/ocr_tests --cov=litellm --cov-report=xml -x -s -v --junitxml=test-results/junit.xml --durations=5 - no_output_timeout: 120m + python -m pytest -vv tests/ocr_tests --cov=litellm --cov-report=xml -x -v --junitxml=test-results/junit.xml --durations=5 -n 4 + no_output_timeout: 15m - run: name: Rename the coverage files command: | @@ -1627,21 +1443,17 @@ jobs: - run: name: Install Dependencies command: | - python -m pip install --upgrade pip - python -m pip install -r requirements.txt - pip install "pytest==7.3.1" - pip install "pytest-retry==1.6.3" - pip install "pytest-cov==5.0.0" - pip install "pytest-asyncio==0.21.1" - pip install "respx==0.22.0" + python -m pip install --upgrade pip uv + uv pip install --system -r requirements.txt + pip install "pytest==7.3.1" "pytest-retry==1.6.3" "pytest-cov==5.0.0" "pytest-asyncio==0.21.1" "respx==0.22.0" "pytest-xdist==3.6.1" # Run pytest and generate JUnit XML report - run: name: Run tests command: | pwd ls - python -m pytest -vv tests/search_tests --cov=litellm --cov-report=xml -x -s -v --junitxml=test-results/junit.xml --durations=5 - no_output_timeout: 120m + python -m pytest -vv tests/search_tests --cov=litellm --cov-report=xml -x -v --junitxml=test-results/junit.xml --durations=5 -n 4 + no_output_timeout: 15m - run: name: Rename the coverage files command: | @@ -1656,7 +1468,7 @@ jobs: paths: - search_coverage.xml - search_coverage - # Split litellm_mapped_tests into 3 parallel jobs for 3x faster execution + # Split litellm_mapped_tests into parallel jobs litellm_mapped_tests_proxy_part1: docker: - image: cimg/python:3.11 @@ -1664,7 +1476,7 @@ jobs: username: ${DOCKERHUB_USERNAME} password: ${DOCKERHUB_PASSWORD} working_directory: ~/project - resource_class: xlarge + resource_class: large steps: - setup_litellm_test_deps - run: @@ -1672,20 +1484,10 @@ jobs: command: | prisma generate export PYTHONUNBUFFERED=1 - python -m pytest tests/test_litellm/proxy/guardrails tests/test_litellm/proxy/management_endpoints tests/test_litellm/proxy/_experimental tests/test_litellm/proxy/client tests/test_litellm/proxy/auth --cov=litellm --cov-report=xml --junitxml=test-results/junit-proxy-part1.xml --durations=10 -n 8 --maxfail=5 --timeout=60 -vv --log-cli-level=WARNING -r A - no_output_timeout: 60m - - run: - name: Rename the coverage files - command: | - mv coverage.xml litellm_proxy_tests_part1_coverage.xml - mv .coverage litellm_proxy_tests_part1_coverage + python -m pytest tests/test_litellm/proxy/guardrails tests/test_litellm/proxy/management_endpoints tests/test_litellm/proxy/_experimental tests/test_litellm/proxy/client tests/test_litellm/proxy/auth --junitxml=test-results/junit-proxy-part1.xml --durations=10 -n 4 --maxfail=5 --timeout=60 -vv --log-cli-level=WARNING -r A + no_output_timeout: 15m - store_test_results: path: test-results - - persist_to_workspace: - root: . - paths: - - litellm_proxy_tests_part1_coverage.xml - - litellm_proxy_tests_part1_coverage litellm_mapped_tests_proxy_part2: docker: - image: cimg/python:3.11 @@ -1693,7 +1495,7 @@ jobs: username: ${DOCKERHUB_USERNAME} password: ${DOCKERHUB_PASSWORD} working_directory: ~/project - resource_class: xlarge + resource_class: large steps: - setup_litellm_test_deps - run: @@ -1701,20 +1503,10 @@ jobs: command: | prisma generate export PYTHONUNBUFFERED=1 - python -m pytest tests/test_litellm/proxy --ignore=tests/test_litellm/proxy/guardrails --ignore=tests/test_litellm/proxy/management_endpoints --ignore=tests/test_litellm/proxy/_experimental --ignore=tests/test_litellm/proxy/client --ignore=tests/test_litellm/proxy/auth --cov=litellm --cov-report=xml --junitxml=test-results/junit-proxy-part2.xml --durations=10 -n 4 --maxfail=5 --timeout=120 -vv --log-cli-level=WARNING -r A - no_output_timeout: 60m - - run: - name: Rename the coverage files - command: | - mv coverage.xml litellm_proxy_tests_part2_coverage.xml - mv .coverage litellm_proxy_tests_part2_coverage + python -m pytest tests/test_litellm/proxy --ignore=tests/test_litellm/proxy/guardrails --ignore=tests/test_litellm/proxy/management_endpoints --ignore=tests/test_litellm/proxy/_experimental --ignore=tests/test_litellm/proxy/client --ignore=tests/test_litellm/proxy/auth --junitxml=test-results/junit-proxy-part2.xml --durations=10 -n 4 --maxfail=5 --timeout=120 -vv --log-cli-level=WARNING -r A + no_output_timeout: 15m - store_test_results: path: test-results - - persist_to_workspace: - root: . - paths: - - litellm_proxy_tests_part2_coverage.xml - - litellm_proxy_tests_part2_coverage litellm_mapped_tests_llms: docker: - image: cimg/python:3.11 @@ -1722,26 +1514,16 @@ jobs: username: ${DOCKERHUB_USERNAME} password: ${DOCKERHUB_PASSWORD} working_directory: ~/project - resource_class: xlarge + resource_class: large steps: - setup_litellm_test_deps - run: name: Run LLM provider tests command: | - python -m pytest tests/test_litellm/llms --cov=litellm --cov-report=xml --junitxml=test-results/junit-llms.xml --durations=10 -n 16 --maxfail=5 --timeout=300 -vv --log-cli-level=WARNING - no_output_timeout: 120m - - run: - name: Rename the coverage files - command: | - mv coverage.xml litellm_llms_tests_coverage.xml - mv .coverage litellm_llms_tests_coverage + python -m pytest tests/test_litellm/llms --junitxml=test-results/junit-llms.xml --durations=10 -n 4 --maxfail=5 --timeout=300 -vv --log-cli-level=WARNING + no_output_timeout: 15m - store_test_results: path: test-results - - persist_to_workspace: - root: . - paths: - - litellm_llms_tests_coverage.xml - - litellm_llms_tests_coverage litellm_mapped_tests_core: docker: - image: cimg/python:3.11 @@ -1749,26 +1531,16 @@ jobs: username: ${DOCKERHUB_USERNAME} password: ${DOCKERHUB_PASSWORD} working_directory: ~/project - resource_class: xlarge + resource_class: large steps: - setup_litellm_test_deps - run: name: Run core tests command: | - python -m pytest tests/test_litellm --ignore=tests/test_litellm/proxy --ignore=tests/test_litellm/llms --ignore=tests/test_litellm/integrations --ignore=tests/test_litellm/litellm_core_utils --ignore=tests/test_litellm/experimental_mcp_client --cov=litellm --cov-report=xml --junitxml=test-results/junit-core.xml --durations=10 -n 16 --maxfail=5 --timeout=300 -vv --log-cli-level=WARNING - no_output_timeout: 120m - - run: - name: Rename the coverage files - command: | - mv coverage.xml litellm_core_tests_coverage.xml - mv .coverage litellm_core_tests_coverage + python -m pytest tests/test_litellm --ignore=tests/test_litellm/proxy --ignore=tests/test_litellm/llms --ignore=tests/test_litellm/integrations --ignore=tests/test_litellm/litellm_core_utils --ignore=tests/test_litellm/experimental_mcp_client --junitxml=test-results/junit-core.xml --durations=10 -n 4 --maxfail=5 --timeout=300 -vv --log-cli-level=WARNING + no_output_timeout: 15m - store_test_results: path: test-results - - persist_to_workspace: - root: . - paths: - - litellm_core_tests_coverage.xml - - litellm_core_tests_coverage litellm_mapped_tests_litellm_core_utils: docker: - image: cimg/python:3.11 @@ -1776,26 +1548,16 @@ jobs: username: ${DOCKERHUB_USERNAME} password: ${DOCKERHUB_PASSWORD} working_directory: ~/project - resource_class: xlarge + resource_class: large steps: - setup_litellm_test_deps - run: name: Run litellm_core_utils tests command: | - python -m pytest tests/test_litellm/litellm_core_utils --cov=litellm --cov-report=xml --junitxml=test-results/junit-litellm-core-utils.xml --durations=10 -n 16 --maxfail=5 --timeout=300 -vv --log-cli-level=WARNING - no_output_timeout: 120m - - run: - name: Rename the coverage files - command: | - mv coverage.xml litellm_core_utils_tests_coverage.xml - mv .coverage litellm_core_utils_tests_coverage + python -m pytest tests/test_litellm/litellm_core_utils --junitxml=test-results/junit-litellm-core-utils.xml --durations=10 -n 4 --maxfail=5 --timeout=300 -vv --log-cli-level=WARNING + no_output_timeout: 15m - store_test_results: path: test-results - - persist_to_workspace: - root: . - paths: - - litellm_core_utils_tests_coverage.xml - - litellm_core_utils_tests_coverage litellm_mapped_tests_mcps: docker: - image: cimg/python:3.11 @@ -1803,14 +1565,14 @@ jobs: username: ${DOCKERHUB_USERNAME} password: ${DOCKERHUB_PASSWORD} working_directory: ~/project - resource_class: xlarge + resource_class: medium steps: - setup_litellm_test_deps - run: name: Run MCP client tests command: | - python -m pytest tests/test_litellm/experimental_mcp_client --cov=litellm --cov-report=xml --junitxml=test-results/junit-mcps.xml --durations=10 -n 4 --maxfail=5 --timeout=300 -vv --log-cli-level=WARNING - no_output_timeout: 120m + python -m pytest tests/test_litellm/experimental_mcp_client --cov=litellm --cov-report=xml --junitxml=test-results/junit-mcps.xml --durations=10 -n 2 --maxfail=5 --timeout=300 -vv --log-cli-level=WARNING + no_output_timeout: 15m - run: name: Rename the coverage files command: | @@ -1830,26 +1592,16 @@ jobs: username: ${DOCKERHUB_USERNAME} password: ${DOCKERHUB_PASSWORD} working_directory: ~/project - resource_class: xlarge + resource_class: large steps: - setup_litellm_test_deps - run: name: Run integrations tests command: | - python -m pytest tests/test_litellm/integrations --cov=litellm --cov-report=xml --junitxml=test-results/junit-integrations.xml --durations=10 -n 16 --maxfail=5 --timeout=300 -vv --log-cli-level=WARNING - no_output_timeout: 120m - - run: - name: Rename the coverage files - command: | - mv coverage.xml litellm_integrations_tests_coverage.xml - mv .coverage litellm_integrations_tests_coverage + python -m pytest tests/test_litellm/integrations --junitxml=test-results/junit-integrations.xml --durations=10 -n 4 --maxfail=5 --timeout=300 -vv --log-cli-level=WARNING + no_output_timeout: 15m - store_test_results: path: test-results - - persist_to_workspace: - root: . - paths: - - litellm_integrations_tests_coverage.xml - - litellm_integrations_tests_coverage litellm_mapped_enterprise_tests: docker: - image: cimg/python:3.11 @@ -1857,6 +1609,7 @@ jobs: username: ${DOCKERHUB_USERNAME} password: ${DOCKERHUB_PASSWORD} working_directory: ~/project + resource_class: large steps: - checkout @@ -1864,8 +1617,8 @@ jobs: - run: name: Install Dependencies command: | - python -m pip install --upgrade pip - python -m pip install -r requirements.txt + python -m pip install --upgrade pip uv + uv pip install --system -r requirements.txt pip install "pytest-mock==3.12.0" pip install "pytest==7.3.1" pip install "pytest-retry==1.6.3" @@ -1878,7 +1631,8 @@ jobs: pip install "requests-mock>=1.12.1" pip install "responses==0.25.7" pip install "pytest-xdist==3.6.1" - pip install "semantic_router==0.1.10" + pip install "semantic_router==0.1.10" --no-deps + pip install aurelio_sdk pip install "fastapi-offline==1.7.3" - setup_litellm_enterprise_pip - run: @@ -1887,22 +1641,11 @@ jobs: pwd ls prisma generate - python -m pytest -vv tests/enterprise --cov=litellm --cov-report=xml -x -s -v --junitxml=test-results/junit-enterprise.xml --durations=10 -n 8 - no_output_timeout: 120m - - run: - name: Rename the coverage files - command: | - mv coverage.xml litellm_mapped_tests_coverage.xml - mv .coverage litellm_mapped_tests_coverage - + python -m pytest -v tests/enterprise -x --junitxml=test-results/junit-enterprise.xml --durations=10 -n 4 + no_output_timeout: 15m # Store test results - store_test_results: path: test-results - - persist_to_workspace: - root: . - paths: - - litellm_mapped_tests_coverage.xml - - litellm_mapped_tests_coverage batches_testing: docker: - image: cimg/python:3.11 @@ -1917,8 +1660,8 @@ jobs: - run: name: Install Dependencies command: | - python -m pip install --upgrade pip - python -m pip install -r requirements.txt + python -m pip install --upgrade pip uv + uv pip install --system -r requirements.txt pip install "respx==0.22.0" pip install "pytest==7.3.1" pip install "pytest-retry==1.6.3" @@ -1926,14 +1669,15 @@ jobs: pip install "pytest-cov==5.0.0" pip install "google-generativeai==0.3.2" pip install "google-cloud-aiplatform==1.43.0" + pip install "pytest-xdist==3.6.1" # Run pytest and generate JUnit XML report - run: name: Run tests command: | pwd ls - python -m pytest -vv tests/batches_tests --cov=litellm --cov-report=xml -x -s -v --junitxml=test-results/junit.xml --durations=5 - no_output_timeout: 120m + python -m pytest -vv tests/batches_tests --cov=litellm --cov-report=xml -x -s -v --junitxml=test-results/junit.xml --durations=5 -n 2 + no_output_timeout: 15m - run: name: Rename the coverage files command: | @@ -1962,9 +1706,9 @@ jobs: - run: name: Install Dependencies command: | - python -m pip install --upgrade pip + python -m pip install --upgrade pip uv + uv pip install --system -r requirements.txt pip install numpydoc - python -m pip install -r requirements.txt pip install "respx==0.22.0" pip install "pytest==7.3.1" pip install "pytest-retry==1.6.3" @@ -1973,14 +1717,15 @@ jobs: pip install "google-generativeai==0.3.2" pip install "google-cloud-aiplatform==1.43.0" pip install pytest-mock + pip install "pytest-xdist==3.6.1" # Run pytest and generate JUnit XML report - run: name: Run tests command: | pwd ls - python -m pytest -vv tests/litellm_utils_tests --cov=litellm --cov-report=xml -x -s -v --junitxml=test-results/junit.xml --durations=5 - no_output_timeout: 120m + python -m pytest -vv tests/litellm_utils_tests --cov=litellm --cov-report=xml -x -s -v --junitxml=test-results/junit.xml --durations=5 -n 2 + no_output_timeout: 15m - run: name: Rename the coverage files command: | @@ -2010,21 +1755,17 @@ jobs: - run: name: Install Dependencies command: | - python -m pip install --upgrade pip - python -m pip install -r requirements.txt - pip install "pytest==7.3.1" - pip install "pytest-retry==1.6.3" - pip install "pytest-cov==5.0.0" - pip install "pytest-asyncio==0.21.1" - pip install "respx==0.22.0" + python -m pip install --upgrade pip uv + uv pip install --system -r requirements.txt + pip install "pytest==7.3.1" "pytest-retry==1.6.3" "pytest-cov==5.0.0" "pytest-asyncio==0.21.1" "respx==0.22.0" "pytest-xdist==3.6.1" # Run pytest and generate JUnit XML report - run: name: Run tests command: | pwd ls - python -m pytest -vv tests/pass_through_unit_tests --cov=litellm --cov-report=xml -x -s -v --junitxml=test-results/junit.xml --durations=5 - no_output_timeout: 120m + python -m pytest -vv tests/pass_through_unit_tests --cov=litellm --cov-report=xml -x -v --junitxml=test-results/junit.xml --durations=5 -n 4 + no_output_timeout: 15m - run: name: Rename the coverage files command: | @@ -2046,6 +1787,7 @@ jobs: username: ${DOCKERHUB_USERNAME} password: ${DOCKERHUB_PASSWORD} working_directory: ~/project + resource_class: large steps: - checkout @@ -2053,8 +1795,8 @@ jobs: - run: name: Install Dependencies command: | - python -m pip install --upgrade pip - python -m pip install -r requirements.txt + python -m pip install --upgrade pip uv + uv pip install --system -r requirements.txt pip install "pytest==7.3.1" pip install "pytest-retry==1.6.3" pip install "pytest-cov==5.0.0" @@ -2067,22 +1809,11 @@ jobs: command: | pwd ls - python -m pytest -vv tests/image_gen_tests -n 4 --cov=litellm --cov-report=xml -x -v --junitxml=test-results/junit.xml --durations=5 - no_output_timeout: 120m - - run: - name: Rename the coverage files - command: | - mv coverage.xml image_gen_coverage.xml - mv .coverage image_gen_coverage - + python -m pytest -v tests/image_gen_tests -n 4 -x --junitxml=test-results/junit.xml --durations=5 + no_output_timeout: 15m # Store test results - store_test_results: path: test-results - - persist_to_workspace: - root: . - paths: - - image_gen_coverage.xml - - image_gen_coverage logging_testing: docker: - image: cimg/python:3.11 @@ -2097,8 +1828,8 @@ jobs: - run: name: Install Dependencies command: | - python -m pip install --upgrade pip - python -m pip install -r requirements.txt + python -m pip install --upgrade pip uv + uv pip install --system -r requirements.txt pip install "pytest==7.3.1" pip install "pytest-retry==1.6.3" pip install "pytest-cov==5.0.0" @@ -2111,6 +1842,7 @@ jobs: pip install "anthropic==0.52.0" pip install "blockbuster==1.5.24" pip install "pytest-xdist==3.6.1" + pip install "pytest-timeout==2.2.0" # Run pytest and generate JUnit XML report - setup_litellm_enterprise_pip - run: @@ -2118,13 +1850,13 @@ jobs: command: | pwd ls - python -m pytest -vv tests/logging_callback_tests --cov=litellm -n 4 --cov-report=xml -s -v --junitxml=test-results/junit.xml --durations=5 - no_output_timeout: 120m + LITELLM_LOG=WARNING python -m pytest tests/logging_callback_tests -vv --cov=litellm --cov-report=xml -n 4 --junitxml=test-results/junit.xml --durations=5 --timeout=120 --timeout_method=thread + no_output_timeout: 15m - run: name: Rename the coverage files command: | - mv coverage.xml logging_coverage.xml - mv .coverage logging_coverage + mv coverage.xml logging_coverage.xml || true + mv .coverage logging_coverage || true # Store test results - store_test_results: @@ -2148,8 +1880,8 @@ jobs: - run: name: Install Dependencies command: | - python -m pip install --upgrade pip - python -m pip install -r requirements.txt + python -m pip install --upgrade pip uv + uv pip install --system -r requirements.txt pip install "pytest==7.3.1" pip install "pytest-retry==1.6.3" pip install "pytest-cov==5.0.0" @@ -2162,7 +1894,7 @@ jobs: pwd ls python -m pytest -vv tests/audio_tests --cov=litellm --cov-report=xml -x -s -v --junitxml=test-results/junit.xml --durations=5 - no_output_timeout: 120m + no_output_timeout: 15m - run: name: Rename the coverage files command: | @@ -2219,6 +1951,7 @@ jobs: username: ${DOCKERHUB_USERNAME} password: ${DOCKERHUB_PASSWORD} working_directory: ~/project + resource_class: medium steps: - checkout @@ -2226,9 +1959,9 @@ jobs: - run: name: Install Dependencies command: | - python -m pip install --upgrade pip - python -m pip install wheel setuptools - python -m pip install -r requirements.txt + python -m pip install --upgrade pip uv + pip install wheel setuptools + uv pip install --system -r requirements.txt pip install "pytest==7.3.1" pip install "pytest-retry==1.6.3" pip install "pytest-asyncio==0.21.1" @@ -2240,7 +1973,7 @@ jobs: command: | pwd ls - python -m pytest -vv tests/local_testing/test_basic_python_version.py + python -m pytest -v tests/local_testing/test_basic_python_version.py helm_chart_testing: machine: image: ubuntu-2204:2023.10.1 # Use machine executor instead of docker @@ -2249,6 +1982,8 @@ jobs: steps: - checkout + - attach_workspace: + at: ~/project - setup_google_dns # Install Helm - run: @@ -2279,10 +2014,11 @@ jobs: kind create cluster --name litellm-test - run: - name: Build Docker image for helm tests + name: Load Docker Database Image for helm tests command: | + zstd -d litellm-docker-database.tar.zst --stdout | docker load IMAGE_TAG=${CIRCLE_SHA1:-ci} - docker build -t litellm-ci:${IMAGE_TAG} -f docker/Dockerfile.database . + docker tag litellm-docker-database:ci litellm-ci:${IMAGE_TAG} - run: name: Load Docker image into Kind @@ -2378,7 +2114,7 @@ jobs: db_migration_disable_update_check: machine: image: ubuntu-2204:2023.10.1 - resource_class: xlarge + resource_class: medium working_directory: ~/project steps: - checkout @@ -2406,7 +2142,7 @@ jobs: - run: name: Load Docker Database Image command: | - gunzip -c litellm-docker-database.tar.gz | docker load + zstd -d litellm-docker-database.tar.zst --stdout | docker load docker images | grep litellm-docker-database - run: name: Run Docker container @@ -2452,23 +2188,19 @@ jobs: - run: name: Run Basic Proxy Startup Tests (Health Readiness and Chat Completion) command: | - python -m pytest -vv tests/basic_proxy_startup_tests -x --junitxml=test-results/junit-2.xml --durations=5 - no_output_timeout: 120m + python -m pytest -v tests/basic_proxy_startup_tests -x --junitxml=test-results/junit-2.xml --durations=5 + no_output_timeout: 15m build_and_test: machine: image: ubuntu-2204:2023.10.1 - resource_class: xlarge + resource_class: large working_directory: ~/project steps: - checkout + - attach_workspace: + at: ~/project - setup_google_dns - - run: - name: Install Docker CLI (In case it's not already installed) - command: | - curl -fsSL https://get.docker.com | sh - sudo usermod -aG docker $USER - docker version - run: name: Install Python 3.9 command: | @@ -2534,8 +2266,10 @@ jobs: name: Wait for PostgreSQL to be ready command: dockerize -wait tcp://localhost:5432 -timeout 1m - run: - name: Build Docker image - command: docker build -t my-app:latest -f ./docker/Dockerfile.database . + name: Load Docker Database Image + command: | + zstd -d litellm-docker-database.tar.zst --stdout | docker load + docker tag litellm-docker-database:ci my-app:latest - run: name: Run Docker container command: | @@ -2590,8 +2324,8 @@ jobs: command: | pwd ls - python -m pytest -s -vv tests/*.py -x --junitxml=test-results/junit.xml -n 4 --durations=5 --ignore=tests/otel_tests --ignore=tests/spend_tracking_tests --ignore=tests/pass_through_tests --ignore=tests/proxy_admin_ui_tests --ignore=tests/load_tests --ignore=tests/llm_translation --ignore=tests/llm_responses_api_testing --ignore=tests/mcp_tests --ignore=tests/guardrails_tests --ignore=tests/image_gen_tests --ignore=tests/pass_through_unit_tests - no_output_timeout: 120m + python -m pytest -s -v tests/*.py -x --junitxml=test-results/junit.xml -n 4 --durations=5 --ignore=tests/otel_tests --ignore=tests/spend_tracking_tests --ignore=tests/pass_through_tests --ignore=tests/proxy_admin_ui_tests --ignore=tests/load_tests --ignore=tests/llm_translation --ignore=tests/llm_responses_api_testing --ignore=tests/mcp_tests --ignore=tests/guardrails_tests --ignore=tests/image_gen_tests --ignore=tests/pass_through_unit_tests + no_output_timeout: 15m # Store test results - store_test_results: @@ -2599,7 +2333,7 @@ jobs: e2e_openai_endpoints: machine: image: ubuntu-2204:2023.10.1 - resource_class: xlarge + resource_class: large working_directory: ~/project steps: - checkout @@ -2680,7 +2414,7 @@ jobs: - run: name: Load Docker Database Image command: | - gunzip -c litellm-docker-database.tar.gz | docker load + zstd -d litellm-docker-database.tar.zst --stdout | docker load docker images | grep litellm-docker-database - run: name: Run Docker container @@ -2738,7 +2472,7 @@ jobs: pwd ls python -m pytest -s -vv tests/openai_endpoints_tests --junitxml=test-results/junit.xml --durations=5 - no_output_timeout: 120m + no_output_timeout: 15m # Store test results - store_test_results: @@ -2746,7 +2480,7 @@ jobs: proxy_logging_guardrails_model_info_tests: machine: image: ubuntu-2204:2023.10.1 - resource_class: xlarge + resource_class: large working_directory: ~/project steps: - checkout @@ -2824,7 +2558,7 @@ jobs: - run: name: Load Docker Database Image command: | - gunzip -c litellm-docker-database.tar.gz | docker load + zstd -d litellm-docker-database.tar.zst --stdout | docker load docker images | grep litellm-docker-database - run: name: Run Docker container @@ -2882,9 +2616,8 @@ jobs: command: | pwd ls - python -m pytest -vv tests/otel_tests -x --junitxml=test-results/junit.xml --durations=5 - no_output_timeout: - 120m + python -m pytest -v tests/otel_tests -x --junitxml=test-results/junit.xml --durations=5 + no_output_timeout: 15m # Clean up first container - run: name: Stop and remove first container @@ -2926,8 +2659,8 @@ jobs: - run: name: Run second round of tests command: | - python -m pytest -vv tests/basic_proxy_startup_tests -x --junitxml=test-results/junit-2.xml --durations=5 - no_output_timeout: 120m + python -m pytest -v tests/basic_proxy_startup_tests -x --junitxml=test-results/junit-2.xml --durations=5 + no_output_timeout: 15m # Store test results - store_test_results: @@ -2935,7 +2668,7 @@ jobs: proxy_spend_accuracy_tests: machine: image: ubuntu-2204:2023.10.1 - resource_class: xlarge + resource_class: large working_directory: ~/project steps: - checkout @@ -2989,7 +2722,7 @@ jobs: - run: name: Load Docker Database Image command: | - gunzip -c litellm-docker-database.tar.gz | docker load + zstd -d litellm-docker-database.tar.zst --stdout | docker load docker images | grep litellm-docker-database - run: name: Run Docker container @@ -3036,8 +2769,7 @@ jobs: pwd ls python -m pytest -vv tests/spend_tracking_tests -x --junitxml=test-results/junit.xml --durations=5 - no_output_timeout: - 120m + no_output_timeout: 15m # Clean up first container - run: name: Stop and remove first container @@ -3048,7 +2780,7 @@ jobs: proxy_multi_instance_tests: machine: image: ubuntu-2204:2023.10.1 - resource_class: xlarge + resource_class: large working_directory: ~/project steps: - checkout @@ -3106,7 +2838,7 @@ jobs: - run: name: Load Docker Database Image command: | - gunzip -c litellm-docker-database.tar.gz | docker load + zstd -d litellm-docker-database.tar.zst --stdout | docker load docker images | grep litellm-docker-database - run: name: Run Docker container 1 @@ -3176,8 +2908,7 @@ jobs: pwd ls python -m pytest -vv tests/multi_instance_e2e_tests -x --junitxml=test-results/junit.xml --durations=5 - no_output_timeout: - 120m + no_output_timeout: 15m # Clean up first container # Store test results - store_test_results: @@ -3186,7 +2917,7 @@ jobs: proxy_store_model_in_db_tests: machine: image: ubuntu-2204:2023.10.1 - resource_class: xlarge + resource_class: large working_directory: ~/project steps: - checkout @@ -3246,7 +2977,7 @@ jobs: - run: name: Load Docker Database Image command: | - gunzip -c litellm-docker-database.tar.gz | docker load + zstd -d litellm-docker-database.tar.zst --stdout | docker load docker images | grep litellm-docker-database - run: name: Run Docker container @@ -3287,7 +3018,7 @@ jobs: pwd ls python -m pytest -vv tests/store_model_in_db_tests -x --junitxml=test-results/junit.xml --durations=5 - no_output_timeout: 120m + no_output_timeout: 15m - run: name: Stop and remove containers command: | @@ -3303,7 +3034,7 @@ jobs: # Change from docker to machine executor machine: image: ubuntu-2204:2023.10.1 - resource_class: xlarge + resource_class: large working_directory: ~/project steps: - checkout @@ -3323,16 +3054,9 @@ jobs: - run: name: Install Dependencies command: | - pip install "pytest==7.3.1" - pip install "pytest-asyncio==0.21.1" - pip install aiohttp python -m pip install --upgrade pip - pip install "pytest==7.3.1" - pip install "pytest-retry==1.6.3" - pip install "pytest-mock==3.12.0" - pip install "pytest-asyncio==0.21.1" - pip install "mypy==1.18.2" - pip install apscheduler + pip install "pytest==7.3.1" "pytest-asyncio==0.21.1" "pytest-retry==1.6.3" \ + "pytest-mock==3.12.0" "mypy==1.18.2" aiohttp apscheduler - run: name: Build Docker image command: | @@ -3389,8 +3113,7 @@ jobs: name: Run tests command: | python -m pytest -vv tests/basic_proxy_startup_tests -x --junitxml=test-results/junit-2.xml --durations=5 - no_output_timeout: - 120m + no_output_timeout: 15m # Clean up first container - run: name: Stop and remove first container @@ -3400,17 +3123,11 @@ jobs: proxy_pass_through_endpoint_tests: machine: image: ubuntu-2204:2023.10.1 - resource_class: xlarge + resource_class: large working_directory: ~/project steps: - checkout - setup_google_dns - - run: - name: Install Docker CLI (In case it's not already installed) - command: | - curl -fsSL https://get.docker.com | sh - sudo usermod -aG docker $USER - docker version - run: name: Install Python 3.10 command: | @@ -3482,7 +3199,7 @@ jobs: - run: name: Load Docker Database Image command: | - gunzip -c litellm-docker-database.tar.gz | docker load + zstd -d litellm-docker-database.tar.zst --stdout | docker load docker images | grep litellm-docker-database - run: name: Run Docker container @@ -3578,8 +3295,8 @@ jobs: conda activate myenv pwd ls - python -m pytest -vv tests/pass_through_tests/ -x --junitxml=test-results/junit.xml --durations=5 - no_output_timeout: 120m + python -m pytest -v tests/pass_through_tests/ -x --junitxml=test-results/junit.xml --durations=5 + no_output_timeout: 15m # Store test results - store_test_results: @@ -3588,7 +3305,7 @@ jobs: proxy_e2e_anthropic_messages_tests: machine: image: ubuntu-2204:2023.10.1 - resource_class: xlarge + resource_class: large working_directory: ~/project steps: - checkout @@ -3646,7 +3363,7 @@ jobs: - run: name: Load Docker Database Image command: | - gunzip -c litellm-docker-database.tar.gz | docker load + zstd -d litellm-docker-database.tar.zst --stdout | docker load docker images | grep litellm-docker-database - run: name: Run Docker container with test config @@ -3685,7 +3402,7 @@ jobs: pwd ls python -m pytest -vv tests/proxy_e2e_anthropic_messages_tests/ -x -s --junitxml=test-results/junit.xml --durations=5 - no_output_timeout: 120m + no_output_timeout: 15m # Store test results - store_test_results: @@ -3694,7 +3411,7 @@ jobs: proxy_e2e_azure_batches_tests: machine: image: ubuntu-2204:2023.10.1 - resource_class: xlarge + resource_class: large working_directory: ~/project steps: - checkout @@ -3797,7 +3514,7 @@ jobs: --maxfail=3 \ --durations=10 \ --junitxml=test-results/junit.xml - no_output_timeout: 30m + no_output_timeout: 15m upload-coverage: docker: @@ -3820,7 +3537,7 @@ jobs: python -m venv venv . venv/bin/activate pip install coverage - coverage combine llm_translation_coverage realtime_translation_coverage llm_responses_api_coverage ocr_coverage search_coverage mcp_coverage litellm_mcps_tests_coverage logging_coverage audio_coverage litellm_router_coverage litellm_router_unit_coverage local_testing_part1_coverage local_testing_part2_coverage litellm_assistants_api_coverage auth_ui_unit_tests_coverage langfuse_coverage caching_coverage litellm_proxy_unit_tests_part1_coverage litellm_proxy_unit_tests_part2_coverage image_gen_coverage pass_through_unit_tests_coverage batches_coverage litellm_security_tests_coverage guardrails_coverage litellm_mapped_tests_coverage + coverage combine realtime_translation_coverage ocr_coverage search_coverage mcp_coverage litellm_mcps_tests_coverage logging_coverage audio_coverage local_testing_part1_coverage local_testing_part2_coverage pass_through_unit_tests_coverage batches_coverage guardrails_coverage coverage xml - codecov/upload: file: ./coverage.xml @@ -4019,83 +3736,87 @@ jobs: twine upload --verbose dist/* ui_build: - machine: - image: ubuntu-2204:2023.10.1 - resource_class: xlarge + docker: + - image: cimg/node:20.19 + auth: + username: ${DOCKERHUB_USERNAME} + password: ${DOCKERHUB_PASSWORD} + resource_class: medium+ working_directory: ~/project steps: - checkout - setup_google_dns + - restore_cache: + keys: + - ui-build-deps-v1-{{ checksum "ui/litellm-dashboard/package-lock.json" }} + - ui-build-deps-v1- + - restore_cache: + keys: + - ui-nextjs-cache-v1-{{ checksum "ui/litellm-dashboard/package-lock.json" }} + - ui-nextjs-cache-v1- + - run: + name: Install dependencies + command: | + cd ui/litellm-dashboard + npm ci + - save_cache: + key: ui-build-deps-v1-{{ checksum "ui/litellm-dashboard/package-lock.json" }} + paths: + - ui/litellm-dashboard/node_modules - run: name: Build UI command: | - # Set up nvm - export NVM_DIR="/opt/circleci/.nvm" - source "$NVM_DIR/nvm.sh" - source "$NVM_DIR/bash_completion" - - # Install and use Node version - nvm install v20 - nvm use v20 - cd ui/litellm-dashboard - - # Remove node_modules and package-lock to ensure clean install (fixes dependency resolution issues) - rm -rf node_modules package-lock.json - - # Install dependencies first - npm install - - # Now source the build script source ./build_ui.sh + - save_cache: + key: ui-nextjs-cache-v1-{{ checksum "ui/litellm-dashboard/package-lock.json" }} + paths: + - ui/litellm-dashboard/.next/cache - persist_to_workspace: root: . paths: - litellm/proxy/_experimental/out ui_unit_tests: - machine: - image: ubuntu-2204:2023.10.1 + docker: + - image: cimg/node:20.19 + auth: + username: ${DOCKERHUB_USERNAME} + password: ${DOCKERHUB_PASSWORD} resource_class: xlarge working_directory: ~/project steps: - checkout - setup_google_dns + - restore_cache: + keys: + - ui-unit-deps-v1-{{ checksum "ui/litellm-dashboard/package-lock.json" }} + - ui-unit-deps-v1- + - run: + name: Install dependencies + command: | + cd ui/litellm-dashboard + npm ci + - save_cache: + key: ui-unit-deps-v1-{{ checksum "ui/litellm-dashboard/package-lock.json" }} + paths: + - ui/litellm-dashboard/node_modules - run: name: Run UI unit tests (Vitest) command: | - # Use Node 20 (several deps require >=20) - export NVM_DIR="/opt/circleci/.nvm" - source "$NVM_DIR/nvm.sh" - nvm install 20 - nvm use 20 - cd ui/litellm-dashboard - # Remove node_modules and package-lock to ensure clean install (fixes optional deps issue) - rm -rf node_modules package-lock.json - npm install - # CI run, with both LCOV (Codecov) and HTML (artifact you can click) - CI=true npm run test -- --run --coverage \ - --coverage.provider=v8 \ - --coverage.reporter=lcov \ - --coverage.reporter=html \ - --coverage.reportsDirectory=coverage/html + CI=true npm run test -- --run \ + --pool forks --poolOptions.forks.maxForks=8 build_docker_database_image: machine: - image: ubuntu-2204:2023.10.1 - resource_class: xlarge + image: ubuntu-2204:2024.04.1 + resource_class: large working_directory: ~/project steps: - checkout - - run: - name: Upgrade Docker - command: | - curl -fsSL https://get.docker.com | sh - docker version - - run: name: Build Docker image command: | @@ -4106,17 +3827,17 @@ jobs: - run: name: Save Docker image to workspace root command: | - docker save litellm-docker-database:ci | gzip > litellm-docker-database.tar.gz + docker save litellm-docker-database:ci | zstd -1 -T0 > litellm-docker-database.tar.zst - persist_to_workspace: root: . paths: - - litellm-docker-database.tar.gz + - litellm-docker-database.tar.zst e2e_ui_testing: machine: image: ubuntu-2204:2023.10.1 - resource_class: xlarge + resource_class: large working_directory: ~/project parameters: browser: @@ -4129,7 +3850,7 @@ jobs: - run: name: Load Docker Database Image command: | - gunzip -c litellm-docker-database.tar.gz | docker load + zstd -d litellm-docker-database.tar.zst --stdout | docker load docker images | grep litellm-docker-database - run: name: Install Dependencies @@ -4201,7 +3922,7 @@ jobs: --config ui/litellm-dashboard/e2e_tests/playwright.config.ts \ --reporter=html \ --output=test-results - no_output_timeout: 120m + no_output_timeout: 15m - store_artifacts: path: test-results destination: playwright-results @@ -4213,7 +3934,7 @@ jobs: prisma_schema_sync: machine: image: ubuntu-2204:2023.10.1 - resource_class: xlarge + resource_class: medium working_directory: ~/project steps: - checkout @@ -4223,7 +3944,7 @@ jobs: - run: name: Load Docker Database Image command: | - gunzip -c litellm-docker-database.tar.gz | docker load + zstd -d litellm-docker-database.tar.zst --stdout | docker load docker images | grep litellm-docker-database - run: name: Install Neon CLI @@ -4267,36 +3988,16 @@ jobs: name: Stop schema sync container command: docker stop schema-sync - test_nonroot_image: - machine: - image: ubuntu-2204:2023.10.1 - resource_class: xlarge - working_directory: ~/project - steps: - - checkout - - setup_google_dns - - run: - name: Build Docker image - command: | - docker build -t non_root_image:latest . -f ./docker/Dockerfile.non_root - - run: - name: Install Container Structure Test - command: | - curl -LO https://github.com/GoogleContainerTools/container-structure-test/releases/download/v1.19.3/container-structure-test-linux-amd64 - chmod +x container-structure-test-linux-amd64 - sudo mv container-structure-test-linux-amd64 /usr/local/bin/container-structure-test - - run: - name: Run Container Structure Test - command: | - container-structure-test test --image non_root_image:latest --config docker/tests/nonroot.yaml test_bad_database_url: machine: image: ubuntu-2204:2023.10.1 - resource_class: xlarge + resource_class: medium working_directory: ~/project steps: - checkout + - attach_workspace: + at: ~/project - setup_google_dns - run: name: Install dockerize @@ -4318,9 +4019,10 @@ jobs: name: Wait for PostgreSQL to be ready command: dockerize -wait tcp://localhost:5432 -timeout 1m - run: - name: Build Docker image + name: Load Docker Database Image command: | - docker build -t myapp . -f ./docker/Dockerfile.non_root + zstd -d litellm-docker-database.tar.zst --stdout | docker load + docker tag litellm-docker-database:ci myapp:latest - run: name: Run Docker container with bad DATABASE_URL command: | @@ -4502,6 +4204,8 @@ workflows: - main - /litellm_.*/ - build_and_test: + requires: + - build_docker_database_image filters: branches: only: @@ -4715,13 +4419,11 @@ workflows: - /litellm_.*/ - upload-coverage: requires: - - llm_translation_testing - realtime_translation_testing - mcp_testing - agent_testing - google_generate_content_endpoint_testing - guardrails_testing - - llm_responses_api_testing - ocr_testing - search_testing - litellm_mapped_tests_proxy_part1 @@ -4738,18 +4440,12 @@ workflows: - image_gen_testing - logging_testing - audio_testing - - litellm_router_testing - - litellm_router_unit_testing - caching_unit_tests - litellm_proxy_unit_testing_key_generation - - litellm_proxy_unit_testing_part1 - - litellm_proxy_unit_testing_part2 - - litellm_security_tests - langfuse_logging_unit_tests - local_testing_part1 - local_testing_part2 - litellm_assistants_api_testing - - auth_ui_unit_tests - db_migration_disable_update_check: requires: - build_docker_database_image @@ -4771,12 +4467,16 @@ workflows: - main - /litellm_.*/ - helm_chart_testing: + requires: + - build_docker_database_image filters: branches: only: - main - /litellm_.*/ - test_bad_database_url: + requires: + - build_docker_database_image filters: branches: only: @@ -4825,6 +4525,7 @@ workflows: - langfuse_logging_unit_tests - litellm_assistants_api_testing - auth_ui_unit_tests + - ui_unit_tests - db_migration_disable_update_check - e2e_ui_testing_chromium - e2e_ui_testing_firefox diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index bd434bea39..d830c16dfa 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -11,6 +11,10 @@ - [ ] My PR's scope is as isolated as possible, it only solves 1 specific problem - [ ] I have requested a Greptile review by commenting `@greptileai` and received a **Confidence Score of at least 4/5** before requesting a maintainer review +## Delays in PR merge? + +If you're seeing a delay in your PR being merged, ping the LiteLLM Team on [Slack (#pr-review)](https://join.slack.com/t/litellmossslack/shared_invite/zt-3o7nkuyfr-p_kbNJj8taRfXGgQI1~YyA). + ## CI (LiteLLM team) > **CI status guideline:** diff --git a/.github/workflows/codspeed.yml b/.github/workflows/codspeed.yml new file mode 100644 index 0000000000..385b95fdaf --- /dev/null +++ b/.github/workflows/codspeed.yml @@ -0,0 +1,44 @@ +name: CodSpeed Benchmarks + +on: + push: + branches: + - main + pull_request: + branches: + - main + # Allow CodSpeed to trigger backtest performance analysis + # in order to generate initial data + workflow_dispatch: + +permissions: + contents: read + id-token: write + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + benchmarks: + runs-on: ubuntu-latest + timeout-minutes: 15 + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Install dependencies + run: | + pip install -e "." + pip install pytest pytest-codspeed==4.3.0 + + - name: Run benchmarks + uses: CodSpeedHQ/action@v4 + with: + mode: simulation + run: pytest tests/benchmarks/ --codspeed diff --git a/Dockerfile b/Dockerfile index 4c6f22a95b..7bda32acf2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -39,7 +39,7 @@ RUN pip wheel --no-cache-dir --wheel-dir=/wheels/ -r requirements.txt # ensure pyjwt is used, not jwt RUN pip uninstall jwt -y RUN pip uninstall PyJWT -y -RUN pip install PyJWT==2.9.0 --no-cache-dir +RUN pip install PyJWT==2.12.0 --no-cache-dir # Runtime stage FROM $LITELLM_RUNTIME_IMAGE AS runtime diff --git a/README.md b/README.md index 3db827d5fd..67f2f3a204 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,9 @@ Slack + + CodSpeed + Group 7154 (1) diff --git a/docker/Dockerfile.database b/docker/Dockerfile.database index b69dc049ce..3e1c55a75a 100644 --- a/docker/Dockerfile.database +++ b/docker/Dockerfile.database @@ -112,7 +112,7 @@ RUN sed -i 's/\r$//' docker/install_auto_router.sh && chmod +x docker/install_au # ensure pyjwt is used, not jwt RUN pip uninstall jwt -y RUN pip uninstall PyJWT -y -RUN pip install PyJWT==2.9.0 --no-cache-dir +RUN pip install PyJWT==2.12.0 --no-cache-dir # Build Admin UI (runtime stage) # Convert Windows line endings to Unix and make executable diff --git a/docker/Dockerfile.dev b/docker/Dockerfile.dev index 17fb3733b1..e3e7ac0e0d 100644 --- a/docker/Dockerfile.dev +++ b/docker/Dockerfile.dev @@ -31,7 +31,7 @@ RUN --mount=type=cache,target=/root/.cache/pip \ # Fix JWT dependency conflicts early RUN pip uninstall jwt -y || true && \ pip uninstall PyJWT -y || true && \ - pip install PyJWT==2.9.0 --no-cache-dir + pip install PyJWT==2.12.0 --no-cache-dir # Copy only necessary files for build COPY pyproject.toml README.md schema.prisma poetry.lock ./ diff --git a/docker/Dockerfile.non_root b/docker/Dockerfile.non_root index fbc16e4f87..db3981fb7e 100644 --- a/docker/Dockerfile.non_root +++ b/docker/Dockerfile.non_root @@ -32,7 +32,7 @@ RUN for i in 1 2 3; do \ # Cache Python dependencies COPY requirements.txt . RUN pip wheel --no-cache-dir --wheel-dir=/wheels/ -r requirements.txt \ - && pip wheel --no-cache-dir --wheel-dir=/wheels/ "semantic_router==0.1.11" "aurelio-sdk==0.0.19" "PyJWT==2.9.0" + && pip wheel --no-cache-dir --wheel-dir=/wheels/ "semantic_router==0.1.11" "aurelio-sdk==0.0.19" "PyJWT==2.12.0" # Copy source after dependency layers COPY . . @@ -106,7 +106,7 @@ RUN for i in 1 2 3; do \ apk add --no-cache python3 py3-pip bash openssl tzdata nodejs npm supervisor && break || sleep 5; \ done \ && apk upgrade --no-cache nodejs \ - && npm install -g npm@latest tar@7.5.10 glob@11.1.0 @isaacs/brace-expansion@5.0.1 minimatch@10.2.4 diff@8.0.3 \ + && npm install -g npm@latest tar@7.5.11 glob@11.1.0 @isaacs/brace-expansion@5.0.1 minimatch@10.2.4 diff@8.0.3 \ && GLOBAL="$(npm root -g)" \ && find "$GLOBAL/npm" -type d -name "tar" -path "*/node_modules/tar" | while read d; do \ rm -rf "$d" && cp -rL "$GLOBAL/tar" "$d"; \ @@ -198,7 +198,7 @@ RUN sed -i 's/\r$//' docker/entrypoint.sh && \ chown -R nobody:nogroup /app /var/lib/litellm/ui /var/lib/litellm/assets /nonexistent /.npm && \ pip uninstall jwt -y || true && \ pip uninstall PyJWT -y || true && \ - pip install --no-index --find-links=/wheels/ PyJWT==2.10.1 --no-cache-dir && \ + pip install --no-index --find-links=/wheels/ PyJWT==2.12.0 --no-cache-dir && \ rm -rf /wheels && \ PRISMA_PATH=$(python -c "import os, prisma; print(os.path.dirname(prisma.__file__))") && \ chown -R nobody:nogroup $PRISMA_PATH && \ diff --git a/docs/my-website/blog/video_characters_litellm/index.md b/docs/my-website/blog/video_characters_litellm/index.md new file mode 100644 index 0000000000..263a17d719 --- /dev/null +++ b/docs/my-website/blog/video_characters_litellm/index.md @@ -0,0 +1,128 @@ +--- +slug: video_characters_api +title: "New Video Characters, Edit and Extension API support" +date: 2026-03-16T10:00:00 +authors: + - name: Sameer Kankute + title: SWE @ LiteLLM + url: https://www.linkedin.com/in/sameer-kankute/ + image_url: https://pbs.twimg.com/profile_images/2001352686994907136/ONgNuSk5_400x400.jpg + - name: Krrish Dholakia + title: "CEO, LiteLLM" + url: https://www.linkedin.com/in/krish-d/ + image_url: https://pbs.twimg.com/profile_images/1298587542745358340/DZv3Oj-h_400x400.jpg + - name: Ishaan Jaff + title: "CTO, LiteLLM" + url: https://www.linkedin.com/in/reffajnaahsi/ + image_url: https://pbs.twimg.com/profile_images/1613813310264340481/lz54oEiB_400x400.jpg +description: "LiteLLM now supports creating, retrieving, and managing reusable video characters across multiple video generations." +tags: [videos, characters, proxy, routing] +hide_table_of_contents: false +--- + +LiteLLM now supoports videos character, edit and extension apis. + +## What's New + +Four new endpoints for video character operations: +- **Create character** - Upload a video to create a reusable asset +- **Get character** - Retrieve character metadata +- **Edit video** - Modify generated videos +- **Extend video** - Continue clips with character consistency + +**Available from:** LiteLLM v1.83.0+ + +## Quick Example + +```python +import litellm + +# Create character from video +character = litellm.avideo_create_character( + name="Luna", + video=open("luna.mp4", "rb"), + custom_llm_provider="openai", + model="sora-2" +) +print(f"Character: {character.id}") + +# Use in generation +video = litellm.avideo( + model="sora-2", + prompt="Luna dances through a magical forest.", + characters=[{"id": character.id}], + seconds="8" +) + +# Get character info +fetched = litellm.avideo_get_character( + character_id=character.id, + custom_llm_provider="openai" +) + +# Edit with character preserved +edited = litellm.avideo_edit( + video_id=video.id, + prompt="Add warm golden lighting" +) + +# Extend sequence +extended = litellm.avideo_extension( + video_id=video.id, + prompt="Luna waves goodbye", + seconds="5" +) +``` + +## Via Proxy + +```bash +# Create character +curl -X POST "http://localhost:4000/v1/videos/characters" \ + -H "Authorization: Bearer sk-litellm-key" \ + -F "video=@luna.mp4" \ + -F "name=Luna" + +# Get character +curl -X GET "http://localhost:4000/v1/videos/characters/char_abc123def456" \ + -H "Authorization: Bearer sk-litellm-key" + +# Edit video +curl -X POST "http://localhost:4000/v1/videos/edits" \ + -H "Authorization: Bearer sk-litellm-key" \ + -H "Content-Type: application/json" \ + -d '{ + "video": {"id": "video_xyz789"}, + "prompt": "Add warm golden lighting and enhance colors" + }' + +# Extend video +curl -X POST "http://localhost:4000/v1/videos/extensions" \ + -H "Authorization: Bearer sk-litellm-key" \ + -H "Content-Type: application/json" \ + -d '{ + "video": {"id": "video_xyz789"}, + "prompt": "Luna waves goodbye and walks into the sunset", + "seconds": "5" + }' +``` + +## Managed Character IDs + +LiteLLM automatically encodes provider and model metadata into character IDs: + +**What happens:** +``` +Upload character "Luna" with model "sora-2" on OpenAI + ↓ +LiteLLM creates: char_abc123def456 (contains provider + model_id) + ↓ +When you reference it later, LiteLLM decodes automatically + ↓ +Router knows exactly which deployment to use +``` + +**Behind the scenes:** +- Character ID format: `character_` +- Metadata includes: provider, model_id, original_character_id +- Transparent to you - just use the ID, LiteLLM handles routing \ No newline at end of file diff --git a/docs/my-website/docs/observability/vantage.md b/docs/my-website/docs/observability/vantage.md new file mode 100644 index 0000000000..31b43a76c3 --- /dev/null +++ b/docs/my-website/docs/observability/vantage.md @@ -0,0 +1,148 @@ +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# Vantage Integration + +LiteLLM can export proxy spend data to [Vantage](https://vantage.sh) as [FOCUS 1.2](https://focus.finops.org/) formatted cost reports. This lets you visualize LLM spend alongside your cloud infrastructure costs in the Vantage dashboard. + +## Overview + +| Property | Details | +|----------|---------| +| Destination | Export LiteLLM usage data to Vantage Custom Provider | +| Data format | FOCUS CSV (automatically transformed from LiteLLM spend data) | +| Supported operations | Manual export, automatic scheduled export (hourly/daily/interval) | +| Authentication | Vantage API key + Custom Provider token | + +## Prerequisites + +You need two credentials from the [Vantage console](https://console.vantage.sh): + +1. **API Key** — Go to **Settings → API Access Tokens** → Create a token with **Write** scope. The token looks like `vntg_tkn_...`. +2. **Custom Provider Token** — Go to **Settings → Integrations** → Create a **Custom Provider** integration → Copy the Provider ID (looks like `accss_crdntl_...`). + +## Setup via API + +The recommended setup uses the proxy admin endpoints. No config file changes needed. + +### 1. Initialize credentials + +```bash +curl -X POST http://localhost:4000/vantage/init \ + -H "Authorization: Bearer $LITELLM_ADMIN_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "api_key": "vntg_tkn_YOUR_VANTAGE_API_KEY", + "integration_token": "accss_crdntl_YOUR_PROVIDER_TOKEN" + }' +``` + +Credentials are encrypted and stored in the proxy database. + +### 2. Preview data (dry run) + +```bash +curl -X POST http://localhost:4000/vantage/dry-run \ + -H "Authorization: Bearer $LITELLM_ADMIN_KEY" \ + -H "Content-Type: application/json" \ + -d '{"limit": 10}' +``` + +This returns FOCUS-transformed data without sending anything to Vantage. Use it to verify the pipeline works and inspect the data mapping. + +### 3. Export to Vantage + +```bash +curl -X POST http://localhost:4000/vantage/export \ + -H "Authorization: Bearer $LITELLM_ADMIN_KEY" \ + -H "Content-Type: application/json" \ + -d '{}' +``` + +Optional parameters: +- `limit` — Max number of records to export +- `start_time_utc` / `end_time_utc` — Filter by time range (must be provided together) + +### 4. Verify in Vantage + +Go to **Settings → Integrations → your Custom Provider → Import Costs** tab to see uploaded CSVs. Once the status changes from "Importing and Processing" to "Stable", costs appear in **Cost Reporting → All Resources**. + +## Setup via Environment Variables + +For automatic scheduled exports, configure via environment variables and proxy config: + +### Environment variables + +| Variable | Required | Description | +|----------|----------|-------------| +| `VANTAGE_API_KEY` | Yes | Vantage API access token | +| `VANTAGE_INTEGRATION_TOKEN` | Yes | Custom Provider token from Vantage dashboard | +| `VANTAGE_BASE_URL` | No | API URL override (default: `https://api.vantage.sh`) | +| `VANTAGE_EXPORT_FREQUENCY` | No | `hourly` (default), `daily`, or `interval` | +| `VANTAGE_EXPORT_INTERVAL_SECONDS` | No | Seconds between exports when frequency is `interval` | + +### Proxy config + +```yaml +model_list: + - model_name: gpt-4o + litellm_params: + model: openai/gpt-4o + api_key: sk-your-key + +litellm_settings: + callbacks: ["vantage"] +``` + +```bash +export VANTAGE_API_KEY="vntg_tkn_..." +export VANTAGE_INTEGRATION_TOKEN="accss_crdntl_..." +litellm --config /path/to/config.yaml +``` + +The proxy registers a background job that exports data on the configured schedule. + +## API Endpoints + +All endpoints require admin authentication. + +| Method | Endpoint | Description | +|--------|----------|-------------| +| `POST` | `/vantage/init` | Store Vantage credentials (encrypted) | +| `GET` | `/vantage/settings` | View current config (credentials masked) | +| `PUT` | `/vantage/settings` | Update credentials or base URL | +| `POST` | `/vantage/dry-run` | Preview FOCUS data without uploading | +| `POST` | `/vantage/export` | Upload cost data to Vantage | +| `DELETE` | `/vantage/delete` | Remove credentials and stop scheduled exports | + +## FOCUS Field Mapping + +LiteLLM spend data is transformed into the FOCUS 1.2 schema: + +| LiteLLM Field | FOCUS Column | Description | +|---------------|-------------|-------------| +| `spend` | BilledCost, EffectiveCost | Cost of the usage | +| `model` | ChargeDescription, ResourceId | Model identifier | +| `model_group` | ServiceName | Model group / deployment | +| `custom_llm_provider` | ProviderName, PublisherName | Provider (openai, anthropic, etc.) | +| `api_key` | BillingAccountId | Hashed API key | +| `api_key_alias` | BillingAccountName | Human-readable key alias | +| `team_id` | SubAccountId | Team identifier | +| `team_alias` | SubAccountName | Team name | + +Additional metadata (user_id, model_group, etc.) is included in the `Tags` column as JSON. + +## Upload Limits + +Vantage enforces per-upload limits. LiteLLM handles these automatically: + +- **10,000 rows** per upload — large exports are split into batches +- **2 MB** per upload — oversized batches are further split by size +- **Unsupported columns** are stripped before upload + +## Related Links + +- [Vantage](https://vantage.sh) +- [Vantage Custom Providers](https://docs.vantage.sh/connecting_custom_providers) +- [FOCUS Specification](https://focus.finops.org/) +- [Focus Export (S3/Parquet)](./focus.md) diff --git a/docs/my-website/docs/providers/aws_sagemaker.md b/docs/my-website/docs/providers/aws_sagemaker.md index bab475e730..a2440c73d7 100644 --- a/docs/my-website/docs/providers/aws_sagemaker.md +++ b/docs/my-website/docs/providers/aws_sagemaker.md @@ -526,3 +526,98 @@ print(f"response: {response}") ``` + +## Nova Models on SageMaker + +LiteLLM supports Amazon Nova models (Nova Micro, Nova Lite, Nova 2 Lite) deployed on SageMaker Inference real-time endpoints. These custom/fine-tuned Nova models use an OpenAI-compatible API format. + +**Reference:** [AWS Blog - Amazon SageMaker Inference for Custom Amazon Nova Models](https://aws.amazon.com/blogs/aws/announcing-amazon-sagemaker-inference-for-custom-amazon-nova-models/) + +### Usage + +Use the `sagemaker_nova/` prefix with your SageMaker endpoint name: + +```python +import litellm +import os + +os.environ["AWS_ACCESS_KEY_ID"] = "" +os.environ["AWS_SECRET_ACCESS_KEY"] = "" +os.environ["AWS_REGION_NAME"] = "us-east-1" + +# Basic chat completion +response = litellm.completion( + model="sagemaker_nova/my-nova-endpoint", + messages=[{"role": "user", "content": "Hello, how are you?"}], + temperature=0.7, + max_tokens=512, +) +print(response.choices[0].message.content) +``` + +### Streaming + +```python +response = litellm.completion( + model="sagemaker_nova/my-nova-endpoint", + messages=[{"role": "user", "content": "Write a short poem"}], + stream=True, + stream_options={"include_usage": True}, +) +for chunk in response: + if chunk.choices[0].delta.content: + print(chunk.choices[0].delta.content, end="") +``` + +### Multimodal (Images) + +Nova models on SageMaker support image inputs using base64 data URIs: + +```python +response = litellm.completion( + model="sagemaker_nova/my-nova-endpoint", + messages=[ + { + "role": "user", + "content": [ + {"type": "text", "text": "What's in this image?"}, + {"type": "image_url", "image_url": {"url": "data:image/jpeg;base64,..."}} + ] + } + ], +) +``` + +### Proxy Config + +```yaml +model_list: + - model_name: nova-micro + litellm_params: + model: sagemaker_nova/my-nova-micro-endpoint + aws_access_key_id: os.environ/AWS_ACCESS_KEY_ID + aws_secret_access_key: os.environ/AWS_SECRET_ACCESS_KEY + aws_region_name: us-east-1 +``` + +### Supported Parameters + +All standard OpenAI parameters are supported, plus these Nova-specific parameters: + +| Parameter | Type | Description | +|-----------|------|-------------| +| `top_k` | integer | Limits token selection to top K most likely tokens | +| `reasoning_effort` | `"low"` \| `"high"` | Reasoning effort level (Nova 2 Lite custom models only) | +| `allowed_token_ids` | array[int] | Restrict output to specified token IDs | +| `truncate_prompt_tokens` | integer | Truncate prompt to N tokens if it exceeds limit | + +```python +response = litellm.completion( + model="sagemaker_nova/my-nova-endpoint", + messages=[{"role": "user", "content": "Think step by step: what is 2+2?"}], + top_k=40, + reasoning_effort="low", + logprobs=True, + top_logprobs=2, +) +``` diff --git a/docs/my-website/docs/providers/openai/videos.md b/docs/my-website/docs/providers/openai/videos.md index 202c79c244..b67800092a 100644 --- a/docs/my-website/docs/providers/openai/videos.md +++ b/docs/my-website/docs/providers/openai/videos.md @@ -135,6 +135,81 @@ curl --location --request POST 'http://localhost:4000/v1/videos/video_id/remix' }' ``` +### Character, Edit, and Extension Routes + +OpenAI video routes supported by LiteLLM proxy: + +- `POST /v1/videos/characters` +- `GET /v1/videos/characters/{character_id}` +- `POST /v1/videos/edits` +- `POST /v1/videos/extensions` + +#### `target_model_names` support on character creation + +`POST /v1/videos/characters` supports `target_model_names` for model-based routing (same behavior as video create). + +```bash +curl --location 'http://localhost:4000/v1/videos/characters' \ +--header 'Authorization: Bearer sk-1234' \ +-F 'name=hero' \ +-F 'target_model_names=gpt-4' \ +-F 'video=@/path/to/character.mp4' +``` + +When `target_model_names` is used, LiteLLM returns an encoded character ID: + +```json +{ + "id": "character_...", + "object": "character", + "created_at": 1712697600, + "name": "hero" +} +``` + +Use that encoded ID directly on get: + +```bash +curl --location 'http://localhost:4000/v1/videos/characters/character_...' \ +--header 'Authorization: Bearer sk-1234' +``` + +#### Encoded and non-encoded video IDs for edit/extension + +Both routes accept either plain or encoded `video.id`: + +- `POST /v1/videos/edits` +- `POST /v1/videos/extensions` + +```bash +curl --location 'http://localhost:4000/v1/videos/edits' \ +--header 'Authorization: Bearer sk-1234' \ +--header 'Content-Type: application/json' \ +--data '{ + "prompt": "Make this brighter", + "video": { "id": "video_..." } +}' +``` + +```bash +curl --location 'http://localhost:4000/v1/videos/extensions' \ +--header 'Authorization: Bearer sk-1234' \ +--header 'Content-Type: application/json' \ +--data '{ + "prompt": "Continue this scene", + "seconds": "4", + "video": { "id": "video_..." } +}' +``` + +#### `custom_llm_provider` input sources + +For these routes, `custom_llm_provider` may be supplied via: + +- header: `custom-llm-provider` +- query: `?custom_llm_provider=...` +- body: `custom_llm_provider` (and `extra_body.custom_llm_provider` where supported) + Test OpenAI video generation request ```bash diff --git a/docs/my-website/docs/proxy/config_settings.md b/docs/my-website/docs/proxy/config_settings.md index 65eaf14471..a0e404e3a1 100644 --- a/docs/my-website/docs/proxy/config_settings.md +++ b/docs/my-website/docs/proxy/config_settings.md @@ -778,6 +778,7 @@ router_settings: | LITELLM_GLOBAL_MAX_PARALLEL_REQUEST_RETRIES | Maximum retries for parallel requests in LiteLLM | LITELLM_GLOBAL_MAX_PARALLEL_REQUEST_RETRY_TIMEOUT | Timeout for retries of parallel requests in LiteLLM | LITELLM_DISABLE_LAZY_LOADING | When set to "1", "true", "yes", or "on", disables lazy loading of attributes (currently only affects encoding/tiktoken). This ensures encoding is initialized before VCR starts recording HTTP requests, fixing VCR cassette creation issues. See [issue #18659](https://github.com/BerriAI/litellm/issues/18659) +| LITELLM_DISABLE_REDACT_SECRETS | When set to "true", disables automatic redaction of secrets (API keys, tokens, credentials) from proxy log output. Secret redaction is enabled by default. | LITELLM_MIGRATION_DIR | Custom migrations directory for prisma migrations, used for baselining db in read-only file systems. | LITELLM_HOSTED_UI | URL of the hosted UI for LiteLLM | LITELLM_UI_API_DOC_BASE_URL | Optional override for the API Reference base URL (used in sample code/docs) when the admin UI runs on a different host than the proxy. Defaults to `PROXY_BASE_URL` when unset. @@ -1021,6 +1022,11 @@ router_settings: | UPSTREAM_LANGFUSE_SECRET_KEY | Secret key for upstream Langfuse authentication | USE_AWS_KMS | Flag to enable AWS Key Management Service for encryption | USE_PRISMA_MIGRATE | Flag to use prisma migrate instead of prisma db push. Recommended for production environments. +| VANTAGE_API_KEY | API key for Vantage cost-import integration +| VANTAGE_BASE_URL | Base URL for Vantage API. Default is `https://api.vantage.sh` +| VANTAGE_EXPORT_FREQUENCY | Export frequency for Vantage — `hourly` (default), `daily`, or `interval` +| VANTAGE_EXPORT_INTERVAL_SECONDS | Interval in seconds when VANTAGE_EXPORT_FREQUENCY is `interval` +| VANTAGE_INTEGRATION_TOKEN | Vantage integration token for the cost-import endpoint | WANDB_API_KEY | API key for Weights & Biases (W&B) logging integration | WANDB_HOST | Host URL for Weights & Biases (W&B) service | WANDB_PROJECT_ID | Project ID for Weights & Biases (W&B) logging integration diff --git a/docs/my-website/docs/proxy/tag_routing.md b/docs/my-website/docs/proxy/tag_routing.md index 399c43d2c0..a1ae52e5e4 100644 --- a/docs/my-website/docs/proxy/tag_routing.md +++ b/docs/my-website/docs/proxy/tag_routing.md @@ -209,6 +209,106 @@ Expect to see the following response header when this works x-litellm-model-id: default-model ``` +## Regex-based tag routing (`tag_regex`) + +Use `tag_regex` to route requests based on regex patterns matched against request headers, without requiring clients to pass a tag explicitly. This is useful when clients already send a recognisable header, such as `User-Agent`. + +**Use case: route all Claude Code traffic to dedicated AWS accounts** + +Claude Code always sends `User-Agent: claude-code/`. With `tag_regex` you can route that traffic to a dedicated deployment automatically — no per-developer configuration needed. + +### 1. Config + +```yaml +model_list: + # Claude Code traffic → dedicated deployment, matched by User-Agent + - model_name: claude-sonnet + litellm_params: + model: bedrock/converse/anthropic-claude-sonnet-4-6 + aws_region_name: us-east-1 + aws_role_name: arn:aws:iam::111122223333:role/LiteLLMClaudeCode + tag_regex: + - "^User-Agent: claude-code\\/" # matches claude-code/1.x, 2.x, etc. + model_info: + id: claude-code-deployment + + # All other traffic falls back to the default deployment + - model_name: claude-sonnet + litellm_params: + model: bedrock/converse/anthropic-claude-sonnet-4-6 + aws_region_name: us-east-1 + aws_role_name: arn:aws:iam::444455556666:role/LiteLLMDefault + tags: + - default + model_info: + id: regular-deployment + +router_settings: + enable_tag_filtering: true + tag_filtering_match_any: true + +general_settings: + master_key: sk-1234 +``` + +### 2. Verify routing + +Claude Code sets `User-Agent: claude-code/` automatically — no client config needed: + +```shell +# Claude Code request (User-Agent set automatically by Claude Code) +curl http://localhost:4000/v1/chat/completions \ + -H "Authorization: Bearer sk-1234" \ + -H "User-Agent: claude-code/1.2.3" \ + -d '{"model": "claude-sonnet", "messages": [{"role": "user", "content": "hi"}]}' +# → x-litellm-model-id: claude-code-deployment + +# Any other client (no matching User-Agent) → default deployment +curl http://localhost:4000/v1/chat/completions \ + -H "Authorization: Bearer sk-1234" \ + -d '{"model": "claude-sonnet", "messages": [{"role": "user", "content": "hi"}]}' +# → x-litellm-model-id: regular-deployment +``` + +### How matching works + +| Priority | Condition | Result | +|----------|-----------|--------| +| 1 | Request has `tags` AND deployment has `tags` | Exact tag match (respects `match_any` setting) | +| 2 | Deployment has `tag_regex` AND request has a `User-Agent` | Regex match (always OR logic — any pattern match suffices) | +| 3 | Deployment has `tags: [default]` | Default fallback | +| 4 | No default set | All healthy deployments returned | + +`tag_regex` always uses OR semantics — `tag_filtering_match_any=False` applies only to exact tag matching, not to regex patterns. + +### Observability + +When a regex matches, `tag_routing` is written into request metadata and flows to SpendLogs: + +```json +{ + "tag_routing": { + "matched_via": "tag_regex", + "matched_value": "^User-Agent: claude-code\\/", + "user_agent": "claude-code/1.2.3", + "request_tags": [] + } +} +``` + +### Security note + +:::caution + +**`User-Agent` is a client-supplied header and can be set to any value.** Any API consumer can send `User-Agent: claude-code/1.0` regardless of whether they are actually using Claude Code. + +Do not rely on `tag_regex` routing to enforce access controls or spend limits — use [team/key-based routing](./users) for that. `tag_regex` is a **traffic classification hint** (useful for billing visibility, capacity planning, and routing convenience), not a security boundary. + +::: + + +--- + ## ✨ Team based tag routing (Enterprise) LiteLLM Proxy supports team-based tag routing, allowing you to associate specific tags with teams and route requests accordingly. Example **Team A can access gpt-4 deployment A, Team B can access gpt-4 deployment B** (LLM Access Control For Teams) diff --git a/docs/my-website/docs/tutorials/claude_code_skills.md b/docs/my-website/docs/tutorials/claude_code_skills.md new file mode 100644 index 0000000000..0c6344f956 --- /dev/null +++ b/docs/my-website/docs/tutorials/claude_code_skills.md @@ -0,0 +1,99 @@ +# LiteLLM Skills + +[litellm-skills](https://github.com/BerriAI/litellm-skills) is a collection of [Agent Skills](https://agentskills.io) for managing a live LiteLLM proxy. Install them once and any agent that supports the Agent Skills standard (Claude Code, OpenCode, OpenClaw, etc.) can create users, teams, keys, models, MCP servers, agents, and query usage — all by running `curl` commands against your proxy. + +## Install + +```bash +curl -fsSL https://raw.githubusercontent.com/BerriAI/litellm-skills/main/install.sh | sh +``` + +## Requirements + +- `curl` installed +- A running LiteLLM proxy (local or remote) +- A proxy admin key — not a virtual key scoped to `llm_api_routes` + +## Available Skills + +### Users + +| Skill | What it does | +|-------|-------------| +| `/add-user` | Create a user — email, role, budget, model access | +| `/update-user` | Update budget, role, or models for an existing user | +| `/delete-user` | Delete one or more users | + +### Teams + +| Skill | What it does | +|-------|-------------| +| `/add-team` | Create a team with budget and model limits | +| `/update-team` | Update budget, models, or rate limits | +| `/delete-team` | Delete one or more teams | + +### API Keys + +| Skill | What it does | +|-------|-------------| +| `/add-key` | Generate a key scoped to a user, team, budget, and expiry | +| `/update-key` | Update budget, models, or expiry | +| `/delete-key` | Delete by key value or alias | + +### Organizations + +| Skill | What it does | +|-------|-------------| +| `/add-org` | Create an org with budget and model access | +| `/delete-org` | Delete one or more orgs | + +### Models + +| Skill | What it does | +|-------|-------------| +| `/add-model` | Add any provider (OpenAI, Azure, Anthropic, Bedrock, Ollama…) and test it | +| `/update-model` | Rotate credentials or swap the underlying deployment | +| `/delete-model` | Remove a model | + +### MCP Servers + +| Skill | What it does | +|-------|-------------| +| `/add-mcp` | Register an MCP server (SSE, HTTP, or stdio) | +| `/update-mcp` | Update URL, credentials, or allowed tools | +| `/delete-mcp` | Remove an MCP server | + +### Agents + +| Skill | What it does | +|-------|-------------| +| `/add-agent` | Create an agent backed by a model and optional MCP servers | +| `/update-agent` | Swap the model or update description and limits | +| `/delete-agent` | Remove an agent | + +### Usage + +| Skill | What it does | +|-------|-------------| +| `/view-usage` | Daily spend and token activity — by user, team, org, or model | + +## How it works + +When you invoke a skill, the agent asks for your `LITELLM_BASE_URL` and admin key, collects the fields needed for that operation, runs the `curl`, and shows the result. For example: + +``` +/add-model +``` +→ Agent asks: provider, public name, credentials. Adds the model, runs a test completion, reports pass/fail. + +``` +/view-usage +``` +→ Agent asks: date range (defaults to current month), optional team/model filter. Prints a table of daily requests, tokens, and spend. + +## Related + +- [litellm-skills on GitHub](https://github.com/BerriAI/litellm-skills) +- [Virtual Keys](../proxy/virtual_keys.md) — managing API keys on the proxy +- [Team-based routing](../proxy/team_based_routing.md) — setting up teams +- [Model Management](../proxy/model_management.md) — adding models via config or API diff --git a/docs/my-website/docs/videos.md b/docs/my-website/docs/videos.md index 0c284aa3c4..846e551435 100644 --- a/docs/my-website/docs/videos.md +++ b/docs/my-website/docs/videos.md @@ -290,6 +290,82 @@ curl --location 'http://localhost:4000/v1/videos' \ --header 'custom-llm-provider: azure' ``` +### Character, Edit, and Extension Endpoints + +LiteLLM proxy also supports these OpenAI-compatible video routes: + +- `POST /v1/videos/characters` +- `GET /v1/videos/characters/{character_id}` +- `POST /v1/videos/edits` +- `POST /v1/videos/extensions` + +#### Routing Behavior (`target_model_names`, encoded IDs, and provider overrides) + +- `POST /v1/videos/characters` supports `target_model_names` like `POST /v1/videos`. +- When `target_model_names` is provided on character creation, LiteLLM encodes the returned `character_id` with routing metadata. +- `GET /v1/videos/characters/{character_id}` accepts encoded character IDs directly. LiteLLM decodes the ID internally and routes with the correct model/provider metadata. +- `POST /v1/videos/edits` and `POST /v1/videos/extensions` support both: + - plain `video.id` + - encoded `video.id` values returned by LiteLLM +- `custom_llm_provider` can be supplied using the same patterns as other proxy endpoints: + - header: `custom-llm-provider` + - query: `?custom_llm_provider=...` + - body: `custom_llm_provider` (or `extra_body.custom_llm_provider` where applicable) + +#### Character create with `target_model_names` + +```bash +curl --location 'http://localhost:4000/v1/videos/characters' \ +--header 'Authorization: Bearer sk-1234' \ +-F 'name=hero' \ +-F 'target_model_names=gpt-4' \ +-F 'video=@/path/to/character.mp4' +``` + +Example response (encoded `id`): + +```json +{ + "id": "character_...", + "object": "character", + "created_at": 1712697600, + "name": "hero" +} +``` + +#### Get character using encoded `character_id` + +```bash +curl --location 'http://localhost:4000/v1/videos/characters/character_...' \ +--header 'Authorization: Bearer sk-1234' +``` + +#### Video edit with encoded `video.id` + +```bash +curl --location 'http://localhost:4000/v1/videos/edits' \ +--header 'Authorization: Bearer sk-1234' \ +--header 'Content-Type: application/json' \ +--data '{ + "prompt": "Make this brighter", + "video": { "id": "video_..." } +}' +``` + +#### Video extension with provider override from `extra_body` + +```bash +curl --location 'http://localhost:4000/v1/videos/extensions' \ +--header 'Authorization: Bearer sk-1234' \ +--header 'Content-Type: application/json' \ +--data '{ + "prompt": "Continue this scene", + "seconds": "4", + "video": { "id": "video_..." }, + "extra_body": { "custom_llm_provider": "openai" } +}' +``` + Test Azure video generation request ```bash diff --git a/docs/my-website/sidebars.js b/docs/my-website/sidebars.js index d1eb331f55..1362745a91 100644 --- a/docs/my-website/sidebars.js +++ b/docs/my-website/sidebars.js @@ -195,6 +195,19 @@ const sidebars = { "projects/openai-agents" ] }, + { + type: "category", + label: "Manage with AI Agents", + link: { + type: "generated-index", + title: "Manage with AI Agents", + description: "Use AI agents to manage your LiteLLM deployment — create users, teams, keys, models, and more via natural language.", + slug: "/manage_with_ai_agents" + }, + items: [ + "tutorials/claude_code_skills", + ] + }, ], // But you can create a sidebar manually 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 42a9acbfd1..cbe8d449b4 100644 --- a/enterprise/litellm_enterprise/proxy/common_utils/check_batch_cost.py +++ b/enterprise/litellm_enterprise/proxy/common_utils/check_batch_cost.py @@ -131,6 +131,10 @@ class CheckBatchCost: # every subsequent poll cycle. if self._has_batch_processed_column: try: + # Include "complete"/"completed" batches: the retrieve_batch + # endpoint may transition a batch to "complete" before + # CheckBatchCost runs. The batch_processed=False filter + # already prevents reprocessing finished batches. jobs = await self.prisma_client.db.litellm_managedobjecttable.find_many( where={ "file_purpose": "batch", @@ -140,8 +144,6 @@ class CheckBatchCost: "failed", "expired", "cancelled", - "complete", - "completed", "stale_expired", ] }, diff --git a/enterprise/litellm_enterprise/proxy/hooks/managed_files.py b/enterprise/litellm_enterprise/proxy/hooks/managed_files.py index 37ca341fdf..5530054170 100644 --- a/enterprise/litellm_enterprise/proxy/hooks/managed_files.py +++ b/enterprise/litellm_enterprise/proxy/hooks/managed_files.py @@ -26,6 +26,7 @@ from litellm.proxy.openai_files_endpoints.common_utils import ( get_batch_id_from_unified_batch_id, get_content_type_from_file_object, get_model_id_from_unified_batch_id, + get_models_from_unified_file_id, normalize_mime_type_for_provider, ) from litellm.types.llms.openai import ( @@ -904,6 +905,21 @@ class _PROXY_LiteLLMManagedFiles(CustomLogger, BaseFileEndpoints): ) # managed batch id model_id = cast(Optional[str], response._hidden_params.get("model_id")) model_name = cast(Optional[str], response._hidden_params.get("model_name")) + resolved_model_name = model_name + + # Some providers (e.g. Vertex batch retrieve) do not set model_name on + # the response. In that case, recover target_model_names from the input + # managed file metadata so unified output IDs preserve routing metadata. + if not resolved_model_name and isinstance(unified_file_id, str): + decoded_unified_file_id = ( + _is_base64_encoded_unified_file_id(unified_file_id) + or unified_file_id + ) + target_model_names = get_models_from_unified_file_id( + decoded_unified_file_id + ) + if target_model_names: + resolved_model_name = ",".join(target_model_names) original_response_id = response.id if (unified_batch_id or unified_file_id) and model_id: @@ -919,7 +935,7 @@ class _PROXY_LiteLLMManagedFiles(CustomLogger, BaseFileEndpoints): unified_file_id = self.get_unified_output_file_id( output_file_id=original_file_id, model_id=model_id, - model_name=model_name, + model_name=resolved_model_name, ) setattr(response, file_attr, unified_file_id) diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20250326162113_baseline/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20250326162113_baseline/migration.sql index fb8a44814f..7b33d58899 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20250326162113_baseline/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20250326162113_baseline/migration.sql @@ -1,5 +1,5 @@ -- CreateTable -CREATE TABLE "LiteLLM_BudgetTable" ( +CREATE TABLE IF NOT EXISTS "LiteLLM_BudgetTable" ( "budget_id" TEXT NOT NULL, "max_budget" DOUBLE PRECISION, "soft_budget" DOUBLE PRECISION, @@ -18,7 +18,7 @@ CREATE TABLE "LiteLLM_BudgetTable" ( ); -- CreateTable -CREATE TABLE "LiteLLM_CredentialsTable" ( +CREATE TABLE IF NOT EXISTS "LiteLLM_CredentialsTable" ( "credential_id" TEXT NOT NULL, "credential_name" TEXT NOT NULL, "credential_values" JSONB NOT NULL, @@ -32,7 +32,7 @@ CREATE TABLE "LiteLLM_CredentialsTable" ( ); -- CreateTable -CREATE TABLE "LiteLLM_ProxyModelTable" ( +CREATE TABLE IF NOT EXISTS "LiteLLM_ProxyModelTable" ( "model_id" TEXT NOT NULL, "model_name" TEXT NOT NULL, "litellm_params" JSONB NOT NULL, @@ -46,7 +46,7 @@ CREATE TABLE "LiteLLM_ProxyModelTable" ( ); -- CreateTable -CREATE TABLE "LiteLLM_OrganizationTable" ( +CREATE TABLE IF NOT EXISTS "LiteLLM_OrganizationTable" ( "organization_id" TEXT NOT NULL, "organization_alias" TEXT NOT NULL, "budget_id" TEXT NOT NULL, @@ -63,7 +63,7 @@ CREATE TABLE "LiteLLM_OrganizationTable" ( ); -- CreateTable -CREATE TABLE "LiteLLM_ModelTable" ( +CREATE TABLE IF NOT EXISTS "LiteLLM_ModelTable" ( "id" SERIAL NOT NULL, "aliases" JSONB, "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, @@ -75,7 +75,7 @@ CREATE TABLE "LiteLLM_ModelTable" ( ); -- CreateTable -CREATE TABLE "LiteLLM_TeamTable" ( +CREATE TABLE IF NOT EXISTS "LiteLLM_TeamTable" ( "team_id" TEXT NOT NULL, "team_alias" TEXT, "organization_id" TEXT, @@ -102,7 +102,7 @@ CREATE TABLE "LiteLLM_TeamTable" ( ); -- CreateTable -CREATE TABLE "LiteLLM_UserTable" ( +CREATE TABLE IF NOT EXISTS "LiteLLM_UserTable" ( "user_id" TEXT NOT NULL, "user_alias" TEXT, "team_id" TEXT, @@ -131,7 +131,7 @@ CREATE TABLE "LiteLLM_UserTable" ( ); -- CreateTable -CREATE TABLE "LiteLLM_VerificationToken" ( +CREATE TABLE IF NOT EXISTS "LiteLLM_VerificationToken" ( "token" TEXT NOT NULL, "key_name" TEXT, "key_alias" TEXT, @@ -166,7 +166,7 @@ CREATE TABLE "LiteLLM_VerificationToken" ( ); -- CreateTable -CREATE TABLE "LiteLLM_EndUserTable" ( +CREATE TABLE IF NOT EXISTS "LiteLLM_EndUserTable" ( "user_id" TEXT NOT NULL, "alias" TEXT, "spend" DOUBLE PRECISION NOT NULL DEFAULT 0.0, @@ -179,7 +179,7 @@ CREATE TABLE "LiteLLM_EndUserTable" ( ); -- CreateTable -CREATE TABLE "LiteLLM_Config" ( +CREATE TABLE IF NOT EXISTS "LiteLLM_Config" ( "param_name" TEXT NOT NULL, "param_value" JSONB, @@ -187,7 +187,7 @@ CREATE TABLE "LiteLLM_Config" ( ); -- CreateTable -CREATE TABLE "LiteLLM_SpendLogs" ( +CREATE TABLE IF NOT EXISTS "LiteLLM_SpendLogs" ( "request_id" TEXT NOT NULL, "call_type" TEXT NOT NULL, "api_key" TEXT NOT NULL DEFAULT '', @@ -218,7 +218,7 @@ CREATE TABLE "LiteLLM_SpendLogs" ( ); -- CreateTable -CREATE TABLE "LiteLLM_ErrorLogs" ( +CREATE TABLE IF NOT EXISTS "LiteLLM_ErrorLogs" ( "request_id" TEXT NOT NULL, "startTime" TIMESTAMP(3) NOT NULL, "endTime" TIMESTAMP(3) NOT NULL, @@ -235,7 +235,7 @@ CREATE TABLE "LiteLLM_ErrorLogs" ( ); -- CreateTable -CREATE TABLE "LiteLLM_UserNotifications" ( +CREATE TABLE IF NOT EXISTS "LiteLLM_UserNotifications" ( "request_id" TEXT NOT NULL, "user_id" TEXT NOT NULL, "models" TEXT[], @@ -246,7 +246,7 @@ CREATE TABLE "LiteLLM_UserNotifications" ( ); -- CreateTable -CREATE TABLE "LiteLLM_TeamMembership" ( +CREATE TABLE IF NOT EXISTS "LiteLLM_TeamMembership" ( "user_id" TEXT NOT NULL, "team_id" TEXT NOT NULL, "spend" DOUBLE PRECISION NOT NULL DEFAULT 0.0, @@ -256,7 +256,7 @@ CREATE TABLE "LiteLLM_TeamMembership" ( ); -- CreateTable -CREATE TABLE "LiteLLM_OrganizationMembership" ( +CREATE TABLE IF NOT EXISTS "LiteLLM_OrganizationMembership" ( "user_id" TEXT NOT NULL, "organization_id" TEXT NOT NULL, "user_role" TEXT, @@ -269,7 +269,7 @@ CREATE TABLE "LiteLLM_OrganizationMembership" ( ); -- CreateTable -CREATE TABLE "LiteLLM_InvitationLink" ( +CREATE TABLE IF NOT EXISTS "LiteLLM_InvitationLink" ( "id" TEXT NOT NULL, "user_id" TEXT NOT NULL, "is_accepted" BOOLEAN NOT NULL DEFAULT false, @@ -284,7 +284,7 @@ CREATE TABLE "LiteLLM_InvitationLink" ( ); -- CreateTable -CREATE TABLE "LiteLLM_AuditLog" ( +CREATE TABLE IF NOT EXISTS "LiteLLM_AuditLog" ( "id" TEXT NOT NULL, "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, "changed_by" TEXT NOT NULL DEFAULT '', @@ -299,62 +299,132 @@ CREATE TABLE "LiteLLM_AuditLog" ( ); -- CreateIndex -CREATE UNIQUE INDEX "LiteLLM_CredentialsTable_credential_name_key" ON "LiteLLM_CredentialsTable"("credential_name"); +CREATE UNIQUE INDEX IF NOT EXISTS "LiteLLM_CredentialsTable_credential_name_key" ON "LiteLLM_CredentialsTable"("credential_name"); -- CreateIndex -CREATE UNIQUE INDEX "LiteLLM_TeamTable_model_id_key" ON "LiteLLM_TeamTable"("model_id"); +CREATE UNIQUE INDEX IF NOT EXISTS "LiteLLM_TeamTable_model_id_key" ON "LiteLLM_TeamTable"("model_id"); -- CreateIndex -CREATE UNIQUE INDEX "LiteLLM_UserTable_sso_user_id_key" ON "LiteLLM_UserTable"("sso_user_id"); +CREATE UNIQUE INDEX IF NOT EXISTS "LiteLLM_UserTable_sso_user_id_key" ON "LiteLLM_UserTable"("sso_user_id"); -- CreateIndex -CREATE INDEX "LiteLLM_SpendLogs_startTime_idx" ON "LiteLLM_SpendLogs"("startTime"); +CREATE INDEX IF NOT EXISTS "LiteLLM_SpendLogs_startTime_idx" ON "LiteLLM_SpendLogs"("startTime"); -- CreateIndex -CREATE INDEX "LiteLLM_SpendLogs_end_user_idx" ON "LiteLLM_SpendLogs"("end_user"); +CREATE INDEX IF NOT EXISTS "LiteLLM_SpendLogs_end_user_idx" ON "LiteLLM_SpendLogs"("end_user"); -- CreateIndex -CREATE UNIQUE INDEX "LiteLLM_OrganizationMembership_user_id_organization_id_key" ON "LiteLLM_OrganizationMembership"("user_id", "organization_id"); +CREATE UNIQUE INDEX IF NOT EXISTS "LiteLLM_OrganizationMembership_user_id_organization_id_key" ON "LiteLLM_OrganizationMembership"("user_id", "organization_id"); -- AddForeignKey -ALTER TABLE "LiteLLM_OrganizationTable" ADD CONSTRAINT "LiteLLM_OrganizationTable_budget_id_fkey" FOREIGN KEY ("budget_id") REFERENCES "LiteLLM_BudgetTable"("budget_id") ON DELETE RESTRICT ON UPDATE CASCADE; +DO $$ +BEGIN + IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'LiteLLM_OrganizationTable_budget_id_fkey') THEN + ALTER TABLE "LiteLLM_OrganizationTable" ADD CONSTRAINT "LiteLLM_OrganizationTable_budget_id_fkey" FOREIGN KEY ("budget_id") REFERENCES "LiteLLM_BudgetTable"("budget_id") ON DELETE RESTRICT ON UPDATE CASCADE; + END IF; +END $$; -- AddForeignKey -ALTER TABLE "LiteLLM_TeamTable" ADD CONSTRAINT "LiteLLM_TeamTable_organization_id_fkey" FOREIGN KEY ("organization_id") REFERENCES "LiteLLM_OrganizationTable"("organization_id") ON DELETE SET NULL ON UPDATE CASCADE; +DO $$ +BEGIN + IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'LiteLLM_TeamTable_organization_id_fkey') THEN + ALTER TABLE "LiteLLM_TeamTable" ADD CONSTRAINT "LiteLLM_TeamTable_organization_id_fkey" FOREIGN KEY ("organization_id") REFERENCES "LiteLLM_OrganizationTable"("organization_id") ON DELETE SET NULL ON UPDATE CASCADE; + END IF; +END $$; -- AddForeignKey -ALTER TABLE "LiteLLM_TeamTable" ADD CONSTRAINT "LiteLLM_TeamTable_model_id_fkey" FOREIGN KEY ("model_id") REFERENCES "LiteLLM_ModelTable"("id") ON DELETE SET NULL ON UPDATE CASCADE; +DO $$ +BEGIN + IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'LiteLLM_TeamTable_model_id_fkey') THEN + ALTER TABLE "LiteLLM_TeamTable" ADD CONSTRAINT "LiteLLM_TeamTable_model_id_fkey" FOREIGN KEY ("model_id") REFERENCES "LiteLLM_ModelTable"("id") ON DELETE SET NULL ON UPDATE CASCADE; + END IF; +END $$; -- AddForeignKey -ALTER TABLE "LiteLLM_UserTable" ADD CONSTRAINT "LiteLLM_UserTable_organization_id_fkey" FOREIGN KEY ("organization_id") REFERENCES "LiteLLM_OrganizationTable"("organization_id") ON DELETE SET NULL ON UPDATE CASCADE; +DO $$ +BEGIN + IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'LiteLLM_UserTable_organization_id_fkey') THEN + ALTER TABLE "LiteLLM_UserTable" ADD CONSTRAINT "LiteLLM_UserTable_organization_id_fkey" FOREIGN KEY ("organization_id") REFERENCES "LiteLLM_OrganizationTable"("organization_id") ON DELETE SET NULL ON UPDATE CASCADE; + END IF; +END $$; -- AddForeignKey -ALTER TABLE "LiteLLM_VerificationToken" ADD CONSTRAINT "LiteLLM_VerificationToken_budget_id_fkey" FOREIGN KEY ("budget_id") REFERENCES "LiteLLM_BudgetTable"("budget_id") ON DELETE SET NULL ON UPDATE CASCADE; +DO $$ +BEGIN + IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'LiteLLM_VerificationToken_budget_id_fkey') THEN + ALTER TABLE "LiteLLM_VerificationToken" ADD CONSTRAINT "LiteLLM_VerificationToken_budget_id_fkey" FOREIGN KEY ("budget_id") REFERENCES "LiteLLM_BudgetTable"("budget_id") ON DELETE SET NULL ON UPDATE CASCADE; + END IF; +END $$; -- AddForeignKey -ALTER TABLE "LiteLLM_VerificationToken" ADD CONSTRAINT "LiteLLM_VerificationToken_organization_id_fkey" FOREIGN KEY ("organization_id") REFERENCES "LiteLLM_OrganizationTable"("organization_id") ON DELETE SET NULL ON UPDATE CASCADE; +DO $$ +BEGIN + IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'LiteLLM_VerificationToken_organization_id_fkey') THEN + ALTER TABLE "LiteLLM_VerificationToken" ADD CONSTRAINT "LiteLLM_VerificationToken_organization_id_fkey" FOREIGN KEY ("organization_id") REFERENCES "LiteLLM_OrganizationTable"("organization_id") ON DELETE SET NULL ON UPDATE CASCADE; + END IF; +END $$; -- AddForeignKey -ALTER TABLE "LiteLLM_EndUserTable" ADD CONSTRAINT "LiteLLM_EndUserTable_budget_id_fkey" FOREIGN KEY ("budget_id") REFERENCES "LiteLLM_BudgetTable"("budget_id") ON DELETE SET NULL ON UPDATE CASCADE; +DO $$ +BEGIN + IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'LiteLLM_EndUserTable_budget_id_fkey') THEN + ALTER TABLE "LiteLLM_EndUserTable" ADD CONSTRAINT "LiteLLM_EndUserTable_budget_id_fkey" FOREIGN KEY ("budget_id") REFERENCES "LiteLLM_BudgetTable"("budget_id") ON DELETE SET NULL ON UPDATE CASCADE; + END IF; +END $$; -- AddForeignKey -ALTER TABLE "LiteLLM_TeamMembership" ADD CONSTRAINT "LiteLLM_TeamMembership_budget_id_fkey" FOREIGN KEY ("budget_id") REFERENCES "LiteLLM_BudgetTable"("budget_id") ON DELETE SET NULL ON UPDATE CASCADE; +DO $$ +BEGIN + IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'LiteLLM_TeamMembership_budget_id_fkey') THEN + ALTER TABLE "LiteLLM_TeamMembership" ADD CONSTRAINT "LiteLLM_TeamMembership_budget_id_fkey" FOREIGN KEY ("budget_id") REFERENCES "LiteLLM_BudgetTable"("budget_id") ON DELETE SET NULL ON UPDATE CASCADE; + END IF; +END $$; -- AddForeignKey -ALTER TABLE "LiteLLM_OrganizationMembership" ADD CONSTRAINT "LiteLLM_OrganizationMembership_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "LiteLLM_UserTable"("user_id") ON DELETE RESTRICT ON UPDATE CASCADE; +DO $$ +BEGIN + IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'LiteLLM_OrganizationMembership_user_id_fkey') THEN + ALTER TABLE "LiteLLM_OrganizationMembership" ADD CONSTRAINT "LiteLLM_OrganizationMembership_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "LiteLLM_UserTable"("user_id") ON DELETE RESTRICT ON UPDATE CASCADE; + END IF; +END $$; -- AddForeignKey -ALTER TABLE "LiteLLM_OrganizationMembership" ADD CONSTRAINT "LiteLLM_OrganizationMembership_organization_id_fkey" FOREIGN KEY ("organization_id") REFERENCES "LiteLLM_OrganizationTable"("organization_id") ON DELETE RESTRICT ON UPDATE CASCADE; +DO $$ +BEGIN + IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'LiteLLM_OrganizationMembership_organization_id_fkey') THEN + ALTER TABLE "LiteLLM_OrganizationMembership" ADD CONSTRAINT "LiteLLM_OrganizationMembership_organization_id_fkey" FOREIGN KEY ("organization_id") REFERENCES "LiteLLM_OrganizationTable"("organization_id") ON DELETE RESTRICT ON UPDATE CASCADE; + END IF; +END $$; -- AddForeignKey -ALTER TABLE "LiteLLM_OrganizationMembership" ADD CONSTRAINT "LiteLLM_OrganizationMembership_budget_id_fkey" FOREIGN KEY ("budget_id") REFERENCES "LiteLLM_BudgetTable"("budget_id") ON DELETE SET NULL ON UPDATE CASCADE; +DO $$ +BEGIN + IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'LiteLLM_OrganizationMembership_budget_id_fkey') THEN + ALTER TABLE "LiteLLM_OrganizationMembership" ADD CONSTRAINT "LiteLLM_OrganizationMembership_budget_id_fkey" FOREIGN KEY ("budget_id") REFERENCES "LiteLLM_BudgetTable"("budget_id") ON DELETE SET NULL ON UPDATE CASCADE; + END IF; +END $$; -- AddForeignKey -ALTER TABLE "LiteLLM_InvitationLink" ADD CONSTRAINT "LiteLLM_InvitationLink_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "LiteLLM_UserTable"("user_id") ON DELETE RESTRICT ON UPDATE CASCADE; +DO $$ +BEGIN + IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'LiteLLM_InvitationLink_user_id_fkey') THEN + ALTER TABLE "LiteLLM_InvitationLink" ADD CONSTRAINT "LiteLLM_InvitationLink_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "LiteLLM_UserTable"("user_id") ON DELETE RESTRICT ON UPDATE CASCADE; + END IF; +END $$; -- AddForeignKey -ALTER TABLE "LiteLLM_InvitationLink" ADD CONSTRAINT "LiteLLM_InvitationLink_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "LiteLLM_UserTable"("user_id") ON DELETE RESTRICT ON UPDATE CASCADE; +DO $$ +BEGIN + IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'LiteLLM_InvitationLink_created_by_fkey') THEN + ALTER TABLE "LiteLLM_InvitationLink" ADD CONSTRAINT "LiteLLM_InvitationLink_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "LiteLLM_UserTable"("user_id") ON DELETE RESTRICT ON UPDATE CASCADE; + END IF; +END $$; -- AddForeignKey -ALTER TABLE "LiteLLM_InvitationLink" ADD CONSTRAINT "LiteLLM_InvitationLink_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "LiteLLM_UserTable"("user_id") ON DELETE RESTRICT ON UPDATE CASCADE; +DO $$ +BEGIN + IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'LiteLLM_InvitationLink_updated_by_fkey') THEN + ALTER TABLE "LiteLLM_InvitationLink" ADD CONSTRAINT "LiteLLM_InvitationLink_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "LiteLLM_UserTable"("user_id") ON DELETE RESTRICT ON UPDATE CASCADE; + END IF; +END $$; diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20250326171002_add_daily_user_table/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20250326171002_add_daily_user_table/migration.sql index 3379d8e9fd..52f20ee0f2 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20250326171002_add_daily_user_table/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20250326171002_add_daily_user_table/migration.sql @@ -1,5 +1,5 @@ -- CreateTable -CREATE TABLE "LiteLLM_DailyUserSpend" ( +CREATE TABLE IF NOT EXISTS "LiteLLM_DailyUserSpend" ( "id" TEXT NOT NULL, "user_id" TEXT NOT NULL, "date" TEXT NOT NULL, @@ -17,17 +17,17 @@ CREATE TABLE "LiteLLM_DailyUserSpend" ( ); -- CreateIndex -CREATE INDEX "LiteLLM_DailyUserSpend_date_idx" ON "LiteLLM_DailyUserSpend"("date"); +CREATE INDEX IF NOT EXISTS "LiteLLM_DailyUserSpend_date_idx" ON "LiteLLM_DailyUserSpend"("date"); -- CreateIndex -CREATE INDEX "LiteLLM_DailyUserSpend_user_id_idx" ON "LiteLLM_DailyUserSpend"("user_id"); +CREATE INDEX IF NOT EXISTS "LiteLLM_DailyUserSpend_user_id_idx" ON "LiteLLM_DailyUserSpend"("user_id"); -- CreateIndex -CREATE INDEX "LiteLLM_DailyUserSpend_api_key_idx" ON "LiteLLM_DailyUserSpend"("api_key"); +CREATE INDEX IF NOT EXISTS "LiteLLM_DailyUserSpend_api_key_idx" ON "LiteLLM_DailyUserSpend"("api_key"); -- CreateIndex -CREATE INDEX "LiteLLM_DailyUserSpend_model_idx" ON "LiteLLM_DailyUserSpend"("model"); +CREATE INDEX IF NOT EXISTS "LiteLLM_DailyUserSpend_model_idx" ON "LiteLLM_DailyUserSpend"("model"); -- CreateIndex -CREATE UNIQUE INDEX "LiteLLM_DailyUserSpend_user_id_date_api_key_model_custom_ll_key" ON "LiteLLM_DailyUserSpend"("user_id", "date", "api_key", "model", "custom_llm_provider"); +CREATE UNIQUE INDEX IF NOT EXISTS "LiteLLM_DailyUserSpend_user_id_date_api_key_model_custom_ll_key" ON "LiteLLM_DailyUserSpend"("user_id", "date", "api_key", "model", "custom_llm_provider"); diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20250327180120_add_api_requests_to_daily_user_table/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20250327180120_add_api_requests_to_daily_user_table/migration.sql index e7c5ab566a..3865194ce8 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20250327180120_add_api_requests_to_daily_user_table/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20250327180120_add_api_requests_to_daily_user_table/migration.sql @@ -1,3 +1,3 @@ -- AlterTable -ALTER TABLE "LiteLLM_DailyUserSpend" ADD COLUMN "api_requests" INTEGER NOT NULL DEFAULT 0; +ALTER TABLE "LiteLLM_DailyUserSpend" ADD COLUMN IF NOT EXISTS "api_requests" INTEGER NOT NULL DEFAULT 0; diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20250329084805_new_cron_job_table/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20250329084805_new_cron_job_table/migration.sql index e7ea2e9015..ba3000f751 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20250329084805_new_cron_job_table/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20250329084805_new_cron_job_table/migration.sql @@ -2,7 +2,7 @@ CREATE TYPE "JobStatus" AS ENUM ('ACTIVE', 'INACTIVE'); -- CreateTable -CREATE TABLE "LiteLLM_CronJob" ( +CREATE TABLE IF NOT EXISTS "LiteLLM_CronJob" ( "cronjob_id" TEXT NOT NULL, "pod_id" TEXT NOT NULL, "status" "JobStatus" NOT NULL DEFAULT 'INACTIVE', diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20250331215456_track_success_and_failed_requests_daily_agg_table/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20250331215456_track_success_and_failed_requests_daily_agg_table/migration.sql index 9f1693500d..47962aec77 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20250331215456_track_success_and_failed_requests_daily_agg_table/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20250331215456_track_success_and_failed_requests_daily_agg_table/migration.sql @@ -1,4 +1,4 @@ -- AlterTable -ALTER TABLE "LiteLLM_DailyUserSpend" ADD COLUMN "failed_requests" INTEGER NOT NULL DEFAULT 0, -ADD COLUMN "successful_requests" INTEGER NOT NULL DEFAULT 0; +ALTER TABLE "LiteLLM_DailyUserSpend" ADD COLUMN IF NOT EXISTS "failed_requests" INTEGER NOT NULL DEFAULT 0, +ADD COLUMN IF NOT EXISTS "successful_requests" INTEGER NOT NULL DEFAULT 0; diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20250411215431_add_managed_file_table/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20250411215431_add_managed_file_table/migration.sql index d14a629458..602cb5ada3 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20250411215431_add_managed_file_table/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20250411215431_add_managed_file_table/migration.sql @@ -1,5 +1,5 @@ -- CreateTable -CREATE TABLE "LiteLLM_ManagedFileTable" ( +CREATE TABLE IF NOT EXISTS "LiteLLM_ManagedFileTable" ( "id" TEXT NOT NULL, "unified_file_id" TEXT NOT NULL, "file_object" JSONB NOT NULL, @@ -11,8 +11,8 @@ CREATE TABLE "LiteLLM_ManagedFileTable" ( ); -- CreateIndex -CREATE UNIQUE INDEX "LiteLLM_ManagedFileTable_unified_file_id_key" ON "LiteLLM_ManagedFileTable"("unified_file_id"); +CREATE UNIQUE INDEX IF NOT EXISTS "LiteLLM_ManagedFileTable_unified_file_id_key" ON "LiteLLM_ManagedFileTable"("unified_file_id"); -- CreateIndex -CREATE INDEX "LiteLLM_ManagedFileTable_unified_file_id_idx" ON "LiteLLM_ManagedFileTable"("unified_file_id"); +CREATE INDEX IF NOT EXISTS "LiteLLM_ManagedFileTable_unified_file_id_idx" ON "LiteLLM_ManagedFileTable"("unified_file_id"); diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20250412081753_team_member_permissions/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20250412081753_team_member_permissions/migration.sql index c07df81379..334b421ca3 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20250412081753_team_member_permissions/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20250412081753_team_member_permissions/migration.sql @@ -1,3 +1,3 @@ -- AlterTable -ALTER TABLE "LiteLLM_TeamTable" ADD COLUMN "team_member_permissions" TEXT[] DEFAULT ARRAY[]::TEXT[]; +ALTER TABLE "LiteLLM_TeamTable" ADD COLUMN IF NOT EXISTS "team_member_permissions" TEXT[] DEFAULT ARRAY[]::TEXT[]; diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20250415151647_add_cache_read_write_tokens_daily_spend_transactions/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20250415151647_add_cache_read_write_tokens_daily_spend_transactions/migration.sql index f47e1c2e91..1a39ee3579 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20250415151647_add_cache_read_write_tokens_daily_spend_transactions/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20250415151647_add_cache_read_write_tokens_daily_spend_transactions/migration.sql @@ -1,4 +1,4 @@ -- AlterTable -ALTER TABLE "LiteLLM_DailyUserSpend" ADD COLUMN "cache_creation_input_tokens" INTEGER NOT NULL DEFAULT 0, -ADD COLUMN "cache_read_input_tokens" INTEGER NOT NULL DEFAULT 0; +ALTER TABLE "LiteLLM_DailyUserSpend" ADD COLUMN IF NOT EXISTS "cache_creation_input_tokens" INTEGER NOT NULL DEFAULT 0, +ADD COLUMN IF NOT EXISTS "cache_read_input_tokens" INTEGER NOT NULL DEFAULT 0; diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20250415191926_add_daily_team_table/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20250415191926_add_daily_team_table/migration.sql index a6eb461bc2..c8ef4eff7d 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20250415191926_add_daily_team_table/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20250415191926_add_daily_team_table/migration.sql @@ -1,5 +1,5 @@ -- CreateTable -CREATE TABLE "LiteLLM_DailyTeamSpend" ( +CREATE TABLE IF NOT EXISTS "LiteLLM_DailyTeamSpend" ( "id" TEXT NOT NULL, "team_id" TEXT NOT NULL, "date" TEXT NOT NULL, @@ -20,17 +20,17 @@ CREATE TABLE "LiteLLM_DailyTeamSpend" ( ); -- CreateIndex -CREATE INDEX "LiteLLM_DailyTeamSpend_date_idx" ON "LiteLLM_DailyTeamSpend"("date"); +CREATE INDEX IF NOT EXISTS "LiteLLM_DailyTeamSpend_date_idx" ON "LiteLLM_DailyTeamSpend"("date"); -- CreateIndex -CREATE INDEX "LiteLLM_DailyTeamSpend_team_id_idx" ON "LiteLLM_DailyTeamSpend"("team_id"); +CREATE INDEX IF NOT EXISTS "LiteLLM_DailyTeamSpend_team_id_idx" ON "LiteLLM_DailyTeamSpend"("team_id"); -- CreateIndex -CREATE INDEX "LiteLLM_DailyTeamSpend_api_key_idx" ON "LiteLLM_DailyTeamSpend"("api_key"); +CREATE INDEX IF NOT EXISTS "LiteLLM_DailyTeamSpend_api_key_idx" ON "LiteLLM_DailyTeamSpend"("api_key"); -- CreateIndex -CREATE INDEX "LiteLLM_DailyTeamSpend_model_idx" ON "LiteLLM_DailyTeamSpend"("model"); +CREATE INDEX IF NOT EXISTS "LiteLLM_DailyTeamSpend_model_idx" ON "LiteLLM_DailyTeamSpend"("model"); -- CreateIndex -CREATE UNIQUE INDEX "LiteLLM_DailyTeamSpend_team_id_date_api_key_model_custom_ll_key" ON "LiteLLM_DailyTeamSpend"("team_id", "date", "api_key", "model", "custom_llm_provider"); +CREATE UNIQUE INDEX IF NOT EXISTS "LiteLLM_DailyTeamSpend_team_id_date_api_key_model_custom_ll_key" ON "LiteLLM_DailyTeamSpend"("team_id", "date", "api_key", "model", "custom_llm_provider"); diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20250416115320_add_tag_table_to_db/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20250416115320_add_tag_table_to_db/migration.sql index 8c3cea7093..0a52834814 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20250416115320_add_tag_table_to_db/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20250416115320_add_tag_table_to_db/migration.sql @@ -1,9 +1,9 @@ -- AlterTable -ALTER TABLE "LiteLLM_DailyTeamSpend" ADD COLUMN "cache_creation_input_tokens" INTEGER NOT NULL DEFAULT 0, -ADD COLUMN "cache_read_input_tokens" INTEGER NOT NULL DEFAULT 0; +ALTER TABLE "LiteLLM_DailyTeamSpend" ADD COLUMN IF NOT EXISTS "cache_creation_input_tokens" INTEGER NOT NULL DEFAULT 0, +ADD COLUMN IF NOT EXISTS "cache_read_input_tokens" INTEGER NOT NULL DEFAULT 0; -- CreateTable -CREATE TABLE "LiteLLM_DailyTagSpend" ( +CREATE TABLE IF NOT EXISTS "LiteLLM_DailyTagSpend" ( "id" TEXT NOT NULL, "tag" TEXT NOT NULL, "date" TEXT NOT NULL, @@ -26,20 +26,20 @@ CREATE TABLE "LiteLLM_DailyTagSpend" ( ); -- CreateIndex -CREATE UNIQUE INDEX "LiteLLM_DailyTagSpend_tag_key" ON "LiteLLM_DailyTagSpend"("tag"); +CREATE UNIQUE INDEX IF NOT EXISTS "LiteLLM_DailyTagSpend_tag_key" ON "LiteLLM_DailyTagSpend"("tag"); -- CreateIndex -CREATE INDEX "LiteLLM_DailyTagSpend_date_idx" ON "LiteLLM_DailyTagSpend"("date"); +CREATE INDEX IF NOT EXISTS "LiteLLM_DailyTagSpend_date_idx" ON "LiteLLM_DailyTagSpend"("date"); -- CreateIndex -CREATE INDEX "LiteLLM_DailyTagSpend_tag_idx" ON "LiteLLM_DailyTagSpend"("tag"); +CREATE INDEX IF NOT EXISTS "LiteLLM_DailyTagSpend_tag_idx" ON "LiteLLM_DailyTagSpend"("tag"); -- CreateIndex -CREATE INDEX "LiteLLM_DailyTagSpend_api_key_idx" ON "LiteLLM_DailyTagSpend"("api_key"); +CREATE INDEX IF NOT EXISTS "LiteLLM_DailyTagSpend_api_key_idx" ON "LiteLLM_DailyTagSpend"("api_key"); -- CreateIndex -CREATE INDEX "LiteLLM_DailyTagSpend_model_idx" ON "LiteLLM_DailyTagSpend"("model"); +CREATE INDEX IF NOT EXISTS "LiteLLM_DailyTagSpend_model_idx" ON "LiteLLM_DailyTagSpend"("model"); -- CreateIndex -CREATE UNIQUE INDEX "LiteLLM_DailyTagSpend_tag_date_api_key_model_custom_llm_pro_key" ON "LiteLLM_DailyTagSpend"("tag", "date", "api_key", "model", "custom_llm_provider"); +CREATE UNIQUE INDEX IF NOT EXISTS "LiteLLM_DailyTagSpend_tag_date_api_key_model_custom_llm_pro_key" ON "LiteLLM_DailyTagSpend"("tag", "date", "api_key", "model", "custom_llm_provider"); diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20250416151339_drop_tag_uniqueness_requirement/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20250416151339_drop_tag_uniqueness_requirement/migration.sql index 5c27b84efb..a5793331ea 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20250416151339_drop_tag_uniqueness_requirement/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20250416151339_drop_tag_uniqueness_requirement/migration.sql @@ -1,3 +1,3 @@ -- DropIndex -DROP INDEX "LiteLLM_DailyTagSpend_tag_key"; +DROP INDEX IF EXISTS "LiteLLM_DailyTagSpend_tag_key"; diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20250416185146_add_allowed_routes_litellm_verification_token/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20250416185146_add_allowed_routes_litellm_verification_token/migration.sql index 2ee7838dcf..fd8997813f 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20250416185146_add_allowed_routes_litellm_verification_token/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20250416185146_add_allowed_routes_litellm_verification_token/migration.sql @@ -1,3 +1,3 @@ -- AlterTable -ALTER TABLE "LiteLLM_VerificationToken" ADD COLUMN "allowed_routes" TEXT[] DEFAULT ARRAY[]::TEXT[]; +ALTER TABLE "LiteLLM_VerificationToken" ADD COLUMN IF NOT EXISTS "allowed_routes" TEXT[] DEFAULT ARRAY[]::TEXT[]; diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20250425182129_add_session_id/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20250425182129_add_session_id/migration.sql index 751c75e5f2..f0ad3886ee 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20250425182129_add_session_id/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20250425182129_add_session_id/migration.sql @@ -1,4 +1,4 @@ -- AlterTable -ALTER TABLE "LiteLLM_SpendLogs" ADD COLUMN "proxy_server_request" JSONB DEFAULT '{}', -ADD COLUMN "session_id" TEXT; +ALTER TABLE "LiteLLM_SpendLogs" ADD COLUMN IF NOT EXISTS "proxy_server_request" JSONB DEFAULT '{}', +ADD COLUMN IF NOT EXISTS "session_id" TEXT; diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20250430193429_add_managed_vector_stores/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20250430193429_add_managed_vector_stores/migration.sql index 39e7f2f3b2..ae73e40cd5 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20250430193429_add_managed_vector_stores/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20250430193429_add_managed_vector_stores/migration.sql @@ -1,5 +1,5 @@ -- CreateTable -CREATE TABLE "LiteLLM_ManagedVectorStoresTable" ( +CREATE TABLE IF NOT EXISTS "LiteLLM_ManagedVectorStoresTable" ( "vector_store_id" TEXT NOT NULL, "custom_llm_provider" TEXT NOT NULL, "vector_store_name" TEXT, diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20250507161526_add_mcp_table_to_db/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20250507161526_add_mcp_table_to_db/migration.sql index 6b8adc6e7e..95f26d5cb5 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20250507161526_add_mcp_table_to_db/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20250507161526_add_mcp_table_to_db/migration.sql @@ -1,5 +1,5 @@ -- CreateTable -CREATE TABLE "LiteLLM_MCPServerTable" ( +CREATE TABLE IF NOT EXISTS "LiteLLM_MCPServerTable" ( "server_id" TEXT NOT NULL, "alias" TEXT, "description" TEXT, diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20250507161527_add_health_check_fields_to_mcp_servers/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20250507161527_add_health_check_fields_to_mcp_servers/migration.sql index d5c206d192..71f595173b 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20250507161527_add_health_check_fields_to_mcp_servers/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20250507161527_add_health_check_fields_to_mcp_servers/migration.sql @@ -1,4 +1,4 @@ -- Add health check fields to MCP server table -ALTER TABLE "LiteLLM_MCPServerTable" ADD COLUMN "status" TEXT DEFAULT 'unknown'; -ALTER TABLE "LiteLLM_MCPServerTable" ADD COLUMN "last_health_check" TIMESTAMP(3); -ALTER TABLE "LiteLLM_MCPServerTable" ADD COLUMN "health_check_error" TEXT; \ No newline at end of file +ALTER TABLE "LiteLLM_MCPServerTable" ADD COLUMN IF NOT EXISTS "status" TEXT DEFAULT 'unknown'; +ALTER TABLE "LiteLLM_MCPServerTable" ADD COLUMN IF NOT EXISTS "last_health_check" TIMESTAMP(3); +ALTER TABLE "LiteLLM_MCPServerTable" ADD COLUMN IF NOT EXISTS "health_check_error" TEXT; \ No newline at end of file diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20250507184818_add_mcp_key_team_permission_mgmt/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20250507184818_add_mcp_key_team_permission_mgmt/migration.sql index dcfce07a48..9937857875 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20250507184818_add_mcp_key_team_permission_mgmt/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20250507184818_add_mcp_key_team_permission_mgmt/migration.sql @@ -1,17 +1,17 @@ -- AlterTable -ALTER TABLE "LiteLLM_OrganizationTable" ADD COLUMN "object_permission_id" TEXT; +ALTER TABLE "LiteLLM_OrganizationTable" ADD COLUMN IF NOT EXISTS "object_permission_id" TEXT; -- AlterTable -ALTER TABLE "LiteLLM_TeamTable" ADD COLUMN "object_permission_id" TEXT; +ALTER TABLE "LiteLLM_TeamTable" ADD COLUMN IF NOT EXISTS "object_permission_id" TEXT; -- AlterTable -ALTER TABLE "LiteLLM_UserTable" ADD COLUMN "object_permission_id" TEXT; +ALTER TABLE "LiteLLM_UserTable" ADD COLUMN IF NOT EXISTS "object_permission_id" TEXT; -- AlterTable -ALTER TABLE "LiteLLM_VerificationToken" ADD COLUMN "object_permission_id" TEXT; +ALTER TABLE "LiteLLM_VerificationToken" ADD COLUMN IF NOT EXISTS "object_permission_id" TEXT; -- CreateTable -CREATE TABLE "LiteLLM_ObjectPermissionTable" ( +CREATE TABLE IF NOT EXISTS "LiteLLM_ObjectPermissionTable" ( "object_permission_id" TEXT NOT NULL, "mcp_servers" TEXT[] DEFAULT ARRAY[]::TEXT[], @@ -19,14 +19,34 @@ CREATE TABLE "LiteLLM_ObjectPermissionTable" ( ); -- AddForeignKey -ALTER TABLE "LiteLLM_OrganizationTable" ADD CONSTRAINT "LiteLLM_OrganizationTable_object_permission_id_fkey" FOREIGN KEY ("object_permission_id") REFERENCES "LiteLLM_ObjectPermissionTable"("object_permission_id") ON DELETE SET NULL ON UPDATE CASCADE; +DO $$ +BEGIN + IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'LiteLLM_OrganizationTable_object_permission_id_fkey') THEN + ALTER TABLE "LiteLLM_OrganizationTable" ADD CONSTRAINT "LiteLLM_OrganizationTable_object_permission_id_fkey" FOREIGN KEY ("object_permission_id") REFERENCES "LiteLLM_ObjectPermissionTable"("object_permission_id") ON DELETE SET NULL ON UPDATE CASCADE; + END IF; +END $$; -- AddForeignKey -ALTER TABLE "LiteLLM_TeamTable" ADD CONSTRAINT "LiteLLM_TeamTable_object_permission_id_fkey" FOREIGN KEY ("object_permission_id") REFERENCES "LiteLLM_ObjectPermissionTable"("object_permission_id") ON DELETE SET NULL ON UPDATE CASCADE; +DO $$ +BEGIN + IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'LiteLLM_TeamTable_object_permission_id_fkey') THEN + ALTER TABLE "LiteLLM_TeamTable" ADD CONSTRAINT "LiteLLM_TeamTable_object_permission_id_fkey" FOREIGN KEY ("object_permission_id") REFERENCES "LiteLLM_ObjectPermissionTable"("object_permission_id") ON DELETE SET NULL ON UPDATE CASCADE; + END IF; +END $$; -- AddForeignKey -ALTER TABLE "LiteLLM_UserTable" ADD CONSTRAINT "LiteLLM_UserTable_object_permission_id_fkey" FOREIGN KEY ("object_permission_id") REFERENCES "LiteLLM_ObjectPermissionTable"("object_permission_id") ON DELETE SET NULL ON UPDATE CASCADE; +DO $$ +BEGIN + IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'LiteLLM_UserTable_object_permission_id_fkey') THEN + ALTER TABLE "LiteLLM_UserTable" ADD CONSTRAINT "LiteLLM_UserTable_object_permission_id_fkey" FOREIGN KEY ("object_permission_id") REFERENCES "LiteLLM_ObjectPermissionTable"("object_permission_id") ON DELETE SET NULL ON UPDATE CASCADE; + END IF; +END $$; -- AddForeignKey -ALTER TABLE "LiteLLM_VerificationToken" ADD CONSTRAINT "LiteLLM_VerificationToken_object_permission_id_fkey" FOREIGN KEY ("object_permission_id") REFERENCES "LiteLLM_ObjectPermissionTable"("object_permission_id") ON DELETE SET NULL ON UPDATE CASCADE; +DO $$ +BEGIN + IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'LiteLLM_VerificationToken_object_permission_id_fkey') THEN + ALTER TABLE "LiteLLM_VerificationToken" ADD CONSTRAINT "LiteLLM_VerificationToken_object_permission_id_fkey" FOREIGN KEY ("object_permission_id") REFERENCES "LiteLLM_ObjectPermissionTable"("object_permission_id") ON DELETE SET NULL ON UPDATE CASCADE; + END IF; +END $$; diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20250508072103_add_status_to_spendlogs/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20250508072103_add_status_to_spendlogs/migration.sql index 8f6c68aa67..a001977be5 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20250508072103_add_status_to_spendlogs/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20250508072103_add_status_to_spendlogs/migration.sql @@ -1,3 +1,3 @@ -- AlterTable -ALTER TABLE "LiteLLM_SpendLogs" ADD COLUMN "status" TEXT; +ALTER TABLE "LiteLLM_SpendLogs" ADD COLUMN IF NOT EXISTS "status" TEXT; diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20250510142544_add_session_id_index_spend_logs/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20250510142544_add_session_id_index_spend_logs/migration.sql index eda055d6e5..a647f386d9 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20250510142544_add_session_id_index_spend_logs/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20250510142544_add_session_id_index_spend_logs/migration.sql @@ -1,3 +1,3 @@ -- CreateIndex -CREATE INDEX "LiteLLM_SpendLogs_session_id_idx" ON "LiteLLM_SpendLogs"("session_id"); +CREATE INDEX IF NOT EXISTS "LiteLLM_SpendLogs_session_id_idx" ON "LiteLLM_SpendLogs"("session_id"); diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20250514142245_add_guardrails_table/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20250514142245_add_guardrails_table/migration.sql index fa99e3be63..41d8c18894 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20250514142245_add_guardrails_table/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20250514142245_add_guardrails_table/migration.sql @@ -1,5 +1,5 @@ -- CreateTable -CREATE TABLE "LiteLLM_GuardrailsTable" ( +CREATE TABLE IF NOT EXISTS "LiteLLM_GuardrailsTable" ( "guardrail_id" TEXT NOT NULL, "guardrail_name" TEXT NOT NULL, "litellm_params" JSONB NOT NULL, @@ -11,5 +11,5 @@ CREATE TABLE "LiteLLM_GuardrailsTable" ( ); -- CreateIndex -CREATE UNIQUE INDEX "LiteLLM_GuardrailsTable_guardrail_name_key" ON "LiteLLM_GuardrailsTable"("guardrail_name"); +CREATE UNIQUE INDEX IF NOT EXISTS "LiteLLM_GuardrailsTable_guardrail_name_key" ON "LiteLLM_GuardrailsTable"("guardrail_name"); diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20250522223020_managed_object_table/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20250522223020_managed_object_table/migration.sql index 95fb837245..564811655f 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20250522223020_managed_object_table/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20250522223020_managed_object_table/migration.sql @@ -1,10 +1,10 @@ -- AlterTable -ALTER TABLE "LiteLLM_ManagedFileTable" ADD COLUMN "created_by" TEXT, -ADD COLUMN "flat_model_file_ids" TEXT[] DEFAULT ARRAY[]::TEXT[], -ADD COLUMN "updated_by" TEXT; +ALTER TABLE "LiteLLM_ManagedFileTable" ADD COLUMN IF NOT EXISTS "created_by" TEXT, +ADD COLUMN IF NOT EXISTS "flat_model_file_ids" TEXT[] DEFAULT ARRAY[]::TEXT[], +ADD COLUMN IF NOT EXISTS "updated_by" TEXT; -- CreateTable -CREATE TABLE "LiteLLM_ManagedObjectTable" ( +CREATE TABLE IF NOT EXISTS "LiteLLM_ManagedObjectTable" ( "id" TEXT NOT NULL, "unified_object_id" TEXT NOT NULL, "model_object_id" TEXT NOT NULL, @@ -19,14 +19,14 @@ CREATE TABLE "LiteLLM_ManagedObjectTable" ( ); -- CreateIndex -CREATE UNIQUE INDEX "LiteLLM_ManagedObjectTable_unified_object_id_key" ON "LiteLLM_ManagedObjectTable"("unified_object_id"); +CREATE UNIQUE INDEX IF NOT EXISTS "LiteLLM_ManagedObjectTable_unified_object_id_key" ON "LiteLLM_ManagedObjectTable"("unified_object_id"); -- CreateIndex -CREATE UNIQUE INDEX "LiteLLM_ManagedObjectTable_model_object_id_key" ON "LiteLLM_ManagedObjectTable"("model_object_id"); +CREATE UNIQUE INDEX IF NOT EXISTS "LiteLLM_ManagedObjectTable_model_object_id_key" ON "LiteLLM_ManagedObjectTable"("model_object_id"); -- CreateIndex -CREATE INDEX "LiteLLM_ManagedObjectTable_unified_object_id_idx" ON "LiteLLM_ManagedObjectTable"("unified_object_id"); +CREATE INDEX IF NOT EXISTS "LiteLLM_ManagedObjectTable_unified_object_id_idx" ON "LiteLLM_ManagedObjectTable"("unified_object_id"); -- CreateIndex -CREATE INDEX "LiteLLM_ManagedObjectTable_model_object_id_idx" ON "LiteLLM_ManagedObjectTable"("model_object_id"); +CREATE INDEX IF NOT EXISTS "LiteLLM_ManagedObjectTable_model_object_id_idx" ON "LiteLLM_ManagedObjectTable"("model_object_id"); diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20250528185438_add_vector_stores_to_object_permissions/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20250528185438_add_vector_stores_to_object_permissions/migration.sql index 39db701056..f1f7615349 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20250528185438_add_vector_stores_to_object_permissions/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20250528185438_add_vector_stores_to_object_permissions/migration.sql @@ -1,3 +1,3 @@ -- AlterTable -ALTER TABLE "LiteLLM_ObjectPermissionTable" ADD COLUMN "vector_stores" TEXT[] DEFAULT ARRAY[]::TEXT[]; +ALTER TABLE "LiteLLM_ObjectPermissionTable" ADD COLUMN IF NOT EXISTS "vector_stores" TEXT[] DEFAULT ARRAY[]::TEXT[]; diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20250603210143_cascade_budget_changes/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20250603210143_cascade_budget_changes/migration.sql index 3d36e42577..ef53fbf3f4 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20250603210143_cascade_budget_changes/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20250603210143_cascade_budget_changes/migration.sql @@ -1,6 +1,16 @@ -- DropForeignKey -ALTER TABLE "LiteLLM_TeamMembership" DROP CONSTRAINT "LiteLLM_TeamMembership_budget_id_fkey"; +DO $$ +BEGIN + IF EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'LiteLLM_TeamMembership_budget_id_fkey') THEN + ALTER TABLE "LiteLLM_TeamMembership" DROP CONSTRAINT "LiteLLM_TeamMembership_budget_id_fkey"; + END IF; +END $$; -- AddForeignKey -ALTER TABLE "LiteLLM_TeamMembership" ADD CONSTRAINT "LiteLLM_TeamMembership_budget_id_fkey" FOREIGN KEY ("budget_id") REFERENCES "LiteLLM_BudgetTable"("budget_id") ON DELETE CASCADE ON UPDATE CASCADE; +DO $$ +BEGIN + IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'LiteLLM_TeamMembership_budget_id_fkey') THEN + ALTER TABLE "LiteLLM_TeamMembership" ADD CONSTRAINT "LiteLLM_TeamMembership_budget_id_fkey" FOREIGN KEY ("budget_id") REFERENCES "LiteLLM_BudgetTable"("budget_id") ON DELETE CASCADE ON UPDATE CASCADE; + END IF; +END $$; diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20250618225828_add_health_check_table/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20250618225828_add_health_check_table/migration.sql index da6f4c23c8..2b4dd1d17d 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20250618225828_add_health_check_table/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20250618225828_add_health_check_table/migration.sql @@ -1,5 +1,5 @@ -- CreateTable -CREATE TABLE "LiteLLM_HealthCheckTable" ( +CREATE TABLE IF NOT EXISTS "LiteLLM_HealthCheckTable" ( "health_check_id" TEXT NOT NULL, "model_name" TEXT NOT NULL, "model_id" TEXT, @@ -18,11 +18,11 @@ CREATE TABLE "LiteLLM_HealthCheckTable" ( ); -- CreateIndex -CREATE INDEX "LiteLLM_HealthCheckTable_model_name_idx" ON "LiteLLM_HealthCheckTable"("model_name"); +CREATE INDEX IF NOT EXISTS "LiteLLM_HealthCheckTable_model_name_idx" ON "LiteLLM_HealthCheckTable"("model_name"); -- CreateIndex -CREATE INDEX "LiteLLM_HealthCheckTable_checked_at_idx" ON "LiteLLM_HealthCheckTable"("checked_at"); +CREATE INDEX IF NOT EXISTS "LiteLLM_HealthCheckTable_checked_at_idx" ON "LiteLLM_HealthCheckTable"("checked_at"); -- CreateIndex -CREATE INDEX "LiteLLM_HealthCheckTable_status_idx" ON "LiteLLM_HealthCheckTable"("status"); +CREATE INDEX IF NOT EXISTS "LiteLLM_HealthCheckTable_status_idx" ON "LiteLLM_HealthCheckTable"("status"); diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20250625145206_cascade_budget_and_loosen_managed_file_json/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20250625145206_cascade_budget_and_loosen_managed_file_json/migration.sql index 51461b8205..75d7e0e74b 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20250625145206_cascade_budget_and_loosen_managed_file_json/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20250625145206_cascade_budget_and_loosen_managed_file_json/migration.sql @@ -1,9 +1,19 @@ -- DropForeignKey -ALTER TABLE "LiteLLM_TeamMembership" DROP CONSTRAINT "LiteLLM_TeamMembership_budget_id_fkey"; +DO $$ +BEGIN + IF EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'LiteLLM_TeamMembership_budget_id_fkey') THEN + ALTER TABLE "LiteLLM_TeamMembership" DROP CONSTRAINT "LiteLLM_TeamMembership_budget_id_fkey"; + END IF; +END $$; -- AlterTable ALTER TABLE "LiteLLM_ManagedFileTable" ALTER COLUMN "file_object" DROP NOT NULL; -- AddForeignKey -ALTER TABLE "LiteLLM_TeamMembership" ADD CONSTRAINT "LiteLLM_TeamMembership_budget_id_fkey" FOREIGN KEY ("budget_id") REFERENCES "LiteLLM_BudgetTable"("budget_id") ON DELETE SET NULL ON UPDATE CASCADE; +DO $$ +BEGIN + IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'LiteLLM_TeamMembership_budget_id_fkey') THEN + ALTER TABLE "LiteLLM_TeamMembership" ADD CONSTRAINT "LiteLLM_TeamMembership_budget_id_fkey" FOREIGN KEY ("budget_id") REFERENCES "LiteLLM_BudgetTable"("budget_id") ON DELETE SET NULL ON UPDATE CASCADE; + END IF; +END $$; diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20250625213625_add_status_to_managed_object_table/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20250625213625_add_status_to_managed_object_table/migration.sql index 7ca7b2c370..a4f0ca0794 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20250625213625_add_status_to_managed_object_table/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20250625213625_add_status_to_managed_object_table/migration.sql @@ -1,3 +1,3 @@ -- AlterTable -ALTER TABLE "LiteLLM_ManagedObjectTable" ADD COLUMN "status" TEXT; +ALTER TABLE "LiteLLM_ManagedObjectTable" ADD COLUMN IF NOT EXISTS "status" TEXT; diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20250707212517_add_mcp_info_column_mcp_servers/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20250707212517_add_mcp_info_column_mcp_servers/migration.sql index efe68ff479..e942383ded 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20250707212517_add_mcp_info_column_mcp_servers/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20250707212517_add_mcp_info_column_mcp_servers/migration.sql @@ -1,3 +1,3 @@ -- AlterTable -ALTER TABLE "LiteLLM_MCPServerTable" ADD COLUMN "mcp_info" JSONB DEFAULT '{}'; +ALTER TABLE "LiteLLM_MCPServerTable" ADD COLUMN IF NOT EXISTS "mcp_info" JSONB DEFAULT '{}'; diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20250707230009_add_mcp_namespaced_tool_name/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20250707230009_add_mcp_namespaced_tool_name/migration.sql index 3130619a77..963b29e187 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20250707230009_add_mcp_namespaced_tool_name/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20250707230009_add_mcp_namespaced_tool_name/migration.sql @@ -1,42 +1,42 @@ -- DropIndex -DROP INDEX "LiteLLM_DailyTagSpend_tag_date_api_key_model_custom_llm_pro_key"; +DROP INDEX IF EXISTS "LiteLLM_DailyTagSpend_tag_date_api_key_model_custom_llm_pro_key"; -- DropIndex -DROP INDEX "LiteLLM_DailyTeamSpend_team_id_date_api_key_model_custom_ll_key"; +DROP INDEX IF EXISTS "LiteLLM_DailyTeamSpend_team_id_date_api_key_model_custom_ll_key"; -- DropIndex -DROP INDEX "LiteLLM_DailyUserSpend_user_id_date_api_key_model_custom_ll_key"; +DROP INDEX IF EXISTS "LiteLLM_DailyUserSpend_user_id_date_api_key_model_custom_ll_key"; -- AlterTable -ALTER TABLE "LiteLLM_DailyTagSpend" ADD COLUMN "mcp_namespaced_tool_name" TEXT, +ALTER TABLE "LiteLLM_DailyTagSpend" ADD COLUMN IF NOT EXISTS "mcp_namespaced_tool_name" TEXT, ALTER COLUMN "model" DROP NOT NULL; -- AlterTable -ALTER TABLE "LiteLLM_DailyTeamSpend" ADD COLUMN "mcp_namespaced_tool_name" TEXT, +ALTER TABLE "LiteLLM_DailyTeamSpend" ADD COLUMN IF NOT EXISTS "mcp_namespaced_tool_name" TEXT, ALTER COLUMN "model" DROP NOT NULL; -- AlterTable -ALTER TABLE "LiteLLM_DailyUserSpend" ADD COLUMN "mcp_namespaced_tool_name" TEXT, +ALTER TABLE "LiteLLM_DailyUserSpend" ADD COLUMN IF NOT EXISTS "mcp_namespaced_tool_name" TEXT, ALTER COLUMN "model" DROP NOT NULL; -- AlterTable -ALTER TABLE "LiteLLM_SpendLogs" ADD COLUMN "mcp_namespaced_tool_name" TEXT; +ALTER TABLE "LiteLLM_SpendLogs" ADD COLUMN IF NOT EXISTS "mcp_namespaced_tool_name" TEXT; -- CreateIndex -CREATE INDEX "LiteLLM_DailyTagSpend_mcp_namespaced_tool_name_idx" ON "LiteLLM_DailyTagSpend"("mcp_namespaced_tool_name"); +CREATE INDEX IF NOT EXISTS "LiteLLM_DailyTagSpend_mcp_namespaced_tool_name_idx" ON "LiteLLM_DailyTagSpend"("mcp_namespaced_tool_name"); -- CreateIndex -CREATE UNIQUE INDEX "LiteLLM_DailyTagSpend_tag_date_api_key_model_custom_llm_pro_key" ON "LiteLLM_DailyTagSpend"("tag", "date", "api_key", "model", "custom_llm_provider", "mcp_namespaced_tool_name"); +CREATE UNIQUE INDEX IF NOT EXISTS "LiteLLM_DailyTagSpend_tag_date_api_key_model_custom_llm_pro_key" ON "LiteLLM_DailyTagSpend"("tag", "date", "api_key", "model", "custom_llm_provider", "mcp_namespaced_tool_name"); -- CreateIndex -CREATE INDEX "LiteLLM_DailyTeamSpend_mcp_namespaced_tool_name_idx" ON "LiteLLM_DailyTeamSpend"("mcp_namespaced_tool_name"); +CREATE INDEX IF NOT EXISTS "LiteLLM_DailyTeamSpend_mcp_namespaced_tool_name_idx" ON "LiteLLM_DailyTeamSpend"("mcp_namespaced_tool_name"); -- CreateIndex -CREATE UNIQUE INDEX "LiteLLM_DailyTeamSpend_team_id_date_api_key_model_custom_ll_key" ON "LiteLLM_DailyTeamSpend"("team_id", "date", "api_key", "model", "custom_llm_provider", "mcp_namespaced_tool_name"); +CREATE UNIQUE INDEX IF NOT EXISTS "LiteLLM_DailyTeamSpend_team_id_date_api_key_model_custom_ll_key" ON "LiteLLM_DailyTeamSpend"("team_id", "date", "api_key", "model", "custom_llm_provider", "mcp_namespaced_tool_name"); -- CreateIndex -CREATE INDEX "LiteLLM_DailyUserSpend_mcp_namespaced_tool_name_idx" ON "LiteLLM_DailyUserSpend"("mcp_namespaced_tool_name"); +CREATE INDEX IF NOT EXISTS "LiteLLM_DailyUserSpend_mcp_namespaced_tool_name_idx" ON "LiteLLM_DailyUserSpend"("mcp_namespaced_tool_name"); -- CreateIndex -CREATE UNIQUE INDEX "LiteLLM_DailyUserSpend_user_id_date_api_key_model_custom_ll_key" ON "LiteLLM_DailyUserSpend"("user_id", "date", "api_key", "model", "custom_llm_provider", "mcp_namespaced_tool_name"); +CREATE UNIQUE INDEX IF NOT EXISTS "LiteLLM_DailyUserSpend_user_id_date_api_key_model_custom_ll_key" ON "LiteLLM_DailyUserSpend"("user_id", "date", "api_key", "model", "custom_llm_provider", "mcp_namespaced_tool_name"); diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20250711220620_add_stdio_mcp/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20250711220620_add_stdio_mcp/migration.sql index ebe7a6adb5..685dc6c1d3 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20250711220620_add_stdio_mcp/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20250711220620_add_stdio_mcp/migration.sql @@ -1,10 +1,10 @@ -- AlterTable -ALTER TABLE "LiteLLM_MCPServerTable" ADD COLUMN "args" TEXT[] DEFAULT ARRAY[]::TEXT[], -ADD COLUMN "command" TEXT, -ADD COLUMN "env" JSONB DEFAULT '{}', -ADD COLUMN "mcp_access_groups" TEXT[], +ALTER TABLE "LiteLLM_MCPServerTable" ADD COLUMN IF NOT EXISTS "args" TEXT[] DEFAULT ARRAY[]::TEXT[], +ADD COLUMN IF NOT EXISTS "command" TEXT, +ADD COLUMN IF NOT EXISTS "env" JSONB DEFAULT '{}', +ADD COLUMN IF NOT EXISTS "mcp_access_groups" TEXT[], ALTER COLUMN "url" DROP NOT NULL; -- AlterTable -ALTER TABLE "LiteLLM_ObjectPermissionTable" ADD COLUMN "mcp_access_groups" TEXT[] DEFAULT ARRAY[]::TEXT[]; +ALTER TABLE "LiteLLM_ObjectPermissionTable" ADD COLUMN IF NOT EXISTS "mcp_access_groups" TEXT[] DEFAULT ARRAY[]::TEXT[]; diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20250718125714_add_litellm_params_to_vector_stores/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20250718125714_add_litellm_params_to_vector_stores/migration.sql index ef9956ddd5..5f502a374e 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20250718125714_add_litellm_params_to_vector_stores/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20250718125714_add_litellm_params_to_vector_stores/migration.sql @@ -1,3 +1,3 @@ -- AlterTable -ALTER TABLE "LiteLLM_ManagedVectorStoresTable" ADD COLUMN "litellm_params" JSONB; +ALTER TABLE "LiteLLM_ManagedVectorStoresTable" ADD COLUMN IF NOT EXISTS "litellm_params" JSONB; diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20250802162330_prompt_table/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20250802162330_prompt_table/migration.sql index e5c00ef4ad..81b3574499 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20250802162330_prompt_table/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20250802162330_prompt_table/migration.sql @@ -1,5 +1,5 @@ -- CreateTable -CREATE TABLE "LiteLLM_PromptTable" ( +CREATE TABLE IF NOT EXISTS "LiteLLM_PromptTable" ( "id" TEXT NOT NULL, "prompt_id" TEXT NOT NULL, "litellm_params" JSONB NOT NULL, @@ -11,5 +11,5 @@ CREATE TABLE "LiteLLM_PromptTable" ( ); -- CreateIndex -CREATE UNIQUE INDEX "LiteLLM_PromptTable_prompt_id_key" ON "LiteLLM_PromptTable"("prompt_id"); +CREATE UNIQUE INDEX IF NOT EXISTS "LiteLLM_PromptTable_prompt_id_key" ON "LiteLLM_PromptTable"("prompt_id"); diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20250918083359_drop_spec_version_column_from_mcp_table/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20250918083359_drop_spec_version_column_from_mcp_table/migration.sql index 472e2ea1e0..5b4db0e500 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20250918083359_drop_spec_version_column_from_mcp_table/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20250918083359_drop_spec_version_column_from_mcp_table/migration.sql @@ -5,4 +5,4 @@ */ -- AlterTable -ALTER TABLE "LiteLLM_MCPServerTable" DROP COLUMN "spec_version"; +ALTER TABLE "LiteLLM_MCPServerTable" DROP COLUMN IF EXISTS "spec_version"; diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20250926194702_unnamed_migration/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20250926194702_unnamed_migration/migration.sql index ea28db1966..a40c88cc85 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20250926194702_unnamed_migration/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20250926194702_unnamed_migration/migration.sql @@ -1,7 +1,7 @@ -- AlterTable -ALTER TABLE "LiteLLM_VerificationToken" ADD COLUMN "auto_rotate" BOOLEAN DEFAULT false, -ADD COLUMN "key_rotation_at" TIMESTAMP(3), -ADD COLUMN "last_rotation_at" TIMESTAMP(3), -ADD COLUMN "rotation_count" INTEGER DEFAULT 0, -ADD COLUMN "rotation_interval" TEXT; +ALTER TABLE "LiteLLM_VerificationToken" ADD COLUMN IF NOT EXISTS "auto_rotate" BOOLEAN DEFAULT false, +ADD COLUMN IF NOT EXISTS "key_rotation_at" TIMESTAMP(3), +ADD COLUMN IF NOT EXISTS "last_rotation_at" TIMESTAMP(3), +ADD COLUMN IF NOT EXISTS "rotation_count" INTEGER DEFAULT 0, +ADD COLUMN IF NOT EXISTS "rotation_interval" TEXT; diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20251003165142_add_allowed_tools_to_mcp/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20251003165142_add_allowed_tools_to_mcp/migration.sql index bdac1e42bc..d5206e8d3a 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20251003165142_add_allowed_tools_to_mcp/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20251003165142_add_allowed_tools_to_mcp/migration.sql @@ -1,3 +1,3 @@ -- AlterTable -ALTER TABLE "LiteLLM_MCPServerTable" ADD COLUMN "allowed_tools" TEXT[] DEFAULT ARRAY[]::TEXT[]; +ALTER TABLE "LiteLLM_MCPServerTable" ADD COLUMN IF NOT EXISTS "allowed_tools" TEXT[] DEFAULT ARRAY[]::TEXT[]; diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20251003190954_extra_headers_to_mcp_table/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20251003190954_extra_headers_to_mcp_table/migration.sql index 1cfcf062eb..b6275c6421 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20251003190954_extra_headers_to_mcp_table/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20251003190954_extra_headers_to_mcp_table/migration.sql @@ -1,3 +1,3 @@ -- AlterTable -ALTER TABLE "LiteLLM_MCPServerTable" ADD COLUMN "extra_headers" TEXT[] DEFAULT ARRAY[]::TEXT[]; +ALTER TABLE "LiteLLM_MCPServerTable" ADD COLUMN IF NOT EXISTS "extra_headers" TEXT[] DEFAULT ARRAY[]::TEXT[]; diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20251006143948_add_mcp_tool_permissions/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20251006143948_add_mcp_tool_permissions/migration.sql index 51f3be8758..70584a9628 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20251006143948_add_mcp_tool_permissions/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20251006143948_add_mcp_tool_permissions/migration.sql @@ -1,3 +1,3 @@ -- AlterTable -ALTER TABLE "LiteLLM_ObjectPermissionTable" ADD COLUMN "mcp_tool_permissions" JSONB; +ALTER TABLE "LiteLLM_ObjectPermissionTable" ADD COLUMN IF NOT EXISTS "mcp_tool_permissions" JSONB; diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20251011084309_add_tag_table/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20251011084309_add_tag_table/migration.sql index 541c70c7e4..c1005a75a4 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20251011084309_add_tag_table/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20251011084309_add_tag_table/migration.sql @@ -1,5 +1,5 @@ -- CreateTable -CREATE TABLE "LiteLLM_TagTable" ( +CREATE TABLE IF NOT EXISTS "LiteLLM_TagTable" ( "tag_name" TEXT NOT NULL, "description" TEXT, "models" TEXT[], @@ -14,5 +14,10 @@ CREATE TABLE "LiteLLM_TagTable" ( ); -- AddForeignKey -ALTER TABLE "LiteLLM_TagTable" ADD CONSTRAINT "LiteLLM_TagTable_budget_id_fkey" FOREIGN KEY ("budget_id") REFERENCES "LiteLLM_BudgetTable"("budget_id") ON DELETE SET NULL ON UPDATE CASCADE; +DO $$ +BEGIN + IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'LiteLLM_TagTable_budget_id_fkey') THEN + ALTER TABLE "LiteLLM_TagTable" ADD CONSTRAINT "LiteLLM_TagTable_budget_id_fkey" FOREIGN KEY ("budget_id") REFERENCES "LiteLLM_BudgetTable"("budget_id") ON DELETE SET NULL ON UPDATE CASCADE; + END IF; +END $$; diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20251023141814_add_search_tool_table/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20251023141814_add_search_tool_table/migration.sql index 4cbe4a7184..3cd2a4c489 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20251023141814_add_search_tool_table/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20251023141814_add_search_tool_table/migration.sql @@ -1,5 +1,5 @@ -- CreateTable -CREATE TABLE "LiteLLM_SearchToolsTable" ( +CREATE TABLE IF NOT EXISTS "LiteLLM_SearchToolsTable" ( "search_tool_id" TEXT NOT NULL, "search_tool_name" TEXT NOT NULL, "litellm_params" JSONB NOT NULL, @@ -11,5 +11,5 @@ CREATE TABLE "LiteLLM_SearchToolsTable" ( ); -- CreateIndex -CREATE UNIQUE INDEX "LiteLLM_SearchToolsTable_search_tool_name_key" ON "LiteLLM_SearchToolsTable"("search_tool_name"); +CREATE UNIQUE INDEX IF NOT EXISTS "LiteLLM_SearchToolsTable_search_tool_name_key" ON "LiteLLM_SearchToolsTable"("search_tool_name"); diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20251031181430_add_cache_config_table/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20251031181430_add_cache_config_table/migration.sql index 705a6fd4d9..bb475b03d2 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20251031181430_add_cache_config_table/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20251031181430_add_cache_config_table/migration.sql @@ -1,5 +1,5 @@ -- CreateTable -CREATE TABLE "LiteLLM_SSOConfig" ( +CREATE TABLE IF NOT EXISTS "LiteLLM_SSOConfig" ( "id" TEXT NOT NULL DEFAULT 'sso_config', "sso_settings" JSONB NOT NULL, "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, @@ -9,7 +9,7 @@ CREATE TABLE "LiteLLM_SSOConfig" ( ); -- CreateTable -CREATE TABLE "LiteLLM_CacheConfig" ( +CREATE TABLE IF NOT EXISTS "LiteLLM_CacheConfig" ( "id" TEXT NOT NULL DEFAULT 'cache_config', "cache_settings" JSONB NOT NULL, "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20251101131415_add_managed_vector_store_index_table/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20251101131415_add_managed_vector_store_index_table/migration.sql index af13500d1c..0997e56917 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20251101131415_add_managed_vector_store_index_table/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20251101131415_add_managed_vector_store_index_table/migration.sql @@ -1,5 +1,5 @@ -- CreateTable -CREATE TABLE "LiteLLM_ManagedVectorStoreIndexTable" ( +CREATE TABLE IF NOT EXISTS "LiteLLM_ManagedVectorStoreIndexTable" ( "id" TEXT NOT NULL, "index_name" TEXT NOT NULL, "litellm_params" JSONB NOT NULL, @@ -13,5 +13,5 @@ CREATE TABLE "LiteLLM_ManagedVectorStoreIndexTable" ( ); -- CreateIndex -CREATE UNIQUE INDEX "LiteLLM_ManagedVectorStoreIndexTable_index_name_key" ON "LiteLLM_ManagedVectorStoreIndexTable"("index_name"); +CREATE UNIQUE INDEX IF NOT EXISTS "LiteLLM_ManagedVectorStoreIndexTable_index_name_key" ON "LiteLLM_ManagedVectorStoreIndexTable"("index_name"); diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20251103072422_add_static_headers/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20251103072422_add_static_headers/migration.sql index 0bedac7631..452a0b73a5 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20251103072422_add_static_headers/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20251103072422_add_static_headers/migration.sql @@ -1,2 +1,2 @@ -- AlterTable -ALTER TABLE "LiteLLM_MCPServerTable" ADD COLUMN "static_headers" JSONB DEFAULT '{}'; +ALTER TABLE "LiteLLM_MCPServerTable" ADD COLUMN IF NOT EXISTS "static_headers" JSONB DEFAULT '{}'; diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20251104220043_add_credentials_to_mcp_servers/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20251104220043_add_credentials_to_mcp_servers/migration.sql index 800c96f18b..c86c3f1f4b 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20251104220043_add_credentials_to_mcp_servers/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20251104220043_add_credentials_to_mcp_servers/migration.sql @@ -1,2 +1,2 @@ -- AlterTable -ALTER TABLE "LiteLLM_MCPServerTable" ADD COLUMN "credentials" JSONB DEFAULT '{}'; +ALTER TABLE "LiteLLM_MCPServerTable" ADD COLUMN IF NOT EXISTS "credentials" JSONB DEFAULT '{}'; diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20251113000000_add_project_table/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20251113000000_add_project_table/migration.sql index f1d3129bb3..9769699b33 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20251113000000_add_project_table/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20251113000000_add_project_table/migration.sql @@ -1,5 +1,5 @@ -- CreateTable -CREATE TABLE "LiteLLM_ProjectTable" ( +CREATE TABLE IF NOT EXISTS "LiteLLM_ProjectTable" ( "project_id" TEXT NOT NULL, "project_alias" TEXT, "team_id" TEXT, @@ -19,17 +19,37 @@ CREATE TABLE "LiteLLM_ProjectTable" ( ); -- AddForeignKey -ALTER TABLE "LiteLLM_ProjectTable" ADD CONSTRAINT "LiteLLM_ProjectTable_team_id_fkey" FOREIGN KEY ("team_id") REFERENCES "LiteLLM_TeamTable"("team_id") ON DELETE SET NULL ON UPDATE CASCADE; +DO $$ +BEGIN + IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'LiteLLM_ProjectTable_team_id_fkey') THEN + ALTER TABLE "LiteLLM_ProjectTable" ADD CONSTRAINT "LiteLLM_ProjectTable_team_id_fkey" FOREIGN KEY ("team_id") REFERENCES "LiteLLM_TeamTable"("team_id") ON DELETE SET NULL ON UPDATE CASCADE; + END IF; +END $$; -- AddForeignKey -ALTER TABLE "LiteLLM_ProjectTable" ADD CONSTRAINT "LiteLLM_ProjectTable_budget_id_fkey" FOREIGN KEY ("budget_id") REFERENCES "LiteLLM_BudgetTable"("budget_id") ON DELETE SET NULL ON UPDATE CASCADE; +DO $$ +BEGIN + IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'LiteLLM_ProjectTable_budget_id_fkey') THEN + ALTER TABLE "LiteLLM_ProjectTable" ADD CONSTRAINT "LiteLLM_ProjectTable_budget_id_fkey" FOREIGN KEY ("budget_id") REFERENCES "LiteLLM_BudgetTable"("budget_id") ON DELETE SET NULL ON UPDATE CASCADE; + END IF; +END $$; -- AddForeignKey -ALTER TABLE "LiteLLM_ProjectTable" ADD CONSTRAINT "LiteLLM_ProjectTable_object_permission_id_fkey" FOREIGN KEY ("object_permission_id") REFERENCES "LiteLLM_ObjectPermissionTable"("object_permission_id") ON DELETE SET NULL ON UPDATE CASCADE; +DO $$ +BEGIN + IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'LiteLLM_ProjectTable_object_permission_id_fkey') THEN + ALTER TABLE "LiteLLM_ProjectTable" ADD CONSTRAINT "LiteLLM_ProjectTable_object_permission_id_fkey" FOREIGN KEY ("object_permission_id") REFERENCES "LiteLLM_ObjectPermissionTable"("object_permission_id") ON DELETE SET NULL ON UPDATE CASCADE; + END IF; +END $$; -- AlterTable: Add project_id to LiteLLM_VerificationToken -ALTER TABLE "LiteLLM_VerificationToken" ADD COLUMN "project_id" TEXT; +ALTER TABLE "LiteLLM_VerificationToken" ADD COLUMN IF NOT EXISTS "project_id" TEXT; -- AddForeignKey -ALTER TABLE "LiteLLM_VerificationToken" ADD CONSTRAINT "LiteLLM_VerificationToken_project_id_fkey" FOREIGN KEY ("project_id") REFERENCES "LiteLLM_ProjectTable"("project_id") ON DELETE SET NULL ON UPDATE CASCADE; +DO $$ +BEGIN + IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'LiteLLM_VerificationToken_project_id_fkey') THEN + ALTER TABLE "LiteLLM_VerificationToken" ADD CONSTRAINT "LiteLLM_VerificationToken_project_id_fkey" FOREIGN KEY ("project_id") REFERENCES "LiteLLM_ProjectTable"("project_id") ON DELETE SET NULL ON UPDATE CASCADE; + END IF; +END $$; diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20251113000001_add_project_fields/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20251113000001_add_project_fields/migration.sql index 48328b4d6a..69dbb6790c 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20251113000001_add_project_fields/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20251113000001_add_project_fields/migration.sql @@ -1,5 +1,5 @@ -- AlterTable: Add new fields to LiteLLM_ProjectTable -ALTER TABLE "LiteLLM_ProjectTable" ADD COLUMN "description" TEXT; -ALTER TABLE "LiteLLM_ProjectTable" ADD COLUMN "model_rpm_limit" JSONB NOT NULL DEFAULT '{}'; -ALTER TABLE "LiteLLM_ProjectTable" ADD COLUMN "model_tpm_limit" JSONB NOT NULL DEFAULT '{}'; +ALTER TABLE "LiteLLM_ProjectTable" ADD COLUMN IF NOT EXISTS "description" TEXT; +ALTER TABLE "LiteLLM_ProjectTable" ADD COLUMN IF NOT EXISTS "model_rpm_limit" JSONB NOT NULL DEFAULT '{}'; +ALTER TABLE "LiteLLM_ProjectTable" ADD COLUMN IF NOT EXISTS "model_tpm_limit" JSONB NOT NULL DEFAULT '{}'; diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20251114173537_add_request_id_to_daily_tag_spend/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20251114173537_add_request_id_to_daily_tag_spend/migration.sql index 6871e27a28..6d66ef36ae 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20251114173537_add_request_id_to_daily_tag_spend/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20251114173537_add_request_id_to_daily_tag_spend/migration.sql @@ -1,3 +1,3 @@ -- AlterTable -ALTER TABLE "LiteLLM_DailyTagSpend" ADD COLUMN "request_id" TEXT; +ALTER TABLE "LiteLLM_DailyTagSpend" ADD COLUMN IF NOT EXISTS "request_id" TEXT; diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20251114180624_Add_org_usage_table/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20251114180624_Add_org_usage_table/migration.sql index 74e0eea313..387b40461a 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20251114180624_Add_org_usage_table/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20251114180624_Add_org_usage_table/migration.sql @@ -1,5 +1,5 @@ -- CreateTable -CREATE TABLE "LiteLLM_DailyOrganizationSpend" ( +CREATE TABLE IF NOT EXISTS "LiteLLM_DailyOrganizationSpend" ( "id" TEXT NOT NULL, "organization_id" TEXT, "date" TEXT NOT NULL, @@ -23,20 +23,20 @@ CREATE TABLE "LiteLLM_DailyOrganizationSpend" ( ); -- CreateIndex -CREATE INDEX "LiteLLM_DailyOrganizationSpend_date_idx" ON "LiteLLM_DailyOrganizationSpend"("date"); +CREATE INDEX IF NOT EXISTS "LiteLLM_DailyOrganizationSpend_date_idx" ON "LiteLLM_DailyOrganizationSpend"("date"); -- CreateIndex -CREATE INDEX "LiteLLM_DailyOrganizationSpend_organization_id_idx" ON "LiteLLM_DailyOrganizationSpend"("organization_id"); +CREATE INDEX IF NOT EXISTS "LiteLLM_DailyOrganizationSpend_organization_id_idx" ON "LiteLLM_DailyOrganizationSpend"("organization_id"); -- CreateIndex -CREATE INDEX "LiteLLM_DailyOrganizationSpend_api_key_idx" ON "LiteLLM_DailyOrganizationSpend"("api_key"); +CREATE INDEX IF NOT EXISTS "LiteLLM_DailyOrganizationSpend_api_key_idx" ON "LiteLLM_DailyOrganizationSpend"("api_key"); -- CreateIndex -CREATE INDEX "LiteLLM_DailyOrganizationSpend_model_idx" ON "LiteLLM_DailyOrganizationSpend"("model"); +CREATE INDEX IF NOT EXISTS "LiteLLM_DailyOrganizationSpend_model_idx" ON "LiteLLM_DailyOrganizationSpend"("model"); -- CreateIndex -CREATE INDEX "LiteLLM_DailyOrganizationSpend_mcp_namespaced_tool_name_idx" ON "LiteLLM_DailyOrganizationSpend"("mcp_namespaced_tool_name"); +CREATE INDEX IF NOT EXISTS "LiteLLM_DailyOrganizationSpend_mcp_namespaced_tool_name_idx" ON "LiteLLM_DailyOrganizationSpend"("mcp_namespaced_tool_name"); -- CreateIndex -CREATE UNIQUE INDEX "LiteLLM_DailyOrganizationSpend_organization_id_date_api_key_key" ON "LiteLLM_DailyOrganizationSpend"("organization_id", "date", "api_key", "model", "custom_llm_provider", "mcp_namespaced_tool_name"); +CREATE UNIQUE INDEX IF NOT EXISTS "LiteLLM_DailyOrganizationSpend_organization_id_date_api_key_key" ON "LiteLLM_DailyOrganizationSpend"("organization_id", "date", "api_key", "model", "custom_llm_provider", "mcp_namespaced_tool_name"); diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20251114182247_agents_table/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20251114182247_agents_table/migration.sql index 28760dcfe4..35595c7eed 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20251114182247_agents_table/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20251114182247_agents_table/migration.sql @@ -1,5 +1,5 @@ -- CreateTable -CREATE TABLE "LiteLLM_AgentsTable" ( +CREATE TABLE IF NOT EXISTS "LiteLLM_AgentsTable" ( "agent_id" TEXT NOT NULL, "agent_name" TEXT NOT NULL, "litellm_params" JSONB, @@ -13,5 +13,5 @@ CREATE TABLE "LiteLLM_AgentsTable" ( ); -- CreateIndex -CREATE UNIQUE INDEX "LiteLLM_AgentsTable_agent_name_key" ON "LiteLLM_AgentsTable"("agent_name"); +CREATE UNIQUE INDEX IF NOT EXISTS "LiteLLM_AgentsTable_agent_name_key" ON "LiteLLM_AgentsTable"("agent_name"); diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20251119131227_add_prompt_versioning/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20251119131227_add_prompt_versioning/migration.sql index 43eb240142..f604dcadbd 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20251119131227_add_prompt_versioning/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20251119131227_add_prompt_versioning/migration.sql @@ -3,10 +3,10 @@ DROP INDEX IF EXISTS "LiteLLM_PromptTable_prompt_id_key"; -- AlterTable ALTER TABLE "LiteLLM_PromptTable" -ADD COLUMN "version" INTEGER NOT NULL DEFAULT 1; +ADD COLUMN IF NOT EXISTS "version" INTEGER NOT NULL DEFAULT 1; -- CreateIndex -CREATE INDEX "LiteLLM_PromptTable_prompt_id_idx" ON "LiteLLM_PromptTable" ("prompt_id"); +CREATE INDEX IF NOT EXISTS "LiteLLM_PromptTable_prompt_id_idx" ON "LiteLLM_PromptTable" ("prompt_id"); -- CreateIndex -CREATE UNIQUE INDEX "LiteLLM_PromptTable_prompt_id_version_key" ON "LiteLLM_PromptTable" ("prompt_id", "version"); \ No newline at end of file +CREATE UNIQUE INDEX IF NOT EXISTS "LiteLLM_PromptTable_prompt_id_version_key" ON "LiteLLM_PromptTable" ("prompt_id", "version"); \ No newline at end of file diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20251122125322_Add organization_id to spend logs/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20251122125322_Add organization_id to spend logs/migration.sql index 4ea082f275..bc483aace7 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20251122125322_Add organization_id to spend logs/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20251122125322_Add organization_id to spend logs/migration.sql @@ -1,3 +1,3 @@ -- AlterTable -ALTER TABLE "LiteLLM_SpendLogs" ADD COLUMN "organization_id" TEXT; +ALTER TABLE "LiteLLM_SpendLogs" ADD COLUMN IF NOT EXISTS "organization_id" TEXT; diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20251204124859_add_end_user_spend_table/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20251204124859_add_end_user_spend_table/migration.sql index c4234785c5..3544768cc1 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20251204124859_add_end_user_spend_table/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20251204124859_add_end_user_spend_table/migration.sql @@ -1,5 +1,5 @@ -- CreateTable -CREATE TABLE "LiteLLM_DailyEndUserSpend" ( +CREATE TABLE IF NOT EXISTS "LiteLLM_DailyEndUserSpend" ( "id" TEXT NOT NULL, "end_user_id" TEXT, "date" TEXT NOT NULL, @@ -23,20 +23,20 @@ CREATE TABLE "LiteLLM_DailyEndUserSpend" ( ); -- CreateIndex -CREATE INDEX "LiteLLM_DailyEndUserSpend_date_idx" ON "LiteLLM_DailyEndUserSpend"("date"); +CREATE INDEX IF NOT EXISTS "LiteLLM_DailyEndUserSpend_date_idx" ON "LiteLLM_DailyEndUserSpend"("date"); -- CreateIndex -CREATE INDEX "LiteLLM_DailyEndUserSpend_end_user_id_idx" ON "LiteLLM_DailyEndUserSpend"("end_user_id"); +CREATE INDEX IF NOT EXISTS "LiteLLM_DailyEndUserSpend_end_user_id_idx" ON "LiteLLM_DailyEndUserSpend"("end_user_id"); -- CreateIndex -CREATE INDEX "LiteLLM_DailyEndUserSpend_api_key_idx" ON "LiteLLM_DailyEndUserSpend"("api_key"); +CREATE INDEX IF NOT EXISTS "LiteLLM_DailyEndUserSpend_api_key_idx" ON "LiteLLM_DailyEndUserSpend"("api_key"); -- CreateIndex -CREATE INDEX "LiteLLM_DailyEndUserSpend_model_idx" ON "LiteLLM_DailyEndUserSpend"("model"); +CREATE INDEX IF NOT EXISTS "LiteLLM_DailyEndUserSpend_model_idx" ON "LiteLLM_DailyEndUserSpend"("model"); -- CreateIndex -CREATE INDEX "LiteLLM_DailyEndUserSpend_mcp_namespaced_tool_name_idx" ON "LiteLLM_DailyEndUserSpend"("mcp_namespaced_tool_name"); +CREATE INDEX IF NOT EXISTS "LiteLLM_DailyEndUserSpend_mcp_namespaced_tool_name_idx" ON "LiteLLM_DailyEndUserSpend"("mcp_namespaced_tool_name"); -- CreateIndex -CREATE UNIQUE INDEX "LiteLLM_DailyEndUserSpend_end_user_id_date_api_key_model_cu_key" ON "LiteLLM_DailyEndUserSpend"("end_user_id", "date", "api_key", "model", "custom_llm_provider", "mcp_namespaced_tool_name"); +CREATE UNIQUE INDEX IF NOT EXISTS "LiteLLM_DailyEndUserSpend_end_user_id_date_api_key_model_cu_key" ON "LiteLLM_DailyEndUserSpend"("end_user_id", "date", "api_key", "model", "custom_llm_provider", "mcp_namespaced_tool_name"); diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20251209112246_add_ui_settings_table/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20251209112246_add_ui_settings_table/migration.sql index 1719ce646d..01e2c9fa76 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20251209112246_add_ui_settings_table/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20251209112246_add_ui_settings_table/migration.sql @@ -1,5 +1,5 @@ -- CreateTable -CREATE TABLE "LiteLLM_UISettings" ( +CREATE TABLE IF NOT EXISTS "LiteLLM_UISettings" ( "id" TEXT NOT NULL DEFAULT 'ui_settings', "ui_settings" JSONB NOT NULL, "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20251210205007_add_daily_agent_spend_table/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20251210205007_add_daily_agent_spend_table/migration.sql index 964904c14c..4cc894f9b2 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20251210205007_add_daily_agent_spend_table/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20251210205007_add_daily_agent_spend_table/migration.sql @@ -1,8 +1,8 @@ -- AlterTable -ALTER TABLE "LiteLLM_SpendLogs" ADD COLUMN "agent_id" TEXT; +ALTER TABLE "LiteLLM_SpendLogs" ADD COLUMN IF NOT EXISTS "agent_id" TEXT; -- CreateTable -CREATE TABLE "LiteLLM_DailyAgentSpend" ( +CREATE TABLE IF NOT EXISTS "LiteLLM_DailyAgentSpend" ( "id" TEXT NOT NULL, "agent_id" TEXT, "date" TEXT NOT NULL, @@ -26,20 +26,20 @@ CREATE TABLE "LiteLLM_DailyAgentSpend" ( ); -- CreateIndex -CREATE INDEX "LiteLLM_DailyAgentSpend_date_idx" ON "LiteLLM_DailyAgentSpend"("date"); +CREATE INDEX IF NOT EXISTS "LiteLLM_DailyAgentSpend_date_idx" ON "LiteLLM_DailyAgentSpend"("date"); -- CreateIndex -CREATE INDEX "LiteLLM_DailyAgentSpend_agent_id_idx" ON "LiteLLM_DailyAgentSpend"("agent_id"); +CREATE INDEX IF NOT EXISTS "LiteLLM_DailyAgentSpend_agent_id_idx" ON "LiteLLM_DailyAgentSpend"("agent_id"); -- CreateIndex -CREATE INDEX "LiteLLM_DailyAgentSpend_api_key_idx" ON "LiteLLM_DailyAgentSpend"("api_key"); +CREATE INDEX IF NOT EXISTS "LiteLLM_DailyAgentSpend_api_key_idx" ON "LiteLLM_DailyAgentSpend"("api_key"); -- CreateIndex -CREATE INDEX "LiteLLM_DailyAgentSpend_model_idx" ON "LiteLLM_DailyAgentSpend"("model"); +CREATE INDEX IF NOT EXISTS "LiteLLM_DailyAgentSpend_model_idx" ON "LiteLLM_DailyAgentSpend"("model"); -- CreateIndex -CREATE INDEX "LiteLLM_DailyAgentSpend_mcp_namespaced_tool_name_idx" ON "LiteLLM_DailyAgentSpend"("mcp_namespaced_tool_name"); +CREATE INDEX IF NOT EXISTS "LiteLLM_DailyAgentSpend_mcp_namespaced_tool_name_idx" ON "LiteLLM_DailyAgentSpend"("mcp_namespaced_tool_name"); -- CreateIndex -CREATE UNIQUE INDEX "LiteLLM_DailyAgentSpend_agent_id_date_api_key_model_custom__key" ON "LiteLLM_DailyAgentSpend"("agent_id", "date", "api_key", "model", "custom_llm_provider", "mcp_namespaced_tool_name"); +CREATE UNIQUE INDEX IF NOT EXISTS "LiteLLM_DailyAgentSpend_agent_id_date_api_key_model_custom__key" ON "LiteLLM_DailyAgentSpend"("agent_id", "date", "api_key", "model", "custom_llm_provider", "mcp_namespaced_tool_name"); diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20251219110931_add_deleted_keys_and_deleted_teams_tables/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20251219110931_add_deleted_keys_and_deleted_teams_tables/migration.sql index 6ca66ddaad..8acff490bb 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20251219110931_add_deleted_keys_and_deleted_teams_tables/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20251219110931_add_deleted_keys_and_deleted_teams_tables/migration.sql @@ -1,5 +1,5 @@ -- CreateTable -CREATE TABLE "LiteLLM_DeletedTeamTable" ( +CREATE TABLE IF NOT EXISTS "LiteLLM_DeletedTeamTable" ( "id" TEXT NOT NULL, "team_id" TEXT NOT NULL, "team_alias" TEXT, @@ -33,7 +33,7 @@ CREATE TABLE "LiteLLM_DeletedTeamTable" ( ); -- CreateTable -CREATE TABLE "LiteLLM_DeletedVerificationToken" ( +CREATE TABLE IF NOT EXISTS "LiteLLM_DeletedVerificationToken" ( "id" TEXT NOT NULL, "token" TEXT NOT NULL, "key_name" TEXT, @@ -80,38 +80,38 @@ CREATE TABLE "LiteLLM_DeletedVerificationToken" ( ); -- CreateIndex -CREATE INDEX "LiteLLM_DeletedTeamTable_team_id_idx" ON "LiteLLM_DeletedTeamTable"("team_id"); +CREATE INDEX IF NOT EXISTS "LiteLLM_DeletedTeamTable_team_id_idx" ON "LiteLLM_DeletedTeamTable"("team_id"); -- CreateIndex -CREATE INDEX "LiteLLM_DeletedTeamTable_deleted_at_idx" ON "LiteLLM_DeletedTeamTable"("deleted_at"); +CREATE INDEX IF NOT EXISTS "LiteLLM_DeletedTeamTable_deleted_at_idx" ON "LiteLLM_DeletedTeamTable"("deleted_at"); -- CreateIndex -CREATE INDEX "LiteLLM_DeletedTeamTable_organization_id_idx" ON "LiteLLM_DeletedTeamTable"("organization_id"); +CREATE INDEX IF NOT EXISTS "LiteLLM_DeletedTeamTable_organization_id_idx" ON "LiteLLM_DeletedTeamTable"("organization_id"); -- CreateIndex -CREATE INDEX "LiteLLM_DeletedTeamTable_team_alias_idx" ON "LiteLLM_DeletedTeamTable"("team_alias"); +CREATE INDEX IF NOT EXISTS "LiteLLM_DeletedTeamTable_team_alias_idx" ON "LiteLLM_DeletedTeamTable"("team_alias"); -- CreateIndex -CREATE INDEX "LiteLLM_DeletedTeamTable_created_at_idx" ON "LiteLLM_DeletedTeamTable"("created_at"); +CREATE INDEX IF NOT EXISTS "LiteLLM_DeletedTeamTable_created_at_idx" ON "LiteLLM_DeletedTeamTable"("created_at"); -- CreateIndex -CREATE INDEX "LiteLLM_DeletedVerificationToken_token_idx" ON "LiteLLM_DeletedVerificationToken"("token"); +CREATE INDEX IF NOT EXISTS "LiteLLM_DeletedVerificationToken_token_idx" ON "LiteLLM_DeletedVerificationToken"("token"); -- CreateIndex -CREATE INDEX "LiteLLM_DeletedVerificationToken_deleted_at_idx" ON "LiteLLM_DeletedVerificationToken"("deleted_at"); +CREATE INDEX IF NOT EXISTS "LiteLLM_DeletedVerificationToken_deleted_at_idx" ON "LiteLLM_DeletedVerificationToken"("deleted_at"); -- CreateIndex -CREATE INDEX "LiteLLM_DeletedVerificationToken_user_id_idx" ON "LiteLLM_DeletedVerificationToken"("user_id"); +CREATE INDEX IF NOT EXISTS "LiteLLM_DeletedVerificationToken_user_id_idx" ON "LiteLLM_DeletedVerificationToken"("user_id"); -- CreateIndex -CREATE INDEX "LiteLLM_DeletedVerificationToken_team_id_idx" ON "LiteLLM_DeletedVerificationToken"("team_id"); +CREATE INDEX IF NOT EXISTS "LiteLLM_DeletedVerificationToken_team_id_idx" ON "LiteLLM_DeletedVerificationToken"("team_id"); -- CreateIndex -CREATE INDEX "LiteLLM_DeletedVerificationToken_organization_id_idx" ON "LiteLLM_DeletedVerificationToken"("organization_id"); +CREATE INDEX IF NOT EXISTS "LiteLLM_DeletedVerificationToken_organization_id_idx" ON "LiteLLM_DeletedVerificationToken"("organization_id"); -- CreateIndex -CREATE INDEX "LiteLLM_DeletedVerificationToken_key_alias_idx" ON "LiteLLM_DeletedVerificationToken"("key_alias"); +CREATE INDEX IF NOT EXISTS "LiteLLM_DeletedVerificationToken_key_alias_idx" ON "LiteLLM_DeletedVerificationToken"("key_alias"); -- CreateIndex -CREATE INDEX "LiteLLM_DeletedVerificationToken_created_at_idx" ON "LiteLLM_DeletedVerificationToken"("created_at"); +CREATE INDEX IF NOT EXISTS "LiteLLM_DeletedVerificationToken_created_at_idx" ON "LiteLLM_DeletedVerificationToken"("created_at"); diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20251220144550_schema_update/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20251220144550_schema_update/migration.sql index b40defec30..c79ce17b9e 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20251220144550_schema_update/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20251220144550_schema_update/migration.sql @@ -1,5 +1,5 @@ -- CreateTable -CREATE TABLE "LiteLLM_SkillsTable" ( +CREATE TABLE IF NOT EXISTS "LiteLLM_SkillsTable" ( "skill_id" TEXT NOT NULL, "display_title" TEXT, "description" TEXT, diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260102131258_add_metadata_urls_to_mcp_servers/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260102131258_add_metadata_urls_to_mcp_servers/migration.sql index 8eebb797e2..a854693d57 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260102131258_add_metadata_urls_to_mcp_servers/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260102131258_add_metadata_urls_to_mcp_servers/migration.sql @@ -1,5 +1,5 @@ -- AlterTable -ALTER TABLE "LiteLLM_MCPServerTable" ADD COLUMN "authorization_url" TEXT, -ADD COLUMN "registration_url" TEXT, -ADD COLUMN "token_url" TEXT; +ALTER TABLE "LiteLLM_MCPServerTable" ADD COLUMN IF NOT EXISTS "authorization_url" TEXT, +ADD COLUMN IF NOT EXISTS "registration_url" TEXT, +ADD COLUMN IF NOT EXISTS "token_url" TEXT; diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260105151539_add_allow_all_keys_to_mcp_servers/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260105151539_add_allow_all_keys_to_mcp_servers/migration.sql index 8d3e02bd05..26319c5ed8 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260105151539_add_allow_all_keys_to_mcp_servers/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260105151539_add_allow_all_keys_to_mcp_servers/migration.sql @@ -1,3 +1,3 @@ -- AlterTable -ALTER TABLE "LiteLLM_MCPServerTable" ADD COLUMN "allow_all_keys" BOOLEAN NOT NULL DEFAULT false; +ALTER TABLE "LiteLLM_MCPServerTable" ADD COLUMN IF NOT EXISTS "allow_all_keys" BOOLEAN NOT NULL DEFAULT false; diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260106155622_add_endpoint_to_daily_activity_tables/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260106155622_add_endpoint_to_daily_activity_tables/migration.sql index 4ed7feb9ca..3e94f736ea 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260106155622_add_endpoint_to_daily_activity_tables/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260106155622_add_endpoint_to_daily_activity_tables/migration.sql @@ -1,72 +1,72 @@ -- DropIndex -DROP INDEX "LiteLLM_DailyAgentSpend_agent_id_date_api_key_model_custom__key"; +DROP INDEX IF EXISTS "LiteLLM_DailyAgentSpend_agent_id_date_api_key_model_custom__key"; -- DropIndex -DROP INDEX "LiteLLM_DailyEndUserSpend_end_user_id_date_api_key_model_cu_key"; +DROP INDEX IF EXISTS "LiteLLM_DailyEndUserSpend_end_user_id_date_api_key_model_cu_key"; -- DropIndex -DROP INDEX "LiteLLM_DailyOrganizationSpend_organization_id_date_api_key_key"; +DROP INDEX IF EXISTS "LiteLLM_DailyOrganizationSpend_organization_id_date_api_key_key"; -- DropIndex -DROP INDEX "LiteLLM_DailyTagSpend_tag_date_api_key_model_custom_llm_pro_key"; +DROP INDEX IF EXISTS "LiteLLM_DailyTagSpend_tag_date_api_key_model_custom_llm_pro_key"; -- DropIndex -DROP INDEX "LiteLLM_DailyTeamSpend_team_id_date_api_key_model_custom_ll_key"; +DROP INDEX IF EXISTS "LiteLLM_DailyTeamSpend_team_id_date_api_key_model_custom_ll_key"; -- DropIndex -DROP INDEX "LiteLLM_DailyUserSpend_user_id_date_api_key_model_custom_ll_key"; +DROP INDEX IF EXISTS "LiteLLM_DailyUserSpend_user_id_date_api_key_model_custom_ll_key"; -- AlterTable -ALTER TABLE "LiteLLM_DailyAgentSpend" ADD COLUMN "endpoint" TEXT; +ALTER TABLE "LiteLLM_DailyAgentSpend" ADD COLUMN IF NOT EXISTS "endpoint" TEXT; -- AlterTable -ALTER TABLE "LiteLLM_DailyEndUserSpend" ADD COLUMN "endpoint" TEXT; +ALTER TABLE "LiteLLM_DailyEndUserSpend" ADD COLUMN IF NOT EXISTS "endpoint" TEXT; -- AlterTable -ALTER TABLE "LiteLLM_DailyOrganizationSpend" ADD COLUMN "endpoint" TEXT; +ALTER TABLE "LiteLLM_DailyOrganizationSpend" ADD COLUMN IF NOT EXISTS "endpoint" TEXT; -- AlterTable -ALTER TABLE "LiteLLM_DailyTagSpend" ADD COLUMN "endpoint" TEXT; +ALTER TABLE "LiteLLM_DailyTagSpend" ADD COLUMN IF NOT EXISTS "endpoint" TEXT; -- AlterTable -ALTER TABLE "LiteLLM_DailyTeamSpend" ADD COLUMN "endpoint" TEXT; +ALTER TABLE "LiteLLM_DailyTeamSpend" ADD COLUMN IF NOT EXISTS "endpoint" TEXT; -- AlterTable -ALTER TABLE "LiteLLM_DailyUserSpend" ADD COLUMN "endpoint" TEXT; +ALTER TABLE "LiteLLM_DailyUserSpend" ADD COLUMN IF NOT EXISTS "endpoint" TEXT; -- CreateIndex -CREATE INDEX "LiteLLM_DailyAgentSpend_endpoint_idx" ON "LiteLLM_DailyAgentSpend"("endpoint"); +CREATE INDEX IF NOT EXISTS "LiteLLM_DailyAgentSpend_endpoint_idx" ON "LiteLLM_DailyAgentSpend"("endpoint"); -- CreateIndex -CREATE UNIQUE INDEX "LiteLLM_DailyAgentSpend_agent_id_date_api_key_model_custom__key" ON "LiteLLM_DailyAgentSpend"("agent_id", "date", "api_key", "model", "custom_llm_provider", "mcp_namespaced_tool_name", "endpoint"); +CREATE UNIQUE INDEX IF NOT EXISTS "LiteLLM_DailyAgentSpend_agent_id_date_api_key_model_custom__key" ON "LiteLLM_DailyAgentSpend"("agent_id", "date", "api_key", "model", "custom_llm_provider", "mcp_namespaced_tool_name", "endpoint"); -- CreateIndex -CREATE INDEX "LiteLLM_DailyEndUserSpend_endpoint_idx" ON "LiteLLM_DailyEndUserSpend"("endpoint"); +CREATE INDEX IF NOT EXISTS "LiteLLM_DailyEndUserSpend_endpoint_idx" ON "LiteLLM_DailyEndUserSpend"("endpoint"); -- CreateIndex -CREATE UNIQUE INDEX "LiteLLM_DailyEndUserSpend_end_user_id_date_api_key_model_cu_key" ON "LiteLLM_DailyEndUserSpend"("end_user_id", "date", "api_key", "model", "custom_llm_provider", "mcp_namespaced_tool_name", "endpoint"); +CREATE UNIQUE INDEX IF NOT EXISTS "LiteLLM_DailyEndUserSpend_end_user_id_date_api_key_model_cu_key" ON "LiteLLM_DailyEndUserSpend"("end_user_id", "date", "api_key", "model", "custom_llm_provider", "mcp_namespaced_tool_name", "endpoint"); -- CreateIndex -CREATE INDEX "LiteLLM_DailyOrganizationSpend_endpoint_idx" ON "LiteLLM_DailyOrganizationSpend"("endpoint"); +CREATE INDEX IF NOT EXISTS "LiteLLM_DailyOrganizationSpend_endpoint_idx" ON "LiteLLM_DailyOrganizationSpend"("endpoint"); -- CreateIndex -CREATE UNIQUE INDEX "LiteLLM_DailyOrganizationSpend_organization_id_date_api_key_key" ON "LiteLLM_DailyOrganizationSpend"("organization_id", "date", "api_key", "model", "custom_llm_provider", "mcp_namespaced_tool_name", "endpoint"); +CREATE UNIQUE INDEX IF NOT EXISTS "LiteLLM_DailyOrganizationSpend_organization_id_date_api_key_key" ON "LiteLLM_DailyOrganizationSpend"("organization_id", "date", "api_key", "model", "custom_llm_provider", "mcp_namespaced_tool_name", "endpoint"); -- CreateIndex -CREATE INDEX "LiteLLM_DailyTagSpend_endpoint_idx" ON "LiteLLM_DailyTagSpend"("endpoint"); +CREATE INDEX IF NOT EXISTS "LiteLLM_DailyTagSpend_endpoint_idx" ON "LiteLLM_DailyTagSpend"("endpoint"); -- CreateIndex -CREATE UNIQUE INDEX "LiteLLM_DailyTagSpend_tag_date_api_key_model_custom_llm_pro_key" ON "LiteLLM_DailyTagSpend"("tag", "date", "api_key", "model", "custom_llm_provider", "mcp_namespaced_tool_name", "endpoint"); +CREATE UNIQUE INDEX IF NOT EXISTS "LiteLLM_DailyTagSpend_tag_date_api_key_model_custom_llm_pro_key" ON "LiteLLM_DailyTagSpend"("tag", "date", "api_key", "model", "custom_llm_provider", "mcp_namespaced_tool_name", "endpoint"); -- CreateIndex -CREATE INDEX "LiteLLM_DailyTeamSpend_endpoint_idx" ON "LiteLLM_DailyTeamSpend"("endpoint"); +CREATE INDEX IF NOT EXISTS "LiteLLM_DailyTeamSpend_endpoint_idx" ON "LiteLLM_DailyTeamSpend"("endpoint"); -- CreateIndex -CREATE UNIQUE INDEX "LiteLLM_DailyTeamSpend_team_id_date_api_key_model_custom_ll_key" ON "LiteLLM_DailyTeamSpend"("team_id", "date", "api_key", "model", "custom_llm_provider", "mcp_namespaced_tool_name", "endpoint"); +CREATE UNIQUE INDEX IF NOT EXISTS "LiteLLM_DailyTeamSpend_team_id_date_api_key_model_custom_ll_key" ON "LiteLLM_DailyTeamSpend"("team_id", "date", "api_key", "model", "custom_llm_provider", "mcp_namespaced_tool_name", "endpoint"); -- CreateIndex -CREATE INDEX "LiteLLM_DailyUserSpend_endpoint_idx" ON "LiteLLM_DailyUserSpend"("endpoint"); +CREATE INDEX IF NOT EXISTS "LiteLLM_DailyUserSpend_endpoint_idx" ON "LiteLLM_DailyUserSpend"("endpoint"); -- CreateIndex -CREATE UNIQUE INDEX "LiteLLM_DailyUserSpend_user_id_date_api_key_model_custom_ll_key" ON "LiteLLM_DailyUserSpend"("user_id", "date", "api_key", "model", "custom_llm_provider", "mcp_namespaced_tool_name", "endpoint"); +CREATE UNIQUE INDEX IF NOT EXISTS "LiteLLM_DailyUserSpend_user_id_date_api_key_model_custom_ll_key" ON "LiteLLM_DailyUserSpend"("user_id", "date", "api_key", "model", "custom_llm_provider", "mcp_namespaced_tool_name", "endpoint"); diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260107111013_add_router_settings_to_keys_teams/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260107111013_add_router_settings_to_keys_teams/migration.sql index 9556695011..07cf2f95f9 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260107111013_add_router_settings_to_keys_teams/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260107111013_add_router_settings_to_keys_teams/migration.sql @@ -1,6 +1,6 @@ -- AlterTable -ALTER TABLE "LiteLLM_TeamTable" ADD COLUMN "router_settings" JSONB DEFAULT '{}'; +ALTER TABLE "LiteLLM_TeamTable" ADD COLUMN IF NOT EXISTS "router_settings" JSONB DEFAULT '{}'; -- AlterTable -ALTER TABLE "LiteLLM_VerificationToken" ADD COLUMN "router_settings" JSONB DEFAULT '{}'; +ALTER TABLE "LiteLLM_VerificationToken" ADD COLUMN IF NOT EXISTS "router_settings" JSONB DEFAULT '{}'; diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260108_add_user_email_lower_idx/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260108_add_user_email_lower_idx/migration.sql index add80b39e7..561c36530d 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260108_add_user_email_lower_idx/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260108_add_user_email_lower_idx/migration.sql @@ -6,4 +6,4 @@ -- With this index, PostgreSQL can use an Index Scan for O(log n) performance. -- -- Related: GitHub Issue #18411 -CREATE INDEX "LiteLLM_UserTable_user_email_lower_idx" ON "LiteLLM_UserTable"(LOWER("user_email")); +CREATE INDEX IF NOT EXISTS "LiteLLM_UserTable_user_email_lower_idx" ON "LiteLLM_UserTable"(LOWER("user_email")); diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260116142756_update_deleted_keys_teams_table_routing_settings/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260116142756_update_deleted_keys_teams_table_routing_settings/migration.sql index 9426bed0da..b948ffcad6 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260116142756_update_deleted_keys_teams_table_routing_settings/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260116142756_update_deleted_keys_teams_table_routing_settings/migration.sql @@ -1,6 +1,6 @@ -- AlterTable -ALTER TABLE "LiteLLM_DeletedTeamTable" ADD COLUMN "router_settings" JSONB DEFAULT '{}'; +ALTER TABLE "LiteLLM_DeletedTeamTable" ADD COLUMN IF NOT EXISTS "router_settings" JSONB DEFAULT '{}'; -- AlterTable -ALTER TABLE "LiteLLM_DeletedVerificationToken" ADD COLUMN "router_settings" JSONB DEFAULT '{}'; +ALTER TABLE "LiteLLM_DeletedVerificationToken" ADD COLUMN IF NOT EXISTS "router_settings" JSONB DEFAULT '{}'; diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260123131407_add_policy_tables_and_policies_field/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260123131407_add_policy_tables_and_policies_field/migration.sql index 595d8f4a0c..8b6ac7a7f3 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260123131407_add_policy_tables_and_policies_field/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260123131407_add_policy_tables_and_policies_field/migration.sql @@ -1,20 +1,20 @@ -- AlterTable -ALTER TABLE "LiteLLM_DeletedTeamTable" ADD COLUMN "policies" TEXT[] DEFAULT ARRAY[]::TEXT[]; +ALTER TABLE "LiteLLM_DeletedTeamTable" ADD COLUMN IF NOT EXISTS "policies" TEXT[] DEFAULT ARRAY[]::TEXT[]; -- AlterTable -ALTER TABLE "LiteLLM_DeletedVerificationToken" ADD COLUMN "policies" TEXT[] DEFAULT ARRAY[]::TEXT[]; +ALTER TABLE "LiteLLM_DeletedVerificationToken" ADD COLUMN IF NOT EXISTS "policies" TEXT[] DEFAULT ARRAY[]::TEXT[]; -- AlterTable -ALTER TABLE "LiteLLM_TeamTable" ADD COLUMN "policies" TEXT[] DEFAULT ARRAY[]::TEXT[]; +ALTER TABLE "LiteLLM_TeamTable" ADD COLUMN IF NOT EXISTS "policies" TEXT[] DEFAULT ARRAY[]::TEXT[]; -- AlterTable -ALTER TABLE "LiteLLM_UserTable" ADD COLUMN "policies" TEXT[] DEFAULT ARRAY[]::TEXT[]; +ALTER TABLE "LiteLLM_UserTable" ADD COLUMN IF NOT EXISTS "policies" TEXT[] DEFAULT ARRAY[]::TEXT[]; -- AlterTable -ALTER TABLE "LiteLLM_VerificationToken" ADD COLUMN "policies" TEXT[] DEFAULT ARRAY[]::TEXT[]; +ALTER TABLE "LiteLLM_VerificationToken" ADD COLUMN IF NOT EXISTS "policies" TEXT[] DEFAULT ARRAY[]::TEXT[]; -- CreateTable -CREATE TABLE "LiteLLM_PolicyTable" ( +CREATE TABLE IF NOT EXISTS "LiteLLM_PolicyTable" ( "policy_id" TEXT NOT NULL, "policy_name" TEXT NOT NULL, "inherit" TEXT, @@ -31,7 +31,7 @@ CREATE TABLE "LiteLLM_PolicyTable" ( ); -- CreateTable -CREATE TABLE "LiteLLM_PolicyAttachmentTable" ( +CREATE TABLE IF NOT EXISTS "LiteLLM_PolicyAttachmentTable" ( "attachment_id" TEXT NOT NULL, "policy_name" TEXT NOT NULL, "scope" TEXT, @@ -47,5 +47,5 @@ CREATE TABLE "LiteLLM_PolicyAttachmentTable" ( ); -- CreateIndex -CREATE UNIQUE INDEX "LiteLLM_PolicyTable_policy_name_key" ON "LiteLLM_PolicyTable"("policy_name"); +CREATE UNIQUE INDEX IF NOT EXISTS "LiteLLM_PolicyTable_policy_name_key" ON "LiteLLM_PolicyTable"("policy_name"); diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260203120000_add_deprecated_verification_token_table/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260203120000_add_deprecated_verification_token_table/migration.sql index 51d8844419..58b2d4048c 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260203120000_add_deprecated_verification_token_table/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260203120000_add_deprecated_verification_token_table/migration.sql @@ -1,5 +1,5 @@ -- CreateTable -CREATE TABLE "LiteLLM_DeprecatedVerificationToken" ( +CREATE TABLE IF NOT EXISTS "LiteLLM_DeprecatedVerificationToken" ( "id" TEXT NOT NULL, "token" TEXT NOT NULL, "active_token_id" TEXT NOT NULL, @@ -10,10 +10,10 @@ CREATE TABLE "LiteLLM_DeprecatedVerificationToken" ( ); -- CreateIndex -CREATE UNIQUE INDEX "LiteLLM_DeprecatedVerificationToken_token_key" ON "LiteLLM_DeprecatedVerificationToken"("token"); +CREATE UNIQUE INDEX IF NOT EXISTS "LiteLLM_DeprecatedVerificationToken_token_key" ON "LiteLLM_DeprecatedVerificationToken"("token"); -- CreateIndex -CREATE INDEX "LiteLLM_DeprecatedVerificationToken_token_revoke_at_idx" ON "LiteLLM_DeprecatedVerificationToken"("token", "revoke_at"); +CREATE INDEX IF NOT EXISTS "LiteLLM_DeprecatedVerificationToken_token_revoke_at_idx" ON "LiteLLM_DeprecatedVerificationToken"("token", "revoke_at"); -- CreateIndex -CREATE INDEX "LiteLLM_DeprecatedVerificationToken_revoke_at_idx" ON "LiteLLM_DeprecatedVerificationToken"("revoke_at"); +CREATE INDEX IF NOT EXISTS "LiteLLM_DeprecatedVerificationToken_revoke_at_idx" ON "LiteLLM_DeprecatedVerificationToken"("revoke_at"); diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260205091235_allow_team_guardrail_config/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260205091235_allow_team_guardrail_config/migration.sql index 000b96b3b8..53ef243f7d 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260205091235_allow_team_guardrail_config/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260205091235_allow_team_guardrail_config/migration.sql @@ -1,6 +1,6 @@ -- AlterTable -ALTER TABLE "LiteLLM_DeletedTeamTable" ADD COLUMN "allow_team_guardrail_config" BOOLEAN NOT NULL DEFAULT false; +ALTER TABLE "LiteLLM_DeletedTeamTable" ADD COLUMN IF NOT EXISTS "allow_team_guardrail_config" BOOLEAN NOT NULL DEFAULT false; -- AlterTable -ALTER TABLE "LiteLLM_TeamTable" ADD COLUMN "allow_team_guardrail_config" BOOLEAN NOT NULL DEFAULT false; +ALTER TABLE "LiteLLM_TeamTable" ADD COLUMN IF NOT EXISTS "allow_team_guardrail_config" BOOLEAN NOT NULL DEFAULT false; diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260205144610_add_soft_budget_to_team_table/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260205144610_add_soft_budget_to_team_table/migration.sql index a64f1de342..6a3c3aa66d 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260205144610_add_soft_budget_to_team_table/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260205144610_add_soft_budget_to_team_table/migration.sql @@ -1,3 +1,3 @@ -- AlterTable -ALTER TABLE "LiteLLM_TeamTable" ADD COLUMN "soft_budget" DOUBLE PRECISION; +ALTER TABLE "LiteLLM_TeamTable" ADD COLUMN IF NOT EXISTS "soft_budget" DOUBLE PRECISION; diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260207093506_add_available_on_public_internet_to_mcp_servers/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260207093506_add_available_on_public_internet_to_mcp_servers/migration.sql index 1efde3dbe0..9b969c1e3b 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260207093506_add_available_on_public_internet_to_mcp_servers/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260207093506_add_available_on_public_internet_to_mcp_servers/migration.sql @@ -1,3 +1,3 @@ -- AlterTable -ALTER TABLE "LiteLLM_MCPServerTable" ADD COLUMN "available_on_public_internet" BOOLEAN NOT NULL DEFAULT false; +ALTER TABLE "LiteLLM_MCPServerTable" ADD COLUMN IF NOT EXISTS "available_on_public_internet" BOOLEAN NOT NULL DEFAULT false; diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260207110613_add_soft_budget_to_deleted_teams_table/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260207110613_add_soft_budget_to_deleted_teams_table/migration.sql index abfb153061..229032e2b1 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260207110613_add_soft_budget_to_deleted_teams_table/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260207110613_add_soft_budget_to_deleted_teams_table/migration.sql @@ -1,3 +1,3 @@ -- AlterTable -ALTER TABLE "LiteLLM_DeletedTeamTable" ADD COLUMN "soft_budget" DOUBLE PRECISION; +ALTER TABLE "LiteLLM_DeletedTeamTable" ADD COLUMN IF NOT EXISTS "soft_budget" DOUBLE PRECISION; diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260209085821_add_verificationtoken_indexes/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260209085821_add_verificationtoken_indexes/migration.sql index 572eea9b52..92baf0d25e 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260209085821_add_verificationtoken_indexes/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260209085821_add_verificationtoken_indexes/migration.sql @@ -1,8 +1,8 @@ -- CreateIndex -CREATE INDEX "LiteLLM_VerificationToken_user_id_team_id_idx" ON "LiteLLM_VerificationToken"("user_id", "team_id"); +CREATE INDEX IF NOT EXISTS "LiteLLM_VerificationToken_user_id_team_id_idx" ON "LiteLLM_VerificationToken"("user_id", "team_id"); -- CreateIndex -CREATE INDEX "LiteLLM_VerificationToken_team_id_idx" ON "LiteLLM_VerificationToken"("team_id"); +CREATE INDEX IF NOT EXISTS "LiteLLM_VerificationToken_team_id_idx" ON "LiteLLM_VerificationToken"("team_id"); -- CreateIndex -CREATE INDEX "LiteLLM_VerificationToken_budget_reset_at_expires_idx" ON "LiteLLM_VerificationToken"("budget_reset_at", "expires"); +CREATE INDEX IF NOT EXISTS "LiteLLM_VerificationToken_budget_reset_at_expires_idx" ON "LiteLLM_VerificationToken"("budget_reset_at", "expires"); diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260212103349_adjust_tags_policy_table/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260212103349_adjust_tags_policy_table/migration.sql index f3a0821d37..de03c010bf 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260212103349_adjust_tags_policy_table/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260212103349_adjust_tags_policy_table/migration.sql @@ -1,3 +1,3 @@ -- AlterTable -ALTER TABLE "LiteLLM_PolicyAttachmentTable" ADD COLUMN "tags" TEXT[] DEFAULT ARRAY[]::TEXT[]; +ALTER TABLE "LiteLLM_PolicyAttachmentTable" ADD COLUMN IF NOT EXISTS "tags" TEXT[] DEFAULT ARRAY[]::TEXT[]; diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260212143306_add_access_group_table/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260212143306_add_access_group_table/migration.sql index 67e75e84c4..b3ae05e202 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260212143306_add_access_group_table/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260212143306_add_access_group_table/migration.sql @@ -1,17 +1,17 @@ -- AlterTable -ALTER TABLE "LiteLLM_DeletedTeamTable" ADD COLUMN "access_group_ids" TEXT[] DEFAULT ARRAY[]::TEXT[]; +ALTER TABLE "LiteLLM_DeletedTeamTable" ADD COLUMN IF NOT EXISTS "access_group_ids" TEXT[] DEFAULT ARRAY[]::TEXT[]; -- AlterTable -ALTER TABLE "LiteLLM_DeletedVerificationToken" ADD COLUMN "access_group_ids" TEXT[] DEFAULT ARRAY[]::TEXT[]; +ALTER TABLE "LiteLLM_DeletedVerificationToken" ADD COLUMN IF NOT EXISTS "access_group_ids" TEXT[] DEFAULT ARRAY[]::TEXT[]; -- AlterTable -ALTER TABLE "LiteLLM_TeamTable" ADD COLUMN "access_group_ids" TEXT[] DEFAULT ARRAY[]::TEXT[]; +ALTER TABLE "LiteLLM_TeamTable" ADD COLUMN IF NOT EXISTS "access_group_ids" TEXT[] DEFAULT ARRAY[]::TEXT[]; -- AlterTable -ALTER TABLE "LiteLLM_VerificationToken" ADD COLUMN "access_group_ids" TEXT[] DEFAULT ARRAY[]::TEXT[]; +ALTER TABLE "LiteLLM_VerificationToken" ADD COLUMN IF NOT EXISTS "access_group_ids" TEXT[] DEFAULT ARRAY[]::TEXT[]; -- CreateTable -CREATE TABLE "LiteLLM_AccessGroupTable" ( +CREATE TABLE IF NOT EXISTS "LiteLLM_AccessGroupTable" ( "access_group_id" TEXT NOT NULL, "access_group_name" TEXT NOT NULL, "description" TEXT, @@ -29,5 +29,5 @@ CREATE TABLE "LiteLLM_AccessGroupTable" ( ); -- CreateIndex -CREATE UNIQUE INDEX "LiteLLM_AccessGroupTable_access_group_name_key" ON "LiteLLM_AccessGroupTable"("access_group_name"); +CREATE UNIQUE INDEX IF NOT EXISTS "LiteLLM_AccessGroupTable_access_group_name_key" ON "LiteLLM_AccessGroupTable"("access_group_name"); diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260213105436_add_managed_vector_store_table/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260213105436_add_managed_vector_store_table/migration.sql index 0835875220..eb3dd90602 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260213105436_add_managed_vector_store_table/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260213105436_add_managed_vector_store_table/migration.sql @@ -1,5 +1,5 @@ -- CreateTable -CREATE TABLE "LiteLLM_ManagedVectorStoreTable" ( +CREATE TABLE IF NOT EXISTS "LiteLLM_ManagedVectorStoreTable" ( "id" TEXT NOT NULL, "unified_resource_id" TEXT NOT NULL, "resource_object" JSONB, @@ -16,7 +16,7 @@ CREATE TABLE "LiteLLM_ManagedVectorStoreTable" ( ); -- CreateIndex -CREATE UNIQUE INDEX "LiteLLM_ManagedVectorStoreTable_unified_resource_id_key" ON "LiteLLM_ManagedVectorStoreTable"("unified_resource_id"); +CREATE UNIQUE INDEX IF NOT EXISTS "LiteLLM_ManagedVectorStoreTable_unified_resource_id_key" ON "LiteLLM_ManagedVectorStoreTable"("unified_resource_id"); -- CreateIndex -CREATE INDEX "LiteLLM_ManagedVectorStoreTable_unified_resource_id_idx" ON "LiteLLM_ManagedVectorStoreTable"("unified_resource_id"); +CREATE INDEX IF NOT EXISTS "LiteLLM_ManagedVectorStoreTable_unified_resource_id_idx" ON "LiteLLM_ManagedVectorStoreTable"("unified_resource_id"); diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260213170952_access_group_change_to_model_name/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260213170952_access_group_change_to_model_name/migration.sql index c940d3aca8..921bee9775 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260213170952_access_group_change_to_model_name/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260213170952_access_group_change_to_model_name/migration.sql @@ -1,3 +1,3 @@ -- AlterTable -ALTER TABLE "LiteLLM_AccessGroupTable" DROP COLUMN "access_model_ids", -ADD COLUMN "access_model_names" TEXT[] DEFAULT ARRAY[]::TEXT[]; +ALTER TABLE "LiteLLM_AccessGroupTable" DROP COLUMN IF EXISTS "access_model_ids", +ADD COLUMN IF NOT EXISTS "access_model_names" TEXT[] DEFAULT ARRAY[]::TEXT[]; diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260214094754_schema_sync/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260214094754_schema_sync/migration.sql index b5d5b97858..31e4320bb1 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260214094754_schema_sync/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260214094754_schema_sync/migration.sql @@ -1,3 +1,3 @@ -- AlterTable -ALTER TABLE "LiteLLM_GuardrailsTable" ADD COLUMN "team_id" TEXT; +ALTER TABLE "LiteLLM_GuardrailsTable" ADD COLUMN IF NOT EXISTS "team_id" TEXT; diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260214163027_add_pipeline_to_policy_table/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260214163027_add_pipeline_to_policy_table/migration.sql index e57b9ef29c..bb121466c9 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260214163027_add_pipeline_to_policy_table/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260214163027_add_pipeline_to_policy_table/migration.sql @@ -1,3 +1,3 @@ -- AlterTable -ALTER TABLE "LiteLLM_PolicyTable" ADD COLUMN "pipeline" JSONB; +ALTER TABLE "LiteLLM_PolicyTable" ADD COLUMN IF NOT EXISTS "pipeline" JSONB; diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260214185341_object_permissions_for_end_users/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260214185341_object_permissions_for_end_users/migration.sql index 5c5dc6fd6f..4b909471e0 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260214185341_object_permissions_for_end_users/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260214185341_object_permissions_for_end_users/migration.sql @@ -1,6 +1,11 @@ -- AlterTable -ALTER TABLE "LiteLLM_EndUserTable" ADD COLUMN "object_permission_id" TEXT; +ALTER TABLE "LiteLLM_EndUserTable" ADD COLUMN IF NOT EXISTS "object_permission_id" TEXT; -- AddForeignKey -ALTER TABLE "LiteLLM_EndUserTable" ADD CONSTRAINT "LiteLLM_EndUserTable_object_permission_id_fkey" FOREIGN KEY ("object_permission_id") REFERENCES "LiteLLM_ObjectPermissionTable"("object_permission_id") ON DELETE SET NULL ON UPDATE CASCADE; +DO $$ +BEGIN + IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'LiteLLM_EndUserTable_object_permission_id_fkey') THEN + ALTER TABLE "LiteLLM_EndUserTable" ADD CONSTRAINT "LiteLLM_EndUserTable_object_permission_id_fkey" FOREIGN KEY ("object_permission_id") REFERENCES "LiteLLM_ObjectPermissionTable"("object_permission_id") ON DELETE SET NULL ON UPDATE CASCADE; + END IF; +END $$; diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260218231534_add_last_active_to_key_table/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260218231534_add_last_active_to_key_table/migration.sql index ded1856059..bfd50fe33b 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260218231534_add_last_active_to_key_table/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260218231534_add_last_active_to_key_table/migration.sql @@ -1,6 +1,6 @@ -- AlterTable -ALTER TABLE "LiteLLM_DeletedVerificationToken" ADD COLUMN "last_active" TIMESTAMP(3); +ALTER TABLE "LiteLLM_DeletedVerificationToken" ADD COLUMN IF NOT EXISTS "last_active" TIMESTAMP(3); -- AlterTable -ALTER TABLE "LiteLLM_VerificationToken" ADD COLUMN "last_active" TIMESTAMP(3); +ALTER TABLE "LiteLLM_VerificationToken" ADD COLUMN IF NOT EXISTS "last_active" TIMESTAMP(3); diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260219105005_add_project_id_to_deleted_keys/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260219105005_add_project_id_to_deleted_keys/migration.sql index 59bdc86adb..ef1ae25856 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260219105005_add_project_id_to_deleted_keys/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260219105005_add_project_id_to_deleted_keys/migration.sql @@ -1,3 +1,3 @@ -- AlterTable -ALTER TABLE "LiteLLM_DeletedVerificationToken" ADD COLUMN "project_id" TEXT; +ALTER TABLE "LiteLLM_DeletedVerificationToken" ADD COLUMN IF NOT EXISTS "project_id" TEXT; diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260219181415_baseline_diff/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260219181415_baseline_diff/migration.sql index dd95d9d84a..13be156db8 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260219181415_baseline_diff/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260219181415_baseline_diff/migration.sql @@ -1,5 +1,5 @@ -- CreateTable -CREATE TABLE "LiteLLM_DailyGuardrailMetrics" ( +CREATE TABLE IF NOT EXISTS "LiteLLM_DailyGuardrailMetrics" ( "guardrail_id" TEXT NOT NULL, "date" TEXT NOT NULL, "requests_evaluated" BIGINT NOT NULL DEFAULT 0, @@ -15,7 +15,7 @@ CREATE TABLE "LiteLLM_DailyGuardrailMetrics" ( ); -- CreateTable -CREATE TABLE "LiteLLM_DailyPolicyMetrics" ( +CREATE TABLE IF NOT EXISTS "LiteLLM_DailyPolicyMetrics" ( "policy_id" TEXT NOT NULL, "date" TEXT NOT NULL, "requests_evaluated" BIGINT NOT NULL DEFAULT 0, @@ -31,7 +31,7 @@ CREATE TABLE "LiteLLM_DailyPolicyMetrics" ( ); -- CreateTable -CREATE TABLE "LiteLLM_SpendLogGuardrailIndex" ( +CREATE TABLE IF NOT EXISTS "LiteLLM_SpendLogGuardrailIndex" ( "request_id" TEXT NOT NULL, "guardrail_id" TEXT NOT NULL, "policy_id" TEXT, @@ -41,20 +41,20 @@ CREATE TABLE "LiteLLM_SpendLogGuardrailIndex" ( ); -- CreateIndex -CREATE INDEX "LiteLLM_DailyGuardrailMetrics_date_idx" ON "LiteLLM_DailyGuardrailMetrics"("date"); +CREATE INDEX IF NOT EXISTS "LiteLLM_DailyGuardrailMetrics_date_idx" ON "LiteLLM_DailyGuardrailMetrics"("date"); -- CreateIndex -CREATE INDEX "LiteLLM_DailyGuardrailMetrics_guardrail_id_idx" ON "LiteLLM_DailyGuardrailMetrics"("guardrail_id"); +CREATE INDEX IF NOT EXISTS "LiteLLM_DailyGuardrailMetrics_guardrail_id_idx" ON "LiteLLM_DailyGuardrailMetrics"("guardrail_id"); -- CreateIndex -CREATE INDEX "LiteLLM_DailyPolicyMetrics_date_idx" ON "LiteLLM_DailyPolicyMetrics"("date"); +CREATE INDEX IF NOT EXISTS "LiteLLM_DailyPolicyMetrics_date_idx" ON "LiteLLM_DailyPolicyMetrics"("date"); -- CreateIndex -CREATE INDEX "LiteLLM_DailyPolicyMetrics_policy_id_idx" ON "LiteLLM_DailyPolicyMetrics"("policy_id"); +CREATE INDEX IF NOT EXISTS "LiteLLM_DailyPolicyMetrics_policy_id_idx" ON "LiteLLM_DailyPolicyMetrics"("policy_id"); -- CreateIndex -CREATE INDEX "LiteLLM_SpendLogGuardrailIndex_guardrail_id_start_time_idx" ON "LiteLLM_SpendLogGuardrailIndex"("guardrail_id", "start_time"); +CREATE INDEX IF NOT EXISTS "LiteLLM_SpendLogGuardrailIndex_guardrail_id_start_time_idx" ON "LiteLLM_SpendLogGuardrailIndex"("guardrail_id", "start_time"); -- CreateIndex -CREATE INDEX "LiteLLM_SpendLogGuardrailIndex_policy_id_start_time_idx" ON "LiteLLM_SpendLogGuardrailIndex"("policy_id", "start_time"); +CREATE INDEX IF NOT EXISTS "LiteLLM_SpendLogGuardrailIndex_policy_id_start_time_idx" ON "LiteLLM_SpendLogGuardrailIndex"("policy_id", "start_time"); diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260220124742_add_spec_path_to_mcp_servers/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260220124742_add_spec_path_to_mcp_servers/migration.sql index 4f4e72a879..55c12d9476 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260220124742_add_spec_path_to_mcp_servers/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260220124742_add_spec_path_to_mcp_servers/migration.sql @@ -1,2 +1,2 @@ -- AlterTable -ALTER TABLE "LiteLLM_MCPServerTable" ADD COLUMN "spec_path" TEXT; +ALTER TABLE "LiteLLM_MCPServerTable" ADD COLUMN IF NOT EXISTS "spec_path" TEXT; diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260220153844_add_composite_index_aggregate_tables/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260220153844_add_composite_index_aggregate_tables/migration.sql index a10f123b02..a95a3c5c9c 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260220153844_add_composite_index_aggregate_tables/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260220153844_add_composite_index_aggregate_tables/migration.sql @@ -1,36 +1,36 @@ -- DropIndex -DROP INDEX "LiteLLM_DailyAgentSpend_agent_id_idx"; +DROP INDEX IF EXISTS "LiteLLM_DailyAgentSpend_agent_id_idx"; -- DropIndex -DROP INDEX "LiteLLM_DailyEndUserSpend_end_user_id_idx"; +DROP INDEX IF EXISTS "LiteLLM_DailyEndUserSpend_end_user_id_idx"; -- DropIndex -DROP INDEX "LiteLLM_DailyOrganizationSpend_organization_id_idx"; +DROP INDEX IF EXISTS "LiteLLM_DailyOrganizationSpend_organization_id_idx"; -- DropIndex -DROP INDEX "LiteLLM_DailyTagSpend_tag_idx"; +DROP INDEX IF EXISTS "LiteLLM_DailyTagSpend_tag_idx"; -- DropIndex -DROP INDEX "LiteLLM_DailyTeamSpend_team_id_idx"; +DROP INDEX IF EXISTS "LiteLLM_DailyTeamSpend_team_id_idx"; -- DropIndex -DROP INDEX "LiteLLM_DailyUserSpend_user_id_idx"; +DROP INDEX IF EXISTS "LiteLLM_DailyUserSpend_user_id_idx"; -- CreateIndex -CREATE INDEX "LiteLLM_DailyAgentSpend_agent_id_date_idx" ON "LiteLLM_DailyAgentSpend"("agent_id", "date"); +CREATE INDEX IF NOT EXISTS "LiteLLM_DailyAgentSpend_agent_id_date_idx" ON "LiteLLM_DailyAgentSpend"("agent_id", "date"); -- CreateIndex -CREATE INDEX "LiteLLM_DailyEndUserSpend_end_user_id_date_idx" ON "LiteLLM_DailyEndUserSpend"("end_user_id", "date"); +CREATE INDEX IF NOT EXISTS "LiteLLM_DailyEndUserSpend_end_user_id_date_idx" ON "LiteLLM_DailyEndUserSpend"("end_user_id", "date"); -- CreateIndex -CREATE INDEX "LiteLLM_DailyOrganizationSpend_organization_id_date_idx" ON "LiteLLM_DailyOrganizationSpend"("organization_id", "date"); +CREATE INDEX IF NOT EXISTS "LiteLLM_DailyOrganizationSpend_organization_id_date_idx" ON "LiteLLM_DailyOrganizationSpend"("organization_id", "date"); -- CreateIndex -CREATE INDEX "LiteLLM_DailyTagSpend_tag_date_idx" ON "LiteLLM_DailyTagSpend"("tag", "date"); +CREATE INDEX IF NOT EXISTS "LiteLLM_DailyTagSpend_tag_date_idx" ON "LiteLLM_DailyTagSpend"("tag", "date"); -- CreateIndex -CREATE INDEX "LiteLLM_DailyTeamSpend_team_id_date_idx" ON "LiteLLM_DailyTeamSpend"("team_id", "date"); +CREATE INDEX IF NOT EXISTS "LiteLLM_DailyTeamSpend_team_id_date_idx" ON "LiteLLM_DailyTeamSpend"("team_id", "date"); -- CreateIndex -CREATE INDEX "LiteLLM_DailyUserSpend_user_id_date_idx" ON "LiteLLM_DailyUserSpend"("user_id", "date"); +CREATE INDEX IF NOT EXISTS "LiteLLM_DailyUserSpend_user_id_date_idx" ON "LiteLLM_DailyUserSpend"("user_id", "date"); diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260221183800_add_policy_versioning/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260221183800_add_policy_versioning/migration.sql index 087c5ecc01..67647da66b 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260221183800_add_policy_versioning/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260221183800_add_policy_versioning/migration.sql @@ -1,17 +1,17 @@ -- DropIndex -DROP INDEX "LiteLLM_PolicyTable_policy_name_key"; +DROP INDEX IF EXISTS "LiteLLM_PolicyTable_policy_name_key"; -- AlterTable -ALTER TABLE "LiteLLM_PolicyTable" ADD COLUMN "is_latest" BOOLEAN NOT NULL DEFAULT true, -ADD COLUMN "parent_version_id" TEXT, -ADD COLUMN "production_at" TIMESTAMP(3), -ADD COLUMN "published_at" TIMESTAMP(3), -ADD COLUMN "version_number" INTEGER NOT NULL DEFAULT 1, -ADD COLUMN "version_status" TEXT NOT NULL DEFAULT 'production'; +ALTER TABLE "LiteLLM_PolicyTable" ADD COLUMN IF NOT EXISTS "is_latest" BOOLEAN NOT NULL DEFAULT true, +ADD COLUMN IF NOT EXISTS "parent_version_id" TEXT, +ADD COLUMN IF NOT EXISTS "production_at" TIMESTAMP(3), +ADD COLUMN IF NOT EXISTS "published_at" TIMESTAMP(3), +ADD COLUMN IF NOT EXISTS "version_number" INTEGER NOT NULL DEFAULT 1, +ADD COLUMN IF NOT EXISTS "version_status" TEXT NOT NULL DEFAULT 'production'; -- CreateIndex -CREATE INDEX "LiteLLM_PolicyTable_policy_name_version_status_idx" ON "LiteLLM_PolicyTable"("policy_name", "version_status"); +CREATE INDEX IF NOT EXISTS "LiteLLM_PolicyTable_policy_name_version_status_idx" ON "LiteLLM_PolicyTable"("policy_name", "version_status"); -- CreateIndex -CREATE UNIQUE INDEX "LiteLLM_PolicyTable_policy_name_version_number_key" ON "LiteLLM_PolicyTable"("policy_name", "version_number"); +CREATE UNIQUE INDEX IF NOT EXISTS "LiteLLM_PolicyTable_policy_name_version_number_key" ON "LiteLLM_PolicyTable"("policy_name", "version_number"); diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260222000000_add_batch_processed_to_managed_object_table/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260222000000_add_batch_processed_to_managed_object_table/migration.sql index ac390d164d..361a4705e6 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260222000000_add_batch_processed_to_managed_object_table/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260222000000_add_batch_processed_to_managed_object_table/migration.sql @@ -1,3 +1,3 @@ -- Add batch_processed column to LiteLLM_ManagedObjectTable -- Set to true by CheckBatchCost after cost has been computed for a completed batch -ALTER TABLE "LiteLLM_ManagedObjectTable" ADD COLUMN "batch_processed" BOOLEAN NOT NULL DEFAULT false; +ALTER TABLE "LiteLLM_ManagedObjectTable" ADD COLUMN IF NOT EXISTS "batch_processed" BOOLEAN NOT NULL DEFAULT false; diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260224201417_spend_logs_request_duration/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260224201417_spend_logs_request_duration/migration.sql index 892aa59e9f..aa0237eae1 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260224201417_spend_logs_request_duration/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260224201417_spend_logs_request_duration/migration.sql @@ -1,3 +1,3 @@ -- AlterTable -ALTER TABLE "LiteLLM_SpendLogs" ADD COLUMN "request_duration_ms" INTEGER; +ALTER TABLE "LiteLLM_SpendLogs" ADD COLUMN IF NOT EXISTS "request_duration_ms" INTEGER; diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260224203854_add_agent_object_permissions_table/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260224203854_add_agent_object_permissions_table/migration.sql index 78e364d547..ecfe47a44d 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260224203854_add_agent_object_permissions_table/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260224203854_add_agent_object_permissions_table/migration.sql @@ -1,14 +1,14 @@ -- AlterTable -ALTER TABLE "LiteLLM_AgentsTable" ADD COLUMN "object_permission_id" TEXT; +ALTER TABLE "LiteLLM_AgentsTable" ADD COLUMN IF NOT EXISTS "object_permission_id" TEXT; -- AlterTable -ALTER TABLE "LiteLLM_MCPServerTable" DROP COLUMN "spec_path"; +ALTER TABLE "LiteLLM_MCPServerTable" DROP COLUMN IF EXISTS "spec_path"; -- AlterTable -ALTER TABLE "LiteLLM_VerificationToken" ADD COLUMN "agent_id" TEXT; +ALTER TABLE "LiteLLM_VerificationToken" ADD COLUMN IF NOT EXISTS "agent_id" TEXT; -- CreateTable -CREATE TABLE "LiteLLM_ToolTable" ( +CREATE TABLE IF NOT EXISTS "LiteLLM_ToolTable" ( "tool_id" TEXT NOT NULL, "tool_name" TEXT NOT NULL, "origin" TEXT, @@ -27,14 +27,19 @@ CREATE TABLE "LiteLLM_ToolTable" ( ); -- CreateIndex -CREATE UNIQUE INDEX "LiteLLM_ToolTable_tool_name_key" ON "LiteLLM_ToolTable"("tool_name"); +CREATE UNIQUE INDEX IF NOT EXISTS "LiteLLM_ToolTable_tool_name_key" ON "LiteLLM_ToolTable"("tool_name"); -- CreateIndex -CREATE INDEX "LiteLLM_ToolTable_call_policy_idx" ON "LiteLLM_ToolTable"("call_policy"); +CREATE INDEX IF NOT EXISTS "LiteLLM_ToolTable_call_policy_idx" ON "LiteLLM_ToolTable"("call_policy"); -- CreateIndex -CREATE INDEX "LiteLLM_ToolTable_team_id_idx" ON "LiteLLM_ToolTable"("team_id"); +CREATE INDEX IF NOT EXISTS "LiteLLM_ToolTable_team_id_idx" ON "LiteLLM_ToolTable"("team_id"); -- AddForeignKey -ALTER TABLE "LiteLLM_AgentsTable" ADD CONSTRAINT "LiteLLM_AgentsTable_object_permission_id_fkey" FOREIGN KEY ("object_permission_id") REFERENCES "LiteLLM_ObjectPermissionTable"("object_permission_id") ON DELETE SET NULL ON UPDATE CASCADE; +DO $$ +BEGIN + IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'LiteLLM_AgentsTable_object_permission_id_fkey') THEN + ALTER TABLE "LiteLLM_AgentsTable" ADD CONSTRAINT "LiteLLM_AgentsTable_object_permission_id_fkey" FOREIGN KEY ("object_permission_id") REFERENCES "LiteLLM_ObjectPermissionTable"("object_permission_id") ON DELETE SET NULL ON UPDATE CASCADE; + END IF; +END $$; diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260226000000_add_blocked_tools_to_object_permission/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260226000000_add_blocked_tools_to_object_permission/migration.sql index cba0668419..24724cb18e 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260226000000_add_blocked_tools_to_object_permission/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260226000000_add_blocked_tools_to_object_permission/migration.sql @@ -1,2 +1,2 @@ -- AlterTable -ALTER TABLE "LiteLLM_ObjectPermissionTable" ADD COLUMN "blocked_tools" TEXT[] DEFAULT ARRAY[]::TEXT[]; +ALTER TABLE "LiteLLM_ObjectPermissionTable" ADD COLUMN IF NOT EXISTS "blocked_tools" TEXT[] DEFAULT ARRAY[]::TEXT[]; diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260226120000_add_spend_log_tool_index/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260226120000_add_spend_log_tool_index/migration.sql index e3199679ce..d9c234696c 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260226120000_add_spend_log_tool_index/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260226120000_add_spend_log_tool_index/migration.sql @@ -1,5 +1,5 @@ -- CreateTable -CREATE TABLE "LiteLLM_SpendLogToolIndex" ( +CREATE TABLE IF NOT EXISTS "LiteLLM_SpendLogToolIndex" ( "request_id" TEXT NOT NULL, "tool_name" TEXT NOT NULL, "start_time" TIMESTAMP(3) NOT NULL, @@ -8,4 +8,4 @@ CREATE TABLE "LiteLLM_SpendLogToolIndex" ( ); -- CreateIndex -CREATE INDEX "LiteLLM_SpendLogToolIndex_tool_name_start_time_idx" ON "LiteLLM_SpendLogToolIndex"("tool_name", "start_time"); +CREATE INDEX IF NOT EXISTS "LiteLLM_SpendLogToolIndex_tool_name_start_time_idx" ON "LiteLLM_SpendLogToolIndex"("tool_name", "start_time"); diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260226202727_add_agent_id_to_delete_keys/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260226202727_add_agent_id_to_delete_keys/migration.sql index 594ab9ac1a..a41160dac6 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260226202727_add_agent_id_to_delete_keys/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260226202727_add_agent_id_to_delete_keys/migration.sql @@ -1,3 +1,3 @@ -- AlterTable -ALTER TABLE "LiteLLM_DeletedVerificationToken" ADD COLUMN "agent_id" TEXT; +ALTER TABLE "LiteLLM_DeletedVerificationToken" ADD COLUMN IF NOT EXISTS "agent_id" TEXT; diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260228000000_add_claude_code_plugin_table/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260228000000_add_claude_code_plugin_table/migration.sql index e2a3694e8e..7fa354d9d8 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260228000000_add_claude_code_plugin_table/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260228000000_add_claude_code_plugin_table/migration.sql @@ -1,5 +1,5 @@ -- CreateTable -CREATE TABLE "LiteLLM_ClaudeCodePluginTable" ( +CREATE TABLE IF NOT EXISTS "LiteLLM_ClaudeCodePluginTable" ( "id" TEXT NOT NULL, "name" TEXT NOT NULL, "version" TEXT, @@ -15,4 +15,4 @@ CREATE TABLE "LiteLLM_ClaudeCodePluginTable" ( ); -- CreateIndex -CREATE UNIQUE INDEX "LiteLLM_ClaudeCodePluginTable_name_key" ON "LiteLLM_ClaudeCodePluginTable"("name"); +CREATE UNIQUE INDEX IF NOT EXISTS "LiteLLM_ClaudeCodePluginTable_name_key" ON "LiteLLM_ClaudeCodePluginTable"("name"); diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260228100000_add_spend_logs_composite_index/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260228100000_add_spend_logs_composite_index/migration.sql index b347a8d589..66d792fe38 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260228100000_add_spend_logs_composite_index/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260228100000_add_spend_logs_composite_index/migration.sql @@ -1,2 +1,2 @@ -- CreateIndex -CREATE INDEX "LiteLLM_SpendLogs_startTime_request_id_idx" ON "LiteLLM_SpendLogs"("startTime", "request_id"); +CREATE INDEX IF NOT EXISTS "LiteLLM_SpendLogs_startTime_request_id_idx" ON "LiteLLM_SpendLogs"("startTime", "request_id"); diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260228170127_support_team_based_guardrails/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260228170127_support_team_based_guardrails/migration.sql index 8af167950e..44d079ad19 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260228170127_support_team_based_guardrails/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260228170127_support_team_based_guardrails/migration.sql @@ -1,8 +1,8 @@ -- AlterTable -ALTER TABLE "LiteLLM_GuardrailsTable" ADD COLUMN "reviewed_at" TIMESTAMP(3), -ADD COLUMN "status" TEXT NOT NULL DEFAULT 'active', -ADD COLUMN "submitted_at" TIMESTAMP(3); +ALTER TABLE "LiteLLM_GuardrailsTable" ADD COLUMN IF NOT EXISTS "reviewed_at" TIMESTAMP(3), +ADD COLUMN IF NOT EXISTS "status" TEXT NOT NULL DEFAULT 'active', +ADD COLUMN IF NOT EXISTS "submitted_at" TIMESTAMP(3); -- CreateIndex -CREATE INDEX "LiteLLM_GuardrailsTable_status_idx" ON "LiteLLM_GuardrailsTable"("status"); +CREATE INDEX IF NOT EXISTS "LiteLLM_GuardrailsTable_status_idx" ON "LiteLLM_GuardrailsTable"("status"); diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260303000000_update_tool_table_policies/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260303000000_update_tool_table_policies/migration.sql index 2e2d722ed4..7aa329c6bb 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260303000000_update_tool_table_policies/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260303000000_update_tool_table_policies/migration.sql @@ -1,20 +1,25 @@ --- Rename call_policy to input_policy -ALTER TABLE "LiteLLM_ToolTable" RENAME COLUMN "call_policy" TO "input_policy"; +-- Rename call_policy to input_policy (only if the old name still exists) +DO $$ +BEGIN + IF EXISTS (SELECT 1 FROM information_schema.columns WHERE table_name = 'LiteLLM_ToolTable' AND column_name = 'call_policy') THEN + ALTER TABLE "LiteLLM_ToolTable" RENAME COLUMN "call_policy" TO "input_policy"; + END IF; +END $$; -- Add output_policy column -ALTER TABLE "LiteLLM_ToolTable" ADD COLUMN "output_policy" TEXT NOT NULL DEFAULT 'untrusted'; +ALTER TABLE "LiteLLM_ToolTable" ADD COLUMN IF NOT EXISTS "output_policy" TEXT NOT NULL DEFAULT 'untrusted'; -- Add user_agent column -ALTER TABLE "LiteLLM_ToolTable" ADD COLUMN "user_agent" TEXT; +ALTER TABLE "LiteLLM_ToolTable" ADD COLUMN IF NOT EXISTS "user_agent" TEXT; -- Add last_used_at column -ALTER TABLE "LiteLLM_ToolTable" ADD COLUMN "last_used_at" TIMESTAMP(3); +ALTER TABLE "LiteLLM_ToolTable" ADD COLUMN IF NOT EXISTS "last_used_at" TIMESTAMP(3); -- Drop old index on call_policy DROP INDEX IF EXISTS "LiteLLM_ToolTable_call_policy_idx"; -- CreateIndex -CREATE INDEX "LiteLLM_ToolTable_input_policy_idx" ON "LiteLLM_ToolTable"("input_policy"); +CREATE INDEX IF NOT EXISTS "LiteLLM_ToolTable_input_policy_idx" ON "LiteLLM_ToolTable"("input_policy"); -- CreateIndex -CREATE INDEX "LiteLLM_ToolTable_output_policy_idx" ON "LiteLLM_ToolTable"("output_policy"); +CREATE INDEX IF NOT EXISTS "LiteLLM_ToolTable_output_policy_idx" ON "LiteLLM_ToolTable"("output_policy"); diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260304175016_add_spend_to_agent_table/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260304175016_add_spend_to_agent_table/migration.sql index 01f3936a6f..a045b7d1d6 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260304175016_add_spend_to_agent_table/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260304175016_add_spend_to_agent_table/migration.sql @@ -1,3 +1,3 @@ -- AlterTable -ALTER TABLE "LiteLLM_AgentsTable" ADD COLUMN "spend" DOUBLE PRECISION NOT NULL DEFAULT 0.0; +ALTER TABLE "LiteLLM_AgentsTable" ADD COLUMN IF NOT EXISTS "spend" DOUBLE PRECISION NOT NULL DEFAULT 0.0; diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260305000000_add_rate_limits_to_agents/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260305000000_add_rate_limits_to_agents/migration.sql index 3cd8ca638a..c1556822c1 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260305000000_add_rate_limits_to_agents/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260305000000_add_rate_limits_to_agents/migration.sql @@ -1,5 +1,5 @@ -- AlterTable -ALTER TABLE "LiteLLM_AgentsTable" ADD COLUMN "tpm_limit" INTEGER; -ALTER TABLE "LiteLLM_AgentsTable" ADD COLUMN "rpm_limit" INTEGER; -ALTER TABLE "LiteLLM_AgentsTable" ADD COLUMN "session_tpm_limit" INTEGER; -ALTER TABLE "LiteLLM_AgentsTable" ADD COLUMN "session_rpm_limit" INTEGER; +ALTER TABLE "LiteLLM_AgentsTable" ADD COLUMN IF NOT EXISTS "tpm_limit" INTEGER; +ALTER TABLE "LiteLLM_AgentsTable" ADD COLUMN IF NOT EXISTS "rpm_limit" INTEGER; +ALTER TABLE "LiteLLM_AgentsTable" ADD COLUMN IF NOT EXISTS "session_tpm_limit" INTEGER; +ALTER TABLE "LiteLLM_AgentsTable" ADD COLUMN IF NOT EXISTS "session_rpm_limit" INTEGER; diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260306175056_add_configs_override_table/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260306175056_add_configs_override_table/migration.sql index aad5e2b388..616463a9e2 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260306175056_add_configs_override_table/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260306175056_add_configs_override_table/migration.sql @@ -1,3 +1,3 @@ -- AlterTable -ALTER TABLE "LiteLLM_MCPServerTable" ADD COLUMN "spec_path" TEXT; +ALTER TABLE "LiteLLM_MCPServerTable" ADD COLUMN IF NOT EXISTS "spec_path" TEXT; diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260306233848_schema_sync/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260306233848_schema_sync/migration.sql index 6395d5b1f8..4f3c0b7485 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260306233848_schema_sync/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260306233848_schema_sync/migration.sql @@ -1,12 +1,12 @@ -- AlterTable -ALTER TABLE "LiteLLM_MCPServerTable" ADD COLUMN "byok_api_key_help_url" TEXT, -ADD COLUMN "byok_description" TEXT[] DEFAULT ARRAY[]::TEXT[], -ADD COLUMN "is_byok" BOOLEAN NOT NULL DEFAULT false, -ADD COLUMN "tool_name_to_description" JSONB DEFAULT '{}', -ADD COLUMN "tool_name_to_display_name" JSONB DEFAULT '{}'; +ALTER TABLE "LiteLLM_MCPServerTable" ADD COLUMN IF NOT EXISTS "byok_api_key_help_url" TEXT, +ADD COLUMN IF NOT EXISTS "byok_description" TEXT[] DEFAULT ARRAY[]::TEXT[], +ADD COLUMN IF NOT EXISTS "is_byok" BOOLEAN NOT NULL DEFAULT false, +ADD COLUMN IF NOT EXISTS "tool_name_to_description" JSONB DEFAULT '{}', +ADD COLUMN IF NOT EXISTS "tool_name_to_display_name" JSONB DEFAULT '{}'; -- CreateTable -CREATE TABLE "LiteLLM_MCPUserCredentials" ( +CREATE TABLE IF NOT EXISTS "LiteLLM_MCPUserCredentials" ( "id" TEXT NOT NULL, "user_id" TEXT NOT NULL, "server_id" TEXT NOT NULL, @@ -18,7 +18,7 @@ CREATE TABLE "LiteLLM_MCPUserCredentials" ( ); -- CreateTable -CREATE TABLE "LiteLLM_JWTKeyMapping" ( +CREATE TABLE IF NOT EXISTS "LiteLLM_JWTKeyMapping" ( "id" TEXT NOT NULL, "jwt_claim_name" TEXT NOT NULL, "jwt_claim_value" TEXT NOT NULL, @@ -34,7 +34,7 @@ CREATE TABLE "LiteLLM_JWTKeyMapping" ( ); -- CreateTable -CREATE TABLE "LiteLLM_ConfigOverrides" ( +CREATE TABLE IF NOT EXISTS "LiteLLM_ConfigOverrides" ( "config_type" TEXT NOT NULL, "config_value" JSONB NOT NULL, "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, @@ -44,14 +44,19 @@ CREATE TABLE "LiteLLM_ConfigOverrides" ( ); -- CreateIndex -CREATE UNIQUE INDEX "LiteLLM_MCPUserCredentials_user_id_server_id_key" ON "LiteLLM_MCPUserCredentials"("user_id", "server_id"); +CREATE UNIQUE INDEX IF NOT EXISTS "LiteLLM_MCPUserCredentials_user_id_server_id_key" ON "LiteLLM_MCPUserCredentials"("user_id", "server_id"); -- CreateIndex -CREATE INDEX "LiteLLM_JWTKeyMapping_jwt_claim_name_jwt_claim_value_is_act_idx" ON "LiteLLM_JWTKeyMapping"("jwt_claim_name", "jwt_claim_value", "is_active"); +CREATE INDEX IF NOT EXISTS "LiteLLM_JWTKeyMapping_jwt_claim_name_jwt_claim_value_is_act_idx" ON "LiteLLM_JWTKeyMapping"("jwt_claim_name", "jwt_claim_value", "is_active"); -- CreateIndex -CREATE UNIQUE INDEX "LiteLLM_JWTKeyMapping_jwt_claim_name_jwt_claim_value_key" ON "LiteLLM_JWTKeyMapping"("jwt_claim_name", "jwt_claim_value"); +CREATE UNIQUE INDEX IF NOT EXISTS "LiteLLM_JWTKeyMapping_jwt_claim_name_jwt_claim_value_key" ON "LiteLLM_JWTKeyMapping"("jwt_claim_name", "jwt_claim_value"); -- AddForeignKey -ALTER TABLE "LiteLLM_JWTKeyMapping" ADD CONSTRAINT "LiteLLM_JWTKeyMapping_token_fkey" FOREIGN KEY ("token") REFERENCES "LiteLLM_VerificationToken"("token") ON DELETE RESTRICT ON UPDATE CASCADE; +DO $$ +BEGIN + IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'LiteLLM_JWTKeyMapping_token_fkey') THEN + ALTER TABLE "LiteLLM_JWTKeyMapping" ADD CONSTRAINT "LiteLLM_JWTKeyMapping_token_fkey" FOREIGN KEY ("token") REFERENCES "LiteLLM_VerificationToken"("token") ON DELETE RESTRICT ON UPDATE CASCADE; + END IF; +END $$; diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260311180521_schema_sync/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260311180521_schema_sync/migration.sql index 5ab834695b..84eb70ce09 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260311180521_schema_sync/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260311180521_schema_sync/migration.sql @@ -1,11 +1,11 @@ -- DropIndex -DROP INDEX "LiteLLM_MCPServerTable_approval_status_idx"; +DROP INDEX IF EXISTS "LiteLLM_MCPServerTable_approval_status_idx"; -- AlterTable -ALTER TABLE "LiteLLM_MCPServerTable" DROP COLUMN "approval_status", -DROP COLUMN "review_notes", -DROP COLUMN "reviewed_at", -DROP COLUMN "source_url", -DROP COLUMN "submitted_at", -DROP COLUMN "submitted_by"; +ALTER TABLE "LiteLLM_MCPServerTable" DROP COLUMN IF EXISTS "approval_status", +DROP COLUMN IF EXISTS "review_notes", +DROP COLUMN IF EXISTS "reviewed_at", +DROP COLUMN IF EXISTS "source_url", +DROP COLUMN IF EXISTS "submitted_at", +DROP COLUMN IF EXISTS "submitted_by"; diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260312124619_schema_sync/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260312124619_schema_sync/migration.sql index 8854fd1e20..cc48a742f2 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260312124619_schema_sync/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260312124619_schema_sync/migration.sql @@ -1,3 +1,3 @@ -- AlterTable -ALTER TABLE "LiteLLM_ObjectPermissionTable" ADD COLUMN "models" TEXT[] DEFAULT ARRAY[]::TEXT[]; +ALTER TABLE "LiteLLM_ObjectPermissionTable" ADD COLUMN IF NOT EXISTS "models" TEXT[] DEFAULT ARRAY[]::TEXT[]; diff --git a/litellm-proxy-extras/litellm_proxy_extras/utils.py b/litellm-proxy-extras/litellm_proxy_extras/utils.py index f315572218..7eff0c00f7 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/utils.py +++ b/litellm-proxy-extras/litellm_proxy_extras/utils.py @@ -415,16 +415,26 @@ class ProxyExtrasDBManager: logger.info( f"Migration {failed_migration} failed due to idempotent error (e.g., column already exists), resolving as applied" ) - ProxyExtrasDBManager._roll_back_migration( - failed_migration - ) - ProxyExtrasDBManager._resolve_specific_migration( - failed_migration - ) - logger.info( - f"✅ Migration {failed_migration} resolved." - ) - return True + try: + ProxyExtrasDBManager._roll_back_migration( + failed_migration + ) + except (subprocess.CalledProcessError, subprocess.TimeoutExpired) as rollback_err: + logger.warning( + f"Failed to roll back migration {failed_migration}: {rollback_err}. " + f"It may already be in a rolled-back state." + ) + try: + ProxyExtrasDBManager._resolve_specific_migration( + failed_migration + ) + logger.info( + f"✅ Migration {failed_migration} resolved, retrying to apply remaining migrations" + ) + except (subprocess.CalledProcessError, subprocess.TimeoutExpired) as resolve_err: + logger.warning( + f"Failed to resolve migration {failed_migration}: {resolve_err}" + ) else: logger.info( f"Found failed migration: {failed_migration}, marking as rolled back" @@ -514,20 +524,34 @@ class ProxyExtrasDBManager: ) if migration_match: migration_name = migration_match.group(1) - logger.info( - f"Rolling back migration {migration_name}" - ) - ProxyExtrasDBManager._roll_back_migration( - migration_name - ) - logger.info( - f"Resolving migration {migration_name} that failed " - f"due to existing schema objects" - ) - ProxyExtrasDBManager._resolve_specific_migration( - migration_name - ) - logger.info("✅ Migration resolved.") + try: + logger.info( + f"Rolling back migration {migration_name}" + ) + ProxyExtrasDBManager._roll_back_migration( + migration_name + ) + except (subprocess.CalledProcessError, subprocess.TimeoutExpired) as rollback_err: + logger.warning( + f"Failed to roll back migration {migration_name}: {rollback_err}. " + f"It may already be in a rolled-back state." + ) + try: + logger.info( + f"Resolving migration {migration_name} that failed " + f"due to existing schema objects" + ) + ProxyExtrasDBManager._resolve_specific_migration( + migration_name + ) + logger.info( + f"✅ Migration {migration_name} resolved, " + f"retrying to apply remaining migrations" + ) + except (subprocess.CalledProcessError, subprocess.TimeoutExpired) as resolve_err: + logger.warning( + f"Failed to resolve migration {migration_name}: {resolve_err}" + ) else: # Unknown P3018 error - log and re-raise for safety logger.warning( diff --git a/litellm/__init__.py b/litellm/__init__.py index dcd4ce2909..299bb18245 100644 --- a/litellm/__init__.py +++ b/litellm/__init__.py @@ -144,6 +144,7 @@ _custom_logger_compatible_callbacks_literal = Literal[ "gitlab", "cloudzero", "focus", + "vantage", "posthog", "levo", ] @@ -1464,12 +1465,9 @@ if TYPE_CHECKING: from .llms.petals.completion.transformation import PetalsConfig as PetalsConfig from .llms.ollama.chat.transformation import OllamaChatConfig as OllamaChatConfig from .llms.ollama.completion.transformation import OllamaConfig as OllamaConfig - from .llms.sagemaker.completion.transformation import ( - SagemakerConfig as SagemakerConfig, - ) - from .llms.sagemaker.chat.transformation import ( - SagemakerChatConfig as SagemakerChatConfig, - ) + from .llms.sagemaker.completion.transformation import SagemakerConfig as SagemakerConfig + from .llms.sagemaker.chat.transformation import SagemakerChatConfig as SagemakerChatConfig + from .llms.sagemaker.nova.transformation import SagemakerNovaConfig as SagemakerNovaConfig from .llms.cohere.chat.transformation import CohereChatConfig as CohereChatConfig from .llms.anthropic.experimental_pass_through.messages.transformation import ( AnthropicMessagesConfig as AnthropicMessagesConfig, diff --git a/litellm/_lazy_imports_registry.py b/litellm/_lazy_imports_registry.py index f7f56d2b88..9164a3c8ae 100644 --- a/litellm/_lazy_imports_registry.py +++ b/litellm/_lazy_imports_registry.py @@ -167,6 +167,7 @@ LLM_CONFIG_NAMES = ( "OllamaConfig", "SagemakerConfig", "SagemakerChatConfig", + "SagemakerNovaConfig", "CohereChatConfig", "AnthropicMessagesConfig", "AmazonAnthropicClaudeMessagesConfig", @@ -701,6 +702,10 @@ _LLM_CONFIGS_IMPORT_MAP = { ".llms.sagemaker.chat.transformation", "SagemakerChatConfig", ), + "SagemakerNovaConfig": ( + ".llms.sagemaker.nova.transformation", + "SagemakerNovaConfig", + ), "CohereChatConfig": (".llms.cohere.chat.transformation", "CohereChatConfig"), "AnthropicMessagesConfig": ( ".llms.anthropic.experimental_pass_through.messages.transformation", diff --git a/litellm/_logging.py b/litellm/_logging.py index fd833f7056..5de9fbb355 100644 --- a/litellm/_logging.py +++ b/litellm/_logging.py @@ -1,10 +1,11 @@ import ast import logging import os +import re import sys from datetime import datetime from logging import Formatter -from typing import Any, Dict, Optional +from typing import Any, Dict, List, Optional from litellm.litellm_core_utils.safe_json_dumps import safe_dumps from litellm.litellm_core_utils.safe_json_loads import safe_json_loads @@ -15,12 +16,94 @@ if set_verbose is True: logging.warning( "`litellm.set_verbose` is deprecated. Please set `os.environ['LITELLM_LOG'] = 'DEBUG'` for debug logs." ) + +_ENABLE_SECRET_REDACTION = os.getenv("LITELLM_DISABLE_REDACT_SECRETS", "").lower() != "true" + +_REDACTED = "REDACTED" + + +def _build_secret_patterns() -> re.Pattern: + patterns: List[str] = [ + # AWS access key IDs + r"(?:AKIA|ASIA)[0-9A-Z]{16}", + # AWS secrets / session tokens / access key IDs (key=value) + r"(?:aws_secret_access_key|aws_session_token|aws_access_key_id)" + r"\s*[:=]\s*[A-Za-z0-9/+=]{20,}", + # Bearer tokens (OAuth, JWT, etc.) + r"Bearer\s+[A-Za-z0-9\-._~+/]{10,}=*", + # Basic auth headers + r"Basic\s+[A-Za-z0-9+/]{10,}={0,2}", + # OpenAI / Anthropic sk- prefixed keys + r"sk-[A-Za-z0-9\-_]{20,}", + # Generic api_key / api-key / apikey (handles 'key': 'value' dict repr) + r"(?:api[_-]?key)['\"]?\s*[:=]\s*['\"]?[^\s,'\"})\]{}>]{8,}", + # x-api-key / api-key header values (handles 'key': 'value' dict repr) + r"(?:x-api-key|api-key)['\"]?\s*[:=]\s*['\"]?[^\s,'\"})\]{}>]+", + # Anthropic internal header keys + r"x-ak-[A-Za-z0-9\-_]{20,}", + # Google API keys + r"AIza[0-9A-Za-z\-_]{35}", + # Password / secret params (handles key=value and 'key': 'value') + r"\w*(?:password|passwd|client_secret|secret_key|_secret)" + r"['\"]?\s*[:=]\s*['\"]?[^\s,'\"})\]{}>]+", + # Database connection string credentials (scheme://user:pass@host) + r"(?<=://)[^\s'\"]*:[^\s'\"@]+(?=@)", + # Databricks personal access tokens + r"dapi[0-9a-f]{32}", + ] + return re.compile("|".join(patterns), re.IGNORECASE) + + +_SECRET_RE = _build_secret_patterns() + + +def _redact_string(value: str) -> str: + return _SECRET_RE.sub(_REDACTED, value) + + +class SecretRedactionFilter(logging.Filter): + """Scrubs known secret/credential patterns from log records.""" + + _formatter = logging.Formatter() + + def filter(self, record: logging.LogRecord) -> bool: + if not _ENABLE_SECRET_REDACTION: + return True + + try: + record.msg = _redact_string(record.getMessage()) + record.args = None + except Exception: + if isinstance(record.msg, str): + record.msg = _redact_string(record.msg) + + # Redact exception tracebacks + if record.exc_info and record.exc_info[1] is not None: + try: + record.exc_text = _redact_string( + self._formatter.formatException(record.exc_info) + ) + except Exception: + pass + + # Redact extra fields passed via logger.debug("msg", extra={...}) + for key, value in list(record.__dict__.items()): + if key not in _STANDARD_RECORD_ATTRS and isinstance(value, str): + setattr(record, key, _redact_string(value)) + + return True + + +_secret_filter = SecretRedactionFilter() + + json_logs = bool(os.getenv("JSON_LOGS", False)) # Create a handler for the logger (you may need to adapt this based on your needs) log_level = os.getenv("LITELLM_LOG", "DEBUG") numeric_level: str = getattr(logging, log_level.upper()) handler = logging.StreamHandler() handler.setLevel(numeric_level) +handler.addFilter(_secret_filter) def _try_parse_json_message(message: str) -> Optional[Dict[str, Any]]: @@ -116,7 +199,7 @@ class JsonFormatter(Formatter): json_record[key] = value if record.exc_info: - json_record["stacktrace"] = self.formatException(record.exc_info) + json_record["stacktrace"] = record.exc_text or self.formatException(record.exc_info) return safe_dumps(json_record) @@ -126,6 +209,7 @@ def _setup_json_exception_handlers(formatter): # Create a handler with JSON formatting for exceptions error_handler = logging.StreamHandler() error_handler.setFormatter(formatter) + error_handler.addFilter(_secret_filter) # Setup excepthook for uncaught exceptions def json_excepthook(exc_type, exc_value, exc_traceback): @@ -149,6 +233,7 @@ def _setup_json_exception_handlers(formatter): def async_json_exception_handler(loop, context): exception = context.get("exception") if exception: + exc_type = type(exception) record = logging.LogRecord( name="LiteLLM", level=logging.ERROR, @@ -156,7 +241,7 @@ def _setup_json_exception_handlers(formatter): lineno=0, msg=str(exception), args=(), - exc_info=None, + exc_info=(exc_type, exception, exception.__traceback__), ) error_handler.handle(record) else: @@ -240,6 +325,7 @@ def _initialize_loggers_with_handler(handler: logging.Handler): - Adds a handler to each logger - Prevents bubbling to parent/root (critical to prevent duplicate JSON logs) """ + handler.addFilter(_secret_filter) for lg in _get_loggers_to_initialize(): lg.handlers.clear() # remove any existing handlers lg.addHandler(handler) # add JSON formatter handler diff --git a/litellm/anthropic_beta_headers_manager.py b/litellm/anthropic_beta_headers_manager.py index efa57ca058..97d223088f 100644 --- a/litellm/anthropic_beta_headers_manager.py +++ b/litellm/anthropic_beta_headers_manager.py @@ -367,6 +367,42 @@ def update_headers_with_filtered_beta( return headers +def update_request_with_filtered_beta( + headers: dict, + request_data: dict, + provider: str, +) -> tuple[dict, dict]: + """ + Update both headers and request body beta fields based on provider support. + Modifies both dicts in place and returns them. + + Args: + headers: Request headers dict (will be modified in place) + request_data: Request body dict (will be modified in place) + provider: Provider name + + Returns: + Tuple of (updated headers, updated request_data) + """ + headers = update_headers_with_filtered_beta(headers=headers, provider=provider) + + existing_body_betas = request_data.get("anthropic_beta") + if not existing_body_betas: + return headers, request_data + + filtered_body_betas = filter_and_transform_beta_headers( + beta_headers=existing_body_betas, + provider=provider, + ) + + if filtered_body_betas: + request_data["anthropic_beta"] = filtered_body_betas + else: + request_data.pop("anthropic_beta", None) + + return headers, request_data + + def get_unsupported_headers(provider: str) -> List[str]: """ Get all beta headers that are unsupported by a provider (have null values in mapping). diff --git a/litellm/batches/main.py b/litellm/batches/main.py index 1a03b172d3..e176dc4292 100644 --- a/litellm/batches/main.py +++ b/litellm/batches/main.py @@ -199,7 +199,8 @@ def create_batch( # noqa: PLR0915 ) ### TIMEOUT LOGIC ### timeout = _resolve_timeout(optional_params, kwargs, custom_llm_provider) - litellm_logging_obj.update_environment_variables( + litellm_logging_obj.update_from_kwargs( + kwargs=kwargs, model=model, user=None, optional_params=optional_params.model_dump(), @@ -207,7 +208,6 @@ def create_batch( # noqa: PLR0915 "litellm_call_id": litellm_call_id, "proxy_server_request": proxy_server_request, "model_info": model_info, - "metadata": metadata, "preset_cache_key": None, "stream_response": {}, **optional_params.model_dump(exclude_unset=True), @@ -584,7 +584,8 @@ def retrieve_batch( **kwargs, ) if litellm_logging_obj is not None: - litellm_logging_obj.update_environment_variables( + litellm_logging_obj.update_from_kwargs( + kwargs=kwargs, model=None, user=None, optional_params=optional_params.model_dump(), diff --git a/litellm/blog_posts.json b/litellm/blog_posts.json index 15340514bc..fa768b3ec5 100644 --- a/litellm/blog_posts.json +++ b/litellm/blog_posts.json @@ -1,10 +1,10 @@ { "posts": [ { - "title": "Incident Report: SERVER_ROOT_PATH regression broke UI routing", - "description": "How a single line removal caused UI 404s for all deployments using SERVER_ROOT_PATH, and the tests we added to prevent it from happening again.", - "date": "2026-02-21", - "url": "https://docs.litellm.ai/blog/server-root-path-incident" + "title": "Realtime WebRTC HTTP Endpoints", + "description": "Use the LiteLLM proxy to route OpenAI-style WebRTC realtime via HTTP: client_secrets and SDP exchange.", + "date": "2026-03-12", + "url": "https://docs.litellm.ai/blog/realtime_webrtc_http_endpoints" } ] } diff --git a/litellm/completion_extras/litellm_responses_transformation/transformation.py b/litellm/completion_extras/litellm_responses_transformation/transformation.py index 4b31bcfc28..53ffd3647b 100644 --- a/litellm/completion_extras/litellm_responses_transformation/transformation.py +++ b/litellm/completion_extras/litellm_responses_transformation/transformation.py @@ -398,6 +398,7 @@ class LiteLLMResponsesTransformationHandler(CompletionTransformationBridge): ResponseOutputMessage, ResponseReasoningItem, ) + try: from openai.types.responses.response_output_item import ( ResponseApplyPatchToolCall, @@ -460,7 +461,9 @@ class LiteLLMResponsesTransformationHandler(CompletionTransformationBridge): accumulated_tool_calls.append(tool_call_dict) tool_call_index += 1 - elif ResponseApplyPatchToolCall is not None and isinstance(item, ResponseApplyPatchToolCall): + elif ResponseApplyPatchToolCall is not None and isinstance( + item, ResponseApplyPatchToolCall + ): from litellm.responses.litellm_completion_transformation.transformation import ( LiteLLMCompletionResponsesConfig, ) diff --git a/litellm/constants.py b/litellm/constants.py index dbc79b69a6..89c59ee932 100644 --- a/litellm/constants.py +++ b/litellm/constants.py @@ -505,6 +505,7 @@ LITELLM_CHAT_PROVIDERS = [ "azure_ai", "sagemaker", "sagemaker_chat", + "sagemaker_nova", "bedrock", "vllm", "nlp_cloud", @@ -1417,6 +1418,7 @@ SECRET_MANAGER_REFRESH_INTERVAL = int( ) LITELLM_SETTINGS_SAFE_DB_OVERRIDES = [ "default_internal_user_params", + "default_team_params", "public_mcp_servers", "public_agent_groups", "public_model_groups", diff --git a/litellm/containers/endpoint_factory.py b/litellm/containers/endpoint_factory.py index 22fd4226de..1d8e50856f 100644 --- a/litellm/containers/endpoint_factory.py +++ b/litellm/containers/endpoint_factory.py @@ -91,7 +91,8 @@ def create_sync_endpoint_function(endpoint_config: Dict) -> Callable: optional_params = {k: kwargs.get(k) for k in path_params if k in kwargs} # Pre-call logging - litellm_logging_obj.update_environment_variables( + litellm_logging_obj.update_from_kwargs( + kwargs=kwargs, model="", optional_params=optional_params, litellm_params={"litellm_call_id": litellm_call_id}, diff --git a/litellm/containers/main.py b/litellm/containers/main.py index 88318ee039..916fc26351 100644 --- a/litellm/containers/main.py +++ b/litellm/containers/main.py @@ -233,7 +233,8 @@ def create_container( ) # Pre Call logging - litellm_logging_obj.update_environment_variables( + litellm_logging_obj.update_from_kwargs( + kwargs=kwargs, model="", optional_params=dict(container_create_request_params), litellm_params={ @@ -438,7 +439,8 @@ def list_containers( ) # Pre Call logging - litellm_logging_obj.update_environment_variables( + litellm_logging_obj.update_from_kwargs( + kwargs=kwargs, model="", optional_params=dict(container_list_optional_params), litellm_params={ @@ -626,7 +628,8 @@ def retrieve_container( ) # Pre Call logging - litellm_logging_obj.update_environment_variables( + litellm_logging_obj.update_from_kwargs( + kwargs=kwargs, model="", optional_params={}, litellm_params={ @@ -811,7 +814,8 @@ def delete_container( ) # Pre Call logging - litellm_logging_obj.update_environment_variables( + litellm_logging_obj.update_from_kwargs( + kwargs=kwargs, model="", optional_params={}, litellm_params={ @@ -1010,7 +1014,8 @@ def list_container_files( ) # Pre Call logging - litellm_logging_obj.update_environment_variables( + litellm_logging_obj.update_from_kwargs( + kwargs=kwargs, model="", optional_params={ "container_id": container_id, @@ -1255,7 +1260,8 @@ def upload_container_file( ) # Pre Call logging - litellm_logging_obj.update_environment_variables( + litellm_logging_obj.update_from_kwargs( + kwargs=kwargs, model="", optional_params={"container_id": container_id}, litellm_params={ diff --git a/litellm/cost_calculator.py b/litellm/cost_calculator.py index c1daa109c7..a3ef7b264e 100644 --- a/litellm/cost_calculator.py +++ b/litellm/cost_calculator.py @@ -1182,7 +1182,7 @@ def completion_cost( # noqa: PLR0915 and _usage["prompt_tokens_details"] != {} and _usage["prompt_tokens_details"] ): - prompt_tokens_details = _usage.get("prompt_tokens_details", {}) + prompt_tokens_details = _usage.get("prompt_tokens_details") or {} cache_read_input_tokens = prompt_tokens_details.get( "cached_tokens", 0 ) @@ -1484,8 +1484,8 @@ def completion_cost( # noqa: PLR0915 completion_tokens_cost_usd_dollar, ) = cost_per_token( model=model, - prompt_tokens=prompt_tokens, - completion_tokens=completion_tokens, + prompt_tokens=prompt_tokens or 0, + completion_tokens=completion_tokens or 0, custom_llm_provider=custom_llm_provider, response_time_ms=total_time, region_name=region_name, @@ -1505,13 +1505,27 @@ def completion_cost( # noqa: PLR0915 ) # Get additional costs from provider (e.g., routing fees, infrastructure costs) - # Only azure_ai implements additional costs if custom_llm_provider == "azure_ai": + model_for_additional_costs = request_model_for_cost + if completion_response is not None: + hidden_params = getattr(completion_response, "_hidden_params", None) or {} + hidden_model = hidden_params.get("model") or hidden_params.get( + "litellm_model_name" + ) + if hidden_model and ( + "model_router" in (hidden_model or "").lower() + or "model-router" in (hidden_model or "").lower() + ): + model_for_additional_costs = hidden_model + elif model_for_additional_costs is None: + model_for_additional_costs = hidden_model + if model_for_additional_costs is None: + model_for_additional_costs = model additional_costs = _get_additional_costs( - model=model, + model=model_for_additional_costs, custom_llm_provider=custom_llm_provider, - prompt_tokens=prompt_tokens, - completion_tokens=completion_tokens, + prompt_tokens=prompt_tokens or 0, + completion_tokens=completion_tokens or 0, ) else: additional_costs = None @@ -1529,8 +1543,9 @@ def completion_cost( # noqa: PLR0915 ) ) _final_cost += cost_for_built_in_tools + if additional_costs: + _final_cost += sum(additional_costs.values()) - # Apply discount from module-level config if configured original_cost = _final_cost if litellm.cost_discount_config: ( diff --git a/litellm/evals/main.py b/litellm/evals/main.py index e57c75bd9b..eab909a6b1 100644 --- a/litellm/evals/main.py +++ b/litellm/evals/main.py @@ -193,7 +193,8 @@ def create_eval( ) # Pre-call logging - litellm_logging_obj.update_environment_variables( + litellm_logging_obj.update_from_kwargs( + kwargs=kwargs, model=None, optional_params=request_body, litellm_params={ @@ -382,7 +383,8 @@ def list_evals( ) # Pre-call logging - litellm_logging_obj.update_environment_variables( + litellm_logging_obj.update_from_kwargs( + kwargs=kwargs, model=None, optional_params=query_params, litellm_params={ @@ -536,7 +538,8 @@ def get_eval( ) # Pre-call logging - litellm_logging_obj.update_environment_variables( + litellm_logging_obj.update_from_kwargs( + kwargs=kwargs, model=None, optional_params={"eval_id": eval_id}, litellm_params={ @@ -760,7 +763,8 @@ def update_eval( ) # Pre-call logging - litellm_logging_obj.update_environment_variables( + litellm_logging_obj.update_from_kwargs( + kwargs=kwargs, model=None, optional_params=request_body, litellm_params={ @@ -914,7 +918,8 @@ def delete_eval( ) # Pre-call logging - litellm_logging_obj.update_environment_variables( + litellm_logging_obj.update_from_kwargs( + kwargs=kwargs, model=None, optional_params={"eval_id": eval_id}, litellm_params={ @@ -1071,7 +1076,8 @@ def cancel_eval( ) # Pre-call logging - litellm_logging_obj.update_environment_variables( + litellm_logging_obj.update_from_kwargs( + kwargs=kwargs, model=None, optional_params={"eval_id": eval_id}, litellm_params={ @@ -1262,7 +1268,8 @@ def create_run( ) # Pre-call logging - litellm_logging_obj.update_environment_variables( + litellm_logging_obj.update_from_kwargs( + kwargs=kwargs, model=None, optional_params=request_body, litellm_params={ @@ -1450,7 +1457,8 @@ def list_runs( ) # Pre-call logging - litellm_logging_obj.update_environment_variables( + litellm_logging_obj.update_from_kwargs( + kwargs=kwargs, model=None, optional_params={"eval_id": eval_id, **query_params}, litellm_params={ @@ -1610,7 +1618,8 @@ def get_run( ) # Pre-call logging - litellm_logging_obj.update_environment_variables( + litellm_logging_obj.update_from_kwargs( + kwargs=kwargs, model=None, optional_params={"eval_id": eval_id, "run_id": run_id}, litellm_params={ @@ -1773,7 +1782,8 @@ def cancel_run( ) # Pre-call logging - litellm_logging_obj.update_environment_variables( + litellm_logging_obj.update_from_kwargs( + kwargs=kwargs, model=None, optional_params={"eval_id": eval_id, "run_id": run_id}, litellm_params={ @@ -1941,7 +1951,8 @@ def delete_run( ) # Pre-call logging - litellm_logging_obj.update_environment_variables( + litellm_logging_obj.update_from_kwargs( + kwargs=kwargs, model=None, optional_params={"eval_id": eval_id, "run_id": run_id}, litellm_params={ diff --git a/litellm/google_genai/main.py b/litellm/google_genai/main.py index a937a35da2..bdbb483dcf 100644 --- a/litellm/google_genai/main.py +++ b/litellm/google_genai/main.py @@ -185,7 +185,8 @@ class GenerateContentHelper: if litellm_logging_obj is None: raise ValueError("litellm_logging_obj is required, but got None") - litellm_logging_obj.update_environment_variables( + litellm_logging_obj.update_from_kwargs( + kwargs=kwargs, model=model, optional_params=dict(generate_content_config_dict), litellm_params={ diff --git a/litellm/images/main.py b/litellm/images/main.py index a3ae97b57d..a5ae154190 100644 --- a/litellm/images/main.py +++ b/litellm/images/main.py @@ -40,6 +40,9 @@ from litellm.utils import exception_type, get_litellm_params llm_http_handler: BaseLLMHTTPHandler = BaseLLMHTTPHandler() from openai.types.audio.transcription_create_params import FileTypes # type: ignore +# BFL handlers +from litellm.llms.black_forest_labs.image_edit.handler import bfl_image_edit +from litellm.llms.black_forest_labs.image_generation.handler import bfl_image_generation from litellm.main import ( azure_chat_completions, base_llm_aiohttp_handler, @@ -50,10 +53,6 @@ from litellm.main import ( openai_image_variations, ) -# BFL handlers -from litellm.llms.black_forest_labs.image_edit.handler import bfl_image_edit -from litellm.llms.black_forest_labs.image_generation.handler import bfl_image_generation - ########################################### from litellm.secret_managers.main import get_secret_str from litellm.types.images.main import ImageEditOptionalRequestParams @@ -297,7 +296,8 @@ def image_generation( # noqa: PLR0915 litellm_params_dict = get_litellm_params(**kwargs) logging: Logging = litellm_logging_obj - logging.update_environment_variables( + logging.update_from_kwargs( + kwargs=kwargs, model=model, user=user, optional_params=optional_params, @@ -308,7 +308,6 @@ def image_generation( # noqa: PLR0915 "logger_fn": logger_fn, "proxy_server_request": proxy_server_request, "model_info": model_info, - "metadata": metadata, "preset_cache_key": None, "stream_response": {}, }, @@ -894,7 +893,8 @@ def image_edit( # noqa: PLR0915 ) # Pre Call logging - litellm_logging_obj.update_environment_variables( + litellm_logging_obj.update_from_kwargs( + kwargs=kwargs, model=model, user=user, optional_params=dict(image_edit_request_params), @@ -902,7 +902,6 @@ def image_edit( # noqa: PLR0915 **image_edit_request_params, "litellm_call_id": litellm_call_id, "model_info": model_info, - "metadata": metadata, }, custom_llm_provider=custom_llm_provider, ) diff --git a/litellm/integrations/focus/destinations/__init__.py b/litellm/integrations/focus/destinations/__init__.py index 233f1da0c9..775d3a259d 100644 --- a/litellm/integrations/focus/destinations/__init__.py +++ b/litellm/integrations/focus/destinations/__init__.py @@ -3,10 +3,12 @@ from .base import FocusDestination, FocusTimeWindow from .factory import FocusDestinationFactory from .s3_destination import FocusS3Destination +from .vantage_destination import FocusVantageDestination __all__ = [ "FocusDestination", "FocusDestinationFactory", "FocusTimeWindow", "FocusS3Destination", + "FocusVantageDestination", ] diff --git a/litellm/integrations/focus/destinations/factory.py b/litellm/integrations/focus/destinations/factory.py index cb7696a11d..01ea6ca9cb 100644 --- a/litellm/integrations/focus/destinations/factory.py +++ b/litellm/integrations/focus/destinations/factory.py @@ -7,6 +7,7 @@ from typing import Any, Dict, Optional from .base import FocusDestination from .s3_destination import FocusS3Destination +from .vantage_destination import FocusVantageDestination class FocusDestinationFactory: @@ -26,6 +27,8 @@ class FocusDestinationFactory: ) if provider_lower == "s3": return FocusS3Destination(prefix=prefix, config=normalized_config) + if provider_lower == "vantage": + return FocusVantageDestination(prefix=prefix, config=normalized_config) raise NotImplementedError( f"Provider '{provider}' not supported for Focus export" ) @@ -54,6 +57,24 @@ class FocusDestinationFactory: if not resolved.get("bucket_name"): raise ValueError("FOCUS_S3_BUCKET_NAME must be provided for S3 exports") return {k: v for k, v in resolved.items() if v is not None} + if provider == "vantage": + resolved = { + "api_key": overrides.get("api_key") + or os.getenv("VANTAGE_API_KEY"), + "integration_token": overrides.get("integration_token") + or os.getenv("VANTAGE_INTEGRATION_TOKEN"), + "base_url": overrides.get("base_url") + or os.getenv("VANTAGE_BASE_URL", "https://api.vantage.sh"), + } + if not resolved.get("api_key"): + raise ValueError( + "VANTAGE_API_KEY must be provided for Vantage exports" + ) + if not resolved.get("integration_token"): + raise ValueError( + "VANTAGE_INTEGRATION_TOKEN must be provided for Vantage exports" + ) + return {k: v for k, v in resolved.items() if v is not None} raise NotImplementedError( f"Provider '{provider}' not supported for Focus export configuration" ) diff --git a/litellm/integrations/focus/destinations/vantage_destination.py b/litellm/integrations/focus/destinations/vantage_destination.py new file mode 100644 index 0000000000..c58e955984 --- /dev/null +++ b/litellm/integrations/focus/destinations/vantage_destination.py @@ -0,0 +1,284 @@ +"""Vantage API destination for Focus export.""" + +from __future__ import annotations + +import csv +import io +from typing import Any, Optional + +import httpx # noqa: F401 - used at runtime (AsyncClient, HTTPStatusError) + +from litellm._logging import verbose_logger +from litellm.llms.custom_httpx.http_handler import ( + AsyncHTTPHandler, + get_async_httpx_client, + httpxSpecialProvider, +) + +from .base import FocusDestination, FocusTimeWindow + +# Vantage enforces a 10,000-row / 2 MB limit per upload. +VANTAGE_MAX_ROWS_PER_UPLOAD = 10_000 +VANTAGE_MAX_BYTES_PER_UPLOAD = 2 * 1024 * 1024 # 2 MB + +# Columns that Vantage actually supports for custom provider CSV uploads. +# See: https://docs.vantage.sh/connecting_custom_providers +# Columns not in this set are silently dropped before upload so Vantage +# does not reject the file. +VANTAGE_SUPPORTED_COLUMNS = { + # Required + "ChargeCategory", + "ChargePeriodStart", + "BilledCost", + "ServiceName", + # Optional + "BillingCurrency", + "BillingAccountId", + "BillingAccountName", + "ChargePeriodEnd", + "ChargeDescription", + "ChargeFrequency", + "ConsumedQuantity", + "ConsumedUnit", + "ContractedCost", + "EffectiveCost", + "ListCost", + "RegionId", + "RegionName", + "ResourceId", + "ResourceName", + "ResourceType", + "ServiceCategory", + "ServiceSubcategory", + "SubAccountId", + "SubAccountName", + "Tags", +} + + +def _strip_unsupported_columns(csv_bytes: bytes) -> bytes: + """Remove CSV columns not in VANTAGE_SUPPORTED_COLUMNS. + + Parses the header row, identifies column indices to keep, and + rebuilds the CSV with only those columns. + """ + lines = csv_bytes.split(b"\n") + if not lines: + return csv_bytes + + header_cols = lines[0].decode("utf-8").split(",") + keep_indices = [ + i + for i, col in enumerate(header_cols) + if col.strip('"') in VANTAGE_SUPPORTED_COLUMNS + ] + + # If all columns are supported, return as-is + if len(keep_indices) == len(header_cols): + return csv_bytes + + dropped = [col for i, col in enumerate(header_cols) if i not in keep_indices] + verbose_logger.debug( + "Vantage destination: dropping unsupported columns: %s", dropped + ) + + output = io.StringIO() + writer = csv.writer(output) + reader = csv.reader(io.StringIO(csv_bytes.decode("utf-8"))) + for row in reader: + if not row: + continue + writer.writerow([row[i] for i in keep_indices]) + + return output.getvalue().encode("utf-8") + + +class FocusVantageDestination(FocusDestination): + """Upload FOCUS CSV exports to the Vantage cost-import API.""" + + def __init__( + self, + *, + prefix: str, + config: Optional[dict[str, Any]] = None, + ) -> None: + config = config or {} + api_key = config.get("api_key") + integration_token = config.get("integration_token") + if not api_key: + raise ValueError( + "api_key must be provided for Vantage destination " + "(set VANTAGE_API_KEY env var or pass in destination_config)" + ) + if not integration_token: + raise ValueError( + "integration_token must be provided for Vantage destination " + "(set VANTAGE_INTEGRATION_TOKEN env var or pass in destination_config)" + ) + self.api_key = api_key + self.integration_token = integration_token + self.base_url = config.get("base_url", "https://api.vantage.sh") + self.prefix = prefix + + async def deliver( + self, + *, + content: bytes, + time_window: FocusTimeWindow, + filename: str, + ) -> None: + """Upload CSV content to the Vantage API, batching if needed.""" + if not content: + verbose_logger.debug("Vantage destination: empty content, skipping upload") + return + + # Strip columns that Vantage does not support to avoid silent + # rejection (e.g. InvoiceIssuerName, ProviderName, PublisherName). + content = _strip_unsupported_columns(content) + + client = get_async_httpx_client( + llm_provider=httpxSpecialProvider.LoggingCallback, + ) + + # Check both size and row-count limits before single-shot upload + lines = content.split(b"\n") + data_line_count = sum(1 for line in lines[1:] if line.strip()) + within_limits = ( + len(content) <= VANTAGE_MAX_BYTES_PER_UPLOAD + and data_line_count <= VANTAGE_MAX_ROWS_PER_UPLOAD + ) + if within_limits: + await self._upload_csv(client, content, filename) + return + + # Otherwise split into batches respecting both limits + await self._upload_batched(client, content, filename) + + async def _upload_csv( + self, client: AsyncHTTPHandler, csv_bytes: bytes, filename: str + ) -> None: + url = f"{self.base_url}/v2/integrations/" f"{self.integration_token}/costs.csv" + headers = { + "Authorization": f"Bearer {self.api_key}", + } + + await client.post( + url, + headers=headers, + files={"csv": (filename, csv_bytes, "text/csv")}, + ) + + verbose_logger.debug( + "Vantage destination: uploaded %d bytes (%s)", + len(csv_bytes), + filename, + ) + + async def _upload_batched( + self, client: AsyncHTTPHandler, csv_bytes: bytes, filename: str + ) -> None: + """Split the CSV into batches and upload each. + + Continues uploading remaining batches even if one fails, then raises + the first error encountered so callers know the export was partial. + """ + lines = csv_bytes.split(b"\n") + header = lines[0] + data_lines = [line for line in lines[1:] if line.strip()] + + first_error: Optional[Exception] = None + batch_num = 0 + for start in range(0, len(data_lines), VANTAGE_MAX_ROWS_PER_UPLOAD): + batch_lines = data_lines[start : start + VANTAGE_MAX_ROWS_PER_UPLOAD] + batch_csv = header + b"\n" + b"\n".join(batch_lines) + b"\n" + + try: + # If a single batch still exceeds 2 MB, split further by size + if len(batch_csv) > VANTAGE_MAX_BYTES_PER_UPLOAD: + await self._upload_size_limited( + client, header, batch_lines, filename, batch_num + ) + else: + batch_filename = f"{filename}.part{batch_num}" + await self._upload_csv(client, batch_csv, batch_filename) + except Exception as e: + verbose_logger.error( + "Vantage destination: batch %d failed: %s", batch_num, e + ) + if first_error is None: + first_error = e + batch_num += 1 + + if first_error is not None: + raise first_error + + async def _upload_size_limited( + self, + client: AsyncHTTPHandler, + header: bytes, + data_lines: list[bytes], + filename: str, + batch_offset: int, + ) -> None: + """Upload lines in chunks that stay under the 2 MB size limit. + + Individual rows that exceed the limit on their own are skipped with + a warning — they cannot be split further. Sub-batch failures are + recorded and the first error is re-raised after all sub-batches have + been attempted, consistent with ``_upload_batched``. + """ + current_chunk: list[bytes] = [] + current_size = len(header) + 1 # header + newline + sub_batch = 0 + header_size = len(header) + 1 + first_error: Optional[Exception] = None + + for line in data_lines: + line_size = len(line) + 1 # line + newline + + # Skip individual rows that exceed the limit on their own + if header_size + line_size > VANTAGE_MAX_BYTES_PER_UPLOAD: + verbose_logger.warning( + "Vantage destination: skipping oversized row (%d bytes)", + line_size, + ) + continue + + if ( + current_size + line_size > VANTAGE_MAX_BYTES_PER_UPLOAD + and current_chunk + ): + batch_csv = header + b"\n" + b"\n".join(current_chunk) + b"\n" + batch_filename = f"{filename}.part{batch_offset}_{sub_batch}" + try: + await self._upload_csv(client, batch_csv, batch_filename) + except Exception as e: + verbose_logger.error( + "Vantage destination: sub-batch %s failed: %s", + batch_filename, + e, + ) + if first_error is None: + first_error = e + current_chunk = [] + current_size = header_size + sub_batch += 1 + current_chunk.append(line) + current_size += line_size + + if current_chunk: + batch_csv = header + b"\n" + b"\n".join(current_chunk) + b"\n" + batch_filename = f"{filename}.part{batch_offset}_{sub_batch}" + try: + await self._upload_csv(client, batch_csv, batch_filename) + except Exception as e: + verbose_logger.error( + "Vantage destination: sub-batch %s failed: %s", + batch_filename, + e, + ) + if first_error is None: + first_error = e + + if first_error is not None: + raise first_error diff --git a/litellm/integrations/focus/export_engine.py b/litellm/integrations/focus/export_engine.py index 22ebce2a16..37da18a0eb 100644 --- a/litellm/integrations/focus/export_engine.py +++ b/litellm/integrations/focus/export_engine.py @@ -10,7 +10,7 @@ from litellm._logging import verbose_logger from .database import FocusLiteLLMDatabase from .destinations import FocusDestinationFactory, FocusTimeWindow -from .serializers import FocusParquetSerializer, FocusSerializer +from .serializers import FocusCsvSerializer, FocusParquetSerializer, FocusSerializer from .transformer import FocusTransformer @@ -38,9 +38,13 @@ class FocusExportEngine: self._database = FocusLiteLLMDatabase() def _init_serializer(self) -> FocusSerializer: - if self.export_format != "parquet": - raise NotImplementedError("Only parquet export supported currently") - return FocusParquetSerializer() + if self.export_format == "csv": + return FocusCsvSerializer() + if self.export_format == "parquet": + return FocusParquetSerializer() + raise NotImplementedError( + f"Export format '{self.export_format}' not supported. Use 'parquet' or 'csv'." + ) async def dry_run_export_usage_data(self, limit: Optional[int]) -> Dict[str, Any]: data = await self._database.get_usage_data(limit=limit) @@ -51,10 +55,10 @@ class FocusExportEngine: summary = { "total_records": len(normalized), - "total_spend": self._sum_column(normalized, "spend"), - "total_tokens": self._sum_column(normalized, "total_tokens"), - "unique_teams": self._count_unique(normalized, "team_id"), - "unique_models": self._count_unique(normalized, "model"), + "total_spend": self._sum_column(data, "spend"), + "total_tokens": self._sum_column(data, "total_tokens"), + "unique_teams": self._count_unique(data, "team_id"), + "unique_models": self._count_unique(data, "model"), } return { @@ -63,6 +67,33 @@ class FocusExportEngine: "summary": summary, } + async def export_all( + self, + *, + limit: Optional[int], + ) -> None: + """Export all available data without time-window filtering.""" + data = await self._database.get_usage_data(limit=limit) + if data.is_empty(): + verbose_logger.debug("Focus export: no usage data available") + return + + normalized = self._transformer.transform(data) + if normalized.is_empty(): + verbose_logger.debug("Focus export: normalized data empty") + return + + # Build a window spanning the full data range for the filename + from datetime import datetime, timezone + + now = datetime.now(timezone.utc) + window = FocusTimeWindow( + start_time=now.replace(hour=0, minute=0, second=0, microsecond=0), + end_time=now, + frequency="all", + ) + await self._serialize_and_upload(normalized, window) + async def export_window( self, *, @@ -97,13 +128,17 @@ class FocusExportEngine: await self._destination.deliver( content=payload, time_window=window, - filename=self._build_filename(), + filename=self._build_filename(window), ) - def _build_filename(self) -> str: + def _build_filename(self, window: FocusTimeWindow) -> str: if not self._serializer.extension: raise ValueError("Serializer must declare a file extension") - return f"usage.{self._serializer.extension}" + # Include time window in filename so Vantage (which deduplicates + # by filename) doesn't overwrite previous uploads. + start_str = window.start_time.strftime("%Y%m%dT%H%M%SZ") + end_str = window.end_time.strftime("%Y%m%dT%H%M%SZ") + return f"usage_{start_str}_{end_str}.{self._serializer.extension}" @staticmethod def _sum_column(frame: pl.DataFrame, column: str) -> float: diff --git a/litellm/integrations/focus/focus_logger.py b/litellm/integrations/focus/focus_logger.py index f493d47e29..083b0e1463 100644 --- a/litellm/integrations/focus/focus_logger.py +++ b/litellm/integrations/focus/focus_logger.py @@ -53,7 +53,15 @@ class FocusLogger(CustomLogger): if interval_seconds is not None else os.getenv("FOCUS_INTERVAL_SECONDS") ) - self.interval_seconds = int(raw_interval) if raw_interval is not None else None + self.interval_seconds: Optional[int] = None + if raw_interval is not None: + try: + self.interval_seconds = int(raw_interval) + except (ValueError, TypeError): + verbose_logger.warning( + "Invalid FOCUS_INTERVAL_SECONDS value: %s, ignoring", + raw_interval, + ) env_prefix = os.getenv("FOCUS_PREFIX") self.prefix: str = ( prefix @@ -84,7 +92,13 @@ class FocusLogger(CustomLogger): start_time_utc: Optional[datetime] = None, end_time_utc: Optional[datetime] = None, ) -> None: - """Public hook to trigger export immediately.""" + """Public hook to trigger export immediately. + + When called without time bounds (manual /vantage/export with no + start/end), exports **all** available data instead of the last + scheduled window. The hourly/daily window only applies to + automatic scheduler runs. + """ if bool(start_time_utc) ^ bool(end_time_utc): raise ValueError( "start_time_utc and end_time_utc must be provided together" @@ -96,9 +110,10 @@ class FocusLogger(CustomLogger): end_time=end_time_utc, frequency=self.frequency, ) + await self._export_window(window=window, limit=limit) else: - window = self._compute_time_window(datetime.now(timezone.utc)) - await self._export_window(window=window, limit=limit) + # No time bounds → export all available data + await self._export_all(limit=limit) async def dry_run_export_usage_data( self, limit: Optional[int] = DEFAULT_DRY_RUN_LIMIT @@ -139,11 +154,15 @@ class FocusLogger(CustomLogger): ) -> None: """Register the export cron/interval job with the provided scheduler.""" - focus_loggers: List[ - CustomLogger - ] = litellm.logging_callback_manager.get_custom_loggers_for_type( - callback_type=FocusLogger - ) + # Use exact type match to exclude subclasses like VantageLogger, + # which have their own dedicated scheduling method. + focus_loggers: List[CustomLogger] = [ + cb + for cb in litellm.logging_callback_manager.get_custom_loggers_for_type( + callback_type=FocusLogger + ) + if type(cb) is FocusLogger + ] if not focus_loggers: verbose_logger.debug( "No Focus export logger registered; skipping scheduler" @@ -180,6 +199,15 @@ class FocusLogger(CustomLogger): window = self._compute_time_window(datetime.now(timezone.utc)) await self._export_window(window=window, limit=None) + async def _export_all( + self, + *, + limit: Optional[int], + ) -> None: + """Export all available data without a time window filter.""" + engine = self._ensure_engine() + await engine.export_all(limit=limit) + async def _export_window( self, *, diff --git a/litellm/integrations/focus/schema.py b/litellm/integrations/focus/schema.py index ac2f33dad0..c06ca9982a 100644 --- a/litellm/integrations/focus/schema.py +++ b/litellm/integrations/focus/schema.py @@ -43,7 +43,13 @@ FOCUS_NORMALIZED_SCHEMA = pl.Schema( ("SubAccountId", pl.String), ("SubAccountName", pl.String), ("SubAccountType", pl.String), - ("Tags", pl.Object), + # Changed from pl.Object to pl.String to hold JSON metadata + # (team_id, user_id, etc.) needed by Vantage Token Allocation. + # This schema is only used for creating empty DataFrames (e.g. + # when transform() receives no rows). Parquet files are + # self-describing and embed their own schema, so existing S3 + # exports are unaffected. Previously Tags was always None. + ("Tags", pl.String), ] ) diff --git a/litellm/integrations/focus/serializers/__init__.py b/litellm/integrations/focus/serializers/__init__.py index 18187bf73e..bdbf520454 100644 --- a/litellm/integrations/focus/serializers/__init__.py +++ b/litellm/integrations/focus/serializers/__init__.py @@ -1,6 +1,7 @@ """Serializer package exports for Focus integration.""" from .base import FocusSerializer +from .csv import FocusCsvSerializer from .parquet import FocusParquetSerializer -__all__ = ["FocusSerializer", "FocusParquetSerializer"] +__all__ = ["FocusSerializer", "FocusCsvSerializer", "FocusParquetSerializer"] diff --git a/litellm/integrations/focus/serializers/csv.py b/litellm/integrations/focus/serializers/csv.py new file mode 100644 index 0000000000..8e33c557be --- /dev/null +++ b/litellm/integrations/focus/serializers/csv.py @@ -0,0 +1,33 @@ +"""CSV serializer for Focus export.""" + +from __future__ import annotations + +import io + +import polars as pl + +from .base import FocusSerializer + + +class FocusCsvSerializer(FocusSerializer): + """Serialize normalized Focus frames to CSV bytes.""" + + extension = "csv" + + def serialize(self, frame: pl.DataFrame) -> bytes: + """Encode the provided frame as a CSV payload.""" + # Cast Decimal columns to Float64 so CSV output uses standard + # floating-point notation (e.g. "1.5") instead of fixed-point + # strings (e.g. "1.500000") that some parsers may reject. + decimal_cols = [ + col + for col, dtype in zip(frame.columns, frame.dtypes) + if isinstance(dtype, pl.Decimal) + ] + if decimal_cols: + frame = frame.with_columns( + [pl.col(c).cast(pl.Float64) for c in decimal_cols] + ) + buffer = io.BytesIO() + frame.write_csv(buffer) + return buffer.getvalue() diff --git a/litellm/integrations/focus/transformer.py b/litellm/integrations/focus/transformer.py index cac12b7be1..b7d28e3dbb 100644 --- a/litellm/integrations/focus/transformer.py +++ b/litellm/integrations/focus/transformer.py @@ -2,6 +2,7 @@ from __future__ import annotations +import json from datetime import timedelta import polars as pl @@ -9,6 +10,38 @@ import polars as pl from .schema import FOCUS_NORMALIZED_SCHEMA +_TAG_KEYS = ( + "team_id", + "team_alias", + "user_id", + "user_email", + "api_key_alias", + "model", + "model_group", + "custom_llm_provider", +) + + +def _build_tags_expr(available_keys: list[str]) -> pl.Expr: + """Build a Polars expression that produces a JSON Tags string per row. + + Uses ``pl.struct`` + ``map_elements`` to avoid materialising the entire + DataFrame to a list of Python dicts. The JSON serialisation callback + still runs in Python (GIL-bound), but struct-packing and loop dispatch + are handled by Polars' Rust engine. + """ + + def _struct_to_json(row: dict) -> str: + tags = {k: str(v) for k, v in row.items() if v is not None} + return json.dumps(tags) if tags else "{}" + + return ( + pl.struct(available_keys) + .map_elements(_struct_to_json, return_dtype=pl.String) + .alias("Tags") + ) + + class FocusTransformer: """Transforms LiteLLM DB rows into Focus-compatible schema.""" @@ -19,6 +52,13 @@ class FocusTransformer: if frame.is_empty(): return pl.DataFrame(schema=self.schema) + # Build Tags JSON from metadata columns using vectorized Polars expression + available_keys = [k for k in _TAG_KEYS if k in frame.columns] + if available_keys: + frame = frame.with_columns(_build_tags_expr(available_keys)) + else: + frame = frame.with_columns(pl.lit("{}").alias("Tags")) + # derive period start/end from usage date frame = frame.with_columns( pl.col("date") @@ -86,5 +126,5 @@ class FocusTransformer: pl.col("team_id").cast(pl.String).alias("SubAccountId"), pl.col("team_alias").cast(pl.String).alias("SubAccountName"), none_str.alias("SubAccountType"), - none_str.alias("Tags"), + pl.col("Tags").cast(pl.String).alias("Tags"), ) diff --git a/litellm/integrations/langfuse/langfuse.py b/litellm/integrations/langfuse/langfuse.py index 9d6ddd0f1e..6ac337d99a 100644 --- a/litellm/integrations/langfuse/langfuse.py +++ b/litellm/integrations/langfuse/langfuse.py @@ -610,7 +610,7 @@ class LangFuseLogger: trace_id = cast(Optional[str], standard_logging_object.get("trace_id")) # Fallback to litellm_call_id if no trace_id found if trace_id is None: - trace_id = litellm_call_id + trace_id = kwargs.get("litellm_trace_id") or litellm_call_id existing_trace_id = clean_metadata.pop("existing_trace_id", None) # If existing_trace_id is provided, use it as the trace_id to return # This allows continuing an existing trace while still returning the correct trace_id diff --git a/litellm/integrations/langfuse/langfuse_prompt_management.py b/litellm/integrations/langfuse/langfuse_prompt_management.py index f0e1e30b68..03a93cd988 100644 --- a/litellm/integrations/langfuse/langfuse_prompt_management.py +++ b/litellm/integrations/langfuse/langfuse_prompt_management.py @@ -338,14 +338,17 @@ class LangfusePromptManagement(LangFuseLogger, PromptManagementBase, CustomLogge Optional[StandardLoggingPayload], kwargs.get("standard_logging_object", None), ) - if standard_logging_object is None: - return + status_message = str(kwargs.get("exception", "Unknown error")) + if standard_logging_object is not None: + status_message = standard_logging_object.get( + "error_str", None + ) or status_message langfuse_logger_to_use.log_event_on_langfuse( start_time=start_time, end_time=end_time, response_obj=None, user_id=kwargs.get("user", None), - status_message=standard_logging_object["error_str"], + status_message=status_message, level="ERROR", kwargs=kwargs, ) diff --git a/litellm/integrations/vantage/__init__.py b/litellm/integrations/vantage/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/litellm/integrations/vantage/vantage_logger.py b/litellm/integrations/vantage/vantage_logger.py new file mode 100644 index 0000000000..6689d93274 --- /dev/null +++ b/litellm/integrations/vantage/vantage_logger.py @@ -0,0 +1,144 @@ +"""Vantage logger — thin wrapper around the Focus export pipeline. + +Configures FocusLogger to use the Vantage API destination with CSV format +so users can simply set ``success_callback: ["vantage"]`` in their proxy config. +""" + +from __future__ import annotations + +import os +from typing import TYPE_CHECKING, Any, Dict, List, Optional, cast + +import litellm +from litellm._logging import verbose_logger +from litellm.integrations.custom_logger import CustomLogger +from litellm.integrations.focus.focus_logger import FocusLogger + +if TYPE_CHECKING: + from apscheduler.schedulers.asyncio import AsyncIOScheduler +else: + AsyncIOScheduler = Any + +VANTAGE_USAGE_DATA_JOB_NAME = "vantage_export_usage_data" + + +class VantageLogger(FocusLogger): + """FocusLogger pre-configured for Vantage (CSV format, Vantage API destination). + + Environment Variables: + VANTAGE_API_KEY: Vantage API key for authentication + VANTAGE_INTEGRATION_TOKEN: Vantage integration token for the cost-import endpoint + VANTAGE_BASE_URL: Optional base URL override (default: https://api.vantage.sh) + VANTAGE_EXPORT_FREQUENCY: Export frequency — "hourly" (default), "daily", or "interval" + VANTAGE_EXPORT_INTERVAL_SECONDS: Interval in seconds when frequency is "interval" + """ + + def __init__( + self, + *, + api_key: Optional[str] = None, + integration_token: Optional[str] = None, + base_url: Optional[str] = None, + frequency: Optional[str] = None, + interval_seconds: Optional[int] = None, + **kwargs: Any, + ) -> None: + resolved_api_key = api_key or os.getenv("VANTAGE_API_KEY") + resolved_token = integration_token or os.getenv("VANTAGE_INTEGRATION_TOKEN") + resolved_base_url = base_url or os.getenv( + "VANTAGE_BASE_URL", "https://api.vantage.sh" + ) + resolved_frequency = ( + frequency or os.getenv("VANTAGE_EXPORT_FREQUENCY") or "hourly" + ).lower() + + raw_interval = interval_seconds or os.getenv("VANTAGE_EXPORT_INTERVAL_SECONDS") + resolved_interval: Optional[int] = None + if raw_interval is not None: + try: + resolved_interval = int(raw_interval) + except (ValueError, TypeError): + verbose_logger.warning( + "Invalid VANTAGE_EXPORT_INTERVAL_SECONDS value: %s, ignoring", + raw_interval, + ) + + destination_config: Dict[str, Any] = {} + if resolved_api_key: + destination_config["api_key"] = resolved_api_key + if resolved_token: + destination_config["integration_token"] = resolved_token + if resolved_base_url: + destination_config["base_url"] = resolved_base_url + + super().__init__( + provider="vantage", + export_format="csv", + frequency=resolved_frequency, + interval_seconds=resolved_interval, + prefix="vantage_exports", + destination_config=destination_config, + **kwargs, + ) + + verbose_logger.debug( + "VantageLogger initialized (integration_token=%s)", + resolved_token[:4] + "***" if resolved_token and len(resolved_token) > 4 else "***", + ) + + async def initialize_focus_export_job(self) -> None: + """Override to use the Vantage-specific pod lock key. + + Without this, VantageLogger and FocusLogger would compete for the + same ``FOCUS_USAGE_DATA_JOB_NAME`` lock, causing one to silently + skip its export cycle when both are configured simultaneously. + """ + from litellm.proxy.proxy_server import proxy_logging_obj + + pod_lock_manager = None + if proxy_logging_obj is not None: + writer = getattr(proxy_logging_obj, "db_spend_update_writer", None) + if writer is not None: + pod_lock_manager = getattr(writer, "pod_lock_manager", None) + + if pod_lock_manager and pod_lock_manager.redis_cache: + acquired = await pod_lock_manager.acquire_lock( + cronjob_id=VANTAGE_USAGE_DATA_JOB_NAME + ) + if not acquired: + verbose_logger.debug("Vantage export: unable to acquire pod lock") + return + try: + await self._run_scheduled_export() + finally: + await pod_lock_manager.release_lock( + cronjob_id=VANTAGE_USAGE_DATA_JOB_NAME + ) + else: + await self._run_scheduled_export() + + @staticmethod + async def init_vantage_background_job( + scheduler: AsyncIOScheduler, + ) -> None: + """Register the Vantage export job with the provided scheduler.""" + vantage_loggers: List[ + CustomLogger + ] = litellm.logging_callback_manager.get_custom_loggers_for_type( + callback_type=VantageLogger + ) + if not vantage_loggers: + verbose_logger.debug( + "No Vantage logger registered; skipping scheduler" + ) + return + + vantage_logger = cast(VantageLogger, vantage_loggers[0]) + trigger_kwargs = vantage_logger._build_scheduler_trigger() + scheduler.add_job( + vantage_logger.initialize_focus_export_job, + **trigger_kwargs, + ) + + +__all__ = ["VantageLogger"] diff --git a/litellm/interactions/main.py b/litellm/interactions/main.py index 2b1786ac3a..ab429ef6db 100644 --- a/litellm/interactions/main.py +++ b/litellm/interactions/main.py @@ -34,16 +34,7 @@ Usage: import asyncio import contextvars from functools import partial -from typing import ( - Any, - AsyncIterator, - Coroutine, - Dict, - Iterator, - List, - Optional, - Union, -) +from typing import Any, AsyncIterator, Coroutine, Dict, Iterator, List, Optional, Union import httpx @@ -306,7 +297,8 @@ def create( **kwargs, ) - litellm_logging_obj.update_environment_variables( + litellm_logging_obj.update_from_kwargs( + kwargs=kwargs, model=model, optional_params=dict(optional_params), litellm_params={"litellm_call_id": litellm_call_id}, @@ -416,7 +408,8 @@ def get( f"Interactions API not supported for: {custom_llm_provider}" ) - litellm_logging_obj.update_environment_variables( + litellm_logging_obj.update_from_kwargs( + kwargs=kwargs, model=None, optional_params={"interaction_id": interaction_id}, litellm_params={"litellm_call_id": litellm_call_id}, @@ -519,7 +512,8 @@ def delete( f"Interactions API not supported for: {custom_llm_provider}" ) - litellm_logging_obj.update_environment_variables( + litellm_logging_obj.update_from_kwargs( + kwargs=kwargs, model=None, optional_params={"interaction_id": interaction_id}, litellm_params={"litellm_call_id": litellm_call_id}, @@ -622,7 +616,8 @@ def cancel( f"Interactions API not supported for: {custom_llm_provider}" ) - litellm_logging_obj.update_environment_variables( + litellm_logging_obj.update_from_kwargs( + kwargs=kwargs, model=None, optional_params={"interaction_id": interaction_id}, litellm_params={"litellm_call_id": litellm_call_id}, diff --git a/litellm/litellm_core_utils/core_helpers.py b/litellm/litellm_core_utils/core_helpers.py index ee111f3592..256b16ff31 100644 --- a/litellm/litellm_core_utils/core_helpers.py +++ b/litellm/litellm_core_utils/core_helpers.py @@ -96,6 +96,8 @@ _FINISH_REASON_MAP: dict[str, OpenAIChatCompletionFinishReason] = { "tool_calls": "tool_calls", "function_call": "function_call", "content_filter": "content_filter", + # Anthropic Sonnet 4 + "content_filtered": "content_filter", } diff --git a/litellm/litellm_core_utils/custom_logger_registry.py b/litellm/litellm_core_utils/custom_logger_registry.py index 2d483f7861..f873bfeece 100644 --- a/litellm/litellm_core_utils/custom_logger_registry.py +++ b/litellm/litellm_core_utils/custom_logger_registry.py @@ -24,6 +24,7 @@ from litellm.integrations.datadog.datadog_metrics import DatadogMetricsLogger from litellm.integrations.deepeval import DeepEvalLogger from litellm.integrations.dotprompt import DotpromptManager from litellm.integrations.focus.focus_logger import FocusLogger +from litellm.integrations.vantage.vantage_logger import VantageLogger from litellm.integrations.galileo import GalileoObserve from litellm.integrations.gcs_bucket.gcs_bucket import GCSBucketLogger from litellm.integrations.gcs_pubsub.pub_sub import GcsPubSubLogger @@ -99,6 +100,7 @@ class CustomLoggerRegistry: "gitlab": GitLabPromptManager, "cloudzero": CloudZeroLogger, "focus": FocusLogger, + "vantage": VantageLogger, "posthog": PostHogLogger, } diff --git a/litellm/litellm_core_utils/default_encoding.py b/litellm/litellm_core_utils/default_encoding.py index 1771efba41..24533feecc 100644 --- a/litellm/litellm_core_utils/default_encoding.py +++ b/litellm/litellm_core_utils/default_encoding.py @@ -15,16 +15,19 @@ except (ImportError, AttributeError): __name__, "litellm_core_utils/tokenizers" ) -# Check if the directory is writable. If not, use /tmp as a fallback. -# This is especially important for non-root Docker environments where the package directory is read-only. -is_non_root = os.getenv("LITELLM_NON_ROOT", "").lower() == "true" -if not os.access(filename, os.W_OK) and is_non_root: - filename = "/tmp/tiktoken_cache" - os.makedirs(filename, exist_ok=True) +# Always default TIKTOKEN_CACHE_DIR to the bundled tokenizers directory +# unless the user explicitly overrides it via CUSTOM_TIKTOKEN_CACHE_DIR. +# This keeps tiktoken fully offline-capable by default (see #1071). +custom_cache_dir = os.getenv("CUSTOM_TIKTOKEN_CACHE_DIR") +if custom_cache_dir: + # If the user opts into a custom cache dir, ensure it exists. + os.makedirs(custom_cache_dir, exist_ok=True) + cache_dir = custom_cache_dir +else: + cache_dir = filename + +os.environ["TIKTOKEN_CACHE_DIR"] = cache_dir # use local copy of tiktoken b/c of - https://github.com/BerriAI/litellm/issues/1071 -os.environ["TIKTOKEN_CACHE_DIR"] = os.getenv( - "CUSTOM_TIKTOKEN_CACHE_DIR", filename -) # use local copy of tiktoken b/c of - https://github.com/BerriAI/litellm/issues/1071 import tiktoken import time import random @@ -45,3 +48,4 @@ for attempt in range(_max_retries): # Exponential backoff with jitter to reduce collision probability delay = _retry_delay * (2**attempt) + random.uniform(0, 0.1) time.sleep(delay) + diff --git a/litellm/litellm_core_utils/litellm_logging.py b/litellm/litellm_core_utils/litellm_logging.py index e22d057bb6..a92f4cb9ec 100644 --- a/litellm/litellm_core_utils/litellm_logging.py +++ b/litellm/litellm_core_utils/litellm_logging.py @@ -352,9 +352,9 @@ class Logging(LiteLLMLoggingBaseClass): ) self.function_id = function_id self.streaming_chunks: List[Any] = [] # for generating complete stream response - self.sync_streaming_chunks: List[ - Any - ] = [] # for generating complete stream response + self.sync_streaming_chunks: List[Any] = ( + [] + ) # for generating complete stream response self.log_raw_request_response = log_raw_request_response # Initialize dynamic callbacks @@ -406,7 +406,7 @@ class Logging(LiteLLMLoggingBaseClass): self.passthrough_guardrails_config: Optional[Dict[str, Any]] = None self.model_call_details: Dict[str, Any] = { - "litellm_trace_id": litellm_trace_id, + "litellm_trace_id": self.litellm_trace_id, "litellm_call_id": litellm_call_id, "input": _input, "litellm_params": litellm_params, @@ -568,6 +568,42 @@ class Logging(LiteLLMLoggingBaseClass): if "custom_llm_provider" in self.model_call_details: self.custom_llm_provider = self.model_call_details["custom_llm_provider"] + def update_from_kwargs( + self, + kwargs: Dict, + litellm_params: Optional[Dict] = None, + optional_params: Optional[Dict] = None, + model: Optional[str] = None, + user: Optional[str] = None, + **additional_params, + ): + """ + Convenience wrapper around update_environment_variables that + automatically extracts metadata/litellm_metadata from kwargs, + so callers don't need to manually plumb them into litellm_params. + """ + base_litellm_params: Dict[str, Any] = {} + + if "metadata" in kwargs: + base_litellm_params["metadata"] = kwargs["metadata"] + if "litellm_metadata" in kwargs and isinstance( + kwargs["litellm_metadata"], dict + ): + base_litellm_params["litellm_metadata"] = kwargs["litellm_metadata"] + if "metadata" not in base_litellm_params: + base_litellm_params["metadata"] = kwargs["litellm_metadata"].copy() + + if litellm_params: + base_litellm_params.update(litellm_params) + + self.update_environment_variables( + litellm_params=base_litellm_params, + optional_params=optional_params or {}, + model=model, + user=user, + **additional_params, + ) + def update_messages(self, messages: List[AllMessageValues]): """ Update the logged value of the messages in the model_call_details @@ -746,9 +782,9 @@ class Logging(LiteLLMLoggingBaseClass): prompt_spec=prompt_spec, dynamic_callback_params=dynamic_callback_params, ): - self.model_call_details[ - "prompt_integration" - ] = logger.__class__.__name__ + self.model_call_details["prompt_integration"] = ( + logger.__class__.__name__ + ) return logger except Exception: # If check fails, continue to next logger @@ -816,9 +852,9 @@ class Logging(LiteLLMLoggingBaseClass): if anthropic_cache_control_logger := AnthropicCacheControlHook.get_custom_logger_for_anthropic_cache_control_hook( non_default_params ): - self.model_call_details[ - "prompt_integration" - ] = anthropic_cache_control_logger.__class__.__name__ + self.model_call_details["prompt_integration"] = ( + anthropic_cache_control_logger.__class__.__name__ + ) return anthropic_cache_control_logger ######################################################### @@ -830,9 +866,9 @@ class Logging(LiteLLMLoggingBaseClass): internal_usage_cache=None, llm_router=None, ) - self.model_call_details[ - "prompt_integration" - ] = vector_store_custom_logger.__class__.__name__ + self.model_call_details["prompt_integration"] = ( + vector_store_custom_logger.__class__.__name__ + ) # Add to global callbacks so post-call hooks are invoked if ( vector_store_custom_logger @@ -892,9 +928,9 @@ class Logging(LiteLLMLoggingBaseClass): model ): # if model name was changes pre-call, overwrite the initial model call name with the new one self.model_call_details["model"] = model - self.model_call_details["litellm_params"][ - "api_base" - ] = self._get_masked_api_base(additional_args.get("api_base", "")) + self.model_call_details["litellm_params"]["api_base"] = ( + self._get_masked_api_base(additional_args.get("api_base", "")) + ) def pre_call(self, input, api_key, model=None, additional_args={}): # noqa: PLR0915 # Log the exact input to the LLM API @@ -923,10 +959,10 @@ class Logging(LiteLLMLoggingBaseClass): try: # [Non-blocking Extra Debug Information in metadata] if turn_off_message_logging is True: - _metadata[ - "raw_request" - ] = "redacted by litellm. \ + _metadata["raw_request"] = ( + "redacted by litellm. \ 'litellm.turn_off_message_logging=True'" + ) else: curl_command = self._get_request_curl_command( api_base=additional_args.get("api_base", ""), @@ -937,34 +973,34 @@ class Logging(LiteLLMLoggingBaseClass): _metadata["raw_request"] = str(curl_command) # split up, so it's easier to parse in the UI - self.model_call_details[ - "raw_request_typed_dict" - ] = RawRequestTypedDict( - raw_request_api_base=str( - additional_args.get("api_base") or "" - ), - raw_request_body=self._get_raw_request_body( - additional_args.get("complete_input_dict", {}) - ), - # NOTE: setting ignore_sensitive_headers to True will cause - # the Authorization header to be leaked when calls to the health - # endpoint are made and fail. - raw_request_headers=self._get_masked_headers( - additional_args.get("headers", {}) or {}, - ), - error=None, + self.model_call_details["raw_request_typed_dict"] = ( + RawRequestTypedDict( + raw_request_api_base=str( + additional_args.get("api_base") or "" + ), + raw_request_body=self._get_raw_request_body( + additional_args.get("complete_input_dict", {}) + ), + # NOTE: setting ignore_sensitive_headers to True will cause + # the Authorization header to be leaked when calls to the health + # endpoint are made and fail. + raw_request_headers=self._get_masked_headers( + additional_args.get("headers", {}) or {}, + ), + error=None, + ) ) except Exception as e: - self.model_call_details[ - "raw_request_typed_dict" - ] = RawRequestTypedDict( - error=str(e), + self.model_call_details["raw_request_typed_dict"] = ( + RawRequestTypedDict( + error=str(e), + ) ) - _metadata[ - "raw_request" - ] = "Unable to Log \ + _metadata["raw_request"] = ( + "Unable to Log \ raw request: {}".format( - str(e) + str(e) + ) ) if getattr(self, "logger_fn", None) and callable(self.logger_fn): try: @@ -1265,13 +1301,13 @@ class Logging(LiteLLMLoggingBaseClass): for callback in callbacks: try: if isinstance(callback, CustomLogger): - response: Optional[ - MCPPostCallResponseObject - ] = await callback.async_post_mcp_tool_call_hook( - kwargs=kwargs, - response_obj=post_mcp_tool_call_response_obj, - start_time=start_time, - end_time=end_time, + response: Optional[MCPPostCallResponseObject] = ( + await callback.async_post_mcp_tool_call_hook( + kwargs=kwargs, + response_obj=post_mcp_tool_call_response_obj, + start_time=start_time, + end_time=end_time, + ) ) ###################################################################### # if any of the callbacks modify the response, use the modified response @@ -1466,9 +1502,9 @@ class Logging(LiteLLMLoggingBaseClass): verbose_logger.debug( f"response_cost_failure_debug_information: {debug_info}" ) - self.model_call_details[ - "response_cost_failure_debug_information" - ] = debug_info + self.model_call_details["response_cost_failure_debug_information"] = ( + debug_info + ) return None try: @@ -1494,9 +1530,9 @@ class Logging(LiteLLMLoggingBaseClass): verbose_logger.debug( f"response_cost_failure_debug_information: {debug_info}" ) - self.model_call_details[ - "response_cost_failure_debug_information" - ] = debug_info + self.model_call_details["response_cost_failure_debug_information"] = ( + debug_info + ) return None @@ -1652,9 +1688,9 @@ class Logging(LiteLLMLoggingBaseClass): result=logging_result ) - self.model_call_details[ - "standard_logging_object" - ] = self._build_standard_logging_payload(logging_result, start_time, end_time) + self.model_call_details["standard_logging_object"] = ( + self._build_standard_logging_payload(logging_result, start_time, end_time) + ) if ( standard_logging_payload := self.model_call_details.get( @@ -1732,9 +1768,9 @@ class Logging(LiteLLMLoggingBaseClass): end_time = datetime.datetime.now() if self.completion_start_time is None: self.completion_start_time = end_time - self.model_call_details[ - "completion_start_time" - ] = self.completion_start_time + self.model_call_details["completion_start_time"] = ( + self.completion_start_time + ) self.model_call_details["log_event_type"] = "successful_api_call" self.model_call_details["end_time"] = end_time @@ -1771,10 +1807,10 @@ class Logging(LiteLLMLoggingBaseClass): end_time=end_time, ) elif isinstance(result, dict) or isinstance(result, list): - self.model_call_details[ - "standard_logging_object" - ] = self._build_standard_logging_payload( - result, start_time, end_time + self.model_call_details["standard_logging_object"] = ( + self._build_standard_logging_payload( + result, start_time, end_time + ) ) if ( standard_logging_payload := self.model_call_details.get( @@ -1783,9 +1819,9 @@ class Logging(LiteLLMLoggingBaseClass): ) is not None: emit_standard_logging_payload(standard_logging_payload) elif standard_logging_object is not None: - self.model_call_details[ - "standard_logging_object" - ] = standard_logging_object + self.model_call_details["standard_logging_object"] = ( + standard_logging_object + ) else: self.model_call_details["response_cost"] = None @@ -1943,17 +1979,17 @@ class Logging(LiteLLMLoggingBaseClass): verbose_logger.debug( "Logging Details LiteLLM-Success Call streaming complete" ) - self.model_call_details[ - "complete_streaming_response" - ] = complete_streaming_response - self.model_call_details[ - "response_cost" - ] = self._response_cost_calculator(result=complete_streaming_response) + self.model_call_details["complete_streaming_response"] = ( + complete_streaming_response + ) + self.model_call_details["response_cost"] = ( + self._response_cost_calculator(result=complete_streaming_response) + ) ## STANDARDIZED LOGGING PAYLOAD - self.model_call_details[ - "standard_logging_object" - ] = self._build_standard_logging_payload( - complete_streaming_response, start_time, end_time + self.model_call_details["standard_logging_object"] = ( + self._build_standard_logging_payload( + complete_streaming_response, start_time, end_time + ) ) if ( standard_logging_payload := self.model_call_details.get( @@ -2287,10 +2323,10 @@ class Logging(LiteLLMLoggingBaseClass): ) else: if self.stream and complete_streaming_response: - self.model_call_details[ - "complete_response" - ] = self.model_call_details.get( - "complete_streaming_response", {} + self.model_call_details["complete_response"] = ( + self.model_call_details.get( + "complete_streaming_response", {} + ) ) result = self.model_call_details["complete_response"] openMeterLogger.log_success_event( @@ -2314,10 +2350,10 @@ class Logging(LiteLLMLoggingBaseClass): ) else: if self.stream and complete_streaming_response: - self.model_call_details[ - "complete_response" - ] = self.model_call_details.get( - "complete_streaming_response", {} + self.model_call_details["complete_response"] = ( + self.model_call_details.get( + "complete_streaming_response", {} + ) ) result = self.model_call_details["complete_response"] @@ -2456,9 +2492,9 @@ class Logging(LiteLLMLoggingBaseClass): if complete_streaming_response is not None: print_verbose("Async success callbacks: Got a complete streaming response") - self.model_call_details[ - "async_complete_streaming_response" - ] = complete_streaming_response + self.model_call_details["async_complete_streaming_response"] = ( + complete_streaming_response + ) try: if self.model_call_details.get("cache_hit", False) is True: @@ -2469,10 +2505,10 @@ class Logging(LiteLLMLoggingBaseClass): model_call_details=self.model_call_details ) # base_model defaults to None if not set on model_info - self.model_call_details[ - "response_cost" - ] = self._response_cost_calculator( - result=complete_streaming_response + self.model_call_details["response_cost"] = ( + self._response_cost_calculator( + result=complete_streaming_response + ) ) verbose_logger.debug( @@ -2485,10 +2521,10 @@ class Logging(LiteLLMLoggingBaseClass): self.model_call_details["response_cost"] = None ## STANDARDIZED LOGGING PAYLOAD - self.model_call_details[ - "standard_logging_object" - ] = self._build_standard_logging_payload( - complete_streaming_response, start_time, end_time + self.model_call_details["standard_logging_object"] = ( + self._build_standard_logging_payload( + complete_streaming_response, start_time, end_time + ) ) # print standard logging payload @@ -2515,9 +2551,9 @@ class Logging(LiteLLMLoggingBaseClass): # _success_handler_helper_fn if self.model_call_details.get("standard_logging_object") is None: ## STANDARDIZED LOGGING PAYLOAD - self.model_call_details[ - "standard_logging_object" - ] = self._build_standard_logging_payload(result, start_time, end_time) + self.model_call_details["standard_logging_object"] = ( + self._build_standard_logging_payload(result, start_time, end_time) + ) # print standard logging payload if ( @@ -2760,18 +2796,18 @@ class Logging(LiteLLMLoggingBaseClass): ## STANDARDIZED LOGGING PAYLOAD - self.model_call_details[ - "standard_logging_object" - ] = get_standard_logging_object_payload( - kwargs=self.model_call_details, - init_response_obj={}, - start_time=start_time, - end_time=end_time, - logging_obj=self, - status="failure", - error_str=str(exception), - original_exception=exception, - standard_built_in_tools_params=self.standard_built_in_tools_params, + self.model_call_details["standard_logging_object"] = ( + get_standard_logging_object_payload( + kwargs=self.model_call_details, + init_response_obj={}, + start_time=start_time, + end_time=end_time, + logging_obj=self, + status="failure", + error_str=str(exception), + original_exception=exception, + standard_built_in_tools_params=self.standard_built_in_tools_params, + ) ) return start_time, end_time @@ -2950,7 +2986,7 @@ class Logging(LiteLLMLoggingBaseClass): user_id=kwargs.get("user", None), status_message=str(exception), level="ERROR", - kwargs=self.model_call_details, + kwargs=kwargs, ) if _response is not None and isinstance(_response, dict): _trace_id = _response.get("trace_id", None) @@ -3735,9 +3771,9 @@ def _init_custom_logger_compatible_class( # noqa: PLR0915 service_name=arize_config.project_name, ) - os.environ[ - "OTEL_EXPORTER_OTLP_TRACES_HEADERS" - ] = f"space_id={arize_config.space_key or arize_config.space_id},api_key={arize_config.api_key}" + os.environ["OTEL_EXPORTER_OTLP_TRACES_HEADERS"] = ( + f"space_id={arize_config.space_key or arize_config.space_id},api_key={arize_config.api_key}" + ) for callback in _in_memory_loggers: if ( isinstance(callback, ArizeLogger) @@ -3763,13 +3799,13 @@ def _init_custom_logger_compatible_class( # noqa: PLR0915 existing_attrs = os.environ.get("OTEL_RESOURCE_ATTRIBUTES", "") # Add openinference.project.name attribute if existing_attrs: - os.environ[ - "OTEL_RESOURCE_ATTRIBUTES" - ] = f"{existing_attrs},openinference.project.name={arize_phoenix_config.project_name}" + os.environ["OTEL_RESOURCE_ATTRIBUTES"] = ( + f"{existing_attrs},openinference.project.name={arize_phoenix_config.project_name}" + ) else: - os.environ[ - "OTEL_RESOURCE_ATTRIBUTES" - ] = f"openinference.project.name={arize_phoenix_config.project_name}" + os.environ["OTEL_RESOURCE_ATTRIBUTES"] = ( + f"openinference.project.name={arize_phoenix_config.project_name}" + ) # Set Phoenix project name from environment variable phoenix_project_name = os.environ.get("PHOENIX_PROJECT_NAME", None) @@ -3777,19 +3813,19 @@ def _init_custom_logger_compatible_class( # noqa: PLR0915 existing_attrs = os.environ.get("OTEL_RESOURCE_ATTRIBUTES", "") # Add openinference.project.name attribute if existing_attrs: - os.environ[ - "OTEL_RESOURCE_ATTRIBUTES" - ] = f"{existing_attrs},openinference.project.name={phoenix_project_name}" + os.environ["OTEL_RESOURCE_ATTRIBUTES"] = ( + f"{existing_attrs},openinference.project.name={phoenix_project_name}" + ) else: - os.environ[ - "OTEL_RESOURCE_ATTRIBUTES" - ] = f"openinference.project.name={phoenix_project_name}" + os.environ["OTEL_RESOURCE_ATTRIBUTES"] = ( + f"openinference.project.name={phoenix_project_name}" + ) # auth can be disabled on local deployments of arize phoenix if arize_phoenix_config.otlp_auth_headers is not None: - os.environ[ - "OTEL_EXPORTER_OTLP_TRACES_HEADERS" - ] = arize_phoenix_config.otlp_auth_headers + os.environ["OTEL_EXPORTER_OTLP_TRACES_HEADERS"] = ( + arize_phoenix_config.otlp_auth_headers + ) for callback in _in_memory_loggers: if ( @@ -3868,11 +3904,20 @@ def _init_custom_logger_compatible_class( # noqa: PLR0915 from litellm.integrations.focus.focus_logger import FocusLogger for callback in _in_memory_loggers: - if isinstance(callback, FocusLogger): + if type(callback) is FocusLogger: # exact match; exclude subclasses like VantageLogger return callback # type: ignore focus_logger = FocusLogger() _in_memory_loggers.append(focus_logger) return focus_logger # type: ignore + elif logging_integration == "vantage": + from litellm.integrations.vantage.vantage_logger import VantageLogger + + for callback in _in_memory_loggers: + if isinstance(callback, VantageLogger): + return callback # type: ignore + vantage_logger = VantageLogger() + _in_memory_loggers.append(vantage_logger) + return vantage_logger # type: ignore elif logging_integration == "deepeval": for callback in _in_memory_loggers: if isinstance(callback, DeepEvalLogger): @@ -3965,9 +4010,9 @@ def _init_custom_logger_compatible_class( # noqa: PLR0915 exporter="otlp_http", endpoint="https://langtrace.ai/api/trace", ) - os.environ[ - "OTEL_EXPORTER_OTLP_TRACES_HEADERS" - ] = f"api_key={os.getenv('LANGTRACE_API_KEY')}" + os.environ["OTEL_EXPORTER_OTLP_TRACES_HEADERS"] = ( + f"api_key={os.getenv('LANGTRACE_API_KEY')}" + ) for callback in _in_memory_loggers: if ( isinstance(callback, OpenTelemetry) @@ -4241,7 +4286,13 @@ def get_custom_logger_compatible_class( # noqa: PLR0915 from litellm.integrations.focus.focus_logger import FocusLogger for callback in _in_memory_loggers: - if isinstance(callback, FocusLogger): + if type(callback) is FocusLogger: # exact match; exclude subclasses like VantageLogger + return callback + elif logging_integration == "vantage": + from litellm.integrations.vantage.vantage_logger import VantageLogger + + for callback in _in_memory_loggers: + if isinstance(callback, VantageLogger): return callback elif logging_integration == "deepeval": for callback in _in_memory_loggers: @@ -4446,15 +4497,17 @@ def use_custom_pricing_for_model(litellm_params: Optional[dict]) -> bool: if litellm_params.get(key) is not None: return True - # Check model_info - metadata: dict = litellm_params.get("metadata", {}) or {} - model_info: dict = metadata.get("model_info", {}) or {} + # Check model_info from metadata or litellm_metadata (generic_api_call routes + # like /responses and /messages store model_info under litellm_metadata) + for metadata_key in ("metadata", "litellm_metadata"): + metadata: dict = litellm_params.get(metadata_key, {}) or {} + model_info: dict = metadata.get("model_info", {}) or {} - if model_info: - matching_keys = _CUSTOM_PRICING_KEYS & model_info.keys() - for key in matching_keys: - if model_info.get(key) is not None: - return True + if model_info: + matching_keys = _CUSTOM_PRICING_KEYS & model_info.keys() + for key in matching_keys: + if model_info.get(key) is not None: + return True return False @@ -4881,10 +4934,10 @@ class StandardLoggingPayloadSetup: for key in StandardLoggingHiddenParams.__annotations__.keys(): if key in hidden_params: if key == "additional_headers": - clean_hidden_params[ - "additional_headers" - ] = StandardLoggingPayloadSetup.get_additional_headers( - hidden_params[key] + clean_hidden_params["additional_headers"] = ( + StandardLoggingPayloadSetup.get_additional_headers( + hidden_params[key] + ) ) else: clean_hidden_params[key] = hidden_params[key] # type: ignore @@ -5523,9 +5576,9 @@ def scrub_sensitive_keys_in_metadata(litellm_params: Optional[dict]): ): for k, v in metadata["user_api_key_metadata"].items(): if k == "logging": # prevent logging user logging keys - cleaned_user_api_key_metadata[ - k - ] = "scrubbed_by_litellm_for_sensitive_keys" + cleaned_user_api_key_metadata[k] = ( + "scrubbed_by_litellm_for_sensitive_keys" + ) else: cleaned_user_api_key_metadata[k] = v diff --git a/litellm/litellm_core_utils/prompt_templates/factory.py b/litellm/litellm_core_utils/prompt_templates/factory.py index ea1f81f9b3..47272b38ad 100644 --- a/litellm/litellm_core_utils/prompt_templates/factory.py +++ b/litellm/litellm_core_utils/prompt_templates/factory.py @@ -2680,7 +2680,9 @@ def anthropic_messages_pt( # noqa: PLR0915 _content_is_list = "content" in assistant_content_block and isinstance( assistant_content_block["content"], list ) - _content_list = assistant_content_block.get("content") if _content_is_list else None + _content_list = ( + assistant_content_block.get("content") if _content_is_list else None + ) _list_has_thinking = False if _content_is_list and _content_list is not None: for _item in _content_list: diff --git a/litellm/litellm_core_utils/streaming_handler.py b/litellm/litellm_core_utils/streaming_handler.py index db2369d03d..6e991e6911 100644 --- a/litellm/litellm_core_utils/streaming_handler.py +++ b/litellm/litellm_core_utils/streaming_handler.py @@ -31,7 +31,7 @@ from litellm.litellm_core_utils.model_response_utils import ( ) from litellm.litellm_core_utils.redact_messages import LiteLLMLoggingObject from litellm.litellm_core_utils.thread_pool_executor import executor -from litellm.types.llms.openai import ChatCompletionChunk +from litellm.types.llms.openai import OpenAIChatCompletionChunk from litellm.types.router import GenericLiteLLMParams from litellm.types.utils import ( Delta, @@ -745,7 +745,7 @@ class CustomStreamWrapper: def copy_model_response_level_provider_specific_fields( self, - original_chunk: Union[ModelResponseStream, ChatCompletionChunk], + original_chunk: Union[ModelResponseStream, OpenAIChatCompletionChunk], model_response: ModelResponseStream, ) -> ModelResponseStream: """ @@ -1012,6 +1012,15 @@ class CustomStreamWrapper: # if delta is None _is_delta_empty = self.is_delta_empty(delta=model_response.choices[0].delta) + # Preserve custom attributes from original chunk (applies to both + # empty and non-empty delta final chunks). + _original_chunk = response_obj.get("original_chunk", None) + if _original_chunk is not None: + preserve_upstream_non_openai_attributes( + model_response=model_response, + original_chunk=_original_chunk, + ) + if _is_delta_empty: model_response.choices[0].delta = Delta( content=None diff --git a/litellm/llms/anthropic/chat/guardrail_translation/handler.py b/litellm/llms/anthropic/chat/guardrail_translation/handler.py index 0bc0777e37..5372757cbb 100644 --- a/litellm/llms/anthropic/chat/guardrail_translation/handler.py +++ b/litellm/llms/anthropic/chat/guardrail_translation/handler.py @@ -127,7 +127,15 @@ class AnthropicMessagesHandler(BaseTranslation): guardrailed_texts = guardrailed_inputs.get("texts", []) guardrailed_tools = guardrailed_inputs.get("tools") if guardrailed_tools is not None: - data["tools"] = guardrailed_tools + # Convert tools back from OpenAI format to Anthropic format + anthropic_config = AnthropicConfig() + anthropic_tools: List[AllAnthropicToolsValues] = [] + for tool in guardrailed_tools: + converted_tool, mcp_server = anthropic_config._map_tool_helper(tool) + if converted_tool is not None: + anthropic_tools.append(converted_tool) + # Note: MCP servers are handled separately in the main transformation + data["tools"] = anthropic_tools # Step 3: Map guardrail responses back to original message structure await self._apply_guardrail_responses_to_input( diff --git a/litellm/llms/anthropic/chat/handler.py b/litellm/llms/anthropic/chat/handler.py index 72cc7ecd9c..5eebebc2e2 100644 --- a/litellm/llms/anthropic/chat/handler.py +++ b/litellm/llms/anthropic/chat/handler.py @@ -23,6 +23,9 @@ import litellm import litellm.litellm_core_utils import litellm.types import litellm.types.utils +from litellm.anthropic_beta_headers_manager import ( + update_request_with_filtered_beta, +) from litellm.constants import RESPONSE_FORMAT_TOOL_NAME from litellm.litellm_core_utils.core_helpers import map_finish_reason from litellm.llms.custom_httpx.http_handler import ( @@ -58,9 +61,6 @@ from litellm.types.utils import ( from ...base import BaseLLM from ..common_utils import AnthropicError, process_anthropic_headers -from litellm.anthropic_beta_headers_manager import ( - update_headers_with_filtered_beta, -) from .transformation import AnthropicConfig if TYPE_CHECKING: @@ -339,10 +339,6 @@ class AnthropicChatCompletion(BaseLLM): litellm_params=litellm_params, ) - headers = update_headers_with_filtered_beta( - headers=headers, provider=custom_llm_provider - ) - config = ProviderConfigManager.get_provider_chat_config( model=model, provider=LlmProviders(custom_llm_provider), @@ -360,6 +356,12 @@ class AnthropicChatCompletion(BaseLLM): headers=headers, ) + headers, data = update_request_with_filtered_beta( + headers=headers, + request_data=data, + provider=custom_llm_provider, + ) + ## LOGGING logging_obj.pre_call( input=messages, diff --git a/litellm/llms/anthropic/chat/transformation.py b/litellm/llms/anthropic/chat/transformation.py index 1b912bfc2a..47cdd8287e 100644 --- a/litellm/llms/anthropic/chat/transformation.py +++ b/litellm/llms/anthropic/chat/transformation.py @@ -55,7 +55,10 @@ from litellm.types.utils import ( CompletionTokensDetailsWrapper, ) from litellm.types.utils import Message as LitellmMessage -from litellm.types.utils import PromptTokensDetailsWrapper, ServerToolUse +from litellm.types.utils import ( + PromptTokensDetailsWrapper, + ServerToolUse, +) from litellm.utils import ( ModelResponse, Usage, @@ -420,6 +423,7 @@ class AnthropicConfig(AnthropicModelInfo, BaseConfig): _tool = AnthropicMessagesTool( name=tool["function"]["name"], input_schema=input_anthropic_schema, + type="custom", ) _description = tool["function"].get("description") diff --git a/litellm/llms/anthropic/experimental_pass_through/adapters/transformation.py b/litellm/llms/anthropic/experimental_pass_through/adapters/transformation.py index 43a6fa8045..c1a6bd6750 100644 --- a/litellm/llms/anthropic/experimental_pass_through/adapters/transformation.py +++ b/litellm/llms/anthropic/experimental_pass_through/adapters/transformation.py @@ -68,6 +68,7 @@ from litellm.litellm_core_utils.prompt_templates.common_utils import ( parse_tool_call_arguments, ) from litellm.types.llms.anthropic import ( + ANTHROPIC_HOSTED_TOOLS, AllAnthropicToolsValues, AnthopicMessagesAssistantMessageParam, AnthropicFinishReason, @@ -771,7 +772,15 @@ class LiteLLMAnthropicMessagesAdapter: new_tools: List[ChatCompletionToolParam] = [] tool_name_mapping: Dict[str, str] = {} mapped_tool_params = ["name", "input_schema", "description", "cache_control"] + for tool in tools: + # Check if this is an Anthropic-native tool that should be kept as-is + tool_type = tool.get("type", "") + if any(tool_type.startswith(t.value) for t in ANTHROPIC_HOSTED_TOOLS): + # Keep Anthropic-native tools in their original format + new_tools.append(tool) # type: ignore[arg-type] + continue + original_name = tool["name"] truncated_name = truncate_tool_name(original_name) diff --git a/litellm/llms/anthropic/experimental_pass_through/messages/transformation.py b/litellm/llms/anthropic/experimental_pass_through/messages/transformation.py index 4d0a2cd829..e9ceea4822 100644 --- a/litellm/llms/anthropic/experimental_pass_through/messages/transformation.py +++ b/litellm/llms/anthropic/experimental_pass_through/messages/transformation.py @@ -50,6 +50,38 @@ class AnthropicMessagesConfig(BaseAnthropicMessagesConfig): # "metadata", ] + def _remove_scope_from_cache_control( + self, anthropic_messages_request: Dict + ) -> None: + """ + Remove `scope` field from cache_control blocks. + + Some providers (Vertex AI, Azure AI Foundry) do not support the `scope` + field in cache_control (e.g. "global" for cross-request caching). + Processes both `system` and `messages` content blocks. + """ + + def _sanitize(cache_control: Any) -> None: + if isinstance(cache_control, dict): + cache_control.pop("scope", None) + + def _process_content_list(content: list) -> None: + for item in content: + if isinstance(item, dict) and "cache_control" in item: + _sanitize(item["cache_control"]) + + if "system" in anthropic_messages_request: + system = anthropic_messages_request["system"] + if isinstance(system, list): + _process_content_list(system) + + if "messages" in anthropic_messages_request: + for message in anthropic_messages_request["messages"]: + if isinstance(message, dict) and "content" in message: + content = message["content"] + if isinstance(content, list): + _process_content_list(content) + @staticmethod def _filter_billing_headers_from_system(system_param): """ diff --git a/litellm/llms/anthropic/files/transformation.py b/litellm/llms/anthropic/files/transformation.py index 0691742bb0..98a548a136 100644 --- a/litellm/llms/anthropic/files/transformation.py +++ b/litellm/llms/anthropic/files/transformation.py @@ -79,7 +79,9 @@ class AnthropicFilesConfig(BaseFilesConfig): return AnthropicError( status_code=status_code, message=error_message, - headers=cast(httpx.Headers, headers) if isinstance(headers, dict) else headers, + headers=cast(httpx.Headers, headers) + if isinstance(headers, dict) + else headers, ) def validate_environment( diff --git a/litellm/llms/base_llm/base_model_iterator.py b/litellm/llms/base_llm/base_model_iterator.py index 18551d9714..cf1fd6f786 100644 --- a/litellm/llms/base_llm/base_model_iterator.py +++ b/litellm/llms/base_llm/base_model_iterator.py @@ -144,9 +144,7 @@ class BaseModelResponseIterator: # Skip empty lines (common in SSE streams between events). # Only apply to str chunks — non-string objects (e.g. Pydantic # BaseModel events from the Responses API) must pass through. - if isinstance(str_line, str) and ( - not str_line or not str_line.strip() - ): + if isinstance(str_line, str) and (not str_line or not str_line.strip()): continue # chunk is a str at this point @@ -184,9 +182,7 @@ class BaseModelResponseIterator: # Skip empty lines (common in SSE streams between events). # Only apply to str chunks — non-string objects (e.g. Pydantic # BaseModel events from the Responses API) must pass through. - if isinstance(str_line, str) and ( - not str_line or not str_line.strip() - ): + if isinstance(str_line, str) and (not str_line or not str_line.strip()): continue # chunk is a str at this point diff --git a/litellm/llms/base_llm/videos/transformation.py b/litellm/llms/base_llm/videos/transformation.py index 2201a63363..a2892e2060 100644 --- a/litellm/llms/base_llm/videos/transformation.py +++ b/litellm/llms/base_llm/videos/transformation.py @@ -11,6 +11,7 @@ from litellm.types.videos.main import VideoCreateOptionalRequestParams if TYPE_CHECKING: from litellm.litellm_core_utils.litellm_logging import Logging as _LiteLLMLoggingObj + from litellm.types.videos.main import CharacterObject as _CharacterObject from litellm.types.videos.main import VideoObject as _VideoObject from ..chat.transformation import BaseLLMException as _BaseLLMException @@ -18,10 +19,12 @@ if TYPE_CHECKING: LiteLLMLoggingObj = _LiteLLMLoggingObj BaseLLMException = _BaseLLMException VideoObject = _VideoObject + CharacterObject = _CharacterObject else: LiteLLMLoggingObj = Any BaseLLMException = Any VideoObject = Any + CharacterObject = Any class BaseVideoConfig(ABC): @@ -265,6 +268,118 @@ class BaseVideoConfig(ABC): ) -> VideoObject: pass + def transform_video_create_character_request( + self, + name: str, + video: Any, + api_base: str, + litellm_params: GenericLiteLLMParams, + headers: dict, + ) -> Tuple[str, list]: + """ + Transform the video create character request into a URL and files list (multipart). + + Returns: + Tuple[str, list]: (url, files_list) for the multipart POST request + """ + raise NotImplementedError( + "video create character is not supported for this provider" + ) + + def transform_video_create_character_response( + self, + raw_response: httpx.Response, + logging_obj: LiteLLMLoggingObj, + ) -> CharacterObject: + raise NotImplementedError( + "video create character is not supported for this provider" + ) + + def transform_video_get_character_request( + self, + character_id: str, + api_base: str, + litellm_params: GenericLiteLLMParams, + headers: dict, + ) -> Tuple[str, Dict]: + """ + Transform the video get character request into a URL and params. + + Returns: + Tuple[str, Dict]: (url, params) for the GET request + """ + raise NotImplementedError( + "video get character is not supported for this provider" + ) + + def transform_video_get_character_response( + self, + raw_response: httpx.Response, + logging_obj: LiteLLMLoggingObj, + ) -> CharacterObject: + raise NotImplementedError( + "video get character is not supported for this provider" + ) + + def transform_video_edit_request( + self, + prompt: str, + video_id: str, + api_base: str, + litellm_params: GenericLiteLLMParams, + headers: dict, + extra_body: Optional[Dict[str, Any]] = None, + ) -> Tuple[str, Dict]: + """ + Transform the video edit request into a URL and JSON data. + + Returns: + Tuple[str, Dict]: (url, data) for the POST request + """ + raise NotImplementedError( + "video edit is not supported for this provider" + ) + + def transform_video_edit_response( + self, + raw_response: httpx.Response, + logging_obj: LiteLLMLoggingObj, + custom_llm_provider: Optional[str] = None, + ) -> VideoObject: + raise NotImplementedError( + "video edit is not supported for this provider" + ) + + def transform_video_extension_request( + self, + prompt: str, + video_id: str, + seconds: str, + api_base: str, + litellm_params: GenericLiteLLMParams, + headers: dict, + extra_body: Optional[Dict[str, Any]] = None, + ) -> Tuple[str, Dict]: + """ + Transform the video extension request into a URL and JSON data. + + Returns: + Tuple[str, Dict]: (url, data) for the POST request + """ + raise NotImplementedError( + "video extension is not supported for this provider" + ) + + def transform_video_extension_response( + self, + raw_response: httpx.Response, + logging_obj: LiteLLMLoggingObj, + custom_llm_provider: Optional[str] = None, + ) -> VideoObject: + raise NotImplementedError( + "video extension is not supported for this provider" + ) + def get_error_class( self, error_message: str, status_code: int, headers: Union[dict, httpx.Headers] ) -> BaseLLMException: diff --git a/litellm/llms/bedrock/base_aws_llm.py b/litellm/llms/bedrock/base_aws_llm.py index 697fccd268..b159d62367 100644 --- a/litellm/llms/bedrock/base_aws_llm.py +++ b/litellm/llms/bedrock/base_aws_llm.py @@ -1268,7 +1268,8 @@ class BaseAWSLLM: # Add back all original headers (including forwarded ones) after signature calculation for header_name, header_value in headers.items(): - request.headers[header_name] = header_value + if header_value is not None: + request.headers[header_name] = header_value if ( extra_headers is not None and "Authorization" in extra_headers @@ -1298,6 +1299,8 @@ class BaseAWSLLM: } for header_name, header_value in headers.items(): + if header_value is None: + continue header_lower = header_name.lower() if ( header_lower in aws_headers @@ -1393,7 +1396,8 @@ class BaseAWSLLM: # Add back original headers after signing. Only headers in SignedHeaders # are integrity-protected; forwarded headers (x-forwarded-*) must remain unsigned. for header_name, header_value in headers.items(): - request_headers_dict[header_name] = header_value + if header_value is not None: + request_headers_dict[header_name] = header_value if ( headers is not None and "Authorization" in headers ): # prevent sigv4 from overwriting the auth header diff --git a/litellm/llms/bedrock/files/transformation.py b/litellm/llms/bedrock/files/transformation.py index 096371749b..3007b54808 100644 --- a/litellm/llms/bedrock/files/transformation.py +++ b/litellm/llms/bedrock/files/transformation.py @@ -173,7 +173,12 @@ class BedrockFilesConfig(BaseAWSLLM, BaseFilesConfig): "S3 bucket_name is required. Set 's3_bucket_name' in litellm_params or AWS_S3_BUCKET_NAME env var" ) - aws_region_name = self._get_aws_region_name(optional_params, model) + s3_region_name = litellm_params.get("s3_region_name") or optional_params.get( + "s3_region_name" + ) + aws_region_name = s3_region_name or self._get_aws_region_name( + optional_params, model + ) file_data = data.get("file") purpose = data.get("purpose") @@ -398,6 +403,15 @@ class BedrockFilesConfig(BaseAWSLLM, BaseFilesConfig): data=create_file_data, ) + # s3_region_name always wins for S3 operations (same priority as in + # get_complete_file_url above). Overwrite aws_region_name unconditionally + # so the SigV4 region matches the URL region, avoiding SignatureDoesNotMatch. + s3_region_name = litellm_params.get("s3_region_name") or optional_params.get( + "s3_region_name" + ) + if s3_region_name: + optional_params = {**optional_params, "aws_region_name": s3_region_name} + # Sign the request and return a pre-signed request object signed_headers, signed_body = self._sign_s3_request( content=file_content, diff --git a/litellm/llms/black_forest_labs/image_edit/transformation.py b/litellm/llms/black_forest_labs/image_edit/transformation.py index 63413787c0..c6d8e8298e 100644 --- a/litellm/llms/black_forest_labs/image_edit/transformation.py +++ b/litellm/llms/black_forest_labs/image_edit/transformation.py @@ -201,7 +201,9 @@ class BlackForestLabsImageEditConfig(BaseImageEditConfig): return image elif isinstance(image, list): # If it's a list, take the first image - return self._read_image_bytes(image[0], depth=depth + 1, max_depth=max_depth) + return self._read_image_bytes( + image[0], depth=depth + 1, max_depth=max_depth + ) elif isinstance(image, str): if image.startswith(("http://", "https://")): # Download image from URL diff --git a/litellm/llms/custom_httpx/llm_http_handler.py b/litellm/llms/custom_httpx/llm_http_handler.py index a8d649064a..204fa4d0cc 100644 --- a/litellm/llms/custom_httpx/llm_http_handler.py +++ b/litellm/llms/custom_httpx/llm_http_handler.py @@ -22,9 +22,7 @@ import litellm.litellm_core_utils import litellm.types import litellm.types.utils from litellm._logging import verbose_logger -from litellm.anthropic_beta_headers_manager import ( - update_headers_with_filtered_beta, -) +from litellm.anthropic_beta_headers_manager import update_headers_with_filtered_beta from litellm.constants import REALTIME_WEBSOCKET_MAX_MESSAGE_SIZE_BYTES from litellm.litellm_core_utils.realtime_streaming import RealTimeStreaming from litellm.llms.base_llm.anthropic_messages.transformation import ( @@ -1884,11 +1882,11 @@ class BaseLLMHTTPHandler: headers=headers, provider=custom_llm_provider ) - logging_obj.update_environment_variables( + logging_obj.update_from_kwargs( + kwargs=kwargs, model=model, optional_params=dict(anthropic_messages_optional_request_params), litellm_params={ - "metadata": kwargs.get("metadata", {}), "preset_cache_key": None, "stream_response": {}, **anthropic_messages_optional_request_params, @@ -6115,6 +6113,614 @@ class BaseLLMHTTPHandler: provider_config=video_remix_provider_config, ) + def video_create_character_handler( + self, + name: str, + video: Any, + video_provider_config: BaseVideoConfig, + custom_llm_provider: str, + litellm_params, + logging_obj, + extra_headers: Optional[Dict[str, Any]] = None, + timeout: Optional[float] = None, + _is_async: bool = False, + client=None, + api_key: Optional[str] = None, + ): + if _is_async: + return self.async_video_create_character_handler( + name=name, + video=video, + video_provider_config=video_provider_config, + custom_llm_provider=custom_llm_provider, + litellm_params=litellm_params, + logging_obj=logging_obj, + extra_headers=extra_headers, + timeout=timeout, + client=client, + api_key=api_key, + ) + + if client is None or not isinstance(client, HTTPHandler): + sync_httpx_client = _get_httpx_client( + params={"ssl_verify": litellm_params.get("ssl_verify", None)} + ) + else: + sync_httpx_client = client + + headers = video_provider_config.validate_environment( + api_key=api_key or litellm_params.get("api_key", None), + headers=extra_headers or {}, + model="", + ) + if extra_headers: + headers.update(extra_headers) + + api_base = video_provider_config.get_complete_url( + model="", + api_base=litellm_params.get("api_base", None), + litellm_params=dict(litellm_params), + ) + + url, files_list = video_provider_config.transform_video_create_character_request( + name=name, + video=video, + api_base=api_base, + litellm_params=litellm_params, + headers=headers, + ) + + logging_obj.pre_call( + input=name, + api_key="", + additional_args={ + "complete_input_dict": {"name": name}, + "api_base": url, + "headers": headers, + }, + ) + + try: + response = sync_httpx_client.post( + url=url, + headers=headers, + files=files_list, + timeout=timeout, + ) + response.raise_for_status() + return video_provider_config.transform_video_create_character_response( + raw_response=response, + logging_obj=logging_obj, + ) + except Exception as e: + raise self._handle_error(e=e, provider_config=video_provider_config) + + async def async_video_create_character_handler( + self, + name: str, + video: Any, + video_provider_config: BaseVideoConfig, + custom_llm_provider: str, + litellm_params, + logging_obj, + extra_headers: Optional[Dict[str, Any]] = None, + timeout: Optional[float] = None, + client=None, + api_key: Optional[str] = None, + ): + if client is None or not isinstance(client, AsyncHTTPHandler): + async_httpx_client = get_async_httpx_client( + llm_provider=litellm.LlmProviders(custom_llm_provider), + params={"ssl_verify": litellm_params.get("ssl_verify", None)}, + ) + else: + async_httpx_client = client + + headers = video_provider_config.validate_environment( + api_key=api_key or litellm_params.get("api_key", None), + headers=extra_headers or {}, + model="", + ) + if extra_headers: + headers.update(extra_headers) + + api_base = video_provider_config.get_complete_url( + model="", + api_base=litellm_params.get("api_base", None), + litellm_params=dict(litellm_params), + ) + + url, files_list = video_provider_config.transform_video_create_character_request( + name=name, + video=video, + api_base=api_base, + litellm_params=litellm_params, + headers=headers, + ) + + logging_obj.pre_call( + input=name, + api_key="", + additional_args={ + "complete_input_dict": {"name": name}, + "api_base": url, + "headers": headers, + }, + ) + + try: + response = await async_httpx_client.post( + url=url, + headers=headers, + files=files_list, + timeout=timeout, + ) + response.raise_for_status() + return video_provider_config.transform_video_create_character_response( + raw_response=response, + logging_obj=logging_obj, + ) + except Exception as e: + raise self._handle_error(e=e, provider_config=video_provider_config) + + def video_get_character_handler( + self, + character_id: str, + video_provider_config: BaseVideoConfig, + custom_llm_provider: str, + litellm_params, + logging_obj, + extra_headers: Optional[Dict[str, Any]] = None, + timeout: Optional[float] = None, + _is_async: bool = False, + client=None, + api_key: Optional[str] = None, + ): + if _is_async: + return self.async_video_get_character_handler( + character_id=character_id, + video_provider_config=video_provider_config, + custom_llm_provider=custom_llm_provider, + litellm_params=litellm_params, + logging_obj=logging_obj, + extra_headers=extra_headers, + timeout=timeout, + client=client, + api_key=api_key, + ) + + if client is None or not isinstance(client, HTTPHandler): + sync_httpx_client = _get_httpx_client( + params={"ssl_verify": litellm_params.get("ssl_verify", None)} + ) + else: + sync_httpx_client = client + + headers = video_provider_config.validate_environment( + api_key=api_key or litellm_params.get("api_key", None), + headers=extra_headers or {}, + model="", + ) + if extra_headers: + headers.update(extra_headers) + + api_base = video_provider_config.get_complete_url( + model="", + api_base=litellm_params.get("api_base", None), + litellm_params=dict(litellm_params), + ) + + url, params = video_provider_config.transform_video_get_character_request( + character_id=character_id, + api_base=api_base, + litellm_params=litellm_params, + headers=headers, + ) + + logging_obj.pre_call( + input=character_id, + api_key="", + additional_args={"api_base": url, "headers": headers}, + ) + + try: + response = sync_httpx_client.get( + url=url, + headers=headers, + params=params + ) + response.raise_for_status() + return video_provider_config.transform_video_get_character_response( + raw_response=response, + logging_obj=logging_obj, + ) + except Exception as e: + raise self._handle_error(e=e, provider_config=video_provider_config) + + async def async_video_get_character_handler( + self, + character_id: str, + video_provider_config: BaseVideoConfig, + custom_llm_provider: str, + litellm_params, + logging_obj, + extra_headers: Optional[Dict[str, Any]] = None, + timeout: Optional[float] = None, + client=None, + api_key: Optional[str] = None, + ): + if client is None or not isinstance(client, AsyncHTTPHandler): + async_httpx_client = get_async_httpx_client( + llm_provider=litellm.LlmProviders(custom_llm_provider), + params={"ssl_verify": litellm_params.get("ssl_verify", None)}, + ) + else: + async_httpx_client = client + + headers = video_provider_config.validate_environment( + api_key=api_key or litellm_params.get("api_key", None), + headers=extra_headers or {}, + model="", + ) + if extra_headers: + headers.update(extra_headers) + + api_base = video_provider_config.get_complete_url( + model="", + api_base=litellm_params.get("api_base", None), + litellm_params=dict(litellm_params), + ) + + url, params = video_provider_config.transform_video_get_character_request( + character_id=character_id, + api_base=api_base, + litellm_params=litellm_params, + headers=headers, + ) + + logging_obj.pre_call( + input=character_id, + api_key="", + additional_args={"api_base": url, "headers": headers}, + ) + + try: + response = await async_httpx_client.get( + url=url, + headers=headers, + params=params + ) + response.raise_for_status() + return video_provider_config.transform_video_get_character_response( + raw_response=response, + logging_obj=logging_obj, + ) + except Exception as e: + raise self._handle_error(e=e, provider_config=video_provider_config) + + def video_edit_handler( + self, + prompt: str, + video_id: str, + video_provider_config: BaseVideoConfig, + custom_llm_provider: str, + litellm_params, + logging_obj, + extra_headers: Optional[Dict[str, Any]] = None, + extra_body: Optional[Dict[str, Any]] = None, + timeout: Optional[float] = None, + _is_async: bool = False, + client=None, + api_key: Optional[str] = None, + ): + if _is_async: + return self.async_video_edit_handler( + prompt=prompt, + video_id=video_id, + video_provider_config=video_provider_config, + custom_llm_provider=custom_llm_provider, + litellm_params=litellm_params, + logging_obj=logging_obj, + extra_headers=extra_headers, + extra_body=extra_body, + timeout=timeout, + client=client, + api_key=api_key, + ) + + if client is None or not isinstance(client, HTTPHandler): + sync_httpx_client = _get_httpx_client( + params={"ssl_verify": litellm_params.get("ssl_verify", None)} + ) + else: + sync_httpx_client = client + + headers = video_provider_config.validate_environment( + api_key=api_key or litellm_params.get("api_key", None), + headers=extra_headers or {}, + model="", + ) + if extra_headers: + headers.update(extra_headers) + + api_base = video_provider_config.get_complete_url( + model="", + api_base=litellm_params.get("api_base", None), + litellm_params=dict(litellm_params), + ) + + url, data = video_provider_config.transform_video_edit_request( + prompt=prompt, + video_id=video_id, + api_base=api_base, + litellm_params=litellm_params, + headers=headers, + extra_body=extra_body, + ) + + logging_obj.pre_call( + input=prompt, + api_key="", + additional_args={ + "complete_input_dict": data, + "api_base": url, + "headers": headers, + "video_id": video_id, + }, + ) + + try: + response = sync_httpx_client.post( + url=url, + headers=headers, + json=data, + timeout=timeout, + ) + response.raise_for_status() + return video_provider_config.transform_video_edit_response( + raw_response=response, + logging_obj=logging_obj, + custom_llm_provider=custom_llm_provider, + ) + except Exception as e: + raise self._handle_error(e=e, provider_config=video_provider_config) + + async def async_video_edit_handler( + self, + prompt: str, + video_id: str, + video_provider_config: BaseVideoConfig, + custom_llm_provider: str, + litellm_params, + logging_obj, + extra_headers: Optional[Dict[str, Any]] = None, + extra_body: Optional[Dict[str, Any]] = None, + timeout: Optional[float] = None, + client=None, + api_key: Optional[str] = None, + ): + if client is None or not isinstance(client, AsyncHTTPHandler): + async_httpx_client = get_async_httpx_client( + llm_provider=litellm.LlmProviders(custom_llm_provider), + params={"ssl_verify": litellm_params.get("ssl_verify", None)}, + ) + else: + async_httpx_client = client + + headers = video_provider_config.validate_environment( + api_key=api_key or litellm_params.get("api_key", None), + headers=extra_headers or {}, + model="", + ) + if extra_headers: + headers.update(extra_headers) + + api_base = video_provider_config.get_complete_url( + model="", + api_base=litellm_params.get("api_base", None), + litellm_params=dict(litellm_params), + ) + + url, data = video_provider_config.transform_video_edit_request( + prompt=prompt, + video_id=video_id, + api_base=api_base, + litellm_params=litellm_params, + headers=headers, + extra_body=extra_body, + ) + + logging_obj.pre_call( + input=prompt, + api_key="", + additional_args={ + "complete_input_dict": data, + "api_base": url, + "headers": headers, + "video_id": video_id, + }, + ) + + try: + response = await async_httpx_client.post( + url=url, + headers=headers, + json=data, + timeout=timeout, + ) + response.raise_for_status() + return video_provider_config.transform_video_edit_response( + raw_response=response, + logging_obj=logging_obj, + custom_llm_provider=custom_llm_provider, + ) + except Exception as e: + raise self._handle_error(e=e, provider_config=video_provider_config) + + def video_extension_handler( + self, + prompt: str, + video_id: str, + seconds: str, + video_provider_config: BaseVideoConfig, + custom_llm_provider: str, + litellm_params, + logging_obj, + extra_headers: Optional[Dict[str, Any]] = None, + extra_body: Optional[Dict[str, Any]] = None, + timeout: Optional[float] = None, + _is_async: bool = False, + client=None, + api_key: Optional[str] = None, + ): + if _is_async: + return self.async_video_extension_handler( + prompt=prompt, + video_id=video_id, + seconds=seconds, + video_provider_config=video_provider_config, + custom_llm_provider=custom_llm_provider, + litellm_params=litellm_params, + logging_obj=logging_obj, + extra_headers=extra_headers, + extra_body=extra_body, + timeout=timeout, + client=client, + api_key=api_key, + ) + + if client is None or not isinstance(client, HTTPHandler): + sync_httpx_client = _get_httpx_client( + params={"ssl_verify": litellm_params.get("ssl_verify", None)} + ) + else: + sync_httpx_client = client + + headers = video_provider_config.validate_environment( + api_key=api_key or litellm_params.get("api_key", None), + headers=extra_headers or {}, + model="", + ) + if extra_headers: + headers.update(extra_headers) + + api_base = video_provider_config.get_complete_url( + model="", + api_base=litellm_params.get("api_base", None), + litellm_params=dict(litellm_params), + ) + + url, data = video_provider_config.transform_video_extension_request( + prompt=prompt, + video_id=video_id, + seconds=seconds, + api_base=api_base, + litellm_params=litellm_params, + headers=headers, + extra_body=extra_body, + ) + + logging_obj.pre_call( + input=prompt, + api_key="", + additional_args={ + "complete_input_dict": data, + "api_base": url, + "headers": headers, + "video_id": video_id, + }, + ) + + try: + response = sync_httpx_client.post( + url=url, + headers=headers, + json=data, + timeout=timeout, + ) + response.raise_for_status() + return video_provider_config.transform_video_extension_response( + raw_response=response, + logging_obj=logging_obj, + custom_llm_provider=custom_llm_provider, + ) + except Exception as e: + raise self._handle_error(e=e, provider_config=video_provider_config) + + async def async_video_extension_handler( + self, + prompt: str, + video_id: str, + seconds: str, + video_provider_config: BaseVideoConfig, + custom_llm_provider: str, + litellm_params, + logging_obj, + extra_headers: Optional[Dict[str, Any]] = None, + extra_body: Optional[Dict[str, Any]] = None, + timeout: Optional[float] = None, + client=None, + api_key: Optional[str] = None, + ): + if client is None or not isinstance(client, AsyncHTTPHandler): + async_httpx_client = get_async_httpx_client( + llm_provider=litellm.LlmProviders(custom_llm_provider), + params={"ssl_verify": litellm_params.get("ssl_verify", None)}, + ) + else: + async_httpx_client = client + + headers = video_provider_config.validate_environment( + api_key=api_key or litellm_params.get("api_key", None), + headers=extra_headers or {}, + model="", + ) + if extra_headers: + headers.update(extra_headers) + + api_base = video_provider_config.get_complete_url( + model="", + api_base=litellm_params.get("api_base", None), + litellm_params=dict(litellm_params), + ) + + url, data = video_provider_config.transform_video_extension_request( + prompt=prompt, + video_id=video_id, + seconds=seconds, + api_base=api_base, + litellm_params=litellm_params, + headers=headers, + extra_body=extra_body, + ) + + logging_obj.pre_call( + input=prompt, + api_key="", + additional_args={ + "complete_input_dict": data, + "api_base": url, + "headers": headers, + "video_id": video_id, + }, + ) + + try: + response = await async_httpx_client.post( + url=url, + headers=headers, + json=data, + timeout=timeout, + ) + response.raise_for_status() + return video_provider_config.transform_video_extension_response( + raw_response=response, + logging_obj=logging_obj, + custom_llm_provider=custom_llm_provider, + ) + except Exception as e: + raise self._handle_error(e=e, provider_config=video_provider_config) + def video_list_handler( self, after: Optional[str], diff --git a/litellm/llms/gemini/videos/transformation.py b/litellm/llms/gemini/videos/transformation.py index c16b20fe57..0798472310 100644 --- a/litellm/llms/gemini/videos/transformation.py +++ b/litellm/llms/gemini/videos/transformation.py @@ -1,29 +1,30 @@ -from typing import TYPE_CHECKING, Any, Dict, Optional, Tuple, Union import base64 +from typing import TYPE_CHECKING, Any, Dict, Optional, Tuple, Union import httpx from httpx._types import RequestFiles -from litellm.types.videos.main import VideoCreateOptionalRequestParams, VideoObject -from litellm.types.router import GenericLiteLLMParams -from litellm.secret_managers.main import get_secret_str -from litellm.types.videos.utils import ( - encode_video_id_with_provider, - extract_original_video_id, -) -from litellm.images.utils import ImageEditRequestUtils import litellm +from litellm.constants import DEFAULT_GOOGLE_VIDEO_DURATION_SECONDS +from litellm.images.utils import ImageEditRequestUtils +from litellm.llms.base_llm.videos.transformation import BaseVideoConfig +from litellm.secret_managers.main import get_secret_str from litellm.types.llms.gemini import ( GeminiLongRunningOperationResponse, GeminiVideoGenerationInstance, GeminiVideoGenerationParameters, GeminiVideoGenerationRequest, ) -from litellm.constants import DEFAULT_GOOGLE_VIDEO_DURATION_SECONDS -from litellm.llms.base_llm.videos.transformation import BaseVideoConfig +from litellm.types.router import GenericLiteLLMParams +from litellm.types.videos.main import VideoCreateOptionalRequestParams, VideoObject +from litellm.types.videos.utils import ( + encode_video_id_with_provider, + extract_original_video_id, +) if TYPE_CHECKING: from litellm.litellm_core_utils.litellm_logging import Logging as _LiteLLMLoggingObj + from ...base_llm.chat.transformation import BaseLLMException as _BaseLLMException LiteLLMLoggingObj = _LiteLLMLoggingObj @@ -524,6 +525,30 @@ class GeminiVideoConfig(BaseVideoConfig): """Video delete is not supported.""" raise NotImplementedError("Video delete is not supported by Google Veo.") + def transform_video_create_character_request(self, name, video, api_base, litellm_params, headers): + raise NotImplementedError("video create character is not supported for Gemini") + + def transform_video_create_character_response(self, raw_response, logging_obj): + raise NotImplementedError("video create character is not supported for Gemini") + + def transform_video_get_character_request(self, character_id, api_base, litellm_params, headers): + raise NotImplementedError("video get character is not supported for Gemini") + + def transform_video_get_character_response(self, raw_response, logging_obj): + raise NotImplementedError("video get character is not supported for Gemini") + + def transform_video_edit_request(self, prompt, video_id, api_base, litellm_params, headers, extra_body=None): + raise NotImplementedError("video edit is not supported for Gemini") + + def transform_video_edit_response(self, raw_response, logging_obj, custom_llm_provider=None): + raise NotImplementedError("video edit is not supported for Gemini") + + def transform_video_extension_request(self, prompt, video_id, seconds, api_base, litellm_params, headers, extra_body=None): + raise NotImplementedError("video extension is not supported for Gemini") + + def transform_video_extension_response(self, raw_response, logging_obj, custom_llm_provider=None): + raise NotImplementedError("video extension is not supported for Gemini") + def get_error_class( self, error_message: str, status_code: int, headers: Union[dict, httpx.Headers] ) -> BaseLLMException: diff --git a/litellm/llms/litellm_proxy/skills/transformation.py b/litellm/llms/litellm_proxy/skills/transformation.py index cd000829ca..4622bda4e8 100644 --- a/litellm/llms/litellm_proxy/skills/transformation.py +++ b/litellm/llms/litellm_proxy/skills/transformation.py @@ -69,7 +69,8 @@ class LiteLLMSkillsTransformationHandler: """ # Pre-call logging if logging_obj: - logging_obj.update_environment_variables( + logging_obj.update_from_kwargs( + kwargs=kwargs, model=None, optional_params={"display_title": display_title}, litellm_params={"litellm_call_id": litellm_call_id}, @@ -172,7 +173,8 @@ class LiteLLMSkillsTransformationHandler: """ # Pre-call logging if logging_obj: - logging_obj.update_environment_variables( + logging_obj.update_from_kwargs( + kwargs=kwargs, model=None, optional_params={"limit": limit, "offset": offset}, litellm_params={"litellm_call_id": litellm_call_id}, @@ -231,7 +233,8 @@ class LiteLLMSkillsTransformationHandler: """ # Pre-call logging if logging_obj: - logging_obj.update_environment_variables( + logging_obj.update_from_kwargs( + kwargs=kwargs, model=None, optional_params={"skill_id": skill_id}, litellm_params={"litellm_call_id": litellm_call_id}, @@ -277,7 +280,8 @@ class LiteLLMSkillsTransformationHandler: """ # Pre-call logging if logging_obj: - logging_obj.update_environment_variables( + logging_obj.update_from_kwargs( + kwargs=kwargs, model=None, optional_params={"skill_id": skill_id}, litellm_params={"litellm_call_id": litellm_call_id}, diff --git a/litellm/llms/moonshot/chat/transformation.py b/litellm/llms/moonshot/chat/transformation.py index 3ed08f51c8..40096be05c 100644 --- a/litellm/llms/moonshot/chat/transformation.py +++ b/litellm/llms/moonshot/chat/transformation.py @@ -2,13 +2,15 @@ Translates from OpenAI's `/v1/chat/completions` to Moonshot AI's `/v1/chat/completions` """ -from typing import Any, Coroutine, List, Literal, Optional, Tuple, Union, overload +from typing import Any, Coroutine, List, Literal, Optional, Tuple, Union, cast, overload +import litellm from litellm.litellm_core_utils.prompt_templates.common_utils import ( handle_messages_with_content_list_to_str_conversion, ) from litellm.secret_managers.main import get_secret_str from litellm.types.llms.openai import AllMessageValues +from litellm.utils import supports_reasoning from ...openai.chat.gpt_transformation import OpenAIGPTConfig @@ -17,8 +19,7 @@ class MoonshotChatConfig(OpenAIGPTConfig): @overload def _transform_messages( self, messages: List[AllMessageValues], model: str, is_async: Literal[True] - ) -> Coroutine[Any, Any, List[AllMessageValues]]: - ... + ) -> Coroutine[Any, Any, List[AllMessageValues]]: ... @overload def _transform_messages( @@ -26,8 +27,7 @@ class MoonshotChatConfig(OpenAIGPTConfig): messages: List[AllMessageValues], model: str, is_async: Literal[False] = False, - ) -> List[AllMessageValues]: - ... + ) -> List[AllMessageValues]: ... def _transform_messages( self, messages: List[AllMessageValues], model: str, is_async: bool = False @@ -53,22 +53,14 @@ class MoonshotChatConfig(OpenAIGPTConfig): messages = handle_messages_with_content_list_to_str_conversion(messages) if is_async: - return super()._transform_messages( - messages=messages, model=model, is_async=True - ) + return super()._transform_messages(messages=messages, model=model, is_async=True) else: - return super()._transform_messages( - messages=messages, model=model, is_async=False - ) + return super()._transform_messages(messages=messages, model=model, is_async=False) def _get_openai_compatible_provider_info( self, api_base: Optional[str], api_key: Optional[str] ) -> Tuple[Optional[str], Optional[str]]: - api_base = ( - api_base - or get_secret_str("MOONSHOT_API_BASE") - or "https://api.moonshot.ai/v1" - ) # type: ignore + api_base = api_base or get_secret_str("MOONSHOT_API_BASE") or "https://api.moonshot.ai/v1" # type: ignore dynamic_api_key = api_key or get_secret_str("MOONSHOT_API_KEY") return api_base, dynamic_api_key @@ -149,6 +141,48 @@ class MoonshotChatConfig(OpenAIGPTConfig): optional_params["temperature"] = 0.3 return optional_params + def fill_reasoning_content(self, messages: List[AllMessageValues]) -> List[AllMessageValues]: + """ + Moonshot reasoning models require `reasoning_content` on every assistant + message that contains tool_calls (multi-turn tool-calling flows). + + For each such message that is missing the field: + 1. Promote provider_specific_fields["reasoning_content"] if present and non-empty + (this is where LiteLLM stores it from a previous response) + 2. Otherwise inject a single space — the minimum value the API accepts + Messages that already carry the field, or are not assistant/tool-call messages, + are appended as-is (no copy made). + """ + result: List[AllMessageValues] = [] + for msg in messages: + if ( + msg.get("role") == "assistant" + and msg.get("tool_calls") + and "reasoning_content" not in msg + ): + patched = dict(cast(dict, msg)) + provider_fields = patched.get("provider_specific_fields") or {} + stored = provider_fields.get("reasoning_content") + if stored: + patched["reasoning_content"] = stored + # Remove the promoted key from provider_specific_fields to + # avoid sending the value twice in the serialised request body + cleaned_provider_fields = dict(provider_fields) + cleaned_provider_fields.pop("reasoning_content", None) + patched["provider_specific_fields"] = cleaned_provider_fields + else: + litellm.verbose_logger.warning( + "Moonshot reasoning model: assistant tool-call message is missing " + "`reasoning_content`. Injecting a placeholder to satisfy API validation. " + "For best results, preserve `reasoning_content` from the original " + "assistant response when building multi-turn conversation history." + ) + patched["reasoning_content"] = " " + result.append(cast(AllMessageValues, patched)) + else: + result.append(msg) + return result + def transform_request( self, model: str, @@ -169,6 +203,10 @@ class MoonshotChatConfig(OpenAIGPTConfig): optional_params=optional_params, ) + # Moonshot reasoning models: fill in reasoning_content before the API call + if supports_reasoning(model=model, custom_llm_provider="moonshot"): + messages = self.fill_reasoning_content(messages) + # Call parent transform_request which handles _transform_messages return super().transform_request( model=model, diff --git a/litellm/llms/openai/videos/transformation.py b/litellm/llms/openai/videos/transformation.py index e224097fb0..61baa56949 100644 --- a/litellm/llms/openai/videos/transformation.py +++ b/litellm/llms/openai/videos/transformation.py @@ -1,4 +1,5 @@ -from io import BufferedReader +import mimetypes +from io import BufferedReader, BytesIO from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Union, cast import httpx @@ -10,9 +11,14 @@ from litellm.llms.openai.image_edit.transformation import ImageEditRequestUtils from litellm.secret_managers.main import get_secret_str from litellm.types.llms.openai import CreateVideoRequest from litellm.types.router import GenericLiteLLMParams -from litellm.types.videos.main import VideoCreateOptionalRequestParams, VideoObject +from litellm.types.videos.main import ( + CharacterObject, + VideoCreateOptionalRequestParams, + VideoObject, +) from litellm.types.videos.utils import ( encode_video_id_with_provider, + extract_original_character_id, extract_original_video_id, ) @@ -46,6 +52,7 @@ class OpenAIVideoConfig(BaseVideoConfig): "input_reference", "seconds", "size", + "characters", "user", "extra_headers", ] @@ -121,6 +128,7 @@ class OpenAIVideoConfig(BaseVideoConfig): model=model, prompt=prompt, **video_create_optional_request_params ) request_dict = cast(Dict, video_create_request) + request_dict = self._decode_character_ids_in_create_video_request(request_dict) # Handle input_reference parameter if provided _input_reference = video_create_optional_request_params.get("input_reference") @@ -138,6 +146,35 @@ class OpenAIVideoConfig(BaseVideoConfig): ) return data_without_files, files_list, api_base + def _decode_character_ids_in_create_video_request(self, request_dict: Dict) -> Dict: + """ + Decode LiteLLM-managed encoded character ids for provider requests. + + OpenAI expects character ids like `char_...`. If a caller sends + `character_`, convert it back to the + original provider id before forwarding upstream. + """ + raw_characters = request_dict.get("characters") + if not isinstance(raw_characters, list): + return request_dict + + decoded_characters: List[Any] = [] + for character in raw_characters: + if not isinstance(character, dict): + decoded_characters.append(character) + continue + + character_id = character.get("id") + if isinstance(character_id, str): + decoded_character = dict(character) + decoded_character["id"] = extract_original_character_id(character_id) + decoded_characters.append(decoded_character) + else: + decoded_characters.append(character) + + request_dict["characters"] = decoded_characters + return request_dict + def transform_video_create_response( self, model: str, @@ -430,6 +467,106 @@ class OpenAIVideoConfig(BaseVideoConfig): headers=headers, ) + def transform_video_create_character_request( + self, + name: str, + video: Any, + api_base: str, + litellm_params: GenericLiteLLMParams, + headers: dict, + ) -> Tuple[str, list]: + url = f"{api_base.rstrip('/')}/characters" + files_list: List[Tuple[str, Any]] = [("name", (None, name))] + self._add_video_to_files(files_list, video, "video") + return url, files_list + + def transform_video_create_character_response( + self, + raw_response: httpx.Response, + logging_obj: Any, + ) -> CharacterObject: + return CharacterObject(**raw_response.json()) + + def transform_video_get_character_request( + self, + character_id: str, + api_base: str, + litellm_params: GenericLiteLLMParams, + headers: dict, + ) -> Tuple[str, Dict]: + url = f"{api_base.rstrip('/')}/characters/{character_id}" + return url, {} + + def transform_video_get_character_response( + self, + raw_response: httpx.Response, + logging_obj: Any, + ) -> CharacterObject: + return CharacterObject(**raw_response.json()) + + def transform_video_edit_request( + self, + prompt: str, + video_id: str, + api_base: str, + litellm_params: GenericLiteLLMParams, + headers: dict, + extra_body: Optional[Dict[str, Any]] = None, + ) -> Tuple[str, Dict]: + original_video_id = extract_original_video_id(video_id) + url = f"{api_base.rstrip('/')}/edits" + data: Dict[str, Any] = {"prompt": prompt, "video": {"id": original_video_id}} + if extra_body: + data.update(extra_body) + return url, data + + def transform_video_edit_response( + self, + raw_response: httpx.Response, + logging_obj: Any, + custom_llm_provider: Optional[str] = None, + ) -> VideoObject: + video_obj = VideoObject(**raw_response.json()) + if custom_llm_provider and video_obj.id: + video_obj.id = encode_video_id_with_provider( + video_obj.id, custom_llm_provider, None + ) + return video_obj + + def transform_video_extension_request( + self, + prompt: str, + video_id: str, + seconds: str, + api_base: str, + litellm_params: GenericLiteLLMParams, + headers: dict, + extra_body: Optional[Dict[str, Any]] = None, + ) -> Tuple[str, Dict]: + original_video_id = extract_original_video_id(video_id) + url = f"{api_base.rstrip('/')}/extensions" + data: Dict[str, Any] = { + "prompt": prompt, + "seconds": seconds, + "video": {"id": original_video_id}, + } + if extra_body: + data.update(extra_body) + return url, data + + def transform_video_extension_response( + self, + raw_response: httpx.Response, + logging_obj: Any, + custom_llm_provider: Optional[str] = None, + ) -> VideoObject: + video_obj = VideoObject(**raw_response.json()) + if custom_llm_provider and video_obj.id: + video_obj.id = encode_video_id_with_provider( + video_obj.id, custom_llm_provider, None + ) + return video_obj + def _add_image_to_files( self, files_list: List[Tuple[str, Any]], @@ -445,3 +582,49 @@ class OpenAIVideoConfig(BaseVideoConfig): files_list.append( (field_name, ("input_reference.png", image, image_content_type)) ) + + def _add_video_to_files( + self, + files_list: List[Tuple[str, Any]], + video: Any, + field_name: str, + ) -> None: + """ + Add a video to files with proper video MIME type detection. + + This path is used by POST /videos/characters and must send video/mp4, + not image/* content types. + """ + filename = getattr(video, "name", None) or "input_video.mp4" + content_type = self._get_video_content_type(video=video, filename=filename) + files_list.append((field_name, (filename, video, content_type))) + + def _get_video_content_type(self, video: Any, filename: str) -> str: + guessed_content_type, _ = mimetypes.guess_type(filename) + if guessed_content_type and guessed_content_type.startswith("video/"): + return guessed_content_type + + # Fast-path detection for common MP4 signatures when filename is missing/incorrect. + try: + header_bytes = b"" + if isinstance(video, BytesIO): + current_pos = video.tell() + video.seek(0) + header_bytes = video.read(64) + video.seek(current_pos) + elif isinstance(video, BufferedReader): + current_pos = video.tell() + video.seek(0) + header_bytes = video.read(64) + video.seek(current_pos) + elif isinstance(video, bytes): + header_bytes = video[:64] + + # MP4 typically includes ftyp in first box. + if b"ftyp" in header_bytes: + return "video/mp4" + except Exception: + pass + + # OpenAI create-character currently supports mp4. + return "video/mp4" diff --git a/litellm/llms/perplexity/responses/transformation.py b/litellm/llms/perplexity/responses/transformation.py index c7ec131356..e09dc01f1c 100644 --- a/litellm/llms/perplexity/responses/transformation.py +++ b/litellm/llms/perplexity/responses/transformation.py @@ -71,7 +71,9 @@ class PerplexityResponsesConfig(OpenAIResponsesAPIConfig): result: List[Any] = [] for item in input: if isinstance(item, dict) and "type" not in item: - new_item = dict(item) # convert to plain dict to avoid TypedDict checking + new_item = dict( + item + ) # convert to plain dict to avoid TypedDict checking new_item["type"] = "message" result.append(new_item) else: diff --git a/litellm/llms/runwayml/videos/transformation.py b/litellm/llms/runwayml/videos/transformation.py index 3fc656a92b..2c29c2e21e 100644 --- a/litellm/llms/runwayml/videos/transformation.py +++ b/litellm/llms/runwayml/videos/transformation.py @@ -592,6 +592,30 @@ class RunwayMLVideoConfig(BaseVideoConfig): return video_obj + def transform_video_create_character_request(self, name, video, api_base, litellm_params, headers): + raise NotImplementedError("video create character is not supported for RunwayML") + + def transform_video_create_character_response(self, raw_response, logging_obj): + raise NotImplementedError("video create character is not supported for RunwayML") + + def transform_video_get_character_request(self, character_id, api_base, litellm_params, headers): + raise NotImplementedError("video get character is not supported for RunwayML") + + def transform_video_get_character_response(self, raw_response, logging_obj): + raise NotImplementedError("video get character is not supported for RunwayML") + + def transform_video_edit_request(self, prompt, video_id, api_base, litellm_params, headers, extra_body=None): + raise NotImplementedError("video edit is not supported for RunwayML") + + def transform_video_edit_response(self, raw_response, logging_obj, custom_llm_provider=None): + raise NotImplementedError("video edit is not supported for RunwayML") + + def transform_video_extension_request(self, prompt, video_id, seconds, api_base, litellm_params, headers, extra_body=None): + raise NotImplementedError("video extension is not supported for RunwayML") + + def transform_video_extension_response(self, raw_response, logging_obj, custom_llm_provider=None): + raise NotImplementedError("video extension is not supported for RunwayML") + def get_error_class( self, error_message: str, status_code: int, headers: Union[dict, httpx.Headers] ) -> BaseLLMException: diff --git a/litellm/llms/sagemaker/chat/transformation.py b/litellm/llms/sagemaker/chat/transformation.py index 2b458fbc43..60e85c9f93 100644 --- a/litellm/llms/sagemaker/chat/transformation.py +++ b/litellm/llms/sagemaker/chat/transformation.py @@ -160,7 +160,7 @@ class SagemakerChatConfig(OpenAIGPTConfig, BaseAWSLLM): streaming_response = CustomStreamWrapper( completion_stream=completion_stream, model=model, - custom_llm_provider="sagemaker_chat", + custom_llm_provider=custom_llm_provider, logging_obj=logging_obj, ) return streaming_response @@ -180,8 +180,12 @@ class SagemakerChatConfig(OpenAIGPTConfig, BaseAWSLLM): signed_json_body: Optional[bytes] = None, ) -> CustomStreamWrapper: if client is None or isinstance(client, HTTPHandler): + try: + llm_provider = LlmProviders(custom_llm_provider) + except ValueError: + llm_provider = LlmProviders.SAGEMAKER_CHAT client = get_async_httpx_client( - llm_provider=LlmProviders.SAGEMAKER_CHAT, params={} + llm_provider=llm_provider, params={} ) try: @@ -210,7 +214,7 @@ class SagemakerChatConfig(OpenAIGPTConfig, BaseAWSLLM): streaming_response = CustomStreamWrapper( completion_stream=completion_stream, model=model, - custom_llm_provider="sagemaker_chat", + custom_llm_provider=custom_llm_provider, logging_obj=logging_obj, ) return streaming_response diff --git a/litellm/llms/sagemaker/nova/__init__.py b/litellm/llms/sagemaker/nova/__init__.py new file mode 100644 index 0000000000..fdebd0b0e4 --- /dev/null +++ b/litellm/llms/sagemaker/nova/__init__.py @@ -0,0 +1 @@ +from .transformation import SagemakerNovaConfig # noqa: F401 diff --git a/litellm/llms/sagemaker/nova/transformation.py b/litellm/llms/sagemaker/nova/transformation.py new file mode 100644 index 0000000000..41c20847b5 --- /dev/null +++ b/litellm/llms/sagemaker/nova/transformation.py @@ -0,0 +1,70 @@ +""" +Translate from OpenAI's `/v1/chat/completions` to SageMaker Nova Inference endpoints. + +Nova models on SageMaker use OpenAI-compatible request/response format with +additional Nova-specific parameters (top_k, reasoning_effort, etc.). + +Docs: https://docs.aws.amazon.com/nova/latest/nova2-userguide/nova-sagemaker-inference-api-reference.html +""" + +from typing import List + +from litellm.types.llms.openai import AllMessageValues + +from ..chat.transformation import SagemakerChatConfig + + +class SagemakerNovaConfig(SagemakerChatConfig): + """ + Config for Amazon Nova models deployed on SageMaker Inference endpoints. + + Nova uses OpenAI-compatible format (same as sagemaker_chat / HF Messages API) + but with additional Nova-specific parameters and requires `stream: true` in + the request body for streaming. + + Usage: + model="sagemaker_nova/" + """ + + @property + def supports_stream_param_in_request_body(self) -> bool: + """Nova expects `stream: true` in the request body for streaming.""" + return True + + def get_supported_openai_params(self, model: str) -> List: + """Extend parent params with Nova-specific parameters.""" + params = super().get_supported_openai_params(model) + nova_params = [ + "top_k", + "reasoning_effort", + "allowed_token_ids", + "truncate_prompt_tokens", + ] + for p in nova_params: + if p not in params: + params.append(p) + return params + + def transform_request( + self, + model: str, + messages: List[AllMessageValues], + optional_params: dict, + litellm_params: dict, + headers: dict, + ) -> dict: + """ + Nova SageMaker endpoints do not accept 'model' in the request body. + Only supported fields: messages, max_tokens, max_completion_tokens, + temperature, top_p, top_k, stream, stream_options, logprobs, + top_logprobs, reasoning_effort, allowed_token_ids, truncate_prompt_tokens. + """ + request_body = super().transform_request( + model=model, + messages=messages, + optional_params=optional_params, + litellm_params=litellm_params, + headers=headers, + ) + request_body.pop("model", None) + return request_body diff --git a/litellm/llms/vertex_ai/batches/transformation.py b/litellm/llms/vertex_ai/batches/transformation.py index 7cb06fea9e..86bdc2c7b5 100644 --- a/litellm/llms/vertex_ai/batches/transformation.py +++ b/litellm/llms/vertex_ai/batches/transformation.py @@ -1,6 +1,6 @@ -from litellm._uuid import uuid from typing import Any, Dict +from litellm._uuid import uuid from litellm.llms.vertex_ai.common_utils import ( _convert_vertex_datetime_to_openai_datetime, ) @@ -144,9 +144,10 @@ class VertexAIBatchTransformation: output_file_id: str = ( response.get("outputInfo", OutputInfo()).get("gcsOutputDirectory", "") - + "/predictions.jsonl" ) - if output_file_id != "/predictions.jsonl": + if output_file_id: + output_file_id = output_file_id.rstrip("/") + "/predictions.jsonl" + if output_file_id and output_file_id != "/predictions.jsonl": return output_file_id output_config = response.get("outputConfig") @@ -158,7 +159,9 @@ class VertexAIBatchTransformation: return output_file_id output_uri_prefix = gcs_destination.get("outputUriPrefix", "") - return output_uri_prefix + if output_uri_prefix.endswith("/predictions.jsonl"): + return output_uri_prefix + return output_uri_prefix.rstrip("/") + "/predictions.jsonl" @classmethod def _get_batch_job_status_from_vertex_ai_batch_response( diff --git a/litellm/llms/vertex_ai/vertex_ai_partner_models/anthropic/experimental_pass_through/transformation.py b/litellm/llms/vertex_ai/vertex_ai_partner_models/anthropic/experimental_pass_through/transformation.py index d3b0217d04..5c3bbf61ee 100644 --- a/litellm/llms/vertex_ai/vertex_ai_partner_models/anthropic/experimental_pass_through/transformation.py +++ b/litellm/llms/vertex_ai/vertex_ai_partner_models/anthropic/experimental_pass_through/transformation.py @@ -150,6 +150,8 @@ class VertexAIPartnerModelsAnthropicMessagesConfig(AnthropicMessagesConfig, Vert headers=headers, ) + self._remove_scope_from_cache_control(anthropic_messages_request) + anthropic_messages_request["anthropic_version"] = "vertex-2023-10-16" anthropic_messages_request.pop( diff --git a/litellm/llms/vertex_ai/videos/transformation.py b/litellm/llms/vertex_ai/videos/transformation.py index e61f2f46ec..07b3d6faf7 100644 --- a/litellm/llms/vertex_ai/videos/transformation.py +++ b/litellm/llms/vertex_ai/videos/transformation.py @@ -624,6 +624,30 @@ class VertexAIVideoConfig(BaseVideoConfig, VertexBase): """Video delete is not supported.""" raise NotImplementedError("Video delete is not supported by Vertex AI Veo.") + def transform_video_create_character_request(self, name, video, api_base, litellm_params, headers): + raise NotImplementedError("video create character is not supported for Vertex AI") + + def transform_video_create_character_response(self, raw_response, logging_obj): + raise NotImplementedError("video create character is not supported for Vertex AI") + + def transform_video_get_character_request(self, character_id, api_base, litellm_params, headers): + raise NotImplementedError("video get character is not supported for Vertex AI") + + def transform_video_get_character_response(self, raw_response, logging_obj): + raise NotImplementedError("video get character is not supported for Vertex AI") + + def transform_video_edit_request(self, prompt, video_id, api_base, litellm_params, headers, extra_body=None): + raise NotImplementedError("video edit is not supported for Vertex AI") + + def transform_video_edit_response(self, raw_response, logging_obj, custom_llm_provider=None): + raise NotImplementedError("video edit is not supported for Vertex AI") + + def transform_video_extension_request(self, prompt, video_id, seconds, api_base, litellm_params, headers, extra_body=None): + raise NotImplementedError("video extension is not supported for Vertex AI") + + def transform_video_extension_response(self, raw_response, logging_obj, custom_llm_provider=None): + raise NotImplementedError("video extension is not supported for Vertex AI") + def get_error_class( self, error_message: str, status_code: int, headers: Union[dict, httpx.Headers] ) -> BaseLLMException: diff --git a/litellm/main.py b/litellm/main.py index 722b4a7aae..81319bc432 100644 --- a/litellm/main.py +++ b/litellm/main.py @@ -1370,6 +1370,13 @@ def completion( # type: ignore # noqa: PLR0915 api_key=api_key, ) + ## RESPONSES API BRIDGE LOGIC ## - check early and normalize model name + responses_api_model_info, model = responses_api_bridge_check( + model=model, + custom_llm_provider=custom_llm_provider, + web_search_options=web_search_options, + ) + if not _should_allow_input_examples( custom_llm_provider=custom_llm_provider, model=model ): @@ -1606,15 +1613,20 @@ def completion( # type: ignore # noqa: PLR0915 ) ## RESPONSES API BRIDGE LOGIC ## - check if model has 'mode: responses' in litellm.model_cost map - model_info, model = responses_api_bridge_check( - model=model, - custom_llm_provider=custom_llm_provider, - web_search_options=web_search_options, - tools=tools, - reasoning_effort=reasoning_effort, - ) + # Only run the second bridge check if the first one didn't already + # detect responses mode (e.g. via the "responses/" prefix). The second + # check handles cases like gpt-5.4+ with tools+reasoning_effort that + # the first (early) check doesn't cover. + if responses_api_model_info.get("mode") != "responses": + responses_api_model_info, model = responses_api_bridge_check( + model=model, + custom_llm_provider=custom_llm_provider, + web_search_options=web_search_options, + tools=tools, + reasoning_effort=reasoning_effort, + ) - if model_info.get("mode") == "responses": + if responses_api_model_info.get("mode") == "responses": from litellm.completion_extras import responses_api_bridge if isinstance(reasoning_effort, dict) and "summary" in reasoning_effort: @@ -3712,8 +3724,10 @@ def completion( # type: ignore # noqa: PLR0915 ): return _model_response response = _model_response - elif custom_llm_provider == "sagemaker_chat": + elif custom_llm_provider in ("sagemaker_chat", "sagemaker_nova"): # boto3 reads keys from .env + # sagemaker_chat: HF Messages API endpoints + # sagemaker_nova: Nova models on SageMaker (OpenAI-compatible) model_response = base_llm_http_handler.completion( model=model, stream=stream, @@ -3723,7 +3737,7 @@ def completion( # type: ignore # noqa: PLR0915 model_response=model_response, optional_params=optional_params, litellm_params=litellm_params, - custom_llm_provider="sagemaker_chat", + custom_llm_provider=custom_llm_provider, timeout=timeout, headers=headers, encoding=_get_encoding(), @@ -5122,6 +5136,7 @@ def embedding( # noqa: PLR0915 client=client, aembedding=aembedding, litellm_params=litellm_params_dict, + headers=headers, ) elif custom_llm_provider == "bedrock": if isinstance(input, str): @@ -7513,8 +7528,15 @@ def stream_chunk_builder( # noqa: PLR0915 ] if len(annotation_chunks) > 0: - annotations = annotation_chunks[0]["choices"][0]["delta"]["annotations"] - response["choices"][0]["message"]["annotations"] = annotations + # Merge annotations from ALL chunks — providers may spread + # them across multiple streaming chunks or send them only in + # the final chunk. + all_annotations: list = [] + for ac in annotation_chunks: + all_annotations.extend( + ac["choices"][0]["delta"]["annotations"] + ) + response["choices"][0]["message"]["annotations"] = all_annotations audio_chunks = [ chunk diff --git a/litellm/model_prices_and_context_window_backup.json b/litellm/model_prices_and_context_window_backup.json index 9b1d81fee4..6786fc3359 100644 --- a/litellm/model_prices_and_context_window_backup.json +++ b/litellm/model_prices_and_context_window_backup.json @@ -22083,6 +22083,7 @@ "output_cost_per_token": 3e-06, "source": "https://platform.moonshot.ai/docs/guide/kimi-k2-5-quickstart", "supports_function_calling": true, + "supports_reasoning": true, "supports_tool_choice": true, "supports_video_input": true, "supports_vision": true @@ -22166,6 +22167,7 @@ "output_cost_per_token": 2.5e-06, "source": "https://platform.moonshot.ai/docs/pricing/chat#generation-model-kimi-k2", "supports_function_calling": true, + "supports_reasoning": true, "supports_tool_choice": true, "supports_web_search": true }, @@ -22180,6 +22182,7 @@ "output_cost_per_token": 8e-06, "source": "https://platform.moonshot.ai/docs/pricing/chat#generation-model-kimi-k2", "supports_function_calling": true, + "supports_reasoning": true, "supports_tool_choice": true, "supports_web_search": true }, diff --git a/litellm/ocr/main.py b/litellm/ocr/main.py index 47cff8a2c0..d90a931b59 100644 --- a/litellm/ocr/main.py +++ b/litellm/ocr/main.py @@ -298,7 +298,8 @@ def ocr( verbose_logger.debug(f"OCR optional_params after mapping: {optional_params}") # Pre Call logging - litellm_logging_obj.update_environment_variables( + litellm_logging_obj.update_from_kwargs( + kwargs=kwargs, model=model, optional_params=optional_params, litellm_params={ diff --git a/litellm/proxy/_experimental/mcp_server/rest_endpoints.py b/litellm/proxy/_experimental/mcp_server/rest_endpoints.py index 298fe36342..5faa0104ac 100644 --- a/litellm/proxy/_experimental/mcp_server/rest_endpoints.py +++ b/litellm/proxy/_experimental/mcp_server/rest_endpoints.py @@ -378,9 +378,7 @@ if MCP_AVAILABLE: # Resolve a server name to its UUID if needed _name_resolved = None if server_id not in allowed_server_ids: - _name_resolved = global_mcp_server_manager.get_mcp_server_by_name( - server_id - ) + _name_resolved = global_mcp_server_manager.get_mcp_server_by_name(server_id) if _name_resolved is not None and _name_resolved.server_id in set( allowed_server_ids ): @@ -442,9 +440,7 @@ if MCP_AVAILABLE: extra_headers=user_oauth_extra_headers, ) except Exception as e: - verbose_logger.exception( - f"Error getting tools from {server.name}: {e}" - ) + verbose_logger.exception(f"Error getting tools from {server.name}: {e}") return { "tools": [], "error": "server_error", @@ -473,7 +469,9 @@ if MCP_AVAILABLE: _name_resolved = None if server_id not in allowed_server_ids: _name_resolved = global_mcp_server_manager.get_mcp_server_by_name(server_id) - if _name_resolved is not None and _name_resolved.server_id in set(allowed_server_ids): + if _name_resolved is not None and _name_resolved.server_id in set( + allowed_server_ids + ): server_id = _name_resolved.server_id if server_id not in allowed_server_ids: @@ -518,7 +516,9 @@ if MCP_AVAILABLE: server_auth_header = _get_server_auth_header( server, mcp_server_auth_headers, mcp_auth_header ) - user_oauth_extra_headers = await _get_user_oauth_extra_headers(server, user_api_key_dict) + user_oauth_extra_headers = await _get_user_oauth_extra_headers( + server, user_api_key_dict + ) try: list_tools_result = await _get_tools_for_single_server( @@ -529,9 +529,7 @@ if MCP_AVAILABLE: extra_headers=user_oauth_extra_headers, ) except Exception as e: - verbose_logger.exception( - f"Error getting tools from {server.name}: {e}" - ) + verbose_logger.exception(f"Error getting tools from {server.name}: {e}") return { "tools": [], "error": "server_error", diff --git a/litellm/proxy/_experimental/out/404.html b/litellm/proxy/_experimental/out/404.html index 9ae6eece58..29dbbfcdd6 100644 --- a/litellm/proxy/_experimental/out/404.html +++ b/litellm/proxy/_experimental/out/404.html @@ -1 +1 @@ -404: This page could not be found.LiteLLM Dashboard

404

This page could not be found.

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

404

This page could not be found.

\ No newline at end of file diff --git a/litellm/proxy/_experimental/out/__next.__PAGE__.txt b/litellm/proxy/_experimental/out/__next.__PAGE__.txt index 9953e63348..f453aaf9be 100644 --- a/litellm/proxy/_experimental/out/__next.__PAGE__.txt +++ b/litellm/proxy/_experimental/out/__next.__PAGE__.txt @@ -1,23 +1,23 @@ 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/a7f104aa2cc7f3f0.js","/litellm-asset-prefix/_next/static/chunks/e8ed72789c2b42ff.js","/litellm-asset-prefix/_next/static/chunks/e627c7aa5ead52b3.js","/litellm-asset-prefix/_next/static/chunks/142704439974f6b3.js","/litellm-asset-prefix/_next/static/chunks/30539b80ac15aad2.js","/litellm-asset-prefix/_next/static/chunks/7d82a1cebfdb679c.js","/litellm-asset-prefix/_next/static/chunks/2d471965761a22ff.js","/litellm-asset-prefix/_next/static/chunks/1fe0596a309ad6cf.js","/litellm-asset-prefix/_next/static/chunks/7b788dd93ad868b3.js","/litellm-asset-prefix/_next/static/chunks/c847ecdf8c790b0b.js","/litellm-asset-prefix/_next/static/chunks/403c4d96324c23a6.js","/litellm-asset-prefix/_next/static/chunks/88c74f8b4b20d25a.js","/litellm-asset-prefix/_next/static/chunks/d64d74932cb225a3.js","/litellm-asset-prefix/_next/static/chunks/8c13023d89b01566.js","/litellm-asset-prefix/_next/static/chunks/3b30ab8eaa03bc21.js","/litellm-asset-prefix/_next/static/chunks/74ce31aa0fb2adc9.js","/litellm-asset-prefix/_next/static/chunks/cdf98a03da656604.js","/litellm-asset-prefix/_next/static/chunks/cac89fc12fb6ef7e.js","/litellm-asset-prefix/_next/static/chunks/d0d828f9a0668699.js","/litellm-asset-prefix/_next/static/chunks/1a04d31843c96649.js","/litellm-asset-prefix/_next/static/chunks/ed90bf177ad61e18.js","/litellm-asset-prefix/_next/static/chunks/2971c4658f1bcd7d.js","/litellm-asset-prefix/_next/static/chunks/6c4c97f1ea6e7d77.js","/litellm-asset-prefix/_next/static/chunks/9d6e5aad99b19216.js","/litellm-asset-prefix/_next/static/chunks/134f728fa7099e3e.js","/litellm-asset-prefix/_next/static/chunks/acbeac1b0fde1fdf.js","/litellm-asset-prefix/_next/static/chunks/fa6fc6b79591df63.js","/litellm-asset-prefix/_next/static/chunks/7e417dd24c8becd0.js","/litellm-asset-prefix/_next/static/chunks/348b31083769a7c4.js","/litellm-asset-prefix/_next/static/chunks/a85adee4198d5478.js","/litellm-asset-prefix/_next/static/chunks/c8eee6971ca36303.js","/litellm-asset-prefix/_next/static/chunks/0adb91ab5f3140d5.js","/litellm-asset-prefix/_next/static/chunks/b6cdb9a433f054f3.js","/litellm-asset-prefix/_next/static/chunks/22970a12064ba16b.js","/litellm-asset-prefix/_next/static/chunks/aae16a3ce4812424.js","/litellm-asset-prefix/_next/static/chunks/4980372eaa37b78b.js","/litellm-asset-prefix/_next/static/chunks/d069df5baead6d90.js","/litellm-asset-prefix/_next/static/chunks/69365f493e1655a4.js","/litellm-asset-prefix/_next/static/chunks/0a65da2cd24e2ab6.js","/litellm-asset-prefix/_next/static/chunks/fc4d54eb6afe7984.js","/litellm-asset-prefix/_next/static/chunks/e99f98e7f34532c9.js","/litellm-asset-prefix/_next/static/chunks/496b84010c33cf69.js","/litellm-asset-prefix/_next/static/chunks/06ebe9b0e9cdf241.js","/litellm-asset-prefix/_next/static/chunks/df6546cd8a44d3b3.js","/litellm-asset-prefix/_next/static/chunks/d3ac82723ec9e30d.js","/litellm-asset-prefix/_next/static/chunks/99cf9cf99df5ccfc.js","/litellm-asset-prefix/_next/static/chunks/07fd9d7c5c879cb6.js","/litellm-asset-prefix/_next/static/chunks/8dda507c226082ca.js","/litellm-asset-prefix/_next/static/chunks/54e29148cb2f2582.js","/litellm-asset-prefix/_next/static/chunks/3675074b1d85e268.js","/litellm-asset-prefix/_next/static/chunks/fcdf7322b0aa3e2e.js","/litellm-asset-prefix/_next/static/chunks/bd94e2fe34d8a187.js"],"default"] +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/e627c7aa5ead52b3.js","/litellm-asset-prefix/_next/static/chunks/142704439974f6b3.js","/litellm-asset-prefix/_next/static/chunks/30539b80ac15aad2.js","/litellm-asset-prefix/_next/static/chunks/7d82a1cebfdb679c.js","/litellm-asset-prefix/_next/static/chunks/2d471965761a22ff.js","/litellm-asset-prefix/_next/static/chunks/1fe0596a309ad6cf.js","/litellm-asset-prefix/_next/static/chunks/7b788dd93ad868b3.js","/litellm-asset-prefix/_next/static/chunks/c847ecdf8c790b0b.js","/litellm-asset-prefix/_next/static/chunks/403c4d96324c23a6.js","/litellm-asset-prefix/_next/static/chunks/88c74f8b4b20d25a.js","/litellm-asset-prefix/_next/static/chunks/d64d74932cb225a3.js","/litellm-asset-prefix/_next/static/chunks/8c13023d89b01566.js","/litellm-asset-prefix/_next/static/chunks/3b30ab8eaa03bc21.js","/litellm-asset-prefix/_next/static/chunks/74ce31aa0fb2adc9.js","/litellm-asset-prefix/_next/static/chunks/cdf98a03da656604.js","/litellm-asset-prefix/_next/static/chunks/cac89fc12fb6ef7e.js","/litellm-asset-prefix/_next/static/chunks/d0d828f9a0668699.js","/litellm-asset-prefix/_next/static/chunks/1a04d31843c96649.js","/litellm-asset-prefix/_next/static/chunks/ed90bf177ad61e18.js","/litellm-asset-prefix/_next/static/chunks/2971c4658f1bcd7d.js","/litellm-asset-prefix/_next/static/chunks/6c4c97f1ea6e7d77.js","/litellm-asset-prefix/_next/static/chunks/9d6e5aad99b19216.js","/litellm-asset-prefix/_next/static/chunks/134f728fa7099e3e.js","/litellm-asset-prefix/_next/static/chunks/acbeac1b0fde1fdf.js","/litellm-asset-prefix/_next/static/chunks/a89452659b6e1d90.js","/litellm-asset-prefix/_next/static/chunks/7e417dd24c8becd0.js","/litellm-asset-prefix/_next/static/chunks/348b31083769a7c4.js","/litellm-asset-prefix/_next/static/chunks/a85adee4198d5478.js","/litellm-asset-prefix/_next/static/chunks/c8eee6971ca36303.js","/litellm-asset-prefix/_next/static/chunks/67ddb5107368a659.js","/litellm-asset-prefix/_next/static/chunks/b6cdb9a433f054f3.js","/litellm-asset-prefix/_next/static/chunks/22970a12064ba16b.js","/litellm-asset-prefix/_next/static/chunks/4348e537165edb3b.js","/litellm-asset-prefix/_next/static/chunks/4980372eaa37b78b.js","/litellm-asset-prefix/_next/static/chunks/d069df5baead6d90.js","/litellm-asset-prefix/_next/static/chunks/0dda11815be4f78b.js","/litellm-asset-prefix/_next/static/chunks/0a65da2cd24e2ab6.js","/litellm-asset-prefix/_next/static/chunks/fc4d54eb6afe7984.js","/litellm-asset-prefix/_next/static/chunks/40f766ecc87dbf9a.js","/litellm-asset-prefix/_next/static/chunks/496b84010c33cf69.js","/litellm-asset-prefix/_next/static/chunks/06ebe9b0e9cdf241.js","/litellm-asset-prefix/_next/static/chunks/df6546cd8a44d3b3.js","/litellm-asset-prefix/_next/static/chunks/d3ac82723ec9e30d.js","/litellm-asset-prefix/_next/static/chunks/99cf9cf99df5ccfc.js","/litellm-asset-prefix/_next/static/chunks/23bf955e8672ce98.js","/litellm-asset-prefix/_next/static/chunks/8dda507c226082ca.js","/litellm-asset-prefix/_next/static/chunks/54e29148cb2f2582.js","/litellm-asset-prefix/_next/static/chunks/3675074b1d85e268.js","/litellm-asset-prefix/_next/static/chunks/fcdf7322b0aa3e2e.js","/litellm-asset-prefix/_next/static/chunks/bd94e2fe34d8a187.js"],"default"] 17:I[897367,["/litellm-asset-prefix/_next/static/chunks/d96012bcfc98706a.js","/litellm-asset-prefix/_next/static/chunks/dbca964212122d58.js"],"OutletBoundary"] 18:"$Sreact.suspense" :HL["/litellm-asset-prefix/_next/static/chunks/3f3fa56b5786d58c.css","style"] -0:{"buildId":"Kalni9LnFJDBB7xvqCPNe","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/e627c7aa5ead52b3.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/7d82a1cebfdb679c.js","async":true}],["$","script","script-4",{"src":"/litellm-asset-prefix/_next/static/chunks/2d471965761a22ff.js","async":true}],["$","script","script-5",{"src":"/litellm-asset-prefix/_next/static/chunks/1fe0596a309ad6cf.js","async":true}],["$","script","script-6",{"src":"/litellm-asset-prefix/_next/static/chunks/7b788dd93ad868b3.js","async":true}],["$","script","script-7",{"src":"/litellm-asset-prefix/_next/static/chunks/c847ecdf8c790b0b.js","async":true}],["$","script","script-8",{"src":"/litellm-asset-prefix/_next/static/chunks/403c4d96324c23a6.js","async":true}],["$","script","script-9",{"src":"/litellm-asset-prefix/_next/static/chunks/88c74f8b4b20d25a.js","async":true}],["$","script","script-10",{"src":"/litellm-asset-prefix/_next/static/chunks/d64d74932cb225a3.js","async":true}],["$","script","script-11",{"src":"/litellm-asset-prefix/_next/static/chunks/8c13023d89b01566.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/74ce31aa0fb2adc9.js","async":true}],["$","script","script-14",{"src":"/litellm-asset-prefix/_next/static/chunks/cdf98a03da656604.js","async":true}],["$","script","script-15",{"src":"/litellm-asset-prefix/_next/static/chunks/cac89fc12fb6ef7e.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/1a04d31843c96649.js","async":true}],["$","script","script-18",{"src":"/litellm-asset-prefix/_next/static/chunks/ed90bf177ad61e18.js","async":true}],["$","script","script-19",{"src":"/litellm-asset-prefix/_next/static/chunks/2971c4658f1bcd7d.js","async":true}],["$","script","script-20",{"src":"/litellm-asset-prefix/_next/static/chunks/6c4c97f1ea6e7d77.js","async":true}],["$","script","script-21",{"src":"/litellm-asset-prefix/_next/static/chunks/9d6e5aad99b19216.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/acbeac1b0fde1fdf.js","async":true}],["$","script","script-24",{"src":"/litellm-asset-prefix/_next/static/chunks/fa6fc6b79591df63.js","async":true}],["$","script","script-25",{"src":"/litellm-asset-prefix/_next/static/chunks/7e417dd24c8becd0.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/a85adee4198d5478.js","async":true}],["$","script","script-28",{"src":"/litellm-asset-prefix/_next/static/chunks/c8eee6971ca36303.js","async":true}],["$","script","script-29",{"src":"/litellm-asset-prefix/_next/static/chunks/0adb91ab5f3140d5.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/22970a12064ba16b.js","async":true}],["$","script","script-32",{"src":"/litellm-asset-prefix/_next/static/chunks/aae16a3ce4812424.js","async":true}],["$","script","script-33",{"src":"/litellm-asset-prefix/_next/static/chunks/4980372eaa37b78b.js","async":true}],"$L6","$L7","$L8","$L9","$La","$Lb","$Lc","$Ld","$Le","$Lf","$L10","$L11","$L12","$L13","$L14","$L15"],"$L16"]}],"loading":null,"isPartial":false} +0:{"buildId":"aKKihXXKRJWLQThZgi8Rq","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/e627c7aa5ead52b3.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/7d82a1cebfdb679c.js","async":true}],["$","script","script-4",{"src":"/litellm-asset-prefix/_next/static/chunks/2d471965761a22ff.js","async":true}],["$","script","script-5",{"src":"/litellm-asset-prefix/_next/static/chunks/1fe0596a309ad6cf.js","async":true}],["$","script","script-6",{"src":"/litellm-asset-prefix/_next/static/chunks/7b788dd93ad868b3.js","async":true}],["$","script","script-7",{"src":"/litellm-asset-prefix/_next/static/chunks/c847ecdf8c790b0b.js","async":true}],["$","script","script-8",{"src":"/litellm-asset-prefix/_next/static/chunks/403c4d96324c23a6.js","async":true}],["$","script","script-9",{"src":"/litellm-asset-prefix/_next/static/chunks/88c74f8b4b20d25a.js","async":true}],["$","script","script-10",{"src":"/litellm-asset-prefix/_next/static/chunks/d64d74932cb225a3.js","async":true}],["$","script","script-11",{"src":"/litellm-asset-prefix/_next/static/chunks/8c13023d89b01566.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/74ce31aa0fb2adc9.js","async":true}],["$","script","script-14",{"src":"/litellm-asset-prefix/_next/static/chunks/cdf98a03da656604.js","async":true}],["$","script","script-15",{"src":"/litellm-asset-prefix/_next/static/chunks/cac89fc12fb6ef7e.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/1a04d31843c96649.js","async":true}],["$","script","script-18",{"src":"/litellm-asset-prefix/_next/static/chunks/ed90bf177ad61e18.js","async":true}],["$","script","script-19",{"src":"/litellm-asset-prefix/_next/static/chunks/2971c4658f1bcd7d.js","async":true}],["$","script","script-20",{"src":"/litellm-asset-prefix/_next/static/chunks/6c4c97f1ea6e7d77.js","async":true}],["$","script","script-21",{"src":"/litellm-asset-prefix/_next/static/chunks/9d6e5aad99b19216.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/acbeac1b0fde1fdf.js","async":true}],["$","script","script-24",{"src":"/litellm-asset-prefix/_next/static/chunks/a89452659b6e1d90.js","async":true}],["$","script","script-25",{"src":"/litellm-asset-prefix/_next/static/chunks/7e417dd24c8becd0.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/a85adee4198d5478.js","async":true}],["$","script","script-28",{"src":"/litellm-asset-prefix/_next/static/chunks/c8eee6971ca36303.js","async":true}],["$","script","script-29",{"src":"/litellm-asset-prefix/_next/static/chunks/67ddb5107368a659.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/22970a12064ba16b.js","async":true}],["$","script","script-32",{"src":"/litellm-asset-prefix/_next/static/chunks/4348e537165edb3b.js","async":true}],["$","script","script-33",{"src":"/litellm-asset-prefix/_next/static/chunks/4980372eaa37b78b.js","async":true}],"$L6","$L7","$L8","$L9","$La","$Lb","$Lc","$Ld","$Le","$Lf","$L10","$L11","$L12","$L13","$L14","$L15"],"$L16"]}],"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/d069df5baead6d90.js","async":true}] -7:["$","script","script-35",{"src":"/litellm-asset-prefix/_next/static/chunks/69365f493e1655a4.js","async":true}] +7:["$","script","script-35",{"src":"/litellm-asset-prefix/_next/static/chunks/0dda11815be4f78b.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/fc4d54eb6afe7984.js","async":true}] -a:["$","script","script-38",{"src":"/litellm-asset-prefix/_next/static/chunks/e99f98e7f34532c9.js","async":true}] +a:["$","script","script-38",{"src":"/litellm-asset-prefix/_next/static/chunks/40f766ecc87dbf9a.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/06ebe9b0e9cdf241.js","async":true}] d:["$","script","script-41",{"src":"/litellm-asset-prefix/_next/static/chunks/df6546cd8a44d3b3.js","async":true}] e:["$","script","script-42",{"src":"/litellm-asset-prefix/_next/static/chunks/d3ac82723ec9e30d.js","async":true}] f:["$","script","script-43",{"src":"/litellm-asset-prefix/_next/static/chunks/99cf9cf99df5ccfc.js","async":true}] -10:["$","script","script-44",{"src":"/litellm-asset-prefix/_next/static/chunks/07fd9d7c5c879cb6.js","async":true}] +10:["$","script","script-44",{"src":"/litellm-asset-prefix/_next/static/chunks/23bf955e8672ce98.js","async":true}] 11:["$","script","script-45",{"src":"/litellm-asset-prefix/_next/static/chunks/8dda507c226082ca.js","async":true}] 12:["$","script","script-46",{"src":"/litellm-asset-prefix/_next/static/chunks/54e29148cb2f2582.js","async":true}] 13:["$","script","script-47",{"src":"/litellm-asset-prefix/_next/static/chunks/3675074b1d85e268.js","async":true}] diff --git a/litellm/proxy/_experimental/out/__next._full.txt b/litellm/proxy/_experimental/out/__next._full.txt index 62ed8a5f0b..49820f4617 100644 --- a/litellm/proxy/_experimental/out/__next._full.txt +++ b/litellm/proxy/_experimental/out/__next._full.txt @@ -4,13 +4,13 @@ 4:I[339756,["/litellm-asset-prefix/_next/static/chunks/d96012bcfc98706a.js","/litellm-asset-prefix/_next/static/chunks/dbca964212122d58.js"],"default"] 5:I[837457,["/litellm-asset-prefix/_next/static/chunks/d96012bcfc98706a.js","/litellm-asset-prefix/_next/static/chunks/dbca964212122d58.js"],"default"] 6:I[347257,["/litellm-asset-prefix/_next/static/chunks/d96012bcfc98706a.js","/litellm-asset-prefix/_next/static/chunks/dbca964212122d58.js"],"ClientPageRoot"] -7:I[952683,["/litellm-asset-prefix/_next/static/chunks/a7f104aa2cc7f3f0.js","/litellm-asset-prefix/_next/static/chunks/e8ed72789c2b42ff.js","/litellm-asset-prefix/_next/static/chunks/e627c7aa5ead52b3.js","/litellm-asset-prefix/_next/static/chunks/142704439974f6b3.js","/litellm-asset-prefix/_next/static/chunks/30539b80ac15aad2.js","/litellm-asset-prefix/_next/static/chunks/7d82a1cebfdb679c.js","/litellm-asset-prefix/_next/static/chunks/2d471965761a22ff.js","/litellm-asset-prefix/_next/static/chunks/1fe0596a309ad6cf.js","/litellm-asset-prefix/_next/static/chunks/7b788dd93ad868b3.js","/litellm-asset-prefix/_next/static/chunks/c847ecdf8c790b0b.js","/litellm-asset-prefix/_next/static/chunks/403c4d96324c23a6.js","/litellm-asset-prefix/_next/static/chunks/88c74f8b4b20d25a.js","/litellm-asset-prefix/_next/static/chunks/d64d74932cb225a3.js","/litellm-asset-prefix/_next/static/chunks/8c13023d89b01566.js","/litellm-asset-prefix/_next/static/chunks/3b30ab8eaa03bc21.js","/litellm-asset-prefix/_next/static/chunks/74ce31aa0fb2adc9.js","/litellm-asset-prefix/_next/static/chunks/cdf98a03da656604.js","/litellm-asset-prefix/_next/static/chunks/cac89fc12fb6ef7e.js","/litellm-asset-prefix/_next/static/chunks/d0d828f9a0668699.js","/litellm-asset-prefix/_next/static/chunks/1a04d31843c96649.js","/litellm-asset-prefix/_next/static/chunks/ed90bf177ad61e18.js","/litellm-asset-prefix/_next/static/chunks/2971c4658f1bcd7d.js","/litellm-asset-prefix/_next/static/chunks/6c4c97f1ea6e7d77.js","/litellm-asset-prefix/_next/static/chunks/9d6e5aad99b19216.js","/litellm-asset-prefix/_next/static/chunks/134f728fa7099e3e.js","/litellm-asset-prefix/_next/static/chunks/acbeac1b0fde1fdf.js","/litellm-asset-prefix/_next/static/chunks/fa6fc6b79591df63.js","/litellm-asset-prefix/_next/static/chunks/7e417dd24c8becd0.js","/litellm-asset-prefix/_next/static/chunks/348b31083769a7c4.js","/litellm-asset-prefix/_next/static/chunks/a85adee4198d5478.js","/litellm-asset-prefix/_next/static/chunks/c8eee6971ca36303.js","/litellm-asset-prefix/_next/static/chunks/0adb91ab5f3140d5.js","/litellm-asset-prefix/_next/static/chunks/b6cdb9a433f054f3.js","/litellm-asset-prefix/_next/static/chunks/22970a12064ba16b.js","/litellm-asset-prefix/_next/static/chunks/aae16a3ce4812424.js","/litellm-asset-prefix/_next/static/chunks/4980372eaa37b78b.js","/litellm-asset-prefix/_next/static/chunks/d069df5baead6d90.js","/litellm-asset-prefix/_next/static/chunks/69365f493e1655a4.js","/litellm-asset-prefix/_next/static/chunks/0a65da2cd24e2ab6.js","/litellm-asset-prefix/_next/static/chunks/fc4d54eb6afe7984.js","/litellm-asset-prefix/_next/static/chunks/e99f98e7f34532c9.js","/litellm-asset-prefix/_next/static/chunks/496b84010c33cf69.js","/litellm-asset-prefix/_next/static/chunks/06ebe9b0e9cdf241.js","/litellm-asset-prefix/_next/static/chunks/df6546cd8a44d3b3.js","/litellm-asset-prefix/_next/static/chunks/d3ac82723ec9e30d.js","/litellm-asset-prefix/_next/static/chunks/99cf9cf99df5ccfc.js","/litellm-asset-prefix/_next/static/chunks/07fd9d7c5c879cb6.js","/litellm-asset-prefix/_next/static/chunks/8dda507c226082ca.js","/litellm-asset-prefix/_next/static/chunks/54e29148cb2f2582.js","/litellm-asset-prefix/_next/static/chunks/3675074b1d85e268.js","/litellm-asset-prefix/_next/static/chunks/fcdf7322b0aa3e2e.js","/litellm-asset-prefix/_next/static/chunks/bd94e2fe34d8a187.js"],"default"] +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/e627c7aa5ead52b3.js","/litellm-asset-prefix/_next/static/chunks/142704439974f6b3.js","/litellm-asset-prefix/_next/static/chunks/30539b80ac15aad2.js","/litellm-asset-prefix/_next/static/chunks/7d82a1cebfdb679c.js","/litellm-asset-prefix/_next/static/chunks/2d471965761a22ff.js","/litellm-asset-prefix/_next/static/chunks/1fe0596a309ad6cf.js","/litellm-asset-prefix/_next/static/chunks/7b788dd93ad868b3.js","/litellm-asset-prefix/_next/static/chunks/c847ecdf8c790b0b.js","/litellm-asset-prefix/_next/static/chunks/403c4d96324c23a6.js","/litellm-asset-prefix/_next/static/chunks/88c74f8b4b20d25a.js","/litellm-asset-prefix/_next/static/chunks/d64d74932cb225a3.js","/litellm-asset-prefix/_next/static/chunks/8c13023d89b01566.js","/litellm-asset-prefix/_next/static/chunks/3b30ab8eaa03bc21.js","/litellm-asset-prefix/_next/static/chunks/74ce31aa0fb2adc9.js","/litellm-asset-prefix/_next/static/chunks/cdf98a03da656604.js","/litellm-asset-prefix/_next/static/chunks/cac89fc12fb6ef7e.js","/litellm-asset-prefix/_next/static/chunks/d0d828f9a0668699.js","/litellm-asset-prefix/_next/static/chunks/1a04d31843c96649.js","/litellm-asset-prefix/_next/static/chunks/ed90bf177ad61e18.js","/litellm-asset-prefix/_next/static/chunks/2971c4658f1bcd7d.js","/litellm-asset-prefix/_next/static/chunks/6c4c97f1ea6e7d77.js","/litellm-asset-prefix/_next/static/chunks/9d6e5aad99b19216.js","/litellm-asset-prefix/_next/static/chunks/134f728fa7099e3e.js","/litellm-asset-prefix/_next/static/chunks/acbeac1b0fde1fdf.js","/litellm-asset-prefix/_next/static/chunks/a89452659b6e1d90.js","/litellm-asset-prefix/_next/static/chunks/7e417dd24c8becd0.js","/litellm-asset-prefix/_next/static/chunks/348b31083769a7c4.js","/litellm-asset-prefix/_next/static/chunks/a85adee4198d5478.js","/litellm-asset-prefix/_next/static/chunks/c8eee6971ca36303.js","/litellm-asset-prefix/_next/static/chunks/67ddb5107368a659.js","/litellm-asset-prefix/_next/static/chunks/b6cdb9a433f054f3.js","/litellm-asset-prefix/_next/static/chunks/22970a12064ba16b.js","/litellm-asset-prefix/_next/static/chunks/4348e537165edb3b.js","/litellm-asset-prefix/_next/static/chunks/4980372eaa37b78b.js","/litellm-asset-prefix/_next/static/chunks/d069df5baead6d90.js","/litellm-asset-prefix/_next/static/chunks/0dda11815be4f78b.js","/litellm-asset-prefix/_next/static/chunks/0a65da2cd24e2ab6.js","/litellm-asset-prefix/_next/static/chunks/fc4d54eb6afe7984.js","/litellm-asset-prefix/_next/static/chunks/40f766ecc87dbf9a.js","/litellm-asset-prefix/_next/static/chunks/496b84010c33cf69.js","/litellm-asset-prefix/_next/static/chunks/06ebe9b0e9cdf241.js","/litellm-asset-prefix/_next/static/chunks/df6546cd8a44d3b3.js","/litellm-asset-prefix/_next/static/chunks/d3ac82723ec9e30d.js","/litellm-asset-prefix/_next/static/chunks/99cf9cf99df5ccfc.js","/litellm-asset-prefix/_next/static/chunks/23bf955e8672ce98.js","/litellm-asset-prefix/_next/static/chunks/8dda507c226082ca.js","/litellm-asset-prefix/_next/static/chunks/54e29148cb2f2582.js","/litellm-asset-prefix/_next/static/chunks/3675074b1d85e268.js","/litellm-asset-prefix/_next/static/chunks/fcdf7322b0aa3e2e.js","/litellm-asset-prefix/_next/static/chunks/bd94e2fe34d8a187.js"],"default"] 2e:I[168027,[],"default"] :HL["/litellm-asset-prefix/_next/static/chunks/4e20891f2fd03463.css","style"] :HL["/litellm-asset-prefix/_next/static/chunks/8dc3b559a2e76f88.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":"Kalni9LnFJDBB7xvqCPNe","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/8dc3b559a2e76f88.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/e627c7aa5ead52b3.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/7d82a1cebfdb679c.js","async":true,"nonce":"$undefined"}],["$","script","script-4",{"src":"/litellm-asset-prefix/_next/static/chunks/2d471965761a22ff.js","async":true,"nonce":"$undefined"}],["$","script","script-5",{"src":"/litellm-asset-prefix/_next/static/chunks/1fe0596a309ad6cf.js","async":true,"nonce":"$undefined"}],["$","script","script-6",{"src":"/litellm-asset-prefix/_next/static/chunks/7b788dd93ad868b3.js","async":true,"nonce":"$undefined"}],["$","script","script-7",{"src":"/litellm-asset-prefix/_next/static/chunks/c847ecdf8c790b0b.js","async":true,"nonce":"$undefined"}],["$","script","script-8",{"src":"/litellm-asset-prefix/_next/static/chunks/403c4d96324c23a6.js","async":true,"nonce":"$undefined"}],["$","script","script-9",{"src":"/litellm-asset-prefix/_next/static/chunks/88c74f8b4b20d25a.js","async":true,"nonce":"$undefined"}],["$","script","script-10",{"src":"/litellm-asset-prefix/_next/static/chunks/d64d74932cb225a3.js","async":true,"nonce":"$undefined"}],["$","script","script-11",{"src":"/litellm-asset-prefix/_next/static/chunks/8c13023d89b01566.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/74ce31aa0fb2adc9.js","async":true,"nonce":"$undefined"}],["$","script","script-14",{"src":"/litellm-asset-prefix/_next/static/chunks/cdf98a03da656604.js","async":true,"nonce":"$undefined"}],["$","script","script-15",{"src":"/litellm-asset-prefix/_next/static/chunks/cac89fc12fb6ef7e.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"]}],{},null,false,false]},null,false,false],"$L2d",false]],"m":"$undefined","G":["$2e",[]],"S":true} +0:{"P":null,"b":"aKKihXXKRJWLQThZgi8Rq","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/8dc3b559a2e76f88.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/e627c7aa5ead52b3.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/7d82a1cebfdb679c.js","async":true,"nonce":"$undefined"}],["$","script","script-4",{"src":"/litellm-asset-prefix/_next/static/chunks/2d471965761a22ff.js","async":true,"nonce":"$undefined"}],["$","script","script-5",{"src":"/litellm-asset-prefix/_next/static/chunks/1fe0596a309ad6cf.js","async":true,"nonce":"$undefined"}],["$","script","script-6",{"src":"/litellm-asset-prefix/_next/static/chunks/7b788dd93ad868b3.js","async":true,"nonce":"$undefined"}],["$","script","script-7",{"src":"/litellm-asset-prefix/_next/static/chunks/c847ecdf8c790b0b.js","async":true,"nonce":"$undefined"}],["$","script","script-8",{"src":"/litellm-asset-prefix/_next/static/chunks/403c4d96324c23a6.js","async":true,"nonce":"$undefined"}],["$","script","script-9",{"src":"/litellm-asset-prefix/_next/static/chunks/88c74f8b4b20d25a.js","async":true,"nonce":"$undefined"}],["$","script","script-10",{"src":"/litellm-asset-prefix/_next/static/chunks/d64d74932cb225a3.js","async":true,"nonce":"$undefined"}],["$","script","script-11",{"src":"/litellm-asset-prefix/_next/static/chunks/8c13023d89b01566.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/74ce31aa0fb2adc9.js","async":true,"nonce":"$undefined"}],["$","script","script-14",{"src":"/litellm-asset-prefix/_next/static/chunks/cdf98a03da656604.js","async":true,"nonce":"$undefined"}],["$","script","script-15",{"src":"/litellm-asset-prefix/_next/static/chunks/cac89fc12fb6ef7e.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"]}],{},null,false,false]},null,false,false],"$L2d",false]],"m":"$undefined","G":["$2e",[]],"S":true} 2f:I[897367,["/litellm-asset-prefix/_next/static/chunks/d96012bcfc98706a.js","/litellm-asset-prefix/_next/static/chunks/dbca964212122d58.js"],"OutletBoundary"] 30:"$Sreact.suspense" 32:I[897367,["/litellm-asset-prefix/_next/static/chunks/d96012bcfc98706a.js","/litellm-asset-prefix/_next/static/chunks/dbca964212122d58.js"],"ViewportBoundary"] @@ -23,27 +23,27 @@ e:["$","script","script-20",{"src":"/litellm-asset-prefix/_next/static/chunks/6c f:["$","script","script-21",{"src":"/litellm-asset-prefix/_next/static/chunks/9d6e5aad99b19216.js","async":true,"nonce":"$undefined"}] 10:["$","script","script-22",{"src":"/litellm-asset-prefix/_next/static/chunks/134f728fa7099e3e.js","async":true,"nonce":"$undefined"}] 11:["$","script","script-23",{"src":"/litellm-asset-prefix/_next/static/chunks/acbeac1b0fde1fdf.js","async":true,"nonce":"$undefined"}] -12:["$","script","script-24",{"src":"/litellm-asset-prefix/_next/static/chunks/fa6fc6b79591df63.js","async":true,"nonce":"$undefined"}] +12:["$","script","script-24",{"src":"/litellm-asset-prefix/_next/static/chunks/a89452659b6e1d90.js","async":true,"nonce":"$undefined"}] 13:["$","script","script-25",{"src":"/litellm-asset-prefix/_next/static/chunks/7e417dd24c8becd0.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/a85adee4198d5478.js","async":true,"nonce":"$undefined"}] 16:["$","script","script-28",{"src":"/litellm-asset-prefix/_next/static/chunks/c8eee6971ca36303.js","async":true,"nonce":"$undefined"}] -17:["$","script","script-29",{"src":"/litellm-asset-prefix/_next/static/chunks/0adb91ab5f3140d5.js","async":true,"nonce":"$undefined"}] +17:["$","script","script-29",{"src":"/litellm-asset-prefix/_next/static/chunks/67ddb5107368a659.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/22970a12064ba16b.js","async":true,"nonce":"$undefined"}] -1a:["$","script","script-32",{"src":"/litellm-asset-prefix/_next/static/chunks/aae16a3ce4812424.js","async":true,"nonce":"$undefined"}] +1a:["$","script","script-32",{"src":"/litellm-asset-prefix/_next/static/chunks/4348e537165edb3b.js","async":true,"nonce":"$undefined"}] 1b:["$","script","script-33",{"src":"/litellm-asset-prefix/_next/static/chunks/4980372eaa37b78b.js","async":true,"nonce":"$undefined"}] 1c:["$","script","script-34",{"src":"/litellm-asset-prefix/_next/static/chunks/d069df5baead6d90.js","async":true,"nonce":"$undefined"}] -1d:["$","script","script-35",{"src":"/litellm-asset-prefix/_next/static/chunks/69365f493e1655a4.js","async":true,"nonce":"$undefined"}] +1d:["$","script","script-35",{"src":"/litellm-asset-prefix/_next/static/chunks/0dda11815be4f78b.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/fc4d54eb6afe7984.js","async":true,"nonce":"$undefined"}] -20:["$","script","script-38",{"src":"/litellm-asset-prefix/_next/static/chunks/e99f98e7f34532c9.js","async":true,"nonce":"$undefined"}] +20:["$","script","script-38",{"src":"/litellm-asset-prefix/_next/static/chunks/40f766ecc87dbf9a.js","async":true,"nonce":"$undefined"}] 21:["$","script","script-39",{"src":"/litellm-asset-prefix/_next/static/chunks/496b84010c33cf69.js","async":true,"nonce":"$undefined"}] 22:["$","script","script-40",{"src":"/litellm-asset-prefix/_next/static/chunks/06ebe9b0e9cdf241.js","async":true,"nonce":"$undefined"}] 23:["$","script","script-41",{"src":"/litellm-asset-prefix/_next/static/chunks/df6546cd8a44d3b3.js","async":true,"nonce":"$undefined"}] 24:["$","script","script-42",{"src":"/litellm-asset-prefix/_next/static/chunks/d3ac82723ec9e30d.js","async":true,"nonce":"$undefined"}] 25:["$","script","script-43",{"src":"/litellm-asset-prefix/_next/static/chunks/99cf9cf99df5ccfc.js","async":true,"nonce":"$undefined"}] -26:["$","script","script-44",{"src":"/litellm-asset-prefix/_next/static/chunks/07fd9d7c5c879cb6.js","async":true,"nonce":"$undefined"}] +26:["$","script","script-44",{"src":"/litellm-asset-prefix/_next/static/chunks/23bf955e8672ce98.js","async":true,"nonce":"$undefined"}] 27:["$","script","script-45",{"src":"/litellm-asset-prefix/_next/static/chunks/8dda507c226082ca.js","async":true,"nonce":"$undefined"}] 28:["$","script","script-46",{"src":"/litellm-asset-prefix/_next/static/chunks/54e29148cb2f2582.js","async":true,"nonce":"$undefined"}] 29:["$","script","script-47",{"src":"/litellm-asset-prefix/_next/static/chunks/3675074b1d85e268.js","async":true,"nonce":"$undefined"}] diff --git a/litellm/proxy/_experimental/out/__next._head.txt b/litellm/proxy/_experimental/out/__next._head.txt index 594e8f5749..8005053bb8 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":"Kalni9LnFJDBB7xvqCPNe","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":"aKKihXXKRJWLQThZgi8Rq","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 5b96902d9c..2670187ea3 100644 --- a/litellm/proxy/_experimental/out/__next._index.txt +++ b/litellm/proxy/_experimental/out/__next._index.txt @@ -5,4 +5,4 @@ 5:I[837457,["/litellm-asset-prefix/_next/static/chunks/d96012bcfc98706a.js","/litellm-asset-prefix/_next/static/chunks/dbca964212122d58.js"],"default"] :HL["/litellm-asset-prefix/_next/static/chunks/4e20891f2fd03463.css","style"] :HL["/litellm-asset-prefix/_next/static/chunks/8dc3b559a2e76f88.css","style"] -0:{"buildId":"Kalni9LnFJDBB7xvqCPNe","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/8dc3b559a2e76f88.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} +0:{"buildId":"aKKihXXKRJWLQThZgi8Rq","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/8dc3b559a2e76f88.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 90402dd4bf..e783edb76a 100644 --- a/litellm/proxy/_experimental/out/__next._tree.txt +++ b/litellm/proxy/_experimental/out/__next._tree.txt @@ -2,4 +2,4 @@ :HL["/litellm-asset-prefix/_next/static/chunks/8dc3b559a2e76f88.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":"Kalni9LnFJDBB7xvqCPNe","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":"aKKihXXKRJWLQThZgi8Rq","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/Kalni9LnFJDBB7xvqCPNe/_buildManifest.js b/litellm/proxy/_experimental/out/_next/static/aKKihXXKRJWLQThZgi8Rq/_buildManifest.js similarity index 100% rename from litellm/proxy/_experimental/out/_next/static/Kalni9LnFJDBB7xvqCPNe/_buildManifest.js rename to litellm/proxy/_experimental/out/_next/static/aKKihXXKRJWLQThZgi8Rq/_buildManifest.js diff --git a/litellm/proxy/_experimental/out/_next/static/Kalni9LnFJDBB7xvqCPNe/_clientMiddlewareManifest.json b/litellm/proxy/_experimental/out/_next/static/aKKihXXKRJWLQThZgi8Rq/_clientMiddlewareManifest.json similarity index 100% rename from litellm/proxy/_experimental/out/_next/static/Kalni9LnFJDBB7xvqCPNe/_clientMiddlewareManifest.json rename to litellm/proxy/_experimental/out/_next/static/aKKihXXKRJWLQThZgi8Rq/_clientMiddlewareManifest.json diff --git a/litellm/proxy/_experimental/out/_next/static/Kalni9LnFJDBB7xvqCPNe/_ssgManifest.js b/litellm/proxy/_experimental/out/_next/static/aKKihXXKRJWLQThZgi8Rq/_ssgManifest.js similarity index 100% rename from litellm/proxy/_experimental/out/_next/static/Kalni9LnFJDBB7xvqCPNe/_ssgManifest.js rename to litellm/proxy/_experimental/out/_next/static/aKKihXXKRJWLQThZgi8Rq/_ssgManifest.js diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/07fd9d7c5c879cb6.js b/litellm/proxy/_experimental/out/_next/static/chunks/07fd9d7c5c879cb6.js deleted file mode 100644 index 77423d0078..0000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/07fd9d7c5c879cb6.js +++ /dev/null @@ -1 +0,0 @@ -(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,757440,e=>{"use strict";var t=e.i(290571),s=e.i(271645);let r=e=>{var r=(0,t.__rest)(e,[]);return s.default.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},r),s.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",()=>r])},446428,854056,e=>{"use strict";let t;var s=e.i(290571),r=e.i(271645);let l=e=>{var t=(0,s.__rest)(e,[]);return r.default.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),r.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",()=>l],446428);var a=e.i(746725),n=e.i(914189),i=e.i(553521),o=e.i(835696),d=e.i(941444),c=e.i(178677),u=e.i(294316),m=e.i(83733),h=e.i(233137),x=e.i(732607),g=e.i(397701),f=e.i(700020);function p(e){var t;return!!(e.enter||e.enterFrom||e.enterTo||e.leave||e.leaveFrom||e.leaveTo)||(null!=(t=e.as)?t:N)!==r.Fragment||1===r.default.Children.count(e.children)}let b=(0,r.createContext)(null);b.displayName="TransitionContext";var j=((t=j||{}).Visible="visible",t.Hidden="hidden",t);let y=(0,r.createContext)(null);function v(e){return"children"in e?v(e.children):e.current.filter(({el:e})=>null!==e.current).filter(({state:e})=>"visible"===e).length>0}function _(e,t){let s=(0,d.useLatestValue)(e),l=(0,r.useRef)([]),o=(0,i.useIsMounted)(),c=(0,a.useDisposables)(),u=(0,n.useEvent)((e,t=f.RenderStrategy.Hidden)=>{let r=l.current.findIndex(({el:t})=>t===e);-1!==r&&((0,g.match)(t,{[f.RenderStrategy.Unmount](){l.current.splice(r,1)},[f.RenderStrategy.Hidden](){l.current[r].state="hidden"}}),c.microTask(()=>{var e;!v(l)&&o.current&&(null==(e=s.current)||e.call(s))}))}),m=(0,n.useEvent)(e=>{let t=l.current.find(({el:t})=>t===e);return t?"visible"!==t.state&&(t.state="visible"):l.current.push({el:e,state:"visible"}),()=>u(e,f.RenderStrategy.Unmount)}),h=(0,r.useRef)([]),x=(0,r.useRef)(Promise.resolve()),p=(0,r.useRef)({enter:[],leave:[]}),b=(0,n.useEvent)((e,s,r)=>{h.current.splice(0),t&&(t.chains.current[s]=t.chains.current[s].filter(([t])=>t!==e)),null==t||t.chains.current[s].push([e,new Promise(e=>{h.current.push(e)})]),null==t||t.chains.current[s].push([e,new Promise(e=>{Promise.all(p.current[s].map(([e,t])=>t)).then(()=>e())})]),"enter"===s?x.current=x.current.then(()=>null==t?void 0:t.wait.current).then(()=>r(s)):r(s)}),j=(0,n.useEvent)((e,t,s)=>{Promise.all(p.current[t].splice(0).map(([e,t])=>t)).then(()=>{var e;null==(e=h.current.shift())||e()}).then(()=>s(t))});return(0,r.useMemo)(()=>({children:l,register:m,unregister:u,onStart:b,onStop:j,wait:x,chains:p}),[m,u,l,b,j,p,x])}y.displayName="NestingContext";let N=r.Fragment,S=f.RenderFeatures.RenderStrategy,w=(0,f.forwardRefWithAs)(function(e,t){let{show:s,appear:l=!1,unmount:a=!0,...i}=e,d=(0,r.useRef)(null),m=p(e),x=(0,u.useSyncRefs)(...m?[d,t]:null===t?[]:[t]);(0,c.useServerHandoffComplete)();let g=(0,h.useOpenClosed)();if(void 0===s&&null!==g&&(s=(g&h.State.Open)===h.State.Open),void 0===s)throw Error("A is used but it is missing a `show={true | false}` prop.");let[j,N]=(0,r.useState)(s?"visible":"hidden"),w=_(()=>{s||N("hidden")}),[T,k]=(0,r.useState)(!0),I=(0,r.useRef)([s]);(0,o.useIsoMorphicEffect)(()=>{!1!==T&&I.current[I.current.length-1]!==s&&(I.current.push(s),k(!1))},[I,s]);let E=(0,r.useMemo)(()=>({show:s,appear:l,initial:T}),[s,l,T]);(0,o.useIsoMorphicEffect)(()=>{s?N("visible"):v(w)||null===d.current||N("hidden")},[s,w]);let U={unmount:a},R=(0,n.useEvent)(()=>{var t;T&&k(!1),null==(t=e.beforeEnter)||t.call(e)}),B=(0,n.useEvent)(()=>{var t;T&&k(!1),null==(t=e.beforeLeave)||t.call(e)}),F=(0,f.useRender)();return r.default.createElement(y.Provider,{value:w},r.default.createElement(b.Provider,{value:E},F({ourProps:{...U,as:r.Fragment,children:r.default.createElement(C,{ref:x,...U,...i,beforeEnter:R,beforeLeave:B})},theirProps:{},defaultTag:r.Fragment,features:S,visible:"visible"===j,name:"Transition"})))}),C=(0,f.forwardRefWithAs)(function(e,t){var s,l;let{transition:a=!0,beforeEnter:i,afterEnter:d,beforeLeave:j,afterLeave:w,enter:C,enterFrom:T,enterTo:k,entered:I,leave:E,leaveFrom:U,leaveTo:R,...B}=e,[F,M]=(0,r.useState)(null),L=(0,r.useRef)(null),D=p(e),A=(0,u.useSyncRefs)(...D?[L,t,M]:null===t?[]:[t]),O=null==(s=B.unmount)||s?f.RenderStrategy.Unmount:f.RenderStrategy.Hidden,{show:P,appear:z,initial:V}=function(){let e=(0,r.useContext)(b);if(null===e)throw Error("A is used but it is missing a parent or .");return e}(),[$,K]=(0,r.useState)(P?"visible":"hidden"),q=function(){let e=(0,r.useContext)(y);if(null===e)throw Error("A is used but it is missing a parent or .");return e}(),{register:H,unregister:W}=q;(0,o.useIsoMorphicEffect)(()=>H(L),[H,L]),(0,o.useIsoMorphicEffect)(()=>{if(O===f.RenderStrategy.Hidden&&L.current)return P&&"visible"!==$?void K("visible"):(0,g.match)($,{hidden:()=>W(L),visible:()=>H(L)})},[$,L,H,W,P,O]);let G=(0,c.useServerHandoffComplete)();(0,o.useIsoMorphicEffect)(()=>{if(D&&G&&"visible"===$&&null===L.current)throw Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[L,$,G,D]);let J=V&&!z,Q=z&&P&&V,Z=(0,r.useRef)(!1),Y=_(()=>{Z.current||(K("hidden"),W(L))},q),X=(0,n.useEvent)(e=>{Z.current=!0,Y.onStart(L,e?"enter":"leave",e=>{"enter"===e?null==i||i():"leave"===e&&(null==j||j())})}),ee=(0,n.useEvent)(e=>{let t=e?"enter":"leave";Z.current=!1,Y.onStop(L,t,e=>{"enter"===e?null==d||d():"leave"===e&&(null==w||w())}),"leave"!==t||v(Y)||(K("hidden"),W(L))});(0,r.useEffect)(()=>{D&&a||(X(P),ee(P))},[P,D,a]);let et=!(!a||!D||!G||J),[,es]=(0,m.useTransition)(et,F,P,{start:X,end:ee}),er=(0,f.compact)({ref:A,className:(null==(l=(0,x.classNames)(B.className,Q&&C,Q&&T,es.enter&&C,es.enter&&es.closed&&T,es.enter&&!es.closed&&k,es.leave&&E,es.leave&&!es.closed&&U,es.leave&&es.closed&&R,!es.transition&&P&&I))?void 0:l.trim())||void 0,...(0,m.transitionDataAttributes)(es)}),el=0;"visible"===$&&(el|=h.State.Open),"hidden"===$&&(el|=h.State.Closed),es.enter&&(el|=h.State.Opening),es.leave&&(el|=h.State.Closing);let ea=(0,f.useRender)();return r.default.createElement(y.Provider,{value:Y},r.default.createElement(h.OpenClosedProvider,{value:el},ea({ourProps:er,theirProps:B,defaultTag:N,features:S,visible:"visible"===$,name:"Transition.Child"})))}),T=(0,f.forwardRefWithAs)(function(e,t){let s=null!==(0,r.useContext)(b),l=null!==(0,h.useOpenClosed)();return r.default.createElement(r.default.Fragment,null,!s&&l?r.default.createElement(w,{ref:t,...e}):r.default.createElement(C,{ref:t,...e}))}),k=Object.assign(w,{Child:T,Root:w});e.s(["Transition",()=>k],854056)},206929,e=>{"use strict";var t=e.i(290571),s=e.i(757440),r=e.i(271645),l=e.i(446428),a=e.i(444755),n=e.i(673706),i=e.i(103471),o=e.i(495470),d=e.i(854056),c=e.i(888288);let u=(0,n.makeClassName)("Select"),m=r.default.forwardRef((e,n)=>{let{defaultValue:m="",value:h,onValueChange:x,placeholder:g="Select...",disabled:f=!1,icon:p,enableClear:b=!1,required:j,children:y,name:v,error:_=!1,errorMessage:N,className:S,id:w}=e,C=(0,t.__rest)(e,["defaultValue","value","onValueChange","placeholder","disabled","icon","enableClear","required","children","name","error","errorMessage","className","id"]),T=(0,r.useRef)(null),k=r.Children.toArray(y),[I,E]=(0,c.default)(m,h),U=(0,r.useMemo)(()=>{let e=r.default.Children.toArray(y).filter(r.isValidElement);return(0,i.constructValueToNameMapping)(e)},[y]);return r.default.createElement("div",{className:(0,a.tremorTwMerge)("w-full min-w-[10rem] text-tremor-default",S)},r.default.createElement("div",{className:"relative"},r.default.createElement("select",{title:"select-hidden",required:j,className:(0,a.tremorTwMerge)("h-full w-full absolute left-0 top-0 -z-10 opacity-0"),value:I,onChange:e=>{e.preventDefault()},name:v,disabled:f,id:w,onFocus:()=>{let e=T.current;e&&e.focus()}},r.default.createElement("option",{className:"hidden",value:"",disabled:!0,hidden:!0},g),k.map(e=>{let t=e.props.value,s=e.props.children;return r.default.createElement("option",{className:"hidden",key:t,value:t},s)})),r.default.createElement(o.Listbox,Object.assign({as:"div",ref:n,defaultValue:I,value:I,onChange:e=>{null==x||x(e),E(e)},disabled:f,id:w},C),({value:e})=>{var t;return r.default.createElement(r.default.Fragment,null,r.default.createElement(o.ListboxButton,{ref:T,className:(0,a.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",p?"pl-10":"pl-3",(0,i.getSelectButtonColors)((0,i.hasValue)(e),f,_))},p&&r.default.createElement("span",{className:(0,a.tremorTwMerge)("absolute inset-y-0 left-0 flex items-center ml-px pl-2.5")},r.default.createElement(p,{className:(0,a.tremorTwMerge)(u("Icon"),"flex-none h-5 w-5","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")})),r.default.createElement("span",{className:"w-[90%] block truncate"},e&&null!=(t=U.get(e))?t:g),r.default.createElement("span",{className:(0,a.tremorTwMerge)("absolute inset-y-0 right-0 flex items-center mr-3")},r.default.createElement(s.default,{className:(0,a.tremorTwMerge)(u("arrowDownIcon"),"flex-none h-5 w-5","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")}))),b&&I?r.default.createElement("button",{type:"button",className:(0,a.tremorTwMerge)("absolute inset-y-0 right-0 flex items-center mr-8"),onClick:e=>{e.preventDefault(),E(""),null==x||x("")}},r.default.createElement(l.default,{className:(0,a.tremorTwMerge)(u("clearIcon"),"flex-none h-4 w-4","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")})):null,r.default.createElement(d.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"},r.default.createElement(o.ListboxOptions,{anchor:"bottom start",className:(0,a.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")},y)))})),_&&N?r.default.createElement("p",{className:(0,a.tremorTwMerge)("errorMessage","text-sm text-rose-500 mt-1")},N):null)});m.displayName="Select",e.s(["Select",()=>m],206929)},502275,e=>{"use strict";var t=e.i(271645);let s=t.forwardRef(function(e,s){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:s},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}))});e.s(["InformationCircleIcon",0,s],502275)},78085,e=>{"use strict";var t=e.i(290571),s=e.i(103471),r=e.i(888288),l=e.i(271645),a=e.i(444755),n=e.i(673706);let i=(0,n.makeClassName)("Textarea"),o=l.default.forwardRef((e,o)=>{let{value:d,defaultValue:c="",placeholder:u="Type...",error:m=!1,errorMessage:h,disabled:x=!1,className:g,onChange:f,onValueChange:p,autoHeight:b=!1}=e,j=(0,t.__rest)(e,["value","defaultValue","placeholder","error","errorMessage","disabled","className","onChange","onValueChange","autoHeight"]),[y,v]=(0,r.default)(c,d),_=(0,l.useRef)(null),N=(0,s.hasValue)(y);return(0,l.useEffect)(()=>{let e=_.current;if(b&&e){e.style.height="60px";let t=e.scrollHeight;e.style.height=t+"px"}},[b,_,y]),l.default.createElement(l.default.Fragment,null,l.default.createElement("textarea",Object.assign({ref:(0,n.mergeRefs)([_,o]),value:y,placeholder:u,disabled:x,className:(0,a.tremorTwMerge)(i("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,s.getSelectButtonColors)(N,x,m),x?"placeholder:text-tremor-content-subtle dark:placeholder:text-dark-tremor-content-subtle":"placeholder:text-tremor-content dark:placeholder:text-dark-tremor-content",g),"data-testid":"text-area",onChange:e=>{null==f||f(e),v(e.target.value),null==p||p(e.target.value)}},j)),m&&h?l.default.createElement("p",{className:(0,a.tremorTwMerge)(i("errorMessage"),"text-sm text-red-500 mt-1")},h):null)});o.displayName="Textarea",e.s(["Textarea",()=>o],78085)},910119,e=>{"use strict";var t=e.i(843476),s=e.i(197647),r=e.i(653824),l=e.i(881073),a=e.i(404206),n=e.i(723731),i=e.i(271645),o=e.i(464571),d=e.i(212931),c=e.i(898586),u=e.i(312361),m=e.i(998573),h=e.i(291542),x=e.i(199133),g=e.i(28651),f=e.i(175712),p=e.i(770914),b=e.i(536916),j=e.i(764205),y=e.i(827252),v=e.i(994388),_=e.i(35983),N=e.i(779241),S=e.i(78085),w=e.i(808613),C=e.i(592968),T=e.i(708347),k=e.i(860585),I=e.i(355619),E=e.i(435451);function U({userData:e,onCancel:s,onSubmit:r,teams:l,accessToken:a,userID:n,userRole:o,userModels:d,possibleUIRoles:c,isBulkEdit:u=!1}){let[m]=w.Form.useForm(),[h,g]=(0,i.useState)(!1);return i.default.useEffect(()=>{let t=e.user_info?.max_budget,s=null==t;g(s),m.setFieldsValue({user_id:e.user_id,user_email:e.user_info?.user_email,user_alias:e.user_info?.user_alias,user_role:e.user_info?.user_role,models:e.user_info?.models||[],max_budget:s?"":t,budget_duration:e.user_info?.budget_duration,metadata:e.user_info?.metadata?JSON.stringify(e.user_info.metadata,null,2):void 0})},[e,m]),(0,t.jsxs)(w.Form,{form:m,onFinish:e=>{if(e.metadata&&"string"==typeof e.metadata)try{e.metadata=JSON.parse(e.metadata)}catch(e){console.error("Error parsing metadata JSON:",e);return}(h||""===e.max_budget||void 0===e.max_budget)&&(e.max_budget=null),r(e)},layout:"vertical",children:[!u&&(0,t.jsx)(w.Form.Item,{label:"User ID",name:"user_id",children:(0,t.jsx)(N.TextInput,{disabled:!0})}),!u&&(0,t.jsx)(w.Form.Item,{label:"Email",name:"user_email",children:(0,t.jsx)(N.TextInput,{})}),(0,t.jsx)(w.Form.Item,{label:"User Alias",name:"user_alias",children:(0,t.jsx)(N.TextInput,{})}),(0,t.jsx)(w.Form.Item,{label:(0,t.jsxs)("span",{children:["Global Proxy Role"," ",(0,t.jsx)(C.Tooltip,{title:"This is the role that the user will globally on the proxy. This role is independent of any team/org specific roles.",children:(0,t.jsx)(y.InfoCircleOutlined,{})})]}),name:"user_role",children:(0,t.jsx)(x.Select,{children:c&&Object.entries(c).map(([e,{ui_label:s,description:r}])=>(0,t.jsx)(_.SelectItem,{value:e,title:s,children:(0,t.jsxs)("div",{className:"flex",children:[s," ",(0,t.jsx)("p",{className:"ml-2",style:{color:"gray",fontSize:"12px"},children:r})]})},e))})}),(0,t.jsx)(w.Form.Item,{label:(0,t.jsxs)("span",{children:["Personal Models"," ",(0,t.jsx)(C.Tooltip,{title:"Select which models this user can access outside of team-scope. Choose 'All Proxy Models' to grant access to all models available on the proxy.",children:(0,t.jsx)(y.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"models",children:(0,t.jsxs)(x.Select,{mode:"multiple",placeholder:"Select models",style:{width:"100%"},disabled:!T.all_admin_roles.includes(o||""),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"),d.map(e=>(0,t.jsx)(x.Select.Option,{value:e,children:(0,I.getModelDisplayName)(e)},e))]})}),(0,t.jsx)(w.Form.Item,{label:(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"12px"},children:[(0,t.jsx)("span",{children:"Max Budget (USD)"}),(0,t.jsx)(b.Checkbox,{checked:h,onChange:e=>{let t=e.target.checked;g(t),t&&m.setFieldsValue({max_budget:""})},children:"Unlimited Budget"})]}),name:"max_budget",rules:[{validator:(e,t)=>h||""!==t&&null!=t?Promise.resolve():Promise.reject(Error("Please enter a budget or select Unlimited Budget"))}],children:(0,t.jsx)(E.default,{step:.01,precision:2,style:{width:"100%"},disabled:h})}),(0,t.jsx)(w.Form.Item,{label:"Reset Budget",name:"budget_duration",children:(0,t.jsx)(k.default,{})}),(0,t.jsx)(w.Form.Item,{label:"Metadata",name:"metadata",children:(0,t.jsx)(S.Textarea,{rows:4,placeholder:"Enter metadata as JSON"})}),(0,t.jsxs)("div",{className:"flex justify-end space-x-2",children:[(0,t.jsx)(v.Button,{variant:"secondary",type:"button",onClick:s,children:"Cancel"}),(0,t.jsx)(v.Button,{type:"submit",children:"Save Changes"})]})]})}var R=e.i(727749);let{Text:B,Title:F}=c.Typography,M=({open:e,onCancel:s,selectedUsers:r,possibleUIRoles:l,accessToken:a,onSuccess:n,teams:o,userRole:c,userModels:y,allowAllUsers:v=!1})=>{let[_,N]=(0,i.useState)(!1),[S,w]=(0,i.useState)([]),[C,T]=(0,i.useState)(null),[k,I]=(0,i.useState)(!1),[E,M]=(0,i.useState)(!1),L=()=>{w([]),T(null),I(!1),M(!1),s()},D=i.default.useMemo(()=>({user_id:"bulk_edit",user_info:{user_email:"",user_role:"",teams:[],models:[],max_budget:null,spend:0,metadata:{},created_at:null,updated_at:null},keys:[],teams:o||[]}),[o,e]),A=async e=>{if(console.log("formValues",e),!a)return void R.default.fromBackend("Access token not found");N(!0);try{let t=r.map(e=>e.user_id),l={};e.user_role&&""!==e.user_role&&(l.user_role=e.user_role),null!==e.max_budget&&void 0!==e.max_budget&&(l.max_budget=e.max_budget),e.models&&e.models.length>0&&(l.models=e.models),e.budget_duration&&""!==e.budget_duration&&(l.budget_duration=e.budget_duration),e.metadata&&Object.keys(e.metadata).length>0&&(l.metadata=e.metadata);let i=Object.keys(l).length>0,o=k&&S.length>0;if(!i&&!o)return void R.default.fromBackend("Please modify at least one field or select teams to add users to");let d=[];if(i)if(E){let e=await (0,j.userBulkUpdateUserCall)(a,l,void 0,!0);d.push(`Updated all users (${e.total_requested} total)`)}else await (0,j.userBulkUpdateUserCall)(a,l,t),d.push(`Updated ${t.length} user(s)`);if(o){let e=[];for(let t of S)try{let s=null;s=E?null:r.map(e=>({user_id:e.user_id,role:"user",user_email:e.user_email||null}));let l=await (0,j.teamBulkMemberAddCall)(a,t,s||null,C||void 0,E);console.log("result",l),e.push({teamId:t,success:!0,successfulAdditions:l.successful_additions,failedAdditions:l.failed_additions})}catch(s){console.error(`Failed to add users to team ${t}:`,s),e.push({teamId:t,success:!1,error:s})}let t=e.filter(e=>e.success),s=e.filter(e=>!e.success);if(t.length>0){let e=t.reduce((e,t)=>e+t.successfulAdditions,0);d.push(`Added users to ${t.length} team(s) (${e} total additions)`)}s.length>0&&m.message.warning(`Failed to add users to ${s.length} team(s)`)}d.length>0&&R.default.success(d.join(". ")),w([]),T(null),I(!1),M(!1),n(),s()}catch(e){console.error("Bulk operation failed:",e),R.default.fromBackend("Failed to perform bulk operations")}finally{N(!1)}};return(0,t.jsxs)(d.Modal,{open:e,onCancel:L,footer:null,title:E?"Bulk Edit All Users":`Bulk Edit ${r.length} User(s)`,width:800,children:[v&&(0,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsx)(b.Checkbox,{checked:E,onChange:e=>M(e.target.checked),children:(0,t.jsx)(B,{strong:!0,children:"Update ALL users in the system"})}),E&&(0,t.jsx)("div",{style:{marginTop:8},children:(0,t.jsx)(B,{type:"warning",style:{fontSize:"12px"},children:"⚠️ This will apply changes to ALL users in the system, not just the selected ones."})})]}),!E&&(0,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsxs)(F,{level:5,children:["Selected Users (",r.length,"):"]}),(0,t.jsx)(h.Table,{size:"small",bordered:!0,dataSource:r,pagination:!1,scroll:{y:200},rowKey:"user_id",columns:[{title:"User ID",dataIndex:"user_id",key:"user_id",width:"30%",render:e=>(0,t.jsx)(B,{strong:!0,style:{fontSize:"12px"},children:e.length>20?`${e.slice(0,20)}...`:e})},{title:"Email",dataIndex:"user_email",key:"user_email",width:"25%",render:e=>(0,t.jsx)(B,{type:"secondary",style:{fontSize:"12px"},children:e||"No email"})},{title:"Current Role",dataIndex:"user_role",key:"user_role",width:"25%",render:e=>(0,t.jsx)(B,{style:{fontSize:"12px"},children:l?.[e]?.ui_label||e})},{title:"Budget",dataIndex:"max_budget",key:"max_budget",width:"20%",render:e=>(0,t.jsx)(B,{style:{fontSize:"12px"},children:null!==e?`$${e}`:"Unlimited"})}]})]}),(0,t.jsx)(u.Divider,{}),(0,t.jsx)("div",{className:"mb-4",children:(0,t.jsxs)(B,{children:[(0,t.jsx)("strong",{children:"Instructions:"})," Fill in the fields below with the values you want to apply to all selected users. You can bulk edit: role, budget, models, and metadata. You can also add users to teams."]})}),(0,t.jsx)(f.Card,{title:"Team Management",size:"small",className:"mb-4",style:{backgroundColor:"#fafafa"},children:(0,t.jsxs)(p.Space,{direction:"vertical",style:{width:"100%"},children:[(0,t.jsx)(b.Checkbox,{checked:k,onChange:e=>I(e.target.checked),children:"Add selected users to teams"}),k&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(B,{strong:!0,children:"Select Teams:"}),(0,t.jsx)(x.Select,{mode:"multiple",placeholder:"Select teams to add users to",value:S,onChange:w,style:{width:"100%",marginTop:8},options:o?.map(e=>({label:e.team_alias||e.team_id,value:e.team_id}))||[]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(B,{strong:!0,children:"Team Budget (Optional):"}),(0,t.jsx)(g.InputNumber,{placeholder:"Max budget per user in team",value:C,onChange:e=>T(e),style:{width:"100%",marginTop:8},min:0,step:.01,precision:2}),(0,t.jsx)(B,{type:"secondary",style:{fontSize:"12px"},children:"Leave empty for unlimited budget within team limits"})]}),(0,t.jsx)(B,{type:"secondary",style:{fontSize:"12px"},children:'Users will be added with "user" role by default. All users will be added to each selected team.'})]})]})}),(0,t.jsx)(U,{userData:D,onCancel:L,onSubmit:A,teams:o,accessToken:a,userID:"bulk_edit",userRole:c,userModels:y,possibleUIRoles:l,isBulkEdit:!0}),_&&(0,t.jsx)("div",{style:{textAlign:"center",marginTop:"10px"},children:(0,t.jsxs)(B,{children:["Updating ",E?"all users":r.length," user(s)..."]})})]})};var L=e.i(371455);let D=({visible:e,possibleUIRoles:s,onCancel:r,user:l,onSubmit:a})=>{let[n,c]=(0,i.useState)(l),[u]=w.Form.useForm();(0,i.useEffect)(()=>{u.resetFields()},[l]);let m=async()=>{u.resetFields(),r()},h=async e=>{a(e),u.resetFields(),r()};return l?(0,t.jsx)(d.Modal,{open:e,onCancel:m,footer:null,title:"Edit User "+l.user_id,width:1e3,children:(0,t.jsx)(w.Form,{form:u,onFinish:h,initialValues:l,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(w.Form.Item,{className:"mt-8",label:"User Email",tooltip:"Email of the User",name:"user_email",children:(0,t.jsx)(N.TextInput,{})}),(0,t.jsx)(w.Form.Item,{label:"user_id",name:"user_id",hidden:!0,children:(0,t.jsx)(N.TextInput,{})}),(0,t.jsx)(w.Form.Item,{label:"User Role",name:"user_role",children:(0,t.jsx)(x.Select,{children:s&&Object.entries(s).map(([e,{ui_label:s,description:r}])=>(0,t.jsx)(_.SelectItem,{value:e,title:s,children:(0,t.jsxs)("div",{className:"flex",children:[s," ",(0,t.jsx)("p",{className:"ml-2",style:{color:"gray",fontSize:"12px"},children:r})]})},e))})}),(0,t.jsx)(w.Form.Item,{label:"Spend (USD)",name:"spend",tooltip:"(float) - Spend of all LLM calls completed by this user",help:"Across all keys (including keys with team_id).",children:(0,t.jsx)(g.InputNumber,{min:0,step:.01})}),(0,t.jsx)(w.Form.Item,{label:"User Budget (USD)",name:"max_budget",tooltip:"(float) - Maximum budget of this user",help:"Maximum budget of this user.",children:(0,t.jsx)(E.default,{min:0,step:.01})}),(0,t.jsx)(w.Form.Item,{label:"Reset Budget",name:"budget_duration",children:(0,t.jsx)(k.default,{})}),(0,t.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,t.jsx)(o.Button,{htmlType:"submit",children:"Save"})}),(0,t.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,t.jsx)(o.Button,{htmlType:"submit",children:"Save"})})]})})}):null};var A=e.i(172372),O=e.i(500330),P=e.i(152473),z=e.i(266027),V=e.i(912598),$=e.i(127952),K=e.i(304967),q=e.i(629569),H=e.i(599724),W=e.i(114600),G=e.i(482725),J=e.i(790848),Q=e.i(646563),Z=e.i(955135);let Y=({accessToken:e,possibleUIRoles:s,userID:r,userRole:l})=>{let[a,n]=(0,i.useState)(!0),[o,d]=(0,i.useState)(null),[u,m]=(0,i.useState)(!1),[h,f]=(0,i.useState)({}),[p,b]=(0,i.useState)(!1),[y,_]=(0,i.useState)([]),{Paragraph:S}=c.Typography,{Option:w}=x.Select;(0,i.useEffect)(()=>{(async()=>{if(!e)return n(!1);try{let t=await (0,j.getInternalUserSettings)(e);if(d(t),f(t.values||{}),e)try{let t=await (0,j.modelAvailableCall)(e,r,l);if(t&&t.data){let e=t.data.map(e=>e.id);_(e)}}catch(e){console.error("Error fetching available models:",e)}}catch(e){console.error("Error fetching SSO settings:",e),R.default.fromBackend("Failed to fetch SSO settings")}finally{n(!1)}})()},[e]);let C=async()=>{if(e){b(!0);try{let t=Object.entries(h).reduce((e,[t,s])=>(e[t]=""===s?null:s,e),{}),s=await (0,j.updateInternalUserSettings)(e,t);d({...o,values:s.settings}),m(!1)}catch(e){console.error("Error updating SSO settings:",e),R.default.fromBackend("Failed to update settings: "+e)}finally{b(!1)}}},T=(e,t)=>{f(s=>({...s,[e]:t}))},E=e=>e&&Array.isArray(e)?e.map(e=>"string"==typeof e?{team_id:e,user_role:"user"}:"object"==typeof e&&e.team_id?{team_id:e.team_id,max_budget_in_team:e.max_budget_in_team,user_role:e.user_role||"user"}:{team_id:"",user_role:"user"}):[];return a?(0,t.jsx)("div",{className:"flex justify-center items-center h-64",children:(0,t.jsx)(G.Spin,{size:"large"})}):o?(0,t.jsxs)(K.Card,{children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,t.jsx)(q.Title,{children:"Default User Settings"}),!a&&o&&(u?(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(v.Button,{variant:"secondary",onClick:()=>{m(!1),f(o.values||{})},disabled:p,children:"Cancel"}),(0,t.jsx)(v.Button,{onClick:C,loading:p,children:"Save Changes"})]}):(0,t.jsx)(v.Button,{onClick:()=>m(!0),children:"Edit Settings"}))]}),o?.field_schema?.description&&(0,t.jsx)(S,{className:"mb-4",children:o.field_schema.description}),(0,t.jsx)(W.Divider,{}),(0,t.jsx)("div",{className:"mt-4 space-y-4",children:(()=>{let{values:e,field_schema:r}=o;return r&&r.properties?Object.entries(r.properties).map(([r,l])=>{let a=e[r],n=r.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)(H.Text,{className:"font-medium text-lg",children:n}),(0,t.jsx)(S,{className:"text-sm text-gray-500 mt-1",children:l.description||"No description available"}),u?(0,t.jsx)("div",{className:"mt-2",children:((e,r,l)=>{let a=r.type;if("teams"===e){let s,r;return(0,t.jsx)("div",{className:"mt-2",children:(s=E(h[e]||[]),r=(e,t,r)=>{let l=[...s];l[e]={...l[e],[t]:r},T("teams",l)},(0,t.jsxs)("div",{className:"space-y-3",children:[s.map((e,l)=>(0,t.jsxs)("div",{className:"border rounded-lg p-4 bg-gray-50",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,t.jsxs)(H.Text,{className:"font-medium",children:["Team ",l+1]}),(0,t.jsx)(v.Button,{size:"sm",variant:"secondary",icon:Z.DeleteOutlined,onClick:()=>{T("teams",s.filter((e,t)=>t!==l))},className:"text-red-500 hover:text-red-700",children:"Remove"})]}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(H.Text,{className:"text-sm font-medium mb-1",children:"Team ID"}),(0,t.jsx)(N.TextInput,{value:e.team_id,onChange:e=>r(l,"team_id",e.target.value),placeholder:"Enter team ID"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(H.Text,{className:"text-sm font-medium mb-1",children:"Max Budget in Team"}),(0,t.jsx)(g.InputNumber,{style:{width:"100%"},value:e.max_budget_in_team,onChange:e=>r(l,"max_budget_in_team",e),placeholder:"Optional",min:0,step:.01,precision:2})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(H.Text,{className:"text-sm font-medium mb-1",children:"User Role"}),(0,t.jsxs)(x.Select,{style:{width:"100%"},value:e.user_role,onChange:e=>r(l,"user_role",e),children:[(0,t.jsx)(w,{value:"user",children:"User"}),(0,t.jsx)(w,{value:"admin",children:"Admin"})]})]})]})]},l)),(0,t.jsx)(v.Button,{variant:"secondary",icon:Q.PlusOutlined,onClick:()=>{T("teams",[...s,{team_id:"",user_role:"user"}])},className:"w-full",children:"Add Team"})]}))})}if("user_role"===e&&s)return(0,t.jsx)(x.Select,{style:{width:"100%"},value:h[e]||"",onChange:t=>T(e,t),className:"mt-2",children:Object.entries(s).filter(([e])=>e.includes("internal_user")).map(([e,{ui_label:s,description:r}])=>(0,t.jsx)(w,{value:e,children:(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("span",{children:s}),(0,t.jsx)("span",{className:"ml-2 text-xs text-gray-500",children:r})]})},e))});if("budget_duration"===e)return(0,t.jsx)(k.default,{value:h[e]||null,onChange:t=>T(e,t),className:"mt-2"});if("boolean"===a)return(0,t.jsx)("div",{className:"mt-2",children:(0,t.jsx)(J.Switch,{checked:!!h[e],onChange:t=>T(e,t)})});if("array"===a&&r.items?.enum)return(0,t.jsx)(x.Select,{mode:"multiple",style:{width:"100%"},value:h[e]||[],onChange:t=>T(e,t),className:"mt-2",children:r.items.enum.map(e=>(0,t.jsx)(w,{value:e,children:e},e))});else if("models"===e)return(0,t.jsxs)(x.Select,{mode:"multiple",style:{width:"100%"},value:h[e]||[],onChange:t=>T(e,t),className:"mt-2",children:[(0,t.jsx)(w,{value:"no-default-models",children:"No Default Models"},"no-default-models"),(0,t.jsx)(w,{value:"all-proxy-models",children:"All Proxy Models"},"all-proxy-models"),y.map(e=>(0,t.jsx)(w,{value:e,children:(0,I.getModelDisplayName)(e)},e))]});else if("string"===a&&r.enum)return(0,t.jsx)(x.Select,{style:{width:"100%"},value:h[e]||"",onChange:t=>T(e,t),className:"mt-2",children:r.enum.map(e=>(0,t.jsx)(w,{value:e,children:e},e))});else return(0,t.jsx)(N.TextInput,{value:void 0!==h[e]?String(h[e]):"",onChange:t=>T(e,t.target.value),placeholder:r.description||"",className:"mt-2"})})(r,l,0)}):(0,t.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:((e,r)=>{if(null==r)return(0,t.jsx)("span",{className:"text-gray-400",children:"Not set"});if("teams"===e&&Array.isArray(r)){if(0===r.length)return(0,t.jsx)("span",{className:"text-gray-400",children:"No teams assigned"});let e=E(r);return(0,t.jsx)("div",{className:"space-y-2 mt-1",children:e.map((e,s)=>(0,t.jsx)("div",{className:"border rounded-lg p-3 bg-white",children:(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-2 text-sm",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"font-medium text-gray-600",children:"Team ID:"}),(0,t.jsx)("p",{className:"text-gray-900",children:e.team_id||"Not specified"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"font-medium text-gray-600",children:"Max Budget:"}),(0,t.jsx)("p",{className:"text-gray-900",children:void 0!==e.max_budget_in_team?`$${(0,O.formatNumberWithCommas)(e.max_budget_in_team,4)}`:"No limit"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"font-medium text-gray-600",children:"Role:"}),(0,t.jsx)("p",{className:"text-gray-900 capitalize",children:e.user_role})]})]})},s))})}if("user_role"===e&&s&&s[r]){let{ui_label:e,description:l}=s[r];return(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"font-medium",children:e}),l&&(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:l})]})}if("budget_duration"===e)return(0,t.jsx)("span",{children:(0,k.getBudgetDurationLabel)(r)});if("boolean"==typeof r)return(0,t.jsx)("span",{children:r?"Enabled":"Disabled"});if("models"===e&&Array.isArray(r))return 0===r.length?(0,t.jsx)("span",{className:"text-gray-400",children:"None"}):(0,t.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:r.map((e,s)=>(0,t.jsx)("span",{className:"px-2 py-1 bg-blue-100 rounded text-xs",children:(0,I.getModelDisplayName)(e)},s))});if("object"==typeof r)return Array.isArray(r)?0===r.length?(0,t.jsx)("span",{className:"text-gray-400",children:"None"}):(0,t.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:r.map((e,s)=>(0,t.jsx)("span",{className:"px-2 py-1 bg-blue-100 rounded text-xs",children:"object"==typeof e?JSON.stringify(e):String(e)},s))}):(0,t.jsx)("pre",{className:"bg-gray-100 p-2 rounded text-xs overflow-auto mt-1",children:JSON.stringify(r,null,2)});return(0,t.jsx)("span",{children:String(r)})})(r,a)})]},r)}):(0,t.jsx)(H.Text,{children:"No schema information available"})})()})]}):(0,t.jsx)(K.Card,{children:(0,t.jsx)(H.Text,{children:"No settings available or you do not have permission to view them."})})};var X=e.i(389083),ee=e.i(350967),et=e.i(752978),es=e.i(591935),er=e.i(68155),el=e.i(502275),ea=e.i(278587);let en=(e,s,r,l,a,n)=>{let i=[{header:"User ID",accessorKey:"user_id",enableSorting:!0,cell:({row:e})=>(0,t.jsx)(C.Tooltip,{title:e.original.user_id,children:(0,t.jsx)("span",{className:"text-xs",children:e.original.user_id?`${e.original.user_id.slice(0,7)}...`:"-"})})},{header:"Email",accessorKey:"user_email",enableSorting:!0,cell:({row:e})=>(0,t.jsx)("span",{className:"text-xs",children:e.original.user_email||"-"})},{header:"Global Proxy Role",accessorKey:"user_role",enableSorting:!0,cell:({row:s})=>(0,t.jsx)("span",{className:"text-xs",children:e?.[s.original.user_role]?.ui_label||"-"})},{header:"User Alias",accessorKey:"user_alias",enableSorting:!1,cell:({row:e})=>(0,t.jsx)("span",{className:"text-xs",children:e.original.user_alias||"-"})},{header:"Spend (USD)",accessorKey:"spend",enableSorting:!0,cell:({row:e})=>(0,t.jsx)("span",{className:"text-xs",children:e.original.spend?(0,O.formatNumberWithCommas)(e.original.spend,4):"-"})},{header:"Budget (USD)",accessorKey:"max_budget",enableSorting:!1,cell:({row:e})=>(0,t.jsx)("span",{className:"text-xs",children:null!==e.original.max_budget?e.original.max_budget:"Unlimited"})},{header:()=>(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{children:"SSO ID"}),(0,t.jsx)(C.Tooltip,{title:"SSO ID is the ID of the user in the SSO provider. If the user is not using SSO, this will be null.",children:(0,t.jsx)(el.InformationCircleIcon,{className:"w-4 h-4"})})]}),accessorKey:"sso_user_id",enableSorting:!1,cell:({row:e})=>(0,t.jsx)("span",{className:"text-xs",children:null!==e.original.sso_user_id?e.original.sso_user_id:"-"})},{header:"Virtual Keys",accessorKey:"key_count",enableSorting:!1,cell:({row:e})=>(0,t.jsx)(ee.Grid,{numItems:2,children:e.original.key_count>0?(0,t.jsxs)(X.Badge,{size:"xs",color:"indigo",children:[e.original.key_count," ",1===e.original.key_count?"Key":"Keys"]}):(0,t.jsx)(X.Badge,{size:"xs",color:"gray",children:"No Keys"})})},{header:"Created At",accessorKey:"created_at",enableSorting:!0,cell:({row:e})=>(0,t.jsx)("span",{className:"text-xs",children:e.original.created_at?new Date(e.original.created_at).toLocaleDateString():"-"})},{header:"Updated At",accessorKey:"updated_at",enableSorting:!1,cell:({row:e})=>(0,t.jsx)("span",{className:"text-xs",children:e.original.updated_at?new Date(e.original.updated_at).toLocaleDateString():"-"})},{id:"actions",header:"Actions",enableSorting:!1,cell:({row:e})=>(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(C.Tooltip,{title:"Edit user details",children:(0,t.jsx)(et.Icon,{icon:es.PencilAltIcon,size:"sm",onClick:()=>a(e.original.user_id,!0),className:"cursor-pointer hover:text-blue-600"})}),(0,t.jsx)(C.Tooltip,{title:"Delete user",children:(0,t.jsx)(et.Icon,{icon:er.TrashIcon,size:"sm",onClick:()=>r(e.original),className:"cursor-pointer hover:text-red-600"})}),(0,t.jsx)(C.Tooltip,{title:"Reset Password",children:(0,t.jsx)(et.Icon,{icon:ea.RefreshIcon,size:"sm",onClick:()=>l(e.original.user_id),className:"cursor-pointer hover:text-green-600"})})]})}];if(n){let{onSelectUser:e,onSelectAll:s,isUserSelected:r,isAllSelected:l,isIndeterminate:a}=n;return[{id:"select",enableSorting:!1,header:()=>(0,t.jsx)(b.Checkbox,{indeterminate:a,checked:l,onChange:e=>s(e.target.checked),onClick:e=>e.stopPropagation()}),cell:({row:s})=>(0,t.jsx)(b.Checkbox,{checked:r(s.original),onChange:t=>e(s.original,t.target.checked),onClick:e=>e.stopPropagation()})},...i]}return i};var ei=e.i(152990),eo=e.i(682830),ed=e.i(269200),ec=e.i(427612),eu=e.i(64848),em=e.i(942232),eh=e.i(496020),ex=e.i(977572),eg=e.i(206929),ef=e.i(94629),ep=e.i(360820),eb=e.i(871943),ej=e.i(981339),ey=e.i(530212),ev=e.i(118366),e_=e.i(678784);function eN({userId:e,onClose:d,accessToken:c,userRole:u,onDelete:m,possibleUIRoles:h,initialTab:x=0,startInEditMode:g=!1}){let[f,p]=(0,i.useState)(null),[b,y]=(0,i.useState)(!1),[_,N]=(0,i.useState)(!1),[S,w]=(0,i.useState)(!0),[C,I]=(0,i.useState)(g),[E,B]=(0,i.useState)([]),[F,M]=(0,i.useState)(!1),[L,D]=(0,i.useState)(null),[P,z]=(0,i.useState)(null),[V,W]=(0,i.useState)(x),[G,J]=(0,i.useState)({}),[Q,Z]=(0,i.useState)(!1);i.default.useEffect(()=>{z((0,j.getProxyBaseUrl)())},[]),i.default.useEffect(()=>{console.log(`userId: ${e}, userRole: ${u}, accessToken: ${c}`),(async()=>{try{if(!c)return;let t=await (0,j.userInfoCall)(c,e,u||"",!1,null,null,!0);p(t);let s=(await (0,j.modelAvailableCall)(c,e,u||"")).data.map(e=>e.id);B(s)}catch(e){console.error("Error fetching user data:",e),R.default.fromBackend("Failed to fetch user data")}finally{w(!1)}})()},[c,e,u]);let Y=async()=>{if(!c)return void R.default.fromBackend("Access token not found");try{R.default.success("Generating password reset link...");let t=await (0,j.invitationCreateCall)(c,e);D(t),M(!0)}catch(e){R.default.fromBackend("Failed to generate password reset link")}},et=async()=>{try{if(!c)return;N(!0),await (0,j.userDeleteCall)(c,[e]),R.default.success("User deleted successfully"),m&&m(),d()}catch(e){console.error("Error deleting user:",e),R.default.fromBackend("Failed to delete user")}finally{y(!1),N(!1)}},es=async e=>{try{if(!c||!f)return;await (0,j.userUpdateUserCall)(c,e,null),p({...f,user_info:{...f.user_info,user_email:e.user_email,user_alias:e.user_alias,models:e.models,max_budget:e.max_budget,budget_duration:e.budget_duration,metadata:e.metadata}}),R.default.success("User updated successfully"),I(!1)}catch(e){console.error("Error updating user:",e),R.default.fromBackend("Failed to update user")}};if(S)return(0,t.jsxs)("div",{className:"p-4",children:[(0,t.jsx)(v.Button,{icon:ey.ArrowLeftIcon,variant:"light",onClick:d,className:"mb-4",children:"Back to Users"}),(0,t.jsx)(H.Text,{children:"Loading user data..."})]});if(!f)return(0,t.jsxs)("div",{className:"p-4",children:[(0,t.jsx)(v.Button,{icon:ey.ArrowLeftIcon,variant:"light",onClick:d,className:"mb-4",children:"Back to Users"}),(0,t.jsx)(H.Text,{children:"User not found"})]});let el=async(e,t)=>{await (0,O.copyToClipboard)(e)&&(J(e=>({...e,[t]:!0})),setTimeout(()=>{J(e=>({...e,[t]:!1}))},2e3))};return(0,t.jsxs)("div",{className:"p-4",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-6",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(v.Button,{icon:ey.ArrowLeftIcon,variant:"light",onClick:d,className:"mb-4",children:"Back to Users"}),(0,t.jsx)(q.Title,{children:f.user_info?.user_email||"User"}),(0,t.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,t.jsx)(H.Text,{className:"text-gray-500 font-mono",children:f.user_id}),(0,t.jsx)(o.Button,{type:"text",size:"small",icon:G["user-id"]?(0,t.jsx)(e_.CheckIcon,{size:12}):(0,t.jsx)(ev.CopyIcon,{size:12}),onClick:()=>el(f.user_id,"user-id"),className:`left-2 z-10 transition-all duration-200 ${G["user-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100"}`})]})]}),u&&T.rolesWithWriteAccess.includes(u)&&(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)(v.Button,{icon:ea.RefreshIcon,variant:"secondary",onClick:Y,className:"flex items-center",children:"Reset Password"}),(0,t.jsx)(v.Button,{icon:er.TrashIcon,variant:"secondary",onClick:()=>y(!0),className:"flex items-center text-red-500 border-red-500 hover:text-red-600 hover:border-red-600",children:"Delete User"})]})]}),(0,t.jsx)($.default,{isOpen:b,title:"Delete User?",message:"Are you sure you want to delete this user? This action cannot be undone.",resourceInformationTitle:"User Information",resourceInformation:[{label:"Email",value:f.user_info?.user_email},{label:"User ID",value:f.user_id,code:!0},{label:"Global Proxy Role",value:f.user_info?.user_role&&h?.[f.user_info.user_role]?.ui_label||f.user_info?.user_role||"-"},{label:"Total Spend (USD)",value:f.user_info?.spend!==null&&f.user_info?.spend!==void 0?f.user_info.spend.toFixed(2):void 0}],onCancel:()=>{y(!1)},onOk:et,confirmLoading:_}),(0,t.jsxs)(r.TabGroup,{defaultIndex:V,onIndexChange:W,children:[(0,t.jsxs)(l.TabList,{className:"mb-4",children:[(0,t.jsx)(s.Tab,{children:"Overview"}),(0,t.jsx)(s.Tab,{children:"Details"})]}),(0,t.jsxs)(n.TabPanels,{children:[(0,t.jsx)(a.TabPanel,{children:(0,t.jsxs)(ee.Grid,{numItems:1,numItemsSm:2,numItemsLg:3,className:"gap-6",children:[(0,t.jsxs)(K.Card,{children:[(0,t.jsx)(H.Text,{children:"Spend"}),(0,t.jsxs)("div",{className:"mt-2",children:[(0,t.jsxs)(q.Title,{children:["$",(0,O.formatNumberWithCommas)(f.user_info?.spend||0,4)]}),(0,t.jsxs)(H.Text,{children:["of"," ",f.user_info?.max_budget!==null?`$${(0,O.formatNumberWithCommas)(f.user_info.max_budget,4)}`:"Unlimited"]})]})]}),(0,t.jsxs)(K.Card,{children:[(0,t.jsx)(H.Text,{children:"Teams"}),(0,t.jsx)("div",{className:"mt-2",children:f.teams?.length&&f.teams?.length>0?(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[f.teams?.slice(0,Q?f.teams.length:20).map((e,s)=>(0,t.jsx)(X.Badge,{color:"blue",title:e.team_alias,children:e.team_alias},s)),!Q&&f.teams?.length>20&&(0,t.jsxs)(X.Badge,{color:"gray",className:"cursor-pointer hover:bg-gray-200 transition-colors",onClick:()=>Z(!0),children:["+",f.teams.length-20," more"]}),Q&&f.teams?.length>20&&(0,t.jsx)(X.Badge,{color:"gray",className:"cursor-pointer hover:bg-gray-200 transition-colors",onClick:()=>Z(!1),children:"Show Less"})]}):(0,t.jsx)(H.Text,{children:"No teams"})})]}),(0,t.jsxs)(K.Card,{children:[(0,t.jsx)(H.Text,{children:"Virtual Keys"}),(0,t.jsx)("div",{className:"mt-2",children:(0,t.jsxs)(H.Text,{children:[f.keys?.length||0," ",f.keys?.length===1?"Key":"Keys"]})})]}),(0,t.jsxs)(K.Card,{children:[(0,t.jsx)(H.Text,{children:"Personal Models"}),(0,t.jsx)("div",{className:"mt-2",children:f.user_info?.models?.length&&f.user_info?.models?.length>0?f.user_info?.models?.map((e,s)=>(0,t.jsx)(H.Text,{children:e},s)):(0,t.jsx)(H.Text,{children:"All proxy models"})})]})]})}),(0,t.jsx)(a.TabPanel,{children:(0,t.jsxs)(K.Card,{children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,t.jsx)(q.Title,{children:"User Settings"}),!C&&u&&T.rolesWithWriteAccess.includes(u)&&(0,t.jsx)(v.Button,{onClick:()=>I(!0),children:"Edit Settings"})]}),C&&f?(0,t.jsx)(U,{userData:f,onCancel:()=>I(!1),onSubmit:es,teams:f.teams,accessToken:c,userID:e,userRole:u,userModels:E,possibleUIRoles:h}):(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(H.Text,{className:"font-medium",children:"User ID"}),(0,t.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,t.jsx)(H.Text,{className:"font-mono",children:f.user_id}),(0,t.jsx)(o.Button,{type:"text",size:"small",icon:G["user-id"]?(0,t.jsx)(e_.CheckIcon,{size:12}):(0,t.jsx)(ev.CopyIcon,{size:12}),onClick:()=>el(f.user_id,"user-id"),className:`left-2 z-10 transition-all duration-200 ${G["user-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100"}`})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(H.Text,{className:"font-medium",children:"Email"}),(0,t.jsx)(H.Text,{children:f.user_info?.user_email||"Not Set"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(H.Text,{className:"font-medium",children:"User Alias"}),(0,t.jsx)(H.Text,{children:f.user_info?.user_alias||"Not Set"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(H.Text,{className:"font-medium",children:"Global Proxy Role"}),(0,t.jsx)(H.Text,{children:f.user_info?.user_role||"Not Set"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(H.Text,{className:"font-medium",children:"Created"}),(0,t.jsx)(H.Text,{children:f.user_info?.created_at?new Date(f.user_info.created_at).toLocaleString():"Unknown"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(H.Text,{className:"font-medium",children:"Last Updated"}),(0,t.jsx)(H.Text,{children:f.user_info?.updated_at?new Date(f.user_info.updated_at).toLocaleString():"Unknown"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(H.Text,{className:"font-medium",children:"Teams"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:f.teams?.length&&f.teams?.length>0?(0,t.jsxs)(t.Fragment,{children:[f.teams?.slice(0,Q?f.teams.length:20).map((e,s)=>(0,t.jsx)("span",{className:"px-2 py-1 bg-blue-100 rounded text-xs",title:e.team_alias||e.team_id,children:e.team_alias||e.team_id},s)),!Q&&f.teams?.length>20&&(0,t.jsxs)("span",{className:"px-2 py-1 bg-gray-100 rounded text-xs cursor-pointer hover:bg-gray-200 transition-colors",onClick:()=>Z(!0),children:["+",f.teams.length-20," more"]}),Q&&f.teams?.length>20&&(0,t.jsx)("span",{className:"px-2 py-1 bg-gray-100 rounded text-xs cursor-pointer hover:bg-gray-200 transition-colors",onClick:()=>Z(!1),children:"Show Less"})]}):(0,t.jsx)(H.Text,{children:"No teams"})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(H.Text,{className:"font-medium",children:"Personal Models"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:f.user_info?.models?.length&&f.user_info?.models?.length>0?f.user_info?.models?.map((e,s)=>(0,t.jsx)("span",{className:"px-2 py-1 bg-blue-100 rounded text-xs",children:e},s)):(0,t.jsx)(H.Text,{children:"All proxy models"})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(H.Text,{className:"font-medium",children:"Virtual Keys"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:f.keys?.length&&f.keys?.length>0?f.keys.map((e,s)=>(0,t.jsx)("span",{className:"px-2 py-1 bg-green-100 rounded text-xs",children:e.key_alias||e.token},s)):(0,t.jsx)(H.Text,{children:"No Virtual Keys"})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(H.Text,{className:"font-medium",children:"Max Budget"}),(0,t.jsx)(H.Text,{children:f.user_info?.max_budget!==null&&f.user_info?.max_budget!==void 0?`$${(0,O.formatNumberWithCommas)(f.user_info.max_budget,4)}`:"Unlimited"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(H.Text,{className:"font-medium",children:"Budget Reset"}),(0,t.jsx)(H.Text,{children:(0,k.getBudgetDurationLabel)(f.user_info?.budget_duration??null)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(H.Text,{className:"font-medium",children:"Metadata"}),(0,t.jsx)("pre",{className:"bg-gray-100 p-2 rounded text-xs overflow-auto mt-1",children:JSON.stringify(f.user_info?.metadata||{},null,2)})]})]})]})})]})]}),(0,t.jsx)(A.default,{isInvitationLinkModalVisible:F,setIsInvitationLinkModalVisible:M,baseUrl:P||"",invitationLinkData:L,modalType:"resetPassword"})]})}var eS=e.i(655913),ew=e.i(38419),eC=e.i(78334),eT=e.i(555436),ek=e.i(284614);let eI=(0,e.i(475254).default)("circle-user-round",[["path",{d:"M18 20a6 6 0 0 0-12 0",key:"1qehca"}],["circle",{cx:"12",cy:"10",r:"4",key:"1h16sb"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);function eE({data:e=[],columns:s,isLoading:r=!1,onSortChange:l,currentSort:a,accessToken:n,userRole:o,possibleUIRoles:d,handleEdit:c,handleDelete:u,handleResetPassword:m,selectedUsers:h=[],onSelectionChange:x,enableSelection:g=!1,filters:f,updateFilters:p,initialFilters:b,teams:j,userListResponse:y,currentPage:v,handlePageChange:N}){let[S,w]=i.default.useState([{id:a?.sortBy||"created_at",desc:a?.sortOrder==="desc"}]),[C,T]=i.default.useState(null),[k,I]=i.default.useState(!1),[E,U]=i.default.useState(!1),R=(e,t=!1)=>{T(e),I(t)},B=(e,t)=>{x&&(t?x([...h,e]):x(h.filter(t=>t.user_id!==e.user_id)))},F=t=>{x&&(t?x(e):x([]))},M=e=>h.some(t=>t.user_id===e.user_id),L=e.length>0&&h.length===e.length,D=h.length>0&&h.lengthd?en(d,c,u,m,R,g?{selectedUsers:h,onSelectUser:B,onSelectAll:F,isUserSelected:M,isAllSelected:L,isIndeterminate:D}:void 0):s,[d,c,u,m,R,s,g,h,L,D]),O=(0,ei.useReactTable)({data:e,columns:A,state:{sorting:S},onSortingChange:e=>{let t="function"==typeof e?e(S):e;if(w(t),t&&Array.isArray(t)&&t.length>0&&t[0]){let e=t[0];if(e.id){let t=e.id,s=e.desc?"desc":"asc";l?.(t,s)}}else l?.("created_at","desc")},getCoreRowModel:(0,eo.getCoreRowModel)(),manualSorting:!0,enableSorting:!0});return(i.default.useEffect(()=>{a&&w([{id:a.sortBy,desc:"desc"===a.sortOrder}])},[a]),C)?(0,t.jsx)(eN,{userId:C,onClose:()=>{T(null),I(!1)},accessToken:n,userRole:o,possibleUIRoles:d,initialTab:+!!k,startInEditMode:k}):(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow",children:[(0,t.jsx)("div",{className:"border-b px-6 py-4",children:(0,t.jsxs)("div",{className:"flex flex-col space-y-4",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,t.jsx)(eS.FilterInput,{placeholder:"Search by email...",value:f.email,onChange:e=>p({email:e}),icon:eT.Search}),(0,t.jsx)(ew.FiltersButton,{onClick:()=>U(!E),active:E,hasActiveFilters:!!(f.user_id||f.user_role||f.team)}),(0,t.jsx)(eC.ResetFiltersButton,{onClick:()=>{p(b)}})]}),E&&(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-3 mt-3",children:[(0,t.jsx)(eS.FilterInput,{placeholder:"Filter by User ID",value:f.user_id,onChange:e=>p({user_id:e}),icon:ek.User}),(0,t.jsx)(eS.FilterInput,{placeholder:"Filter by SSO ID",value:f.sso_user_id,onChange:e=>p({sso_user_id:e}),icon:eI}),(0,t.jsx)("div",{className:"w-64",children:(0,t.jsx)(eg.Select,{value:f.user_role,onValueChange:e=>p({user_role:e}),placeholder:"Select Role",children:d&&Object.entries(d).map(([e,s])=>(0,t.jsx)(_.SelectItem,{value:e,children:s.ui_label},e))})}),(0,t.jsx)("div",{className:"w-64",children:(0,t.jsx)(eg.Select,{value:f.team,onValueChange:e=>p({team:e}),placeholder:"Select Team",children:j?.map(e=>(0,t.jsx)(_.SelectItem,{value:e.team_id,children:e.team_alias||e.team_id},e.team_id))})})]}),(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[r?(0,t.jsx)(ej.Skeleton.Input,{active:!0,style:{width:192,height:20}}):(0,t.jsxs)("span",{className:"text-sm text-gray-700",children:["Showing"," ",y&&y.users&&y.users.length>0?(y.page-1)*y.page_size+1:0," ","-"," ",y&&y.users?Math.min(y.page*y.page_size,y.total):0," ","of ",y?y.total:0," results"]}),(0,t.jsx)("div",{className:"flex space-x-2",children:r?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(ej.Skeleton.Button,{active:!0,size:"small",style:{width:80,height:30}}),(0,t.jsx)(ej.Skeleton.Button,{active:!0,size:"small",style:{width:60,height:30}})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("button",{onClick:()=>N(v-1),disabled:1===v,className:`px-3 py-1 text-sm border rounded-md ${1===v?"bg-gray-100 text-gray-400 cursor-not-allowed":"hover:bg-gray-50"}`,children:"Previous"}),(0,t.jsx)("button",{onClick:()=>N(v+1),disabled:!y||v>=y.total_pages,className:`px-3 py-1 text-sm border rounded-md ${!y||v>=y.total_pages?"bg-gray-100 text-gray-400 cursor-not-allowed":"hover:bg-gray-50"}`,children:"Next"})]})})]})]})}),(0,t.jsx)("div",{className:"overflow-auto",children:(0,t.jsx)("div",{className:"rounded-lg custom-border relative",children:(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)(ed.Table,{className:"[&_td]:py-0.5 [&_th]:py-1",children:[(0,t.jsx)(ec.TableHead,{children:O.getHeaderGroups().map(e=>(0,t.jsx)(eh.TableRow,{children:e.headers.map(e=>(0,t.jsx)(eu.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)]":""} ${e.column.getCanSort()?"cursor-pointer hover:bg-gray-50":""}`,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,ei.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)(ep.ChevronUpIcon,{className:"h-4 w-4 text-blue-500"}),desc:(0,t.jsx)(eb.ChevronDownIcon,{className:"h-4 w-4 text-blue-500"})})[e.column.getIsSorted()]:(0,t.jsx)(ef.SwitchVerticalIcon,{className:"h-4 w-4 text-gray-400"})})]})},e.id))},e.id))}),(0,t.jsx)(em.TableBody,{children:r?(0,t.jsx)(eh.TableRow,{children:(0,t.jsx)(ex.TableCell,{colSpan:A.length,className:"h-8 text-center",children:(0,t.jsx)("div",{className:"text-center text-gray-500",children:(0,t.jsx)("p",{children:"🚅 Loading users..."})})})}):e.length>0?O.getRowModel().rows.map(e=>(0,t.jsx)(eh.TableRow,{className:"h-8",children:e.getVisibleCells().map(e=>(0,t.jsx)(ex.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)]":""}`,onClick:()=>{"user_id"===e.column.id&&R(e.getValue(),!1)},style:{cursor:"user_id"===e.column.id?"pointer":"default",color:"user_id"===e.column.id?"#3b82f6":"inherit"},children:(0,ei.flexRender)(e.column.columnDef.cell,e.getContext())},e.id))},e.id)):(0,t.jsx)(eh.TableRow,{children:(0,t.jsx)(ex.TableCell,{colSpan:A.length,className:"h-8 text-center",children:(0,t.jsx)("div",{className:"text-center text-gray-500",children:(0,t.jsx)("p",{children:"No users found"})})})})})]})})})})]})}let{Text:eU,Title:eR}=c.Typography,eB={email:"",user_id:"",user_role:"",sso_user_id:"",team:"",model:"",min_spend:null,max_spend:null,sort_by:"created_at",sort_order:"desc"};e.s(["default",0,({accessToken:e,token:d,userRole:c,userID:u,teams:m,orgAdminOrgIds:h})=>{let x=!!c&&(0,T.isProxyAdminRole)(c),g=(0,V.useQueryClient)(),[f,p]=(0,i.useState)(1),[b,y]=(0,i.useState)(!1),[v,_]=(0,i.useState)(null),[N,S]=(0,i.useState)(!1),[w,C]=(0,i.useState)(!1),[k,I]=(0,i.useState)(null),[E,U]=(0,i.useState)("users"),[B,F]=(0,i.useState)(eB),[K,q,H]=(0,P.useDebouncedState)(B,{wait:300}),[W,G]=(0,i.useState)(!1),[J,Q]=(0,i.useState)(null),[Z,X]=(0,i.useState)(null),[ee,et]=(0,i.useState)([]),[es,er]=(0,i.useState)(!1),[el,ea]=(0,i.useState)(!1),[ei,eo]=(0,i.useState)([]),ed=e=>{I(e),S(!0)};(0,i.useEffect)(()=>()=>{H.cancel()},[H]),(0,i.useEffect)(()=>{X((0,j.getProxyBaseUrl)())},[]),(0,i.useEffect)(()=>{(async()=>{try{if(!u||!c||!e)return;let t=(await (0,j.modelAvailableCall)(e,u,c)).data.map(e=>e.id);console.log("available_model_names:",t),eo(t)}catch(e){console.error("Error fetching user models:",e)}})()},[e,u,c]);let ec=e=>{F(t=>{let s={...t,...e};return q(s),s})},eu=(e,t)=>{ec({sort_by:e,sort_order:t})},em=async t=>{if(!e)return void R.default.fromBackend("Access token not found");try{R.default.success("Generating password reset link...");let s=await (0,j.invitationCreateCall)(e,t);Q(s),G(!0)}catch(e){R.default.fromBackend("Failed to generate password reset link")}},eh=async()=>{if(k&&e)try{C(!0),await (0,j.userDeleteCall)(e,[k.user_id]),g.setQueriesData({queryKey:["userList"]},e=>{if(void 0===e)return e;let t=e.users.filter(e=>e.user_id!==k.user_id);return{...e,users:t}}),R.default.success("User deleted successfully")}catch(e){console.error("Error deleting user:",e),R.default.fromBackend("Failed to delete user")}finally{S(!1),I(null),C(!1)}},ex=async()=>{_(null),y(!1)},eg=async t=>{if(console.log("inside handleEditSubmit:",t),e&&d&&c&&u){try{let s=await (0,j.userUpdateUserCall)(e,t,null);g.setQueriesData({queryKey:["userList"]},e=>{if(void 0===e)return e;let t=e.users.map(e=>e.user_id===s.data.user_id?(0,O.updateExistingKeys)(e,s.data):e);return{...e,users:t}}),R.default.success(`User ${t.user_id} updated successfully`)}catch(e){console.error("There was an error updating the user",e)}_(null),y(!1)}},ef=async e=>{p(e)},ep=e=>{et(e)},eb=(0,z.useQuery)({queryKey:["userList",{debouncedFilter:K,currentPage:f,orgAdminOrgIds:h}],queryFn:async()=>{if(!e)throw Error("Access token required");return await (0,j.userListCall)(e,K.user_id?[K.user_id]:null,f,25,K.email||null,K.user_role||null,K.team||null,K.sso_user_id||null,K.sort_by,K.sort_order,h?h.map(e=>e.organization_id):null)},enabled:!!(e&&d&&c&&u),placeholderData:e=>e}),ey=eb.data,ev=(0,z.useQuery)({queryKey:["userRoles"],initialData:()=>({}),queryFn:async()=>{if(!e)throw Error("Access token required");return await (0,j.getPossibleUserRoles)(e)},enabled:!!(e&&d&&c&&u)}).data,e_=en(ev,e=>{_(e),y(!0)},ed,em,()=>{});return(0,t.jsxs)("div",{className:"w-full p-8 overflow-hidden",children:[(0,t.jsx)("div",{className:"flex items-center justify-between mb-4",children:(0,t.jsx)("div",{className:"flex space-x-3",children:eb.isLoading?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(ej.Skeleton.Button,{active:!0,size:"default",shape:"default",style:{width:110,height:36}}),(0,t.jsx)(ej.Skeleton.Button,{active:!0,size:"default",shape:"default",style:{width:145,height:36}}),(0,t.jsx)(ej.Skeleton.Button,{active:!0,size:"default",shape:"default",style:{width:110,height:36}})]}):u&&e?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(L.CreateUserButton,{userID:u,accessToken:e,teams:m,possibleUIRoles:ev}),x&&(0,t.jsx)(o.Button,{onClick:()=>{ea(!el),et([])},type:el?"primary":"default",className:"flex items-center",children:el?"Cancel Selection":"Select Users"}),x&&el&&(0,t.jsxs)(o.Button,{type:"primary",onClick:()=>{0===ee.length?R.default.fromBackend("Please select users to edit"):er(!0)},disabled:0===ee.length,className:"flex items-center",children:["Bulk Edit (",ee.length," selected)"]})]}):null})}),x?(0,t.jsxs)(r.TabGroup,{defaultIndex:0,onIndexChange:e=>U(0===e?"users":"settings"),children:[(0,t.jsxs)(l.TabList,{className:"mb-4",children:[(0,t.jsx)(s.Tab,{children:"Users"}),(0,t.jsx)(s.Tab,{children:"Default User Settings"})]}),(0,t.jsxs)(n.TabPanels,{children:[(0,t.jsx)(a.TabPanel,{children:(0,t.jsx)(eE,{data:eb.data?.users||[],columns:e_,isLoading:eb.isLoading,accessToken:e,userRole:c,onSortChange:eu,currentSort:{sortBy:B.sort_by,sortOrder:B.sort_order},possibleUIRoles:ev,handleEdit:e=>{_(e),y(!0)},handleDelete:ed,handleResetPassword:em,enableSelection:el,selectedUsers:ee,onSelectionChange:ep,filters:B,updateFilters:ec,initialFilters:eB,teams:m,userListResponse:ey,currentPage:f,handlePageChange:ef})}),(0,t.jsx)(a.TabPanel,{children:u&&c&&e?(0,t.jsx)(Y,{accessToken:e,possibleUIRoles:ev,userID:u,userRole:c}):(0,t.jsx)("div",{className:"flex justify-center items-center h-64",children:(0,t.jsx)(ej.Skeleton,{active:!0,paragraph:{rows:4}})})})]})]}):(0,t.jsx)(eE,{data:eb.data?.users||[],columns:e_,isLoading:eb.isLoading,accessToken:e,userRole:c,onSortChange:eu,currentSort:{sortBy:B.sort_by,sortOrder:B.sort_order},possibleUIRoles:ev,handleEdit:e=>{_(e),y(!0)},handleDelete:ed,handleResetPassword:em,enableSelection:!1,selectedUsers:[],onSelectionChange:ep,filters:B,updateFilters:ec,initialFilters:eB,teams:m,userListResponse:ey,currentPage:f,handlePageChange:ef}),(0,t.jsx)(D,{visible:b,possibleUIRoles:ev,onCancel:ex,user:v,onSubmit:eg}),(0,t.jsx)($.default,{isOpen:N,title:"Delete User?",message:"Are you sure you want to delete this user? This action cannot be undone.",resourceInformationTitle:"User Information",resourceInformation:[{label:"Email",value:k?.user_email},{label:"User ID",value:k?.user_id,code:!0},{label:"Global Proxy Role",value:k&&ev?.[k.user_role]?.ui_label||k?.user_role||"-"},{label:"Total Spend (USD)",value:k?.spend?.toFixed(2)}],onCancel:()=>{S(!1),I(null)},onOk:eh,confirmLoading:w}),(0,t.jsx)(A.default,{isInvitationLinkModalVisible:W,setIsInvitationLinkModalVisible:G,baseUrl:Z||"",invitationLinkData:J,modalType:"resetPassword"}),(0,t.jsx)(M,{open:es,onCancel:()=>er(!1),selectedUsers:ee,possibleUIRoles:ev,accessToken:e,onSuccess:()=>{g.invalidateQueries({queryKey:["userList"]}),et([]),ea(!1)},teams:m,userRole:c,userModels:ei,allowAllUsers:!!c&&(0,T.isAdminRole)(c)})]})}],910119)}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/0bffe854234d50c4.js b/litellm/proxy/_experimental/out/_next/static/chunks/0bffe854234d50c4.js deleted file mode 100644 index a2b8809a94..0000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/0bffe854234d50c4.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 l=t.forwardRef(function(e,l){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:l},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"}))});e.s(["ExternalLinkIcon",0,l],434626)},902555,e=>{"use strict";var t=e.i(843476),l=e.i(591935),a=e.i(122577),r=e.i(278587),n=e.i(68155),i=e.i(360820),o=e.i(871943),s=e.i(434626),c=e.i(592968),d=e.i(115504),u=e.i(752978);function m({icon:e,onClick:l,className:a,disabled:r,dataTestId:n}){return r?(0,t.jsx)(u.Icon,{icon:e,size:"sm",className:"opacity-50 cursor-not-allowed","data-testid":n}):(0,t.jsx)(u.Icon,{icon:e,size:"sm",onClick:l,className:(0,d.cx)("cursor-pointer",a),"data-testid":n})}let g={Edit:{icon:l.PencilAltIcon,className:"hover:text-blue-600"},Delete:{icon:n.TrashIcon,className:"hover:text-red-600"},Test:{icon:a.PlayIcon,className:"hover:text-blue-600"},Regenerate:{icon:r.RefreshIcon,className:"hover:text-green-600"},Up:{icon:i.ChevronUpIcon,className:"hover:text-blue-600"},Down:{icon:o.ChevronDownIcon,className:"hover:text-blue-600"},Open:{icon:s.ExternalLinkIcon,className:"hover:text-green-600"}};function b({onClick:e,tooltipText:l,disabled:a=!1,disabledTooltipText:r,dataTestId:n,variant:i}){let{icon:o,className:s}=g[i];return(0,t.jsx)(c.Tooltip,{title:a?r:l,children:(0,t.jsx)("span",{children:(0,t.jsx)(m,{icon:o,onClick:e,className:s,disabled:a,dataTestId:n})})})}e.s(["default",()=>b],902555)},122577,e=>{"use strict";var t=e.i(271645);let l=t.forwardRef(function(e,l){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:l},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14.752 11.168l-3.197-2.132A1 1 0 0010 9.87v4.263a1 1 0 001.555.832l3.197-2.132a1 1 0 000-1.664z"}),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}))});e.s(["PlayIcon",0,l],122577)},591935,e=>{"use strict";var t=e.i(271645);let l=t.forwardRef(function(e,l){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:l},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"}))});e.s(["PencilAltIcon",0,l],591935)},360820,e=>{"use strict";var t=e.i(271645);let l=t.forwardRef(function(e,l){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:l},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"}))});e.s(["ChevronUpIcon",0,l],360820)},871943,e=>{"use strict";var t=e.i(271645);let l=t.forwardRef(function(e,l){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:l},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"}))});e.s(["ChevronDownIcon",0,l],871943)},185793,e=>{"use strict";e.i(247167);var t=e.i(271645),l=e.i(343794),a=e.i(242064),r=e.i(529681);let n=e=>{let{prefixCls:a,className:r,style:n,size:i,shape:o}=e,s=(0,l.default)({[`${a}-lg`]:"large"===i,[`${a}-sm`]:"small"===i}),c=(0,l.default)({[`${a}-circle`]:"circle"===o,[`${a}-square`]:"square"===o,[`${a}-round`]:"round"===o}),d=t.useMemo(()=>"number"==typeof i?{width:i,height:i,lineHeight:`${i}px`}:{},[i]);return t.createElement("span",{className:(0,l.default)(a,s,c,r),style:Object.assign(Object.assign({},d),n)})};e.i(296059);var i=e.i(694758),o=e.i(915654),s=e.i(246422),c=e.i(838378);let d=new i.Keyframes("ant-skeleton-loading",{"0%":{backgroundPosition:"100% 50%"},"100%":{backgroundPosition:"0 50%"}}),u=e=>({height:e,lineHeight:(0,o.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)),b=e=>Object.assign({width:e},u(e)),p=(e,t,l)=>{let{skeletonButtonCls:a}=e;return{[`${l}${a}-circle`]:{width:t,minWidth:t,borderRadius:"50%"},[`${l}${a}-round`]:{borderRadius:t}}},f=(e,t)=>Object.assign({width:t(e).mul(2).equal(),minWidth:t(e).mul(2).equal()},u(e)),h=(0,s.genStyleHooks)("Skeleton",e=>{let{componentCls:t,calc:l}=e;return(e=>{let{componentCls:t,skeletonAvatarCls:l,skeletonTitleCls:a,skeletonParagraphCls:r,skeletonButtonCls:n,skeletonInputCls:i,skeletonImageCls:o,controlHeight:s,controlHeightLG:c,controlHeightSM:u,gradientFromColor:h,padding:v,marginSM:x,borderRadius:j,titleHeight:$,blockRadius:y,paragraphLiHeight:w,controlHeightXS:C,paragraphMarginTop:O}=e;return{[t]:{display:"table",width:"100%",[`${t}-header`]:{display:"table-cell",paddingInlineEnd:v,verticalAlign:"top",[l]:Object.assign({display:"inline-block",verticalAlign:"top",background:h},m(s)),[`${l}-circle`]:{borderRadius:"50%"},[`${l}-lg`]:Object.assign({},m(c)),[`${l}-sm`]:Object.assign({},m(u))},[`${t}-content`]:{display:"table-cell",width:"100%",verticalAlign:"top",[a]:{width:"100%",height:$,background:h,borderRadius:y,[`+ ${r}`]:{marginBlockStart:u}},[r]:{padding:0,"> li":{width:"100%",height:w,listStyle:"none",background:h,borderRadius:y,"+ li":{marginBlockStart:C}}},[`${r}> li:last-child:not(:first-child):not(:nth-child(2))`]:{width:"61%"}},[`&-round ${t}-content`]:{[`${a}, ${r} > li`]:{borderRadius:j}}},[`${t}-with-avatar ${t}-content`]:{[a]:{marginBlockStart:x,[`+ ${r}`]:{marginBlockStart:O}}},[`${t}${t}-element`]:Object.assign(Object.assign(Object.assign(Object.assign({display:"inline-block",width:"auto"},(e=>{let{borderRadiusSM:t,skeletonButtonCls:l,controlHeight:a,controlHeightLG:r,controlHeightSM:n,gradientFromColor:i,calc:o}=e;return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({[l]:Object.assign({display:"inline-block",verticalAlign:"top",background:i,borderRadius:t,width:o(a).mul(2).equal(),minWidth:o(a).mul(2).equal()},f(a,o))},p(e,a,l)),{[`${l}-lg`]:Object.assign({},f(r,o))}),p(e,r,`${l}-lg`)),{[`${l}-sm`]:Object.assign({},f(n,o))}),p(e,n,`${l}-sm`))})(e)),(e=>{let{skeletonAvatarCls:t,gradientFromColor:l,controlHeight:a,controlHeightLG:r,controlHeightSM:n}=e;return{[t]:Object.assign({display:"inline-block",verticalAlign:"top",background:l},m(a)),[`${t}${t}-circle`]:{borderRadius:"50%"},[`${t}${t}-lg`]:Object.assign({},m(r)),[`${t}${t}-sm`]:Object.assign({},m(n))}})(e)),(e=>{let{controlHeight:t,borderRadiusSM:l,skeletonInputCls:a,controlHeightLG:r,controlHeightSM:n,gradientFromColor:i,calc:o}=e;return{[a]:Object.assign({display:"inline-block",verticalAlign:"top",background:i,borderRadius:l},g(t,o)),[`${a}-lg`]:Object.assign({},g(r,o)),[`${a}-sm`]:Object.assign({},g(n,o))}})(e)),(e=>{let{skeletonImageCls:t,imageSizeBase:l,gradientFromColor:a,borderRadiusSM:r,calc:n}=e;return{[t]:Object.assign(Object.assign({display:"inline-flex",alignItems:"center",justifyContent:"center",verticalAlign:"middle",background:a,borderRadius:r},b(n(l).mul(2).equal())),{[`${t}-path`]:{fill:"#bfbfbf"},[`${t}-svg`]:Object.assign(Object.assign({},b(l)),{maxWidth:n(l).mul(4).equal(),maxHeight:n(l).mul(4).equal()}),[`${t}-svg${t}-svg-circle`]:{borderRadius:"50%"}}),[`${t}${t}-circle`]:{borderRadius:"50%"}}})(e)),[`${t}${t}-block`]:{width:"100%",[n]:{width:"100%"},[i]:{width:"100%"}},[`${t}${t}-active`]:{[` - ${a}, - ${r} > li, - ${l}, - ${n}, - ${i}, - ${o} - `]: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:l(e.controlHeight).mul(1.5).equal(),borderRadius:100,skeletonLoadingBackground:`linear-gradient(90deg, ${e.gradientFromColor} 25%, ${e.gradientToColor} 37%, ${e.gradientFromColor} 63%)`,skeletonLoadingMotionDuration:"1.4s"}))},e=>{let{colorFillContent:t,colorFill:l}=e;return{color:t,colorGradientEnd:l,gradientFromColor:t,gradientToColor:l,titleHeight:e.controlHeight/2,blockRadius:e.borderRadiusSM,paragraphMarginTop:e.marginLG+e.marginXXS,paragraphLiHeight:e.controlHeight/2}},{deprecatedTokens:[["color","gradientFromColor"],["colorGradientEnd","gradientToColor"]]}),v=e=>{let{prefixCls:a,className:r,style:n,rows:i=0}=e,o=Array.from({length:i}).map((l,a)=>t.createElement("li",{key:a,style:{width:((e,t)=>{let{width:l,rows:a=2}=t;return Array.isArray(l)?l[e]:a-1===e?l:void 0})(a,e)}}));return t.createElement("ul",{className:(0,l.default)(a,r),style:n},o)},x=({prefixCls:e,className:a,width:r,style:n})=>t.createElement("h3",{className:(0,l.default)(e,a),style:Object.assign({width:r},n)});function j(e){return e&&"object"==typeof e?e:{}}let $=e=>{let{prefixCls:r,loading:i,className:o,rootClassName:s,style:c,children:d,avatar:u=!1,title:m=!0,paragraph:g=!0,active:b,round:p}=e,{getPrefixCls:f,direction:$,className:y,style:w}=(0,a.useComponentConfig)("skeleton"),C=f("skeleton",r),[O,k,N]=h(C);if(i||!("loading"in e)){let e,a,r=!!u,i=!!m,d=!!g;if(r){let l=Object.assign(Object.assign({prefixCls:`${C}-avatar`},i&&!d?{size:"large",shape:"square"}:{size:"large",shape:"circle"}),j(u));e=t.createElement("div",{className:`${C}-header`},t.createElement(n,Object.assign({},l)))}if(i||d){let e,l;if(i){let l=Object.assign(Object.assign({prefixCls:`${C}-title`},!r&&d?{width:"38%"}:r&&d?{width:"50%"}:{}),j(m));e=t.createElement(x,Object.assign({},l))}if(d){let e,a=Object.assign(Object.assign({prefixCls:`${C}-paragraph`},(e={},r&&i||(e.width="61%"),!r&&i?e.rows=3:e.rows=2,e)),j(g));l=t.createElement(v,Object.assign({},a))}a=t.createElement("div",{className:`${C}-content`},e,l)}let f=(0,l.default)(C,{[`${C}-with-avatar`]:r,[`${C}-active`]:b,[`${C}-rtl`]:"rtl"===$,[`${C}-round`]:p},y,o,s,k,N);return O(t.createElement("div",{className:f,style:Object.assign(Object.assign({},w),c)},e,a))}return null!=d?d:null};$.Button=e=>{let{prefixCls:i,className:o,rootClassName:s,active:c,block:d=!1,size:u="default"}=e,{getPrefixCls:m}=t.useContext(a.ConfigContext),g=m("skeleton",i),[b,p,f]=h(g),v=(0,r.default)(e,["prefixCls"]),x=(0,l.default)(g,`${g}-element`,{[`${g}-active`]:c,[`${g}-block`]:d},o,s,p,f);return b(t.createElement("div",{className:x},t.createElement(n,Object.assign({prefixCls:`${g}-button`,size:u},v))))},$.Avatar=e=>{let{prefixCls:i,className:o,rootClassName:s,active:c,shape:d="circle",size:u="default"}=e,{getPrefixCls:m}=t.useContext(a.ConfigContext),g=m("skeleton",i),[b,p,f]=h(g),v=(0,r.default)(e,["prefixCls","className"]),x=(0,l.default)(g,`${g}-element`,{[`${g}-active`]:c},o,s,p,f);return b(t.createElement("div",{className:x},t.createElement(n,Object.assign({prefixCls:`${g}-avatar`,shape:d,size:u},v))))},$.Input=e=>{let{prefixCls:i,className:o,rootClassName:s,active:c,block:d,size:u="default"}=e,{getPrefixCls:m}=t.useContext(a.ConfigContext),g=m("skeleton",i),[b,p,f]=h(g),v=(0,r.default)(e,["prefixCls"]),x=(0,l.default)(g,`${g}-element`,{[`${g}-active`]:c,[`${g}-block`]:d},o,s,p,f);return b(t.createElement("div",{className:x},t.createElement(n,Object.assign({prefixCls:`${g}-input`,size:u},v))))},$.Image=e=>{let{prefixCls:r,className:n,rootClassName:i,style:o,active:s}=e,{getPrefixCls:c}=t.useContext(a.ConfigContext),d=c("skeleton",r),[u,m,g]=h(d),b=(0,l.default)(d,`${d}-element`,{[`${d}-active`]:s},n,i,m,g);return u(t.createElement("div",{className:b},t.createElement("div",{className:(0,l.default)(`${d}-image`,n),style:o},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`})))))},$.Node=e=>{let{prefixCls:r,className:n,rootClassName:i,style:o,active:s,children:c}=e,{getPrefixCls:d}=t.useContext(a.ConfigContext),u=d("skeleton",r),[m,g,b]=h(u),p=(0,l.default)(u,`${u}-element`,{[`${u}-active`]:s},g,n,i,b);return m(t.createElement("div",{className:p},t.createElement("div",{className:(0,l.default)(`${u}-image`,n),style:o},c)))},e.s(["default",0,$],185793)},959013,e=>{"use strict";e.i(247167);var t=e.i(931067),l=e.i(271645);let a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"}},{tag:"path",attrs:{d:"M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z"}}]},name:"plus",theme:"outlined"};var r=e.i(9583),n=l.forwardRef(function(e,n){return l.createElement(r.default,(0,t.default)({},e,{ref:n,icon:a}))});e.s(["default",0,n],959013)},269200,e=>{"use strict";var t=e.i(290571),l=e.i(271645),a=e.i(444755);let r=(0,e.i(673706).makeClassName)("Table"),n=l.default.forwardRef((e,n)=>{let{children:i,className:o}=e,s=(0,t.__rest)(e,["children","className"]);return l.default.createElement("div",{className:(0,a.tremorTwMerge)(r("root"),"overflow-auto",o)},l.default.createElement("table",Object.assign({ref:n,className:(0,a.tremorTwMerge)(r("table"),"w-full text-tremor-default","text-tremor-content","dark:text-dark-tremor-content")},s),i))});n.displayName="Table",e.s(["Table",()=>n],269200)},427612,e=>{"use strict";var t=e.i(290571),l=e.i(271645),a=e.i(444755);let r=(0,e.i(673706).makeClassName)("TableHead"),n=l.default.forwardRef((e,n)=>{let{children:i,className:o}=e,s=(0,t.__rest)(e,["children","className"]);return l.default.createElement(l.default.Fragment,null,l.default.createElement("thead",Object.assign({ref:n,className:(0,a.tremorTwMerge)(r("root"),"text-left","text-tremor-content","dark:text-dark-tremor-content",o)},s),i))});n.displayName="TableHead",e.s(["TableHead",()=>n],427612)},64848,e=>{"use strict";var t=e.i(290571),l=e.i(271645),a=e.i(444755);let r=(0,e.i(673706).makeClassName)("TableHeaderCell"),n=l.default.forwardRef((e,n)=>{let{children:i,className:o}=e,s=(0,t.__rest)(e,["children","className"]);return l.default.createElement(l.default.Fragment,null,l.default.createElement("th",Object.assign({ref:n,className:(0,a.tremorTwMerge)(r("root"),"whitespace-nowrap text-left font-semibold top-0 px-4 py-3.5","text-tremor-content-strong","dark:text-dark-tremor-content-strong",o)},s),i))});n.displayName="TableHeaderCell",e.s(["TableHeaderCell",()=>n],64848)},942232,e=>{"use strict";var t=e.i(290571),l=e.i(271645),a=e.i(444755);let r=(0,e.i(673706).makeClassName)("TableBody"),n=l.default.forwardRef((e,n)=>{let{children:i,className:o}=e,s=(0,t.__rest)(e,["children","className"]);return l.default.createElement(l.default.Fragment,null,l.default.createElement("tbody",Object.assign({ref:n,className:(0,a.tremorTwMerge)(r("root"),"align-top divide-y","divide-tremor-border","dark:divide-dark-tremor-border",o)},s),i))});n.displayName="TableBody",e.s(["TableBody",()=>n],942232)},496020,e=>{"use strict";var t=e.i(290571),l=e.i(271645),a=e.i(444755);let r=(0,e.i(673706).makeClassName)("TableRow"),n=l.default.forwardRef((e,n)=>{let{children:i,className:o}=e,s=(0,t.__rest)(e,["children","className"]);return l.default.createElement(l.default.Fragment,null,l.default.createElement("tr",Object.assign({ref:n,className:(0,a.tremorTwMerge)(r("row"),o)},s),i))});n.displayName="TableRow",e.s(["TableRow",()=>n],496020)},977572,e=>{"use strict";var t=e.i(290571),l=e.i(271645),a=e.i(444755);let r=(0,e.i(673706).makeClassName)("TableCell"),n=l.default.forwardRef((e,n)=>{let{children:i,className:o}=e,s=(0,t.__rest)(e,["children","className"]);return l.default.createElement(l.default.Fragment,null,l.default.createElement("td",Object.assign({ref:n,className:(0,a.tremorTwMerge)(r("root"),"align-middle whitespace-nowrap text-left p-4",o)},s),i))});n.displayName="TableCell",e.s(["TableCell",()=>n],977572)},68155,e=>{"use strict";var t=e.i(271645);let l=t.forwardRef(function(e,l){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:l},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"}))});e.s(["TrashIcon",0,l],68155)},278587,e=>{"use strict";var t=e.i(271645);let l=t.forwardRef(function(e,l){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:l},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"}))});e.s(["RefreshIcon",0,l],278587)},207670,e=>{"use strict";function t(){for(var e,t,l=0,a="",r=arguments.length;lt,"default",0,t])},906579,e=>{"use strict";e.i(247167);var t=e.i(271645),l=e.i(343794),a=e.i(361275),r=e.i(702779),n=e.i(763731),i=e.i(242064);e.i(296059);var o=e.i(915654),s=e.i(694758),c=e.i(183293),d=e.i(403541),u=e.i(246422),m=e.i(838378);let g=new s.Keyframes("antStatusProcessing",{"0%":{transform:"scale(0.8)",opacity:.5},"100%":{transform:"scale(2.4)",opacity:0}}),b=new s.Keyframes("antZoomBadgeIn",{"0%":{transform:"scale(0) translate(50%, -50%)",opacity:0},"100%":{transform:"scale(1) translate(50%, -50%)"}}),p=new s.Keyframes("antZoomBadgeOut",{"0%":{transform:"scale(1) translate(50%, -50%)"},"100%":{transform:"scale(0) translate(50%, -50%)",opacity:0}}),f=new s.Keyframes("antNoWrapperZoomBadgeIn",{"0%":{transform:"scale(0)",opacity:0},"100%":{transform:"scale(1)"}}),h=new s.Keyframes("antNoWrapperZoomBadgeOut",{"0%":{transform:"scale(1)"},"100%":{transform:"scale(0)",opacity:0}}),v=new s.Keyframes("antBadgeLoadingCircle",{"0%":{transformOrigin:"50%"},"100%":{transform:"translate(50%, -50%) rotate(360deg)",transformOrigin:"50%"}}),x=e=>{let{fontHeight:t,lineWidth:l,marginXS:a,colorBorderBg:r}=e,n=e.colorTextLightSolid,i=e.colorError,o=e.colorErrorHover;return(0,m.mergeToken)(e,{badgeFontHeight:t,badgeShadowSize:l,badgeTextColor:n,badgeColor:i,badgeColorHover:o,badgeShadowColor:r,badgeProcessingDuration:"1.2s",badgeRibbonOffset:a,badgeRibbonCornerTransform:"scaleY(0.75)",badgeRibbonCornerFilter:"brightness(75%)"})},j=e=>{let{fontSize:t,lineHeight:l,fontSizeSM:a,lineWidth:r}=e;return{indicatorZIndex:"auto",indicatorHeight:Math.round(t*l)-2*r,indicatorHeightSM:t,dotSize:a/2,textFontSize:a,textFontSizeSM:a,textFontWeight:"normal",statusSize:a/2}},$=(0,u.genStyleHooks)("Badge",e=>(e=>{let{componentCls:t,iconCls:l,antCls:a,badgeShadowSize:r,textFontSize:n,textFontSizeSM:i,statusSize:s,dotSize:u,textFontWeight:m,indicatorHeight:x,indicatorHeightSM:j,marginXS:$,calc:y}=e,w=`${a}-scroll-number`,C=(0,d.genPresetColor)(e,(e,{darkColor:l})=>({[`&${t} ${t}-color-${e}`]:{background:l,[`&:not(${t}-count)`]:{color:l},"a:hover &":{background:l}}}));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:x,height:x,color:e.badgeTextColor,fontWeight:m,fontSize:n,lineHeight:(0,o.unit)(x),whiteSpace:"nowrap",textAlign:"center",background:e.badgeColor,borderRadius:y(x).div(2).equal(),boxShadow:`0 0 0 ${(0,o.unit)(r)} ${e.badgeShadowColor}`,transition:`background ${e.motionDurationMid}`,a:{color:e.badgeTextColor},"a:hover":{color:e.badgeTextColor},"a:hover &":{background:e.badgeColorHover}},[`${t}-count-sm`]:{minWidth:j,height:j,fontSize:i,lineHeight:(0,o.unit)(j),borderRadius:y(j).div(2).equal()},[`${t}-multiple-words`]:{padding:`0 ${(0,o.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,o.unit)(r)} ${e.badgeShadowColor}`},[`${t}-count, ${t}-dot, ${w}-custom-component`]:{position:"absolute",top:0,insetInlineEnd:0,transform:"translate(50%, -50%)",transformOrigin:"100% 0%",[`&${l}-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:s,height:s,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:r,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:$,color:e.colorText,fontSize:e.fontSize}}}),C),{[`${t}-zoom-appear, ${t}-zoom-enter`]:{animationName:b,animationDuration:e.motionDurationSlow,animationTimingFunction:e.motionEaseOutBack,animationFillMode:"both"},[`${t}-zoom-leave`]:{animationName:p,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:h,animationDuration:e.motionDurationSlow,animationTimingFunction:e.motionEaseOutBack},[`&:not(${t}-status)`]:{verticalAlign:"middle"},[`${w}-custom-component, ${t}-count`]:{transform:"none"},[`${w}-custom-component, ${w}`]:{position:"relative",top:"auto",display:"block",transformOrigin:"50% 50%"}},[w]:{overflow:"hidden",transition:`all ${e.motionDurationMid} ${e.motionEaseOutBack}`,[`${w}-only`]:{position:"relative",display:"inline-block",height:x,transition:`all ${e.motionDurationSlow} ${e.motionEaseOutBack}`,WebkitTransformStyle:"preserve-3d",WebkitBackfaceVisibility:"hidden",[`> p${w}-only-unit`]:{height:x,margin:0,WebkitTransformStyle:"preserve-3d",WebkitBackfaceVisibility:"hidden"}},[`${w}-symbol`]:{verticalAlign:"top"}},"&-rtl":{direction:"rtl",[`${t}-count, ${t}-dot, ${w}-custom-component`]:{transform:"translate(-50%, -50%)"}}})}})(x(e)),j),y=(0,u.genStyleHooks)(["Badge","Ribbon"],e=>(e=>{let{antCls:t,badgeFontHeight:l,marginXS:a,badgeRibbonOffset:r,calc:n}=e,i=`${t}-ribbon`,s=`${t}-ribbon-wrapper`,u=(0,d.genPresetColor)(e,(e,{darkColor:t})=>({[`&${i}-color-${e}`]:{background:t,color:t}}));return{[s]:{position:"relative"},[i]:Object.assign(Object.assign(Object.assign(Object.assign({},(0,c.resetComponent)(e)),{position:"absolute",top:a,padding:`0 ${(0,o.unit)(e.paddingXS)}`,color:e.colorPrimary,lineHeight:(0,o.unit)(l),whiteSpace:"nowrap",backgroundColor:e.colorPrimary,borderRadius:e.borderRadiusSM,[`${i}-text`]:{color:e.badgeTextColor},[`${i}-corner`]:{position:"absolute",top:"100%",width:r,height:r,color:"currentcolor",border:`${(0,o.unit)(n(r).div(2).equal())} solid`,transform:e.badgeRibbonCornerTransform,transformOrigin:"top",filter:e.badgeRibbonCornerFilter}}),u),{[`&${i}-placement-end`]:{insetInlineEnd:n(r).mul(-1).equal(),borderEndEndRadius:0,[`${i}-corner`]:{insetInlineEnd:0,borderInlineEndColor:"transparent",borderBlockEndColor:"transparent"}},[`&${i}-placement-start`]:{insetInlineStart:n(r).mul(-1).equal(),borderEndStartRadius:0,[`${i}-corner`]:{insetInlineStart:0,borderBlockEndColor:"transparent",borderInlineStartColor:"transparent"}},"&-rtl":{direction:"rtl"}})}})(x(e)),j),w=e=>{let a,{prefixCls:r,value:n,current:i,offset:o=0}=e;return o&&(a={position:"absolute",top:`${o}00%`,left:0}),t.createElement("span",{style:a,className:(0,l.default)(`${r}-only-unit`,{current:i})},n)},C=e=>{let l,a,{prefixCls:r,count:n,value:i}=e,o=Number(i),s=Math.abs(n),[c,d]=t.useState(o),[u,m]=t.useState(s),g=()=>{d(o),m(s)};if(t.useEffect(()=>{let e=setTimeout(g,1e3);return()=>clearTimeout(e)},[o]),c===o||Number.isNaN(o)||Number.isNaN(c))l=[t.createElement(w,Object.assign({},e,{key:o,current:!0}))],a={transition:"none"};else{l=[];let r=o+10,n=[];for(let e=o;e<=r;e+=1)n.push(e);let i=ue%10===c);l=(i<0?n.slice(0,d+1):n.slice(d)).map((l,a)=>t.createElement(w,Object.assign({},e,{key:l,value:l%10,offset:i<0?a-d:a,current:a===d}))),a={transform:`translateY(${-function(e,t,l){let a=e,r=0;for(;(a+10)%10!==t;)a+=l,r+=l;return r}(c,o,i)}00%)`}}return t.createElement("span",{className:`${r}-only`,style:a,onTransitionEnd:g},l)};var O=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 r=0,a=Object.getOwnPropertySymbols(e);rt.indexOf(a[r])&&Object.prototype.propertyIsEnumerable.call(e,a[r])&&(l[a[r]]=e[a[r]]);return l};let k=t.forwardRef((e,a)=>{let{prefixCls:r,count:o,className:s,motionClassName:c,style:d,title:u,show:m,component:g="sup",children:b}=e,p=O(e,["prefixCls","count","className","motionClassName","style","title","show","component","children"]),{getPrefixCls:f}=t.useContext(i.ConfigContext),h=f("scroll-number",r),v=Object.assign(Object.assign({},p),{"data-show":m,style:d,className:(0,l.default)(h,s,c),title:u}),x=o;if(o&&Number(o)%1==0){let e=String(o).split("");x=t.createElement("bdi",null,e.map((l,a)=>t.createElement(C,{prefixCls:h,count:Number(o),value:l,key:e.length-a})))}return((null==d?void 0:d.borderColor)&&(v.style=Object.assign(Object.assign({},d),{boxShadow:`0 0 0 1px ${d.borderColor} inset`})),b)?(0,n.cloneElement)(b,e=>({className:(0,l.default)(`${h}-custom-component`,null==e?void 0:e.className,c)})):t.createElement(g,Object.assign({},v,{ref:a}),x)});var N=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 r=0,a=Object.getOwnPropertySymbols(e);rt.indexOf(a[r])&&Object.prototype.propertyIsEnumerable.call(e,a[r])&&(l[a[r]]=e[a[r]]);return l};let E=t.forwardRef((e,o)=>{var s,c,d,u,m;let{prefixCls:g,scrollNumberPrefixCls:b,children:p,status:f,text:h,color:v,count:x=null,overflowCount:j=99,dot:y=!1,size:w="default",title:C,offset:O,style:E,className:S,rootClassName:T,classNames:I,styles:R,showZero:M=!1}=e,_=N(e,["prefixCls","scrollNumberPrefixCls","children","status","text","color","count","overflowCount","dot","size","title","offset","style","className","rootClassName","classNames","styles","showZero"]),{getPrefixCls:F,direction:A,badge:B}=t.useContext(i.ConfigContext),z=F("badge",g),[q,P,L]=$(z),H=x>j?`${j}+`:x,D="0"===H||0===H||"0"===h||0===h,W=null===x||D&&!M,U=(null!=f||null!=v)&&W,K=null!=f||!D,V=y&&!D,Z=V?"":H,X=(0,t.useMemo)(()=>((null==Z||""===Z)&&(null==h||""===h)||D&&!M)&&!V,[Z,D,M,V,h]),G=(0,t.useRef)(x);X||(G.current=x);let J=G.current,Q=(0,t.useRef)(Z);X||(Q.current=Z);let Y=Q.current,ee=(0,t.useRef)(V);X||(ee.current=V);let et=(0,t.useMemo)(()=>{if(!O)return Object.assign(Object.assign({},null==B?void 0:B.style),E);let e={marginTop:O[1]};return"rtl"===A?e.left=Number.parseInt(O[0],10):e.right=-Number.parseInt(O[0],10),Object.assign(Object.assign(Object.assign({},e),null==B?void 0:B.style),E)},[A,O,E,null==B?void 0:B.style]),el=null!=C?C:"string"==typeof J||"number"==typeof J?J:void 0,ea=!X&&(0===h?M:!!h&&!0!==h),er=ea?t.createElement("span",{className:`${z}-status-text`},h):null,en=J&&"object"==typeof J?(0,n.cloneElement)(J,e=>({style:Object.assign(Object.assign({},et),e.style)})):void 0,ei=(0,r.isPresetColor)(v,!1),eo=(0,l.default)(null==I?void 0:I.indicator,null==(s=null==B?void 0:B.classNames)?void 0:s.indicator,{[`${z}-status-dot`]:U,[`${z}-status-${f}`]:!!f,[`${z}-color-${v}`]:ei}),es={};v&&!ei&&(es.color=v,es.background=v);let ec=(0,l.default)(z,{[`${z}-status`]:U,[`${z}-not-a-wrapper`]:!p,[`${z}-rtl`]:"rtl"===A},S,T,null==B?void 0:B.className,null==(c=null==B?void 0:B.classNames)?void 0:c.root,null==I?void 0:I.root,P,L);if(!p&&U&&(h||K||!W)){let e=et.color;return q(t.createElement("span",Object.assign({},_,{className:ec,style:Object.assign(Object.assign(Object.assign({},null==R?void 0:R.root),null==(d=null==B?void 0:B.styles)?void 0:d.root),et)}),t.createElement("span",{className:eo,style:Object.assign(Object.assign(Object.assign({},null==R?void 0:R.indicator),null==(u=null==B?void 0:B.styles)?void 0:u.indicator),es)}),ea&&t.createElement("span",{style:{color:e},className:`${z}-status-text`},h)))}return q(t.createElement("span",Object.assign({ref:o},_,{className:ec,style:Object.assign(Object.assign({},null==(m=null==B?void 0:B.styles)?void 0:m.root),null==R?void 0:R.root)}),p,t.createElement(a.default,{visible:!X,motionName:`${z}-zoom`,motionAppear:!1,motionDeadline:1e3},({className:e})=>{var a,r;let n=F("scroll-number",b),i=ee.current,o=(0,l.default)(null==I?void 0:I.indicator,null==(a=null==B?void 0:B.classNames)?void 0:a.indicator,{[`${z}-dot`]:i,[`${z}-count`]:!i,[`${z}-count-sm`]:"small"===w,[`${z}-multiple-words`]:!i&&Y&&Y.toString().length>1,[`${z}-status-${f}`]:!!f,[`${z}-color-${v}`]:ei}),s=Object.assign(Object.assign(Object.assign({},null==R?void 0:R.indicator),null==(r=null==B?void 0:B.styles)?void 0:r.indicator),et);return v&&!ei&&((s=s||{}).background=v),t.createElement(k,{prefixCls:n,show:!X,motionClassName:e,className:o,count:Y,title:el,style:s,key:"scrollNumber"},en)}),er))});E.Ribbon=e=>{let{className:a,prefixCls:n,style:o,color:s,children:c,text:d,placement:u="end",rootClassName:m}=e,{getPrefixCls:g,direction:b}=t.useContext(i.ConfigContext),p=g("ribbon",n),f=`${p}-wrapper`,[h,v,x]=y(p,f),j=(0,r.isPresetColor)(s,!1),$=(0,l.default)(p,`${p}-placement-${u}`,{[`${p}-rtl`]:"rtl"===b,[`${p}-color-${s}`]:j},a),w={},C={};return s&&!j&&(w.background=s,C.color=s),h(t.createElement("div",{className:(0,l.default)(f,m,v,x)},c,t.createElement("div",{className:(0,l.default)($,v),style:Object.assign(Object.assign({},w),o)},t.createElement("span",{className:`${p}-text`},d),t.createElement("div",{className:`${p}-corner`,style:C}))))},e.s(["Badge",0,E],906579)},738014,e=>{"use strict";var t=e.i(135214),l=e.i(764205),a=e.i(266027);let r=(0,e.i(243652).createQueryKeys)("users");e.s(["useCurrentUser",0,()=>{let{accessToken:e,userId:n,userRole:i}=(0,t.default)();return(0,a.useQuery)({queryKey:r.detail(n),queryFn:async()=>{let t=await (0,l.userInfoCall)(e,n,i,!1,null,null);return console.log(`userInfo: ${JSON.stringify(t)}`),t.user_info},enabled:!!(e&&n&&i)})}])},907308,e=>{"use strict";var t=e.i(843476),l=e.i(271645),a=e.i(212931),r=e.i(808613),n=e.i(464571),i=e.i(199133),o=e.i(592968),s=e.i(213205),c=e.i(374009),d=e.i(764205);e.s(["default",0,({isVisible:e,onCancel:u,onSubmit:m,accessToken:g,title:b="Add Team Member",roles:p=[{label:"admin",value:"admin",description:"Admin role. Can create team keys, add members, and manage settings."},{label:"user",value:"user",description:"User role. Can view team info, but not manage it."}],defaultRole:f="user",teamId:h})=>{let[v]=r.Form.useForm(),[x,j]=(0,l.useState)([]),[$,y]=(0,l.useState)(!1),[w,C]=(0,l.useState)("user_email"),[O,k]=(0,l.useState)(!1),N=async(e,t)=>{if(!e)return void j([]);y(!0);try{let l=new URLSearchParams;if(l.append(t,e),h&&l.append("team_id",h),null==g)return;let a=(await (0,d.userFilterUICall)(g,l)).map(e=>({label:"user_email"===t?`${e.user_email}`:`${e.user_id}`,value:"user_email"===t?e.user_email:e.user_id,user:e}));j(a)}catch(e){console.error("Error fetching users:",e)}finally{y(!1)}},E=(0,l.useCallback)((0,c.default)((e,t)=>N(e,t),300),[]),S=(e,t)=>{C(t),E(e,t)},T=(e,t)=>{let l=t.user;v.setFieldsValue({user_email:l.user_email,user_id:l.user_id,role:v.getFieldValue("role")})},I=async e=>{k(!0);try{await m(e)}finally{k(!1)}};return(0,t.jsx)(a.Modal,{title:b,open:e,onCancel:()=>{v.resetFields(),j([]),u()},footer:null,width:800,maskClosable:!O,children:(0,t.jsxs)(r.Form,{form:v,onFinish:I,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",initialValues:{role:f},children:[(0,t.jsx)(r.Form.Item,{label:"Email",name:"user_email",className:"mb-4",children:(0,t.jsx)(i.Select,{showSearch:!0,className:"w-full",placeholder:"Search by email",filterOption:!1,onSearch:e=>S(e,"user_email"),onSelect:(e,t)=>T(e,t),options:"user_email"===w?x:[],loading:$,allowClear:!0})}),(0,t.jsx)("div",{className:"text-center mb-4",children:"OR"}),(0,t.jsx)(r.Form.Item,{label:"User ID",name:"user_id",className:"mb-4",children:(0,t.jsx)(i.Select,{showSearch:!0,className:"w-full",placeholder:"Search by user ID",filterOption:!1,onSearch:e=>S(e,"user_id"),onSelect:(e,t)=>T(e,t),options:"user_id"===w?x:[],loading:$,allowClear:!0})}),(0,t.jsx)(r.Form.Item,{label:"Member Role",name:"role",className:"mb-4",children:(0,t.jsx)(i.Select,{defaultValue:f,children:p.map(e=>(0,t.jsx)(i.Select.Option,{value:e.value,children:(0,t.jsxs)(o.Tooltip,{title:e.description,children:[(0,t.jsx)("span",{className:"font-medium",children:e.label}),(0,t.jsxs)("span",{className:"ml-2 text-gray-500 text-sm",children:["- ",e.description]})]})},e.value))})}),(0,t.jsx)("div",{className:"text-right mt-4",children:(0,t.jsx)(n.Button,{type:"primary",htmlType:"submit",icon:(0,t.jsx)(s.UserAddOutlined,{}),loading:O,children:O?"Adding...":"Add Member"})})]})})}])},162386,e=>{"use strict";var t=e.i(843476),l=e.i(625901),a=e.i(109799),r=e.i(785242),n=e.i(738014),i=e.i(199133),o=e.i(981339),s=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:l})=>t&&l?.includeUserModels?t:[],team:({allProxyModels:e,selectedOrganization:t,userModels:l})=>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:b,options:p,context:f,dataTestId:h,value:v=[],onChange:x,style:j}=e,{includeUserModels:$,showAllTeamModelsOption:y,showAllProxyModelsOverride:w,includeSpecialOptions:C}=p||{},{data:O,isLoading:k}=(0,l.useAllProxyModels)(),{data:N,isLoading:E}=(0,r.useTeam)(g),{data:S,isLoading:T}=(0,a.useOrganization)(b),{data:I,isLoading:R}=(0,n.useCurrentUser)(),M=e=>u.some(t=>t.value===e),_=v.some(M),F=S?.models.includes(c.value)||S?.models.length===0;if(k||E||T||R)return(0,t.jsx)(o.Skeleton.Input,{active:!0,block:!0});let{wildcard:A,regular:B}=(e=>{let t=[],l=[];for(let a of e)a.endsWith("/*")?t.push(a):l.push(a);return{wildcard:t,regular:l}})(((e,t,l)=>{let a=Array.from(new Map(e.map(e=>[e.id,e])).values()).map(e=>e.id);if(t.options?.showAllProxyModelsOverride)return a;let r=m[t.context];return r?r({allProxyModels:a,...l,options:t.options}):[]})(O?.data??[],e,{selectedTeam:N,selectedOrganization:S,userModels:I?.models}));return(0,t.jsx)(i.Select,{"data-testid":h,value:v,onChange:e=>{let t=e.filter(M);x(t.length>0?[t[t.length-1]]:e)},style:j,options:[C?{label:(0,t.jsx)("span",{children:"Special Options"}),title:"Special Options",options:[...w||F&&C||"global"===f?[{label:(0,t.jsx)("span",{children:"All Proxy Models"}),value:c.value,disabled:v.length>0&&v.some(e=>M(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=>M(e)&&e!==d.value),key:d.value}]}:[],...A.length>0?[{label:(0,t.jsx)("span",{children:"Wildcard Options"}),title:"Wildcard Options",options:A.map(e=>{let l=e.replace("/*",""),a=l.charAt(0).toUpperCase()+l.slice(1);return{label:(0,t.jsx)("span",{children:`All ${a} models`}),value:e,disabled:_}})}]:[],{label:(0,t.jsx)("span",{children:"Models"}),title:"Models",options:B.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)(s.Tooltip,{styles:{root:{pointerEvents:"none"}},title:e.map(({value:e})=>e).join(", "),children:(0,t.jsxs)("span",{children:["+",e.length," more"]})})})}],162386)},276173,e=>{"use strict";var t=e.i(843476),l=e.i(599724),a=e.i(779241),r=e.i(464571),n=e.i(808613),i=e.i(212931),o=e.i(199133),s=e.i(271645),c=e.i(435451);e.s(["default",0,({visible:e,onCancel:d,onSubmit:u,initialData:m,mode:g,config:b})=>{let p,[f]=n.Form.useForm(),[h,v]=(0,s.useState)(!1);console.log("Initial Data:",m),(0,s.useEffect)(()=>{if(e)if("edit"===g&&m){let e={...m,role:m.role||b.defaultRole,max_budget_in_team:m.max_budget_in_team||null,tpm_limit:m.tpm_limit||null,rpm_limit:m.rpm_limit||null};console.log("Setting form values:",e),f.setFieldsValue(e)}else f.resetFields(),f.setFieldsValue({role:b.defaultRole||b.roleOptions[0]?.value})},[e,m,g,f,b.defaultRole,b.roleOptions]);let x=async e=>{try{v(!0);let t=Object.entries(e).reduce((e,[t,l])=>{if("string"==typeof l){let a=l.trim();return""===a&&("max_budget_in_team"===t||"tpm_limit"===t||"rpm_limit"===t)?{...e,[t]:null}:{...e,[t]:a}}return{...e,[t]:l}},{});console.log("Submitting form data:",t),await Promise.resolve(u(t)),f.resetFields()}catch(e){console.error("Form submission error:",e)}finally{v(!1)}};return(0,t.jsx)(i.Modal,{title:b.title||("add"===g?"Add Member":"Edit Member"),open:e,width:1e3,footer:null,onCancel:d,children:(0,t.jsxs)(n.Form,{form:f,onFinish:x,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[b.showEmail&&(0,t.jsx)(n.Form.Item,{label:"Email",name:"user_email",className:"mb-4",rules:[{type:"email",message:"Please enter a valid email!"}],children:(0,t.jsx)(a.TextInput,{placeholder:"user@example.com"})}),b.showEmail&&b.showUserId&&(0,t.jsx)("div",{className:"text-center mb-4",children:(0,t.jsx)(l.Text,{children:"OR"})}),b.showUserId&&(0,t.jsx)(n.Form.Item,{label:"User ID",name:"user_id",className:"mb-4",children:(0,t.jsx)(a.TextInput,{placeholder:"user_123"})}),(0,t.jsx)(n.Form.Item,{label:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{children:"Role"}),"edit"===g&&m&&(0,t.jsxs)("span",{className:"text-gray-500 text-sm",children:["(Current: ",(p=m.role,b.roleOptions.find(e=>e.value===p)?.label||p),")"]})]}),name:"role",className:"mb-4",rules:[{required:!0,message:"Please select a role!"}],children:(0,t.jsx)(o.Select,{children:"edit"===g&&m?[...b.roleOptions.filter(e=>e.value===m.role),...b.roleOptions.filter(e=>e.value!==m.role)].map(e=>(0,t.jsx)(o.Select.Option,{value:e.value,children:e.label},e.value)):b.roleOptions.map(e=>(0,t.jsx)(o.Select.Option,{value:e.value,children:e.label},e.value))})}),b.additionalFields?.map(e=>(0,t.jsx)(n.Form.Item,{label:e.label,name:e.name,className:"mb-4",rules:e.rules,children:(e=>{switch(e.type){case"input":return(0,t.jsx)(a.TextInput,{placeholder:e.placeholder});case"numerical":return(0,t.jsx)(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)(o.Select,{children:e.options?.map(e=>(0,t.jsx)(o.Select.Option,{value:e.value,children:e.label},e.value))});default:return null}})(e)},e.name)),(0,t.jsxs)("div",{className:"text-right mt-6",children:[(0,t.jsx)(r.Button,{onClick:d,className:"mr-2",disabled:h,children:"Cancel"}),(0,t.jsx)(r.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),l=e.i(100486),a=e.i(827252),r=e.i(213205),n=e.i(771674),i=e.i(464571),o=e.i(770914),s=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 b({members:e,canEdit:u,onEdit:b,onDelete:p,onAddMember:f,roleColumnTitle:h="Role",roleTooltip:v,extraColumns:x=[],showDeleteForMember:j,emptyText:$}){let y=[{title:"User Email",dataIndex:"user_email",key:"user_email",render:e=>(0,t.jsx)(g,{children:e||"-"})},{title:"User ID",dataIndex:"user_id",key:"user_id",render:e=>"default_user_id"===e?(0,t.jsx)(c.Tag,{color:"blue",children:"Default Proxy Admin"}):(0,t.jsx)(g,{children:e||"-"})},{title:v?(0,t.jsxs)(o.Space,{direction:"horizontal",children:[h,(0,t.jsx)(d.Tooltip,{title:v,children:(0,t.jsx)(a.InfoCircleOutlined,{})})]}):h,dataIndex:"role",key:"role",render:e=>(0,t.jsxs)(o.Space,{children:[e?.toLowerCase()==="admin"||e?.toLowerCase()==="org_admin"?(0,t.jsx)(l.CrownOutlined,{}):(0,t.jsx)(n.UserOutlined,{}),(0,t.jsx)(g,{style:{textTransform:"capitalize"},children:e||"-"})]})},...x,{title:"Actions",key:"actions",fixed:"right",width:120,render:(e,l)=>u?(0,t.jsxs)(o.Space,{children:[(0,t.jsx)(m.default,{variant:"Edit",tooltipText:"Edit member",dataTestId:"edit-member",onClick:()=>b(l)}),(!j||j(l))&&(0,t.jsx)(m.default,{variant:"Delete",tooltipText:"Delete member",dataTestId:"delete-member",onClick:()=>p(l)})]}):null}];return(0,t.jsxs)(o.Space,{direction:"vertical",style:{width:"100%"},children:[(0,t.jsxs)("span",{className:"inline-flex text-sm text-gray-700",children:[e.length," Member",1!==e.length?"s":""]}),(0,t.jsx)(s.Table,{columns:y,dataSource:e,rowKey:e=>e.user_id??e.user_email??JSON.stringify(e),pagination:!1,size:"small",scroll:{x:"max-content"},locale:$?{emptyText:$}:void 0}),f&&u&&(0,t.jsx)(i.Button,{icon:(0,t.jsx)(r.UserAddOutlined,{}),type:"primary",onClick:f,children:"Add Member"})]})}e.s(["default",()=>b])}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/69365f493e1655a4.js b/litellm/proxy/_experimental/out/_next/static/chunks/0dda11815be4f78b.js similarity index 79% rename from litellm/proxy/_experimental/out/_next/static/chunks/69365f493e1655a4.js rename to litellm/proxy/_experimental/out/_next/static/chunks/0dda11815be4f78b.js index 6b38909128..f8b096910b 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/69365f493e1655a4.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/0dda11815be4f78b.js @@ -100,6 +100,6 @@ `]:{animationName:i.slideDownIn},[`${u}${d}bottomLeft`]:{animationName:i.slideUpOut},[` ${u}${d}topLeft, ${u}${d}topRight - `]:{animationName:i.slideDownOut},"&-hidden":{display:"none"},[o]:Object.assign(Object.assign({},l(e)),{cursor:"pointer",transition:`background ${e.motionDurationSlow} ease`,borderRadius:e.borderRadiusSM,"&-group":{color:e.colorTextDescription,fontSize:e.fontSizeSM,cursor:"default"},"&-option":{display:"flex","&-content":Object.assign({flex:"auto"},t.textEllipsis),"&-state":{flex:"none",display:"flex",alignItems:"center"},[`&-active:not(${o}-option-disabled)`]:{backgroundColor:e.optionActiveBg},[`&-selected:not(${o}-option-disabled)`]:{color:e.optionSelectedColor,fontWeight:e.optionSelectedFontWeight,backgroundColor:e.optionSelectedBg,[`${o}-option-state`]:{color:e.colorPrimary}},"&-disabled":{[`&${o}-option-selected`]:{backgroundColor:e.colorBgContainerDisabled},color:e.colorTextDisabled,cursor:"not-allowed"},"&-grouped":{paddingInlineStart:e.calc(e.controlPaddingHorizontal).mul(2).equal()}},"&-empty":Object.assign(Object.assign({},l(e)),{color:e.colorTextDisabled})}),[`${f}:has(+ ${f})`]:{borderEndStartRadius:0,borderEndEndRadius:0,[`& + ${f}`]:{borderStartStartRadius:0,borderStartEndRadius:0}},"&-rtl":{direction:"rtl"}})},(0,i.initSlideMotion)(e,"slide-up"),(0,i.initSlideMotion)(e,"slide-down"),(0,a.initMoveMotion)(e,"move-up"),(0,a.initMoveMotion)(e,"move-down")]})(e),{[`${n}-rtl`]:{direction:"rtl"}},(0,r.genCompactItemStyle)(e,{borderElCls:`${n}-selector`,focusElCls:`${n}-focused`})]})(v),{[v.componentCls]:Object.assign(Object.assign(Object.assign(Object.assign({},{"&-outlined":Object.assign(Object.assign(Object.assign(Object.assign({},d(v,{borderColor:v.colorBorder,hoverBorderHover:v.hoverBorderColor,activeBorderColor:v.activeBorderColor,activeOutlineColor:v.activeOutlineColor,color:v.colorText})),f(v,{status:"error",borderColor:v.colorError,hoverBorderHover:v.colorErrorHover,activeBorderColor:v.colorError,activeOutlineColor:v.colorErrorOutline,color:v.colorError})),f(v,{status:"warning",borderColor:v.colorWarning,hoverBorderHover:v.colorWarningHover,activeBorderColor:v.colorWarning,activeOutlineColor:v.colorWarningOutline,color:v.colorWarning})),{[`&${v.componentCls}-disabled`]:{[`&:not(${v.componentCls}-customize-input) ${v.componentCls}-selector`]:{background:v.colorBgContainerDisabled,color:v.colorTextDisabled}},[`&${v.componentCls}-multiple ${v.componentCls}-selection-item`]:{background:v.multipleItemBg,border:`${(0,s.unit)(v.lineWidth)} ${v.lineType} ${v.multipleItemBorderColor}`}})}),{"&-filled":Object.assign(Object.assign(Object.assign(Object.assign({},p(v,{bg:v.colorFillTertiary,hoverBg:v.colorFillSecondary,activeBorderColor:v.activeBorderColor,color:v.colorText})),m(v,{status:"error",bg:v.colorErrorBg,hoverBg:v.colorErrorBgHover,activeBorderColor:v.colorError,color:v.colorError})),m(v,{status:"warning",bg:v.colorWarningBg,hoverBg:v.colorWarningBgHover,activeBorderColor:v.colorWarning,color:v.colorWarning})),{[`&${v.componentCls}-disabled`]:{[`&:not(${v.componentCls}-customize-input) ${v.componentCls}-selector`]:{borderColor:v.colorBorder,background:v.colorBgContainerDisabled,color:v.colorTextDisabled}},[`&${v.componentCls}-multiple ${v.componentCls}-selection-item`]:{background:v.colorBgContainer,border:`${(0,s.unit)(v.lineWidth)} ${v.lineType} ${v.colorSplit}`}})}),{"&-borderless":{[`${v.componentCls}-selector`]:{background:"transparent",border:`${(0,s.unit)(v.lineWidth)} ${v.lineType} transparent`},[`&${v.componentCls}-disabled`]:{[`&:not(${v.componentCls}-customize-input) ${v.componentCls}-selector`]:{color:v.colorTextDisabled}},[`&${v.componentCls}-multiple ${v.componentCls}-selection-item`]:{background:v.multipleItemBg,border:`${(0,s.unit)(v.lineWidth)} ${v.lineType} ${v.multipleItemBorderColor}`},[`&${v.componentCls}-status-error`]:{[`${v.componentCls}-prefix, ${v.componentCls}-selection-item`]:{color:v.colorError}},[`&${v.componentCls}-status-warning`]:{[`${v.componentCls}-prefix, ${v.componentCls}-selection-item`]:{color:v.colorWarning}}}}),{"&-underlined":Object.assign(Object.assign(Object.assign(Object.assign({},h(v,{borderColor:v.colorBorder,hoverBorderHover:v.hoverBorderColor,activeBorderColor:v.activeBorderColor,activeOutlineColor:v.activeOutlineColor,color:v.colorText})),g(v,{status:"error",borderColor:v.colorError,hoverBorderHover:v.colorErrorHover,activeBorderColor:v.colorError,activeOutlineColor:v.colorErrorOutline,color:v.colorError})),g(v,{status:"warning",borderColor:v.colorWarning,hoverBorderHover:v.colorWarningHover,activeBorderColor:v.colorWarning,activeOutlineColor:v.colorWarningOutline,color:v.colorWarning})),{[`&${v.componentCls}-disabled`]:{[`&:not(${v.componentCls}-customize-input) ${v.componentCls}-selector`]:{color:v.colorTextDisabled}},[`&${v.componentCls}-multiple ${v.componentCls}-selection-item`]:{background:v.multipleItemBg,border:`${(0,s.unit)(v.lineWidth)} ${v.lineType} ${v.multipleItemBorderColor}`}})})}]},e=>{let{fontSize:t,lineHeight:r,lineWidth:n,controlHeight:o,controlHeightSM:a,controlHeightLG:i,paddingXXS:l,controlPaddingHorizontal:s,zIndexPopupBase:c,colorText:u,fontWeightStrong:d,controlItemBgActive:f,controlItemBgHover:p,colorBgContainer:m,colorFillSecondary:h,colorBgContainerDisabled:g,colorTextDisabled:v,colorPrimaryHover:y,colorPrimary:b,controlOutline:w}=e,$=2*l,C=2*n,E=Math.min(o-$,o-C),S=Math.min(a-$,a-C),x=Math.min(i-$,i-C);return{INTERNAL_FIXED_ITEM_MARGIN:Math.floor(l/2),zIndexPopup:c+50,optionSelectedColor:u,optionSelectedFontWeight:d,optionSelectedBg:f,optionActiveBg:p,optionPadding:`${(o-t*r)/2}px ${s}px`,optionFontSize:t,optionLineHeight:r,optionHeight:o,selectorBg:m,clearBg:m,singleItemHeightLG:i,multipleItemBg:h,multipleItemBorderColor:"transparent",multipleItemHeight:E,multipleItemHeightSM:S,multipleItemHeightLG:x,multipleSelectorBgDisabled:g,multipleItemColorDisabled:v,multipleItemBorderColorDisabled:"transparent",showArrowPaddingInlineEnd:Math.ceil(1.25*e.fontSize),hoverBorderColor:y,activeBorderColor:b,activeOutlineColor:w,selectAffixPadding:l}},{unitless:{optionLineHeight:!0,optionSelectedFontWeight:!0}});e.s(["default",0,v],950302)},121229,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:"M912 190h-69.9c-9.8 0-19.1 4.5-25.1 12.2L404.7 724.5 207 474a32 32 0 00-25.1-12.2H112c-6.7 0-10.4 7.7-6.3 12.9l273.9 347c12.8 16.2 37.4 16.2 50.3 0l488.4-618.9c4.1-5.1.4-12.8-6.3-12.8z"}}]},name:"check",theme:"outlined"};var o=e.i(9583),a=r.forwardRef(function(e,a){return r.createElement(o.default,(0,t.default)({},e,{ref:a,icon:n}))});e.s(["default",0,a],121229)},729151,e=>{"use strict";var t=e.i(271645),r=e.i(121229),n=e.i(726289),o=e.i(864517),a=e.i(247153),i=e.i(739295),l=e.i(38953);function s({suffixIcon:e,clearIcon:s,menuItemSelectedIcon:c,removeIcon:u,loading:d,multiple:f,hasFeedback:p,prefixCls:m,showSuffixIcon:h,feedbackIcon:g,showArrow:v,componentName:y}){let b=null!=s?s:t.createElement(n.default,null),w=r=>null!==e||p||v?t.createElement(t.Fragment,null,!1!==h&&r,p&&g):null,$=null;if(void 0!==e)$=w(e);else if(d)$=w(t.createElement(i.default,{spin:!0}));else{let e=`${m}-suffix`;$=({open:r,showSearch:n})=>r&&n?w(t.createElement(l.default,{className:e})):w(t.createElement(a.default,{className:e}))}let C=null;C=void 0!==c?c:f?t.createElement(r.default,null):null;return{clearIcon:b,suffixIcon:$,itemIcon:C,removeIcon:void 0!==u?u:t.createElement(o.default,null)}}e.s(["default",()=>s])},327494,e=>{"use strict";e.i(247167);var t=e.i(271645),r=e.i(343794),n=e.i(123829),o=e.i(955492),a=e.i(869301),i=e.i(529681),l=e.i(122767),s=e.i(613541),c=e.i(805484),u=e.i(52956),d=e.i(242064),f=e.i(721132),p=e.i(937328),m=e.i(321883),h=e.i(517455),g=e.i(62139),v=e.i(792812),y=e.i(249616),b=e.i(104458),w=e.i(85566),$=e.i(950302),C=e.i(729151),E=e.i(617206),S=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var 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 x="SECRET_COMBOBOX_MODE_DO_NOT_USE",j=t.forwardRef((e,o)=>{var a,c,j,O,k,T,F,_;let I,{prefixCls:P,bordered:N,className:R,rootClassName:M,getPopupContainer:B,popupClassName:A,dropdownClassName:z,listHeight:L=256,placement:H,listItemHeight:D,size:V,disabled:W,notFoundContent:G,status:U,builtinPlacements:q,dropdownMatchSelectWidth:J,popupMatchSelectWidth:K,direction:X,style:Y,allowClear:Z,variant:Q,dropdownStyle:ee,transitionName:et,tagRender:er,maxCount:en,prefix:eo,dropdownRender:ea,popupRender:ei,onDropdownVisibleChange:el,onOpenChange:es,styles:ec,classNames:eu}=e,ed=S(e,["prefixCls","bordered","className","rootClassName","getPopupContainer","popupClassName","dropdownClassName","listHeight","placement","listItemHeight","size","disabled","notFoundContent","status","builtinPlacements","dropdownMatchSelectWidth","popupMatchSelectWidth","direction","style","allowClear","variant","dropdownStyle","transitionName","tagRender","maxCount","prefix","dropdownRender","popupRender","onDropdownVisibleChange","onOpenChange","styles","classNames"]),{getPopupContainer:ef,getPrefixCls:ep,renderEmpty:em,direction:eh,virtual:eg,popupMatchSelectWidth:ev,popupOverflow:ey}=t.useContext(d.ConfigContext),{showSearch:eb,style:ew,styles:e$,className:eC,classNames:eE}=(0,d.useComponentConfig)("select"),[,eS]=(0,b.useToken)(),ex=null!=D?D:null==eS?void 0:eS.controlHeight,ej=ep("select",P),eO=ep(),ek=null!=X?X:eh,{compactSize:eT,compactItemClassnames:eF}=(0,y.useCompactItemContext)(ej,ek),[e_,eI]=(0,v.default)("select",Q,N),eP=(0,m.default)(ej),[eN,eR,eM]=(0,$.default)(ej,eP),eB=t.useMemo(()=>{let{mode:t}=e;if("combobox"!==t)return t===x?"combobox":t},[e.mode]),eA="multiple"===eB||"tags"===eB,ez=(T=e.suffixIcon,void 0!==(F=e.showArrow)?F:null!==T),eL=null!=(a=null!=K?K:J)?a:ev,eH=(null==(c=null==ec?void 0:ec.popup)?void 0:c.root)||(null==(j=e$.popup)?void 0:j.root)||ee,eD=(_=ei||ea,t.default.useMemo(()=>{if(_)return(...e)=>t.default.createElement(E.default,{space:!0},_.apply(void 0,e))},[_])),{status:eV,hasFeedback:eW,isFormItemInput:eG,feedbackIcon:eU}=t.useContext(g.FormItemInputContext),eq=(0,u.getMergedStatus)(eV,U);I=void 0!==G?G:"combobox"===eB?null:(null==em?void 0:em("Select"))||t.createElement(f.default,{componentName:"Select"});let{suffixIcon:eJ,itemIcon:eK,removeIcon:eX,clearIcon:eY}=(0,C.default)(Object.assign(Object.assign({},ed),{multiple:eA,hasFeedback:eW,feedbackIcon:eU,showSuffixIcon:ez,prefixCls:ej,componentName:"Select"})),eZ=(0,i.default)(ed,["suffixIcon","itemIcon"]),eQ=(0,r.default)((null==(O=null==eu?void 0:eu.popup)?void 0:O.root)||(null==(k=null==eE?void 0:eE.popup)?void 0:k.root)||A||z,{[`${ej}-dropdown-${ek}`]:"rtl"===ek},M,eE.root,null==eu?void 0:eu.root,eM,eP,eR),e0=(0,h.default)(e=>{var t;return null!=(t=null!=V?V:eT)?t:e}),e1=t.useContext(p.default),e2=(0,r.default)({[`${ej}-lg`]:"large"===e0,[`${ej}-sm`]:"small"===e0,[`${ej}-rtl`]:"rtl"===ek,[`${ej}-${e_}`]:eI,[`${ej}-in-form-item`]:eG},(0,u.getStatusClassNames)(ej,eq,eW),eF,eC,R,eE.root,null==eu?void 0:eu.root,M,eM,eP,eR),e4=t.useMemo(()=>void 0!==H?H:"rtl"===ek?"bottomRight":"bottomLeft",[H,ek]),[e6]=(0,l.useZIndex)("SelectLike",null==eH?void 0:eH.zIndex);return eN(t.createElement(n.default,Object.assign({ref:o,virtual:eg,showSearch:eb},eZ,{style:Object.assign(Object.assign(Object.assign(Object.assign({},e$.root),null==ec?void 0:ec.root),ew),Y),dropdownMatchSelectWidth:eL,transitionName:(0,s.getTransitionName)(eO,"slide-up",et),builtinPlacements:(0,w.default)(q,ey),listHeight:L,listItemHeight:ex,mode:eB,prefixCls:ej,placement:e4,direction:ek,prefix:eo,suffixIcon:eJ,menuItemSelectedIcon:eK,removeIcon:eX,allowClear:!0===Z?{clearIcon:eY}:Z,notFoundContent:I,className:e2,getPopupContainer:B||ef,dropdownClassName:eQ,disabled:null!=W?W:e1,dropdownStyle:Object.assign(Object.assign({},eH),{zIndex:e6}),maxCount:eA?en:void 0,tagRender:eA?er:void 0,dropdownRender:eD,onDropdownVisibleChange:es||el})))}),O=(0,c.default)(j,"dropdownAlign");j.SECRET_COMBOBOX_MODE_DO_NOT_USE=x,j.Option=a.Option,j.OptGroup=o.OptGroup,j._InternalPanelDoNotUseOrYouWillBeFired=O,e.s(["default",0,j],327494)},199133,e=>{"use strict";var t=e.i(327494);e.s(["Select",()=>t.default])},689074,21243,98801,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:"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 22ZM11 15V17H13V15H11ZM11 7V13H13V7H11Z"}))};e.s(["default",()=>n],689074);let o=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:"M1.18164 12C2.12215 6.87976 6.60812 3 12.0003 3C17.3924 3 21.8784 6.87976 22.8189 12C21.8784 17.1202 17.3924 21 12.0003 21C6.60812 21 2.12215 17.1202 1.18164 12ZM12.0003 17C14.7617 17 17.0003 14.7614 17.0003 12C17.0003 9.23858 14.7617 7 12.0003 7C9.23884 7 7.00026 9.23858 7.00026 12C7.00026 14.7614 9.23884 17 12.0003 17ZM12.0003 15C10.3434 15 9.00026 13.6569 9.00026 12C9.00026 10.3431 10.3434 9 12.0003 9C13.6571 9 15.0003 10.3431 15.0003 12C15.0003 13.6569 13.6571 15 12.0003 15Z"}))};e.s(["default",()=>o],21243);let a=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:"M4.52047 5.93457L1.39366 2.80777L2.80788 1.39355L22.6069 21.1925L21.1927 22.6068L17.8827 19.2968C16.1814 20.3755 14.1638 21.0002 12.0003 21.0002C6.60812 21.0002 2.12215 17.1204 1.18164 12.0002C1.61832 9.62282 2.81932 7.5129 4.52047 5.93457ZM14.7577 16.1718L13.2937 14.7078C12.902 14.8952 12.4634 15.0002 12.0003 15.0002C10.3434 15.0002 9.00026 13.657 9.00026 12.0002C9.00026 11.537 9.10522 11.0984 9.29263 10.7067L7.82866 9.24277C7.30514 10.0332 7.00026 10.9811 7.00026 12.0002C7.00026 14.7616 9.23884 17.0002 12.0003 17.0002C13.0193 17.0002 13.9672 16.6953 14.7577 16.1718ZM7.97446 3.76015C9.22127 3.26959 10.5793 3.00016 12.0003 3.00016C17.3924 3.00016 21.8784 6.87992 22.8189 12.0002C22.5067 13.6998 21.8038 15.2628 20.8068 16.5925L16.947 12.7327C16.9821 12.4936 17.0003 12.249 17.0003 12.0002C17.0003 9.23873 14.7617 7.00016 12.0003 7.00016C11.7514 7.00016 11.5068 7.01833 11.2677 7.05343L7.97446 3.76015Z"}))};e.s(["default",()=>a],98801)},103471,e=>{"use strict";var t=e.i(444755),r=e.i(271645);let n=e=>["string","number"].includes(typeof e)?e:e instanceof Array?e.map(n).join(""):"object"==typeof e&&e?n(e.props.children):void 0;function o(e){let t=new Map;return r.default.Children.map(e,e=>{var r;t.set(e.props.value,null!=(r=n(e))?r:e.props.value)}),t}function a(e,t){return r.default.Children.map(t,t=>{var r;if((null!=(r=n(t))?r:t.props.value).toLowerCase().includes(e.toLowerCase()))return t})}let i=(e,r,n=!1)=>(0,t.tremorTwMerge)(r?"bg-tremor-background-subtle dark:bg-dark-tremor-background-subtle":"bg-tremor-background dark:bg-dark-tremor-background",!r&&"hover:bg-tremor-background-muted dark:hover:bg-dark-tremor-background-muted",e?"text-tremor-content-emphasis dark:text-dark-tremor-content-emphasis":"text-tremor-content dark:text-dark-tremor-content",r&&"text-tremor-content-subtle dark:text-dark-tremor-content-subtle",n&&"text-red-500 placeholder:text-red-500 dark:text-red-500 dark:placeholder:text-red-500",n?"border-red-500 dark:border-red-500":"border-tremor-border dark:border-dark-tremor-border");function l(e){return null!=e&&""!==e}e.s(["constructValueToNameMapping",()=>o,"getFilteredOptions",()=>a,"getNodeText",()=>n,"getSelectButtonColors",()=>i,"hasValue",()=>l])},779241,677955,e=>{"use strict";var t=e.i(290571),r=e.i(271645),n=e.i(673706),o=e.i(689074),a=e.i(21243),i=e.i(98801),l=e.i(103471),s=e.i(444755);let c=r.default.forwardRef((e,c)=>{let{value:u,defaultValue:d,type:f,placeholder:p="Type...",icon:m,error:h=!1,errorMessage:g,disabled:v=!1,stepper:y,makeInputClassName:b,className:w,onChange:$,onValueChange:C,autoFocus:E,pattern:S}=e,x=(0,t.__rest)(e,["value","defaultValue","type","placeholder","icon","error","errorMessage","disabled","stepper","makeInputClassName","className","onChange","onValueChange","autoFocus","pattern"]),[j,O]=(0,r.useState)(E||!1),[k,T]=(0,r.useState)(!1),F=(0,r.useCallback)(()=>T(!k),[k,T]),_=(0,r.useRef)(null),I=(0,l.hasValue)(u||d);return r.default.useEffect(()=>{let e=()=>O(!0),t=()=>O(!1),r=_.current;return r&&(r.addEventListener("focus",e),r.addEventListener("blur",t),E&&r.focus()),()=>{r&&(r.removeEventListener("focus",e),r.removeEventListener("blur",t))}},[E]),r.default.createElement(r.default.Fragment,null,r.default.createElement("div",{className:(0,s.tremorTwMerge)(b("root"),"relative w-full flex items-center min-w-[10rem] outline-none rounded-tremor-default transition duration-100 border","shadow-tremor-input","dark:shadow-dark-tremor-input",(0,l.getSelectButtonColors)(I,v,h),j&&(0,s.tremorTwMerge)("ring-2","border-tremor-brand-subtle ring-tremor-brand-muted","dark:border-dark-tremor-brand-subtle dark:ring-dark-tremor-brand-muted"),w)},m?r.default.createElement(m,{className:(0,s.tremorTwMerge)(b("icon"),"shrink-0 h-5 w-5 mx-2.5 absolute left-0 flex items-center","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")}):null,r.default.createElement("input",Object.assign({ref:(0,n.mergeRefs)([_,c]),defaultValue:d,value:u,type:k?"text":f,className:(0,s.tremorTwMerge)(b("input"),"w-full bg-transparent focus:outline-none focus:ring-0 border-none text-tremor-default rounded-tremor-default transition duration-100 py-2","text-tremor-content-emphasis","dark:text-dark-tremor-content-emphasis","[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none","password"===f?h?"pr-16":"pr-12":h?"pr-8":"pr-3",m?"pl-10":"pl-3",v?"placeholder:text-tremor-content-subtle dark:placeholder:text-dark-tremor-content-subtle":"placeholder:text-tremor-content dark:placeholder:text-dark-tremor-content"),placeholder:p,disabled:v,"data-testid":"base-input",onChange:e=>{null==$||$(e),null==C||C(e.target.value)},pattern:S},x)),"password"!==f||v?null:r.default.createElement("button",{className:(0,s.tremorTwMerge)(b("toggleButton"),"absolute inset-y-0 right-0 flex items-center px-2.5 rounded-lg"),type:"button",onClick:()=>F(),"aria-label":k?"Hide password":"Show Password"},k?r.default.createElement(i.default,{className:(0,s.tremorTwMerge)("flex-none h-5 w-5 transition","text-tremor-content-subtle hover:text-tremor-content","dark:text-dark-tremor-content-subtle hover:dark:text-dark-tremor-content"),"aria-hidden":!0}):r.default.createElement(a.default,{className:(0,s.tremorTwMerge)("flex-none h-5 w-5 transition","text-tremor-content-subtle hover:text-tremor-content","dark:text-dark-tremor-content-subtle hover:dark:text-dark-tremor-content"),"aria-hidden":!0})),h?r.default.createElement(o.default,{className:(0,s.tremorTwMerge)(b("errorIcon"),"text-red-500 shrink-0 h-5 w-5 absolute right-0 flex items-center","password"===f?"mr-10":"number"===f?y?"mr-20":"mr-3":"mx-2.5")}):null,null!=y?y:null),h&&g?r.default.createElement("p",{className:(0,s.tremorTwMerge)(b("errorMessage"),"text-sm text-red-500 mt-1")},g):null)});c.displayName="BaseInput",e.s(["default",()=>c],677955);let u=(0,n.makeClassName)("TextInput"),d=r.default.forwardRef((e,n)=>{let{type:o="text"}=e,a=(0,t.__rest)(e,["type"]);return r.default.createElement(c,Object.assign({ref:n,type:o,makeInputClassName:u},a))});d.displayName="TextInput",e.s(["TextInput",()=>d],779241)},827252,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 372z"}},{tag:"path",attrs:{d:"M464 336a48 48 0 1096 0 48 48 0 10-96 0zm72 112h-48c-4.4 0-8 3.6-8 8v272c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V456c0-4.4-3.6-8-8-8z"}}]},name:"info-circle",theme:"outlined"};var o=e.i(9583),a=r.forwardRef(function(e,a){return r.createElement(o.default,(0,t.default)({},e,{ref:a,icon:n}))});e.s(["InfoCircleOutlined",0,a],827252)},592968,e=>{"use strict";var t=e.i(491816);e.s(["Tooltip",()=>t.default])},122550,e=>{"use strict";function t(e,t){return e.length>t?e.substring(0,t)+"...":e}e.s(["formItemValidateJSON",0,(e,t)=>{if(!t)return Promise.resolve();try{return JSON.parse(t),Promise.resolve()}catch(e){return Promise.reject("Please enter valid JSON")}},"formatLabel",0,e=>e?e.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase()):e,"truncateString",()=>t])},764205,82946,e=>{"use strict";e.s(["addAllowedIP",()=>eP,"adminGlobalActivity",()=>eq,"adminGlobalActivityPerModel",()=>eK,"adminGlobalCacheActivity",()=>eJ,"adminSpendLogsCall",()=>eV,"adminTopEndUsersCall",()=>eG,"adminTopKeysCall",()=>eW,"adminTopModelsCall",()=>eX,"adminspendByProvider",()=>eU,"agentDailyActivityCall",()=>ew,"agentHubPublicModelsCall",()=>eT,"alertingSettingsCall",()=>J,"allEndUsersCall",()=>eL,"allTagNamesCall",()=>ez,"applyGuardrail",()=>nr,"approveGuardrailSubmission",()=>tB,"approveMCPServer",()=>rS,"availableTeamListCall",()=>el,"budgetCreateCall",()=>G,"budgetDeleteCall",()=>W,"budgetUpdateCall",()=>U,"buildMcpOAuthAuthorizeUrl",()=>nh,"cacheTemporaryMcpServer",()=>np,"cachingHealthCheckCall",()=>tk,"callMCPTool",()=>rP,"cancelModelCostMapReload",()=>z,"checkEuAiActCompliance",()=>nM,"checkGdprCompliance",()=>nB,"claimOnboardingToken",()=>eC,"convertPromptFileToJson",()=>rl,"createAgentCall",()=>rs,"createGuardrailCall",()=>rc,"createMCPServer",()=>rb,"createPassThroughEndpoint",()=>tC,"createPolicyAttachmentCall",()=>t3,"createPolicyCall",()=>tY,"createPolicyVersion",()=>t0,"createPromptCall",()=>ro,"createSearchTool",()=>rO,"credentialCreateCall",()=>e3,"credentialDeleteCall",()=>e9,"credentialGetCall",()=>e5,"credentialListCall",()=>e7,"credentialUpdateCall",()=>e8,"customerDailyActivityCall",()=>eb,"deleteAgentCall",()=>rQ,"deleteAllowedIP",()=>eN,"deleteCallback",()=>nd,"deleteClaudeCodePlugin",()=>nR,"deleteConfigFieldSetting",()=>tS,"deleteGuardrailCall",()=>r2,"deleteMCPOAuthUserCredential",()=>nG,"deleteMCPServer",()=>r$,"deletePassThroughEndpointsCall",()=>tx,"deletePolicyAttachmentCall",()=>t7,"deletePolicyCall",()=>t2,"deletePromptCall",()=>ri,"deleteSearchTool",()=>rT,"deleteToolPolicyOverride",()=>nV,"deriveErrorMessage",()=>nx,"disableClaudeCodePlugin",()=>nN,"enableClaudeCodePlugin",()=>nP,"enrichPolicyTemplate",()=>tU,"enrichPolicyTemplateStream",()=>tK,"estimateAttachmentImpactCall",()=>re,"exchangeMcpOAuthToken",()=>ng,"fetchAvailableSearchProviders",()=>rF,"fetchDiscoverableMCPServers",()=>rm,"fetchMCPAccessGroups",()=>rv,"fetchMCPClientIp",()=>ry,"fetchMCPServerHealth",()=>rg,"fetchMCPServers",()=>rh,"fetchMCPSubmissions",()=>rE,"fetchOpenAPIRegistry",()=>rp,"fetchSearchTools",()=>rj,"fetchToolDetail",()=>nH,"fetchToolPolicyOptions",()=>nA,"fetchToolsList",()=>nz,"formatDate",()=>v,"getAgentCreateMetadata",()=>k,"getAgentInfo",()=>r9,"getAgentsList",()=>r5,"getAllowedIPs",()=>eI,"getBudgetList",()=>tp,"getCacheSettingsCall",()=>tv,"getCallbackConfigsCall",()=>y,"getCallbacksCall",()=>tm,"getCategoryYaml",()=>r3,"getClaudeCodeMarketplace",()=>nT,"getClaudeCodePluginDetails",()=>n_,"getClaudeCodePluginsList",()=>nF,"getConfigFieldSetting",()=>t$,"getDefaultTeamSettings",()=>rz,"getEmailEventSettings",()=>rX,"getGeneralSettingsCall",()=>th,"getGlobalLitellmHeaderName",()=>_,"getGuardrailInfo",()=>r8,"getGuardrailProviderSpecificParams",()=>r6,"getGuardrailUISettings",()=>r4,"getGuardrailsList",()=>tR,"getGuardrailsUsageDetail",()=>tL,"getGuardrailsUsageLogs",()=>tH,"getGuardrailsUsageOverview",()=>tz,"getInProductNudgesCall",()=>b,"getInternalUserSettings",()=>rd,"getLicenseInfo",()=>nc,"getMCPOAuthUserCredentialStatus",()=>nU,"getMCPSemanticFilterSettings",()=>tI,"getMajorAirlines",()=>r7,"getModelCostMapReloadStatus",()=>H,"getModelCostMapSource",()=>L,"getOnboardingCredentials",()=>e$,"getOpenAPISchema",()=>R,"getPassThroughEndpointsCall",()=>tw,"getPoliciesList",()=>tD,"getPolicyAttachmentsList",()=>t6,"getPolicyInfo",()=>t4,"getPolicyInfoWithGuardrails",()=>tW,"getPolicyTemplates",()=>tG,"getPossibleUserRoles",()=>e4,"getPromptInfo",()=>rr,"getPromptVersions",()=>rn,"getPromptsList",()=>rt,"getProviderCreateMetadata",()=>O,"getProxyBaseUrl",()=>C,"getProxyUISettings",()=>tF,"getPublicModelHubInfo",()=>N,"getRemainingUsers",()=>ns,"getResolvedGuardrails",()=>t9,"getRouterSettingsCall",()=>tg,"getSSOSettings",()=>na,"getTeamPermissionsCall",()=>rH,"getToolUsageLogs",()=>nL,"getUISettings",()=>t_,"getUiConfig",()=>P,"getUiSettings",()=>nO,"handleError",()=>j,"individualModelHealthCheckCall",()=>tO,"invitationCreateCall",()=>q,"keyAliasesCall",()=>e1,"keyCreateCall",()=>X,"keyCreateForAgentCall",()=>Y,"keyCreateServiceAccountCall",()=>K,"keyDeleteCall",()=>Q,"keyInfoCall",()=>eY,"keyInfoV1Call",()=>eQ,"keyListCall",()=>e0,"keyUpdateCall",()=>te,"latestHealthChecksCall",()=>tT,"listGuardrailSubmissions",()=>tM,"listMCPTools",()=>rI,"listMCPUserCredentials",()=>nq,"listPolicyVersions",()=>tQ,"loginCall",()=>nj,"makeAgentsPublicCall",()=>r0,"makeMCPPublicCall",()=>r1,"makeModelGroupPublic",()=>I,"mcpHubPublicServersCall",()=>eF,"modelAvailableCall",()=>eM,"modelCostMap",()=>M,"modelCreateCall",()=>D,"modelDeleteCall",()=>V,"modelHubCall",()=>e_,"modelHubPublicModelsCall",()=>ek,"modelInfoCall",()=>ej,"modelInfoV1Call",()=>eO,"modelPatchUpdateCall",()=>tr,"organizationCreateCall",()=>eu,"organizationDailyActivityCall",()=>ey,"organizationDeleteCall",()=>ef,"organizationInfoCall",()=>ec,"organizationListCall",()=>es,"organizationMemberAddCall",()=>tl,"organizationMemberDeleteCall",()=>ts,"organizationMemberUpdateCall",()=>tc,"organizationUpdateCall",()=>ed,"patchAgentCall",()=>ne,"perUserAnalyticsCall",()=>nS,"proxyBaseUrl",()=>$,"ragIngestCall",()=>rK,"regenerateKeyCall",()=>eE,"registerClaudeCodePlugin",()=>nI,"registerMCPServer",()=>rC,"registerMcpOAuthClient",()=>nm,"rejectGuardrailSubmission",()=>tA,"rejectMCPServer",()=>rx,"reloadModelCostMap",()=>B,"resetEmailEventSettings",()=>rZ,"resolvePoliciesCall",()=>t8,"scheduleModelCostMapReload",()=>A,"searchToolQueryCall",()=>ny,"serverRootPath",()=>w,"serviceHealthCheck",()=>tf,"sessionSpendLogsCall",()=>rV,"setCallbacksCall",()=>tj,"setGlobalLitellmHeaderName",()=>F,"storeMCPOAuthUserCredential",()=>nW,"suggestPolicyTemplates",()=>tq,"tagCreateCall",()=>rN,"tagDailyActivityCall",()=>eg,"tagDauCall",()=>nb,"tagDeleteCall",()=>rA,"tagDistinctCall",()=>nC,"tagInfoCall",()=>rM,"tagListCall",()=>rB,"tagMauCall",()=>n$,"tagUpdateCall",()=>rR,"tagWauCall",()=>nw,"tagsSpendLogsCall",()=>eA,"teamBulkMemberAddCall",()=>to,"teamCreateCall",()=>e6,"teamDailyActivityCall",()=>ev,"teamDeleteCall",()=>et,"teamInfoCall",()=>eo,"teamListCall",()=>ei,"teamMemberAddCall",()=>tn,"teamMemberDeleteCall",()=>ti,"teamMemberUpdateCall",()=>ta,"teamPermissionsUpdateCall",()=>rD,"teamSpendLogsCall",()=>eB,"teamUpdateCall",()=>tt,"testCacheConnectionCall",()=>ty,"testConnectionRequest",()=>eZ,"testCustomCodeGuardrail",()=>nn,"testMCPSemanticFilter",()=>tN,"testMCPToolsListRequest",()=>nf,"testPipelineCall",()=>t5,"testPoliciesAndGuardrails",()=>tV,"testPolicyTemplate",()=>tJ,"testSearchToolConnection",()=>r_,"transformRequestCall",()=>ep,"uiAuditLogsCall",()=>nl,"uiSpendLogDetailsCall",()=>ru,"uiSpendLogsCall",()=>eD,"updateCacheSettingsCall",()=>tb,"updateConfigFieldSetting",()=>tE,"updateDefaultTeamSettings",()=>rL,"updateEmailEventSettings",()=>rY,"updateGuardrailCall",()=>nt,"updateInternalUserSettings",()=>rf,"updateMCPSemanticFilterSettings",()=>tP,"updateMCPServer",()=>rw,"updatePassThroughEndpoint",()=>nu,"updatePolicyCall",()=>tZ,"updatePolicyVersionStatus",()=>t1,"updatePromptCall",()=>ra,"updateSSOSettings",()=>ni,"updateSearchTool",()=>rk,"updateToolPolicy",()=>nD,"updateUiSettings",()=>nk,"updateUsefulLinksCall",()=>eR,"usageAiChatStream",()=>tX,"userAgentSummaryCall",()=>nE,"userBulkUpdateUserCall",()=>td,"userCreateCall",()=>Z,"userDailyActivityAggregatedCall",()=>e2,"userDailyActivityCall",()=>eh,"userDeleteCall",()=>ee,"userFilterUICall",()=>eH,"userInfoCall",()=>en,"userListCall",()=>er,"userUpdateUserCall",()=>tu,"v2TeamListCall",()=>ea,"validateBlockedWordsFile",()=>no,"vectorStoreCreateCall",()=>rW,"vectorStoreDeleteCall",()=>rU,"vectorStoreInfoCall",()=>rq,"vectorStoreListCall",()=>rG,"vectorStoreSearchCall",()=>nv,"vectorStoreUpdateCall",()=>rJ],764205),e.i(247167);var t=e.i(998573),r=e.i(268004);e.s(["default",()=>h,"jsonFields",()=>p],82946);var n=e.i(843476),o=e.i(271645),a=e.i(808613),i=e.i(311451),l=e.i(28651),s=e.i(199133),c=e.i(779241),u=e.i(827252),d=e.i(592968),f=e.i(122550);let p=["metadata","config","enforced_params","aliases"],m=(e,t)=>p.includes(e)||"json"===t.format,h=({schemaComponent:e,excludedFields:t=[],form:r,overrideLabels:p={},overrideTooltips:h={},customValidation:g={},defaultValues:v={}})=>{let[y,b]=(0,o.useState)(null),[w,$]=(0,o.useState)(null);return((0,o.useEffect)(()=>{(async()=>{try{let n=(await R()).components.schemas[e];if(!n)throw Error(`Schema component "${e}" not found`);b(n);let o={};Object.keys(n.properties).filter(e=>!t.includes(e)&&void 0!==v[e]).forEach(e=>{o[e]=v[e]}),r.setFieldsValue(o)}catch(e){console.error("Schema fetch error:",e),$(e instanceof Error?e.message:"Failed to fetch schema")}})()},[e,r,t]),w)?(0,n.jsxs)("div",{className:"text-red-500",children:["Error: ",w]}):y?.properties?(0,n.jsx)("div",{children:Object.entries(y.properties).filter(([e])=>!t.includes(e)).map(([e,t])=>{let r,o,b,w,$,C,E,S;return o=(e=>{if(e.type)return e.type;if(e.anyOf){let t=e.anyOf.map(e=>e.type);if(t.includes("number")||t.includes("integer"))return"number";t.includes("string")}return"string"})(t),b=y?.required?.includes(e),w=p[e]||t.title||(0,f.formatLabel)(e),$=h[e]||t.description,C=[],b&&C.push({required:!0,message:`${w} is required`}),g[e]&&C.push({validator:g[e]}),m(e,t)&&C.push({validator:async(e,t)=>{if(t&&!(e=>{if(!e)return!0;try{return JSON.parse(e),!0}catch{return!1}})(t))throw Error("Please enter valid JSON")}}),E=$?(0,n.jsxs)("span",{children:[w," ",(0,n.jsx)(d.Tooltip,{title:$,children:(0,n.jsx)(u.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}):w,r=m(e,t)?(0,n.jsx)(i.Input.TextArea,{rows:4,placeholder:"Enter as JSON",className:"font-mono"}):t.enum?(0,n.jsx)(s.Select,{children:t.enum.map(e=>(0,n.jsx)(s.Select.Option,{value:e,children:e},e))}):"number"===o||"integer"===o?(0,n.jsx)(l.InputNumber,{style:{width:"100%"},precision:"integer"===o?0:void 0}):"duration"===e?(0,n.jsx)(c.TextInput,{placeholder:"eg: 30s, 30h, 30d"}):(0,n.jsx)(c.TextInput,{placeholder:$||""}),(0,n.jsx)(a.Form.Item,{label:E,name:e,className:"mt-8",rules:C,initialValue:v[e],help:(0,n.jsx)("div",{className:"text-xs text-gray-500",children:(S=({max_budget:"Enter maximum budget in USD (e.g., 100.50)",budget_duration:"Select a time period for budget reset",tpm_limit:"Enter maximum tokens per minute (whole number)",rpm_limit:"Enter maximum requests per minute (whole number)",duration:"Enter duration (e.g., 30s, 24h, 7d)",metadata:'Enter JSON object with key-value pairs\nExample: {"team": "research", "project": "nlp"}',config:'Enter configuration as JSON object\nExample: {"setting": "value"}',permissions:"Enter comma-separated permission strings",enforced_params:'Enter parameters as JSON object\nExample: {"param": "value"}',blocked:"Enter true/false or specific block conditions",aliases:'Enter aliases as JSON object\nExample: {"alias1": "value1", "alias2": "value2"}',models:"Select one or more model names",key_alias:"Enter a unique identifier for this key",tags:"Enter comma-separated tag strings"})[e]||({string:"Text input",number:"Numeric input",integer:"Whole number input",boolean:"True/False value"})[o]||"Text input",m(e,t)?`${S} + `]:{animationName:i.slideDownOut},"&-hidden":{display:"none"},[o]:Object.assign(Object.assign({},l(e)),{cursor:"pointer",transition:`background ${e.motionDurationSlow} ease`,borderRadius:e.borderRadiusSM,"&-group":{color:e.colorTextDescription,fontSize:e.fontSizeSM,cursor:"default"},"&-option":{display:"flex","&-content":Object.assign({flex:"auto"},t.textEllipsis),"&-state":{flex:"none",display:"flex",alignItems:"center"},[`&-active:not(${o}-option-disabled)`]:{backgroundColor:e.optionActiveBg},[`&-selected:not(${o}-option-disabled)`]:{color:e.optionSelectedColor,fontWeight:e.optionSelectedFontWeight,backgroundColor:e.optionSelectedBg,[`${o}-option-state`]:{color:e.colorPrimary}},"&-disabled":{[`&${o}-option-selected`]:{backgroundColor:e.colorBgContainerDisabled},color:e.colorTextDisabled,cursor:"not-allowed"},"&-grouped":{paddingInlineStart:e.calc(e.controlPaddingHorizontal).mul(2).equal()}},"&-empty":Object.assign(Object.assign({},l(e)),{color:e.colorTextDisabled})}),[`${f}:has(+ ${f})`]:{borderEndStartRadius:0,borderEndEndRadius:0,[`& + ${f}`]:{borderStartStartRadius:0,borderStartEndRadius:0}},"&-rtl":{direction:"rtl"}})},(0,i.initSlideMotion)(e,"slide-up"),(0,i.initSlideMotion)(e,"slide-down"),(0,a.initMoveMotion)(e,"move-up"),(0,a.initMoveMotion)(e,"move-down")]})(e),{[`${n}-rtl`]:{direction:"rtl"}},(0,r.genCompactItemStyle)(e,{borderElCls:`${n}-selector`,focusElCls:`${n}-focused`})]})(v),{[v.componentCls]:Object.assign(Object.assign(Object.assign(Object.assign({},{"&-outlined":Object.assign(Object.assign(Object.assign(Object.assign({},d(v,{borderColor:v.colorBorder,hoverBorderHover:v.hoverBorderColor,activeBorderColor:v.activeBorderColor,activeOutlineColor:v.activeOutlineColor,color:v.colorText})),f(v,{status:"error",borderColor:v.colorError,hoverBorderHover:v.colorErrorHover,activeBorderColor:v.colorError,activeOutlineColor:v.colorErrorOutline,color:v.colorError})),f(v,{status:"warning",borderColor:v.colorWarning,hoverBorderHover:v.colorWarningHover,activeBorderColor:v.colorWarning,activeOutlineColor:v.colorWarningOutline,color:v.colorWarning})),{[`&${v.componentCls}-disabled`]:{[`&:not(${v.componentCls}-customize-input) ${v.componentCls}-selector`]:{background:v.colorBgContainerDisabled,color:v.colorTextDisabled}},[`&${v.componentCls}-multiple ${v.componentCls}-selection-item`]:{background:v.multipleItemBg,border:`${(0,s.unit)(v.lineWidth)} ${v.lineType} ${v.multipleItemBorderColor}`}})}),{"&-filled":Object.assign(Object.assign(Object.assign(Object.assign({},p(v,{bg:v.colorFillTertiary,hoverBg:v.colorFillSecondary,activeBorderColor:v.activeBorderColor,color:v.colorText})),m(v,{status:"error",bg:v.colorErrorBg,hoverBg:v.colorErrorBgHover,activeBorderColor:v.colorError,color:v.colorError})),m(v,{status:"warning",bg:v.colorWarningBg,hoverBg:v.colorWarningBgHover,activeBorderColor:v.colorWarning,color:v.colorWarning})),{[`&${v.componentCls}-disabled`]:{[`&:not(${v.componentCls}-customize-input) ${v.componentCls}-selector`]:{borderColor:v.colorBorder,background:v.colorBgContainerDisabled,color:v.colorTextDisabled}},[`&${v.componentCls}-multiple ${v.componentCls}-selection-item`]:{background:v.colorBgContainer,border:`${(0,s.unit)(v.lineWidth)} ${v.lineType} ${v.colorSplit}`}})}),{"&-borderless":{[`${v.componentCls}-selector`]:{background:"transparent",border:`${(0,s.unit)(v.lineWidth)} ${v.lineType} transparent`},[`&${v.componentCls}-disabled`]:{[`&:not(${v.componentCls}-customize-input) ${v.componentCls}-selector`]:{color:v.colorTextDisabled}},[`&${v.componentCls}-multiple ${v.componentCls}-selection-item`]:{background:v.multipleItemBg,border:`${(0,s.unit)(v.lineWidth)} ${v.lineType} ${v.multipleItemBorderColor}`},[`&${v.componentCls}-status-error`]:{[`${v.componentCls}-prefix, ${v.componentCls}-selection-item`]:{color:v.colorError}},[`&${v.componentCls}-status-warning`]:{[`${v.componentCls}-prefix, ${v.componentCls}-selection-item`]:{color:v.colorWarning}}}}),{"&-underlined":Object.assign(Object.assign(Object.assign(Object.assign({},h(v,{borderColor:v.colorBorder,hoverBorderHover:v.hoverBorderColor,activeBorderColor:v.activeBorderColor,activeOutlineColor:v.activeOutlineColor,color:v.colorText})),g(v,{status:"error",borderColor:v.colorError,hoverBorderHover:v.colorErrorHover,activeBorderColor:v.colorError,activeOutlineColor:v.colorErrorOutline,color:v.colorError})),g(v,{status:"warning",borderColor:v.colorWarning,hoverBorderHover:v.colorWarningHover,activeBorderColor:v.colorWarning,activeOutlineColor:v.colorWarningOutline,color:v.colorWarning})),{[`&${v.componentCls}-disabled`]:{[`&:not(${v.componentCls}-customize-input) ${v.componentCls}-selector`]:{color:v.colorTextDisabled}},[`&${v.componentCls}-multiple ${v.componentCls}-selection-item`]:{background:v.multipleItemBg,border:`${(0,s.unit)(v.lineWidth)} ${v.lineType} ${v.multipleItemBorderColor}`}})})}]},e=>{let{fontSize:t,lineHeight:r,lineWidth:n,controlHeight:o,controlHeightSM:a,controlHeightLG:i,paddingXXS:l,controlPaddingHorizontal:s,zIndexPopupBase:c,colorText:u,fontWeightStrong:d,controlItemBgActive:f,controlItemBgHover:p,colorBgContainer:m,colorFillSecondary:h,colorBgContainerDisabled:g,colorTextDisabled:v,colorPrimaryHover:y,colorPrimary:b,controlOutline:w}=e,$=2*l,C=2*n,E=Math.min(o-$,o-C),S=Math.min(a-$,a-C),x=Math.min(i-$,i-C);return{INTERNAL_FIXED_ITEM_MARGIN:Math.floor(l/2),zIndexPopup:c+50,optionSelectedColor:u,optionSelectedFontWeight:d,optionSelectedBg:f,optionActiveBg:p,optionPadding:`${(o-t*r)/2}px ${s}px`,optionFontSize:t,optionLineHeight:r,optionHeight:o,selectorBg:m,clearBg:m,singleItemHeightLG:i,multipleItemBg:h,multipleItemBorderColor:"transparent",multipleItemHeight:E,multipleItemHeightSM:S,multipleItemHeightLG:x,multipleSelectorBgDisabled:g,multipleItemColorDisabled:v,multipleItemBorderColorDisabled:"transparent",showArrowPaddingInlineEnd:Math.ceil(1.25*e.fontSize),hoverBorderColor:y,activeBorderColor:b,activeOutlineColor:w,selectAffixPadding:l}},{unitless:{optionLineHeight:!0,optionSelectedFontWeight:!0}});e.s(["default",0,v],950302)},121229,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:"M912 190h-69.9c-9.8 0-19.1 4.5-25.1 12.2L404.7 724.5 207 474a32 32 0 00-25.1-12.2H112c-6.7 0-10.4 7.7-6.3 12.9l273.9 347c12.8 16.2 37.4 16.2 50.3 0l488.4-618.9c4.1-5.1.4-12.8-6.3-12.8z"}}]},name:"check",theme:"outlined"};var o=e.i(9583),a=r.forwardRef(function(e,a){return r.createElement(o.default,(0,t.default)({},e,{ref:a,icon:n}))});e.s(["default",0,a],121229)},729151,e=>{"use strict";var t=e.i(271645),r=e.i(121229),n=e.i(726289),o=e.i(864517),a=e.i(247153),i=e.i(739295),l=e.i(38953);function s({suffixIcon:e,clearIcon:s,menuItemSelectedIcon:c,removeIcon:u,loading:d,multiple:f,hasFeedback:p,prefixCls:m,showSuffixIcon:h,feedbackIcon:g,showArrow:v,componentName:y}){let b=null!=s?s:t.createElement(n.default,null),w=r=>null!==e||p||v?t.createElement(t.Fragment,null,!1!==h&&r,p&&g):null,$=null;if(void 0!==e)$=w(e);else if(d)$=w(t.createElement(i.default,{spin:!0}));else{let e=`${m}-suffix`;$=({open:r,showSearch:n})=>r&&n?w(t.createElement(l.default,{className:e})):w(t.createElement(a.default,{className:e}))}let C=null;C=void 0!==c?c:f?t.createElement(r.default,null):null;return{clearIcon:b,suffixIcon:$,itemIcon:C,removeIcon:void 0!==u?u:t.createElement(o.default,null)}}e.s(["default",()=>s])},327494,e=>{"use strict";e.i(247167);var t=e.i(271645),r=e.i(343794),n=e.i(123829),o=e.i(955492),a=e.i(869301),i=e.i(529681),l=e.i(122767),s=e.i(613541),c=e.i(805484),u=e.i(52956),d=e.i(242064),f=e.i(721132),p=e.i(937328),m=e.i(321883),h=e.i(517455),g=e.i(62139),v=e.i(792812),y=e.i(249616),b=e.i(104458),w=e.i(85566),$=e.i(950302),C=e.i(729151),E=e.i(617206),S=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var 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 x="SECRET_COMBOBOX_MODE_DO_NOT_USE",j=t.forwardRef((e,o)=>{var a,c,j,O,k,T,F,_;let I,{prefixCls:P,bordered:N,className:R,rootClassName:M,getPopupContainer:B,popupClassName:A,dropdownClassName:z,listHeight:L=256,placement:H,listItemHeight:D,size:V,disabled:W,notFoundContent:G,status:U,builtinPlacements:q,dropdownMatchSelectWidth:J,popupMatchSelectWidth:K,direction:X,style:Y,allowClear:Z,variant:Q,dropdownStyle:ee,transitionName:et,tagRender:er,maxCount:en,prefix:eo,dropdownRender:ea,popupRender:ei,onDropdownVisibleChange:el,onOpenChange:es,styles:ec,classNames:eu}=e,ed=S(e,["prefixCls","bordered","className","rootClassName","getPopupContainer","popupClassName","dropdownClassName","listHeight","placement","listItemHeight","size","disabled","notFoundContent","status","builtinPlacements","dropdownMatchSelectWidth","popupMatchSelectWidth","direction","style","allowClear","variant","dropdownStyle","transitionName","tagRender","maxCount","prefix","dropdownRender","popupRender","onDropdownVisibleChange","onOpenChange","styles","classNames"]),{getPopupContainer:ef,getPrefixCls:ep,renderEmpty:em,direction:eh,virtual:eg,popupMatchSelectWidth:ev,popupOverflow:ey}=t.useContext(d.ConfigContext),{showSearch:eb,style:ew,styles:e$,className:eC,classNames:eE}=(0,d.useComponentConfig)("select"),[,eS]=(0,b.useToken)(),ex=null!=D?D:null==eS?void 0:eS.controlHeight,ej=ep("select",P),eO=ep(),ek=null!=X?X:eh,{compactSize:eT,compactItemClassnames:eF}=(0,y.useCompactItemContext)(ej,ek),[e_,eI]=(0,v.default)("select",Q,N),eP=(0,m.default)(ej),[eN,eR,eM]=(0,$.default)(ej,eP),eB=t.useMemo(()=>{let{mode:t}=e;if("combobox"!==t)return t===x?"combobox":t},[e.mode]),eA="multiple"===eB||"tags"===eB,ez=(T=e.suffixIcon,void 0!==(F=e.showArrow)?F:null!==T),eL=null!=(a=null!=K?K:J)?a:ev,eH=(null==(c=null==ec?void 0:ec.popup)?void 0:c.root)||(null==(j=e$.popup)?void 0:j.root)||ee,eD=(_=ei||ea,t.default.useMemo(()=>{if(_)return(...e)=>t.default.createElement(E.default,{space:!0},_.apply(void 0,e))},[_])),{status:eV,hasFeedback:eW,isFormItemInput:eG,feedbackIcon:eU}=t.useContext(g.FormItemInputContext),eq=(0,u.getMergedStatus)(eV,U);I=void 0!==G?G:"combobox"===eB?null:(null==em?void 0:em("Select"))||t.createElement(f.default,{componentName:"Select"});let{suffixIcon:eJ,itemIcon:eK,removeIcon:eX,clearIcon:eY}=(0,C.default)(Object.assign(Object.assign({},ed),{multiple:eA,hasFeedback:eW,feedbackIcon:eU,showSuffixIcon:ez,prefixCls:ej,componentName:"Select"})),eZ=(0,i.default)(ed,["suffixIcon","itemIcon"]),eQ=(0,r.default)((null==(O=null==eu?void 0:eu.popup)?void 0:O.root)||(null==(k=null==eE?void 0:eE.popup)?void 0:k.root)||A||z,{[`${ej}-dropdown-${ek}`]:"rtl"===ek},M,eE.root,null==eu?void 0:eu.root,eM,eP,eR),e0=(0,h.default)(e=>{var t;return null!=(t=null!=V?V:eT)?t:e}),e1=t.useContext(p.default),e2=(0,r.default)({[`${ej}-lg`]:"large"===e0,[`${ej}-sm`]:"small"===e0,[`${ej}-rtl`]:"rtl"===ek,[`${ej}-${e_}`]:eI,[`${ej}-in-form-item`]:eG},(0,u.getStatusClassNames)(ej,eq,eW),eF,eC,R,eE.root,null==eu?void 0:eu.root,M,eM,eP,eR),e4=t.useMemo(()=>void 0!==H?H:"rtl"===ek?"bottomRight":"bottomLeft",[H,ek]),[e6]=(0,l.useZIndex)("SelectLike",null==eH?void 0:eH.zIndex);return eN(t.createElement(n.default,Object.assign({ref:o,virtual:eg,showSearch:eb},eZ,{style:Object.assign(Object.assign(Object.assign(Object.assign({},e$.root),null==ec?void 0:ec.root),ew),Y),dropdownMatchSelectWidth:eL,transitionName:(0,s.getTransitionName)(eO,"slide-up",et),builtinPlacements:(0,w.default)(q,ey),listHeight:L,listItemHeight:ex,mode:eB,prefixCls:ej,placement:e4,direction:ek,prefix:eo,suffixIcon:eJ,menuItemSelectedIcon:eK,removeIcon:eX,allowClear:!0===Z?{clearIcon:eY}:Z,notFoundContent:I,className:e2,getPopupContainer:B||ef,dropdownClassName:eQ,disabled:null!=W?W:e1,dropdownStyle:Object.assign(Object.assign({},eH),{zIndex:e6}),maxCount:eA?en:void 0,tagRender:eA?er:void 0,dropdownRender:eD,onDropdownVisibleChange:es||el})))}),O=(0,c.default)(j,"dropdownAlign");j.SECRET_COMBOBOX_MODE_DO_NOT_USE=x,j.Option=a.Option,j.OptGroup=o.OptGroup,j._InternalPanelDoNotUseOrYouWillBeFired=O,e.s(["default",0,j],327494)},199133,e=>{"use strict";var t=e.i(327494);e.s(["Select",()=>t.default])},689074,21243,98801,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:"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 22ZM11 15V17H13V15H11ZM11 7V13H13V7H11Z"}))};e.s(["default",()=>n],689074);let o=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:"M1.18164 12C2.12215 6.87976 6.60812 3 12.0003 3C17.3924 3 21.8784 6.87976 22.8189 12C21.8784 17.1202 17.3924 21 12.0003 21C6.60812 21 2.12215 17.1202 1.18164 12ZM12.0003 17C14.7617 17 17.0003 14.7614 17.0003 12C17.0003 9.23858 14.7617 7 12.0003 7C9.23884 7 7.00026 9.23858 7.00026 12C7.00026 14.7614 9.23884 17 12.0003 17ZM12.0003 15C10.3434 15 9.00026 13.6569 9.00026 12C9.00026 10.3431 10.3434 9 12.0003 9C13.6571 9 15.0003 10.3431 15.0003 12C15.0003 13.6569 13.6571 15 12.0003 15Z"}))};e.s(["default",()=>o],21243);let a=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:"M4.52047 5.93457L1.39366 2.80777L2.80788 1.39355L22.6069 21.1925L21.1927 22.6068L17.8827 19.2968C16.1814 20.3755 14.1638 21.0002 12.0003 21.0002C6.60812 21.0002 2.12215 17.1204 1.18164 12.0002C1.61832 9.62282 2.81932 7.5129 4.52047 5.93457ZM14.7577 16.1718L13.2937 14.7078C12.902 14.8952 12.4634 15.0002 12.0003 15.0002C10.3434 15.0002 9.00026 13.657 9.00026 12.0002C9.00026 11.537 9.10522 11.0984 9.29263 10.7067L7.82866 9.24277C7.30514 10.0332 7.00026 10.9811 7.00026 12.0002C7.00026 14.7616 9.23884 17.0002 12.0003 17.0002C13.0193 17.0002 13.9672 16.6953 14.7577 16.1718ZM7.97446 3.76015C9.22127 3.26959 10.5793 3.00016 12.0003 3.00016C17.3924 3.00016 21.8784 6.87992 22.8189 12.0002C22.5067 13.6998 21.8038 15.2628 20.8068 16.5925L16.947 12.7327C16.9821 12.4936 17.0003 12.249 17.0003 12.0002C17.0003 9.23873 14.7617 7.00016 12.0003 7.00016C11.7514 7.00016 11.5068 7.01833 11.2677 7.05343L7.97446 3.76015Z"}))};e.s(["default",()=>a],98801)},103471,e=>{"use strict";var t=e.i(444755),r=e.i(271645);let n=e=>["string","number"].includes(typeof e)?e:e instanceof Array?e.map(n).join(""):"object"==typeof e&&e?n(e.props.children):void 0;function o(e){let t=new Map;return r.default.Children.map(e,e=>{var r;t.set(e.props.value,null!=(r=n(e))?r:e.props.value)}),t}function a(e,t){return r.default.Children.map(t,t=>{var r;if((null!=(r=n(t))?r:t.props.value).toLowerCase().includes(e.toLowerCase()))return t})}let i=(e,r,n=!1)=>(0,t.tremorTwMerge)(r?"bg-tremor-background-subtle dark:bg-dark-tremor-background-subtle":"bg-tremor-background dark:bg-dark-tremor-background",!r&&"hover:bg-tremor-background-muted dark:hover:bg-dark-tremor-background-muted",e?"text-tremor-content-emphasis dark:text-dark-tremor-content-emphasis":"text-tremor-content dark:text-dark-tremor-content",r&&"text-tremor-content-subtle dark:text-dark-tremor-content-subtle",n&&"text-red-500 placeholder:text-red-500 dark:text-red-500 dark:placeholder:text-red-500",n?"border-red-500 dark:border-red-500":"border-tremor-border dark:border-dark-tremor-border");function l(e){return null!=e&&""!==e}e.s(["constructValueToNameMapping",()=>o,"getFilteredOptions",()=>a,"getNodeText",()=>n,"getSelectButtonColors",()=>i,"hasValue",()=>l])},779241,677955,e=>{"use strict";var t=e.i(290571),r=e.i(271645),n=e.i(673706),o=e.i(689074),a=e.i(21243),i=e.i(98801),l=e.i(103471),s=e.i(444755);let c=r.default.forwardRef((e,c)=>{let{value:u,defaultValue:d,type:f,placeholder:p="Type...",icon:m,error:h=!1,errorMessage:g,disabled:v=!1,stepper:y,makeInputClassName:b,className:w,onChange:$,onValueChange:C,autoFocus:E,pattern:S}=e,x=(0,t.__rest)(e,["value","defaultValue","type","placeholder","icon","error","errorMessage","disabled","stepper","makeInputClassName","className","onChange","onValueChange","autoFocus","pattern"]),[j,O]=(0,r.useState)(E||!1),[k,T]=(0,r.useState)(!1),F=(0,r.useCallback)(()=>T(!k),[k,T]),_=(0,r.useRef)(null),I=(0,l.hasValue)(u||d);return r.default.useEffect(()=>{let e=()=>O(!0),t=()=>O(!1),r=_.current;return r&&(r.addEventListener("focus",e),r.addEventListener("blur",t),E&&r.focus()),()=>{r&&(r.removeEventListener("focus",e),r.removeEventListener("blur",t))}},[E]),r.default.createElement(r.default.Fragment,null,r.default.createElement("div",{className:(0,s.tremorTwMerge)(b("root"),"relative w-full flex items-center min-w-[10rem] outline-none rounded-tremor-default transition duration-100 border","shadow-tremor-input","dark:shadow-dark-tremor-input",(0,l.getSelectButtonColors)(I,v,h),j&&(0,s.tremorTwMerge)("ring-2","border-tremor-brand-subtle ring-tremor-brand-muted","dark:border-dark-tremor-brand-subtle dark:ring-dark-tremor-brand-muted"),w)},m?r.default.createElement(m,{className:(0,s.tremorTwMerge)(b("icon"),"shrink-0 h-5 w-5 mx-2.5 absolute left-0 flex items-center","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")}):null,r.default.createElement("input",Object.assign({ref:(0,n.mergeRefs)([_,c]),defaultValue:d,value:u,type:k?"text":f,className:(0,s.tremorTwMerge)(b("input"),"w-full bg-transparent focus:outline-none focus:ring-0 border-none text-tremor-default rounded-tremor-default transition duration-100 py-2","text-tremor-content-emphasis","dark:text-dark-tremor-content-emphasis","[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none","password"===f?h?"pr-16":"pr-12":h?"pr-8":"pr-3",m?"pl-10":"pl-3",v?"placeholder:text-tremor-content-subtle dark:placeholder:text-dark-tremor-content-subtle":"placeholder:text-tremor-content dark:placeholder:text-dark-tremor-content"),placeholder:p,disabled:v,"data-testid":"base-input",onChange:e=>{null==$||$(e),null==C||C(e.target.value)},pattern:S},x)),"password"!==f||v?null:r.default.createElement("button",{className:(0,s.tremorTwMerge)(b("toggleButton"),"absolute inset-y-0 right-0 flex items-center px-2.5 rounded-lg"),type:"button",onClick:()=>F(),"aria-label":k?"Hide password":"Show Password"},k?r.default.createElement(i.default,{className:(0,s.tremorTwMerge)("flex-none h-5 w-5 transition","text-tremor-content-subtle hover:text-tremor-content","dark:text-dark-tremor-content-subtle hover:dark:text-dark-tremor-content"),"aria-hidden":!0}):r.default.createElement(a.default,{className:(0,s.tremorTwMerge)("flex-none h-5 w-5 transition","text-tremor-content-subtle hover:text-tremor-content","dark:text-dark-tremor-content-subtle hover:dark:text-dark-tremor-content"),"aria-hidden":!0})),h?r.default.createElement(o.default,{className:(0,s.tremorTwMerge)(b("errorIcon"),"text-red-500 shrink-0 h-5 w-5 absolute right-0 flex items-center","password"===f?"mr-10":"number"===f?y?"mr-20":"mr-3":"mx-2.5")}):null,null!=y?y:null),h&&g?r.default.createElement("p",{className:(0,s.tremorTwMerge)(b("errorMessage"),"text-sm text-red-500 mt-1")},g):null)});c.displayName="BaseInput",e.s(["default",()=>c],677955);let u=(0,n.makeClassName)("TextInput"),d=r.default.forwardRef((e,n)=>{let{type:o="text"}=e,a=(0,t.__rest)(e,["type"]);return r.default.createElement(c,Object.assign({ref:n,type:o,makeInputClassName:u},a))});d.displayName="TextInput",e.s(["TextInput",()=>d],779241)},827252,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 372z"}},{tag:"path",attrs:{d:"M464 336a48 48 0 1096 0 48 48 0 10-96 0zm72 112h-48c-4.4 0-8 3.6-8 8v272c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V456c0-4.4-3.6-8-8-8z"}}]},name:"info-circle",theme:"outlined"};var o=e.i(9583),a=r.forwardRef(function(e,a){return r.createElement(o.default,(0,t.default)({},e,{ref:a,icon:n}))});e.s(["InfoCircleOutlined",0,a],827252)},592968,e=>{"use strict";var t=e.i(491816);e.s(["Tooltip",()=>t.default])},122550,e=>{"use strict";function t(e,t){return e.length>t?e.substring(0,t)+"...":e}e.s(["formItemValidateJSON",0,(e,t)=>{if(!t)return Promise.resolve();try{return JSON.parse(t),Promise.resolve()}catch(e){return Promise.reject("Please enter valid JSON")}},"formatLabel",0,e=>e?e.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase()):e,"truncateString",()=>t])},764205,82946,e=>{"use strict";e.s(["addAllowedIP",()=>eN,"adminGlobalActivity",()=>eJ,"adminGlobalActivityPerModel",()=>eX,"adminGlobalCacheActivity",()=>eK,"adminSpendLogsCall",()=>eW,"adminTopEndUsersCall",()=>eU,"adminTopKeysCall",()=>eG,"adminTopModelsCall",()=>eY,"adminspendByProvider",()=>eq,"agentDailyActivityCall",()=>e$,"agentHubPublicModelsCall",()=>eF,"alertingSettingsCall",()=>J,"allEndUsersCall",()=>eH,"allTagNamesCall",()=>eL,"applyGuardrail",()=>nn,"approveGuardrailSubmission",()=>tA,"approveMCPServer",()=>rx,"availableTeamListCall",()=>es,"budgetCreateCall",()=>G,"budgetDeleteCall",()=>W,"budgetUpdateCall",()=>U,"buildMcpOAuthAuthorizeUrl",()=>ng,"cacheTemporaryMcpServer",()=>nm,"cachingHealthCheckCall",()=>tT,"callMCPTool",()=>rN,"cancelModelCostMapReload",()=>z,"checkEuAiActCompliance",()=>nB,"checkGdprCompliance",()=>nA,"claimOnboardingToken",()=>eE,"convertPromptFileToJson",()=>rs,"createAgentCall",()=>rc,"createGuardrailCall",()=>ru,"createMCPServer",()=>rw,"createPassThroughEndpoint",()=>tE,"createPolicyAttachmentCall",()=>t7,"createPolicyCall",()=>tZ,"createPolicyVersion",()=>t1,"createPromptCall",()=>ra,"createSearchTool",()=>rk,"credentialCreateCall",()=>e7,"credentialDeleteCall",()=>e8,"credentialGetCall",()=>e9,"credentialListCall",()=>e5,"credentialUpdateCall",()=>te,"customerDailyActivityCall",()=>ew,"deleteAgentCall",()=>r0,"deleteAllowedIP",()=>eR,"deleteCallback",()=>nf,"deleteClaudeCodePlugin",()=>nM,"deleteConfigFieldSetting",()=>tx,"deleteGuardrailCall",()=>r4,"deleteMCPOAuthUserCredential",()=>nU,"deleteMCPServer",()=>rC,"deletePassThroughEndpointsCall",()=>tj,"deletePolicyAttachmentCall",()=>t5,"deletePolicyCall",()=>t4,"deletePromptCall",()=>rl,"deleteSearchTool",()=>rF,"deleteToolPolicyOverride",()=>nW,"deriveErrorMessage",()=>nj,"disableClaudeCodePlugin",()=>nR,"enableClaudeCodePlugin",()=>nN,"enrichPolicyTemplate",()=>tq,"enrichPolicyTemplateStream",()=>tX,"estimateAttachmentImpactCall",()=>rt,"exchangeMcpOAuthToken",()=>nv,"fetchAvailableSearchProviders",()=>r_,"fetchDiscoverableMCPServers",()=>rh,"fetchMCPAccessGroups",()=>ry,"fetchMCPClientIp",()=>rb,"fetchMCPServerHealth",()=>rv,"fetchMCPServers",()=>rg,"fetchMCPSubmissions",()=>rS,"fetchOpenAPIRegistry",()=>rm,"fetchSearchTools",()=>rO,"fetchToolDetail",()=>nD,"fetchToolPolicyOptions",()=>nz,"fetchToolsList",()=>nL,"formatDate",()=>v,"getAgentCreateMetadata",()=>k,"getAgentInfo",()=>r8,"getAgentsList",()=>r9,"getAllowedIPs",()=>eP,"getBudgetList",()=>tm,"getCacheSettingsCall",()=>ty,"getCallbackConfigsCall",()=>y,"getCallbacksCall",()=>th,"getCategoryYaml",()=>r7,"getClaudeCodeMarketplace",()=>nF,"getClaudeCodePluginDetails",()=>nI,"getClaudeCodePluginsList",()=>n_,"getConfigFieldSetting",()=>tC,"getDefaultTeamSettings",()=>rL,"getEmailEventSettings",()=>rY,"getGeneralSettingsCall",()=>tg,"getGlobalLitellmHeaderName",()=>_,"getGuardrailInfo",()=>ne,"getGuardrailProviderSpecificParams",()=>r3,"getGuardrailUISettings",()=>r6,"getGuardrailsList",()=>tM,"getGuardrailsUsageDetail",()=>tH,"getGuardrailsUsageLogs",()=>tD,"getGuardrailsUsageOverview",()=>tL,"getInProductNudgesCall",()=>b,"getInternalUserSettings",()=>rf,"getLicenseInfo",()=>nu,"getMCPOAuthUserCredentialStatus",()=>nq,"getMCPSemanticFilterSettings",()=>tP,"getMajorAirlines",()=>r5,"getModelCostMapReloadStatus",()=>H,"getModelCostMapSource",()=>L,"getOnboardingCredentials",()=>eC,"getOpenAPISchema",()=>R,"getPassThroughEndpointsCall",()=>t$,"getPoliciesList",()=>tV,"getPolicyAttachmentsList",()=>t3,"getPolicyInfo",()=>t6,"getPolicyInfoWithGuardrails",()=>tG,"getPolicyTemplates",()=>tU,"getPossibleUserRoles",()=>e6,"getPromptInfo",()=>rn,"getPromptVersions",()=>ro,"getPromptsList",()=>rr,"getProviderCreateMetadata",()=>O,"getProxyBaseUrl",()=>C,"getProxyUISettings",()=>t_,"getPublicModelHubInfo",()=>N,"getRemainingUsers",()=>nc,"getResolvedGuardrails",()=>t8,"getRouterSettingsCall",()=>tv,"getSSOSettings",()=>ni,"getTeamPermissionsCall",()=>rD,"getToolUsageLogs",()=>nH,"getUISettings",()=>tI,"getUiConfig",()=>P,"getUiSettings",()=>nk,"handleError",()=>j,"individualModelHealthCheckCall",()=>tk,"invitationCreateCall",()=>q,"keyAliasesCall",()=>e2,"keyCreateCall",()=>X,"keyCreateForAgentCall",()=>Y,"keyCreateServiceAccountCall",()=>K,"keyDeleteCall",()=>Q,"keyInfoCall",()=>eZ,"keyInfoV1Call",()=>e0,"keyListCall",()=>e1,"keyUpdateCall",()=>tt,"latestHealthChecksCall",()=>tF,"listGuardrailSubmissions",()=>tB,"listMCPTools",()=>rP,"listMCPUserCredentials",()=>nJ,"listPolicyVersions",()=>t0,"loginCall",()=>nO,"makeAgentsPublicCall",()=>r1,"makeMCPPublicCall",()=>r2,"makeModelGroupPublic",()=>I,"mcpHubPublicServersCall",()=>e_,"modelAvailableCall",()=>eB,"modelCostMap",()=>M,"modelCreateCall",()=>D,"modelDeleteCall",()=>V,"modelHubCall",()=>eI,"modelHubPublicModelsCall",()=>eT,"modelInfoCall",()=>eO,"modelInfoV1Call",()=>ek,"modelPatchUpdateCall",()=>tn,"organizationCreateCall",()=>ed,"organizationDailyActivityCall",()=>eb,"organizationDeleteCall",()=>ep,"organizationInfoCall",()=>eu,"organizationListCall",()=>ec,"organizationMemberAddCall",()=>ts,"organizationMemberDeleteCall",()=>tc,"organizationMemberUpdateCall",()=>tu,"organizationUpdateCall",()=>ef,"patchAgentCall",()=>nt,"perUserAnalyticsCall",()=>nx,"proxyBaseUrl",()=>$,"ragIngestCall",()=>rX,"regenerateKeyCall",()=>eS,"registerClaudeCodePlugin",()=>nP,"registerMCPServer",()=>rE,"registerMcpOAuthClient",()=>nh,"rejectGuardrailSubmission",()=>tz,"rejectMCPServer",()=>rj,"reloadModelCostMap",()=>B,"resetEmailEventSettings",()=>rQ,"resolvePoliciesCall",()=>re,"scheduleModelCostMapReload",()=>A,"searchToolQueryCall",()=>nb,"serverRootPath",()=>w,"serviceHealthCheck",()=>tp,"sessionSpendLogsCall",()=>rW,"setCallbacksCall",()=>tO,"setGlobalLitellmHeaderName",()=>F,"storeMCPOAuthUserCredential",()=>nG,"suggestPolicyTemplates",()=>tJ,"tagCreateCall",()=>rR,"tagDailyActivityCall",()=>ev,"tagDauCall",()=>nw,"tagDeleteCall",()=>rz,"tagDistinctCall",()=>nE,"tagInfoCall",()=>rB,"tagListCall",()=>rA,"tagMauCall",()=>nC,"tagUpdateCall",()=>rM,"tagWauCall",()=>n$,"tagsSpendLogsCall",()=>ez,"teamBulkMemberAddCall",()=>ta,"teamCreateCall",()=>e3,"teamDailyActivityCall",()=>ey,"teamDeleteCall",()=>et,"teamInfoCall",()=>ea,"teamListCall",()=>el,"teamMemberAddCall",()=>to,"teamMemberDeleteCall",()=>tl,"teamMemberUpdateCall",()=>ti,"teamPermissionsUpdateCall",()=>rV,"teamSpendLogsCall",()=>eA,"teamUpdateCall",()=>tr,"testCacheConnectionCall",()=>tb,"testConnectionRequest",()=>eQ,"testCustomCodeGuardrail",()=>no,"testMCPSemanticFilter",()=>tR,"testMCPToolsListRequest",()=>np,"testPipelineCall",()=>t9,"testPoliciesAndGuardrails",()=>tW,"testPolicyTemplate",()=>tK,"testSearchToolConnection",()=>rI,"transformRequestCall",()=>em,"uiAuditLogsCall",()=>ns,"uiSpendLogDetailsCall",()=>rd,"uiSpendLogsCall",()=>eV,"updateCacheSettingsCall",()=>tw,"updateConfigFieldSetting",()=>tS,"updateDefaultTeamSettings",()=>rH,"updateEmailEventSettings",()=>rZ,"updateGuardrailCall",()=>nr,"updateInternalUserSettings",()=>rp,"updateMCPSemanticFilterSettings",()=>tN,"updateMCPServer",()=>r$,"updatePassThroughEndpoint",()=>nd,"updatePolicyCall",()=>tQ,"updatePolicyVersionStatus",()=>t2,"updatePromptCall",()=>ri,"updateSSOSettings",()=>nl,"updateSearchTool",()=>rT,"updateToolPolicy",()=>nV,"updateUiSettings",()=>nT,"updateUsefulLinksCall",()=>eM,"usageAiChatStream",()=>tY,"userAgentSummaryCall",()=>nS,"userBulkUpdateUserCall",()=>tf,"userCreateCall",()=>Z,"userDailyActivityAggregatedCall",()=>e4,"userDailyActivityCall",()=>eg,"userDeleteCall",()=>ee,"userFilterUICall",()=>eD,"userGetInfoV2",()=>en,"userInfoCall",()=>eo,"userListCall",()=>er,"userUpdateUserCall",()=>td,"v2TeamListCall",()=>ei,"validateBlockedWordsFile",()=>na,"vectorStoreCreateCall",()=>rG,"vectorStoreDeleteCall",()=>rq,"vectorStoreInfoCall",()=>rJ,"vectorStoreListCall",()=>rU,"vectorStoreSearchCall",()=>ny,"vectorStoreUpdateCall",()=>rK],764205),e.i(247167);var t=e.i(998573),r=e.i(268004);e.s(["default",()=>h,"jsonFields",()=>p],82946);var n=e.i(843476),o=e.i(271645),a=e.i(808613),i=e.i(311451),l=e.i(28651),s=e.i(199133),c=e.i(779241),u=e.i(827252),d=e.i(592968),f=e.i(122550);let p=["metadata","config","enforced_params","aliases"],m=(e,t)=>p.includes(e)||"json"===t.format,h=({schemaComponent:e,excludedFields:t=[],form:r,overrideLabels:p={},overrideTooltips:h={},customValidation:g={},defaultValues:v={}})=>{let[y,b]=(0,o.useState)(null),[w,$]=(0,o.useState)(null);return((0,o.useEffect)(()=>{(async()=>{try{let n=(await R()).components.schemas[e];if(!n)throw Error(`Schema component "${e}" not found`);b(n);let o={};Object.keys(n.properties).filter(e=>!t.includes(e)&&void 0!==v[e]).forEach(e=>{o[e]=v[e]}),r.setFieldsValue(o)}catch(e){console.error("Schema fetch error:",e),$(e instanceof Error?e.message:"Failed to fetch schema")}})()},[e,r,t]),w)?(0,n.jsxs)("div",{className:"text-red-500",children:["Error: ",w]}):y?.properties?(0,n.jsx)("div",{children:Object.entries(y.properties).filter(([e])=>!t.includes(e)).map(([e,t])=>{let r,o,b,w,$,C,E,S;return o=(e=>{if(e.type)return e.type;if(e.anyOf){let t=e.anyOf.map(e=>e.type);if(t.includes("number")||t.includes("integer"))return"number";t.includes("string")}return"string"})(t),b=y?.required?.includes(e),w=p[e]||t.title||(0,f.formatLabel)(e),$=h[e]||t.description,C=[],b&&C.push({required:!0,message:`${w} is required`}),g[e]&&C.push({validator:g[e]}),m(e,t)&&C.push({validator:async(e,t)=>{if(t&&!(e=>{if(!e)return!0;try{return JSON.parse(e),!0}catch{return!1}})(t))throw Error("Please enter valid JSON")}}),E=$?(0,n.jsxs)("span",{children:[w," ",(0,n.jsx)(d.Tooltip,{title:$,children:(0,n.jsx)(u.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}):w,r=m(e,t)?(0,n.jsx)(i.Input.TextArea,{rows:4,placeholder:"Enter as JSON",className:"font-mono"}):t.enum?(0,n.jsx)(s.Select,{children:t.enum.map(e=>(0,n.jsx)(s.Select.Option,{value:e,children:e},e))}):"number"===o||"integer"===o?(0,n.jsx)(l.InputNumber,{style:{width:"100%"},precision:"integer"===o?0:void 0}):"duration"===e?(0,n.jsx)(c.TextInput,{placeholder:"eg: 30s, 30h, 30d"}):(0,n.jsx)(c.TextInput,{placeholder:$||""}),(0,n.jsx)(a.Form.Item,{label:E,name:e,className:"mt-8",rules:C,initialValue:v[e],help:(0,n.jsx)("div",{className:"text-xs text-gray-500",children:(S=({max_budget:"Enter maximum budget in USD (e.g., 100.50)",budget_duration:"Select a time period for budget reset",tpm_limit:"Enter maximum tokens per minute (whole number)",rpm_limit:"Enter maximum requests per minute (whole number)",duration:"Enter duration (e.g., 30s, 24h, 7d)",metadata:'Enter JSON object with key-value pairs\nExample: {"team": "research", "project": "nlp"}',config:'Enter configuration as JSON object\nExample: {"setting": "value"}',permissions:"Enter comma-separated permission strings",enforced_params:'Enter parameters as JSON object\nExample: {"param": "value"}',blocked:"Enter true/false or specific block conditions",aliases:'Enter aliases as JSON object\nExample: {"alias1": "value1", "alias2": "value2"}',models:"Select one or more model names",key_alias:"Enter a unique identifier for this key",tags:"Enter comma-separated tag strings"})[e]||({string:"Text input",number:"Numeric input",integer:"Whole number input",boolean:"True/False value"})[o]||"Text input",m(e,t)?`${S} Must be valid JSON format`:t.enum?`Select from available options -Allowed values: ${t.enum.join(", ")}`:S)}),children:r},e)})}):null};var g=e.i(727749);let v=e=>{let t=e.getFullYear(),r=String(e.getMonth()+1).padStart(2,"0"),n=String(e.getDate()).padStart(2,"0");return`${t}-${r}-${n}`},y=async e=>{try{let t=$?`${$}/callbacks/configs`:"/callbacks/configs",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nx(e);throw j(t),Error(t)}return await r.json()}catch(e){throw console.error("Failed to get callbacks:",e),e}},b=async e=>{try{let t=$?`${$}/in_product_nudges`:"/in_product_nudges",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nx(e);throw j(t),Error(t)}return await r.json()}catch(e){throw console.error("Failed to get in-product nudges:",e),e}},w="/",$=null;console.log=function(){};let C=()=>{if($)return $;let e=window.location;return e?.origin??""},E="POST",S="DELETE",x=0,j=async e=>{let t=Date.now();if(t-x>6e4){if(("string"==typeof e?e:JSON.stringify(e)).includes("Authentication Error - Expired Key")){g.default.info("UI Session Expired. Logging out."),x=t,(0,r.clearTokenCookies)();let e=window.location;e&&(window.location.href=e.pathname)}x=t}else console.log("Error suppressed to prevent spam:",e)},O=async()=>{let e=$?`${$}/public/providers/fields`:"/public/providers/fields",t=await fetch(e,{method:"GET"});if(!t.ok){let e=await t.text();throw console.error("Failed to fetch provider create metadata:",t.status,e),Error("Failed to load provider configuration")}return await t.json()},k=async()=>{let e=$?`${$}/public/agents/fields`:"/public/agents/fields",t=await fetch(e,{method:"GET"});if(!t.ok){let e=await t.text();throw console.error("Failed to fetch agent create metadata:",t.status,e),Error("Failed to load agent configuration")}return await t.json()},T="Authorization";function F(e="Authorization"){console.log(`setGlobalLitellmHeaderName: ${e}`),T=e}function _(){return T}let I=async(e,t)=>{let r=$?`${$}/model_group/make_public`:"/model_group/make_public";return(await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({model_groups:t})})).json()},P=async()=>{console.log("Getting UI config");let e=await fetch("/litellm/.well-known/litellm-ui-config"),t=await e.json();return console.log("jsonData in getUiConfig:",t),((e,t=null)=>{let r=window.location,n=r?.origin??null,o=t||n;if(console.log("proxyBaseUrl:",$),console.log("serverRootPath:",e),!o)return console.log("Updated proxyBaseUrl:",$=$??null);e.length>0&&!o.endsWith(e)&&"/"!=e&&(o+=e),console.log("Updated proxyBaseUrl:",$=o)})(t.server_root_path,t.proxy_base_url),t},N=async()=>{let e=$?`${$}/public/model_hub/info`:"/public/model_hub/info",t=await fetch(e);return await t.json()},R=async()=>{let e=$?`${$}/openapi.json`:"/openapi.json",t=await fetch(e);return await t.json()},M=async()=>{try{let e=$?`${$}/public/litellm_model_cost_map`:"/public/litellm_model_cost_map",t=await fetch(e,{method:"GET",headers:{"Content-Type":"application/json"}}),r=await t.json();return console.log(`received litellm model cost data: ${r}`),r}catch(e){throw console.error("Failed to get model cost map:",e),e}},B=async e=>{try{let t=$?`${$}/reload/model_cost_map`:"/reload/model_cost_map",r=await fetch(t,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}}),n=await r.json();return console.log(`Model cost map reload response: ${n}`),n}catch(e){throw console.error("Failed to reload model cost map:",e),e}},A=async(e,t)=>{try{let r=$?`${$}/schedule/model_cost_map_reload?hours=${t}`:`/schedule/model_cost_map_reload?hours=${t}`,n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}}),o=await n.json();return console.log(`Schedule model cost map reload response: ${o}`),o}catch(e){throw console.error("Failed to schedule model cost map reload:",e),e}},z=async e=>{try{let t=$?`${$}/schedule/model_cost_map_reload`:"/schedule/model_cost_map_reload",r=await fetch(t,{method:"DELETE",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}}),n=await r.json();return console.log(`Cancel model cost map reload response: ${n}`),n}catch(e){throw console.error("Failed to cancel model cost map reload:",e),e}},L=async e=>{try{let t=$?`${$}/model/cost_map/source`:"/model/cost_map/source",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.text();throw Error(`HTTP ${r.status}: ${e}`)}let n=await r.json();return console.log("Model cost map source info:",n),n}catch(e){throw console.error("Failed to get model cost map source info:",e),e}},H=async e=>{try{let t=$?`${$}/schedule/model_cost_map_reload/status`:"/schedule/model_cost_map_reload/status";console.log("Fetching status from URL:",t);let r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){console.error(`Status request failed with status: ${r.status}`);let e=await r.text();throw console.error("Error response:",e),Error(`HTTP ${r.status}: ${e}`)}let n=await r.json();return console.log("Model cost map reload status:",n),n}catch(e){throw console.error("Failed to get model cost map reload status:",e),e}},D=async(e,r)=>{try{let n=$?`${$}/model/new`:"/model/new",o=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({...r})});if(!o.ok){let e=await o.json(),t=nx(e);throw j(t),Error(t)}let a=await o.json();return console.log("API Response:",a),t.message.destroy(),g.default.success(`Model ${r.model_name} created successfully`),a}catch(e){throw console.error("Failed to create key:",e),e}},V=async(e,t)=>{console.log(`model_id in model delete call: ${t}`);try{let r=$?`${$}/model/delete`:"/model/delete",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({id:t})});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}let o=await n.json();return console.log("API Response:",o),o}catch(e){throw console.error("Failed to create key:",e),e}},W=async(e,t)=>{if(console.log(`budget_id in budget delete call: ${t}`),null!=e)try{let r=$?`${$}/budget/delete`:"/budget/delete",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({id:t})});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}let o=await n.json();return console.log("API Response:",o),o}catch(e){throw console.error("Failed to create key:",e),e}},G=async(e,t)=>{try{console.log("Form Values in budgetCreateCall:",t),console.log("Form Values after check:",t);let r=$?`${$}/budget/new`:"/budget/new",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({...t})});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}let o=await n.json();return console.log("API Response:",o),o}catch(e){throw console.error("Failed to create key:",e),e}},U=async(e,t)=>{try{console.log("Form Values in budgetUpdateCall:",t),console.log("Form Values after check:",t);let r=$?`${$}/budget/update`:"/budget/update",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({...t})});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}let o=await n.json();return console.log("API Response:",o),o}catch(e){throw console.error("Failed to create key:",e),e}},q=async(e,t)=>{try{let r=$?`${$}/invitation/new`:"/invitation/new",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({user_id:t})});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}let o=await n.json();return console.log("API Response:",o),o}catch(e){throw console.error("Failed to create key:",e),e}},J=async e=>{try{let t=$?`${$}/alerting/settings`:"/alerting/settings",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nx(e);throw j(t),Error(t)}return await r.json()}catch(e){throw console.error("Failed to get callbacks:",e),e}},K=async(e,t)=>{try{for(let e of(console.log("Form Values in keyCreateServiceAccountCall:",t),t.description&&(t.metadata||(t.metadata={}),t.metadata.description=t.description,delete t.description,t.metadata=JSON.stringify(t.metadata)),p))if(t[e]){console.log(`formValues.${e}:`,t[e]);try{t[e]=JSON.parse(t[e])}catch(t){throw Error(`Failed to parse ${e}: `+t)}}console.log("Form Values after check:",t);let r=$?`${$}/key/service-account/generate`:"/key/service-account/generate",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({...t})});if(!n.ok){let e=await n.text();throw j(e),console.error("Error response from the server:",e),Error(e)}let o=await n.json();return console.log("API Response:",o),o}catch(e){throw console.error("Failed to create key:",e),e}},X=async(e,t,r)=>{try{for(let e of(console.log("Form Values in keyCreateCall:",r),r.description&&(r.metadata||(r.metadata={}),r.metadata.description=r.description,delete r.description,r.metadata=JSON.stringify(r.metadata)),p))if(r[e]){console.log(`formValues.${e}:`,r[e]);try{r[e]=JSON.parse(r[e])}catch(t){throw Error(`Failed to parse ${e}: `+t)}}console.log("Form Values after check:",r);let n=$?`${$}/key/generate`:"/key/generate",o=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({user_id:t,...r})});if(!o.ok){let e=await o.text();throw j(e),console.error("Error response from the server:",e),Error(e)}let a=await o.json();return console.log("API Response:",a),a}catch(e){throw console.error("Failed to create key:",e),e}},Y=async(e,t,r,n,o,a)=>{let i=$?`${$}/key/generate`:"/key/generate",l={agent_id:t,key_alias:r,models:n.length>0?n:[]};a&&(l.team_id=a),o&&Object.keys(o).length>0&&(l.metadata=o);let s=await fetch(i,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(l)});if(!s.ok)throw j(await s.text()),Error("Failed to create key for agent");return s.json()},Z=async(e,t,r)=>{try{if(console.log("Form Values in keyCreateCall:",r),r.description&&(r.metadata||(r.metadata={}),r.metadata.description=r.description,delete r.description,r.metadata=JSON.stringify(r.metadata)),r.auto_create_key=!1,r.metadata){console.log("formValues.metadata:",r.metadata);try{r.metadata=JSON.parse(r.metadata)}catch(e){throw Error("Failed to parse metadata: "+e)}}console.log("Form Values after check:",r);let n=$?`${$}/user/new`:"/user/new",o=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({user_id:t,...r})});if(!o.ok){let e=await o.text();throw j(e),console.error("Error response from the server:",e),Error(e)}let a=await o.json();return console.log("API Response:",a),a}catch(e){throw console.error("Failed to create key:",e),e}},Q=async(e,t)=>{try{let r=$?`${$}/key/delete`:"/key/delete";console.log("in keyDeleteCall:",t);let n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({keys:[t]})});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}let o=await n.json();return console.log(o),o}catch(e){throw console.error("Failed to create key:",e),e}},ee=async(e,t)=>{try{let r=$?`${$}/user/delete`:"/user/delete";console.log("in userDeleteCall:",t);let n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({user_ids:t})});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}let o=await n.json();return console.log(o),o}catch(e){throw console.error("Failed to delete user(s):",e),e}},et=async(e,t)=>{try{let r=$?`${$}/team/delete`:"/team/delete";console.log("in teamDeleteCall:",t);let n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({team_ids:[t]})});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}let o=await n.json();return console.log(o),o}catch(e){throw console.error("Failed to delete key:",e),e}},er=async(e,t=null,r=null,n=null,o=null,a=null,i=null,l=null,s=null,c=null,u=null)=>{try{let d=$?`${$}/user/list`:"/user/list";console.log("in userListCall");let f=new URLSearchParams;if(t&&t.length>0){let e=t.join(",");f.append("user_ids",e)}r&&f.append("page",r.toString()),n&&f.append("page_size",n.toString()),o&&f.append("user_email",o),a&&f.append("role",a),i&&f.append("team",i),l&&f.append("sso_user_ids",l),s&&f.append("sort_by",s),c&&f.append("sort_order",c),u&&u.length>0&&f.append("organization_ids",u.join(","));let p=f.toString();p&&(d+=`?${p}`);let m=await fetch(d,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!m.ok){let e=await m.json(),t=nx(e);throw j(t),Error(t)}let h=await m.json();return console.log("/user/list API Response:",h),h}catch(e){throw console.error("Failed to create key:",e),e}},en=async(e,t,r,n=!1,o,a,i=!1)=>{console.log(`userInfoCall: ${t}, ${r}, ${n}, ${o}, ${a}, ${i}`);try{let l;if(n){l=$?`${$}/user/list`:"/user/list";let e=new URLSearchParams;null!=o&&e.append("page",o.toString()),null!=a&&e.append("page_size",a.toString()),l+=`?${e.toString()}`}else l=$?`${$}/user/info`:"/user/info",("Admin"!==r&&"Admin Viewer"!==r||i)&&t&&(l+=`?user_id=${t}`);console.log("Requesting user data from:",l);let s=await fetch(l,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!s.ok){let e=await s.json(),t=nx(e);throw j(t),Error(t)}let c=await s.json();return console.log("API Response:",c),c}catch(e){throw console.error("Failed to fetch user data:",e),e}},eo=async(e,t)=>{try{let r=$?`${$}/team/info`:"/team/info";t&&(r=`${r}?team_id=${t}`),console.log("in teamInfoCall");let n=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}let o=await n.json();return console.log("API Response:",o),o}catch(e){throw console.error("Failed to create key:",e),e}},ea=async(e,t,r=null,n=null,o=null,a=1,i=10,l=null,s=null)=>{try{let a=$?`${$}/v2/team/list`:"/v2/team/list";console.log("in teamInfoCall");let i=new URLSearchParams;r&&i.append("user_id",r.toString()),t&&i.append("organization_id",t.toString()),n&&i.append("team_id",n.toString()),o&&i.append("team_alias",o.toString());let l=i.toString();l&&(a+=`?${l}`);let s=await fetch(a,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!s.ok){let e=await s.json(),t=nx(e);throw j(t),Error(t)}let c=await s.json();return console.log("/v2/team/list API Response:",c),c}catch(e){throw console.error("Failed to create key:",e),e}},ei=async(e,t,r=null,n=null,o=null)=>{try{let a=$?`${$}/team/list`:"/team/list";console.log("in teamInfoCall");let i=new URLSearchParams;r&&i.append("user_id",r.toString()),t&&i.append("organization_id",t.toString()),n&&i.append("team_id",n.toString()),o&&i.append("team_alias",o.toString());let l=i.toString();l&&(a+=`?${l}`);let s=await fetch(a,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!s.ok){let e=await s.json(),t=nx(e);throw j(t),Error(t)}let c=await s.json();return console.log("/team/list API Response:",c),c}catch(e){throw console.error("Failed to create key:",e),e}},el=async e=>{try{let t=$?`${$}/team/available`:"/team/available";console.log("in availableTeamListCall");let r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nx(e);throw j(t),Error(t)}let n=await r.json();return console.log("/team/available_teams API Response:",n),n}catch(e){throw e}},es=async(e,t=null,r=null)=>{try{let n=$?`${$}/organization/list`:"/organization/list",o=new URLSearchParams;t&&o.append("org_id",t.toString()),r&&o.append("org_alias",r.toString());let a=o.toString();a&&(n+=`?${a}`);let i=await fetch(n,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!i.ok){let e=await i.json(),t=nx(e);throw j(t),Error(t)}return await i.json()}catch(e){throw console.error("Failed to create key:",e),e}},ec=async(e,t)=>{try{let r=$?`${$}/organization/info`:"/organization/info";t&&(r=`${r}?organization_id=${t}`),console.log("in teamInfoCall");let n=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}let o=await n.json();return console.log("API Response:",o),o}catch(e){throw console.error("Failed to create key:",e),e}},eu=async(e,t)=>{try{if(console.log("Form Values in organizationCreateCall:",t),t.metadata){console.log("formValues.metadata:",t.metadata);try{t.metadata=JSON.parse(t.metadata)}catch(e){throw console.error("Failed to parse metadata:",e),Error("Failed to parse metadata: "+e)}}let r=$?`${$}/organization/new`:"/organization/new",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({...t})});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}let o=await n.json();return console.log("API Response:",o),o}catch(e){throw console.error("Failed to create key:",e),e}},ed=async(e,t)=>{try{console.log("Form Values in organizationUpdateCall:",t);let r=$?`${$}/organization/update`:"/organization/update",n=await fetch(r,{method:"PATCH",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({...t})});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}let o=await n.json();return console.log("Update Team Response:",o),o}catch(e){throw console.error("Failed to create key:",e),e}},ef=async(e,t)=>{try{let r=$?`${$}/organization/delete`:"/organization/delete",n=await fetch(r,{method:"DELETE",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({organization_ids:[t]})});if(!n.ok){let e=await n.text();throw j(e),Error(`Error deleting organization: ${e}`)}return await n.json()}catch(e){throw console.error("Failed to delete organization:",e),e}},ep=async(e,t)=>{try{let r=$?`${$}/utils/transform_request`:"/utils/transform_request",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to create key:",e),e}},em=async({accessToken:e,endpoint:t,startTime:r,endTime:n,page:o=1,extraQueryParams:a})=>{try{let i,l,s,c,u=(i=t.startsWith("/")?t:`/${t}`,l=$?`${$}${i}`:i,(s=new URLSearchParams).append("start_date",v(r)),s.append("end_date",v(n)),s.append("page_size","1000"),s.append("page",o.toString()),s.append("timezone",new Date().getTimezoneOffset().toString()),a&&Object.entries(a).forEach(([e,t])=>{((e,t,r)=>{if(null!=r){if(Array.isArray(r)){r.length>0&&e.append(t,r.join(","));return}e.append(t,`${r}`)}})(s,e,t)}),(c=s.toString())?`${l}?${c}`:l),d=await fetch(u,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!d.ok){let e=await d.json(),t=nx(e);throw j(t),Error(t)}return await d.json()}catch(e){throw console.error(`Failed to fetch daily activity (${t}):`,e),e}},eh=async(e,t,r,n=1,o=null)=>em({accessToken:e,endpoint:"/user/daily/activity",startTime:t,endTime:r,page:n,extraQueryParams:{user_id:o}}),eg=async(e,t,r,n=1,o=null)=>em({accessToken:e,endpoint:"/tag/daily/activity",startTime:t,endTime:r,page:n,extraQueryParams:{tags:o}}),ev=async(e,t,r,n=1,o=null)=>em({accessToken:e,endpoint:"/team/daily/activity",startTime:t,endTime:r,page:n,extraQueryParams:{team_ids:o,exclude_team_ids:"litellm-dashboard"}}),ey=async(e,t,r,n=1,o=null)=>em({accessToken:e,endpoint:"/organization/daily/activity",startTime:t,endTime:r,page:n,extraQueryParams:{organization_ids:o}}),eb=async(e,t,r,n=1,o=null)=>em({accessToken:e,endpoint:"/customer/daily/activity",startTime:t,endTime:r,page:n,extraQueryParams:{end_user_ids:o}}),ew=async(e,t,r,n=1,o=null)=>em({accessToken:e,endpoint:"/agent/daily/activity",startTime:t,endTime:r,page:n,extraQueryParams:{agent_ids:o}}),e$=async e=>{try{let t=$?`${$}/onboarding/get_token`:"/onboarding/get_token";t+=`?invite_link=${e}`;let r=await fetch(t,{method:"GET",headers:{"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nx(e);throw j(t),Error(t)}return await r.json()}catch(e){throw console.error("Failed to create key:",e),e}},eC=async(e,t,r,n)=>{let o=$?`${$}/onboarding/claim_token`:"/onboarding/claim_token";try{let a=await fetch(o,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({invitation_link:t,user_id:r,password:n})});if(!a.ok){let e=await a.json(),t=nx(e);throw j(t),Error(t)}let i=await a.json();return console.log(i),i}catch(e){throw console.error("Failed to delete key:",e),e}},eE=async(e,t,r)=>{try{let n=$?`${$}/key/${t}/regenerate`:`/key/${t}/regenerate`,o=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(r)});if(!o.ok){let e=await o.json(),t=nx(e);throw j(t),Error(t)}let a=await o.json();return console.log("Regenerate key Response:",a),a}catch(e){throw console.error("Failed to regenerate key:",e),e}},eS=!1,ex=null,ej=async(e,t,r,n=1,o=50,a,i,l,s,c)=>{try{console.log("modelInfoCall:",e,t,r,n,o,a,i,l,s,c);let u=$?`${$}/v2/model/info`:"/v2/model/info",d=new URLSearchParams;d.append("include_team_models","true"),d.append("page",n.toString()),d.append("size",o.toString()),a&&a.trim()&&d.append("search",a.trim()),i&&i.trim()&&d.append("modelId",i.trim()),l&&l.trim()&&d.append("teamId",l.trim()),s&&s.trim()&&d.append("sortBy",s.trim()),c&&c.trim()&&d.append("sortOrder",c.trim()),d.toString()&&(u+=`?${d.toString()}`);let f=await fetch(u,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!f.ok){let e=await f.text();throw e+=`error shown=${eS}`,eS||(e.includes("No model list passed")&&(e="No Models Exist. Click Add Model to get started."),g.default.info(e),eS=!0,ex&&clearTimeout(ex),ex=setTimeout(()=>{eS=!1},1e4)),Error("Network response was not ok")}let p=await f.json();return console.log("modelInfoCall:",p),p}catch(e){throw console.error("Failed to create key:",e),e}},eO=async(e,t)=>{try{let r=$?`${$}/v1/model/info`:"/v1/model/info";r+=`?litellm_model_id=${t}`;let n=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}let o=await n.json();return console.log("modelInfoV1Call:",o),o}catch(e){throw console.error("Failed to create key:",e),e}},ek=async()=>{let e=$?`${$}/public/model_hub`:"/public/model_hub",t=await fetch(e,{method:"GET",headers:{"Content-Type":"application/json"}});return t.ok?t.json():(console.error(`modelHubPublicModelsCall failed with status ${t.status}`),[])},eT=async()=>{let e=$?`${$}/public/agent_hub`:"/public/agent_hub",t=await fetch(e,{method:"GET",headers:{"Content-Type":"application/json"}});return t.ok?t.json():(console.error(`agentHubPublicModelsCall failed with status ${t.status}`),[])},eF=async()=>{let e=$?`${$}/public/mcp_hub`:"/public/mcp_hub",t=await fetch(e,{method:"GET",headers:{"Content-Type":"application/json"}});return t.ok?t.json():(console.error(`mcpHubPublicServersCall failed with status ${t.status}`),[])},e_=async e=>{try{let t=$?`${$}/model_group/info`:"/model_group/info",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nx(e);throw j(t),Error(t)}let n=await r.json();return console.log("modelHubCall:",n),n}catch(e){throw console.error("Failed to create key:",e),e}},eI=async e=>{try{let t=$?`${$}/get/allowed_ips`:"/get/allowed_ips",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nx(e);throw j(t),Error(t)}let n=await r.json();return console.log("getAllowedIPs:",n),n.data}catch(e){throw console.error("Failed to get allowed IPs:",e),e}},eP=async(e,t)=>{try{let r=$?`${$}/add/allowed_ip`:"/add/allowed_ip",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({ip:t})});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}let o=await n.json();return console.log("addAllowedIP:",o),o}catch(e){throw console.error("Failed to add allowed IP:",e),e}},eN=async(e,t)=>{try{let r=$?`${$}/delete/allowed_ip`:"/delete/allowed_ip",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({ip:t})});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}let o=await n.json();return console.log("deleteAllowedIP:",o),o}catch(e){throw console.error("Failed to delete allowed IP:",e),e}},eR=async(e,t)=>{try{let r=$?`${$}/model_hub/update_useful_links`:"/model_hub/update_useful_links",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({useful_links:t})});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to create key:",e),e}},eM=async(e,t,r,n=!1,o=null,a=!1,i=!1,l)=>{console.log("in /models calls, globalLitellmHeaderName",T);try{let t=$?`${$}/models`:"/models",r=new URLSearchParams;r.append("include_model_access_groups","True"),!0===n&&r.append("return_wildcard_routes","True"),!0===i&&r.append("only_model_access_groups","True"),o&&r.append("team_id",o.toString()),l&&r.append("scope",l),r.toString()&&(t+=`?${r.toString()}`);let a=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!a.ok){let e=await a.json(),t=nx(e);throw j(t),Error(t)}return await a.json()}catch(e){throw console.error("Failed to create key:",e),e}},eB=async e=>{try{let t=$?`${$}/global/spend/teams`:"/global/spend/teams";console.log("in teamSpendLogsCall:",t);let r=await fetch(`${t}`,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nx(e);throw j(t),Error(t)}let n=await r.json();return console.log(n),n}catch(e){throw console.error("Failed to create key:",e),e}},eA=async(e,t,r,n)=>{try{let o=$?`${$}/global/spend/tags`:"/global/spend/tags";t&&r&&(o=`${o}?start_date=${t}&end_date=${r}`),n&&(o+=`&tags=${n.join(",")}`),console.log("in tagsSpendLogsCall:",o);let a=await fetch(`${o}`,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!a.ok){let e=await a.json(),t=nx(e);throw j(t),Error(t)}let i=await a.json();return console.log(i),i}catch(e){throw console.error("Failed to create key:",e),e}},ez=async e=>{try{let t=$?`${$}/global/spend/all_tag_names`:"/global/spend/all_tag_names";console.log("in global/spend/all_tag_names call",t);let r=await fetch(`${t}`,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nx(e);throw j(t),Error(t)}let n=await r.json();return console.log(n),n}catch(e){throw console.error("Failed to create key:",e),e}},eL=async e=>{try{let t=$?`${$}/customer/list`:"/customer/list";console.log("in customer/list",t);let r=await fetch(`${t}`,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nx(e);throw j(t),Error(t)}let n=await r.json();return console.log(n),n}catch(e){throw console.error("Failed to fetch end users:",e),e}},eH=async(e,t)=>{try{let r=$?`${$}/user/filter/ui`:"/user/filter/ui",n=new URLSearchParams;t.get("user_email")&&n.append("user_email",t.get("user_email")),t.get("user_id")&&n.append("user_id",t.get("user_id")),t.get("team_id")&&n.append("team_id",t.get("team_id"));let o=n.toString(),a=o?`${r}?${o}`:r,i=await fetch(a,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!i.ok){let e=await i.json(),t=nx(e);throw j(t),Error(t)}return await i.json()}catch(e){throw console.error("Failed to create key:",e),e}},eD=async({accessToken:e,start_date:t,end_date:r,page:n=1,page_size:o=50,params:a={}})=>{try{let i=$?`${$}/spend/logs/ui`:"/spend/logs/ui",l=new URLSearchParams;for(let[e,i]of(l.append("start_date",t),l.append("end_date",r),l.append("page",n.toString()),l.append("page_size",o.toString()),Object.entries(a)))null!=i&&("min_spend"===e||"max_spend"===e?l.append(e,i.toString()):"string"==typeof i&&""!==i&&l.append(e,String(i)));let s=l.toString();s&&(i+=`?${s}`);let c=await fetch(i,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!c.ok){let e=await c.json(),t=nx(e);throw j(t),Error(t)}let u=await c.json();return console.log("Spend Logs Response:",u),u}catch(e){throw console.error("Failed to fetch spend logs:",e),e}},eV=async e=>{try{let t=$?`${$}/global/spend/logs`:"/global/spend/logs",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nx(e);throw j(t),Error(t)}let n=await r.json();return console.log(n),n}catch(e){throw console.error("Failed to create key:",e),e}},eW=async e=>{try{let t=$?`${$}/global/spend/keys?limit=5`:"/global/spend/keys?limit=5",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nx(e);throw j(t),Error(t)}let n=await r.json();return console.log(n),n}catch(e){throw console.error("Failed to create key:",e),e}},eG=async(e,t,r,n)=>{try{let o=$?`${$}/global/spend/end_users`:"/global/spend/end_users",a="";a=t?JSON.stringify({api_key:t,startTime:r,endTime:n}):JSON.stringify({startTime:r,endTime:n});let i={method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:a},l=await fetch(o,i);if(!l.ok){let e=await l.json(),t=nx(e);throw j(t),Error(t)}let s=await l.json();return console.log(s),s}catch(e){throw console.error("Failed to create key:",e),e}},eU=async(e,t,r,n)=>{try{let o=$?`${$}/global/spend/provider`:"/global/spend/provider";r&&n&&(o+=`?start_date=${r}&end_date=${n}`),t&&(o+=`&api_key=${t}`);let a={method:"GET",headers:{[T]:`Bearer ${e}`}},i=await fetch(o,a);if(!i.ok){let e=await i.json(),t=nx(e);throw j(t),Error(t)}let l=await i.json();return console.log(l),l}catch(e){throw console.error("Failed to fetch spend data:",e),e}},eq=async(e,t,r)=>{try{let n=$?`${$}/global/activity`:"/global/activity";t&&r&&(n+=`?start_date=${t}&end_date=${r}`);let o={method:"GET",headers:{[T]:`Bearer ${e}`}},a=await fetch(n,o);if(!a.ok){let e=await a.json(),t=nx(e);throw j(t),Error(t)}let i=await a.json();return console.log(i),i}catch(e){throw console.error("Failed to fetch spend data:",e),e}},eJ=async(e,t,r)=>{try{let n=$?`${$}/global/activity/cache_hits`:"/global/activity/cache_hits";t&&r&&(n+=`?start_date=${t}&end_date=${r}`);let o={method:"GET",headers:{[T]:`Bearer ${e}`}},a=await fetch(n,o);if(!a.ok){let e=await a.json(),t=nx(e);throw j(t),Error(t)}let i=await a.json();return console.log(i),i}catch(e){throw console.error("Failed to fetch spend data:",e),e}},eK=async(e,t,r)=>{try{let n=$?`${$}/global/activity/model`:"/global/activity/model";t&&r&&(n+=`?start_date=${t}&end_date=${r}`);let o={method:"GET",headers:{[T]:`Bearer ${e}`}},a=await fetch(n,o);if(!a.ok){let e=await a.json(),t=nx(e);throw j(t),Error(t)}let i=await a.json();return console.log(i),i}catch(e){throw console.error("Failed to fetch spend data:",e),e}},eX=async e=>{try{let t=$?`${$}/global/spend/models?limit=5`:"/global/spend/models?limit=5",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nx(e);throw j(t),Error(t)}let n=await r.json();return console.log(n),n}catch(e){throw console.error("Failed to create key:",e),e}},eY=async(e,t)=>{try{let r=$?`${$}/v2/key/info`:"/v2/key/info",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({keys:t})});if(!n.ok){let e=await n.text();if(e.includes("Invalid proxy server token passed"))throw Error("Invalid proxy server token passed");throw j(e),Error("Network response was not ok")}let o=await n.json();return console.log(o),o}catch(e){throw console.error("Failed to create key:",e),e}},eZ=async(e,t,r,n)=>{try{console.log("Sending model connection test request:",JSON.stringify(t));let o=$?`${$}/health/test_connection`:"/health/test_connection",a=await fetch(o,{method:"POST",headers:{"Content-Type":"application/json",[T]:`Bearer ${e}`},body:JSON.stringify({litellm_params:t,model_info:r,mode:n})}),i=a.headers.get("content-type");if(!i||!i.includes("application/json")){let e=await a.text();throw console.error("Received non-JSON response:",e),Error(`Received non-JSON response (${a.status}: ${a.statusText}). Check network tab for details.`)}let l=await a.json();if((!a.ok||"error"===l.status)&&"error"!==l.status)return{status:"error",message:l.error?.message||`Connection test failed: ${a.status} ${a.statusText}`};return l}catch(e){throw console.error("Model connection test error:",e),e}},eQ=async(e,t)=>{try{console.log("entering keyInfoV1Call");let r=$?`${$}/key/info`:"/key/info";r=`${r}?key=${t}`;let n=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(console.log("response",n),!n.ok){let e=await n.text();j(e),g.default.fromBackend("Failed to fetch key info - "+e)}let o=await n.json();return console.log("data",o),o}catch(e){throw console.error("Failed to fetch key info:",e),e}},e0=async(e,t,r,n,o,a,i,l,s=null,c=null,u=null,d=null)=>{try{let f=$?`${$}/key/list`:"/key/list";console.log("in keyListCall");let p=new URLSearchParams;r&&p.append("team_id",r.toString()),t&&p.append("organization_id",t.toString()),n&&p.append("key_alias",n),a&&p.append("key_hash",a),o&&p.append("user_id",o.toString()),i&&p.append("page",i.toString()),l&&p.append("size",l.toString()),s&&p.append("sort_by",s),c&&p.append("sort_order",c),u&&p.append("expand",u),d&&p.append("status",d),p.append("return_full_object","true"),p.append("include_team_keys","true"),p.append("include_created_by_keys","true");let m=p.toString();m&&(f+=`?${m}`);let h=await fetch(f,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!h.ok){let e=await h.json(),t=nx(e);throw j(t),Error(t)}let g=await h.json();return console.log("/team/list API Response:",g),g}catch(e){throw console.error("Failed to create key:",e),e}},e1=async(e,t=1,r=50,n)=>{try{let o=new URLSearchParams(Object.entries({page:String(t),size:String(r),...n?{search:n}:{}})),a=$?`${$}/key/aliases`:"/key/aliases";a=`${a}?${o}`;let i=await fetch(a,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!i.ok){let e=await i.json(),t=nx(e);throw j(t),Error(t)}let l=await i.json();return console.log("/key/aliases API Response:",l),l}catch(e){throw console.error("Failed to fetch key aliases:",e),e}},e2=async(e,t,r,n=null)=>{try{let o=$?`${$}/user/daily/activity/aggregated`:"/user/daily/activity/aggregated",a=new URLSearchParams,i=e=>{let t=e.getFullYear(),r=String(e.getMonth()+1).padStart(2,"0"),n=String(e.getDate()).padStart(2,"0");return`${t}-${r}-${n}`};a.append("start_date",i(t)),a.append("end_date",i(r)),a.append("timezone",new Date().getTimezoneOffset().toString()),n&&a.append("user_id",n);let l=a.toString();l&&(o+=`?${l}`);let s=await fetch(o,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!s.ok){let e=await s.json(),t=nx(e);throw j(t),Error(t)}return await s.json()}catch(e){throw console.error("Failed to fetch aggregated user daily activity:",e),e}},e4=async e=>{try{let t=$?`${$}/user/available_roles`:"/user/available_roles",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nx(e);throw j(t),Error(t)}let n=await r.json();return console.log("response from user/available_role",n),n}catch(e){throw e}},e6=async(e,t)=>{try{if(console.log("Form Values in teamCreateCall:",t),t.metadata){console.log("formValues.metadata:",t.metadata);try{t.metadata=JSON.parse(t.metadata)}catch(e){throw Error("Failed to parse metadata: "+e)}}let r=$?`${$}/team/new`:"/team/new",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({...t})});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}let o=await n.json();return console.log("API Response:",o),o}catch(e){throw console.error("Failed to create key:",e),e}},e3=async(e,t)=>{try{if(console.log("Form Values in credentialCreateCall:",t),t.metadata){console.log("formValues.metadata:",t.metadata);try{t.metadata=JSON.parse(t.metadata)}catch(e){throw Error("Failed to parse metadata: "+e)}}let r=$?`${$}/credentials`:"/credentials",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({...t})});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}let o=await n.json();return console.log("API Response:",o),o}catch(e){throw console.error("Failed to create key:",e),e}},e7=async e=>{try{let t=$?`${$}/credentials`:"/credentials";console.log("in credentialListCall");let r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nx(e);throw j(t),Error(t)}let n=await r.json();return console.log("/credentials API Response:",n),n}catch(e){throw console.error("Failed to create key:",e),e}},e5=async(e,t,r)=>{try{let n=$?`${$}/credentials`:"/credentials";t?n+=`/by_name/${t}`:r&&(n+=`/by_model/${r}`),console.log("in credentialListCall");let o=await fetch(n,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!o.ok){let e=await o.json(),t=nx(e);throw j(t),Error(t)}let a=await o.json();return console.log("/credentials API Response:",a),a}catch(e){throw console.error("Failed to create key:",e),e}},e9=async(e,t)=>{try{let r=$?`${$}/credentials/${t}`:`/credentials/${t}`;console.log("in credentialDeleteCall:",t);let n=await fetch(r,{method:"DELETE",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}let o=await n.json();return console.log(o),o}catch(e){throw console.error("Failed to delete key:",e),e}},e8=async(e,t,r)=>{try{if(console.log("Form Values in credentialUpdateCall:",r),r.metadata){console.log("formValues.metadata:",r.metadata);try{r.metadata=JSON.parse(r.metadata)}catch(e){throw Error("Failed to parse metadata: "+e)}}let n=$?`${$}/credentials/${t}`:`/credentials/${t}`,o=await fetch(n,{method:"PATCH",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({...r})});if(!o.ok){let e=await o.json(),t=nx(e);throw j(t),Error(t)}let a=await o.json();return console.log("API Response:",a),a}catch(e){throw console.error("Failed to create key:",e),e}},te=async(e,t)=>{try{if(console.log("Form Values in keyUpdateCall:",t),t.model_tpm_limit){console.log("formValues.model_tpm_limit:",t.model_tpm_limit);try{t.model_tpm_limit=JSON.parse(t.model_tpm_limit)}catch(e){throw Error("Failed to parse model_tpm_limit: "+e)}}if(t.model_rpm_limit){console.log("formValues.model_rpm_limit:",t.model_rpm_limit);try{t.model_rpm_limit=JSON.parse(t.model_rpm_limit)}catch(e){throw Error("Failed to parse model_rpm_limit: "+e)}}let r=$?`${$}/key/update`:"/key/update",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({...t})});if(!n.ok){let e=await n.text();throw j(e),console.error("Error response from the server:",e),Error(e)}let o=await n.json();return console.log("Update key Response:",o),o}catch(e){throw console.error("Failed to create key:",e),e}},tt=async(e,t)=>{try{console.log("Form Values in teamUpateCall:",t);let r=$?`${$}/team/update`:"/team/update",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({...t})});if(!n.ok){let e=await n.text();throw j(e),console.error("Error response from the server:",e),g.default.fromBackend("Failed to update team settings: "+e),Error(e)}let o=await n.json();return console.log("Update Team Response:",o),o}catch(e){throw console.error("Failed to update team:",e),e}},tr=async(e,t,r)=>{try{console.log("Form Values in modelUpateCall:",t);let n=$?`${$}/model/${r}/update`:`/model/${r}/update`,o=await fetch(n,{method:"PATCH",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({...t})});if(!o.ok){let e=await o.text();throw j(e),console.error("Error update from the server:",e),Error("Network response was not ok")}let a=await o.json();return console.log("Update model Response:",a),a}catch(e){throw console.error("Failed to update model:",e),e}},tn=async(e,t,r)=>{try{console.log("Form Values in teamMemberAddCall:",r);let n=$?`${$}/team/member_add`:"/team/member_add",o=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({team_id:t,member:r})});if(!o.ok){let e=await o.text(),t={};try{t=JSON.parse(e)}catch(t){console.warn("Failed to parse error body as JSON:",e)}let r=t?.detail?.error||"Failed to add team member",n=Error(r);throw n.raw=t,n}let a=await o.json();return console.log("API Response:",a),a}catch(e){throw console.error("Failed to create key:",e),e}},to=async(e,t,r,n,o)=>{try{console.log("Bulk add team members:",{teamId:t,members:r,maxBudgetInTeam:n});let a=$?`${$}/team/bulk_member_add`:"/team/bulk_member_add",i={team_id:t};o?i.all_users=!0:i.members=r,null!=n&&(i.max_budget_in_team=n);let l=await fetch(a,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(i)});if(!l.ok){let e=await l.text(),t={};try{t=JSON.parse(e)}catch(t){console.warn("Failed to parse error body as JSON:",e)}let r=t?.detail?.error||"Failed to bulk add team members",n=Error(r);throw n.raw=t,n}let s=await l.json();return console.log("Bulk team member add API Response:",s),s}catch(e){throw console.error("Failed to bulk add team members:",e),e}},ta=async(e,t,r)=>{try{console.log("Form Values in teamMemberUpdateCall:",r),console.log("Budget value:",r.max_budget_in_team),console.log("TPM limit:",r.tpm_limit),console.log("RPM limit:",r.rpm_limit);let n=$?`${$}/team/member_update`:"/team/member_update",o={team_id:t,role:r.role,user_id:r.user_id};void 0!==r.user_email&&(o.user_email=r.user_email),void 0!==r.max_budget_in_team&&null!==r.max_budget_in_team&&(o.max_budget_in_team=r.max_budget_in_team),void 0!==r.tpm_limit&&null!==r.tpm_limit&&(o.tpm_limit=r.tpm_limit),void 0!==r.rpm_limit&&null!==r.rpm_limit&&(o.rpm_limit=r.rpm_limit),console.log("Final request body:",o);let a=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(o)});if(!a.ok){let e=await a.text(),t={};try{t=JSON.parse(e)}catch(t){console.warn("Failed to parse error body as JSON:",e)}let r=t?.detail?.error||"Failed to add team member",n=Error(r);throw n.raw=t,n}let i=await a.json();return console.log("API Response:",i),i}catch(e){throw console.error("Failed to update team member:",e),e}},ti=async(e,t,r)=>{try{console.log("Form Values in teamMemberAddCall:",r);let n=$?`${$}/team/member_delete`:"/team/member_delete",o=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({team_id:t,...void 0!==r.user_email&&{user_email:r.user_email},...void 0!==r.user_id&&{user_id:r.user_id}})});if(!o.ok){let e=await o.json(),t=nx(e);throw j(t),Error(t)}let a=await o.json();return console.log("API Response:",a),a}catch(e){throw console.error("Failed to create key:",e),e}},tl=async(e,t,r)=>{try{console.log("Form Values in teamMemberAddCall:",r);let n=$?`${$}/organization/member_add`:"/organization/member_add",o=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({organization_id:t,member:r})});if(!o.ok){let e=await o.text();throw j(e),console.error("Error response from the server:",e),Error(e)}let a=await o.json();return console.log("API Response:",a),a}catch(e){throw console.error("Failed to create organization member:",e),e}},ts=async(e,t,r)=>{try{console.log("Form Values in organizationMemberDeleteCall:",r);let n=$?`${$}/organization/member_delete`:"/organization/member_delete",o=await fetch(n,{method:"DELETE",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({organization_id:t,user_id:r})});if(!o.ok){let e=await o.json(),t=nx(e);throw j(t),Error(t)}let a=await o.json();return console.log("API Response:",a),a}catch(e){throw console.error("Failed to delete organization member:",e),e}},tc=async(e,t,r)=>{try{console.log("Form Values in organizationMemberUpdateCall:",r);let n=$?`${$}/organization/member_update`:"/organization/member_update",o=await fetch(n,{method:"PATCH",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({organization_id:t,...r})});if(!o.ok){let e=await o.json(),t=nx(e);throw j(t),Error(t)}let a=await o.json();return console.log("API Response:",a),a}catch(e){throw console.error("Failed to update organization member:",e),e}},tu=async(e,t,r)=>{try{console.log("Form Values in userUpdateUserCall:",t);let n=$?`${$}/user/update`:"/user/update",o={...t};null!==r&&(o.user_role=r),o=JSON.stringify(o);let a=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:o});if(!a.ok){let e=await a.json(),t=nx(e);throw j(t),Error(t)}let i=await a.json();return console.log("API Response:",i),i}catch(e){throw console.error("Failed to create key:",e),e}},td=async(e,t,r,n=!1)=>{try{let o;console.log("Form Values in userUpdateUserCall:",t);let a=$?`${$}/user/bulk_update`:"/user/bulk_update";if(n)o=JSON.stringify({all_users:!0,user_updates:t});else if(r&&r.length>0){let e=[];for(let n of r)e.push({user_id:n,...t});o=JSON.stringify({users:e})}else throw Error("Must provide either userIds or set allUsers=true");let i=await fetch(a,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:o});if(!i.ok){let e=await i.json(),t=nx(e);throw j(t),Error(t)}let l=await i.json();return console.log("API Response:",l),l}catch(e){throw console.error("Failed to create key:",e),e}},tf=async(e,t)=>{try{let r=$?`${$}/health/services?service=${t}`:`/health/services?service=${t}`;console.log("Checking Slack Budget Alerts service health");let n=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.text();throw j(e),Error(e)}return await n.json()}catch(e){throw console.error("Failed to perform health check:",e),e}},tp=async e=>{try{let t=$?`${$}/budget/list`:"/budget/list",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nx(e);throw j(t),Error(t)}return await r.json()}catch(e){throw console.error("Failed to get callbacks:",e),e}},tm=async(e,t,r)=>{try{let t=$?`${$}/get/config/callbacks`:"/get/config/callbacks",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nx(e);throw j(t),Error(t)}return await r.json()}catch(e){throw console.error("Failed to get callbacks:",e),e}},th=async e=>{try{let t=$?`${$}/config/list?config_type=general_settings`:"/config/list?config_type=general_settings",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nx(e);throw j(t),Error(t)}return await r.json()}catch(e){throw console.error("Failed to get callbacks:",e),e}},tg=async e=>{try{let t=$?`${$}/router/settings`:"/router/settings",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nx(e);throw j(t),Error(t)}return await r.json()}catch(e){throw console.error("Failed to get router settings:",e),e}},tv=async e=>{try{let t=$?`${$}/cache/settings`:"/cache/settings",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nx(e);throw j(t),Error(t)}return await r.json()}catch(e){throw console.error("Failed to get cache settings:",e),e}},ty=async(e,t)=>{try{let r=$?`${$}/cache/settings/test`:"/cache/settings/test",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({cache_settings:t})});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to test cache connection:",e),e}},tb=async(e,t)=>{try{let r=$?`${$}/cache/settings`:"/cache/settings",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({cache_settings:t})});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to update cache settings:",e),e}},tw=async(e,t)=>{try{let r=$?`${$}/config/pass_through_endpoint`:"/config/pass_through_endpoint";t&&(r+=`/team/${t}`);let n=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to get callbacks:",e),e}},t$=async(e,t)=>{try{let r=$?`${$}/config/field/info?field_name=${t}`:`/config/field/info?field_name=${t}`,n=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to set callbacks:",e),e}},tC=async(e,t)=>{try{let r=$?`${$}/config/pass_through_endpoint`:"/config/pass_through_endpoint",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({...t})});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to set callbacks:",e),e}},tE=async(e,t,r)=>{try{let n=$?`${$}/config/field/update`:"/config/field/update",o=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({field_name:t,field_value:r,config_type:"general_settings"})});if(!o.ok){let e=await o.json(),t=nx(e);throw j(t),Error(t)}let a=await o.json();return g.default.success("Successfully updated value!"),a}catch(e){throw console.error("Failed to set callbacks:",e),e}},tS=async(e,t)=>{try{let r=$?`${$}/config/field/delete`:"/config/field/delete",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({field_name:t,config_type:"general_settings"})});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}let o=await n.json();return g.default.success("Field reset on proxy"),o}catch(e){throw console.error("Failed to get callbacks:",e),e}},tx=async(e,t)=>{try{let r=$?`${$}/config/pass_through_endpoint?endpoint_id=${t}`:`/config/pass_through_endpoint?endpoint_id=${t}`,n=await fetch(r,{method:"DELETE",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to get callbacks:",e),e}},tj=async(e,t)=>{try{let r=$?`${$}/config/update`:"/config/update",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({...t})});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to set callbacks:",e),e}},tO=async(e,t)=>{try{let r=$?`${$}/health?model_id=${encodeURIComponent(t)}`:`/health?model_id=${encodeURIComponent(t)}`,n=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error(`Failed to call /health for model id ${t}:`,e),e}},tk=async e=>{try{let t=$?`${$}/cache/ping`:"/cache/ping",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.text();throw j(e),Error(e)}return await r.json()}catch(e){throw console.error("Failed to call /cache/ping:",e),e}},tT=async e=>{try{let t=$?`${$}/health/latest`:"/health/latest",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.text();throw j(e),Error(e)}return await r.json()}catch(e){throw console.error("Failed to call /health/latest:",e),e}},tF=async e=>{try{console.log("Getting proxy UI settings"),console.log("proxyBaseUrl in getProxyUISettings:",$);let t=$?`${$}/sso/get/ui_settings`:"/sso/get/ui_settings",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nx(e);throw j(t),Error(t)}return await r.json()}catch(e){throw console.error("Failed to get callbacks:",e),e}},t_=async e=>{try{let t=$?`${$}/get/ui_settings`:"/get/ui_settings",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nx(e);return console.error("Failed to get UI settings:",t),null}return await r.json()}catch(e){return console.error("Failed to get UI settings:",e),null}},tI=async e=>{try{let t=$?`${$}/get/mcp_semantic_filter_settings`:"/get/mcp_semantic_filter_settings",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nx(e);throw j(t),Error(t)}return await r.json()}catch(e){throw console.error("Failed to get MCP semantic filter settings:",e),e}},tP=async(e,t)=>{try{let r=$?`${$}/update/mcp_semantic_filter_settings`:"/update/mcp_semantic_filter_settings",n=await fetch(r,{method:"PATCH",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to update MCP semantic filter settings:",e),e}},tN=async(e,t,r)=>{try{let n=$?`${$}/v1/responses`:"/v1/responses",o=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({model:t,input:[{role:"user",content:r,type:"message"}],tools:[{type:"mcp",server_url:"litellm_proxy",require_approval:"never"}],tool_choice:"required"})}),a=o.headers.get("x-litellm-semantic-filter"),i=o.headers.get("x-litellm-semantic-filter-tools");if(!o.ok){let e=await o.json(),t=nx(e);throw j(t),Error(t)}return{data:await o.json(),headers:{filter:a,tools:i}}}catch(e){throw console.error("Failed to test MCP semantic filter:",e),e}},tR=async e=>{try{let t=$?`${$}/v2/guardrails/list`:"/v2/guardrails/list",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok)throw Error(`v2 guardrails/list returned ${r.status}`);return await r.json()}catch(t){console.log("v2/guardrails/list failed, falling back to v1:",t);try{let t=$?`${$}/guardrails/list`:"/guardrails/list",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nx(e);throw j(t),Error(t)}return await r.json()}catch(e){throw console.error("Failed to get guardrails list:",e),e}}},tM=async(e,t)=>{let r=$?`${$}/guardrails/submissions`:"/guardrails/submissions",n=new URLSearchParams;t?.status&&n.set("status",t.status),t?.team_id&&n.set("team_id",t.team_id),t?.team_guardrail!==void 0&&n.set("team_guardrail",String(t.team_guardrail)),t?.search&&n.set("search",t.search);let o=n.toString()?`${r}?${n.toString()}`:r,a=await fetch(o,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!a.ok){let e=nx(await a.json().catch(()=>({})));throw j(e),Error(e)}return a.json()},tB=async(e,t)=>{let r=$?`${$}/guardrails/submissions/${encodeURIComponent(t)}/approve`:`/guardrails/submissions/${encodeURIComponent(t)}/approve`,n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=nx(await n.json().catch(()=>({})));throw j(e),Error(e)}return n.json()},tA=async(e,t)=>{let r=$?`${$}/guardrails/submissions/${encodeURIComponent(t)}/reject`:`/guardrails/submissions/${encodeURIComponent(t)}/reject`,n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=nx(await n.json().catch(()=>({})));throw j(e),Error(e)}return n.json()},tz=async(e,t,r)=>{try{let n=$?`${$}/guardrails/usage/overview`:"/guardrails/usage/overview",o=new URLSearchParams;t&&o.append("start_date",t),r&&o.append("end_date",r),o.toString()&&(n+=`?${o.toString()}`);let a=await fetch(n,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!a.ok){let e=await a.json();throw Error(nx(e))}return a.json()}catch(e){throw console.error("Failed to get guardrails usage overview:",e),e}},tL=async(e,t,r,n)=>{try{let o=$?`${$}/guardrails/usage/detail/${encodeURIComponent(t)}`:`/guardrails/usage/detail/${encodeURIComponent(t)}`,a=new URLSearchParams;r&&a.append("start_date",r),n&&a.append("end_date",n),a.toString()&&(o+=`?${a.toString()}`);let i=await fetch(o,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!i.ok){let e=await i.json();throw Error(nx(e))}return i.json()}catch(e){throw console.error("Failed to get guardrails usage detail:",e),e}},tH=async(e,t)=>{try{let r=$?`${$}/guardrails/usage/logs`:"/guardrails/usage/logs",n=new URLSearchParams;t.guardrailId&&n.append("guardrail_id",t.guardrailId),t.policyId&&n.append("policy_id",t.policyId),null!=t.page&&n.append("page",String(t.page)),null!=t.pageSize&&n.append("page_size",String(t.pageSize)),t.action&&n.append("action",t.action),t.startDate&&n.append("start_date",t.startDate),t.endDate&&n.append("end_date",t.endDate),n.toString()&&(r+=`?${n.toString()}`);let o=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!o.ok){let e=await o.json();throw Error(nx(e))}return o.json()}catch(e){throw console.error("Failed to get guardrails usage logs:",e),e}},tD=async e=>{try{let t=$?`${$}/policies/list`:"/policies/list",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nx(e);throw j(t),Error(t)}return await r.json()}catch(e){throw console.error("Failed to get policies list:",e),e}},tV=async(e,t,r)=>{try{let n=$?`${$}/utils/test_policies_and_guardrails`:"/utils/test_policies_and_guardrails",o=await fetch(n,{method:"POST",signal:r,headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({policy_names:t.policy_names??null,guardrail_names:t.guardrail_names??null,inputs:t.inputs??null,inputs_list:t.inputs_list??null,request_data:t.request_data??{},input_type:t.input_type??"request",agent_id:t.agent_id??null})});if(!o.ok){let e=await o.text(),t="Failed to test policies and guardrails";try{let r=JSON.parse(e);r.detail?t="string"==typeof r.detail?r.detail:JSON.stringify(r.detail):r.message&&(t=r.message)}catch{t=e||t}throw j(t),Error(t)}return await o.json()}catch(e){throw console.error("Failed to test policies and guardrails:",e),e}},tW=async(e,t)=>{try{let r=$?`${$}/policy/info/${t}`:`/policy/info/${t}`,n=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error(`Failed to get policy info for ${t}:`,e),e}},tG=async e=>{try{let t=$?`${$}/policy/templates`:"/policy/templates",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nx(e);throw j(t),Error(t)}return await r.json()}catch(e){throw console.error("Failed to get policy templates:",e),e}},tU=async(e,t,r,n,o)=>{try{let a=$?`${$}/policy/templates/enrich`:"/policy/templates/enrich",i={template_id:t,parameters:r};n&&(i.model=n),o&&(i.competitors=o);let l=await fetch(a,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(i)});if(!l.ok){let e=await l.json(),t=nx(e);throw j(t),Error(t)}return await l.json()}catch(e){throw console.error("Failed to enrich policy template:",e),e}},tq=async(e,t,r,n)=>{try{let o=$?`${$}/policy/templates/suggest`:"/policy/templates/suggest",a=await fetch(o,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({attack_examples:t.filter(e=>e.trim()),description:r,model:n})});if(!a.ok){let e=await a.json(),t=nx(e);throw j(t),Error(t)}return a.json()}catch(e){throw console.error("Failed to suggest policy templates:",e),e}},tJ=async(e,t,r)=>{try{let n=$?`${$}/policy/templates/test`:"/policy/templates/test",o=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({guardrail_definitions:t,text:r})});if(!o.ok){let e=await o.json(),t=nx(e);throw j(t),Error(t)}return o.json()}catch(e){throw console.error("Failed to test policy template:",e),e}},tK=async(e,t,r,n,o,a,i,l,s)=>{let c=$?`${$}/policy/templates/enrich/stream`:"/policy/templates/enrich/stream",u={template_id:t,parameters:r,model:n};l?.instruction&&(u.instruction=l.instruction),l?.existingCompetitors&&(u.competitors=l.existingCompetitors);let d=await fetch(c,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(u)});if(!d.ok){let e=nx(await d.json());throw j(e),Error(e)}let f=d.body?.getReader();if(!f)throw Error("No response body");let p=new TextDecoder,m="";for(;;){let{done:e,value:t}=await f.read();if(e)break;let r=(m+=p.decode(t,{stream:!0})).split("\n");for(let e of(m=r.pop()||"",r))if(e.startsWith("data: "))try{let t=JSON.parse(e.slice(6));"competitor"===t.type?o(t.name):"status"===t.type?s?.(t.message):"done"===t.type?a(t):"error"===t.type&&i?.(t.message)}catch{}}},tX=async(e,t,r,n,o,a,i,l,s)=>{let c=$?`${$}/usage/ai/chat`:"/usage/ai/chat",u=await fetch(c,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({messages:t,model:r}),signal:s});if(!u.ok){let e=nx(await u.json());throw j(e),Error(e)}let d=u.body?.getReader();if(!d)throw Error("No response body");let f=new TextDecoder,p="";for(;;){let{done:e,value:t}=await d.read();if(e)break;let r=(p+=f.decode(t,{stream:!0})).split("\n");for(let e of(p=r.pop()||"",r))if(e.startsWith("data: "))try{let t=JSON.parse(e.slice(6));"chunk"===t.type?n(t.content):"status"===t.type?i?.(t.message):"tool_call"===t.type?l?.(t):"done"===t.type?o():"error"===t.type&&a?.(t.message)}catch{}}},tY=async(e,t)=>{try{let r=$?`${$}/policies`:"/policies",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to create policy:",e),e}},tZ=async(e,t,r)=>{try{let n=$?`${$}/policies/${t}`:`/policies/${t}`,o=await fetch(n,{method:"PUT",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(r)});if(!o.ok){let e=await o.json(),t=nx(e);throw j(t),Error(t)}return await o.json()}catch(e){throw console.error("Failed to update policy:",e),e}},tQ=async(e,t)=>{try{let r=encodeURIComponent(t),n=$?`${$}/policies/name/${r}/versions`:`/policies/name/${r}/versions`,o=await fetch(n,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!o.ok){let e=await o.json(),t=nx(e);throw j(t),Error(t)}return await o.json()}catch(e){throw console.error("Failed to list policy versions:",e),e}},t0=async(e,t,r)=>{try{let n=encodeURIComponent(t),o=$?`${$}/policies/name/${n}/versions`:`/policies/name/${n}/versions`,a=await fetch(o,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({source_policy_id:r??void 0})});if(!a.ok){let e=await a.json(),t=nx(e);throw j(t),Error(t)}return await a.json()}catch(e){throw console.error("Failed to create policy version:",e),e}},t1=async(e,t,r)=>{try{let n=$?`${$}/policies/${t}/status`:`/policies/${t}/status`,o=await fetch(n,{method:"PUT",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({version_status:r})});if(!o.ok){let e=await o.json(),t=nx(e);throw j(t),Error(t)}return await o.json()}catch(e){throw console.error("Failed to update policy version status:",e),e}},t2=async(e,t)=>{try{let r=$?`${$}/policies/${t}`:`/policies/${t}`,n=await fetch(r,{method:"DELETE",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to delete policy:",e),e}},t4=async(e,t)=>{try{let r=$?`${$}/policies/${t}`:`/policies/${t}`,n=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to get policy info:",e),e}},t6=async e=>{try{let t=$?`${$}/policies/attachments/list`:"/policies/attachments/list",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nx(e);throw j(t),Error(t)}return await r.json()}catch(e){throw console.error("Failed to get policy attachments list:",e),e}},t3=async(e,t)=>{try{let r=$?`${$}/policies/attachments`:"/policies/attachments",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to create policy attachment:",e),e}},t7=async(e,t)=>{try{let r=$?`${$}/policies/attachments/${t}`:`/policies/attachments/${t}`,n=await fetch(r,{method:"DELETE",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to delete policy attachment:",e),e}},t5=async(e,t,r)=>{try{let n=$?`${$}/policies/test-pipeline`:"/policies/test-pipeline",o=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({pipeline:t,test_messages:r})});if(!o.ok){let e=await o.json(),t=nx(e);throw j(t),Error(t)}return await o.json()}catch(e){throw console.error("Failed to test pipeline:",e),e}},t9=async(e,t)=>{try{let r=$?`${$}/policies/${t}/resolved-guardrails`:`/policies/${t}/resolved-guardrails`,n=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to get resolved guardrails:",e),e}},t8=async(e,t)=>{try{let r=$?`${$}/policies/resolve`:"/policies/resolve",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to resolve policies:",e),e}},re=async(e,t)=>{try{let r=$?`${$}/policies/attachments/estimate-impact`:"/policies/attachments/estimate-impact",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to estimate attachment impact:",e),e}},rt=async e=>{try{let t=$?`${$}/prompts/list`:"/prompts/list",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nx(e);throw j(t),Error(t)}return await r.json()}catch(e){throw console.error("Failed to get prompts list:",e),e}},rr=async(e,t)=>{try{let r=$?`${$}/prompts/${t}/info`:`/prompts/${t}/info`,n=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to get prompt info:",e),e}},rn=async(e,t)=>{try{let r=$?`${$}/prompts/${t}/versions`:`/prompts/${t}/versions`,n=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nx(e);throw 404!==n.status&&j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to get prompt versions:",e),e}},ro=async(e,t)=>{try{let r=$?`${$}/prompts`:"/prompts",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to create prompt:",e),e}},ra=async(e,t,r)=>{try{let n=$?`${$}/prompts/${t}`:`/prompts/${t}`,o=await fetch(n,{method:"PUT",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(r)});if(!o.ok){let e=await o.json(),t=nx(e);throw j(t),Error(t)}return await o.json()}catch(e){throw console.error("Failed to update prompt:",e),e}},ri=async(e,t)=>{try{let r=$?`${$}/prompts/${t}`:`/prompts/${t}`,n=await fetch(r,{method:"DELETE",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to delete prompt:",e),e}},rl=async(e,t)=>{try{let r=new FormData;r.append("file",t);let n=$?`${$}/utils/dotprompt_json_converter`:"/utils/dotprompt_json_converter",o=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`},body:r});if(!o.ok){let e=await o.json(),t=nx(e);throw j(t),Error(t)}return await o.json()}catch(e){throw console.error("Failed to convert prompt file:",e),e}},rs=async(e,t)=>{try{let r=$?`${$}/v1/agents`:"/v1/agents",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({...t})});if(!n.ok){let e=await n.text();throw j(e),Error(e)}let o=await n.json();return console.log("Create agent response:",o),o}catch(e){throw console.error("Failed to create agent:",e),e}},rc=async(e,t)=>{try{let r=$?`${$}/guardrails`:"/guardrails",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({guardrail:t})});if(!n.ok){let e=await n.text();throw j(e),Error(e)}let o=await n.json();return console.log("Create guardrail response:",o),o}catch(e){throw console.error("Failed to create guardrail:",e),e}},ru=async(e,t,r)=>{try{let n=$?`${$}/spend/logs/ui/${t}?start_date=${encodeURIComponent(r)}`:`/spend/logs/ui/${t}?start_date=${encodeURIComponent(r)}`;console.log("Fetching log details from:",n);let o=await fetch(n,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!o.ok){let e=await o.json(),t=nx(e);throw j(t),Error(t)}let a=await o.json();return console.log("Fetched log details:",a),a}catch(e){throw console.error("Failed to fetch log details:",e),e}},rd=async e=>{try{let t=$?`${$}/get/internal_user_settings`:"/get/internal_user_settings";console.log("Fetching SSO settings from:",t);let r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nx(e);throw j(t),Error(t)}let n=await r.json();return console.log("Fetched SSO settings:",n),n}catch(e){throw console.error("Failed to fetch SSO settings:",e),e}},rf=async(e,t)=>{try{let r=$?`${$}/update/internal_user_settings`:"/update/internal_user_settings";console.log("Updating internal user settings:",t);let n=await fetch(r,{method:"PATCH",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){let e=await n.text();throw j(e),Error(e)}let o=await n.json();return console.log("Updated internal user settings:",o),g.default.success("Internal user settings updated successfully"),o}catch(e){throw console.error("Failed to update internal user settings:",e),e}},rp=async e=>{try{let t=$?`${$}/v1/mcp/openapi-registry`:"/v1/mcp/openapi-registry",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json();throw Error(nx(e))}return await r.json()}catch(e){throw console.error("Failed to fetch OpenAPI registry:",e),e}},rm=async e=>{try{let t=$?`${$}/v1/mcp/discover`:"/v1/mcp/discover",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nx(e);throw j(t),Error(t)}return await r.json()}catch(e){throw console.error("Failed to fetch discoverable MCP servers:",e),e}},rh=async(e,t)=>{try{let r=$?`${$}/v1/mcp/server`:"/v1/mcp/server";if(t){let e=new URLSearchParams;e.append("team_id",t),r=`${r}?${e.toString()}`}console.log("Fetching MCP servers from:",r);let n=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}let o=await n.json();return console.log("Fetched MCP servers:",o),o}catch(e){throw console.error("Failed to fetch MCP servers:",e),e}},rg=async(e,t)=>{try{let r=$?`${$}/v1/mcp/server/health`:"/v1/mcp/server/health";if(t&&t.length>0){let e=new URLSearchParams;t.forEach(t=>e.append("server_ids",t)),r=`${r}?${e.toString()}`}console.log("Fetching MCP server health from:",r);let n=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}let o=await n.json();return console.log("Fetched MCP server health:",o),o}catch(e){throw console.error("Failed to fetch MCP server health:",e),e}},rv=async e=>{try{let t=$?`${$}/v1/mcp/access_groups`:"/v1/mcp/access_groups";console.log("Fetching MCP access groups from:",t);let r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nx(e);throw j(t),Error(t)}let n=await r.json();return console.log("Fetched MCP access groups:",n),n.access_groups||[]}catch(e){throw console.error("Failed to fetch MCP access groups:",e),e}},ry=async e=>{try{let t=$?`${$}/v1/mcp/network/client-ip`:"/v1/mcp/network/client-ip",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`}});if(!r.ok)return null;return(await r.json()).ip||null}catch{return null}},rb=async(e,t)=>{try{console.log("Form Values in createMCPServer:",t);let r=$?`${$}/v1/mcp/server`:"/v1/mcp/server",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({...t})});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}let o=await n.json();return console.log("API Response:",o),o}catch(e){throw console.error("Failed to create key:",e),e}},rw=async(e,t)=>{try{let r=$?`${$}/v1/mcp/server`:"/v1/mcp/server",n=await fetch(r,{method:"PUT",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to update MCP server:",e),e}},r$=async(e,t)=>{try{let r=($?`${$}`:"")+`/v1/mcp/server/${t}`;console.log("in deleteMCPServer:",t);let n=await fetch(r,{method:S,headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}}catch(e){throw console.error("Failed to delete key:",e),e}},rC=async(e,t)=>{try{let r=($?`${$}`:"")+"/v1/mcp/server/register",n=await fetch(r,{method:E,headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}return n.json()}catch(e){throw console.error("Failed to register MCP server:",e),e}},rE=async e=>{try{let t=($?`${$}`:"")+"/v1/mcp/server/submissions",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json().catch(()=>({})),t=nx(e);throw j(t),Error(t)}return r.json()}catch(e){throw console.error("Failed to fetch MCP submissions:",e),e}},rS=async(e,t)=>{try{let r=($?`${$}`:"")+`/v1/mcp/server/${encodeURIComponent(t)}/approve`,n=await fetch(r,{method:"PUT",headers:{[T]:`Bearer ${e}`}});if(!n.ok){let e=await n.json().catch(()=>({})),t=nx(e);throw j(t),Error(t)}return n.json()}catch(e){throw console.error("Failed to approve MCP server:",e),e}},rx=async(e,t,r)=>{try{let n=($?`${$}`:"")+`/v1/mcp/server/${encodeURIComponent(t)}/reject`,o=await fetch(n,{method:"PUT",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({review_notes:r??null})});if(!o.ok){let e=await o.json().catch(()=>({})),t=nx(e);throw j(t),Error(t)}return o.json()}catch(e){throw console.error("Failed to reject MCP server:",e),e}},rj=async e=>{try{let t=$?`${$}/search_tools/list`:"/search_tools/list";console.log("Fetching search tools from:",t);let r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nx(e);throw j(t),Error(t)}let n=await r.json();return console.log("Fetched search tools:",n),n}catch(e){throw console.error("Failed to fetch search tools:",e),e}},rO=async(e,t)=>{try{console.log("Creating search tool with values:",t);let r=$?`${$}/search_tools`:"/search_tools",n=await fetch(r,{method:E,headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({search_tool:t})});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}let o=await n.json();return console.log("Created search tool:",o),o}catch(e){throw console.error("Failed to create search tool:",e),e}},rk=async(e,t,r)=>{try{console.log("Updating search tool with ID:",t,"values:",r);let n=$?`${$}/search_tools/${t}`:`/search_tools/${t}`,o=await fetch(n,{method:"PUT",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({search_tool:r})});if(!o.ok){let e=await o.json(),t=nx(e);throw j(t),Error(t)}let a=await o.json();return console.log("Updated search tool:",a),a}catch(e){throw console.error("Failed to update search tool:",e),e}},rT=async(e,t)=>{try{let r=($?`${$}`:"")+`/search_tools/${t}`;console.log("Deleting search tool:",t);let n=await fetch(r,{method:S,headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}let o=await n.json();return console.log("Deleted search tool:",o),o}catch(e){throw console.error("Failed to delete search tool:",e),e}},rF=async e=>{try{let t=$?`${$}/search_tools/ui/available_providers`:"/search_tools/ui/available_providers";console.log("Fetching available search providers from:",t);let r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nx(e);throw j(t),Error(t)}let n=await r.json();return console.log("Fetched available search providers:",n),n}catch(e){throw console.error("Failed to fetch available search providers:",e),e}},r_=async(e,t)=>{try{let r=$?`${$}/search_tools/test_connection`:"/search_tools/test_connection";console.log("Testing search tool connection:",r);let n=await fetch(r,{method:E,headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({litellm_params:t})});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}let o=await n.json();return console.log("Test connection response:",o),o}catch(e){throw console.error("Failed to test search tool connection:",e),e}},rI=async(e,t,r)=>{try{let n=$?`${$}/mcp-rest/tools/list?server_id=${t}`:`/mcp-rest/tools/list?server_id=${t}`;console.log("Fetching MCP tools from:",n);let o={[T]:`Bearer ${e}`,"Content-Type":"application/json",...r},a=await fetch(n,{method:"GET",headers:o}),i=await a.json();if(console.log("Fetched MCP tools response:",i),!a.ok){if(i.error&&i.message)throw Error(i.message);throw Error("Failed to fetch MCP tools")}return i}catch(e){return console.error("Failed to fetch MCP tools:",e),{tools:[],error:"network_error",message:e instanceof Error?e.message:"Failed to fetch MCP tools",stack_trace:null}}},rP=async(e,t,r,n,o)=>{try{let a=$?`${$}/mcp-rest/tools/call`:"/mcp-rest/tools/call";console.log("Calling MCP tool:",r,"with arguments:",n,"for server:",t);let i={[T]:`Bearer ${e}`,"Content-Type":"application/json",...o?.customHeaders||{}},l={server_id:t,name:r,arguments:n};o?.guardrails&&o.guardrails.length>0&&(l.litellm_metadata={guardrails:o.guardrails});let s=await fetch(a,{method:"POST",headers:i,body:JSON.stringify(l)});if(!s.ok){let e="Network response was not ok",t=null,r=await s.text();try{let n=JSON.parse(r);n.detail?"string"==typeof n.detail?e=n.detail:"object"==typeof n.detail&&(e=n.detail.message||n.detail.error||"An error occurred",t=n.detail):e=n.message||n.error||e}catch(t){console.error("Failed to parse JSON error response:",t),r&&(e=r)}let n=Error(e);throw n.status=s.status,n.statusText=s.statusText,n.details=t,j(e),n}let c=await s.json();return console.log("MCP tool call response:",c),c}catch(e){throw console.error("Failed to call MCP tool:",e),console.error("Error type:",typeof e),e instanceof Error&&(console.error("Error message:",e.message),console.error("Error stack:",e.stack)),e}},rN=async(e,t)=>{try{let r=$?`${$}/tag/new`:"/tag/new",n=await fetch(r,{method:"POST",headers:{"Content-Type":"application/json",[T]:`Bearer ${e}`},body:JSON.stringify(t)});if(!n.ok){let e=await n.text();await j(e);return}return await n.json()}catch(e){throw console.error("Error creating tag:",e),e}},rR=async(e,t)=>{try{let r=$?`${$}/tag/update`:"/tag/update",n=await fetch(r,{method:"POST",headers:{"Content-Type":"application/json",[T]:`Bearer ${e}`},body:JSON.stringify(t)});if(!n.ok){let e=await n.text();await j(e);return}return await n.json()}catch(e){throw console.error("Error updating tag:",e),e}},rM=async(e,t)=>{try{let r=$?`${$}/tag/info`:"/tag/info",n=await fetch(r,{method:"POST",headers:{"Content-Type":"application/json",[T]:`Bearer ${e}`},body:JSON.stringify({names:t})});if(!n.ok){let e=await n.text();return await j(e),{}}return await n.json()}catch(e){throw console.error("Error getting tag info:",e),e}},rB=async e=>{try{let t=$?`${$}/tag/list`:"/tag/list",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`}});if(!r.ok){let e=await r.text();return await j(e),{}}return await r.json()}catch(e){throw console.error("Error listing tags:",e),e}},rA=async(e,t)=>{try{let r=$?`${$}/tag/delete`:"/tag/delete",n=await fetch(r,{method:"POST",headers:{"Content-Type":"application/json",[T]:`Bearer ${e}`},body:JSON.stringify({name:t})});if(!n.ok){let e=await n.text();await j(e);return}return await n.json()}catch(e){throw console.error("Error deleting tag:",e),e}},rz=async e=>{try{let t=$?`${$}/get/default_team_settings`:"/get/default_team_settings";console.log("Fetching default team settings from:",t);let r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nx(e);throw j(t),Error(t)}let n=await r.json();return console.log("Fetched default team settings:",n),n}catch(e){throw console.error("Failed to fetch default team settings:",e),e}},rL=async(e,t)=>{try{let r=$?`${$}/update/default_team_settings`:"/update/default_team_settings";console.log("Updating default team settings:",t);let n=await fetch(r,{method:"PATCH",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}let o=await n.json();return console.log("Updated default team settings:",o),g.default.success("Default team settings updated successfully"),o}catch(e){throw console.error("Failed to update default team settings:",e),e}},rH=async(e,t)=>{try{let r=$?`${$}/team/permissions_list?team_id=${t}`:`/team/permissions_list?team_id=${t}`,n=await fetch(r,{method:"GET",headers:{"Content-Type":"application/json",[T]:`Bearer ${e}`}});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}let o=await n.json();return console.log("Team permissions response:",o),o}catch(e){throw console.error("Failed to get team permissions:",e),e}},rD=async(e,t,r)=>{try{let n=$?`${$}/team/permissions_update`:"/team/permissions_update",o=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json",[T]:`Bearer ${e}`},body:JSON.stringify({team_id:t,team_member_permissions:r})});if(!o.ok){let e=await o.json(),t=nx(e);throw j(t),Error(t)}let a=await o.json();return console.log("Team permissions response:",a),a}catch(e){throw console.error("Failed to update team permissions:",e),e}},rV=async(e,t)=>{try{let r=$?`${$}/spend/logs/session/ui?session_id=${encodeURIComponent(t)}`:`/spend/logs/session/ui?session_id=${encodeURIComponent(t)}`,n=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to fetch session logs:",e),e}},rW=async(e,t)=>{try{let r=$?`${$}/vector_store/new`:"/vector_store/new",n=await fetch(r,{method:"POST",headers:{"Content-Type":"application/json",[T]:`Bearer ${e}`},body:JSON.stringify(t)});if(!n.ok){let e=await n.json();throw Error(e.detail||"Failed to create vector store")}return await n.json()}catch(e){throw console.error("Error creating vector store:",e),e}},rG=async(e,t=1,r=100)=>{try{let t=$?`${$}/vector_store/list`:"/vector_store/list",r=await fetch(t,{method:"GET",headers:{"Content-Type":"application/json",[T]:`Bearer ${e}`}});if(!r.ok){let e=await r.json();throw Error(e.detail||"Failed to list vector stores")}return await r.json()}catch(e){throw console.error("Error listing vector stores:",e),e}},rU=async(e,t)=>{try{let r=$?`${$}/vector_store/delete`:"/vector_store/delete",n=await fetch(r,{method:"POST",headers:{"Content-Type":"application/json",[T]:`Bearer ${e}`},body:JSON.stringify({vector_store_id:t})});if(!n.ok){let e=await n.json();throw Error(e.detail||"Failed to delete vector store")}return await n.json()}catch(e){throw console.error("Error deleting vector store:",e),e}},rq=async(e,t)=>{try{let r=$?`${$}/vector_store/info`:"/vector_store/info",n=await fetch(r,{method:"POST",headers:{"Content-Type":"application/json",[T]:`Bearer ${e}`},body:JSON.stringify({vector_store_id:t})});if(!n.ok){let e=await n.json();throw Error(e.detail||"Failed to get vector store info")}return await n.json()}catch(e){throw console.error("Error getting vector store info:",e),e}},rJ=async(e,t)=>{try{let r=$?`${$}/vector_store/update`:"/vector_store/update",n=await fetch(r,{method:"POST",headers:{"Content-Type":"application/json",[T]:`Bearer ${e}`},body:JSON.stringify(t)});if(!n.ok){let e=await n.json();throw Error(e.detail||"Failed to update vector store")}return await n.json()}catch(e){throw console.error("Error updating vector store:",e),e}},rK=async(e,t,r,n,o,a,i)=>{try{let l=$?`${$}/rag/ingest`:"/rag/ingest",s=new FormData;s.append("file",t);let c={ingest_options:{vector_store:{custom_llm_provider:r,...n&&{vector_store_id:n},...i&&i}}};(o||a)&&(c.ingest_options.litellm_vector_store_params={},o&&(c.ingest_options.litellm_vector_store_params.vector_store_name=o),a&&(c.ingest_options.litellm_vector_store_params.vector_store_description=a)),s.append("request",JSON.stringify(c));let u=await fetch(l,{method:"POST",headers:{[T]:`Bearer ${e}`},body:s});if(!u.ok){let e=await u.json();throw Error(e.error?.message||e.detail||"Failed to ingest document")}return await u.json()}catch(e){throw console.error("Error ingesting document:",e),e}},rX=async e=>{try{let t=$?`${$}/email/event_settings`:"/email/event_settings",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.text();throw j(e),Error("Failed to get email event settings")}let n=await r.json();return console.log("Email event settings response:",n),n}catch(e){throw console.error("Failed to get email event settings:",e),e}},rY=async(e,t)=>{try{let r=$?`${$}/email/event_settings`:"/email/event_settings",n=await fetch(r,{method:"PATCH",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){let e=await n.text();throw j(e),Error("Failed to update email event settings")}let o=await n.json();return console.log("Update email event settings response:",o),o}catch(e){throw console.error("Failed to update email event settings:",e),e}},rZ=async e=>{try{let t=$?`${$}/email/event_settings/reset`:"/email/event_settings/reset",r=await fetch(t,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.text();throw j(e),Error("Failed to reset email event settings")}let n=await r.json();return console.log("Reset email event settings response:",n),n}catch(e){throw console.error("Failed to reset email event settings:",e),e}},rQ=async(e,t)=>{try{let r=$?`${$}/v1/agents/${t}`:`/v1/agents/${t}`,n=await fetch(r,{method:"DELETE",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.text();throw j(e),Error(e)}let o=await n.json();return console.log("Delete agent response:",o),o}catch(e){throw console.error("Failed to delete agent:",e),e}},r0=async(e,t)=>{try{let r=$?`${$}/v1/agents/make_public`:"/v1/agents/make_public",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({agent_ids:t})});if(!n.ok){let e=await n.text();throw j(e),Error(e)}let o=await n.json();return console.log("Make agents public response:",o),o}catch(e){throw console.error("Failed to make agents public:",e),e}},r1=async(e,t)=>{try{let r=$?`${$}/v1/mcp/make_public`:"/v1/mcp/make_public",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({mcp_server_ids:t})});if(!n.ok){let e=await n.text();throw j(e),Error(e)}let o=await n.json();return console.log("Make agents public response:",o),o}catch(e){throw console.error("Failed to make agents public:",e),e}},r2=async(e,t)=>{try{let r=$?`${$}/guardrails/${t}`:`/guardrails/${t}`,n=await fetch(r,{method:"DELETE",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.text();throw j(e),Error(e)}let o=await n.json();return console.log("Delete guardrail response:",o),o}catch(e){throw console.error("Failed to delete guardrail:",e),e}},r4=async e=>{try{let t=$?`${$}/guardrails/ui/add_guardrail_settings`:"/guardrails/ui/add_guardrail_settings",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.text();throw j(e),Error("Failed to get guardrail UI settings")}let n=await r.json();return console.log("Guardrail UI settings response:",n),n}catch(e){throw console.error("Failed to get guardrail UI settings:",e),e}},r6=async e=>{try{let t=$?`${$}/guardrails/ui/provider_specific_params`:"/guardrails/ui/provider_specific_params",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.text();throw j(e),Error("Failed to get guardrail provider specific parameters")}let n=await r.json();return console.log("Guardrail provider specific params response:",n),n}catch(e){throw console.error("Failed to get guardrail provider specific parameters:",e),e}},r3=async(e,t)=>{try{let r=encodeURIComponent(t),n=$?`${$}/guardrails/ui/category_yaml/${r}`:`/guardrails/ui/category_yaml/${r}`;console.log(`Fetching category YAML from: ${n}`);let o=await fetch(n,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!o.ok){let e=await o.text();throw console.error(`Failed to get category YAML. Status: ${o.status}, Error:`,e),j(e),Error(`Failed to get category YAML: ${o.status} ${e}`)}let a=await o.json();return console.log("Category YAML response:",a),a}catch(e){throw console.error("Failed to get category YAML:",e),e}},r7=async e=>{try{let t=$?`${$}/guardrails/ui/major_airlines`:"/guardrails/ui/major_airlines",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.text();throw console.error(`Failed to get major airlines. Status: ${r.status}, Error:`,e),j(e),Error(`Failed to get major airlines: ${r.status} ${e}`)}return await r.json()}catch(e){throw console.error("Failed to get major airlines:",e),e}},r5=async(e,t=!1)=>{try{let r=t?"?health_check=true":"",n=$?`${$}/v1/agents${r}`:`/v1/agents${r}`,o=await fetch(n,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!o.ok){let e=await o.text();throw j(e),Error("Failed to get agents list")}let a=await o.json();return console.log("Agents list response:",a),{agents:a}}catch(e){throw console.error("Failed to get agents list:",e),e}},r9=async(e,t)=>{try{let r=$?`${$}/v1/agents/${t}`:`/v1/agents/${t}`,n=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.text();throw j(e),Error("Failed to get agent info")}let o=await n.json();return console.log("Agent info response:",o),o}catch(e){throw console.error("Failed to get agent info:",e),e}},r8=async(e,t)=>{try{let r=$?`${$}/guardrails/${t}/info`:`/guardrails/${t}/info`,n=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.text();throw j(e),Error("Failed to get guardrail info")}let o=await n.json();return console.log("Guardrail info response:",o),o}catch(e){throw console.error("Failed to get guardrail info:",e),e}},ne=async(e,t,r)=>{try{let n=$?`${$}/v1/agents/${t}`:`/v1/agents/${t}`,o=await fetch(n,{method:"PATCH",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(r)});if(!o.ok){let e=await o.text();throw j(e),Error("Failed to patch agent")}let a=await o.json();return console.log("Patch agent response:",a),a}catch(e){throw console.error("Failed to update guardrail:",e),e}},nt=async(e,t,r)=>{try{let n=$?`${$}/guardrails/${t}`:`/guardrails/${t}`,o=await fetch(n,{method:"PATCH",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(r)});if(!o.ok){let e=await o.text();throw j(e),Error("Failed to update guardrail")}let a=await o.json();return console.log("Update guardrail response:",a),a}catch(e){throw console.error("Failed to update guardrail:",e),e}},nr=async(e,t,r,n,o)=>{try{let a=$?`${$}/guardrails/apply_guardrail`:"/guardrails/apply_guardrail",i={guardrail_name:t,text:r};n&&(i.language=n),o&&o.length>0&&(i.entities=o);let l=await fetch(a,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(i)});if(!l.ok){let e=await l.text(),t="Failed to apply guardrail";try{let r=JSON.parse(e);r.error?.message?t=r.error.message:r.detail?t=r.detail:r.message&&(t=r.message)}catch(r){t=e||t}throw j(e),Error(t)}let s=await l.json();return console.log("Apply guardrail response:",s),s}catch(e){throw console.error("Failed to apply guardrail:",e),e}},nn=async(e,t)=>{try{let r=$?`${$}/guardrails/test_custom_code`:"/guardrails/test_custom_code",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){let e=await n.text(),t="Failed to test custom code guardrail";try{let r=JSON.parse(e);r.error?.message?t=r.error.message:r.detail?t=r.detail:r.message&&(t=r.message)}catch(r){t=e||t}throw j(e),Error(t)}let o=await n.json();return console.log("Test custom code guardrail response:",o),o}catch(e){throw console.error("Failed to test custom code guardrail:",e),e}},no=async(e,t)=>{try{let r=$?`${$}/guardrails/validate_blocked_words_file`:"/guardrails/validate_blocked_words_file",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({file_content:t})});if(!n.ok){let e=await n.text();throw j(e),Error("Failed to validate blocked words file")}let o=await n.json();return console.log("Validate blocked words file response:",o),o}catch(e){throw console.error("Failed to validate blocked words file:",e),e}},na=async e=>{try{let t=$?`${$}/get/sso_settings`:"/get/sso_settings";console.log("Fetching SSO configuration from:",t);let r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nx(e);throw j(t),Error(t)}let n=await r.json();return console.log("Fetched SSO configuration:",n),n}catch(e){throw console.error("Failed to fetch SSO configuration:",e),e}},ni=async(e,t)=>{try{let r=$?`${$}/update/sso_settings`:"/update/sso_settings";console.log("Updating SSO configuration:",t);let n=await fetch(r,{method:"PATCH",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){let e=await n.json(),t="object"==typeof e?.detail?e.detail?.error||e.detail?.message:e?.detail,r="string"==typeof t&&t.length>0?t:nx(e);j(r);let o=Error(r);throw e?.detail!==void 0&&(o.detail=e.detail),o.rawError=e,o}let o=await n.json();return console.log("Updated SSO configuration:",o),o}catch(e){throw console.error("Failed to update SSO configuration:",e),e}},nl=async({accessToken:e,page:t=1,page_size:r=50,params:n={}})=>{try{let o=$?`${$}/audit`:"/audit",a=new URLSearchParams;for(let[e,o]of(a.append("page",t.toString()),a.append("page_size",r.toString()),Object.entries(n)))null!=o&&""!==o&&a.append(e,String(o));o+=`?${a.toString()}`;let i=await fetch(o,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!i.ok){let e=await i.json(),t=nx(e);throw j(t),Error(t)}return await i.json()}catch(e){throw console.error("Failed to fetch audit logs:",e),e}},ns=async e=>{try{let t=$?`${$}/user/available_users`:"/user/available_users",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`}});if(!r.ok){if(404===r.status)return null;let e=await r.text();throw j(e),Error("Network response was not ok")}return await r.json()}catch(e){throw console.error("Failed to fetch remaining users:",e),e}},nc=async e=>{try{let t=$?`${$}/health/license`:"/health/license",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`}});if(!r.ok){if(404===r.status)return null;let e=await r.text();throw j(e),Error("Network response was not ok")}return await r.json()}catch(e){throw console.error("Failed to fetch license info:",e),e}},nu=async(e,t,r)=>{try{let n=$?`${$}/config/pass_through_endpoint/${encodeURIComponent(t)}`:`/config/pass_through_endpoint/${encodeURIComponent(t)}`,o=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(r)});if(!o.ok){let e=await o.json(),t=nx(e);throw j(t),Error(t)}let a=await o.json();return g.default.success("Pass through endpoint updated successfully"),a}catch(e){throw console.error("Failed to update pass through endpoint:",e),e}},nd=async(e,t)=>{try{let r=$?`${$}/config/callback/delete`:"/config/callback/delete",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({callback_name:t})});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to delete specific callback:",e),e}},nf=async(e,t,r)=>{try{console.log("Testing MCP tools list with config:",JSON.stringify(t));let n=$?`${$}/mcp-rest/test/tools/list`:"/mcp-rest/test/tools/list",o={"Content-Type":"application/json"};e&&(o["x-litellm-api-key"]=e),r?o.Authorization=`Bearer ${r}`:e&&(o[T]=`Bearer ${e}`);let a=await fetch(n,{method:"POST",headers:o,body:JSON.stringify(t)}),i=a.headers.get("content-type");if(!i||!i.includes("application/json")){let e=await a.text();throw console.error("Received non-JSON response:",e),Error(`Received non-JSON response (${a.status}: ${a.statusText}). Check network tab for details.`)}let l=await a.json();if((!a.ok||l.error)&&!l.error)return{tools:[],error:"request_failed",message:l.message||`MCP tools list failed: ${a.status} ${a.statusText}`};return l}catch(e){throw console.error("MCP tools list test error:",e),e}},np=async(e,t)=>{let r=$?`${$}/v1/mcp/server/oauth/session`:"/v1/mcp/server/oauth/session",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)}),o=await n.json();if(!n.ok)throw Error(nx(o)||o?.error||"Failed to cache MCP server");return o},nm=async(e,t,r)=>{let n=C(),o=encodeURIComponent(t.trim()),a=`${n}/v1/mcp/server/oauth/${o}/register`,i=await fetch(a,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json",Accept:"application/json, text/event-stream"},body:JSON.stringify(r)}),l=await i.json();if(!i.ok)throw Error(nx(l)||l?.detail||"Failed to register OAuth client");return l},nh=({serverId:e,clientId:t,redirectUri:r,state:n,codeChallenge:o,scope:a})=>{let i=C(),l=encodeURIComponent(e.trim()),s=`${i}/v1/mcp/server/oauth/${l}/authorize`,c=new URLSearchParams({redirect_uri:r,state:n,response_type:"code",code_challenge:o,code_challenge_method:"S256"});return t&&t.trim().length>0&&c.set("client_id",t),a&&a.trim().length>0&&c.set("scope",a),`${s}?${c.toString()}`},ng=async({serverId:e,code:t,clientId:r,clientSecret:n,codeVerifier:o,redirectUri:a})=>{let i=C(),l=encodeURIComponent(e.trim()),s=`${i}/v1/mcp/server/oauth/${l}/token`,c=new URLSearchParams;c.set("grant_type","authorization_code"),c.set("code",t),r&&r.trim().length>0&&c.set("client_id",r),n&&n.trim().length>0&&c.set("client_secret",n),c.set("code_verifier",o),c.set("redirect_uri",a);let u=await fetch(s,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:c.toString()}),d=await u.json();if(!u.ok)throw Error(nx(d)||d?.detail||"OAuth token exchange failed");return d},nv=async(e,t,r)=>{try{let n=`${C()}/v1/vector_stores/${t}/search`,o=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({query:r})});if(!o.ok){let e=await o.text();return await j(e),null}return await o.json()}catch(e){throw console.error("Error testing vector store search:",e),e}},ny=async(e,t,r,n)=>{try{let o=`${C()}/v1/search/${t}`,a=await fetch(o,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({query:r,max_results:n||5})});if(!a.ok){let e=await a.text();return await j(e),null}return await a.json()}catch(e){throw console.error("Error querying search tool:",e),e}},nb=async(e,t,r,n)=>{try{let o,a,i,l=$?`${$}/tag/dau`:"/tag/dau",s=new URLSearchParams;s.append("end_date",(o=t.getFullYear(),a=String(t.getMonth()+1).padStart(2,"0"),i=String(t.getDate()).padStart(2,"0"),`${o}-${a}-${i}`)),n&&n.length>0?n.forEach(e=>{s.append("tag_filters",e)}):r&&s.append("tag_filter",r);let c=s.toString();c&&(l+=`?${c}`);let u=await fetch(l,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!u.ok){let e=await u.json(),t=nx(e);throw j(t),Error(t)}return await u.json()}catch(e){throw console.error("Failed to fetch DAU:",e),e}},nw=async(e,t,r,n)=>{try{let o,a,i,l=$?`${$}/tag/wau`:"/tag/wau",s=new URLSearchParams;s.append("end_date",(o=t.getFullYear(),a=String(t.getMonth()+1).padStart(2,"0"),i=String(t.getDate()).padStart(2,"0"),`${o}-${a}-${i}`)),n&&n.length>0?n.forEach(e=>{s.append("tag_filters",e)}):r&&s.append("tag_filter",r);let c=s.toString();c&&(l+=`?${c}`);let u=await fetch(l,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!u.ok){let e=await u.json(),t=nx(e);throw j(t),Error(t)}return await u.json()}catch(e){throw console.error("Failed to fetch WAU:",e),e}},n$=async(e,t,r,n)=>{try{let o,a,i,l=$?`${$}/tag/mau`:"/tag/mau",s=new URLSearchParams;s.append("end_date",(o=t.getFullYear(),a=String(t.getMonth()+1).padStart(2,"0"),i=String(t.getDate()).padStart(2,"0"),`${o}-${a}-${i}`)),n&&n.length>0?n.forEach(e=>{s.append("tag_filters",e)}):r&&s.append("tag_filter",r);let c=s.toString();c&&(l+=`?${c}`);let u=await fetch(l,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!u.ok){let e=await u.json(),t=nx(e);throw j(t),Error(t)}return await u.json()}catch(e){throw console.error("Failed to fetch MAU:",e),e}},nC=async e=>{try{let t=$?`${$}/tag/distinct`:"/tag/distinct",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nx(e);throw j(t),Error(t)}return await r.json()}catch(e){throw console.error("Failed to fetch distinct tags:",e),e}},nE=async(e,t,r,n)=>{try{let o=$?`${$}/tag/summary`:"/tag/summary",a=new URLSearchParams,i=e=>{let t=e.getFullYear(),r=String(e.getMonth()+1).padStart(2,"0"),n=String(e.getDate()).padStart(2,"0");return`${t}-${r}-${n}`};a.append("start_date",i(t)),a.append("end_date",i(r)),n&&n.length>0&&n.forEach(e=>{a.append("tag_filters",e)});let l=a.toString();l&&(o+=`?${l}`);let s=await fetch(o,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!s.ok){let e=await s.json(),t=nx(e);throw j(t),Error(t)}return await s.json()}catch(e){throw console.error("Failed to fetch user agent summary:",e),e}},nS=async(e,t=1,r=50,n)=>{try{let o=$?`${$}/tag/user-agent/per-user-analytics`:"/tag/user-agent/per-user-analytics",a=new URLSearchParams;a.append("page",t.toString()),a.append("page_size",r.toString()),n&&n.length>0&&n.forEach(e=>{a.append("tag_filters",e)});let i=a.toString();i&&(o+=`?${i}`);let l=await fetch(o,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!l.ok){let e=await l.json(),t=nx(e);throw j(t),Error(t)}return await l.json()}catch(e){throw console.error("Failed to fetch per-user analytics:",e),e}},nx=e=>{let t=e?.detail,r=Array.isArray(t)?t.map(e=>e?.msg||JSON.stringify(e)).join("; "):"string"==typeof t?t:void 0;return e?.error&&(e.error.message||("string"==typeof e.error?e.error:void 0))||e?.message||r||JSON.stringify(e)},nj=async(e,t)=>{let r=C(),n=r?`${r}/v2/login`:"/v2/login",o=JSON.stringify({username:e,password:t}),a=await fetch(n,{method:"POST",body:o,credentials:"include",headers:{"Content-Type":"application/json"}});if(!a.ok)throw Error(nx(await a.json()));return await a.json()},nO=async()=>{let e=C(),t=e?`${e}/get/ui_settings`:"/get/ui_settings",r=await fetch(t,{method:"GET"});if(!r.ok)throw Error(nx(await r.json()));return await r.json()},nk=async(e,t)=>{let r=C(),n=r?`${r}/update/ui_settings`:"/update/ui_settings",o=await fetch(n,{method:"PATCH",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!o.ok)throw Error(nx(await o.json()));return await o.json()},nT=async()=>{try{let e=C(),t=e?`${e}/claude-code/marketplace.json`:"/claude-code/marketplace.json",r=await fetch(t,{method:"GET",headers:{"Content-Type":"application/json"}});if(!r.ok){let e=await r.text(),t=nx(JSON.parse(e));throw j(t),Error(t)}return await r.json()}catch(e){throw console.error("Failed to fetch Claude Code marketplace:",e),e}},nF=async(e,t=!1)=>{try{let r=C(),n=r?`${r}/claude-code/plugins?enabled_only=${t}`:`/claude-code/plugins?enabled_only=${t}`,o=await fetch(n,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!o.ok){let e=await o.text(),t=nx(JSON.parse(e));throw j(t),Error(t)}return await o.json()}catch(e){throw console.error("Failed to fetch Claude Code plugins list:",e),e}},n_=async(e,t)=>{try{let r=C(),n=r?`${r}/claude-code/plugins/${t}`:`/claude-code/plugins/${t}`,o=await fetch(n,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!o.ok){let e=await o.text(),t=nx(JSON.parse(e));throw j(t),Error(t)}return await o.json()}catch(e){throw console.error(`Failed to fetch plugin "${t}":`,e),e}},nI=async(e,t)=>{try{let r=C(),n=r?`${r}/claude-code/plugins`:"/claude-code/plugins",o=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!o.ok){let e=await o.text(),t=nx(JSON.parse(e));throw j(t),Error(t)}return await o.json()}catch(e){throw console.error("Failed to register Claude Code plugin:",e),e}},nP=async(e,t)=>{try{let r=C(),n=r?`${r}/claude-code/plugins/${t}/enable`:`/claude-code/plugins/${t}/enable`,o=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!o.ok){let e=await o.text(),t=nx(JSON.parse(e));throw j(t),Error(t)}return await o.json()}catch(e){throw console.error(`Failed to enable plugin "${t}":`,e),e}},nN=async(e,t)=>{try{let r=C(),n=r?`${r}/claude-code/plugins/${t}/disable`:`/claude-code/plugins/${t}/disable`,o=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!o.ok){let e=await o.text(),t=nx(JSON.parse(e));throw j(t),Error(t)}return await o.json()}catch(e){throw console.error(`Failed to disable plugin "${t}":`,e),e}},nR=async(e,t)=>{try{let r=C(),n=r?`${r}/claude-code/plugins/${t}`:`/claude-code/plugins/${t}`,o=await fetch(n,{method:"DELETE",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!o.ok){let e=await o.text(),t=nx(JSON.parse(e));throw j(t),Error(t)}return await o.json()}catch(e){throw console.error(`Failed to delete plugin "${t}":`,e),e}},nM=async(e,t)=>{let r=$?`${$}/compliance/eu-ai-act`:"/compliance/eu-ai-act",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok)throw Error(await n.text());return n.json()},nB=async(e,t)=>{let r=$?`${$}/compliance/gdpr`:"/compliance/gdpr",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok)throw Error(await n.text());return n.json()},nA=async e=>{let t=$?`${$}/v1/tool/policy/options`:"/v1/tool/policy/options",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok)throw Error(await r.text());return r.json()},nz=async e=>{let t=$?`${$}/v1/tool/list`:"/v1/tool/list",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok)throw Error(await r.text());return(await r.json()).tools??[]},nL=async(e,t,r)=>{let n=encodeURIComponent(t),o=$?`${$}/v1/tool/${n}/logs`:`/v1/tool/${n}/logs`,a=new URLSearchParams;null!=r.page&&a.append("page",String(r.page)),null!=r.pageSize&&a.append("page_size",String(r.pageSize)),r.startDate&&a.append("start_date",r.startDate),r.endDate&&a.append("end_date",r.endDate);let i=a.toString()?`${o}?${a.toString()}`:o,l=await fetch(i,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!l.ok)throw Error(nx(await l.json().catch(()=>({}))));return l.json()},nH=async(e,t)=>{let r=encodeURIComponent(t),n=$?`${$}/v1/tool/${r}/detail`:`/v1/tool/${r}/detail`,o=await fetch(n,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!o.ok)throw Error(await o.text());return o.json()},nD=async(e,t,r,n)=>{let o=$?`${$}/v1/tool/policy`:"/v1/tool/policy",a={tool_name:t};null!=r.input_policy&&(a.input_policy=r.input_policy),null!=r.output_policy&&(a.output_policy=r.output_policy),n?.team_id!=null&&(a.team_id=n.team_id||void 0),n?.key_hash!=null&&(a.key_hash=n.key_hash||void 0),n?.key_alias!=null&&(a.key_alias=n.key_alias||void 0);let i=await fetch(o,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(a)});if(!i.ok)throw Error(await i.text());return i.json()},nV=async(e,t,r)=>{let n=encodeURIComponent(t),o=new URLSearchParams;null!=r.team_id&&""!==r.team_id&&o.set("team_id",r.team_id),null!=r.key_hash&&""!==r.key_hash&&o.set("key_hash",r.key_hash);let a=o.toString(),i=$?`${$}/v1/tool/${n}/overrides${a?`?${a}`:""}`:`/v1/tool/${n}/overrides${a?`?${a}`:""}`,l=await fetch(i,{method:"DELETE",headers:{[T]:`Bearer ${e}`}});if(!l.ok)throw Error(await l.text());return l.json()},nW=async(e,t,r)=>{let n=$?`${$}/v1/mcp/server/${t}/oauth-user-credential`:`/v1/mcp/server/${t}/oauth-user-credential`,o=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(r)});if(!o.ok){let e=await o.json().catch(()=>({})),t=e?.detail;throw Error((Array.isArray(t)?t.map(e=>e&&"object"==typeof e?e.msg??JSON.stringify(e):String(e)).join("; "):"string"==typeof t?t:t&&"string"==typeof t.error?t.error:void 0)||"Failed to store OAuth credential")}return o.json()},nG=async(e,t)=>{let r=$?`${$}/v1/mcp/server/${t}/oauth-user-credential`:`/v1/mcp/server/${t}/oauth-user-credential`,n=await fetch(r,{method:"DELETE",headers:{[T]:`Bearer ${e}`}});if(!n.ok){let e=await n.json().catch(()=>({})),t=e?.detail;throw Error((Array.isArray(t)?t.map(e=>e&&"object"==typeof e?e.msg??JSON.stringify(e):String(e)).join("; "):"string"==typeof t?t:t&&"string"==typeof t.error?t.error:void 0)||"Failed to revoke OAuth credential")}return n.json()},nU=async(e,t)=>{let r=$?`${$}/v1/mcp/server/${t}/oauth-user-credential/status`:`/v1/mcp/server/${t}/oauth-user-credential/status`,n=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`}});return n.ok?n.json():{server_id:t,has_credential:!1,is_expired:!1}},nq=async e=>{let t=$?`${$}/v1/mcp/user-credentials`:"/v1/mcp/user-credentials",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`}});return r.ok?r.json():[]}}]); \ No newline at end of file +Allowed values: ${t.enum.join(", ")}`:S)}),children:r},e)})}):null};var g=e.i(727749);let v=e=>{let t=e.getFullYear(),r=String(e.getMonth()+1).padStart(2,"0"),n=String(e.getDate()).padStart(2,"0");return`${t}-${r}-${n}`},y=async e=>{try{let t=$?`${$}/callbacks/configs`:"/callbacks/configs",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nj(e);throw j(t),Error(t)}return await r.json()}catch(e){throw console.error("Failed to get callbacks:",e),e}},b=async e=>{try{let t=$?`${$}/in_product_nudges`:"/in_product_nudges",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nj(e);throw j(t),Error(t)}return await r.json()}catch(e){throw console.error("Failed to get in-product nudges:",e),e}},w="/",$=null;console.log=function(){};let C=()=>{if($)return $;let e=window.location;return e?.origin??""},E="POST",S="DELETE",x=0,j=async e=>{let t=Date.now();if(t-x>6e4){if(("string"==typeof e?e:JSON.stringify(e)).includes("Authentication Error - Expired Key")){g.default.info("UI Session Expired. Logging out."),x=t,(0,r.clearTokenCookies)();let e=window.location;e&&(window.location.href=e.pathname)}x=t}else console.log("Error suppressed to prevent spam:",e)},O=async()=>{let e=$?`${$}/public/providers/fields`:"/public/providers/fields",t=await fetch(e,{method:"GET"});if(!t.ok){let e=await t.text();throw console.error("Failed to fetch provider create metadata:",t.status,e),Error("Failed to load provider configuration")}return await t.json()},k=async()=>{let e=$?`${$}/public/agents/fields`:"/public/agents/fields",t=await fetch(e,{method:"GET"});if(!t.ok){let e=await t.text();throw console.error("Failed to fetch agent create metadata:",t.status,e),Error("Failed to load agent configuration")}return await t.json()},T="Authorization";function F(e="Authorization"){console.log(`setGlobalLitellmHeaderName: ${e}`),T=e}function _(){return T}let I=async(e,t)=>{let r=$?`${$}/model_group/make_public`:"/model_group/make_public";return(await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({model_groups:t})})).json()},P=async()=>{console.log("Getting UI config");let e=await fetch("/litellm/.well-known/litellm-ui-config"),t=await e.json();return console.log("jsonData in getUiConfig:",t),((e,t=null)=>{let r=window.location,n=r?.origin??null,o=t||n;if(console.log("proxyBaseUrl:",$),console.log("serverRootPath:",e),!o)return console.log("Updated proxyBaseUrl:",$=$??null);e.length>0&&!o.endsWith(e)&&"/"!=e&&(o+=e),console.log("Updated proxyBaseUrl:",$=o)})(t.server_root_path,t.proxy_base_url),t},N=async()=>{let e=$?`${$}/public/model_hub/info`:"/public/model_hub/info",t=await fetch(e);return await t.json()},R=async()=>{let e=$?`${$}/openapi.json`:"/openapi.json",t=await fetch(e);return await t.json()},M=async()=>{try{let e=$?`${$}/public/litellm_model_cost_map`:"/public/litellm_model_cost_map",t=await fetch(e,{method:"GET",headers:{"Content-Type":"application/json"}}),r=await t.json();return console.log(`received litellm model cost data: ${r}`),r}catch(e){throw console.error("Failed to get model cost map:",e),e}},B=async e=>{try{let t=$?`${$}/reload/model_cost_map`:"/reload/model_cost_map",r=await fetch(t,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}}),n=await r.json();return console.log(`Model cost map reload response: ${n}`),n}catch(e){throw console.error("Failed to reload model cost map:",e),e}},A=async(e,t)=>{try{let r=$?`${$}/schedule/model_cost_map_reload?hours=${t}`:`/schedule/model_cost_map_reload?hours=${t}`,n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}}),o=await n.json();return console.log(`Schedule model cost map reload response: ${o}`),o}catch(e){throw console.error("Failed to schedule model cost map reload:",e),e}},z=async e=>{try{let t=$?`${$}/schedule/model_cost_map_reload`:"/schedule/model_cost_map_reload",r=await fetch(t,{method:"DELETE",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}}),n=await r.json();return console.log(`Cancel model cost map reload response: ${n}`),n}catch(e){throw console.error("Failed to cancel model cost map reload:",e),e}},L=async e=>{try{let t=$?`${$}/model/cost_map/source`:"/model/cost_map/source",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.text();throw Error(`HTTP ${r.status}: ${e}`)}let n=await r.json();return console.log("Model cost map source info:",n),n}catch(e){throw console.error("Failed to get model cost map source info:",e),e}},H=async e=>{try{let t=$?`${$}/schedule/model_cost_map_reload/status`:"/schedule/model_cost_map_reload/status";console.log("Fetching status from URL:",t);let r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){console.error(`Status request failed with status: ${r.status}`);let e=await r.text();throw console.error("Error response:",e),Error(`HTTP ${r.status}: ${e}`)}let n=await r.json();return console.log("Model cost map reload status:",n),n}catch(e){throw console.error("Failed to get model cost map reload status:",e),e}},D=async(e,r)=>{try{let n=$?`${$}/model/new`:"/model/new",o=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({...r})});if(!o.ok){let e=await o.json(),t=nj(e);throw j(t),Error(t)}let a=await o.json();return console.log("API Response:",a),t.message.destroy(),g.default.success(`Model ${r.model_name} created successfully`),a}catch(e){throw console.error("Failed to create key:",e),e}},V=async(e,t)=>{console.log(`model_id in model delete call: ${t}`);try{let r=$?`${$}/model/delete`:"/model/delete",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({id:t})});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}let o=await n.json();return console.log("API Response:",o),o}catch(e){throw console.error("Failed to create key:",e),e}},W=async(e,t)=>{if(console.log(`budget_id in budget delete call: ${t}`),null!=e)try{let r=$?`${$}/budget/delete`:"/budget/delete",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({id:t})});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}let o=await n.json();return console.log("API Response:",o),o}catch(e){throw console.error("Failed to create key:",e),e}},G=async(e,t)=>{try{console.log("Form Values in budgetCreateCall:",t),console.log("Form Values after check:",t);let r=$?`${$}/budget/new`:"/budget/new",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({...t})});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}let o=await n.json();return console.log("API Response:",o),o}catch(e){throw console.error("Failed to create key:",e),e}},U=async(e,t)=>{try{console.log("Form Values in budgetUpdateCall:",t),console.log("Form Values after check:",t);let r=$?`${$}/budget/update`:"/budget/update",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({...t})});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}let o=await n.json();return console.log("API Response:",o),o}catch(e){throw console.error("Failed to create key:",e),e}},q=async(e,t)=>{try{let r=$?`${$}/invitation/new`:"/invitation/new",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({user_id:t})});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}let o=await n.json();return console.log("API Response:",o),o}catch(e){throw console.error("Failed to create key:",e),e}},J=async e=>{try{let t=$?`${$}/alerting/settings`:"/alerting/settings",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nj(e);throw j(t),Error(t)}return await r.json()}catch(e){throw console.error("Failed to get callbacks:",e),e}},K=async(e,t)=>{try{for(let e of(console.log("Form Values in keyCreateServiceAccountCall:",t),t.description&&(t.metadata||(t.metadata={}),t.metadata.description=t.description,delete t.description,t.metadata=JSON.stringify(t.metadata)),p))if(t[e]){console.log(`formValues.${e}:`,t[e]);try{t[e]=JSON.parse(t[e])}catch(t){throw Error(`Failed to parse ${e}: `+t)}}console.log("Form Values after check:",t);let r=$?`${$}/key/service-account/generate`:"/key/service-account/generate",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({...t})});if(!n.ok){let e=await n.text();throw j(e),console.error("Error response from the server:",e),Error(e)}let o=await n.json();return console.log("API Response:",o),o}catch(e){throw console.error("Failed to create key:",e),e}},X=async(e,t,r)=>{try{for(let e of(console.log("Form Values in keyCreateCall:",r),r.description&&(r.metadata||(r.metadata={}),r.metadata.description=r.description,delete r.description,r.metadata=JSON.stringify(r.metadata)),p))if(r[e]){console.log(`formValues.${e}:`,r[e]);try{r[e]=JSON.parse(r[e])}catch(t){throw Error(`Failed to parse ${e}: `+t)}}console.log("Form Values after check:",r);let n=$?`${$}/key/generate`:"/key/generate",o=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({user_id:t,...r})});if(!o.ok){let e=await o.text();throw j(e),console.error("Error response from the server:",e),Error(e)}let a=await o.json();return console.log("API Response:",a),a}catch(e){throw console.error("Failed to create key:",e),e}},Y=async(e,t,r,n,o,a)=>{let i=$?`${$}/key/generate`:"/key/generate",l={agent_id:t,key_alias:r,models:n.length>0?n:[]};a&&(l.team_id=a),o&&Object.keys(o).length>0&&(l.metadata=o);let s=await fetch(i,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(l)});if(!s.ok)throw j(await s.text()),Error("Failed to create key for agent");return s.json()},Z=async(e,t,r)=>{try{if(console.log("Form Values in keyCreateCall:",r),r.description&&(r.metadata||(r.metadata={}),r.metadata.description=r.description,delete r.description,r.metadata=JSON.stringify(r.metadata)),r.auto_create_key=!1,r.metadata){console.log("formValues.metadata:",r.metadata);try{r.metadata=JSON.parse(r.metadata)}catch(e){throw Error("Failed to parse metadata: "+e)}}console.log("Form Values after check:",r);let n=$?`${$}/user/new`:"/user/new",o=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({user_id:t,...r})});if(!o.ok){let e=await o.text();throw j(e),console.error("Error response from the server:",e),Error(e)}let a=await o.json();return console.log("API Response:",a),a}catch(e){throw console.error("Failed to create key:",e),e}},Q=async(e,t)=>{try{let r=$?`${$}/key/delete`:"/key/delete";console.log("in keyDeleteCall:",t);let n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({keys:[t]})});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}let o=await n.json();return console.log(o),o}catch(e){throw console.error("Failed to create key:",e),e}},ee=async(e,t)=>{try{let r=$?`${$}/user/delete`:"/user/delete";console.log("in userDeleteCall:",t);let n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({user_ids:t})});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}let o=await n.json();return console.log(o),o}catch(e){throw console.error("Failed to delete user(s):",e),e}},et=async(e,t)=>{try{let r=$?`${$}/team/delete`:"/team/delete";console.log("in teamDeleteCall:",t);let n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({team_ids:[t]})});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}let o=await n.json();return console.log(o),o}catch(e){throw console.error("Failed to delete key:",e),e}},er=async(e,t=null,r=null,n=null,o=null,a=null,i=null,l=null,s=null,c=null,u=null)=>{try{let d=$?`${$}/user/list`:"/user/list";console.log("in userListCall");let f=new URLSearchParams;if(t&&t.length>0){let e=t.join(",");f.append("user_ids",e)}r&&f.append("page",r.toString()),n&&f.append("page_size",n.toString()),o&&f.append("user_email",o),a&&f.append("role",a),i&&f.append("team",i),l&&f.append("sso_user_ids",l),s&&f.append("sort_by",s),c&&f.append("sort_order",c),u&&u.length>0&&f.append("organization_ids",u.join(","));let p=f.toString();p&&(d+=`?${p}`);let m=await fetch(d,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!m.ok){let e=await m.json(),t=nj(e);throw j(t),Error(t)}let h=await m.json();return console.log("/user/list API Response:",h),h}catch(e){throw console.error("Failed to create key:",e),e}},en=async(e,t)=>{try{let r=$?`${$}/v2/user/info`:"/v2/user/info";t&&(r+=`?user_id=${encodeURIComponent(t)}`);let n=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to fetch user info v2:",e),e}},eo=async(e,t,r,n=!1,o,a,i=!1)=>{console.log(`userInfoCall: ${t}, ${r}, ${n}, ${o}, ${a}, ${i}`);try{let l;if(n){l=$?`${$}/user/list`:"/user/list";let e=new URLSearchParams;null!=o&&e.append("page",o.toString()),null!=a&&e.append("page_size",a.toString()),l+=`?${e.toString()}`}else l=$?`${$}/user/info`:"/user/info",("Admin"!==r&&"Admin Viewer"!==r||i)&&t&&(l+=`?user_id=${t}`);console.log("Requesting user data from:",l);let s=await fetch(l,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!s.ok){let e=await s.json(),t=nj(e);throw j(t),Error(t)}let c=await s.json();return console.log("API Response:",c),c}catch(e){throw console.error("Failed to fetch user data:",e),e}},ea=async(e,t)=>{try{let r=$?`${$}/team/info`:"/team/info";t&&(r=`${r}?team_id=${t}`),console.log("in teamInfoCall");let n=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}let o=await n.json();return console.log("API Response:",o),o}catch(e){throw console.error("Failed to create key:",e),e}},ei=async(e,t,r=null,n=null,o=null,a=1,i=10,l=null,s=null)=>{try{let a=$?`${$}/v2/team/list`:"/v2/team/list";console.log("in teamInfoCall");let i=new URLSearchParams;r&&i.append("user_id",r.toString()),t&&i.append("organization_id",t.toString()),n&&i.append("team_id",n.toString()),o&&i.append("team_alias",o.toString());let l=i.toString();l&&(a+=`?${l}`);let s=await fetch(a,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!s.ok){let e=await s.json(),t=nj(e);throw j(t),Error(t)}let c=await s.json();return console.log("/v2/team/list API Response:",c),c}catch(e){throw console.error("Failed to create key:",e),e}},el=async(e,t,r=null,n=null,o=null)=>{try{let a=$?`${$}/team/list`:"/team/list";console.log("in teamInfoCall");let i=new URLSearchParams;r&&i.append("user_id",r.toString()),t&&i.append("organization_id",t.toString()),n&&i.append("team_id",n.toString()),o&&i.append("team_alias",o.toString());let l=i.toString();l&&(a+=`?${l}`);let s=await fetch(a,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!s.ok){let e=await s.json(),t=nj(e);throw j(t),Error(t)}let c=await s.json();return console.log("/team/list API Response:",c),c}catch(e){throw console.error("Failed to create key:",e),e}},es=async e=>{try{let t=$?`${$}/team/available`:"/team/available";console.log("in availableTeamListCall");let r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nj(e);throw j(t),Error(t)}let n=await r.json();return console.log("/team/available_teams API Response:",n),n}catch(e){throw e}},ec=async(e,t=null,r=null)=>{try{let n=$?`${$}/organization/list`:"/organization/list",o=new URLSearchParams;t&&o.append("org_id",t.toString()),r&&o.append("org_alias",r.toString());let a=o.toString();a&&(n+=`?${a}`);let i=await fetch(n,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!i.ok){let e=await i.json(),t=nj(e);throw j(t),Error(t)}return await i.json()}catch(e){throw console.error("Failed to create key:",e),e}},eu=async(e,t)=>{try{let r=$?`${$}/organization/info`:"/organization/info";t&&(r=`${r}?organization_id=${t}`),console.log("in teamInfoCall");let n=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}let o=await n.json();return console.log("API Response:",o),o}catch(e){throw console.error("Failed to create key:",e),e}},ed=async(e,t)=>{try{if(console.log("Form Values in organizationCreateCall:",t),t.metadata){console.log("formValues.metadata:",t.metadata);try{t.metadata=JSON.parse(t.metadata)}catch(e){throw console.error("Failed to parse metadata:",e),Error("Failed to parse metadata: "+e)}}let r=$?`${$}/organization/new`:"/organization/new",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({...t})});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}let o=await n.json();return console.log("API Response:",o),o}catch(e){throw console.error("Failed to create key:",e),e}},ef=async(e,t)=>{try{console.log("Form Values in organizationUpdateCall:",t);let r=$?`${$}/organization/update`:"/organization/update",n=await fetch(r,{method:"PATCH",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({...t})});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}let o=await n.json();return console.log("Update Team Response:",o),o}catch(e){throw console.error("Failed to create key:",e),e}},ep=async(e,t)=>{try{let r=$?`${$}/organization/delete`:"/organization/delete",n=await fetch(r,{method:"DELETE",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({organization_ids:[t]})});if(!n.ok){let e=await n.text();throw j(e),Error(`Error deleting organization: ${e}`)}return await n.json()}catch(e){throw console.error("Failed to delete organization:",e),e}},em=async(e,t)=>{try{let r=$?`${$}/utils/transform_request`:"/utils/transform_request",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to create key:",e),e}},eh=async({accessToken:e,endpoint:t,startTime:r,endTime:n,page:o=1,extraQueryParams:a})=>{try{let i,l,s,c,u=(i=t.startsWith("/")?t:`/${t}`,l=$?`${$}${i}`:i,(s=new URLSearchParams).append("start_date",v(r)),s.append("end_date",v(n)),s.append("page_size","1000"),s.append("page",o.toString()),s.append("timezone",new Date().getTimezoneOffset().toString()),a&&Object.entries(a).forEach(([e,t])=>{((e,t,r)=>{if(null!=r){if(Array.isArray(r)){r.length>0&&e.append(t,r.join(","));return}e.append(t,`${r}`)}})(s,e,t)}),(c=s.toString())?`${l}?${c}`:l),d=await fetch(u,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!d.ok){let e=await d.json(),t=nj(e);throw j(t),Error(t)}return await d.json()}catch(e){throw console.error(`Failed to fetch daily activity (${t}):`,e),e}},eg=async(e,t,r,n=1,o=null)=>eh({accessToken:e,endpoint:"/user/daily/activity",startTime:t,endTime:r,page:n,extraQueryParams:{user_id:o}}),ev=async(e,t,r,n=1,o=null)=>eh({accessToken:e,endpoint:"/tag/daily/activity",startTime:t,endTime:r,page:n,extraQueryParams:{tags:o}}),ey=async(e,t,r,n=1,o=null)=>eh({accessToken:e,endpoint:"/team/daily/activity",startTime:t,endTime:r,page:n,extraQueryParams:{team_ids:o,exclude_team_ids:"litellm-dashboard"}}),eb=async(e,t,r,n=1,o=null)=>eh({accessToken:e,endpoint:"/organization/daily/activity",startTime:t,endTime:r,page:n,extraQueryParams:{organization_ids:o}}),ew=async(e,t,r,n=1,o=null)=>eh({accessToken:e,endpoint:"/customer/daily/activity",startTime:t,endTime:r,page:n,extraQueryParams:{end_user_ids:o}}),e$=async(e,t,r,n=1,o=null)=>eh({accessToken:e,endpoint:"/agent/daily/activity",startTime:t,endTime:r,page:n,extraQueryParams:{agent_ids:o}}),eC=async e=>{try{let t=$?`${$}/onboarding/get_token`:"/onboarding/get_token";t+=`?invite_link=${e}`;let r=await fetch(t,{method:"GET",headers:{"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nj(e);throw j(t),Error(t)}return await r.json()}catch(e){throw console.error("Failed to create key:",e),e}},eE=async(e,t,r,n)=>{let o=$?`${$}/onboarding/claim_token`:"/onboarding/claim_token";try{let a=await fetch(o,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({invitation_link:t,user_id:r,password:n})});if(!a.ok){let e=await a.json(),t=nj(e);throw j(t),Error(t)}let i=await a.json();return console.log(i),i}catch(e){throw console.error("Failed to delete key:",e),e}},eS=async(e,t,r)=>{try{let n=$?`${$}/key/${t}/regenerate`:`/key/${t}/regenerate`,o=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(r)});if(!o.ok){let e=await o.json(),t=nj(e);throw j(t),Error(t)}let a=await o.json();return console.log("Regenerate key Response:",a),a}catch(e){throw console.error("Failed to regenerate key:",e),e}},ex=!1,ej=null,eO=async(e,t,r,n=1,o=50,a,i,l,s,c)=>{try{console.log("modelInfoCall:",e,t,r,n,o,a,i,l,s,c);let u=$?`${$}/v2/model/info`:"/v2/model/info",d=new URLSearchParams;d.append("include_team_models","true"),d.append("page",n.toString()),d.append("size",o.toString()),a&&a.trim()&&d.append("search",a.trim()),i&&i.trim()&&d.append("modelId",i.trim()),l&&l.trim()&&d.append("teamId",l.trim()),s&&s.trim()&&d.append("sortBy",s.trim()),c&&c.trim()&&d.append("sortOrder",c.trim()),d.toString()&&(u+=`?${d.toString()}`);let f=await fetch(u,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!f.ok){let e=await f.text();throw e+=`error shown=${ex}`,ex||(e.includes("No model list passed")&&(e="No Models Exist. Click Add Model to get started."),g.default.info(e),ex=!0,ej&&clearTimeout(ej),ej=setTimeout(()=>{ex=!1},1e4)),Error("Network response was not ok")}let p=await f.json();return console.log("modelInfoCall:",p),p}catch(e){throw console.error("Failed to create key:",e),e}},ek=async(e,t)=>{try{let r=$?`${$}/v1/model/info`:"/v1/model/info";r+=`?litellm_model_id=${t}`;let n=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}let o=await n.json();return console.log("modelInfoV1Call:",o),o}catch(e){throw console.error("Failed to create key:",e),e}},eT=async()=>{let e=$?`${$}/public/model_hub`:"/public/model_hub",t=await fetch(e,{method:"GET",headers:{"Content-Type":"application/json"}});return t.ok?t.json():(console.error(`modelHubPublicModelsCall failed with status ${t.status}`),[])},eF=async()=>{let e=$?`${$}/public/agent_hub`:"/public/agent_hub",t=await fetch(e,{method:"GET",headers:{"Content-Type":"application/json"}});return t.ok?t.json():(console.error(`agentHubPublicModelsCall failed with status ${t.status}`),[])},e_=async()=>{let e=$?`${$}/public/mcp_hub`:"/public/mcp_hub",t=await fetch(e,{method:"GET",headers:{"Content-Type":"application/json"}});return t.ok?t.json():(console.error(`mcpHubPublicServersCall failed with status ${t.status}`),[])},eI=async e=>{try{let t=$?`${$}/model_group/info`:"/model_group/info",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nj(e);throw j(t),Error(t)}let n=await r.json();return console.log("modelHubCall:",n),n}catch(e){throw console.error("Failed to create key:",e),e}},eP=async e=>{try{let t=$?`${$}/get/allowed_ips`:"/get/allowed_ips",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nj(e);throw j(t),Error(t)}let n=await r.json();return console.log("getAllowedIPs:",n),n.data}catch(e){throw console.error("Failed to get allowed IPs:",e),e}},eN=async(e,t)=>{try{let r=$?`${$}/add/allowed_ip`:"/add/allowed_ip",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({ip:t})});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}let o=await n.json();return console.log("addAllowedIP:",o),o}catch(e){throw console.error("Failed to add allowed IP:",e),e}},eR=async(e,t)=>{try{let r=$?`${$}/delete/allowed_ip`:"/delete/allowed_ip",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({ip:t})});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}let o=await n.json();return console.log("deleteAllowedIP:",o),o}catch(e){throw console.error("Failed to delete allowed IP:",e),e}},eM=async(e,t)=>{try{let r=$?`${$}/model_hub/update_useful_links`:"/model_hub/update_useful_links",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({useful_links:t})});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to create key:",e),e}},eB=async(e,t,r,n=!1,o=null,a=!1,i=!1,l)=>{console.log("in /models calls, globalLitellmHeaderName",T);try{let t=$?`${$}/models`:"/models",r=new URLSearchParams;r.append("include_model_access_groups","True"),!0===n&&r.append("return_wildcard_routes","True"),!0===i&&r.append("only_model_access_groups","True"),o&&r.append("team_id",o.toString()),l&&r.append("scope",l),r.toString()&&(t+=`?${r.toString()}`);let a=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!a.ok){let e=await a.json(),t=nj(e);throw j(t),Error(t)}return await a.json()}catch(e){throw console.error("Failed to create key:",e),e}},eA=async e=>{try{let t=$?`${$}/global/spend/teams`:"/global/spend/teams";console.log("in teamSpendLogsCall:",t);let r=await fetch(`${t}`,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nj(e);throw j(t),Error(t)}let n=await r.json();return console.log(n),n}catch(e){throw console.error("Failed to create key:",e),e}},ez=async(e,t,r,n)=>{try{let o=$?`${$}/global/spend/tags`:"/global/spend/tags";t&&r&&(o=`${o}?start_date=${t}&end_date=${r}`),n&&(o+=`&tags=${n.join(",")}`),console.log("in tagsSpendLogsCall:",o);let a=await fetch(`${o}`,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!a.ok){let e=await a.json(),t=nj(e);throw j(t),Error(t)}let i=await a.json();return console.log(i),i}catch(e){throw console.error("Failed to create key:",e),e}},eL=async e=>{try{let t=$?`${$}/global/spend/all_tag_names`:"/global/spend/all_tag_names";console.log("in global/spend/all_tag_names call",t);let r=await fetch(`${t}`,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nj(e);throw j(t),Error(t)}let n=await r.json();return console.log(n),n}catch(e){throw console.error("Failed to create key:",e),e}},eH=async e=>{try{let t=$?`${$}/customer/list`:"/customer/list";console.log("in customer/list",t);let r=await fetch(`${t}`,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nj(e);throw j(t),Error(t)}let n=await r.json();return console.log(n),n}catch(e){throw console.error("Failed to fetch end users:",e),e}},eD=async(e,t)=>{try{let r=$?`${$}/user/filter/ui`:"/user/filter/ui",n=new URLSearchParams;t.get("user_email")&&n.append("user_email",t.get("user_email")),t.get("user_id")&&n.append("user_id",t.get("user_id")),t.get("team_id")&&n.append("team_id",t.get("team_id"));let o=n.toString(),a=o?`${r}?${o}`:r,i=await fetch(a,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!i.ok){let e=await i.json(),t=nj(e);throw j(t),Error(t)}return await i.json()}catch(e){throw console.error("Failed to create key:",e),e}},eV=async({accessToken:e,start_date:t,end_date:r,page:n=1,page_size:o=50,params:a={}})=>{try{let i=$?`${$}/spend/logs/ui`:"/spend/logs/ui",l=new URLSearchParams;for(let[e,i]of(l.append("start_date",t),l.append("end_date",r),l.append("page",n.toString()),l.append("page_size",o.toString()),Object.entries(a)))null!=i&&("min_spend"===e||"max_spend"===e?l.append(e,i.toString()):"string"==typeof i&&""!==i&&l.append(e,String(i)));let s=l.toString();s&&(i+=`?${s}`);let c=await fetch(i,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!c.ok){let e=await c.json(),t=nj(e);throw j(t),Error(t)}let u=await c.json();return console.log("Spend Logs Response:",u),u}catch(e){throw console.error("Failed to fetch spend logs:",e),e}},eW=async e=>{try{let t=$?`${$}/global/spend/logs`:"/global/spend/logs",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nj(e);throw j(t),Error(t)}let n=await r.json();return console.log(n),n}catch(e){throw console.error("Failed to create key:",e),e}},eG=async e=>{try{let t=$?`${$}/global/spend/keys?limit=5`:"/global/spend/keys?limit=5",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nj(e);throw j(t),Error(t)}let n=await r.json();return console.log(n),n}catch(e){throw console.error("Failed to create key:",e),e}},eU=async(e,t,r,n)=>{try{let o=$?`${$}/global/spend/end_users`:"/global/spend/end_users",a="";a=t?JSON.stringify({api_key:t,startTime:r,endTime:n}):JSON.stringify({startTime:r,endTime:n});let i={method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:a},l=await fetch(o,i);if(!l.ok){let e=await l.json(),t=nj(e);throw j(t),Error(t)}let s=await l.json();return console.log(s),s}catch(e){throw console.error("Failed to create key:",e),e}},eq=async(e,t,r,n)=>{try{let o=$?`${$}/global/spend/provider`:"/global/spend/provider";r&&n&&(o+=`?start_date=${r}&end_date=${n}`),t&&(o+=`&api_key=${t}`);let a={method:"GET",headers:{[T]:`Bearer ${e}`}},i=await fetch(o,a);if(!i.ok){let e=await i.json(),t=nj(e);throw j(t),Error(t)}let l=await i.json();return console.log(l),l}catch(e){throw console.error("Failed to fetch spend data:",e),e}},eJ=async(e,t,r)=>{try{let n=$?`${$}/global/activity`:"/global/activity";t&&r&&(n+=`?start_date=${t}&end_date=${r}`);let o={method:"GET",headers:{[T]:`Bearer ${e}`}},a=await fetch(n,o);if(!a.ok){let e=await a.json(),t=nj(e);throw j(t),Error(t)}let i=await a.json();return console.log(i),i}catch(e){throw console.error("Failed to fetch spend data:",e),e}},eK=async(e,t,r)=>{try{let n=$?`${$}/global/activity/cache_hits`:"/global/activity/cache_hits";t&&r&&(n+=`?start_date=${t}&end_date=${r}`);let o={method:"GET",headers:{[T]:`Bearer ${e}`}},a=await fetch(n,o);if(!a.ok){let e=await a.json(),t=nj(e);throw j(t),Error(t)}let i=await a.json();return console.log(i),i}catch(e){throw console.error("Failed to fetch spend data:",e),e}},eX=async(e,t,r)=>{try{let n=$?`${$}/global/activity/model`:"/global/activity/model";t&&r&&(n+=`?start_date=${t}&end_date=${r}`);let o={method:"GET",headers:{[T]:`Bearer ${e}`}},a=await fetch(n,o);if(!a.ok){let e=await a.json(),t=nj(e);throw j(t),Error(t)}let i=await a.json();return console.log(i),i}catch(e){throw console.error("Failed to fetch spend data:",e),e}},eY=async e=>{try{let t=$?`${$}/global/spend/models?limit=5`:"/global/spend/models?limit=5",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nj(e);throw j(t),Error(t)}let n=await r.json();return console.log(n),n}catch(e){throw console.error("Failed to create key:",e),e}},eZ=async(e,t)=>{try{let r=$?`${$}/v2/key/info`:"/v2/key/info",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({keys:t})});if(!n.ok){let e=await n.text();if(e.includes("Invalid proxy server token passed"))throw Error("Invalid proxy server token passed");throw j(e),Error("Network response was not ok")}let o=await n.json();return console.log(o),o}catch(e){throw console.error("Failed to create key:",e),e}},eQ=async(e,t,r,n)=>{try{console.log("Sending model connection test request:",JSON.stringify(t));let o=$?`${$}/health/test_connection`:"/health/test_connection",a=await fetch(o,{method:"POST",headers:{"Content-Type":"application/json",[T]:`Bearer ${e}`},body:JSON.stringify({litellm_params:t,model_info:r,mode:n})}),i=a.headers.get("content-type");if(!i||!i.includes("application/json")){let e=await a.text();throw console.error("Received non-JSON response:",e),Error(`Received non-JSON response (${a.status}: ${a.statusText}). Check network tab for details.`)}let l=await a.json();if((!a.ok||"error"===l.status)&&"error"!==l.status)return{status:"error",message:l.error?.message||`Connection test failed: ${a.status} ${a.statusText}`};return l}catch(e){throw console.error("Model connection test error:",e),e}},e0=async(e,t)=>{try{console.log("entering keyInfoV1Call");let r=$?`${$}/key/info`:"/key/info";r=`${r}?key=${t}`;let n=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(console.log("response",n),!n.ok){let e=await n.text();j(e),g.default.fromBackend("Failed to fetch key info - "+e)}let o=await n.json();return console.log("data",o),o}catch(e){throw console.error("Failed to fetch key info:",e),e}},e1=async(e,t,r,n,o,a,i,l,s=null,c=null,u=null,d=null)=>{try{let f=$?`${$}/key/list`:"/key/list";console.log("in keyListCall");let p=new URLSearchParams;r&&p.append("team_id",r.toString()),t&&p.append("organization_id",t.toString()),n&&p.append("key_alias",n),a&&p.append("key_hash",a),o&&p.append("user_id",o.toString()),i&&p.append("page",i.toString()),l&&p.append("size",l.toString()),s&&p.append("sort_by",s),c&&p.append("sort_order",c),u&&p.append("expand",u),d&&p.append("status",d),p.append("return_full_object","true"),p.append("include_team_keys","true"),p.append("include_created_by_keys","true");let m=p.toString();m&&(f+=`?${m}`);let h=await fetch(f,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!h.ok){let e=await h.json(),t=nj(e);throw j(t),Error(t)}let g=await h.json();return console.log("/team/list API Response:",g),g}catch(e){throw console.error("Failed to create key:",e),e}},e2=async(e,t=1,r=50,n)=>{try{let o=new URLSearchParams(Object.entries({page:String(t),size:String(r),...n?{search:n}:{}})),a=$?`${$}/key/aliases`:"/key/aliases";a=`${a}?${o}`;let i=await fetch(a,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!i.ok){let e=await i.json(),t=nj(e);throw j(t),Error(t)}let l=await i.json();return console.log("/key/aliases API Response:",l),l}catch(e){throw console.error("Failed to fetch key aliases:",e),e}},e4=async(e,t,r,n=null)=>{try{let o=$?`${$}/user/daily/activity/aggregated`:"/user/daily/activity/aggregated",a=new URLSearchParams,i=e=>{let t=e.getFullYear(),r=String(e.getMonth()+1).padStart(2,"0"),n=String(e.getDate()).padStart(2,"0");return`${t}-${r}-${n}`};a.append("start_date",i(t)),a.append("end_date",i(r)),a.append("timezone",new Date().getTimezoneOffset().toString()),n&&a.append("user_id",n);let l=a.toString();l&&(o+=`?${l}`);let s=await fetch(o,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!s.ok){let e=await s.json(),t=nj(e);throw j(t),Error(t)}return await s.json()}catch(e){throw console.error("Failed to fetch aggregated user daily activity:",e),e}},e6=async e=>{try{let t=$?`${$}/user/available_roles`:"/user/available_roles",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nj(e);throw j(t),Error(t)}let n=await r.json();return console.log("response from user/available_role",n),n}catch(e){throw e}},e3=async(e,t)=>{try{if(console.log("Form Values in teamCreateCall:",t),t.metadata){console.log("formValues.metadata:",t.metadata);try{t.metadata=JSON.parse(t.metadata)}catch(e){throw Error("Failed to parse metadata: "+e)}}let r=$?`${$}/team/new`:"/team/new",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({...t})});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}let o=await n.json();return console.log("API Response:",o),o}catch(e){throw console.error("Failed to create key:",e),e}},e7=async(e,t)=>{try{if(console.log("Form Values in credentialCreateCall:",t),t.metadata){console.log("formValues.metadata:",t.metadata);try{t.metadata=JSON.parse(t.metadata)}catch(e){throw Error("Failed to parse metadata: "+e)}}let r=$?`${$}/credentials`:"/credentials",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({...t})});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}let o=await n.json();return console.log("API Response:",o),o}catch(e){throw console.error("Failed to create key:",e),e}},e5=async e=>{try{let t=$?`${$}/credentials`:"/credentials";console.log("in credentialListCall");let r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nj(e);throw j(t),Error(t)}let n=await r.json();return console.log("/credentials API Response:",n),n}catch(e){throw console.error("Failed to create key:",e),e}},e9=async(e,t,r)=>{try{let n=$?`${$}/credentials`:"/credentials";t?n+=`/by_name/${t}`:r&&(n+=`/by_model/${r}`),console.log("in credentialListCall");let o=await fetch(n,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!o.ok){let e=await o.json(),t=nj(e);throw j(t),Error(t)}let a=await o.json();return console.log("/credentials API Response:",a),a}catch(e){throw console.error("Failed to create key:",e),e}},e8=async(e,t)=>{try{let r=$?`${$}/credentials/${t}`:`/credentials/${t}`;console.log("in credentialDeleteCall:",t);let n=await fetch(r,{method:"DELETE",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}let o=await n.json();return console.log(o),o}catch(e){throw console.error("Failed to delete key:",e),e}},te=async(e,t,r)=>{try{if(console.log("Form Values in credentialUpdateCall:",r),r.metadata){console.log("formValues.metadata:",r.metadata);try{r.metadata=JSON.parse(r.metadata)}catch(e){throw Error("Failed to parse metadata: "+e)}}let n=$?`${$}/credentials/${t}`:`/credentials/${t}`,o=await fetch(n,{method:"PATCH",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({...r})});if(!o.ok){let e=await o.json(),t=nj(e);throw j(t),Error(t)}let a=await o.json();return console.log("API Response:",a),a}catch(e){throw console.error("Failed to create key:",e),e}},tt=async(e,t)=>{try{if(console.log("Form Values in keyUpdateCall:",t),t.model_tpm_limit){console.log("formValues.model_tpm_limit:",t.model_tpm_limit);try{t.model_tpm_limit=JSON.parse(t.model_tpm_limit)}catch(e){throw Error("Failed to parse model_tpm_limit: "+e)}}if(t.model_rpm_limit){console.log("formValues.model_rpm_limit:",t.model_rpm_limit);try{t.model_rpm_limit=JSON.parse(t.model_rpm_limit)}catch(e){throw Error("Failed to parse model_rpm_limit: "+e)}}let r=$?`${$}/key/update`:"/key/update",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({...t})});if(!n.ok){let e=await n.text();throw j(e),console.error("Error response from the server:",e),Error(e)}let o=await n.json();return console.log("Update key Response:",o),o}catch(e){throw console.error("Failed to create key:",e),e}},tr=async(e,t)=>{try{console.log("Form Values in teamUpateCall:",t);let r=$?`${$}/team/update`:"/team/update",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({...t})});if(!n.ok){let e=await n.text();throw j(e),console.error("Error response from the server:",e),g.default.fromBackend("Failed to update team settings: "+e),Error(e)}let o=await n.json();return console.log("Update Team Response:",o),o}catch(e){throw console.error("Failed to update team:",e),e}},tn=async(e,t,r)=>{try{console.log("Form Values in modelUpateCall:",t);let n=$?`${$}/model/${r}/update`:`/model/${r}/update`,o=await fetch(n,{method:"PATCH",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({...t})});if(!o.ok){let e=await o.text();throw j(e),console.error("Error update from the server:",e),Error("Network response was not ok")}let a=await o.json();return console.log("Update model Response:",a),a}catch(e){throw console.error("Failed to update model:",e),e}},to=async(e,t,r)=>{try{console.log("Form Values in teamMemberAddCall:",r);let n=$?`${$}/team/member_add`:"/team/member_add",o=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({team_id:t,member:r})});if(!o.ok){let e=await o.text(),t={};try{t=JSON.parse(e)}catch(t){console.warn("Failed to parse error body as JSON:",e)}let r=t?.detail?.error||"Failed to add team member",n=Error(r);throw n.raw=t,n}let a=await o.json();return console.log("API Response:",a),a}catch(e){throw console.error("Failed to create key:",e),e}},ta=async(e,t,r,n,o)=>{try{console.log("Bulk add team members:",{teamId:t,members:r,maxBudgetInTeam:n});let a=$?`${$}/team/bulk_member_add`:"/team/bulk_member_add",i={team_id:t};o?i.all_users=!0:i.members=r,null!=n&&(i.max_budget_in_team=n);let l=await fetch(a,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(i)});if(!l.ok){let e=await l.text(),t={};try{t=JSON.parse(e)}catch(t){console.warn("Failed to parse error body as JSON:",e)}let r=t?.detail?.error||"Failed to bulk add team members",n=Error(r);throw n.raw=t,n}let s=await l.json();return console.log("Bulk team member add API Response:",s),s}catch(e){throw console.error("Failed to bulk add team members:",e),e}},ti=async(e,t,r)=>{try{console.log("Form Values in teamMemberUpdateCall:",r),console.log("Budget value:",r.max_budget_in_team),console.log("TPM limit:",r.tpm_limit),console.log("RPM limit:",r.rpm_limit);let n=$?`${$}/team/member_update`:"/team/member_update",o={team_id:t,role:r.role,user_id:r.user_id};void 0!==r.user_email&&(o.user_email=r.user_email),void 0!==r.max_budget_in_team&&null!==r.max_budget_in_team&&(o.max_budget_in_team=r.max_budget_in_team),void 0!==r.tpm_limit&&null!==r.tpm_limit&&(o.tpm_limit=r.tpm_limit),void 0!==r.rpm_limit&&null!==r.rpm_limit&&(o.rpm_limit=r.rpm_limit),console.log("Final request body:",o);let a=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(o)});if(!a.ok){let e=await a.text(),t={};try{t=JSON.parse(e)}catch(t){console.warn("Failed to parse error body as JSON:",e)}let r=t?.detail?.error||"Failed to add team member",n=Error(r);throw n.raw=t,n}let i=await a.json();return console.log("API Response:",i),i}catch(e){throw console.error("Failed to update team member:",e),e}},tl=async(e,t,r)=>{try{console.log("Form Values in teamMemberAddCall:",r);let n=$?`${$}/team/member_delete`:"/team/member_delete",o=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({team_id:t,...void 0!==r.user_email&&{user_email:r.user_email},...void 0!==r.user_id&&{user_id:r.user_id}})});if(!o.ok){let e=await o.json(),t=nj(e);throw j(t),Error(t)}let a=await o.json();return console.log("API Response:",a),a}catch(e){throw console.error("Failed to create key:",e),e}},ts=async(e,t,r)=>{try{console.log("Form Values in teamMemberAddCall:",r);let n=$?`${$}/organization/member_add`:"/organization/member_add",o=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({organization_id:t,member:r})});if(!o.ok){let e=await o.text();throw j(e),console.error("Error response from the server:",e),Error(e)}let a=await o.json();return console.log("API Response:",a),a}catch(e){throw console.error("Failed to create organization member:",e),e}},tc=async(e,t,r)=>{try{console.log("Form Values in organizationMemberDeleteCall:",r);let n=$?`${$}/organization/member_delete`:"/organization/member_delete",o=await fetch(n,{method:"DELETE",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({organization_id:t,user_id:r})});if(!o.ok){let e=await o.json(),t=nj(e);throw j(t),Error(t)}let a=await o.json();return console.log("API Response:",a),a}catch(e){throw console.error("Failed to delete organization member:",e),e}},tu=async(e,t,r)=>{try{console.log("Form Values in organizationMemberUpdateCall:",r);let n=$?`${$}/organization/member_update`:"/organization/member_update",o=await fetch(n,{method:"PATCH",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({organization_id:t,...r})});if(!o.ok){let e=await o.json(),t=nj(e);throw j(t),Error(t)}let a=await o.json();return console.log("API Response:",a),a}catch(e){throw console.error("Failed to update organization member:",e),e}},td=async(e,t,r)=>{try{console.log("Form Values in userUpdateUserCall:",t);let n=$?`${$}/user/update`:"/user/update",o={...t};null!==r&&(o.user_role=r),o=JSON.stringify(o);let a=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:o});if(!a.ok){let e=await a.json(),t=nj(e);throw j(t),Error(t)}let i=await a.json();return console.log("API Response:",i),i}catch(e){throw console.error("Failed to create key:",e),e}},tf=async(e,t,r,n=!1)=>{try{let o;console.log("Form Values in userUpdateUserCall:",t);let a=$?`${$}/user/bulk_update`:"/user/bulk_update";if(n)o=JSON.stringify({all_users:!0,user_updates:t});else if(r&&r.length>0){let e=[];for(let n of r)e.push({user_id:n,...t});o=JSON.stringify({users:e})}else throw Error("Must provide either userIds or set allUsers=true");let i=await fetch(a,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:o});if(!i.ok){let e=await i.json(),t=nj(e);throw j(t),Error(t)}let l=await i.json();return console.log("API Response:",l),l}catch(e){throw console.error("Failed to create key:",e),e}},tp=async(e,t)=>{try{let r=$?`${$}/health/services?service=${t}`:`/health/services?service=${t}`;console.log("Checking Slack Budget Alerts service health");let n=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.text();throw j(e),Error(e)}return await n.json()}catch(e){throw console.error("Failed to perform health check:",e),e}},tm=async e=>{try{let t=$?`${$}/budget/list`:"/budget/list",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nj(e);throw j(t),Error(t)}return await r.json()}catch(e){throw console.error("Failed to get callbacks:",e),e}},th=async(e,t,r)=>{try{let t=$?`${$}/get/config/callbacks`:"/get/config/callbacks",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nj(e);throw j(t),Error(t)}return await r.json()}catch(e){throw console.error("Failed to get callbacks:",e),e}},tg=async e=>{try{let t=$?`${$}/config/list?config_type=general_settings`:"/config/list?config_type=general_settings",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nj(e);throw j(t),Error(t)}return await r.json()}catch(e){throw console.error("Failed to get callbacks:",e),e}},tv=async e=>{try{let t=$?`${$}/router/settings`:"/router/settings",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nj(e);throw j(t),Error(t)}return await r.json()}catch(e){throw console.error("Failed to get router settings:",e),e}},ty=async e=>{try{let t=$?`${$}/cache/settings`:"/cache/settings",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nj(e);throw j(t),Error(t)}return await r.json()}catch(e){throw console.error("Failed to get cache settings:",e),e}},tb=async(e,t)=>{try{let r=$?`${$}/cache/settings/test`:"/cache/settings/test",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({cache_settings:t})});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to test cache connection:",e),e}},tw=async(e,t)=>{try{let r=$?`${$}/cache/settings`:"/cache/settings",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({cache_settings:t})});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to update cache settings:",e),e}},t$=async(e,t)=>{try{let r=$?`${$}/config/pass_through_endpoint`:"/config/pass_through_endpoint";t&&(r+=`/team/${t}`);let n=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to get callbacks:",e),e}},tC=async(e,t)=>{try{let r=$?`${$}/config/field/info?field_name=${t}`:`/config/field/info?field_name=${t}`,n=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to set callbacks:",e),e}},tE=async(e,t)=>{try{let r=$?`${$}/config/pass_through_endpoint`:"/config/pass_through_endpoint",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({...t})});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to set callbacks:",e),e}},tS=async(e,t,r)=>{try{let n=$?`${$}/config/field/update`:"/config/field/update",o=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({field_name:t,field_value:r,config_type:"general_settings"})});if(!o.ok){let e=await o.json(),t=nj(e);throw j(t),Error(t)}let a=await o.json();return g.default.success("Successfully updated value!"),a}catch(e){throw console.error("Failed to set callbacks:",e),e}},tx=async(e,t)=>{try{let r=$?`${$}/config/field/delete`:"/config/field/delete",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({field_name:t,config_type:"general_settings"})});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}let o=await n.json();return g.default.success("Field reset on proxy"),o}catch(e){throw console.error("Failed to get callbacks:",e),e}},tj=async(e,t)=>{try{let r=$?`${$}/config/pass_through_endpoint?endpoint_id=${t}`:`/config/pass_through_endpoint?endpoint_id=${t}`,n=await fetch(r,{method:"DELETE",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to get callbacks:",e),e}},tO=async(e,t)=>{try{let r=$?`${$}/config/update`:"/config/update",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({...t})});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to set callbacks:",e),e}},tk=async(e,t)=>{try{let r=$?`${$}/health?model_id=${encodeURIComponent(t)}`:`/health?model_id=${encodeURIComponent(t)}`,n=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error(`Failed to call /health for model id ${t}:`,e),e}},tT=async e=>{try{let t=$?`${$}/cache/ping`:"/cache/ping",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.text();throw j(e),Error(e)}return await r.json()}catch(e){throw console.error("Failed to call /cache/ping:",e),e}},tF=async e=>{try{let t=$?`${$}/health/latest`:"/health/latest",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.text();throw j(e),Error(e)}return await r.json()}catch(e){throw console.error("Failed to call /health/latest:",e),e}},t_=async e=>{try{console.log("Getting proxy UI settings"),console.log("proxyBaseUrl in getProxyUISettings:",$);let t=$?`${$}/sso/get/ui_settings`:"/sso/get/ui_settings",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nj(e);throw j(t),Error(t)}return await r.json()}catch(e){throw console.error("Failed to get callbacks:",e),e}},tI=async e=>{try{let t=$?`${$}/get/ui_settings`:"/get/ui_settings",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nj(e);return console.error("Failed to get UI settings:",t),null}return await r.json()}catch(e){return console.error("Failed to get UI settings:",e),null}},tP=async e=>{try{let t=$?`${$}/get/mcp_semantic_filter_settings`:"/get/mcp_semantic_filter_settings",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nj(e);throw j(t),Error(t)}return await r.json()}catch(e){throw console.error("Failed to get MCP semantic filter settings:",e),e}},tN=async(e,t)=>{try{let r=$?`${$}/update/mcp_semantic_filter_settings`:"/update/mcp_semantic_filter_settings",n=await fetch(r,{method:"PATCH",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to update MCP semantic filter settings:",e),e}},tR=async(e,t,r)=>{try{let n=$?`${$}/v1/responses`:"/v1/responses",o=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({model:t,input:[{role:"user",content:r,type:"message"}],tools:[{type:"mcp",server_url:"litellm_proxy",require_approval:"never"}],tool_choice:"required"})}),a=o.headers.get("x-litellm-semantic-filter"),i=o.headers.get("x-litellm-semantic-filter-tools");if(!o.ok){let e=await o.json(),t=nj(e);throw j(t),Error(t)}return{data:await o.json(),headers:{filter:a,tools:i}}}catch(e){throw console.error("Failed to test MCP semantic filter:",e),e}},tM=async e=>{try{let t=$?`${$}/v2/guardrails/list`:"/v2/guardrails/list",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok)throw Error(`v2 guardrails/list returned ${r.status}`);return await r.json()}catch(t){console.log("v2/guardrails/list failed, falling back to v1:",t);try{let t=$?`${$}/guardrails/list`:"/guardrails/list",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nj(e);throw j(t),Error(t)}return await r.json()}catch(e){throw console.error("Failed to get guardrails list:",e),e}}},tB=async(e,t)=>{let r=$?`${$}/guardrails/submissions`:"/guardrails/submissions",n=new URLSearchParams;t?.status&&n.set("status",t.status),t?.team_id&&n.set("team_id",t.team_id),t?.team_guardrail!==void 0&&n.set("team_guardrail",String(t.team_guardrail)),t?.search&&n.set("search",t.search);let o=n.toString()?`${r}?${n.toString()}`:r,a=await fetch(o,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!a.ok){let e=nj(await a.json().catch(()=>({})));throw j(e),Error(e)}return a.json()},tA=async(e,t)=>{let r=$?`${$}/guardrails/submissions/${encodeURIComponent(t)}/approve`:`/guardrails/submissions/${encodeURIComponent(t)}/approve`,n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=nj(await n.json().catch(()=>({})));throw j(e),Error(e)}return n.json()},tz=async(e,t)=>{let r=$?`${$}/guardrails/submissions/${encodeURIComponent(t)}/reject`:`/guardrails/submissions/${encodeURIComponent(t)}/reject`,n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=nj(await n.json().catch(()=>({})));throw j(e),Error(e)}return n.json()},tL=async(e,t,r)=>{try{let n=$?`${$}/guardrails/usage/overview`:"/guardrails/usage/overview",o=new URLSearchParams;t&&o.append("start_date",t),r&&o.append("end_date",r),o.toString()&&(n+=`?${o.toString()}`);let a=await fetch(n,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!a.ok){let e=await a.json();throw Error(nj(e))}return a.json()}catch(e){throw console.error("Failed to get guardrails usage overview:",e),e}},tH=async(e,t,r,n)=>{try{let o=$?`${$}/guardrails/usage/detail/${encodeURIComponent(t)}`:`/guardrails/usage/detail/${encodeURIComponent(t)}`,a=new URLSearchParams;r&&a.append("start_date",r),n&&a.append("end_date",n),a.toString()&&(o+=`?${a.toString()}`);let i=await fetch(o,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!i.ok){let e=await i.json();throw Error(nj(e))}return i.json()}catch(e){throw console.error("Failed to get guardrails usage detail:",e),e}},tD=async(e,t)=>{try{let r=$?`${$}/guardrails/usage/logs`:"/guardrails/usage/logs",n=new URLSearchParams;t.guardrailId&&n.append("guardrail_id",t.guardrailId),t.policyId&&n.append("policy_id",t.policyId),null!=t.page&&n.append("page",String(t.page)),null!=t.pageSize&&n.append("page_size",String(t.pageSize)),t.action&&n.append("action",t.action),t.startDate&&n.append("start_date",t.startDate),t.endDate&&n.append("end_date",t.endDate),n.toString()&&(r+=`?${n.toString()}`);let o=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!o.ok){let e=await o.json();throw Error(nj(e))}return o.json()}catch(e){throw console.error("Failed to get guardrails usage logs:",e),e}},tV=async e=>{try{let t=$?`${$}/policies/list`:"/policies/list",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nj(e);throw j(t),Error(t)}return await r.json()}catch(e){throw console.error("Failed to get policies list:",e),e}},tW=async(e,t,r)=>{try{let n=$?`${$}/utils/test_policies_and_guardrails`:"/utils/test_policies_and_guardrails",o=await fetch(n,{method:"POST",signal:r,headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({policy_names:t.policy_names??null,guardrail_names:t.guardrail_names??null,inputs:t.inputs??null,inputs_list:t.inputs_list??null,request_data:t.request_data??{},input_type:t.input_type??"request",agent_id:t.agent_id??null})});if(!o.ok){let e=await o.text(),t="Failed to test policies and guardrails";try{let r=JSON.parse(e);r.detail?t="string"==typeof r.detail?r.detail:JSON.stringify(r.detail):r.message&&(t=r.message)}catch{t=e||t}throw j(t),Error(t)}return await o.json()}catch(e){throw console.error("Failed to test policies and guardrails:",e),e}},tG=async(e,t)=>{try{let r=$?`${$}/policy/info/${t}`:`/policy/info/${t}`,n=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error(`Failed to get policy info for ${t}:`,e),e}},tU=async e=>{try{let t=$?`${$}/policy/templates`:"/policy/templates",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nj(e);throw j(t),Error(t)}return await r.json()}catch(e){throw console.error("Failed to get policy templates:",e),e}},tq=async(e,t,r,n,o)=>{try{let a=$?`${$}/policy/templates/enrich`:"/policy/templates/enrich",i={template_id:t,parameters:r};n&&(i.model=n),o&&(i.competitors=o);let l=await fetch(a,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(i)});if(!l.ok){let e=await l.json(),t=nj(e);throw j(t),Error(t)}return await l.json()}catch(e){throw console.error("Failed to enrich policy template:",e),e}},tJ=async(e,t,r,n)=>{try{let o=$?`${$}/policy/templates/suggest`:"/policy/templates/suggest",a=await fetch(o,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({attack_examples:t.filter(e=>e.trim()),description:r,model:n})});if(!a.ok){let e=await a.json(),t=nj(e);throw j(t),Error(t)}return a.json()}catch(e){throw console.error("Failed to suggest policy templates:",e),e}},tK=async(e,t,r)=>{try{let n=$?`${$}/policy/templates/test`:"/policy/templates/test",o=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({guardrail_definitions:t,text:r})});if(!o.ok){let e=await o.json(),t=nj(e);throw j(t),Error(t)}return o.json()}catch(e){throw console.error("Failed to test policy template:",e),e}},tX=async(e,t,r,n,o,a,i,l,s)=>{let c=$?`${$}/policy/templates/enrich/stream`:"/policy/templates/enrich/stream",u={template_id:t,parameters:r,model:n};l?.instruction&&(u.instruction=l.instruction),l?.existingCompetitors&&(u.competitors=l.existingCompetitors);let d=await fetch(c,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(u)});if(!d.ok){let e=nj(await d.json());throw j(e),Error(e)}let f=d.body?.getReader();if(!f)throw Error("No response body");let p=new TextDecoder,m="";for(;;){let{done:e,value:t}=await f.read();if(e)break;let r=(m+=p.decode(t,{stream:!0})).split("\n");for(let e of(m=r.pop()||"",r))if(e.startsWith("data: "))try{let t=JSON.parse(e.slice(6));"competitor"===t.type?o(t.name):"status"===t.type?s?.(t.message):"done"===t.type?a(t):"error"===t.type&&i?.(t.message)}catch{}}},tY=async(e,t,r,n,o,a,i,l,s)=>{let c=$?`${$}/usage/ai/chat`:"/usage/ai/chat",u=await fetch(c,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({messages:t,model:r}),signal:s});if(!u.ok){let e=nj(await u.json());throw j(e),Error(e)}let d=u.body?.getReader();if(!d)throw Error("No response body");let f=new TextDecoder,p="";for(;;){let{done:e,value:t}=await d.read();if(e)break;let r=(p+=f.decode(t,{stream:!0})).split("\n");for(let e of(p=r.pop()||"",r))if(e.startsWith("data: "))try{let t=JSON.parse(e.slice(6));"chunk"===t.type?n(t.content):"status"===t.type?i?.(t.message):"tool_call"===t.type?l?.(t):"done"===t.type?o():"error"===t.type&&a?.(t.message)}catch{}}},tZ=async(e,t)=>{try{let r=$?`${$}/policies`:"/policies",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to create policy:",e),e}},tQ=async(e,t,r)=>{try{let n=$?`${$}/policies/${t}`:`/policies/${t}`,o=await fetch(n,{method:"PUT",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(r)});if(!o.ok){let e=await o.json(),t=nj(e);throw j(t),Error(t)}return await o.json()}catch(e){throw console.error("Failed to update policy:",e),e}},t0=async(e,t)=>{try{let r=encodeURIComponent(t),n=$?`${$}/policies/name/${r}/versions`:`/policies/name/${r}/versions`,o=await fetch(n,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!o.ok){let e=await o.json(),t=nj(e);throw j(t),Error(t)}return await o.json()}catch(e){throw console.error("Failed to list policy versions:",e),e}},t1=async(e,t,r)=>{try{let n=encodeURIComponent(t),o=$?`${$}/policies/name/${n}/versions`:`/policies/name/${n}/versions`,a=await fetch(o,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({source_policy_id:r??void 0})});if(!a.ok){let e=await a.json(),t=nj(e);throw j(t),Error(t)}return await a.json()}catch(e){throw console.error("Failed to create policy version:",e),e}},t2=async(e,t,r)=>{try{let n=$?`${$}/policies/${t}/status`:`/policies/${t}/status`,o=await fetch(n,{method:"PUT",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({version_status:r})});if(!o.ok){let e=await o.json(),t=nj(e);throw j(t),Error(t)}return await o.json()}catch(e){throw console.error("Failed to update policy version status:",e),e}},t4=async(e,t)=>{try{let r=$?`${$}/policies/${t}`:`/policies/${t}`,n=await fetch(r,{method:"DELETE",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to delete policy:",e),e}},t6=async(e,t)=>{try{let r=$?`${$}/policies/${t}`:`/policies/${t}`,n=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to get policy info:",e),e}},t3=async e=>{try{let t=$?`${$}/policies/attachments/list`:"/policies/attachments/list",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nj(e);throw j(t),Error(t)}return await r.json()}catch(e){throw console.error("Failed to get policy attachments list:",e),e}},t7=async(e,t)=>{try{let r=$?`${$}/policies/attachments`:"/policies/attachments",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to create policy attachment:",e),e}},t5=async(e,t)=>{try{let r=$?`${$}/policies/attachments/${t}`:`/policies/attachments/${t}`,n=await fetch(r,{method:"DELETE",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to delete policy attachment:",e),e}},t9=async(e,t,r)=>{try{let n=$?`${$}/policies/test-pipeline`:"/policies/test-pipeline",o=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({pipeline:t,test_messages:r})});if(!o.ok){let e=await o.json(),t=nj(e);throw j(t),Error(t)}return await o.json()}catch(e){throw console.error("Failed to test pipeline:",e),e}},t8=async(e,t)=>{try{let r=$?`${$}/policies/${t}/resolved-guardrails`:`/policies/${t}/resolved-guardrails`,n=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to get resolved guardrails:",e),e}},re=async(e,t)=>{try{let r=$?`${$}/policies/resolve`:"/policies/resolve",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to resolve policies:",e),e}},rt=async(e,t)=>{try{let r=$?`${$}/policies/attachments/estimate-impact`:"/policies/attachments/estimate-impact",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to estimate attachment impact:",e),e}},rr=async e=>{try{let t=$?`${$}/prompts/list`:"/prompts/list",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nj(e);throw j(t),Error(t)}return await r.json()}catch(e){throw console.error("Failed to get prompts list:",e),e}},rn=async(e,t)=>{try{let r=$?`${$}/prompts/${t}/info`:`/prompts/${t}/info`,n=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to get prompt info:",e),e}},ro=async(e,t)=>{try{let r=$?`${$}/prompts/${t}/versions`:`/prompts/${t}/versions`,n=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nj(e);throw 404!==n.status&&j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to get prompt versions:",e),e}},ra=async(e,t)=>{try{let r=$?`${$}/prompts`:"/prompts",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to create prompt:",e),e}},ri=async(e,t,r)=>{try{let n=$?`${$}/prompts/${t}`:`/prompts/${t}`,o=await fetch(n,{method:"PUT",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(r)});if(!o.ok){let e=await o.json(),t=nj(e);throw j(t),Error(t)}return await o.json()}catch(e){throw console.error("Failed to update prompt:",e),e}},rl=async(e,t)=>{try{let r=$?`${$}/prompts/${t}`:`/prompts/${t}`,n=await fetch(r,{method:"DELETE",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to delete prompt:",e),e}},rs=async(e,t)=>{try{let r=new FormData;r.append("file",t);let n=$?`${$}/utils/dotprompt_json_converter`:"/utils/dotprompt_json_converter",o=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`},body:r});if(!o.ok){let e=await o.json(),t=nj(e);throw j(t),Error(t)}return await o.json()}catch(e){throw console.error("Failed to convert prompt file:",e),e}},rc=async(e,t)=>{try{let r=$?`${$}/v1/agents`:"/v1/agents",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({...t})});if(!n.ok){let e=await n.text();throw j(e),Error(e)}let o=await n.json();return console.log("Create agent response:",o),o}catch(e){throw console.error("Failed to create agent:",e),e}},ru=async(e,t)=>{try{let r=$?`${$}/guardrails`:"/guardrails",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({guardrail:t})});if(!n.ok){let e=await n.text();throw j(e),Error(e)}let o=await n.json();return console.log("Create guardrail response:",o),o}catch(e){throw console.error("Failed to create guardrail:",e),e}},rd=async(e,t,r)=>{try{let n=$?`${$}/spend/logs/ui/${t}?start_date=${encodeURIComponent(r)}`:`/spend/logs/ui/${t}?start_date=${encodeURIComponent(r)}`;console.log("Fetching log details from:",n);let o=await fetch(n,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!o.ok){let e=await o.json(),t=nj(e);throw j(t),Error(t)}let a=await o.json();return console.log("Fetched log details:",a),a}catch(e){throw console.error("Failed to fetch log details:",e),e}},rf=async e=>{try{let t=$?`${$}/get/internal_user_settings`:"/get/internal_user_settings";console.log("Fetching SSO settings from:",t);let r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nj(e);throw j(t),Error(t)}let n=await r.json();return console.log("Fetched SSO settings:",n),n}catch(e){throw console.error("Failed to fetch SSO settings:",e),e}},rp=async(e,t)=>{try{let r=$?`${$}/update/internal_user_settings`:"/update/internal_user_settings";console.log("Updating internal user settings:",t);let n=await fetch(r,{method:"PATCH",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){let e=await n.text();throw j(e),Error(e)}let o=await n.json();return console.log("Updated internal user settings:",o),g.default.success("Internal user settings updated successfully"),o}catch(e){throw console.error("Failed to update internal user settings:",e),e}},rm=async e=>{try{let t=$?`${$}/v1/mcp/openapi-registry`:"/v1/mcp/openapi-registry",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json();throw Error(nj(e))}return await r.json()}catch(e){throw console.error("Failed to fetch OpenAPI registry:",e),e}},rh=async e=>{try{let t=$?`${$}/v1/mcp/discover`:"/v1/mcp/discover",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nj(e);throw j(t),Error(t)}return await r.json()}catch(e){throw console.error("Failed to fetch discoverable MCP servers:",e),e}},rg=async(e,t)=>{try{let r=$?`${$}/v1/mcp/server`:"/v1/mcp/server";if(t){let e=new URLSearchParams;e.append("team_id",t),r=`${r}?${e.toString()}`}console.log("Fetching MCP servers from:",r);let n=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}let o=await n.json();return console.log("Fetched MCP servers:",o),o}catch(e){throw console.error("Failed to fetch MCP servers:",e),e}},rv=async(e,t)=>{try{let r=$?`${$}/v1/mcp/server/health`:"/v1/mcp/server/health";if(t&&t.length>0){let e=new URLSearchParams;t.forEach(t=>e.append("server_ids",t)),r=`${r}?${e.toString()}`}console.log("Fetching MCP server health from:",r);let n=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}let o=await n.json();return console.log("Fetched MCP server health:",o),o}catch(e){throw console.error("Failed to fetch MCP server health:",e),e}},ry=async e=>{try{let t=$?`${$}/v1/mcp/access_groups`:"/v1/mcp/access_groups";console.log("Fetching MCP access groups from:",t);let r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nj(e);throw j(t),Error(t)}let n=await r.json();return console.log("Fetched MCP access groups:",n),n.access_groups||[]}catch(e){throw console.error("Failed to fetch MCP access groups:",e),e}},rb=async e=>{try{let t=$?`${$}/v1/mcp/network/client-ip`:"/v1/mcp/network/client-ip",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`}});if(!r.ok)return null;return(await r.json()).ip||null}catch{return null}},rw=async(e,t)=>{try{console.log("Form Values in createMCPServer:",t);let r=$?`${$}/v1/mcp/server`:"/v1/mcp/server",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({...t})});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}let o=await n.json();return console.log("API Response:",o),o}catch(e){throw console.error("Failed to create key:",e),e}},r$=async(e,t)=>{try{let r=$?`${$}/v1/mcp/server`:"/v1/mcp/server",n=await fetch(r,{method:"PUT",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to update MCP server:",e),e}},rC=async(e,t)=>{try{let r=($?`${$}`:"")+`/v1/mcp/server/${t}`;console.log("in deleteMCPServer:",t);let n=await fetch(r,{method:S,headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}}catch(e){throw console.error("Failed to delete key:",e),e}},rE=async(e,t)=>{try{let r=($?`${$}`:"")+"/v1/mcp/server/register",n=await fetch(r,{method:E,headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}return n.json()}catch(e){throw console.error("Failed to register MCP server:",e),e}},rS=async e=>{try{let t=($?`${$}`:"")+"/v1/mcp/server/submissions",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json().catch(()=>({})),t=nj(e);throw j(t),Error(t)}return r.json()}catch(e){throw console.error("Failed to fetch MCP submissions:",e),e}},rx=async(e,t)=>{try{let r=($?`${$}`:"")+`/v1/mcp/server/${encodeURIComponent(t)}/approve`,n=await fetch(r,{method:"PUT",headers:{[T]:`Bearer ${e}`}});if(!n.ok){let e=await n.json().catch(()=>({})),t=nj(e);throw j(t),Error(t)}return n.json()}catch(e){throw console.error("Failed to approve MCP server:",e),e}},rj=async(e,t,r)=>{try{let n=($?`${$}`:"")+`/v1/mcp/server/${encodeURIComponent(t)}/reject`,o=await fetch(n,{method:"PUT",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({review_notes:r??null})});if(!o.ok){let e=await o.json().catch(()=>({})),t=nj(e);throw j(t),Error(t)}return o.json()}catch(e){throw console.error("Failed to reject MCP server:",e),e}},rO=async e=>{try{let t=$?`${$}/search_tools/list`:"/search_tools/list";console.log("Fetching search tools from:",t);let r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nj(e);throw j(t),Error(t)}let n=await r.json();return console.log("Fetched search tools:",n),n}catch(e){throw console.error("Failed to fetch search tools:",e),e}},rk=async(e,t)=>{try{console.log("Creating search tool with values:",t);let r=$?`${$}/search_tools`:"/search_tools",n=await fetch(r,{method:E,headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({search_tool:t})});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}let o=await n.json();return console.log("Created search tool:",o),o}catch(e){throw console.error("Failed to create search tool:",e),e}},rT=async(e,t,r)=>{try{console.log("Updating search tool with ID:",t,"values:",r);let n=$?`${$}/search_tools/${t}`:`/search_tools/${t}`,o=await fetch(n,{method:"PUT",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({search_tool:r})});if(!o.ok){let e=await o.json(),t=nj(e);throw j(t),Error(t)}let a=await o.json();return console.log("Updated search tool:",a),a}catch(e){throw console.error("Failed to update search tool:",e),e}},rF=async(e,t)=>{try{let r=($?`${$}`:"")+`/search_tools/${t}`;console.log("Deleting search tool:",t);let n=await fetch(r,{method:S,headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}let o=await n.json();return console.log("Deleted search tool:",o),o}catch(e){throw console.error("Failed to delete search tool:",e),e}},r_=async e=>{try{let t=$?`${$}/search_tools/ui/available_providers`:"/search_tools/ui/available_providers";console.log("Fetching available search providers from:",t);let r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nj(e);throw j(t),Error(t)}let n=await r.json();return console.log("Fetched available search providers:",n),n}catch(e){throw console.error("Failed to fetch available search providers:",e),e}},rI=async(e,t)=>{try{let r=$?`${$}/search_tools/test_connection`:"/search_tools/test_connection";console.log("Testing search tool connection:",r);let n=await fetch(r,{method:E,headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({litellm_params:t})});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}let o=await n.json();return console.log("Test connection response:",o),o}catch(e){throw console.error("Failed to test search tool connection:",e),e}},rP=async(e,t,r)=>{try{let n=$?`${$}/mcp-rest/tools/list?server_id=${t}`:`/mcp-rest/tools/list?server_id=${t}`;console.log("Fetching MCP tools from:",n);let o={[T]:`Bearer ${e}`,"Content-Type":"application/json",...r},a=await fetch(n,{method:"GET",headers:o}),i=await a.json();if(console.log("Fetched MCP tools response:",i),!a.ok){if(i.error&&i.message)throw Error(i.message);throw Error("Failed to fetch MCP tools")}return i}catch(e){return console.error("Failed to fetch MCP tools:",e),{tools:[],error:"network_error",message:e instanceof Error?e.message:"Failed to fetch MCP tools",stack_trace:null}}},rN=async(e,t,r,n,o)=>{try{let a=$?`${$}/mcp-rest/tools/call`:"/mcp-rest/tools/call";console.log("Calling MCP tool:",r,"with arguments:",n,"for server:",t);let i={[T]:`Bearer ${e}`,"Content-Type":"application/json",...o?.customHeaders||{}},l={server_id:t,name:r,arguments:n};o?.guardrails&&o.guardrails.length>0&&(l.litellm_metadata={guardrails:o.guardrails});let s=await fetch(a,{method:"POST",headers:i,body:JSON.stringify(l)});if(!s.ok){let e="Network response was not ok",t=null,r=await s.text();try{let n=JSON.parse(r);n.detail?"string"==typeof n.detail?e=n.detail:"object"==typeof n.detail&&(e=n.detail.message||n.detail.error||"An error occurred",t=n.detail):e=n.message||n.error||e}catch(t){console.error("Failed to parse JSON error response:",t),r&&(e=r)}let n=Error(e);throw n.status=s.status,n.statusText=s.statusText,n.details=t,j(e),n}let c=await s.json();return console.log("MCP tool call response:",c),c}catch(e){throw console.error("Failed to call MCP tool:",e),console.error("Error type:",typeof e),e instanceof Error&&(console.error("Error message:",e.message),console.error("Error stack:",e.stack)),e}},rR=async(e,t)=>{try{let r=$?`${$}/tag/new`:"/tag/new",n=await fetch(r,{method:"POST",headers:{"Content-Type":"application/json",[T]:`Bearer ${e}`},body:JSON.stringify(t)});if(!n.ok){let e=await n.text();await j(e);return}return await n.json()}catch(e){throw console.error("Error creating tag:",e),e}},rM=async(e,t)=>{try{let r=$?`${$}/tag/update`:"/tag/update",n=await fetch(r,{method:"POST",headers:{"Content-Type":"application/json",[T]:`Bearer ${e}`},body:JSON.stringify(t)});if(!n.ok){let e=await n.text();await j(e);return}return await n.json()}catch(e){throw console.error("Error updating tag:",e),e}},rB=async(e,t)=>{try{let r=$?`${$}/tag/info`:"/tag/info",n=await fetch(r,{method:"POST",headers:{"Content-Type":"application/json",[T]:`Bearer ${e}`},body:JSON.stringify({names:t})});if(!n.ok){let e=await n.text();return await j(e),{}}return await n.json()}catch(e){throw console.error("Error getting tag info:",e),e}},rA=async e=>{try{let t=$?`${$}/tag/list`:"/tag/list",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`}});if(!r.ok){let e=await r.text();return await j(e),{}}return await r.json()}catch(e){throw console.error("Error listing tags:",e),e}},rz=async(e,t)=>{try{let r=$?`${$}/tag/delete`:"/tag/delete",n=await fetch(r,{method:"POST",headers:{"Content-Type":"application/json",[T]:`Bearer ${e}`},body:JSON.stringify({name:t})});if(!n.ok){let e=await n.text();await j(e);return}return await n.json()}catch(e){throw console.error("Error deleting tag:",e),e}},rL=async e=>{try{let t=$?`${$}/get/default_team_settings`:"/get/default_team_settings";console.log("Fetching default team settings from:",t);let r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nj(e);throw j(t),Error(t)}let n=await r.json();return console.log("Fetched default team settings:",n),n}catch(e){throw console.error("Failed to fetch default team settings:",e),e}},rH=async(e,t)=>{try{let r=$?`${$}/update/default_team_settings`:"/update/default_team_settings";console.log("Updating default team settings:",t);let n=await fetch(r,{method:"PATCH",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}let o=await n.json();return console.log("Updated default team settings:",o),g.default.success("Default team settings updated successfully"),o}catch(e){throw console.error("Failed to update default team settings:",e),e}},rD=async(e,t)=>{try{let r=$?`${$}/team/permissions_list?team_id=${t}`:`/team/permissions_list?team_id=${t}`,n=await fetch(r,{method:"GET",headers:{"Content-Type":"application/json",[T]:`Bearer ${e}`}});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}let o=await n.json();return console.log("Team permissions response:",o),o}catch(e){throw console.error("Failed to get team permissions:",e),e}},rV=async(e,t,r)=>{try{let n=$?`${$}/team/permissions_update`:"/team/permissions_update",o=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json",[T]:`Bearer ${e}`},body:JSON.stringify({team_id:t,team_member_permissions:r})});if(!o.ok){let e=await o.json(),t=nj(e);throw j(t),Error(t)}let a=await o.json();return console.log("Team permissions response:",a),a}catch(e){throw console.error("Failed to update team permissions:",e),e}},rW=async(e,t)=>{try{let r=$?`${$}/spend/logs/session/ui?session_id=${encodeURIComponent(t)}`:`/spend/logs/session/ui?session_id=${encodeURIComponent(t)}`,n=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to fetch session logs:",e),e}},rG=async(e,t)=>{try{let r=$?`${$}/vector_store/new`:"/vector_store/new",n=await fetch(r,{method:"POST",headers:{"Content-Type":"application/json",[T]:`Bearer ${e}`},body:JSON.stringify(t)});if(!n.ok){let e=await n.json();throw Error(e.detail||"Failed to create vector store")}return await n.json()}catch(e){throw console.error("Error creating vector store:",e),e}},rU=async(e,t=1,r=100)=>{try{let t=$?`${$}/vector_store/list`:"/vector_store/list",r=await fetch(t,{method:"GET",headers:{"Content-Type":"application/json",[T]:`Bearer ${e}`}});if(!r.ok){let e=await r.json();throw Error(e.detail||"Failed to list vector stores")}return await r.json()}catch(e){throw console.error("Error listing vector stores:",e),e}},rq=async(e,t)=>{try{let r=$?`${$}/vector_store/delete`:"/vector_store/delete",n=await fetch(r,{method:"POST",headers:{"Content-Type":"application/json",[T]:`Bearer ${e}`},body:JSON.stringify({vector_store_id:t})});if(!n.ok){let e=await n.json();throw Error(e.detail||"Failed to delete vector store")}return await n.json()}catch(e){throw console.error("Error deleting vector store:",e),e}},rJ=async(e,t)=>{try{let r=$?`${$}/vector_store/info`:"/vector_store/info",n=await fetch(r,{method:"POST",headers:{"Content-Type":"application/json",[T]:`Bearer ${e}`},body:JSON.stringify({vector_store_id:t})});if(!n.ok){let e=await n.json();throw Error(e.detail||"Failed to get vector store info")}return await n.json()}catch(e){throw console.error("Error getting vector store info:",e),e}},rK=async(e,t)=>{try{let r=$?`${$}/vector_store/update`:"/vector_store/update",n=await fetch(r,{method:"POST",headers:{"Content-Type":"application/json",[T]:`Bearer ${e}`},body:JSON.stringify(t)});if(!n.ok){let e=await n.json();throw Error(e.detail||"Failed to update vector store")}return await n.json()}catch(e){throw console.error("Error updating vector store:",e),e}},rX=async(e,t,r,n,o,a,i)=>{try{let l=$?`${$}/rag/ingest`:"/rag/ingest",s=new FormData;s.append("file",t);let c={ingest_options:{vector_store:{custom_llm_provider:r,...n&&{vector_store_id:n},...i&&i}}};(o||a)&&(c.ingest_options.litellm_vector_store_params={},o&&(c.ingest_options.litellm_vector_store_params.vector_store_name=o),a&&(c.ingest_options.litellm_vector_store_params.vector_store_description=a)),s.append("request",JSON.stringify(c));let u=await fetch(l,{method:"POST",headers:{[T]:`Bearer ${e}`},body:s});if(!u.ok){let e=await u.json();throw Error(e.error?.message||e.detail||"Failed to ingest document")}return await u.json()}catch(e){throw console.error("Error ingesting document:",e),e}},rY=async e=>{try{let t=$?`${$}/email/event_settings`:"/email/event_settings",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.text();throw j(e),Error("Failed to get email event settings")}let n=await r.json();return console.log("Email event settings response:",n),n}catch(e){throw console.error("Failed to get email event settings:",e),e}},rZ=async(e,t)=>{try{let r=$?`${$}/email/event_settings`:"/email/event_settings",n=await fetch(r,{method:"PATCH",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){let e=await n.text();throw j(e),Error("Failed to update email event settings")}let o=await n.json();return console.log("Update email event settings response:",o),o}catch(e){throw console.error("Failed to update email event settings:",e),e}},rQ=async e=>{try{let t=$?`${$}/email/event_settings/reset`:"/email/event_settings/reset",r=await fetch(t,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.text();throw j(e),Error("Failed to reset email event settings")}let n=await r.json();return console.log("Reset email event settings response:",n),n}catch(e){throw console.error("Failed to reset email event settings:",e),e}},r0=async(e,t)=>{try{let r=$?`${$}/v1/agents/${t}`:`/v1/agents/${t}`,n=await fetch(r,{method:"DELETE",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.text();throw j(e),Error(e)}let o=await n.json();return console.log("Delete agent response:",o),o}catch(e){throw console.error("Failed to delete agent:",e),e}},r1=async(e,t)=>{try{let r=$?`${$}/v1/agents/make_public`:"/v1/agents/make_public",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({agent_ids:t})});if(!n.ok){let e=await n.text();throw j(e),Error(e)}let o=await n.json();return console.log("Make agents public response:",o),o}catch(e){throw console.error("Failed to make agents public:",e),e}},r2=async(e,t)=>{try{let r=$?`${$}/v1/mcp/make_public`:"/v1/mcp/make_public",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({mcp_server_ids:t})});if(!n.ok){let e=await n.text();throw j(e),Error(e)}let o=await n.json();return console.log("Make agents public response:",o),o}catch(e){throw console.error("Failed to make agents public:",e),e}},r4=async(e,t)=>{try{let r=$?`${$}/guardrails/${t}`:`/guardrails/${t}`,n=await fetch(r,{method:"DELETE",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.text();throw j(e),Error(e)}let o=await n.json();return console.log("Delete guardrail response:",o),o}catch(e){throw console.error("Failed to delete guardrail:",e),e}},r6=async e=>{try{let t=$?`${$}/guardrails/ui/add_guardrail_settings`:"/guardrails/ui/add_guardrail_settings",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.text();throw j(e),Error("Failed to get guardrail UI settings")}let n=await r.json();return console.log("Guardrail UI settings response:",n),n}catch(e){throw console.error("Failed to get guardrail UI settings:",e),e}},r3=async e=>{try{let t=$?`${$}/guardrails/ui/provider_specific_params`:"/guardrails/ui/provider_specific_params",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.text();throw j(e),Error("Failed to get guardrail provider specific parameters")}let n=await r.json();return console.log("Guardrail provider specific params response:",n),n}catch(e){throw console.error("Failed to get guardrail provider specific parameters:",e),e}},r7=async(e,t)=>{try{let r=encodeURIComponent(t),n=$?`${$}/guardrails/ui/category_yaml/${r}`:`/guardrails/ui/category_yaml/${r}`;console.log(`Fetching category YAML from: ${n}`);let o=await fetch(n,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!o.ok){let e=await o.text();throw console.error(`Failed to get category YAML. Status: ${o.status}, Error:`,e),j(e),Error(`Failed to get category YAML: ${o.status} ${e}`)}let a=await o.json();return console.log("Category YAML response:",a),a}catch(e){throw console.error("Failed to get category YAML:",e),e}},r5=async e=>{try{let t=$?`${$}/guardrails/ui/major_airlines`:"/guardrails/ui/major_airlines",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.text();throw console.error(`Failed to get major airlines. Status: ${r.status}, Error:`,e),j(e),Error(`Failed to get major airlines: ${r.status} ${e}`)}return await r.json()}catch(e){throw console.error("Failed to get major airlines:",e),e}},r9=async(e,t=!1)=>{try{let r=t?"?health_check=true":"",n=$?`${$}/v1/agents${r}`:`/v1/agents${r}`,o=await fetch(n,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!o.ok){let e=await o.text();throw j(e),Error("Failed to get agents list")}let a=await o.json();return console.log("Agents list response:",a),{agents:a}}catch(e){throw console.error("Failed to get agents list:",e),e}},r8=async(e,t)=>{try{let r=$?`${$}/v1/agents/${t}`:`/v1/agents/${t}`,n=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.text();throw j(e),Error("Failed to get agent info")}let o=await n.json();return console.log("Agent info response:",o),o}catch(e){throw console.error("Failed to get agent info:",e),e}},ne=async(e,t)=>{try{let r=$?`${$}/guardrails/${t}/info`:`/guardrails/${t}/info`,n=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.text();throw j(e),Error("Failed to get guardrail info")}let o=await n.json();return console.log("Guardrail info response:",o),o}catch(e){throw console.error("Failed to get guardrail info:",e),e}},nt=async(e,t,r)=>{try{let n=$?`${$}/v1/agents/${t}`:`/v1/agents/${t}`,o=await fetch(n,{method:"PATCH",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(r)});if(!o.ok){let e=await o.text();throw j(e),Error("Failed to patch agent")}let a=await o.json();return console.log("Patch agent response:",a),a}catch(e){throw console.error("Failed to update guardrail:",e),e}},nr=async(e,t,r)=>{try{let n=$?`${$}/guardrails/${t}`:`/guardrails/${t}`,o=await fetch(n,{method:"PATCH",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(r)});if(!o.ok){let e=await o.text();throw j(e),Error("Failed to update guardrail")}let a=await o.json();return console.log("Update guardrail response:",a),a}catch(e){throw console.error("Failed to update guardrail:",e),e}},nn=async(e,t,r,n,o)=>{try{let a=$?`${$}/guardrails/apply_guardrail`:"/guardrails/apply_guardrail",i={guardrail_name:t,text:r};n&&(i.language=n),o&&o.length>0&&(i.entities=o);let l=await fetch(a,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(i)});if(!l.ok){let e=await l.text(),t="Failed to apply guardrail";try{let r=JSON.parse(e);r.error?.message?t=r.error.message:r.detail?t=r.detail:r.message&&(t=r.message)}catch(r){t=e||t}throw j(e),Error(t)}let s=await l.json();return console.log("Apply guardrail response:",s),s}catch(e){throw console.error("Failed to apply guardrail:",e),e}},no=async(e,t)=>{try{let r=$?`${$}/guardrails/test_custom_code`:"/guardrails/test_custom_code",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){let e=await n.text(),t="Failed to test custom code guardrail";try{let r=JSON.parse(e);r.error?.message?t=r.error.message:r.detail?t=r.detail:r.message&&(t=r.message)}catch(r){t=e||t}throw j(e),Error(t)}let o=await n.json();return console.log("Test custom code guardrail response:",o),o}catch(e){throw console.error("Failed to test custom code guardrail:",e),e}},na=async(e,t)=>{try{let r=$?`${$}/guardrails/validate_blocked_words_file`:"/guardrails/validate_blocked_words_file",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({file_content:t})});if(!n.ok){let e=await n.text();throw j(e),Error("Failed to validate blocked words file")}let o=await n.json();return console.log("Validate blocked words file response:",o),o}catch(e){throw console.error("Failed to validate blocked words file:",e),e}},ni=async e=>{try{let t=$?`${$}/get/sso_settings`:"/get/sso_settings";console.log("Fetching SSO configuration from:",t);let r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nj(e);throw j(t),Error(t)}let n=await r.json();return console.log("Fetched SSO configuration:",n),n}catch(e){throw console.error("Failed to fetch SSO configuration:",e),e}},nl=async(e,t)=>{try{let r=$?`${$}/update/sso_settings`:"/update/sso_settings";console.log("Updating SSO configuration:",t);let n=await fetch(r,{method:"PATCH",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){let e=await n.json(),t="object"==typeof e?.detail?e.detail?.error||e.detail?.message:e?.detail,r="string"==typeof t&&t.length>0?t:nj(e);j(r);let o=Error(r);throw e?.detail!==void 0&&(o.detail=e.detail),o.rawError=e,o}let o=await n.json();return console.log("Updated SSO configuration:",o),o}catch(e){throw console.error("Failed to update SSO configuration:",e),e}},ns=async({accessToken:e,page:t=1,page_size:r=50,params:n={}})=>{try{let o=$?`${$}/audit`:"/audit",a=new URLSearchParams;for(let[e,o]of(a.append("page",t.toString()),a.append("page_size",r.toString()),Object.entries(n)))null!=o&&""!==o&&a.append(e,String(o));o+=`?${a.toString()}`;let i=await fetch(o,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!i.ok){let e=await i.json(),t=nj(e);throw j(t),Error(t)}return await i.json()}catch(e){throw console.error("Failed to fetch audit logs:",e),e}},nc=async e=>{try{let t=$?`${$}/user/available_users`:"/user/available_users",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`}});if(!r.ok){if(404===r.status)return null;let e=await r.text();throw j(e),Error("Network response was not ok")}return await r.json()}catch(e){throw console.error("Failed to fetch remaining users:",e),e}},nu=async e=>{try{let t=$?`${$}/health/license`:"/health/license",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`}});if(!r.ok){if(404===r.status)return null;let e=await r.text();throw j(e),Error("Network response was not ok")}return await r.json()}catch(e){throw console.error("Failed to fetch license info:",e),e}},nd=async(e,t,r)=>{try{let n=$?`${$}/config/pass_through_endpoint/${encodeURIComponent(t)}`:`/config/pass_through_endpoint/${encodeURIComponent(t)}`,o=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(r)});if(!o.ok){let e=await o.json(),t=nj(e);throw j(t),Error(t)}let a=await o.json();return g.default.success("Pass through endpoint updated successfully"),a}catch(e){throw console.error("Failed to update pass through endpoint:",e),e}},nf=async(e,t)=>{try{let r=$?`${$}/config/callback/delete`:"/config/callback/delete",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({callback_name:t})});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to delete specific callback:",e),e}},np=async(e,t,r)=>{try{console.log("Testing MCP tools list with config:",JSON.stringify(t));let n=$?`${$}/mcp-rest/test/tools/list`:"/mcp-rest/test/tools/list",o={"Content-Type":"application/json"};e&&(o["x-litellm-api-key"]=e),r?o.Authorization=`Bearer ${r}`:e&&(o[T]=`Bearer ${e}`);let a=await fetch(n,{method:"POST",headers:o,body:JSON.stringify(t)}),i=a.headers.get("content-type");if(!i||!i.includes("application/json")){let e=await a.text();throw console.error("Received non-JSON response:",e),Error(`Received non-JSON response (${a.status}: ${a.statusText}). Check network tab for details.`)}let l=await a.json();if((!a.ok||l.error)&&!l.error)return{tools:[],error:"request_failed",message:l.message||`MCP tools list failed: ${a.status} ${a.statusText}`};return l}catch(e){throw console.error("MCP tools list test error:",e),e}},nm=async(e,t)=>{let r=$?`${$}/v1/mcp/server/oauth/session`:"/v1/mcp/server/oauth/session",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)}),o=await n.json();if(!n.ok)throw Error(nj(o)||o?.error||"Failed to cache MCP server");return o},nh=async(e,t,r)=>{let n=C(),o=encodeURIComponent(t.trim()),a=`${n}/v1/mcp/server/oauth/${o}/register`,i=await fetch(a,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json",Accept:"application/json, text/event-stream"},body:JSON.stringify(r)}),l=await i.json();if(!i.ok)throw Error(nj(l)||l?.detail||"Failed to register OAuth client");return l},ng=({serverId:e,clientId:t,redirectUri:r,state:n,codeChallenge:o,scope:a})=>{let i=C(),l=encodeURIComponent(e.trim()),s=`${i}/v1/mcp/server/oauth/${l}/authorize`,c=new URLSearchParams({redirect_uri:r,state:n,response_type:"code",code_challenge:o,code_challenge_method:"S256"});return t&&t.trim().length>0&&c.set("client_id",t),a&&a.trim().length>0&&c.set("scope",a),`${s}?${c.toString()}`},nv=async({serverId:e,code:t,clientId:r,clientSecret:n,codeVerifier:o,redirectUri:a})=>{let i=C(),l=encodeURIComponent(e.trim()),s=`${i}/v1/mcp/server/oauth/${l}/token`,c=new URLSearchParams;c.set("grant_type","authorization_code"),c.set("code",t),r&&r.trim().length>0&&c.set("client_id",r),n&&n.trim().length>0&&c.set("client_secret",n),c.set("code_verifier",o),c.set("redirect_uri",a);let u=await fetch(s,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:c.toString()}),d=await u.json();if(!u.ok)throw Error(nj(d)||d?.detail||"OAuth token exchange failed");return d},ny=async(e,t,r)=>{try{let n=`${C()}/v1/vector_stores/${t}/search`,o=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({query:r})});if(!o.ok){let e=await o.text();return await j(e),null}return await o.json()}catch(e){throw console.error("Error testing vector store search:",e),e}},nb=async(e,t,r,n)=>{try{let o=`${C()}/v1/search/${t}`,a=await fetch(o,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({query:r,max_results:n||5})});if(!a.ok){let e=await a.text();return await j(e),null}return await a.json()}catch(e){throw console.error("Error querying search tool:",e),e}},nw=async(e,t,r,n)=>{try{let o,a,i,l=$?`${$}/tag/dau`:"/tag/dau",s=new URLSearchParams;s.append("end_date",(o=t.getFullYear(),a=String(t.getMonth()+1).padStart(2,"0"),i=String(t.getDate()).padStart(2,"0"),`${o}-${a}-${i}`)),n&&n.length>0?n.forEach(e=>{s.append("tag_filters",e)}):r&&s.append("tag_filter",r);let c=s.toString();c&&(l+=`?${c}`);let u=await fetch(l,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!u.ok){let e=await u.json(),t=nj(e);throw j(t),Error(t)}return await u.json()}catch(e){throw console.error("Failed to fetch DAU:",e),e}},n$=async(e,t,r,n)=>{try{let o,a,i,l=$?`${$}/tag/wau`:"/tag/wau",s=new URLSearchParams;s.append("end_date",(o=t.getFullYear(),a=String(t.getMonth()+1).padStart(2,"0"),i=String(t.getDate()).padStart(2,"0"),`${o}-${a}-${i}`)),n&&n.length>0?n.forEach(e=>{s.append("tag_filters",e)}):r&&s.append("tag_filter",r);let c=s.toString();c&&(l+=`?${c}`);let u=await fetch(l,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!u.ok){let e=await u.json(),t=nj(e);throw j(t),Error(t)}return await u.json()}catch(e){throw console.error("Failed to fetch WAU:",e),e}},nC=async(e,t,r,n)=>{try{let o,a,i,l=$?`${$}/tag/mau`:"/tag/mau",s=new URLSearchParams;s.append("end_date",(o=t.getFullYear(),a=String(t.getMonth()+1).padStart(2,"0"),i=String(t.getDate()).padStart(2,"0"),`${o}-${a}-${i}`)),n&&n.length>0?n.forEach(e=>{s.append("tag_filters",e)}):r&&s.append("tag_filter",r);let c=s.toString();c&&(l+=`?${c}`);let u=await fetch(l,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!u.ok){let e=await u.json(),t=nj(e);throw j(t),Error(t)}return await u.json()}catch(e){throw console.error("Failed to fetch MAU:",e),e}},nE=async e=>{try{let t=$?`${$}/tag/distinct`:"/tag/distinct",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nj(e);throw j(t),Error(t)}return await r.json()}catch(e){throw console.error("Failed to fetch distinct tags:",e),e}},nS=async(e,t,r,n)=>{try{let o=$?`${$}/tag/summary`:"/tag/summary",a=new URLSearchParams,i=e=>{let t=e.getFullYear(),r=String(e.getMonth()+1).padStart(2,"0"),n=String(e.getDate()).padStart(2,"0");return`${t}-${r}-${n}`};a.append("start_date",i(t)),a.append("end_date",i(r)),n&&n.length>0&&n.forEach(e=>{a.append("tag_filters",e)});let l=a.toString();l&&(o+=`?${l}`);let s=await fetch(o,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!s.ok){let e=await s.json(),t=nj(e);throw j(t),Error(t)}return await s.json()}catch(e){throw console.error("Failed to fetch user agent summary:",e),e}},nx=async(e,t=1,r=50,n)=>{try{let o=$?`${$}/tag/user-agent/per-user-analytics`:"/tag/user-agent/per-user-analytics",a=new URLSearchParams;a.append("page",t.toString()),a.append("page_size",r.toString()),n&&n.length>0&&n.forEach(e=>{a.append("tag_filters",e)});let i=a.toString();i&&(o+=`?${i}`);let l=await fetch(o,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!l.ok){let e=await l.json(),t=nj(e);throw j(t),Error(t)}return await l.json()}catch(e){throw console.error("Failed to fetch per-user analytics:",e),e}},nj=e=>{let t=e?.detail,r=Array.isArray(t)?t.map(e=>e?.msg||JSON.stringify(e)).join("; "):"string"==typeof t?t:void 0;return e?.error&&(e.error.message||("string"==typeof e.error?e.error:void 0))||e?.message||r||JSON.stringify(e)},nO=async(e,t)=>{let r=C(),n=r?`${r}/v2/login`:"/v2/login",o=JSON.stringify({username:e,password:t}),a=await fetch(n,{method:"POST",body:o,credentials:"include",headers:{"Content-Type":"application/json"}});if(!a.ok)throw Error(nj(await a.json()));return await a.json()},nk=async()=>{let e=C(),t=e?`${e}/get/ui_settings`:"/get/ui_settings",r=await fetch(t,{method:"GET"});if(!r.ok)throw Error(nj(await r.json()));return await r.json()},nT=async(e,t)=>{let r=C(),n=r?`${r}/update/ui_settings`:"/update/ui_settings",o=await fetch(n,{method:"PATCH",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!o.ok)throw Error(nj(await o.json()));return await o.json()},nF=async()=>{try{let e=C(),t=e?`${e}/claude-code/marketplace.json`:"/claude-code/marketplace.json",r=await fetch(t,{method:"GET",headers:{"Content-Type":"application/json"}});if(!r.ok){let e=await r.text(),t=nj(JSON.parse(e));throw j(t),Error(t)}return await r.json()}catch(e){throw console.error("Failed to fetch Claude Code marketplace:",e),e}},n_=async(e,t=!1)=>{try{let r=C(),n=r?`${r}/claude-code/plugins?enabled_only=${t}`:`/claude-code/plugins?enabled_only=${t}`,o=await fetch(n,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!o.ok){let e=await o.text(),t=nj(JSON.parse(e));throw j(t),Error(t)}return await o.json()}catch(e){throw console.error("Failed to fetch Claude Code plugins list:",e),e}},nI=async(e,t)=>{try{let r=C(),n=r?`${r}/claude-code/plugins/${t}`:`/claude-code/plugins/${t}`,o=await fetch(n,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!o.ok){let e=await o.text(),t=nj(JSON.parse(e));throw j(t),Error(t)}return await o.json()}catch(e){throw console.error(`Failed to fetch plugin "${t}":`,e),e}},nP=async(e,t)=>{try{let r=C(),n=r?`${r}/claude-code/plugins`:"/claude-code/plugins",o=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!o.ok){let e=await o.text(),t=nj(JSON.parse(e));throw j(t),Error(t)}return await o.json()}catch(e){throw console.error("Failed to register Claude Code plugin:",e),e}},nN=async(e,t)=>{try{let r=C(),n=r?`${r}/claude-code/plugins/${t}/enable`:`/claude-code/plugins/${t}/enable`,o=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!o.ok){let e=await o.text(),t=nj(JSON.parse(e));throw j(t),Error(t)}return await o.json()}catch(e){throw console.error(`Failed to enable plugin "${t}":`,e),e}},nR=async(e,t)=>{try{let r=C(),n=r?`${r}/claude-code/plugins/${t}/disable`:`/claude-code/plugins/${t}/disable`,o=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!o.ok){let e=await o.text(),t=nj(JSON.parse(e));throw j(t),Error(t)}return await o.json()}catch(e){throw console.error(`Failed to disable plugin "${t}":`,e),e}},nM=async(e,t)=>{try{let r=C(),n=r?`${r}/claude-code/plugins/${t}`:`/claude-code/plugins/${t}`,o=await fetch(n,{method:"DELETE",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!o.ok){let e=await o.text(),t=nj(JSON.parse(e));throw j(t),Error(t)}return await o.json()}catch(e){throw console.error(`Failed to delete plugin "${t}":`,e),e}},nB=async(e,t)=>{let r=$?`${$}/compliance/eu-ai-act`:"/compliance/eu-ai-act",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok)throw Error(await n.text());return n.json()},nA=async(e,t)=>{let r=$?`${$}/compliance/gdpr`:"/compliance/gdpr",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok)throw Error(await n.text());return n.json()},nz=async e=>{let t=$?`${$}/v1/tool/policy/options`:"/v1/tool/policy/options",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok)throw Error(await r.text());return r.json()},nL=async e=>{let t=$?`${$}/v1/tool/list`:"/v1/tool/list",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok)throw Error(await r.text());return(await r.json()).tools??[]},nH=async(e,t,r)=>{let n=encodeURIComponent(t),o=$?`${$}/v1/tool/${n}/logs`:`/v1/tool/${n}/logs`,a=new URLSearchParams;null!=r.page&&a.append("page",String(r.page)),null!=r.pageSize&&a.append("page_size",String(r.pageSize)),r.startDate&&a.append("start_date",r.startDate),r.endDate&&a.append("end_date",r.endDate);let i=a.toString()?`${o}?${a.toString()}`:o,l=await fetch(i,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!l.ok)throw Error(nj(await l.json().catch(()=>({}))));return l.json()},nD=async(e,t)=>{let r=encodeURIComponent(t),n=$?`${$}/v1/tool/${r}/detail`:`/v1/tool/${r}/detail`,o=await fetch(n,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!o.ok)throw Error(await o.text());return o.json()},nV=async(e,t,r,n)=>{let o=$?`${$}/v1/tool/policy`:"/v1/tool/policy",a={tool_name:t};null!=r.input_policy&&(a.input_policy=r.input_policy),null!=r.output_policy&&(a.output_policy=r.output_policy),n?.team_id!=null&&(a.team_id=n.team_id||void 0),n?.key_hash!=null&&(a.key_hash=n.key_hash||void 0),n?.key_alias!=null&&(a.key_alias=n.key_alias||void 0);let i=await fetch(o,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(a)});if(!i.ok)throw Error(await i.text());return i.json()},nW=async(e,t,r)=>{let n=encodeURIComponent(t),o=new URLSearchParams;null!=r.team_id&&""!==r.team_id&&o.set("team_id",r.team_id),null!=r.key_hash&&""!==r.key_hash&&o.set("key_hash",r.key_hash);let a=o.toString(),i=$?`${$}/v1/tool/${n}/overrides${a?`?${a}`:""}`:`/v1/tool/${n}/overrides${a?`?${a}`:""}`,l=await fetch(i,{method:"DELETE",headers:{[T]:`Bearer ${e}`}});if(!l.ok)throw Error(await l.text());return l.json()},nG=async(e,t,r)=>{let n=$?`${$}/v1/mcp/server/${t}/oauth-user-credential`:`/v1/mcp/server/${t}/oauth-user-credential`,o=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(r)});if(!o.ok){let e=await o.json().catch(()=>({})),t=e?.detail;throw Error((Array.isArray(t)?t.map(e=>e&&"object"==typeof e?e.msg??JSON.stringify(e):String(e)).join("; "):"string"==typeof t?t:t&&"string"==typeof t.error?t.error:void 0)||"Failed to store OAuth credential")}return o.json()},nU=async(e,t)=>{let r=$?`${$}/v1/mcp/server/${t}/oauth-user-credential`:`/v1/mcp/server/${t}/oauth-user-credential`,n=await fetch(r,{method:"DELETE",headers:{[T]:`Bearer ${e}`}});if(!n.ok){let e=await n.json().catch(()=>({})),t=e?.detail;throw Error((Array.isArray(t)?t.map(e=>e&&"object"==typeof e?e.msg??JSON.stringify(e):String(e)).join("; "):"string"==typeof t?t:t&&"string"==typeof t.error?t.error:void 0)||"Failed to revoke OAuth credential")}return n.json()},nq=async(e,t)=>{let r=$?`${$}/v1/mcp/server/${t}/oauth-user-credential/status`:`/v1/mcp/server/${t}/oauth-user-credential/status`,n=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`}});return n.ok?n.json():{server_id:t,has_credential:!1,is_expired:!1}},nJ=async e=>{let t=$?`${$}/v1/mcp/user-credentials`:"/v1/mcp/user-credentials",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`}});return r.ok?r.json():[]}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/123bb7375879d789.js b/litellm/proxy/_experimental/out/_next/static/chunks/123bb7375879d789.js new file mode 100644 index 0000000000..b23ef2ae7e --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/123bb7375879d789.js @@ -0,0 +1,3 @@ +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,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)},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)},95684,e=>{"use strict";var t=e.i(165370);e.s(["Pagination",()=>t.default])},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)},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)})])},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"}]])},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)},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])},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,m=e?.input_cost!==void 0||e?.output_cost!==void 0,x=e?.additional_costs&&Object.entries(e.additional_costs).some(([,e])=>null!=e&&0!==e);if(!(m||c||x||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 u=e&&(void 0!==e.discount_percent&&0!==e.discount_percent||void 0!==e.discount_amount&&0!==e.discount_amount),p=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),h=d?0:e?.input_cost,g=d?0:e?.output_cost,f=d?0:e?.original_cost,y=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(h),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(g),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.entries(e.additional_costs).filter(([,e])=>null!=e&&0!==e).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(f)})]})}),(u||p)&&(0,t.jsxs)("div",{className:"pt-2 space-y-2 max-w-2xl",children:[u&&(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)]})]})]}),p&&(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(y),d&&" (Cached)"]})]})})]})}]})})}])},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)},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)},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)},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)},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/92260915afd3dac5.js b/litellm/proxy/_experimental/out/_next/static/chunks/179425128d293da9.js similarity index 93% rename from litellm/proxy/_experimental/out/_next/static/chunks/92260915afd3dac5.js rename to litellm/proxy/_experimental/out/_next/static/chunks/179425128d293da9.js index a4ac20198b..2d9ba69123 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/92260915afd3dac5.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/179425128d293da9.js @@ -4,4 +4,4 @@ `]:{[`&:hover ${t}-inner`]:{borderColor:e.colorPrimary}},[`${l}:not(${l}-disabled)`]:{[`&:hover ${t}-checked:not(${t}-disabled) ${t}-inner`]:{backgroundColor:e.colorPrimaryHover,borderColor:"transparent"},[`&:hover ${t}-checked:not(${t}-disabled):after`]:{borderColor:e.colorPrimaryHover}}},{[`${t}-checked`]:{[`${t}-inner`]:{backgroundColor:e.colorPrimary,borderColor:e.colorPrimary,"&:after":{opacity:1,transform:"rotate(45deg) scale(1) translate(-50%,-50%)",transition:`all ${e.motionDurationMid} ${e.motionEaseOutBack} ${e.motionDurationFast}`}}},[` ${l}-checked:not(${l}-disabled), ${t}-checked:not(${t}-disabled) - `]:{[`&:hover ${t}-inner`]:{backgroundColor:e.colorPrimaryHover,borderColor:"transparent"}}},{[t]:{"&-indeterminate":{"&":{[`${t}-inner`]:{backgroundColor:`${e.colorBgContainer}`,borderColor:`${e.colorBorder}`,"&:after":{top:"50%",insetInlineStart:"50%",width:e.calc(e.fontSizeLG).div(2).equal(),height:e.calc(e.fontSizeLG).div(2).equal(),backgroundColor:e.colorPrimary,border:0,transform:"translate(-50%, -50%) scale(1)",opacity:1,content:'""'}},[`&:hover ${t}-inner`]:{backgroundColor:`${e.colorBgContainer}`,borderColor:`${e.colorPrimary}`}}}}},{[`${l}-disabled`]:{cursor:"not-allowed"},[`${t}-disabled`]:{[`&, ${t}-input`]:{cursor:"not-allowed",pointerEvents:"none"},[`${t}-inner`]:{background:e.colorBgContainerDisabled,borderColor:e.colorBorder,"&:after":{borderColor:e.colorTextDisabled}},"&:after":{display:"none"},"& + span":{color:e.colorTextDisabled},[`&${t}-indeterminate ${t}-inner::after`]:{background:e.colorTextDisabled}}}]})((0,o.mergeToken)(t,{checkboxCls:`.${e}`,checkboxSize:t.controlInteractiveSize}))}let s=(0,l.genStyleHooks)("Checkbox",(e,{prefixCls:t})=>[n(t,e)]);e.s(["default",0,s,"getStyle",()=>n],236836)},374276,e=>{"use strict";e.i(247167);var t=e.i(271645),r=e.i(343794),a=e.i(91874),l=e.i(611935),o=e.i(121872),n=e.i(26905),s=e.i(242064),i=e.i(937328),c=e.i(321883),d=e.i(62139),u=e.i(421512),m=e.i(236836),g=e.i(681216),p=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 l=0,a=Object.getOwnPropertySymbols(e);lt.indexOf(a[l])&&Object.prototype.propertyIsEnumerable.call(e,a[l])&&(r[a[l]]=e[a[l]]);return r};let f=t.forwardRef((e,f)=>{var h;let{prefixCls:x,className:b,rootClassName:y,children:v,indeterminate:w=!1,style:k,onMouseEnter:C,onMouseLeave:j,skipGroup:N=!1,disabled:S}=e,$=p(e,["prefixCls","className","rootClassName","children","indeterminate","style","onMouseEnter","onMouseLeave","skipGroup","disabled"]),{getPrefixCls:M,direction:E,checkbox:O}=t.useContext(s.ConfigContext),T=t.useContext(u.default),{isFormItemInput:P}=t.useContext(d.FormItemInputContext),_=t.useContext(i.default),z=null!=(h=(null==T?void 0:T.disabled)||S)?h:_,R=t.useRef($.value),I=t.useRef(null),L=(0,l.composeRef)(f,I);t.useEffect(()=>{null==T||T.registerValue($.value)},[]),t.useEffect(()=>{if(!N)return $.value!==R.current&&(null==T||T.cancelValue(R.current),null==T||T.registerValue($.value),R.current=$.value),()=>null==T?void 0:T.cancelValue($.value)},[$.value]),t.useEffect(()=>{var e;(null==(e=I.current)?void 0:e.input)&&(I.current.input.indeterminate=w)},[w]);let D=M("checkbox",x),B=(0,c.default)(D),[F,A,q]=(0,m.default)(D,B),H=Object.assign({},$);T&&!N&&(H.onChange=(...e)=>{$.onChange&&$.onChange.apply($,e),T.toggleOption&&T.toggleOption({label:v,value:$.value})},H.name=T.name,H.checked=T.value.includes($.value));let G=(0,r.default)(`${D}-wrapper`,{[`${D}-rtl`]:"rtl"===E,[`${D}-wrapper-checked`]:H.checked,[`${D}-wrapper-disabled`]:z,[`${D}-wrapper-in-form-item`]:P},null==O?void 0:O.className,b,y,q,B,A),X=(0,r.default)({[`${D}-indeterminate`]:w},n.TARGET_CLS,A),[V,K]=(0,g.default)(H.onClick);return F(t.createElement(o.default,{component:"Checkbox",disabled:z},t.createElement("label",{className:G,style:Object.assign(Object.assign({},null==O?void 0:O.style),k),onMouseEnter:C,onMouseLeave:j,onClick:V},t.createElement(a.default,Object.assign({},H,{onClick:K,prefixCls:D,className:X,disabled:z,ref:L})),null!=v&&t.createElement("span",{className:`${D}-label`},v))))});var h=e.i(8211),x=e.i(529681),b=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 l=0,a=Object.getOwnPropertySymbols(e);lt.indexOf(a[l])&&Object.prototype.propertyIsEnumerable.call(e,a[l])&&(r[a[l]]=e[a[l]]);return r};let y=t.forwardRef((e,a)=>{let{defaultValue:l,children:o,options:n=[],prefixCls:i,className:d,rootClassName:g,style:p,onChange:y}=e,v=b(e,["defaultValue","children","options","prefixCls","className","rootClassName","style","onChange"]),{getPrefixCls:w,direction:k}=t.useContext(s.ConfigContext),[C,j]=t.useState(v.value||l||[]),[N,S]=t.useState([]);t.useEffect(()=>{"value"in v&&j(v.value||[])},[v.value]);let $=t.useMemo(()=>n.map(e=>"string"==typeof e||"number"==typeof e?{label:e,value:e}:e),[n]),M=e=>{S(t=>t.filter(t=>t!==e))},E=e=>{S(t=>[].concat((0,h.default)(t),[e]))},O=e=>{let t=C.indexOf(e.value),r=(0,h.default)(C);-1===t?r.push(e.value):r.splice(t,1),"value"in v||j(r),null==y||y(r.filter(e=>N.includes(e)).sort((e,t)=>$.findIndex(t=>t.value===e)-$.findIndex(e=>e.value===t)))},T=w("checkbox",i),P=`${T}-group`,_=(0,c.default)(T),[z,R,I]=(0,m.default)(T,_),L=(0,x.default)(v,["value","disabled"]),D=n.length?$.map(e=>t.createElement(f,{prefixCls:T,key:e.value.toString(),disabled:"disabled"in e?e.disabled:v.disabled,value:e.value,checked:C.includes(e.value),onChange:e.onChange,className:(0,r.default)(`${P}-item`,e.className),style:e.style,title:e.title,id:e.id,required:e.required},e.label)):o,B=t.useMemo(()=>({toggleOption:O,value:C,disabled:v.disabled,name:v.name,registerValue:E,cancelValue:M}),[O,C,v.disabled,v.name,E,M]),F=(0,r.default)(P,{[`${P}-rtl`]:"rtl"===k},d,g,I,_,R);return z(t.createElement("div",Object.assign({className:F,style:p},L,{ref:a}),t.createElement(u.default.Provider,{value:B},D)))});f.Group=y,f.__ANT_CHECKBOX=!0,e.s(["default",0,f],374276)},536916,e=>{"use strict";var t=e.i(374276);e.s(["Checkbox",()=>t.default])},292639,e=>{"use strict";var t=e.i(764205),r=e.i(266027);let a=(0,e.i(243652).createQueryKeys)("uiSettings");e.s(["useUISettings",0,()=>(0,r.useQuery)({queryKey:a.list({}),queryFn:async()=>await (0,t.getUiSettings)(),staleTime:36e5,gcTime:36e5})])},250980,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3m0 0v3m0-3h3m-3 0H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z"}))});e.s(["PlusCircleIcon",0,r],250980)},502547,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"}))});e.s(["ChevronRightIcon",0,r],502547)},988297,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4v16m8-8H4"}))});e.s(["PlusIcon",0,r],988297)},797672,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"}))});e.s(["PencilIcon",0,r],797672)},992619,e=>{"use strict";var t=e.i(843476),r=e.i(271645),a=e.i(779241),l=e.i(599724),o=e.i(199133),n=e.i(983561),s=e.i(689020);e.s(["default",0,({accessToken:e,value:i,placeholder:c="Select a Model",onChange:d,disabled:u=!1,style:m,className:g,showLabel:p=!0,labelText:f="Select Model"})=>{let[h,x]=(0,r.useState)(i),[b,y]=(0,r.useState)(!1),[v,w]=(0,r.useState)([]),k=(0,r.useRef)(null);return(0,r.useEffect)(()=>{x(i)},[i]),(0,r.useEffect)(()=>{e&&(async()=>{try{let t=await (0,s.fetchAvailableModels)(e);console.log("Fetched models for selector:",t),t.length>0&&w(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)(n.RobotOutlined,{className:"mr-2"})," ",f]}),(0,t.jsx)(o.Select,{value:h,placeholder:c,onChange:e=>{"custom"===e?(y(!0),x(void 0)):(y(!1),x(e),d&&d(e))},options:[...Array.from(new Set(v.map(e=>e.model_group))).map((e,t)=>({value:e,label:e,key:t})),{value:"custom",label:"Enter custom model",key:"custom"}],style:{width:"100%",...m},showSearch:!0,className:`rounded-md ${g||""}`,disabled:u}),b&&(0,t.jsx)(a.TextInput,{className:"mt-2",placeholder:"Enter custom model name",onValueChange:e=>{k.current&&clearTimeout(k.current),k.current=setTimeout(()=>{x(e),d&&d(e)},500)},disabled:u})]})}])},91739,e=>{"use strict";var t=e.i(544195);e.s(["Radio",()=>t.default])},409797,e=>{"use strict";var t=e.i(631171);e.s(["ChevronDownIcon",()=>t.default])},500727,696609,531516,e=>{"use strict";var t=e.i(266027),r=e.i(243652),a=e.i(764205),l=e.i(135214);let o=(0,r.createQueryKeys)("mcpServers");e.s(["useMCPServers",0,e=>{let{accessToken:r}=(0,l.default)();return(0,t.useQuery)({queryKey:o.list(e?{filters:{teamId:e}}:void 0),queryFn:async()=>await (0,a.fetchMCPServers)(r,e),enabled:!!r})}],500727);var n=e.i(843476),s=e.i(271645),i=e.i(536916),c=e.i(599724),d=e.i(409797),u=e.i(246349),u=u;let m=/\b(delete|remove|destroy|purge|drop|erase|unlink)\b/i,g=/\b(create|add|insert|new|post|submit|register|make|generate|write|upload)\b/i,p=/\b(update|edit|modify|change|patch|put|set|rename|move|transform)\b/i,f=/\b(get|read|list|fetch|search|find|query|retrieve|show|view|check|describe|info)\b/i;function h(e,t=""){let r=e.toLowerCase();if(f.test(r))return"read";if(m.test(r))return"delete";if(p.test(r))return"update";if(g.test(r))return"create";if(t){let e=t.toLowerCase();if(f.test(e))return"read";if(m.test(e))return"delete";if(p.test(e))return"update";if(g.test(e))return"create"}return"unknown"}function x(e){let t={read:[],create:[],update:[],delete:[],unknown:[]};for(let r of e)t[h(r.name,r.description)].push(r);return t}let b={read:{label:"Read",description:"Safe operations — fetch, list, search. No side effects.",risk:"low"},create:{label:"Create",description:"Add new resources — insert, upload, register.",risk:"medium"},update:{label:"Update",description:"Modify existing resources — edit, patch, rename.",risk:"medium"},delete:{label:"Delete",description:"Destructive operations — remove, purge, destroy.",risk:"high"},unknown:{label:"Other",description:"Operations that could not be automatically classified.",risk:"unknown"}};e.s(["CRUD_GROUP_META",0,b,"classifyToolOp",()=>h,"groupToolsByCrud",()=>x],696609);let y=["read","create","update","delete","unknown"],v={low:"bg-green-100 text-green-800",medium:"bg-yellow-100 text-yellow-800",high:"bg-red-100 text-red-800 font-semibold",unknown:"bg-gray-100 text-gray-700"},w={read:"border-green-200",create:"border-blue-200",update:"border-yellow-200",delete:"border-red-300",unknown:"border-gray-200"},k={read:"bg-green-50",create:"bg-blue-50",update:"bg-yellow-50",delete:"bg-red-50",unknown:"bg-gray-50"};e.s(["default",0,({tools:e,value:t,onChange:r,readOnly:a=!1,searchFilter:l=""})=>{let[o,m]=(0,s.useState)({read:!1,create:!1,update:!1,delete:!1,unknown:!0}),g=(0,s.useMemo)(()=>x(e),[e]),p=(0,s.useMemo)(()=>new Set(void 0===t?e.map(e=>e.name):t),[t,e]),f=e=>{if(a)return;let t=new Set(p);t.has(e)?t.delete(e):t.add(e),r(Array.from(t))};return 0===e.length?null:(0,n.jsx)("div",{className:"space-y-3",children:y.map(e=>{let t,s=g[e];if(0===s.length)return null;if(l){let e=l.toLowerCase();if(!s.some(t=>t.name.toLowerCase().includes(e)||(t.description??"").toLowerCase().includes(e)))return null}let h=b[e],x=(t=g[e]).length>0&&t.every(e=>p.has(e.name)),y=(e=>{let t=g[e];if(0===t.length)return!1;let r=t.filter(e=>p.has(e.name)).length;return r>0&&r{m(t=>({...t,[e]:!t[e]}))},children:[C?(0,n.jsx)(u.default,{className:"w-4 h-4 text-gray-500 flex-shrink-0"}):(0,n.jsx)(d.ChevronDownIcon,{className:"w-4 h-4 text-gray-500 flex-shrink-0"}),(0,n.jsx)("span",{className:"font-semibold text-gray-900 text-sm",children:h.label}),(0,n.jsx)("span",{className:`text-xs px-2 py-0.5 rounded-full ${v[h.risk]}`,children:"high"===h.risk?"High Risk":"medium"===h.risk?"Medium Risk":"low"===h.risk?"Safe":"Unclassified"}),(0,n.jsxs)("span",{className:"text-xs text-gray-500 ml-1",children:[s.filter(e=>p.has(e.name)).length,"/",s.length," allowed"]})]}),!a&&(0,n.jsxs)("div",{className:"flex items-center gap-2 ml-4",children:[(0,n.jsx)(c.Text,{className:"text-xs text-gray-500",children:x?"All on":y?"Partial":"All off"}),(0,n.jsx)(i.Checkbox,{checked:x,indeterminate:y,onChange:t=>((e,t)=>{if(a)return;let l=new Set(p);for(let r of g[e])t?l.add(r.name):l.delete(r.name);r(Array.from(l))})(e,t.target.checked),onClick:e=>e.stopPropagation()})]})]}),!C&&(0,n.jsx)("div",{className:"px-4 pt-2 pb-1 text-xs text-gray-500 bg-white border-b border-gray-100",children:h.description}),!C&&(0,n.jsx)("div",{className:"bg-white divide-y divide-gray-50",children:s.filter(e=>!l||e.name.toLowerCase().includes(l.toLowerCase())||(e.description??"").toLowerCase().includes(l.toLowerCase())).map(e=>{let t,r=(t=e.name,p.has(t));return(0,n.jsxs)("div",{className:`flex items-start gap-3 px-4 py-2.5 transition-colors hover:bg-gray-50 ${!a?"cursor-pointer":""} ${r?"":"opacity-60"}`,onClick:()=>f(e.name),children:[(0,n.jsx)(i.Checkbox,{checked:r,onChange:()=>f(e.name),disabled:a,onClick:e=>e.stopPropagation()}),(0,n.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,n.jsx)(c.Text,{className:"font-medium text-gray-900 text-sm",children:e.name}),e.description&&(0,n.jsx)(c.Text,{className:"text-xs text-gray-500 mt-0.5 leading-snug",children:e.description})]}),(0,n.jsx)("span",{className:`text-xs px-1.5 py-0.5 rounded flex-shrink-0 ${r?"bg-green-100 text-green-700":"bg-gray-100 text-gray-500"}`,children:r?"on":"off"})]},e.name)})})]},e)})})}],531516)},361653,e=>{"use strict";let t=(0,e.i(475254).default)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);e.s(["default",()=>t])},841947,e=>{"use strict";let t=(0,e.i(475254).default)("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);e.s(["default",()=>t])},603908,e=>{"use strict";let t=(0,e.i(475254).default)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);e.s(["default",()=>t])},793130,e=>{"use strict";var t=e.i(290571),r=e.i(429427),a=e.i(371330),l=e.i(271645),o=e.i(394487),n=e.i(503269),s=e.i(214520),i=e.i(746725),c=e.i(914189),d=e.i(144279),u=e.i(294316),m=e.i(601893),g=e.i(140721),p=e.i(942803),f=e.i(233538),h=e.i(694421),x=e.i(700020),b=e.i(35889),y=e.i(998348),v=e.i(722678);let w=(0,l.createContext)(null);w.displayName="GroupContext";let k=l.Fragment,C=Object.assign((0,x.forwardRefWithAs)(function(e,t){var k;let C=(0,l.useId)(),j=(0,p.useProvidedId)(),N=(0,m.useDisabled)(),{id:S=j||`headlessui-switch-${C}`,disabled:$=N||!1,checked:M,defaultChecked:E,onChange:O,name:T,value:P,form:_,autoFocus:z=!1,...R}=e,I=(0,l.useContext)(w),[L,D]=(0,l.useState)(null),B=(0,l.useRef)(null),F=(0,u.useSyncRefs)(B,t,null===I?null:I.setSwitch,D),A=(0,s.useDefaultValue)(E),[q,H]=(0,n.useControllable)(M,O,null!=A&&A),G=(0,i.useDisposables)(),[X,V]=(0,l.useState)(!1),K=(0,c.useEvent)(()=>{V(!0),null==H||H(!q),G.nextFrame(()=>{V(!1)})}),W=(0,c.useEvent)(e=>{if((0,f.isDisabledReactIssue7711)(e.currentTarget))return e.preventDefault();e.preventDefault(),K()}),U=(0,c.useEvent)(e=>{e.key===y.Keys.Space?(e.preventDefault(),K()):e.key===y.Keys.Enter&&(0,h.attemptSubmit)(e.currentTarget)}),Y=(0,c.useEvent)(e=>e.preventDefault()),Q=(0,v.useLabelledBy)(),J=(0,b.useDescribedBy)(),{isFocusVisible:Z,focusProps:ee}=(0,r.useFocusRing)({autoFocus:z}),{isHovered:et,hoverProps:er}=(0,a.useHover)({isDisabled:$}),{pressed:ea,pressProps:el}=(0,o.useActivePress)({disabled:$}),eo=(0,l.useMemo)(()=>({checked:q,disabled:$,hover:et,focus:Z,active:ea,autofocus:z,changing:X}),[q,et,Z,ea,$,X,z]),en=(0,x.mergeProps)({id:S,ref:F,role:"switch",type:(0,d.useResolveButtonType)(e,L),tabIndex:-1===e.tabIndex?0:null!=(k=e.tabIndex)?k:0,"aria-checked":q,"aria-labelledby":Q,"aria-describedby":J,disabled:$||void 0,autoFocus:z,onClick:W,onKeyUp:U,onKeyPress:Y},ee,er,el),es=(0,l.useCallback)(()=>{if(void 0!==A)return null==H?void 0:H(A)},[H,A]),ei=(0,x.useRender)();return l.default.createElement(l.default.Fragment,null,null!=T&&l.default.createElement(g.FormFields,{disabled:$,data:{[T]:P||"on"},overrides:{type:"checkbox",checked:q},form:_,onReset:es}),ei({ourProps:en,theirProps:R,slot:eo,defaultTag:"button",name:"Switch"}))}),{Group:function(e){var t;let[r,a]=(0,l.useState)(null),[o,n]=(0,v.useLabels)(),[s,i]=(0,b.useDescriptions)(),c=(0,l.useMemo)(()=>({switch:r,setSwitch:a}),[r,a]),d=(0,x.useRender)();return l.default.createElement(i,{name:"Switch.Description",value:s},l.default.createElement(n,{name:"Switch.Label",value:o,props:{htmlFor:null==(t=c.switch)?void 0:t.id,onClick(e){r&&(e.currentTarget instanceof HTMLLabelElement&&e.preventDefault(),r.click(),r.focus({preventScroll:!0}))}}},l.default.createElement(w.Provider,{value:c},d({ourProps:{},theirProps:e,slot:{},defaultTag:k,name:"Switch.Group"}))))},Label:v.Label,Description:b.Description});var j=e.i(888288),N=e.i(95779),S=e.i(444755),$=e.i(673706),M=e.i(829087);let E=(0,$.makeClassName)("Switch"),O=l.default.forwardRef((e,r)=>{let{checked:a,defaultChecked:o=!1,onChange:n,color:s,name:i,error:c,errorMessage:d,disabled:u,required:m,tooltip:g,id:p}=e,f=(0,t.__rest)(e,["checked","defaultChecked","onChange","color","name","error","errorMessage","disabled","required","tooltip","id"]),h={bgColor:s?(0,$.getColorClassNames)(s,N.colorPalette.background).bgColor:"bg-tremor-brand dark:bg-dark-tremor-brand",ringColor:s?(0,$.getColorClassNames)(s,N.colorPalette.ring).ringColor:"ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted"},[x,b]=(0,j.default)(o,a),[y,v]=(0,l.useState)(!1),{tooltipProps:w,getReferenceProps:k}=(0,M.useTooltip)(300);return l.default.createElement("div",{className:"flex flex-row items-center justify-start"},l.default.createElement(M.default,Object.assign({text:g},w)),l.default.createElement("div",Object.assign({ref:(0,$.mergeRefs)([r,w.refs.setReference]),className:(0,S.tremorTwMerge)(E("root"),"flex flex-row relative h-5")},f,k),l.default.createElement("input",{type:"checkbox",className:(0,S.tremorTwMerge)(E("input"),"absolute w-5 h-5 cursor-pointer left-0 top-0 opacity-0"),name:i,required:m,checked:x,onChange:e=>{e.preventDefault()}}),l.default.createElement(C,{checked:x,onChange:e=>{b(e),null==n||n(e)},disabled:u,className:(0,S.tremorTwMerge)(E("switch"),"w-10 h-5 group relative inline-flex shrink-0 cursor-pointer items-center justify-center rounded-tremor-full","focus:outline-none",u?"cursor-not-allowed":""),onFocus:()=>v(!0),onBlur:()=>v(!1),id:p},l.default.createElement("span",{className:(0,S.tremorTwMerge)(E("sr-only"),"sr-only")},"Switch ",x?"on":"off"),l.default.createElement("span",{"aria-hidden":"true",className:(0,S.tremorTwMerge)(E("background"),x?h.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")}),l.default.createElement("span",{"aria-hidden":"true",className:(0,S.tremorTwMerge)(E("round"),x?(0,S.tremorTwMerge)(h.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,S.tremorTwMerge)("ring-2",h.ringColor):"")}))),c&&d?l.default.createElement("p",{className:(0,S.tremorTwMerge)(E("errorMessage"),"text-sm text-red-500 mt-1 ")},d):null)});O.displayName="Switch",e.s(["Switch",()=>O],793130)},158392,419470,e=>{"use strict";var t=e.i(843476),r=e.i(779241);let a={ttl:3600,lowest_latency_buffer:0},l=({routingStrategyArgs:e})=>{let l={ttl:"Sliding window to look back over when calculating the average latency of a deployment. Default - 1 hour (in seconds).",lowest_latency_buffer:"Shuffle between deployments within this % of the lowest latency. Default - 0 (i.e. always pick lowest latency)."};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"max-w-3xl",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Latency-Based Configuration"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Fine-tune latency-based routing behavior"})]}),(0,t.jsx)("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2 xl:grid-cols-3",children:Object.entries(e||a).map(([e,a])=>(0,t.jsx)("div",{className:"space-y-2",children:(0,t.jsxs)("label",{className:"block",children:[(0,t.jsx)("span",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:e.replace(/_/g," ")}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-0.5 mb-2",children:l[e]||""}),(0,t.jsx)(r.TextInput,{name:e,defaultValue:"object"==typeof a?JSON.stringify(a,null,2):a?.toString(),className:"font-mono text-sm w-full"})]})},e))})]}),(0,t.jsx)("div",{className:"border-t border-gray-200"})]})},o=({routerSettings:e,routerFieldsMetadata:a})=>(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"max-w-3xl",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Reliability & Retries"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Configure retry logic and failure handling"})]}),(0,t.jsx)("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2 xl:grid-cols-3",children:Object.entries(e).filter(([e,t])=>"fallbacks"!=e&&"context_window_fallbacks"!=e&&"routing_strategy_args"!=e&&"routing_strategy"!=e&&"enable_tag_filtering"!=e).map(([e,l])=>(0,t.jsx)("div",{className:"space-y-2",children:(0,t.jsxs)("label",{className:"block",children:[(0,t.jsx)("span",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:a[e]?.ui_field_name||e}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-0.5 mb-2",children:a[e]?.field_description||""}),(0,t.jsx)(r.TextInput,{name:e,defaultValue:null==l||"null"===l?"":"object"==typeof l?JSON.stringify(l,null,2):l?.toString()||"",placeholder:"—",className:"font-mono text-sm w-full"})]})},e))})]});var n=e.i(199133);let s=({selectedStrategy:e,availableStrategies:r,routingStrategyDescriptions:a,routerFieldsMetadata:l,onStrategyChange:o})=>(0,t.jsxs)("div",{className:"space-y-2 max-w-3xl",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:l.routing_strategy?.ui_field_name||"Routing Strategy"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-0.5 mb-2",children:l.routing_strategy?.field_description||""})]}),(0,t.jsx)("div",{className:"routing-strategy-select max-w-3xl",children:(0,t.jsx)(n.Select,{value:e,onChange:o,style:{width:"100%"},size:"large",children:r.map(e=>(0,t.jsx)(n.Select.Option,{value:e,label:e,children:(0,t.jsxs)("div",{className:"flex flex-col gap-0.5 py-1",children:[(0,t.jsx)("span",{className:"font-mono text-sm font-medium",children:e}),a[e]&&(0,t.jsx)("span",{className:"text-xs text-gray-500 font-normal",children:a[e]})]})},e))})})]});var i=e.i(793130);let c=({enabled:e,routerFieldsMetadata:r,onToggle:a})=>(0,t.jsx)("div",{className:"space-y-3 max-w-3xl",children:(0,t.jsxs)("div",{className:"flex items-start justify-between",children:[(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)("label",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:r.enable_tag_filtering?.ui_field_name||"Enable Tag Filtering"}),(0,t.jsxs)("p",{className:"text-xs text-gray-500 mt-0.5",children:[r.enable_tag_filtering?.field_description||"",r.enable_tag_filtering?.link&&(0,t.jsxs)(t.Fragment,{children:[" ",(0,t.jsx)("a",{href:r.enable_tag_filtering.link,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-800 underline",children:"Learn more"})]})]})]}),(0,t.jsx)(i.Switch,{checked:e,onChange:a,className:"ml-4"})]})});e.s(["default",0,({value:e,onChange:r,routerFieldsMetadata:a,availableRoutingStrategies:n,routingStrategyDescriptions:i})=>(0,t.jsxs)("div",{className:"w-full space-y-8 py-2",children:[(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"max-w-3xl",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Routing Settings"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Configure how requests are routed to deployments"})]}),n.length>0&&(0,t.jsx)(s,{selectedStrategy:e.selectedStrategy||e.routerSettings.routing_strategy||null,availableStrategies:n,routingStrategyDescriptions:i,routerFieldsMetadata:a,onStrategyChange:t=>{r({...e,selectedStrategy:t})}}),(0,t.jsx)(c,{enabled:e.enableTagFiltering,routerFieldsMetadata:a,onToggle:t=>{r({...e,enableTagFiltering:t})}})]}),(0,t.jsx)("div",{className:"border-t border-gray-200"}),"latency-based-routing"===e.selectedStrategy&&(0,t.jsx)(l,{routingStrategyArgs:e.routerSettings.routing_strategy_args}),(0,t.jsx)(o,{routerSettings:e.routerSettings,routerFieldsMetadata:a})]})],158392);var d=e.i(994388),u=e.i(998573),m=e.i(653496),g=e.i(107233),p=e.i(271645),f=e.i(592968),h=e.i(361653),h=h;let x=(0,e.i(475254).default)("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);var b=e.i(37727);function y({group:e,onChange:r,availableModels:a,maxFallbacks:l}){let o=a.filter(t=>t!==e.primaryModel),s=e.fallbackModels.length{let a=[...e.fallbackModels];a.includes(t)&&(a=a.filter(e=>e!==t)),r({...e,primaryModel:t,fallbackModels:a})},showSearch:!0,filterOption:(e,t)=>(t?.label??"").toLowerCase().includes(e.toLowerCase()),options:a.map(e=>({label:e,value:e}))}),!e.primaryModel&&(0,t.jsxs)("div",{className:"mt-2 flex items-center gap-2 text-amber-600 text-xs bg-amber-50 p-2 rounded",children:[(0,t.jsx)(h.default,{className:"w-4 h-4"}),(0,t.jsx)("span",{children:"Select a model to begin configuring fallbacks"})]})]}),(0,t.jsx)("div",{className:"flex items-center justify-center -my-4 z-10",children:(0,t.jsxs)("div",{className:"bg-indigo-50 text-indigo-500 px-4 py-1 rounded-full text-xs font-bold border border-indigo-100 flex items-center gap-2 shadow-sm",children:[(0,t.jsx)(x,{className:"w-4 h-4"}),"IF FAILS, TRY..."]})}),(0,t.jsxs)("div",{className:`transition-opacity duration-300 ${!e.primaryModel?"opacity-50 pointer-events-none":"opacity-100"}`,children:[(0,t.jsxs)("label",{className:"block text-sm font-semibold text-gray-700 mb-2",children:["Fallback Chain ",(0,t.jsx)("span",{className:"text-red-500",children:"*"}),(0,t.jsxs)("span",{className:"text-xs text-gray-500 font-normal ml-2",children:["(Max ",l," fallbacks at a time)"]})]}),(0,t.jsxs)("div",{className:"bg-gray-50 rounded-xl p-4 border border-gray-200",children:[(0,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsx)(n.Select,{mode:"multiple",className:"w-full",size:"large",placeholder:s?"Select fallback models to add...":`Maximum ${l} fallbacks reached`,value:e.fallbackModels,onChange:t=>{let a=t.slice(0,l);r({...e,fallbackModels:a})},disabled:!e.primaryModel,options:o.map(e=>({label:e,value:e})),optionRender:(r,a)=>{let l=e.fallbackModels.includes(r.value),o=l?e.fallbackModels.indexOf(r.value)+1:null;return(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[l&&null!==o&&(0,t.jsx)("span",{className:"flex items-center justify-center w-5 h-5 rounded bg-indigo-100 text-indigo-600 text-xs font-bold",children:o}),(0,t.jsx)("span",{children:r.label})]})},maxTagCount:"responsive",maxTagPlaceholder:e=>(0,t.jsx)(f.Tooltip,{styles:{root:{pointerEvents:"none"}},title:e.map(({value:e})=>e).join(", "),children:(0,t.jsxs)("span",{children:["+",e.length," more"]})}),showSearch:!0,filterOption:(e,t)=>(t?.label??"").toLowerCase().includes(e.toLowerCase())}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1 ml-1",children:s?`Search and select multiple models. Selected models will appear below in order. (${e.fallbackModels.length}/${l} used)`:`Maximum ${l} fallbacks reached. Remove some to add more.`})]}),(0,t.jsx)("div",{className:"space-y-2 min-h-[100px]",children:0===e.fallbackModels.length?(0,t.jsxs)("div",{className:"h-32 border-2 border-dashed border-gray-300 rounded-lg flex flex-col items-center justify-center text-gray-400",children:[(0,t.jsx)("span",{className:"text-sm",children:"No fallback models selected"}),(0,t.jsx)("span",{className:"text-xs mt-1",children:"Add models from the dropdown above"})]}):e.fallbackModels.map((a,l)=>(0,t.jsxs)("div",{className:"group flex items-center justify-between p-3 bg-white rounded-lg border border-gray-200 hover:border-indigo-300 hover:shadow-sm transition-all",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"flex items-center justify-center w-6 h-6 rounded bg-gray-100 text-gray-400 group-hover:text-indigo-500 group-hover:bg-indigo-50",children:(0,t.jsx)("span",{className:"text-xs font-bold",children:l+1})}),(0,t.jsx)("div",{children:(0,t.jsx)("span",{className:"font-medium text-gray-800",children:a})})]}),(0,t.jsx)("button",{type:"button",onClick:()=>{let t;return t=e.fallbackModels.filter((e,t)=>t!==l),void r({...e,fallbackModels:t})},className:"opacity-0 group-hover:opacity-100 transition-opacity text-gray-400 hover:text-red-500 p-1",children:(0,t.jsx)(b.X,{className:"w-4 h-4"})})]},`${a}-${l}`))})]})]})]})}function v({groups:e,onGroupsChange:r,availableModels:a,maxFallbacks:l=10,maxGroups:o=5}){let[n,s]=(0,p.useState)(e.length>0?e[0].id:"1");(0,p.useEffect)(()=>{e.length>0?e.some(e=>e.id===n)||s(e[0].id):s("1")},[e]);let i=()=>{if(e.length>=o)return;let t=Date.now().toString();r([...e,{id:t,primaryModel:null,fallbackModels:[]}]),s(t)},c=t=>{r(e.map(e=>e.id===t.id?t:e))},f=e.map((r,o)=>{let n=r.primaryModel?r.primaryModel:`Group ${o+1}`;return{key:r.id,label:n,closable:e.length>1,children:(0,t.jsx)(y,{group:r,onChange:c,availableModels:a,maxFallbacks:l})}});return 0===e.length?(0,t.jsxs)("div",{className:"text-center py-12 bg-gray-50 rounded-lg border border-dashed border-gray-300",children:[(0,t.jsx)("p",{className:"text-gray-500 mb-4",children:"No fallback groups configured"}),(0,t.jsx)(d.Button,{variant:"primary",onClick:i,icon:()=>(0,t.jsx)(g.Plus,{className:"w-4 h-4"}),children:"Create First Group"})]}):(0,t.jsx)(m.Tabs,{type:"editable-card",activeKey:n,onChange:s,onEdit:(t,a)=>{"add"===a?i():"remove"===a&&e.length>1&&(t=>{if(1===e.length)return u.message.warning("At least one group is required");let a=e.filter(e=>e.id!==t);r(a),n===t&&a.length>0&&s(a[a.length-1].id)})(t)},items:f,className:"fallback-tabs",tabBarStyle:{marginBottom:0},hideAdd:e.length>=o})}e.s(["FallbackSelectionForm",()=>v],419470)}]); \ No newline at end of file + `]:{[`&:hover ${t}-inner`]:{backgroundColor:e.colorPrimaryHover,borderColor:"transparent"}}},{[t]:{"&-indeterminate":{"&":{[`${t}-inner`]:{backgroundColor:`${e.colorBgContainer}`,borderColor:`${e.colorBorder}`,"&:after":{top:"50%",insetInlineStart:"50%",width:e.calc(e.fontSizeLG).div(2).equal(),height:e.calc(e.fontSizeLG).div(2).equal(),backgroundColor:e.colorPrimary,border:0,transform:"translate(-50%, -50%) scale(1)",opacity:1,content:'""'}},[`&:hover ${t}-inner`]:{backgroundColor:`${e.colorBgContainer}`,borderColor:`${e.colorPrimary}`}}}}},{[`${l}-disabled`]:{cursor:"not-allowed"},[`${t}-disabled`]:{[`&, ${t}-input`]:{cursor:"not-allowed",pointerEvents:"none"},[`${t}-inner`]:{background:e.colorBgContainerDisabled,borderColor:e.colorBorder,"&:after":{borderColor:e.colorTextDisabled}},"&:after":{display:"none"},"& + span":{color:e.colorTextDisabled},[`&${t}-indeterminate ${t}-inner::after`]:{background:e.colorTextDisabled}}}]})((0,o.mergeToken)(t,{checkboxCls:`.${e}`,checkboxSize:t.controlInteractiveSize}))}let s=(0,l.genStyleHooks)("Checkbox",(e,{prefixCls:t})=>[n(t,e)]);e.s(["default",0,s,"getStyle",()=>n],236836)},374276,e=>{"use strict";e.i(247167);var t=e.i(271645),r=e.i(343794),a=e.i(91874),l=e.i(611935),o=e.i(121872),n=e.i(26905),s=e.i(242064),i=e.i(937328),c=e.i(321883),d=e.i(62139),u=e.i(421512),m=e.i(236836),g=e.i(681216),p=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 l=0,a=Object.getOwnPropertySymbols(e);lt.indexOf(a[l])&&Object.prototype.propertyIsEnumerable.call(e,a[l])&&(r[a[l]]=e[a[l]]);return r};let f=t.forwardRef((e,f)=>{var h;let{prefixCls:x,className:b,rootClassName:y,children:v,indeterminate:w=!1,style:k,onMouseEnter:C,onMouseLeave:j,skipGroup:N=!1,disabled:S}=e,$=p(e,["prefixCls","className","rootClassName","children","indeterminate","style","onMouseEnter","onMouseLeave","skipGroup","disabled"]),{getPrefixCls:M,direction:E,checkbox:O}=t.useContext(s.ConfigContext),T=t.useContext(u.default),{isFormItemInput:P}=t.useContext(d.FormItemInputContext),_=t.useContext(i.default),z=null!=(h=(null==T?void 0:T.disabled)||S)?h:_,R=t.useRef($.value),I=t.useRef(null),L=(0,l.composeRef)(f,I);t.useEffect(()=>{null==T||T.registerValue($.value)},[]),t.useEffect(()=>{if(!N)return $.value!==R.current&&(null==T||T.cancelValue(R.current),null==T||T.registerValue($.value),R.current=$.value),()=>null==T?void 0:T.cancelValue($.value)},[$.value]),t.useEffect(()=>{var e;(null==(e=I.current)?void 0:e.input)&&(I.current.input.indeterminate=w)},[w]);let D=M("checkbox",x),B=(0,c.default)(D),[F,A,q]=(0,m.default)(D,B),H=Object.assign({},$);T&&!N&&(H.onChange=(...e)=>{$.onChange&&$.onChange.apply($,e),T.toggleOption&&T.toggleOption({label:v,value:$.value})},H.name=T.name,H.checked=T.value.includes($.value));let G=(0,r.default)(`${D}-wrapper`,{[`${D}-rtl`]:"rtl"===E,[`${D}-wrapper-checked`]:H.checked,[`${D}-wrapper-disabled`]:z,[`${D}-wrapper-in-form-item`]:P},null==O?void 0:O.className,b,y,q,B,A),X=(0,r.default)({[`${D}-indeterminate`]:w},n.TARGET_CLS,A),[V,K]=(0,g.default)(H.onClick);return F(t.createElement(o.default,{component:"Checkbox",disabled:z},t.createElement("label",{className:G,style:Object.assign(Object.assign({},null==O?void 0:O.style),k),onMouseEnter:C,onMouseLeave:j,onClick:V},t.createElement(a.default,Object.assign({},H,{onClick:K,prefixCls:D,className:X,disabled:z,ref:L})),null!=v&&t.createElement("span",{className:`${D}-label`},v))))});var h=e.i(8211),x=e.i(529681),b=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 l=0,a=Object.getOwnPropertySymbols(e);lt.indexOf(a[l])&&Object.prototype.propertyIsEnumerable.call(e,a[l])&&(r[a[l]]=e[a[l]]);return r};let y=t.forwardRef((e,a)=>{let{defaultValue:l,children:o,options:n=[],prefixCls:i,className:d,rootClassName:g,style:p,onChange:y}=e,v=b(e,["defaultValue","children","options","prefixCls","className","rootClassName","style","onChange"]),{getPrefixCls:w,direction:k}=t.useContext(s.ConfigContext),[C,j]=t.useState(v.value||l||[]),[N,S]=t.useState([]);t.useEffect(()=>{"value"in v&&j(v.value||[])},[v.value]);let $=t.useMemo(()=>n.map(e=>"string"==typeof e||"number"==typeof e?{label:e,value:e}:e),[n]),M=e=>{S(t=>t.filter(t=>t!==e))},E=e=>{S(t=>[].concat((0,h.default)(t),[e]))},O=e=>{let t=C.indexOf(e.value),r=(0,h.default)(C);-1===t?r.push(e.value):r.splice(t,1),"value"in v||j(r),null==y||y(r.filter(e=>N.includes(e)).sort((e,t)=>$.findIndex(t=>t.value===e)-$.findIndex(e=>e.value===t)))},T=w("checkbox",i),P=`${T}-group`,_=(0,c.default)(T),[z,R,I]=(0,m.default)(T,_),L=(0,x.default)(v,["value","disabled"]),D=n.length?$.map(e=>t.createElement(f,{prefixCls:T,key:e.value.toString(),disabled:"disabled"in e?e.disabled:v.disabled,value:e.value,checked:C.includes(e.value),onChange:e.onChange,className:(0,r.default)(`${P}-item`,e.className),style:e.style,title:e.title,id:e.id,required:e.required},e.label)):o,B=t.useMemo(()=>({toggleOption:O,value:C,disabled:v.disabled,name:v.name,registerValue:E,cancelValue:M}),[O,C,v.disabled,v.name,E,M]),F=(0,r.default)(P,{[`${P}-rtl`]:"rtl"===k},d,g,I,_,R);return z(t.createElement("div",Object.assign({className:F,style:p},L,{ref:a}),t.createElement(u.default.Provider,{value:B},D)))});f.Group=y,f.__ANT_CHECKBOX=!0,e.s(["default",0,f],374276)},536916,e=>{"use strict";var t=e.i(374276);e.s(["Checkbox",()=>t.default])},292639,e=>{"use strict";var t=e.i(764205),r=e.i(266027);let a=(0,e.i(243652).createQueryKeys)("uiSettings");e.s(["useUISettings",0,()=>(0,r.useQuery)({queryKey:a.list({}),queryFn:async()=>await (0,t.getUiSettings)(),staleTime:36e5,gcTime:36e5})])},250980,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3m0 0v3m0-3h3m-3 0H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z"}))});e.s(["PlusCircleIcon",0,r],250980)},502547,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"}))});e.s(["ChevronRightIcon",0,r],502547)},988297,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4v16m8-8H4"}))});e.s(["PlusIcon",0,r],988297)},797672,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"}))});e.s(["PencilIcon",0,r],797672)},992619,e=>{"use strict";var t=e.i(843476),r=e.i(271645),a=e.i(779241),l=e.i(599724),o=e.i(199133),n=e.i(983561),s=e.i(689020);e.s(["default",0,({accessToken:e,value:i,placeholder:c="Select a Model",onChange:d,disabled:u=!1,style:m,className:g,showLabel:p=!0,labelText:f="Select Model"})=>{let[h,x]=(0,r.useState)(i),[b,y]=(0,r.useState)(!1),[v,w]=(0,r.useState)([]),k=(0,r.useRef)(null);return(0,r.useEffect)(()=>{x(i)},[i]),(0,r.useEffect)(()=>{e&&(async()=>{try{let t=await (0,s.fetchAvailableModels)(e);console.log("Fetched models for selector:",t),t.length>0&&w(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)(n.RobotOutlined,{className:"mr-2"})," ",f]}),(0,t.jsx)(o.Select,{value:h,placeholder:c,onChange:e=>{"custom"===e?(y(!0),x(void 0)):(y(!1),x(e),d&&d(e))},options:[...Array.from(new Set(v.map(e=>e.model_group))).map((e,t)=>({value:e,label:e,key:t})),{value:"custom",label:"Enter custom model",key:"custom"}],style:{width:"100%",...m},showSearch:!0,className:`rounded-md ${g||""}`,disabled:u}),b&&(0,t.jsx)(a.TextInput,{className:"mt-2",placeholder:"Enter custom model name",onValueChange:e=>{k.current&&clearTimeout(k.current),k.current=setTimeout(()=>{x(e),d&&d(e)},500)},disabled:u})]})}])},91739,e=>{"use strict";var t=e.i(544195);e.s(["Radio",()=>t.default])},409797,e=>{"use strict";var t=e.i(631171);e.s(["ChevronDownIcon",()=>t.default])},500727,696609,531516,e=>{"use strict";var t=e.i(266027),r=e.i(243652),a=e.i(764205),l=e.i(135214);let o=(0,r.createQueryKeys)("mcpServers");e.s(["useMCPServers",0,e=>{let{accessToken:r}=(0,l.default)();return(0,t.useQuery)({queryKey:o.list(e?{filters:{teamId:e}}:void 0),queryFn:async()=>await (0,a.fetchMCPServers)(r,e),enabled:!!r})}],500727);var n=e.i(843476),s=e.i(271645),i=e.i(536916),c=e.i(599724),d=e.i(409797),u=e.i(246349),u=u;let m=/\b(delete|remove|destroy|purge|drop|erase|unlink)\b/i,g=/\b(create|add|insert|new|post|submit|register|make|generate|write|upload)\b/i,p=/\b(update|edit|modify|change|patch|put|set|rename|move|transform)\b/i,f=/\b(get|read|list|fetch|search|find|query|retrieve|show|view|check|describe|info)\b/i;function h(e,t=""){let r=e.toLowerCase();if(f.test(r))return"read";if(m.test(r))return"delete";if(p.test(r))return"update";if(g.test(r))return"create";if(t){let e=t.toLowerCase();if(f.test(e))return"read";if(m.test(e))return"delete";if(p.test(e))return"update";if(g.test(e))return"create"}return"unknown"}function x(e){let t={read:[],create:[],update:[],delete:[],unknown:[]};for(let r of e)t[h(r.name,r.description)].push(r);return t}let b={read:{label:"Read",description:"Safe operations — fetch, list, search. No side effects.",risk:"low"},create:{label:"Create",description:"Add new resources — insert, upload, register.",risk:"medium"},update:{label:"Update",description:"Modify existing resources — edit, patch, rename.",risk:"medium"},delete:{label:"Delete",description:"Destructive operations — remove, purge, destroy.",risk:"high"},unknown:{label:"Other",description:"Operations that could not be automatically classified.",risk:"unknown"}};e.s(["CRUD_GROUP_META",0,b,"classifyToolOp",()=>h,"groupToolsByCrud",()=>x],696609);let y=["read","create","update","delete","unknown"],v={low:"bg-green-100 text-green-800",medium:"bg-yellow-100 text-yellow-800",high:"bg-red-100 text-red-800 font-semibold",unknown:"bg-gray-100 text-gray-700"},w={read:"border-green-200",create:"border-blue-200",update:"border-yellow-200",delete:"border-red-300",unknown:"border-gray-200"},k={read:"bg-green-50",create:"bg-blue-50",update:"bg-yellow-50",delete:"bg-red-50",unknown:"bg-gray-50"};e.s(["default",0,({tools:e,value:t,onChange:r,readOnly:a=!1,searchFilter:l=""})=>{let[o,m]=(0,s.useState)({read:!1,create:!1,update:!1,delete:!1,unknown:!0}),g=(0,s.useMemo)(()=>x(e),[e]),p=(0,s.useMemo)(()=>new Set(void 0===t?e.map(e=>e.name):t),[t,e]),f=e=>{if(a)return;let t=new Set(p);t.has(e)?t.delete(e):t.add(e),r(Array.from(t))};return 0===e.length?null:(0,n.jsx)("div",{className:"space-y-3",children:y.map(e=>{let t,s=g[e];if(0===s.length)return null;if(l){let e=l.toLowerCase();if(!s.some(t=>t.name.toLowerCase().includes(e)||(t.description??"").toLowerCase().includes(e)))return null}let h=b[e],x=(t=g[e]).length>0&&t.every(e=>p.has(e.name)),y=(e=>{let t=g[e];if(0===t.length)return!1;let r=t.filter(e=>p.has(e.name)).length;return r>0&&r{m(t=>({...t,[e]:!t[e]}))},children:[C?(0,n.jsx)(u.default,{className:"w-4 h-4 text-gray-500 flex-shrink-0"}):(0,n.jsx)(d.ChevronDownIcon,{className:"w-4 h-4 text-gray-500 flex-shrink-0"}),(0,n.jsx)("span",{className:"font-semibold text-gray-900 text-sm",children:h.label}),(0,n.jsx)("span",{className:`text-xs px-2 py-0.5 rounded-full ${v[h.risk]}`,children:"high"===h.risk?"High Risk":"medium"===h.risk?"Medium Risk":"low"===h.risk?"Safe":"Unclassified"}),(0,n.jsxs)("span",{className:"text-xs text-gray-500 ml-1",children:[s.filter(e=>p.has(e.name)).length,"/",s.length," allowed"]})]}),!a&&(0,n.jsxs)("div",{className:"flex items-center gap-2 ml-4",children:[(0,n.jsx)(c.Text,{className:"text-xs text-gray-500",children:x?"All on":y?"Partial":"All off"}),(0,n.jsx)(i.Checkbox,{checked:x,indeterminate:y,onChange:t=>((e,t)=>{if(a)return;let l=new Set(p);for(let r of g[e])t?l.add(r.name):l.delete(r.name);r(Array.from(l))})(e,t.target.checked),onClick:e=>e.stopPropagation()})]})]}),!C&&(0,n.jsx)("div",{className:"px-4 pt-2 pb-1 text-xs text-gray-500 bg-white border-b border-gray-100",children:h.description}),!C&&(0,n.jsx)("div",{className:"bg-white divide-y divide-gray-50",children:s.filter(e=>!l||e.name.toLowerCase().includes(l.toLowerCase())||(e.description??"").toLowerCase().includes(l.toLowerCase())).map(e=>{let t,r=(t=e.name,p.has(t));return(0,n.jsxs)("div",{className:`flex items-start gap-3 px-4 py-2.5 transition-colors hover:bg-gray-50 ${!a?"cursor-pointer":""} ${r?"":"opacity-60"}`,onClick:()=>f(e.name),children:[(0,n.jsx)(i.Checkbox,{checked:r,onChange:()=>f(e.name),disabled:a,onClick:e=>e.stopPropagation()}),(0,n.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,n.jsx)(c.Text,{className:"font-medium text-gray-900 text-sm",children:e.name}),e.description&&(0,n.jsx)(c.Text,{className:"text-xs text-gray-500 mt-0.5 leading-snug",children:e.description})]}),(0,n.jsx)("span",{className:`text-xs px-1.5 py-0.5 rounded flex-shrink-0 ${r?"bg-green-100 text-green-700":"bg-gray-100 text-gray-500"}`,children:r?"on":"off"})]},e.name)})})]},e)})})}],531516)},361653,e=>{"use strict";let t=(0,e.i(475254).default)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);e.s(["default",()=>t])},841947,e=>{"use strict";let t=(0,e.i(475254).default)("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);e.s(["default",()=>t])},603908,e=>{"use strict";let t=(0,e.i(475254).default)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);e.s(["default",()=>t])},793130,e=>{"use strict";var t=e.i(290571),r=e.i(429427),a=e.i(371330),l=e.i(271645),o=e.i(394487),n=e.i(503269),s=e.i(214520),i=e.i(746725),c=e.i(914189),d=e.i(144279),u=e.i(294316),m=e.i(601893),g=e.i(140721),p=e.i(942803),f=e.i(233538),h=e.i(694421),x=e.i(700020),b=e.i(35889),y=e.i(998348),v=e.i(722678);let w=(0,l.createContext)(null);w.displayName="GroupContext";let k=l.Fragment,C=Object.assign((0,x.forwardRefWithAs)(function(e,t){var k;let C=(0,l.useId)(),j=(0,p.useProvidedId)(),N=(0,m.useDisabled)(),{id:S=j||`headlessui-switch-${C}`,disabled:$=N||!1,checked:M,defaultChecked:E,onChange:O,name:T,value:P,form:_,autoFocus:z=!1,...R}=e,I=(0,l.useContext)(w),[L,D]=(0,l.useState)(null),B=(0,l.useRef)(null),F=(0,u.useSyncRefs)(B,t,null===I?null:I.setSwitch,D),A=(0,s.useDefaultValue)(E),[q,H]=(0,n.useControllable)(M,O,null!=A&&A),G=(0,i.useDisposables)(),[X,V]=(0,l.useState)(!1),K=(0,c.useEvent)(()=>{V(!0),null==H||H(!q),G.nextFrame(()=>{V(!1)})}),W=(0,c.useEvent)(e=>{if((0,f.isDisabledReactIssue7711)(e.currentTarget))return e.preventDefault();e.preventDefault(),K()}),U=(0,c.useEvent)(e=>{e.key===y.Keys.Space?(e.preventDefault(),K()):e.key===y.Keys.Enter&&(0,h.attemptSubmit)(e.currentTarget)}),Y=(0,c.useEvent)(e=>e.preventDefault()),Q=(0,v.useLabelledBy)(),J=(0,b.useDescribedBy)(),{isFocusVisible:Z,focusProps:ee}=(0,r.useFocusRing)({autoFocus:z}),{isHovered:et,hoverProps:er}=(0,a.useHover)({isDisabled:$}),{pressed:ea,pressProps:el}=(0,o.useActivePress)({disabled:$}),eo=(0,l.useMemo)(()=>({checked:q,disabled:$,hover:et,focus:Z,active:ea,autofocus:z,changing:X}),[q,et,Z,ea,$,X,z]),en=(0,x.mergeProps)({id:S,ref:F,role:"switch",type:(0,d.useResolveButtonType)(e,L),tabIndex:-1===e.tabIndex?0:null!=(k=e.tabIndex)?k:0,"aria-checked":q,"aria-labelledby":Q,"aria-describedby":J,disabled:$||void 0,autoFocus:z,onClick:W,onKeyUp:U,onKeyPress:Y},ee,er,el),es=(0,l.useCallback)(()=>{if(void 0!==A)return null==H?void 0:H(A)},[H,A]),ei=(0,x.useRender)();return l.default.createElement(l.default.Fragment,null,null!=T&&l.default.createElement(g.FormFields,{disabled:$,data:{[T]:P||"on"},overrides:{type:"checkbox",checked:q},form:_,onReset:es}),ei({ourProps:en,theirProps:R,slot:eo,defaultTag:"button",name:"Switch"}))}),{Group:function(e){var t;let[r,a]=(0,l.useState)(null),[o,n]=(0,v.useLabels)(),[s,i]=(0,b.useDescriptions)(),c=(0,l.useMemo)(()=>({switch:r,setSwitch:a}),[r,a]),d=(0,x.useRender)();return l.default.createElement(i,{name:"Switch.Description",value:s},l.default.createElement(n,{name:"Switch.Label",value:o,props:{htmlFor:null==(t=c.switch)?void 0:t.id,onClick(e){r&&(e.currentTarget instanceof HTMLLabelElement&&e.preventDefault(),r.click(),r.focus({preventScroll:!0}))}}},l.default.createElement(w.Provider,{value:c},d({ourProps:{},theirProps:e,slot:{},defaultTag:k,name:"Switch.Group"}))))},Label:v.Label,Description:b.Description});var j=e.i(888288),N=e.i(95779),S=e.i(444755),$=e.i(673706),M=e.i(829087);let E=(0,$.makeClassName)("Switch"),O=l.default.forwardRef((e,r)=>{let{checked:a,defaultChecked:o=!1,onChange:n,color:s,name:i,error:c,errorMessage:d,disabled:u,required:m,tooltip:g,id:p}=e,f=(0,t.__rest)(e,["checked","defaultChecked","onChange","color","name","error","errorMessage","disabled","required","tooltip","id"]),h={bgColor:s?(0,$.getColorClassNames)(s,N.colorPalette.background).bgColor:"bg-tremor-brand dark:bg-dark-tremor-brand",ringColor:s?(0,$.getColorClassNames)(s,N.colorPalette.ring).ringColor:"ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted"},[x,b]=(0,j.default)(o,a),[y,v]=(0,l.useState)(!1),{tooltipProps:w,getReferenceProps:k}=(0,M.useTooltip)(300);return l.default.createElement("div",{className:"flex flex-row items-center justify-start"},l.default.createElement(M.default,Object.assign({text:g},w)),l.default.createElement("div",Object.assign({ref:(0,$.mergeRefs)([r,w.refs.setReference]),className:(0,S.tremorTwMerge)(E("root"),"flex flex-row relative h-5")},f,k),l.default.createElement("input",{type:"checkbox",className:(0,S.tremorTwMerge)(E("input"),"absolute w-5 h-5 cursor-pointer left-0 top-0 opacity-0"),name:i,required:m,checked:x,onChange:e=>{e.preventDefault()}}),l.default.createElement(C,{checked:x,onChange:e=>{b(e),null==n||n(e)},disabled:u,className:(0,S.tremorTwMerge)(E("switch"),"w-10 h-5 group relative inline-flex shrink-0 cursor-pointer items-center justify-center rounded-tremor-full","focus:outline-none",u?"cursor-not-allowed":""),onFocus:()=>v(!0),onBlur:()=>v(!1),id:p},l.default.createElement("span",{className:(0,S.tremorTwMerge)(E("sr-only"),"sr-only")},"Switch ",x?"on":"off"),l.default.createElement("span",{"aria-hidden":"true",className:(0,S.tremorTwMerge)(E("background"),x?h.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")}),l.default.createElement("span",{"aria-hidden":"true",className:(0,S.tremorTwMerge)(E("round"),x?(0,S.tremorTwMerge)(h.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,S.tremorTwMerge)("ring-2",h.ringColor):"")}))),c&&d?l.default.createElement("p",{className:(0,S.tremorTwMerge)(E("errorMessage"),"text-sm text-red-500 mt-1 ")},d):null)});O.displayName="Switch",e.s(["Switch",()=>O],793130)},158392,419470,e=>{"use strict";var t=e.i(843476),r=e.i(779241);let a={ttl:3600,lowest_latency_buffer:0},l=({routingStrategyArgs:e})=>{let l={ttl:"Sliding window to look back over when calculating the average latency of a deployment. Default - 1 hour (in seconds).",lowest_latency_buffer:"Shuffle between deployments within this % of the lowest latency. Default - 0 (i.e. always pick lowest latency)."};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"max-w-3xl",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Latency-Based Configuration"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Fine-tune latency-based routing behavior"})]}),(0,t.jsx)("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2 xl:grid-cols-3",children:Object.entries(e||a).map(([e,a])=>(0,t.jsx)("div",{className:"space-y-2",children:(0,t.jsxs)("label",{className:"block",children:[(0,t.jsx)("span",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:e.replace(/_/g," ")}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-0.5 mb-2",children:l[e]||""}),(0,t.jsx)(r.TextInput,{name:e,defaultValue:"object"==typeof a?JSON.stringify(a,null,2):a?.toString(),className:"font-mono text-sm w-full"})]})},e))})]}),(0,t.jsx)("div",{className:"border-t border-gray-200"})]})},o=({routerSettings:e,routerFieldsMetadata:a})=>(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"max-w-3xl",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Reliability & Retries"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Configure retry logic and failure handling"})]}),(0,t.jsx)("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2 xl:grid-cols-3",children:Object.entries(e).filter(([e,t])=>"fallbacks"!=e&&"context_window_fallbacks"!=e&&"routing_strategy_args"!=e&&"routing_strategy"!=e&&"enable_tag_filtering"!=e).map(([e,l])=>(0,t.jsx)("div",{className:"space-y-2",children:(0,t.jsxs)("label",{className:"block",children:[(0,t.jsx)("span",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:a[e]?.ui_field_name||e}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-0.5 mb-2",children:a[e]?.field_description||""}),(0,t.jsx)(r.TextInput,{name:e,defaultValue:null==l||"null"===l?"":"object"==typeof l?JSON.stringify(l,null,2):l?.toString()||"",placeholder:"—",className:"font-mono text-sm w-full"})]})},e))})]});var n=e.i(199133);let s=({selectedStrategy:e,availableStrategies:r,routingStrategyDescriptions:a,routerFieldsMetadata:l,onStrategyChange:o})=>(0,t.jsxs)("div",{className:"space-y-2 max-w-3xl",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:l.routing_strategy?.ui_field_name||"Routing Strategy"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-0.5 mb-2",children:l.routing_strategy?.field_description||""})]}),(0,t.jsx)("div",{className:"routing-strategy-select max-w-3xl",children:(0,t.jsx)(n.Select,{value:e,onChange:o,style:{width:"100%"},size:"large",children:r.map(e=>(0,t.jsx)(n.Select.Option,{value:e,label:e,children:(0,t.jsxs)("div",{className:"flex flex-col gap-0.5 py-1",children:[(0,t.jsx)("span",{className:"font-mono text-sm font-medium",children:e}),a[e]&&(0,t.jsx)("span",{className:"text-xs text-gray-500 font-normal",children:a[e]})]})},e))})})]});var i=e.i(793130);let c=({enabled:e,routerFieldsMetadata:r,onToggle:a})=>(0,t.jsx)("div",{className:"space-y-3 max-w-3xl",children:(0,t.jsxs)("div",{className:"flex items-start justify-between",children:[(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)("label",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:r.enable_tag_filtering?.ui_field_name||"Enable Tag Filtering"}),(0,t.jsxs)("p",{className:"text-xs text-gray-500 mt-0.5",children:[r.enable_tag_filtering?.field_description||"",r.enable_tag_filtering?.link&&(0,t.jsxs)(t.Fragment,{children:[" ",(0,t.jsx)("a",{href:r.enable_tag_filtering.link,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-800 underline",children:"Learn more"})]})]})]}),(0,t.jsx)(i.Switch,{checked:e,onChange:a,className:"ml-4"})]})});e.s(["default",0,({value:e,onChange:r,routerFieldsMetadata:a,availableRoutingStrategies:n,routingStrategyDescriptions:i})=>(0,t.jsxs)("div",{className:"w-full space-y-8 py-2",children:[(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"max-w-3xl",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Routing Settings"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Configure how requests are routed to deployments"})]}),n.length>0&&(0,t.jsx)(s,{selectedStrategy:e.selectedStrategy||e.routerSettings.routing_strategy||null,availableStrategies:n,routingStrategyDescriptions:i,routerFieldsMetadata:a,onStrategyChange:t=>{r({...e,selectedStrategy:t})}}),(0,t.jsx)(c,{enabled:e.enableTagFiltering,routerFieldsMetadata:a,onToggle:t=>{r({...e,enableTagFiltering:t})}})]}),(0,t.jsx)("div",{className:"border-t border-gray-200"}),"latency-based-routing"===e.selectedStrategy&&(0,t.jsx)(l,{routingStrategyArgs:e.routerSettings.routing_strategy_args}),(0,t.jsx)(o,{routerSettings:e.routerSettings,routerFieldsMetadata:a})]})],158392);var d=e.i(994388),u=e.i(998573),m=e.i(653496),g=e.i(107233),p=e.i(271645),f=e.i(592968),h=e.i(361653),h=h;let x=(0,e.i(475254).default)("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);var b=e.i(37727);function y({group:e,onChange:r,availableModels:a,maxFallbacks:l}){let o=a.filter(t=>t!==e.primaryModel),s=e.fallbackModels.length{let a=[...e.fallbackModels];a.includes(t)&&(a=a.filter(e=>e!==t)),r({...e,primaryModel:t,fallbackModels:a})},showSearch:!0,getPopupContainer:e=>e.parentElement||document.body,filterOption:(e,t)=>(t?.label??"").toLowerCase().includes(e.toLowerCase()),options:a.map(e=>({label:e,value:e}))}),!e.primaryModel&&(0,t.jsxs)("div",{className:"mt-2 flex items-center gap-2 text-amber-600 text-xs bg-amber-50 p-2 rounded",children:[(0,t.jsx)(h.default,{className:"w-4 h-4"}),(0,t.jsx)("span",{children:"Select a model to begin configuring fallbacks"})]})]}),(0,t.jsx)("div",{className:"flex items-center justify-center -my-4 z-10",children:(0,t.jsxs)("div",{className:"bg-indigo-50 text-indigo-500 px-4 py-1 rounded-full text-xs font-bold border border-indigo-100 flex items-center gap-2 shadow-sm",children:[(0,t.jsx)(x,{className:"w-4 h-4"}),"IF FAILS, TRY..."]})}),(0,t.jsxs)("div",{className:`transition-opacity duration-300 ${!e.primaryModel?"opacity-50 pointer-events-none":"opacity-100"}`,children:[(0,t.jsxs)("label",{className:"block text-sm font-semibold text-gray-700 mb-2",children:["Fallback Chain ",(0,t.jsx)("span",{className:"text-red-500",children:"*"}),(0,t.jsxs)("span",{className:"text-xs text-gray-500 font-normal ml-2",children:["(Max ",l," fallbacks at a time)"]})]}),(0,t.jsxs)("div",{className:"bg-gray-50 rounded-xl p-4 border border-gray-200",children:[(0,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsx)(n.Select,{mode:"multiple",className:"w-full",size:"large",placeholder:s?"Select fallback models to add...":`Maximum ${l} fallbacks reached`,value:e.fallbackModels,onChange:t=>{let a=t.slice(0,l);r({...e,fallbackModels:a})},disabled:!e.primaryModel,getPopupContainer:e=>e.parentElement||document.body,options:o.map(e=>({label:e,value:e})),optionRender:(r,a)=>{let l=e.fallbackModels.includes(r.value),o=l?e.fallbackModels.indexOf(r.value)+1:null;return(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[l&&null!==o&&(0,t.jsx)("span",{className:"flex items-center justify-center w-5 h-5 rounded bg-indigo-100 text-indigo-600 text-xs font-bold",children:o}),(0,t.jsx)("span",{children:r.label})]})},maxTagCount:"responsive",maxTagPlaceholder:e=>(0,t.jsx)(f.Tooltip,{styles:{root:{pointerEvents:"none"}},title:e.map(({value:e})=>e).join(", "),children:(0,t.jsxs)("span",{children:["+",e.length," more"]})}),showSearch:!0,filterOption:(e,t)=>(t?.label??"").toLowerCase().includes(e.toLowerCase())}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1 ml-1",children:s?`Search and select multiple models. Selected models will appear below in order. (${e.fallbackModels.length}/${l} used)`:`Maximum ${l} fallbacks reached. Remove some to add more.`})]}),(0,t.jsx)("div",{className:"space-y-2 min-h-[100px]",children:0===e.fallbackModels.length?(0,t.jsxs)("div",{className:"h-32 border-2 border-dashed border-gray-300 rounded-lg flex flex-col items-center justify-center text-gray-400",children:[(0,t.jsx)("span",{className:"text-sm",children:"No fallback models selected"}),(0,t.jsx)("span",{className:"text-xs mt-1",children:"Add models from the dropdown above"})]}):e.fallbackModels.map((a,l)=>(0,t.jsxs)("div",{className:"group flex items-center justify-between p-3 bg-white rounded-lg border border-gray-200 hover:border-indigo-300 hover:shadow-sm transition-all",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"flex items-center justify-center w-6 h-6 rounded bg-gray-100 text-gray-400 group-hover:text-indigo-500 group-hover:bg-indigo-50",children:(0,t.jsx)("span",{className:"text-xs font-bold",children:l+1})}),(0,t.jsx)("div",{children:(0,t.jsx)("span",{className:"font-medium text-gray-800",children:a})})]}),(0,t.jsx)("button",{type:"button",onClick:()=>{let t;return t=e.fallbackModels.filter((e,t)=>t!==l),void r({...e,fallbackModels:t})},className:"opacity-0 group-hover:opacity-100 transition-opacity text-gray-400 hover:text-red-500 p-1",children:(0,t.jsx)(b.X,{className:"w-4 h-4"})})]},`${a}-${l}`))})]})]})]})}function v({groups:e,onGroupsChange:r,availableModels:a,maxFallbacks:l=10,maxGroups:o=5}){let[n,s]=(0,p.useState)(e.length>0?e[0].id:"1");(0,p.useEffect)(()=>{e.length>0?e.some(e=>e.id===n)||s(e[0].id):s("1")},[e]);let i=()=>{if(e.length>=o)return;let t=Date.now().toString();r([...e,{id:t,primaryModel:null,fallbackModels:[]}]),s(t)},c=t=>{r(e.map(e=>e.id===t.id?t:e))},f=e.map((r,o)=>{let n=r.primaryModel?r.primaryModel:`Group ${o+1}`;return{key:r.id,label:n,closable:e.length>1,children:(0,t.jsx)(y,{group:r,onChange:c,availableModels:a,maxFallbacks:l})}});return 0===e.length?(0,t.jsxs)("div",{className:"text-center py-12 bg-gray-50 rounded-lg border border-dashed border-gray-300",children:[(0,t.jsx)("p",{className:"text-gray-500 mb-4",children:"No fallback groups configured"}),(0,t.jsx)(d.Button,{variant:"primary",onClick:i,icon:()=>(0,t.jsx)(g.Plus,{className:"w-4 h-4"}),children:"Create First Group"})]}):(0,t.jsx)(m.Tabs,{type:"editable-card",activeKey:n,onChange:s,onEdit:(t,a)=>{"add"===a?i():"remove"===a&&e.length>1&&(t=>{if(1===e.length)return u.message.warning("At least one group is required");let a=e.filter(e=>e.id!==t);r(a),n===t&&a.length>0&&s(a[a.length-1].id)})(t)},items:f,className:"fallback-tabs",tabBarStyle:{marginBottom:0},hideAdd:e.length>=o})}e.s(["FallbackSelectionForm",()=>v],419470)}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/23bf955e8672ce98.js b/litellm/proxy/_experimental/out/_next/static/chunks/23bf955e8672ce98.js new file mode 100644 index 0000000000..f483b01ffa --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/23bf955e8672ce98.js @@ -0,0 +1 @@ +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,757440,e=>{"use strict";var t=e.i(290571),s=e.i(271645);let l=e=>{var l=(0,t.__rest)(e,[]);return s.default.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},l),s.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",()=>l])},446428,854056,e=>{"use strict";let t;var s=e.i(290571),l=e.i(271645);let r=e=>{var t=(0,s.__rest)(e,[]);return l.default.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),l.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",()=>r],446428);var a=e.i(746725),n=e.i(914189),i=e.i(553521),d=e.i(835696),o=e.i(941444),c=e.i(178677),u=e.i(294316),m=e.i(83733),h=e.i(233137),x=e.i(732607),g=e.i(397701),f=e.i(700020);function p(e){var t;return!!(e.enter||e.enterFrom||e.enterTo||e.leave||e.leaveFrom||e.leaveTo)||(null!=(t=e.as)?t:S)!==l.Fragment||1===l.default.Children.count(e.children)}let b=(0,l.createContext)(null);b.displayName="TransitionContext";var j=((t=j||{}).Visible="visible",t.Hidden="hidden",t);let v=(0,l.createContext)(null);function y(e){return"children"in e?y(e.children):e.current.filter(({el:e})=>null!==e.current).filter(({state:e})=>"visible"===e).length>0}function _(e,t){let s=(0,o.useLatestValue)(e),r=(0,l.useRef)([]),d=(0,i.useIsMounted)(),c=(0,a.useDisposables)(),u=(0,n.useEvent)((e,t=f.RenderStrategy.Hidden)=>{let l=r.current.findIndex(({el:t})=>t===e);-1!==l&&((0,g.match)(t,{[f.RenderStrategy.Unmount](){r.current.splice(l,1)},[f.RenderStrategy.Hidden](){r.current[l].state="hidden"}}),c.microTask(()=>{var e;!y(r)&&d.current&&(null==(e=s.current)||e.call(s))}))}),m=(0,n.useEvent)(e=>{let t=r.current.find(({el:t})=>t===e);return t?"visible"!==t.state&&(t.state="visible"):r.current.push({el:e,state:"visible"}),()=>u(e,f.RenderStrategy.Unmount)}),h=(0,l.useRef)([]),x=(0,l.useRef)(Promise.resolve()),p=(0,l.useRef)({enter:[],leave:[]}),b=(0,n.useEvent)((e,s,l)=>{h.current.splice(0),t&&(t.chains.current[s]=t.chains.current[s].filter(([t])=>t!==e)),null==t||t.chains.current[s].push([e,new Promise(e=>{h.current.push(e)})]),null==t||t.chains.current[s].push([e,new Promise(e=>{Promise.all(p.current[s].map(([e,t])=>t)).then(()=>e())})]),"enter"===s?x.current=x.current.then(()=>null==t?void 0:t.wait.current).then(()=>l(s)):l(s)}),j=(0,n.useEvent)((e,t,s)=>{Promise.all(p.current[t].splice(0).map(([e,t])=>t)).then(()=>{var e;null==(e=h.current.shift())||e()}).then(()=>s(t))});return(0,l.useMemo)(()=>({children:r,register:m,unregister:u,onStart:b,onStop:j,wait:x,chains:p}),[m,u,r,b,j,p,x])}v.displayName="NestingContext";let S=l.Fragment,N=f.RenderFeatures.RenderStrategy,w=(0,f.forwardRefWithAs)(function(e,t){let{show:s,appear:r=!1,unmount:a=!0,...i}=e,o=(0,l.useRef)(null),m=p(e),x=(0,u.useSyncRefs)(...m?[o,t]:null===t?[]:[t]);(0,c.useServerHandoffComplete)();let g=(0,h.useOpenClosed)();if(void 0===s&&null!==g&&(s=(g&h.State.Open)===h.State.Open),void 0===s)throw Error("A is used but it is missing a `show={true | false}` prop.");let[j,S]=(0,l.useState)(s?"visible":"hidden"),w=_(()=>{s||S("hidden")}),[T,k]=(0,l.useState)(!0),I=(0,l.useRef)([s]);(0,d.useIsoMorphicEffect)(()=>{!1!==T&&I.current[I.current.length-1]!==s&&(I.current.push(s),k(!1))},[I,s]);let E=(0,l.useMemo)(()=>({show:s,appear:r,initial:T}),[s,r,T]);(0,d.useIsoMorphicEffect)(()=>{s?S("visible"):y(w)||null===o.current||S("hidden")},[s,w]);let U={unmount:a},R=(0,n.useEvent)(()=>{var t;T&&k(!1),null==(t=e.beforeEnter)||t.call(e)}),B=(0,n.useEvent)(()=>{var t;T&&k(!1),null==(t=e.beforeLeave)||t.call(e)}),F=(0,f.useRender)();return l.default.createElement(v.Provider,{value:w},l.default.createElement(b.Provider,{value:E},F({ourProps:{...U,as:l.Fragment,children:l.default.createElement(C,{ref:x,...U,...i,beforeEnter:R,beforeLeave:B})},theirProps:{},defaultTag:l.Fragment,features:N,visible:"visible"===j,name:"Transition"})))}),C=(0,f.forwardRefWithAs)(function(e,t){var s,r;let{transition:a=!0,beforeEnter:i,afterEnter:o,beforeLeave:j,afterLeave:w,enter:C,enterFrom:T,enterTo:k,entered:I,leave:E,leaveFrom:U,leaveTo:R,...B}=e,[F,M]=(0,l.useState)(null),L=(0,l.useRef)(null),D=p(e),A=(0,u.useSyncRefs)(...D?[L,t,M]:null===t?[]:[t]),O=null==(s=B.unmount)||s?f.RenderStrategy.Unmount:f.RenderStrategy.Hidden,{show:P,appear:z,initial:V}=function(){let e=(0,l.useContext)(b);if(null===e)throw Error("A is used but it is missing a parent or .");return e}(),[$,K]=(0,l.useState)(P?"visible":"hidden"),q=function(){let e=(0,l.useContext)(v);if(null===e)throw Error("A is used but it is missing a parent or .");return e}(),{register:H,unregister:G}=q;(0,d.useIsoMorphicEffect)(()=>H(L),[H,L]),(0,d.useIsoMorphicEffect)(()=>{if(O===f.RenderStrategy.Hidden&&L.current)return P&&"visible"!==$?void K("visible"):(0,g.match)($,{hidden:()=>G(L),visible:()=>H(L)})},[$,L,H,G,P,O]);let W=(0,c.useServerHandoffComplete)();(0,d.useIsoMorphicEffect)(()=>{if(D&&W&&"visible"===$&&null===L.current)throw Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[L,$,W,D]);let J=V&&!z,Q=z&&P&&V,Z=(0,l.useRef)(!1),Y=_(()=>{Z.current||(K("hidden"),G(L))},q),X=(0,n.useEvent)(e=>{Z.current=!0,Y.onStart(L,e?"enter":"leave",e=>{"enter"===e?null==i||i():"leave"===e&&(null==j||j())})}),ee=(0,n.useEvent)(e=>{let t=e?"enter":"leave";Z.current=!1,Y.onStop(L,t,e=>{"enter"===e?null==o||o():"leave"===e&&(null==w||w())}),"leave"!==t||y(Y)||(K("hidden"),G(L))});(0,l.useEffect)(()=>{D&&a||(X(P),ee(P))},[P,D,a]);let et=!(!a||!D||!W||J),[,es]=(0,m.useTransition)(et,F,P,{start:X,end:ee}),el=(0,f.compact)({ref:A,className:(null==(r=(0,x.classNames)(B.className,Q&&C,Q&&T,es.enter&&C,es.enter&&es.closed&&T,es.enter&&!es.closed&&k,es.leave&&E,es.leave&&!es.closed&&U,es.leave&&es.closed&&R,!es.transition&&P&&I))?void 0:r.trim())||void 0,...(0,m.transitionDataAttributes)(es)}),er=0;"visible"===$&&(er|=h.State.Open),"hidden"===$&&(er|=h.State.Closed),es.enter&&(er|=h.State.Opening),es.leave&&(er|=h.State.Closing);let ea=(0,f.useRender)();return l.default.createElement(v.Provider,{value:Y},l.default.createElement(h.OpenClosedProvider,{value:er},ea({ourProps:el,theirProps:B,defaultTag:S,features:N,visible:"visible"===$,name:"Transition.Child"})))}),T=(0,f.forwardRefWithAs)(function(e,t){let s=null!==(0,l.useContext)(b),r=null!==(0,h.useOpenClosed)();return l.default.createElement(l.default.Fragment,null,!s&&r?l.default.createElement(w,{ref:t,...e}):l.default.createElement(C,{ref:t,...e}))}),k=Object.assign(w,{Child:T,Root:w});e.s(["Transition",()=>k],854056)},206929,e=>{"use strict";var t=e.i(290571),s=e.i(757440),l=e.i(271645),r=e.i(446428),a=e.i(444755),n=e.i(673706),i=e.i(103471),d=e.i(495470),o=e.i(854056),c=e.i(888288);let u=(0,n.makeClassName)("Select"),m=l.default.forwardRef((e,n)=>{let{defaultValue:m="",value:h,onValueChange:x,placeholder:g="Select...",disabled:f=!1,icon:p,enableClear:b=!1,required:j,children:v,name:y,error:_=!1,errorMessage:S,className:N,id:w}=e,C=(0,t.__rest)(e,["defaultValue","value","onValueChange","placeholder","disabled","icon","enableClear","required","children","name","error","errorMessage","className","id"]),T=(0,l.useRef)(null),k=l.Children.toArray(v),[I,E]=(0,c.default)(m,h),U=(0,l.useMemo)(()=>{let e=l.default.Children.toArray(v).filter(l.isValidElement);return(0,i.constructValueToNameMapping)(e)},[v]);return l.default.createElement("div",{className:(0,a.tremorTwMerge)("w-full min-w-[10rem] text-tremor-default",N)},l.default.createElement("div",{className:"relative"},l.default.createElement("select",{title:"select-hidden",required:j,className:(0,a.tremorTwMerge)("h-full w-full absolute left-0 top-0 -z-10 opacity-0"),value:I,onChange:e=>{e.preventDefault()},name:y,disabled:f,id:w,onFocus:()=>{let e=T.current;e&&e.focus()}},l.default.createElement("option",{className:"hidden",value:"",disabled:!0,hidden:!0},g),k.map(e=>{let t=e.props.value,s=e.props.children;return l.default.createElement("option",{className:"hidden",key:t,value:t},s)})),l.default.createElement(d.Listbox,Object.assign({as:"div",ref:n,defaultValue:I,value:I,onChange:e=>{null==x||x(e),E(e)},disabled:f,id:w},C),({value:e})=>{var t;return l.default.createElement(l.default.Fragment,null,l.default.createElement(d.ListboxButton,{ref:T,className:(0,a.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",p?"pl-10":"pl-3",(0,i.getSelectButtonColors)((0,i.hasValue)(e),f,_))},p&&l.default.createElement("span",{className:(0,a.tremorTwMerge)("absolute inset-y-0 left-0 flex items-center ml-px pl-2.5")},l.default.createElement(p,{className:(0,a.tremorTwMerge)(u("Icon"),"flex-none h-5 w-5","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")})),l.default.createElement("span",{className:"w-[90%] block truncate"},e&&null!=(t=U.get(e))?t:g),l.default.createElement("span",{className:(0,a.tremorTwMerge)("absolute inset-y-0 right-0 flex items-center mr-3")},l.default.createElement(s.default,{className:(0,a.tremorTwMerge)(u("arrowDownIcon"),"flex-none h-5 w-5","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")}))),b&&I?l.default.createElement("button",{type:"button",className:(0,a.tremorTwMerge)("absolute inset-y-0 right-0 flex items-center mr-8"),onClick:e=>{e.preventDefault(),E(""),null==x||x("")}},l.default.createElement(r.default,{className:(0,a.tremorTwMerge)(u("clearIcon"),"flex-none h-4 w-4","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")})):null,l.default.createElement(o.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"},l.default.createElement(d.ListboxOptions,{anchor:"bottom start",className:(0,a.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")},v)))})),_&&S?l.default.createElement("p",{className:(0,a.tremorTwMerge)("errorMessage","text-sm text-rose-500 mt-1")},S):null)});m.displayName="Select",e.s(["Select",()=>m],206929)},502275,e=>{"use strict";var t=e.i(271645);let s=t.forwardRef(function(e,s){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:s},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}))});e.s(["InformationCircleIcon",0,s],502275)},78085,e=>{"use strict";var t=e.i(290571),s=e.i(103471),l=e.i(888288),r=e.i(271645),a=e.i(444755),n=e.i(673706);let i=(0,n.makeClassName)("Textarea"),d=r.default.forwardRef((e,d)=>{let{value:o,defaultValue:c="",placeholder:u="Type...",error:m=!1,errorMessage:h,disabled:x=!1,className:g,onChange:f,onValueChange:p,autoHeight:b=!1}=e,j=(0,t.__rest)(e,["value","defaultValue","placeholder","error","errorMessage","disabled","className","onChange","onValueChange","autoHeight"]),[v,y]=(0,l.default)(c,o),_=(0,r.useRef)(null),S=(0,s.hasValue)(v);return(0,r.useEffect)(()=>{let e=_.current;if(b&&e){e.style.height="60px";let t=e.scrollHeight;e.style.height=t+"px"}},[b,_,v]),r.default.createElement(r.default.Fragment,null,r.default.createElement("textarea",Object.assign({ref:(0,n.mergeRefs)([_,d]),value:v,placeholder:u,disabled:x,className:(0,a.tremorTwMerge)(i("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,s.getSelectButtonColors)(S,x,m),x?"placeholder:text-tremor-content-subtle dark:placeholder:text-dark-tremor-content-subtle":"placeholder:text-tremor-content dark:placeholder:text-dark-tremor-content",g),"data-testid":"text-area",onChange:e=>{null==f||f(e),y(e.target.value),null==p||p(e.target.value)}},j)),m&&h?r.default.createElement("p",{className:(0,a.tremorTwMerge)(i("errorMessage"),"text-sm text-red-500 mt-1")},h):null)});d.displayName="Textarea",e.s(["Textarea",()=>d],78085)},910119,e=>{"use strict";var t=e.i(843476),s=e.i(197647),l=e.i(653824),r=e.i(881073),a=e.i(404206),n=e.i(723731),i=e.i(271645),d=e.i(464571),o=e.i(212931),c=e.i(898586),u=e.i(312361),m=e.i(998573),h=e.i(291542),x=e.i(199133),g=e.i(28651),f=e.i(175712),p=e.i(770914),b=e.i(536916),j=e.i(764205),v=e.i(827252),y=e.i(994388),_=e.i(35983),S=e.i(779241),N=e.i(78085),w=e.i(808613),C=e.i(592968),T=e.i(708347),k=e.i(860585),I=e.i(355619),E=e.i(435451);function U({userData:e,onCancel:s,onSubmit:l,teams:r,accessToken:a,userID:n,userRole:d,userModels:o,possibleUIRoles:c,isBulkEdit:u=!1}){let[m]=w.Form.useForm(),[h,g]=(0,i.useState)(!1);return i.default.useEffect(()=>{let t=e.user_info?.max_budget,s=null==t;g(s),m.setFieldsValue({user_id:e.user_id,user_email:e.user_info?.user_email,user_alias:e.user_info?.user_alias,user_role:e.user_info?.user_role,models:e.user_info?.models||[],max_budget:s?"":t,budget_duration:e.user_info?.budget_duration,metadata:e.user_info?.metadata?JSON.stringify(e.user_info.metadata,null,2):void 0})},[e,m]),(0,t.jsxs)(w.Form,{form:m,onFinish:e=>{if(e.metadata&&"string"==typeof e.metadata)try{e.metadata=JSON.parse(e.metadata)}catch(e){console.error("Error parsing metadata JSON:",e);return}(h||""===e.max_budget||void 0===e.max_budget)&&(e.max_budget=null),l(e)},layout:"vertical",children:[!u&&(0,t.jsx)(w.Form.Item,{label:"User ID",name:"user_id",children:(0,t.jsx)(S.TextInput,{disabled:!0})}),!u&&(0,t.jsx)(w.Form.Item,{label:"Email",name:"user_email",children:(0,t.jsx)(S.TextInput,{})}),(0,t.jsx)(w.Form.Item,{label:"User Alias",name:"user_alias",children:(0,t.jsx)(S.TextInput,{})}),(0,t.jsx)(w.Form.Item,{label:(0,t.jsxs)("span",{children:["Global Proxy Role"," ",(0,t.jsx)(C.Tooltip,{title:"This is the role that the user will globally on the proxy. This role is independent of any team/org specific roles.",children:(0,t.jsx)(v.InfoCircleOutlined,{})})]}),name:"user_role",children:(0,t.jsx)(x.Select,{children:c&&Object.entries(c).map(([e,{ui_label:s,description:l}])=>(0,t.jsx)(_.SelectItem,{value:e,title:s,children:(0,t.jsxs)("div",{className:"flex",children:[s," ",(0,t.jsx)("p",{className:"ml-2",style:{color:"gray",fontSize:"12px"},children:l})]})},e))})}),(0,t.jsx)(w.Form.Item,{label:(0,t.jsxs)("span",{children:["Personal Models"," ",(0,t.jsx)(C.Tooltip,{title:"Select which models this user can access outside of team-scope. Choose 'All Proxy Models' to grant access to all models available on the proxy.",children:(0,t.jsx)(v.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"models",children:(0,t.jsxs)(x.Select,{mode:"multiple",placeholder:"Select models",style:{width:"100%"},disabled:!T.all_admin_roles.includes(d||""),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"),o.map(e=>(0,t.jsx)(x.Select.Option,{value:e,children:(0,I.getModelDisplayName)(e)},e))]})}),(0,t.jsx)(w.Form.Item,{label:(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"12px"},children:[(0,t.jsx)("span",{children:"Max Budget (USD)"}),(0,t.jsx)(b.Checkbox,{checked:h,onChange:e=>{let t=e.target.checked;g(t),t&&m.setFieldsValue({max_budget:""})},children:"Unlimited Budget"})]}),name:"max_budget",rules:[{validator:(e,t)=>h||""!==t&&null!=t?Promise.resolve():Promise.reject(Error("Please enter a budget or select Unlimited Budget"))}],children:(0,t.jsx)(E.default,{step:.01,precision:2,style:{width:"100%"},disabled:h})}),(0,t.jsx)(w.Form.Item,{label:"Reset Budget",name:"budget_duration",children:(0,t.jsx)(k.default,{})}),(0,t.jsx)(w.Form.Item,{label:"Metadata",name:"metadata",children:(0,t.jsx)(N.Textarea,{rows:4,placeholder:"Enter metadata as JSON"})}),(0,t.jsxs)("div",{className:"flex justify-end space-x-2",children:[(0,t.jsx)(y.Button,{variant:"secondary",type:"button",onClick:s,children:"Cancel"}),(0,t.jsx)(y.Button,{type:"submit",children:"Save Changes"})]})]})}var R=e.i(727749);let{Text:B,Title:F}=c.Typography,M=({open:e,onCancel:s,selectedUsers:l,possibleUIRoles:r,accessToken:a,onSuccess:n,teams:d,userRole:c,userModels:v,allowAllUsers:y=!1})=>{let[_,S]=(0,i.useState)(!1),[N,w]=(0,i.useState)([]),[C,T]=(0,i.useState)(null),[k,I]=(0,i.useState)(!1),[E,M]=(0,i.useState)(!1),L=()=>{w([]),T(null),I(!1),M(!1),s()},D=i.default.useMemo(()=>({user_id:"bulk_edit",user_info:{user_email:"",user_role:"",teams:[],models:[],max_budget:null,spend:0,metadata:{},created_at:null,updated_at:null},keys:[],teams:d||[]}),[d,e]),A=async e=>{if(console.log("formValues",e),!a)return void R.default.fromBackend("Access token not found");S(!0);try{let t=l.map(e=>e.user_id),r={};e.user_role&&""!==e.user_role&&(r.user_role=e.user_role),null!==e.max_budget&&void 0!==e.max_budget&&(r.max_budget=e.max_budget),e.models&&e.models.length>0&&(r.models=e.models),e.budget_duration&&""!==e.budget_duration&&(r.budget_duration=e.budget_duration),e.metadata&&Object.keys(e.metadata).length>0&&(r.metadata=e.metadata);let i=Object.keys(r).length>0,d=k&&N.length>0;if(!i&&!d)return void R.default.fromBackend("Please modify at least one field or select teams to add users to");let o=[];if(i)if(E){let e=await (0,j.userBulkUpdateUserCall)(a,r,void 0,!0);o.push(`Updated all users (${e.total_requested} total)`)}else await (0,j.userBulkUpdateUserCall)(a,r,t),o.push(`Updated ${t.length} user(s)`);if(d){let e=[];for(let t of N)try{let s=null;s=E?null:l.map(e=>({user_id:e.user_id,role:"user",user_email:e.user_email||null}));let r=await (0,j.teamBulkMemberAddCall)(a,t,s||null,C||void 0,E);console.log("result",r),e.push({teamId:t,success:!0,successfulAdditions:r.successful_additions,failedAdditions:r.failed_additions})}catch(s){console.error(`Failed to add users to team ${t}:`,s),e.push({teamId:t,success:!1,error:s})}let t=e.filter(e=>e.success),s=e.filter(e=>!e.success);if(t.length>0){let e=t.reduce((e,t)=>e+t.successfulAdditions,0);o.push(`Added users to ${t.length} team(s) (${e} total additions)`)}s.length>0&&m.message.warning(`Failed to add users to ${s.length} team(s)`)}o.length>0&&R.default.success(o.join(". ")),w([]),T(null),I(!1),M(!1),n(),s()}catch(e){console.error("Bulk operation failed:",e),R.default.fromBackend("Failed to perform bulk operations")}finally{S(!1)}};return(0,t.jsxs)(o.Modal,{open:e,onCancel:L,footer:null,title:E?"Bulk Edit All Users":`Bulk Edit ${l.length} User(s)`,width:800,children:[y&&(0,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsx)(b.Checkbox,{checked:E,onChange:e=>M(e.target.checked),children:(0,t.jsx)(B,{strong:!0,children:"Update ALL users in the system"})}),E&&(0,t.jsx)("div",{style:{marginTop:8},children:(0,t.jsx)(B,{type:"warning",style:{fontSize:"12px"},children:"⚠️ This will apply changes to ALL users in the system, not just the selected ones."})})]}),!E&&(0,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsxs)(F,{level:5,children:["Selected Users (",l.length,"):"]}),(0,t.jsx)(h.Table,{size:"small",bordered:!0,dataSource:l,pagination:!1,scroll:{y:200},rowKey:"user_id",columns:[{title:"User ID",dataIndex:"user_id",key:"user_id",width:"30%",render:e=>(0,t.jsx)(B,{strong:!0,style:{fontSize:"12px"},children:e.length>20?`${e.slice(0,20)}...`:e})},{title:"Email",dataIndex:"user_email",key:"user_email",width:"25%",render:e=>(0,t.jsx)(B,{type:"secondary",style:{fontSize:"12px"},children:e||"No email"})},{title:"Current Role",dataIndex:"user_role",key:"user_role",width:"25%",render:e=>(0,t.jsx)(B,{style:{fontSize:"12px"},children:r?.[e]?.ui_label||e})},{title:"Budget",dataIndex:"max_budget",key:"max_budget",width:"20%",render:e=>(0,t.jsx)(B,{style:{fontSize:"12px"},children:null!==e?`$${e}`:"Unlimited"})}]})]}),(0,t.jsx)(u.Divider,{}),(0,t.jsx)("div",{className:"mb-4",children:(0,t.jsxs)(B,{children:[(0,t.jsx)("strong",{children:"Instructions:"})," Fill in the fields below with the values you want to apply to all selected users. You can bulk edit: role, budget, models, and metadata. You can also add users to teams."]})}),(0,t.jsx)(f.Card,{title:"Team Management",size:"small",className:"mb-4",style:{backgroundColor:"#fafafa"},children:(0,t.jsxs)(p.Space,{direction:"vertical",style:{width:"100%"},children:[(0,t.jsx)(b.Checkbox,{checked:k,onChange:e=>I(e.target.checked),children:"Add selected users to teams"}),k&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(B,{strong:!0,children:"Select Teams:"}),(0,t.jsx)(x.Select,{mode:"multiple",placeholder:"Select teams to add users to",value:N,onChange:w,style:{width:"100%",marginTop:8},options:d?.map(e=>({label:e.team_alias||e.team_id,value:e.team_id}))||[]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(B,{strong:!0,children:"Team Budget (Optional):"}),(0,t.jsx)(g.InputNumber,{placeholder:"Max budget per user in team",value:C,onChange:e=>T(e),style:{width:"100%",marginTop:8},min:0,step:.01,precision:2}),(0,t.jsx)(B,{type:"secondary",style:{fontSize:"12px"},children:"Leave empty for unlimited budget within team limits"})]}),(0,t.jsx)(B,{type:"secondary",style:{fontSize:"12px"},children:'Users will be added with "user" role by default. All users will be added to each selected team.'})]})]})}),(0,t.jsx)(U,{userData:D,onCancel:L,onSubmit:A,teams:d,accessToken:a,userID:"bulk_edit",userRole:c,userModels:v,possibleUIRoles:r,isBulkEdit:!0}),_&&(0,t.jsx)("div",{style:{textAlign:"center",marginTop:"10px"},children:(0,t.jsxs)(B,{children:["Updating ",E?"all users":l.length," user(s)..."]})})]})};var L=e.i(371455);let D=({visible:e,possibleUIRoles:s,onCancel:l,user:r,onSubmit:a})=>{let[n,c]=(0,i.useState)(r),[u]=w.Form.useForm();(0,i.useEffect)(()=>{u.resetFields()},[r]);let m=async()=>{u.resetFields(),l()},h=async e=>{a(e),u.resetFields(),l()};return r?(0,t.jsx)(o.Modal,{open:e,onCancel:m,footer:null,title:"Edit User "+r.user_id,width:1e3,children:(0,t.jsx)(w.Form,{form:u,onFinish:h,initialValues:r,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(w.Form.Item,{className:"mt-8",label:"User Email",tooltip:"Email of the User",name:"user_email",children:(0,t.jsx)(S.TextInput,{})}),(0,t.jsx)(w.Form.Item,{label:"user_id",name:"user_id",hidden:!0,children:(0,t.jsx)(S.TextInput,{})}),(0,t.jsx)(w.Form.Item,{label:"User Role",name:"user_role",children:(0,t.jsx)(x.Select,{children:s&&Object.entries(s).map(([e,{ui_label:s,description:l}])=>(0,t.jsx)(_.SelectItem,{value:e,title:s,children:(0,t.jsxs)("div",{className:"flex",children:[s," ",(0,t.jsx)("p",{className:"ml-2",style:{color:"gray",fontSize:"12px"},children:l})]})},e))})}),(0,t.jsx)(w.Form.Item,{label:"Spend (USD)",name:"spend",tooltip:"(float) - Spend of all LLM calls completed by this user",help:"Across all keys (including keys with team_id).",children:(0,t.jsx)(g.InputNumber,{min:0,step:.01})}),(0,t.jsx)(w.Form.Item,{label:"User Budget (USD)",name:"max_budget",tooltip:"(float) - Maximum budget of this user",help:"Maximum budget of this user.",children:(0,t.jsx)(E.default,{min:0,step:.01})}),(0,t.jsx)(w.Form.Item,{label:"Reset Budget",name:"budget_duration",children:(0,t.jsx)(k.default,{})}),(0,t.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,t.jsx)(d.Button,{htmlType:"submit",children:"Save"})}),(0,t.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,t.jsx)(d.Button,{htmlType:"submit",children:"Save"})})]})})}):null};var A=e.i(172372),O=e.i(500330),P=e.i(152473),z=e.i(266027),V=e.i(912598),$=e.i(127952),K=e.i(304967),q=e.i(629569),H=e.i(599724),G=e.i(114600),W=e.i(482725),J=e.i(790848),Q=e.i(646563),Z=e.i(955135);let Y=({accessToken:e,possibleUIRoles:s,userID:l,userRole:r})=>{let[a,n]=(0,i.useState)(!0),[d,o]=(0,i.useState)(null),[u,m]=(0,i.useState)(!1),[h,f]=(0,i.useState)({}),[p,b]=(0,i.useState)(!1),[v,_]=(0,i.useState)([]),{Paragraph:N}=c.Typography,{Option:w}=x.Select;(0,i.useEffect)(()=>{(async()=>{if(!e)return n(!1);try{let t=await (0,j.getInternalUserSettings)(e);if(o(t),f(t.values||{}),e)try{let t=await (0,j.modelAvailableCall)(e,l,r);if(t&&t.data){let e=t.data.map(e=>e.id);_(e)}}catch(e){console.error("Error fetching available models:",e)}}catch(e){console.error("Error fetching SSO settings:",e),R.default.fromBackend("Failed to fetch SSO settings")}finally{n(!1)}})()},[e]);let C=async()=>{if(e){b(!0);try{let t=Object.entries(h).reduce((e,[t,s])=>(e[t]=""===s?null:s,e),{}),s=await (0,j.updateInternalUserSettings)(e,t);o({...d,values:s.settings}),m(!1)}catch(e){console.error("Error updating SSO settings:",e),R.default.fromBackend("Failed to update settings: "+e)}finally{b(!1)}}},T=(e,t)=>{f(s=>({...s,[e]:t}))},E=e=>e&&Array.isArray(e)?e.map(e=>"string"==typeof e?{team_id:e,user_role:"user"}:"object"==typeof e&&e.team_id?{team_id:e.team_id,max_budget_in_team:e.max_budget_in_team,user_role:e.user_role||"user"}:{team_id:"",user_role:"user"}):[];return a?(0,t.jsx)("div",{className:"flex justify-center items-center h-64",children:(0,t.jsx)(W.Spin,{size:"large"})}):d?(0,t.jsxs)(K.Card,{children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,t.jsx)(q.Title,{children:"Default User Settings"}),!a&&d&&(u?(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(y.Button,{variant:"secondary",onClick:()=>{m(!1),f(d.values||{})},disabled:p,children:"Cancel"}),(0,t.jsx)(y.Button,{onClick:C,loading:p,children:"Save Changes"})]}):(0,t.jsx)(y.Button,{onClick:()=>m(!0),children:"Edit Settings"}))]}),d?.field_schema?.description&&(0,t.jsx)(N,{className:"mb-4",children:d.field_schema.description}),(0,t.jsx)(G.Divider,{}),(0,t.jsx)("div",{className:"mt-4 space-y-4",children:(()=>{let{values:e,field_schema:l}=d;return l&&l.properties?Object.entries(l.properties).map(([l,r])=>{let a=e[l],n=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)(H.Text,{className:"font-medium text-lg",children:n}),(0,t.jsx)(N,{className:"text-sm text-gray-500 mt-1",children:r.description||"No description available"}),u?(0,t.jsx)("div",{className:"mt-2",children:((e,l,r)=>{let a=l.type;if("teams"===e){let s,l;return(0,t.jsx)("div",{className:"mt-2",children:(s=E(h[e]||[]),l=(e,t,l)=>{let r=[...s];r[e]={...r[e],[t]:l},T("teams",r)},(0,t.jsxs)("div",{className:"space-y-3",children:[s.map((e,r)=>(0,t.jsxs)("div",{className:"border rounded-lg p-4 bg-gray-50",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,t.jsxs)(H.Text,{className:"font-medium",children:["Team ",r+1]}),(0,t.jsx)(y.Button,{size:"sm",variant:"secondary",icon:Z.DeleteOutlined,onClick:()=>{T("teams",s.filter((e,t)=>t!==r))},className:"text-red-500 hover:text-red-700",children:"Remove"})]}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(H.Text,{className:"text-sm font-medium mb-1",children:"Team ID"}),(0,t.jsx)(S.TextInput,{value:e.team_id,onChange:e=>l(r,"team_id",e.target.value),placeholder:"Enter team ID"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(H.Text,{className:"text-sm font-medium mb-1",children:"Max Budget in Team"}),(0,t.jsx)(g.InputNumber,{style:{width:"100%"},value:e.max_budget_in_team,onChange:e=>l(r,"max_budget_in_team",e),placeholder:"Optional",min:0,step:.01,precision:2})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(H.Text,{className:"text-sm font-medium mb-1",children:"User Role"}),(0,t.jsxs)(x.Select,{style:{width:"100%"},value:e.user_role,onChange:e=>l(r,"user_role",e),children:[(0,t.jsx)(w,{value:"user",children:"User"}),(0,t.jsx)(w,{value:"admin",children:"Admin"})]})]})]})]},r)),(0,t.jsx)(y.Button,{variant:"secondary",icon:Q.PlusOutlined,onClick:()=>{T("teams",[...s,{team_id:"",user_role:"user"}])},className:"w-full",children:"Add Team"})]}))})}if("user_role"===e&&s)return(0,t.jsx)(x.Select,{style:{width:"100%"},value:h[e]||"",onChange:t=>T(e,t),className:"mt-2",children:Object.entries(s).filter(([e])=>e.includes("internal_user")).map(([e,{ui_label:s,description:l}])=>(0,t.jsx)(w,{value:e,children:(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("span",{children:s}),(0,t.jsx)("span",{className:"ml-2 text-xs text-gray-500",children:l})]})},e))});if("budget_duration"===e)return(0,t.jsx)(k.default,{value:h[e]||null,onChange:t=>T(e,t),className:"mt-2"});if("boolean"===a)return(0,t.jsx)("div",{className:"mt-2",children:(0,t.jsx)(J.Switch,{checked:!!h[e],onChange:t=>T(e,t)})});if("array"===a&&l.items?.enum)return(0,t.jsx)(x.Select,{mode:"multiple",style:{width:"100%"},value:h[e]||[],onChange:t=>T(e,t),className:"mt-2",children:l.items.enum.map(e=>(0,t.jsx)(w,{value:e,children:e},e))});else if("models"===e)return(0,t.jsxs)(x.Select,{mode:"multiple",style:{width:"100%"},value:h[e]||[],onChange:t=>T(e,t),className:"mt-2",children:[(0,t.jsx)(w,{value:"no-default-models",children:"No Default Models"},"no-default-models"),(0,t.jsx)(w,{value:"all-proxy-models",children:"All Proxy Models"},"all-proxy-models"),v.map(e=>(0,t.jsx)(w,{value:e,children:(0,I.getModelDisplayName)(e)},e))]});else if("string"===a&&l.enum)return(0,t.jsx)(x.Select,{style:{width:"100%"},value:h[e]||"",onChange:t=>T(e,t),className:"mt-2",children:l.enum.map(e=>(0,t.jsx)(w,{value:e,children:e},e))});else return(0,t.jsx)(S.TextInput,{value:void 0!==h[e]?String(h[e]):"",onChange:t=>T(e,t.target.value),placeholder:l.description||"",className:"mt-2"})})(l,r,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("teams"===e&&Array.isArray(l)){if(0===l.length)return(0,t.jsx)("span",{className:"text-gray-400",children:"No teams assigned"});let e=E(l);return(0,t.jsx)("div",{className:"space-y-2 mt-1",children:e.map((e,s)=>(0,t.jsx)("div",{className:"border rounded-lg p-3 bg-white",children:(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-2 text-sm",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"font-medium text-gray-600",children:"Team ID:"}),(0,t.jsx)("p",{className:"text-gray-900",children:e.team_id||"Not specified"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"font-medium text-gray-600",children:"Max Budget:"}),(0,t.jsx)("p",{className:"text-gray-900",children:void 0!==e.max_budget_in_team?`$${(0,O.formatNumberWithCommas)(e.max_budget_in_team,4)}`:"No limit"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"font-medium text-gray-600",children:"Role:"}),(0,t.jsx)("p",{className:"text-gray-900 capitalize",children:e.user_role})]})]})},s))})}if("user_role"===e&&s&&s[l]){let{ui_label:e,description:r}=s[l];return(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"font-medium",children:e}),r&&(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:r})]})}if("budget_duration"===e)return(0,t.jsx)("span",{children:(0,k.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,s)=>(0,t.jsx)("span",{className:"px-2 py-1 bg-blue-100 rounded text-xs",children:(0,I.getModelDisplayName)(e)},s))});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,s)=>(0,t.jsx)("span",{className:"px-2 py-1 bg-blue-100 rounded text-xs",children:"object"==typeof e?JSON.stringify(e):String(e)},s))}):(0,t.jsx)("pre",{className:"bg-gray-100 p-2 rounded text-xs overflow-auto mt-1",children:JSON.stringify(l,null,2)});return(0,t.jsx)("span",{children:String(l)})})(l,a)})]},l)}):(0,t.jsx)(H.Text,{children:"No schema information available"})})()})]}):(0,t.jsx)(K.Card,{children:(0,t.jsx)(H.Text,{children:"No settings available or you do not have permission to view them."})})};var X=e.i(389083),ee=e.i(350967),et=e.i(752978),es=e.i(591935),el=e.i(68155),er=e.i(502275),ea=e.i(278587);let en=(e,s,l,r,a,n)=>{let i=[{header:"User ID",accessorKey:"user_id",enableSorting:!0,cell:({row:e})=>(0,t.jsx)(C.Tooltip,{title:e.original.user_id,children:(0,t.jsx)("span",{className:"text-xs",children:e.original.user_id?`${e.original.user_id.slice(0,7)}...`:"-"})})},{header:"Email",accessorKey:"user_email",enableSorting:!0,cell:({row:e})=>(0,t.jsx)("span",{className:"text-xs",children:e.original.user_email||"-"})},{header:"Global Proxy Role",accessorKey:"user_role",enableSorting:!0,cell:({row:s})=>(0,t.jsx)("span",{className:"text-xs",children:e?.[s.original.user_role]?.ui_label||"-"})},{header:"User Alias",accessorKey:"user_alias",enableSorting:!1,cell:({row:e})=>(0,t.jsx)("span",{className:"text-xs",children:e.original.user_alias||"-"})},{header:"Spend (USD)",accessorKey:"spend",enableSorting:!0,cell:({row:e})=>(0,t.jsx)("span",{className:"text-xs",children:e.original.spend?(0,O.formatNumberWithCommas)(e.original.spend,4):"-"})},{header:"Budget (USD)",accessorKey:"max_budget",enableSorting:!1,cell:({row:e})=>(0,t.jsx)("span",{className:"text-xs",children:null!==e.original.max_budget?e.original.max_budget:"Unlimited"})},{header:()=>(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{children:"SSO ID"}),(0,t.jsx)(C.Tooltip,{title:"SSO ID is the ID of the user in the SSO provider. If the user is not using SSO, this will be null.",children:(0,t.jsx)(er.InformationCircleIcon,{className:"w-4 h-4"})})]}),accessorKey:"sso_user_id",enableSorting:!1,cell:({row:e})=>(0,t.jsx)("span",{className:"text-xs",children:null!==e.original.sso_user_id?e.original.sso_user_id:"-"})},{header:"Virtual Keys",accessorKey:"key_count",enableSorting:!1,cell:({row:e})=>(0,t.jsx)(ee.Grid,{numItems:2,children:e.original.key_count>0?(0,t.jsxs)(X.Badge,{size:"xs",color:"indigo",children:[e.original.key_count," ",1===e.original.key_count?"Key":"Keys"]}):(0,t.jsx)(X.Badge,{size:"xs",color:"gray",children:"No Keys"})})},{header:"Created At",accessorKey:"created_at",enableSorting:!0,cell:({row:e})=>(0,t.jsx)("span",{className:"text-xs",children:e.original.created_at?new Date(e.original.created_at).toLocaleDateString():"-"})},{header:"Updated At",accessorKey:"updated_at",enableSorting:!1,cell:({row:e})=>(0,t.jsx)("span",{className:"text-xs",children:e.original.updated_at?new Date(e.original.updated_at).toLocaleDateString():"-"})},{id:"actions",header:"Actions",enableSorting:!1,cell:({row:e})=>(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(C.Tooltip,{title:"Edit user details",children:(0,t.jsx)(et.Icon,{icon:es.PencilAltIcon,size:"sm",onClick:()=>a(e.original.user_id,!0),className:"cursor-pointer hover:text-blue-600"})}),(0,t.jsx)(C.Tooltip,{title:"Delete user",children:(0,t.jsx)(et.Icon,{icon:el.TrashIcon,size:"sm",onClick:()=>l(e.original),className:"cursor-pointer hover:text-red-600"})}),(0,t.jsx)(C.Tooltip,{title:"Reset Password",children:(0,t.jsx)(et.Icon,{icon:ea.RefreshIcon,size:"sm",onClick:()=>r(e.original.user_id),className:"cursor-pointer hover:text-green-600"})})]})}];if(n){let{onSelectUser:e,onSelectAll:s,isUserSelected:l,isAllSelected:r,isIndeterminate:a}=n;return[{id:"select",enableSorting:!1,header:()=>(0,t.jsx)(b.Checkbox,{indeterminate:a,checked:r,onChange:e=>s(e.target.checked),onClick:e=>e.stopPropagation()}),cell:({row:s})=>(0,t.jsx)(b.Checkbox,{checked:l(s.original),onChange:t=>e(s.original,t.target.checked),onClick:e=>e.stopPropagation()})},...i]}return i};var ei=e.i(152990),ed=e.i(682830),eo=e.i(269200),ec=e.i(427612),eu=e.i(64848),em=e.i(942232),eh=e.i(496020),ex=e.i(977572),eg=e.i(206929),ef=e.i(94629),ep=e.i(360820),eb=e.i(871943),ej=e.i(981339),ev=e.i(530212),ey=e.i(118366),e_=e.i(678784);function eS({userId:e,onClose:o,accessToken:c,userRole:u,onDelete:m,possibleUIRoles:h,initialTab:x=0,startInEditMode:g=!1}){let[f,p]=(0,i.useState)(null),[b,v]=(0,i.useState)([]),[_,S]=(0,i.useState)(!1),[N,w]=(0,i.useState)(!1),[C,I]=(0,i.useState)(!0),[E,B]=(0,i.useState)(g),[F,M]=(0,i.useState)([]),[L,D]=(0,i.useState)(!1),[P,z]=(0,i.useState)(null),[V,G]=(0,i.useState)(null),[W,J]=(0,i.useState)(x),[Q,Z]=(0,i.useState)({}),[Y,et]=(0,i.useState)(!1);i.default.useEffect(()=>{G((0,j.getProxyBaseUrl)())},[]),i.default.useEffect(()=>{console.log(`userId: ${e}, userRole: ${u}, accessToken: ${c}`),(async()=>{try{if(!c)return;let t=await (0,j.userGetInfoV2)(c,e);if(p(t),t.teams&&t.teams.length>0)try{let e=t.teams.map(async e=>{try{let t=await (0,j.teamInfoCall)(c,e);return{team_id:e,team_alias:t?.team_alias||null}}catch{return{team_id:e,team_alias:null}}}),s=await Promise.all(e);v(s)}catch{v(t.teams.map(e=>({team_id:e,team_alias:null})))}let s=(await (0,j.modelAvailableCall)(c,e,u||"")).data.map(e=>e.id);M(s)}catch(e){console.error("Error fetching user data:",e),R.default.fromBackend("Failed to fetch user data")}finally{I(!1)}})()},[c,e,u]);let es=async()=>{if(!c)return void R.default.fromBackend("Access token not found");try{R.default.success("Generating password reset link...");let t=await (0,j.invitationCreateCall)(c,e);z(t),D(!0)}catch(e){R.default.fromBackend("Failed to generate password reset link")}},er=async()=>{try{if(!c)return;w(!0),await (0,j.userDeleteCall)(c,[e]),R.default.success("User deleted successfully"),m&&m(),o()}catch(e){console.error("Error deleting user:",e),R.default.fromBackend("Failed to delete user")}finally{S(!1),w(!1)}},en=async e=>{try{if(!c||!f)return;await (0,j.userUpdateUserCall)(c,e,null),p({...f,user_email:e.user_email??f.user_email,user_alias:e.user_alias??f.user_alias,models:e.models??f.models,max_budget:e.max_budget??f.max_budget,budget_duration:e.budget_duration??f.budget_duration,metadata:e.metadata??f.metadata}),R.default.success("User updated successfully"),B(!1)}catch(e){console.error("Error updating user:",e),R.default.fromBackend("Failed to update user")}};if(C)return(0,t.jsxs)("div",{className:"p-4",children:[(0,t.jsx)(y.Button,{icon:ev.ArrowLeftIcon,variant:"light",onClick:o,className:"mb-4",children:"Back to Users"}),(0,t.jsx)(H.Text,{children:"Loading user data..."})]});if(!f)return(0,t.jsxs)("div",{className:"p-4",children:[(0,t.jsx)(y.Button,{icon:ev.ArrowLeftIcon,variant:"light",onClick:o,className:"mb-4",children:"Back to Users"}),(0,t.jsx)(H.Text,{children:"User not found"})]});let ei=async(e,t)=>{await (0,O.copyToClipboard)(e)&&(Z(e=>({...e,[t]:!0})),setTimeout(()=>{Z(e=>({...e,[t]:!1}))},2e3))},ed={user_id:f.user_id,user_info:{user_email:f.user_email,user_alias:f.user_alias,user_role:f.user_role,models:f.models,max_budget:f.max_budget,budget_duration:f.budget_duration,metadata:f.metadata}};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)(y.Button,{icon:ev.ArrowLeftIcon,variant:"light",onClick:o,className:"mb-4",children:"Back to Users"}),(0,t.jsx)(q.Title,{children:f.user_email||"User"}),(0,t.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,t.jsx)(H.Text,{className:"text-gray-500 font-mono",children:f.user_id}),(0,t.jsx)(d.Button,{type:"text",size:"small",icon:Q["user-id"]?(0,t.jsx)(e_.CheckIcon,{size:12}):(0,t.jsx)(ey.CopyIcon,{size:12}),onClick:()=>ei(f.user_id,"user-id"),className:`left-2 z-10 transition-all duration-200 ${Q["user-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100"}`})]})]}),u&&T.rolesWithWriteAccess.includes(u)&&(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)(y.Button,{icon:ea.RefreshIcon,variant:"secondary",onClick:es,className:"flex items-center",children:"Reset Password"}),(0,t.jsx)(y.Button,{icon:el.TrashIcon,variant:"secondary",onClick:()=>S(!0),className:"flex items-center text-red-500 border-red-500 hover:text-red-600 hover:border-red-600",children:"Delete User"})]})]}),(0,t.jsx)($.default,{isOpen:_,title:"Delete User?",message:"Are you sure you want to delete this user? This action cannot be undone.",resourceInformationTitle:"User Information",resourceInformation:[{label:"Email",value:f.user_email},{label:"User ID",value:f.user_id,code:!0},{label:"Global Proxy Role",value:f.user_role&&h?.[f.user_role]?.ui_label||f.user_role||"-"},{label:"Total Spend (USD)",value:null!==f.spend&&void 0!==f.spend?f.spend.toFixed(2):void 0}],onCancel:()=>{S(!1)},onOk:er,confirmLoading:N}),(0,t.jsxs)(l.TabGroup,{defaultIndex:W,onIndexChange:J,children:[(0,t.jsxs)(r.TabList,{className:"mb-4",children:[(0,t.jsx)(s.Tab,{children:"Overview"}),(0,t.jsx)(s.Tab,{children:"Details"})]}),(0,t.jsxs)(n.TabPanels,{children:[(0,t.jsx)(a.TabPanel,{children:(0,t.jsxs)(ee.Grid,{numItems:1,numItemsSm:2,numItemsLg:3,className:"gap-6",children:[(0,t.jsxs)(K.Card,{children:[(0,t.jsx)(H.Text,{children:"Spend"}),(0,t.jsxs)("div",{className:"mt-2",children:[(0,t.jsxs)(q.Title,{children:["$",(0,O.formatNumberWithCommas)(f.spend||0,4)]}),(0,t.jsxs)(H.Text,{children:["of"," ",null!==f.max_budget?`$${(0,O.formatNumberWithCommas)(f.max_budget,4)}`:"Unlimited"]})]})]}),(0,t.jsxs)(K.Card,{children:[(0,t.jsx)(H.Text,{children:"Teams"}),(0,t.jsx)("div",{className:"mt-2",children:b.length>0?(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[b.slice(0,Y?b.length:20).map((e,s)=>(0,t.jsx)(X.Badge,{color:"blue",title:e.team_alias||e.team_id,children:e.team_alias||e.team_id},s)),!Y&&b.length>20&&(0,t.jsxs)(X.Badge,{color:"gray",className:"cursor-pointer hover:bg-gray-200 transition-colors",onClick:()=>et(!0),children:["+",b.length-20," more"]}),Y&&b.length>20&&(0,t.jsx)(X.Badge,{color:"gray",className:"cursor-pointer hover:bg-gray-200 transition-colors",onClick:()=>et(!1),children:"Show Less"})]}):(0,t.jsx)(H.Text,{children:"No teams"})})]}),(0,t.jsxs)(K.Card,{children:[(0,t.jsx)(H.Text,{children:"Personal Models"}),(0,t.jsx)("div",{className:"mt-2",children:f.models?.length&&f.models?.length>0?f.models?.map((e,s)=>(0,t.jsx)(H.Text,{children:e},s)):(0,t.jsx)(H.Text,{children:"All proxy models"})})]})]})}),(0,t.jsx)(a.TabPanel,{children:(0,t.jsxs)(K.Card,{children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,t.jsx)(q.Title,{children:"User Settings"}),!E&&u&&T.rolesWithWriteAccess.includes(u)&&(0,t.jsx)(y.Button,{onClick:()=>B(!0),children:"Edit Settings"})]}),E&&f?(0,t.jsx)(U,{userData:ed,onCancel:()=>B(!1),onSubmit:en,teams:b,accessToken:c,userID:e,userRole:u,userModels:F,possibleUIRoles:h}):(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(H.Text,{className:"font-medium",children:"User ID"}),(0,t.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,t.jsx)(H.Text,{className:"font-mono",children:f.user_id}),(0,t.jsx)(d.Button,{type:"text",size:"small",icon:Q["user-id"]?(0,t.jsx)(e_.CheckIcon,{size:12}):(0,t.jsx)(ey.CopyIcon,{size:12}),onClick:()=>ei(f.user_id,"user-id"),className:`left-2 z-10 transition-all duration-200 ${Q["user-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100"}`})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(H.Text,{className:"font-medium",children:"Email"}),(0,t.jsx)(H.Text,{children:f.user_email||"Not Set"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(H.Text,{className:"font-medium",children:"User Alias"}),(0,t.jsx)(H.Text,{children:f.user_alias||"Not Set"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(H.Text,{className:"font-medium",children:"Global Proxy Role"}),(0,t.jsx)(H.Text,{children:f.user_role||"Not Set"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(H.Text,{className:"font-medium",children:"Created"}),(0,t.jsx)(H.Text,{children:f.created_at?new Date(f.created_at).toLocaleString():"Unknown"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(H.Text,{className:"font-medium",children:"Last Updated"}),(0,t.jsx)(H.Text,{children:f.updated_at?new Date(f.updated_at).toLocaleString():"Unknown"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(H.Text,{className:"font-medium",children:"Teams"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:b.length>0?(0,t.jsxs)(t.Fragment,{children:[b.slice(0,Y?b.length:20).map((e,s)=>(0,t.jsx)("span",{className:"px-2 py-1 bg-blue-100 rounded text-xs",title:e.team_alias||e.team_id,children:e.team_alias||e.team_id},s)),!Y&&b.length>20&&(0,t.jsxs)("span",{className:"px-2 py-1 bg-gray-100 rounded text-xs cursor-pointer hover:bg-gray-200 transition-colors",onClick:()=>et(!0),children:["+",b.length-20," more"]}),Y&&b.length>20&&(0,t.jsx)("span",{className:"px-2 py-1 bg-gray-100 rounded text-xs cursor-pointer hover:bg-gray-200 transition-colors",onClick:()=>et(!1),children:"Show Less"})]}):(0,t.jsx)(H.Text,{children:"No teams"})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(H.Text,{className:"font-medium",children:"Personal Models"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:f.models?.length&&f.models?.length>0?f.models?.map((e,s)=>(0,t.jsx)("span",{className:"px-2 py-1 bg-blue-100 rounded text-xs",children:e},s)):(0,t.jsx)(H.Text,{children:"All proxy models"})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(H.Text,{className:"font-medium",children:"Max Budget"}),(0,t.jsx)(H.Text,{children:null!==f.max_budget&&void 0!==f.max_budget?`$${(0,O.formatNumberWithCommas)(f.max_budget,4)}`:"Unlimited"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(H.Text,{className:"font-medium",children:"Budget Reset"}),(0,t.jsx)(H.Text,{children:(0,k.getBudgetDurationLabel)(f.budget_duration??null)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(H.Text,{className:"font-medium",children:"Metadata"}),(0,t.jsx)("pre",{className:"bg-gray-100 p-2 rounded text-xs overflow-auto mt-1",children:JSON.stringify(f.metadata||{},null,2)})]})]})]})})]})]}),(0,t.jsx)(A.default,{isInvitationLinkModalVisible:L,setIsInvitationLinkModalVisible:D,baseUrl:V||"",invitationLinkData:P,modalType:"resetPassword"})]})}var eN=e.i(655913),ew=e.i(38419),eC=e.i(78334),eT=e.i(555436),ek=e.i(284614);let eI=(0,e.i(475254).default)("circle-user-round",[["path",{d:"M18 20a6 6 0 0 0-12 0",key:"1qehca"}],["circle",{cx:"12",cy:"10",r:"4",key:"1h16sb"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);function eE({data:e=[],columns:s,isLoading:l=!1,onSortChange:r,currentSort:a,accessToken:n,userRole:d,possibleUIRoles:o,handleEdit:c,handleDelete:u,handleResetPassword:m,selectedUsers:h=[],onSelectionChange:x,enableSelection:g=!1,filters:f,updateFilters:p,initialFilters:b,teams:j,userListResponse:v,currentPage:y,handlePageChange:S}){let[N,w]=i.default.useState([{id:a?.sortBy||"created_at",desc:a?.sortOrder==="desc"}]),[C,T]=i.default.useState(null),[k,I]=i.default.useState(!1),[E,U]=i.default.useState(!1),R=(e,t=!1)=>{T(e),I(t)},B=(e,t)=>{x&&(t?x([...h,e]):x(h.filter(t=>t.user_id!==e.user_id)))},F=t=>{x&&(t?x(e):x([]))},M=e=>h.some(t=>t.user_id===e.user_id),L=e.length>0&&h.length===e.length,D=h.length>0&&h.lengtho?en(o,c,u,m,R,g?{selectedUsers:h,onSelectUser:B,onSelectAll:F,isUserSelected:M,isAllSelected:L,isIndeterminate:D}:void 0):s,[o,c,u,m,R,s,g,h,L,D]),O=(0,ei.useReactTable)({data:e,columns:A,state:{sorting:N},onSortingChange:e=>{let t="function"==typeof e?e(N):e;if(w(t),t&&Array.isArray(t)&&t.length>0&&t[0]){let e=t[0];if(e.id){let t=e.id,s=e.desc?"desc":"asc";r?.(t,s)}}else r?.("created_at","desc")},getCoreRowModel:(0,ed.getCoreRowModel)(),manualSorting:!0,enableSorting:!0});return(i.default.useEffect(()=>{a&&w([{id:a.sortBy,desc:"desc"===a.sortOrder}])},[a]),C)?(0,t.jsx)(eS,{userId:C,onClose:()=>{T(null),I(!1)},accessToken:n,userRole:d,possibleUIRoles:o,initialTab:+!!k,startInEditMode:k}):(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow",children:[(0,t.jsx)("div",{className:"border-b px-6 py-4",children:(0,t.jsxs)("div",{className:"flex flex-col space-y-4",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,t.jsx)(eN.FilterInput,{placeholder:"Search by email...",value:f.email,onChange:e=>p({email:e}),icon:eT.Search}),(0,t.jsx)(ew.FiltersButton,{onClick:()=>U(!E),active:E,hasActiveFilters:!!(f.user_id||f.user_role||f.team)}),(0,t.jsx)(eC.ResetFiltersButton,{onClick:()=>{p(b)}})]}),E&&(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-3 mt-3",children:[(0,t.jsx)(eN.FilterInput,{placeholder:"Filter by User ID",value:f.user_id,onChange:e=>p({user_id:e}),icon:ek.User}),(0,t.jsx)(eN.FilterInput,{placeholder:"Filter by SSO ID",value:f.sso_user_id,onChange:e=>p({sso_user_id:e}),icon:eI}),(0,t.jsx)("div",{className:"w-64",children:(0,t.jsx)(eg.Select,{value:f.user_role,onValueChange:e=>p({user_role:e}),placeholder:"Select Role",children:o&&Object.entries(o).map(([e,s])=>(0,t.jsx)(_.SelectItem,{value:e,children:s.ui_label},e))})}),(0,t.jsx)("div",{className:"w-64",children:(0,t.jsx)(eg.Select,{value:f.team,onValueChange:e=>p({team:e}),placeholder:"Select Team",children:j?.map(e=>(0,t.jsx)(_.SelectItem,{value:e.team_id,children:e.team_alias||e.team_id},e.team_id))})})]}),(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[l?(0,t.jsx)(ej.Skeleton.Input,{active:!0,style:{width:192,height:20}}):(0,t.jsxs)("span",{className:"text-sm text-gray-700",children:["Showing"," ",v&&v.users&&v.users.length>0?(v.page-1)*v.page_size+1:0," ","-"," ",v&&v.users?Math.min(v.page*v.page_size,v.total):0," ","of ",v?v.total:0," results"]}),(0,t.jsx)("div",{className:"flex space-x-2",children:l?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(ej.Skeleton.Button,{active:!0,size:"small",style:{width:80,height:30}}),(0,t.jsx)(ej.Skeleton.Button,{active:!0,size:"small",style:{width:60,height:30}})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("button",{onClick:()=>S(y-1),disabled:1===y,className:`px-3 py-1 text-sm border rounded-md ${1===y?"bg-gray-100 text-gray-400 cursor-not-allowed":"hover:bg-gray-50"}`,children:"Previous"}),(0,t.jsx)("button",{onClick:()=>S(y+1),disabled:!v||y>=v.total_pages,className:`px-3 py-1 text-sm border rounded-md ${!v||y>=v.total_pages?"bg-gray-100 text-gray-400 cursor-not-allowed":"hover:bg-gray-50"}`,children:"Next"})]})})]})]})}),(0,t.jsx)("div",{className:"overflow-auto",children:(0,t.jsx)("div",{className:"rounded-lg custom-border relative",children:(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)(eo.Table,{className:"[&_td]:py-0.5 [&_th]:py-1",children:[(0,t.jsx)(ec.TableHead,{children:O.getHeaderGroups().map(e=>(0,t.jsx)(eh.TableRow,{children:e.headers.map(e=>(0,t.jsx)(eu.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)]":""} ${e.column.getCanSort()?"cursor-pointer hover:bg-gray-50":""}`,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,ei.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)(ep.ChevronUpIcon,{className:"h-4 w-4 text-blue-500"}),desc:(0,t.jsx)(eb.ChevronDownIcon,{className:"h-4 w-4 text-blue-500"})})[e.column.getIsSorted()]:(0,t.jsx)(ef.SwitchVerticalIcon,{className:"h-4 w-4 text-gray-400"})})]})},e.id))},e.id))}),(0,t.jsx)(em.TableBody,{children:l?(0,t.jsx)(eh.TableRow,{children:(0,t.jsx)(ex.TableCell,{colSpan:A.length,className:"h-8 text-center",children:(0,t.jsx)("div",{className:"text-center text-gray-500",children:(0,t.jsx)("p",{children:"🚅 Loading users..."})})})}):e.length>0?O.getRowModel().rows.map(e=>(0,t.jsx)(eh.TableRow,{className:"h-8",children:e.getVisibleCells().map(e=>(0,t.jsx)(ex.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)]":""}`,onClick:()=>{"user_id"===e.column.id&&R(e.getValue(),!1)},style:{cursor:"user_id"===e.column.id?"pointer":"default",color:"user_id"===e.column.id?"#3b82f6":"inherit"},children:(0,ei.flexRender)(e.column.columnDef.cell,e.getContext())},e.id))},e.id)):(0,t.jsx)(eh.TableRow,{children:(0,t.jsx)(ex.TableCell,{colSpan:A.length,className:"h-8 text-center",children:(0,t.jsx)("div",{className:"text-center text-gray-500",children:(0,t.jsx)("p",{children:"No users found"})})})})})]})})})})]})}let{Text:eU,Title:eR}=c.Typography,eB={email:"",user_id:"",user_role:"",sso_user_id:"",team:"",model:"",min_spend:null,max_spend:null,sort_by:"created_at",sort_order:"desc"};e.s(["default",0,({accessToken:e,token:o,userRole:c,userID:u,teams:m,orgAdminOrgIds:h})=>{let x=!!c&&(0,T.isProxyAdminRole)(c),g=(0,V.useQueryClient)(),[f,p]=(0,i.useState)(1),[b,v]=(0,i.useState)(!1),[y,_]=(0,i.useState)(null),[S,N]=(0,i.useState)(!1),[w,C]=(0,i.useState)(!1),[k,I]=(0,i.useState)(null),[E,U]=(0,i.useState)("users"),[B,F]=(0,i.useState)(eB),[K,q,H]=(0,P.useDebouncedState)(B,{wait:300}),[G,W]=(0,i.useState)(!1),[J,Q]=(0,i.useState)(null),[Z,X]=(0,i.useState)(null),[ee,et]=(0,i.useState)([]),[es,el]=(0,i.useState)(!1),[er,ea]=(0,i.useState)(!1),[ei,ed]=(0,i.useState)([]),eo=e=>{I(e),N(!0)};(0,i.useEffect)(()=>()=>{H.cancel()},[H]),(0,i.useEffect)(()=>{X((0,j.getProxyBaseUrl)())},[]),(0,i.useEffect)(()=>{(async()=>{try{if(!u||!c||!e)return;let t=(await (0,j.modelAvailableCall)(e,u,c)).data.map(e=>e.id);console.log("available_model_names:",t),ed(t)}catch(e){console.error("Error fetching user models:",e)}})()},[e,u,c]);let ec=e=>{F(t=>{let s={...t,...e};return q(s),s})},eu=(e,t)=>{ec({sort_by:e,sort_order:t})},em=async t=>{if(!e)return void R.default.fromBackend("Access token not found");try{R.default.success("Generating password reset link...");let s=await (0,j.invitationCreateCall)(e,t);Q(s),W(!0)}catch(e){R.default.fromBackend("Failed to generate password reset link")}},eh=async()=>{if(k&&e)try{C(!0),await (0,j.userDeleteCall)(e,[k.user_id]),g.setQueriesData({queryKey:["userList"]},e=>{if(void 0===e)return e;let t=e.users.filter(e=>e.user_id!==k.user_id);return{...e,users:t}}),R.default.success("User deleted successfully")}catch(e){console.error("Error deleting user:",e),R.default.fromBackend("Failed to delete user")}finally{N(!1),I(null),C(!1)}},ex=async()=>{_(null),v(!1)},eg=async t=>{if(console.log("inside handleEditSubmit:",t),e&&o&&c&&u){try{let s=await (0,j.userUpdateUserCall)(e,t,null);g.setQueriesData({queryKey:["userList"]},e=>{if(void 0===e)return e;let t=e.users.map(e=>e.user_id===s.data.user_id?(0,O.updateExistingKeys)(e,s.data):e);return{...e,users:t}}),R.default.success(`User ${t.user_id} updated successfully`)}catch(e){console.error("There was an error updating the user",e)}_(null),v(!1)}},ef=async e=>{p(e)},ep=e=>{et(e)},eb=(0,z.useQuery)({queryKey:["userList",{debouncedFilter:K,currentPage:f,orgAdminOrgIds:h}],queryFn:async()=>{if(!e)throw Error("Access token required");return await (0,j.userListCall)(e,K.user_id?[K.user_id]:null,f,25,K.email||null,K.user_role||null,K.team||null,K.sso_user_id||null,K.sort_by,K.sort_order,h?h.map(e=>e.organization_id):null)},enabled:!!(e&&o&&c&&u),placeholderData:e=>e}),ev=eb.data,ey=(0,z.useQuery)({queryKey:["userRoles"],initialData:()=>({}),queryFn:async()=>{if(!e)throw Error("Access token required");return await (0,j.getPossibleUserRoles)(e)},enabled:!!(e&&o&&c&&u)}).data,e_=en(ey,e=>{_(e),v(!0)},eo,em,()=>{});return(0,t.jsxs)("div",{className:"w-full p-8 overflow-hidden",children:[(0,t.jsx)("div",{className:"flex items-center justify-between mb-4",children:(0,t.jsx)("div",{className:"flex space-x-3",children:eb.isLoading?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(ej.Skeleton.Button,{active:!0,size:"default",shape:"default",style:{width:110,height:36}}),(0,t.jsx)(ej.Skeleton.Button,{active:!0,size:"default",shape:"default",style:{width:145,height:36}}),(0,t.jsx)(ej.Skeleton.Button,{active:!0,size:"default",shape:"default",style:{width:110,height:36}})]}):u&&e?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(L.CreateUserButton,{userID:u,accessToken:e,teams:m,possibleUIRoles:ey}),x&&(0,t.jsx)(d.Button,{onClick:()=>{ea(!er),et([])},type:er?"primary":"default",className:"flex items-center",children:er?"Cancel Selection":"Select Users"}),x&&er&&(0,t.jsxs)(d.Button,{type:"primary",onClick:()=>{0===ee.length?R.default.fromBackend("Please select users to edit"):el(!0)},disabled:0===ee.length,className:"flex items-center",children:["Bulk Edit (",ee.length," selected)"]})]}):null})}),x?(0,t.jsxs)(l.TabGroup,{defaultIndex:0,onIndexChange:e=>U(0===e?"users":"settings"),children:[(0,t.jsxs)(r.TabList,{className:"mb-4",children:[(0,t.jsx)(s.Tab,{children:"Users"}),(0,t.jsx)(s.Tab,{children:"Default User Settings"})]}),(0,t.jsxs)(n.TabPanels,{children:[(0,t.jsx)(a.TabPanel,{children:(0,t.jsx)(eE,{data:eb.data?.users||[],columns:e_,isLoading:eb.isLoading,accessToken:e,userRole:c,onSortChange:eu,currentSort:{sortBy:B.sort_by,sortOrder:B.sort_order},possibleUIRoles:ey,handleEdit:e=>{_(e),v(!0)},handleDelete:eo,handleResetPassword:em,enableSelection:er,selectedUsers:ee,onSelectionChange:ep,filters:B,updateFilters:ec,initialFilters:eB,teams:m,userListResponse:ev,currentPage:f,handlePageChange:ef})}),(0,t.jsx)(a.TabPanel,{children:u&&c&&e?(0,t.jsx)(Y,{accessToken:e,possibleUIRoles:ey,userID:u,userRole:c}):(0,t.jsx)("div",{className:"flex justify-center items-center h-64",children:(0,t.jsx)(ej.Skeleton,{active:!0,paragraph:{rows:4}})})})]})]}):(0,t.jsx)(eE,{data:eb.data?.users||[],columns:e_,isLoading:eb.isLoading,accessToken:e,userRole:c,onSortChange:eu,currentSort:{sortBy:B.sort_by,sortOrder:B.sort_order},possibleUIRoles:ey,handleEdit:e=>{_(e),v(!0)},handleDelete:eo,handleResetPassword:em,enableSelection:!1,selectedUsers:[],onSelectionChange:ep,filters:B,updateFilters:ec,initialFilters:eB,teams:m,userListResponse:ev,currentPage:f,handlePageChange:ef}),(0,t.jsx)(D,{visible:b,possibleUIRoles:ey,onCancel:ex,user:y,onSubmit:eg}),(0,t.jsx)($.default,{isOpen:S,title:"Delete User?",message:"Are you sure you want to delete this user? This action cannot be undone.",resourceInformationTitle:"User Information",resourceInformation:[{label:"Email",value:k?.user_email},{label:"User ID",value:k?.user_id,code:!0},{label:"Global Proxy Role",value:k&&ey?.[k.user_role]?.ui_label||k?.user_role||"-"},{label:"Total Spend (USD)",value:k?.spend?.toFixed(2)}],onCancel:()=>{N(!1),I(null)},onOk:eh,confirmLoading:w}),(0,t.jsx)(A.default,{isInvitationLinkModalVisible:G,setIsInvitationLinkModalVisible:W,baseUrl:Z||"",invitationLinkData:J,modalType:"resetPassword"}),(0,t.jsx)(M,{open:es,onCancel:()=>el(!1),selectedUsers:ee,possibleUIRoles:ey,accessToken:e,onSuccess:()=>{g.invalidateQueries({queryKey:["userList"]}),et([]),ea(!1)},teams:m,userRole:c,userModels:ei,allowAllUsers:!!c&&(0,T.isAdminRole)(c)})]})}],910119)}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/0b06d056425a991f.js b/litellm/proxy/_experimental/out/_next/static/chunks/2bacff998dbae5da.js similarity index 56% rename from litellm/proxy/_experimental/out/_next/static/chunks/0b06d056425a991f.js rename to litellm/proxy/_experimental/out/_next/static/chunks/2bacff998dbae5da.js index c05203719b..3f1702793c 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/0b06d056425a991f.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/2bacff998dbae5da.js @@ -1,7 +1,7 @@ -(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,270345,e=>{"use strict";var t=e.i(764205);let r=async(e,r,a,l)=>"Admin"!=a&&"Admin Viewer"!=a?await (0,t.teamListCall)(e,l?.organization_id||null,r):await (0,t.teamListCall)(e,l?.organization_id||null);e.s(["fetchTeams",0,r])},519756,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:"M400 317.7h73.9V656c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V317.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 163a8 8 0 00-12.6 0l-112 141.7c-4.1 5.3-.4 13 6.3 13zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"}}]},name:"upload",theme:"outlined"};var l=e.i(9583),n=r.forwardRef(function(e,n){return r.createElement(l.default,(0,t.default)({},e,{ref:n,icon:a}))});e.s(["UploadOutlined",0,n],519756)},981339,e=>{"use strict";var t=e.i(185793);e.s(["Skeleton",()=>t.default])},500330,e=>{"use strict";var t=e.i(727749);function r(e,t){let r=structuredClone(e);for(let[e,a]of Object.entries(t))e in r&&(r[e]=a);return r}let a=(e,t=0,r=!1,a=!0)=>{if(null==e||!Number.isFinite(e)||0===e&&!a)return"-";let l={minimumFractionDigits:t,maximumFractionDigits:t};if(!r)return e.toLocaleString("en-US",l);let n=e<0?"-":"",s=Math.abs(e),o=s,i="";return s>=1e6?(o=s/1e6,i="M"):s>=1e3&&(o=s/1e3,i="K"),`${n}${o.toLocaleString("en-US",l)}${i}`},l=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 a=document.createElement("textarea");a.value=e,a.style.position="fixed",a.style.left="-999999px",a.style.top="-999999px",a.setAttribute("readonly",""),document.body.appendChild(a),a.focus(),a.select();let l=document.execCommand("copy");if(document.body.removeChild(a),l)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,l,"formatNumberWithCommas",0,a,"getSpendString",0,(e,t=6)=>{if(null==e||!Number.isFinite(e)||0===e)return"-";let r=a(e,t,!1,!1);if(0===Number(r.replace(/,/g,""))){let e=(1/10**t).toFixed(t);return`< $${e}`}return`$${r}`},"updateExistingKeys",()=>r])},743151,(e,t,r)=>{"use strict";function a(e){return(a="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 l=o(e.r(271645)),n=o(e.r(844343)),s=["text","onCopy","options","children"];function o(e){return e&&e.__esModule?e:{default:e}}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,a)}return r}function c(e){for(var t=1;t=0||(l[r]=e[r]);return l}(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(a=0;a=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(l[r]=e[r])}return l}(e,s),a=l.default.Children.only(t);return l.default.cloneElement(a,c(c({},r),{},{onClick:this.onClick}))}}],function(e,t){for(var r=0;r{"use strict";var a=e.r(743151).CopyToClipboard;a.CopyToClipboard=a,t.exports=a},109799,e=>{"use strict";var t=e.i(135214),r=e.i(764205),a=e.i(266027),l=e.i(912598);let n=(0,e.i(243652).createQueryKeys)("organizations");e.s(["useOrganization",0,e=>{let s=(0,l.useQueryClient)(),{accessToken:o}=(0,t.default)();return(0,a.useQuery)({queryKey:n.detail(e),enabled:!!(o&&e),queryFn:async()=>{if(!o||!e)throw Error("Missing auth or teamId");return(0,r.organizationInfoCall)(o,e)},initialData:()=>{if(!e)return;let t=s.getQueryData(n.list({}));return t?.find(t=>t.organization_id===e)}})},"useOrganizations",0,()=>{let{accessToken:e,userId:l,userRole:s}=(0,t.default)();return(0,a.useQuery)({queryKey:n.list({}),queryFn:async()=>await (0,r.organizationListCall)(e),enabled:!!(e&&l&&s)})}])},309426,e=>{"use strict";var t=e.i(290571),r=e.i(444755),a=e.i(673706),l=e.i(271645),n=e.i(46757);let s=(0,a.makeClassName)("Col"),o=l.default.forwardRef((e,a)=>{let o,i,c,d,{numColSpan:u=1,numColSpanSm:m,numColSpanMd:g,numColSpanLg:f,children:p,className:h}=e,x=(0,t.__rest)(e,["numColSpan","numColSpanSm","numColSpanMd","numColSpanLg","children","className"]),b=(e,t)=>e&&Object.keys(t).includes(String(e))?t[e]:"";return l.default.createElement("div",Object.assign({ref:a,className:(0,r.tremorTwMerge)(s("root"),(o=b(u,n.colSpan),i=b(m,n.colSpanSm),c=b(g,n.colSpanMd),d=b(f,n.colSpanLg),(0,r.tremorTwMerge)(o,i,c,d)),h)},x),p)});o.displayName="Col",e.s(["Col",()=>o],309426)},988297,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4v16m8-8H4"}))});e.s(["PlusIcon",0,r],988297)},797672,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"}))});e.s(["PencilIcon",0,r],797672)},992619,e=>{"use strict";var t=e.i(843476),r=e.i(271645),a=e.i(779241),l=e.i(599724),n=e.i(199133),s=e.i(983561),o=e.i(689020);e.s(["default",0,({accessToken:e,value:i,placeholder:c="Select a Model",onChange:d,disabled:u=!1,style:m,className:g,showLabel:f=!0,labelText:p="Select Model"})=>{let[h,x]=(0,r.useState)(i),[b,y]=(0,r.useState)(!1),[v,w]=(0,r.useState)([]),k=(0,r.useRef)(null);return(0,r.useEffect)(()=>{x(i)},[i]),(0,r.useEffect)(()=>{e&&(async()=>{try{let t=await (0,o.fetchAvailableModels)(e);console.log("Fetched models for selector:",t),t.length>0&&w(t)}catch(e){console.error("Error fetching model info:",e)}})()},[e]),(0,t.jsxs)("div",{children:[f&&(0,t.jsxs)(l.Text,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,t.jsx)(s.RobotOutlined,{className:"mr-2"})," ",p]}),(0,t.jsx)(n.Select,{value:h,placeholder:c,onChange:e=>{"custom"===e?(y(!0),x(void 0)):(y(!1),x(e),d&&d(e))},options:[...Array.from(new Set(v.map(e=>e.model_group))).map((e,t)=>({value:e,label:e,key:t})),{value:"custom",label:"Enter custom model",key:"custom"}],style:{width:"100%",...m},showSearch:!0,className:`rounded-md ${g||""}`,disabled:u}),b&&(0,t.jsx)(a.TextInput,{className:"mt-2",placeholder:"Enter custom model name",onValueChange:e=>{k.current&&clearTimeout(k.current),k.current=setTimeout(()=>{x(e),d&&d(e)},500)},disabled:u})]})}])},409797,e=>{"use strict";var t=e.i(631171);e.s(["ChevronDownIcon",()=>t.default])},91739,e=>{"use strict";var t=e.i(544195);e.s(["Radio",()=>t.default])},500727,696609,531516,e=>{"use strict";var t=e.i(266027),r=e.i(243652),a=e.i(764205),l=e.i(135214);let n=(0,r.createQueryKeys)("mcpServers");e.s(["useMCPServers",0,e=>{let{accessToken:r}=(0,l.default)();return(0,t.useQuery)({queryKey:n.list(e?{filters:{teamId:e}}:void 0),queryFn:async()=>await (0,a.fetchMCPServers)(r,e),enabled:!!r})}],500727);var s=e.i(843476),o=e.i(271645),i=e.i(536916),c=e.i(599724),d=e.i(409797),u=e.i(246349),u=u;let m=/\b(delete|remove|destroy|purge|drop|erase|unlink)\b/i,g=/\b(create|add|insert|new|post|submit|register|make|generate|write|upload)\b/i,f=/\b(update|edit|modify|change|patch|put|set|rename|move|transform)\b/i,p=/\b(get|read|list|fetch|search|find|query|retrieve|show|view|check|describe|info)\b/i;function h(e,t=""){let r=e.toLowerCase();if(p.test(r))return"read";if(m.test(r))return"delete";if(f.test(r))return"update";if(g.test(r))return"create";if(t){let e=t.toLowerCase();if(p.test(e))return"read";if(m.test(e))return"delete";if(f.test(e))return"update";if(g.test(e))return"create"}return"unknown"}function x(e){let t={read:[],create:[],update:[],delete:[],unknown:[]};for(let r of e)t[h(r.name,r.description)].push(r);return t}let b={read:{label:"Read",description:"Safe operations — fetch, list, search. No side effects.",risk:"low"},create:{label:"Create",description:"Add new resources — insert, upload, register.",risk:"medium"},update:{label:"Update",description:"Modify existing resources — edit, patch, rename.",risk:"medium"},delete:{label:"Delete",description:"Destructive operations — remove, purge, destroy.",risk:"high"},unknown:{label:"Other",description:"Operations that could not be automatically classified.",risk:"unknown"}};e.s(["CRUD_GROUP_META",0,b,"classifyToolOp",()=>h,"groupToolsByCrud",()=>x],696609);let y=["read","create","update","delete","unknown"],v={low:"bg-green-100 text-green-800",medium:"bg-yellow-100 text-yellow-800",high:"bg-red-100 text-red-800 font-semibold",unknown:"bg-gray-100 text-gray-700"},w={read:"border-green-200",create:"border-blue-200",update:"border-yellow-200",delete:"border-red-300",unknown:"border-gray-200"},k={read:"bg-green-50",create:"bg-blue-50",update:"bg-yellow-50",delete:"bg-red-50",unknown:"bg-gray-50"};e.s(["default",0,({tools:e,value:t,onChange:r,readOnly:a=!1,searchFilter:l=""})=>{let[n,m]=(0,o.useState)({read:!1,create:!1,update:!1,delete:!1,unknown:!0}),g=(0,o.useMemo)(()=>x(e),[e]),f=(0,o.useMemo)(()=>new Set(void 0===t?e.map(e=>e.name):t),[t,e]),p=e=>{if(a)return;let t=new Set(f);t.has(e)?t.delete(e):t.add(e),r(Array.from(t))};return 0===e.length?null:(0,s.jsx)("div",{className:"space-y-3",children:y.map(e=>{let t,o=g[e];if(0===o.length)return null;if(l){let e=l.toLowerCase();if(!o.some(t=>t.name.toLowerCase().includes(e)||(t.description??"").toLowerCase().includes(e)))return null}let h=b[e],x=(t=g[e]).length>0&&t.every(e=>f.has(e.name)),y=(e=>{let t=g[e];if(0===t.length)return!1;let r=t.filter(e=>f.has(e.name)).length;return r>0&&r{m(t=>({...t,[e]:!t[e]}))},children:[C?(0,s.jsx)(u.default,{className:"w-4 h-4 text-gray-500 flex-shrink-0"}):(0,s.jsx)(d.ChevronDownIcon,{className:"w-4 h-4 text-gray-500 flex-shrink-0"}),(0,s.jsx)("span",{className:"font-semibold text-gray-900 text-sm",children:h.label}),(0,s.jsx)("span",{className:`text-xs px-2 py-0.5 rounded-full ${v[h.risk]}`,children:"high"===h.risk?"High Risk":"medium"===h.risk?"Medium Risk":"low"===h.risk?"Safe":"Unclassified"}),(0,s.jsxs)("span",{className:"text-xs text-gray-500 ml-1",children:[o.filter(e=>f.has(e.name)).length,"/",o.length," allowed"]})]}),!a&&(0,s.jsxs)("div",{className:"flex items-center gap-2 ml-4",children:[(0,s.jsx)(c.Text,{className:"text-xs text-gray-500",children:x?"All on":y?"Partial":"All off"}),(0,s.jsx)(i.Checkbox,{checked:x,indeterminate:y,onChange:t=>((e,t)=>{if(a)return;let l=new Set(f);for(let r of g[e])t?l.add(r.name):l.delete(r.name);r(Array.from(l))})(e,t.target.checked),onClick:e=>e.stopPropagation()})]})]}),!C&&(0,s.jsx)("div",{className:"px-4 pt-2 pb-1 text-xs text-gray-500 bg-white border-b border-gray-100",children:h.description}),!C&&(0,s.jsx)("div",{className:"bg-white divide-y divide-gray-50",children:o.filter(e=>!l||e.name.toLowerCase().includes(l.toLowerCase())||(e.description??"").toLowerCase().includes(l.toLowerCase())).map(e=>{let t,r=(t=e.name,f.has(t));return(0,s.jsxs)("div",{className:`flex items-start gap-3 px-4 py-2.5 transition-colors hover:bg-gray-50 ${!a?"cursor-pointer":""} ${r?"":"opacity-60"}`,onClick:()=>p(e.name),children:[(0,s.jsx)(i.Checkbox,{checked:r,onChange:()=>p(e.name),disabled:a,onClick:e=>e.stopPropagation()}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsx)(c.Text,{className:"font-medium text-gray-900 text-sm",children:e.name}),e.description&&(0,s.jsx)(c.Text,{className:"text-xs text-gray-500 mt-0.5 leading-snug",children:e.description})]}),(0,s.jsx)("span",{className:`text-xs px-1.5 py-0.5 rounded flex-shrink-0 ${r?"bg-green-100 text-green-700":"bg-gray-100 text-gray-500"}`,children:r?"on":"off"})]},e.name)})})]},e)})})}],531516)},361653,e=>{"use strict";let t=(0,e.i(475254).default)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);e.s(["default",()=>t])},603908,e=>{"use strict";let t=(0,e.i(475254).default)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);e.s(["default",()=>t])},841947,e=>{"use strict";let t=(0,e.i(475254).default)("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);e.s(["default",()=>t])},793130,e=>{"use strict";var t=e.i(290571),r=e.i(429427),a=e.i(371330),l=e.i(271645),n=e.i(394487),s=e.i(503269),o=e.i(214520),i=e.i(746725),c=e.i(914189),d=e.i(144279),u=e.i(294316),m=e.i(601893),g=e.i(140721),f=e.i(942803),p=e.i(233538),h=e.i(694421),x=e.i(700020),b=e.i(35889),y=e.i(998348),v=e.i(722678);let w=(0,l.createContext)(null);w.displayName="GroupContext";let k=l.Fragment,C=Object.assign((0,x.forwardRefWithAs)(function(e,t){var k;let C=(0,l.useId)(),j=(0,f.useProvidedId)(),N=(0,m.useDisabled)(),{id:S=j||`headlessui-switch-${C}`,disabled:M=N||!1,checked:T,defaultChecked:O,onChange:E,name:P,value:$,form:_,autoFocus:R=!1,...L}=e,z=(0,l.useContext)(w),[B,D]=(0,l.useState)(null),F=(0,l.useRef)(null),I=(0,u.useSyncRefs)(F,t,null===z?null:z.setSwitch,D),A=(0,o.useDefaultValue)(O),[H,q]=(0,s.useControllable)(T,E,null!=A&&A),V=(0,i.useDisposables)(),[G,K]=(0,l.useState)(!1),X=(0,c.useEvent)(()=>{K(!0),null==q||q(!H),V.nextFrame(()=>{K(!1)})}),W=(0,c.useEvent)(e=>{if((0,p.isDisabledReactIssue7711)(e.currentTarget))return e.preventDefault();e.preventDefault(),X()}),U=(0,c.useEvent)(e=>{e.key===y.Keys.Space?(e.preventDefault(),X()):e.key===y.Keys.Enter&&(0,h.attemptSubmit)(e.currentTarget)}),Y=(0,c.useEvent)(e=>e.preventDefault()),Q=(0,v.useLabelledBy)(),J=(0,b.useDescribedBy)(),{isFocusVisible:Z,focusProps:ee}=(0,r.useFocusRing)({autoFocus:R}),{isHovered:et,hoverProps:er}=(0,a.useHover)({isDisabled:M}),{pressed:ea,pressProps:el}=(0,n.useActivePress)({disabled:M}),en=(0,l.useMemo)(()=>({checked:H,disabled:M,hover:et,focus:Z,active:ea,autofocus:R,changing:G}),[H,et,Z,ea,M,G,R]),es=(0,x.mergeProps)({id:S,ref:I,role:"switch",type:(0,d.useResolveButtonType)(e,B),tabIndex:-1===e.tabIndex?0:null!=(k=e.tabIndex)?k:0,"aria-checked":H,"aria-labelledby":Q,"aria-describedby":J,disabled:M||void 0,autoFocus:R,onClick:W,onKeyUp:U,onKeyPress:Y},ee,er,el),eo=(0,l.useCallback)(()=>{if(void 0!==A)return null==q?void 0:q(A)},[q,A]),ei=(0,x.useRender)();return l.default.createElement(l.default.Fragment,null,null!=P&&l.default.createElement(g.FormFields,{disabled:M,data:{[P]:$||"on"},overrides:{type:"checkbox",checked:H},form:_,onReset:eo}),ei({ourProps:es,theirProps:L,slot:en,defaultTag:"button",name:"Switch"}))}),{Group:function(e){var t;let[r,a]=(0,l.useState)(null),[n,s]=(0,v.useLabels)(),[o,i]=(0,b.useDescriptions)(),c=(0,l.useMemo)(()=>({switch:r,setSwitch:a}),[r,a]),d=(0,x.useRender)();return l.default.createElement(i,{name:"Switch.Description",value:o},l.default.createElement(s,{name:"Switch.Label",value:n,props:{htmlFor:null==(t=c.switch)?void 0:t.id,onClick(e){r&&(e.currentTarget instanceof HTMLLabelElement&&e.preventDefault(),r.click(),r.focus({preventScroll:!0}))}}},l.default.createElement(w.Provider,{value:c},d({ourProps:{},theirProps:e,slot:{},defaultTag:k,name:"Switch.Group"}))))},Label:v.Label,Description:b.Description});var j=e.i(888288),N=e.i(95779),S=e.i(444755),M=e.i(673706),T=e.i(829087);let O=(0,M.makeClassName)("Switch"),E=l.default.forwardRef((e,r)=>{let{checked:a,defaultChecked:n=!1,onChange:s,color:o,name:i,error:c,errorMessage:d,disabled:u,required:m,tooltip:g,id:f}=e,p=(0,t.__rest)(e,["checked","defaultChecked","onChange","color","name","error","errorMessage","disabled","required","tooltip","id"]),h={bgColor:o?(0,M.getColorClassNames)(o,N.colorPalette.background).bgColor:"bg-tremor-brand dark:bg-dark-tremor-brand",ringColor:o?(0,M.getColorClassNames)(o,N.colorPalette.ring).ringColor:"ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted"},[x,b]=(0,j.default)(n,a),[y,v]=(0,l.useState)(!1),{tooltipProps:w,getReferenceProps:k}=(0,T.useTooltip)(300);return l.default.createElement("div",{className:"flex flex-row items-center justify-start"},l.default.createElement(T.default,Object.assign({text:g},w)),l.default.createElement("div",Object.assign({ref:(0,M.mergeRefs)([r,w.refs.setReference]),className:(0,S.tremorTwMerge)(O("root"),"flex flex-row relative h-5")},p,k),l.default.createElement("input",{type:"checkbox",className:(0,S.tremorTwMerge)(O("input"),"absolute w-5 h-5 cursor-pointer left-0 top-0 opacity-0"),name:i,required:m,checked:x,onChange:e=>{e.preventDefault()}}),l.default.createElement(C,{checked:x,onChange:e=>{b(e),null==s||s(e)},disabled:u,className:(0,S.tremorTwMerge)(O("switch"),"w-10 h-5 group relative inline-flex shrink-0 cursor-pointer items-center justify-center rounded-tremor-full","focus:outline-none",u?"cursor-not-allowed":""),onFocus:()=>v(!0),onBlur:()=>v(!1),id:f},l.default.createElement("span",{className:(0,S.tremorTwMerge)(O("sr-only"),"sr-only")},"Switch ",x?"on":"off"),l.default.createElement("span",{"aria-hidden":"true",className:(0,S.tremorTwMerge)(O("background"),x?h.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")}),l.default.createElement("span",{"aria-hidden":"true",className:(0,S.tremorTwMerge)(O("round"),x?(0,S.tremorTwMerge)(h.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,S.tremorTwMerge)("ring-2",h.ringColor):"")}))),c&&d?l.default.createElement("p",{className:(0,S.tremorTwMerge)(O("errorMessage"),"text-sm text-red-500 mt-1 ")},d):null)});E.displayName="Switch",e.s(["Switch",()=>E],793130)},158392,419470,e=>{"use strict";var t=e.i(843476),r=e.i(779241);let a={ttl:3600,lowest_latency_buffer:0},l=({routingStrategyArgs:e})=>{let l={ttl:"Sliding window to look back over when calculating the average latency of a deployment. Default - 1 hour (in seconds).",lowest_latency_buffer:"Shuffle between deployments within this % of the lowest latency. Default - 0 (i.e. always pick lowest latency)."};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"max-w-3xl",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Latency-Based Configuration"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Fine-tune latency-based routing behavior"})]}),(0,t.jsx)("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2 xl:grid-cols-3",children:Object.entries(e||a).map(([e,a])=>(0,t.jsx)("div",{className:"space-y-2",children:(0,t.jsxs)("label",{className:"block",children:[(0,t.jsx)("span",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:e.replace(/_/g," ")}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-0.5 mb-2",children:l[e]||""}),(0,t.jsx)(r.TextInput,{name:e,defaultValue:"object"==typeof a?JSON.stringify(a,null,2):a?.toString(),className:"font-mono text-sm w-full"})]})},e))})]}),(0,t.jsx)("div",{className:"border-t border-gray-200"})]})},n=({routerSettings:e,routerFieldsMetadata:a})=>(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"max-w-3xl",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Reliability & Retries"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Configure retry logic and failure handling"})]}),(0,t.jsx)("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2 xl:grid-cols-3",children:Object.entries(e).filter(([e,t])=>"fallbacks"!=e&&"context_window_fallbacks"!=e&&"routing_strategy_args"!=e&&"routing_strategy"!=e&&"enable_tag_filtering"!=e).map(([e,l])=>(0,t.jsx)("div",{className:"space-y-2",children:(0,t.jsxs)("label",{className:"block",children:[(0,t.jsx)("span",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:a[e]?.ui_field_name||e}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-0.5 mb-2",children:a[e]?.field_description||""}),(0,t.jsx)(r.TextInput,{name:e,defaultValue:null==l||"null"===l?"":"object"==typeof l?JSON.stringify(l,null,2):l?.toString()||"",placeholder:"—",className:"font-mono text-sm w-full"})]})},e))})]});var s=e.i(199133);let o=({selectedStrategy:e,availableStrategies:r,routingStrategyDescriptions:a,routerFieldsMetadata:l,onStrategyChange:n})=>(0,t.jsxs)("div",{className:"space-y-2 max-w-3xl",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:l.routing_strategy?.ui_field_name||"Routing Strategy"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-0.5 mb-2",children:l.routing_strategy?.field_description||""})]}),(0,t.jsx)("div",{className:"routing-strategy-select max-w-3xl",children:(0,t.jsx)(s.Select,{value:e,onChange:n,style:{width:"100%"},size:"large",children:r.map(e=>(0,t.jsx)(s.Select.Option,{value:e,label:e,children:(0,t.jsxs)("div",{className:"flex flex-col gap-0.5 py-1",children:[(0,t.jsx)("span",{className:"font-mono text-sm font-medium",children:e}),a[e]&&(0,t.jsx)("span",{className:"text-xs text-gray-500 font-normal",children:a[e]})]})},e))})})]});var i=e.i(793130);let c=({enabled:e,routerFieldsMetadata:r,onToggle:a})=>(0,t.jsx)("div",{className:"space-y-3 max-w-3xl",children:(0,t.jsxs)("div",{className:"flex items-start justify-between",children:[(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)("label",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:r.enable_tag_filtering?.ui_field_name||"Enable Tag Filtering"}),(0,t.jsxs)("p",{className:"text-xs text-gray-500 mt-0.5",children:[r.enable_tag_filtering?.field_description||"",r.enable_tag_filtering?.link&&(0,t.jsxs)(t.Fragment,{children:[" ",(0,t.jsx)("a",{href:r.enable_tag_filtering.link,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-800 underline",children:"Learn more"})]})]})]}),(0,t.jsx)(i.Switch,{checked:e,onChange:a,className:"ml-4"})]})});e.s(["default",0,({value:e,onChange:r,routerFieldsMetadata:a,availableRoutingStrategies:s,routingStrategyDescriptions:i})=>(0,t.jsxs)("div",{className:"w-full space-y-8 py-2",children:[(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"max-w-3xl",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Routing Settings"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Configure how requests are routed to deployments"})]}),s.length>0&&(0,t.jsx)(o,{selectedStrategy:e.selectedStrategy||e.routerSettings.routing_strategy||null,availableStrategies:s,routingStrategyDescriptions:i,routerFieldsMetadata:a,onStrategyChange:t=>{r({...e,selectedStrategy:t})}}),(0,t.jsx)(c,{enabled:e.enableTagFiltering,routerFieldsMetadata:a,onToggle:t=>{r({...e,enableTagFiltering:t})}})]}),(0,t.jsx)("div",{className:"border-t border-gray-200"}),"latency-based-routing"===e.selectedStrategy&&(0,t.jsx)(l,{routingStrategyArgs:e.routerSettings.routing_strategy_args}),(0,t.jsx)(n,{routerSettings:e.routerSettings,routerFieldsMetadata:a})]})],158392);var d=e.i(994388),u=e.i(998573),m=e.i(653496),g=e.i(107233),f=e.i(271645),p=e.i(592968),h=e.i(361653),h=h;let x=(0,e.i(475254).default)("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);var b=e.i(37727);function y({group:e,onChange:r,availableModels:a,maxFallbacks:l}){let n=a.filter(t=>t!==e.primaryModel),o=e.fallbackModels.length{let a=[...e.fallbackModels];a.includes(t)&&(a=a.filter(e=>e!==t)),r({...e,primaryModel:t,fallbackModels:a})},showSearch:!0,filterOption:(e,t)=>(t?.label??"").toLowerCase().includes(e.toLowerCase()),options:a.map(e=>({label:e,value:e}))}),!e.primaryModel&&(0,t.jsxs)("div",{className:"mt-2 flex items-center gap-2 text-amber-600 text-xs bg-amber-50 p-2 rounded",children:[(0,t.jsx)(h.default,{className:"w-4 h-4"}),(0,t.jsx)("span",{children:"Select a model to begin configuring fallbacks"})]})]}),(0,t.jsx)("div",{className:"flex items-center justify-center -my-4 z-10",children:(0,t.jsxs)("div",{className:"bg-indigo-50 text-indigo-500 px-4 py-1 rounded-full text-xs font-bold border border-indigo-100 flex items-center gap-2 shadow-sm",children:[(0,t.jsx)(x,{className:"w-4 h-4"}),"IF FAILS, TRY..."]})}),(0,t.jsxs)("div",{className:`transition-opacity duration-300 ${!e.primaryModel?"opacity-50 pointer-events-none":"opacity-100"}`,children:[(0,t.jsxs)("label",{className:"block text-sm font-semibold text-gray-700 mb-2",children:["Fallback Chain ",(0,t.jsx)("span",{className:"text-red-500",children:"*"}),(0,t.jsxs)("span",{className:"text-xs text-gray-500 font-normal ml-2",children:["(Max ",l," fallbacks at a time)"]})]}),(0,t.jsxs)("div",{className:"bg-gray-50 rounded-xl p-4 border border-gray-200",children:[(0,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsx)(s.Select,{mode:"multiple",className:"w-full",size:"large",placeholder:o?"Select fallback models to add...":`Maximum ${l} fallbacks reached`,value:e.fallbackModels,onChange:t=>{let a=t.slice(0,l);r({...e,fallbackModels:a})},disabled:!e.primaryModel,options:n.map(e=>({label:e,value:e})),optionRender:(r,a)=>{let l=e.fallbackModels.includes(r.value),n=l?e.fallbackModels.indexOf(r.value)+1:null;return(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[l&&null!==n&&(0,t.jsx)("span",{className:"flex items-center justify-center w-5 h-5 rounded bg-indigo-100 text-indigo-600 text-xs font-bold",children:n}),(0,t.jsx)("span",{children:r.label})]})},maxTagCount:"responsive",maxTagPlaceholder:e=>(0,t.jsx)(p.Tooltip,{styles:{root:{pointerEvents:"none"}},title:e.map(({value:e})=>e).join(", "),children:(0,t.jsxs)("span",{children:["+",e.length," more"]})}),showSearch:!0,filterOption:(e,t)=>(t?.label??"").toLowerCase().includes(e.toLowerCase())}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1 ml-1",children:o?`Search and select multiple models. Selected models will appear below in order. (${e.fallbackModels.length}/${l} used)`:`Maximum ${l} fallbacks reached. Remove some to add more.`})]}),(0,t.jsx)("div",{className:"space-y-2 min-h-[100px]",children:0===e.fallbackModels.length?(0,t.jsxs)("div",{className:"h-32 border-2 border-dashed border-gray-300 rounded-lg flex flex-col items-center justify-center text-gray-400",children:[(0,t.jsx)("span",{className:"text-sm",children:"No fallback models selected"}),(0,t.jsx)("span",{className:"text-xs mt-1",children:"Add models from the dropdown above"})]}):e.fallbackModels.map((a,l)=>(0,t.jsxs)("div",{className:"group flex items-center justify-between p-3 bg-white rounded-lg border border-gray-200 hover:border-indigo-300 hover:shadow-sm transition-all",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"flex items-center justify-center w-6 h-6 rounded bg-gray-100 text-gray-400 group-hover:text-indigo-500 group-hover:bg-indigo-50",children:(0,t.jsx)("span",{className:"text-xs font-bold",children:l+1})}),(0,t.jsx)("div",{children:(0,t.jsx)("span",{className:"font-medium text-gray-800",children:a})})]}),(0,t.jsx)("button",{type:"button",onClick:()=>{let t;return t=e.fallbackModels.filter((e,t)=>t!==l),void r({...e,fallbackModels:t})},className:"opacity-0 group-hover:opacity-100 transition-opacity text-gray-400 hover:text-red-500 p-1",children:(0,t.jsx)(b.X,{className:"w-4 h-4"})})]},`${a}-${l}`))})]})]})]})}function v({groups:e,onGroupsChange:r,availableModels:a,maxFallbacks:l=10,maxGroups:n=5}){let[s,o]=(0,f.useState)(e.length>0?e[0].id:"1");(0,f.useEffect)(()=>{e.length>0?e.some(e=>e.id===s)||o(e[0].id):o("1")},[e]);let i=()=>{if(e.length>=n)return;let t=Date.now().toString();r([...e,{id:t,primaryModel:null,fallbackModels:[]}]),o(t)},c=t=>{r(e.map(e=>e.id===t.id?t:e))},p=e.map((r,n)=>{let s=r.primaryModel?r.primaryModel:`Group ${n+1}`;return{key:r.id,label:s,closable:e.length>1,children:(0,t.jsx)(y,{group:r,onChange:c,availableModels:a,maxFallbacks:l})}});return 0===e.length?(0,t.jsxs)("div",{className:"text-center py-12 bg-gray-50 rounded-lg border border-dashed border-gray-300",children:[(0,t.jsx)("p",{className:"text-gray-500 mb-4",children:"No fallback groups configured"}),(0,t.jsx)(d.Button,{variant:"primary",onClick:i,icon:()=>(0,t.jsx)(g.Plus,{className:"w-4 h-4"}),children:"Create First Group"})]}):(0,t.jsx)(m.Tabs,{type:"editable-card",activeKey:s,onChange:o,onEdit:(t,a)=>{"add"===a?i():"remove"===a&&e.length>1&&(t=>{if(1===e.length)return u.message.warning("At least one group is required");let a=e.filter(e=>e.id!==t);r(a),s===t&&a.length>0&&o(a[a.length-1].id)})(t)},items:p,className:"fallback-tabs",tabBarStyle:{marginBottom:0},hideAdd:e.length>=n})}e.s(["FallbackSelectionForm",()=>v],419470)},653496,e=>{"use strict";var t=e.i(721369);e.s(["Tabs",()=>t.default])},599724,936325,e=>{"use strict";var t=e.i(95779),r=e.i(444755),a=e.i(673706),l=e.i(271645);let n=l.default.forwardRef((e,n)=>{let{color:s,className:o,children:i}=e;return l.default.createElement("p",{ref:n,className:(0,r.tremorTwMerge)("text-tremor-default",s?(0,a.getColorClassNames)(s,t.colorPalette.text).textColor:(0,r.tremorTwMerge)("text-tremor-content","dark:text-dark-tremor-content"),o)},i)});n.displayName="Text",e.s(["default",()=>n],936325),e.s(["Text",()=>n],599724)},304967,e=>{"use strict";var t=e.i(290571),r=e.i(271645),a=e.i(480731),l=e.i(95779),n=e.i(444755),s=e.i(673706);let o=(0,s.makeClassName)("Card"),i=r.default.forwardRef((e,i)=>{let{decoration:c="",decorationColor:d,children:u,className:m}=e,g=(0,t.__rest)(e,["decoration","decorationColor","children","className"]);return r.default.createElement("div",Object.assign({ref:i,className:(0,n.tremorTwMerge)(o("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",d?(0,s.getColorClassNames)(d,l.colorPalette.border).borderColor:"border-tremor-brand dark:border-dark-tremor-brand",(e=>{if(!e)return"";switch(e){case a.HorizontalPositions.Left:return"border-l-4";case a.VerticalPositions.Top:return"border-t-4";case a.HorizontalPositions.Right:return"border-r-4";case a.VerticalPositions.Bottom:return"border-b-4";default:return""}})(c),m)},g),u)});i.displayName="Card",e.s(["Card",()=>i],304967)},994388,e=>{"use strict";var t=e.i(290571),r=e.i(829087),a=e.i(271645);let l=["preEnter","entering","entered","preExit","exiting","exited","unmounted"],n=e=>({_s:e,status:l[e],isEnter:e<3,isMounted:6!==e,isResolved:2===e||e>4}),s=e=>e?6:5,o=(e,t,r,a,l)=>{clearTimeout(a.current);let s=n(e);t(s),r.current=s,l&&l({current:s})};var i=e.i(480731),c=e.i(444755),d=e.i(673706);let u=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 g={xs:{height:"h-4",width:"w-4"},sm:{height:"h-5",width:"w-5"},md:{height:"h-5",width:"w-5"},lg:{height:"h-6",width:"w-6"},xl:{height:"h-6",width:"w-6"}},f=(e,t)=>{switch(e){case"primary":return{textColor:t?(0,d.getColorClassNames)("white").textColor:"text-tremor-brand-inverted dark:text-dark-tremor-brand-inverted",hoverTextColor:t?(0,d.getColorClassNames)("white").textColor:"text-tremor-brand-inverted dark:text-dark-tremor-brand-inverted",bgColor:t?(0,d.getColorClassNames)(t,m.colorPalette.background).bgColor:"bg-tremor-brand dark:bg-dark-tremor-brand",hoverBgColor:t?(0,d.getColorClassNames)(t,m.colorPalette.darkBackground).hoverBgColor:"hover:bg-tremor-brand-emphasis dark:hover:bg-dark-tremor-brand-emphasis",borderColor:t?(0,d.getColorClassNames)(t,m.colorPalette.border).borderColor:"border-tremor-brand dark:border-dark-tremor-brand",hoverBorderColor:t?(0,d.getColorClassNames)(t,m.colorPalette.darkBorder).hoverBorderColor:"hover:border-tremor-brand-emphasis dark:hover:border-dark-tremor-brand-emphasis"};case"secondary":return{textColor:t?(0,d.getColorClassNames)(t,m.colorPalette.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",hoverTextColor:t?(0,d.getColorClassNames)(t,m.colorPalette.text).textColor:"hover:text-tremor-brand-emphasis dark:hover:text-dark-tremor-brand-emphasis",bgColor:(0,d.getColorClassNames)("transparent").bgColor,hoverBgColor:t?(0,c.tremorTwMerge)((0,d.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,d.getColorClassNames)(t,m.colorPalette.border).borderColor:"border-tremor-brand dark:border-dark-tremor-brand"};case"light":return{textColor:t?(0,d.getColorClassNames)(t,m.colorPalette.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",hoverTextColor:t?(0,d.getColorClassNames)(t,m.colorPalette.darkText).hoverTextColor:"hover:text-tremor-brand-emphasis dark:hover:text-dark-tremor-brand-emphasis",bgColor:(0,d.getColorClassNames)("transparent").bgColor,borderColor:"",hoverBorderColor:""}}},p=(0,d.makeClassName)("Button"),h=({loading:e,iconSize:t,iconPosition:r,Icon:l,needMargin:n,transitionStatus:s})=>{let o=n?r===i.HorizontalPositions.Left?(0,c.tremorTwMerge)("-ml-1","mr-1.5"):(0,c.tremorTwMerge)("-mr-1","ml-1.5"):"",d=(0,c.tremorTwMerge)("w-0 h-0"),m={default:d,entering:d,entered:t,exiting:t,exited:d};return e?a.default.createElement(u,{className:(0,c.tremorTwMerge)(p("icon"),"animate-spin shrink-0",o,m.default,m[s]),style:{transition:"width 150ms"}}):a.default.createElement(l,{className:(0,c.tremorTwMerge)(p("icon"),"shrink-0",t,o)})},x=a.default.forwardRef((e,l)=>{let{icon:u,iconPosition:m=i.HorizontalPositions.Left,size:x=i.Sizes.SM,color:b,variant:y="primary",disabled:v,loading:w=!1,loadingText:k,children:C,tooltip:j,className:N}=e,S=(0,t.__rest)(e,["icon","iconPosition","size","color","variant","disabled","loading","loadingText","children","tooltip","className"]),M=w||v,T=void 0!==u||w,O=w&&k,E=!(!C&&!O),P=(0,c.tremorTwMerge)(g[x].height,g[x].width),$="light"!==y?(0,c.tremorTwMerge)("rounded-tremor-default border","shadow-tremor-input","dark:shadow-dark-tremor-input"):"",_=f(y,b),R=("light"!==y?{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"}})[x],{tooltipProps:L,getReferenceProps:z}=(0,r.useTooltip)(300),[B,D]=(({enter:e=!0,exit:t=!0,preEnter:r,preExit:l,timeout:i,initialEntered:c,mountOnEnter:d,unmountOnExit:u,onStateChange:m}={})=>{let[g,f]=(0,a.useState)(()=>n(c?2:s(d))),p=(0,a.useRef)(g),h=(0,a.useRef)(0),[x,b]="object"==typeof i?[i.enter,i.exit]:[i,i],y=(0,a.useCallback)(()=>{let e=((e,t)=>{switch(e){case 1:case 0:return 2;case 4:case 3:return s(t)}})(p.current._s,u);e&&o(e,f,p,h,m)},[m,u]);return[g,(0,a.useCallback)(a=>{let n=e=>{switch(o(e,f,p,h,m),e){case 1:x>=0&&(h.current=((...e)=>setTimeout(...e))(y,x));break;case 4:b>=0&&(h.current=((...e)=>setTimeout(...e))(y,b));break;case 0:case 3:h.current=((...e)=>setTimeout(...e))(()=>{isNaN(document.body.offsetTop)||n(e+1)},0)}},i=p.current.isEnter;"boolean"!=typeof a&&(a=!i),a?i||n(e?+!r:2):i&&n(t?l?3:4:s(u))},[y,m,e,t,r,l,x,b,u]),y]})({timeout:50});return(0,a.useEffect)(()=>{D(w)},[w]),a.default.createElement("button",Object.assign({ref:(0,d.mergeRefs)([l,L.refs.setReference]),className:(0,c.tremorTwMerge)(p("root"),"shrink-0 inline-flex justify-center items-center group font-medium outline-none",$,R.paddingX,R.paddingY,R.fontSize,_.textColor,_.bgColor,_.borderColor,_.hoverBorderColor,M?"opacity-50 cursor-not-allowed":(0,c.tremorTwMerge)(f(y,b).hoverTextColor,f(y,b).hoverBgColor,f(y,b).hoverBorderColor),N),disabled:M},z,S),a.default.createElement(r.default,Object.assign({text:j},L)),T&&m!==i.HorizontalPositions.Right?a.default.createElement(h,{loading:w,iconSize:P,iconPosition:m,Icon:u,transitionStatus:B.status,needMargin:E}):null,O||C?a.default.createElement("span",{className:(0,c.tremorTwMerge)(p("text"),"text-tremor-default whitespace-nowrap")},O?k:C):null,T&&m===i.HorizontalPositions.Right?a.default.createElement(h,{loading:w,iconSize:P,iconPosition:m,Icon:u,transitionStatus:B.status,needMargin:E}):null)});x.displayName="Button",e.s(["Button",()=>x],994388)},629569,e=>{"use strict";var t=e.i(290571),r=e.i(95779),a=e.i(444755),l=e.i(673706),n=e.i(271645);let s=n.default.forwardRef((e,s)=>{let{color:o,children:i,className:c}=e,d=(0,t.__rest)(e,["color","children","className"]);return n.default.createElement("p",Object.assign({ref:s,className:(0,a.tremorTwMerge)("font-medium text-tremor-title",o?(0,l.getColorClassNames)(o,r.colorPalette.darkText).textColor:"text-tremor-content-strong dark:text-dark-tremor-content-strong",c)},d),i)});s.displayName="Title",e.s(["Title",()=>s],629569)},91874,e=>{"use strict";var t=e.i(931067),r=e.i(209428),a=e.i(211577),l=e.i(392221),n=e.i(703923),s=e.i(343794),o=e.i(914949),i=e.i(271645),c=["prefixCls","className","style","checked","disabled","defaultChecked","type","title","onChange"],d=(0,i.forwardRef)(function(e,d){var u=e.prefixCls,m=void 0===u?"rc-checkbox":u,g=e.className,f=e.style,p=e.checked,h=e.disabled,x=e.defaultChecked,b=e.type,y=void 0===b?"checkbox":b,v=e.title,w=e.onChange,k=(0,n.default)(e,c),C=(0,i.useRef)(null),j=(0,i.useRef)(null),N=(0,o.default)(void 0!==x&&x,{value:p}),S=(0,l.default)(N,2),M=S[0],T=S[1];(0,i.useImperativeHandle)(d,function(){return{focus:function(e){var t;null==(t=C.current)||t.focus(e)},blur:function(){var e;null==(e=C.current)||e.blur()},input:C.current,nativeElement:j.current}});var O=(0,s.default)(m,g,(0,a.default)((0,a.default)({},"".concat(m,"-checked"),M),"".concat(m,"-disabled"),h));return i.createElement("span",{className:O,title:v,style:f,ref:j},i.createElement("input",(0,t.default)({},k,{className:"".concat(m,"-input"),ref:C,onChange:function(t){h||("checked"in e||T(t.target.checked),null==w||w({target:(0,r.default)((0,r.default)({},e),{},{type:y,checked:t.target.checked}),stopPropagation:function(){t.stopPropagation()},preventDefault:function(){t.preventDefault()},nativeEvent:t.nativeEvent}))},disabled:h,checked:!!M,type:y})),i.createElement("span",{className:"".concat(m,"-inner")}))});e.s(["default",0,d])},421512,236836,e=>{"use strict";let t=e.i(271645).default.createContext(null);e.s(["default",0,t],421512),e.i(296059);var r=e.i(915654),a=e.i(183293),l=e.i(246422),n=e.i(838378);function s(e,t){return(e=>{let{checkboxCls:t}=e,l=`${t}-wrapper`;return[{[`${t}-group`]:Object.assign(Object.assign({},(0,a.resetComponent)(e)),{display:"inline-flex",flexWrap:"wrap",columnGap:e.marginXS,[`> ${e.antCls}-row`]:{flex:1}}),[l]:Object.assign(Object.assign({},(0,a.resetComponent)(e)),{display:"inline-flex",alignItems:"baseline",cursor:"pointer","&:after":{display:"inline-block",width:0,overflow:"hidden",content:"'\\a0'"},[`& + ${l}`]:{marginInlineStart:0},[`&${l}-in-form-item`]:{'input[type="checkbox"]':{width:14,height:14}}}),[t]:Object.assign(Object.assign({},(0,a.resetComponent)(e)),{position:"relative",whiteSpace:"nowrap",lineHeight:1,cursor:"pointer",borderRadius:e.borderRadiusSM,alignSelf:"center",[`${t}-input`]:{position:"absolute",inset:0,zIndex:1,cursor:"pointer",opacity:0,margin:0,[`&:focus-visible + ${t}-inner`]:(0,a.genFocusOutline)(e)},[`${t}-inner`]:{boxSizing:"border-box",display:"block",width:e.checkboxSize,height:e.checkboxSize,direction:"ltr",backgroundColor:e.colorBgContainer,border:`${(0,r.unit)(e.lineWidth)} ${e.lineType} ${e.colorBorder}`,borderRadius:e.borderRadiusSM,borderCollapse:"separate",transition:`all ${e.motionDurationSlow}`,"&:after":{boxSizing:"border-box",position:"absolute",top:"50%",insetInlineStart:"25%",display:"table",width:e.calc(e.checkboxSize).div(14).mul(5).equal(),height:e.calc(e.checkboxSize).div(14).mul(8).equal(),border:`${(0,r.unit)(e.lineWidthBold)} solid ${e.colorWhite}`,borderTop:0,borderInlineStart:0,transform:"rotate(45deg) scale(0) translate(-50%,-50%)",opacity:0,content:'""',transition:`all ${e.motionDurationFast} ${e.motionEaseInBack}, opacity ${e.motionDurationFast}`}},"& + span":{paddingInlineStart:e.paddingXS,paddingInlineEnd:e.paddingXS}})},{[` +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,270345,e=>{"use strict";var t=e.i(764205);let r=async(e,r,a,l)=>"Admin"!=a&&"Admin Viewer"!=a?await (0,t.teamListCall)(e,l?.organization_id||null,r):await (0,t.teamListCall)(e,l?.organization_id||null);e.s(["fetchTeams",0,r])},519756,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:"M400 317.7h73.9V656c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V317.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 163a8 8 0 00-12.6 0l-112 141.7c-4.1 5.3-.4 13 6.3 13zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"}}]},name:"upload",theme:"outlined"};var l=e.i(9583),n=r.forwardRef(function(e,n){return r.createElement(l.default,(0,t.default)({},e,{ref:n,icon:a}))});e.s(["UploadOutlined",0,n],519756)},981339,e=>{"use strict";var t=e.i(185793);e.s(["Skeleton",()=>t.default])},500330,e=>{"use strict";var t=e.i(727749);function r(e,t){let r=structuredClone(e);for(let[e,a]of Object.entries(t))e in r&&(r[e]=a);return r}let a=(e,t=0,r=!1,a=!0)=>{if(null==e||!Number.isFinite(e)||0===e&&!a)return"-";let l={minimumFractionDigits:t,maximumFractionDigits:t};if(!r)return e.toLocaleString("en-US",l);let n=e<0?"-":"",o=Math.abs(e),s=o,i="";return o>=1e6?(s=o/1e6,i="M"):o>=1e3&&(s=o/1e3,i="K"),`${n}${s.toLocaleString("en-US",l)}${i}`},l=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 a=document.createElement("textarea");a.value=e,a.style.position="fixed",a.style.left="-999999px",a.style.top="-999999px",a.setAttribute("readonly",""),document.body.appendChild(a),a.focus(),a.select();let l=document.execCommand("copy");if(document.body.removeChild(a),l)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,l,"formatNumberWithCommas",0,a,"getSpendString",0,(e,t=6)=>{if(null==e||!Number.isFinite(e)||0===e)return"-";let r=a(e,t,!1,!1);if(0===Number(r.replace(/,/g,""))){let e=(1/10**t).toFixed(t);return`< $${e}`}return`$${r}`},"updateExistingKeys",()=>r])},743151,(e,t,r)=>{"use strict";function a(e){return(a="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 l=s(e.r(271645)),n=s(e.r(844343)),o=["text","onCopy","options","children"];function s(e){return e&&e.__esModule?e:{default:e}}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,a)}return r}function c(e){for(var t=1;t=0||(l[r]=e[r]);return l}(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(a=0;a=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(l[r]=e[r])}return l}(e,o),a=l.default.Children.only(t);return l.default.cloneElement(a,c(c({},r),{},{onClick:this.onClick}))}}],function(e,t){for(var r=0;r{"use strict";var a=e.r(743151).CopyToClipboard;a.CopyToClipboard=a,t.exports=a},109799,e=>{"use strict";var t=e.i(135214),r=e.i(764205),a=e.i(266027),l=e.i(912598);let n=(0,e.i(243652).createQueryKeys)("organizations");e.s(["useOrganization",0,e=>{let o=(0,l.useQueryClient)(),{accessToken:s}=(0,t.default)();return(0,a.useQuery)({queryKey:n.detail(e),enabled:!!(s&&e),queryFn:async()=>{if(!s||!e)throw Error("Missing auth or teamId");return(0,r.organizationInfoCall)(s,e)},initialData:()=>{if(!e)return;let t=o.getQueryData(n.list({}));return t?.find(t=>t.organization_id===e)}})},"useOrganizations",0,()=>{let{accessToken:e,userId:l,userRole:o}=(0,t.default)();return(0,a.useQuery)({queryKey:n.list({}),queryFn:async()=>await (0,r.organizationListCall)(e),enabled:!!(e&&l&&o)})}])},309426,e=>{"use strict";var t=e.i(290571),r=e.i(444755),a=e.i(673706),l=e.i(271645),n=e.i(46757);let o=(0,a.makeClassName)("Col"),s=l.default.forwardRef((e,a)=>{let s,i,c,d,{numColSpan:u=1,numColSpanSm:m,numColSpanMd:g,numColSpanLg:p,children:f,className:h}=e,x=(0,t.__rest)(e,["numColSpan","numColSpanSm","numColSpanMd","numColSpanLg","children","className"]),b=(e,t)=>e&&Object.keys(t).includes(String(e))?t[e]:"";return l.default.createElement("div",Object.assign({ref:a,className:(0,r.tremorTwMerge)(o("root"),(s=b(u,n.colSpan),i=b(m,n.colSpanSm),c=b(g,n.colSpanMd),d=b(p,n.colSpanLg),(0,r.tremorTwMerge)(s,i,c,d)),h)},x),f)});s.displayName="Col",e.s(["Col",()=>s],309426)},988297,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4v16m8-8H4"}))});e.s(["PlusIcon",0,r],988297)},797672,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"}))});e.s(["PencilIcon",0,r],797672)},992619,e=>{"use strict";var t=e.i(843476),r=e.i(271645),a=e.i(779241),l=e.i(599724),n=e.i(199133),o=e.i(983561),s=e.i(689020);e.s(["default",0,({accessToken:e,value:i,placeholder:c="Select a Model",onChange:d,disabled:u=!1,style:m,className:g,showLabel:p=!0,labelText:f="Select Model"})=>{let[h,x]=(0,r.useState)(i),[b,y]=(0,r.useState)(!1),[v,w]=(0,r.useState)([]),k=(0,r.useRef)(null);return(0,r.useEffect)(()=>{x(i)},[i]),(0,r.useEffect)(()=>{e&&(async()=>{try{let t=await (0,s.fetchAvailableModels)(e);console.log("Fetched models for selector:",t),t.length>0&&w(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)(o.RobotOutlined,{className:"mr-2"})," ",f]}),(0,t.jsx)(n.Select,{value:h,placeholder:c,onChange:e=>{"custom"===e?(y(!0),x(void 0)):(y(!1),x(e),d&&d(e))},options:[...Array.from(new Set(v.map(e=>e.model_group))).map((e,t)=>({value:e,label:e,key:t})),{value:"custom",label:"Enter custom model",key:"custom"}],style:{width:"100%",...m},showSearch:!0,className:`rounded-md ${g||""}`,disabled:u}),b&&(0,t.jsx)(a.TextInput,{className:"mt-2",placeholder:"Enter custom model name",onValueChange:e=>{k.current&&clearTimeout(k.current),k.current=setTimeout(()=>{x(e),d&&d(e)},500)},disabled:u})]})}])},409797,e=>{"use strict";var t=e.i(631171);e.s(["ChevronDownIcon",()=>t.default])},91739,e=>{"use strict";var t=e.i(544195);e.s(["Radio",()=>t.default])},500727,696609,531516,e=>{"use strict";var t=e.i(266027),r=e.i(243652),a=e.i(764205),l=e.i(135214);let n=(0,r.createQueryKeys)("mcpServers");e.s(["useMCPServers",0,e=>{let{accessToken:r}=(0,l.default)();return(0,t.useQuery)({queryKey:n.list(e?{filters:{teamId:e}}:void 0),queryFn:async()=>await (0,a.fetchMCPServers)(r,e),enabled:!!r})}],500727);var o=e.i(843476),s=e.i(271645),i=e.i(536916),c=e.i(599724),d=e.i(409797),u=e.i(246349),u=u;let m=/\b(delete|remove|destroy|purge|drop|erase|unlink)\b/i,g=/\b(create|add|insert|new|post|submit|register|make|generate|write|upload)\b/i,p=/\b(update|edit|modify|change|patch|put|set|rename|move|transform)\b/i,f=/\b(get|read|list|fetch|search|find|query|retrieve|show|view|check|describe|info)\b/i;function h(e,t=""){let r=e.toLowerCase();if(f.test(r))return"read";if(m.test(r))return"delete";if(p.test(r))return"update";if(g.test(r))return"create";if(t){let e=t.toLowerCase();if(f.test(e))return"read";if(m.test(e))return"delete";if(p.test(e))return"update";if(g.test(e))return"create"}return"unknown"}function x(e){let t={read:[],create:[],update:[],delete:[],unknown:[]};for(let r of e)t[h(r.name,r.description)].push(r);return t}let b={read:{label:"Read",description:"Safe operations — fetch, list, search. No side effects.",risk:"low"},create:{label:"Create",description:"Add new resources — insert, upload, register.",risk:"medium"},update:{label:"Update",description:"Modify existing resources — edit, patch, rename.",risk:"medium"},delete:{label:"Delete",description:"Destructive operations — remove, purge, destroy.",risk:"high"},unknown:{label:"Other",description:"Operations that could not be automatically classified.",risk:"unknown"}};e.s(["CRUD_GROUP_META",0,b,"classifyToolOp",()=>h,"groupToolsByCrud",()=>x],696609);let y=["read","create","update","delete","unknown"],v={low:"bg-green-100 text-green-800",medium:"bg-yellow-100 text-yellow-800",high:"bg-red-100 text-red-800 font-semibold",unknown:"bg-gray-100 text-gray-700"},w={read:"border-green-200",create:"border-blue-200",update:"border-yellow-200",delete:"border-red-300",unknown:"border-gray-200"},k={read:"bg-green-50",create:"bg-blue-50",update:"bg-yellow-50",delete:"bg-red-50",unknown:"bg-gray-50"};e.s(["default",0,({tools:e,value:t,onChange:r,readOnly:a=!1,searchFilter:l=""})=>{let[n,m]=(0,s.useState)({read:!1,create:!1,update:!1,delete:!1,unknown:!0}),g=(0,s.useMemo)(()=>x(e),[e]),p=(0,s.useMemo)(()=>new Set(void 0===t?e.map(e=>e.name):t),[t,e]),f=e=>{if(a)return;let t=new Set(p);t.has(e)?t.delete(e):t.add(e),r(Array.from(t))};return 0===e.length?null:(0,o.jsx)("div",{className:"space-y-3",children:y.map(e=>{let t,s=g[e];if(0===s.length)return null;if(l){let e=l.toLowerCase();if(!s.some(t=>t.name.toLowerCase().includes(e)||(t.description??"").toLowerCase().includes(e)))return null}let h=b[e],x=(t=g[e]).length>0&&t.every(e=>p.has(e.name)),y=(e=>{let t=g[e];if(0===t.length)return!1;let r=t.filter(e=>p.has(e.name)).length;return r>0&&r{m(t=>({...t,[e]:!t[e]}))},children:[C?(0,o.jsx)(u.default,{className:"w-4 h-4 text-gray-500 flex-shrink-0"}):(0,o.jsx)(d.ChevronDownIcon,{className:"w-4 h-4 text-gray-500 flex-shrink-0"}),(0,o.jsx)("span",{className:"font-semibold text-gray-900 text-sm",children:h.label}),(0,o.jsx)("span",{className:`text-xs px-2 py-0.5 rounded-full ${v[h.risk]}`,children:"high"===h.risk?"High Risk":"medium"===h.risk?"Medium Risk":"low"===h.risk?"Safe":"Unclassified"}),(0,o.jsxs)("span",{className:"text-xs text-gray-500 ml-1",children:[s.filter(e=>p.has(e.name)).length,"/",s.length," allowed"]})]}),!a&&(0,o.jsxs)("div",{className:"flex items-center gap-2 ml-4",children:[(0,o.jsx)(c.Text,{className:"text-xs text-gray-500",children:x?"All on":y?"Partial":"All off"}),(0,o.jsx)(i.Checkbox,{checked:x,indeterminate:y,onChange:t=>((e,t)=>{if(a)return;let l=new Set(p);for(let r of g[e])t?l.add(r.name):l.delete(r.name);r(Array.from(l))})(e,t.target.checked),onClick:e=>e.stopPropagation()})]})]}),!C&&(0,o.jsx)("div",{className:"px-4 pt-2 pb-1 text-xs text-gray-500 bg-white border-b border-gray-100",children:h.description}),!C&&(0,o.jsx)("div",{className:"bg-white divide-y divide-gray-50",children:s.filter(e=>!l||e.name.toLowerCase().includes(l.toLowerCase())||(e.description??"").toLowerCase().includes(l.toLowerCase())).map(e=>{let t,r=(t=e.name,p.has(t));return(0,o.jsxs)("div",{className:`flex items-start gap-3 px-4 py-2.5 transition-colors hover:bg-gray-50 ${!a?"cursor-pointer":""} ${r?"":"opacity-60"}`,onClick:()=>f(e.name),children:[(0,o.jsx)(i.Checkbox,{checked:r,onChange:()=>f(e.name),disabled:a,onClick:e=>e.stopPropagation()}),(0,o.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,o.jsx)(c.Text,{className:"font-medium text-gray-900 text-sm",children:e.name}),e.description&&(0,o.jsx)(c.Text,{className:"text-xs text-gray-500 mt-0.5 leading-snug",children:e.description})]}),(0,o.jsx)("span",{className:`text-xs px-1.5 py-0.5 rounded flex-shrink-0 ${r?"bg-green-100 text-green-700":"bg-gray-100 text-gray-500"}`,children:r?"on":"off"})]},e.name)})})]},e)})})}],531516)},361653,e=>{"use strict";let t=(0,e.i(475254).default)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);e.s(["default",()=>t])},603908,e=>{"use strict";let t=(0,e.i(475254).default)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);e.s(["default",()=>t])},841947,e=>{"use strict";let t=(0,e.i(475254).default)("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);e.s(["default",()=>t])},793130,e=>{"use strict";var t=e.i(290571),r=e.i(429427),a=e.i(371330),l=e.i(271645),n=e.i(394487),o=e.i(503269),s=e.i(214520),i=e.i(746725),c=e.i(914189),d=e.i(144279),u=e.i(294316),m=e.i(601893),g=e.i(140721),p=e.i(942803),f=e.i(233538),h=e.i(694421),x=e.i(700020),b=e.i(35889),y=e.i(998348),v=e.i(722678);let w=(0,l.createContext)(null);w.displayName="GroupContext";let k=l.Fragment,C=Object.assign((0,x.forwardRefWithAs)(function(e,t){var k;let C=(0,l.useId)(),j=(0,p.useProvidedId)(),N=(0,m.useDisabled)(),{id:S=j||`headlessui-switch-${C}`,disabled:M=N||!1,checked:T,defaultChecked:E,onChange:O,name:P,value:$,form:_,autoFocus:R=!1,...L}=e,z=(0,l.useContext)(w),[B,D]=(0,l.useState)(null),F=(0,l.useRef)(null),I=(0,u.useSyncRefs)(F,t,null===z?null:z.setSwitch,D),A=(0,s.useDefaultValue)(E),[H,q]=(0,o.useControllable)(T,O,null!=A&&A),V=(0,i.useDisposables)(),[G,K]=(0,l.useState)(!1),X=(0,c.useEvent)(()=>{K(!0),null==q||q(!H),V.nextFrame(()=>{K(!1)})}),W=(0,c.useEvent)(e=>{if((0,f.isDisabledReactIssue7711)(e.currentTarget))return e.preventDefault();e.preventDefault(),X()}),U=(0,c.useEvent)(e=>{e.key===y.Keys.Space?(e.preventDefault(),X()):e.key===y.Keys.Enter&&(0,h.attemptSubmit)(e.currentTarget)}),Y=(0,c.useEvent)(e=>e.preventDefault()),Q=(0,v.useLabelledBy)(),J=(0,b.useDescribedBy)(),{isFocusVisible:Z,focusProps:ee}=(0,r.useFocusRing)({autoFocus:R}),{isHovered:et,hoverProps:er}=(0,a.useHover)({isDisabled:M}),{pressed:ea,pressProps:el}=(0,n.useActivePress)({disabled:M}),en=(0,l.useMemo)(()=>({checked:H,disabled:M,hover:et,focus:Z,active:ea,autofocus:R,changing:G}),[H,et,Z,ea,M,G,R]),eo=(0,x.mergeProps)({id:S,ref:I,role:"switch",type:(0,d.useResolveButtonType)(e,B),tabIndex:-1===e.tabIndex?0:null!=(k=e.tabIndex)?k:0,"aria-checked":H,"aria-labelledby":Q,"aria-describedby":J,disabled:M||void 0,autoFocus:R,onClick:W,onKeyUp:U,onKeyPress:Y},ee,er,el),es=(0,l.useCallback)(()=>{if(void 0!==A)return null==q?void 0:q(A)},[q,A]),ei=(0,x.useRender)();return l.default.createElement(l.default.Fragment,null,null!=P&&l.default.createElement(g.FormFields,{disabled:M,data:{[P]:$||"on"},overrides:{type:"checkbox",checked:H},form:_,onReset:es}),ei({ourProps:eo,theirProps:L,slot:en,defaultTag:"button",name:"Switch"}))}),{Group:function(e){var t;let[r,a]=(0,l.useState)(null),[n,o]=(0,v.useLabels)(),[s,i]=(0,b.useDescriptions)(),c=(0,l.useMemo)(()=>({switch:r,setSwitch:a}),[r,a]),d=(0,x.useRender)();return l.default.createElement(i,{name:"Switch.Description",value:s},l.default.createElement(o,{name:"Switch.Label",value:n,props:{htmlFor:null==(t=c.switch)?void 0:t.id,onClick(e){r&&(e.currentTarget instanceof HTMLLabelElement&&e.preventDefault(),r.click(),r.focus({preventScroll:!0}))}}},l.default.createElement(w.Provider,{value:c},d({ourProps:{},theirProps:e,slot:{},defaultTag:k,name:"Switch.Group"}))))},Label:v.Label,Description:b.Description});var j=e.i(888288),N=e.i(95779),S=e.i(444755),M=e.i(673706),T=e.i(829087);let E=(0,M.makeClassName)("Switch"),O=l.default.forwardRef((e,r)=>{let{checked:a,defaultChecked:n=!1,onChange:o,color:s,name:i,error:c,errorMessage:d,disabled:u,required:m,tooltip:g,id:p}=e,f=(0,t.__rest)(e,["checked","defaultChecked","onChange","color","name","error","errorMessage","disabled","required","tooltip","id"]),h={bgColor:s?(0,M.getColorClassNames)(s,N.colorPalette.background).bgColor:"bg-tremor-brand dark:bg-dark-tremor-brand",ringColor:s?(0,M.getColorClassNames)(s,N.colorPalette.ring).ringColor:"ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted"},[x,b]=(0,j.default)(n,a),[y,v]=(0,l.useState)(!1),{tooltipProps:w,getReferenceProps:k}=(0,T.useTooltip)(300);return l.default.createElement("div",{className:"flex flex-row items-center justify-start"},l.default.createElement(T.default,Object.assign({text:g},w)),l.default.createElement("div",Object.assign({ref:(0,M.mergeRefs)([r,w.refs.setReference]),className:(0,S.tremorTwMerge)(E("root"),"flex flex-row relative h-5")},f,k),l.default.createElement("input",{type:"checkbox",className:(0,S.tremorTwMerge)(E("input"),"absolute w-5 h-5 cursor-pointer left-0 top-0 opacity-0"),name:i,required:m,checked:x,onChange:e=>{e.preventDefault()}}),l.default.createElement(C,{checked:x,onChange:e=>{b(e),null==o||o(e)},disabled:u,className:(0,S.tremorTwMerge)(E("switch"),"w-10 h-5 group relative inline-flex shrink-0 cursor-pointer items-center justify-center rounded-tremor-full","focus:outline-none",u?"cursor-not-allowed":""),onFocus:()=>v(!0),onBlur:()=>v(!1),id:p},l.default.createElement("span",{className:(0,S.tremorTwMerge)(E("sr-only"),"sr-only")},"Switch ",x?"on":"off"),l.default.createElement("span",{"aria-hidden":"true",className:(0,S.tremorTwMerge)(E("background"),x?h.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")}),l.default.createElement("span",{"aria-hidden":"true",className:(0,S.tremorTwMerge)(E("round"),x?(0,S.tremorTwMerge)(h.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,S.tremorTwMerge)("ring-2",h.ringColor):"")}))),c&&d?l.default.createElement("p",{className:(0,S.tremorTwMerge)(E("errorMessage"),"text-sm text-red-500 mt-1 ")},d):null)});O.displayName="Switch",e.s(["Switch",()=>O],793130)},158392,419470,e=>{"use strict";var t=e.i(843476),r=e.i(779241);let a={ttl:3600,lowest_latency_buffer:0},l=({routingStrategyArgs:e})=>{let l={ttl:"Sliding window to look back over when calculating the average latency of a deployment. Default - 1 hour (in seconds).",lowest_latency_buffer:"Shuffle between deployments within this % of the lowest latency. Default - 0 (i.e. always pick lowest latency)."};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"max-w-3xl",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Latency-Based Configuration"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Fine-tune latency-based routing behavior"})]}),(0,t.jsx)("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2 xl:grid-cols-3",children:Object.entries(e||a).map(([e,a])=>(0,t.jsx)("div",{className:"space-y-2",children:(0,t.jsxs)("label",{className:"block",children:[(0,t.jsx)("span",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:e.replace(/_/g," ")}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-0.5 mb-2",children:l[e]||""}),(0,t.jsx)(r.TextInput,{name:e,defaultValue:"object"==typeof a?JSON.stringify(a,null,2):a?.toString(),className:"font-mono text-sm w-full"})]})},e))})]}),(0,t.jsx)("div",{className:"border-t border-gray-200"})]})},n=({routerSettings:e,routerFieldsMetadata:a})=>(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"max-w-3xl",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Reliability & Retries"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Configure retry logic and failure handling"})]}),(0,t.jsx)("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2 xl:grid-cols-3",children:Object.entries(e).filter(([e,t])=>"fallbacks"!=e&&"context_window_fallbacks"!=e&&"routing_strategy_args"!=e&&"routing_strategy"!=e&&"enable_tag_filtering"!=e).map(([e,l])=>(0,t.jsx)("div",{className:"space-y-2",children:(0,t.jsxs)("label",{className:"block",children:[(0,t.jsx)("span",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:a[e]?.ui_field_name||e}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-0.5 mb-2",children:a[e]?.field_description||""}),(0,t.jsx)(r.TextInput,{name:e,defaultValue:null==l||"null"===l?"":"object"==typeof l?JSON.stringify(l,null,2):l?.toString()||"",placeholder:"—",className:"font-mono text-sm w-full"})]})},e))})]});var o=e.i(199133);let s=({selectedStrategy:e,availableStrategies:r,routingStrategyDescriptions:a,routerFieldsMetadata:l,onStrategyChange:n})=>(0,t.jsxs)("div",{className:"space-y-2 max-w-3xl",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:l.routing_strategy?.ui_field_name||"Routing Strategy"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-0.5 mb-2",children:l.routing_strategy?.field_description||""})]}),(0,t.jsx)("div",{className:"routing-strategy-select max-w-3xl",children:(0,t.jsx)(o.Select,{value:e,onChange:n,style:{width:"100%"},size:"large",children:r.map(e=>(0,t.jsx)(o.Select.Option,{value:e,label:e,children:(0,t.jsxs)("div",{className:"flex flex-col gap-0.5 py-1",children:[(0,t.jsx)("span",{className:"font-mono text-sm font-medium",children:e}),a[e]&&(0,t.jsx)("span",{className:"text-xs text-gray-500 font-normal",children:a[e]})]})},e))})})]});var i=e.i(793130);let c=({enabled:e,routerFieldsMetadata:r,onToggle:a})=>(0,t.jsx)("div",{className:"space-y-3 max-w-3xl",children:(0,t.jsxs)("div",{className:"flex items-start justify-between",children:[(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)("label",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:r.enable_tag_filtering?.ui_field_name||"Enable Tag Filtering"}),(0,t.jsxs)("p",{className:"text-xs text-gray-500 mt-0.5",children:[r.enable_tag_filtering?.field_description||"",r.enable_tag_filtering?.link&&(0,t.jsxs)(t.Fragment,{children:[" ",(0,t.jsx)("a",{href:r.enable_tag_filtering.link,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-800 underline",children:"Learn more"})]})]})]}),(0,t.jsx)(i.Switch,{checked:e,onChange:a,className:"ml-4"})]})});e.s(["default",0,({value:e,onChange:r,routerFieldsMetadata:a,availableRoutingStrategies:o,routingStrategyDescriptions:i})=>(0,t.jsxs)("div",{className:"w-full space-y-8 py-2",children:[(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"max-w-3xl",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Routing Settings"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Configure how requests are routed to deployments"})]}),o.length>0&&(0,t.jsx)(s,{selectedStrategy:e.selectedStrategy||e.routerSettings.routing_strategy||null,availableStrategies:o,routingStrategyDescriptions:i,routerFieldsMetadata:a,onStrategyChange:t=>{r({...e,selectedStrategy:t})}}),(0,t.jsx)(c,{enabled:e.enableTagFiltering,routerFieldsMetadata:a,onToggle:t=>{r({...e,enableTagFiltering:t})}})]}),(0,t.jsx)("div",{className:"border-t border-gray-200"}),"latency-based-routing"===e.selectedStrategy&&(0,t.jsx)(l,{routingStrategyArgs:e.routerSettings.routing_strategy_args}),(0,t.jsx)(n,{routerSettings:e.routerSettings,routerFieldsMetadata:a})]})],158392);var d=e.i(994388),u=e.i(998573),m=e.i(653496),g=e.i(107233),p=e.i(271645),f=e.i(592968),h=e.i(361653),h=h;let x=(0,e.i(475254).default)("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);var b=e.i(37727);function y({group:e,onChange:r,availableModels:a,maxFallbacks:l}){let n=a.filter(t=>t!==e.primaryModel),s=e.fallbackModels.length{let a=[...e.fallbackModels];a.includes(t)&&(a=a.filter(e=>e!==t)),r({...e,primaryModel:t,fallbackModels:a})},showSearch:!0,getPopupContainer:e=>e.parentElement||document.body,filterOption:(e,t)=>(t?.label??"").toLowerCase().includes(e.toLowerCase()),options:a.map(e=>({label:e,value:e}))}),!e.primaryModel&&(0,t.jsxs)("div",{className:"mt-2 flex items-center gap-2 text-amber-600 text-xs bg-amber-50 p-2 rounded",children:[(0,t.jsx)(h.default,{className:"w-4 h-4"}),(0,t.jsx)("span",{children:"Select a model to begin configuring fallbacks"})]})]}),(0,t.jsx)("div",{className:"flex items-center justify-center -my-4 z-10",children:(0,t.jsxs)("div",{className:"bg-indigo-50 text-indigo-500 px-4 py-1 rounded-full text-xs font-bold border border-indigo-100 flex items-center gap-2 shadow-sm",children:[(0,t.jsx)(x,{className:"w-4 h-4"}),"IF FAILS, TRY..."]})}),(0,t.jsxs)("div",{className:`transition-opacity duration-300 ${!e.primaryModel?"opacity-50 pointer-events-none":"opacity-100"}`,children:[(0,t.jsxs)("label",{className:"block text-sm font-semibold text-gray-700 mb-2",children:["Fallback Chain ",(0,t.jsx)("span",{className:"text-red-500",children:"*"}),(0,t.jsxs)("span",{className:"text-xs text-gray-500 font-normal ml-2",children:["(Max ",l," fallbacks at a time)"]})]}),(0,t.jsxs)("div",{className:"bg-gray-50 rounded-xl p-4 border border-gray-200",children:[(0,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsx)(o.Select,{mode:"multiple",className:"w-full",size:"large",placeholder:s?"Select fallback models to add...":`Maximum ${l} fallbacks reached`,value:e.fallbackModels,onChange:t=>{let a=t.slice(0,l);r({...e,fallbackModels:a})},disabled:!e.primaryModel,getPopupContainer:e=>e.parentElement||document.body,options:n.map(e=>({label:e,value:e})),optionRender:(r,a)=>{let l=e.fallbackModels.includes(r.value),n=l?e.fallbackModels.indexOf(r.value)+1:null;return(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[l&&null!==n&&(0,t.jsx)("span",{className:"flex items-center justify-center w-5 h-5 rounded bg-indigo-100 text-indigo-600 text-xs font-bold",children:n}),(0,t.jsx)("span",{children:r.label})]})},maxTagCount:"responsive",maxTagPlaceholder:e=>(0,t.jsx)(f.Tooltip,{styles:{root:{pointerEvents:"none"}},title:e.map(({value:e})=>e).join(", "),children:(0,t.jsxs)("span",{children:["+",e.length," more"]})}),showSearch:!0,filterOption:(e,t)=>(t?.label??"").toLowerCase().includes(e.toLowerCase())}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1 ml-1",children:s?`Search and select multiple models. Selected models will appear below in order. (${e.fallbackModels.length}/${l} used)`:`Maximum ${l} fallbacks reached. Remove some to add more.`})]}),(0,t.jsx)("div",{className:"space-y-2 min-h-[100px]",children:0===e.fallbackModels.length?(0,t.jsxs)("div",{className:"h-32 border-2 border-dashed border-gray-300 rounded-lg flex flex-col items-center justify-center text-gray-400",children:[(0,t.jsx)("span",{className:"text-sm",children:"No fallback models selected"}),(0,t.jsx)("span",{className:"text-xs mt-1",children:"Add models from the dropdown above"})]}):e.fallbackModels.map((a,l)=>(0,t.jsxs)("div",{className:"group flex items-center justify-between p-3 bg-white rounded-lg border border-gray-200 hover:border-indigo-300 hover:shadow-sm transition-all",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"flex items-center justify-center w-6 h-6 rounded bg-gray-100 text-gray-400 group-hover:text-indigo-500 group-hover:bg-indigo-50",children:(0,t.jsx)("span",{className:"text-xs font-bold",children:l+1})}),(0,t.jsx)("div",{children:(0,t.jsx)("span",{className:"font-medium text-gray-800",children:a})})]}),(0,t.jsx)("button",{type:"button",onClick:()=>{let t;return t=e.fallbackModels.filter((e,t)=>t!==l),void r({...e,fallbackModels:t})},className:"opacity-0 group-hover:opacity-100 transition-opacity text-gray-400 hover:text-red-500 p-1",children:(0,t.jsx)(b.X,{className:"w-4 h-4"})})]},`${a}-${l}`))})]})]})]})}function v({groups:e,onGroupsChange:r,availableModels:a,maxFallbacks:l=10,maxGroups:n=5}){let[o,s]=(0,p.useState)(e.length>0?e[0].id:"1");(0,p.useEffect)(()=>{e.length>0?e.some(e=>e.id===o)||s(e[0].id):s("1")},[e]);let i=()=>{if(e.length>=n)return;let t=Date.now().toString();r([...e,{id:t,primaryModel:null,fallbackModels:[]}]),s(t)},c=t=>{r(e.map(e=>e.id===t.id?t:e))},f=e.map((r,n)=>{let o=r.primaryModel?r.primaryModel:`Group ${n+1}`;return{key:r.id,label:o,closable:e.length>1,children:(0,t.jsx)(y,{group:r,onChange:c,availableModels:a,maxFallbacks:l})}});return 0===e.length?(0,t.jsxs)("div",{className:"text-center py-12 bg-gray-50 rounded-lg border border-dashed border-gray-300",children:[(0,t.jsx)("p",{className:"text-gray-500 mb-4",children:"No fallback groups configured"}),(0,t.jsx)(d.Button,{variant:"primary",onClick:i,icon:()=>(0,t.jsx)(g.Plus,{className:"w-4 h-4"}),children:"Create First Group"})]}):(0,t.jsx)(m.Tabs,{type:"editable-card",activeKey:o,onChange:s,onEdit:(t,a)=>{"add"===a?i():"remove"===a&&e.length>1&&(t=>{if(1===e.length)return u.message.warning("At least one group is required");let a=e.filter(e=>e.id!==t);r(a),o===t&&a.length>0&&s(a[a.length-1].id)})(t)},items:f,className:"fallback-tabs",tabBarStyle:{marginBottom:0},hideAdd:e.length>=n})}e.s(["FallbackSelectionForm",()=>v],419470)},653496,e=>{"use strict";var t=e.i(721369);e.s(["Tabs",()=>t.default])},599724,936325,e=>{"use strict";var t=e.i(95779),r=e.i(444755),a=e.i(673706),l=e.i(271645);let n=l.default.forwardRef((e,n)=>{let{color:o,className:s,children:i}=e;return l.default.createElement("p",{ref:n,className:(0,r.tremorTwMerge)("text-tremor-default",o?(0,a.getColorClassNames)(o,t.colorPalette.text).textColor:(0,r.tremorTwMerge)("text-tremor-content","dark:text-dark-tremor-content"),s)},i)});n.displayName="Text",e.s(["default",()=>n],936325),e.s(["Text",()=>n],599724)},994388,e=>{"use strict";var t=e.i(290571),r=e.i(829087),a=e.i(271645);let l=["preEnter","entering","entered","preExit","exiting","exited","unmounted"],n=e=>({_s:e,status:l[e],isEnter:e<3,isMounted:6!==e,isResolved:2===e||e>4}),o=e=>e?6:5,s=(e,t,r,a,l)=>{clearTimeout(a.current);let o=n(e);t(o),r.current=o,l&&l({current:o})};var i=e.i(480731),c=e.i(444755),d=e.i(673706);let u=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 g={xs:{height:"h-4",width:"w-4"},sm:{height:"h-5",width:"w-5"},md:{height:"h-5",width:"w-5"},lg:{height:"h-6",width:"w-6"},xl:{height:"h-6",width:"w-6"}},p=(e,t)=>{switch(e){case"primary":return{textColor:t?(0,d.getColorClassNames)("white").textColor:"text-tremor-brand-inverted dark:text-dark-tremor-brand-inverted",hoverTextColor:t?(0,d.getColorClassNames)("white").textColor:"text-tremor-brand-inverted dark:text-dark-tremor-brand-inverted",bgColor:t?(0,d.getColorClassNames)(t,m.colorPalette.background).bgColor:"bg-tremor-brand dark:bg-dark-tremor-brand",hoverBgColor:t?(0,d.getColorClassNames)(t,m.colorPalette.darkBackground).hoverBgColor:"hover:bg-tremor-brand-emphasis dark:hover:bg-dark-tremor-brand-emphasis",borderColor:t?(0,d.getColorClassNames)(t,m.colorPalette.border).borderColor:"border-tremor-brand dark:border-dark-tremor-brand",hoverBorderColor:t?(0,d.getColorClassNames)(t,m.colorPalette.darkBorder).hoverBorderColor:"hover:border-tremor-brand-emphasis dark:hover:border-dark-tremor-brand-emphasis"};case"secondary":return{textColor:t?(0,d.getColorClassNames)(t,m.colorPalette.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",hoverTextColor:t?(0,d.getColorClassNames)(t,m.colorPalette.text).textColor:"hover:text-tremor-brand-emphasis dark:hover:text-dark-tremor-brand-emphasis",bgColor:(0,d.getColorClassNames)("transparent").bgColor,hoverBgColor:t?(0,c.tremorTwMerge)((0,d.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,d.getColorClassNames)(t,m.colorPalette.border).borderColor:"border-tremor-brand dark:border-dark-tremor-brand"};case"light":return{textColor:t?(0,d.getColorClassNames)(t,m.colorPalette.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",hoverTextColor:t?(0,d.getColorClassNames)(t,m.colorPalette.darkText).hoverTextColor:"hover:text-tremor-brand-emphasis dark:hover:text-dark-tremor-brand-emphasis",bgColor:(0,d.getColorClassNames)("transparent").bgColor,borderColor:"",hoverBorderColor:""}}},f=(0,d.makeClassName)("Button"),h=({loading:e,iconSize:t,iconPosition:r,Icon:l,needMargin:n,transitionStatus:o})=>{let s=n?r===i.HorizontalPositions.Left?(0,c.tremorTwMerge)("-ml-1","mr-1.5"):(0,c.tremorTwMerge)("-mr-1","ml-1.5"):"",d=(0,c.tremorTwMerge)("w-0 h-0"),m={default:d,entering:d,entered:t,exiting:t,exited:d};return e?a.default.createElement(u,{className:(0,c.tremorTwMerge)(f("icon"),"animate-spin shrink-0",s,m.default,m[o]),style:{transition:"width 150ms"}}):a.default.createElement(l,{className:(0,c.tremorTwMerge)(f("icon"),"shrink-0",t,s)})},x=a.default.forwardRef((e,l)=>{let{icon:u,iconPosition:m=i.HorizontalPositions.Left,size:x=i.Sizes.SM,color:b,variant:y="primary",disabled:v,loading:w=!1,loadingText:k,children:C,tooltip:j,className:N}=e,S=(0,t.__rest)(e,["icon","iconPosition","size","color","variant","disabled","loading","loadingText","children","tooltip","className"]),M=w||v,T=void 0!==u||w,E=w&&k,O=!(!C&&!E),P=(0,c.tremorTwMerge)(g[x].height,g[x].width),$="light"!==y?(0,c.tremorTwMerge)("rounded-tremor-default border","shadow-tremor-input","dark:shadow-dark-tremor-input"):"",_=p(y,b),R=("light"!==y?{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"}})[x],{tooltipProps:L,getReferenceProps:z}=(0,r.useTooltip)(300),[B,D]=(({enter:e=!0,exit:t=!0,preEnter:r,preExit:l,timeout:i,initialEntered:c,mountOnEnter:d,unmountOnExit:u,onStateChange:m}={})=>{let[g,p]=(0,a.useState)(()=>n(c?2:o(d))),f=(0,a.useRef)(g),h=(0,a.useRef)(0),[x,b]="object"==typeof i?[i.enter,i.exit]:[i,i],y=(0,a.useCallback)(()=>{let e=((e,t)=>{switch(e){case 1:case 0:return 2;case 4:case 3:return o(t)}})(f.current._s,u);e&&s(e,p,f,h,m)},[m,u]);return[g,(0,a.useCallback)(a=>{let n=e=>{switch(s(e,p,f,h,m),e){case 1:x>=0&&(h.current=((...e)=>setTimeout(...e))(y,x));break;case 4:b>=0&&(h.current=((...e)=>setTimeout(...e))(y,b));break;case 0:case 3:h.current=((...e)=>setTimeout(...e))(()=>{isNaN(document.body.offsetTop)||n(e+1)},0)}},i=f.current.isEnter;"boolean"!=typeof a&&(a=!i),a?i||n(e?+!r:2):i&&n(t?l?3:4:o(u))},[y,m,e,t,r,l,x,b,u]),y]})({timeout:50});return(0,a.useEffect)(()=>{D(w)},[w]),a.default.createElement("button",Object.assign({ref:(0,d.mergeRefs)([l,L.refs.setReference]),className:(0,c.tremorTwMerge)(f("root"),"shrink-0 inline-flex justify-center items-center group font-medium outline-none",$,R.paddingX,R.paddingY,R.fontSize,_.textColor,_.bgColor,_.borderColor,_.hoverBorderColor,M?"opacity-50 cursor-not-allowed":(0,c.tremorTwMerge)(p(y,b).hoverTextColor,p(y,b).hoverBgColor,p(y,b).hoverBorderColor),N),disabled:M},z,S),a.default.createElement(r.default,Object.assign({text:j},L)),T&&m!==i.HorizontalPositions.Right?a.default.createElement(h,{loading:w,iconSize:P,iconPosition:m,Icon:u,transitionStatus:B.status,needMargin:O}):null,E||C?a.default.createElement("span",{className:(0,c.tremorTwMerge)(f("text"),"text-tremor-default whitespace-nowrap")},E?k:C):null,T&&m===i.HorizontalPositions.Right?a.default.createElement(h,{loading:w,iconSize:P,iconPosition:m,Icon:u,transitionStatus:B.status,needMargin:O}):null)});x.displayName="Button",e.s(["Button",()=>x],994388)},304967,e=>{"use strict";var t=e.i(290571),r=e.i(271645),a=e.i(480731),l=e.i(95779),n=e.i(444755),o=e.i(673706);let s=(0,o.makeClassName)("Card"),i=r.default.forwardRef((e,i)=>{let{decoration:c="",decorationColor:d,children:u,className:m}=e,g=(0,t.__rest)(e,["decoration","decorationColor","children","className"]);return r.default.createElement("div",Object.assign({ref:i,className:(0,n.tremorTwMerge)(s("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",d?(0,o.getColorClassNames)(d,l.colorPalette.border).borderColor:"border-tremor-brand dark:border-dark-tremor-brand",(e=>{if(!e)return"";switch(e){case a.HorizontalPositions.Left:return"border-l-4";case a.VerticalPositions.Top:return"border-t-4";case a.HorizontalPositions.Right:return"border-r-4";case a.VerticalPositions.Bottom:return"border-b-4";default:return""}})(c),m)},g),u)});i.displayName="Card",e.s(["Card",()=>i],304967)},629569,e=>{"use strict";var t=e.i(290571),r=e.i(95779),a=e.i(444755),l=e.i(673706),n=e.i(271645);let o=n.default.forwardRef((e,o)=>{let{color:s,children:i,className:c}=e,d=(0,t.__rest)(e,["color","children","className"]);return n.default.createElement("p",Object.assign({ref:o,className:(0,a.tremorTwMerge)("font-medium text-tremor-title",s?(0,l.getColorClassNames)(s,r.colorPalette.darkText).textColor:"text-tremor-content-strong dark:text-dark-tremor-content-strong",c)},d),i)});o.displayName="Title",e.s(["Title",()=>o],629569)},91874,e=>{"use strict";var t=e.i(931067),r=e.i(209428),a=e.i(211577),l=e.i(392221),n=e.i(703923),o=e.i(343794),s=e.i(914949),i=e.i(271645),c=["prefixCls","className","style","checked","disabled","defaultChecked","type","title","onChange"],d=(0,i.forwardRef)(function(e,d){var u=e.prefixCls,m=void 0===u?"rc-checkbox":u,g=e.className,p=e.style,f=e.checked,h=e.disabled,x=e.defaultChecked,b=e.type,y=void 0===b?"checkbox":b,v=e.title,w=e.onChange,k=(0,n.default)(e,c),C=(0,i.useRef)(null),j=(0,i.useRef)(null),N=(0,s.default)(void 0!==x&&x,{value:f}),S=(0,l.default)(N,2),M=S[0],T=S[1];(0,i.useImperativeHandle)(d,function(){return{focus:function(e){var t;null==(t=C.current)||t.focus(e)},blur:function(){var e;null==(e=C.current)||e.blur()},input:C.current,nativeElement:j.current}});var E=(0,o.default)(m,g,(0,a.default)((0,a.default)({},"".concat(m,"-checked"),M),"".concat(m,"-disabled"),h));return i.createElement("span",{className:E,title:v,style:p,ref:j},i.createElement("input",(0,t.default)({},k,{className:"".concat(m,"-input"),ref:C,onChange:function(t){h||("checked"in e||T(t.target.checked),null==w||w({target:(0,r.default)((0,r.default)({},e),{},{type:y,checked:t.target.checked}),stopPropagation:function(){t.stopPropagation()},preventDefault:function(){t.preventDefault()},nativeEvent:t.nativeEvent}))},disabled:h,checked:!!M,type:y})),i.createElement("span",{className:"".concat(m,"-inner")}))});e.s(["default",0,d])},421512,236836,e=>{"use strict";let t=e.i(271645).default.createContext(null);e.s(["default",0,t],421512),e.i(296059);var r=e.i(915654),a=e.i(183293),l=e.i(246422),n=e.i(838378);function o(e,t){return(e=>{let{checkboxCls:t}=e,l=`${t}-wrapper`;return[{[`${t}-group`]:Object.assign(Object.assign({},(0,a.resetComponent)(e)),{display:"inline-flex",flexWrap:"wrap",columnGap:e.marginXS,[`> ${e.antCls}-row`]:{flex:1}}),[l]:Object.assign(Object.assign({},(0,a.resetComponent)(e)),{display:"inline-flex",alignItems:"baseline",cursor:"pointer","&:after":{display:"inline-block",width:0,overflow:"hidden",content:"'\\a0'"},[`& + ${l}`]:{marginInlineStart:0},[`&${l}-in-form-item`]:{'input[type="checkbox"]':{width:14,height:14}}}),[t]:Object.assign(Object.assign({},(0,a.resetComponent)(e)),{position:"relative",whiteSpace:"nowrap",lineHeight:1,cursor:"pointer",borderRadius:e.borderRadiusSM,alignSelf:"center",[`${t}-input`]:{position:"absolute",inset:0,zIndex:1,cursor:"pointer",opacity:0,margin:0,[`&:focus-visible + ${t}-inner`]:(0,a.genFocusOutline)(e)},[`${t}-inner`]:{boxSizing:"border-box",display:"block",width:e.checkboxSize,height:e.checkboxSize,direction:"ltr",backgroundColor:e.colorBgContainer,border:`${(0,r.unit)(e.lineWidth)} ${e.lineType} ${e.colorBorder}`,borderRadius:e.borderRadiusSM,borderCollapse:"separate",transition:`all ${e.motionDurationSlow}`,"&:after":{boxSizing:"border-box",position:"absolute",top:"50%",insetInlineStart:"25%",display:"table",width:e.calc(e.checkboxSize).div(14).mul(5).equal(),height:e.calc(e.checkboxSize).div(14).mul(8).equal(),border:`${(0,r.unit)(e.lineWidthBold)} solid ${e.colorWhite}`,borderTop:0,borderInlineStart:0,transform:"rotate(45deg) scale(0) translate(-50%,-50%)",opacity:0,content:'""',transition:`all ${e.motionDurationFast} ${e.motionEaseInBack}, opacity ${e.motionDurationFast}`}},"& + span":{paddingInlineStart:e.paddingXS,paddingInlineEnd:e.paddingXS}})},{[` ${l}:not(${l}-disabled), ${t}:not(${t}-disabled) `]:{[`&:hover ${t}-inner`]:{borderColor:e.colorPrimary}},[`${l}:not(${l}-disabled)`]:{[`&:hover ${t}-checked:not(${t}-disabled) ${t}-inner`]:{backgroundColor:e.colorPrimaryHover,borderColor:"transparent"},[`&:hover ${t}-checked:not(${t}-disabled):after`]:{borderColor:e.colorPrimaryHover}}},{[`${t}-checked`]:{[`${t}-inner`]:{backgroundColor:e.colorPrimary,borderColor:e.colorPrimary,"&:after":{opacity:1,transform:"rotate(45deg) scale(1) translate(-50%,-50%)",transition:`all ${e.motionDurationMid} ${e.motionEaseOutBack} ${e.motionDurationFast}`}}},[` ${l}-checked:not(${l}-disabled), ${t}-checked:not(${t}-disabled) - `]:{[`&:hover ${t}-inner`]:{backgroundColor:e.colorPrimaryHover,borderColor:"transparent"}}},{[t]:{"&-indeterminate":{"&":{[`${t}-inner`]:{backgroundColor:`${e.colorBgContainer}`,borderColor:`${e.colorBorder}`,"&:after":{top:"50%",insetInlineStart:"50%",width:e.calc(e.fontSizeLG).div(2).equal(),height:e.calc(e.fontSizeLG).div(2).equal(),backgroundColor:e.colorPrimary,border:0,transform:"translate(-50%, -50%) scale(1)",opacity:1,content:'""'}},[`&:hover ${t}-inner`]:{backgroundColor:`${e.colorBgContainer}`,borderColor:`${e.colorPrimary}`}}}}},{[`${l}-disabled`]:{cursor:"not-allowed"},[`${t}-disabled`]:{[`&, ${t}-input`]:{cursor:"not-allowed",pointerEvents:"none"},[`${t}-inner`]:{background:e.colorBgContainerDisabled,borderColor:e.colorBorder,"&:after":{borderColor:e.colorTextDisabled}},"&:after":{display:"none"},"& + span":{color:e.colorTextDisabled},[`&${t}-indeterminate ${t}-inner::after`]:{background:e.colorTextDisabled}}}]})((0,n.mergeToken)(t,{checkboxCls:`.${e}`,checkboxSize:t.controlInteractiveSize}))}let o=(0,l.genStyleHooks)("Checkbox",(e,{prefixCls:t})=>[s(t,e)]);e.s(["default",0,o,"getStyle",()=>s],236836)},681216,e=>{"use strict";var t=e.i(271645),r=e.i(963188);function a(e){let a=t.default.useRef(null),l=()=>{r.default.cancel(a.current),a.current=null};return[()=>{l(),a.current=(0,r.default)(()=>{a.current=null})},t=>{a.current&&(t.stopPropagation(),l()),null==e||e(t)}]}e.s(["default",()=>a])},374276,e=>{"use strict";e.i(247167);var t=e.i(271645),r=e.i(343794),a=e.i(91874),l=e.i(611935),n=e.i(121872),s=e.i(26905),o=e.i(242064),i=e.i(937328),c=e.i(321883),d=e.i(62139),u=e.i(421512),m=e.i(236836),g=e.i(681216),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 l=0,a=Object.getOwnPropertySymbols(e);lt.indexOf(a[l])&&Object.prototype.propertyIsEnumerable.call(e,a[l])&&(r[a[l]]=e[a[l]]);return r};let p=t.forwardRef((e,p)=>{var h;let{prefixCls:x,className:b,rootClassName:y,children:v,indeterminate:w=!1,style:k,onMouseEnter:C,onMouseLeave:j,skipGroup:N=!1,disabled:S}=e,M=f(e,["prefixCls","className","rootClassName","children","indeterminate","style","onMouseEnter","onMouseLeave","skipGroup","disabled"]),{getPrefixCls:T,direction:O,checkbox:E}=t.useContext(o.ConfigContext),P=t.useContext(u.default),{isFormItemInput:$}=t.useContext(d.FormItemInputContext),_=t.useContext(i.default),R=null!=(h=(null==P?void 0:P.disabled)||S)?h:_,L=t.useRef(M.value),z=t.useRef(null),B=(0,l.composeRef)(p,z);t.useEffect(()=>{null==P||P.registerValue(M.value)},[]),t.useEffect(()=>{if(!N)return M.value!==L.current&&(null==P||P.cancelValue(L.current),null==P||P.registerValue(M.value),L.current=M.value),()=>null==P?void 0:P.cancelValue(M.value)},[M.value]),t.useEffect(()=>{var e;(null==(e=z.current)?void 0:e.input)&&(z.current.input.indeterminate=w)},[w]);let D=T("checkbox",x),F=(0,c.default)(D),[I,A,H]=(0,m.default)(D,F),q=Object.assign({},M);P&&!N&&(q.onChange=(...e)=>{M.onChange&&M.onChange.apply(M,e),P.toggleOption&&P.toggleOption({label:v,value:M.value})},q.name=P.name,q.checked=P.value.includes(M.value));let V=(0,r.default)(`${D}-wrapper`,{[`${D}-rtl`]:"rtl"===O,[`${D}-wrapper-checked`]:q.checked,[`${D}-wrapper-disabled`]:R,[`${D}-wrapper-in-form-item`]:$},null==E?void 0:E.className,b,y,H,F,A),G=(0,r.default)({[`${D}-indeterminate`]:w},s.TARGET_CLS,A),[K,X]=(0,g.default)(q.onClick);return I(t.createElement(n.default,{component:"Checkbox",disabled:R},t.createElement("label",{className:V,style:Object.assign(Object.assign({},null==E?void 0:E.style),k),onMouseEnter:C,onMouseLeave:j,onClick:K},t.createElement(a.default,Object.assign({},q,{onClick:X,prefixCls:D,className:G,disabled:R,ref:B})),null!=v&&t.createElement("span",{className:`${D}-label`},v))))});var h=e.i(8211),x=e.i(529681),b=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 l=0,a=Object.getOwnPropertySymbols(e);lt.indexOf(a[l])&&Object.prototype.propertyIsEnumerable.call(e,a[l])&&(r[a[l]]=e[a[l]]);return r};let y=t.forwardRef((e,a)=>{let{defaultValue:l,children:n,options:s=[],prefixCls:i,className:d,rootClassName:g,style:f,onChange:y}=e,v=b(e,["defaultValue","children","options","prefixCls","className","rootClassName","style","onChange"]),{getPrefixCls:w,direction:k}=t.useContext(o.ConfigContext),[C,j]=t.useState(v.value||l||[]),[N,S]=t.useState([]);t.useEffect(()=>{"value"in v&&j(v.value||[])},[v.value]);let M=t.useMemo(()=>s.map(e=>"string"==typeof e||"number"==typeof e?{label:e,value:e}:e),[s]),T=e=>{S(t=>t.filter(t=>t!==e))},O=e=>{S(t=>[].concat((0,h.default)(t),[e]))},E=e=>{let t=C.indexOf(e.value),r=(0,h.default)(C);-1===t?r.push(e.value):r.splice(t,1),"value"in v||j(r),null==y||y(r.filter(e=>N.includes(e)).sort((e,t)=>M.findIndex(t=>t.value===e)-M.findIndex(e=>e.value===t)))},P=w("checkbox",i),$=`${P}-group`,_=(0,c.default)(P),[R,L,z]=(0,m.default)(P,_),B=(0,x.default)(v,["value","disabled"]),D=s.length?M.map(e=>t.createElement(p,{prefixCls:P,key:e.value.toString(),disabled:"disabled"in e?e.disabled:v.disabled,value:e.value,checked:C.includes(e.value),onChange:e.onChange,className:(0,r.default)(`${$}-item`,e.className),style:e.style,title:e.title,id:e.id,required:e.required},e.label)):n,F=t.useMemo(()=>({toggleOption:E,value:C,disabled:v.disabled,name:v.name,registerValue:O,cancelValue:T}),[E,C,v.disabled,v.name,O,T]),I=(0,r.default)($,{[`${$}-rtl`]:"rtl"===k},d,g,z,_,L);return R(t.createElement("div",Object.assign({className:I,style:f},B,{ref:a}),t.createElement(u.default.Provider,{value:F},D)))});p.Group=y,p.__ANT_CHECKBOX=!0,e.s(["default",0,p],374276)},536916,e=>{"use strict";var t=e.i(374276);e.s(["Checkbox",()=>t.default])},292639,e=>{"use strict";var t=e.i(764205),r=e.i(266027);let a=(0,e.i(243652).createQueryKeys)("uiSettings");e.s(["useUISettings",0,()=>(0,r.useQuery)({queryKey:a.list({}),queryFn:async()=>await (0,t.getUiSettings)(),staleTime:36e5,gcTime:36e5})])},250980,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3m0 0v3m0-3h3m-3 0H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z"}))});e.s(["PlusCircleIcon",0,r],250980)},502547,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"}))});e.s(["ChevronRightIcon",0,r],502547)},384767,e=>{"use strict";var t=e.i(843476),r=e.i(599724),a=e.i(271645),l=e.i(389083);let n=a.forwardRef(function(e,t){return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 7v10c0 2.21 3.582 4 8 4s8-1.79 8-4V7M4 7c0 2.21 3.582 4 8 4s8-1.79 8-4M4 7c0-2.21 3.582-4 8-4s8 1.79 8 4m0 5c0 2.21-3.582 4-8 4s-8-1.79-8-4"}))});var s=e.i(764205);let o=function({vectorStores:e,accessToken:o}){let[i,c]=(0,a.useState)([]);return(0,a.useEffect)(()=>{(async()=>{if(o&&0!==e.length)try{let e=await (0,s.vectorStoreListCall)(o);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)}})()},[o,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)(n,{className:"h-4 w-4 text-blue-600"}),(0,t.jsx)(r.Text,{className:"font-semibold text-gray-900",children:"Vector Stores"}),(0,t.jsx)(l.Badge,{color:"blue",size:"xs",children:e.length})]}),e.length>0?(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:e.map((e,r)=>{let a;return(0,t.jsx)("div",{className:"inline-flex items-center px-3 py-1.5 rounded-lg bg-blue-50 border border-blue-200 text-blue-800 text-sm font-medium",children:(a=i.find(t=>t.vector_store_id===e))?`${a.vector_store_name||a.vector_store_id} (${a.vector_store_id})`:e},r)})}):(0,t.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-50 border border-gray-200",children:[(0,t.jsx)(n,{className:"h-4 w-4 text-gray-400"}),(0,t.jsx)(r.Text,{className:"text-gray-500 text-sm",children:"No vector stores configured"})]})]})},i=a.forwardRef(function(e,t){return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 12h14M5 12a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v4a2 2 0 01-2 2M5 12a2 2 0 00-2 2v4a2 2 0 002 2h14a2 2 0 002-2v-4a2 2 0 00-2-2m-2-4h.01M17 16h.01"}))});var c=e.i(871943),d=e.i(502547),u=e.i(592968);let m=function({mcpServers:n,mcpAccessGroups:o=[],mcpToolPermissions:m={},accessToken:g}){let[f,p]=(0,a.useState)([]),[h,x]=(0,a.useState)([]),[b,y]=(0,a.useState)(new Set);(0,a.useEffect)(()=>{(async()=>{if(g&&n.length>0)try{let e=await (0,s.fetchMCPServers)(g);e&&Array.isArray(e)?p(e):e.data&&Array.isArray(e.data)&&p(e.data)}catch(e){console.error("Error fetching MCP servers:",e)}})()},[g,n.length]),(0,a.useEffect)(()=>{(async()=>{if(g&&o.length>0)try{let t=await e.A(601236).then(e=>e.fetchMCPAccessGroups(g));x(Array.isArray(t)?t:t.data||[])}catch(e){console.error("Error fetching MCP access groups:",e)}})()},[g,o.length]);let v=[...n.map(e=>({type:"server",value:e})),...o.map(e=>({type:"accessGroup",value:e}))],w=v.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)(i,{className:"h-4 w-4 text-blue-600"}),(0,t.jsx)(r.Text,{className:"font-semibold text-gray-900",children:"MCP Servers"}),(0,t.jsx)(l.Badge,{color:"blue",size:"xs",children:w})]}),w>0?(0,t.jsx)("div",{className:"max-h-[400px] overflow-y-auto space-y-2 pr-1",children:v.map((e,r)=>{let a="server"===e.type?m[e.value]:void 0,l=a&&a.length>0,n=b.has(e.value);return(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{onClick:()=>{var t;return l&&(t=e.value,void y(e=>{let r=new Set(e);return r.has(t)?r.delete(t):r.add(t),r}))},className:`flex items-center gap-3 py-2 px-3 rounded-lg border border-gray-200 transition-all ${l?"cursor-pointer hover:bg-gray-50 hover:border-gray-300":"bg-white"}`,children:[(0,t.jsx)("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:"server"===e.type?(0,t.jsx)(u.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=f.find(t=>t.server_id===e);if(t){let r=e.length>7?`${e.slice(0,3)}...${e.slice(-4)}`:e;return`${t.alias} (${r})`}return e})(e.value)})]})}):(0,t.jsxs)("div",{className:"inline-flex items-center gap-2 min-w-0",children:[(0,t.jsx)("span",{className:"inline-block w-1.5 h-1.5 bg-green-500 rounded-full flex-shrink-0"}),(0,t.jsx)("span",{className:"text-sm font-medium text-gray-900 truncate",children:e.value}),(0,t.jsx)("span",{className:"ml-1 px-1.5 py-0.5 text-[9px] font-semibold text-green-600 bg-green-50 border border-green-200 rounded uppercase tracking-wide flex-shrink-0",children:"Group"})]})}),l&&(0,t.jsxs)("div",{className:"flex items-center gap-1 flex-shrink-0 whitespace-nowrap",children:[(0,t.jsx)("span",{className:"text-xs font-medium text-gray-600",children:a.length}),(0,t.jsx)("span",{className:"text-xs text-gray-500",children:1===a.length?"tool":"tools"}),n?(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&&n&&(0,t.jsx)("div",{className:"ml-4 pl-4 border-l-2 border-blue-200 pb-1",children:(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5",children:a.map((e,r)=>(0,t.jsx)("span",{className:"inline-flex items-center px-2.5 py-1 rounded-lg bg-blue-50 border border-blue-200 text-blue-800 text-xs font-medium",children:e},r))})})]},r)})}):(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)(i,{className:"h-4 w-4 text-gray-400"}),(0,t.jsx)(r.Text,{className:"text-gray-500 text-sm",children:"No MCP servers or access groups configured"})]})]})},g=a.forwardRef(function(e,t){return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z"}))}),f=function({agents:e,agentAccessGroups:n=[],accessToken:o}){let[i,c]=(0,a.useState)([]);(0,a.useEffect)(()=>{(async()=>{if(o&&e.length>0)try{let e=await (0,s.getAgentsList)(o);e&&e.agents&&Array.isArray(e.agents)&&c(e.agents)}catch(e){console.error("Error fetching agents:",e)}})()},[o,e.length]);let d=[...e.map(e=>({type:"agent",value:e})),...n.map(e=>({type:"accessGroup",value:e}))],m=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)(r.Text,{className:"font-semibold text-gray-900",children:"Agents"}),(0,t.jsx)(l.Badge,{color:"purple",size:"xs",children:m})]}),m>0?(0,t.jsx)("div",{className:"max-h-[400px] overflow-y-auto space-y-2 pr-1",children:d.map((e,r)=>(0,t.jsx)("div",{className:"space-y-2",children:(0,t.jsx)("div",{className:"flex items-center gap-3 py-2 px-3 rounded-lg border border-gray-200 bg-white",children:(0,t.jsx)("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:"agent"===e.type?(0,t.jsx)(u.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=i.find(t=>t.agent_id===e);if(t){let r=e.length>7?`${e.slice(0,3)}...${e.slice(-4)}`:e;return`${t.agent_name} (${r})`}return e})(e.value)})]})}):(0,t.jsxs)("div",{className:"inline-flex items-center gap-2 min-w-0",children:[(0,t.jsx)("span",{className:"inline-block w-1.5 h-1.5 bg-green-500 rounded-full flex-shrink-0"}),(0,t.jsx)("span",{className:"text-sm font-medium text-gray-900 truncate",children:e.value}),(0,t.jsx)("span",{className:"ml-1 px-1.5 py-0.5 text-[9px] font-semibold text-green-600 bg-green-50 border border-green-200 rounded uppercase tracking-wide flex-shrink-0",children:"Group"})]})})})},r))}):(0,t.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-50 border border-gray-200",children:[(0,t.jsx)(g,{className:"h-4 w-4 text-gray-400"}),(0,t.jsx)(r.Text,{className:"text-gray-500 text-sm",children:"No agents or access groups configured"})]})]})};e.s(["default",0,function({objectPermission:e,variant:a="card",className:l="",accessToken:n}){let s=e?.vector_stores||[],i=e?.mcp_servers||[],c=e?.mcp_access_groups||[],d=e?.mcp_tool_permissions||{},u=e?.agents||[],g=e?.agent_access_groups||[],p=(0,t.jsxs)("div",{className:"card"===a?"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6":"space-y-4",children:[(0,t.jsx)(o,{vectorStores:s,accessToken:n}),(0,t.jsx)(m,{mcpServers:i,mcpAccessGroups:c,mcpToolPermissions:d,accessToken:n}),(0,t.jsx)(f,{agents:u,agentAccessGroups:g,accessToken:n})]});return"card"===a?(0,t.jsxs)("div",{className:`bg-white border border-gray-200 rounded-lg p-6 ${l}`,children:[(0,t.jsx)("div",{className:"flex items-center gap-2 mb-6",children:(0,t.jsxs)("div",{children:[(0,t.jsx)(r.Text,{className:"font-semibold text-gray-900",children:"Object Permissions"}),(0,t.jsx)(r.Text,{className:"text-xs text-gray-500",children:"Access control for Vector Stores and MCP Servers"})]})}),p]}):(0,t.jsxs)("div",{className:`${l}`,children:[(0,t.jsx)(r.Text,{className:"font-medium text-gray-900 mb-3",children:"Object Permissions"}),p]})}],384767)}]); \ No newline at end of file + `]:{[`&:hover ${t}-inner`]:{backgroundColor:e.colorPrimaryHover,borderColor:"transparent"}}},{[t]:{"&-indeterminate":{"&":{[`${t}-inner`]:{backgroundColor:`${e.colorBgContainer}`,borderColor:`${e.colorBorder}`,"&:after":{top:"50%",insetInlineStart:"50%",width:e.calc(e.fontSizeLG).div(2).equal(),height:e.calc(e.fontSizeLG).div(2).equal(),backgroundColor:e.colorPrimary,border:0,transform:"translate(-50%, -50%) scale(1)",opacity:1,content:'""'}},[`&:hover ${t}-inner`]:{backgroundColor:`${e.colorBgContainer}`,borderColor:`${e.colorPrimary}`}}}}},{[`${l}-disabled`]:{cursor:"not-allowed"},[`${t}-disabled`]:{[`&, ${t}-input`]:{cursor:"not-allowed",pointerEvents:"none"},[`${t}-inner`]:{background:e.colorBgContainerDisabled,borderColor:e.colorBorder,"&:after":{borderColor:e.colorTextDisabled}},"&:after":{display:"none"},"& + span":{color:e.colorTextDisabled},[`&${t}-indeterminate ${t}-inner::after`]:{background:e.colorTextDisabled}}}]})((0,n.mergeToken)(t,{checkboxCls:`.${e}`,checkboxSize:t.controlInteractiveSize}))}let s=(0,l.genStyleHooks)("Checkbox",(e,{prefixCls:t})=>[o(t,e)]);e.s(["default",0,s,"getStyle",()=>o],236836)},681216,e=>{"use strict";var t=e.i(271645),r=e.i(963188);function a(e){let a=t.default.useRef(null),l=()=>{r.default.cancel(a.current),a.current=null};return[()=>{l(),a.current=(0,r.default)(()=>{a.current=null})},t=>{a.current&&(t.stopPropagation(),l()),null==e||e(t)}]}e.s(["default",()=>a])},374276,e=>{"use strict";e.i(247167);var t=e.i(271645),r=e.i(343794),a=e.i(91874),l=e.i(611935),n=e.i(121872),o=e.i(26905),s=e.i(242064),i=e.i(937328),c=e.i(321883),d=e.i(62139),u=e.i(421512),m=e.i(236836),g=e.i(681216),p=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 l=0,a=Object.getOwnPropertySymbols(e);lt.indexOf(a[l])&&Object.prototype.propertyIsEnumerable.call(e,a[l])&&(r[a[l]]=e[a[l]]);return r};let f=t.forwardRef((e,f)=>{var h;let{prefixCls:x,className:b,rootClassName:y,children:v,indeterminate:w=!1,style:k,onMouseEnter:C,onMouseLeave:j,skipGroup:N=!1,disabled:S}=e,M=p(e,["prefixCls","className","rootClassName","children","indeterminate","style","onMouseEnter","onMouseLeave","skipGroup","disabled"]),{getPrefixCls:T,direction:E,checkbox:O}=t.useContext(s.ConfigContext),P=t.useContext(u.default),{isFormItemInput:$}=t.useContext(d.FormItemInputContext),_=t.useContext(i.default),R=null!=(h=(null==P?void 0:P.disabled)||S)?h:_,L=t.useRef(M.value),z=t.useRef(null),B=(0,l.composeRef)(f,z);t.useEffect(()=>{null==P||P.registerValue(M.value)},[]),t.useEffect(()=>{if(!N)return M.value!==L.current&&(null==P||P.cancelValue(L.current),null==P||P.registerValue(M.value),L.current=M.value),()=>null==P?void 0:P.cancelValue(M.value)},[M.value]),t.useEffect(()=>{var e;(null==(e=z.current)?void 0:e.input)&&(z.current.input.indeterminate=w)},[w]);let D=T("checkbox",x),F=(0,c.default)(D),[I,A,H]=(0,m.default)(D,F),q=Object.assign({},M);P&&!N&&(q.onChange=(...e)=>{M.onChange&&M.onChange.apply(M,e),P.toggleOption&&P.toggleOption({label:v,value:M.value})},q.name=P.name,q.checked=P.value.includes(M.value));let V=(0,r.default)(`${D}-wrapper`,{[`${D}-rtl`]:"rtl"===E,[`${D}-wrapper-checked`]:q.checked,[`${D}-wrapper-disabled`]:R,[`${D}-wrapper-in-form-item`]:$},null==O?void 0:O.className,b,y,H,F,A),G=(0,r.default)({[`${D}-indeterminate`]:w},o.TARGET_CLS,A),[K,X]=(0,g.default)(q.onClick);return I(t.createElement(n.default,{component:"Checkbox",disabled:R},t.createElement("label",{className:V,style:Object.assign(Object.assign({},null==O?void 0:O.style),k),onMouseEnter:C,onMouseLeave:j,onClick:K},t.createElement(a.default,Object.assign({},q,{onClick:X,prefixCls:D,className:G,disabled:R,ref:B})),null!=v&&t.createElement("span",{className:`${D}-label`},v))))});var h=e.i(8211),x=e.i(529681),b=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 l=0,a=Object.getOwnPropertySymbols(e);lt.indexOf(a[l])&&Object.prototype.propertyIsEnumerable.call(e,a[l])&&(r[a[l]]=e[a[l]]);return r};let y=t.forwardRef((e,a)=>{let{defaultValue:l,children:n,options:o=[],prefixCls:i,className:d,rootClassName:g,style:p,onChange:y}=e,v=b(e,["defaultValue","children","options","prefixCls","className","rootClassName","style","onChange"]),{getPrefixCls:w,direction:k}=t.useContext(s.ConfigContext),[C,j]=t.useState(v.value||l||[]),[N,S]=t.useState([]);t.useEffect(()=>{"value"in v&&j(v.value||[])},[v.value]);let M=t.useMemo(()=>o.map(e=>"string"==typeof e||"number"==typeof e?{label:e,value:e}:e),[o]),T=e=>{S(t=>t.filter(t=>t!==e))},E=e=>{S(t=>[].concat((0,h.default)(t),[e]))},O=e=>{let t=C.indexOf(e.value),r=(0,h.default)(C);-1===t?r.push(e.value):r.splice(t,1),"value"in v||j(r),null==y||y(r.filter(e=>N.includes(e)).sort((e,t)=>M.findIndex(t=>t.value===e)-M.findIndex(e=>e.value===t)))},P=w("checkbox",i),$=`${P}-group`,_=(0,c.default)(P),[R,L,z]=(0,m.default)(P,_),B=(0,x.default)(v,["value","disabled"]),D=o.length?M.map(e=>t.createElement(f,{prefixCls:P,key:e.value.toString(),disabled:"disabled"in e?e.disabled:v.disabled,value:e.value,checked:C.includes(e.value),onChange:e.onChange,className:(0,r.default)(`${$}-item`,e.className),style:e.style,title:e.title,id:e.id,required:e.required},e.label)):n,F=t.useMemo(()=>({toggleOption:O,value:C,disabled:v.disabled,name:v.name,registerValue:E,cancelValue:T}),[O,C,v.disabled,v.name,E,T]),I=(0,r.default)($,{[`${$}-rtl`]:"rtl"===k},d,g,z,_,L);return R(t.createElement("div",Object.assign({className:I,style:p},B,{ref:a}),t.createElement(u.default.Provider,{value:F},D)))});f.Group=y,f.__ANT_CHECKBOX=!0,e.s(["default",0,f],374276)},536916,e=>{"use strict";var t=e.i(374276);e.s(["Checkbox",()=>t.default])},292639,e=>{"use strict";var t=e.i(764205),r=e.i(266027);let a=(0,e.i(243652).createQueryKeys)("uiSettings");e.s(["useUISettings",0,()=>(0,r.useQuery)({queryKey:a.list({}),queryFn:async()=>await (0,t.getUiSettings)(),staleTime:36e5,gcTime:36e5})])},250980,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3m0 0v3m0-3h3m-3 0H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z"}))});e.s(["PlusCircleIcon",0,r],250980)},502547,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"}))});e.s(["ChevronRightIcon",0,r],502547)},384767,e=>{"use strict";var t=e.i(843476),r=e.i(599724),a=e.i(271645),l=e.i(389083);let n=a.forwardRef(function(e,t){return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 7v10c0 2.21 3.582 4 8 4s8-1.79 8-4V7M4 7c0 2.21 3.582 4 8 4s8-1.79 8-4M4 7c0-2.21 3.582-4 8-4s8 1.79 8 4m0 5c0 2.21-3.582 4-8 4s-8-1.79-8-4"}))});var o=e.i(764205);let s=function({vectorStores:e,accessToken:s}){let[i,c]=(0,a.useState)([]);return(0,a.useEffect)(()=>{(async()=>{if(s&&0!==e.length)try{let e=await (0,o.vectorStoreListCall)(s);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)}})()},[s,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)(n,{className:"h-4 w-4 text-blue-600"}),(0,t.jsx)(r.Text,{className:"font-semibold text-gray-900",children:"Vector Stores"}),(0,t.jsx)(l.Badge,{color:"blue",size:"xs",children:e.length})]}),e.length>0?(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:e.map((e,r)=>{let a;return(0,t.jsx)("div",{className:"inline-flex items-center px-3 py-1.5 rounded-lg bg-blue-50 border border-blue-200 text-blue-800 text-sm font-medium",children:(a=i.find(t=>t.vector_store_id===e))?`${a.vector_store_name||a.vector_store_id} (${a.vector_store_id})`:e},r)})}):(0,t.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-50 border border-gray-200",children:[(0,t.jsx)(n,{className:"h-4 w-4 text-gray-400"}),(0,t.jsx)(r.Text,{className:"text-gray-500 text-sm",children:"No vector stores configured"})]})]})},i=a.forwardRef(function(e,t){return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 12h14M5 12a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v4a2 2 0 01-2 2M5 12a2 2 0 00-2 2v4a2 2 0 002 2h14a2 2 0 002-2v-4a2 2 0 00-2-2m-2-4h.01M17 16h.01"}))});var c=e.i(871943),d=e.i(502547),u=e.i(592968);let m=function({mcpServers:n,mcpAccessGroups:s=[],mcpToolPermissions:m={},accessToken:g}){let[p,f]=(0,a.useState)([]),[h,x]=(0,a.useState)([]),[b,y]=(0,a.useState)(new Set);(0,a.useEffect)(()=>{(async()=>{if(g&&n.length>0)try{let e=await (0,o.fetchMCPServers)(g);e&&Array.isArray(e)?f(e):e.data&&Array.isArray(e.data)&&f(e.data)}catch(e){console.error("Error fetching MCP servers:",e)}})()},[g,n.length]),(0,a.useEffect)(()=>{(async()=>{if(g&&s.length>0)try{let t=await e.A(601236).then(e=>e.fetchMCPAccessGroups(g));x(Array.isArray(t)?t:t.data||[])}catch(e){console.error("Error fetching MCP access groups:",e)}})()},[g,s.length]);let v=[...n.map(e=>({type:"server",value:e})),...s.map(e=>({type:"accessGroup",value:e}))],w=v.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)(i,{className:"h-4 w-4 text-blue-600"}),(0,t.jsx)(r.Text,{className:"font-semibold text-gray-900",children:"MCP Servers"}),(0,t.jsx)(l.Badge,{color:"blue",size:"xs",children:w})]}),w>0?(0,t.jsx)("div",{className:"max-h-[400px] overflow-y-auto space-y-2 pr-1",children:v.map((e,r)=>{let a="server"===e.type?m[e.value]:void 0,l=a&&a.length>0,n=b.has(e.value);return(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{onClick:()=>{var t;return l&&(t=e.value,void y(e=>{let r=new Set(e);return r.has(t)?r.delete(t):r.add(t),r}))},className:`flex items-center gap-3 py-2 px-3 rounded-lg border border-gray-200 transition-all ${l?"cursor-pointer hover:bg-gray-50 hover:border-gray-300":"bg-white"}`,children:[(0,t.jsx)("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:"server"===e.type?(0,t.jsx)(u.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 r=e.length>7?`${e.slice(0,3)}...${e.slice(-4)}`:e;return`${t.alias} (${r})`}return e})(e.value)})]})}):(0,t.jsxs)("div",{className:"inline-flex items-center gap-2 min-w-0",children:[(0,t.jsx)("span",{className:"inline-block w-1.5 h-1.5 bg-green-500 rounded-full flex-shrink-0"}),(0,t.jsx)("span",{className:"text-sm font-medium text-gray-900 truncate",children:e.value}),(0,t.jsx)("span",{className:"ml-1 px-1.5 py-0.5 text-[9px] font-semibold text-green-600 bg-green-50 border border-green-200 rounded uppercase tracking-wide flex-shrink-0",children:"Group"})]})}),l&&(0,t.jsxs)("div",{className:"flex items-center gap-1 flex-shrink-0 whitespace-nowrap",children:[(0,t.jsx)("span",{className:"text-xs font-medium text-gray-600",children:a.length}),(0,t.jsx)("span",{className:"text-xs text-gray-500",children:1===a.length?"tool":"tools"}),n?(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&&n&&(0,t.jsx)("div",{className:"ml-4 pl-4 border-l-2 border-blue-200 pb-1",children:(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5",children:a.map((e,r)=>(0,t.jsx)("span",{className:"inline-flex items-center px-2.5 py-1 rounded-lg bg-blue-50 border border-blue-200 text-blue-800 text-xs font-medium",children:e},r))})})]},r)})}):(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)(i,{className:"h-4 w-4 text-gray-400"}),(0,t.jsx)(r.Text,{className:"text-gray-500 text-sm",children:"No MCP servers or access groups configured"})]})]})},g=a.forwardRef(function(e,t){return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z"}))}),p=function({agents:e,agentAccessGroups:n=[],accessToken:s}){let[i,c]=(0,a.useState)([]);(0,a.useEffect)(()=>{(async()=>{if(s&&e.length>0)try{let e=await (0,o.getAgentsList)(s);e&&e.agents&&Array.isArray(e.agents)&&c(e.agents)}catch(e){console.error("Error fetching agents:",e)}})()},[s,e.length]);let d=[...e.map(e=>({type:"agent",value:e})),...n.map(e=>({type:"accessGroup",value:e}))],m=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)(r.Text,{className:"font-semibold text-gray-900",children:"Agents"}),(0,t.jsx)(l.Badge,{color:"purple",size:"xs",children:m})]}),m>0?(0,t.jsx)("div",{className:"max-h-[400px] overflow-y-auto space-y-2 pr-1",children:d.map((e,r)=>(0,t.jsx)("div",{className:"space-y-2",children:(0,t.jsx)("div",{className:"flex items-center gap-3 py-2 px-3 rounded-lg border border-gray-200 bg-white",children:(0,t.jsx)("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:"agent"===e.type?(0,t.jsx)(u.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=i.find(t=>t.agent_id===e);if(t){let r=e.length>7?`${e.slice(0,3)}...${e.slice(-4)}`:e;return`${t.agent_name} (${r})`}return e})(e.value)})]})}):(0,t.jsxs)("div",{className:"inline-flex items-center gap-2 min-w-0",children:[(0,t.jsx)("span",{className:"inline-block w-1.5 h-1.5 bg-green-500 rounded-full flex-shrink-0"}),(0,t.jsx)("span",{className:"text-sm font-medium text-gray-900 truncate",children:e.value}),(0,t.jsx)("span",{className:"ml-1 px-1.5 py-0.5 text-[9px] font-semibold text-green-600 bg-green-50 border border-green-200 rounded uppercase tracking-wide flex-shrink-0",children:"Group"})]})})})},r))}):(0,t.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-50 border border-gray-200",children:[(0,t.jsx)(g,{className:"h-4 w-4 text-gray-400"}),(0,t.jsx)(r.Text,{className:"text-gray-500 text-sm",children:"No agents or access groups configured"})]})]})};e.s(["default",0,function({objectPermission:e,variant:a="card",className:l="",accessToken:n}){let o=e?.vector_stores||[],i=e?.mcp_servers||[],c=e?.mcp_access_groups||[],d=e?.mcp_tool_permissions||{},u=e?.agents||[],g=e?.agent_access_groups||[],f=(0,t.jsxs)("div",{className:"card"===a?"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6":"space-y-4",children:[(0,t.jsx)(s,{vectorStores:o,accessToken:n}),(0,t.jsx)(m,{mcpServers:i,mcpAccessGroups:c,mcpToolPermissions:d,accessToken:n}),(0,t.jsx)(p,{agents:u,agentAccessGroups:g,accessToken:n})]});return"card"===a?(0,t.jsxs)("div",{className:`bg-white border border-gray-200 rounded-lg p-6 ${l}`,children:[(0,t.jsx)("div",{className:"flex items-center gap-2 mb-6",children:(0,t.jsxs)("div",{children:[(0,t.jsx)(r.Text,{className:"font-semibold text-gray-900",children:"Object Permissions"}),(0,t.jsx)(r.Text,{className:"text-xs text-gray-500",children:"Access control for Vector Stores and MCP Servers"})]})}),f]}):(0,t.jsxs)("div",{className:`${l}`,children:[(0,t.jsx)(r.Text,{className:"font-medium text-gray-900 mb-3",children:"Object Permissions"}),f]})}],384767)}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/2f9ed92e7b7cd792.js b/litellm/proxy/_experimental/out/_next/static/chunks/2f9ed92e7b7cd792.js deleted file mode 100644 index 47b035afd1..0000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/2f9ed92e7b7cd792.js +++ /dev/null @@ -1 +0,0 @@ -(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"},i="../ui/assets/logos/",o={"A2A Agent":`${i}a2a_agent.png`,Ai21:`${i}ai21.svg`,"Ai21 Chat":`${i}ai21.svg`,"AI/ML API":`${i}aiml_api.svg`,"Aiohttp Openai":`${i}openai_small.svg`,Anthropic:`${i}anthropic.svg`,"Anthropic Text":`${i}anthropic.svg`,AssemblyAI:`${i}assemblyai_small.png`,Azure:`${i}microsoft_azure.svg`,"Azure AI Foundry (Studio)":`${i}microsoft_azure.svg`,"Azure Text":`${i}microsoft_azure.svg`,Baseten:`${i}baseten.svg`,"Amazon Bedrock":`${i}bedrock.svg`,"Amazon Bedrock Mantle":`${i}bedrock.svg`,"AWS SageMaker":`${i}bedrock.svg`,Cerebras:`${i}cerebras.svg`,Cloudflare:`${i}cloudflare.svg`,Codestral:`${i}mistral.svg`,Cohere:`${i}cohere.svg`,"Cohere Chat":`${i}cohere.svg`,Cometapi:`${i}cometapi.svg`,Cursor:`${i}cursor.svg`,"Databricks (Qwen API)":`${i}databricks.svg`,Dashscope:`${i}dashscope.svg`,Deepseek:`${i}deepseek.svg`,Deepgram:`${i}deepgram.png`,DeepInfra:`${i}deepinfra.png`,ElevenLabs:`${i}elevenlabs.png`,"Fal AI":`${i}fal_ai.jpg`,"Featherless Ai":`${i}featherless.svg`,"Fireworks AI":`${i}fireworks.svg`,Friendliai:`${i}friendli.svg`,"Github Copilot":`${i}github_copilot.svg`,"Google AI Studio":`${i}google.svg`,GradientAI:`${i}gradientai.svg`,Groq:`${i}groq.svg`,vllm:`${i}vllm.png`,Huggingface:`${i}huggingface.svg`,Hyperbolic:`${i}hyperbolic.svg`,Infinity:`${i}infinity.png`,"Jina AI":`${i}jina.png`,"Lambda Ai":`${i}lambda.svg`,"Lm Studio":`${i}lmstudio.svg`,"Meta Llama":`${i}meta_llama.svg`,MiniMax:`${i}minimax.svg`,"Mistral AI":`${i}mistral.svg`,Moonshot:`${i}moonshot.svg`,Morph:`${i}morph.svg`,Nebius:`${i}nebius.svg`,Novita:`${i}novita.svg`,"Nvidia Nim":`${i}nvidia_nim.svg`,Ollama:`${i}ollama.svg`,"Ollama Chat":`${i}ollama.svg`,Oobabooga:`${i}openai_small.svg`,OpenAI:`${i}openai_small.svg`,"Openai Like":`${i}openai_small.svg`,"OpenAI Text Completion":`${i}openai_small.svg`,"OpenAI-Compatible Text Completion Models (Together AI, etc.)":`${i}openai_small.svg`,"OpenAI-Compatible Endpoints (Together AI, etc.)":`${i}openai_small.svg`,Openrouter:`${i}openrouter.svg`,"Oracle Cloud Infrastructure (OCI)":`${i}oracle.svg`,Perplexity:`${i}perplexity-ai.svg`,Recraft:`${i}recraft.svg`,Replicate:`${i}replicate.svg`,RunwayML:`${i}runwayml.png`,Sagemaker:`${i}bedrock.svg`,Sambanova:`${i}sambanova.svg`,"SAP Generative AI Hub":`${i}sap.png`,Snowflake:`${i}snowflake.svg`,"Text-Completion-Codestral":`${i}mistral.svg`,TogetherAI:`${i}togetherai.svg`,Topaz:`${i}topaz.svg`,Triton:`${i}nvidia_triton.png`,V0:`${i}v0.svg`,"Vercel Ai Gateway":`${i}vercel.svg`,"Vertex AI (Anthropic, Gemini, etc.)":`${i}google.svg`,"Vertex Ai Beta":`${i}google.svg`,Vllm:`${i}vllm.png`,VolcEngine:`${i}volcengine.png`,"Voyage AI":`${i}voyage.webp`,Watsonx:`${i}watsonx.svg`,"Watsonx Text":`${i}watsonx.svg`,xAI:`${i}xai.svg`,Xinference:`${i}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:o[e],displayName:e}}let t=Object.keys(a).find(t=>a[t].toLowerCase()===e.toLowerCase());if(!t)return{logo:"",displayName:e};let i=r[t];return{logo:o[i],displayName:i}},"getProviderModels",0,(e,t)=>{console.log(`Provider key: ${e}`);let r=a[e];console.log(`Provider mapped to: ${r}`);let i=[];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))&&i.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&&i.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&&i.push(e)}))),i},"providerLogoMap",0,o,"provider_map",0,a])},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])},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 i(e,r){let[i,o]=(0,t.useState)(e),n=function(e,r){let[i]=(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 i.setOptions(r),i}(o,r);return[i,n.maybeExecute,n]}e.s(["useDebouncedState",()=>i],152473)},738014,e=>{"use strict";var t=e.i(135214),r=e.i(764205),a=e.i(266027);let i=(0,e.i(243652).createQueryKeys)("users");e.s(["useCurrentUser",0,()=>{let{accessToken:e,userId:o,userRole:n}=(0,t.default)();return(0,a.useQuery)({queryKey:i.detail(o),queryFn:async()=>{let t=await (0,r.userInfoCall)(e,o,n,!1,null,null);return console.log(`userInfo: ${JSON.stringify(t)}`),t.user_info},enabled:!!(e&&o&&n)})}])},906579,e=>{"use strict";e.i(247167);var t=e.i(271645),r=e.i(343794),a=e.i(361275),i=e.i(702779),o=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%)"}}),f=new l.Keyframes("antZoomBadgeOut",{"0%":{transform:"scale(1) translate(50%, -50%)"},"100%":{transform:"scale(0) translate(50%, -50%)",opacity:0}}),h=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:i}=e,o=e.colorTextLightSolid,n=e.colorError,s=e.colorErrorHover;return(0,m.mergeToken)(e,{badgeFontHeight:t,badgeShadowSize:r,badgeTextColor:o,badgeColor:n,badgeColorHover:s,badgeShadowColor:i,badgeProcessingDuration:"1.2s",badgeRibbonOffset:a,badgeRibbonCornerTransform:"scaleY(0.75)",badgeRibbonCornerFilter:"brightness(75%)"})},y=e=>{let{fontSize:t,lineHeight:r,fontSizeSM:a,lineWidth:i}=e;return{indicatorZIndex:"auto",indicatorHeight:Math.round(t*r)-2*i,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:i,textFontSize:o,textFontSizeSM:n,statusSize:l,dotSize:d,textFontWeight:m,indicatorHeight:A,indicatorHeightSM:y,marginXS:O,calc:x}=e,C=`${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:o,lineHeight:(0,s.unit)(A),whiteSpace:"nowrap",textAlign:"center",background:e.badgeColor,borderRadius:x(A).div(2).equal(),boxShadow:`0 0 0 ${(0,s.unit)(i)} ${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:x(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)(i)} ${e.badgeShadowColor}`},[`${t}-count, ${t}-dot, ${C}-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:i,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:f,animationDuration:e.motionDurationSlow,animationTimingFunction:e.motionEaseOutBack,animationFillMode:"both"},[`&${t}-not-a-wrapper`]:{[`${t}-zoom-appear, ${t}-zoom-enter`]:{animationName:h,animationDuration:e.motionDurationSlow,animationTimingFunction:e.motionEaseOutBack},[`${t}-zoom-leave`]:{animationName:b,animationDuration:e.motionDurationSlow,animationTimingFunction:e.motionEaseOutBack},[`&:not(${t}-status)`]:{verticalAlign:"middle"},[`${C}-custom-component, ${t}-count`]:{transform:"none"},[`${C}-custom-component, ${C}`]:{position:"relative",top:"auto",display:"block",transformOrigin:"50% 50%"}},[C]:{overflow:"hidden",transition:`all ${e.motionDurationMid} ${e.motionEaseOutBack}`,[`${C}-only`]:{position:"relative",display:"inline-block",height:A,transition:`all ${e.motionDurationSlow} ${e.motionEaseOutBack}`,WebkitTransformStyle:"preserve-3d",WebkitBackfaceVisibility:"hidden",[`> p${C}-only-unit`]:{height:A,margin:0,WebkitTransformStyle:"preserve-3d",WebkitBackfaceVisibility:"hidden"}},[`${C}-symbol`]:{verticalAlign:"top"}},"&-rtl":{direction:"rtl",[`${t}-count, ${t}-dot, ${C}-custom-component`]:{transform:"translate(-50%, -50%)"}}})}})(A(e)),y),x=(0,d.genStyleHooks)(["Badge","Ribbon"],e=>(e=>{let{antCls:t,badgeFontHeight:r,marginXS:a,badgeRibbonOffset:i,calc:o}=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:i,height:i,color:"currentcolor",border:`${(0,s.unit)(o(i).div(2).equal())} solid`,transform:e.badgeRibbonCornerTransform,transformOrigin:"top",filter:e.badgeRibbonCornerFilter}}),d),{[`&${n}-placement-end`]:{insetInlineEnd:o(i).mul(-1).equal(),borderEndEndRadius:0,[`${n}-corner`]:{insetInlineEnd:0,borderInlineEndColor:"transparent",borderBlockEndColor:"transparent"}},[`&${n}-placement-start`]:{insetInlineStart:o(i).mul(-1).equal(),borderEndStartRadius:0,[`${n}-corner`]:{insetInlineStart:0,borderBlockEndColor:"transparent",borderInlineStartColor:"transparent"}},"&-rtl":{direction:"rtl"}})}})(A(e)),y),C=e=>{let a,{prefixCls:i,value:o,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)(`${i}-only-unit`,{current:n})},o)},I=e=>{let r,a,{prefixCls:i,count:o,value:n}=e,s=Number(n),l=Math.abs(o),[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(C,Object.assign({},e,{key:s,current:!0}))],a={transition:"none"};else{r=[];let i=s+10,o=[];for(let e=s;e<=i;e+=1)o.push(e);let n=de%10===c);r=(n<0?o.slice(0,u+1):o.slice(u)).map((r,a)=>t.createElement(C,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,i=0;for(;(a+10)%10!==t;)a+=r,i+=r;return i}(c,s,n)}00%)`}}return t.createElement("span",{className:`${i}-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 i=0,a=Object.getOwnPropertySymbols(e);it.indexOf(a[i])&&Object.prototype.propertyIsEnumerable.call(e,a[i])&&(r[a[i]]=e[a[i]]);return r};let $=t.forwardRef((e,a)=>{let{prefixCls:i,count:s,className:l,motionClassName:c,style:u,title:d,show:m,component:g="sup",children:p}=e,f=E(e,["prefixCls","count","className","motionClassName","style","title","show","component","children"]),{getPrefixCls:h}=t.useContext(n.ConfigContext),b=h("scroll-number",i),v=Object.assign(Object.assign({},f),{"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,o.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 i=0,a=Object.getOwnPropertySymbols(e);it.indexOf(a[i])&&Object.prototype.propertyIsEnumerable.call(e,a[i])&&(r[a[i]]=e[a[i]]);return r};let T=t.forwardRef((e,s)=>{var l,c,u,d,m;let{prefixCls:g,scrollNumberPrefixCls:p,children:f,status:h,text:b,color:v,count:A=null,overflowCount:y=99,dot:x=!1,size:C="default",title:I,offset:E,style:T,className:w,rootClassName:S,classNames:N,styles:M,showZero:R=!1}=e,P=_(e,["prefixCls","scrollNumberPrefixCls","children","status","text","color","count","overflowCount","dot","size","title","offset","style","className","rootClassName","classNames","styles","showZero"]),{getPrefixCls:k,direction:j,badge:L}=t.useContext(n.ConfigContext),D=k("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!=h||null!=v)&&V,K=null!=h||!G,U=x&&!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==L?void 0:L.style),T);let e={marginTop:E[1]};return"rtl"===j?e.left=Number.parseInt(E[0],10):e.right=-Number.parseInt(E[0],10),Object.assign(Object.assign(Object.assign({},e),null==L?void 0:L.style),T)},[j,E,T,null==L?void 0:L.style]),er=null!=I?I:"string"==typeof Z||"number"==typeof Z?Z:void 0,ea=!X&&(0===b?R:!!b&&!0!==b),ei=ea?t.createElement("span",{className:`${D}-status-text`},b):null,eo=Z&&"object"==typeof Z?(0,o.cloneElement)(Z,e=>({style:Object.assign(Object.assign({},et),e.style)})):void 0,en=(0,i.isPresetColor)(v,!1),es=(0,r.default)(null==N?void 0:N.indicator,null==(l=null==L?void 0:L.classNames)?void 0:l.indicator,{[`${D}-status-dot`]:W,[`${D}-status-${h}`]:!!h,[`${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`]:!f,[`${D}-rtl`]:"rtl"===j},w,S,null==L?void 0:L.className,null==(c=null==L?void 0:L.classNames)?void 0:c.root,null==N?void 0:N.root,F,z);if(!f&&W&&(b||K||!V)){let e=et.color;return B(t.createElement("span",Object.assign({},P,{className:ec,style:Object.assign(Object.assign(Object.assign({},null==M?void 0:M.root),null==(u=null==L?void 0:L.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==L?void 0:L.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},P,{className:ec,style:Object.assign(Object.assign({},null==(m=null==L?void 0:L.styles)?void 0:m.root),null==M?void 0:M.root)}),f,t.createElement(a.default,{visible:!X,motionName:`${D}-zoom`,motionAppear:!1,motionDeadline:1e3},({className:e})=>{var a,i;let o=k("scroll-number",p),n=ee.current,s=(0,r.default)(null==N?void 0:N.indicator,null==(a=null==L?void 0:L.classNames)?void 0:a.indicator,{[`${D}-dot`]:n,[`${D}-count`]:!n,[`${D}-count-sm`]:"small"===C,[`${D}-multiple-words`]:!n&&J&&J.toString().length>1,[`${D}-status-${h}`]:!!h,[`${D}-color-${v}`]:en}),l=Object.assign(Object.assign(Object.assign({},null==M?void 0:M.indicator),null==(i=null==L?void 0:L.styles)?void 0:i.indicator),et);return v&&!en&&((l=l||{}).background=v),t.createElement($,{prefixCls:o,show:!X,motionClassName:e,className:s,count:J,title:er,style:l,key:"scrollNumber"},eo)}),ei))});T.Ribbon=e=>{let{className:a,prefixCls:o,style:s,color:l,children:c,text:u,placement:d="end",rootClassName:m}=e,{getPrefixCls:g,direction:p}=t.useContext(n.ConfigContext),f=g("ribbon",o),h=`${f}-wrapper`,[b,v,A]=x(f,h),y=(0,i.isPresetColor)(l,!1),O=(0,r.default)(f,`${f}-placement-${d}`,{[`${f}-rtl`]:"rtl"===p,[`${f}-color-${l}`]:y},a),C={},I={};return l&&!y&&(C.background=l,I.color=l),b(t.createElement("div",{className:(0,r.default)(h,m,v,A)},c,t.createElement("div",{className:(0,r.default)(O,v),style:Object.assign(Object.assign({},C),s)},t.createElement("span",{className:`${f}-text`},u),t.createElement("div",{className:`${f}-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,i=super.createResult(e,t),{isFetching:o,isRefetching:n,isError:s,isRefetchError:l}=i,c=a.fetchMeta?.fetchMore?.direction,u=s&&"forward"===c,d=o&&"forward"===c,m=s&&"backward"===c,g=o&&"backward"===c;return{...i,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}}},i=e.i(469637);function o(e,t){return(0,i.useBaseQuery)(e,a,t)}e.s(["useInfiniteQuery",()=>o],621482)},785242,e=>{"use strict";var t=e.i(619273),r=e.i(266027),a=e.i(912598),i=e.i(135214),o=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 i=(0,s.getProxyBaseUrl)(),o=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=`${i?`${i}/v2/team/list`:"/v2/team/list"}?${o}`,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,o={})=>{let{accessToken:n}=(0,i.default)();return(0,r.useQuery)({queryKey:u.list({page:e,limit:a,...o}),queryFn:async()=>await c(n,e,a,o),enabled:!!n,staleTime:3e4,placeholderData:t.keepPreviousData})},"useTeam",0,e=>{let{accessToken:t}=(0,i.default)(),o=(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=o.getQueryData(l.list({}));return t?.find(t=>t.team_id===e)}})},"useTeams",0,()=>{let{accessToken:e,userId:t,userRole:a}=(0,i.default)();return(0,r.useQuery)({queryKey:l.list({}),queryFn:async()=>await (0,o.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 i({className:e="",...i}){var o,n;let s=(0,r.useId)();return o=()=>{let e=document.getAnimations().filter(e=>e instanceof CSSAnimation&&"spin"===e.animationName),t=e.find(e=>e.effect.target?.getAttribute("data-spinner-id")===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)(o,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",...i,children:[(0,t.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,t.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})}e.s(["UiLoadingSpinner",()=>i],571303)},366283,e=>{"use strict";var t=e.i(290571),r=e.i(271645),a=e.i(95779),i=e.i(444755),o=e.i(673706);let n=(0,o.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,i.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,i.tremorTwMerge)((0,o.getColorClassNames)(u,a.colorPalette.background).bgColor,(0,o.getColorClassNames)(u,a.colorPalette.darkBorder).borderColor,(0,o.getColorClassNames)(u,a.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"),d)},g),r.default.createElement("div",{className:(0,i.tremorTwMerge)(n("header"),"flex items-start")},c?r.default.createElement(c,{className:(0,i.tremorTwMerge)(n("icon"),"flex-none h-5 w-5 mr-1.5")}):null,r.default.createElement("h4",{className:(0,i.tremorTwMerge)(n("title"),"font-semibold")},l)),r.default.createElement("p",{className:(0,i.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:i="w-4 h-4"})=>{let[o,n]=(0,r.useState)(!1),{logo:s}=(0,a.getProviderLogoAndName)(e);return o||!s?(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:s,alt:`${e} logo`,className:i,onError:()=>n(!0)})}])},37091,e=>{"use strict";var t=e.i(290571),r=e.i(95779),a=e.i(444755),i=e.i(673706),o=e.i(271645);let n=o.default.forwardRef((e,n)=>{let{color:s,children:l,className:c}=e,u=(0,t.__rest)(e,["color","children","className"]);return o.default.createElement("p",Object.assign({ref:n,className:(0,a.tremorTwMerge)(s?(0,i.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,i]=(0,t.useState)([]),{accessToken:o,userId:n,userRole:s}=(0,r.default)();return(0,t.useEffect)(()=>{(async()=>{i(await (0,a.fetchTeams)(o,n,s,null))})()},[o,n,s]),{teams:e,setTeams:i}}])},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 i=t(e);return isNaN(a)?r(e,NaN):(a&&i.setDate(i.getDate()+a),i)}function i(e,a){let i=t(e);if(isNaN(a))return r(e,NaN);if(!a)return i;let o=i.getDate(),n=r(e,i.getTime());return(n.setMonth(i.getMonth()+a+1,0),o>=n.getDate())?n:(i.setFullYear(n.getFullYear(),n.getMonth(),o),i)}e.s(["toDate",()=>t],435684),e.s(["constructFrom",()=>r],96226),e.s(["addDays",()=>a],439189),e.s(["addMonths",()=>i],497245)},891547,e=>{"use strict";var t=e.i(843476),r=e.i(271645),a=e.i(199133),i=e.i(764205);e.s(["default",0,({onChange:e,value:o,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,i.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:o,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),i=e.i(764205);function o(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,i.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:o(d),optionFilterProp:"label",showSearch:!0,style:{width:"100%"}})})},"getPolicyOptionEntries",()=>o])},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 i=e.i(9583),o=r.forwardRef(function(e,o){return r.createElement(i.default,(0,t.default)({},e,{ref:o,icon:a}))});e.s(["ClockCircleOutlined",0,o],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 i=e.i(9583),o=r.forwardRef(function(e,o){return r.createElement(i.default,(0,t.default)({},e,{ref:o,icon:a}))});e.s(["ArrowLeftOutlined",0,o],447566)},954616,e=>{"use strict";var t=e.i(271645),r=e.i(114272),a=e.i(540143),i=e.i(915823),o=e.i(619273),n=class extends i.Subscribable{#e;#t=void 0;#r;#a;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,o.shallowEqualObjects)(this.options,t)||this.#e.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#r,observer:this}),t?.mutationKey&&this.options.mutationKey&&(0,o.hashKey)(t.mutationKey)!==(0,o.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.#o(e)}getCurrentResult(){return this.#t}reset(){this.#r?.removeObserver(this),this.#r=void 0,this.#i(),this.#o()}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)}#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}}#o(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 i=(0,s.useQueryClient)(r),[l]=t.useState(()=>new n(i,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(o.noop)},[l]);if(c.error&&(0,o.shouldThrowError)(l.options.throwOnError,[c.error]))throw c.error;return{...c,mutate:u,mutateAsync:c.mutate}}e.s(["useMutation",()=>l],954616)},525720,e=>{"use strict";e.i(247167);var t=e.i(271645),r=e.i(343794),a=e.i(529681),i=e.i(908286),o=e.i(242064),n=e.i(246422),s=e.i(838378);let l=["wrap","nowrap","wrap-reverse"],c=["flex-start","flex-end","start","end","center","space-between","space-around","space-evenly","stretch","normal","left","right"],u=["center","start","end","flex-start","flex-end","self-start","self-end","baseline","normal","stretch"],d=function(e,t){let a,i,o;return(0,r.default)(Object.assign(Object.assign(Object.assign({},(a=!0===t.wrap?"wrap":t.wrap,{[`${e}-wrap-${a}`]:a&&l.includes(a)})),(i={},u.forEach(r=>{i[`${e}-align-${r}`]=t.align===r}),i[`${e}-align-stretch`]=!t.align&&!!t.vertical,i)),(o={},c.forEach(r=>{o[`${e}-justify-${r}`]=t.justify===r}),o)))},m=(0,n.genStyleHooks)("Flex",e=>{let{paddingXS:t,padding:r,paddingLG:a}=e,i=(0,s.mergeToken)(e,{flexGapSM:t,flexGap:r,flexGapLG:a});return[(e=>{let{componentCls:t}=e;return{[t]:{display:"flex",margin:0,padding:0,"&-vertical":{flexDirection:"column"},"&-rtl":{direction:"rtl"},"&:empty":{display:"none"}}}})(i),(e=>{let{componentCls:t}=e;return{[t]:{"&-gap-small":{gap:e.flexGapSM},"&-gap-middle":{gap:e.flexGap},"&-gap-large":{gap:e.flexGapLG}}}})(i),(e=>{let{componentCls:t}=e,r={};return l.forEach(e=>{r[`${t}-wrap-${e}`]={flexWrap:e}}),r})(i),(e=>{let{componentCls:t}=e,r={};return u.forEach(e=>{r[`${t}-align-${e}`]={alignItems:e}}),r})(i),(e=>{let{componentCls:t}=e,r={};return c.forEach(e=>{r[`${t}-justify-${e}`]={justifyContent:e}}),r})(i)]},()=>({}),{resetStyle:!1});var 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 i=0,a=Object.getOwnPropertySymbols(e);it.indexOf(a[i])&&Object.prototype.propertyIsEnumerable.call(e,a[i])&&(r[a[i]]=e[a[i]]);return r};let p=t.default.forwardRef((e,n)=>{let{prefixCls:s,rootClassName:l,className:c,style:u,flex:p,gap:f,vertical:h=!1,component:b="div",children:v}=e,A=g(e,["prefixCls","rootClassName","className","style","flex","gap","vertical","component","children"]),{flex:y,direction:O,getPrefixCls:x}=t.default.useContext(o.ConfigContext),C=x("flex",s),[I,E,$]=m(C),_=null!=h?h:null==y?void 0:y.vertical,T=(0,r.default)(c,l,null==y?void 0:y.className,C,E,$,d(C,e),{[`${C}-rtl`]:"rtl"===O,[`${C}-gap-${f}`]:(0,i.isPresetSize)(f),[`${C}-vertical`]:_}),w=Object.assign(Object.assign({},null==y?void 0:y.style),u);return p&&(w.flex=p),f&&!(0,i.isPresetSize)(f)&&(w.gap=f),I(t.default.createElement(b,Object.assign({ref:n,className:T,style:w},(0,a.default)(A,["justify","wrap","align"])),v))});e.s(["Flex",0,p],525720)},149121,e=>{"use strict";var t=e.i(843476),r=e.i(271645),a=e.i(152990),i=e.i(682830),o=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:f,isLoading:h=!1,loadingMessage:b="🚅 Loading logs...",noDataMessage:v="No logs found",enableSorting:A=!1}){let y=!!(g||p)&&!!f,[O,x]=(0,r.useState)([]),C=(0,a.useReactTable)({data:e,columns:d,...A&&{state:{sorting:O},onSortingChange:x,enableSortingRemoval:!1},...y&&{getRowCanExpand:f},getRowId:(e,t)=>e?.request_id??String(t),getCoreRowModel:(0,i.getCoreRowModel)(),...A&&{getSortedRowModel:(0,i.getSortedRowModel)()},...y&&{getExpandedRowModel:(0,i.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)(o.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:C.getHeaderGroups().map(e=>(0,t.jsx)(c.TableRow,{children:e.headers.map(e=>{let r=A&&e.column.getCanSort(),i=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"===i?"↑":"desc"===i?"↓":"⇅"})]})},e.id)})},e.id))}),(0,t.jsx)(l.TableBody,{children:h?(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})})})}):C.getRowModel().rows.length>0?C.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),i=e.i(214541);e.s(["default",0,()=>{let{accessToken:e,userRole:o,userId:n,premiumUser:s}=(0,a.default)(),{teams:l}=(0,i.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/31ad6450b9c696ec.js b/litellm/proxy/_experimental/out/_next/static/chunks/31ad6450b9c696ec.js deleted file mode 100644 index de88919e32..0000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/31ad6450b9c696ec.js +++ /dev/null @@ -1 +0,0 @@ -(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,367240,555436,e=>{"use strict";let t=(0,e.i(475254).default)("rotate-ccw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);e.s(["RotateCcw",()=>t],367240);var l=e.i(54943);e.s(["Search",()=>l.default],555436)},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])},655913,38419,78334,e=>{"use strict";var t=e.i(843476),l=e.i(115504),a=e.i(311451),i=e.i(374009),r=e.i(271645);e.s(["FilterInput",0,({placeholder:e,value:s,onChange:n,icon:o,className:d})=>{let[c,m]=(0,r.useState)(s);(0,r.useEffect)(()=>{m(s)},[s]);let u=(0,r.useMemo)(()=>(0,i.default)(e=>n(e),300),[n]);(0,r.useEffect)(()=>()=>{u.cancel()},[u]);let g=(0,r.useCallback)(e=>{let t=e.target.value;m(t),u(t)},[u]);return(0,t.jsx)(a.Input,{placeholder:e,value:c,onChange:g,prefix:o?(0,t.jsx)(o,{size:16,className:"text-gray-500"}):void 0,className:(0,l.cx)("w-64",d)})}],655913);var s=e.i(906579),n=e.i(464571);let o=(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:l,hasActiveFilters:a,label:i="Filters"})=>(0,t.jsx)(s.Badge,{color:"blue",dot:a,children:(0,t.jsx)(n.Button,{type:"default",onClick:e,icon:(0,t.jsx)(o,{size:16}),className:l?"bg-gray-100":"",children:i})})],38419);var d=e.i(367240);e.s(["ResetFiltersButton",0,({onClick:e,label:l="Reset Filters"})=>(0,t.jsx)(n.Button,{type:"default",onClick:e,icon:(0,t.jsx)(d.RotateCcw,{size:16}),children:l})],78334)},284614,e=>{"use strict";var t=e.i(846753);e.s(["User",()=>t.default])},906579,e=>{"use strict";e.i(247167);var t=e.i(271645),l=e.i(343794),a=e.i(361275),i=e.i(702779),r=e.i(763731),s=e.i(242064);e.i(296059);var n=e.i(915654),o=e.i(694758),d=e.i(183293),c=e.i(403541),m=e.i(246422),u=e.i(838378);let g=new o.Keyframes("antStatusProcessing",{"0%":{transform:"scale(0.8)",opacity:.5},"100%":{transform:"scale(2.4)",opacity:0}}),x=new o.Keyframes("antZoomBadgeIn",{"0%":{transform:"scale(0) translate(50%, -50%)",opacity:0},"100%":{transform:"scale(1) translate(50%, -50%)"}}),h=new o.Keyframes("antZoomBadgeOut",{"0%":{transform:"scale(1) translate(50%, -50%)"},"100%":{transform:"scale(0) translate(50%, -50%)",opacity:0}}),b=new o.Keyframes("antNoWrapperZoomBadgeIn",{"0%":{transform:"scale(0)",opacity:0},"100%":{transform:"scale(1)"}}),p=new o.Keyframes("antNoWrapperZoomBadgeOut",{"0%":{transform:"scale(1)"},"100%":{transform:"scale(0)",opacity:0}}),_=new o.Keyframes("antBadgeLoadingCircle",{"0%":{transformOrigin:"50%"},"100%":{transform:"translate(50%, -50%) rotate(360deg)",transformOrigin:"50%"}}),f=e=>{let{fontHeight:t,lineWidth:l,marginXS:a,colorBorderBg:i}=e,r=e.colorTextLightSolid,s=e.colorError,n=e.colorErrorHover;return(0,u.mergeToken)(e,{badgeFontHeight:t,badgeShadowSize:l,badgeTextColor:r,badgeColor:s,badgeColorHover:n,badgeShadowColor:i,badgeProcessingDuration:"1.2s",badgeRibbonOffset:a,badgeRibbonCornerTransform:"scaleY(0.75)",badgeRibbonCornerFilter:"brightness(75%)"})},j=e=>{let{fontSize:t,lineHeight:l,fontSizeSM:a,lineWidth:i}=e;return{indicatorZIndex:"auto",indicatorHeight:Math.round(t*l)-2*i,indicatorHeightSM:t,dotSize:a/2,textFontSize:a,textFontSizeSM:a,textFontWeight:"normal",statusSize:a/2}},v=(0,m.genStyleHooks)("Badge",e=>(e=>{let{componentCls:t,iconCls:l,antCls:a,badgeShadowSize:i,textFontSize:r,textFontSizeSM:s,statusSize:o,dotSize:m,textFontWeight:u,indicatorHeight:f,indicatorHeightSM:j,marginXS:v,calc:y}=e,C=`${a}-scroll-number`,w=(0,c.genPresetColor)(e,(e,{darkColor:l})=>({[`&${t} ${t}-color-${e}`]:{background:l,[`&:not(${t}-count)`]:{color:l},"a:hover &":{background:l}}}));return{[t]:Object.assign(Object.assign(Object.assign(Object.assign({},(0,d.resetComponent)(e)),{position:"relative",display:"inline-block",width:"fit-content",lineHeight:1,[`${t}-count`]:{display:"inline-flex",justifyContent:"center",zIndex:e.indicatorZIndex,minWidth:f,height:f,color:e.badgeTextColor,fontWeight:u,fontSize:r,lineHeight:(0,n.unit)(f),whiteSpace:"nowrap",textAlign:"center",background:e.badgeColor,borderRadius:y(f).div(2).equal(),boxShadow:`0 0 0 ${(0,n.unit)(i)} ${e.badgeShadowColor}`,transition:`background ${e.motionDurationMid}`,a:{color:e.badgeTextColor},"a:hover":{color:e.badgeTextColor},"a:hover &":{background:e.badgeColorHover}},[`${t}-count-sm`]:{minWidth:j,height:j,fontSize:s,lineHeight:(0,n.unit)(j),borderRadius:y(j).div(2).equal()},[`${t}-multiple-words`]:{padding:`0 ${(0,n.unit)(e.paddingXS)}`,bdi:{unicodeBidi:"plaintext"}},[`${t}-dot`]:{zIndex:e.indicatorZIndex,width:m,minWidth:m,height:m,background:e.badgeColor,borderRadius:"100%",boxShadow:`0 0 0 ${(0,n.unit)(i)} ${e.badgeShadowColor}`},[`${t}-count, ${t}-dot, ${C}-custom-component`]:{position:"absolute",top:0,insetInlineEnd:0,transform:"translate(50%, -50%)",transformOrigin:"100% 0%",[`&${l}-spin`]:{animationName:_,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:i,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:v,color:e.colorText,fontSize:e.fontSize}}}),w),{[`${t}-zoom-appear, ${t}-zoom-enter`]:{animationName:x,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:b,animationDuration:e.motionDurationSlow,animationTimingFunction:e.motionEaseOutBack},[`${t}-zoom-leave`]:{animationName:p,animationDuration:e.motionDurationSlow,animationTimingFunction:e.motionEaseOutBack},[`&:not(${t}-status)`]:{verticalAlign:"middle"},[`${C}-custom-component, ${t}-count`]:{transform:"none"},[`${C}-custom-component, ${C}`]:{position:"relative",top:"auto",display:"block",transformOrigin:"50% 50%"}},[C]:{overflow:"hidden",transition:`all ${e.motionDurationMid} ${e.motionEaseOutBack}`,[`${C}-only`]:{position:"relative",display:"inline-block",height:f,transition:`all ${e.motionDurationSlow} ${e.motionEaseOutBack}`,WebkitTransformStyle:"preserve-3d",WebkitBackfaceVisibility:"hidden",[`> p${C}-only-unit`]:{height:f,margin:0,WebkitTransformStyle:"preserve-3d",WebkitBackfaceVisibility:"hidden"}},[`${C}-symbol`]:{verticalAlign:"top"}},"&-rtl":{direction:"rtl",[`${t}-count, ${t}-dot, ${C}-custom-component`]:{transform:"translate(-50%, -50%)"}}})}})(f(e)),j),y=(0,m.genStyleHooks)(["Badge","Ribbon"],e=>(e=>{let{antCls:t,badgeFontHeight:l,marginXS:a,badgeRibbonOffset:i,calc:r}=e,s=`${t}-ribbon`,o=`${t}-ribbon-wrapper`,m=(0,c.genPresetColor)(e,(e,{darkColor:t})=>({[`&${s}-color-${e}`]:{background:t,color:t}}));return{[o]:{position:"relative"},[s]:Object.assign(Object.assign(Object.assign(Object.assign({},(0,d.resetComponent)(e)),{position:"absolute",top:a,padding:`0 ${(0,n.unit)(e.paddingXS)}`,color:e.colorPrimary,lineHeight:(0,n.unit)(l),whiteSpace:"nowrap",backgroundColor:e.colorPrimary,borderRadius:e.borderRadiusSM,[`${s}-text`]:{color:e.badgeTextColor},[`${s}-corner`]:{position:"absolute",top:"100%",width:i,height:i,color:"currentcolor",border:`${(0,n.unit)(r(i).div(2).equal())} solid`,transform:e.badgeRibbonCornerTransform,transformOrigin:"top",filter:e.badgeRibbonCornerFilter}}),m),{[`&${s}-placement-end`]:{insetInlineEnd:r(i).mul(-1).equal(),borderEndEndRadius:0,[`${s}-corner`]:{insetInlineEnd:0,borderInlineEndColor:"transparent",borderBlockEndColor:"transparent"}},[`&${s}-placement-start`]:{insetInlineStart:r(i).mul(-1).equal(),borderEndStartRadius:0,[`${s}-corner`]:{insetInlineStart:0,borderBlockEndColor:"transparent",borderInlineStartColor:"transparent"}},"&-rtl":{direction:"rtl"}})}})(f(e)),j),C=e=>{let a,{prefixCls:i,value:r,current:s,offset:n=0}=e;return n&&(a={position:"absolute",top:`${n}00%`,left:0}),t.createElement("span",{style:a,className:(0,l.default)(`${i}-only-unit`,{current:s})},r)},w=e=>{let l,a,{prefixCls:i,count:r,value:s}=e,n=Number(s),o=Math.abs(r),[d,c]=t.useState(n),[m,u]=t.useState(o),g=()=>{c(n),u(o)};if(t.useEffect(()=>{let e=setTimeout(g,1e3);return()=>clearTimeout(e)},[n]),d===n||Number.isNaN(n)||Number.isNaN(d))l=[t.createElement(C,Object.assign({},e,{key:n,current:!0}))],a={transition:"none"};else{l=[];let i=n+10,r=[];for(let e=n;e<=i;e+=1)r.push(e);let s=me%10===d);l=(s<0?r.slice(0,c+1):r.slice(c)).map((l,a)=>t.createElement(C,Object.assign({},e,{key:l,value:l%10,offset:s<0?a-c:a,current:a===c}))),a={transform:`translateY(${-function(e,t,l){let a=e,i=0;for(;(a+10)%10!==t;)a+=l,i+=l;return i}(d,n,s)}00%)`}}return t.createElement("span",{className:`${i}-only`,style:a,onTransitionEnd:g},l)};var N=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 i=0,a=Object.getOwnPropertySymbols(e);it.indexOf(a[i])&&Object.prototype.propertyIsEnumerable.call(e,a[i])&&(l[a[i]]=e[a[i]]);return l};let T=t.forwardRef((e,a)=>{let{prefixCls:i,count:n,className:o,motionClassName:d,style:c,title:m,show:u,component:g="sup",children:x}=e,h=N(e,["prefixCls","count","className","motionClassName","style","title","show","component","children"]),{getPrefixCls:b}=t.useContext(s.ConfigContext),p=b("scroll-number",i),_=Object.assign(Object.assign({},h),{"data-show":u,style:c,className:(0,l.default)(p,o,d),title:m}),f=n;if(n&&Number(n)%1==0){let e=String(n).split("");f=t.createElement("bdi",null,e.map((l,a)=>t.createElement(w,{prefixCls:p,count:Number(n),value:l,key:e.length-a})))}return((null==c?void 0:c.borderColor)&&(_.style=Object.assign(Object.assign({},c),{boxShadow:`0 0 0 1px ${c.borderColor} inset`})),x)?(0,r.cloneElement)(x,e=>({className:(0,l.default)(`${p}-custom-component`,null==e?void 0:e.className,d)})):t.createElement(g,Object.assign({},_,{ref:a}),f)});var z=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 i=0,a=Object.getOwnPropertySymbols(e);it.indexOf(a[i])&&Object.prototype.propertyIsEnumerable.call(e,a[i])&&(l[a[i]]=e[a[i]]);return l};let S=t.forwardRef((e,n)=>{var o,d,c,m,u;let{prefixCls:g,scrollNumberPrefixCls:x,children:h,status:b,text:p,color:_,count:f=null,overflowCount:j=99,dot:y=!1,size:C="default",title:w,offset:N,style:S,className:O,rootClassName:$,classNames:k,styles:I,showZero:F=!1}=e,M=z(e,["prefixCls","scrollNumberPrefixCls","children","status","text","color","count","overflowCount","dot","size","title","offset","style","className","rootClassName","classNames","styles","showZero"]),{getPrefixCls:E,direction:B,badge:R}=t.useContext(s.ConfigContext),D=E("badge",g),[P,A,L]=v(D),H=f>j?`${j}+`:f,U="0"===H||0===H||"0"===p||0===p,V=null===f||U&&!F,W=(null!=b||null!=_)&&V,q=null!=b||!U,G=y&&!U,K=G?"":H,Z=(0,t.useMemo)(()=>((null==K||""===K)&&(null==p||""===p)||U&&!F)&&!G,[K,U,F,G,p]),J=(0,t.useRef)(f);Z||(J.current=f);let Y=J.current,Q=(0,t.useRef)(K);Z||(Q.current=K);let X=Q.current,ee=(0,t.useRef)(G);Z||(ee.current=G);let et=(0,t.useMemo)(()=>{if(!N)return Object.assign(Object.assign({},null==R?void 0:R.style),S);let e={marginTop:N[1]};return"rtl"===B?e.left=Number.parseInt(N[0],10):e.right=-Number.parseInt(N[0],10),Object.assign(Object.assign(Object.assign({},e),null==R?void 0:R.style),S)},[B,N,S,null==R?void 0:R.style]),el=null!=w?w:"string"==typeof Y||"number"==typeof Y?Y:void 0,ea=!Z&&(0===p?F:!!p&&!0!==p),ei=ea?t.createElement("span",{className:`${D}-status-text`},p):null,er=Y&&"object"==typeof Y?(0,r.cloneElement)(Y,e=>({style:Object.assign(Object.assign({},et),e.style)})):void 0,es=(0,i.isPresetColor)(_,!1),en=(0,l.default)(null==k?void 0:k.indicator,null==(o=null==R?void 0:R.classNames)?void 0:o.indicator,{[`${D}-status-dot`]:W,[`${D}-status-${b}`]:!!b,[`${D}-color-${_}`]:es}),eo={};_&&!es&&(eo.color=_,eo.background=_);let ed=(0,l.default)(D,{[`${D}-status`]:W,[`${D}-not-a-wrapper`]:!h,[`${D}-rtl`]:"rtl"===B},O,$,null==R?void 0:R.className,null==(d=null==R?void 0:R.classNames)?void 0:d.root,null==k?void 0:k.root,A,L);if(!h&&W&&(p||q||!V)){let e=et.color;return P(t.createElement("span",Object.assign({},M,{className:ed,style:Object.assign(Object.assign(Object.assign({},null==I?void 0:I.root),null==(c=null==R?void 0:R.styles)?void 0:c.root),et)}),t.createElement("span",{className:en,style:Object.assign(Object.assign(Object.assign({},null==I?void 0:I.indicator),null==(m=null==R?void 0:R.styles)?void 0:m.indicator),eo)}),ea&&t.createElement("span",{style:{color:e},className:`${D}-status-text`},p)))}return P(t.createElement("span",Object.assign({ref:n},M,{className:ed,style:Object.assign(Object.assign({},null==(u=null==R?void 0:R.styles)?void 0:u.root),null==I?void 0:I.root)}),h,t.createElement(a.default,{visible:!Z,motionName:`${D}-zoom`,motionAppear:!1,motionDeadline:1e3},({className:e})=>{var a,i;let r=E("scroll-number",x),s=ee.current,n=(0,l.default)(null==k?void 0:k.indicator,null==(a=null==R?void 0:R.classNames)?void 0:a.indicator,{[`${D}-dot`]:s,[`${D}-count`]:!s,[`${D}-count-sm`]:"small"===C,[`${D}-multiple-words`]:!s&&X&&X.toString().length>1,[`${D}-status-${b}`]:!!b,[`${D}-color-${_}`]:es}),o=Object.assign(Object.assign(Object.assign({},null==I?void 0:I.indicator),null==(i=null==R?void 0:R.styles)?void 0:i.indicator),et);return _&&!es&&((o=o||{}).background=_),t.createElement(T,{prefixCls:r,show:!Z,motionClassName:e,className:n,count:X,title:el,style:o,key:"scrollNumber"},er)}),ei))});S.Ribbon=e=>{let{className:a,prefixCls:r,style:n,color:o,children:d,text:c,placement:m="end",rootClassName:u}=e,{getPrefixCls:g,direction:x}=t.useContext(s.ConfigContext),h=g("ribbon",r),b=`${h}-wrapper`,[p,_,f]=y(h,b),j=(0,i.isPresetColor)(o,!1),v=(0,l.default)(h,`${h}-placement-${m}`,{[`${h}-rtl`]:"rtl"===x,[`${h}-color-${o}`]:j},a),C={},w={};return o&&!j&&(C.background=o,w.color=o),p(t.createElement("div",{className:(0,l.default)(b,u,_,f)},d,t.createElement("div",{className:(0,l.default)(v,_),style:Object.assign(Object.assign({},C),n)},t.createElement("span",{className:`${h}-text`},c),t.createElement("div",{className:`${h}-corner`,style:w}))))},e.s(["Badge",0,S],906579)},738014,e=>{"use strict";var t=e.i(135214),l=e.i(764205),a=e.i(266027);let i=(0,e.i(243652).createQueryKeys)("users");e.s(["useCurrentUser",0,()=>{let{accessToken:e,userId:r,userRole:s}=(0,t.default)();return(0,a.useQuery)({queryKey:i.detail(r),queryFn:async()=>{let t=await (0,l.userInfoCall)(e,r,s,!1,null,null);return console.log(`userInfo: ${JSON.stringify(t)}`),t.user_info},enabled:!!(e&&r&&s)})}])},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 l=t.find(t=>t.team_id===e);return l?l.team_alias:null}])},846835,e=>{"use strict";var t=e.i(843476),l=e.i(655913),a=e.i(38419),i=e.i(78334),r=e.i(555436),s=e.i(284614);let n=({filters:e,showFilters:n,onToggleFilters:o,onChange:d,onReset:c})=>{let m=!!(e.org_id||e.org_alias);return(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)(l.FilterInput,{placeholder:"Search by Organization Name",value:e.org_alias,onChange:e=>d("org_alias",e),icon:r.Search,className:"w-64"}),(0,t.jsx)(a.FiltersButton,{onClick:()=>o(!n),active:n,hasActiveFilters:m}),(0,t.jsx)(i.ResetFiltersButton,{onClick:c})]}),n&&(0,t.jsx)("div",{className:"flex flex-wrap items-center gap-3 mt-3",children:(0,t.jsx)(l.FilterInput,{placeholder:"Search by Organization ID",value:e.org_id,onChange:e=>d("org_id",e),icon:s.User,className:"w-64"})})]})};var o=e.i(827252),d=e.i(871943),c=e.i(502547),m=e.i(278587),u=e.i(389083),g=e.i(994388),x=e.i(304967),h=e.i(309426),b=e.i(350967),p=e.i(752978),_=e.i(197647),f=e.i(653824),j=e.i(269200),v=e.i(942232),y=e.i(977572),C=e.i(427612),w=e.i(64848),N=e.i(496020),T=e.i(881073),z=e.i(404206),S=e.i(723731),O=e.i(599724),$=e.i(779241),k=e.i(808613),I=e.i(311451),F=e.i(212931),M=e.i(199133),E=e.i(592968),B=e.i(271645),R=e.i(500330),D=e.i(127952),P=e.i(902555),A=e.i(355619),L=e.i(75921),H=e.i(162386),U=e.i(727749),V=e.i(764205),W=e.i(785242),q=e.i(980187),G=e.i(530212),K=e.i(629569),Z=e.i(464571),J=e.i(653496),Y=e.i(898586),Q=e.i(678784),X=e.i(118366),ee=e.i(294612),et=e.i(907308),el=e.i(384767),ea=e.i(435451),ei=e.i(276173),er=e.i(916940);let es=({organizationId:e,onClose:l,accessToken:a,is_org_admin:i,is_proxy_admin:r,userModels:s,editOrg:n})=>{let[o,d]=(0,B.useState)(null),[c,m]=(0,B.useState)(!0),[h]=k.Form.useForm(),[p,_]=(0,B.useState)(!1),[f,j]=(0,B.useState)(!1),[v,y]=(0,B.useState)(!1),[C,w]=(0,B.useState)(null),[N,T]=(0,B.useState)({}),[z,S]=(0,B.useState)(!1),F=i||r,{data:E}=(0,W.useTeams)(),D=(0,B.useMemo)(()=>(0,q.createTeamAliasMap)(E),[E]),P=async()=>{try{if(m(!0),!a)return;let t=await (0,V.organizationInfoCall)(a,e);d(t)}catch(e){U.default.fromBackend("Failed to load organization information"),console.error("Error fetching organization info:",e)}finally{m(!1)}};(0,B.useEffect)(()=>{P()},[e,a]);let A=async t=>{try{if(null==a)return;let l={user_email:t.user_email,user_id:t.user_id,role:t.role};await (0,V.organizationMemberAddCall)(a,e,l),U.default.success("Organization member added successfully"),j(!1),h.resetFields(),P()}catch(e){U.default.fromBackend("Failed to add organization member"),console.error("Error adding organization member:",e)}},es=async t=>{try{if(!a)return;let l={user_email:t.user_email,user_id:t.user_id,role:t.role};await (0,V.organizationMemberUpdateCall)(a,e,l),U.default.success("Organization member updated successfully"),y(!1),h.resetFields(),P()}catch(e){U.default.fromBackend("Failed to update organization member"),console.error("Error updating organization member:",e)}},en=async t=>{try{if(!a)return;await (0,V.organizationMemberDeleteCall)(a,e,t.user_id),U.default.success("Organization member deleted successfully"),y(!1),h.resetFields(),P()}catch(e){U.default.fromBackend("Failed to delete organization member"),console.error("Error deleting organization member:",e)}},eo=async t=>{try{if(!a)return;S(!0);let l={organization_id:e,organization_alias:t.organization_alias,models:t.models,litellm_budget_table:{tpm_limit:t.tpm_limit,rpm_limit:t.rpm_limit,max_budget:t.max_budget,budget_duration:t.budget_duration},metadata:t.metadata?JSON.parse(t.metadata):null};if((void 0!==t.vector_stores||void 0!==t.mcp_servers_and_groups)&&(l.object_permission={...o?.object_permission,vector_stores:t.vector_stores||[]},void 0!==t.mcp_servers_and_groups)){let{servers:e,accessGroups:a}=t.mcp_servers_and_groups||{servers:[],accessGroups:[]};e&&e.length>0&&(l.object_permission.mcp_servers=e),a&&a.length>0&&(l.object_permission.mcp_access_groups=a)}await (0,V.organizationUpdateCall)(a,l),U.default.success("Organization settings updated successfully"),_(!1),P()}catch(e){U.default.fromBackend("Failed to update organization settings"),console.error("Error updating organization:",e)}finally{S(!1)}};if(c)return(0,t.jsx)("div",{className:"p-4",children:"Loading..."});if(!o)return(0,t.jsx)("div",{className:"p-4",children:"Organization not found"});let ed=async(e,t)=>{await (0,R.copyToClipboard)(e)&&(T(e=>({...e,[t]:!0})),setTimeout(()=>{T(e=>({...e,[t]:!1}))},2e3))},ec=[{title:"Spend (USD)",key:"spend",render:(e,l)=>{let a=null!=l.user_id?(o.members||[]).find(e=>e.user_id===l.user_id):void 0;return(0,t.jsxs)(Y.Typography.Text,{children:["$",(0,R.formatNumberWithCommas)(a?.spend??0,4)]})}},{title:"Created At",key:"created_at",render:(e,l)=>{let a=null!=l.user_id?(o.members||[]).find(e=>e.user_id===l.user_id):void 0;return(0,t.jsx)(Y.Typography.Text,{children:a?.created_at?new Date(a.created_at).toLocaleString():"-"})}}];return(0,t.jsxs)("div",{className:"w-full h-screen p-4 bg-white",children:[(0,t.jsx)("div",{className:"flex justify-between items-center mb-6",children:(0,t.jsxs)("div",{children:[(0,t.jsx)(g.Button,{icon:G.ArrowLeftIcon,onClick:l,variant:"light",className:"mb-4",children:"Back to Organizations"}),(0,t.jsx)(K.Title,{children:o.organization_alias}),(0,t.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,t.jsx)(O.Text,{className:"text-gray-500 font-mono",children:o.organization_id}),(0,t.jsx)(Z.Button,{type:"text",size:"small",icon:N["org-id"]?(0,t.jsx)(Q.CheckIcon,{size:12}):(0,t.jsx)(X.CopyIcon,{size:12}),onClick:()=>ed(o.organization_id,"org-id"),className:`left-2 z-10 transition-all duration-200 ${N["org-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100"}`})]})]})}),(0,t.jsx)(J.Tabs,{defaultActiveKey:n?"settings":"overview",className:"mb-4",items:[{key:"overview",label:"Overview",children:(0,t.jsxs)(b.Grid,{numItems:1,numItemsSm:2,numItemsLg:3,className:"gap-6",children:[(0,t.jsxs)(x.Card,{children:[(0,t.jsx)(O.Text,{children:"Organization Details"}),(0,t.jsxs)("div",{className:"mt-2",children:[(0,t.jsxs)(O.Text,{children:["Created: ",new Date(o.created_at).toLocaleDateString()]}),(0,t.jsxs)(O.Text,{children:["Updated: ",new Date(o.updated_at).toLocaleDateString()]}),(0,t.jsxs)(O.Text,{children:["Created By: ",o.created_by]})]})]}),(0,t.jsxs)(x.Card,{children:[(0,t.jsx)(O.Text,{children:"Budget Status"}),(0,t.jsxs)("div",{className:"mt-2",children:[(0,t.jsxs)(K.Title,{children:["$",(0,R.formatNumberWithCommas)(o.spend,4)]}),(0,t.jsxs)(O.Text,{children:["of"," ",null===o.litellm_budget_table.max_budget?"Unlimited":`$${(0,R.formatNumberWithCommas)(o.litellm_budget_table.max_budget,4)}`]}),o.litellm_budget_table.budget_duration&&(0,t.jsxs)(O.Text,{className:"text-gray-500",children:["Reset: ",o.litellm_budget_table.budget_duration]})]})]}),(0,t.jsxs)(x.Card,{children:[(0,t.jsx)(O.Text,{children:"Rate Limits"}),(0,t.jsxs)("div",{className:"mt-2",children:[(0,t.jsxs)(O.Text,{children:["TPM: ",o.litellm_budget_table.tpm_limit||"Unlimited"]}),(0,t.jsxs)(O.Text,{children:["RPM: ",o.litellm_budget_table.rpm_limit||"Unlimited"]}),o.litellm_budget_table.max_parallel_requests&&(0,t.jsxs)(O.Text,{children:["Max Parallel Requests: ",o.litellm_budget_table.max_parallel_requests]})]})]}),(0,t.jsxs)(x.Card,{children:[(0,t.jsx)(O.Text,{children:"Models"}),(0,t.jsx)("div",{className:"mt-2 flex flex-wrap gap-2",children:0===o.models.length?(0,t.jsx)(u.Badge,{color:"red",children:"All proxy models"}):o.models.map((e,l)=>(0,t.jsx)(u.Badge,{color:"red",children:e},l))})]}),(0,t.jsxs)(x.Card,{children:[(0,t.jsx)(O.Text,{children:"Teams"}),(0,t.jsx)("div",{className:"mt-2 flex flex-wrap gap-2",children:o.teams?.map((e,l)=>(0,t.jsx)(u.Badge,{color:"red",children:D[e.team_id]||e.team_id},l))})]}),(0,t.jsx)(el.default,{objectPermission:o.object_permission,variant:"card",accessToken:a})]})},{key:"members",label:"Members",children:(0,t.jsx)("div",{className:"space-y-4",children:(0,t.jsx)(ee.default,{members:(o.members||[]).map(e=>({role:e.user_role||"",user_id:e.user_id,user_email:e.user_email})),canEdit:F,onEdit:e=>{w(e),y(!0)},onDelete:e=>en(e),onAddMember:()=>j(!0),roleColumnTitle:"Organization Role",extraColumns:ec,emptyText:"No members found"})})},{key:"settings",label:"Settings",children:(0,t.jsxs)(x.Card,{className:"overflow-y-auto max-h-[65vh]",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,t.jsx)(K.Title,{children:"Organization Settings"}),F&&!p&&(0,t.jsx)(g.Button,{onClick:()=>_(!0),children:"Edit Settings"})]}),p?(0,t.jsxs)(k.Form,{form:h,onFinish:eo,initialValues:{organization_alias:o.organization_alias,models:o.models,tpm_limit:o.litellm_budget_table.tpm_limit,rpm_limit:o.litellm_budget_table.rpm_limit,max_budget:o.litellm_budget_table.max_budget,budget_duration:o.litellm_budget_table.budget_duration,metadata:o.metadata?JSON.stringify(o.metadata,null,2):"",vector_stores:o.object_permission?.vector_stores||[],mcp_servers_and_groups:{servers:o.object_permission?.mcp_servers||[],accessGroups:o.object_permission?.mcp_access_groups||[]}},layout:"vertical",children:[(0,t.jsx)(k.Form.Item,{label:"Organization Name",name:"organization_alias",rules:[{required:!0,message:"Please input an organization name"}],children:(0,t.jsx)($.TextInput,{})}),(0,t.jsx)(k.Form.Item,{label:"Models",name:"models",children:(0,t.jsx)(H.ModelSelect,{value:h.getFieldValue("models"),onChange:e=>h.setFieldValue("models",e),context:"organization",options:{includeSpecialOptions:!0,showAllProxyModelsOverride:!0}})}),(0,t.jsx)(k.Form.Item,{label:"Max Budget (USD)",name:"max_budget",children:(0,t.jsx)(ea.default,{step:.01,precision:2,style:{width:"100%"}})}),(0,t.jsx)(k.Form.Item,{label:"Reset Budget",name:"budget_duration",children:(0,t.jsxs)(M.Select,{placeholder:"n/a",children:[(0,t.jsx)(M.Select.Option,{value:"24h",children:"daily"}),(0,t.jsx)(M.Select.Option,{value:"7d",children:"weekly"}),(0,t.jsx)(M.Select.Option,{value:"30d",children:"monthly"})]})}),(0,t.jsx)(k.Form.Item,{label:"Tokens per minute Limit (TPM)",name:"tpm_limit",children:(0,t.jsx)(ea.default,{step:1,style:{width:"100%"}})}),(0,t.jsx)(k.Form.Item,{label:"Requests per minute Limit (RPM)",name:"rpm_limit",children:(0,t.jsx)(ea.default,{step:1,style:{width:"100%"}})}),(0,t.jsx)(k.Form.Item,{label:"Vector Stores",name:"vector_stores",children:(0,t.jsx)(er.default,{onChange:e=>h.setFieldValue("vector_stores",e),value:h.getFieldValue("vector_stores"),accessToken:a||"",placeholder:"Select vector stores"})}),(0,t.jsx)(k.Form.Item,{label:"MCP Servers & Access Groups",name:"mcp_servers_and_groups",children:(0,t.jsx)(L.default,{onChange:e=>h.setFieldValue("mcp_servers_and_groups",e),value:h.getFieldValue("mcp_servers_and_groups"),accessToken:a||"",placeholder:"Select MCP servers and access groups"})}),(0,t.jsx)(k.Form.Item,{label:"Metadata",name:"metadata",children:(0,t.jsx)(I.Input.TextArea,{rows:4})}),(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)(g.Button,{variant:"secondary",onClick:()=>_(!1),disabled:z,children:"Cancel"}),(0,t.jsx)(g.Button,{type:"submit",loading:z,children:"Save Changes"})]})})]}):(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(O.Text,{className:"font-medium",children:"Organization Name"}),(0,t.jsx)("div",{children:o.organization_alias})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(O.Text,{className:"font-medium",children:"Organization ID"}),(0,t.jsx)("div",{className:"font-mono",children:o.organization_id})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(O.Text,{className:"font-medium",children:"Created At"}),(0,t.jsx)("div",{children:new Date(o.created_at).toLocaleString()})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(O.Text,{className:"font-medium",children:"Models"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:o.models.map((e,l)=>(0,t.jsx)(u.Badge,{color:"red",children:e},l))})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(O.Text,{className:"font-medium",children:"Rate Limits"}),(0,t.jsxs)("div",{children:["TPM: ",o.litellm_budget_table.tpm_limit||"Unlimited"]}),(0,t.jsxs)("div",{children:["RPM: ",o.litellm_budget_table.rpm_limit||"Unlimited"]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(O.Text,{className:"font-medium",children:"Budget"}),(0,t.jsxs)("div",{children:["Max:"," ",null!==o.litellm_budget_table.max_budget?`$${(0,R.formatNumberWithCommas)(o.litellm_budget_table.max_budget,4)}`:"No Limit"]}),(0,t.jsxs)("div",{children:["Reset: ",o.litellm_budget_table.budget_duration||"Never"]})]}),(0,t.jsx)(el.default,{objectPermission:o.object_permission,variant:"inline",className:"pt-4 border-t border-gray-200",accessToken:a})]})]})}]}),(0,t.jsx)(et.default,{isVisible:f,onCancel:()=>j(!1),onSubmit:A,accessToken:a,title:"Add Organization Member",roles:[{label:"org_admin",value:"org_admin",description:"Can add and remove members, and change their roles."},{label:"internal_user",value:"internal_user",description:"Can view/create keys for themselves within organization."},{label:"internal_user_viewer",value:"internal_user_viewer",description:"Can only view their keys within organization."}],defaultRole:"internal_user"}),(0,t.jsx)(ei.default,{visible:v,onCancel:()=>y(!1),onSubmit:es,initialData:C,mode:"edit",config:{title:"Edit Member",showEmail:!0,showUserId:!0,roleOptions:[{label:"Org Admin",value:"org_admin"},{label:"Internal User",value:"internal_user"},{label:"Internal User Viewer",value:"internal_user_viewer"}]}})]})},en=async(e,t,l=null,a=null)=>{t(await (0,V.organizationListCall)(e,l,a))};e.s(["default",0,({organizations:e,userRole:l,userModels:a,accessToken:i,lastRefreshed:r,handleRefreshClick:s,currentOrg:W,guardrailsList:q=[],setOrganizations:G,premiumUser:K})=>{let[Z,J]=(0,B.useState)(null),[Y,Q]=(0,B.useState)(!1),[X,ee]=(0,B.useState)(!1),[et,el]=(0,B.useState)(null),[ei,eo]=(0,B.useState)(!1),[ed,ec]=(0,B.useState)(!1),[em]=k.Form.useForm(),[eu,eg]=(0,B.useState)({}),[ex,eh]=(0,B.useState)(!1),[eb,ep]=(0,B.useState)({org_id:"",org_alias:"",sort_by:"created_at",sort_order:"desc"}),e_=async()=>{if(et&&i)try{eo(!0),await (0,V.organizationDeleteCall)(i,et),U.default.success("Organization deleted successfully"),ee(!1),el(null),await en(i,G,eb.org_id||null,eb.org_alias||null)}catch(e){console.error("Error deleting organization:",e)}finally{eo(!1)}},ef=async e=>{try{if(!i)return;console.log(`values in organizations new create call: ${JSON.stringify(e)}`),(e.allowed_vector_store_ids&&e.allowed_vector_store_ids.length>0||e.allowed_mcp_servers_and_groups&&(e.allowed_mcp_servers_and_groups.servers?.length>0||e.allowed_mcp_servers_and_groups.accessGroups?.length>0))&&(e.object_permission={},e.allowed_vector_store_ids&&e.allowed_vector_store_ids.length>0&&(e.object_permission.vector_stores=e.allowed_vector_store_ids,delete e.allowed_vector_store_ids),e.allowed_mcp_servers_and_groups&&(e.allowed_mcp_servers_and_groups.servers?.length>0&&(e.object_permission.mcp_servers=e.allowed_mcp_servers_and_groups.servers),e.allowed_mcp_servers_and_groups.accessGroups?.length>0&&(e.object_permission.mcp_access_groups=e.allowed_mcp_servers_and_groups.accessGroups),delete e.allowed_mcp_servers_and_groups)),await (0,V.organizationCreateCall)(i,e),U.default.success("Organization created successfully"),ec(!1),em.resetFields(),en(i,G,eb.org_id||null,eb.org_alias||null)}catch(e){console.error("Error creating organization:",e)}};return K?(0,t.jsxs)("div",{className:"w-full mx-4 h-[75vh]",children:[(0,t.jsx)(b.Grid,{numItems:1,className:"gap-2 p-8 w-full mt-2",children:(0,t.jsxs)(h.Col,{numColSpan:1,className:"flex flex-col gap-2",children:[("Admin"===l||"Org Admin"===l)&&(0,t.jsx)(g.Button,{className:"w-fit",onClick:()=>ec(!0),children:"+ Create New Organization"}),Z?(0,t.jsx)(es,{organizationId:Z,onClose:()=>{J(null),Q(!1)},accessToken:i,is_org_admin:!0,is_proxy_admin:"Admin"===l,userModels:a,editOrg:Y}):(0,t.jsxs)(f.TabGroup,{className:"gap-2 h-[75vh] w-full",children:[(0,t.jsxs)(T.TabList,{className:"flex justify-between mt-2 w-full items-center",children:[(0,t.jsx)("div",{className:"flex",children:(0,t.jsx)(_.Tab,{children:"Your Organizations"})}),(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[r&&(0,t.jsxs)(O.Text,{children:["Last Refreshed: ",r]}),(0,t.jsx)(p.Icon,{icon:m.RefreshIcon,variant:"shadow",size:"xs",className:"self-center",onClick:s})]})]}),(0,t.jsx)(S.TabPanels,{children:(0,t.jsxs)(z.TabPanel,{children:[(0,t.jsx)(O.Text,{children:"Click on “Organization ID” to view organization details."}),(0,t.jsx)(b.Grid,{numItems:1,className:"gap-2 pt-2 pb-2 h-[75vh] w-full mt-2",children:(0,t.jsx)(h.Col,{numColSpan:1,children:(0,t.jsxs)(x.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.jsx)("div",{className:"flex flex-col space-y-4",children:(0,t.jsx)(n,{filters:eb,showFilters:ex,onToggleFilters:eh,onChange:(e,t)=>{let l={...eb,[e]:t};ep(l),i&&(0,V.organizationListCall)(i,l.org_id||null,l.org_alias||null).then(e=>{e&&G(e)}).catch(e=>{console.error("Error fetching organizations:",e)})},onReset:()=>{ep({org_id:"",org_alias:"",sort_by:"created_at",sort_order:"desc"}),i&&(0,V.organizationListCall)(i,null,null).then(e=>{e&&G(e)}).catch(e=>{console.error("Error fetching organizations:",e)})}})})}),(0,t.jsxs)(j.Table,{children:[(0,t.jsx)(C.TableHead,{children:(0,t.jsxs)(N.TableRow,{children:[(0,t.jsx)(w.TableHeaderCell,{children:"Organization ID"}),(0,t.jsx)(w.TableHeaderCell,{children:"Organization Name"}),(0,t.jsx)(w.TableHeaderCell,{children:"Created"}),(0,t.jsx)(w.TableHeaderCell,{children:"Spend (USD)"}),(0,t.jsx)(w.TableHeaderCell,{children:"Budget (USD)"}),(0,t.jsx)(w.TableHeaderCell,{children:"Models"}),(0,t.jsx)(w.TableHeaderCell,{children:"TPM / RPM Limits"}),(0,t.jsx)(w.TableHeaderCell,{children:"Info"}),(0,t.jsx)(w.TableHeaderCell,{children:"Actions"})]})}),(0,t.jsx)(v.TableBody,{children:e&&e.length>0?e.sort((e,t)=>new Date(t.created_at).getTime()-new Date(e.created_at).getTime()).map(e=>(0,t.jsxs)(N.TableRow,{children:[(0,t.jsx)(y.TableCell,{children:(0,t.jsx)("div",{className:"overflow-hidden",children:(0,t.jsx)(E.Tooltip,{title:e.organization_id,children:(0,t.jsxs)(g.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:()=>J(e.organization_id),children:[e.organization_id?.slice(0,7),"..."]})})})}),(0,t.jsx)(y.TableCell,{children:e.organization_alias}),(0,t.jsx)(y.TableCell,{children:e.created_at?new Date(e.created_at).toLocaleDateString():"N/A"}),(0,t.jsx)(y.TableCell,{children:(0,R.formatNumberWithCommas)(e.spend,4)}),(0,t.jsx)(y.TableCell,{children:e.litellm_budget_table?.max_budget!==null&&e.litellm_budget_table?.max_budget!==void 0?e.litellm_budget_table?.max_budget:"No limit"}),(0,t.jsx)(y.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)(u.Badge,{size:"xs",className:"mb-1",color:"red",children:(0,t.jsx)(O.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)(p.Icon,{icon:eu[e.organization_id||""]?d.ChevronDownIcon:c.ChevronRightIcon,className:"cursor-pointer",size:"xs",onClick:()=>{eg(t=>({...t,[e.organization_id||""]:!t[e.organization_id||""]}))}})}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-1",children:[e.models.slice(0,3).map((e,l)=>"all-proxy-models"===e?(0,t.jsx)(u.Badge,{size:"xs",color:"red",children:(0,t.jsx)(O.Text,{children:"All Proxy Models"})},l):(0,t.jsx)(u.Badge,{size:"xs",color:"blue",children:(0,t.jsx)(O.Text,{children:e.length>30?`${(0,A.getModelDisplayName)(e).slice(0,30)}...`:(0,A.getModelDisplayName)(e)})},l)),e.models.length>3&&!eu[e.organization_id||""]&&(0,t.jsx)(u.Badge,{size:"xs",color:"gray",className:"cursor-pointer",children:(0,t.jsxs)(O.Text,{children:["+",e.models.length-3," ",e.models.length-3==1?"more model":"more models"]})}),eu[e.organization_id||""]&&(0,t.jsx)("div",{className:"flex flex-wrap gap-1",children:e.models.slice(3).map((e,l)=>"all-proxy-models"===e?(0,t.jsx)(u.Badge,{size:"xs",color:"red",children:(0,t.jsx)(O.Text,{children:"All Proxy Models"})},l+3):(0,t.jsx)(u.Badge,{size:"xs",color:"blue",children:(0,t.jsx)(O.Text,{children:e.length>30?`${(0,A.getModelDisplayName)(e).slice(0,30)}...`:(0,A.getModelDisplayName)(e)})},l+3))})]})]})})}):null})}),(0,t.jsx)(y.TableCell,{children:(0,t.jsxs)(O.Text,{children:["TPM:"," ",e.litellm_budget_table?.tpm_limit?e.litellm_budget_table?.tpm_limit:"Unlimited",(0,t.jsx)("br",{}),"RPM:"," ",e.litellm_budget_table?.rpm_limit?e.litellm_budget_table?.rpm_limit:"Unlimited"]})}),(0,t.jsx)(y.TableCell,{children:(0,t.jsxs)(O.Text,{children:[e.members?.length||0," Members"]})}),(0,t.jsx)(y.TableCell,{children:"Admin"===l&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(P.default,{variant:"Edit",tooltipText:"Edit organization",onClick:()=>{J(e.organization_id),Q(!0)}}),(0,t.jsx)(P.default,{variant:"Delete",tooltipText:"Delete organization",onClick:()=>{var t;(t=e.organization_id)&&(el(t),ee(!0))}})]})})]},e.organization_id)):null})]})]})})})]})})]})]})}),(0,t.jsx)(F.Modal,{title:"Create Organization",visible:ed,width:800,footer:null,onCancel:()=>{ec(!1),em.resetFields()},children:(0,t.jsxs)(k.Form,{form:em,onFinish:ef,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,t.jsx)(k.Form.Item,{label:"Organization Name",name:"organization_alias",rules:[{required:!0,message:"Please input an organization name"}],children:(0,t.jsx)($.TextInput,{placeholder:""})}),(0,t.jsx)(k.Form.Item,{label:"Models",name:"models",children:(0,t.jsx)(H.ModelSelect,{options:{showAllProxyModelsOverride:!0,includeSpecialOptions:!0},value:em.getFieldValue("models"),onChange:e=>em.setFieldValue("models",e),context:"organization"})}),(0,t.jsx)(k.Form.Item,{label:"Max Budget (USD)",name:"max_budget",children:(0,t.jsx)(ea.default,{step:.01,precision:2,width:200})}),(0,t.jsx)(k.Form.Item,{label:"Reset Budget",name:"budget_duration",children:(0,t.jsxs)(M.Select,{defaultValue:null,placeholder:"n/a",children:[(0,t.jsx)(M.Select.Option,{value:"24h",children:"daily"}),(0,t.jsx)(M.Select.Option,{value:"7d",children:"weekly"}),(0,t.jsx)(M.Select.Option,{value:"30d",children:"monthly"})]})}),(0,t.jsx)(k.Form.Item,{label:"Tokens per minute Limit (TPM)",name:"tpm_limit",children:(0,t.jsx)(ea.default,{step:1,width:400})}),(0,t.jsx)(k.Form.Item,{label:"Requests per minute Limit (RPM)",name:"rpm_limit",children:(0,t.jsx)(ea.default,{step:1,width:400})}),(0,t.jsx)(k.Form.Item,{label:(0,t.jsxs)("span",{children:["Allowed Vector Stores"," ",(0,t.jsx)(E.Tooltip,{title:"Select which vector stores this organization can access by default. Leave empty for access to all vector stores",children:(0,t.jsx)(o.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"allowed_vector_store_ids",className:"mt-4",help:"Select vector stores this organization can access. Leave empty for access to all vector stores",children:(0,t.jsx)(er.default,{onChange:e=>em.setFieldValue("allowed_vector_store_ids",e),value:em.getFieldValue("allowed_vector_store_ids"),accessToken:i||"",placeholder:"Select vector stores (optional)"})}),(0,t.jsx)(k.Form.Item,{label:(0,t.jsxs)("span",{children:["Allowed MCP Servers"," ",(0,t.jsx)(E.Tooltip,{title:"Select which MCP servers and access groups this organization can access by default.",children:(0,t.jsx)(o.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"allowed_mcp_servers_and_groups",className:"mt-4",help:"Select MCP servers and access groups this organization can access.",children:(0,t.jsx)(L.default,{onChange:e=>em.setFieldValue("allowed_mcp_servers_and_groups",e),value:em.getFieldValue("allowed_mcp_servers_and_groups"),accessToken:i||"",placeholder:"Select MCP servers and access groups (optional)"})}),(0,t.jsx)(k.Form.Item,{label:"Metadata",name:"metadata",children:(0,t.jsx)(I.Input.TextArea,{rows:4})}),(0,t.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,t.jsx)(g.Button,{type:"submit",children:"Create Organization"})})]})}),(0,t.jsx)(D.default,{isOpen:X,title:"Delete Organization?",message:"Are you sure you want to delete this organization? This action cannot be undone.",resourceInformationTitle:"Organization Information",resourceInformation:[{label:"Organization ID",value:et,code:!0}],onCancel:()=>{ee(!1),el(null)},onOk:e_,confirmLoading:ei})]}):(0,t.jsx)("div",{children:(0,t.jsxs)(O.Text,{children:["This is a LiteLLM Enterprise feature, and requires a valid key to use. Get a trial key"," ",(0,t.jsx)("a",{href:"https://www.litellm.ai/#pricing",target:"_blank",rel:"noopener noreferrer",children:"here"}),"."]})})},"fetchOrganizations",0,en],846835)}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/81b595b330469e25.js b/litellm/proxy/_experimental/out/_next/static/chunks/38976546132cd527.js similarity index 79% rename from litellm/proxy/_experimental/out/_next/static/chunks/81b595b330469e25.js rename to litellm/proxy/_experimental/out/_next/static/chunks/38976546132cd527.js index da9bd38829..63208ba2db 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/81b595b330469e25.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/38976546132cd527.js @@ -100,6 +100,6 @@ `]:{animationName:i.slideDownIn},[`${u}${d}bottomLeft`]:{animationName:i.slideUpOut},[` ${u}${d}topLeft, ${u}${d}topRight - `]:{animationName:i.slideDownOut},"&-hidden":{display:"none"},[o]:Object.assign(Object.assign({},l(e)),{cursor:"pointer",transition:`background ${e.motionDurationSlow} ease`,borderRadius:e.borderRadiusSM,"&-group":{color:e.colorTextDescription,fontSize:e.fontSizeSM,cursor:"default"},"&-option":{display:"flex","&-content":Object.assign({flex:"auto"},t.textEllipsis),"&-state":{flex:"none",display:"flex",alignItems:"center"},[`&-active:not(${o}-option-disabled)`]:{backgroundColor:e.optionActiveBg},[`&-selected:not(${o}-option-disabled)`]:{color:e.optionSelectedColor,fontWeight:e.optionSelectedFontWeight,backgroundColor:e.optionSelectedBg,[`${o}-option-state`]:{color:e.colorPrimary}},"&-disabled":{[`&${o}-option-selected`]:{backgroundColor:e.colorBgContainerDisabled},color:e.colorTextDisabled,cursor:"not-allowed"},"&-grouped":{paddingInlineStart:e.calc(e.controlPaddingHorizontal).mul(2).equal()}},"&-empty":Object.assign(Object.assign({},l(e)),{color:e.colorTextDisabled})}),[`${f}:has(+ ${f})`]:{borderEndStartRadius:0,borderEndEndRadius:0,[`& + ${f}`]:{borderStartStartRadius:0,borderStartEndRadius:0}},"&-rtl":{direction:"rtl"}})},(0,i.initSlideMotion)(e,"slide-up"),(0,i.initSlideMotion)(e,"slide-down"),(0,a.initMoveMotion)(e,"move-up"),(0,a.initMoveMotion)(e,"move-down")]})(e),{[`${n}-rtl`]:{direction:"rtl"}},(0,r.genCompactItemStyle)(e,{borderElCls:`${n}-selector`,focusElCls:`${n}-focused`})]})(v),{[v.componentCls]:Object.assign(Object.assign(Object.assign(Object.assign({},{"&-outlined":Object.assign(Object.assign(Object.assign(Object.assign({},d(v,{borderColor:v.colorBorder,hoverBorderHover:v.hoverBorderColor,activeBorderColor:v.activeBorderColor,activeOutlineColor:v.activeOutlineColor,color:v.colorText})),f(v,{status:"error",borderColor:v.colorError,hoverBorderHover:v.colorErrorHover,activeBorderColor:v.colorError,activeOutlineColor:v.colorErrorOutline,color:v.colorError})),f(v,{status:"warning",borderColor:v.colorWarning,hoverBorderHover:v.colorWarningHover,activeBorderColor:v.colorWarning,activeOutlineColor:v.colorWarningOutline,color:v.colorWarning})),{[`&${v.componentCls}-disabled`]:{[`&:not(${v.componentCls}-customize-input) ${v.componentCls}-selector`]:{background:v.colorBgContainerDisabled,color:v.colorTextDisabled}},[`&${v.componentCls}-multiple ${v.componentCls}-selection-item`]:{background:v.multipleItemBg,border:`${(0,s.unit)(v.lineWidth)} ${v.lineType} ${v.multipleItemBorderColor}`}})}),{"&-filled":Object.assign(Object.assign(Object.assign(Object.assign({},p(v,{bg:v.colorFillTertiary,hoverBg:v.colorFillSecondary,activeBorderColor:v.activeBorderColor,color:v.colorText})),m(v,{status:"error",bg:v.colorErrorBg,hoverBg:v.colorErrorBgHover,activeBorderColor:v.colorError,color:v.colorError})),m(v,{status:"warning",bg:v.colorWarningBg,hoverBg:v.colorWarningBgHover,activeBorderColor:v.colorWarning,color:v.colorWarning})),{[`&${v.componentCls}-disabled`]:{[`&:not(${v.componentCls}-customize-input) ${v.componentCls}-selector`]:{borderColor:v.colorBorder,background:v.colorBgContainerDisabled,color:v.colorTextDisabled}},[`&${v.componentCls}-multiple ${v.componentCls}-selection-item`]:{background:v.colorBgContainer,border:`${(0,s.unit)(v.lineWidth)} ${v.lineType} ${v.colorSplit}`}})}),{"&-borderless":{[`${v.componentCls}-selector`]:{background:"transparent",border:`${(0,s.unit)(v.lineWidth)} ${v.lineType} transparent`},[`&${v.componentCls}-disabled`]:{[`&:not(${v.componentCls}-customize-input) ${v.componentCls}-selector`]:{color:v.colorTextDisabled}},[`&${v.componentCls}-multiple ${v.componentCls}-selection-item`]:{background:v.multipleItemBg,border:`${(0,s.unit)(v.lineWidth)} ${v.lineType} ${v.multipleItemBorderColor}`},[`&${v.componentCls}-status-error`]:{[`${v.componentCls}-prefix, ${v.componentCls}-selection-item`]:{color:v.colorError}},[`&${v.componentCls}-status-warning`]:{[`${v.componentCls}-prefix, ${v.componentCls}-selection-item`]:{color:v.colorWarning}}}}),{"&-underlined":Object.assign(Object.assign(Object.assign(Object.assign({},h(v,{borderColor:v.colorBorder,hoverBorderHover:v.hoverBorderColor,activeBorderColor:v.activeBorderColor,activeOutlineColor:v.activeOutlineColor,color:v.colorText})),g(v,{status:"error",borderColor:v.colorError,hoverBorderHover:v.colorErrorHover,activeBorderColor:v.colorError,activeOutlineColor:v.colorErrorOutline,color:v.colorError})),g(v,{status:"warning",borderColor:v.colorWarning,hoverBorderHover:v.colorWarningHover,activeBorderColor:v.colorWarning,activeOutlineColor:v.colorWarningOutline,color:v.colorWarning})),{[`&${v.componentCls}-disabled`]:{[`&:not(${v.componentCls}-customize-input) ${v.componentCls}-selector`]:{color:v.colorTextDisabled}},[`&${v.componentCls}-multiple ${v.componentCls}-selection-item`]:{background:v.multipleItemBg,border:`${(0,s.unit)(v.lineWidth)} ${v.lineType} ${v.multipleItemBorderColor}`}})})}]},e=>{let{fontSize:t,lineHeight:r,lineWidth:n,controlHeight:o,controlHeightSM:a,controlHeightLG:i,paddingXXS:l,controlPaddingHorizontal:s,zIndexPopupBase:c,colorText:u,fontWeightStrong:d,controlItemBgActive:f,controlItemBgHover:p,colorBgContainer:m,colorFillSecondary:h,colorBgContainerDisabled:g,colorTextDisabled:v,colorPrimaryHover:y,colorPrimary:b,controlOutline:w}=e,$=2*l,C=2*n,E=Math.min(o-$,o-C),S=Math.min(a-$,a-C),x=Math.min(i-$,i-C);return{INTERNAL_FIXED_ITEM_MARGIN:Math.floor(l/2),zIndexPopup:c+50,optionSelectedColor:u,optionSelectedFontWeight:d,optionSelectedBg:f,optionActiveBg:p,optionPadding:`${(o-t*r)/2}px ${s}px`,optionFontSize:t,optionLineHeight:r,optionHeight:o,selectorBg:m,clearBg:m,singleItemHeightLG:i,multipleItemBg:h,multipleItemBorderColor:"transparent",multipleItemHeight:E,multipleItemHeightSM:S,multipleItemHeightLG:x,multipleSelectorBgDisabled:g,multipleItemColorDisabled:v,multipleItemBorderColorDisabled:"transparent",showArrowPaddingInlineEnd:Math.ceil(1.25*e.fontSize),hoverBorderColor:y,activeBorderColor:b,activeOutlineColor:w,selectAffixPadding:l}},{unitless:{optionLineHeight:!0,optionSelectedFontWeight:!0}});e.s(["default",0,v],950302)},729151,e=>{"use strict";var t=e.i(271645),r=e.i(121229),n=e.i(726289),o=e.i(864517),a=e.i(247153),i=e.i(739295),l=e.i(38953);function s({suffixIcon:e,clearIcon:s,menuItemSelectedIcon:c,removeIcon:u,loading:d,multiple:f,hasFeedback:p,prefixCls:m,showSuffixIcon:h,feedbackIcon:g,showArrow:v,componentName:y}){let b=null!=s?s:t.createElement(n.default,null),w=r=>null!==e||p||v?t.createElement(t.Fragment,null,!1!==h&&r,p&&g):null,$=null;if(void 0!==e)$=w(e);else if(d)$=w(t.createElement(i.default,{spin:!0}));else{let e=`${m}-suffix`;$=({open:r,showSearch:n})=>r&&n?w(t.createElement(l.default,{className:e})):w(t.createElement(a.default,{className:e}))}let C=null;C=void 0!==c?c:f?t.createElement(r.default,null):null;return{clearIcon:b,suffixIcon:$,itemIcon:C,removeIcon:void 0!==u?u:t.createElement(o.default,null)}}e.s(["default",()=>s])},327494,e=>{"use strict";e.i(247167);var t=e.i(271645),r=e.i(343794),n=e.i(123829),o=e.i(955492),a=e.i(869301),i=e.i(529681),l=e.i(122767),s=e.i(613541),c=e.i(805484),u=e.i(52956),d=e.i(242064),f=e.i(721132),p=e.i(937328),m=e.i(321883),h=e.i(517455),g=e.i(62139),v=e.i(792812),y=e.i(249616),b=e.i(104458),w=e.i(85566),$=e.i(950302),C=e.i(729151),E=e.i(617206),S=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var 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 x="SECRET_COMBOBOX_MODE_DO_NOT_USE",j=t.forwardRef((e,o)=>{var a,c,j,O,k,T,F,_;let I,{prefixCls:P,bordered:N,className:R,rootClassName:M,getPopupContainer:B,popupClassName:A,dropdownClassName:z,listHeight:L=256,placement:H,listItemHeight:D,size:V,disabled:W,notFoundContent:G,status:U,builtinPlacements:q,dropdownMatchSelectWidth:J,popupMatchSelectWidth:K,direction:X,style:Y,allowClear:Z,variant:Q,dropdownStyle:ee,transitionName:et,tagRender:er,maxCount:en,prefix:eo,dropdownRender:ea,popupRender:ei,onDropdownVisibleChange:el,onOpenChange:es,styles:ec,classNames:eu}=e,ed=S(e,["prefixCls","bordered","className","rootClassName","getPopupContainer","popupClassName","dropdownClassName","listHeight","placement","listItemHeight","size","disabled","notFoundContent","status","builtinPlacements","dropdownMatchSelectWidth","popupMatchSelectWidth","direction","style","allowClear","variant","dropdownStyle","transitionName","tagRender","maxCount","prefix","dropdownRender","popupRender","onDropdownVisibleChange","onOpenChange","styles","classNames"]),{getPopupContainer:ef,getPrefixCls:ep,renderEmpty:em,direction:eh,virtual:eg,popupMatchSelectWidth:ev,popupOverflow:ey}=t.useContext(d.ConfigContext),{showSearch:eb,style:ew,styles:e$,className:eC,classNames:eE}=(0,d.useComponentConfig)("select"),[,eS]=(0,b.useToken)(),ex=null!=D?D:null==eS?void 0:eS.controlHeight,ej=ep("select",P),eO=ep(),ek=null!=X?X:eh,{compactSize:eT,compactItemClassnames:eF}=(0,y.useCompactItemContext)(ej,ek),[e_,eI]=(0,v.default)("select",Q,N),eP=(0,m.default)(ej),[eN,eR,eM]=(0,$.default)(ej,eP),eB=t.useMemo(()=>{let{mode:t}=e;if("combobox"!==t)return t===x?"combobox":t},[e.mode]),eA="multiple"===eB||"tags"===eB,ez=(T=e.suffixIcon,void 0!==(F=e.showArrow)?F:null!==T),eL=null!=(a=null!=K?K:J)?a:ev,eH=(null==(c=null==ec?void 0:ec.popup)?void 0:c.root)||(null==(j=e$.popup)?void 0:j.root)||ee,eD=(_=ei||ea,t.default.useMemo(()=>{if(_)return(...e)=>t.default.createElement(E.default,{space:!0},_.apply(void 0,e))},[_])),{status:eV,hasFeedback:eW,isFormItemInput:eG,feedbackIcon:eU}=t.useContext(g.FormItemInputContext),eq=(0,u.getMergedStatus)(eV,U);I=void 0!==G?G:"combobox"===eB?null:(null==em?void 0:em("Select"))||t.createElement(f.default,{componentName:"Select"});let{suffixIcon:eJ,itemIcon:eK,removeIcon:eX,clearIcon:eY}=(0,C.default)(Object.assign(Object.assign({},ed),{multiple:eA,hasFeedback:eW,feedbackIcon:eU,showSuffixIcon:ez,prefixCls:ej,componentName:"Select"})),eZ=(0,i.default)(ed,["suffixIcon","itemIcon"]),eQ=(0,r.default)((null==(O=null==eu?void 0:eu.popup)?void 0:O.root)||(null==(k=null==eE?void 0:eE.popup)?void 0:k.root)||A||z,{[`${ej}-dropdown-${ek}`]:"rtl"===ek},M,eE.root,null==eu?void 0:eu.root,eM,eP,eR),e0=(0,h.default)(e=>{var t;return null!=(t=null!=V?V:eT)?t:e}),e1=t.useContext(p.default),e2=(0,r.default)({[`${ej}-lg`]:"large"===e0,[`${ej}-sm`]:"small"===e0,[`${ej}-rtl`]:"rtl"===ek,[`${ej}-${e_}`]:eI,[`${ej}-in-form-item`]:eG},(0,u.getStatusClassNames)(ej,eq,eW),eF,eC,R,eE.root,null==eu?void 0:eu.root,M,eM,eP,eR),e4=t.useMemo(()=>void 0!==H?H:"rtl"===ek?"bottomRight":"bottomLeft",[H,ek]),[e6]=(0,l.useZIndex)("SelectLike",null==eH?void 0:eH.zIndex);return eN(t.createElement(n.default,Object.assign({ref:o,virtual:eg,showSearch:eb},eZ,{style:Object.assign(Object.assign(Object.assign(Object.assign({},e$.root),null==ec?void 0:ec.root),ew),Y),dropdownMatchSelectWidth:eL,transitionName:(0,s.getTransitionName)(eO,"slide-up",et),builtinPlacements:(0,w.default)(q,ey),listHeight:L,listItemHeight:ex,mode:eB,prefixCls:ej,placement:e4,direction:ek,prefix:eo,suffixIcon:eJ,menuItemSelectedIcon:eK,removeIcon:eX,allowClear:!0===Z?{clearIcon:eY}:Z,notFoundContent:I,className:e2,getPopupContainer:B||ef,dropdownClassName:eQ,disabled:null!=W?W:e1,dropdownStyle:Object.assign(Object.assign({},eH),{zIndex:e6}),maxCount:eA?en:void 0,tagRender:eA?er:void 0,dropdownRender:eD,onDropdownVisibleChange:es||el})))}),O=(0,c.default)(j,"dropdownAlign");j.SECRET_COMBOBOX_MODE_DO_NOT_USE=x,j.Option=a.Option,j.OptGroup=o.OptGroup,j._InternalPanelDoNotUseOrYouWillBeFired=O,e.s(["default",0,j],327494)},199133,e=>{"use strict";var t=e.i(327494);e.s(["Select",()=>t.default])},689074,21243,98801,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:"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 22ZM11 15V17H13V15H11ZM11 7V13H13V7H11Z"}))};e.s(["default",()=>n],689074);let o=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:"M1.18164 12C2.12215 6.87976 6.60812 3 12.0003 3C17.3924 3 21.8784 6.87976 22.8189 12C21.8784 17.1202 17.3924 21 12.0003 21C6.60812 21 2.12215 17.1202 1.18164 12ZM12.0003 17C14.7617 17 17.0003 14.7614 17.0003 12C17.0003 9.23858 14.7617 7 12.0003 7C9.23884 7 7.00026 9.23858 7.00026 12C7.00026 14.7614 9.23884 17 12.0003 17ZM12.0003 15C10.3434 15 9.00026 13.6569 9.00026 12C9.00026 10.3431 10.3434 9 12.0003 9C13.6571 9 15.0003 10.3431 15.0003 12C15.0003 13.6569 13.6571 15 12.0003 15Z"}))};e.s(["default",()=>o],21243);let a=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:"M4.52047 5.93457L1.39366 2.80777L2.80788 1.39355L22.6069 21.1925L21.1927 22.6068L17.8827 19.2968C16.1814 20.3755 14.1638 21.0002 12.0003 21.0002C6.60812 21.0002 2.12215 17.1204 1.18164 12.0002C1.61832 9.62282 2.81932 7.5129 4.52047 5.93457ZM14.7577 16.1718L13.2937 14.7078C12.902 14.8952 12.4634 15.0002 12.0003 15.0002C10.3434 15.0002 9.00026 13.657 9.00026 12.0002C9.00026 11.537 9.10522 11.0984 9.29263 10.7067L7.82866 9.24277C7.30514 10.0332 7.00026 10.9811 7.00026 12.0002C7.00026 14.7616 9.23884 17.0002 12.0003 17.0002C13.0193 17.0002 13.9672 16.6953 14.7577 16.1718ZM7.97446 3.76015C9.22127 3.26959 10.5793 3.00016 12.0003 3.00016C17.3924 3.00016 21.8784 6.87992 22.8189 12.0002C22.5067 13.6998 21.8038 15.2628 20.8068 16.5925L16.947 12.7327C16.9821 12.4936 17.0003 12.249 17.0003 12.0002C17.0003 9.23873 14.7617 7.00016 12.0003 7.00016C11.7514 7.00016 11.5068 7.01833 11.2677 7.05343L7.97446 3.76015Z"}))};e.s(["default",()=>a],98801)},103471,e=>{"use strict";var t=e.i(444755),r=e.i(271645);let n=e=>["string","number"].includes(typeof e)?e:e instanceof Array?e.map(n).join(""):"object"==typeof e&&e?n(e.props.children):void 0;function o(e){let t=new Map;return r.default.Children.map(e,e=>{var r;t.set(e.props.value,null!=(r=n(e))?r:e.props.value)}),t}function a(e,t){return r.default.Children.map(t,t=>{var r;if((null!=(r=n(t))?r:t.props.value).toLowerCase().includes(e.toLowerCase()))return t})}let i=(e,r,n=!1)=>(0,t.tremorTwMerge)(r?"bg-tremor-background-subtle dark:bg-dark-tremor-background-subtle":"bg-tremor-background dark:bg-dark-tremor-background",!r&&"hover:bg-tremor-background-muted dark:hover:bg-dark-tremor-background-muted",e?"text-tremor-content-emphasis dark:text-dark-tremor-content-emphasis":"text-tremor-content dark:text-dark-tremor-content",r&&"text-tremor-content-subtle dark:text-dark-tremor-content-subtle",n&&"text-red-500 placeholder:text-red-500 dark:text-red-500 dark:placeholder:text-red-500",n?"border-red-500 dark:border-red-500":"border-tremor-border dark:border-dark-tremor-border");function l(e){return null!=e&&""!==e}e.s(["constructValueToNameMapping",()=>o,"getFilteredOptions",()=>a,"getNodeText",()=>n,"getSelectButtonColors",()=>i,"hasValue",()=>l])},779241,677955,e=>{"use strict";var t=e.i(290571),r=e.i(271645),n=e.i(673706),o=e.i(689074),a=e.i(21243),i=e.i(98801),l=e.i(103471),s=e.i(444755);let c=r.default.forwardRef((e,c)=>{let{value:u,defaultValue:d,type:f,placeholder:p="Type...",icon:m,error:h=!1,errorMessage:g,disabled:v=!1,stepper:y,makeInputClassName:b,className:w,onChange:$,onValueChange:C,autoFocus:E,pattern:S}=e,x=(0,t.__rest)(e,["value","defaultValue","type","placeholder","icon","error","errorMessage","disabled","stepper","makeInputClassName","className","onChange","onValueChange","autoFocus","pattern"]),[j,O]=(0,r.useState)(E||!1),[k,T]=(0,r.useState)(!1),F=(0,r.useCallback)(()=>T(!k),[k,T]),_=(0,r.useRef)(null),I=(0,l.hasValue)(u||d);return r.default.useEffect(()=>{let e=()=>O(!0),t=()=>O(!1),r=_.current;return r&&(r.addEventListener("focus",e),r.addEventListener("blur",t),E&&r.focus()),()=>{r&&(r.removeEventListener("focus",e),r.removeEventListener("blur",t))}},[E]),r.default.createElement(r.default.Fragment,null,r.default.createElement("div",{className:(0,s.tremorTwMerge)(b("root"),"relative w-full flex items-center min-w-[10rem] outline-none rounded-tremor-default transition duration-100 border","shadow-tremor-input","dark:shadow-dark-tremor-input",(0,l.getSelectButtonColors)(I,v,h),j&&(0,s.tremorTwMerge)("ring-2","border-tremor-brand-subtle ring-tremor-brand-muted","dark:border-dark-tremor-brand-subtle dark:ring-dark-tremor-brand-muted"),w)},m?r.default.createElement(m,{className:(0,s.tremorTwMerge)(b("icon"),"shrink-0 h-5 w-5 mx-2.5 absolute left-0 flex items-center","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")}):null,r.default.createElement("input",Object.assign({ref:(0,n.mergeRefs)([_,c]),defaultValue:d,value:u,type:k?"text":f,className:(0,s.tremorTwMerge)(b("input"),"w-full bg-transparent focus:outline-none focus:ring-0 border-none text-tremor-default rounded-tremor-default transition duration-100 py-2","text-tremor-content-emphasis","dark:text-dark-tremor-content-emphasis","[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none","password"===f?h?"pr-16":"pr-12":h?"pr-8":"pr-3",m?"pl-10":"pl-3",v?"placeholder:text-tremor-content-subtle dark:placeholder:text-dark-tremor-content-subtle":"placeholder:text-tremor-content dark:placeholder:text-dark-tremor-content"),placeholder:p,disabled:v,"data-testid":"base-input",onChange:e=>{null==$||$(e),null==C||C(e.target.value)},pattern:S},x)),"password"!==f||v?null:r.default.createElement("button",{className:(0,s.tremorTwMerge)(b("toggleButton"),"absolute inset-y-0 right-0 flex items-center px-2.5 rounded-lg"),type:"button",onClick:()=>F(),"aria-label":k?"Hide password":"Show Password"},k?r.default.createElement(i.default,{className:(0,s.tremorTwMerge)("flex-none h-5 w-5 transition","text-tremor-content-subtle hover:text-tremor-content","dark:text-dark-tremor-content-subtle hover:dark:text-dark-tremor-content"),"aria-hidden":!0}):r.default.createElement(a.default,{className:(0,s.tremorTwMerge)("flex-none h-5 w-5 transition","text-tremor-content-subtle hover:text-tremor-content","dark:text-dark-tremor-content-subtle hover:dark:text-dark-tremor-content"),"aria-hidden":!0})),h?r.default.createElement(o.default,{className:(0,s.tremorTwMerge)(b("errorIcon"),"text-red-500 shrink-0 h-5 w-5 absolute right-0 flex items-center","password"===f?"mr-10":"number"===f?y?"mr-20":"mr-3":"mx-2.5")}):null,null!=y?y:null),h&&g?r.default.createElement("p",{className:(0,s.tremorTwMerge)(b("errorMessage"),"text-sm text-red-500 mt-1")},g):null)});c.displayName="BaseInput",e.s(["default",()=>c],677955);let u=(0,n.makeClassName)("TextInput"),d=r.default.forwardRef((e,n)=>{let{type:o="text"}=e,a=(0,t.__rest)(e,["type"]);return r.default.createElement(c,Object.assign({ref:n,type:o,makeInputClassName:u},a))});d.displayName="TextInput",e.s(["TextInput",()=>d],779241)},122550,e=>{"use strict";function t(e,t){return e.length>t?e.substring(0,t)+"...":e}e.s(["formItemValidateJSON",0,(e,t)=>{if(!t)return Promise.resolve();try{return JSON.parse(t),Promise.resolve()}catch(e){return Promise.reject("Please enter valid JSON")}},"formatLabel",0,e=>e?e.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase()):e,"truncateString",()=>t])},764205,82946,e=>{"use strict";e.s(["addAllowedIP",()=>eP,"adminGlobalActivity",()=>eq,"adminGlobalActivityPerModel",()=>eK,"adminGlobalCacheActivity",()=>eJ,"adminSpendLogsCall",()=>eV,"adminTopEndUsersCall",()=>eG,"adminTopKeysCall",()=>eW,"adminTopModelsCall",()=>eX,"adminspendByProvider",()=>eU,"agentDailyActivityCall",()=>ew,"agentHubPublicModelsCall",()=>eT,"alertingSettingsCall",()=>J,"allEndUsersCall",()=>eL,"allTagNamesCall",()=>ez,"applyGuardrail",()=>nr,"approveGuardrailSubmission",()=>tB,"approveMCPServer",()=>rS,"availableTeamListCall",()=>el,"budgetCreateCall",()=>G,"budgetDeleteCall",()=>W,"budgetUpdateCall",()=>U,"buildMcpOAuthAuthorizeUrl",()=>nh,"cacheTemporaryMcpServer",()=>np,"cachingHealthCheckCall",()=>tk,"callMCPTool",()=>rP,"cancelModelCostMapReload",()=>z,"checkEuAiActCompliance",()=>nM,"checkGdprCompliance",()=>nB,"claimOnboardingToken",()=>eC,"convertPromptFileToJson",()=>rl,"createAgentCall",()=>rs,"createGuardrailCall",()=>rc,"createMCPServer",()=>rb,"createPassThroughEndpoint",()=>tC,"createPolicyAttachmentCall",()=>t3,"createPolicyCall",()=>tY,"createPolicyVersion",()=>t0,"createPromptCall",()=>ro,"createSearchTool",()=>rO,"credentialCreateCall",()=>e3,"credentialDeleteCall",()=>e9,"credentialGetCall",()=>e5,"credentialListCall",()=>e7,"credentialUpdateCall",()=>e8,"customerDailyActivityCall",()=>eb,"deleteAgentCall",()=>rQ,"deleteAllowedIP",()=>eN,"deleteCallback",()=>nd,"deleteClaudeCodePlugin",()=>nR,"deleteConfigFieldSetting",()=>tS,"deleteGuardrailCall",()=>r2,"deleteMCPOAuthUserCredential",()=>nG,"deleteMCPServer",()=>r$,"deletePassThroughEndpointsCall",()=>tx,"deletePolicyAttachmentCall",()=>t7,"deletePolicyCall",()=>t2,"deletePromptCall",()=>ri,"deleteSearchTool",()=>rT,"deleteToolPolicyOverride",()=>nV,"deriveErrorMessage",()=>nx,"disableClaudeCodePlugin",()=>nN,"enableClaudeCodePlugin",()=>nP,"enrichPolicyTemplate",()=>tU,"enrichPolicyTemplateStream",()=>tK,"estimateAttachmentImpactCall",()=>re,"exchangeMcpOAuthToken",()=>ng,"fetchAvailableSearchProviders",()=>rF,"fetchDiscoverableMCPServers",()=>rm,"fetchMCPAccessGroups",()=>rv,"fetchMCPClientIp",()=>ry,"fetchMCPServerHealth",()=>rg,"fetchMCPServers",()=>rh,"fetchMCPSubmissions",()=>rE,"fetchOpenAPIRegistry",()=>rp,"fetchSearchTools",()=>rj,"fetchToolDetail",()=>nH,"fetchToolPolicyOptions",()=>nA,"fetchToolsList",()=>nz,"formatDate",()=>v,"getAgentCreateMetadata",()=>k,"getAgentInfo",()=>r9,"getAgentsList",()=>r5,"getAllowedIPs",()=>eI,"getBudgetList",()=>tp,"getCacheSettingsCall",()=>tv,"getCallbackConfigsCall",()=>y,"getCallbacksCall",()=>tm,"getCategoryYaml",()=>r3,"getClaudeCodeMarketplace",()=>nT,"getClaudeCodePluginDetails",()=>n_,"getClaudeCodePluginsList",()=>nF,"getConfigFieldSetting",()=>t$,"getDefaultTeamSettings",()=>rz,"getEmailEventSettings",()=>rX,"getGeneralSettingsCall",()=>th,"getGlobalLitellmHeaderName",()=>_,"getGuardrailInfo",()=>r8,"getGuardrailProviderSpecificParams",()=>r6,"getGuardrailUISettings",()=>r4,"getGuardrailsList",()=>tR,"getGuardrailsUsageDetail",()=>tL,"getGuardrailsUsageLogs",()=>tH,"getGuardrailsUsageOverview",()=>tz,"getInProductNudgesCall",()=>b,"getInternalUserSettings",()=>rd,"getLicenseInfo",()=>nc,"getMCPOAuthUserCredentialStatus",()=>nU,"getMCPSemanticFilterSettings",()=>tI,"getMajorAirlines",()=>r7,"getModelCostMapReloadStatus",()=>H,"getModelCostMapSource",()=>L,"getOnboardingCredentials",()=>e$,"getOpenAPISchema",()=>R,"getPassThroughEndpointsCall",()=>tw,"getPoliciesList",()=>tD,"getPolicyAttachmentsList",()=>t6,"getPolicyInfo",()=>t4,"getPolicyInfoWithGuardrails",()=>tW,"getPolicyTemplates",()=>tG,"getPossibleUserRoles",()=>e4,"getPromptInfo",()=>rr,"getPromptVersions",()=>rn,"getPromptsList",()=>rt,"getProviderCreateMetadata",()=>O,"getProxyBaseUrl",()=>C,"getProxyUISettings",()=>tF,"getPublicModelHubInfo",()=>N,"getRemainingUsers",()=>ns,"getResolvedGuardrails",()=>t9,"getRouterSettingsCall",()=>tg,"getSSOSettings",()=>na,"getTeamPermissionsCall",()=>rH,"getToolUsageLogs",()=>nL,"getUISettings",()=>t_,"getUiConfig",()=>P,"getUiSettings",()=>nO,"handleError",()=>j,"individualModelHealthCheckCall",()=>tO,"invitationCreateCall",()=>q,"keyAliasesCall",()=>e1,"keyCreateCall",()=>X,"keyCreateForAgentCall",()=>Y,"keyCreateServiceAccountCall",()=>K,"keyDeleteCall",()=>Q,"keyInfoCall",()=>eY,"keyInfoV1Call",()=>eQ,"keyListCall",()=>e0,"keyUpdateCall",()=>te,"latestHealthChecksCall",()=>tT,"listGuardrailSubmissions",()=>tM,"listMCPTools",()=>rI,"listMCPUserCredentials",()=>nq,"listPolicyVersions",()=>tQ,"loginCall",()=>nj,"makeAgentsPublicCall",()=>r0,"makeMCPPublicCall",()=>r1,"makeModelGroupPublic",()=>I,"mcpHubPublicServersCall",()=>eF,"modelAvailableCall",()=>eM,"modelCostMap",()=>M,"modelCreateCall",()=>D,"modelDeleteCall",()=>V,"modelHubCall",()=>e_,"modelHubPublicModelsCall",()=>ek,"modelInfoCall",()=>ej,"modelInfoV1Call",()=>eO,"modelPatchUpdateCall",()=>tr,"organizationCreateCall",()=>eu,"organizationDailyActivityCall",()=>ey,"organizationDeleteCall",()=>ef,"organizationInfoCall",()=>ec,"organizationListCall",()=>es,"organizationMemberAddCall",()=>tl,"organizationMemberDeleteCall",()=>ts,"organizationMemberUpdateCall",()=>tc,"organizationUpdateCall",()=>ed,"patchAgentCall",()=>ne,"perUserAnalyticsCall",()=>nS,"proxyBaseUrl",()=>$,"ragIngestCall",()=>rK,"regenerateKeyCall",()=>eE,"registerClaudeCodePlugin",()=>nI,"registerMCPServer",()=>rC,"registerMcpOAuthClient",()=>nm,"rejectGuardrailSubmission",()=>tA,"rejectMCPServer",()=>rx,"reloadModelCostMap",()=>B,"resetEmailEventSettings",()=>rZ,"resolvePoliciesCall",()=>t8,"scheduleModelCostMapReload",()=>A,"searchToolQueryCall",()=>ny,"serverRootPath",()=>w,"serviceHealthCheck",()=>tf,"sessionSpendLogsCall",()=>rV,"setCallbacksCall",()=>tj,"setGlobalLitellmHeaderName",()=>F,"storeMCPOAuthUserCredential",()=>nW,"suggestPolicyTemplates",()=>tq,"tagCreateCall",()=>rN,"tagDailyActivityCall",()=>eg,"tagDauCall",()=>nb,"tagDeleteCall",()=>rA,"tagDistinctCall",()=>nC,"tagInfoCall",()=>rM,"tagListCall",()=>rB,"tagMauCall",()=>n$,"tagUpdateCall",()=>rR,"tagWauCall",()=>nw,"tagsSpendLogsCall",()=>eA,"teamBulkMemberAddCall",()=>to,"teamCreateCall",()=>e6,"teamDailyActivityCall",()=>ev,"teamDeleteCall",()=>et,"teamInfoCall",()=>eo,"teamListCall",()=>ei,"teamMemberAddCall",()=>tn,"teamMemberDeleteCall",()=>ti,"teamMemberUpdateCall",()=>ta,"teamPermissionsUpdateCall",()=>rD,"teamSpendLogsCall",()=>eB,"teamUpdateCall",()=>tt,"testCacheConnectionCall",()=>ty,"testConnectionRequest",()=>eZ,"testCustomCodeGuardrail",()=>nn,"testMCPSemanticFilter",()=>tN,"testMCPToolsListRequest",()=>nf,"testPipelineCall",()=>t5,"testPoliciesAndGuardrails",()=>tV,"testPolicyTemplate",()=>tJ,"testSearchToolConnection",()=>r_,"transformRequestCall",()=>ep,"uiAuditLogsCall",()=>nl,"uiSpendLogDetailsCall",()=>ru,"uiSpendLogsCall",()=>eD,"updateCacheSettingsCall",()=>tb,"updateConfigFieldSetting",()=>tE,"updateDefaultTeamSettings",()=>rL,"updateEmailEventSettings",()=>rY,"updateGuardrailCall",()=>nt,"updateInternalUserSettings",()=>rf,"updateMCPSemanticFilterSettings",()=>tP,"updateMCPServer",()=>rw,"updatePassThroughEndpoint",()=>nu,"updatePolicyCall",()=>tZ,"updatePolicyVersionStatus",()=>t1,"updatePromptCall",()=>ra,"updateSSOSettings",()=>ni,"updateSearchTool",()=>rk,"updateToolPolicy",()=>nD,"updateUiSettings",()=>nk,"updateUsefulLinksCall",()=>eR,"usageAiChatStream",()=>tX,"userAgentSummaryCall",()=>nE,"userBulkUpdateUserCall",()=>td,"userCreateCall",()=>Z,"userDailyActivityAggregatedCall",()=>e2,"userDailyActivityCall",()=>eh,"userDeleteCall",()=>ee,"userFilterUICall",()=>eH,"userInfoCall",()=>en,"userListCall",()=>er,"userUpdateUserCall",()=>tu,"v2TeamListCall",()=>ea,"validateBlockedWordsFile",()=>no,"vectorStoreCreateCall",()=>rW,"vectorStoreDeleteCall",()=>rU,"vectorStoreInfoCall",()=>rq,"vectorStoreListCall",()=>rG,"vectorStoreSearchCall",()=>nv,"vectorStoreUpdateCall",()=>rJ],764205),e.i(247167);var t=e.i(998573),r=e.i(268004);e.s(["default",()=>h,"jsonFields",()=>p],82946);var n=e.i(843476),o=e.i(271645),a=e.i(808613),i=e.i(311451),l=e.i(28651),s=e.i(199133),c=e.i(779241),u=e.i(827252),d=e.i(592968),f=e.i(122550);let p=["metadata","config","enforced_params","aliases"],m=(e,t)=>p.includes(e)||"json"===t.format,h=({schemaComponent:e,excludedFields:t=[],form:r,overrideLabels:p={},overrideTooltips:h={},customValidation:g={},defaultValues:v={}})=>{let[y,b]=(0,o.useState)(null),[w,$]=(0,o.useState)(null);return((0,o.useEffect)(()=>{(async()=>{try{let n=(await R()).components.schemas[e];if(!n)throw Error(`Schema component "${e}" not found`);b(n);let o={};Object.keys(n.properties).filter(e=>!t.includes(e)&&void 0!==v[e]).forEach(e=>{o[e]=v[e]}),r.setFieldsValue(o)}catch(e){console.error("Schema fetch error:",e),$(e instanceof Error?e.message:"Failed to fetch schema")}})()},[e,r,t]),w)?(0,n.jsxs)("div",{className:"text-red-500",children:["Error: ",w]}):y?.properties?(0,n.jsx)("div",{children:Object.entries(y.properties).filter(([e])=>!t.includes(e)).map(([e,t])=>{let r,o,b,w,$,C,E,S;return o=(e=>{if(e.type)return e.type;if(e.anyOf){let t=e.anyOf.map(e=>e.type);if(t.includes("number")||t.includes("integer"))return"number";t.includes("string")}return"string"})(t),b=y?.required?.includes(e),w=p[e]||t.title||(0,f.formatLabel)(e),$=h[e]||t.description,C=[],b&&C.push({required:!0,message:`${w} is required`}),g[e]&&C.push({validator:g[e]}),m(e,t)&&C.push({validator:async(e,t)=>{if(t&&!(e=>{if(!e)return!0;try{return JSON.parse(e),!0}catch{return!1}})(t))throw Error("Please enter valid JSON")}}),E=$?(0,n.jsxs)("span",{children:[w," ",(0,n.jsx)(d.Tooltip,{title:$,children:(0,n.jsx)(u.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}):w,r=m(e,t)?(0,n.jsx)(i.Input.TextArea,{rows:4,placeholder:"Enter as JSON",className:"font-mono"}):t.enum?(0,n.jsx)(s.Select,{children:t.enum.map(e=>(0,n.jsx)(s.Select.Option,{value:e,children:e},e))}):"number"===o||"integer"===o?(0,n.jsx)(l.InputNumber,{style:{width:"100%"},precision:"integer"===o?0:void 0}):"duration"===e?(0,n.jsx)(c.TextInput,{placeholder:"eg: 30s, 30h, 30d"}):(0,n.jsx)(c.TextInput,{placeholder:$||""}),(0,n.jsx)(a.Form.Item,{label:E,name:e,className:"mt-8",rules:C,initialValue:v[e],help:(0,n.jsx)("div",{className:"text-xs text-gray-500",children:(S=({max_budget:"Enter maximum budget in USD (e.g., 100.50)",budget_duration:"Select a time period for budget reset",tpm_limit:"Enter maximum tokens per minute (whole number)",rpm_limit:"Enter maximum requests per minute (whole number)",duration:"Enter duration (e.g., 30s, 24h, 7d)",metadata:'Enter JSON object with key-value pairs\nExample: {"team": "research", "project": "nlp"}',config:'Enter configuration as JSON object\nExample: {"setting": "value"}',permissions:"Enter comma-separated permission strings",enforced_params:'Enter parameters as JSON object\nExample: {"param": "value"}',blocked:"Enter true/false or specific block conditions",aliases:'Enter aliases as JSON object\nExample: {"alias1": "value1", "alias2": "value2"}',models:"Select one or more model names",key_alias:"Enter a unique identifier for this key",tags:"Enter comma-separated tag strings"})[e]||({string:"Text input",number:"Numeric input",integer:"Whole number input",boolean:"True/False value"})[o]||"Text input",m(e,t)?`${S} + `]:{animationName:i.slideDownOut},"&-hidden":{display:"none"},[o]:Object.assign(Object.assign({},l(e)),{cursor:"pointer",transition:`background ${e.motionDurationSlow} ease`,borderRadius:e.borderRadiusSM,"&-group":{color:e.colorTextDescription,fontSize:e.fontSizeSM,cursor:"default"},"&-option":{display:"flex","&-content":Object.assign({flex:"auto"},t.textEllipsis),"&-state":{flex:"none",display:"flex",alignItems:"center"},[`&-active:not(${o}-option-disabled)`]:{backgroundColor:e.optionActiveBg},[`&-selected:not(${o}-option-disabled)`]:{color:e.optionSelectedColor,fontWeight:e.optionSelectedFontWeight,backgroundColor:e.optionSelectedBg,[`${o}-option-state`]:{color:e.colorPrimary}},"&-disabled":{[`&${o}-option-selected`]:{backgroundColor:e.colorBgContainerDisabled},color:e.colorTextDisabled,cursor:"not-allowed"},"&-grouped":{paddingInlineStart:e.calc(e.controlPaddingHorizontal).mul(2).equal()}},"&-empty":Object.assign(Object.assign({},l(e)),{color:e.colorTextDisabled})}),[`${f}:has(+ ${f})`]:{borderEndStartRadius:0,borderEndEndRadius:0,[`& + ${f}`]:{borderStartStartRadius:0,borderStartEndRadius:0}},"&-rtl":{direction:"rtl"}})},(0,i.initSlideMotion)(e,"slide-up"),(0,i.initSlideMotion)(e,"slide-down"),(0,a.initMoveMotion)(e,"move-up"),(0,a.initMoveMotion)(e,"move-down")]})(e),{[`${n}-rtl`]:{direction:"rtl"}},(0,r.genCompactItemStyle)(e,{borderElCls:`${n}-selector`,focusElCls:`${n}-focused`})]})(v),{[v.componentCls]:Object.assign(Object.assign(Object.assign(Object.assign({},{"&-outlined":Object.assign(Object.assign(Object.assign(Object.assign({},d(v,{borderColor:v.colorBorder,hoverBorderHover:v.hoverBorderColor,activeBorderColor:v.activeBorderColor,activeOutlineColor:v.activeOutlineColor,color:v.colorText})),f(v,{status:"error",borderColor:v.colorError,hoverBorderHover:v.colorErrorHover,activeBorderColor:v.colorError,activeOutlineColor:v.colorErrorOutline,color:v.colorError})),f(v,{status:"warning",borderColor:v.colorWarning,hoverBorderHover:v.colorWarningHover,activeBorderColor:v.colorWarning,activeOutlineColor:v.colorWarningOutline,color:v.colorWarning})),{[`&${v.componentCls}-disabled`]:{[`&:not(${v.componentCls}-customize-input) ${v.componentCls}-selector`]:{background:v.colorBgContainerDisabled,color:v.colorTextDisabled}},[`&${v.componentCls}-multiple ${v.componentCls}-selection-item`]:{background:v.multipleItemBg,border:`${(0,s.unit)(v.lineWidth)} ${v.lineType} ${v.multipleItemBorderColor}`}})}),{"&-filled":Object.assign(Object.assign(Object.assign(Object.assign({},p(v,{bg:v.colorFillTertiary,hoverBg:v.colorFillSecondary,activeBorderColor:v.activeBorderColor,color:v.colorText})),m(v,{status:"error",bg:v.colorErrorBg,hoverBg:v.colorErrorBgHover,activeBorderColor:v.colorError,color:v.colorError})),m(v,{status:"warning",bg:v.colorWarningBg,hoverBg:v.colorWarningBgHover,activeBorderColor:v.colorWarning,color:v.colorWarning})),{[`&${v.componentCls}-disabled`]:{[`&:not(${v.componentCls}-customize-input) ${v.componentCls}-selector`]:{borderColor:v.colorBorder,background:v.colorBgContainerDisabled,color:v.colorTextDisabled}},[`&${v.componentCls}-multiple ${v.componentCls}-selection-item`]:{background:v.colorBgContainer,border:`${(0,s.unit)(v.lineWidth)} ${v.lineType} ${v.colorSplit}`}})}),{"&-borderless":{[`${v.componentCls}-selector`]:{background:"transparent",border:`${(0,s.unit)(v.lineWidth)} ${v.lineType} transparent`},[`&${v.componentCls}-disabled`]:{[`&:not(${v.componentCls}-customize-input) ${v.componentCls}-selector`]:{color:v.colorTextDisabled}},[`&${v.componentCls}-multiple ${v.componentCls}-selection-item`]:{background:v.multipleItemBg,border:`${(0,s.unit)(v.lineWidth)} ${v.lineType} ${v.multipleItemBorderColor}`},[`&${v.componentCls}-status-error`]:{[`${v.componentCls}-prefix, ${v.componentCls}-selection-item`]:{color:v.colorError}},[`&${v.componentCls}-status-warning`]:{[`${v.componentCls}-prefix, ${v.componentCls}-selection-item`]:{color:v.colorWarning}}}}),{"&-underlined":Object.assign(Object.assign(Object.assign(Object.assign({},h(v,{borderColor:v.colorBorder,hoverBorderHover:v.hoverBorderColor,activeBorderColor:v.activeBorderColor,activeOutlineColor:v.activeOutlineColor,color:v.colorText})),g(v,{status:"error",borderColor:v.colorError,hoverBorderHover:v.colorErrorHover,activeBorderColor:v.colorError,activeOutlineColor:v.colorErrorOutline,color:v.colorError})),g(v,{status:"warning",borderColor:v.colorWarning,hoverBorderHover:v.colorWarningHover,activeBorderColor:v.colorWarning,activeOutlineColor:v.colorWarningOutline,color:v.colorWarning})),{[`&${v.componentCls}-disabled`]:{[`&:not(${v.componentCls}-customize-input) ${v.componentCls}-selector`]:{color:v.colorTextDisabled}},[`&${v.componentCls}-multiple ${v.componentCls}-selection-item`]:{background:v.multipleItemBg,border:`${(0,s.unit)(v.lineWidth)} ${v.lineType} ${v.multipleItemBorderColor}`}})})}]},e=>{let{fontSize:t,lineHeight:r,lineWidth:n,controlHeight:o,controlHeightSM:a,controlHeightLG:i,paddingXXS:l,controlPaddingHorizontal:s,zIndexPopupBase:c,colorText:u,fontWeightStrong:d,controlItemBgActive:f,controlItemBgHover:p,colorBgContainer:m,colorFillSecondary:h,colorBgContainerDisabled:g,colorTextDisabled:v,colorPrimaryHover:y,colorPrimary:b,controlOutline:w}=e,$=2*l,C=2*n,E=Math.min(o-$,o-C),S=Math.min(a-$,a-C),x=Math.min(i-$,i-C);return{INTERNAL_FIXED_ITEM_MARGIN:Math.floor(l/2),zIndexPopup:c+50,optionSelectedColor:u,optionSelectedFontWeight:d,optionSelectedBg:f,optionActiveBg:p,optionPadding:`${(o-t*r)/2}px ${s}px`,optionFontSize:t,optionLineHeight:r,optionHeight:o,selectorBg:m,clearBg:m,singleItemHeightLG:i,multipleItemBg:h,multipleItemBorderColor:"transparent",multipleItemHeight:E,multipleItemHeightSM:S,multipleItemHeightLG:x,multipleSelectorBgDisabled:g,multipleItemColorDisabled:v,multipleItemBorderColorDisabled:"transparent",showArrowPaddingInlineEnd:Math.ceil(1.25*e.fontSize),hoverBorderColor:y,activeBorderColor:b,activeOutlineColor:w,selectAffixPadding:l}},{unitless:{optionLineHeight:!0,optionSelectedFontWeight:!0}});e.s(["default",0,v],950302)},729151,e=>{"use strict";var t=e.i(271645),r=e.i(121229),n=e.i(726289),o=e.i(864517),a=e.i(247153),i=e.i(739295),l=e.i(38953);function s({suffixIcon:e,clearIcon:s,menuItemSelectedIcon:c,removeIcon:u,loading:d,multiple:f,hasFeedback:p,prefixCls:m,showSuffixIcon:h,feedbackIcon:g,showArrow:v,componentName:y}){let b=null!=s?s:t.createElement(n.default,null),w=r=>null!==e||p||v?t.createElement(t.Fragment,null,!1!==h&&r,p&&g):null,$=null;if(void 0!==e)$=w(e);else if(d)$=w(t.createElement(i.default,{spin:!0}));else{let e=`${m}-suffix`;$=({open:r,showSearch:n})=>r&&n?w(t.createElement(l.default,{className:e})):w(t.createElement(a.default,{className:e}))}let C=null;C=void 0!==c?c:f?t.createElement(r.default,null):null;return{clearIcon:b,suffixIcon:$,itemIcon:C,removeIcon:void 0!==u?u:t.createElement(o.default,null)}}e.s(["default",()=>s])},327494,e=>{"use strict";e.i(247167);var t=e.i(271645),r=e.i(343794),n=e.i(123829),o=e.i(955492),a=e.i(869301),i=e.i(529681),l=e.i(122767),s=e.i(613541),c=e.i(805484),u=e.i(52956),d=e.i(242064),f=e.i(721132),p=e.i(937328),m=e.i(321883),h=e.i(517455),g=e.i(62139),v=e.i(792812),y=e.i(249616),b=e.i(104458),w=e.i(85566),$=e.i(950302),C=e.i(729151),E=e.i(617206),S=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var 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 x="SECRET_COMBOBOX_MODE_DO_NOT_USE",j=t.forwardRef((e,o)=>{var a,c,j,O,k,T,F,_;let I,{prefixCls:P,bordered:N,className:R,rootClassName:M,getPopupContainer:B,popupClassName:A,dropdownClassName:z,listHeight:L=256,placement:H,listItemHeight:D,size:V,disabled:W,notFoundContent:G,status:U,builtinPlacements:q,dropdownMatchSelectWidth:J,popupMatchSelectWidth:K,direction:X,style:Y,allowClear:Z,variant:Q,dropdownStyle:ee,transitionName:et,tagRender:er,maxCount:en,prefix:eo,dropdownRender:ea,popupRender:ei,onDropdownVisibleChange:el,onOpenChange:es,styles:ec,classNames:eu}=e,ed=S(e,["prefixCls","bordered","className","rootClassName","getPopupContainer","popupClassName","dropdownClassName","listHeight","placement","listItemHeight","size","disabled","notFoundContent","status","builtinPlacements","dropdownMatchSelectWidth","popupMatchSelectWidth","direction","style","allowClear","variant","dropdownStyle","transitionName","tagRender","maxCount","prefix","dropdownRender","popupRender","onDropdownVisibleChange","onOpenChange","styles","classNames"]),{getPopupContainer:ef,getPrefixCls:ep,renderEmpty:em,direction:eh,virtual:eg,popupMatchSelectWidth:ev,popupOverflow:ey}=t.useContext(d.ConfigContext),{showSearch:eb,style:ew,styles:e$,className:eC,classNames:eE}=(0,d.useComponentConfig)("select"),[,eS]=(0,b.useToken)(),ex=null!=D?D:null==eS?void 0:eS.controlHeight,ej=ep("select",P),eO=ep(),ek=null!=X?X:eh,{compactSize:eT,compactItemClassnames:eF}=(0,y.useCompactItemContext)(ej,ek),[e_,eI]=(0,v.default)("select",Q,N),eP=(0,m.default)(ej),[eN,eR,eM]=(0,$.default)(ej,eP),eB=t.useMemo(()=>{let{mode:t}=e;if("combobox"!==t)return t===x?"combobox":t},[e.mode]),eA="multiple"===eB||"tags"===eB,ez=(T=e.suffixIcon,void 0!==(F=e.showArrow)?F:null!==T),eL=null!=(a=null!=K?K:J)?a:ev,eH=(null==(c=null==ec?void 0:ec.popup)?void 0:c.root)||(null==(j=e$.popup)?void 0:j.root)||ee,eD=(_=ei||ea,t.default.useMemo(()=>{if(_)return(...e)=>t.default.createElement(E.default,{space:!0},_.apply(void 0,e))},[_])),{status:eV,hasFeedback:eW,isFormItemInput:eG,feedbackIcon:eU}=t.useContext(g.FormItemInputContext),eq=(0,u.getMergedStatus)(eV,U);I=void 0!==G?G:"combobox"===eB?null:(null==em?void 0:em("Select"))||t.createElement(f.default,{componentName:"Select"});let{suffixIcon:eJ,itemIcon:eK,removeIcon:eX,clearIcon:eY}=(0,C.default)(Object.assign(Object.assign({},ed),{multiple:eA,hasFeedback:eW,feedbackIcon:eU,showSuffixIcon:ez,prefixCls:ej,componentName:"Select"})),eZ=(0,i.default)(ed,["suffixIcon","itemIcon"]),eQ=(0,r.default)((null==(O=null==eu?void 0:eu.popup)?void 0:O.root)||(null==(k=null==eE?void 0:eE.popup)?void 0:k.root)||A||z,{[`${ej}-dropdown-${ek}`]:"rtl"===ek},M,eE.root,null==eu?void 0:eu.root,eM,eP,eR),e0=(0,h.default)(e=>{var t;return null!=(t=null!=V?V:eT)?t:e}),e1=t.useContext(p.default),e2=(0,r.default)({[`${ej}-lg`]:"large"===e0,[`${ej}-sm`]:"small"===e0,[`${ej}-rtl`]:"rtl"===ek,[`${ej}-${e_}`]:eI,[`${ej}-in-form-item`]:eG},(0,u.getStatusClassNames)(ej,eq,eW),eF,eC,R,eE.root,null==eu?void 0:eu.root,M,eM,eP,eR),e4=t.useMemo(()=>void 0!==H?H:"rtl"===ek?"bottomRight":"bottomLeft",[H,ek]),[e6]=(0,l.useZIndex)("SelectLike",null==eH?void 0:eH.zIndex);return eN(t.createElement(n.default,Object.assign({ref:o,virtual:eg,showSearch:eb},eZ,{style:Object.assign(Object.assign(Object.assign(Object.assign({},e$.root),null==ec?void 0:ec.root),ew),Y),dropdownMatchSelectWidth:eL,transitionName:(0,s.getTransitionName)(eO,"slide-up",et),builtinPlacements:(0,w.default)(q,ey),listHeight:L,listItemHeight:ex,mode:eB,prefixCls:ej,placement:e4,direction:ek,prefix:eo,suffixIcon:eJ,menuItemSelectedIcon:eK,removeIcon:eX,allowClear:!0===Z?{clearIcon:eY}:Z,notFoundContent:I,className:e2,getPopupContainer:B||ef,dropdownClassName:eQ,disabled:null!=W?W:e1,dropdownStyle:Object.assign(Object.assign({},eH),{zIndex:e6}),maxCount:eA?en:void 0,tagRender:eA?er:void 0,dropdownRender:eD,onDropdownVisibleChange:es||el})))}),O=(0,c.default)(j,"dropdownAlign");j.SECRET_COMBOBOX_MODE_DO_NOT_USE=x,j.Option=a.Option,j.OptGroup=o.OptGroup,j._InternalPanelDoNotUseOrYouWillBeFired=O,e.s(["default",0,j],327494)},199133,e=>{"use strict";var t=e.i(327494);e.s(["Select",()=>t.default])},689074,21243,98801,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:"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 22ZM11 15V17H13V15H11ZM11 7V13H13V7H11Z"}))};e.s(["default",()=>n],689074);let o=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:"M1.18164 12C2.12215 6.87976 6.60812 3 12.0003 3C17.3924 3 21.8784 6.87976 22.8189 12C21.8784 17.1202 17.3924 21 12.0003 21C6.60812 21 2.12215 17.1202 1.18164 12ZM12.0003 17C14.7617 17 17.0003 14.7614 17.0003 12C17.0003 9.23858 14.7617 7 12.0003 7C9.23884 7 7.00026 9.23858 7.00026 12C7.00026 14.7614 9.23884 17 12.0003 17ZM12.0003 15C10.3434 15 9.00026 13.6569 9.00026 12C9.00026 10.3431 10.3434 9 12.0003 9C13.6571 9 15.0003 10.3431 15.0003 12C15.0003 13.6569 13.6571 15 12.0003 15Z"}))};e.s(["default",()=>o],21243);let a=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:"M4.52047 5.93457L1.39366 2.80777L2.80788 1.39355L22.6069 21.1925L21.1927 22.6068L17.8827 19.2968C16.1814 20.3755 14.1638 21.0002 12.0003 21.0002C6.60812 21.0002 2.12215 17.1204 1.18164 12.0002C1.61832 9.62282 2.81932 7.5129 4.52047 5.93457ZM14.7577 16.1718L13.2937 14.7078C12.902 14.8952 12.4634 15.0002 12.0003 15.0002C10.3434 15.0002 9.00026 13.657 9.00026 12.0002C9.00026 11.537 9.10522 11.0984 9.29263 10.7067L7.82866 9.24277C7.30514 10.0332 7.00026 10.9811 7.00026 12.0002C7.00026 14.7616 9.23884 17.0002 12.0003 17.0002C13.0193 17.0002 13.9672 16.6953 14.7577 16.1718ZM7.97446 3.76015C9.22127 3.26959 10.5793 3.00016 12.0003 3.00016C17.3924 3.00016 21.8784 6.87992 22.8189 12.0002C22.5067 13.6998 21.8038 15.2628 20.8068 16.5925L16.947 12.7327C16.9821 12.4936 17.0003 12.249 17.0003 12.0002C17.0003 9.23873 14.7617 7.00016 12.0003 7.00016C11.7514 7.00016 11.5068 7.01833 11.2677 7.05343L7.97446 3.76015Z"}))};e.s(["default",()=>a],98801)},103471,e=>{"use strict";var t=e.i(444755),r=e.i(271645);let n=e=>["string","number"].includes(typeof e)?e:e instanceof Array?e.map(n).join(""):"object"==typeof e&&e?n(e.props.children):void 0;function o(e){let t=new Map;return r.default.Children.map(e,e=>{var r;t.set(e.props.value,null!=(r=n(e))?r:e.props.value)}),t}function a(e,t){return r.default.Children.map(t,t=>{var r;if((null!=(r=n(t))?r:t.props.value).toLowerCase().includes(e.toLowerCase()))return t})}let i=(e,r,n=!1)=>(0,t.tremorTwMerge)(r?"bg-tremor-background-subtle dark:bg-dark-tremor-background-subtle":"bg-tremor-background dark:bg-dark-tremor-background",!r&&"hover:bg-tremor-background-muted dark:hover:bg-dark-tremor-background-muted",e?"text-tremor-content-emphasis dark:text-dark-tremor-content-emphasis":"text-tremor-content dark:text-dark-tremor-content",r&&"text-tremor-content-subtle dark:text-dark-tremor-content-subtle",n&&"text-red-500 placeholder:text-red-500 dark:text-red-500 dark:placeholder:text-red-500",n?"border-red-500 dark:border-red-500":"border-tremor-border dark:border-dark-tremor-border");function l(e){return null!=e&&""!==e}e.s(["constructValueToNameMapping",()=>o,"getFilteredOptions",()=>a,"getNodeText",()=>n,"getSelectButtonColors",()=>i,"hasValue",()=>l])},779241,677955,e=>{"use strict";var t=e.i(290571),r=e.i(271645),n=e.i(673706),o=e.i(689074),a=e.i(21243),i=e.i(98801),l=e.i(103471),s=e.i(444755);let c=r.default.forwardRef((e,c)=>{let{value:u,defaultValue:d,type:f,placeholder:p="Type...",icon:m,error:h=!1,errorMessage:g,disabled:v=!1,stepper:y,makeInputClassName:b,className:w,onChange:$,onValueChange:C,autoFocus:E,pattern:S}=e,x=(0,t.__rest)(e,["value","defaultValue","type","placeholder","icon","error","errorMessage","disabled","stepper","makeInputClassName","className","onChange","onValueChange","autoFocus","pattern"]),[j,O]=(0,r.useState)(E||!1),[k,T]=(0,r.useState)(!1),F=(0,r.useCallback)(()=>T(!k),[k,T]),_=(0,r.useRef)(null),I=(0,l.hasValue)(u||d);return r.default.useEffect(()=>{let e=()=>O(!0),t=()=>O(!1),r=_.current;return r&&(r.addEventListener("focus",e),r.addEventListener("blur",t),E&&r.focus()),()=>{r&&(r.removeEventListener("focus",e),r.removeEventListener("blur",t))}},[E]),r.default.createElement(r.default.Fragment,null,r.default.createElement("div",{className:(0,s.tremorTwMerge)(b("root"),"relative w-full flex items-center min-w-[10rem] outline-none rounded-tremor-default transition duration-100 border","shadow-tremor-input","dark:shadow-dark-tremor-input",(0,l.getSelectButtonColors)(I,v,h),j&&(0,s.tremorTwMerge)("ring-2","border-tremor-brand-subtle ring-tremor-brand-muted","dark:border-dark-tremor-brand-subtle dark:ring-dark-tremor-brand-muted"),w)},m?r.default.createElement(m,{className:(0,s.tremorTwMerge)(b("icon"),"shrink-0 h-5 w-5 mx-2.5 absolute left-0 flex items-center","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")}):null,r.default.createElement("input",Object.assign({ref:(0,n.mergeRefs)([_,c]),defaultValue:d,value:u,type:k?"text":f,className:(0,s.tremorTwMerge)(b("input"),"w-full bg-transparent focus:outline-none focus:ring-0 border-none text-tremor-default rounded-tremor-default transition duration-100 py-2","text-tremor-content-emphasis","dark:text-dark-tremor-content-emphasis","[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none","password"===f?h?"pr-16":"pr-12":h?"pr-8":"pr-3",m?"pl-10":"pl-3",v?"placeholder:text-tremor-content-subtle dark:placeholder:text-dark-tremor-content-subtle":"placeholder:text-tremor-content dark:placeholder:text-dark-tremor-content"),placeholder:p,disabled:v,"data-testid":"base-input",onChange:e=>{null==$||$(e),null==C||C(e.target.value)},pattern:S},x)),"password"!==f||v?null:r.default.createElement("button",{className:(0,s.tremorTwMerge)(b("toggleButton"),"absolute inset-y-0 right-0 flex items-center px-2.5 rounded-lg"),type:"button",onClick:()=>F(),"aria-label":k?"Hide password":"Show Password"},k?r.default.createElement(i.default,{className:(0,s.tremorTwMerge)("flex-none h-5 w-5 transition","text-tremor-content-subtle hover:text-tremor-content","dark:text-dark-tremor-content-subtle hover:dark:text-dark-tremor-content"),"aria-hidden":!0}):r.default.createElement(a.default,{className:(0,s.tremorTwMerge)("flex-none h-5 w-5 transition","text-tremor-content-subtle hover:text-tremor-content","dark:text-dark-tremor-content-subtle hover:dark:text-dark-tremor-content"),"aria-hidden":!0})),h?r.default.createElement(o.default,{className:(0,s.tremorTwMerge)(b("errorIcon"),"text-red-500 shrink-0 h-5 w-5 absolute right-0 flex items-center","password"===f?"mr-10":"number"===f?y?"mr-20":"mr-3":"mx-2.5")}):null,null!=y?y:null),h&&g?r.default.createElement("p",{className:(0,s.tremorTwMerge)(b("errorMessage"),"text-sm text-red-500 mt-1")},g):null)});c.displayName="BaseInput",e.s(["default",()=>c],677955);let u=(0,n.makeClassName)("TextInput"),d=r.default.forwardRef((e,n)=>{let{type:o="text"}=e,a=(0,t.__rest)(e,["type"]);return r.default.createElement(c,Object.assign({ref:n,type:o,makeInputClassName:u},a))});d.displayName="TextInput",e.s(["TextInput",()=>d],779241)},122550,e=>{"use strict";function t(e,t){return e.length>t?e.substring(0,t)+"...":e}e.s(["formItemValidateJSON",0,(e,t)=>{if(!t)return Promise.resolve();try{return JSON.parse(t),Promise.resolve()}catch(e){return Promise.reject("Please enter valid JSON")}},"formatLabel",0,e=>e?e.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase()):e,"truncateString",()=>t])},764205,82946,e=>{"use strict";e.s(["addAllowedIP",()=>eN,"adminGlobalActivity",()=>eJ,"adminGlobalActivityPerModel",()=>eX,"adminGlobalCacheActivity",()=>eK,"adminSpendLogsCall",()=>eW,"adminTopEndUsersCall",()=>eU,"adminTopKeysCall",()=>eG,"adminTopModelsCall",()=>eY,"adminspendByProvider",()=>eq,"agentDailyActivityCall",()=>e$,"agentHubPublicModelsCall",()=>eF,"alertingSettingsCall",()=>J,"allEndUsersCall",()=>eH,"allTagNamesCall",()=>eL,"applyGuardrail",()=>nn,"approveGuardrailSubmission",()=>tA,"approveMCPServer",()=>rx,"availableTeamListCall",()=>es,"budgetCreateCall",()=>G,"budgetDeleteCall",()=>W,"budgetUpdateCall",()=>U,"buildMcpOAuthAuthorizeUrl",()=>ng,"cacheTemporaryMcpServer",()=>nm,"cachingHealthCheckCall",()=>tT,"callMCPTool",()=>rN,"cancelModelCostMapReload",()=>z,"checkEuAiActCompliance",()=>nB,"checkGdprCompliance",()=>nA,"claimOnboardingToken",()=>eE,"convertPromptFileToJson",()=>rs,"createAgentCall",()=>rc,"createGuardrailCall",()=>ru,"createMCPServer",()=>rw,"createPassThroughEndpoint",()=>tE,"createPolicyAttachmentCall",()=>t7,"createPolicyCall",()=>tZ,"createPolicyVersion",()=>t1,"createPromptCall",()=>ra,"createSearchTool",()=>rk,"credentialCreateCall",()=>e7,"credentialDeleteCall",()=>e8,"credentialGetCall",()=>e9,"credentialListCall",()=>e5,"credentialUpdateCall",()=>te,"customerDailyActivityCall",()=>ew,"deleteAgentCall",()=>r0,"deleteAllowedIP",()=>eR,"deleteCallback",()=>nf,"deleteClaudeCodePlugin",()=>nM,"deleteConfigFieldSetting",()=>tx,"deleteGuardrailCall",()=>r4,"deleteMCPOAuthUserCredential",()=>nU,"deleteMCPServer",()=>rC,"deletePassThroughEndpointsCall",()=>tj,"deletePolicyAttachmentCall",()=>t5,"deletePolicyCall",()=>t4,"deletePromptCall",()=>rl,"deleteSearchTool",()=>rF,"deleteToolPolicyOverride",()=>nW,"deriveErrorMessage",()=>nj,"disableClaudeCodePlugin",()=>nR,"enableClaudeCodePlugin",()=>nN,"enrichPolicyTemplate",()=>tq,"enrichPolicyTemplateStream",()=>tX,"estimateAttachmentImpactCall",()=>rt,"exchangeMcpOAuthToken",()=>nv,"fetchAvailableSearchProviders",()=>r_,"fetchDiscoverableMCPServers",()=>rh,"fetchMCPAccessGroups",()=>ry,"fetchMCPClientIp",()=>rb,"fetchMCPServerHealth",()=>rv,"fetchMCPServers",()=>rg,"fetchMCPSubmissions",()=>rS,"fetchOpenAPIRegistry",()=>rm,"fetchSearchTools",()=>rO,"fetchToolDetail",()=>nD,"fetchToolPolicyOptions",()=>nz,"fetchToolsList",()=>nL,"formatDate",()=>v,"getAgentCreateMetadata",()=>k,"getAgentInfo",()=>r8,"getAgentsList",()=>r9,"getAllowedIPs",()=>eP,"getBudgetList",()=>tm,"getCacheSettingsCall",()=>ty,"getCallbackConfigsCall",()=>y,"getCallbacksCall",()=>th,"getCategoryYaml",()=>r7,"getClaudeCodeMarketplace",()=>nF,"getClaudeCodePluginDetails",()=>nI,"getClaudeCodePluginsList",()=>n_,"getConfigFieldSetting",()=>tC,"getDefaultTeamSettings",()=>rL,"getEmailEventSettings",()=>rY,"getGeneralSettingsCall",()=>tg,"getGlobalLitellmHeaderName",()=>_,"getGuardrailInfo",()=>ne,"getGuardrailProviderSpecificParams",()=>r3,"getGuardrailUISettings",()=>r6,"getGuardrailsList",()=>tM,"getGuardrailsUsageDetail",()=>tH,"getGuardrailsUsageLogs",()=>tD,"getGuardrailsUsageOverview",()=>tL,"getInProductNudgesCall",()=>b,"getInternalUserSettings",()=>rf,"getLicenseInfo",()=>nu,"getMCPOAuthUserCredentialStatus",()=>nq,"getMCPSemanticFilterSettings",()=>tP,"getMajorAirlines",()=>r5,"getModelCostMapReloadStatus",()=>H,"getModelCostMapSource",()=>L,"getOnboardingCredentials",()=>eC,"getOpenAPISchema",()=>R,"getPassThroughEndpointsCall",()=>t$,"getPoliciesList",()=>tV,"getPolicyAttachmentsList",()=>t3,"getPolicyInfo",()=>t6,"getPolicyInfoWithGuardrails",()=>tG,"getPolicyTemplates",()=>tU,"getPossibleUserRoles",()=>e6,"getPromptInfo",()=>rn,"getPromptVersions",()=>ro,"getPromptsList",()=>rr,"getProviderCreateMetadata",()=>O,"getProxyBaseUrl",()=>C,"getProxyUISettings",()=>t_,"getPublicModelHubInfo",()=>N,"getRemainingUsers",()=>nc,"getResolvedGuardrails",()=>t8,"getRouterSettingsCall",()=>tv,"getSSOSettings",()=>ni,"getTeamPermissionsCall",()=>rD,"getToolUsageLogs",()=>nH,"getUISettings",()=>tI,"getUiConfig",()=>P,"getUiSettings",()=>nk,"handleError",()=>j,"individualModelHealthCheckCall",()=>tk,"invitationCreateCall",()=>q,"keyAliasesCall",()=>e2,"keyCreateCall",()=>X,"keyCreateForAgentCall",()=>Y,"keyCreateServiceAccountCall",()=>K,"keyDeleteCall",()=>Q,"keyInfoCall",()=>eZ,"keyInfoV1Call",()=>e0,"keyListCall",()=>e1,"keyUpdateCall",()=>tt,"latestHealthChecksCall",()=>tF,"listGuardrailSubmissions",()=>tB,"listMCPTools",()=>rP,"listMCPUserCredentials",()=>nJ,"listPolicyVersions",()=>t0,"loginCall",()=>nO,"makeAgentsPublicCall",()=>r1,"makeMCPPublicCall",()=>r2,"makeModelGroupPublic",()=>I,"mcpHubPublicServersCall",()=>e_,"modelAvailableCall",()=>eB,"modelCostMap",()=>M,"modelCreateCall",()=>D,"modelDeleteCall",()=>V,"modelHubCall",()=>eI,"modelHubPublicModelsCall",()=>eT,"modelInfoCall",()=>eO,"modelInfoV1Call",()=>ek,"modelPatchUpdateCall",()=>tn,"organizationCreateCall",()=>ed,"organizationDailyActivityCall",()=>eb,"organizationDeleteCall",()=>ep,"organizationInfoCall",()=>eu,"organizationListCall",()=>ec,"organizationMemberAddCall",()=>ts,"organizationMemberDeleteCall",()=>tc,"organizationMemberUpdateCall",()=>tu,"organizationUpdateCall",()=>ef,"patchAgentCall",()=>nt,"perUserAnalyticsCall",()=>nx,"proxyBaseUrl",()=>$,"ragIngestCall",()=>rX,"regenerateKeyCall",()=>eS,"registerClaudeCodePlugin",()=>nP,"registerMCPServer",()=>rE,"registerMcpOAuthClient",()=>nh,"rejectGuardrailSubmission",()=>tz,"rejectMCPServer",()=>rj,"reloadModelCostMap",()=>B,"resetEmailEventSettings",()=>rQ,"resolvePoliciesCall",()=>re,"scheduleModelCostMapReload",()=>A,"searchToolQueryCall",()=>nb,"serverRootPath",()=>w,"serviceHealthCheck",()=>tp,"sessionSpendLogsCall",()=>rW,"setCallbacksCall",()=>tO,"setGlobalLitellmHeaderName",()=>F,"storeMCPOAuthUserCredential",()=>nG,"suggestPolicyTemplates",()=>tJ,"tagCreateCall",()=>rR,"tagDailyActivityCall",()=>ev,"tagDauCall",()=>nw,"tagDeleteCall",()=>rz,"tagDistinctCall",()=>nE,"tagInfoCall",()=>rB,"tagListCall",()=>rA,"tagMauCall",()=>nC,"tagUpdateCall",()=>rM,"tagWauCall",()=>n$,"tagsSpendLogsCall",()=>ez,"teamBulkMemberAddCall",()=>ta,"teamCreateCall",()=>e3,"teamDailyActivityCall",()=>ey,"teamDeleteCall",()=>et,"teamInfoCall",()=>ea,"teamListCall",()=>el,"teamMemberAddCall",()=>to,"teamMemberDeleteCall",()=>tl,"teamMemberUpdateCall",()=>ti,"teamPermissionsUpdateCall",()=>rV,"teamSpendLogsCall",()=>eA,"teamUpdateCall",()=>tr,"testCacheConnectionCall",()=>tb,"testConnectionRequest",()=>eQ,"testCustomCodeGuardrail",()=>no,"testMCPSemanticFilter",()=>tR,"testMCPToolsListRequest",()=>np,"testPipelineCall",()=>t9,"testPoliciesAndGuardrails",()=>tW,"testPolicyTemplate",()=>tK,"testSearchToolConnection",()=>rI,"transformRequestCall",()=>em,"uiAuditLogsCall",()=>ns,"uiSpendLogDetailsCall",()=>rd,"uiSpendLogsCall",()=>eV,"updateCacheSettingsCall",()=>tw,"updateConfigFieldSetting",()=>tS,"updateDefaultTeamSettings",()=>rH,"updateEmailEventSettings",()=>rZ,"updateGuardrailCall",()=>nr,"updateInternalUserSettings",()=>rp,"updateMCPSemanticFilterSettings",()=>tN,"updateMCPServer",()=>r$,"updatePassThroughEndpoint",()=>nd,"updatePolicyCall",()=>tQ,"updatePolicyVersionStatus",()=>t2,"updatePromptCall",()=>ri,"updateSSOSettings",()=>nl,"updateSearchTool",()=>rT,"updateToolPolicy",()=>nV,"updateUiSettings",()=>nT,"updateUsefulLinksCall",()=>eM,"usageAiChatStream",()=>tY,"userAgentSummaryCall",()=>nS,"userBulkUpdateUserCall",()=>tf,"userCreateCall",()=>Z,"userDailyActivityAggregatedCall",()=>e4,"userDailyActivityCall",()=>eg,"userDeleteCall",()=>ee,"userFilterUICall",()=>eD,"userGetInfoV2",()=>en,"userInfoCall",()=>eo,"userListCall",()=>er,"userUpdateUserCall",()=>td,"v2TeamListCall",()=>ei,"validateBlockedWordsFile",()=>na,"vectorStoreCreateCall",()=>rG,"vectorStoreDeleteCall",()=>rq,"vectorStoreInfoCall",()=>rJ,"vectorStoreListCall",()=>rU,"vectorStoreSearchCall",()=>ny,"vectorStoreUpdateCall",()=>rK],764205),e.i(247167);var t=e.i(998573),r=e.i(268004);e.s(["default",()=>h,"jsonFields",()=>p],82946);var n=e.i(843476),o=e.i(271645),a=e.i(808613),i=e.i(311451),l=e.i(28651),s=e.i(199133),c=e.i(779241),u=e.i(827252),d=e.i(592968),f=e.i(122550);let p=["metadata","config","enforced_params","aliases"],m=(e,t)=>p.includes(e)||"json"===t.format,h=({schemaComponent:e,excludedFields:t=[],form:r,overrideLabels:p={},overrideTooltips:h={},customValidation:g={},defaultValues:v={}})=>{let[y,b]=(0,o.useState)(null),[w,$]=(0,o.useState)(null);return((0,o.useEffect)(()=>{(async()=>{try{let n=(await R()).components.schemas[e];if(!n)throw Error(`Schema component "${e}" not found`);b(n);let o={};Object.keys(n.properties).filter(e=>!t.includes(e)&&void 0!==v[e]).forEach(e=>{o[e]=v[e]}),r.setFieldsValue(o)}catch(e){console.error("Schema fetch error:",e),$(e instanceof Error?e.message:"Failed to fetch schema")}})()},[e,r,t]),w)?(0,n.jsxs)("div",{className:"text-red-500",children:["Error: ",w]}):y?.properties?(0,n.jsx)("div",{children:Object.entries(y.properties).filter(([e])=>!t.includes(e)).map(([e,t])=>{let r,o,b,w,$,C,E,S;return o=(e=>{if(e.type)return e.type;if(e.anyOf){let t=e.anyOf.map(e=>e.type);if(t.includes("number")||t.includes("integer"))return"number";t.includes("string")}return"string"})(t),b=y?.required?.includes(e),w=p[e]||t.title||(0,f.formatLabel)(e),$=h[e]||t.description,C=[],b&&C.push({required:!0,message:`${w} is required`}),g[e]&&C.push({validator:g[e]}),m(e,t)&&C.push({validator:async(e,t)=>{if(t&&!(e=>{if(!e)return!0;try{return JSON.parse(e),!0}catch{return!1}})(t))throw Error("Please enter valid JSON")}}),E=$?(0,n.jsxs)("span",{children:[w," ",(0,n.jsx)(d.Tooltip,{title:$,children:(0,n.jsx)(u.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}):w,r=m(e,t)?(0,n.jsx)(i.Input.TextArea,{rows:4,placeholder:"Enter as JSON",className:"font-mono"}):t.enum?(0,n.jsx)(s.Select,{children:t.enum.map(e=>(0,n.jsx)(s.Select.Option,{value:e,children:e},e))}):"number"===o||"integer"===o?(0,n.jsx)(l.InputNumber,{style:{width:"100%"},precision:"integer"===o?0:void 0}):"duration"===e?(0,n.jsx)(c.TextInput,{placeholder:"eg: 30s, 30h, 30d"}):(0,n.jsx)(c.TextInput,{placeholder:$||""}),(0,n.jsx)(a.Form.Item,{label:E,name:e,className:"mt-8",rules:C,initialValue:v[e],help:(0,n.jsx)("div",{className:"text-xs text-gray-500",children:(S=({max_budget:"Enter maximum budget in USD (e.g., 100.50)",budget_duration:"Select a time period for budget reset",tpm_limit:"Enter maximum tokens per minute (whole number)",rpm_limit:"Enter maximum requests per minute (whole number)",duration:"Enter duration (e.g., 30s, 24h, 7d)",metadata:'Enter JSON object with key-value pairs\nExample: {"team": "research", "project": "nlp"}',config:'Enter configuration as JSON object\nExample: {"setting": "value"}',permissions:"Enter comma-separated permission strings",enforced_params:'Enter parameters as JSON object\nExample: {"param": "value"}',blocked:"Enter true/false or specific block conditions",aliases:'Enter aliases as JSON object\nExample: {"alias1": "value1", "alias2": "value2"}',models:"Select one or more model names",key_alias:"Enter a unique identifier for this key",tags:"Enter comma-separated tag strings"})[e]||({string:"Text input",number:"Numeric input",integer:"Whole number input",boolean:"True/False value"})[o]||"Text input",m(e,t)?`${S} Must be valid JSON format`:t.enum?`Select from available options -Allowed values: ${t.enum.join(", ")}`:S)}),children:r},e)})}):null};var g=e.i(727749);let v=e=>{let t=e.getFullYear(),r=String(e.getMonth()+1).padStart(2,"0"),n=String(e.getDate()).padStart(2,"0");return`${t}-${r}-${n}`},y=async e=>{try{let t=$?`${$}/callbacks/configs`:"/callbacks/configs",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nx(e);throw j(t),Error(t)}return await r.json()}catch(e){throw console.error("Failed to get callbacks:",e),e}},b=async e=>{try{let t=$?`${$}/in_product_nudges`:"/in_product_nudges",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nx(e);throw j(t),Error(t)}return await r.json()}catch(e){throw console.error("Failed to get in-product nudges:",e),e}},w="/",$=null;console.log=function(){};let C=()=>{if($)return $;let e=window.location;return e?.origin??""},E="POST",S="DELETE",x=0,j=async e=>{let t=Date.now();if(t-x>6e4){if(("string"==typeof e?e:JSON.stringify(e)).includes("Authentication Error - Expired Key")){g.default.info("UI Session Expired. Logging out."),x=t,(0,r.clearTokenCookies)();let e=window.location;e&&(window.location.href=e.pathname)}x=t}else console.log("Error suppressed to prevent spam:",e)},O=async()=>{let e=$?`${$}/public/providers/fields`:"/public/providers/fields",t=await fetch(e,{method:"GET"});if(!t.ok){let e=await t.text();throw console.error("Failed to fetch provider create metadata:",t.status,e),Error("Failed to load provider configuration")}return await t.json()},k=async()=>{let e=$?`${$}/public/agents/fields`:"/public/agents/fields",t=await fetch(e,{method:"GET"});if(!t.ok){let e=await t.text();throw console.error("Failed to fetch agent create metadata:",t.status,e),Error("Failed to load agent configuration")}return await t.json()},T="Authorization";function F(e="Authorization"){console.log(`setGlobalLitellmHeaderName: ${e}`),T=e}function _(){return T}let I=async(e,t)=>{let r=$?`${$}/model_group/make_public`:"/model_group/make_public";return(await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({model_groups:t})})).json()},P=async()=>{console.log("Getting UI config");let e=await fetch("/litellm/.well-known/litellm-ui-config"),t=await e.json();return console.log("jsonData in getUiConfig:",t),((e,t=null)=>{let r=window.location,n=r?.origin??null,o=t||n;if(console.log("proxyBaseUrl:",$),console.log("serverRootPath:",e),!o)return console.log("Updated proxyBaseUrl:",$=$??null);e.length>0&&!o.endsWith(e)&&"/"!=e&&(o+=e),console.log("Updated proxyBaseUrl:",$=o)})(t.server_root_path,t.proxy_base_url),t},N=async()=>{let e=$?`${$}/public/model_hub/info`:"/public/model_hub/info",t=await fetch(e);return await t.json()},R=async()=>{let e=$?`${$}/openapi.json`:"/openapi.json",t=await fetch(e);return await t.json()},M=async()=>{try{let e=$?`${$}/public/litellm_model_cost_map`:"/public/litellm_model_cost_map",t=await fetch(e,{method:"GET",headers:{"Content-Type":"application/json"}}),r=await t.json();return console.log(`received litellm model cost data: ${r}`),r}catch(e){throw console.error("Failed to get model cost map:",e),e}},B=async e=>{try{let t=$?`${$}/reload/model_cost_map`:"/reload/model_cost_map",r=await fetch(t,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}}),n=await r.json();return console.log(`Model cost map reload response: ${n}`),n}catch(e){throw console.error("Failed to reload model cost map:",e),e}},A=async(e,t)=>{try{let r=$?`${$}/schedule/model_cost_map_reload?hours=${t}`:`/schedule/model_cost_map_reload?hours=${t}`,n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}}),o=await n.json();return console.log(`Schedule model cost map reload response: ${o}`),o}catch(e){throw console.error("Failed to schedule model cost map reload:",e),e}},z=async e=>{try{let t=$?`${$}/schedule/model_cost_map_reload`:"/schedule/model_cost_map_reload",r=await fetch(t,{method:"DELETE",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}}),n=await r.json();return console.log(`Cancel model cost map reload response: ${n}`),n}catch(e){throw console.error("Failed to cancel model cost map reload:",e),e}},L=async e=>{try{let t=$?`${$}/model/cost_map/source`:"/model/cost_map/source",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.text();throw Error(`HTTP ${r.status}: ${e}`)}let n=await r.json();return console.log("Model cost map source info:",n),n}catch(e){throw console.error("Failed to get model cost map source info:",e),e}},H=async e=>{try{let t=$?`${$}/schedule/model_cost_map_reload/status`:"/schedule/model_cost_map_reload/status";console.log("Fetching status from URL:",t);let r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){console.error(`Status request failed with status: ${r.status}`);let e=await r.text();throw console.error("Error response:",e),Error(`HTTP ${r.status}: ${e}`)}let n=await r.json();return console.log("Model cost map reload status:",n),n}catch(e){throw console.error("Failed to get model cost map reload status:",e),e}},D=async(e,r)=>{try{let n=$?`${$}/model/new`:"/model/new",o=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({...r})});if(!o.ok){let e=await o.json(),t=nx(e);throw j(t),Error(t)}let a=await o.json();return console.log("API Response:",a),t.message.destroy(),g.default.success(`Model ${r.model_name} created successfully`),a}catch(e){throw console.error("Failed to create key:",e),e}},V=async(e,t)=>{console.log(`model_id in model delete call: ${t}`);try{let r=$?`${$}/model/delete`:"/model/delete",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({id:t})});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}let o=await n.json();return console.log("API Response:",o),o}catch(e){throw console.error("Failed to create key:",e),e}},W=async(e,t)=>{if(console.log(`budget_id in budget delete call: ${t}`),null!=e)try{let r=$?`${$}/budget/delete`:"/budget/delete",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({id:t})});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}let o=await n.json();return console.log("API Response:",o),o}catch(e){throw console.error("Failed to create key:",e),e}},G=async(e,t)=>{try{console.log("Form Values in budgetCreateCall:",t),console.log("Form Values after check:",t);let r=$?`${$}/budget/new`:"/budget/new",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({...t})});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}let o=await n.json();return console.log("API Response:",o),o}catch(e){throw console.error("Failed to create key:",e),e}},U=async(e,t)=>{try{console.log("Form Values in budgetUpdateCall:",t),console.log("Form Values after check:",t);let r=$?`${$}/budget/update`:"/budget/update",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({...t})});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}let o=await n.json();return console.log("API Response:",o),o}catch(e){throw console.error("Failed to create key:",e),e}},q=async(e,t)=>{try{let r=$?`${$}/invitation/new`:"/invitation/new",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({user_id:t})});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}let o=await n.json();return console.log("API Response:",o),o}catch(e){throw console.error("Failed to create key:",e),e}},J=async e=>{try{let t=$?`${$}/alerting/settings`:"/alerting/settings",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nx(e);throw j(t),Error(t)}return await r.json()}catch(e){throw console.error("Failed to get callbacks:",e),e}},K=async(e,t)=>{try{for(let e of(console.log("Form Values in keyCreateServiceAccountCall:",t),t.description&&(t.metadata||(t.metadata={}),t.metadata.description=t.description,delete t.description,t.metadata=JSON.stringify(t.metadata)),p))if(t[e]){console.log(`formValues.${e}:`,t[e]);try{t[e]=JSON.parse(t[e])}catch(t){throw Error(`Failed to parse ${e}: `+t)}}console.log("Form Values after check:",t);let r=$?`${$}/key/service-account/generate`:"/key/service-account/generate",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({...t})});if(!n.ok){let e=await n.text();throw j(e),console.error("Error response from the server:",e),Error(e)}let o=await n.json();return console.log("API Response:",o),o}catch(e){throw console.error("Failed to create key:",e),e}},X=async(e,t,r)=>{try{for(let e of(console.log("Form Values in keyCreateCall:",r),r.description&&(r.metadata||(r.metadata={}),r.metadata.description=r.description,delete r.description,r.metadata=JSON.stringify(r.metadata)),p))if(r[e]){console.log(`formValues.${e}:`,r[e]);try{r[e]=JSON.parse(r[e])}catch(t){throw Error(`Failed to parse ${e}: `+t)}}console.log("Form Values after check:",r);let n=$?`${$}/key/generate`:"/key/generate",o=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({user_id:t,...r})});if(!o.ok){let e=await o.text();throw j(e),console.error("Error response from the server:",e),Error(e)}let a=await o.json();return console.log("API Response:",a),a}catch(e){throw console.error("Failed to create key:",e),e}},Y=async(e,t,r,n,o,a)=>{let i=$?`${$}/key/generate`:"/key/generate",l={agent_id:t,key_alias:r,models:n.length>0?n:[]};a&&(l.team_id=a),o&&Object.keys(o).length>0&&(l.metadata=o);let s=await fetch(i,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(l)});if(!s.ok)throw j(await s.text()),Error("Failed to create key for agent");return s.json()},Z=async(e,t,r)=>{try{if(console.log("Form Values in keyCreateCall:",r),r.description&&(r.metadata||(r.metadata={}),r.metadata.description=r.description,delete r.description,r.metadata=JSON.stringify(r.metadata)),r.auto_create_key=!1,r.metadata){console.log("formValues.metadata:",r.metadata);try{r.metadata=JSON.parse(r.metadata)}catch(e){throw Error("Failed to parse metadata: "+e)}}console.log("Form Values after check:",r);let n=$?`${$}/user/new`:"/user/new",o=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({user_id:t,...r})});if(!o.ok){let e=await o.text();throw j(e),console.error("Error response from the server:",e),Error(e)}let a=await o.json();return console.log("API Response:",a),a}catch(e){throw console.error("Failed to create key:",e),e}},Q=async(e,t)=>{try{let r=$?`${$}/key/delete`:"/key/delete";console.log("in keyDeleteCall:",t);let n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({keys:[t]})});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}let o=await n.json();return console.log(o),o}catch(e){throw console.error("Failed to create key:",e),e}},ee=async(e,t)=>{try{let r=$?`${$}/user/delete`:"/user/delete";console.log("in userDeleteCall:",t);let n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({user_ids:t})});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}let o=await n.json();return console.log(o),o}catch(e){throw console.error("Failed to delete user(s):",e),e}},et=async(e,t)=>{try{let r=$?`${$}/team/delete`:"/team/delete";console.log("in teamDeleteCall:",t);let n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({team_ids:[t]})});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}let o=await n.json();return console.log(o),o}catch(e){throw console.error("Failed to delete key:",e),e}},er=async(e,t=null,r=null,n=null,o=null,a=null,i=null,l=null,s=null,c=null,u=null)=>{try{let d=$?`${$}/user/list`:"/user/list";console.log("in userListCall");let f=new URLSearchParams;if(t&&t.length>0){let e=t.join(",");f.append("user_ids",e)}r&&f.append("page",r.toString()),n&&f.append("page_size",n.toString()),o&&f.append("user_email",o),a&&f.append("role",a),i&&f.append("team",i),l&&f.append("sso_user_ids",l),s&&f.append("sort_by",s),c&&f.append("sort_order",c),u&&u.length>0&&f.append("organization_ids",u.join(","));let p=f.toString();p&&(d+=`?${p}`);let m=await fetch(d,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!m.ok){let e=await m.json(),t=nx(e);throw j(t),Error(t)}let h=await m.json();return console.log("/user/list API Response:",h),h}catch(e){throw console.error("Failed to create key:",e),e}},en=async(e,t,r,n=!1,o,a,i=!1)=>{console.log(`userInfoCall: ${t}, ${r}, ${n}, ${o}, ${a}, ${i}`);try{let l;if(n){l=$?`${$}/user/list`:"/user/list";let e=new URLSearchParams;null!=o&&e.append("page",o.toString()),null!=a&&e.append("page_size",a.toString()),l+=`?${e.toString()}`}else l=$?`${$}/user/info`:"/user/info",("Admin"!==r&&"Admin Viewer"!==r||i)&&t&&(l+=`?user_id=${t}`);console.log("Requesting user data from:",l);let s=await fetch(l,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!s.ok){let e=await s.json(),t=nx(e);throw j(t),Error(t)}let c=await s.json();return console.log("API Response:",c),c}catch(e){throw console.error("Failed to fetch user data:",e),e}},eo=async(e,t)=>{try{let r=$?`${$}/team/info`:"/team/info";t&&(r=`${r}?team_id=${t}`),console.log("in teamInfoCall");let n=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}let o=await n.json();return console.log("API Response:",o),o}catch(e){throw console.error("Failed to create key:",e),e}},ea=async(e,t,r=null,n=null,o=null,a=1,i=10,l=null,s=null)=>{try{let a=$?`${$}/v2/team/list`:"/v2/team/list";console.log("in teamInfoCall");let i=new URLSearchParams;r&&i.append("user_id",r.toString()),t&&i.append("organization_id",t.toString()),n&&i.append("team_id",n.toString()),o&&i.append("team_alias",o.toString());let l=i.toString();l&&(a+=`?${l}`);let s=await fetch(a,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!s.ok){let e=await s.json(),t=nx(e);throw j(t),Error(t)}let c=await s.json();return console.log("/v2/team/list API Response:",c),c}catch(e){throw console.error("Failed to create key:",e),e}},ei=async(e,t,r=null,n=null,o=null)=>{try{let a=$?`${$}/team/list`:"/team/list";console.log("in teamInfoCall");let i=new URLSearchParams;r&&i.append("user_id",r.toString()),t&&i.append("organization_id",t.toString()),n&&i.append("team_id",n.toString()),o&&i.append("team_alias",o.toString());let l=i.toString();l&&(a+=`?${l}`);let s=await fetch(a,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!s.ok){let e=await s.json(),t=nx(e);throw j(t),Error(t)}let c=await s.json();return console.log("/team/list API Response:",c),c}catch(e){throw console.error("Failed to create key:",e),e}},el=async e=>{try{let t=$?`${$}/team/available`:"/team/available";console.log("in availableTeamListCall");let r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nx(e);throw j(t),Error(t)}let n=await r.json();return console.log("/team/available_teams API Response:",n),n}catch(e){throw e}},es=async(e,t=null,r=null)=>{try{let n=$?`${$}/organization/list`:"/organization/list",o=new URLSearchParams;t&&o.append("org_id",t.toString()),r&&o.append("org_alias",r.toString());let a=o.toString();a&&(n+=`?${a}`);let i=await fetch(n,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!i.ok){let e=await i.json(),t=nx(e);throw j(t),Error(t)}return await i.json()}catch(e){throw console.error("Failed to create key:",e),e}},ec=async(e,t)=>{try{let r=$?`${$}/organization/info`:"/organization/info";t&&(r=`${r}?organization_id=${t}`),console.log("in teamInfoCall");let n=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}let o=await n.json();return console.log("API Response:",o),o}catch(e){throw console.error("Failed to create key:",e),e}},eu=async(e,t)=>{try{if(console.log("Form Values in organizationCreateCall:",t),t.metadata){console.log("formValues.metadata:",t.metadata);try{t.metadata=JSON.parse(t.metadata)}catch(e){throw console.error("Failed to parse metadata:",e),Error("Failed to parse metadata: "+e)}}let r=$?`${$}/organization/new`:"/organization/new",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({...t})});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}let o=await n.json();return console.log("API Response:",o),o}catch(e){throw console.error("Failed to create key:",e),e}},ed=async(e,t)=>{try{console.log("Form Values in organizationUpdateCall:",t);let r=$?`${$}/organization/update`:"/organization/update",n=await fetch(r,{method:"PATCH",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({...t})});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}let o=await n.json();return console.log("Update Team Response:",o),o}catch(e){throw console.error("Failed to create key:",e),e}},ef=async(e,t)=>{try{let r=$?`${$}/organization/delete`:"/organization/delete",n=await fetch(r,{method:"DELETE",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({organization_ids:[t]})});if(!n.ok){let e=await n.text();throw j(e),Error(`Error deleting organization: ${e}`)}return await n.json()}catch(e){throw console.error("Failed to delete organization:",e),e}},ep=async(e,t)=>{try{let r=$?`${$}/utils/transform_request`:"/utils/transform_request",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to create key:",e),e}},em=async({accessToken:e,endpoint:t,startTime:r,endTime:n,page:o=1,extraQueryParams:a})=>{try{let i,l,s,c,u=(i=t.startsWith("/")?t:`/${t}`,l=$?`${$}${i}`:i,(s=new URLSearchParams).append("start_date",v(r)),s.append("end_date",v(n)),s.append("page_size","1000"),s.append("page",o.toString()),s.append("timezone",new Date().getTimezoneOffset().toString()),a&&Object.entries(a).forEach(([e,t])=>{((e,t,r)=>{if(null!=r){if(Array.isArray(r)){r.length>0&&e.append(t,r.join(","));return}e.append(t,`${r}`)}})(s,e,t)}),(c=s.toString())?`${l}?${c}`:l),d=await fetch(u,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!d.ok){let e=await d.json(),t=nx(e);throw j(t),Error(t)}return await d.json()}catch(e){throw console.error(`Failed to fetch daily activity (${t}):`,e),e}},eh=async(e,t,r,n=1,o=null)=>em({accessToken:e,endpoint:"/user/daily/activity",startTime:t,endTime:r,page:n,extraQueryParams:{user_id:o}}),eg=async(e,t,r,n=1,o=null)=>em({accessToken:e,endpoint:"/tag/daily/activity",startTime:t,endTime:r,page:n,extraQueryParams:{tags:o}}),ev=async(e,t,r,n=1,o=null)=>em({accessToken:e,endpoint:"/team/daily/activity",startTime:t,endTime:r,page:n,extraQueryParams:{team_ids:o,exclude_team_ids:"litellm-dashboard"}}),ey=async(e,t,r,n=1,o=null)=>em({accessToken:e,endpoint:"/organization/daily/activity",startTime:t,endTime:r,page:n,extraQueryParams:{organization_ids:o}}),eb=async(e,t,r,n=1,o=null)=>em({accessToken:e,endpoint:"/customer/daily/activity",startTime:t,endTime:r,page:n,extraQueryParams:{end_user_ids:o}}),ew=async(e,t,r,n=1,o=null)=>em({accessToken:e,endpoint:"/agent/daily/activity",startTime:t,endTime:r,page:n,extraQueryParams:{agent_ids:o}}),e$=async e=>{try{let t=$?`${$}/onboarding/get_token`:"/onboarding/get_token";t+=`?invite_link=${e}`;let r=await fetch(t,{method:"GET",headers:{"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nx(e);throw j(t),Error(t)}return await r.json()}catch(e){throw console.error("Failed to create key:",e),e}},eC=async(e,t,r,n)=>{let o=$?`${$}/onboarding/claim_token`:"/onboarding/claim_token";try{let a=await fetch(o,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({invitation_link:t,user_id:r,password:n})});if(!a.ok){let e=await a.json(),t=nx(e);throw j(t),Error(t)}let i=await a.json();return console.log(i),i}catch(e){throw console.error("Failed to delete key:",e),e}},eE=async(e,t,r)=>{try{let n=$?`${$}/key/${t}/regenerate`:`/key/${t}/regenerate`,o=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(r)});if(!o.ok){let e=await o.json(),t=nx(e);throw j(t),Error(t)}let a=await o.json();return console.log("Regenerate key Response:",a),a}catch(e){throw console.error("Failed to regenerate key:",e),e}},eS=!1,ex=null,ej=async(e,t,r,n=1,o=50,a,i,l,s,c)=>{try{console.log("modelInfoCall:",e,t,r,n,o,a,i,l,s,c);let u=$?`${$}/v2/model/info`:"/v2/model/info",d=new URLSearchParams;d.append("include_team_models","true"),d.append("page",n.toString()),d.append("size",o.toString()),a&&a.trim()&&d.append("search",a.trim()),i&&i.trim()&&d.append("modelId",i.trim()),l&&l.trim()&&d.append("teamId",l.trim()),s&&s.trim()&&d.append("sortBy",s.trim()),c&&c.trim()&&d.append("sortOrder",c.trim()),d.toString()&&(u+=`?${d.toString()}`);let f=await fetch(u,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!f.ok){let e=await f.text();throw e+=`error shown=${eS}`,eS||(e.includes("No model list passed")&&(e="No Models Exist. Click Add Model to get started."),g.default.info(e),eS=!0,ex&&clearTimeout(ex),ex=setTimeout(()=>{eS=!1},1e4)),Error("Network response was not ok")}let p=await f.json();return console.log("modelInfoCall:",p),p}catch(e){throw console.error("Failed to create key:",e),e}},eO=async(e,t)=>{try{let r=$?`${$}/v1/model/info`:"/v1/model/info";r+=`?litellm_model_id=${t}`;let n=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}let o=await n.json();return console.log("modelInfoV1Call:",o),o}catch(e){throw console.error("Failed to create key:",e),e}},ek=async()=>{let e=$?`${$}/public/model_hub`:"/public/model_hub",t=await fetch(e,{method:"GET",headers:{"Content-Type":"application/json"}});return t.ok?t.json():(console.error(`modelHubPublicModelsCall failed with status ${t.status}`),[])},eT=async()=>{let e=$?`${$}/public/agent_hub`:"/public/agent_hub",t=await fetch(e,{method:"GET",headers:{"Content-Type":"application/json"}});return t.ok?t.json():(console.error(`agentHubPublicModelsCall failed with status ${t.status}`),[])},eF=async()=>{let e=$?`${$}/public/mcp_hub`:"/public/mcp_hub",t=await fetch(e,{method:"GET",headers:{"Content-Type":"application/json"}});return t.ok?t.json():(console.error(`mcpHubPublicServersCall failed with status ${t.status}`),[])},e_=async e=>{try{let t=$?`${$}/model_group/info`:"/model_group/info",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nx(e);throw j(t),Error(t)}let n=await r.json();return console.log("modelHubCall:",n),n}catch(e){throw console.error("Failed to create key:",e),e}},eI=async e=>{try{let t=$?`${$}/get/allowed_ips`:"/get/allowed_ips",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nx(e);throw j(t),Error(t)}let n=await r.json();return console.log("getAllowedIPs:",n),n.data}catch(e){throw console.error("Failed to get allowed IPs:",e),e}},eP=async(e,t)=>{try{let r=$?`${$}/add/allowed_ip`:"/add/allowed_ip",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({ip:t})});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}let o=await n.json();return console.log("addAllowedIP:",o),o}catch(e){throw console.error("Failed to add allowed IP:",e),e}},eN=async(e,t)=>{try{let r=$?`${$}/delete/allowed_ip`:"/delete/allowed_ip",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({ip:t})});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}let o=await n.json();return console.log("deleteAllowedIP:",o),o}catch(e){throw console.error("Failed to delete allowed IP:",e),e}},eR=async(e,t)=>{try{let r=$?`${$}/model_hub/update_useful_links`:"/model_hub/update_useful_links",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({useful_links:t})});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to create key:",e),e}},eM=async(e,t,r,n=!1,o=null,a=!1,i=!1,l)=>{console.log("in /models calls, globalLitellmHeaderName",T);try{let t=$?`${$}/models`:"/models",r=new URLSearchParams;r.append("include_model_access_groups","True"),!0===n&&r.append("return_wildcard_routes","True"),!0===i&&r.append("only_model_access_groups","True"),o&&r.append("team_id",o.toString()),l&&r.append("scope",l),r.toString()&&(t+=`?${r.toString()}`);let a=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!a.ok){let e=await a.json(),t=nx(e);throw j(t),Error(t)}return await a.json()}catch(e){throw console.error("Failed to create key:",e),e}},eB=async e=>{try{let t=$?`${$}/global/spend/teams`:"/global/spend/teams";console.log("in teamSpendLogsCall:",t);let r=await fetch(`${t}`,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nx(e);throw j(t),Error(t)}let n=await r.json();return console.log(n),n}catch(e){throw console.error("Failed to create key:",e),e}},eA=async(e,t,r,n)=>{try{let o=$?`${$}/global/spend/tags`:"/global/spend/tags";t&&r&&(o=`${o}?start_date=${t}&end_date=${r}`),n&&(o+=`&tags=${n.join(",")}`),console.log("in tagsSpendLogsCall:",o);let a=await fetch(`${o}`,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!a.ok){let e=await a.json(),t=nx(e);throw j(t),Error(t)}let i=await a.json();return console.log(i),i}catch(e){throw console.error("Failed to create key:",e),e}},ez=async e=>{try{let t=$?`${$}/global/spend/all_tag_names`:"/global/spend/all_tag_names";console.log("in global/spend/all_tag_names call",t);let r=await fetch(`${t}`,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nx(e);throw j(t),Error(t)}let n=await r.json();return console.log(n),n}catch(e){throw console.error("Failed to create key:",e),e}},eL=async e=>{try{let t=$?`${$}/customer/list`:"/customer/list";console.log("in customer/list",t);let r=await fetch(`${t}`,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nx(e);throw j(t),Error(t)}let n=await r.json();return console.log(n),n}catch(e){throw console.error("Failed to fetch end users:",e),e}},eH=async(e,t)=>{try{let r=$?`${$}/user/filter/ui`:"/user/filter/ui",n=new URLSearchParams;t.get("user_email")&&n.append("user_email",t.get("user_email")),t.get("user_id")&&n.append("user_id",t.get("user_id")),t.get("team_id")&&n.append("team_id",t.get("team_id"));let o=n.toString(),a=o?`${r}?${o}`:r,i=await fetch(a,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!i.ok){let e=await i.json(),t=nx(e);throw j(t),Error(t)}return await i.json()}catch(e){throw console.error("Failed to create key:",e),e}},eD=async({accessToken:e,start_date:t,end_date:r,page:n=1,page_size:o=50,params:a={}})=>{try{let i=$?`${$}/spend/logs/ui`:"/spend/logs/ui",l=new URLSearchParams;for(let[e,i]of(l.append("start_date",t),l.append("end_date",r),l.append("page",n.toString()),l.append("page_size",o.toString()),Object.entries(a)))null!=i&&("min_spend"===e||"max_spend"===e?l.append(e,i.toString()):"string"==typeof i&&""!==i&&l.append(e,String(i)));let s=l.toString();s&&(i+=`?${s}`);let c=await fetch(i,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!c.ok){let e=await c.json(),t=nx(e);throw j(t),Error(t)}let u=await c.json();return console.log("Spend Logs Response:",u),u}catch(e){throw console.error("Failed to fetch spend logs:",e),e}},eV=async e=>{try{let t=$?`${$}/global/spend/logs`:"/global/spend/logs",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nx(e);throw j(t),Error(t)}let n=await r.json();return console.log(n),n}catch(e){throw console.error("Failed to create key:",e),e}},eW=async e=>{try{let t=$?`${$}/global/spend/keys?limit=5`:"/global/spend/keys?limit=5",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nx(e);throw j(t),Error(t)}let n=await r.json();return console.log(n),n}catch(e){throw console.error("Failed to create key:",e),e}},eG=async(e,t,r,n)=>{try{let o=$?`${$}/global/spend/end_users`:"/global/spend/end_users",a="";a=t?JSON.stringify({api_key:t,startTime:r,endTime:n}):JSON.stringify({startTime:r,endTime:n});let i={method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:a},l=await fetch(o,i);if(!l.ok){let e=await l.json(),t=nx(e);throw j(t),Error(t)}let s=await l.json();return console.log(s),s}catch(e){throw console.error("Failed to create key:",e),e}},eU=async(e,t,r,n)=>{try{let o=$?`${$}/global/spend/provider`:"/global/spend/provider";r&&n&&(o+=`?start_date=${r}&end_date=${n}`),t&&(o+=`&api_key=${t}`);let a={method:"GET",headers:{[T]:`Bearer ${e}`}},i=await fetch(o,a);if(!i.ok){let e=await i.json(),t=nx(e);throw j(t),Error(t)}let l=await i.json();return console.log(l),l}catch(e){throw console.error("Failed to fetch spend data:",e),e}},eq=async(e,t,r)=>{try{let n=$?`${$}/global/activity`:"/global/activity";t&&r&&(n+=`?start_date=${t}&end_date=${r}`);let o={method:"GET",headers:{[T]:`Bearer ${e}`}},a=await fetch(n,o);if(!a.ok){let e=await a.json(),t=nx(e);throw j(t),Error(t)}let i=await a.json();return console.log(i),i}catch(e){throw console.error("Failed to fetch spend data:",e),e}},eJ=async(e,t,r)=>{try{let n=$?`${$}/global/activity/cache_hits`:"/global/activity/cache_hits";t&&r&&(n+=`?start_date=${t}&end_date=${r}`);let o={method:"GET",headers:{[T]:`Bearer ${e}`}},a=await fetch(n,o);if(!a.ok){let e=await a.json(),t=nx(e);throw j(t),Error(t)}let i=await a.json();return console.log(i),i}catch(e){throw console.error("Failed to fetch spend data:",e),e}},eK=async(e,t,r)=>{try{let n=$?`${$}/global/activity/model`:"/global/activity/model";t&&r&&(n+=`?start_date=${t}&end_date=${r}`);let o={method:"GET",headers:{[T]:`Bearer ${e}`}},a=await fetch(n,o);if(!a.ok){let e=await a.json(),t=nx(e);throw j(t),Error(t)}let i=await a.json();return console.log(i),i}catch(e){throw console.error("Failed to fetch spend data:",e),e}},eX=async e=>{try{let t=$?`${$}/global/spend/models?limit=5`:"/global/spend/models?limit=5",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nx(e);throw j(t),Error(t)}let n=await r.json();return console.log(n),n}catch(e){throw console.error("Failed to create key:",e),e}},eY=async(e,t)=>{try{let r=$?`${$}/v2/key/info`:"/v2/key/info",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({keys:t})});if(!n.ok){let e=await n.text();if(e.includes("Invalid proxy server token passed"))throw Error("Invalid proxy server token passed");throw j(e),Error("Network response was not ok")}let o=await n.json();return console.log(o),o}catch(e){throw console.error("Failed to create key:",e),e}},eZ=async(e,t,r,n)=>{try{console.log("Sending model connection test request:",JSON.stringify(t));let o=$?`${$}/health/test_connection`:"/health/test_connection",a=await fetch(o,{method:"POST",headers:{"Content-Type":"application/json",[T]:`Bearer ${e}`},body:JSON.stringify({litellm_params:t,model_info:r,mode:n})}),i=a.headers.get("content-type");if(!i||!i.includes("application/json")){let e=await a.text();throw console.error("Received non-JSON response:",e),Error(`Received non-JSON response (${a.status}: ${a.statusText}). Check network tab for details.`)}let l=await a.json();if((!a.ok||"error"===l.status)&&"error"!==l.status)return{status:"error",message:l.error?.message||`Connection test failed: ${a.status} ${a.statusText}`};return l}catch(e){throw console.error("Model connection test error:",e),e}},eQ=async(e,t)=>{try{console.log("entering keyInfoV1Call");let r=$?`${$}/key/info`:"/key/info";r=`${r}?key=${t}`;let n=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(console.log("response",n),!n.ok){let e=await n.text();j(e),g.default.fromBackend("Failed to fetch key info - "+e)}let o=await n.json();return console.log("data",o),o}catch(e){throw console.error("Failed to fetch key info:",e),e}},e0=async(e,t,r,n,o,a,i,l,s=null,c=null,u=null,d=null)=>{try{let f=$?`${$}/key/list`:"/key/list";console.log("in keyListCall");let p=new URLSearchParams;r&&p.append("team_id",r.toString()),t&&p.append("organization_id",t.toString()),n&&p.append("key_alias",n),a&&p.append("key_hash",a),o&&p.append("user_id",o.toString()),i&&p.append("page",i.toString()),l&&p.append("size",l.toString()),s&&p.append("sort_by",s),c&&p.append("sort_order",c),u&&p.append("expand",u),d&&p.append("status",d),p.append("return_full_object","true"),p.append("include_team_keys","true"),p.append("include_created_by_keys","true");let m=p.toString();m&&(f+=`?${m}`);let h=await fetch(f,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!h.ok){let e=await h.json(),t=nx(e);throw j(t),Error(t)}let g=await h.json();return console.log("/team/list API Response:",g),g}catch(e){throw console.error("Failed to create key:",e),e}},e1=async(e,t=1,r=50,n)=>{try{let o=new URLSearchParams(Object.entries({page:String(t),size:String(r),...n?{search:n}:{}})),a=$?`${$}/key/aliases`:"/key/aliases";a=`${a}?${o}`;let i=await fetch(a,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!i.ok){let e=await i.json(),t=nx(e);throw j(t),Error(t)}let l=await i.json();return console.log("/key/aliases API Response:",l),l}catch(e){throw console.error("Failed to fetch key aliases:",e),e}},e2=async(e,t,r,n=null)=>{try{let o=$?`${$}/user/daily/activity/aggregated`:"/user/daily/activity/aggregated",a=new URLSearchParams,i=e=>{let t=e.getFullYear(),r=String(e.getMonth()+1).padStart(2,"0"),n=String(e.getDate()).padStart(2,"0");return`${t}-${r}-${n}`};a.append("start_date",i(t)),a.append("end_date",i(r)),a.append("timezone",new Date().getTimezoneOffset().toString()),n&&a.append("user_id",n);let l=a.toString();l&&(o+=`?${l}`);let s=await fetch(o,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!s.ok){let e=await s.json(),t=nx(e);throw j(t),Error(t)}return await s.json()}catch(e){throw console.error("Failed to fetch aggregated user daily activity:",e),e}},e4=async e=>{try{let t=$?`${$}/user/available_roles`:"/user/available_roles",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nx(e);throw j(t),Error(t)}let n=await r.json();return console.log("response from user/available_role",n),n}catch(e){throw e}},e6=async(e,t)=>{try{if(console.log("Form Values in teamCreateCall:",t),t.metadata){console.log("formValues.metadata:",t.metadata);try{t.metadata=JSON.parse(t.metadata)}catch(e){throw Error("Failed to parse metadata: "+e)}}let r=$?`${$}/team/new`:"/team/new",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({...t})});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}let o=await n.json();return console.log("API Response:",o),o}catch(e){throw console.error("Failed to create key:",e),e}},e3=async(e,t)=>{try{if(console.log("Form Values in credentialCreateCall:",t),t.metadata){console.log("formValues.metadata:",t.metadata);try{t.metadata=JSON.parse(t.metadata)}catch(e){throw Error("Failed to parse metadata: "+e)}}let r=$?`${$}/credentials`:"/credentials",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({...t})});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}let o=await n.json();return console.log("API Response:",o),o}catch(e){throw console.error("Failed to create key:",e),e}},e7=async e=>{try{let t=$?`${$}/credentials`:"/credentials";console.log("in credentialListCall");let r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nx(e);throw j(t),Error(t)}let n=await r.json();return console.log("/credentials API Response:",n),n}catch(e){throw console.error("Failed to create key:",e),e}},e5=async(e,t,r)=>{try{let n=$?`${$}/credentials`:"/credentials";t?n+=`/by_name/${t}`:r&&(n+=`/by_model/${r}`),console.log("in credentialListCall");let o=await fetch(n,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!o.ok){let e=await o.json(),t=nx(e);throw j(t),Error(t)}let a=await o.json();return console.log("/credentials API Response:",a),a}catch(e){throw console.error("Failed to create key:",e),e}},e9=async(e,t)=>{try{let r=$?`${$}/credentials/${t}`:`/credentials/${t}`;console.log("in credentialDeleteCall:",t);let n=await fetch(r,{method:"DELETE",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}let o=await n.json();return console.log(o),o}catch(e){throw console.error("Failed to delete key:",e),e}},e8=async(e,t,r)=>{try{if(console.log("Form Values in credentialUpdateCall:",r),r.metadata){console.log("formValues.metadata:",r.metadata);try{r.metadata=JSON.parse(r.metadata)}catch(e){throw Error("Failed to parse metadata: "+e)}}let n=$?`${$}/credentials/${t}`:`/credentials/${t}`,o=await fetch(n,{method:"PATCH",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({...r})});if(!o.ok){let e=await o.json(),t=nx(e);throw j(t),Error(t)}let a=await o.json();return console.log("API Response:",a),a}catch(e){throw console.error("Failed to create key:",e),e}},te=async(e,t)=>{try{if(console.log("Form Values in keyUpdateCall:",t),t.model_tpm_limit){console.log("formValues.model_tpm_limit:",t.model_tpm_limit);try{t.model_tpm_limit=JSON.parse(t.model_tpm_limit)}catch(e){throw Error("Failed to parse model_tpm_limit: "+e)}}if(t.model_rpm_limit){console.log("formValues.model_rpm_limit:",t.model_rpm_limit);try{t.model_rpm_limit=JSON.parse(t.model_rpm_limit)}catch(e){throw Error("Failed to parse model_rpm_limit: "+e)}}let r=$?`${$}/key/update`:"/key/update",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({...t})});if(!n.ok){let e=await n.text();throw j(e),console.error("Error response from the server:",e),Error(e)}let o=await n.json();return console.log("Update key Response:",o),o}catch(e){throw console.error("Failed to create key:",e),e}},tt=async(e,t)=>{try{console.log("Form Values in teamUpateCall:",t);let r=$?`${$}/team/update`:"/team/update",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({...t})});if(!n.ok){let e=await n.text();throw j(e),console.error("Error response from the server:",e),g.default.fromBackend("Failed to update team settings: "+e),Error(e)}let o=await n.json();return console.log("Update Team Response:",o),o}catch(e){throw console.error("Failed to update team:",e),e}},tr=async(e,t,r)=>{try{console.log("Form Values in modelUpateCall:",t);let n=$?`${$}/model/${r}/update`:`/model/${r}/update`,o=await fetch(n,{method:"PATCH",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({...t})});if(!o.ok){let e=await o.text();throw j(e),console.error("Error update from the server:",e),Error("Network response was not ok")}let a=await o.json();return console.log("Update model Response:",a),a}catch(e){throw console.error("Failed to update model:",e),e}},tn=async(e,t,r)=>{try{console.log("Form Values in teamMemberAddCall:",r);let n=$?`${$}/team/member_add`:"/team/member_add",o=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({team_id:t,member:r})});if(!o.ok){let e=await o.text(),t={};try{t=JSON.parse(e)}catch(t){console.warn("Failed to parse error body as JSON:",e)}let r=t?.detail?.error||"Failed to add team member",n=Error(r);throw n.raw=t,n}let a=await o.json();return console.log("API Response:",a),a}catch(e){throw console.error("Failed to create key:",e),e}},to=async(e,t,r,n,o)=>{try{console.log("Bulk add team members:",{teamId:t,members:r,maxBudgetInTeam:n});let a=$?`${$}/team/bulk_member_add`:"/team/bulk_member_add",i={team_id:t};o?i.all_users=!0:i.members=r,null!=n&&(i.max_budget_in_team=n);let l=await fetch(a,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(i)});if(!l.ok){let e=await l.text(),t={};try{t=JSON.parse(e)}catch(t){console.warn("Failed to parse error body as JSON:",e)}let r=t?.detail?.error||"Failed to bulk add team members",n=Error(r);throw n.raw=t,n}let s=await l.json();return console.log("Bulk team member add API Response:",s),s}catch(e){throw console.error("Failed to bulk add team members:",e),e}},ta=async(e,t,r)=>{try{console.log("Form Values in teamMemberUpdateCall:",r),console.log("Budget value:",r.max_budget_in_team),console.log("TPM limit:",r.tpm_limit),console.log("RPM limit:",r.rpm_limit);let n=$?`${$}/team/member_update`:"/team/member_update",o={team_id:t,role:r.role,user_id:r.user_id};void 0!==r.user_email&&(o.user_email=r.user_email),void 0!==r.max_budget_in_team&&null!==r.max_budget_in_team&&(o.max_budget_in_team=r.max_budget_in_team),void 0!==r.tpm_limit&&null!==r.tpm_limit&&(o.tpm_limit=r.tpm_limit),void 0!==r.rpm_limit&&null!==r.rpm_limit&&(o.rpm_limit=r.rpm_limit),console.log("Final request body:",o);let a=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(o)});if(!a.ok){let e=await a.text(),t={};try{t=JSON.parse(e)}catch(t){console.warn("Failed to parse error body as JSON:",e)}let r=t?.detail?.error||"Failed to add team member",n=Error(r);throw n.raw=t,n}let i=await a.json();return console.log("API Response:",i),i}catch(e){throw console.error("Failed to update team member:",e),e}},ti=async(e,t,r)=>{try{console.log("Form Values in teamMemberAddCall:",r);let n=$?`${$}/team/member_delete`:"/team/member_delete",o=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({team_id:t,...void 0!==r.user_email&&{user_email:r.user_email},...void 0!==r.user_id&&{user_id:r.user_id}})});if(!o.ok){let e=await o.json(),t=nx(e);throw j(t),Error(t)}let a=await o.json();return console.log("API Response:",a),a}catch(e){throw console.error("Failed to create key:",e),e}},tl=async(e,t,r)=>{try{console.log("Form Values in teamMemberAddCall:",r);let n=$?`${$}/organization/member_add`:"/organization/member_add",o=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({organization_id:t,member:r})});if(!o.ok){let e=await o.text();throw j(e),console.error("Error response from the server:",e),Error(e)}let a=await o.json();return console.log("API Response:",a),a}catch(e){throw console.error("Failed to create organization member:",e),e}},ts=async(e,t,r)=>{try{console.log("Form Values in organizationMemberDeleteCall:",r);let n=$?`${$}/organization/member_delete`:"/organization/member_delete",o=await fetch(n,{method:"DELETE",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({organization_id:t,user_id:r})});if(!o.ok){let e=await o.json(),t=nx(e);throw j(t),Error(t)}let a=await o.json();return console.log("API Response:",a),a}catch(e){throw console.error("Failed to delete organization member:",e),e}},tc=async(e,t,r)=>{try{console.log("Form Values in organizationMemberUpdateCall:",r);let n=$?`${$}/organization/member_update`:"/organization/member_update",o=await fetch(n,{method:"PATCH",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({organization_id:t,...r})});if(!o.ok){let e=await o.json(),t=nx(e);throw j(t),Error(t)}let a=await o.json();return console.log("API Response:",a),a}catch(e){throw console.error("Failed to update organization member:",e),e}},tu=async(e,t,r)=>{try{console.log("Form Values in userUpdateUserCall:",t);let n=$?`${$}/user/update`:"/user/update",o={...t};null!==r&&(o.user_role=r),o=JSON.stringify(o);let a=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:o});if(!a.ok){let e=await a.json(),t=nx(e);throw j(t),Error(t)}let i=await a.json();return console.log("API Response:",i),i}catch(e){throw console.error("Failed to create key:",e),e}},td=async(e,t,r,n=!1)=>{try{let o;console.log("Form Values in userUpdateUserCall:",t);let a=$?`${$}/user/bulk_update`:"/user/bulk_update";if(n)o=JSON.stringify({all_users:!0,user_updates:t});else if(r&&r.length>0){let e=[];for(let n of r)e.push({user_id:n,...t});o=JSON.stringify({users:e})}else throw Error("Must provide either userIds or set allUsers=true");let i=await fetch(a,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:o});if(!i.ok){let e=await i.json(),t=nx(e);throw j(t),Error(t)}let l=await i.json();return console.log("API Response:",l),l}catch(e){throw console.error("Failed to create key:",e),e}},tf=async(e,t)=>{try{let r=$?`${$}/health/services?service=${t}`:`/health/services?service=${t}`;console.log("Checking Slack Budget Alerts service health");let n=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.text();throw j(e),Error(e)}return await n.json()}catch(e){throw console.error("Failed to perform health check:",e),e}},tp=async e=>{try{let t=$?`${$}/budget/list`:"/budget/list",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nx(e);throw j(t),Error(t)}return await r.json()}catch(e){throw console.error("Failed to get callbacks:",e),e}},tm=async(e,t,r)=>{try{let t=$?`${$}/get/config/callbacks`:"/get/config/callbacks",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nx(e);throw j(t),Error(t)}return await r.json()}catch(e){throw console.error("Failed to get callbacks:",e),e}},th=async e=>{try{let t=$?`${$}/config/list?config_type=general_settings`:"/config/list?config_type=general_settings",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nx(e);throw j(t),Error(t)}return await r.json()}catch(e){throw console.error("Failed to get callbacks:",e),e}},tg=async e=>{try{let t=$?`${$}/router/settings`:"/router/settings",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nx(e);throw j(t),Error(t)}return await r.json()}catch(e){throw console.error("Failed to get router settings:",e),e}},tv=async e=>{try{let t=$?`${$}/cache/settings`:"/cache/settings",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nx(e);throw j(t),Error(t)}return await r.json()}catch(e){throw console.error("Failed to get cache settings:",e),e}},ty=async(e,t)=>{try{let r=$?`${$}/cache/settings/test`:"/cache/settings/test",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({cache_settings:t})});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to test cache connection:",e),e}},tb=async(e,t)=>{try{let r=$?`${$}/cache/settings`:"/cache/settings",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({cache_settings:t})});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to update cache settings:",e),e}},tw=async(e,t)=>{try{let r=$?`${$}/config/pass_through_endpoint`:"/config/pass_through_endpoint";t&&(r+=`/team/${t}`);let n=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to get callbacks:",e),e}},t$=async(e,t)=>{try{let r=$?`${$}/config/field/info?field_name=${t}`:`/config/field/info?field_name=${t}`,n=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to set callbacks:",e),e}},tC=async(e,t)=>{try{let r=$?`${$}/config/pass_through_endpoint`:"/config/pass_through_endpoint",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({...t})});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to set callbacks:",e),e}},tE=async(e,t,r)=>{try{let n=$?`${$}/config/field/update`:"/config/field/update",o=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({field_name:t,field_value:r,config_type:"general_settings"})});if(!o.ok){let e=await o.json(),t=nx(e);throw j(t),Error(t)}let a=await o.json();return g.default.success("Successfully updated value!"),a}catch(e){throw console.error("Failed to set callbacks:",e),e}},tS=async(e,t)=>{try{let r=$?`${$}/config/field/delete`:"/config/field/delete",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({field_name:t,config_type:"general_settings"})});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}let o=await n.json();return g.default.success("Field reset on proxy"),o}catch(e){throw console.error("Failed to get callbacks:",e),e}},tx=async(e,t)=>{try{let r=$?`${$}/config/pass_through_endpoint?endpoint_id=${t}`:`/config/pass_through_endpoint?endpoint_id=${t}`,n=await fetch(r,{method:"DELETE",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to get callbacks:",e),e}},tj=async(e,t)=>{try{let r=$?`${$}/config/update`:"/config/update",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({...t})});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to set callbacks:",e),e}},tO=async(e,t)=>{try{let r=$?`${$}/health?model_id=${encodeURIComponent(t)}`:`/health?model_id=${encodeURIComponent(t)}`,n=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error(`Failed to call /health for model id ${t}:`,e),e}},tk=async e=>{try{let t=$?`${$}/cache/ping`:"/cache/ping",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.text();throw j(e),Error(e)}return await r.json()}catch(e){throw console.error("Failed to call /cache/ping:",e),e}},tT=async e=>{try{let t=$?`${$}/health/latest`:"/health/latest",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.text();throw j(e),Error(e)}return await r.json()}catch(e){throw console.error("Failed to call /health/latest:",e),e}},tF=async e=>{try{console.log("Getting proxy UI settings"),console.log("proxyBaseUrl in getProxyUISettings:",$);let t=$?`${$}/sso/get/ui_settings`:"/sso/get/ui_settings",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nx(e);throw j(t),Error(t)}return await r.json()}catch(e){throw console.error("Failed to get callbacks:",e),e}},t_=async e=>{try{let t=$?`${$}/get/ui_settings`:"/get/ui_settings",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nx(e);return console.error("Failed to get UI settings:",t),null}return await r.json()}catch(e){return console.error("Failed to get UI settings:",e),null}},tI=async e=>{try{let t=$?`${$}/get/mcp_semantic_filter_settings`:"/get/mcp_semantic_filter_settings",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nx(e);throw j(t),Error(t)}return await r.json()}catch(e){throw console.error("Failed to get MCP semantic filter settings:",e),e}},tP=async(e,t)=>{try{let r=$?`${$}/update/mcp_semantic_filter_settings`:"/update/mcp_semantic_filter_settings",n=await fetch(r,{method:"PATCH",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to update MCP semantic filter settings:",e),e}},tN=async(e,t,r)=>{try{let n=$?`${$}/v1/responses`:"/v1/responses",o=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({model:t,input:[{role:"user",content:r,type:"message"}],tools:[{type:"mcp",server_url:"litellm_proxy",require_approval:"never"}],tool_choice:"required"})}),a=o.headers.get("x-litellm-semantic-filter"),i=o.headers.get("x-litellm-semantic-filter-tools");if(!o.ok){let e=await o.json(),t=nx(e);throw j(t),Error(t)}return{data:await o.json(),headers:{filter:a,tools:i}}}catch(e){throw console.error("Failed to test MCP semantic filter:",e),e}},tR=async e=>{try{let t=$?`${$}/v2/guardrails/list`:"/v2/guardrails/list",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok)throw Error(`v2 guardrails/list returned ${r.status}`);return await r.json()}catch(t){console.log("v2/guardrails/list failed, falling back to v1:",t);try{let t=$?`${$}/guardrails/list`:"/guardrails/list",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nx(e);throw j(t),Error(t)}return await r.json()}catch(e){throw console.error("Failed to get guardrails list:",e),e}}},tM=async(e,t)=>{let r=$?`${$}/guardrails/submissions`:"/guardrails/submissions",n=new URLSearchParams;t?.status&&n.set("status",t.status),t?.team_id&&n.set("team_id",t.team_id),t?.team_guardrail!==void 0&&n.set("team_guardrail",String(t.team_guardrail)),t?.search&&n.set("search",t.search);let o=n.toString()?`${r}?${n.toString()}`:r,a=await fetch(o,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!a.ok){let e=nx(await a.json().catch(()=>({})));throw j(e),Error(e)}return a.json()},tB=async(e,t)=>{let r=$?`${$}/guardrails/submissions/${encodeURIComponent(t)}/approve`:`/guardrails/submissions/${encodeURIComponent(t)}/approve`,n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=nx(await n.json().catch(()=>({})));throw j(e),Error(e)}return n.json()},tA=async(e,t)=>{let r=$?`${$}/guardrails/submissions/${encodeURIComponent(t)}/reject`:`/guardrails/submissions/${encodeURIComponent(t)}/reject`,n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=nx(await n.json().catch(()=>({})));throw j(e),Error(e)}return n.json()},tz=async(e,t,r)=>{try{let n=$?`${$}/guardrails/usage/overview`:"/guardrails/usage/overview",o=new URLSearchParams;t&&o.append("start_date",t),r&&o.append("end_date",r),o.toString()&&(n+=`?${o.toString()}`);let a=await fetch(n,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!a.ok){let e=await a.json();throw Error(nx(e))}return a.json()}catch(e){throw console.error("Failed to get guardrails usage overview:",e),e}},tL=async(e,t,r,n)=>{try{let o=$?`${$}/guardrails/usage/detail/${encodeURIComponent(t)}`:`/guardrails/usage/detail/${encodeURIComponent(t)}`,a=new URLSearchParams;r&&a.append("start_date",r),n&&a.append("end_date",n),a.toString()&&(o+=`?${a.toString()}`);let i=await fetch(o,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!i.ok){let e=await i.json();throw Error(nx(e))}return i.json()}catch(e){throw console.error("Failed to get guardrails usage detail:",e),e}},tH=async(e,t)=>{try{let r=$?`${$}/guardrails/usage/logs`:"/guardrails/usage/logs",n=new URLSearchParams;t.guardrailId&&n.append("guardrail_id",t.guardrailId),t.policyId&&n.append("policy_id",t.policyId),null!=t.page&&n.append("page",String(t.page)),null!=t.pageSize&&n.append("page_size",String(t.pageSize)),t.action&&n.append("action",t.action),t.startDate&&n.append("start_date",t.startDate),t.endDate&&n.append("end_date",t.endDate),n.toString()&&(r+=`?${n.toString()}`);let o=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!o.ok){let e=await o.json();throw Error(nx(e))}return o.json()}catch(e){throw console.error("Failed to get guardrails usage logs:",e),e}},tD=async e=>{try{let t=$?`${$}/policies/list`:"/policies/list",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nx(e);throw j(t),Error(t)}return await r.json()}catch(e){throw console.error("Failed to get policies list:",e),e}},tV=async(e,t,r)=>{try{let n=$?`${$}/utils/test_policies_and_guardrails`:"/utils/test_policies_and_guardrails",o=await fetch(n,{method:"POST",signal:r,headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({policy_names:t.policy_names??null,guardrail_names:t.guardrail_names??null,inputs:t.inputs??null,inputs_list:t.inputs_list??null,request_data:t.request_data??{},input_type:t.input_type??"request",agent_id:t.agent_id??null})});if(!o.ok){let e=await o.text(),t="Failed to test policies and guardrails";try{let r=JSON.parse(e);r.detail?t="string"==typeof r.detail?r.detail:JSON.stringify(r.detail):r.message&&(t=r.message)}catch{t=e||t}throw j(t),Error(t)}return await o.json()}catch(e){throw console.error("Failed to test policies and guardrails:",e),e}},tW=async(e,t)=>{try{let r=$?`${$}/policy/info/${t}`:`/policy/info/${t}`,n=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error(`Failed to get policy info for ${t}:`,e),e}},tG=async e=>{try{let t=$?`${$}/policy/templates`:"/policy/templates",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nx(e);throw j(t),Error(t)}return await r.json()}catch(e){throw console.error("Failed to get policy templates:",e),e}},tU=async(e,t,r,n,o)=>{try{let a=$?`${$}/policy/templates/enrich`:"/policy/templates/enrich",i={template_id:t,parameters:r};n&&(i.model=n),o&&(i.competitors=o);let l=await fetch(a,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(i)});if(!l.ok){let e=await l.json(),t=nx(e);throw j(t),Error(t)}return await l.json()}catch(e){throw console.error("Failed to enrich policy template:",e),e}},tq=async(e,t,r,n)=>{try{let o=$?`${$}/policy/templates/suggest`:"/policy/templates/suggest",a=await fetch(o,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({attack_examples:t.filter(e=>e.trim()),description:r,model:n})});if(!a.ok){let e=await a.json(),t=nx(e);throw j(t),Error(t)}return a.json()}catch(e){throw console.error("Failed to suggest policy templates:",e),e}},tJ=async(e,t,r)=>{try{let n=$?`${$}/policy/templates/test`:"/policy/templates/test",o=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({guardrail_definitions:t,text:r})});if(!o.ok){let e=await o.json(),t=nx(e);throw j(t),Error(t)}return o.json()}catch(e){throw console.error("Failed to test policy template:",e),e}},tK=async(e,t,r,n,o,a,i,l,s)=>{let c=$?`${$}/policy/templates/enrich/stream`:"/policy/templates/enrich/stream",u={template_id:t,parameters:r,model:n};l?.instruction&&(u.instruction=l.instruction),l?.existingCompetitors&&(u.competitors=l.existingCompetitors);let d=await fetch(c,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(u)});if(!d.ok){let e=nx(await d.json());throw j(e),Error(e)}let f=d.body?.getReader();if(!f)throw Error("No response body");let p=new TextDecoder,m="";for(;;){let{done:e,value:t}=await f.read();if(e)break;let r=(m+=p.decode(t,{stream:!0})).split("\n");for(let e of(m=r.pop()||"",r))if(e.startsWith("data: "))try{let t=JSON.parse(e.slice(6));"competitor"===t.type?o(t.name):"status"===t.type?s?.(t.message):"done"===t.type?a(t):"error"===t.type&&i?.(t.message)}catch{}}},tX=async(e,t,r,n,o,a,i,l,s)=>{let c=$?`${$}/usage/ai/chat`:"/usage/ai/chat",u=await fetch(c,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({messages:t,model:r}),signal:s});if(!u.ok){let e=nx(await u.json());throw j(e),Error(e)}let d=u.body?.getReader();if(!d)throw Error("No response body");let f=new TextDecoder,p="";for(;;){let{done:e,value:t}=await d.read();if(e)break;let r=(p+=f.decode(t,{stream:!0})).split("\n");for(let e of(p=r.pop()||"",r))if(e.startsWith("data: "))try{let t=JSON.parse(e.slice(6));"chunk"===t.type?n(t.content):"status"===t.type?i?.(t.message):"tool_call"===t.type?l?.(t):"done"===t.type?o():"error"===t.type&&a?.(t.message)}catch{}}},tY=async(e,t)=>{try{let r=$?`${$}/policies`:"/policies",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to create policy:",e),e}},tZ=async(e,t,r)=>{try{let n=$?`${$}/policies/${t}`:`/policies/${t}`,o=await fetch(n,{method:"PUT",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(r)});if(!o.ok){let e=await o.json(),t=nx(e);throw j(t),Error(t)}return await o.json()}catch(e){throw console.error("Failed to update policy:",e),e}},tQ=async(e,t)=>{try{let r=encodeURIComponent(t),n=$?`${$}/policies/name/${r}/versions`:`/policies/name/${r}/versions`,o=await fetch(n,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!o.ok){let e=await o.json(),t=nx(e);throw j(t),Error(t)}return await o.json()}catch(e){throw console.error("Failed to list policy versions:",e),e}},t0=async(e,t,r)=>{try{let n=encodeURIComponent(t),o=$?`${$}/policies/name/${n}/versions`:`/policies/name/${n}/versions`,a=await fetch(o,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({source_policy_id:r??void 0})});if(!a.ok){let e=await a.json(),t=nx(e);throw j(t),Error(t)}return await a.json()}catch(e){throw console.error("Failed to create policy version:",e),e}},t1=async(e,t,r)=>{try{let n=$?`${$}/policies/${t}/status`:`/policies/${t}/status`,o=await fetch(n,{method:"PUT",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({version_status:r})});if(!o.ok){let e=await o.json(),t=nx(e);throw j(t),Error(t)}return await o.json()}catch(e){throw console.error("Failed to update policy version status:",e),e}},t2=async(e,t)=>{try{let r=$?`${$}/policies/${t}`:`/policies/${t}`,n=await fetch(r,{method:"DELETE",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to delete policy:",e),e}},t4=async(e,t)=>{try{let r=$?`${$}/policies/${t}`:`/policies/${t}`,n=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to get policy info:",e),e}},t6=async e=>{try{let t=$?`${$}/policies/attachments/list`:"/policies/attachments/list",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nx(e);throw j(t),Error(t)}return await r.json()}catch(e){throw console.error("Failed to get policy attachments list:",e),e}},t3=async(e,t)=>{try{let r=$?`${$}/policies/attachments`:"/policies/attachments",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to create policy attachment:",e),e}},t7=async(e,t)=>{try{let r=$?`${$}/policies/attachments/${t}`:`/policies/attachments/${t}`,n=await fetch(r,{method:"DELETE",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to delete policy attachment:",e),e}},t5=async(e,t,r)=>{try{let n=$?`${$}/policies/test-pipeline`:"/policies/test-pipeline",o=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({pipeline:t,test_messages:r})});if(!o.ok){let e=await o.json(),t=nx(e);throw j(t),Error(t)}return await o.json()}catch(e){throw console.error("Failed to test pipeline:",e),e}},t9=async(e,t)=>{try{let r=$?`${$}/policies/${t}/resolved-guardrails`:`/policies/${t}/resolved-guardrails`,n=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to get resolved guardrails:",e),e}},t8=async(e,t)=>{try{let r=$?`${$}/policies/resolve`:"/policies/resolve",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to resolve policies:",e),e}},re=async(e,t)=>{try{let r=$?`${$}/policies/attachments/estimate-impact`:"/policies/attachments/estimate-impact",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to estimate attachment impact:",e),e}},rt=async e=>{try{let t=$?`${$}/prompts/list`:"/prompts/list",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nx(e);throw j(t),Error(t)}return await r.json()}catch(e){throw console.error("Failed to get prompts list:",e),e}},rr=async(e,t)=>{try{let r=$?`${$}/prompts/${t}/info`:`/prompts/${t}/info`,n=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to get prompt info:",e),e}},rn=async(e,t)=>{try{let r=$?`${$}/prompts/${t}/versions`:`/prompts/${t}/versions`,n=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nx(e);throw 404!==n.status&&j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to get prompt versions:",e),e}},ro=async(e,t)=>{try{let r=$?`${$}/prompts`:"/prompts",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to create prompt:",e),e}},ra=async(e,t,r)=>{try{let n=$?`${$}/prompts/${t}`:`/prompts/${t}`,o=await fetch(n,{method:"PUT",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(r)});if(!o.ok){let e=await o.json(),t=nx(e);throw j(t),Error(t)}return await o.json()}catch(e){throw console.error("Failed to update prompt:",e),e}},ri=async(e,t)=>{try{let r=$?`${$}/prompts/${t}`:`/prompts/${t}`,n=await fetch(r,{method:"DELETE",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to delete prompt:",e),e}},rl=async(e,t)=>{try{let r=new FormData;r.append("file",t);let n=$?`${$}/utils/dotprompt_json_converter`:"/utils/dotprompt_json_converter",o=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`},body:r});if(!o.ok){let e=await o.json(),t=nx(e);throw j(t),Error(t)}return await o.json()}catch(e){throw console.error("Failed to convert prompt file:",e),e}},rs=async(e,t)=>{try{let r=$?`${$}/v1/agents`:"/v1/agents",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({...t})});if(!n.ok){let e=await n.text();throw j(e),Error(e)}let o=await n.json();return console.log("Create agent response:",o),o}catch(e){throw console.error("Failed to create agent:",e),e}},rc=async(e,t)=>{try{let r=$?`${$}/guardrails`:"/guardrails",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({guardrail:t})});if(!n.ok){let e=await n.text();throw j(e),Error(e)}let o=await n.json();return console.log("Create guardrail response:",o),o}catch(e){throw console.error("Failed to create guardrail:",e),e}},ru=async(e,t,r)=>{try{let n=$?`${$}/spend/logs/ui/${t}?start_date=${encodeURIComponent(r)}`:`/spend/logs/ui/${t}?start_date=${encodeURIComponent(r)}`;console.log("Fetching log details from:",n);let o=await fetch(n,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!o.ok){let e=await o.json(),t=nx(e);throw j(t),Error(t)}let a=await o.json();return console.log("Fetched log details:",a),a}catch(e){throw console.error("Failed to fetch log details:",e),e}},rd=async e=>{try{let t=$?`${$}/get/internal_user_settings`:"/get/internal_user_settings";console.log("Fetching SSO settings from:",t);let r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nx(e);throw j(t),Error(t)}let n=await r.json();return console.log("Fetched SSO settings:",n),n}catch(e){throw console.error("Failed to fetch SSO settings:",e),e}},rf=async(e,t)=>{try{let r=$?`${$}/update/internal_user_settings`:"/update/internal_user_settings";console.log("Updating internal user settings:",t);let n=await fetch(r,{method:"PATCH",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){let e=await n.text();throw j(e),Error(e)}let o=await n.json();return console.log("Updated internal user settings:",o),g.default.success("Internal user settings updated successfully"),o}catch(e){throw console.error("Failed to update internal user settings:",e),e}},rp=async e=>{try{let t=$?`${$}/v1/mcp/openapi-registry`:"/v1/mcp/openapi-registry",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json();throw Error(nx(e))}return await r.json()}catch(e){throw console.error("Failed to fetch OpenAPI registry:",e),e}},rm=async e=>{try{let t=$?`${$}/v1/mcp/discover`:"/v1/mcp/discover",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nx(e);throw j(t),Error(t)}return await r.json()}catch(e){throw console.error("Failed to fetch discoverable MCP servers:",e),e}},rh=async(e,t)=>{try{let r=$?`${$}/v1/mcp/server`:"/v1/mcp/server";if(t){let e=new URLSearchParams;e.append("team_id",t),r=`${r}?${e.toString()}`}console.log("Fetching MCP servers from:",r);let n=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}let o=await n.json();return console.log("Fetched MCP servers:",o),o}catch(e){throw console.error("Failed to fetch MCP servers:",e),e}},rg=async(e,t)=>{try{let r=$?`${$}/v1/mcp/server/health`:"/v1/mcp/server/health";if(t&&t.length>0){let e=new URLSearchParams;t.forEach(t=>e.append("server_ids",t)),r=`${r}?${e.toString()}`}console.log("Fetching MCP server health from:",r);let n=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}let o=await n.json();return console.log("Fetched MCP server health:",o),o}catch(e){throw console.error("Failed to fetch MCP server health:",e),e}},rv=async e=>{try{let t=$?`${$}/v1/mcp/access_groups`:"/v1/mcp/access_groups";console.log("Fetching MCP access groups from:",t);let r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nx(e);throw j(t),Error(t)}let n=await r.json();return console.log("Fetched MCP access groups:",n),n.access_groups||[]}catch(e){throw console.error("Failed to fetch MCP access groups:",e),e}},ry=async e=>{try{let t=$?`${$}/v1/mcp/network/client-ip`:"/v1/mcp/network/client-ip",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`}});if(!r.ok)return null;return(await r.json()).ip||null}catch{return null}},rb=async(e,t)=>{try{console.log("Form Values in createMCPServer:",t);let r=$?`${$}/v1/mcp/server`:"/v1/mcp/server",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({...t})});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}let o=await n.json();return console.log("API Response:",o),o}catch(e){throw console.error("Failed to create key:",e),e}},rw=async(e,t)=>{try{let r=$?`${$}/v1/mcp/server`:"/v1/mcp/server",n=await fetch(r,{method:"PUT",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to update MCP server:",e),e}},r$=async(e,t)=>{try{let r=($?`${$}`:"")+`/v1/mcp/server/${t}`;console.log("in deleteMCPServer:",t);let n=await fetch(r,{method:S,headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}}catch(e){throw console.error("Failed to delete key:",e),e}},rC=async(e,t)=>{try{let r=($?`${$}`:"")+"/v1/mcp/server/register",n=await fetch(r,{method:E,headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}return n.json()}catch(e){throw console.error("Failed to register MCP server:",e),e}},rE=async e=>{try{let t=($?`${$}`:"")+"/v1/mcp/server/submissions",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json().catch(()=>({})),t=nx(e);throw j(t),Error(t)}return r.json()}catch(e){throw console.error("Failed to fetch MCP submissions:",e),e}},rS=async(e,t)=>{try{let r=($?`${$}`:"")+`/v1/mcp/server/${encodeURIComponent(t)}/approve`,n=await fetch(r,{method:"PUT",headers:{[T]:`Bearer ${e}`}});if(!n.ok){let e=await n.json().catch(()=>({})),t=nx(e);throw j(t),Error(t)}return n.json()}catch(e){throw console.error("Failed to approve MCP server:",e),e}},rx=async(e,t,r)=>{try{let n=($?`${$}`:"")+`/v1/mcp/server/${encodeURIComponent(t)}/reject`,o=await fetch(n,{method:"PUT",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({review_notes:r??null})});if(!o.ok){let e=await o.json().catch(()=>({})),t=nx(e);throw j(t),Error(t)}return o.json()}catch(e){throw console.error("Failed to reject MCP server:",e),e}},rj=async e=>{try{let t=$?`${$}/search_tools/list`:"/search_tools/list";console.log("Fetching search tools from:",t);let r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nx(e);throw j(t),Error(t)}let n=await r.json();return console.log("Fetched search tools:",n),n}catch(e){throw console.error("Failed to fetch search tools:",e),e}},rO=async(e,t)=>{try{console.log("Creating search tool with values:",t);let r=$?`${$}/search_tools`:"/search_tools",n=await fetch(r,{method:E,headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({search_tool:t})});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}let o=await n.json();return console.log("Created search tool:",o),o}catch(e){throw console.error("Failed to create search tool:",e),e}},rk=async(e,t,r)=>{try{console.log("Updating search tool with ID:",t,"values:",r);let n=$?`${$}/search_tools/${t}`:`/search_tools/${t}`,o=await fetch(n,{method:"PUT",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({search_tool:r})});if(!o.ok){let e=await o.json(),t=nx(e);throw j(t),Error(t)}let a=await o.json();return console.log("Updated search tool:",a),a}catch(e){throw console.error("Failed to update search tool:",e),e}},rT=async(e,t)=>{try{let r=($?`${$}`:"")+`/search_tools/${t}`;console.log("Deleting search tool:",t);let n=await fetch(r,{method:S,headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}let o=await n.json();return console.log("Deleted search tool:",o),o}catch(e){throw console.error("Failed to delete search tool:",e),e}},rF=async e=>{try{let t=$?`${$}/search_tools/ui/available_providers`:"/search_tools/ui/available_providers";console.log("Fetching available search providers from:",t);let r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nx(e);throw j(t),Error(t)}let n=await r.json();return console.log("Fetched available search providers:",n),n}catch(e){throw console.error("Failed to fetch available search providers:",e),e}},r_=async(e,t)=>{try{let r=$?`${$}/search_tools/test_connection`:"/search_tools/test_connection";console.log("Testing search tool connection:",r);let n=await fetch(r,{method:E,headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({litellm_params:t})});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}let o=await n.json();return console.log("Test connection response:",o),o}catch(e){throw console.error("Failed to test search tool connection:",e),e}},rI=async(e,t,r)=>{try{let n=$?`${$}/mcp-rest/tools/list?server_id=${t}`:`/mcp-rest/tools/list?server_id=${t}`;console.log("Fetching MCP tools from:",n);let o={[T]:`Bearer ${e}`,"Content-Type":"application/json",...r},a=await fetch(n,{method:"GET",headers:o}),i=await a.json();if(console.log("Fetched MCP tools response:",i),!a.ok){if(i.error&&i.message)throw Error(i.message);throw Error("Failed to fetch MCP tools")}return i}catch(e){return console.error("Failed to fetch MCP tools:",e),{tools:[],error:"network_error",message:e instanceof Error?e.message:"Failed to fetch MCP tools",stack_trace:null}}},rP=async(e,t,r,n,o)=>{try{let a=$?`${$}/mcp-rest/tools/call`:"/mcp-rest/tools/call";console.log("Calling MCP tool:",r,"with arguments:",n,"for server:",t);let i={[T]:`Bearer ${e}`,"Content-Type":"application/json",...o?.customHeaders||{}},l={server_id:t,name:r,arguments:n};o?.guardrails&&o.guardrails.length>0&&(l.litellm_metadata={guardrails:o.guardrails});let s=await fetch(a,{method:"POST",headers:i,body:JSON.stringify(l)});if(!s.ok){let e="Network response was not ok",t=null,r=await s.text();try{let n=JSON.parse(r);n.detail?"string"==typeof n.detail?e=n.detail:"object"==typeof n.detail&&(e=n.detail.message||n.detail.error||"An error occurred",t=n.detail):e=n.message||n.error||e}catch(t){console.error("Failed to parse JSON error response:",t),r&&(e=r)}let n=Error(e);throw n.status=s.status,n.statusText=s.statusText,n.details=t,j(e),n}let c=await s.json();return console.log("MCP tool call response:",c),c}catch(e){throw console.error("Failed to call MCP tool:",e),console.error("Error type:",typeof e),e instanceof Error&&(console.error("Error message:",e.message),console.error("Error stack:",e.stack)),e}},rN=async(e,t)=>{try{let r=$?`${$}/tag/new`:"/tag/new",n=await fetch(r,{method:"POST",headers:{"Content-Type":"application/json",[T]:`Bearer ${e}`},body:JSON.stringify(t)});if(!n.ok){let e=await n.text();await j(e);return}return await n.json()}catch(e){throw console.error("Error creating tag:",e),e}},rR=async(e,t)=>{try{let r=$?`${$}/tag/update`:"/tag/update",n=await fetch(r,{method:"POST",headers:{"Content-Type":"application/json",[T]:`Bearer ${e}`},body:JSON.stringify(t)});if(!n.ok){let e=await n.text();await j(e);return}return await n.json()}catch(e){throw console.error("Error updating tag:",e),e}},rM=async(e,t)=>{try{let r=$?`${$}/tag/info`:"/tag/info",n=await fetch(r,{method:"POST",headers:{"Content-Type":"application/json",[T]:`Bearer ${e}`},body:JSON.stringify({names:t})});if(!n.ok){let e=await n.text();return await j(e),{}}return await n.json()}catch(e){throw console.error("Error getting tag info:",e),e}},rB=async e=>{try{let t=$?`${$}/tag/list`:"/tag/list",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`}});if(!r.ok){let e=await r.text();return await j(e),{}}return await r.json()}catch(e){throw console.error("Error listing tags:",e),e}},rA=async(e,t)=>{try{let r=$?`${$}/tag/delete`:"/tag/delete",n=await fetch(r,{method:"POST",headers:{"Content-Type":"application/json",[T]:`Bearer ${e}`},body:JSON.stringify({name:t})});if(!n.ok){let e=await n.text();await j(e);return}return await n.json()}catch(e){throw console.error("Error deleting tag:",e),e}},rz=async e=>{try{let t=$?`${$}/get/default_team_settings`:"/get/default_team_settings";console.log("Fetching default team settings from:",t);let r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nx(e);throw j(t),Error(t)}let n=await r.json();return console.log("Fetched default team settings:",n),n}catch(e){throw console.error("Failed to fetch default team settings:",e),e}},rL=async(e,t)=>{try{let r=$?`${$}/update/default_team_settings`:"/update/default_team_settings";console.log("Updating default team settings:",t);let n=await fetch(r,{method:"PATCH",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}let o=await n.json();return console.log("Updated default team settings:",o),g.default.success("Default team settings updated successfully"),o}catch(e){throw console.error("Failed to update default team settings:",e),e}},rH=async(e,t)=>{try{let r=$?`${$}/team/permissions_list?team_id=${t}`:`/team/permissions_list?team_id=${t}`,n=await fetch(r,{method:"GET",headers:{"Content-Type":"application/json",[T]:`Bearer ${e}`}});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}let o=await n.json();return console.log("Team permissions response:",o),o}catch(e){throw console.error("Failed to get team permissions:",e),e}},rD=async(e,t,r)=>{try{let n=$?`${$}/team/permissions_update`:"/team/permissions_update",o=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json",[T]:`Bearer ${e}`},body:JSON.stringify({team_id:t,team_member_permissions:r})});if(!o.ok){let e=await o.json(),t=nx(e);throw j(t),Error(t)}let a=await o.json();return console.log("Team permissions response:",a),a}catch(e){throw console.error("Failed to update team permissions:",e),e}},rV=async(e,t)=>{try{let r=$?`${$}/spend/logs/session/ui?session_id=${encodeURIComponent(t)}`:`/spend/logs/session/ui?session_id=${encodeURIComponent(t)}`,n=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to fetch session logs:",e),e}},rW=async(e,t)=>{try{let r=$?`${$}/vector_store/new`:"/vector_store/new",n=await fetch(r,{method:"POST",headers:{"Content-Type":"application/json",[T]:`Bearer ${e}`},body:JSON.stringify(t)});if(!n.ok){let e=await n.json();throw Error(e.detail||"Failed to create vector store")}return await n.json()}catch(e){throw console.error("Error creating vector store:",e),e}},rG=async(e,t=1,r=100)=>{try{let t=$?`${$}/vector_store/list`:"/vector_store/list",r=await fetch(t,{method:"GET",headers:{"Content-Type":"application/json",[T]:`Bearer ${e}`}});if(!r.ok){let e=await r.json();throw Error(e.detail||"Failed to list vector stores")}return await r.json()}catch(e){throw console.error("Error listing vector stores:",e),e}},rU=async(e,t)=>{try{let r=$?`${$}/vector_store/delete`:"/vector_store/delete",n=await fetch(r,{method:"POST",headers:{"Content-Type":"application/json",[T]:`Bearer ${e}`},body:JSON.stringify({vector_store_id:t})});if(!n.ok){let e=await n.json();throw Error(e.detail||"Failed to delete vector store")}return await n.json()}catch(e){throw console.error("Error deleting vector store:",e),e}},rq=async(e,t)=>{try{let r=$?`${$}/vector_store/info`:"/vector_store/info",n=await fetch(r,{method:"POST",headers:{"Content-Type":"application/json",[T]:`Bearer ${e}`},body:JSON.stringify({vector_store_id:t})});if(!n.ok){let e=await n.json();throw Error(e.detail||"Failed to get vector store info")}return await n.json()}catch(e){throw console.error("Error getting vector store info:",e),e}},rJ=async(e,t)=>{try{let r=$?`${$}/vector_store/update`:"/vector_store/update",n=await fetch(r,{method:"POST",headers:{"Content-Type":"application/json",[T]:`Bearer ${e}`},body:JSON.stringify(t)});if(!n.ok){let e=await n.json();throw Error(e.detail||"Failed to update vector store")}return await n.json()}catch(e){throw console.error("Error updating vector store:",e),e}},rK=async(e,t,r,n,o,a,i)=>{try{let l=$?`${$}/rag/ingest`:"/rag/ingest",s=new FormData;s.append("file",t);let c={ingest_options:{vector_store:{custom_llm_provider:r,...n&&{vector_store_id:n},...i&&i}}};(o||a)&&(c.ingest_options.litellm_vector_store_params={},o&&(c.ingest_options.litellm_vector_store_params.vector_store_name=o),a&&(c.ingest_options.litellm_vector_store_params.vector_store_description=a)),s.append("request",JSON.stringify(c));let u=await fetch(l,{method:"POST",headers:{[T]:`Bearer ${e}`},body:s});if(!u.ok){let e=await u.json();throw Error(e.error?.message||e.detail||"Failed to ingest document")}return await u.json()}catch(e){throw console.error("Error ingesting document:",e),e}},rX=async e=>{try{let t=$?`${$}/email/event_settings`:"/email/event_settings",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.text();throw j(e),Error("Failed to get email event settings")}let n=await r.json();return console.log("Email event settings response:",n),n}catch(e){throw console.error("Failed to get email event settings:",e),e}},rY=async(e,t)=>{try{let r=$?`${$}/email/event_settings`:"/email/event_settings",n=await fetch(r,{method:"PATCH",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){let e=await n.text();throw j(e),Error("Failed to update email event settings")}let o=await n.json();return console.log("Update email event settings response:",o),o}catch(e){throw console.error("Failed to update email event settings:",e),e}},rZ=async e=>{try{let t=$?`${$}/email/event_settings/reset`:"/email/event_settings/reset",r=await fetch(t,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.text();throw j(e),Error("Failed to reset email event settings")}let n=await r.json();return console.log("Reset email event settings response:",n),n}catch(e){throw console.error("Failed to reset email event settings:",e),e}},rQ=async(e,t)=>{try{let r=$?`${$}/v1/agents/${t}`:`/v1/agents/${t}`,n=await fetch(r,{method:"DELETE",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.text();throw j(e),Error(e)}let o=await n.json();return console.log("Delete agent response:",o),o}catch(e){throw console.error("Failed to delete agent:",e),e}},r0=async(e,t)=>{try{let r=$?`${$}/v1/agents/make_public`:"/v1/agents/make_public",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({agent_ids:t})});if(!n.ok){let e=await n.text();throw j(e),Error(e)}let o=await n.json();return console.log("Make agents public response:",o),o}catch(e){throw console.error("Failed to make agents public:",e),e}},r1=async(e,t)=>{try{let r=$?`${$}/v1/mcp/make_public`:"/v1/mcp/make_public",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({mcp_server_ids:t})});if(!n.ok){let e=await n.text();throw j(e),Error(e)}let o=await n.json();return console.log("Make agents public response:",o),o}catch(e){throw console.error("Failed to make agents public:",e),e}},r2=async(e,t)=>{try{let r=$?`${$}/guardrails/${t}`:`/guardrails/${t}`,n=await fetch(r,{method:"DELETE",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.text();throw j(e),Error(e)}let o=await n.json();return console.log("Delete guardrail response:",o),o}catch(e){throw console.error("Failed to delete guardrail:",e),e}},r4=async e=>{try{let t=$?`${$}/guardrails/ui/add_guardrail_settings`:"/guardrails/ui/add_guardrail_settings",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.text();throw j(e),Error("Failed to get guardrail UI settings")}let n=await r.json();return console.log("Guardrail UI settings response:",n),n}catch(e){throw console.error("Failed to get guardrail UI settings:",e),e}},r6=async e=>{try{let t=$?`${$}/guardrails/ui/provider_specific_params`:"/guardrails/ui/provider_specific_params",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.text();throw j(e),Error("Failed to get guardrail provider specific parameters")}let n=await r.json();return console.log("Guardrail provider specific params response:",n),n}catch(e){throw console.error("Failed to get guardrail provider specific parameters:",e),e}},r3=async(e,t)=>{try{let r=encodeURIComponent(t),n=$?`${$}/guardrails/ui/category_yaml/${r}`:`/guardrails/ui/category_yaml/${r}`;console.log(`Fetching category YAML from: ${n}`);let o=await fetch(n,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!o.ok){let e=await o.text();throw console.error(`Failed to get category YAML. Status: ${o.status}, Error:`,e),j(e),Error(`Failed to get category YAML: ${o.status} ${e}`)}let a=await o.json();return console.log("Category YAML response:",a),a}catch(e){throw console.error("Failed to get category YAML:",e),e}},r7=async e=>{try{let t=$?`${$}/guardrails/ui/major_airlines`:"/guardrails/ui/major_airlines",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.text();throw console.error(`Failed to get major airlines. Status: ${r.status}, Error:`,e),j(e),Error(`Failed to get major airlines: ${r.status} ${e}`)}return await r.json()}catch(e){throw console.error("Failed to get major airlines:",e),e}},r5=async(e,t=!1)=>{try{let r=t?"?health_check=true":"",n=$?`${$}/v1/agents${r}`:`/v1/agents${r}`,o=await fetch(n,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!o.ok){let e=await o.text();throw j(e),Error("Failed to get agents list")}let a=await o.json();return console.log("Agents list response:",a),{agents:a}}catch(e){throw console.error("Failed to get agents list:",e),e}},r9=async(e,t)=>{try{let r=$?`${$}/v1/agents/${t}`:`/v1/agents/${t}`,n=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.text();throw j(e),Error("Failed to get agent info")}let o=await n.json();return console.log("Agent info response:",o),o}catch(e){throw console.error("Failed to get agent info:",e),e}},r8=async(e,t)=>{try{let r=$?`${$}/guardrails/${t}/info`:`/guardrails/${t}/info`,n=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.text();throw j(e),Error("Failed to get guardrail info")}let o=await n.json();return console.log("Guardrail info response:",o),o}catch(e){throw console.error("Failed to get guardrail info:",e),e}},ne=async(e,t,r)=>{try{let n=$?`${$}/v1/agents/${t}`:`/v1/agents/${t}`,o=await fetch(n,{method:"PATCH",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(r)});if(!o.ok){let e=await o.text();throw j(e),Error("Failed to patch agent")}let a=await o.json();return console.log("Patch agent response:",a),a}catch(e){throw console.error("Failed to update guardrail:",e),e}},nt=async(e,t,r)=>{try{let n=$?`${$}/guardrails/${t}`:`/guardrails/${t}`,o=await fetch(n,{method:"PATCH",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(r)});if(!o.ok){let e=await o.text();throw j(e),Error("Failed to update guardrail")}let a=await o.json();return console.log("Update guardrail response:",a),a}catch(e){throw console.error("Failed to update guardrail:",e),e}},nr=async(e,t,r,n,o)=>{try{let a=$?`${$}/guardrails/apply_guardrail`:"/guardrails/apply_guardrail",i={guardrail_name:t,text:r};n&&(i.language=n),o&&o.length>0&&(i.entities=o);let l=await fetch(a,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(i)});if(!l.ok){let e=await l.text(),t="Failed to apply guardrail";try{let r=JSON.parse(e);r.error?.message?t=r.error.message:r.detail?t=r.detail:r.message&&(t=r.message)}catch(r){t=e||t}throw j(e),Error(t)}let s=await l.json();return console.log("Apply guardrail response:",s),s}catch(e){throw console.error("Failed to apply guardrail:",e),e}},nn=async(e,t)=>{try{let r=$?`${$}/guardrails/test_custom_code`:"/guardrails/test_custom_code",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){let e=await n.text(),t="Failed to test custom code guardrail";try{let r=JSON.parse(e);r.error?.message?t=r.error.message:r.detail?t=r.detail:r.message&&(t=r.message)}catch(r){t=e||t}throw j(e),Error(t)}let o=await n.json();return console.log("Test custom code guardrail response:",o),o}catch(e){throw console.error("Failed to test custom code guardrail:",e),e}},no=async(e,t)=>{try{let r=$?`${$}/guardrails/validate_blocked_words_file`:"/guardrails/validate_blocked_words_file",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({file_content:t})});if(!n.ok){let e=await n.text();throw j(e),Error("Failed to validate blocked words file")}let o=await n.json();return console.log("Validate blocked words file response:",o),o}catch(e){throw console.error("Failed to validate blocked words file:",e),e}},na=async e=>{try{let t=$?`${$}/get/sso_settings`:"/get/sso_settings";console.log("Fetching SSO configuration from:",t);let r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nx(e);throw j(t),Error(t)}let n=await r.json();return console.log("Fetched SSO configuration:",n),n}catch(e){throw console.error("Failed to fetch SSO configuration:",e),e}},ni=async(e,t)=>{try{let r=$?`${$}/update/sso_settings`:"/update/sso_settings";console.log("Updating SSO configuration:",t);let n=await fetch(r,{method:"PATCH",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){let e=await n.json(),t="object"==typeof e?.detail?e.detail?.error||e.detail?.message:e?.detail,r="string"==typeof t&&t.length>0?t:nx(e);j(r);let o=Error(r);throw e?.detail!==void 0&&(o.detail=e.detail),o.rawError=e,o}let o=await n.json();return console.log("Updated SSO configuration:",o),o}catch(e){throw console.error("Failed to update SSO configuration:",e),e}},nl=async({accessToken:e,page:t=1,page_size:r=50,params:n={}})=>{try{let o=$?`${$}/audit`:"/audit",a=new URLSearchParams;for(let[e,o]of(a.append("page",t.toString()),a.append("page_size",r.toString()),Object.entries(n)))null!=o&&""!==o&&a.append(e,String(o));o+=`?${a.toString()}`;let i=await fetch(o,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!i.ok){let e=await i.json(),t=nx(e);throw j(t),Error(t)}return await i.json()}catch(e){throw console.error("Failed to fetch audit logs:",e),e}},ns=async e=>{try{let t=$?`${$}/user/available_users`:"/user/available_users",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`}});if(!r.ok){if(404===r.status)return null;let e=await r.text();throw j(e),Error("Network response was not ok")}return await r.json()}catch(e){throw console.error("Failed to fetch remaining users:",e),e}},nc=async e=>{try{let t=$?`${$}/health/license`:"/health/license",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`}});if(!r.ok){if(404===r.status)return null;let e=await r.text();throw j(e),Error("Network response was not ok")}return await r.json()}catch(e){throw console.error("Failed to fetch license info:",e),e}},nu=async(e,t,r)=>{try{let n=$?`${$}/config/pass_through_endpoint/${encodeURIComponent(t)}`:`/config/pass_through_endpoint/${encodeURIComponent(t)}`,o=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(r)});if(!o.ok){let e=await o.json(),t=nx(e);throw j(t),Error(t)}let a=await o.json();return g.default.success("Pass through endpoint updated successfully"),a}catch(e){throw console.error("Failed to update pass through endpoint:",e),e}},nd=async(e,t)=>{try{let r=$?`${$}/config/callback/delete`:"/config/callback/delete",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({callback_name:t})});if(!n.ok){let e=await n.json(),t=nx(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to delete specific callback:",e),e}},nf=async(e,t,r)=>{try{console.log("Testing MCP tools list with config:",JSON.stringify(t));let n=$?`${$}/mcp-rest/test/tools/list`:"/mcp-rest/test/tools/list",o={"Content-Type":"application/json"};e&&(o["x-litellm-api-key"]=e),r?o.Authorization=`Bearer ${r}`:e&&(o[T]=`Bearer ${e}`);let a=await fetch(n,{method:"POST",headers:o,body:JSON.stringify(t)}),i=a.headers.get("content-type");if(!i||!i.includes("application/json")){let e=await a.text();throw console.error("Received non-JSON response:",e),Error(`Received non-JSON response (${a.status}: ${a.statusText}). Check network tab for details.`)}let l=await a.json();if((!a.ok||l.error)&&!l.error)return{tools:[],error:"request_failed",message:l.message||`MCP tools list failed: ${a.status} ${a.statusText}`};return l}catch(e){throw console.error("MCP tools list test error:",e),e}},np=async(e,t)=>{let r=$?`${$}/v1/mcp/server/oauth/session`:"/v1/mcp/server/oauth/session",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)}),o=await n.json();if(!n.ok)throw Error(nx(o)||o?.error||"Failed to cache MCP server");return o},nm=async(e,t,r)=>{let n=C(),o=encodeURIComponent(t.trim()),a=`${n}/v1/mcp/server/oauth/${o}/register`,i=await fetch(a,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json",Accept:"application/json, text/event-stream"},body:JSON.stringify(r)}),l=await i.json();if(!i.ok)throw Error(nx(l)||l?.detail||"Failed to register OAuth client");return l},nh=({serverId:e,clientId:t,redirectUri:r,state:n,codeChallenge:o,scope:a})=>{let i=C(),l=encodeURIComponent(e.trim()),s=`${i}/v1/mcp/server/oauth/${l}/authorize`,c=new URLSearchParams({redirect_uri:r,state:n,response_type:"code",code_challenge:o,code_challenge_method:"S256"});return t&&t.trim().length>0&&c.set("client_id",t),a&&a.trim().length>0&&c.set("scope",a),`${s}?${c.toString()}`},ng=async({serverId:e,code:t,clientId:r,clientSecret:n,codeVerifier:o,redirectUri:a})=>{let i=C(),l=encodeURIComponent(e.trim()),s=`${i}/v1/mcp/server/oauth/${l}/token`,c=new URLSearchParams;c.set("grant_type","authorization_code"),c.set("code",t),r&&r.trim().length>0&&c.set("client_id",r),n&&n.trim().length>0&&c.set("client_secret",n),c.set("code_verifier",o),c.set("redirect_uri",a);let u=await fetch(s,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:c.toString()}),d=await u.json();if(!u.ok)throw Error(nx(d)||d?.detail||"OAuth token exchange failed");return d},nv=async(e,t,r)=>{try{let n=`${C()}/v1/vector_stores/${t}/search`,o=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({query:r})});if(!o.ok){let e=await o.text();return await j(e),null}return await o.json()}catch(e){throw console.error("Error testing vector store search:",e),e}},ny=async(e,t,r,n)=>{try{let o=`${C()}/v1/search/${t}`,a=await fetch(o,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({query:r,max_results:n||5})});if(!a.ok){let e=await a.text();return await j(e),null}return await a.json()}catch(e){throw console.error("Error querying search tool:",e),e}},nb=async(e,t,r,n)=>{try{let o,a,i,l=$?`${$}/tag/dau`:"/tag/dau",s=new URLSearchParams;s.append("end_date",(o=t.getFullYear(),a=String(t.getMonth()+1).padStart(2,"0"),i=String(t.getDate()).padStart(2,"0"),`${o}-${a}-${i}`)),n&&n.length>0?n.forEach(e=>{s.append("tag_filters",e)}):r&&s.append("tag_filter",r);let c=s.toString();c&&(l+=`?${c}`);let u=await fetch(l,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!u.ok){let e=await u.json(),t=nx(e);throw j(t),Error(t)}return await u.json()}catch(e){throw console.error("Failed to fetch DAU:",e),e}},nw=async(e,t,r,n)=>{try{let o,a,i,l=$?`${$}/tag/wau`:"/tag/wau",s=new URLSearchParams;s.append("end_date",(o=t.getFullYear(),a=String(t.getMonth()+1).padStart(2,"0"),i=String(t.getDate()).padStart(2,"0"),`${o}-${a}-${i}`)),n&&n.length>0?n.forEach(e=>{s.append("tag_filters",e)}):r&&s.append("tag_filter",r);let c=s.toString();c&&(l+=`?${c}`);let u=await fetch(l,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!u.ok){let e=await u.json(),t=nx(e);throw j(t),Error(t)}return await u.json()}catch(e){throw console.error("Failed to fetch WAU:",e),e}},n$=async(e,t,r,n)=>{try{let o,a,i,l=$?`${$}/tag/mau`:"/tag/mau",s=new URLSearchParams;s.append("end_date",(o=t.getFullYear(),a=String(t.getMonth()+1).padStart(2,"0"),i=String(t.getDate()).padStart(2,"0"),`${o}-${a}-${i}`)),n&&n.length>0?n.forEach(e=>{s.append("tag_filters",e)}):r&&s.append("tag_filter",r);let c=s.toString();c&&(l+=`?${c}`);let u=await fetch(l,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!u.ok){let e=await u.json(),t=nx(e);throw j(t),Error(t)}return await u.json()}catch(e){throw console.error("Failed to fetch MAU:",e),e}},nC=async e=>{try{let t=$?`${$}/tag/distinct`:"/tag/distinct",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nx(e);throw j(t),Error(t)}return await r.json()}catch(e){throw console.error("Failed to fetch distinct tags:",e),e}},nE=async(e,t,r,n)=>{try{let o=$?`${$}/tag/summary`:"/tag/summary",a=new URLSearchParams,i=e=>{let t=e.getFullYear(),r=String(e.getMonth()+1).padStart(2,"0"),n=String(e.getDate()).padStart(2,"0");return`${t}-${r}-${n}`};a.append("start_date",i(t)),a.append("end_date",i(r)),n&&n.length>0&&n.forEach(e=>{a.append("tag_filters",e)});let l=a.toString();l&&(o+=`?${l}`);let s=await fetch(o,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!s.ok){let e=await s.json(),t=nx(e);throw j(t),Error(t)}return await s.json()}catch(e){throw console.error("Failed to fetch user agent summary:",e),e}},nS=async(e,t=1,r=50,n)=>{try{let o=$?`${$}/tag/user-agent/per-user-analytics`:"/tag/user-agent/per-user-analytics",a=new URLSearchParams;a.append("page",t.toString()),a.append("page_size",r.toString()),n&&n.length>0&&n.forEach(e=>{a.append("tag_filters",e)});let i=a.toString();i&&(o+=`?${i}`);let l=await fetch(o,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!l.ok){let e=await l.json(),t=nx(e);throw j(t),Error(t)}return await l.json()}catch(e){throw console.error("Failed to fetch per-user analytics:",e),e}},nx=e=>{let t=e?.detail,r=Array.isArray(t)?t.map(e=>e?.msg||JSON.stringify(e)).join("; "):"string"==typeof t?t:void 0;return e?.error&&(e.error.message||("string"==typeof e.error?e.error:void 0))||e?.message||r||JSON.stringify(e)},nj=async(e,t)=>{let r=C(),n=r?`${r}/v2/login`:"/v2/login",o=JSON.stringify({username:e,password:t}),a=await fetch(n,{method:"POST",body:o,credentials:"include",headers:{"Content-Type":"application/json"}});if(!a.ok)throw Error(nx(await a.json()));return await a.json()},nO=async()=>{let e=C(),t=e?`${e}/get/ui_settings`:"/get/ui_settings",r=await fetch(t,{method:"GET"});if(!r.ok)throw Error(nx(await r.json()));return await r.json()},nk=async(e,t)=>{let r=C(),n=r?`${r}/update/ui_settings`:"/update/ui_settings",o=await fetch(n,{method:"PATCH",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!o.ok)throw Error(nx(await o.json()));return await o.json()},nT=async()=>{try{let e=C(),t=e?`${e}/claude-code/marketplace.json`:"/claude-code/marketplace.json",r=await fetch(t,{method:"GET",headers:{"Content-Type":"application/json"}});if(!r.ok){let e=await r.text(),t=nx(JSON.parse(e));throw j(t),Error(t)}return await r.json()}catch(e){throw console.error("Failed to fetch Claude Code marketplace:",e),e}},nF=async(e,t=!1)=>{try{let r=C(),n=r?`${r}/claude-code/plugins?enabled_only=${t}`:`/claude-code/plugins?enabled_only=${t}`,o=await fetch(n,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!o.ok){let e=await o.text(),t=nx(JSON.parse(e));throw j(t),Error(t)}return await o.json()}catch(e){throw console.error("Failed to fetch Claude Code plugins list:",e),e}},n_=async(e,t)=>{try{let r=C(),n=r?`${r}/claude-code/plugins/${t}`:`/claude-code/plugins/${t}`,o=await fetch(n,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!o.ok){let e=await o.text(),t=nx(JSON.parse(e));throw j(t),Error(t)}return await o.json()}catch(e){throw console.error(`Failed to fetch plugin "${t}":`,e),e}},nI=async(e,t)=>{try{let r=C(),n=r?`${r}/claude-code/plugins`:"/claude-code/plugins",o=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!o.ok){let e=await o.text(),t=nx(JSON.parse(e));throw j(t),Error(t)}return await o.json()}catch(e){throw console.error("Failed to register Claude Code plugin:",e),e}},nP=async(e,t)=>{try{let r=C(),n=r?`${r}/claude-code/plugins/${t}/enable`:`/claude-code/plugins/${t}/enable`,o=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!o.ok){let e=await o.text(),t=nx(JSON.parse(e));throw j(t),Error(t)}return await o.json()}catch(e){throw console.error(`Failed to enable plugin "${t}":`,e),e}},nN=async(e,t)=>{try{let r=C(),n=r?`${r}/claude-code/plugins/${t}/disable`:`/claude-code/plugins/${t}/disable`,o=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!o.ok){let e=await o.text(),t=nx(JSON.parse(e));throw j(t),Error(t)}return await o.json()}catch(e){throw console.error(`Failed to disable plugin "${t}":`,e),e}},nR=async(e,t)=>{try{let r=C(),n=r?`${r}/claude-code/plugins/${t}`:`/claude-code/plugins/${t}`,o=await fetch(n,{method:"DELETE",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!o.ok){let e=await o.text(),t=nx(JSON.parse(e));throw j(t),Error(t)}return await o.json()}catch(e){throw console.error(`Failed to delete plugin "${t}":`,e),e}},nM=async(e,t)=>{let r=$?`${$}/compliance/eu-ai-act`:"/compliance/eu-ai-act",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok)throw Error(await n.text());return n.json()},nB=async(e,t)=>{let r=$?`${$}/compliance/gdpr`:"/compliance/gdpr",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok)throw Error(await n.text());return n.json()},nA=async e=>{let t=$?`${$}/v1/tool/policy/options`:"/v1/tool/policy/options",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok)throw Error(await r.text());return r.json()},nz=async e=>{let t=$?`${$}/v1/tool/list`:"/v1/tool/list",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok)throw Error(await r.text());return(await r.json()).tools??[]},nL=async(e,t,r)=>{let n=encodeURIComponent(t),o=$?`${$}/v1/tool/${n}/logs`:`/v1/tool/${n}/logs`,a=new URLSearchParams;null!=r.page&&a.append("page",String(r.page)),null!=r.pageSize&&a.append("page_size",String(r.pageSize)),r.startDate&&a.append("start_date",r.startDate),r.endDate&&a.append("end_date",r.endDate);let i=a.toString()?`${o}?${a.toString()}`:o,l=await fetch(i,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!l.ok)throw Error(nx(await l.json().catch(()=>({}))));return l.json()},nH=async(e,t)=>{let r=encodeURIComponent(t),n=$?`${$}/v1/tool/${r}/detail`:`/v1/tool/${r}/detail`,o=await fetch(n,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!o.ok)throw Error(await o.text());return o.json()},nD=async(e,t,r,n)=>{let o=$?`${$}/v1/tool/policy`:"/v1/tool/policy",a={tool_name:t};null!=r.input_policy&&(a.input_policy=r.input_policy),null!=r.output_policy&&(a.output_policy=r.output_policy),n?.team_id!=null&&(a.team_id=n.team_id||void 0),n?.key_hash!=null&&(a.key_hash=n.key_hash||void 0),n?.key_alias!=null&&(a.key_alias=n.key_alias||void 0);let i=await fetch(o,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(a)});if(!i.ok)throw Error(await i.text());return i.json()},nV=async(e,t,r)=>{let n=encodeURIComponent(t),o=new URLSearchParams;null!=r.team_id&&""!==r.team_id&&o.set("team_id",r.team_id),null!=r.key_hash&&""!==r.key_hash&&o.set("key_hash",r.key_hash);let a=o.toString(),i=$?`${$}/v1/tool/${n}/overrides${a?`?${a}`:""}`:`/v1/tool/${n}/overrides${a?`?${a}`:""}`,l=await fetch(i,{method:"DELETE",headers:{[T]:`Bearer ${e}`}});if(!l.ok)throw Error(await l.text());return l.json()},nW=async(e,t,r)=>{let n=$?`${$}/v1/mcp/server/${t}/oauth-user-credential`:`/v1/mcp/server/${t}/oauth-user-credential`,o=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(r)});if(!o.ok){let e=await o.json().catch(()=>({})),t=e?.detail;throw Error((Array.isArray(t)?t.map(e=>e&&"object"==typeof e?e.msg??JSON.stringify(e):String(e)).join("; "):"string"==typeof t?t:t&&"string"==typeof t.error?t.error:void 0)||"Failed to store OAuth credential")}return o.json()},nG=async(e,t)=>{let r=$?`${$}/v1/mcp/server/${t}/oauth-user-credential`:`/v1/mcp/server/${t}/oauth-user-credential`,n=await fetch(r,{method:"DELETE",headers:{[T]:`Bearer ${e}`}});if(!n.ok){let e=await n.json().catch(()=>({})),t=e?.detail;throw Error((Array.isArray(t)?t.map(e=>e&&"object"==typeof e?e.msg??JSON.stringify(e):String(e)).join("; "):"string"==typeof t?t:t&&"string"==typeof t.error?t.error:void 0)||"Failed to revoke OAuth credential")}return n.json()},nU=async(e,t)=>{let r=$?`${$}/v1/mcp/server/${t}/oauth-user-credential/status`:`/v1/mcp/server/${t}/oauth-user-credential/status`,n=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`}});return n.ok?n.json():{server_id:t,has_credential:!1,is_expired:!1}},nq=async e=>{let t=$?`${$}/v1/mcp/user-credentials`:"/v1/mcp/user-credentials",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`}});return r.ok?r.json():[]}}]); \ No newline at end of file +Allowed values: ${t.enum.join(", ")}`:S)}),children:r},e)})}):null};var g=e.i(727749);let v=e=>{let t=e.getFullYear(),r=String(e.getMonth()+1).padStart(2,"0"),n=String(e.getDate()).padStart(2,"0");return`${t}-${r}-${n}`},y=async e=>{try{let t=$?`${$}/callbacks/configs`:"/callbacks/configs",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nj(e);throw j(t),Error(t)}return await r.json()}catch(e){throw console.error("Failed to get callbacks:",e),e}},b=async e=>{try{let t=$?`${$}/in_product_nudges`:"/in_product_nudges",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nj(e);throw j(t),Error(t)}return await r.json()}catch(e){throw console.error("Failed to get in-product nudges:",e),e}},w="/",$=null;console.log=function(){};let C=()=>{if($)return $;let e=window.location;return e?.origin??""},E="POST",S="DELETE",x=0,j=async e=>{let t=Date.now();if(t-x>6e4){if(("string"==typeof e?e:JSON.stringify(e)).includes("Authentication Error - Expired Key")){g.default.info("UI Session Expired. Logging out."),x=t,(0,r.clearTokenCookies)();let e=window.location;e&&(window.location.href=e.pathname)}x=t}else console.log("Error suppressed to prevent spam:",e)},O=async()=>{let e=$?`${$}/public/providers/fields`:"/public/providers/fields",t=await fetch(e,{method:"GET"});if(!t.ok){let e=await t.text();throw console.error("Failed to fetch provider create metadata:",t.status,e),Error("Failed to load provider configuration")}return await t.json()},k=async()=>{let e=$?`${$}/public/agents/fields`:"/public/agents/fields",t=await fetch(e,{method:"GET"});if(!t.ok){let e=await t.text();throw console.error("Failed to fetch agent create metadata:",t.status,e),Error("Failed to load agent configuration")}return await t.json()},T="Authorization";function F(e="Authorization"){console.log(`setGlobalLitellmHeaderName: ${e}`),T=e}function _(){return T}let I=async(e,t)=>{let r=$?`${$}/model_group/make_public`:"/model_group/make_public";return(await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({model_groups:t})})).json()},P=async()=>{console.log("Getting UI config");let e=await fetch("/litellm/.well-known/litellm-ui-config"),t=await e.json();return console.log("jsonData in getUiConfig:",t),((e,t=null)=>{let r=window.location,n=r?.origin??null,o=t||n;if(console.log("proxyBaseUrl:",$),console.log("serverRootPath:",e),!o)return console.log("Updated proxyBaseUrl:",$=$??null);e.length>0&&!o.endsWith(e)&&"/"!=e&&(o+=e),console.log("Updated proxyBaseUrl:",$=o)})(t.server_root_path,t.proxy_base_url),t},N=async()=>{let e=$?`${$}/public/model_hub/info`:"/public/model_hub/info",t=await fetch(e);return await t.json()},R=async()=>{let e=$?`${$}/openapi.json`:"/openapi.json",t=await fetch(e);return await t.json()},M=async()=>{try{let e=$?`${$}/public/litellm_model_cost_map`:"/public/litellm_model_cost_map",t=await fetch(e,{method:"GET",headers:{"Content-Type":"application/json"}}),r=await t.json();return console.log(`received litellm model cost data: ${r}`),r}catch(e){throw console.error("Failed to get model cost map:",e),e}},B=async e=>{try{let t=$?`${$}/reload/model_cost_map`:"/reload/model_cost_map",r=await fetch(t,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}}),n=await r.json();return console.log(`Model cost map reload response: ${n}`),n}catch(e){throw console.error("Failed to reload model cost map:",e),e}},A=async(e,t)=>{try{let r=$?`${$}/schedule/model_cost_map_reload?hours=${t}`:`/schedule/model_cost_map_reload?hours=${t}`,n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}}),o=await n.json();return console.log(`Schedule model cost map reload response: ${o}`),o}catch(e){throw console.error("Failed to schedule model cost map reload:",e),e}},z=async e=>{try{let t=$?`${$}/schedule/model_cost_map_reload`:"/schedule/model_cost_map_reload",r=await fetch(t,{method:"DELETE",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}}),n=await r.json();return console.log(`Cancel model cost map reload response: ${n}`),n}catch(e){throw console.error("Failed to cancel model cost map reload:",e),e}},L=async e=>{try{let t=$?`${$}/model/cost_map/source`:"/model/cost_map/source",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.text();throw Error(`HTTP ${r.status}: ${e}`)}let n=await r.json();return console.log("Model cost map source info:",n),n}catch(e){throw console.error("Failed to get model cost map source info:",e),e}},H=async e=>{try{let t=$?`${$}/schedule/model_cost_map_reload/status`:"/schedule/model_cost_map_reload/status";console.log("Fetching status from URL:",t);let r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){console.error(`Status request failed with status: ${r.status}`);let e=await r.text();throw console.error("Error response:",e),Error(`HTTP ${r.status}: ${e}`)}let n=await r.json();return console.log("Model cost map reload status:",n),n}catch(e){throw console.error("Failed to get model cost map reload status:",e),e}},D=async(e,r)=>{try{let n=$?`${$}/model/new`:"/model/new",o=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({...r})});if(!o.ok){let e=await o.json(),t=nj(e);throw j(t),Error(t)}let a=await o.json();return console.log("API Response:",a),t.message.destroy(),g.default.success(`Model ${r.model_name} created successfully`),a}catch(e){throw console.error("Failed to create key:",e),e}},V=async(e,t)=>{console.log(`model_id in model delete call: ${t}`);try{let r=$?`${$}/model/delete`:"/model/delete",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({id:t})});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}let o=await n.json();return console.log("API Response:",o),o}catch(e){throw console.error("Failed to create key:",e),e}},W=async(e,t)=>{if(console.log(`budget_id in budget delete call: ${t}`),null!=e)try{let r=$?`${$}/budget/delete`:"/budget/delete",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({id:t})});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}let o=await n.json();return console.log("API Response:",o),o}catch(e){throw console.error("Failed to create key:",e),e}},G=async(e,t)=>{try{console.log("Form Values in budgetCreateCall:",t),console.log("Form Values after check:",t);let r=$?`${$}/budget/new`:"/budget/new",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({...t})});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}let o=await n.json();return console.log("API Response:",o),o}catch(e){throw console.error("Failed to create key:",e),e}},U=async(e,t)=>{try{console.log("Form Values in budgetUpdateCall:",t),console.log("Form Values after check:",t);let r=$?`${$}/budget/update`:"/budget/update",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({...t})});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}let o=await n.json();return console.log("API Response:",o),o}catch(e){throw console.error("Failed to create key:",e),e}},q=async(e,t)=>{try{let r=$?`${$}/invitation/new`:"/invitation/new",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({user_id:t})});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}let o=await n.json();return console.log("API Response:",o),o}catch(e){throw console.error("Failed to create key:",e),e}},J=async e=>{try{let t=$?`${$}/alerting/settings`:"/alerting/settings",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nj(e);throw j(t),Error(t)}return await r.json()}catch(e){throw console.error("Failed to get callbacks:",e),e}},K=async(e,t)=>{try{for(let e of(console.log("Form Values in keyCreateServiceAccountCall:",t),t.description&&(t.metadata||(t.metadata={}),t.metadata.description=t.description,delete t.description,t.metadata=JSON.stringify(t.metadata)),p))if(t[e]){console.log(`formValues.${e}:`,t[e]);try{t[e]=JSON.parse(t[e])}catch(t){throw Error(`Failed to parse ${e}: `+t)}}console.log("Form Values after check:",t);let r=$?`${$}/key/service-account/generate`:"/key/service-account/generate",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({...t})});if(!n.ok){let e=await n.text();throw j(e),console.error("Error response from the server:",e),Error(e)}let o=await n.json();return console.log("API Response:",o),o}catch(e){throw console.error("Failed to create key:",e),e}},X=async(e,t,r)=>{try{for(let e of(console.log("Form Values in keyCreateCall:",r),r.description&&(r.metadata||(r.metadata={}),r.metadata.description=r.description,delete r.description,r.metadata=JSON.stringify(r.metadata)),p))if(r[e]){console.log(`formValues.${e}:`,r[e]);try{r[e]=JSON.parse(r[e])}catch(t){throw Error(`Failed to parse ${e}: `+t)}}console.log("Form Values after check:",r);let n=$?`${$}/key/generate`:"/key/generate",o=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({user_id:t,...r})});if(!o.ok){let e=await o.text();throw j(e),console.error("Error response from the server:",e),Error(e)}let a=await o.json();return console.log("API Response:",a),a}catch(e){throw console.error("Failed to create key:",e),e}},Y=async(e,t,r,n,o,a)=>{let i=$?`${$}/key/generate`:"/key/generate",l={agent_id:t,key_alias:r,models:n.length>0?n:[]};a&&(l.team_id=a),o&&Object.keys(o).length>0&&(l.metadata=o);let s=await fetch(i,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(l)});if(!s.ok)throw j(await s.text()),Error("Failed to create key for agent");return s.json()},Z=async(e,t,r)=>{try{if(console.log("Form Values in keyCreateCall:",r),r.description&&(r.metadata||(r.metadata={}),r.metadata.description=r.description,delete r.description,r.metadata=JSON.stringify(r.metadata)),r.auto_create_key=!1,r.metadata){console.log("formValues.metadata:",r.metadata);try{r.metadata=JSON.parse(r.metadata)}catch(e){throw Error("Failed to parse metadata: "+e)}}console.log("Form Values after check:",r);let n=$?`${$}/user/new`:"/user/new",o=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({user_id:t,...r})});if(!o.ok){let e=await o.text();throw j(e),console.error("Error response from the server:",e),Error(e)}let a=await o.json();return console.log("API Response:",a),a}catch(e){throw console.error("Failed to create key:",e),e}},Q=async(e,t)=>{try{let r=$?`${$}/key/delete`:"/key/delete";console.log("in keyDeleteCall:",t);let n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({keys:[t]})});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}let o=await n.json();return console.log(o),o}catch(e){throw console.error("Failed to create key:",e),e}},ee=async(e,t)=>{try{let r=$?`${$}/user/delete`:"/user/delete";console.log("in userDeleteCall:",t);let n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({user_ids:t})});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}let o=await n.json();return console.log(o),o}catch(e){throw console.error("Failed to delete user(s):",e),e}},et=async(e,t)=>{try{let r=$?`${$}/team/delete`:"/team/delete";console.log("in teamDeleteCall:",t);let n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({team_ids:[t]})});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}let o=await n.json();return console.log(o),o}catch(e){throw console.error("Failed to delete key:",e),e}},er=async(e,t=null,r=null,n=null,o=null,a=null,i=null,l=null,s=null,c=null,u=null)=>{try{let d=$?`${$}/user/list`:"/user/list";console.log("in userListCall");let f=new URLSearchParams;if(t&&t.length>0){let e=t.join(",");f.append("user_ids",e)}r&&f.append("page",r.toString()),n&&f.append("page_size",n.toString()),o&&f.append("user_email",o),a&&f.append("role",a),i&&f.append("team",i),l&&f.append("sso_user_ids",l),s&&f.append("sort_by",s),c&&f.append("sort_order",c),u&&u.length>0&&f.append("organization_ids",u.join(","));let p=f.toString();p&&(d+=`?${p}`);let m=await fetch(d,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!m.ok){let e=await m.json(),t=nj(e);throw j(t),Error(t)}let h=await m.json();return console.log("/user/list API Response:",h),h}catch(e){throw console.error("Failed to create key:",e),e}},en=async(e,t)=>{try{let r=$?`${$}/v2/user/info`:"/v2/user/info";t&&(r+=`?user_id=${encodeURIComponent(t)}`);let n=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to fetch user info v2:",e),e}},eo=async(e,t,r,n=!1,o,a,i=!1)=>{console.log(`userInfoCall: ${t}, ${r}, ${n}, ${o}, ${a}, ${i}`);try{let l;if(n){l=$?`${$}/user/list`:"/user/list";let e=new URLSearchParams;null!=o&&e.append("page",o.toString()),null!=a&&e.append("page_size",a.toString()),l+=`?${e.toString()}`}else l=$?`${$}/user/info`:"/user/info",("Admin"!==r&&"Admin Viewer"!==r||i)&&t&&(l+=`?user_id=${t}`);console.log("Requesting user data from:",l);let s=await fetch(l,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!s.ok){let e=await s.json(),t=nj(e);throw j(t),Error(t)}let c=await s.json();return console.log("API Response:",c),c}catch(e){throw console.error("Failed to fetch user data:",e),e}},ea=async(e,t)=>{try{let r=$?`${$}/team/info`:"/team/info";t&&(r=`${r}?team_id=${t}`),console.log("in teamInfoCall");let n=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}let o=await n.json();return console.log("API Response:",o),o}catch(e){throw console.error("Failed to create key:",e),e}},ei=async(e,t,r=null,n=null,o=null,a=1,i=10,l=null,s=null)=>{try{let a=$?`${$}/v2/team/list`:"/v2/team/list";console.log("in teamInfoCall");let i=new URLSearchParams;r&&i.append("user_id",r.toString()),t&&i.append("organization_id",t.toString()),n&&i.append("team_id",n.toString()),o&&i.append("team_alias",o.toString());let l=i.toString();l&&(a+=`?${l}`);let s=await fetch(a,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!s.ok){let e=await s.json(),t=nj(e);throw j(t),Error(t)}let c=await s.json();return console.log("/v2/team/list API Response:",c),c}catch(e){throw console.error("Failed to create key:",e),e}},el=async(e,t,r=null,n=null,o=null)=>{try{let a=$?`${$}/team/list`:"/team/list";console.log("in teamInfoCall");let i=new URLSearchParams;r&&i.append("user_id",r.toString()),t&&i.append("organization_id",t.toString()),n&&i.append("team_id",n.toString()),o&&i.append("team_alias",o.toString());let l=i.toString();l&&(a+=`?${l}`);let s=await fetch(a,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!s.ok){let e=await s.json(),t=nj(e);throw j(t),Error(t)}let c=await s.json();return console.log("/team/list API Response:",c),c}catch(e){throw console.error("Failed to create key:",e),e}},es=async e=>{try{let t=$?`${$}/team/available`:"/team/available";console.log("in availableTeamListCall");let r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nj(e);throw j(t),Error(t)}let n=await r.json();return console.log("/team/available_teams API Response:",n),n}catch(e){throw e}},ec=async(e,t=null,r=null)=>{try{let n=$?`${$}/organization/list`:"/organization/list",o=new URLSearchParams;t&&o.append("org_id",t.toString()),r&&o.append("org_alias",r.toString());let a=o.toString();a&&(n+=`?${a}`);let i=await fetch(n,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!i.ok){let e=await i.json(),t=nj(e);throw j(t),Error(t)}return await i.json()}catch(e){throw console.error("Failed to create key:",e),e}},eu=async(e,t)=>{try{let r=$?`${$}/organization/info`:"/organization/info";t&&(r=`${r}?organization_id=${t}`),console.log("in teamInfoCall");let n=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}let o=await n.json();return console.log("API Response:",o),o}catch(e){throw console.error("Failed to create key:",e),e}},ed=async(e,t)=>{try{if(console.log("Form Values in organizationCreateCall:",t),t.metadata){console.log("formValues.metadata:",t.metadata);try{t.metadata=JSON.parse(t.metadata)}catch(e){throw console.error("Failed to parse metadata:",e),Error("Failed to parse metadata: "+e)}}let r=$?`${$}/organization/new`:"/organization/new",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({...t})});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}let o=await n.json();return console.log("API Response:",o),o}catch(e){throw console.error("Failed to create key:",e),e}},ef=async(e,t)=>{try{console.log("Form Values in organizationUpdateCall:",t);let r=$?`${$}/organization/update`:"/organization/update",n=await fetch(r,{method:"PATCH",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({...t})});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}let o=await n.json();return console.log("Update Team Response:",o),o}catch(e){throw console.error("Failed to create key:",e),e}},ep=async(e,t)=>{try{let r=$?`${$}/organization/delete`:"/organization/delete",n=await fetch(r,{method:"DELETE",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({organization_ids:[t]})});if(!n.ok){let e=await n.text();throw j(e),Error(`Error deleting organization: ${e}`)}return await n.json()}catch(e){throw console.error("Failed to delete organization:",e),e}},em=async(e,t)=>{try{let r=$?`${$}/utils/transform_request`:"/utils/transform_request",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to create key:",e),e}},eh=async({accessToken:e,endpoint:t,startTime:r,endTime:n,page:o=1,extraQueryParams:a})=>{try{let i,l,s,c,u=(i=t.startsWith("/")?t:`/${t}`,l=$?`${$}${i}`:i,(s=new URLSearchParams).append("start_date",v(r)),s.append("end_date",v(n)),s.append("page_size","1000"),s.append("page",o.toString()),s.append("timezone",new Date().getTimezoneOffset().toString()),a&&Object.entries(a).forEach(([e,t])=>{((e,t,r)=>{if(null!=r){if(Array.isArray(r)){r.length>0&&e.append(t,r.join(","));return}e.append(t,`${r}`)}})(s,e,t)}),(c=s.toString())?`${l}?${c}`:l),d=await fetch(u,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!d.ok){let e=await d.json(),t=nj(e);throw j(t),Error(t)}return await d.json()}catch(e){throw console.error(`Failed to fetch daily activity (${t}):`,e),e}},eg=async(e,t,r,n=1,o=null)=>eh({accessToken:e,endpoint:"/user/daily/activity",startTime:t,endTime:r,page:n,extraQueryParams:{user_id:o}}),ev=async(e,t,r,n=1,o=null)=>eh({accessToken:e,endpoint:"/tag/daily/activity",startTime:t,endTime:r,page:n,extraQueryParams:{tags:o}}),ey=async(e,t,r,n=1,o=null)=>eh({accessToken:e,endpoint:"/team/daily/activity",startTime:t,endTime:r,page:n,extraQueryParams:{team_ids:o,exclude_team_ids:"litellm-dashboard"}}),eb=async(e,t,r,n=1,o=null)=>eh({accessToken:e,endpoint:"/organization/daily/activity",startTime:t,endTime:r,page:n,extraQueryParams:{organization_ids:o}}),ew=async(e,t,r,n=1,o=null)=>eh({accessToken:e,endpoint:"/customer/daily/activity",startTime:t,endTime:r,page:n,extraQueryParams:{end_user_ids:o}}),e$=async(e,t,r,n=1,o=null)=>eh({accessToken:e,endpoint:"/agent/daily/activity",startTime:t,endTime:r,page:n,extraQueryParams:{agent_ids:o}}),eC=async e=>{try{let t=$?`${$}/onboarding/get_token`:"/onboarding/get_token";t+=`?invite_link=${e}`;let r=await fetch(t,{method:"GET",headers:{"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nj(e);throw j(t),Error(t)}return await r.json()}catch(e){throw console.error("Failed to create key:",e),e}},eE=async(e,t,r,n)=>{let o=$?`${$}/onboarding/claim_token`:"/onboarding/claim_token";try{let a=await fetch(o,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({invitation_link:t,user_id:r,password:n})});if(!a.ok){let e=await a.json(),t=nj(e);throw j(t),Error(t)}let i=await a.json();return console.log(i),i}catch(e){throw console.error("Failed to delete key:",e),e}},eS=async(e,t,r)=>{try{let n=$?`${$}/key/${t}/regenerate`:`/key/${t}/regenerate`,o=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(r)});if(!o.ok){let e=await o.json(),t=nj(e);throw j(t),Error(t)}let a=await o.json();return console.log("Regenerate key Response:",a),a}catch(e){throw console.error("Failed to regenerate key:",e),e}},ex=!1,ej=null,eO=async(e,t,r,n=1,o=50,a,i,l,s,c)=>{try{console.log("modelInfoCall:",e,t,r,n,o,a,i,l,s,c);let u=$?`${$}/v2/model/info`:"/v2/model/info",d=new URLSearchParams;d.append("include_team_models","true"),d.append("page",n.toString()),d.append("size",o.toString()),a&&a.trim()&&d.append("search",a.trim()),i&&i.trim()&&d.append("modelId",i.trim()),l&&l.trim()&&d.append("teamId",l.trim()),s&&s.trim()&&d.append("sortBy",s.trim()),c&&c.trim()&&d.append("sortOrder",c.trim()),d.toString()&&(u+=`?${d.toString()}`);let f=await fetch(u,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!f.ok){let e=await f.text();throw e+=`error shown=${ex}`,ex||(e.includes("No model list passed")&&(e="No Models Exist. Click Add Model to get started."),g.default.info(e),ex=!0,ej&&clearTimeout(ej),ej=setTimeout(()=>{ex=!1},1e4)),Error("Network response was not ok")}let p=await f.json();return console.log("modelInfoCall:",p),p}catch(e){throw console.error("Failed to create key:",e),e}},ek=async(e,t)=>{try{let r=$?`${$}/v1/model/info`:"/v1/model/info";r+=`?litellm_model_id=${t}`;let n=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}let o=await n.json();return console.log("modelInfoV1Call:",o),o}catch(e){throw console.error("Failed to create key:",e),e}},eT=async()=>{let e=$?`${$}/public/model_hub`:"/public/model_hub",t=await fetch(e,{method:"GET",headers:{"Content-Type":"application/json"}});return t.ok?t.json():(console.error(`modelHubPublicModelsCall failed with status ${t.status}`),[])},eF=async()=>{let e=$?`${$}/public/agent_hub`:"/public/agent_hub",t=await fetch(e,{method:"GET",headers:{"Content-Type":"application/json"}});return t.ok?t.json():(console.error(`agentHubPublicModelsCall failed with status ${t.status}`),[])},e_=async()=>{let e=$?`${$}/public/mcp_hub`:"/public/mcp_hub",t=await fetch(e,{method:"GET",headers:{"Content-Type":"application/json"}});return t.ok?t.json():(console.error(`mcpHubPublicServersCall failed with status ${t.status}`),[])},eI=async e=>{try{let t=$?`${$}/model_group/info`:"/model_group/info",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nj(e);throw j(t),Error(t)}let n=await r.json();return console.log("modelHubCall:",n),n}catch(e){throw console.error("Failed to create key:",e),e}},eP=async e=>{try{let t=$?`${$}/get/allowed_ips`:"/get/allowed_ips",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nj(e);throw j(t),Error(t)}let n=await r.json();return console.log("getAllowedIPs:",n),n.data}catch(e){throw console.error("Failed to get allowed IPs:",e),e}},eN=async(e,t)=>{try{let r=$?`${$}/add/allowed_ip`:"/add/allowed_ip",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({ip:t})});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}let o=await n.json();return console.log("addAllowedIP:",o),o}catch(e){throw console.error("Failed to add allowed IP:",e),e}},eR=async(e,t)=>{try{let r=$?`${$}/delete/allowed_ip`:"/delete/allowed_ip",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({ip:t})});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}let o=await n.json();return console.log("deleteAllowedIP:",o),o}catch(e){throw console.error("Failed to delete allowed IP:",e),e}},eM=async(e,t)=>{try{let r=$?`${$}/model_hub/update_useful_links`:"/model_hub/update_useful_links",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({useful_links:t})});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to create key:",e),e}},eB=async(e,t,r,n=!1,o=null,a=!1,i=!1,l)=>{console.log("in /models calls, globalLitellmHeaderName",T);try{let t=$?`${$}/models`:"/models",r=new URLSearchParams;r.append("include_model_access_groups","True"),!0===n&&r.append("return_wildcard_routes","True"),!0===i&&r.append("only_model_access_groups","True"),o&&r.append("team_id",o.toString()),l&&r.append("scope",l),r.toString()&&(t+=`?${r.toString()}`);let a=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!a.ok){let e=await a.json(),t=nj(e);throw j(t),Error(t)}return await a.json()}catch(e){throw console.error("Failed to create key:",e),e}},eA=async e=>{try{let t=$?`${$}/global/spend/teams`:"/global/spend/teams";console.log("in teamSpendLogsCall:",t);let r=await fetch(`${t}`,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nj(e);throw j(t),Error(t)}let n=await r.json();return console.log(n),n}catch(e){throw console.error("Failed to create key:",e),e}},ez=async(e,t,r,n)=>{try{let o=$?`${$}/global/spend/tags`:"/global/spend/tags";t&&r&&(o=`${o}?start_date=${t}&end_date=${r}`),n&&(o+=`&tags=${n.join(",")}`),console.log("in tagsSpendLogsCall:",o);let a=await fetch(`${o}`,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!a.ok){let e=await a.json(),t=nj(e);throw j(t),Error(t)}let i=await a.json();return console.log(i),i}catch(e){throw console.error("Failed to create key:",e),e}},eL=async e=>{try{let t=$?`${$}/global/spend/all_tag_names`:"/global/spend/all_tag_names";console.log("in global/spend/all_tag_names call",t);let r=await fetch(`${t}`,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nj(e);throw j(t),Error(t)}let n=await r.json();return console.log(n),n}catch(e){throw console.error("Failed to create key:",e),e}},eH=async e=>{try{let t=$?`${$}/customer/list`:"/customer/list";console.log("in customer/list",t);let r=await fetch(`${t}`,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nj(e);throw j(t),Error(t)}let n=await r.json();return console.log(n),n}catch(e){throw console.error("Failed to fetch end users:",e),e}},eD=async(e,t)=>{try{let r=$?`${$}/user/filter/ui`:"/user/filter/ui",n=new URLSearchParams;t.get("user_email")&&n.append("user_email",t.get("user_email")),t.get("user_id")&&n.append("user_id",t.get("user_id")),t.get("team_id")&&n.append("team_id",t.get("team_id"));let o=n.toString(),a=o?`${r}?${o}`:r,i=await fetch(a,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!i.ok){let e=await i.json(),t=nj(e);throw j(t),Error(t)}return await i.json()}catch(e){throw console.error("Failed to create key:",e),e}},eV=async({accessToken:e,start_date:t,end_date:r,page:n=1,page_size:o=50,params:a={}})=>{try{let i=$?`${$}/spend/logs/ui`:"/spend/logs/ui",l=new URLSearchParams;for(let[e,i]of(l.append("start_date",t),l.append("end_date",r),l.append("page",n.toString()),l.append("page_size",o.toString()),Object.entries(a)))null!=i&&("min_spend"===e||"max_spend"===e?l.append(e,i.toString()):"string"==typeof i&&""!==i&&l.append(e,String(i)));let s=l.toString();s&&(i+=`?${s}`);let c=await fetch(i,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!c.ok){let e=await c.json(),t=nj(e);throw j(t),Error(t)}let u=await c.json();return console.log("Spend Logs Response:",u),u}catch(e){throw console.error("Failed to fetch spend logs:",e),e}},eW=async e=>{try{let t=$?`${$}/global/spend/logs`:"/global/spend/logs",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nj(e);throw j(t),Error(t)}let n=await r.json();return console.log(n),n}catch(e){throw console.error("Failed to create key:",e),e}},eG=async e=>{try{let t=$?`${$}/global/spend/keys?limit=5`:"/global/spend/keys?limit=5",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nj(e);throw j(t),Error(t)}let n=await r.json();return console.log(n),n}catch(e){throw console.error("Failed to create key:",e),e}},eU=async(e,t,r,n)=>{try{let o=$?`${$}/global/spend/end_users`:"/global/spend/end_users",a="";a=t?JSON.stringify({api_key:t,startTime:r,endTime:n}):JSON.stringify({startTime:r,endTime:n});let i={method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:a},l=await fetch(o,i);if(!l.ok){let e=await l.json(),t=nj(e);throw j(t),Error(t)}let s=await l.json();return console.log(s),s}catch(e){throw console.error("Failed to create key:",e),e}},eq=async(e,t,r,n)=>{try{let o=$?`${$}/global/spend/provider`:"/global/spend/provider";r&&n&&(o+=`?start_date=${r}&end_date=${n}`),t&&(o+=`&api_key=${t}`);let a={method:"GET",headers:{[T]:`Bearer ${e}`}},i=await fetch(o,a);if(!i.ok){let e=await i.json(),t=nj(e);throw j(t),Error(t)}let l=await i.json();return console.log(l),l}catch(e){throw console.error("Failed to fetch spend data:",e),e}},eJ=async(e,t,r)=>{try{let n=$?`${$}/global/activity`:"/global/activity";t&&r&&(n+=`?start_date=${t}&end_date=${r}`);let o={method:"GET",headers:{[T]:`Bearer ${e}`}},a=await fetch(n,o);if(!a.ok){let e=await a.json(),t=nj(e);throw j(t),Error(t)}let i=await a.json();return console.log(i),i}catch(e){throw console.error("Failed to fetch spend data:",e),e}},eK=async(e,t,r)=>{try{let n=$?`${$}/global/activity/cache_hits`:"/global/activity/cache_hits";t&&r&&(n+=`?start_date=${t}&end_date=${r}`);let o={method:"GET",headers:{[T]:`Bearer ${e}`}},a=await fetch(n,o);if(!a.ok){let e=await a.json(),t=nj(e);throw j(t),Error(t)}let i=await a.json();return console.log(i),i}catch(e){throw console.error("Failed to fetch spend data:",e),e}},eX=async(e,t,r)=>{try{let n=$?`${$}/global/activity/model`:"/global/activity/model";t&&r&&(n+=`?start_date=${t}&end_date=${r}`);let o={method:"GET",headers:{[T]:`Bearer ${e}`}},a=await fetch(n,o);if(!a.ok){let e=await a.json(),t=nj(e);throw j(t),Error(t)}let i=await a.json();return console.log(i),i}catch(e){throw console.error("Failed to fetch spend data:",e),e}},eY=async e=>{try{let t=$?`${$}/global/spend/models?limit=5`:"/global/spend/models?limit=5",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nj(e);throw j(t),Error(t)}let n=await r.json();return console.log(n),n}catch(e){throw console.error("Failed to create key:",e),e}},eZ=async(e,t)=>{try{let r=$?`${$}/v2/key/info`:"/v2/key/info",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({keys:t})});if(!n.ok){let e=await n.text();if(e.includes("Invalid proxy server token passed"))throw Error("Invalid proxy server token passed");throw j(e),Error("Network response was not ok")}let o=await n.json();return console.log(o),o}catch(e){throw console.error("Failed to create key:",e),e}},eQ=async(e,t,r,n)=>{try{console.log("Sending model connection test request:",JSON.stringify(t));let o=$?`${$}/health/test_connection`:"/health/test_connection",a=await fetch(o,{method:"POST",headers:{"Content-Type":"application/json",[T]:`Bearer ${e}`},body:JSON.stringify({litellm_params:t,model_info:r,mode:n})}),i=a.headers.get("content-type");if(!i||!i.includes("application/json")){let e=await a.text();throw console.error("Received non-JSON response:",e),Error(`Received non-JSON response (${a.status}: ${a.statusText}). Check network tab for details.`)}let l=await a.json();if((!a.ok||"error"===l.status)&&"error"!==l.status)return{status:"error",message:l.error?.message||`Connection test failed: ${a.status} ${a.statusText}`};return l}catch(e){throw console.error("Model connection test error:",e),e}},e0=async(e,t)=>{try{console.log("entering keyInfoV1Call");let r=$?`${$}/key/info`:"/key/info";r=`${r}?key=${t}`;let n=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(console.log("response",n),!n.ok){let e=await n.text();j(e),g.default.fromBackend("Failed to fetch key info - "+e)}let o=await n.json();return console.log("data",o),o}catch(e){throw console.error("Failed to fetch key info:",e),e}},e1=async(e,t,r,n,o,a,i,l,s=null,c=null,u=null,d=null)=>{try{let f=$?`${$}/key/list`:"/key/list";console.log("in keyListCall");let p=new URLSearchParams;r&&p.append("team_id",r.toString()),t&&p.append("organization_id",t.toString()),n&&p.append("key_alias",n),a&&p.append("key_hash",a),o&&p.append("user_id",o.toString()),i&&p.append("page",i.toString()),l&&p.append("size",l.toString()),s&&p.append("sort_by",s),c&&p.append("sort_order",c),u&&p.append("expand",u),d&&p.append("status",d),p.append("return_full_object","true"),p.append("include_team_keys","true"),p.append("include_created_by_keys","true");let m=p.toString();m&&(f+=`?${m}`);let h=await fetch(f,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!h.ok){let e=await h.json(),t=nj(e);throw j(t),Error(t)}let g=await h.json();return console.log("/team/list API Response:",g),g}catch(e){throw console.error("Failed to create key:",e),e}},e2=async(e,t=1,r=50,n)=>{try{let o=new URLSearchParams(Object.entries({page:String(t),size:String(r),...n?{search:n}:{}})),a=$?`${$}/key/aliases`:"/key/aliases";a=`${a}?${o}`;let i=await fetch(a,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!i.ok){let e=await i.json(),t=nj(e);throw j(t),Error(t)}let l=await i.json();return console.log("/key/aliases API Response:",l),l}catch(e){throw console.error("Failed to fetch key aliases:",e),e}},e4=async(e,t,r,n=null)=>{try{let o=$?`${$}/user/daily/activity/aggregated`:"/user/daily/activity/aggregated",a=new URLSearchParams,i=e=>{let t=e.getFullYear(),r=String(e.getMonth()+1).padStart(2,"0"),n=String(e.getDate()).padStart(2,"0");return`${t}-${r}-${n}`};a.append("start_date",i(t)),a.append("end_date",i(r)),a.append("timezone",new Date().getTimezoneOffset().toString()),n&&a.append("user_id",n);let l=a.toString();l&&(o+=`?${l}`);let s=await fetch(o,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!s.ok){let e=await s.json(),t=nj(e);throw j(t),Error(t)}return await s.json()}catch(e){throw console.error("Failed to fetch aggregated user daily activity:",e),e}},e6=async e=>{try{let t=$?`${$}/user/available_roles`:"/user/available_roles",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nj(e);throw j(t),Error(t)}let n=await r.json();return console.log("response from user/available_role",n),n}catch(e){throw e}},e3=async(e,t)=>{try{if(console.log("Form Values in teamCreateCall:",t),t.metadata){console.log("formValues.metadata:",t.metadata);try{t.metadata=JSON.parse(t.metadata)}catch(e){throw Error("Failed to parse metadata: "+e)}}let r=$?`${$}/team/new`:"/team/new",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({...t})});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}let o=await n.json();return console.log("API Response:",o),o}catch(e){throw console.error("Failed to create key:",e),e}},e7=async(e,t)=>{try{if(console.log("Form Values in credentialCreateCall:",t),t.metadata){console.log("formValues.metadata:",t.metadata);try{t.metadata=JSON.parse(t.metadata)}catch(e){throw Error("Failed to parse metadata: "+e)}}let r=$?`${$}/credentials`:"/credentials",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({...t})});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}let o=await n.json();return console.log("API Response:",o),o}catch(e){throw console.error("Failed to create key:",e),e}},e5=async e=>{try{let t=$?`${$}/credentials`:"/credentials";console.log("in credentialListCall");let r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nj(e);throw j(t),Error(t)}let n=await r.json();return console.log("/credentials API Response:",n),n}catch(e){throw console.error("Failed to create key:",e),e}},e9=async(e,t,r)=>{try{let n=$?`${$}/credentials`:"/credentials";t?n+=`/by_name/${t}`:r&&(n+=`/by_model/${r}`),console.log("in credentialListCall");let o=await fetch(n,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!o.ok){let e=await o.json(),t=nj(e);throw j(t),Error(t)}let a=await o.json();return console.log("/credentials API Response:",a),a}catch(e){throw console.error("Failed to create key:",e),e}},e8=async(e,t)=>{try{let r=$?`${$}/credentials/${t}`:`/credentials/${t}`;console.log("in credentialDeleteCall:",t);let n=await fetch(r,{method:"DELETE",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}let o=await n.json();return console.log(o),o}catch(e){throw console.error("Failed to delete key:",e),e}},te=async(e,t,r)=>{try{if(console.log("Form Values in credentialUpdateCall:",r),r.metadata){console.log("formValues.metadata:",r.metadata);try{r.metadata=JSON.parse(r.metadata)}catch(e){throw Error("Failed to parse metadata: "+e)}}let n=$?`${$}/credentials/${t}`:`/credentials/${t}`,o=await fetch(n,{method:"PATCH",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({...r})});if(!o.ok){let e=await o.json(),t=nj(e);throw j(t),Error(t)}let a=await o.json();return console.log("API Response:",a),a}catch(e){throw console.error("Failed to create key:",e),e}},tt=async(e,t)=>{try{if(console.log("Form Values in keyUpdateCall:",t),t.model_tpm_limit){console.log("formValues.model_tpm_limit:",t.model_tpm_limit);try{t.model_tpm_limit=JSON.parse(t.model_tpm_limit)}catch(e){throw Error("Failed to parse model_tpm_limit: "+e)}}if(t.model_rpm_limit){console.log("formValues.model_rpm_limit:",t.model_rpm_limit);try{t.model_rpm_limit=JSON.parse(t.model_rpm_limit)}catch(e){throw Error("Failed to parse model_rpm_limit: "+e)}}let r=$?`${$}/key/update`:"/key/update",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({...t})});if(!n.ok){let e=await n.text();throw j(e),console.error("Error response from the server:",e),Error(e)}let o=await n.json();return console.log("Update key Response:",o),o}catch(e){throw console.error("Failed to create key:",e),e}},tr=async(e,t)=>{try{console.log("Form Values in teamUpateCall:",t);let r=$?`${$}/team/update`:"/team/update",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({...t})});if(!n.ok){let e=await n.text();throw j(e),console.error("Error response from the server:",e),g.default.fromBackend("Failed to update team settings: "+e),Error(e)}let o=await n.json();return console.log("Update Team Response:",o),o}catch(e){throw console.error("Failed to update team:",e),e}},tn=async(e,t,r)=>{try{console.log("Form Values in modelUpateCall:",t);let n=$?`${$}/model/${r}/update`:`/model/${r}/update`,o=await fetch(n,{method:"PATCH",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({...t})});if(!o.ok){let e=await o.text();throw j(e),console.error("Error update from the server:",e),Error("Network response was not ok")}let a=await o.json();return console.log("Update model Response:",a),a}catch(e){throw console.error("Failed to update model:",e),e}},to=async(e,t,r)=>{try{console.log("Form Values in teamMemberAddCall:",r);let n=$?`${$}/team/member_add`:"/team/member_add",o=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({team_id:t,member:r})});if(!o.ok){let e=await o.text(),t={};try{t=JSON.parse(e)}catch(t){console.warn("Failed to parse error body as JSON:",e)}let r=t?.detail?.error||"Failed to add team member",n=Error(r);throw n.raw=t,n}let a=await o.json();return console.log("API Response:",a),a}catch(e){throw console.error("Failed to create key:",e),e}},ta=async(e,t,r,n,o)=>{try{console.log("Bulk add team members:",{teamId:t,members:r,maxBudgetInTeam:n});let a=$?`${$}/team/bulk_member_add`:"/team/bulk_member_add",i={team_id:t};o?i.all_users=!0:i.members=r,null!=n&&(i.max_budget_in_team=n);let l=await fetch(a,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(i)});if(!l.ok){let e=await l.text(),t={};try{t=JSON.parse(e)}catch(t){console.warn("Failed to parse error body as JSON:",e)}let r=t?.detail?.error||"Failed to bulk add team members",n=Error(r);throw n.raw=t,n}let s=await l.json();return console.log("Bulk team member add API Response:",s),s}catch(e){throw console.error("Failed to bulk add team members:",e),e}},ti=async(e,t,r)=>{try{console.log("Form Values in teamMemberUpdateCall:",r),console.log("Budget value:",r.max_budget_in_team),console.log("TPM limit:",r.tpm_limit),console.log("RPM limit:",r.rpm_limit);let n=$?`${$}/team/member_update`:"/team/member_update",o={team_id:t,role:r.role,user_id:r.user_id};void 0!==r.user_email&&(o.user_email=r.user_email),void 0!==r.max_budget_in_team&&null!==r.max_budget_in_team&&(o.max_budget_in_team=r.max_budget_in_team),void 0!==r.tpm_limit&&null!==r.tpm_limit&&(o.tpm_limit=r.tpm_limit),void 0!==r.rpm_limit&&null!==r.rpm_limit&&(o.rpm_limit=r.rpm_limit),console.log("Final request body:",o);let a=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(o)});if(!a.ok){let e=await a.text(),t={};try{t=JSON.parse(e)}catch(t){console.warn("Failed to parse error body as JSON:",e)}let r=t?.detail?.error||"Failed to add team member",n=Error(r);throw n.raw=t,n}let i=await a.json();return console.log("API Response:",i),i}catch(e){throw console.error("Failed to update team member:",e),e}},tl=async(e,t,r)=>{try{console.log("Form Values in teamMemberAddCall:",r);let n=$?`${$}/team/member_delete`:"/team/member_delete",o=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({team_id:t,...void 0!==r.user_email&&{user_email:r.user_email},...void 0!==r.user_id&&{user_id:r.user_id}})});if(!o.ok){let e=await o.json(),t=nj(e);throw j(t),Error(t)}let a=await o.json();return console.log("API Response:",a),a}catch(e){throw console.error("Failed to create key:",e),e}},ts=async(e,t,r)=>{try{console.log("Form Values in teamMemberAddCall:",r);let n=$?`${$}/organization/member_add`:"/organization/member_add",o=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({organization_id:t,member:r})});if(!o.ok){let e=await o.text();throw j(e),console.error("Error response from the server:",e),Error(e)}let a=await o.json();return console.log("API Response:",a),a}catch(e){throw console.error("Failed to create organization member:",e),e}},tc=async(e,t,r)=>{try{console.log("Form Values in organizationMemberDeleteCall:",r);let n=$?`${$}/organization/member_delete`:"/organization/member_delete",o=await fetch(n,{method:"DELETE",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({organization_id:t,user_id:r})});if(!o.ok){let e=await o.json(),t=nj(e);throw j(t),Error(t)}let a=await o.json();return console.log("API Response:",a),a}catch(e){throw console.error("Failed to delete organization member:",e),e}},tu=async(e,t,r)=>{try{console.log("Form Values in organizationMemberUpdateCall:",r);let n=$?`${$}/organization/member_update`:"/organization/member_update",o=await fetch(n,{method:"PATCH",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({organization_id:t,...r})});if(!o.ok){let e=await o.json(),t=nj(e);throw j(t),Error(t)}let a=await o.json();return console.log("API Response:",a),a}catch(e){throw console.error("Failed to update organization member:",e),e}},td=async(e,t,r)=>{try{console.log("Form Values in userUpdateUserCall:",t);let n=$?`${$}/user/update`:"/user/update",o={...t};null!==r&&(o.user_role=r),o=JSON.stringify(o);let a=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:o});if(!a.ok){let e=await a.json(),t=nj(e);throw j(t),Error(t)}let i=await a.json();return console.log("API Response:",i),i}catch(e){throw console.error("Failed to create key:",e),e}},tf=async(e,t,r,n=!1)=>{try{let o;console.log("Form Values in userUpdateUserCall:",t);let a=$?`${$}/user/bulk_update`:"/user/bulk_update";if(n)o=JSON.stringify({all_users:!0,user_updates:t});else if(r&&r.length>0){let e=[];for(let n of r)e.push({user_id:n,...t});o=JSON.stringify({users:e})}else throw Error("Must provide either userIds or set allUsers=true");let i=await fetch(a,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:o});if(!i.ok){let e=await i.json(),t=nj(e);throw j(t),Error(t)}let l=await i.json();return console.log("API Response:",l),l}catch(e){throw console.error("Failed to create key:",e),e}},tp=async(e,t)=>{try{let r=$?`${$}/health/services?service=${t}`:`/health/services?service=${t}`;console.log("Checking Slack Budget Alerts service health");let n=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.text();throw j(e),Error(e)}return await n.json()}catch(e){throw console.error("Failed to perform health check:",e),e}},tm=async e=>{try{let t=$?`${$}/budget/list`:"/budget/list",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nj(e);throw j(t),Error(t)}return await r.json()}catch(e){throw console.error("Failed to get callbacks:",e),e}},th=async(e,t,r)=>{try{let t=$?`${$}/get/config/callbacks`:"/get/config/callbacks",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nj(e);throw j(t),Error(t)}return await r.json()}catch(e){throw console.error("Failed to get callbacks:",e),e}},tg=async e=>{try{let t=$?`${$}/config/list?config_type=general_settings`:"/config/list?config_type=general_settings",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nj(e);throw j(t),Error(t)}return await r.json()}catch(e){throw console.error("Failed to get callbacks:",e),e}},tv=async e=>{try{let t=$?`${$}/router/settings`:"/router/settings",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nj(e);throw j(t),Error(t)}return await r.json()}catch(e){throw console.error("Failed to get router settings:",e),e}},ty=async e=>{try{let t=$?`${$}/cache/settings`:"/cache/settings",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nj(e);throw j(t),Error(t)}return await r.json()}catch(e){throw console.error("Failed to get cache settings:",e),e}},tb=async(e,t)=>{try{let r=$?`${$}/cache/settings/test`:"/cache/settings/test",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({cache_settings:t})});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to test cache connection:",e),e}},tw=async(e,t)=>{try{let r=$?`${$}/cache/settings`:"/cache/settings",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({cache_settings:t})});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to update cache settings:",e),e}},t$=async(e,t)=>{try{let r=$?`${$}/config/pass_through_endpoint`:"/config/pass_through_endpoint";t&&(r+=`/team/${t}`);let n=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to get callbacks:",e),e}},tC=async(e,t)=>{try{let r=$?`${$}/config/field/info?field_name=${t}`:`/config/field/info?field_name=${t}`,n=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to set callbacks:",e),e}},tE=async(e,t)=>{try{let r=$?`${$}/config/pass_through_endpoint`:"/config/pass_through_endpoint",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({...t})});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to set callbacks:",e),e}},tS=async(e,t,r)=>{try{let n=$?`${$}/config/field/update`:"/config/field/update",o=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({field_name:t,field_value:r,config_type:"general_settings"})});if(!o.ok){let e=await o.json(),t=nj(e);throw j(t),Error(t)}let a=await o.json();return g.default.success("Successfully updated value!"),a}catch(e){throw console.error("Failed to set callbacks:",e),e}},tx=async(e,t)=>{try{let r=$?`${$}/config/field/delete`:"/config/field/delete",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({field_name:t,config_type:"general_settings"})});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}let o=await n.json();return g.default.success("Field reset on proxy"),o}catch(e){throw console.error("Failed to get callbacks:",e),e}},tj=async(e,t)=>{try{let r=$?`${$}/config/pass_through_endpoint?endpoint_id=${t}`:`/config/pass_through_endpoint?endpoint_id=${t}`,n=await fetch(r,{method:"DELETE",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to get callbacks:",e),e}},tO=async(e,t)=>{try{let r=$?`${$}/config/update`:"/config/update",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({...t})});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to set callbacks:",e),e}},tk=async(e,t)=>{try{let r=$?`${$}/health?model_id=${encodeURIComponent(t)}`:`/health?model_id=${encodeURIComponent(t)}`,n=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error(`Failed to call /health for model id ${t}:`,e),e}},tT=async e=>{try{let t=$?`${$}/cache/ping`:"/cache/ping",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.text();throw j(e),Error(e)}return await r.json()}catch(e){throw console.error("Failed to call /cache/ping:",e),e}},tF=async e=>{try{let t=$?`${$}/health/latest`:"/health/latest",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.text();throw j(e),Error(e)}return await r.json()}catch(e){throw console.error("Failed to call /health/latest:",e),e}},t_=async e=>{try{console.log("Getting proxy UI settings"),console.log("proxyBaseUrl in getProxyUISettings:",$);let t=$?`${$}/sso/get/ui_settings`:"/sso/get/ui_settings",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nj(e);throw j(t),Error(t)}return await r.json()}catch(e){throw console.error("Failed to get callbacks:",e),e}},tI=async e=>{try{let t=$?`${$}/get/ui_settings`:"/get/ui_settings",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nj(e);return console.error("Failed to get UI settings:",t),null}return await r.json()}catch(e){return console.error("Failed to get UI settings:",e),null}},tP=async e=>{try{let t=$?`${$}/get/mcp_semantic_filter_settings`:"/get/mcp_semantic_filter_settings",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nj(e);throw j(t),Error(t)}return await r.json()}catch(e){throw console.error("Failed to get MCP semantic filter settings:",e),e}},tN=async(e,t)=>{try{let r=$?`${$}/update/mcp_semantic_filter_settings`:"/update/mcp_semantic_filter_settings",n=await fetch(r,{method:"PATCH",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to update MCP semantic filter settings:",e),e}},tR=async(e,t,r)=>{try{let n=$?`${$}/v1/responses`:"/v1/responses",o=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({model:t,input:[{role:"user",content:r,type:"message"}],tools:[{type:"mcp",server_url:"litellm_proxy",require_approval:"never"}],tool_choice:"required"})}),a=o.headers.get("x-litellm-semantic-filter"),i=o.headers.get("x-litellm-semantic-filter-tools");if(!o.ok){let e=await o.json(),t=nj(e);throw j(t),Error(t)}return{data:await o.json(),headers:{filter:a,tools:i}}}catch(e){throw console.error("Failed to test MCP semantic filter:",e),e}},tM=async e=>{try{let t=$?`${$}/v2/guardrails/list`:"/v2/guardrails/list",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok)throw Error(`v2 guardrails/list returned ${r.status}`);return await r.json()}catch(t){console.log("v2/guardrails/list failed, falling back to v1:",t);try{let t=$?`${$}/guardrails/list`:"/guardrails/list",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nj(e);throw j(t),Error(t)}return await r.json()}catch(e){throw console.error("Failed to get guardrails list:",e),e}}},tB=async(e,t)=>{let r=$?`${$}/guardrails/submissions`:"/guardrails/submissions",n=new URLSearchParams;t?.status&&n.set("status",t.status),t?.team_id&&n.set("team_id",t.team_id),t?.team_guardrail!==void 0&&n.set("team_guardrail",String(t.team_guardrail)),t?.search&&n.set("search",t.search);let o=n.toString()?`${r}?${n.toString()}`:r,a=await fetch(o,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!a.ok){let e=nj(await a.json().catch(()=>({})));throw j(e),Error(e)}return a.json()},tA=async(e,t)=>{let r=$?`${$}/guardrails/submissions/${encodeURIComponent(t)}/approve`:`/guardrails/submissions/${encodeURIComponent(t)}/approve`,n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=nj(await n.json().catch(()=>({})));throw j(e),Error(e)}return n.json()},tz=async(e,t)=>{let r=$?`${$}/guardrails/submissions/${encodeURIComponent(t)}/reject`:`/guardrails/submissions/${encodeURIComponent(t)}/reject`,n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=nj(await n.json().catch(()=>({})));throw j(e),Error(e)}return n.json()},tL=async(e,t,r)=>{try{let n=$?`${$}/guardrails/usage/overview`:"/guardrails/usage/overview",o=new URLSearchParams;t&&o.append("start_date",t),r&&o.append("end_date",r),o.toString()&&(n+=`?${o.toString()}`);let a=await fetch(n,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!a.ok){let e=await a.json();throw Error(nj(e))}return a.json()}catch(e){throw console.error("Failed to get guardrails usage overview:",e),e}},tH=async(e,t,r,n)=>{try{let o=$?`${$}/guardrails/usage/detail/${encodeURIComponent(t)}`:`/guardrails/usage/detail/${encodeURIComponent(t)}`,a=new URLSearchParams;r&&a.append("start_date",r),n&&a.append("end_date",n),a.toString()&&(o+=`?${a.toString()}`);let i=await fetch(o,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!i.ok){let e=await i.json();throw Error(nj(e))}return i.json()}catch(e){throw console.error("Failed to get guardrails usage detail:",e),e}},tD=async(e,t)=>{try{let r=$?`${$}/guardrails/usage/logs`:"/guardrails/usage/logs",n=new URLSearchParams;t.guardrailId&&n.append("guardrail_id",t.guardrailId),t.policyId&&n.append("policy_id",t.policyId),null!=t.page&&n.append("page",String(t.page)),null!=t.pageSize&&n.append("page_size",String(t.pageSize)),t.action&&n.append("action",t.action),t.startDate&&n.append("start_date",t.startDate),t.endDate&&n.append("end_date",t.endDate),n.toString()&&(r+=`?${n.toString()}`);let o=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!o.ok){let e=await o.json();throw Error(nj(e))}return o.json()}catch(e){throw console.error("Failed to get guardrails usage logs:",e),e}},tV=async e=>{try{let t=$?`${$}/policies/list`:"/policies/list",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nj(e);throw j(t),Error(t)}return await r.json()}catch(e){throw console.error("Failed to get policies list:",e),e}},tW=async(e,t,r)=>{try{let n=$?`${$}/utils/test_policies_and_guardrails`:"/utils/test_policies_and_guardrails",o=await fetch(n,{method:"POST",signal:r,headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({policy_names:t.policy_names??null,guardrail_names:t.guardrail_names??null,inputs:t.inputs??null,inputs_list:t.inputs_list??null,request_data:t.request_data??{},input_type:t.input_type??"request",agent_id:t.agent_id??null})});if(!o.ok){let e=await o.text(),t="Failed to test policies and guardrails";try{let r=JSON.parse(e);r.detail?t="string"==typeof r.detail?r.detail:JSON.stringify(r.detail):r.message&&(t=r.message)}catch{t=e||t}throw j(t),Error(t)}return await o.json()}catch(e){throw console.error("Failed to test policies and guardrails:",e),e}},tG=async(e,t)=>{try{let r=$?`${$}/policy/info/${t}`:`/policy/info/${t}`,n=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error(`Failed to get policy info for ${t}:`,e),e}},tU=async e=>{try{let t=$?`${$}/policy/templates`:"/policy/templates",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nj(e);throw j(t),Error(t)}return await r.json()}catch(e){throw console.error("Failed to get policy templates:",e),e}},tq=async(e,t,r,n,o)=>{try{let a=$?`${$}/policy/templates/enrich`:"/policy/templates/enrich",i={template_id:t,parameters:r};n&&(i.model=n),o&&(i.competitors=o);let l=await fetch(a,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(i)});if(!l.ok){let e=await l.json(),t=nj(e);throw j(t),Error(t)}return await l.json()}catch(e){throw console.error("Failed to enrich policy template:",e),e}},tJ=async(e,t,r,n)=>{try{let o=$?`${$}/policy/templates/suggest`:"/policy/templates/suggest",a=await fetch(o,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({attack_examples:t.filter(e=>e.trim()),description:r,model:n})});if(!a.ok){let e=await a.json(),t=nj(e);throw j(t),Error(t)}return a.json()}catch(e){throw console.error("Failed to suggest policy templates:",e),e}},tK=async(e,t,r)=>{try{let n=$?`${$}/policy/templates/test`:"/policy/templates/test",o=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({guardrail_definitions:t,text:r})});if(!o.ok){let e=await o.json(),t=nj(e);throw j(t),Error(t)}return o.json()}catch(e){throw console.error("Failed to test policy template:",e),e}},tX=async(e,t,r,n,o,a,i,l,s)=>{let c=$?`${$}/policy/templates/enrich/stream`:"/policy/templates/enrich/stream",u={template_id:t,parameters:r,model:n};l?.instruction&&(u.instruction=l.instruction),l?.existingCompetitors&&(u.competitors=l.existingCompetitors);let d=await fetch(c,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(u)});if(!d.ok){let e=nj(await d.json());throw j(e),Error(e)}let f=d.body?.getReader();if(!f)throw Error("No response body");let p=new TextDecoder,m="";for(;;){let{done:e,value:t}=await f.read();if(e)break;let r=(m+=p.decode(t,{stream:!0})).split("\n");for(let e of(m=r.pop()||"",r))if(e.startsWith("data: "))try{let t=JSON.parse(e.slice(6));"competitor"===t.type?o(t.name):"status"===t.type?s?.(t.message):"done"===t.type?a(t):"error"===t.type&&i?.(t.message)}catch{}}},tY=async(e,t,r,n,o,a,i,l,s)=>{let c=$?`${$}/usage/ai/chat`:"/usage/ai/chat",u=await fetch(c,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({messages:t,model:r}),signal:s});if(!u.ok){let e=nj(await u.json());throw j(e),Error(e)}let d=u.body?.getReader();if(!d)throw Error("No response body");let f=new TextDecoder,p="";for(;;){let{done:e,value:t}=await d.read();if(e)break;let r=(p+=f.decode(t,{stream:!0})).split("\n");for(let e of(p=r.pop()||"",r))if(e.startsWith("data: "))try{let t=JSON.parse(e.slice(6));"chunk"===t.type?n(t.content):"status"===t.type?i?.(t.message):"tool_call"===t.type?l?.(t):"done"===t.type?o():"error"===t.type&&a?.(t.message)}catch{}}},tZ=async(e,t)=>{try{let r=$?`${$}/policies`:"/policies",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to create policy:",e),e}},tQ=async(e,t,r)=>{try{let n=$?`${$}/policies/${t}`:`/policies/${t}`,o=await fetch(n,{method:"PUT",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(r)});if(!o.ok){let e=await o.json(),t=nj(e);throw j(t),Error(t)}return await o.json()}catch(e){throw console.error("Failed to update policy:",e),e}},t0=async(e,t)=>{try{let r=encodeURIComponent(t),n=$?`${$}/policies/name/${r}/versions`:`/policies/name/${r}/versions`,o=await fetch(n,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!o.ok){let e=await o.json(),t=nj(e);throw j(t),Error(t)}return await o.json()}catch(e){throw console.error("Failed to list policy versions:",e),e}},t1=async(e,t,r)=>{try{let n=encodeURIComponent(t),o=$?`${$}/policies/name/${n}/versions`:`/policies/name/${n}/versions`,a=await fetch(o,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({source_policy_id:r??void 0})});if(!a.ok){let e=await a.json(),t=nj(e);throw j(t),Error(t)}return await a.json()}catch(e){throw console.error("Failed to create policy version:",e),e}},t2=async(e,t,r)=>{try{let n=$?`${$}/policies/${t}/status`:`/policies/${t}/status`,o=await fetch(n,{method:"PUT",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({version_status:r})});if(!o.ok){let e=await o.json(),t=nj(e);throw j(t),Error(t)}return await o.json()}catch(e){throw console.error("Failed to update policy version status:",e),e}},t4=async(e,t)=>{try{let r=$?`${$}/policies/${t}`:`/policies/${t}`,n=await fetch(r,{method:"DELETE",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to delete policy:",e),e}},t6=async(e,t)=>{try{let r=$?`${$}/policies/${t}`:`/policies/${t}`,n=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to get policy info:",e),e}},t3=async e=>{try{let t=$?`${$}/policies/attachments/list`:"/policies/attachments/list",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nj(e);throw j(t),Error(t)}return await r.json()}catch(e){throw console.error("Failed to get policy attachments list:",e),e}},t7=async(e,t)=>{try{let r=$?`${$}/policies/attachments`:"/policies/attachments",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to create policy attachment:",e),e}},t5=async(e,t)=>{try{let r=$?`${$}/policies/attachments/${t}`:`/policies/attachments/${t}`,n=await fetch(r,{method:"DELETE",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to delete policy attachment:",e),e}},t9=async(e,t,r)=>{try{let n=$?`${$}/policies/test-pipeline`:"/policies/test-pipeline",o=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({pipeline:t,test_messages:r})});if(!o.ok){let e=await o.json(),t=nj(e);throw j(t),Error(t)}return await o.json()}catch(e){throw console.error("Failed to test pipeline:",e),e}},t8=async(e,t)=>{try{let r=$?`${$}/policies/${t}/resolved-guardrails`:`/policies/${t}/resolved-guardrails`,n=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to get resolved guardrails:",e),e}},re=async(e,t)=>{try{let r=$?`${$}/policies/resolve`:"/policies/resolve",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to resolve policies:",e),e}},rt=async(e,t)=>{try{let r=$?`${$}/policies/attachments/estimate-impact`:"/policies/attachments/estimate-impact",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to estimate attachment impact:",e),e}},rr=async e=>{try{let t=$?`${$}/prompts/list`:"/prompts/list",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nj(e);throw j(t),Error(t)}return await r.json()}catch(e){throw console.error("Failed to get prompts list:",e),e}},rn=async(e,t)=>{try{let r=$?`${$}/prompts/${t}/info`:`/prompts/${t}/info`,n=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to get prompt info:",e),e}},ro=async(e,t)=>{try{let r=$?`${$}/prompts/${t}/versions`:`/prompts/${t}/versions`,n=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nj(e);throw 404!==n.status&&j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to get prompt versions:",e),e}},ra=async(e,t)=>{try{let r=$?`${$}/prompts`:"/prompts",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to create prompt:",e),e}},ri=async(e,t,r)=>{try{let n=$?`${$}/prompts/${t}`:`/prompts/${t}`,o=await fetch(n,{method:"PUT",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(r)});if(!o.ok){let e=await o.json(),t=nj(e);throw j(t),Error(t)}return await o.json()}catch(e){throw console.error("Failed to update prompt:",e),e}},rl=async(e,t)=>{try{let r=$?`${$}/prompts/${t}`:`/prompts/${t}`,n=await fetch(r,{method:"DELETE",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to delete prompt:",e),e}},rs=async(e,t)=>{try{let r=new FormData;r.append("file",t);let n=$?`${$}/utils/dotprompt_json_converter`:"/utils/dotprompt_json_converter",o=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`},body:r});if(!o.ok){let e=await o.json(),t=nj(e);throw j(t),Error(t)}return await o.json()}catch(e){throw console.error("Failed to convert prompt file:",e),e}},rc=async(e,t)=>{try{let r=$?`${$}/v1/agents`:"/v1/agents",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({...t})});if(!n.ok){let e=await n.text();throw j(e),Error(e)}let o=await n.json();return console.log("Create agent response:",o),o}catch(e){throw console.error("Failed to create agent:",e),e}},ru=async(e,t)=>{try{let r=$?`${$}/guardrails`:"/guardrails",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({guardrail:t})});if(!n.ok){let e=await n.text();throw j(e),Error(e)}let o=await n.json();return console.log("Create guardrail response:",o),o}catch(e){throw console.error("Failed to create guardrail:",e),e}},rd=async(e,t,r)=>{try{let n=$?`${$}/spend/logs/ui/${t}?start_date=${encodeURIComponent(r)}`:`/spend/logs/ui/${t}?start_date=${encodeURIComponent(r)}`;console.log("Fetching log details from:",n);let o=await fetch(n,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!o.ok){let e=await o.json(),t=nj(e);throw j(t),Error(t)}let a=await o.json();return console.log("Fetched log details:",a),a}catch(e){throw console.error("Failed to fetch log details:",e),e}},rf=async e=>{try{let t=$?`${$}/get/internal_user_settings`:"/get/internal_user_settings";console.log("Fetching SSO settings from:",t);let r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nj(e);throw j(t),Error(t)}let n=await r.json();return console.log("Fetched SSO settings:",n),n}catch(e){throw console.error("Failed to fetch SSO settings:",e),e}},rp=async(e,t)=>{try{let r=$?`${$}/update/internal_user_settings`:"/update/internal_user_settings";console.log("Updating internal user settings:",t);let n=await fetch(r,{method:"PATCH",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){let e=await n.text();throw j(e),Error(e)}let o=await n.json();return console.log("Updated internal user settings:",o),g.default.success("Internal user settings updated successfully"),o}catch(e){throw console.error("Failed to update internal user settings:",e),e}},rm=async e=>{try{let t=$?`${$}/v1/mcp/openapi-registry`:"/v1/mcp/openapi-registry",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json();throw Error(nj(e))}return await r.json()}catch(e){throw console.error("Failed to fetch OpenAPI registry:",e),e}},rh=async e=>{try{let t=$?`${$}/v1/mcp/discover`:"/v1/mcp/discover",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nj(e);throw j(t),Error(t)}return await r.json()}catch(e){throw console.error("Failed to fetch discoverable MCP servers:",e),e}},rg=async(e,t)=>{try{let r=$?`${$}/v1/mcp/server`:"/v1/mcp/server";if(t){let e=new URLSearchParams;e.append("team_id",t),r=`${r}?${e.toString()}`}console.log("Fetching MCP servers from:",r);let n=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}let o=await n.json();return console.log("Fetched MCP servers:",o),o}catch(e){throw console.error("Failed to fetch MCP servers:",e),e}},rv=async(e,t)=>{try{let r=$?`${$}/v1/mcp/server/health`:"/v1/mcp/server/health";if(t&&t.length>0){let e=new URLSearchParams;t.forEach(t=>e.append("server_ids",t)),r=`${r}?${e.toString()}`}console.log("Fetching MCP server health from:",r);let n=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}let o=await n.json();return console.log("Fetched MCP server health:",o),o}catch(e){throw console.error("Failed to fetch MCP server health:",e),e}},ry=async e=>{try{let t=$?`${$}/v1/mcp/access_groups`:"/v1/mcp/access_groups";console.log("Fetching MCP access groups from:",t);let r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nj(e);throw j(t),Error(t)}let n=await r.json();return console.log("Fetched MCP access groups:",n),n.access_groups||[]}catch(e){throw console.error("Failed to fetch MCP access groups:",e),e}},rb=async e=>{try{let t=$?`${$}/v1/mcp/network/client-ip`:"/v1/mcp/network/client-ip",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`}});if(!r.ok)return null;return(await r.json()).ip||null}catch{return null}},rw=async(e,t)=>{try{console.log("Form Values in createMCPServer:",t);let r=$?`${$}/v1/mcp/server`:"/v1/mcp/server",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({...t})});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}let o=await n.json();return console.log("API Response:",o),o}catch(e){throw console.error("Failed to create key:",e),e}},r$=async(e,t)=>{try{let r=$?`${$}/v1/mcp/server`:"/v1/mcp/server",n=await fetch(r,{method:"PUT",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to update MCP server:",e),e}},rC=async(e,t)=>{try{let r=($?`${$}`:"")+`/v1/mcp/server/${t}`;console.log("in deleteMCPServer:",t);let n=await fetch(r,{method:S,headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}}catch(e){throw console.error("Failed to delete key:",e),e}},rE=async(e,t)=>{try{let r=($?`${$}`:"")+"/v1/mcp/server/register",n=await fetch(r,{method:E,headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}return n.json()}catch(e){throw console.error("Failed to register MCP server:",e),e}},rS=async e=>{try{let t=($?`${$}`:"")+"/v1/mcp/server/submissions",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json().catch(()=>({})),t=nj(e);throw j(t),Error(t)}return r.json()}catch(e){throw console.error("Failed to fetch MCP submissions:",e),e}},rx=async(e,t)=>{try{let r=($?`${$}`:"")+`/v1/mcp/server/${encodeURIComponent(t)}/approve`,n=await fetch(r,{method:"PUT",headers:{[T]:`Bearer ${e}`}});if(!n.ok){let e=await n.json().catch(()=>({})),t=nj(e);throw j(t),Error(t)}return n.json()}catch(e){throw console.error("Failed to approve MCP server:",e),e}},rj=async(e,t,r)=>{try{let n=($?`${$}`:"")+`/v1/mcp/server/${encodeURIComponent(t)}/reject`,o=await fetch(n,{method:"PUT",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({review_notes:r??null})});if(!o.ok){let e=await o.json().catch(()=>({})),t=nj(e);throw j(t),Error(t)}return o.json()}catch(e){throw console.error("Failed to reject MCP server:",e),e}},rO=async e=>{try{let t=$?`${$}/search_tools/list`:"/search_tools/list";console.log("Fetching search tools from:",t);let r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nj(e);throw j(t),Error(t)}let n=await r.json();return console.log("Fetched search tools:",n),n}catch(e){throw console.error("Failed to fetch search tools:",e),e}},rk=async(e,t)=>{try{console.log("Creating search tool with values:",t);let r=$?`${$}/search_tools`:"/search_tools",n=await fetch(r,{method:E,headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({search_tool:t})});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}let o=await n.json();return console.log("Created search tool:",o),o}catch(e){throw console.error("Failed to create search tool:",e),e}},rT=async(e,t,r)=>{try{console.log("Updating search tool with ID:",t,"values:",r);let n=$?`${$}/search_tools/${t}`:`/search_tools/${t}`,o=await fetch(n,{method:"PUT",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({search_tool:r})});if(!o.ok){let e=await o.json(),t=nj(e);throw j(t),Error(t)}let a=await o.json();return console.log("Updated search tool:",a),a}catch(e){throw console.error("Failed to update search tool:",e),e}},rF=async(e,t)=>{try{let r=($?`${$}`:"")+`/search_tools/${t}`;console.log("Deleting search tool:",t);let n=await fetch(r,{method:S,headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}let o=await n.json();return console.log("Deleted search tool:",o),o}catch(e){throw console.error("Failed to delete search tool:",e),e}},r_=async e=>{try{let t=$?`${$}/search_tools/ui/available_providers`:"/search_tools/ui/available_providers";console.log("Fetching available search providers from:",t);let r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nj(e);throw j(t),Error(t)}let n=await r.json();return console.log("Fetched available search providers:",n),n}catch(e){throw console.error("Failed to fetch available search providers:",e),e}},rI=async(e,t)=>{try{let r=$?`${$}/search_tools/test_connection`:"/search_tools/test_connection";console.log("Testing search tool connection:",r);let n=await fetch(r,{method:E,headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({litellm_params:t})});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}let o=await n.json();return console.log("Test connection response:",o),o}catch(e){throw console.error("Failed to test search tool connection:",e),e}},rP=async(e,t,r)=>{try{let n=$?`${$}/mcp-rest/tools/list?server_id=${t}`:`/mcp-rest/tools/list?server_id=${t}`;console.log("Fetching MCP tools from:",n);let o={[T]:`Bearer ${e}`,"Content-Type":"application/json",...r},a=await fetch(n,{method:"GET",headers:o}),i=await a.json();if(console.log("Fetched MCP tools response:",i),!a.ok){if(i.error&&i.message)throw Error(i.message);throw Error("Failed to fetch MCP tools")}return i}catch(e){return console.error("Failed to fetch MCP tools:",e),{tools:[],error:"network_error",message:e instanceof Error?e.message:"Failed to fetch MCP tools",stack_trace:null}}},rN=async(e,t,r,n,o)=>{try{let a=$?`${$}/mcp-rest/tools/call`:"/mcp-rest/tools/call";console.log("Calling MCP tool:",r,"with arguments:",n,"for server:",t);let i={[T]:`Bearer ${e}`,"Content-Type":"application/json",...o?.customHeaders||{}},l={server_id:t,name:r,arguments:n};o?.guardrails&&o.guardrails.length>0&&(l.litellm_metadata={guardrails:o.guardrails});let s=await fetch(a,{method:"POST",headers:i,body:JSON.stringify(l)});if(!s.ok){let e="Network response was not ok",t=null,r=await s.text();try{let n=JSON.parse(r);n.detail?"string"==typeof n.detail?e=n.detail:"object"==typeof n.detail&&(e=n.detail.message||n.detail.error||"An error occurred",t=n.detail):e=n.message||n.error||e}catch(t){console.error("Failed to parse JSON error response:",t),r&&(e=r)}let n=Error(e);throw n.status=s.status,n.statusText=s.statusText,n.details=t,j(e),n}let c=await s.json();return console.log("MCP tool call response:",c),c}catch(e){throw console.error("Failed to call MCP tool:",e),console.error("Error type:",typeof e),e instanceof Error&&(console.error("Error message:",e.message),console.error("Error stack:",e.stack)),e}},rR=async(e,t)=>{try{let r=$?`${$}/tag/new`:"/tag/new",n=await fetch(r,{method:"POST",headers:{"Content-Type":"application/json",[T]:`Bearer ${e}`},body:JSON.stringify(t)});if(!n.ok){let e=await n.text();await j(e);return}return await n.json()}catch(e){throw console.error("Error creating tag:",e),e}},rM=async(e,t)=>{try{let r=$?`${$}/tag/update`:"/tag/update",n=await fetch(r,{method:"POST",headers:{"Content-Type":"application/json",[T]:`Bearer ${e}`},body:JSON.stringify(t)});if(!n.ok){let e=await n.text();await j(e);return}return await n.json()}catch(e){throw console.error("Error updating tag:",e),e}},rB=async(e,t)=>{try{let r=$?`${$}/tag/info`:"/tag/info",n=await fetch(r,{method:"POST",headers:{"Content-Type":"application/json",[T]:`Bearer ${e}`},body:JSON.stringify({names:t})});if(!n.ok){let e=await n.text();return await j(e),{}}return await n.json()}catch(e){throw console.error("Error getting tag info:",e),e}},rA=async e=>{try{let t=$?`${$}/tag/list`:"/tag/list",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`}});if(!r.ok){let e=await r.text();return await j(e),{}}return await r.json()}catch(e){throw console.error("Error listing tags:",e),e}},rz=async(e,t)=>{try{let r=$?`${$}/tag/delete`:"/tag/delete",n=await fetch(r,{method:"POST",headers:{"Content-Type":"application/json",[T]:`Bearer ${e}`},body:JSON.stringify({name:t})});if(!n.ok){let e=await n.text();await j(e);return}return await n.json()}catch(e){throw console.error("Error deleting tag:",e),e}},rL=async e=>{try{let t=$?`${$}/get/default_team_settings`:"/get/default_team_settings";console.log("Fetching default team settings from:",t);let r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nj(e);throw j(t),Error(t)}let n=await r.json();return console.log("Fetched default team settings:",n),n}catch(e){throw console.error("Failed to fetch default team settings:",e),e}},rH=async(e,t)=>{try{let r=$?`${$}/update/default_team_settings`:"/update/default_team_settings";console.log("Updating default team settings:",t);let n=await fetch(r,{method:"PATCH",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}let o=await n.json();return console.log("Updated default team settings:",o),g.default.success("Default team settings updated successfully"),o}catch(e){throw console.error("Failed to update default team settings:",e),e}},rD=async(e,t)=>{try{let r=$?`${$}/team/permissions_list?team_id=${t}`:`/team/permissions_list?team_id=${t}`,n=await fetch(r,{method:"GET",headers:{"Content-Type":"application/json",[T]:`Bearer ${e}`}});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}let o=await n.json();return console.log("Team permissions response:",o),o}catch(e){throw console.error("Failed to get team permissions:",e),e}},rV=async(e,t,r)=>{try{let n=$?`${$}/team/permissions_update`:"/team/permissions_update",o=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json",[T]:`Bearer ${e}`},body:JSON.stringify({team_id:t,team_member_permissions:r})});if(!o.ok){let e=await o.json(),t=nj(e);throw j(t),Error(t)}let a=await o.json();return console.log("Team permissions response:",a),a}catch(e){throw console.error("Failed to update team permissions:",e),e}},rW=async(e,t)=>{try{let r=$?`${$}/spend/logs/session/ui?session_id=${encodeURIComponent(t)}`:`/spend/logs/session/ui?session_id=${encodeURIComponent(t)}`,n=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to fetch session logs:",e),e}},rG=async(e,t)=>{try{let r=$?`${$}/vector_store/new`:"/vector_store/new",n=await fetch(r,{method:"POST",headers:{"Content-Type":"application/json",[T]:`Bearer ${e}`},body:JSON.stringify(t)});if(!n.ok){let e=await n.json();throw Error(e.detail||"Failed to create vector store")}return await n.json()}catch(e){throw console.error("Error creating vector store:",e),e}},rU=async(e,t=1,r=100)=>{try{let t=$?`${$}/vector_store/list`:"/vector_store/list",r=await fetch(t,{method:"GET",headers:{"Content-Type":"application/json",[T]:`Bearer ${e}`}});if(!r.ok){let e=await r.json();throw Error(e.detail||"Failed to list vector stores")}return await r.json()}catch(e){throw console.error("Error listing vector stores:",e),e}},rq=async(e,t)=>{try{let r=$?`${$}/vector_store/delete`:"/vector_store/delete",n=await fetch(r,{method:"POST",headers:{"Content-Type":"application/json",[T]:`Bearer ${e}`},body:JSON.stringify({vector_store_id:t})});if(!n.ok){let e=await n.json();throw Error(e.detail||"Failed to delete vector store")}return await n.json()}catch(e){throw console.error("Error deleting vector store:",e),e}},rJ=async(e,t)=>{try{let r=$?`${$}/vector_store/info`:"/vector_store/info",n=await fetch(r,{method:"POST",headers:{"Content-Type":"application/json",[T]:`Bearer ${e}`},body:JSON.stringify({vector_store_id:t})});if(!n.ok){let e=await n.json();throw Error(e.detail||"Failed to get vector store info")}return await n.json()}catch(e){throw console.error("Error getting vector store info:",e),e}},rK=async(e,t)=>{try{let r=$?`${$}/vector_store/update`:"/vector_store/update",n=await fetch(r,{method:"POST",headers:{"Content-Type":"application/json",[T]:`Bearer ${e}`},body:JSON.stringify(t)});if(!n.ok){let e=await n.json();throw Error(e.detail||"Failed to update vector store")}return await n.json()}catch(e){throw console.error("Error updating vector store:",e),e}},rX=async(e,t,r,n,o,a,i)=>{try{let l=$?`${$}/rag/ingest`:"/rag/ingest",s=new FormData;s.append("file",t);let c={ingest_options:{vector_store:{custom_llm_provider:r,...n&&{vector_store_id:n},...i&&i}}};(o||a)&&(c.ingest_options.litellm_vector_store_params={},o&&(c.ingest_options.litellm_vector_store_params.vector_store_name=o),a&&(c.ingest_options.litellm_vector_store_params.vector_store_description=a)),s.append("request",JSON.stringify(c));let u=await fetch(l,{method:"POST",headers:{[T]:`Bearer ${e}`},body:s});if(!u.ok){let e=await u.json();throw Error(e.error?.message||e.detail||"Failed to ingest document")}return await u.json()}catch(e){throw console.error("Error ingesting document:",e),e}},rY=async e=>{try{let t=$?`${$}/email/event_settings`:"/email/event_settings",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.text();throw j(e),Error("Failed to get email event settings")}let n=await r.json();return console.log("Email event settings response:",n),n}catch(e){throw console.error("Failed to get email event settings:",e),e}},rZ=async(e,t)=>{try{let r=$?`${$}/email/event_settings`:"/email/event_settings",n=await fetch(r,{method:"PATCH",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){let e=await n.text();throw j(e),Error("Failed to update email event settings")}let o=await n.json();return console.log("Update email event settings response:",o),o}catch(e){throw console.error("Failed to update email event settings:",e),e}},rQ=async e=>{try{let t=$?`${$}/email/event_settings/reset`:"/email/event_settings/reset",r=await fetch(t,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.text();throw j(e),Error("Failed to reset email event settings")}let n=await r.json();return console.log("Reset email event settings response:",n),n}catch(e){throw console.error("Failed to reset email event settings:",e),e}},r0=async(e,t)=>{try{let r=$?`${$}/v1/agents/${t}`:`/v1/agents/${t}`,n=await fetch(r,{method:"DELETE",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.text();throw j(e),Error(e)}let o=await n.json();return console.log("Delete agent response:",o),o}catch(e){throw console.error("Failed to delete agent:",e),e}},r1=async(e,t)=>{try{let r=$?`${$}/v1/agents/make_public`:"/v1/agents/make_public",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({agent_ids:t})});if(!n.ok){let e=await n.text();throw j(e),Error(e)}let o=await n.json();return console.log("Make agents public response:",o),o}catch(e){throw console.error("Failed to make agents public:",e),e}},r2=async(e,t)=>{try{let r=$?`${$}/v1/mcp/make_public`:"/v1/mcp/make_public",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({mcp_server_ids:t})});if(!n.ok){let e=await n.text();throw j(e),Error(e)}let o=await n.json();return console.log("Make agents public response:",o),o}catch(e){throw console.error("Failed to make agents public:",e),e}},r4=async(e,t)=>{try{let r=$?`${$}/guardrails/${t}`:`/guardrails/${t}`,n=await fetch(r,{method:"DELETE",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.text();throw j(e),Error(e)}let o=await n.json();return console.log("Delete guardrail response:",o),o}catch(e){throw console.error("Failed to delete guardrail:",e),e}},r6=async e=>{try{let t=$?`${$}/guardrails/ui/add_guardrail_settings`:"/guardrails/ui/add_guardrail_settings",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.text();throw j(e),Error("Failed to get guardrail UI settings")}let n=await r.json();return console.log("Guardrail UI settings response:",n),n}catch(e){throw console.error("Failed to get guardrail UI settings:",e),e}},r3=async e=>{try{let t=$?`${$}/guardrails/ui/provider_specific_params`:"/guardrails/ui/provider_specific_params",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.text();throw j(e),Error("Failed to get guardrail provider specific parameters")}let n=await r.json();return console.log("Guardrail provider specific params response:",n),n}catch(e){throw console.error("Failed to get guardrail provider specific parameters:",e),e}},r7=async(e,t)=>{try{let r=encodeURIComponent(t),n=$?`${$}/guardrails/ui/category_yaml/${r}`:`/guardrails/ui/category_yaml/${r}`;console.log(`Fetching category YAML from: ${n}`);let o=await fetch(n,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!o.ok){let e=await o.text();throw console.error(`Failed to get category YAML. Status: ${o.status}, Error:`,e),j(e),Error(`Failed to get category YAML: ${o.status} ${e}`)}let a=await o.json();return console.log("Category YAML response:",a),a}catch(e){throw console.error("Failed to get category YAML:",e),e}},r5=async e=>{try{let t=$?`${$}/guardrails/ui/major_airlines`:"/guardrails/ui/major_airlines",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.text();throw console.error(`Failed to get major airlines. Status: ${r.status}, Error:`,e),j(e),Error(`Failed to get major airlines: ${r.status} ${e}`)}return await r.json()}catch(e){throw console.error("Failed to get major airlines:",e),e}},r9=async(e,t=!1)=>{try{let r=t?"?health_check=true":"",n=$?`${$}/v1/agents${r}`:`/v1/agents${r}`,o=await fetch(n,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!o.ok){let e=await o.text();throw j(e),Error("Failed to get agents list")}let a=await o.json();return console.log("Agents list response:",a),{agents:a}}catch(e){throw console.error("Failed to get agents list:",e),e}},r8=async(e,t)=>{try{let r=$?`${$}/v1/agents/${t}`:`/v1/agents/${t}`,n=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.text();throw j(e),Error("Failed to get agent info")}let o=await n.json();return console.log("Agent info response:",o),o}catch(e){throw console.error("Failed to get agent info:",e),e}},ne=async(e,t)=>{try{let r=$?`${$}/guardrails/${t}/info`:`/guardrails/${t}/info`,n=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.text();throw j(e),Error("Failed to get guardrail info")}let o=await n.json();return console.log("Guardrail info response:",o),o}catch(e){throw console.error("Failed to get guardrail info:",e),e}},nt=async(e,t,r)=>{try{let n=$?`${$}/v1/agents/${t}`:`/v1/agents/${t}`,o=await fetch(n,{method:"PATCH",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(r)});if(!o.ok){let e=await o.text();throw j(e),Error("Failed to patch agent")}let a=await o.json();return console.log("Patch agent response:",a),a}catch(e){throw console.error("Failed to update guardrail:",e),e}},nr=async(e,t,r)=>{try{let n=$?`${$}/guardrails/${t}`:`/guardrails/${t}`,o=await fetch(n,{method:"PATCH",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(r)});if(!o.ok){let e=await o.text();throw j(e),Error("Failed to update guardrail")}let a=await o.json();return console.log("Update guardrail response:",a),a}catch(e){throw console.error("Failed to update guardrail:",e),e}},nn=async(e,t,r,n,o)=>{try{let a=$?`${$}/guardrails/apply_guardrail`:"/guardrails/apply_guardrail",i={guardrail_name:t,text:r};n&&(i.language=n),o&&o.length>0&&(i.entities=o);let l=await fetch(a,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(i)});if(!l.ok){let e=await l.text(),t="Failed to apply guardrail";try{let r=JSON.parse(e);r.error?.message?t=r.error.message:r.detail?t=r.detail:r.message&&(t=r.message)}catch(r){t=e||t}throw j(e),Error(t)}let s=await l.json();return console.log("Apply guardrail response:",s),s}catch(e){throw console.error("Failed to apply guardrail:",e),e}},no=async(e,t)=>{try{let r=$?`${$}/guardrails/test_custom_code`:"/guardrails/test_custom_code",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){let e=await n.text(),t="Failed to test custom code guardrail";try{let r=JSON.parse(e);r.error?.message?t=r.error.message:r.detail?t=r.detail:r.message&&(t=r.message)}catch(r){t=e||t}throw j(e),Error(t)}let o=await n.json();return console.log("Test custom code guardrail response:",o),o}catch(e){throw console.error("Failed to test custom code guardrail:",e),e}},na=async(e,t)=>{try{let r=$?`${$}/guardrails/validate_blocked_words_file`:"/guardrails/validate_blocked_words_file",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({file_content:t})});if(!n.ok){let e=await n.text();throw j(e),Error("Failed to validate blocked words file")}let o=await n.json();return console.log("Validate blocked words file response:",o),o}catch(e){throw console.error("Failed to validate blocked words file:",e),e}},ni=async e=>{try{let t=$?`${$}/get/sso_settings`:"/get/sso_settings";console.log("Fetching SSO configuration from:",t);let r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nj(e);throw j(t),Error(t)}let n=await r.json();return console.log("Fetched SSO configuration:",n),n}catch(e){throw console.error("Failed to fetch SSO configuration:",e),e}},nl=async(e,t)=>{try{let r=$?`${$}/update/sso_settings`:"/update/sso_settings";console.log("Updating SSO configuration:",t);let n=await fetch(r,{method:"PATCH",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){let e=await n.json(),t="object"==typeof e?.detail?e.detail?.error||e.detail?.message:e?.detail,r="string"==typeof t&&t.length>0?t:nj(e);j(r);let o=Error(r);throw e?.detail!==void 0&&(o.detail=e.detail),o.rawError=e,o}let o=await n.json();return console.log("Updated SSO configuration:",o),o}catch(e){throw console.error("Failed to update SSO configuration:",e),e}},ns=async({accessToken:e,page:t=1,page_size:r=50,params:n={}})=>{try{let o=$?`${$}/audit`:"/audit",a=new URLSearchParams;for(let[e,o]of(a.append("page",t.toString()),a.append("page_size",r.toString()),Object.entries(n)))null!=o&&""!==o&&a.append(e,String(o));o+=`?${a.toString()}`;let i=await fetch(o,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!i.ok){let e=await i.json(),t=nj(e);throw j(t),Error(t)}return await i.json()}catch(e){throw console.error("Failed to fetch audit logs:",e),e}},nc=async e=>{try{let t=$?`${$}/user/available_users`:"/user/available_users",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`}});if(!r.ok){if(404===r.status)return null;let e=await r.text();throw j(e),Error("Network response was not ok")}return await r.json()}catch(e){throw console.error("Failed to fetch remaining users:",e),e}},nu=async e=>{try{let t=$?`${$}/health/license`:"/health/license",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`}});if(!r.ok){if(404===r.status)return null;let e=await r.text();throw j(e),Error("Network response was not ok")}return await r.json()}catch(e){throw console.error("Failed to fetch license info:",e),e}},nd=async(e,t,r)=>{try{let n=$?`${$}/config/pass_through_endpoint/${encodeURIComponent(t)}`:`/config/pass_through_endpoint/${encodeURIComponent(t)}`,o=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(r)});if(!o.ok){let e=await o.json(),t=nj(e);throw j(t),Error(t)}let a=await o.json();return g.default.success("Pass through endpoint updated successfully"),a}catch(e){throw console.error("Failed to update pass through endpoint:",e),e}},nf=async(e,t)=>{try{let r=$?`${$}/config/callback/delete`:"/config/callback/delete",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({callback_name:t})});if(!n.ok){let e=await n.json(),t=nj(e);throw j(t),Error(t)}return await n.json()}catch(e){throw console.error("Failed to delete specific callback:",e),e}},np=async(e,t,r)=>{try{console.log("Testing MCP tools list with config:",JSON.stringify(t));let n=$?`${$}/mcp-rest/test/tools/list`:"/mcp-rest/test/tools/list",o={"Content-Type":"application/json"};e&&(o["x-litellm-api-key"]=e),r?o.Authorization=`Bearer ${r}`:e&&(o[T]=`Bearer ${e}`);let a=await fetch(n,{method:"POST",headers:o,body:JSON.stringify(t)}),i=a.headers.get("content-type");if(!i||!i.includes("application/json")){let e=await a.text();throw console.error("Received non-JSON response:",e),Error(`Received non-JSON response (${a.status}: ${a.statusText}). Check network tab for details.`)}let l=await a.json();if((!a.ok||l.error)&&!l.error)return{tools:[],error:"request_failed",message:l.message||`MCP tools list failed: ${a.status} ${a.statusText}`};return l}catch(e){throw console.error("MCP tools list test error:",e),e}},nm=async(e,t)=>{let r=$?`${$}/v1/mcp/server/oauth/session`:"/v1/mcp/server/oauth/session",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)}),o=await n.json();if(!n.ok)throw Error(nj(o)||o?.error||"Failed to cache MCP server");return o},nh=async(e,t,r)=>{let n=C(),o=encodeURIComponent(t.trim()),a=`${n}/v1/mcp/server/oauth/${o}/register`,i=await fetch(a,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json",Accept:"application/json, text/event-stream"},body:JSON.stringify(r)}),l=await i.json();if(!i.ok)throw Error(nj(l)||l?.detail||"Failed to register OAuth client");return l},ng=({serverId:e,clientId:t,redirectUri:r,state:n,codeChallenge:o,scope:a})=>{let i=C(),l=encodeURIComponent(e.trim()),s=`${i}/v1/mcp/server/oauth/${l}/authorize`,c=new URLSearchParams({redirect_uri:r,state:n,response_type:"code",code_challenge:o,code_challenge_method:"S256"});return t&&t.trim().length>0&&c.set("client_id",t),a&&a.trim().length>0&&c.set("scope",a),`${s}?${c.toString()}`},nv=async({serverId:e,code:t,clientId:r,clientSecret:n,codeVerifier:o,redirectUri:a})=>{let i=C(),l=encodeURIComponent(e.trim()),s=`${i}/v1/mcp/server/oauth/${l}/token`,c=new URLSearchParams;c.set("grant_type","authorization_code"),c.set("code",t),r&&r.trim().length>0&&c.set("client_id",r),n&&n.trim().length>0&&c.set("client_secret",n),c.set("code_verifier",o),c.set("redirect_uri",a);let u=await fetch(s,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:c.toString()}),d=await u.json();if(!u.ok)throw Error(nj(d)||d?.detail||"OAuth token exchange failed");return d},ny=async(e,t,r)=>{try{let n=`${C()}/v1/vector_stores/${t}/search`,o=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({query:r})});if(!o.ok){let e=await o.text();return await j(e),null}return await o.json()}catch(e){throw console.error("Error testing vector store search:",e),e}},nb=async(e,t,r,n)=>{try{let o=`${C()}/v1/search/${t}`,a=await fetch(o,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({query:r,max_results:n||5})});if(!a.ok){let e=await a.text();return await j(e),null}return await a.json()}catch(e){throw console.error("Error querying search tool:",e),e}},nw=async(e,t,r,n)=>{try{let o,a,i,l=$?`${$}/tag/dau`:"/tag/dau",s=new URLSearchParams;s.append("end_date",(o=t.getFullYear(),a=String(t.getMonth()+1).padStart(2,"0"),i=String(t.getDate()).padStart(2,"0"),`${o}-${a}-${i}`)),n&&n.length>0?n.forEach(e=>{s.append("tag_filters",e)}):r&&s.append("tag_filter",r);let c=s.toString();c&&(l+=`?${c}`);let u=await fetch(l,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!u.ok){let e=await u.json(),t=nj(e);throw j(t),Error(t)}return await u.json()}catch(e){throw console.error("Failed to fetch DAU:",e),e}},n$=async(e,t,r,n)=>{try{let o,a,i,l=$?`${$}/tag/wau`:"/tag/wau",s=new URLSearchParams;s.append("end_date",(o=t.getFullYear(),a=String(t.getMonth()+1).padStart(2,"0"),i=String(t.getDate()).padStart(2,"0"),`${o}-${a}-${i}`)),n&&n.length>0?n.forEach(e=>{s.append("tag_filters",e)}):r&&s.append("tag_filter",r);let c=s.toString();c&&(l+=`?${c}`);let u=await fetch(l,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!u.ok){let e=await u.json(),t=nj(e);throw j(t),Error(t)}return await u.json()}catch(e){throw console.error("Failed to fetch WAU:",e),e}},nC=async(e,t,r,n)=>{try{let o,a,i,l=$?`${$}/tag/mau`:"/tag/mau",s=new URLSearchParams;s.append("end_date",(o=t.getFullYear(),a=String(t.getMonth()+1).padStart(2,"0"),i=String(t.getDate()).padStart(2,"0"),`${o}-${a}-${i}`)),n&&n.length>0?n.forEach(e=>{s.append("tag_filters",e)}):r&&s.append("tag_filter",r);let c=s.toString();c&&(l+=`?${c}`);let u=await fetch(l,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!u.ok){let e=await u.json(),t=nj(e);throw j(t),Error(t)}return await u.json()}catch(e){throw console.error("Failed to fetch MAU:",e),e}},nE=async e=>{try{let t=$?`${$}/tag/distinct`:"/tag/distinct",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=nj(e);throw j(t),Error(t)}return await r.json()}catch(e){throw console.error("Failed to fetch distinct tags:",e),e}},nS=async(e,t,r,n)=>{try{let o=$?`${$}/tag/summary`:"/tag/summary",a=new URLSearchParams,i=e=>{let t=e.getFullYear(),r=String(e.getMonth()+1).padStart(2,"0"),n=String(e.getDate()).padStart(2,"0");return`${t}-${r}-${n}`};a.append("start_date",i(t)),a.append("end_date",i(r)),n&&n.length>0&&n.forEach(e=>{a.append("tag_filters",e)});let l=a.toString();l&&(o+=`?${l}`);let s=await fetch(o,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!s.ok){let e=await s.json(),t=nj(e);throw j(t),Error(t)}return await s.json()}catch(e){throw console.error("Failed to fetch user agent summary:",e),e}},nx=async(e,t=1,r=50,n)=>{try{let o=$?`${$}/tag/user-agent/per-user-analytics`:"/tag/user-agent/per-user-analytics",a=new URLSearchParams;a.append("page",t.toString()),a.append("page_size",r.toString()),n&&n.length>0&&n.forEach(e=>{a.append("tag_filters",e)});let i=a.toString();i&&(o+=`?${i}`);let l=await fetch(o,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!l.ok){let e=await l.json(),t=nj(e);throw j(t),Error(t)}return await l.json()}catch(e){throw console.error("Failed to fetch per-user analytics:",e),e}},nj=e=>{let t=e?.detail,r=Array.isArray(t)?t.map(e=>e?.msg||JSON.stringify(e)).join("; "):"string"==typeof t?t:void 0;return e?.error&&(e.error.message||("string"==typeof e.error?e.error:void 0))||e?.message||r||JSON.stringify(e)},nO=async(e,t)=>{let r=C(),n=r?`${r}/v2/login`:"/v2/login",o=JSON.stringify({username:e,password:t}),a=await fetch(n,{method:"POST",body:o,credentials:"include",headers:{"Content-Type":"application/json"}});if(!a.ok)throw Error(nj(await a.json()));return await a.json()},nk=async()=>{let e=C(),t=e?`${e}/get/ui_settings`:"/get/ui_settings",r=await fetch(t,{method:"GET"});if(!r.ok)throw Error(nj(await r.json()));return await r.json()},nT=async(e,t)=>{let r=C(),n=r?`${r}/update/ui_settings`:"/update/ui_settings",o=await fetch(n,{method:"PATCH",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!o.ok)throw Error(nj(await o.json()));return await o.json()},nF=async()=>{try{let e=C(),t=e?`${e}/claude-code/marketplace.json`:"/claude-code/marketplace.json",r=await fetch(t,{method:"GET",headers:{"Content-Type":"application/json"}});if(!r.ok){let e=await r.text(),t=nj(JSON.parse(e));throw j(t),Error(t)}return await r.json()}catch(e){throw console.error("Failed to fetch Claude Code marketplace:",e),e}},n_=async(e,t=!1)=>{try{let r=C(),n=r?`${r}/claude-code/plugins?enabled_only=${t}`:`/claude-code/plugins?enabled_only=${t}`,o=await fetch(n,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!o.ok){let e=await o.text(),t=nj(JSON.parse(e));throw j(t),Error(t)}return await o.json()}catch(e){throw console.error("Failed to fetch Claude Code plugins list:",e),e}},nI=async(e,t)=>{try{let r=C(),n=r?`${r}/claude-code/plugins/${t}`:`/claude-code/plugins/${t}`,o=await fetch(n,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!o.ok){let e=await o.text(),t=nj(JSON.parse(e));throw j(t),Error(t)}return await o.json()}catch(e){throw console.error(`Failed to fetch plugin "${t}":`,e),e}},nP=async(e,t)=>{try{let r=C(),n=r?`${r}/claude-code/plugins`:"/claude-code/plugins",o=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!o.ok){let e=await o.text(),t=nj(JSON.parse(e));throw j(t),Error(t)}return await o.json()}catch(e){throw console.error("Failed to register Claude Code plugin:",e),e}},nN=async(e,t)=>{try{let r=C(),n=r?`${r}/claude-code/plugins/${t}/enable`:`/claude-code/plugins/${t}/enable`,o=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!o.ok){let e=await o.text(),t=nj(JSON.parse(e));throw j(t),Error(t)}return await o.json()}catch(e){throw console.error(`Failed to enable plugin "${t}":`,e),e}},nR=async(e,t)=>{try{let r=C(),n=r?`${r}/claude-code/plugins/${t}/disable`:`/claude-code/plugins/${t}/disable`,o=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!o.ok){let e=await o.text(),t=nj(JSON.parse(e));throw j(t),Error(t)}return await o.json()}catch(e){throw console.error(`Failed to disable plugin "${t}":`,e),e}},nM=async(e,t)=>{try{let r=C(),n=r?`${r}/claude-code/plugins/${t}`:`/claude-code/plugins/${t}`,o=await fetch(n,{method:"DELETE",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!o.ok){let e=await o.text(),t=nj(JSON.parse(e));throw j(t),Error(t)}return await o.json()}catch(e){throw console.error(`Failed to delete plugin "${t}":`,e),e}},nB=async(e,t)=>{let r=$?`${$}/compliance/eu-ai-act`:"/compliance/eu-ai-act",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok)throw Error(await n.text());return n.json()},nA=async(e,t)=>{let r=$?`${$}/compliance/gdpr`:"/compliance/gdpr",n=await fetch(r,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok)throw Error(await n.text());return n.json()},nz=async e=>{let t=$?`${$}/v1/tool/policy/options`:"/v1/tool/policy/options",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok)throw Error(await r.text());return r.json()},nL=async e=>{let t=$?`${$}/v1/tool/list`:"/v1/tool/list",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok)throw Error(await r.text());return(await r.json()).tools??[]},nH=async(e,t,r)=>{let n=encodeURIComponent(t),o=$?`${$}/v1/tool/${n}/logs`:`/v1/tool/${n}/logs`,a=new URLSearchParams;null!=r.page&&a.append("page",String(r.page)),null!=r.pageSize&&a.append("page_size",String(r.pageSize)),r.startDate&&a.append("start_date",r.startDate),r.endDate&&a.append("end_date",r.endDate);let i=a.toString()?`${o}?${a.toString()}`:o,l=await fetch(i,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!l.ok)throw Error(nj(await l.json().catch(()=>({}))));return l.json()},nD=async(e,t)=>{let r=encodeURIComponent(t),n=$?`${$}/v1/tool/${r}/detail`:`/v1/tool/${r}/detail`,o=await fetch(n,{method:"GET",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!o.ok)throw Error(await o.text());return o.json()},nV=async(e,t,r,n)=>{let o=$?`${$}/v1/tool/policy`:"/v1/tool/policy",a={tool_name:t};null!=r.input_policy&&(a.input_policy=r.input_policy),null!=r.output_policy&&(a.output_policy=r.output_policy),n?.team_id!=null&&(a.team_id=n.team_id||void 0),n?.key_hash!=null&&(a.key_hash=n.key_hash||void 0),n?.key_alias!=null&&(a.key_alias=n.key_alias||void 0);let i=await fetch(o,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(a)});if(!i.ok)throw Error(await i.text());return i.json()},nW=async(e,t,r)=>{let n=encodeURIComponent(t),o=new URLSearchParams;null!=r.team_id&&""!==r.team_id&&o.set("team_id",r.team_id),null!=r.key_hash&&""!==r.key_hash&&o.set("key_hash",r.key_hash);let a=o.toString(),i=$?`${$}/v1/tool/${n}/overrides${a?`?${a}`:""}`:`/v1/tool/${n}/overrides${a?`?${a}`:""}`,l=await fetch(i,{method:"DELETE",headers:{[T]:`Bearer ${e}`}});if(!l.ok)throw Error(await l.text());return l.json()},nG=async(e,t,r)=>{let n=$?`${$}/v1/mcp/server/${t}/oauth-user-credential`:`/v1/mcp/server/${t}/oauth-user-credential`,o=await fetch(n,{method:"POST",headers:{[T]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(r)});if(!o.ok){let e=await o.json().catch(()=>({})),t=e?.detail;throw Error((Array.isArray(t)?t.map(e=>e&&"object"==typeof e?e.msg??JSON.stringify(e):String(e)).join("; "):"string"==typeof t?t:t&&"string"==typeof t.error?t.error:void 0)||"Failed to store OAuth credential")}return o.json()},nU=async(e,t)=>{let r=$?`${$}/v1/mcp/server/${t}/oauth-user-credential`:`/v1/mcp/server/${t}/oauth-user-credential`,n=await fetch(r,{method:"DELETE",headers:{[T]:`Bearer ${e}`}});if(!n.ok){let e=await n.json().catch(()=>({})),t=e?.detail;throw Error((Array.isArray(t)?t.map(e=>e&&"object"==typeof e?e.msg??JSON.stringify(e):String(e)).join("; "):"string"==typeof t?t:t&&"string"==typeof t.error?t.error:void 0)||"Failed to revoke OAuth credential")}return n.json()},nq=async(e,t)=>{let r=$?`${$}/v1/mcp/server/${t}/oauth-user-credential/status`:`/v1/mcp/server/${t}/oauth-user-credential/status`,n=await fetch(r,{method:"GET",headers:{[T]:`Bearer ${e}`}});return n.ok?n.json():{server_id:t,has_credential:!1,is_expired:!1}},nJ=async e=>{let t=$?`${$}/v1/mcp/user-credentials`:"/v1/mcp/user-credentials",r=await fetch(t,{method:"GET",headers:{[T]:`Bearer ${e}`}});return r.ok?r.json():[]}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/9b0c03a2b0969129.js b/litellm/proxy/_experimental/out/_next/static/chunks/3b3c0b070b14da06.js similarity index 70% rename from litellm/proxy/_experimental/out/_next/static/chunks/9b0c03a2b0969129.js rename to litellm/proxy/_experimental/out/_next/static/chunks/3b3c0b070b14da06.js index f9bef80c55..786780e51d 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/9b0c03a2b0969129.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/3b3c0b070b14da06.js @@ -1,8 +1,8 @@ -(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"},l="../ui/assets/logos/",o={"A2A Agent":`${l}a2a_agent.png`,Ai21:`${l}ai21.svg`,"Ai21 Chat":`${l}ai21.svg`,"AI/ML API":`${l}aiml_api.svg`,"Aiohttp Openai":`${l}openai_small.svg`,Anthropic:`${l}anthropic.svg`,"Anthropic Text":`${l}anthropic.svg`,AssemblyAI:`${l}assemblyai_small.png`,Azure:`${l}microsoft_azure.svg`,"Azure AI Foundry (Studio)":`${l}microsoft_azure.svg`,"Azure Text":`${l}microsoft_azure.svg`,Baseten:`${l}baseten.svg`,"Amazon Bedrock":`${l}bedrock.svg`,"Amazon Bedrock Mantle":`${l}bedrock.svg`,"AWS SageMaker":`${l}bedrock.svg`,Cerebras:`${l}cerebras.svg`,Cloudflare:`${l}cloudflare.svg`,Codestral:`${l}mistral.svg`,Cohere:`${l}cohere.svg`,"Cohere Chat":`${l}cohere.svg`,Cometapi:`${l}cometapi.svg`,Cursor:`${l}cursor.svg`,"Databricks (Qwen API)":`${l}databricks.svg`,Dashscope:`${l}dashscope.svg`,Deepseek:`${l}deepseek.svg`,Deepgram:`${l}deepgram.png`,DeepInfra:`${l}deepinfra.png`,ElevenLabs:`${l}elevenlabs.png`,"Fal AI":`${l}fal_ai.jpg`,"Featherless Ai":`${l}featherless.svg`,"Fireworks AI":`${l}fireworks.svg`,Friendliai:`${l}friendli.svg`,"Github Copilot":`${l}github_copilot.svg`,"Google AI Studio":`${l}google.svg`,GradientAI:`${l}gradientai.svg`,Groq:`${l}groq.svg`,vllm:`${l}vllm.png`,Huggingface:`${l}huggingface.svg`,Hyperbolic:`${l}hyperbolic.svg`,Infinity:`${l}infinity.png`,"Jina AI":`${l}jina.png`,"Lambda Ai":`${l}lambda.svg`,"Lm Studio":`${l}lmstudio.svg`,"Meta Llama":`${l}meta_llama.svg`,MiniMax:`${l}minimax.svg`,"Mistral AI":`${l}mistral.svg`,Moonshot:`${l}moonshot.svg`,Morph:`${l}morph.svg`,Nebius:`${l}nebius.svg`,Novita:`${l}novita.svg`,"Nvidia Nim":`${l}nvidia_nim.svg`,Ollama:`${l}ollama.svg`,"Ollama Chat":`${l}ollama.svg`,Oobabooga:`${l}openai_small.svg`,OpenAI:`${l}openai_small.svg`,"Openai Like":`${l}openai_small.svg`,"OpenAI Text Completion":`${l}openai_small.svg`,"OpenAI-Compatible Text Completion Models (Together AI, etc.)":`${l}openai_small.svg`,"OpenAI-Compatible Endpoints (Together AI, etc.)":`${l}openai_small.svg`,Openrouter:`${l}openrouter.svg`,"Oracle Cloud Infrastructure (OCI)":`${l}oracle.svg`,Perplexity:`${l}perplexity-ai.svg`,Recraft:`${l}recraft.svg`,Replicate:`${l}replicate.svg`,RunwayML:`${l}runwayml.png`,Sagemaker:`${l}bedrock.svg`,Sambanova:`${l}sambanova.svg`,"SAP Generative AI Hub":`${l}sap.png`,Snowflake:`${l}snowflake.svg`,"Text-Completion-Codestral":`${l}mistral.svg`,TogetherAI:`${l}togetherai.svg`,Topaz:`${l}topaz.svg`,Triton:`${l}nvidia_triton.png`,V0:`${l}v0.svg`,"Vercel Ai Gateway":`${l}vercel.svg`,"Vertex AI (Anthropic, Gemini, etc.)":`${l}google.svg`,"Vertex Ai Beta":`${l}google.svg`,Vllm:`${l}vllm.png`,VolcEngine:`${l}volcengine.png`,"Voyage AI":`${l}voyage.webp`,Watsonx:`${l}watsonx.svg`,"Watsonx Text":`${l}watsonx.svg`,xAI:`${l}xai.svg`,Xinference:`${l}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:o[e],displayName:e}}let t=Object.keys(a).find(t=>a[t].toLowerCase()===e.toLowerCase());if(!t)return{logo:"",displayName:e};let l=r[t];return{logo:o[l],displayName:l}},"getProviderModels",0,(e,t)=>{console.log(`Provider key: ${e}`);let r=a[e];console.log(`Provider mapped to: ${r}`);let l=[];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))&&l.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&&l.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&&l.push(e)}))),l},"providerLogoMap",0,o,"provider_map",0,a])},793130,e=>{"use strict";var t=e.i(290571),r=e.i(429427),a=e.i(371330),l=e.i(271645),o=e.i(394487),s=e.i(503269),i=e.i(214520),n=e.i(746725),d=e.i(914189),c=e.i(144279),u=e.i(294316),m=e.i(601893),g=e.i(140721),p=e.i(942803),f=e.i(233538),b=e.i(694421),h=e.i(700020),x=e.i(35889),v=e.i(998348),C=e.i(722678);let y=(0,l.createContext)(null);y.displayName="GroupContext";let k=l.Fragment,w=Object.assign((0,h.forwardRefWithAs)(function(e,t){var k;let w=(0,l.useId)(),A=(0,p.useProvidedId)(),N=(0,m.useDisabled)(),{id:j=A||`headlessui-switch-${w}`,disabled:_=N||!1,checked:T,defaultChecked:E,onChange:I,name:O,value:M,form:S,autoFocus:$=!1,...R}=e,L=(0,l.useContext)(y),[P,B]=(0,l.useState)(null),F=(0,l.useRef)(null),D=(0,u.useSyncRefs)(F,t,null===L?null:L.setSwitch,B),z=(0,i.useDefaultValue)(E),[H,G]=(0,s.useControllable)(T,I,null!=z&&z),V=(0,n.useDisposables)(),[q,X]=(0,l.useState)(!1),U=(0,d.useEvent)(()=>{X(!0),null==G||G(!H),V.nextFrame(()=>{X(!1)})}),W=(0,d.useEvent)(e=>{if((0,f.isDisabledReactIssue7711)(e.currentTarget))return e.preventDefault();e.preventDefault(),U()}),Y=(0,d.useEvent)(e=>{e.key===v.Keys.Space?(e.preventDefault(),U()):e.key===v.Keys.Enter&&(0,b.attemptSubmit)(e.currentTarget)}),K=(0,d.useEvent)(e=>e.preventDefault()),J=(0,C.useLabelledBy)(),Z=(0,x.useDescribedBy)(),{isFocusVisible:Q,focusProps:ee}=(0,r.useFocusRing)({autoFocus:$}),{isHovered:et,hoverProps:er}=(0,a.useHover)({isDisabled:_}),{pressed:ea,pressProps:el}=(0,o.useActivePress)({disabled:_}),eo=(0,l.useMemo)(()=>({checked:H,disabled:_,hover:et,focus:Q,active:ea,autofocus:$,changing:q}),[H,et,Q,ea,_,q,$]),es=(0,h.mergeProps)({id:j,ref:D,role:"switch",type:(0,c.useResolveButtonType)(e,P),tabIndex:-1===e.tabIndex?0:null!=(k=e.tabIndex)?k:0,"aria-checked":H,"aria-labelledby":J,"aria-describedby":Z,disabled:_||void 0,autoFocus:$,onClick:W,onKeyUp:Y,onKeyPress:K},ee,er,el),ei=(0,l.useCallback)(()=>{if(void 0!==z)return null==G?void 0:G(z)},[G,z]),en=(0,h.useRender)();return l.default.createElement(l.default.Fragment,null,null!=O&&l.default.createElement(g.FormFields,{disabled:_,data:{[O]:M||"on"},overrides:{type:"checkbox",checked:H},form:S,onReset:ei}),en({ourProps:es,theirProps:R,slot:eo,defaultTag:"button",name:"Switch"}))}),{Group:function(e){var t;let[r,a]=(0,l.useState)(null),[o,s]=(0,C.useLabels)(),[i,n]=(0,x.useDescriptions)(),d=(0,l.useMemo)(()=>({switch:r,setSwitch:a}),[r,a]),c=(0,h.useRender)();return l.default.createElement(n,{name:"Switch.Description",value:i},l.default.createElement(s,{name:"Switch.Label",value:o,props:{htmlFor:null==(t=d.switch)?void 0:t.id,onClick(e){r&&(e.currentTarget instanceof HTMLLabelElement&&e.preventDefault(),r.click(),r.focus({preventScroll:!0}))}}},l.default.createElement(y.Provider,{value:d},c({ourProps:{},theirProps:e,slot:{},defaultTag:k,name:"Switch.Group"}))))},Label:C.Label,Description:x.Description});var A=e.i(888288),N=e.i(95779),j=e.i(444755),_=e.i(673706),T=e.i(829087);let E=(0,_.makeClassName)("Switch"),I=l.default.forwardRef((e,r)=>{let{checked:a,defaultChecked:o=!1,onChange:s,color:i,name:n,error:d,errorMessage:c,disabled:u,required:m,tooltip:g,id:p}=e,f=(0,t.__rest)(e,["checked","defaultChecked","onChange","color","name","error","errorMessage","disabled","required","tooltip","id"]),b={bgColor:i?(0,_.getColorClassNames)(i,N.colorPalette.background).bgColor:"bg-tremor-brand dark:bg-dark-tremor-brand",ringColor:i?(0,_.getColorClassNames)(i,N.colorPalette.ring).ringColor:"ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted"},[h,x]=(0,A.default)(o,a),[v,C]=(0,l.useState)(!1),{tooltipProps:y,getReferenceProps:k}=(0,T.useTooltip)(300);return l.default.createElement("div",{className:"flex flex-row items-center justify-start"},l.default.createElement(T.default,Object.assign({text:g},y)),l.default.createElement("div",Object.assign({ref:(0,_.mergeRefs)([r,y.refs.setReference]),className:(0,j.tremorTwMerge)(E("root"),"flex flex-row relative h-5")},f,k),l.default.createElement("input",{type:"checkbox",className:(0,j.tremorTwMerge)(E("input"),"absolute w-5 h-5 cursor-pointer left-0 top-0 opacity-0"),name:n,required:m,checked:h,onChange:e=>{e.preventDefault()}}),l.default.createElement(w,{checked:h,onChange:e=>{x(e),null==s||s(e)},disabled:u,className:(0,j.tremorTwMerge)(E("switch"),"w-10 h-5 group relative inline-flex shrink-0 cursor-pointer items-center justify-center rounded-tremor-full","focus:outline-none",u?"cursor-not-allowed":""),onFocus:()=>C(!0),onBlur:()=>C(!1),id:p},l.default.createElement("span",{className:(0,j.tremorTwMerge)(E("sr-only"),"sr-only")},"Switch ",h?"on":"off"),l.default.createElement("span",{"aria-hidden":"true",className:(0,j.tremorTwMerge)(E("background"),h?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")}),l.default.createElement("span",{"aria-hidden":"true",className:(0,j.tremorTwMerge)(E("round"),h?(0,j.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",v?(0,j.tremorTwMerge)("ring-2",b.ringColor):"")}))),d&&c?l.default.createElement("p",{className:(0,j.tremorTwMerge)(E("errorMessage"),"text-sm text-red-500 mt-1 ")},c):null)});I.displayName="Switch",e.s(["Switch",()=>I],793130)},653496,e=>{"use strict";var t=e.i(721369);e.s(["Tabs",()=>t.default])},689020,e=>{"use strict";var t=e.i(764205);let r=async e=>{try{let r=await (0,t.modelHubCall)(e);if(console.log("model_info:",r),r?.data.length>0){let e=r.data.map(e=>({model_group:e.model_group,mode:e?.mode}));return e.sort((e,t)=>e.model_group.localeCompare(t.model_group)),e}return[]}catch(e){throw console.error("Error fetching model info:",e),e}};e.s(["fetchAvailableModels",0,r])},107233,37727,e=>{"use strict";var t=e.i(603908);e.s(["Plus",()=>t.default],107233);var r=e.i(841947);e.s(["X",()=>r.default],37727)},361653,e=>{"use strict";let t=(0,e.i(475254).default)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);e.s(["default",()=>t])},603908,e=>{"use strict";let t=(0,e.i(475254).default)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);e.s(["default",()=>t])},841947,e=>{"use strict";let t=(0,e.i(475254).default)("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);e.s(["default",()=>t])},158392,419470,e=>{"use strict";var t=e.i(843476),r=e.i(779241);let a={ttl:3600,lowest_latency_buffer:0},l=({routingStrategyArgs:e})=>{let l={ttl:"Sliding window to look back over when calculating the average latency of a deployment. Default - 1 hour (in seconds).",lowest_latency_buffer:"Shuffle between deployments within this % of the lowest latency. Default - 0 (i.e. always pick lowest latency)."};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"max-w-3xl",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Latency-Based Configuration"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Fine-tune latency-based routing behavior"})]}),(0,t.jsx)("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2 xl:grid-cols-3",children:Object.entries(e||a).map(([e,a])=>(0,t.jsx)("div",{className:"space-y-2",children:(0,t.jsxs)("label",{className:"block",children:[(0,t.jsx)("span",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:e.replace(/_/g," ")}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-0.5 mb-2",children:l[e]||""}),(0,t.jsx)(r.TextInput,{name:e,defaultValue:"object"==typeof a?JSON.stringify(a,null,2):a?.toString(),className:"font-mono text-sm w-full"})]})},e))})]}),(0,t.jsx)("div",{className:"border-t border-gray-200"})]})},o=({routerSettings:e,routerFieldsMetadata:a})=>(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"max-w-3xl",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Reliability & Retries"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Configure retry logic and failure handling"})]}),(0,t.jsx)("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2 xl:grid-cols-3",children:Object.entries(e).filter(([e,t])=>"fallbacks"!=e&&"context_window_fallbacks"!=e&&"routing_strategy_args"!=e&&"routing_strategy"!=e&&"enable_tag_filtering"!=e).map(([e,l])=>(0,t.jsx)("div",{className:"space-y-2",children:(0,t.jsxs)("label",{className:"block",children:[(0,t.jsx)("span",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:a[e]?.ui_field_name||e}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-0.5 mb-2",children:a[e]?.field_description||""}),(0,t.jsx)(r.TextInput,{name:e,defaultValue:null==l||"null"===l?"":"object"==typeof l?JSON.stringify(l,null,2):l?.toString()||"",placeholder:"—",className:"font-mono text-sm w-full"})]})},e))})]});var s=e.i(199133);let i=({selectedStrategy:e,availableStrategies:r,routingStrategyDescriptions:a,routerFieldsMetadata:l,onStrategyChange:o})=>(0,t.jsxs)("div",{className:"space-y-2 max-w-3xl",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:l.routing_strategy?.ui_field_name||"Routing Strategy"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-0.5 mb-2",children:l.routing_strategy?.field_description||""})]}),(0,t.jsx)("div",{className:"routing-strategy-select max-w-3xl",children:(0,t.jsx)(s.Select,{value:e,onChange:o,style:{width:"100%"},size:"large",children:r.map(e=>(0,t.jsx)(s.Select.Option,{value:e,label:e,children:(0,t.jsxs)("div",{className:"flex flex-col gap-0.5 py-1",children:[(0,t.jsx)("span",{className:"font-mono text-sm font-medium",children:e}),a[e]&&(0,t.jsx)("span",{className:"text-xs text-gray-500 font-normal",children:a[e]})]})},e))})})]});var n=e.i(793130);let d=({enabled:e,routerFieldsMetadata:r,onToggle:a})=>(0,t.jsx)("div",{className:"space-y-3 max-w-3xl",children:(0,t.jsxs)("div",{className:"flex items-start justify-between",children:[(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)("label",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:r.enable_tag_filtering?.ui_field_name||"Enable Tag Filtering"}),(0,t.jsxs)("p",{className:"text-xs text-gray-500 mt-0.5",children:[r.enable_tag_filtering?.field_description||"",r.enable_tag_filtering?.link&&(0,t.jsxs)(t.Fragment,{children:[" ",(0,t.jsx)("a",{href:r.enable_tag_filtering.link,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-800 underline",children:"Learn more"})]})]})]}),(0,t.jsx)(n.Switch,{checked:e,onChange:a,className:"ml-4"})]})});e.s(["default",0,({value:e,onChange:r,routerFieldsMetadata:a,availableRoutingStrategies:s,routingStrategyDescriptions:n})=>(0,t.jsxs)("div",{className:"w-full space-y-8 py-2",children:[(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"max-w-3xl",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Routing Settings"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Configure how requests are routed to deployments"})]}),s.length>0&&(0,t.jsx)(i,{selectedStrategy:e.selectedStrategy||e.routerSettings.routing_strategy||null,availableStrategies:s,routingStrategyDescriptions:n,routerFieldsMetadata:a,onStrategyChange:t=>{r({...e,selectedStrategy:t})}}),(0,t.jsx)(d,{enabled:e.enableTagFiltering,routerFieldsMetadata:a,onToggle:t=>{r({...e,enableTagFiltering:t})}})]}),(0,t.jsx)("div",{className:"border-t border-gray-200"}),"latency-based-routing"===e.selectedStrategy&&(0,t.jsx)(l,{routingStrategyArgs:e.routerSettings.routing_strategy_args}),(0,t.jsx)(o,{routerSettings:e.routerSettings,routerFieldsMetadata:a})]})],158392);var c=e.i(994388),u=e.i(998573),m=e.i(653496),g=e.i(107233),p=e.i(271645),f=e.i(592968),b=e.i(361653),b=b;let h=(0,e.i(475254).default)("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);var x=e.i(37727);function v({group:e,onChange:r,availableModels:a,maxFallbacks:l}){let o=a.filter(t=>t!==e.primaryModel),i=e.fallbackModels.length{let a=[...e.fallbackModels];a.includes(t)&&(a=a.filter(e=>e!==t)),r({...e,primaryModel:t,fallbackModels:a})},showSearch:!0,filterOption:(e,t)=>(t?.label??"").toLowerCase().includes(e.toLowerCase()),options:a.map(e=>({label:e,value:e}))}),!e.primaryModel&&(0,t.jsxs)("div",{className:"mt-2 flex items-center gap-2 text-amber-600 text-xs bg-amber-50 p-2 rounded",children:[(0,t.jsx)(b.default,{className:"w-4 h-4"}),(0,t.jsx)("span",{children:"Select a model to begin configuring fallbacks"})]})]}),(0,t.jsx)("div",{className:"flex items-center justify-center -my-4 z-10",children:(0,t.jsxs)("div",{className:"bg-indigo-50 text-indigo-500 px-4 py-1 rounded-full text-xs font-bold border border-indigo-100 flex items-center gap-2 shadow-sm",children:[(0,t.jsx)(h,{className:"w-4 h-4"}),"IF FAILS, TRY..."]})}),(0,t.jsxs)("div",{className:`transition-opacity duration-300 ${!e.primaryModel?"opacity-50 pointer-events-none":"opacity-100"}`,children:[(0,t.jsxs)("label",{className:"block text-sm font-semibold text-gray-700 mb-2",children:["Fallback Chain ",(0,t.jsx)("span",{className:"text-red-500",children:"*"}),(0,t.jsxs)("span",{className:"text-xs text-gray-500 font-normal ml-2",children:["(Max ",l," fallbacks at a time)"]})]}),(0,t.jsxs)("div",{className:"bg-gray-50 rounded-xl p-4 border border-gray-200",children:[(0,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsx)(s.Select,{mode:"multiple",className:"w-full",size:"large",placeholder:i?"Select fallback models to add...":`Maximum ${l} fallbacks reached`,value:e.fallbackModels,onChange:t=>{let a=t.slice(0,l);r({...e,fallbackModels:a})},disabled:!e.primaryModel,options:o.map(e=>({label:e,value:e})),optionRender:(r,a)=>{let l=e.fallbackModels.includes(r.value),o=l?e.fallbackModels.indexOf(r.value)+1:null;return(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[l&&null!==o&&(0,t.jsx)("span",{className:"flex items-center justify-center w-5 h-5 rounded bg-indigo-100 text-indigo-600 text-xs font-bold",children:o}),(0,t.jsx)("span",{children:r.label})]})},maxTagCount:"responsive",maxTagPlaceholder:e=>(0,t.jsx)(f.Tooltip,{styles:{root:{pointerEvents:"none"}},title:e.map(({value:e})=>e).join(", "),children:(0,t.jsxs)("span",{children:["+",e.length," more"]})}),showSearch:!0,filterOption:(e,t)=>(t?.label??"").toLowerCase().includes(e.toLowerCase())}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1 ml-1",children:i?`Search and select multiple models. Selected models will appear below in order. (${e.fallbackModels.length}/${l} used)`:`Maximum ${l} fallbacks reached. Remove some to add more.`})]}),(0,t.jsx)("div",{className:"space-y-2 min-h-[100px]",children:0===e.fallbackModels.length?(0,t.jsxs)("div",{className:"h-32 border-2 border-dashed border-gray-300 rounded-lg flex flex-col items-center justify-center text-gray-400",children:[(0,t.jsx)("span",{className:"text-sm",children:"No fallback models selected"}),(0,t.jsx)("span",{className:"text-xs mt-1",children:"Add models from the dropdown above"})]}):e.fallbackModels.map((a,l)=>(0,t.jsxs)("div",{className:"group flex items-center justify-between p-3 bg-white rounded-lg border border-gray-200 hover:border-indigo-300 hover:shadow-sm transition-all",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"flex items-center justify-center w-6 h-6 rounded bg-gray-100 text-gray-400 group-hover:text-indigo-500 group-hover:bg-indigo-50",children:(0,t.jsx)("span",{className:"text-xs font-bold",children:l+1})}),(0,t.jsx)("div",{children:(0,t.jsx)("span",{className:"font-medium text-gray-800",children:a})})]}),(0,t.jsx)("button",{type:"button",onClick:()=>{let t;return t=e.fallbackModels.filter((e,t)=>t!==l),void r({...e,fallbackModels:t})},className:"opacity-0 group-hover:opacity-100 transition-opacity text-gray-400 hover:text-red-500 p-1",children:(0,t.jsx)(x.X,{className:"w-4 h-4"})})]},`${a}-${l}`))})]})]})]})}function C({groups:e,onGroupsChange:r,availableModels:a,maxFallbacks:l=10,maxGroups:o=5}){let[s,i]=(0,p.useState)(e.length>0?e[0].id:"1");(0,p.useEffect)(()=>{e.length>0?e.some(e=>e.id===s)||i(e[0].id):i("1")},[e]);let n=()=>{if(e.length>=o)return;let t=Date.now().toString();r([...e,{id:t,primaryModel:null,fallbackModels:[]}]),i(t)},d=t=>{r(e.map(e=>e.id===t.id?t:e))},f=e.map((r,o)=>{let s=r.primaryModel?r.primaryModel:`Group ${o+1}`;return{key:r.id,label:s,closable:e.length>1,children:(0,t.jsx)(v,{group:r,onChange:d,availableModels:a,maxFallbacks:l})}});return 0===e.length?(0,t.jsxs)("div",{className:"text-center py-12 bg-gray-50 rounded-lg border border-dashed border-gray-300",children:[(0,t.jsx)("p",{className:"text-gray-500 mb-4",children:"No fallback groups configured"}),(0,t.jsx)(c.Button,{variant:"primary",onClick:n,icon:()=>(0,t.jsx)(g.Plus,{className:"w-4 h-4"}),children:"Create First Group"})]}):(0,t.jsx)(m.Tabs,{type:"editable-card",activeKey:s,onChange:i,onEdit:(t,a)=>{"add"===a?n():"remove"===a&&e.length>1&&(t=>{if(1===e.length)return u.message.warning("At least one group is required");let a=e.filter(e=>e.id!==t);r(a),s===t&&a.length>0&&i(a[a.length-1].id)})(t)},items:f,className:"fallback-tabs",tabBarStyle:{marginBottom:0},hideAdd:e.length>=o})}e.s(["FallbackSelectionForm",()=>C],419470)},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)},599724,936325,e=>{"use strict";var t=e.i(95779),r=e.i(444755),a=e.i(673706),l=e.i(271645);let o=l.default.forwardRef((e,o)=>{let{color:s,className:i,children:n}=e;return l.default.createElement("p",{ref:o,className:(0,r.tremorTwMerge)("text-tremor-default",s?(0,a.getColorClassNames)(s,t.colorPalette.text).textColor:(0,r.tremorTwMerge)("text-tremor-content","dark:text-dark-tremor-content"),i)},n)});o.displayName="Text",e.s(["default",()=>o],936325),e.s(["Text",()=>o],599724)},304967,e=>{"use strict";var t=e.i(290571),r=e.i(271645),a=e.i(480731),l=e.i(95779),o=e.i(444755),s=e.i(673706);let i=(0,s.makeClassName)("Card"),n=r.default.forwardRef((e,n)=>{let{decoration:d="",decorationColor:c,children:u,className:m}=e,g=(0,t.__rest)(e,["decoration","decorationColor","children","className"]);return r.default.createElement("div",Object.assign({ref:n,className:(0,o.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,s.getColorClassNames)(c,l.colorPalette.border).borderColor:"border-tremor-brand dark:border-dark-tremor-brand",(e=>{if(!e)return"";switch(e){case a.HorizontalPositions.Left:return"border-l-4";case a.VerticalPositions.Top:return"border-t-4";case a.HorizontalPositions.Right:return"border-r-4";case a.VerticalPositions.Bottom:return"border-b-4";default:return""}})(d),m)},g),u)});n.displayName="Card",e.s(["Card",()=>n],304967)},994388,e=>{"use strict";var t=e.i(290571),r=e.i(829087),a=e.i(271645);let l=["preEnter","entering","entered","preExit","exiting","exited","unmounted"],o=e=>({_s:e,status:l[e],isEnter:e<3,isMounted:6!==e,isResolved:2===e||e>4}),s=e=>e?6:5,i=(e,t,r,a,l)=>{clearTimeout(a.current);let s=o(e);t(s),r.current=s,l&&l({current:s})};var n=e.i(480731),d=e.i(444755),c=e.i(673706);let u=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 g={xs:{height:"h-4",width:"w-4"},sm:{height:"h-5",width:"w-5"},md:{height:"h-5",width:"w-5"},lg:{height:"h-6",width:"w-6"},xl:{height:"h-6",width:"w-6"}},p=(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:""}}},f=(0,c.makeClassName)("Button"),b=({loading:e,iconSize:t,iconPosition:r,Icon:l,needMargin:o,transitionStatus:s})=>{let i=o?r===n.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(u,{className:(0,d.tremorTwMerge)(f("icon"),"animate-spin shrink-0",i,m.default,m[s]),style:{transition:"width 150ms"}}):a.default.createElement(l,{className:(0,d.tremorTwMerge)(f("icon"),"shrink-0",t,i)})},h=a.default.forwardRef((e,l)=>{let{icon:u,iconPosition:m=n.HorizontalPositions.Left,size:h=n.Sizes.SM,color:x,variant:v="primary",disabled:C,loading:y=!1,loadingText:k,children:w,tooltip:A,className:N}=e,j=(0,t.__rest)(e,["icon","iconPosition","size","color","variant","disabled","loading","loadingText","children","tooltip","className"]),_=y||C,T=void 0!==u||y,E=y&&k,I=!(!w&&!E),O=(0,d.tremorTwMerge)(g[h].height,g[h].width),M="light"!==v?(0,d.tremorTwMerge)("rounded-tremor-default border","shadow-tremor-input","dark:shadow-dark-tremor-input"):"",S=p(v,x),$=("light"!==v?{xs:{paddingX:"px-2.5",paddingY:"py-1.5",fontSize:"text-xs"},sm:{paddingX:"px-4",paddingY:"py-2",fontSize:"text-sm"},md:{paddingX:"px-4",paddingY:"py-2",fontSize:"text-md"},lg:{paddingX:"px-4",paddingY:"py-2.5",fontSize:"text-lg"},xl:{paddingX:"px-4",paddingY:"py-3",fontSize:"text-xl"}}:{xs:{paddingX:"",paddingY:"",fontSize:"text-xs"},sm:{paddingX:"",paddingY:"",fontSize:"text-sm"},md:{paddingX:"",paddingY:"",fontSize:"text-md"},lg:{paddingX:"",paddingY:"",fontSize:"text-lg"},xl:{paddingX:"",paddingY:"",fontSize:"text-xl"}})[h],{tooltipProps:R,getReferenceProps:L}=(0,r.useTooltip)(300),[P,B]=(({enter:e=!0,exit:t=!0,preEnter:r,preExit:l,timeout:n,initialEntered:d,mountOnEnter:c,unmountOnExit:u,onStateChange:m}={})=>{let[g,p]=(0,a.useState)(()=>o(d?2:s(c))),f=(0,a.useRef)(g),b=(0,a.useRef)(0),[h,x]="object"==typeof n?[n.enter,n.exit]:[n,n],v=(0,a.useCallback)(()=>{let e=((e,t)=>{switch(e){case 1:case 0:return 2;case 4:case 3:return s(t)}})(f.current._s,u);e&&i(e,p,f,b,m)},[m,u]);return[g,(0,a.useCallback)(a=>{let o=e=>{switch(i(e,p,f,b,m),e){case 1:h>=0&&(b.current=((...e)=>setTimeout(...e))(v,h));break;case 4:x>=0&&(b.current=((...e)=>setTimeout(...e))(v,x));break;case 0:case 3:b.current=((...e)=>setTimeout(...e))(()=>{isNaN(document.body.offsetTop)||o(e+1)},0)}},n=f.current.isEnter;"boolean"!=typeof a&&(a=!n),a?n||o(e?+!r:2):n&&o(t?l?3:4:s(u))},[v,m,e,t,r,l,h,x,u]),v]})({timeout:50});return(0,a.useEffect)(()=>{B(y)},[y]),a.default.createElement("button",Object.assign({ref:(0,c.mergeRefs)([l,R.refs.setReference]),className:(0,d.tremorTwMerge)(f("root"),"shrink-0 inline-flex justify-center items-center group font-medium outline-none",M,$.paddingX,$.paddingY,$.fontSize,S.textColor,S.bgColor,S.borderColor,S.hoverBorderColor,_?"opacity-50 cursor-not-allowed":(0,d.tremorTwMerge)(p(v,x).hoverTextColor,p(v,x).hoverBgColor,p(v,x).hoverBorderColor),N),disabled:_},L,j),a.default.createElement(r.default,Object.assign({text:A},R)),T&&m!==n.HorizontalPositions.Right?a.default.createElement(b,{loading:y,iconSize:O,iconPosition:m,Icon:u,transitionStatus:P.status,needMargin:I}):null,E||w?a.default.createElement("span",{className:(0,d.tremorTwMerge)(f("text"),"text-tremor-default whitespace-nowrap")},E?k:w):null,T&&m===n.HorizontalPositions.Right?a.default.createElement(b,{loading:y,iconSize:O,iconPosition:m,Icon:u,transitionStatus:P.status,needMargin:I}):null)});h.displayName="Button",e.s(["Button",()=>h],994388)},185793,e=>{"use strict";e.i(247167);var t=e.i(271645),r=e.i(343794),a=e.i(242064),l=e.i(529681);let o=e=>{let{prefixCls:a,className:l,style:o,size:s,shape:i}=e,n=(0,r.default)({[`${a}-lg`]:"large"===s,[`${a}-sm`]:"small"===s}),d=(0,r.default)({[`${a}-circle`]:"circle"===i,[`${a}-square`]:"square"===i,[`${a}-round`]:"round"===i}),c=t.useMemo(()=>"number"==typeof s?{width:s,height:s,lineHeight:`${s}px`}:{},[s]);return t.createElement("span",{className:(0,r.default)(a,n,d,l),style:Object.assign(Object.assign({},c),o)})};e.i(296059);var s=e.i(694758),i=e.i(915654),n=e.i(246422),d=e.i(838378);let c=new s.Keyframes("ant-skeleton-loading",{"0%":{backgroundPosition:"100% 50%"},"100%":{backgroundPosition:"0 50%"}}),u=e=>({height:e,lineHeight:(0,i.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)),p=e=>Object.assign({width:e},u(e)),f=(e,t,r)=>{let{skeletonButtonCls:a}=e;return{[`${r}${a}-circle`]:{width:t,minWidth:t,borderRadius:"50%"},[`${r}${a}-round`]:{borderRadius:t}}},b=(e,t)=>Object.assign({width:t(e).mul(2).equal(),minWidth:t(e).mul(2).equal()},u(e)),h=(0,n.genStyleHooks)("Skeleton",e=>{let{componentCls:t,calc:r}=e;return(e=>{let{componentCls:t,skeletonAvatarCls:r,skeletonTitleCls:a,skeletonParagraphCls:l,skeletonButtonCls:o,skeletonInputCls:s,skeletonImageCls:i,controlHeight:n,controlHeightLG:d,controlHeightSM:u,gradientFromColor:h,padding:x,marginSM:v,borderRadius:C,titleHeight:y,blockRadius:k,paragraphLiHeight:w,controlHeightXS:A,paragraphMarginTop:N}=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(n)),[`${r}-circle`]:{borderRadius:"50%"},[`${r}-lg`]:Object.assign({},m(d)),[`${r}-sm`]:Object.assign({},m(u))},[`${t}-content`]:{display:"table-cell",width:"100%",verticalAlign:"top",[a]:{width:"100%",height:y,background:h,borderRadius:k,[`+ ${l}`]:{marginBlockStart:u}},[l]:{padding:0,"> li":{width:"100%",height:w,listStyle:"none",background:h,borderRadius:k,"+ li":{marginBlockStart:A}}},[`${l}> li:last-child:not(:first-child):not(:nth-child(2))`]:{width:"61%"}},[`&-round ${t}-content`]:{[`${a}, ${l} > li`]:{borderRadius:C}}},[`${t}-with-avatar ${t}-content`]:{[a]:{marginBlockStart:v,[`+ ${l}`]:{marginBlockStart:N}}},[`${t}${t}-element`]:Object.assign(Object.assign(Object.assign(Object.assign({display:"inline-block",width:"auto"},(e=>{let{borderRadiusSM:t,skeletonButtonCls:r,controlHeight:a,controlHeightLG:l,controlHeightSM:o,gradientFromColor:s,calc:i}=e;return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({[r]:Object.assign({display:"inline-block",verticalAlign:"top",background:s,borderRadius:t,width:i(a).mul(2).equal(),minWidth:i(a).mul(2).equal()},b(a,i))},f(e,a,r)),{[`${r}-lg`]:Object.assign({},b(l,i))}),f(e,l,`${r}-lg`)),{[`${r}-sm`]:Object.assign({},b(o,i))}),f(e,o,`${r}-sm`))})(e)),(e=>{let{skeletonAvatarCls:t,gradientFromColor:r,controlHeight:a,controlHeightLG:l,controlHeightSM:o}=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(l)),[`${t}${t}-sm`]:Object.assign({},m(o))}})(e)),(e=>{let{controlHeight:t,borderRadiusSM:r,skeletonInputCls:a,controlHeightLG:l,controlHeightSM:o,gradientFromColor:s,calc:i}=e;return{[a]:Object.assign({display:"inline-block",verticalAlign:"top",background:s,borderRadius:r},g(t,i)),[`${a}-lg`]:Object.assign({},g(l,i)),[`${a}-sm`]:Object.assign({},g(o,i))}})(e)),(e=>{let{skeletonImageCls:t,imageSizeBase:r,gradientFromColor:a,borderRadiusSM:l,calc:o}=e;return{[t]:Object.assign(Object.assign({display:"inline-flex",alignItems:"center",justifyContent:"center",verticalAlign:"middle",background:a,borderRadius:l},p(o(r).mul(2).equal())),{[`${t}-path`]:{fill:"#bfbfbf"},[`${t}-svg`]:Object.assign(Object.assign({},p(r)),{maxWidth:o(r).mul(4).equal(),maxHeight:o(r).mul(4).equal()}),[`${t}-svg${t}-svg-circle`]:{borderRadius:"50%"}}),[`${t}${t}-circle`]:{borderRadius:"50%"}}})(e)),[`${t}${t}-block`]:{width:"100%",[o]:{width:"100%"},[s]:{width:"100%"}},[`${t}${t}-active`]:{[` +(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"},l="../ui/assets/logos/",o={"A2A Agent":`${l}a2a_agent.png`,Ai21:`${l}ai21.svg`,"Ai21 Chat":`${l}ai21.svg`,"AI/ML API":`${l}aiml_api.svg`,"Aiohttp Openai":`${l}openai_small.svg`,Anthropic:`${l}anthropic.svg`,"Anthropic Text":`${l}anthropic.svg`,AssemblyAI:`${l}assemblyai_small.png`,Azure:`${l}microsoft_azure.svg`,"Azure AI Foundry (Studio)":`${l}microsoft_azure.svg`,"Azure Text":`${l}microsoft_azure.svg`,Baseten:`${l}baseten.svg`,"Amazon Bedrock":`${l}bedrock.svg`,"Amazon Bedrock Mantle":`${l}bedrock.svg`,"AWS SageMaker":`${l}bedrock.svg`,Cerebras:`${l}cerebras.svg`,Cloudflare:`${l}cloudflare.svg`,Codestral:`${l}mistral.svg`,Cohere:`${l}cohere.svg`,"Cohere Chat":`${l}cohere.svg`,Cometapi:`${l}cometapi.svg`,Cursor:`${l}cursor.svg`,"Databricks (Qwen API)":`${l}databricks.svg`,Dashscope:`${l}dashscope.svg`,Deepseek:`${l}deepseek.svg`,Deepgram:`${l}deepgram.png`,DeepInfra:`${l}deepinfra.png`,ElevenLabs:`${l}elevenlabs.png`,"Fal AI":`${l}fal_ai.jpg`,"Featherless Ai":`${l}featherless.svg`,"Fireworks AI":`${l}fireworks.svg`,Friendliai:`${l}friendli.svg`,"Github Copilot":`${l}github_copilot.svg`,"Google AI Studio":`${l}google.svg`,GradientAI:`${l}gradientai.svg`,Groq:`${l}groq.svg`,vllm:`${l}vllm.png`,Huggingface:`${l}huggingface.svg`,Hyperbolic:`${l}hyperbolic.svg`,Infinity:`${l}infinity.png`,"Jina AI":`${l}jina.png`,"Lambda Ai":`${l}lambda.svg`,"Lm Studio":`${l}lmstudio.svg`,"Meta Llama":`${l}meta_llama.svg`,MiniMax:`${l}minimax.svg`,"Mistral AI":`${l}mistral.svg`,Moonshot:`${l}moonshot.svg`,Morph:`${l}morph.svg`,Nebius:`${l}nebius.svg`,Novita:`${l}novita.svg`,"Nvidia Nim":`${l}nvidia_nim.svg`,Ollama:`${l}ollama.svg`,"Ollama Chat":`${l}ollama.svg`,Oobabooga:`${l}openai_small.svg`,OpenAI:`${l}openai_small.svg`,"Openai Like":`${l}openai_small.svg`,"OpenAI Text Completion":`${l}openai_small.svg`,"OpenAI-Compatible Text Completion Models (Together AI, etc.)":`${l}openai_small.svg`,"OpenAI-Compatible Endpoints (Together AI, etc.)":`${l}openai_small.svg`,Openrouter:`${l}openrouter.svg`,"Oracle Cloud Infrastructure (OCI)":`${l}oracle.svg`,Perplexity:`${l}perplexity-ai.svg`,Recraft:`${l}recraft.svg`,Replicate:`${l}replicate.svg`,RunwayML:`${l}runwayml.png`,Sagemaker:`${l}bedrock.svg`,Sambanova:`${l}sambanova.svg`,"SAP Generative AI Hub":`${l}sap.png`,Snowflake:`${l}snowflake.svg`,"Text-Completion-Codestral":`${l}mistral.svg`,TogetherAI:`${l}togetherai.svg`,Topaz:`${l}topaz.svg`,Triton:`${l}nvidia_triton.png`,V0:`${l}v0.svg`,"Vercel Ai Gateway":`${l}vercel.svg`,"Vertex AI (Anthropic, Gemini, etc.)":`${l}google.svg`,"Vertex Ai Beta":`${l}google.svg`,Vllm:`${l}vllm.png`,VolcEngine:`${l}volcengine.png`,"Voyage AI":`${l}voyage.webp`,Watsonx:`${l}watsonx.svg`,"Watsonx Text":`${l}watsonx.svg`,xAI:`${l}xai.svg`,Xinference:`${l}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:o[e],displayName:e}}let t=Object.keys(a).find(t=>a[t].toLowerCase()===e.toLowerCase());if(!t)return{logo:"",displayName:e};let l=r[t];return{logo:o[l],displayName:l}},"getProviderModels",0,(e,t)=>{console.log(`Provider key: ${e}`);let r=a[e];console.log(`Provider mapped to: ${r}`);let l=[];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))&&l.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&&l.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&&l.push(e)}))),l},"providerLogoMap",0,o,"provider_map",0,a])},793130,e=>{"use strict";var t=e.i(290571),r=e.i(429427),a=e.i(371330),l=e.i(271645),o=e.i(394487),s=e.i(503269),i=e.i(214520),n=e.i(746725),d=e.i(914189),c=e.i(144279),u=e.i(294316),m=e.i(601893),g=e.i(140721),p=e.i(942803),b=e.i(233538),f=e.i(694421),h=e.i(700020),x=e.i(35889),v=e.i(998348),C=e.i(722678);let y=(0,l.createContext)(null);y.displayName="GroupContext";let k=l.Fragment,w=Object.assign((0,h.forwardRefWithAs)(function(e,t){var k;let w=(0,l.useId)(),A=(0,p.useProvidedId)(),N=(0,m.useDisabled)(),{id:j=A||`headlessui-switch-${w}`,disabled:_=N||!1,checked:T,defaultChecked:E,onChange:I,name:O,value:M,form:S,autoFocus:$=!1,...R}=e,L=(0,l.useContext)(y),[P,B]=(0,l.useState)(null),F=(0,l.useRef)(null),D=(0,u.useSyncRefs)(F,t,null===L?null:L.setSwitch,B),z=(0,i.useDefaultValue)(E),[H,G]=(0,s.useControllable)(T,I,null!=z&&z),V=(0,n.useDisposables)(),[q,X]=(0,l.useState)(!1),U=(0,d.useEvent)(()=>{X(!0),null==G||G(!H),V.nextFrame(()=>{X(!1)})}),W=(0,d.useEvent)(e=>{if((0,b.isDisabledReactIssue7711)(e.currentTarget))return e.preventDefault();e.preventDefault(),U()}),Y=(0,d.useEvent)(e=>{e.key===v.Keys.Space?(e.preventDefault(),U()):e.key===v.Keys.Enter&&(0,f.attemptSubmit)(e.currentTarget)}),K=(0,d.useEvent)(e=>e.preventDefault()),J=(0,C.useLabelledBy)(),Z=(0,x.useDescribedBy)(),{isFocusVisible:Q,focusProps:ee}=(0,r.useFocusRing)({autoFocus:$}),{isHovered:et,hoverProps:er}=(0,a.useHover)({isDisabled:_}),{pressed:ea,pressProps:el}=(0,o.useActivePress)({disabled:_}),eo=(0,l.useMemo)(()=>({checked:H,disabled:_,hover:et,focus:Q,active:ea,autofocus:$,changing:q}),[H,et,Q,ea,_,q,$]),es=(0,h.mergeProps)({id:j,ref:D,role:"switch",type:(0,c.useResolveButtonType)(e,P),tabIndex:-1===e.tabIndex?0:null!=(k=e.tabIndex)?k:0,"aria-checked":H,"aria-labelledby":J,"aria-describedby":Z,disabled:_||void 0,autoFocus:$,onClick:W,onKeyUp:Y,onKeyPress:K},ee,er,el),ei=(0,l.useCallback)(()=>{if(void 0!==z)return null==G?void 0:G(z)},[G,z]),en=(0,h.useRender)();return l.default.createElement(l.default.Fragment,null,null!=O&&l.default.createElement(g.FormFields,{disabled:_,data:{[O]:M||"on"},overrides:{type:"checkbox",checked:H},form:S,onReset:ei}),en({ourProps:es,theirProps:R,slot:eo,defaultTag:"button",name:"Switch"}))}),{Group:function(e){var t;let[r,a]=(0,l.useState)(null),[o,s]=(0,C.useLabels)(),[i,n]=(0,x.useDescriptions)(),d=(0,l.useMemo)(()=>({switch:r,setSwitch:a}),[r,a]),c=(0,h.useRender)();return l.default.createElement(n,{name:"Switch.Description",value:i},l.default.createElement(s,{name:"Switch.Label",value:o,props:{htmlFor:null==(t=d.switch)?void 0:t.id,onClick(e){r&&(e.currentTarget instanceof HTMLLabelElement&&e.preventDefault(),r.click(),r.focus({preventScroll:!0}))}}},l.default.createElement(y.Provider,{value:d},c({ourProps:{},theirProps:e,slot:{},defaultTag:k,name:"Switch.Group"}))))},Label:C.Label,Description:x.Description});var A=e.i(888288),N=e.i(95779),j=e.i(444755),_=e.i(673706),T=e.i(829087);let E=(0,_.makeClassName)("Switch"),I=l.default.forwardRef((e,r)=>{let{checked:a,defaultChecked:o=!1,onChange:s,color:i,name:n,error:d,errorMessage:c,disabled:u,required:m,tooltip:g,id:p}=e,b=(0,t.__rest)(e,["checked","defaultChecked","onChange","color","name","error","errorMessage","disabled","required","tooltip","id"]),f={bgColor:i?(0,_.getColorClassNames)(i,N.colorPalette.background).bgColor:"bg-tremor-brand dark:bg-dark-tremor-brand",ringColor:i?(0,_.getColorClassNames)(i,N.colorPalette.ring).ringColor:"ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted"},[h,x]=(0,A.default)(o,a),[v,C]=(0,l.useState)(!1),{tooltipProps:y,getReferenceProps:k}=(0,T.useTooltip)(300);return l.default.createElement("div",{className:"flex flex-row items-center justify-start"},l.default.createElement(T.default,Object.assign({text:g},y)),l.default.createElement("div",Object.assign({ref:(0,_.mergeRefs)([r,y.refs.setReference]),className:(0,j.tremorTwMerge)(E("root"),"flex flex-row relative h-5")},b,k),l.default.createElement("input",{type:"checkbox",className:(0,j.tremorTwMerge)(E("input"),"absolute w-5 h-5 cursor-pointer left-0 top-0 opacity-0"),name:n,required:m,checked:h,onChange:e=>{e.preventDefault()}}),l.default.createElement(w,{checked:h,onChange:e=>{x(e),null==s||s(e)},disabled:u,className:(0,j.tremorTwMerge)(E("switch"),"w-10 h-5 group relative inline-flex shrink-0 cursor-pointer items-center justify-center rounded-tremor-full","focus:outline-none",u?"cursor-not-allowed":""),onFocus:()=>C(!0),onBlur:()=>C(!1),id:p},l.default.createElement("span",{className:(0,j.tremorTwMerge)(E("sr-only"),"sr-only")},"Switch ",h?"on":"off"),l.default.createElement("span",{"aria-hidden":"true",className:(0,j.tremorTwMerge)(E("background"),h?f.bgColor:"bg-tremor-border dark:bg-dark-tremor-border","pointer-events-none absolute mx-auto h-3 w-9 rounded-tremor-full transition-colors duration-100 ease-in-out")}),l.default.createElement("span",{"aria-hidden":"true",className:(0,j.tremorTwMerge)(E("round"),h?(0,j.tremorTwMerge)(f.bgColor,"translate-x-5 border-tremor-background dark:border-dark-tremor-background"):"translate-x-0 bg-tremor-border dark:bg-dark-tremor-border border-tremor-background dark:border-dark-tremor-background","pointer-events-none absolute left-0 inline-block h-5 w-5 transform rounded-tremor-full border-2 shadow-tremor-input duration-100 ease-in-out transition",v?(0,j.tremorTwMerge)("ring-2",f.ringColor):"")}))),d&&c?l.default.createElement("p",{className:(0,j.tremorTwMerge)(E("errorMessage"),"text-sm text-red-500 mt-1 ")},c):null)});I.displayName="Switch",e.s(["Switch",()=>I],793130)},653496,e=>{"use strict";var t=e.i(721369);e.s(["Tabs",()=>t.default])},689020,e=>{"use strict";var t=e.i(764205);let r=async e=>{try{let r=await (0,t.modelHubCall)(e);if(console.log("model_info:",r),r?.data.length>0){let e=r.data.map(e=>({model_group:e.model_group,mode:e?.mode}));return e.sort((e,t)=>e.model_group.localeCompare(t.model_group)),e}return[]}catch(e){throw console.error("Error fetching model info:",e),e}};e.s(["fetchAvailableModels",0,r])},107233,37727,e=>{"use strict";var t=e.i(603908);e.s(["Plus",()=>t.default],107233);var r=e.i(841947);e.s(["X",()=>r.default],37727)},361653,e=>{"use strict";let t=(0,e.i(475254).default)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);e.s(["default",()=>t])},603908,e=>{"use strict";let t=(0,e.i(475254).default)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);e.s(["default",()=>t])},841947,e=>{"use strict";let t=(0,e.i(475254).default)("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);e.s(["default",()=>t])},158392,419470,e=>{"use strict";var t=e.i(843476),r=e.i(779241);let a={ttl:3600,lowest_latency_buffer:0},l=({routingStrategyArgs:e})=>{let l={ttl:"Sliding window to look back over when calculating the average latency of a deployment. Default - 1 hour (in seconds).",lowest_latency_buffer:"Shuffle between deployments within this % of the lowest latency. Default - 0 (i.e. always pick lowest latency)."};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"max-w-3xl",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Latency-Based Configuration"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Fine-tune latency-based routing behavior"})]}),(0,t.jsx)("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2 xl:grid-cols-3",children:Object.entries(e||a).map(([e,a])=>(0,t.jsx)("div",{className:"space-y-2",children:(0,t.jsxs)("label",{className:"block",children:[(0,t.jsx)("span",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:e.replace(/_/g," ")}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-0.5 mb-2",children:l[e]||""}),(0,t.jsx)(r.TextInput,{name:e,defaultValue:"object"==typeof a?JSON.stringify(a,null,2):a?.toString(),className:"font-mono text-sm w-full"})]})},e))})]}),(0,t.jsx)("div",{className:"border-t border-gray-200"})]})},o=({routerSettings:e,routerFieldsMetadata:a})=>(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"max-w-3xl",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Reliability & Retries"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Configure retry logic and failure handling"})]}),(0,t.jsx)("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2 xl:grid-cols-3",children:Object.entries(e).filter(([e,t])=>"fallbacks"!=e&&"context_window_fallbacks"!=e&&"routing_strategy_args"!=e&&"routing_strategy"!=e&&"enable_tag_filtering"!=e).map(([e,l])=>(0,t.jsx)("div",{className:"space-y-2",children:(0,t.jsxs)("label",{className:"block",children:[(0,t.jsx)("span",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:a[e]?.ui_field_name||e}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-0.5 mb-2",children:a[e]?.field_description||""}),(0,t.jsx)(r.TextInput,{name:e,defaultValue:null==l||"null"===l?"":"object"==typeof l?JSON.stringify(l,null,2):l?.toString()||"",placeholder:"—",className:"font-mono text-sm w-full"})]})},e))})]});var s=e.i(199133);let i=({selectedStrategy:e,availableStrategies:r,routingStrategyDescriptions:a,routerFieldsMetadata:l,onStrategyChange:o})=>(0,t.jsxs)("div",{className:"space-y-2 max-w-3xl",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:l.routing_strategy?.ui_field_name||"Routing Strategy"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-0.5 mb-2",children:l.routing_strategy?.field_description||""})]}),(0,t.jsx)("div",{className:"routing-strategy-select max-w-3xl",children:(0,t.jsx)(s.Select,{value:e,onChange:o,style:{width:"100%"},size:"large",children:r.map(e=>(0,t.jsx)(s.Select.Option,{value:e,label:e,children:(0,t.jsxs)("div",{className:"flex flex-col gap-0.5 py-1",children:[(0,t.jsx)("span",{className:"font-mono text-sm font-medium",children:e}),a[e]&&(0,t.jsx)("span",{className:"text-xs text-gray-500 font-normal",children:a[e]})]})},e))})})]});var n=e.i(793130);let d=({enabled:e,routerFieldsMetadata:r,onToggle:a})=>(0,t.jsx)("div",{className:"space-y-3 max-w-3xl",children:(0,t.jsxs)("div",{className:"flex items-start justify-between",children:[(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)("label",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:r.enable_tag_filtering?.ui_field_name||"Enable Tag Filtering"}),(0,t.jsxs)("p",{className:"text-xs text-gray-500 mt-0.5",children:[r.enable_tag_filtering?.field_description||"",r.enable_tag_filtering?.link&&(0,t.jsxs)(t.Fragment,{children:[" ",(0,t.jsx)("a",{href:r.enable_tag_filtering.link,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-800 underline",children:"Learn more"})]})]})]}),(0,t.jsx)(n.Switch,{checked:e,onChange:a,className:"ml-4"})]})});e.s(["default",0,({value:e,onChange:r,routerFieldsMetadata:a,availableRoutingStrategies:s,routingStrategyDescriptions:n})=>(0,t.jsxs)("div",{className:"w-full space-y-8 py-2",children:[(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"max-w-3xl",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Routing Settings"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Configure how requests are routed to deployments"})]}),s.length>0&&(0,t.jsx)(i,{selectedStrategy:e.selectedStrategy||e.routerSettings.routing_strategy||null,availableStrategies:s,routingStrategyDescriptions:n,routerFieldsMetadata:a,onStrategyChange:t=>{r({...e,selectedStrategy:t})}}),(0,t.jsx)(d,{enabled:e.enableTagFiltering,routerFieldsMetadata:a,onToggle:t=>{r({...e,enableTagFiltering:t})}})]}),(0,t.jsx)("div",{className:"border-t border-gray-200"}),"latency-based-routing"===e.selectedStrategy&&(0,t.jsx)(l,{routingStrategyArgs:e.routerSettings.routing_strategy_args}),(0,t.jsx)(o,{routerSettings:e.routerSettings,routerFieldsMetadata:a})]})],158392);var c=e.i(994388),u=e.i(998573),m=e.i(653496),g=e.i(107233),p=e.i(271645),b=e.i(592968),f=e.i(361653),f=f;let h=(0,e.i(475254).default)("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);var x=e.i(37727);function v({group:e,onChange:r,availableModels:a,maxFallbacks:l}){let o=a.filter(t=>t!==e.primaryModel),i=e.fallbackModels.length{let a=[...e.fallbackModels];a.includes(t)&&(a=a.filter(e=>e!==t)),r({...e,primaryModel:t,fallbackModels:a})},showSearch:!0,getPopupContainer:e=>e.parentElement||document.body,filterOption:(e,t)=>(t?.label??"").toLowerCase().includes(e.toLowerCase()),options:a.map(e=>({label:e,value:e}))}),!e.primaryModel&&(0,t.jsxs)("div",{className:"mt-2 flex items-center gap-2 text-amber-600 text-xs bg-amber-50 p-2 rounded",children:[(0,t.jsx)(f.default,{className:"w-4 h-4"}),(0,t.jsx)("span",{children:"Select a model to begin configuring fallbacks"})]})]}),(0,t.jsx)("div",{className:"flex items-center justify-center -my-4 z-10",children:(0,t.jsxs)("div",{className:"bg-indigo-50 text-indigo-500 px-4 py-1 rounded-full text-xs font-bold border border-indigo-100 flex items-center gap-2 shadow-sm",children:[(0,t.jsx)(h,{className:"w-4 h-4"}),"IF FAILS, TRY..."]})}),(0,t.jsxs)("div",{className:`transition-opacity duration-300 ${!e.primaryModel?"opacity-50 pointer-events-none":"opacity-100"}`,children:[(0,t.jsxs)("label",{className:"block text-sm font-semibold text-gray-700 mb-2",children:["Fallback Chain ",(0,t.jsx)("span",{className:"text-red-500",children:"*"}),(0,t.jsxs)("span",{className:"text-xs text-gray-500 font-normal ml-2",children:["(Max ",l," fallbacks at a time)"]})]}),(0,t.jsxs)("div",{className:"bg-gray-50 rounded-xl p-4 border border-gray-200",children:[(0,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsx)(s.Select,{mode:"multiple",className:"w-full",size:"large",placeholder:i?"Select fallback models to add...":`Maximum ${l} fallbacks reached`,value:e.fallbackModels,onChange:t=>{let a=t.slice(0,l);r({...e,fallbackModels:a})},disabled:!e.primaryModel,getPopupContainer:e=>e.parentElement||document.body,options:o.map(e=>({label:e,value:e})),optionRender:(r,a)=>{let l=e.fallbackModels.includes(r.value),o=l?e.fallbackModels.indexOf(r.value)+1:null;return(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[l&&null!==o&&(0,t.jsx)("span",{className:"flex items-center justify-center w-5 h-5 rounded bg-indigo-100 text-indigo-600 text-xs font-bold",children:o}),(0,t.jsx)("span",{children:r.label})]})},maxTagCount:"responsive",maxTagPlaceholder:e=>(0,t.jsx)(b.Tooltip,{styles:{root:{pointerEvents:"none"}},title:e.map(({value:e})=>e).join(", "),children:(0,t.jsxs)("span",{children:["+",e.length," more"]})}),showSearch:!0,filterOption:(e,t)=>(t?.label??"").toLowerCase().includes(e.toLowerCase())}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1 ml-1",children:i?`Search and select multiple models. Selected models will appear below in order. (${e.fallbackModels.length}/${l} used)`:`Maximum ${l} fallbacks reached. Remove some to add more.`})]}),(0,t.jsx)("div",{className:"space-y-2 min-h-[100px]",children:0===e.fallbackModels.length?(0,t.jsxs)("div",{className:"h-32 border-2 border-dashed border-gray-300 rounded-lg flex flex-col items-center justify-center text-gray-400",children:[(0,t.jsx)("span",{className:"text-sm",children:"No fallback models selected"}),(0,t.jsx)("span",{className:"text-xs mt-1",children:"Add models from the dropdown above"})]}):e.fallbackModels.map((a,l)=>(0,t.jsxs)("div",{className:"group flex items-center justify-between p-3 bg-white rounded-lg border border-gray-200 hover:border-indigo-300 hover:shadow-sm transition-all",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"flex items-center justify-center w-6 h-6 rounded bg-gray-100 text-gray-400 group-hover:text-indigo-500 group-hover:bg-indigo-50",children:(0,t.jsx)("span",{className:"text-xs font-bold",children:l+1})}),(0,t.jsx)("div",{children:(0,t.jsx)("span",{className:"font-medium text-gray-800",children:a})})]}),(0,t.jsx)("button",{type:"button",onClick:()=>{let t;return t=e.fallbackModels.filter((e,t)=>t!==l),void r({...e,fallbackModels:t})},className:"opacity-0 group-hover:opacity-100 transition-opacity text-gray-400 hover:text-red-500 p-1",children:(0,t.jsx)(x.X,{className:"w-4 h-4"})})]},`${a}-${l}`))})]})]})]})}function C({groups:e,onGroupsChange:r,availableModels:a,maxFallbacks:l=10,maxGroups:o=5}){let[s,i]=(0,p.useState)(e.length>0?e[0].id:"1");(0,p.useEffect)(()=>{e.length>0?e.some(e=>e.id===s)||i(e[0].id):i("1")},[e]);let n=()=>{if(e.length>=o)return;let t=Date.now().toString();r([...e,{id:t,primaryModel:null,fallbackModels:[]}]),i(t)},d=t=>{r(e.map(e=>e.id===t.id?t:e))},b=e.map((r,o)=>{let s=r.primaryModel?r.primaryModel:`Group ${o+1}`;return{key:r.id,label:s,closable:e.length>1,children:(0,t.jsx)(v,{group:r,onChange:d,availableModels:a,maxFallbacks:l})}});return 0===e.length?(0,t.jsxs)("div",{className:"text-center py-12 bg-gray-50 rounded-lg border border-dashed border-gray-300",children:[(0,t.jsx)("p",{className:"text-gray-500 mb-4",children:"No fallback groups configured"}),(0,t.jsx)(c.Button,{variant:"primary",onClick:n,icon:()=>(0,t.jsx)(g.Plus,{className:"w-4 h-4"}),children:"Create First Group"})]}):(0,t.jsx)(m.Tabs,{type:"editable-card",activeKey:s,onChange:i,onEdit:(t,a)=>{"add"===a?n():"remove"===a&&e.length>1&&(t=>{if(1===e.length)return u.message.warning("At least one group is required");let a=e.filter(e=>e.id!==t);r(a),s===t&&a.length>0&&i(a[a.length-1].id)})(t)},items:b,className:"fallback-tabs",tabBarStyle:{marginBottom:0},hideAdd:e.length>=o})}e.s(["FallbackSelectionForm",()=>C],419470)},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)},599724,936325,e=>{"use strict";var t=e.i(95779),r=e.i(444755),a=e.i(673706),l=e.i(271645);let o=l.default.forwardRef((e,o)=>{let{color:s,className:i,children:n}=e;return l.default.createElement("p",{ref:o,className:(0,r.tremorTwMerge)("text-tremor-default",s?(0,a.getColorClassNames)(s,t.colorPalette.text).textColor:(0,r.tremorTwMerge)("text-tremor-content","dark:text-dark-tremor-content"),i)},n)});o.displayName="Text",e.s(["default",()=>o],936325),e.s(["Text",()=>o],599724)},304967,e=>{"use strict";var t=e.i(290571),r=e.i(271645),a=e.i(480731),l=e.i(95779),o=e.i(444755),s=e.i(673706);let i=(0,s.makeClassName)("Card"),n=r.default.forwardRef((e,n)=>{let{decoration:d="",decorationColor:c,children:u,className:m}=e,g=(0,t.__rest)(e,["decoration","decorationColor","children","className"]);return r.default.createElement("div",Object.assign({ref:n,className:(0,o.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,s.getColorClassNames)(c,l.colorPalette.border).borderColor:"border-tremor-brand dark:border-dark-tremor-brand",(e=>{if(!e)return"";switch(e){case a.HorizontalPositions.Left:return"border-l-4";case a.VerticalPositions.Top:return"border-t-4";case a.HorizontalPositions.Right:return"border-r-4";case a.VerticalPositions.Bottom:return"border-b-4";default:return""}})(d),m)},g),u)});n.displayName="Card",e.s(["Card",()=>n],304967)},994388,e=>{"use strict";var t=e.i(290571),r=e.i(829087),a=e.i(271645);let l=["preEnter","entering","entered","preExit","exiting","exited","unmounted"],o=e=>({_s:e,status:l[e],isEnter:e<3,isMounted:6!==e,isResolved:2===e||e>4}),s=e=>e?6:5,i=(e,t,r,a,l)=>{clearTimeout(a.current);let s=o(e);t(s),r.current=s,l&&l({current:s})};var n=e.i(480731),d=e.i(444755),c=e.i(673706);let u=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 g={xs:{height:"h-4",width:"w-4"},sm:{height:"h-5",width:"w-5"},md:{height:"h-5",width:"w-5"},lg:{height:"h-6",width:"w-6"},xl:{height:"h-6",width:"w-6"}},p=(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:""}}},b=(0,c.makeClassName)("Button"),f=({loading:e,iconSize:t,iconPosition:r,Icon:l,needMargin:o,transitionStatus:s})=>{let i=o?r===n.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(u,{className:(0,d.tremorTwMerge)(b("icon"),"animate-spin shrink-0",i,m.default,m[s]),style:{transition:"width 150ms"}}):a.default.createElement(l,{className:(0,d.tremorTwMerge)(b("icon"),"shrink-0",t,i)})},h=a.default.forwardRef((e,l)=>{let{icon:u,iconPosition:m=n.HorizontalPositions.Left,size:h=n.Sizes.SM,color:x,variant:v="primary",disabled:C,loading:y=!1,loadingText:k,children:w,tooltip:A,className:N}=e,j=(0,t.__rest)(e,["icon","iconPosition","size","color","variant","disabled","loading","loadingText","children","tooltip","className"]),_=y||C,T=void 0!==u||y,E=y&&k,I=!(!w&&!E),O=(0,d.tremorTwMerge)(g[h].height,g[h].width),M="light"!==v?(0,d.tremorTwMerge)("rounded-tremor-default border","shadow-tremor-input","dark:shadow-dark-tremor-input"):"",S=p(v,x),$=("light"!==v?{xs:{paddingX:"px-2.5",paddingY:"py-1.5",fontSize:"text-xs"},sm:{paddingX:"px-4",paddingY:"py-2",fontSize:"text-sm"},md:{paddingX:"px-4",paddingY:"py-2",fontSize:"text-md"},lg:{paddingX:"px-4",paddingY:"py-2.5",fontSize:"text-lg"},xl:{paddingX:"px-4",paddingY:"py-3",fontSize:"text-xl"}}:{xs:{paddingX:"",paddingY:"",fontSize:"text-xs"},sm:{paddingX:"",paddingY:"",fontSize:"text-sm"},md:{paddingX:"",paddingY:"",fontSize:"text-md"},lg:{paddingX:"",paddingY:"",fontSize:"text-lg"},xl:{paddingX:"",paddingY:"",fontSize:"text-xl"}})[h],{tooltipProps:R,getReferenceProps:L}=(0,r.useTooltip)(300),[P,B]=(({enter:e=!0,exit:t=!0,preEnter:r,preExit:l,timeout:n,initialEntered:d,mountOnEnter:c,unmountOnExit:u,onStateChange:m}={})=>{let[g,p]=(0,a.useState)(()=>o(d?2:s(c))),b=(0,a.useRef)(g),f=(0,a.useRef)(0),[h,x]="object"==typeof n?[n.enter,n.exit]:[n,n],v=(0,a.useCallback)(()=>{let e=((e,t)=>{switch(e){case 1:case 0:return 2;case 4:case 3:return s(t)}})(b.current._s,u);e&&i(e,p,b,f,m)},[m,u]);return[g,(0,a.useCallback)(a=>{let o=e=>{switch(i(e,p,b,f,m),e){case 1:h>=0&&(f.current=((...e)=>setTimeout(...e))(v,h));break;case 4:x>=0&&(f.current=((...e)=>setTimeout(...e))(v,x));break;case 0:case 3:f.current=((...e)=>setTimeout(...e))(()=>{isNaN(document.body.offsetTop)||o(e+1)},0)}},n=b.current.isEnter;"boolean"!=typeof a&&(a=!n),a?n||o(e?+!r:2):n&&o(t?l?3:4:s(u))},[v,m,e,t,r,l,h,x,u]),v]})({timeout:50});return(0,a.useEffect)(()=>{B(y)},[y]),a.default.createElement("button",Object.assign({ref:(0,c.mergeRefs)([l,R.refs.setReference]),className:(0,d.tremorTwMerge)(b("root"),"shrink-0 inline-flex justify-center items-center group font-medium outline-none",M,$.paddingX,$.paddingY,$.fontSize,S.textColor,S.bgColor,S.borderColor,S.hoverBorderColor,_?"opacity-50 cursor-not-allowed":(0,d.tremorTwMerge)(p(v,x).hoverTextColor,p(v,x).hoverBgColor,p(v,x).hoverBorderColor),N),disabled:_},L,j),a.default.createElement(r.default,Object.assign({text:A},R)),T&&m!==n.HorizontalPositions.Right?a.default.createElement(f,{loading:y,iconSize:O,iconPosition:m,Icon:u,transitionStatus:P.status,needMargin:I}):null,E||w?a.default.createElement("span",{className:(0,d.tremorTwMerge)(b("text"),"text-tremor-default whitespace-nowrap")},E?k:w):null,T&&m===n.HorizontalPositions.Right?a.default.createElement(f,{loading:y,iconSize:O,iconPosition:m,Icon:u,transitionStatus:P.status,needMargin:I}):null)});h.displayName="Button",e.s(["Button",()=>h],994388)},185793,e=>{"use strict";e.i(247167);var t=e.i(271645),r=e.i(343794),a=e.i(242064),l=e.i(529681);let o=e=>{let{prefixCls:a,className:l,style:o,size:s,shape:i}=e,n=(0,r.default)({[`${a}-lg`]:"large"===s,[`${a}-sm`]:"small"===s}),d=(0,r.default)({[`${a}-circle`]:"circle"===i,[`${a}-square`]:"square"===i,[`${a}-round`]:"round"===i}),c=t.useMemo(()=>"number"==typeof s?{width:s,height:s,lineHeight:`${s}px`}:{},[s]);return t.createElement("span",{className:(0,r.default)(a,n,d,l),style:Object.assign(Object.assign({},c),o)})};e.i(296059);var s=e.i(694758),i=e.i(915654),n=e.i(246422),d=e.i(838378);let c=new s.Keyframes("ant-skeleton-loading",{"0%":{backgroundPosition:"100% 50%"},"100%":{backgroundPosition:"0 50%"}}),u=e=>({height:e,lineHeight:(0,i.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)),p=e=>Object.assign({width:e},u(e)),b=(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()},u(e)),h=(0,n.genStyleHooks)("Skeleton",e=>{let{componentCls:t,calc:r}=e;return(e=>{let{componentCls:t,skeletonAvatarCls:r,skeletonTitleCls:a,skeletonParagraphCls:l,skeletonButtonCls:o,skeletonInputCls:s,skeletonImageCls:i,controlHeight:n,controlHeightLG:d,controlHeightSM:u,gradientFromColor:h,padding:x,marginSM:v,borderRadius:C,titleHeight:y,blockRadius:k,paragraphLiHeight:w,controlHeightXS:A,paragraphMarginTop:N}=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(n)),[`${r}-circle`]:{borderRadius:"50%"},[`${r}-lg`]:Object.assign({},m(d)),[`${r}-sm`]:Object.assign({},m(u))},[`${t}-content`]:{display:"table-cell",width:"100%",verticalAlign:"top",[a]:{width:"100%",height:y,background:h,borderRadius:k,[`+ ${l}`]:{marginBlockStart:u}},[l]:{padding:0,"> li":{width:"100%",height:w,listStyle:"none",background:h,borderRadius:k,"+ li":{marginBlockStart:A}}},[`${l}> li:last-child:not(:first-child):not(:nth-child(2))`]:{width:"61%"}},[`&-round ${t}-content`]:{[`${a}, ${l} > li`]:{borderRadius:C}}},[`${t}-with-avatar ${t}-content`]:{[a]:{marginBlockStart:v,[`+ ${l}`]:{marginBlockStart:N}}},[`${t}${t}-element`]:Object.assign(Object.assign(Object.assign(Object.assign({display:"inline-block",width:"auto"},(e=>{let{borderRadiusSM:t,skeletonButtonCls:r,controlHeight:a,controlHeightLG:l,controlHeightSM:o,gradientFromColor:s,calc:i}=e;return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({[r]:Object.assign({display:"inline-block",verticalAlign:"top",background:s,borderRadius:t,width:i(a).mul(2).equal(),minWidth:i(a).mul(2).equal()},f(a,i))},b(e,a,r)),{[`${r}-lg`]:Object.assign({},f(l,i))}),b(e,l,`${r}-lg`)),{[`${r}-sm`]:Object.assign({},f(o,i))}),b(e,o,`${r}-sm`))})(e)),(e=>{let{skeletonAvatarCls:t,gradientFromColor:r,controlHeight:a,controlHeightLG:l,controlHeightSM:o}=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(l)),[`${t}${t}-sm`]:Object.assign({},m(o))}})(e)),(e=>{let{controlHeight:t,borderRadiusSM:r,skeletonInputCls:a,controlHeightLG:l,controlHeightSM:o,gradientFromColor:s,calc:i}=e;return{[a]:Object.assign({display:"inline-block",verticalAlign:"top",background:s,borderRadius:r},g(t,i)),[`${a}-lg`]:Object.assign({},g(l,i)),[`${a}-sm`]:Object.assign({},g(o,i))}})(e)),(e=>{let{skeletonImageCls:t,imageSizeBase:r,gradientFromColor:a,borderRadiusSM:l,calc:o}=e;return{[t]:Object.assign(Object.assign({display:"inline-flex",alignItems:"center",justifyContent:"center",verticalAlign:"middle",background:a,borderRadius:l},p(o(r).mul(2).equal())),{[`${t}-path`]:{fill:"#bfbfbf"},[`${t}-svg`]:Object.assign(Object.assign({},p(r)),{maxWidth:o(r).mul(4).equal(),maxHeight:o(r).mul(4).equal()}),[`${t}-svg${t}-svg-circle`]:{borderRadius:"50%"}}),[`${t}${t}-circle`]:{borderRadius:"50%"}}})(e)),[`${t}${t}-block`]:{width:"100%",[o]:{width:"100%"},[s]:{width:"100%"}},[`${t}${t}-active`]:{[` ${a}, ${l} > li, ${r}, ${o}, ${s}, ${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:l,style:o,rows:s=0}=e,i=Array.from({length:s}).map((r,a)=>t.createElement("li",{key:a,style:{width:((e,t)=>{let{width:r,rows:a=2}=t;return Array.isArray(r)?r[e]:a-1===e?r:void 0})(a,e)}}));return t.createElement("ul",{className:(0,r.default)(a,l),style:o},i)},v=({prefixCls:e,className:a,width:l,style:o})=>t.createElement("h3",{className:(0,r.default)(e,a),style:Object.assign({width:l},o)});function C(e){return e&&"object"==typeof e?e:{}}let y=e=>{let{prefixCls:l,loading:s,className:i,rootClassName:n,style:d,children:c,avatar:u=!1,title:m=!0,paragraph:g=!0,active:p,round:f}=e,{getPrefixCls:b,direction:y,className:k,style:w}=(0,a.useComponentConfig)("skeleton"),A=b("skeleton",l),[N,j,_]=h(A);if(s||!("loading"in e)){let e,a,l=!!u,s=!!m,c=!!g;if(l){let r=Object.assign(Object.assign({prefixCls:`${A}-avatar`},s&&!c?{size:"large",shape:"square"}:{size:"large",shape:"circle"}),C(u));e=t.createElement("div",{className:`${A}-header`},t.createElement(o,Object.assign({},r)))}if(s||c){let e,r;if(s){let r=Object.assign(Object.assign({prefixCls:`${A}-title`},!l&&c?{width:"38%"}:l&&c?{width:"50%"}:{}),C(m));e=t.createElement(v,Object.assign({},r))}if(c){let e,a=Object.assign(Object.assign({prefixCls:`${A}-paragraph`},(e={},l&&s||(e.width="61%"),!l&&s?e.rows=3:e.rows=2,e)),C(g));r=t.createElement(x,Object.assign({},a))}a=t.createElement("div",{className:`${A}-content`},e,r)}let b=(0,r.default)(A,{[`${A}-with-avatar`]:l,[`${A}-active`]:p,[`${A}-rtl`]:"rtl"===y,[`${A}-round`]:f},k,i,n,j,_);return N(t.createElement("div",{className:b,style:Object.assign(Object.assign({},w),d)},e,a))}return null!=c?c:null};y.Button=e=>{let{prefixCls:s,className:i,rootClassName:n,active:d,block:c=!1,size:u="default"}=e,{getPrefixCls:m}=t.useContext(a.ConfigContext),g=m("skeleton",s),[p,f,b]=h(g),x=(0,l.default)(e,["prefixCls"]),v=(0,r.default)(g,`${g}-element`,{[`${g}-active`]:d,[`${g}-block`]:c},i,n,f,b);return p(t.createElement("div",{className:v},t.createElement(o,Object.assign({prefixCls:`${g}-button`,size:u},x))))},y.Avatar=e=>{let{prefixCls:s,className:i,rootClassName:n,active:d,shape:c="circle",size:u="default"}=e,{getPrefixCls:m}=t.useContext(a.ConfigContext),g=m("skeleton",s),[p,f,b]=h(g),x=(0,l.default)(e,["prefixCls","className"]),v=(0,r.default)(g,`${g}-element`,{[`${g}-active`]:d},i,n,f,b);return p(t.createElement("div",{className:v},t.createElement(o,Object.assign({prefixCls:`${g}-avatar`,shape:c,size:u},x))))},y.Input=e=>{let{prefixCls:s,className:i,rootClassName:n,active:d,block:c,size:u="default"}=e,{getPrefixCls:m}=t.useContext(a.ConfigContext),g=m("skeleton",s),[p,f,b]=h(g),x=(0,l.default)(e,["prefixCls"]),v=(0,r.default)(g,`${g}-element`,{[`${g}-active`]:d,[`${g}-block`]:c},i,n,f,b);return p(t.createElement("div",{className:v},t.createElement(o,Object.assign({prefixCls:`${g}-input`,size:u},x))))},y.Image=e=>{let{prefixCls:l,className:o,rootClassName:s,style:i,active:n}=e,{getPrefixCls:d}=t.useContext(a.ConfigContext),c=d("skeleton",l),[u,m,g]=h(c),p=(0,r.default)(c,`${c}-element`,{[`${c}-active`]:n},o,s,m,g);return u(t.createElement("div",{className:p},t.createElement("div",{className:(0,r.default)(`${c}-image`,o),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`})))))},y.Node=e=>{let{prefixCls:l,className:o,rootClassName:s,style:i,active:n,children:d}=e,{getPrefixCls:c}=t.useContext(a.ConfigContext),u=c("skeleton",l),[m,g,p]=h(u),f=(0,r.default)(u,`${u}-element`,{[`${u}-active`]:n},g,o,s,p);return m(t.createElement("div",{className:f},t.createElement("div",{className:(0,r.default)(`${u}-image`,o),style:i},d)))},e.s(["default",0,y],185793)},959013,e=>{"use strict";e.i(247167);var t=e.i(931067),r=e.i(271645);let a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"}},{tag:"path",attrs:{d:"M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z"}}]},name:"plus",theme:"outlined"};var l=e.i(9583),o=r.forwardRef(function(e,o){return r.createElement(l.default,(0,t.default)({},e,{ref:o,icon:a}))});e.s(["default",0,o],959013)},269200,e=>{"use strict";var t=e.i(290571),r=e.i(271645),a=e.i(444755);let l=(0,e.i(673706).makeClassName)("Table"),o=r.default.forwardRef((e,o)=>{let{children:s,className:i}=e,n=(0,t.__rest)(e,["children","className"]);return r.default.createElement("div",{className:(0,a.tremorTwMerge)(l("root"),"overflow-auto",i)},r.default.createElement("table",Object.assign({ref:o,className:(0,a.tremorTwMerge)(l("table"),"w-full text-tremor-default","text-tremor-content","dark:text-dark-tremor-content")},n),s))});o.displayName="Table",e.s(["Table",()=>o],269200)},427612,e=>{"use strict";var t=e.i(290571),r=e.i(271645),a=e.i(444755);let l=(0,e.i(673706).makeClassName)("TableHead"),o=r.default.forwardRef((e,o)=>{let{children:s,className:i}=e,n=(0,t.__rest)(e,["children","className"]);return r.default.createElement(r.default.Fragment,null,r.default.createElement("thead",Object.assign({ref:o,className:(0,a.tremorTwMerge)(l("root"),"text-left","text-tremor-content","dark:text-dark-tremor-content",i)},n),s))});o.displayName="TableHead",e.s(["TableHead",()=>o],427612)},496020,e=>{"use strict";var t=e.i(290571),r=e.i(271645),a=e.i(444755);let l=(0,e.i(673706).makeClassName)("TableRow"),o=r.default.forwardRef((e,o)=>{let{children:s,className:i}=e,n=(0,t.__rest)(e,["children","className"]);return r.default.createElement(r.default.Fragment,null,r.default.createElement("tr",Object.assign({ref:o,className:(0,a.tremorTwMerge)(l("row"),i)},n),s))});o.displayName="TableRow",e.s(["TableRow",()=>o],496020)},64848,e=>{"use strict";var t=e.i(290571),r=e.i(271645),a=e.i(444755);let l=(0,e.i(673706).makeClassName)("TableHeaderCell"),o=r.default.forwardRef((e,o)=>{let{children:s,className:i}=e,n=(0,t.__rest)(e,["children","className"]);return r.default.createElement(r.default.Fragment,null,r.default.createElement("th",Object.assign({ref:o,className:(0,a.tremorTwMerge)(l("root"),"whitespace-nowrap text-left font-semibold top-0 px-4 py-3.5","text-tremor-content-strong","dark:text-dark-tremor-content-strong",i)},n),s))});o.displayName="TableHeaderCell",e.s(["TableHeaderCell",()=>o],64848)},977572,e=>{"use strict";var t=e.i(290571),r=e.i(271645),a=e.i(444755);let l=(0,e.i(673706).makeClassName)("TableCell"),o=r.default.forwardRef((e,o)=>{let{children:s,className:i}=e,n=(0,t.__rest)(e,["children","className"]);return r.default.createElement(r.default.Fragment,null,r.default.createElement("td",Object.assign({ref:o,className:(0,a.tremorTwMerge)(l("root"),"align-middle whitespace-nowrap text-left p-4",i)},n),s))});o.displayName="TableCell",e.s(["TableCell",()=>o],977572)},942232,e=>{"use strict";var t=e.i(290571),r=e.i(271645),a=e.i(444755);let l=(0,e.i(673706).makeClassName)("TableBody"),o=r.default.forwardRef((e,o)=>{let{children:s,className:i}=e,n=(0,t.__rest)(e,["children","className"]);return r.default.createElement(r.default.Fragment,null,r.default.createElement("tbody",Object.assign({ref:o,className:(0,a.tremorTwMerge)(l("root"),"align-top divide-y","divide-tremor-border","dark:divide-dark-tremor-border",i)},n),s))});o.displayName="TableBody",e.s(["TableBody",()=>o],942232)},728889,e=>{"use strict";var t=e.i(290571),r=e.i(271645),a=e.i(829087),l=e.i(480731),o=e.i(444755),s=e.i(673706),i=e.i(95779);let n={xs:{paddingX:"px-1.5",paddingY:"py-1.5"},sm:{paddingX:"px-1.5",paddingY:"py-1.5"},md:{paddingX:"px-2",paddingY:"py-2"},lg:{paddingX:"px-2",paddingY:"py-2"},xl:{paddingX:"px-2.5",paddingY:"py-2.5"}},d={xs:{height:"h-3",width:"w-3"},sm:{height:"h-5",width:"w-5"},md:{height:"h-5",width:"w-5"},lg:{height:"h-7",width:"w-7"},xl:{height:"h-9",width:"w-9"}},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:""}},u=(0,s.makeClassName)("Icon"),m=r.default.forwardRef((e,m)=>{let{icon:g,variant:p="simple",tooltip:f,size:b=l.Sizes.SM,color:h,className:x}=e,v=(0,t.__rest)(e,["icon","variant","tooltip","size","color","className"]),C=((e,t)=>{switch(e){case"simple":return{textColor:t?(0,s.getColorClassNames)(t,i.colorPalette.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:"",borderColor:"",ringColor:""};case"light":return{textColor:t?(0,s.getColorClassNames)(t,i.colorPalette.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:t?(0,o.tremorTwMerge)((0,s.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,s.getColorClassNames)(t,i.colorPalette.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:t?(0,o.tremorTwMerge)((0,s.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,s.getColorClassNames)(t,i.colorPalette.text).textColor:"text-tremor-brand-inverted dark:text-dark-tremor-brand-inverted",bgColor:t?(0,o.tremorTwMerge)((0,s.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,s.getColorClassNames)(t,i.colorPalette.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:t?(0,o.tremorTwMerge)((0,s.getColorClassNames)(t,i.colorPalette.background).bgColor,"bg-opacity-20"):"bg-tremor-background dark:bg-dark-tremor-background",borderColor:t?(0,s.getColorClassNames)(t,i.colorPalette.ring).borderColor:"border-tremor-brand-subtle dark:border-dark-tremor-brand-subtle",ringColor:t?(0,o.tremorTwMerge)((0,s.getColorClassNames)(t,i.colorPalette.ring).ringColor,"ring-opacity-40"):"ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted"}}})(p,h),{tooltipProps:y,getReferenceProps:k}=(0,a.useTooltip)();return r.default.createElement("span",Object.assign({ref:(0,s.mergeRefs)([m,y.refs.setReference]),className:(0,o.tremorTwMerge)(u("root"),"inline-flex shrink-0 items-center justify-center",C.bgColor,C.textColor,C.borderColor,C.ringColor,c[p].rounded,c[p].border,c[p].shadow,c[p].ring,n[b].paddingX,n[b].paddingY,x)},k,v),r.default.createElement(a.default,Object.assign({text:f},y)),r.default.createElement(g,{className:(0,o.tremorTwMerge)(u("icon"),"shrink-0",d[b].height,d[b].width)}))});m.displayName="Icon",e.s(["default",()=>m],728889)},752978,e=>{"use strict";var t=e.i(728889);e.s(["Icon",()=>t.default])},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)},418371,e=>{"use strict";var t=e.i(843476),r=e.i(271645),a=e.i(916925);e.s(["ProviderLogo",0,({provider:e,className:l="w-4 h-4"})=>{let[o,s]=(0,r.useState)(!1),{logo:i}=(0,a.getProviderLogoAndName)(e);return o||!i?(0,t.jsx)("div",{className:`${l} rounded-full bg-gray-200 flex items-center justify-center text-xs`,children:e?.charAt(0)||"-"}):(0,t.jsx)("img",{src:i,alt:`${e} logo`,className:l,onError:()=>s(!0)})}])},368670,e=>{"use strict";var t=e.i(764205),r=e.i(266027);let a=(0,e.i(243652).createQueryKeys)("modelCostMap");e.s(["useModelCostMap",0,()=>(0,r.useQuery)({queryKey:a.list({}),queryFn:async()=>await (0,t.modelCostMap)(),staleTime:6e4,gcTime:6e4})])},226898,972520,e=>{"use strict";var t=e.i(843476),r=e.i(271645),a=e.i(304967),l=e.i(269200),o=e.i(427612),s=e.i(496020),i=e.i(389083),n=e.i(64848),d=e.i(977572),c=e.i(942232),u=e.i(599724),m=e.i(994388),g=e.i(752978),p=e.i(793130),f=e.i(404206),b=e.i(723731),h=e.i(653824),x=e.i(881073),v=e.i(197647),C=e.i(764205),y=e.i(28651),k=e.i(68155),w=e.i(220508),A=e.i(727749),N=e.i(158392);let j=({accessToken:e,userRole:a,userID:l,modelData:o})=>{let[s,i]=(0,r.useState)({routerSettings:{},selectedStrategy:null,enableTagFiltering:!1}),[n,d]=(0,r.useState)([]),[c,u]=(0,r.useState)({}),[g,p]=(0,r.useState)({});return((0,r.useEffect)(()=>{e&&a&&l&&((0,C.getCallbacksCall)(e,l,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 r=t.routing_strategy||null;i(e=>({...e,routerSettings:t,selectedStrategy:r}))}),(0,C.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 r=e.fields.find(e=>"routing_strategy"===e.field_name);r?.options&&d(r.options),e.routing_strategy_descriptions&&p(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&&i(e=>({...e,enableTagFiltering:a.field_value}))}}))},[e,a,l]),e)?(0,t.jsxs)("div",{className:"w-full",children:[(0,t.jsx)(N.default,{value:s,onChange:i,routerFieldsMetadata:c,availableRoutingStrategies:n,routingStrategyDescriptions:g}),(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=s.routerSettings;console.log("router_settings",t);let r=new Set(["allowed_fails","cooldown_time","num_retries","timeout","retry_after"]),a=new Set(["model_group_alias","retry_policy"]),l=Object.fromEntries(Object.entries({...t,enable_tag_filtering:s.enableTagFiltering}).map(([e,t])=>{if("routing_strategy_args"!==e&&"routing_strategy"!==e&&"enable_tag_filtering"!==e){let l=document.querySelector(`input[name="${e}"]`),o=((e,t,l)=>{if(void 0===t)return l;let o=t.trim();if("null"===o.toLowerCase())return null;if(r.has(e)){let e=Number(o);return Number.isNaN(e)?l:e}if(a.has(e)){if(""===o)return null;try{return JSON.parse(o)}catch{return l}}return"true"===o.toLowerCase()||"false"!==o.toLowerCase()&&o})(e,l?.value,t);return[e,o]}if("routing_strategy"===e)return[e,s.selectedStrategy];if("enable_tag_filtering"===e)return[e,s.enableTagFiltering];if("routing_strategy_args"===e&&"latency-based-routing"===s.selectedStrategy){let e={},t=document.querySelector('input[name="lowest_latency_buffer"]'),r=document.querySelector('input[name="ttl"]');return t?.value&&(e.lowest_latency_buffer=Number(t.value)),r?.value&&(e.ttl=Number(r.value)),console.log(`setRoutingStrategyArgs: ${e}`),["routing_strategy_args",e]}return null}).filter(e=>null!=e));console.log("updatedVariables",l);try{(0,C.setCallbacksCall)(e,{router_settings:l})}catch(e){A.default.fromBackend("Failed to update router settings: "+e)}A.default.success("router settings updated successfully")},className:"text-sm font-medium",children:"Save Changes"})]})]}):null};e.i(247167);var _=e.i(368670);let T=r.forwardRef(function(e,t){return r.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14 5l7 7m0 0l-7 7m7-7H3"}))});var E=e.i(122577),I=e.i(592968),O=e.i(898586),M=e.i(356449),S=e.i(127952),$=e.i(418371),R=e.i(464571),L=e.i(998573),P=e.i(689020),B=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 D({open:e,onCancel:r,children:a}){return(0,t.jsx)(B.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:r,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 z=e.i(419470);function H({models:e,accessToken:a,value:l=[],onChange:o}){let[s,i]=(0,r.useState)(!1),[n,d]=(0,r.useState)([]),[c,u]=(0,r.useState)(0),[g,p]=(0,r.useState)(!1),[f,b]=(0,r.useState)([{id:"1",primaryModel:null,fallbackModels:[]}]);(0,r.useEffect)(()=>{s&&(b([{id:"1",primaryModel:null,fallbackModels:[]}]),u(e=>e+1))},[s]),(0,r.useEffect)(()=>{let e=async()=>{try{let e=await (0,P.fetchAvailableModels)(a);console.log("Fetched models for fallbacks:",e),d(e)}catch(e){console.error("Error fetching model info for fallbacks:",e)}};s&&e()},[a,s]);let h=Array.from(new Set(n.map(e=>e.model_group))).sort(),x=()=>{i(!1),b([{id:"1",primaryModel:null,fallbackModels:[]}])},v=async()=>{let e=f.filter(e=>!e.primaryModel||0===e.fallbackModels.length);if(e.length>0)return void L.message.error(`Please complete configuration for all groups. ${e.length} group(s) incomplete.`);let t=[...l||[],...f.map(e=>({[e.primaryModel]:e.fallbackModels}))];if(o){p(!0);try{await o(t),A.default.success(`${f.length} fallback configuration(s) added successfully!`),x()}catch(e){console.error("Error saving fallbacks:",e)}finally{p(!1)}}else A.default.fromBackend("onChange callback not provided")};return(0,t.jsxs)("div",{children:[(0,t.jsx)(m.Button,{className:"mx-auto",onClick:()=>i(!0),icon:()=>(0,t.jsx)("span",{className:"mr-1",children:"+"}),children:"Add Fallbacks"}),(0,t.jsxs)(D,{open:s,onCancel:x,children:[(0,t.jsx)(z.FallbackSelectionForm,{groups:f,onGroupsChange:b,availableModels:h,maxFallbacks:10,maxGroups:5},c),f.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)(R.Button,{type:"default",onClick:x,disabled:g,children:"Cancel"}),(0,t.jsx)(R.Button,{type:"default",onClick:v,disabled:0===f.length||g,loading:g,children:g?"Saving Configuration...":"Save All Configurations"})]})]})]})}let G="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 V(e,r){console.log=function(){};let a=window.location.origin,l=new M.default.OpenAI({apiKey:r,baseURL:a,dangerouslyAllowBrowser:!0});try{A.default.info("Testing fallback model response...");let r=await l.chat.completions.create({model:e,messages:[{role:"user",content:"Hi, this is a test message"}],mock_testing_fallbacks:!0});A.default.success((0,t.jsxs)("span",{children:["Test model=",(0,t.jsx)("strong",{children:e}),", received model=",(0,t.jsx)("strong",{children:r.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){A.default.fromBackend(`Error occurred while generating model response. Please try again. Error: ${e}`)}}let q=({accessToken:e,userRole:a,userID:i,modelData:u})=>{let[m,p]=(0,r.useState)({}),[f,b]=(0,r.useState)(!1),[h,x]=(0,r.useState)(null),[v,y]=(0,r.useState)(!1),{data:w}=(0,_.useModelCostMap)(),N=e=>null!=w&&"object"==typeof w&&e in w?w[e].litellm_provider??"":"";(0,r.useEffect)(()=>{e&&a&&i&&(0,C.getCallbacksCall)(e,i,a).then(e=>{console.log("callbacks",e);let t=e.router_settings;"model_group_retry_policy"in t&&delete t.model_group_retry_policy,p(t)})},[e,a,i]);let j=e=>{x(e),y(!0)},M=async()=>{if(!h||!e)return;let t=Object.keys(h)[0];if(!t)return;b(!0);let r=m.fallbacks.map(e=>{let r={...e};return t in r&&Array.isArray(r[t])&&delete r[t],r}).filter(e=>Object.keys(e).length>0),a={...m,fallbacks:r};try{await (0,C.setCallbacksCall)(e,{router_settings:a}),p(a),A.default.success("Router settings updated successfully")}catch(e){A.default.fromBackend("Failed to update router settings: "+e)}finally{b(!1),y(!1),x(null)}};if(!e)return null;let R=async t=>{if(!e)return;let r={...m,fallbacks:t};try{await (0,C.setCallbacksCall)(e,{router_settings:r}),p(r)}catch(t){throw A.default.fromBackend("Failed to update router settings: "+t),e&&a&&i&&(0,C.getCallbacksCall)(e,i,a).then(e=>{let t=e.router_settings;"model_group_retry_policy"in t&&delete t.model_group_retry_policy,p(t)}),t}},L=Array.isArray(m.fallbacks)&&m.fallbacks.length>0;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(H,{models:u?.data?u.data.map(e=>e.model_name):[],accessToken:e||"",value:m.fallbacks||[],onChange:R}),L?(0,t.jsxs)(l.Table,{children:[(0,t.jsx)(o.TableHead,{children:(0,t.jsxs)(s.TableRow,{children:[(0,t.jsx)(n.TableHeaderCell,{children:"Model Name"}),(0,t.jsx)(n.TableHeaderCell,{children:"Fallbacks"}),(0,t.jsx)(n.TableHeaderCell,{children:"Actions"})]})}),(0,t.jsx)(c.TableBody,{children:m.fallbacks.map((a,l)=>Object.entries(a).map(([o,i])=>{let n;return(0,t.jsxs)(s.TableRow,{children:[(0,t.jsx)(d.TableCell,{className:"align-top",children:(n=N?.(o)??o,(0,t.jsxs)("span",{className:G,children:[(0,t.jsx)($.ProviderLogo,{provider:n,className:"w-4 h-4 shrink-0"}),(0,t.jsx)("span",{children:o})]}))}),(0,t.jsx)(d.TableCell,{className:"align-top",children:function(e,a,l){let o=Array.isArray(a)?a:[];if(0===o.length)return null;let s=({modelName:e})=>{let r=l?.(e)??e;return(0,t.jsxs)("span",{className:G,children:[(0,t.jsx)($.ProviderLogo,{provider:r,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:o.map((e,a)=>(0,t.jsxs)(r.default.Fragment,{children:[a>0&&(0,t.jsx)(g.Icon,{icon:T,size:"xs",className:"shrink-0 text-gray-400"}),(0,t.jsx)(s,{modelName:e})]},e))})]})}(0,Array.isArray(i)?i:[],N)}),(0,t.jsxs)(d.TableCell,{className:"align-top",children:[(0,t.jsx)(I.Tooltip,{title:"Test fallback",children:(0,t.jsx)(g.Icon,{icon:E.PlayIcon,size:"sm",onClick:()=>V(Object.keys(a)[0],e||""),className:"cursor-pointer hover:text-blue-600"})}),(0,t.jsx)(I.Tooltip,{title:"Delete fallback",children:(0,t.jsx)("span",{"data-testid":"delete-fallback-button",role:"button",tabIndex:0,onClick:()=>j(a),onKeyDown:e=>"Enter"===e.key&&j(a),className:"cursor-pointer inline-flex",children:(0,t.jsx)(g.Icon,{icon:k.TrashIcon,size:"sm",className:"hover:text-red-600"})})})]})]},l.toString()+o)}))})]}):(0,t.jsx)("div",{className:"rounded-lg border border-gray-200 bg-gray-50 px-4 py-6 text-center",children:(0,t.jsx)(O.Typography.Text,{type:"secondary",children:"No fallbacks configured. Add fallbacks to automatically try another model when the primary fails."})}),(0,t.jsx)(S.default,{isOpen:v,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:h?Object.keys(h)[0]:"",code:!0}],onCancel:()=>{y(!1),x(null)},onOk:M,confirmLoading:f})]})};e.s(["default",0,({accessToken:e,userRole:A,userID:N,modelData:_})=>{let[T,E]=(0,r.useState)([]);(0,r.useEffect)(()=>{e&&(0,C.getGeneralSettingsCall)(e).then(e=>{E(e)})},[e]);let I=(e,t)=>{E(T.map(r=>r.field_name===e?{...r,field_value:t}:r))};return e?(0,t.jsx)("div",{className:"w-full",children:(0,t.jsxs)(h.TabGroup,{className:"h-[75vh] w-full",children:[(0,t.jsxs)(x.TabList,{variant:"line",defaultValue:"1",className:"px-8 pt-4",children:[(0,t.jsx)(v.Tab,{value:"1",children:"Loadbalancing"}),(0,t.jsx)(v.Tab,{value:"2",children:"Fallbacks"}),(0,t.jsx)(v.Tab,{value:"3",children:"General"})]}),(0,t.jsxs)(b.TabPanels,{className:"px-8 py-6",children:[(0,t.jsx)(f.TabPanel,{children:(0,t.jsx)(j,{accessToken:e,userRole:A,userID:N,modelData:_})}),(0,t.jsx)(f.TabPanel,{children:(0,t.jsx)(q,{accessToken:e,userRole:A,userID:N,modelData:_})}),(0,t.jsx)(f.TabPanel,{children:(0,t.jsx)(a.Card,{children:(0,t.jsxs)(l.Table,{children:[(0,t.jsx)(o.TableHead,{children:(0,t.jsxs)(s.TableRow,{children:[(0,t.jsx)(n.TableHeaderCell,{children:"Setting"}),(0,t.jsx)(n.TableHeaderCell,{children:"Value"}),(0,t.jsx)(n.TableHeaderCell,{children:"Status"}),(0,t.jsx)(n.TableHeaderCell,{children:"Action"})]})}),(0,t.jsx)(c.TableBody,{children:T.filter(e=>"TypedDictionary"!==e.field_type).map((r,a)=>(0,t.jsxs)(s.TableRow,{children:[(0,t.jsxs)(d.TableCell,{children:[(0,t.jsx)(u.Text,{children:r.field_name}),(0,t.jsx)("p",{style:{fontSize:"0.65rem",color:"#808080",fontStyle:"italic"},className:"mt-1",children:r.field_description})]}),(0,t.jsx)(d.TableCell,{children:"Integer"==r.field_type?(0,t.jsx)(y.InputNumber,{step:1,value:r.field_value,onChange:e=>I(r.field_name,e)}):"Boolean"==r.field_type?(0,t.jsx)(p.Switch,{checked:!0===r.field_value||"true"===r.field_value,onChange:e=>I(r.field_name,e)}):null}),(0,t.jsx)(d.TableCell,{children:!0==r.stored_in_db?(0,t.jsx)(i.Badge,{icon:w.CheckCircleIcon,className:"text-white",children:"In DB"}):!1==r.stored_in_db?(0,t.jsx)(i.Badge,{className:"text-gray bg-white outline",children:"In Config"}):(0,t.jsx)(i.Badge,{className:"text-gray bg-white outline",children:"Not Set"})}),(0,t.jsxs)(d.TableCell,{children:[(0,t.jsx)(m.Button,{onClick:()=>((t,r)=>{if(!e)return;let a=T[r].field_value;if(null!=a&&void 0!=a)try{(0,C.updateConfigFieldSetting)(e,t,a);let r=T.map(e=>e.field_name===t?{...e,stored_in_db:!0}:e);E(r)}catch(e){}})(r.field_name,a),children:"Update"}),(0,t.jsx)(g.Icon,{icon:k.TrashIcon,color:"red",onClick:()=>((t,r)=>{if(e)try{(0,C.deleteConfigFieldSetting)(e,t);let r=T.map(e=>e.field_name===t?{...e,stored_in_db:null,field_value:null}:e);E(r)}catch(e){}})(r.field_name,0),children:"Reset"})]})]},a))})]})})})]})]})}):null}],226898)},511715,e=>{"use strict";var t=e.i(843476),r=e.i(226898),a=e.i(135214);e.s(["default",0,()=>{let{accessToken:e,userRole:l,userId:o}=(0,a.default)();return(0,t.jsx)(r.default,{accessToken:e,userRole:l,userID:o,modelData:{}})}])}]); \ No newline at end of file + `]: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:l,style:o,rows:s=0}=e,i=Array.from({length:s}).map((r,a)=>t.createElement("li",{key:a,style:{width:((e,t)=>{let{width:r,rows:a=2}=t;return Array.isArray(r)?r[e]:a-1===e?r:void 0})(a,e)}}));return t.createElement("ul",{className:(0,r.default)(a,l),style:o},i)},v=({prefixCls:e,className:a,width:l,style:o})=>t.createElement("h3",{className:(0,r.default)(e,a),style:Object.assign({width:l},o)});function C(e){return e&&"object"==typeof e?e:{}}let y=e=>{let{prefixCls:l,loading:s,className:i,rootClassName:n,style:d,children:c,avatar:u=!1,title:m=!0,paragraph:g=!0,active:p,round:b}=e,{getPrefixCls:f,direction:y,className:k,style:w}=(0,a.useComponentConfig)("skeleton"),A=f("skeleton",l),[N,j,_]=h(A);if(s||!("loading"in e)){let e,a,l=!!u,s=!!m,c=!!g;if(l){let r=Object.assign(Object.assign({prefixCls:`${A}-avatar`},s&&!c?{size:"large",shape:"square"}:{size:"large",shape:"circle"}),C(u));e=t.createElement("div",{className:`${A}-header`},t.createElement(o,Object.assign({},r)))}if(s||c){let e,r;if(s){let r=Object.assign(Object.assign({prefixCls:`${A}-title`},!l&&c?{width:"38%"}:l&&c?{width:"50%"}:{}),C(m));e=t.createElement(v,Object.assign({},r))}if(c){let e,a=Object.assign(Object.assign({prefixCls:`${A}-paragraph`},(e={},l&&s||(e.width="61%"),!l&&s?e.rows=3:e.rows=2,e)),C(g));r=t.createElement(x,Object.assign({},a))}a=t.createElement("div",{className:`${A}-content`},e,r)}let f=(0,r.default)(A,{[`${A}-with-avatar`]:l,[`${A}-active`]:p,[`${A}-rtl`]:"rtl"===y,[`${A}-round`]:b},k,i,n,j,_);return N(t.createElement("div",{className:f,style:Object.assign(Object.assign({},w),d)},e,a))}return null!=c?c:null};y.Button=e=>{let{prefixCls:s,className:i,rootClassName:n,active:d,block:c=!1,size:u="default"}=e,{getPrefixCls:m}=t.useContext(a.ConfigContext),g=m("skeleton",s),[p,b,f]=h(g),x=(0,l.default)(e,["prefixCls"]),v=(0,r.default)(g,`${g}-element`,{[`${g}-active`]:d,[`${g}-block`]:c},i,n,b,f);return p(t.createElement("div",{className:v},t.createElement(o,Object.assign({prefixCls:`${g}-button`,size:u},x))))},y.Avatar=e=>{let{prefixCls:s,className:i,rootClassName:n,active:d,shape:c="circle",size:u="default"}=e,{getPrefixCls:m}=t.useContext(a.ConfigContext),g=m("skeleton",s),[p,b,f]=h(g),x=(0,l.default)(e,["prefixCls","className"]),v=(0,r.default)(g,`${g}-element`,{[`${g}-active`]:d},i,n,b,f);return p(t.createElement("div",{className:v},t.createElement(o,Object.assign({prefixCls:`${g}-avatar`,shape:c,size:u},x))))},y.Input=e=>{let{prefixCls:s,className:i,rootClassName:n,active:d,block:c,size:u="default"}=e,{getPrefixCls:m}=t.useContext(a.ConfigContext),g=m("skeleton",s),[p,b,f]=h(g),x=(0,l.default)(e,["prefixCls"]),v=(0,r.default)(g,`${g}-element`,{[`${g}-active`]:d,[`${g}-block`]:c},i,n,b,f);return p(t.createElement("div",{className:v},t.createElement(o,Object.assign({prefixCls:`${g}-input`,size:u},x))))},y.Image=e=>{let{prefixCls:l,className:o,rootClassName:s,style:i,active:n}=e,{getPrefixCls:d}=t.useContext(a.ConfigContext),c=d("skeleton",l),[u,m,g]=h(c),p=(0,r.default)(c,`${c}-element`,{[`${c}-active`]:n},o,s,m,g);return u(t.createElement("div",{className:p},t.createElement("div",{className:(0,r.default)(`${c}-image`,o),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`})))))},y.Node=e=>{let{prefixCls:l,className:o,rootClassName:s,style:i,active:n,children:d}=e,{getPrefixCls:c}=t.useContext(a.ConfigContext),u=c("skeleton",l),[m,g,p]=h(u),b=(0,r.default)(u,`${u}-element`,{[`${u}-active`]:n},g,o,s,p);return m(t.createElement("div",{className:b},t.createElement("div",{className:(0,r.default)(`${u}-image`,o),style:i},d)))},e.s(["default",0,y],185793)},959013,e=>{"use strict";e.i(247167);var t=e.i(931067),r=e.i(271645);let a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"}},{tag:"path",attrs:{d:"M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z"}}]},name:"plus",theme:"outlined"};var l=e.i(9583),o=r.forwardRef(function(e,o){return r.createElement(l.default,(0,t.default)({},e,{ref:o,icon:a}))});e.s(["default",0,o],959013)},269200,e=>{"use strict";var t=e.i(290571),r=e.i(271645),a=e.i(444755);let l=(0,e.i(673706).makeClassName)("Table"),o=r.default.forwardRef((e,o)=>{let{children:s,className:i}=e,n=(0,t.__rest)(e,["children","className"]);return r.default.createElement("div",{className:(0,a.tremorTwMerge)(l("root"),"overflow-auto",i)},r.default.createElement("table",Object.assign({ref:o,className:(0,a.tremorTwMerge)(l("table"),"w-full text-tremor-default","text-tremor-content","dark:text-dark-tremor-content")},n),s))});o.displayName="Table",e.s(["Table",()=>o],269200)},427612,e=>{"use strict";var t=e.i(290571),r=e.i(271645),a=e.i(444755);let l=(0,e.i(673706).makeClassName)("TableHead"),o=r.default.forwardRef((e,o)=>{let{children:s,className:i}=e,n=(0,t.__rest)(e,["children","className"]);return r.default.createElement(r.default.Fragment,null,r.default.createElement("thead",Object.assign({ref:o,className:(0,a.tremorTwMerge)(l("root"),"text-left","text-tremor-content","dark:text-dark-tremor-content",i)},n),s))});o.displayName="TableHead",e.s(["TableHead",()=>o],427612)},496020,e=>{"use strict";var t=e.i(290571),r=e.i(271645),a=e.i(444755);let l=(0,e.i(673706).makeClassName)("TableRow"),o=r.default.forwardRef((e,o)=>{let{children:s,className:i}=e,n=(0,t.__rest)(e,["children","className"]);return r.default.createElement(r.default.Fragment,null,r.default.createElement("tr",Object.assign({ref:o,className:(0,a.tremorTwMerge)(l("row"),i)},n),s))});o.displayName="TableRow",e.s(["TableRow",()=>o],496020)},64848,e=>{"use strict";var t=e.i(290571),r=e.i(271645),a=e.i(444755);let l=(0,e.i(673706).makeClassName)("TableHeaderCell"),o=r.default.forwardRef((e,o)=>{let{children:s,className:i}=e,n=(0,t.__rest)(e,["children","className"]);return r.default.createElement(r.default.Fragment,null,r.default.createElement("th",Object.assign({ref:o,className:(0,a.tremorTwMerge)(l("root"),"whitespace-nowrap text-left font-semibold top-0 px-4 py-3.5","text-tremor-content-strong","dark:text-dark-tremor-content-strong",i)},n),s))});o.displayName="TableHeaderCell",e.s(["TableHeaderCell",()=>o],64848)},977572,e=>{"use strict";var t=e.i(290571),r=e.i(271645),a=e.i(444755);let l=(0,e.i(673706).makeClassName)("TableCell"),o=r.default.forwardRef((e,o)=>{let{children:s,className:i}=e,n=(0,t.__rest)(e,["children","className"]);return r.default.createElement(r.default.Fragment,null,r.default.createElement("td",Object.assign({ref:o,className:(0,a.tremorTwMerge)(l("root"),"align-middle whitespace-nowrap text-left p-4",i)},n),s))});o.displayName="TableCell",e.s(["TableCell",()=>o],977572)},942232,e=>{"use strict";var t=e.i(290571),r=e.i(271645),a=e.i(444755);let l=(0,e.i(673706).makeClassName)("TableBody"),o=r.default.forwardRef((e,o)=>{let{children:s,className:i}=e,n=(0,t.__rest)(e,["children","className"]);return r.default.createElement(r.default.Fragment,null,r.default.createElement("tbody",Object.assign({ref:o,className:(0,a.tremorTwMerge)(l("root"),"align-top divide-y","divide-tremor-border","dark:divide-dark-tremor-border",i)},n),s))});o.displayName="TableBody",e.s(["TableBody",()=>o],942232)},728889,e=>{"use strict";var t=e.i(290571),r=e.i(271645),a=e.i(829087),l=e.i(480731),o=e.i(444755),s=e.i(673706),i=e.i(95779);let n={xs:{paddingX:"px-1.5",paddingY:"py-1.5"},sm:{paddingX:"px-1.5",paddingY:"py-1.5"},md:{paddingX:"px-2",paddingY:"py-2"},lg:{paddingX:"px-2",paddingY:"py-2"},xl:{paddingX:"px-2.5",paddingY:"py-2.5"}},d={xs:{height:"h-3",width:"w-3"},sm:{height:"h-5",width:"w-5"},md:{height:"h-5",width:"w-5"},lg:{height:"h-7",width:"w-7"},xl:{height:"h-9",width:"w-9"}},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:""}},u=(0,s.makeClassName)("Icon"),m=r.default.forwardRef((e,m)=>{let{icon:g,variant:p="simple",tooltip:b,size:f=l.Sizes.SM,color:h,className:x}=e,v=(0,t.__rest)(e,["icon","variant","tooltip","size","color","className"]),C=((e,t)=>{switch(e){case"simple":return{textColor:t?(0,s.getColorClassNames)(t,i.colorPalette.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:"",borderColor:"",ringColor:""};case"light":return{textColor:t?(0,s.getColorClassNames)(t,i.colorPalette.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:t?(0,o.tremorTwMerge)((0,s.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,s.getColorClassNames)(t,i.colorPalette.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:t?(0,o.tremorTwMerge)((0,s.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,s.getColorClassNames)(t,i.colorPalette.text).textColor:"text-tremor-brand-inverted dark:text-dark-tremor-brand-inverted",bgColor:t?(0,o.tremorTwMerge)((0,s.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,s.getColorClassNames)(t,i.colorPalette.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:t?(0,o.tremorTwMerge)((0,s.getColorClassNames)(t,i.colorPalette.background).bgColor,"bg-opacity-20"):"bg-tremor-background dark:bg-dark-tremor-background",borderColor:t?(0,s.getColorClassNames)(t,i.colorPalette.ring).borderColor:"border-tremor-brand-subtle dark:border-dark-tremor-brand-subtle",ringColor:t?(0,o.tremorTwMerge)((0,s.getColorClassNames)(t,i.colorPalette.ring).ringColor,"ring-opacity-40"):"ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted"}}})(p,h),{tooltipProps:y,getReferenceProps:k}=(0,a.useTooltip)();return r.default.createElement("span",Object.assign({ref:(0,s.mergeRefs)([m,y.refs.setReference]),className:(0,o.tremorTwMerge)(u("root"),"inline-flex shrink-0 items-center justify-center",C.bgColor,C.textColor,C.borderColor,C.ringColor,c[p].rounded,c[p].border,c[p].shadow,c[p].ring,n[f].paddingX,n[f].paddingY,x)},k,v),r.default.createElement(a.default,Object.assign({text:b},y)),r.default.createElement(g,{className:(0,o.tremorTwMerge)(u("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])},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)},418371,e=>{"use strict";var t=e.i(843476),r=e.i(271645),a=e.i(916925);e.s(["ProviderLogo",0,({provider:e,className:l="w-4 h-4"})=>{let[o,s]=(0,r.useState)(!1),{logo:i}=(0,a.getProviderLogoAndName)(e);return o||!i?(0,t.jsx)("div",{className:`${l} rounded-full bg-gray-200 flex items-center justify-center text-xs`,children:e?.charAt(0)||"-"}):(0,t.jsx)("img",{src:i,alt:`${e} logo`,className:l,onError:()=>s(!0)})}])},368670,e=>{"use strict";var t=e.i(764205),r=e.i(266027);let a=(0,e.i(243652).createQueryKeys)("modelCostMap");e.s(["useModelCostMap",0,()=>(0,r.useQuery)({queryKey:a.list({}),queryFn:async()=>await (0,t.modelCostMap)(),staleTime:6e4,gcTime:6e4})])},226898,972520,e=>{"use strict";var t=e.i(843476),r=e.i(271645),a=e.i(304967),l=e.i(269200),o=e.i(427612),s=e.i(496020),i=e.i(389083),n=e.i(64848),d=e.i(977572),c=e.i(942232),u=e.i(599724),m=e.i(994388),g=e.i(752978),p=e.i(793130),b=e.i(404206),f=e.i(723731),h=e.i(653824),x=e.i(881073),v=e.i(197647),C=e.i(764205),y=e.i(28651),k=e.i(68155),w=e.i(220508),A=e.i(727749),N=e.i(158392);let j=({accessToken:e,userRole:a,userID:l,modelData:o})=>{let[s,i]=(0,r.useState)({routerSettings:{},selectedStrategy:null,enableTagFiltering:!1}),[n,d]=(0,r.useState)([]),[c,u]=(0,r.useState)({}),[g,p]=(0,r.useState)({});return((0,r.useEffect)(()=>{e&&a&&l&&((0,C.getCallbacksCall)(e,l,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 r=t.routing_strategy||null;i(e=>({...e,routerSettings:t,selectedStrategy:r}))}),(0,C.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 r=e.fields.find(e=>"routing_strategy"===e.field_name);r?.options&&d(r.options),e.routing_strategy_descriptions&&p(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&&i(e=>({...e,enableTagFiltering:a.field_value}))}}))},[e,a,l]),e)?(0,t.jsxs)("div",{className:"w-full",children:[(0,t.jsx)(N.default,{value:s,onChange:i,routerFieldsMetadata:c,availableRoutingStrategies:n,routingStrategyDescriptions:g}),(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=s.routerSettings;console.log("router_settings",t);let r=new Set(["allowed_fails","cooldown_time","num_retries","timeout","retry_after"]),a=new Set(["model_group_alias","retry_policy"]),l=Object.fromEntries(Object.entries({...t,enable_tag_filtering:s.enableTagFiltering}).map(([e,t])=>{if("routing_strategy_args"!==e&&"routing_strategy"!==e&&"enable_tag_filtering"!==e){let l=document.querySelector(`input[name="${e}"]`),o=((e,t,l)=>{if(void 0===t)return l;let o=t.trim();if("null"===o.toLowerCase())return null;if(r.has(e)){let e=Number(o);return Number.isNaN(e)?l:e}if(a.has(e)){if(""===o)return null;try{return JSON.parse(o)}catch{return l}}return"true"===o.toLowerCase()||"false"!==o.toLowerCase()&&o})(e,l?.value,t);return[e,o]}if("routing_strategy"===e)return[e,s.selectedStrategy];if("enable_tag_filtering"===e)return[e,s.enableTagFiltering];if("routing_strategy_args"===e&&"latency-based-routing"===s.selectedStrategy){let e={},t=document.querySelector('input[name="lowest_latency_buffer"]'),r=document.querySelector('input[name="ttl"]');return t?.value&&(e.lowest_latency_buffer=Number(t.value)),r?.value&&(e.ttl=Number(r.value)),console.log(`setRoutingStrategyArgs: ${e}`),["routing_strategy_args",e]}return null}).filter(e=>null!=e));console.log("updatedVariables",l);try{(0,C.setCallbacksCall)(e,{router_settings:l})}catch(e){A.default.fromBackend("Failed to update router settings: "+e)}A.default.success("router settings updated successfully")},className:"text-sm font-medium",children:"Save Changes"})]})]}):null};e.i(247167);var _=e.i(368670);let T=r.forwardRef(function(e,t){return r.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14 5l7 7m0 0l-7 7m7-7H3"}))});var E=e.i(122577),I=e.i(592968),O=e.i(898586),M=e.i(356449),S=e.i(127952),$=e.i(418371),R=e.i(464571),L=e.i(998573),P=e.i(689020),B=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 D({open:e,onCancel:r,children:a}){return(0,t.jsx)(B.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:r,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 z=e.i(419470);function H({models:e,accessToken:a,value:l=[],onChange:o}){let[s,i]=(0,r.useState)(!1),[n,d]=(0,r.useState)([]),[c,u]=(0,r.useState)(0),[g,p]=(0,r.useState)(!1),[b,f]=(0,r.useState)([{id:"1",primaryModel:null,fallbackModels:[]}]);(0,r.useEffect)(()=>{s&&(f([{id:"1",primaryModel:null,fallbackModels:[]}]),u(e=>e+1))},[s]),(0,r.useEffect)(()=>{let e=async()=>{try{let e=await (0,P.fetchAvailableModels)(a);console.log("Fetched models for fallbacks:",e),d(e)}catch(e){console.error("Error fetching model info for fallbacks:",e)}};s&&e()},[a,s]);let h=Array.from(new Set(n.map(e=>e.model_group))).sort(),x=()=>{i(!1),f([{id:"1",primaryModel:null,fallbackModels:[]}])},v=async()=>{let e=b.filter(e=>!e.primaryModel||0===e.fallbackModels.length);if(e.length>0)return void L.message.error(`Please complete configuration for all groups. ${e.length} group(s) incomplete.`);let t=[...l||[],...b.map(e=>({[e.primaryModel]:e.fallbackModels}))];if(o){p(!0);try{await o(t),A.default.success(`${b.length} fallback configuration(s) added successfully!`),x()}catch(e){console.error("Error saving fallbacks:",e)}finally{p(!1)}}else A.default.fromBackend("onChange callback not provided")};return(0,t.jsxs)("div",{children:[(0,t.jsx)(m.Button,{className:"mx-auto",onClick:()=>i(!0),icon:()=>(0,t.jsx)("span",{className:"mr-1",children:"+"}),children:"Add Fallbacks"}),(0,t.jsxs)(D,{open:s,onCancel:x,children:[(0,t.jsx)(z.FallbackSelectionForm,{groups:b,onGroupsChange:f,availableModels:h,maxFallbacks:10,maxGroups:5},c),b.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)(R.Button,{type:"default",onClick:x,disabled:g,children:"Cancel"}),(0,t.jsx)(R.Button,{type:"default",onClick:v,disabled:0===b.length||g,loading:g,children:g?"Saving Configuration...":"Save All Configurations"})]})]})]})}let G="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 V(e,r){console.log=function(){};let a=window.location.origin,l=new M.default.OpenAI({apiKey:r,baseURL:a,dangerouslyAllowBrowser:!0});try{A.default.info("Testing fallback model response...");let r=await l.chat.completions.create({model:e,messages:[{role:"user",content:"Hi, this is a test message"}],mock_testing_fallbacks:!0});A.default.success((0,t.jsxs)("span",{children:["Test model=",(0,t.jsx)("strong",{children:e}),", received model=",(0,t.jsx)("strong",{children:r.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){A.default.fromBackend(`Error occurred while generating model response. Please try again. Error: ${e}`)}}let q=({accessToken:e,userRole:a,userID:i,modelData:u})=>{let[m,p]=(0,r.useState)({}),[b,f]=(0,r.useState)(!1),[h,x]=(0,r.useState)(null),[v,y]=(0,r.useState)(!1),{data:w}=(0,_.useModelCostMap)(),N=e=>null!=w&&"object"==typeof w&&e in w?w[e].litellm_provider??"":"";(0,r.useEffect)(()=>{e&&a&&i&&(0,C.getCallbacksCall)(e,i,a).then(e=>{console.log("callbacks",e);let t=e.router_settings;"model_group_retry_policy"in t&&delete t.model_group_retry_policy,p(t)})},[e,a,i]);let j=e=>{x(e),y(!0)},M=async()=>{if(!h||!e)return;let t=Object.keys(h)[0];if(!t)return;f(!0);let r=m.fallbacks.map(e=>{let r={...e};return t in r&&Array.isArray(r[t])&&delete r[t],r}).filter(e=>Object.keys(e).length>0),a={...m,fallbacks:r};try{await (0,C.setCallbacksCall)(e,{router_settings:a}),p(a),A.default.success("Router settings updated successfully")}catch(e){A.default.fromBackend("Failed to update router settings: "+e)}finally{f(!1),y(!1),x(null)}};if(!e)return null;let R=async t=>{if(!e)return;let r={...m,fallbacks:t};try{await (0,C.setCallbacksCall)(e,{router_settings:r}),p(r)}catch(t){throw A.default.fromBackend("Failed to update router settings: "+t),e&&a&&i&&(0,C.getCallbacksCall)(e,i,a).then(e=>{let t=e.router_settings;"model_group_retry_policy"in t&&delete t.model_group_retry_policy,p(t)}),t}},L=Array.isArray(m.fallbacks)&&m.fallbacks.length>0;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(H,{models:u?.data?u.data.map(e=>e.model_name):[],accessToken:e||"",value:m.fallbacks||[],onChange:R}),L?(0,t.jsxs)(l.Table,{children:[(0,t.jsx)(o.TableHead,{children:(0,t.jsxs)(s.TableRow,{children:[(0,t.jsx)(n.TableHeaderCell,{children:"Model Name"}),(0,t.jsx)(n.TableHeaderCell,{children:"Fallbacks"}),(0,t.jsx)(n.TableHeaderCell,{children:"Actions"})]})}),(0,t.jsx)(c.TableBody,{children:m.fallbacks.map((a,l)=>Object.entries(a).map(([o,i])=>{let n;return(0,t.jsxs)(s.TableRow,{children:[(0,t.jsx)(d.TableCell,{className:"align-top",children:(n=N?.(o)??o,(0,t.jsxs)("span",{className:G,children:[(0,t.jsx)($.ProviderLogo,{provider:n,className:"w-4 h-4 shrink-0"}),(0,t.jsx)("span",{children:o})]}))}),(0,t.jsx)(d.TableCell,{className:"align-top",children:function(e,a,l){let o=Array.isArray(a)?a:[];if(0===o.length)return null;let s=({modelName:e})=>{let r=l?.(e)??e;return(0,t.jsxs)("span",{className:G,children:[(0,t.jsx)($.ProviderLogo,{provider:r,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:o.map((e,a)=>(0,t.jsxs)(r.default.Fragment,{children:[a>0&&(0,t.jsx)(g.Icon,{icon:T,size:"xs",className:"shrink-0 text-gray-400"}),(0,t.jsx)(s,{modelName:e})]},e))})]})}(0,Array.isArray(i)?i:[],N)}),(0,t.jsxs)(d.TableCell,{className:"align-top",children:[(0,t.jsx)(I.Tooltip,{title:"Test fallback",children:(0,t.jsx)(g.Icon,{icon:E.PlayIcon,size:"sm",onClick:()=>V(Object.keys(a)[0],e||""),className:"cursor-pointer hover:text-blue-600"})}),(0,t.jsx)(I.Tooltip,{title:"Delete fallback",children:(0,t.jsx)("span",{"data-testid":"delete-fallback-button",role:"button",tabIndex:0,onClick:()=>j(a),onKeyDown:e=>"Enter"===e.key&&j(a),className:"cursor-pointer inline-flex",children:(0,t.jsx)(g.Icon,{icon:k.TrashIcon,size:"sm",className:"hover:text-red-600"})})})]})]},l.toString()+o)}))})]}):(0,t.jsx)("div",{className:"rounded-lg border border-gray-200 bg-gray-50 px-4 py-6 text-center",children:(0,t.jsx)(O.Typography.Text,{type:"secondary",children:"No fallbacks configured. Add fallbacks to automatically try another model when the primary fails."})}),(0,t.jsx)(S.default,{isOpen:v,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:h?Object.keys(h)[0]:"",code:!0}],onCancel:()=>{y(!1),x(null)},onOk:M,confirmLoading:b})]})};e.s(["default",0,({accessToken:e,userRole:A,userID:N,modelData:_})=>{let[T,E]=(0,r.useState)([]);(0,r.useEffect)(()=>{e&&(0,C.getGeneralSettingsCall)(e).then(e=>{E(e)})},[e]);let I=(e,t)=>{E(T.map(r=>r.field_name===e?{...r,field_value:t}:r))};return e?(0,t.jsx)("div",{className:"w-full",children:(0,t.jsxs)(h.TabGroup,{className:"h-[75vh] w-full",children:[(0,t.jsxs)(x.TabList,{variant:"line",defaultValue:"1",className:"px-8 pt-4",children:[(0,t.jsx)(v.Tab,{value:"1",children:"Loadbalancing"}),(0,t.jsx)(v.Tab,{value:"2",children:"Fallbacks"}),(0,t.jsx)(v.Tab,{value:"3",children:"General"})]}),(0,t.jsxs)(f.TabPanels,{className:"px-8 py-6",children:[(0,t.jsx)(b.TabPanel,{children:(0,t.jsx)(j,{accessToken:e,userRole:A,userID:N,modelData:_})}),(0,t.jsx)(b.TabPanel,{children:(0,t.jsx)(q,{accessToken:e,userRole:A,userID:N,modelData:_})}),(0,t.jsx)(b.TabPanel,{children:(0,t.jsx)(a.Card,{children:(0,t.jsxs)(l.Table,{children:[(0,t.jsx)(o.TableHead,{children:(0,t.jsxs)(s.TableRow,{children:[(0,t.jsx)(n.TableHeaderCell,{children:"Setting"}),(0,t.jsx)(n.TableHeaderCell,{children:"Value"}),(0,t.jsx)(n.TableHeaderCell,{children:"Status"}),(0,t.jsx)(n.TableHeaderCell,{children:"Action"})]})}),(0,t.jsx)(c.TableBody,{children:T.filter(e=>"TypedDictionary"!==e.field_type).map((r,a)=>(0,t.jsxs)(s.TableRow,{children:[(0,t.jsxs)(d.TableCell,{children:[(0,t.jsx)(u.Text,{children:r.field_name}),(0,t.jsx)("p",{style:{fontSize:"0.65rem",color:"#808080",fontStyle:"italic"},className:"mt-1",children:r.field_description})]}),(0,t.jsx)(d.TableCell,{children:"Integer"==r.field_type?(0,t.jsx)(y.InputNumber,{step:1,value:r.field_value,onChange:e=>I(r.field_name,e)}):"Boolean"==r.field_type?(0,t.jsx)(p.Switch,{checked:!0===r.field_value||"true"===r.field_value,onChange:e=>I(r.field_name,e)}):null}),(0,t.jsx)(d.TableCell,{children:!0==r.stored_in_db?(0,t.jsx)(i.Badge,{icon:w.CheckCircleIcon,className:"text-white",children:"In DB"}):!1==r.stored_in_db?(0,t.jsx)(i.Badge,{className:"text-gray bg-white outline",children:"In Config"}):(0,t.jsx)(i.Badge,{className:"text-gray bg-white outline",children:"Not Set"})}),(0,t.jsxs)(d.TableCell,{children:[(0,t.jsx)(m.Button,{onClick:()=>((t,r)=>{if(!e)return;let a=T[r].field_value;if(null!=a&&void 0!=a)try{(0,C.updateConfigFieldSetting)(e,t,a);let r=T.map(e=>e.field_name===t?{...e,stored_in_db:!0}:e);E(r)}catch(e){}})(r.field_name,a),children:"Update"}),(0,t.jsx)(g.Icon,{icon:k.TrashIcon,color:"red",onClick:()=>((t,r)=>{if(e)try{(0,C.deleteConfigFieldSetting)(e,t);let r=T.map(e=>e.field_name===t?{...e,stored_in_db:null,field_value:null}:e);E(r)}catch(e){}})(r.field_name,0),children:"Reset"})]})]},a))})]})})})]})]})}):null}],226898)},511715,e=>{"use strict";var t=e.i(843476),r=e.i(226898),a=e.i(135214);e.s(["default",0,()=>{let{accessToken:e,userRole:l,userId:o}=(0,a.default)();return(0,t.jsx)(r.default,{accessToken:e,userRole:l,userID:o,modelData:{}})}])}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/b08200c758c5c505.js b/litellm/proxy/_experimental/out/_next/static/chunks/3da2633a10defd79.js similarity index 97% rename from litellm/proxy/_experimental/out/_next/static/chunks/b08200c758c5c505.js rename to litellm/proxy/_experimental/out/_next/static/chunks/3da2633a10defd79.js index 58a9150e6b..5e26accaf3 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/b08200c758c5c505.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/3da2633a10defd79.js @@ -1 +1 @@ -(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,304911,e=>{"use strict";var t=e.i(843476),a=e.i(262218);let{Text:s}=e.i(898586).Typography;function l({userId:e}){return"default_user_id"===e?(0,t.jsx)(a.Tag,{color:"blue",children:"Default Proxy Admin"}):(0,t.jsx)(s,{children:e})}e.s(["default",()=>l])},11751,e=>{"use strict";function t(e){return""===e?null:e}e.s(["mapEmptyStringToNull",()=>t])},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)},534172,3750,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:"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 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(["SafetyCertificateOutlined",0,r],534172);let i={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=a.forwardRef(function(e,s){return a.createElement(l.default,(0,t.default)({},e,{ref:s,icon:i}))});e.s(["TransactionOutlined",0,n],3750)},784647,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),j=e.i(534172),_=e.i(3750),y=e.i(304911);let{Text:b}=s.Typography;function f({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)(y.default,{userId:a}):(0,t.jsx)(b,{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)(b,{type:"secondary",children:s}),(0,t.jsx)(b,{type:"secondary",style:{fontSize:12,textTransform:"uppercase",letterSpacing:"0.05em"},children:e})]}),(0,t.jsx)("div",{children:c})]})}let{Title:v,Text:N}=s.Typography;function k({data:e,onBack:s,onCreateNew:y,onRegenerate:b,onDelete:k,onResetSpend:T,canModifyKey:w=!0,backButtonText:S="Back to Keys",regenerateDisabled:I=!1,regenerateTooltip:C}){return(0,t.jsxs)("div",{children:[y&&(0,t.jsx)("div",{style:{marginBottom:16},children:(0,t.jsx)(a.Button,{type:"primary",icon:(0,t.jsx)(m.PlusOutlined,{}),onClick:y,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:S})}),(0,t.jsxs)(n.Flex,{justify:"space-between",align:"start",style:{marginBottom:20},children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(v,{level:3,copyable:{tooltips:["Copy Key Alias","Copied!"]},style:{margin:0},children:e.keyName}),(0,t.jsxs)(N,{type:"secondary",copyable:{text:e.keyId,tooltips:["Copy Key ID","Copied!"]},children:["Key ID: ",e.keyId]})]}),w&&(0,t.jsxs)(r.Space,{children:[(0,t.jsx)(l.Tooltip,{title:C||"",children:(0,t.jsx)("span",{children:(0,t.jsx)(a.Button,{icon:(0,t.jsx)(d.SyncOutlined,{}),onClick:b,disabled:I,children:"Regenerate Key"})})}),T&&(0,t.jsx)(a.Button,{danger:!0,icon:(0,t.jsx)(_.TransactionOutlined,{}),onClick:T,children:"Reset Spend"}),(0,t.jsx)(a.Button,{danger:!0,icon:(0,t.jsx)(c.DeleteOutlined,{}),onClick:k,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)(f,{label:"User Email",value:e.userEmail,icon:(0,t.jsx)(x.MailOutlined,{})}),(0,t.jsx)(f,{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)(f,{label:"Created At",value:e.createdAt,icon:(0,t.jsx)(p.CalendarOutlined,{})}),(0,t.jsx)(f,{label:"Created By",value:e.createdBy,icon:(0,t.jsx)(j.SafetyCertificateOutlined,{}),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)(f,{label:"Last Updated",value:e.lastUpdated,icon:(0,t.jsx)(g.ClockCircleOutlined,{})}),(0,t.jsx)(f,{label:"Last Active",value:e.lastActive,icon:(0,t.jsx)(h.ThunderboltOutlined,{})})]})]})]})}e.s(["KeyInfoHeader",()=>k],784647);var T=e.i(599724),w=e.i(389083),S=e.i(278587),I=e.i(271645);let C=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:"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)(S.RefreshIcon,{className:"h-4 w-4 text-blue-600"}),(0,t.jsx)(T.Text,{className:"font-semibold text-gray-900",children:"Auto-Rotation"}),(0,t.jsx)(w.Badge,{color:e?"green":"gray",size:"xs",children:e?"Enabled":"Disabled"}),e&&a&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(T.Text,{className:"text-gray-400",children:"•"}),(0,t.jsxs)(T.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)(C,{className:"w-4 h-4 text-gray-500"}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)(T.Text,{className:"font-medium text-gray-700",children:"Last Rotation"}),(0,t.jsx)(T.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)(C,{className:"w-4 h-4 text-gray-500"}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)(T.Text,{className:"font-medium text-gray-700",children:"Next Scheduled Rotation"}),(0,t.jsx)(T.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)(C,{className:"w-4 h-4 text-gray-500"}),(0,t.jsx)(T.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)(S.RefreshIcon,{className:"w-4 h-4 text-gray-400"}),(0,t.jsx)(T.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)(T.Text,{className:"font-semibold text-gray-900",children:"Auto-Rotation"}),(0,t.jsx)(T.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)(T.Text,{className:"font-medium text-gray-900 mb-3",children:"Auto-Rotation"}),d]})}],505022);let A=["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])=>!A.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),_=e.i(497245),y=e.i(96226),b=e.i(435684);function f(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,b.toDate)(e),c=s||a?(0,_.addMonths)(d,s+12*a):d,m=r||l?(0,j.addDays)(c,r+7*l):c;return(0,y.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),[b,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||(y(null),C(!1),F(!1),M(null),j.resetFields())},[t,j]);let R=e=>{if(!e)return null;try{let t,a=new Date;if(e.endsWith("s"))t=f(a,{seconds:parseInt(e)});else if(e.endsWith("h"))t=f(a,{hours:parseInt(e)});else if(e.endsWith("d"))t=f(a,{days:parseInt(e)});else throw Error("Invalid duration format");return t.toLocaleString()}catch(e){return null}};(0,v.useEffect)(()=>{b?.duration?S(R(b.duration)):S(null)},[b?.duration]);let D=async()=>{if(e&&L){C(!0);try{let t=await j.validateFields(),a=await (0,s.regenerateKeyCall)(L,e.token||e.token_id,t);y(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?R(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)}}},B=()=>{y(null),C(!1),F(!1),M(null),j.resetFields(),a()};return(0,n.jsx)(h.Modal,{title:"Regenerate Virtual Key",open:t,onCancel:B,footer:_?[(0,n.jsx)(o.Button,{onClick:B,children:"Close"},"close")]:[(0,n.jsx)(o.Button,{onClick:B,className:"mr-2",children:"Cancel"},"cancel"),(0,n.jsx)(o.Button,{onClick:D,disabled:I,children:I?"Regenerating...":"Regenerate"},"regenerate")],children:_?(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:_})}),(0,n.jsx)(N.CopyToClipboard,{text:_,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),_=e.i(599724),y=e.i(629569),b=e.i(808613),f=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),R=e.i(384767),D=e.i(690284),B=e.i(190702),E=e.i(891547),P=e.i(921511),O=e.i(827252),K=e.i(779241),U=e.i(311451),V=e.i(199133),$=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]=b.Form.useForm(),[p,g]=(0,k.useState)([]),[h,j]=(0,k.useState)({}),_=i?.find(t=>t.team_id===e.team_id),[y,f]=(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||""),[R,D]=(0,k.useState)(!e.expires),[B,ea]=(0,k.useState)(!1),{data:es}=(0,s.useProjects)(),{data:el}=(0,l.useUISettings)(),er=!!el?.values?.enable_projects_ui,ei=!!e.project_id,en=(()=>{if(!e.project_id)return null;let t=es?.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);f(e)}else if(_?.team_id){let e=await (0,X.fetchTeamModels)(o,d,n,_.team_id);f(Array.from(new Set([..._.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,_,e.team_id]),(0,k.useEffect)(()=>{x.setFieldValue("disabled_callbacks",v)},[x,v]);let eo=e=>e&&({"24h":"daily","7d":"weekly","30d":"monthly"})[e]||null,ed={...e,token:e.token||e.token_id,budget_duration:eo(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:eo(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 ec=async e=>{try{if(ea(!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)}R&&(e.duration=null),await r(e)}finally{ea(!1)}};return(0,t.jsxs)(b.Form,{form:x,onFinish:ec,initialValues:ed,layout:"vertical",children:[(0,t.jsx)(b.Form.Item,{label:"Key Alias",name:"key_alias",children:(0,t.jsx)(K.TextInput,{})}),(0,t.jsx)(b.Form.Item,{label:"Models",name:"models",children:(0,t.jsx)(b.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)(V.Select,{mode:"multiple",placeholder:"Select models",style:{width:"100%"},disabled:r,value:r?[]:i,onChange:e=>a("models",e),children:[y.length>0&&(0,t.jsx)(V.Select.Option,{value:"all-team-models",children:"All Team Models"}),y.map(e=>(0,t.jsx)(V.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)(b.Form.Item,{label:"Key Type",children:(0,t.jsx)(b.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)(V.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)(V.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)(V.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)(V.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)(b.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)(O.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"allowed_routes",children:(0,t.jsx)(U.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)(b.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)(b.Form.Item,{label:"Reset Budget",name:"budget_duration",children:(0,t.jsxs)(V.Select,{placeholder:"n/a",children:[(0,t.jsx)(V.Select.Option,{value:"daily",children:"Daily"}),(0,t.jsx)(V.Select.Option,{value:"weekly",children:"Weekly"}),(0,t.jsx)(V.Select.Option,{value:"monthly",children:"Monthly"})]})}),(0,t.jsx)(b.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)(b.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)(b.Form.Item,{label:"Max Parallel Requests",name:"max_parallel_requests",children:(0,t.jsx)(Z.default,{min:0})}),(0,t.jsx)(b.Form.Item,{label:"Model TPM Limit",name:"model_tpm_limit",children:(0,t.jsx)(U.Input.TextArea,{rows:4,placeholder:'{"gpt-4": 100, "claude-v1": 200}'})}),(0,t.jsx)(b.Form.Item,{label:"Model RPM Limit",name:"model_rpm_limit",children:(0,t.jsx)(U.Input.TextArea,{rows:4,placeholder:'{"gpt-4": 100, "claude-v1": 200}'})}),(0,t.jsx)(b.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)(b.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)(O.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"disable_global_guardrails",valuePropName:"checked",children:(0,t.jsx)($.Switch,{disabled:!u,checkedChildren:"Yes",unCheckedChildren:"No"})}),(0,t.jsx)(b.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)(O.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"policies",children:n&&(0,t.jsx)(P.default,{onChange:e=>{x.setFieldValue("policies",e)},accessToken:n,disabled:!m})}),(0,t.jsx)(b.Form.Item,{label:"Tags",name:"tags",children:(0,t.jsx)(V.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)(b.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)(V.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)(b.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)(O.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"access_group_ids",children:(0,t.jsx)(W.default,{placeholder:"Select access groups (optional)"})}),(0,t.jsx)(b.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)(b.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)(b.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)(b.Form.Item,{name:"mcp_tool_permissions",initialValue:{},hidden:!0,children:(0,t.jsx)(U.Input,{type:"hidden"})}),(0,t.jsx)(b.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)(b.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)(b.Form.Item,{label:"Team ID",name:"team_id",help:er&&ei?"Team is locked because this key belongs to a project":void 0,children:(0,t.jsx)(V.Select,{placeholder:"Select team",showSearch:!0,disabled:er&&ei,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)(V.Select.Option,{value:e.team_id,children:`${e.team_alias} (${e.team_id})`},e.team_id))})}),er&&ei&&(0,t.jsx)(b.Form.Item,{label:"Project",children:(0,t.jsx)(U.Input,{value:en??"",disabled:!0})}),(0,t.jsx)(b.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)(b.Form.Item,{label:"Metadata",name:"metadata",children:(0,t.jsx)(U.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,neverExpire:R,onNeverExpireChange:D}),(0,t.jsx)(b.Form.Item,{name:"duration",hidden:!0,initialValue:"",children:(0,t.jsx)(U.Input,{})})]}),(0,t.jsx)(b.Form.Item,{name:"token",hidden:!0,children:(0,t.jsx)(U.Input,{})}),(0,t.jsx)(b.Form.Item,{name:"disabled_callbacks",hidden:!0,children:(0,t.jsx)(U.Input,{})}),(0,t.jsx)(b.Form.Item,{name:"auto_rotate",hidden:!0,children:(0,t.jsx)(U.Input,{})}),(0,t.jsx)(b.Form.Item,{name:"rotation_interval",hidden:!0,children:(0,t.jsx)(U.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:B,children:"Cancel"}),(0,t.jsx)(c.Button,{type:"submit",loading:B,children:"Save Changes"})]})})]})}function es({onClose:e,keyData:E,teams:P,onKeyDataUpdate:O,onDelete:K,backButtonText:U="Back to Keys"}){let V,{accessToken:$,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]=b.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),[e_,ey]=(0,k.useState)(!1),[eb,ef]=(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(!$||!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)($,e);t[e]=a.resolved_guardrails||[]}catch(a){console.error(`Failed to fetch guardrails for policy ${e}:`,a),t[e]=[]}})),ef(t)}catch(e){console.error("Failed to fetch policy guardrails:",e)}finally{eN(!1)}})()},[$,ep?.metadata?.policies]),(0,k.useEffect)(()=>{if(e_){let e=setTimeout(()=>{ey(!1)},5e3);return()=>clearTimeout(e)}},[e_]),!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:U}),(0,t.jsx)(_.Text,{children:"Key not found"})]});let ek=async e=>{try{if(!$)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)($,e);eg(e=>e?{...e,...a}:void 0),O&&O(a),F.default.success("Key updated successfully"),Z(!1)}catch(e){F.default.fromBackend((0,B.parseErrorMessage)(e)),console.error("Error updating key:",e)}},eT=async()=>{try{if(er(!0),!$)return;await (0,L.keyDeleteCall)($,ep.token||ep.token_id),F.default.success("Key deleted successfully"),K&&K(),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:U,regenerateDisabled:!W,regenerateTooltip:W?void 0:"This is a LiteLLM Enterprise feature, and requires a valid key to use."}),(0,t.jsx)(D.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),ey(!0),O&&O({...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)(f.Modal,{title:"Reset Key Spend",open:ec,onOk:()=>{eu(ep.token||ep.token_id,{onSuccess:()=>{eg(e=>e?{...e,spend:0}:void 0),O&&O({spend:0}),F.default.success("Key spend reset to $0"),em(!1)},onError:e=>{F.default.fromBackend((0,B.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)(_.Text,{children:"Spend"}),(0,t.jsxs)("div",{className:"mt-2",children:[(0,t.jsxs)(y.Title,{children:["$",(0,i.formatNumberWithCommas)(ep.spend,4)]}),(0,t.jsxs)(_.Text,{children:["of"," ",null!==ep.max_budget?`$${(0,i.formatNumberWithCommas)(ep.max_budget)}`:"Unlimited"]})]})]}),(0,t.jsxs)(m.Card,{children:[(0,t.jsx)(_.Text,{children:"Rate Limits"}),(0,t.jsxs)("div",{className:"mt-2",children:[(0,t.jsxs)(_.Text,{children:["TPM: ",null!==ep.tpm_limit?ep.tpm_limit:"Unlimited"]}),(0,t.jsxs)(_.Text,{children:["RPM: ",null!==ep.rpm_limit?ep.rpm_limit:"Unlimited"]})]})]}),(0,t.jsxs)(m.Card,{children:[(0,t.jsx)(_.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)(_.Text,{children:"No models specified"})})]}),(0,t.jsx)(m.Card,{children:(0,t.jsx)(R.default,{objectPermission:ep.object_permission,variant:"inline",accessToken:$})}),(0,t.jsxs)(m.Card,{children:[(0,t.jsx)(_.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)(_.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)(_.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)(_.Text,{className:"text-xs text-gray-400",children:"Loading guardrails..."})]}),!ev&&eb[e]&&eb[e].length>0&&(0,t.jsxs)("div",{className:"ml-4 pl-3 border-l-2 border-gray-200",children:[(0,t.jsx)(_.Text,{className:"text-xs text-gray-500 mb-1",children:"Resolved Guardrails:"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-1",children:eb[e].map((e,a)=>(0,t.jsx)(d.Badge,{color:"blue",size:"xs",children:e},a))})]})]},a))}):(0,t.jsx)(_.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)(y.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:P,accessToken:$,userID:z,userRole:G,premiumUser:W}):(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(_.Text,{className:"font-medium",children:"Key ID"}),(0,t.jsx)(_.Text,{className:"font-mono",children:ep.token_id||ep.token})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(_.Text,{className:"font-medium",children:"Key Alias"}),(0,t.jsx)(_.Text,{children:ep.key_alias||"Not Set"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(_.Text,{className:"font-medium",children:"Secret Key"}),(0,t.jsx)(_.Text,{className:"font-mono",children:ep.key_name})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(_.Text,{className:"font-medium",children:"Team ID"}),(0,t.jsx)(_.Text,{children:ep.team_id||"Not Set"})]}),Y&&(0,t.jsxs)("div",{children:[(0,t.jsx)(_.Text,{className:"font-medium",children:"Project"}),(0,t.jsx)(_.Text,{children:ep.project_id?(V=J?.find(e=>e.project_id===ep.project_id),V?.project_alias?`${V.project_alias} (${ep.project_id})`:ep.project_id):"Not Set"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(_.Text,{className:"font-medium",children:"Organization"}),(0,t.jsx)(_.Text,{children:(ep.organization_id??ep.org_id)||"Not Set"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(_.Text,{className:"font-medium",children:"Created"}),(0,t.jsx)(_.Text,{children:ew(ep.created_at)})]}),eh&&(0,t.jsxs)("div",{children:[(0,t.jsx)(_.Text,{className:"font-medium",children:"Last Regenerated"}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(_.Text,{children:ew(eh)}),(0,t.jsx)(d.Badge,{color:"green",size:"xs",children:"Recent"})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(_.Text,{className:"font-medium",children:"Expires"}),(0,t.jsx)(_.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)(_.Text,{className:"font-medium",children:"Spend"}),(0,t.jsxs)(_.Text,{children:["$",(0,i.formatNumberWithCommas)(ep.spend,4)," USD"]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(_.Text,{className:"font-medium",children:"Budget"}),(0,t.jsx)(_.Text,{children:null!==ep.max_budget?`$${(0,i.formatNumberWithCommas)(ep.max_budget,2)}`:"Unlimited"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(_.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)(_.Text,{className:"font-medium",children:"Prompts"}),(0,t.jsx)(_.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)(_.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)(_.Text,{className:"font-medium",children:"Allowed Pass Through Routes"}),(0,t.jsx)(_.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)(_.Text,{className:"font-medium",children:"Disable Global Guardrails"}),(0,t.jsx)(_.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)(_.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)(_.Text,{children:"No models specified"})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(_.Text,{className:"font-medium",children:"Rate Limits"}),(0,t.jsxs)(_.Text,{children:["TPM: ",null!==ep.tpm_limit?ep.tpm_limit:"Unlimited"]}),(0,t.jsxs)(_.Text,{children:["RPM: ",null!==ep.rpm_limit?ep.rpm_limit:"Unlimited"]}),(0,t.jsxs)(_.Text,{children:["Max Parallel Requests:"," ",null!==ep.max_parallel_requests?ep.max_parallel_requests:"Unlimited"]}),(0,t.jsxs)(_.Text,{children:["Model TPM Limits:"," ",ep.metadata?.model_tpm_limit?JSON.stringify(ep.metadata.model_tpm_limit):"Unlimited"]}),(0,t.jsxs)(_.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)(_.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)(R.default,{objectPermission:ep.object_permission,variant:"inline",className:"pt-4 border-t border-gray-200",accessToken:$}),(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 +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,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)},304911,e=>{"use strict";var t=e.i(843476),a=e.i(262218);let{Text:s}=e.i(898586).Typography;function l({userId:e}){return"default_user_id"===e?(0,t.jsx)(a.Tag,{color:"blue",children:"Default Proxy Admin"}):(0,t.jsx)(s,{children:e})}e.s(["default",()=>l])},11751,e=>{"use strict";function t(e){return""===e?null:e}e.s(["mapEmptyStringToNull",()=>t])},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)},534172,3750,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:"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 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(["SafetyCertificateOutlined",0,r],534172);let i={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=a.forwardRef(function(e,s){return a.createElement(l.default,(0,t.default)({},e,{ref:s,icon:i}))});e.s(["TransactionOutlined",0,n],3750)},784647,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),j=e.i(534172),_=e.i(3750),y=e.i(304911);let{Text:b}=s.Typography;function f({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)(y.default,{userId:a}):(0,t.jsx)(b,{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)(b,{type:"secondary",children:s}),(0,t.jsx)(b,{type:"secondary",style:{fontSize:12,textTransform:"uppercase",letterSpacing:"0.05em"},children:e})]}),(0,t.jsx)("div",{children:c})]})}let{Title:v,Text:N}=s.Typography;function k({data:e,onBack:s,onCreateNew:y,onRegenerate:b,onDelete:k,onResetSpend:T,canModifyKey:w=!0,backButtonText:S="Back to Keys",regenerateDisabled:I=!1,regenerateTooltip:C}){return(0,t.jsxs)("div",{children:[y&&(0,t.jsx)("div",{style:{marginBottom:16},children:(0,t.jsx)(a.Button,{type:"primary",icon:(0,t.jsx)(m.PlusOutlined,{}),onClick:y,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:S})}),(0,t.jsxs)(n.Flex,{justify:"space-between",align:"start",style:{marginBottom:20},children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(v,{level:3,copyable:{tooltips:["Copy Key Alias","Copied!"]},style:{margin:0},children:e.keyName}),(0,t.jsxs)(N,{type:"secondary",copyable:{text:e.keyId,tooltips:["Copy Key ID","Copied!"]},children:["Key ID: ",e.keyId]})]}),w&&(0,t.jsxs)(r.Space,{children:[(0,t.jsx)(l.Tooltip,{title:C||"",children:(0,t.jsx)("span",{children:(0,t.jsx)(a.Button,{icon:(0,t.jsx)(d.SyncOutlined,{}),onClick:b,disabled:I,children:"Regenerate Key"})})}),T&&(0,t.jsx)(a.Button,{danger:!0,icon:(0,t.jsx)(_.TransactionOutlined,{}),onClick:T,children:"Reset Spend"}),(0,t.jsx)(a.Button,{danger:!0,icon:(0,t.jsx)(c.DeleteOutlined,{}),onClick:k,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)(f,{label:"User Email",value:e.userEmail,icon:(0,t.jsx)(x.MailOutlined,{})}),(0,t.jsx)(f,{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)(f,{label:"Created At",value:e.createdAt,icon:(0,t.jsx)(p.CalendarOutlined,{})}),(0,t.jsx)(f,{label:"Created By",value:e.createdBy,icon:(0,t.jsx)(j.SafetyCertificateOutlined,{}),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)(f,{label:"Last Updated",value:e.lastUpdated,icon:(0,t.jsx)(g.ClockCircleOutlined,{})}),(0,t.jsx)(f,{label:"Last Active",value:e.lastActive,icon:(0,t.jsx)(h.ThunderboltOutlined,{})})]})]})]})}e.s(["KeyInfoHeader",()=>k],784647);var T=e.i(599724),w=e.i(389083),S=e.i(278587),I=e.i(271645);let C=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:"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)(S.RefreshIcon,{className:"h-4 w-4 text-blue-600"}),(0,t.jsx)(T.Text,{className:"font-semibold text-gray-900",children:"Auto-Rotation"}),(0,t.jsx)(w.Badge,{color:e?"green":"gray",size:"xs",children:e?"Enabled":"Disabled"}),e&&a&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(T.Text,{className:"text-gray-400",children:"•"}),(0,t.jsxs)(T.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)(C,{className:"w-4 h-4 text-gray-500"}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)(T.Text,{className:"font-medium text-gray-700",children:"Last Rotation"}),(0,t.jsx)(T.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)(C,{className:"w-4 h-4 text-gray-500"}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)(T.Text,{className:"font-medium text-gray-700",children:"Next Scheduled Rotation"}),(0,t.jsx)(T.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)(C,{className:"w-4 h-4 text-gray-500"}),(0,t.jsx)(T.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)(S.RefreshIcon,{className:"w-4 h-4 text-gray-400"}),(0,t.jsx)(T.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)(T.Text,{className:"font-semibold text-gray-900",children:"Auto-Rotation"}),(0,t.jsx)(T.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)(T.Text,{className:"font-medium text-gray-900 mb-3",children:"Auto-Rotation"}),d]})}],505022);let A=["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])=>!A.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),_=e.i(497245),y=e.i(96226),b=e.i(435684);function f(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,b.toDate)(e),c=s||a?(0,_.addMonths)(d,s+12*a):d,m=r||l?(0,j.addDays)(c,r+7*l):c;return(0,y.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),[b,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||(y(null),C(!1),F(!1),M(null),j.resetFields())},[t,j]);let R=e=>{if(!e)return null;try{let t,a=new Date;if(e.endsWith("s"))t=f(a,{seconds:parseInt(e)});else if(e.endsWith("h"))t=f(a,{hours:parseInt(e)});else if(e.endsWith("d"))t=f(a,{days:parseInt(e)});else throw Error("Invalid duration format");return t.toLocaleString()}catch(e){return null}};(0,v.useEffect)(()=>{b?.duration?S(R(b.duration)):S(null)},[b?.duration]);let D=async()=>{if(e&&L){C(!0);try{let t=await j.validateFields(),a=await (0,s.regenerateKeyCall)(L,e.token||e.token_id,t);y(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?R(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)}}},B=()=>{y(null),C(!1),F(!1),M(null),j.resetFields(),a()};return(0,n.jsx)(h.Modal,{title:"Regenerate Virtual Key",open:t,onCancel:B,footer:_?[(0,n.jsx)(o.Button,{onClick:B,children:"Close"},"close")]:[(0,n.jsx)(o.Button,{onClick:B,className:"mr-2",children:"Cancel"},"cancel"),(0,n.jsx)(o.Button,{onClick:D,disabled:I,children:I?"Regenerating...":"Regenerate"},"regenerate")],children:_?(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:_})}),(0,n.jsx)(N.CopyToClipboard,{text:_,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),_=e.i(599724),y=e.i(629569),b=e.i(808613),f=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),R=e.i(384767),D=e.i(690284),B=e.i(190702),E=e.i(891547),P=e.i(921511),O=e.i(827252),K=e.i(779241),U=e.i(311451),V=e.i(199133),$=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]=b.Form.useForm(),[p,g]=(0,k.useState)([]),[h,j]=(0,k.useState)({}),_=i?.find(t=>t.team_id===e.team_id),[y,f]=(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||""),[R,D]=(0,k.useState)(!e.expires),[B,ea]=(0,k.useState)(!1),{data:es}=(0,s.useProjects)(),{data:el}=(0,l.useUISettings)(),er=!!el?.values?.enable_projects_ui,ei=!!e.project_id,en=(()=>{if(!e.project_id)return null;let t=es?.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);f(e)}else if(_?.team_id){let e=await (0,X.fetchTeamModels)(o,d,n,_.team_id);f(Array.from(new Set([..._.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,_,e.team_id]),(0,k.useEffect)(()=>{x.setFieldValue("disabled_callbacks",v)},[x,v]);let eo=e=>e&&({"24h":"daily","7d":"weekly","30d":"monthly"})[e]||null,ed={...e,token:e.token||e.token_id,budget_duration:eo(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:eo(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 ec=async e=>{try{if(ea(!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)}R&&(e.duration=null),await r(e)}finally{ea(!1)}};return(0,t.jsxs)(b.Form,{form:x,onFinish:ec,initialValues:ed,layout:"vertical",children:[(0,t.jsx)(b.Form.Item,{label:"Key Alias",name:"key_alias",children:(0,t.jsx)(K.TextInput,{})}),(0,t.jsx)(b.Form.Item,{label:"Models",name:"models",children:(0,t.jsx)(b.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)(V.Select,{mode:"multiple",placeholder:"Select models",style:{width:"100%"},disabled:r,value:r?[]:i,onChange:e=>a("models",e),children:[y.length>0&&(0,t.jsx)(V.Select.Option,{value:"all-team-models",children:"All Team Models"}),y.map(e=>(0,t.jsx)(V.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)(b.Form.Item,{label:"Key Type",children:(0,t.jsx)(b.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)(V.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)(V.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)(V.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)(V.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)(b.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)(O.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"allowed_routes",children:(0,t.jsx)(U.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)(b.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)(b.Form.Item,{label:"Reset Budget",name:"budget_duration",children:(0,t.jsxs)(V.Select,{placeholder:"n/a",children:[(0,t.jsx)(V.Select.Option,{value:"daily",children:"Daily"}),(0,t.jsx)(V.Select.Option,{value:"weekly",children:"Weekly"}),(0,t.jsx)(V.Select.Option,{value:"monthly",children:"Monthly"})]})}),(0,t.jsx)(b.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)(b.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)(b.Form.Item,{label:"Max Parallel Requests",name:"max_parallel_requests",children:(0,t.jsx)(Z.default,{min:0})}),(0,t.jsx)(b.Form.Item,{label:"Model TPM Limit",name:"model_tpm_limit",children:(0,t.jsx)(U.Input.TextArea,{rows:4,placeholder:'{"gpt-4": 100, "claude-v1": 200}'})}),(0,t.jsx)(b.Form.Item,{label:"Model RPM Limit",name:"model_rpm_limit",children:(0,t.jsx)(U.Input.TextArea,{rows:4,placeholder:'{"gpt-4": 100, "claude-v1": 200}'})}),(0,t.jsx)(b.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)(b.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)(O.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"disable_global_guardrails",valuePropName:"checked",children:(0,t.jsx)($.Switch,{disabled:!u,checkedChildren:"Yes",unCheckedChildren:"No"})}),(0,t.jsx)(b.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)(O.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"policies",children:n&&(0,t.jsx)(P.default,{onChange:e=>{x.setFieldValue("policies",e)},accessToken:n,disabled:!m})}),(0,t.jsx)(b.Form.Item,{label:"Tags",name:"tags",children:(0,t.jsx)(V.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)(b.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)(V.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)(b.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)(O.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"access_group_ids",children:(0,t.jsx)(W.default,{placeholder:"Select access groups (optional)"})}),(0,t.jsx)(b.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)(b.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)(b.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)(b.Form.Item,{name:"mcp_tool_permissions",initialValue:{},hidden:!0,children:(0,t.jsx)(U.Input,{type:"hidden"})}),(0,t.jsx)(b.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)(b.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)(b.Form.Item,{label:"Team ID",name:"team_id",help:er&&ei?"Team is locked because this key belongs to a project":void 0,children:(0,t.jsx)(V.Select,{placeholder:"Select team",showSearch:!0,disabled:er&&ei,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)(V.Select.Option,{value:e.team_id,children:`${e.team_alias} (${e.team_id})`},e.team_id))})}),er&&ei&&(0,t.jsx)(b.Form.Item,{label:"Project",children:(0,t.jsx)(U.Input,{value:en??"",disabled:!0})}),(0,t.jsx)(b.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)(b.Form.Item,{label:"Metadata",name:"metadata",children:(0,t.jsx)(U.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,neverExpire:R,onNeverExpireChange:D}),(0,t.jsx)(b.Form.Item,{name:"duration",hidden:!0,initialValue:"",children:(0,t.jsx)(U.Input,{})})]}),(0,t.jsx)(b.Form.Item,{name:"token",hidden:!0,children:(0,t.jsx)(U.Input,{})}),(0,t.jsx)(b.Form.Item,{name:"disabled_callbacks",hidden:!0,children:(0,t.jsx)(U.Input,{})}),(0,t.jsx)(b.Form.Item,{name:"auto_rotate",hidden:!0,children:(0,t.jsx)(U.Input,{})}),(0,t.jsx)(b.Form.Item,{name:"rotation_interval",hidden:!0,children:(0,t.jsx)(U.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:B,children:"Cancel"}),(0,t.jsx)(c.Button,{type:"submit",loading:B,children:"Save Changes"})]})})]})}function es({onClose:e,keyData:E,teams:P,onKeyDataUpdate:O,onDelete:K,backButtonText:U="Back to Keys"}){let V,{accessToken:$,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]=b.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),[e_,ey]=(0,k.useState)(!1),[eb,ef]=(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(!$||!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)($,e);t[e]=a.resolved_guardrails||[]}catch(a){console.error(`Failed to fetch guardrails for policy ${e}:`,a),t[e]=[]}})),ef(t)}catch(e){console.error("Failed to fetch policy guardrails:",e)}finally{eN(!1)}})()},[$,ep?.metadata?.policies]),(0,k.useEffect)(()=>{if(e_){let e=setTimeout(()=>{ey(!1)},5e3);return()=>clearTimeout(e)}},[e_]),!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:U}),(0,t.jsx)(_.Text,{children:"Key not found"})]});let ek=async e=>{try{if(!$)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)($,e);eg(e=>e?{...e,...a}:void 0),O&&O(a),F.default.success("Key updated successfully"),Z(!1)}catch(e){F.default.fromBackend((0,B.parseErrorMessage)(e)),console.error("Error updating key:",e)}},eT=async()=>{try{if(er(!0),!$)return;await (0,L.keyDeleteCall)($,ep.token||ep.token_id),F.default.success("Key deleted successfully"),K&&K(),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:U,regenerateDisabled:!W,regenerateTooltip:W?void 0:"This is a LiteLLM Enterprise feature, and requires a valid key to use."}),(0,t.jsx)(D.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),ey(!0),O&&O({...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)(f.Modal,{title:"Reset Key Spend",open:ec,onOk:()=>{eu(ep.token||ep.token_id,{onSuccess:()=>{eg(e=>e?{...e,spend:0}:void 0),O&&O({spend:0}),F.default.success("Key spend reset to $0"),em(!1)},onError:e=>{F.default.fromBackend((0,B.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)(_.Text,{children:"Spend"}),(0,t.jsxs)("div",{className:"mt-2",children:[(0,t.jsxs)(y.Title,{children:["$",(0,i.formatNumberWithCommas)(ep.spend,4)]}),(0,t.jsxs)(_.Text,{children:["of"," ",null!==ep.max_budget?`$${(0,i.formatNumberWithCommas)(ep.max_budget)}`:"Unlimited"]})]})]}),(0,t.jsxs)(m.Card,{children:[(0,t.jsx)(_.Text,{children:"Rate Limits"}),(0,t.jsxs)("div",{className:"mt-2",children:[(0,t.jsxs)(_.Text,{children:["TPM: ",null!==ep.tpm_limit?ep.tpm_limit:"Unlimited"]}),(0,t.jsxs)(_.Text,{children:["RPM: ",null!==ep.rpm_limit?ep.rpm_limit:"Unlimited"]})]})]}),(0,t.jsxs)(m.Card,{children:[(0,t.jsx)(_.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)(_.Text,{children:"No models specified"})})]}),(0,t.jsx)(m.Card,{children:(0,t.jsx)(R.default,{objectPermission:ep.object_permission,variant:"inline",accessToken:$})}),(0,t.jsxs)(m.Card,{children:[(0,t.jsx)(_.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)(_.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)(_.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)(_.Text,{className:"text-xs text-gray-400",children:"Loading guardrails..."})]}),!ev&&eb[e]&&eb[e].length>0&&(0,t.jsxs)("div",{className:"ml-4 pl-3 border-l-2 border-gray-200",children:[(0,t.jsx)(_.Text,{className:"text-xs text-gray-500 mb-1",children:"Resolved Guardrails:"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-1",children:eb[e].map((e,a)=>(0,t.jsx)(d.Badge,{color:"blue",size:"xs",children:e},a))})]})]},a))}):(0,t.jsx)(_.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)(y.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:P,accessToken:$,userID:z,userRole:G,premiumUser:W}):(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(_.Text,{className:"font-medium",children:"Key ID"}),(0,t.jsx)(_.Text,{className:"font-mono",children:ep.token_id||ep.token})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(_.Text,{className:"font-medium",children:"Key Alias"}),(0,t.jsx)(_.Text,{children:ep.key_alias||"Not Set"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(_.Text,{className:"font-medium",children:"Secret Key"}),(0,t.jsx)(_.Text,{className:"font-mono",children:ep.key_name})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(_.Text,{className:"font-medium",children:"Team ID"}),(0,t.jsx)(_.Text,{children:ep.team_id||"Not Set"})]}),Y&&(0,t.jsxs)("div",{children:[(0,t.jsx)(_.Text,{className:"font-medium",children:"Project"}),(0,t.jsx)(_.Text,{children:ep.project_id?(V=J?.find(e=>e.project_id===ep.project_id),V?.project_alias?`${V.project_alias} (${ep.project_id})`:ep.project_id):"Not Set"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(_.Text,{className:"font-medium",children:"Organization"}),(0,t.jsx)(_.Text,{children:(ep.organization_id??ep.org_id)||"Not Set"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(_.Text,{className:"font-medium",children:"Created"}),(0,t.jsx)(_.Text,{children:ew(ep.created_at)})]}),eh&&(0,t.jsxs)("div",{children:[(0,t.jsx)(_.Text,{className:"font-medium",children:"Last Regenerated"}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(_.Text,{children:ew(eh)}),(0,t.jsx)(d.Badge,{color:"green",size:"xs",children:"Recent"})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(_.Text,{className:"font-medium",children:"Expires"}),(0,t.jsx)(_.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)(_.Text,{className:"font-medium",children:"Spend"}),(0,t.jsxs)(_.Text,{children:["$",(0,i.formatNumberWithCommas)(ep.spend,4)," USD"]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(_.Text,{className:"font-medium",children:"Budget"}),(0,t.jsx)(_.Text,{children:null!==ep.max_budget?`$${(0,i.formatNumberWithCommas)(ep.max_budget,2)}`:"Unlimited"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(_.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)(_.Text,{className:"font-medium",children:"Prompts"}),(0,t.jsx)(_.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)(_.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)(_.Text,{className:"font-medium",children:"Allowed Pass Through Routes"}),(0,t.jsx)(_.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)(_.Text,{className:"font-medium",children:"Disable Global Guardrails"}),(0,t.jsx)(_.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)(_.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)(_.Text,{children:"No models specified"})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(_.Text,{className:"font-medium",children:"Rate Limits"}),(0,t.jsxs)(_.Text,{children:["TPM: ",null!==ep.tpm_limit?ep.tpm_limit:"Unlimited"]}),(0,t.jsxs)(_.Text,{children:["RPM: ",null!==ep.rpm_limit?ep.rpm_limit:"Unlimited"]}),(0,t.jsxs)(_.Text,{children:["Max Parallel Requests:"," ",null!==ep.max_parallel_requests?ep.max_parallel_requests:"Unlimited"]}),(0,t.jsxs)(_.Text,{children:["Model TPM Limits:"," ",ep.metadata?.model_tpm_limit?JSON.stringify(ep.metadata.model_tpm_limit):"Unlimited"]}),(0,t.jsxs)(_.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)(_.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)(R.default,{objectPermission:ep.object_permission,variant:"inline",className:"pt-4 border-t border-gray-200",accessToken:$}),(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/e99f98e7f34532c9.js b/litellm/proxy/_experimental/out/_next/static/chunks/40f766ecc87dbf9a.js similarity index 63% rename from litellm/proxy/_experimental/out/_next/static/chunks/e99f98e7f34532c9.js rename to litellm/proxy/_experimental/out/_next/static/chunks/40f766ecc87dbf9a.js index bd7488f525..faa3fae736 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/e99f98e7f34532c9.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/40f766ecc87dbf9a.js @@ -1 +1 @@ -(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,56567,e=>{"use strict";var t=e.i(843476),a=e.i(135214),r=e.i(109799),l=e.i(907308),i=e.i(764205),s=e.i(500330),n=e.i(11751),o=e.i(708347),d=e.i(751904),m=e.i(827252),c=e.i(987432),u=e.i(530212),g=e.i(389083),h=e.i(304967),p=e.i(350967),x=e.i(599724),b=e.i(779241),f=e.i(629569),y=e.i(464571),_=e.i(808613),v=e.i(311451),j=e.i(998573),w=e.i(199133),C=e.i(790848),S=e.i(653496),k=e.i(592968),N=e.i(678784),T=e.i(118366),I=e.i(271645),M=e.i(9314),O=e.i(552130),z=e.i(127952);function E({className:e,value:a,onChange:r}){return(0,t.jsxs)(w.Select,{className:e,value:a,onChange:r,children:[(0,t.jsx)(w.Select.Option,{value:"24h",children:"Daily"}),(0,t.jsx)(w.Select.Option,{value:"7d",children:"Weekly"}),(0,t.jsx)(w.Select.Option,{value:"30d",children:"Monthly"})]})}var P=e.i(844565),D=e.i(355619),$=e.i(643449),F=e.i(75921),L=e.i(390605),A=e.i(162386),R=e.i(727749),B=e.i(384767),U=e.i(435451),V=e.i(916940),K=e.i(183588),q=e.i(276173),W=e.i(91979),H=e.i(269200),G=e.i(942232),Q=e.i(977572),X=e.i(427612),Y=e.i(64848),J=e.i(496020),Z=e.i(536916),ee=e.i(21548);let et={"/key/generate":"Member can generate a virtual key for this team","/key/service-account/generate":"Member can generate a service account key (not belonging to any user) for this team","/key/update":"Member can update a virtual key belonging to this team","/key/delete":"Member can delete a virtual key belonging to this team","/key/info":"Member can get info about a virtual key belonging to this team","/key/regenerate":"Member can regenerate a virtual key belonging to this team","/key/{key_id}/regenerate":"Member can regenerate a virtual key belonging to this team","/key/list":"Member can list virtual keys belonging to this team","/key/block":"Member can block a virtual key belonging to this team","/key/unblock":"Member can unblock a virtual key belonging to this team","/team/daily/activity":"Member can view all team usage data (not just their own)"},ea=({teamId:e,accessToken:a,canEditTeam:r})=>{let[l,s]=(0,I.useState)([]),[n,o]=(0,I.useState)([]),[d,m]=(0,I.useState)(!0),[u,g]=(0,I.useState)(!1),[p,b]=(0,I.useState)(!1),_=async()=>{try{if(m(!0),!a)return;let t=await (0,i.getTeamPermissionsCall)(a,e),r=t.all_available_permissions||[];s(r);let l=t.team_member_permissions||[];o(l),b(!1)}catch(e){R.default.fromBackend("Failed to load permissions"),console.error("Error fetching permissions:",e)}finally{m(!1)}};(0,I.useEffect)(()=>{_()},[e,a]);let v=async()=>{try{if(!a)return;g(!0),await (0,i.teamPermissionsUpdateCall)(a,e,n),R.default.success("Permissions updated successfully"),b(!1)}catch(e){R.default.fromBackend("Failed to update permissions"),console.error("Error updating permissions:",e)}finally{g(!1)}};if(d)return(0,t.jsx)("div",{className:"p-6 text-center",children:"Loading permissions..."});let j=l.length>0;return(0,t.jsxs)(h.Card,{className:"bg-white shadow-md rounded-md p-6",children:[(0,t.jsxs)("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center border-b pb-4 mb-6",children:[(0,t.jsx)(f.Title,{className:"mb-2 sm:mb-0",children:"Member Permissions"}),r&&p&&(0,t.jsxs)("div",{className:"flex gap-3",children:[(0,t.jsx)(y.Button,{icon:(0,t.jsx)(W.ReloadOutlined,{}),onClick:()=>{_()},children:"Reset"}),(0,t.jsx)(y.Button,{onClick:v,loading:u,type:"primary",icon:(0,t.jsx)(c.SaveOutlined,{}),children:"Save Changes"})]})]}),(0,t.jsx)(x.Text,{className:"mb-6 text-gray-600",children:"Control what team members can do when they are not team admins."}),j?(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)(H.Table,{className:" min-w-full",children:[(0,t.jsx)(X.TableHead,{children:(0,t.jsxs)(J.TableRow,{children:[(0,t.jsx)(Y.TableHeaderCell,{children:"Method"}),(0,t.jsx)(Y.TableHeaderCell,{children:"Endpoint"}),(0,t.jsx)(Y.TableHeaderCell,{children:"Description"}),(0,t.jsx)(Y.TableHeaderCell,{className:"sticky right-0 bg-white shadow-[-4px_0_4px_-4px_rgba(0,0,0,0.1)] text-center",children:"Allow Access"})]})}),(0,t.jsx)(G.TableBody,{children:l.map(e=>{let a=(e=>{let t=e.includes("/info")||e.includes("/list")||e.includes("/activity")?"GET":"POST",a=et[e];if(!a){for(let[t,r]of Object.entries(et))if(e.includes(t)){a=r;break}}return a||(a=`Access ${e}`),{method:t,endpoint:e,description:a,route:e}})(e);return(0,t.jsxs)(J.TableRow,{className:"hover:bg-gray-50 transition-colors",children:[(0,t.jsx)(Q.TableCell,{children:(0,t.jsx)("span",{className:`px-2 py-1 rounded text-xs font-medium ${"GET"===a.method?"bg-blue-100 text-blue-800":"bg-green-100 text-green-800"}`,children:a.method})}),(0,t.jsx)(Q.TableCell,{children:(0,t.jsx)("span",{className:"font-mono text-sm text-gray-800",children:a.endpoint})}),(0,t.jsx)(Q.TableCell,{className:"text-gray-700",children:a.description}),(0,t.jsx)(Q.TableCell,{className:"sticky right-0 bg-white shadow-[-4px_0_4px_-4px_rgba(0,0,0,0.1)] text-center",children:(0,t.jsx)(Z.Checkbox,{checked:n.includes(e),onChange:t=>{o(t.target.checked?[...n,e]:n.filter(t=>t!==e)),b(!0)},disabled:!r})})]},e)})})]})}):(0,t.jsx)("div",{className:"py-12",children:(0,t.jsx)(ee.Empty,{description:"No permissions available"})})]})},er="overview",el="virtual-keys",ei="members",es="member-permissions",en="settings",eo={[er]:"Overview",[el]:"Virtual Keys",[ei]:"Members",[es]:"Member Permissions",[en]:"Settings"};var ed=e.i(292639),em=e.i(770914),ec=e.i(898586),eu=e.i(294612);function eg({teamData:e,canEditTeam:r,handleMemberDelete:l,setSelectedEditMember:i,setIsEditMemberModalVisible:n,setIsAddMemberModalVisible:d}){let c=e=>{if(null==e)return"0";if("number"==typeof e){let t=Number(e);return t===Math.floor(t)?t.toString():(0,s.formatNumberWithCommas)(t,8).replace(/\.?0+$/,"")}return"0"},{data:u}=(0,ed.useUISettings)(),{userId:g,userRole:h}=(0,a.default)(),p=!!u?.values?.disable_team_admin_delete_team_user,x=(0,o.isUserTeamAdminForSingleTeam)(e.team_info.members_with_roles,g||""),b=(0,o.isProxyAdminRole)(h||""),f=[{title:(0,t.jsxs)(em.Space,{direction:"horizontal",children:["Team Member Spend (USD)",(0,t.jsx)(k.Tooltip,{title:"This is the amount spent by a user in the team.",children:(0,t.jsx)(m.InfoCircleOutlined,{})})]}),key:"spend",render:(a,r)=>(0,t.jsxs)(ec.Typography.Text,{children:["$",(0,s.formatNumberWithCommas)((t=>{if(!t)return 0;let a=e.team_memberships.find(e=>e.user_id===t);return a?.spend||0})(r.user_id),4)]})},{title:"Team Member Budget (USD)",key:"budget",render:(a,r)=>{let l=(t=>{if(!t)return null;let a=e.team_memberships.find(e=>e.user_id===t),r=a?.litellm_budget_table?.max_budget;return null==r?null:c(r)})(r.user_id);return(0,t.jsx)(ec.Typography.Text,{children:l?`$${(0,s.formatNumberWithCommas)(Number(l),4)}`:"No Limit"})}},{title:(0,t.jsxs)(em.Space,{direction:"horizontal",children:["Team Member Rate Limits",(0,t.jsx)(k.Tooltip,{title:"Rate limits for this member's usage within this team.",children:(0,t.jsx)(m.InfoCircleOutlined,{})})]}),key:"rate_limits",render:(a,r)=>(0,t.jsx)(ec.Typography.Text,{children:(t=>{if(!t)return"No Limits";let a=e.team_memberships.find(e=>e.user_id===t),r=a?.litellm_budget_table?.rpm_limit,l=a?.litellm_budget_table?.tpm_limit,i=[r?`${c(r)} RPM`:null,l?`${c(l)} TPM`:null].filter(Boolean);return i.length>0?i.join(" / "):"No Limits"})(r.user_id)})}];return(0,t.jsx)(eu.default,{members:e.team_info.members_with_roles,canEdit:r,onEdit:t=>{let a=e.team_memberships.find(e=>e.user_id===t.user_id);i({...t,max_budget_in_team:a?.litellm_budget_table?.max_budget||null,tpm_limit:a?.litellm_budget_table?.tpm_limit||null,rpm_limit:a?.litellm_budget_table?.rpm_limit||null}),n(!0)},onDelete:l,onAddMember:()=>d(!0),roleColumnTitle:"Team Role",roleTooltip:"This role applies only to this team and is independent from the user's proxy-level role.",extraColumns:f,showDeleteForMember:()=>b||r&&!x||x&&!p})}var eh=e.i(207082),ep=e.i(871943),ex=e.i(502547),eb=e.i(360820),ef=e.i(94629),ey=e.i(152990),e_=e.i(682830),ev=e.i(994388),ej=e.i(752978),ew=e.i(282786),eC=e.i(981339),eS=e.i(969550),ek=e.i(20147),eN=e.i(266027),eT=e.i(633627);function eI({teamId:e,teamAlias:r,organization:l}){let{accessToken:i}=(0,a.default)(),[n,o]=(0,I.useState)(null),[d,c]=(0,I.useState)([{id:"created_at",desc:!0}]),[u,h]=(0,I.useState)({pageIndex:0,pageSize:50}),[p,b]=(0,I.useState)({"Organization ID":"","Key Alias":"","User ID":"","Sort By":"created_at","Sort Order":"desc"}),f=d.length>0?d[0].id:"created_at",y=d.length>0?d[0].desc?"desc":"asc":"desc",_=u.pageIndex,v=u.pageSize,{data:j,isPending:w,isFetching:C,refetch:S}=(0,eh.useKeys)(_+1,v,{teamID:e,organizationID:p["Organization ID"]?.trim()||void 0,selectedKeyAlias:p["Key Alias"]?.trim()||void 0,userID:p["User ID"]?.trim()||void 0,sortBy:f||void 0,sortOrder:y||void 0,expand:"user"}),N=(0,I.useMemo)(()=>{let e=j?.keys||[],t=l?.organization_id;return t?e.map(e=>({...e,organization_id:(e.organization_id??e.org_id)||t})):e},[j?.keys,l?.organization_id]),T=j?.total_pages??0,[M,O]=(0,I.useState)({}),z=(0,I.useMemo)(()=>({team_id:e,team_alias:r||e,models:[],max_budget:null,budget_duration:null,tpm_limit:null,rpm_limit:null,organization_id:l?.organization_id||"",created_at:"",keys:[],members_with_roles:[],spend:0}),[e,r,l]),E=(0,eN.useQuery)({queryKey:["teamFilterOptions",e,i],queryFn:async()=>(0,eT.fetchTeamFilterOptions)(i,e),enabled:!!i&&!!e,staleTime:3e4}).data||{keyAliases:[],organizationIds:[],userIds:[]},P=(0,I.useCallback)(()=>{S?.()},[S]);(0,I.useEffect)(()=>(window.addEventListener("storage",P),()=>window.removeEventListener("storage",P)),[P]);let $=(0,I.useCallback)((e,t=!1)=>{b(t=>({...t,"Organization ID":e["Organization ID"]??t["Organization ID"],"Key Alias":e["Key Alias"]??t["Key Alias"],"User ID":e["User ID"]??t["User ID"],"Sort By":e["Sort By"]??t["Sort By"]??"created_at","Sort Order":e["Sort Order"]??t["Sort Order"]??"desc"})),t||h(e=>({...e,pageIndex:0}))},[]),F=(0,I.useCallback)(()=>{b({"Organization ID":"","Key Alias":"","User ID":"","Sort By":"created_at","Sort Order":"desc"}),h(e=>({...e,pageIndex:0}))},[]),L=(0,I.useMemo)(()=>[{name:"Organization ID",label:"Organization ID",isSearchable:!0,searchFn:async e=>{let{organizationIds:t}=E;if(!t.length)return[];let a=e.toLowerCase();return(a?t.filter(e=>e.toLowerCase().includes(a)):t).map(e=>({label:e,value:e}))}},{name:"Key Alias",label:"Key Alias",isSearchable:!0,searchFn:async e=>{let{keyAliases:t}=E,a=e.toLowerCase();return(a?t.filter(e=>e.toLowerCase().includes(a)):t).map(e=>({label:e,value:e}))}},{name:"User ID",label:"User ID",isSearchable:!0,searchFn:async e=>{let{userIds:t}=E,a=e.toLowerCase();return(a?t.filter(e=>e.id.toLowerCase().includes(a)||e.email.toLowerCase().includes(a)):t).map(e=>({label:e.email?`${e.id} (${e.email})`:e.id,value:e.id}))}}],[E]),A=(0,I.useMemo)(()=>[{id:"token",accessorKey:"token",header:"Key ID",size:100,enableSorting:!0,cell:e=>{let a=e.getValue(),r=e.cell.column.getSize();return(0,t.jsx)(k.Tooltip,{title:a,children:(0,t.jsx)(ev.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:r,overflow:"hidden"},onClick:()=>o(e.row.original),children:a??"-"})})}},{id:"key_alias",accessorKey:"key_alias",header:"Key Alias",size:150,enableSorting:!0,cell:e=>{let a=e.getValue(),r=e.cell.column.getSize();return(0,t.jsx)(k.Tooltip,{title:a,children:(0,t.jsx)("span",{className:"font-mono text-xs truncate block",style:{maxWidth:r,overflow:"hidden"},children:a??"-"})})}},{id:"key_name",accessorKey:"key_name",header:"Secret Key",size:120,enableSorting:!1,cell:e=>(0,t.jsx)("span",{className:"font-mono text-xs",children:e.getValue()})},{id:"organization_id",accessorKey:"organization_id",header:"Organization ID",size:140,enableSorting:!1,cell:e=>e.getValue()?e.renderValue():"-"},{id:"user_email",accessorKey:"user",header:"User Email",size:160,enableSorting:!1,cell:e=>{let a=e.getValue(),r=a?.user_email,l=e.cell.column.getSize();return(0,t.jsx)(k.Tooltip,{title:r,children:(0,t.jsx)("span",{className:"font-mono text-xs truncate block",style:{maxWidth:l,overflow:"hidden"},children:r??"-"})})}},{id:"user_id",accessorKey:"user_id",header:"User ID",size:70,enableSorting:!1,cell:e=>{let a=e.getValue(),r="default_user_id"===a?"Default Proxy Admin":a,l=e.cell.column.getSize();return(0,t.jsx)(k.Tooltip,{title:r,children:(0,t.jsx)("span",{className:"font-mono text-xs truncate block",style:{maxWidth:l,overflow:"hidden"},children:r??"-"})})}},{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 a=e.getValue(),r="default_user_id"===a?"Default Proxy Admin":a,l=e.cell.column.getSize();return(0,t.jsx)(k.Tooltip,{title:r,children:(0,t.jsx)("span",{className:"font-mono text-xs truncate block",style:{maxWidth:l,overflow:"hidden"},children:r??"-"})})}},{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)(ew.Popover,{content:"This is a new field and is not backfilled. Only new key usage will update this value.",trigger:"hover",children:(0,t.jsx)(m.InfoCircleOutlined,{className:"text-gray-400 text-xs cursor-help"})})]}),size:130,enableSorting:!1,cell:e=>{let a=e.getValue();if(!a)return"Unknown";let r=new Date(a);return(0,t.jsx)(k.Tooltip,{title:r.toLocaleString(void 0,{dateStyle:"medium",timeStyle:"long"}),children:(0,t.jsx)("span",{children:r.toLocaleDateString()})})}},{id:"expires",accessorKey:"expires",header:"Expires",size:120,enableSorting:!1,cell:e=>{let t=e.getValue();return t?new Date(t).toLocaleDateString():"Never"}},{id:"spend",accessorKey:"spend",header:"Spend (USD)",size:100,enableSorting:!0,cell:e=>(0,s.formatNumberWithCommas)(e.getValue(),4)},{id:"max_budget",accessorKey:"max_budget",header:"Budget (USD)",size:110,enableSorting:!0,cell:e=>{let t=e.getValue();return null===t?"Unlimited":`$${(0,s.formatNumberWithCommas)(t)}`}},{id:"budget_reset_at",accessorKey:"budget_reset_at",header:"Budget Reset",size:130,enableSorting:!1,cell:e=>{let t=e.getValue();return t?new Date(t).toLocaleString():"Never"}},{id:"models",accessorKey:"models",header:"Models",size:200,enableSorting:!1,cell:e=>{let a=e.getValue();return(0,t.jsx)("div",{className:"flex flex-col py-2",children:Array.isArray(a)?(0,t.jsx)("div",{className:"flex flex-col",children:0===a.length?(0,t.jsx)(g.Badge,{size:"xs",className:"mb-1",color:"red",children:(0,t.jsx)(x.Text,{children:"All Proxy Models"})}):(0,t.jsx)(t.Fragment,{children:(0,t.jsxs)("div",{className:"flex items-start",children:[a.length>3&&(0,t.jsx)("div",{children:(0,t.jsx)(ej.Icon,{icon:M[e.row.id]?ep.ChevronDownIcon:ex.ChevronRightIcon,className:"cursor-pointer",size:"xs",onClick:()=>O(t=>({...t,[e.row.id]:!t[e.row.id]}))})}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-1",children:[a.slice(0,3).map((e,a)=>"all-proxy-models"===e?(0,t.jsx)(g.Badge,{size:"xs",color:"red",children:(0,t.jsx)(x.Text,{children:"All Proxy Models"})},a):(0,t.jsx)(g.Badge,{size:"xs",color:"blue",children:(0,t.jsx)(x.Text,{children:e.length>30?`${(0,D.getModelDisplayName)(e).slice(0,30)}...`:(0,D.getModelDisplayName)(e)})},a)),a.length>3&&!M[e.row.id]&&(0,t.jsx)(g.Badge,{size:"xs",color:"gray",className:"cursor-pointer",children:(0,t.jsxs)(x.Text,{children:["+",a.length-3," ",a.length-3==1?"more model":"more models"]})}),M[e.row.id]&&(0,t.jsx)("div",{className:"flex flex-wrap gap-1",children:a.slice(3).map((e,a)=>"all-proxy-models"===e?(0,t.jsx)(g.Badge,{size:"xs",color:"red",children:(0,t.jsx)(x.Text,{children:"All Proxy Models"})},a+3):(0,t.jsx)(g.Badge,{size:"xs",color:"blue",children:(0,t.jsx)(x.Text,{children:e.length>30?`${(0,D.getModelDisplayName)(e).slice(0,30)}...`:(0,D.getModelDisplayName)(e)})},a+3))})]})]})})}):null})}},{id:"rate_limits",header:"Rate Limits",size:140,enableSorting:!1,cell:({row:e})=>{let a=e.original;return(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{children:["TPM: ",null!==a.tpm_limit?a.tpm_limit:"Unlimited"]}),(0,t.jsxs)("div",{children:["RPM: ",null!==a.rpm_limit?a.rpm_limit:"Unlimited"]})]})}}],[M]),R=(0,I.useCallback)(e=>{let t="function"==typeof e?e(d):e;if(c(t),t?.length>0){let e=t[0];$({"Sort By":e.id,"Sort Order":e.desc?"desc":"asc"},!0)}},[d,$]),B=(0,ey.useReactTable)({data:N,columns:A,columnResizeMode:"onChange",columnResizeDirection:"ltr",state:{sorting:d,pagination:u},onSortingChange:R,onPaginationChange:h,getCoreRowModel:(0,e_.getCoreRowModel)(),enableSorting:!0,manualSorting:!0,manualPagination:!0,pageCount:T});return(0,t.jsx)("div",{className:"w-full h-full overflow-hidden",children:n?(0,t.jsx)(ek.default,{keyId:n.token,onClose:()=>o(null),keyData:n,teams:[z],onDelete:S}):(0,t.jsxs)("div",{className:"border-b py-4 flex-1 overflow-hidden",children:[(0,t.jsx)("div",{className:"w-full mb-6",children:(0,t.jsx)(eS.default,{options:L,onApplyFilters:$,initialValues:p,onResetFilters:F})}),(0,t.jsx)("div",{className:"flex items-center justify-end w-full mb-4",children:(0,t.jsxs)("div",{className:"inline-flex items-center gap-2",children:[w||C?(0,t.jsx)(eC.Skeleton.Node,{active:!0,style:{width:74,height:20}}):(0,t.jsxs)("span",{className:"text-sm text-gray-700",children:["Page ",_+1," of ",B.getPageCount()]}),w||C?(0,t.jsx)(eC.Skeleton.Button,{active:!0,size:"small",style:{width:84,height:30}}):(0,t.jsx)("button",{onClick:()=>B.previousPage(),disabled:w||C||!B.getCanPreviousPage(),className:"px-3 py-1 text-sm border rounded-md hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed",children:"Previous"}),w||C?(0,t.jsx)(eC.Skeleton.Button,{active:!0,size:"small",style:{width:58,height:30}}):(0,t.jsx)("button",{onClick:()=>B.nextPage(),disabled:w||C||!B.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)(H.Table,{className:"[&_td]:py-0.5 [&_th]:py-1",style:{width:B.getCenterTotalSize()},children:[(0,t.jsx)(X.TableHead,{children:B.getHeaderGroups().map(e=>(0,t.jsx)(J.TableRow,{children:e.headers.map(e=>(0,t.jsx)(Y.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,ey.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)(eb.ChevronUpIcon,{className:"h-4 w-4 text-blue-500"}),desc:(0,t.jsx)(ep.ChevronDownIcon,{className:"h-4 w-4 text-blue-500"})})[e.column.getIsSorted()]:(0,t.jsx)(ef.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 ${B.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)(G.TableBody,{children:w||C?(0,t.jsx)(J.TableRow,{children:(0,t.jsx)(Q.TableCell,{colSpan:A.length,className:"h-8 text-center",children:(0,t.jsx)("div",{className:"text-center text-gray-500",children:(0,t.jsx)("p",{children:"Loading keys..."})})})}):N.length>0?B.getRowModel().rows.map(e=>(0,t.jsx)(J.TableRow,{className:"h-8",children:e.getVisibleCells().map(e=>(0,t.jsx)(Q.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,ey.flexRender)(e.column.columnDef.cell,e.getContext())},e.id))},e.id)):(0,t.jsx)(J.TableRow,{children:(0,t.jsx)(Q.TableCell,{colSpan:A.length,className:"h-8 text-center",children:(0,t.jsx)("div",{className:"text-center text-gray-500",children:(0,t.jsx)("p",{children:"No keys found"})})})})})]})})})})]})})}e.s(["default",0,({teamId:e,onClose:W,accessToken:H,is_team_admin:G,is_proxy_admin:Q,is_org_admin:X=!1,userModels:Y,editTeam:J,premiumUser:Z=!1,onUpdate:ee})=>{let[et,ed]=(0,I.useState)(null),[em,ec]=(0,I.useState)(!0),[eu,eh]=(0,I.useState)(!1),[ep]=_.Form.useForm(),[ex,eb]=(0,I.useState)(!1),[ef,ey]=(0,I.useState)(null),[e_,ev]=(0,I.useState)(!1),[ej,ew]=(0,I.useState)([]),[eC,eS]=(0,I.useState)(!1),[ek,eN]=(0,I.useState)({}),[eT,eM]=(0,I.useState)([]),[eO,ez]=(0,I.useState)([]),[eE,eP]=(0,I.useState)({}),[eD,e$]=(0,I.useState)(!1),[eF,eL]=(0,I.useState)(null),[eA,eR]=(0,I.useState)(!1),[eB,eU]=(0,I.useState)(!1),[eV,eK]=(0,I.useState)(!1),[eq,eW]=(0,I.useState)(null),{userRole:eH,userId:eG}=(0,a.default)(),{data:eQ=[]}=(0,r.useOrganizations)(),eX=(0,I.useMemo)(()=>{let e=et?.team_info?.organization_id;if(!e||!eG)return!1;let t=eQ.find(t=>t.organization_id===e);return t?.members?.some(e=>e.user_id===eG&&"org_admin"===e.user_role)??!1},[et,eQ,eG]),eY=G||Q||X||eX,eJ=(0,I.useMemo)(()=>{let e;return e=[er,el],eY?[...e,ei,es,en]:e},[eY]),eZ=(0,I.useMemo)(()=>J&&eY?en:er,[J,eY]),e0=async()=>{try{if(ec(!0),!H)return;let t=await (0,i.teamInfoCall)(H,e);ed(t)}catch(e){R.default.fromBackend("Failed to load team information"),console.error("Error fetching team info:",e)}finally{ec(!1)}};(0,I.useEffect)(()=>{e0()},[e,H]),(0,I.useEffect)(()=>{(async()=>{if(!H||!et?.team_info?.organization_id)return eW(null);try{let e=await (0,i.organizationInfoCall)(H,et.team_info.organization_id);eW(e)}catch(e){console.error("Error fetching organization info:",e),eW(null)}})()},[H,et?.team_info?.organization_id]),(0,I.useMemo)(()=>{let e;return e=[],e=eq?eq.models.includes("all-proxy-models")?Y:eq.models.length>0?eq.models:Y:Y,(0,D.unfurlWildcardModelsInList)(e,Y)},[eq,Y]),(0,I.useEffect)(()=>{let e=async()=>{try{if(!H)return;let e=(await (0,i.getPoliciesList)(H)).policies.map(e=>e.policy_name);ez(e)}catch(e){console.error("Failed to fetch policies:",e)}};(async()=>{try{if(!H)return;let e=(await (0,i.getGuardrailsList)(H)).guardrails.map(e=>e.guardrail_name);eM(e)}catch(e){console.error("Failed to fetch guardrails:",e)}})(),e()},[H]),(0,I.useEffect)(()=>{(async()=>{if(!H||!et?.team_info?.policies||0===et.team_info.policies.length)return;e$(!0);let e={};try{await Promise.all(et.team_info.policies.map(async t=>{try{let a=await (0,i.getPolicyInfoWithGuardrails)(H,t);e[t]=a.resolved_guardrails||[]}catch(a){console.error(`Failed to fetch guardrails for policy ${t}:`,a),e[t]=[]}})),eP(e)}catch(e){console.error("Failed to fetch policy guardrails:",e)}finally{e$(!1)}})()},[H,et?.team_info?.policies]);let e1=async t=>{try{if(null==H)return;let a={user_email:t.user_email,user_id:t.user_id,role:t.role};await (0,i.teamMemberAddCall)(H,e,a),R.default.success("Team member added successfully"),eh(!1),ep.resetFields();let r=await (0,i.teamInfoCall)(H,e);ed(r),ee(r)}catch(t){let e="Failed to add team member";t?.raw?.detail?.error?.includes("Assigning team admins is a premium feature")?e="Assigning admins is an enterprise-only feature. Please upgrade your LiteLLM plan to enable this.":t?.message&&(e=t.message),R.default.fromBackend(e),console.error("Error adding team member:",t)}},e2=async t=>{try{if(null==H)return;let a={user_email:t.user_email,user_id:t.user_id,role:t.role,max_budget_in_team:t.max_budget_in_team,tpm_limit:t.tpm_limit,rpm_limit:t.rpm_limit};j.message.destroy(),await (0,i.teamMemberUpdateCall)(H,e,a),R.default.success("Team member updated successfully"),eb(!1);let r=await (0,i.teamInfoCall)(H,e);ed(r),ee(r)}catch(t){let e="Failed to update team member";t?.raw?.detail?.includes("Assigning team admins is a premium feature")?e="Assigning admins is an enterprise-only feature. Please upgrade your LiteLLM plan to enable this.":t?.message&&(e=t.message),eb(!1),j.message.destroy(),R.default.fromBackend(e),console.error("Error updating team member:",t)}},e4=async()=>{if(eF&&H){eU(!0);try{await (0,i.teamMemberDeleteCall)(H,e,eF),R.default.success("Team member removed successfully");let t=await (0,i.teamInfoCall)(H,e);ed(t),ee(t)}catch(e){R.default.fromBackend("Failed to remove team member"),console.error("Error removing team member:",e)}finally{eU(!1),eR(!1),eL(null)}}},e5=async t=>{try{let a;if(!H)return;eK(!0);let r={};try{let{soft_budget_alerting_emails:e,...a}=t.metadata?JSON.parse(t.metadata):{};r=a}catch(e){R.default.fromBackend("Invalid JSON in metadata field");return}if("string"==typeof t.secret_manager_settings&&t.secret_manager_settings.trim().length>0)try{a=JSON.parse(t.secret_manager_settings)}catch(e){R.default.fromBackend("Invalid JSON in secret manager settings");return}let l=e=>null==e||"string"==typeof e&&""===e.trim()||"number"==typeof e&&Number.isNaN(e)?null:e,s={team_id:e,team_alias:t.team_alias,models:t.models,tpm_limit:l(t.tpm_limit),rpm_limit:l(t.rpm_limit),max_budget:t.max_budget,soft_budget:l(t.soft_budget),budget_duration:t.budget_duration,metadata:{...r,...t.guardrails?.length>0?{guardrails:t.guardrails}:{},...t.logging_settings?.length>0?{logging:t.logging_settings}:{},disable_global_guardrails:t.disable_global_guardrails||!1,soft_budget_alerting_emails:"string"==typeof t.soft_budget_alerting_emails?t.soft_budget_alerting_emails.split(",").map(e=>e.trim()).filter(e=>e.length>0):t.soft_budget_alerting_emails||[],...void 0!==a?{secret_manager_settings:a}:{}},...t.policies?.length>0?{policies:t.policies}:{},organization_id:t.organization_id};s.max_budget=(0,n.mapEmptyStringToNull)(s.max_budget),s.team_member_budget_duration=t.team_member_budget_duration,void 0!==t.team_member_budget&&(s.team_member_budget=Number(t.team_member_budget)),void 0!==t.team_member_key_duration&&(s.team_member_key_duration=t.team_member_key_duration),(void 0!==t.team_member_tpm_limit||void 0!==t.team_member_rpm_limit)&&(s.team_member_tpm_limit=l(t.team_member_tpm_limit),s.team_member_rpm_limit=l(t.team_member_rpm_limit));let{servers:o,accessGroups:d}=t.mcp_servers_and_groups||{servers:[],accessGroups:[]},m=new Set(o||[]),c=Object.fromEntries(Object.entries(t.mcp_tool_permissions||{}).filter(([e])=>m.has(e)));s.object_permission={},o&&(s.object_permission.mcp_servers=o),d&&(s.object_permission.mcp_access_groups=d),c&&(s.object_permission.mcp_tool_permissions=c),delete t.mcp_servers_and_groups,delete t.mcp_tool_permissions;let{agents:u,accessGroups:g}=t.agents_and_groups||{agents:[],accessGroups:[]};u&&u.length>0&&(s.object_permission.agents=u),g&&g.length>0&&(s.object_permission.agent_access_groups=g),delete t.agents_and_groups,t.vector_stores&&t.vector_stores.length>0&&(s.object_permission.vector_stores=t.vector_stores),void 0!==t.access_group_ids&&(s.access_group_ids=t.access_group_ids),await (0,i.teamUpdateCall)(H,s),R.default.success("Team settings updated successfully"),ev(!1),e0()}catch(e){console.error("Error updating team:",e)}finally{eK(!1)}};if(em)return(0,t.jsx)("div",{className:"p-4",children:"Loading..."});if(!et?.team_info)return(0,t.jsx)("div",{className:"p-4",children:"Team not found"});let{team_info:e7}=et,e6=async(e,t)=>{await (0,s.copyToClipboard)(e)&&(eN(e=>({...e,[t]:!0})),setTimeout(()=>{eN(e=>({...e,[t]:!1}))},2e3))};return(0,t.jsxs)("div",{className:"p-4",children:[(0,t.jsx)("div",{className:"flex justify-between items-center mb-6",children:(0,t.jsxs)("div",{children:[(0,t.jsx)(y.Button,{type:"text",icon:(0,t.jsx)(u.ArrowLeftIcon,{className:"h-4 w-4"}),onClick:W,className:"mb-4",children:"Back to Teams"}),(0,t.jsx)(f.Title,{children:e7.team_alias}),(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)(x.Text,{className:"text-gray-500 font-mono",children:e7.team_id}),(0,t.jsx)(y.Button,{type:"text",size:"small",icon:ek["team-id"]?(0,t.jsx)(N.CheckIcon,{size:12}):(0,t.jsx)(T.CopyIcon,{size:12}),onClick:()=>e6(e7.team_id,"team-id"),className:`left-2 z-10 transition-all duration-200 ${ek["team-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100"}`})]})]})}),(0,t.jsx)(S.Tabs,{defaultActiveKey:eZ,className:"mb-4",items:[{key:er,label:eo[er],children:(0,t.jsxs)(p.Grid,{numItems:1,numItemsSm:2,numItemsLg:3,className:"gap-6",children:[(0,t.jsxs)(h.Card,{children:[(0,t.jsx)(x.Text,{children:"Budget Status"}),(0,t.jsxs)("div",{className:"mt-2",children:[(0,t.jsxs)(f.Title,{children:["$",(0,s.formatNumberWithCommas)(e7.spend,4)]}),(0,t.jsxs)(x.Text,{children:["of ",null===e7.max_budget?"Unlimited":`$${(0,s.formatNumberWithCommas)(e7.max_budget,4)}`]}),e7.budget_duration&&(0,t.jsxs)(x.Text,{className:"text-gray-500",children:["Reset: ",e7.budget_duration]}),(0,t.jsx)("br",{}),e7.team_member_budget_table&&(0,t.jsxs)(x.Text,{className:"text-gray-500",children:["Team Member Budget: $",(0,s.formatNumberWithCommas)(e7.team_member_budget_table.max_budget,4)]})]})]}),(0,t.jsxs)(h.Card,{children:[(0,t.jsx)(x.Text,{children:"Rate Limits"}),(0,t.jsxs)("div",{className:"mt-2",children:[(0,t.jsxs)(x.Text,{children:["TPM: ",e7.tpm_limit||"Unlimited"]}),(0,t.jsxs)(x.Text,{children:["RPM: ",e7.rpm_limit||"Unlimited"]}),e7.max_parallel_requests&&(0,t.jsxs)(x.Text,{children:["Max Parallel Requests: ",e7.max_parallel_requests]})]})]}),(0,t.jsxs)(h.Card,{children:[(0,t.jsx)(x.Text,{children:"Models"}),(0,t.jsx)("div",{className:"mt-2 flex flex-wrap gap-2",children:0===e7.models.length?(0,t.jsx)(g.Badge,{color:"red",children:"All proxy models"}):e7.models.map((e,a)=>(0,t.jsx)(g.Badge,{color:"red",children:e},a))})]}),(0,t.jsxs)(h.Card,{children:[(0,t.jsx)(x.Text,{className:"font-semibold text-gray-900",children:"Virtual Keys"}),(0,t.jsxs)("div",{className:"mt-2",children:[(0,t.jsxs)(x.Text,{children:["User Keys: ",et.keys.filter(e=>e.user_id).length]}),(0,t.jsxs)(x.Text,{children:["Service Account Keys: ",et.keys.filter(e=>!e.user_id).length]}),(0,t.jsxs)(x.Text,{className:"text-gray-500",children:["Total: ",et.keys.length]})]})]}),(0,t.jsx)(B.default,{objectPermission:e7.object_permission,variant:"card",accessToken:H}),(0,t.jsxs)(h.Card,{children:[(0,t.jsx)(x.Text,{className:"font-semibold text-gray-900 mb-3",children:"Guardrails"}),e7.guardrails&&e7.guardrails.length>0?(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:e7.guardrails.map((e,a)=>(0,t.jsx)(g.Badge,{color:"blue",children:e},a))}):(0,t.jsx)(x.Text,{className:"text-gray-500",children:"No guardrails configured"}),e7.metadata?.disable_global_guardrails&&(0,t.jsx)("div",{className:"mt-3 pt-3 border-t border-gray-200",children:(0,t.jsx)(g.Badge,{color:"yellow",children:"Global Guardrails Disabled"})})]}),(0,t.jsxs)(h.Card,{children:[(0,t.jsx)(x.Text,{className:"font-semibold text-gray-900 mb-3",children:"Policies"}),e7.policies&&e7.policies.length>0?(0,t.jsx)("div",{className:"space-y-4",children:e7.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)(g.Badge,{color:"purple",children:e}),eD&&(0,t.jsx)(x.Text,{className:"text-xs text-gray-400",children:"Loading guardrails..."})]}),!eD&&eE[e]&&eE[e].length>0&&(0,t.jsxs)("div",{className:"ml-4 pl-3 border-l-2 border-gray-200",children:[(0,t.jsx)(x.Text,{className:"text-xs text-gray-500 mb-1",children:"Resolved Guardrails:"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-1",children:eE[e].map((e,a)=>(0,t.jsx)(g.Badge,{color:"blue",size:"xs",children:e},a))})]})]},a))}):(0,t.jsx)(x.Text,{className:"text-gray-500",children:"No policies configured"})]}),(0,t.jsx)($.default,{loggingConfigs:e7.metadata?.logging||[],disabledCallbacks:[],variant:"card"})]})},{key:el,label:eo[el],children:(0,t.jsx)(eI,{teamId:e,teamAlias:e7.team_alias,organization:eq})},{key:ei,label:eo[ei],children:(0,t.jsx)(eg,{teamData:et,canEditTeam:eY,handleMemberDelete:e=>{eL(e),eR(!0)},setSelectedEditMember:ey,setIsEditMemberModalVisible:eb,setIsAddMemberModalVisible:eh})},{key:es,label:eo[es],children:(0,t.jsx)(ea,{teamId:e,accessToken:H,canEditTeam:eY})},{key:en,label:eo[en],children:(0,t.jsxs)(h.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)(f.Title,{children:"Team Settings"}),eY&&!e_&&(0,t.jsx)(y.Button,{icon:(0,t.jsx)(d.EditOutlined,{className:"h-4 w-4"}),onClick:()=>ev(!0),children:"Edit Settings"})]}),e_?(0,t.jsxs)(_.Form,{form:ep,onFinish:e5,initialValues:{...e7,team_alias:e7.team_alias,models:e7.models,tpm_limit:e7.tpm_limit,rpm_limit:e7.rpm_limit,max_budget:e7.max_budget,soft_budget:e7.soft_budget,budget_duration:e7.budget_duration,team_member_tpm_limit:e7.team_member_budget_table?.tpm_limit,team_member_rpm_limit:e7.team_member_budget_table?.rpm_limit,team_member_budget:e7.team_member_budget_table?.max_budget,team_member_budget_duration:e7.team_member_budget_table?.budget_duration,guardrails:e7.metadata?.guardrails||[],policies:e7.policies||[],disable_global_guardrails:e7.metadata?.disable_global_guardrails||!1,soft_budget_alerting_emails:Array.isArray(e7.metadata?.soft_budget_alerting_emails)?e7.metadata.soft_budget_alerting_emails.join(", "):"",metadata:e7.metadata?JSON.stringify((({logging:e,secret_manager_settings:t,soft_budget_alerting_emails:a,...r})=>r)(e7.metadata),null,2):"",logging_settings:e7.metadata?.logging||[],secret_manager_settings:e7.metadata?.secret_manager_settings?JSON.stringify(e7.metadata.secret_manager_settings,null,2):"",organization_id:e7.organization_id,vector_stores:e7.object_permission?.vector_stores||[],mcp_servers:e7.object_permission?.mcp_servers||[],mcp_access_groups:e7.object_permission?.mcp_access_groups||[],mcp_servers_and_groups:{servers:e7.object_permission?.mcp_servers||[],accessGroups:e7.object_permission?.mcp_access_groups||[]},mcp_tool_permissions:e7.object_permission?.mcp_tool_permissions||{},agents_and_groups:{agents:e7.object_permission?.agents||[],accessGroups:e7.object_permission?.agent_access_groups||[]},access_group_ids:e7.access_group_ids||[]},layout:"vertical",children:[(0,t.jsx)(_.Form.Item,{label:"Team Name",name:"team_alias",rules:[{required:!0,message:"Please input a team name"}],children:(0,t.jsx)(v.Input,{type:""})}),(0,t.jsx)(_.Form.Item,{label:"Models",name:"models",rules:[{required:!0,message:"Please select at least one model"}],children:(0,t.jsx)(A.ModelSelect,{value:ep.getFieldValue("models")||[],onChange:e=>ep.setFieldValue("models",e),teamID:e,organizationID:et?.team_info?.organization_id||void 0,options:{includeSpecialOptions:!0,includeUserModels:!et?.team_info?.organization_id,showAllProxyModelsOverride:(0,o.isProxyAdminRole)(eH)&&!et?.team_info?.organization_id},context:"team",dataTestId:"models-select"})}),(0,t.jsx)(_.Form.Item,{label:"Max Budget (USD)",name:"max_budget",children:(0,t.jsx)(U.default,{step:.01,precision:2,style:{width:"100%"}})}),(0,t.jsx)(_.Form.Item,{label:"Soft Budget (USD)",name:"soft_budget",children:(0,t.jsx)(U.default,{step:.01,precision:2,style:{width:"100%"}})}),(0,t.jsx)(_.Form.Item,{label:"Soft Budget Alerting Emails",name:"soft_budget_alerting_emails",tooltip:"Comma-separated email addresses to receive alerts when the soft budget is reached",children:(0,t.jsx)(v.Input,{placeholder:"example1@test.com, example2@test.com"})}),(0,t.jsx)(_.Form.Item,{label:"Team Member Budget (USD)",name:"team_member_budget",tooltip:"This is the individual budget for a user in the team.",children:(0,t.jsx)(U.default,{step:.01,precision:2,style:{width:"100%"}})}),(0,t.jsx)(_.Form.Item,{label:"Team Member Budget Duration",name:"team_member_budget_duration",children:(0,t.jsx)(E,{onChange:e=>ep.setFieldValue("team_member_budget_duration",e),value:ep.getFieldValue("team_member_budget_duration")})}),(0,t.jsx)(_.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)(b.TextInput,{placeholder:"e.g., 30d"})}),(0,t.jsx)(_.Form.Item,{label:"Team Member TPM Limit",name:"team_member_tpm_limit",tooltip:"Default tokens per minute limit for an individual team member. This limit applies to all requests the user makes within this team. Can be overridden per member.",children:(0,t.jsx)(U.default,{step:1,style:{width:"100%"},placeholder:"e.g., 1000"})}),(0,t.jsx)(_.Form.Item,{label:"Team Member RPM Limit",name:"team_member_rpm_limit",tooltip:"Default requests per minute limit for an individual team member. This limit applies to all requests the user makes within this team. Can be overridden per member.",children:(0,t.jsx)(U.default,{step:1,style:{width:"100%"},placeholder:"e.g., 100"})}),(0,t.jsx)(_.Form.Item,{label:"Reset Budget",name:"budget_duration",children:(0,t.jsxs)(w.Select,{placeholder:"n/a",children:[(0,t.jsx)(w.Select.Option,{value:"24h",children:"daily"}),(0,t.jsx)(w.Select.Option,{value:"7d",children:"weekly"}),(0,t.jsx)(w.Select.Option,{value:"30d",children:"monthly"})]})}),(0,t.jsx)(_.Form.Item,{label:"Tokens per minute Limit (TPM)",name:"tpm_limit",children:(0,t.jsx)(U.default,{step:1,style:{width:"100%"}})}),(0,t.jsx)(_.Form.Item,{label:"Requests per minute Limit (RPM)",name:"rpm_limit",children:(0,t.jsx)(U.default,{step:1,style:{width:"100%"}})}),(0,t.jsx)(_.Form.Item,{label:(0,t.jsxs)("span",{children:["Guardrails"," ",(0,t.jsx)(k.Tooltip,{title:"Setup your first guardrail",children:(0,t.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/guardrails/quick_start",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:(0,t.jsx)(m.InfoCircleOutlined,{style:{marginLeft:"4px"}})})})]}),name:"guardrails",help:"Select existing guardrails or enter new ones",children:(0,t.jsx)(w.Select,{mode:"tags",placeholder:"Select or enter guardrails",options:eT.map(e=>({value:e,label:e}))})}),(0,t.jsx)(_.Form.Item,{label:(0,t.jsxs)("span",{children:["Disable Global Guardrails",(0,t.jsx)(k.Tooltip,{title:"When enabled, this team will bypass any guardrails configured to run on every request (global guardrails)",children:(0,t.jsx)(m.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"disable_global_guardrails",valuePropName:"checked",help:"Bypass global guardrails for this team",children:(0,t.jsx)(C.Switch,{checkedChildren:"Yes",unCheckedChildren:"No"})}),(0,t.jsx)(_.Form.Item,{label:(0,t.jsxs)("span",{children:["Policies"," ",(0,t.jsx)(k.Tooltip,{title:"Apply policies to this team to control guardrails and other settings",children:(0,t.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/guardrails/guardrail_policies",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:(0,t.jsx)(m.InfoCircleOutlined,{style:{marginLeft:"4px"}})})})]}),name:"policies",help:"Select existing policies or enter new ones",children:(0,t.jsx)(w.Select,{mode:"tags",placeholder:"Select or enter policies",options:eO.map(e=>({value:e,label:e}))})}),(0,t.jsx)(_.Form.Item,{label:(0,t.jsxs)("span",{children:["Access Groups"," ",(0,t.jsx)(k.Tooltip,{title:"Assign access groups to this team. Access groups control which models, MCP servers, and agents this team can use",children:(0,t.jsx)(m.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"access_group_ids",children:(0,t.jsx)(M.default,{placeholder:"Select access groups (optional)"})}),(0,t.jsx)(_.Form.Item,{label:"Vector Stores",name:"vector_stores","aria-label":"Vector Stores",children:(0,t.jsx)(V.default,{onChange:e=>ep.setFieldValue("vector_stores",e),value:ep.getFieldValue("vector_stores"),accessToken:H||"",placeholder:"Select vector stores"})}),(0,t.jsx)(_.Form.Item,{label:"Allowed Pass Through Routes",name:"allowed_passthrough_routes",children:(0,t.jsx)(P.default,{onChange:e=>ep.setFieldValue("allowed_passthrough_routes",e),value:ep.getFieldValue("allowed_passthrough_routes"),accessToken:H||"",placeholder:"Select pass through routes"})}),(0,t.jsx)(_.Form.Item,{label:"MCP Servers / Access Groups",name:"mcp_servers_and_groups",children:(0,t.jsx)(F.default,{onChange:e=>ep.setFieldValue("mcp_servers_and_groups",e),value:ep.getFieldValue("mcp_servers_and_groups"),accessToken:H||"",placeholder:"Select MCP servers or access groups (optional)"})}),(0,t.jsx)(_.Form.Item,{name:"mcp_tool_permissions",initialValue:{},hidden:!0,children:(0,t.jsx)(v.Input,{type:"hidden"})}),(0,t.jsx)(_.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)(L.default,{accessToken:H||"",selectedServers:ep.getFieldValue("mcp_servers_and_groups")?.servers||[],toolPermissions:ep.getFieldValue("mcp_tool_permissions")||{},onChange:e=>ep.setFieldsValue({mcp_tool_permissions:e})})})}),(0,t.jsx)(_.Form.Item,{label:"Agents / Access Groups",name:"agents_and_groups",children:(0,t.jsx)(O.default,{onChange:e=>ep.setFieldValue("agents_and_groups",e),value:ep.getFieldValue("agents_and_groups"),accessToken:H||"",placeholder:"Select agents or access groups (optional)"})}),(0,t.jsx)(_.Form.Item,{label:"Organization ID",name:"organization_id",children:(0,t.jsx)(v.Input,{type:"",disabled:!0})}),(0,t.jsx)(_.Form.Item,{label:"Logging Settings",name:"logging_settings",children:(0,t.jsx)(K.default,{value:ep.getFieldValue("logging_settings"),onChange:e=>ep.setFieldValue("logging_settings",e)})}),(0,t.jsx)(_.Form.Item,{label:"Secret Manager Settings",name:"secret_manager_settings",help:Z?"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)(v.Input.TextArea,{rows:6,placeholder:'{"namespace": "admin", "mount": "secret", "path_prefix": "litellm"}',disabled:!Z})}),(0,t.jsx)(_.Form.Item,{label:"Metadata",name:"metadata",children:(0,t.jsx)(v.Input.TextArea,{rows:10})}),(0,t.jsx)("div",{className:"sticky z-10 bg-white p-4 pr-0 border-t border-gray-200 bottom-[-1.5rem] inset-x-[-1.5rem]",children:(0,t.jsxs)("div",{className:"flex justify-end items-center gap-2",children:[(0,t.jsx)(y.Button,{onClick:()=>ev(!1),disabled:eV,children:"Cancel"}),(0,t.jsx)(y.Button,{icon:(0,t.jsx)(c.SaveOutlined,{className:"h-4 w-4"}),type:"primary",htmlType:"submit",loading:eV,children:"Save Changes"})]})})]}):(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(x.Text,{className:"font-medium",children:"Team Name"}),(0,t.jsx)("div",{children:e7.team_alias})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(x.Text,{className:"font-medium",children:"Team ID"}),(0,t.jsx)("div",{className:"font-mono",children:e7.team_id})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(x.Text,{className:"font-medium",children:"Created At"}),(0,t.jsx)("div",{children:new Date(e7.created_at).toLocaleString()})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(x.Text,{className:"font-medium",children:"Models"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:e7.models.map((e,a)=>(0,t.jsx)(g.Badge,{color:"red",children:e},a))})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(x.Text,{className:"font-medium",children:"Rate Limits"}),(0,t.jsxs)("div",{children:["TPM: ",e7.tpm_limit||"Unlimited"]}),(0,t.jsxs)("div",{children:["RPM: ",e7.rpm_limit||"Unlimited"]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(x.Text,{className:"font-medium",children:"Team Budget"}),(0,t.jsxs)("div",{children:["Max Budget:"," ",null!==e7.max_budget?`$${(0,s.formatNumberWithCommas)(e7.max_budget,4)}`:"No Limit"]}),(0,t.jsxs)("div",{children:["Soft Budget:"," ",null!==e7.soft_budget&&void 0!==e7.soft_budget?`$${(0,s.formatNumberWithCommas)(e7.soft_budget,4)}`:"No Limit"]}),(0,t.jsxs)("div",{children:["Budget Reset: ",e7.budget_duration||"Never"]}),e7.metadata?.soft_budget_alerting_emails&&Array.isArray(e7.metadata.soft_budget_alerting_emails)&&e7.metadata.soft_budget_alerting_emails.length>0&&(0,t.jsxs)("div",{children:["Soft Budget Alerting Emails: ",e7.metadata.soft_budget_alerting_emails.join(", ")]})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)(x.Text,{className:"font-medium",children:["Team Member Settings"," ",(0,t.jsx)(k.Tooltip,{title:"These are limits on individual team members",children:(0,t.jsx)(m.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),(0,t.jsxs)("div",{children:["Max Budget: ",e7.team_member_budget_table?.max_budget||"No Limit"]}),(0,t.jsxs)("div",{children:["Budget Duration: ",e7.team_member_budget_table?.budget_duration||"No Limit"]}),(0,t.jsxs)("div",{children:["Key Duration: ",e7.metadata?.team_member_key_duration||"No Limit"]}),(0,t.jsxs)("div",{children:["TPM Limit: ",e7.team_member_budget_table?.tpm_limit||"No Limit"]}),(0,t.jsxs)("div",{children:["RPM Limit: ",e7.team_member_budget_table?.rpm_limit||"No Limit"]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(x.Text,{className:"font-medium",children:"Organization ID"}),(0,t.jsx)("div",{children:e7.organization_id})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(x.Text,{className:"font-medium",children:"Status"}),(0,t.jsx)(g.Badge,{color:e7.blocked?"red":"green",children:e7.blocked?"Blocked":"Active"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(x.Text,{className:"font-medium",children:"Disable Global Guardrails"}),(0,t.jsx)("div",{children:e7.metadata?.disable_global_guardrails===!0?(0,t.jsx)(g.Badge,{color:"yellow",children:"Enabled - Global guardrails bypassed"}):(0,t.jsx)(g.Badge,{color:"green",children:"Disabled - Global guardrails active"})})]}),(0,t.jsx)(B.default,{objectPermission:e7.object_permission,variant:"inline",className:"pt-4 border-t border-gray-200",accessToken:H}),(0,t.jsx)($.default,{loggingConfigs:e7.metadata?.logging||[],disabledCallbacks:[],variant:"inline",className:"pt-4 border-t border-gray-200"}),e7.metadata?.secret_manager_settings&&(0,t.jsxs)("div",{className:"pt-4 border-t border-gray-200",children:[(0,t.jsx)(x.Text,{className:"font-medium",children:"Secret Manager Settings"}),(0,t.jsx)("pre",{className:"mt-2 bg-gray-50 p-3 rounded text-xs overflow-x-auto",children:JSON.stringify(e7.metadata.secret_manager_settings,null,2)})]})]})]})}].filter(e=>eJ.includes(e.key))}),(0,t.jsx)(q.default,{visible:ex,onCancel:()=>eb(!1),onSubmit:e2,initialData:ef,mode:"edit",config:{title:"Edit Member",showEmail:!0,showUserId:!0,roleOptions:[{label:"Admin",value:"admin"},{label:"User",value:"user"}],additionalFields:[{name:"max_budget_in_team",label:(0,t.jsxs)("span",{children:["Team Member Budget (USD)"," ",(0,t.jsx)(k.Tooltip,{title:"Maximum amount in USD this member can spend within this team. This is separate from any global user budget limits",children:(0,t.jsx)(m.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),type:"numerical",step:.01,min:0,placeholder:"Budget limit for this member within this team"},{name:"tpm_limit",label:(0,t.jsxs)("span",{children:["Team Member TPM Limit"," ",(0,t.jsx)(k.Tooltip,{title:"Maximum tokens per minute this member can use within this team. This is separate from any global user TPM limit",children:(0,t.jsx)(m.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),type:"numerical",step:1,min:0,placeholder:"Tokens per minute limit for this member in this team"},{name:"rpm_limit",label:(0,t.jsxs)("span",{children:["Team Member RPM Limit"," ",(0,t.jsx)(k.Tooltip,{title:"Maximum requests per minute this member can make within this team. This is separate from any global user RPM limit",children:(0,t.jsx)(m.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),type:"numerical",step:1,min:0,placeholder:"Requests per minute limit for this member in this team"}]}}),(0,t.jsx)(l.default,{isVisible:eu,onCancel:()=>eh(!1),onSubmit:e1,accessToken:H,teamId:e}),(0,t.jsx)(z.default,{isOpen:eA,title:"Delete Team Member",alertMessage:"Removing team members will also delete any keys created by or created for this member.",message:"Are you sure you want to remove this member from the team? This action cannot be undone.",resourceInformationTitle:"Team Member Information",resourceInformation:[{label:"User ID",value:eF?.user_id,code:!0},{label:"Email",value:eF?.user_email},{label:"Role",value:eF?.role}],onCancel:()=>{eR(!1),eL(null)},onOk:e4,confirmLoading:eB})]})}],56567)},829672,836938,310730,e=>{"use strict";e.i(247167);var t=e.i(271645),a=e.i(343794),r=e.i(914949),l=e.i(404948);let i=e=>e?"function"==typeof e?e():e:null;e.s(["getRenderPropValue",0,i],836938);var s=e.i(613541),n=e.i(763731),o=e.i(242064),d=e.i(491816);e.i(793154);var m=e.i(880476),c=e.i(183293),u=e.i(717356),g=e.i(320560),h=e.i(307358),p=e.i(246422),x=e.i(838378),b=e.i(617933);let f=(0,p.genStyleHooks)("Popover",e=>{let{colorBgElevated:t,colorText:a}=e,r=(0,x.mergeToken)(e,{popoverBg:t,popoverColor:a});return[(e=>{let{componentCls:t,popoverColor:a,titleMinWidth:r,fontWeightStrong:l,innerPadding:i,boxShadowSecondary:s,colorTextHeading:n,borderRadiusLG:o,zIndexPopup:d,titleMarginBottom:m,colorBgElevated:u,popoverBg:h,titleBorderBottom:p,innerContentPadding:x,titlePadding:b}=e;return[{[t]:Object.assign(Object.assign({},(0,c.resetComponent)(e)),{position:"absolute",top:0,left:{_skip_check_:!0,value:0},zIndex:d,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":u,width:"max-content",maxWidth:"100vw","&-rtl":{direction:"rtl"},"&-hidden":{display:"none"},[`${t}-content`]:{position:"relative"},[`${t}-inner`]:{backgroundColor:h,backgroundClip:"padding-box",borderRadius:o,boxShadow:s,padding:i},[`${t}-title`]:{minWidth:r,marginBottom:m,color:n,fontWeight:l,borderBottom:p,padding:b},[`${t}-inner-content`]:{color:a,padding:x}})},(0,g.default)(e,"var(--antd-arrow-background-color)"),{[`${t}-pure`]:{position:"relative",maxWidth:"none",margin:e.sizePopupArrow,display:"inline-block",[`${t}-content`]:{display:"inline-block"}}}]})(r),(e=>{let{componentCls:t}=e;return{[t]:b.PresetColors.map(a=>{let r=e[`${a}6`];return{[`&${t}-${a}`]:{"--antd-arrow-background-color":r,[`${t}-inner`]:{backgroundColor:r},[`${t}-arrow`]:{background:"transparent"}}}})}})(r),(0,u.initZoomMotion)(r,"zoom-big")]},e=>{let{lineWidth:t,controlHeight:a,fontHeight:r,padding:l,wireframe:i,zIndexPopupBase:s,borderRadiusLG:n,marginXS:o,lineType:d,colorSplit:m,paddingSM:c}=e,u=a-r;return Object.assign(Object.assign(Object.assign({titleMinWidth:177,zIndexPopup:s+30},(0,h.getArrowToken)(e)),(0,g.getArrowOffsetToken)({contentRadius:n,limitVerticalRadius:!0})),{innerPadding:12*!i,titleMarginBottom:i?0:o,titlePadding:i?`${u/2}px ${l}px ${u/2-t}px`:0,titleBorderBottom:i?`${t}px ${d} ${m}`:"none",innerContentPadding:i?`${c}px ${l}px`:0})},{resetStyle:!1,deprecatedTokens:[["width","titleMinWidth"],["minWidth","titleMinWidth"]]});var y=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 _=({title:e,content:a,prefixCls:r})=>e||a?t.createElement(t.Fragment,null,e&&t.createElement("div",{className:`${r}-title`},e),a&&t.createElement("div",{className:`${r}-inner-content`},a)):null,v=e=>{let{hashId:r,prefixCls:l,className:s,style:n,placement:o="top",title:d,content:c,children:u}=e,g=i(d),h=i(c),p=(0,a.default)(r,l,`${l}-pure`,`${l}-placement-${o}`,s);return t.createElement("div",{className:p,style:n},t.createElement("div",{className:`${l}-arrow`}),t.createElement(m.Popup,Object.assign({},e,{className:r,prefixCls:l}),u||t.createElement(_,{prefixCls:l,title:g,content:h})))},j=e=>{let{prefixCls:r,className:l}=e,i=y(e,["prefixCls","className"]),{getPrefixCls:s}=t.useContext(o.ConfigContext),n=s("popover",r),[d,m,c]=f(n);return d(t.createElement(v,Object.assign({},i,{prefixCls:n,hashId:m,className:(0,a.default)(l,c)})))};e.s(["Overlay",0,_,"default",0,j],310730);var w=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 C=t.forwardRef((e,m)=>{var c,u;let{prefixCls:g,title:h,content:p,overlayClassName:x,placement:b="top",trigger:y="hover",children:v,mouseEnterDelay:j=.1,mouseLeaveDelay:C=.1,onOpenChange:S,overlayStyle:k={},styles:N,classNames:T}=e,I=w(e,["prefixCls","title","content","overlayClassName","placement","trigger","children","mouseEnterDelay","mouseLeaveDelay","onOpenChange","overlayStyle","styles","classNames"]),{getPrefixCls:M,className:O,style:z,classNames:E,styles:P}=(0,o.useComponentConfig)("popover"),D=M("popover",g),[$,F,L]=f(D),A=M(),R=(0,a.default)(x,F,L,O,E.root,null==T?void 0:T.root),B=(0,a.default)(E.body,null==T?void 0:T.body),[U,V]=(0,r.default)(!1,{value:null!=(c=e.open)?c:e.visible,defaultValue:null!=(u=e.defaultOpen)?u:e.defaultVisible}),K=(e,t)=>{V(e,!0),null==S||S(e,t)},q=i(h),W=i(p);return $(t.createElement(d.default,Object.assign({placement:b,trigger:y,mouseEnterDelay:j,mouseLeaveDelay:C},I,{prefixCls:D,classNames:{root:R,body:B},styles:{root:Object.assign(Object.assign(Object.assign(Object.assign({},P.root),z),k),null==N?void 0:N.root),body:Object.assign(Object.assign({},P.body),null==N?void 0:N.body)},ref:m,open:U,onOpenChange:e=>{K(e)},overlay:q||W?t.createElement(_,{prefixCls:D,title:q,content:W}):null,transitionName:(0,s.getTransitionName)(A,"zoom-big",I.transitionName),"data-popover-inject":!0}),(0,n.cloneElement)(v,{onKeyDown:e=>{var a,r;(0,t.isValidElement)(v)&&(null==(r=null==v?void 0:(a=v.props).onKeyDown)||r.call(a,e)),e.keyCode===l.default.ESC&&K(!1,e)}})))});C._InternalPanelDoNotUseOrYouWillBeFired=j,e.s(["default",0,C],829672)},282786,e=>{"use strict";var t=e.i(829672);e.s(["Popover",()=>t.default])},751904,e=>{"use strict";var t=e.i(401361);e.s(["EditOutlined",()=>t.default])},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),s=e.i(360820),n=e.i(871943),o=e.i(434626),d=e.i(592968),m=e.i(115504),c=e.i(752978);function u({icon:e,onClick:a,className:r,disabled:l,dataTestId:i}){return l?(0,t.jsx)(c.Icon,{icon:e,size:"sm",className:"opacity-50 cursor-not-allowed","data-testid":i}):(0,t.jsx)(c.Icon,{icon:e,size:"sm",onClick:a,className:(0,m.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:s.ChevronUpIcon,className:"hover:text-blue-600"},Down:{icon:n.ChevronDownIcon,className:"hover:text-blue-600"},Open:{icon:o.ExternalLinkIcon,className:"hover:text-green-600"}};function h({onClick:e,tooltipText:a,disabled:r=!1,disabledTooltipText:l,dataTestId:i,variant:s}){let{icon:n,className:o}=g[s];return(0,t.jsx)(d.Tooltip,{title:r?l:a,children:(0,t.jsx)("span",{children:(0,t.jsx)(u,{icon:n,onClick:e,className:o,disabled:r,dataTestId:i})})})}e.s(["default",()=>h],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)},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])},728889,e=>{"use strict";var t=e.i(290571),a=e.i(271645),r=e.i(829087),l=e.i(480731),i=e.i(444755),s=e.i(673706),n=e.i(95779);let o={xs:{paddingX:"px-1.5",paddingY:"py-1.5"},sm:{paddingX:"px-1.5",paddingY:"py-1.5"},md:{paddingX:"px-2",paddingY:"py-2"},lg:{paddingX:"px-2",paddingY:"py-2"},xl:{paddingX:"px-2.5",paddingY:"py-2.5"}},d={xs:{height:"h-3",width:"w-3"},sm:{height:"h-5",width:"w-5"},md:{height:"h-5",width:"w-5"},lg:{height:"h-7",width:"w-7"},xl:{height:"h-9",width:"w-9"}},m={simple:{rounded:"",border:"",ring:"",shadow:""},light:{rounded:"rounded-tremor-default",border:"",ring:"",shadow:""},shadow:{rounded:"rounded-tremor-default",border:"border",ring:"",shadow:"shadow-tremor-card dark:shadow-dark-tremor-card"},solid:{rounded:"rounded-tremor-default",border:"border-2",ring:"ring-1",shadow:""},outlined:{rounded:"rounded-tremor-default",border:"border",ring:"ring-2",shadow:""}},c=(0,s.makeClassName)("Icon"),u=a.default.forwardRef((e,u)=>{let{icon:g,variant:h="simple",tooltip:p,size:x=l.Sizes.SM,color:b,className:f}=e,y=(0,t.__rest)(e,["icon","variant","tooltip","size","color","className"]),_=((e,t)=>{switch(e){case"simple":return{textColor:t?(0,s.getColorClassNames)(t,n.colorPalette.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:"",borderColor:"",ringColor:""};case"light":return{textColor:t?(0,s.getColorClassNames)(t,n.colorPalette.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:t?(0,i.tremorTwMerge)((0,s.getColorClassNames)(t,n.colorPalette.background).bgColor,"bg-opacity-20"):"bg-tremor-brand-muted dark:bg-dark-tremor-brand-muted",borderColor:"",ringColor:""};case"shadow":return{textColor:t?(0,s.getColorClassNames)(t,n.colorPalette.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:t?(0,i.tremorTwMerge)((0,s.getColorClassNames)(t,n.colorPalette.background).bgColor,"bg-opacity-20"):"bg-tremor-background dark:bg-dark-tremor-background",borderColor:"border-tremor-border dark:border-dark-tremor-border",ringColor:""};case"solid":return{textColor:t?(0,s.getColorClassNames)(t,n.colorPalette.text).textColor:"text-tremor-brand-inverted dark:text-dark-tremor-brand-inverted",bgColor:t?(0,i.tremorTwMerge)((0,s.getColorClassNames)(t,n.colorPalette.background).bgColor,"bg-opacity-20"):"bg-tremor-brand dark:bg-dark-tremor-brand",borderColor:"border-tremor-brand-inverted dark:border-dark-tremor-brand-inverted",ringColor:"ring-tremor-ring dark:ring-dark-tremor-ring"};case"outlined":return{textColor:t?(0,s.getColorClassNames)(t,n.colorPalette.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:t?(0,i.tremorTwMerge)((0,s.getColorClassNames)(t,n.colorPalette.background).bgColor,"bg-opacity-20"):"bg-tremor-background dark:bg-dark-tremor-background",borderColor:t?(0,s.getColorClassNames)(t,n.colorPalette.ring).borderColor:"border-tremor-brand-subtle dark:border-dark-tremor-brand-subtle",ringColor:t?(0,i.tremorTwMerge)((0,s.getColorClassNames)(t,n.colorPalette.ring).ringColor,"ring-opacity-40"):"ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted"}}})(h,b),{tooltipProps:v,getReferenceProps:j}=(0,r.useTooltip)();return a.default.createElement("span",Object.assign({ref:(0,s.mergeRefs)([u,v.refs.setReference]),className:(0,i.tremorTwMerge)(c("root"),"inline-flex shrink-0 items-center justify-center",_.bgColor,_.textColor,_.borderColor,_.ringColor,m[h].rounded,m[h].border,m[h].shadow,m[h].ring,o[x].paddingX,o[x].paddingY,f)},j,y),a.default.createElement(r.default,Object.assign({text:p},v)),a.default.createElement(g,{className:(0,i.tremorTwMerge)(c("icon"),"shrink-0",d[x].height,d[x].width)}))});u.displayName="Icon",e.s(["default",()=>u],728889)},752978,e=>{"use strict";var t=e.i(728889);e.s(["Icon",()=>t.default])},591935,e=>{"use strict";var t=e.i(271645);let 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)},100486,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:"M899.6 276.5L705 396.4 518.4 147.5a8.06 8.06 0 00-12.9 0L319 396.4 124.3 276.5c-5.7-3.5-13.1 1.2-12.2 7.9L188.5 865c1.1 7.9 7.9 14 16 14h615.1c8 0 14.9-6 15.9-14l76.4-580.6c.8-6.7-6.5-11.4-12.3-7.9zm-126 534.1H250.3l-53.8-409.4 139.8 86.1L512 252.9l175.7 234.4 139.8-86.1-53.9 409.4zM512 509c-62.1 0-112.6 50.5-112.6 112.6S449.9 734.2 512 734.2s112.6-50.5 112.6-112.6S574.1 509 512 509zm0 160.9c-26.6 0-48.2-21.6-48.2-48.3 0-26.6 21.6-48.3 48.2-48.3s48.2 21.6 48.2 48.3c0 26.6-21.6 48.3-48.2 48.3z"}}]},name:"crown",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(["CrownOutlined",0,i],100486)},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:s,isError:n,isRefetchError:o}=l,d=r.fetchMeta?.fetchMore?.direction,m=n&&"forward"===d,c=i&&"forward"===d,u=n&&"backward"===d,g=i&&"backward"===d;return{...l,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:(0,a.hasNextPage)(t,r.data),hasPreviousPage:(0,a.hasPreviousPage)(t,r.data),isFetchNextPageError:m,isFetchingNextPage:c,isFetchPreviousPageError:u,isFetchingPreviousPage:g,isRefetchError:o&&!m&&!u,isRefetching:s&&!c&&!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),s=e.i(243652),n=e.i(764205);let o=(0,s.createQueryKeys)("teams"),d=async(e,t,a,r={})=>{try{let l=(0,n.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)])),s=`${l?`${l}/v2/team/list`:"/v2/team/list"}?${i}`,o=await fetch(s,{method:"GET",headers:{[(0,n.getGlobalLitellmHeaderName)()]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!o.ok){let e=await o.json(),t=(0,n.deriveErrorMessage)(e);throw(0,n.handleError)(t),Error(t)}let d=await o.json();if(console.log("/team/list?status=deleted API Response:",d),d&&"object"==typeof d&&"teams"in d)return d.teams;return d}catch(e){throw console.error("Failed to list deleted teams:",e),e}},m=(0,s.createQueryKeys)("deletedTeams");e.s(["useDeletedTeams",0,(e,r,i={})=>{let{accessToken:s}=(0,l.default)();return(0,a.useQuery)({queryKey:m.list({page:e,limit:r,...i}),queryFn:async()=>await d(s,e,r,i),enabled:!!s,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,n.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})}])},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:s}=(0,t.default)();return(0,r.useQuery)({queryKey:l.detail(i),queryFn:async()=>{let t=await (0,a.userInfoCall)(e,i,s,!1,null,null);return console.log(`userInfo: ${JSON.stringify(t)}`),t.user_info},enabled:!!(e&&i&&s)})}])},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),s=e.i(199133),n=e.i(592968),o=e.i(213205),d=e.i(374009),m=e.i(764205);e.s(["default",0,({isVisible:e,onCancel:c,onSubmit:u,accessToken:g,title:h="Add Team Member",roles:p=[{label:"admin",value:"admin",description:"Admin role. Can create team keys, add members, and manage settings."},{label:"user",value:"user",description:"User role. Can view team info, but not manage it."}],defaultRole:x="user",teamId:b})=>{let[f]=l.Form.useForm(),[y,_]=(0,a.useState)([]),[v,j]=(0,a.useState)(!1),[w,C]=(0,a.useState)("user_email"),[S,k]=(0,a.useState)(!1),N=async(e,t)=>{if(!e)return void _([]);j(!0);try{let a=new URLSearchParams;if(a.append(t,e),b&&a.append("team_id",b),null==g)return;let r=(await (0,m.userFilterUICall)(g,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}));_(r)}catch(e){console.error("Error fetching users:",e)}finally{j(!1)}},T=(0,a.useCallback)((0,d.default)((e,t)=>N(e,t),300),[]),I=(e,t)=>{C(t),T(e,t)},M=(e,t)=>{let a=t.user;f.setFieldsValue({user_email:a.user_email,user_id:a.user_id,role:f.getFieldValue("role")})},O=async e=>{k(!0);try{await u(e)}finally{k(!1)}};return(0,t.jsx)(r.Modal,{title:h,open:e,onCancel:()=>{f.resetFields(),_([]),c()},footer:null,width:800,maskClosable:!S,children:(0,t.jsxs)(l.Form,{form:f,onFinish:O,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",initialValues:{role:x},children:[(0,t.jsx)(l.Form.Item,{label:"Email",name:"user_email",className:"mb-4",children:(0,t.jsx)(s.Select,{showSearch:!0,className:"w-full",placeholder:"Search by email",filterOption:!1,onSearch:e=>I(e,"user_email"),onSelect:(e,t)=>M(e,t),options:"user_email"===w?y:[],loading:v,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)(s.Select,{showSearch:!0,className:"w-full",placeholder:"Search by user ID",filterOption:!1,onSearch:e=>I(e,"user_id"),onSelect:(e,t)=>M(e,t),options:"user_id"===w?y:[],loading:v,allowClear:!0})}),(0,t.jsx)(l.Form.Item,{label:"Member Role",name:"role",className:"mb-4",children:(0,t.jsx)(s.Select,{defaultValue:x,children:p.map(e=>(0,t.jsx)(s.Select.Option,{value:e.value,children:(0,t.jsxs)(n.Tooltip,{title:e.description,children:[(0,t.jsx)("span",{className:"font-medium",children:e.label}),(0,t.jsxs)("span",{className:"ml-2 text-gray-500 text-sm",children:["- ",e.description]})]})},e.value))})}),(0,t.jsx)("div",{className:"text-right mt-4",children:(0,t.jsx)(i.Button,{type:"primary",htmlType:"submit",icon:(0,t.jsx)(o.UserAddOutlined,{}),loading:S,children:S?"Adding...":"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),s=e.i(199133),n=e.i(981339),o=e.i(592968);let d={label:"All Proxy Models",value:"all-proxy-models"},m={label:"No Default Models",value:"no-default-models"},c=[d,m],u={user:({allProxyModels:e,userModels:t,options:a})=>t&&a?.includeUserModels?t:[],team:({allProxyModels:e,selectedOrganization:t,userModels:a})=>t?t.models.includes(d.value)||0===t.models.length?e:e.filter(e=>t.models.includes(e)):e??[],organization:({allProxyModels:e})=>e,global:({allProxyModels:e})=>e};e.s(["ModelSelect",0,e=>{let{teamID:g,organizationID:h,options:p,context:x,dataTestId:b,value:f=[],onChange:y,style:_}=e,{includeUserModels:v,showAllTeamModelsOption:j,showAllProxyModelsOverride:w,includeSpecialOptions:C}=p||{},{data:S,isLoading:k}=(0,a.useAllProxyModels)(),{data:N,isLoading:T}=(0,l.useTeam)(g),{data:I,isLoading:M}=(0,r.useOrganization)(h),{data:O,isLoading:z}=(0,i.useCurrentUser)(),E=e=>c.some(t=>t.value===e),P=f.some(E),D=I?.models.includes(d.value)||I?.models.length===0;if(k||T||M||z)return(0,t.jsx)(n.Skeleton.Input,{active:!0,block:!0});let{wildcard:$,regular:F}=(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=u[t.context];return l?l({allProxyModels:r,...a,options:t.options}):[]})(S?.data??[],e,{selectedTeam:N,selectedOrganization:I,userModels:O?.models}));return(0,t.jsx)(s.Select,{"data-testid":b,value:f,onChange:e=>{let t=e.filter(E);y(t.length>0?[t[t.length-1]]:e)},style:_,options:[C?{label:(0,t.jsx)("span",{children:"Special Options"}),title:"Special Options",options:[...w||D&&C||"global"===x?[{label:(0,t.jsx)("span",{children:"All Proxy Models"}),value:d.value,disabled:f.length>0&&f.some(e=>E(e)&&e!==d.value),key:d.value}]:[],{label:(0,t.jsx)("span",{children:"No Default Models"}),value:m.value,disabled:f.length>0&&f.some(e=>E(e)&&e!==m.value),key:m.value}]}:[],...$.length>0?[{label:(0,t.jsx)("span",{children:"Wildcard Options"}),title:"Wildcard Options",options:$.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:P}})}]:[],{label:(0,t.jsx)("span",{children:"Models"}),title:"Models",options:F.map(e=>({label:(0,t.jsx)("span",{children:e}),value:e,disabled:P}))}],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),s=e.i(212931),n=e.i(199133),o=e.i(271645),d=e.i(435451);e.s(["default",0,({visible:e,onCancel:m,onSubmit:c,initialData:u,mode:g,config:h})=>{let p,[x]=i.Form.useForm(),[b,f]=(0,o.useState)(!1);console.log("Initial Data:",u),(0,o.useEffect)(()=>{if(e)if("edit"===g&&u){let e={...u,role:u.role||h.defaultRole,max_budget_in_team:u.max_budget_in_team||null,tpm_limit:u.tpm_limit||null,rpm_limit:u.rpm_limit||null};console.log("Setting form values:",e),x.setFieldsValue(e)}else x.resetFields(),x.setFieldsValue({role:h.defaultRole||h.roleOptions[0]?.value})},[e,u,g,x,h.defaultRole,h.roleOptions]);let y=async e=>{try{f(!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(c(t)),x.resetFields()}catch(e){console.error("Form submission error:",e)}finally{f(!1)}};return(0,t.jsx)(s.Modal,{title:h.title||("add"===g?"Add Member":"Edit Member"),open:e,width:1e3,footer:null,onCancel:m,children:(0,t.jsxs)(i.Form,{form:x,onFinish:y,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[h.showEmail&&(0,t.jsx)(i.Form.Item,{label:"Email",name:"user_email",className:"mb-4",rules:[{type:"email",message:"Please enter a valid email!"}],children:(0,t.jsx)(r.TextInput,{placeholder:"user@example.com"})}),h.showEmail&&h.showUserId&&(0,t.jsx)("div",{className:"text-center mb-4",children:(0,t.jsx)(a.Text,{children:"OR"})}),h.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&&u&&(0,t.jsxs)("span",{className:"text-gray-500 text-sm",children:["(Current: ",(p=u.role,h.roleOptions.find(e=>e.value===p)?.label||p),")"]})]}),name:"role",className:"mb-4",rules:[{required:!0,message:"Please select a role!"}],children:(0,t.jsx)(n.Select,{children:"edit"===g&&u?[...h.roleOptions.filter(e=>e.value===u.role),...h.roleOptions.filter(e=>e.value!==u.role)].map(e=>(0,t.jsx)(n.Select.Option,{value:e.value,children:e.label},e.value)):h.roleOptions.map(e=>(0,t.jsx)(n.Select.Option,{value:e.value,children:e.label},e.value))})}),h.additionalFields?.map(e=>(0,t.jsx)(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)(d.default,{step:e.step||1,min:e.min||0,style:{width:"100%"},placeholder:e.placeholder||"Enter a numerical value"});case"select":return(0,t.jsx)(n.Select,{children:e.options?.map(e=>(0,t.jsx)(n.Select.Option,{value:e.value,children:e.label},e.value))});default:return null}})(e)},e.name)),(0,t.jsxs)("div",{className:"text-right mt-6",children:[(0,t.jsx)(l.Button,{onClick:m,className:"mr-2",disabled:b,children:"Cancel"}),(0,t.jsx)(l.Button,{type:"default",htmlType:"submit",loading:b,children:"add"===g?b?"Adding...":"Add Member":b?"Saving...":"Save Changes"})]})]})})}])},294612,e=>{"use strict";var t=e.i(843476),a=e.i(100486),r=e.i(827252),l=e.i(213205),i=e.i(771674),s=e.i(464571),n=e.i(770914),o=e.i(291542),d=e.i(262218),m=e.i(592968),c=e.i(898586),u=e.i(902555);let{Text:g}=c.Typography;function h({members:e,canEdit:c,onEdit:h,onDelete:p,onAddMember:x,roleColumnTitle:b="Role",roleTooltip:f,extraColumns:y=[],showDeleteForMember:_,emptyText:v}){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)(d.Tag,{color:"blue",children:"Default Proxy Admin"}):(0,t.jsx)(g,{children:e||"-"})},{title:f?(0,t.jsxs)(n.Space,{direction:"horizontal",children:[b,(0,t.jsx)(m.Tooltip,{title:f,children:(0,t.jsx)(r.InfoCircleOutlined,{})})]}):b,dataIndex:"role",key:"role",render:e=>(0,t.jsxs)(n.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)=>c?(0,t.jsxs)(n.Space,{children:[(0,t.jsx)(u.default,{variant:"Edit",tooltipText:"Edit member",dataTestId:"edit-member",onClick:()=>h(a)}),(!_||_(a))&&(0,t.jsx)(u.default,{variant:"Delete",tooltipText:"Delete member",dataTestId:"delete-member",onClick:()=>p(a)})]}):null}];return(0,t.jsxs)(n.Space,{direction:"vertical",style:{width:"100%"},children:[(0,t.jsxs)("span",{className:"inline-flex text-sm text-gray-700",children:[e.length," Member",1!==e.length?"s":""]}),(0,t.jsx)(o.Table,{columns:j,dataSource:e,rowKey:e=>e.user_id??e.user_email??JSON.stringify(e),pagination:!1,size:"small",scroll:{x:"max-content"},locale:v?{emptyText:v}:void 0}),x&&c&&(0,t.jsx)(s.Button,{icon:(0,t.jsx)(l.UserAddOutlined,{}),type:"primary",onClick:x,children:"Add Member"})]})}e.s(["default",()=>h])},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)},244451,e=>{"use strict";let t;e.i(247167);var a=e.i(271645),r=e.i(343794),l=e.i(242064),i=e.i(763731),s=e.i(174428);let n=80*Math.PI,o=e=>{let{dotClassName:t,style:l,hasCircleCls:i}=e;return a.createElement("circle",{className:(0,r.default)(`${t}-circle`,{[`${t}-circle-bg`]:i}),r:40,cx:50,cy:50,strokeWidth:20,style:l})},d=({percent:e,prefixCls:t})=>{let l=`${t}-dot`,i=`${l}-holder`,d=`${i}-hidden`,[m,c]=a.useState(!1);(0,s.default)(()=>{0!==e&&c(!0)},[0!==e]);let u=Math.max(Math.min(e,100),0);if(!m)return null;let g={strokeDashoffset:`${n/4}`,strokeDasharray:`${n*u/100} ${n*(100-u)/100}`};return a.createElement("span",{className:(0,r.default)(i,`${l}-progress`,u<=0&&d)},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 m(e){let{prefixCls:t,percent:l=0}=e,i=`${t}-dot`,s=`${i}-holder`,n=`${s}-hidden`;return a.createElement(a.Fragment,null,a.createElement("span",{className:(0,r.default)(s,l>0&&n)},a.createElement("span",{className:(0,r.default)(i,`${t}-dot-spin`)},[1,2,3,4].map(e=>a.createElement("i",{className:`${t}-dot-item`,key:e})))),a.createElement(d,{prefixCls:t,percent:l}))}function c(e){var t;let{prefixCls:l,indicator:s,percent:n}=e,o=`${l}-dot`;return s&&a.isValidElement(s)?(0,i.cloneElement)(s,{className:(0,r.default)(null==(t=s.props)?void 0:t.className,o),percent:n}):a.createElement(m,{prefixCls:l,percent:n})}e.i(296059);var u=e.i(694758),g=e.i(183293),h=e.i(246422),p=e.i(838378);let x=new u.Keyframes("antSpinMove",{to:{opacity:1}}),b=new u.Keyframes("antRotate",{to:{transform:"rotate(405deg)"}}),f=(0,h.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:x,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:b,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,p.mergeToken)(e,{spinDotDefault:e.colorTextDescription})),e=>{let{controlHeightLG:t,controlHeight:a}=e;return{contentHeight:400,dotSize:t/2,dotSizeSM:.35*t,dotSizeLG:a}}),y=[[30,.05],[70,.03],[96,.01]];var _=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 v=e=>{var i;let{prefixCls:s,spinning:n=!0,delay:o=0,className:d,rootClassName:m,size:u="default",tip:g,wrapperClassName:h,style:p,children:x,fullscreen:b=!1,indicator:v,percent:j}=e,w=_(e,["prefixCls","spinning","delay","className","rootClassName","size","tip","wrapperClassName","style","children","fullscreen","indicator","percent"]),{getPrefixCls:C,direction:S,className:k,style:N,indicator:T}=(0,l.useComponentConfig)("spin"),I=C("spin",s),[M,O,z]=f(I),[E,P]=a.useState(()=>n&&(!n||!o||!!Number.isNaN(Number(o)))),D=function(e,t){let[r,l]=a.useState(0),i=a.useRef(null),s="auto"===t;return a.useEffect(()=>(s&&e&&(l(0),i.current=setInterval(()=>{l(e=>{let t=100-e;for(let a=0;a{i.current&&(clearInterval(i.current),i.current=null)}),[s,e]),s?r:t}(E,j);a.useEffect(()=>{if(n){let e=function(e,t,a){var r,l=a||{},i=l.noTrailing,s=void 0!==i&&i,n=l.noLeading,o=void 0!==n&&n,d=l.debounceMode,m=void 0===d?void 0:d,c=!1,u=0;function g(){r&&clearTimeout(r)}function h(){for(var a=arguments.length,l=Array(a),i=0;ie?o?(u=Date.now(),s||(r=setTimeout(m?p:h,e))):h():!0!==s&&(r=setTimeout(m?p:h,void 0===m?e-d:e)))}return h.cancel=function(e){var t=(e||{}).upcomingOnly;g(),c=!(void 0!==t&&t)},h}(o,()=>{P(!0)},{debounceMode:false});return e(),()=>{var t;null==(t=null==e?void 0:e.cancel)||t.call(e)}}P(!1)},[o,n]);let $=a.useMemo(()=>void 0!==x&&!b,[x,b]),F=(0,r.default)(I,k,{[`${I}-sm`]:"small"===u,[`${I}-lg`]:"large"===u,[`${I}-spinning`]:E,[`${I}-show-text`]:!!g,[`${I}-rtl`]:"rtl"===S},d,!b&&m,O,z),L=(0,r.default)(`${I}-container`,{[`${I}-blur`]:E}),A=null!=(i=null!=v?v:T)?i:t,R=Object.assign(Object.assign({},N),p),B=a.createElement("div",Object.assign({},w,{style:R,className:F,"aria-live":"polite","aria-busy":E}),a.createElement(c,{prefixCls:I,indicator:A,percent:D}),g&&($||b)?a.createElement("div",{className:`${I}-text`},g):null);return M($?a.createElement("div",Object.assign({},w,{className:(0,r.default)(`${I}-nested-loading`,h,O,z)}),E&&a.createElement("div",{key:"loading"},B),a.createElement("div",{className:L,key:"container"},x)):b?a.createElement("div",{className:(0,r.default)(`${I}-fullscreen`,{[`${I}-fullscreen-show`]:E},m,O,z)},B):B)};v.setDefaultIndicator=e=>{t=e},e.s(["default",0,v],244451)},482725,e=>{"use strict";var t=e.i(244451);e.s(["Spin",()=>t.default])},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:s,className:n}=e,o=(0,t.__rest)(e,["children","className"]);return a.default.createElement("div",{className:(0,r.tremorTwMerge)(l("root"),"overflow-auto",n)},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),s))});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:s,className:n}=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",n)},o),s))});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:s,className:n}=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",n)},o),s))});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:s,className:n}=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",n)},o),s))});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:s,className:n}=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"),n)},o),s))});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:s,className:n}=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",n)},o),s))});i.displayName="TableCell",e.s(["TableCell",()=>i],977572)},389083,e=>{"use strict";var t=e.i(290571),a=e.i(271645),r=e.i(829087),l=e.i(480731),i=e.i(95779),s=e.i(444755),n=e.i(673706);let o={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"}},d={xs:{height:"h-4",width:"w-4"},sm:{height:"h-4",width:"w-4"},md:{height:"h-4",width:"w-4"},lg:{height:"h-5",width:"w-5"},xl:{height:"h-6",width:"w-6"}},m=(0,n.makeClassName)("Badge"),c=a.default.forwardRef((e,c)=>{let{color:u,icon:g,size:h=l.Sizes.SM,tooltip:p,className:x,children:b}=e,f=(0,t.__rest)(e,["color","icon","size","tooltip","className","children"]),y=g||null,{tooltipProps:_,getReferenceProps:v}=(0,r.useTooltip)();return a.default.createElement("span",Object.assign({ref:(0,n.mergeRefs)([c,_.refs.setReference]),className:(0,s.tremorTwMerge)(m("root"),"w-max shrink-0 inline-flex justify-center items-center cursor-default rounded-tremor-small ring-1 ring-inset",u?(0,s.tremorTwMerge)((0,n.getColorClassNames)(u,i.colorPalette.background).bgColor,(0,n.getColorClassNames)(u,i.colorPalette.iconText).textColor,(0,n.getColorClassNames)(u,i.colorPalette.iconRing).ringColor,"bg-opacity-10 ring-opacity-20","dark:bg-opacity-5 dark:ring-opacity-60"):(0,s.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"),o[h].paddingX,o[h].paddingY,o[h].fontSize,x)},v,f),a.default.createElement(r.default,Object.assign({text:p},_)),y?a.default.createElement(y,{className:(0,s.tremorTwMerge)(m("icon"),"shrink-0 -ml-1 mr-1.5",d[h].height,d[h].width)}):null,a.default.createElement("span",{className:(0,s.tremorTwMerge)(m("text"),"whitespace-nowrap")},b))});c.displayName="Badge",e.s(["Badge",()=>c],389083)},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)},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)},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)},969550,e=>{"use strict";var t=e.i(843476),a=e.i(271645);let r=a.forwardRef(function(e,t){return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"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"}))});var l=e.i(464571),i=e.i(311451),s=e.i(199133),n=e.i(374009);e.s(["default",0,({options:e,onApplyFilters:o,onResetFilters:d,initialValues:m={},buttonLabel:c="Filters"})=>{let[u,g]=(0,a.useState)(!1),[h,p]=(0,a.useState)(m),[x,b]=(0,a.useState)({}),[f,y]=(0,a.useState)({}),[_,v]=(0,a.useState)({}),[j,w]=(0,a.useState)({}),C=(0,a.useCallback)((0,n.default)(async(e,t)=>{if(t.isSearchable&&t.searchFn){y(e=>({...e,[t.name]:!0}));try{let a=await t.searchFn(e);b(e=>({...e,[t.name]:a}))}catch(e){console.error("Error searching:",e),b(e=>({...e,[t.name]:[]}))}finally{y(e=>({...e,[t.name]:!1}))}}},300),[]),S=(0,a.useCallback)(async e=>{if(e.isSearchable&&e.searchFn&&!j[e.name]){y(t=>({...t,[e.name]:!0})),w(t=>({...t,[e.name]:!0}));try{let t=await e.searchFn("");b(a=>({...a,[e.name]:t}))}catch(t){console.error("Error loading initial options:",t),b(t=>({...t,[e.name]:[]}))}finally{y(t=>({...t,[e.name]:!1}))}}},[j]);(0,a.useEffect)(()=>{u&&e.forEach(e=>{e.isSearchable&&!j[e.name]&&S(e)})},[u,e,S,j]);let k=(e,t)=>{let a={...h,[e]:t};p(a),o(a)};return(0,t.jsxs)("div",{className:"w-full",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-6",children:[(0,t.jsx)(l.Button,{icon:(0,t.jsx)(r,{className:"h-4 w-4"}),onClick:()=>g(!u),className:"flex items-center gap-2",children:c}),(0,t.jsx)(l.Button,{onClick:()=>{let t={};e.forEach(e=>{t[e.name]=""}),p(t),d()},children:"Reset Filters"})]}),u&&(0,t.jsx)("div",{className:"grid grid-cols-3 gap-x-6 gap-y-4 mb-6",children:["Team ID","Status","Organization ID","Key Alias","User ID","End User","Error Code","Error Message","Key Hash","Model"].map(a=>{let r,l=e.find(e=>e.label===a||e.name===a);return l?(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsx)("label",{className:"text-sm text-gray-600",children:l.label||l.name}),l.isSearchable?(0,t.jsx)(s.Select,{showSearch:!0,className:"w-full",placeholder:`Search ${l.label||l.name}...`,value:h[l.name]||void 0,onChange:e=>k(l.name,e),onOpenChange:e=>{e&&l.isSearchable&&!j[l.name]&&S(l)},onSearch:e=>{v(t=>({...t,[l.name]:e})),l.searchFn&&C(e,l)},filterOption:!1,loading:f[l.name],options:x[l.name]||[],allowClear:!0,notFoundContent:f[l.name]?"Loading...":"No results found"}):l.options?(0,t.jsx)(s.Select,{className:"w-full",placeholder:`Select ${l.label||l.name}...`,value:h[l.name]||void 0,onChange:e=>k(l.name,e),allowClear:!0,children:l.options.map(e=>(0,t.jsx)(s.Select.Option,{value:e.value,children:e.label},e.value))}):l.customComponent?(r=l.customComponent,(0,t.jsx)(r,{value:h[l.name]||void 0,onChange:e=>k(l.name,e??""),placeholder:`Select ${l.label||l.name}...`})):(0,t.jsx)(i.Input,{className:"w-full",placeholder:`Enter ${l.label||l.name}...`,value:h[l.name]||"",onChange:e=>k(l.name,e.target.value),allowClear:!0})]},l.name):null})})]})}],969550)},633627,e=>{"use strict";var t=e.i(764205);let a=(e,t,a,r)=>{for(let l of e){let e=l?.key_alias;e&&"string"==typeof e&&t.add(e.trim());let i=l?.organization_id??l?.org_id;i&&"string"==typeof i&&a.add(i.trim());let s=l?.user_id;if(s&&"string"==typeof s){let e=l?.user?.user_email||s;r.set(s,e)}}},r=async(e,r)=>{if(!e||!r)return{keyAliases:[],organizationIds:[],userIds:[]};try{let l=new Set,i=new Set,s=new Map,n=await (0,t.keyListCall)(e,null,r,null,null,null,1,100,null,null,"user",null),o=n?.keys||[],d=n?.total_pages??1;a(o,l,i,s);let m=Math.min(d,10)-1;if(m>0){let n=Array.from({length:m},(a,l)=>(0,t.keyListCall)(e,null,r,null,null,null,l+2,100,null,null,"user",null));for(let e of(await Promise.allSettled(n)))"fulfilled"===e.status&&a(e.value?.keys||[],l,i,s)}return{keyAliases:Array.from(l).sort(),organizationIds:Array.from(i).sort(),userIds:Array.from(s.entries()).map(([e,t])=>({id:e,email:t}))}}catch(e){return console.error("Error fetching team filter options:",e),{keyAliases:[],organizationIds:[],userIds:[]}}},l=async(e,a)=>{if(!e)return[];try{let r=[],l=1,i=!0;for(;i;){let s=await (0,t.teamListCall)(e,a||null,null);r=[...r,...s],l{if(!e)return[];try{let a=[],r=1,l=!0;for(;l;){let i=await (0,t.organizationListCall)(e);a=[...a,...i],r{"use strict";var t=e.i(266027),a=e.i(621482),r=e.i(243652),l=e.i(764205),i=e.i(135214);let s=(0,r.createQueryKeys)("models"),n=(0,r.createQueryKeys)("modelHub"),o=(0,r.createQueryKeys)("allProxyModels");(0,r.createQueryKeys)("selectedTeamModels");let d=(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:s,userRole:n}=(0,i.default)();return(0,a.useInfiniteQuery)({queryKey:d.list({filters:{...s&&{userId:s},...n&&{userRole:n},size:e,...t&&{search:t}}}),queryFn:async({pageParam:a})=>await (0,l.modelInfoCall)(r,s,n,a,e,t),initialPageParam:1,getNextPageParam:e=>{if(e.current_page{let{accessToken:e}=(0,i.default)();return(0,t.useQuery)({queryKey:n.list({}),queryFn:async()=>await (0,l.modelHubCall)(e),enabled:!!e})},"useModelsInfo",0,(e=1,a=50,r,n,o,d,m)=>{let{accessToken:c,userId:u,userRole:g}=(0,i.default)();return(0,t.useQuery)({queryKey:s.list({filters:{...u&&{userId:u},...g&&{userRole:g},page:e,size:a,...r&&{search:r},...n&&{modelId:n},...o&&{teamId:o},...d&&{sortBy:d},...m&&{sortOrder:m}}}),queryFn:async()=>await (0,l.modelInfoCall)(c,u,g,e,a,r,n,o,d,m),enabled:!!(c&&u&&g)})}])},91979,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:"M909.1 209.3l-56.4 44.1C775.8 155.1 656.2 92 521.9 92 290 92 102.3 279.5 102 511.5 101.7 743.7 289.8 932 521.9 932c181.3 0 335.8-115 394.6-276.1 1.5-4.2-.7-8.9-4.9-10.3l-56.7-19.5a8 8 0 00-10.1 4.8c-1.8 5-3.8 10-5.9 14.9-17.3 41-42.1 77.8-73.7 109.4A344.77 344.77 0 01655.9 829c-42.3 17.9-87.4 27-133.8 27-46.5 0-91.5-9.1-133.8-27A341.5 341.5 0 01279 755.2a342.16 342.16 0 01-73.7-109.4c-17.9-42.4-27-87.4-27-133.9s9.1-91.5 27-133.9c17.3-41 42.1-77.8 73.7-109.4 31.6-31.6 68.4-56.4 109.3-73.8 42.3-17.9 87.4-27 133.8-27 46.5 0 91.5 9.1 133.8 27a341.5 341.5 0 01109.3 73.8c9.9 9.9 19.2 20.4 27.8 31.4l-60.2 47a8 8 0 003 14.1l175.6 43c5 1.2 9.9-2.6 9.9-7.7l.8-180.9c-.1-6.6-7.8-10.3-13-6.2z"}}]},name:"reload",theme:"outlined"};var 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(["ReloadOutlined",0,i],91979)}]); \ No newline at end of file +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,56567,e=>{"use strict";var t=e.i(843476),a=e.i(135214),r=e.i(109799),l=e.i(907308),i=e.i(764205),s=e.i(500330),n=e.i(11751),o=e.i(708347),d=e.i(751904),m=e.i(827252),c=e.i(987432),u=e.i(530212),g=e.i(389083),h=e.i(304967),p=e.i(350967),x=e.i(599724),b=e.i(779241),f=e.i(629569),y=e.i(464571),_=e.i(808613),v=e.i(311451),j=e.i(998573),w=e.i(199133),C=e.i(790848),S=e.i(653496),k=e.i(592968),N=e.i(678784),T=e.i(118366),I=e.i(271645),M=e.i(9314),O=e.i(552130),z=e.i(127952);function E({className:e,value:a,onChange:r}){return(0,t.jsxs)(w.Select,{className:e,value:a,onChange:r,children:[(0,t.jsx)(w.Select.Option,{value:"24h",children:"Daily"}),(0,t.jsx)(w.Select.Option,{value:"7d",children:"Weekly"}),(0,t.jsx)(w.Select.Option,{value:"30d",children:"Monthly"})]})}var P=e.i(844565),D=e.i(355619),$=e.i(643449),F=e.i(75921),L=e.i(390605),A=e.i(162386),R=e.i(727749),B=e.i(384767),U=e.i(435451),V=e.i(916940),K=e.i(183588),q=e.i(276173),W=e.i(91979),G=e.i(269200),H=e.i(942232),Q=e.i(977572),X=e.i(427612),Y=e.i(64848),J=e.i(496020),Z=e.i(536916),ee=e.i(21548);let et={"/key/generate":"Member can generate a virtual key for this team","/key/service-account/generate":"Member can generate a service account key (not belonging to any user) for this team","/key/update":"Member can update a virtual key belonging to this team","/key/delete":"Member can delete a virtual key belonging to this team","/key/info":"Member can get info about a virtual key belonging to this team","/key/regenerate":"Member can regenerate a virtual key belonging to this team","/key/{key_id}/regenerate":"Member can regenerate a virtual key belonging to this team","/key/list":"Member can list virtual keys belonging to this team","/key/block":"Member can block a virtual key belonging to this team","/key/unblock":"Member can unblock a virtual key belonging to this team","/team/daily/activity":"Member can view all team usage data (not just their own)"},ea=({teamId:e,accessToken:a,canEditTeam:r})=>{let[l,s]=(0,I.useState)([]),[n,o]=(0,I.useState)([]),[d,m]=(0,I.useState)(!0),[u,g]=(0,I.useState)(!1),[p,b]=(0,I.useState)(!1),_=async()=>{try{if(m(!0),!a)return;let t=await (0,i.getTeamPermissionsCall)(a,e),r=t.all_available_permissions||[];s(r);let l=t.team_member_permissions||[];o(l),b(!1)}catch(e){R.default.fromBackend("Failed to load permissions"),console.error("Error fetching permissions:",e)}finally{m(!1)}};(0,I.useEffect)(()=>{_()},[e,a]);let v=async()=>{try{if(!a)return;g(!0),await (0,i.teamPermissionsUpdateCall)(a,e,n),R.default.success("Permissions updated successfully"),b(!1)}catch(e){R.default.fromBackend("Failed to update permissions"),console.error("Error updating permissions:",e)}finally{g(!1)}};if(d)return(0,t.jsx)("div",{className:"p-6 text-center",children:"Loading permissions..."});let j=l.length>0;return(0,t.jsxs)(h.Card,{className:"bg-white shadow-md rounded-md p-6",children:[(0,t.jsxs)("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center border-b pb-4 mb-6",children:[(0,t.jsx)(f.Title,{className:"mb-2 sm:mb-0",children:"Member Permissions"}),r&&p&&(0,t.jsxs)("div",{className:"flex gap-3",children:[(0,t.jsx)(y.Button,{icon:(0,t.jsx)(W.ReloadOutlined,{}),onClick:()=>{_()},children:"Reset"}),(0,t.jsx)(y.Button,{onClick:v,loading:u,type:"primary",icon:(0,t.jsx)(c.SaveOutlined,{}),children:"Save Changes"})]})]}),(0,t.jsx)(x.Text,{className:"mb-6 text-gray-600",children:"Control what team members can do when they are not team admins."}),j?(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)(G.Table,{className:" min-w-full",children:[(0,t.jsx)(X.TableHead,{children:(0,t.jsxs)(J.TableRow,{children:[(0,t.jsx)(Y.TableHeaderCell,{children:"Method"}),(0,t.jsx)(Y.TableHeaderCell,{children:"Endpoint"}),(0,t.jsx)(Y.TableHeaderCell,{children:"Description"}),(0,t.jsx)(Y.TableHeaderCell,{className:"sticky right-0 bg-white shadow-[-4px_0_4px_-4px_rgba(0,0,0,0.1)] text-center",children:"Allow Access"})]})}),(0,t.jsx)(H.TableBody,{children:l.map(e=>{let a=(e=>{let t=e.includes("/info")||e.includes("/list")||e.includes("/activity")?"GET":"POST",a=et[e];if(!a){for(let[t,r]of Object.entries(et))if(e.includes(t)){a=r;break}}return a||(a=`Access ${e}`),{method:t,endpoint:e,description:a,route:e}})(e);return(0,t.jsxs)(J.TableRow,{className:"hover:bg-gray-50 transition-colors",children:[(0,t.jsx)(Q.TableCell,{children:(0,t.jsx)("span",{className:`px-2 py-1 rounded text-xs font-medium ${"GET"===a.method?"bg-blue-100 text-blue-800":"bg-green-100 text-green-800"}`,children:a.method})}),(0,t.jsx)(Q.TableCell,{children:(0,t.jsx)("span",{className:"font-mono text-sm text-gray-800",children:a.endpoint})}),(0,t.jsx)(Q.TableCell,{className:"text-gray-700",children:a.description}),(0,t.jsx)(Q.TableCell,{className:"sticky right-0 bg-white shadow-[-4px_0_4px_-4px_rgba(0,0,0,0.1)] text-center",children:(0,t.jsx)(Z.Checkbox,{checked:n.includes(e),onChange:t=>{o(t.target.checked?[...n,e]:n.filter(t=>t!==e)),b(!0)},disabled:!r})})]},e)})})]})}):(0,t.jsx)("div",{className:"py-12",children:(0,t.jsx)(ee.Empty,{description:"No permissions available"})})]})},er="overview",el="virtual-keys",ei="members",es="member-permissions",en="settings",eo={[er]:"Overview",[el]:"Virtual Keys",[ei]:"Members",[es]:"Member Permissions",[en]:"Settings"};var ed=e.i(292639),em=e.i(770914),ec=e.i(898586),eu=e.i(294612);function eg({teamData:e,canEditTeam:r,handleMemberDelete:l,setSelectedEditMember:i,setIsEditMemberModalVisible:n,setIsAddMemberModalVisible:d}){let c=e=>{if(null==e)return"0";if("number"==typeof e){let t=Number(e);return t===Math.floor(t)?t.toString():(0,s.formatNumberWithCommas)(t,8).replace(/\.?0+$/,"")}return"0"},{data:u}=(0,ed.useUISettings)(),{userId:g,userRole:h}=(0,a.default)(),p=!!u?.values?.disable_team_admin_delete_team_user,x=(0,o.isUserTeamAdminForSingleTeam)(e.team_info.members_with_roles,g||""),b=(0,o.isProxyAdminRole)(h||""),f=[{title:(0,t.jsxs)(em.Space,{direction:"horizontal",children:["Team Member Spend (USD)",(0,t.jsx)(k.Tooltip,{title:"This is the amount spent by a user in the team.",children:(0,t.jsx)(m.InfoCircleOutlined,{})})]}),key:"spend",render:(a,r)=>(0,t.jsxs)(ec.Typography.Text,{children:["$",(0,s.formatNumberWithCommas)((t=>{if(!t)return 0;let a=e.team_memberships.find(e=>e.user_id===t);return a?.spend||0})(r.user_id),4)]})},{title:"Team Member Budget (USD)",key:"budget",render:(a,r)=>{let l=(t=>{if(!t)return null;let a=e.team_memberships.find(e=>e.user_id===t),r=a?.litellm_budget_table?.max_budget;return null==r?null:c(r)})(r.user_id);return(0,t.jsx)(ec.Typography.Text,{children:l?`$${(0,s.formatNumberWithCommas)(Number(l),4)}`:"No Limit"})}},{title:(0,t.jsxs)(em.Space,{direction:"horizontal",children:["Team Member Rate Limits",(0,t.jsx)(k.Tooltip,{title:"Rate limits for this member's usage within this team.",children:(0,t.jsx)(m.InfoCircleOutlined,{})})]}),key:"rate_limits",render:(a,r)=>(0,t.jsx)(ec.Typography.Text,{children:(t=>{if(!t)return"No Limits";let a=e.team_memberships.find(e=>e.user_id===t),r=a?.litellm_budget_table?.rpm_limit,l=a?.litellm_budget_table?.tpm_limit,i=[r?`${c(r)} RPM`:null,l?`${c(l)} TPM`:null].filter(Boolean);return i.length>0?i.join(" / "):"No Limits"})(r.user_id)})}];return(0,t.jsx)(eu.default,{members:e.team_info.members_with_roles,canEdit:r,onEdit:t=>{let a=e.team_memberships.find(e=>e.user_id===t.user_id);i({...t,max_budget_in_team:a?.litellm_budget_table?.max_budget||null,tpm_limit:a?.litellm_budget_table?.tpm_limit||null,rpm_limit:a?.litellm_budget_table?.rpm_limit||null}),n(!0)},onDelete:l,onAddMember:()=>d(!0),roleColumnTitle:"Team Role",roleTooltip:"This role applies only to this team and is independent from the user's proxy-level role.",extraColumns:f,showDeleteForMember:()=>b||r&&!x||x&&!p})}var eh=e.i(207082),ep=e.i(871943),ex=e.i(502547),eb=e.i(360820),ef=e.i(94629),ey=e.i(152990),e_=e.i(682830),ev=e.i(994388),ej=e.i(752978),ew=e.i(282786),eC=e.i(981339),eS=e.i(969550),ek=e.i(20147),eN=e.i(266027),eT=e.i(633627);function eI({teamId:e,teamAlias:r,organization:l}){let{accessToken:i}=(0,a.default)(),[n,o]=(0,I.useState)(null),[d,c]=(0,I.useState)([{id:"created_at",desc:!0}]),[u,h]=(0,I.useState)({pageIndex:0,pageSize:50}),[p,b]=(0,I.useState)({"Organization ID":"","Key Alias":"","User ID":"","Sort By":"created_at","Sort Order":"desc"}),f=d.length>0?d[0].id:"created_at",y=d.length>0?d[0].desc?"desc":"asc":"desc",_=u.pageIndex,v=u.pageSize,{data:j,isPending:w,isFetching:C,refetch:S}=(0,eh.useKeys)(_+1,v,{teamID:e,organizationID:p["Organization ID"]?.trim()||void 0,selectedKeyAlias:p["Key Alias"]?.trim()||void 0,userID:p["User ID"]?.trim()||void 0,sortBy:f||void 0,sortOrder:y||void 0,expand:"user"}),N=(0,I.useMemo)(()=>{let e=j?.keys||[],t=l?.organization_id;return t?e.map(e=>({...e,organization_id:(e.organization_id??e.org_id)||t})):e},[j?.keys,l?.organization_id]),T=j?.total_pages??0,[M,O]=(0,I.useState)({}),z=(0,I.useMemo)(()=>({team_id:e,team_alias:r||e,models:[],max_budget:null,budget_duration:null,tpm_limit:null,rpm_limit:null,organization_id:l?.organization_id||"",created_at:"",keys:[],members_with_roles:[],spend:0}),[e,r,l]),E=(0,eN.useQuery)({queryKey:["teamFilterOptions",e,i],queryFn:async()=>(0,eT.fetchTeamFilterOptions)(i,e),enabled:!!i&&!!e,staleTime:3e4}).data||{keyAliases:[],organizationIds:[],userIds:[]},P=(0,I.useCallback)(()=>{S?.()},[S]);(0,I.useEffect)(()=>(window.addEventListener("storage",P),()=>window.removeEventListener("storage",P)),[P]);let $=(0,I.useCallback)((e,t=!1)=>{b(t=>({...t,"Organization ID":e["Organization ID"]??t["Organization ID"],"Key Alias":e["Key Alias"]??t["Key Alias"],"User ID":e["User ID"]??t["User ID"],"Sort By":e["Sort By"]??t["Sort By"]??"created_at","Sort Order":e["Sort Order"]??t["Sort Order"]??"desc"})),t||h(e=>({...e,pageIndex:0}))},[]),F=(0,I.useCallback)(()=>{b({"Organization ID":"","Key Alias":"","User ID":"","Sort By":"created_at","Sort Order":"desc"}),h(e=>({...e,pageIndex:0}))},[]),L=(0,I.useMemo)(()=>[{name:"Organization ID",label:"Organization ID",isSearchable:!0,searchFn:async e=>{let{organizationIds:t}=E;if(!t.length)return[];let a=e.toLowerCase();return(a?t.filter(e=>e.toLowerCase().includes(a)):t).map(e=>({label:e,value:e}))}},{name:"Key Alias",label:"Key Alias",isSearchable:!0,searchFn:async e=>{let{keyAliases:t}=E,a=e.toLowerCase();return(a?t.filter(e=>e.toLowerCase().includes(a)):t).map(e=>({label:e,value:e}))}},{name:"User ID",label:"User ID",isSearchable:!0,searchFn:async e=>{let{userIds:t}=E,a=e.toLowerCase();return(a?t.filter(e=>e.id.toLowerCase().includes(a)||e.email.toLowerCase().includes(a)):t).map(e=>({label:e.email?`${e.id} (${e.email})`:e.id,value:e.id}))}}],[E]),A=(0,I.useMemo)(()=>[{id:"token",accessorKey:"token",header:"Key ID",size:100,enableSorting:!0,cell:e=>{let a=e.getValue(),r=e.cell.column.getSize();return(0,t.jsx)(k.Tooltip,{title:a,children:(0,t.jsx)(ev.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:r,overflow:"hidden"},onClick:()=>o(e.row.original),children:a??"-"})})}},{id:"key_alias",accessorKey:"key_alias",header:"Key Alias",size:150,enableSorting:!0,cell:e=>{let a=e.getValue(),r=e.cell.column.getSize();return(0,t.jsx)(k.Tooltip,{title:a,children:(0,t.jsx)("span",{className:"font-mono text-xs truncate block",style:{maxWidth:r,overflow:"hidden"},children:a??"-"})})}},{id:"key_name",accessorKey:"key_name",header:"Secret Key",size:120,enableSorting:!1,cell:e=>(0,t.jsx)("span",{className:"font-mono text-xs",children:e.getValue()})},{id:"organization_id",accessorKey:"organization_id",header:"Organization ID",size:140,enableSorting:!1,cell:e=>e.getValue()?e.renderValue():"-"},{id:"user_email",accessorKey:"user",header:"User Email",size:160,enableSorting:!1,cell:e=>{let a=e.getValue(),r=a?.user_email,l=e.cell.column.getSize();return(0,t.jsx)(k.Tooltip,{title:r,children:(0,t.jsx)("span",{className:"font-mono text-xs truncate block",style:{maxWidth:l,overflow:"hidden"},children:r??"-"})})}},{id:"user_id",accessorKey:"user_id",header:"User ID",size:70,enableSorting:!1,cell:e=>{let a=e.getValue(),r="default_user_id"===a?"Default Proxy Admin":a,l=e.cell.column.getSize();return(0,t.jsx)(k.Tooltip,{title:r,children:(0,t.jsx)("span",{className:"font-mono text-xs truncate block",style:{maxWidth:l,overflow:"hidden"},children:r??"-"})})}},{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 a=e.getValue(),r="default_user_id"===a?"Default Proxy Admin":a,l=e.cell.column.getSize();return(0,t.jsx)(k.Tooltip,{title:r,children:(0,t.jsx)("span",{className:"font-mono text-xs truncate block",style:{maxWidth:l,overflow:"hidden"},children:r??"-"})})}},{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)(ew.Popover,{content:"This is a new field and is not backfilled. Only new key usage will update this value.",trigger:"hover",children:(0,t.jsx)(m.InfoCircleOutlined,{className:"text-gray-400 text-xs cursor-help"})})]}),size:130,enableSorting:!1,cell:e=>{let a=e.getValue();if(!a)return"Unknown";let r=new Date(a);return(0,t.jsx)(k.Tooltip,{title:r.toLocaleString(void 0,{dateStyle:"medium",timeStyle:"long"}),children:(0,t.jsx)("span",{children:r.toLocaleDateString()})})}},{id:"expires",accessorKey:"expires",header:"Expires",size:120,enableSorting:!1,cell:e=>{let t=e.getValue();return t?new Date(t).toLocaleDateString():"Never"}},{id:"spend",accessorKey:"spend",header:"Spend (USD)",size:100,enableSorting:!0,cell:e=>(0,s.formatNumberWithCommas)(e.getValue(),4)},{id:"max_budget",accessorKey:"max_budget",header:"Budget (USD)",size:110,enableSorting:!0,cell:e=>{let t=e.getValue();return null===t?"Unlimited":`$${(0,s.formatNumberWithCommas)(t)}`}},{id:"budget_reset_at",accessorKey:"budget_reset_at",header:"Budget Reset",size:130,enableSorting:!1,cell:e=>{let t=e.getValue();return t?new Date(t).toLocaleString():"Never"}},{id:"models",accessorKey:"models",header:"Models",size:200,enableSorting:!1,cell:e=>{let a=e.getValue();return(0,t.jsx)("div",{className:"flex flex-col py-2",children:Array.isArray(a)?(0,t.jsx)("div",{className:"flex flex-col",children:0===a.length?(0,t.jsx)(g.Badge,{size:"xs",className:"mb-1",color:"red",children:(0,t.jsx)(x.Text,{children:"All Proxy Models"})}):(0,t.jsx)(t.Fragment,{children:(0,t.jsxs)("div",{className:"flex items-start",children:[a.length>3&&(0,t.jsx)("div",{children:(0,t.jsx)(ej.Icon,{icon:M[e.row.id]?ep.ChevronDownIcon:ex.ChevronRightIcon,className:"cursor-pointer",size:"xs",onClick:()=>O(t=>({...t,[e.row.id]:!t[e.row.id]}))})}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-1",children:[a.slice(0,3).map((e,a)=>"all-proxy-models"===e?(0,t.jsx)(g.Badge,{size:"xs",color:"red",children:(0,t.jsx)(x.Text,{children:"All Proxy Models"})},a):(0,t.jsx)(g.Badge,{size:"xs",color:"blue",children:(0,t.jsx)(x.Text,{children:e.length>30?`${(0,D.getModelDisplayName)(e).slice(0,30)}...`:(0,D.getModelDisplayName)(e)})},a)),a.length>3&&!M[e.row.id]&&(0,t.jsx)(g.Badge,{size:"xs",color:"gray",className:"cursor-pointer",children:(0,t.jsxs)(x.Text,{children:["+",a.length-3," ",a.length-3==1?"more model":"more models"]})}),M[e.row.id]&&(0,t.jsx)("div",{className:"flex flex-wrap gap-1",children:a.slice(3).map((e,a)=>"all-proxy-models"===e?(0,t.jsx)(g.Badge,{size:"xs",color:"red",children:(0,t.jsx)(x.Text,{children:"All Proxy Models"})},a+3):(0,t.jsx)(g.Badge,{size:"xs",color:"blue",children:(0,t.jsx)(x.Text,{children:e.length>30?`${(0,D.getModelDisplayName)(e).slice(0,30)}...`:(0,D.getModelDisplayName)(e)})},a+3))})]})]})})}):null})}},{id:"rate_limits",header:"Rate Limits",size:140,enableSorting:!1,cell:({row:e})=>{let a=e.original;return(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{children:["TPM: ",null!==a.tpm_limit?a.tpm_limit:"Unlimited"]}),(0,t.jsxs)("div",{children:["RPM: ",null!==a.rpm_limit?a.rpm_limit:"Unlimited"]})]})}}],[M]),R=(0,I.useCallback)(e=>{let t="function"==typeof e?e(d):e;if(c(t),t?.length>0){let e=t[0];$({"Sort By":e.id,"Sort Order":e.desc?"desc":"asc"},!0)}},[d,$]),B=(0,ey.useReactTable)({data:N,columns:A,columnResizeMode:"onChange",columnResizeDirection:"ltr",state:{sorting:d,pagination:u},onSortingChange:R,onPaginationChange:h,getCoreRowModel:(0,e_.getCoreRowModel)(),enableSorting:!0,manualSorting:!0,manualPagination:!0,pageCount:T});return(0,t.jsx)("div",{className:"w-full h-full overflow-hidden",children:n?(0,t.jsx)(ek.default,{keyId:n.token,onClose:()=>o(null),keyData:n,teams:[z],onDelete:S}):(0,t.jsxs)("div",{className:"border-b py-4 flex-1 overflow-hidden",children:[(0,t.jsx)("div",{className:"w-full mb-6",children:(0,t.jsx)(eS.default,{options:L,onApplyFilters:$,initialValues:p,onResetFilters:F})}),(0,t.jsx)("div",{className:"flex items-center justify-end w-full mb-4",children:(0,t.jsxs)("div",{className:"inline-flex items-center gap-2",children:[w||C?(0,t.jsx)(eC.Skeleton.Node,{active:!0,style:{width:74,height:20}}):(0,t.jsxs)("span",{className:"text-sm text-gray-700",children:["Page ",_+1," of ",B.getPageCount()]}),w||C?(0,t.jsx)(eC.Skeleton.Button,{active:!0,size:"small",style:{width:84,height:30}}):(0,t.jsx)("button",{onClick:()=>B.previousPage(),disabled:w||C||!B.getCanPreviousPage(),className:"px-3 py-1 text-sm border rounded-md hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed",children:"Previous"}),w||C?(0,t.jsx)(eC.Skeleton.Button,{active:!0,size:"small",style:{width:58,height:30}}):(0,t.jsx)("button",{onClick:()=>B.nextPage(),disabled:w||C||!B.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)(G.Table,{className:"[&_td]:py-0.5 [&_th]:py-1",style:{width:B.getCenterTotalSize()},children:[(0,t.jsx)(X.TableHead,{children:B.getHeaderGroups().map(e=>(0,t.jsx)(J.TableRow,{children:e.headers.map(e=>(0,t.jsx)(Y.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,ey.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)(eb.ChevronUpIcon,{className:"h-4 w-4 text-blue-500"}),desc:(0,t.jsx)(ep.ChevronDownIcon,{className:"h-4 w-4 text-blue-500"})})[e.column.getIsSorted()]:(0,t.jsx)(ef.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 ${B.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)(H.TableBody,{children:w||C?(0,t.jsx)(J.TableRow,{children:(0,t.jsx)(Q.TableCell,{colSpan:A.length,className:"h-8 text-center",children:(0,t.jsx)("div",{className:"text-center text-gray-500",children:(0,t.jsx)("p",{children:"Loading keys..."})})})}):N.length>0?B.getRowModel().rows.map(e=>(0,t.jsx)(J.TableRow,{className:"h-8",children:e.getVisibleCells().map(e=>(0,t.jsx)(Q.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,ey.flexRender)(e.column.columnDef.cell,e.getContext())},e.id))},e.id)):(0,t.jsx)(J.TableRow,{children:(0,t.jsx)(Q.TableCell,{colSpan:A.length,className:"h-8 text-center",children:(0,t.jsx)("div",{className:"text-center text-gray-500",children:(0,t.jsx)("p",{children:"No keys found"})})})})})]})})})})]})})}e.s(["default",0,({teamId:e,onClose:W,accessToken:G,is_team_admin:H,is_proxy_admin:Q,is_org_admin:X=!1,userModels:Y,editTeam:J,premiumUser:Z=!1,onUpdate:ee})=>{let[et,ed]=(0,I.useState)(null),[em,ec]=(0,I.useState)(!0),[eu,eh]=(0,I.useState)(!1),[ep]=_.Form.useForm(),[ex,eb]=(0,I.useState)(!1),[ef,ey]=(0,I.useState)(null),[e_,ev]=(0,I.useState)(!1),[ej,ew]=(0,I.useState)([]),[eC,eS]=(0,I.useState)(!1),[ek,eN]=(0,I.useState)({}),[eT,eM]=(0,I.useState)([]),[eO,ez]=(0,I.useState)([]),[eE,eP]=(0,I.useState)({}),[eD,e$]=(0,I.useState)(!1),[eF,eL]=(0,I.useState)(null),[eA,eR]=(0,I.useState)(!1),[eB,eU]=(0,I.useState)(!1),[eV,eK]=(0,I.useState)(!1),[eq,eW]=(0,I.useState)(null),{userRole:eG,userId:eH}=(0,a.default)(),{data:eQ=[]}=(0,r.useOrganizations)(),eX=(0,I.useMemo)(()=>{let e=et?.team_info?.organization_id;if(!e||!eH)return!1;let t=eQ.find(t=>t.organization_id===e);return t?.members?.some(e=>e.user_id===eH&&"org_admin"===e.user_role)??!1},[et,eQ,eH]),eY=H||Q||X||eX,eJ=(0,I.useMemo)(()=>{let e;return e=[er,el],eY?[...e,ei,es,en]:e},[eY]),eZ=(0,I.useMemo)(()=>J&&eY?en:er,[J,eY]),e0=async()=>{try{if(ec(!0),!G)return;let t=await (0,i.teamInfoCall)(G,e);ed(t)}catch(e){R.default.fromBackend("Failed to load team information"),console.error("Error fetching team info:",e)}finally{ec(!1)}};(0,I.useEffect)(()=>{e0()},[e,G]),(0,I.useEffect)(()=>{(async()=>{if(!G||!et?.team_info?.organization_id)return eW(null);try{let e=await (0,i.organizationInfoCall)(G,et.team_info.organization_id);eW(e)}catch(e){console.error("Error fetching organization info:",e),eW(null)}})()},[G,et?.team_info?.organization_id]),(0,I.useMemo)(()=>{let e;return e=[],e=eq?eq.models.includes("all-proxy-models")?Y:eq.models.length>0?eq.models:Y:Y,(0,D.unfurlWildcardModelsInList)(e,Y)},[eq,Y]),(0,I.useEffect)(()=>{let e=async()=>{try{if(!G)return;let e=(await (0,i.getPoliciesList)(G)).policies.map(e=>e.policy_name);ez(e)}catch(e){console.error("Failed to fetch policies:",e)}};(async()=>{try{if(!G)return;let e=(await (0,i.getGuardrailsList)(G)).guardrails.map(e=>e.guardrail_name);eM(e)}catch(e){console.error("Failed to fetch guardrails:",e)}})(),e()},[G]),(0,I.useEffect)(()=>{(async()=>{if(!G||!et?.team_info?.policies||0===et.team_info.policies.length)return;e$(!0);let e={};try{await Promise.all(et.team_info.policies.map(async t=>{try{let a=await (0,i.getPolicyInfoWithGuardrails)(G,t);e[t]=a.resolved_guardrails||[]}catch(a){console.error(`Failed to fetch guardrails for policy ${t}:`,a),e[t]=[]}})),eP(e)}catch(e){console.error("Failed to fetch policy guardrails:",e)}finally{e$(!1)}})()},[G,et?.team_info?.policies]);let e1=async t=>{try{if(null==G)return;let a={user_email:t.user_email,user_id:t.user_id,role:t.role};await (0,i.teamMemberAddCall)(G,e,a),R.default.success("Team member added successfully"),eh(!1),ep.resetFields();let r=await (0,i.teamInfoCall)(G,e);ed(r),ee(r)}catch(t){let e="Failed to add team member";t?.raw?.detail?.error?.includes("Assigning team admins is a premium feature")?e="Assigning admins is an enterprise-only feature. Please upgrade your LiteLLM plan to enable this.":t?.message&&(e=t.message),R.default.fromBackend(e),console.error("Error adding team member:",t)}},e2=async t=>{try{if(null==G)return;let a={user_email:t.user_email,user_id:t.user_id,role:t.role,max_budget_in_team:t.max_budget_in_team,tpm_limit:t.tpm_limit,rpm_limit:t.rpm_limit};j.message.destroy(),await (0,i.teamMemberUpdateCall)(G,e,a),R.default.success("Team member updated successfully"),eb(!1);let r=await (0,i.teamInfoCall)(G,e);ed(r),ee(r)}catch(t){let e="Failed to update team member";t?.raw?.detail?.includes("Assigning team admins is a premium feature")?e="Assigning admins is an enterprise-only feature. Please upgrade your LiteLLM plan to enable this.":t?.message&&(e=t.message),eb(!1),j.message.destroy(),R.default.fromBackend(e),console.error("Error updating team member:",t)}},e4=async()=>{if(eF&&G){eU(!0);try{await (0,i.teamMemberDeleteCall)(G,e,eF),R.default.success("Team member removed successfully");let t=await (0,i.teamInfoCall)(G,e);ed(t),ee(t)}catch(e){R.default.fromBackend("Failed to remove team member"),console.error("Error removing team member:",e)}finally{eU(!1),eR(!1),eL(null)}}},e5=async t=>{try{let a;if(!G)return;eK(!0);let r={};try{let{soft_budget_alerting_emails:e,...a}=t.metadata?JSON.parse(t.metadata):{};r=a}catch(e){R.default.fromBackend("Invalid JSON in metadata field");return}if("string"==typeof t.secret_manager_settings&&t.secret_manager_settings.trim().length>0)try{a=JSON.parse(t.secret_manager_settings)}catch(e){R.default.fromBackend("Invalid JSON in secret manager settings");return}let l=e=>null==e||"string"==typeof e&&""===e.trim()||"number"==typeof e&&Number.isNaN(e)?null:e,s={team_id:e,team_alias:t.team_alias,models:t.models,tpm_limit:l(t.tpm_limit),rpm_limit:l(t.rpm_limit),max_budget:t.max_budget,soft_budget:l(t.soft_budget),budget_duration:t.budget_duration,metadata:{...r,...t.guardrails?.length>0?{guardrails:t.guardrails}:{},...t.logging_settings?.length>0?{logging:t.logging_settings}:{},disable_global_guardrails:t.disable_global_guardrails||!1,soft_budget_alerting_emails:"string"==typeof t.soft_budget_alerting_emails?t.soft_budget_alerting_emails.split(",").map(e=>e.trim()).filter(e=>e.length>0):t.soft_budget_alerting_emails||[],...void 0!==a?{secret_manager_settings:a}:{}},...t.policies?.length>0?{policies:t.policies}:{},organization_id:t.organization_id};s.max_budget=(0,n.mapEmptyStringToNull)(s.max_budget),s.team_member_budget_duration=t.team_member_budget_duration,void 0!==t.team_member_budget&&(s.team_member_budget=Number(t.team_member_budget)),void 0!==t.team_member_key_duration&&(s.team_member_key_duration=t.team_member_key_duration),(void 0!==t.team_member_tpm_limit||void 0!==t.team_member_rpm_limit)&&(s.team_member_tpm_limit=l(t.team_member_tpm_limit),s.team_member_rpm_limit=l(t.team_member_rpm_limit));let{servers:o,accessGroups:d}=t.mcp_servers_and_groups||{servers:[],accessGroups:[]},m=new Set(o||[]),c=Object.fromEntries(Object.entries(t.mcp_tool_permissions||{}).filter(([e])=>m.has(e)));s.object_permission={},o&&(s.object_permission.mcp_servers=o),d&&(s.object_permission.mcp_access_groups=d),c&&(s.object_permission.mcp_tool_permissions=c),delete t.mcp_servers_and_groups,delete t.mcp_tool_permissions;let{agents:u,accessGroups:g}=t.agents_and_groups||{agents:[],accessGroups:[]};u&&u.length>0&&(s.object_permission.agents=u),g&&g.length>0&&(s.object_permission.agent_access_groups=g),delete t.agents_and_groups,t.vector_stores&&t.vector_stores.length>0&&(s.object_permission.vector_stores=t.vector_stores),void 0!==t.access_group_ids&&(s.access_group_ids=t.access_group_ids),await (0,i.teamUpdateCall)(G,s),R.default.success("Team settings updated successfully"),ev(!1),e0()}catch(e){console.error("Error updating team:",e)}finally{eK(!1)}};if(em)return(0,t.jsx)("div",{className:"p-4",children:"Loading..."});if(!et?.team_info)return(0,t.jsx)("div",{className:"p-4",children:"Team not found"});let{team_info:e7}=et,e6=async(e,t)=>{await (0,s.copyToClipboard)(e)&&(eN(e=>({...e,[t]:!0})),setTimeout(()=>{eN(e=>({...e,[t]:!1}))},2e3))};return(0,t.jsxs)("div",{className:"p-4",children:[(0,t.jsx)("div",{className:"flex justify-between items-center mb-6",children:(0,t.jsxs)("div",{children:[(0,t.jsx)(y.Button,{type:"text",icon:(0,t.jsx)(u.ArrowLeftIcon,{className:"h-4 w-4"}),onClick:W,className:"mb-4",children:"Back to Teams"}),(0,t.jsx)(f.Title,{children:e7.team_alias}),(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)(x.Text,{className:"text-gray-500 font-mono",children:e7.team_id}),(0,t.jsx)(y.Button,{type:"text",size:"small",icon:ek["team-id"]?(0,t.jsx)(N.CheckIcon,{size:12}):(0,t.jsx)(T.CopyIcon,{size:12}),onClick:()=>e6(e7.team_id,"team-id"),className:`left-2 z-10 transition-all duration-200 ${ek["team-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100"}`})]})]})}),(0,t.jsx)(S.Tabs,{defaultActiveKey:eZ,className:"mb-4",items:[{key:er,label:eo[er],children:(0,t.jsxs)(p.Grid,{numItems:1,numItemsSm:2,numItemsLg:3,className:"gap-6",children:[(0,t.jsxs)(h.Card,{children:[(0,t.jsx)(x.Text,{children:"Budget Status"}),(0,t.jsxs)("div",{className:"mt-2",children:[(0,t.jsxs)(f.Title,{children:["$",(0,s.formatNumberWithCommas)(e7.spend,4)]}),(0,t.jsxs)(x.Text,{children:["of ",null===e7.max_budget?"Unlimited":`$${(0,s.formatNumberWithCommas)(e7.max_budget,4)}`]}),e7.budget_duration&&(0,t.jsxs)(x.Text,{className:"text-gray-500",children:["Reset: ",e7.budget_duration]}),(0,t.jsx)("br",{}),e7.team_member_budget_table&&(0,t.jsxs)(x.Text,{className:"text-gray-500",children:["Team Member Budget: $",(0,s.formatNumberWithCommas)(e7.team_member_budget_table.max_budget,4)]})]})]}),(0,t.jsxs)(h.Card,{children:[(0,t.jsx)(x.Text,{children:"Rate Limits"}),(0,t.jsxs)("div",{className:"mt-2",children:[(0,t.jsxs)(x.Text,{children:["TPM: ",e7.tpm_limit||"Unlimited"]}),(0,t.jsxs)(x.Text,{children:["RPM: ",e7.rpm_limit||"Unlimited"]}),e7.max_parallel_requests&&(0,t.jsxs)(x.Text,{children:["Max Parallel Requests: ",e7.max_parallel_requests]})]})]}),(0,t.jsxs)(h.Card,{children:[(0,t.jsx)(x.Text,{children:"Models"}),(0,t.jsx)("div",{className:"mt-2 flex flex-wrap gap-2",children:0===e7.models.length?(0,t.jsx)(g.Badge,{color:"red",children:"All proxy models"}):e7.models.map((e,a)=>(0,t.jsx)(g.Badge,{color:"red",children:e},a))})]}),(0,t.jsxs)(h.Card,{children:[(0,t.jsx)(x.Text,{className:"font-semibold text-gray-900",children:"Virtual Keys"}),(0,t.jsxs)("div",{className:"mt-2",children:[(0,t.jsxs)(x.Text,{children:["User Keys: ",et.keys.filter(e=>e.user_id).length]}),(0,t.jsxs)(x.Text,{children:["Service Account Keys: ",et.keys.filter(e=>!e.user_id).length]}),(0,t.jsxs)(x.Text,{className:"text-gray-500",children:["Total: ",et.keys.length]})]})]}),(0,t.jsx)(B.default,{objectPermission:e7.object_permission,variant:"card",accessToken:G}),(0,t.jsxs)(h.Card,{children:[(0,t.jsx)(x.Text,{className:"font-semibold text-gray-900 mb-3",children:"Guardrails"}),e7.guardrails&&e7.guardrails.length>0?(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:e7.guardrails.map((e,a)=>(0,t.jsx)(g.Badge,{color:"blue",children:e},a))}):(0,t.jsx)(x.Text,{className:"text-gray-500",children:"No guardrails configured"}),e7.metadata?.disable_global_guardrails&&(0,t.jsx)("div",{className:"mt-3 pt-3 border-t border-gray-200",children:(0,t.jsx)(g.Badge,{color:"yellow",children:"Global Guardrails Disabled"})})]}),(0,t.jsxs)(h.Card,{children:[(0,t.jsx)(x.Text,{className:"font-semibold text-gray-900 mb-3",children:"Policies"}),e7.policies&&e7.policies.length>0?(0,t.jsx)("div",{className:"space-y-4",children:e7.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)(g.Badge,{color:"purple",children:e}),eD&&(0,t.jsx)(x.Text,{className:"text-xs text-gray-400",children:"Loading guardrails..."})]}),!eD&&eE[e]&&eE[e].length>0&&(0,t.jsxs)("div",{className:"ml-4 pl-3 border-l-2 border-gray-200",children:[(0,t.jsx)(x.Text,{className:"text-xs text-gray-500 mb-1",children:"Resolved Guardrails:"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-1",children:eE[e].map((e,a)=>(0,t.jsx)(g.Badge,{color:"blue",size:"xs",children:e},a))})]})]},a))}):(0,t.jsx)(x.Text,{className:"text-gray-500",children:"No policies configured"})]}),(0,t.jsx)($.default,{loggingConfigs:e7.metadata?.logging||[],disabledCallbacks:[],variant:"card"})]})},{key:el,label:eo[el],children:(0,t.jsx)(eI,{teamId:e,teamAlias:e7.team_alias,organization:eq})},{key:ei,label:eo[ei],children:(0,t.jsx)(eg,{teamData:et,canEditTeam:eY,handleMemberDelete:e=>{eL(e),eR(!0)},setSelectedEditMember:ey,setIsEditMemberModalVisible:eb,setIsAddMemberModalVisible:eh})},{key:es,label:eo[es],children:(0,t.jsx)(ea,{teamId:e,accessToken:G,canEditTeam:eY})},{key:en,label:eo[en],children:(0,t.jsxs)(h.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)(f.Title,{children:"Team Settings"}),eY&&!e_&&(0,t.jsx)(y.Button,{icon:(0,t.jsx)(d.EditOutlined,{className:"h-4 w-4"}),onClick:()=>ev(!0),children:"Edit Settings"})]}),e_?(0,t.jsxs)(_.Form,{form:ep,onFinish:e5,initialValues:{...e7,team_alias:e7.team_alias,models:e7.models,tpm_limit:e7.tpm_limit,rpm_limit:e7.rpm_limit,max_budget:e7.max_budget,soft_budget:e7.soft_budget,budget_duration:e7.budget_duration,team_member_tpm_limit:e7.team_member_budget_table?.tpm_limit,team_member_rpm_limit:e7.team_member_budget_table?.rpm_limit,team_member_budget:e7.team_member_budget_table?.max_budget,team_member_budget_duration:e7.team_member_budget_table?.budget_duration,guardrails:e7.metadata?.guardrails||[],policies:e7.policies||[],disable_global_guardrails:e7.metadata?.disable_global_guardrails||!1,soft_budget_alerting_emails:Array.isArray(e7.metadata?.soft_budget_alerting_emails)?e7.metadata.soft_budget_alerting_emails.join(", "):"",metadata:e7.metadata?JSON.stringify((({logging:e,secret_manager_settings:t,soft_budget_alerting_emails:a,...r})=>r)(e7.metadata),null,2):"",logging_settings:e7.metadata?.logging||[],secret_manager_settings:e7.metadata?.secret_manager_settings?JSON.stringify(e7.metadata.secret_manager_settings,null,2):"",organization_id:e7.organization_id,vector_stores:e7.object_permission?.vector_stores||[],mcp_servers:e7.object_permission?.mcp_servers||[],mcp_access_groups:e7.object_permission?.mcp_access_groups||[],mcp_servers_and_groups:{servers:e7.object_permission?.mcp_servers||[],accessGroups:e7.object_permission?.mcp_access_groups||[]},mcp_tool_permissions:e7.object_permission?.mcp_tool_permissions||{},agents_and_groups:{agents:e7.object_permission?.agents||[],accessGroups:e7.object_permission?.agent_access_groups||[]},access_group_ids:e7.access_group_ids||[]},layout:"vertical",children:[(0,t.jsx)(_.Form.Item,{label:"Team Name",name:"team_alias",rules:[{required:!0,message:"Please input a team name"}],children:(0,t.jsx)(v.Input,{type:""})}),(0,t.jsx)(_.Form.Item,{label:"Models",name:"models",rules:[{required:!0,message:"Please select at least one model"}],children:(0,t.jsx)(A.ModelSelect,{value:ep.getFieldValue("models")||[],onChange:e=>ep.setFieldValue("models",e),teamID:e,organizationID:et?.team_info?.organization_id||void 0,options:{includeSpecialOptions:!0,includeUserModels:!et?.team_info?.organization_id,showAllProxyModelsOverride:(0,o.isProxyAdminRole)(eG)&&!et?.team_info?.organization_id},context:"team",dataTestId:"models-select"})}),(0,t.jsx)(_.Form.Item,{label:"Max Budget (USD)",name:"max_budget",children:(0,t.jsx)(U.default,{step:.01,precision:2,style:{width:"100%"}})}),(0,t.jsx)(_.Form.Item,{label:"Soft Budget (USD)",name:"soft_budget",children:(0,t.jsx)(U.default,{step:.01,precision:2,style:{width:"100%"}})}),(0,t.jsx)(_.Form.Item,{label:"Soft Budget Alerting Emails",name:"soft_budget_alerting_emails",tooltip:"Comma-separated email addresses to receive alerts when the soft budget is reached",children:(0,t.jsx)(v.Input,{placeholder:"example1@test.com, example2@test.com"})}),(0,t.jsx)(_.Form.Item,{label:"Team Member Budget (USD)",name:"team_member_budget",tooltip:"This is the individual budget for a user in the team.",children:(0,t.jsx)(U.default,{step:.01,precision:2,style:{width:"100%"}})}),(0,t.jsx)(_.Form.Item,{label:"Team Member Budget Duration",name:"team_member_budget_duration",children:(0,t.jsx)(E,{onChange:e=>ep.setFieldValue("team_member_budget_duration",e),value:ep.getFieldValue("team_member_budget_duration")})}),(0,t.jsx)(_.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)(b.TextInput,{placeholder:"e.g., 30d"})}),(0,t.jsx)(_.Form.Item,{label:"Team Member TPM Limit",name:"team_member_tpm_limit",tooltip:"Default tokens per minute limit for an individual team member. This limit applies to all requests the user makes within this team. Can be overridden per member.",children:(0,t.jsx)(U.default,{step:1,style:{width:"100%"},placeholder:"e.g., 1000"})}),(0,t.jsx)(_.Form.Item,{label:"Team Member RPM Limit",name:"team_member_rpm_limit",tooltip:"Default requests per minute limit for an individual team member. This limit applies to all requests the user makes within this team. Can be overridden per member.",children:(0,t.jsx)(U.default,{step:1,style:{width:"100%"},placeholder:"e.g., 100"})}),(0,t.jsx)(_.Form.Item,{label:"Reset Budget",name:"budget_duration",children:(0,t.jsxs)(w.Select,{placeholder:"n/a",children:[(0,t.jsx)(w.Select.Option,{value:"24h",children:"daily"}),(0,t.jsx)(w.Select.Option,{value:"7d",children:"weekly"}),(0,t.jsx)(w.Select.Option,{value:"30d",children:"monthly"})]})}),(0,t.jsx)(_.Form.Item,{label:"Tokens per minute Limit (TPM)",name:"tpm_limit",children:(0,t.jsx)(U.default,{step:1,style:{width:"100%"}})}),(0,t.jsx)(_.Form.Item,{label:"Requests per minute Limit (RPM)",name:"rpm_limit",children:(0,t.jsx)(U.default,{step:1,style:{width:"100%"}})}),(0,t.jsx)(_.Form.Item,{label:(0,t.jsxs)("span",{children:["Guardrails"," ",(0,t.jsx)(k.Tooltip,{title:"Setup your first guardrail",children:(0,t.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/guardrails/quick_start",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:(0,t.jsx)(m.InfoCircleOutlined,{style:{marginLeft:"4px"}})})})]}),name:"guardrails",help:"Select existing guardrails or enter new ones",children:(0,t.jsx)(w.Select,{mode:"tags",placeholder:"Select or enter guardrails",options:eT.map(e=>({value:e,label:e}))})}),(0,t.jsx)(_.Form.Item,{label:(0,t.jsxs)("span",{children:["Disable Global Guardrails",(0,t.jsx)(k.Tooltip,{title:"When enabled, this team will bypass any guardrails configured to run on every request (global guardrails)",children:(0,t.jsx)(m.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"disable_global_guardrails",valuePropName:"checked",help:"Bypass global guardrails for this team",children:(0,t.jsx)(C.Switch,{checkedChildren:"Yes",unCheckedChildren:"No"})}),(0,t.jsx)(_.Form.Item,{label:(0,t.jsxs)("span",{children:["Policies"," ",(0,t.jsx)(k.Tooltip,{title:"Apply policies to this team to control guardrails and other settings",children:(0,t.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/guardrails/guardrail_policies",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:(0,t.jsx)(m.InfoCircleOutlined,{style:{marginLeft:"4px"}})})})]}),name:"policies",help:"Select existing policies or enter new ones",children:(0,t.jsx)(w.Select,{mode:"tags",placeholder:"Select or enter policies",options:eO.map(e=>({value:e,label:e}))})}),(0,t.jsx)(_.Form.Item,{label:(0,t.jsxs)("span",{children:["Access Groups"," ",(0,t.jsx)(k.Tooltip,{title:"Assign access groups to this team. Access groups control which models, MCP servers, and agents this team can use",children:(0,t.jsx)(m.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"access_group_ids",children:(0,t.jsx)(M.default,{placeholder:"Select access groups (optional)"})}),(0,t.jsx)(_.Form.Item,{label:"Vector Stores",name:"vector_stores","aria-label":"Vector Stores",children:(0,t.jsx)(V.default,{onChange:e=>ep.setFieldValue("vector_stores",e),value:ep.getFieldValue("vector_stores"),accessToken:G||"",placeholder:"Select vector stores"})}),(0,t.jsx)(_.Form.Item,{label:"Allowed Pass Through Routes",name:"allowed_passthrough_routes",children:(0,t.jsx)(P.default,{onChange:e=>ep.setFieldValue("allowed_passthrough_routes",e),value:ep.getFieldValue("allowed_passthrough_routes"),accessToken:G||"",placeholder:"Select pass through routes"})}),(0,t.jsx)(_.Form.Item,{label:"MCP Servers / Access Groups",name:"mcp_servers_and_groups",children:(0,t.jsx)(F.default,{onChange:e=>ep.setFieldValue("mcp_servers_and_groups",e),value:ep.getFieldValue("mcp_servers_and_groups"),accessToken:G||"",placeholder:"Select MCP servers or access groups (optional)"})}),(0,t.jsx)(_.Form.Item,{name:"mcp_tool_permissions",initialValue:{},hidden:!0,children:(0,t.jsx)(v.Input,{type:"hidden"})}),(0,t.jsx)(_.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)(L.default,{accessToken:G||"",selectedServers:ep.getFieldValue("mcp_servers_and_groups")?.servers||[],toolPermissions:ep.getFieldValue("mcp_tool_permissions")||{},onChange:e=>ep.setFieldsValue({mcp_tool_permissions:e})})})}),(0,t.jsx)(_.Form.Item,{label:"Agents / Access Groups",name:"agents_and_groups",children:(0,t.jsx)(O.default,{onChange:e=>ep.setFieldValue("agents_and_groups",e),value:ep.getFieldValue("agents_and_groups"),accessToken:G||"",placeholder:"Select agents or access groups (optional)"})}),(0,t.jsx)(_.Form.Item,{label:"Organization ID",name:"organization_id",children:(0,t.jsx)(v.Input,{type:"",disabled:!0})}),(0,t.jsx)(_.Form.Item,{label:"Logging Settings",name:"logging_settings",children:(0,t.jsx)(K.default,{value:ep.getFieldValue("logging_settings"),onChange:e=>ep.setFieldValue("logging_settings",e)})}),(0,t.jsx)(_.Form.Item,{label:"Secret Manager Settings",name:"secret_manager_settings",help:Z?"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)(v.Input.TextArea,{rows:6,placeholder:'{"namespace": "admin", "mount": "secret", "path_prefix": "litellm"}',disabled:!Z})}),(0,t.jsx)(_.Form.Item,{label:"Metadata",name:"metadata",children:(0,t.jsx)(v.Input.TextArea,{rows:10})}),(0,t.jsx)("div",{className:"sticky z-10 bg-white p-4 pr-0 border-t border-gray-200 bottom-[-1.5rem] inset-x-[-1.5rem]",children:(0,t.jsxs)("div",{className:"flex justify-end items-center gap-2",children:[(0,t.jsx)(y.Button,{onClick:()=>ev(!1),disabled:eV,children:"Cancel"}),(0,t.jsx)(y.Button,{icon:(0,t.jsx)(c.SaveOutlined,{className:"h-4 w-4"}),type:"primary",htmlType:"submit",loading:eV,children:"Save Changes"})]})})]}):(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(x.Text,{className:"font-medium",children:"Team Name"}),(0,t.jsx)("div",{children:e7.team_alias})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(x.Text,{className:"font-medium",children:"Team ID"}),(0,t.jsx)("div",{className:"font-mono",children:e7.team_id})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(x.Text,{className:"font-medium",children:"Created At"}),(0,t.jsx)("div",{children:new Date(e7.created_at).toLocaleString()})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(x.Text,{className:"font-medium",children:"Models"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:e7.models.map((e,a)=>(0,t.jsx)(g.Badge,{color:"red",children:e},a))})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(x.Text,{className:"font-medium",children:"Rate Limits"}),(0,t.jsxs)("div",{children:["TPM: ",e7.tpm_limit||"Unlimited"]}),(0,t.jsxs)("div",{children:["RPM: ",e7.rpm_limit||"Unlimited"]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(x.Text,{className:"font-medium",children:"Team Budget"}),(0,t.jsxs)("div",{children:["Max Budget:"," ",null!==e7.max_budget?`$${(0,s.formatNumberWithCommas)(e7.max_budget,4)}`:"No Limit"]}),(0,t.jsxs)("div",{children:["Soft Budget:"," ",null!==e7.soft_budget&&void 0!==e7.soft_budget?`$${(0,s.formatNumberWithCommas)(e7.soft_budget,4)}`:"No Limit"]}),(0,t.jsxs)("div",{children:["Budget Reset: ",e7.budget_duration||"Never"]}),e7.metadata?.soft_budget_alerting_emails&&Array.isArray(e7.metadata.soft_budget_alerting_emails)&&e7.metadata.soft_budget_alerting_emails.length>0&&(0,t.jsxs)("div",{children:["Soft Budget Alerting Emails: ",e7.metadata.soft_budget_alerting_emails.join(", ")]})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)(x.Text,{className:"font-medium",children:["Team Member Settings"," ",(0,t.jsx)(k.Tooltip,{title:"These are limits on individual team members",children:(0,t.jsx)(m.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),(0,t.jsxs)("div",{children:["Max Budget: ",e7.team_member_budget_table?.max_budget||"No Limit"]}),(0,t.jsxs)("div",{children:["Budget Duration: ",e7.team_member_budget_table?.budget_duration||"No Limit"]}),(0,t.jsxs)("div",{children:["Key Duration: ",e7.metadata?.team_member_key_duration||"No Limit"]}),(0,t.jsxs)("div",{children:["TPM Limit: ",e7.team_member_budget_table?.tpm_limit||"No Limit"]}),(0,t.jsxs)("div",{children:["RPM Limit: ",e7.team_member_budget_table?.rpm_limit||"No Limit"]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(x.Text,{className:"font-medium",children:"Organization ID"}),(0,t.jsx)("div",{children:e7.organization_id})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(x.Text,{className:"font-medium",children:"Status"}),(0,t.jsx)(g.Badge,{color:e7.blocked?"red":"green",children:e7.blocked?"Blocked":"Active"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(x.Text,{className:"font-medium",children:"Disable Global Guardrails"}),(0,t.jsx)("div",{children:e7.metadata?.disable_global_guardrails===!0?(0,t.jsx)(g.Badge,{color:"yellow",children:"Enabled - Global guardrails bypassed"}):(0,t.jsx)(g.Badge,{color:"green",children:"Disabled - Global guardrails active"})})]}),(0,t.jsx)(B.default,{objectPermission:e7.object_permission,variant:"inline",className:"pt-4 border-t border-gray-200",accessToken:G}),(0,t.jsx)($.default,{loggingConfigs:e7.metadata?.logging||[],disabledCallbacks:[],variant:"inline",className:"pt-4 border-t border-gray-200"}),e7.metadata?.secret_manager_settings&&(0,t.jsxs)("div",{className:"pt-4 border-t border-gray-200",children:[(0,t.jsx)(x.Text,{className:"font-medium",children:"Secret Manager Settings"}),(0,t.jsx)("pre",{className:"mt-2 bg-gray-50 p-3 rounded text-xs overflow-x-auto",children:JSON.stringify(e7.metadata.secret_manager_settings,null,2)})]})]})]})}].filter(e=>eJ.includes(e.key))}),(0,t.jsx)(q.default,{visible:ex,onCancel:()=>eb(!1),onSubmit:e2,initialData:ef,mode:"edit",config:{title:"Edit Member",showEmail:!0,showUserId:!0,roleOptions:[{label:"Admin",value:"admin"},{label:"User",value:"user"}],additionalFields:[{name:"max_budget_in_team",label:(0,t.jsxs)("span",{children:["Team Member Budget (USD)"," ",(0,t.jsx)(k.Tooltip,{title:"Maximum amount in USD this member can spend within this team. This is separate from any global user budget limits",children:(0,t.jsx)(m.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),type:"numerical",step:.01,min:0,placeholder:"Budget limit for this member within this team"},{name:"tpm_limit",label:(0,t.jsxs)("span",{children:["Team Member TPM Limit"," ",(0,t.jsx)(k.Tooltip,{title:"Maximum tokens per minute this member can use within this team. This is separate from any global user TPM limit",children:(0,t.jsx)(m.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),type:"numerical",step:1,min:0,placeholder:"Tokens per minute limit for this member in this team"},{name:"rpm_limit",label:(0,t.jsxs)("span",{children:["Team Member RPM Limit"," ",(0,t.jsx)(k.Tooltip,{title:"Maximum requests per minute this member can make within this team. This is separate from any global user RPM limit",children:(0,t.jsx)(m.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),type:"numerical",step:1,min:0,placeholder:"Requests per minute limit for this member in this team"}]}}),(0,t.jsx)(l.default,{isVisible:eu,onCancel:()=>eh(!1),onSubmit:e1,accessToken:G,teamId:e}),(0,t.jsx)(z.default,{isOpen:eA,title:"Delete Team Member",alertMessage:"Removing team members will also delete any keys created by or created for this member.",message:"Are you sure you want to remove this member from the team? This action cannot be undone.",resourceInformationTitle:"Team Member Information",resourceInformation:[{label:"User ID",value:eF?.user_id,code:!0},{label:"Email",value:eF?.user_email},{label:"Role",value:eF?.role}],onCancel:()=>{eR(!1),eL(null)},onOk:e4,confirmLoading:eB})]})}],56567)},829672,836938,310730,e=>{"use strict";e.i(247167);var t=e.i(271645),a=e.i(343794),r=e.i(914949),l=e.i(404948);let i=e=>e?"function"==typeof e?e():e:null;e.s(["getRenderPropValue",0,i],836938);var s=e.i(613541),n=e.i(763731),o=e.i(242064),d=e.i(491816);e.i(793154);var m=e.i(880476),c=e.i(183293),u=e.i(717356),g=e.i(320560),h=e.i(307358),p=e.i(246422),x=e.i(838378),b=e.i(617933);let f=(0,p.genStyleHooks)("Popover",e=>{let{colorBgElevated:t,colorText:a}=e,r=(0,x.mergeToken)(e,{popoverBg:t,popoverColor:a});return[(e=>{let{componentCls:t,popoverColor:a,titleMinWidth:r,fontWeightStrong:l,innerPadding:i,boxShadowSecondary:s,colorTextHeading:n,borderRadiusLG:o,zIndexPopup:d,titleMarginBottom:m,colorBgElevated:u,popoverBg:h,titleBorderBottom:p,innerContentPadding:x,titlePadding:b}=e;return[{[t]:Object.assign(Object.assign({},(0,c.resetComponent)(e)),{position:"absolute",top:0,left:{_skip_check_:!0,value:0},zIndex:d,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":u,width:"max-content",maxWidth:"100vw","&-rtl":{direction:"rtl"},"&-hidden":{display:"none"},[`${t}-content`]:{position:"relative"},[`${t}-inner`]:{backgroundColor:h,backgroundClip:"padding-box",borderRadius:o,boxShadow:s,padding:i},[`${t}-title`]:{minWidth:r,marginBottom:m,color:n,fontWeight:l,borderBottom:p,padding:b},[`${t}-inner-content`]:{color:a,padding:x}})},(0,g.default)(e,"var(--antd-arrow-background-color)"),{[`${t}-pure`]:{position:"relative",maxWidth:"none",margin:e.sizePopupArrow,display:"inline-block",[`${t}-content`]:{display:"inline-block"}}}]})(r),(e=>{let{componentCls:t}=e;return{[t]:b.PresetColors.map(a=>{let r=e[`${a}6`];return{[`&${t}-${a}`]:{"--antd-arrow-background-color":r,[`${t}-inner`]:{backgroundColor:r},[`${t}-arrow`]:{background:"transparent"}}}})}})(r),(0,u.initZoomMotion)(r,"zoom-big")]},e=>{let{lineWidth:t,controlHeight:a,fontHeight:r,padding:l,wireframe:i,zIndexPopupBase:s,borderRadiusLG:n,marginXS:o,lineType:d,colorSplit:m,paddingSM:c}=e,u=a-r;return Object.assign(Object.assign(Object.assign({titleMinWidth:177,zIndexPopup:s+30},(0,h.getArrowToken)(e)),(0,g.getArrowOffsetToken)({contentRadius:n,limitVerticalRadius:!0})),{innerPadding:12*!i,titleMarginBottom:i?0:o,titlePadding:i?`${u/2}px ${l}px ${u/2-t}px`:0,titleBorderBottom:i?`${t}px ${d} ${m}`:"none",innerContentPadding:i?`${c}px ${l}px`:0})},{resetStyle:!1,deprecatedTokens:[["width","titleMinWidth"],["minWidth","titleMinWidth"]]});var y=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 _=({title:e,content:a,prefixCls:r})=>e||a?t.createElement(t.Fragment,null,e&&t.createElement("div",{className:`${r}-title`},e),a&&t.createElement("div",{className:`${r}-inner-content`},a)):null,v=e=>{let{hashId:r,prefixCls:l,className:s,style:n,placement:o="top",title:d,content:c,children:u}=e,g=i(d),h=i(c),p=(0,a.default)(r,l,`${l}-pure`,`${l}-placement-${o}`,s);return t.createElement("div",{className:p,style:n},t.createElement("div",{className:`${l}-arrow`}),t.createElement(m.Popup,Object.assign({},e,{className:r,prefixCls:l}),u||t.createElement(_,{prefixCls:l,title:g,content:h})))},j=e=>{let{prefixCls:r,className:l}=e,i=y(e,["prefixCls","className"]),{getPrefixCls:s}=t.useContext(o.ConfigContext),n=s("popover",r),[d,m,c]=f(n);return d(t.createElement(v,Object.assign({},i,{prefixCls:n,hashId:m,className:(0,a.default)(l,c)})))};e.s(["Overlay",0,_,"default",0,j],310730);var w=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 C=t.forwardRef((e,m)=>{var c,u;let{prefixCls:g,title:h,content:p,overlayClassName:x,placement:b="top",trigger:y="hover",children:v,mouseEnterDelay:j=.1,mouseLeaveDelay:C=.1,onOpenChange:S,overlayStyle:k={},styles:N,classNames:T}=e,I=w(e,["prefixCls","title","content","overlayClassName","placement","trigger","children","mouseEnterDelay","mouseLeaveDelay","onOpenChange","overlayStyle","styles","classNames"]),{getPrefixCls:M,className:O,style:z,classNames:E,styles:P}=(0,o.useComponentConfig)("popover"),D=M("popover",g),[$,F,L]=f(D),A=M(),R=(0,a.default)(x,F,L,O,E.root,null==T?void 0:T.root),B=(0,a.default)(E.body,null==T?void 0:T.body),[U,V]=(0,r.default)(!1,{value:null!=(c=e.open)?c:e.visible,defaultValue:null!=(u=e.defaultOpen)?u:e.defaultVisible}),K=(e,t)=>{V(e,!0),null==S||S(e,t)},q=i(h),W=i(p);return $(t.createElement(d.default,Object.assign({placement:b,trigger:y,mouseEnterDelay:j,mouseLeaveDelay:C},I,{prefixCls:D,classNames:{root:R,body:B},styles:{root:Object.assign(Object.assign(Object.assign(Object.assign({},P.root),z),k),null==N?void 0:N.root),body:Object.assign(Object.assign({},P.body),null==N?void 0:N.body)},ref:m,open:U,onOpenChange:e=>{K(e)},overlay:q||W?t.createElement(_,{prefixCls:D,title:q,content:W}):null,transitionName:(0,s.getTransitionName)(A,"zoom-big",I.transitionName),"data-popover-inject":!0}),(0,n.cloneElement)(v,{onKeyDown:e=>{var a,r;(0,t.isValidElement)(v)&&(null==(r=null==v?void 0:(a=v.props).onKeyDown)||r.call(a,e)),e.keyCode===l.default.ESC&&K(!1,e)}})))});C._InternalPanelDoNotUseOrYouWillBeFired=j,e.s(["default",0,C],829672)},282786,e=>{"use strict";var t=e.i(829672);e.s(["Popover",()=>t.default])},751904,e=>{"use strict";var t=e.i(401361);e.s(["EditOutlined",()=>t.default])},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),s=e.i(360820),n=e.i(871943),o=e.i(434626),d=e.i(592968),m=e.i(115504),c=e.i(752978);function u({icon:e,onClick:a,className:r,disabled:l,dataTestId:i}){return l?(0,t.jsx)(c.Icon,{icon:e,size:"sm",className:"opacity-50 cursor-not-allowed","data-testid":i}):(0,t.jsx)(c.Icon,{icon:e,size:"sm",onClick:a,className:(0,m.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:s.ChevronUpIcon,className:"hover:text-blue-600"},Down:{icon:n.ChevronDownIcon,className:"hover:text-blue-600"},Open:{icon:o.ExternalLinkIcon,className:"hover:text-green-600"}};function h({onClick:e,tooltipText:a,disabled:r=!1,disabledTooltipText:l,dataTestId:i,variant:s}){let{icon:n,className:o}=g[s];return(0,t.jsx)(d.Tooltip,{title:r?l:a,children:(0,t.jsx)("span",{children:(0,t.jsx)(u,{icon:n,onClick:e,className:o,disabled:r,dataTestId:i})})})}e.s(["default",()=>h],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)},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])},728889,e=>{"use strict";var t=e.i(290571),a=e.i(271645),r=e.i(829087),l=e.i(480731),i=e.i(444755),s=e.i(673706),n=e.i(95779);let o={xs:{paddingX:"px-1.5",paddingY:"py-1.5"},sm:{paddingX:"px-1.5",paddingY:"py-1.5"},md:{paddingX:"px-2",paddingY:"py-2"},lg:{paddingX:"px-2",paddingY:"py-2"},xl:{paddingX:"px-2.5",paddingY:"py-2.5"}},d={xs:{height:"h-3",width:"w-3"},sm:{height:"h-5",width:"w-5"},md:{height:"h-5",width:"w-5"},lg:{height:"h-7",width:"w-7"},xl:{height:"h-9",width:"w-9"}},m={simple:{rounded:"",border:"",ring:"",shadow:""},light:{rounded:"rounded-tremor-default",border:"",ring:"",shadow:""},shadow:{rounded:"rounded-tremor-default",border:"border",ring:"",shadow:"shadow-tremor-card dark:shadow-dark-tremor-card"},solid:{rounded:"rounded-tremor-default",border:"border-2",ring:"ring-1",shadow:""},outlined:{rounded:"rounded-tremor-default",border:"border",ring:"ring-2",shadow:""}},c=(0,s.makeClassName)("Icon"),u=a.default.forwardRef((e,u)=>{let{icon:g,variant:h="simple",tooltip:p,size:x=l.Sizes.SM,color:b,className:f}=e,y=(0,t.__rest)(e,["icon","variant","tooltip","size","color","className"]),_=((e,t)=>{switch(e){case"simple":return{textColor:t?(0,s.getColorClassNames)(t,n.colorPalette.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:"",borderColor:"",ringColor:""};case"light":return{textColor:t?(0,s.getColorClassNames)(t,n.colorPalette.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:t?(0,i.tremorTwMerge)((0,s.getColorClassNames)(t,n.colorPalette.background).bgColor,"bg-opacity-20"):"bg-tremor-brand-muted dark:bg-dark-tremor-brand-muted",borderColor:"",ringColor:""};case"shadow":return{textColor:t?(0,s.getColorClassNames)(t,n.colorPalette.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:t?(0,i.tremorTwMerge)((0,s.getColorClassNames)(t,n.colorPalette.background).bgColor,"bg-opacity-20"):"bg-tremor-background dark:bg-dark-tremor-background",borderColor:"border-tremor-border dark:border-dark-tremor-border",ringColor:""};case"solid":return{textColor:t?(0,s.getColorClassNames)(t,n.colorPalette.text).textColor:"text-tremor-brand-inverted dark:text-dark-tremor-brand-inverted",bgColor:t?(0,i.tremorTwMerge)((0,s.getColorClassNames)(t,n.colorPalette.background).bgColor,"bg-opacity-20"):"bg-tremor-brand dark:bg-dark-tremor-brand",borderColor:"border-tremor-brand-inverted dark:border-dark-tremor-brand-inverted",ringColor:"ring-tremor-ring dark:ring-dark-tremor-ring"};case"outlined":return{textColor:t?(0,s.getColorClassNames)(t,n.colorPalette.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:t?(0,i.tremorTwMerge)((0,s.getColorClassNames)(t,n.colorPalette.background).bgColor,"bg-opacity-20"):"bg-tremor-background dark:bg-dark-tremor-background",borderColor:t?(0,s.getColorClassNames)(t,n.colorPalette.ring).borderColor:"border-tremor-brand-subtle dark:border-dark-tremor-brand-subtle",ringColor:t?(0,i.tremorTwMerge)((0,s.getColorClassNames)(t,n.colorPalette.ring).ringColor,"ring-opacity-40"):"ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted"}}})(h,b),{tooltipProps:v,getReferenceProps:j}=(0,r.useTooltip)();return a.default.createElement("span",Object.assign({ref:(0,s.mergeRefs)([u,v.refs.setReference]),className:(0,i.tremorTwMerge)(c("root"),"inline-flex shrink-0 items-center justify-center",_.bgColor,_.textColor,_.borderColor,_.ringColor,m[h].rounded,m[h].border,m[h].shadow,m[h].ring,o[x].paddingX,o[x].paddingY,f)},j,y),a.default.createElement(r.default,Object.assign({text:p},v)),a.default.createElement(g,{className:(0,i.tremorTwMerge)(c("icon"),"shrink-0",d[x].height,d[x].width)}))});u.displayName="Icon",e.s(["default",()=>u],728889)},752978,e=>{"use strict";var t=e.i(728889);e.s(["Icon",()=>t.default])},591935,e=>{"use strict";var t=e.i(271645);let 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)},100486,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:"M899.6 276.5L705 396.4 518.4 147.5a8.06 8.06 0 00-12.9 0L319 396.4 124.3 276.5c-5.7-3.5-13.1 1.2-12.2 7.9L188.5 865c1.1 7.9 7.9 14 16 14h615.1c8 0 14.9-6 15.9-14l76.4-580.6c.8-6.7-6.5-11.4-12.3-7.9zm-126 534.1H250.3l-53.8-409.4 139.8 86.1L512 252.9l175.7 234.4 139.8-86.1-53.9 409.4zM512 509c-62.1 0-112.6 50.5-112.6 112.6S449.9 734.2 512 734.2s112.6-50.5 112.6-112.6S574.1 509 512 509zm0 160.9c-26.6 0-48.2-21.6-48.2-48.3 0-26.6 21.6-48.3 48.2-48.3s48.2 21.6 48.2 48.3c0 26.6-21.6 48.3-48.2 48.3z"}}]},name:"crown",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(["CrownOutlined",0,i],100486)},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:s,isError:n,isRefetchError:o}=l,d=r.fetchMeta?.fetchMore?.direction,m=n&&"forward"===d,c=i&&"forward"===d,u=n&&"backward"===d,g=i&&"backward"===d;return{...l,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:(0,a.hasNextPage)(t,r.data),hasPreviousPage:(0,a.hasPreviousPage)(t,r.data),isFetchNextPageError:m,isFetchingNextPage:c,isFetchPreviousPageError:u,isFetchingPreviousPage:g,isRefetchError:o&&!m&&!u,isRefetching:s&&!c&&!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),s=e.i(243652),n=e.i(764205);let o=(0,s.createQueryKeys)("teams"),d=async(e,t,a,r={})=>{try{let l=(0,n.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)])),s=`${l?`${l}/v2/team/list`:"/v2/team/list"}?${i}`,o=await fetch(s,{method:"GET",headers:{[(0,n.getGlobalLitellmHeaderName)()]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!o.ok){let e=await o.json(),t=(0,n.deriveErrorMessage)(e);throw(0,n.handleError)(t),Error(t)}let d=await o.json();if(console.log("/team/list?status=deleted API Response:",d),d&&"object"==typeof d&&"teams"in d)return d.teams;return d}catch(e){throw console.error("Failed to list deleted teams:",e),e}},m=(0,s.createQueryKeys)("deletedTeams");e.s(["useDeletedTeams",0,(e,r,i={})=>{let{accessToken:s}=(0,l.default)();return(0,a.useQuery)({queryKey:m.list({page:e,limit:r,...i}),queryFn:async()=>await d(s,e,r,i),enabled:!!s,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,n.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})}])},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}=(0,t.default)();return(0,r.useQuery)({queryKey:l.detail(i),queryFn:async()=>await (0,a.userGetInfoV2)(e),enabled:!!(e&&i)})}])},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),s=e.i(199133),n=e.i(592968),o=e.i(213205),d=e.i(374009),m=e.i(764205);e.s(["default",0,({isVisible:e,onCancel:c,onSubmit:u,accessToken:g,title:h="Add Team Member",roles:p=[{label:"admin",value:"admin",description:"Admin role. Can create team keys, add members, and manage settings."},{label:"user",value:"user",description:"User role. Can view team info, but not manage it."}],defaultRole:x="user",teamId:b})=>{let[f]=l.Form.useForm(),[y,_]=(0,a.useState)([]),[v,j]=(0,a.useState)(!1),[w,C]=(0,a.useState)("user_email"),[S,k]=(0,a.useState)(!1),N=async(e,t)=>{if(!e)return void _([]);j(!0);try{let a=new URLSearchParams;if(a.append(t,e),b&&a.append("team_id",b),null==g)return;let r=(await (0,m.userFilterUICall)(g,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}));_(r)}catch(e){console.error("Error fetching users:",e)}finally{j(!1)}},T=(0,a.useCallback)((0,d.default)((e,t)=>N(e,t),300),[]),I=(e,t)=>{C(t),T(e,t)},M=(e,t)=>{let a=t.user;f.setFieldsValue({user_email:a.user_email,user_id:a.user_id,role:f.getFieldValue("role")})},O=async e=>{k(!0);try{await u(e)}finally{k(!1)}};return(0,t.jsx)(r.Modal,{title:h,open:e,onCancel:()=>{f.resetFields(),_([]),c()},footer:null,width:800,maskClosable:!S,children:(0,t.jsxs)(l.Form,{form:f,onFinish:O,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",initialValues:{role:x},children:[(0,t.jsx)(l.Form.Item,{label:"Email",name:"user_email",className:"mb-4",children:(0,t.jsx)(s.Select,{showSearch:!0,className:"w-full",placeholder:"Search by email",filterOption:!1,onSearch:e=>I(e,"user_email"),onSelect:(e,t)=>M(e,t),options:"user_email"===w?y:[],loading:v,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)(s.Select,{showSearch:!0,className:"w-full",placeholder:"Search by user ID",filterOption:!1,onSearch:e=>I(e,"user_id"),onSelect:(e,t)=>M(e,t),options:"user_id"===w?y:[],loading:v,allowClear:!0})}),(0,t.jsx)(l.Form.Item,{label:"Member Role",name:"role",className:"mb-4",children:(0,t.jsx)(s.Select,{defaultValue:x,children:p.map(e=>(0,t.jsx)(s.Select.Option,{value:e.value,children:(0,t.jsxs)(n.Tooltip,{title:e.description,children:[(0,t.jsx)("span",{className:"font-medium",children:e.label}),(0,t.jsxs)("span",{className:"ml-2 text-gray-500 text-sm",children:["- ",e.description]})]})},e.value))})}),(0,t.jsx)("div",{className:"text-right mt-4",children:(0,t.jsx)(i.Button,{type:"primary",htmlType:"submit",icon:(0,t.jsx)(o.UserAddOutlined,{}),loading:S,children:S?"Adding...":"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),s=e.i(199133),n=e.i(981339),o=e.i(592968);let d={label:"All Proxy Models",value:"all-proxy-models"},m={label:"No Default Models",value:"no-default-models"},c=[d,m],u={user:({allProxyModels:e,userModels:t,options:a})=>t&&a?.includeUserModels?t:[],team:({allProxyModels:e,selectedOrganization:t,userModels:a})=>t?t.models.includes(d.value)||0===t.models.length?e:e.filter(e=>t.models.includes(e)):e??[],organization:({allProxyModels:e})=>e,global:({allProxyModels:e})=>e};e.s(["ModelSelect",0,e=>{let{teamID:g,organizationID:h,options:p,context:x,dataTestId:b,value:f=[],onChange:y,style:_}=e,{includeUserModels:v,showAllTeamModelsOption:j,showAllProxyModelsOverride:w,includeSpecialOptions:C}=p||{},{data:S,isLoading:k}=(0,a.useAllProxyModels)(),{data:N,isLoading:T}=(0,l.useTeam)(g),{data:I,isLoading:M}=(0,r.useOrganization)(h),{data:O,isLoading:z}=(0,i.useCurrentUser)(),E=e=>c.some(t=>t.value===e),P=f.some(E),D=I?.models.includes(d.value)||I?.models.length===0;if(k||T||M||z)return(0,t.jsx)(n.Skeleton.Input,{active:!0,block:!0});let{wildcard:$,regular:F}=(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=u[t.context];return l?l({allProxyModels:r,...a,options:t.options}):[]})(S?.data??[],e,{selectedTeam:N,selectedOrganization:I,userModels:O?.models}));return(0,t.jsx)(s.Select,{"data-testid":b,value:f,onChange:e=>{let t=e.filter(E);y(t.length>0?[t[t.length-1]]:e)},style:_,options:[C?{label:(0,t.jsx)("span",{children:"Special Options"}),title:"Special Options",options:[...w||D&&C||"global"===x?[{label:(0,t.jsx)("span",{children:"All Proxy Models"}),value:d.value,disabled:f.length>0&&f.some(e=>E(e)&&e!==d.value),key:d.value}]:[],{label:(0,t.jsx)("span",{children:"No Default Models"}),value:m.value,disabled:f.length>0&&f.some(e=>E(e)&&e!==m.value),key:m.value}]}:[],...$.length>0?[{label:(0,t.jsx)("span",{children:"Wildcard Options"}),title:"Wildcard Options",options:$.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:P}})}]:[],{label:(0,t.jsx)("span",{children:"Models"}),title:"Models",options:F.map(e=>({label:(0,t.jsx)("span",{children:e}),value:e,disabled:P}))}],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),s=e.i(212931),n=e.i(199133),o=e.i(271645),d=e.i(435451);e.s(["default",0,({visible:e,onCancel:m,onSubmit:c,initialData:u,mode:g,config:h})=>{let p,[x]=i.Form.useForm(),[b,f]=(0,o.useState)(!1);console.log("Initial Data:",u),(0,o.useEffect)(()=>{if(e)if("edit"===g&&u){let e={...u,role:u.role||h.defaultRole,max_budget_in_team:u.max_budget_in_team||null,tpm_limit:u.tpm_limit||null,rpm_limit:u.rpm_limit||null};console.log("Setting form values:",e),x.setFieldsValue(e)}else x.resetFields(),x.setFieldsValue({role:h.defaultRole||h.roleOptions[0]?.value})},[e,u,g,x,h.defaultRole,h.roleOptions]);let y=async e=>{try{f(!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(c(t)),x.resetFields()}catch(e){console.error("Form submission error:",e)}finally{f(!1)}};return(0,t.jsx)(s.Modal,{title:h.title||("add"===g?"Add Member":"Edit Member"),open:e,width:1e3,footer:null,onCancel:m,children:(0,t.jsxs)(i.Form,{form:x,onFinish:y,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[h.showEmail&&(0,t.jsx)(i.Form.Item,{label:"Email",name:"user_email",className:"mb-4",rules:[{type:"email",message:"Please enter a valid email!"}],children:(0,t.jsx)(r.TextInput,{placeholder:"user@example.com"})}),h.showEmail&&h.showUserId&&(0,t.jsx)("div",{className:"text-center mb-4",children:(0,t.jsx)(a.Text,{children:"OR"})}),h.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&&u&&(0,t.jsxs)("span",{className:"text-gray-500 text-sm",children:["(Current: ",(p=u.role,h.roleOptions.find(e=>e.value===p)?.label||p),")"]})]}),name:"role",className:"mb-4",rules:[{required:!0,message:"Please select a role!"}],children:(0,t.jsx)(n.Select,{children:"edit"===g&&u?[...h.roleOptions.filter(e=>e.value===u.role),...h.roleOptions.filter(e=>e.value!==u.role)].map(e=>(0,t.jsx)(n.Select.Option,{value:e.value,children:e.label},e.value)):h.roleOptions.map(e=>(0,t.jsx)(n.Select.Option,{value:e.value,children:e.label},e.value))})}),h.additionalFields?.map(e=>(0,t.jsx)(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)(d.default,{step:e.step||1,min:e.min||0,style:{width:"100%"},placeholder:e.placeholder||"Enter a numerical value"});case"select":return(0,t.jsx)(n.Select,{children:e.options?.map(e=>(0,t.jsx)(n.Select.Option,{value:e.value,children:e.label},e.value))});default:return null}})(e)},e.name)),(0,t.jsxs)("div",{className:"text-right mt-6",children:[(0,t.jsx)(l.Button,{onClick:m,className:"mr-2",disabled:b,children:"Cancel"}),(0,t.jsx)(l.Button,{type:"default",htmlType:"submit",loading:b,children:"add"===g?b?"Adding...":"Add Member":b?"Saving...":"Save Changes"})]})]})})}])},294612,e=>{"use strict";var t=e.i(843476),a=e.i(100486),r=e.i(827252),l=e.i(213205),i=e.i(771674),s=e.i(464571),n=e.i(770914),o=e.i(291542),d=e.i(262218),m=e.i(592968),c=e.i(898586),u=e.i(902555);let{Text:g}=c.Typography;function h({members:e,canEdit:c,onEdit:h,onDelete:p,onAddMember:x,roleColumnTitle:b="Role",roleTooltip:f,extraColumns:y=[],showDeleteForMember:_,emptyText:v}){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)(d.Tag,{color:"blue",children:"Default Proxy Admin"}):(0,t.jsx)(g,{children:e||"-"})},{title:f?(0,t.jsxs)(n.Space,{direction:"horizontal",children:[b,(0,t.jsx)(m.Tooltip,{title:f,children:(0,t.jsx)(r.InfoCircleOutlined,{})})]}):b,dataIndex:"role",key:"role",render:e=>(0,t.jsxs)(n.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)=>c?(0,t.jsxs)(n.Space,{children:[(0,t.jsx)(u.default,{variant:"Edit",tooltipText:"Edit member",dataTestId:"edit-member",onClick:()=>h(a)}),(!_||_(a))&&(0,t.jsx)(u.default,{variant:"Delete",tooltipText:"Delete member",dataTestId:"delete-member",onClick:()=>p(a)})]}):null}];return(0,t.jsxs)(n.Space,{direction:"vertical",style:{width:"100%"},children:[(0,t.jsxs)("span",{className:"inline-flex text-sm text-gray-700",children:[e.length," Member",1!==e.length?"s":""]}),(0,t.jsx)(o.Table,{columns:j,dataSource:e,rowKey:e=>e.user_id??e.user_email??JSON.stringify(e),pagination:!1,size:"small",scroll:{x:"max-content"},locale:v?{emptyText:v}:void 0}),x&&c&&(0,t.jsx)(s.Button,{icon:(0,t.jsx)(l.UserAddOutlined,{}),type:"primary",onClick:x,children:"Add Member"})]})}e.s(["default",()=>h])},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)},244451,e=>{"use strict";let t;e.i(247167);var a=e.i(271645),r=e.i(343794),l=e.i(242064),i=e.i(763731),s=e.i(174428);let n=80*Math.PI,o=e=>{let{dotClassName:t,style:l,hasCircleCls:i}=e;return a.createElement("circle",{className:(0,r.default)(`${t}-circle`,{[`${t}-circle-bg`]:i}),r:40,cx:50,cy:50,strokeWidth:20,style:l})},d=({percent:e,prefixCls:t})=>{let l=`${t}-dot`,i=`${l}-holder`,d=`${i}-hidden`,[m,c]=a.useState(!1);(0,s.default)(()=>{0!==e&&c(!0)},[0!==e]);let u=Math.max(Math.min(e,100),0);if(!m)return null;let g={strokeDashoffset:`${n/4}`,strokeDasharray:`${n*u/100} ${n*(100-u)/100}`};return a.createElement("span",{className:(0,r.default)(i,`${l}-progress`,u<=0&&d)},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 m(e){let{prefixCls:t,percent:l=0}=e,i=`${t}-dot`,s=`${i}-holder`,n=`${s}-hidden`;return a.createElement(a.Fragment,null,a.createElement("span",{className:(0,r.default)(s,l>0&&n)},a.createElement("span",{className:(0,r.default)(i,`${t}-dot-spin`)},[1,2,3,4].map(e=>a.createElement("i",{className:`${t}-dot-item`,key:e})))),a.createElement(d,{prefixCls:t,percent:l}))}function c(e){var t;let{prefixCls:l,indicator:s,percent:n}=e,o=`${l}-dot`;return s&&a.isValidElement(s)?(0,i.cloneElement)(s,{className:(0,r.default)(null==(t=s.props)?void 0:t.className,o),percent:n}):a.createElement(m,{prefixCls:l,percent:n})}e.i(296059);var u=e.i(694758),g=e.i(183293),h=e.i(246422),p=e.i(838378);let x=new u.Keyframes("antSpinMove",{to:{opacity:1}}),b=new u.Keyframes("antRotate",{to:{transform:"rotate(405deg)"}}),f=(0,h.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:x,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:b,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,p.mergeToken)(e,{spinDotDefault:e.colorTextDescription})),e=>{let{controlHeightLG:t,controlHeight:a}=e;return{contentHeight:400,dotSize:t/2,dotSizeSM:.35*t,dotSizeLG:a}}),y=[[30,.05],[70,.03],[96,.01]];var _=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 v=e=>{var i;let{prefixCls:s,spinning:n=!0,delay:o=0,className:d,rootClassName:m,size:u="default",tip:g,wrapperClassName:h,style:p,children:x,fullscreen:b=!1,indicator:v,percent:j}=e,w=_(e,["prefixCls","spinning","delay","className","rootClassName","size","tip","wrapperClassName","style","children","fullscreen","indicator","percent"]),{getPrefixCls:C,direction:S,className:k,style:N,indicator:T}=(0,l.useComponentConfig)("spin"),I=C("spin",s),[M,O,z]=f(I),[E,P]=a.useState(()=>n&&(!n||!o||!!Number.isNaN(Number(o)))),D=function(e,t){let[r,l]=a.useState(0),i=a.useRef(null),s="auto"===t;return a.useEffect(()=>(s&&e&&(l(0),i.current=setInterval(()=>{l(e=>{let t=100-e;for(let a=0;a{i.current&&(clearInterval(i.current),i.current=null)}),[s,e]),s?r:t}(E,j);a.useEffect(()=>{if(n){let e=function(e,t,a){var r,l=a||{},i=l.noTrailing,s=void 0!==i&&i,n=l.noLeading,o=void 0!==n&&n,d=l.debounceMode,m=void 0===d?void 0:d,c=!1,u=0;function g(){r&&clearTimeout(r)}function h(){for(var a=arguments.length,l=Array(a),i=0;ie?o?(u=Date.now(),s||(r=setTimeout(m?p:h,e))):h():!0!==s&&(r=setTimeout(m?p:h,void 0===m?e-d:e)))}return h.cancel=function(e){var t=(e||{}).upcomingOnly;g(),c=!(void 0!==t&&t)},h}(o,()=>{P(!0)},{debounceMode:false});return e(),()=>{var t;null==(t=null==e?void 0:e.cancel)||t.call(e)}}P(!1)},[o,n]);let $=a.useMemo(()=>void 0!==x&&!b,[x,b]),F=(0,r.default)(I,k,{[`${I}-sm`]:"small"===u,[`${I}-lg`]:"large"===u,[`${I}-spinning`]:E,[`${I}-show-text`]:!!g,[`${I}-rtl`]:"rtl"===S},d,!b&&m,O,z),L=(0,r.default)(`${I}-container`,{[`${I}-blur`]:E}),A=null!=(i=null!=v?v:T)?i:t,R=Object.assign(Object.assign({},N),p),B=a.createElement("div",Object.assign({},w,{style:R,className:F,"aria-live":"polite","aria-busy":E}),a.createElement(c,{prefixCls:I,indicator:A,percent:D}),g&&($||b)?a.createElement("div",{className:`${I}-text`},g):null);return M($?a.createElement("div",Object.assign({},w,{className:(0,r.default)(`${I}-nested-loading`,h,O,z)}),E&&a.createElement("div",{key:"loading"},B),a.createElement("div",{className:L,key:"container"},x)):b?a.createElement("div",{className:(0,r.default)(`${I}-fullscreen`,{[`${I}-fullscreen-show`]:E},m,O,z)},B):B)};v.setDefaultIndicator=e=>{t=e},e.s(["default",0,v],244451)},482725,e=>{"use strict";var t=e.i(244451);e.s(["Spin",()=>t.default])},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:s,className:n}=e,o=(0,t.__rest)(e,["children","className"]);return a.default.createElement("div",{className:(0,r.tremorTwMerge)(l("root"),"overflow-auto",n)},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),s))});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:s,className:n}=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",n)},o),s))});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:s,className:n}=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",n)},o),s))});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:s,className:n}=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",n)},o),s))});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:s,className:n}=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"),n)},o),s))});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:s,className:n}=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",n)},o),s))});i.displayName="TableCell",e.s(["TableCell",()=>i],977572)},389083,e=>{"use strict";var t=e.i(290571),a=e.i(271645),r=e.i(829087),l=e.i(480731),i=e.i(95779),s=e.i(444755),n=e.i(673706);let o={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"}},d={xs:{height:"h-4",width:"w-4"},sm:{height:"h-4",width:"w-4"},md:{height:"h-4",width:"w-4"},lg:{height:"h-5",width:"w-5"},xl:{height:"h-6",width:"w-6"}},m=(0,n.makeClassName)("Badge"),c=a.default.forwardRef((e,c)=>{let{color:u,icon:g,size:h=l.Sizes.SM,tooltip:p,className:x,children:b}=e,f=(0,t.__rest)(e,["color","icon","size","tooltip","className","children"]),y=g||null,{tooltipProps:_,getReferenceProps:v}=(0,r.useTooltip)();return a.default.createElement("span",Object.assign({ref:(0,n.mergeRefs)([c,_.refs.setReference]),className:(0,s.tremorTwMerge)(m("root"),"w-max shrink-0 inline-flex justify-center items-center cursor-default rounded-tremor-small ring-1 ring-inset",u?(0,s.tremorTwMerge)((0,n.getColorClassNames)(u,i.colorPalette.background).bgColor,(0,n.getColorClassNames)(u,i.colorPalette.iconText).textColor,(0,n.getColorClassNames)(u,i.colorPalette.iconRing).ringColor,"bg-opacity-10 ring-opacity-20","dark:bg-opacity-5 dark:ring-opacity-60"):(0,s.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"),o[h].paddingX,o[h].paddingY,o[h].fontSize,x)},v,f),a.default.createElement(r.default,Object.assign({text:p},_)),y?a.default.createElement(y,{className:(0,s.tremorTwMerge)(m("icon"),"shrink-0 -ml-1 mr-1.5",d[h].height,d[h].width)}):null,a.default.createElement("span",{className:(0,s.tremorTwMerge)(m("text"),"whitespace-nowrap")},b))});c.displayName="Badge",e.s(["Badge",()=>c],389083)},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)},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)},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)},969550,e=>{"use strict";var t=e.i(843476),a=e.i(271645);let r=a.forwardRef(function(e,t){return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"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"}))});var l=e.i(464571),i=e.i(311451),s=e.i(199133),n=e.i(374009);e.s(["default",0,({options:e,onApplyFilters:o,onResetFilters:d,initialValues:m={},buttonLabel:c="Filters"})=>{let[u,g]=(0,a.useState)(!1),[h,p]=(0,a.useState)(m),[x,b]=(0,a.useState)({}),[f,y]=(0,a.useState)({}),[_,v]=(0,a.useState)({}),[j,w]=(0,a.useState)({}),C=(0,a.useCallback)((0,n.default)(async(e,t)=>{if(t.isSearchable&&t.searchFn){y(e=>({...e,[t.name]:!0}));try{let a=await t.searchFn(e);b(e=>({...e,[t.name]:a}))}catch(e){console.error("Error searching:",e),b(e=>({...e,[t.name]:[]}))}finally{y(e=>({...e,[t.name]:!1}))}}},300),[]),S=(0,a.useCallback)(async e=>{if(e.isSearchable&&e.searchFn&&!j[e.name]){y(t=>({...t,[e.name]:!0})),w(t=>({...t,[e.name]:!0}));try{let t=await e.searchFn("");b(a=>({...a,[e.name]:t}))}catch(t){console.error("Error loading initial options:",t),b(t=>({...t,[e.name]:[]}))}finally{y(t=>({...t,[e.name]:!1}))}}},[j]);(0,a.useEffect)(()=>{u&&e.forEach(e=>{e.isSearchable&&!j[e.name]&&S(e)})},[u,e,S,j]);let k=(e,t)=>{let a={...h,[e]:t};p(a),o(a)};return(0,t.jsxs)("div",{className:"w-full",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-6",children:[(0,t.jsx)(l.Button,{icon:(0,t.jsx)(r,{className:"h-4 w-4"}),onClick:()=>g(!u),className:"flex items-center gap-2",children:c}),(0,t.jsx)(l.Button,{onClick:()=>{let t={};e.forEach(e=>{t[e.name]=""}),p(t),d()},children:"Reset Filters"})]}),u&&(0,t.jsx)("div",{className:"grid grid-cols-3 gap-x-6 gap-y-4 mb-6",children:["Team ID","Status","Organization ID","Key Alias","User ID","End User","Error Code","Error Message","Key Hash","Model"].map(a=>{let r,l=e.find(e=>e.label===a||e.name===a);return l?(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsx)("label",{className:"text-sm text-gray-600",children:l.label||l.name}),l.isSearchable?(0,t.jsx)(s.Select,{showSearch:!0,className:"w-full",placeholder:`Search ${l.label||l.name}...`,value:h[l.name]||void 0,onChange:e=>k(l.name,e),onOpenChange:e=>{e&&l.isSearchable&&!j[l.name]&&S(l)},onSearch:e=>{v(t=>({...t,[l.name]:e})),l.searchFn&&C(e,l)},filterOption:!1,loading:f[l.name],options:x[l.name]||[],allowClear:!0,notFoundContent:f[l.name]?"Loading...":"No results found"}):l.options?(0,t.jsx)(s.Select,{className:"w-full",placeholder:`Select ${l.label||l.name}...`,value:h[l.name]||void 0,onChange:e=>k(l.name,e),allowClear:!0,children:l.options.map(e=>(0,t.jsx)(s.Select.Option,{value:e.value,children:e.label},e.value))}):l.customComponent?(r=l.customComponent,(0,t.jsx)(r,{value:h[l.name]||void 0,onChange:e=>k(l.name,e??""),placeholder:`Select ${l.label||l.name}...`})):(0,t.jsx)(i.Input,{className:"w-full",placeholder:`Enter ${l.label||l.name}...`,value:h[l.name]||"",onChange:e=>k(l.name,e.target.value),allowClear:!0})]},l.name):null})})]})}],969550)},633627,e=>{"use strict";var t=e.i(764205);let a=(e,t,a,r)=>{for(let l of e){let e=l?.key_alias;e&&"string"==typeof e&&t.add(e.trim());let i=l?.organization_id??l?.org_id;i&&"string"==typeof i&&a.add(i.trim());let s=l?.user_id;if(s&&"string"==typeof s){let e=l?.user?.user_email||s;r.set(s,e)}}},r=async(e,r)=>{if(!e||!r)return{keyAliases:[],organizationIds:[],userIds:[]};try{let l=new Set,i=new Set,s=new Map,n=await (0,t.keyListCall)(e,null,r,null,null,null,1,100,null,null,"user",null),o=n?.keys||[],d=n?.total_pages??1;a(o,l,i,s);let m=Math.min(d,10)-1;if(m>0){let n=Array.from({length:m},(a,l)=>(0,t.keyListCall)(e,null,r,null,null,null,l+2,100,null,null,"user",null));for(let e of(await Promise.allSettled(n)))"fulfilled"===e.status&&a(e.value?.keys||[],l,i,s)}return{keyAliases:Array.from(l).sort(),organizationIds:Array.from(i).sort(),userIds:Array.from(s.entries()).map(([e,t])=>({id:e,email:t}))}}catch(e){return console.error("Error fetching team filter options:",e),{keyAliases:[],organizationIds:[],userIds:[]}}},l=async(e,a)=>{if(!e)return[];try{let r=[],l=1,i=!0;for(;i;){let s=await (0,t.teamListCall)(e,a||null,null);r=[...r,...s],l{if(!e)return[];try{let a=[],r=1,l=!0;for(;l;){let i=await (0,t.organizationListCall)(e);a=[...a,...i],r{"use strict";var t=e.i(266027),a=e.i(621482),r=e.i(243652),l=e.i(764205),i=e.i(135214);let s=(0,r.createQueryKeys)("models"),n=(0,r.createQueryKeys)("modelHub"),o=(0,r.createQueryKeys)("allProxyModels");(0,r.createQueryKeys)("selectedTeamModels");let d=(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:s,userRole:n}=(0,i.default)();return(0,a.useInfiniteQuery)({queryKey:d.list({filters:{...s&&{userId:s},...n&&{userRole:n},size:e,...t&&{search:t}}}),queryFn:async({pageParam:a})=>await (0,l.modelInfoCall)(r,s,n,a,e,t),initialPageParam:1,getNextPageParam:e=>{if(e.current_page{let{accessToken:e}=(0,i.default)();return(0,t.useQuery)({queryKey:n.list({}),queryFn:async()=>await (0,l.modelHubCall)(e),enabled:!!e})},"useModelsInfo",0,(e=1,a=50,r,n,o,d,m)=>{let{accessToken:c,userId:u,userRole:g}=(0,i.default)();return(0,t.useQuery)({queryKey:s.list({filters:{...u&&{userId:u},...g&&{userRole:g},page:e,size:a,...r&&{search:r},...n&&{modelId:n},...o&&{teamId:o},...d&&{sortBy:d},...m&&{sortOrder:m}}}),queryFn:async()=>await (0,l.modelInfoCall)(c,u,g,e,a,r,n,o,d,m),enabled:!!(c&&u&&g)})}])},91979,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:"M909.1 209.3l-56.4 44.1C775.8 155.1 656.2 92 521.9 92 290 92 102.3 279.5 102 511.5 101.7 743.7 289.8 932 521.9 932c181.3 0 335.8-115 394.6-276.1 1.5-4.2-.7-8.9-4.9-10.3l-56.7-19.5a8 8 0 00-10.1 4.8c-1.8 5-3.8 10-5.9 14.9-17.3 41-42.1 77.8-73.7 109.4A344.77 344.77 0 01655.9 829c-42.3 17.9-87.4 27-133.8 27-46.5 0-91.5-9.1-133.8-27A341.5 341.5 0 01279 755.2a342.16 342.16 0 01-73.7-109.4c-17.9-42.4-27-87.4-27-133.9s9.1-91.5 27-133.9c17.3-41 42.1-77.8 73.7-109.4 31.6-31.6 68.4-56.4 109.3-73.8 42.3-17.9 87.4-27 133.8-27 46.5 0 91.5 9.1 133.8 27a341.5 341.5 0 01109.3 73.8c9.9 9.9 19.2 20.4 27.8 31.4l-60.2 47a8 8 0 003 14.1l175.6 43c5 1.2 9.9-2.6 9.9-7.7l.8-180.9c-.1-6.6-7.8-10.3-13-6.2z"}}]},name:"reload",theme:"outlined"};var 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(["ReloadOutlined",0,i],91979)}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/4348e537165edb3b.js b/litellm/proxy/_experimental/out/_next/static/chunks/4348e537165edb3b.js new file mode 100644 index 0000000000..1b8a9c367e --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/4348e537165edb3b.js @@ -0,0 +1 @@ +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,988297,e=>{"use strict";var t=e.i(271645);let s=t.forwardRef(function(e,s){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:s},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4v16m8-8H4"}))});e.s(["PlusIcon",0,s],988297)},797672,e=>{"use strict";var t=e.i(271645);let s=t.forwardRef(function(e,s){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:s},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"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,s],797672)},981339,e=>{"use strict";var t=e.i(185793);e.s(["Skeleton",()=>t.default])},653496,e=>{"use strict";var t=e.i(721369);e.s(["Tabs",()=>t.default])},983561,e=>{"use strict";e.i(247167);var t=e.i(931067),s=e.i(271645);let a={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),l=s.forwardRef(function(e,l){return s.createElement(r.default,(0,t.default)({},e,{ref:l,icon:a}))});e.s(["RobotOutlined",0,l],983561)},992619,e=>{"use strict";var t=e.i(843476),s=e.i(271645),a=e.i(779241),r=e.i(599724),l=e.i(199133),i=e.i(983561),n=e.i(689020);e.s(["default",0,({accessToken:e,value:o,placeholder:c="Select a Model",onChange:d,disabled:u=!1,style:m,className:h,showLabel:p=!0,labelText:g="Select Model"})=>{let[f,x]=(0,s.useState)(o),[y,b]=(0,s.useState)(!1),[_,v]=(0,s.useState)([]),j=(0,s.useRef)(null);return(0,s.useEffect)(()=>{x(o)},[o]),(0,s.useEffect)(()=>{e&&(async()=>{try{let t=await (0,n.fetchAvailableModels)(e);console.log("Fetched models for selector:",t),t.length>0&&v(t)}catch(e){console.error("Error fetching model info:",e)}})()},[e]),(0,t.jsxs)("div",{children:[p&&(0,t.jsxs)(r.Text,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,t.jsx)(i.RobotOutlined,{className:"mr-2"})," ",g]}),(0,t.jsx)(l.Select,{value:f,placeholder:c,onChange:e=>{"custom"===e?(b(!0),x(void 0)):(b(!1),x(e),d&&d(e))},options:[...Array.from(new Set(_.map(e=>e.model_group))).map((e,t)=>({value:e,label:e,key:t})),{value:"custom",label:"Enter custom model",key:"custom"}],style:{width:"100%",...m},showSearch:!0,className:`rounded-md ${h||""}`,disabled:u}),y&&(0,t.jsx)(a.TextInput,{className:"mt-2",placeholder:"Enter custom model name",onValueChange:e=>{j.current&&clearTimeout(j.current),j.current=setTimeout(()=>{x(e),d&&d(e)},500)},disabled:u})]})}])},91739,e=>{"use strict";var t=e.i(544195);e.s(["Radio",()=>t.default])},409797,e=>{"use strict";var t=e.i(631171);e.s(["ChevronDownIcon",()=>t.default])},500727,696609,531516,e=>{"use strict";var t=e.i(266027),s=e.i(243652),a=e.i(764205),r=e.i(135214);let l=(0,s.createQueryKeys)("mcpServers");e.s(["useMCPServers",0,e=>{let{accessToken:s}=(0,r.default)();return(0,t.useQuery)({queryKey:l.list(e?{filters:{teamId:e}}:void 0),queryFn:async()=>await (0,a.fetchMCPServers)(s,e),enabled:!!s})}],500727);var i=e.i(843476),n=e.i(271645),o=e.i(536916),c=e.i(599724),d=e.i(409797),u=e.i(246349),u=u;let m=/\b(delete|remove|destroy|purge|drop|erase|unlink)\b/i,h=/\b(create|add|insert|new|post|submit|register|make|generate|write|upload)\b/i,p=/\b(update|edit|modify|change|patch|put|set|rename|move|transform)\b/i,g=/\b(get|read|list|fetch|search|find|query|retrieve|show|view|check|describe|info)\b/i;function f(e,t=""){let s=e.toLowerCase();if(g.test(s))return"read";if(m.test(s))return"delete";if(p.test(s))return"update";if(h.test(s))return"create";if(t){let e=t.toLowerCase();if(g.test(e))return"read";if(m.test(e))return"delete";if(p.test(e))return"update";if(h.test(e))return"create"}return"unknown"}function x(e){let t={read:[],create:[],update:[],delete:[],unknown:[]};for(let s of e)t[f(s.name,s.description)].push(s);return t}let y={read:{label:"Read",description:"Safe operations — fetch, list, search. No side effects.",risk:"low"},create:{label:"Create",description:"Add new resources — insert, upload, register.",risk:"medium"},update:{label:"Update",description:"Modify existing resources — edit, patch, rename.",risk:"medium"},delete:{label:"Delete",description:"Destructive operations — remove, purge, destroy.",risk:"high"},unknown:{label:"Other",description:"Operations that could not be automatically classified.",risk:"unknown"}};e.s(["CRUD_GROUP_META",0,y,"classifyToolOp",()=>f,"groupToolsByCrud",()=>x],696609);let b=["read","create","update","delete","unknown"],_={low:"bg-green-100 text-green-800",medium:"bg-yellow-100 text-yellow-800",high:"bg-red-100 text-red-800 font-semibold",unknown:"bg-gray-100 text-gray-700"},v={read:"border-green-200",create:"border-blue-200",update:"border-yellow-200",delete:"border-red-300",unknown:"border-gray-200"},j={read:"bg-green-50",create:"bg-blue-50",update:"bg-yellow-50",delete:"bg-red-50",unknown:"bg-gray-50"};e.s(["default",0,({tools:e,value:t,onChange:s,readOnly:a=!1,searchFilter:r=""})=>{let[l,m]=(0,n.useState)({read:!1,create:!1,update:!1,delete:!1,unknown:!0}),h=(0,n.useMemo)(()=>x(e),[e]),p=(0,n.useMemo)(()=>new Set(void 0===t?e.map(e=>e.name):t),[t,e]),g=e=>{if(a)return;let t=new Set(p);t.has(e)?t.delete(e):t.add(e),s(Array.from(t))};return 0===e.length?null:(0,i.jsx)("div",{className:"space-y-3",children:b.map(e=>{let t,n=h[e];if(0===n.length)return null;if(r){let e=r.toLowerCase();if(!n.some(t=>t.name.toLowerCase().includes(e)||(t.description??"").toLowerCase().includes(e)))return null}let f=y[e],x=(t=h[e]).length>0&&t.every(e=>p.has(e.name)),b=(e=>{let t=h[e];if(0===t.length)return!1;let s=t.filter(e=>p.has(e.name)).length;return s>0&&s{m(t=>({...t,[e]:!t[e]}))},children:[w?(0,i.jsx)(u.default,{className:"w-4 h-4 text-gray-500 flex-shrink-0"}):(0,i.jsx)(d.ChevronDownIcon,{className:"w-4 h-4 text-gray-500 flex-shrink-0"}),(0,i.jsx)("span",{className:"font-semibold text-gray-900 text-sm",children:f.label}),(0,i.jsx)("span",{className:`text-xs px-2 py-0.5 rounded-full ${_[f.risk]}`,children:"high"===f.risk?"High Risk":"medium"===f.risk?"Medium Risk":"low"===f.risk?"Safe":"Unclassified"}),(0,i.jsxs)("span",{className:"text-xs text-gray-500 ml-1",children:[n.filter(e=>p.has(e.name)).length,"/",n.length," allowed"]})]}),!a&&(0,i.jsxs)("div",{className:"flex items-center gap-2 ml-4",children:[(0,i.jsx)(c.Text,{className:"text-xs text-gray-500",children:x?"All on":b?"Partial":"All off"}),(0,i.jsx)(o.Checkbox,{checked:x,indeterminate:b,onChange:t=>((e,t)=>{if(a)return;let r=new Set(p);for(let s of h[e])t?r.add(s.name):r.delete(s.name);s(Array.from(r))})(e,t.target.checked),onClick:e=>e.stopPropagation()})]})]}),!w&&(0,i.jsx)("div",{className:"px-4 pt-2 pb-1 text-xs text-gray-500 bg-white border-b border-gray-100",children:f.description}),!w&&(0,i.jsx)("div",{className:"bg-white divide-y divide-gray-50",children:n.filter(e=>!r||e.name.toLowerCase().includes(r.toLowerCase())||(e.description??"").toLowerCase().includes(r.toLowerCase())).map(e=>{let t,s=(t=e.name,p.has(t));return(0,i.jsxs)("div",{className:`flex items-start gap-3 px-4 py-2.5 transition-colors hover:bg-gray-50 ${!a?"cursor-pointer":""} ${s?"":"opacity-60"}`,onClick:()=>g(e.name),children:[(0,i.jsx)(o.Checkbox,{checked:s,onChange:()=>g(e.name),disabled:a,onClick:e=>e.stopPropagation()}),(0,i.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,i.jsx)(c.Text,{className:"font-medium text-gray-900 text-sm",children:e.name}),e.description&&(0,i.jsx)(c.Text,{className:"text-xs text-gray-500 mt-0.5 leading-snug",children:e.description})]}),(0,i.jsx)("span",{className:`text-xs px-1.5 py-0.5 rounded flex-shrink-0 ${s?"bg-green-100 text-green-700":"bg-gray-100 text-gray-500"}`,children:s?"on":"off"})]},e.name)})})]},e)})})}],531516)},107233,37727,e=>{"use strict";var t=e.i(603908);e.s(["Plus",()=>t.default],107233);var s=e.i(841947);e.s(["X",()=>s.default],37727)},246349,e=>{"use strict";let t=(0,e.i(475254).default)("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);e.s(["default",()=>t])},689020,e=>{"use strict";var t=e.i(764205);let s=async e=>{try{let s=await (0,t.modelHubCall)(e);if(console.log("model_info:",s),s?.data.length>0){let e=s.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,s])},955135,e=>{"use strict";var t=e.i(597440);e.s(["DeleteOutlined",()=>t.default])},737434,e=>{"use strict";var t=e.i(184163);e.s(["DownloadOutlined",()=>t.default])},916940,e=>{"use strict";var t=e.i(843476),s=e.i(271645),a=e.i(199133),r=e.i(764205);e.s(["default",0,({onChange:e,value:l,className:i,accessToken:n,placeholder:o="Select vector stores",disabled:c=!1})=>{let[d,u]=(0,s.useState)([]),[m,h]=(0,s.useState)(!1);return(0,s.useEffect)(()=>{(async()=>{if(n){h(!0);try{let e=await (0,r.vectorStoreListCall)(n);e.data&&u(e.data)}catch(e){console.error("Error fetching vector stores:",e)}finally{h(!1)}}})()},[n]),(0,t.jsx)("div",{children:(0,t.jsx)(a.Select,{mode:"multiple",placeholder:o,onChange:e,value:l,loading:m,className:i,allowClear:!0,options:d.map(e=>({label:`${e.vector_store_name||e.vector_store_id} (${e.vector_store_id})`,value:e.vector_store_id,title:e.vector_store_description||e.vector_store_id})),optionFilterProp:"label",showSearch:!0,style:{width:"100%"},disabled:c})})}])},59935,(e,t,s)=>{var a;let r;e.e,a=function e(){var t,s="u">typeof self?self:"u">typeof window?window:void 0!==s?s:{},a=!s.document&&!!s.postMessage,r=s.IS_PAPA_WORKER||!1,l={},i=0,n={};function o(e){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},(function(e){var t=b(e);t.chunkSize=parseInt(t.chunkSize),e.step||e.chunk||(t.chunkSize=null),this._handle=new h(t),(this._handle.streamer=this)._config=t}).call(this,e),this.parseChunk=function(e,t){var a=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0=this._config.preview,r)s.postMessage({results:l,workerId:n.WORKER_ID,finished:a});else if(v(this._config.chunk)&&!t){if(this._config.chunk(l,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);this._completeResults=l=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(l.data),this._completeResults.errors=this._completeResults.errors.concat(l.errors),this._completeResults.meta=l.meta),this._completed||!a||!v(this._config.complete)||l&&l.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),a||l&&l.meta.paused||this._nextChunk(),l}this._halted=!0},this._sendError=function(e){v(this._config.error)?this._config.error(e):r&&this._config.error&&s.postMessage({workerId:n.WORKER_ID,error:e,finished:!1})}}function c(e){var t;(e=e||{}).chunkSize||(e.chunkSize=n.RemoteChunkSize),o.call(this,e),this._nextChunk=a?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),a||(t.onload=_(this._chunkLoaded,this),t.onerror=_(this._chunkError,this)),t.open(this._config.downloadRequestBody?"POST":"GET",this._input,!a),this._config.downloadRequestHeaders){var e,s,r=this._config.downloadRequestHeaders;for(s in r)t.setRequestHeader(s,r[s])}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)}a&&0===t.status&&this._chunkError()}},this._chunkLoaded=function(){let e;4===t.readyState&&(t.status<200||400<=t.status?this._chunkError():(this._start+=this._config.chunkSize||t.responseText.length,this._finished=!this._config.chunkSize||this._start>=(null!==(e=(e=t).getResponseHeader("Content-Range"))?parseInt(e.substring(e.lastIndexOf("/")+1)):-1),this.parseChunk(t.responseText)))},this._chunkError=function(e){e=t.statusText||e,this._sendError(Error(e))}}function d(e){(e=e||{}).chunkSize||(e.chunkSize=n.LocalChunkSize),o.call(this,e);var t,s,a="u">typeof FileReader;this.stream=function(e){this._input=e,s=e.slice||e.webkitSlice||e.mozSlice,a?((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,s;if(!this._finished)return t=(e=this._config.chunkSize)?(s=t.substring(0,e),t.substring(e)):(s=t,""),this._finished=!t,this.parseChunk(s)}}function m(e){o.call(this,e=e||{});var t=[],s=!0,a=!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(){a&&1===t.length&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),t.length?this.parseChunk(t.shift()):s=!0},this._streamData=_(function(e){try{t.push("string"==typeof e?e:e.toString(this._config.encoding)),s&&(s=!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(),a=!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 h(e){var t,s,a,r,l=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,i=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,o=this,c=0,d=0,u=!1,m=!1,h=[],f={data:[],errors:[],meta:{}};function x(t){return"greedy"===e.skipEmptyLines?""===t.join("").trim():1===t.length&&0===t[0].length}function y(){if(f&&a&&(j("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+n.DefaultDelimiter+"'"),a=!1),e.skipEmptyLines&&(f.data=f.data.filter(function(e){return!x(e)})),_()){if(f)if(Array.isArray(f.data[0])){for(var t,s=0;_()&&s(e.dynamicTypingFunction&&void 0===e.dynamicTyping[t]&&(e.dynamicTyping[t]=e.dynamicTypingFunction(t)),!0===(e.dynamicTyping[t]||e.dynamicTyping))?"true"===s||"TRUE"===s||"false"!==s&&"FALSE"!==s&&((e=>{if(l.test(e)&&-0x20000000000000<(e=parseFloat(e))&&e<0x20000000000000)return 1})(s)?parseFloat(s):i.test(s)?new Date(s):""===s?null:s):s)(n=e.header?r>=h.length?"__parsed_extra":h[r]:n,o=e.transform?e.transform(o,n):o);"__parsed_extra"===n?(a[n]=a[n]||[],a[n].push(o)):a[n]=o}return e.header&&(r>h.length?j("FieldMismatch","TooManyFields","Too many fields: expected "+h.length+" fields but parsed "+r,d+s):re.preview?s.abort():(f.data=f.data[0],r(f,o))))}),this.parse=function(r,l,i){var o=e.quoteChar||'"',o=(e.newline||(e.newline=this.guessLineEndings(r,o)),a=!1,e.delimiter?v(e.delimiter)&&(e.delimiter=e.delimiter(r),f.meta.delimiter=e.delimiter):((o=((t,s,a,r,l)=>{var i,o,c,d;l=l||[","," ","|",";",n.RECORD_SEP,n.UNIT_SEP];for(var u=0;u=s.length/2?"\r\n":"\r"}}function p(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function g(e){var t=(e=e||{}).delimiter,s=e.newline,a=e.comments,r=e.step,l=e.preview,i=e.fastMode,o=null,c=!1,d=null==e.quoteChar?'"':e.quoteChar,u=d;if(void 0!==e.escapeChar&&(u=e.escapeChar),("string"!=typeof t||-1=l)return D(!0);break}k.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:w.length,index:m}),O++}}else if(a&&0===N.length&&n.substring(m,m+_)===a){if(-1===I)return D();m=I+b,I=n.indexOf(s,m),E=n.indexOf(t,m)}else if(-1!==E&&(E=l)return D(!0)}return R();function M(e){w.push(e),S=m}function F(e){return -1!==e&&(e=n.substring(O+1,e))&&""===e.trim()?e.length:0}function R(e){return f||(void 0===e&&(e=n.substring(m)),N.push(e),m=x,M(N),j&&B()),D()}function P(e){m=e,M(N),N=[],I=n.indexOf(s,m)}function D(a){if(e.header&&!g&&w.length&&!c){var r=w[0],l=Object.create(null),i=new Set(r);let t=!1;for(let s=0;s{if("object"==typeof t){if("string"!=typeof t.delimiter||n.BAD_DELIMITERS.filter(function(e){return -1!==t.delimiter.indexOf(e)}).length||(r=t.delimiter),("boolean"==typeof t.quotes||"function"==typeof t.quotes||Array.isArray(t.quotes))&&(s=t.quotes),"boolean"!=typeof t.skipEmptyLines&&"string"!=typeof t.skipEmptyLines||(c=t.skipEmptyLines),"string"==typeof t.newline&&(l=t.newline),"string"==typeof t.quoteChar&&(i=t.quoteChar),"boolean"==typeof t.header&&(a=t.header),Array.isArray(t.columns)){if(0===t.columns.length)throw Error("Option columns is empty");d=t.columns}void 0!==t.escapeChar&&(o=t.escapeChar+i),t.escapeFormulae instanceof RegExp?u=t.escapeFormulae:"boolean"==typeof t.escapeFormulae&&t.escapeFormulae&&(u=/^[=+\-@\t\r].*$/)}})(),RegExp(p(i),"g"));if("string"==typeof e&&(e=JSON.parse(e)),Array.isArray(e)){if(!e.length||Array.isArray(e[0]))return h(null,e,c);if("object"==typeof e[0])return h(d||Object.keys(e[0]),e,c)}else if("object"==typeof e)return"string"==typeof e.data&&(e.data=JSON.parse(e.data)),Array.isArray(e.data)&&(e.fields||(e.fields=e.meta&&e.meta.fields||d),e.fields||(e.fields=Array.isArray(e.data[0])?e.fields:"object"==typeof e.data[0]?Object.keys(e.data[0]):[]),Array.isArray(e.data[0])||"object"==typeof e.data[0]||(e.data=[e.data])),h(e.fields||[],e.data||[],c);throw Error("Unable to serialize unrecognized input");function h(e,t,s){var i="",n=("string"==typeof e&&(e=JSON.parse(e)),"string"==typeof t&&(t=JSON.parse(t)),Array.isArray(e)&&0{for(var s=0;s{"use strict";let t=(0,e.i(475254).default)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);e.s(["default",()=>t])},603908,e=>{"use strict";let t=(0,e.i(475254).default)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);e.s(["default",()=>t])},841947,e=>{"use strict";let t=(0,e.i(475254).default)("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);e.s(["default",()=>t])},793130,e=>{"use strict";var t=e.i(290571),s=e.i(429427),a=e.i(371330),r=e.i(271645),l=e.i(394487),i=e.i(503269),n=e.i(214520),o=e.i(746725),c=e.i(914189),d=e.i(144279),u=e.i(294316),m=e.i(601893),h=e.i(140721),p=e.i(942803),g=e.i(233538),f=e.i(694421),x=e.i(700020),y=e.i(35889),b=e.i(998348),_=e.i(722678);let v=(0,r.createContext)(null);v.displayName="GroupContext";let j=r.Fragment,w=Object.assign((0,x.forwardRefWithAs)(function(e,t){var j;let w=(0,r.useId)(),k=(0,p.useProvidedId)(),N=(0,m.useDisabled)(),{id:S=k||`headlessui-switch-${w}`,disabled:C=N||!1,checked:T,defaultChecked:E,onChange:I,name:A,value:O,form:L,autoFocus:M=!1,...F}=e,R=(0,r.useContext)(v),[P,D]=(0,r.useState)(null),B=(0,r.useRef)(null),$=(0,u.useSyncRefs)(B,t,null===R?null:R.setSwitch,D),K=(0,n.useDefaultValue)(E),[U,z]=(0,i.useControllable)(T,I,null!=K&&K),V=(0,o.useDisposables)(),[q,G]=(0,r.useState)(!1),H=(0,c.useEvent)(()=>{G(!0),null==z||z(!U),V.nextFrame(()=>{G(!1)})}),W=(0,c.useEvent)(e=>{if((0,g.isDisabledReactIssue7711)(e.currentTarget))return e.preventDefault();e.preventDefault(),H()}),Q=(0,c.useEvent)(e=>{e.key===b.Keys.Space?(e.preventDefault(),H()):e.key===b.Keys.Enter&&(0,f.attemptSubmit)(e.currentTarget)}),J=(0,c.useEvent)(e=>e.preventDefault()),Y=(0,_.useLabelledBy)(),X=(0,y.useDescribedBy)(),{isFocusVisible:Z,focusProps:ee}=(0,s.useFocusRing)({autoFocus:M}),{isHovered:et,hoverProps:es}=(0,a.useHover)({isDisabled:C}),{pressed:ea,pressProps:er}=(0,l.useActivePress)({disabled:C}),el=(0,r.useMemo)(()=>({checked:U,disabled:C,hover:et,focus:Z,active:ea,autofocus:M,changing:q}),[U,et,Z,ea,C,q,M]),ei=(0,x.mergeProps)({id:S,ref:$,role:"switch",type:(0,d.useResolveButtonType)(e,P),tabIndex:-1===e.tabIndex?0:null!=(j=e.tabIndex)?j:0,"aria-checked":U,"aria-labelledby":Y,"aria-describedby":X,disabled:C||void 0,autoFocus:M,onClick:W,onKeyUp:Q,onKeyPress:J},ee,es,er),en=(0,r.useCallback)(()=>{if(void 0!==K)return null==z?void 0:z(K)},[z,K]),eo=(0,x.useRender)();return r.default.createElement(r.default.Fragment,null,null!=A&&r.default.createElement(h.FormFields,{disabled:C,data:{[A]:O||"on"},overrides:{type:"checkbox",checked:U},form:L,onReset:en}),eo({ourProps:ei,theirProps:F,slot:el,defaultTag:"button",name:"Switch"}))}),{Group:function(e){var t;let[s,a]=(0,r.useState)(null),[l,i]=(0,_.useLabels)(),[n,o]=(0,y.useDescriptions)(),c=(0,r.useMemo)(()=>({switch:s,setSwitch:a}),[s,a]),d=(0,x.useRender)();return r.default.createElement(o,{name:"Switch.Description",value:n},r.default.createElement(i,{name:"Switch.Label",value:l,props:{htmlFor:null==(t=c.switch)?void 0:t.id,onClick(e){s&&(e.currentTarget instanceof HTMLLabelElement&&e.preventDefault(),s.click(),s.focus({preventScroll:!0}))}}},r.default.createElement(v.Provider,{value:c},d({ourProps:{},theirProps:e,slot:{},defaultTag:j,name:"Switch.Group"}))))},Label:_.Label,Description:y.Description});var k=e.i(888288),N=e.i(95779),S=e.i(444755),C=e.i(673706),T=e.i(829087);let E=(0,C.makeClassName)("Switch"),I=r.default.forwardRef((e,s)=>{let{checked:a,defaultChecked:l=!1,onChange:i,color:n,name:o,error:c,errorMessage:d,disabled:u,required:m,tooltip:h,id:p}=e,g=(0,t.__rest)(e,["checked","defaultChecked","onChange","color","name","error","errorMessage","disabled","required","tooltip","id"]),f={bgColor:n?(0,C.getColorClassNames)(n,N.colorPalette.background).bgColor:"bg-tremor-brand dark:bg-dark-tremor-brand",ringColor:n?(0,C.getColorClassNames)(n,N.colorPalette.ring).ringColor:"ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted"},[x,y]=(0,k.default)(l,a),[b,_]=(0,r.useState)(!1),{tooltipProps:v,getReferenceProps:j}=(0,T.useTooltip)(300);return r.default.createElement("div",{className:"flex flex-row items-center justify-start"},r.default.createElement(T.default,Object.assign({text:h},v)),r.default.createElement("div",Object.assign({ref:(0,C.mergeRefs)([s,v.refs.setReference]),className:(0,S.tremorTwMerge)(E("root"),"flex flex-row relative h-5")},g,j),r.default.createElement("input",{type:"checkbox",className:(0,S.tremorTwMerge)(E("input"),"absolute w-5 h-5 cursor-pointer left-0 top-0 opacity-0"),name:o,required:m,checked:x,onChange:e=>{e.preventDefault()}}),r.default.createElement(w,{checked:x,onChange:e=>{y(e),null==i||i(e)},disabled:u,className:(0,S.tremorTwMerge)(E("switch"),"w-10 h-5 group relative inline-flex shrink-0 cursor-pointer items-center justify-center rounded-tremor-full","focus:outline-none",u?"cursor-not-allowed":""),onFocus:()=>_(!0),onBlur:()=>_(!1),id:p},r.default.createElement("span",{className:(0,S.tremorTwMerge)(E("sr-only"),"sr-only")},"Switch ",x?"on":"off"),r.default.createElement("span",{"aria-hidden":"true",className:(0,S.tremorTwMerge)(E("background"),x?f.bgColor:"bg-tremor-border dark:bg-dark-tremor-border","pointer-events-none absolute mx-auto h-3 w-9 rounded-tremor-full transition-colors duration-100 ease-in-out")}),r.default.createElement("span",{"aria-hidden":"true",className:(0,S.tremorTwMerge)(E("round"),x?(0,S.tremorTwMerge)(f.bgColor,"translate-x-5 border-tremor-background dark:border-dark-tremor-background"):"translate-x-0 bg-tremor-border dark:bg-dark-tremor-border border-tremor-background dark:border-dark-tremor-background","pointer-events-none absolute left-0 inline-block h-5 w-5 transform rounded-tremor-full border-2 shadow-tremor-input duration-100 ease-in-out transition",b?(0,S.tremorTwMerge)("ring-2",f.ringColor):"")}))),c&&d?r.default.createElement("p",{className:(0,S.tremorTwMerge)(E("errorMessage"),"text-sm text-red-500 mt-1 ")},d):null)});I.displayName="Switch",e.s(["Switch",()=>I],793130)},158392,419470,e=>{"use strict";var t=e.i(843476),s=e.i(779241);let a={ttl:3600,lowest_latency_buffer:0},r=({routingStrategyArgs:e})=>{let r={ttl:"Sliding window to look back over when calculating the average latency of a deployment. Default - 1 hour (in seconds).",lowest_latency_buffer:"Shuffle between deployments within this % of the lowest latency. Default - 0 (i.e. always pick lowest latency)."};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"max-w-3xl",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Latency-Based Configuration"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Fine-tune latency-based routing behavior"})]}),(0,t.jsx)("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2 xl:grid-cols-3",children:Object.entries(e||a).map(([e,a])=>(0,t.jsx)("div",{className:"space-y-2",children:(0,t.jsxs)("label",{className:"block",children:[(0,t.jsx)("span",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:e.replace(/_/g," ")}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-0.5 mb-2",children:r[e]||""}),(0,t.jsx)(s.TextInput,{name:e,defaultValue:"object"==typeof a?JSON.stringify(a,null,2):a?.toString(),className:"font-mono text-sm w-full"})]})},e))})]}),(0,t.jsx)("div",{className:"border-t border-gray-200"})]})},l=({routerSettings:e,routerFieldsMetadata:a})=>(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"max-w-3xl",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Reliability & Retries"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Configure retry logic and failure handling"})]}),(0,t.jsx)("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2 xl:grid-cols-3",children:Object.entries(e).filter(([e,t])=>"fallbacks"!=e&&"context_window_fallbacks"!=e&&"routing_strategy_args"!=e&&"routing_strategy"!=e&&"enable_tag_filtering"!=e).map(([e,r])=>(0,t.jsx)("div",{className:"space-y-2",children:(0,t.jsxs)("label",{className:"block",children:[(0,t.jsx)("span",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:a[e]?.ui_field_name||e}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-0.5 mb-2",children:a[e]?.field_description||""}),(0,t.jsx)(s.TextInput,{name:e,defaultValue:null==r||"null"===r?"":"object"==typeof r?JSON.stringify(r,null,2):r?.toString()||"",placeholder:"—",className:"font-mono text-sm w-full"})]})},e))})]});var i=e.i(199133);let n=({selectedStrategy:e,availableStrategies:s,routingStrategyDescriptions:a,routerFieldsMetadata:r,onStrategyChange:l})=>(0,t.jsxs)("div",{className:"space-y-2 max-w-3xl",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:r.routing_strategy?.ui_field_name||"Routing Strategy"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-0.5 mb-2",children:r.routing_strategy?.field_description||""})]}),(0,t.jsx)("div",{className:"routing-strategy-select max-w-3xl",children:(0,t.jsx)(i.Select,{value:e,onChange:l,style:{width:"100%"},size:"large",children:s.map(e=>(0,t.jsx)(i.Select.Option,{value:e,label:e,children:(0,t.jsxs)("div",{className:"flex flex-col gap-0.5 py-1",children:[(0,t.jsx)("span",{className:"font-mono text-sm font-medium",children:e}),a[e]&&(0,t.jsx)("span",{className:"text-xs text-gray-500 font-normal",children:a[e]})]})},e))})})]});var o=e.i(793130);let c=({enabled:e,routerFieldsMetadata:s,onToggle:a})=>(0,t.jsx)("div",{className:"space-y-3 max-w-3xl",children:(0,t.jsxs)("div",{className:"flex items-start justify-between",children:[(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)("label",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:s.enable_tag_filtering?.ui_field_name||"Enable Tag Filtering"}),(0,t.jsxs)("p",{className:"text-xs text-gray-500 mt-0.5",children:[s.enable_tag_filtering?.field_description||"",s.enable_tag_filtering?.link&&(0,t.jsxs)(t.Fragment,{children:[" ",(0,t.jsx)("a",{href:s.enable_tag_filtering.link,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-800 underline",children:"Learn more"})]})]})]}),(0,t.jsx)(o.Switch,{checked:e,onChange:a,className:"ml-4"})]})});e.s(["default",0,({value:e,onChange:s,routerFieldsMetadata:a,availableRoutingStrategies:i,routingStrategyDescriptions:o})=>(0,t.jsxs)("div",{className:"w-full space-y-8 py-2",children:[(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"max-w-3xl",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Routing Settings"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Configure how requests are routed to deployments"})]}),i.length>0&&(0,t.jsx)(n,{selectedStrategy:e.selectedStrategy||e.routerSettings.routing_strategy||null,availableStrategies:i,routingStrategyDescriptions:o,routerFieldsMetadata:a,onStrategyChange:t=>{s({...e,selectedStrategy:t})}}),(0,t.jsx)(c,{enabled:e.enableTagFiltering,routerFieldsMetadata:a,onToggle:t=>{s({...e,enableTagFiltering:t})}})]}),(0,t.jsx)("div",{className:"border-t border-gray-200"}),"latency-based-routing"===e.selectedStrategy&&(0,t.jsx)(r,{routingStrategyArgs:e.routerSettings.routing_strategy_args}),(0,t.jsx)(l,{routerSettings:e.routerSettings,routerFieldsMetadata:a})]})],158392);var d=e.i(994388),u=e.i(998573),m=e.i(653496),h=e.i(107233),p=e.i(271645),g=e.i(592968),f=e.i(361653),f=f;let x=(0,e.i(475254).default)("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);var y=e.i(37727);function b({group:e,onChange:s,availableModels:a,maxFallbacks:r}){let l=a.filter(t=>t!==e.primaryModel),n=e.fallbackModels.length{let a=[...e.fallbackModels];a.includes(t)&&(a=a.filter(e=>e!==t)),s({...e,primaryModel:t,fallbackModels:a})},showSearch:!0,getPopupContainer:e=>e.parentElement||document.body,filterOption:(e,t)=>(t?.label??"").toLowerCase().includes(e.toLowerCase()),options:a.map(e=>({label:e,value:e}))}),!e.primaryModel&&(0,t.jsxs)("div",{className:"mt-2 flex items-center gap-2 text-amber-600 text-xs bg-amber-50 p-2 rounded",children:[(0,t.jsx)(f.default,{className:"w-4 h-4"}),(0,t.jsx)("span",{children:"Select a model to begin configuring fallbacks"})]})]}),(0,t.jsx)("div",{className:"flex items-center justify-center -my-4 z-10",children:(0,t.jsxs)("div",{className:"bg-indigo-50 text-indigo-500 px-4 py-1 rounded-full text-xs font-bold border border-indigo-100 flex items-center gap-2 shadow-sm",children:[(0,t.jsx)(x,{className:"w-4 h-4"}),"IF FAILS, TRY..."]})}),(0,t.jsxs)("div",{className:`transition-opacity duration-300 ${!e.primaryModel?"opacity-50 pointer-events-none":"opacity-100"}`,children:[(0,t.jsxs)("label",{className:"block text-sm font-semibold text-gray-700 mb-2",children:["Fallback Chain ",(0,t.jsx)("span",{className:"text-red-500",children:"*"}),(0,t.jsxs)("span",{className:"text-xs text-gray-500 font-normal ml-2",children:["(Max ",r," fallbacks at a time)"]})]}),(0,t.jsxs)("div",{className:"bg-gray-50 rounded-xl p-4 border border-gray-200",children:[(0,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsx)(i.Select,{mode:"multiple",className:"w-full",size:"large",placeholder:n?"Select fallback models to add...":`Maximum ${r} fallbacks reached`,value:e.fallbackModels,onChange:t=>{let a=t.slice(0,r);s({...e,fallbackModels:a})},disabled:!e.primaryModel,getPopupContainer:e=>e.parentElement||document.body,options:l.map(e=>({label:e,value:e})),optionRender:(s,a)=>{let r=e.fallbackModels.includes(s.value),l=r?e.fallbackModels.indexOf(s.value)+1:null;return(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[r&&null!==l&&(0,t.jsx)("span",{className:"flex items-center justify-center w-5 h-5 rounded bg-indigo-100 text-indigo-600 text-xs font-bold",children:l}),(0,t.jsx)("span",{children:s.label})]})},maxTagCount:"responsive",maxTagPlaceholder:e=>(0,t.jsx)(g.Tooltip,{styles:{root:{pointerEvents:"none"}},title:e.map(({value:e})=>e).join(", "),children:(0,t.jsxs)("span",{children:["+",e.length," more"]})}),showSearch:!0,filterOption:(e,t)=>(t?.label??"").toLowerCase().includes(e.toLowerCase())}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1 ml-1",children:n?`Search and select multiple models. Selected models will appear below in order. (${e.fallbackModels.length}/${r} used)`:`Maximum ${r} fallbacks reached. Remove some to add more.`})]}),(0,t.jsx)("div",{className:"space-y-2 min-h-[100px]",children:0===e.fallbackModels.length?(0,t.jsxs)("div",{className:"h-32 border-2 border-dashed border-gray-300 rounded-lg flex flex-col items-center justify-center text-gray-400",children:[(0,t.jsx)("span",{className:"text-sm",children:"No fallback models selected"}),(0,t.jsx)("span",{className:"text-xs mt-1",children:"Add models from the dropdown above"})]}):e.fallbackModels.map((a,r)=>(0,t.jsxs)("div",{className:"group flex items-center justify-between p-3 bg-white rounded-lg border border-gray-200 hover:border-indigo-300 hover:shadow-sm transition-all",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"flex items-center justify-center w-6 h-6 rounded bg-gray-100 text-gray-400 group-hover:text-indigo-500 group-hover:bg-indigo-50",children:(0,t.jsx)("span",{className:"text-xs font-bold",children:r+1})}),(0,t.jsx)("div",{children:(0,t.jsx)("span",{className:"font-medium text-gray-800",children:a})})]}),(0,t.jsx)("button",{type:"button",onClick:()=>{let t;return t=e.fallbackModels.filter((e,t)=>t!==r),void s({...e,fallbackModels:t})},className:"opacity-0 group-hover:opacity-100 transition-opacity text-gray-400 hover:text-red-500 p-1",children:(0,t.jsx)(y.X,{className:"w-4 h-4"})})]},`${a}-${r}`))})]})]})]})}function _({groups:e,onGroupsChange:s,availableModels:a,maxFallbacks:r=10,maxGroups:l=5}){let[i,n]=(0,p.useState)(e.length>0?e[0].id:"1");(0,p.useEffect)(()=>{e.length>0?e.some(e=>e.id===i)||n(e[0].id):n("1")},[e]);let o=()=>{if(e.length>=l)return;let t=Date.now().toString();s([...e,{id:t,primaryModel:null,fallbackModels:[]}]),n(t)},c=t=>{s(e.map(e=>e.id===t.id?t:e))},g=e.map((s,l)=>{let i=s.primaryModel?s.primaryModel:`Group ${l+1}`;return{key:s.id,label:i,closable:e.length>1,children:(0,t.jsx)(b,{group:s,onChange:c,availableModels:a,maxFallbacks:r})}});return 0===e.length?(0,t.jsxs)("div",{className:"text-center py-12 bg-gray-50 rounded-lg border border-dashed border-gray-300",children:[(0,t.jsx)("p",{className:"text-gray-500 mb-4",children:"No fallback groups configured"}),(0,t.jsx)(d.Button,{variant:"primary",onClick:o,icon:()=>(0,t.jsx)(h.Plus,{className:"w-4 h-4"}),children:"Create First Group"})]}):(0,t.jsx)(m.Tabs,{type:"editable-card",activeKey:i,onChange:n,onEdit:(t,a)=>{"add"===a?o():"remove"===a&&e.length>1&&(t=>{if(1===e.length)return u.message.warning("At least one group is required");let a=e.filter(e=>e.id!==t);s(a),i===t&&a.length>0&&n(a[a.length-1].id)})(t)},items:g,className:"fallback-tabs",tabBarStyle:{marginBottom:0},hideAdd:e.length>=l})}e.s(["FallbackSelectionForm",()=>_],419470)},309426,e=>{"use strict";var t=e.i(290571),s=e.i(444755),a=e.i(673706),r=e.i(271645),l=e.i(46757);let i=(0,a.makeClassName)("Col"),n=r.default.forwardRef((e,a)=>{let n,o,c,d,{numColSpan:u=1,numColSpanSm:m,numColSpanMd:h,numColSpanLg:p,children:g,className:f}=e,x=(0,t.__rest)(e,["numColSpan","numColSpanSm","numColSpanMd","numColSpanLg","children","className"]),y=(e,t)=>e&&Object.keys(t).includes(String(e))?t[e]:"";return r.default.createElement("div",Object.assign({ref:a,className:(0,s.tremorTwMerge)(i("root"),(n=y(u,l.colSpan),o=y(m,l.colSpanSm),c=y(h,l.colSpanMd),d=y(p,l.colSpanLg),(0,s.tremorTwMerge)(n,o,c,d)),f)},x),g)});n.displayName="Col",e.s(["Col",()=>n],309426)},677667,674175,886148,543086,e=>{"use strict";let t,s;var a,r=e.i(290571),l=e.i(429427),i=e.i(371330),n=e.i(271645),o=e.i(394487),c=e.i(914189),d=e.i(144279),u=e.i(294316),m=e.i(83733);let h=(0,n.createContext)(()=>{});function p({value:e,children:t}){return n.default.createElement(h.Provider,{value:e},t)}e.s(["CloseProvider",()=>p],674175);var g=e.i(233137),f=e.i(233538),x=e.i(397701),y=e.i(402155),b=e.i(700020);let _=null!=(a=n.default.startTransition)?a:function(e){e()};var v=e.i(998348),j=((t=j||{})[t.Open=0]="Open",t[t.Closed=1]="Closed",t),w=((s=w||{})[s.ToggleDisclosure=0]="ToggleDisclosure",s[s.CloseDisclosure=1]="CloseDisclosure",s[s.SetButtonId=2]="SetButtonId",s[s.SetPanelId=3]="SetPanelId",s[s.SetButtonElement=4]="SetButtonElement",s[s.SetPanelElement=5]="SetPanelElement",s);let k={0:e=>({...e,disclosureState:(0,x.match)(e.disclosureState,{0:1,1:0})}),1:e=>1===e.disclosureState?e:{...e,disclosureState:1},2:(e,t)=>e.buttonId===t.buttonId?e:{...e,buttonId:t.buttonId},3:(e,t)=>e.panelId===t.panelId?e:{...e,panelId:t.panelId},4:(e,t)=>e.buttonElement===t.element?e:{...e,buttonElement:t.element},5:(e,t)=>e.panelElement===t.element?e:{...e,panelElement:t.element}},N=(0,n.createContext)(null);function S(e){let t=(0,n.useContext)(N);if(null===t){let t=Error(`<${e} /> is missing a parent component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,S),t}return t}N.displayName="DisclosureContext";let C=(0,n.createContext)(null);C.displayName="DisclosureAPIContext";let T=(0,n.createContext)(null);function E(e,t){return(0,x.match)(t.type,k,e,t)}T.displayName="DisclosurePanelContext";let I=n.Fragment,A=b.RenderFeatures.RenderStrategy|b.RenderFeatures.Static,O=Object.assign((0,b.forwardRefWithAs)(function(e,t){let{defaultOpen:s=!1,...a}=e,r=(0,n.useRef)(null),l=(0,u.useSyncRefs)(t,(0,u.optionalRef)(e=>{r.current=e},void 0===e.as||e.as===n.Fragment)),i=(0,n.useReducer)(E,{disclosureState:+!s,buttonElement:null,panelElement:null,buttonId:null,panelId:null}),[{disclosureState:o,buttonId:d},m]=i,h=(0,c.useEvent)(e=>{m({type:1});let t=(0,y.getOwnerDocument)(r);if(!t||!d)return;let s=e?e instanceof HTMLElement?e:e.current instanceof HTMLElement?e.current:t.getElementById(d):t.getElementById(d);null==s||s.focus()}),f=(0,n.useMemo)(()=>({close:h}),[h]),_=(0,n.useMemo)(()=>({open:0===o,close:h}),[o,h]),v=(0,b.useRender)();return n.default.createElement(N.Provider,{value:i},n.default.createElement(C.Provider,{value:f},n.default.createElement(p,{value:h},n.default.createElement(g.OpenClosedProvider,{value:(0,x.match)(o,{0:g.State.Open,1:g.State.Closed})},v({ourProps:{ref:l},theirProps:a,slot:_,defaultTag:I,name:"Disclosure"})))))}),{Button:(0,b.forwardRefWithAs)(function(e,t){let s=(0,n.useId)(),{id:a=`headlessui-disclosure-button-${s}`,disabled:r=!1,autoFocus:m=!1,...h}=e,[p,g]=S("Disclosure.Button"),x=(0,n.useContext)(T),y=null!==x&&x===p.panelId,_=(0,n.useRef)(null),j=(0,u.useSyncRefs)(_,t,(0,c.useEvent)(e=>{if(!y)return g({type:4,element:e})}));(0,n.useEffect)(()=>{if(!y)return g({type:2,buttonId:a}),()=>{g({type:2,buttonId:null})}},[a,g,y]);let w=(0,c.useEvent)(e=>{var t;if(y){if(1===p.disclosureState)return;switch(e.key){case v.Keys.Space:case v.Keys.Enter:e.preventDefault(),e.stopPropagation(),g({type:0}),null==(t=p.buttonElement)||t.focus()}}else switch(e.key){case v.Keys.Space:case v.Keys.Enter:e.preventDefault(),e.stopPropagation(),g({type:0})}}),k=(0,c.useEvent)(e=>{e.key===v.Keys.Space&&e.preventDefault()}),N=(0,c.useEvent)(e=>{var t;(0,f.isDisabledReactIssue7711)(e.currentTarget)||r||(y?(g({type:0}),null==(t=p.buttonElement)||t.focus()):g({type:0}))}),{isFocusVisible:C,focusProps:E}=(0,l.useFocusRing)({autoFocus:m}),{isHovered:I,hoverProps:A}=(0,i.useHover)({isDisabled:r}),{pressed:O,pressProps:L}=(0,o.useActivePress)({disabled:r}),M=(0,n.useMemo)(()=>({open:0===p.disclosureState,hover:I,active:O,disabled:r,focus:C,autofocus:m}),[p,I,O,C,r,m]),F=(0,d.useResolveButtonType)(e,p.buttonElement),R=y?(0,b.mergeProps)({ref:j,type:F,disabled:r||void 0,autoFocus:m,onKeyDown:w,onClick:N},E,A,L):(0,b.mergeProps)({ref:j,id:a,type:F,"aria-expanded":0===p.disclosureState,"aria-controls":p.panelElement?p.panelId:void 0,disabled:r||void 0,autoFocus:m,onKeyDown:w,onKeyUp:k,onClick:N},E,A,L);return(0,b.useRender)()({ourProps:R,theirProps:h,slot:M,defaultTag:"button",name:"Disclosure.Button"})}),Panel:(0,b.forwardRefWithAs)(function(e,t){let s=(0,n.useId)(),{id:a=`headlessui-disclosure-panel-${s}`,transition:r=!1,...l}=e,[i,o]=S("Disclosure.Panel"),{close:d}=function e(t){let s=(0,n.useContext)(C);if(null===s){let s=Error(`<${t} /> is missing a parent component.`);throw Error.captureStackTrace&&Error.captureStackTrace(s,e),s}return s}("Disclosure.Panel"),[h,p]=(0,n.useState)(null),f=(0,u.useSyncRefs)(t,(0,c.useEvent)(e=>{_(()=>o({type:5,element:e}))}),p);(0,n.useEffect)(()=>(o({type:3,panelId:a}),()=>{o({type:3,panelId:null})}),[a,o]);let x=(0,g.useOpenClosed)(),[y,v]=(0,m.useTransition)(r,h,null!==x?(x&g.State.Open)===g.State.Open:0===i.disclosureState),j=(0,n.useMemo)(()=>({open:0===i.disclosureState,close:d}),[i.disclosureState,d]),w={ref:f,id:a,...(0,m.transitionDataAttributes)(v)},k=(0,b.useRender)();return n.default.createElement(g.ResetOpenClosedProvider,null,n.default.createElement(T.Provider,{value:i.panelId},k({ourProps:w,theirProps:l,slot:j,defaultTag:"div",features:A,visible:y,name:"Disclosure.Panel"})))})});e.s(["Disclosure",()=>O],886148);let L=(0,n.createContext)(void 0);var M=e.i(444755);let F=(0,e.i(673706).makeClassName)("Accordion"),R=(0,n.createContext)({isOpen:!1}),P=n.default.forwardRef((e,t)=>{var s;let{defaultOpen:a=!1,children:l,className:i}=e,o=(0,r.__rest)(e,["defaultOpen","children","className"]),c=null!=(s=(0,n.useContext)(L))?s:(0,M.tremorTwMerge)("rounded-tremor-default border");return n.default.createElement(O,Object.assign({as:"div",ref:t,className:(0,M.tremorTwMerge)(F("root"),"overflow-hidden","bg-tremor-background border-tremor-border","dark:bg-dark-tremor-background dark:border-dark-tremor-border",c,i),defaultOpen:a},o),({open:e})=>n.default.createElement(R.Provider,{value:{isOpen:e}},l))});P.displayName="Accordion",e.s(["OpenContext",()=>R,"default",()=>P],543086),e.s(["Accordion",()=>P],677667)},898667,e=>{"use strict";var t=e.i(290571),s=e.i(271645),a=e.i(886148);let r=e=>{var a=(0,t.__rest)(e,[]);return s.default.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},a),s.default.createElement("path",{d:"M11.9999 10.8284L7.0502 15.7782L5.63599 14.364L11.9999 8L18.3639 14.364L16.9497 15.7782L11.9999 10.8284Z"}))};var l=e.i(543086),i=e.i(444755);let n=(0,e.i(673706).makeClassName)("AccordionHeader"),o=s.default.forwardRef((e,o)=>{let{children:c,className:d}=e,u=(0,t.__rest)(e,["children","className"]),{isOpen:m}=(0,s.useContext)(l.OpenContext);return s.default.createElement(a.Disclosure.Button,Object.assign({ref:o,className:(0,i.tremorTwMerge)(n("root"),"w-full flex items-center justify-between px-4 py-3","text-tremor-content-emphasis","dark:text-dark-tremor-content-emphasis",d)},u),s.default.createElement("div",{className:(0,i.tremorTwMerge)(n("children"),"flex flex-1 text-inherit mr-4")},c),s.default.createElement("div",null,s.default.createElement(r,{className:(0,i.tremorTwMerge)(n("arrowIcon"),"h-5 w-5 -mr-1","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle",m?"transition-all":"transition-all -rotate-180")})))});o.displayName="AccordionHeader",e.s(["AccordionHeader",()=>o],898667)},130643,e=>{"use strict";var t=e.i(290571),s=e.i(271645),a=e.i(886148),r=e.i(444755);let l=(0,e.i(673706).makeClassName)("AccordionBody"),i=s.default.forwardRef((e,i)=>{let{children:n,className:o}=e,c=(0,t.__rest)(e,["children","className"]);return s.default.createElement(a.Disclosure.Panel,Object.assign({ref:i,className:(0,r.tremorTwMerge)(l("root"),"w-full text-tremor-default px-4 pb-3","text-tremor-content","dark:text-dark-tremor-content",o)},c),n)});i.displayName="AccordionBody",e.s(["AccordionBody",()=>i],130643)},950724,(e,t,s)=>{t.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},100236,(e,t,s)=>{t.exports=e.g&&e.g.Object===Object&&e.g},139088,(e,t,s)=>{var a=e.r(100236),r="object"==typeof self&&self&&self.Object===Object&&self;t.exports=a||r||Function("return this")()},631926,(e,t,s)=>{var a=e.r(139088);t.exports=function(){return a.Date.now()}},748891,(e,t,s)=>{var a=/\s/;t.exports=function(e){for(var t=e.length;t--&&a.test(e.charAt(t)););return t}},830364,(e,t,s)=>{var a=e.r(748891),r=/^\s+/;t.exports=function(e){return e?e.slice(0,a(e)+1).replace(r,""):e}},630353,(e,t,s)=>{t.exports=e.r(139088).Symbol},243436,(e,t,s)=>{var a=e.r(630353),r=Object.prototype,l=r.hasOwnProperty,i=r.toString,n=a?a.toStringTag:void 0;t.exports=function(e){var t=l.call(e,n),s=e[n];try{e[n]=void 0;var a=!0}catch(e){}var r=i.call(e);return a&&(t?e[n]=s:delete e[n]),r}},223243,(e,t,s)=>{var a=Object.prototype.toString;t.exports=function(e){return a.call(e)}},377684,(e,t,s)=>{var a=e.r(630353),r=e.r(243436),l=e.r(223243),i=a?a.toStringTag:void 0;t.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":i&&i in Object(e)?r(e):l(e)}},877289,(e,t,s)=>{t.exports=function(e){return null!=e&&"object"==typeof e}},361884,(e,t,s)=>{var a=e.r(377684),r=e.r(877289);t.exports=function(e){return"symbol"==typeof e||r(e)&&"[object Symbol]"==a(e)}},773759,(e,t,s)=>{var a=e.r(830364),r=e.r(950724),l=e.r(361884),i=0/0,n=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,c=/^0o[0-7]+$/i,d=parseInt;t.exports=function(e){if("number"==typeof e)return e;if(l(e))return i;if(r(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=r(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=a(e);var s=o.test(e);return s||c.test(e)?d(e.slice(2),s?2:8):n.test(e)?i:+e}},374009,(e,t,s)=>{var a=e.r(950724),r=e.r(631926),l=e.r(773759),i=Math.max,n=Math.min;t.exports=function(e,t,s){var o,c,d,u,m,h,p=0,g=!1,f=!1,x=!0;if("function"!=typeof e)throw TypeError("Expected a function");function y(t){var s=o,a=c;return o=c=void 0,p=t,u=e.apply(a,s)}function b(e){var s=e-h,a=e-p;return void 0===h||s>=t||s<0||f&&a>=d}function _(){var e,s,a,l=r();if(b(l))return v(l);m=setTimeout(_,(e=l-h,s=l-p,a=t-e,f?n(a,d-s):a))}function v(e){return(m=void 0,x&&o)?y(e):(o=c=void 0,u)}function j(){var e,s=r(),a=b(s);if(o=arguments,c=this,h=s,a){if(void 0===m)return p=e=h,m=setTimeout(_,t),g?y(e):u;if(f)return clearTimeout(m),m=setTimeout(_,t),y(h)}return void 0===m&&(m=setTimeout(_,t)),u}return t=l(t)||0,a(s)&&(g=!!s.leading,d=(f="maxWait"in s)?i(l(s.maxWait)||0,t):d,x="trailing"in s?!!s.trailing:x),j.cancel=function(){void 0!==m&&clearTimeout(m),p=0,o=h=c=m=void 0},j.flush=function(){return void 0===m?u:v(r())},j}},964306,e=>{"use strict";var t=e.i(271645);let s=t.forwardRef(function(e,s){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:s},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 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,s],964306)},9314,263147,e=>{"use strict";var t=e.i(843476),s=e.i(199133),a=e.i(981339),r=e.i(645526),l=e.i(599724),i=e.i(266027),n=e.i(243652),o=e.i(764205),c=e.i(708347),d=e.i(135214);let u=(0,n.createQueryKeys)("accessGroups"),m=async e=>{let t=(0,o.getProxyBaseUrl)(),s=`${t}/v1/access_group`,a=await fetch(s,{method:"GET",headers:{[(0,o.getGlobalLitellmHeaderName)()]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!a.ok){let e=await a.json(),t=(0,o.deriveErrorMessage)(e);throw(0,o.handleError)(t),Error(t)}return a.json()},h=()=>{let{accessToken:e,userRole:t}=(0,d.default)();return(0,i.useQuery)({queryKey:u.list({}),queryFn:async()=>m(e),enabled:!!e&&c.all_admin_roles.includes(t||"")})};e.s(["accessGroupKeys",0,u,"useAccessGroups",0,h],263147),e.s(["default",0,({value:e,onChange:i,placeholder:n="Select access groups",disabled:o=!1,style:c,className:d,showLabel:u=!1,labelText:m="Access Group",allowClear:p=!0})=>{let{data:g,isLoading:f,isError:x}=h();if(f)return(0,t.jsxs)("div",{children:[u&&(0,t.jsxs)(l.Text,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,t.jsx)(r.TeamOutlined,{className:"mr-2"})," ",m]}),(0,t.jsx)(a.Skeleton.Input,{active:!0,block:!0,style:{height:32,...c}})]});let y=(g??[]).map(e=>({label:(0,t.jsxs)("span",{children:[(0,t.jsx)("span",{className:"font-medium",children:e.access_group_name})," ",(0,t.jsxs)("span",{className:"text-gray-400 text-xs",children:["(",e.access_group_id,")"]})]}),value:e.access_group_id,selectedLabel:e.access_group_name,searchText:`${e.access_group_name} ${e.access_group_id}`}));return(0,t.jsxs)("div",{children:[u&&(0,t.jsxs)(l.Text,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,t.jsx)(r.TeamOutlined,{className:"mr-2"})," ",m]}),(0,t.jsx)(s.Select,{mode:"multiple",value:e,placeholder:n,onChange:i,disabled:o,allowClear:p,showSearch:!0,style:{width:"100%",...c},className:`rounded-md ${d??""}`,notFoundContent:x?(0,t.jsx)("span",{className:"text-red-500",children:"Failed to load access groups"}):"No access groups found",filterOption:(e,t)=>(y.find(e=>e.value===t?.value)?.searchText??"").toLowerCase().includes(e.toLowerCase()),optionLabelProp:"selectedLabel",options:y.map(e=>({label:e.label,value:e.value,selectedLabel:e.selectedLabel}))})]})}],9314)},552130,e=>{"use strict";var t=e.i(843476),s=e.i(271645),a=e.i(199133),r=e.i(764205);e.s(["default",0,({onChange:e,value:l,className:i,accessToken:n,placeholder:o="Select agents",disabled:c=!1})=>{let[d,u]=(0,s.useState)([]),[m,h]=(0,s.useState)([]),[p,g]=(0,s.useState)(!1);(0,s.useEffect)(()=>{(async()=>{if(n){g(!0);try{let e=await (0,r.getAgentsList)(n),t=e?.agents||[];u(t);let s=new Set;t.forEach(e=>{let t=e.agent_access_groups;t&&Array.isArray(t)&&t.forEach(e=>s.add(e))}),h(Array.from(s))}catch(e){console.error("Error fetching agents:",e)}finally{g(!1)}}})()},[n]);let f=[...m.map(e=>({label:e,value:`group:${e}`,isAccessGroup:!0,searchText:`${e} Access Group`})),...d.map(e=>({label:`${e.agent_name||e.agent_id}`,value:e.agent_id,isAccessGroup:!1,searchText:`${e.agent_name||e.agent_id} ${e.agent_id} Agent`}))],x=[...l?.agents||[],...(l?.accessGroups||[]).map(e=>`group:${e}`)];return(0,t.jsx)("div",{children:(0,t.jsx)(a.Select,{mode:"multiple",placeholder:o,onChange:t=>{e({agents:t.filter(e=>!e.startsWith("group:")),accessGroups:t.filter(e=>e.startsWith("group:")).map(e=>e.replace("group:",""))})},value:x,loading:p,className:i,allowClear:!0,showSearch:!0,style:{width:"100%"},disabled:c,filterOption:(e,t)=>(f.find(e=>e.value===t?.value)?.searchText||"").toLowerCase().includes(e.toLowerCase()),children:f.map(e=>(0,t.jsx)(a.Select.Option,{value:e.value,label:e.label,children:(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[(0,t.jsx)("span",{style:{display:"inline-block",width:8,height:8,borderRadius:"50%",background:e.isAccessGroup?"#52c41a":"#722ed1",flexShrink:0}}),(0,t.jsx)("span",{style:{flex:1},children:e.label}),(0,t.jsx)("span",{style:{color:e.isAccessGroup?"#52c41a":"#722ed1",fontSize:"12px",fontWeight:500,opacity:.8},children:e.isAccessGroup?"Access Group":"Agent"})]})},e.value))})})}])},844565,e=>{"use strict";var t=e.i(843476),s=e.i(271645),a=e.i(199133),r=e.i(764205);e.s(["default",0,({onChange:e,value:l,className:i,accessToken:n,placeholder:o="Select pass through routes",disabled:c=!1,teamId:d})=>{let[u,m]=(0,s.useState)([]),[h,p]=(0,s.useState)(!1);return(0,s.useEffect)(()=>{(async()=>{if(n){p(!0);try{let e=await (0,r.getPassThroughEndpointsCall)(n,d);if(e.endpoints){let t=e.endpoints.flatMap(e=>{let t=e.path,s=e.methods;return s&&s.length>0?s.map(e=>({label:`${e} ${t}`,value:t})):[{label:t,value:t}]});m(t)}}catch(e){console.error("Error fetching pass through routes:",e)}finally{p(!1)}}})()},[n,d]),(0,t.jsx)(a.Select,{mode:"tags",placeholder:o,onChange:e,value:l,loading:h,className:i,allowClear:!0,options:u,optionFilterProp:"label",showSearch:!0,style:{width:"100%"},disabled:c})}])},810757,477386,e=>{"use strict";var t=e.i(271645);let s=t.forwardRef(function(e,s){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:s},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}))});e.s(["CogIcon",0,s],810757);let a=t.forwardRef(function(e,s){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:s},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M18.364 18.364A9 9 0 005.636 5.636m12.728 12.728A9 9 0 015.636 5.636m12.728 12.728L5.636 5.636"}))});e.s(["BanIcon",0,a],477386)},557662,e=>{"use strict";let t="../ui/assets/logos/",s=[{id:"arize",displayName:"Arize",logo:`${t}arize.png`,supports_key_team_logging:!0,dynamic_params:{arize_api_key:"password",arize_space_id:"password"},description:"Arize Logging Integration"},{id:"braintrust",displayName:"Braintrust",logo:`${t}braintrust.png`,supports_key_team_logging:!1,dynamic_params:{braintrust_api_key:"password",braintrust_project_name:"text"},description:"Braintrust Logging Integration"},{id:"custom_callback_api",displayName:"Custom Callback API",logo:`${t}custom.svg`,supports_key_team_logging:!0,dynamic_params:{custom_callback_api_url:"text",custom_callback_api_headers:"text"},description:"Custom Callback API Logging Integration"},{id:"datadog",displayName:"Datadog",logo:`${t}datadog.png`,supports_key_team_logging:!1,dynamic_params:{dd_api_key:"password",dd_site:"text"},description:"Datadog Logging Integration"},{id:"lago",displayName:"Lago",logo:`${t}lago.svg`,supports_key_team_logging:!1,dynamic_params:{lago_api_url:"text",lago_api_key:"password"},description:"Lago Billing Logging Integration"},{id:"langfuse",displayName:"Langfuse",logo:`${t}langfuse.png`,supports_key_team_logging:!0,dynamic_params:{langfuse_public_key:"text",langfuse_secret_key:"password",langfuse_host:"text"},description:"Langfuse v2 Logging Integration"},{id:"langfuse_otel",displayName:"Langfuse OTEL",logo:`${t}langfuse.png`,supports_key_team_logging:!0,dynamic_params:{langfuse_public_key:"text",langfuse_secret_key:"password",langfuse_host:"text"},description:"Langfuse v3 OTEL Logging Integration"},{id:"langsmith",displayName:"LangSmith",logo:`${t}langsmith.png`,supports_key_team_logging:!0,dynamic_params:{langsmith_api_key:"password",langsmith_project:"text",langsmith_base_url:"text",langsmith_sampling_rate:"number"},description:"Langsmith Logging Integration"},{id:"openmeter",displayName:"OpenMeter",logo:`${t}openmeter.png`,supports_key_team_logging:!1,dynamic_params:{openmeter_api_key:"password",openmeter_base_url:"text"},description:"OpenMeter Logging Integration"},{id:"otel",displayName:"Open Telemetry",logo:`${t}otel.png`,supports_key_team_logging:!1,dynamic_params:{otel_endpoint:"text",otel_headers:"text"},description:"OpenTelemetry Logging Integration"},{id:"s3",displayName:"S3",logo:`${t}aws.svg`,supports_key_team_logging:!1,dynamic_params:{s3_bucket_name:"text",aws_access_key_id:"password",aws_secret_access_key:"password",aws_region:"text"},description:"S3 Bucket (AWS) Logging Integration"},{id:"SQS",displayName:"SQS",logo:`${t}aws.svg`,supports_key_team_logging:!1,dynamic_params:{sqs_queue_url:"text",aws_access_key_id:"password",aws_secret_access_key:"password",aws_region:"text"},description:"SQS Queue (AWS) Logging Integration"}],a=s.reduce((e,t)=>(e[t.displayName]=t,e),{}),r=s.reduce((e,t)=>(e[t.displayName]=t.id,e),{}),l=s.reduce((e,t)=>(e[t.id]=t.displayName,e),{});e.s(["callbackInfo",0,a,"callback_map",0,r,"mapDisplayToInternalNames",0,e=>e.map(e=>r[e]||e),"mapInternalToDisplayNames",0,e=>e.map(e=>l[e]||e),"reverse_callback_map",0,l])},75921,e=>{"use strict";var t=e.i(843476),s=e.i(266027),a=e.i(243652),r=e.i(764205),l=e.i(135214);let i=(0,a.createQueryKeys)("mcpAccessGroups");var n=e.i(500727),o=e.i(199133);e.s(["default",0,({onChange:e,value:a,className:c,accessToken:d,placeholder:u="Select MCP servers",disabled:m=!1,teamId:h})=>{let{data:p=[],isLoading:g}=(0,n.useMCPServers)(h),{data:f=[],isLoading:x}=(()=>{let{accessToken:e}=(0,l.default)();return(0,s.useQuery)({queryKey:i.list({}),queryFn:async()=>await (0,r.fetchMCPAccessGroups)(e),enabled:!!e})})(),y=[...f.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=[...a?.servers||[],...a?.accessGroups||[]];return(0,t.jsx)("div",{children:(0,t.jsx)(o.Select,{mode:"multiple",placeholder:u,onChange:t=>{e({servers:t.filter(e=>!f.includes(e)),accessGroups:t.filter(e=>f.includes(e))})},value:b,loading:g||x,className:c,allowClear:!0,showSearch:!0,style:{width:"100%"},disabled:m,filterOption:(e,t)=>(y.find(e=>e.value===t?.value)?.searchText||"").toLowerCase().includes(e.toLowerCase()),children:y.map(e=>(0,t.jsx)(o.Select.Option,{value:e.value,label:e.label,children:(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[(0,t.jsx)("span",{style:{display:"inline-block",width:8,height:8,borderRadius:"50%",background:e.isAccessGroup?"#52c41a":"#1890ff",flexShrink:0}}),(0,t.jsx)("span",{style:{flex:1},children:e.label}),(0,t.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,e=>{"use strict";var t=e.i(843476),s=e.i(271645),a=e.i(764205),r=e.i(599724),l=e.i(482725),i=e.i(91739),n=e.i(500727),o=e.i(531516),c=e.i(696609);e.s(["default",0,({accessToken:e,selectedServers:d,toolPermissions:u,onChange:m,disabled:h=!1})=>{let{data:p=[]}=(0,n.useMCPServers)(),[g,f]=(0,s.useState)({}),[x,y]=(0,s.useState)({}),[b,_]=(0,s.useState)({}),[v,j]=(0,s.useState)({}),w=(0,s.useRef)(u);(0,s.useEffect)(()=>{w.current=u},[u]);let k=(0,s.useMemo)(()=>0===d.length?[]:p.filter(e=>d.includes(e.server_id)),[p,d]),N=async(e,t)=>{y(t=>({...t,[e]:!0})),_(t=>({...t,[e]:""}));try{let s=await (0,a.listMCPTools)(t,e);if(s.error)_(t=>({...t,[e]:s.message||"Failed to fetch tools"})),f(t=>({...t,[e]:[]}));else{let t=s.tools||[];f(s=>({...s,[e]:t}));let a=w.current;if(!a[e]&&t.length>0){let s=t.filter(e=>"delete"!==(0,c.classifyToolOp)(e.name,e.description||"")).map(e=>e.name);m({...a,[e]:s})}}}catch(t){console.error(`Error fetching tools for server ${e}:`,t),_(t=>({...t,[e]:"Failed to fetch tools"})),f(t=>({...t,[e]:[]}))}finally{y(t=>({...t,[e]:!1}))}};(0,s.useEffect)(()=>{k.forEach(t=>{g[t.server_id]||x[t.server_id]||N(t.server_id,e)})},[k,e]);let S=(e,t)=>{m({...u,[e]:t})};return 0===d.length?null:(0,t.jsx)("div",{className:"space-y-4",children:k.map(e=>{let s=e.server_name||e.alias||e.server_id,a=g[e.server_id]||[],n=u[e.server_id]||[],c=x[e.server_id],d=b[e.server_id],p=v[e.server_id]??"crud";return(0,t.jsxs)("div",{className:"border rounded-lg bg-gray-50",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between p-4 border-b bg-white rounded-t-lg",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(r.Text,{className:"font-semibold text-gray-900",children:s}),e.description&&(0,t.jsx)(r.Text,{className:"text-sm text-gray-500",children:e.description})]}),(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[!h&&a.length>0&&(0,t.jsx)(i.Radio.Group,{value:p,onChange:t=>j(s=>({...s,[e.server_id]:t.target.value})),size:"small",optionType:"button",buttonStyle:"solid",options:[{label:"Risk Groups",value:"crud"},{label:"Flat List",value:"flat"}]}),!h&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("button",{type:"button",className:"text-sm text-blue-600 hover:text-blue-700 font-medium",onClick:()=>{var t;let s;return s=g[t=e.server_id]||[],void m({...u,[t]:s.map(e=>e.name)})},disabled:c,children:"Select All"}),(0,t.jsx)("button",{type:"button",className:"text-sm text-blue-600 hover:text-blue-700 font-medium",onClick:()=>{var t;return t=e.server_id,void m({...u,[t]:[]})},disabled:c,children:"Deselect All"})]})]})]}),(0,t.jsxs)("div",{className:"p-4",children:[c&&(0,t.jsxs)("div",{className:"flex items-center justify-center py-8",children:[(0,t.jsx)(l.Spin,{size:"large"}),(0,t.jsx)(r.Text,{className:"ml-3 text-gray-500",children:"Loading tools..."})]}),d&&!c&&(0,t.jsxs)("div",{className:"p-4 bg-red-50 border border-red-200 rounded-lg text-center",children:[(0,t.jsx)(r.Text,{className:"text-red-600 font-medium",children:"Unable to load tools"}),(0,t.jsx)(r.Text,{className:"text-sm text-red-500 mt-1",children:d})]}),!c&&!d&&a.length>0&&"crud"===p&&(0,t.jsx)(o.default,{tools:a,value:u[e.server_id]?n:void 0,onChange:t=>S(e.server_id,t),readOnly:h}),!c&&!d&&a.length>0&&"flat"===p&&(0,t.jsx)("div",{className:"space-y-2",children:a.map(s=>{let a=n.includes(s.name);return(0,t.jsxs)("div",{className:"flex items-start gap-2",children:[(0,t.jsx)("input",{type:"checkbox",checked:a,onChange:()=>{if(h)return;let t=a?n.filter(e=>e!==s.name):[...n,s.name];S(e.server_id,t)},disabled:h,className:"mt-0.5"}),(0,t.jsx)("div",{className:"flex-1 min-w-0",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(r.Text,{className:"font-medium text-gray-900",children:s.name}),(0,t.jsxs)(r.Text,{className:"text-sm text-gray-500",children:["- ",s.description||"No description"]})]})})]},s.name)})}),!c&&!d&&0===a.length&&(0,t.jsx)("div",{className:"text-center py-6",children:(0,t.jsx)(r.Text,{className:"text-gray-500",children:"No tools available"})})]})]},e.server_id)})})}])},266484,e=>{"use strict";var t=e.i(843476),s=e.i(199133),a=e.i(592968),r=e.i(312361),l=e.i(827252),i=e.i(994388),n=e.i(304967),o=e.i(779241),c=e.i(988297),d=e.i(68155),u=e.i(810757),m=e.i(477386),h=e.i(557662),p=e.i(435451);let{Option:g}=s.Select;e.s(["default",0,({value:e=[],onChange:f,disabledCallbacks:x=[],onDisabledCallbacksChange:y})=>{let b=Object.entries(h.callbackInfo).filter(([e,t])=>t.supports_key_team_logging).map(([e,t])=>e),_=Object.keys(h.callbackInfo),v=e=>{f?.(e)},j=(t,s,a)=>{let r=[...e];if("callback_name"===s){let e=h.callback_map[a]||a;r[t]={...r[t],[s]:e,callback_vars:{}}}else r[t]={...r[t],[s]:a};v(r)},w=(t,s,a)=>{let r=[...e];r[t]={...r[t],callback_vars:{...r[t].callback_vars,[s]:a}},v(r)};return(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)(m.BanIcon,{className:"w-5 h-5 text-red-500"}),(0,t.jsx)("span",{className:"text-base font-semibold text-gray-800",children:"Disabled Callbacks"}),(0,t.jsx)(a.Tooltip,{title:"Select callbacks to disable for this key. Disabled callbacks will not receive any logging data.",children:(0,t.jsx)(l.InfoCircleOutlined,{className:"text-gray-400 cursor-help"})})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Disabled Callbacks"}),(0,t.jsx)(s.Select,{mode:"multiple",placeholder:"Select callbacks to disable",value:x,onChange:e=>{let t=(0,h.mapDisplayToInternalNames)(e);y?.(t)},style:{width:"100%"},optionLabelProp:"label",children:_.map(e=>{let s=h.callbackInfo[e]?.logo,r=h.callbackInfo[e]?.description;return(0,t.jsx)(g,{value:e,label:e,children:(0,t.jsx)(a.Tooltip,{title:r,placement:"right",children:(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[s&&(0,t.jsx)("img",{src:s,alt:e,className:"w-4 h-4 object-contain",onError:t=>{let s=t.target,a=s.parentElement;if(a){let t=document.createElement("div");t.className="w-4 h-4 rounded-full bg-gray-200 flex items-center justify-center text-xs",t.textContent=e.charAt(0),a.replaceChild(t,s)}}}),(0,t.jsx)("span",{children:e})]})})},e)})}),(0,t.jsx)("div",{className:"text-xs text-gray-500",children:"Select callbacks that should be disabled for this key. These callbacks will not receive any logging data."})]})]}),(0,t.jsx)(r.Divider,{}),(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)(u.CogIcon,{className:"w-5 h-5 text-blue-500"}),(0,t.jsx)("span",{className:"text-base font-semibold text-gray-800",children:"Logging Integrations"}),(0,t.jsx)(a.Tooltip,{title:"Configure callback logging integrations for this team.",children:(0,t.jsx)(l.InfoCircleOutlined,{className:"text-gray-400 cursor-help"})})]}),(0,t.jsx)(i.Button,{variant:"secondary",onClick:()=>{v([...e,{callback_name:"",callback_type:"success",callback_vars:{}}])},icon:c.PlusIcon,size:"sm",className:"hover:border-blue-400 hover:text-blue-500",type:"button",children:"Add Integration"})]}),(0,t.jsx)("div",{className:"space-y-4",children:e.map((r,c)=>{let u=r.callback_name?Object.entries(h.callback_map).find(([e,t])=>t===r.callback_name)?.[0]:void 0,m=u?h.callbackInfo[u]?.logo:null;return(0,t.jsxs)(n.Card,{className:"border border-gray-200 shadow-sm hover:shadow-md transition-shadow duration-200",decoration:"top",decorationColor:"blue",children:[(0,t.jsxs)("div",{className:"flex justify-between items-start mb-4",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[m&&(0,t.jsx)("img",{src:m,alt:u,className:"w-5 h-5 object-contain"}),(0,t.jsxs)("span",{className:"text-sm font-medium",children:[u||"New Integration"," Configuration"]})]}),(0,t.jsx)(i.Button,{variant:"light",onClick:()=>{v(e.filter((e,t)=>t!==c))},icon:d.TrashIcon,size:"xs",color:"red",className:"hover:bg-red-50",type:"button",children:"Remove"})]}),(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Integration Type"}),(0,t.jsx)(s.Select,{value:u,placeholder:"Select integration",onChange:e=>j(c,"callback_name",e),className:"w-full",optionLabelProp:"label",children:b.map(e=>{let s=h.callbackInfo[e]?.logo,r=h.callbackInfo[e]?.description;return(0,t.jsx)(g,{value:e,label:e,children:(0,t.jsx)(a.Tooltip,{title:r,placement:"right",children:(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[s&&(0,t.jsx)("img",{src:s,alt:e,className:"w-4 h-4 object-contain",onError:t=>{let s=t.target,a=s.parentElement;if(a){let t=document.createElement("div");t.className="w-4 h-4 rounded-full bg-gray-200 flex items-center justify-center text-xs",t.textContent=e.charAt(0),a.replaceChild(t,s)}}}),(0,t.jsx)("span",{children:e})]})})},e)})})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Event Type"}),(0,t.jsxs)(s.Select,{value:r.callback_type,onChange:e=>j(c,"callback_type",e),className:"w-full",children:[(0,t.jsx)(g,{value:"success",children:(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),(0,t.jsx)("span",{children:"Success Only"})]})}),(0,t.jsx)(g,{value:"failure",children:(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)("div",{className:"w-2 h-2 bg-red-500 rounded-full"}),(0,t.jsx)("span",{children:"Failure Only"})]})}),(0,t.jsx)(g,{value:"success_and_failure",children:(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)("div",{className:"w-2 h-2 bg-blue-500 rounded-full"}),(0,t.jsx)("span",{children:"Success & Failure"})]})})]})]})]}),((e,s)=>{if(!e.callback_name)return null;let r=Object.entries(h.callback_map).find(([t,s])=>s===e.callback_name)?.[0];if(!r)return null;let i=h.callbackInfo[r]?.dynamic_params||{};return 0===Object.keys(i).length?null:(0,t.jsxs)("div",{className:"mt-6 pt-4 border-t border-gray-100",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2 mb-4",children:[(0,t.jsx)("div",{className:"w-3 h-3 bg-blue-100 rounded-full flex items-center justify-center",children:(0,t.jsx)("div",{className:"w-1.5 h-1.5 bg-blue-500 rounded-full"})}),(0,t.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Integration Parameters"})]}),(0,t.jsx)("div",{className:"grid grid-cols-1 gap-4",children:Object.entries(i).map(([r,i])=>(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("label",{className:"text-sm font-medium text-gray-700 capitalize flex items-center space-x-1",children:[(0,t.jsx)("span",{children:r.replace(/_/g," ")}),(0,t.jsx)(a.Tooltip,{title:`Environment variable reference recommended: os.environ/${r.toUpperCase()}`,children:(0,t.jsx)(l.InfoCircleOutlined,{className:"text-gray-400 cursor-help text-xs"})}),"password"===i&&(0,t.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-yellow-100 text-yellow-800",children:"Sensitive"}),"number"===i&&(0,t.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-yellow-100 text-yellow-800",children:"Number"})]}),"number"===i&&(0,t.jsx)("span",{className:"text-xs text-gray-500",children:"Value must be between 0 and 1"}),"number"===i?(0,t.jsx)(p.default,{step:.01,width:400,placeholder:`os.environ/${r.toUpperCase()}`,value:e.callback_vars[r]||"",onChange:e=>w(s,r,e.target.value)}):(0,t.jsx)(o.TextInput,{type:"password"===i?"password":"text",placeholder:`os.environ/${r.toUpperCase()}`,value:e.callback_vars[r]||"",onChange:e=>w(s,r,e.target.value)})]},r))})]})})(r,c)]})]},c)})}),0===e.length&&(0,t.jsxs)("div",{className:"text-center py-12 text-gray-500 border-2 border-dashed border-gray-200 rounded-lg bg-gray-50/50",children:[(0,t.jsx)(u.CogIcon,{className:"w-12 h-12 text-gray-300 mb-3 mx-auto"}),(0,t.jsx)("div",{className:"text-base font-medium mb-1",children:"No logging integrations configured"}),(0,t.jsx)("div",{className:"text-sm text-gray-400",children:'Click "Add Integration" to configure logging for this team'})]})]})}])},207082,e=>{"use strict";var t=e.i(619273),s=e.i(266027),a=e.i(243652),r=e.i(764205),l=e.i(135214);let i=(0,a.createQueryKeys)("keys"),n=async(e,t,s,a={})=>{try{let l=(0,r.getProxyBaseUrl)(),i=new URLSearchParams(Object.entries({team_id:a.teamID,project_id:a.projectID,organization_id:a.organizationID,key_alias:a.selectedKeyAlias,key_hash:a.keyHash,user_id:a.userID,page:t,size:s,sort_by:a.sortBy,sort_order:a.sortOrder,expand:a.expand,status:a.status,return_full_object:"true",include_team_keys:"true",include_created_by_keys:"true"}).filter(([,e])=>null!=e).map(([e,t])=>[e,String(t)])),n=`${l?`${l}/key/list`:"/key/list"}?${i}`,o=await fetch(n,{method:"GET",headers:{[(0,r.getGlobalLitellmHeaderName)()]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!o.ok){let e=await o.json(),t=(0,r.deriveErrorMessage)(e);throw(0,r.handleError)(t),Error(t)}let c=await o.json();return console.log("/key/list API Response:",c),c}catch(e){throw console.error("Failed to list keys:",e),e}},o=(0,a.createQueryKeys)("deletedKeys");e.s(["keyKeys",0,i,"useDeletedKeys",0,(e,a,r={})=>{let{accessToken:i}=(0,l.default)();return(0,s.useQuery)({queryKey:o.list({page:e,limit:a,...r}),queryFn:async()=>await n(i,e,a,{...r,status:"deleted"}),enabled:!!i,staleTime:3e4,placeholderData:t.keepPreviousData})},"useKeys",0,(e,a,r={})=>{let{accessToken:o}=(0,l.default)();return(0,s.useQuery)({queryKey:i.list({page:e,limit:a,...r}),queryFn:async()=>await n(o,e,a,r),enabled:!!o,staleTime:3e4,placeholderData:t.keepPreviousData})}])},510674,e=>{"use strict";var t=e.i(266027),s=e.i(243652),a=e.i(764205),r=e.i(708347),l=e.i(135214);let i=(0,s.createQueryKeys)("projects"),n=async e=>{let t=(0,a.getProxyBaseUrl)(),s=`${t}/project/list`,r=await fetch(s,{method:"GET",headers:{[(0,a.getGlobalLitellmHeaderName)()]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!r.ok){let e=await r.json(),t=(0,a.deriveErrorMessage)(e);throw(0,a.handleError)(t),Error(t)}return r.json()};e.s(["projectKeys",0,i,"useProjects",0,()=>{let{accessToken:e,userRole:s}=(0,l.default)();return(0,t.useQuery)({queryKey:i.list({}),queryFn:async()=>n(e),enabled:!!e&&r.all_admin_roles.includes(s||"")})}])},392110,e=>{"use strict";var t=e.i(843476),s=e.i(271645),a=e.i(199133),r=e.i(592968),l=e.i(312361),i=e.i(790848),n=e.i(536916),o=e.i(827252),c=e.i(779241);let{Option:d}=a.Select;e.s(["default",0,({form:e,autoRotationEnabled:u,onAutoRotationChange:m,rotationInterval:h,onRotationIntervalChange:p,isCreateMode:g=!1,neverExpire:f=!1,onNeverExpireChange:x})=>{let y=h&&!["7d","30d","90d","180d","365d"].includes(h),[b,_]=(0,s.useState)(y),[v,j]=(0,s.useState)(y?h:""),[w,k]=(0,s.useState)(e?.getFieldValue?.("duration")||"");return(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Key Expiry Settings"}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("label",{className:"text-sm font-medium text-gray-700 flex items-center space-x-1",children:[(0,t.jsx)("span",{children:"Expire Key"}),(0,t.jsx)(r.Tooltip,{title:"Set when this key should expire. Format: 30s (seconds), 30m (minutes), 30h (hours), 30d (days). Leave empty to keep the current expiry unchanged.",children:(0,t.jsx)(o.InfoCircleOutlined,{className:"text-gray-400 cursor-help text-xs"})}),!g&&x&&(0,t.jsx)(n.Checkbox,{checked:f,onChange:t=>{let s=t.target.checked;x(s),s&&(k(""),e&&"function"==typeof e.setFieldValue?e.setFieldValue("duration",""):e&&"function"==typeof e.setFieldsValue&&e.setFieldsValue({duration:""}))},className:"ml-2 text-sm font-normal text-gray-600",children:"Never Expire"})]}),(0,t.jsx)(c.TextInput,{name:"duration",placeholder:g?"e.g., 30d or leave empty to never expire":"e.g., 30d",className:"w-full",value:w,onValueChange:t=>{k(t),e&&"function"==typeof e.setFieldValue?e.setFieldValue("duration",t):e&&"function"==typeof e.setFieldsValue&&e.setFieldsValue({duration:t})},disabled:!g&&f})]})]}),(0,t.jsx)(l.Divider,{}),(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Auto-Rotation Settings"}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("label",{className:"text-sm font-medium text-gray-700 flex items-center space-x-1",children:[(0,t.jsx)("span",{children:"Enable Auto-Rotation"}),(0,t.jsx)(r.Tooltip,{title:"Key will automatically regenerate at the specified interval for enhanced security.",children:(0,t.jsx)(o.InfoCircleOutlined,{className:"text-gray-400 cursor-help text-xs"})})]}),(0,t.jsx)(i.Switch,{checked:u,onChange:m,size:"default",className:u?"":"bg-gray-400"})]}),u&&(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("label",{className:"text-sm font-medium text-gray-700 flex items-center space-x-1",children:[(0,t.jsx)("span",{children:"Rotation Interval"}),(0,t.jsx)(r.Tooltip,{title:"How often the key should be automatically rotated. Choose the interval that best fits your security requirements.",children:(0,t.jsx)(o.InfoCircleOutlined,{className:"text-gray-400 cursor-help text-xs"})})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)(a.Select,{value:b?"custom":h,onChange:e=>{"custom"===e?_(!0):(_(!1),j(""),p(e))},className:"w-full",placeholder:"Select interval",children:[(0,t.jsx)(d,{value:"7d",children:"7 days"}),(0,t.jsx)(d,{value:"30d",children:"30 days"}),(0,t.jsx)(d,{value:"90d",children:"90 days"}),(0,t.jsx)(d,{value:"180d",children:"180 days"}),(0,t.jsx)(d,{value:"365d",children:"365 days"}),(0,t.jsx)(d,{value:"custom",children:"Custom interval"})]}),b&&(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)(c.TextInput,{value:v,onChange:e=>{let t=e.target.value;j(t),p(t)},placeholder:"e.g., 1s, 5m, 2h, 14d"}),(0,t.jsx)("div",{className:"text-xs text-gray-500",children:"Supported formats: seconds (s), minutes (m), hours (h), days (d)"})]})]})]})]}),u&&(0,t.jsx)("div",{className:"bg-blue-50 p-3 rounded-md text-sm text-blue-700",children:"When rotation occurs, you'll receive a notification with the new key. The old key will be deactivated after a brief grace period."})]})]})}])},939510,e=>{"use strict";var t=e.i(843476),s=e.i(808613),a=e.i(199133),r=e.i(592968),l=e.i(827252);let{Option:i}=a.Select;e.s(["default",0,({type:e,name:n,showDetailedDescriptions:o=!0,className:c="",initialValue:d=null,form:u,onChange:m})=>{let h=e.toUpperCase(),p=e.toLowerCase(),g=`Select 'guaranteed_throughput' to prevent overallocating ${h} limit when the key belongs to a Team with specific ${h} limits.`;return(0,t.jsx)(s.Form.Item,{label:(0,t.jsxs)("span",{children:[h," Rate Limit Type"," ",(0,t.jsx)(r.Tooltip,{title:g,children:(0,t.jsx)(l.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:n,initialValue:d,className:c,children:(0,t.jsx)(a.Select,{defaultValue:o?"default":void 0,placeholder:"Select rate limit type",style:{width:"100%"},optionLabelProp:o?"label":void 0,onChange:e=>{u&&u.setFieldValue(n,e),m&&m(e)},children:o?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(i,{value:"best_effort_throughput",label:"Default",children:(0,t.jsxs)("div",{style:{padding:"4px 0"},children:[(0,t.jsx)("div",{style:{fontWeight:500},children:"Default"}),(0,t.jsxs)("div",{style:{fontSize:"11px",color:"#6b7280",marginTop:"2px"},children:["Best effort throughput - no error if we're overallocating ",p," (Team/Key Limits checked at runtime)."]})]})}),(0,t.jsx)(i,{value:"guaranteed_throughput",label:"Guaranteed throughput",children:(0,t.jsxs)("div",{style:{padding:"4px 0"},children:[(0,t.jsx)("div",{style:{fontWeight:500},children:"Guaranteed throughput"}),(0,t.jsxs)("div",{style:{fontSize:"11px",color:"#6b7280",marginTop:"2px"},children:["Guaranteed throughput - raise an error if we're overallocating ",p," (also checks model-specific limits)"]})]})}),(0,t.jsx)(i,{value:"dynamic",label:"Dynamic",children:(0,t.jsxs)("div",{style:{padding:"4px 0"},children:[(0,t.jsx)("div",{style:{fontWeight:500},children:"Dynamic"}),(0,t.jsxs)("div",{style:{fontSize:"11px",color:"#6b7280",marginTop:"2px"},children:["If the key has a set ",h," (e.g. 2 ",h,") and there are no 429 errors, it can dynamically exceed the limit when the model being called is not erroring."]})]})})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(i,{value:"best_effort_throughput",children:"Best effort throughput"}),(0,t.jsx)(i,{value:"guaranteed_throughput",children:"Guaranteed throughput"}),(0,t.jsx)(i,{value:"dynamic",children:"Dynamic"})]})})})}])},533882,e=>{"use strict";var t=e.i(843476),s=e.i(271645),a=e.i(250980),r=e.i(797672),l=e.i(68155),i=e.i(304967),n=e.i(629569),o=e.i(599724),c=e.i(269200),d=e.i(427612),u=e.i(64848),m=e.i(942232),h=e.i(496020),p=e.i(977572),g=e.i(992619),f=e.i(727749);e.s(["default",0,({accessToken:e,initialModelAliases:x={},onAliasUpdate:y,showExampleConfig:b=!0})=>{let[_,v]=(0,s.useState)([]),[j,w]=(0,s.useState)({aliasName:"",targetModel:""}),[k,N]=(0,s.useState)(null);(0,s.useEffect)(()=>{v(Object.entries(x).map(([e,t],s)=>({id:`${s}-${e}`,aliasName:e,targetModel:t})))},[x]);let S=()=>{if(!k)return;if(!k.aliasName||!k.targetModel)return void f.default.fromBackend("Please provide both alias name and target model");if(_.some(e=>e.id!==k.id&&e.aliasName===k.aliasName))return void f.default.fromBackend("An alias with this name already exists");let e=_.map(e=>e.id===k.id?k:e);v(e),N(null);let t={};e.forEach(e=>{t[e.aliasName]=e.targetModel}),y&&y(t),f.default.success("Alias updated successfully")},C=()=>{N(null)},T=_.reduce((e,t)=>(e[t.aliasName]=t.targetModel,e),{});return(0,t.jsxs)("div",{className:"mt-4",children:[(0,t.jsxs)("div",{className:"mb-6",children:[(0,t.jsx)(o.Text,{className:"text-sm font-medium text-gray-700 mb-2",children:"Add New Alias"}),(0,t.jsxs)("div",{className:"grid grid-cols-3 gap-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-xs text-gray-500 mb-1",children:"Alias Name"}),(0,t.jsx)("input",{type:"text",value:j.aliasName,onChange:e=>w({...j,aliasName:e.target.value}),placeholder:"e.g., gpt-4o",className:"w-full px-3 py-2 border border-gray-300 rounded-md text-sm"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-xs text-gray-500 mb-1",children:"Target Model"}),(0,t.jsx)(g.default,{accessToken:e,value:j.targetModel,placeholder:"Select target model",onChange:e=>w({...j,targetModel:e}),showLabel:!1})]}),(0,t.jsx)("div",{className:"flex items-end",children:(0,t.jsxs)("button",{onClick:()=>{if(!j.aliasName||!j.targetModel)return void f.default.fromBackend("Please provide both alias name and target model");if(_.some(e=>e.aliasName===j.aliasName))return void f.default.fromBackend("An alias with this name already exists");let e=[..._,{id:`${Date.now()}-${j.aliasName}`,aliasName:j.aliasName,targetModel:j.targetModel}];v(e),w({aliasName:"",targetModel:""});let t={};e.forEach(e=>{t[e.aliasName]=e.targetModel}),y&&y(t),f.default.success("Alias added successfully")},disabled:!j.aliasName||!j.targetModel,className:`flex items-center px-4 py-2 rounded-md text-sm ${!j.aliasName||!j.targetModel?"bg-gray-300 text-gray-500 cursor-not-allowed":"bg-green-600 text-white hover:bg-green-700"}`,children:[(0,t.jsx)(a.PlusCircleIcon,{className:"w-4 h-4 mr-1"}),"Add Alias"]})})]})]}),(0,t.jsx)(o.Text,{className:"text-sm font-medium text-gray-700 mb-2",children:"Manage Existing Aliases"}),(0,t.jsx)("div",{className:"rounded-lg custom-border relative mb-6",children:(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)(c.Table,{className:"[&_td]:py-0.5 [&_th]:py-1",children:[(0,t.jsx)(d.TableHead,{children:(0,t.jsxs)(h.TableRow,{children:[(0,t.jsx)(u.TableHeaderCell,{className:"py-1 h-8",children:"Alias Name"}),(0,t.jsx)(u.TableHeaderCell,{className:"py-1 h-8",children:"Target Model"}),(0,t.jsx)(u.TableHeaderCell,{className:"py-1 h-8",children:"Actions"})]})}),(0,t.jsxs)(m.TableBody,{children:[_.map(s=>(0,t.jsx)(h.TableRow,{className:"h-8",children:k&&k.id===s.id?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(p.TableCell,{className:"py-0.5",children:(0,t.jsx)("input",{type:"text",value:k.aliasName,onChange:e=>N({...k,aliasName:e.target.value}),className:"w-full px-2 py-1 border border-gray-300 rounded-md text-sm"})}),(0,t.jsx)(p.TableCell,{className:"py-0.5",children:(0,t.jsx)(g.default,{accessToken:e,value:k.targetModel,onChange:e=>N({...k,targetModel:e}),showLabel:!1,style:{height:"32px"}})}),(0,t.jsx)(p.TableCell,{className:"py-0.5 whitespace-nowrap",children:(0,t.jsxs)("div",{className:"flex space-x-2",children:[(0,t.jsx)("button",{onClick:S,className:"text-xs bg-blue-50 text-blue-600 px-2 py-1 rounded hover:bg-blue-100",children:"Save"}),(0,t.jsx)("button",{onClick:C,className:"text-xs bg-gray-50 text-gray-600 px-2 py-1 rounded hover:bg-gray-100",children:"Cancel"})]})})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(p.TableCell,{className:"py-0.5 text-sm text-gray-900",children:s.aliasName}),(0,t.jsx)(p.TableCell,{className:"py-0.5 text-sm text-gray-500",children:s.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:()=>{N({...s})},className:"text-xs bg-blue-50 text-blue-600 px-2 py-1 rounded hover:bg-blue-100",children:(0,t.jsx)(r.PencilIcon,{className:"w-3 h-3"})}),(0,t.jsx)("button",{onClick:()=>{var e;let t,a;return e=s.id,v(t=_.filter(t=>t.id!==e)),a={},void(t.forEach(e=>{a[e.aliasName]=e.targetModel}),y&&y(a),f.default.success("Alias deleted successfully"))},className:"text-xs bg-red-50 text-red-600 px-2 py-1 rounded hover:bg-red-100",children:(0,t.jsx)(l.TrashIcon,{className:"w-3 h-3"})})]})})]})},s.id)),0===_.length&&(0,t.jsx)(h.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(T).length?(0,t.jsxs)("span",{className:"text-gray-500",children:[(0,t.jsx)("br",{}),"  # No aliases configured yet"]}):Object.entries(T).map(([e,s])=>(0,t.jsxs)("span",{children:[(0,t.jsx)("br",{}),'  "',e,'": "',s,'"']},e))]})})]})]})}])},651904,e=>{"use strict";var t=e.i(843476),s=e.i(599724),a=e.i(266484);e.s(["default",0,function({value:e,onChange:r,premiumUser:l=!1,disabledCallbacks:i=[],onDisabledCallbacksChange:n}){return l?(0,t.jsx)(a.default,{value:e,onChange:r,disabledCallbacks:i,onDisabledCallbacksChange:n}):(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex flex-wrap gap-2 mb-3",children:[(0,t.jsx)("div",{className:"inline-flex items-center px-3 py-1.5 rounded-lg bg-green-50 border border-green-200 text-green-800 text-sm font-medium opacity-50",children:"✨ langfuse-logging"}),(0,t.jsx)("div",{className:"inline-flex items-center px-3 py-1.5 rounded-lg bg-green-50 border border-green-200 text-green-800 text-sm font-medium opacity-50",children:"✨ datadog-logging"})]}),(0,t.jsx)("div",{className:"p-3 bg-yellow-50 border border-yellow-200 rounded-lg",children:(0,t.jsxs)(s.Text,{className:"text-sm text-yellow-800",children:["Setting Key/Team logging settings is a LiteLLM Enterprise feature. Global Logging Settings are available for all free users. Get a trial key"," ",(0,t.jsx)("a",{href:"https://www.litellm.ai/#pricing",target:"_blank",rel:"noopener noreferrer",className:"underline",children:"here"}),"."]})})]})}])},460285,575260,e=>{"use strict";var t=e.i(843476),s=e.i(271645),a=e.i(404206),r=e.i(723731),l=e.i(653824),i=e.i(881073),n=e.i(197647),o=e.i(764205),c=e.i(158392),d=e.i(419470),u=e.i(689020);let m=(0,s.forwardRef)(({accessToken:e,value:m,onChange:h,modelData:p},g)=>{let[f,x]=(0,s.useState)({routerSettings:{},selectedStrategy:null,enableTagFiltering:!1}),[y,b]=(0,s.useState)([]),[_,v]=(0,s.useState)([]),[j,w]=(0,s.useState)([]),[k,N]=(0,s.useState)([]),[S,C]=(0,s.useState)({}),[T,E]=(0,s.useState)({}),I=(0,s.useRef)(!1),A=(0,s.useRef)(null);(0,s.useEffect)(()=>{let e=m?.router_settings?JSON.stringify({routing_strategy:m.router_settings.routing_strategy,fallbacks:m.router_settings.fallbacks,enable_tag_filtering:m.router_settings.enable_tag_filtering}):null;if(I.current&&e===A.current){I.current=!1;return}if(I.current&&e!==A.current&&(I.current=!1),e!==A.current)if(A.current=e,m?.router_settings){let e=m.router_settings,{fallbacks:t,...s}=e;x({routerSettings:s,selectedStrategy:e.routing_strategy||null,enableTagFiltering:e.enable_tag_filtering??!1});let a=e.fallbacks||[];b(a),v(a&&0!==a.length?a.map((e,t)=>{let[s,a]=Object.entries(e)[0];return{id:(t+1).toString(),primaryModel:s||null,fallbackModels:a||[]}}):[{id:"1",primaryModel:null,fallbackModels:[]}])}else x({routerSettings:{},selectedStrategy:null,enableTagFiltering:!1}),b([]),v([{id:"1",primaryModel:null,fallbackModels:[]}])},[m]),(0,s.useEffect)(()=>{e&&(0,o.getRouterSettingsCall)(e).then(e=>{if(e.fields){let t={};e.fields.forEach(e=>{t[e.field_name]={ui_field_name:e.ui_field_name,field_description:e.field_description,options:e.options,link:e.link}}),C(t);let s=e.fields.find(e=>"routing_strategy"===e.field_name);s?.options&&N(s.options),e.routing_strategy_descriptions&&E(e.routing_strategy_descriptions)}})},[e]),(0,s.useEffect)(()=>{e&&(async()=>{try{let t=await (0,u.fetchAvailableModels)(e);w(t)}catch(e){console.error("Error fetching model info for fallbacks:",e)}})()},[e]);let O=()=>{let e=new Set(["allowed_fails","cooldown_time","num_retries","timeout","retry_after"]),t=new Set(["model_group_alias","retry_policy"]),s=Object.fromEntries(Object.entries({...f.routerSettings,enable_tag_filtering:f.enableTagFiltering,routing_strategy:f.selectedStrategy,fallbacks:y.length>0?y:null}).map(([s,a])=>{if("routing_strategy_args"!==s&&"routing_strategy"!==s&&"enable_tag_filtering"!==s&&"fallbacks"!==s){let r=document.querySelector(`input[name="${s}"]`);if(r&&void 0!==r.value&&""!==r.value){let l=((s,a,r)=>{if(null==a)return r;let l=String(a).trim();if(""===l||"null"===l.toLowerCase())return null;if(e.has(s)){let e=Number(l);return Number.isNaN(e)?r:e}if(t.has(s)){if(""===l)return null;try{return JSON.parse(l)}catch{return r}}return"true"===l.toLowerCase()||"false"!==l.toLowerCase()&&l})(s,r.value,a);return[s,l]}}else if("routing_strategy"===s)return[s,f.selectedStrategy];else if("enable_tag_filtering"===s)return[s,f.enableTagFiltering];else if("fallbacks"===s)return[s,y.length>0?y:null];else if("routing_strategy_args"===s&&"latency-based-routing"===f.selectedStrategy){let e=document.querySelector('input[name="lowest_latency_buffer"]'),t=document.querySelector('input[name="ttl"]'),s={};return e?.value&&(s.lowest_latency_buffer=Number(e.value)),t?.value&&(s.ttl=Number(t.value)),["routing_strategy_args",Object.keys(s).length>0?s:null]}return[s,a]}).filter(e=>null!=e)),a=(e,t=!1)=>null==e||"object"==typeof e&&!Array.isArray(e)&&0===Object.keys(e).length||t&&("number"!=typeof e||Number.isNaN(e))?null:e;return{routing_strategy:a(s.routing_strategy),allowed_fails:a(s.allowed_fails,!0),cooldown_time:a(s.cooldown_time,!0),num_retries:a(s.num_retries,!0),timeout:a(s.timeout,!0),retry_after:a(s.retry_after,!0),fallbacks:y.length>0?y:null,context_window_fallbacks:a(s.context_window_fallbacks),retry_policy:a(s.retry_policy),model_group_alias:a(s.model_group_alias),enable_tag_filtering:f.enableTagFiltering,routing_strategy_args:a(s.routing_strategy_args)}};(0,s.useEffect)(()=>{if(!h)return;let e=setTimeout(()=>{I.current=!0,h({router_settings:O()})},100);return()=>clearTimeout(e)},[f,y]);let L=Array.from(new Set(j.map(e=>e.model_group))).sort();return((0,s.useImperativeHandle)(g,()=>({getValue:()=>({router_settings:O()})})),e)?(0,t.jsx)("div",{className:"w-full",children:(0,t.jsxs)(l.TabGroup,{className:"w-full",children:[(0,t.jsxs)(i.TabList,{variant:"line",defaultValue:"1",className:"px-8 pt-4",children:[(0,t.jsx)(n.Tab,{value:"1",children:"Loadbalancing"}),(0,t.jsx)(n.Tab,{value:"2",children:"Fallbacks"})]}),(0,t.jsxs)(r.TabPanels,{className:"px-8 py-6",children:[(0,t.jsx)(a.TabPanel,{children:(0,t.jsx)(c.default,{value:f,onChange:x,routerFieldsMetadata:S,availableRoutingStrategies:k,routingStrategyDescriptions:T})}),(0,t.jsx)(a.TabPanel,{children:(0,t.jsx)(d.FallbackSelectionForm,{groups:_,onGroupsChange:e=>{v(e),b(e.filter(e=>e.primaryModel&&e.fallbackModels.length>0).map(e=>({[e.primaryModel]:e.fallbackModels})))},availableModels:L,maxGroups:5})})]})]})}):null});m.displayName="RouterSettingsAccordion",e.s(["default",0,m],460285);var h=e.i(199133),p=e.i(482725),g=e.i(56456);e.s(["default",0,({projects:e,value:s,onChange:a,disabled:r,loading:l,teamId:i})=>{let n=i?e?.filter(e=>e.team_id===i):e;return(0,t.jsx)(h.Select,{showSearch:!0,placeholder:"Search or select a project",value:s,onChange:a,disabled:r,loading:l,allowClear:!0,notFoundContent:l?(0,t.jsx)(p.Spin,{indicator:(0,t.jsx)(g.LoadingOutlined,{spin:!0}),size:"small"}):void 0,filterOption:(e,t)=>{if(!t)return!1;let s=n?.find(e=>e.project_id===t.key);if(!s)return!1;let a=e.toLowerCase().trim(),r=(s.project_alias||"").toLowerCase(),l=(s.project_id||"").toLowerCase();return r.includes(a)||l.includes(a)},optionFilterProp:"children",children:!l&&n?.map(e=>(0,t.jsxs)(h.Select.Option,{value:e.project_id,children:[(0,t.jsx)("span",{className:"font-medium",children:e.project_alias||e.project_id})," ",(0,t.jsxs)("span",{className:"text-gray-500",children:["(",e.project_id,")"]})]},e.project_id))})}],575260)},702597,364769,e=>{"use strict";var t=e.i(843476),s=e.i(207082),a=e.i(510674),r=e.i(292639),l=e.i(135214),i=e.i(500330),n=e.i(827252),o=e.i(912598),c=e.i(677667),d=e.i(130643),u=e.i(898667),m=e.i(994388),h=e.i(309426),p=e.i(350967),g=e.i(599724),f=e.i(779241),x=e.i(629569),y=e.i(464571),b=e.i(808613),_=e.i(311451),v=e.i(212931),j=e.i(91739),w=e.i(199133),k=e.i(790848),N=e.i(262218),S=e.i(592968),C=e.i(374009),T=e.i(271645),E=e.i(708347),I=e.i(552130),A=e.i(557662),O=e.i(9314),L=e.i(860585),M=e.i(82946),F=e.i(392110),R=e.i(533882),P=e.i(844565),D=e.i(651904),B=e.i(939510),$=e.i(460285),K=e.i(663435),U=e.i(575260),z=e.i(371455),V=e.i(355619),q=e.i(75921),G=e.i(390605),H=e.i(727749),W=e.i(764205),Q=e.i(237016),J=e.i(998573);let Y=({apiKey:e})=>{let[s,a]=(0,T.useState)(!1);return(0,t.jsxs)("div",{children:[(0,t.jsxs)("p",{className:"mb-2",children:["Please save this secret key somewhere safe and accessible. For security reasons,"," ",(0,t.jsx)("b",{children:"you will not be able to view it again"})," through your LiteLLM account. If you lose this secret key, you will need to generate a new one."]}),(0,t.jsx)("p",{className:"text-sm text-gray-600 mt-3 mb-1",children:"Virtual Key:"}),(0,t.jsx)("div",{style:{background:"#f8f8f8",padding:"10px",borderRadius:"5px",marginBottom:"10px"},children:(0,t.jsx)("pre",{style:{wordWrap:"break-word",whiteSpace:"normal",margin:0},children:e})}),(0,t.jsx)(Q.CopyToClipboard,{text:e,onCopy:()=>{a(!0),J.message.success("Key copied to clipboard"),setTimeout(()=>a(!1),2e3)},children:(0,t.jsx)(y.Button,{type:"primary",style:{marginTop:12},children:s?"Copied!":"Copy Virtual Key"})})]})};e.s(["default",0,Y],364769);var X=e.i(435451),Z=e.i(916940);let{Option:ee}=w.Select,et=async(e,t,s,a)=>{try{if(null===e||null===t)return[];if(null!==s){let r=(await (0,W.modelAvailableCall)(s,e,t,!0,a,!0)).data.map(e=>e.id);return console.log("available_model_names:",r),r}return[]}catch(e){return console.error("Error fetching user models:",e),[]}},es=async(e,t,s,a)=>{try{if(null===e||null===t)return;if(null!==s){let r=(await (0,W.modelAvailableCall)(s,e,t)).data.map(e=>e.id);console.log("available_model_names:",r),a(r)}}catch(e){console.error("Error fetching user models:",e)}};e.s(["default",0,({team:e,teams:Q,data:J,addKey:ea,autoOpenCreate:er,prefillData:el})=>{let{accessToken:ei,userId:en,userRole:eo,premiumUser:ec}=(0,l.default)(),ed=ec||null!=eo&&E.rolesWithWriteAccess.includes(eo),{data:eu,isLoading:em}=(0,a.useProjects)(),{data:eh}=(0,r.useUISettings)(),ep=!!eh?.values?.enable_projects_ui,eg=(0,o.useQueryClient)(),[ef]=b.Form.useForm(),[ex,ey]=(0,T.useState)(!1),[eb,e_]=(0,T.useState)(null),[ev,ej]=(0,T.useState)(null),[ew,ek]=(0,T.useState)([]),[eN,eS]=(0,T.useState)([]),[eC,eT]=(0,T.useState)("you"),[eE,eI]=(0,T.useState)((e=>{let t=[];if(console.log("data:",JSON.stringify(e)),e)for(let s of e)s.metadata&&s.metadata.tags&&t.push(...s.metadata.tags);let s=Array.from(new Set(t)).map(e=>({value:e,label:e}));return console.log("uniqueTags:",s),s})(J)),[eA,eO]=(0,T.useState)(!1),[eL,eM]=(0,T.useState)(null),[eF,eR]=(0,T.useState)([]),[eP,eD]=(0,T.useState)([]),[eB,e$]=(0,T.useState)([]),[eK,eU]=(0,T.useState)([]),[ez,eV]=(0,T.useState)(e),[eq,eG]=(0,T.useState)(null),[eH,eW]=(0,T.useState)(!1),[eQ,eJ]=(0,T.useState)(null),[eY,eX]=(0,T.useState)({}),[eZ,e0]=(0,T.useState)([]),[e1,e2]=(0,T.useState)(!1),[e4,e3]=(0,T.useState)([]),[e5,e6]=(0,T.useState)([]),[e7,e9]=(0,T.useState)("llm_api"),[e8,te]=(0,T.useState)({}),[tt,ts]=(0,T.useState)(!1),[ta,tr]=(0,T.useState)("30d"),[tl,ti]=(0,T.useState)(null),[tn,to]=(0,T.useState)(0),[tc,td]=(0,T.useState)([]),[tu,tm]=(0,T.useState)(null),th=()=>{ey(!1),ef.resetFields(),eU([]),e6([]),e9("llm_api"),te({}),ts(!1),tr("30d"),ti(null),to(e=>e+1),tm(null),eG(null)},tp=()=>{ey(!1),e_(null),eV(null),ef.resetFields(),eU([]),e6([]),e9("llm_api"),te({}),ts(!1),tr("30d"),ti(null),to(e=>e+1),tm(null),eG(null)};(0,T.useEffect)(()=>{en&&eo&&ei&&es(en,eo,ei,ek)},[ei,en,eo]),(0,T.useEffect)(()=>{ei&&(0,W.getAgentsList)(ei).then(e=>td(e?.agents||[])).catch(()=>td([]))},[ei]),(0,T.useEffect)(()=>{let e=async()=>{try{let e=(await (0,W.getPoliciesList)(ei)).policies.map(e=>e.policy_name);eD(e)}catch(e){console.error("Failed to fetch policies:",e)}},t=async()=>{try{let e=await (0,W.getPromptsList)(ei);e$(e.prompts.map(e=>e.prompt_id))}catch(e){console.error("Failed to fetch prompts:",e)}};(async()=>{try{let e=(await (0,W.getGuardrailsList)(ei)).guardrails.map(e=>e.guardrail_name);eR(e)}catch(e){console.error("Failed to fetch guardrails:",e)}})(),e(),t()},[ei]),(0,T.useEffect)(()=>{(async()=>{try{if(ei){let e=sessionStorage.getItem("possibleUserRoles");if(e)eX(JSON.parse(e));else{let e=await (0,W.getPossibleUserRoles)(ei);sessionStorage.setItem("possibleUserRoles",JSON.stringify(e)),eX(e)}}}catch(e){console.error("Error fetching possible user roles:",e)}})()},[ei]),(0,T.useEffect)(()=>{if(er&&!eA&&Q&&eo&&E.rolesWithWriteAccess.includes(eo)&&(ey(!0),eO(!0),el)){if(el.owned_by&&("another_user"===el.owned_by&&"Admin"!==eo?eT("you"):eT(el.owned_by)),el.team_id){let e=Q?.find(e=>e.team_id===el.team_id)||null;e&&(eV(e),ef.setFieldsValue({team_id:el.team_id}))}el.key_alias&&ef.setFieldsValue({key_alias:el.key_alias}),el.models&&el.models.length>0&&eM(el.models),el.key_type&&(e9(el.key_type),ef.setFieldsValue({key_type:el.key_type}))}},[er,el,Q,eA,ef,eo]);let tg=eN.includes("no-default-models")&&!ez,tf=async e=>{try{let t,a=e?.key_alias??"",r=e?.team_id??null;if((J?.filter(e=>e.team_id===r).map(e=>e.key_alias)??[]).includes(a))throw Error(`Key alias ${a} already exists for team with ID ${r}, please provide another key alias`);if(H.default.info("Making API Call"),ey(!0),"you"===eC)e.user_id=en;else if("agent"===eC){if(!tu)return void H.default.fromBackend("Please select an agent");e.agent_id=tu}let l={};try{l=JSON.parse(e.metadata||"{}")}catch(e){console.error("Error parsing metadata:",e)}if("service_account"===eC&&(l.service_account_id=e.key_alias),eK.length>0&&(l={...l,logging:eK.filter(e=>e.callback_name)}),e5.length>0){let e=(0,A.mapDisplayToInternalNames)(e5);l={...l,litellm_disabled_callbacks:e}}if(tt&&(e.auto_rotate=!0,e.rotation_interval=ta),e.duration&&""!==e.duration.trim()||(e.duration=null),e.metadata=JSON.stringify(l),e.allowed_vector_store_ids&&e.allowed_vector_store_ids.length>0&&(e.object_permission={vector_stores:e.allowed_vector_store_ids},delete e.allowed_vector_store_ids),e.allowed_mcp_servers_and_groups&&(e.allowed_mcp_servers_and_groups.servers?.length>0||e.allowed_mcp_servers_and_groups.accessGroups?.length>0)){e.object_permission||(e.object_permission={});let{servers:t,accessGroups:s}=e.allowed_mcp_servers_and_groups;t&&t.length>0&&(e.object_permission.mcp_servers=t),s&&s.length>0&&(e.object_permission.mcp_access_groups=s),delete e.allowed_mcp_servers_and_groups}let i=e.mcp_tool_permissions||{};if(Object.keys(i).length>0&&(e.object_permission||(e.object_permission={}),e.object_permission.mcp_tool_permissions=i),delete e.mcp_tool_permissions,e.allowed_mcp_access_groups&&e.allowed_mcp_access_groups.length>0&&(e.object_permission||(e.object_permission={}),e.object_permission.mcp_access_groups=e.allowed_mcp_access_groups,delete e.allowed_mcp_access_groups),e.allowed_agents_and_groups&&(e.allowed_agents_and_groups.agents?.length>0||e.allowed_agents_and_groups.accessGroups?.length>0)){e.object_permission||(e.object_permission={});let{agents:t,accessGroups:s}=e.allowed_agents_and_groups;t&&t.length>0&&(e.object_permission.agents=t),s&&s.length>0&&(e.object_permission.agent_access_groups=s),delete e.allowed_agents_and_groups}Object.keys(e8).length>0&&(e.aliases=JSON.stringify(e8)),tl?.router_settings&&Object.values(tl.router_settings).some(e=>null!=e&&""!==e)&&(e.router_settings=tl.router_settings),t="service_account"===eC?await (0,W.keyCreateServiceAccountCall)(ei,e):await (0,W.keyCreateCall)(ei,en,e),console.log("key create Response:",t),ea(t),eg.invalidateQueries({queryKey:s.keyKeys.lists()}),e_(t.key),ej(t.soft_budget),H.default.success("Virtual Key Created"),ef.resetFields(),localStorage.removeItem("userData"+en)}catch(t){console.log("error in create key:",t);let e=(e=>{let t;if(!(t=!e||"object"!=typeof e||e instanceof Error?String(e):JSON.stringify(e)).includes("/key/generate")&&!t.includes("KeyManagementRoutes.KEY_GENERATE"))return`Error creating the key: ${e}`;let s=t;try{if(!e||"object"!=typeof e||e instanceof Error){let e=t.match(/\{[\s\S]*\}/);if(e){let t=JSON.parse(e[0]),a=t?.error||t;a?.message&&(s=a.message)}}else{let t=e?.error||e;t?.message&&(s=t.message)}}catch(e){}return t.includes("team_member_permission_error")||s.includes("Team member does not have permissions")?"Team member does not have permission to generate key for this team. Ask your proxy admin to configure the team member permission settings.":`Error creating the key: ${e}`})(t);H.default.fromBackend(e)}};(0,T.useEffect)(()=>{if(eq){let e=eu?.find(e=>e.project_id===eq);eS(e?.models??[]),ef.setFieldValue("models",[]);return}en&&eo&&ei&&et(en,eo,ei,ez?.team_id??null).then(e=>{eS(Array.from(new Set([...ez?.models??[],...e])))}),eL||ef.setFieldValue("models",[]),ef.setFieldValue("allowed_mcp_servers_and_groups",{servers:[],accessGroups:[]})},[ez,eq,ei,en,eo,ef]),(0,T.useEffect)(()=>{if(!eL||0===eL.length||!eN||0===eN.length)return;let e=eL.filter(e=>eN.includes(e));e.length>0&&ef.setFieldsValue({models:e}),eM(null)},[eL,eN,ef]),(0,T.useEffect)(()=>{if(!eq||!Q)return;let e=eu?.find(e=>e.project_id===eq);if(!e?.team_id||ez?.team_id===e.team_id)return;let t=Q.find(t=>t.team_id===e.team_id)||null;t&&(eV(t),ef.setFieldValue("team_id",t.team_id))},[Q,eq,eu]);let tx=async e=>{if(!e)return void e0([]);e2(!0);try{let t=new URLSearchParams;if(t.append("user_email",e),null==ei)return;let s=(await (0,W.userFilterUICall)(ei,t)).map(e=>({label:`${e.user_email} (${e.user_id})`,value:e.user_id,user:e}));e0(s)}catch(e){console.error("Error fetching users:",e),H.default.fromBackend("Failed to search for users")}finally{e2(!1)}},ty=(0,T.useCallback)((0,C.default)(e=>tx(e),300),[ei]);return(0,t.jsxs)("div",{children:[eo&&E.rolesWithWriteAccess.includes(eo)&&(0,t.jsx)(m.Button,{className:"mx-auto",onClick:()=>ey(!0),children:"+ Create New Key"}),(0,t.jsx)(v.Modal,{open:ex,width:1e3,footer:null,onOk:th,onCancel:tp,children:(0,t.jsxs)(b.Form,{form:ef,onFinish:tf,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,t.jsxs)("div",{className:"mb-8",children:[(0,t.jsx)(x.Title,{className:"mb-4",children:"Key Ownership"}),(0,t.jsx)(b.Form.Item,{label:(0,t.jsxs)("span",{children:["Owned By"," ",(0,t.jsx)(S.Tooltip,{title:"Select who will own this Virtual Key",children:(0,t.jsx)(n.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),className:"mb-4",children:(0,t.jsxs)(j.Radio.Group,{onChange:e=>eT(e.target.value),value:eC,children:[(0,t.jsx)(j.Radio,{value:"you",children:"You"}),(0,t.jsx)(j.Radio,{value:"service_account",children:"Service Account"}),"Admin"===eo&&(0,t.jsx)(j.Radio,{value:"another_user",children:"Another User"}),(0,t.jsxs)(j.Radio,{value:"agent",children:["Agent ",(0,t.jsx)(N.Tag,{color:"purple",children:"New"})]})]})}),"another_user"===eC&&(0,t.jsx)(b.Form.Item,{label:(0,t.jsxs)("span",{children:["User ID"," ",(0,t.jsx)(S.Tooltip,{title:"The user who will own this key and be responsible for its usage",children:(0,t.jsx)(n.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"user_id",className:"mt-4",rules:[{required:"another_user"===eC,message:"Please input the user ID of the user you are assigning the key to"}],children:(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{style:{display:"flex",marginBottom:"8px"},children:[(0,t.jsx)(w.Select,{showSearch:!0,placeholder:"Type email to search for users",filterOption:!1,onSearch:e=>{ty(e)},onSelect:(e,t)=>{let s;return s=t.user,void ef.setFieldsValue({user_id:s.user_id})},options:eZ,loading:e1,allowClear:!0,style:{width:"100%"},notFoundContent:e1?"Searching...":"No users found"}),(0,t.jsx)(y.Button,{onClick:()=>eW(!0),style:{marginLeft:"8px"},children:"Create User"})]}),(0,t.jsx)("div",{className:"text-xs text-gray-500",children:"Search by email to find users"})]})}),"agent"===eC&&(0,t.jsxs)("div",{className:"mt-4 p-4 bg-purple-50 border border-purple-200 rounded-md",children:[(0,t.jsx)("div",{className:"mb-3",children:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700",children:["Select Agent ",(0,t.jsx)("span",{className:"text-red-500",children:"*"})]})}),(0,t.jsx)(w.Select,{showSearch:!0,placeholder:"Select an agent",style:{width:"100%"},value:tu,onChange:e=>tm(e),filterOption:(e,t)=>t?.label?.toLowerCase().includes(e.toLowerCase()),options:tc.map(e=>({label:e.agent_name||e.agent_id,value:e.agent_id}))}),(0,t.jsx)("div",{className:"text-xs text-gray-500 mt-2",children:"This key will be used by the selected agent to make requests to LiteLLM"})]}),(0,t.jsx)(b.Form.Item,{label:(0,t.jsxs)("span",{children:["Team"," ",(0,t.jsx)(S.Tooltip,{title:"The team this key belongs to, which determines available models and budget limits",children:(0,t.jsx)(n.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"team_id",initialValue:e?e.team_id:null,className:"mt-4",rules:[{required:"service_account"===eC,message:"Please select a team for the service account"}],help:"service_account"===eC?"required":"",children:(0,t.jsx)(K.default,{teams:Q,disabled:null!==eq,loading:!Q,onChange:e=>{eV(Q?.find(t=>t.team_id===e)||null),eG(null),ef.setFieldValue("project_id",void 0)}})}),ep&&(0,t.jsx)(b.Form.Item,{label:(0,t.jsxs)("span",{children:["Project"," ",(0,t.jsx)(S.Tooltip,{title:"Assign this key to a project. Selecting a project will lock the team to the project's team.",children:(0,t.jsx)(n.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"project_id",className:"mt-4",children:(0,t.jsx)(U.default,{projects:eu,teamId:ez?.team_id,loading:em||!Q,onChange:e=>{if(!e){eG(null),eV(null),ef.setFieldValue("team_id",void 0);return}eG(e)}})})]}),tg&&(0,t.jsx)("div",{className:"mb-8 p-4 bg-blue-50 border border-blue-200 rounded-md",children:(0,t.jsx)(g.Text,{className:"text-blue-800 text-sm",children:"Please select a team to continue configuring your Virtual Key. If you do not see any teams, please contact your Proxy Admin to either provide you with access to models or to add you to a team."})}),!tg&&(0,t.jsxs)("div",{className:"mb-8",children:[(0,t.jsx)(x.Title,{className:"mb-4",children:"Key Details"}),(0,t.jsx)(b.Form.Item,{label:(0,t.jsxs)("span",{children:["you"===eC||"another_user"===eC?"Key Name":"Service Account ID"," ",(0,t.jsx)(S.Tooltip,{title:"you"===eC||"another_user"===eC?"A descriptive name to identify this key":"Unique identifier for this service account",children:(0,t.jsx)(n.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"key_alias",rules:[{required:!0,message:`Please input a ${"you"===eC?"key name":"service account ID"}`}],help:"required",children:(0,t.jsx)(f.TextInput,{placeholder:""})}),(0,t.jsx)(b.Form.Item,{label:(0,t.jsxs)("span",{children:["Models"," ",(0,t.jsx)(S.Tooltip,{title:"Select which models this key can access. Choose 'All Team Models' to grant access to all models available to the team. Leave empty to allow access to all models.",children:(0,t.jsx)(n.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"models",rules:[],help:"management"===e7||"read_only"===e7?"Models field is disabled for this key type":"optional - leave empty to allow access to all models",className:"mt-4",children:(0,t.jsxs)(w.Select,{mode:"multiple",placeholder:"Select models",style:{width:"100%"},disabled:"management"===e7||"read_only"===e7,onChange:e=>{e.includes("all-team-models")&&ef.setFieldsValue({models:["all-team-models"]})},children:[!eq&&(0,t.jsx)(ee,{value:"all-team-models",children:"All Team Models"},"all-team-models"),eN.map(e=>(0,t.jsx)(ee,{value:e,children:(0,V.getModelDisplayName)(e)},e))]})}),(0,t.jsx)(b.Form.Item,{label:(0,t.jsxs)("span",{children:["Key Type"," ",(0,t.jsx)(S.Tooltip,{title:"Select the type of key to determine what routes and operations this key can access",children:(0,t.jsx)(n.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"key_type",initialValue:"llm_api",className:"mt-4",children:(0,t.jsxs)(w.Select,{defaultValue:"llm_api",placeholder:"Select key type",style:{width:"100%"},optionLabelProp:"label",onChange:e=>{e9(e),("management"===e||"read_only"===e)&&ef.setFieldsValue({models:[]})},children:[(0,t.jsx)(ee,{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)(ee,{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)(ee,{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)"})]})})]})})]}),!tg&&(0,t.jsx)("div",{className:"mb-8",children:(0,t.jsxs)(c.Accordion,{className:"mt-4 mb-4",children:[(0,t.jsx)(u.AccordionHeader,{children:(0,t.jsx)(x.Title,{className:"m-0",children:"Optional Settings"})}),(0,t.jsxs)(d.AccordionBody,{children:[(0,t.jsx)(b.Form.Item,{className:"mt-4",label:(0,t.jsxs)("span",{children:["Max Budget (USD)"," ",(0,t.jsx)(S.Tooltip,{title:"Maximum amount in USD this key can spend. When reached, the key will be blocked from making further requests",children:(0,t.jsx)(n.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"max_budget",help:`Budget cannot exceed team max budget: $${e?.max_budget!==null&&e?.max_budget!==void 0?e?.max_budget:"unlimited"}`,rules:[{validator:async(t,s)=>{if(s&&e&&null!==e.max_budget&&s>e.max_budget)throw Error(`Budget cannot exceed team max budget: $${(0,i.formatNumberWithCommas)(e.max_budget,4)}`)}}],children:(0,t.jsx)(X.default,{step:.01,precision:2,width:200})}),(0,t.jsx)(b.Form.Item,{className:"mt-4",label:(0,t.jsxs)("span",{children:["Reset Budget"," ",(0,t.jsx)(S.Tooltip,{title:"How often the budget should reset. For example, setting 'daily' will reset the budget every 24 hours",children:(0,t.jsx)(n.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"budget_duration",help:`Team Reset Budget: ${e?.budget_duration!==null&&e?.budget_duration!==void 0?e?.budget_duration:"None"}`,children:(0,t.jsx)(L.default,{onChange:e=>ef.setFieldValue("budget_duration",e)})}),(0,t.jsx)(b.Form.Item,{className:"mt-4",label:(0,t.jsxs)("span",{children:["Tokens per minute Limit (TPM)"," ",(0,t.jsx)(S.Tooltip,{title:"Maximum number of tokens this key can process per minute. Helps control usage and costs",children:(0,t.jsx)(n.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"tpm_limit",help:`TPM cannot exceed team TPM limit: ${e?.tpm_limit!==null&&e?.tpm_limit!==void 0?e?.tpm_limit:"unlimited"}`,rules:[{validator:async(t,s)=>{if(s&&e&&null!==e.tpm_limit&&s>e.tpm_limit)throw Error(`TPM limit cannot exceed team TPM limit: ${e.tpm_limit}`)}}],children:(0,t.jsx)(X.default,{step:1,width:400})}),(0,t.jsx)(B.default,{type:"tpm",name:"tpm_limit_type",className:"mt-4",initialValue:null,form:ef,showDetailedDescriptions:!0}),(0,t.jsx)(b.Form.Item,{className:"mt-4",label:(0,t.jsxs)("span",{children:["Requests per minute Limit (RPM)"," ",(0,t.jsx)(S.Tooltip,{title:"Maximum number of API requests this key can make per minute. Helps prevent abuse and manage load",children:(0,t.jsx)(n.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"rpm_limit",help:`RPM cannot exceed team RPM limit: ${e?.rpm_limit!==null&&e?.rpm_limit!==void 0?e?.rpm_limit:"unlimited"}`,rules:[{validator:async(t,s)=>{if(s&&e&&null!==e.rpm_limit&&s>e.rpm_limit)throw Error(`RPM limit cannot exceed team RPM limit: ${e.rpm_limit}`)}}],children:(0,t.jsx)(X.default,{step:1,width:400})}),(0,t.jsx)(B.default,{type:"rpm",name:"rpm_limit_type",className:"mt-4",initialValue:null,form:ef,showDetailedDescriptions:!0}),(0,t.jsx)(b.Form.Item,{label:(0,t.jsxs)("span",{children:["Guardrails"," ",(0,t.jsx)(S.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)(n.InfoCircleOutlined,{style:{marginLeft:"4px"}})})})]}),name:"guardrails",className:"mt-4",help:ed?"Select existing guardrails or enter new ones":"Premium feature - Upgrade to set guardrails by key",children:(0,t.jsx)(w.Select,{mode:"tags",style:{width:"100%"},disabled:!ed,placeholder:ed?"Select or enter guardrails":"Premium feature - Upgrade to set guardrails by key",options:eF.map(e=>({value:e,label:e}))})}),(0,t.jsx)(b.Form.Item,{label:(0,t.jsxs)("span",{children:["Disable Global Guardrails"," ",(0,t.jsx)(S.Tooltip,{title:"When enabled, this key will bypass any guardrails configured to run on every request (global guardrails)",children:(0,t.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/guardrails/quick_start",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:(0,t.jsx)(n.InfoCircleOutlined,{style:{marginLeft:"4px"}})})})]}),name:"disable_global_guardrails",className:"mt-4",valuePropName:"checked",help:ed?"Bypass global guardrails for this key":"Premium feature - Upgrade to disable global guardrails by key",children:(0,t.jsx)(k.Switch,{disabled:!ed,checkedChildren:"Yes",unCheckedChildren:"No"})}),(0,t.jsx)(b.Form.Item,{label:(0,t.jsxs)("span",{children:["Policies"," ",(0,t.jsx)(S.Tooltip,{title:"Apply policies to this key to control guardrails and other settings",children:(0,t.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/guardrails/guardrail_policies",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:(0,t.jsx)(n.InfoCircleOutlined,{style:{marginLeft:"4px"}})})})]}),name:"policies",className:"mt-4",help:ec?"Select existing policies or enter new ones":"Premium feature - Upgrade to set policies by key",children:(0,t.jsx)(w.Select,{mode:"tags",style:{width:"100%"},disabled:!ec,placeholder:ec?"Select or enter policies":"Premium feature - Upgrade to set policies by key",options:eP.map(e=>({value:e,label:e}))})}),(0,t.jsx)(b.Form.Item,{label:(0,t.jsxs)("span",{children:["Prompts"," ",(0,t.jsx)(S.Tooltip,{title:"Allow this key to use specific prompt templates",children:(0,t.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/prompt_management",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:(0,t.jsx)(n.InfoCircleOutlined,{style:{marginLeft:"4px"}})})})]}),name:"prompts",className:"mt-4",help:ec?"Select existing prompts or enter new ones":"Premium feature - Upgrade to set prompts by key",children:(0,t.jsx)(w.Select,{mode:"tags",style:{width:"100%"},disabled:!ec,placeholder:ec?"Select or enter prompts":"Premium feature - Upgrade to set prompts by key",options:eB.map(e=>({value:e,label:e}))})}),(0,t.jsx)(b.Form.Item,{label:(0,t.jsxs)("span",{children:["Access Groups"," ",(0,t.jsx)(S.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)(n.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"access_group_ids",className:"mt-4",help:"Select access groups to assign to this key",children:(0,t.jsx)(O.default,{placeholder:"Select access groups (optional)"})}),(0,t.jsx)(b.Form.Item,{label:(0,t.jsxs)("span",{children:["Allowed Pass Through Routes"," ",(0,t.jsx)(S.Tooltip,{title:"Allow this key to use specific pass through routes",children:(0,t.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/pass_through",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:(0,t.jsx)(n.InfoCircleOutlined,{style:{marginLeft:"4px"}})})})]}),name:"allowed_passthrough_routes",className:"mt-4",help:ec?"Select existing pass through routes or enter new ones":"Premium feature - Upgrade to set pass through routes by key",children:(0,t.jsx)(P.default,{onChange:e=>ef.setFieldValue("allowed_passthrough_routes",e),value:ef.getFieldValue("allowed_passthrough_routes"),accessToken:ei,placeholder:ec?"Select or enter pass through routes":"Premium feature - Upgrade to set pass through routes by key",disabled:!ec,teamId:ez?ez.team_id:null})}),(0,t.jsx)(b.Form.Item,{label:(0,t.jsxs)("span",{children:["Allowed Vector Stores"," ",(0,t.jsx)(S.Tooltip,{title:"Select which vector stores this key can access. If none selected, the key will have access to all available vector stores",children:(0,t.jsx)(n.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"allowed_vector_store_ids",className:"mt-4",help:"Select vector stores this key can access. Leave empty for access to all vector stores",children:(0,t.jsx)(Z.default,{onChange:e=>ef.setFieldValue("allowed_vector_store_ids",e),value:ef.getFieldValue("allowed_vector_store_ids"),accessToken:ei,placeholder:"Select vector stores (optional)"})}),(0,t.jsx)(b.Form.Item,{label:(0,t.jsxs)("span",{children:["Metadata"," ",(0,t.jsx)(S.Tooltip,{title:"JSON object with additional information about this key. Used for tracking or custom logic",children:(0,t.jsx)(n.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"metadata",className:"mt-4",children:(0,t.jsx)(_.Input.TextArea,{rows:4,placeholder:"Enter metadata as JSON"})}),(0,t.jsx)(b.Form.Item,{label:(0,t.jsxs)("span",{children:["Tags"," ",(0,t.jsx)(S.Tooltip,{title:"Tags for tracking spend and/or doing tag-based routing. Used for analytics and filtering",children:(0,t.jsx)(n.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"tags",className:"mt-4",help:"Tags for tracking spend and/or doing tag-based routing.",children:(0,t.jsx)(w.Select,{mode:"tags",style:{width:"100%"},placeholder:"Enter tags",tokenSeparators:[","],options:eE})}),(0,t.jsxs)(c.Accordion,{className:"mt-4 mb-4",children:[(0,t.jsx)(u.AccordionHeader,{children:(0,t.jsx)("b",{children:"MCP Settings"})}),(0,t.jsxs)(d.AccordionBody,{children:[(0,t.jsx)(b.Form.Item,{label:(0,t.jsxs)("span",{children:["Allowed MCP Servers"," ",(0,t.jsx)(S.Tooltip,{title:"Select which MCP servers or access groups this key can access",children:(0,t.jsx)(n.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"allowed_mcp_servers_and_groups",help:"Select MCP servers or access groups this key can access",children:(0,t.jsx)(q.default,{onChange:e=>ef.setFieldValue("allowed_mcp_servers_and_groups",e),value:ef.getFieldValue("allowed_mcp_servers_and_groups"),accessToken:ei,teamId:ez?.team_id??null,placeholder:"Select MCP servers or access groups (optional)"})}),(0,t.jsx)(b.Form.Item,{name:"mcp_tool_permissions",initialValue:{},hidden:!0,children:(0,t.jsx)(_.Input,{type:"hidden"})}),(0,t.jsx)(b.Form.Item,{noStyle:!0,shouldUpdate:(e,t)=>e.allowed_mcp_servers_and_groups!==t.allowed_mcp_servers_and_groups||e.mcp_tool_permissions!==t.mcp_tool_permissions,children:()=>(0,t.jsx)("div",{className:"mt-6",children:(0,t.jsx)(G.default,{accessToken:ei,selectedServers:ef.getFieldValue("allowed_mcp_servers_and_groups")?.servers||[],toolPermissions:ef.getFieldValue("mcp_tool_permissions")||{},onChange:e=>ef.setFieldsValue({mcp_tool_permissions:e})})})})]})]}),(0,t.jsxs)(c.Accordion,{className:"mt-4 mb-4",children:[(0,t.jsx)(u.AccordionHeader,{children:(0,t.jsx)("b",{children:"Agent Settings"})}),(0,t.jsx)(d.AccordionBody,{children:(0,t.jsx)(b.Form.Item,{label:(0,t.jsxs)("span",{children:["Allowed Agents"," ",(0,t.jsx)(S.Tooltip,{title:"Select which agents or access groups this key can access",children:(0,t.jsx)(n.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"allowed_agents_and_groups",help:"Select agents or access groups this key can access",children:(0,t.jsx)(I.default,{onChange:e=>ef.setFieldValue("allowed_agents_and_groups",e),value:ef.getFieldValue("allowed_agents_and_groups"),accessToken:ei,placeholder:"Select agents or access groups (optional)"})})})]}),ec?(0,t.jsxs)(c.Accordion,{className:"mt-4 mb-4",children:[(0,t.jsx)(u.AccordionHeader,{children:(0,t.jsx)("b",{children:"Logging Settings"})}),(0,t.jsx)(d.AccordionBody,{children:(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsx)(D.default,{value:eK,onChange:eU,premiumUser:!0,disabledCallbacks:e5,onDisabledCallbacksChange:e6})})})]}):(0,t.jsx)(S.Tooltip,{title:(0,t.jsxs)("span",{children:["Key-level logging settings is an enterprise feature, get in touch -",(0,t.jsx)("a",{href:"https://www.litellm.ai/enterprise",target:"_blank",children:"https://www.litellm.ai/enterprise"})]}),placement:"top",children:(0,t.jsxs)("div",{style:{position:"relative"},children:[(0,t.jsx)("div",{style:{opacity:.5},children:(0,t.jsxs)(c.Accordion,{className:"mt-4 mb-4",children:[(0,t.jsx)(u.AccordionHeader,{children:(0,t.jsx)("b",{children:"Logging Settings"})}),(0,t.jsx)(d.AccordionBody,{children:(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsx)(D.default,{value:eK,onChange:eU,premiumUser:!1,disabledCallbacks:e5,onDisabledCallbacksChange:e6})})})]})}),(0,t.jsx)("div",{style:{position:"absolute",inset:0,cursor:"not-allowed"}})]})}),(0,t.jsxs)(c.Accordion,{className:"mt-4 mb-4",children:[(0,t.jsx)(u.AccordionHeader,{children:(0,t.jsx)("b",{children:"Router Settings"})}),(0,t.jsx)(d.AccordionBody,{children:(0,t.jsx)("div",{className:"mt-4 w-full",children:(0,t.jsx)($.default,{accessToken:ei||"",value:tl||void 0,onChange:ti,modelData:ew.length>0?{data:ew.map(e=>({model_name:e}))}:void 0},tn)})})]},`router-settings-accordion-${tn}`),(0,t.jsxs)(c.Accordion,{className:"mt-4 mb-4",children:[(0,t.jsx)(u.AccordionHeader,{children:(0,t.jsx)("b",{children:"Model Aliases"})}),(0,t.jsx)(d.AccordionBody,{children:(0,t.jsxs)("div",{className:"mt-4",children:[(0,t.jsx)(g.Text,{className:"text-sm text-gray-600 mb-4",children:"Create custom aliases for models that can be used in API calls. This allows you to create shortcuts for specific models."}),(0,t.jsx)(R.default,{accessToken:ei,initialModelAliases:e8,onAliasUpdate:te,showExampleConfig:!1})]})})]}),(0,t.jsxs)(c.Accordion,{className:"mt-4 mb-4",children:[(0,t.jsx)(u.AccordionHeader,{children:(0,t.jsx)("b",{children:"Key Lifecycle"})}),(0,t.jsx)(d.AccordionBody,{children:(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsx)(F.default,{form:ef,autoRotationEnabled:tt,onAutoRotationChange:ts,rotationInterval:ta,onRotationIntervalChange:tr,isCreateMode:!0})})}),(0,t.jsx)(b.Form.Item,{name:"duration",hidden:!0,initialValue:null,children:(0,t.jsx)(_.Input,{})})]}),(0,t.jsxs)(c.Accordion,{className:"mt-4 mb-4",children:[(0,t.jsx)(u.AccordionHeader,{children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("b",{children:"Advanced Settings"}),(0,t.jsx)(S.Tooltip,{title:(0,t.jsxs)("span",{children:["Learn more about advanced settings in our"," ",(0,t.jsx)("a",{href:W.proxyBaseUrl?`${W.proxyBaseUrl}/#/key%20management/generate_key_fn_key_generate_post`:"/#/key%20management/generate_key_fn_key_generate_post",target:"_blank",rel:"noopener noreferrer",className:"text-blue-400 hover:text-blue-300",children:"documentation"})]}),children:(0,t.jsx)(n.InfoCircleOutlined,{className:"text-gray-400 hover:text-gray-300 cursor-help"})})]})}),(0,t.jsx)(d.AccordionBody,{children:(0,t.jsx)(M.default,{schemaComponent:"GenerateKeyRequest",form:ef,excludedFields:["key_alias","team_id","models","duration","metadata","tags","guardrails","max_budget","budget_duration","tpm_limit","rpm_limit"]})})]})]})]})}),(0,t.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,t.jsx)(y.Button,{htmlType:"submit",disabled:tg,style:{opacity:tg?.5:1},children:"Create Key"})})]})}),eH&&(0,t.jsx)(v.Modal,{title:"Create New User",open:eH,onCancel:()=>eW(!1),footer:null,width:800,children:(0,t.jsx)(z.CreateUserButton,{userID:en,accessToken:ei,teams:Q,possibleUIRoles:eY,onUserCreated:e=>{eJ(e),ef.setFieldsValue({user_id:e}),eW(!1)},isEmbedded:!0})}),eb&&(0,t.jsx)(v.Modal,{open:ex,onOk:th,onCancel:tp,footer:null,children:(0,t.jsxs)(p.Grid,{numItems:1,className:"gap-2 w-full",children:[(0,t.jsx)(x.Title,{children:"Save your Key"}),(0,t.jsx)(h.Col,{numColSpan:1,children:null!=eb?(0,t.jsx)(Y,{apiKey:eb}):(0,t.jsx)(g.Text,{children:"Key being created, this might take 30s"})})]})})]})},"fetchTeamModels",0,et,"fetchUserModels",0,es],702597)}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/3413b6a1ede03f29.js b/litellm/proxy/_experimental/out/_next/static/chunks/5595eb6378e90997.js similarity index 87% rename from litellm/proxy/_experimental/out/_next/static/chunks/3413b6a1ede03f29.js rename to litellm/proxy/_experimental/out/_next/static/chunks/5595eb6378e90997.js index 016e8f37d8..ab41ae1d36 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/3413b6a1ede03f29.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/5595eb6378e90997.js @@ -1 +1 @@ -(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,384767,e=>{"use strict";var t=e.i(843476),r=e.i(599724),a=e.i(271645),s=e.i(389083);let l=a.forwardRef(function(e,t){return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 7v10c0 2.21 3.582 4 8 4s8-1.79 8-4V7M4 7c0 2.21 3.582 4 8 4s8-1.79 8-4M4 7c0-2.21 3.582-4 8-4s8 1.79 8 4m0 5c0 2.21-3.582 4-8 4s-8-1.79-8-4"}))});var n=e.i(764205);let i=function({vectorStores:e,accessToken:i}){let[o,c]=(0,a.useState)([]);return(0,a.useEffect)(()=>{(async()=>{if(i&&0!==e.length)try{let e=await (0,n.vectorStoreListCall)(i);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)}})()},[i,e.length]),(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(l,{className:"h-4 w-4 text-blue-600"}),(0,t.jsx)(r.Text,{className:"font-semibold text-gray-900",children:"Vector Stores"}),(0,t.jsx)(s.Badge,{color:"blue",size:"xs",children:e.length})]}),e.length>0?(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:e.map((e,r)=>{let a;return(0,t.jsx)("div",{className:"inline-flex items-center px-3 py-1.5 rounded-lg bg-blue-50 border border-blue-200 text-blue-800 text-sm font-medium",children:(a=o.find(t=>t.vector_store_id===e))?`${a.vector_store_name||a.vector_store_id} (${a.vector_store_id})`:e},r)})}):(0,t.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-50 border border-gray-200",children:[(0,t.jsx)(l,{className:"h-4 w-4 text-gray-400"}),(0,t.jsx)(r.Text,{className:"text-gray-500 text-sm",children:"No vector stores configured"})]})]})},o=a.forwardRef(function(e,t){return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 12h14M5 12a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v4a2 2 0 01-2 2M5 12a2 2 0 00-2 2v4a2 2 0 002 2h14a2 2 0 002-2v-4a2 2 0 00-2-2m-2-4h.01M17 16h.01"}))});var c=e.i(871943),d=e.i(502547),u=e.i(592968);let m=function({mcpServers:l,mcpAccessGroups:i=[],mcpToolPermissions:m={},accessToken:p}){let[g,f]=(0,a.useState)([]),[x,h]=(0,a.useState)([]),[b,y]=(0,a.useState)(new Set);(0,a.useEffect)(()=>{(async()=>{if(p&&l.length>0)try{let e=await (0,n.fetchMCPServers)(p);e&&Array.isArray(e)?f(e):e.data&&Array.isArray(e.data)&&f(e.data)}catch(e){console.error("Error fetching MCP servers:",e)}})()},[p,l.length]),(0,a.useEffect)(()=>{(async()=>{if(p&&i.length>0)try{let t=await e.A(601236).then(e=>e.fetchMCPAccessGroups(p));h(Array.isArray(t)?t:t.data||[])}catch(e){console.error("Error fetching MCP access groups:",e)}})()},[p,i.length]);let v=[...l.map(e=>({type:"server",value:e})),...i.map(e=>({type:"accessGroup",value:e}))],j=v.length;return(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(o,{className:"h-4 w-4 text-blue-600"}),(0,t.jsx)(r.Text,{className:"font-semibold text-gray-900",children:"MCP Servers"}),(0,t.jsx)(s.Badge,{color:"blue",size:"xs",children:j})]}),j>0?(0,t.jsx)("div",{className:"max-h-[400px] overflow-y-auto space-y-2 pr-1",children:v.map((e,r)=>{let a="server"===e.type?m[e.value]:void 0,s=a&&a.length>0,l=b.has(e.value);return(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{onClick:()=>{var t;return s&&(t=e.value,void y(e=>{let r=new Set(e);return r.has(t)?r.delete(t):r.add(t),r}))},className:`flex items-center gap-3 py-2 px-3 rounded-lg border border-gray-200 transition-all ${s?"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)(u.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=g.find(t=>t.server_id===e);if(t){let r=e.length>7?`${e.slice(0,3)}...${e.slice(-4)}`:e;return`${t.alias} (${r})`}return e})(e.value)})]})}):(0,t.jsxs)("div",{className:"inline-flex items-center gap-2 min-w-0",children:[(0,t.jsx)("span",{className:"inline-block w-1.5 h-1.5 bg-green-500 rounded-full flex-shrink-0"}),(0,t.jsx)("span",{className:"text-sm font-medium text-gray-900 truncate",children:e.value}),(0,t.jsx)("span",{className:"ml-1 px-1.5 py-0.5 text-[9px] font-semibold text-green-600 bg-green-50 border border-green-200 rounded uppercase tracking-wide flex-shrink-0",children:"Group"})]})}),s&&(0,t.jsxs)("div",{className:"flex items-center gap-1 flex-shrink-0 whitespace-nowrap",children:[(0,t.jsx)("span",{className:"text-xs font-medium text-gray-600",children:a.length}),(0,t.jsx)("span",{className:"text-xs text-gray-500",children:1===a.length?"tool":"tools"}),l?(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"})]})]}),s&&l&&(0,t.jsx)("div",{className:"ml-4 pl-4 border-l-2 border-blue-200 pb-1",children:(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5",children:a.map((e,r)=>(0,t.jsx)("span",{className:"inline-flex items-center px-2.5 py-1 rounded-lg bg-blue-50 border border-blue-200 text-blue-800 text-xs font-medium",children:e},r))})})]},r)})}):(0,t.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-50 border border-gray-200",children:[(0,t.jsx)(o,{className:"h-4 w-4 text-gray-400"}),(0,t.jsx)(r.Text,{className:"text-gray-500 text-sm",children:"No MCP servers or access groups configured"})]})]})},p=a.forwardRef(function(e,t){return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z"}))}),g=function({agents:e,agentAccessGroups:l=[],accessToken:i}){let[o,c]=(0,a.useState)([]);(0,a.useEffect)(()=>{(async()=>{if(i&&e.length>0)try{let e=await (0,n.getAgentsList)(i);e&&e.agents&&Array.isArray(e.agents)&&c(e.agents)}catch(e){console.error("Error fetching agents:",e)}})()},[i,e.length]);let d=[...e.map(e=>({type:"agent",value:e})),...l.map(e=>({type:"accessGroup",value:e}))],m=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)(p,{className:"h-4 w-4 text-purple-600"}),(0,t.jsx)(r.Text,{className:"font-semibold text-gray-900",children:"Agents"}),(0,t.jsx)(s.Badge,{color:"purple",size:"xs",children:m})]}),m>0?(0,t.jsx)("div",{className:"max-h-[400px] overflow-y-auto space-y-2 pr-1",children:d.map((e,r)=>(0,t.jsx)("div",{className:"space-y-2",children:(0,t.jsx)("div",{className:"flex items-center gap-3 py-2 px-3 rounded-lg border border-gray-200 bg-white",children:(0,t.jsx)("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:"agent"===e.type?(0,t.jsx)(u.Tooltip,{title:`Full ID: ${e.value}`,placement:"top",children:(0,t.jsxs)("div",{className:"inline-flex items-center gap-2 min-w-0",children:[(0,t.jsx)("span",{className:"inline-block w-1.5 h-1.5 bg-purple-500 rounded-full flex-shrink-0"}),(0,t.jsx)("span",{className:"text-sm font-medium text-gray-900 truncate",children:(e=>{let t=o.find(t=>t.agent_id===e);if(t){let r=e.length>7?`${e.slice(0,3)}...${e.slice(-4)}`:e;return`${t.agent_name} (${r})`}return e})(e.value)})]})}):(0,t.jsxs)("div",{className:"inline-flex items-center gap-2 min-w-0",children:[(0,t.jsx)("span",{className:"inline-block w-1.5 h-1.5 bg-green-500 rounded-full flex-shrink-0"}),(0,t.jsx)("span",{className:"text-sm font-medium text-gray-900 truncate",children:e.value}),(0,t.jsx)("span",{className:"ml-1 px-1.5 py-0.5 text-[9px] font-semibold text-green-600 bg-green-50 border border-green-200 rounded uppercase tracking-wide flex-shrink-0",children:"Group"})]})})})},r))}):(0,t.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-50 border border-gray-200",children:[(0,t.jsx)(p,{className:"h-4 w-4 text-gray-400"}),(0,t.jsx)(r.Text,{className:"text-gray-500 text-sm",children:"No agents or access groups configured"})]})]})};e.s(["default",0,function({objectPermission:e,variant:a="card",className:s="",accessToken:l}){let n=e?.vector_stores||[],o=e?.mcp_servers||[],c=e?.mcp_access_groups||[],d=e?.mcp_tool_permissions||{},u=e?.agents||[],p=e?.agent_access_groups||[],f=(0,t.jsxs)("div",{className:"card"===a?"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6":"space-y-4",children:[(0,t.jsx)(i,{vectorStores:n,accessToken:l}),(0,t.jsx)(m,{mcpServers:o,mcpAccessGroups:c,mcpToolPermissions:d,accessToken:l}),(0,t.jsx)(g,{agents:u,agentAccessGroups:p,accessToken:l})]});return"card"===a?(0,t.jsxs)("div",{className:`bg-white border border-gray-200 rounded-lg p-6 ${s}`,children:[(0,t.jsx)("div",{className:"flex items-center gap-2 mb-6",children:(0,t.jsxs)("div",{children:[(0,t.jsx)(r.Text,{className:"font-semibold text-gray-900",children:"Object Permissions"}),(0,t.jsx)(r.Text,{className:"text-xs text-gray-500",children:"Access control for Vector Stores and MCP Servers"})]})}),f]}):(0,t.jsxs)("div",{className:`${s}`,children:[(0,t.jsx)(r.Text,{className:"font-medium text-gray-900 mb-3",children:"Object Permissions"}),f]})}],384767)},270345,e=>{"use strict";var t=e.i(764205);let r=async(e,r,a,s)=>"Admin"!=a&&"Admin Viewer"!=a?await (0,t.teamListCall)(e,s?.organization_id||null,r):await (0,t.teamListCall)(e,s?.organization_id||null);e.s(["fetchTeams",0,r])},519756,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:"M400 317.7h73.9V656c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V317.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 163a8 8 0 00-12.6 0l-112 141.7c-4.1 5.3-.4 13 6.3 13zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"}}]},name:"upload",theme:"outlined"};var s=e.i(9583),l=r.forwardRef(function(e,l){return r.createElement(s.default,(0,t.default)({},e,{ref:l,icon:a}))});e.s(["UploadOutlined",0,l],519756)},981339,e=>{"use strict";var t=e.i(185793);e.s(["Skeleton",()=>t.default])},500330,e=>{"use strict";var t=e.i(727749);function r(e,t){let r=structuredClone(e);for(let[e,a]of Object.entries(t))e in r&&(r[e]=a);return r}let a=(e,t=0,r=!1,a=!0)=>{if(null==e||!Number.isFinite(e)||0===e&&!a)return"-";let s={minimumFractionDigits:t,maximumFractionDigits:t};if(!r)return e.toLocaleString("en-US",s);let l=e<0?"-":"",n=Math.abs(e),i=n,o="";return n>=1e6?(i=n/1e6,o="M"):n>=1e3&&(i=n/1e3,o="K"),`${l}${i.toLocaleString("en-US",s)}${o}`},s=async(e,r="Copied to clipboard")=>{if(!e)return!1;if(!navigator||!navigator.clipboard||!navigator.clipboard.writeText)return l(e,r);try{return await navigator.clipboard.writeText(e),t.default.success(r),!0}catch(t){return console.error("Clipboard API failed: ",t),l(e,r)}},l=(e,r)=>{try{let a=document.createElement("textarea");a.value=e,a.style.position="fixed",a.style.left="-999999px",a.style.top="-999999px",a.setAttribute("readonly",""),document.body.appendChild(a),a.focus(),a.select();let s=document.execCommand("copy");if(document.body.removeChild(a),s)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,s,"formatNumberWithCommas",0,a,"getSpendString",0,(e,t=6)=>{if(null==e||!Number.isFinite(e)||0===e)return"-";let r=a(e,t,!1,!1);if(0===Number(r.replace(/,/g,""))){let e=(1/10**t).toFixed(t);return`< $${e}`}return`$${r}`},"updateExistingKeys",()=>r])},743151,(e,t,r)=>{"use strict";function a(e){return(a="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 s=i(e.r(271645)),l=i(e.r(844343)),n=["text","onCopy","options","children"];function i(e){return e&&e.__esModule?e:{default:e}}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,a)}return r}function c(e){for(var t=1;t=0||(s[r]=e[r]);return s}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}(e,n),a=s.default.Children.only(t);return s.default.cloneElement(a,c(c({},r),{},{onClick:this.onClick}))}}],function(e,t){for(var r=0;r{"use strict";var a=e.r(743151).CopyToClipboard;a.CopyToClipboard=a,t.exports=a},109799,e=>{"use strict";var t=e.i(135214),r=e.i(764205),a=e.i(266027),s=e.i(912598);let l=(0,e.i(243652).createQueryKeys)("organizations");e.s(["useOrganization",0,e=>{let n=(0,s.useQueryClient)(),{accessToken:i}=(0,t.default)();return(0,a.useQuery)({queryKey:l.detail(e),enabled:!!(i&&e),queryFn:async()=>{if(!i||!e)throw Error("Missing auth or teamId");return(0,r.organizationInfoCall)(i,e)},initialData:()=>{if(!e)return;let t=n.getQueryData(l.list({}));return t?.find(t=>t.organization_id===e)}})},"useOrganizations",0,()=>{let{accessToken:e,userId:s,userRole:n}=(0,t.default)();return(0,a.useQuery)({queryKey:l.list({}),queryFn:async()=>await (0,r.organizationListCall)(e),enabled:!!(e&&s&&n)})}])},309426,e=>{"use strict";var t=e.i(290571),r=e.i(444755),a=e.i(673706),s=e.i(271645),l=e.i(46757);let n=(0,a.makeClassName)("Col"),i=s.default.forwardRef((e,a)=>{let i,o,c,d,{numColSpan:u=1,numColSpanSm:m,numColSpanMd:p,numColSpanLg:g,children:f,className:x}=e,h=(0,t.__rest)(e,["numColSpan","numColSpanSm","numColSpanMd","numColSpanLg","children","className"]),b=(e,t)=>e&&Object.keys(t).includes(String(e))?t[e]:"";return s.default.createElement("div",Object.assign({ref:a,className:(0,r.tremorTwMerge)(n("root"),(i=b(u,l.colSpan),o=b(m,l.colSpanSm),c=b(p,l.colSpanMd),d=b(g,l.colSpanLg),(0,r.tremorTwMerge)(i,o,c,d)),x)},h),f)});i.displayName="Col",e.s(["Col",()=>i],309426)},988297,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4v16m8-8H4"}))});e.s(["PlusIcon",0,r],988297)},797672,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"}))});e.s(["PencilIcon",0,r],797672)},992619,e=>{"use strict";var t=e.i(843476),r=e.i(271645),a=e.i(779241),s=e.i(599724),l=e.i(199133),n=e.i(983561),i=e.i(689020);e.s(["default",0,({accessToken:e,value:o,placeholder:c="Select a Model",onChange:d,disabled:u=!1,style:m,className:p,showLabel:g=!0,labelText:f="Select Model"})=>{let[x,h]=(0,r.useState)(o),[b,y]=(0,r.useState)(!1),[v,j]=(0,r.useState)([]),w=(0,r.useRef)(null);return(0,r.useEffect)(()=>{h(o)},[o]),(0,r.useEffect)(()=>{e&&(async()=>{try{let t=await (0,i.fetchAvailableModels)(e);console.log("Fetched models for selector:",t),t.length>0&&j(t)}catch(e){console.error("Error fetching model info:",e)}})()},[e]),(0,t.jsxs)("div",{children:[g&&(0,t.jsxs)(s.Text,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,t.jsx)(n.RobotOutlined,{className:"mr-2"})," ",f]}),(0,t.jsx)(l.Select,{value:x,placeholder:c,onChange:e=>{"custom"===e?(y(!0),h(void 0)):(y(!1),h(e),d&&d(e))},options:[...Array.from(new Set(v.map(e=>e.model_group))).map((e,t)=>({value:e,label:e,key:t})),{value:"custom",label:"Enter custom model",key:"custom"}],style:{width:"100%",...m},showSearch:!0,className:`rounded-md ${p||""}`,disabled:u}),b&&(0,t.jsx)(a.TextInput,{className:"mt-2",placeholder:"Enter custom model name",onValueChange:e=>{w.current&&clearTimeout(w.current),w.current=setTimeout(()=>{h(e),d&&d(e)},500)},disabled:u})]})}])},91739,e=>{"use strict";var t=e.i(544195);e.s(["Radio",()=>t.default])},409797,e=>{"use strict";var t=e.i(631171);e.s(["ChevronDownIcon",()=>t.default])},500727,696609,531516,e=>{"use strict";var t=e.i(266027),r=e.i(243652),a=e.i(764205),s=e.i(135214);let l=(0,r.createQueryKeys)("mcpServers");e.s(["useMCPServers",0,e=>{let{accessToken:r}=(0,s.default)();return(0,t.useQuery)({queryKey:l.list(e?{filters:{teamId:e}}:void 0),queryFn:async()=>await (0,a.fetchMCPServers)(r,e),enabled:!!r})}],500727);var n=e.i(843476),i=e.i(271645),o=e.i(536916),c=e.i(599724),d=e.i(409797),u=e.i(246349),u=u;let m=/\b(delete|remove|destroy|purge|drop|erase|unlink)\b/i,p=/\b(create|add|insert|new|post|submit|register|make|generate|write|upload)\b/i,g=/\b(update|edit|modify|change|patch|put|set|rename|move|transform)\b/i,f=/\b(get|read|list|fetch|search|find|query|retrieve|show|view|check|describe|info)\b/i;function x(e,t=""){let r=e.toLowerCase();if(f.test(r))return"read";if(m.test(r))return"delete";if(g.test(r))return"update";if(p.test(r))return"create";if(t){let e=t.toLowerCase();if(f.test(e))return"read";if(m.test(e))return"delete";if(g.test(e))return"update";if(p.test(e))return"create"}return"unknown"}function h(e){let t={read:[],create:[],update:[],delete:[],unknown:[]};for(let r of e)t[x(r.name,r.description)].push(r);return t}let b={read:{label:"Read",description:"Safe operations — fetch, list, search. No side effects.",risk:"low"},create:{label:"Create",description:"Add new resources — insert, upload, register.",risk:"medium"},update:{label:"Update",description:"Modify existing resources — edit, patch, rename.",risk:"medium"},delete:{label:"Delete",description:"Destructive operations — remove, purge, destroy.",risk:"high"},unknown:{label:"Other",description:"Operations that could not be automatically classified.",risk:"unknown"}};e.s(["CRUD_GROUP_META",0,b,"classifyToolOp",()=>x,"groupToolsByCrud",()=>h],696609);let y=["read","create","update","delete","unknown"],v={low:"bg-green-100 text-green-800",medium:"bg-yellow-100 text-yellow-800",high:"bg-red-100 text-red-800 font-semibold",unknown:"bg-gray-100 text-gray-700"},j={read:"border-green-200",create:"border-blue-200",update:"border-yellow-200",delete:"border-red-300",unknown:"border-gray-200"},w={read:"bg-green-50",create:"bg-blue-50",update:"bg-yellow-50",delete:"bg-red-50",unknown:"bg-gray-50"};e.s(["default",0,({tools:e,value:t,onChange:r,readOnly:a=!1,searchFilter:s=""})=>{let[l,m]=(0,i.useState)({read:!1,create:!1,update:!1,delete:!1,unknown:!0}),p=(0,i.useMemo)(()=>h(e),[e]),g=(0,i.useMemo)(()=>new Set(void 0===t?e.map(e=>e.name):t),[t,e]),f=e=>{if(a)return;let t=new Set(g);t.has(e)?t.delete(e):t.add(e),r(Array.from(t))};return 0===e.length?null:(0,n.jsx)("div",{className:"space-y-3",children:y.map(e=>{let t,i=p[e];if(0===i.length)return null;if(s){let e=s.toLowerCase();if(!i.some(t=>t.name.toLowerCase().includes(e)||(t.description??"").toLowerCase().includes(e)))return null}let x=b[e],h=(t=p[e]).length>0&&t.every(e=>g.has(e.name)),y=(e=>{let t=p[e];if(0===t.length)return!1;let r=t.filter(e=>g.has(e.name)).length;return r>0&&r{m(t=>({...t,[e]:!t[e]}))},children:[N?(0,n.jsx)(u.default,{className:"w-4 h-4 text-gray-500 flex-shrink-0"}):(0,n.jsx)(d.ChevronDownIcon,{className:"w-4 h-4 text-gray-500 flex-shrink-0"}),(0,n.jsx)("span",{className:"font-semibold text-gray-900 text-sm",children:x.label}),(0,n.jsx)("span",{className:`text-xs px-2 py-0.5 rounded-full ${v[x.risk]}`,children:"high"===x.risk?"High Risk":"medium"===x.risk?"Medium Risk":"low"===x.risk?"Safe":"Unclassified"}),(0,n.jsxs)("span",{className:"text-xs text-gray-500 ml-1",children:[i.filter(e=>g.has(e.name)).length,"/",i.length," allowed"]})]}),!a&&(0,n.jsxs)("div",{className:"flex items-center gap-2 ml-4",children:[(0,n.jsx)(c.Text,{className:"text-xs text-gray-500",children:h?"All on":y?"Partial":"All off"}),(0,n.jsx)(o.Checkbox,{checked:h,indeterminate:y,onChange:t=>((e,t)=>{if(a)return;let s=new Set(g);for(let r of p[e])t?s.add(r.name):s.delete(r.name);r(Array.from(s))})(e,t.target.checked),onClick:e=>e.stopPropagation()})]})]}),!N&&(0,n.jsx)("div",{className:"px-4 pt-2 pb-1 text-xs text-gray-500 bg-white border-b border-gray-100",children:x.description}),!N&&(0,n.jsx)("div",{className:"bg-white divide-y divide-gray-50",children:i.filter(e=>!s||e.name.toLowerCase().includes(s.toLowerCase())||(e.description??"").toLowerCase().includes(s.toLowerCase())).map(e=>{let t,r=(t=e.name,g.has(t));return(0,n.jsxs)("div",{className:`flex items-start gap-3 px-4 py-2.5 transition-colors hover:bg-gray-50 ${!a?"cursor-pointer":""} ${r?"":"opacity-60"}`,onClick:()=>f(e.name),children:[(0,n.jsx)(o.Checkbox,{checked:r,onChange:()=>f(e.name),disabled:a,onClick:e=>e.stopPropagation()}),(0,n.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,n.jsx)(c.Text,{className:"font-medium text-gray-900 text-sm",children:e.name}),e.description&&(0,n.jsx)(c.Text,{className:"text-xs text-gray-500 mt-0.5 leading-snug",children:e.description})]}),(0,n.jsx)("span",{className:`text-xs px-1.5 py-0.5 rounded flex-shrink-0 ${r?"bg-green-100 text-green-700":"bg-gray-100 text-gray-500"}`,children:r?"on":"off"})]},e.name)})})]},e)})})}],531516)},361653,e=>{"use strict";let t=(0,e.i(475254).default)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);e.s(["default",()=>t])},603908,e=>{"use strict";let t=(0,e.i(475254).default)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);e.s(["default",()=>t])},841947,e=>{"use strict";let t=(0,e.i(475254).default)("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);e.s(["default",()=>t])},793130,e=>{"use strict";var t=e.i(290571),r=e.i(429427),a=e.i(371330),s=e.i(271645),l=e.i(394487),n=e.i(503269),i=e.i(214520),o=e.i(746725),c=e.i(914189),d=e.i(144279),u=e.i(294316),m=e.i(601893),p=e.i(140721),g=e.i(942803),f=e.i(233538),x=e.i(694421),h=e.i(700020),b=e.i(35889),y=e.i(998348),v=e.i(722678);let j=(0,s.createContext)(null);j.displayName="GroupContext";let w=s.Fragment,N=Object.assign((0,h.forwardRefWithAs)(function(e,t){var w;let N=(0,s.useId)(),k=(0,g.useProvidedId)(),C=(0,m.useDisabled)(),{id:S=k||`headlessui-switch-${N}`,disabled:M=C||!1,checked:_,defaultChecked:O,onChange:T,name:E,value:P,form:L,autoFocus:R=!1,...F}=e,$=(0,s.useContext)(j),[A,D]=(0,s.useState)(null),B=(0,s.useRef)(null),I=(0,u.useSyncRefs)(B,t,null===$?null:$.setSwitch,D),z=(0,i.useDefaultValue)(O),[q,K]=(0,n.useControllable)(_,T,null!=z&&z),V=(0,o.useDisposables)(),[G,H]=(0,s.useState)(!1),U=(0,c.useEvent)(()=>{H(!0),null==K||K(!q),V.nextFrame(()=>{H(!1)})}),Q=(0,c.useEvent)(e=>{if((0,f.isDisabledReactIssue7711)(e.currentTarget))return e.preventDefault();e.preventDefault(),U()}),W=(0,c.useEvent)(e=>{e.key===y.Keys.Space?(e.preventDefault(),U()):e.key===y.Keys.Enter&&(0,x.attemptSubmit)(e.currentTarget)}),J=(0,c.useEvent)(e=>e.preventDefault()),X=(0,v.useLabelledBy)(),Y=(0,b.useDescribedBy)(),{isFocusVisible:Z,focusProps:ee}=(0,r.useFocusRing)({autoFocus:R}),{isHovered:et,hoverProps:er}=(0,a.useHover)({isDisabled:M}),{pressed:ea,pressProps:es}=(0,l.useActivePress)({disabled:M}),el=(0,s.useMemo)(()=>({checked:q,disabled:M,hover:et,focus:Z,active:ea,autofocus:R,changing:G}),[q,et,Z,ea,M,G,R]),en=(0,h.mergeProps)({id:S,ref:I,role:"switch",type:(0,d.useResolveButtonType)(e,A),tabIndex:-1===e.tabIndex?0:null!=(w=e.tabIndex)?w:0,"aria-checked":q,"aria-labelledby":X,"aria-describedby":Y,disabled:M||void 0,autoFocus:R,onClick:Q,onKeyUp:W,onKeyPress:J},ee,er,es),ei=(0,s.useCallback)(()=>{if(void 0!==z)return null==K?void 0:K(z)},[K,z]),eo=(0,h.useRender)();return s.default.createElement(s.default.Fragment,null,null!=E&&s.default.createElement(p.FormFields,{disabled:M,data:{[E]:P||"on"},overrides:{type:"checkbox",checked:q},form:L,onReset:ei}),eo({ourProps:en,theirProps:F,slot:el,defaultTag:"button",name:"Switch"}))}),{Group:function(e){var t;let[r,a]=(0,s.useState)(null),[l,n]=(0,v.useLabels)(),[i,o]=(0,b.useDescriptions)(),c=(0,s.useMemo)(()=>({switch:r,setSwitch:a}),[r,a]),d=(0,h.useRender)();return s.default.createElement(o,{name:"Switch.Description",value:i},s.default.createElement(n,{name:"Switch.Label",value:l,props:{htmlFor:null==(t=c.switch)?void 0:t.id,onClick(e){r&&(e.currentTarget instanceof HTMLLabelElement&&e.preventDefault(),r.click(),r.focus({preventScroll:!0}))}}},s.default.createElement(j.Provider,{value:c},d({ourProps:{},theirProps:e,slot:{},defaultTag:w,name:"Switch.Group"}))))},Label:v.Label,Description:b.Description});var k=e.i(888288),C=e.i(95779),S=e.i(444755),M=e.i(673706),_=e.i(829087);let O=(0,M.makeClassName)("Switch"),T=s.default.forwardRef((e,r)=>{let{checked:a,defaultChecked:l=!1,onChange:n,color:i,name:o,error:c,errorMessage:d,disabled:u,required:m,tooltip:p,id:g}=e,f=(0,t.__rest)(e,["checked","defaultChecked","onChange","color","name","error","errorMessage","disabled","required","tooltip","id"]),x={bgColor:i?(0,M.getColorClassNames)(i,C.colorPalette.background).bgColor:"bg-tremor-brand dark:bg-dark-tremor-brand",ringColor:i?(0,M.getColorClassNames)(i,C.colorPalette.ring).ringColor:"ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted"},[h,b]=(0,k.default)(l,a),[y,v]=(0,s.useState)(!1),{tooltipProps:j,getReferenceProps:w}=(0,_.useTooltip)(300);return s.default.createElement("div",{className:"flex flex-row items-center justify-start"},s.default.createElement(_.default,Object.assign({text:p},j)),s.default.createElement("div",Object.assign({ref:(0,M.mergeRefs)([r,j.refs.setReference]),className:(0,S.tremorTwMerge)(O("root"),"flex flex-row relative h-5")},f,w),s.default.createElement("input",{type:"checkbox",className:(0,S.tremorTwMerge)(O("input"),"absolute w-5 h-5 cursor-pointer left-0 top-0 opacity-0"),name:o,required:m,checked:h,onChange:e=>{e.preventDefault()}}),s.default.createElement(N,{checked:h,onChange:e=>{b(e),null==n||n(e)},disabled:u,className:(0,S.tremorTwMerge)(O("switch"),"w-10 h-5 group relative inline-flex shrink-0 cursor-pointer items-center justify-center rounded-tremor-full","focus:outline-none",u?"cursor-not-allowed":""),onFocus:()=>v(!0),onBlur:()=>v(!1),id:g},s.default.createElement("span",{className:(0,S.tremorTwMerge)(O("sr-only"),"sr-only")},"Switch ",h?"on":"off"),s.default.createElement("span",{"aria-hidden":"true",className:(0,S.tremorTwMerge)(O("background"),h?x.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,S.tremorTwMerge)(O("round"),h?(0,S.tremorTwMerge)(x.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,S.tremorTwMerge)("ring-2",x.ringColor):"")}))),c&&d?s.default.createElement("p",{className:(0,S.tremorTwMerge)(O("errorMessage"),"text-sm text-red-500 mt-1 ")},d):null)});T.displayName="Switch",e.s(["Switch",()=>T],793130)},158392,419470,e=>{"use strict";var t=e.i(843476),r=e.i(779241);let a={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,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"max-w-3xl",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Latency-Based Configuration"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Fine-tune latency-based routing behavior"})]}),(0,t.jsx)("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2 xl:grid-cols-3",children:Object.entries(e||a).map(([e,a])=>(0,t.jsx)("div",{className:"space-y-2",children:(0,t.jsxs)("label",{className:"block",children:[(0,t.jsx)("span",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:e.replace(/_/g," ")}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-0.5 mb-2",children:s[e]||""}),(0,t.jsx)(r.TextInput,{name:e,defaultValue:"object"==typeof a?JSON.stringify(a,null,2):a?.toString(),className:"font-mono text-sm w-full"})]})},e))})]}),(0,t.jsx)("div",{className:"border-t border-gray-200"})]})},l=({routerSettings:e,routerFieldsMetadata:a})=>(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"max-w-3xl",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Reliability & Retries"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Configure retry logic and failure handling"})]}),(0,t.jsx)("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2 xl:grid-cols-3",children:Object.entries(e).filter(([e,t])=>"fallbacks"!=e&&"context_window_fallbacks"!=e&&"routing_strategy_args"!=e&&"routing_strategy"!=e&&"enable_tag_filtering"!=e).map(([e,s])=>(0,t.jsx)("div",{className:"space-y-2",children:(0,t.jsxs)("label",{className:"block",children:[(0,t.jsx)("span",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:a[e]?.ui_field_name||e}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-0.5 mb-2",children:a[e]?.field_description||""}),(0,t.jsx)(r.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 n=e.i(199133);let i=({selectedStrategy:e,availableStrategies:r,routingStrategyDescriptions:a,routerFieldsMetadata:s,onStrategyChange:l})=>(0,t.jsxs)("div",{className:"space-y-2 max-w-3xl",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:s.routing_strategy?.ui_field_name||"Routing Strategy"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-0.5 mb-2",children:s.routing_strategy?.field_description||""})]}),(0,t.jsx)("div",{className:"routing-strategy-select max-w-3xl",children:(0,t.jsx)(n.Select,{value:e,onChange:l,style:{width:"100%"},size:"large",children:r.map(e=>(0,t.jsx)(n.Select.Option,{value:e,label:e,children:(0,t.jsxs)("div",{className:"flex flex-col gap-0.5 py-1",children:[(0,t.jsx)("span",{className:"font-mono text-sm font-medium",children:e}),a[e]&&(0,t.jsx)("span",{className:"text-xs text-gray-500 font-normal",children:a[e]})]})},e))})})]});var o=e.i(793130);let c=({enabled:e,routerFieldsMetadata:r,onToggle:a})=>(0,t.jsx)("div",{className:"space-y-3 max-w-3xl",children:(0,t.jsxs)("div",{className:"flex items-start justify-between",children:[(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)("label",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:r.enable_tag_filtering?.ui_field_name||"Enable Tag Filtering"}),(0,t.jsxs)("p",{className:"text-xs text-gray-500 mt-0.5",children:[r.enable_tag_filtering?.field_description||"",r.enable_tag_filtering?.link&&(0,t.jsxs)(t.Fragment,{children:[" ",(0,t.jsx)("a",{href:r.enable_tag_filtering.link,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-800 underline",children:"Learn more"})]})]})]}),(0,t.jsx)(o.Switch,{checked:e,onChange:a,className:"ml-4"})]})});e.s(["default",0,({value:e,onChange:r,routerFieldsMetadata:a,availableRoutingStrategies:n,routingStrategyDescriptions:o})=>(0,t.jsxs)("div",{className:"w-full space-y-8 py-2",children:[(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"max-w-3xl",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Routing Settings"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Configure how requests are routed to deployments"})]}),n.length>0&&(0,t.jsx)(i,{selectedStrategy:e.selectedStrategy||e.routerSettings.routing_strategy||null,availableStrategies:n,routingStrategyDescriptions:o,routerFieldsMetadata:a,onStrategyChange:t=>{r({...e,selectedStrategy:t})}}),(0,t.jsx)(c,{enabled:e.enableTagFiltering,routerFieldsMetadata:a,onToggle:t=>{r({...e,enableTagFiltering:t})}})]}),(0,t.jsx)("div",{className:"border-t border-gray-200"}),"latency-based-routing"===e.selectedStrategy&&(0,t.jsx)(s,{routingStrategyArgs:e.routerSettings.routing_strategy_args}),(0,t.jsx)(l,{routerSettings:e.routerSettings,routerFieldsMetadata:a})]})],158392);var d=e.i(994388),u=e.i(998573),m=e.i(653496),p=e.i(107233),g=e.i(271645),f=e.i(592968),x=e.i(361653),x=x;let h=(0,e.i(475254).default)("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);var b=e.i(37727);function y({group:e,onChange:r,availableModels:a,maxFallbacks:s}){let l=a.filter(t=>t!==e.primaryModel),i=e.fallbackModels.length{let a=[...e.fallbackModels];a.includes(t)&&(a=a.filter(e=>e!==t)),r({...e,primaryModel:t,fallbackModels:a})},showSearch:!0,filterOption:(e,t)=>(t?.label??"").toLowerCase().includes(e.toLowerCase()),options:a.map(e=>({label:e,value:e}))}),!e.primaryModel&&(0,t.jsxs)("div",{className:"mt-2 flex items-center gap-2 text-amber-600 text-xs bg-amber-50 p-2 rounded",children:[(0,t.jsx)(x.default,{className:"w-4 h-4"}),(0,t.jsx)("span",{children:"Select a model to begin configuring fallbacks"})]})]}),(0,t.jsx)("div",{className:"flex items-center justify-center -my-4 z-10",children:(0,t.jsxs)("div",{className:"bg-indigo-50 text-indigo-500 px-4 py-1 rounded-full text-xs font-bold border border-indigo-100 flex items-center gap-2 shadow-sm",children:[(0,t.jsx)(h,{className:"w-4 h-4"}),"IF FAILS, TRY..."]})}),(0,t.jsxs)("div",{className:`transition-opacity duration-300 ${!e.primaryModel?"opacity-50 pointer-events-none":"opacity-100"}`,children:[(0,t.jsxs)("label",{className:"block text-sm font-semibold text-gray-700 mb-2",children:["Fallback Chain ",(0,t.jsx)("span",{className:"text-red-500",children:"*"}),(0,t.jsxs)("span",{className:"text-xs text-gray-500 font-normal ml-2",children:["(Max ",s," fallbacks at a time)"]})]}),(0,t.jsxs)("div",{className:"bg-gray-50 rounded-xl p-4 border border-gray-200",children:[(0,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsx)(n.Select,{mode:"multiple",className:"w-full",size:"large",placeholder:i?"Select fallback models to add...":`Maximum ${s} fallbacks reached`,value:e.fallbackModels,onChange:t=>{let a=t.slice(0,s);r({...e,fallbackModels:a})},disabled:!e.primaryModel,options:l.map(e=>({label:e,value:e})),optionRender:(r,a)=>{let s=e.fallbackModels.includes(r.value),l=s?e.fallbackModels.indexOf(r.value)+1:null;return(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[s&&null!==l&&(0,t.jsx)("span",{className:"flex items-center justify-center w-5 h-5 rounded bg-indigo-100 text-indigo-600 text-xs font-bold",children:l}),(0,t.jsx)("span",{children:r.label})]})},maxTagCount:"responsive",maxTagPlaceholder:e=>(0,t.jsx)(f.Tooltip,{styles:{root:{pointerEvents:"none"}},title:e.map(({value:e})=>e).join(", "),children:(0,t.jsxs)("span",{children:["+",e.length," more"]})}),showSearch:!0,filterOption:(e,t)=>(t?.label??"").toLowerCase().includes(e.toLowerCase())}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1 ml-1",children:i?`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,t.jsx)("div",{className:"space-y-2 min-h-[100px]",children:0===e.fallbackModels.length?(0,t.jsxs)("div",{className:"h-32 border-2 border-dashed border-gray-300 rounded-lg flex flex-col items-center justify-center text-gray-400",children:[(0,t.jsx)("span",{className:"text-sm",children:"No fallback models selected"}),(0,t.jsx)("span",{className:"text-xs mt-1",children:"Add models from the dropdown above"})]}):e.fallbackModels.map((a,s)=>(0,t.jsxs)("div",{className:"group flex items-center justify-between p-3 bg-white rounded-lg border border-gray-200 hover:border-indigo-300 hover:shadow-sm transition-all",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"flex items-center justify-center w-6 h-6 rounded bg-gray-100 text-gray-400 group-hover:text-indigo-500 group-hover:bg-indigo-50",children:(0,t.jsx)("span",{className:"text-xs font-bold",children:s+1})}),(0,t.jsx)("div",{children:(0,t.jsx)("span",{className:"font-medium text-gray-800",children:a})})]}),(0,t.jsx)("button",{type:"button",onClick:()=>{let t;return t=e.fallbackModels.filter((e,t)=>t!==s),void r({...e,fallbackModels:t})},className:"opacity-0 group-hover:opacity-100 transition-opacity text-gray-400 hover:text-red-500 p-1",children:(0,t.jsx)(b.X,{className:"w-4 h-4"})})]},`${a}-${s}`))})]})]})]})}function v({groups:e,onGroupsChange:r,availableModels:a,maxFallbacks:s=10,maxGroups:l=5}){let[n,i]=(0,g.useState)(e.length>0?e[0].id:"1");(0,g.useEffect)(()=>{e.length>0?e.some(e=>e.id===n)||i(e[0].id):i("1")},[e]);let o=()=>{if(e.length>=l)return;let t=Date.now().toString();r([...e,{id:t,primaryModel:null,fallbackModels:[]}]),i(t)},c=t=>{r(e.map(e=>e.id===t.id?t:e))},f=e.map((r,l)=>{let n=r.primaryModel?r.primaryModel:`Group ${l+1}`;return{key:r.id,label:n,closable:e.length>1,children:(0,t.jsx)(y,{group:r,onChange:c,availableModels:a,maxFallbacks:s})}});return 0===e.length?(0,t.jsxs)("div",{className:"text-center py-12 bg-gray-50 rounded-lg border border-dashed border-gray-300",children:[(0,t.jsx)("p",{className:"text-gray-500 mb-4",children:"No fallback groups configured"}),(0,t.jsx)(d.Button,{variant:"primary",onClick:o,icon:()=>(0,t.jsx)(p.Plus,{className:"w-4 h-4"}),children:"Create First Group"})]}):(0,t.jsx)(m.Tabs,{type:"editable-card",activeKey:n,onChange:i,onEdit:(t,a)=>{"add"===a?o():"remove"===a&&e.length>1&&(t=>{if(1===e.length)return u.message.warning("At least one group is required");let a=e.filter(e=>e.id!==t);r(a),n===t&&a.length>0&&i(a[a.length-1].id)})(t)},items:f,className:"fallback-tabs",tabBarStyle:{marginBottom:0},hideAdd:e.length>=l})}e.s(["FallbackSelectionForm",()=>v],419470)}]); \ No newline at end of file +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,384767,e=>{"use strict";var t=e.i(843476),r=e.i(599724),a=e.i(271645),s=e.i(389083);let l=a.forwardRef(function(e,t){return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 7v10c0 2.21 3.582 4 8 4s8-1.79 8-4V7M4 7c0 2.21 3.582 4 8 4s8-1.79 8-4M4 7c0-2.21 3.582-4 8-4s8 1.79 8 4m0 5c0 2.21-3.582 4-8 4s-8-1.79-8-4"}))});var n=e.i(764205);let i=function({vectorStores:e,accessToken:i}){let[o,c]=(0,a.useState)([]);return(0,a.useEffect)(()=>{(async()=>{if(i&&0!==e.length)try{let e=await (0,n.vectorStoreListCall)(i);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)}})()},[i,e.length]),(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(l,{className:"h-4 w-4 text-blue-600"}),(0,t.jsx)(r.Text,{className:"font-semibold text-gray-900",children:"Vector Stores"}),(0,t.jsx)(s.Badge,{color:"blue",size:"xs",children:e.length})]}),e.length>0?(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:e.map((e,r)=>{let a;return(0,t.jsx)("div",{className:"inline-flex items-center px-3 py-1.5 rounded-lg bg-blue-50 border border-blue-200 text-blue-800 text-sm font-medium",children:(a=o.find(t=>t.vector_store_id===e))?`${a.vector_store_name||a.vector_store_id} (${a.vector_store_id})`:e},r)})}):(0,t.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-50 border border-gray-200",children:[(0,t.jsx)(l,{className:"h-4 w-4 text-gray-400"}),(0,t.jsx)(r.Text,{className:"text-gray-500 text-sm",children:"No vector stores configured"})]})]})},o=a.forwardRef(function(e,t){return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 12h14M5 12a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v4a2 2 0 01-2 2M5 12a2 2 0 00-2 2v4a2 2 0 002 2h14a2 2 0 002-2v-4a2 2 0 00-2-2m-2-4h.01M17 16h.01"}))});var c=e.i(871943),d=e.i(502547),u=e.i(592968);let m=function({mcpServers:l,mcpAccessGroups:i=[],mcpToolPermissions:m={},accessToken:p}){let[g,f]=(0,a.useState)([]),[x,h]=(0,a.useState)([]),[b,y]=(0,a.useState)(new Set);(0,a.useEffect)(()=>{(async()=>{if(p&&l.length>0)try{let e=await (0,n.fetchMCPServers)(p);e&&Array.isArray(e)?f(e):e.data&&Array.isArray(e.data)&&f(e.data)}catch(e){console.error("Error fetching MCP servers:",e)}})()},[p,l.length]),(0,a.useEffect)(()=>{(async()=>{if(p&&i.length>0)try{let t=await e.A(601236).then(e=>e.fetchMCPAccessGroups(p));h(Array.isArray(t)?t:t.data||[])}catch(e){console.error("Error fetching MCP access groups:",e)}})()},[p,i.length]);let v=[...l.map(e=>({type:"server",value:e})),...i.map(e=>({type:"accessGroup",value:e}))],j=v.length;return(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(o,{className:"h-4 w-4 text-blue-600"}),(0,t.jsx)(r.Text,{className:"font-semibold text-gray-900",children:"MCP Servers"}),(0,t.jsx)(s.Badge,{color:"blue",size:"xs",children:j})]}),j>0?(0,t.jsx)("div",{className:"max-h-[400px] overflow-y-auto space-y-2 pr-1",children:v.map((e,r)=>{let a="server"===e.type?m[e.value]:void 0,s=a&&a.length>0,l=b.has(e.value);return(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{onClick:()=>{var t;return s&&(t=e.value,void y(e=>{let r=new Set(e);return r.has(t)?r.delete(t):r.add(t),r}))},className:`flex items-center gap-3 py-2 px-3 rounded-lg border border-gray-200 transition-all ${s?"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)(u.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=g.find(t=>t.server_id===e);if(t){let r=e.length>7?`${e.slice(0,3)}...${e.slice(-4)}`:e;return`${t.alias} (${r})`}return e})(e.value)})]})}):(0,t.jsxs)("div",{className:"inline-flex items-center gap-2 min-w-0",children:[(0,t.jsx)("span",{className:"inline-block w-1.5 h-1.5 bg-green-500 rounded-full flex-shrink-0"}),(0,t.jsx)("span",{className:"text-sm font-medium text-gray-900 truncate",children:e.value}),(0,t.jsx)("span",{className:"ml-1 px-1.5 py-0.5 text-[9px] font-semibold text-green-600 bg-green-50 border border-green-200 rounded uppercase tracking-wide flex-shrink-0",children:"Group"})]})}),s&&(0,t.jsxs)("div",{className:"flex items-center gap-1 flex-shrink-0 whitespace-nowrap",children:[(0,t.jsx)("span",{className:"text-xs font-medium text-gray-600",children:a.length}),(0,t.jsx)("span",{className:"text-xs text-gray-500",children:1===a.length?"tool":"tools"}),l?(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"})]})]}),s&&l&&(0,t.jsx)("div",{className:"ml-4 pl-4 border-l-2 border-blue-200 pb-1",children:(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5",children:a.map((e,r)=>(0,t.jsx)("span",{className:"inline-flex items-center px-2.5 py-1 rounded-lg bg-blue-50 border border-blue-200 text-blue-800 text-xs font-medium",children:e},r))})})]},r)})}):(0,t.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-50 border border-gray-200",children:[(0,t.jsx)(o,{className:"h-4 w-4 text-gray-400"}),(0,t.jsx)(r.Text,{className:"text-gray-500 text-sm",children:"No MCP servers or access groups configured"})]})]})},p=a.forwardRef(function(e,t){return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z"}))}),g=function({agents:e,agentAccessGroups:l=[],accessToken:i}){let[o,c]=(0,a.useState)([]);(0,a.useEffect)(()=>{(async()=>{if(i&&e.length>0)try{let e=await (0,n.getAgentsList)(i);e&&e.agents&&Array.isArray(e.agents)&&c(e.agents)}catch(e){console.error("Error fetching agents:",e)}})()},[i,e.length]);let d=[...e.map(e=>({type:"agent",value:e})),...l.map(e=>({type:"accessGroup",value:e}))],m=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)(p,{className:"h-4 w-4 text-purple-600"}),(0,t.jsx)(r.Text,{className:"font-semibold text-gray-900",children:"Agents"}),(0,t.jsx)(s.Badge,{color:"purple",size:"xs",children:m})]}),m>0?(0,t.jsx)("div",{className:"max-h-[400px] overflow-y-auto space-y-2 pr-1",children:d.map((e,r)=>(0,t.jsx)("div",{className:"space-y-2",children:(0,t.jsx)("div",{className:"flex items-center gap-3 py-2 px-3 rounded-lg border border-gray-200 bg-white",children:(0,t.jsx)("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:"agent"===e.type?(0,t.jsx)(u.Tooltip,{title:`Full ID: ${e.value}`,placement:"top",children:(0,t.jsxs)("div",{className:"inline-flex items-center gap-2 min-w-0",children:[(0,t.jsx)("span",{className:"inline-block w-1.5 h-1.5 bg-purple-500 rounded-full flex-shrink-0"}),(0,t.jsx)("span",{className:"text-sm font-medium text-gray-900 truncate",children:(e=>{let t=o.find(t=>t.agent_id===e);if(t){let r=e.length>7?`${e.slice(0,3)}...${e.slice(-4)}`:e;return`${t.agent_name} (${r})`}return e})(e.value)})]})}):(0,t.jsxs)("div",{className:"inline-flex items-center gap-2 min-w-0",children:[(0,t.jsx)("span",{className:"inline-block w-1.5 h-1.5 bg-green-500 rounded-full flex-shrink-0"}),(0,t.jsx)("span",{className:"text-sm font-medium text-gray-900 truncate",children:e.value}),(0,t.jsx)("span",{className:"ml-1 px-1.5 py-0.5 text-[9px] font-semibold text-green-600 bg-green-50 border border-green-200 rounded uppercase tracking-wide flex-shrink-0",children:"Group"})]})})})},r))}):(0,t.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-50 border border-gray-200",children:[(0,t.jsx)(p,{className:"h-4 w-4 text-gray-400"}),(0,t.jsx)(r.Text,{className:"text-gray-500 text-sm",children:"No agents or access groups configured"})]})]})};e.s(["default",0,function({objectPermission:e,variant:a="card",className:s="",accessToken:l}){let n=e?.vector_stores||[],o=e?.mcp_servers||[],c=e?.mcp_access_groups||[],d=e?.mcp_tool_permissions||{},u=e?.agents||[],p=e?.agent_access_groups||[],f=(0,t.jsxs)("div",{className:"card"===a?"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6":"space-y-4",children:[(0,t.jsx)(i,{vectorStores:n,accessToken:l}),(0,t.jsx)(m,{mcpServers:o,mcpAccessGroups:c,mcpToolPermissions:d,accessToken:l}),(0,t.jsx)(g,{agents:u,agentAccessGroups:p,accessToken:l})]});return"card"===a?(0,t.jsxs)("div",{className:`bg-white border border-gray-200 rounded-lg p-6 ${s}`,children:[(0,t.jsx)("div",{className:"flex items-center gap-2 mb-6",children:(0,t.jsxs)("div",{children:[(0,t.jsx)(r.Text,{className:"font-semibold text-gray-900",children:"Object Permissions"}),(0,t.jsx)(r.Text,{className:"text-xs text-gray-500",children:"Access control for Vector Stores and MCP Servers"})]})}),f]}):(0,t.jsxs)("div",{className:`${s}`,children:[(0,t.jsx)(r.Text,{className:"font-medium text-gray-900 mb-3",children:"Object Permissions"}),f]})}],384767)},270345,e=>{"use strict";var t=e.i(764205);let r=async(e,r,a,s)=>"Admin"!=a&&"Admin Viewer"!=a?await (0,t.teamListCall)(e,s?.organization_id||null,r):await (0,t.teamListCall)(e,s?.organization_id||null);e.s(["fetchTeams",0,r])},519756,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:"M400 317.7h73.9V656c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V317.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 163a8 8 0 00-12.6 0l-112 141.7c-4.1 5.3-.4 13 6.3 13zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"}}]},name:"upload",theme:"outlined"};var s=e.i(9583),l=r.forwardRef(function(e,l){return r.createElement(s.default,(0,t.default)({},e,{ref:l,icon:a}))});e.s(["UploadOutlined",0,l],519756)},981339,e=>{"use strict";var t=e.i(185793);e.s(["Skeleton",()=>t.default])},500330,e=>{"use strict";var t=e.i(727749);function r(e,t){let r=structuredClone(e);for(let[e,a]of Object.entries(t))e in r&&(r[e]=a);return r}let a=(e,t=0,r=!1,a=!0)=>{if(null==e||!Number.isFinite(e)||0===e&&!a)return"-";let s={minimumFractionDigits:t,maximumFractionDigits:t};if(!r)return e.toLocaleString("en-US",s);let l=e<0?"-":"",n=Math.abs(e),i=n,o="";return n>=1e6?(i=n/1e6,o="M"):n>=1e3&&(i=n/1e3,o="K"),`${l}${i.toLocaleString("en-US",s)}${o}`},s=async(e,r="Copied to clipboard")=>{if(!e)return!1;if(!navigator||!navigator.clipboard||!navigator.clipboard.writeText)return l(e,r);try{return await navigator.clipboard.writeText(e),t.default.success(r),!0}catch(t){return console.error("Clipboard API failed: ",t),l(e,r)}},l=(e,r)=>{try{let a=document.createElement("textarea");a.value=e,a.style.position="fixed",a.style.left="-999999px",a.style.top="-999999px",a.setAttribute("readonly",""),document.body.appendChild(a),a.focus(),a.select();let s=document.execCommand("copy");if(document.body.removeChild(a),s)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,s,"formatNumberWithCommas",0,a,"getSpendString",0,(e,t=6)=>{if(null==e||!Number.isFinite(e)||0===e)return"-";let r=a(e,t,!1,!1);if(0===Number(r.replace(/,/g,""))){let e=(1/10**t).toFixed(t);return`< $${e}`}return`$${r}`},"updateExistingKeys",()=>r])},743151,(e,t,r)=>{"use strict";function a(e){return(a="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 s=i(e.r(271645)),l=i(e.r(844343)),n=["text","onCopy","options","children"];function i(e){return e&&e.__esModule?e:{default:e}}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,a)}return r}function c(e){for(var t=1;t=0||(s[r]=e[r]);return s}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}(e,n),a=s.default.Children.only(t);return s.default.cloneElement(a,c(c({},r),{},{onClick:this.onClick}))}}],function(e,t){for(var r=0;r{"use strict";var a=e.r(743151).CopyToClipboard;a.CopyToClipboard=a,t.exports=a},109799,e=>{"use strict";var t=e.i(135214),r=e.i(764205),a=e.i(266027),s=e.i(912598);let l=(0,e.i(243652).createQueryKeys)("organizations");e.s(["useOrganization",0,e=>{let n=(0,s.useQueryClient)(),{accessToken:i}=(0,t.default)();return(0,a.useQuery)({queryKey:l.detail(e),enabled:!!(i&&e),queryFn:async()=>{if(!i||!e)throw Error("Missing auth or teamId");return(0,r.organizationInfoCall)(i,e)},initialData:()=>{if(!e)return;let t=n.getQueryData(l.list({}));return t?.find(t=>t.organization_id===e)}})},"useOrganizations",0,()=>{let{accessToken:e,userId:s,userRole:n}=(0,t.default)();return(0,a.useQuery)({queryKey:l.list({}),queryFn:async()=>await (0,r.organizationListCall)(e),enabled:!!(e&&s&&n)})}])},309426,e=>{"use strict";var t=e.i(290571),r=e.i(444755),a=e.i(673706),s=e.i(271645),l=e.i(46757);let n=(0,a.makeClassName)("Col"),i=s.default.forwardRef((e,a)=>{let i,o,c,d,{numColSpan:u=1,numColSpanSm:m,numColSpanMd:p,numColSpanLg:g,children:f,className:x}=e,h=(0,t.__rest)(e,["numColSpan","numColSpanSm","numColSpanMd","numColSpanLg","children","className"]),b=(e,t)=>e&&Object.keys(t).includes(String(e))?t[e]:"";return s.default.createElement("div",Object.assign({ref:a,className:(0,r.tremorTwMerge)(n("root"),(i=b(u,l.colSpan),o=b(m,l.colSpanSm),c=b(p,l.colSpanMd),d=b(g,l.colSpanLg),(0,r.tremorTwMerge)(i,o,c,d)),x)},h),f)});i.displayName="Col",e.s(["Col",()=>i],309426)},988297,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4v16m8-8H4"}))});e.s(["PlusIcon",0,r],988297)},797672,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"}))});e.s(["PencilIcon",0,r],797672)},992619,e=>{"use strict";var t=e.i(843476),r=e.i(271645),a=e.i(779241),s=e.i(599724),l=e.i(199133),n=e.i(983561),i=e.i(689020);e.s(["default",0,({accessToken:e,value:o,placeholder:c="Select a Model",onChange:d,disabled:u=!1,style:m,className:p,showLabel:g=!0,labelText:f="Select Model"})=>{let[x,h]=(0,r.useState)(o),[b,y]=(0,r.useState)(!1),[v,j]=(0,r.useState)([]),w=(0,r.useRef)(null);return(0,r.useEffect)(()=>{h(o)},[o]),(0,r.useEffect)(()=>{e&&(async()=>{try{let t=await (0,i.fetchAvailableModels)(e);console.log("Fetched models for selector:",t),t.length>0&&j(t)}catch(e){console.error("Error fetching model info:",e)}})()},[e]),(0,t.jsxs)("div",{children:[g&&(0,t.jsxs)(s.Text,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,t.jsx)(n.RobotOutlined,{className:"mr-2"})," ",f]}),(0,t.jsx)(l.Select,{value:x,placeholder:c,onChange:e=>{"custom"===e?(y(!0),h(void 0)):(y(!1),h(e),d&&d(e))},options:[...Array.from(new Set(v.map(e=>e.model_group))).map((e,t)=>({value:e,label:e,key:t})),{value:"custom",label:"Enter custom model",key:"custom"}],style:{width:"100%",...m},showSearch:!0,className:`rounded-md ${p||""}`,disabled:u}),b&&(0,t.jsx)(a.TextInput,{className:"mt-2",placeholder:"Enter custom model name",onValueChange:e=>{w.current&&clearTimeout(w.current),w.current=setTimeout(()=>{h(e),d&&d(e)},500)},disabled:u})]})}])},91739,e=>{"use strict";var t=e.i(544195);e.s(["Radio",()=>t.default])},409797,e=>{"use strict";var t=e.i(631171);e.s(["ChevronDownIcon",()=>t.default])},500727,696609,531516,e=>{"use strict";var t=e.i(266027),r=e.i(243652),a=e.i(764205),s=e.i(135214);let l=(0,r.createQueryKeys)("mcpServers");e.s(["useMCPServers",0,e=>{let{accessToken:r}=(0,s.default)();return(0,t.useQuery)({queryKey:l.list(e?{filters:{teamId:e}}:void 0),queryFn:async()=>await (0,a.fetchMCPServers)(r,e),enabled:!!r})}],500727);var n=e.i(843476),i=e.i(271645),o=e.i(536916),c=e.i(599724),d=e.i(409797),u=e.i(246349),u=u;let m=/\b(delete|remove|destroy|purge|drop|erase|unlink)\b/i,p=/\b(create|add|insert|new|post|submit|register|make|generate|write|upload)\b/i,g=/\b(update|edit|modify|change|patch|put|set|rename|move|transform)\b/i,f=/\b(get|read|list|fetch|search|find|query|retrieve|show|view|check|describe|info)\b/i;function x(e,t=""){let r=e.toLowerCase();if(f.test(r))return"read";if(m.test(r))return"delete";if(g.test(r))return"update";if(p.test(r))return"create";if(t){let e=t.toLowerCase();if(f.test(e))return"read";if(m.test(e))return"delete";if(g.test(e))return"update";if(p.test(e))return"create"}return"unknown"}function h(e){let t={read:[],create:[],update:[],delete:[],unknown:[]};for(let r of e)t[x(r.name,r.description)].push(r);return t}let b={read:{label:"Read",description:"Safe operations — fetch, list, search. No side effects.",risk:"low"},create:{label:"Create",description:"Add new resources — insert, upload, register.",risk:"medium"},update:{label:"Update",description:"Modify existing resources — edit, patch, rename.",risk:"medium"},delete:{label:"Delete",description:"Destructive operations — remove, purge, destroy.",risk:"high"},unknown:{label:"Other",description:"Operations that could not be automatically classified.",risk:"unknown"}};e.s(["CRUD_GROUP_META",0,b,"classifyToolOp",()=>x,"groupToolsByCrud",()=>h],696609);let y=["read","create","update","delete","unknown"],v={low:"bg-green-100 text-green-800",medium:"bg-yellow-100 text-yellow-800",high:"bg-red-100 text-red-800 font-semibold",unknown:"bg-gray-100 text-gray-700"},j={read:"border-green-200",create:"border-blue-200",update:"border-yellow-200",delete:"border-red-300",unknown:"border-gray-200"},w={read:"bg-green-50",create:"bg-blue-50",update:"bg-yellow-50",delete:"bg-red-50",unknown:"bg-gray-50"};e.s(["default",0,({tools:e,value:t,onChange:r,readOnly:a=!1,searchFilter:s=""})=>{let[l,m]=(0,i.useState)({read:!1,create:!1,update:!1,delete:!1,unknown:!0}),p=(0,i.useMemo)(()=>h(e),[e]),g=(0,i.useMemo)(()=>new Set(void 0===t?e.map(e=>e.name):t),[t,e]),f=e=>{if(a)return;let t=new Set(g);t.has(e)?t.delete(e):t.add(e),r(Array.from(t))};return 0===e.length?null:(0,n.jsx)("div",{className:"space-y-3",children:y.map(e=>{let t,i=p[e];if(0===i.length)return null;if(s){let e=s.toLowerCase();if(!i.some(t=>t.name.toLowerCase().includes(e)||(t.description??"").toLowerCase().includes(e)))return null}let x=b[e],h=(t=p[e]).length>0&&t.every(e=>g.has(e.name)),y=(e=>{let t=p[e];if(0===t.length)return!1;let r=t.filter(e=>g.has(e.name)).length;return r>0&&r{m(t=>({...t,[e]:!t[e]}))},children:[N?(0,n.jsx)(u.default,{className:"w-4 h-4 text-gray-500 flex-shrink-0"}):(0,n.jsx)(d.ChevronDownIcon,{className:"w-4 h-4 text-gray-500 flex-shrink-0"}),(0,n.jsx)("span",{className:"font-semibold text-gray-900 text-sm",children:x.label}),(0,n.jsx)("span",{className:`text-xs px-2 py-0.5 rounded-full ${v[x.risk]}`,children:"high"===x.risk?"High Risk":"medium"===x.risk?"Medium Risk":"low"===x.risk?"Safe":"Unclassified"}),(0,n.jsxs)("span",{className:"text-xs text-gray-500 ml-1",children:[i.filter(e=>g.has(e.name)).length,"/",i.length," allowed"]})]}),!a&&(0,n.jsxs)("div",{className:"flex items-center gap-2 ml-4",children:[(0,n.jsx)(c.Text,{className:"text-xs text-gray-500",children:h?"All on":y?"Partial":"All off"}),(0,n.jsx)(o.Checkbox,{checked:h,indeterminate:y,onChange:t=>((e,t)=>{if(a)return;let s=new Set(g);for(let r of p[e])t?s.add(r.name):s.delete(r.name);r(Array.from(s))})(e,t.target.checked),onClick:e=>e.stopPropagation()})]})]}),!N&&(0,n.jsx)("div",{className:"px-4 pt-2 pb-1 text-xs text-gray-500 bg-white border-b border-gray-100",children:x.description}),!N&&(0,n.jsx)("div",{className:"bg-white divide-y divide-gray-50",children:i.filter(e=>!s||e.name.toLowerCase().includes(s.toLowerCase())||(e.description??"").toLowerCase().includes(s.toLowerCase())).map(e=>{let t,r=(t=e.name,g.has(t));return(0,n.jsxs)("div",{className:`flex items-start gap-3 px-4 py-2.5 transition-colors hover:bg-gray-50 ${!a?"cursor-pointer":""} ${r?"":"opacity-60"}`,onClick:()=>f(e.name),children:[(0,n.jsx)(o.Checkbox,{checked:r,onChange:()=>f(e.name),disabled:a,onClick:e=>e.stopPropagation()}),(0,n.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,n.jsx)(c.Text,{className:"font-medium text-gray-900 text-sm",children:e.name}),e.description&&(0,n.jsx)(c.Text,{className:"text-xs text-gray-500 mt-0.5 leading-snug",children:e.description})]}),(0,n.jsx)("span",{className:`text-xs px-1.5 py-0.5 rounded flex-shrink-0 ${r?"bg-green-100 text-green-700":"bg-gray-100 text-gray-500"}`,children:r?"on":"off"})]},e.name)})})]},e)})})}],531516)},361653,e=>{"use strict";let t=(0,e.i(475254).default)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);e.s(["default",()=>t])},603908,e=>{"use strict";let t=(0,e.i(475254).default)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);e.s(["default",()=>t])},841947,e=>{"use strict";let t=(0,e.i(475254).default)("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);e.s(["default",()=>t])},793130,e=>{"use strict";var t=e.i(290571),r=e.i(429427),a=e.i(371330),s=e.i(271645),l=e.i(394487),n=e.i(503269),i=e.i(214520),o=e.i(746725),c=e.i(914189),d=e.i(144279),u=e.i(294316),m=e.i(601893),p=e.i(140721),g=e.i(942803),f=e.i(233538),x=e.i(694421),h=e.i(700020),b=e.i(35889),y=e.i(998348),v=e.i(722678);let j=(0,s.createContext)(null);j.displayName="GroupContext";let w=s.Fragment,N=Object.assign((0,h.forwardRefWithAs)(function(e,t){var w;let N=(0,s.useId)(),k=(0,g.useProvidedId)(),C=(0,m.useDisabled)(),{id:S=k||`headlessui-switch-${N}`,disabled:M=C||!1,checked:_,defaultChecked:O,onChange:T,name:E,value:P,form:L,autoFocus:R=!1,...F}=e,$=(0,s.useContext)(j),[A,D]=(0,s.useState)(null),B=(0,s.useRef)(null),I=(0,u.useSyncRefs)(B,t,null===$?null:$.setSwitch,D),z=(0,i.useDefaultValue)(O),[q,K]=(0,n.useControllable)(_,T,null!=z&&z),V=(0,o.useDisposables)(),[G,H]=(0,s.useState)(!1),U=(0,c.useEvent)(()=>{H(!0),null==K||K(!q),V.nextFrame(()=>{H(!1)})}),Q=(0,c.useEvent)(e=>{if((0,f.isDisabledReactIssue7711)(e.currentTarget))return e.preventDefault();e.preventDefault(),U()}),W=(0,c.useEvent)(e=>{e.key===y.Keys.Space?(e.preventDefault(),U()):e.key===y.Keys.Enter&&(0,x.attemptSubmit)(e.currentTarget)}),J=(0,c.useEvent)(e=>e.preventDefault()),X=(0,v.useLabelledBy)(),Y=(0,b.useDescribedBy)(),{isFocusVisible:Z,focusProps:ee}=(0,r.useFocusRing)({autoFocus:R}),{isHovered:et,hoverProps:er}=(0,a.useHover)({isDisabled:M}),{pressed:ea,pressProps:es}=(0,l.useActivePress)({disabled:M}),el=(0,s.useMemo)(()=>({checked:q,disabled:M,hover:et,focus:Z,active:ea,autofocus:R,changing:G}),[q,et,Z,ea,M,G,R]),en=(0,h.mergeProps)({id:S,ref:I,role:"switch",type:(0,d.useResolveButtonType)(e,A),tabIndex:-1===e.tabIndex?0:null!=(w=e.tabIndex)?w:0,"aria-checked":q,"aria-labelledby":X,"aria-describedby":Y,disabled:M||void 0,autoFocus:R,onClick:Q,onKeyUp:W,onKeyPress:J},ee,er,es),ei=(0,s.useCallback)(()=>{if(void 0!==z)return null==K?void 0:K(z)},[K,z]),eo=(0,h.useRender)();return s.default.createElement(s.default.Fragment,null,null!=E&&s.default.createElement(p.FormFields,{disabled:M,data:{[E]:P||"on"},overrides:{type:"checkbox",checked:q},form:L,onReset:ei}),eo({ourProps:en,theirProps:F,slot:el,defaultTag:"button",name:"Switch"}))}),{Group:function(e){var t;let[r,a]=(0,s.useState)(null),[l,n]=(0,v.useLabels)(),[i,o]=(0,b.useDescriptions)(),c=(0,s.useMemo)(()=>({switch:r,setSwitch:a}),[r,a]),d=(0,h.useRender)();return s.default.createElement(o,{name:"Switch.Description",value:i},s.default.createElement(n,{name:"Switch.Label",value:l,props:{htmlFor:null==(t=c.switch)?void 0:t.id,onClick(e){r&&(e.currentTarget instanceof HTMLLabelElement&&e.preventDefault(),r.click(),r.focus({preventScroll:!0}))}}},s.default.createElement(j.Provider,{value:c},d({ourProps:{},theirProps:e,slot:{},defaultTag:w,name:"Switch.Group"}))))},Label:v.Label,Description:b.Description});var k=e.i(888288),C=e.i(95779),S=e.i(444755),M=e.i(673706),_=e.i(829087);let O=(0,M.makeClassName)("Switch"),T=s.default.forwardRef((e,r)=>{let{checked:a,defaultChecked:l=!1,onChange:n,color:i,name:o,error:c,errorMessage:d,disabled:u,required:m,tooltip:p,id:g}=e,f=(0,t.__rest)(e,["checked","defaultChecked","onChange","color","name","error","errorMessage","disabled","required","tooltip","id"]),x={bgColor:i?(0,M.getColorClassNames)(i,C.colorPalette.background).bgColor:"bg-tremor-brand dark:bg-dark-tremor-brand",ringColor:i?(0,M.getColorClassNames)(i,C.colorPalette.ring).ringColor:"ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted"},[h,b]=(0,k.default)(l,a),[y,v]=(0,s.useState)(!1),{tooltipProps:j,getReferenceProps:w}=(0,_.useTooltip)(300);return s.default.createElement("div",{className:"flex flex-row items-center justify-start"},s.default.createElement(_.default,Object.assign({text:p},j)),s.default.createElement("div",Object.assign({ref:(0,M.mergeRefs)([r,j.refs.setReference]),className:(0,S.tremorTwMerge)(O("root"),"flex flex-row relative h-5")},f,w),s.default.createElement("input",{type:"checkbox",className:(0,S.tremorTwMerge)(O("input"),"absolute w-5 h-5 cursor-pointer left-0 top-0 opacity-0"),name:o,required:m,checked:h,onChange:e=>{e.preventDefault()}}),s.default.createElement(N,{checked:h,onChange:e=>{b(e),null==n||n(e)},disabled:u,className:(0,S.tremorTwMerge)(O("switch"),"w-10 h-5 group relative inline-flex shrink-0 cursor-pointer items-center justify-center rounded-tremor-full","focus:outline-none",u?"cursor-not-allowed":""),onFocus:()=>v(!0),onBlur:()=>v(!1),id:g},s.default.createElement("span",{className:(0,S.tremorTwMerge)(O("sr-only"),"sr-only")},"Switch ",h?"on":"off"),s.default.createElement("span",{"aria-hidden":"true",className:(0,S.tremorTwMerge)(O("background"),h?x.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,S.tremorTwMerge)(O("round"),h?(0,S.tremorTwMerge)(x.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,S.tremorTwMerge)("ring-2",x.ringColor):"")}))),c&&d?s.default.createElement("p",{className:(0,S.tremorTwMerge)(O("errorMessage"),"text-sm text-red-500 mt-1 ")},d):null)});T.displayName="Switch",e.s(["Switch",()=>T],793130)},158392,419470,e=>{"use strict";var t=e.i(843476),r=e.i(779241);let a={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,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"max-w-3xl",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Latency-Based Configuration"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Fine-tune latency-based routing behavior"})]}),(0,t.jsx)("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2 xl:grid-cols-3",children:Object.entries(e||a).map(([e,a])=>(0,t.jsx)("div",{className:"space-y-2",children:(0,t.jsxs)("label",{className:"block",children:[(0,t.jsx)("span",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:e.replace(/_/g," ")}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-0.5 mb-2",children:s[e]||""}),(0,t.jsx)(r.TextInput,{name:e,defaultValue:"object"==typeof a?JSON.stringify(a,null,2):a?.toString(),className:"font-mono text-sm w-full"})]})},e))})]}),(0,t.jsx)("div",{className:"border-t border-gray-200"})]})},l=({routerSettings:e,routerFieldsMetadata:a})=>(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"max-w-3xl",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Reliability & Retries"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Configure retry logic and failure handling"})]}),(0,t.jsx)("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2 xl:grid-cols-3",children:Object.entries(e).filter(([e,t])=>"fallbacks"!=e&&"context_window_fallbacks"!=e&&"routing_strategy_args"!=e&&"routing_strategy"!=e&&"enable_tag_filtering"!=e).map(([e,s])=>(0,t.jsx)("div",{className:"space-y-2",children:(0,t.jsxs)("label",{className:"block",children:[(0,t.jsx)("span",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:a[e]?.ui_field_name||e}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-0.5 mb-2",children:a[e]?.field_description||""}),(0,t.jsx)(r.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 n=e.i(199133);let i=({selectedStrategy:e,availableStrategies:r,routingStrategyDescriptions:a,routerFieldsMetadata:s,onStrategyChange:l})=>(0,t.jsxs)("div",{className:"space-y-2 max-w-3xl",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:s.routing_strategy?.ui_field_name||"Routing Strategy"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-0.5 mb-2",children:s.routing_strategy?.field_description||""})]}),(0,t.jsx)("div",{className:"routing-strategy-select max-w-3xl",children:(0,t.jsx)(n.Select,{value:e,onChange:l,style:{width:"100%"},size:"large",children:r.map(e=>(0,t.jsx)(n.Select.Option,{value:e,label:e,children:(0,t.jsxs)("div",{className:"flex flex-col gap-0.5 py-1",children:[(0,t.jsx)("span",{className:"font-mono text-sm font-medium",children:e}),a[e]&&(0,t.jsx)("span",{className:"text-xs text-gray-500 font-normal",children:a[e]})]})},e))})})]});var o=e.i(793130);let c=({enabled:e,routerFieldsMetadata:r,onToggle:a})=>(0,t.jsx)("div",{className:"space-y-3 max-w-3xl",children:(0,t.jsxs)("div",{className:"flex items-start justify-between",children:[(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)("label",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:r.enable_tag_filtering?.ui_field_name||"Enable Tag Filtering"}),(0,t.jsxs)("p",{className:"text-xs text-gray-500 mt-0.5",children:[r.enable_tag_filtering?.field_description||"",r.enable_tag_filtering?.link&&(0,t.jsxs)(t.Fragment,{children:[" ",(0,t.jsx)("a",{href:r.enable_tag_filtering.link,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-800 underline",children:"Learn more"})]})]})]}),(0,t.jsx)(o.Switch,{checked:e,onChange:a,className:"ml-4"})]})});e.s(["default",0,({value:e,onChange:r,routerFieldsMetadata:a,availableRoutingStrategies:n,routingStrategyDescriptions:o})=>(0,t.jsxs)("div",{className:"w-full space-y-8 py-2",children:[(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"max-w-3xl",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Routing Settings"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Configure how requests are routed to deployments"})]}),n.length>0&&(0,t.jsx)(i,{selectedStrategy:e.selectedStrategy||e.routerSettings.routing_strategy||null,availableStrategies:n,routingStrategyDescriptions:o,routerFieldsMetadata:a,onStrategyChange:t=>{r({...e,selectedStrategy:t})}}),(0,t.jsx)(c,{enabled:e.enableTagFiltering,routerFieldsMetadata:a,onToggle:t=>{r({...e,enableTagFiltering:t})}})]}),(0,t.jsx)("div",{className:"border-t border-gray-200"}),"latency-based-routing"===e.selectedStrategy&&(0,t.jsx)(s,{routingStrategyArgs:e.routerSettings.routing_strategy_args}),(0,t.jsx)(l,{routerSettings:e.routerSettings,routerFieldsMetadata:a})]})],158392);var d=e.i(994388),u=e.i(998573),m=e.i(653496),p=e.i(107233),g=e.i(271645),f=e.i(592968),x=e.i(361653),x=x;let h=(0,e.i(475254).default)("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);var b=e.i(37727);function y({group:e,onChange:r,availableModels:a,maxFallbacks:s}){let l=a.filter(t=>t!==e.primaryModel),i=e.fallbackModels.length{let a=[...e.fallbackModels];a.includes(t)&&(a=a.filter(e=>e!==t)),r({...e,primaryModel:t,fallbackModels:a})},showSearch:!0,getPopupContainer:e=>e.parentElement||document.body,filterOption:(e,t)=>(t?.label??"").toLowerCase().includes(e.toLowerCase()),options:a.map(e=>({label:e,value:e}))}),!e.primaryModel&&(0,t.jsxs)("div",{className:"mt-2 flex items-center gap-2 text-amber-600 text-xs bg-amber-50 p-2 rounded",children:[(0,t.jsx)(x.default,{className:"w-4 h-4"}),(0,t.jsx)("span",{children:"Select a model to begin configuring fallbacks"})]})]}),(0,t.jsx)("div",{className:"flex items-center justify-center -my-4 z-10",children:(0,t.jsxs)("div",{className:"bg-indigo-50 text-indigo-500 px-4 py-1 rounded-full text-xs font-bold border border-indigo-100 flex items-center gap-2 shadow-sm",children:[(0,t.jsx)(h,{className:"w-4 h-4"}),"IF FAILS, TRY..."]})}),(0,t.jsxs)("div",{className:`transition-opacity duration-300 ${!e.primaryModel?"opacity-50 pointer-events-none":"opacity-100"}`,children:[(0,t.jsxs)("label",{className:"block text-sm font-semibold text-gray-700 mb-2",children:["Fallback Chain ",(0,t.jsx)("span",{className:"text-red-500",children:"*"}),(0,t.jsxs)("span",{className:"text-xs text-gray-500 font-normal ml-2",children:["(Max ",s," fallbacks at a time)"]})]}),(0,t.jsxs)("div",{className:"bg-gray-50 rounded-xl p-4 border border-gray-200",children:[(0,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsx)(n.Select,{mode:"multiple",className:"w-full",size:"large",placeholder:i?"Select fallback models to add...":`Maximum ${s} fallbacks reached`,value:e.fallbackModels,onChange:t=>{let a=t.slice(0,s);r({...e,fallbackModels:a})},disabled:!e.primaryModel,getPopupContainer:e=>e.parentElement||document.body,options:l.map(e=>({label:e,value:e})),optionRender:(r,a)=>{let s=e.fallbackModels.includes(r.value),l=s?e.fallbackModels.indexOf(r.value)+1:null;return(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[s&&null!==l&&(0,t.jsx)("span",{className:"flex items-center justify-center w-5 h-5 rounded bg-indigo-100 text-indigo-600 text-xs font-bold",children:l}),(0,t.jsx)("span",{children:r.label})]})},maxTagCount:"responsive",maxTagPlaceholder:e=>(0,t.jsx)(f.Tooltip,{styles:{root:{pointerEvents:"none"}},title:e.map(({value:e})=>e).join(", "),children:(0,t.jsxs)("span",{children:["+",e.length," more"]})}),showSearch:!0,filterOption:(e,t)=>(t?.label??"").toLowerCase().includes(e.toLowerCase())}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1 ml-1",children:i?`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,t.jsx)("div",{className:"space-y-2 min-h-[100px]",children:0===e.fallbackModels.length?(0,t.jsxs)("div",{className:"h-32 border-2 border-dashed border-gray-300 rounded-lg flex flex-col items-center justify-center text-gray-400",children:[(0,t.jsx)("span",{className:"text-sm",children:"No fallback models selected"}),(0,t.jsx)("span",{className:"text-xs mt-1",children:"Add models from the dropdown above"})]}):e.fallbackModels.map((a,s)=>(0,t.jsxs)("div",{className:"group flex items-center justify-between p-3 bg-white rounded-lg border border-gray-200 hover:border-indigo-300 hover:shadow-sm transition-all",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"flex items-center justify-center w-6 h-6 rounded bg-gray-100 text-gray-400 group-hover:text-indigo-500 group-hover:bg-indigo-50",children:(0,t.jsx)("span",{className:"text-xs font-bold",children:s+1})}),(0,t.jsx)("div",{children:(0,t.jsx)("span",{className:"font-medium text-gray-800",children:a})})]}),(0,t.jsx)("button",{type:"button",onClick:()=>{let t;return t=e.fallbackModels.filter((e,t)=>t!==s),void r({...e,fallbackModels:t})},className:"opacity-0 group-hover:opacity-100 transition-opacity text-gray-400 hover:text-red-500 p-1",children:(0,t.jsx)(b.X,{className:"w-4 h-4"})})]},`${a}-${s}`))})]})]})]})}function v({groups:e,onGroupsChange:r,availableModels:a,maxFallbacks:s=10,maxGroups:l=5}){let[n,i]=(0,g.useState)(e.length>0?e[0].id:"1");(0,g.useEffect)(()=>{e.length>0?e.some(e=>e.id===n)||i(e[0].id):i("1")},[e]);let o=()=>{if(e.length>=l)return;let t=Date.now().toString();r([...e,{id:t,primaryModel:null,fallbackModels:[]}]),i(t)},c=t=>{r(e.map(e=>e.id===t.id?t:e))},f=e.map((r,l)=>{let n=r.primaryModel?r.primaryModel:`Group ${l+1}`;return{key:r.id,label:n,closable:e.length>1,children:(0,t.jsx)(y,{group:r,onChange:c,availableModels:a,maxFallbacks:s})}});return 0===e.length?(0,t.jsxs)("div",{className:"text-center py-12 bg-gray-50 rounded-lg border border-dashed border-gray-300",children:[(0,t.jsx)("p",{className:"text-gray-500 mb-4",children:"No fallback groups configured"}),(0,t.jsx)(d.Button,{variant:"primary",onClick:o,icon:()=>(0,t.jsx)(p.Plus,{className:"w-4 h-4"}),children:"Create First Group"})]}):(0,t.jsx)(m.Tabs,{type:"editable-card",activeKey:n,onChange:i,onEdit:(t,a)=>{"add"===a?o():"remove"===a&&e.length>1&&(t=>{if(1===e.length)return u.message.warning("At least one group is required");let a=e.filter(e=>e.id!==t);r(a),n===t&&a.length>0&&i(a[a.length-1].id)})(t)},items:f,className:"fallback-tabs",tabBarStyle:{marginBottom:0},hideAdd:e.length>=l})}e.s(["FallbackSelectionForm",()=>v],419470)}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/f2ee2fa5fe008110.js b/litellm/proxy/_experimental/out/_next/static/chunks/62a03e24dd5227b9.js similarity index 93% rename from litellm/proxy/_experimental/out/_next/static/chunks/f2ee2fa5fe008110.js rename to litellm/proxy/_experimental/out/_next/static/chunks/62a03e24dd5227b9.js index 7bfeae44ad..dc9b74ebc1 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/f2ee2fa5fe008110.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/62a03e24dd5227b9.js @@ -4,4 +4,4 @@ `]:{[`&:hover ${t}-inner`]:{borderColor:e.colorPrimary}},[`${l}:not(${l}-disabled)`]:{[`&:hover ${t}-checked:not(${t}-disabled) ${t}-inner`]:{backgroundColor:e.colorPrimaryHover,borderColor:"transparent"},[`&:hover ${t}-checked:not(${t}-disabled):after`]:{borderColor:e.colorPrimaryHover}}},{[`${t}-checked`]:{[`${t}-inner`]:{backgroundColor:e.colorPrimary,borderColor:e.colorPrimary,"&:after":{opacity:1,transform:"rotate(45deg) scale(1) translate(-50%,-50%)",transition:`all ${e.motionDurationMid} ${e.motionEaseOutBack} ${e.motionDurationFast}`}}},[` ${l}-checked:not(${l}-disabled), ${t}-checked:not(${t}-disabled) - `]:{[`&:hover ${t}-inner`]:{backgroundColor:e.colorPrimaryHover,borderColor:"transparent"}}},{[t]:{"&-indeterminate":{"&":{[`${t}-inner`]:{backgroundColor:`${e.colorBgContainer}`,borderColor:`${e.colorBorder}`,"&:after":{top:"50%",insetInlineStart:"50%",width:e.calc(e.fontSizeLG).div(2).equal(),height:e.calc(e.fontSizeLG).div(2).equal(),backgroundColor:e.colorPrimary,border:0,transform:"translate(-50%, -50%) scale(1)",opacity:1,content:'""'}},[`&:hover ${t}-inner`]:{backgroundColor:`${e.colorBgContainer}`,borderColor:`${e.colorPrimary}`}}}}},{[`${l}-disabled`]:{cursor:"not-allowed"},[`${t}-disabled`]:{[`&, ${t}-input`]:{cursor:"not-allowed",pointerEvents:"none"},[`${t}-inner`]:{background:e.colorBgContainerDisabled,borderColor:e.colorBorder,"&:after":{borderColor:e.colorTextDisabled}},"&:after":{display:"none"},"& + span":{color:e.colorTextDisabled},[`&${t}-indeterminate ${t}-inner::after`]:{background:e.colorTextDisabled}}}]})((0,o.mergeToken)(t,{checkboxCls:`.${e}`,checkboxSize:t.controlInteractiveSize}))}let s=(0,l.genStyleHooks)("Checkbox",(e,{prefixCls:t})=>[n(t,e)]);e.s(["default",0,s,"getStyle",()=>n],236836)},374276,e=>{"use strict";e.i(247167);var t=e.i(271645),r=e.i(343794),a=e.i(91874),l=e.i(611935),o=e.i(121872),n=e.i(26905),s=e.i(242064),i=e.i(937328),c=e.i(321883),d=e.i(62139),u=e.i(421512),m=e.i(236836),g=e.i(681216),p=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 l=0,a=Object.getOwnPropertySymbols(e);lt.indexOf(a[l])&&Object.prototype.propertyIsEnumerable.call(e,a[l])&&(r[a[l]]=e[a[l]]);return r};let f=t.forwardRef((e,f)=>{var h;let{prefixCls:x,className:b,rootClassName:y,children:v,indeterminate:w=!1,style:k,onMouseEnter:C,onMouseLeave:j,skipGroup:N=!1,disabled:S}=e,$=p(e,["prefixCls","className","rootClassName","children","indeterminate","style","onMouseEnter","onMouseLeave","skipGroup","disabled"]),{getPrefixCls:M,direction:E,checkbox:O}=t.useContext(s.ConfigContext),T=t.useContext(u.default),{isFormItemInput:P}=t.useContext(d.FormItemInputContext),_=t.useContext(i.default),z=null!=(h=(null==T?void 0:T.disabled)||S)?h:_,R=t.useRef($.value),I=t.useRef(null),L=(0,l.composeRef)(f,I);t.useEffect(()=>{null==T||T.registerValue($.value)},[]),t.useEffect(()=>{if(!N)return $.value!==R.current&&(null==T||T.cancelValue(R.current),null==T||T.registerValue($.value),R.current=$.value),()=>null==T?void 0:T.cancelValue($.value)},[$.value]),t.useEffect(()=>{var e;(null==(e=I.current)?void 0:e.input)&&(I.current.input.indeterminate=w)},[w]);let D=M("checkbox",x),B=(0,c.default)(D),[F,A,q]=(0,m.default)(D,B),H=Object.assign({},$);T&&!N&&(H.onChange=(...e)=>{$.onChange&&$.onChange.apply($,e),T.toggleOption&&T.toggleOption({label:v,value:$.value})},H.name=T.name,H.checked=T.value.includes($.value));let G=(0,r.default)(`${D}-wrapper`,{[`${D}-rtl`]:"rtl"===E,[`${D}-wrapper-checked`]:H.checked,[`${D}-wrapper-disabled`]:z,[`${D}-wrapper-in-form-item`]:P},null==O?void 0:O.className,b,y,q,B,A),X=(0,r.default)({[`${D}-indeterminate`]:w},n.TARGET_CLS,A),[V,K]=(0,g.default)(H.onClick);return F(t.createElement(o.default,{component:"Checkbox",disabled:z},t.createElement("label",{className:G,style:Object.assign(Object.assign({},null==O?void 0:O.style),k),onMouseEnter:C,onMouseLeave:j,onClick:V},t.createElement(a.default,Object.assign({},H,{onClick:K,prefixCls:D,className:X,disabled:z,ref:L})),null!=v&&t.createElement("span",{className:`${D}-label`},v))))});var h=e.i(8211),x=e.i(529681),b=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 l=0,a=Object.getOwnPropertySymbols(e);lt.indexOf(a[l])&&Object.prototype.propertyIsEnumerable.call(e,a[l])&&(r[a[l]]=e[a[l]]);return r};let y=t.forwardRef((e,a)=>{let{defaultValue:l,children:o,options:n=[],prefixCls:i,className:d,rootClassName:g,style:p,onChange:y}=e,v=b(e,["defaultValue","children","options","prefixCls","className","rootClassName","style","onChange"]),{getPrefixCls:w,direction:k}=t.useContext(s.ConfigContext),[C,j]=t.useState(v.value||l||[]),[N,S]=t.useState([]);t.useEffect(()=>{"value"in v&&j(v.value||[])},[v.value]);let $=t.useMemo(()=>n.map(e=>"string"==typeof e||"number"==typeof e?{label:e,value:e}:e),[n]),M=e=>{S(t=>t.filter(t=>t!==e))},E=e=>{S(t=>[].concat((0,h.default)(t),[e]))},O=e=>{let t=C.indexOf(e.value),r=(0,h.default)(C);-1===t?r.push(e.value):r.splice(t,1),"value"in v||j(r),null==y||y(r.filter(e=>N.includes(e)).sort((e,t)=>$.findIndex(t=>t.value===e)-$.findIndex(e=>e.value===t)))},T=w("checkbox",i),P=`${T}-group`,_=(0,c.default)(T),[z,R,I]=(0,m.default)(T,_),L=(0,x.default)(v,["value","disabled"]),D=n.length?$.map(e=>t.createElement(f,{prefixCls:T,key:e.value.toString(),disabled:"disabled"in e?e.disabled:v.disabled,value:e.value,checked:C.includes(e.value),onChange:e.onChange,className:(0,r.default)(`${P}-item`,e.className),style:e.style,title:e.title,id:e.id,required:e.required},e.label)):o,B=t.useMemo(()=>({toggleOption:O,value:C,disabled:v.disabled,name:v.name,registerValue:E,cancelValue:M}),[O,C,v.disabled,v.name,E,M]),F=(0,r.default)(P,{[`${P}-rtl`]:"rtl"===k},d,g,I,_,R);return z(t.createElement("div",Object.assign({className:F,style:p},L,{ref:a}),t.createElement(u.default.Provider,{value:B},D)))});f.Group=y,f.__ANT_CHECKBOX=!0,e.s(["default",0,f],374276)},536916,e=>{"use strict";var t=e.i(374276);e.s(["Checkbox",()=>t.default])},292639,e=>{"use strict";var t=e.i(764205),r=e.i(266027);let a=(0,e.i(243652).createQueryKeys)("uiSettings");e.s(["useUISettings",0,()=>(0,r.useQuery)({queryKey:a.list({}),queryFn:async()=>await (0,t.getUiSettings)(),staleTime:36e5,gcTime:36e5})])},250980,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3m0 0v3m0-3h3m-3 0H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z"}))});e.s(["PlusCircleIcon",0,r],250980)},502547,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"}))});e.s(["ChevronRightIcon",0,r],502547)},988297,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4v16m8-8H4"}))});e.s(["PlusIcon",0,r],988297)},797672,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"}))});e.s(["PencilIcon",0,r],797672)},992619,e=>{"use strict";var t=e.i(843476),r=e.i(271645),a=e.i(779241),l=e.i(599724),o=e.i(199133),n=e.i(983561),s=e.i(689020);e.s(["default",0,({accessToken:e,value:i,placeholder:c="Select a Model",onChange:d,disabled:u=!1,style:m,className:g,showLabel:p=!0,labelText:f="Select Model"})=>{let[h,x]=(0,r.useState)(i),[b,y]=(0,r.useState)(!1),[v,w]=(0,r.useState)([]),k=(0,r.useRef)(null);return(0,r.useEffect)(()=>{x(i)},[i]),(0,r.useEffect)(()=>{e&&(async()=>{try{let t=await (0,s.fetchAvailableModels)(e);console.log("Fetched models for selector:",t),t.length>0&&w(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)(n.RobotOutlined,{className:"mr-2"})," ",f]}),(0,t.jsx)(o.Select,{value:h,placeholder:c,onChange:e=>{"custom"===e?(y(!0),x(void 0)):(y(!1),x(e),d&&d(e))},options:[...Array.from(new Set(v.map(e=>e.model_group))).map((e,t)=>({value:e,label:e,key:t})),{value:"custom",label:"Enter custom model",key:"custom"}],style:{width:"100%",...m},showSearch:!0,className:`rounded-md ${g||""}`,disabled:u}),b&&(0,t.jsx)(a.TextInput,{className:"mt-2",placeholder:"Enter custom model name",onValueChange:e=>{k.current&&clearTimeout(k.current),k.current=setTimeout(()=>{x(e),d&&d(e)},500)},disabled:u})]})}])},409797,e=>{"use strict";var t=e.i(631171);e.s(["ChevronDownIcon",()=>t.default])},91739,e=>{"use strict";var t=e.i(544195);e.s(["Radio",()=>t.default])},500727,696609,531516,e=>{"use strict";var t=e.i(266027),r=e.i(243652),a=e.i(764205),l=e.i(135214);let o=(0,r.createQueryKeys)("mcpServers");e.s(["useMCPServers",0,e=>{let{accessToken:r}=(0,l.default)();return(0,t.useQuery)({queryKey:o.list(e?{filters:{teamId:e}}:void 0),queryFn:async()=>await (0,a.fetchMCPServers)(r,e),enabled:!!r})}],500727);var n=e.i(843476),s=e.i(271645),i=e.i(536916),c=e.i(599724),d=e.i(409797),u=e.i(246349),u=u;let m=/\b(delete|remove|destroy|purge|drop|erase|unlink)\b/i,g=/\b(create|add|insert|new|post|submit|register|make|generate|write|upload)\b/i,p=/\b(update|edit|modify|change|patch|put|set|rename|move|transform)\b/i,f=/\b(get|read|list|fetch|search|find|query|retrieve|show|view|check|describe|info)\b/i;function h(e,t=""){let r=e.toLowerCase();if(f.test(r))return"read";if(m.test(r))return"delete";if(p.test(r))return"update";if(g.test(r))return"create";if(t){let e=t.toLowerCase();if(f.test(e))return"read";if(m.test(e))return"delete";if(p.test(e))return"update";if(g.test(e))return"create"}return"unknown"}function x(e){let t={read:[],create:[],update:[],delete:[],unknown:[]};for(let r of e)t[h(r.name,r.description)].push(r);return t}let b={read:{label:"Read",description:"Safe operations — fetch, list, search. No side effects.",risk:"low"},create:{label:"Create",description:"Add new resources — insert, upload, register.",risk:"medium"},update:{label:"Update",description:"Modify existing resources — edit, patch, rename.",risk:"medium"},delete:{label:"Delete",description:"Destructive operations — remove, purge, destroy.",risk:"high"},unknown:{label:"Other",description:"Operations that could not be automatically classified.",risk:"unknown"}};e.s(["CRUD_GROUP_META",0,b,"classifyToolOp",()=>h,"groupToolsByCrud",()=>x],696609);let y=["read","create","update","delete","unknown"],v={low:"bg-green-100 text-green-800",medium:"bg-yellow-100 text-yellow-800",high:"bg-red-100 text-red-800 font-semibold",unknown:"bg-gray-100 text-gray-700"},w={read:"border-green-200",create:"border-blue-200",update:"border-yellow-200",delete:"border-red-300",unknown:"border-gray-200"},k={read:"bg-green-50",create:"bg-blue-50",update:"bg-yellow-50",delete:"bg-red-50",unknown:"bg-gray-50"};e.s(["default",0,({tools:e,value:t,onChange:r,readOnly:a=!1,searchFilter:l=""})=>{let[o,m]=(0,s.useState)({read:!1,create:!1,update:!1,delete:!1,unknown:!0}),g=(0,s.useMemo)(()=>x(e),[e]),p=(0,s.useMemo)(()=>new Set(void 0===t?e.map(e=>e.name):t),[t,e]),f=e=>{if(a)return;let t=new Set(p);t.has(e)?t.delete(e):t.add(e),r(Array.from(t))};return 0===e.length?null:(0,n.jsx)("div",{className:"space-y-3",children:y.map(e=>{let t,s=g[e];if(0===s.length)return null;if(l){let e=l.toLowerCase();if(!s.some(t=>t.name.toLowerCase().includes(e)||(t.description??"").toLowerCase().includes(e)))return null}let h=b[e],x=(t=g[e]).length>0&&t.every(e=>p.has(e.name)),y=(e=>{let t=g[e];if(0===t.length)return!1;let r=t.filter(e=>p.has(e.name)).length;return r>0&&r{m(t=>({...t,[e]:!t[e]}))},children:[C?(0,n.jsx)(u.default,{className:"w-4 h-4 text-gray-500 flex-shrink-0"}):(0,n.jsx)(d.ChevronDownIcon,{className:"w-4 h-4 text-gray-500 flex-shrink-0"}),(0,n.jsx)("span",{className:"font-semibold text-gray-900 text-sm",children:h.label}),(0,n.jsx)("span",{className:`text-xs px-2 py-0.5 rounded-full ${v[h.risk]}`,children:"high"===h.risk?"High Risk":"medium"===h.risk?"Medium Risk":"low"===h.risk?"Safe":"Unclassified"}),(0,n.jsxs)("span",{className:"text-xs text-gray-500 ml-1",children:[s.filter(e=>p.has(e.name)).length,"/",s.length," allowed"]})]}),!a&&(0,n.jsxs)("div",{className:"flex items-center gap-2 ml-4",children:[(0,n.jsx)(c.Text,{className:"text-xs text-gray-500",children:x?"All on":y?"Partial":"All off"}),(0,n.jsx)(i.Checkbox,{checked:x,indeterminate:y,onChange:t=>((e,t)=>{if(a)return;let l=new Set(p);for(let r of g[e])t?l.add(r.name):l.delete(r.name);r(Array.from(l))})(e,t.target.checked),onClick:e=>e.stopPropagation()})]})]}),!C&&(0,n.jsx)("div",{className:"px-4 pt-2 pb-1 text-xs text-gray-500 bg-white border-b border-gray-100",children:h.description}),!C&&(0,n.jsx)("div",{className:"bg-white divide-y divide-gray-50",children:s.filter(e=>!l||e.name.toLowerCase().includes(l.toLowerCase())||(e.description??"").toLowerCase().includes(l.toLowerCase())).map(e=>{let t,r=(t=e.name,p.has(t));return(0,n.jsxs)("div",{className:`flex items-start gap-3 px-4 py-2.5 transition-colors hover:bg-gray-50 ${!a?"cursor-pointer":""} ${r?"":"opacity-60"}`,onClick:()=>f(e.name),children:[(0,n.jsx)(i.Checkbox,{checked:r,onChange:()=>f(e.name),disabled:a,onClick:e=>e.stopPropagation()}),(0,n.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,n.jsx)(c.Text,{className:"font-medium text-gray-900 text-sm",children:e.name}),e.description&&(0,n.jsx)(c.Text,{className:"text-xs text-gray-500 mt-0.5 leading-snug",children:e.description})]}),(0,n.jsx)("span",{className:`text-xs px-1.5 py-0.5 rounded flex-shrink-0 ${r?"bg-green-100 text-green-700":"bg-gray-100 text-gray-500"}`,children:r?"on":"off"})]},e.name)})})]},e)})})}],531516)},361653,e=>{"use strict";let t=(0,e.i(475254).default)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);e.s(["default",()=>t])},603908,e=>{"use strict";let t=(0,e.i(475254).default)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);e.s(["default",()=>t])},841947,e=>{"use strict";let t=(0,e.i(475254).default)("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);e.s(["default",()=>t])},793130,e=>{"use strict";var t=e.i(290571),r=e.i(429427),a=e.i(371330),l=e.i(271645),o=e.i(394487),n=e.i(503269),s=e.i(214520),i=e.i(746725),c=e.i(914189),d=e.i(144279),u=e.i(294316),m=e.i(601893),g=e.i(140721),p=e.i(942803),f=e.i(233538),h=e.i(694421),x=e.i(700020),b=e.i(35889),y=e.i(998348),v=e.i(722678);let w=(0,l.createContext)(null);w.displayName="GroupContext";let k=l.Fragment,C=Object.assign((0,x.forwardRefWithAs)(function(e,t){var k;let C=(0,l.useId)(),j=(0,p.useProvidedId)(),N=(0,m.useDisabled)(),{id:S=j||`headlessui-switch-${C}`,disabled:$=N||!1,checked:M,defaultChecked:E,onChange:O,name:T,value:P,form:_,autoFocus:z=!1,...R}=e,I=(0,l.useContext)(w),[L,D]=(0,l.useState)(null),B=(0,l.useRef)(null),F=(0,u.useSyncRefs)(B,t,null===I?null:I.setSwitch,D),A=(0,s.useDefaultValue)(E),[q,H]=(0,n.useControllable)(M,O,null!=A&&A),G=(0,i.useDisposables)(),[X,V]=(0,l.useState)(!1),K=(0,c.useEvent)(()=>{V(!0),null==H||H(!q),G.nextFrame(()=>{V(!1)})}),W=(0,c.useEvent)(e=>{if((0,f.isDisabledReactIssue7711)(e.currentTarget))return e.preventDefault();e.preventDefault(),K()}),U=(0,c.useEvent)(e=>{e.key===y.Keys.Space?(e.preventDefault(),K()):e.key===y.Keys.Enter&&(0,h.attemptSubmit)(e.currentTarget)}),Y=(0,c.useEvent)(e=>e.preventDefault()),Q=(0,v.useLabelledBy)(),J=(0,b.useDescribedBy)(),{isFocusVisible:Z,focusProps:ee}=(0,r.useFocusRing)({autoFocus:z}),{isHovered:et,hoverProps:er}=(0,a.useHover)({isDisabled:$}),{pressed:ea,pressProps:el}=(0,o.useActivePress)({disabled:$}),eo=(0,l.useMemo)(()=>({checked:q,disabled:$,hover:et,focus:Z,active:ea,autofocus:z,changing:X}),[q,et,Z,ea,$,X,z]),en=(0,x.mergeProps)({id:S,ref:F,role:"switch",type:(0,d.useResolveButtonType)(e,L),tabIndex:-1===e.tabIndex?0:null!=(k=e.tabIndex)?k:0,"aria-checked":q,"aria-labelledby":Q,"aria-describedby":J,disabled:$||void 0,autoFocus:z,onClick:W,onKeyUp:U,onKeyPress:Y},ee,er,el),es=(0,l.useCallback)(()=>{if(void 0!==A)return null==H?void 0:H(A)},[H,A]),ei=(0,x.useRender)();return l.default.createElement(l.default.Fragment,null,null!=T&&l.default.createElement(g.FormFields,{disabled:$,data:{[T]:P||"on"},overrides:{type:"checkbox",checked:q},form:_,onReset:es}),ei({ourProps:en,theirProps:R,slot:eo,defaultTag:"button",name:"Switch"}))}),{Group:function(e){var t;let[r,a]=(0,l.useState)(null),[o,n]=(0,v.useLabels)(),[s,i]=(0,b.useDescriptions)(),c=(0,l.useMemo)(()=>({switch:r,setSwitch:a}),[r,a]),d=(0,x.useRender)();return l.default.createElement(i,{name:"Switch.Description",value:s},l.default.createElement(n,{name:"Switch.Label",value:o,props:{htmlFor:null==(t=c.switch)?void 0:t.id,onClick(e){r&&(e.currentTarget instanceof HTMLLabelElement&&e.preventDefault(),r.click(),r.focus({preventScroll:!0}))}}},l.default.createElement(w.Provider,{value:c},d({ourProps:{},theirProps:e,slot:{},defaultTag:k,name:"Switch.Group"}))))},Label:v.Label,Description:b.Description});var j=e.i(888288),N=e.i(95779),S=e.i(444755),$=e.i(673706),M=e.i(829087);let E=(0,$.makeClassName)("Switch"),O=l.default.forwardRef((e,r)=>{let{checked:a,defaultChecked:o=!1,onChange:n,color:s,name:i,error:c,errorMessage:d,disabled:u,required:m,tooltip:g,id:p}=e,f=(0,t.__rest)(e,["checked","defaultChecked","onChange","color","name","error","errorMessage","disabled","required","tooltip","id"]),h={bgColor:s?(0,$.getColorClassNames)(s,N.colorPalette.background).bgColor:"bg-tremor-brand dark:bg-dark-tremor-brand",ringColor:s?(0,$.getColorClassNames)(s,N.colorPalette.ring).ringColor:"ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted"},[x,b]=(0,j.default)(o,a),[y,v]=(0,l.useState)(!1),{tooltipProps:w,getReferenceProps:k}=(0,M.useTooltip)(300);return l.default.createElement("div",{className:"flex flex-row items-center justify-start"},l.default.createElement(M.default,Object.assign({text:g},w)),l.default.createElement("div",Object.assign({ref:(0,$.mergeRefs)([r,w.refs.setReference]),className:(0,S.tremorTwMerge)(E("root"),"flex flex-row relative h-5")},f,k),l.default.createElement("input",{type:"checkbox",className:(0,S.tremorTwMerge)(E("input"),"absolute w-5 h-5 cursor-pointer left-0 top-0 opacity-0"),name:i,required:m,checked:x,onChange:e=>{e.preventDefault()}}),l.default.createElement(C,{checked:x,onChange:e=>{b(e),null==n||n(e)},disabled:u,className:(0,S.tremorTwMerge)(E("switch"),"w-10 h-5 group relative inline-flex shrink-0 cursor-pointer items-center justify-center rounded-tremor-full","focus:outline-none",u?"cursor-not-allowed":""),onFocus:()=>v(!0),onBlur:()=>v(!1),id:p},l.default.createElement("span",{className:(0,S.tremorTwMerge)(E("sr-only"),"sr-only")},"Switch ",x?"on":"off"),l.default.createElement("span",{"aria-hidden":"true",className:(0,S.tremorTwMerge)(E("background"),x?h.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")}),l.default.createElement("span",{"aria-hidden":"true",className:(0,S.tremorTwMerge)(E("round"),x?(0,S.tremorTwMerge)(h.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,S.tremorTwMerge)("ring-2",h.ringColor):"")}))),c&&d?l.default.createElement("p",{className:(0,S.tremorTwMerge)(E("errorMessage"),"text-sm text-red-500 mt-1 ")},d):null)});O.displayName="Switch",e.s(["Switch",()=>O],793130)},158392,419470,e=>{"use strict";var t=e.i(843476),r=e.i(779241);let a={ttl:3600,lowest_latency_buffer:0},l=({routingStrategyArgs:e})=>{let l={ttl:"Sliding window to look back over when calculating the average latency of a deployment. Default - 1 hour (in seconds).",lowest_latency_buffer:"Shuffle between deployments within this % of the lowest latency. Default - 0 (i.e. always pick lowest latency)."};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"max-w-3xl",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Latency-Based Configuration"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Fine-tune latency-based routing behavior"})]}),(0,t.jsx)("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2 xl:grid-cols-3",children:Object.entries(e||a).map(([e,a])=>(0,t.jsx)("div",{className:"space-y-2",children:(0,t.jsxs)("label",{className:"block",children:[(0,t.jsx)("span",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:e.replace(/_/g," ")}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-0.5 mb-2",children:l[e]||""}),(0,t.jsx)(r.TextInput,{name:e,defaultValue:"object"==typeof a?JSON.stringify(a,null,2):a?.toString(),className:"font-mono text-sm w-full"})]})},e))})]}),(0,t.jsx)("div",{className:"border-t border-gray-200"})]})},o=({routerSettings:e,routerFieldsMetadata:a})=>(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"max-w-3xl",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Reliability & Retries"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Configure retry logic and failure handling"})]}),(0,t.jsx)("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2 xl:grid-cols-3",children:Object.entries(e).filter(([e,t])=>"fallbacks"!=e&&"context_window_fallbacks"!=e&&"routing_strategy_args"!=e&&"routing_strategy"!=e&&"enable_tag_filtering"!=e).map(([e,l])=>(0,t.jsx)("div",{className:"space-y-2",children:(0,t.jsxs)("label",{className:"block",children:[(0,t.jsx)("span",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:a[e]?.ui_field_name||e}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-0.5 mb-2",children:a[e]?.field_description||""}),(0,t.jsx)(r.TextInput,{name:e,defaultValue:null==l||"null"===l?"":"object"==typeof l?JSON.stringify(l,null,2):l?.toString()||"",placeholder:"—",className:"font-mono text-sm w-full"})]})},e))})]});var n=e.i(199133);let s=({selectedStrategy:e,availableStrategies:r,routingStrategyDescriptions:a,routerFieldsMetadata:l,onStrategyChange:o})=>(0,t.jsxs)("div",{className:"space-y-2 max-w-3xl",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:l.routing_strategy?.ui_field_name||"Routing Strategy"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-0.5 mb-2",children:l.routing_strategy?.field_description||""})]}),(0,t.jsx)("div",{className:"routing-strategy-select max-w-3xl",children:(0,t.jsx)(n.Select,{value:e,onChange:o,style:{width:"100%"},size:"large",children:r.map(e=>(0,t.jsx)(n.Select.Option,{value:e,label:e,children:(0,t.jsxs)("div",{className:"flex flex-col gap-0.5 py-1",children:[(0,t.jsx)("span",{className:"font-mono text-sm font-medium",children:e}),a[e]&&(0,t.jsx)("span",{className:"text-xs text-gray-500 font-normal",children:a[e]})]})},e))})})]});var i=e.i(793130);let c=({enabled:e,routerFieldsMetadata:r,onToggle:a})=>(0,t.jsx)("div",{className:"space-y-3 max-w-3xl",children:(0,t.jsxs)("div",{className:"flex items-start justify-between",children:[(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)("label",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:r.enable_tag_filtering?.ui_field_name||"Enable Tag Filtering"}),(0,t.jsxs)("p",{className:"text-xs text-gray-500 mt-0.5",children:[r.enable_tag_filtering?.field_description||"",r.enable_tag_filtering?.link&&(0,t.jsxs)(t.Fragment,{children:[" ",(0,t.jsx)("a",{href:r.enable_tag_filtering.link,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-800 underline",children:"Learn more"})]})]})]}),(0,t.jsx)(i.Switch,{checked:e,onChange:a,className:"ml-4"})]})});e.s(["default",0,({value:e,onChange:r,routerFieldsMetadata:a,availableRoutingStrategies:n,routingStrategyDescriptions:i})=>(0,t.jsxs)("div",{className:"w-full space-y-8 py-2",children:[(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"max-w-3xl",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Routing Settings"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Configure how requests are routed to deployments"})]}),n.length>0&&(0,t.jsx)(s,{selectedStrategy:e.selectedStrategy||e.routerSettings.routing_strategy||null,availableStrategies:n,routingStrategyDescriptions:i,routerFieldsMetadata:a,onStrategyChange:t=>{r({...e,selectedStrategy:t})}}),(0,t.jsx)(c,{enabled:e.enableTagFiltering,routerFieldsMetadata:a,onToggle:t=>{r({...e,enableTagFiltering:t})}})]}),(0,t.jsx)("div",{className:"border-t border-gray-200"}),"latency-based-routing"===e.selectedStrategy&&(0,t.jsx)(l,{routingStrategyArgs:e.routerSettings.routing_strategy_args}),(0,t.jsx)(o,{routerSettings:e.routerSettings,routerFieldsMetadata:a})]})],158392);var d=e.i(994388),u=e.i(998573),m=e.i(653496),g=e.i(107233),p=e.i(271645),f=e.i(592968),h=e.i(361653),h=h;let x=(0,e.i(475254).default)("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);var b=e.i(37727);function y({group:e,onChange:r,availableModels:a,maxFallbacks:l}){let o=a.filter(t=>t!==e.primaryModel),s=e.fallbackModels.length{let a=[...e.fallbackModels];a.includes(t)&&(a=a.filter(e=>e!==t)),r({...e,primaryModel:t,fallbackModels:a})},showSearch:!0,filterOption:(e,t)=>(t?.label??"").toLowerCase().includes(e.toLowerCase()),options:a.map(e=>({label:e,value:e}))}),!e.primaryModel&&(0,t.jsxs)("div",{className:"mt-2 flex items-center gap-2 text-amber-600 text-xs bg-amber-50 p-2 rounded",children:[(0,t.jsx)(h.default,{className:"w-4 h-4"}),(0,t.jsx)("span",{children:"Select a model to begin configuring fallbacks"})]})]}),(0,t.jsx)("div",{className:"flex items-center justify-center -my-4 z-10",children:(0,t.jsxs)("div",{className:"bg-indigo-50 text-indigo-500 px-4 py-1 rounded-full text-xs font-bold border border-indigo-100 flex items-center gap-2 shadow-sm",children:[(0,t.jsx)(x,{className:"w-4 h-4"}),"IF FAILS, TRY..."]})}),(0,t.jsxs)("div",{className:`transition-opacity duration-300 ${!e.primaryModel?"opacity-50 pointer-events-none":"opacity-100"}`,children:[(0,t.jsxs)("label",{className:"block text-sm font-semibold text-gray-700 mb-2",children:["Fallback Chain ",(0,t.jsx)("span",{className:"text-red-500",children:"*"}),(0,t.jsxs)("span",{className:"text-xs text-gray-500 font-normal ml-2",children:["(Max ",l," fallbacks at a time)"]})]}),(0,t.jsxs)("div",{className:"bg-gray-50 rounded-xl p-4 border border-gray-200",children:[(0,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsx)(n.Select,{mode:"multiple",className:"w-full",size:"large",placeholder:s?"Select fallback models to add...":`Maximum ${l} fallbacks reached`,value:e.fallbackModels,onChange:t=>{let a=t.slice(0,l);r({...e,fallbackModels:a})},disabled:!e.primaryModel,options:o.map(e=>({label:e,value:e})),optionRender:(r,a)=>{let l=e.fallbackModels.includes(r.value),o=l?e.fallbackModels.indexOf(r.value)+1:null;return(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[l&&null!==o&&(0,t.jsx)("span",{className:"flex items-center justify-center w-5 h-5 rounded bg-indigo-100 text-indigo-600 text-xs font-bold",children:o}),(0,t.jsx)("span",{children:r.label})]})},maxTagCount:"responsive",maxTagPlaceholder:e=>(0,t.jsx)(f.Tooltip,{styles:{root:{pointerEvents:"none"}},title:e.map(({value:e})=>e).join(", "),children:(0,t.jsxs)("span",{children:["+",e.length," more"]})}),showSearch:!0,filterOption:(e,t)=>(t?.label??"").toLowerCase().includes(e.toLowerCase())}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1 ml-1",children:s?`Search and select multiple models. Selected models will appear below in order. (${e.fallbackModels.length}/${l} used)`:`Maximum ${l} fallbacks reached. Remove some to add more.`})]}),(0,t.jsx)("div",{className:"space-y-2 min-h-[100px]",children:0===e.fallbackModels.length?(0,t.jsxs)("div",{className:"h-32 border-2 border-dashed border-gray-300 rounded-lg flex flex-col items-center justify-center text-gray-400",children:[(0,t.jsx)("span",{className:"text-sm",children:"No fallback models selected"}),(0,t.jsx)("span",{className:"text-xs mt-1",children:"Add models from the dropdown above"})]}):e.fallbackModels.map((a,l)=>(0,t.jsxs)("div",{className:"group flex items-center justify-between p-3 bg-white rounded-lg border border-gray-200 hover:border-indigo-300 hover:shadow-sm transition-all",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"flex items-center justify-center w-6 h-6 rounded bg-gray-100 text-gray-400 group-hover:text-indigo-500 group-hover:bg-indigo-50",children:(0,t.jsx)("span",{className:"text-xs font-bold",children:l+1})}),(0,t.jsx)("div",{children:(0,t.jsx)("span",{className:"font-medium text-gray-800",children:a})})]}),(0,t.jsx)("button",{type:"button",onClick:()=>{let t;return t=e.fallbackModels.filter((e,t)=>t!==l),void r({...e,fallbackModels:t})},className:"opacity-0 group-hover:opacity-100 transition-opacity text-gray-400 hover:text-red-500 p-1",children:(0,t.jsx)(b.X,{className:"w-4 h-4"})})]},`${a}-${l}`))})]})]})]})}function v({groups:e,onGroupsChange:r,availableModels:a,maxFallbacks:l=10,maxGroups:o=5}){let[n,s]=(0,p.useState)(e.length>0?e[0].id:"1");(0,p.useEffect)(()=>{e.length>0?e.some(e=>e.id===n)||s(e[0].id):s("1")},[e]);let i=()=>{if(e.length>=o)return;let t=Date.now().toString();r([...e,{id:t,primaryModel:null,fallbackModels:[]}]),s(t)},c=t=>{r(e.map(e=>e.id===t.id?t:e))},f=e.map((r,o)=>{let n=r.primaryModel?r.primaryModel:`Group ${o+1}`;return{key:r.id,label:n,closable:e.length>1,children:(0,t.jsx)(y,{group:r,onChange:c,availableModels:a,maxFallbacks:l})}});return 0===e.length?(0,t.jsxs)("div",{className:"text-center py-12 bg-gray-50 rounded-lg border border-dashed border-gray-300",children:[(0,t.jsx)("p",{className:"text-gray-500 mb-4",children:"No fallback groups configured"}),(0,t.jsx)(d.Button,{variant:"primary",onClick:i,icon:()=>(0,t.jsx)(g.Plus,{className:"w-4 h-4"}),children:"Create First Group"})]}):(0,t.jsx)(m.Tabs,{type:"editable-card",activeKey:n,onChange:s,onEdit:(t,a)=>{"add"===a?i():"remove"===a&&e.length>1&&(t=>{if(1===e.length)return u.message.warning("At least one group is required");let a=e.filter(e=>e.id!==t);r(a),n===t&&a.length>0&&s(a[a.length-1].id)})(t)},items:f,className:"fallback-tabs",tabBarStyle:{marginBottom:0},hideAdd:e.length>=o})}e.s(["FallbackSelectionForm",()=>v],419470)}]); \ No newline at end of file + `]:{[`&:hover ${t}-inner`]:{backgroundColor:e.colorPrimaryHover,borderColor:"transparent"}}},{[t]:{"&-indeterminate":{"&":{[`${t}-inner`]:{backgroundColor:`${e.colorBgContainer}`,borderColor:`${e.colorBorder}`,"&:after":{top:"50%",insetInlineStart:"50%",width:e.calc(e.fontSizeLG).div(2).equal(),height:e.calc(e.fontSizeLG).div(2).equal(),backgroundColor:e.colorPrimary,border:0,transform:"translate(-50%, -50%) scale(1)",opacity:1,content:'""'}},[`&:hover ${t}-inner`]:{backgroundColor:`${e.colorBgContainer}`,borderColor:`${e.colorPrimary}`}}}}},{[`${l}-disabled`]:{cursor:"not-allowed"},[`${t}-disabled`]:{[`&, ${t}-input`]:{cursor:"not-allowed",pointerEvents:"none"},[`${t}-inner`]:{background:e.colorBgContainerDisabled,borderColor:e.colorBorder,"&:after":{borderColor:e.colorTextDisabled}},"&:after":{display:"none"},"& + span":{color:e.colorTextDisabled},[`&${t}-indeterminate ${t}-inner::after`]:{background:e.colorTextDisabled}}}]})((0,o.mergeToken)(t,{checkboxCls:`.${e}`,checkboxSize:t.controlInteractiveSize}))}let s=(0,l.genStyleHooks)("Checkbox",(e,{prefixCls:t})=>[n(t,e)]);e.s(["default",0,s,"getStyle",()=>n],236836)},374276,e=>{"use strict";e.i(247167);var t=e.i(271645),r=e.i(343794),a=e.i(91874),l=e.i(611935),o=e.i(121872),n=e.i(26905),s=e.i(242064),i=e.i(937328),c=e.i(321883),d=e.i(62139),u=e.i(421512),m=e.i(236836),g=e.i(681216),p=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 l=0,a=Object.getOwnPropertySymbols(e);lt.indexOf(a[l])&&Object.prototype.propertyIsEnumerable.call(e,a[l])&&(r[a[l]]=e[a[l]]);return r};let f=t.forwardRef((e,f)=>{var h;let{prefixCls:x,className:b,rootClassName:y,children:v,indeterminate:w=!1,style:k,onMouseEnter:C,onMouseLeave:j,skipGroup:N=!1,disabled:S}=e,$=p(e,["prefixCls","className","rootClassName","children","indeterminate","style","onMouseEnter","onMouseLeave","skipGroup","disabled"]),{getPrefixCls:M,direction:E,checkbox:O}=t.useContext(s.ConfigContext),T=t.useContext(u.default),{isFormItemInput:P}=t.useContext(d.FormItemInputContext),_=t.useContext(i.default),z=null!=(h=(null==T?void 0:T.disabled)||S)?h:_,R=t.useRef($.value),I=t.useRef(null),L=(0,l.composeRef)(f,I);t.useEffect(()=>{null==T||T.registerValue($.value)},[]),t.useEffect(()=>{if(!N)return $.value!==R.current&&(null==T||T.cancelValue(R.current),null==T||T.registerValue($.value),R.current=$.value),()=>null==T?void 0:T.cancelValue($.value)},[$.value]),t.useEffect(()=>{var e;(null==(e=I.current)?void 0:e.input)&&(I.current.input.indeterminate=w)},[w]);let D=M("checkbox",x),B=(0,c.default)(D),[F,A,q]=(0,m.default)(D,B),H=Object.assign({},$);T&&!N&&(H.onChange=(...e)=>{$.onChange&&$.onChange.apply($,e),T.toggleOption&&T.toggleOption({label:v,value:$.value})},H.name=T.name,H.checked=T.value.includes($.value));let G=(0,r.default)(`${D}-wrapper`,{[`${D}-rtl`]:"rtl"===E,[`${D}-wrapper-checked`]:H.checked,[`${D}-wrapper-disabled`]:z,[`${D}-wrapper-in-form-item`]:P},null==O?void 0:O.className,b,y,q,B,A),X=(0,r.default)({[`${D}-indeterminate`]:w},n.TARGET_CLS,A),[V,K]=(0,g.default)(H.onClick);return F(t.createElement(o.default,{component:"Checkbox",disabled:z},t.createElement("label",{className:G,style:Object.assign(Object.assign({},null==O?void 0:O.style),k),onMouseEnter:C,onMouseLeave:j,onClick:V},t.createElement(a.default,Object.assign({},H,{onClick:K,prefixCls:D,className:X,disabled:z,ref:L})),null!=v&&t.createElement("span",{className:`${D}-label`},v))))});var h=e.i(8211),x=e.i(529681),b=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 l=0,a=Object.getOwnPropertySymbols(e);lt.indexOf(a[l])&&Object.prototype.propertyIsEnumerable.call(e,a[l])&&(r[a[l]]=e[a[l]]);return r};let y=t.forwardRef((e,a)=>{let{defaultValue:l,children:o,options:n=[],prefixCls:i,className:d,rootClassName:g,style:p,onChange:y}=e,v=b(e,["defaultValue","children","options","prefixCls","className","rootClassName","style","onChange"]),{getPrefixCls:w,direction:k}=t.useContext(s.ConfigContext),[C,j]=t.useState(v.value||l||[]),[N,S]=t.useState([]);t.useEffect(()=>{"value"in v&&j(v.value||[])},[v.value]);let $=t.useMemo(()=>n.map(e=>"string"==typeof e||"number"==typeof e?{label:e,value:e}:e),[n]),M=e=>{S(t=>t.filter(t=>t!==e))},E=e=>{S(t=>[].concat((0,h.default)(t),[e]))},O=e=>{let t=C.indexOf(e.value),r=(0,h.default)(C);-1===t?r.push(e.value):r.splice(t,1),"value"in v||j(r),null==y||y(r.filter(e=>N.includes(e)).sort((e,t)=>$.findIndex(t=>t.value===e)-$.findIndex(e=>e.value===t)))},T=w("checkbox",i),P=`${T}-group`,_=(0,c.default)(T),[z,R,I]=(0,m.default)(T,_),L=(0,x.default)(v,["value","disabled"]),D=n.length?$.map(e=>t.createElement(f,{prefixCls:T,key:e.value.toString(),disabled:"disabled"in e?e.disabled:v.disabled,value:e.value,checked:C.includes(e.value),onChange:e.onChange,className:(0,r.default)(`${P}-item`,e.className),style:e.style,title:e.title,id:e.id,required:e.required},e.label)):o,B=t.useMemo(()=>({toggleOption:O,value:C,disabled:v.disabled,name:v.name,registerValue:E,cancelValue:M}),[O,C,v.disabled,v.name,E,M]),F=(0,r.default)(P,{[`${P}-rtl`]:"rtl"===k},d,g,I,_,R);return z(t.createElement("div",Object.assign({className:F,style:p},L,{ref:a}),t.createElement(u.default.Provider,{value:B},D)))});f.Group=y,f.__ANT_CHECKBOX=!0,e.s(["default",0,f],374276)},536916,e=>{"use strict";var t=e.i(374276);e.s(["Checkbox",()=>t.default])},292639,e=>{"use strict";var t=e.i(764205),r=e.i(266027);let a=(0,e.i(243652).createQueryKeys)("uiSettings");e.s(["useUISettings",0,()=>(0,r.useQuery)({queryKey:a.list({}),queryFn:async()=>await (0,t.getUiSettings)(),staleTime:36e5,gcTime:36e5})])},250980,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3m0 0v3m0-3h3m-3 0H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z"}))});e.s(["PlusCircleIcon",0,r],250980)},502547,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"}))});e.s(["ChevronRightIcon",0,r],502547)},988297,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4v16m8-8H4"}))});e.s(["PlusIcon",0,r],988297)},797672,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"}))});e.s(["PencilIcon",0,r],797672)},992619,e=>{"use strict";var t=e.i(843476),r=e.i(271645),a=e.i(779241),l=e.i(599724),o=e.i(199133),n=e.i(983561),s=e.i(689020);e.s(["default",0,({accessToken:e,value:i,placeholder:c="Select a Model",onChange:d,disabled:u=!1,style:m,className:g,showLabel:p=!0,labelText:f="Select Model"})=>{let[h,x]=(0,r.useState)(i),[b,y]=(0,r.useState)(!1),[v,w]=(0,r.useState)([]),k=(0,r.useRef)(null);return(0,r.useEffect)(()=>{x(i)},[i]),(0,r.useEffect)(()=>{e&&(async()=>{try{let t=await (0,s.fetchAvailableModels)(e);console.log("Fetched models for selector:",t),t.length>0&&w(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)(n.RobotOutlined,{className:"mr-2"})," ",f]}),(0,t.jsx)(o.Select,{value:h,placeholder:c,onChange:e=>{"custom"===e?(y(!0),x(void 0)):(y(!1),x(e),d&&d(e))},options:[...Array.from(new Set(v.map(e=>e.model_group))).map((e,t)=>({value:e,label:e,key:t})),{value:"custom",label:"Enter custom model",key:"custom"}],style:{width:"100%",...m},showSearch:!0,className:`rounded-md ${g||""}`,disabled:u}),b&&(0,t.jsx)(a.TextInput,{className:"mt-2",placeholder:"Enter custom model name",onValueChange:e=>{k.current&&clearTimeout(k.current),k.current=setTimeout(()=>{x(e),d&&d(e)},500)},disabled:u})]})}])},409797,e=>{"use strict";var t=e.i(631171);e.s(["ChevronDownIcon",()=>t.default])},91739,e=>{"use strict";var t=e.i(544195);e.s(["Radio",()=>t.default])},500727,696609,531516,e=>{"use strict";var t=e.i(266027),r=e.i(243652),a=e.i(764205),l=e.i(135214);let o=(0,r.createQueryKeys)("mcpServers");e.s(["useMCPServers",0,e=>{let{accessToken:r}=(0,l.default)();return(0,t.useQuery)({queryKey:o.list(e?{filters:{teamId:e}}:void 0),queryFn:async()=>await (0,a.fetchMCPServers)(r,e),enabled:!!r})}],500727);var n=e.i(843476),s=e.i(271645),i=e.i(536916),c=e.i(599724),d=e.i(409797),u=e.i(246349),u=u;let m=/\b(delete|remove|destroy|purge|drop|erase|unlink)\b/i,g=/\b(create|add|insert|new|post|submit|register|make|generate|write|upload)\b/i,p=/\b(update|edit|modify|change|patch|put|set|rename|move|transform)\b/i,f=/\b(get|read|list|fetch|search|find|query|retrieve|show|view|check|describe|info)\b/i;function h(e,t=""){let r=e.toLowerCase();if(f.test(r))return"read";if(m.test(r))return"delete";if(p.test(r))return"update";if(g.test(r))return"create";if(t){let e=t.toLowerCase();if(f.test(e))return"read";if(m.test(e))return"delete";if(p.test(e))return"update";if(g.test(e))return"create"}return"unknown"}function x(e){let t={read:[],create:[],update:[],delete:[],unknown:[]};for(let r of e)t[h(r.name,r.description)].push(r);return t}let b={read:{label:"Read",description:"Safe operations — fetch, list, search. No side effects.",risk:"low"},create:{label:"Create",description:"Add new resources — insert, upload, register.",risk:"medium"},update:{label:"Update",description:"Modify existing resources — edit, patch, rename.",risk:"medium"},delete:{label:"Delete",description:"Destructive operations — remove, purge, destroy.",risk:"high"},unknown:{label:"Other",description:"Operations that could not be automatically classified.",risk:"unknown"}};e.s(["CRUD_GROUP_META",0,b,"classifyToolOp",()=>h,"groupToolsByCrud",()=>x],696609);let y=["read","create","update","delete","unknown"],v={low:"bg-green-100 text-green-800",medium:"bg-yellow-100 text-yellow-800",high:"bg-red-100 text-red-800 font-semibold",unknown:"bg-gray-100 text-gray-700"},w={read:"border-green-200",create:"border-blue-200",update:"border-yellow-200",delete:"border-red-300",unknown:"border-gray-200"},k={read:"bg-green-50",create:"bg-blue-50",update:"bg-yellow-50",delete:"bg-red-50",unknown:"bg-gray-50"};e.s(["default",0,({tools:e,value:t,onChange:r,readOnly:a=!1,searchFilter:l=""})=>{let[o,m]=(0,s.useState)({read:!1,create:!1,update:!1,delete:!1,unknown:!0}),g=(0,s.useMemo)(()=>x(e),[e]),p=(0,s.useMemo)(()=>new Set(void 0===t?e.map(e=>e.name):t),[t,e]),f=e=>{if(a)return;let t=new Set(p);t.has(e)?t.delete(e):t.add(e),r(Array.from(t))};return 0===e.length?null:(0,n.jsx)("div",{className:"space-y-3",children:y.map(e=>{let t,s=g[e];if(0===s.length)return null;if(l){let e=l.toLowerCase();if(!s.some(t=>t.name.toLowerCase().includes(e)||(t.description??"").toLowerCase().includes(e)))return null}let h=b[e],x=(t=g[e]).length>0&&t.every(e=>p.has(e.name)),y=(e=>{let t=g[e];if(0===t.length)return!1;let r=t.filter(e=>p.has(e.name)).length;return r>0&&r{m(t=>({...t,[e]:!t[e]}))},children:[C?(0,n.jsx)(u.default,{className:"w-4 h-4 text-gray-500 flex-shrink-0"}):(0,n.jsx)(d.ChevronDownIcon,{className:"w-4 h-4 text-gray-500 flex-shrink-0"}),(0,n.jsx)("span",{className:"font-semibold text-gray-900 text-sm",children:h.label}),(0,n.jsx)("span",{className:`text-xs px-2 py-0.5 rounded-full ${v[h.risk]}`,children:"high"===h.risk?"High Risk":"medium"===h.risk?"Medium Risk":"low"===h.risk?"Safe":"Unclassified"}),(0,n.jsxs)("span",{className:"text-xs text-gray-500 ml-1",children:[s.filter(e=>p.has(e.name)).length,"/",s.length," allowed"]})]}),!a&&(0,n.jsxs)("div",{className:"flex items-center gap-2 ml-4",children:[(0,n.jsx)(c.Text,{className:"text-xs text-gray-500",children:x?"All on":y?"Partial":"All off"}),(0,n.jsx)(i.Checkbox,{checked:x,indeterminate:y,onChange:t=>((e,t)=>{if(a)return;let l=new Set(p);for(let r of g[e])t?l.add(r.name):l.delete(r.name);r(Array.from(l))})(e,t.target.checked),onClick:e=>e.stopPropagation()})]})]}),!C&&(0,n.jsx)("div",{className:"px-4 pt-2 pb-1 text-xs text-gray-500 bg-white border-b border-gray-100",children:h.description}),!C&&(0,n.jsx)("div",{className:"bg-white divide-y divide-gray-50",children:s.filter(e=>!l||e.name.toLowerCase().includes(l.toLowerCase())||(e.description??"").toLowerCase().includes(l.toLowerCase())).map(e=>{let t,r=(t=e.name,p.has(t));return(0,n.jsxs)("div",{className:`flex items-start gap-3 px-4 py-2.5 transition-colors hover:bg-gray-50 ${!a?"cursor-pointer":""} ${r?"":"opacity-60"}`,onClick:()=>f(e.name),children:[(0,n.jsx)(i.Checkbox,{checked:r,onChange:()=>f(e.name),disabled:a,onClick:e=>e.stopPropagation()}),(0,n.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,n.jsx)(c.Text,{className:"font-medium text-gray-900 text-sm",children:e.name}),e.description&&(0,n.jsx)(c.Text,{className:"text-xs text-gray-500 mt-0.5 leading-snug",children:e.description})]}),(0,n.jsx)("span",{className:`text-xs px-1.5 py-0.5 rounded flex-shrink-0 ${r?"bg-green-100 text-green-700":"bg-gray-100 text-gray-500"}`,children:r?"on":"off"})]},e.name)})})]},e)})})}],531516)},361653,e=>{"use strict";let t=(0,e.i(475254).default)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);e.s(["default",()=>t])},603908,e=>{"use strict";let t=(0,e.i(475254).default)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);e.s(["default",()=>t])},841947,e=>{"use strict";let t=(0,e.i(475254).default)("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);e.s(["default",()=>t])},793130,e=>{"use strict";var t=e.i(290571),r=e.i(429427),a=e.i(371330),l=e.i(271645),o=e.i(394487),n=e.i(503269),s=e.i(214520),i=e.i(746725),c=e.i(914189),d=e.i(144279),u=e.i(294316),m=e.i(601893),g=e.i(140721),p=e.i(942803),f=e.i(233538),h=e.i(694421),x=e.i(700020),b=e.i(35889),y=e.i(998348),v=e.i(722678);let w=(0,l.createContext)(null);w.displayName="GroupContext";let k=l.Fragment,C=Object.assign((0,x.forwardRefWithAs)(function(e,t){var k;let C=(0,l.useId)(),j=(0,p.useProvidedId)(),N=(0,m.useDisabled)(),{id:S=j||`headlessui-switch-${C}`,disabled:$=N||!1,checked:M,defaultChecked:E,onChange:O,name:T,value:P,form:_,autoFocus:z=!1,...R}=e,I=(0,l.useContext)(w),[L,D]=(0,l.useState)(null),B=(0,l.useRef)(null),F=(0,u.useSyncRefs)(B,t,null===I?null:I.setSwitch,D),A=(0,s.useDefaultValue)(E),[q,H]=(0,n.useControllable)(M,O,null!=A&&A),G=(0,i.useDisposables)(),[X,V]=(0,l.useState)(!1),K=(0,c.useEvent)(()=>{V(!0),null==H||H(!q),G.nextFrame(()=>{V(!1)})}),W=(0,c.useEvent)(e=>{if((0,f.isDisabledReactIssue7711)(e.currentTarget))return e.preventDefault();e.preventDefault(),K()}),U=(0,c.useEvent)(e=>{e.key===y.Keys.Space?(e.preventDefault(),K()):e.key===y.Keys.Enter&&(0,h.attemptSubmit)(e.currentTarget)}),Y=(0,c.useEvent)(e=>e.preventDefault()),Q=(0,v.useLabelledBy)(),J=(0,b.useDescribedBy)(),{isFocusVisible:Z,focusProps:ee}=(0,r.useFocusRing)({autoFocus:z}),{isHovered:et,hoverProps:er}=(0,a.useHover)({isDisabled:$}),{pressed:ea,pressProps:el}=(0,o.useActivePress)({disabled:$}),eo=(0,l.useMemo)(()=>({checked:q,disabled:$,hover:et,focus:Z,active:ea,autofocus:z,changing:X}),[q,et,Z,ea,$,X,z]),en=(0,x.mergeProps)({id:S,ref:F,role:"switch",type:(0,d.useResolveButtonType)(e,L),tabIndex:-1===e.tabIndex?0:null!=(k=e.tabIndex)?k:0,"aria-checked":q,"aria-labelledby":Q,"aria-describedby":J,disabled:$||void 0,autoFocus:z,onClick:W,onKeyUp:U,onKeyPress:Y},ee,er,el),es=(0,l.useCallback)(()=>{if(void 0!==A)return null==H?void 0:H(A)},[H,A]),ei=(0,x.useRender)();return l.default.createElement(l.default.Fragment,null,null!=T&&l.default.createElement(g.FormFields,{disabled:$,data:{[T]:P||"on"},overrides:{type:"checkbox",checked:q},form:_,onReset:es}),ei({ourProps:en,theirProps:R,slot:eo,defaultTag:"button",name:"Switch"}))}),{Group:function(e){var t;let[r,a]=(0,l.useState)(null),[o,n]=(0,v.useLabels)(),[s,i]=(0,b.useDescriptions)(),c=(0,l.useMemo)(()=>({switch:r,setSwitch:a}),[r,a]),d=(0,x.useRender)();return l.default.createElement(i,{name:"Switch.Description",value:s},l.default.createElement(n,{name:"Switch.Label",value:o,props:{htmlFor:null==(t=c.switch)?void 0:t.id,onClick(e){r&&(e.currentTarget instanceof HTMLLabelElement&&e.preventDefault(),r.click(),r.focus({preventScroll:!0}))}}},l.default.createElement(w.Provider,{value:c},d({ourProps:{},theirProps:e,slot:{},defaultTag:k,name:"Switch.Group"}))))},Label:v.Label,Description:b.Description});var j=e.i(888288),N=e.i(95779),S=e.i(444755),$=e.i(673706),M=e.i(829087);let E=(0,$.makeClassName)("Switch"),O=l.default.forwardRef((e,r)=>{let{checked:a,defaultChecked:o=!1,onChange:n,color:s,name:i,error:c,errorMessage:d,disabled:u,required:m,tooltip:g,id:p}=e,f=(0,t.__rest)(e,["checked","defaultChecked","onChange","color","name","error","errorMessage","disabled","required","tooltip","id"]),h={bgColor:s?(0,$.getColorClassNames)(s,N.colorPalette.background).bgColor:"bg-tremor-brand dark:bg-dark-tremor-brand",ringColor:s?(0,$.getColorClassNames)(s,N.colorPalette.ring).ringColor:"ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted"},[x,b]=(0,j.default)(o,a),[y,v]=(0,l.useState)(!1),{tooltipProps:w,getReferenceProps:k}=(0,M.useTooltip)(300);return l.default.createElement("div",{className:"flex flex-row items-center justify-start"},l.default.createElement(M.default,Object.assign({text:g},w)),l.default.createElement("div",Object.assign({ref:(0,$.mergeRefs)([r,w.refs.setReference]),className:(0,S.tremorTwMerge)(E("root"),"flex flex-row relative h-5")},f,k),l.default.createElement("input",{type:"checkbox",className:(0,S.tremorTwMerge)(E("input"),"absolute w-5 h-5 cursor-pointer left-0 top-0 opacity-0"),name:i,required:m,checked:x,onChange:e=>{e.preventDefault()}}),l.default.createElement(C,{checked:x,onChange:e=>{b(e),null==n||n(e)},disabled:u,className:(0,S.tremorTwMerge)(E("switch"),"w-10 h-5 group relative inline-flex shrink-0 cursor-pointer items-center justify-center rounded-tremor-full","focus:outline-none",u?"cursor-not-allowed":""),onFocus:()=>v(!0),onBlur:()=>v(!1),id:p},l.default.createElement("span",{className:(0,S.tremorTwMerge)(E("sr-only"),"sr-only")},"Switch ",x?"on":"off"),l.default.createElement("span",{"aria-hidden":"true",className:(0,S.tremorTwMerge)(E("background"),x?h.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")}),l.default.createElement("span",{"aria-hidden":"true",className:(0,S.tremorTwMerge)(E("round"),x?(0,S.tremorTwMerge)(h.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,S.tremorTwMerge)("ring-2",h.ringColor):"")}))),c&&d?l.default.createElement("p",{className:(0,S.tremorTwMerge)(E("errorMessage"),"text-sm text-red-500 mt-1 ")},d):null)});O.displayName="Switch",e.s(["Switch",()=>O],793130)},158392,419470,e=>{"use strict";var t=e.i(843476),r=e.i(779241);let a={ttl:3600,lowest_latency_buffer:0},l=({routingStrategyArgs:e})=>{let l={ttl:"Sliding window to look back over when calculating the average latency of a deployment. Default - 1 hour (in seconds).",lowest_latency_buffer:"Shuffle between deployments within this % of the lowest latency. Default - 0 (i.e. always pick lowest latency)."};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"max-w-3xl",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Latency-Based Configuration"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Fine-tune latency-based routing behavior"})]}),(0,t.jsx)("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2 xl:grid-cols-3",children:Object.entries(e||a).map(([e,a])=>(0,t.jsx)("div",{className:"space-y-2",children:(0,t.jsxs)("label",{className:"block",children:[(0,t.jsx)("span",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:e.replace(/_/g," ")}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-0.5 mb-2",children:l[e]||""}),(0,t.jsx)(r.TextInput,{name:e,defaultValue:"object"==typeof a?JSON.stringify(a,null,2):a?.toString(),className:"font-mono text-sm w-full"})]})},e))})]}),(0,t.jsx)("div",{className:"border-t border-gray-200"})]})},o=({routerSettings:e,routerFieldsMetadata:a})=>(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"max-w-3xl",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Reliability & Retries"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Configure retry logic and failure handling"})]}),(0,t.jsx)("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2 xl:grid-cols-3",children:Object.entries(e).filter(([e,t])=>"fallbacks"!=e&&"context_window_fallbacks"!=e&&"routing_strategy_args"!=e&&"routing_strategy"!=e&&"enable_tag_filtering"!=e).map(([e,l])=>(0,t.jsx)("div",{className:"space-y-2",children:(0,t.jsxs)("label",{className:"block",children:[(0,t.jsx)("span",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:a[e]?.ui_field_name||e}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-0.5 mb-2",children:a[e]?.field_description||""}),(0,t.jsx)(r.TextInput,{name:e,defaultValue:null==l||"null"===l?"":"object"==typeof l?JSON.stringify(l,null,2):l?.toString()||"",placeholder:"—",className:"font-mono text-sm w-full"})]})},e))})]});var n=e.i(199133);let s=({selectedStrategy:e,availableStrategies:r,routingStrategyDescriptions:a,routerFieldsMetadata:l,onStrategyChange:o})=>(0,t.jsxs)("div",{className:"space-y-2 max-w-3xl",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:l.routing_strategy?.ui_field_name||"Routing Strategy"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-0.5 mb-2",children:l.routing_strategy?.field_description||""})]}),(0,t.jsx)("div",{className:"routing-strategy-select max-w-3xl",children:(0,t.jsx)(n.Select,{value:e,onChange:o,style:{width:"100%"},size:"large",children:r.map(e=>(0,t.jsx)(n.Select.Option,{value:e,label:e,children:(0,t.jsxs)("div",{className:"flex flex-col gap-0.5 py-1",children:[(0,t.jsx)("span",{className:"font-mono text-sm font-medium",children:e}),a[e]&&(0,t.jsx)("span",{className:"text-xs text-gray-500 font-normal",children:a[e]})]})},e))})})]});var i=e.i(793130);let c=({enabled:e,routerFieldsMetadata:r,onToggle:a})=>(0,t.jsx)("div",{className:"space-y-3 max-w-3xl",children:(0,t.jsxs)("div",{className:"flex items-start justify-between",children:[(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)("label",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:r.enable_tag_filtering?.ui_field_name||"Enable Tag Filtering"}),(0,t.jsxs)("p",{className:"text-xs text-gray-500 mt-0.5",children:[r.enable_tag_filtering?.field_description||"",r.enable_tag_filtering?.link&&(0,t.jsxs)(t.Fragment,{children:[" ",(0,t.jsx)("a",{href:r.enable_tag_filtering.link,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-800 underline",children:"Learn more"})]})]})]}),(0,t.jsx)(i.Switch,{checked:e,onChange:a,className:"ml-4"})]})});e.s(["default",0,({value:e,onChange:r,routerFieldsMetadata:a,availableRoutingStrategies:n,routingStrategyDescriptions:i})=>(0,t.jsxs)("div",{className:"w-full space-y-8 py-2",children:[(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"max-w-3xl",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Routing Settings"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Configure how requests are routed to deployments"})]}),n.length>0&&(0,t.jsx)(s,{selectedStrategy:e.selectedStrategy||e.routerSettings.routing_strategy||null,availableStrategies:n,routingStrategyDescriptions:i,routerFieldsMetadata:a,onStrategyChange:t=>{r({...e,selectedStrategy:t})}}),(0,t.jsx)(c,{enabled:e.enableTagFiltering,routerFieldsMetadata:a,onToggle:t=>{r({...e,enableTagFiltering:t})}})]}),(0,t.jsx)("div",{className:"border-t border-gray-200"}),"latency-based-routing"===e.selectedStrategy&&(0,t.jsx)(l,{routingStrategyArgs:e.routerSettings.routing_strategy_args}),(0,t.jsx)(o,{routerSettings:e.routerSettings,routerFieldsMetadata:a})]})],158392);var d=e.i(994388),u=e.i(998573),m=e.i(653496),g=e.i(107233),p=e.i(271645),f=e.i(592968),h=e.i(361653),h=h;let x=(0,e.i(475254).default)("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);var b=e.i(37727);function y({group:e,onChange:r,availableModels:a,maxFallbacks:l}){let o=a.filter(t=>t!==e.primaryModel),s=e.fallbackModels.length{let a=[...e.fallbackModels];a.includes(t)&&(a=a.filter(e=>e!==t)),r({...e,primaryModel:t,fallbackModels:a})},showSearch:!0,getPopupContainer:e=>e.parentElement||document.body,filterOption:(e,t)=>(t?.label??"").toLowerCase().includes(e.toLowerCase()),options:a.map(e=>({label:e,value:e}))}),!e.primaryModel&&(0,t.jsxs)("div",{className:"mt-2 flex items-center gap-2 text-amber-600 text-xs bg-amber-50 p-2 rounded",children:[(0,t.jsx)(h.default,{className:"w-4 h-4"}),(0,t.jsx)("span",{children:"Select a model to begin configuring fallbacks"})]})]}),(0,t.jsx)("div",{className:"flex items-center justify-center -my-4 z-10",children:(0,t.jsxs)("div",{className:"bg-indigo-50 text-indigo-500 px-4 py-1 rounded-full text-xs font-bold border border-indigo-100 flex items-center gap-2 shadow-sm",children:[(0,t.jsx)(x,{className:"w-4 h-4"}),"IF FAILS, TRY..."]})}),(0,t.jsxs)("div",{className:`transition-opacity duration-300 ${!e.primaryModel?"opacity-50 pointer-events-none":"opacity-100"}`,children:[(0,t.jsxs)("label",{className:"block text-sm font-semibold text-gray-700 mb-2",children:["Fallback Chain ",(0,t.jsx)("span",{className:"text-red-500",children:"*"}),(0,t.jsxs)("span",{className:"text-xs text-gray-500 font-normal ml-2",children:["(Max ",l," fallbacks at a time)"]})]}),(0,t.jsxs)("div",{className:"bg-gray-50 rounded-xl p-4 border border-gray-200",children:[(0,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsx)(n.Select,{mode:"multiple",className:"w-full",size:"large",placeholder:s?"Select fallback models to add...":`Maximum ${l} fallbacks reached`,value:e.fallbackModels,onChange:t=>{let a=t.slice(0,l);r({...e,fallbackModels:a})},disabled:!e.primaryModel,getPopupContainer:e=>e.parentElement||document.body,options:o.map(e=>({label:e,value:e})),optionRender:(r,a)=>{let l=e.fallbackModels.includes(r.value),o=l?e.fallbackModels.indexOf(r.value)+1:null;return(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[l&&null!==o&&(0,t.jsx)("span",{className:"flex items-center justify-center w-5 h-5 rounded bg-indigo-100 text-indigo-600 text-xs font-bold",children:o}),(0,t.jsx)("span",{children:r.label})]})},maxTagCount:"responsive",maxTagPlaceholder:e=>(0,t.jsx)(f.Tooltip,{styles:{root:{pointerEvents:"none"}},title:e.map(({value:e})=>e).join(", "),children:(0,t.jsxs)("span",{children:["+",e.length," more"]})}),showSearch:!0,filterOption:(e,t)=>(t?.label??"").toLowerCase().includes(e.toLowerCase())}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1 ml-1",children:s?`Search and select multiple models. Selected models will appear below in order. (${e.fallbackModels.length}/${l} used)`:`Maximum ${l} fallbacks reached. Remove some to add more.`})]}),(0,t.jsx)("div",{className:"space-y-2 min-h-[100px]",children:0===e.fallbackModels.length?(0,t.jsxs)("div",{className:"h-32 border-2 border-dashed border-gray-300 rounded-lg flex flex-col items-center justify-center text-gray-400",children:[(0,t.jsx)("span",{className:"text-sm",children:"No fallback models selected"}),(0,t.jsx)("span",{className:"text-xs mt-1",children:"Add models from the dropdown above"})]}):e.fallbackModels.map((a,l)=>(0,t.jsxs)("div",{className:"group flex items-center justify-between p-3 bg-white rounded-lg border border-gray-200 hover:border-indigo-300 hover:shadow-sm transition-all",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"flex items-center justify-center w-6 h-6 rounded bg-gray-100 text-gray-400 group-hover:text-indigo-500 group-hover:bg-indigo-50",children:(0,t.jsx)("span",{className:"text-xs font-bold",children:l+1})}),(0,t.jsx)("div",{children:(0,t.jsx)("span",{className:"font-medium text-gray-800",children:a})})]}),(0,t.jsx)("button",{type:"button",onClick:()=>{let t;return t=e.fallbackModels.filter((e,t)=>t!==l),void r({...e,fallbackModels:t})},className:"opacity-0 group-hover:opacity-100 transition-opacity text-gray-400 hover:text-red-500 p-1",children:(0,t.jsx)(b.X,{className:"w-4 h-4"})})]},`${a}-${l}`))})]})]})]})}function v({groups:e,onGroupsChange:r,availableModels:a,maxFallbacks:l=10,maxGroups:o=5}){let[n,s]=(0,p.useState)(e.length>0?e[0].id:"1");(0,p.useEffect)(()=>{e.length>0?e.some(e=>e.id===n)||s(e[0].id):s("1")},[e]);let i=()=>{if(e.length>=o)return;let t=Date.now().toString();r([...e,{id:t,primaryModel:null,fallbackModels:[]}]),s(t)},c=t=>{r(e.map(e=>e.id===t.id?t:e))},f=e.map((r,o)=>{let n=r.primaryModel?r.primaryModel:`Group ${o+1}`;return{key:r.id,label:n,closable:e.length>1,children:(0,t.jsx)(y,{group:r,onChange:c,availableModels:a,maxFallbacks:l})}});return 0===e.length?(0,t.jsxs)("div",{className:"text-center py-12 bg-gray-50 rounded-lg border border-dashed border-gray-300",children:[(0,t.jsx)("p",{className:"text-gray-500 mb-4",children:"No fallback groups configured"}),(0,t.jsx)(d.Button,{variant:"primary",onClick:i,icon:()=>(0,t.jsx)(g.Plus,{className:"w-4 h-4"}),children:"Create First Group"})]}):(0,t.jsx)(m.Tabs,{type:"editable-card",activeKey:n,onChange:s,onEdit:(t,a)=>{"add"===a?i():"remove"===a&&e.length>1&&(t=>{if(1===e.length)return u.message.warning("At least one group is required");let a=e.filter(e=>e.id!==t);r(a),n===t&&a.length>0&&s(a[a.length-1].id)})(t)},items:f,className:"fallback-tabs",tabBarStyle:{marginBottom:0},hideAdd:e.length>=o})}e.s(["FallbackSelectionForm",()=>v],419470)}]); \ 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/67ddb5107368a659.js similarity index 95% rename from litellm/proxy/_experimental/out/_next/static/chunks/0adb91ab5f3140d5.js rename to litellm/proxy/_experimental/out/_next/static/chunks/67ddb5107368a659.js index a8ed71a7b2..56a8ade942 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/0adb91ab5f3140d5.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/67ddb5107368a659.js @@ -1,3 +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: +(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,m=e?.input_cost!==void 0||e?.output_cost!==void 0,x=e?.additional_costs&&Object.entries(e.additional_costs).some(([,e])=>null!=e&&0!==e);if(!(m||c||x||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 u=e&&(void 0!==e.discount_percent&&0!==e.discount_percent||void 0!==e.discount_amount&&0!==e.discount_amount),p=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),h=d?0:e?.input_cost,g=d?0:e?.output_cost,f=d?0:e?.original_cost,y=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(h),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(g),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.entries(e.additional_costs).filter(([,e])=>null!=e&&0!==e).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(f)})]})}),(u||p)&&(0,t.jsxs)("div",{className:"pt-2 space-y-2 max-w-2xl",children:[u&&(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)]})]})]}),p&&(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(y),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/f728bd69dddaff23.js b/litellm/proxy/_experimental/out/_next/static/chunks/68066e020262ced9.js similarity index 92% rename from litellm/proxy/_experimental/out/_next/static/chunks/f728bd69dddaff23.js rename to litellm/proxy/_experimental/out/_next/static/chunks/68066e020262ced9.js index 59166e5e81..34cc7798a1 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/f728bd69dddaff23.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/68066e020262ced9.js @@ -4,4 +4,4 @@ `]:{[`&:hover ${t}-inner`]:{borderColor:e.colorPrimary}},[`${l}:not(${l}-disabled)`]:{[`&:hover ${t}-checked:not(${t}-disabled) ${t}-inner`]:{backgroundColor:e.colorPrimaryHover,borderColor:"transparent"},[`&:hover ${t}-checked:not(${t}-disabled):after`]:{borderColor:e.colorPrimaryHover}}},{[`${t}-checked`]:{[`${t}-inner`]:{backgroundColor:e.colorPrimary,borderColor:e.colorPrimary,"&:after":{opacity:1,transform:"rotate(45deg) scale(1) translate(-50%,-50%)",transition:`all ${e.motionDurationMid} ${e.motionEaseOutBack} ${e.motionDurationFast}`}}},[` ${l}-checked:not(${l}-disabled), ${t}-checked:not(${t}-disabled) - `]:{[`&:hover ${t}-inner`]:{backgroundColor:e.colorPrimaryHover,borderColor:"transparent"}}},{[t]:{"&-indeterminate":{"&":{[`${t}-inner`]:{backgroundColor:`${e.colorBgContainer}`,borderColor:`${e.colorBorder}`,"&:after":{top:"50%",insetInlineStart:"50%",width:e.calc(e.fontSizeLG).div(2).equal(),height:e.calc(e.fontSizeLG).div(2).equal(),backgroundColor:e.colorPrimary,border:0,transform:"translate(-50%, -50%) scale(1)",opacity:1,content:'""'}},[`&:hover ${t}-inner`]:{backgroundColor:`${e.colorBgContainer}`,borderColor:`${e.colorPrimary}`}}}}},{[`${l}-disabled`]:{cursor:"not-allowed"},[`${t}-disabled`]:{[`&, ${t}-input`]:{cursor:"not-allowed",pointerEvents:"none"},[`${t}-inner`]:{background:e.colorBgContainerDisabled,borderColor:e.colorBorder,"&:after":{borderColor:e.colorTextDisabled}},"&:after":{display:"none"},"& + span":{color:e.colorTextDisabled},[`&${t}-indeterminate ${t}-inner::after`]:{background:e.colorTextDisabled}}}]})((0,o.mergeToken)(t,{checkboxCls:`.${e}`,checkboxSize:t.controlInteractiveSize}))}let s=(0,l.genStyleHooks)("Checkbox",(e,{prefixCls:t})=>[n(t,e)]);e.s(["default",0,s,"getStyle",()=>n],236836)},681216,e=>{"use strict";var t=e.i(271645),r=e.i(963188);function a(e){let a=t.default.useRef(null),l=()=>{r.default.cancel(a.current),a.current=null};return[()=>{l(),a.current=(0,r.default)(()=>{a.current=null})},t=>{a.current&&(t.stopPropagation(),l()),null==e||e(t)}]}e.s(["default",()=>a])},374276,e=>{"use strict";e.i(247167);var t=e.i(271645),r=e.i(343794),a=e.i(91874),l=e.i(611935),o=e.i(121872),n=e.i(26905),s=e.i(242064),i=e.i(937328),c=e.i(321883),d=e.i(62139),u=e.i(421512),m=e.i(236836),g=e.i(681216),p=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 l=0,a=Object.getOwnPropertySymbols(e);lt.indexOf(a[l])&&Object.prototype.propertyIsEnumerable.call(e,a[l])&&(r[a[l]]=e[a[l]]);return r};let f=t.forwardRef((e,f)=>{var h;let{prefixCls:x,className:b,rootClassName:y,children:v,indeterminate:w=!1,style:k,onMouseEnter:C,onMouseLeave:j,skipGroup:N=!1,disabled:S}=e,$=p(e,["prefixCls","className","rootClassName","children","indeterminate","style","onMouseEnter","onMouseLeave","skipGroup","disabled"]),{getPrefixCls:M,direction:E,checkbox:O}=t.useContext(s.ConfigContext),T=t.useContext(u.default),{isFormItemInput:P}=t.useContext(d.FormItemInputContext),_=t.useContext(i.default),z=null!=(h=(null==T?void 0:T.disabled)||S)?h:_,R=t.useRef($.value),I=t.useRef(null),L=(0,l.composeRef)(f,I);t.useEffect(()=>{null==T||T.registerValue($.value)},[]),t.useEffect(()=>{if(!N)return $.value!==R.current&&(null==T||T.cancelValue(R.current),null==T||T.registerValue($.value),R.current=$.value),()=>null==T?void 0:T.cancelValue($.value)},[$.value]),t.useEffect(()=>{var e;(null==(e=I.current)?void 0:e.input)&&(I.current.input.indeterminate=w)},[w]);let D=M("checkbox",x),B=(0,c.default)(D),[F,A,q]=(0,m.default)(D,B),H=Object.assign({},$);T&&!N&&(H.onChange=(...e)=>{$.onChange&&$.onChange.apply($,e),T.toggleOption&&T.toggleOption({label:v,value:$.value})},H.name=T.name,H.checked=T.value.includes($.value));let G=(0,r.default)(`${D}-wrapper`,{[`${D}-rtl`]:"rtl"===E,[`${D}-wrapper-checked`]:H.checked,[`${D}-wrapper-disabled`]:z,[`${D}-wrapper-in-form-item`]:P},null==O?void 0:O.className,b,y,q,B,A),X=(0,r.default)({[`${D}-indeterminate`]:w},n.TARGET_CLS,A),[V,K]=(0,g.default)(H.onClick);return F(t.createElement(o.default,{component:"Checkbox",disabled:z},t.createElement("label",{className:G,style:Object.assign(Object.assign({},null==O?void 0:O.style),k),onMouseEnter:C,onMouseLeave:j,onClick:V},t.createElement(a.default,Object.assign({},H,{onClick:K,prefixCls:D,className:X,disabled:z,ref:L})),null!=v&&t.createElement("span",{className:`${D}-label`},v))))});var h=e.i(8211),x=e.i(529681),b=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 l=0,a=Object.getOwnPropertySymbols(e);lt.indexOf(a[l])&&Object.prototype.propertyIsEnumerable.call(e,a[l])&&(r[a[l]]=e[a[l]]);return r};let y=t.forwardRef((e,a)=>{let{defaultValue:l,children:o,options:n=[],prefixCls:i,className:d,rootClassName:g,style:p,onChange:y}=e,v=b(e,["defaultValue","children","options","prefixCls","className","rootClassName","style","onChange"]),{getPrefixCls:w,direction:k}=t.useContext(s.ConfigContext),[C,j]=t.useState(v.value||l||[]),[N,S]=t.useState([]);t.useEffect(()=>{"value"in v&&j(v.value||[])},[v.value]);let $=t.useMemo(()=>n.map(e=>"string"==typeof e||"number"==typeof e?{label:e,value:e}:e),[n]),M=e=>{S(t=>t.filter(t=>t!==e))},E=e=>{S(t=>[].concat((0,h.default)(t),[e]))},O=e=>{let t=C.indexOf(e.value),r=(0,h.default)(C);-1===t?r.push(e.value):r.splice(t,1),"value"in v||j(r),null==y||y(r.filter(e=>N.includes(e)).sort((e,t)=>$.findIndex(t=>t.value===e)-$.findIndex(e=>e.value===t)))},T=w("checkbox",i),P=`${T}-group`,_=(0,c.default)(T),[z,R,I]=(0,m.default)(T,_),L=(0,x.default)(v,["value","disabled"]),D=n.length?$.map(e=>t.createElement(f,{prefixCls:T,key:e.value.toString(),disabled:"disabled"in e?e.disabled:v.disabled,value:e.value,checked:C.includes(e.value),onChange:e.onChange,className:(0,r.default)(`${P}-item`,e.className),style:e.style,title:e.title,id:e.id,required:e.required},e.label)):o,B=t.useMemo(()=>({toggleOption:O,value:C,disabled:v.disabled,name:v.name,registerValue:E,cancelValue:M}),[O,C,v.disabled,v.name,E,M]),F=(0,r.default)(P,{[`${P}-rtl`]:"rtl"===k},d,g,I,_,R);return z(t.createElement("div",Object.assign({className:F,style:p},L,{ref:a}),t.createElement(u.default.Provider,{value:B},D)))});f.Group=y,f.__ANT_CHECKBOX=!0,e.s(["default",0,f],374276)},536916,e=>{"use strict";var t=e.i(374276);e.s(["Checkbox",()=>t.default])},292639,e=>{"use strict";var t=e.i(764205),r=e.i(266027);let a=(0,e.i(243652).createQueryKeys)("uiSettings");e.s(["useUISettings",0,()=>(0,r.useQuery)({queryKey:a.list({}),queryFn:async()=>await (0,t.getUiSettings)(),staleTime:36e5,gcTime:36e5})])},250980,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3m0 0v3m0-3h3m-3 0H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z"}))});e.s(["PlusCircleIcon",0,r],250980)},502547,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"}))});e.s(["ChevronRightIcon",0,r],502547)},988297,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4v16m8-8H4"}))});e.s(["PlusIcon",0,r],988297)},797672,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"}))});e.s(["PencilIcon",0,r],797672)},992619,e=>{"use strict";var t=e.i(843476),r=e.i(271645),a=e.i(779241),l=e.i(599724),o=e.i(199133),n=e.i(983561),s=e.i(689020);e.s(["default",0,({accessToken:e,value:i,placeholder:c="Select a Model",onChange:d,disabled:u=!1,style:m,className:g,showLabel:p=!0,labelText:f="Select Model"})=>{let[h,x]=(0,r.useState)(i),[b,y]=(0,r.useState)(!1),[v,w]=(0,r.useState)([]),k=(0,r.useRef)(null);return(0,r.useEffect)(()=>{x(i)},[i]),(0,r.useEffect)(()=>{e&&(async()=>{try{let t=await (0,s.fetchAvailableModels)(e);console.log("Fetched models for selector:",t),t.length>0&&w(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)(n.RobotOutlined,{className:"mr-2"})," ",f]}),(0,t.jsx)(o.Select,{value:h,placeholder:c,onChange:e=>{"custom"===e?(y(!0),x(void 0)):(y(!1),x(e),d&&d(e))},options:[...Array.from(new Set(v.map(e=>e.model_group))).map((e,t)=>({value:e,label:e,key:t})),{value:"custom",label:"Enter custom model",key:"custom"}],style:{width:"100%",...m},showSearch:!0,className:`rounded-md ${g||""}`,disabled:u}),b&&(0,t.jsx)(a.TextInput,{className:"mt-2",placeholder:"Enter custom model name",onValueChange:e=>{k.current&&clearTimeout(k.current),k.current=setTimeout(()=>{x(e),d&&d(e)},500)},disabled:u})]})}])},91739,e=>{"use strict";var t=e.i(544195);e.s(["Radio",()=>t.default])},409797,e=>{"use strict";var t=e.i(631171);e.s(["ChevronDownIcon",()=>t.default])},500727,696609,531516,e=>{"use strict";var t=e.i(266027),r=e.i(243652),a=e.i(764205),l=e.i(135214);let o=(0,r.createQueryKeys)("mcpServers");e.s(["useMCPServers",0,e=>{let{accessToken:r}=(0,l.default)();return(0,t.useQuery)({queryKey:o.list(e?{filters:{teamId:e}}:void 0),queryFn:async()=>await (0,a.fetchMCPServers)(r,e),enabled:!!r})}],500727);var n=e.i(843476),s=e.i(271645),i=e.i(536916),c=e.i(599724),d=e.i(409797),u=e.i(246349),u=u;let m=/\b(delete|remove|destroy|purge|drop|erase|unlink)\b/i,g=/\b(create|add|insert|new|post|submit|register|make|generate|write|upload)\b/i,p=/\b(update|edit|modify|change|patch|put|set|rename|move|transform)\b/i,f=/\b(get|read|list|fetch|search|find|query|retrieve|show|view|check|describe|info)\b/i;function h(e,t=""){let r=e.toLowerCase();if(f.test(r))return"read";if(m.test(r))return"delete";if(p.test(r))return"update";if(g.test(r))return"create";if(t){let e=t.toLowerCase();if(f.test(e))return"read";if(m.test(e))return"delete";if(p.test(e))return"update";if(g.test(e))return"create"}return"unknown"}function x(e){let t={read:[],create:[],update:[],delete:[],unknown:[]};for(let r of e)t[h(r.name,r.description)].push(r);return t}let b={read:{label:"Read",description:"Safe operations — fetch, list, search. No side effects.",risk:"low"},create:{label:"Create",description:"Add new resources — insert, upload, register.",risk:"medium"},update:{label:"Update",description:"Modify existing resources — edit, patch, rename.",risk:"medium"},delete:{label:"Delete",description:"Destructive operations — remove, purge, destroy.",risk:"high"},unknown:{label:"Other",description:"Operations that could not be automatically classified.",risk:"unknown"}};e.s(["CRUD_GROUP_META",0,b,"classifyToolOp",()=>h,"groupToolsByCrud",()=>x],696609);let y=["read","create","update","delete","unknown"],v={low:"bg-green-100 text-green-800",medium:"bg-yellow-100 text-yellow-800",high:"bg-red-100 text-red-800 font-semibold",unknown:"bg-gray-100 text-gray-700"},w={read:"border-green-200",create:"border-blue-200",update:"border-yellow-200",delete:"border-red-300",unknown:"border-gray-200"},k={read:"bg-green-50",create:"bg-blue-50",update:"bg-yellow-50",delete:"bg-red-50",unknown:"bg-gray-50"};e.s(["default",0,({tools:e,value:t,onChange:r,readOnly:a=!1,searchFilter:l=""})=>{let[o,m]=(0,s.useState)({read:!1,create:!1,update:!1,delete:!1,unknown:!0}),g=(0,s.useMemo)(()=>x(e),[e]),p=(0,s.useMemo)(()=>new Set(void 0===t?e.map(e=>e.name):t),[t,e]),f=e=>{if(a)return;let t=new Set(p);t.has(e)?t.delete(e):t.add(e),r(Array.from(t))};return 0===e.length?null:(0,n.jsx)("div",{className:"space-y-3",children:y.map(e=>{let t,s=g[e];if(0===s.length)return null;if(l){let e=l.toLowerCase();if(!s.some(t=>t.name.toLowerCase().includes(e)||(t.description??"").toLowerCase().includes(e)))return null}let h=b[e],x=(t=g[e]).length>0&&t.every(e=>p.has(e.name)),y=(e=>{let t=g[e];if(0===t.length)return!1;let r=t.filter(e=>p.has(e.name)).length;return r>0&&r{m(t=>({...t,[e]:!t[e]}))},children:[C?(0,n.jsx)(u.default,{className:"w-4 h-4 text-gray-500 flex-shrink-0"}):(0,n.jsx)(d.ChevronDownIcon,{className:"w-4 h-4 text-gray-500 flex-shrink-0"}),(0,n.jsx)("span",{className:"font-semibold text-gray-900 text-sm",children:h.label}),(0,n.jsx)("span",{className:`text-xs px-2 py-0.5 rounded-full ${v[h.risk]}`,children:"high"===h.risk?"High Risk":"medium"===h.risk?"Medium Risk":"low"===h.risk?"Safe":"Unclassified"}),(0,n.jsxs)("span",{className:"text-xs text-gray-500 ml-1",children:[s.filter(e=>p.has(e.name)).length,"/",s.length," allowed"]})]}),!a&&(0,n.jsxs)("div",{className:"flex items-center gap-2 ml-4",children:[(0,n.jsx)(c.Text,{className:"text-xs text-gray-500",children:x?"All on":y?"Partial":"All off"}),(0,n.jsx)(i.Checkbox,{checked:x,indeterminate:y,onChange:t=>((e,t)=>{if(a)return;let l=new Set(p);for(let r of g[e])t?l.add(r.name):l.delete(r.name);r(Array.from(l))})(e,t.target.checked),onClick:e=>e.stopPropagation()})]})]}),!C&&(0,n.jsx)("div",{className:"px-4 pt-2 pb-1 text-xs text-gray-500 bg-white border-b border-gray-100",children:h.description}),!C&&(0,n.jsx)("div",{className:"bg-white divide-y divide-gray-50",children:s.filter(e=>!l||e.name.toLowerCase().includes(l.toLowerCase())||(e.description??"").toLowerCase().includes(l.toLowerCase())).map(e=>{let t,r=(t=e.name,p.has(t));return(0,n.jsxs)("div",{className:`flex items-start gap-3 px-4 py-2.5 transition-colors hover:bg-gray-50 ${!a?"cursor-pointer":""} ${r?"":"opacity-60"}`,onClick:()=>f(e.name),children:[(0,n.jsx)(i.Checkbox,{checked:r,onChange:()=>f(e.name),disabled:a,onClick:e=>e.stopPropagation()}),(0,n.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,n.jsx)(c.Text,{className:"font-medium text-gray-900 text-sm",children:e.name}),e.description&&(0,n.jsx)(c.Text,{className:"text-xs text-gray-500 mt-0.5 leading-snug",children:e.description})]}),(0,n.jsx)("span",{className:`text-xs px-1.5 py-0.5 rounded flex-shrink-0 ${r?"bg-green-100 text-green-700":"bg-gray-100 text-gray-500"}`,children:r?"on":"off"})]},e.name)})})]},e)})})}],531516)},361653,e=>{"use strict";let t=(0,e.i(475254).default)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);e.s(["default",()=>t])},841947,e=>{"use strict";let t=(0,e.i(475254).default)("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);e.s(["default",()=>t])},603908,e=>{"use strict";let t=(0,e.i(475254).default)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);e.s(["default",()=>t])},793130,e=>{"use strict";var t=e.i(290571),r=e.i(429427),a=e.i(371330),l=e.i(271645),o=e.i(394487),n=e.i(503269),s=e.i(214520),i=e.i(746725),c=e.i(914189),d=e.i(144279),u=e.i(294316),m=e.i(601893),g=e.i(140721),p=e.i(942803),f=e.i(233538),h=e.i(694421),x=e.i(700020),b=e.i(35889),y=e.i(998348),v=e.i(722678);let w=(0,l.createContext)(null);w.displayName="GroupContext";let k=l.Fragment,C=Object.assign((0,x.forwardRefWithAs)(function(e,t){var k;let C=(0,l.useId)(),j=(0,p.useProvidedId)(),N=(0,m.useDisabled)(),{id:S=j||`headlessui-switch-${C}`,disabled:$=N||!1,checked:M,defaultChecked:E,onChange:O,name:T,value:P,form:_,autoFocus:z=!1,...R}=e,I=(0,l.useContext)(w),[L,D]=(0,l.useState)(null),B=(0,l.useRef)(null),F=(0,u.useSyncRefs)(B,t,null===I?null:I.setSwitch,D),A=(0,s.useDefaultValue)(E),[q,H]=(0,n.useControllable)(M,O,null!=A&&A),G=(0,i.useDisposables)(),[X,V]=(0,l.useState)(!1),K=(0,c.useEvent)(()=>{V(!0),null==H||H(!q),G.nextFrame(()=>{V(!1)})}),W=(0,c.useEvent)(e=>{if((0,f.isDisabledReactIssue7711)(e.currentTarget))return e.preventDefault();e.preventDefault(),K()}),U=(0,c.useEvent)(e=>{e.key===y.Keys.Space?(e.preventDefault(),K()):e.key===y.Keys.Enter&&(0,h.attemptSubmit)(e.currentTarget)}),Y=(0,c.useEvent)(e=>e.preventDefault()),Q=(0,v.useLabelledBy)(),J=(0,b.useDescribedBy)(),{isFocusVisible:Z,focusProps:ee}=(0,r.useFocusRing)({autoFocus:z}),{isHovered:et,hoverProps:er}=(0,a.useHover)({isDisabled:$}),{pressed:ea,pressProps:el}=(0,o.useActivePress)({disabled:$}),eo=(0,l.useMemo)(()=>({checked:q,disabled:$,hover:et,focus:Z,active:ea,autofocus:z,changing:X}),[q,et,Z,ea,$,X,z]),en=(0,x.mergeProps)({id:S,ref:F,role:"switch",type:(0,d.useResolveButtonType)(e,L),tabIndex:-1===e.tabIndex?0:null!=(k=e.tabIndex)?k:0,"aria-checked":q,"aria-labelledby":Q,"aria-describedby":J,disabled:$||void 0,autoFocus:z,onClick:W,onKeyUp:U,onKeyPress:Y},ee,er,el),es=(0,l.useCallback)(()=>{if(void 0!==A)return null==H?void 0:H(A)},[H,A]),ei=(0,x.useRender)();return l.default.createElement(l.default.Fragment,null,null!=T&&l.default.createElement(g.FormFields,{disabled:$,data:{[T]:P||"on"},overrides:{type:"checkbox",checked:q},form:_,onReset:es}),ei({ourProps:en,theirProps:R,slot:eo,defaultTag:"button",name:"Switch"}))}),{Group:function(e){var t;let[r,a]=(0,l.useState)(null),[o,n]=(0,v.useLabels)(),[s,i]=(0,b.useDescriptions)(),c=(0,l.useMemo)(()=>({switch:r,setSwitch:a}),[r,a]),d=(0,x.useRender)();return l.default.createElement(i,{name:"Switch.Description",value:s},l.default.createElement(n,{name:"Switch.Label",value:o,props:{htmlFor:null==(t=c.switch)?void 0:t.id,onClick(e){r&&(e.currentTarget instanceof HTMLLabelElement&&e.preventDefault(),r.click(),r.focus({preventScroll:!0}))}}},l.default.createElement(w.Provider,{value:c},d({ourProps:{},theirProps:e,slot:{},defaultTag:k,name:"Switch.Group"}))))},Label:v.Label,Description:b.Description});var j=e.i(888288),N=e.i(95779),S=e.i(444755),$=e.i(673706),M=e.i(829087);let E=(0,$.makeClassName)("Switch"),O=l.default.forwardRef((e,r)=>{let{checked:a,defaultChecked:o=!1,onChange:n,color:s,name:i,error:c,errorMessage:d,disabled:u,required:m,tooltip:g,id:p}=e,f=(0,t.__rest)(e,["checked","defaultChecked","onChange","color","name","error","errorMessage","disabled","required","tooltip","id"]),h={bgColor:s?(0,$.getColorClassNames)(s,N.colorPalette.background).bgColor:"bg-tremor-brand dark:bg-dark-tremor-brand",ringColor:s?(0,$.getColorClassNames)(s,N.colorPalette.ring).ringColor:"ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted"},[x,b]=(0,j.default)(o,a),[y,v]=(0,l.useState)(!1),{tooltipProps:w,getReferenceProps:k}=(0,M.useTooltip)(300);return l.default.createElement("div",{className:"flex flex-row items-center justify-start"},l.default.createElement(M.default,Object.assign({text:g},w)),l.default.createElement("div",Object.assign({ref:(0,$.mergeRefs)([r,w.refs.setReference]),className:(0,S.tremorTwMerge)(E("root"),"flex flex-row relative h-5")},f,k),l.default.createElement("input",{type:"checkbox",className:(0,S.tremorTwMerge)(E("input"),"absolute w-5 h-5 cursor-pointer left-0 top-0 opacity-0"),name:i,required:m,checked:x,onChange:e=>{e.preventDefault()}}),l.default.createElement(C,{checked:x,onChange:e=>{b(e),null==n||n(e)},disabled:u,className:(0,S.tremorTwMerge)(E("switch"),"w-10 h-5 group relative inline-flex shrink-0 cursor-pointer items-center justify-center rounded-tremor-full","focus:outline-none",u?"cursor-not-allowed":""),onFocus:()=>v(!0),onBlur:()=>v(!1),id:p},l.default.createElement("span",{className:(0,S.tremorTwMerge)(E("sr-only"),"sr-only")},"Switch ",x?"on":"off"),l.default.createElement("span",{"aria-hidden":"true",className:(0,S.tremorTwMerge)(E("background"),x?h.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")}),l.default.createElement("span",{"aria-hidden":"true",className:(0,S.tremorTwMerge)(E("round"),x?(0,S.tremorTwMerge)(h.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,S.tremorTwMerge)("ring-2",h.ringColor):"")}))),c&&d?l.default.createElement("p",{className:(0,S.tremorTwMerge)(E("errorMessage"),"text-sm text-red-500 mt-1 ")},d):null)});O.displayName="Switch",e.s(["Switch",()=>O],793130)},158392,419470,e=>{"use strict";var t=e.i(843476),r=e.i(779241);let a={ttl:3600,lowest_latency_buffer:0},l=({routingStrategyArgs:e})=>{let l={ttl:"Sliding window to look back over when calculating the average latency of a deployment. Default - 1 hour (in seconds).",lowest_latency_buffer:"Shuffle between deployments within this % of the lowest latency. Default - 0 (i.e. always pick lowest latency)."};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"max-w-3xl",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Latency-Based Configuration"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Fine-tune latency-based routing behavior"})]}),(0,t.jsx)("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2 xl:grid-cols-3",children:Object.entries(e||a).map(([e,a])=>(0,t.jsx)("div",{className:"space-y-2",children:(0,t.jsxs)("label",{className:"block",children:[(0,t.jsx)("span",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:e.replace(/_/g," ")}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-0.5 mb-2",children:l[e]||""}),(0,t.jsx)(r.TextInput,{name:e,defaultValue:"object"==typeof a?JSON.stringify(a,null,2):a?.toString(),className:"font-mono text-sm w-full"})]})},e))})]}),(0,t.jsx)("div",{className:"border-t border-gray-200"})]})},o=({routerSettings:e,routerFieldsMetadata:a})=>(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"max-w-3xl",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Reliability & Retries"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Configure retry logic and failure handling"})]}),(0,t.jsx)("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2 xl:grid-cols-3",children:Object.entries(e).filter(([e,t])=>"fallbacks"!=e&&"context_window_fallbacks"!=e&&"routing_strategy_args"!=e&&"routing_strategy"!=e&&"enable_tag_filtering"!=e).map(([e,l])=>(0,t.jsx)("div",{className:"space-y-2",children:(0,t.jsxs)("label",{className:"block",children:[(0,t.jsx)("span",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:a[e]?.ui_field_name||e}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-0.5 mb-2",children:a[e]?.field_description||""}),(0,t.jsx)(r.TextInput,{name:e,defaultValue:null==l||"null"===l?"":"object"==typeof l?JSON.stringify(l,null,2):l?.toString()||"",placeholder:"—",className:"font-mono text-sm w-full"})]})},e))})]});var n=e.i(199133);let s=({selectedStrategy:e,availableStrategies:r,routingStrategyDescriptions:a,routerFieldsMetadata:l,onStrategyChange:o})=>(0,t.jsxs)("div",{className:"space-y-2 max-w-3xl",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:l.routing_strategy?.ui_field_name||"Routing Strategy"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-0.5 mb-2",children:l.routing_strategy?.field_description||""})]}),(0,t.jsx)("div",{className:"routing-strategy-select max-w-3xl",children:(0,t.jsx)(n.Select,{value:e,onChange:o,style:{width:"100%"},size:"large",children:r.map(e=>(0,t.jsx)(n.Select.Option,{value:e,label:e,children:(0,t.jsxs)("div",{className:"flex flex-col gap-0.5 py-1",children:[(0,t.jsx)("span",{className:"font-mono text-sm font-medium",children:e}),a[e]&&(0,t.jsx)("span",{className:"text-xs text-gray-500 font-normal",children:a[e]})]})},e))})})]});var i=e.i(793130);let c=({enabled:e,routerFieldsMetadata:r,onToggle:a})=>(0,t.jsx)("div",{className:"space-y-3 max-w-3xl",children:(0,t.jsxs)("div",{className:"flex items-start justify-between",children:[(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)("label",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:r.enable_tag_filtering?.ui_field_name||"Enable Tag Filtering"}),(0,t.jsxs)("p",{className:"text-xs text-gray-500 mt-0.5",children:[r.enable_tag_filtering?.field_description||"",r.enable_tag_filtering?.link&&(0,t.jsxs)(t.Fragment,{children:[" ",(0,t.jsx)("a",{href:r.enable_tag_filtering.link,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-800 underline",children:"Learn more"})]})]})]}),(0,t.jsx)(i.Switch,{checked:e,onChange:a,className:"ml-4"})]})});e.s(["default",0,({value:e,onChange:r,routerFieldsMetadata:a,availableRoutingStrategies:n,routingStrategyDescriptions:i})=>(0,t.jsxs)("div",{className:"w-full space-y-8 py-2",children:[(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"max-w-3xl",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Routing Settings"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Configure how requests are routed to deployments"})]}),n.length>0&&(0,t.jsx)(s,{selectedStrategy:e.selectedStrategy||e.routerSettings.routing_strategy||null,availableStrategies:n,routingStrategyDescriptions:i,routerFieldsMetadata:a,onStrategyChange:t=>{r({...e,selectedStrategy:t})}}),(0,t.jsx)(c,{enabled:e.enableTagFiltering,routerFieldsMetadata:a,onToggle:t=>{r({...e,enableTagFiltering:t})}})]}),(0,t.jsx)("div",{className:"border-t border-gray-200"}),"latency-based-routing"===e.selectedStrategy&&(0,t.jsx)(l,{routingStrategyArgs:e.routerSettings.routing_strategy_args}),(0,t.jsx)(o,{routerSettings:e.routerSettings,routerFieldsMetadata:a})]})],158392);var d=e.i(994388),u=e.i(998573),m=e.i(653496),g=e.i(107233),p=e.i(271645),f=e.i(592968),h=e.i(361653),h=h;let x=(0,e.i(475254).default)("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);var b=e.i(37727);function y({group:e,onChange:r,availableModels:a,maxFallbacks:l}){let o=a.filter(t=>t!==e.primaryModel),s=e.fallbackModels.length{let a=[...e.fallbackModels];a.includes(t)&&(a=a.filter(e=>e!==t)),r({...e,primaryModel:t,fallbackModels:a})},showSearch:!0,filterOption:(e,t)=>(t?.label??"").toLowerCase().includes(e.toLowerCase()),options:a.map(e=>({label:e,value:e}))}),!e.primaryModel&&(0,t.jsxs)("div",{className:"mt-2 flex items-center gap-2 text-amber-600 text-xs bg-amber-50 p-2 rounded",children:[(0,t.jsx)(h.default,{className:"w-4 h-4"}),(0,t.jsx)("span",{children:"Select a model to begin configuring fallbacks"})]})]}),(0,t.jsx)("div",{className:"flex items-center justify-center -my-4 z-10",children:(0,t.jsxs)("div",{className:"bg-indigo-50 text-indigo-500 px-4 py-1 rounded-full text-xs font-bold border border-indigo-100 flex items-center gap-2 shadow-sm",children:[(0,t.jsx)(x,{className:"w-4 h-4"}),"IF FAILS, TRY..."]})}),(0,t.jsxs)("div",{className:`transition-opacity duration-300 ${!e.primaryModel?"opacity-50 pointer-events-none":"opacity-100"}`,children:[(0,t.jsxs)("label",{className:"block text-sm font-semibold text-gray-700 mb-2",children:["Fallback Chain ",(0,t.jsx)("span",{className:"text-red-500",children:"*"}),(0,t.jsxs)("span",{className:"text-xs text-gray-500 font-normal ml-2",children:["(Max ",l," fallbacks at a time)"]})]}),(0,t.jsxs)("div",{className:"bg-gray-50 rounded-xl p-4 border border-gray-200",children:[(0,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsx)(n.Select,{mode:"multiple",className:"w-full",size:"large",placeholder:s?"Select fallback models to add...":`Maximum ${l} fallbacks reached`,value:e.fallbackModels,onChange:t=>{let a=t.slice(0,l);r({...e,fallbackModels:a})},disabled:!e.primaryModel,options:o.map(e=>({label:e,value:e})),optionRender:(r,a)=>{let l=e.fallbackModels.includes(r.value),o=l?e.fallbackModels.indexOf(r.value)+1:null;return(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[l&&null!==o&&(0,t.jsx)("span",{className:"flex items-center justify-center w-5 h-5 rounded bg-indigo-100 text-indigo-600 text-xs font-bold",children:o}),(0,t.jsx)("span",{children:r.label})]})},maxTagCount:"responsive",maxTagPlaceholder:e=>(0,t.jsx)(f.Tooltip,{styles:{root:{pointerEvents:"none"}},title:e.map(({value:e})=>e).join(", "),children:(0,t.jsxs)("span",{children:["+",e.length," more"]})}),showSearch:!0,filterOption:(e,t)=>(t?.label??"").toLowerCase().includes(e.toLowerCase())}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1 ml-1",children:s?`Search and select multiple models. Selected models will appear below in order. (${e.fallbackModels.length}/${l} used)`:`Maximum ${l} fallbacks reached. Remove some to add more.`})]}),(0,t.jsx)("div",{className:"space-y-2 min-h-[100px]",children:0===e.fallbackModels.length?(0,t.jsxs)("div",{className:"h-32 border-2 border-dashed border-gray-300 rounded-lg flex flex-col items-center justify-center text-gray-400",children:[(0,t.jsx)("span",{className:"text-sm",children:"No fallback models selected"}),(0,t.jsx)("span",{className:"text-xs mt-1",children:"Add models from the dropdown above"})]}):e.fallbackModels.map((a,l)=>(0,t.jsxs)("div",{className:"group flex items-center justify-between p-3 bg-white rounded-lg border border-gray-200 hover:border-indigo-300 hover:shadow-sm transition-all",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"flex items-center justify-center w-6 h-6 rounded bg-gray-100 text-gray-400 group-hover:text-indigo-500 group-hover:bg-indigo-50",children:(0,t.jsx)("span",{className:"text-xs font-bold",children:l+1})}),(0,t.jsx)("div",{children:(0,t.jsx)("span",{className:"font-medium text-gray-800",children:a})})]}),(0,t.jsx)("button",{type:"button",onClick:()=>{let t;return t=e.fallbackModels.filter((e,t)=>t!==l),void r({...e,fallbackModels:t})},className:"opacity-0 group-hover:opacity-100 transition-opacity text-gray-400 hover:text-red-500 p-1",children:(0,t.jsx)(b.X,{className:"w-4 h-4"})})]},`${a}-${l}`))})]})]})]})}function v({groups:e,onGroupsChange:r,availableModels:a,maxFallbacks:l=10,maxGroups:o=5}){let[n,s]=(0,p.useState)(e.length>0?e[0].id:"1");(0,p.useEffect)(()=>{e.length>0?e.some(e=>e.id===n)||s(e[0].id):s("1")},[e]);let i=()=>{if(e.length>=o)return;let t=Date.now().toString();r([...e,{id:t,primaryModel:null,fallbackModels:[]}]),s(t)},c=t=>{r(e.map(e=>e.id===t.id?t:e))},f=e.map((r,o)=>{let n=r.primaryModel?r.primaryModel:`Group ${o+1}`;return{key:r.id,label:n,closable:e.length>1,children:(0,t.jsx)(y,{group:r,onChange:c,availableModels:a,maxFallbacks:l})}});return 0===e.length?(0,t.jsxs)("div",{className:"text-center py-12 bg-gray-50 rounded-lg border border-dashed border-gray-300",children:[(0,t.jsx)("p",{className:"text-gray-500 mb-4",children:"No fallback groups configured"}),(0,t.jsx)(d.Button,{variant:"primary",onClick:i,icon:()=>(0,t.jsx)(g.Plus,{className:"w-4 h-4"}),children:"Create First Group"})]}):(0,t.jsx)(m.Tabs,{type:"editable-card",activeKey:n,onChange:s,onEdit:(t,a)=>{"add"===a?i():"remove"===a&&e.length>1&&(t=>{if(1===e.length)return u.message.warning("At least one group is required");let a=e.filter(e=>e.id!==t);r(a),n===t&&a.length>0&&s(a[a.length-1].id)})(t)},items:f,className:"fallback-tabs",tabBarStyle:{marginBottom:0},hideAdd:e.length>=o})}e.s(["FallbackSelectionForm",()=>v],419470)}]); \ No newline at end of file + `]:{[`&:hover ${t}-inner`]:{backgroundColor:e.colorPrimaryHover,borderColor:"transparent"}}},{[t]:{"&-indeterminate":{"&":{[`${t}-inner`]:{backgroundColor:`${e.colorBgContainer}`,borderColor:`${e.colorBorder}`,"&:after":{top:"50%",insetInlineStart:"50%",width:e.calc(e.fontSizeLG).div(2).equal(),height:e.calc(e.fontSizeLG).div(2).equal(),backgroundColor:e.colorPrimary,border:0,transform:"translate(-50%, -50%) scale(1)",opacity:1,content:'""'}},[`&:hover ${t}-inner`]:{backgroundColor:`${e.colorBgContainer}`,borderColor:`${e.colorPrimary}`}}}}},{[`${l}-disabled`]:{cursor:"not-allowed"},[`${t}-disabled`]:{[`&, ${t}-input`]:{cursor:"not-allowed",pointerEvents:"none"},[`${t}-inner`]:{background:e.colorBgContainerDisabled,borderColor:e.colorBorder,"&:after":{borderColor:e.colorTextDisabled}},"&:after":{display:"none"},"& + span":{color:e.colorTextDisabled},[`&${t}-indeterminate ${t}-inner::after`]:{background:e.colorTextDisabled}}}]})((0,o.mergeToken)(t,{checkboxCls:`.${e}`,checkboxSize:t.controlInteractiveSize}))}let s=(0,l.genStyleHooks)("Checkbox",(e,{prefixCls:t})=>[n(t,e)]);e.s(["default",0,s,"getStyle",()=>n],236836)},681216,e=>{"use strict";var t=e.i(271645),r=e.i(963188);function a(e){let a=t.default.useRef(null),l=()=>{r.default.cancel(a.current),a.current=null};return[()=>{l(),a.current=(0,r.default)(()=>{a.current=null})},t=>{a.current&&(t.stopPropagation(),l()),null==e||e(t)}]}e.s(["default",()=>a])},374276,e=>{"use strict";e.i(247167);var t=e.i(271645),r=e.i(343794),a=e.i(91874),l=e.i(611935),o=e.i(121872),n=e.i(26905),s=e.i(242064),i=e.i(937328),c=e.i(321883),d=e.i(62139),u=e.i(421512),m=e.i(236836),g=e.i(681216),p=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 l=0,a=Object.getOwnPropertySymbols(e);lt.indexOf(a[l])&&Object.prototype.propertyIsEnumerable.call(e,a[l])&&(r[a[l]]=e[a[l]]);return r};let f=t.forwardRef((e,f)=>{var h;let{prefixCls:x,className:b,rootClassName:y,children:v,indeterminate:w=!1,style:k,onMouseEnter:C,onMouseLeave:j,skipGroup:N=!1,disabled:S}=e,$=p(e,["prefixCls","className","rootClassName","children","indeterminate","style","onMouseEnter","onMouseLeave","skipGroup","disabled"]),{getPrefixCls:M,direction:E,checkbox:O}=t.useContext(s.ConfigContext),T=t.useContext(u.default),{isFormItemInput:P}=t.useContext(d.FormItemInputContext),_=t.useContext(i.default),z=null!=(h=(null==T?void 0:T.disabled)||S)?h:_,R=t.useRef($.value),I=t.useRef(null),L=(0,l.composeRef)(f,I);t.useEffect(()=>{null==T||T.registerValue($.value)},[]),t.useEffect(()=>{if(!N)return $.value!==R.current&&(null==T||T.cancelValue(R.current),null==T||T.registerValue($.value),R.current=$.value),()=>null==T?void 0:T.cancelValue($.value)},[$.value]),t.useEffect(()=>{var e;(null==(e=I.current)?void 0:e.input)&&(I.current.input.indeterminate=w)},[w]);let D=M("checkbox",x),B=(0,c.default)(D),[F,A,q]=(0,m.default)(D,B),H=Object.assign({},$);T&&!N&&(H.onChange=(...e)=>{$.onChange&&$.onChange.apply($,e),T.toggleOption&&T.toggleOption({label:v,value:$.value})},H.name=T.name,H.checked=T.value.includes($.value));let G=(0,r.default)(`${D}-wrapper`,{[`${D}-rtl`]:"rtl"===E,[`${D}-wrapper-checked`]:H.checked,[`${D}-wrapper-disabled`]:z,[`${D}-wrapper-in-form-item`]:P},null==O?void 0:O.className,b,y,q,B,A),X=(0,r.default)({[`${D}-indeterminate`]:w},n.TARGET_CLS,A),[V,K]=(0,g.default)(H.onClick);return F(t.createElement(o.default,{component:"Checkbox",disabled:z},t.createElement("label",{className:G,style:Object.assign(Object.assign({},null==O?void 0:O.style),k),onMouseEnter:C,onMouseLeave:j,onClick:V},t.createElement(a.default,Object.assign({},H,{onClick:K,prefixCls:D,className:X,disabled:z,ref:L})),null!=v&&t.createElement("span",{className:`${D}-label`},v))))});var h=e.i(8211),x=e.i(529681),b=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 l=0,a=Object.getOwnPropertySymbols(e);lt.indexOf(a[l])&&Object.prototype.propertyIsEnumerable.call(e,a[l])&&(r[a[l]]=e[a[l]]);return r};let y=t.forwardRef((e,a)=>{let{defaultValue:l,children:o,options:n=[],prefixCls:i,className:d,rootClassName:g,style:p,onChange:y}=e,v=b(e,["defaultValue","children","options","prefixCls","className","rootClassName","style","onChange"]),{getPrefixCls:w,direction:k}=t.useContext(s.ConfigContext),[C,j]=t.useState(v.value||l||[]),[N,S]=t.useState([]);t.useEffect(()=>{"value"in v&&j(v.value||[])},[v.value]);let $=t.useMemo(()=>n.map(e=>"string"==typeof e||"number"==typeof e?{label:e,value:e}:e),[n]),M=e=>{S(t=>t.filter(t=>t!==e))},E=e=>{S(t=>[].concat((0,h.default)(t),[e]))},O=e=>{let t=C.indexOf(e.value),r=(0,h.default)(C);-1===t?r.push(e.value):r.splice(t,1),"value"in v||j(r),null==y||y(r.filter(e=>N.includes(e)).sort((e,t)=>$.findIndex(t=>t.value===e)-$.findIndex(e=>e.value===t)))},T=w("checkbox",i),P=`${T}-group`,_=(0,c.default)(T),[z,R,I]=(0,m.default)(T,_),L=(0,x.default)(v,["value","disabled"]),D=n.length?$.map(e=>t.createElement(f,{prefixCls:T,key:e.value.toString(),disabled:"disabled"in e?e.disabled:v.disabled,value:e.value,checked:C.includes(e.value),onChange:e.onChange,className:(0,r.default)(`${P}-item`,e.className),style:e.style,title:e.title,id:e.id,required:e.required},e.label)):o,B=t.useMemo(()=>({toggleOption:O,value:C,disabled:v.disabled,name:v.name,registerValue:E,cancelValue:M}),[O,C,v.disabled,v.name,E,M]),F=(0,r.default)(P,{[`${P}-rtl`]:"rtl"===k},d,g,I,_,R);return z(t.createElement("div",Object.assign({className:F,style:p},L,{ref:a}),t.createElement(u.default.Provider,{value:B},D)))});f.Group=y,f.__ANT_CHECKBOX=!0,e.s(["default",0,f],374276)},536916,e=>{"use strict";var t=e.i(374276);e.s(["Checkbox",()=>t.default])},292639,e=>{"use strict";var t=e.i(764205),r=e.i(266027);let a=(0,e.i(243652).createQueryKeys)("uiSettings");e.s(["useUISettings",0,()=>(0,r.useQuery)({queryKey:a.list({}),queryFn:async()=>await (0,t.getUiSettings)(),staleTime:36e5,gcTime:36e5})])},250980,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3m0 0v3m0-3h3m-3 0H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z"}))});e.s(["PlusCircleIcon",0,r],250980)},502547,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"}))});e.s(["ChevronRightIcon",0,r],502547)},988297,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4v16m8-8H4"}))});e.s(["PlusIcon",0,r],988297)},797672,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"}))});e.s(["PencilIcon",0,r],797672)},992619,e=>{"use strict";var t=e.i(843476),r=e.i(271645),a=e.i(779241),l=e.i(599724),o=e.i(199133),n=e.i(983561),s=e.i(689020);e.s(["default",0,({accessToken:e,value:i,placeholder:c="Select a Model",onChange:d,disabled:u=!1,style:m,className:g,showLabel:p=!0,labelText:f="Select Model"})=>{let[h,x]=(0,r.useState)(i),[b,y]=(0,r.useState)(!1),[v,w]=(0,r.useState)([]),k=(0,r.useRef)(null);return(0,r.useEffect)(()=>{x(i)},[i]),(0,r.useEffect)(()=>{e&&(async()=>{try{let t=await (0,s.fetchAvailableModels)(e);console.log("Fetched models for selector:",t),t.length>0&&w(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)(n.RobotOutlined,{className:"mr-2"})," ",f]}),(0,t.jsx)(o.Select,{value:h,placeholder:c,onChange:e=>{"custom"===e?(y(!0),x(void 0)):(y(!1),x(e),d&&d(e))},options:[...Array.from(new Set(v.map(e=>e.model_group))).map((e,t)=>({value:e,label:e,key:t})),{value:"custom",label:"Enter custom model",key:"custom"}],style:{width:"100%",...m},showSearch:!0,className:`rounded-md ${g||""}`,disabled:u}),b&&(0,t.jsx)(a.TextInput,{className:"mt-2",placeholder:"Enter custom model name",onValueChange:e=>{k.current&&clearTimeout(k.current),k.current=setTimeout(()=>{x(e),d&&d(e)},500)},disabled:u})]})}])},91739,e=>{"use strict";var t=e.i(544195);e.s(["Radio",()=>t.default])},409797,e=>{"use strict";var t=e.i(631171);e.s(["ChevronDownIcon",()=>t.default])},500727,696609,531516,e=>{"use strict";var t=e.i(266027),r=e.i(243652),a=e.i(764205),l=e.i(135214);let o=(0,r.createQueryKeys)("mcpServers");e.s(["useMCPServers",0,e=>{let{accessToken:r}=(0,l.default)();return(0,t.useQuery)({queryKey:o.list(e?{filters:{teamId:e}}:void 0),queryFn:async()=>await (0,a.fetchMCPServers)(r,e),enabled:!!r})}],500727);var n=e.i(843476),s=e.i(271645),i=e.i(536916),c=e.i(599724),d=e.i(409797),u=e.i(246349),u=u;let m=/\b(delete|remove|destroy|purge|drop|erase|unlink)\b/i,g=/\b(create|add|insert|new|post|submit|register|make|generate|write|upload)\b/i,p=/\b(update|edit|modify|change|patch|put|set|rename|move|transform)\b/i,f=/\b(get|read|list|fetch|search|find|query|retrieve|show|view|check|describe|info)\b/i;function h(e,t=""){let r=e.toLowerCase();if(f.test(r))return"read";if(m.test(r))return"delete";if(p.test(r))return"update";if(g.test(r))return"create";if(t){let e=t.toLowerCase();if(f.test(e))return"read";if(m.test(e))return"delete";if(p.test(e))return"update";if(g.test(e))return"create"}return"unknown"}function x(e){let t={read:[],create:[],update:[],delete:[],unknown:[]};for(let r of e)t[h(r.name,r.description)].push(r);return t}let b={read:{label:"Read",description:"Safe operations — fetch, list, search. No side effects.",risk:"low"},create:{label:"Create",description:"Add new resources — insert, upload, register.",risk:"medium"},update:{label:"Update",description:"Modify existing resources — edit, patch, rename.",risk:"medium"},delete:{label:"Delete",description:"Destructive operations — remove, purge, destroy.",risk:"high"},unknown:{label:"Other",description:"Operations that could not be automatically classified.",risk:"unknown"}};e.s(["CRUD_GROUP_META",0,b,"classifyToolOp",()=>h,"groupToolsByCrud",()=>x],696609);let y=["read","create","update","delete","unknown"],v={low:"bg-green-100 text-green-800",medium:"bg-yellow-100 text-yellow-800",high:"bg-red-100 text-red-800 font-semibold",unknown:"bg-gray-100 text-gray-700"},w={read:"border-green-200",create:"border-blue-200",update:"border-yellow-200",delete:"border-red-300",unknown:"border-gray-200"},k={read:"bg-green-50",create:"bg-blue-50",update:"bg-yellow-50",delete:"bg-red-50",unknown:"bg-gray-50"};e.s(["default",0,({tools:e,value:t,onChange:r,readOnly:a=!1,searchFilter:l=""})=>{let[o,m]=(0,s.useState)({read:!1,create:!1,update:!1,delete:!1,unknown:!0}),g=(0,s.useMemo)(()=>x(e),[e]),p=(0,s.useMemo)(()=>new Set(void 0===t?e.map(e=>e.name):t),[t,e]),f=e=>{if(a)return;let t=new Set(p);t.has(e)?t.delete(e):t.add(e),r(Array.from(t))};return 0===e.length?null:(0,n.jsx)("div",{className:"space-y-3",children:y.map(e=>{let t,s=g[e];if(0===s.length)return null;if(l){let e=l.toLowerCase();if(!s.some(t=>t.name.toLowerCase().includes(e)||(t.description??"").toLowerCase().includes(e)))return null}let h=b[e],x=(t=g[e]).length>0&&t.every(e=>p.has(e.name)),y=(e=>{let t=g[e];if(0===t.length)return!1;let r=t.filter(e=>p.has(e.name)).length;return r>0&&r{m(t=>({...t,[e]:!t[e]}))},children:[C?(0,n.jsx)(u.default,{className:"w-4 h-4 text-gray-500 flex-shrink-0"}):(0,n.jsx)(d.ChevronDownIcon,{className:"w-4 h-4 text-gray-500 flex-shrink-0"}),(0,n.jsx)("span",{className:"font-semibold text-gray-900 text-sm",children:h.label}),(0,n.jsx)("span",{className:`text-xs px-2 py-0.5 rounded-full ${v[h.risk]}`,children:"high"===h.risk?"High Risk":"medium"===h.risk?"Medium Risk":"low"===h.risk?"Safe":"Unclassified"}),(0,n.jsxs)("span",{className:"text-xs text-gray-500 ml-1",children:[s.filter(e=>p.has(e.name)).length,"/",s.length," allowed"]})]}),!a&&(0,n.jsxs)("div",{className:"flex items-center gap-2 ml-4",children:[(0,n.jsx)(c.Text,{className:"text-xs text-gray-500",children:x?"All on":y?"Partial":"All off"}),(0,n.jsx)(i.Checkbox,{checked:x,indeterminate:y,onChange:t=>((e,t)=>{if(a)return;let l=new Set(p);for(let r of g[e])t?l.add(r.name):l.delete(r.name);r(Array.from(l))})(e,t.target.checked),onClick:e=>e.stopPropagation()})]})]}),!C&&(0,n.jsx)("div",{className:"px-4 pt-2 pb-1 text-xs text-gray-500 bg-white border-b border-gray-100",children:h.description}),!C&&(0,n.jsx)("div",{className:"bg-white divide-y divide-gray-50",children:s.filter(e=>!l||e.name.toLowerCase().includes(l.toLowerCase())||(e.description??"").toLowerCase().includes(l.toLowerCase())).map(e=>{let t,r=(t=e.name,p.has(t));return(0,n.jsxs)("div",{className:`flex items-start gap-3 px-4 py-2.5 transition-colors hover:bg-gray-50 ${!a?"cursor-pointer":""} ${r?"":"opacity-60"}`,onClick:()=>f(e.name),children:[(0,n.jsx)(i.Checkbox,{checked:r,onChange:()=>f(e.name),disabled:a,onClick:e=>e.stopPropagation()}),(0,n.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,n.jsx)(c.Text,{className:"font-medium text-gray-900 text-sm",children:e.name}),e.description&&(0,n.jsx)(c.Text,{className:"text-xs text-gray-500 mt-0.5 leading-snug",children:e.description})]}),(0,n.jsx)("span",{className:`text-xs px-1.5 py-0.5 rounded flex-shrink-0 ${r?"bg-green-100 text-green-700":"bg-gray-100 text-gray-500"}`,children:r?"on":"off"})]},e.name)})})]},e)})})}],531516)},361653,e=>{"use strict";let t=(0,e.i(475254).default)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);e.s(["default",()=>t])},841947,e=>{"use strict";let t=(0,e.i(475254).default)("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);e.s(["default",()=>t])},603908,e=>{"use strict";let t=(0,e.i(475254).default)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);e.s(["default",()=>t])},793130,e=>{"use strict";var t=e.i(290571),r=e.i(429427),a=e.i(371330),l=e.i(271645),o=e.i(394487),n=e.i(503269),s=e.i(214520),i=e.i(746725),c=e.i(914189),d=e.i(144279),u=e.i(294316),m=e.i(601893),g=e.i(140721),p=e.i(942803),f=e.i(233538),h=e.i(694421),x=e.i(700020),b=e.i(35889),y=e.i(998348),v=e.i(722678);let w=(0,l.createContext)(null);w.displayName="GroupContext";let k=l.Fragment,C=Object.assign((0,x.forwardRefWithAs)(function(e,t){var k;let C=(0,l.useId)(),j=(0,p.useProvidedId)(),N=(0,m.useDisabled)(),{id:S=j||`headlessui-switch-${C}`,disabled:$=N||!1,checked:M,defaultChecked:E,onChange:O,name:T,value:P,form:_,autoFocus:z=!1,...R}=e,I=(0,l.useContext)(w),[L,D]=(0,l.useState)(null),B=(0,l.useRef)(null),F=(0,u.useSyncRefs)(B,t,null===I?null:I.setSwitch,D),A=(0,s.useDefaultValue)(E),[q,H]=(0,n.useControllable)(M,O,null!=A&&A),G=(0,i.useDisposables)(),[X,V]=(0,l.useState)(!1),K=(0,c.useEvent)(()=>{V(!0),null==H||H(!q),G.nextFrame(()=>{V(!1)})}),W=(0,c.useEvent)(e=>{if((0,f.isDisabledReactIssue7711)(e.currentTarget))return e.preventDefault();e.preventDefault(),K()}),U=(0,c.useEvent)(e=>{e.key===y.Keys.Space?(e.preventDefault(),K()):e.key===y.Keys.Enter&&(0,h.attemptSubmit)(e.currentTarget)}),Y=(0,c.useEvent)(e=>e.preventDefault()),Q=(0,v.useLabelledBy)(),J=(0,b.useDescribedBy)(),{isFocusVisible:Z,focusProps:ee}=(0,r.useFocusRing)({autoFocus:z}),{isHovered:et,hoverProps:er}=(0,a.useHover)({isDisabled:$}),{pressed:ea,pressProps:el}=(0,o.useActivePress)({disabled:$}),eo=(0,l.useMemo)(()=>({checked:q,disabled:$,hover:et,focus:Z,active:ea,autofocus:z,changing:X}),[q,et,Z,ea,$,X,z]),en=(0,x.mergeProps)({id:S,ref:F,role:"switch",type:(0,d.useResolveButtonType)(e,L),tabIndex:-1===e.tabIndex?0:null!=(k=e.tabIndex)?k:0,"aria-checked":q,"aria-labelledby":Q,"aria-describedby":J,disabled:$||void 0,autoFocus:z,onClick:W,onKeyUp:U,onKeyPress:Y},ee,er,el),es=(0,l.useCallback)(()=>{if(void 0!==A)return null==H?void 0:H(A)},[H,A]),ei=(0,x.useRender)();return l.default.createElement(l.default.Fragment,null,null!=T&&l.default.createElement(g.FormFields,{disabled:$,data:{[T]:P||"on"},overrides:{type:"checkbox",checked:q},form:_,onReset:es}),ei({ourProps:en,theirProps:R,slot:eo,defaultTag:"button",name:"Switch"}))}),{Group:function(e){var t;let[r,a]=(0,l.useState)(null),[o,n]=(0,v.useLabels)(),[s,i]=(0,b.useDescriptions)(),c=(0,l.useMemo)(()=>({switch:r,setSwitch:a}),[r,a]),d=(0,x.useRender)();return l.default.createElement(i,{name:"Switch.Description",value:s},l.default.createElement(n,{name:"Switch.Label",value:o,props:{htmlFor:null==(t=c.switch)?void 0:t.id,onClick(e){r&&(e.currentTarget instanceof HTMLLabelElement&&e.preventDefault(),r.click(),r.focus({preventScroll:!0}))}}},l.default.createElement(w.Provider,{value:c},d({ourProps:{},theirProps:e,slot:{},defaultTag:k,name:"Switch.Group"}))))},Label:v.Label,Description:b.Description});var j=e.i(888288),N=e.i(95779),S=e.i(444755),$=e.i(673706),M=e.i(829087);let E=(0,$.makeClassName)("Switch"),O=l.default.forwardRef((e,r)=>{let{checked:a,defaultChecked:o=!1,onChange:n,color:s,name:i,error:c,errorMessage:d,disabled:u,required:m,tooltip:g,id:p}=e,f=(0,t.__rest)(e,["checked","defaultChecked","onChange","color","name","error","errorMessage","disabled","required","tooltip","id"]),h={bgColor:s?(0,$.getColorClassNames)(s,N.colorPalette.background).bgColor:"bg-tremor-brand dark:bg-dark-tremor-brand",ringColor:s?(0,$.getColorClassNames)(s,N.colorPalette.ring).ringColor:"ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted"},[x,b]=(0,j.default)(o,a),[y,v]=(0,l.useState)(!1),{tooltipProps:w,getReferenceProps:k}=(0,M.useTooltip)(300);return l.default.createElement("div",{className:"flex flex-row items-center justify-start"},l.default.createElement(M.default,Object.assign({text:g},w)),l.default.createElement("div",Object.assign({ref:(0,$.mergeRefs)([r,w.refs.setReference]),className:(0,S.tremorTwMerge)(E("root"),"flex flex-row relative h-5")},f,k),l.default.createElement("input",{type:"checkbox",className:(0,S.tremorTwMerge)(E("input"),"absolute w-5 h-5 cursor-pointer left-0 top-0 opacity-0"),name:i,required:m,checked:x,onChange:e=>{e.preventDefault()}}),l.default.createElement(C,{checked:x,onChange:e=>{b(e),null==n||n(e)},disabled:u,className:(0,S.tremorTwMerge)(E("switch"),"w-10 h-5 group relative inline-flex shrink-0 cursor-pointer items-center justify-center rounded-tremor-full","focus:outline-none",u?"cursor-not-allowed":""),onFocus:()=>v(!0),onBlur:()=>v(!1),id:p},l.default.createElement("span",{className:(0,S.tremorTwMerge)(E("sr-only"),"sr-only")},"Switch ",x?"on":"off"),l.default.createElement("span",{"aria-hidden":"true",className:(0,S.tremorTwMerge)(E("background"),x?h.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")}),l.default.createElement("span",{"aria-hidden":"true",className:(0,S.tremorTwMerge)(E("round"),x?(0,S.tremorTwMerge)(h.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,S.tremorTwMerge)("ring-2",h.ringColor):"")}))),c&&d?l.default.createElement("p",{className:(0,S.tremorTwMerge)(E("errorMessage"),"text-sm text-red-500 mt-1 ")},d):null)});O.displayName="Switch",e.s(["Switch",()=>O],793130)},158392,419470,e=>{"use strict";var t=e.i(843476),r=e.i(779241);let a={ttl:3600,lowest_latency_buffer:0},l=({routingStrategyArgs:e})=>{let l={ttl:"Sliding window to look back over when calculating the average latency of a deployment. Default - 1 hour (in seconds).",lowest_latency_buffer:"Shuffle between deployments within this % of the lowest latency. Default - 0 (i.e. always pick lowest latency)."};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"max-w-3xl",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Latency-Based Configuration"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Fine-tune latency-based routing behavior"})]}),(0,t.jsx)("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2 xl:grid-cols-3",children:Object.entries(e||a).map(([e,a])=>(0,t.jsx)("div",{className:"space-y-2",children:(0,t.jsxs)("label",{className:"block",children:[(0,t.jsx)("span",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:e.replace(/_/g," ")}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-0.5 mb-2",children:l[e]||""}),(0,t.jsx)(r.TextInput,{name:e,defaultValue:"object"==typeof a?JSON.stringify(a,null,2):a?.toString(),className:"font-mono text-sm w-full"})]})},e))})]}),(0,t.jsx)("div",{className:"border-t border-gray-200"})]})},o=({routerSettings:e,routerFieldsMetadata:a})=>(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"max-w-3xl",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Reliability & Retries"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Configure retry logic and failure handling"})]}),(0,t.jsx)("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2 xl:grid-cols-3",children:Object.entries(e).filter(([e,t])=>"fallbacks"!=e&&"context_window_fallbacks"!=e&&"routing_strategy_args"!=e&&"routing_strategy"!=e&&"enable_tag_filtering"!=e).map(([e,l])=>(0,t.jsx)("div",{className:"space-y-2",children:(0,t.jsxs)("label",{className:"block",children:[(0,t.jsx)("span",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:a[e]?.ui_field_name||e}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-0.5 mb-2",children:a[e]?.field_description||""}),(0,t.jsx)(r.TextInput,{name:e,defaultValue:null==l||"null"===l?"":"object"==typeof l?JSON.stringify(l,null,2):l?.toString()||"",placeholder:"—",className:"font-mono text-sm w-full"})]})},e))})]});var n=e.i(199133);let s=({selectedStrategy:e,availableStrategies:r,routingStrategyDescriptions:a,routerFieldsMetadata:l,onStrategyChange:o})=>(0,t.jsxs)("div",{className:"space-y-2 max-w-3xl",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:l.routing_strategy?.ui_field_name||"Routing Strategy"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-0.5 mb-2",children:l.routing_strategy?.field_description||""})]}),(0,t.jsx)("div",{className:"routing-strategy-select max-w-3xl",children:(0,t.jsx)(n.Select,{value:e,onChange:o,style:{width:"100%"},size:"large",children:r.map(e=>(0,t.jsx)(n.Select.Option,{value:e,label:e,children:(0,t.jsxs)("div",{className:"flex flex-col gap-0.5 py-1",children:[(0,t.jsx)("span",{className:"font-mono text-sm font-medium",children:e}),a[e]&&(0,t.jsx)("span",{className:"text-xs text-gray-500 font-normal",children:a[e]})]})},e))})})]});var i=e.i(793130);let c=({enabled:e,routerFieldsMetadata:r,onToggle:a})=>(0,t.jsx)("div",{className:"space-y-3 max-w-3xl",children:(0,t.jsxs)("div",{className:"flex items-start justify-between",children:[(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)("label",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:r.enable_tag_filtering?.ui_field_name||"Enable Tag Filtering"}),(0,t.jsxs)("p",{className:"text-xs text-gray-500 mt-0.5",children:[r.enable_tag_filtering?.field_description||"",r.enable_tag_filtering?.link&&(0,t.jsxs)(t.Fragment,{children:[" ",(0,t.jsx)("a",{href:r.enable_tag_filtering.link,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-800 underline",children:"Learn more"})]})]})]}),(0,t.jsx)(i.Switch,{checked:e,onChange:a,className:"ml-4"})]})});e.s(["default",0,({value:e,onChange:r,routerFieldsMetadata:a,availableRoutingStrategies:n,routingStrategyDescriptions:i})=>(0,t.jsxs)("div",{className:"w-full space-y-8 py-2",children:[(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"max-w-3xl",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Routing Settings"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Configure how requests are routed to deployments"})]}),n.length>0&&(0,t.jsx)(s,{selectedStrategy:e.selectedStrategy||e.routerSettings.routing_strategy||null,availableStrategies:n,routingStrategyDescriptions:i,routerFieldsMetadata:a,onStrategyChange:t=>{r({...e,selectedStrategy:t})}}),(0,t.jsx)(c,{enabled:e.enableTagFiltering,routerFieldsMetadata:a,onToggle:t=>{r({...e,enableTagFiltering:t})}})]}),(0,t.jsx)("div",{className:"border-t border-gray-200"}),"latency-based-routing"===e.selectedStrategy&&(0,t.jsx)(l,{routingStrategyArgs:e.routerSettings.routing_strategy_args}),(0,t.jsx)(o,{routerSettings:e.routerSettings,routerFieldsMetadata:a})]})],158392);var d=e.i(994388),u=e.i(998573),m=e.i(653496),g=e.i(107233),p=e.i(271645),f=e.i(592968),h=e.i(361653),h=h;let x=(0,e.i(475254).default)("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);var b=e.i(37727);function y({group:e,onChange:r,availableModels:a,maxFallbacks:l}){let o=a.filter(t=>t!==e.primaryModel),s=e.fallbackModels.length{let a=[...e.fallbackModels];a.includes(t)&&(a=a.filter(e=>e!==t)),r({...e,primaryModel:t,fallbackModels:a})},showSearch:!0,getPopupContainer:e=>e.parentElement||document.body,filterOption:(e,t)=>(t?.label??"").toLowerCase().includes(e.toLowerCase()),options:a.map(e=>({label:e,value:e}))}),!e.primaryModel&&(0,t.jsxs)("div",{className:"mt-2 flex items-center gap-2 text-amber-600 text-xs bg-amber-50 p-2 rounded",children:[(0,t.jsx)(h.default,{className:"w-4 h-4"}),(0,t.jsx)("span",{children:"Select a model to begin configuring fallbacks"})]})]}),(0,t.jsx)("div",{className:"flex items-center justify-center -my-4 z-10",children:(0,t.jsxs)("div",{className:"bg-indigo-50 text-indigo-500 px-4 py-1 rounded-full text-xs font-bold border border-indigo-100 flex items-center gap-2 shadow-sm",children:[(0,t.jsx)(x,{className:"w-4 h-4"}),"IF FAILS, TRY..."]})}),(0,t.jsxs)("div",{className:`transition-opacity duration-300 ${!e.primaryModel?"opacity-50 pointer-events-none":"opacity-100"}`,children:[(0,t.jsxs)("label",{className:"block text-sm font-semibold text-gray-700 mb-2",children:["Fallback Chain ",(0,t.jsx)("span",{className:"text-red-500",children:"*"}),(0,t.jsxs)("span",{className:"text-xs text-gray-500 font-normal ml-2",children:["(Max ",l," fallbacks at a time)"]})]}),(0,t.jsxs)("div",{className:"bg-gray-50 rounded-xl p-4 border border-gray-200",children:[(0,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsx)(n.Select,{mode:"multiple",className:"w-full",size:"large",placeholder:s?"Select fallback models to add...":`Maximum ${l} fallbacks reached`,value:e.fallbackModels,onChange:t=>{let a=t.slice(0,l);r({...e,fallbackModels:a})},disabled:!e.primaryModel,getPopupContainer:e=>e.parentElement||document.body,options:o.map(e=>({label:e,value:e})),optionRender:(r,a)=>{let l=e.fallbackModels.includes(r.value),o=l?e.fallbackModels.indexOf(r.value)+1:null;return(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[l&&null!==o&&(0,t.jsx)("span",{className:"flex items-center justify-center w-5 h-5 rounded bg-indigo-100 text-indigo-600 text-xs font-bold",children:o}),(0,t.jsx)("span",{children:r.label})]})},maxTagCount:"responsive",maxTagPlaceholder:e=>(0,t.jsx)(f.Tooltip,{styles:{root:{pointerEvents:"none"}},title:e.map(({value:e})=>e).join(", "),children:(0,t.jsxs)("span",{children:["+",e.length," more"]})}),showSearch:!0,filterOption:(e,t)=>(t?.label??"").toLowerCase().includes(e.toLowerCase())}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1 ml-1",children:s?`Search and select multiple models. Selected models will appear below in order. (${e.fallbackModels.length}/${l} used)`:`Maximum ${l} fallbacks reached. Remove some to add more.`})]}),(0,t.jsx)("div",{className:"space-y-2 min-h-[100px]",children:0===e.fallbackModels.length?(0,t.jsxs)("div",{className:"h-32 border-2 border-dashed border-gray-300 rounded-lg flex flex-col items-center justify-center text-gray-400",children:[(0,t.jsx)("span",{className:"text-sm",children:"No fallback models selected"}),(0,t.jsx)("span",{className:"text-xs mt-1",children:"Add models from the dropdown above"})]}):e.fallbackModels.map((a,l)=>(0,t.jsxs)("div",{className:"group flex items-center justify-between p-3 bg-white rounded-lg border border-gray-200 hover:border-indigo-300 hover:shadow-sm transition-all",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"flex items-center justify-center w-6 h-6 rounded bg-gray-100 text-gray-400 group-hover:text-indigo-500 group-hover:bg-indigo-50",children:(0,t.jsx)("span",{className:"text-xs font-bold",children:l+1})}),(0,t.jsx)("div",{children:(0,t.jsx)("span",{className:"font-medium text-gray-800",children:a})})]}),(0,t.jsx)("button",{type:"button",onClick:()=>{let t;return t=e.fallbackModels.filter((e,t)=>t!==l),void r({...e,fallbackModels:t})},className:"opacity-0 group-hover:opacity-100 transition-opacity text-gray-400 hover:text-red-500 p-1",children:(0,t.jsx)(b.X,{className:"w-4 h-4"})})]},`${a}-${l}`))})]})]})]})}function v({groups:e,onGroupsChange:r,availableModels:a,maxFallbacks:l=10,maxGroups:o=5}){let[n,s]=(0,p.useState)(e.length>0?e[0].id:"1");(0,p.useEffect)(()=>{e.length>0?e.some(e=>e.id===n)||s(e[0].id):s("1")},[e]);let i=()=>{if(e.length>=o)return;let t=Date.now().toString();r([...e,{id:t,primaryModel:null,fallbackModels:[]}]),s(t)},c=t=>{r(e.map(e=>e.id===t.id?t:e))},f=e.map((r,o)=>{let n=r.primaryModel?r.primaryModel:`Group ${o+1}`;return{key:r.id,label:n,closable:e.length>1,children:(0,t.jsx)(y,{group:r,onChange:c,availableModels:a,maxFallbacks:l})}});return 0===e.length?(0,t.jsxs)("div",{className:"text-center py-12 bg-gray-50 rounded-lg border border-dashed border-gray-300",children:[(0,t.jsx)("p",{className:"text-gray-500 mb-4",children:"No fallback groups configured"}),(0,t.jsx)(d.Button,{variant:"primary",onClick:i,icon:()=>(0,t.jsx)(g.Plus,{className:"w-4 h-4"}),children:"Create First Group"})]}):(0,t.jsx)(m.Tabs,{type:"editable-card",activeKey:n,onChange:s,onEdit:(t,a)=>{"add"===a?i():"remove"===a&&e.length>1&&(t=>{if(1===e.length)return u.message.warning("At least one group is required");let a=e.filter(e=>e.id!==t);r(a),n===t&&a.length>0&&s(a[a.length-1].id)})(t)},items:f,className:"fallback-tabs",tabBarStyle:{marginBottom:0},hideAdd:e.length>=o})}e.s(["FallbackSelectionForm",()=>v],419470)}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/16d77647b44247de.js b/litellm/proxy/_experimental/out/_next/static/chunks/715057b8e12f1cd9.js similarity index 93% rename from litellm/proxy/_experimental/out/_next/static/chunks/16d77647b44247de.js rename to litellm/proxy/_experimental/out/_next/static/chunks/715057b8e12f1cd9.js index e1a9f60f2b..0e332a63ac 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/16d77647b44247de.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/715057b8e12f1cd9.js @@ -4,4 +4,4 @@ `]:{[`&:hover ${t}-inner`]:{borderColor:e.colorPrimary}},[`${l}:not(${l}-disabled)`]:{[`&:hover ${t}-checked:not(${t}-disabled) ${t}-inner`]:{backgroundColor:e.colorPrimaryHover,borderColor:"transparent"},[`&:hover ${t}-checked:not(${t}-disabled):after`]:{borderColor:e.colorPrimaryHover}}},{[`${t}-checked`]:{[`${t}-inner`]:{backgroundColor:e.colorPrimary,borderColor:e.colorPrimary,"&:after":{opacity:1,transform:"rotate(45deg) scale(1) translate(-50%,-50%)",transition:`all ${e.motionDurationMid} ${e.motionEaseOutBack} ${e.motionDurationFast}`}}},[` ${l}-checked:not(${l}-disabled), ${t}-checked:not(${t}-disabled) - `]:{[`&:hover ${t}-inner`]:{backgroundColor:e.colorPrimaryHover,borderColor:"transparent"}}},{[t]:{"&-indeterminate":{"&":{[`${t}-inner`]:{backgroundColor:`${e.colorBgContainer}`,borderColor:`${e.colorBorder}`,"&:after":{top:"50%",insetInlineStart:"50%",width:e.calc(e.fontSizeLG).div(2).equal(),height:e.calc(e.fontSizeLG).div(2).equal(),backgroundColor:e.colorPrimary,border:0,transform:"translate(-50%, -50%) scale(1)",opacity:1,content:'""'}},[`&:hover ${t}-inner`]:{backgroundColor:`${e.colorBgContainer}`,borderColor:`${e.colorPrimary}`}}}}},{[`${l}-disabled`]:{cursor:"not-allowed"},[`${t}-disabled`]:{[`&, ${t}-input`]:{cursor:"not-allowed",pointerEvents:"none"},[`${t}-inner`]:{background:e.colorBgContainerDisabled,borderColor:e.colorBorder,"&:after":{borderColor:e.colorTextDisabled}},"&:after":{display:"none"},"& + span":{color:e.colorTextDisabled},[`&${t}-indeterminate ${t}-inner::after`]:{background:e.colorTextDisabled}}}]})((0,o.mergeToken)(t,{checkboxCls:`.${e}`,checkboxSize:t.controlInteractiveSize}))}let s=(0,l.genStyleHooks)("Checkbox",(e,{prefixCls:t})=>[n(t,e)]);e.s(["default",0,s,"getStyle",()=>n],236836)},374276,e=>{"use strict";e.i(247167);var t=e.i(271645),r=e.i(343794),a=e.i(91874),l=e.i(611935),o=e.i(121872),n=e.i(26905),s=e.i(242064),i=e.i(937328),c=e.i(321883),d=e.i(62139),u=e.i(421512),m=e.i(236836),g=e.i(681216),p=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 l=0,a=Object.getOwnPropertySymbols(e);lt.indexOf(a[l])&&Object.prototype.propertyIsEnumerable.call(e,a[l])&&(r[a[l]]=e[a[l]]);return r};let f=t.forwardRef((e,f)=>{var h;let{prefixCls:x,className:b,rootClassName:y,children:v,indeterminate:w=!1,style:k,onMouseEnter:C,onMouseLeave:j,skipGroup:N=!1,disabled:S}=e,$=p(e,["prefixCls","className","rootClassName","children","indeterminate","style","onMouseEnter","onMouseLeave","skipGroup","disabled"]),{getPrefixCls:M,direction:E,checkbox:O}=t.useContext(s.ConfigContext),T=t.useContext(u.default),{isFormItemInput:P}=t.useContext(d.FormItemInputContext),_=t.useContext(i.default),z=null!=(h=(null==T?void 0:T.disabled)||S)?h:_,R=t.useRef($.value),I=t.useRef(null),L=(0,l.composeRef)(f,I);t.useEffect(()=>{null==T||T.registerValue($.value)},[]),t.useEffect(()=>{if(!N)return $.value!==R.current&&(null==T||T.cancelValue(R.current),null==T||T.registerValue($.value),R.current=$.value),()=>null==T?void 0:T.cancelValue($.value)},[$.value]),t.useEffect(()=>{var e;(null==(e=I.current)?void 0:e.input)&&(I.current.input.indeterminate=w)},[w]);let D=M("checkbox",x),B=(0,c.default)(D),[F,A,q]=(0,m.default)(D,B),H=Object.assign({},$);T&&!N&&(H.onChange=(...e)=>{$.onChange&&$.onChange.apply($,e),T.toggleOption&&T.toggleOption({label:v,value:$.value})},H.name=T.name,H.checked=T.value.includes($.value));let G=(0,r.default)(`${D}-wrapper`,{[`${D}-rtl`]:"rtl"===E,[`${D}-wrapper-checked`]:H.checked,[`${D}-wrapper-disabled`]:z,[`${D}-wrapper-in-form-item`]:P},null==O?void 0:O.className,b,y,q,B,A),X=(0,r.default)({[`${D}-indeterminate`]:w},n.TARGET_CLS,A),[V,K]=(0,g.default)(H.onClick);return F(t.createElement(o.default,{component:"Checkbox",disabled:z},t.createElement("label",{className:G,style:Object.assign(Object.assign({},null==O?void 0:O.style),k),onMouseEnter:C,onMouseLeave:j,onClick:V},t.createElement(a.default,Object.assign({},H,{onClick:K,prefixCls:D,className:X,disabled:z,ref:L})),null!=v&&t.createElement("span",{className:`${D}-label`},v))))});var h=e.i(8211),x=e.i(529681),b=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 l=0,a=Object.getOwnPropertySymbols(e);lt.indexOf(a[l])&&Object.prototype.propertyIsEnumerable.call(e,a[l])&&(r[a[l]]=e[a[l]]);return r};let y=t.forwardRef((e,a)=>{let{defaultValue:l,children:o,options:n=[],prefixCls:i,className:d,rootClassName:g,style:p,onChange:y}=e,v=b(e,["defaultValue","children","options","prefixCls","className","rootClassName","style","onChange"]),{getPrefixCls:w,direction:k}=t.useContext(s.ConfigContext),[C,j]=t.useState(v.value||l||[]),[N,S]=t.useState([]);t.useEffect(()=>{"value"in v&&j(v.value||[])},[v.value]);let $=t.useMemo(()=>n.map(e=>"string"==typeof e||"number"==typeof e?{label:e,value:e}:e),[n]),M=e=>{S(t=>t.filter(t=>t!==e))},E=e=>{S(t=>[].concat((0,h.default)(t),[e]))},O=e=>{let t=C.indexOf(e.value),r=(0,h.default)(C);-1===t?r.push(e.value):r.splice(t,1),"value"in v||j(r),null==y||y(r.filter(e=>N.includes(e)).sort((e,t)=>$.findIndex(t=>t.value===e)-$.findIndex(e=>e.value===t)))},T=w("checkbox",i),P=`${T}-group`,_=(0,c.default)(T),[z,R,I]=(0,m.default)(T,_),L=(0,x.default)(v,["value","disabled"]),D=n.length?$.map(e=>t.createElement(f,{prefixCls:T,key:e.value.toString(),disabled:"disabled"in e?e.disabled:v.disabled,value:e.value,checked:C.includes(e.value),onChange:e.onChange,className:(0,r.default)(`${P}-item`,e.className),style:e.style,title:e.title,id:e.id,required:e.required},e.label)):o,B=t.useMemo(()=>({toggleOption:O,value:C,disabled:v.disabled,name:v.name,registerValue:E,cancelValue:M}),[O,C,v.disabled,v.name,E,M]),F=(0,r.default)(P,{[`${P}-rtl`]:"rtl"===k},d,g,I,_,R);return z(t.createElement("div",Object.assign({className:F,style:p},L,{ref:a}),t.createElement(u.default.Provider,{value:B},D)))});f.Group=y,f.__ANT_CHECKBOX=!0,e.s(["default",0,f],374276)},536916,e=>{"use strict";var t=e.i(374276);e.s(["Checkbox",()=>t.default])},292639,e=>{"use strict";var t=e.i(764205),r=e.i(266027);let a=(0,e.i(243652).createQueryKeys)("uiSettings");e.s(["useUISettings",0,()=>(0,r.useQuery)({queryKey:a.list({}),queryFn:async()=>await (0,t.getUiSettings)(),staleTime:36e5,gcTime:36e5})])},250980,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3m0 0v3m0-3h3m-3 0H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z"}))});e.s(["PlusCircleIcon",0,r],250980)},502547,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"}))});e.s(["ChevronRightIcon",0,r],502547)},988297,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4v16m8-8H4"}))});e.s(["PlusIcon",0,r],988297)},797672,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"}))});e.s(["PencilIcon",0,r],797672)},992619,e=>{"use strict";var t=e.i(843476),r=e.i(271645),a=e.i(779241),l=e.i(599724),o=e.i(199133),n=e.i(983561),s=e.i(689020);e.s(["default",0,({accessToken:e,value:i,placeholder:c="Select a Model",onChange:d,disabled:u=!1,style:m,className:g,showLabel:p=!0,labelText:f="Select Model"})=>{let[h,x]=(0,r.useState)(i),[b,y]=(0,r.useState)(!1),[v,w]=(0,r.useState)([]),k=(0,r.useRef)(null);return(0,r.useEffect)(()=>{x(i)},[i]),(0,r.useEffect)(()=>{e&&(async()=>{try{let t=await (0,s.fetchAvailableModels)(e);console.log("Fetched models for selector:",t),t.length>0&&w(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)(n.RobotOutlined,{className:"mr-2"})," ",f]}),(0,t.jsx)(o.Select,{value:h,placeholder:c,onChange:e=>{"custom"===e?(y(!0),x(void 0)):(y(!1),x(e),d&&d(e))},options:[...Array.from(new Set(v.map(e=>e.model_group))).map((e,t)=>({value:e,label:e,key:t})),{value:"custom",label:"Enter custom model",key:"custom"}],style:{width:"100%",...m},showSearch:!0,className:`rounded-md ${g||""}`,disabled:u}),b&&(0,t.jsx)(a.TextInput,{className:"mt-2",placeholder:"Enter custom model name",onValueChange:e=>{k.current&&clearTimeout(k.current),k.current=setTimeout(()=>{x(e),d&&d(e)},500)},disabled:u})]})}])},409797,e=>{"use strict";var t=e.i(631171);e.s(["ChevronDownIcon",()=>t.default])},91739,e=>{"use strict";var t=e.i(544195);e.s(["Radio",()=>t.default])},500727,696609,531516,e=>{"use strict";var t=e.i(266027),r=e.i(243652),a=e.i(764205),l=e.i(135214);let o=(0,r.createQueryKeys)("mcpServers");e.s(["useMCPServers",0,e=>{let{accessToken:r}=(0,l.default)();return(0,t.useQuery)({queryKey:o.list(e?{filters:{teamId:e}}:void 0),queryFn:async()=>await (0,a.fetchMCPServers)(r,e),enabled:!!r})}],500727);var n=e.i(843476),s=e.i(271645),i=e.i(536916),c=e.i(599724),d=e.i(409797),u=e.i(246349),u=u;let m=/\b(delete|remove|destroy|purge|drop|erase|unlink)\b/i,g=/\b(create|add|insert|new|post|submit|register|make|generate|write|upload)\b/i,p=/\b(update|edit|modify|change|patch|put|set|rename|move|transform)\b/i,f=/\b(get|read|list|fetch|search|find|query|retrieve|show|view|check|describe|info)\b/i;function h(e,t=""){let r=e.toLowerCase();if(f.test(r))return"read";if(m.test(r))return"delete";if(p.test(r))return"update";if(g.test(r))return"create";if(t){let e=t.toLowerCase();if(f.test(e))return"read";if(m.test(e))return"delete";if(p.test(e))return"update";if(g.test(e))return"create"}return"unknown"}function x(e){let t={read:[],create:[],update:[],delete:[],unknown:[]};for(let r of e)t[h(r.name,r.description)].push(r);return t}let b={read:{label:"Read",description:"Safe operations — fetch, list, search. No side effects.",risk:"low"},create:{label:"Create",description:"Add new resources — insert, upload, register.",risk:"medium"},update:{label:"Update",description:"Modify existing resources — edit, patch, rename.",risk:"medium"},delete:{label:"Delete",description:"Destructive operations — remove, purge, destroy.",risk:"high"},unknown:{label:"Other",description:"Operations that could not be automatically classified.",risk:"unknown"}};e.s(["CRUD_GROUP_META",0,b,"classifyToolOp",()=>h,"groupToolsByCrud",()=>x],696609);let y=["read","create","update","delete","unknown"],v={low:"bg-green-100 text-green-800",medium:"bg-yellow-100 text-yellow-800",high:"bg-red-100 text-red-800 font-semibold",unknown:"bg-gray-100 text-gray-700"},w={read:"border-green-200",create:"border-blue-200",update:"border-yellow-200",delete:"border-red-300",unknown:"border-gray-200"},k={read:"bg-green-50",create:"bg-blue-50",update:"bg-yellow-50",delete:"bg-red-50",unknown:"bg-gray-50"};e.s(["default",0,({tools:e,value:t,onChange:r,readOnly:a=!1,searchFilter:l=""})=>{let[o,m]=(0,s.useState)({read:!1,create:!1,update:!1,delete:!1,unknown:!0}),g=(0,s.useMemo)(()=>x(e),[e]),p=(0,s.useMemo)(()=>new Set(void 0===t?e.map(e=>e.name):t),[t,e]),f=e=>{if(a)return;let t=new Set(p);t.has(e)?t.delete(e):t.add(e),r(Array.from(t))};return 0===e.length?null:(0,n.jsx)("div",{className:"space-y-3",children:y.map(e=>{let t,s=g[e];if(0===s.length)return null;if(l){let e=l.toLowerCase();if(!s.some(t=>t.name.toLowerCase().includes(e)||(t.description??"").toLowerCase().includes(e)))return null}let h=b[e],x=(t=g[e]).length>0&&t.every(e=>p.has(e.name)),y=(e=>{let t=g[e];if(0===t.length)return!1;let r=t.filter(e=>p.has(e.name)).length;return r>0&&r{m(t=>({...t,[e]:!t[e]}))},children:[C?(0,n.jsx)(u.default,{className:"w-4 h-4 text-gray-500 flex-shrink-0"}):(0,n.jsx)(d.ChevronDownIcon,{className:"w-4 h-4 text-gray-500 flex-shrink-0"}),(0,n.jsx)("span",{className:"font-semibold text-gray-900 text-sm",children:h.label}),(0,n.jsx)("span",{className:`text-xs px-2 py-0.5 rounded-full ${v[h.risk]}`,children:"high"===h.risk?"High Risk":"medium"===h.risk?"Medium Risk":"low"===h.risk?"Safe":"Unclassified"}),(0,n.jsxs)("span",{className:"text-xs text-gray-500 ml-1",children:[s.filter(e=>p.has(e.name)).length,"/",s.length," allowed"]})]}),!a&&(0,n.jsxs)("div",{className:"flex items-center gap-2 ml-4",children:[(0,n.jsx)(c.Text,{className:"text-xs text-gray-500",children:x?"All on":y?"Partial":"All off"}),(0,n.jsx)(i.Checkbox,{checked:x,indeterminate:y,onChange:t=>((e,t)=>{if(a)return;let l=new Set(p);for(let r of g[e])t?l.add(r.name):l.delete(r.name);r(Array.from(l))})(e,t.target.checked),onClick:e=>e.stopPropagation()})]})]}),!C&&(0,n.jsx)("div",{className:"px-4 pt-2 pb-1 text-xs text-gray-500 bg-white border-b border-gray-100",children:h.description}),!C&&(0,n.jsx)("div",{className:"bg-white divide-y divide-gray-50",children:s.filter(e=>!l||e.name.toLowerCase().includes(l.toLowerCase())||(e.description??"").toLowerCase().includes(l.toLowerCase())).map(e=>{let t,r=(t=e.name,p.has(t));return(0,n.jsxs)("div",{className:`flex items-start gap-3 px-4 py-2.5 transition-colors hover:bg-gray-50 ${!a?"cursor-pointer":""} ${r?"":"opacity-60"}`,onClick:()=>f(e.name),children:[(0,n.jsx)(i.Checkbox,{checked:r,onChange:()=>f(e.name),disabled:a,onClick:e=>e.stopPropagation()}),(0,n.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,n.jsx)(c.Text,{className:"font-medium text-gray-900 text-sm",children:e.name}),e.description&&(0,n.jsx)(c.Text,{className:"text-xs text-gray-500 mt-0.5 leading-snug",children:e.description})]}),(0,n.jsx)("span",{className:`text-xs px-1.5 py-0.5 rounded flex-shrink-0 ${r?"bg-green-100 text-green-700":"bg-gray-100 text-gray-500"}`,children:r?"on":"off"})]},e.name)})})]},e)})})}],531516)},361653,e=>{"use strict";let t=(0,e.i(475254).default)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);e.s(["default",()=>t])},603908,e=>{"use strict";let t=(0,e.i(475254).default)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);e.s(["default",()=>t])},841947,e=>{"use strict";let t=(0,e.i(475254).default)("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);e.s(["default",()=>t])},793130,e=>{"use strict";var t=e.i(290571),r=e.i(429427),a=e.i(371330),l=e.i(271645),o=e.i(394487),n=e.i(503269),s=e.i(214520),i=e.i(746725),c=e.i(914189),d=e.i(144279),u=e.i(294316),m=e.i(601893),g=e.i(140721),p=e.i(942803),f=e.i(233538),h=e.i(694421),x=e.i(700020),b=e.i(35889),y=e.i(998348),v=e.i(722678);let w=(0,l.createContext)(null);w.displayName="GroupContext";let k=l.Fragment,C=Object.assign((0,x.forwardRefWithAs)(function(e,t){var k;let C=(0,l.useId)(),j=(0,p.useProvidedId)(),N=(0,m.useDisabled)(),{id:S=j||`headlessui-switch-${C}`,disabled:$=N||!1,checked:M,defaultChecked:E,onChange:O,name:T,value:P,form:_,autoFocus:z=!1,...R}=e,I=(0,l.useContext)(w),[L,D]=(0,l.useState)(null),B=(0,l.useRef)(null),F=(0,u.useSyncRefs)(B,t,null===I?null:I.setSwitch,D),A=(0,s.useDefaultValue)(E),[q,H]=(0,n.useControllable)(M,O,null!=A&&A),G=(0,i.useDisposables)(),[X,V]=(0,l.useState)(!1),K=(0,c.useEvent)(()=>{V(!0),null==H||H(!q),G.nextFrame(()=>{V(!1)})}),W=(0,c.useEvent)(e=>{if((0,f.isDisabledReactIssue7711)(e.currentTarget))return e.preventDefault();e.preventDefault(),K()}),U=(0,c.useEvent)(e=>{e.key===y.Keys.Space?(e.preventDefault(),K()):e.key===y.Keys.Enter&&(0,h.attemptSubmit)(e.currentTarget)}),Y=(0,c.useEvent)(e=>e.preventDefault()),Q=(0,v.useLabelledBy)(),J=(0,b.useDescribedBy)(),{isFocusVisible:Z,focusProps:ee}=(0,r.useFocusRing)({autoFocus:z}),{isHovered:et,hoverProps:er}=(0,a.useHover)({isDisabled:$}),{pressed:ea,pressProps:el}=(0,o.useActivePress)({disabled:$}),eo=(0,l.useMemo)(()=>({checked:q,disabled:$,hover:et,focus:Z,active:ea,autofocus:z,changing:X}),[q,et,Z,ea,$,X,z]),en=(0,x.mergeProps)({id:S,ref:F,role:"switch",type:(0,d.useResolveButtonType)(e,L),tabIndex:-1===e.tabIndex?0:null!=(k=e.tabIndex)?k:0,"aria-checked":q,"aria-labelledby":Q,"aria-describedby":J,disabled:$||void 0,autoFocus:z,onClick:W,onKeyUp:U,onKeyPress:Y},ee,er,el),es=(0,l.useCallback)(()=>{if(void 0!==A)return null==H?void 0:H(A)},[H,A]),ei=(0,x.useRender)();return l.default.createElement(l.default.Fragment,null,null!=T&&l.default.createElement(g.FormFields,{disabled:$,data:{[T]:P||"on"},overrides:{type:"checkbox",checked:q},form:_,onReset:es}),ei({ourProps:en,theirProps:R,slot:eo,defaultTag:"button",name:"Switch"}))}),{Group:function(e){var t;let[r,a]=(0,l.useState)(null),[o,n]=(0,v.useLabels)(),[s,i]=(0,b.useDescriptions)(),c=(0,l.useMemo)(()=>({switch:r,setSwitch:a}),[r,a]),d=(0,x.useRender)();return l.default.createElement(i,{name:"Switch.Description",value:s},l.default.createElement(n,{name:"Switch.Label",value:o,props:{htmlFor:null==(t=c.switch)?void 0:t.id,onClick(e){r&&(e.currentTarget instanceof HTMLLabelElement&&e.preventDefault(),r.click(),r.focus({preventScroll:!0}))}}},l.default.createElement(w.Provider,{value:c},d({ourProps:{},theirProps:e,slot:{},defaultTag:k,name:"Switch.Group"}))))},Label:v.Label,Description:b.Description});var j=e.i(888288),N=e.i(95779),S=e.i(444755),$=e.i(673706),M=e.i(829087);let E=(0,$.makeClassName)("Switch"),O=l.default.forwardRef((e,r)=>{let{checked:a,defaultChecked:o=!1,onChange:n,color:s,name:i,error:c,errorMessage:d,disabled:u,required:m,tooltip:g,id:p}=e,f=(0,t.__rest)(e,["checked","defaultChecked","onChange","color","name","error","errorMessage","disabled","required","tooltip","id"]),h={bgColor:s?(0,$.getColorClassNames)(s,N.colorPalette.background).bgColor:"bg-tremor-brand dark:bg-dark-tremor-brand",ringColor:s?(0,$.getColorClassNames)(s,N.colorPalette.ring).ringColor:"ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted"},[x,b]=(0,j.default)(o,a),[y,v]=(0,l.useState)(!1),{tooltipProps:w,getReferenceProps:k}=(0,M.useTooltip)(300);return l.default.createElement("div",{className:"flex flex-row items-center justify-start"},l.default.createElement(M.default,Object.assign({text:g},w)),l.default.createElement("div",Object.assign({ref:(0,$.mergeRefs)([r,w.refs.setReference]),className:(0,S.tremorTwMerge)(E("root"),"flex flex-row relative h-5")},f,k),l.default.createElement("input",{type:"checkbox",className:(0,S.tremorTwMerge)(E("input"),"absolute w-5 h-5 cursor-pointer left-0 top-0 opacity-0"),name:i,required:m,checked:x,onChange:e=>{e.preventDefault()}}),l.default.createElement(C,{checked:x,onChange:e=>{b(e),null==n||n(e)},disabled:u,className:(0,S.tremorTwMerge)(E("switch"),"w-10 h-5 group relative inline-flex shrink-0 cursor-pointer items-center justify-center rounded-tremor-full","focus:outline-none",u?"cursor-not-allowed":""),onFocus:()=>v(!0),onBlur:()=>v(!1),id:p},l.default.createElement("span",{className:(0,S.tremorTwMerge)(E("sr-only"),"sr-only")},"Switch ",x?"on":"off"),l.default.createElement("span",{"aria-hidden":"true",className:(0,S.tremorTwMerge)(E("background"),x?h.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")}),l.default.createElement("span",{"aria-hidden":"true",className:(0,S.tremorTwMerge)(E("round"),x?(0,S.tremorTwMerge)(h.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,S.tremorTwMerge)("ring-2",h.ringColor):"")}))),c&&d?l.default.createElement("p",{className:(0,S.tremorTwMerge)(E("errorMessage"),"text-sm text-red-500 mt-1 ")},d):null)});O.displayName="Switch",e.s(["Switch",()=>O],793130)},158392,419470,e=>{"use strict";var t=e.i(843476),r=e.i(779241);let a={ttl:3600,lowest_latency_buffer:0},l=({routingStrategyArgs:e})=>{let l={ttl:"Sliding window to look back over when calculating the average latency of a deployment. Default - 1 hour (in seconds).",lowest_latency_buffer:"Shuffle between deployments within this % of the lowest latency. Default - 0 (i.e. always pick lowest latency)."};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"max-w-3xl",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Latency-Based Configuration"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Fine-tune latency-based routing behavior"})]}),(0,t.jsx)("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2 xl:grid-cols-3",children:Object.entries(e||a).map(([e,a])=>(0,t.jsx)("div",{className:"space-y-2",children:(0,t.jsxs)("label",{className:"block",children:[(0,t.jsx)("span",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:e.replace(/_/g," ")}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-0.5 mb-2",children:l[e]||""}),(0,t.jsx)(r.TextInput,{name:e,defaultValue:"object"==typeof a?JSON.stringify(a,null,2):a?.toString(),className:"font-mono text-sm w-full"})]})},e))})]}),(0,t.jsx)("div",{className:"border-t border-gray-200"})]})},o=({routerSettings:e,routerFieldsMetadata:a})=>(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"max-w-3xl",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Reliability & Retries"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Configure retry logic and failure handling"})]}),(0,t.jsx)("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2 xl:grid-cols-3",children:Object.entries(e).filter(([e,t])=>"fallbacks"!=e&&"context_window_fallbacks"!=e&&"routing_strategy_args"!=e&&"routing_strategy"!=e&&"enable_tag_filtering"!=e).map(([e,l])=>(0,t.jsx)("div",{className:"space-y-2",children:(0,t.jsxs)("label",{className:"block",children:[(0,t.jsx)("span",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:a[e]?.ui_field_name||e}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-0.5 mb-2",children:a[e]?.field_description||""}),(0,t.jsx)(r.TextInput,{name:e,defaultValue:null==l||"null"===l?"":"object"==typeof l?JSON.stringify(l,null,2):l?.toString()||"",placeholder:"—",className:"font-mono text-sm w-full"})]})},e))})]});var n=e.i(199133);let s=({selectedStrategy:e,availableStrategies:r,routingStrategyDescriptions:a,routerFieldsMetadata:l,onStrategyChange:o})=>(0,t.jsxs)("div",{className:"space-y-2 max-w-3xl",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:l.routing_strategy?.ui_field_name||"Routing Strategy"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-0.5 mb-2",children:l.routing_strategy?.field_description||""})]}),(0,t.jsx)("div",{className:"routing-strategy-select max-w-3xl",children:(0,t.jsx)(n.Select,{value:e,onChange:o,style:{width:"100%"},size:"large",children:r.map(e=>(0,t.jsx)(n.Select.Option,{value:e,label:e,children:(0,t.jsxs)("div",{className:"flex flex-col gap-0.5 py-1",children:[(0,t.jsx)("span",{className:"font-mono text-sm font-medium",children:e}),a[e]&&(0,t.jsx)("span",{className:"text-xs text-gray-500 font-normal",children:a[e]})]})},e))})})]});var i=e.i(793130);let c=({enabled:e,routerFieldsMetadata:r,onToggle:a})=>(0,t.jsx)("div",{className:"space-y-3 max-w-3xl",children:(0,t.jsxs)("div",{className:"flex items-start justify-between",children:[(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)("label",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:r.enable_tag_filtering?.ui_field_name||"Enable Tag Filtering"}),(0,t.jsxs)("p",{className:"text-xs text-gray-500 mt-0.5",children:[r.enable_tag_filtering?.field_description||"",r.enable_tag_filtering?.link&&(0,t.jsxs)(t.Fragment,{children:[" ",(0,t.jsx)("a",{href:r.enable_tag_filtering.link,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-800 underline",children:"Learn more"})]})]})]}),(0,t.jsx)(i.Switch,{checked:e,onChange:a,className:"ml-4"})]})});e.s(["default",0,({value:e,onChange:r,routerFieldsMetadata:a,availableRoutingStrategies:n,routingStrategyDescriptions:i})=>(0,t.jsxs)("div",{className:"w-full space-y-8 py-2",children:[(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"max-w-3xl",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Routing Settings"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Configure how requests are routed to deployments"})]}),n.length>0&&(0,t.jsx)(s,{selectedStrategy:e.selectedStrategy||e.routerSettings.routing_strategy||null,availableStrategies:n,routingStrategyDescriptions:i,routerFieldsMetadata:a,onStrategyChange:t=>{r({...e,selectedStrategy:t})}}),(0,t.jsx)(c,{enabled:e.enableTagFiltering,routerFieldsMetadata:a,onToggle:t=>{r({...e,enableTagFiltering:t})}})]}),(0,t.jsx)("div",{className:"border-t border-gray-200"}),"latency-based-routing"===e.selectedStrategy&&(0,t.jsx)(l,{routingStrategyArgs:e.routerSettings.routing_strategy_args}),(0,t.jsx)(o,{routerSettings:e.routerSettings,routerFieldsMetadata:a})]})],158392);var d=e.i(994388),u=e.i(998573),m=e.i(653496),g=e.i(107233),p=e.i(271645),f=e.i(592968),h=e.i(361653),h=h;let x=(0,e.i(475254).default)("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);var b=e.i(37727);function y({group:e,onChange:r,availableModels:a,maxFallbacks:l}){let o=a.filter(t=>t!==e.primaryModel),s=e.fallbackModels.length{let a=[...e.fallbackModels];a.includes(t)&&(a=a.filter(e=>e!==t)),r({...e,primaryModel:t,fallbackModels:a})},showSearch:!0,filterOption:(e,t)=>(t?.label??"").toLowerCase().includes(e.toLowerCase()),options:a.map(e=>({label:e,value:e}))}),!e.primaryModel&&(0,t.jsxs)("div",{className:"mt-2 flex items-center gap-2 text-amber-600 text-xs bg-amber-50 p-2 rounded",children:[(0,t.jsx)(h.default,{className:"w-4 h-4"}),(0,t.jsx)("span",{children:"Select a model to begin configuring fallbacks"})]})]}),(0,t.jsx)("div",{className:"flex items-center justify-center -my-4 z-10",children:(0,t.jsxs)("div",{className:"bg-indigo-50 text-indigo-500 px-4 py-1 rounded-full text-xs font-bold border border-indigo-100 flex items-center gap-2 shadow-sm",children:[(0,t.jsx)(x,{className:"w-4 h-4"}),"IF FAILS, TRY..."]})}),(0,t.jsxs)("div",{className:`transition-opacity duration-300 ${!e.primaryModel?"opacity-50 pointer-events-none":"opacity-100"}`,children:[(0,t.jsxs)("label",{className:"block text-sm font-semibold text-gray-700 mb-2",children:["Fallback Chain ",(0,t.jsx)("span",{className:"text-red-500",children:"*"}),(0,t.jsxs)("span",{className:"text-xs text-gray-500 font-normal ml-2",children:["(Max ",l," fallbacks at a time)"]})]}),(0,t.jsxs)("div",{className:"bg-gray-50 rounded-xl p-4 border border-gray-200",children:[(0,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsx)(n.Select,{mode:"multiple",className:"w-full",size:"large",placeholder:s?"Select fallback models to add...":`Maximum ${l} fallbacks reached`,value:e.fallbackModels,onChange:t=>{let a=t.slice(0,l);r({...e,fallbackModels:a})},disabled:!e.primaryModel,options:o.map(e=>({label:e,value:e})),optionRender:(r,a)=>{let l=e.fallbackModels.includes(r.value),o=l?e.fallbackModels.indexOf(r.value)+1:null;return(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[l&&null!==o&&(0,t.jsx)("span",{className:"flex items-center justify-center w-5 h-5 rounded bg-indigo-100 text-indigo-600 text-xs font-bold",children:o}),(0,t.jsx)("span",{children:r.label})]})},maxTagCount:"responsive",maxTagPlaceholder:e=>(0,t.jsx)(f.Tooltip,{styles:{root:{pointerEvents:"none"}},title:e.map(({value:e})=>e).join(", "),children:(0,t.jsxs)("span",{children:["+",e.length," more"]})}),showSearch:!0,filterOption:(e,t)=>(t?.label??"").toLowerCase().includes(e.toLowerCase())}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1 ml-1",children:s?`Search and select multiple models. Selected models will appear below in order. (${e.fallbackModels.length}/${l} used)`:`Maximum ${l} fallbacks reached. Remove some to add more.`})]}),(0,t.jsx)("div",{className:"space-y-2 min-h-[100px]",children:0===e.fallbackModels.length?(0,t.jsxs)("div",{className:"h-32 border-2 border-dashed border-gray-300 rounded-lg flex flex-col items-center justify-center text-gray-400",children:[(0,t.jsx)("span",{className:"text-sm",children:"No fallback models selected"}),(0,t.jsx)("span",{className:"text-xs mt-1",children:"Add models from the dropdown above"})]}):e.fallbackModels.map((a,l)=>(0,t.jsxs)("div",{className:"group flex items-center justify-between p-3 bg-white rounded-lg border border-gray-200 hover:border-indigo-300 hover:shadow-sm transition-all",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"flex items-center justify-center w-6 h-6 rounded bg-gray-100 text-gray-400 group-hover:text-indigo-500 group-hover:bg-indigo-50",children:(0,t.jsx)("span",{className:"text-xs font-bold",children:l+1})}),(0,t.jsx)("div",{children:(0,t.jsx)("span",{className:"font-medium text-gray-800",children:a})})]}),(0,t.jsx)("button",{type:"button",onClick:()=>{let t;return t=e.fallbackModels.filter((e,t)=>t!==l),void r({...e,fallbackModels:t})},className:"opacity-0 group-hover:opacity-100 transition-opacity text-gray-400 hover:text-red-500 p-1",children:(0,t.jsx)(b.X,{className:"w-4 h-4"})})]},`${a}-${l}`))})]})]})]})}function v({groups:e,onGroupsChange:r,availableModels:a,maxFallbacks:l=10,maxGroups:o=5}){let[n,s]=(0,p.useState)(e.length>0?e[0].id:"1");(0,p.useEffect)(()=>{e.length>0?e.some(e=>e.id===n)||s(e[0].id):s("1")},[e]);let i=()=>{if(e.length>=o)return;let t=Date.now().toString();r([...e,{id:t,primaryModel:null,fallbackModels:[]}]),s(t)},c=t=>{r(e.map(e=>e.id===t.id?t:e))},f=e.map((r,o)=>{let n=r.primaryModel?r.primaryModel:`Group ${o+1}`;return{key:r.id,label:n,closable:e.length>1,children:(0,t.jsx)(y,{group:r,onChange:c,availableModels:a,maxFallbacks:l})}});return 0===e.length?(0,t.jsxs)("div",{className:"text-center py-12 bg-gray-50 rounded-lg border border-dashed border-gray-300",children:[(0,t.jsx)("p",{className:"text-gray-500 mb-4",children:"No fallback groups configured"}),(0,t.jsx)(d.Button,{variant:"primary",onClick:i,icon:()=>(0,t.jsx)(g.Plus,{className:"w-4 h-4"}),children:"Create First Group"})]}):(0,t.jsx)(m.Tabs,{type:"editable-card",activeKey:n,onChange:s,onEdit:(t,a)=>{"add"===a?i():"remove"===a&&e.length>1&&(t=>{if(1===e.length)return u.message.warning("At least one group is required");let a=e.filter(e=>e.id!==t);r(a),n===t&&a.length>0&&s(a[a.length-1].id)})(t)},items:f,className:"fallback-tabs",tabBarStyle:{marginBottom:0},hideAdd:e.length>=o})}e.s(["FallbackSelectionForm",()=>v],419470)}]); \ No newline at end of file + `]:{[`&:hover ${t}-inner`]:{backgroundColor:e.colorPrimaryHover,borderColor:"transparent"}}},{[t]:{"&-indeterminate":{"&":{[`${t}-inner`]:{backgroundColor:`${e.colorBgContainer}`,borderColor:`${e.colorBorder}`,"&:after":{top:"50%",insetInlineStart:"50%",width:e.calc(e.fontSizeLG).div(2).equal(),height:e.calc(e.fontSizeLG).div(2).equal(),backgroundColor:e.colorPrimary,border:0,transform:"translate(-50%, -50%) scale(1)",opacity:1,content:'""'}},[`&:hover ${t}-inner`]:{backgroundColor:`${e.colorBgContainer}`,borderColor:`${e.colorPrimary}`}}}}},{[`${l}-disabled`]:{cursor:"not-allowed"},[`${t}-disabled`]:{[`&, ${t}-input`]:{cursor:"not-allowed",pointerEvents:"none"},[`${t}-inner`]:{background:e.colorBgContainerDisabled,borderColor:e.colorBorder,"&:after":{borderColor:e.colorTextDisabled}},"&:after":{display:"none"},"& + span":{color:e.colorTextDisabled},[`&${t}-indeterminate ${t}-inner::after`]:{background:e.colorTextDisabled}}}]})((0,o.mergeToken)(t,{checkboxCls:`.${e}`,checkboxSize:t.controlInteractiveSize}))}let s=(0,l.genStyleHooks)("Checkbox",(e,{prefixCls:t})=>[n(t,e)]);e.s(["default",0,s,"getStyle",()=>n],236836)},374276,e=>{"use strict";e.i(247167);var t=e.i(271645),r=e.i(343794),a=e.i(91874),l=e.i(611935),o=e.i(121872),n=e.i(26905),s=e.i(242064),i=e.i(937328),c=e.i(321883),d=e.i(62139),u=e.i(421512),m=e.i(236836),g=e.i(681216),p=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 l=0,a=Object.getOwnPropertySymbols(e);lt.indexOf(a[l])&&Object.prototype.propertyIsEnumerable.call(e,a[l])&&(r[a[l]]=e[a[l]]);return r};let f=t.forwardRef((e,f)=>{var h;let{prefixCls:x,className:b,rootClassName:y,children:v,indeterminate:w=!1,style:k,onMouseEnter:C,onMouseLeave:j,skipGroup:N=!1,disabled:S}=e,$=p(e,["prefixCls","className","rootClassName","children","indeterminate","style","onMouseEnter","onMouseLeave","skipGroup","disabled"]),{getPrefixCls:M,direction:E,checkbox:O}=t.useContext(s.ConfigContext),T=t.useContext(u.default),{isFormItemInput:P}=t.useContext(d.FormItemInputContext),_=t.useContext(i.default),z=null!=(h=(null==T?void 0:T.disabled)||S)?h:_,R=t.useRef($.value),I=t.useRef(null),L=(0,l.composeRef)(f,I);t.useEffect(()=>{null==T||T.registerValue($.value)},[]),t.useEffect(()=>{if(!N)return $.value!==R.current&&(null==T||T.cancelValue(R.current),null==T||T.registerValue($.value),R.current=$.value),()=>null==T?void 0:T.cancelValue($.value)},[$.value]),t.useEffect(()=>{var e;(null==(e=I.current)?void 0:e.input)&&(I.current.input.indeterminate=w)},[w]);let D=M("checkbox",x),B=(0,c.default)(D),[F,A,q]=(0,m.default)(D,B),H=Object.assign({},$);T&&!N&&(H.onChange=(...e)=>{$.onChange&&$.onChange.apply($,e),T.toggleOption&&T.toggleOption({label:v,value:$.value})},H.name=T.name,H.checked=T.value.includes($.value));let G=(0,r.default)(`${D}-wrapper`,{[`${D}-rtl`]:"rtl"===E,[`${D}-wrapper-checked`]:H.checked,[`${D}-wrapper-disabled`]:z,[`${D}-wrapper-in-form-item`]:P},null==O?void 0:O.className,b,y,q,B,A),X=(0,r.default)({[`${D}-indeterminate`]:w},n.TARGET_CLS,A),[V,K]=(0,g.default)(H.onClick);return F(t.createElement(o.default,{component:"Checkbox",disabled:z},t.createElement("label",{className:G,style:Object.assign(Object.assign({},null==O?void 0:O.style),k),onMouseEnter:C,onMouseLeave:j,onClick:V},t.createElement(a.default,Object.assign({},H,{onClick:K,prefixCls:D,className:X,disabled:z,ref:L})),null!=v&&t.createElement("span",{className:`${D}-label`},v))))});var h=e.i(8211),x=e.i(529681),b=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 l=0,a=Object.getOwnPropertySymbols(e);lt.indexOf(a[l])&&Object.prototype.propertyIsEnumerable.call(e,a[l])&&(r[a[l]]=e[a[l]]);return r};let y=t.forwardRef((e,a)=>{let{defaultValue:l,children:o,options:n=[],prefixCls:i,className:d,rootClassName:g,style:p,onChange:y}=e,v=b(e,["defaultValue","children","options","prefixCls","className","rootClassName","style","onChange"]),{getPrefixCls:w,direction:k}=t.useContext(s.ConfigContext),[C,j]=t.useState(v.value||l||[]),[N,S]=t.useState([]);t.useEffect(()=>{"value"in v&&j(v.value||[])},[v.value]);let $=t.useMemo(()=>n.map(e=>"string"==typeof e||"number"==typeof e?{label:e,value:e}:e),[n]),M=e=>{S(t=>t.filter(t=>t!==e))},E=e=>{S(t=>[].concat((0,h.default)(t),[e]))},O=e=>{let t=C.indexOf(e.value),r=(0,h.default)(C);-1===t?r.push(e.value):r.splice(t,1),"value"in v||j(r),null==y||y(r.filter(e=>N.includes(e)).sort((e,t)=>$.findIndex(t=>t.value===e)-$.findIndex(e=>e.value===t)))},T=w("checkbox",i),P=`${T}-group`,_=(0,c.default)(T),[z,R,I]=(0,m.default)(T,_),L=(0,x.default)(v,["value","disabled"]),D=n.length?$.map(e=>t.createElement(f,{prefixCls:T,key:e.value.toString(),disabled:"disabled"in e?e.disabled:v.disabled,value:e.value,checked:C.includes(e.value),onChange:e.onChange,className:(0,r.default)(`${P}-item`,e.className),style:e.style,title:e.title,id:e.id,required:e.required},e.label)):o,B=t.useMemo(()=>({toggleOption:O,value:C,disabled:v.disabled,name:v.name,registerValue:E,cancelValue:M}),[O,C,v.disabled,v.name,E,M]),F=(0,r.default)(P,{[`${P}-rtl`]:"rtl"===k},d,g,I,_,R);return z(t.createElement("div",Object.assign({className:F,style:p},L,{ref:a}),t.createElement(u.default.Provider,{value:B},D)))});f.Group=y,f.__ANT_CHECKBOX=!0,e.s(["default",0,f],374276)},536916,e=>{"use strict";var t=e.i(374276);e.s(["Checkbox",()=>t.default])},292639,e=>{"use strict";var t=e.i(764205),r=e.i(266027);let a=(0,e.i(243652).createQueryKeys)("uiSettings");e.s(["useUISettings",0,()=>(0,r.useQuery)({queryKey:a.list({}),queryFn:async()=>await (0,t.getUiSettings)(),staleTime:36e5,gcTime:36e5})])},250980,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3m0 0v3m0-3h3m-3 0H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z"}))});e.s(["PlusCircleIcon",0,r],250980)},502547,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"}))});e.s(["ChevronRightIcon",0,r],502547)},988297,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4v16m8-8H4"}))});e.s(["PlusIcon",0,r],988297)},797672,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"}))});e.s(["PencilIcon",0,r],797672)},992619,e=>{"use strict";var t=e.i(843476),r=e.i(271645),a=e.i(779241),l=e.i(599724),o=e.i(199133),n=e.i(983561),s=e.i(689020);e.s(["default",0,({accessToken:e,value:i,placeholder:c="Select a Model",onChange:d,disabled:u=!1,style:m,className:g,showLabel:p=!0,labelText:f="Select Model"})=>{let[h,x]=(0,r.useState)(i),[b,y]=(0,r.useState)(!1),[v,w]=(0,r.useState)([]),k=(0,r.useRef)(null);return(0,r.useEffect)(()=>{x(i)},[i]),(0,r.useEffect)(()=>{e&&(async()=>{try{let t=await (0,s.fetchAvailableModels)(e);console.log("Fetched models for selector:",t),t.length>0&&w(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)(n.RobotOutlined,{className:"mr-2"})," ",f]}),(0,t.jsx)(o.Select,{value:h,placeholder:c,onChange:e=>{"custom"===e?(y(!0),x(void 0)):(y(!1),x(e),d&&d(e))},options:[...Array.from(new Set(v.map(e=>e.model_group))).map((e,t)=>({value:e,label:e,key:t})),{value:"custom",label:"Enter custom model",key:"custom"}],style:{width:"100%",...m},showSearch:!0,className:`rounded-md ${g||""}`,disabled:u}),b&&(0,t.jsx)(a.TextInput,{className:"mt-2",placeholder:"Enter custom model name",onValueChange:e=>{k.current&&clearTimeout(k.current),k.current=setTimeout(()=>{x(e),d&&d(e)},500)},disabled:u})]})}])},409797,e=>{"use strict";var t=e.i(631171);e.s(["ChevronDownIcon",()=>t.default])},91739,e=>{"use strict";var t=e.i(544195);e.s(["Radio",()=>t.default])},500727,696609,531516,e=>{"use strict";var t=e.i(266027),r=e.i(243652),a=e.i(764205),l=e.i(135214);let o=(0,r.createQueryKeys)("mcpServers");e.s(["useMCPServers",0,e=>{let{accessToken:r}=(0,l.default)();return(0,t.useQuery)({queryKey:o.list(e?{filters:{teamId:e}}:void 0),queryFn:async()=>await (0,a.fetchMCPServers)(r,e),enabled:!!r})}],500727);var n=e.i(843476),s=e.i(271645),i=e.i(536916),c=e.i(599724),d=e.i(409797),u=e.i(246349),u=u;let m=/\b(delete|remove|destroy|purge|drop|erase|unlink)\b/i,g=/\b(create|add|insert|new|post|submit|register|make|generate|write|upload)\b/i,p=/\b(update|edit|modify|change|patch|put|set|rename|move|transform)\b/i,f=/\b(get|read|list|fetch|search|find|query|retrieve|show|view|check|describe|info)\b/i;function h(e,t=""){let r=e.toLowerCase();if(f.test(r))return"read";if(m.test(r))return"delete";if(p.test(r))return"update";if(g.test(r))return"create";if(t){let e=t.toLowerCase();if(f.test(e))return"read";if(m.test(e))return"delete";if(p.test(e))return"update";if(g.test(e))return"create"}return"unknown"}function x(e){let t={read:[],create:[],update:[],delete:[],unknown:[]};for(let r of e)t[h(r.name,r.description)].push(r);return t}let b={read:{label:"Read",description:"Safe operations — fetch, list, search. No side effects.",risk:"low"},create:{label:"Create",description:"Add new resources — insert, upload, register.",risk:"medium"},update:{label:"Update",description:"Modify existing resources — edit, patch, rename.",risk:"medium"},delete:{label:"Delete",description:"Destructive operations — remove, purge, destroy.",risk:"high"},unknown:{label:"Other",description:"Operations that could not be automatically classified.",risk:"unknown"}};e.s(["CRUD_GROUP_META",0,b,"classifyToolOp",()=>h,"groupToolsByCrud",()=>x],696609);let y=["read","create","update","delete","unknown"],v={low:"bg-green-100 text-green-800",medium:"bg-yellow-100 text-yellow-800",high:"bg-red-100 text-red-800 font-semibold",unknown:"bg-gray-100 text-gray-700"},w={read:"border-green-200",create:"border-blue-200",update:"border-yellow-200",delete:"border-red-300",unknown:"border-gray-200"},k={read:"bg-green-50",create:"bg-blue-50",update:"bg-yellow-50",delete:"bg-red-50",unknown:"bg-gray-50"};e.s(["default",0,({tools:e,value:t,onChange:r,readOnly:a=!1,searchFilter:l=""})=>{let[o,m]=(0,s.useState)({read:!1,create:!1,update:!1,delete:!1,unknown:!0}),g=(0,s.useMemo)(()=>x(e),[e]),p=(0,s.useMemo)(()=>new Set(void 0===t?e.map(e=>e.name):t),[t,e]),f=e=>{if(a)return;let t=new Set(p);t.has(e)?t.delete(e):t.add(e),r(Array.from(t))};return 0===e.length?null:(0,n.jsx)("div",{className:"space-y-3",children:y.map(e=>{let t,s=g[e];if(0===s.length)return null;if(l){let e=l.toLowerCase();if(!s.some(t=>t.name.toLowerCase().includes(e)||(t.description??"").toLowerCase().includes(e)))return null}let h=b[e],x=(t=g[e]).length>0&&t.every(e=>p.has(e.name)),y=(e=>{let t=g[e];if(0===t.length)return!1;let r=t.filter(e=>p.has(e.name)).length;return r>0&&r{m(t=>({...t,[e]:!t[e]}))},children:[C?(0,n.jsx)(u.default,{className:"w-4 h-4 text-gray-500 flex-shrink-0"}):(0,n.jsx)(d.ChevronDownIcon,{className:"w-4 h-4 text-gray-500 flex-shrink-0"}),(0,n.jsx)("span",{className:"font-semibold text-gray-900 text-sm",children:h.label}),(0,n.jsx)("span",{className:`text-xs px-2 py-0.5 rounded-full ${v[h.risk]}`,children:"high"===h.risk?"High Risk":"medium"===h.risk?"Medium Risk":"low"===h.risk?"Safe":"Unclassified"}),(0,n.jsxs)("span",{className:"text-xs text-gray-500 ml-1",children:[s.filter(e=>p.has(e.name)).length,"/",s.length," allowed"]})]}),!a&&(0,n.jsxs)("div",{className:"flex items-center gap-2 ml-4",children:[(0,n.jsx)(c.Text,{className:"text-xs text-gray-500",children:x?"All on":y?"Partial":"All off"}),(0,n.jsx)(i.Checkbox,{checked:x,indeterminate:y,onChange:t=>((e,t)=>{if(a)return;let l=new Set(p);for(let r of g[e])t?l.add(r.name):l.delete(r.name);r(Array.from(l))})(e,t.target.checked),onClick:e=>e.stopPropagation()})]})]}),!C&&(0,n.jsx)("div",{className:"px-4 pt-2 pb-1 text-xs text-gray-500 bg-white border-b border-gray-100",children:h.description}),!C&&(0,n.jsx)("div",{className:"bg-white divide-y divide-gray-50",children:s.filter(e=>!l||e.name.toLowerCase().includes(l.toLowerCase())||(e.description??"").toLowerCase().includes(l.toLowerCase())).map(e=>{let t,r=(t=e.name,p.has(t));return(0,n.jsxs)("div",{className:`flex items-start gap-3 px-4 py-2.5 transition-colors hover:bg-gray-50 ${!a?"cursor-pointer":""} ${r?"":"opacity-60"}`,onClick:()=>f(e.name),children:[(0,n.jsx)(i.Checkbox,{checked:r,onChange:()=>f(e.name),disabled:a,onClick:e=>e.stopPropagation()}),(0,n.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,n.jsx)(c.Text,{className:"font-medium text-gray-900 text-sm",children:e.name}),e.description&&(0,n.jsx)(c.Text,{className:"text-xs text-gray-500 mt-0.5 leading-snug",children:e.description})]}),(0,n.jsx)("span",{className:`text-xs px-1.5 py-0.5 rounded flex-shrink-0 ${r?"bg-green-100 text-green-700":"bg-gray-100 text-gray-500"}`,children:r?"on":"off"})]},e.name)})})]},e)})})}],531516)},361653,e=>{"use strict";let t=(0,e.i(475254).default)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);e.s(["default",()=>t])},603908,e=>{"use strict";let t=(0,e.i(475254).default)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);e.s(["default",()=>t])},841947,e=>{"use strict";let t=(0,e.i(475254).default)("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);e.s(["default",()=>t])},793130,e=>{"use strict";var t=e.i(290571),r=e.i(429427),a=e.i(371330),l=e.i(271645),o=e.i(394487),n=e.i(503269),s=e.i(214520),i=e.i(746725),c=e.i(914189),d=e.i(144279),u=e.i(294316),m=e.i(601893),g=e.i(140721),p=e.i(942803),f=e.i(233538),h=e.i(694421),x=e.i(700020),b=e.i(35889),y=e.i(998348),v=e.i(722678);let w=(0,l.createContext)(null);w.displayName="GroupContext";let k=l.Fragment,C=Object.assign((0,x.forwardRefWithAs)(function(e,t){var k;let C=(0,l.useId)(),j=(0,p.useProvidedId)(),N=(0,m.useDisabled)(),{id:S=j||`headlessui-switch-${C}`,disabled:$=N||!1,checked:M,defaultChecked:E,onChange:O,name:T,value:P,form:_,autoFocus:z=!1,...R}=e,I=(0,l.useContext)(w),[L,D]=(0,l.useState)(null),B=(0,l.useRef)(null),F=(0,u.useSyncRefs)(B,t,null===I?null:I.setSwitch,D),A=(0,s.useDefaultValue)(E),[q,H]=(0,n.useControllable)(M,O,null!=A&&A),G=(0,i.useDisposables)(),[X,V]=(0,l.useState)(!1),K=(0,c.useEvent)(()=>{V(!0),null==H||H(!q),G.nextFrame(()=>{V(!1)})}),W=(0,c.useEvent)(e=>{if((0,f.isDisabledReactIssue7711)(e.currentTarget))return e.preventDefault();e.preventDefault(),K()}),U=(0,c.useEvent)(e=>{e.key===y.Keys.Space?(e.preventDefault(),K()):e.key===y.Keys.Enter&&(0,h.attemptSubmit)(e.currentTarget)}),Y=(0,c.useEvent)(e=>e.preventDefault()),Q=(0,v.useLabelledBy)(),J=(0,b.useDescribedBy)(),{isFocusVisible:Z,focusProps:ee}=(0,r.useFocusRing)({autoFocus:z}),{isHovered:et,hoverProps:er}=(0,a.useHover)({isDisabled:$}),{pressed:ea,pressProps:el}=(0,o.useActivePress)({disabled:$}),eo=(0,l.useMemo)(()=>({checked:q,disabled:$,hover:et,focus:Z,active:ea,autofocus:z,changing:X}),[q,et,Z,ea,$,X,z]),en=(0,x.mergeProps)({id:S,ref:F,role:"switch",type:(0,d.useResolveButtonType)(e,L),tabIndex:-1===e.tabIndex?0:null!=(k=e.tabIndex)?k:0,"aria-checked":q,"aria-labelledby":Q,"aria-describedby":J,disabled:$||void 0,autoFocus:z,onClick:W,onKeyUp:U,onKeyPress:Y},ee,er,el),es=(0,l.useCallback)(()=>{if(void 0!==A)return null==H?void 0:H(A)},[H,A]),ei=(0,x.useRender)();return l.default.createElement(l.default.Fragment,null,null!=T&&l.default.createElement(g.FormFields,{disabled:$,data:{[T]:P||"on"},overrides:{type:"checkbox",checked:q},form:_,onReset:es}),ei({ourProps:en,theirProps:R,slot:eo,defaultTag:"button",name:"Switch"}))}),{Group:function(e){var t;let[r,a]=(0,l.useState)(null),[o,n]=(0,v.useLabels)(),[s,i]=(0,b.useDescriptions)(),c=(0,l.useMemo)(()=>({switch:r,setSwitch:a}),[r,a]),d=(0,x.useRender)();return l.default.createElement(i,{name:"Switch.Description",value:s},l.default.createElement(n,{name:"Switch.Label",value:o,props:{htmlFor:null==(t=c.switch)?void 0:t.id,onClick(e){r&&(e.currentTarget instanceof HTMLLabelElement&&e.preventDefault(),r.click(),r.focus({preventScroll:!0}))}}},l.default.createElement(w.Provider,{value:c},d({ourProps:{},theirProps:e,slot:{},defaultTag:k,name:"Switch.Group"}))))},Label:v.Label,Description:b.Description});var j=e.i(888288),N=e.i(95779),S=e.i(444755),$=e.i(673706),M=e.i(829087);let E=(0,$.makeClassName)("Switch"),O=l.default.forwardRef((e,r)=>{let{checked:a,defaultChecked:o=!1,onChange:n,color:s,name:i,error:c,errorMessage:d,disabled:u,required:m,tooltip:g,id:p}=e,f=(0,t.__rest)(e,["checked","defaultChecked","onChange","color","name","error","errorMessage","disabled","required","tooltip","id"]),h={bgColor:s?(0,$.getColorClassNames)(s,N.colorPalette.background).bgColor:"bg-tremor-brand dark:bg-dark-tremor-brand",ringColor:s?(0,$.getColorClassNames)(s,N.colorPalette.ring).ringColor:"ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted"},[x,b]=(0,j.default)(o,a),[y,v]=(0,l.useState)(!1),{tooltipProps:w,getReferenceProps:k}=(0,M.useTooltip)(300);return l.default.createElement("div",{className:"flex flex-row items-center justify-start"},l.default.createElement(M.default,Object.assign({text:g},w)),l.default.createElement("div",Object.assign({ref:(0,$.mergeRefs)([r,w.refs.setReference]),className:(0,S.tremorTwMerge)(E("root"),"flex flex-row relative h-5")},f,k),l.default.createElement("input",{type:"checkbox",className:(0,S.tremorTwMerge)(E("input"),"absolute w-5 h-5 cursor-pointer left-0 top-0 opacity-0"),name:i,required:m,checked:x,onChange:e=>{e.preventDefault()}}),l.default.createElement(C,{checked:x,onChange:e=>{b(e),null==n||n(e)},disabled:u,className:(0,S.tremorTwMerge)(E("switch"),"w-10 h-5 group relative inline-flex shrink-0 cursor-pointer items-center justify-center rounded-tremor-full","focus:outline-none",u?"cursor-not-allowed":""),onFocus:()=>v(!0),onBlur:()=>v(!1),id:p},l.default.createElement("span",{className:(0,S.tremorTwMerge)(E("sr-only"),"sr-only")},"Switch ",x?"on":"off"),l.default.createElement("span",{"aria-hidden":"true",className:(0,S.tremorTwMerge)(E("background"),x?h.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")}),l.default.createElement("span",{"aria-hidden":"true",className:(0,S.tremorTwMerge)(E("round"),x?(0,S.tremorTwMerge)(h.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,S.tremorTwMerge)("ring-2",h.ringColor):"")}))),c&&d?l.default.createElement("p",{className:(0,S.tremorTwMerge)(E("errorMessage"),"text-sm text-red-500 mt-1 ")},d):null)});O.displayName="Switch",e.s(["Switch",()=>O],793130)},158392,419470,e=>{"use strict";var t=e.i(843476),r=e.i(779241);let a={ttl:3600,lowest_latency_buffer:0},l=({routingStrategyArgs:e})=>{let l={ttl:"Sliding window to look back over when calculating the average latency of a deployment. Default - 1 hour (in seconds).",lowest_latency_buffer:"Shuffle between deployments within this % of the lowest latency. Default - 0 (i.e. always pick lowest latency)."};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"max-w-3xl",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Latency-Based Configuration"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Fine-tune latency-based routing behavior"})]}),(0,t.jsx)("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2 xl:grid-cols-3",children:Object.entries(e||a).map(([e,a])=>(0,t.jsx)("div",{className:"space-y-2",children:(0,t.jsxs)("label",{className:"block",children:[(0,t.jsx)("span",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:e.replace(/_/g," ")}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-0.5 mb-2",children:l[e]||""}),(0,t.jsx)(r.TextInput,{name:e,defaultValue:"object"==typeof a?JSON.stringify(a,null,2):a?.toString(),className:"font-mono text-sm w-full"})]})},e))})]}),(0,t.jsx)("div",{className:"border-t border-gray-200"})]})},o=({routerSettings:e,routerFieldsMetadata:a})=>(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"max-w-3xl",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Reliability & Retries"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Configure retry logic and failure handling"})]}),(0,t.jsx)("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2 xl:grid-cols-3",children:Object.entries(e).filter(([e,t])=>"fallbacks"!=e&&"context_window_fallbacks"!=e&&"routing_strategy_args"!=e&&"routing_strategy"!=e&&"enable_tag_filtering"!=e).map(([e,l])=>(0,t.jsx)("div",{className:"space-y-2",children:(0,t.jsxs)("label",{className:"block",children:[(0,t.jsx)("span",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:a[e]?.ui_field_name||e}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-0.5 mb-2",children:a[e]?.field_description||""}),(0,t.jsx)(r.TextInput,{name:e,defaultValue:null==l||"null"===l?"":"object"==typeof l?JSON.stringify(l,null,2):l?.toString()||"",placeholder:"—",className:"font-mono text-sm w-full"})]})},e))})]});var n=e.i(199133);let s=({selectedStrategy:e,availableStrategies:r,routingStrategyDescriptions:a,routerFieldsMetadata:l,onStrategyChange:o})=>(0,t.jsxs)("div",{className:"space-y-2 max-w-3xl",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:l.routing_strategy?.ui_field_name||"Routing Strategy"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-0.5 mb-2",children:l.routing_strategy?.field_description||""})]}),(0,t.jsx)("div",{className:"routing-strategy-select max-w-3xl",children:(0,t.jsx)(n.Select,{value:e,onChange:o,style:{width:"100%"},size:"large",children:r.map(e=>(0,t.jsx)(n.Select.Option,{value:e,label:e,children:(0,t.jsxs)("div",{className:"flex flex-col gap-0.5 py-1",children:[(0,t.jsx)("span",{className:"font-mono text-sm font-medium",children:e}),a[e]&&(0,t.jsx)("span",{className:"text-xs text-gray-500 font-normal",children:a[e]})]})},e))})})]});var i=e.i(793130);let c=({enabled:e,routerFieldsMetadata:r,onToggle:a})=>(0,t.jsx)("div",{className:"space-y-3 max-w-3xl",children:(0,t.jsxs)("div",{className:"flex items-start justify-between",children:[(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)("label",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:r.enable_tag_filtering?.ui_field_name||"Enable Tag Filtering"}),(0,t.jsxs)("p",{className:"text-xs text-gray-500 mt-0.5",children:[r.enable_tag_filtering?.field_description||"",r.enable_tag_filtering?.link&&(0,t.jsxs)(t.Fragment,{children:[" ",(0,t.jsx)("a",{href:r.enable_tag_filtering.link,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-800 underline",children:"Learn more"})]})]})]}),(0,t.jsx)(i.Switch,{checked:e,onChange:a,className:"ml-4"})]})});e.s(["default",0,({value:e,onChange:r,routerFieldsMetadata:a,availableRoutingStrategies:n,routingStrategyDescriptions:i})=>(0,t.jsxs)("div",{className:"w-full space-y-8 py-2",children:[(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"max-w-3xl",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Routing Settings"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Configure how requests are routed to deployments"})]}),n.length>0&&(0,t.jsx)(s,{selectedStrategy:e.selectedStrategy||e.routerSettings.routing_strategy||null,availableStrategies:n,routingStrategyDescriptions:i,routerFieldsMetadata:a,onStrategyChange:t=>{r({...e,selectedStrategy:t})}}),(0,t.jsx)(c,{enabled:e.enableTagFiltering,routerFieldsMetadata:a,onToggle:t=>{r({...e,enableTagFiltering:t})}})]}),(0,t.jsx)("div",{className:"border-t border-gray-200"}),"latency-based-routing"===e.selectedStrategy&&(0,t.jsx)(l,{routingStrategyArgs:e.routerSettings.routing_strategy_args}),(0,t.jsx)(o,{routerSettings:e.routerSettings,routerFieldsMetadata:a})]})],158392);var d=e.i(994388),u=e.i(998573),m=e.i(653496),g=e.i(107233),p=e.i(271645),f=e.i(592968),h=e.i(361653),h=h;let x=(0,e.i(475254).default)("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);var b=e.i(37727);function y({group:e,onChange:r,availableModels:a,maxFallbacks:l}){let o=a.filter(t=>t!==e.primaryModel),s=e.fallbackModels.length{let a=[...e.fallbackModels];a.includes(t)&&(a=a.filter(e=>e!==t)),r({...e,primaryModel:t,fallbackModels:a})},showSearch:!0,getPopupContainer:e=>e.parentElement||document.body,filterOption:(e,t)=>(t?.label??"").toLowerCase().includes(e.toLowerCase()),options:a.map(e=>({label:e,value:e}))}),!e.primaryModel&&(0,t.jsxs)("div",{className:"mt-2 flex items-center gap-2 text-amber-600 text-xs bg-amber-50 p-2 rounded",children:[(0,t.jsx)(h.default,{className:"w-4 h-4"}),(0,t.jsx)("span",{children:"Select a model to begin configuring fallbacks"})]})]}),(0,t.jsx)("div",{className:"flex items-center justify-center -my-4 z-10",children:(0,t.jsxs)("div",{className:"bg-indigo-50 text-indigo-500 px-4 py-1 rounded-full text-xs font-bold border border-indigo-100 flex items-center gap-2 shadow-sm",children:[(0,t.jsx)(x,{className:"w-4 h-4"}),"IF FAILS, TRY..."]})}),(0,t.jsxs)("div",{className:`transition-opacity duration-300 ${!e.primaryModel?"opacity-50 pointer-events-none":"opacity-100"}`,children:[(0,t.jsxs)("label",{className:"block text-sm font-semibold text-gray-700 mb-2",children:["Fallback Chain ",(0,t.jsx)("span",{className:"text-red-500",children:"*"}),(0,t.jsxs)("span",{className:"text-xs text-gray-500 font-normal ml-2",children:["(Max ",l," fallbacks at a time)"]})]}),(0,t.jsxs)("div",{className:"bg-gray-50 rounded-xl p-4 border border-gray-200",children:[(0,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsx)(n.Select,{mode:"multiple",className:"w-full",size:"large",placeholder:s?"Select fallback models to add...":`Maximum ${l} fallbacks reached`,value:e.fallbackModels,onChange:t=>{let a=t.slice(0,l);r({...e,fallbackModels:a})},disabled:!e.primaryModel,getPopupContainer:e=>e.parentElement||document.body,options:o.map(e=>({label:e,value:e})),optionRender:(r,a)=>{let l=e.fallbackModels.includes(r.value),o=l?e.fallbackModels.indexOf(r.value)+1:null;return(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[l&&null!==o&&(0,t.jsx)("span",{className:"flex items-center justify-center w-5 h-5 rounded bg-indigo-100 text-indigo-600 text-xs font-bold",children:o}),(0,t.jsx)("span",{children:r.label})]})},maxTagCount:"responsive",maxTagPlaceholder:e=>(0,t.jsx)(f.Tooltip,{styles:{root:{pointerEvents:"none"}},title:e.map(({value:e})=>e).join(", "),children:(0,t.jsxs)("span",{children:["+",e.length," more"]})}),showSearch:!0,filterOption:(e,t)=>(t?.label??"").toLowerCase().includes(e.toLowerCase())}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1 ml-1",children:s?`Search and select multiple models. Selected models will appear below in order. (${e.fallbackModels.length}/${l} used)`:`Maximum ${l} fallbacks reached. Remove some to add more.`})]}),(0,t.jsx)("div",{className:"space-y-2 min-h-[100px]",children:0===e.fallbackModels.length?(0,t.jsxs)("div",{className:"h-32 border-2 border-dashed border-gray-300 rounded-lg flex flex-col items-center justify-center text-gray-400",children:[(0,t.jsx)("span",{className:"text-sm",children:"No fallback models selected"}),(0,t.jsx)("span",{className:"text-xs mt-1",children:"Add models from the dropdown above"})]}):e.fallbackModels.map((a,l)=>(0,t.jsxs)("div",{className:"group flex items-center justify-between p-3 bg-white rounded-lg border border-gray-200 hover:border-indigo-300 hover:shadow-sm transition-all",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"flex items-center justify-center w-6 h-6 rounded bg-gray-100 text-gray-400 group-hover:text-indigo-500 group-hover:bg-indigo-50",children:(0,t.jsx)("span",{className:"text-xs font-bold",children:l+1})}),(0,t.jsx)("div",{children:(0,t.jsx)("span",{className:"font-medium text-gray-800",children:a})})]}),(0,t.jsx)("button",{type:"button",onClick:()=>{let t;return t=e.fallbackModels.filter((e,t)=>t!==l),void r({...e,fallbackModels:t})},className:"opacity-0 group-hover:opacity-100 transition-opacity text-gray-400 hover:text-red-500 p-1",children:(0,t.jsx)(b.X,{className:"w-4 h-4"})})]},`${a}-${l}`))})]})]})]})}function v({groups:e,onGroupsChange:r,availableModels:a,maxFallbacks:l=10,maxGroups:o=5}){let[n,s]=(0,p.useState)(e.length>0?e[0].id:"1");(0,p.useEffect)(()=>{e.length>0?e.some(e=>e.id===n)||s(e[0].id):s("1")},[e]);let i=()=>{if(e.length>=o)return;let t=Date.now().toString();r([...e,{id:t,primaryModel:null,fallbackModels:[]}]),s(t)},c=t=>{r(e.map(e=>e.id===t.id?t:e))},f=e.map((r,o)=>{let n=r.primaryModel?r.primaryModel:`Group ${o+1}`;return{key:r.id,label:n,closable:e.length>1,children:(0,t.jsx)(y,{group:r,onChange:c,availableModels:a,maxFallbacks:l})}});return 0===e.length?(0,t.jsxs)("div",{className:"text-center py-12 bg-gray-50 rounded-lg border border-dashed border-gray-300",children:[(0,t.jsx)("p",{className:"text-gray-500 mb-4",children:"No fallback groups configured"}),(0,t.jsx)(d.Button,{variant:"primary",onClick:i,icon:()=>(0,t.jsx)(g.Plus,{className:"w-4 h-4"}),children:"Create First Group"})]}):(0,t.jsx)(m.Tabs,{type:"editable-card",activeKey:n,onChange:s,onEdit:(t,a)=>{"add"===a?i():"remove"===a&&e.length>1&&(t=>{if(1===e.length)return u.message.warning("At least one group is required");let a=e.filter(e=>e.id!==t);r(a),n===t&&a.length>0&&s(a[a.length-1].id)})(t)},items:f,className:"fallback-tabs",tabBarStyle:{marginBottom:0},hideAdd:e.length>=o})}e.s(["FallbackSelectionForm",()=>v],419470)}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/531dc633eecbb64f.js b/litellm/proxy/_experimental/out/_next/static/chunks/7174130ddef406dd.js similarity index 58% rename from litellm/proxy/_experimental/out/_next/static/chunks/531dc633eecbb64f.js rename to litellm/proxy/_experimental/out/_next/static/chunks/7174130ddef406dd.js index 8ed318457c..21cdd1b50a 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/531dc633eecbb64f.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/7174130ddef406dd.js @@ -1,8 +1,8 @@ -(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,162386,e=>{"use strict";var t=e.i(843476),l=e.i(625901),a=e.i(109799),r=e.i(785242),i=e.i(738014),s=e.i(199133),n=e.i(981339),o=e.i(592968);let d={label:"All Proxy Models",value:"all-proxy-models"},c={label:"No Default Models",value:"no-default-models"},u=[d,c],m={user:({allProxyModels:e,userModels:t,options:l})=>t&&l?.includeUserModels?t:[],team:({allProxyModels:e,selectedOrganization:t,userModels:l})=>t?t.models.includes(d.value)||0===t.models.length?e:e.filter(e=>t.models.includes(e)):e??[],organization:({allProxyModels:e})=>e,global:({allProxyModels:e})=>e};e.s(["ModelSelect",0,e=>{let{teamID:h,organizationID:g,options:f,context:p,dataTestId:b,value:v=[],onChange:x,style:y}=e,{includeUserModels:j,showAllTeamModelsOption:w,showAllProxyModelsOverride:k,includeSpecialOptions:C}=f||{},{data:O,isLoading:$}=(0,l.useAllProxyModels)(),{data:N,isLoading:E}=(0,r.useTeam)(h),{data:T,isLoading:_}=(0,a.useOrganization)(g),{data:M,isLoading:I}=(0,i.useCurrentUser)(),S=e=>u.some(t=>t.value===e),R=v.some(S),P=T?.models.includes(d.value)||T?.models.length===0;if($||E||_||I)return(0,t.jsx)(n.Skeleton.Input,{active:!0,block:!0});let{wildcard:q,regular:A}=(e=>{let t=[],l=[];for(let a of e)a.endsWith("/*")?t.push(a):l.push(a);return{wildcard:t,regular:l}})(((e,t,l)=>{let a=Array.from(new Map(e.map(e=>[e.id,e])).values()).map(e=>e.id);if(t.options?.showAllProxyModelsOverride)return a;let r=m[t.context];return r?r({allProxyModels:a,...l,options:t.options}):[]})(O?.data??[],e,{selectedTeam:N,selectedOrganization:T,userModels:M?.models}));return(0,t.jsx)(s.Select,{"data-testid":b,value:v,onChange:e=>{let t=e.filter(S);x(t.length>0?[t[t.length-1]]:e)},style:y,options:[C?{label:(0,t.jsx)("span",{children:"Special Options"}),title:"Special Options",options:[...k||P&&C||"global"===p?[{label:(0,t.jsx)("span",{children:"All Proxy Models"}),value:d.value,disabled:v.length>0&&v.some(e=>S(e)&&e!==d.value),key:d.value}]:[],{label:(0,t.jsx)("span",{children:"No Default Models"}),value:c.value,disabled:v.length>0&&v.some(e=>S(e)&&e!==c.value),key:c.value}]}:[],...q.length>0?[{label:(0,t.jsx)("span",{children:"Wildcard Options"}),title:"Wildcard Options",options:q.map(e=>{let l=e.replace("/*",""),a=l.charAt(0).toUpperCase()+l.slice(1);return{label:(0,t.jsx)("span",{children:`All ${a} models`}),value:e,disabled:R}})}]:[],{label:(0,t.jsx)("span",{children:"Models"}),title:"Models",options:A.map(e=>({label:(0,t.jsx)("span",{children:e}),value:e,disabled:R}))}],mode:"multiple",placeholder:"Select Models",allowClear:!0,maxTagCount:"responsive",maxTagPlaceholder:e=>(0,t.jsx)(o.Tooltip,{styles:{root:{pointerEvents:"none"}},title:e.map(({value:e})=>e).join(", "),children:(0,t.jsxs)("span",{children:["+",e.length," more"]})})})}],162386)},294612,e=>{"use strict";var t=e.i(843476),l=e.i(100486),a=e.i(827252),r=e.i(213205),i=e.i(771674),s=e.i(464571),n=e.i(770914),o=e.i(291542),d=e.i(262218),c=e.i(592968),u=e.i(898586),m=e.i(902555);let{Text:h}=u.Typography;function g({members:e,canEdit:u,onEdit:g,onDelete:f,onAddMember:p,roleColumnTitle:b="Role",roleTooltip:v,extraColumns:x=[],showDeleteForMember:y,emptyText:j}){let w=[{title:"User Email",dataIndex:"user_email",key:"user_email",render:e=>(0,t.jsx)(h,{children:e||"-"})},{title:"User ID",dataIndex:"user_id",key:"user_id",render:e=>"default_user_id"===e?(0,t.jsx)(d.Tag,{color:"blue",children:"Default Proxy Admin"}):(0,t.jsx)(h,{children:e||"-"})},{title:v?(0,t.jsxs)(n.Space,{direction:"horizontal",children:[b,(0,t.jsx)(c.Tooltip,{title:v,children:(0,t.jsx)(a.InfoCircleOutlined,{})})]}):b,dataIndex:"role",key:"role",render:e=>(0,t.jsxs)(n.Space,{children:[e?.toLowerCase()==="admin"||e?.toLowerCase()==="org_admin"?(0,t.jsx)(l.CrownOutlined,{}):(0,t.jsx)(i.UserOutlined,{}),(0,t.jsx)(h,{style:{textTransform:"capitalize"},children:e||"-"})]})},...x,{title:"Actions",key:"actions",fixed:"right",width:120,render:(e,l)=>u?(0,t.jsxs)(n.Space,{children:[(0,t.jsx)(m.default,{variant:"Edit",tooltipText:"Edit member",dataTestId:"edit-member",onClick:()=>g(l)}),(!y||y(l))&&(0,t.jsx)(m.default,{variant:"Delete",tooltipText:"Delete member",dataTestId:"delete-member",onClick:()=>f(l)})]}):null}];return(0,t.jsxs)(n.Space,{direction:"vertical",style:{width:"100%"},children:[(0,t.jsxs)("span",{className:"inline-flex text-sm text-gray-700",children:[e.length," Member",1!==e.length?"s":""]}),(0,t.jsx)(o.Table,{columns:w,dataSource:e,rowKey:e=>e.user_id??e.user_email??JSON.stringify(e),pagination:!1,size:"small",scroll:{x:"max-content"},locale:j?{emptyText:j}:void 0}),p&&u&&(0,t.jsx)(s.Button,{icon:(0,t.jsx)(r.UserAddOutlined,{}),type:"primary",onClick:p,children:"Add Member"})]})}e.s(["default",()=>g])},907308,e=>{"use strict";var t=e.i(843476),l=e.i(271645),a=e.i(212931),r=e.i(808613),i=e.i(464571),s=e.i(199133),n=e.i(592968),o=e.i(213205),d=e.i(374009),c=e.i(764205);e.s(["default",0,({isVisible:e,onCancel:u,onSubmit:m,accessToken:h,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:p="user",teamId:b})=>{let[v]=r.Form.useForm(),[x,y]=(0,l.useState)([]),[j,w]=(0,l.useState)(!1),[k,C]=(0,l.useState)("user_email"),[O,$]=(0,l.useState)(!1),N=async(e,t)=>{if(!e)return void y([]);w(!0);try{let l=new URLSearchParams;if(l.append(t,e),b&&l.append("team_id",b),null==h)return;let a=(await (0,c.userFilterUICall)(h,l)).map(e=>({label:"user_email"===t?`${e.user_email}`:`${e.user_id}`,value:"user_email"===t?e.user_email:e.user_id,user:e}));y(a)}catch(e){console.error("Error fetching users:",e)}finally{w(!1)}},E=(0,l.useCallback)((0,d.default)((e,t)=>N(e,t),300),[]),T=(e,t)=>{C(t),E(e,t)},_=(e,t)=>{let l=t.user;v.setFieldsValue({user_email:l.user_email,user_id:l.user_id,role:v.getFieldValue("role")})},M=async e=>{$(!0);try{await m(e)}finally{$(!1)}};return(0,t.jsx)(a.Modal,{title:g,open:e,onCancel:()=>{v.resetFields(),y([]),u()},footer:null,width:800,maskClosable:!O,children:(0,t.jsxs)(r.Form,{form:v,onFinish:M,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",initialValues:{role:p},children:[(0,t.jsx)(r.Form.Item,{label:"Email",name:"user_email",className:"mb-4",children:(0,t.jsx)(s.Select,{showSearch:!0,className:"w-full",placeholder:"Search by email",filterOption:!1,onSearch:e=>T(e,"user_email"),onSelect:(e,t)=>_(e,t),options:"user_email"===k?x:[],loading:j,allowClear:!0})}),(0,t.jsx)("div",{className:"text-center mb-4",children:"OR"}),(0,t.jsx)(r.Form.Item,{label:"User ID",name:"user_id",className:"mb-4",children:(0,t.jsx)(s.Select,{showSearch:!0,className:"w-full",placeholder:"Search by user ID",filterOption:!1,onSearch:e=>T(e,"user_id"),onSelect:(e,t)=>_(e,t),options:"user_id"===k?x:[],loading:j,allowClear:!0})}),(0,t.jsx)(r.Form.Item,{label:"Member Role",name:"role",className:"mb-4",children:(0,t.jsx)(s.Select,{defaultValue:p,children:f.map(e=>(0,t.jsx)(s.Select.Option,{value:e.value,children:(0,t.jsxs)(n.Tooltip,{title:e.description,children:[(0,t.jsx)("span",{className:"font-medium",children:e.label}),(0,t.jsxs)("span",{className:"ml-2 text-gray-500 text-sm",children:["- ",e.description]})]})},e.value))})}),(0,t.jsx)("div",{className:"text-right mt-4",children:(0,t.jsx)(i.Button,{type:"primary",htmlType:"submit",icon:(0,t.jsx)(o.UserAddOutlined,{}),loading:O,children:O?"Adding...":"Add Member"})})]})})}])},276173,e=>{"use strict";var t=e.i(843476),l=e.i(599724),a=e.i(779241),r=e.i(464571),i=e.i(808613),s=e.i(212931),n=e.i(199133),o=e.i(271645),d=e.i(435451);e.s(["default",0,({visible:e,onCancel:c,onSubmit:u,initialData:m,mode:h,config:g})=>{let f,[p]=i.Form.useForm(),[b,v]=(0,o.useState)(!1);console.log("Initial Data:",m),(0,o.useEffect)(()=>{if(e)if("edit"===h&&m){let e={...m,role:m.role||g.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:g.defaultRole||g.roleOptions[0]?.value})},[e,m,h,p,g.defaultRole,g.roleOptions]);let x=async e=>{try{v(!0);let t=Object.entries(e).reduce((e,[t,l])=>{if("string"==typeof l){let a=l.trim();return""===a&&("max_budget_in_team"===t||"tpm_limit"===t||"rpm_limit"===t)?{...e,[t]:null}:{...e,[t]:a}}return{...e,[t]:l}},{});console.log("Submitting form data:",t),await Promise.resolve(u(t)),p.resetFields()}catch(e){console.error("Form submission error:",e)}finally{v(!1)}};return(0,t.jsx)(s.Modal,{title:g.title||("add"===h?"Add Member":"Edit Member"),open:e,width:1e3,footer:null,onCancel:c,children:(0,t.jsxs)(i.Form,{form:p,onFinish:x,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[g.showEmail&&(0,t.jsx)(i.Form.Item,{label:"Email",name:"user_email",className:"mb-4",rules:[{type:"email",message:"Please enter a valid email!"}],children:(0,t.jsx)(a.TextInput,{placeholder:"user@example.com"})}),g.showEmail&&g.showUserId&&(0,t.jsx)("div",{className:"text-center mb-4",children:(0,t.jsx)(l.Text,{children:"OR"})}),g.showUserId&&(0,t.jsx)(i.Form.Item,{label:"User ID",name:"user_id",className:"mb-4",children:(0,t.jsx)(a.TextInput,{placeholder:"user_123"})}),(0,t.jsx)(i.Form.Item,{label:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{children:"Role"}),"edit"===h&&m&&(0,t.jsxs)("span",{className:"text-gray-500 text-sm",children:["(Current: ",(f=m.role,g.roleOptions.find(e=>e.value===f)?.label||f),")"]})]}),name:"role",className:"mb-4",rules:[{required:!0,message:"Please select a role!"}],children:(0,t.jsx)(n.Select,{children:"edit"===h&&m?[...g.roleOptions.filter(e=>e.value===m.role),...g.roleOptions.filter(e=>e.value!==m.role)].map(e=>(0,t.jsx)(n.Select.Option,{value:e.value,children:e.label},e.value)):g.roleOptions.map(e=>(0,t.jsx)(n.Select.Option,{value:e.value,children:e.label},e.value))})}),g.additionalFields?.map(e=>(0,t.jsx)(i.Form.Item,{label:e.label,name:e.name,className:"mb-4",rules:e.rules,children:(e=>{switch(e.type){case"input":return(0,t.jsx)(a.TextInput,{placeholder:e.placeholder});case"numerical":return(0,t.jsx)(d.default,{step:e.step||1,min:e.min||0,style:{width:"100%"},placeholder:e.placeholder||"Enter a numerical value"});case"select":return(0,t.jsx)(n.Select,{children:e.options?.map(e=>(0,t.jsx)(n.Select.Option,{value:e.value,children:e.label},e.value))});default:return null}})(e)},e.name)),(0,t.jsxs)("div",{className:"text-right mt-6",children:[(0,t.jsx)(r.Button,{onClick:c,className:"mr-2",disabled:b,children:"Cancel"}),(0,t.jsx)(r.Button,{type:"default",htmlType:"submit",loading:b,children:"add"===h?b?"Adding...":"Add Member":b?"Saving...":"Save Changes"})]})]})})}])},434626,e=>{"use strict";var t=e.i(271645);let l=t.forwardRef(function(e,l){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:l},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"}))});e.s(["ExternalLinkIcon",0,l],434626)},902555,e=>{"use strict";var t=e.i(843476),l=e.i(591935),a=e.i(122577),r=e.i(278587),i=e.i(68155),s=e.i(360820),n=e.i(871943),o=e.i(434626),d=e.i(592968),c=e.i(115504),u=e.i(752978);function m({icon:e,onClick:l,className:a,disabled:r,dataTestId:i}){return r?(0,t.jsx)(u.Icon,{icon:e,size:"sm",className:"opacity-50 cursor-not-allowed","data-testid":i}):(0,t.jsx)(u.Icon,{icon:e,size:"sm",onClick:l,className:(0,c.cx)("cursor-pointer",a),"data-testid":i})}let h={Edit:{icon:l.PencilAltIcon,className:"hover:text-blue-600"},Delete:{icon:i.TrashIcon,className:"hover:text-red-600"},Test:{icon:a.PlayIcon,className:"hover:text-blue-600"},Regenerate:{icon:r.RefreshIcon,className:"hover:text-green-600"},Up:{icon:s.ChevronUpIcon,className:"hover:text-blue-600"},Down:{icon:n.ChevronDownIcon,className:"hover:text-blue-600"},Open:{icon:o.ExternalLinkIcon,className:"hover:text-green-600"}};function g({onClick:e,tooltipText:l,disabled:a=!1,disabledTooltipText:r,dataTestId:i,variant:s}){let{icon:n,className:o}=h[s];return(0,t.jsx)(d.Tooltip,{title:a?r:l,children:(0,t.jsx)("span",{children:(0,t.jsx)(m,{icon:n,onClick:e,className:o,disabled:a,dataTestId:i})})})}e.s(["default",()=>g],902555)},122577,e=>{"use strict";var t=e.i(271645);let l=t.forwardRef(function(e,l){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:l},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14.752 11.168l-3.197-2.132A1 1 0 0010 9.87v4.263a1 1 0 001.555.832l3.197-2.132a1 1 0 000-1.664z"}),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}))});e.s(["PlayIcon",0,l],122577)},591935,e=>{"use strict";var t=e.i(271645);let l=t.forwardRef(function(e,l){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:l},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"}))});e.s(["PencilAltIcon",0,l],591935)},871943,e=>{"use strict";var t=e.i(271645);let l=t.forwardRef(function(e,l){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:l},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"}))});e.s(["ChevronDownIcon",0,l],871943)},360820,e=>{"use strict";var t=e.i(271645);let l=t.forwardRef(function(e,l){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:l},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"}))});e.s(["ChevronUpIcon",0,l],360820)},185793,e=>{"use strict";e.i(247167);var t=e.i(271645),l=e.i(343794),a=e.i(242064),r=e.i(529681);let i=e=>{let{prefixCls:a,className:r,style:i,size:s,shape:n}=e,o=(0,l.default)({[`${a}-lg`]:"large"===s,[`${a}-sm`]:"small"===s}),d=(0,l.default)({[`${a}-circle`]:"circle"===n,[`${a}-square`]:"square"===n,[`${a}-round`]:"round"===n}),c=t.useMemo(()=>"number"==typeof s?{width:s,height:s,lineHeight:`${s}px`}:{},[s]);return t.createElement("span",{className:(0,l.default)(a,o,d,r),style:Object.assign(Object.assign({},c),i)})};e.i(296059);var s=e.i(694758),n=e.i(915654),o=e.i(246422),d=e.i(838378);let c=new s.Keyframes("ant-skeleton-loading",{"0%":{backgroundPosition:"100% 50%"},"100%":{backgroundPosition:"0 50%"}}),u=e=>({height:e,lineHeight:(0,n.unit)(e)}),m=e=>Object.assign({width:e},u(e)),h=(e,t)=>Object.assign({width:t(e).mul(5).equal(),minWidth:t(e).mul(5).equal()},u(e)),g=e=>Object.assign({width:e},u(e)),f=(e,t,l)=>{let{skeletonButtonCls:a}=e;return{[`${l}${a}-circle`]:{width:t,minWidth:t,borderRadius:"50%"},[`${l}${a}-round`]:{borderRadius:t}}},p=(e,t)=>Object.assign({width:t(e).mul(2).equal(),minWidth:t(e).mul(2).equal()},u(e)),b=(0,o.genStyleHooks)("Skeleton",e=>{let{componentCls:t,calc:l}=e;return(e=>{let{componentCls:t,skeletonAvatarCls:l,skeletonTitleCls:a,skeletonParagraphCls:r,skeletonButtonCls:i,skeletonInputCls:s,skeletonImageCls:n,controlHeight:o,controlHeightLG:d,controlHeightSM:u,gradientFromColor:b,padding:v,marginSM:x,borderRadius:y,titleHeight:j,blockRadius:w,paragraphLiHeight:k,controlHeightXS:C,paragraphMarginTop:O}=e;return{[t]:{display:"table",width:"100%",[`${t}-header`]:{display:"table-cell",paddingInlineEnd:v,verticalAlign:"top",[l]:Object.assign({display:"inline-block",verticalAlign:"top",background:b},m(o)),[`${l}-circle`]:{borderRadius:"50%"},[`${l}-lg`]:Object.assign({},m(d)),[`${l}-sm`]:Object.assign({},m(u))},[`${t}-content`]:{display:"table-cell",width:"100%",verticalAlign:"top",[a]:{width:"100%",height:j,background:b,borderRadius:w,[`+ ${r}`]:{marginBlockStart:u}},[r]:{padding:0,"> li":{width:"100%",height:k,listStyle:"none",background:b,borderRadius:w,"+ li":{marginBlockStart:C}}},[`${r}> li:last-child:not(:first-child):not(:nth-child(2))`]:{width:"61%"}},[`&-round ${t}-content`]:{[`${a}, ${r} > li`]:{borderRadius:y}}},[`${t}-with-avatar ${t}-content`]:{[a]:{marginBlockStart:x,[`+ ${r}`]:{marginBlockStart:O}}},[`${t}${t}-element`]:Object.assign(Object.assign(Object.assign(Object.assign({display:"inline-block",width:"auto"},(e=>{let{borderRadiusSM:t,skeletonButtonCls:l,controlHeight:a,controlHeightLG:r,controlHeightSM:i,gradientFromColor:s,calc:n}=e;return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({[l]:Object.assign({display:"inline-block",verticalAlign:"top",background:s,borderRadius:t,width:n(a).mul(2).equal(),minWidth:n(a).mul(2).equal()},p(a,n))},f(e,a,l)),{[`${l}-lg`]:Object.assign({},p(r,n))}),f(e,r,`${l}-lg`)),{[`${l}-sm`]:Object.assign({},p(i,n))}),f(e,i,`${l}-sm`))})(e)),(e=>{let{skeletonAvatarCls:t,gradientFromColor:l,controlHeight:a,controlHeightLG:r,controlHeightSM:i}=e;return{[t]:Object.assign({display:"inline-block",verticalAlign:"top",background:l},m(a)),[`${t}${t}-circle`]:{borderRadius:"50%"},[`${t}${t}-lg`]:Object.assign({},m(r)),[`${t}${t}-sm`]:Object.assign({},m(i))}})(e)),(e=>{let{controlHeight:t,borderRadiusSM:l,skeletonInputCls:a,controlHeightLG:r,controlHeightSM:i,gradientFromColor:s,calc:n}=e;return{[a]:Object.assign({display:"inline-block",verticalAlign:"top",background:s,borderRadius:l},h(t,n)),[`${a}-lg`]:Object.assign({},h(r,n)),[`${a}-sm`]:Object.assign({},h(i,n))}})(e)),(e=>{let{skeletonImageCls:t,imageSizeBase:l,gradientFromColor:a,borderRadiusSM:r,calc:i}=e;return{[t]:Object.assign(Object.assign({display:"inline-flex",alignItems:"center",justifyContent:"center",verticalAlign:"middle",background:a,borderRadius:r},g(i(l).mul(2).equal())),{[`${t}-path`]:{fill:"#bfbfbf"},[`${t}-svg`]:Object.assign(Object.assign({},g(l)),{maxWidth:i(l).mul(4).equal(),maxHeight:i(l).mul(4).equal()}),[`${t}-svg${t}-svg-circle`]:{borderRadius:"50%"}}),[`${t}${t}-circle`]:{borderRadius:"50%"}}})(e)),[`${t}${t}-block`]:{width:"100%",[i]:{width:"100%"},[s]:{width:"100%"}},[`${t}${t}-active`]:{[` - ${a}, - ${r} > li, +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,162386,e=>{"use strict";var t=e.i(843476),a=e.i(625901),l=e.i(109799),r=e.i(785242),i=e.i(738014),s=e.i(199133),n=e.i(981339),o=e.i(592968);let d={label:"All Proxy Models",value:"all-proxy-models"},c={label:"No Default Models",value:"no-default-models"},u=[d,c],m={user:({allProxyModels:e,userModels:t,options:a})=>t&&a?.includeUserModels?t:[],team:({allProxyModels:e,selectedOrganization:t,userModels:a})=>t?t.models.includes(d.value)||0===t.models.length?e:e.filter(e=>t.models.includes(e)):e??[],organization:({allProxyModels:e})=>e,global:({allProxyModels:e})=>e};e.s(["ModelSelect",0,e=>{let{teamID:h,organizationID:g,options:f,context:p,dataTestId:b,value:v=[],onChange:x,style:y}=e,{includeUserModels:j,showAllTeamModelsOption:w,showAllProxyModelsOverride:k,includeSpecialOptions:C}=f||{},{data:O,isLoading:$}=(0,a.useAllProxyModels)(),{data:N,isLoading:E}=(0,r.useTeam)(h),{data:T,isLoading:_}=(0,l.useOrganization)(g),{data:M,isLoading:I}=(0,i.useCurrentUser)(),R=e=>u.some(t=>t.value===e),S=v.some(R),P=T?.models.includes(d.value)||T?.models.length===0;if($||E||_||I)return(0,t.jsx)(n.Skeleton.Input,{active:!0,block:!0});let{wildcard:q,regular:A}=(e=>{let t=[],a=[];for(let l of e)l.endsWith("/*")?t.push(l):a.push(l);return{wildcard:t,regular:a}})(((e,t,a)=>{let l=Array.from(new Map(e.map(e=>[e.id,e])).values()).map(e=>e.id);if(t.options?.showAllProxyModelsOverride)return l;let r=m[t.context];return r?r({allProxyModels:l,...a,options:t.options}):[]})(O?.data??[],e,{selectedTeam:N,selectedOrganization:T,userModels:M?.models}));return(0,t.jsx)(s.Select,{"data-testid":b,value:v,onChange:e=>{let t=e.filter(R);x(t.length>0?[t[t.length-1]]:e)},style:y,options:[C?{label:(0,t.jsx)("span",{children:"Special Options"}),title:"Special Options",options:[...k||P&&C||"global"===p?[{label:(0,t.jsx)("span",{children:"All Proxy Models"}),value:d.value,disabled:v.length>0&&v.some(e=>R(e)&&e!==d.value),key:d.value}]:[],{label:(0,t.jsx)("span",{children:"No Default Models"}),value:c.value,disabled:v.length>0&&v.some(e=>R(e)&&e!==c.value),key:c.value}]}:[],...q.length>0?[{label:(0,t.jsx)("span",{children:"Wildcard Options"}),title:"Wildcard Options",options:q.map(e=>{let a=e.replace("/*",""),l=a.charAt(0).toUpperCase()+a.slice(1);return{label:(0,t.jsx)("span",{children:`All ${l} models`}),value:e,disabled:S}})}]:[],{label:(0,t.jsx)("span",{children:"Models"}),title:"Models",options:A.map(e=>({label:(0,t.jsx)("span",{children:e}),value:e,disabled:S}))}],mode:"multiple",placeholder:"Select Models",allowClear:!0,maxTagCount:"responsive",maxTagPlaceholder:e=>(0,t.jsx)(o.Tooltip,{styles:{root:{pointerEvents:"none"}},title:e.map(({value:e})=>e).join(", "),children:(0,t.jsxs)("span",{children:["+",e.length," more"]})})})}],162386)},294612,e=>{"use strict";var t=e.i(843476),a=e.i(100486),l=e.i(827252),r=e.i(213205),i=e.i(771674),s=e.i(464571),n=e.i(770914),o=e.i(291542),d=e.i(262218),c=e.i(592968),u=e.i(898586),m=e.i(902555);let{Text:h}=u.Typography;function g({members:e,canEdit:u,onEdit:g,onDelete:f,onAddMember:p,roleColumnTitle:b="Role",roleTooltip:v,extraColumns:x=[],showDeleteForMember:y,emptyText:j}){let w=[{title:"User Email",dataIndex:"user_email",key:"user_email",render:e=>(0,t.jsx)(h,{children:e||"-"})},{title:"User ID",dataIndex:"user_id",key:"user_id",render:e=>"default_user_id"===e?(0,t.jsx)(d.Tag,{color:"blue",children:"Default Proxy Admin"}):(0,t.jsx)(h,{children:e||"-"})},{title:v?(0,t.jsxs)(n.Space,{direction:"horizontal",children:[b,(0,t.jsx)(c.Tooltip,{title:v,children:(0,t.jsx)(l.InfoCircleOutlined,{})})]}):b,dataIndex:"role",key:"role",render:e=>(0,t.jsxs)(n.Space,{children:[e?.toLowerCase()==="admin"||e?.toLowerCase()==="org_admin"?(0,t.jsx)(a.CrownOutlined,{}):(0,t.jsx)(i.UserOutlined,{}),(0,t.jsx)(h,{style:{textTransform:"capitalize"},children:e||"-"})]})},...x,{title:"Actions",key:"actions",fixed:"right",width:120,render:(e,a)=>u?(0,t.jsxs)(n.Space,{children:[(0,t.jsx)(m.default,{variant:"Edit",tooltipText:"Edit member",dataTestId:"edit-member",onClick:()=>g(a)}),(!y||y(a))&&(0,t.jsx)(m.default,{variant:"Delete",tooltipText:"Delete member",dataTestId:"delete-member",onClick:()=>f(a)})]}):null}];return(0,t.jsxs)(n.Space,{direction:"vertical",style:{width:"100%"},children:[(0,t.jsxs)("span",{className:"inline-flex text-sm text-gray-700",children:[e.length," Member",1!==e.length?"s":""]}),(0,t.jsx)(o.Table,{columns:w,dataSource:e,rowKey:e=>e.user_id??e.user_email??JSON.stringify(e),pagination:!1,size:"small",scroll:{x:"max-content"},locale:j?{emptyText:j}:void 0}),p&&u&&(0,t.jsx)(s.Button,{icon:(0,t.jsx)(r.UserAddOutlined,{}),type:"primary",onClick:p,children:"Add Member"})]})}e.s(["default",()=>g])},907308,e=>{"use strict";var t=e.i(843476),a=e.i(271645),l=e.i(212931),r=e.i(808613),i=e.i(464571),s=e.i(199133),n=e.i(592968),o=e.i(213205),d=e.i(374009),c=e.i(764205);e.s(["default",0,({isVisible:e,onCancel:u,onSubmit:m,accessToken:h,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:p="user",teamId:b})=>{let[v]=r.Form.useForm(),[x,y]=(0,a.useState)([]),[j,w]=(0,a.useState)(!1),[k,C]=(0,a.useState)("user_email"),[O,$]=(0,a.useState)(!1),N=async(e,t)=>{if(!e)return void y([]);w(!0);try{let a=new URLSearchParams;if(a.append(t,e),b&&a.append("team_id",b),null==h)return;let l=(await (0,c.userFilterUICall)(h,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}));y(l)}catch(e){console.error("Error fetching users:",e)}finally{w(!1)}},E=(0,a.useCallback)((0,d.default)((e,t)=>N(e,t),300),[]),T=(e,t)=>{C(t),E(e,t)},_=(e,t)=>{let a=t.user;v.setFieldsValue({user_email:a.user_email,user_id:a.user_id,role:v.getFieldValue("role")})},M=async e=>{$(!0);try{await m(e)}finally{$(!1)}};return(0,t.jsx)(l.Modal,{title:g,open:e,onCancel:()=>{v.resetFields(),y([]),u()},footer:null,width:800,maskClosable:!O,children:(0,t.jsxs)(r.Form,{form:v,onFinish:M,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",initialValues:{role:p},children:[(0,t.jsx)(r.Form.Item,{label:"Email",name:"user_email",className:"mb-4",children:(0,t.jsx)(s.Select,{showSearch:!0,className:"w-full",placeholder:"Search by email",filterOption:!1,onSearch:e=>T(e,"user_email"),onSelect:(e,t)=>_(e,t),options:"user_email"===k?x:[],loading:j,allowClear:!0})}),(0,t.jsx)("div",{className:"text-center mb-4",children:"OR"}),(0,t.jsx)(r.Form.Item,{label:"User ID",name:"user_id",className:"mb-4",children:(0,t.jsx)(s.Select,{showSearch:!0,className:"w-full",placeholder:"Search by user ID",filterOption:!1,onSearch:e=>T(e,"user_id"),onSelect:(e,t)=>_(e,t),options:"user_id"===k?x:[],loading:j,allowClear:!0})}),(0,t.jsx)(r.Form.Item,{label:"Member Role",name:"role",className:"mb-4",children:(0,t.jsx)(s.Select,{defaultValue:p,children:f.map(e=>(0,t.jsx)(s.Select.Option,{value:e.value,children:(0,t.jsxs)(n.Tooltip,{title:e.description,children:[(0,t.jsx)("span",{className:"font-medium",children:e.label}),(0,t.jsxs)("span",{className:"ml-2 text-gray-500 text-sm",children:["- ",e.description]})]})},e.value))})}),(0,t.jsx)("div",{className:"text-right mt-4",children:(0,t.jsx)(i.Button,{type:"primary",htmlType:"submit",icon:(0,t.jsx)(o.UserAddOutlined,{}),loading:O,children:O?"Adding...":"Add Member"})})]})})}])},276173,e=>{"use strict";var t=e.i(843476),a=e.i(599724),l=e.i(779241),r=e.i(464571),i=e.i(808613),s=e.i(212931),n=e.i(199133),o=e.i(271645),d=e.i(435451);e.s(["default",0,({visible:e,onCancel:c,onSubmit:u,initialData:m,mode:h,config:g})=>{let f,[p]=i.Form.useForm(),[b,v]=(0,o.useState)(!1);console.log("Initial Data:",m),(0,o.useEffect)(()=>{if(e)if("edit"===h&&m){let e={...m,role:m.role||g.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:g.defaultRole||g.roleOptions[0]?.value})},[e,m,h,p,g.defaultRole,g.roleOptions]);let x=async e=>{try{v(!0);let t=Object.entries(e).reduce((e,[t,a])=>{if("string"==typeof a){let l=a.trim();return""===l&&("max_budget_in_team"===t||"tpm_limit"===t||"rpm_limit"===t)?{...e,[t]:null}:{...e,[t]:l}}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)(s.Modal,{title:g.title||("add"===h?"Add Member":"Edit Member"),open:e,width:1e3,footer:null,onCancel:c,children:(0,t.jsxs)(i.Form,{form:p,onFinish:x,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[g.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)(l.TextInput,{placeholder:"user@example.com"})}),g.showEmail&&g.showUserId&&(0,t.jsx)("div",{className:"text-center mb-4",children:(0,t.jsx)(a.Text,{children:"OR"})}),g.showUserId&&(0,t.jsx)(i.Form.Item,{label:"User ID",name:"user_id",className:"mb-4",children:(0,t.jsx)(l.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"===h&&m&&(0,t.jsxs)("span",{className:"text-gray-500 text-sm",children:["(Current: ",(f=m.role,g.roleOptions.find(e=>e.value===f)?.label||f),")"]})]}),name:"role",className:"mb-4",rules:[{required:!0,message:"Please select a role!"}],children:(0,t.jsx)(n.Select,{children:"edit"===h&&m?[...g.roleOptions.filter(e=>e.value===m.role),...g.roleOptions.filter(e=>e.value!==m.role)].map(e=>(0,t.jsx)(n.Select.Option,{value:e.value,children:e.label},e.value)):g.roleOptions.map(e=>(0,t.jsx)(n.Select.Option,{value:e.value,children:e.label},e.value))})}),g.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)(l.TextInput,{placeholder:e.placeholder});case"numerical":return(0,t.jsx)(d.default,{step:e.step||1,min:e.min||0,style:{width:"100%"},placeholder:e.placeholder||"Enter a numerical value"});case"select":return(0,t.jsx)(n.Select,{children:e.options?.map(e=>(0,t.jsx)(n.Select.Option,{value:e.value,children:e.label},e.value))});default:return null}})(e)},e.name)),(0,t.jsxs)("div",{className:"text-right mt-6",children:[(0,t.jsx)(r.Button,{onClick:c,className:"mr-2",disabled:b,children:"Cancel"}),(0,t.jsx)(r.Button,{type:"default",htmlType:"submit",loading:b,children:"add"===h?b?"Adding...":"Add Member":b?"Saving...":"Save Changes"})]})]})})}])},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),l=e.i(122577),r=e.i(278587),i=e.i(68155),s=e.i(360820),n=e.i(871943),o=e.i(434626),d=e.i(592968),c=e.i(115504),u=e.i(752978);function m({icon:e,onClick:a,className:l,disabled:r,dataTestId:i}){return r?(0,t.jsx)(u.Icon,{icon:e,size:"sm",className:"opacity-50 cursor-not-allowed","data-testid":i}):(0,t.jsx)(u.Icon,{icon:e,size:"sm",onClick:a,className:(0,c.cx)("cursor-pointer",l),"data-testid":i})}let h={Edit:{icon:a.PencilAltIcon,className:"hover:text-blue-600"},Delete:{icon:i.TrashIcon,className:"hover:text-red-600"},Test:{icon:l.PlayIcon,className:"hover:text-blue-600"},Regenerate:{icon:r.RefreshIcon,className:"hover:text-green-600"},Up:{icon:s.ChevronUpIcon,className:"hover:text-blue-600"},Down:{icon:n.ChevronDownIcon,className:"hover:text-blue-600"},Open:{icon:o.ExternalLinkIcon,className:"hover:text-green-600"}};function g({onClick:e,tooltipText:a,disabled:l=!1,disabledTooltipText:r,dataTestId:i,variant:s}){let{icon:n,className:o}=h[s];return(0,t.jsx)(d.Tooltip,{title:l?r:a,children:(0,t.jsx)("span",{children:(0,t.jsx)(m,{icon:n,onClick:e,className:o,disabled:l,dataTestId:i})})})}e.s(["default",()=>g],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)},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)},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)},185793,e=>{"use strict";e.i(247167);var t=e.i(271645),a=e.i(343794),l=e.i(242064),r=e.i(529681);let i=e=>{let{prefixCls:l,className:r,style:i,size:s,shape:n}=e,o=(0,a.default)({[`${l}-lg`]:"large"===s,[`${l}-sm`]:"small"===s}),d=(0,a.default)({[`${l}-circle`]:"circle"===n,[`${l}-square`]:"square"===n,[`${l}-round`]:"round"===n}),c=t.useMemo(()=>"number"==typeof s?{width:s,height:s,lineHeight:`${s}px`}:{},[s]);return t.createElement("span",{className:(0,a.default)(l,o,d,r),style:Object.assign(Object.assign({},c),i)})};e.i(296059);var s=e.i(694758),n=e.i(915654),o=e.i(246422),d=e.i(838378);let c=new s.Keyframes("ant-skeleton-loading",{"0%":{backgroundPosition:"100% 50%"},"100%":{backgroundPosition:"0 50%"}}),u=e=>({height:e,lineHeight:(0,n.unit)(e)}),m=e=>Object.assign({width:e},u(e)),h=(e,t)=>Object.assign({width:t(e).mul(5).equal(),minWidth:t(e).mul(5).equal()},u(e)),g=e=>Object.assign({width:e},u(e)),f=(e,t,a)=>{let{skeletonButtonCls:l}=e;return{[`${a}${l}-circle`]:{width:t,minWidth:t,borderRadius:"50%"},[`${a}${l}-round`]:{borderRadius:t}}},p=(e,t)=>Object.assign({width:t(e).mul(2).equal(),minWidth:t(e).mul(2).equal()},u(e)),b=(0,o.genStyleHooks)("Skeleton",e=>{let{componentCls:t,calc:a}=e;return(e=>{let{componentCls:t,skeletonAvatarCls:a,skeletonTitleCls:l,skeletonParagraphCls:r,skeletonButtonCls:i,skeletonInputCls:s,skeletonImageCls:n,controlHeight:o,controlHeightLG:d,controlHeightSM:u,gradientFromColor:b,padding:v,marginSM:x,borderRadius:y,titleHeight:j,blockRadius:w,paragraphLiHeight:k,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:b},m(o)),[`${a}-circle`]:{borderRadius:"50%"},[`${a}-lg`]:Object.assign({},m(d)),[`${a}-sm`]:Object.assign({},m(u))},[`${t}-content`]:{display:"table-cell",width:"100%",verticalAlign:"top",[l]:{width:"100%",height:j,background:b,borderRadius:w,[`+ ${r}`]:{marginBlockStart:u}},[r]:{padding:0,"> li":{width:"100%",height:k,listStyle:"none",background:b,borderRadius:w,"+ li":{marginBlockStart:C}}},[`${r}> li:last-child:not(:first-child):not(:nth-child(2))`]:{width:"61%"}},[`&-round ${t}-content`]:{[`${l}, ${r} > li`]:{borderRadius:y}}},[`${t}-with-avatar ${t}-content`]:{[l]:{marginBlockStart:x,[`+ ${r}`]:{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:l,controlHeightLG:r,controlHeightSM:i,gradientFromColor:s,calc:n}=e;return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({[a]:Object.assign({display:"inline-block",verticalAlign:"top",background:s,borderRadius:t,width:n(l).mul(2).equal(),minWidth:n(l).mul(2).equal()},p(l,n))},f(e,l,a)),{[`${a}-lg`]:Object.assign({},p(r,n))}),f(e,r,`${a}-lg`)),{[`${a}-sm`]:Object.assign({},p(i,n))}),f(e,i,`${a}-sm`))})(e)),(e=>{let{skeletonAvatarCls:t,gradientFromColor:a,controlHeight:l,controlHeightLG:r,controlHeightSM:i}=e;return{[t]:Object.assign({display:"inline-block",verticalAlign:"top",background:a},m(l)),[`${t}${t}-circle`]:{borderRadius:"50%"},[`${t}${t}-lg`]:Object.assign({},m(r)),[`${t}${t}-sm`]:Object.assign({},m(i))}})(e)),(e=>{let{controlHeight:t,borderRadiusSM:a,skeletonInputCls:l,controlHeightLG:r,controlHeightSM:i,gradientFromColor:s,calc:n}=e;return{[l]:Object.assign({display:"inline-block",verticalAlign:"top",background:s,borderRadius:a},h(t,n)),[`${l}-lg`]:Object.assign({},h(r,n)),[`${l}-sm`]:Object.assign({},h(i,n))}})(e)),(e=>{let{skeletonImageCls:t,imageSizeBase:a,gradientFromColor:l,borderRadiusSM:r,calc:i}=e;return{[t]:Object.assign(Object.assign({display:"inline-flex",alignItems:"center",justifyContent:"center",verticalAlign:"middle",background:l,borderRadius:r},g(i(a).mul(2).equal())),{[`${t}-path`]:{fill:"#bfbfbf"},[`${t}-svg`]:Object.assign(Object.assign({},g(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%"},[s]:{width:"100%"}},[`${t}${t}-active`]:{[` ${l}, + ${r} > li, + ${a}, ${i}, ${s}, ${n} - `]:Object.assign({},{background:e.skeletonLoadingBackground,backgroundSize:"400% 100%",animationName:c,animationDuration:e.skeletonLoadingMotionDuration,animationTimingFunction:"ease",animationIterationCount:"infinite"})}}})((0,d.mergeToken)(e,{skeletonAvatarCls:`${t}-avatar`,skeletonTitleCls:`${t}-title`,skeletonParagraphCls:`${t}-paragraph`,skeletonButtonCls:`${t}-button`,skeletonInputCls:`${t}-input`,skeletonImageCls:`${t}-image`,imageSizeBase:l(e.controlHeight).mul(1.5).equal(),borderRadius:100,skeletonLoadingBackground:`linear-gradient(90deg, ${e.gradientFromColor} 25%, ${e.gradientToColor} 37%, ${e.gradientFromColor} 63%)`,skeletonLoadingMotionDuration:"1.4s"}))},e=>{let{colorFillContent:t,colorFill:l}=e;return{color:t,colorGradientEnd:l,gradientFromColor:t,gradientToColor:l,titleHeight:e.controlHeight/2,blockRadius:e.borderRadiusSM,paragraphMarginTop:e.marginLG+e.marginXXS,paragraphLiHeight:e.controlHeight/2}},{deprecatedTokens:[["color","gradientFromColor"],["colorGradientEnd","gradientToColor"]]}),v=e=>{let{prefixCls:a,className:r,style:i,rows:s=0}=e,n=Array.from({length:s}).map((l,a)=>t.createElement("li",{key:a,style:{width:((e,t)=>{let{width:l,rows:a=2}=t;return Array.isArray(l)?l[e]:a-1===e?l:void 0})(a,e)}}));return t.createElement("ul",{className:(0,l.default)(a,r),style:i},n)},x=({prefixCls:e,className:a,width:r,style:i})=>t.createElement("h3",{className:(0,l.default)(e,a),style:Object.assign({width:r},i)});function y(e){return e&&"object"==typeof e?e:{}}let j=e=>{let{prefixCls:r,loading:s,className:n,rootClassName:o,style:d,children:c,avatar:u=!1,title:m=!0,paragraph:h=!0,active:g,round:f}=e,{getPrefixCls:p,direction:j,className:w,style:k}=(0,a.useComponentConfig)("skeleton"),C=p("skeleton",r),[O,$,N]=b(C);if(s||!("loading"in e)){let e,a,r=!!u,s=!!m,c=!!h;if(r){let l=Object.assign(Object.assign({prefixCls:`${C}-avatar`},s&&!c?{size:"large",shape:"square"}:{size:"large",shape:"circle"}),y(u));e=t.createElement("div",{className:`${C}-header`},t.createElement(i,Object.assign({},l)))}if(s||c){let e,l;if(s){let l=Object.assign(Object.assign({prefixCls:`${C}-title`},!r&&c?{width:"38%"}:r&&c?{width:"50%"}:{}),y(m));e=t.createElement(x,Object.assign({},l))}if(c){let e,a=Object.assign(Object.assign({prefixCls:`${C}-paragraph`},(e={},r&&s||(e.width="61%"),!r&&s?e.rows=3:e.rows=2,e)),y(h));l=t.createElement(v,Object.assign({},a))}a=t.createElement("div",{className:`${C}-content`},e,l)}let p=(0,l.default)(C,{[`${C}-with-avatar`]:r,[`${C}-active`]:g,[`${C}-rtl`]:"rtl"===j,[`${C}-round`]:f},w,n,o,$,N);return O(t.createElement("div",{className:p,style:Object.assign(Object.assign({},k),d)},e,a))}return null!=c?c:null};j.Button=e=>{let{prefixCls:s,className:n,rootClassName:o,active:d,block:c=!1,size:u="default"}=e,{getPrefixCls:m}=t.useContext(a.ConfigContext),h=m("skeleton",s),[g,f,p]=b(h),v=(0,r.default)(e,["prefixCls"]),x=(0,l.default)(h,`${h}-element`,{[`${h}-active`]:d,[`${h}-block`]:c},n,o,f,p);return g(t.createElement("div",{className:x},t.createElement(i,Object.assign({prefixCls:`${h}-button`,size:u},v))))},j.Avatar=e=>{let{prefixCls:s,className:n,rootClassName:o,active:d,shape:c="circle",size:u="default"}=e,{getPrefixCls:m}=t.useContext(a.ConfigContext),h=m("skeleton",s),[g,f,p]=b(h),v=(0,r.default)(e,["prefixCls","className"]),x=(0,l.default)(h,`${h}-element`,{[`${h}-active`]:d},n,o,f,p);return g(t.createElement("div",{className:x},t.createElement(i,Object.assign({prefixCls:`${h}-avatar`,shape:c,size:u},v))))},j.Input=e=>{let{prefixCls:s,className:n,rootClassName:o,active:d,block:c,size:u="default"}=e,{getPrefixCls:m}=t.useContext(a.ConfigContext),h=m("skeleton",s),[g,f,p]=b(h),v=(0,r.default)(e,["prefixCls"]),x=(0,l.default)(h,`${h}-element`,{[`${h}-active`]:d,[`${h}-block`]:c},n,o,f,p);return g(t.createElement("div",{className:x},t.createElement(i,Object.assign({prefixCls:`${h}-input`,size:u},v))))},j.Image=e=>{let{prefixCls:r,className:i,rootClassName:s,style:n,active:o}=e,{getPrefixCls:d}=t.useContext(a.ConfigContext),c=d("skeleton",r),[u,m,h]=b(c),g=(0,l.default)(c,`${c}-element`,{[`${c}-active`]:o},i,s,m,h);return u(t.createElement("div",{className:g},t.createElement("div",{className:(0,l.default)(`${c}-image`,i),style:n},t.createElement("svg",{viewBox:"0 0 1098 1024",xmlns:"http://www.w3.org/2000/svg",className:`${c}-image-svg`},t.createElement("title",null,"Image placeholder"),t.createElement("path",{d:"M365.714286 329.142857q0 45.714286-32.036571 77.677714t-77.677714 32.036571-77.677714-32.036571-32.036571-77.677714 32.036571-77.677714 77.677714-32.036571 77.677714 32.036571 32.036571 77.677714zM950.857143 548.571429l0 256-804.571429 0 0-109.714286 182.857143-182.857143 91.428571 91.428571 292.571429-292.571429zM1005.714286 146.285714l-914.285714 0q-7.460571 0-12.873143 5.412571t-5.412571 12.873143l0 694.857143q0 7.460571 5.412571 12.873143t12.873143 5.412571l914.285714 0q7.460571 0 12.873143-5.412571t5.412571-12.873143l0-694.857143q0-7.460571-5.412571-12.873143t-12.873143-5.412571zM1097.142857 164.571429l0 694.857143q0 37.741714-26.843429 64.585143t-64.585143 26.843429l-914.285714 0q-37.741714 0-64.585143-26.843429t-26.843429-64.585143l0-694.857143q0-37.741714 26.843429-64.585143t64.585143-26.843429l914.285714 0q37.741714 0 64.585143 26.843429t26.843429 64.585143z",className:`${c}-image-path`})))))},j.Node=e=>{let{prefixCls:r,className:i,rootClassName:s,style:n,active:o,children:d}=e,{getPrefixCls:c}=t.useContext(a.ConfigContext),u=c("skeleton",r),[m,h,g]=b(u),f=(0,l.default)(u,`${u}-element`,{[`${u}-active`]:o},h,i,s,g);return m(t.createElement("div",{className:f},t.createElement("div",{className:(0,l.default)(`${u}-image`,i),style:n},d)))},e.s(["default",0,j],185793)},959013,e=>{"use strict";e.i(247167);var t=e.i(931067),l=e.i(271645);let a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"}},{tag:"path",attrs:{d:"M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z"}}]},name:"plus",theme:"outlined"};var r=e.i(9583),i=l.forwardRef(function(e,i){return l.createElement(r.default,(0,t.default)({},e,{ref:i,icon:a}))});e.s(["default",0,i],959013)},269200,e=>{"use strict";var t=e.i(290571),l=e.i(271645),a=e.i(444755);let r=(0,e.i(673706).makeClassName)("Table"),i=l.default.forwardRef((e,i)=>{let{children:s,className:n}=e,o=(0,t.__rest)(e,["children","className"]);return l.default.createElement("div",{className:(0,a.tremorTwMerge)(r("root"),"overflow-auto",n)},l.default.createElement("table",Object.assign({ref:i,className:(0,a.tremorTwMerge)(r("table"),"w-full text-tremor-default","text-tremor-content","dark:text-dark-tremor-content")},o),s))});i.displayName="Table",e.s(["Table",()=>i],269200)},942232,e=>{"use strict";var t=e.i(290571),l=e.i(271645),a=e.i(444755);let r=(0,e.i(673706).makeClassName)("TableBody"),i=l.default.forwardRef((e,i)=>{let{children:s,className:n}=e,o=(0,t.__rest)(e,["children","className"]);return l.default.createElement(l.default.Fragment,null,l.default.createElement("tbody",Object.assign({ref:i,className:(0,a.tremorTwMerge)(r("root"),"align-top divide-y","divide-tremor-border","dark:divide-dark-tremor-border",n)},o),s))});i.displayName="TableBody",e.s(["TableBody",()=>i],942232)},977572,e=>{"use strict";var t=e.i(290571),l=e.i(271645),a=e.i(444755);let r=(0,e.i(673706).makeClassName)("TableCell"),i=l.default.forwardRef((e,i)=>{let{children:s,className:n}=e,o=(0,t.__rest)(e,["children","className"]);return l.default.createElement(l.default.Fragment,null,l.default.createElement("td",Object.assign({ref:i,className:(0,a.tremorTwMerge)(r("root"),"align-middle whitespace-nowrap text-left p-4",n)},o),s))});i.displayName="TableCell",e.s(["TableCell",()=>i],977572)},427612,e=>{"use strict";var t=e.i(290571),l=e.i(271645),a=e.i(444755);let r=(0,e.i(673706).makeClassName)("TableHead"),i=l.default.forwardRef((e,i)=>{let{children:s,className:n}=e,o=(0,t.__rest)(e,["children","className"]);return l.default.createElement(l.default.Fragment,null,l.default.createElement("thead",Object.assign({ref:i,className:(0,a.tremorTwMerge)(r("root"),"text-left","text-tremor-content","dark:text-dark-tremor-content",n)},o),s))});i.displayName="TableHead",e.s(["TableHead",()=>i],427612)},64848,e=>{"use strict";var t=e.i(290571),l=e.i(271645),a=e.i(444755);let r=(0,e.i(673706).makeClassName)("TableHeaderCell"),i=l.default.forwardRef((e,i)=>{let{children:s,className:n}=e,o=(0,t.__rest)(e,["children","className"]);return l.default.createElement(l.default.Fragment,null,l.default.createElement("th",Object.assign({ref:i,className:(0,a.tremorTwMerge)(r("root"),"whitespace-nowrap text-left font-semibold top-0 px-4 py-3.5","text-tremor-content-strong","dark:text-dark-tremor-content-strong",n)},o),s))});i.displayName="TableHeaderCell",e.s(["TableHeaderCell",()=>i],64848)},496020,e=>{"use strict";var t=e.i(290571),l=e.i(271645),a=e.i(444755);let r=(0,e.i(673706).makeClassName)("TableRow"),i=l.default.forwardRef((e,i)=>{let{children:s,className:n}=e,o=(0,t.__rest)(e,["children","className"]);return l.default.createElement(l.default.Fragment,null,l.default.createElement("tr",Object.assign({ref:i,className:(0,a.tremorTwMerge)(r("row"),n)},o),s))});i.displayName="TableRow",e.s(["TableRow",()=>i],496020)},68155,e=>{"use strict";var t=e.i(271645);let l=t.forwardRef(function(e,l){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:l},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"}))});e.s(["TrashIcon",0,l],68155)},278587,e=>{"use strict";var t=e.i(271645);let l=t.forwardRef(function(e,l){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:l},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"}))});e.s(["RefreshIcon",0,l],278587)},207670,e=>{"use strict";function t(){for(var e,t,l=0,a="",r=arguments.length;lt,"default",0,t])},625901,e=>{"use strict";var t=e.i(266027),l=e.i(621482),a=e.i(243652),r=e.i(764205),i=e.i(135214);let s=(0,a.createQueryKeys)("models"),n=(0,a.createQueryKeys)("modelHub"),o=(0,a.createQueryKeys)("allProxyModels");(0,a.createQueryKeys)("selectedTeamModels");let d=(0,a.createQueryKeys)("infiniteModels");e.s(["useAllProxyModels",0,()=>{let{accessToken:e,userId:l,userRole:a}=(0,i.default)();return(0,t.useQuery)({queryKey:o.list({}),queryFn:async()=>await (0,r.modelAvailableCall)(e,l,a,!0,null,!0,!1,"expand"),enabled:!!(e&&l&&a)})},"useInfiniteModelInfo",0,(e=50,t)=>{let{accessToken:a,userId:s,userRole:n}=(0,i.default)();return(0,l.useInfiniteQuery)({queryKey:d.list({filters:{...s&&{userId:s},...n&&{userRole:n},size:e,...t&&{search:t}}}),queryFn:async({pageParam:l})=>await (0,r.modelInfoCall)(a,s,n,l,e,t),initialPageParam:1,getNextPageParam:e=>{if(e.current_page{let{accessToken:e}=(0,i.default)();return(0,t.useQuery)({queryKey:n.list({}),queryFn:async()=>await (0,r.modelHubCall)(e),enabled:!!e})},"useModelsInfo",0,(e=1,l=50,a,n,o,d,c)=>{let{accessToken:u,userId:m,userRole:h}=(0,i.default)();return(0,t.useQuery)({queryKey:s.list({filters:{...m&&{userId:m},...h&&{userRole:h},page:e,size:l,...a&&{search:a},...n&&{modelId:n},...o&&{teamId:o},...d&&{sortBy:d},...c&&{sortOrder:c}}}),queryFn:async()=>await (0,r.modelInfoCall)(u,m,h,e,l,a,n,o,d,c),enabled:!!(u&&m&&h)})}])},621482,e=>{"use strict";var t=e.i(869230),l=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,l.infiniteQueryBehavior)()})}getOptimisticResult(e){return e.behavior=(0,l.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,r=super.createResult(e,t),{isFetching:i,isRefetching:s,isError:n,isRefetchError:o}=r,d=a.fetchMeta?.fetchMore?.direction,c=n&&"forward"===d,u=i&&"forward"===d,m=n&&"backward"===d,h=i&&"backward"===d;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:(0,l.hasNextPage)(t,a.data),hasPreviousPage:(0,l.hasPreviousPage)(t,a.data),isFetchNextPageError:c,isFetchingNextPage:u,isFetchPreviousPageError:m,isFetchingPreviousPage:h,isRefetchError:o&&!c&&!m,isRefetching:s&&!u&&!h}}},r=e.i(469637);function i(e,t){return(0,r.useBaseQuery)(e,a,t)}e.s(["useInfiniteQuery",()=>i],621482)},785242,e=>{"use strict";var t=e.i(619273),l=e.i(266027),a=e.i(912598),r=e.i(135214),i=e.i(270345),s=e.i(243652),n=e.i(764205);let o=(0,s.createQueryKeys)("teams"),d=async(e,t,l,a={})=>{try{let r=(0,n.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:l,sort_by:a.sortBy,sort_order:a.sortOrder,status:"deleted"}).filter(([,e])=>null!=e).map(([e,t])=>[e,String(t)])),s=`${r?`${r}/v2/team/list`:"/v2/team/list"}?${i}`,o=await fetch(s,{method:"GET",headers:{[(0,n.getGlobalLitellmHeaderName)()]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!o.ok){let e=await o.json(),t=(0,n.deriveErrorMessage)(e);throw(0,n.handleError)(t),Error(t)}let d=await o.json();if(console.log("/team/list?status=deleted API Response:",d),d&&"object"==typeof d&&"teams"in d)return d.teams;return d}catch(e){throw console.error("Failed to list deleted teams:",e),e}},c=(0,s.createQueryKeys)("deletedTeams");e.s(["useDeletedTeams",0,(e,a,i={})=>{let{accessToken:s}=(0,r.default)();return(0,l.useQuery)({queryKey:c.list({page:e,limit:a,...i}),queryFn:async()=>await d(s,e,a,i),enabled:!!s,staleTime:3e4,placeholderData:t.keepPreviousData})},"useTeam",0,e=>{let{accessToken:t}=(0,r.default)(),i=(0,a.useQueryClient)();return(0,l.useQuery)({queryKey:o.detail(e),enabled:!!(t&&e),queryFn:async()=>{if(!t||!e)throw Error("Missing auth or teamId");return(0,n.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:a}=(0,r.default)();return(0,l.useQuery)({queryKey:o.list({}),queryFn:async()=>await (0,i.fetchTeams)(e,t,a,null),enabled:!!e})}])},738014,e=>{"use strict";var t=e.i(135214),l=e.i(764205),a=e.i(266027);let r=(0,e.i(243652).createQueryKeys)("users");e.s(["useCurrentUser",0,()=>{let{accessToken:e,userId:i,userRole:s}=(0,t.default)();return(0,a.useQuery)({queryKey:r.detail(i),queryFn:async()=>{let t=await (0,l.userInfoCall)(e,i,s,!1,null,null);return console.log(`userInfo: ${JSON.stringify(t)}`),t.user_info},enabled:!!(e&&i&&s)})}])}]); \ No newline at end of file + `]: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: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:l,className:r,style:i,rows:s=0}=e,n=Array.from({length:s}).map((a,l)=>t.createElement("li",{key:l,style:{width:((e,t)=>{let{width:a,rows:l=2}=t;return Array.isArray(a)?a[e]:l-1===e?a:void 0})(l,e)}}));return t.createElement("ul",{className:(0,a.default)(l,r),style:i},n)},x=({prefixCls:e,className:l,width:r,style:i})=>t.createElement("h3",{className:(0,a.default)(e,l),style:Object.assign({width:r},i)});function y(e){return e&&"object"==typeof e?e:{}}let j=e=>{let{prefixCls:r,loading:s,className:n,rootClassName:o,style:d,children:c,avatar:u=!1,title:m=!0,paragraph:h=!0,active:g,round:f}=e,{getPrefixCls:p,direction:j,className:w,style:k}=(0,l.useComponentConfig)("skeleton"),C=p("skeleton",r),[O,$,N]=b(C);if(s||!("loading"in e)){let e,l,r=!!u,s=!!m,c=!!h;if(r){let a=Object.assign(Object.assign({prefixCls:`${C}-avatar`},s&&!c?{size:"large",shape:"square"}:{size:"large",shape:"circle"}),y(u));e=t.createElement("div",{className:`${C}-header`},t.createElement(i,Object.assign({},a)))}if(s||c){let e,a;if(s){let a=Object.assign(Object.assign({prefixCls:`${C}-title`},!r&&c?{width:"38%"}:r&&c?{width:"50%"}:{}),y(m));e=t.createElement(x,Object.assign({},a))}if(c){let e,l=Object.assign(Object.assign({prefixCls:`${C}-paragraph`},(e={},r&&s||(e.width="61%"),!r&&s?e.rows=3:e.rows=2,e)),y(h));a=t.createElement(v,Object.assign({},l))}l=t.createElement("div",{className:`${C}-content`},e,a)}let p=(0,a.default)(C,{[`${C}-with-avatar`]:r,[`${C}-active`]:g,[`${C}-rtl`]:"rtl"===j,[`${C}-round`]:f},w,n,o,$,N);return O(t.createElement("div",{className:p,style:Object.assign(Object.assign({},k),d)},e,l))}return null!=c?c:null};j.Button=e=>{let{prefixCls:s,className:n,rootClassName:o,active:d,block:c=!1,size:u="default"}=e,{getPrefixCls:m}=t.useContext(l.ConfigContext),h=m("skeleton",s),[g,f,p]=b(h),v=(0,r.default)(e,["prefixCls"]),x=(0,a.default)(h,`${h}-element`,{[`${h}-active`]:d,[`${h}-block`]:c},n,o,f,p);return g(t.createElement("div",{className:x},t.createElement(i,Object.assign({prefixCls:`${h}-button`,size:u},v))))},j.Avatar=e=>{let{prefixCls:s,className:n,rootClassName:o,active:d,shape:c="circle",size:u="default"}=e,{getPrefixCls:m}=t.useContext(l.ConfigContext),h=m("skeleton",s),[g,f,p]=b(h),v=(0,r.default)(e,["prefixCls","className"]),x=(0,a.default)(h,`${h}-element`,{[`${h}-active`]:d},n,o,f,p);return g(t.createElement("div",{className:x},t.createElement(i,Object.assign({prefixCls:`${h}-avatar`,shape:c,size:u},v))))},j.Input=e=>{let{prefixCls:s,className:n,rootClassName:o,active:d,block:c,size:u="default"}=e,{getPrefixCls:m}=t.useContext(l.ConfigContext),h=m("skeleton",s),[g,f,p]=b(h),v=(0,r.default)(e,["prefixCls"]),x=(0,a.default)(h,`${h}-element`,{[`${h}-active`]:d,[`${h}-block`]:c},n,o,f,p);return g(t.createElement("div",{className:x},t.createElement(i,Object.assign({prefixCls:`${h}-input`,size:u},v))))},j.Image=e=>{let{prefixCls:r,className:i,rootClassName:s,style:n,active:o}=e,{getPrefixCls:d}=t.useContext(l.ConfigContext),c=d("skeleton",r),[u,m,h]=b(c),g=(0,a.default)(c,`${c}-element`,{[`${c}-active`]:o},i,s,m,h);return u(t.createElement("div",{className:g},t.createElement("div",{className:(0,a.default)(`${c}-image`,i),style:n},t.createElement("svg",{viewBox:"0 0 1098 1024",xmlns:"http://www.w3.org/2000/svg",className:`${c}-image-svg`},t.createElement("title",null,"Image placeholder"),t.createElement("path",{d:"M365.714286 329.142857q0 45.714286-32.036571 77.677714t-77.677714 32.036571-77.677714-32.036571-32.036571-77.677714 32.036571-77.677714 77.677714-32.036571 77.677714 32.036571 32.036571 77.677714zM950.857143 548.571429l0 256-804.571429 0 0-109.714286 182.857143-182.857143 91.428571 91.428571 292.571429-292.571429zM1005.714286 146.285714l-914.285714 0q-7.460571 0-12.873143 5.412571t-5.412571 12.873143l0 694.857143q0 7.460571 5.412571 12.873143t12.873143 5.412571l914.285714 0q7.460571 0 12.873143-5.412571t5.412571-12.873143l0-694.857143q0-7.460571-5.412571-12.873143t-12.873143-5.412571zM1097.142857 164.571429l0 694.857143q0 37.741714-26.843429 64.585143t-64.585143 26.843429l-914.285714 0q-37.741714 0-64.585143-26.843429t-26.843429-64.585143l0-694.857143q0-37.741714 26.843429-64.585143t64.585143-26.843429l914.285714 0q37.741714 0 64.585143 26.843429t26.843429 64.585143z",className:`${c}-image-path`})))))},j.Node=e=>{let{prefixCls:r,className:i,rootClassName:s,style:n,active:o,children:d}=e,{getPrefixCls:c}=t.useContext(l.ConfigContext),u=c("skeleton",r),[m,h,g]=b(u),f=(0,a.default)(u,`${u}-element`,{[`${u}-active`]:o},h,i,s,g);return m(t.createElement("div",{className:f},t.createElement("div",{className:(0,a.default)(`${u}-image`,i),style:n},d)))},e.s(["default",0,j],185793)},959013,e=>{"use strict";e.i(247167);var t=e.i(931067),a=e.i(271645);let l={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"}},{tag:"path",attrs:{d:"M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z"}}]},name:"plus",theme:"outlined"};var r=e.i(9583),i=a.forwardRef(function(e,i){return a.createElement(r.default,(0,t.default)({},e,{ref:i,icon:l}))});e.s(["default",0,i],959013)},269200,e=>{"use strict";var t=e.i(290571),a=e.i(271645),l=e.i(444755);let r=(0,e.i(673706).makeClassName)("Table"),i=a.default.forwardRef((e,i)=>{let{children:s,className:n}=e,o=(0,t.__rest)(e,["children","className"]);return a.default.createElement("div",{className:(0,l.tremorTwMerge)(r("root"),"overflow-auto",n)},a.default.createElement("table",Object.assign({ref:i,className:(0,l.tremorTwMerge)(r("table"),"w-full text-tremor-default","text-tremor-content","dark:text-dark-tremor-content")},o),s))});i.displayName="Table",e.s(["Table",()=>i],269200)},942232,e=>{"use strict";var t=e.i(290571),a=e.i(271645),l=e.i(444755);let r=(0,e.i(673706).makeClassName)("TableBody"),i=a.default.forwardRef((e,i)=>{let{children:s,className:n}=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,l.tremorTwMerge)(r("root"),"align-top divide-y","divide-tremor-border","dark:divide-dark-tremor-border",n)},o),s))});i.displayName="TableBody",e.s(["TableBody",()=>i],942232)},977572,e=>{"use strict";var t=e.i(290571),a=e.i(271645),l=e.i(444755);let r=(0,e.i(673706).makeClassName)("TableCell"),i=a.default.forwardRef((e,i)=>{let{children:s,className:n}=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,l.tremorTwMerge)(r("root"),"align-middle whitespace-nowrap text-left p-4",n)},o),s))});i.displayName="TableCell",e.s(["TableCell",()=>i],977572)},427612,e=>{"use strict";var t=e.i(290571),a=e.i(271645),l=e.i(444755);let r=(0,e.i(673706).makeClassName)("TableHead"),i=a.default.forwardRef((e,i)=>{let{children:s,className:n}=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,l.tremorTwMerge)(r("root"),"text-left","text-tremor-content","dark:text-dark-tremor-content",n)},o),s))});i.displayName="TableHead",e.s(["TableHead",()=>i],427612)},64848,e=>{"use strict";var t=e.i(290571),a=e.i(271645),l=e.i(444755);let r=(0,e.i(673706).makeClassName)("TableHeaderCell"),i=a.default.forwardRef((e,i)=>{let{children:s,className:n}=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,l.tremorTwMerge)(r("root"),"whitespace-nowrap text-left font-semibold top-0 px-4 py-3.5","text-tremor-content-strong","dark:text-dark-tremor-content-strong",n)},o),s))});i.displayName="TableHeaderCell",e.s(["TableHeaderCell",()=>i],64848)},496020,e=>{"use strict";var t=e.i(290571),a=e.i(271645),l=e.i(444755);let r=(0,e.i(673706).makeClassName)("TableRow"),i=a.default.forwardRef((e,i)=>{let{children:s,className:n}=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,l.tremorTwMerge)(r("row"),n)},o),s))});i.displayName="TableRow",e.s(["TableRow",()=>i],496020)},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,l="",r=arguments.length;at,"default",0,t])},625901,e=>{"use strict";var t=e.i(266027),a=e.i(621482),l=e.i(243652),r=e.i(764205),i=e.i(135214);let s=(0,l.createQueryKeys)("models"),n=(0,l.createQueryKeys)("modelHub"),o=(0,l.createQueryKeys)("allProxyModels");(0,l.createQueryKeys)("selectedTeamModels");let d=(0,l.createQueryKeys)("infiniteModels");e.s(["useAllProxyModels",0,()=>{let{accessToken:e,userId:a,userRole:l}=(0,i.default)();return(0,t.useQuery)({queryKey:o.list({}),queryFn:async()=>await (0,r.modelAvailableCall)(e,a,l,!0,null,!0,!1,"expand"),enabled:!!(e&&a&&l)})},"useInfiniteModelInfo",0,(e=50,t)=>{let{accessToken:l,userId:s,userRole:n}=(0,i.default)();return(0,a.useInfiniteQuery)({queryKey:d.list({filters:{...s&&{userId:s},...n&&{userRole:n},size:e,...t&&{search:t}}}),queryFn:async({pageParam:a})=>await (0,r.modelInfoCall)(l,s,n,a,e,t),initialPageParam:1,getNextPageParam:e=>{if(e.current_page{let{accessToken:e}=(0,i.default)();return(0,t.useQuery)({queryKey:n.list({}),queryFn:async()=>await (0,r.modelHubCall)(e),enabled:!!e})},"useModelsInfo",0,(e=1,a=50,l,n,o,d,c)=>{let{accessToken:u,userId:m,userRole:h}=(0,i.default)();return(0,t.useQuery)({queryKey:s.list({filters:{...m&&{userId:m},...h&&{userRole:h},page:e,size:a,...l&&{search:l},...n&&{modelId:n},...o&&{teamId:o},...d&&{sortBy:d},...c&&{sortOrder:c}}}),queryFn:async()=>await (0,r.modelInfoCall)(u,m,h,e,a,l,n,o,d,c),enabled:!!(u&&m&&h)})}])},621482,e=>{"use strict";var t=e.i(869230),a=e.i(992571),l=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:l}=e,r=super.createResult(e,t),{isFetching:i,isRefetching:s,isError:n,isRefetchError:o}=r,d=l.fetchMeta?.fetchMore?.direction,c=n&&"forward"===d,u=i&&"forward"===d,m=n&&"backward"===d,h=i&&"backward"===d;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:(0,a.hasNextPage)(t,l.data),hasPreviousPage:(0,a.hasPreviousPage)(t,l.data),isFetchNextPageError:c,isFetchingNextPage:u,isFetchPreviousPageError:m,isFetchingPreviousPage:h,isRefetchError:o&&!c&&!m,isRefetching:s&&!u&&!h}}},r=e.i(469637);function i(e,t){return(0,r.useBaseQuery)(e,l,t)}e.s(["useInfiniteQuery",()=>i],621482)},785242,e=>{"use strict";var t=e.i(619273),a=e.i(266027),l=e.i(912598),r=e.i(135214),i=e.i(270345),s=e.i(243652),n=e.i(764205);let o=(0,s.createQueryKeys)("teams"),d=async(e,t,a,l={})=>{try{let r=(0,n.getProxyBaseUrl)(),i=new URLSearchParams(Object.entries({team_id:l.teamID,organization_id:l.organizationID,team_alias:l.team_alias,user_id:l.userID,page:t,page_size:a,sort_by:l.sortBy,sort_order:l.sortOrder,status:"deleted"}).filter(([,e])=>null!=e).map(([e,t])=>[e,String(t)])),s=`${r?`${r}/v2/team/list`:"/v2/team/list"}?${i}`,o=await fetch(s,{method:"GET",headers:{[(0,n.getGlobalLitellmHeaderName)()]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!o.ok){let e=await o.json(),t=(0,n.deriveErrorMessage)(e);throw(0,n.handleError)(t),Error(t)}let d=await o.json();if(console.log("/team/list?status=deleted API Response:",d),d&&"object"==typeof d&&"teams"in d)return d.teams;return d}catch(e){throw console.error("Failed to list deleted teams:",e),e}},c=(0,s.createQueryKeys)("deletedTeams");e.s(["useDeletedTeams",0,(e,l,i={})=>{let{accessToken:s}=(0,r.default)();return(0,a.useQuery)({queryKey:c.list({page:e,limit:l,...i}),queryFn:async()=>await d(s,e,l,i),enabled:!!s,staleTime:3e4,placeholderData:t.keepPreviousData})},"useTeam",0,e=>{let{accessToken:t}=(0,r.default)(),i=(0,l.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,n.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:l}=(0,r.default)();return(0,a.useQuery)({queryKey:o.list({}),queryFn:async()=>await (0,i.fetchTeams)(e,t,l,null),enabled:!!e})}])},738014,e=>{"use strict";var t=e.i(135214),a=e.i(764205),l=e.i(266027);let r=(0,e.i(243652).createQueryKeys)("users");e.s(["useCurrentUser",0,()=>{let{accessToken:e,userId:i}=(0,t.default)();return(0,l.useQuery)({queryKey:r.detail(i),queryFn:async()=>await (0,a.userGetInfoV2)(e),enabled:!!(e&&i)})}])}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/8cc98e6cf29063c4.js b/litellm/proxy/_experimental/out/_next/static/chunks/8cc98e6cf29063c4.js new file mode 100644 index 0000000000..def48bb0c9 --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/8cc98e6cf29063c4.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"},i="../ui/assets/logos/",o={"A2A Agent":`${i}a2a_agent.png`,Ai21:`${i}ai21.svg`,"Ai21 Chat":`${i}ai21.svg`,"AI/ML API":`${i}aiml_api.svg`,"Aiohttp Openai":`${i}openai_small.svg`,Anthropic:`${i}anthropic.svg`,"Anthropic Text":`${i}anthropic.svg`,AssemblyAI:`${i}assemblyai_small.png`,Azure:`${i}microsoft_azure.svg`,"Azure AI Foundry (Studio)":`${i}microsoft_azure.svg`,"Azure Text":`${i}microsoft_azure.svg`,Baseten:`${i}baseten.svg`,"Amazon Bedrock":`${i}bedrock.svg`,"Amazon Bedrock Mantle":`${i}bedrock.svg`,"AWS SageMaker":`${i}bedrock.svg`,Cerebras:`${i}cerebras.svg`,Cloudflare:`${i}cloudflare.svg`,Codestral:`${i}mistral.svg`,Cohere:`${i}cohere.svg`,"Cohere Chat":`${i}cohere.svg`,Cometapi:`${i}cometapi.svg`,Cursor:`${i}cursor.svg`,"Databricks (Qwen API)":`${i}databricks.svg`,Dashscope:`${i}dashscope.svg`,Deepseek:`${i}deepseek.svg`,Deepgram:`${i}deepgram.png`,DeepInfra:`${i}deepinfra.png`,ElevenLabs:`${i}elevenlabs.png`,"Fal AI":`${i}fal_ai.jpg`,"Featherless Ai":`${i}featherless.svg`,"Fireworks AI":`${i}fireworks.svg`,Friendliai:`${i}friendli.svg`,"Github Copilot":`${i}github_copilot.svg`,"Google AI Studio":`${i}google.svg`,GradientAI:`${i}gradientai.svg`,Groq:`${i}groq.svg`,vllm:`${i}vllm.png`,Huggingface:`${i}huggingface.svg`,Hyperbolic:`${i}hyperbolic.svg`,Infinity:`${i}infinity.png`,"Jina AI":`${i}jina.png`,"Lambda Ai":`${i}lambda.svg`,"Lm Studio":`${i}lmstudio.svg`,"Meta Llama":`${i}meta_llama.svg`,MiniMax:`${i}minimax.svg`,"Mistral AI":`${i}mistral.svg`,Moonshot:`${i}moonshot.svg`,Morph:`${i}morph.svg`,Nebius:`${i}nebius.svg`,Novita:`${i}novita.svg`,"Nvidia Nim":`${i}nvidia_nim.svg`,Ollama:`${i}ollama.svg`,"Ollama Chat":`${i}ollama.svg`,Oobabooga:`${i}openai_small.svg`,OpenAI:`${i}openai_small.svg`,"Openai Like":`${i}openai_small.svg`,"OpenAI Text Completion":`${i}openai_small.svg`,"OpenAI-Compatible Text Completion Models (Together AI, etc.)":`${i}openai_small.svg`,"OpenAI-Compatible Endpoints (Together AI, etc.)":`${i}openai_small.svg`,Openrouter:`${i}openrouter.svg`,"Oracle Cloud Infrastructure (OCI)":`${i}oracle.svg`,Perplexity:`${i}perplexity-ai.svg`,Recraft:`${i}recraft.svg`,Replicate:`${i}replicate.svg`,RunwayML:`${i}runwayml.png`,Sagemaker:`${i}bedrock.svg`,Sambanova:`${i}sambanova.svg`,"SAP Generative AI Hub":`${i}sap.png`,Snowflake:`${i}snowflake.svg`,"Text-Completion-Codestral":`${i}mistral.svg`,TogetherAI:`${i}togetherai.svg`,Topaz:`${i}topaz.svg`,Triton:`${i}nvidia_triton.png`,V0:`${i}v0.svg`,"Vercel Ai Gateway":`${i}vercel.svg`,"Vertex AI (Anthropic, Gemini, etc.)":`${i}google.svg`,"Vertex Ai Beta":`${i}google.svg`,Vllm:`${i}vllm.png`,VolcEngine:`${i}volcengine.png`,"Voyage AI":`${i}voyage.webp`,Watsonx:`${i}watsonx.svg`,"Watsonx Text":`${i}watsonx.svg`,xAI:`${i}xai.svg`,Xinference:`${i}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:o[e],displayName:e}}let t=Object.keys(a).find(t=>a[t].toLowerCase()===e.toLowerCase());if(!t)return{logo:"",displayName:e};let i=r[t];return{logo:o[i],displayName:i}},"getProviderModels",0,(e,t)=>{console.log(`Provider key: ${e}`);let r=a[e];console.log(`Provider mapped to: ${r}`);let i=[];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))&&i.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&&i.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&&i.push(e)}))),i},"providerLogoMap",0,o,"provider_map",0,a])},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])},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 i(e,r){let[i,o]=(0,t.useState)(e),n=function(e,r){let[i]=(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 i.setOptions(r),i}(o,r);return[i,n.maybeExecute,n]}e.s(["useDebouncedState",()=>i],152473)},738014,e=>{"use strict";var t=e.i(135214),r=e.i(764205),a=e.i(266027);let i=(0,e.i(243652).createQueryKeys)("users");e.s(["useCurrentUser",0,()=>{let{accessToken:e,userId:o}=(0,t.default)();return(0,a.useQuery)({queryKey:i.detail(o),queryFn:async()=>await (0,r.userGetInfoV2)(e),enabled:!!(e&&o)})}])},906579,e=>{"use strict";e.i(247167);var t=e.i(271645),r=e.i(343794),a=e.i(361275),i=e.i(702779),o=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%)"}}),f=new l.Keyframes("antZoomBadgeOut",{"0%":{transform:"scale(1) translate(50%, -50%)"},"100%":{transform:"scale(0) translate(50%, -50%)",opacity:0}}),h=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:i}=e,o=e.colorTextLightSolid,n=e.colorError,s=e.colorErrorHover;return(0,m.mergeToken)(e,{badgeFontHeight:t,badgeShadowSize:r,badgeTextColor:o,badgeColor:n,badgeColorHover:s,badgeShadowColor:i,badgeProcessingDuration:"1.2s",badgeRibbonOffset:a,badgeRibbonCornerTransform:"scaleY(0.75)",badgeRibbonCornerFilter:"brightness(75%)"})},y=e=>{let{fontSize:t,lineHeight:r,fontSizeSM:a,lineWidth:i}=e;return{indicatorZIndex:"auto",indicatorHeight:Math.round(t*r)-2*i,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:i,textFontSize:o,textFontSizeSM:n,statusSize:l,dotSize:d,textFontWeight:m,indicatorHeight:A,indicatorHeightSM:y,marginXS:O,calc:x}=e,C=`${a}-scroll-number`,E=(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:o,lineHeight:(0,s.unit)(A),whiteSpace:"nowrap",textAlign:"center",background:e.badgeColor,borderRadius:x(A).div(2).equal(),boxShadow:`0 0 0 ${(0,s.unit)(i)} ${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:x(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)(i)} ${e.badgeShadowColor}`},[`${t}-count, ${t}-dot, ${C}-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:i,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}}}),E),{[`${t}-zoom-appear, ${t}-zoom-enter`]:{animationName:p,animationDuration:e.motionDurationSlow,animationTimingFunction:e.motionEaseOutBack,animationFillMode:"both"},[`${t}-zoom-leave`]:{animationName:f,animationDuration:e.motionDurationSlow,animationTimingFunction:e.motionEaseOutBack,animationFillMode:"both"},[`&${t}-not-a-wrapper`]:{[`${t}-zoom-appear, ${t}-zoom-enter`]:{animationName:h,animationDuration:e.motionDurationSlow,animationTimingFunction:e.motionEaseOutBack},[`${t}-zoom-leave`]:{animationName:b,animationDuration:e.motionDurationSlow,animationTimingFunction:e.motionEaseOutBack},[`&:not(${t}-status)`]:{verticalAlign:"middle"},[`${C}-custom-component, ${t}-count`]:{transform:"none"},[`${C}-custom-component, ${C}`]:{position:"relative",top:"auto",display:"block",transformOrigin:"50% 50%"}},[C]:{overflow:"hidden",transition:`all ${e.motionDurationMid} ${e.motionEaseOutBack}`,[`${C}-only`]:{position:"relative",display:"inline-block",height:A,transition:`all ${e.motionDurationSlow} ${e.motionEaseOutBack}`,WebkitTransformStyle:"preserve-3d",WebkitBackfaceVisibility:"hidden",[`> p${C}-only-unit`]:{height:A,margin:0,WebkitTransformStyle:"preserve-3d",WebkitBackfaceVisibility:"hidden"}},[`${C}-symbol`]:{verticalAlign:"top"}},"&-rtl":{direction:"rtl",[`${t}-count, ${t}-dot, ${C}-custom-component`]:{transform:"translate(-50%, -50%)"}}})}})(A(e)),y),x=(0,d.genStyleHooks)(["Badge","Ribbon"],e=>(e=>{let{antCls:t,badgeFontHeight:r,marginXS:a,badgeRibbonOffset:i,calc:o}=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:i,height:i,color:"currentcolor",border:`${(0,s.unit)(o(i).div(2).equal())} solid`,transform:e.badgeRibbonCornerTransform,transformOrigin:"top",filter:e.badgeRibbonCornerFilter}}),d),{[`&${n}-placement-end`]:{insetInlineEnd:o(i).mul(-1).equal(),borderEndEndRadius:0,[`${n}-corner`]:{insetInlineEnd:0,borderInlineEndColor:"transparent",borderBlockEndColor:"transparent"}},[`&${n}-placement-start`]:{insetInlineStart:o(i).mul(-1).equal(),borderEndStartRadius:0,[`${n}-corner`]:{insetInlineStart:0,borderBlockEndColor:"transparent",borderInlineStartColor:"transparent"}},"&-rtl":{direction:"rtl"}})}})(A(e)),y),C=e=>{let a,{prefixCls:i,value:o,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)(`${i}-only-unit`,{current:n})},o)},E=e=>{let r,a,{prefixCls:i,count:o,value:n}=e,s=Number(n),l=Math.abs(o),[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(C,Object.assign({},e,{key:s,current:!0}))],a={transition:"none"};else{r=[];let i=s+10,o=[];for(let e=s;e<=i;e+=1)o.push(e);let n=de%10===c);r=(n<0?o.slice(0,u+1):o.slice(u)).map((r,a)=>t.createElement(C,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,i=0;for(;(a+10)%10!==t;)a+=r,i+=r;return i}(c,s,n)}00%)`}}return t.createElement("span",{className:`${i}-only`,style:a,onTransitionEnd:g},r)};var I=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 i=0,a=Object.getOwnPropertySymbols(e);it.indexOf(a[i])&&Object.prototype.propertyIsEnumerable.call(e,a[i])&&(r[a[i]]=e[a[i]]);return r};let $=t.forwardRef((e,a)=>{let{prefixCls:i,count:s,className:l,motionClassName:c,style:u,title:d,show:m,component:g="sup",children:p}=e,f=I(e,["prefixCls","count","className","motionClassName","style","title","show","component","children"]),{getPrefixCls:h}=t.useContext(n.ConfigContext),b=h("scroll-number",i),v=Object.assign(Object.assign({},f),{"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(E,{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,o.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 i=0,a=Object.getOwnPropertySymbols(e);it.indexOf(a[i])&&Object.prototype.propertyIsEnumerable.call(e,a[i])&&(r[a[i]]=e[a[i]]);return r};let T=t.forwardRef((e,s)=>{var l,c,u,d,m;let{prefixCls:g,scrollNumberPrefixCls:p,children:f,status:h,text:b,color:v,count:A=null,overflowCount:y=99,dot:x=!1,size:C="default",title:E,offset:I,style:T,className:w,rootClassName:S,classNames:N,styles:M,showZero:R=!1}=e,P=_(e,["prefixCls","scrollNumberPrefixCls","children","status","text","color","count","overflowCount","dot","size","title","offset","style","className","rootClassName","classNames","styles","showZero"]),{getPrefixCls:k,direction:j,badge:L}=t.useContext(n.ConfigContext),D=k("badge",g),[B,F,z]=O(D),G=A>y?`${y}+`:A,H="0"===G||0===G||"0"===b||0===b,V=null===A||H&&!R,W=(null!=h||null!=v)&&V,K=null!=h||!H,U=x&&!H,q=U?"":G,X=(0,t.useMemo)(()=>((null==q||""===q)&&(null==b||""===b)||H&&!R)&&!U,[q,H,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(!I)return Object.assign(Object.assign({},null==L?void 0:L.style),T);let e={marginTop:I[1]};return"rtl"===j?e.left=Number.parseInt(I[0],10):e.right=-Number.parseInt(I[0],10),Object.assign(Object.assign(Object.assign({},e),null==L?void 0:L.style),T)},[j,I,T,null==L?void 0:L.style]),er=null!=E?E:"string"==typeof Z||"number"==typeof Z?Z:void 0,ea=!X&&(0===b?R:!!b&&!0!==b),ei=ea?t.createElement("span",{className:`${D}-status-text`},b):null,eo=Z&&"object"==typeof Z?(0,o.cloneElement)(Z,e=>({style:Object.assign(Object.assign({},et),e.style)})):void 0,en=(0,i.isPresetColor)(v,!1),es=(0,r.default)(null==N?void 0:N.indicator,null==(l=null==L?void 0:L.classNames)?void 0:l.indicator,{[`${D}-status-dot`]:W,[`${D}-status-${h}`]:!!h,[`${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`]:!f,[`${D}-rtl`]:"rtl"===j},w,S,null==L?void 0:L.className,null==(c=null==L?void 0:L.classNames)?void 0:c.root,null==N?void 0:N.root,F,z);if(!f&&W&&(b||K||!V)){let e=et.color;return B(t.createElement("span",Object.assign({},P,{className:ec,style:Object.assign(Object.assign(Object.assign({},null==M?void 0:M.root),null==(u=null==L?void 0:L.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==L?void 0:L.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},P,{className:ec,style:Object.assign(Object.assign({},null==(m=null==L?void 0:L.styles)?void 0:m.root),null==M?void 0:M.root)}),f,t.createElement(a.default,{visible:!X,motionName:`${D}-zoom`,motionAppear:!1,motionDeadline:1e3},({className:e})=>{var a,i;let o=k("scroll-number",p),n=ee.current,s=(0,r.default)(null==N?void 0:N.indicator,null==(a=null==L?void 0:L.classNames)?void 0:a.indicator,{[`${D}-dot`]:n,[`${D}-count`]:!n,[`${D}-count-sm`]:"small"===C,[`${D}-multiple-words`]:!n&&J&&J.toString().length>1,[`${D}-status-${h}`]:!!h,[`${D}-color-${v}`]:en}),l=Object.assign(Object.assign(Object.assign({},null==M?void 0:M.indicator),null==(i=null==L?void 0:L.styles)?void 0:i.indicator),et);return v&&!en&&((l=l||{}).background=v),t.createElement($,{prefixCls:o,show:!X,motionClassName:e,className:s,count:J,title:er,style:l,key:"scrollNumber"},eo)}),ei))});T.Ribbon=e=>{let{className:a,prefixCls:o,style:s,color:l,children:c,text:u,placement:d="end",rootClassName:m}=e,{getPrefixCls:g,direction:p}=t.useContext(n.ConfigContext),f=g("ribbon",o),h=`${f}-wrapper`,[b,v,A]=x(f,h),y=(0,i.isPresetColor)(l,!1),O=(0,r.default)(f,`${f}-placement-${d}`,{[`${f}-rtl`]:"rtl"===p,[`${f}-color-${l}`]:y},a),C={},E={};return l&&!y&&(C.background=l,E.color=l),b(t.createElement("div",{className:(0,r.default)(h,m,v,A)},c,t.createElement("div",{className:(0,r.default)(O,v),style:Object.assign(Object.assign({},C),s)},t.createElement("span",{className:`${f}-text`},u),t.createElement("div",{className:`${f}-corner`,style:E}))))},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,i=super.createResult(e,t),{isFetching:o,isRefetching:n,isError:s,isRefetchError:l}=i,c=a.fetchMeta?.fetchMore?.direction,u=s&&"forward"===c,d=o&&"forward"===c,m=s&&"backward"===c,g=o&&"backward"===c;return{...i,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}}},i=e.i(469637);function o(e,t){return(0,i.useBaseQuery)(e,a,t)}e.s(["useInfiniteQuery",()=>o],621482)},785242,e=>{"use strict";var t=e.i(619273),r=e.i(266027),a=e.i(912598),i=e.i(135214),o=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 i=(0,s.getProxyBaseUrl)(),o=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=`${i?`${i}/v2/team/list`:"/v2/team/list"}?${o}`,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,o={})=>{let{accessToken:n}=(0,i.default)();return(0,r.useQuery)({queryKey:u.list({page:e,limit:a,...o}),queryFn:async()=>await c(n,e,a,o),enabled:!!n,staleTime:3e4,placeholderData:t.keepPreviousData})},"useTeam",0,e=>{let{accessToken:t}=(0,i.default)(),o=(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=o.getQueryData(l.list({}));return t?.find(t=>t.team_id===e)}})},"useTeams",0,()=>{let{accessToken:e,userId:t,userRole:a}=(0,i.default)();return(0,r.useQuery)({queryKey:l.list({}),queryFn:async()=>await (0,o.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 i({className:e="",...i}){var o,n;let s=(0,r.useId)();return o=()=>{let e=document.getAnimations().filter(e=>e instanceof CSSAnimation&&"spin"===e.animationName),t=e.find(e=>e.effect.target?.getAttribute("data-spinner-id")===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)(o,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",...i,children:[(0,t.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,t.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})}e.s(["UiLoadingSpinner",()=>i],571303)},366283,e=>{"use strict";var t=e.i(290571),r=e.i(271645),a=e.i(95779),i=e.i(444755),o=e.i(673706);let n=(0,o.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,i.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,i.tremorTwMerge)((0,o.getColorClassNames)(u,a.colorPalette.background).bgColor,(0,o.getColorClassNames)(u,a.colorPalette.darkBorder).borderColor,(0,o.getColorClassNames)(u,a.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"),d)},g),r.default.createElement("div",{className:(0,i.tremorTwMerge)(n("header"),"flex items-start")},c?r.default.createElement(c,{className:(0,i.tremorTwMerge)(n("icon"),"flex-none h-5 w-5 mr-1.5")}):null,r.default.createElement("h4",{className:(0,i.tremorTwMerge)(n("title"),"font-semibold")},l)),r.default.createElement("p",{className:(0,i.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:i="w-4 h-4"})=>{let[o,n]=(0,r.useState)(!1),{logo:s}=(0,a.getProviderLogoAndName)(e);return o||!s?(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:s,alt:`${e} logo`,className:i,onError:()=>n(!0)})}])},37091,e=>{"use strict";var t=e.i(290571),r=e.i(95779),a=e.i(444755),i=e.i(673706),o=e.i(271645);let n=o.default.forwardRef((e,n)=>{let{color:s,children:l,className:c}=e,u=(0,t.__rest)(e,["color","children","className"]);return o.default.createElement("p",Object.assign({ref:n,className:(0,a.tremorTwMerge)(s?(0,i.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,i]=(0,t.useState)([]),{accessToken:o,userId:n,userRole:s}=(0,r.default)();return(0,t.useEffect)(()=>{(async()=>{i(await (0,a.fetchTeams)(o,n,s,null))})()},[o,n,s]),{teams:e,setTeams:i}}])},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 i=t(e);return isNaN(a)?r(e,NaN):(a&&i.setDate(i.getDate()+a),i)}function i(e,a){let i=t(e);if(isNaN(a))return r(e,NaN);if(!a)return i;let o=i.getDate(),n=r(e,i.getTime());return(n.setMonth(i.getMonth()+a+1,0),o>=n.getDate())?n:(i.setFullYear(n.getFullYear(),n.getMonth(),o),i)}e.s(["toDate",()=>t],435684),e.s(["constructFrom",()=>r],96226),e.s(["addDays",()=>a],439189),e.s(["addMonths",()=>i],497245)},891547,e=>{"use strict";var t=e.i(843476),r=e.i(271645),a=e.i(199133),i=e.i(764205);e.s(["default",0,({onChange:e,value:o,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,i.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:o,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),i=e.i(764205);function o(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,i.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:o(d),optionFilterProp:"label",showSearch:!0,style:{width:"100%"}})})},"getPolicyOptionEntries",()=>o])},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 i=e.i(9583),o=r.forwardRef(function(e,o){return r.createElement(i.default,(0,t.default)({},e,{ref:o,icon:a}))});e.s(["ClockCircleOutlined",0,o],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 i=e.i(9583),o=r.forwardRef(function(e,o){return r.createElement(i.default,(0,t.default)({},e,{ref:o,icon:a}))});e.s(["ArrowLeftOutlined",0,o],447566)},954616,e=>{"use strict";var t=e.i(271645),r=e.i(114272),a=e.i(540143),i=e.i(915823),o=e.i(619273),n=class extends i.Subscribable{#e;#t=void 0;#r;#a;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,o.shallowEqualObjects)(this.options,t)||this.#e.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#r,observer:this}),t?.mutationKey&&this.options.mutationKey&&(0,o.hashKey)(t.mutationKey)!==(0,o.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.#o(e)}getCurrentResult(){return this.#t}reset(){this.#r?.removeObserver(this),this.#r=void 0,this.#i(),this.#o()}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)}#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}}#o(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 i=(0,s.useQueryClient)(r),[l]=t.useState(()=>new n(i,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(o.noop)},[l]);if(c.error&&(0,o.shouldThrowError)(l.options.throwOnError,[c.error]))throw c.error;return{...c,mutate:u,mutateAsync:c.mutate}}e.s(["useMutation",()=>l],954616)},525720,e=>{"use strict";e.i(247167);var t=e.i(271645),r=e.i(343794),a=e.i(529681),i=e.i(908286),o=e.i(242064),n=e.i(246422),s=e.i(838378);let l=["wrap","nowrap","wrap-reverse"],c=["flex-start","flex-end","start","end","center","space-between","space-around","space-evenly","stretch","normal","left","right"],u=["center","start","end","flex-start","flex-end","self-start","self-end","baseline","normal","stretch"],d=function(e,t){let a,i,o;return(0,r.default)(Object.assign(Object.assign(Object.assign({},(a=!0===t.wrap?"wrap":t.wrap,{[`${e}-wrap-${a}`]:a&&l.includes(a)})),(i={},u.forEach(r=>{i[`${e}-align-${r}`]=t.align===r}),i[`${e}-align-stretch`]=!t.align&&!!t.vertical,i)),(o={},c.forEach(r=>{o[`${e}-justify-${r}`]=t.justify===r}),o)))},m=(0,n.genStyleHooks)("Flex",e=>{let{paddingXS:t,padding:r,paddingLG:a}=e,i=(0,s.mergeToken)(e,{flexGapSM:t,flexGap:r,flexGapLG:a});return[(e=>{let{componentCls:t}=e;return{[t]:{display:"flex",margin:0,padding:0,"&-vertical":{flexDirection:"column"},"&-rtl":{direction:"rtl"},"&:empty":{display:"none"}}}})(i),(e=>{let{componentCls:t}=e;return{[t]:{"&-gap-small":{gap:e.flexGapSM},"&-gap-middle":{gap:e.flexGap},"&-gap-large":{gap:e.flexGapLG}}}})(i),(e=>{let{componentCls:t}=e,r={};return l.forEach(e=>{r[`${t}-wrap-${e}`]={flexWrap:e}}),r})(i),(e=>{let{componentCls:t}=e,r={};return u.forEach(e=>{r[`${t}-align-${e}`]={alignItems:e}}),r})(i),(e=>{let{componentCls:t}=e,r={};return c.forEach(e=>{r[`${t}-justify-${e}`]={justifyContent:e}}),r})(i)]},()=>({}),{resetStyle:!1});var 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 i=0,a=Object.getOwnPropertySymbols(e);it.indexOf(a[i])&&Object.prototype.propertyIsEnumerable.call(e,a[i])&&(r[a[i]]=e[a[i]]);return r};let p=t.default.forwardRef((e,n)=>{let{prefixCls:s,rootClassName:l,className:c,style:u,flex:p,gap:f,vertical:h=!1,component:b="div",children:v}=e,A=g(e,["prefixCls","rootClassName","className","style","flex","gap","vertical","component","children"]),{flex:y,direction:O,getPrefixCls:x}=t.default.useContext(o.ConfigContext),C=x("flex",s),[E,I,$]=m(C),_=null!=h?h:null==y?void 0:y.vertical,T=(0,r.default)(c,l,null==y?void 0:y.className,C,I,$,d(C,e),{[`${C}-rtl`]:"rtl"===O,[`${C}-gap-${f}`]:(0,i.isPresetSize)(f),[`${C}-vertical`]:_}),w=Object.assign(Object.assign({},null==y?void 0:y.style),u);return p&&(w.flex=p),f&&!(0,i.isPresetSize)(f)&&(w.gap=f),E(t.default.createElement(b,Object.assign({ref:n,className:T,style:w},(0,a.default)(A,["justify","wrap","align"])),v))});e.s(["Flex",0,p],525720)},149121,e=>{"use strict";var t=e.i(843476),r=e.i(271645),a=e.i(152990),i=e.i(682830),o=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:f,isLoading:h=!1,loadingMessage:b="🚅 Loading logs...",noDataMessage:v="No logs found",enableSorting:A=!1}){let y=!!(g||p)&&!!f,[O,x]=(0,r.useState)([]),C=(0,a.useReactTable)({data:e,columns:d,...A&&{state:{sorting:O},onSortingChange:x,enableSortingRemoval:!1},...y&&{getRowCanExpand:f},getRowId:(e,t)=>e?.request_id??String(t),getCoreRowModel:(0,i.getCoreRowModel)(),...A&&{getSortedRowModel:(0,i.getSortedRowModel)()},...y&&{getExpandedRowModel:(0,i.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)(o.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:C.getHeaderGroups().map(e=>(0,t.jsx)(c.TableRow,{children:e.headers.map(e=>{let r=A&&e.column.getCanSort(),i=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"===i?"↑":"desc"===i?"↓":"⇅"})]})},e.id)})},e.id))}),(0,t.jsx)(l.TableBody,{children:h?(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})})})}):C.getRowModel().rows.length>0?C.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),i=e.i(214541);e.s(["default",0,()=>{let{accessToken:e,userRole:o,userId:n,premiumUser:s}=(0,a.default)(),{teams:l}=(0,i.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/5ec157703332dbc8.js b/litellm/proxy/_experimental/out/_next/static/chunks/90c332d66ef5954b.js similarity index 51% rename from litellm/proxy/_experimental/out/_next/static/chunks/5ec157703332dbc8.js rename to litellm/proxy/_experimental/out/_next/static/chunks/90c332d66ef5954b.js index 345ee2ef9b..bc806426f1 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/5ec157703332dbc8.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/90c332d66ef5954b.js @@ -1,5 +1,5 @@ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,955135,e=>{"use strict";var t=e.i(597440);e.s(["DeleteOutlined",()=>t.default])},309821,e=>{"use strict";e.i(247167);var t=e.i(271645);e.i(262370);var r=e.i(135551),n=e.i(201072),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),f=e.i(703923),m={percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,trailColor:"#D9D9D9",trailWidth:1,gapPosition:"bottom"},p=function(){var e=(0,t.useRef)([]),r=(0,t.useRef)(null);return(0,t.useEffect)(function(){var t=Date.now(),n=!1;e.current.forEach(function(e){if(e){n=!0;var 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},g=e.i(410160),h=e.i(392221),b=e.i(654310),v=0,y=(0,b.default)();let x=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=v,v+=1):e="TEST_OR_SSR",e)))},[]),e||o};var k=function(e){var r=e.bg,n=e.children;return t.createElement("div",{style:{width:"100%",height:"100%",background:r}},n)};function C(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 w=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,f=e.gapDegree,m=o&&"object"===(0,g.default)(o),p=u/2,h=t.createElement("circle",{className:"".concat(n,"-circle-path"),r:a,cx:p,cy:p,stroke:m?"#FFF":void 0,strokeLinecap:c,strokeWidth:d,opacity:+(0!==s),style:l,ref:r});if(!m)return h;var b="".concat(i,"-conic"),v=C(o,(360-f)/360),y=C(o,1),x="conic-gradient(from ".concat(f?"".concat(180+f/2,"deg"):"0deg",", ").concat(v.join(", "),")"),w="linear-gradient(to ".concat(f?"bottom":"top",", ").concat(y.join(", "),")");return t.createElement(t.Fragment,null,t.createElement("mask",{id:b},h),t.createElement("foreignObject",{x:0,y:0,width:u,height:u,mask:"url(#".concat(b,")")},t.createElement(k,{bg:w},t.createElement(k,{bg:x}))))}),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}},E=["id","prefixCls","steps","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"];function j(e){var t=null!=e?e:[];return Array.isArray(t)?t:[t]}let _=function(e){var r,n,o,i,a=(0,u.default)((0,u.default)({},m),e),s=a.id,c=a.prefixCls,h=a.steps,b=a.strokeWidth,v=a.trailWidth,y=a.gapDegree,k=void 0===y?0:y,C=a.gapPosition,_=a.trailColor,N=a.strokeLinecap,O=a.style,$=a.className,T=a.strokeColor,M=a.percent,R=(0,f.default)(a,E),P=x(s),I="".concat(P,"-gradient"),D=50-b/2,L=2*Math.PI*D,F=k>0?90+k/2:-90,z=(360-k)/360*L,A="object"===(0,g.default)(h)?h:{count:h,gap:2},B=A.count,H=A.gap,q=j(M),W=j(T),K=W.find(function(e){return e&&"object"===(0,g.default)(e)}),U=K&&"object"===(0,g.default)(K)?"butt":N,X=S(L,z,0,100,F,k,C,_,U,b),G=p();return t.createElement("svg",(0,d.default)({className:(0,l.default)("".concat(c,"-circle"),$),viewBox:"0 0 ".concat(100," ").concat(100),style:O,id:s,role:"presentation"},R),!B&&t.createElement("circle",{className:"".concat(c,"-circle-trail"),r:D,cx:50,cy:50,stroke:_,strokeLinecap:U,strokeWidth:v||b,style:X}),B?(r=Math.round(B*(q[0]/100)),n=100/B,o=0,Array(B).fill(null).map(function(e,i){var a=i<=r-1?W[0]:_,l=a&&"object"===(0,g.default)(a)?"url(#".concat(I,")"):void 0,s=S(L,z,o,n,F,k,C,a,"butt",b,H);return o+=(z-s.strokeDashoffset+H)*100/z,t.createElement("circle",{key:i,className:"".concat(c,"-circle-path"),r:D,cx:50,cy:50,stroke:l,strokeWidth:b,opacity:1,style:s,ref:function(e){G[i]=e}})})):(i=0,q.map(function(e,r){var n=W[r]||W[W.length-1],o=S(L,z,i,e,F,k,C,n,U,b);return i+=e,t.createElement(w,{key:r,color:n,ptg:e,radius:D,prefixCls:c,gradientId:I,style:o,strokeLinecap:U,strokeWidth:b,gapDegree:k,ref:function(e){G[r]=e},size:100})}).reverse()))};var N=e.i(491816);e.i(765846);var O=e.i(896091);function $(e){return!e||e<0?0:e>100?100:e}function T({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]},R=e=>{let{prefixCls:r,trailColor:n=null,strokeLinecap:o="round",gapPosition:i,gapDegree:a,width:s=120,type:c,children:d,success:u,size:f=s,steps:m}=e,[p,g]=M(f,"circle"),{strokeWidth:h}=e;void 0===h&&(h=Math.max(3/p*100,6));let b=t.useMemo(()=>a||0===a?a:"dashboard"===c?75:void 0,[a,c]),v=(({percent:e,success:t,successPercent:r})=>{let n=$(T({success:t,successPercent:r}));return[n,$($(e)-n)]})(e),y="[object Object]"===Object.prototype.toString.call(e.strokeColor),x=(({success:e={},strokeColor:t})=>{let{strokeColor:r}=e;return[r||O.presetPrimaryColors.green,t||null]})({success:u,strokeColor:e.strokeColor}),k=(0,l.default)(`${r}-inner`,{[`${r}-circle-gradient`]:y}),C=t.createElement(_,{steps:m,percent:m?v[1]:v,strokeWidth:h,trailWidth:h,strokeColor:m?x[1]:x,strokeLinecap:o,trailColor:n,prefixCls:r,gapDegree:b,gapPosition:i||"dashboard"===c&&"bottom"||void 0}),w=p<=20,S=t.createElement("div",{className:k,style:{width:p,height:g,fontSize:.15*p+6}},C,!w&&d);return w?t.createElement(N.default,{title:d},S):S};e.i(296059);var P=e.i(694758),I=e.i(915654),D=e.i(183293),L=e.i(246422),F=e.i(838378);let z="--progress-line-stroke-color",A="--progress-percent",B=e=>{let t=e?"100%":"-100%";return new P.Keyframes(`antProgress${e?"RTL":"LTR"}Active`,{"0%":{transform:`translateX(${t}) scaleX(0)`,opacity:.1},"20%":{transform:`translateX(${t}) scaleX(0)`,opacity:.5},to:{transform:"translateX(0) scaleX(1)",opacity:0}})},H=(0,L.genStyleHooks)("Progress",e=>{let t=e.calc(e.marginXXS).div(2).equal(),r=(0,F.mergeToken)(e,{progressStepMarginInlineEnd:t,progressStepMinWidth:t,progressActiveMotionDuration:"2.4s"});return[(e=>{let{componentCls:t,iconCls:r}=e;return{[t]:Object.assign(Object.assign({},(0,D.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(${z})`]},height:"100%",width:`calc(1 / var(${A}) * 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,I.unit)(e.paddingXXS)}`,[`&${t}-text-start`]:{justifyContent:"start"},[`&${t}-text-end`]:{justifyContent:"end"}},[`&${t}-status-active`]:{[`${t}-bg::before`]:{position:"absolute",inset:0,backgroundColor:e.colorBgContainer,borderRadius:e.lineBorderRadius,opacity:0,animationName:B(),animationDuration:e.progressActiveMotionDuration,animationTimingFunction:e.motionEaseOutQuint,animationIterationCount:"infinite",content:'""'}},[`&${t}-rtl${t}-status-active`]:{[`${t}-bg::before`]:{animationName:B(!0)}},[`&${t}-status-exception`]:{[`${t}-bg`]:{backgroundColor:e.colorError},[`${t}-text`]:{color:e.colorError}},[`&${t}-status-exception ${t}-inner:not(${t}-circle-gradient)`]:{[`${t}-circle-path`]:{stroke:e.colorError}},[`&${t}-status-success`]:{[`${t}-bg`]:{backgroundColor:e.colorSuccess},[`${t}-text`]:{color:e.colorSuccess}},[`&${t}-status-success ${t}-inner:not(${t}-circle-gradient)`]:{[`${t}-circle-path`]:{stroke:e.colorSuccess}}})}})(r),(e=>{let{componentCls:t,iconCls:r}=e;return{[t]:{[`${t}-circle-trail`]:{stroke:e.remainingColor},[`&${t}-circle ${t}-inner`]:{position:"relative",lineHeight:1,backgroundColor:"transparent"},[`&${t}-circle ${t}-text`]:{position:"absolute",insetBlockStart:"50%",insetInlineStart:0,width:"100%",margin:0,padding:0,color:e.circleTextColor,fontSize:e.circleTextFontSize,lineHeight:1,whiteSpace:"normal",textAlign:"center",transform:"translateY(-50%)",[r]:{fontSize:e.circleIconFontSize}},[`${t}-circle&-status-exception`]:{[`${t}-text`]:{color:e.colorError}},[`${t}-circle&-status-success`]:{[`${t}-text`]:{color:e.colorSuccess}}},[`${t}-inline-circle`]:{lineHeight:1,[`${t}-inner`]:{verticalAlign:"bottom"}}}})(r),(e=>{let{componentCls:t}=e;return{[t]:{[`${t}-steps`]:{display:"inline-block","&-outer":{display:"flex",flexDirection:"row",alignItems:"center"},"&-item":{flexShrink:0,minWidth:e.progressStepMinWidth,marginInlineEnd:e.progressStepMarginInlineEnd,backgroundColor:e.remainingColor,transition:`all ${e.motionDurationSlow}`,"&-active":{backgroundColor:e.defaultColor}}}}}})(r),(e=>{let{componentCls:t,iconCls:r}=e;return{[t]:{[`${t}-small&-line, ${t}-small&-line ${t}-text ${r}`]:{fontSize:e.fontSizeSM}}}})(r)]},e=>({circleTextColor:e.colorText,defaultColor:e.colorInfo,remainingColor:e.colorFillSecondary,lineBorderRadius:100,circleTextFontSize:"1em",circleIconFontSize:`${e.fontSize/e.fontSizeSM}em`}));var q=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var 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 W=e=>{let{prefixCls:r,direction:n,percent:o,size:i,strokeWidth:a,strokeColor:s,strokeLinecap:c="round",children:d,trailColor:u=null,percentPosition:f,success:m}=e,{align:p,type:g}=f,h=s&&"string"!=typeof s?((e,t)=>{let{from:r=O.presetPrimaryColors.blue,to:n=O.presetPrimaryColors.blue,direction:o="rtl"===t?"to left":"to right"}=e,i=q(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,[z]:r}}let a=`linear-gradient(${o}, ${r}, ${n})`;return{background:a,[z]:a}})(s,n):{[z]:s,background:s},b="square"===c||"butt"===c?0:void 0,[v,y]=M(null!=i?i:[-1,a||("small"===i?6:8)],"line",{strokeWidth:a}),x=Object.assign(Object.assign({width:`${$(o)}%`,height:y,borderRadius:b},h),{[A]:$(o)/100}),k=T(e),C={width:`${$(k)}%`,height:y,borderRadius:b,backgroundColor:null==m?void 0:m.strokeColor},w=t.createElement("div",{className:`${r}-inner`,style:{backgroundColor:u||void 0,borderRadius:b}},t.createElement("div",{className:(0,l.default)(`${r}-bg`,`${r}-bg-${g}`),style:x},"inner"===g&&d),void 0!==k&&t.createElement("div",{className:`${r}-success-bg`,style:C})),S="outer"===g&&"start"===p,E="outer"===g&&"end"===p;return"outer"===g&&"center"===p?t.createElement("div",{className:`${r}-layout-bottom`},w,d):t.createElement("div",{className:`${r}-outer`,style:{width:v<0?"100%":v}},S&&d,w,E&&d)},K=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,f=o(i/100*n),[m,p]=M(null!=r?r:["small"===r?2:14,a],"step",{steps:n,strokeWidth:a}),g=m/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 X=["normal","exception","active","success"],G=t.forwardRef((e,d)=>{let u,{prefixCls:f,className:m,rootClassName:p,steps:g,strokeColor:h,percent:b=0,size:v="default",showInfo:y=!0,type:x="line",status:k,format:C,style:w,percentPosition:S={}}=e,E=U(e,["prefixCls","className","rootClassName","steps","strokeColor","percent","size","showInfo","type","status","format","style","percentPosition"]),{align:j="end",type:_="outer"}=S,N=Array.isArray(h)?h[0]:h,O="string"==typeof h||Array.isArray(h)?h:void 0,P=t.useMemo(()=>{if(N){let e="string"==typeof N?N:Object.values(N)[0];return new r.FastColor(e).isLight()}return!1},[h]),I=t.useMemo(()=>{var t,r;let n=T(e);return Number.parseInt(void 0!==n?null==(t=null!=n?n:0)?void 0:t.toString():null==(r=null!=b?b:0)?void 0:r.toString(),10)},[b,e.success,e.successPercent]),D=t.useMemo(()=>!X.includes(k)&&I>=100?"success":k||"normal",[k,I]),{getPrefixCls:L,direction:F,progress:z}=t.useContext(c.ConfigContext),A=L("progress",f),[B,q,G]=H(A),V="line"===x,Q=V&&!g,Y=t.useMemo(()=>{let r;if(!y)return null;let s=T(e),c=C||(e=>`${e}%`),d=V&&P&&"inner"===_;return"inner"===_||C||"exception"!==D&&"success"!==D?r=c($(b),$(s)):"exception"===D?r=V?t.createElement(i.default,null):t.createElement(a.default,null):"success"===D&&(r=V?t.createElement(n.default,null):t.createElement(o.default,null)),t.createElement("span",{className:(0,l.default)(`${A}-text`,{[`${A}-text-bright`]:d,[`${A}-text-${j}`]:Q,[`${A}-text-${_}`]:Q}),title:"string"==typeof r?r:void 0},r)},[y,b,I,D,x,A,C]);"line"===x?u=g?t.createElement(K,Object.assign({},e,{strokeColor:O,prefixCls:A,steps:"object"==typeof g?g.count:g}),Y):t.createElement(W,Object.assign({},e,{strokeColor:N,prefixCls:A,direction:F,percentPosition:{align:j,type:_}}),Y):("circle"===x||"dashboard"===x)&&(u=t.createElement(R,Object.assign({},e,{strokeColor:N,prefixCls:A,progressStatus:D}),Y));let J=(0,l.default)(A,`${A}-status-${D}`,{[`${A}-${"dashboard"===x&&"circle"||x}`]:"line"!==x,[`${A}-inline-circle`]:"circle"===x&&M(v,"circle")[0]<=20,[`${A}-line`]:Q,[`${A}-line-align-${j}`]:Q,[`${A}-line-position-${_}`]:Q,[`${A}-steps`]:g,[`${A}-show-info`]:y,[`${A}-${v}`]:"string"==typeof v,[`${A}-rtl`]:"rtl"===F},null==z?void 0:z.className,m,p,q,G);return B(t.createElement("div",Object.assign({ref:d,style:Object.assign(Object.assign({},null==z?void 0:z.style),w),className:J,role:"progressbar","aria-valuenow":I,"aria-valuemin":0,"aria-valuemax":100},(0,s.default)(E,["trailColor","strokeWidth","width","gapDegree","gapPosition","strokeLinecap","success","successPercent"])),u))});e.s(["default",0,G],309821)},597440,e=>{"use strict";e.i(247167);var t=e.i(931067),r=e.i(271645);let n={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z"}}]},name:"delete",theme:"outlined"};var 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(["default",0,i],597440)},737434,e=>{"use strict";var t=e.i(184163);e.s(["DownloadOutlined",()=>t.default])},916940,e=>{"use strict";var t=e.i(843476),r=e.i(271645),n=e.i(199133),o=e.i(764205);e.s(["default",0,({onChange:e,value:i,className:a,accessToken:l,placeholder:s="Select vector stores",disabled:c=!1})=>{let[d,u]=(0,r.useState)([]),[f,m]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{(async()=>{if(l){m(!0);try{let e=await (0,o.vectorStoreListCall)(l);e.data&&u(e.data)}catch(e){console.error("Error fetching vector stores:",e)}finally{m(!1)}}})()},[l]),(0,t.jsx)("div",{children:(0,t.jsx)(n.Select,{mode:"multiple",placeholder:s,onChange:e,value:i,loading:f,className:a,allowClear:!0,options:d.map(e=>({label:`${e.vector_store_name||e.vector_store_id} (${e.vector_store_id})`,value:e.vector_store_id,title:e.vector_store_description||e.vector_store_id})),optionFilterProp:"label",showSearch:!0,style:{width:"100%"},disabled:c})})}])},107233,37727,e=>{"use strict";var t=e.i(603908);e.s(["Plus",()=>t.default],107233);var r=e.i(841947);e.s(["X",()=>r.default],37727)},246349,e=>{"use strict";let t=(0,e.i(475254).default)("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);e.s(["default",()=>t])},309426,e=>{"use strict";var t=e.i(290571),r=e.i(444755),n=e.i(673706),o=e.i(271645),i=e.i(46757);let a=(0,n.makeClassName)("Col"),l=o.default.forwardRef((e,n)=>{let l,s,c,d,{numColSpan:u=1,numColSpanSm:f,numColSpanMd:m,numColSpanLg:p,children:g,className:h}=e,b=(0,t.__rest)(e,["numColSpan","numColSpanSm","numColSpanMd","numColSpanLg","children","className"]),v=(e,t)=>e&&Object.keys(t).includes(String(e))?t[e]:"";return o.default.createElement("div",Object.assign({ref:n,className:(0,r.tremorTwMerge)(a("root"),(l=v(u,i.colSpan),s=v(f,i.colSpanSm),c=v(m,i.colSpanMd),d=v(p,i.colSpanLg),(0,r.tremorTwMerge)(l,s,c,d)),h)},b),g)});l.displayName="Col",e.s(["Col",()=>l],309426)},950724,(e,t,r)=>{t.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},100236,(e,t,r)=>{t.exports=e.g&&e.g.Object===Object&&e.g},139088,(e,t,r)=>{var n=e.r(100236),o="object"==typeof self&&self&&self.Object===Object&&self;t.exports=n||o||Function("return this")()},631926,(e,t,r)=>{var n=e.r(139088);t.exports=function(){return n.Date.now()}},748891,(e,t,r)=>{var n=/\s/;t.exports=function(e){for(var t=e.length;t--&&n.test(e.charAt(t)););return t}},830364,(e,t,r)=>{var n=e.r(748891),o=/^\s+/;t.exports=function(e){return e?e.slice(0,n(e)+1).replace(o,""):e}},630353,(e,t,r)=>{t.exports=e.r(139088).Symbol},243436,(e,t,r)=>{var n=e.r(630353),o=Object.prototype,i=o.hasOwnProperty,a=o.toString,l=n?n.toStringTag:void 0;t.exports=function(e){var t=i.call(e,l),r=e[l];try{e[l]=void 0;var n=!0}catch(e){}var o=a.call(e);return n&&(t?e[l]=r:delete e[l]),o}},223243,(e,t,r)=>{var n=Object.prototype.toString;t.exports=function(e){return n.call(e)}},377684,(e,t,r)=>{var n=e.r(630353),o=e.r(243436),i=e.r(223243),a=n?n.toStringTag:void 0;t.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":a&&a in Object(e)?o(e):i(e)}},877289,(e,t,r)=>{t.exports=function(e){return null!=e&&"object"==typeof e}},361884,(e,t,r)=>{var n=e.r(377684),o=e.r(877289);t.exports=function(e){return"symbol"==typeof e||o(e)&&"[object Symbol]"==n(e)}},773759,(e,t,r)=>{var n=e.r(830364),o=e.r(950724),i=e.r(361884),a=0/0,l=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,c=/^0o[0-7]+$/i,d=parseInt;t.exports=function(e){if("number"==typeof e)return e;if(i(e))return a;if(o(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=o(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=n(e);var r=s.test(e);return r||c.test(e)?d(e.slice(2),r?2:8):l.test(e)?a:+e}},374009,(e,t,r)=>{var n=e.r(950724),o=e.r(631926),i=e.r(773759),a=Math.max,l=Math.min;t.exports=function(e,t,r){var s,c,d,u,f,m,p=0,g=!1,h=!1,b=!0;if("function"!=typeof e)throw TypeError("Expected a function");function v(t){var r=s,n=c;return s=c=void 0,p=t,u=e.apply(n,r)}function y(e){var r=e-m,n=e-p;return void 0===m||r>=t||r<0||h&&n>=d}function x(){var e,r,n,i=o();if(y(i))return k(i);f=setTimeout(x,(e=i-m,r=i-p,n=t-e,h?l(n,d-r):n))}function k(e){return(f=void 0,b&&s)?v(e):(s=c=void 0,u)}function C(){var e,r=o(),n=y(r);if(s=arguments,c=this,m=r,n){if(void 0===f)return p=e=m,f=setTimeout(x,t),g?v(e):u;if(h)return clearTimeout(f),f=setTimeout(x,t),v(m)}return void 0===f&&(f=setTimeout(x,t)),u}return t=i(t)||0,n(r)&&(g=!!r.leading,d=(h="maxWait"in r)?a(i(r.maxWait)||0,t):d,b="trailing"in r?!!r.trailing:b),C.cancel=function(){void 0!==f&&clearTimeout(f),p=0,s=m=c=f=void 0},C.flush=function(){return void 0===f?u:k(o())},C}},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)},677667,674175,886148,543086,e=>{"use strict";let t,r;var n,o=e.i(290571),i=e.i(429427),a=e.i(371330),l=e.i(271645),s=e.i(394487),c=e.i(914189),d=e.i(144279),u=e.i(294316),f=e.i(83733);let m=(0,l.createContext)(()=>{});function p({value:e,children:t}){return l.default.createElement(m.Provider,{value:e},t)}e.s(["CloseProvider",()=>p],674175);var g=e.i(233137),h=e.i(233538),b=e.i(397701),v=e.i(402155),y=e.i(700020);let x=null!=(n=l.default.startTransition)?n:function(e){e()};var k=e.i(998348),C=((t=C||{})[t.Open=0]="Open",t[t.Closed=1]="Closed",t),w=((r=w||{})[r.ToggleDisclosure=0]="ToggleDisclosure",r[r.CloseDisclosure=1]="CloseDisclosure",r[r.SetButtonId=2]="SetButtonId",r[r.SetPanelId=3]="SetPanelId",r[r.SetButtonElement=4]="SetButtonElement",r[r.SetPanelElement=5]="SetPanelElement",r);let S={0:e=>({...e,disclosureState:(0,b.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}},E=(0,l.createContext)(null);function j(e){let t=(0,l.useContext)(E);if(null===t){let t=Error(`<${e} /> is missing a parent component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,j),t}return t}E.displayName="DisclosureContext";let _=(0,l.createContext)(null);_.displayName="DisclosureAPIContext";let N=(0,l.createContext)(null);function O(e,t){return(0,b.match)(t.type,S,e,t)}N.displayName="DisclosurePanelContext";let $=l.Fragment,T=y.RenderFeatures.RenderStrategy|y.RenderFeatures.Static,M=Object.assign((0,y.forwardRefWithAs)(function(e,t){let{defaultOpen:r=!1,...n}=e,o=(0,l.useRef)(null),i=(0,u.useSyncRefs)(t,(0,u.optionalRef)(e=>{o.current=e},void 0===e.as||e.as===l.Fragment)),a=(0,l.useReducer)(O,{disclosureState:+!r,buttonElement:null,panelElement:null,buttonId:null,panelId:null}),[{disclosureState:s,buttonId:d},f]=a,m=(0,c.useEvent)(e=>{f({type:1});let t=(0,v.getOwnerDocument)(o);if(!t||!d)return;let r=e?e instanceof HTMLElement?e:e.current instanceof HTMLElement?e.current:t.getElementById(d):t.getElementById(d);null==r||r.focus()}),h=(0,l.useMemo)(()=>({close:m}),[m]),x=(0,l.useMemo)(()=>({open:0===s,close:m}),[s,m]),k=(0,y.useRender)();return l.default.createElement(E.Provider,{value:a},l.default.createElement(_.Provider,{value:h},l.default.createElement(p,{value:m},l.default.createElement(g.OpenClosedProvider,{value:(0,b.match)(s,{0:g.State.Open,1:g.State.Closed})},k({ourProps:{ref:i},theirProps:n,slot:x,defaultTag:$,name:"Disclosure"})))))}),{Button:(0,y.forwardRefWithAs)(function(e,t){let r=(0,l.useId)(),{id:n=`headlessui-disclosure-button-${r}`,disabled:o=!1,autoFocus:f=!1,...m}=e,[p,g]=j("Disclosure.Button"),b=(0,l.useContext)(N),v=null!==b&&b===p.panelId,x=(0,l.useRef)(null),C=(0,u.useSyncRefs)(x,t,(0,c.useEvent)(e=>{if(!v)return g({type:4,element:e})}));(0,l.useEffect)(()=>{if(!v)return g({type:2,buttonId:n}),()=>{g({type:2,buttonId:null})}},[n,g,v]);let w=(0,c.useEvent)(e=>{var t;if(v){if(1===p.disclosureState)return;switch(e.key){case k.Keys.Space:case k.Keys.Enter:e.preventDefault(),e.stopPropagation(),g({type:0}),null==(t=p.buttonElement)||t.focus()}}else switch(e.key){case k.Keys.Space:case k.Keys.Enter:e.preventDefault(),e.stopPropagation(),g({type:0})}}),S=(0,c.useEvent)(e=>{e.key===k.Keys.Space&&e.preventDefault()}),E=(0,c.useEvent)(e=>{var t;(0,h.isDisabledReactIssue7711)(e.currentTarget)||o||(v?(g({type:0}),null==(t=p.buttonElement)||t.focus()):g({type:0}))}),{isFocusVisible:_,focusProps:O}=(0,i.useFocusRing)({autoFocus:f}),{isHovered:$,hoverProps:T}=(0,a.useHover)({isDisabled:o}),{pressed:M,pressProps:R}=(0,s.useActivePress)({disabled:o}),P=(0,l.useMemo)(()=>({open:0===p.disclosureState,hover:$,active:M,disabled:o,focus:_,autofocus:f}),[p,$,M,_,o,f]),I=(0,d.useResolveButtonType)(e,p.buttonElement),D=v?(0,y.mergeProps)({ref:C,type:I,disabled:o||void 0,autoFocus:f,onKeyDown:w,onClick:E},O,T,R):(0,y.mergeProps)({ref:C,id:n,type:I,"aria-expanded":0===p.disclosureState,"aria-controls":p.panelElement?p.panelId:void 0,disabled:o||void 0,autoFocus:f,onKeyDown:w,onKeyUp:S,onClick:E},O,T,R);return(0,y.useRender)()({ourProps:D,theirProps:m,slot:P,defaultTag:"button",name:"Disclosure.Button"})}),Panel:(0,y.forwardRefWithAs)(function(e,t){let r=(0,l.useId)(),{id:n=`headlessui-disclosure-panel-${r}`,transition:o=!1,...i}=e,[a,s]=j("Disclosure.Panel"),{close:d}=function e(t){let r=(0,l.useContext)(_);if(null===r){let r=Error(`<${t} /> is missing a parent component.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,e),r}return r}("Disclosure.Panel"),[m,p]=(0,l.useState)(null),h=(0,u.useSyncRefs)(t,(0,c.useEvent)(e=>{x(()=>s({type:5,element:e}))}),p);(0,l.useEffect)(()=>(s({type:3,panelId:n}),()=>{s({type:3,panelId:null})}),[n,s]);let b=(0,g.useOpenClosed)(),[v,k]=(0,f.useTransition)(o,m,null!==b?(b&g.State.Open)===g.State.Open:0===a.disclosureState),C=(0,l.useMemo)(()=>({open:0===a.disclosureState,close:d}),[a.disclosureState,d]),w={ref:h,id:n,...(0,f.transitionDataAttributes)(k)},S=(0,y.useRender)();return l.default.createElement(g.ResetOpenClosedProvider,null,l.default.createElement(N.Provider,{value:a.panelId},S({ourProps:w,theirProps:i,slot:C,defaultTag:"div",features:T,visible:v,name:"Disclosure.Panel"})))})});e.s(["Disclosure",()=>M],886148);let R=(0,l.createContext)(void 0);var P=e.i(444755);let I=(0,e.i(673706).makeClassName)("Accordion"),D=(0,l.createContext)({isOpen:!1}),L=l.default.forwardRef((e,t)=>{var r;let{defaultOpen:n=!1,children:i,className:a}=e,s=(0,o.__rest)(e,["defaultOpen","children","className"]),c=null!=(r=(0,l.useContext)(R))?r:(0,P.tremorTwMerge)("rounded-tremor-default border");return l.default.createElement(M,Object.assign({as:"div",ref:t,className:(0,P.tremorTwMerge)(I("root"),"overflow-hidden","bg-tremor-background border-tremor-border","dark:bg-dark-tremor-background dark:border-dark-tremor-border",c,a),defaultOpen:n},s),({open:e})=>l.default.createElement(D.Provider,{value:{isOpen:e}},i))});L.displayName="Accordion",e.s(["OpenContext",()=>D,"default",()=>L],543086),e.s(["Accordion",()=>L],677667)},898667,e=>{"use strict";var t=e.i(290571),r=e.i(271645),n=e.i(886148);let o=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 i=e.i(543086),a=e.i(444755);let l=(0,e.i(673706).makeClassName)("AccordionHeader"),s=r.default.forwardRef((e,s)=>{let{children:c,className:d}=e,u=(0,t.__rest)(e,["children","className"]),{isOpen:f}=(0,r.useContext)(i.OpenContext);return r.default.createElement(n.Disclosure.Button,Object.assign({ref:s,className:(0,a.tremorTwMerge)(l("root"),"w-full flex items-center justify-between px-4 py-3","text-tremor-content-emphasis","dark:text-dark-tremor-content-emphasis",d)},u),r.default.createElement("div",{className:(0,a.tremorTwMerge)(l("children"),"flex flex-1 text-inherit mr-4")},c),r.default.createElement("div",null,r.default.createElement(o,{className:(0,a.tremorTwMerge)(l("arrowIcon"),"h-5 w-5 -mr-1","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle",f?"transition-all":"transition-all -rotate-180")})))});s.displayName="AccordionHeader",e.s(["AccordionHeader",()=>s],898667)},130643,e=>{"use strict";var t=e.i(290571),r=e.i(271645),n=e.i(886148),o=e.i(444755);let i=(0,e.i(673706).makeClassName)("AccordionBody"),a=r.default.forwardRef((e,a)=>{let{children:l,className:s}=e,c=(0,t.__rest)(e,["children","className"]);return r.default.createElement(n.Disclosure.Panel,Object.assign({ref:a,className:(0,o.tremorTwMerge)(i("root"),"w-full text-tremor-default px-4 pb-3","text-tremor-content","dark:text-dark-tremor-content",s)},c),l)});a.displayName="AccordionBody",e.s(["AccordionBody",()=>a],130643)},83733,233137,e=>{"use strict";let t,r;var n,o,i=e.i(247167),a=e.i(271645),l=e.i(544508),s=e.i(746725),c=e.i(835696);void 0!==i.default&&"u">typeof globalThis&&"u">typeof Element&&(null==(n=null==i.default?void 0:i.default.env)?void 0:n.NODE_ENV)==="test"&&void 0===(null==(o=null==Element?void 0:Element.prototype)?void 0:o.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 d=((t=d||{})[t.None=0]="None",t[t.Closed=1]="Closed",t[t.Enter=2]="Enter",t[t.Leave=4]="Leave",t);function u(e){let t={};for(let r in e)!0===e[r]&&(t[`data-${r}`]="");return t}function f(e,t,r,n){let[o,i]=(0,a.useState)(r),{hasFlag:d,addFlag:u,removeFlag:f}=function(e=0){let[t,r]=(0,a.useState)(e),n=(0,a.useCallback)(e=>r(e),[t]),o=(0,a.useCallback)(e=>r(t=>t|e),[t]),i=(0,a.useCallback)(e=>(t&e)===e,[t]);return{flags:t,setFlag:n,addFlag:o,hasFlag:i,removeFlag:(0,a.useCallback)(e=>r(t=>t&~e),[r]),toggleFlag:(0,a.useCallback)(e=>r(t=>t^e),[r])}}(e&&o?3:0),m=(0,a.useRef)(!1),p=(0,a.useRef)(!1),g=(0,s.useDisposables)();return(0,c.useIsoMorphicEffect)(()=>{var o;if(e){if(r&&i(!0),!t){r&&u(3);return}return null==(o=null==n?void 0:n.start)||o.call(n,r),function(e,{prepare:t,run:r,done:n,inFlight:o}){let i=(0,l.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:o}),i.nextFrame(()=>{r(),i.requestAnimationFrame(()=>{i.add(function(e,t){var r,n;let o=(0,l.disposables)();if(!e)return o.dispose;let i=!1;o.add(()=>{i=!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(()=>{i||t()}),o.dispose}(e,n))})}),i.dispose}(t,{inFlight:m,prepare(){p.current?p.current=!1:p.current=m.current,m.current=!0,p.current||(r?(u(3),f(4)):(u(4),f(2)))},run(){p.current?r?(f(3),u(4)):(f(4),u(3)):r?f(1):u(1)},done(){var e;p.current&&"function"==typeof t.getAnimations&&t.getAnimations().length>0||(m.current=!1,f(7),r||i(!1),null==(e=null==n?void 0:n.end)||e.call(n,r))}})}},[e,r,t,g]),e?[o,{closed:d(1),enter:d(2),leave:d(4),transition:d(2)||d(4)}]:[r,{closed:void 0,enter:void 0,leave:void 0,transition:void 0}]}e.s(["transitionDataAttributes",()=>u,"useTransition",()=>f],83733);let m=(0,a.createContext)(null);m.displayName="OpenClosedContext";var p=((r=p||{})[r.Open=1]="Open",r[r.Closed=2]="Closed",r[r.Closing=4]="Closing",r[r.Opening=8]="Opening",r);function g(){return(0,a.useContext)(m)}function h({value:e,children:t}){return a.default.createElement(m.Provider,{value:e},t)}function b({children:e}){return a.default.createElement(m.Provider,{value:null},e)}e.s(["OpenClosedProvider",()=>h,"ResetOpenClosedProvider",()=>b,"State",()=>p,"useOpenClosed",()=>g],233137)},233538,e=>{"use strict";function t(e){let t=e.parentElement,r=null;for(;t&&!(t instanceof HTMLFieldSetElement);)t instanceof HTMLLegendElement&&(r=t),t=t.parentElement;let n=(null==t?void 0:t.getAttribute("disabled"))==="";return!(n&&function(e){if(!e)return!1;let t=e.previousElementSibling;for(;null!==t;){if(t instanceof HTMLLegendElement)return!1;t=t.previousElementSibling}return!0}(r))&&n}e.s(["isDisabledReactIssue7711",()=>t])},888288,220508,e=>{"use strict";var t=e.i(271645);let r=(e,r)=>{let n=void 0!==r,[o,i]=(0,t.useState)(e);return[n?r:o,e=>{n||i(e)}]};e.s(["default",()=>r],888288);let n=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"}))});e.s(["CheckCircleIcon",0,n],220508)},503269,214520,601893,694421,140721,942803,35889,722678,e=>{"use strict";var t=e.i(271645),r=e.i(914189);function n(e,n,o){let[i,a]=(0,t.useState)(o),l=void 0!==e,s=(0,t.useRef)(l),c=(0,t.useRef)(!1),d=(0,t.useRef)(!1);return!l||s.current||c.current?l||!s.current||d.current||(d.current=!0,s.current=l,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.")):(c.current=!0,s.current=l,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.")),[l?e:i,(0,r.useEvent)(e=>(l||a(e),null==n?void 0:n(e)))]}function o(e){let[r]=(0,t.useState)(e);return r}e.s(["useControllable",()=>n],503269),e.s(["useDefaultValue",()=>o],214520);let i=(0,t.createContext)(void 0);function a(){return(0,t.useContext)(i)}e.s(["useDisabled",()=>a],601893);var l=e.i(174080),s=e.i(746725);function c(e={},t=null,r=[]){for(let[n,o]of Object.entries(e))!function e(t,r,n){if(Array.isArray(n))for(let[o,i]of n.entries())e(t,d(r,o.toString()),i);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,""]):c(n,r,t)}(r,d(t,n),o);return r}function d(e,t){return e?e+"["+t+"]":t}function u(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",()=>u,"objectToFormEntries",()=>c],694421);var f=e.i(700020),m=e.i(2788);let p=(0,t.createContext)(null);function g({children:e}){let r=(0,t.useContext)(p);if(!r)return t.default.createElement(t.default.Fragment,null,e);let{target:n}=r;return n?(0,l.createPortal)(t.default.createElement(t.default.Fragment,null,e),n):null}function h({data:e,form:r,disabled:n,onReset:o,overrides:i}){let[a,l]=(0,t.useState)(null),d=(0,s.useDisposables)();return(0,t.useEffect)(()=>{if(o&&a)return d.addEventListener(a,"reset",o)},[a,r,o]),t.default.createElement(g,null,t.default.createElement(b,{setForm:l,formId:r}),c(e).map(([e,o])=>t.default.createElement(m.Hidden,{features:m.HiddenFeatures.Hidden,...(0,f.compact)({key:e,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:r,disabled:n,name:e,value:o,...i})})))}function b({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(m.Hidden,{features:m.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",()=>h],140721);let v=(0,t.createContext)(void 0);function y(){return(0,t.useContext)(v)}e.s(["useProvidedId",()=>y],942803);var x=e.i(835696),k=e.i(294316);let C=(0,t.createContext)(null);function w(){var e,r;return null!=(r=null==(e=(0,t.useContext)(C))?void 0:e.value)?r:void 0}function S(){let[e,n]=(0,t.useState)([]);return[e.length>0?e.join(" "):void 0,(0,t.useMemo)(()=>function(e){let o=(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}))),i=(0,t.useMemo)(()=>({register:o,slot:e.slot,name:e.name,props:e.props,value:e.value}),[o,e.slot,e.name,e.props,e.value]);return t.default.createElement(C.Provider,{value:i},e.children)},[n])]}C.displayName="DescriptionContext";let E=Object.assign((0,f.forwardRefWithAs)(function(e,r){let n=(0,t.useId)(),o=a(),{id:i=`headlessui-description-${n}`,...l}=e,s=function e(){let r=(0,t.useContext)(C);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}(),c=(0,k.useSyncRefs)(r);(0,x.useIsoMorphicEffect)(()=>s.register(i),[i,s.register]);let d=o||!1,u=(0,t.useMemo)(()=>({...s.slot,disabled:d}),[s.slot,d]),m={ref:c,...s.props,id:i};return(0,f.useRender)()({ourProps:m,theirProps:l,slot:u,defaultTag:"p",name:s.name||"Description"})}),{});e.s(["Description",()=>E,"useDescribedBy",()=>w,"useDescriptions",()=>S],35889);let j=(0,t.createContext)(null);function _(e){var r,n,o;let i=null!=(n=null==(r=(0,t.useContext)(j))?void 0:r.value)?n:void 0;return(null!=(o=null==e?void 0:e.length)?o:0)>0?[i,...e].filter(Boolean).join(" "):i}function N({inherit:e=!1}={}){let n=_(),[o,i]=(0,t.useState)([]),a=e?[n,...o].filter(Boolean):o;return[a.length>0?a.join(" "):void 0,(0,t.useMemo)(()=>function(e){let n=(0,r.useEvent)(e=>(i(t=>[...t,e]),()=>i(t=>{let r=t.slice(),n=r.indexOf(e);return -1!==n&&r.splice(n,1),r}))),o=(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(j.Provider,{value:o},e.children)},[i])]}j.displayName="LabelContext";let O=Object.assign((0,f.forwardRefWithAs)(function(e,n){var o;let i=(0,t.useId)(),l=function e(){let r=(0,t.useContext)(j);if(null===r){let t=Error("You used a