From bcefd1a22caf4598ff6cd0012d16ec77b630f455 Mon Sep 17 00:00:00 2001 From: Patrick Walukagga Date: Thu, 23 Jul 2026 10:29:47 +0300 Subject: [PATCH 1/2] feat(stt): serve /tasks/audio/transcriptions from 51-language ASR model Replace the Modal/RunPod dispatch behind POST /tasks/audio/transcriptions with Sunbird's faster-whisper ASR deployment (Sunbird/faster-whisper-51-african-languages), expanding coverage from 10 to 51 African languages. All ten previously supported languages remain. The deployment is OpenAI-compatible and maps Sunbird ISO 639-3 codes to Whisper's language-token slots server-side, so codes are forwarded verbatim. Because the fine-tune reuses those slots, auto-detection is unreliable and `language` stays required. BREAKING CHANGE: the endpoint no longer accepts `platform`, `adapter`, `whisper`, `recognise_speakers`, `org`, or `gcs_blob_name`; they now return 422. Speaker diarization and the organization workflow remain available on the deprecated /tasks/stt* routes. - add ASRService (app/services/asr_service.py) wrapping the deployment, mapping HTTP/timeout/connection/parse failures to ExternalServiceError - add ASR_BASE_URL, ASR_MODEL_NAME and ASR_TIMEOUT_SECONDS settings; promote RUNPOD_API_KEY to a Settings field and document all four in .env.example. ASR_BASE_URL has no working default and must be set. - add ASRLanguage (51 codes) and TranscriptionSegment; STTTranscript gains optional `segments` (via timestamps=true) and `duration_seconds` - retire TranscriptionService, which existed only to dispatch across the removed platforms - update app/docs.py, docs/tutorial.md and the React Tutorial page with the full 51-language list and the breaking-change notice Co-Authored-By: Claude Opus 4.8 --- .env.example | 9 + app/core/config.py | 28 ++ app/deps.py | 13 +- app/docs.py | 35 +- app/routers/audio.py | 280 ++++++---------- app/schemas/stt.py | 149 ++++++++- app/services/asr_service.py | 315 ++++++++++++++++++ app/services/transcription_service.py | 157 --------- .../{index-BitrVV8a.js => index-2D4AqWZy.js} | 154 +++++---- app/static/react_build/index.html | 2 +- app/tests/test_asr_service.py | 159 +++++++++ app/tests/test_audio_transcriptions.py | 253 ++++++++------ app/tests/test_transcription_service.py | 258 -------------- docs/tutorial.md | 210 ++++++++---- frontend/src/pages/Tutorial.tsx | 242 ++++++++++---- 15 files changed, 1354 insertions(+), 910 deletions(-) create mode 100644 app/services/asr_service.py delete mode 100644 app/services/transcription_service.py rename app/static/react_build/assets/{index-BitrVV8a.js => index-2D4AqWZy.js} (88%) create mode 100644 app/tests/test_asr_service.py delete mode 100644 app/tests/test_transcription_service.py diff --git a/.env.example b/.env.example index 4e0fc4c7..e1357042 100644 --- a/.env.example +++ b/.env.example @@ -79,6 +79,15 @@ SIGNED_URL_EXPIRY_MINUTES=30 RUNPOD_API_KEY=your-runpod-api-key RUNPOD_ENDPOINT_ID=your-runpod-endpoint-id +# Speech-to-text: Sunbird faster-whisper ASR, 51 African languages +# (Sunbird/faster-whisper-51-african-languages), served behind an +# OpenAI-compatible API. Required by POST /tasks/audio/transcriptions. +# Must include the trailing /v1 — the service appends /audio/transcriptions. +# Authenticates with RUNPOD_API_KEY above. +ASR_BASE_URL=https://your-endpoint-id.api.runpod.ai/v1 +# ASR_MODEL_NAME=sunbird-asr-51 +# ASR_TIMEOUT_SECONDS=600 + # Sunflower chat/inference endpoints (RunPod, OpenAI-compatible). # The /tasks/chat/completions endpoint serves two models: # - sunflower-14b (default) -> SUNFLOWER_14B_ENDPOINT_ID diff --git a/app/core/config.py b/app/core/config.py index 6bf7f843..39409f20 100644 --- a/app/core/config.py +++ b/app/core/config.py @@ -51,6 +51,34 @@ class Settings(BaseSettings): default=10000, description="Maximum allowed text length for TTS" ) + # Sunbird ASR (faster-whisper, 51 African languages) Configuration + runpod_api_key: Optional[str] = Field( + default=None, + alias="RUNPOD_API_KEY", + description="RunPod API key, used as the bearer token for the ASR deployment", + ) + asr_base_url: str = Field( + default="https://.api.runpod.ai/v1", + alias="ASR_BASE_URL", + description=( + "Base URL of the OpenAI-compatible faster-whisper ASR deployment " + "serving Sunbird/faster-whisper-51-african-languages" + ), + ) + asr_model_name: str = Field( + default="sunbird-asr-51", + alias="ASR_MODEL_NAME", + description="Model name sent to the ASR deployment", + ) + asr_timeout_seconds: int = Field( + default=600, + alias="ASR_TIMEOUT_SECONDS", + description=( + "Timeout for ASR requests in seconds. Generous by default: a cold " + "start plus first-time model download can take several minutes." + ), + ) + # GCP Storage Configuration gcp_bucket_name: str = Field( default="your-tts-audio-bucket", diff --git a/app/deps.py b/app/deps.py index 86c6a25f..a1f722c4 100644 --- a/app/deps.py +++ b/app/deps.py @@ -43,6 +43,7 @@ async def endpoint( from app.schemas.users import TokenData, User # Service imports +from app.services.asr_service import ASRService, get_asr_service from app.services.billing_analytics.service import ( BillingAnalyticsService, get_billing_analytics_service, @@ -65,10 +66,6 @@ async def endpoint( from app.services.storage_service import StorageService from app.services.storage_service import get_storage_service as get_new_storage_service from app.services.stt_service import STTService, get_stt_service -from app.services.transcription_service import ( - TranscriptionService, - get_transcription_service, -) from app.services.translation_service import TranslationService, get_translation_service from app.services.tts_service import TTSService, get_tts_service from app.services.whatsapp_service import WhatsAppBusinessService, get_whatsapp_service @@ -85,9 +82,7 @@ async def endpoint( # Service dependencies STTServiceDep = Annotated[STTService, Depends(get_stt_service)] ModalSTTServiceDep = Annotated[ModalSTTService, Depends(get_modal_stt_service)] -TranscriptionServiceDep = Annotated[ - TranscriptionService, Depends(get_transcription_service) -] +ASRServiceDep = Annotated[ASRService, Depends(get_asr_service)] TTSServiceDep = Annotated[TTSService, Depends(get_tts_service)] OrpheusTTSServiceDep = Annotated[OrpheusTTSService, Depends(get_orpheus_tts_service)] TranslationServiceDep = Annotated[TranslationService, Depends(get_translation_service)] @@ -234,7 +229,7 @@ async def get_current_admin( # Service dependencies "STTServiceDep", "ModalSTTServiceDep", - "TranscriptionServiceDep", + "ASRServiceDep", "TTSServiceDep", "OrpheusTTSServiceDep", "TranslationServiceDep", @@ -260,7 +255,7 @@ async def get_current_admin( # Service classes (for type hints) "STTService", "ModalSTTService", - "TranscriptionService", + "ASRService", "TTSService", "OrpheusTTSService", "TranslationService", diff --git a/app/docs.py b/app/docs.py index f7439c38..80a7b29c 100644 --- a/app/docs.py +++ b/app/docs.py @@ -36,13 +36,32 @@ (supports Acholi, Ateso, English, Luganda, Lugbara, Runyankole) ### Speech-to-Text (STT) -- **`POST /tasks/audio/transcriptions`** - Unified STT endpoint (OpenAI-style). - - Accepts an uploaded audio file (`audio`) or a GCS object (`gcs_blob_name`). - - `platform`: `modal` (default, Whisper large-v3) or `runpod`. - - RunPod options: `adapter` (language adapter), `whisper`, `recognise_speakers` - (diarization), and the `org` organization workflow. - - `language`: 3-letter code (e.g. `eng`, `lug`) or full name; improves accuracy. - Supports WAV, MP3, OGG, M4A, and more. Auto-detects when omitted. +- **`POST /tasks/audio/transcriptions`** - STT endpoint, powered by + Sunbird's faster-whisper ASR model covering **51 African languages** + (`Sunbird/faster-whisper-51-african-languages`, a Whisper large-v3 fine-tune). + - `audio`: the audio file to transcribe (**required**). Supports WAV, MP3, + OGG, M4A, and more. + - `language`: ISO 639-3 code (**required**). The model reuses Whisper's + language-token slots for African languages, so automatic detection is + unreliable — always pass a language explicitly. + - `timestamps`: set `true` to also receive per-segment start/end times in the + `segments` field. Defaults to `false`. + - **51 supported languages**: Acholi (`ach`), Afrikaans (`afr`), Akan (`aka`), + Amharic (`amh`), Ateso (`teo`), Bambara (`bam`), Bemba (`bem`), + Berber (`ber`), Chichewa (`nya`), Dagaare (`dga`), Dagbani (`dag`), + English (`eng`), Ewe (`ewe`), French (`fra`), Fulani (`ful`), Hausa (`hau`), + Igbo (`ibo`), Ikposo (`kpo`), Kabyle (`kab`), Kalenjin (`kln`), + Kanuri (`kau`), Kikuyu (`kik`), Kinyarwanda (`kin`), Kwamba (`rwm`), + Lendu (`led`), Lingala (`lin`), Lugbara (`lgg`), Luganda (`lug`), + Luhya (`luy`), Lumasaba (`myx`), Luo (`luo`), Lusoga (`xog`), + Malagasy (`mlg`), Ndebele (`nbl`), Nigerian Pidgin (`pcm`), Oromo (`orm`), + Rukiga (`cgg`), Rukonjo (`koo`), Runyankole (`nyn`), Ruruuli (`ruc`), + Rutooro (`ttj`), Shona (`sna`), Somali (`som`), Sotho (`sot`), + Swahili (`swa`), Thur (`lth`), Tswana (`tsn`), Wolof (`wol`), + Xhosa (`xho`), Yoruba (`yor`), Zulu (`zul`). + - **Removed parameters** (previously accepted, now rejected): `platform`, + `adapter`, `whisper`, `recognise_speakers`, `org`, `gcs_blob_name`. Speaker + diarization and the organization workflow remain on the legacy routes below. - **Deprecated** → use `POST /tasks/audio/transcriptions`: - `POST /tasks/stt`, `POST /tasks/stt_from_gcs`, `POST /tasks/org/stt`, `POST /tasks/modal/stt` @@ -116,7 +135,7 @@ }, { "name": "Speech-to-Text", - "description": "Convert speech audio to text. The unified /tasks/audio/transcriptions endpoint accepts an uploaded file or a GCS object, routes to the Modal or RunPod backend, and supports optional speaker diarization for Acholi, Ateso, English, Luganda, Lugbara, and Runyankole.", # noqa: E501 + "description": "Convert speech audio to text. The unified /tasks/audio/transcriptions endpoint is powered by Sunbird's faster-whisper ASR model covering 51 African languages. It takes an uploaded audio file plus a required ISO 639-3 language code, and optionally returns per-segment timestamps (timestamps=true). Speaker diarization and the organization workflow remain on the deprecated /tasks/stt* routes.", # noqa: E501 }, { "name": "Text-to-Speech", diff --git a/app/routers/audio.py b/app/routers/audio.py index 84b92623..e279fba0 100644 --- a/app/routers/audio.py +++ b/app/routers/audio.py @@ -10,9 +10,8 @@ import tempfile import time import uuid -from typing import Optional +from typing import Optional, Tuple -import aiofiles from fastapi import ( APIRouter, BackgroundTasks, @@ -26,6 +25,7 @@ ) from sqlalchemy.ext.asyncio import AsyncSession +from app.core.config import settings from app.core.exceptions import ( BadRequestError, ExternalServiceError, @@ -35,10 +35,10 @@ ) from app.crud.audio_transcription import create_audio_transcription from app.deps import ( + ASRServiceDep, LegacyStorageServiceDep, QuotaServiceDep, SpeechServiceDep, - TranscriptionServiceDep, TTSServiceDep, get_current_user, get_db, @@ -55,23 +55,14 @@ SpeechResponse, TTSModel, ) -from app.schemas.stt import ( - CHUNK_SIZE, - SttbLanguage, - STTTranscript, - TranscriptionPlatform, -) +from app.schemas.stt import ASRLanguage, STTTranscript, TranscriptionSegment from app.schemas.tts import TTSRequest as ModalTTSRequest from app.services.speech_service import SpeechService -from app.services.stt_service import ( - AudioProcessingError, - AudioValidationError, - TranscriptionError, -) from app.utils.audio import get_audio_extension from app.utils.feedback import INFERENCE_TYPES, save_api_inference from app.utils.quota_guard import check_quota from app.utils.rate_limit import get_account_type_limit, limiter +from app.utils.upload_audio_file_gcp import upload_audio_file logging.basicConfig(level=logging.INFO) @@ -83,186 +74,137 @@ response_model=STTTranscript, summary="Transcribe audio (unified STT endpoint)", description=( - "Unified Speech-to-Text endpoint. Accepts an uploaded audio file or a " - "GCS blob, routes to Modal or RunPod, and supports the RunPod " - "organization workflow. Replaces /stt, /stt_from_gcs, /org/stt, and " - "/modal/stt." + "Unified Speech-to-Text endpoint, powered by Sunbird's " + "faster-whisper ASR model covering 51 African languages. Accepts an " + "uploaded audio file and a required language code; set timestamps=true " + "to also receive per-segment timings. Replaces /stt, /stt_from_gcs, " + "/org/stt, and /modal/stt." ), tags=["Speech-to-Text"], ) @limiter.limit(get_account_type_limit) -async def create_transcription( # noqa: C901 +async def create_transcription( request: Request, background_tasks: BackgroundTasks, quota: QuotaServiceDep, - transcription_service: TranscriptionServiceDep, - language: SttbLanguage = Form(..., description="Target language code."), - # NOTE: annotate as plain ``UploadFile`` (not ``Optional[UploadFile]``) so the - # OpenAPI schema is a clean ``{type: string, format: binary}`` instead of an - # ``anyOf`` with null. Swagger UI only renders the file-picker widget for the - # former; the field stays optional via ``default=None`` (gcs_blob_name is the - # alternative input). - audio: UploadFile = File(default=None, description="Audio file to transcribe."), - gcs_blob_name: Optional[str] = Form( - default=None, description="GCS blob name (RunPod only)." - ), - platform: TranscriptionPlatform = Form( - default=TranscriptionPlatform.modal, - description="Transcription platform: 'modal' (default) or 'runpod'.", + asr_service: ASRServiceDep, + audio: UploadFile = File(..., description="Audio file to transcribe."), + language: ASRLanguage = Form( + ..., + description=( + "Language of the audio (ISO 639-3). Required: this model reuses " + "Whisper's language-token slots, so auto-detection is unreliable." + ), ), - # Annotate as plain ``SttbLanguage`` (not ``Optional[...]``) so the OpenAPI - # schema is a clean enum ref and Swagger UI renders a dropdown like - # ``language``; the field stays optional via ``default=None`` and falls back - # to ``language`` below. - adapter: SttbLanguage = Form( - default=None, - description="Language adapter (RunPod only). Defaults to the language.", - ), - # Plain ``bool`` (not ``Optional[bool]``) so Swagger renders a true/false - # selector instead of a free-text box. RunPod-only; both default to False. - whisper: bool = Form(default=False, description="Use Whisper (RunPod only)."), - recognise_speakers: bool = Form( + timestamps: bool = Form( default=False, - description="Enable speaker diarization (RunPod only).", - ), - org: bool = Form( - default=False, description="Use the RunPod organization workflow." + description="Return per-segment start/end timestamps in 'segments'.", ), db: AsyncSession = Depends(get_db), current_user=Depends(get_current_user), ) -> STTTranscript: - """Transcribe audio via the selected platform and workflow.""" + """Transcribe audio with the Sunbird 51-African-language ASR model.""" await check_quota(quota, db, current_user) start_time = time.time() - has_audio = audio is not None and bool(audio.filename) - resolved_whisper, resolved_speakers = transcription_service.validate_and_normalize( - platform=platform.value, - has_audio=has_audio, - gcs_blob_name=gcs_blob_name, - org=org, - whisper=whisper, - recognise_speakers=recognise_speakers, + if not audio.filename: + raise ValidationError( + message="An 'audio' file is required.", + errors=[{"field": "audio", "value": None}], + ) + + file_extension = get_audio_extension(audio.filename) + audio_bytes = await audio.read() + + result = await asr_service.transcribe( + audio_bytes=audio_bytes, + language=language.value, + filename=audio.filename, + content_type=audio.content_type, + timestamps=timestamps, ) - adapter_value = (adapter or language).value - file_path: Optional[str] = None - try: - if platform == TranscriptionPlatform.modal: - audio_bytes = await audio.read() - result = await transcription_service.transcribe( - platform="modal", - language=language.value, - adapter=adapter_value, - audio_bytes=audio_bytes, - ) - elif gcs_blob_name: - result = await transcription_service.transcribe( - platform="runpod", - language=language.value, - adapter=adapter_value, - gcs_blob_name=gcs_blob_name, - whisper=resolved_whisper, - recognise_speakers=resolved_speakers, - ) - else: - content_type = audio.content_type - file_extension = get_audio_extension(audio.filename) - with tempfile.NamedTemporaryFile( - delete=False, suffix=file_extension - ) as temp_file: - file_path = temp_file.name - async with aiofiles.open(file_path, "wb") as out_file: - while content := await audio.read(CHUNK_SIZE): - await out_file.write(content) - result = await transcription_service.transcribe( - platform="runpod", - language=language.value, - adapter=adapter_value, - org=org, - whisper=resolved_whisper, - recognise_speakers=resolved_speakers, - file_path=file_path, - file_extension=file_extension, - content_type=content_type, + elapsed_time = time.time() - start_time + + audio_url, blob_name = _store_audio( + audio_bytes=audio_bytes, file_extension=file_extension + ) + + audio_transcription_id = None + if result.text: + try: + db_obj = await create_audio_transcription( + db, + current_user, + audio_url, + blob_name, + result.text, + language.value, ) + audio_transcription_id = db_obj.id + except Exception as e: + logging.error(f"Database error: {str(e)}") + + response = STTTranscript( + audio_transcription=result.text, + diarization_output={}, + formatted_diarization_output="", + audio_transcription_id=audio_transcription_id, + audio_url=audio_url, + language=language.value, + was_audio_trimmed=False, + original_duration_minutes=None, + segments=[ + TranscriptionSegment(start=s.start, end=s.end, text=s.text) + for s in result.segments + ] + if timestamps + else None, + duration_seconds=result.duration, + ) - elapsed_time = time.time() - start_time + _schedule_stt_feedback( + background_tasks=background_tasks, + user=current_user, + source=audio.filename, + transcription=result.text, + audio_url=audio_url, + blob_name=blob_name, + language=language.value, + adapter=language.value, + whisper=True, + processing_time=elapsed_time, + model_type=settings.asr_model_name, + org=False, + ) - audio_transcription_id = None - should_persist = platform == TranscriptionPlatform.runpod and not org - if should_persist and result.transcription: - try: - db_obj = await create_audio_transcription( - db, - current_user, - result.audio_url, - result.blob_name, - result.transcription, - language.value, - ) - audio_transcription_id = db_obj.id - except Exception as e: - logging.error(f"Database error: {str(e)}") - - response = STTTranscript( - audio_transcription=result.transcription, - diarization_output=result.diarization_output, - formatted_diarization_output=result.formatted_diarization_output, - audio_transcription_id=audio_transcription_id, - audio_url=result.audio_url, - language=language.value, - was_audio_trimmed=result.was_trimmed, - original_duration_minutes=result.original_duration - if result.was_trimmed - else None, - ) + return response - _schedule_stt_feedback( - background_tasks=background_tasks, - user=current_user, - source=gcs_blob_name or (audio.filename if audio else "uploaded_audio"), - transcription=result.transcription, - audio_url=result.audio_url, - blob_name=result.blob_name, - language=language.value, - adapter=adapter_value, - whisper=resolved_whisper - if platform == TranscriptionPlatform.runpod - else True, - processing_time=elapsed_time, - model_type="whisper-modal" - if platform == TranscriptionPlatform.modal - else None, - org=org, - ) - return response +def _store_audio( + *, audio_bytes: bytes, file_extension: str +) -> Tuple[Optional[str], Optional[str]]: + """Upload the submitted audio to GCS, returning ``(audio_url, blob_name)``. - except AudioValidationError as e: - raise ValidationError( - message=str(e), errors=[{"field": "audio", "value": None}] - ) - except AudioProcessingError as e: - raise BadRequestError(message=str(e)) - except TranscriptionError as e: - raise ExternalServiceError( - service_name="STT Transcription Service", message=str(e) - ) - except ( - BadRequestError, - ValidationError, - ExternalServiceError, - ServiceUnavailableError, - ): - raise + ``audio_url`` is a ``gs://`` URI, matching the legacy RunPod STT path. + Storage is best-effort: a failure here must not fail an otherwise + successful transcription, so both values fall back to ``None``. + """ + file_path: Optional[str] = None + try: + with tempfile.NamedTemporaryFile( + delete=False, suffix=file_extension + ) as temp_file: + temp_file.write(audio_bytes) + file_path = temp_file.name + uploaded = upload_audio_file(file_path=file_path) + if not uploaded: + return None, None + blob_name, blob_url = uploaded + return blob_url, blob_name except Exception as e: - logging.error(f"Unexpected error in create_transcription: {str(e)}") - raise ExternalServiceError( - service_name="STT Service", - message="An unexpected error occurred while processing your request", - original_error=str(e), - ) + logging.warning(f"Failed to store transcription audio: {e}") + return None, None finally: if file_path and os.path.exists(file_path): try: diff --git a/app/schemas/stt.py b/app/schemas/stt.py index e5a7d9ee..ad8f9830 100644 --- a/app/schemas/stt.py +++ b/app/schemas/stt.py @@ -17,13 +17,136 @@ """ from enum import Enum -from typing import Any, Dict, Optional +from typing import Any, Dict, List, Optional from pydantic import BaseModel, Field from app.utils.audio import AUDIO_MIME_TYPES +class ASRLanguage(str, Enum): + """Languages supported by the Sunbird 51-African-language ASR model. + + Values are the ISO 639-3 codes accepted by + ``Sunbird/faster-whisper-51-african-languages``. The deployment maps these + to the underlying Whisper language-token slots server-side, so the codes + below are passed through verbatim. + + Note: + The fine-tune reuses Whisper's built-in language-token slots for + African languages, which makes automatic language detection + meaningless. A language must always be supplied explicitly. + """ + + acholi = "ach" + afrikaans = "afr" + akan = "aka" + amharic = "amh" + bambara = "bam" + bemba = "bem" + berber = "ber" + rukiga = "cgg" + dagbani = "dag" + dagaare = "dga" + english = "eng" + ewe = "ewe" + french = "fra" + fulani = "ful" + hausa = "hau" + igbo = "ibo" + kabyle = "kab" + kanuri = "kau" + kikuyu = "kik" + kinyarwanda = "kin" + kalenjin = "kln" + rukonjo = "koo" + ikposo = "kpo" + lendu = "led" + lugbara = "lgg" + lingala = "lin" + thur = "lth" + luganda = "lug" + luo = "luo" + luhya = "luy" + malagasy = "mlg" + lumasaba = "myx" + ndebele = "nbl" + chichewa = "nya" + runyankole = "nyn" + oromo = "orm" + nigerian_pidgin = "pcm" + ruruuli = "ruc" + kwamba = "rwm" + shona = "sna" + somali = "som" + sotho = "sot" + swahili = "swa" + ateso = "teo" + tswana = "tsn" + rutooro = "ttj" + wolof = "wol" + xhosa = "xho" + lusoga = "xog" + yoruba = "yor" + zulu = "zul" + + +#: Human-readable names for every :class:`ASRLanguage` code. +ASR_LANGUAGE_NAMES: Dict[str, str] = { + "ach": "Acholi", + "afr": "Afrikaans", + "aka": "Akan", + "amh": "Amharic", + "bam": "Bambara", + "bem": "Bemba", + "ber": "Berber", + "cgg": "Rukiga", + "dag": "Dagbani", + "dga": "Dagaare", + "eng": "English", + "ewe": "Ewe", + "fra": "French", + "ful": "Fulani", + "hau": "Hausa", + "ibo": "Igbo", + "kab": "Kabyle", + "kau": "Kanuri", + "kik": "Kikuyu", + "kin": "Kinyarwanda", + "kln": "Kalenjin", + "koo": "Rukonjo", + "kpo": "Ikposo", + "led": "Lendu", + "lgg": "Lugbara", + "lin": "Lingala", + "lth": "Thur", + "lug": "Luganda", + "luo": "Luo", + "luy": "Luhya", + "mlg": "Malagasy", + "myx": "Lumasaba", + "nbl": "Ndebele", + "nya": "Chichewa", + "nyn": "Runyankole", + "orm": "Oromo", + "pcm": "Nigerian Pidgin", + "ruc": "Ruruuli", + "rwm": "Kwamba", + "sna": "Shona", + "som": "Somali", + "sot": "Sotho", + "swa": "Swahili", + "teo": "Ateso", + "tsn": "Tswana", + "ttj": "Rutooro", + "wol": "Wolof", + "xho": "Xhosa", + "xog": "Lusoga", + "yor": "Yoruba", + "zul": "Zulu", +} + + class SttbLanguage(str, Enum): """Supported languages for Speech-to-Text transcription. @@ -67,6 +190,20 @@ class TranscriptionPlatform(str, Enum): runpod = "runpod" +class TranscriptionSegment(BaseModel): + """A single timestamped span of transcribed audio. + + Attributes: + start: Segment start time in seconds from the beginning of the audio. + end: Segment end time in seconds from the beginning of the audio. + text: The text transcribed for this span. + """ + + start: float = Field(..., description="Segment start time in seconds") + end: float = Field(..., description="Segment end time in seconds") + text: str = Field(..., description="Text transcribed for this segment") + + class STTTranscript(BaseModel): """Response model for speech-to-text transcription results. @@ -109,6 +246,16 @@ class STTTranscript(BaseModel): original_duration_minutes: Optional[float] = Field( None, description="Original duration in minutes if audio was trimmed" ) + segments: Optional[List[TranscriptionSegment]] = Field( + None, + description=( + "Timestamped segments. Only populated when the request sets " + "timestamps=true" + ), + ) + duration_seconds: Optional[float] = Field( + None, description="Duration of the transcribed audio in seconds" + ) class STTFromGCSRequest(BaseModel): diff --git a/app/services/asr_service.py b/app/services/asr_service.py new file mode 100644 index 00000000..bc29615a --- /dev/null +++ b/app/services/asr_service.py @@ -0,0 +1,315 @@ +""" +Sunbird ASR Service Module. + +Client for the OpenAI-compatible faster-whisper deployment serving +``Sunbird/faster-whisper-51-african-languages`` — a Whisper large-v3 fine-tune +covering 51 African languages. + +Architecture: + Router -> ASRService -> POST {ASR_BASE_URL}/audio/transcriptions + +The deployment accepts Sunbird ISO 639-3 codes (``lug``, ``ach``, ...) directly +and maps them to the underlying Whisper language-token slots server-side, so +codes are forwarded verbatim. The fine-tune reuses those slots for African +languages, which makes automatic language detection meaningless — a language is +always required. + +Usage: + from app.services.asr_service import ASRService, get_asr_service + + @router.post("/audio/transcriptions") + async def transcribe( + audio: UploadFile, + service: Annotated[ASRService, Depends(get_asr_service)], + ): + result = await service.transcribe( + audio_bytes=await audio.read(), + filename=audio.filename, + language="lug", + ) + return {"audio_transcription": result.text} +""" + +from dataclasses import dataclass, field +from typing import List, Optional + +import httpx + +from app.core.config import settings +from app.core.exceptions import APIException +from app.services.base import BaseService + +#: Fallback content type when the client does not supply one. +DEFAULT_AUDIO_CONTENT_TYPE = "application/octet-stream" + + +@dataclass +class ASRSegment: + """A timestamped span of transcribed audio.""" + + start: float + end: float + text: str + + +@dataclass +class ASRResult: + """Outcome of a transcription request. + + Attributes: + text: The full transcript. + language: Language code echoed back by the deployment. + duration: Duration of the transcribed audio in seconds, if reported. + segments: Timestamped segments, empty unless requested. + """ + + text: str + language: Optional[str] = None + duration: Optional[float] = None + segments: List[ASRSegment] = field(default_factory=list) + + +class ASRService(BaseService): + """Client for the Sunbird 51-language faster-whisper ASR deployment. + + Attributes: + base_url: Base URL of the OpenAI-compatible ASR server (``.../v1``). + model: Model name sent with each request. + api_key: Bearer token for the deployment. + timeout: Request timeout in seconds. + """ + + EXTERNAL_SERVICE_NAME = "Sunbird ASR API" + + def __init__( + self, + base_url: Optional[str] = None, + model: Optional[str] = None, + api_key: Optional[str] = None, + timeout: Optional[int] = None, + ) -> None: + """Initialize the ASR service. + + Args: + base_url: ASR base URL. Defaults to ``settings.asr_base_url``. + model: Model name. Defaults to ``settings.asr_model_name``. + api_key: Bearer token. Defaults to ``settings.runpod_api_key``. + timeout: Timeout in seconds. Defaults to + ``settings.asr_timeout_seconds``. + """ + super().__init__() + self.base_url = (base_url or settings.asr_base_url).rstrip("/") + self.model = model or settings.asr_model_name + self.api_key = api_key if api_key is not None else settings.runpod_api_key + self.timeout = timeout or settings.asr_timeout_seconds + + self.log_debug( + "Sunbird ASR service initialized", + extra={ + "base_url": self.base_url, + "model": self.model, + "timeout": self.timeout, + }, + ) + + @property + def transcriptions_url(self) -> str: + """Full URL of the transcriptions endpoint.""" + return f"{self.base_url}/audio/transcriptions" + + async def transcribe( + self, + *, + audio_bytes: bytes, + language: str, + filename: Optional[str] = None, + content_type: Optional[str] = None, + timestamps: bool = False, + ) -> ASRResult: + """Transcribe audio via the Sunbird 51-language ASR deployment. + + Args: + audio_bytes: Raw audio file bytes. + language: ISO 639-3 code supported by the model (e.g. ``"lug"``). + filename: Original filename, forwarded so the server can infer the + container format. + content_type: MIME type of the upload. + timestamps: Request ``verbose_json`` and return per-segment + timestamps. When False the server returns text only. + + Returns: + An :class:`ASRResult`. + + Raises: + ExternalServiceError: If the deployment errors, times out, is + unreachable, or returns an unparseable body. + """ + response_format = "verbose_json" if timestamps else "json" + + files = { + "file": ( + filename or "audio", + audio_bytes, + content_type or DEFAULT_AUDIO_CONTENT_TYPE, + ) + } + data = { + "model": self.model, + "language": language, + "response_format": response_format, + } + if timestamps: + data["timestamp_granularities[]"] = "segment" + + headers = {"Authorization": f"Bearer {self.api_key}"} if self.api_key else {} + + self.log_info( + "Transcribing audio", + extra={ + "audio_bytes": len(audio_bytes), + "language": language, + "response_format": response_format, + }, + ) + + try: + async with httpx.AsyncClient(timeout=self.timeout) as client: + response = await client.post( + self.transcriptions_url, + files=files, + data=data, + headers=headers, + ) + + if response.status_code != 200: + self.log_error( + "Sunbird ASR API returned error", + extra={ + "status_code": response.status_code, + "response_text": response.text[:500], + }, + ) + raise self.external_service_error( + service_name=self.EXTERNAL_SERVICE_NAME, + message=f"ASR API error: {response.text[:500]}", + original_error=f"HTTP {response.status_code}", + ) + + return self._parse_result(response.json(), fallback_language=language) + + except httpx.TimeoutException as e: + self.log_error("Sunbird ASR API timeout", exc_info=e) + raise self.external_service_error( + service_name=self.EXTERNAL_SERVICE_NAME, + message=( + "ASR service timed out - the audio may be too long, or the " + "endpoint may be cold-starting. Please retry." + ), + original_error=str(e), + ) + except httpx.RequestError as e: + self.log_error("Sunbird ASR API request error", exc_info=e) + raise self.external_service_error( + service_name=self.EXTERNAL_SERVICE_NAME, + message="Failed to connect to the ASR service", + original_error=str(e), + ) + except APIException: + raise + except Exception as e: + self.log_error("Unexpected error during transcription", exc_info=e) + raise self.external_service_error( + service_name=self.EXTERNAL_SERVICE_NAME, + message="Unexpected error during transcription", + original_error=str(e), + ) + + def _parse_result(self, payload: object, *, fallback_language: str) -> ASRResult: + """Parse an OpenAI-style transcription body into an :class:`ASRResult`. + + Args: + payload: Decoded JSON body from the deployment. + fallback_language: Language to report when the body omits one. + + Returns: + The parsed result. + + Raises: + ExternalServiceError: If the body is not a JSON object with ``text``. + """ + if not isinstance(payload, dict) or "text" not in payload: + self.log_error( + "Failed to parse ASR response", + extra={"response": str(payload)[:500]}, + ) + raise self.external_service_error( + service_name=self.EXTERNAL_SERVICE_NAME, + message="Unexpected response format from the ASR service", + original_error="missing 'text' field", + ) + + segments = [ + ASRSegment( + start=float(segment.get("start", 0.0)), + end=float(segment.get("end", 0.0)), + text=str(segment.get("text", "")).strip(), + ) + for segment in (payload.get("segments") or []) + if isinstance(segment, dict) + ] + + duration = payload.get("duration") + result = ASRResult( + text=str(payload["text"]).strip(), + language=payload.get("language") or fallback_language, + duration=float(duration) if duration is not None else None, + segments=segments, + ) + + self.log_info( + "Transcription completed", + extra={ + "transcription_length": len(result.text), + "segment_count": len(result.segments), + }, + ) + return result + + async def health_check(self) -> bool: + """Check whether the ASR deployment is reachable. + + Returns: + True if ``/models`` responds with a non-5xx status, False otherwise. + """ + try: + async with httpx.AsyncClient(timeout=10) as client: + response = await client.get(f"{self.base_url}/models") + return response.status_code < 500 + except Exception as e: + self.log_warning("Health check failed", extra={"error": str(e)}) + return False + + +# ----------------------------------------------------------------------------- +# Dependency Injection +# ----------------------------------------------------------------------------- + +_asr_service: Optional[ASRService] = None + + +def get_asr_service() -> ASRService: + """Get or create the ASR service singleton. + + Returns: + ASRService configured from application settings. + """ + global _asr_service + if _asr_service is None: + _asr_service = ASRService() + return _asr_service + + +def reset_asr_service() -> None: + """Reset the ASR service singleton. Used for testing.""" + global _asr_service + _asr_service = None diff --git a/app/services/transcription_service.py b/app/services/transcription_service.py deleted file mode 100644 index 7cbe1c84..00000000 --- a/app/services/transcription_service.py +++ /dev/null @@ -1,157 +0,0 @@ -"""TranscriptionService facade for the unified STT endpoint. - -Routes a transcription request to the correct underlying service based on the -selected platform and the organization flag, after validating that the -requested combination of inputs is supported. No transcription business logic -lives here — it composes the existing STTService and ModalSTTService. -""" - -from typing import Optional, Tuple - -from app.core.exceptions import BadRequestError -from app.services.modal_stt_service import ModalSTTService, get_modal_stt_service -from app.services.stt_service import STTService, TranscriptionResult, get_stt_service - - -class TranscriptionService: - """Dispatches transcription requests across Modal and RunPod backends.""" - - def __init__( - self, - stt_service: Optional[STTService] = None, - modal_stt_service: Optional[ModalSTTService] = None, - ) -> None: - self._stt = stt_service or get_stt_service() - self._modal = modal_stt_service or get_modal_stt_service() - - def validate_and_normalize( - self, - *, - platform: str, - has_audio: bool, - gcs_blob_name: Optional[str], - org: bool, - whisper: bool, - recognise_speakers: bool, - ) -> Tuple[bool, bool]: - """Validate the request combination and resolve the RunPod flags. - - ``whisper`` and ``recognise_speakers`` are RunPod-only and default to - ``False``. For RunPod they pass through unchanged; for Modal they must - be ``False`` (Modal does not support them) and the returned values are - unused. - - Returns: - (whisper, recognise_speakers) for RunPod; (False, False) for Modal. - - Raises: - BadRequestError: If the input combination is unsupported (HTTP 400). - """ - if platform not in ("modal", "runpod"): - raise BadRequestError( - message=f"Unsupported platform '{platform}'. Use 'modal' or 'runpod'." - ) - - has_gcs = bool(gcs_blob_name) - if has_audio and has_gcs: - raise BadRequestError( - message="Provide either 'audio' or 'gcs_blob_name', not both." - ) - if not has_audio and not has_gcs: - raise BadRequestError( - message="One of 'audio' or 'gcs_blob_name' is required." - ) - - if platform == "modal": - if has_gcs: - raise BadRequestError( - message="GCS input is not supported on the 'modal' platform; " - "use platform='runpod'." - ) - if org: - raise BadRequestError( - message="The organization workflow (org=true) is only available " - "on the 'runpod' platform." - ) - if whisper or recognise_speakers: - raise BadRequestError( - message="'whisper' and 'recognise_speakers' are RunPod-only " - "options; leave them false when platform='modal'." - ) - return (False, False) - - # RunPod: use the flags as provided (both default to False). - return (whisper, recognise_speakers) - - async def transcribe( - self, - *, - platform: str, - language: str, - adapter: str, - org: bool = False, - whisper: bool = False, - recognise_speakers: bool = False, - file_path: Optional[str] = None, - file_extension: Optional[str] = None, - content_type: Optional[str] = None, - audio_bytes: Optional[bytes] = None, - gcs_blob_name: Optional[str] = None, - ) -> TranscriptionResult: - """Dispatch to the appropriate backend and return a TranscriptionResult. - - Callers must have already run ``validate_and_normalize``. - """ - if platform == "modal": - text = await self._modal.transcribe(audio_bytes, language=language) - return TranscriptionResult( - transcription=text, - diarization_output={}, - formatted_diarization_output="", - ) - - # RunPod from GCS. - if gcs_blob_name: - return await self._stt.transcribe_from_gcs( - gcs_blob_name=gcs_blob_name, - language=language, - adapter=adapter, - whisper=whisper, - recognise_speakers=recognise_speakers, - ) - - # RunPod from an uploaded file (org or standard). Validate type first, - # preserving the legacy endpoints' behavior. - self._stt.validate_audio_file(content_type, file_extension) - - if org: - return await self._stt.transcribe_org_audio( - file_path=file_path, - recognise_speakers=recognise_speakers, - ) - - return await self._stt.transcribe_uploaded_file( - file_path=file_path, - file_extension=file_extension, - language=language, - adapter=adapter, - whisper=whisper, - recognise_speakers=recognise_speakers, - ) - - -_transcription_service_instance: Optional[TranscriptionService] = None - - -def get_transcription_service() -> TranscriptionService: - """Return the TranscriptionService singleton.""" - global _transcription_service_instance - if _transcription_service_instance is None: - _transcription_service_instance = TranscriptionService() - return _transcription_service_instance - - -def reset_transcription_service() -> None: - """Reset the singleton (test helper).""" - global _transcription_service_instance - _transcription_service_instance = None diff --git a/app/static/react_build/assets/index-BitrVV8a.js b/app/static/react_build/assets/index-2D4AqWZy.js similarity index 88% rename from app/static/react_build/assets/index-BitrVV8a.js rename to app/static/react_build/assets/index-2D4AqWZy.js index fc701a42..1ba8dbeb 100644 --- a/app/static/react_build/assets/index-BitrVV8a.js +++ b/app/static/react_build/assets/index-2D4AqWZy.js @@ -1,4 +1,4 @@ -var w_=Object.defineProperty;var k_=(e,t,n)=>t in e?w_(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Z=(e,t,n)=>k_(e,typeof t!="symbol"?t+"":t,n);function S_(e,t){for(var n=0;nr[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(s){if(s.ep)return;s.ep=!0;const o=n(s);fetch(s.href,o)}})();function Kb(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Yb={exports:{}},Qc={},Xb={exports:{}},de={};/** +var w_=Object.defineProperty;var k_=(e,t,n)=>t in e?w_(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Z=(e,t,n)=>k_(e,typeof t!="symbol"?t+"":t,n);function S_(e,t){for(var n=0;nr[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(s){if(s.ep)return;s.ep=!0;const o=n(s);fetch(s.href,o)}})();function qb(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Yb={exports:{}},Qc={},Xb={exports:{}},de={};/** * @license React * react.production.min.js * @@ -6,7 +6,7 @@ var w_=Object.defineProperty;var k_=(e,t,n)=>t in e?w_(e,t,{enumerable:!0,config * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var Ca=Symbol.for("react.element"),__=Symbol.for("react.portal"),j_=Symbol.for("react.fragment"),C_=Symbol.for("react.strict_mode"),N_=Symbol.for("react.profiler"),P_=Symbol.for("react.provider"),R_=Symbol.for("react.context"),E_=Symbol.for("react.forward_ref"),T_=Symbol.for("react.suspense"),A_=Symbol.for("react.memo"),M_=Symbol.for("react.lazy"),am=Symbol.iterator;function L_(e){return e===null||typeof e!="object"?null:(e=am&&e[am]||e["@@iterator"],typeof e=="function"?e:null)}var Qb={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Jb=Object.assign,Zb={};function Bo(e,t,n){this.props=e,this.context=t,this.refs=Zb,this.updater=n||Qb}Bo.prototype.isReactComponent={};Bo.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Bo.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function ev(){}ev.prototype=Bo.prototype;function ep(e,t,n){this.props=e,this.context=t,this.refs=Zb,this.updater=n||Qb}var tp=ep.prototype=new ev;tp.constructor=ep;Jb(tp,Bo.prototype);tp.isPureReactComponent=!0;var lm=Array.isArray,tv=Object.prototype.hasOwnProperty,np={current:null},nv={key:!0,ref:!0,__self:!0,__source:!0};function rv(e,t,n){var r,s={},o=null,i=null;if(t!=null)for(r in t.ref!==void 0&&(i=t.ref),t.key!==void 0&&(o=""+t.key),t)tv.call(t,r)&&!nv.hasOwnProperty(r)&&(s[r]=t[r]);var a=arguments.length-2;if(a===1)s.children=n;else if(1t in e?w_(e,t,{enumerable:!0,config * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */(function(e){function t(C,L){var E=C.length;C.push(L);e:for(;0>>1,Y=C[I];if(0>>1;Is(q,E))nes(ce,q)?(C[I]=ce,C[ne]=E,I=ne):(C[I]=q,C[$]=E,I=$);else if(nes(ce,E))C[I]=ce,C[ne]=E,I=ne;else break e}}return L}function s(C,L){var E=C.sortIndex-L.sortIndex;return E!==0?E:C.id-L.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var i=Date,a=i.now();e.unstable_now=function(){return i.now()-a}}var l=[],u=[],d=1,h=null,f=3,p=!1,g=!1,m=!1,y=typeof setTimeout=="function"?setTimeout:null,x=typeof clearTimeout=="function"?clearTimeout:null,v=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function b(C){for(var L=n(u);L!==null;){if(L.callback===null)r(u);else if(L.startTime<=C)r(u),L.sortIndex=L.expirationTime,t(l,L);else break;L=n(u)}}function k(C){if(m=!1,b(C),!g)if(n(l)!==null)g=!0,M(w);else{var L=n(u);L!==null&&H(k,L.startTime-C)}}function w(C,L){g=!1,m&&(m=!1,x(_),_=-1),p=!0;var E=f;try{for(b(L),h=n(l);h!==null&&(!(h.expirationTime>L)||C&&!O());){var I=h.callback;if(typeof I=="function"){h.callback=null,f=h.priorityLevel;var Y=I(h.expirationTime<=L);L=e.unstable_now(),typeof Y=="function"?h.callback=Y:h===n(l)&&r(l),b(L)}else r(l);h=n(l)}if(h!==null)var T=!0;else{var $=n(u);$!==null&&H(k,$.startTime-L),T=!1}return T}finally{h=null,f=E,p=!1}}var j=!1,N=null,_=-1,P=5,A=-1;function O(){return!(e.unstable_now()-AC||125I?(C.sortIndex=E,t(u,C),n(l)===null&&C===n(u)&&(m?(x(_),_=-1):m=!0,H(k,E-I))):(C.sortIndex=Y,t(l,C),g||p||(g=!0,M(w))),C},e.unstable_shouldYield=O,e.unstable_wrapCallback=function(C){var L=f;return function(){var E=f;f=L;try{return C.apply(this,arguments)}finally{f=E}}}})(lv);av.exports=lv;var G_=av.exports;/** + */(function(e){function t(C,L){var E=C.length;C.push(L);e:for(;0>>1,Y=C[I];if(0>>1;Is(K,E))nes(ce,K)?(C[I]=ce,C[ne]=E,I=ne):(C[I]=K,C[$]=E,I=$);else if(nes(ce,E))C[I]=ce,C[ne]=E,I=ne;else break e}}return L}function s(C,L){var E=C.sortIndex-L.sortIndex;return E!==0?E:C.id-L.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var i=Date,a=i.now();e.unstable_now=function(){return i.now()-a}}var l=[],u=[],d=1,h=null,f=3,p=!1,g=!1,m=!1,y=typeof setTimeout=="function"?setTimeout:null,x=typeof clearTimeout=="function"?clearTimeout:null,v=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function b(C){for(var L=n(u);L!==null;){if(L.callback===null)r(u);else if(L.startTime<=C)r(u),L.sortIndex=L.expirationTime,t(l,L);else break;L=n(u)}}function k(C){if(m=!1,b(C),!g)if(n(l)!==null)g=!0,M(w);else{var L=n(u);L!==null&&U(k,L.startTime-C)}}function w(C,L){g=!1,m&&(m=!1,x(_),_=-1),p=!0;var E=f;try{for(b(L),h=n(l);h!==null&&(!(h.expirationTime>L)||C&&!O());){var I=h.callback;if(typeof I=="function"){h.callback=null,f=h.priorityLevel;var Y=I(h.expirationTime<=L);L=e.unstable_now(),typeof Y=="function"?h.callback=Y:h===n(l)&&r(l),b(L)}else r(l);h=n(l)}if(h!==null)var T=!0;else{var $=n(u);$!==null&&U(k,$.startTime-L),T=!1}return T}finally{h=null,f=E,p=!1}}var j=!1,N=null,_=-1,P=5,A=-1;function O(){return!(e.unstable_now()-AC||125I?(C.sortIndex=E,t(u,C),n(l)===null&&C===n(u)&&(m?(x(_),_=-1):m=!0,U(k,E-I))):(C.sortIndex=Y,t(l,C),g||p||(g=!0,M(w))),C},e.unstable_shouldYield=O,e.unstable_wrapCallback=function(C){var L=f;return function(){var E=f;f=L;try{return C.apply(this,arguments)}finally{f=E}}}})(lv);av.exports=lv;var G_=av.exports;/** * @license React * react-dom.production.min.js * @@ -30,14 +30,14 @@ var w_=Object.defineProperty;var k_=(e,t,n)=>t in e?w_(e,t,{enumerable:!0,config * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var q_=S,qt=G_;function V(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),uh=Object.prototype.hasOwnProperty,K_=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,um={},dm={};function Y_(e){return uh.call(dm,e)?!0:uh.call(um,e)?!1:K_.test(e)?dm[e]=!0:(um[e]=!0,!1)}function X_(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function Q_(e,t,n,r){if(t===null||typeof t>"u"||X_(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Nt(e,t,n,r,s,o,i){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=s,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=i}var at={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){at[e]=new Nt(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];at[t]=new Nt(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){at[e]=new Nt(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){at[e]=new Nt(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){at[e]=new Nt(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){at[e]=new Nt(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){at[e]=new Nt(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){at[e]=new Nt(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){at[e]=new Nt(e,5,!1,e.toLowerCase(),null,!1,!1)});var sp=/[\-:]([a-z])/g;function op(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(sp,op);at[t]=new Nt(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(sp,op);at[t]=new Nt(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(sp,op);at[t]=new Nt(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){at[e]=new Nt(e,1,!1,e.toLowerCase(),null,!1,!1)});at.xlinkHref=new Nt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){at[e]=new Nt(e,1,!1,e.toLowerCase(),null,!0,!0)});function ip(e,t,n,r){var s=at.hasOwnProperty(t)?at[t]:null;(s!==null?s.type!==0:r||!(2"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),uh=Object.prototype.hasOwnProperty,q_=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,um={},dm={};function Y_(e){return uh.call(dm,e)?!0:uh.call(um,e)?!1:q_.test(e)?dm[e]=!0:(um[e]=!0,!1)}function X_(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function Q_(e,t,n,r){if(t===null||typeof t>"u"||X_(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Nt(e,t,n,r,s,o,i){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=s,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=i}var at={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){at[e]=new Nt(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];at[t]=new Nt(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){at[e]=new Nt(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){at[e]=new Nt(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){at[e]=new Nt(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){at[e]=new Nt(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){at[e]=new Nt(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){at[e]=new Nt(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){at[e]=new Nt(e,5,!1,e.toLowerCase(),null,!1,!1)});var sp=/[\-:]([a-z])/g;function op(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(sp,op);at[t]=new Nt(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(sp,op);at[t]=new Nt(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(sp,op);at[t]=new Nt(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){at[e]=new Nt(e,1,!1,e.toLowerCase(),null,!1,!1)});at.xlinkHref=new Nt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){at[e]=new Nt(e,1,!1,e.toLowerCase(),null,!0,!0)});function ip(e,t,n,r){var s=at.hasOwnProperty(t)?at[t]:null;(s!==null?s.type!==0:r||!(2a||s[i]!==o[a]){var l=` -`+s[i].replace(" at new "," at ");return e.displayName&&l.includes("")&&(l=l.replace("",e.displayName)),l}while(1<=i&&0<=a);break}}}finally{Xu=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?xi(e):""}function J_(e){switch(e.tag){case 5:return xi(e.type);case 16:return xi("Lazy");case 13:return xi("Suspense");case 19:return xi("SuspenseList");case 0:case 2:case 15:return e=Qu(e.type,!1),e;case 11:return e=Qu(e.type.render,!1),e;case 1:return e=Qu(e.type,!0),e;default:return""}}function ph(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Qs:return"Fragment";case Xs:return"Portal";case dh:return"Profiler";case ap:return"StrictMode";case hh:return"Suspense";case fh:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case dv:return(e.displayName||"Context")+".Consumer";case uv:return(e._context.displayName||"Context")+".Provider";case lp:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case cp:return t=e.displayName||null,t!==null?t:ph(e.type)||"Memo";case gr:t=e._payload,e=e._init;try{return ph(e(t))}catch{}}return null}function Z_(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ph(t);case 8:return t===ap?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Vr(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function fv(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function ej(e){var t=fv(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var s=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(i){r=""+i,o.call(this,i)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(i){r=""+i},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Ya(e){e._valueTracker||(e._valueTracker=ej(e))}function pv(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=fv(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function ac(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function gh(e,t){var n=t.checked;return Le({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function fm(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Vr(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function gv(e,t){t=t.checked,t!=null&&ip(e,"checked",t,!1)}function mh(e,t){gv(e,t);var n=Vr(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?yh(e,t.type,n):t.hasOwnProperty("defaultValue")&&yh(e,t.type,Vr(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function pm(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function yh(e,t,n){(t!=="number"||ac(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var bi=Array.isArray;function po(e,t,n,r){if(e=e.options,t){t={};for(var s=0;s"+t.valueOf().toString()+"",t=Xa.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Yi(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Pi={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},tj=["Webkit","ms","Moz","O"];Object.keys(Pi).forEach(function(e){tj.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Pi[t]=Pi[e]})});function bv(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Pi.hasOwnProperty(e)&&Pi[e]?(""+t).trim():t+"px"}function vv(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=bv(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,s):e[n]=s}}var nj=Le({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function vh(e,t){if(t){if(nj[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(V(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(V(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(V(61))}if(t.style!=null&&typeof t.style!="object")throw Error(V(62))}}function wh(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var kh=null;function up(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Sh=null,go=null,mo=null;function ym(e){if(e=Ra(e)){if(typeof Sh!="function")throw Error(V(280));var t=e.stateNode;t&&(t=nu(t),Sh(e.stateNode,e.type,t))}}function wv(e){go?mo?mo.push(e):mo=[e]:go=e}function kv(){if(go){var e=go,t=mo;if(mo=go=null,ym(e),t)for(e=0;e>>=0,e===0?32:31-(fj(e)/pj|0)|0}var Qa=64,Ja=4194304;function vi(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function dc(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,s=e.suspendedLanes,o=e.pingedLanes,i=n&268435455;if(i!==0){var a=i&~s;a!==0?r=vi(a):(o&=i,o!==0&&(r=vi(o)))}else i=n&~s,i!==0?r=vi(i):o!==0&&(r=vi(o));if(r===0)return 0;if(t!==0&&t!==r&&(t&s)===0&&(s=r&-r,o=t&-t,s>=o||s===16&&(o&4194240)!==0))return t;if((r&4)!==0&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function Na(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-vn(t),e[t]=n}function xj(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=Ei),Cm=" ",Nm=!1;function $v(e,t){switch(e){case"keyup":return Gj.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Hv(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Js=!1;function Kj(e,t){switch(e){case"compositionend":return Hv(t);case"keypress":return t.which!==32?null:(Nm=!0,Cm);case"textInput":return e=t.data,e===Cm&&Nm?null:e;default:return null}}function Yj(e,t){if(Js)return e==="compositionend"||!xp&&$v(e,t)?(e=Vv(),Vl=gp=vr=null,Js=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Tm(n)}}function qv(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?qv(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Kv(){for(var e=window,t=ac();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=ac(e.document)}return t}function bp(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function sC(e){var t=Kv(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&qv(n.ownerDocument.documentElement,n)){if(r!==null&&bp(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var s=n.textContent.length,o=Math.min(r.start,s);r=r.end===void 0?o:Math.min(r.end,s),!e.extend&&o>r&&(s=r,r=o,o=s),s=Am(n,o);var i=Am(n,r);s&&i&&(e.rangeCount!==1||e.anchorNode!==s.node||e.anchorOffset!==s.offset||e.focusNode!==i.node||e.focusOffset!==i.offset)&&(t=t.createRange(),t.setStart(s.node,s.offset),e.removeAllRanges(),o>r?(e.addRange(t),e.extend(i.node,i.offset)):(t.setEnd(i.node,i.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Zs=null,Rh=null,Ai=null,Eh=!1;function Mm(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Eh||Zs==null||Zs!==ac(r)||(r=Zs,"selectionStart"in r&&bp(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Ai&&ta(Ai,r)||(Ai=r,r=pc(Rh,"onSelect"),0no||(e.current=Dh[no],Dh[no]=null,no--)}function we(e,t){no++,Dh[no]=e.current,e.current=t}var Br={},xt=qr(Br),Mt=qr(!1),Ns=Br;function _o(e,t){var n=e.type.contextTypes;if(!n)return Br;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var s={},o;for(o in n)s[o]=t[o];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=s),s}function Lt(e){return e=e.childContextTypes,e!=null}function mc(){Ce(Mt),Ce(xt)}function Vm(e,t,n){if(xt.current!==Br)throw Error(V(168));we(xt,t),we(Mt,n)}function rw(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var s in r)if(!(s in t))throw Error(V(108,Z_(e)||"Unknown",s));return Le({},n,r)}function yc(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Br,Ns=xt.current,we(xt,e),we(Mt,Mt.current),!0}function Bm(e,t,n){var r=e.stateNode;if(!r)throw Error(V(169));n?(e=rw(e,t,Ns),r.__reactInternalMemoizedMergedChildContext=e,Ce(Mt),Ce(xt),we(xt,e)):Ce(Mt),we(Mt,n)}var Wn=null,ru=!1,dd=!1;function sw(e){Wn===null?Wn=[e]:Wn.push(e)}function mC(e){ru=!0,sw(e)}function Kr(){if(!dd&&Wn!==null){dd=!0;var e=0,t=be;try{var n=Wn;for(be=1;e>=i,s-=i,qn=1<<32-vn(t)+s|n<_?(P=N,N=null):P=N.sibling;var A=f(x,N,b[_],k);if(A===null){N===null&&(N=P);break}e&&N&&A.alternate===null&&t(x,N),v=o(A,v,_),j===null?w=A:j.sibling=A,j=A,N=P}if(_===b.length)return n(x,N),Ne&&as(x,_),w;if(N===null){for(;__?(P=N,N=null):P=N.sibling;var O=f(x,N,A.value,k);if(O===null){N===null&&(N=P);break}e&&N&&O.alternate===null&&t(x,N),v=o(O,v,_),j===null?w=O:j.sibling=O,j=O,N=P}if(A.done)return n(x,N),Ne&&as(x,_),w;if(N===null){for(;!A.done;_++,A=b.next())A=h(x,A.value,k),A!==null&&(v=o(A,v,_),j===null?w=A:j.sibling=A,j=A);return Ne&&as(x,_),w}for(N=r(x,N);!A.done;_++,A=b.next())A=p(N,x,_,A.value,k),A!==null&&(e&&A.alternate!==null&&N.delete(A.key===null?_:A.key),v=o(A,v,_),j===null?w=A:j.sibling=A,j=A);return e&&N.forEach(function(F){return t(x,F)}),Ne&&as(x,_),w}function y(x,v,b,k){if(typeof b=="object"&&b!==null&&b.type===Qs&&b.key===null&&(b=b.props.children),typeof b=="object"&&b!==null){switch(b.$$typeof){case Ka:e:{for(var w=b.key,j=v;j!==null;){if(j.key===w){if(w=b.type,w===Qs){if(j.tag===7){n(x,j.sibling),v=s(j,b.props.children),v.return=x,x=v;break e}}else if(j.elementType===w||typeof w=="object"&&w!==null&&w.$$typeof===gr&&Um(w)===j.type){n(x,j.sibling),v=s(j,b.props),v.ref=si(x,j,b),v.return=x,x=v;break e}n(x,j);break}else t(x,j);j=j.sibling}b.type===Qs?(v=ks(b.props.children,x.mode,k,b.key),v.return=x,x=v):(k=Kl(b.type,b.key,b.props,null,x.mode,k),k.ref=si(x,v,b),k.return=x,x=k)}return i(x);case Xs:e:{for(j=b.key;v!==null;){if(v.key===j)if(v.tag===4&&v.stateNode.containerInfo===b.containerInfo&&v.stateNode.implementation===b.implementation){n(x,v.sibling),v=s(v,b.children||[]),v.return=x,x=v;break e}else{n(x,v);break}else t(x,v);v=v.sibling}v=bd(b,x.mode,k),v.return=x,x=v}return i(x);case gr:return j=b._init,y(x,v,j(b._payload),k)}if(bi(b))return g(x,v,b,k);if(Zo(b))return m(x,v,b,k);ol(x,b)}return typeof b=="string"&&b!==""||typeof b=="number"?(b=""+b,v!==null&&v.tag===6?(n(x,v.sibling),v=s(v,b),v.return=x,x=v):(n(x,v),v=xd(b,x.mode,k),v.return=x,x=v),i(x)):n(x,v)}return y}var Co=lw(!0),cw=lw(!1),vc=qr(null),wc=null,oo=null,Sp=null;function _p(){Sp=oo=wc=null}function jp(e){var t=vc.current;Ce(vc),e._currentValue=t}function zh(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function xo(e,t){wc=e,Sp=oo=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(At=!0),e.firstContext=null)}function un(e){var t=e._currentValue;if(Sp!==e)if(e={context:e,memoizedValue:t,next:null},oo===null){if(wc===null)throw Error(V(308));oo=e,wc.dependencies={lanes:0,firstContext:e}}else oo=oo.next=e;return t}var gs=null;function Cp(e){gs===null?gs=[e]:gs.push(e)}function uw(e,t,n,r){var s=t.interleaved;return s===null?(n.next=n,Cp(t)):(n.next=s.next,s.next=n),t.interleaved=n,rr(e,r)}function rr(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var mr=!1;function Np(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function dw(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Qn(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Tr(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,(pe&2)!==0){var s=r.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),r.pending=t,rr(e,n)}return s=r.interleaved,s===null?(t.next=t,Cp(r)):(t.next=s.next,s.next=t),r.interleaved=t,rr(e,n)}function $l(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,hp(e,n)}}function Wm(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var s=null,o=null;if(n=n.firstBaseUpdate,n!==null){do{var i={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};o===null?s=o=i:o=o.next=i,n=n.next}while(n!==null);o===null?s=o=t:o=o.next=t}else s=o=t;n={baseState:r.baseState,firstBaseUpdate:s,lastBaseUpdate:o,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function kc(e,t,n,r){var s=e.updateQueue;mr=!1;var o=s.firstBaseUpdate,i=s.lastBaseUpdate,a=s.shared.pending;if(a!==null){s.shared.pending=null;var l=a,u=l.next;l.next=null,i===null?o=u:i.next=u,i=l;var d=e.alternate;d!==null&&(d=d.updateQueue,a=d.lastBaseUpdate,a!==i&&(a===null?d.firstBaseUpdate=u:a.next=u,d.lastBaseUpdate=l))}if(o!==null){var h=s.baseState;i=0,d=u=l=null,a=o;do{var f=a.lane,p=a.eventTime;if((r&f)===f){d!==null&&(d=d.next={eventTime:p,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var g=e,m=a;switch(f=t,p=n,m.tag){case 1:if(g=m.payload,typeof g=="function"){h=g.call(p,h,f);break e}h=g;break e;case 3:g.flags=g.flags&-65537|128;case 0:if(g=m.payload,f=typeof g=="function"?g.call(p,h,f):g,f==null)break e;h=Le({},h,f);break e;case 2:mr=!0}}a.callback!==null&&a.lane!==0&&(e.flags|=64,f=s.effects,f===null?s.effects=[a]:f.push(a))}else p={eventTime:p,lane:f,tag:a.tag,payload:a.payload,callback:a.callback,next:null},d===null?(u=d=p,l=h):d=d.next=p,i|=f;if(a=a.next,a===null){if(a=s.shared.pending,a===null)break;f=a,a=f.next,f.next=null,s.lastBaseUpdate=f,s.shared.pending=null}}while(!0);if(d===null&&(l=h),s.baseState=l,s.firstBaseUpdate=u,s.lastBaseUpdate=d,t=s.shared.interleaved,t!==null){s=t;do i|=s.lane,s=s.next;while(s!==t)}else o===null&&(s.shared.lanes=0);Es|=i,e.lanes=i,e.memoizedState=h}}function Gm(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=fd.transition;fd.transition={};try{e(!1),t()}finally{be=n,fd.transition=r}}function Pw(){return dn().memoizedState}function vC(e,t,n){var r=Mr(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Rw(e))Ew(t,n);else if(n=uw(e,t,n,r),n!==null){var s=jt();wn(n,e,r,s),Tw(n,t,r)}}function wC(e,t,n){var r=Mr(e),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Rw(e))Ew(t,s);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var i=t.lastRenderedState,a=o(i,n);if(s.hasEagerState=!0,s.eagerState=a,Sn(a,i)){var l=t.interleaved;l===null?(s.next=s,Cp(t)):(s.next=l.next,l.next=s),t.interleaved=s;return}}catch{}finally{}n=uw(e,t,s,r),n!==null&&(s=jt(),wn(n,e,r,s),Tw(n,t,r))}}function Rw(e){var t=e.alternate;return e===Me||t!==null&&t===Me}function Ew(e,t){Mi=_c=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Tw(e,t,n){if((n&4194240)!==0){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,hp(e,n)}}var jc={readContext:un,useCallback:ut,useContext:ut,useEffect:ut,useImperativeHandle:ut,useInsertionEffect:ut,useLayoutEffect:ut,useMemo:ut,useReducer:ut,useRef:ut,useState:ut,useDebugValue:ut,useDeferredValue:ut,useTransition:ut,useMutableSource:ut,useSyncExternalStore:ut,useId:ut,unstable_isNewReconciler:!1},kC={readContext:un,useCallback:function(e,t){return Tn().memoizedState=[e,t===void 0?null:t],e},useContext:un,useEffect:Km,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Ul(4194308,4,Sw.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Ul(4194308,4,e,t)},useInsertionEffect:function(e,t){return Ul(4,2,e,t)},useMemo:function(e,t){var n=Tn();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Tn();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=vC.bind(null,Me,e),[r.memoizedState,e]},useRef:function(e){var t=Tn();return e={current:e},t.memoizedState=e},useState:qm,useDebugValue:Op,useDeferredValue:function(e){return Tn().memoizedState=e},useTransition:function(){var e=qm(!1),t=e[0];return e=bC.bind(null,e[1]),Tn().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Me,s=Tn();if(Ne){if(n===void 0)throw Error(V(407));n=n()}else{if(n=t(),tt===null)throw Error(V(349));(Rs&30)!==0||gw(r,t,n)}s.memoizedState=n;var o={value:n,getSnapshot:t};return s.queue=o,Km(yw.bind(null,r,o,e),[e]),r.flags|=2048,ca(9,mw.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=Tn(),t=tt.identifierPrefix;if(Ne){var n=Kn,r=qn;n=(r&~(1<<32-vn(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=aa++,0")&&(l=l.replace("",e.displayName)),l}while(1<=i&&0<=a);break}}}finally{Xu=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?xi(e):""}function J_(e){switch(e.tag){case 5:return xi(e.type);case 16:return xi("Lazy");case 13:return xi("Suspense");case 19:return xi("SuspenseList");case 0:case 2:case 15:return e=Qu(e.type,!1),e;case 11:return e=Qu(e.type.render,!1),e;case 1:return e=Qu(e.type,!0),e;default:return""}}function ph(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Js:return"Fragment";case Qs:return"Portal";case dh:return"Profiler";case ap:return"StrictMode";case hh:return"Suspense";case fh:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case dv:return(e.displayName||"Context")+".Consumer";case uv:return(e._context.displayName||"Context")+".Provider";case lp:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case cp:return t=e.displayName||null,t!==null?t:ph(e.type)||"Memo";case gr:t=e._payload,e=e._init;try{return ph(e(t))}catch{}}return null}function Z_(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ph(t);case 8:return t===ap?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Vr(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function fv(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function ej(e){var t=fv(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var s=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(i){r=""+i,o.call(this,i)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(i){r=""+i},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Ya(e){e._valueTracker||(e._valueTracker=ej(e))}function pv(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=fv(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function ac(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function gh(e,t){var n=t.checked;return Le({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function fm(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Vr(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function gv(e,t){t=t.checked,t!=null&&ip(e,"checked",t,!1)}function mh(e,t){gv(e,t);var n=Vr(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?yh(e,t.type,n):t.hasOwnProperty("defaultValue")&&yh(e,t.type,Vr(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function pm(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function yh(e,t,n){(t!=="number"||ac(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var bi=Array.isArray;function go(e,t,n,r){if(e=e.options,t){t={};for(var s=0;s"+t.valueOf().toString()+"",t=Xa.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Yi(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Pi={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},tj=["Webkit","ms","Moz","O"];Object.keys(Pi).forEach(function(e){tj.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Pi[t]=Pi[e]})});function bv(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Pi.hasOwnProperty(e)&&Pi[e]?(""+t).trim():t+"px"}function vv(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=bv(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,s):e[n]=s}}var nj=Le({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function vh(e,t){if(t){if(nj[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(V(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(V(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(V(61))}if(t.style!=null&&typeof t.style!="object")throw Error(V(62))}}function wh(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var kh=null;function up(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Sh=null,mo=null,yo=null;function ym(e){if(e=Ra(e)){if(typeof Sh!="function")throw Error(V(280));var t=e.stateNode;t&&(t=nu(t),Sh(e.stateNode,e.type,t))}}function wv(e){mo?yo?yo.push(e):yo=[e]:mo=e}function kv(){if(mo){var e=mo,t=yo;if(yo=mo=null,ym(e),t)for(e=0;e>>=0,e===0?32:31-(fj(e)/pj|0)|0}var Qa=64,Ja=4194304;function vi(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function dc(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,s=e.suspendedLanes,o=e.pingedLanes,i=n&268435455;if(i!==0){var a=i&~s;a!==0?r=vi(a):(o&=i,o!==0&&(r=vi(o)))}else i=n&~s,i!==0?r=vi(i):o!==0&&(r=vi(o));if(r===0)return 0;if(t!==0&&t!==r&&(t&s)===0&&(s=r&-r,o=t&-t,s>=o||s===16&&(o&4194240)!==0))return t;if((r&4)!==0&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function Na(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-vn(t),e[t]=n}function xj(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=Ei),Cm=" ",Nm=!1;function $v(e,t){switch(e){case"keyup":return Gj.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Hv(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Zs=!1;function qj(e,t){switch(e){case"compositionend":return Hv(t);case"keypress":return t.which!==32?null:(Nm=!0,Cm);case"textInput":return e=t.data,e===Cm&&Nm?null:e;default:return null}}function Yj(e,t){if(Zs)return e==="compositionend"||!xp&&$v(e,t)?(e=Vv(),Vl=gp=vr=null,Zs=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Tm(n)}}function Kv(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Kv(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function qv(){for(var e=window,t=ac();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=ac(e.document)}return t}function bp(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function sC(e){var t=qv(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Kv(n.ownerDocument.documentElement,n)){if(r!==null&&bp(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var s=n.textContent.length,o=Math.min(r.start,s);r=r.end===void 0?o:Math.min(r.end,s),!e.extend&&o>r&&(s=r,r=o,o=s),s=Am(n,o);var i=Am(n,r);s&&i&&(e.rangeCount!==1||e.anchorNode!==s.node||e.anchorOffset!==s.offset||e.focusNode!==i.node||e.focusOffset!==i.offset)&&(t=t.createRange(),t.setStart(s.node,s.offset),e.removeAllRanges(),o>r?(e.addRange(t),e.extend(i.node,i.offset)):(t.setEnd(i.node,i.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,eo=null,Rh=null,Ai=null,Eh=!1;function Mm(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Eh||eo==null||eo!==ac(r)||(r=eo,"selectionStart"in r&&bp(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Ai&&ta(Ai,r)||(Ai=r,r=pc(Rh,"onSelect"),0ro||(e.current=Dh[ro],Dh[ro]=null,ro--)}function we(e,t){ro++,Dh[ro]=e.current,e.current=t}var Br={},xt=Kr(Br),Mt=Kr(!1),Ns=Br;function jo(e,t){var n=e.type.contextTypes;if(!n)return Br;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var s={},o;for(o in n)s[o]=t[o];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=s),s}function Lt(e){return e=e.childContextTypes,e!=null}function mc(){Ce(Mt),Ce(xt)}function Vm(e,t,n){if(xt.current!==Br)throw Error(V(168));we(xt,t),we(Mt,n)}function rw(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var s in r)if(!(s in t))throw Error(V(108,Z_(e)||"Unknown",s));return Le({},n,r)}function yc(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Br,Ns=xt.current,we(xt,e),we(Mt,Mt.current),!0}function Bm(e,t,n){var r=e.stateNode;if(!r)throw Error(V(169));n?(e=rw(e,t,Ns),r.__reactInternalMemoizedMergedChildContext=e,Ce(Mt),Ce(xt),we(xt,e)):Ce(Mt),we(Mt,n)}var Wn=null,ru=!1,dd=!1;function sw(e){Wn===null?Wn=[e]:Wn.push(e)}function mC(e){ru=!0,sw(e)}function qr(){if(!dd&&Wn!==null){dd=!0;var e=0,t=be;try{var n=Wn;for(be=1;e>=i,s-=i,Kn=1<<32-vn(t)+s|n<_?(P=N,N=null):P=N.sibling;var A=f(x,N,b[_],k);if(A===null){N===null&&(N=P);break}e&&N&&A.alternate===null&&t(x,N),v=o(A,v,_),j===null?w=A:j.sibling=A,j=A,N=P}if(_===b.length)return n(x,N),Pe&&as(x,_),w;if(N===null){for(;__?(P=N,N=null):P=N.sibling;var O=f(x,N,A.value,k);if(O===null){N===null&&(N=P);break}e&&N&&O.alternate===null&&t(x,N),v=o(O,v,_),j===null?w=O:j.sibling=O,j=O,N=P}if(A.done)return n(x,N),Pe&&as(x,_),w;if(N===null){for(;!A.done;_++,A=b.next())A=h(x,A.value,k),A!==null&&(v=o(A,v,_),j===null?w=A:j.sibling=A,j=A);return Pe&&as(x,_),w}for(N=r(x,N);!A.done;_++,A=b.next())A=p(N,x,_,A.value,k),A!==null&&(e&&A.alternate!==null&&N.delete(A.key===null?_:A.key),v=o(A,v,_),j===null?w=A:j.sibling=A,j=A);return e&&N.forEach(function(F){return t(x,F)}),Pe&&as(x,_),w}function y(x,v,b,k){if(typeof b=="object"&&b!==null&&b.type===Js&&b.key===null&&(b=b.props.children),typeof b=="object"&&b!==null){switch(b.$$typeof){case qa:e:{for(var w=b.key,j=v;j!==null;){if(j.key===w){if(w=b.type,w===Js){if(j.tag===7){n(x,j.sibling),v=s(j,b.props.children),v.return=x,x=v;break e}}else if(j.elementType===w||typeof w=="object"&&w!==null&&w.$$typeof===gr&&Um(w)===j.type){n(x,j.sibling),v=s(j,b.props),v.ref=oi(x,j,b),v.return=x,x=v;break e}n(x,j);break}else t(x,j);j=j.sibling}b.type===Js?(v=ks(b.props.children,x.mode,k,b.key),v.return=x,x=v):(k=ql(b.type,b.key,b.props,null,x.mode,k),k.ref=oi(x,v,b),k.return=x,x=k)}return i(x);case Qs:e:{for(j=b.key;v!==null;){if(v.key===j)if(v.tag===4&&v.stateNode.containerInfo===b.containerInfo&&v.stateNode.implementation===b.implementation){n(x,v.sibling),v=s(v,b.children||[]),v.return=x,x=v;break e}else{n(x,v);break}else t(x,v);v=v.sibling}v=bd(b,x.mode,k),v.return=x,x=v}return i(x);case gr:return j=b._init,y(x,v,j(b._payload),k)}if(bi(b))return g(x,v,b,k);if(ei(b))return m(x,v,b,k);ol(x,b)}return typeof b=="string"&&b!==""||typeof b=="number"?(b=""+b,v!==null&&v.tag===6?(n(x,v.sibling),v=s(v,b),v.return=x,x=v):(n(x,v),v=xd(b,x.mode,k),v.return=x,x=v),i(x)):n(x,v)}return y}var No=lw(!0),cw=lw(!1),vc=Kr(null),wc=null,io=null,Sp=null;function _p(){Sp=io=wc=null}function jp(e){var t=vc.current;Ce(vc),e._currentValue=t}function zh(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function bo(e,t){wc=e,Sp=io=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(At=!0),e.firstContext=null)}function un(e){var t=e._currentValue;if(Sp!==e)if(e={context:e,memoizedValue:t,next:null},io===null){if(wc===null)throw Error(V(308));io=e,wc.dependencies={lanes:0,firstContext:e}}else io=io.next=e;return t}var gs=null;function Cp(e){gs===null?gs=[e]:gs.push(e)}function uw(e,t,n,r){var s=t.interleaved;return s===null?(n.next=n,Cp(t)):(n.next=s.next,s.next=n),t.interleaved=n,rr(e,r)}function rr(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var mr=!1;function Np(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function dw(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Qn(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Tr(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,(pe&2)!==0){var s=r.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),r.pending=t,rr(e,n)}return s=r.interleaved,s===null?(t.next=t,Cp(r)):(t.next=s.next,s.next=t),r.interleaved=t,rr(e,n)}function $l(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,hp(e,n)}}function Wm(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var s=null,o=null;if(n=n.firstBaseUpdate,n!==null){do{var i={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};o===null?s=o=i:o=o.next=i,n=n.next}while(n!==null);o===null?s=o=t:o=o.next=t}else s=o=t;n={baseState:r.baseState,firstBaseUpdate:s,lastBaseUpdate:o,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function kc(e,t,n,r){var s=e.updateQueue;mr=!1;var o=s.firstBaseUpdate,i=s.lastBaseUpdate,a=s.shared.pending;if(a!==null){s.shared.pending=null;var l=a,u=l.next;l.next=null,i===null?o=u:i.next=u,i=l;var d=e.alternate;d!==null&&(d=d.updateQueue,a=d.lastBaseUpdate,a!==i&&(a===null?d.firstBaseUpdate=u:a.next=u,d.lastBaseUpdate=l))}if(o!==null){var h=s.baseState;i=0,d=u=l=null,a=o;do{var f=a.lane,p=a.eventTime;if((r&f)===f){d!==null&&(d=d.next={eventTime:p,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var g=e,m=a;switch(f=t,p=n,m.tag){case 1:if(g=m.payload,typeof g=="function"){h=g.call(p,h,f);break e}h=g;break e;case 3:g.flags=g.flags&-65537|128;case 0:if(g=m.payload,f=typeof g=="function"?g.call(p,h,f):g,f==null)break e;h=Le({},h,f);break e;case 2:mr=!0}}a.callback!==null&&a.lane!==0&&(e.flags|=64,f=s.effects,f===null?s.effects=[a]:f.push(a))}else p={eventTime:p,lane:f,tag:a.tag,payload:a.payload,callback:a.callback,next:null},d===null?(u=d=p,l=h):d=d.next=p,i|=f;if(a=a.next,a===null){if(a=s.shared.pending,a===null)break;f=a,a=f.next,f.next=null,s.lastBaseUpdate=f,s.shared.pending=null}}while(!0);if(d===null&&(l=h),s.baseState=l,s.firstBaseUpdate=u,s.lastBaseUpdate=d,t=s.shared.interleaved,t!==null){s=t;do i|=s.lane,s=s.next;while(s!==t)}else o===null&&(s.shared.lanes=0);Es|=i,e.lanes=i,e.memoizedState=h}}function Gm(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=fd.transition;fd.transition={};try{e(!1),t()}finally{be=n,fd.transition=r}}function Pw(){return dn().memoizedState}function vC(e,t,n){var r=Mr(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Rw(e))Ew(t,n);else if(n=uw(e,t,n,r),n!==null){var s=jt();wn(n,e,r,s),Tw(n,t,r)}}function wC(e,t,n){var r=Mr(e),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Rw(e))Ew(t,s);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var i=t.lastRenderedState,a=o(i,n);if(s.hasEagerState=!0,s.eagerState=a,Sn(a,i)){var l=t.interleaved;l===null?(s.next=s,Cp(t)):(s.next=l.next,l.next=s),t.interleaved=s;return}}catch{}finally{}n=uw(e,t,s,r),n!==null&&(s=jt(),wn(n,e,r,s),Tw(n,t,r))}}function Rw(e){var t=e.alternate;return e===Me||t!==null&&t===Me}function Ew(e,t){Mi=_c=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Tw(e,t,n){if((n&4194240)!==0){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,hp(e,n)}}var jc={readContext:un,useCallback:ut,useContext:ut,useEffect:ut,useImperativeHandle:ut,useInsertionEffect:ut,useLayoutEffect:ut,useMemo:ut,useReducer:ut,useRef:ut,useState:ut,useDebugValue:ut,useDeferredValue:ut,useTransition:ut,useMutableSource:ut,useSyncExternalStore:ut,useId:ut,unstable_isNewReconciler:!1},kC={readContext:un,useCallback:function(e,t){return Tn().memoizedState=[e,t===void 0?null:t],e},useContext:un,useEffect:qm,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Ul(4194308,4,Sw.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Ul(4194308,4,e,t)},useInsertionEffect:function(e,t){return Ul(4,2,e,t)},useMemo:function(e,t){var n=Tn();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Tn();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=vC.bind(null,Me,e),[r.memoizedState,e]},useRef:function(e){var t=Tn();return e={current:e},t.memoizedState=e},useState:Km,useDebugValue:Op,useDeferredValue:function(e){return Tn().memoizedState=e},useTransition:function(){var e=Km(!1),t=e[0];return e=bC.bind(null,e[1]),Tn().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Me,s=Tn();if(Pe){if(n===void 0)throw Error(V(407));n=n()}else{if(n=t(),tt===null)throw Error(V(349));(Rs&30)!==0||gw(r,t,n)}s.memoizedState=n;var o={value:n,getSnapshot:t};return s.queue=o,qm(yw.bind(null,r,o,e),[e]),r.flags|=2048,ca(9,mw.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=Tn(),t=tt.identifierPrefix;if(Pe){var n=qn,r=Kn;n=(r&~(1<<32-vn(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=aa++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=i.createElement(n,{is:r.is}):(e=i.createElement(n),n==="select"&&(i=e,r.multiple?i.multiple=!0:r.size&&(i.size=r.size))):e=i.createElementNS(e,n),e[Mn]=t,e[sa]=r,Bw(e,t,!1,!1),t.stateNode=e;e:{switch(i=wh(n,r),n){case"dialog":_e("cancel",e),_e("close",e),s=r;break;case"iframe":case"object":case"embed":_e("load",e),s=r;break;case"video":case"audio":for(s=0;sRo&&(t.flags|=128,r=!0,oi(o,!1),t.lanes=4194304)}else{if(!r)if(e=Sc(i),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),oi(o,!0),o.tail===null&&o.tailMode==="hidden"&&!i.alternate&&!Ne)return dt(t),null}else 2*De()-o.renderingStartTime>Ro&&n!==1073741824&&(t.flags|=128,r=!0,oi(o,!1),t.lanes=4194304);o.isBackwards?(i.sibling=t.child,t.child=i):(n=o.last,n!==null?n.sibling=i:t.child=i,o.last=i)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=De(),t.sibling=null,n=Re.current,we(Re,r?n&1|2:n&1),t):(dt(t),null);case 22:case 23:return Bp(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&(t.mode&1)!==0?(Ht&1073741824)!==0&&(dt(t),t.subtreeFlags&6&&(t.flags|=8192)):dt(t),null;case 24:return null;case 25:return null}throw Error(V(156,t.tag))}function EC(e,t){switch(wp(t),t.tag){case 1:return Lt(t.type)&&mc(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return No(),Ce(Mt),Ce(xt),Ep(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 5:return Rp(t),null;case 13:if(Ce(Re),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(V(340));jo()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Ce(Re),null;case 4:return No(),null;case 10:return jp(t.type._context),null;case 22:case 23:return Bp(),null;case 24:return null;default:return null}}var al=!1,gt=!1,TC=typeof WeakSet=="function"?WeakSet:Set,K=null;function io(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Oe(e,t,r)}else n.current=null}function Kh(e,t,n){try{n()}catch(r){Oe(e,t,r)}}var o0=!1;function AC(e,t){if(Th=hc,e=Kv(),bp(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var s=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var i=0,a=-1,l=-1,u=0,d=0,h=e,f=null;t:for(;;){for(var p;h!==n||s!==0&&h.nodeType!==3||(a=i+s),h!==o||r!==0&&h.nodeType!==3||(l=i+r),h.nodeType===3&&(i+=h.nodeValue.length),(p=h.firstChild)!==null;)f=h,h=p;for(;;){if(h===e)break t;if(f===n&&++u===s&&(a=i),f===o&&++d===r&&(l=i),(p=h.nextSibling)!==null)break;h=f,f=h.parentNode}h=p}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(Ah={focusedElem:e,selectionRange:n},hc=!1,K=t;K!==null;)if(t=K,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,K=e;else for(;K!==null;){t=K;try{var g=t.alternate;if((t.flags&1024)!==0)switch(t.tag){case 0:case 11:case 15:break;case 1:if(g!==null){var m=g.memoizedProps,y=g.memoizedState,x=t.stateNode,v=x.getSnapshotBeforeUpdate(t.elementType===t.type?m:mn(t.type,m),y);x.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var b=t.stateNode.containerInfo;b.nodeType===1?b.textContent="":b.nodeType===9&&b.documentElement&&b.removeChild(b.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(V(163))}}catch(k){Oe(t,t.return,k)}if(e=t.sibling,e!==null){e.return=t.return,K=e;break}K=t.return}return g=o0,o0=!1,g}function Li(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var s=r=r.next;do{if((s.tag&e)===e){var o=s.destroy;s.destroy=void 0,o!==void 0&&Kh(t,n,o)}s=s.next}while(s!==r)}}function iu(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Yh(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function Uw(e){var t=e.alternate;t!==null&&(e.alternate=null,Uw(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Mn],delete t[sa],delete t[Oh],delete t[pC],delete t[gC])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Ww(e){return e.tag===5||e.tag===3||e.tag===4}function i0(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Ww(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Xh(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=gc));else if(r!==4&&(e=e.child,e!==null))for(Xh(e,t,n),e=e.sibling;e!==null;)Xh(e,t,n),e=e.sibling}function Qh(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Qh(e,t,n),e=e.sibling;e!==null;)Qh(e,t,n),e=e.sibling}var ot=null,yn=!1;function ur(e,t,n){for(n=n.child;n!==null;)Gw(e,t,n),n=n.sibling}function Gw(e,t,n){if(Ln&&typeof Ln.onCommitFiberUnmount=="function")try{Ln.onCommitFiberUnmount(Jc,n)}catch{}switch(n.tag){case 5:gt||io(n,t);case 6:var r=ot,s=yn;ot=null,ur(e,t,n),ot=r,yn=s,ot!==null&&(yn?(e=ot,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):ot.removeChild(n.stateNode));break;case 18:ot!==null&&(yn?(e=ot,n=n.stateNode,e.nodeType===8?ud(e.parentNode,n):e.nodeType===1&&ud(e,n),Zi(e)):ud(ot,n.stateNode));break;case 4:r=ot,s=yn,ot=n.stateNode.containerInfo,yn=!0,ur(e,t,n),ot=r,yn=s;break;case 0:case 11:case 14:case 15:if(!gt&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){s=r=r.next;do{var o=s,i=o.destroy;o=o.tag,i!==void 0&&((o&2)!==0||(o&4)!==0)&&Kh(n,t,i),s=s.next}while(s!==r)}ur(e,t,n);break;case 1:if(!gt&&(io(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){Oe(n,t,a)}ur(e,t,n);break;case 21:ur(e,t,n);break;case 22:n.mode&1?(gt=(r=gt)||n.memoizedState!==null,ur(e,t,n),gt=r):ur(e,t,n);break;default:ur(e,t,n)}}function a0(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new TC),t.forEach(function(r){var s=BC.bind(null,e,r);n.has(r)||(n.add(r),r.then(s,s))})}}function gn(e,t){var n=t.deletions;if(n!==null)for(var r=0;rs&&(s=i),r&=~o}if(r=s,r=De()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*LC(r/1960))-r,10e?16:e,wr===null)var r=!1;else{if(e=wr,wr=null,Pc=0,(pe&6)!==0)throw Error(V(331));var s=pe;for(pe|=4,K=e.current;K!==null;){var o=K,i=o.child;if((K.flags&16)!==0){var a=o.deletions;if(a!==null){for(var l=0;lDe()-zp?ws(e,0):Fp|=n),Ot(e,t)}function e1(e,t){t===0&&((e.mode&1)===0?t=1:(t=Ja,Ja<<=1,(Ja&130023424)===0&&(Ja=4194304)));var n=jt();e=rr(e,t),e!==null&&(Na(e,t,n),Ot(e,n))}function VC(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),e1(e,n)}function BC(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,s=e.memoizedState;s!==null&&(n=s.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(V(314))}r!==null&&r.delete(t),e1(e,n)}var t1;t1=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Mt.current)At=!0;else{if((e.lanes&n)===0&&(t.flags&128)===0)return At=!1,PC(e,t,n);At=(e.flags&131072)!==0}else At=!1,Ne&&(t.flags&1048576)!==0&&ow(t,bc,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Wl(e,t),e=t.pendingProps;var s=_o(t,xt.current);xo(t,n),s=Ap(null,t,r,e,s,n);var o=Mp();return t.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Lt(r)?(o=!0,yc(t)):o=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,Np(t),s.updater=ou,t.stateNode=s,s._reactInternals=t,Bh(t,r,e,n),t=Uh(null,t,r,!0,o,n)):(t.tag=0,Ne&&o&&vp(t),kt(null,t,s,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Wl(e,t),e=t.pendingProps,s=r._init,r=s(r._payload),t.type=r,s=t.tag=HC(r),e=mn(r,e),s){case 0:t=Hh(null,t,r,e,n);break e;case 1:t=n0(null,t,r,e,n);break e;case 11:t=e0(null,t,r,e,n);break e;case 14:t=t0(null,t,r,mn(r.type,e),n);break e}throw Error(V(306,r,""))}return t;case 0:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:mn(r,s),Hh(e,t,r,s,n);case 1:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:mn(r,s),n0(e,t,r,s,n);case 3:e:{if(Fw(t),e===null)throw Error(V(387));r=t.pendingProps,o=t.memoizedState,s=o.element,dw(e,t),kc(t,r,null,n);var i=t.memoizedState;if(r=i.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:i.cache,pendingSuspenseBoundaries:i.pendingSuspenseBoundaries,transitions:i.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){s=Po(Error(V(423)),t),t=r0(e,t,r,n,s);break e}else if(r!==s){s=Po(Error(V(424)),t),t=r0(e,t,r,n,s);break e}else for(Wt=Er(t.stateNode.containerInfo.firstChild),Gt=t,Ne=!0,xn=null,n=cw(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(jo(),r===s){t=sr(e,t,n);break e}kt(e,t,r,n)}t=t.child}return t;case 5:return hw(t),e===null&&Fh(t),r=t.type,s=t.pendingProps,o=e!==null?e.memoizedProps:null,i=s.children,Mh(r,s)?i=null:o!==null&&Mh(r,o)&&(t.flags|=32),Iw(e,t),kt(e,t,i,n),t.child;case 6:return e===null&&Fh(t),null;case 13:return zw(e,t,n);case 4:return Pp(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Co(t,null,r,n):kt(e,t,r,n),t.child;case 11:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:mn(r,s),e0(e,t,r,s,n);case 7:return kt(e,t,t.pendingProps,n),t.child;case 8:return kt(e,t,t.pendingProps.children,n),t.child;case 12:return kt(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,s=t.pendingProps,o=t.memoizedProps,i=s.value,we(vc,r._currentValue),r._currentValue=i,o!==null)if(Sn(o.value,i)){if(o.children===s.children&&!Mt.current){t=sr(e,t,n);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var a=o.dependencies;if(a!==null){i=o.child;for(var l=a.firstContext;l!==null;){if(l.context===r){if(o.tag===1){l=Qn(-1,n&-n),l.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?l.next=l:(l.next=d.next,d.next=l),u.pending=l}}o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),zh(o.return,n,t),a.lanes|=n;break}l=l.next}}else if(o.tag===10)i=o.type===t.type?null:o.child;else if(o.tag===18){if(i=o.return,i===null)throw Error(V(341));i.lanes|=n,a=i.alternate,a!==null&&(a.lanes|=n),zh(i,n,t),i=o.sibling}else i=o.child;if(i!==null)i.return=o;else for(i=o;i!==null;){if(i===t){i=null;break}if(o=i.sibling,o!==null){o.return=i.return,i=o;break}i=i.return}o=i}kt(e,t,s.children,n),t=t.child}return t;case 9:return s=t.type,r=t.pendingProps.children,xo(t,n),s=un(s),r=r(s),t.flags|=1,kt(e,t,r,n),t.child;case 14:return r=t.type,s=mn(r,t.pendingProps),s=mn(r.type,s),t0(e,t,r,s,n);case 15:return Ow(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:mn(r,s),Wl(e,t),t.tag=1,Lt(r)?(e=!0,yc(t)):e=!1,xo(t,n),Aw(t,r,s),Bh(t,r,s,n),Uh(null,t,r,!0,e,n);case 19:return Vw(e,t,n);case 22:return Dw(e,t,n)}throw Error(V(156,t.tag))};function n1(e,t){return Rv(e,t)}function $C(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function an(e,t,n,r){return new $C(e,t,n,r)}function Hp(e){return e=e.prototype,!(!e||!e.isReactComponent)}function HC(e){if(typeof e=="function")return Hp(e)?1:0;if(e!=null){if(e=e.$$typeof,e===lp)return 11;if(e===cp)return 14}return 2}function Lr(e,t){var n=e.alternate;return n===null?(n=an(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Kl(e,t,n,r,s,o){var i=2;if(r=e,typeof e=="function")Hp(e)&&(i=1);else if(typeof e=="string")i=5;else e:switch(e){case Qs:return ks(n.children,s,o,t);case ap:i=8,s|=8;break;case dh:return e=an(12,n,t,s|2),e.elementType=dh,e.lanes=o,e;case hh:return e=an(13,n,t,s),e.elementType=hh,e.lanes=o,e;case fh:return e=an(19,n,t,s),e.elementType=fh,e.lanes=o,e;case hv:return lu(n,s,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case uv:i=10;break e;case dv:i=9;break e;case lp:i=11;break e;case cp:i=14;break e;case gr:i=16,r=null;break e}throw Error(V(130,e==null?e:typeof e,""))}return t=an(i,n,t,s),t.elementType=e,t.type=r,t.lanes=o,t}function ks(e,t,n,r){return e=an(7,e,r,t),e.lanes=n,e}function lu(e,t,n,r){return e=an(22,e,r,t),e.elementType=hv,e.lanes=n,e.stateNode={isHidden:!1},e}function xd(e,t,n){return e=an(6,e,null,t),e.lanes=n,e}function bd(e,t,n){return t=an(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function UC(e,t,n,r,s){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Zu(0),this.expirationTimes=Zu(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Zu(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function Up(e,t,n,r,s,o,i,a,l){return e=new UC(e,t,n,a,l),t===1?(t=1,o===!0&&(t|=8)):t=0,o=an(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Np(o),e}function WC(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(i1)}catch(e){console.error(e)}}i1(),iv.exports=Xt;var a1=iv.exports;const XC=Kb(a1);var g0=a1;ch.createRoot=g0.createRoot,ch.hydrateRoot=g0.hydrateRoot;/** +`+o.stack}return{value:e,source:t,stack:s,digest:null}}function md(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function $h(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var jC=typeof WeakMap=="function"?WeakMap:Map;function Mw(e,t,n){n=Qn(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){Nc||(Nc=!0,Jh=r),$h(e,t)},n}function Lw(e,t,n){n=Qn(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var s=t.value;n.payload=function(){return r(s)},n.callback=function(){$h(e,t)}}var o=e.stateNode;return o!==null&&typeof o.componentDidCatch=="function"&&(n.callback=function(){$h(e,t),typeof r!="function"&&(Ar===null?Ar=new Set([this]):Ar.add(this));var i=t.stack;this.componentDidCatch(t.value,{componentStack:i!==null?i:""})}),n}function Qm(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new jC;var s=new Set;r.set(t,s)}else s=r.get(t),s===void 0&&(s=new Set,r.set(t,s));s.has(n)||(s.add(n),e=zC.bind(null,e,t,n),t.then(e,e))}function Jm(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function Zm(e,t,n,r,s){return(e.mode&1)===0?(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=Qn(-1,1),t.tag=2,Tr(n,t,1))),n.lanes|=1),e):(e.flags|=65536,e.lanes=s,e)}var CC=ir.ReactCurrentOwner,At=!1;function kt(e,t,n,r){t.child=e===null?cw(t,null,n,r):No(t,e.child,n,r)}function e0(e,t,n,r,s){n=n.render;var o=t.ref;return bo(t,s),r=Ap(e,t,n,r,o,s),n=Mp(),e!==null&&!At?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,sr(e,t,s)):(Pe&&n&&vp(t),t.flags|=1,kt(e,t,r,s),t.child)}function t0(e,t,n,r,s){if(e===null){var o=n.type;return typeof o=="function"&&!Hp(o)&&o.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=o,Ow(e,t,o,r,s)):(e=ql(n.type,null,r,t,t.mode,s),e.ref=t.ref,e.return=t,t.child=e)}if(o=e.child,(e.lanes&s)===0){var i=o.memoizedProps;if(n=n.compare,n=n!==null?n:ta,n(i,r)&&e.ref===t.ref)return sr(e,t,s)}return t.flags|=1,e=Lr(o,r),e.ref=t.ref,e.return=t,t.child=e}function Ow(e,t,n,r,s){if(e!==null){var o=e.memoizedProps;if(ta(o,r)&&e.ref===t.ref)if(At=!1,t.pendingProps=r=o,(e.lanes&s)!==0)(e.flags&131072)!==0&&(At=!0);else return t.lanes=e.lanes,sr(e,t,s)}return Hh(e,t,n,r,s)}function Dw(e,t,n){var r=t.pendingProps,s=r.children,o=e!==null?e.memoizedState:null;if(r.mode==="hidden")if((t.mode&1)===0)t.memoizedState={baseLanes:0,cachePool:null,transitions:null},we(lo,Ht),Ht|=n;else{if((n&1073741824)===0)return e=o!==null?o.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,we(lo,Ht),Ht|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=o!==null?o.baseLanes:n,we(lo,Ht),Ht|=r}else o!==null?(r=o.baseLanes|n,t.memoizedState=null):r=n,we(lo,Ht),Ht|=r;return kt(e,t,s,n),t.child}function Iw(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Hh(e,t,n,r,s){var o=Lt(n)?Ns:xt.current;return o=jo(t,o),bo(t,s),n=Ap(e,t,n,r,o,s),r=Mp(),e!==null&&!At?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,sr(e,t,s)):(Pe&&r&&vp(t),t.flags|=1,kt(e,t,n,s),t.child)}function n0(e,t,n,r,s){if(Lt(n)){var o=!0;yc(t)}else o=!1;if(bo(t,s),t.stateNode===null)Wl(e,t),Aw(t,n,r),Bh(t,n,r,s),r=!0;else if(e===null){var i=t.stateNode,a=t.memoizedProps;i.props=a;var l=i.context,u=n.contextType;typeof u=="object"&&u!==null?u=un(u):(u=Lt(n)?Ns:xt.current,u=jo(t,u));var d=n.getDerivedStateFromProps,h=typeof d=="function"||typeof i.getSnapshotBeforeUpdate=="function";h||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(a!==r||l!==u)&&Xm(t,i,r,u),mr=!1;var f=t.memoizedState;i.state=f,kc(t,r,i,s),l=t.memoizedState,a!==r||f!==l||Mt.current||mr?(typeof d=="function"&&(Vh(t,n,d,r),l=t.memoizedState),(a=mr||Ym(t,n,a,r,f,l,u))?(h||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount()),typeof i.componentDidMount=="function"&&(t.flags|=4194308)):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),i.props=r,i.state=l,i.context=u,r=a):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{i=t.stateNode,dw(e,t),a=t.memoizedProps,u=t.type===t.elementType?a:mn(t.type,a),i.props=u,h=t.pendingProps,f=i.context,l=n.contextType,typeof l=="object"&&l!==null?l=un(l):(l=Lt(n)?Ns:xt.current,l=jo(t,l));var p=n.getDerivedStateFromProps;(d=typeof p=="function"||typeof i.getSnapshotBeforeUpdate=="function")||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(a!==h||f!==l)&&Xm(t,i,r,l),mr=!1,f=t.memoizedState,i.state=f,kc(t,r,i,s);var g=t.memoizedState;a!==h||f!==g||Mt.current||mr?(typeof p=="function"&&(Vh(t,n,p,r),g=t.memoizedState),(u=mr||Ym(t,n,u,r,f,g,l)||!1)?(d||typeof i.UNSAFE_componentWillUpdate!="function"&&typeof i.componentWillUpdate!="function"||(typeof i.componentWillUpdate=="function"&&i.componentWillUpdate(r,g,l),typeof i.UNSAFE_componentWillUpdate=="function"&&i.UNSAFE_componentWillUpdate(r,g,l)),typeof i.componentDidUpdate=="function"&&(t.flags|=4),typeof i.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof i.componentDidUpdate!="function"||a===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=g),i.props=r,i.state=g,i.context=l,r=u):(typeof i.componentDidUpdate!="function"||a===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return Uh(e,t,n,r,o,s)}function Uh(e,t,n,r,s,o){Iw(e,t);var i=(t.flags&128)!==0;if(!r&&!i)return s&&Bm(t,n,!1),sr(e,t,o);r=t.stateNode,CC.current=t;var a=i&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&i?(t.child=No(t,e.child,null,o),t.child=No(t,null,a,o)):kt(e,t,a,o),t.memoizedState=r.state,s&&Bm(t,n,!0),t.child}function Fw(e){var t=e.stateNode;t.pendingContext?Vm(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Vm(e,t.context,!1),Pp(e,t.containerInfo)}function r0(e,t,n,r,s){return Co(),kp(s),t.flags|=256,kt(e,t,n,r),t.child}var Wh={dehydrated:null,treeContext:null,retryLane:0};function Gh(e){return{baseLanes:e,cachePool:null,transitions:null}}function zw(e,t,n){var r=t.pendingProps,s=Re.current,o=!1,i=(t.flags&128)!==0,a;if((a=i)||(a=e!==null&&e.memoizedState===null?!1:(s&2)!==0),a?(o=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(s|=1),we(Re,s&1),e===null)return Fh(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?((t.mode&1)===0?t.lanes=1:e.data==="$!"?t.lanes=8:t.lanes=1073741824,null):(i=r.children,e=r.fallback,o?(r=t.mode,o=t.child,i={mode:"hidden",children:i},(r&1)===0&&o!==null?(o.childLanes=0,o.pendingProps=i):o=lu(i,r,0,null),e=ks(e,r,n,null),o.return=t,e.return=t,o.sibling=e,t.child=o,t.child.memoizedState=Gh(n),t.memoizedState=Wh,e):Dp(t,i));if(s=e.memoizedState,s!==null&&(a=s.dehydrated,a!==null))return NC(e,t,i,r,a,s,n);if(o){o=r.fallback,i=t.mode,s=e.child,a=s.sibling;var l={mode:"hidden",children:r.children};return(i&1)===0&&t.child!==s?(r=t.child,r.childLanes=0,r.pendingProps=l,t.deletions=null):(r=Lr(s,l),r.subtreeFlags=s.subtreeFlags&14680064),a!==null?o=Lr(a,o):(o=ks(o,i,n,null),o.flags|=2),o.return=t,r.return=t,r.sibling=o,t.child=r,r=o,o=t.child,i=e.child.memoizedState,i=i===null?Gh(n):{baseLanes:i.baseLanes|n,cachePool:null,transitions:i.transitions},o.memoizedState=i,o.childLanes=e.childLanes&~n,t.memoizedState=Wh,r}return o=e.child,e=o.sibling,r=Lr(o,{mode:"visible",children:r.children}),(t.mode&1)===0&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function Dp(e,t){return t=lu({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function il(e,t,n,r){return r!==null&&kp(r),No(t,e.child,null,n),e=Dp(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function NC(e,t,n,r,s,o,i){if(n)return t.flags&256?(t.flags&=-257,r=md(Error(V(422))),il(e,t,i,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(o=r.fallback,s=t.mode,r=lu({mode:"visible",children:r.children},s,0,null),o=ks(o,s,i,null),o.flags|=2,r.return=t,o.return=t,r.sibling=o,t.child=r,(t.mode&1)!==0&&No(t,e.child,null,i),t.child.memoizedState=Gh(i),t.memoizedState=Wh,o);if((t.mode&1)===0)return il(e,t,i,null);if(s.data==="$!"){if(r=s.nextSibling&&s.nextSibling.dataset,r)var a=r.dgst;return r=a,o=Error(V(419)),r=md(o,r,void 0),il(e,t,i,r)}if(a=(i&e.childLanes)!==0,At||a){if(r=tt,r!==null){switch(i&-i){case 4:s=2;break;case 16:s=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:s=32;break;case 536870912:s=268435456;break;default:s=0}s=(s&(r.suspendedLanes|i))!==0?0:s,s!==0&&s!==o.retryLane&&(o.retryLane=s,rr(e,s),wn(r,e,s,-1))}return $p(),r=md(Error(V(421))),il(e,t,i,r)}return s.data==="$?"?(t.flags|=128,t.child=e.child,t=VC.bind(null,e),s._reactRetry=t,null):(e=o.treeContext,Wt=Er(s.nextSibling),Gt=t,Pe=!0,xn=null,e!==null&&(sn[on++]=Kn,sn[on++]=qn,sn[on++]=Ps,Kn=e.id,qn=e.overflow,Ps=t),t=Dp(t,r.children),t.flags|=4096,t)}function s0(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),zh(e.return,t,n)}function yd(e,t,n,r,s){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:s}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=s)}function Vw(e,t,n){var r=t.pendingProps,s=r.revealOrder,o=r.tail;if(kt(e,t,r.children,n),r=Re.current,(r&2)!==0)r=r&1|2,t.flags|=128;else{if(e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&s0(e,n,t);else if(e.tag===19)s0(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(we(Re,r),(t.mode&1)===0)t.memoizedState=null;else switch(s){case"forwards":for(n=t.child,s=null;n!==null;)e=n.alternate,e!==null&&Sc(e)===null&&(s=n),n=n.sibling;n=s,n===null?(s=t.child,t.child=null):(s=n.sibling,n.sibling=null),yd(t,!1,s,n,o);break;case"backwards":for(n=null,s=t.child,t.child=null;s!==null;){if(e=s.alternate,e!==null&&Sc(e)===null){t.child=s;break}e=s.sibling,s.sibling=n,n=s,s=e}yd(t,!0,n,null,o);break;case"together":yd(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Wl(e,t){(t.mode&1)===0&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function sr(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Es|=t.lanes,(n&t.childLanes)===0)return null;if(e!==null&&t.child!==e.child)throw Error(V(153));if(t.child!==null){for(e=t.child,n=Lr(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Lr(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function PC(e,t,n){switch(t.tag){case 3:Fw(t),Co();break;case 5:hw(t);break;case 1:Lt(t.type)&&yc(t);break;case 4:Pp(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,s=t.memoizedProps.value;we(vc,r._currentValue),r._currentValue=s;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(we(Re,Re.current&1),t.flags|=128,null):(n&t.child.childLanes)!==0?zw(e,t,n):(we(Re,Re.current&1),e=sr(e,t,n),e!==null?e.sibling:null);we(Re,Re.current&1);break;case 19:if(r=(n&t.childLanes)!==0,(e.flags&128)!==0){if(r)return Vw(e,t,n);t.flags|=128}if(s=t.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),we(Re,Re.current),r)break;return null;case 22:case 23:return t.lanes=0,Dw(e,t,n)}return sr(e,t,n)}var Bw,Kh,$w,Hw;Bw=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};Kh=function(){};$w=function(e,t,n,r){var s=e.memoizedProps;if(s!==r){e=t.stateNode,ms(On.current);var o=null;switch(n){case"input":s=gh(e,s),r=gh(e,r),o=[];break;case"select":s=Le({},s,{value:void 0}),r=Le({},r,{value:void 0}),o=[];break;case"textarea":s=xh(e,s),r=xh(e,r),o=[];break;default:typeof s.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=gc)}vh(n,r);var i;n=null;for(u in s)if(!r.hasOwnProperty(u)&&s.hasOwnProperty(u)&&s[u]!=null)if(u==="style"){var a=s[u];for(i in a)a.hasOwnProperty(i)&&(n||(n={}),n[i]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(qi.hasOwnProperty(u)?o||(o=[]):(o=o||[]).push(u,null));for(u in r){var l=r[u];if(a=s!=null?s[u]:void 0,r.hasOwnProperty(u)&&l!==a&&(l!=null||a!=null))if(u==="style")if(a){for(i in a)!a.hasOwnProperty(i)||l&&l.hasOwnProperty(i)||(n||(n={}),n[i]="");for(i in l)l.hasOwnProperty(i)&&a[i]!==l[i]&&(n||(n={}),n[i]=l[i])}else n||(o||(o=[]),o.push(u,n)),n=l;else u==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,a=a?a.__html:void 0,l!=null&&a!==l&&(o=o||[]).push(u,l)):u==="children"?typeof l!="string"&&typeof l!="number"||(o=o||[]).push(u,""+l):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(qi.hasOwnProperty(u)?(l!=null&&u==="onScroll"&&_e("scroll",e),o||a===l||(o=[])):(o=o||[]).push(u,l))}n&&(o=o||[]).push("style",n);var u=o;(t.updateQueue=u)&&(t.flags|=4)}};Hw=function(e,t,n,r){n!==r&&(t.flags|=4)};function ii(e,t){if(!Pe)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function dt(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var s=e.child;s!==null;)n|=s.lanes|s.childLanes,r|=s.subtreeFlags&14680064,r|=s.flags&14680064,s.return=e,s=s.sibling;else for(s=e.child;s!==null;)n|=s.lanes|s.childLanes,r|=s.subtreeFlags,r|=s.flags,s.return=e,s=s.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function RC(e,t,n){var r=t.pendingProps;switch(wp(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return dt(t),null;case 1:return Lt(t.type)&&mc(),dt(t),null;case 3:return r=t.stateNode,Po(),Ce(Mt),Ce(xt),Ep(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(sl(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,xn!==null&&(tf(xn),xn=null))),Kh(e,t),dt(t),null;case 5:Rp(t);var s=ms(ia.current);if(n=t.type,e!==null&&t.stateNode!=null)$w(e,t,n,r,s),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(V(166));return dt(t),null}if(e=ms(On.current),sl(t)){r=t.stateNode,n=t.type;var o=t.memoizedProps;switch(r[Mn]=t,r[sa]=o,e=(t.mode&1)!==0,n){case"dialog":_e("cancel",r),_e("close",r);break;case"iframe":case"object":case"embed":_e("load",r);break;case"video":case"audio":for(s=0;s<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=i.createElement(n,{is:r.is}):(e=i.createElement(n),n==="select"&&(i=e,r.multiple?i.multiple=!0:r.size&&(i.size=r.size))):e=i.createElementNS(e,n),e[Mn]=t,e[sa]=r,Bw(e,t,!1,!1),t.stateNode=e;e:{switch(i=wh(n,r),n){case"dialog":_e("cancel",e),_e("close",e),s=r;break;case"iframe":case"object":case"embed":_e("load",e),s=r;break;case"video":case"audio":for(s=0;sEo&&(t.flags|=128,r=!0,ii(o,!1),t.lanes=4194304)}else{if(!r)if(e=Sc(i),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),ii(o,!0),o.tail===null&&o.tailMode==="hidden"&&!i.alternate&&!Pe)return dt(t),null}else 2*De()-o.renderingStartTime>Eo&&n!==1073741824&&(t.flags|=128,r=!0,ii(o,!1),t.lanes=4194304);o.isBackwards?(i.sibling=t.child,t.child=i):(n=o.last,n!==null?n.sibling=i:t.child=i,o.last=i)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=De(),t.sibling=null,n=Re.current,we(Re,r?n&1|2:n&1),t):(dt(t),null);case 22:case 23:return Bp(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&(t.mode&1)!==0?(Ht&1073741824)!==0&&(dt(t),t.subtreeFlags&6&&(t.flags|=8192)):dt(t),null;case 24:return null;case 25:return null}throw Error(V(156,t.tag))}function EC(e,t){switch(wp(t),t.tag){case 1:return Lt(t.type)&&mc(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Po(),Ce(Mt),Ce(xt),Ep(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 5:return Rp(t),null;case 13:if(Ce(Re),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(V(340));Co()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Ce(Re),null;case 4:return Po(),null;case 10:return jp(t.type._context),null;case 22:case 23:return Bp(),null;case 24:return null;default:return null}}var al=!1,gt=!1,TC=typeof WeakSet=="function"?WeakSet:Set,q=null;function ao(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Oe(e,t,r)}else n.current=null}function qh(e,t,n){try{n()}catch(r){Oe(e,t,r)}}var o0=!1;function AC(e,t){if(Th=hc,e=qv(),bp(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var s=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var i=0,a=-1,l=-1,u=0,d=0,h=e,f=null;t:for(;;){for(var p;h!==n||s!==0&&h.nodeType!==3||(a=i+s),h!==o||r!==0&&h.nodeType!==3||(l=i+r),h.nodeType===3&&(i+=h.nodeValue.length),(p=h.firstChild)!==null;)f=h,h=p;for(;;){if(h===e)break t;if(f===n&&++u===s&&(a=i),f===o&&++d===r&&(l=i),(p=h.nextSibling)!==null)break;h=f,f=h.parentNode}h=p}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(Ah={focusedElem:e,selectionRange:n},hc=!1,q=t;q!==null;)if(t=q,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,q=e;else for(;q!==null;){t=q;try{var g=t.alternate;if((t.flags&1024)!==0)switch(t.tag){case 0:case 11:case 15:break;case 1:if(g!==null){var m=g.memoizedProps,y=g.memoizedState,x=t.stateNode,v=x.getSnapshotBeforeUpdate(t.elementType===t.type?m:mn(t.type,m),y);x.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var b=t.stateNode.containerInfo;b.nodeType===1?b.textContent="":b.nodeType===9&&b.documentElement&&b.removeChild(b.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(V(163))}}catch(k){Oe(t,t.return,k)}if(e=t.sibling,e!==null){e.return=t.return,q=e;break}q=t.return}return g=o0,o0=!1,g}function Li(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var s=r=r.next;do{if((s.tag&e)===e){var o=s.destroy;s.destroy=void 0,o!==void 0&&qh(t,n,o)}s=s.next}while(s!==r)}}function iu(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Yh(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function Uw(e){var t=e.alternate;t!==null&&(e.alternate=null,Uw(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Mn],delete t[sa],delete t[Oh],delete t[pC],delete t[gC])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Ww(e){return e.tag===5||e.tag===3||e.tag===4}function i0(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Ww(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Xh(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=gc));else if(r!==4&&(e=e.child,e!==null))for(Xh(e,t,n),e=e.sibling;e!==null;)Xh(e,t,n),e=e.sibling}function Qh(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Qh(e,t,n),e=e.sibling;e!==null;)Qh(e,t,n),e=e.sibling}var ot=null,yn=!1;function ur(e,t,n){for(n=n.child;n!==null;)Gw(e,t,n),n=n.sibling}function Gw(e,t,n){if(Ln&&typeof Ln.onCommitFiberUnmount=="function")try{Ln.onCommitFiberUnmount(Jc,n)}catch{}switch(n.tag){case 5:gt||ao(n,t);case 6:var r=ot,s=yn;ot=null,ur(e,t,n),ot=r,yn=s,ot!==null&&(yn?(e=ot,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):ot.removeChild(n.stateNode));break;case 18:ot!==null&&(yn?(e=ot,n=n.stateNode,e.nodeType===8?ud(e.parentNode,n):e.nodeType===1&&ud(e,n),Zi(e)):ud(ot,n.stateNode));break;case 4:r=ot,s=yn,ot=n.stateNode.containerInfo,yn=!0,ur(e,t,n),ot=r,yn=s;break;case 0:case 11:case 14:case 15:if(!gt&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){s=r=r.next;do{var o=s,i=o.destroy;o=o.tag,i!==void 0&&((o&2)!==0||(o&4)!==0)&&qh(n,t,i),s=s.next}while(s!==r)}ur(e,t,n);break;case 1:if(!gt&&(ao(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){Oe(n,t,a)}ur(e,t,n);break;case 21:ur(e,t,n);break;case 22:n.mode&1?(gt=(r=gt)||n.memoizedState!==null,ur(e,t,n),gt=r):ur(e,t,n);break;default:ur(e,t,n)}}function a0(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new TC),t.forEach(function(r){var s=BC.bind(null,e,r);n.has(r)||(n.add(r),r.then(s,s))})}}function gn(e,t){var n=t.deletions;if(n!==null)for(var r=0;rs&&(s=i),r&=~o}if(r=s,r=De()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*LC(r/1960))-r,10e?16:e,wr===null)var r=!1;else{if(e=wr,wr=null,Pc=0,(pe&6)!==0)throw Error(V(331));var s=pe;for(pe|=4,q=e.current;q!==null;){var o=q,i=o.child;if((q.flags&16)!==0){var a=o.deletions;if(a!==null){for(var l=0;lDe()-zp?ws(e,0):Fp|=n),Ot(e,t)}function e1(e,t){t===0&&((e.mode&1)===0?t=1:(t=Ja,Ja<<=1,(Ja&130023424)===0&&(Ja=4194304)));var n=jt();e=rr(e,t),e!==null&&(Na(e,t,n),Ot(e,n))}function VC(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),e1(e,n)}function BC(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,s=e.memoizedState;s!==null&&(n=s.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(V(314))}r!==null&&r.delete(t),e1(e,n)}var t1;t1=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Mt.current)At=!0;else{if((e.lanes&n)===0&&(t.flags&128)===0)return At=!1,PC(e,t,n);At=(e.flags&131072)!==0}else At=!1,Pe&&(t.flags&1048576)!==0&&ow(t,bc,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Wl(e,t),e=t.pendingProps;var s=jo(t,xt.current);bo(t,n),s=Ap(null,t,r,e,s,n);var o=Mp();return t.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Lt(r)?(o=!0,yc(t)):o=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,Np(t),s.updater=ou,t.stateNode=s,s._reactInternals=t,Bh(t,r,e,n),t=Uh(null,t,r,!0,o,n)):(t.tag=0,Pe&&o&&vp(t),kt(null,t,s,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Wl(e,t),e=t.pendingProps,s=r._init,r=s(r._payload),t.type=r,s=t.tag=HC(r),e=mn(r,e),s){case 0:t=Hh(null,t,r,e,n);break e;case 1:t=n0(null,t,r,e,n);break e;case 11:t=e0(null,t,r,e,n);break e;case 14:t=t0(null,t,r,mn(r.type,e),n);break e}throw Error(V(306,r,""))}return t;case 0:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:mn(r,s),Hh(e,t,r,s,n);case 1:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:mn(r,s),n0(e,t,r,s,n);case 3:e:{if(Fw(t),e===null)throw Error(V(387));r=t.pendingProps,o=t.memoizedState,s=o.element,dw(e,t),kc(t,r,null,n);var i=t.memoizedState;if(r=i.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:i.cache,pendingSuspenseBoundaries:i.pendingSuspenseBoundaries,transitions:i.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){s=Ro(Error(V(423)),t),t=r0(e,t,r,n,s);break e}else if(r!==s){s=Ro(Error(V(424)),t),t=r0(e,t,r,n,s);break e}else for(Wt=Er(t.stateNode.containerInfo.firstChild),Gt=t,Pe=!0,xn=null,n=cw(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Co(),r===s){t=sr(e,t,n);break e}kt(e,t,r,n)}t=t.child}return t;case 5:return hw(t),e===null&&Fh(t),r=t.type,s=t.pendingProps,o=e!==null?e.memoizedProps:null,i=s.children,Mh(r,s)?i=null:o!==null&&Mh(r,o)&&(t.flags|=32),Iw(e,t),kt(e,t,i,n),t.child;case 6:return e===null&&Fh(t),null;case 13:return zw(e,t,n);case 4:return Pp(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=No(t,null,r,n):kt(e,t,r,n),t.child;case 11:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:mn(r,s),e0(e,t,r,s,n);case 7:return kt(e,t,t.pendingProps,n),t.child;case 8:return kt(e,t,t.pendingProps.children,n),t.child;case 12:return kt(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,s=t.pendingProps,o=t.memoizedProps,i=s.value,we(vc,r._currentValue),r._currentValue=i,o!==null)if(Sn(o.value,i)){if(o.children===s.children&&!Mt.current){t=sr(e,t,n);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var a=o.dependencies;if(a!==null){i=o.child;for(var l=a.firstContext;l!==null;){if(l.context===r){if(o.tag===1){l=Qn(-1,n&-n),l.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?l.next=l:(l.next=d.next,d.next=l),u.pending=l}}o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),zh(o.return,n,t),a.lanes|=n;break}l=l.next}}else if(o.tag===10)i=o.type===t.type?null:o.child;else if(o.tag===18){if(i=o.return,i===null)throw Error(V(341));i.lanes|=n,a=i.alternate,a!==null&&(a.lanes|=n),zh(i,n,t),i=o.sibling}else i=o.child;if(i!==null)i.return=o;else for(i=o;i!==null;){if(i===t){i=null;break}if(o=i.sibling,o!==null){o.return=i.return,i=o;break}i=i.return}o=i}kt(e,t,s.children,n),t=t.child}return t;case 9:return s=t.type,r=t.pendingProps.children,bo(t,n),s=un(s),r=r(s),t.flags|=1,kt(e,t,r,n),t.child;case 14:return r=t.type,s=mn(r,t.pendingProps),s=mn(r.type,s),t0(e,t,r,s,n);case 15:return Ow(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:mn(r,s),Wl(e,t),t.tag=1,Lt(r)?(e=!0,yc(t)):e=!1,bo(t,n),Aw(t,r,s),Bh(t,r,s,n),Uh(null,t,r,!0,e,n);case 19:return Vw(e,t,n);case 22:return Dw(e,t,n)}throw Error(V(156,t.tag))};function n1(e,t){return Rv(e,t)}function $C(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function an(e,t,n,r){return new $C(e,t,n,r)}function Hp(e){return e=e.prototype,!(!e||!e.isReactComponent)}function HC(e){if(typeof e=="function")return Hp(e)?1:0;if(e!=null){if(e=e.$$typeof,e===lp)return 11;if(e===cp)return 14}return 2}function Lr(e,t){var n=e.alternate;return n===null?(n=an(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function ql(e,t,n,r,s,o){var i=2;if(r=e,typeof e=="function")Hp(e)&&(i=1);else if(typeof e=="string")i=5;else e:switch(e){case Js:return ks(n.children,s,o,t);case ap:i=8,s|=8;break;case dh:return e=an(12,n,t,s|2),e.elementType=dh,e.lanes=o,e;case hh:return e=an(13,n,t,s),e.elementType=hh,e.lanes=o,e;case fh:return e=an(19,n,t,s),e.elementType=fh,e.lanes=o,e;case hv:return lu(n,s,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case uv:i=10;break e;case dv:i=9;break e;case lp:i=11;break e;case cp:i=14;break e;case gr:i=16,r=null;break e}throw Error(V(130,e==null?e:typeof e,""))}return t=an(i,n,t,s),t.elementType=e,t.type=r,t.lanes=o,t}function ks(e,t,n,r){return e=an(7,e,r,t),e.lanes=n,e}function lu(e,t,n,r){return e=an(22,e,r,t),e.elementType=hv,e.lanes=n,e.stateNode={isHidden:!1},e}function xd(e,t,n){return e=an(6,e,null,t),e.lanes=n,e}function bd(e,t,n){return t=an(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function UC(e,t,n,r,s){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Zu(0),this.expirationTimes=Zu(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Zu(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function Up(e,t,n,r,s,o,i,a,l){return e=new UC(e,t,n,a,l),t===1?(t=1,o===!0&&(t|=8)):t=0,o=an(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Np(o),e}function WC(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(i1)}catch(e){console.error(e)}}i1(),iv.exports=Xt;var a1=iv.exports;const XC=qb(a1);var g0=a1;ch.createRoot=g0.createRoot,ch.hydrateRoot=g0.hydrateRoot;/** * @remix-run/router v1.23.2 * * Copyright (c) Remix Software Inc. @@ -46,7 +46,7 @@ Error generating stack: `+o.message+` * LICENSE.md file in the root directory of this source tree. * * @license MIT - */function da(){return da=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u")throw new Error(t)}function Kp(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function JC(){return Math.random().toString(36).substr(2,8)}function y0(e,t){return{usr:e.state,key:e.key,idx:t}}function nf(e,t,n,r){return n===void 0&&(n=null),da({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?Uo(t):t,{state:n,key:t&&t.key||r||JC()})}function Tc(e){let{pathname:t="/",search:n="",hash:r=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(t+=r.charAt(0)==="#"?r:"#"+r),t}function Uo(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function ZC(e,t,n,r){r===void 0&&(r={});let{window:s=document.defaultView,v5Compat:o=!1}=r,i=s.history,a=kr.Pop,l=null,u=d();u==null&&(u=0,i.replaceState(da({},i.state,{idx:u}),""));function d(){return(i.state||{idx:null}).idx}function h(){a=kr.Pop;let y=d(),x=y==null?null:y-u;u=y,l&&l({action:a,location:m.location,delta:x})}function f(y,x){a=kr.Push;let v=nf(m.location,y,x);u=d()+1;let b=y0(v,u),k=m.createHref(v);try{i.pushState(b,"",k)}catch(w){if(w instanceof DOMException&&w.name==="DataCloneError")throw w;s.location.assign(k)}o&&l&&l({action:a,location:m.location,delta:1})}function p(y,x){a=kr.Replace;let v=nf(m.location,y,x);u=d();let b=y0(v,u),k=m.createHref(v);i.replaceState(b,"",k),o&&l&&l({action:a,location:m.location,delta:0})}function g(y){let x=s.location.origin!=="null"?s.location.origin:s.location.href,v=typeof y=="string"?y:Tc(y);return v=v.replace(/ $/,"%20"),ze(x,"No window.location.(origin|href) available to create URL for href: "+v),new URL(v,x)}let m={get action(){return a},get location(){return e(s,i)},listen(y){if(l)throw new Error("A history only accepts one active listener");return s.addEventListener(m0,h),l=y,()=>{s.removeEventListener(m0,h),l=null}},createHref(y){return t(s,y)},createURL:g,encodeLocation(y){let x=g(y);return{pathname:x.pathname,search:x.search,hash:x.hash}},push:f,replace:p,go(y){return i.go(y)}};return m}var x0;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(x0||(x0={}));function eN(e,t,n){return n===void 0&&(n="/"),tN(e,t,n)}function tN(e,t,n,r){let s=typeof t=="string"?Uo(t):t,o=Yp(s.pathname||"/",n);if(o==null)return null;let i=l1(e);nN(i);let a=null;for(let l=0;a==null&&l{let l={relativePath:a===void 0?o.path||"":a,caseSensitive:o.caseSensitive===!0,childrenIndex:i,route:o};l.relativePath.startsWith("/")&&(ze(l.relativePath.startsWith(r),'Absolute route path "'+l.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),l.relativePath=l.relativePath.slice(r.length));let u=Or([r,l.relativePath]),d=n.concat(l);o.children&&o.children.length>0&&(ze(o.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),l1(o.children,t,d,u)),!(o.path==null&&!o.index)&&t.push({path:u,score:cN(u,o.index),routesMeta:d})};return e.forEach((o,i)=>{var a;if(o.path===""||!((a=o.path)!=null&&a.includes("?")))s(o,i);else for(let l of c1(o.path))s(o,i,l)}),t}function c1(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,s=n.endsWith("?"),o=n.replace(/\?$/,"");if(r.length===0)return s?[o,""]:[o];let i=c1(r.join("/")),a=[];return a.push(...i.map(l=>l===""?o:[o,l].join("/"))),s&&a.push(...i),a.map(l=>e.startsWith("/")&&l===""?"/":l)}function nN(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:uN(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const rN=/^:[\w-]+$/,sN=3,oN=2,iN=1,aN=10,lN=-2,b0=e=>e==="*";function cN(e,t){let n=e.split("/"),r=n.length;return n.some(b0)&&(r+=lN),t&&(r+=oN),n.filter(s=>!b0(s)).reduce((s,o)=>s+(rN.test(o)?sN:o===""?iN:aN),r)}function uN(e,t){return e.length===t.length&&e.slice(0,-1).every((r,s)=>r===t[s])?e[e.length-1]-t[t.length-1]:0}function dN(e,t,n){let{routesMeta:r}=e,s={},o="/",i=[];for(let a=0;a{let{paramName:f,isOptional:p}=d;if(f==="*"){let m=a[h]||"";i=o.slice(0,o.length-m.length).replace(/(.)\/+$/,"$1")}const g=a[h];return p&&!g?u[f]=void 0:u[f]=(g||"").replace(/%2F/g,"/"),u},{}),pathname:o,pathnameBase:i,pattern:e}}function fN(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),Kp(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let r=[],s="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(i,a,l)=>(r.push({paramName:a,isOptional:l!=null}),l?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(r.push({paramName:"*"}),s+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?s+="\\/*$":e!==""&&e!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,t?void 0:"i"),r]}function pN(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Kp(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function Yp(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}const gN=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,mN=e=>gN.test(e);function yN(e,t){t===void 0&&(t="/");let{pathname:n,search:r="",hash:s=""}=typeof e=="string"?Uo(e):e,o;if(n)if(mN(n))o=n;else{if(n.includes("//")){let i=n;n=n.replace(/\/\/+/g,"/"),Kp(!1,"Pathnames cannot have embedded double slashes - normalizing "+(i+" -> "+n))}n.startsWith("/")?o=v0(n.substring(1),"/"):o=v0(n,t)}else o=t;return{pathname:o,search:vN(r),hash:wN(s)}}function v0(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(s=>{s===".."?n.length>1&&n.pop():s!=="."&&n.push(s)}),n.length>1?n.join("/"):"/"}function vd(e,t,n,r){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function xN(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function Xp(e,t){let n=xN(e);return t?n.map((r,s)=>s===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function Qp(e,t,n,r){r===void 0&&(r=!1);let s;typeof e=="string"?s=Uo(e):(s=da({},e),ze(!s.pathname||!s.pathname.includes("?"),vd("?","pathname","search",s)),ze(!s.pathname||!s.pathname.includes("#"),vd("#","pathname","hash",s)),ze(!s.search||!s.search.includes("#"),vd("#","search","hash",s)));let o=e===""||s.pathname==="",i=o?"/":s.pathname,a;if(i==null)a=n;else{let h=t.length-1;if(!r&&i.startsWith("..")){let f=i.split("/");for(;f[0]==="..";)f.shift(),h-=1;s.pathname=f.join("/")}a=h>=0?t[h]:"/"}let l=yN(s,a),u=i&&i!=="/"&&i.endsWith("/"),d=(o||i===".")&&n.endsWith("/");return!l.pathname.endsWith("/")&&(u||d)&&(l.pathname+="/"),l}const Or=e=>e.join("/").replace(/\/\/+/g,"/"),bN=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),vN=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,wN=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function kN(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const u1=["post","put","patch","delete"];new Set(u1);const SN=["get",...u1];new Set(SN);/** + */function da(){return da=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u")throw new Error(t)}function qp(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function JC(){return Math.random().toString(36).substr(2,8)}function y0(e,t){return{usr:e.state,key:e.key,idx:t}}function nf(e,t,n,r){return n===void 0&&(n=null),da({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?Wo(t):t,{state:n,key:t&&t.key||r||JC()})}function Tc(e){let{pathname:t="/",search:n="",hash:r=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(t+=r.charAt(0)==="#"?r:"#"+r),t}function Wo(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function ZC(e,t,n,r){r===void 0&&(r={});let{window:s=document.defaultView,v5Compat:o=!1}=r,i=s.history,a=kr.Pop,l=null,u=d();u==null&&(u=0,i.replaceState(da({},i.state,{idx:u}),""));function d(){return(i.state||{idx:null}).idx}function h(){a=kr.Pop;let y=d(),x=y==null?null:y-u;u=y,l&&l({action:a,location:m.location,delta:x})}function f(y,x){a=kr.Push;let v=nf(m.location,y,x);u=d()+1;let b=y0(v,u),k=m.createHref(v);try{i.pushState(b,"",k)}catch(w){if(w instanceof DOMException&&w.name==="DataCloneError")throw w;s.location.assign(k)}o&&l&&l({action:a,location:m.location,delta:1})}function p(y,x){a=kr.Replace;let v=nf(m.location,y,x);u=d();let b=y0(v,u),k=m.createHref(v);i.replaceState(b,"",k),o&&l&&l({action:a,location:m.location,delta:0})}function g(y){let x=s.location.origin!=="null"?s.location.origin:s.location.href,v=typeof y=="string"?y:Tc(y);return v=v.replace(/ $/,"%20"),ze(x,"No window.location.(origin|href) available to create URL for href: "+v),new URL(v,x)}let m={get action(){return a},get location(){return e(s,i)},listen(y){if(l)throw new Error("A history only accepts one active listener");return s.addEventListener(m0,h),l=y,()=>{s.removeEventListener(m0,h),l=null}},createHref(y){return t(s,y)},createURL:g,encodeLocation(y){let x=g(y);return{pathname:x.pathname,search:x.search,hash:x.hash}},push:f,replace:p,go(y){return i.go(y)}};return m}var x0;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(x0||(x0={}));function eN(e,t,n){return n===void 0&&(n="/"),tN(e,t,n)}function tN(e,t,n,r){let s=typeof t=="string"?Wo(t):t,o=Yp(s.pathname||"/",n);if(o==null)return null;let i=l1(e);nN(i);let a=null;for(let l=0;a==null&&l{let l={relativePath:a===void 0?o.path||"":a,caseSensitive:o.caseSensitive===!0,childrenIndex:i,route:o};l.relativePath.startsWith("/")&&(ze(l.relativePath.startsWith(r),'Absolute route path "'+l.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),l.relativePath=l.relativePath.slice(r.length));let u=Or([r,l.relativePath]),d=n.concat(l);o.children&&o.children.length>0&&(ze(o.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),l1(o.children,t,d,u)),!(o.path==null&&!o.index)&&t.push({path:u,score:cN(u,o.index),routesMeta:d})};return e.forEach((o,i)=>{var a;if(o.path===""||!((a=o.path)!=null&&a.includes("?")))s(o,i);else for(let l of c1(o.path))s(o,i,l)}),t}function c1(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,s=n.endsWith("?"),o=n.replace(/\?$/,"");if(r.length===0)return s?[o,""]:[o];let i=c1(r.join("/")),a=[];return a.push(...i.map(l=>l===""?o:[o,l].join("/"))),s&&a.push(...i),a.map(l=>e.startsWith("/")&&l===""?"/":l)}function nN(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:uN(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const rN=/^:[\w-]+$/,sN=3,oN=2,iN=1,aN=10,lN=-2,b0=e=>e==="*";function cN(e,t){let n=e.split("/"),r=n.length;return n.some(b0)&&(r+=lN),t&&(r+=oN),n.filter(s=>!b0(s)).reduce((s,o)=>s+(rN.test(o)?sN:o===""?iN:aN),r)}function uN(e,t){return e.length===t.length&&e.slice(0,-1).every((r,s)=>r===t[s])?e[e.length-1]-t[t.length-1]:0}function dN(e,t,n){let{routesMeta:r}=e,s={},o="/",i=[];for(let a=0;a{let{paramName:f,isOptional:p}=d;if(f==="*"){let m=a[h]||"";i=o.slice(0,o.length-m.length).replace(/(.)\/+$/,"$1")}const g=a[h];return p&&!g?u[f]=void 0:u[f]=(g||"").replace(/%2F/g,"/"),u},{}),pathname:o,pathnameBase:i,pattern:e}}function fN(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),qp(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let r=[],s="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(i,a,l)=>(r.push({paramName:a,isOptional:l!=null}),l?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(r.push({paramName:"*"}),s+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?s+="\\/*$":e!==""&&e!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,t?void 0:"i"),r]}function pN(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return qp(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function Yp(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}const gN=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,mN=e=>gN.test(e);function yN(e,t){t===void 0&&(t="/");let{pathname:n,search:r="",hash:s=""}=typeof e=="string"?Wo(e):e,o;if(n)if(mN(n))o=n;else{if(n.includes("//")){let i=n;n=n.replace(/\/\/+/g,"/"),qp(!1,"Pathnames cannot have embedded double slashes - normalizing "+(i+" -> "+n))}n.startsWith("/")?o=v0(n.substring(1),"/"):o=v0(n,t)}else o=t;return{pathname:o,search:vN(r),hash:wN(s)}}function v0(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(s=>{s===".."?n.length>1&&n.pop():s!=="."&&n.push(s)}),n.length>1?n.join("/"):"/"}function vd(e,t,n,r){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function xN(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function Xp(e,t){let n=xN(e);return t?n.map((r,s)=>s===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function Qp(e,t,n,r){r===void 0&&(r=!1);let s;typeof e=="string"?s=Wo(e):(s=da({},e),ze(!s.pathname||!s.pathname.includes("?"),vd("?","pathname","search",s)),ze(!s.pathname||!s.pathname.includes("#"),vd("#","pathname","hash",s)),ze(!s.search||!s.search.includes("#"),vd("#","search","hash",s)));let o=e===""||s.pathname==="",i=o?"/":s.pathname,a;if(i==null)a=n;else{let h=t.length-1;if(!r&&i.startsWith("..")){let f=i.split("/");for(;f[0]==="..";)f.shift(),h-=1;s.pathname=f.join("/")}a=h>=0?t[h]:"/"}let l=yN(s,a),u=i&&i!=="/"&&i.endsWith("/"),d=(o||i===".")&&n.endsWith("/");return!l.pathname.endsWith("/")&&(u||d)&&(l.pathname+="/"),l}const Or=e=>e.join("/").replace(/\/\/+/g,"/"),bN=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),vN=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,wN=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function kN(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const u1=["post","put","patch","delete"];new Set(u1);const SN=["get",...u1];new Set(SN);/** * React Router v6.30.3 * * Copyright (c) Remix Software Inc. @@ -55,7 +55,7 @@ Error generating stack: `+o.message+` * LICENSE.md file in the root directory of this source tree. * * @license MIT - */function ha(){return ha=Object.assign?Object.assign.bind():function(e){for(var t=1;t{a.current=!0}),S.useCallback(function(u,d){if(d===void 0&&(d={}),!a.current)return;if(typeof u=="number"){r.go(u);return}let h=Qp(u,JSON.parse(i),o,d.relative==="path");e==null&&t!=="/"&&(h.pathname=h.pathname==="/"?t:Or([t,h.pathname])),(d.replace?r.replace:r.push)(h,d.state,d)},[t,r,i,o,e])}function f1(e,t){let{relative:n}=t===void 0?{}:t,{future:r}=S.useContext(Yr),{matches:s}=S.useContext(Xr),{pathname:o}=ar(),i=JSON.stringify(Xp(s,r.v7_relativeSplatPath));return S.useMemo(()=>Qp(e,JSON.parse(i),o,n==="path"),[e,i,o,n])}function NN(e,t){return PN(e,t)}function PN(e,t,n,r){Wo()||ze(!1);let{navigator:s}=S.useContext(Yr),{matches:o}=S.useContext(Xr),i=o[o.length-1],a=i?i.params:{};i&&i.pathname;let l=i?i.pathnameBase:"/";i&&i.route;let u=ar(),d;if(t){var h;let y=typeof t=="string"?Uo(t):t;l==="/"||(h=y.pathname)!=null&&h.startsWith(l)||ze(!1),d=y}else d=u;let f=d.pathname||"/",p=f;if(l!=="/"){let y=l.replace(/^\//,"").split("/");p="/"+f.replace(/^\//,"").split("/").slice(y.length).join("/")}let g=eN(e,{pathname:p}),m=MN(g&&g.map(y=>Object.assign({},y,{params:Object.assign({},a,y.params),pathname:Or([l,s.encodeLocation?s.encodeLocation(y.pathname).pathname:y.pathname]),pathnameBase:y.pathnameBase==="/"?l:Or([l,s.encodeLocation?s.encodeLocation(y.pathnameBase).pathname:y.pathnameBase])})),o,n,r);return t&&m?S.createElement(fu.Provider,{value:{location:ha({pathname:"/",search:"",hash:"",state:null,key:"default"},d),navigationType:kr.Pop}},m):m}function RN(){let e=IN(),t=kN(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,s={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return S.createElement(S.Fragment,null,S.createElement("h2",null,"Unexpected Application Error!"),S.createElement("h3",{style:{fontStyle:"italic"}},t),n?S.createElement("pre",{style:s},n):null,null)}const EN=S.createElement(RN,null);class TN extends S.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?S.createElement(Xr.Provider,{value:this.props.routeContext},S.createElement(d1.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function AN(e){let{routeContext:t,match:n,children:r}=e,s=S.useContext(Jp);return s&&s.static&&s.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=n.route.id),S.createElement(Xr.Provider,{value:t},r)}function MN(e,t,n,r){var s;if(t===void 0&&(t=[]),n===void 0&&(n=null),r===void 0&&(r=null),e==null){var o;if(!n)return null;if(n.errors)e=n.matches;else if((o=r)!=null&&o.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let i=e,a=(s=n)==null?void 0:s.errors;if(a!=null){let d=i.findIndex(h=>h.route.id&&(a==null?void 0:a[h.route.id])!==void 0);d>=0||ze(!1),i=i.slice(0,Math.min(i.length,d+1))}let l=!1,u=-1;if(n&&r&&r.v7_partialHydration)for(let d=0;d=0?i=i.slice(0,u+1):i=[i[0]];break}}}return i.reduceRight((d,h,f)=>{let p,g=!1,m=null,y=null;n&&(p=a&&h.route.id?a[h.route.id]:void 0,m=h.route.errorElement||EN,l&&(u<0&&f===0?(zN("route-fallback"),g=!0,y=null):u===f&&(g=!0,y=h.route.hydrateFallbackElement||null)));let x=t.concat(i.slice(0,f+1)),v=()=>{let b;return p?b=m:g?b=y:h.route.Component?b=S.createElement(h.route.Component,null):h.route.element?b=h.route.element:b=d,S.createElement(AN,{match:h,routeContext:{outlet:d,matches:x,isDataRoute:n!=null},children:b})};return n&&(h.route.ErrorBoundary||h.route.errorElement||f===0)?S.createElement(TN,{location:n.location,revalidation:n.revalidation,component:m,error:p,children:v(),routeContext:{outlet:null,matches:x,isDataRoute:!0}}):v()},null)}var p1=(function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e})(p1||{}),g1=(function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e})(g1||{});function LN(e){let t=S.useContext(Jp);return t||ze(!1),t}function ON(e){let t=S.useContext(_N);return t||ze(!1),t}function DN(e){let t=S.useContext(Xr);return t||ze(!1),t}function m1(e){let t=DN(),n=t.matches[t.matches.length-1];return n.route.id||ze(!1),n.route.id}function IN(){var e;let t=S.useContext(d1),n=ON(),r=m1();return t!==void 0?t:(e=n.errors)==null?void 0:e[r]}function FN(){let{router:e}=LN(p1.UseNavigateStable),t=m1(g1.UseNavigateStable),n=S.useRef(!1);return h1(()=>{n.current=!0}),S.useCallback(function(s,o){o===void 0&&(o={}),n.current&&(typeof s=="number"?e.navigate(s):e.navigate(s,ha({fromRouteId:t},o)))},[e,t])}const w0={};function zN(e,t,n){w0[e]||(w0[e]=!0)}function VN(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function y1(e){let{to:t,replace:n,state:r,relative:s}=e;Wo()||ze(!1);let{future:o,static:i}=S.useContext(Yr),{matches:a}=S.useContext(Xr),{pathname:l}=ar(),u=Is(),d=Qp(t,Xp(a,o.v7_relativeSplatPath),l,s==="path"),h=JSON.stringify(d);return S.useEffect(()=>u(JSON.parse(h),{replace:n,state:r,relative:s}),[u,h,s,n,r]),null}function Je(e){ze(!1)}function BN(e){let{basename:t="/",children:n=null,location:r,navigationType:s=kr.Pop,navigator:o,static:i=!1,future:a}=e;Wo()&&ze(!1);let l=t.replace(/^\/*/,"/"),u=S.useMemo(()=>({basename:l,navigator:o,static:i,future:ha({v7_relativeSplatPath:!1},a)}),[l,a,o,i]);typeof r=="string"&&(r=Uo(r));let{pathname:d="/",search:h="",hash:f="",state:p=null,key:g="default"}=r,m=S.useMemo(()=>{let y=Yp(d,l);return y==null?null:{location:{pathname:y,search:h,hash:f,state:p,key:g},navigationType:s}},[l,d,h,f,p,g,s]);return m==null?null:S.createElement(Yr.Provider,{value:u},S.createElement(fu.Provider,{children:n,value:m}))}function $N(e){let{children:t,location:n}=e;return NN(rf(t),n)}new Promise(()=>{});function rf(e,t){t===void 0&&(t=[]);let n=[];return S.Children.forEach(e,(r,s)=>{if(!S.isValidElement(r))return;let o=[...t,s];if(r.type===S.Fragment){n.push.apply(n,rf(r.props.children,o));return}r.type!==Je&&ze(!1),!r.props.index||!r.props.children||ze(!1);let i={id:r.props.id||o.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(i.children=rf(r.props.children,o)),n.push(i)}),n}/** + */function ha(){return ha=Object.assign?Object.assign.bind():function(e){for(var t=1;t{a.current=!0}),S.useCallback(function(u,d){if(d===void 0&&(d={}),!a.current)return;if(typeof u=="number"){r.go(u);return}let h=Qp(u,JSON.parse(i),o,d.relative==="path");e==null&&t!=="/"&&(h.pathname=h.pathname==="/"?t:Or([t,h.pathname])),(d.replace?r.replace:r.push)(h,d.state,d)},[t,r,i,o,e])}function f1(e,t){let{relative:n}=t===void 0?{}:t,{future:r}=S.useContext(Yr),{matches:s}=S.useContext(Xr),{pathname:o}=ar(),i=JSON.stringify(Xp(s,r.v7_relativeSplatPath));return S.useMemo(()=>Qp(e,JSON.parse(i),o,n==="path"),[e,i,o,n])}function NN(e,t){return PN(e,t)}function PN(e,t,n,r){Go()||ze(!1);let{navigator:s}=S.useContext(Yr),{matches:o}=S.useContext(Xr),i=o[o.length-1],a=i?i.params:{};i&&i.pathname;let l=i?i.pathnameBase:"/";i&&i.route;let u=ar(),d;if(t){var h;let y=typeof t=="string"?Wo(t):t;l==="/"||(h=y.pathname)!=null&&h.startsWith(l)||ze(!1),d=y}else d=u;let f=d.pathname||"/",p=f;if(l!=="/"){let y=l.replace(/^\//,"").split("/");p="/"+f.replace(/^\//,"").split("/").slice(y.length).join("/")}let g=eN(e,{pathname:p}),m=MN(g&&g.map(y=>Object.assign({},y,{params:Object.assign({},a,y.params),pathname:Or([l,s.encodeLocation?s.encodeLocation(y.pathname).pathname:y.pathname]),pathnameBase:y.pathnameBase==="/"?l:Or([l,s.encodeLocation?s.encodeLocation(y.pathnameBase).pathname:y.pathnameBase])})),o,n,r);return t&&m?S.createElement(fu.Provider,{value:{location:ha({pathname:"/",search:"",hash:"",state:null,key:"default"},d),navigationType:kr.Pop}},m):m}function RN(){let e=IN(),t=kN(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,s={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return S.createElement(S.Fragment,null,S.createElement("h2",null,"Unexpected Application Error!"),S.createElement("h3",{style:{fontStyle:"italic"}},t),n?S.createElement("pre",{style:s},n):null,null)}const EN=S.createElement(RN,null);class TN extends S.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?S.createElement(Xr.Provider,{value:this.props.routeContext},S.createElement(d1.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function AN(e){let{routeContext:t,match:n,children:r}=e,s=S.useContext(Jp);return s&&s.static&&s.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=n.route.id),S.createElement(Xr.Provider,{value:t},r)}function MN(e,t,n,r){var s;if(t===void 0&&(t=[]),n===void 0&&(n=null),r===void 0&&(r=null),e==null){var o;if(!n)return null;if(n.errors)e=n.matches;else if((o=r)!=null&&o.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let i=e,a=(s=n)==null?void 0:s.errors;if(a!=null){let d=i.findIndex(h=>h.route.id&&(a==null?void 0:a[h.route.id])!==void 0);d>=0||ze(!1),i=i.slice(0,Math.min(i.length,d+1))}let l=!1,u=-1;if(n&&r&&r.v7_partialHydration)for(let d=0;d=0?i=i.slice(0,u+1):i=[i[0]];break}}}return i.reduceRight((d,h,f)=>{let p,g=!1,m=null,y=null;n&&(p=a&&h.route.id?a[h.route.id]:void 0,m=h.route.errorElement||EN,l&&(u<0&&f===0?(zN("route-fallback"),g=!0,y=null):u===f&&(g=!0,y=h.route.hydrateFallbackElement||null)));let x=t.concat(i.slice(0,f+1)),v=()=>{let b;return p?b=m:g?b=y:h.route.Component?b=S.createElement(h.route.Component,null):h.route.element?b=h.route.element:b=d,S.createElement(AN,{match:h,routeContext:{outlet:d,matches:x,isDataRoute:n!=null},children:b})};return n&&(h.route.ErrorBoundary||h.route.errorElement||f===0)?S.createElement(TN,{location:n.location,revalidation:n.revalidation,component:m,error:p,children:v(),routeContext:{outlet:null,matches:x,isDataRoute:!0}}):v()},null)}var p1=(function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e})(p1||{}),g1=(function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e})(g1||{});function LN(e){let t=S.useContext(Jp);return t||ze(!1),t}function ON(e){let t=S.useContext(_N);return t||ze(!1),t}function DN(e){let t=S.useContext(Xr);return t||ze(!1),t}function m1(e){let t=DN(),n=t.matches[t.matches.length-1];return n.route.id||ze(!1),n.route.id}function IN(){var e;let t=S.useContext(d1),n=ON(),r=m1();return t!==void 0?t:(e=n.errors)==null?void 0:e[r]}function FN(){let{router:e}=LN(p1.UseNavigateStable),t=m1(g1.UseNavigateStable),n=S.useRef(!1);return h1(()=>{n.current=!0}),S.useCallback(function(s,o){o===void 0&&(o={}),n.current&&(typeof s=="number"?e.navigate(s):e.navigate(s,ha({fromRouteId:t},o)))},[e,t])}const w0={};function zN(e,t,n){w0[e]||(w0[e]=!0)}function VN(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function y1(e){let{to:t,replace:n,state:r,relative:s}=e;Go()||ze(!1);let{future:o,static:i}=S.useContext(Yr),{matches:a}=S.useContext(Xr),{pathname:l}=ar(),u=Is(),d=Qp(t,Xp(a,o.v7_relativeSplatPath),l,s==="path"),h=JSON.stringify(d);return S.useEffect(()=>u(JSON.parse(h),{replace:n,state:r,relative:s}),[u,h,s,n,r]),null}function Je(e){ze(!1)}function BN(e){let{basename:t="/",children:n=null,location:r,navigationType:s=kr.Pop,navigator:o,static:i=!1,future:a}=e;Go()&&ze(!1);let l=t.replace(/^\/*/,"/"),u=S.useMemo(()=>({basename:l,navigator:o,static:i,future:ha({v7_relativeSplatPath:!1},a)}),[l,a,o,i]);typeof r=="string"&&(r=Wo(r));let{pathname:d="/",search:h="",hash:f="",state:p=null,key:g="default"}=r,m=S.useMemo(()=>{let y=Yp(d,l);return y==null?null:{location:{pathname:y,search:h,hash:f,state:p,key:g},navigationType:s}},[l,d,h,f,p,g,s]);return m==null?null:S.createElement(Yr.Provider,{value:u},S.createElement(fu.Provider,{children:n,value:m}))}function $N(e){let{children:t,location:n}=e;return NN(rf(t),n)}new Promise(()=>{});function rf(e,t){t===void 0&&(t=[]);let n=[];return S.Children.forEach(e,(r,s)=>{if(!S.isValidElement(r))return;let o=[...t,s];if(r.type===S.Fragment){n.push.apply(n,rf(r.props.children,o));return}r.type!==Je&&ze(!1),!r.props.index||!r.props.children||ze(!1);let i={id:r.props.id||o.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(i.children=rf(r.props.children,o)),n.push(i)}),n}/** * React Router DOM v6.30.3 * * Copyright (c) Remix Software Inc. @@ -64,12 +64,12 @@ Error generating stack: `+o.message+` * LICENSE.md file in the root directory of this source tree. * * @license MIT - */function sf(){return sf=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&(n[s]=e[s]);return n}function UN(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function WN(e,t){return e.button===0&&(!t||t==="_self")&&!UN(e)}function of(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(s=>[n,s]):[[n,r]])},[]))}function GN(e,t){let n=of(e);return t&&t.forEach((r,s)=>{n.has(s)||t.getAll(s).forEach(o=>{n.append(s,o)})}),n}const qN=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],KN="6";try{window.__reactRouterVersion=KN}catch{}const YN="startTransition",k0=z_[YN];function XN(e){let{basename:t,children:n,future:r,window:s}=e,o=S.useRef();o.current==null&&(o.current=QC({window:s,v5Compat:!0}));let i=o.current,[a,l]=S.useState({action:i.action,location:i.location}),{v7_startTransition:u}=r||{},d=S.useCallback(h=>{u&&k0?k0(()=>l(h)):l(h)},[l,u]);return S.useLayoutEffect(()=>i.listen(d),[i,d]),S.useEffect(()=>VN(r),[r]),S.createElement(BN,{basename:t,children:n,location:a.location,navigationType:a.action,navigator:i,future:r})}const QN=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",JN=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Ee=S.forwardRef(function(t,n){let{onClick:r,relative:s,reloadDocument:o,replace:i,state:a,target:l,to:u,preventScrollReset:d,viewTransition:h}=t,f=HN(t,qN),{basename:p}=S.useContext(Yr),g,m=!1;if(typeof u=="string"&&JN.test(u)&&(g=u,QN))try{let b=new URL(window.location.href),k=u.startsWith("//")?new URL(b.protocol+u):new URL(u),w=Yp(k.pathname,p);k.origin===b.origin&&w!=null?u=w+k.search+k.hash:m=!0}catch{}let y=jN(u,{relative:s}),x=ZN(u,{replace:i,state:a,target:l,preventScrollReset:d,relative:s,viewTransition:h});function v(b){r&&r(b),b.defaultPrevented||x(b)}return S.createElement("a",sf({},f,{href:g||y,onClick:m||o?r:v,ref:n,target:l}))});var S0;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(S0||(S0={}));var _0;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(_0||(_0={}));function ZN(e,t){let{target:n,replace:r,state:s,preventScrollReset:o,relative:i,viewTransition:a}=t===void 0?{}:t,l=Is(),u=ar(),d=f1(e,{relative:i});return S.useCallback(h=>{if(WN(h,n)){h.preventDefault();let f=r!==void 0?r:Tc(u)===Tc(d);l(e,{replace:f,state:s,preventScrollReset:o,relative:i,viewTransition:a})}},[u,l,d,r,s,n,e,o,i,a])}function x1(e){let t=S.useRef(of(e)),n=S.useRef(!1),r=ar(),s=S.useMemo(()=>GN(r.search,n.current?null:t.current),[r.search]),o=Is(),i=S.useCallback((a,l)=>{const u=of(typeof a=="function"?a(s):a);n.current=!0,o("?"+u,l)},[o,s]);return[s,i]}function eP(e){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}const tP=e=>{switch(e){case"success":return sP;case"info":return iP;case"warning":return oP;case"error":return aP;default:return null}},nP=Array(12).fill(0),rP=({visible:e,className:t})=>z.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},z.createElement("div",{className:"sonner-spinner"},nP.map((n,r)=>z.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),sP=z.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},z.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),oP=z.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},z.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),iP=z.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},z.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),aP=z.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},z.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),lP=z.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},z.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),z.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),cP=()=>{const[e,t]=z.useState(document.hidden);return z.useEffect(()=>{const n=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),e};let af=1;class uP{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{const n=this.subscribers.indexOf(t);this.subscribers.splice(n,1)}),this.publish=t=>{this.subscribers.forEach(n=>n(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var n;const{message:r,...s}=t,o=typeof(t==null?void 0:t.id)=="number"||((n=t.id)==null?void 0:n.length)>0?t.id:af++,i=this.toasts.find(l=>l.id===o),a=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(o)&&this.dismissedToasts.delete(o),i?this.toasts=this.toasts.map(l=>l.id===o?(this.publish({...l,...t,id:o,title:r}),{...l,...t,id:o,dismissible:a,title:r}):l):this.addToast({title:r,...s,dismissible:a,id:o}),o},this.dismiss=t=>(t?(this.dismissedToasts.add(t),requestAnimationFrame(()=>this.subscribers.forEach(n=>n({id:t,dismiss:!0})))):this.toasts.forEach(n=>{this.subscribers.forEach(r=>r({id:n.id,dismiss:!0}))}),t),this.message=(t,n)=>this.create({...n,message:t}),this.error=(t,n)=>this.create({...n,message:t,type:"error"}),this.success=(t,n)=>this.create({...n,type:"success",message:t}),this.info=(t,n)=>this.create({...n,type:"info",message:t}),this.warning=(t,n)=>this.create({...n,type:"warning",message:t}),this.loading=(t,n)=>this.create({...n,type:"loading",message:t}),this.promise=(t,n)=>{if(!n)return;let r;n.loading!==void 0&&(r=this.create({...n,promise:t,type:"loading",message:n.loading,description:typeof n.description!="function"?n.description:void 0}));const s=Promise.resolve(t instanceof Function?t():t);let o=r!==void 0,i;const a=s.then(async u=>{if(i=["resolve",u],z.isValidElement(u))o=!1,this.create({id:r,type:"default",message:u});else if(hP(u)&&!u.ok){o=!1;const h=typeof n.error=="function"?await n.error(`HTTP error! status: ${u.status}`):n.error,f=typeof n.description=="function"?await n.description(`HTTP error! status: ${u.status}`):n.description,g=typeof h=="object"&&!z.isValidElement(h)?h:{message:h};this.create({id:r,type:"error",description:f,...g})}else if(u instanceof Error){o=!1;const h=typeof n.error=="function"?await n.error(u):n.error,f=typeof n.description=="function"?await n.description(u):n.description,g=typeof h=="object"&&!z.isValidElement(h)?h:{message:h};this.create({id:r,type:"error",description:f,...g})}else if(n.success!==void 0){o=!1;const h=typeof n.success=="function"?await n.success(u):n.success,f=typeof n.description=="function"?await n.description(u):n.description,g=typeof h=="object"&&!z.isValidElement(h)?h:{message:h};this.create({id:r,type:"success",description:f,...g})}}).catch(async u=>{if(i=["reject",u],n.error!==void 0){o=!1;const d=typeof n.error=="function"?await n.error(u):n.error,h=typeof n.description=="function"?await n.description(u):n.description,p=typeof d=="object"&&!z.isValidElement(d)?d:{message:d};this.create({id:r,type:"error",description:h,...p})}}).finally(()=>{o&&(this.dismiss(r),r=void 0),n.finally==null||n.finally.call(n)}),l=()=>new Promise((u,d)=>a.then(()=>i[0]==="reject"?d(i[1]):u(i[1])).catch(d));return typeof r!="string"&&typeof r!="number"?{unwrap:l}:Object.assign(r,{unwrap:l})},this.custom=(t,n)=>{const r=(n==null?void 0:n.id)||af++;return this.create({jsx:t(r),id:r,...n}),r},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const Rt=new uP,dP=(e,t)=>{const n=(t==null?void 0:t.id)||af++;return Rt.addToast({title:e,...t,id:n}),n},hP=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",fP=dP,pP=()=>Rt.toasts,gP=()=>Rt.getActiveToasts(),_n=Object.assign(fP,{success:Rt.success,info:Rt.info,warning:Rt.warning,error:Rt.error,custom:Rt.custom,message:Rt.message,promise:Rt.promise,dismiss:Rt.dismiss,loading:Rt.loading},{getHistory:pP,getToasts:gP});eP("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function ul(e){return e.label!==void 0}const mP=3,yP="24px",xP="16px",j0=4e3,bP=356,vP=14,wP=45,kP=200;function Nn(...e){return e.filter(Boolean).join(" ")}function SP(e){const[t,n]=e.split("-"),r=[];return t&&r.push(t),n&&r.push(n),r}const _P=e=>{var t,n,r,s,o,i,a,l,u;const{invert:d,toast:h,unstyled:f,interacting:p,setHeights:g,visibleToasts:m,heights:y,index:x,toasts:v,expanded:b,removeToast:k,defaultRichColors:w,closeButton:j,style:N,cancelButtonStyle:_,actionButtonStyle:P,className:A="",descriptionClassName:O="",duration:F,position:D,gap:U,expandByDefault:W,classNames:M,icons:H,closeButtonAriaLabel:C="Close toast"}=e,[L,E]=z.useState(null),[I,Y]=z.useState(null),[T,$]=z.useState(!1),[q,ne]=z.useState(!1),[ce,fe]=z.useState(!1),[nt,lt]=z.useState(!1),[Ye,Jt]=z.useState(!1),[c_,Wu]=z.useState(0),[u_,Jg]=z.useState(0),Jo=z.useRef(h.duration||F||j0),Zg=z.useRef(null),In=z.useRef(null),d_=x===0,h_=x+1<=m,Vt=h.type,Hs=h.dismissible!==!1,f_=h.className||"",p_=h.descriptionClassName||"",Ua=z.useMemo(()=>y.findIndex(oe=>oe.toastId===h.id)||0,[y,h.id]),g_=z.useMemo(()=>{var oe;return(oe=h.closeButton)!=null?oe:j},[h.closeButton,j]),em=z.useMemo(()=>h.duration||F||j0,[h.duration,F]),Gu=z.useRef(0),Us=z.useRef(0),tm=z.useRef(0),Ws=z.useRef(null),[m_,y_]=D.split("-"),nm=z.useMemo(()=>y.reduce((oe,Xe,ct)=>ct>=Ua?oe:oe+Xe.height,0),[y,Ua]),rm=cP(),x_=h.invert||d,qu=Vt==="loading";Us.current=z.useMemo(()=>Ua*U+nm,[Ua,nm]),z.useEffect(()=>{Jo.current=em},[em]),z.useEffect(()=>{$(!0)},[]),z.useEffect(()=>{const oe=In.current;if(oe){const Xe=oe.getBoundingClientRect().height;return Jg(Xe),g(ct=>[{toastId:h.id,height:Xe,position:h.position},...ct]),()=>g(ct=>ct.filter(Bt=>Bt.toastId!==h.id))}},[g,h.id]),z.useLayoutEffect(()=>{if(!T)return;const oe=In.current,Xe=oe.style.height;oe.style.height="auto";const ct=oe.getBoundingClientRect().height;oe.style.height=Xe,Jg(ct),g(Bt=>Bt.find(rt=>rt.toastId===h.id)?Bt.map(rt=>rt.toastId===h.id?{...rt,height:ct}:rt):[{toastId:h.id,height:ct,position:h.position},...Bt])},[T,h.title,h.description,g,h.id,h.jsx,h.action,h.cancel]);const cr=z.useCallback(()=>{ne(!0),Wu(Us.current),g(oe=>oe.filter(Xe=>Xe.toastId!==h.id)),setTimeout(()=>{k(h)},kP)},[h,k,g,Us]);z.useEffect(()=>{if(h.promise&&Vt==="loading"||h.duration===1/0||h.type==="loading")return;let oe;return b||p||rm?(()=>{if(tm.current{Jo.current!==1/0&&(Gu.current=new Date().getTime(),oe=setTimeout(()=>{h.onAutoClose==null||h.onAutoClose.call(h,h),cr()},Jo.current))})(),()=>clearTimeout(oe)},[b,p,h,Vt,rm,cr]),z.useEffect(()=>{h.delete&&(cr(),h.onDismiss==null||h.onDismiss.call(h,h))},[cr,h.delete]);function b_(){var oe;if(H!=null&&H.loading){var Xe;return z.createElement("div",{className:Nn(M==null?void 0:M.loader,h==null||(Xe=h.classNames)==null?void 0:Xe.loader,"sonner-loader"),"data-visible":Vt==="loading"},H.loading)}return z.createElement(rP,{className:Nn(M==null?void 0:M.loader,h==null||(oe=h.classNames)==null?void 0:oe.loader),visible:Vt==="loading"})}const v_=h.icon||(H==null?void 0:H[Vt])||tP(Vt);var sm,om;return z.createElement("li",{tabIndex:0,ref:In,className:Nn(A,f_,M==null?void 0:M.toast,h==null||(t=h.classNames)==null?void 0:t.toast,M==null?void 0:M.default,M==null?void 0:M[Vt],h==null||(n=h.classNames)==null?void 0:n[Vt]),"data-sonner-toast":"","data-rich-colors":(sm=h.richColors)!=null?sm:w,"data-styled":!(h.jsx||h.unstyled||f),"data-mounted":T,"data-promise":!!h.promise,"data-swiped":Ye,"data-removed":q,"data-visible":h_,"data-y-position":m_,"data-x-position":y_,"data-index":x,"data-front":d_,"data-swiping":ce,"data-dismissible":Hs,"data-type":Vt,"data-invert":x_,"data-swipe-out":nt,"data-swipe-direction":I,"data-expanded":!!(b||W&&T),"data-testid":h.testId,style:{"--index":x,"--toasts-before":x,"--z-index":v.length-x,"--offset":`${q?c_:Us.current}px`,"--initial-height":W?"auto":`${u_}px`,...N,...h.style},onDragEnd:()=>{fe(!1),E(null),Ws.current=null},onPointerDown:oe=>{oe.button!==2&&(qu||!Hs||(Zg.current=new Date,Wu(Us.current),oe.target.setPointerCapture(oe.pointerId),oe.target.tagName!=="BUTTON"&&(fe(!0),Ws.current={x:oe.clientX,y:oe.clientY})))},onPointerUp:()=>{var oe,Xe,ct;if(nt||!Hs)return;Ws.current=null;const Bt=Number(((oe=In.current)==null?void 0:oe.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Wa=Number(((Xe=In.current)==null?void 0:Xe.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),rt=new Date().getTime()-((ct=Zg.current)==null?void 0:ct.getTime()),Zt=L==="x"?Bt:Wa,Ga=Math.abs(Zt)/rt;if(Math.abs(Zt)>=wP||Ga>.11){Wu(Us.current),h.onDismiss==null||h.onDismiss.call(h,h),Y(L==="x"?Bt>0?"right":"left":Wa>0?"down":"up"),cr(),lt(!0);return}else{var fn,pn;(fn=In.current)==null||fn.style.setProperty("--swipe-amount-x","0px"),(pn=In.current)==null||pn.style.setProperty("--swipe-amount-y","0px")}Jt(!1),fe(!1),E(null)},onPointerMove:oe=>{var Xe,ct,Bt;if(!Ws.current||!Hs||((Xe=window.getSelection())==null?void 0:Xe.toString().length)>0)return;const rt=oe.clientY-Ws.current.y,Zt=oe.clientX-Ws.current.x;var Ga;const fn=(Ga=e.swipeDirections)!=null?Ga:SP(D);!L&&(Math.abs(Zt)>1||Math.abs(rt)>1)&&E(Math.abs(Zt)>Math.abs(rt)?"x":"y");let pn={x:0,y:0};const im=es=>1/(1.5+Math.abs(es)/20);if(L==="y"){if(fn.includes("top")||fn.includes("bottom"))if(fn.includes("top")&&rt<0||fn.includes("bottom")&&rt>0)pn.y=rt;else{const es=rt*im(rt);pn.y=Math.abs(es)0)pn.x=Zt;else{const es=Zt*im(Zt);pn.x=Math.abs(es)0||Math.abs(pn.y)>0)&&Jt(!0),(ct=In.current)==null||ct.style.setProperty("--swipe-amount-x",`${pn.x}px`),(Bt=In.current)==null||Bt.style.setProperty("--swipe-amount-y",`${pn.y}px`)}},g_&&!h.jsx&&Vt!=="loading"?z.createElement("button",{"aria-label":C,"data-disabled":qu,"data-close-button":!0,onClick:qu||!Hs?()=>{}:()=>{cr(),h.onDismiss==null||h.onDismiss.call(h,h)},className:Nn(M==null?void 0:M.closeButton,h==null||(r=h.classNames)==null?void 0:r.closeButton)},(om=H==null?void 0:H.close)!=null?om:lP):null,(Vt||h.icon||h.promise)&&h.icon!==null&&((H==null?void 0:H[Vt])!==null||h.icon)?z.createElement("div",{"data-icon":"",className:Nn(M==null?void 0:M.icon,h==null||(s=h.classNames)==null?void 0:s.icon)},h.promise||h.type==="loading"&&!h.icon?h.icon||b_():null,h.type!=="loading"?v_:null):null,z.createElement("div",{"data-content":"",className:Nn(M==null?void 0:M.content,h==null||(o=h.classNames)==null?void 0:o.content)},z.createElement("div",{"data-title":"",className:Nn(M==null?void 0:M.title,h==null||(i=h.classNames)==null?void 0:i.title)},h.jsx?h.jsx:typeof h.title=="function"?h.title():h.title),h.description?z.createElement("div",{"data-description":"",className:Nn(O,p_,M==null?void 0:M.description,h==null||(a=h.classNames)==null?void 0:a.description)},typeof h.description=="function"?h.description():h.description):null),z.isValidElement(h.cancel)?h.cancel:h.cancel&&ul(h.cancel)?z.createElement("button",{"data-button":!0,"data-cancel":!0,style:h.cancelButtonStyle||_,onClick:oe=>{ul(h.cancel)&&Hs&&(h.cancel.onClick==null||h.cancel.onClick.call(h.cancel,oe),cr())},className:Nn(M==null?void 0:M.cancelButton,h==null||(l=h.classNames)==null?void 0:l.cancelButton)},h.cancel.label):null,z.isValidElement(h.action)?h.action:h.action&&ul(h.action)?z.createElement("button",{"data-button":!0,"data-action":!0,style:h.actionButtonStyle||P,onClick:oe=>{ul(h.action)&&(h.action.onClick==null||h.action.onClick.call(h.action,oe),!oe.defaultPrevented&&cr())},className:Nn(M==null?void 0:M.actionButton,h==null||(u=h.classNames)==null?void 0:u.actionButton)},h.action.label):null)};function C0(){if(typeof window>"u"||typeof document>"u")return"ltr";const e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function jP(e,t){const n={};return[e,t].forEach((r,s)=>{const o=s===1,i=o?"--mobile-offset":"--offset",a=o?xP:yP;function l(u){["top","right","bottom","left"].forEach(d=>{n[`${i}-${d}`]=typeof u=="number"?`${u}px`:u})}typeof r=="number"||typeof r=="string"?l(r):typeof r=="object"?["top","right","bottom","left"].forEach(u=>{r[u]===void 0?n[`${i}-${u}`]=a:n[`${i}-${u}`]=typeof r[u]=="number"?`${r[u]}px`:r[u]}):l(a)}),n}const CP=z.forwardRef(function(t,n){const{id:r,invert:s,position:o="bottom-right",hotkey:i=["altKey","KeyT"],expand:a,closeButton:l,className:u,offset:d,mobileOffset:h,theme:f="light",richColors:p,duration:g,style:m,visibleToasts:y=mP,toastOptions:x,dir:v=C0(),gap:b=vP,icons:k,containerAriaLabel:w="Notifications"}=t,[j,N]=z.useState([]),_=z.useMemo(()=>r?j.filter(T=>T.toasterId===r):j.filter(T=>!T.toasterId),[j,r]),P=z.useMemo(()=>Array.from(new Set([o].concat(_.filter(T=>T.position).map(T=>T.position)))),[_,o]),[A,O]=z.useState([]),[F,D]=z.useState(!1),[U,W]=z.useState(!1),[M,H]=z.useState(f!=="system"?f:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),C=z.useRef(null),L=i.join("+").replace(/Key/g,"").replace(/Digit/g,""),E=z.useRef(null),I=z.useRef(!1),Y=z.useCallback(T=>{N($=>{var q;return(q=$.find(ne=>ne.id===T.id))!=null&&q.delete||Rt.dismiss(T.id),$.filter(({id:ne})=>ne!==T.id)})},[]);return z.useEffect(()=>Rt.subscribe(T=>{if(T.dismiss){requestAnimationFrame(()=>{N($=>$.map(q=>q.id===T.id?{...q,delete:!0}:q))});return}setTimeout(()=>{XC.flushSync(()=>{N($=>{const q=$.findIndex(ne=>ne.id===T.id);return q!==-1?[...$.slice(0,q),{...$[q],...T},...$.slice(q+1)]:[T,...$]})})})}),[j]),z.useEffect(()=>{if(f!=="system"){H(f);return}if(f==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?H("dark"):H("light")),typeof window>"u")return;const T=window.matchMedia("(prefers-color-scheme: dark)");try{T.addEventListener("change",({matches:$})=>{H($?"dark":"light")})}catch{T.addListener(({matches:q})=>{try{H(q?"dark":"light")}catch(ne){console.error(ne)}})}},[f]),z.useEffect(()=>{j.length<=1&&D(!1)},[j]),z.useEffect(()=>{const T=$=>{var q;if(i.every(fe=>$[fe]||$.code===fe)){var ce;D(!0),(ce=C.current)==null||ce.focus()}$.code==="Escape"&&(document.activeElement===C.current||(q=C.current)!=null&&q.contains(document.activeElement))&&D(!1)};return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[i]),z.useEffect(()=>{if(C.current)return()=>{E.current&&(E.current.focus({preventScroll:!0}),E.current=null,I.current=!1)}},[C.current]),z.createElement("section",{ref:n,"aria-label":`${w} ${L}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},P.map((T,$)=>{var q;const[ne,ce]=T.split("-");return _.length?z.createElement("ol",{key:T,dir:v==="auto"?C0():v,tabIndex:-1,ref:C,className:u,"data-sonner-toaster":!0,"data-sonner-theme":M,"data-y-position":ne,"data-x-position":ce,style:{"--front-toast-height":`${((q=A[0])==null?void 0:q.height)||0}px`,"--width":`${bP}px`,"--gap":`${b}px`,...m,...jP(d,h)},onBlur:fe=>{I.current&&!fe.currentTarget.contains(fe.relatedTarget)&&(I.current=!1,E.current&&(E.current.focus({preventScroll:!0}),E.current=null))},onFocus:fe=>{fe.target instanceof HTMLElement&&fe.target.dataset.dismissible==="false"||I.current||(I.current=!0,E.current=fe.relatedTarget)},onMouseEnter:()=>D(!0),onMouseMove:()=>D(!0),onMouseLeave:()=>{U||D(!1)},onDragEnd:()=>D(!1),onPointerDown:fe=>{fe.target instanceof HTMLElement&&fe.target.dataset.dismissible==="false"||W(!0)},onPointerUp:()=>W(!1)},_.filter(fe=>!fe.position&&$===0||fe.position===T).map((fe,nt)=>{var lt,Ye;return z.createElement(_P,{key:fe.id,icons:k,index:nt,toast:fe,defaultRichColors:p,duration:(lt=x==null?void 0:x.duration)!=null?lt:g,className:x==null?void 0:x.className,descriptionClassName:x==null?void 0:x.descriptionClassName,invert:s,visibleToasts:y,closeButton:(Ye=x==null?void 0:x.closeButton)!=null?Ye:l,interacting:U,position:T,style:x==null?void 0:x.style,unstyled:x==null?void 0:x.unstyled,classNames:x==null?void 0:x.classNames,cancelButtonStyle:x==null?void 0:x.cancelButtonStyle,actionButtonStyle:x==null?void 0:x.actionButtonStyle,closeButtonAriaLabel:x==null?void 0:x.closeButtonAriaLabel,removeToast:Y,toasts:_.filter(Jt=>Jt.position==fe.position),heights:A.filter(Jt=>Jt.position==fe.position),setHeights:O,expandByDefault:a,gap:b,expanded:F,swipeDirections:t.swipeDirections})})):null}))});function b1(e,t){return function(){return e.apply(t,arguments)}}const{toString:NP}=Object.prototype,{getPrototypeOf:Zp}=Object,{iterator:pu,toStringTag:v1}=Symbol,gu=(e=>t=>{const n=NP.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),jn=e=>(e=e.toLowerCase(),t=>gu(t)===e),mu=e=>t=>typeof t===e,{isArray:Go}=Array,Eo=mu("undefined");function Ta(e){return e!==null&&!Eo(e)&&e.constructor!==null&&!Eo(e.constructor)&&Dt(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const w1=jn("ArrayBuffer");function PP(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&w1(e.buffer),t}const RP=mu("string"),Dt=mu("function"),k1=mu("number"),Aa=e=>e!==null&&typeof e=="object",EP=e=>e===!0||e===!1,Yl=e=>{if(gu(e)!=="object")return!1;const t=Zp(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(v1 in e)&&!(pu in e)},TP=e=>{if(!Aa(e)||Ta(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},AP=jn("Date"),MP=jn("File"),LP=e=>!!(e&&typeof e.uri<"u"),OP=e=>e&&typeof e.getParts<"u",DP=jn("Blob"),IP=jn("FileList"),FP=e=>Aa(e)&&Dt(e.pipe);function zP(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const N0=zP(),P0=typeof N0.FormData<"u"?N0.FormData:void 0,VP=e=>{let t;return e&&(P0&&e instanceof P0||Dt(e.append)&&((t=gu(e))==="formdata"||t==="object"&&Dt(e.toString)&&e.toString()==="[object FormData]"))},BP=jn("URLSearchParams"),[$P,HP,UP,WP]=["ReadableStream","Request","Response","Headers"].map(jn),GP=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Ma(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,s;if(typeof e!="object"&&(e=[e]),Go(e))for(r=0,s=e.length;r0;)if(s=n[r],t===s.toLowerCase())return s;return null}const ys=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,_1=e=>!Eo(e)&&e!==ys;function lf(){const{caseless:e,skipUndefined:t}=_1(this)&&this||{},n={},r=(s,o)=>{if(o==="__proto__"||o==="constructor"||o==="prototype")return;const i=e&&S1(n,o)||o;Yl(n[i])&&Yl(s)?n[i]=lf(n[i],s):Yl(s)?n[i]=lf({},s):Go(s)?n[i]=s.slice():(!t||!Eo(s))&&(n[i]=s)};for(let s=0,o=arguments.length;s(Ma(t,(s,o)=>{n&&Dt(s)?Object.defineProperty(e,o,{value:b1(s,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,o,{value:s,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),e),KP=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),YP=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),Object.defineProperty(e.prototype,"constructor",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},XP=(e,t,n,r)=>{let s,o,i;const a={};if(t=t||{},e==null)return t;do{for(s=Object.getOwnPropertyNames(e),o=s.length;o-- >0;)i=s[o],(!r||r(i,e,t))&&!a[i]&&(t[i]=e[i],a[i]=!0);e=n!==!1&&Zp(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},QP=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return r!==-1&&r===n},JP=e=>{if(!e)return null;if(Go(e))return e;let t=e.length;if(!k1(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},ZP=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Zp(Uint8Array)),e5=(e,t)=>{const r=(e&&e[pu]).call(e);let s;for(;(s=r.next())&&!s.done;){const o=s.value;t.call(e,o[0],o[1])}},t5=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},n5=jn("HTMLFormElement"),r5=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),R0=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),s5=jn("RegExp"),j1=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};Ma(n,(s,o)=>{let i;(i=t(s,o,e))!==!1&&(r[o]=i||s)}),Object.defineProperties(e,r)},o5=e=>{j1(e,(t,n)=>{if(Dt(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=e[n];if(Dt(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},i5=(e,t)=>{const n={},r=s=>{s.forEach(o=>{n[o]=!0})};return Go(e)?r(e):r(String(e).split(t)),n},a5=()=>{},l5=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function c5(e){return!!(e&&Dt(e.append)&&e[v1]==="FormData"&&e[pu])}const u5=e=>{const t=new Array(10),n=(r,s)=>{if(Aa(r)){if(t.indexOf(r)>=0)return;if(Ta(r))return r;if(!("toJSON"in r)){t[s]=r;const o=Go(r)?[]:{};return Ma(r,(i,a)=>{const l=n(i,s+1);!Eo(l)&&(o[a]=l)}),t[s]=void 0,o}}return r};return n(e,0)},d5=jn("AsyncFunction"),h5=e=>e&&(Aa(e)||Dt(e))&&Dt(e.then)&&Dt(e.catch),C1=((e,t)=>e?setImmediate:t?((n,r)=>(ys.addEventListener("message",({source:s,data:o})=>{s===ys&&o===n&&r.length&&r.shift()()},!1),s=>{r.push(s),ys.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",Dt(ys.postMessage)),f5=typeof queueMicrotask<"u"?queueMicrotask.bind(ys):typeof process<"u"&&process.nextTick||C1,p5=e=>e!=null&&Dt(e[pu]),R={isArray:Go,isArrayBuffer:w1,isBuffer:Ta,isFormData:VP,isArrayBufferView:PP,isString:RP,isNumber:k1,isBoolean:EP,isObject:Aa,isPlainObject:Yl,isEmptyObject:TP,isReadableStream:$P,isRequest:HP,isResponse:UP,isHeaders:WP,isUndefined:Eo,isDate:AP,isFile:MP,isReactNativeBlob:LP,isReactNative:OP,isBlob:DP,isRegExp:s5,isFunction:Dt,isStream:FP,isURLSearchParams:BP,isTypedArray:ZP,isFileList:IP,forEach:Ma,merge:lf,extend:qP,trim:GP,stripBOM:KP,inherits:YP,toFlatObject:XP,kindOf:gu,kindOfTest:jn,endsWith:QP,toArray:JP,forEachEntry:e5,matchAll:t5,isHTMLForm:n5,hasOwnProperty:R0,hasOwnProp:R0,reduceDescriptors:j1,freezeMethods:o5,toObjectSet:i5,toCamelCase:r5,noop:a5,toFiniteNumber:l5,findKey:S1,global:ys,isContextDefined:_1,isSpecCompliantForm:c5,toJSONObject:u5,isAsyncFn:d5,isThenable:h5,setImmediate:C1,asap:f5,isIterable:p5};let se=class N1 extends Error{static from(t,n,r,s,o,i){const a=new N1(t.message,n||t.code,r,s,o);return a.cause=t,a.name=t.name,t.status!=null&&a.status==null&&(a.status=t.status),i&&Object.assign(a,i),a}constructor(t,n,r,s,o){super(t),Object.defineProperty(this,"message",{value:t,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,n&&(this.code=n),r&&(this.config=r),s&&(this.request=s),o&&(this.response=o,this.status=o.status)}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:R.toJSONObject(this.config),code:this.code,status:this.status}}};se.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";se.ERR_BAD_OPTION="ERR_BAD_OPTION";se.ECONNABORTED="ECONNABORTED";se.ETIMEDOUT="ETIMEDOUT";se.ERR_NETWORK="ERR_NETWORK";se.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";se.ERR_DEPRECATED="ERR_DEPRECATED";se.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";se.ERR_BAD_REQUEST="ERR_BAD_REQUEST";se.ERR_CANCELED="ERR_CANCELED";se.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";se.ERR_INVALID_URL="ERR_INVALID_URL";const g5=null;function cf(e){return R.isPlainObject(e)||R.isArray(e)}function P1(e){return R.endsWith(e,"[]")?e.slice(0,-2):e}function wd(e,t,n){return e?e.concat(t).map(function(s,o){return s=P1(s),!n&&o?"["+s+"]":s}).join(n?".":""):t}function m5(e){return R.isArray(e)&&!e.some(cf)}const y5=R.toFlatObject(R,{},null,function(t){return/^is[A-Z]/.test(t)});function yu(e,t,n){if(!R.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=R.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(m,y){return!R.isUndefined(y[m])});const r=n.metaTokens,s=n.visitor||d,o=n.dots,i=n.indexes,l=(n.Blob||typeof Blob<"u"&&Blob)&&R.isSpecCompliantForm(t);if(!R.isFunction(s))throw new TypeError("visitor must be a function");function u(g){if(g===null)return"";if(R.isDate(g))return g.toISOString();if(R.isBoolean(g))return g.toString();if(!l&&R.isBlob(g))throw new se("Blob is not supported. Use a Buffer instead.");return R.isArrayBuffer(g)||R.isTypedArray(g)?l&&typeof Blob=="function"?new Blob([g]):Buffer.from(g):g}function d(g,m,y){let x=g;if(R.isReactNative(t)&&R.isReactNativeBlob(g))return t.append(wd(y,m,o),u(g)),!1;if(g&&!y&&typeof g=="object"){if(R.endsWith(m,"{}"))m=r?m:m.slice(0,-2),g=JSON.stringify(g);else if(R.isArray(g)&&m5(g)||(R.isFileList(g)||R.endsWith(m,"[]"))&&(x=R.toArray(g)))return m=P1(m),x.forEach(function(b,k){!(R.isUndefined(b)||b===null)&&t.append(i===!0?wd([m],k,o):i===null?m:m+"[]",u(b))}),!1}return cf(g)?!0:(t.append(wd(y,m,o),u(g)),!1)}const h=[],f=Object.assign(y5,{defaultVisitor:d,convertValue:u,isVisitable:cf});function p(g,m){if(!R.isUndefined(g)){if(h.indexOf(g)!==-1)throw Error("Circular reference detected in "+m.join("."));h.push(g),R.forEach(g,function(x,v){(!(R.isUndefined(x)||x===null)&&s.call(t,x,R.isString(v)?v.trim():v,m,f))===!0&&p(x,m?m.concat(v):[v])}),h.pop()}}if(!R.isObject(e))throw new TypeError("data must be an object");return p(e),t}function E0(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(r){return t[r]})}function eg(e,t){this._pairs=[],e&&yu(e,this,t)}const R1=eg.prototype;R1.append=function(t,n){this._pairs.push([t,n])};R1.toString=function(t){const n=t?function(r){return t.call(this,r,E0)}:E0;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function x5(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function E1(e,t,n){if(!t)return e;const r=n&&n.encode||x5,s=R.isFunction(n)?{serialize:n}:n,o=s&&s.serialize;let i;if(o?i=o(t,s):i=R.isURLSearchParams(t)?t.toString():new eg(t,s).toString(r),i){const a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}class T0{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){R.forEach(this.handlers,function(r){r!==null&&t(r)})}}const tg={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},b5=typeof URLSearchParams<"u"?URLSearchParams:eg,v5=typeof FormData<"u"?FormData:null,w5=typeof Blob<"u"?Blob:null,k5={isBrowser:!0,classes:{URLSearchParams:b5,FormData:v5,Blob:w5},protocols:["http","https","file","blob","url","data"]},ng=typeof window<"u"&&typeof document<"u",uf=typeof navigator=="object"&&navigator||void 0,S5=ng&&(!uf||["ReactNative","NativeScript","NS"].indexOf(uf.product)<0),_5=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",j5=ng&&window.location.href||"http://localhost",C5=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:ng,hasStandardBrowserEnv:S5,hasStandardBrowserWebWorkerEnv:_5,navigator:uf,origin:j5},Symbol.toStringTag,{value:"Module"})),mt={...C5,...k5};function N5(e,t){return yu(e,new mt.classes.URLSearchParams,{visitor:function(n,r,s,o){return mt.isNode&&R.isBuffer(n)?(this.append(r,n.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...t})}function P5(e){return R.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function R5(e){const t={},n=Object.keys(e);let r;const s=n.length;let o;for(r=0;r=n.length;return i=!i&&R.isArray(s)?s.length:i,l?(R.hasOwnProp(s,i)?s[i]=[s[i],r]:s[i]=r,!a):((!s[i]||!R.isObject(s[i]))&&(s[i]=[]),t(n,r,s[i],o)&&R.isArray(s[i])&&(s[i]=R5(s[i])),!a)}if(R.isFormData(e)&&R.isFunction(e.entries)){const n={};return R.forEachEntry(e,(r,s)=>{t(P5(r),s,n,0)}),n}return null}function E5(e,t,n){if(R.isString(e))try{return(t||JSON.parse)(e),R.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const La={transitional:tg,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,o=R.isObject(t);if(o&&R.isHTMLForm(t)&&(t=new FormData(t)),R.isFormData(t))return s?JSON.stringify(T1(t)):t;if(R.isArrayBuffer(t)||R.isBuffer(t)||R.isStream(t)||R.isFile(t)||R.isBlob(t)||R.isReadableStream(t))return t;if(R.isArrayBufferView(t))return t.buffer;if(R.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let a;if(o){if(r.indexOf("application/x-www-form-urlencoded")>-1)return N5(t,this.formSerializer).toString();if((a=R.isFileList(t))||r.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return yu(a?{"files[]":t}:t,l&&new l,this.formSerializer)}}return o||s?(n.setContentType("application/json",!1),E5(t)):t}],transformResponse:[function(t){const n=this.transitional||La.transitional,r=n&&n.forcedJSONParsing,s=this.responseType==="json";if(R.isResponse(t)||R.isReadableStream(t))return t;if(t&&R.isString(t)&&(r&&!this.responseType||s)){const i=!(n&&n.silentJSONParsing)&&s;try{return JSON.parse(t,this.parseReviver)}catch(a){if(i)throw a.name==="SyntaxError"?se.from(a,se.ERR_BAD_RESPONSE,this,null,this.response):a}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:mt.classes.FormData,Blob:mt.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};R.forEach(["delete","get","head","post","put","patch"],e=>{La.headers[e]={}});const T5=R.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),A5=e=>{const t={};let n,r,s;return e&&e.split(` -`).forEach(function(i){s=i.indexOf(":"),n=i.substring(0,s).trim().toLowerCase(),r=i.substring(s+1).trim(),!(!n||t[n]&&T5[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t},A0=Symbol("internals");function ai(e){return e&&String(e).trim().toLowerCase()}function Xl(e){return e===!1||e==null?e:R.isArray(e)?e.map(Xl):String(e).replace(/[\r\n]+$/,"")}function M5(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}const L5=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function kd(e,t,n,r,s){if(R.isFunction(r))return r.call(this,t,n);if(s&&(t=n),!!R.isString(t)){if(R.isString(r))return t.indexOf(r)!==-1;if(R.isRegExp(r))return r.test(t)}}function O5(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function D5(e,t){const n=R.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(s,o,i){return this[r].call(this,t,s,o,i)},configurable:!0})})}let It=class{constructor(t){t&&this.set(t)}set(t,n,r){const s=this;function o(a,l,u){const d=ai(l);if(!d)throw new Error("header name must be a non-empty string");const h=R.findKey(s,d);(!h||s[h]===void 0||u===!0||u===void 0&&s[h]!==!1)&&(s[h||l]=Xl(a))}const i=(a,l)=>R.forEach(a,(u,d)=>o(u,d,l));if(R.isPlainObject(t)||t instanceof this.constructor)i(t,n);else if(R.isString(t)&&(t=t.trim())&&!L5(t))i(A5(t),n);else if(R.isObject(t)&&R.isIterable(t)){let a={},l,u;for(const d of t){if(!R.isArray(d))throw TypeError("Object iterator must return a key-value pair");a[u=d[0]]=(l=a[u])?R.isArray(l)?[...l,d[1]]:[l,d[1]]:d[1]}i(a,n)}else t!=null&&o(n,t,r);return this}get(t,n){if(t=ai(t),t){const r=R.findKey(this,t);if(r){const s=this[r];if(!n)return s;if(n===!0)return M5(s);if(R.isFunction(n))return n.call(this,s,r);if(R.isRegExp(n))return n.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=ai(t),t){const r=R.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||kd(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let s=!1;function o(i){if(i=ai(i),i){const a=R.findKey(r,i);a&&(!n||kd(r,r[a],a,n))&&(delete r[a],s=!0)}}return R.isArray(t)?t.forEach(o):o(t),s}clear(t){const n=Object.keys(this);let r=n.length,s=!1;for(;r--;){const o=n[r];(!t||kd(this,this[o],o,t,!0))&&(delete this[o],s=!0)}return s}normalize(t){const n=this,r={};return R.forEach(this,(s,o)=>{const i=R.findKey(r,o);if(i){n[i]=Xl(s),delete n[o];return}const a=t?O5(o):String(o).trim();a!==o&&delete n[o],n[a]=Xl(s),r[a]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return R.forEach(this,(r,s)=>{r!=null&&r!==!1&&(n[s]=t&&R.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(` -`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(s=>r.set(s)),r}static accessor(t){const r=(this[A0]=this[A0]={accessors:{}}).accessors,s=this.prototype;function o(i){const a=ai(i);r[a]||(D5(s,i),r[a]=!0)}return R.isArray(t)?t.forEach(o):o(t),this}};It.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);R.reduceDescriptors(It.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});R.freezeMethods(It);function Sd(e,t){const n=this||La,r=t||n,s=It.from(r.headers);let o=r.data;return R.forEach(e,function(a){o=a.call(n,o,s.normalize(),t?t.status:void 0)}),s.normalize(),o}function A1(e){return!!(e&&e.__CANCEL__)}let Oa=class extends se{constructor(t,n,r){super(t??"canceled",se.ERR_CANCELED,n,r),this.name="CanceledError",this.__CANCEL__=!0}};function M1(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new se("Request failed with status code "+n.status,[se.ERR_BAD_REQUEST,se.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function I5(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function F5(e,t){e=e||10;const n=new Array(e),r=new Array(e);let s=0,o=0,i;return t=t!==void 0?t:1e3,function(l){const u=Date.now(),d=r[o];i||(i=u),n[s]=l,r[s]=u;let h=o,f=0;for(;h!==s;)f+=n[h++],h=h%e;if(s=(s+1)%e,s===o&&(o=(o+1)%e),u-i{n=d,s=null,o&&(clearTimeout(o),o=null),e(...u)};return[(...u)=>{const d=Date.now(),h=d-n;h>=r?i(u,d):(s=u,o||(o=setTimeout(()=>{o=null,i(s)},r-h)))},()=>s&&i(s)]}const Ac=(e,t,n=3)=>{let r=0;const s=F5(50,250);return z5(o=>{const i=o.loaded,a=o.lengthComputable?o.total:void 0,l=i-r,u=s(l),d=i<=a;r=i;const h={loaded:i,total:a,progress:a?i/a:void 0,bytes:l,rate:u||void 0,estimated:u&&a&&d?(a-i)/u:void 0,event:o,lengthComputable:a!=null,[t?"download":"upload"]:!0};e(h)},n)},M0=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},L0=e=>(...t)=>R.asap(()=>e(...t)),V5=mt.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,mt.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(mt.origin),mt.navigator&&/(msie|trident)/i.test(mt.navigator.userAgent)):()=>!0,B5=mt.hasStandardBrowserEnv?{write(e,t,n,r,s,o,i){if(typeof document>"u")return;const a=[`${e}=${encodeURIComponent(t)}`];R.isNumber(n)&&a.push(`expires=${new Date(n).toUTCString()}`),R.isString(r)&&a.push(`path=${r}`),R.isString(s)&&a.push(`domain=${s}`),o===!0&&a.push("secure"),R.isString(i)&&a.push(`SameSite=${i}`),document.cookie=a.join("; ")},read(e){if(typeof document>"u")return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function $5(e){return typeof e!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function H5(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function L1(e,t,n){let r=!$5(t);return e&&(r||n==!1)?H5(e,t):t}const O0=e=>e instanceof It?{...e}:e;function As(e,t){t=t||{};const n={};function r(u,d,h,f){return R.isPlainObject(u)&&R.isPlainObject(d)?R.merge.call({caseless:f},u,d):R.isPlainObject(d)?R.merge({},d):R.isArray(d)?d.slice():d}function s(u,d,h,f){if(R.isUndefined(d)){if(!R.isUndefined(u))return r(void 0,u,h,f)}else return r(u,d,h,f)}function o(u,d){if(!R.isUndefined(d))return r(void 0,d)}function i(u,d){if(R.isUndefined(d)){if(!R.isUndefined(u))return r(void 0,u)}else return r(void 0,d)}function a(u,d,h){if(h in t)return r(u,d);if(h in e)return r(void 0,u)}const l={url:o,method:o,data:o,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:a,headers:(u,d,h)=>s(O0(u),O0(d),h,!0)};return R.forEach(Object.keys({...e,...t}),function(d){if(d==="__proto__"||d==="constructor"||d==="prototype")return;const h=R.hasOwnProp(l,d)?l[d]:s,f=h(e[d],t[d],d);R.isUndefined(f)&&h!==a||(n[d]=f)}),n}const O1=e=>{const t=As({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:o,headers:i,auth:a}=t;if(t.headers=i=It.from(i),t.url=E1(L1(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&i.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),R.isFormData(n)){if(mt.hasStandardBrowserEnv||mt.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(R.isFunction(n.getHeaders)){const l=n.getHeaders(),u=["content-type","content-length"];Object.entries(l).forEach(([d,h])=>{u.includes(d.toLowerCase())&&i.set(d,h)})}}if(mt.hasStandardBrowserEnv&&(r&&R.isFunction(r)&&(r=r(t)),r||r!==!1&&V5(t.url))){const l=s&&o&&B5.read(o);l&&i.set(s,l)}return t},U5=typeof XMLHttpRequest<"u",W5=U5&&function(e){return new Promise(function(n,r){const s=O1(e);let o=s.data;const i=It.from(s.headers).normalize();let{responseType:a,onUploadProgress:l,onDownloadProgress:u}=s,d,h,f,p,g;function m(){p&&p(),g&&g(),s.cancelToken&&s.cancelToken.unsubscribe(d),s.signal&&s.signal.removeEventListener("abort",d)}let y=new XMLHttpRequest;y.open(s.method.toUpperCase(),s.url,!0),y.timeout=s.timeout;function x(){if(!y)return;const b=It.from("getAllResponseHeaders"in y&&y.getAllResponseHeaders()),w={data:!a||a==="text"||a==="json"?y.responseText:y.response,status:y.status,statusText:y.statusText,headers:b,config:e,request:y};M1(function(N){n(N),m()},function(N){r(N),m()},w),y=null}"onloadend"in y?y.onloadend=x:y.onreadystatechange=function(){!y||y.readyState!==4||y.status===0&&!(y.responseURL&&y.responseURL.indexOf("file:")===0)||setTimeout(x)},y.onabort=function(){y&&(r(new se("Request aborted",se.ECONNABORTED,e,y)),y=null)},y.onerror=function(k){const w=k&&k.message?k.message:"Network Error",j=new se(w,se.ERR_NETWORK,e,y);j.event=k||null,r(j),y=null},y.ontimeout=function(){let k=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const w=s.transitional||tg;s.timeoutErrorMessage&&(k=s.timeoutErrorMessage),r(new se(k,w.clarifyTimeoutError?se.ETIMEDOUT:se.ECONNABORTED,e,y)),y=null},o===void 0&&i.setContentType(null),"setRequestHeader"in y&&R.forEach(i.toJSON(),function(k,w){y.setRequestHeader(w,k)}),R.isUndefined(s.withCredentials)||(y.withCredentials=!!s.withCredentials),a&&a!=="json"&&(y.responseType=s.responseType),u&&([f,g]=Ac(u,!0),y.addEventListener("progress",f)),l&&y.upload&&([h,p]=Ac(l),y.upload.addEventListener("progress",h),y.upload.addEventListener("loadend",p)),(s.cancelToken||s.signal)&&(d=b=>{y&&(r(!b||b.type?new Oa(null,e,y):b),y.abort(),y=null)},s.cancelToken&&s.cancelToken.subscribe(d),s.signal&&(s.signal.aborted?d():s.signal.addEventListener("abort",d)));const v=I5(s.url);if(v&&mt.protocols.indexOf(v)===-1){r(new se("Unsupported protocol "+v+":",se.ERR_BAD_REQUEST,e));return}y.send(o||null)})},G5=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let r=new AbortController,s;const o=function(u){if(!s){s=!0,a();const d=u instanceof Error?u:this.reason;r.abort(d instanceof se?d:new Oa(d instanceof Error?d.message:d))}};let i=t&&setTimeout(()=>{i=null,o(new se(`timeout of ${t}ms exceeded`,se.ETIMEDOUT))},t);const a=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(u=>{u.unsubscribe?u.unsubscribe(o):u.removeEventListener("abort",o)}),e=null)};e.forEach(u=>u.addEventListener("abort",o));const{signal:l}=r;return l.unsubscribe=()=>R.asap(a),l}},q5=function*(e,t){let n=e.byteLength;if(n{const s=K5(e,t);let o=0,i,a=l=>{i||(i=!0,r&&r(l))};return new ReadableStream({async pull(l){try{const{done:u,value:d}=await s.next();if(u){a(),l.close();return}let h=d.byteLength;if(n){let f=o+=h;n(f)}l.enqueue(new Uint8Array(d))}catch(u){throw a(u),u}},cancel(l){return a(l),s.return()}},{highWaterMark:2})},I0=64*1024,{isFunction:dl}=R,X5=(({Request:e,Response:t})=>({Request:e,Response:t}))(R.global),{ReadableStream:F0,TextEncoder:z0}=R.global,V0=(e,...t)=>{try{return!!e(...t)}catch{return!1}},Q5=e=>{e=R.merge.call({skipUndefined:!0},X5,e);const{fetch:t,Request:n,Response:r}=e,s=t?dl(t):typeof fetch=="function",o=dl(n),i=dl(r);if(!s)return!1;const a=s&&dl(F0),l=s&&(typeof z0=="function"?(g=>m=>g.encode(m))(new z0):async g=>new Uint8Array(await new n(g).arrayBuffer())),u=o&&a&&V0(()=>{let g=!1;const m=new F0,y=new n(mt.origin,{body:m,method:"POST",get duplex(){return g=!0,"half"}}).headers.has("Content-Type");return m.cancel(),g&&!y}),d=i&&a&&V0(()=>R.isReadableStream(new r("").body)),h={stream:d&&(g=>g.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(g=>{!h[g]&&(h[g]=(m,y)=>{let x=m&&m[g];if(x)return x.call(m);throw new se(`Response type '${g}' is not supported`,se.ERR_NOT_SUPPORT,y)})});const f=async g=>{if(g==null)return 0;if(R.isBlob(g))return g.size;if(R.isSpecCompliantForm(g))return(await new n(mt.origin,{method:"POST",body:g}).arrayBuffer()).byteLength;if(R.isArrayBufferView(g)||R.isArrayBuffer(g))return g.byteLength;if(R.isURLSearchParams(g)&&(g=g+""),R.isString(g))return(await l(g)).byteLength},p=async(g,m)=>{const y=R.toFiniteNumber(g.getContentLength());return y??f(m)};return async g=>{let{url:m,method:y,data:x,signal:v,cancelToken:b,timeout:k,onDownloadProgress:w,onUploadProgress:j,responseType:N,headers:_,withCredentials:P="same-origin",fetchOptions:A}=O1(g),O=t||fetch;N=N?(N+"").toLowerCase():"text";let F=G5([v,b&&b.toAbortSignal()],k),D=null;const U=F&&F.unsubscribe&&(()=>{F.unsubscribe()});let W;try{if(j&&u&&y!=="get"&&y!=="head"&&(W=await p(_,x))!==0){let I=new n(m,{method:"POST",body:x,duplex:"half"}),Y;if(R.isFormData(x)&&(Y=I.headers.get("content-type"))&&_.setContentType(Y),I.body){const[T,$]=M0(W,Ac(L0(j)));x=D0(I.body,I0,T,$)}}R.isString(P)||(P=P?"include":"omit");const M=o&&"credentials"in n.prototype,H={...A,signal:F,method:y.toUpperCase(),headers:_.normalize().toJSON(),body:x,duplex:"half",credentials:M?P:void 0};D=o&&new n(m,H);let C=await(o?O(D,A):O(m,H));const L=d&&(N==="stream"||N==="response");if(d&&(w||L&&U)){const I={};["status","statusText","headers"].forEach(q=>{I[q]=C[q]});const Y=R.toFiniteNumber(C.headers.get("content-length")),[T,$]=w&&M0(Y,Ac(L0(w),!0))||[];C=new r(D0(C.body,I0,T,()=>{$&&$(),U&&U()}),I)}N=N||"text";let E=await h[R.findKey(h,N)||"text"](C,g);return!L&&U&&U(),await new Promise((I,Y)=>{M1(I,Y,{data:E,headers:It.from(C.headers),status:C.status,statusText:C.statusText,config:g,request:D})})}catch(M){throw U&&U(),M&&M.name==="TypeError"&&/Load failed|fetch/i.test(M.message)?Object.assign(new se("Network Error",se.ERR_NETWORK,g,D,M&&M.response),{cause:M.cause||M}):se.from(M,M&&M.code,g,D,M&&M.response)}}},J5=new Map,D1=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:s}=t,o=[r,s,n];let i=o.length,a=i,l,u,d=J5;for(;a--;)l=o[a],u=d.get(l),u===void 0&&d.set(l,u=a?new Map:Q5(t)),d=u;return u};D1();const rg={http:g5,xhr:W5,fetch:{get:D1}};R.forEach(rg,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const B0=e=>`- ${e}`,Z5=e=>R.isFunction(e)||e===null||e===!1;function eR(e,t){e=R.isArray(e)?e:[e];const{length:n}=e;let r,s;const o={};for(let i=0;i`adapter ${l} `+(u===!1?"is not supported by the environment":"is not available in the build"));let a=n?i.length>1?`since : + */function sf(){return sf=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&(n[s]=e[s]);return n}function UN(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function WN(e,t){return e.button===0&&(!t||t==="_self")&&!UN(e)}function of(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(s=>[n,s]):[[n,r]])},[]))}function GN(e,t){let n=of(e);return t&&t.forEach((r,s)=>{n.has(s)||t.getAll(s).forEach(o=>{n.append(s,o)})}),n}const KN=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],qN="6";try{window.__reactRouterVersion=qN}catch{}const YN="startTransition",k0=z_[YN];function XN(e){let{basename:t,children:n,future:r,window:s}=e,o=S.useRef();o.current==null&&(o.current=QC({window:s,v5Compat:!0}));let i=o.current,[a,l]=S.useState({action:i.action,location:i.location}),{v7_startTransition:u}=r||{},d=S.useCallback(h=>{u&&k0?k0(()=>l(h)):l(h)},[l,u]);return S.useLayoutEffect(()=>i.listen(d),[i,d]),S.useEffect(()=>VN(r),[r]),S.createElement(BN,{basename:t,children:n,location:a.location,navigationType:a.action,navigator:i,future:r})}const QN=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",JN=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Ee=S.forwardRef(function(t,n){let{onClick:r,relative:s,reloadDocument:o,replace:i,state:a,target:l,to:u,preventScrollReset:d,viewTransition:h}=t,f=HN(t,KN),{basename:p}=S.useContext(Yr),g,m=!1;if(typeof u=="string"&&JN.test(u)&&(g=u,QN))try{let b=new URL(window.location.href),k=u.startsWith("//")?new URL(b.protocol+u):new URL(u),w=Yp(k.pathname,p);k.origin===b.origin&&w!=null?u=w+k.search+k.hash:m=!0}catch{}let y=jN(u,{relative:s}),x=ZN(u,{replace:i,state:a,target:l,preventScrollReset:d,relative:s,viewTransition:h});function v(b){r&&r(b),b.defaultPrevented||x(b)}return S.createElement("a",sf({},f,{href:g||y,onClick:m||o?r:v,ref:n,target:l}))});var S0;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(S0||(S0={}));var _0;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(_0||(_0={}));function ZN(e,t){let{target:n,replace:r,state:s,preventScrollReset:o,relative:i,viewTransition:a}=t===void 0?{}:t,l=Is(),u=ar(),d=f1(e,{relative:i});return S.useCallback(h=>{if(WN(h,n)){h.preventDefault();let f=r!==void 0?r:Tc(u)===Tc(d);l(e,{replace:f,state:s,preventScrollReset:o,relative:i,viewTransition:a})}},[u,l,d,r,s,n,e,o,i,a])}function x1(e){let t=S.useRef(of(e)),n=S.useRef(!1),r=ar(),s=S.useMemo(()=>GN(r.search,n.current?null:t.current),[r.search]),o=Is(),i=S.useCallback((a,l)=>{const u=of(typeof a=="function"?a(s):a);n.current=!0,o("?"+u,l)},[o,s]);return[s,i]}function eP(e){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}const tP=e=>{switch(e){case"success":return sP;case"info":return iP;case"warning":return oP;case"error":return aP;default:return null}},nP=Array(12).fill(0),rP=({visible:e,className:t})=>z.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},z.createElement("div",{className:"sonner-spinner"},nP.map((n,r)=>z.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),sP=z.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},z.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),oP=z.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},z.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),iP=z.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},z.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),aP=z.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},z.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),lP=z.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},z.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),z.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),cP=()=>{const[e,t]=z.useState(document.hidden);return z.useEffect(()=>{const n=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),e};let af=1;class uP{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{const n=this.subscribers.indexOf(t);this.subscribers.splice(n,1)}),this.publish=t=>{this.subscribers.forEach(n=>n(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var n;const{message:r,...s}=t,o=typeof(t==null?void 0:t.id)=="number"||((n=t.id)==null?void 0:n.length)>0?t.id:af++,i=this.toasts.find(l=>l.id===o),a=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(o)&&this.dismissedToasts.delete(o),i?this.toasts=this.toasts.map(l=>l.id===o?(this.publish({...l,...t,id:o,title:r}),{...l,...t,id:o,dismissible:a,title:r}):l):this.addToast({title:r,...s,dismissible:a,id:o}),o},this.dismiss=t=>(t?(this.dismissedToasts.add(t),requestAnimationFrame(()=>this.subscribers.forEach(n=>n({id:t,dismiss:!0})))):this.toasts.forEach(n=>{this.subscribers.forEach(r=>r({id:n.id,dismiss:!0}))}),t),this.message=(t,n)=>this.create({...n,message:t}),this.error=(t,n)=>this.create({...n,message:t,type:"error"}),this.success=(t,n)=>this.create({...n,type:"success",message:t}),this.info=(t,n)=>this.create({...n,type:"info",message:t}),this.warning=(t,n)=>this.create({...n,type:"warning",message:t}),this.loading=(t,n)=>this.create({...n,type:"loading",message:t}),this.promise=(t,n)=>{if(!n)return;let r;n.loading!==void 0&&(r=this.create({...n,promise:t,type:"loading",message:n.loading,description:typeof n.description!="function"?n.description:void 0}));const s=Promise.resolve(t instanceof Function?t():t);let o=r!==void 0,i;const a=s.then(async u=>{if(i=["resolve",u],z.isValidElement(u))o=!1,this.create({id:r,type:"default",message:u});else if(hP(u)&&!u.ok){o=!1;const h=typeof n.error=="function"?await n.error(`HTTP error! status: ${u.status}`):n.error,f=typeof n.description=="function"?await n.description(`HTTP error! status: ${u.status}`):n.description,g=typeof h=="object"&&!z.isValidElement(h)?h:{message:h};this.create({id:r,type:"error",description:f,...g})}else if(u instanceof Error){o=!1;const h=typeof n.error=="function"?await n.error(u):n.error,f=typeof n.description=="function"?await n.description(u):n.description,g=typeof h=="object"&&!z.isValidElement(h)?h:{message:h};this.create({id:r,type:"error",description:f,...g})}else if(n.success!==void 0){o=!1;const h=typeof n.success=="function"?await n.success(u):n.success,f=typeof n.description=="function"?await n.description(u):n.description,g=typeof h=="object"&&!z.isValidElement(h)?h:{message:h};this.create({id:r,type:"success",description:f,...g})}}).catch(async u=>{if(i=["reject",u],n.error!==void 0){o=!1;const d=typeof n.error=="function"?await n.error(u):n.error,h=typeof n.description=="function"?await n.description(u):n.description,p=typeof d=="object"&&!z.isValidElement(d)?d:{message:d};this.create({id:r,type:"error",description:h,...p})}}).finally(()=>{o&&(this.dismiss(r),r=void 0),n.finally==null||n.finally.call(n)}),l=()=>new Promise((u,d)=>a.then(()=>i[0]==="reject"?d(i[1]):u(i[1])).catch(d));return typeof r!="string"&&typeof r!="number"?{unwrap:l}:Object.assign(r,{unwrap:l})},this.custom=(t,n)=>{const r=(n==null?void 0:n.id)||af++;return this.create({jsx:t(r),id:r,...n}),r},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const Rt=new uP,dP=(e,t)=>{const n=(t==null?void 0:t.id)||af++;return Rt.addToast({title:e,...t,id:n}),n},hP=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",fP=dP,pP=()=>Rt.toasts,gP=()=>Rt.getActiveToasts(),_n=Object.assign(fP,{success:Rt.success,info:Rt.info,warning:Rt.warning,error:Rt.error,custom:Rt.custom,message:Rt.message,promise:Rt.promise,dismiss:Rt.dismiss,loading:Rt.loading},{getHistory:pP,getToasts:gP});eP("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function ul(e){return e.label!==void 0}const mP=3,yP="24px",xP="16px",j0=4e3,bP=356,vP=14,wP=45,kP=200;function Nn(...e){return e.filter(Boolean).join(" ")}function SP(e){const[t,n]=e.split("-"),r=[];return t&&r.push(t),n&&r.push(n),r}const _P=e=>{var t,n,r,s,o,i,a,l,u;const{invert:d,toast:h,unstyled:f,interacting:p,setHeights:g,visibleToasts:m,heights:y,index:x,toasts:v,expanded:b,removeToast:k,defaultRichColors:w,closeButton:j,style:N,cancelButtonStyle:_,actionButtonStyle:P,className:A="",descriptionClassName:O="",duration:F,position:D,gap:W,expandByDefault:G,classNames:M,icons:U,closeButtonAriaLabel:C="Close toast"}=e,[L,E]=z.useState(null),[I,Y]=z.useState(null),[T,$]=z.useState(!1),[K,ne]=z.useState(!1),[ce,fe]=z.useState(!1),[nt,lt]=z.useState(!1),[Ye,Jt]=z.useState(!1),[c_,Wu]=z.useState(0),[u_,Jg]=z.useState(0),Zo=z.useRef(h.duration||F||j0),Zg=z.useRef(null),In=z.useRef(null),d_=x===0,h_=x+1<=m,Vt=h.type,Hs=h.dismissible!==!1,f_=h.className||"",p_=h.descriptionClassName||"",Ua=z.useMemo(()=>y.findIndex(oe=>oe.toastId===h.id)||0,[y,h.id]),g_=z.useMemo(()=>{var oe;return(oe=h.closeButton)!=null?oe:j},[h.closeButton,j]),em=z.useMemo(()=>h.duration||F||j0,[h.duration,F]),Gu=z.useRef(0),Us=z.useRef(0),tm=z.useRef(0),Ws=z.useRef(null),[m_,y_]=D.split("-"),nm=z.useMemo(()=>y.reduce((oe,Xe,ct)=>ct>=Ua?oe:oe+Xe.height,0),[y,Ua]),rm=cP(),x_=h.invert||d,Ku=Vt==="loading";Us.current=z.useMemo(()=>Ua*W+nm,[Ua,nm]),z.useEffect(()=>{Zo.current=em},[em]),z.useEffect(()=>{$(!0)},[]),z.useEffect(()=>{const oe=In.current;if(oe){const Xe=oe.getBoundingClientRect().height;return Jg(Xe),g(ct=>[{toastId:h.id,height:Xe,position:h.position},...ct]),()=>g(ct=>ct.filter(Bt=>Bt.toastId!==h.id))}},[g,h.id]),z.useLayoutEffect(()=>{if(!T)return;const oe=In.current,Xe=oe.style.height;oe.style.height="auto";const ct=oe.getBoundingClientRect().height;oe.style.height=Xe,Jg(ct),g(Bt=>Bt.find(rt=>rt.toastId===h.id)?Bt.map(rt=>rt.toastId===h.id?{...rt,height:ct}:rt):[{toastId:h.id,height:ct,position:h.position},...Bt])},[T,h.title,h.description,g,h.id,h.jsx,h.action,h.cancel]);const cr=z.useCallback(()=>{ne(!0),Wu(Us.current),g(oe=>oe.filter(Xe=>Xe.toastId!==h.id)),setTimeout(()=>{k(h)},kP)},[h,k,g,Us]);z.useEffect(()=>{if(h.promise&&Vt==="loading"||h.duration===1/0||h.type==="loading")return;let oe;return b||p||rm?(()=>{if(tm.current{Zo.current!==1/0&&(Gu.current=new Date().getTime(),oe=setTimeout(()=>{h.onAutoClose==null||h.onAutoClose.call(h,h),cr()},Zo.current))})(),()=>clearTimeout(oe)},[b,p,h,Vt,rm,cr]),z.useEffect(()=>{h.delete&&(cr(),h.onDismiss==null||h.onDismiss.call(h,h))},[cr,h.delete]);function b_(){var oe;if(U!=null&&U.loading){var Xe;return z.createElement("div",{className:Nn(M==null?void 0:M.loader,h==null||(Xe=h.classNames)==null?void 0:Xe.loader,"sonner-loader"),"data-visible":Vt==="loading"},U.loading)}return z.createElement(rP,{className:Nn(M==null?void 0:M.loader,h==null||(oe=h.classNames)==null?void 0:oe.loader),visible:Vt==="loading"})}const v_=h.icon||(U==null?void 0:U[Vt])||tP(Vt);var sm,om;return z.createElement("li",{tabIndex:0,ref:In,className:Nn(A,f_,M==null?void 0:M.toast,h==null||(t=h.classNames)==null?void 0:t.toast,M==null?void 0:M.default,M==null?void 0:M[Vt],h==null||(n=h.classNames)==null?void 0:n[Vt]),"data-sonner-toast":"","data-rich-colors":(sm=h.richColors)!=null?sm:w,"data-styled":!(h.jsx||h.unstyled||f),"data-mounted":T,"data-promise":!!h.promise,"data-swiped":Ye,"data-removed":K,"data-visible":h_,"data-y-position":m_,"data-x-position":y_,"data-index":x,"data-front":d_,"data-swiping":ce,"data-dismissible":Hs,"data-type":Vt,"data-invert":x_,"data-swipe-out":nt,"data-swipe-direction":I,"data-expanded":!!(b||G&&T),"data-testid":h.testId,style:{"--index":x,"--toasts-before":x,"--z-index":v.length-x,"--offset":`${K?c_:Us.current}px`,"--initial-height":G?"auto":`${u_}px`,...N,...h.style},onDragEnd:()=>{fe(!1),E(null),Ws.current=null},onPointerDown:oe=>{oe.button!==2&&(Ku||!Hs||(Zg.current=new Date,Wu(Us.current),oe.target.setPointerCapture(oe.pointerId),oe.target.tagName!=="BUTTON"&&(fe(!0),Ws.current={x:oe.clientX,y:oe.clientY})))},onPointerUp:()=>{var oe,Xe,ct;if(nt||!Hs)return;Ws.current=null;const Bt=Number(((oe=In.current)==null?void 0:oe.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Wa=Number(((Xe=In.current)==null?void 0:Xe.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),rt=new Date().getTime()-((ct=Zg.current)==null?void 0:ct.getTime()),Zt=L==="x"?Bt:Wa,Ga=Math.abs(Zt)/rt;if(Math.abs(Zt)>=wP||Ga>.11){Wu(Us.current),h.onDismiss==null||h.onDismiss.call(h,h),Y(L==="x"?Bt>0?"right":"left":Wa>0?"down":"up"),cr(),lt(!0);return}else{var fn,pn;(fn=In.current)==null||fn.style.setProperty("--swipe-amount-x","0px"),(pn=In.current)==null||pn.style.setProperty("--swipe-amount-y","0px")}Jt(!1),fe(!1),E(null)},onPointerMove:oe=>{var Xe,ct,Bt;if(!Ws.current||!Hs||((Xe=window.getSelection())==null?void 0:Xe.toString().length)>0)return;const rt=oe.clientY-Ws.current.y,Zt=oe.clientX-Ws.current.x;var Ga;const fn=(Ga=e.swipeDirections)!=null?Ga:SP(D);!L&&(Math.abs(Zt)>1||Math.abs(rt)>1)&&E(Math.abs(Zt)>Math.abs(rt)?"x":"y");let pn={x:0,y:0};const im=es=>1/(1.5+Math.abs(es)/20);if(L==="y"){if(fn.includes("top")||fn.includes("bottom"))if(fn.includes("top")&&rt<0||fn.includes("bottom")&&rt>0)pn.y=rt;else{const es=rt*im(rt);pn.y=Math.abs(es)0)pn.x=Zt;else{const es=Zt*im(Zt);pn.x=Math.abs(es)0||Math.abs(pn.y)>0)&&Jt(!0),(ct=In.current)==null||ct.style.setProperty("--swipe-amount-x",`${pn.x}px`),(Bt=In.current)==null||Bt.style.setProperty("--swipe-amount-y",`${pn.y}px`)}},g_&&!h.jsx&&Vt!=="loading"?z.createElement("button",{"aria-label":C,"data-disabled":Ku,"data-close-button":!0,onClick:Ku||!Hs?()=>{}:()=>{cr(),h.onDismiss==null||h.onDismiss.call(h,h)},className:Nn(M==null?void 0:M.closeButton,h==null||(r=h.classNames)==null?void 0:r.closeButton)},(om=U==null?void 0:U.close)!=null?om:lP):null,(Vt||h.icon||h.promise)&&h.icon!==null&&((U==null?void 0:U[Vt])!==null||h.icon)?z.createElement("div",{"data-icon":"",className:Nn(M==null?void 0:M.icon,h==null||(s=h.classNames)==null?void 0:s.icon)},h.promise||h.type==="loading"&&!h.icon?h.icon||b_():null,h.type!=="loading"?v_:null):null,z.createElement("div",{"data-content":"",className:Nn(M==null?void 0:M.content,h==null||(o=h.classNames)==null?void 0:o.content)},z.createElement("div",{"data-title":"",className:Nn(M==null?void 0:M.title,h==null||(i=h.classNames)==null?void 0:i.title)},h.jsx?h.jsx:typeof h.title=="function"?h.title():h.title),h.description?z.createElement("div",{"data-description":"",className:Nn(O,p_,M==null?void 0:M.description,h==null||(a=h.classNames)==null?void 0:a.description)},typeof h.description=="function"?h.description():h.description):null),z.isValidElement(h.cancel)?h.cancel:h.cancel&&ul(h.cancel)?z.createElement("button",{"data-button":!0,"data-cancel":!0,style:h.cancelButtonStyle||_,onClick:oe=>{ul(h.cancel)&&Hs&&(h.cancel.onClick==null||h.cancel.onClick.call(h.cancel,oe),cr())},className:Nn(M==null?void 0:M.cancelButton,h==null||(l=h.classNames)==null?void 0:l.cancelButton)},h.cancel.label):null,z.isValidElement(h.action)?h.action:h.action&&ul(h.action)?z.createElement("button",{"data-button":!0,"data-action":!0,style:h.actionButtonStyle||P,onClick:oe=>{ul(h.action)&&(h.action.onClick==null||h.action.onClick.call(h.action,oe),!oe.defaultPrevented&&cr())},className:Nn(M==null?void 0:M.actionButton,h==null||(u=h.classNames)==null?void 0:u.actionButton)},h.action.label):null)};function C0(){if(typeof window>"u"||typeof document>"u")return"ltr";const e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function jP(e,t){const n={};return[e,t].forEach((r,s)=>{const o=s===1,i=o?"--mobile-offset":"--offset",a=o?xP:yP;function l(u){["top","right","bottom","left"].forEach(d=>{n[`${i}-${d}`]=typeof u=="number"?`${u}px`:u})}typeof r=="number"||typeof r=="string"?l(r):typeof r=="object"?["top","right","bottom","left"].forEach(u=>{r[u]===void 0?n[`${i}-${u}`]=a:n[`${i}-${u}`]=typeof r[u]=="number"?`${r[u]}px`:r[u]}):l(a)}),n}const CP=z.forwardRef(function(t,n){const{id:r,invert:s,position:o="bottom-right",hotkey:i=["altKey","KeyT"],expand:a,closeButton:l,className:u,offset:d,mobileOffset:h,theme:f="light",richColors:p,duration:g,style:m,visibleToasts:y=mP,toastOptions:x,dir:v=C0(),gap:b=vP,icons:k,containerAriaLabel:w="Notifications"}=t,[j,N]=z.useState([]),_=z.useMemo(()=>r?j.filter(T=>T.toasterId===r):j.filter(T=>!T.toasterId),[j,r]),P=z.useMemo(()=>Array.from(new Set([o].concat(_.filter(T=>T.position).map(T=>T.position)))),[_,o]),[A,O]=z.useState([]),[F,D]=z.useState(!1),[W,G]=z.useState(!1),[M,U]=z.useState(f!=="system"?f:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),C=z.useRef(null),L=i.join("+").replace(/Key/g,"").replace(/Digit/g,""),E=z.useRef(null),I=z.useRef(!1),Y=z.useCallback(T=>{N($=>{var K;return(K=$.find(ne=>ne.id===T.id))!=null&&K.delete||Rt.dismiss(T.id),$.filter(({id:ne})=>ne!==T.id)})},[]);return z.useEffect(()=>Rt.subscribe(T=>{if(T.dismiss){requestAnimationFrame(()=>{N($=>$.map(K=>K.id===T.id?{...K,delete:!0}:K))});return}setTimeout(()=>{XC.flushSync(()=>{N($=>{const K=$.findIndex(ne=>ne.id===T.id);return K!==-1?[...$.slice(0,K),{...$[K],...T},...$.slice(K+1)]:[T,...$]})})})}),[j]),z.useEffect(()=>{if(f!=="system"){U(f);return}if(f==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?U("dark"):U("light")),typeof window>"u")return;const T=window.matchMedia("(prefers-color-scheme: dark)");try{T.addEventListener("change",({matches:$})=>{U($?"dark":"light")})}catch{T.addListener(({matches:K})=>{try{U(K?"dark":"light")}catch(ne){console.error(ne)}})}},[f]),z.useEffect(()=>{j.length<=1&&D(!1)},[j]),z.useEffect(()=>{const T=$=>{var K;if(i.every(fe=>$[fe]||$.code===fe)){var ce;D(!0),(ce=C.current)==null||ce.focus()}$.code==="Escape"&&(document.activeElement===C.current||(K=C.current)!=null&&K.contains(document.activeElement))&&D(!1)};return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[i]),z.useEffect(()=>{if(C.current)return()=>{E.current&&(E.current.focus({preventScroll:!0}),E.current=null,I.current=!1)}},[C.current]),z.createElement("section",{ref:n,"aria-label":`${w} ${L}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},P.map((T,$)=>{var K;const[ne,ce]=T.split("-");return _.length?z.createElement("ol",{key:T,dir:v==="auto"?C0():v,tabIndex:-1,ref:C,className:u,"data-sonner-toaster":!0,"data-sonner-theme":M,"data-y-position":ne,"data-x-position":ce,style:{"--front-toast-height":`${((K=A[0])==null?void 0:K.height)||0}px`,"--width":`${bP}px`,"--gap":`${b}px`,...m,...jP(d,h)},onBlur:fe=>{I.current&&!fe.currentTarget.contains(fe.relatedTarget)&&(I.current=!1,E.current&&(E.current.focus({preventScroll:!0}),E.current=null))},onFocus:fe=>{fe.target instanceof HTMLElement&&fe.target.dataset.dismissible==="false"||I.current||(I.current=!0,E.current=fe.relatedTarget)},onMouseEnter:()=>D(!0),onMouseMove:()=>D(!0),onMouseLeave:()=>{W||D(!1)},onDragEnd:()=>D(!1),onPointerDown:fe=>{fe.target instanceof HTMLElement&&fe.target.dataset.dismissible==="false"||G(!0)},onPointerUp:()=>G(!1)},_.filter(fe=>!fe.position&&$===0||fe.position===T).map((fe,nt)=>{var lt,Ye;return z.createElement(_P,{key:fe.id,icons:k,index:nt,toast:fe,defaultRichColors:p,duration:(lt=x==null?void 0:x.duration)!=null?lt:g,className:x==null?void 0:x.className,descriptionClassName:x==null?void 0:x.descriptionClassName,invert:s,visibleToasts:y,closeButton:(Ye=x==null?void 0:x.closeButton)!=null?Ye:l,interacting:W,position:T,style:x==null?void 0:x.style,unstyled:x==null?void 0:x.unstyled,classNames:x==null?void 0:x.classNames,cancelButtonStyle:x==null?void 0:x.cancelButtonStyle,actionButtonStyle:x==null?void 0:x.actionButtonStyle,closeButtonAriaLabel:x==null?void 0:x.closeButtonAriaLabel,removeToast:Y,toasts:_.filter(Jt=>Jt.position==fe.position),heights:A.filter(Jt=>Jt.position==fe.position),setHeights:O,expandByDefault:a,gap:b,expanded:F,swipeDirections:t.swipeDirections})})):null}))});function b1(e,t){return function(){return e.apply(t,arguments)}}const{toString:NP}=Object.prototype,{getPrototypeOf:Zp}=Object,{iterator:pu,toStringTag:v1}=Symbol,gu=(e=>t=>{const n=NP.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),jn=e=>(e=e.toLowerCase(),t=>gu(t)===e),mu=e=>t=>typeof t===e,{isArray:Ko}=Array,To=mu("undefined");function Ta(e){return e!==null&&!To(e)&&e.constructor!==null&&!To(e.constructor)&&Dt(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const w1=jn("ArrayBuffer");function PP(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&w1(e.buffer),t}const RP=mu("string"),Dt=mu("function"),k1=mu("number"),Aa=e=>e!==null&&typeof e=="object",EP=e=>e===!0||e===!1,Yl=e=>{if(gu(e)!=="object")return!1;const t=Zp(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(v1 in e)&&!(pu in e)},TP=e=>{if(!Aa(e)||Ta(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},AP=jn("Date"),MP=jn("File"),LP=e=>!!(e&&typeof e.uri<"u"),OP=e=>e&&typeof e.getParts<"u",DP=jn("Blob"),IP=jn("FileList"),FP=e=>Aa(e)&&Dt(e.pipe);function zP(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const N0=zP(),P0=typeof N0.FormData<"u"?N0.FormData:void 0,VP=e=>{let t;return e&&(P0&&e instanceof P0||Dt(e.append)&&((t=gu(e))==="formdata"||t==="object"&&Dt(e.toString)&&e.toString()==="[object FormData]"))},BP=jn("URLSearchParams"),[$P,HP,UP,WP]=["ReadableStream","Request","Response","Headers"].map(jn),GP=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Ma(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,s;if(typeof e!="object"&&(e=[e]),Ko(e))for(r=0,s=e.length;r0;)if(s=n[r],t===s.toLowerCase())return s;return null}const ys=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,_1=e=>!To(e)&&e!==ys;function lf(){const{caseless:e,skipUndefined:t}=_1(this)&&this||{},n={},r=(s,o)=>{if(o==="__proto__"||o==="constructor"||o==="prototype")return;const i=e&&S1(n,o)||o;Yl(n[i])&&Yl(s)?n[i]=lf(n[i],s):Yl(s)?n[i]=lf({},s):Ko(s)?n[i]=s.slice():(!t||!To(s))&&(n[i]=s)};for(let s=0,o=arguments.length;s(Ma(t,(s,o)=>{n&&Dt(s)?Object.defineProperty(e,o,{value:b1(s,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,o,{value:s,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),e),qP=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),YP=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),Object.defineProperty(e.prototype,"constructor",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},XP=(e,t,n,r)=>{let s,o,i;const a={};if(t=t||{},e==null)return t;do{for(s=Object.getOwnPropertyNames(e),o=s.length;o-- >0;)i=s[o],(!r||r(i,e,t))&&!a[i]&&(t[i]=e[i],a[i]=!0);e=n!==!1&&Zp(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},QP=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return r!==-1&&r===n},JP=e=>{if(!e)return null;if(Ko(e))return e;let t=e.length;if(!k1(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},ZP=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Zp(Uint8Array)),e5=(e,t)=>{const r=(e&&e[pu]).call(e);let s;for(;(s=r.next())&&!s.done;){const o=s.value;t.call(e,o[0],o[1])}},t5=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},n5=jn("HTMLFormElement"),r5=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),R0=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),s5=jn("RegExp"),j1=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};Ma(n,(s,o)=>{let i;(i=t(s,o,e))!==!1&&(r[o]=i||s)}),Object.defineProperties(e,r)},o5=e=>{j1(e,(t,n)=>{if(Dt(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=e[n];if(Dt(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},i5=(e,t)=>{const n={},r=s=>{s.forEach(o=>{n[o]=!0})};return Ko(e)?r(e):r(String(e).split(t)),n},a5=()=>{},l5=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function c5(e){return!!(e&&Dt(e.append)&&e[v1]==="FormData"&&e[pu])}const u5=e=>{const t=new Array(10),n=(r,s)=>{if(Aa(r)){if(t.indexOf(r)>=0)return;if(Ta(r))return r;if(!("toJSON"in r)){t[s]=r;const o=Ko(r)?[]:{};return Ma(r,(i,a)=>{const l=n(i,s+1);!To(l)&&(o[a]=l)}),t[s]=void 0,o}}return r};return n(e,0)},d5=jn("AsyncFunction"),h5=e=>e&&(Aa(e)||Dt(e))&&Dt(e.then)&&Dt(e.catch),C1=((e,t)=>e?setImmediate:t?((n,r)=>(ys.addEventListener("message",({source:s,data:o})=>{s===ys&&o===n&&r.length&&r.shift()()},!1),s=>{r.push(s),ys.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",Dt(ys.postMessage)),f5=typeof queueMicrotask<"u"?queueMicrotask.bind(ys):typeof process<"u"&&process.nextTick||C1,p5=e=>e!=null&&Dt(e[pu]),R={isArray:Ko,isArrayBuffer:w1,isBuffer:Ta,isFormData:VP,isArrayBufferView:PP,isString:RP,isNumber:k1,isBoolean:EP,isObject:Aa,isPlainObject:Yl,isEmptyObject:TP,isReadableStream:$P,isRequest:HP,isResponse:UP,isHeaders:WP,isUndefined:To,isDate:AP,isFile:MP,isReactNativeBlob:LP,isReactNative:OP,isBlob:DP,isRegExp:s5,isFunction:Dt,isStream:FP,isURLSearchParams:BP,isTypedArray:ZP,isFileList:IP,forEach:Ma,merge:lf,extend:KP,trim:GP,stripBOM:qP,inherits:YP,toFlatObject:XP,kindOf:gu,kindOfTest:jn,endsWith:QP,toArray:JP,forEachEntry:e5,matchAll:t5,isHTMLForm:n5,hasOwnProperty:R0,hasOwnProp:R0,reduceDescriptors:j1,freezeMethods:o5,toObjectSet:i5,toCamelCase:r5,noop:a5,toFiniteNumber:l5,findKey:S1,global:ys,isContextDefined:_1,isSpecCompliantForm:c5,toJSONObject:u5,isAsyncFn:d5,isThenable:h5,setImmediate:C1,asap:f5,isIterable:p5};let se=class N1 extends Error{static from(t,n,r,s,o,i){const a=new N1(t.message,n||t.code,r,s,o);return a.cause=t,a.name=t.name,t.status!=null&&a.status==null&&(a.status=t.status),i&&Object.assign(a,i),a}constructor(t,n,r,s,o){super(t),Object.defineProperty(this,"message",{value:t,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,n&&(this.code=n),r&&(this.config=r),s&&(this.request=s),o&&(this.response=o,this.status=o.status)}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:R.toJSONObject(this.config),code:this.code,status:this.status}}};se.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";se.ERR_BAD_OPTION="ERR_BAD_OPTION";se.ECONNABORTED="ECONNABORTED";se.ETIMEDOUT="ETIMEDOUT";se.ERR_NETWORK="ERR_NETWORK";se.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";se.ERR_DEPRECATED="ERR_DEPRECATED";se.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";se.ERR_BAD_REQUEST="ERR_BAD_REQUEST";se.ERR_CANCELED="ERR_CANCELED";se.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";se.ERR_INVALID_URL="ERR_INVALID_URL";const g5=null;function cf(e){return R.isPlainObject(e)||R.isArray(e)}function P1(e){return R.endsWith(e,"[]")?e.slice(0,-2):e}function wd(e,t,n){return e?e.concat(t).map(function(s,o){return s=P1(s),!n&&o?"["+s+"]":s}).join(n?".":""):t}function m5(e){return R.isArray(e)&&!e.some(cf)}const y5=R.toFlatObject(R,{},null,function(t){return/^is[A-Z]/.test(t)});function yu(e,t,n){if(!R.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=R.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(m,y){return!R.isUndefined(y[m])});const r=n.metaTokens,s=n.visitor||d,o=n.dots,i=n.indexes,l=(n.Blob||typeof Blob<"u"&&Blob)&&R.isSpecCompliantForm(t);if(!R.isFunction(s))throw new TypeError("visitor must be a function");function u(g){if(g===null)return"";if(R.isDate(g))return g.toISOString();if(R.isBoolean(g))return g.toString();if(!l&&R.isBlob(g))throw new se("Blob is not supported. Use a Buffer instead.");return R.isArrayBuffer(g)||R.isTypedArray(g)?l&&typeof Blob=="function"?new Blob([g]):Buffer.from(g):g}function d(g,m,y){let x=g;if(R.isReactNative(t)&&R.isReactNativeBlob(g))return t.append(wd(y,m,o),u(g)),!1;if(g&&!y&&typeof g=="object"){if(R.endsWith(m,"{}"))m=r?m:m.slice(0,-2),g=JSON.stringify(g);else if(R.isArray(g)&&m5(g)||(R.isFileList(g)||R.endsWith(m,"[]"))&&(x=R.toArray(g)))return m=P1(m),x.forEach(function(b,k){!(R.isUndefined(b)||b===null)&&t.append(i===!0?wd([m],k,o):i===null?m:m+"[]",u(b))}),!1}return cf(g)?!0:(t.append(wd(y,m,o),u(g)),!1)}const h=[],f=Object.assign(y5,{defaultVisitor:d,convertValue:u,isVisitable:cf});function p(g,m){if(!R.isUndefined(g)){if(h.indexOf(g)!==-1)throw Error("Circular reference detected in "+m.join("."));h.push(g),R.forEach(g,function(x,v){(!(R.isUndefined(x)||x===null)&&s.call(t,x,R.isString(v)?v.trim():v,m,f))===!0&&p(x,m?m.concat(v):[v])}),h.pop()}}if(!R.isObject(e))throw new TypeError("data must be an object");return p(e),t}function E0(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(r){return t[r]})}function eg(e,t){this._pairs=[],e&&yu(e,this,t)}const R1=eg.prototype;R1.append=function(t,n){this._pairs.push([t,n])};R1.toString=function(t){const n=t?function(r){return t.call(this,r,E0)}:E0;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function x5(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function E1(e,t,n){if(!t)return e;const r=n&&n.encode||x5,s=R.isFunction(n)?{serialize:n}:n,o=s&&s.serialize;let i;if(o?i=o(t,s):i=R.isURLSearchParams(t)?t.toString():new eg(t,s).toString(r),i){const a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}class T0{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){R.forEach(this.handlers,function(r){r!==null&&t(r)})}}const tg={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},b5=typeof URLSearchParams<"u"?URLSearchParams:eg,v5=typeof FormData<"u"?FormData:null,w5=typeof Blob<"u"?Blob:null,k5={isBrowser:!0,classes:{URLSearchParams:b5,FormData:v5,Blob:w5},protocols:["http","https","file","blob","url","data"]},ng=typeof window<"u"&&typeof document<"u",uf=typeof navigator=="object"&&navigator||void 0,S5=ng&&(!uf||["ReactNative","NativeScript","NS"].indexOf(uf.product)<0),_5=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",j5=ng&&window.location.href||"http://localhost",C5=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:ng,hasStandardBrowserEnv:S5,hasStandardBrowserWebWorkerEnv:_5,navigator:uf,origin:j5},Symbol.toStringTag,{value:"Module"})),mt={...C5,...k5};function N5(e,t){return yu(e,new mt.classes.URLSearchParams,{visitor:function(n,r,s,o){return mt.isNode&&R.isBuffer(n)?(this.append(r,n.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...t})}function P5(e){return R.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function R5(e){const t={},n=Object.keys(e);let r;const s=n.length;let o;for(r=0;r=n.length;return i=!i&&R.isArray(s)?s.length:i,l?(R.hasOwnProp(s,i)?s[i]=[s[i],r]:s[i]=r,!a):((!s[i]||!R.isObject(s[i]))&&(s[i]=[]),t(n,r,s[i],o)&&R.isArray(s[i])&&(s[i]=R5(s[i])),!a)}if(R.isFormData(e)&&R.isFunction(e.entries)){const n={};return R.forEachEntry(e,(r,s)=>{t(P5(r),s,n,0)}),n}return null}function E5(e,t,n){if(R.isString(e))try{return(t||JSON.parse)(e),R.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const La={transitional:tg,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,o=R.isObject(t);if(o&&R.isHTMLForm(t)&&(t=new FormData(t)),R.isFormData(t))return s?JSON.stringify(T1(t)):t;if(R.isArrayBuffer(t)||R.isBuffer(t)||R.isStream(t)||R.isFile(t)||R.isBlob(t)||R.isReadableStream(t))return t;if(R.isArrayBufferView(t))return t.buffer;if(R.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let a;if(o){if(r.indexOf("application/x-www-form-urlencoded")>-1)return N5(t,this.formSerializer).toString();if((a=R.isFileList(t))||r.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return yu(a?{"files[]":t}:t,l&&new l,this.formSerializer)}}return o||s?(n.setContentType("application/json",!1),E5(t)):t}],transformResponse:[function(t){const n=this.transitional||La.transitional,r=n&&n.forcedJSONParsing,s=this.responseType==="json";if(R.isResponse(t)||R.isReadableStream(t))return t;if(t&&R.isString(t)&&(r&&!this.responseType||s)){const i=!(n&&n.silentJSONParsing)&&s;try{return JSON.parse(t,this.parseReviver)}catch(a){if(i)throw a.name==="SyntaxError"?se.from(a,se.ERR_BAD_RESPONSE,this,null,this.response):a}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:mt.classes.FormData,Blob:mt.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};R.forEach(["delete","get","head","post","put","patch"],e=>{La.headers[e]={}});const T5=R.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),A5=e=>{const t={};let n,r,s;return e&&e.split(` +`).forEach(function(i){s=i.indexOf(":"),n=i.substring(0,s).trim().toLowerCase(),r=i.substring(s+1).trim(),!(!n||t[n]&&T5[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t},A0=Symbol("internals");function li(e){return e&&String(e).trim().toLowerCase()}function Xl(e){return e===!1||e==null?e:R.isArray(e)?e.map(Xl):String(e).replace(/[\r\n]+$/,"")}function M5(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}const L5=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function kd(e,t,n,r,s){if(R.isFunction(r))return r.call(this,t,n);if(s&&(t=n),!!R.isString(t)){if(R.isString(r))return t.indexOf(r)!==-1;if(R.isRegExp(r))return r.test(t)}}function O5(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function D5(e,t){const n=R.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(s,o,i){return this[r].call(this,t,s,o,i)},configurable:!0})})}let It=class{constructor(t){t&&this.set(t)}set(t,n,r){const s=this;function o(a,l,u){const d=li(l);if(!d)throw new Error("header name must be a non-empty string");const h=R.findKey(s,d);(!h||s[h]===void 0||u===!0||u===void 0&&s[h]!==!1)&&(s[h||l]=Xl(a))}const i=(a,l)=>R.forEach(a,(u,d)=>o(u,d,l));if(R.isPlainObject(t)||t instanceof this.constructor)i(t,n);else if(R.isString(t)&&(t=t.trim())&&!L5(t))i(A5(t),n);else if(R.isObject(t)&&R.isIterable(t)){let a={},l,u;for(const d of t){if(!R.isArray(d))throw TypeError("Object iterator must return a key-value pair");a[u=d[0]]=(l=a[u])?R.isArray(l)?[...l,d[1]]:[l,d[1]]:d[1]}i(a,n)}else t!=null&&o(n,t,r);return this}get(t,n){if(t=li(t),t){const r=R.findKey(this,t);if(r){const s=this[r];if(!n)return s;if(n===!0)return M5(s);if(R.isFunction(n))return n.call(this,s,r);if(R.isRegExp(n))return n.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=li(t),t){const r=R.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||kd(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let s=!1;function o(i){if(i=li(i),i){const a=R.findKey(r,i);a&&(!n||kd(r,r[a],a,n))&&(delete r[a],s=!0)}}return R.isArray(t)?t.forEach(o):o(t),s}clear(t){const n=Object.keys(this);let r=n.length,s=!1;for(;r--;){const o=n[r];(!t||kd(this,this[o],o,t,!0))&&(delete this[o],s=!0)}return s}normalize(t){const n=this,r={};return R.forEach(this,(s,o)=>{const i=R.findKey(r,o);if(i){n[i]=Xl(s),delete n[o];return}const a=t?O5(o):String(o).trim();a!==o&&delete n[o],n[a]=Xl(s),r[a]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return R.forEach(this,(r,s)=>{r!=null&&r!==!1&&(n[s]=t&&R.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(` +`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(s=>r.set(s)),r}static accessor(t){const r=(this[A0]=this[A0]={accessors:{}}).accessors,s=this.prototype;function o(i){const a=li(i);r[a]||(D5(s,i),r[a]=!0)}return R.isArray(t)?t.forEach(o):o(t),this}};It.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);R.reduceDescriptors(It.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});R.freezeMethods(It);function Sd(e,t){const n=this||La,r=t||n,s=It.from(r.headers);let o=r.data;return R.forEach(e,function(a){o=a.call(n,o,s.normalize(),t?t.status:void 0)}),s.normalize(),o}function A1(e){return!!(e&&e.__CANCEL__)}let Oa=class extends se{constructor(t,n,r){super(t??"canceled",se.ERR_CANCELED,n,r),this.name="CanceledError",this.__CANCEL__=!0}};function M1(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new se("Request failed with status code "+n.status,[se.ERR_BAD_REQUEST,se.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function I5(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function F5(e,t){e=e||10;const n=new Array(e),r=new Array(e);let s=0,o=0,i;return t=t!==void 0?t:1e3,function(l){const u=Date.now(),d=r[o];i||(i=u),n[s]=l,r[s]=u;let h=o,f=0;for(;h!==s;)f+=n[h++],h=h%e;if(s=(s+1)%e,s===o&&(o=(o+1)%e),u-i{n=d,s=null,o&&(clearTimeout(o),o=null),e(...u)};return[(...u)=>{const d=Date.now(),h=d-n;h>=r?i(u,d):(s=u,o||(o=setTimeout(()=>{o=null,i(s)},r-h)))},()=>s&&i(s)]}const Ac=(e,t,n=3)=>{let r=0;const s=F5(50,250);return z5(o=>{const i=o.loaded,a=o.lengthComputable?o.total:void 0,l=i-r,u=s(l),d=i<=a;r=i;const h={loaded:i,total:a,progress:a?i/a:void 0,bytes:l,rate:u||void 0,estimated:u&&a&&d?(a-i)/u:void 0,event:o,lengthComputable:a!=null,[t?"download":"upload"]:!0};e(h)},n)},M0=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},L0=e=>(...t)=>R.asap(()=>e(...t)),V5=mt.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,mt.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(mt.origin),mt.navigator&&/(msie|trident)/i.test(mt.navigator.userAgent)):()=>!0,B5=mt.hasStandardBrowserEnv?{write(e,t,n,r,s,o,i){if(typeof document>"u")return;const a=[`${e}=${encodeURIComponent(t)}`];R.isNumber(n)&&a.push(`expires=${new Date(n).toUTCString()}`),R.isString(r)&&a.push(`path=${r}`),R.isString(s)&&a.push(`domain=${s}`),o===!0&&a.push("secure"),R.isString(i)&&a.push(`SameSite=${i}`),document.cookie=a.join("; ")},read(e){if(typeof document>"u")return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function $5(e){return typeof e!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function H5(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function L1(e,t,n){let r=!$5(t);return e&&(r||n==!1)?H5(e,t):t}const O0=e=>e instanceof It?{...e}:e;function As(e,t){t=t||{};const n={};function r(u,d,h,f){return R.isPlainObject(u)&&R.isPlainObject(d)?R.merge.call({caseless:f},u,d):R.isPlainObject(d)?R.merge({},d):R.isArray(d)?d.slice():d}function s(u,d,h,f){if(R.isUndefined(d)){if(!R.isUndefined(u))return r(void 0,u,h,f)}else return r(u,d,h,f)}function o(u,d){if(!R.isUndefined(d))return r(void 0,d)}function i(u,d){if(R.isUndefined(d)){if(!R.isUndefined(u))return r(void 0,u)}else return r(void 0,d)}function a(u,d,h){if(h in t)return r(u,d);if(h in e)return r(void 0,u)}const l={url:o,method:o,data:o,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:a,headers:(u,d,h)=>s(O0(u),O0(d),h,!0)};return R.forEach(Object.keys({...e,...t}),function(d){if(d==="__proto__"||d==="constructor"||d==="prototype")return;const h=R.hasOwnProp(l,d)?l[d]:s,f=h(e[d],t[d],d);R.isUndefined(f)&&h!==a||(n[d]=f)}),n}const O1=e=>{const t=As({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:o,headers:i,auth:a}=t;if(t.headers=i=It.from(i),t.url=E1(L1(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&i.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),R.isFormData(n)){if(mt.hasStandardBrowserEnv||mt.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(R.isFunction(n.getHeaders)){const l=n.getHeaders(),u=["content-type","content-length"];Object.entries(l).forEach(([d,h])=>{u.includes(d.toLowerCase())&&i.set(d,h)})}}if(mt.hasStandardBrowserEnv&&(r&&R.isFunction(r)&&(r=r(t)),r||r!==!1&&V5(t.url))){const l=s&&o&&B5.read(o);l&&i.set(s,l)}return t},U5=typeof XMLHttpRequest<"u",W5=U5&&function(e){return new Promise(function(n,r){const s=O1(e);let o=s.data;const i=It.from(s.headers).normalize();let{responseType:a,onUploadProgress:l,onDownloadProgress:u}=s,d,h,f,p,g;function m(){p&&p(),g&&g(),s.cancelToken&&s.cancelToken.unsubscribe(d),s.signal&&s.signal.removeEventListener("abort",d)}let y=new XMLHttpRequest;y.open(s.method.toUpperCase(),s.url,!0),y.timeout=s.timeout;function x(){if(!y)return;const b=It.from("getAllResponseHeaders"in y&&y.getAllResponseHeaders()),w={data:!a||a==="text"||a==="json"?y.responseText:y.response,status:y.status,statusText:y.statusText,headers:b,config:e,request:y};M1(function(N){n(N),m()},function(N){r(N),m()},w),y=null}"onloadend"in y?y.onloadend=x:y.onreadystatechange=function(){!y||y.readyState!==4||y.status===0&&!(y.responseURL&&y.responseURL.indexOf("file:")===0)||setTimeout(x)},y.onabort=function(){y&&(r(new se("Request aborted",se.ECONNABORTED,e,y)),y=null)},y.onerror=function(k){const w=k&&k.message?k.message:"Network Error",j=new se(w,se.ERR_NETWORK,e,y);j.event=k||null,r(j),y=null},y.ontimeout=function(){let k=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const w=s.transitional||tg;s.timeoutErrorMessage&&(k=s.timeoutErrorMessage),r(new se(k,w.clarifyTimeoutError?se.ETIMEDOUT:se.ECONNABORTED,e,y)),y=null},o===void 0&&i.setContentType(null),"setRequestHeader"in y&&R.forEach(i.toJSON(),function(k,w){y.setRequestHeader(w,k)}),R.isUndefined(s.withCredentials)||(y.withCredentials=!!s.withCredentials),a&&a!=="json"&&(y.responseType=s.responseType),u&&([f,g]=Ac(u,!0),y.addEventListener("progress",f)),l&&y.upload&&([h,p]=Ac(l),y.upload.addEventListener("progress",h),y.upload.addEventListener("loadend",p)),(s.cancelToken||s.signal)&&(d=b=>{y&&(r(!b||b.type?new Oa(null,e,y):b),y.abort(),y=null)},s.cancelToken&&s.cancelToken.subscribe(d),s.signal&&(s.signal.aborted?d():s.signal.addEventListener("abort",d)));const v=I5(s.url);if(v&&mt.protocols.indexOf(v)===-1){r(new se("Unsupported protocol "+v+":",se.ERR_BAD_REQUEST,e));return}y.send(o||null)})},G5=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let r=new AbortController,s;const o=function(u){if(!s){s=!0,a();const d=u instanceof Error?u:this.reason;r.abort(d instanceof se?d:new Oa(d instanceof Error?d.message:d))}};let i=t&&setTimeout(()=>{i=null,o(new se(`timeout of ${t}ms exceeded`,se.ETIMEDOUT))},t);const a=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(u=>{u.unsubscribe?u.unsubscribe(o):u.removeEventListener("abort",o)}),e=null)};e.forEach(u=>u.addEventListener("abort",o));const{signal:l}=r;return l.unsubscribe=()=>R.asap(a),l}},K5=function*(e,t){let n=e.byteLength;if(n{const s=q5(e,t);let o=0,i,a=l=>{i||(i=!0,r&&r(l))};return new ReadableStream({async pull(l){try{const{done:u,value:d}=await s.next();if(u){a(),l.close();return}let h=d.byteLength;if(n){let f=o+=h;n(f)}l.enqueue(new Uint8Array(d))}catch(u){throw a(u),u}},cancel(l){return a(l),s.return()}},{highWaterMark:2})},I0=64*1024,{isFunction:dl}=R,X5=(({Request:e,Response:t})=>({Request:e,Response:t}))(R.global),{ReadableStream:F0,TextEncoder:z0}=R.global,V0=(e,...t)=>{try{return!!e(...t)}catch{return!1}},Q5=e=>{e=R.merge.call({skipUndefined:!0},X5,e);const{fetch:t,Request:n,Response:r}=e,s=t?dl(t):typeof fetch=="function",o=dl(n),i=dl(r);if(!s)return!1;const a=s&&dl(F0),l=s&&(typeof z0=="function"?(g=>m=>g.encode(m))(new z0):async g=>new Uint8Array(await new n(g).arrayBuffer())),u=o&&a&&V0(()=>{let g=!1;const m=new F0,y=new n(mt.origin,{body:m,method:"POST",get duplex(){return g=!0,"half"}}).headers.has("Content-Type");return m.cancel(),g&&!y}),d=i&&a&&V0(()=>R.isReadableStream(new r("").body)),h={stream:d&&(g=>g.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(g=>{!h[g]&&(h[g]=(m,y)=>{let x=m&&m[g];if(x)return x.call(m);throw new se(`Response type '${g}' is not supported`,se.ERR_NOT_SUPPORT,y)})});const f=async g=>{if(g==null)return 0;if(R.isBlob(g))return g.size;if(R.isSpecCompliantForm(g))return(await new n(mt.origin,{method:"POST",body:g}).arrayBuffer()).byteLength;if(R.isArrayBufferView(g)||R.isArrayBuffer(g))return g.byteLength;if(R.isURLSearchParams(g)&&(g=g+""),R.isString(g))return(await l(g)).byteLength},p=async(g,m)=>{const y=R.toFiniteNumber(g.getContentLength());return y??f(m)};return async g=>{let{url:m,method:y,data:x,signal:v,cancelToken:b,timeout:k,onDownloadProgress:w,onUploadProgress:j,responseType:N,headers:_,withCredentials:P="same-origin",fetchOptions:A}=O1(g),O=t||fetch;N=N?(N+"").toLowerCase():"text";let F=G5([v,b&&b.toAbortSignal()],k),D=null;const W=F&&F.unsubscribe&&(()=>{F.unsubscribe()});let G;try{if(j&&u&&y!=="get"&&y!=="head"&&(G=await p(_,x))!==0){let I=new n(m,{method:"POST",body:x,duplex:"half"}),Y;if(R.isFormData(x)&&(Y=I.headers.get("content-type"))&&_.setContentType(Y),I.body){const[T,$]=M0(G,Ac(L0(j)));x=D0(I.body,I0,T,$)}}R.isString(P)||(P=P?"include":"omit");const M=o&&"credentials"in n.prototype,U={...A,signal:F,method:y.toUpperCase(),headers:_.normalize().toJSON(),body:x,duplex:"half",credentials:M?P:void 0};D=o&&new n(m,U);let C=await(o?O(D,A):O(m,U));const L=d&&(N==="stream"||N==="response");if(d&&(w||L&&W)){const I={};["status","statusText","headers"].forEach(K=>{I[K]=C[K]});const Y=R.toFiniteNumber(C.headers.get("content-length")),[T,$]=w&&M0(Y,Ac(L0(w),!0))||[];C=new r(D0(C.body,I0,T,()=>{$&&$(),W&&W()}),I)}N=N||"text";let E=await h[R.findKey(h,N)||"text"](C,g);return!L&&W&&W(),await new Promise((I,Y)=>{M1(I,Y,{data:E,headers:It.from(C.headers),status:C.status,statusText:C.statusText,config:g,request:D})})}catch(M){throw W&&W(),M&&M.name==="TypeError"&&/Load failed|fetch/i.test(M.message)?Object.assign(new se("Network Error",se.ERR_NETWORK,g,D,M&&M.response),{cause:M.cause||M}):se.from(M,M&&M.code,g,D,M&&M.response)}}},J5=new Map,D1=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:s}=t,o=[r,s,n];let i=o.length,a=i,l,u,d=J5;for(;a--;)l=o[a],u=d.get(l),u===void 0&&d.set(l,u=a?new Map:Q5(t)),d=u;return u};D1();const rg={http:g5,xhr:W5,fetch:{get:D1}};R.forEach(rg,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const B0=e=>`- ${e}`,Z5=e=>R.isFunction(e)||e===null||e===!1;function eR(e,t){e=R.isArray(e)?e:[e];const{length:n}=e;let r,s;const o={};for(let i=0;i`adapter ${l} `+(u===!1?"is not supported by the environment":"is not available in the build"));let a=n?i.length>1?`since : `+i.map(B0).join(` `):" "+B0(i[0]):"as no adapter specified";throw new se("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return s}const I1={getAdapter:eR,adapters:rg};function _d(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Oa(null,e)}function $0(e){return _d(e),e.headers=It.from(e.headers),e.data=Sd.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),I1.getAdapter(e.adapter||La.adapter,e)(e).then(function(r){return _d(e),r.data=Sd.call(e,e.transformResponse,r),r.headers=It.from(r.headers),r},function(r){return A1(r)||(_d(e),r&&r.response&&(r.response.data=Sd.call(e,e.transformResponse,r.response),r.response.headers=It.from(r.response.headers))),Promise.reject(r)})}const F1="1.14.0",xu={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{xu[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const H0={};xu.transitional=function(t,n,r){function s(o,i){return"[Axios v"+F1+"] Transitional option '"+o+"'"+i+(r?". "+r:"")}return(o,i,a)=>{if(t===!1)throw new se(s(i," has been removed"+(n?" in "+n:"")),se.ERR_DEPRECATED);return n&&!H0[i]&&(H0[i]=!0,console.warn(s(i," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(o,i,a):!0}};xu.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function tR(e,t,n){if(typeof e!="object")throw new se("options must be an object",se.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let s=r.length;for(;s-- >0;){const o=r[s],i=t[o];if(i){const a=e[o],l=a===void 0||i(a,o,e);if(l!==!0)throw new se("option "+o+" must be "+l,se.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new se("Unknown option "+o,se.ERR_BAD_OPTION)}}const Ql={assertOptions:tR,validators:xu},en=Ql.validators;let Ss=class{constructor(t){this.defaults=t||{},this.interceptors={request:new T0,response:new T0}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const o=s.stack?s.stack.replace(/^.+\n/,""):"";try{r.stack?o&&!String(r.stack).endsWith(o.replace(/^.+\n.+\n/,""))&&(r.stack+=` -`+o):r.stack=o}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=As(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:o}=n;r!==void 0&&Ql.assertOptions(r,{silentJSONParsing:en.transitional(en.boolean),forcedJSONParsing:en.transitional(en.boolean),clarifyTimeoutError:en.transitional(en.boolean),legacyInterceptorReqResOrdering:en.transitional(en.boolean)},!1),s!=null&&(R.isFunction(s)?n.paramsSerializer={serialize:s}:Ql.assertOptions(s,{encode:en.function,serialize:en.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Ql.assertOptions(n,{baseUrl:en.spelling("baseURL"),withXsrfToken:en.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let i=o&&R.merge(o.common,o[n.method]);o&&R.forEach(["delete","get","head","post","put","patch","common"],g=>{delete o[g]}),n.headers=It.concat(i,o);const a=[];let l=!0;this.interceptors.request.forEach(function(m){if(typeof m.runWhen=="function"&&m.runWhen(n)===!1)return;l=l&&m.synchronous;const y=n.transitional||tg;y&&y.legacyInterceptorReqResOrdering?a.unshift(m.fulfilled,m.rejected):a.push(m.fulfilled,m.rejected)});const u=[];this.interceptors.response.forEach(function(m){u.push(m.fulfilled,m.rejected)});let d,h=0,f;if(!l){const g=[$0.bind(this),void 0];for(g.unshift(...a),g.push(...u),f=g.length,d=Promise.resolve(n);h{if(!r._listeners)return;let o=r._listeners.length;for(;o-- >0;)r._listeners[o](s);r._listeners=null}),this.promise.then=s=>{let o;const i=new Promise(a=>{r.subscribe(a),o=a}).then(s);return i.cancel=function(){r.unsubscribe(o)},i},t(function(o,i,a){r.reason||(r.reason=new Oa(o,i,a),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new z1(function(s){t=s}),cancel:t}}};function rR(e){return function(n){return e.apply(null,n)}}function sR(e){return R.isObject(e)&&e.isAxiosError===!0}const df={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(df).forEach(([e,t])=>{df[t]=e});function V1(e){const t=new Ss(e),n=b1(Ss.prototype.request,t);return R.extend(n,Ss.prototype,t,{allOwnKeys:!0}),R.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return V1(As(e,s))},n}const ae=V1(La);ae.Axios=Ss;ae.CanceledError=Oa;ae.CancelToken=nR;ae.isCancel=A1;ae.VERSION=F1;ae.toFormData=yu;ae.AxiosError=se;ae.Cancel=ae.CanceledError;ae.all=function(t){return Promise.all(t)};ae.spread=rR;ae.isAxiosError=sR;ae.mergeConfig=As;ae.AxiosHeaders=It;ae.formToJSON=e=>T1(R.isHTMLForm(e)?new FormData(e):e);ae.getAdapter=I1.getAdapter;ae.HttpStatusCode=df;ae.default=ae;const{Axios:Kz,AxiosError:Yz,CanceledError:Xz,isCancel:Qz,CancelToken:Jz,VERSION:Zz,all:eV,Cancel:tV,isAxiosError:nV,spread:rV,toFormData:sV,AxiosHeaders:oV,HttpStatusCode:iV,formToJSON:aV,getAdapter:lV,mergeConfig:cV}=ae,B1=S.createContext(void 0);function oR({children:e}){const[t,n]=S.useState(null),[r,s]=S.useState(!0),o=async()=>{try{const l=await ae.get("/auth/me");n(l.data)}catch{n(null)}finally{s(!1)}};S.useEffect(()=>{const l=localStorage.getItem("access_token");l?(ae.defaults.headers.common.Authorization=`Bearer ${l}`,o()):s(!1)},[]);const i=async(l,u)=>{try{const d=new URLSearchParams;d.append("username",l),d.append("password",u);const h=await ae.post("/auth/token",d,{headers:{"Content-Type":"application/x-www-form-urlencoded"}});localStorage.setItem("access_token",h.data.access_token),ae.defaults.headers.common.Authorization=`Bearer ${h.data.access_token}`,await o()}catch(d){throw d}},a=async()=>{try{localStorage.removeItem("access_token"),delete ae.defaults.headers.common.Authorization,n(null)}catch(l){console.error("Logout error:",l)}};return c.jsx(B1.Provider,{value:{user:t,isAuthenticated:!!t,isLoading:r,login:i,logout:a,checkAuth:o},children:e})}function Qr(){const e=S.useContext(B1);if(e===void 0)throw new Error("useAuth must be used within an AuthProvider");return e}const iR={theme:"system",setTheme:()=>null},$1=S.createContext(iR);function aR({children:e,defaultTheme:t="system",storageKey:n="vite-ui-theme"}){const[r,s]=S.useState(()=>localStorage.getItem(n)||t);S.useEffect(()=>{const i=window.document.documentElement;if(i.classList.remove("light","dark"),r==="system"){const a=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";i.classList.add(a);return}i.classList.add(r)},[r]);const o={theme:r,setTheme:i=>{localStorage.setItem(n,i),s(i)}};return c.jsx($1.Provider,{value:o,children:e})}const H1=()=>{const e=S.useContext($1);if(e===void 0)throw new Error("useTheme must be used within a ThemeProvider");return e};/** +`+o):r.stack=o}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=As(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:o}=n;r!==void 0&&Ql.assertOptions(r,{silentJSONParsing:en.transitional(en.boolean),forcedJSONParsing:en.transitional(en.boolean),clarifyTimeoutError:en.transitional(en.boolean),legacyInterceptorReqResOrdering:en.transitional(en.boolean)},!1),s!=null&&(R.isFunction(s)?n.paramsSerializer={serialize:s}:Ql.assertOptions(s,{encode:en.function,serialize:en.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Ql.assertOptions(n,{baseUrl:en.spelling("baseURL"),withXsrfToken:en.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let i=o&&R.merge(o.common,o[n.method]);o&&R.forEach(["delete","get","head","post","put","patch","common"],g=>{delete o[g]}),n.headers=It.concat(i,o);const a=[];let l=!0;this.interceptors.request.forEach(function(m){if(typeof m.runWhen=="function"&&m.runWhen(n)===!1)return;l=l&&m.synchronous;const y=n.transitional||tg;y&&y.legacyInterceptorReqResOrdering?a.unshift(m.fulfilled,m.rejected):a.push(m.fulfilled,m.rejected)});const u=[];this.interceptors.response.forEach(function(m){u.push(m.fulfilled,m.rejected)});let d,h=0,f;if(!l){const g=[$0.bind(this),void 0];for(g.unshift(...a),g.push(...u),f=g.length,d=Promise.resolve(n);h{if(!r._listeners)return;let o=r._listeners.length;for(;o-- >0;)r._listeners[o](s);r._listeners=null}),this.promise.then=s=>{let o;const i=new Promise(a=>{r.subscribe(a),o=a}).then(s);return i.cancel=function(){r.unsubscribe(o)},i},t(function(o,i,a){r.reason||(r.reason=new Oa(o,i,a),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new z1(function(s){t=s}),cancel:t}}};function rR(e){return function(n){return e.apply(null,n)}}function sR(e){return R.isObject(e)&&e.isAxiosError===!0}const df={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(df).forEach(([e,t])=>{df[t]=e});function V1(e){const t=new Ss(e),n=b1(Ss.prototype.request,t);return R.extend(n,Ss.prototype,t,{allOwnKeys:!0}),R.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return V1(As(e,s))},n}const ae=V1(La);ae.Axios=Ss;ae.CanceledError=Oa;ae.CancelToken=nR;ae.isCancel=A1;ae.VERSION=F1;ae.toFormData=yu;ae.AxiosError=se;ae.Cancel=ae.CanceledError;ae.all=function(t){return Promise.all(t)};ae.spread=rR;ae.isAxiosError=sR;ae.mergeConfig=As;ae.AxiosHeaders=It;ae.formToJSON=e=>T1(R.isHTMLForm(e)?new FormData(e):e);ae.getAdapter=I1.getAdapter;ae.HttpStatusCode=df;ae.default=ae;const{Axios:Yz,AxiosError:Xz,CanceledError:Qz,isCancel:Jz,CancelToken:Zz,VERSION:eV,all:tV,Cancel:nV,isAxiosError:rV,spread:sV,toFormData:oV,AxiosHeaders:iV,HttpStatusCode:aV,formToJSON:lV,getAdapter:cV,mergeConfig:uV}=ae,B1=S.createContext(void 0);function oR({children:e}){const[t,n]=S.useState(null),[r,s]=S.useState(!0),o=async()=>{try{const l=await ae.get("/auth/me");n(l.data)}catch{n(null)}finally{s(!1)}};S.useEffect(()=>{const l=localStorage.getItem("access_token");l?(ae.defaults.headers.common.Authorization=`Bearer ${l}`,o()):s(!1)},[]);const i=async(l,u)=>{try{const d=new URLSearchParams;d.append("username",l),d.append("password",u);const h=await ae.post("/auth/token",d,{headers:{"Content-Type":"application/x-www-form-urlencoded"}});localStorage.setItem("access_token",h.data.access_token),ae.defaults.headers.common.Authorization=`Bearer ${h.data.access_token}`,await o()}catch(d){throw d}},a=async()=>{try{localStorage.removeItem("access_token"),delete ae.defaults.headers.common.Authorization,n(null)}catch(l){console.error("Logout error:",l)}};return c.jsx(B1.Provider,{value:{user:t,isAuthenticated:!!t,isLoading:r,login:i,logout:a,checkAuth:o},children:e})}function Qr(){const e=S.useContext(B1);if(e===void 0)throw new Error("useAuth must be used within an AuthProvider");return e}const iR={theme:"system",setTheme:()=>null},$1=S.createContext(iR);function aR({children:e,defaultTheme:t="system",storageKey:n="vite-ui-theme"}){const[r,s]=S.useState(()=>localStorage.getItem(n)||t);S.useEffect(()=>{const i=window.document.documentElement;if(i.classList.remove("light","dark"),r==="system"){const a=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";i.classList.add(a);return}i.classList.add(r)},[r]);const o={theme:r,setTheme:i=>{localStorage.setItem(n,i),s(i)}};return c.jsx($1.Provider,{value:o,children:e})}const H1=()=>{const e=S.useContext($1);if(e===void 0)throw new Error("useTheme must be used within a ThemeProvider");return e};/** * @license lucide-react v0.294.0 - ISC * * This source code is licensed under the ISC license. @@ -139,12 +139,12 @@ Error generating stack: `+o.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const q1=J("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/** + */const K1=J("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/** * @license lucide-react v0.294.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const K1=J("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** + */const q1=J("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** * @license lucide-react v0.294.0 - ISC * * This source code is licensed under the ISC license. @@ -224,7 +224,7 @@ Error generating stack: `+o.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const q0=J("KeyRound",[["path",{d:"M2 18v3c0 .6.4 1 1 1h4v-3h3v-3h2l1.4-1.4a6.5 6.5 0 1 0-4-4Z",key:"167ctg"}],["circle",{cx:"16.5",cy:"7.5",r:".5",key:"1kog09"}]]);/** + */const K0=J("KeyRound",[["path",{d:"M2 18v3c0 .6.4 1 1 1h4v-3h3v-3h2l1.4-1.4a6.5 6.5 0 1 0-4-4Z",key:"167ctg"}],["circle",{cx:"16.5",cy:"7.5",r:".5",key:"1kog09"}]]);/** * @license lucide-react v0.294.0 - ISC * * This source code is licensed under the ISC license. @@ -289,7 +289,7 @@ Error generating stack: `+o.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const K0=J("Mic",[["path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z",key:"131961"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]);/** + */const q0=J("Mic",[["path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z",key:"131961"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]);/** * @license lucide-react v0.294.0 - ISC * * This source code is licensed under the ISC license. @@ -369,7 +369,7 @@ Error generating stack: `+o.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const To=J("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"}]]);/** + */const Ao=J("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"}]]);/** * @license lucide-react v0.294.0 - ISC * * This source code is licensed under the ISC license. @@ -394,7 +394,7 @@ Error generating stack: `+o.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const LR=J("Zap",[["polygon",{points:"13 2 3 14 12 14 11 22 21 10 12 10 13 2",key:"45s27k"}]]);function ts({children:e}){const[t,n]=S.useState(!1),[r,s]=S.useState(!1),{user:o,logout:i}=Qr(),a=ar(),u=[...(o==null?void 0:o.account_type)==="Admin"?[{name:"Analytics",href:"/admin/analytics",icon:dR},{name:"Billing",href:"/admin/billing",icon:MR},{name:"Google Analytics",href:"/admin/google-analytics",icon:Z1},{name:"Website & Engagement Funnel",href:"/admin/engagement-insights",icon:Q1}]:[{name:"Dashboard",href:"/dashboard",icon:vR}],{name:"API Keys",href:"/keys",icon:J1},{name:"Account",href:"/account",icon:NR}],d=h=>a.pathname===h;return c.jsxs("div",{className:"min-h-screen bg-gray-50 dark:bg-black transition-colors duration-300",children:[c.jsxs("header",{className:"fixed top-0 z-40 w-full bg-white dark:bg-black border-b border-gray-200 dark:border-white/10 h-16 flex items-center justify-between px-4 sm:px-6 lg:px-8 transition-colors duration-300",children:[c.jsxs("div",{className:"flex items-center gap-4",children:[c.jsxs("button",{type:"button",className:"lg:hidden p-2 text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200",onClick:()=>n(!t),children:[c.jsx("span",{className:"sr-only",children:"Open sidebar"}),t?c.jsx(Su,{size:24}):c.jsx(ek,{size:24})]}),c.jsxs("div",{className:"flex items-center gap-2 font-bold text-xl ",children:[c.jsx("img",{src:"/logo.png",className:"w-8 h-8 object-cover",alt:""}),c.jsx("span",{children:"Sunbird AI"})]})]}),c.jsx("div",{className:"flex items-center gap-4",children:c.jsxs("div",{className:"flex items-center gap-3 pl-4 border-gray-200 dark:border-white/10",children:[c.jsxs("div",{className:"hidden md:block text-right",children:[c.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-white",children:(o==null?void 0:o.username)||"User"}),c.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:(o==null?void 0:o.organization)||"Organization"})]}),c.jsx("div",{className:"h-8 w-8 rounded-full bg-primary-100 dark:bg-primary-900/50 flex items-center justify-center text-primary-700 dark:text-primary-400 border border-primary-200 dark:border-primary-800",children:c.jsx(To,{size:18})})]})})]}),c.jsxs("article",{children:[c.jsx("aside",{className:`fixed top-16 left-0 z-50 h-[calc(100vh-4rem)] bg-white dark:bg-black border-r border-gray-200 dark:border-white/10 transition-all duration-300 lg:translate-x-0 ${t?"translate-x-0":"-translate-x-full"} ${r?"w-16":"w-64"}`,children:c.jsxs("nav",{className:"h-full flex flex-col justify-between p-2",children:[c.jsx("div",{className:"space-y-1",children:u.map(h=>c.jsxs("div",{className:"relative group",children:[c.jsxs(Ee,{to:h.href,className:`flex items-center gap-3 px-3 py-2 rounded-md text-sm font-medium transition-colors ${d(h.href)?"bg-primary-50 text-primary-600 dark:bg-primary-900/20 dark:text-primary-400":"text-gray-700 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-white/5"} ${r?"justify-center":""}`,onClick:()=>n(!1),children:[c.jsx(h.icon,{size:20,className:"flex-shrink-0"}),!r&&c.jsx("span",{children:h.name})]}),r&&c.jsxs("div",{className:"absolute left-full ml-2 top-1/2 -translate-y-1/2 px-2 py-1 bg-gray-900 dark:bg-white text-white dark:text-black text-xs rounded opacity-0 invisible group-hover:opacity-100 group-hover:visible transition-all duration-200 whitespace-nowrap z-50 pointer-events-none",children:[h.name,c.jsx("div",{className:"absolute right-full top-1/2 -translate-y-1/2 border-4 border-transparent border-r-gray-900 dark:border-r-white"})]})]},h.name))}),c.jsxs("div",{className:"space-y-1 pt-4 border-t border-gray-200 dark:border-white/10",children:[c.jsxs("div",{className:"relative group",children:[c.jsxs("a",{href:"https://docs.sunbird.ai",target:"_blank",rel:"noopener noreferrer",className:`flex items-center gap-3 px-3 py-2 rounded-md text-sm font-medium text-gray-700 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-white/5 transition-colors ${r?"justify-center":""}`,children:[c.jsx(Mc,{size:20,className:"flex-shrink-0"}),!r&&c.jsx("span",{children:"Documentation"})]}),r&&c.jsxs("div",{className:"absolute left-full ml-2 top-1/2 -translate-y-1/2 px-2 py-1 bg-gray-900 dark:bg-white dark:text-black text-white text-xs rounded opacity-0 invisible group-hover:opacity-100 group-hover:visible transition-all duration-200 whitespace-nowrap z-50 pointer-events-none",children:["Documentation",c.jsx("div",{className:"absolute right-full top-1/2 -translate-y-1/2 border-4 border-transparent border-r-gray-900 dark:border-r-white"})]})]}),c.jsxs("div",{className:"relative group",children:[c.jsxs("button",{onClick:i,className:`w-full flex items-center gap-3 px-3 py-2 rounded-md text-sm font-medium text-red-600 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-900/20 transition-colors ${r?"justify-center":""}`,children:[c.jsx(kR,{size:20,className:"flex-shrink-0"}),!r&&c.jsx("span",{children:"Sign Out"})]}),r&&c.jsxs("div",{className:"absolute left-full ml-2 top-1/2 -translate-y-1/2 px-2 py-1 bg-gray-900 dark:bg-white dark:text-black text-white text-xs rounded opacity-0 invisible group-hover:opacity-100 group-hover:visible transition-all duration-200 whitespace-nowrap z-50 pointer-events-none",children:["Sign Out",c.jsx("div",{className:"absolute right-full top-1/2 -translate-y-1/2 border-4 border-transparent border-r-gray-900 dark:border-r-white"})]})]}),c.jsxs("div",{className:"relative group",children:[c.jsx("button",{onClick:()=>s(!r),className:`hidden lg:flex w-full items-center gap-3 px-3 py-2 rounded-md text-sm font-medium text-gray-700 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-white/5 transition-colors mt-2 ${r?"justify-center":""}`,children:r?c.jsx(K1,{size:20,className:"flex-shrink-0"}):c.jsxs(c.Fragment,{children:[c.jsx(q1,{size:20,className:"flex-shrink-0"}),c.jsx("span",{children:"Collapse"})]})}),r&&c.jsxs("div",{className:"absolute left-full ml-2 top-1/2 -translate-y-1/2 px-2 py-1 bg-gray-900 dark:bg-white dark:text-black text-white text-xs rounded opacity-0 invisible group-hover:opacity-100 group-hover:visible transition-all duration-200 whitespace-nowrap z-50 pointer-events-none",children:["Expand",c.jsx("div",{className:"absolute right-full top-1/2 -translate-y-1/2 border-4 border-transparent border-r-gray-900 dark:border-r-white"})]})]})]})]})}),c.jsxs("main",{className:`pt-16 pb-24 min-h-screen transition-all duration-300 ${r?"lg:pl-20":"lg:pl-64"}`,children:[c.jsx("div",{className:"p-4 sm:p-6 lg:p-8 max-w-7xl mx-auto",children:e}),c.jsx("footer",{className:`border-t border-gray-200 dark:border-white/10 py-6 text-center text-sm text-gray-500 dark:text-gray-400 fixed bottom-0 left-0 right-0 z-40 bg-gray-50 dark:bg-black ${r?"lg:ml-20":"lg:ml-64"}`,children:c.jsxs("p",{children:["© ",new Date().getFullYear()," Sunbird AI. All rights reserved."]})})]})]}),t&&c.jsx("div",{className:"fixed inset-0 bg-black/50 z-20 lg:hidden",onClick:()=>n(!1)})]})}const rk=S.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"}),_u=S.createContext({}),ju=S.createContext(null),Cu=typeof document<"u",ig=Cu?S.useLayoutEffect:S.useEffect,sk=S.createContext({strict:!1}),ag=e=>e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),OR="framerAppearId",ok="data-"+ag(OR);function DR(e,t,n,r){const{visualElement:s}=S.useContext(_u),o=S.useContext(sk),i=S.useContext(ju),a=S.useContext(rk).reducedMotion,l=S.useRef();r=r||o.renderer,!l.current&&r&&(l.current=r(e,{visualState:t,parent:s,props:n,presenceContext:i,blockInitialAnimation:i?i.initial===!1:!1,reducedMotionConfig:a}));const u=l.current;S.useInsertionEffect(()=>{u&&u.update(n,i)});const d=S.useRef(!!(n[ok]&&!window.HandoffComplete));return ig(()=>{u&&(u.render(),d.current&&u.animationState&&u.animationState.animateChanges())}),S.useEffect(()=>{u&&(u.updateFeatures(),!d.current&&u.animationState&&u.animationState.animateChanges(),d.current&&(d.current=!1,window.HandoffComplete=!0))}),u}function lo(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function IR(e,t,n){return S.useCallback(r=>{r&&e.mount&&e.mount(r),t&&(r?t.mount(r):t.unmount()),n&&(typeof n=="function"?n(r):lo(n)&&(n.current=r))},[t])}function fa(e){return typeof e=="string"||Array.isArray(e)}function Nu(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}const lg=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],cg=["initial",...lg];function Pu(e){return Nu(e.animate)||cg.some(t=>fa(e[t]))}function ik(e){return!!(Pu(e)||e.variants)}function FR(e,t){if(Pu(e)){const{initial:n,animate:r}=e;return{initial:n===!1||fa(n)?n:void 0,animate:fa(r)?r:void 0}}return e.inherit!==!1?t:{}}function zR(e){const{initial:t,animate:n}=FR(e,S.useContext(_u));return S.useMemo(()=>({initial:t,animate:n}),[Q0(t),Q0(n)])}function Q0(e){return Array.isArray(e)?e.join(" "):e}const J0={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},pa={};for(const e in J0)pa[e]={isEnabled:t=>J0[e].some(n=>!!t[n])};function VR(e){for(const t in e)pa[t]={...pa[t],...e[t]}}const ug=S.createContext({}),ak=S.createContext({}),BR=Symbol.for("motionComponentSymbol");function $R({preloadedFeatures:e,createVisualElement:t,useRender:n,useVisualState:r,Component:s}){e&&VR(e);function o(a,l){let u;const d={...S.useContext(rk),...a,layoutId:HR(a)},{isStatic:h}=d,f=zR(a),p=r(a,h);if(!h&&Cu){f.visualElement=DR(s,p,d,t);const g=S.useContext(ak),m=S.useContext(sk).strict;f.visualElement&&(u=f.visualElement.loadFeatures(d,m,e,g))}return S.createElement(_u.Provider,{value:f},u&&f.visualElement?S.createElement(u,{visualElement:f.visualElement,...d}):null,n(s,a,IR(p,f.visualElement,l),p,h,f.visualElement))}const i=S.forwardRef(o);return i[BR]=s,i}function HR({layoutId:e}){const t=S.useContext(ug).id;return t&&e!==void 0?t+"-"+e:e}function UR(e){function t(r,s={}){return $R(e(r,s))}if(typeof Proxy>"u")return t;const n=new Map;return new Proxy(t,{get:(r,s)=>(n.has(s)||n.set(s,t(s)),n.get(s))})}const WR=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function dg(e){return typeof e!="string"||e.includes("-")?!1:!!(WR.indexOf(e)>-1||/[A-Z]/.test(e))}const Lc={};function GR(e){Object.assign(Lc,e)}const Ia=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Fs=new Set(Ia);function lk(e,{layout:t,layoutId:n}){return Fs.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!Lc[e]||e==="opacity")}const Ft=e=>!!(e&&e.getVelocity),qR={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},KR=Ia.length;function YR(e,{enableHardwareAcceleration:t=!0,allowTransformNone:n=!0},r,s){let o="";for(let i=0;it=>typeof t=="string"&&t.startsWith(e),uk=ck("--"),gf=ck("var(--"),XR=/var\s*\(\s*--[\w-]+(\s*,\s*(?:(?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)+)?\s*\)/g,QR=(e,t)=>t&&typeof e=="number"?t.transform(e):e,$r=(e,t,n)=>Math.min(Math.max(n,e),t),zs={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},Ii={...zs,transform:e=>$r(0,1,e)},hl={...zs,default:1},Fi=e=>Math.round(e*1e5)/1e5,Ru=/(-)?([\d]*\.?[\d])+/g,dk=/(#[0-9a-f]{3,8}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))/gi,JR=/^(#[0-9a-f]{3,8}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))$/i;function Fa(e){return typeof e=="string"}const za=e=>({test:t=>Fa(t)&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),pr=za("deg"),Dn=za("%"),re=za("px"),ZR=za("vh"),e4=za("vw"),Z0={...Dn,parse:e=>Dn.parse(e)/100,transform:e=>Dn.transform(e*100)},ey={...zs,transform:Math.round},hk={borderWidth:re,borderTopWidth:re,borderRightWidth:re,borderBottomWidth:re,borderLeftWidth:re,borderRadius:re,radius:re,borderTopLeftRadius:re,borderTopRightRadius:re,borderBottomRightRadius:re,borderBottomLeftRadius:re,width:re,maxWidth:re,height:re,maxHeight:re,size:re,top:re,right:re,bottom:re,left:re,padding:re,paddingTop:re,paddingRight:re,paddingBottom:re,paddingLeft:re,margin:re,marginTop:re,marginRight:re,marginBottom:re,marginLeft:re,rotate:pr,rotateX:pr,rotateY:pr,rotateZ:pr,scale:hl,scaleX:hl,scaleY:hl,scaleZ:hl,skew:pr,skewX:pr,skewY:pr,distance:re,translateX:re,translateY:re,translateZ:re,x:re,y:re,z:re,perspective:re,transformPerspective:re,opacity:Ii,originX:Z0,originY:Z0,originZ:re,zIndex:ey,fillOpacity:Ii,strokeOpacity:Ii,numOctaves:ey};function hg(e,t,n,r){const{style:s,vars:o,transform:i,transformOrigin:a}=e;let l=!1,u=!1,d=!0;for(const h in t){const f=t[h];if(uk(h)){o[h]=f;continue}const p=hk[h],g=QR(f,p);if(Fs.has(h)){if(l=!0,i[h]=g,!d)continue;f!==(p.default||0)&&(d=!1)}else h.startsWith("origin")?(u=!0,a[h]=g):s[h]=g}if(t.transform||(l||r?s.transform=YR(e.transform,n,d,r):s.transform&&(s.transform="none")),u){const{originX:h="50%",originY:f="50%",originZ:p=0}=a;s.transformOrigin=`${h} ${f} ${p}`}}const fg=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function fk(e,t,n){for(const r in t)!Ft(t[r])&&!lk(r,n)&&(e[r]=t[r])}function t4({transformTemplate:e},t,n){return S.useMemo(()=>{const r=fg();return hg(r,t,{enableHardwareAcceleration:!n},e),Object.assign({},r.vars,r.style)},[t])}function n4(e,t,n){const r=e.style||{},s={};return fk(s,r,e),Object.assign(s,t4(e,t,n)),e.transformValues?e.transformValues(s):s}function r4(e,t,n){const r={},s=n4(e,t,n);return e.drag&&e.dragListener!==!1&&(r.draggable=!1,s.userSelect=s.WebkitUserSelect=s.WebkitTouchCallout="none",s.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(r.tabIndex=0),r.style=s,r}const s4=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","transformValues","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function Oc(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||s4.has(e)}let pk=e=>!Oc(e);function o4(e){e&&(pk=t=>t.startsWith("on")?!Oc(t):e(t))}try{o4(require("@emotion/is-prop-valid").default)}catch{}function i4(e,t,n){const r={};for(const s in e)s==="values"&&typeof e.values=="object"||(pk(s)||n===!0&&Oc(s)||!t&&!Oc(s)||e.draggable&&s.startsWith("onDrag"))&&(r[s]=e[s]);return r}function ty(e,t,n){return typeof e=="string"?e:re.transform(t+n*e)}function a4(e,t,n){const r=ty(t,e.x,e.width),s=ty(n,e.y,e.height);return`${r} ${s}`}const l4={offset:"stroke-dashoffset",array:"stroke-dasharray"},c4={offset:"strokeDashoffset",array:"strokeDasharray"};function u4(e,t,n=1,r=0,s=!0){e.pathLength=1;const o=s?l4:c4;e[o.offset]=re.transform(-r);const i=re.transform(t),a=re.transform(n);e[o.array]=`${i} ${a}`}function pg(e,{attrX:t,attrY:n,attrScale:r,originX:s,originY:o,pathLength:i,pathSpacing:a=1,pathOffset:l=0,...u},d,h,f){if(hg(e,u,d,f),h){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:p,style:g,dimensions:m}=e;p.transform&&(m&&(g.transform=p.transform),delete p.transform),m&&(s!==void 0||o!==void 0||g.transform)&&(g.transformOrigin=a4(m,s!==void 0?s:.5,o!==void 0?o:.5)),t!==void 0&&(p.x=t),n!==void 0&&(p.y=n),r!==void 0&&(p.scale=r),i!==void 0&&u4(p,i,a,l,!1)}const gk=()=>({...fg(),attrs:{}}),gg=e=>typeof e=="string"&&e.toLowerCase()==="svg";function d4(e,t,n,r){const s=S.useMemo(()=>{const o=gk();return pg(o,t,{enableHardwareAcceleration:!1},gg(r),e.transformTemplate),{...o.attrs,style:{...o.style}}},[t]);if(e.style){const o={};fk(o,e.style,e),s.style={...o,...s.style}}return s}function h4(e=!1){return(n,r,s,{latestValues:o},i)=>{const l=(dg(n)?d4:r4)(r,o,i,n),d={...i4(r,typeof n=="string",e),...l,ref:s},{children:h}=r,f=S.useMemo(()=>Ft(h)?h.get():h,[h]);return S.createElement(n,{...d,children:f})}}function mk(e,{style:t,vars:n},r,s){Object.assign(e.style,t,s&&s.getProjectionStyles(r));for(const o in n)e.style.setProperty(o,n[o])}const yk=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function xk(e,t,n,r){mk(e,t,void 0,r);for(const s in t.attrs)e.setAttribute(yk.has(s)?s:ag(s),t.attrs[s])}function mg(e,t){const{style:n}=e,r={};for(const s in n)(Ft(n[s])||t.style&&Ft(t.style[s])||lk(s,e))&&(r[s]=n[s]);return r}function bk(e,t){const n=mg(e,t);for(const r in e)if(Ft(e[r])||Ft(t[r])){const s=Ia.indexOf(r)!==-1?"attr"+r.charAt(0).toUpperCase()+r.substring(1):r;n[s]=e[r]}return n}function yg(e,t,n,r={},s={}){return typeof t=="function"&&(t=t(n!==void 0?n:e.custom,r,s)),typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"&&(t=t(n!==void 0?n:e.custom,r,s)),t}function vk(e){const t=S.useRef(null);return t.current===null&&(t.current=e()),t.current}const Dc=e=>Array.isArray(e),f4=e=>!!(e&&typeof e=="object"&&e.mix&&e.toValue),p4=e=>Dc(e)?e[e.length-1]||0:e;function Zl(e){const t=Ft(e)?e.get():e;return f4(t)?t.toValue():t}function g4({scrapeMotionValuesFromProps:e,createRenderState:t,onMount:n},r,s,o){const i={latestValues:m4(r,s,o,e),renderState:t()};return n&&(i.mount=a=>n(r,a,i)),i}const wk=e=>(t,n)=>{const r=S.useContext(_u),s=S.useContext(ju),o=()=>g4(e,t,r,s);return n?o():vk(o)};function m4(e,t,n,r){const s={},o=r(e,{});for(const f in o)s[f]=Zl(o[f]);let{initial:i,animate:a}=e;const l=Pu(e),u=ik(e);t&&u&&!l&&e.inherit!==!1&&(i===void 0&&(i=t.initial),a===void 0&&(a=t.animate));let d=n?n.initial===!1:!1;d=d||i===!1;const h=d?a:i;return h&&typeof h!="boolean"&&!Nu(h)&&(Array.isArray(h)?h:[h]).forEach(p=>{const g=yg(e,p);if(!g)return;const{transitionEnd:m,transition:y,...x}=g;for(const v in x){let b=x[v];if(Array.isArray(b)){const k=d?b.length-1:0;b=b[k]}b!==null&&(s[v]=b)}for(const v in m)s[v]=m[v]}),s}const Ie=e=>e;class ny{constructor(){this.order=[],this.scheduled=new Set}add(t){if(!this.scheduled.has(t))return this.scheduled.add(t),this.order.push(t),!0}remove(t){const n=this.order.indexOf(t);n!==-1&&(this.order.splice(n,1),this.scheduled.delete(t))}clear(){this.order.length=0,this.scheduled.clear()}}function y4(e){let t=new ny,n=new ny,r=0,s=!1,o=!1;const i=new WeakSet,a={schedule:(l,u=!1,d=!1)=>{const h=d&&s,f=h?t:n;return u&&i.add(l),f.add(l)&&h&&s&&(r=t.order.length),l},cancel:l=>{n.remove(l),i.delete(l)},process:l=>{if(s){o=!0;return}if(s=!0,[t,n]=[n,t],n.clear(),r=t.order.length,r)for(let u=0;u(h[f]=y4(()=>n=!0),h),{}),i=h=>o[h].process(s),a=()=>{const h=performance.now();n=!1,s.delta=r?1e3/60:Math.max(Math.min(h-s.timestamp,x4),1),s.timestamp=h,s.isProcessing=!0,fl.forEach(i),s.isProcessing=!1,n&&t&&(r=!1,e(a))},l=()=>{n=!0,r=!0,s.isProcessing||e(a)};return{schedule:fl.reduce((h,f)=>{const p=o[f];return h[f]=(g,m=!1,y=!1)=>(n||l(),p.schedule(g,m,y)),h},{}),cancel:h=>fl.forEach(f=>o[f].cancel(h)),state:s,steps:o}}const{schedule:Se,cancel:or,state:ft,steps:jd}=b4(typeof requestAnimationFrame<"u"?requestAnimationFrame:Ie,!0),v4={useVisualState:wk({scrapeMotionValuesFromProps:bk,createRenderState:gk,onMount:(e,t,{renderState:n,latestValues:r})=>{Se.read(()=>{try{n.dimensions=typeof t.getBBox=="function"?t.getBBox():t.getBoundingClientRect()}catch{n.dimensions={x:0,y:0,width:0,height:0}}}),Se.render(()=>{pg(n,r,{enableHardwareAcceleration:!1},gg(t.tagName),e.transformTemplate),xk(t,n)})}})},w4={useVisualState:wk({scrapeMotionValuesFromProps:mg,createRenderState:fg})};function k4(e,{forwardMotionProps:t=!1},n,r){return{...dg(e)?v4:w4,preloadedFeatures:n,useRender:h4(t),createVisualElement:r,Component:e}}function Yn(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}const kk=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1;function Eu(e,t="page"){return{point:{x:e[t+"X"],y:e[t+"Y"]}}}const S4=e=>t=>kk(t)&&e(t,Eu(t));function Zn(e,t,n,r){return Yn(e,t,S4(n),r)}const _4=(e,t)=>n=>t(e(n)),Fr=(...e)=>e.reduce(_4);function Sk(e){let t=null;return()=>{const n=()=>{t=null};return t===null?(t=e,n):!1}}const ry=Sk("dragHorizontal"),sy=Sk("dragVertical");function _k(e){let t=!1;if(e==="y")t=sy();else if(e==="x")t=ry();else{const n=ry(),r=sy();n&&r?t=()=>{n(),r()}:(n&&n(),r&&r())}return t}function jk(){const e=_k(!0);return e?(e(),!1):!0}class Jr{constructor(t){this.isMounted=!1,this.node=t}update(){}}function oy(e,t){const n="pointer"+(t?"enter":"leave"),r="onHover"+(t?"Start":"End"),s=(o,i)=>{if(o.pointerType==="touch"||jk())return;const a=e.getProps();e.animationState&&a.whileHover&&e.animationState.setActive("whileHover",t),a[r]&&Se.update(()=>a[r](o,i))};return Zn(e.current,n,s,{passive:!e.getProps()[r]})}class j4 extends Jr{mount(){this.unmount=Fr(oy(this.node,!0),oy(this.node,!1))}unmount(){}}class C4 extends Jr{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Fr(Yn(this.node.current,"focus",()=>this.onFocus()),Yn(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const Ck=(e,t)=>t?e===t?!0:Ck(e,t.parentElement):!1;function Cd(e,t){if(!t)return;const n=new PointerEvent("pointer"+e);t(n,Eu(n))}class N4 extends Jr{constructor(){super(...arguments),this.removeStartListeners=Ie,this.removeEndListeners=Ie,this.removeAccessibleListeners=Ie,this.startPointerPress=(t,n)=>{if(this.isPressing)return;this.removeEndListeners();const r=this.node.getProps(),o=Zn(window,"pointerup",(a,l)=>{if(!this.checkPressEnd())return;const{onTap:u,onTapCancel:d,globalTapTarget:h}=this.node.getProps();Se.update(()=>{!h&&!Ck(this.node.current,a.target)?d&&d(a,l):u&&u(a,l)})},{passive:!(r.onTap||r.onPointerUp)}),i=Zn(window,"pointercancel",(a,l)=>this.cancelPress(a,l),{passive:!(r.onTapCancel||r.onPointerCancel)});this.removeEndListeners=Fr(o,i),this.startPress(t,n)},this.startAccessiblePress=()=>{const t=o=>{if(o.key!=="Enter"||this.isPressing)return;const i=a=>{a.key!=="Enter"||!this.checkPressEnd()||Cd("up",(l,u)=>{const{onTap:d}=this.node.getProps();d&&Se.update(()=>d(l,u))})};this.removeEndListeners(),this.removeEndListeners=Yn(this.node.current,"keyup",i),Cd("down",(a,l)=>{this.startPress(a,l)})},n=Yn(this.node.current,"keydown",t),r=()=>{this.isPressing&&Cd("cancel",(o,i)=>this.cancelPress(o,i))},s=Yn(this.node.current,"blur",r);this.removeAccessibleListeners=Fr(n,s)}}startPress(t,n){this.isPressing=!0;const{onTapStart:r,whileTap:s}=this.node.getProps();s&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),r&&Se.update(()=>r(t,n))}checkPressEnd(){return this.removeEndListeners(),this.isPressing=!1,this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!jk()}cancelPress(t,n){if(!this.checkPressEnd())return;const{onTapCancel:r}=this.node.getProps();r&&Se.update(()=>r(t,n))}mount(){const t=this.node.getProps(),n=Zn(t.globalTapTarget?window:this.node.current,"pointerdown",this.startPointerPress,{passive:!(t.onTapStart||t.onPointerStart)}),r=Yn(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=Fr(n,r)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}const mf=new WeakMap,Nd=new WeakMap,P4=e=>{const t=mf.get(e.target);t&&t(e)},R4=e=>{e.forEach(P4)};function E4({root:e,...t}){const n=e||document;Nd.has(n)||Nd.set(n,{});const r=Nd.get(n),s=JSON.stringify(t);return r[s]||(r[s]=new IntersectionObserver(R4,{root:e,...t})),r[s]}function T4(e,t,n){const r=E4(t);return mf.set(e,n),r.observe(e),()=>{mf.delete(e),r.unobserve(e)}}const A4={some:0,all:1};class M4 extends Jr{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:n,margin:r,amount:s="some",once:o}=t,i={root:n?n.current:void 0,rootMargin:r,threshold:typeof s=="number"?s:A4[s]},a=l=>{const{isIntersecting:u}=l;if(this.isInView===u||(this.isInView=u,o&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);const{onViewportEnter:d,onViewportLeave:h}=this.node.getProps(),f=u?d:h;f&&f(l)};return T4(this.node.current,i,a)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(L4(t,n))&&this.startObserver()}unmount(){}}function L4({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const O4={inView:{Feature:M4},tap:{Feature:N4},focus:{Feature:C4},hover:{Feature:j4}};function Nk(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let r=0;rt[r]=n.get()),t}function I4(e){const t={};return e.values.forEach((n,r)=>t[r]=n.getVelocity()),t}function Tu(e,t,n){const r=e.getProps();return yg(r,t,n!==void 0?n:r.custom,D4(e),I4(e))}let xg=Ie;const _s=e=>e*1e3,er=e=>e/1e3,F4={current:!1},Pk=e=>Array.isArray(e)&&typeof e[0]=="number";function Rk(e){return!!(!e||typeof e=="string"&&Ek[e]||Pk(e)||Array.isArray(e)&&e.every(Rk))}const ki=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,Ek={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:ki([0,.65,.55,1]),circOut:ki([.55,0,1,.45]),backIn:ki([.31,.01,.66,-.59]),backOut:ki([.33,1.53,.69,.99])};function Tk(e){if(e)return Pk(e)?ki(e):Array.isArray(e)?e.map(Tk):Ek[e]}function z4(e,t,n,{delay:r=0,duration:s,repeat:o=0,repeatType:i="loop",ease:a,times:l}={}){const u={[t]:n};l&&(u.offset=l);const d=Tk(a);return Array.isArray(d)&&(u.easing=d),e.animate(u,{delay:r,duration:s,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:o+1,direction:i==="reverse"?"alternate":"normal"})}function V4(e,{repeat:t,repeatType:n="loop"}){const r=t&&n!=="loop"&&t%2===1?0:e.length-1;return e[r]}const Ak=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,B4=1e-7,$4=12;function H4(e,t,n,r,s){let o,i,a=0;do i=t+(n-t)/2,o=Ak(i,r,s)-e,o>0?n=i:t=i;while(Math.abs(o)>B4&&++a<$4);return i}function Va(e,t,n,r){if(e===t&&n===r)return Ie;const s=o=>H4(o,0,1,e,n);return o=>o===0||o===1?o:Ak(s(o),t,r)}const U4=Va(.42,0,1,1),W4=Va(0,0,.58,1),Mk=Va(.42,0,.58,1),G4=e=>Array.isArray(e)&&typeof e[0]!="number",Lk=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,Ok=e=>t=>1-e(1-t),bg=e=>1-Math.sin(Math.acos(e)),Dk=Ok(bg),q4=Lk(bg),Ik=Va(.33,1.53,.69,.99),vg=Ok(Ik),K4=Lk(vg),Y4=e=>(e*=2)<1?.5*vg(e):.5*(2-Math.pow(2,-10*(e-1))),X4={linear:Ie,easeIn:U4,easeInOut:Mk,easeOut:W4,circIn:bg,circInOut:q4,circOut:Dk,backIn:vg,backInOut:K4,backOut:Ik,anticipate:Y4},iy=e=>{if(Array.isArray(e)){xg(e.length===4);const[t,n,r,s]=e;return Va(t,n,r,s)}else if(typeof e=="string")return X4[e];return e},wg=(e,t)=>n=>!!(Fa(n)&&JR.test(n)&&n.startsWith(e)||t&&Object.prototype.hasOwnProperty.call(n,t)),Fk=(e,t,n)=>r=>{if(!Fa(r))return r;const[s,o,i,a]=r.match(Ru);return{[e]:parseFloat(s),[t]:parseFloat(o),[n]:parseFloat(i),alpha:a!==void 0?parseFloat(a):1}},Q4=e=>$r(0,255,e),Pd={...zs,transform:e=>Math.round(Q4(e))},xs={test:wg("rgb","red"),parse:Fk("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+Pd.transform(e)+", "+Pd.transform(t)+", "+Pd.transform(n)+", "+Fi(Ii.transform(r))+")"};function J4(e){let t="",n="",r="",s="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),s=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),s=e.substring(4,5),t+=t,n+=n,r+=r,s+=s),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:s?parseInt(s,16)/255:1}}const yf={test:wg("#"),parse:J4,transform:xs.transform},co={test:wg("hsl","hue"),parse:Fk("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+Dn.transform(Fi(t))+", "+Dn.transform(Fi(n))+", "+Fi(Ii.transform(r))+")"},wt={test:e=>xs.test(e)||yf.test(e)||co.test(e),parse:e=>xs.test(e)?xs.parse(e):co.test(e)?co.parse(e):yf.parse(e),transform:e=>Fa(e)?e:e.hasOwnProperty("red")?xs.transform(e):co.transform(e)},Te=(e,t,n)=>-n*e+n*t+e;function Rd(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function Z4({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let s=0,o=0,i=0;if(!t)s=o=i=n;else{const a=n<.5?n*(1+t):n+t-n*t,l=2*n-a;s=Rd(l,a,e+1/3),o=Rd(l,a,e),i=Rd(l,a,e-1/3)}return{red:Math.round(s*255),green:Math.round(o*255),blue:Math.round(i*255),alpha:r}}const Ed=(e,t,n)=>{const r=e*e;return Math.sqrt(Math.max(0,n*(t*t-r)+r))},e3=[yf,xs,co],t3=e=>e3.find(t=>t.test(e));function ay(e){const t=t3(e);let n=t.parse(e);return t===co&&(n=Z4(n)),n}const zk=(e,t)=>{const n=ay(e),r=ay(t),s={...n};return o=>(s.red=Ed(n.red,r.red,o),s.green=Ed(n.green,r.green,o),s.blue=Ed(n.blue,r.blue,o),s.alpha=Te(n.alpha,r.alpha,o),xs.transform(s))};function n3(e){var t,n;return isNaN(e)&&Fa(e)&&(((t=e.match(Ru))===null||t===void 0?void 0:t.length)||0)+(((n=e.match(dk))===null||n===void 0?void 0:n.length)||0)>0}const Vk={regex:XR,countKey:"Vars",token:"${v}",parse:Ie},Bk={regex:dk,countKey:"Colors",token:"${c}",parse:wt.parse},$k={regex:Ru,countKey:"Numbers",token:"${n}",parse:zs.parse};function Td(e,{regex:t,countKey:n,token:r,parse:s}){const o=e.tokenised.match(t);o&&(e["num"+n]=o.length,e.tokenised=e.tokenised.replace(t,r),e.values.push(...o.map(s)))}function Ic(e){const t=e.toString(),n={value:t,tokenised:t,values:[],numVars:0,numColors:0,numNumbers:0};return n.value.includes("var(--")&&Td(n,Vk),Td(n,Bk),Td(n,$k),n}function Hk(e){return Ic(e).values}function Uk(e){const{values:t,numColors:n,numVars:r,tokenised:s}=Ic(e),o=t.length;return i=>{let a=s;for(let l=0;ltypeof e=="number"?0:e;function s3(e){const t=Hk(e);return Uk(e)(t.map(r3))}const Hr={test:n3,parse:Hk,createTransformer:Uk,getAnimatableNone:s3},Wk=(e,t)=>n=>`${n>0?t:e}`;function Gk(e,t){return typeof e=="number"?n=>Te(e,t,n):wt.test(e)?zk(e,t):e.startsWith("var(")?Wk(e,t):Kk(e,t)}const qk=(e,t)=>{const n=[...e],r=n.length,s=e.map((o,i)=>Gk(o,t[i]));return o=>{for(let i=0;i{const n={...e,...t},r={};for(const s in n)e[s]!==void 0&&t[s]!==void 0&&(r[s]=Gk(e[s],t[s]));return s=>{for(const o in r)n[o]=r[o](s);return n}},Kk=(e,t)=>{const n=Hr.createTransformer(t),r=Ic(e),s=Ic(t);return r.numVars===s.numVars&&r.numColors===s.numColors&&r.numNumbers>=s.numNumbers?Fr(qk(r.values,s.values),n):Wk(e,t)},ga=(e,t,n)=>{const r=t-e;return r===0?1:(n-e)/r},ly=(e,t)=>n=>Te(e,t,n);function i3(e){return typeof e=="number"?ly:typeof e=="string"?wt.test(e)?zk:Kk:Array.isArray(e)?qk:typeof e=="object"?o3:ly}function a3(e,t,n){const r=[],s=n||i3(e[0]),o=e.length-1;for(let i=0;it[0];e[0]>e[o-1]&&(e=[...e].reverse(),t=[...t].reverse());const i=a3(t,r,s),a=i.length,l=u=>{let d=0;if(a>1)for(;dl($r(e[0],e[o-1],u)):l}function l3(e,t){const n=e[e.length-1];for(let r=1;r<=t;r++){const s=ga(0,t,r);e.push(Te(n,1,s))}}function c3(e){const t=[0];return l3(t,e.length-1),t}function u3(e,t){return e.map(n=>n*t)}function d3(e,t){return e.map(()=>t||Mk).splice(0,e.length-1)}function Fc({duration:e=300,keyframes:t,times:n,ease:r="easeInOut"}){const s=G4(r)?r.map(iy):iy(r),o={done:!1,value:t[0]},i=u3(n&&n.length===t.length?n:c3(t),e),a=Yk(i,t,{ease:Array.isArray(s)?s:d3(t,s)});return{calculatedDuration:e,next:l=>(o.value=a(l),o.done=l>=e,o)}}function Xk(e,t){return t?e*(1e3/t):0}const h3=5;function Qk(e,t,n){const r=Math.max(t-h3,0);return Xk(n-e(r),t-r)}const Ad=.001,f3=.01,p3=10,g3=.05,m3=1;function y3({duration:e=800,bounce:t=.25,velocity:n=0,mass:r=1}){let s,o,i=1-t;i=$r(g3,m3,i),e=$r(f3,p3,er(e)),i<1?(s=u=>{const d=u*i,h=d*e,f=d-n,p=xf(u,i),g=Math.exp(-h);return Ad-f/p*g},o=u=>{const h=u*i*e,f=h*n+n,p=Math.pow(i,2)*Math.pow(u,2)*e,g=Math.exp(-h),m=xf(Math.pow(u,2),i);return(-s(u)+Ad>0?-1:1)*((f-p)*g)/m}):(s=u=>{const d=Math.exp(-u*e),h=(u-n)*e+1;return-Ad+d*h},o=u=>{const d=Math.exp(-u*e),h=(n-u)*(e*e);return d*h});const a=5/e,l=b3(s,o,a);if(e=_s(e),isNaN(l))return{stiffness:100,damping:10,duration:e};{const u=Math.pow(l,2)*r;return{stiffness:u,damping:i*2*Math.sqrt(r*u),duration:e}}}const x3=12;function b3(e,t,n){let r=n;for(let s=1;se[n]!==void 0)}function k3(e){let t={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...e};if(!cy(e,w3)&&cy(e,v3)){const n=y3(e);t={...t,...n,mass:1},t.isResolvedFromDuration=!0}return t}function Jk({keyframes:e,restDelta:t,restSpeed:n,...r}){const s=e[0],o=e[e.length-1],i={done:!1,value:s},{stiffness:a,damping:l,mass:u,duration:d,velocity:h,isResolvedFromDuration:f}=k3({...r,velocity:-er(r.velocity||0)}),p=h||0,g=l/(2*Math.sqrt(a*u)),m=o-s,y=er(Math.sqrt(a/u)),x=Math.abs(m)<5;n||(n=x?.01:2),t||(t=x?.005:.5);let v;if(g<1){const b=xf(y,g);v=k=>{const w=Math.exp(-g*y*k);return o-w*((p+g*y*m)/b*Math.sin(b*k)+m*Math.cos(b*k))}}else if(g===1)v=b=>o-Math.exp(-y*b)*(m+(p+y*m)*b);else{const b=y*Math.sqrt(g*g-1);v=k=>{const w=Math.exp(-g*y*k),j=Math.min(b*k,300);return o-w*((p+g*y*m)*Math.sinh(j)+b*m*Math.cosh(j))/b}}return{calculatedDuration:f&&d||null,next:b=>{const k=v(b);if(f)i.done=b>=d;else{let w=p;b!==0&&(g<1?w=Qk(v,b,k):w=0);const j=Math.abs(w)<=n,N=Math.abs(o-k)<=t;i.done=j&&N}return i.value=i.done?o:k,i}}}function uy({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:s=10,bounceStiffness:o=500,modifyTarget:i,min:a,max:l,restDelta:u=.5,restSpeed:d}){const h=e[0],f={done:!1,value:h},p=_=>a!==void 0&&_l,g=_=>a===void 0?l:l===void 0||Math.abs(a-_)-m*Math.exp(-_/r),b=_=>x+v(_),k=_=>{const P=v(_),A=b(_);f.done=Math.abs(P)<=u,f.value=f.done?x:A};let w,j;const N=_=>{p(f.value)&&(w=_,j=Jk({keyframes:[f.value,g(f.value)],velocity:Qk(b,_,f.value),damping:s,stiffness:o,restDelta:u,restSpeed:d}))};return N(0),{calculatedDuration:null,next:_=>{let P=!1;return!j&&w===void 0&&(P=!0,k(_),N(_)),w!==void 0&&_>w?j.next(_-w):(!P&&k(_),f)}}}const S3=e=>{const t=({timestamp:n})=>e(n);return{start:()=>Se.update(t,!0),stop:()=>or(t),now:()=>ft.isProcessing?ft.timestamp:performance.now()}},dy=2e4;function hy(e){let t=0;const n=50;let r=e.next(t);for(;!r.done&&t=dy?1/0:t}const _3={decay:uy,inertia:uy,tween:Fc,keyframes:Fc,spring:Jk};function zc({autoplay:e=!0,delay:t=0,driver:n=S3,keyframes:r,type:s="keyframes",repeat:o=0,repeatDelay:i=0,repeatType:a="loop",onPlay:l,onStop:u,onComplete:d,onUpdate:h,...f}){let p=1,g=!1,m,y;const x=()=>{y=new Promise(I=>{m=I})};x();let v;const b=_3[s]||Fc;let k;b!==Fc&&typeof r[0]!="number"&&(k=Yk([0,100],r,{clamp:!1}),r=[0,100]);const w=b({...f,keyframes:r});let j;a==="mirror"&&(j=b({...f,keyframes:[...r].reverse(),velocity:-(f.velocity||0)}));let N="idle",_=null,P=null,A=null;w.calculatedDuration===null&&o&&(w.calculatedDuration=hy(w));const{calculatedDuration:O}=w;let F=1/0,D=1/0;O!==null&&(F=O+i,D=F*(o+1)-i);let U=0;const W=I=>{if(P===null)return;p>0&&(P=Math.min(P,I)),p<0&&(P=Math.min(I-D/p,P)),_!==null?U=_:U=Math.round(I-P)*p;const Y=U-t*(p>=0?1:-1),T=p>=0?Y<0:Y>D;U=Math.max(Y,0),N==="finished"&&_===null&&(U=D);let $=U,q=w;if(o){const nt=Math.min(U,D)/F;let lt=Math.floor(nt),Ye=nt%1;!Ye&&nt>=1&&(Ye=1),Ye===1&<--,lt=Math.min(lt,o+1),!!(lt%2)&&(a==="reverse"?(Ye=1-Ye,i&&(Ye-=i/F)):a==="mirror"&&(q=j)),$=$r(0,1,Ye)*F}const ne=T?{done:!1,value:r[0]}:q.next($);k&&(ne.value=k(ne.value));let{done:ce}=ne;!T&&O!==null&&(ce=p>=0?U>=D:U<=0);const fe=_===null&&(N==="finished"||N==="running"&&ce);return h&&h(ne.value),fe&&C(),ne},M=()=>{v&&v.stop(),v=void 0},H=()=>{N="idle",M(),m(),x(),P=A=null},C=()=>{N="finished",d&&d(),M(),m()},L=()=>{if(g)return;v||(v=n(W));const I=v.now();l&&l(),_!==null?P=I-_:(!P||N==="finished")&&(P=I),N==="finished"&&x(),A=P,_=null,N="running",v.start()};e&&L();const E={then(I,Y){return y.then(I,Y)},get time(){return er(U)},set time(I){I=_s(I),U=I,_!==null||!v||p===0?_=I:P=v.now()-I/p},get duration(){const I=w.calculatedDuration===null?hy(w):w.calculatedDuration;return er(I)},get speed(){return p},set speed(I){I===p||!v||(p=I,E.time=er(U))},get state(){return N},play:L,pause:()=>{N="paused",_=U},stop:()=>{g=!0,N!=="idle"&&(N="idle",u&&u(),H())},cancel:()=>{A!==null&&W(A),H()},complete:()=>{N="finished"},sample:I=>(P=0,W(I))};return E}function j3(e){let t;return()=>(t===void 0&&(t=e()),t)}const C3=j3(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),N3=new Set(["opacity","clipPath","filter","transform","backgroundColor"]),pl=10,P3=2e4,R3=(e,t)=>t.type==="spring"||e==="backgroundColor"||!Rk(t.ease);function E3(e,t,{onUpdate:n,onComplete:r,...s}){if(!(C3()&&N3.has(t)&&!s.repeatDelay&&s.repeatType!=="mirror"&&s.damping!==0&&s.type!=="inertia"))return!1;let i=!1,a,l,u=!1;const d=()=>{l=new Promise(b=>{a=b})};d();let{keyframes:h,duration:f=300,ease:p,times:g}=s;if(R3(t,s)){const b=zc({...s,repeat:0,delay:0});let k={done:!1,value:h[0]};const w=[];let j=0;for(;!k.done&&j{u=!1,m.cancel()},x=()=>{u=!0,Se.update(y),a(),d()};return m.onfinish=()=>{u||(e.set(V4(h,s)),r&&r(),x())},{then(b,k){return l.then(b,k)},attachTimeline(b){return m.timeline=b,m.onfinish=null,Ie},get time(){return er(m.currentTime||0)},set time(b){m.currentTime=_s(b)},get speed(){return m.playbackRate},set speed(b){m.playbackRate=b},get duration(){return er(f)},play:()=>{i||(m.play(),or(y))},pause:()=>m.pause(),stop:()=>{if(i=!0,m.playState==="idle")return;const{currentTime:b}=m;if(b){const k=zc({...s,autoplay:!1});e.setWithVelocity(k.sample(b-pl).value,k.sample(b).value,pl)}x()},complete:()=>{u||m.finish()},cancel:x}}function T3({keyframes:e,delay:t,onUpdate:n,onComplete:r}){const s=()=>(n&&n(e[e.length-1]),r&&r(),{time:0,speed:1,duration:0,play:Ie,pause:Ie,stop:Ie,then:o=>(o(),Promise.resolve()),cancel:Ie,complete:Ie});return t?zc({keyframes:[0,1],duration:0,delay:t,onComplete:s}):s()}const A3={type:"spring",stiffness:500,damping:25,restSpeed:10},M3=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),L3={type:"keyframes",duration:.8},O3={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},D3=(e,{keyframes:t})=>t.length>2?L3:Fs.has(e)?e.startsWith("scale")?M3(t[1]):A3:O3,bf=(e,t)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(Hr.test(t)||t==="0")&&!t.startsWith("url(")),I3=new Set(["brightness","contrast","saturate","opacity"]);function F3(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[r]=n.match(Ru)||[];if(!r)return e;const s=n.replace(r,"");let o=I3.has(t)?1:0;return r!==n&&(o*=100),t+"("+o+s+")"}const z3=/([a-z-]*)\(.*?\)/g,vf={...Hr,getAnimatableNone:e=>{const t=e.match(z3);return t?t.map(F3).join(" "):e}},V3={...hk,color:wt,backgroundColor:wt,outlineColor:wt,fill:wt,stroke:wt,borderColor:wt,borderTopColor:wt,borderRightColor:wt,borderBottomColor:wt,borderLeftColor:wt,filter:vf,WebkitFilter:vf},kg=e=>V3[e];function Zk(e,t){let n=kg(e);return n!==vf&&(n=Hr),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const e2=e=>/^0[^.\s]+$/.test(e);function B3(e){if(typeof e=="number")return e===0;if(e!==null)return e==="none"||e==="0"||e2(e)}function $3(e,t,n,r){const s=bf(t,n);let o;Array.isArray(n)?o=[...n]:o=[null,n];const i=r.from!==void 0?r.from:e.get();let a;const l=[];for(let u=0;us=>{const o=Sg(r,e)||{},i=o.delay||r.delay||0;let{elapsed:a=0}=r;a=a-_s(i);const l=$3(t,e,n,o),u=l[0],d=l[l.length-1],h=bf(e,u),f=bf(e,d);let p={keyframes:l,velocity:t.getVelocity(),ease:"easeOut",...o,delay:-a,onUpdate:g=>{t.set(g),o.onUpdate&&o.onUpdate(g)},onComplete:()=>{s(),o.onComplete&&o.onComplete()}};if(H3(o)||(p={...p,...D3(e,p)}),p.duration&&(p.duration=_s(p.duration)),p.repeatDelay&&(p.repeatDelay=_s(p.repeatDelay)),!h||!f||F4.current||o.type===!1||U3.skipAnimations)return T3(p);if(!r.isHandoff&&t.owner&&t.owner.current instanceof HTMLElement&&!t.owner.getProps().onUpdate){const g=E3(t,e,p);if(g)return g}return zc(p)};function Vc(e){return!!(Ft(e)&&e.add)}const t2=e=>/^\-?\d*\.?\d+$/.test(e);function jg(e,t){e.indexOf(t)===-1&&e.push(t)}function Cg(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}class Ng{constructor(){this.subscriptions=[]}add(t){return jg(this.subscriptions,t),()=>Cg(this.subscriptions,t)}notify(t,n,r){const s=this.subscriptions.length;if(s)if(s===1)this.subscriptions[0](t,n,r);else for(let o=0;o!isNaN(parseFloat(e));class G3{constructor(t,n={}){this.version="10.18.0",this.timeDelta=0,this.lastUpdated=0,this.canTrackVelocity=!1,this.events={},this.updateAndNotify=(r,s=!0)=>{this.prev=this.current,this.current=r;const{delta:o,timestamp:i}=ft;this.lastUpdated!==i&&(this.timeDelta=o,this.lastUpdated=i,Se.postRender(this.scheduleVelocityCheck)),this.prev!==this.current&&this.events.change&&this.events.change.notify(this.current),this.events.velocityChange&&this.events.velocityChange.notify(this.getVelocity()),s&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.scheduleVelocityCheck=()=>Se.postRender(this.velocityCheck),this.velocityCheck=({timestamp:r})=>{r!==this.lastUpdated&&(this.prev=this.current,this.events.velocityChange&&this.events.velocityChange.notify(this.getVelocity()))},this.hasAnimated=!1,this.prev=this.current=t,this.canTrackVelocity=W3(this.current),this.owner=n.owner}onChange(t){return this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new Ng);const r=this.events[t].add(n);return t==="change"?()=>{r(),Se.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t,n=!0){!n||!this.passiveEffect?this.updateAndNotify(t,n):this.passiveEffect(t,this.updateAndNotify)}setWithVelocity(t,n,r){this.set(n),this.prev=t,this.timeDelta=r}jump(t){this.updateAndNotify(t),this.prev=t,this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){return this.canTrackVelocity?Xk(parseFloat(this.current)-parseFloat(this.prev),this.timeDelta):0}start(t){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=t(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Ao(e,t){return new G3(e,t)}const n2=e=>t=>t.test(e),q3={test:e=>e==="auto",parse:e=>e},r2=[zs,re,Dn,pr,e4,ZR,q3],li=e=>r2.find(n2(e)),K3=[...r2,wt,Hr],Y3=e=>K3.find(n2(e));function X3(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,Ao(n))}function Q3(e,t){const n=Tu(e,t);let{transitionEnd:r={},transition:s={},...o}=n?e.makeTargetAnimatable(n,!1):{};o={...o,...r};for(const i in o){const a=p4(o[i]);X3(e,i,a)}}function J3(e,t,n){var r,s;const o=Object.keys(t).filter(a=>!e.hasValue(a)),i=o.length;if(i)for(let a=0;al.remove(h))),u.push(y)}return i&&Promise.all(u).then(()=>{i&&Q3(e,i)}),u}function wf(e,t,n={}){const r=Tu(e,t,n.custom);let{transition:s=e.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(s=n.transitionOverride);const o=r?()=>Promise.all(s2(e,r,n)):()=>Promise.resolve(),i=e.variantChildren&&e.variantChildren.size?(l=0)=>{const{delayChildren:u=0,staggerChildren:d,staggerDirection:h}=s;return rE(e,t,u+l,d,h,n)}:()=>Promise.resolve(),{when:a}=s;if(a){const[l,u]=a==="beforeChildren"?[o,i]:[i,o];return l().then(()=>u())}else return Promise.all([o(),i(n.delay)])}function rE(e,t,n=0,r=0,s=1,o){const i=[],a=(e.variantChildren.size-1)*r,l=s===1?(u=0)=>u*r:(u=0)=>a-u*r;return Array.from(e.variantChildren).sort(sE).forEach((u,d)=>{u.notify("AnimationStart",t),i.push(wf(u,t,{...o,delay:n+l(d)}).then(()=>u.notify("AnimationComplete",t)))}),Promise.all(i)}function sE(e,t){return e.sortNodePosition(t)}function oE(e,t,n={}){e.notify("AnimationStart",t);let r;if(Array.isArray(t)){const s=t.map(o=>wf(e,o,n));r=Promise.all(s)}else if(typeof t=="string")r=wf(e,t,n);else{const s=typeof t=="function"?Tu(e,t,n.custom):t;r=Promise.all(s2(e,s,n))}return r.then(()=>e.notify("AnimationComplete",t))}const iE=[...lg].reverse(),aE=lg.length;function lE(e){return t=>Promise.all(t.map(({animation:n,options:r})=>oE(e,n,r)))}function cE(e){let t=lE(e);const n=dE();let r=!0;const s=(l,u)=>{const d=Tu(e,u);if(d){const{transition:h,transitionEnd:f,...p}=d;l={...l,...p,...f}}return l};function o(l){t=l(e)}function i(l,u){const d=e.getProps(),h=e.getVariantContext(!0)||{},f=[],p=new Set;let g={},m=1/0;for(let x=0;xm&&w,A=!1;const O=Array.isArray(k)?k:[k];let F=O.reduce(s,{});j===!1&&(F={});const{prevResolvedValues:D={}}=b,U={...D,...F},W=M=>{P=!0,p.has(M)&&(A=!0,p.delete(M)),b.needsAnimating[M]=!0};for(const M in U){const H=F[M],C=D[M];if(g.hasOwnProperty(M))continue;let L=!1;Dc(H)&&Dc(C)?L=!Nk(H,C):L=H!==C,L?H!==void 0?W(M):p.add(M):H!==void 0&&p.has(M)?W(M):b.protectedKeys[M]=!0}b.prevProp=k,b.prevResolvedValues=F,b.isActive&&(g={...g,...F}),r&&e.blockInitialAnimation&&(P=!1),P&&(!N||A)&&f.push(...O.map(M=>({animation:M,options:{type:v,...l}})))}if(p.size){const x={};p.forEach(v=>{const b=e.getBaseTarget(v);b!==void 0&&(x[v]=b)}),f.push({animation:x})}let y=!!f.length;return r&&(d.initial===!1||d.initial===d.animate)&&!e.manuallyAnimateOnMount&&(y=!1),r=!1,y?t(f):Promise.resolve()}function a(l,u,d){var h;if(n[l].isActive===u)return Promise.resolve();(h=e.variantChildren)===null||h===void 0||h.forEach(p=>{var g;return(g=p.animationState)===null||g===void 0?void 0:g.setActive(l,u)}),n[l].isActive=u;const f=i(d,l);for(const p in n)n[p].protectedKeys={};return f}return{animateChanges:i,setActive:a,setAnimateFunction:o,getState:()=>n}}function uE(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!Nk(t,e):!1}function ns(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function dE(){return{animate:ns(!0),whileInView:ns(),whileHover:ns(),whileTap:ns(),whileDrag:ns(),whileFocus:ns(),exit:ns()}}class hE extends Jr{constructor(t){super(t),t.animationState||(t.animationState=cE(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();this.unmount(),Nu(t)&&(this.unmount=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){}}let fE=0;class pE extends Jr{constructor(){super(...arguments),this.id=fE++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n,custom:r}=this.node.presenceContext,{isPresent:s}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===s)return;const o=this.node.animationState.setActive("exit",!t,{custom:r??this.node.getProps().custom});n&&!t&&o.then(()=>n(this.id))}mount(){const{register:t}=this.node.presenceContext||{};t&&(this.unmount=t(this.id))}unmount(){}}const gE={animation:{Feature:hE},exit:{Feature:pE}},fy=(e,t)=>Math.abs(e-t);function mE(e,t){const n=fy(e.x,t.x),r=fy(e.y,t.y);return Math.sqrt(n**2+r**2)}class o2{constructor(t,n,{transformPagePoint:r,contextWindow:s,dragSnapToOrigin:o=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const h=Ld(this.lastMoveEventInfo,this.history),f=this.startEvent!==null,p=mE(h.offset,{x:0,y:0})>=3;if(!f&&!p)return;const{point:g}=h,{timestamp:m}=ft;this.history.push({...g,timestamp:m});const{onStart:y,onMove:x}=this.handlers;f||(y&&y(this.lastMoveEvent,h),this.startEvent=this.lastMoveEvent),x&&x(this.lastMoveEvent,h)},this.handlePointerMove=(h,f)=>{this.lastMoveEvent=h,this.lastMoveEventInfo=Md(f,this.transformPagePoint),Se.update(this.updatePoint,!0)},this.handlePointerUp=(h,f)=>{this.end();const{onEnd:p,onSessionEnd:g,resumeAnimation:m}=this.handlers;if(this.dragSnapToOrigin&&m&&m(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const y=Ld(h.type==="pointercancel"?this.lastMoveEventInfo:Md(f,this.transformPagePoint),this.history);this.startEvent&&p&&p(h,y),g&&g(h,y)},!kk(t))return;this.dragSnapToOrigin=o,this.handlers=n,this.transformPagePoint=r,this.contextWindow=s||window;const i=Eu(t),a=Md(i,this.transformPagePoint),{point:l}=a,{timestamp:u}=ft;this.history=[{...l,timestamp:u}];const{onSessionStart:d}=n;d&&d(t,Ld(a,this.history)),this.removeListeners=Fr(Zn(this.contextWindow,"pointermove",this.handlePointerMove),Zn(this.contextWindow,"pointerup",this.handlePointerUp),Zn(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),or(this.updatePoint)}}function Md(e,t){return t?{point:t(e.point)}:e}function py(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Ld({point:e},t){return{point:e,delta:py(e,i2(t)),offset:py(e,yE(t)),velocity:xE(t,.1)}}function yE(e){return e[0]}function i2(e){return e[e.length-1]}function xE(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const s=i2(e);for(;n>=0&&(r=e[n],!(s.timestamp-r.timestamp>_s(t)));)n--;if(!r)return{x:0,y:0};const o=er(s.timestamp-r.timestamp);if(o===0)return{x:0,y:0};const i={x:(s.x-r.x)/o,y:(s.y-r.y)/o};return i.x===1/0&&(i.x=0),i.y===1/0&&(i.y=0),i}function Kt(e){return e.max-e.min}function kf(e,t=0,n=.01){return Math.abs(e-t)<=n}function gy(e,t,n,r=.5){e.origin=r,e.originPoint=Te(t.min,t.max,e.origin),e.scale=Kt(n)/Kt(t),(kf(e.scale,1,1e-4)||isNaN(e.scale))&&(e.scale=1),e.translate=Te(n.min,n.max,e.origin)-e.originPoint,(kf(e.translate)||isNaN(e.translate))&&(e.translate=0)}function zi(e,t,n,r){gy(e.x,t.x,n.x,r?r.originX:void 0),gy(e.y,t.y,n.y,r?r.originY:void 0)}function my(e,t,n){e.min=n.min+t.min,e.max=e.min+Kt(t)}function bE(e,t,n){my(e.x,t.x,n.x),my(e.y,t.y,n.y)}function yy(e,t,n){e.min=t.min-n.min,e.max=e.min+Kt(t)}function Vi(e,t,n){yy(e.x,t.x,n.x),yy(e.y,t.y,n.y)}function vE(e,{min:t,max:n},r){return t!==void 0&&en&&(e=r?Te(n,e,r.max):Math.min(e,n)),e}function xy(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function wE(e,{top:t,left:n,bottom:r,right:s}){return{x:xy(e.x,n,s),y:xy(e.y,t,r)}}function by(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.minr?n=ga(t.min,t.max-r,e.min):r>s&&(n=ga(e.min,e.max-s,t.min)),$r(0,1,n)}function _E(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const Sf=.35;function jE(e=Sf){return e===!1?e=0:e===!0&&(e=Sf),{x:vy(e,"left","right"),y:vy(e,"top","bottom")}}function vy(e,t,n){return{min:wy(e,t),max:wy(e,n)}}function wy(e,t){return typeof e=="number"?e:e[t]||0}const ky=()=>({translate:0,scale:1,origin:0,originPoint:0}),uo=()=>({x:ky(),y:ky()}),Sy=()=>({min:0,max:0}),Ve=()=>({x:Sy(),y:Sy()});function rn(e){return[e("x"),e("y")]}function a2({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function CE({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function NE(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function Od(e){return e===void 0||e===1}function _f({scale:e,scaleX:t,scaleY:n}){return!Od(e)||!Od(t)||!Od(n)}function cs(e){return _f(e)||l2(e)||e.z||e.rotate||e.rotateX||e.rotateY}function l2(e){return _y(e.x)||_y(e.y)}function _y(e){return e&&e!=="0%"}function Bc(e,t,n){const r=e-n,s=t*r;return n+s}function jy(e,t,n,r,s){return s!==void 0&&(e=Bc(e,s,r)),Bc(e,n,r)+t}function jf(e,t=0,n=1,r,s){e.min=jy(e.min,t,n,r,s),e.max=jy(e.max,t,n,r,s)}function c2(e,{x:t,y:n}){jf(e.x,t.translate,t.scale,t.originPoint),jf(e.y,n.translate,n.scale,n.originPoint)}function PE(e,t,n,r=!1){const s=n.length;if(!s)return;t.x=t.y=1;let o,i;for(let a=0;a1.0000000000001||e<.999999999999?e:1}function yr(e,t){e.min=e.min+t,e.max=e.max+t}function Ny(e,t,[n,r,s]){const o=t[s]!==void 0?t[s]:.5,i=Te(e.min,e.max,o);jf(e,t[n],t[r],i,t.scale)}const RE=["x","scaleX","originX"],EE=["y","scaleY","originY"];function ho(e,t){Ny(e.x,t,RE),Ny(e.y,t,EE)}function u2(e,t){return a2(NE(e.getBoundingClientRect(),t))}function TE(e,t,n){const r=u2(e,n),{scroll:s}=t;return s&&(yr(r.x,s.offset.x),yr(r.y,s.offset.y)),r}const d2=({current:e})=>e?e.ownerDocument.defaultView:null,AE=new WeakMap;class ME{constructor(t){this.openGlobalLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Ve(),this.visualElement=t}start(t,{snapToCursor:n=!1}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const s=d=>{const{dragSnapToOrigin:h}=this.getProps();h?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(Eu(d,"page").point)},o=(d,h)=>{const{drag:f,dragPropagation:p,onDragStart:g}=this.getProps();if(f&&!p&&(this.openGlobalLock&&this.openGlobalLock(),this.openGlobalLock=_k(f),!this.openGlobalLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),rn(y=>{let x=this.getAxisMotionValue(y).get()||0;if(Dn.test(x)){const{projection:v}=this.visualElement;if(v&&v.layout){const b=v.layout.layoutBox[y];b&&(x=Kt(b)*(parseFloat(x)/100))}}this.originPoint[y]=x}),g&&Se.update(()=>g(d,h),!1,!0);const{animationState:m}=this.visualElement;m&&m.setActive("whileDrag",!0)},i=(d,h)=>{const{dragPropagation:f,dragDirectionLock:p,onDirectionLock:g,onDrag:m}=this.getProps();if(!f&&!this.openGlobalLock)return;const{offset:y}=h;if(p&&this.currentDirection===null){this.currentDirection=LE(y),this.currentDirection!==null&&g&&g(this.currentDirection);return}this.updateAxis("x",h.point,y),this.updateAxis("y",h.point,y),this.visualElement.render(),m&&m(d,h)},a=(d,h)=>this.stop(d,h),l=()=>rn(d=>{var h;return this.getAnimationState(d)==="paused"&&((h=this.getAxisMotionValue(d).animation)===null||h===void 0?void 0:h.play())}),{dragSnapToOrigin:u}=this.getProps();this.panSession=new o2(t,{onSessionStart:s,onStart:o,onMove:i,onSessionEnd:a,resumeAnimation:l},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:u,contextWindow:d2(this.visualElement)})}stop(t,n){const r=this.isDragging;if(this.cancel(),!r)return;const{velocity:s}=n;this.startAnimation(s);const{onDragEnd:o}=this.getProps();o&&Se.update(()=>o(t,n))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:r}=this.getProps();!r&&this.openGlobalLock&&(this.openGlobalLock(),this.openGlobalLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(t,n,r){const{drag:s}=this.getProps();if(!r||!gl(t,s,this.currentDirection))return;const o=this.getAxisMotionValue(t);let i=this.originPoint[t]+r[t];this.constraints&&this.constraints[t]&&(i=vE(i,this.constraints[t],this.elastic[t])),o.set(i)}resolveConstraints(){var t;const{dragConstraints:n,dragElastic:r}=this.getProps(),s=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(t=this.visualElement.projection)===null||t===void 0?void 0:t.layout,o=this.constraints;n&&lo(n)?this.constraints||(this.constraints=this.resolveRefConstraints()):n&&s?this.constraints=wE(s.layoutBox,n):this.constraints=!1,this.elastic=jE(r),o!==this.constraints&&s&&this.constraints&&!this.hasMutatedConstraints&&rn(i=>{this.getAxisMotionValue(i)&&(this.constraints[i]=_E(s.layoutBox[i],this.constraints[i]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!lo(t))return!1;const r=t.current,{projection:s}=this.visualElement;if(!s||!s.layout)return!1;const o=TE(r,s.root,this.visualElement.getTransformPagePoint());let i=kE(s.layout.layoutBox,o);if(n){const a=n(CE(i));this.hasMutatedConstraints=!!a,a&&(i=a2(a))}return i}startAnimation(t){const{drag:n,dragMomentum:r,dragElastic:s,dragTransition:o,dragSnapToOrigin:i,onDragTransitionEnd:a}=this.getProps(),l=this.constraints||{},u=rn(d=>{if(!gl(d,n,this.currentDirection))return;let h=l&&l[d]||{};i&&(h={min:0,max:0});const f=s?200:1e6,p=s?40:1e7,g={type:"inertia",velocity:r?t[d]:0,bounceStiffness:f,bounceDamping:p,timeConstant:750,restDelta:1,restSpeed:10,...o,...h};return this.startAxisValueAnimation(d,g)});return Promise.all(u).then(a)}startAxisValueAnimation(t,n){const r=this.getAxisMotionValue(t);return r.start(_g(t,r,0,n))}stopAnimation(){rn(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){rn(t=>{var n;return(n=this.getAxisMotionValue(t).animation)===null||n===void 0?void 0:n.pause()})}getAnimationState(t){var n;return(n=this.getAxisMotionValue(t).animation)===null||n===void 0?void 0:n.state}getAxisMotionValue(t){const n="_drag"+t.toUpperCase(),r=this.visualElement.getProps(),s=r[n];return s||this.visualElement.getValue(t,(r.initial?r.initial[t]:void 0)||0)}snapToCursor(t){rn(n=>{const{drag:r}=this.getProps();if(!gl(n,r,this.currentDirection))return;const{projection:s}=this.visualElement,o=this.getAxisMotionValue(n);if(s&&s.layout){const{min:i,max:a}=s.layout.layoutBox[n];o.set(t[n]-Te(i,a,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!lo(n)||!r||!this.constraints)return;this.stopAnimation();const s={x:0,y:0};rn(i=>{const a=this.getAxisMotionValue(i);if(a){const l=a.get();s[i]=SE({min:l,max:l},this.constraints[i])}});const{transformTemplate:o}=this.visualElement.getProps();this.visualElement.current.style.transform=o?o({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),rn(i=>{if(!gl(i,t,null))return;const a=this.getAxisMotionValue(i),{min:l,max:u}=this.constraints[i];a.set(Te(l,u,s[i]))})}addListeners(){if(!this.visualElement.current)return;AE.set(this.visualElement,this);const t=this.visualElement.current,n=Zn(t,"pointerdown",l=>{const{drag:u,dragListener:d=!0}=this.getProps();u&&d&&this.start(l)}),r=()=>{const{dragConstraints:l}=this.getProps();lo(l)&&(this.constraints=this.resolveRefConstraints())},{projection:s}=this.visualElement,o=s.addEventListener("measure",r);s&&!s.layout&&(s.root&&s.root.updateScroll(),s.updateLayout()),r();const i=Yn(window,"resize",()=>this.scalePositionWithinConstraints()),a=s.addEventListener("didUpdate",(({delta:l,hasLayoutChanged:u})=>{this.isDragging&&u&&(rn(d=>{const h=this.getAxisMotionValue(d);h&&(this.originPoint[d]+=l[d].translate,h.set(h.get()+l[d].translate))}),this.visualElement.render())}));return()=>{i(),n(),o(),a&&a()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:s=!1,dragConstraints:o=!1,dragElastic:i=Sf,dragMomentum:a=!0}=t;return{...t,drag:n,dragDirectionLock:r,dragPropagation:s,dragConstraints:o,dragElastic:i,dragMomentum:a}}}function gl(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function LE(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class OE extends Jr{constructor(t){super(t),this.removeGroupControls=Ie,this.removeListeners=Ie,this.controls=new ME(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Ie}unmount(){this.removeGroupControls(),this.removeListeners()}}const Py=e=>(t,n)=>{e&&Se.update(()=>e(t,n))};class DE extends Jr{constructor(){super(...arguments),this.removePointerDownListener=Ie}onPointerDown(t){this.session=new o2(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:d2(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:r,onPanEnd:s}=this.node.getProps();return{onSessionStart:Py(t),onStart:Py(n),onMove:r,onEnd:(o,i)=>{delete this.session,s&&Se.update(()=>s(o,i))}}}mount(){this.removePointerDownListener=Zn(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}function IE(){const e=S.useContext(ju);if(e===null)return[!0,null];const{isPresent:t,onExitComplete:n,register:r}=e,s=S.useId();return S.useEffect(()=>r(s),[]),!t&&n?[!1,()=>n&&n(s)]:[!0]}const ec={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function Ry(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const ci={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(re.test(e))e=parseFloat(e);else return e;const n=Ry(e,t.target.x),r=Ry(e,t.target.y);return`${n}% ${r}%`}},FE={correct:(e,{treeScale:t,projectionDelta:n})=>{const r=e,s=Hr.parse(e);if(s.length>5)return r;const o=Hr.createTransformer(e),i=typeof s[0]!="number"?1:0,a=n.x.scale*t.x,l=n.y.scale*t.y;s[0+i]/=a,s[1+i]/=l;const u=Te(a,l,.5);return typeof s[2+i]=="number"&&(s[2+i]/=u),typeof s[3+i]=="number"&&(s[3+i]/=u),o(s)}};class zE extends z.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r,layoutId:s}=this.props,{projection:o}=t;GR(VE),o&&(n.group&&n.group.add(o),r&&r.register&&s&&r.register(o),o.root.didUpdate(),o.addEventListener("animationComplete",()=>{this.safeToRemove()}),o.setOptions({...o.options,onExitComplete:()=>this.safeToRemove()})),ec.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:r,drag:s,isPresent:o}=this.props,i=r.projection;return i&&(i.isPresent=o,s||t.layoutDependency!==n||n===void 0?i.willUpdate():this.safeToRemove(),t.isPresent!==o&&(o?i.promote():i.relegate()||Se.postRender(()=>{const a=i.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),queueMicrotask(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:s}=t;s&&(s.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(s),r&&r.deregister&&r.deregister(s))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function h2(e){const[t,n]=IE(),r=S.useContext(ug);return z.createElement(zE,{...e,layoutGroup:r,switchLayoutGroup:S.useContext(ak),isPresent:t,safeToRemove:n})}const VE={borderRadius:{...ci,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:ci,borderTopRightRadius:ci,borderBottomLeftRadius:ci,borderBottomRightRadius:ci,boxShadow:FE},f2=["TopLeft","TopRight","BottomLeft","BottomRight"],BE=f2.length,Ey=e=>typeof e=="string"?parseFloat(e):e,Ty=e=>typeof e=="number"||re.test(e);function $E(e,t,n,r,s,o){s?(e.opacity=Te(0,n.opacity!==void 0?n.opacity:1,HE(r)),e.opacityExit=Te(t.opacity!==void 0?t.opacity:1,0,UE(r))):o&&(e.opacity=Te(t.opacity!==void 0?t.opacity:1,n.opacity!==void 0?n.opacity:1,r));for(let i=0;irt?1:n(ga(e,t,r))}function My(e,t){e.min=t.min,e.max=t.max}function tn(e,t){My(e.x,t.x),My(e.y,t.y)}function Ly(e,t,n,r,s){return e-=t,e=Bc(e,1/n,r),s!==void 0&&(e=Bc(e,1/s,r)),e}function WE(e,t=0,n=1,r=.5,s,o=e,i=e){if(Dn.test(t)&&(t=parseFloat(t),t=Te(i.min,i.max,t/100)-i.min),typeof t!="number")return;let a=Te(o.min,o.max,r);e===o&&(a-=t),e.min=Ly(e.min,t,n,a,s),e.max=Ly(e.max,t,n,a,s)}function Oy(e,t,[n,r,s],o,i){WE(e,t[n],t[r],t[s],t.scale,o,i)}const GE=["x","scaleX","originX"],qE=["y","scaleY","originY"];function Dy(e,t,n,r){Oy(e.x,t,GE,n?n.x:void 0,r?r.x:void 0),Oy(e.y,t,qE,n?n.y:void 0,r?r.y:void 0)}function Iy(e){return e.translate===0&&e.scale===1}function g2(e){return Iy(e.x)&&Iy(e.y)}function KE(e,t){return e.x.min===t.x.min&&e.x.max===t.x.max&&e.y.min===t.y.min&&e.y.max===t.y.max}function m2(e,t){return Math.round(e.x.min)===Math.round(t.x.min)&&Math.round(e.x.max)===Math.round(t.x.max)&&Math.round(e.y.min)===Math.round(t.y.min)&&Math.round(e.y.max)===Math.round(t.y.max)}function Fy(e){return Kt(e.x)/Kt(e.y)}class YE{constructor(){this.members=[]}add(t){jg(this.members,t),t.scheduleRender()}remove(t){if(Cg(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){const n=this.members.findIndex(s=>t===s);if(n===0)return!1;let r;for(let s=n;s>=0;s--){const o=this.members[s];if(o.isPresent!==!1){r=o;break}}return r?(this.promote(r),!0):!1}promote(t,n){const r=this.lead;if(t!==r&&(this.prevLead=r,this.lead=t,t.show(),r)){r.instance&&r.scheduleRender(),t.scheduleRender(),t.resumeFrom=r,n&&(t.resumeFrom.preserveOpacity=!0),r.snapshot&&(t.snapshot=r.snapshot,t.snapshot.latestValues=r.animationValues||r.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:s}=t.options;s===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:n,resumingFrom:r}=t;n.onExitComplete&&n.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function zy(e,t,n){let r="";const s=e.x.translate/t.x,o=e.y.translate/t.y;if((s||o)&&(r=`translate3d(${s}px, ${o}px, 0) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){const{rotate:l,rotateX:u,rotateY:d}=n;l&&(r+=`rotate(${l}deg) `),u&&(r+=`rotateX(${u}deg) `),d&&(r+=`rotateY(${d}deg) `)}const i=e.x.scale*t.x,a=e.y.scale*t.y;return(i!==1||a!==1)&&(r+=`scale(${i}, ${a})`),r||"none"}const XE=(e,t)=>e.depth-t.depth;class QE{constructor(){this.children=[],this.isDirty=!1}add(t){jg(this.children,t),this.isDirty=!0}remove(t){Cg(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(XE),this.isDirty=!1,this.children.forEach(t)}}function JE(e,t){const n=performance.now(),r=({timestamp:s})=>{const o=s-n;o>=t&&(or(r),e(o-t))};return Se.read(r,!0),()=>or(r)}function ZE(e){window.MotionDebug&&window.MotionDebug.record(e)}function eT(e){return e instanceof SVGElement&&e.tagName!=="svg"}function tT(e,t,n){const r=Ft(e)?e:Ao(e);return r.start(_g("",r,t,n)),r.animation}const Vy=["","X","Y","Z"],nT={visibility:"hidden"},By=1e3;let rT=0;const us={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0};function y2({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:s}){return class{constructor(i={},a=t==null?void 0:t()){this.id=rT++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,us.totalNodes=us.resolvedTargetDeltas=us.recalculatedProjection=0,this.nodes.forEach(iT),this.nodes.forEach(dT),this.nodes.forEach(hT),this.nodes.forEach(aT),ZE(us)},this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=i,this.root=a?a.root||a:this,this.path=a?[...a.path,a]:[],this.parent=a,this.depth=a?a.depth+1:0;for(let l=0;lthis.root.updateBlockedByResize=!1;e(i,()=>{this.root.updateBlockedByResize=!0,h&&h(),h=JE(f,250),ec.hasAnimatedSinceResize&&(ec.hasAnimatedSinceResize=!1,this.nodes.forEach(Hy))})}l&&this.root.registerSharedNode(l,this),this.options.animate!==!1&&d&&(l||u)&&this.addEventListener("didUpdate",({delta:h,hasLayoutChanged:f,hasRelativeTargetChanged:p,layout:g})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const m=this.options.transition||d.getDefaultTransition()||yT,{onLayoutAnimationStart:y,onLayoutAnimationComplete:x}=d.getProps(),v=!this.targetLayout||!m2(this.targetLayout,g)||p,b=!f&&p;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||b||f&&(v||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(h,b);const k={...Sg(m,"layout"),onPlay:y,onComplete:x};(d.shouldReduceMotion||this.options.layoutRoot)&&(k.delay=0,k.type=!1),this.startAnimation(k)}else f||Hy(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=g})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const i=this.getStack();i&&i.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,or(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(fT),this.animationId++)}getTransformTemplate(){const{visualElement:i}=this.options;return i&&i.getProps().transformTemplate}willUpdate(i=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let d=0;dthis.update()))}clearAllSnapshots(){this.nodes.forEach(lT),this.sharedNodes.forEach(pT)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Se.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Se.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let l=0;l{const w=k/1e3;Uy(h.x,i.x,w),Uy(h.y,i.y,w),this.setTargetDelta(h),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Vi(f,this.layout.layoutBox,this.relativeParent.layout.layoutBox),gT(this.relativeTarget,this.relativeTargetOrigin,f,w),b&&KE(this.relativeTarget,b)&&(this.isProjectionDirty=!1),b||(b=Ve()),tn(b,this.relativeTarget)),m&&(this.animationValues=d,$E(d,u,this.latestValues,w,v,x)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=w},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(i){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(or(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Se.update(()=>{ec.hasAnimatedSinceResize=!0,this.currentAnimation=tT(0,By,{...i,onUpdate:a=>{this.mixTargetDelta(a),i.onUpdate&&i.onUpdate(a)},onComplete:()=>{i.onComplete&&i.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const i=this.getStack();i&&i.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(By),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const i=this.getLead();let{targetWithTransforms:a,target:l,layout:u,latestValues:d}=i;if(!(!a||!l||!u)){if(this!==i&&this.layout&&u&&x2(this.options.animationType,this.layout.layoutBox,u.layoutBox)){l=this.target||Ve();const h=Kt(this.layout.layoutBox.x);l.x.min=i.target.x.min,l.x.max=l.x.min+h;const f=Kt(this.layout.layoutBox.y);l.y.min=i.target.y.min,l.y.max=l.y.min+f}tn(a,l),ho(a,d),zi(this.projectionDeltaWithTransform,this.layoutCorrected,a,d)}}registerSharedNode(i,a){this.sharedNodes.has(i)||this.sharedNodes.set(i,new YE),this.sharedNodes.get(i).add(a);const u=a.options.initialPromotionConfig;a.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(a):void 0})}isLead(){const i=this.getStack();return i?i.lead===this:!0}getLead(){var i;const{layoutId:a}=this.options;return a?((i=this.getStack())===null||i===void 0?void 0:i.lead)||this:this}getPrevLead(){var i;const{layoutId:a}=this.options;return a?(i=this.getStack())===null||i===void 0?void 0:i.prevLead:void 0}getStack(){const{layoutId:i}=this.options;if(i)return this.root.sharedNodes.get(i)}promote({needsReset:i,transition:a,preserveFollowOpacity:l}={}){const u=this.getStack();u&&u.promote(this,l),i&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const i=this.getStack();return i?i.relegate(this):!1}resetRotation(){const{visualElement:i}=this.options;if(!i)return;let a=!1;const{latestValues:l}=i;if((l.rotate||l.rotateX||l.rotateY||l.rotateZ)&&(a=!0),!a)return;const u={};for(let d=0;d{var a;return(a=i.currentAnimation)===null||a===void 0?void 0:a.stop()}),this.root.nodes.forEach($y),this.root.sharedNodes.clear()}}}function sT(e){e.updateLayout()}function oT(e){var t;const n=((t=e.resumeFrom)===null||t===void 0?void 0:t.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&n&&e.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:s}=e.layout,{animationType:o}=e.options,i=n.source!==e.layout.source;o==="size"?rn(h=>{const f=i?n.measuredBox[h]:n.layoutBox[h],p=Kt(f);f.min=r[h].min,f.max=f.min+p}):x2(o,n.layoutBox,r)&&rn(h=>{const f=i?n.measuredBox[h]:n.layoutBox[h],p=Kt(r[h]);f.max=f.min+p,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[h].max=e.relativeTarget[h].min+p)});const a=uo();zi(a,r,n.layoutBox);const l=uo();i?zi(l,e.applyTransform(s,!0),n.measuredBox):zi(l,r,n.layoutBox);const u=!g2(a);let d=!1;if(!e.resumeFrom){const h=e.getClosestProjectingParent();if(h&&!h.resumeFrom){const{snapshot:f,layout:p}=h;if(f&&p){const g=Ve();Vi(g,n.layoutBox,f.layoutBox);const m=Ve();Vi(m,r,p.layoutBox),m2(g,m)||(d=!0),h.options.layoutRoot&&(e.relativeTarget=m,e.relativeTargetOrigin=g,e.relativeParent=h)}}}e.notifyListeners("didUpdate",{layout:r,snapshot:n,delta:l,layoutDelta:a,hasLayoutChanged:u,hasRelativeTargetChanged:d})}else if(e.isLead()){const{onExitComplete:r}=e.options;r&&r()}e.options.transition=void 0}function iT(e){us.totalNodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function aT(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function lT(e){e.clearSnapshot()}function $y(e){e.clearMeasurements()}function cT(e){e.isLayoutDirty=!1}function uT(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function Hy(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function dT(e){e.resolveTargetDelta()}function hT(e){e.calcProjection()}function fT(e){e.resetRotation()}function pT(e){e.removeLeadSnapshot()}function Uy(e,t,n){e.translate=Te(t.translate,0,n),e.scale=Te(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function Wy(e,t,n,r){e.min=Te(t.min,n.min,r),e.max=Te(t.max,n.max,r)}function gT(e,t,n,r){Wy(e.x,t.x,n.x,r),Wy(e.y,t.y,n.y,r)}function mT(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const yT={duration:.45,ease:[.4,0,.1,1]},Gy=e=>typeof navigator<"u"&&navigator.userAgent.toLowerCase().includes(e),qy=Gy("applewebkit/")&&!Gy("chrome/")?Math.round:Ie;function Ky(e){e.min=qy(e.min),e.max=qy(e.max)}function xT(e){Ky(e.x),Ky(e.y)}function x2(e,t,n){return e==="position"||e==="preserve-aspect"&&!kf(Fy(t),Fy(n),.2)}const bT=y2({attachResizeListener:(e,t)=>Yn(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),Dd={current:void 0},b2=y2({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!Dd.current){const e=new bT({});e.mount(window),e.setOptions({layoutScroll:!0}),Dd.current=e}return Dd.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),vT={pan:{Feature:DE},drag:{Feature:OE,ProjectionNode:b2,MeasureLayout:h2}},wT=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/;function kT(e){const t=wT.exec(e);if(!t)return[,];const[,n,r]=t;return[n,r]}function Cf(e,t,n=1){const[r,s]=kT(e);if(!r)return;const o=window.getComputedStyle(t).getPropertyValue(r);if(o){const i=o.trim();return t2(i)?parseFloat(i):i}else return gf(s)?Cf(s,t,n+1):s}function ST(e,{...t},n){const r=e.current;if(!(r instanceof Element))return{target:t,transitionEnd:n};n&&(n={...n}),e.values.forEach(s=>{const o=s.get();if(!gf(o))return;const i=Cf(o,r);i&&s.set(i)});for(const s in t){const o=t[s];if(!gf(o))continue;const i=Cf(o,r);i&&(t[s]=i,n||(n={}),n[s]===void 0&&(n[s]=o))}return{target:t,transitionEnd:n}}const _T=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),v2=e=>_T.has(e),jT=e=>Object.keys(e).some(v2),Yy=e=>e===zs||e===re,Xy=(e,t)=>parseFloat(e.split(", ")[t]),Qy=(e,t)=>(n,{transform:r})=>{if(r==="none"||!r)return 0;const s=r.match(/^matrix3d\((.+)\)$/);if(s)return Xy(s[1],t);{const o=r.match(/^matrix\((.+)\)$/);return o?Xy(o[1],e):0}},CT=new Set(["x","y","z"]),NT=Ia.filter(e=>!CT.has(e));function PT(e){const t=[];return NT.forEach(n=>{const r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),t.length&&e.render(),t}const Mo={width:({x:e},{paddingLeft:t="0",paddingRight:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t="0",paddingBottom:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:Qy(4,13),y:Qy(5,14)};Mo.translateX=Mo.x;Mo.translateY=Mo.y;const RT=(e,t,n)=>{const r=t.measureViewportBox(),s=t.current,o=getComputedStyle(s),{display:i}=o,a={};i==="none"&&t.setStaticValue("display",e.display||"block"),n.forEach(u=>{a[u]=Mo[u](r,o)}),t.render();const l=t.measureViewportBox();return n.forEach(u=>{const d=t.getValue(u);d&&d.jump(a[u]),e[u]=Mo[u](l,o)}),e},ET=(e,t,n={},r={})=>{t={...t},r={...r};const s=Object.keys(t).filter(v2);let o=[],i=!1;const a=[];if(s.forEach(l=>{const u=e.getValue(l);if(!e.hasValue(l))return;let d=n[l],h=li(d);const f=t[l];let p;if(Dc(f)){const g=f.length,m=f[0]===null?1:0;d=f[m],h=li(d);for(let y=m;y=0?window.pageYOffset:null,u=RT(t,e,a);return o.length&&o.forEach(([d,h])=>{e.getValue(d).set(h)}),e.render(),Cu&&l!==null&&window.scrollTo({top:l}),{target:u,transitionEnd:r}}else return{target:t,transitionEnd:r}};function TT(e,t,n,r){return jT(t)?ET(e,t,n,r):{target:t,transitionEnd:r}}const AT=(e,t,n,r)=>{const s=ST(e,t,r);return t=s.target,r=s.transitionEnd,TT(e,t,n,r)},Nf={current:null},w2={current:!1};function MT(){if(w2.current=!0,!!Cu)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>Nf.current=e.matches;e.addListener(t),t()}else Nf.current=!1}function LT(e,t,n){const{willChange:r}=t;for(const s in t){const o=t[s],i=n[s];if(Ft(o))e.addValue(s,o),Vc(r)&&r.add(s);else if(Ft(i))e.addValue(s,Ao(o,{owner:e})),Vc(r)&&r.remove(s);else if(i!==o)if(e.hasValue(s)){const a=e.getValue(s);!a.hasAnimated&&a.set(o)}else{const a=e.getStaticValue(s);e.addValue(s,Ao(a!==void 0?a:o,{owner:e}))}}for(const s in n)t[s]===void 0&&e.removeValue(s);return t}const Jy=new WeakMap,k2=Object.keys(pa),OT=k2.length,Zy=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],DT=cg.length;class IT{constructor({parent:t,props:n,presenceContext:r,reducedMotionConfig:s,visualState:o},i={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.scheduleRender=()=>Se.render(this.render,!1,!0);const{latestValues:a,renderState:l}=o;this.latestValues=a,this.baseTarget={...a},this.initialValues=n.initial?{...a}:{},this.renderState=l,this.parent=t,this.props=n,this.presenceContext=r,this.depth=t?t.depth+1:0,this.reducedMotionConfig=s,this.options=i,this.isControllingVariants=Pu(n),this.isVariantNode=ik(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:u,...d}=this.scrapeMotionValuesFromProps(n,{});for(const h in d){const f=d[h];a[h]!==void 0&&Ft(f)&&(f.set(a[h],!1),Vc(u)&&u.add(h))}}scrapeMotionValuesFromProps(t,n){return{}}mount(t){this.current=t,Jy.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((n,r)=>this.bindToMotionValue(r,n)),w2.current||MT(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:Nf.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){Jy.delete(this.current),this.projection&&this.projection.unmount(),or(this.notifyUpdate),or(this.render),this.valueSubscriptions.forEach(t=>t()),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const t in this.events)this.events[t].clear();for(const t in this.features)this.features[t].unmount();this.current=null}bindToMotionValue(t,n){const r=Fs.has(t),s=n.on("change",i=>{this.latestValues[t]=i,this.props.onUpdate&&Se.update(this.notifyUpdate,!1,!0),r&&this.projection&&(this.projection.isTransformDirty=!0)}),o=n.on("renderRequest",this.scheduleRender);this.valueSubscriptions.set(t,()=>{s(),o()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}loadFeatures({children:t,...n},r,s,o){let i,a;for(let l=0;lthis.scheduleRender(),animationType:typeof u=="string"?u:"both",initialPromotionConfig:o,layoutScroll:f,layoutRoot:p})}return a}updateFeatures(){for(const t in this.features){const n=this.features[t];n.isMounted?n.update():(n.mount(),n.isMounted=!0)}}triggerBuild(){this.build(this.renderState,this.latestValues,this.options,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Ve()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}makeTargetAnimatable(t,n=!0){return this.makeTargetAnimatableFromInstance(t,this.props,n)}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;rn.variantChildren.delete(t)}addValue(t,n){n!==this.values.get(t)&&(this.removeValue(t),this.bindToMotionValue(t,n)),this.values.set(t,n),this.latestValues[t]=n.get()}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){if(this.props.values&&this.props.values[t])return this.props.values[t];let r=this.values.get(t);return r===void 0&&n!==void 0&&(r=Ao(n,{owner:this}),this.addValue(t,r)),r}readValue(t){var n;return this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:(n=this.getBaseTargetFromProps(this.props,t))!==null&&n!==void 0?n:this.readValueFromInstance(this.current,t,this.options)}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){var n;const{initial:r}=this.props,s=typeof r=="string"||typeof r=="object"?(n=yg(this.props,r))===null||n===void 0?void 0:n[t]:void 0;if(r&&s!==void 0)return s;const o=this.getBaseTargetFromProps(this.props,t);return o!==void 0&&!Ft(o)?o:this.initialValues[t]!==void 0&&s===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new Ng),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}}class S2 extends IT{sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){return t.style?t.style[n]:void 0}removeValueFromRenderState(t,{vars:n,style:r}){delete n[t],delete r[t]}makeTargetAnimatableFromInstance({transition:t,transitionEnd:n,...r},{transformValues:s},o){let i=eE(r,t||{},this);if(s&&(n&&(n=s(n)),r&&(r=s(r)),i&&(i=s(i))),o){J3(this,r,i);const a=AT(this,r,i,n);n=a.transitionEnd,r=a.target}return{transition:t,transitionEnd:n,...r}}}function FT(e){return window.getComputedStyle(e)}class zT extends S2{constructor(){super(...arguments),this.type="html"}readValueFromInstance(t,n){if(Fs.has(n)){const r=kg(n);return r&&r.default||0}else{const r=FT(t),s=(uk(n)?r.getPropertyValue(n):r[n])||0;return typeof s=="string"?s.trim():s}}measureInstanceViewportBox(t,{transformPagePoint:n}){return u2(t,n)}build(t,n,r,s){hg(t,n,r,s.transformTemplate)}scrapeMotionValuesFromProps(t,n){return mg(t,n)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;Ft(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}renderInstance(t,n,r,s){mk(t,n,r,s)}}class VT extends S2{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(Fs.has(n)){const r=kg(n);return r&&r.default||0}return n=yk.has(n)?n:ag(n),t.getAttribute(n)}measureInstanceViewportBox(){return Ve()}scrapeMotionValuesFromProps(t,n){return bk(t,n)}build(t,n,r,s){pg(t,n,r,this.isSVGTag,s.transformTemplate)}renderInstance(t,n,r,s){xk(t,n,r,s)}mount(t){this.isSVGTag=gg(t.tagName),super.mount(t)}}const BT=(e,t)=>dg(e)?new VT(t,{enableHardwareAcceleration:!1}):new zT(t,{enableHardwareAcceleration:!0}),$T={layout:{ProjectionNode:b2,MeasureLayout:h2}},HT={...gE,...O4,...vT,...$T},Lo=UR((e,t)=>k4(e,t,HT,BT));function _2(){const e=S.useRef(!1);return ig(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function UT(){const e=_2(),[t,n]=S.useState(0),r=S.useCallback(()=>{e.current&&n(t+1)},[t]);return[S.useCallback(()=>Se.postRender(r),[r]),t]}class WT extends S.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(n&&t.isPresent&&!this.props.isPresent){const r=this.props.sizeRef.current;r.height=n.offsetHeight||0,r.width=n.offsetWidth||0,r.top=n.offsetTop,r.left=n.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function GT({children:e,isPresent:t}){const n=S.useId(),r=S.useRef(null),s=S.useRef({width:0,height:0,top:0,left:0});return S.useInsertionEffect(()=>{const{width:o,height:i,top:a,left:l}=s.current;if(t||!r.current||!o||!i)return;r.current.dataset.motionPopId=n;const u=document.createElement("style");return document.head.appendChild(u),u.sheet&&u.sheet.insertRule(` + */const LR=J("Zap",[["polygon",{points:"13 2 3 14 12 14 11 22 21 10 12 10 13 2",key:"45s27k"}]]);function ts({children:e}){const[t,n]=S.useState(!1),[r,s]=S.useState(!1),{user:o,logout:i}=Qr(),a=ar(),u=[...(o==null?void 0:o.account_type)==="Admin"?[{name:"Analytics",href:"/admin/analytics",icon:dR},{name:"Billing",href:"/admin/billing",icon:MR},{name:"Google Analytics",href:"/admin/google-analytics",icon:Z1},{name:"Website & Engagement Funnel",href:"/admin/engagement-insights",icon:Q1}]:[{name:"Dashboard",href:"/dashboard",icon:vR}],{name:"API Keys",href:"/keys",icon:J1},{name:"Account",href:"/account",icon:NR}],d=h=>a.pathname===h;return c.jsxs("div",{className:"min-h-screen bg-gray-50 dark:bg-black transition-colors duration-300",children:[c.jsxs("header",{className:"fixed top-0 z-40 w-full bg-white dark:bg-black border-b border-gray-200 dark:border-white/10 h-16 flex items-center justify-between px-4 sm:px-6 lg:px-8 transition-colors duration-300",children:[c.jsxs("div",{className:"flex items-center gap-4",children:[c.jsxs("button",{type:"button",className:"lg:hidden p-2 text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200",onClick:()=>n(!t),children:[c.jsx("span",{className:"sr-only",children:"Open sidebar"}),t?c.jsx(Su,{size:24}):c.jsx(ek,{size:24})]}),c.jsxs("div",{className:"flex items-center gap-2 font-bold text-xl ",children:[c.jsx("img",{src:"/logo.png",className:"w-8 h-8 object-cover",alt:""}),c.jsx("span",{children:"Sunbird AI"})]})]}),c.jsx("div",{className:"flex items-center gap-4",children:c.jsxs("div",{className:"flex items-center gap-3 pl-4 border-gray-200 dark:border-white/10",children:[c.jsxs("div",{className:"hidden md:block text-right",children:[c.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-white",children:(o==null?void 0:o.username)||"User"}),c.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:(o==null?void 0:o.organization)||"Organization"})]}),c.jsx("div",{className:"h-8 w-8 rounded-full bg-primary-100 dark:bg-primary-900/50 flex items-center justify-center text-primary-700 dark:text-primary-400 border border-primary-200 dark:border-primary-800",children:c.jsx(Ao,{size:18})})]})})]}),c.jsxs("article",{children:[c.jsx("aside",{className:`fixed top-16 left-0 z-50 h-[calc(100vh-4rem)] bg-white dark:bg-black border-r border-gray-200 dark:border-white/10 transition-all duration-300 lg:translate-x-0 ${t?"translate-x-0":"-translate-x-full"} ${r?"w-16":"w-64"}`,children:c.jsxs("nav",{className:"h-full flex flex-col justify-between p-2",children:[c.jsx("div",{className:"space-y-1",children:u.map(h=>c.jsxs("div",{className:"relative group",children:[c.jsxs(Ee,{to:h.href,className:`flex items-center gap-3 px-3 py-2 rounded-md text-sm font-medium transition-colors ${d(h.href)?"bg-primary-50 text-primary-600 dark:bg-primary-900/20 dark:text-primary-400":"text-gray-700 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-white/5"} ${r?"justify-center":""}`,onClick:()=>n(!1),children:[c.jsx(h.icon,{size:20,className:"flex-shrink-0"}),!r&&c.jsx("span",{children:h.name})]}),r&&c.jsxs("div",{className:"absolute left-full ml-2 top-1/2 -translate-y-1/2 px-2 py-1 bg-gray-900 dark:bg-white text-white dark:text-black text-xs rounded opacity-0 invisible group-hover:opacity-100 group-hover:visible transition-all duration-200 whitespace-nowrap z-50 pointer-events-none",children:[h.name,c.jsx("div",{className:"absolute right-full top-1/2 -translate-y-1/2 border-4 border-transparent border-r-gray-900 dark:border-r-white"})]})]},h.name))}),c.jsxs("div",{className:"space-y-1 pt-4 border-t border-gray-200 dark:border-white/10",children:[c.jsxs("div",{className:"relative group",children:[c.jsxs("a",{href:"https://docs.sunbird.ai",target:"_blank",rel:"noopener noreferrer",className:`flex items-center gap-3 px-3 py-2 rounded-md text-sm font-medium text-gray-700 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-white/5 transition-colors ${r?"justify-center":""}`,children:[c.jsx(Mc,{size:20,className:"flex-shrink-0"}),!r&&c.jsx("span",{children:"Documentation"})]}),r&&c.jsxs("div",{className:"absolute left-full ml-2 top-1/2 -translate-y-1/2 px-2 py-1 bg-gray-900 dark:bg-white dark:text-black text-white text-xs rounded opacity-0 invisible group-hover:opacity-100 group-hover:visible transition-all duration-200 whitespace-nowrap z-50 pointer-events-none",children:["Documentation",c.jsx("div",{className:"absolute right-full top-1/2 -translate-y-1/2 border-4 border-transparent border-r-gray-900 dark:border-r-white"})]})]}),c.jsxs("div",{className:"relative group",children:[c.jsxs("button",{onClick:i,className:`w-full flex items-center gap-3 px-3 py-2 rounded-md text-sm font-medium text-red-600 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-900/20 transition-colors ${r?"justify-center":""}`,children:[c.jsx(kR,{size:20,className:"flex-shrink-0"}),!r&&c.jsx("span",{children:"Sign Out"})]}),r&&c.jsxs("div",{className:"absolute left-full ml-2 top-1/2 -translate-y-1/2 px-2 py-1 bg-gray-900 dark:bg-white dark:text-black text-white text-xs rounded opacity-0 invisible group-hover:opacity-100 group-hover:visible transition-all duration-200 whitespace-nowrap z-50 pointer-events-none",children:["Sign Out",c.jsx("div",{className:"absolute right-full top-1/2 -translate-y-1/2 border-4 border-transparent border-r-gray-900 dark:border-r-white"})]})]}),c.jsxs("div",{className:"relative group",children:[c.jsx("button",{onClick:()=>s(!r),className:`hidden lg:flex w-full items-center gap-3 px-3 py-2 rounded-md text-sm font-medium text-gray-700 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-white/5 transition-colors mt-2 ${r?"justify-center":""}`,children:r?c.jsx(q1,{size:20,className:"flex-shrink-0"}):c.jsxs(c.Fragment,{children:[c.jsx(K1,{size:20,className:"flex-shrink-0"}),c.jsx("span",{children:"Collapse"})]})}),r&&c.jsxs("div",{className:"absolute left-full ml-2 top-1/2 -translate-y-1/2 px-2 py-1 bg-gray-900 dark:bg-white dark:text-black text-white text-xs rounded opacity-0 invisible group-hover:opacity-100 group-hover:visible transition-all duration-200 whitespace-nowrap z-50 pointer-events-none",children:["Expand",c.jsx("div",{className:"absolute right-full top-1/2 -translate-y-1/2 border-4 border-transparent border-r-gray-900 dark:border-r-white"})]})]})]})]})}),c.jsxs("main",{className:`pt-16 pb-24 min-h-screen transition-all duration-300 ${r?"lg:pl-20":"lg:pl-64"}`,children:[c.jsx("div",{className:"p-4 sm:p-6 lg:p-8 max-w-7xl mx-auto",children:e}),c.jsx("footer",{className:`border-t border-gray-200 dark:border-white/10 py-6 text-center text-sm text-gray-500 dark:text-gray-400 fixed bottom-0 left-0 right-0 z-40 bg-gray-50 dark:bg-black ${r?"lg:ml-20":"lg:ml-64"}`,children:c.jsxs("p",{children:["© ",new Date().getFullYear()," Sunbird AI. All rights reserved."]})})]})]}),t&&c.jsx("div",{className:"fixed inset-0 bg-black/50 z-20 lg:hidden",onClick:()=>n(!1)})]})}const rk=S.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"}),_u=S.createContext({}),ju=S.createContext(null),Cu=typeof document<"u",ig=Cu?S.useLayoutEffect:S.useEffect,sk=S.createContext({strict:!1}),ag=e=>e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),OR="framerAppearId",ok="data-"+ag(OR);function DR(e,t,n,r){const{visualElement:s}=S.useContext(_u),o=S.useContext(sk),i=S.useContext(ju),a=S.useContext(rk).reducedMotion,l=S.useRef();r=r||o.renderer,!l.current&&r&&(l.current=r(e,{visualState:t,parent:s,props:n,presenceContext:i,blockInitialAnimation:i?i.initial===!1:!1,reducedMotionConfig:a}));const u=l.current;S.useInsertionEffect(()=>{u&&u.update(n,i)});const d=S.useRef(!!(n[ok]&&!window.HandoffComplete));return ig(()=>{u&&(u.render(),d.current&&u.animationState&&u.animationState.animateChanges())}),S.useEffect(()=>{u&&(u.updateFeatures(),!d.current&&u.animationState&&u.animationState.animateChanges(),d.current&&(d.current=!1,window.HandoffComplete=!0))}),u}function co(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function IR(e,t,n){return S.useCallback(r=>{r&&e.mount&&e.mount(r),t&&(r?t.mount(r):t.unmount()),n&&(typeof n=="function"?n(r):co(n)&&(n.current=r))},[t])}function fa(e){return typeof e=="string"||Array.isArray(e)}function Nu(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}const lg=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],cg=["initial",...lg];function Pu(e){return Nu(e.animate)||cg.some(t=>fa(e[t]))}function ik(e){return!!(Pu(e)||e.variants)}function FR(e,t){if(Pu(e)){const{initial:n,animate:r}=e;return{initial:n===!1||fa(n)?n:void 0,animate:fa(r)?r:void 0}}return e.inherit!==!1?t:{}}function zR(e){const{initial:t,animate:n}=FR(e,S.useContext(_u));return S.useMemo(()=>({initial:t,animate:n}),[Q0(t),Q0(n)])}function Q0(e){return Array.isArray(e)?e.join(" "):e}const J0={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},pa={};for(const e in J0)pa[e]={isEnabled:t=>J0[e].some(n=>!!t[n])};function VR(e){for(const t in e)pa[t]={...pa[t],...e[t]}}const ug=S.createContext({}),ak=S.createContext({}),BR=Symbol.for("motionComponentSymbol");function $R({preloadedFeatures:e,createVisualElement:t,useRender:n,useVisualState:r,Component:s}){e&&VR(e);function o(a,l){let u;const d={...S.useContext(rk),...a,layoutId:HR(a)},{isStatic:h}=d,f=zR(a),p=r(a,h);if(!h&&Cu){f.visualElement=DR(s,p,d,t);const g=S.useContext(ak),m=S.useContext(sk).strict;f.visualElement&&(u=f.visualElement.loadFeatures(d,m,e,g))}return S.createElement(_u.Provider,{value:f},u&&f.visualElement?S.createElement(u,{visualElement:f.visualElement,...d}):null,n(s,a,IR(p,f.visualElement,l),p,h,f.visualElement))}const i=S.forwardRef(o);return i[BR]=s,i}function HR({layoutId:e}){const t=S.useContext(ug).id;return t&&e!==void 0?t+"-"+e:e}function UR(e){function t(r,s={}){return $R(e(r,s))}if(typeof Proxy>"u")return t;const n=new Map;return new Proxy(t,{get:(r,s)=>(n.has(s)||n.set(s,t(s)),n.get(s))})}const WR=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function dg(e){return typeof e!="string"||e.includes("-")?!1:!!(WR.indexOf(e)>-1||/[A-Z]/.test(e))}const Lc={};function GR(e){Object.assign(Lc,e)}const Ia=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Fs=new Set(Ia);function lk(e,{layout:t,layoutId:n}){return Fs.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!Lc[e]||e==="opacity")}const Ft=e=>!!(e&&e.getVelocity),KR={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},qR=Ia.length;function YR(e,{enableHardwareAcceleration:t=!0,allowTransformNone:n=!0},r,s){let o="";for(let i=0;it=>typeof t=="string"&&t.startsWith(e),uk=ck("--"),gf=ck("var(--"),XR=/var\s*\(\s*--[\w-]+(\s*,\s*(?:(?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)+)?\s*\)/g,QR=(e,t)=>t&&typeof e=="number"?t.transform(e):e,$r=(e,t,n)=>Math.min(Math.max(n,e),t),zs={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},Ii={...zs,transform:e=>$r(0,1,e)},hl={...zs,default:1},Fi=e=>Math.round(e*1e5)/1e5,Ru=/(-)?([\d]*\.?[\d])+/g,dk=/(#[0-9a-f]{3,8}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))/gi,JR=/^(#[0-9a-f]{3,8}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))$/i;function Fa(e){return typeof e=="string"}const za=e=>({test:t=>Fa(t)&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),pr=za("deg"),Dn=za("%"),re=za("px"),ZR=za("vh"),e4=za("vw"),Z0={...Dn,parse:e=>Dn.parse(e)/100,transform:e=>Dn.transform(e*100)},ey={...zs,transform:Math.round},hk={borderWidth:re,borderTopWidth:re,borderRightWidth:re,borderBottomWidth:re,borderLeftWidth:re,borderRadius:re,radius:re,borderTopLeftRadius:re,borderTopRightRadius:re,borderBottomRightRadius:re,borderBottomLeftRadius:re,width:re,maxWidth:re,height:re,maxHeight:re,size:re,top:re,right:re,bottom:re,left:re,padding:re,paddingTop:re,paddingRight:re,paddingBottom:re,paddingLeft:re,margin:re,marginTop:re,marginRight:re,marginBottom:re,marginLeft:re,rotate:pr,rotateX:pr,rotateY:pr,rotateZ:pr,scale:hl,scaleX:hl,scaleY:hl,scaleZ:hl,skew:pr,skewX:pr,skewY:pr,distance:re,translateX:re,translateY:re,translateZ:re,x:re,y:re,z:re,perspective:re,transformPerspective:re,opacity:Ii,originX:Z0,originY:Z0,originZ:re,zIndex:ey,fillOpacity:Ii,strokeOpacity:Ii,numOctaves:ey};function hg(e,t,n,r){const{style:s,vars:o,transform:i,transformOrigin:a}=e;let l=!1,u=!1,d=!0;for(const h in t){const f=t[h];if(uk(h)){o[h]=f;continue}const p=hk[h],g=QR(f,p);if(Fs.has(h)){if(l=!0,i[h]=g,!d)continue;f!==(p.default||0)&&(d=!1)}else h.startsWith("origin")?(u=!0,a[h]=g):s[h]=g}if(t.transform||(l||r?s.transform=YR(e.transform,n,d,r):s.transform&&(s.transform="none")),u){const{originX:h="50%",originY:f="50%",originZ:p=0}=a;s.transformOrigin=`${h} ${f} ${p}`}}const fg=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function fk(e,t,n){for(const r in t)!Ft(t[r])&&!lk(r,n)&&(e[r]=t[r])}function t4({transformTemplate:e},t,n){return S.useMemo(()=>{const r=fg();return hg(r,t,{enableHardwareAcceleration:!n},e),Object.assign({},r.vars,r.style)},[t])}function n4(e,t,n){const r=e.style||{},s={};return fk(s,r,e),Object.assign(s,t4(e,t,n)),e.transformValues?e.transformValues(s):s}function r4(e,t,n){const r={},s=n4(e,t,n);return e.drag&&e.dragListener!==!1&&(r.draggable=!1,s.userSelect=s.WebkitUserSelect=s.WebkitTouchCallout="none",s.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(r.tabIndex=0),r.style=s,r}const s4=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","transformValues","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function Oc(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||s4.has(e)}let pk=e=>!Oc(e);function o4(e){e&&(pk=t=>t.startsWith("on")?!Oc(t):e(t))}try{o4(require("@emotion/is-prop-valid").default)}catch{}function i4(e,t,n){const r={};for(const s in e)s==="values"&&typeof e.values=="object"||(pk(s)||n===!0&&Oc(s)||!t&&!Oc(s)||e.draggable&&s.startsWith("onDrag"))&&(r[s]=e[s]);return r}function ty(e,t,n){return typeof e=="string"?e:re.transform(t+n*e)}function a4(e,t,n){const r=ty(t,e.x,e.width),s=ty(n,e.y,e.height);return`${r} ${s}`}const l4={offset:"stroke-dashoffset",array:"stroke-dasharray"},c4={offset:"strokeDashoffset",array:"strokeDasharray"};function u4(e,t,n=1,r=0,s=!0){e.pathLength=1;const o=s?l4:c4;e[o.offset]=re.transform(-r);const i=re.transform(t),a=re.transform(n);e[o.array]=`${i} ${a}`}function pg(e,{attrX:t,attrY:n,attrScale:r,originX:s,originY:o,pathLength:i,pathSpacing:a=1,pathOffset:l=0,...u},d,h,f){if(hg(e,u,d,f),h){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:p,style:g,dimensions:m}=e;p.transform&&(m&&(g.transform=p.transform),delete p.transform),m&&(s!==void 0||o!==void 0||g.transform)&&(g.transformOrigin=a4(m,s!==void 0?s:.5,o!==void 0?o:.5)),t!==void 0&&(p.x=t),n!==void 0&&(p.y=n),r!==void 0&&(p.scale=r),i!==void 0&&u4(p,i,a,l,!1)}const gk=()=>({...fg(),attrs:{}}),gg=e=>typeof e=="string"&&e.toLowerCase()==="svg";function d4(e,t,n,r){const s=S.useMemo(()=>{const o=gk();return pg(o,t,{enableHardwareAcceleration:!1},gg(r),e.transformTemplate),{...o.attrs,style:{...o.style}}},[t]);if(e.style){const o={};fk(o,e.style,e),s.style={...o,...s.style}}return s}function h4(e=!1){return(n,r,s,{latestValues:o},i)=>{const l=(dg(n)?d4:r4)(r,o,i,n),d={...i4(r,typeof n=="string",e),...l,ref:s},{children:h}=r,f=S.useMemo(()=>Ft(h)?h.get():h,[h]);return S.createElement(n,{...d,children:f})}}function mk(e,{style:t,vars:n},r,s){Object.assign(e.style,t,s&&s.getProjectionStyles(r));for(const o in n)e.style.setProperty(o,n[o])}const yk=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function xk(e,t,n,r){mk(e,t,void 0,r);for(const s in t.attrs)e.setAttribute(yk.has(s)?s:ag(s),t.attrs[s])}function mg(e,t){const{style:n}=e,r={};for(const s in n)(Ft(n[s])||t.style&&Ft(t.style[s])||lk(s,e))&&(r[s]=n[s]);return r}function bk(e,t){const n=mg(e,t);for(const r in e)if(Ft(e[r])||Ft(t[r])){const s=Ia.indexOf(r)!==-1?"attr"+r.charAt(0).toUpperCase()+r.substring(1):r;n[s]=e[r]}return n}function yg(e,t,n,r={},s={}){return typeof t=="function"&&(t=t(n!==void 0?n:e.custom,r,s)),typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"&&(t=t(n!==void 0?n:e.custom,r,s)),t}function vk(e){const t=S.useRef(null);return t.current===null&&(t.current=e()),t.current}const Dc=e=>Array.isArray(e),f4=e=>!!(e&&typeof e=="object"&&e.mix&&e.toValue),p4=e=>Dc(e)?e[e.length-1]||0:e;function Zl(e){const t=Ft(e)?e.get():e;return f4(t)?t.toValue():t}function g4({scrapeMotionValuesFromProps:e,createRenderState:t,onMount:n},r,s,o){const i={latestValues:m4(r,s,o,e),renderState:t()};return n&&(i.mount=a=>n(r,a,i)),i}const wk=e=>(t,n)=>{const r=S.useContext(_u),s=S.useContext(ju),o=()=>g4(e,t,r,s);return n?o():vk(o)};function m4(e,t,n,r){const s={},o=r(e,{});for(const f in o)s[f]=Zl(o[f]);let{initial:i,animate:a}=e;const l=Pu(e),u=ik(e);t&&u&&!l&&e.inherit!==!1&&(i===void 0&&(i=t.initial),a===void 0&&(a=t.animate));let d=n?n.initial===!1:!1;d=d||i===!1;const h=d?a:i;return h&&typeof h!="boolean"&&!Nu(h)&&(Array.isArray(h)?h:[h]).forEach(p=>{const g=yg(e,p);if(!g)return;const{transitionEnd:m,transition:y,...x}=g;for(const v in x){let b=x[v];if(Array.isArray(b)){const k=d?b.length-1:0;b=b[k]}b!==null&&(s[v]=b)}for(const v in m)s[v]=m[v]}),s}const Ie=e=>e;class ny{constructor(){this.order=[],this.scheduled=new Set}add(t){if(!this.scheduled.has(t))return this.scheduled.add(t),this.order.push(t),!0}remove(t){const n=this.order.indexOf(t);n!==-1&&(this.order.splice(n,1),this.scheduled.delete(t))}clear(){this.order.length=0,this.scheduled.clear()}}function y4(e){let t=new ny,n=new ny,r=0,s=!1,o=!1;const i=new WeakSet,a={schedule:(l,u=!1,d=!1)=>{const h=d&&s,f=h?t:n;return u&&i.add(l),f.add(l)&&h&&s&&(r=t.order.length),l},cancel:l=>{n.remove(l),i.delete(l)},process:l=>{if(s){o=!0;return}if(s=!0,[t,n]=[n,t],n.clear(),r=t.order.length,r)for(let u=0;u(h[f]=y4(()=>n=!0),h),{}),i=h=>o[h].process(s),a=()=>{const h=performance.now();n=!1,s.delta=r?1e3/60:Math.max(Math.min(h-s.timestamp,x4),1),s.timestamp=h,s.isProcessing=!0,fl.forEach(i),s.isProcessing=!1,n&&t&&(r=!1,e(a))},l=()=>{n=!0,r=!0,s.isProcessing||e(a)};return{schedule:fl.reduce((h,f)=>{const p=o[f];return h[f]=(g,m=!1,y=!1)=>(n||l(),p.schedule(g,m,y)),h},{}),cancel:h=>fl.forEach(f=>o[f].cancel(h)),state:s,steps:o}}const{schedule:Se,cancel:or,state:ft,steps:jd}=b4(typeof requestAnimationFrame<"u"?requestAnimationFrame:Ie,!0),v4={useVisualState:wk({scrapeMotionValuesFromProps:bk,createRenderState:gk,onMount:(e,t,{renderState:n,latestValues:r})=>{Se.read(()=>{try{n.dimensions=typeof t.getBBox=="function"?t.getBBox():t.getBoundingClientRect()}catch{n.dimensions={x:0,y:0,width:0,height:0}}}),Se.render(()=>{pg(n,r,{enableHardwareAcceleration:!1},gg(t.tagName),e.transformTemplate),xk(t,n)})}})},w4={useVisualState:wk({scrapeMotionValuesFromProps:mg,createRenderState:fg})};function k4(e,{forwardMotionProps:t=!1},n,r){return{...dg(e)?v4:w4,preloadedFeatures:n,useRender:h4(t),createVisualElement:r,Component:e}}function Yn(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}const kk=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1;function Eu(e,t="page"){return{point:{x:e[t+"X"],y:e[t+"Y"]}}}const S4=e=>t=>kk(t)&&e(t,Eu(t));function Zn(e,t,n,r){return Yn(e,t,S4(n),r)}const _4=(e,t)=>n=>t(e(n)),Fr=(...e)=>e.reduce(_4);function Sk(e){let t=null;return()=>{const n=()=>{t=null};return t===null?(t=e,n):!1}}const ry=Sk("dragHorizontal"),sy=Sk("dragVertical");function _k(e){let t=!1;if(e==="y")t=sy();else if(e==="x")t=ry();else{const n=ry(),r=sy();n&&r?t=()=>{n(),r()}:(n&&n(),r&&r())}return t}function jk(){const e=_k(!0);return e?(e(),!1):!0}class Jr{constructor(t){this.isMounted=!1,this.node=t}update(){}}function oy(e,t){const n="pointer"+(t?"enter":"leave"),r="onHover"+(t?"Start":"End"),s=(o,i)=>{if(o.pointerType==="touch"||jk())return;const a=e.getProps();e.animationState&&a.whileHover&&e.animationState.setActive("whileHover",t),a[r]&&Se.update(()=>a[r](o,i))};return Zn(e.current,n,s,{passive:!e.getProps()[r]})}class j4 extends Jr{mount(){this.unmount=Fr(oy(this.node,!0),oy(this.node,!1))}unmount(){}}class C4 extends Jr{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Fr(Yn(this.node.current,"focus",()=>this.onFocus()),Yn(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const Ck=(e,t)=>t?e===t?!0:Ck(e,t.parentElement):!1;function Cd(e,t){if(!t)return;const n=new PointerEvent("pointer"+e);t(n,Eu(n))}class N4 extends Jr{constructor(){super(...arguments),this.removeStartListeners=Ie,this.removeEndListeners=Ie,this.removeAccessibleListeners=Ie,this.startPointerPress=(t,n)=>{if(this.isPressing)return;this.removeEndListeners();const r=this.node.getProps(),o=Zn(window,"pointerup",(a,l)=>{if(!this.checkPressEnd())return;const{onTap:u,onTapCancel:d,globalTapTarget:h}=this.node.getProps();Se.update(()=>{!h&&!Ck(this.node.current,a.target)?d&&d(a,l):u&&u(a,l)})},{passive:!(r.onTap||r.onPointerUp)}),i=Zn(window,"pointercancel",(a,l)=>this.cancelPress(a,l),{passive:!(r.onTapCancel||r.onPointerCancel)});this.removeEndListeners=Fr(o,i),this.startPress(t,n)},this.startAccessiblePress=()=>{const t=o=>{if(o.key!=="Enter"||this.isPressing)return;const i=a=>{a.key!=="Enter"||!this.checkPressEnd()||Cd("up",(l,u)=>{const{onTap:d}=this.node.getProps();d&&Se.update(()=>d(l,u))})};this.removeEndListeners(),this.removeEndListeners=Yn(this.node.current,"keyup",i),Cd("down",(a,l)=>{this.startPress(a,l)})},n=Yn(this.node.current,"keydown",t),r=()=>{this.isPressing&&Cd("cancel",(o,i)=>this.cancelPress(o,i))},s=Yn(this.node.current,"blur",r);this.removeAccessibleListeners=Fr(n,s)}}startPress(t,n){this.isPressing=!0;const{onTapStart:r,whileTap:s}=this.node.getProps();s&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),r&&Se.update(()=>r(t,n))}checkPressEnd(){return this.removeEndListeners(),this.isPressing=!1,this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!jk()}cancelPress(t,n){if(!this.checkPressEnd())return;const{onTapCancel:r}=this.node.getProps();r&&Se.update(()=>r(t,n))}mount(){const t=this.node.getProps(),n=Zn(t.globalTapTarget?window:this.node.current,"pointerdown",this.startPointerPress,{passive:!(t.onTapStart||t.onPointerStart)}),r=Yn(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=Fr(n,r)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}const mf=new WeakMap,Nd=new WeakMap,P4=e=>{const t=mf.get(e.target);t&&t(e)},R4=e=>{e.forEach(P4)};function E4({root:e,...t}){const n=e||document;Nd.has(n)||Nd.set(n,{});const r=Nd.get(n),s=JSON.stringify(t);return r[s]||(r[s]=new IntersectionObserver(R4,{root:e,...t})),r[s]}function T4(e,t,n){const r=E4(t);return mf.set(e,n),r.observe(e),()=>{mf.delete(e),r.unobserve(e)}}const A4={some:0,all:1};class M4 extends Jr{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:n,margin:r,amount:s="some",once:o}=t,i={root:n?n.current:void 0,rootMargin:r,threshold:typeof s=="number"?s:A4[s]},a=l=>{const{isIntersecting:u}=l;if(this.isInView===u||(this.isInView=u,o&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);const{onViewportEnter:d,onViewportLeave:h}=this.node.getProps(),f=u?d:h;f&&f(l)};return T4(this.node.current,i,a)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(L4(t,n))&&this.startObserver()}unmount(){}}function L4({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const O4={inView:{Feature:M4},tap:{Feature:N4},focus:{Feature:C4},hover:{Feature:j4}};function Nk(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let r=0;rt[r]=n.get()),t}function I4(e){const t={};return e.values.forEach((n,r)=>t[r]=n.getVelocity()),t}function Tu(e,t,n){const r=e.getProps();return yg(r,t,n!==void 0?n:r.custom,D4(e),I4(e))}let xg=Ie;const _s=e=>e*1e3,er=e=>e/1e3,F4={current:!1},Pk=e=>Array.isArray(e)&&typeof e[0]=="number";function Rk(e){return!!(!e||typeof e=="string"&&Ek[e]||Pk(e)||Array.isArray(e)&&e.every(Rk))}const ki=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,Ek={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:ki([0,.65,.55,1]),circOut:ki([.55,0,1,.45]),backIn:ki([.31,.01,.66,-.59]),backOut:ki([.33,1.53,.69,.99])};function Tk(e){if(e)return Pk(e)?ki(e):Array.isArray(e)?e.map(Tk):Ek[e]}function z4(e,t,n,{delay:r=0,duration:s,repeat:o=0,repeatType:i="loop",ease:a,times:l}={}){const u={[t]:n};l&&(u.offset=l);const d=Tk(a);return Array.isArray(d)&&(u.easing=d),e.animate(u,{delay:r,duration:s,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:o+1,direction:i==="reverse"?"alternate":"normal"})}function V4(e,{repeat:t,repeatType:n="loop"}){const r=t&&n!=="loop"&&t%2===1?0:e.length-1;return e[r]}const Ak=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,B4=1e-7,$4=12;function H4(e,t,n,r,s){let o,i,a=0;do i=t+(n-t)/2,o=Ak(i,r,s)-e,o>0?n=i:t=i;while(Math.abs(o)>B4&&++a<$4);return i}function Va(e,t,n,r){if(e===t&&n===r)return Ie;const s=o=>H4(o,0,1,e,n);return o=>o===0||o===1?o:Ak(s(o),t,r)}const U4=Va(.42,0,1,1),W4=Va(0,0,.58,1),Mk=Va(.42,0,.58,1),G4=e=>Array.isArray(e)&&typeof e[0]!="number",Lk=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,Ok=e=>t=>1-e(1-t),bg=e=>1-Math.sin(Math.acos(e)),Dk=Ok(bg),K4=Lk(bg),Ik=Va(.33,1.53,.69,.99),vg=Ok(Ik),q4=Lk(vg),Y4=e=>(e*=2)<1?.5*vg(e):.5*(2-Math.pow(2,-10*(e-1))),X4={linear:Ie,easeIn:U4,easeInOut:Mk,easeOut:W4,circIn:bg,circInOut:K4,circOut:Dk,backIn:vg,backInOut:q4,backOut:Ik,anticipate:Y4},iy=e=>{if(Array.isArray(e)){xg(e.length===4);const[t,n,r,s]=e;return Va(t,n,r,s)}else if(typeof e=="string")return X4[e];return e},wg=(e,t)=>n=>!!(Fa(n)&&JR.test(n)&&n.startsWith(e)||t&&Object.prototype.hasOwnProperty.call(n,t)),Fk=(e,t,n)=>r=>{if(!Fa(r))return r;const[s,o,i,a]=r.match(Ru);return{[e]:parseFloat(s),[t]:parseFloat(o),[n]:parseFloat(i),alpha:a!==void 0?parseFloat(a):1}},Q4=e=>$r(0,255,e),Pd={...zs,transform:e=>Math.round(Q4(e))},xs={test:wg("rgb","red"),parse:Fk("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+Pd.transform(e)+", "+Pd.transform(t)+", "+Pd.transform(n)+", "+Fi(Ii.transform(r))+")"};function J4(e){let t="",n="",r="",s="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),s=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),s=e.substring(4,5),t+=t,n+=n,r+=r,s+=s),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:s?parseInt(s,16)/255:1}}const yf={test:wg("#"),parse:J4,transform:xs.transform},uo={test:wg("hsl","hue"),parse:Fk("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+Dn.transform(Fi(t))+", "+Dn.transform(Fi(n))+", "+Fi(Ii.transform(r))+")"},wt={test:e=>xs.test(e)||yf.test(e)||uo.test(e),parse:e=>xs.test(e)?xs.parse(e):uo.test(e)?uo.parse(e):yf.parse(e),transform:e=>Fa(e)?e:e.hasOwnProperty("red")?xs.transform(e):uo.transform(e)},Te=(e,t,n)=>-n*e+n*t+e;function Rd(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function Z4({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let s=0,o=0,i=0;if(!t)s=o=i=n;else{const a=n<.5?n*(1+t):n+t-n*t,l=2*n-a;s=Rd(l,a,e+1/3),o=Rd(l,a,e),i=Rd(l,a,e-1/3)}return{red:Math.round(s*255),green:Math.round(o*255),blue:Math.round(i*255),alpha:r}}const Ed=(e,t,n)=>{const r=e*e;return Math.sqrt(Math.max(0,n*(t*t-r)+r))},eE=[yf,xs,uo],tE=e=>eE.find(t=>t.test(e));function ay(e){const t=tE(e);let n=t.parse(e);return t===uo&&(n=Z4(n)),n}const zk=(e,t)=>{const n=ay(e),r=ay(t),s={...n};return o=>(s.red=Ed(n.red,r.red,o),s.green=Ed(n.green,r.green,o),s.blue=Ed(n.blue,r.blue,o),s.alpha=Te(n.alpha,r.alpha,o),xs.transform(s))};function nE(e){var t,n;return isNaN(e)&&Fa(e)&&(((t=e.match(Ru))===null||t===void 0?void 0:t.length)||0)+(((n=e.match(dk))===null||n===void 0?void 0:n.length)||0)>0}const Vk={regex:XR,countKey:"Vars",token:"${v}",parse:Ie},Bk={regex:dk,countKey:"Colors",token:"${c}",parse:wt.parse},$k={regex:Ru,countKey:"Numbers",token:"${n}",parse:zs.parse};function Td(e,{regex:t,countKey:n,token:r,parse:s}){const o=e.tokenised.match(t);o&&(e["num"+n]=o.length,e.tokenised=e.tokenised.replace(t,r),e.values.push(...o.map(s)))}function Ic(e){const t=e.toString(),n={value:t,tokenised:t,values:[],numVars:0,numColors:0,numNumbers:0};return n.value.includes("var(--")&&Td(n,Vk),Td(n,Bk),Td(n,$k),n}function Hk(e){return Ic(e).values}function Uk(e){const{values:t,numColors:n,numVars:r,tokenised:s}=Ic(e),o=t.length;return i=>{let a=s;for(let l=0;ltypeof e=="number"?0:e;function sE(e){const t=Hk(e);return Uk(e)(t.map(rE))}const Hr={test:nE,parse:Hk,createTransformer:Uk,getAnimatableNone:sE},Wk=(e,t)=>n=>`${n>0?t:e}`;function Gk(e,t){return typeof e=="number"?n=>Te(e,t,n):wt.test(e)?zk(e,t):e.startsWith("var(")?Wk(e,t):qk(e,t)}const Kk=(e,t)=>{const n=[...e],r=n.length,s=e.map((o,i)=>Gk(o,t[i]));return o=>{for(let i=0;i{const n={...e,...t},r={};for(const s in n)e[s]!==void 0&&t[s]!==void 0&&(r[s]=Gk(e[s],t[s]));return s=>{for(const o in r)n[o]=r[o](s);return n}},qk=(e,t)=>{const n=Hr.createTransformer(t),r=Ic(e),s=Ic(t);return r.numVars===s.numVars&&r.numColors===s.numColors&&r.numNumbers>=s.numNumbers?Fr(Kk(r.values,s.values),n):Wk(e,t)},ga=(e,t,n)=>{const r=t-e;return r===0?1:(n-e)/r},ly=(e,t)=>n=>Te(e,t,n);function iE(e){return typeof e=="number"?ly:typeof e=="string"?wt.test(e)?zk:qk:Array.isArray(e)?Kk:typeof e=="object"?oE:ly}function aE(e,t,n){const r=[],s=n||iE(e[0]),o=e.length-1;for(let i=0;it[0];e[0]>e[o-1]&&(e=[...e].reverse(),t=[...t].reverse());const i=aE(t,r,s),a=i.length,l=u=>{let d=0;if(a>1)for(;dl($r(e[0],e[o-1],u)):l}function lE(e,t){const n=e[e.length-1];for(let r=1;r<=t;r++){const s=ga(0,t,r);e.push(Te(n,1,s))}}function cE(e){const t=[0];return lE(t,e.length-1),t}function uE(e,t){return e.map(n=>n*t)}function dE(e,t){return e.map(()=>t||Mk).splice(0,e.length-1)}function Fc({duration:e=300,keyframes:t,times:n,ease:r="easeInOut"}){const s=G4(r)?r.map(iy):iy(r),o={done:!1,value:t[0]},i=uE(n&&n.length===t.length?n:cE(t),e),a=Yk(i,t,{ease:Array.isArray(s)?s:dE(t,s)});return{calculatedDuration:e,next:l=>(o.value=a(l),o.done=l>=e,o)}}function Xk(e,t){return t?e*(1e3/t):0}const hE=5;function Qk(e,t,n){const r=Math.max(t-hE,0);return Xk(n-e(r),t-r)}const Ad=.001,fE=.01,pE=10,gE=.05,mE=1;function yE({duration:e=800,bounce:t=.25,velocity:n=0,mass:r=1}){let s,o,i=1-t;i=$r(gE,mE,i),e=$r(fE,pE,er(e)),i<1?(s=u=>{const d=u*i,h=d*e,f=d-n,p=xf(u,i),g=Math.exp(-h);return Ad-f/p*g},o=u=>{const h=u*i*e,f=h*n+n,p=Math.pow(i,2)*Math.pow(u,2)*e,g=Math.exp(-h),m=xf(Math.pow(u,2),i);return(-s(u)+Ad>0?-1:1)*((f-p)*g)/m}):(s=u=>{const d=Math.exp(-u*e),h=(u-n)*e+1;return-Ad+d*h},o=u=>{const d=Math.exp(-u*e),h=(n-u)*(e*e);return d*h});const a=5/e,l=bE(s,o,a);if(e=_s(e),isNaN(l))return{stiffness:100,damping:10,duration:e};{const u=Math.pow(l,2)*r;return{stiffness:u,damping:i*2*Math.sqrt(r*u),duration:e}}}const xE=12;function bE(e,t,n){let r=n;for(let s=1;se[n]!==void 0)}function kE(e){let t={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...e};if(!cy(e,wE)&&cy(e,vE)){const n=yE(e);t={...t,...n,mass:1},t.isResolvedFromDuration=!0}return t}function Jk({keyframes:e,restDelta:t,restSpeed:n,...r}){const s=e[0],o=e[e.length-1],i={done:!1,value:s},{stiffness:a,damping:l,mass:u,duration:d,velocity:h,isResolvedFromDuration:f}=kE({...r,velocity:-er(r.velocity||0)}),p=h||0,g=l/(2*Math.sqrt(a*u)),m=o-s,y=er(Math.sqrt(a/u)),x=Math.abs(m)<5;n||(n=x?.01:2),t||(t=x?.005:.5);let v;if(g<1){const b=xf(y,g);v=k=>{const w=Math.exp(-g*y*k);return o-w*((p+g*y*m)/b*Math.sin(b*k)+m*Math.cos(b*k))}}else if(g===1)v=b=>o-Math.exp(-y*b)*(m+(p+y*m)*b);else{const b=y*Math.sqrt(g*g-1);v=k=>{const w=Math.exp(-g*y*k),j=Math.min(b*k,300);return o-w*((p+g*y*m)*Math.sinh(j)+b*m*Math.cosh(j))/b}}return{calculatedDuration:f&&d||null,next:b=>{const k=v(b);if(f)i.done=b>=d;else{let w=p;b!==0&&(g<1?w=Qk(v,b,k):w=0);const j=Math.abs(w)<=n,N=Math.abs(o-k)<=t;i.done=j&&N}return i.value=i.done?o:k,i}}}function uy({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:s=10,bounceStiffness:o=500,modifyTarget:i,min:a,max:l,restDelta:u=.5,restSpeed:d}){const h=e[0],f={done:!1,value:h},p=_=>a!==void 0&&_l,g=_=>a===void 0?l:l===void 0||Math.abs(a-_)-m*Math.exp(-_/r),b=_=>x+v(_),k=_=>{const P=v(_),A=b(_);f.done=Math.abs(P)<=u,f.value=f.done?x:A};let w,j;const N=_=>{p(f.value)&&(w=_,j=Jk({keyframes:[f.value,g(f.value)],velocity:Qk(b,_,f.value),damping:s,stiffness:o,restDelta:u,restSpeed:d}))};return N(0),{calculatedDuration:null,next:_=>{let P=!1;return!j&&w===void 0&&(P=!0,k(_),N(_)),w!==void 0&&_>w?j.next(_-w):(!P&&k(_),f)}}}const SE=e=>{const t=({timestamp:n})=>e(n);return{start:()=>Se.update(t,!0),stop:()=>or(t),now:()=>ft.isProcessing?ft.timestamp:performance.now()}},dy=2e4;function hy(e){let t=0;const n=50;let r=e.next(t);for(;!r.done&&t=dy?1/0:t}const _E={decay:uy,inertia:uy,tween:Fc,keyframes:Fc,spring:Jk};function zc({autoplay:e=!0,delay:t=0,driver:n=SE,keyframes:r,type:s="keyframes",repeat:o=0,repeatDelay:i=0,repeatType:a="loop",onPlay:l,onStop:u,onComplete:d,onUpdate:h,...f}){let p=1,g=!1,m,y;const x=()=>{y=new Promise(I=>{m=I})};x();let v;const b=_E[s]||Fc;let k;b!==Fc&&typeof r[0]!="number"&&(k=Yk([0,100],r,{clamp:!1}),r=[0,100]);const w=b({...f,keyframes:r});let j;a==="mirror"&&(j=b({...f,keyframes:[...r].reverse(),velocity:-(f.velocity||0)}));let N="idle",_=null,P=null,A=null;w.calculatedDuration===null&&o&&(w.calculatedDuration=hy(w));const{calculatedDuration:O}=w;let F=1/0,D=1/0;O!==null&&(F=O+i,D=F*(o+1)-i);let W=0;const G=I=>{if(P===null)return;p>0&&(P=Math.min(P,I)),p<0&&(P=Math.min(I-D/p,P)),_!==null?W=_:W=Math.round(I-P)*p;const Y=W-t*(p>=0?1:-1),T=p>=0?Y<0:Y>D;W=Math.max(Y,0),N==="finished"&&_===null&&(W=D);let $=W,K=w;if(o){const nt=Math.min(W,D)/F;let lt=Math.floor(nt),Ye=nt%1;!Ye&&nt>=1&&(Ye=1),Ye===1&<--,lt=Math.min(lt,o+1),!!(lt%2)&&(a==="reverse"?(Ye=1-Ye,i&&(Ye-=i/F)):a==="mirror"&&(K=j)),$=$r(0,1,Ye)*F}const ne=T?{done:!1,value:r[0]}:K.next($);k&&(ne.value=k(ne.value));let{done:ce}=ne;!T&&O!==null&&(ce=p>=0?W>=D:W<=0);const fe=_===null&&(N==="finished"||N==="running"&&ce);return h&&h(ne.value),fe&&C(),ne},M=()=>{v&&v.stop(),v=void 0},U=()=>{N="idle",M(),m(),x(),P=A=null},C=()=>{N="finished",d&&d(),M(),m()},L=()=>{if(g)return;v||(v=n(G));const I=v.now();l&&l(),_!==null?P=I-_:(!P||N==="finished")&&(P=I),N==="finished"&&x(),A=P,_=null,N="running",v.start()};e&&L();const E={then(I,Y){return y.then(I,Y)},get time(){return er(W)},set time(I){I=_s(I),W=I,_!==null||!v||p===0?_=I:P=v.now()-I/p},get duration(){const I=w.calculatedDuration===null?hy(w):w.calculatedDuration;return er(I)},get speed(){return p},set speed(I){I===p||!v||(p=I,E.time=er(W))},get state(){return N},play:L,pause:()=>{N="paused",_=W},stop:()=>{g=!0,N!=="idle"&&(N="idle",u&&u(),U())},cancel:()=>{A!==null&&G(A),U()},complete:()=>{N="finished"},sample:I=>(P=0,G(I))};return E}function jE(e){let t;return()=>(t===void 0&&(t=e()),t)}const CE=jE(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),NE=new Set(["opacity","clipPath","filter","transform","backgroundColor"]),pl=10,PE=2e4,RE=(e,t)=>t.type==="spring"||e==="backgroundColor"||!Rk(t.ease);function EE(e,t,{onUpdate:n,onComplete:r,...s}){if(!(CE()&&NE.has(t)&&!s.repeatDelay&&s.repeatType!=="mirror"&&s.damping!==0&&s.type!=="inertia"))return!1;let i=!1,a,l,u=!1;const d=()=>{l=new Promise(b=>{a=b})};d();let{keyframes:h,duration:f=300,ease:p,times:g}=s;if(RE(t,s)){const b=zc({...s,repeat:0,delay:0});let k={done:!1,value:h[0]};const w=[];let j=0;for(;!k.done&&j{u=!1,m.cancel()},x=()=>{u=!0,Se.update(y),a(),d()};return m.onfinish=()=>{u||(e.set(V4(h,s)),r&&r(),x())},{then(b,k){return l.then(b,k)},attachTimeline(b){return m.timeline=b,m.onfinish=null,Ie},get time(){return er(m.currentTime||0)},set time(b){m.currentTime=_s(b)},get speed(){return m.playbackRate},set speed(b){m.playbackRate=b},get duration(){return er(f)},play:()=>{i||(m.play(),or(y))},pause:()=>m.pause(),stop:()=>{if(i=!0,m.playState==="idle")return;const{currentTime:b}=m;if(b){const k=zc({...s,autoplay:!1});e.setWithVelocity(k.sample(b-pl).value,k.sample(b).value,pl)}x()},complete:()=>{u||m.finish()},cancel:x}}function TE({keyframes:e,delay:t,onUpdate:n,onComplete:r}){const s=()=>(n&&n(e[e.length-1]),r&&r(),{time:0,speed:1,duration:0,play:Ie,pause:Ie,stop:Ie,then:o=>(o(),Promise.resolve()),cancel:Ie,complete:Ie});return t?zc({keyframes:[0,1],duration:0,delay:t,onComplete:s}):s()}const AE={type:"spring",stiffness:500,damping:25,restSpeed:10},ME=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),LE={type:"keyframes",duration:.8},OE={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},DE=(e,{keyframes:t})=>t.length>2?LE:Fs.has(e)?e.startsWith("scale")?ME(t[1]):AE:OE,bf=(e,t)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(Hr.test(t)||t==="0")&&!t.startsWith("url(")),IE=new Set(["brightness","contrast","saturate","opacity"]);function FE(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[r]=n.match(Ru)||[];if(!r)return e;const s=n.replace(r,"");let o=IE.has(t)?1:0;return r!==n&&(o*=100),t+"("+o+s+")"}const zE=/([a-z-]*)\(.*?\)/g,vf={...Hr,getAnimatableNone:e=>{const t=e.match(zE);return t?t.map(FE).join(" "):e}},VE={...hk,color:wt,backgroundColor:wt,outlineColor:wt,fill:wt,stroke:wt,borderColor:wt,borderTopColor:wt,borderRightColor:wt,borderBottomColor:wt,borderLeftColor:wt,filter:vf,WebkitFilter:vf},kg=e=>VE[e];function Zk(e,t){let n=kg(e);return n!==vf&&(n=Hr),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const e2=e=>/^0[^.\s]+$/.test(e);function BE(e){if(typeof e=="number")return e===0;if(e!==null)return e==="none"||e==="0"||e2(e)}function $E(e,t,n,r){const s=bf(t,n);let o;Array.isArray(n)?o=[...n]:o=[null,n];const i=r.from!==void 0?r.from:e.get();let a;const l=[];for(let u=0;us=>{const o=Sg(r,e)||{},i=o.delay||r.delay||0;let{elapsed:a=0}=r;a=a-_s(i);const l=$E(t,e,n,o),u=l[0],d=l[l.length-1],h=bf(e,u),f=bf(e,d);let p={keyframes:l,velocity:t.getVelocity(),ease:"easeOut",...o,delay:-a,onUpdate:g=>{t.set(g),o.onUpdate&&o.onUpdate(g)},onComplete:()=>{s(),o.onComplete&&o.onComplete()}};if(HE(o)||(p={...p,...DE(e,p)}),p.duration&&(p.duration=_s(p.duration)),p.repeatDelay&&(p.repeatDelay=_s(p.repeatDelay)),!h||!f||F4.current||o.type===!1||UE.skipAnimations)return TE(p);if(!r.isHandoff&&t.owner&&t.owner.current instanceof HTMLElement&&!t.owner.getProps().onUpdate){const g=EE(t,e,p);if(g)return g}return zc(p)};function Vc(e){return!!(Ft(e)&&e.add)}const t2=e=>/^\-?\d*\.?\d+$/.test(e);function jg(e,t){e.indexOf(t)===-1&&e.push(t)}function Cg(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}class Ng{constructor(){this.subscriptions=[]}add(t){return jg(this.subscriptions,t),()=>Cg(this.subscriptions,t)}notify(t,n,r){const s=this.subscriptions.length;if(s)if(s===1)this.subscriptions[0](t,n,r);else for(let o=0;o!isNaN(parseFloat(e));class GE{constructor(t,n={}){this.version="10.18.0",this.timeDelta=0,this.lastUpdated=0,this.canTrackVelocity=!1,this.events={},this.updateAndNotify=(r,s=!0)=>{this.prev=this.current,this.current=r;const{delta:o,timestamp:i}=ft;this.lastUpdated!==i&&(this.timeDelta=o,this.lastUpdated=i,Se.postRender(this.scheduleVelocityCheck)),this.prev!==this.current&&this.events.change&&this.events.change.notify(this.current),this.events.velocityChange&&this.events.velocityChange.notify(this.getVelocity()),s&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.scheduleVelocityCheck=()=>Se.postRender(this.velocityCheck),this.velocityCheck=({timestamp:r})=>{r!==this.lastUpdated&&(this.prev=this.current,this.events.velocityChange&&this.events.velocityChange.notify(this.getVelocity()))},this.hasAnimated=!1,this.prev=this.current=t,this.canTrackVelocity=WE(this.current),this.owner=n.owner}onChange(t){return this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new Ng);const r=this.events[t].add(n);return t==="change"?()=>{r(),Se.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t,n=!0){!n||!this.passiveEffect?this.updateAndNotify(t,n):this.passiveEffect(t,this.updateAndNotify)}setWithVelocity(t,n,r){this.set(n),this.prev=t,this.timeDelta=r}jump(t){this.updateAndNotify(t),this.prev=t,this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){return this.canTrackVelocity?Xk(parseFloat(this.current)-parseFloat(this.prev),this.timeDelta):0}start(t){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=t(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Mo(e,t){return new GE(e,t)}const n2=e=>t=>t.test(e),KE={test:e=>e==="auto",parse:e=>e},r2=[zs,re,Dn,pr,e4,ZR,KE],ci=e=>r2.find(n2(e)),qE=[...r2,wt,Hr],YE=e=>qE.find(n2(e));function XE(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,Mo(n))}function QE(e,t){const n=Tu(e,t);let{transitionEnd:r={},transition:s={},...o}=n?e.makeTargetAnimatable(n,!1):{};o={...o,...r};for(const i in o){const a=p4(o[i]);XE(e,i,a)}}function JE(e,t,n){var r,s;const o=Object.keys(t).filter(a=>!e.hasValue(a)),i=o.length;if(i)for(let a=0;al.remove(h))),u.push(y)}return i&&Promise.all(u).then(()=>{i&&QE(e,i)}),u}function wf(e,t,n={}){const r=Tu(e,t,n.custom);let{transition:s=e.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(s=n.transitionOverride);const o=r?()=>Promise.all(s2(e,r,n)):()=>Promise.resolve(),i=e.variantChildren&&e.variantChildren.size?(l=0)=>{const{delayChildren:u=0,staggerChildren:d,staggerDirection:h}=s;return r3(e,t,u+l,d,h,n)}:()=>Promise.resolve(),{when:a}=s;if(a){const[l,u]=a==="beforeChildren"?[o,i]:[i,o];return l().then(()=>u())}else return Promise.all([o(),i(n.delay)])}function r3(e,t,n=0,r=0,s=1,o){const i=[],a=(e.variantChildren.size-1)*r,l=s===1?(u=0)=>u*r:(u=0)=>a-u*r;return Array.from(e.variantChildren).sort(s3).forEach((u,d)=>{u.notify("AnimationStart",t),i.push(wf(u,t,{...o,delay:n+l(d)}).then(()=>u.notify("AnimationComplete",t)))}),Promise.all(i)}function s3(e,t){return e.sortNodePosition(t)}function o3(e,t,n={}){e.notify("AnimationStart",t);let r;if(Array.isArray(t)){const s=t.map(o=>wf(e,o,n));r=Promise.all(s)}else if(typeof t=="string")r=wf(e,t,n);else{const s=typeof t=="function"?Tu(e,t,n.custom):t;r=Promise.all(s2(e,s,n))}return r.then(()=>e.notify("AnimationComplete",t))}const i3=[...lg].reverse(),a3=lg.length;function l3(e){return t=>Promise.all(t.map(({animation:n,options:r})=>o3(e,n,r)))}function c3(e){let t=l3(e);const n=d3();let r=!0;const s=(l,u)=>{const d=Tu(e,u);if(d){const{transition:h,transitionEnd:f,...p}=d;l={...l,...p,...f}}return l};function o(l){t=l(e)}function i(l,u){const d=e.getProps(),h=e.getVariantContext(!0)||{},f=[],p=new Set;let g={},m=1/0;for(let x=0;xm&&w,A=!1;const O=Array.isArray(k)?k:[k];let F=O.reduce(s,{});j===!1&&(F={});const{prevResolvedValues:D={}}=b,W={...D,...F},G=M=>{P=!0,p.has(M)&&(A=!0,p.delete(M)),b.needsAnimating[M]=!0};for(const M in W){const U=F[M],C=D[M];if(g.hasOwnProperty(M))continue;let L=!1;Dc(U)&&Dc(C)?L=!Nk(U,C):L=U!==C,L?U!==void 0?G(M):p.add(M):U!==void 0&&p.has(M)?G(M):b.protectedKeys[M]=!0}b.prevProp=k,b.prevResolvedValues=F,b.isActive&&(g={...g,...F}),r&&e.blockInitialAnimation&&(P=!1),P&&(!N||A)&&f.push(...O.map(M=>({animation:M,options:{type:v,...l}})))}if(p.size){const x={};p.forEach(v=>{const b=e.getBaseTarget(v);b!==void 0&&(x[v]=b)}),f.push({animation:x})}let y=!!f.length;return r&&(d.initial===!1||d.initial===d.animate)&&!e.manuallyAnimateOnMount&&(y=!1),r=!1,y?t(f):Promise.resolve()}function a(l,u,d){var h;if(n[l].isActive===u)return Promise.resolve();(h=e.variantChildren)===null||h===void 0||h.forEach(p=>{var g;return(g=p.animationState)===null||g===void 0?void 0:g.setActive(l,u)}),n[l].isActive=u;const f=i(d,l);for(const p in n)n[p].protectedKeys={};return f}return{animateChanges:i,setActive:a,setAnimateFunction:o,getState:()=>n}}function u3(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!Nk(t,e):!1}function ns(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function d3(){return{animate:ns(!0),whileInView:ns(),whileHover:ns(),whileTap:ns(),whileDrag:ns(),whileFocus:ns(),exit:ns()}}class h3 extends Jr{constructor(t){super(t),t.animationState||(t.animationState=c3(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();this.unmount(),Nu(t)&&(this.unmount=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){}}let f3=0;class p3 extends Jr{constructor(){super(...arguments),this.id=f3++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n,custom:r}=this.node.presenceContext,{isPresent:s}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===s)return;const o=this.node.animationState.setActive("exit",!t,{custom:r??this.node.getProps().custom});n&&!t&&o.then(()=>n(this.id))}mount(){const{register:t}=this.node.presenceContext||{};t&&(this.unmount=t(this.id))}unmount(){}}const g3={animation:{Feature:h3},exit:{Feature:p3}},fy=(e,t)=>Math.abs(e-t);function m3(e,t){const n=fy(e.x,t.x),r=fy(e.y,t.y);return Math.sqrt(n**2+r**2)}class o2{constructor(t,n,{transformPagePoint:r,contextWindow:s,dragSnapToOrigin:o=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const h=Ld(this.lastMoveEventInfo,this.history),f=this.startEvent!==null,p=m3(h.offset,{x:0,y:0})>=3;if(!f&&!p)return;const{point:g}=h,{timestamp:m}=ft;this.history.push({...g,timestamp:m});const{onStart:y,onMove:x}=this.handlers;f||(y&&y(this.lastMoveEvent,h),this.startEvent=this.lastMoveEvent),x&&x(this.lastMoveEvent,h)},this.handlePointerMove=(h,f)=>{this.lastMoveEvent=h,this.lastMoveEventInfo=Md(f,this.transformPagePoint),Se.update(this.updatePoint,!0)},this.handlePointerUp=(h,f)=>{this.end();const{onEnd:p,onSessionEnd:g,resumeAnimation:m}=this.handlers;if(this.dragSnapToOrigin&&m&&m(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const y=Ld(h.type==="pointercancel"?this.lastMoveEventInfo:Md(f,this.transformPagePoint),this.history);this.startEvent&&p&&p(h,y),g&&g(h,y)},!kk(t))return;this.dragSnapToOrigin=o,this.handlers=n,this.transformPagePoint=r,this.contextWindow=s||window;const i=Eu(t),a=Md(i,this.transformPagePoint),{point:l}=a,{timestamp:u}=ft;this.history=[{...l,timestamp:u}];const{onSessionStart:d}=n;d&&d(t,Ld(a,this.history)),this.removeListeners=Fr(Zn(this.contextWindow,"pointermove",this.handlePointerMove),Zn(this.contextWindow,"pointerup",this.handlePointerUp),Zn(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),or(this.updatePoint)}}function Md(e,t){return t?{point:t(e.point)}:e}function py(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Ld({point:e},t){return{point:e,delta:py(e,i2(t)),offset:py(e,y3(t)),velocity:x3(t,.1)}}function y3(e){return e[0]}function i2(e){return e[e.length-1]}function x3(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const s=i2(e);for(;n>=0&&(r=e[n],!(s.timestamp-r.timestamp>_s(t)));)n--;if(!r)return{x:0,y:0};const o=er(s.timestamp-r.timestamp);if(o===0)return{x:0,y:0};const i={x:(s.x-r.x)/o,y:(s.y-r.y)/o};return i.x===1/0&&(i.x=0),i.y===1/0&&(i.y=0),i}function qt(e){return e.max-e.min}function kf(e,t=0,n=.01){return Math.abs(e-t)<=n}function gy(e,t,n,r=.5){e.origin=r,e.originPoint=Te(t.min,t.max,e.origin),e.scale=qt(n)/qt(t),(kf(e.scale,1,1e-4)||isNaN(e.scale))&&(e.scale=1),e.translate=Te(n.min,n.max,e.origin)-e.originPoint,(kf(e.translate)||isNaN(e.translate))&&(e.translate=0)}function zi(e,t,n,r){gy(e.x,t.x,n.x,r?r.originX:void 0),gy(e.y,t.y,n.y,r?r.originY:void 0)}function my(e,t,n){e.min=n.min+t.min,e.max=e.min+qt(t)}function b3(e,t,n){my(e.x,t.x,n.x),my(e.y,t.y,n.y)}function yy(e,t,n){e.min=t.min-n.min,e.max=e.min+qt(t)}function Vi(e,t,n){yy(e.x,t.x,n.x),yy(e.y,t.y,n.y)}function v3(e,{min:t,max:n},r){return t!==void 0&&en&&(e=r?Te(n,e,r.max):Math.min(e,n)),e}function xy(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function w3(e,{top:t,left:n,bottom:r,right:s}){return{x:xy(e.x,n,s),y:xy(e.y,t,r)}}function by(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.minr?n=ga(t.min,t.max-r,e.min):r>s&&(n=ga(e.min,e.max-s,t.min)),$r(0,1,n)}function _3(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const Sf=.35;function j3(e=Sf){return e===!1?e=0:e===!0&&(e=Sf),{x:vy(e,"left","right"),y:vy(e,"top","bottom")}}function vy(e,t,n){return{min:wy(e,t),max:wy(e,n)}}function wy(e,t){return typeof e=="number"?e:e[t]||0}const ky=()=>({translate:0,scale:1,origin:0,originPoint:0}),ho=()=>({x:ky(),y:ky()}),Sy=()=>({min:0,max:0}),Ve=()=>({x:Sy(),y:Sy()});function rn(e){return[e("x"),e("y")]}function a2({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function C3({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function N3(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function Od(e){return e===void 0||e===1}function _f({scale:e,scaleX:t,scaleY:n}){return!Od(e)||!Od(t)||!Od(n)}function cs(e){return _f(e)||l2(e)||e.z||e.rotate||e.rotateX||e.rotateY}function l2(e){return _y(e.x)||_y(e.y)}function _y(e){return e&&e!=="0%"}function Bc(e,t,n){const r=e-n,s=t*r;return n+s}function jy(e,t,n,r,s){return s!==void 0&&(e=Bc(e,s,r)),Bc(e,n,r)+t}function jf(e,t=0,n=1,r,s){e.min=jy(e.min,t,n,r,s),e.max=jy(e.max,t,n,r,s)}function c2(e,{x:t,y:n}){jf(e.x,t.translate,t.scale,t.originPoint),jf(e.y,n.translate,n.scale,n.originPoint)}function P3(e,t,n,r=!1){const s=n.length;if(!s)return;t.x=t.y=1;let o,i;for(let a=0;a1.0000000000001||e<.999999999999?e:1}function yr(e,t){e.min=e.min+t,e.max=e.max+t}function Ny(e,t,[n,r,s]){const o=t[s]!==void 0?t[s]:.5,i=Te(e.min,e.max,o);jf(e,t[n],t[r],i,t.scale)}const R3=["x","scaleX","originX"],E3=["y","scaleY","originY"];function fo(e,t){Ny(e.x,t,R3),Ny(e.y,t,E3)}function u2(e,t){return a2(N3(e.getBoundingClientRect(),t))}function T3(e,t,n){const r=u2(e,n),{scroll:s}=t;return s&&(yr(r.x,s.offset.x),yr(r.y,s.offset.y)),r}const d2=({current:e})=>e?e.ownerDocument.defaultView:null,A3=new WeakMap;class M3{constructor(t){this.openGlobalLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Ve(),this.visualElement=t}start(t,{snapToCursor:n=!1}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const s=d=>{const{dragSnapToOrigin:h}=this.getProps();h?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(Eu(d,"page").point)},o=(d,h)=>{const{drag:f,dragPropagation:p,onDragStart:g}=this.getProps();if(f&&!p&&(this.openGlobalLock&&this.openGlobalLock(),this.openGlobalLock=_k(f),!this.openGlobalLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),rn(y=>{let x=this.getAxisMotionValue(y).get()||0;if(Dn.test(x)){const{projection:v}=this.visualElement;if(v&&v.layout){const b=v.layout.layoutBox[y];b&&(x=qt(b)*(parseFloat(x)/100))}}this.originPoint[y]=x}),g&&Se.update(()=>g(d,h),!1,!0);const{animationState:m}=this.visualElement;m&&m.setActive("whileDrag",!0)},i=(d,h)=>{const{dragPropagation:f,dragDirectionLock:p,onDirectionLock:g,onDrag:m}=this.getProps();if(!f&&!this.openGlobalLock)return;const{offset:y}=h;if(p&&this.currentDirection===null){this.currentDirection=L3(y),this.currentDirection!==null&&g&&g(this.currentDirection);return}this.updateAxis("x",h.point,y),this.updateAxis("y",h.point,y),this.visualElement.render(),m&&m(d,h)},a=(d,h)=>this.stop(d,h),l=()=>rn(d=>{var h;return this.getAnimationState(d)==="paused"&&((h=this.getAxisMotionValue(d).animation)===null||h===void 0?void 0:h.play())}),{dragSnapToOrigin:u}=this.getProps();this.panSession=new o2(t,{onSessionStart:s,onStart:o,onMove:i,onSessionEnd:a,resumeAnimation:l},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:u,contextWindow:d2(this.visualElement)})}stop(t,n){const r=this.isDragging;if(this.cancel(),!r)return;const{velocity:s}=n;this.startAnimation(s);const{onDragEnd:o}=this.getProps();o&&Se.update(()=>o(t,n))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:r}=this.getProps();!r&&this.openGlobalLock&&(this.openGlobalLock(),this.openGlobalLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(t,n,r){const{drag:s}=this.getProps();if(!r||!gl(t,s,this.currentDirection))return;const o=this.getAxisMotionValue(t);let i=this.originPoint[t]+r[t];this.constraints&&this.constraints[t]&&(i=v3(i,this.constraints[t],this.elastic[t])),o.set(i)}resolveConstraints(){var t;const{dragConstraints:n,dragElastic:r}=this.getProps(),s=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(t=this.visualElement.projection)===null||t===void 0?void 0:t.layout,o=this.constraints;n&&co(n)?this.constraints||(this.constraints=this.resolveRefConstraints()):n&&s?this.constraints=w3(s.layoutBox,n):this.constraints=!1,this.elastic=j3(r),o!==this.constraints&&s&&this.constraints&&!this.hasMutatedConstraints&&rn(i=>{this.getAxisMotionValue(i)&&(this.constraints[i]=_3(s.layoutBox[i],this.constraints[i]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!co(t))return!1;const r=t.current,{projection:s}=this.visualElement;if(!s||!s.layout)return!1;const o=T3(r,s.root,this.visualElement.getTransformPagePoint());let i=k3(s.layout.layoutBox,o);if(n){const a=n(C3(i));this.hasMutatedConstraints=!!a,a&&(i=a2(a))}return i}startAnimation(t){const{drag:n,dragMomentum:r,dragElastic:s,dragTransition:o,dragSnapToOrigin:i,onDragTransitionEnd:a}=this.getProps(),l=this.constraints||{},u=rn(d=>{if(!gl(d,n,this.currentDirection))return;let h=l&&l[d]||{};i&&(h={min:0,max:0});const f=s?200:1e6,p=s?40:1e7,g={type:"inertia",velocity:r?t[d]:0,bounceStiffness:f,bounceDamping:p,timeConstant:750,restDelta:1,restSpeed:10,...o,...h};return this.startAxisValueAnimation(d,g)});return Promise.all(u).then(a)}startAxisValueAnimation(t,n){const r=this.getAxisMotionValue(t);return r.start(_g(t,r,0,n))}stopAnimation(){rn(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){rn(t=>{var n;return(n=this.getAxisMotionValue(t).animation)===null||n===void 0?void 0:n.pause()})}getAnimationState(t){var n;return(n=this.getAxisMotionValue(t).animation)===null||n===void 0?void 0:n.state}getAxisMotionValue(t){const n="_drag"+t.toUpperCase(),r=this.visualElement.getProps(),s=r[n];return s||this.visualElement.getValue(t,(r.initial?r.initial[t]:void 0)||0)}snapToCursor(t){rn(n=>{const{drag:r}=this.getProps();if(!gl(n,r,this.currentDirection))return;const{projection:s}=this.visualElement,o=this.getAxisMotionValue(n);if(s&&s.layout){const{min:i,max:a}=s.layout.layoutBox[n];o.set(t[n]-Te(i,a,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!co(n)||!r||!this.constraints)return;this.stopAnimation();const s={x:0,y:0};rn(i=>{const a=this.getAxisMotionValue(i);if(a){const l=a.get();s[i]=S3({min:l,max:l},this.constraints[i])}});const{transformTemplate:o}=this.visualElement.getProps();this.visualElement.current.style.transform=o?o({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),rn(i=>{if(!gl(i,t,null))return;const a=this.getAxisMotionValue(i),{min:l,max:u}=this.constraints[i];a.set(Te(l,u,s[i]))})}addListeners(){if(!this.visualElement.current)return;A3.set(this.visualElement,this);const t=this.visualElement.current,n=Zn(t,"pointerdown",l=>{const{drag:u,dragListener:d=!0}=this.getProps();u&&d&&this.start(l)}),r=()=>{const{dragConstraints:l}=this.getProps();co(l)&&(this.constraints=this.resolveRefConstraints())},{projection:s}=this.visualElement,o=s.addEventListener("measure",r);s&&!s.layout&&(s.root&&s.root.updateScroll(),s.updateLayout()),r();const i=Yn(window,"resize",()=>this.scalePositionWithinConstraints()),a=s.addEventListener("didUpdate",(({delta:l,hasLayoutChanged:u})=>{this.isDragging&&u&&(rn(d=>{const h=this.getAxisMotionValue(d);h&&(this.originPoint[d]+=l[d].translate,h.set(h.get()+l[d].translate))}),this.visualElement.render())}));return()=>{i(),n(),o(),a&&a()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:s=!1,dragConstraints:o=!1,dragElastic:i=Sf,dragMomentum:a=!0}=t;return{...t,drag:n,dragDirectionLock:r,dragPropagation:s,dragConstraints:o,dragElastic:i,dragMomentum:a}}}function gl(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function L3(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class O3 extends Jr{constructor(t){super(t),this.removeGroupControls=Ie,this.removeListeners=Ie,this.controls=new M3(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Ie}unmount(){this.removeGroupControls(),this.removeListeners()}}const Py=e=>(t,n)=>{e&&Se.update(()=>e(t,n))};class D3 extends Jr{constructor(){super(...arguments),this.removePointerDownListener=Ie}onPointerDown(t){this.session=new o2(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:d2(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:r,onPanEnd:s}=this.node.getProps();return{onSessionStart:Py(t),onStart:Py(n),onMove:r,onEnd:(o,i)=>{delete this.session,s&&Se.update(()=>s(o,i))}}}mount(){this.removePointerDownListener=Zn(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}function I3(){const e=S.useContext(ju);if(e===null)return[!0,null];const{isPresent:t,onExitComplete:n,register:r}=e,s=S.useId();return S.useEffect(()=>r(s),[]),!t&&n?[!1,()=>n&&n(s)]:[!0]}const ec={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function Ry(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const ui={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(re.test(e))e=parseFloat(e);else return e;const n=Ry(e,t.target.x),r=Ry(e,t.target.y);return`${n}% ${r}%`}},F3={correct:(e,{treeScale:t,projectionDelta:n})=>{const r=e,s=Hr.parse(e);if(s.length>5)return r;const o=Hr.createTransformer(e),i=typeof s[0]!="number"?1:0,a=n.x.scale*t.x,l=n.y.scale*t.y;s[0+i]/=a,s[1+i]/=l;const u=Te(a,l,.5);return typeof s[2+i]=="number"&&(s[2+i]/=u),typeof s[3+i]=="number"&&(s[3+i]/=u),o(s)}};class z3 extends z.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r,layoutId:s}=this.props,{projection:o}=t;GR(V3),o&&(n.group&&n.group.add(o),r&&r.register&&s&&r.register(o),o.root.didUpdate(),o.addEventListener("animationComplete",()=>{this.safeToRemove()}),o.setOptions({...o.options,onExitComplete:()=>this.safeToRemove()})),ec.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:r,drag:s,isPresent:o}=this.props,i=r.projection;return i&&(i.isPresent=o,s||t.layoutDependency!==n||n===void 0?i.willUpdate():this.safeToRemove(),t.isPresent!==o&&(o?i.promote():i.relegate()||Se.postRender(()=>{const a=i.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),queueMicrotask(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:s}=t;s&&(s.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(s),r&&r.deregister&&r.deregister(s))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function h2(e){const[t,n]=I3(),r=S.useContext(ug);return z.createElement(z3,{...e,layoutGroup:r,switchLayoutGroup:S.useContext(ak),isPresent:t,safeToRemove:n})}const V3={borderRadius:{...ui,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:ui,borderTopRightRadius:ui,borderBottomLeftRadius:ui,borderBottomRightRadius:ui,boxShadow:F3},f2=["TopLeft","TopRight","BottomLeft","BottomRight"],B3=f2.length,Ey=e=>typeof e=="string"?parseFloat(e):e,Ty=e=>typeof e=="number"||re.test(e);function $3(e,t,n,r,s,o){s?(e.opacity=Te(0,n.opacity!==void 0?n.opacity:1,H3(r)),e.opacityExit=Te(t.opacity!==void 0?t.opacity:1,0,U3(r))):o&&(e.opacity=Te(t.opacity!==void 0?t.opacity:1,n.opacity!==void 0?n.opacity:1,r));for(let i=0;irt?1:n(ga(e,t,r))}function My(e,t){e.min=t.min,e.max=t.max}function tn(e,t){My(e.x,t.x),My(e.y,t.y)}function Ly(e,t,n,r,s){return e-=t,e=Bc(e,1/n,r),s!==void 0&&(e=Bc(e,1/s,r)),e}function W3(e,t=0,n=1,r=.5,s,o=e,i=e){if(Dn.test(t)&&(t=parseFloat(t),t=Te(i.min,i.max,t/100)-i.min),typeof t!="number")return;let a=Te(o.min,o.max,r);e===o&&(a-=t),e.min=Ly(e.min,t,n,a,s),e.max=Ly(e.max,t,n,a,s)}function Oy(e,t,[n,r,s],o,i){W3(e,t[n],t[r],t[s],t.scale,o,i)}const G3=["x","scaleX","originX"],K3=["y","scaleY","originY"];function Dy(e,t,n,r){Oy(e.x,t,G3,n?n.x:void 0,r?r.x:void 0),Oy(e.y,t,K3,n?n.y:void 0,r?r.y:void 0)}function Iy(e){return e.translate===0&&e.scale===1}function g2(e){return Iy(e.x)&&Iy(e.y)}function q3(e,t){return e.x.min===t.x.min&&e.x.max===t.x.max&&e.y.min===t.y.min&&e.y.max===t.y.max}function m2(e,t){return Math.round(e.x.min)===Math.round(t.x.min)&&Math.round(e.x.max)===Math.round(t.x.max)&&Math.round(e.y.min)===Math.round(t.y.min)&&Math.round(e.y.max)===Math.round(t.y.max)}function Fy(e){return qt(e.x)/qt(e.y)}class Y3{constructor(){this.members=[]}add(t){jg(this.members,t),t.scheduleRender()}remove(t){if(Cg(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){const n=this.members.findIndex(s=>t===s);if(n===0)return!1;let r;for(let s=n;s>=0;s--){const o=this.members[s];if(o.isPresent!==!1){r=o;break}}return r?(this.promote(r),!0):!1}promote(t,n){const r=this.lead;if(t!==r&&(this.prevLead=r,this.lead=t,t.show(),r)){r.instance&&r.scheduleRender(),t.scheduleRender(),t.resumeFrom=r,n&&(t.resumeFrom.preserveOpacity=!0),r.snapshot&&(t.snapshot=r.snapshot,t.snapshot.latestValues=r.animationValues||r.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:s}=t.options;s===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:n,resumingFrom:r}=t;n.onExitComplete&&n.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function zy(e,t,n){let r="";const s=e.x.translate/t.x,o=e.y.translate/t.y;if((s||o)&&(r=`translate3d(${s}px, ${o}px, 0) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){const{rotate:l,rotateX:u,rotateY:d}=n;l&&(r+=`rotate(${l}deg) `),u&&(r+=`rotateX(${u}deg) `),d&&(r+=`rotateY(${d}deg) `)}const i=e.x.scale*t.x,a=e.y.scale*t.y;return(i!==1||a!==1)&&(r+=`scale(${i}, ${a})`),r||"none"}const X3=(e,t)=>e.depth-t.depth;class Q3{constructor(){this.children=[],this.isDirty=!1}add(t){jg(this.children,t),this.isDirty=!0}remove(t){Cg(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(X3),this.isDirty=!1,this.children.forEach(t)}}function J3(e,t){const n=performance.now(),r=({timestamp:s})=>{const o=s-n;o>=t&&(or(r),e(o-t))};return Se.read(r,!0),()=>or(r)}function Z3(e){window.MotionDebug&&window.MotionDebug.record(e)}function eT(e){return e instanceof SVGElement&&e.tagName!=="svg"}function tT(e,t,n){const r=Ft(e)?e:Mo(e);return r.start(_g("",r,t,n)),r.animation}const Vy=["","X","Y","Z"],nT={visibility:"hidden"},By=1e3;let rT=0;const us={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0};function y2({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:s}){return class{constructor(i={},a=t==null?void 0:t()){this.id=rT++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,us.totalNodes=us.resolvedTargetDeltas=us.recalculatedProjection=0,this.nodes.forEach(iT),this.nodes.forEach(dT),this.nodes.forEach(hT),this.nodes.forEach(aT),Z3(us)},this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=i,this.root=a?a.root||a:this,this.path=a?[...a.path,a]:[],this.parent=a,this.depth=a?a.depth+1:0;for(let l=0;lthis.root.updateBlockedByResize=!1;e(i,()=>{this.root.updateBlockedByResize=!0,h&&h(),h=J3(f,250),ec.hasAnimatedSinceResize&&(ec.hasAnimatedSinceResize=!1,this.nodes.forEach(Hy))})}l&&this.root.registerSharedNode(l,this),this.options.animate!==!1&&d&&(l||u)&&this.addEventListener("didUpdate",({delta:h,hasLayoutChanged:f,hasRelativeTargetChanged:p,layout:g})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const m=this.options.transition||d.getDefaultTransition()||yT,{onLayoutAnimationStart:y,onLayoutAnimationComplete:x}=d.getProps(),v=!this.targetLayout||!m2(this.targetLayout,g)||p,b=!f&&p;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||b||f&&(v||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(h,b);const k={...Sg(m,"layout"),onPlay:y,onComplete:x};(d.shouldReduceMotion||this.options.layoutRoot)&&(k.delay=0,k.type=!1),this.startAnimation(k)}else f||Hy(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=g})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const i=this.getStack();i&&i.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,or(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(fT),this.animationId++)}getTransformTemplate(){const{visualElement:i}=this.options;return i&&i.getProps().transformTemplate}willUpdate(i=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let d=0;dthis.update()))}clearAllSnapshots(){this.nodes.forEach(lT),this.sharedNodes.forEach(pT)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Se.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Se.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let l=0;l{const w=k/1e3;Uy(h.x,i.x,w),Uy(h.y,i.y,w),this.setTargetDelta(h),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Vi(f,this.layout.layoutBox,this.relativeParent.layout.layoutBox),gT(this.relativeTarget,this.relativeTargetOrigin,f,w),b&&q3(this.relativeTarget,b)&&(this.isProjectionDirty=!1),b||(b=Ve()),tn(b,this.relativeTarget)),m&&(this.animationValues=d,$3(d,u,this.latestValues,w,v,x)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=w},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(i){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(or(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Se.update(()=>{ec.hasAnimatedSinceResize=!0,this.currentAnimation=tT(0,By,{...i,onUpdate:a=>{this.mixTargetDelta(a),i.onUpdate&&i.onUpdate(a)},onComplete:()=>{i.onComplete&&i.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const i=this.getStack();i&&i.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(By),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const i=this.getLead();let{targetWithTransforms:a,target:l,layout:u,latestValues:d}=i;if(!(!a||!l||!u)){if(this!==i&&this.layout&&u&&x2(this.options.animationType,this.layout.layoutBox,u.layoutBox)){l=this.target||Ve();const h=qt(this.layout.layoutBox.x);l.x.min=i.target.x.min,l.x.max=l.x.min+h;const f=qt(this.layout.layoutBox.y);l.y.min=i.target.y.min,l.y.max=l.y.min+f}tn(a,l),fo(a,d),zi(this.projectionDeltaWithTransform,this.layoutCorrected,a,d)}}registerSharedNode(i,a){this.sharedNodes.has(i)||this.sharedNodes.set(i,new Y3),this.sharedNodes.get(i).add(a);const u=a.options.initialPromotionConfig;a.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(a):void 0})}isLead(){const i=this.getStack();return i?i.lead===this:!0}getLead(){var i;const{layoutId:a}=this.options;return a?((i=this.getStack())===null||i===void 0?void 0:i.lead)||this:this}getPrevLead(){var i;const{layoutId:a}=this.options;return a?(i=this.getStack())===null||i===void 0?void 0:i.prevLead:void 0}getStack(){const{layoutId:i}=this.options;if(i)return this.root.sharedNodes.get(i)}promote({needsReset:i,transition:a,preserveFollowOpacity:l}={}){const u=this.getStack();u&&u.promote(this,l),i&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const i=this.getStack();return i?i.relegate(this):!1}resetRotation(){const{visualElement:i}=this.options;if(!i)return;let a=!1;const{latestValues:l}=i;if((l.rotate||l.rotateX||l.rotateY||l.rotateZ)&&(a=!0),!a)return;const u={};for(let d=0;d{var a;return(a=i.currentAnimation)===null||a===void 0?void 0:a.stop()}),this.root.nodes.forEach($y),this.root.sharedNodes.clear()}}}function sT(e){e.updateLayout()}function oT(e){var t;const n=((t=e.resumeFrom)===null||t===void 0?void 0:t.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&n&&e.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:s}=e.layout,{animationType:o}=e.options,i=n.source!==e.layout.source;o==="size"?rn(h=>{const f=i?n.measuredBox[h]:n.layoutBox[h],p=qt(f);f.min=r[h].min,f.max=f.min+p}):x2(o,n.layoutBox,r)&&rn(h=>{const f=i?n.measuredBox[h]:n.layoutBox[h],p=qt(r[h]);f.max=f.min+p,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[h].max=e.relativeTarget[h].min+p)});const a=ho();zi(a,r,n.layoutBox);const l=ho();i?zi(l,e.applyTransform(s,!0),n.measuredBox):zi(l,r,n.layoutBox);const u=!g2(a);let d=!1;if(!e.resumeFrom){const h=e.getClosestProjectingParent();if(h&&!h.resumeFrom){const{snapshot:f,layout:p}=h;if(f&&p){const g=Ve();Vi(g,n.layoutBox,f.layoutBox);const m=Ve();Vi(m,r,p.layoutBox),m2(g,m)||(d=!0),h.options.layoutRoot&&(e.relativeTarget=m,e.relativeTargetOrigin=g,e.relativeParent=h)}}}e.notifyListeners("didUpdate",{layout:r,snapshot:n,delta:l,layoutDelta:a,hasLayoutChanged:u,hasRelativeTargetChanged:d})}else if(e.isLead()){const{onExitComplete:r}=e.options;r&&r()}e.options.transition=void 0}function iT(e){us.totalNodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function aT(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function lT(e){e.clearSnapshot()}function $y(e){e.clearMeasurements()}function cT(e){e.isLayoutDirty=!1}function uT(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function Hy(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function dT(e){e.resolveTargetDelta()}function hT(e){e.calcProjection()}function fT(e){e.resetRotation()}function pT(e){e.removeLeadSnapshot()}function Uy(e,t,n){e.translate=Te(t.translate,0,n),e.scale=Te(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function Wy(e,t,n,r){e.min=Te(t.min,n.min,r),e.max=Te(t.max,n.max,r)}function gT(e,t,n,r){Wy(e.x,t.x,n.x,r),Wy(e.y,t.y,n.y,r)}function mT(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const yT={duration:.45,ease:[.4,0,.1,1]},Gy=e=>typeof navigator<"u"&&navigator.userAgent.toLowerCase().includes(e),Ky=Gy("applewebkit/")&&!Gy("chrome/")?Math.round:Ie;function qy(e){e.min=Ky(e.min),e.max=Ky(e.max)}function xT(e){qy(e.x),qy(e.y)}function x2(e,t,n){return e==="position"||e==="preserve-aspect"&&!kf(Fy(t),Fy(n),.2)}const bT=y2({attachResizeListener:(e,t)=>Yn(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),Dd={current:void 0},b2=y2({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!Dd.current){const e=new bT({});e.mount(window),e.setOptions({layoutScroll:!0}),Dd.current=e}return Dd.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),vT={pan:{Feature:D3},drag:{Feature:O3,ProjectionNode:b2,MeasureLayout:h2}},wT=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/;function kT(e){const t=wT.exec(e);if(!t)return[,];const[,n,r]=t;return[n,r]}function Cf(e,t,n=1){const[r,s]=kT(e);if(!r)return;const o=window.getComputedStyle(t).getPropertyValue(r);if(o){const i=o.trim();return t2(i)?parseFloat(i):i}else return gf(s)?Cf(s,t,n+1):s}function ST(e,{...t},n){const r=e.current;if(!(r instanceof Element))return{target:t,transitionEnd:n};n&&(n={...n}),e.values.forEach(s=>{const o=s.get();if(!gf(o))return;const i=Cf(o,r);i&&s.set(i)});for(const s in t){const o=t[s];if(!gf(o))continue;const i=Cf(o,r);i&&(t[s]=i,n||(n={}),n[s]===void 0&&(n[s]=o))}return{target:t,transitionEnd:n}}const _T=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),v2=e=>_T.has(e),jT=e=>Object.keys(e).some(v2),Yy=e=>e===zs||e===re,Xy=(e,t)=>parseFloat(e.split(", ")[t]),Qy=(e,t)=>(n,{transform:r})=>{if(r==="none"||!r)return 0;const s=r.match(/^matrix3d\((.+)\)$/);if(s)return Xy(s[1],t);{const o=r.match(/^matrix\((.+)\)$/);return o?Xy(o[1],e):0}},CT=new Set(["x","y","z"]),NT=Ia.filter(e=>!CT.has(e));function PT(e){const t=[];return NT.forEach(n=>{const r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),t.length&&e.render(),t}const Lo={width:({x:e},{paddingLeft:t="0",paddingRight:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t="0",paddingBottom:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:Qy(4,13),y:Qy(5,14)};Lo.translateX=Lo.x;Lo.translateY=Lo.y;const RT=(e,t,n)=>{const r=t.measureViewportBox(),s=t.current,o=getComputedStyle(s),{display:i}=o,a={};i==="none"&&t.setStaticValue("display",e.display||"block"),n.forEach(u=>{a[u]=Lo[u](r,o)}),t.render();const l=t.measureViewportBox();return n.forEach(u=>{const d=t.getValue(u);d&&d.jump(a[u]),e[u]=Lo[u](l,o)}),e},ET=(e,t,n={},r={})=>{t={...t},r={...r};const s=Object.keys(t).filter(v2);let o=[],i=!1;const a=[];if(s.forEach(l=>{const u=e.getValue(l);if(!e.hasValue(l))return;let d=n[l],h=ci(d);const f=t[l];let p;if(Dc(f)){const g=f.length,m=f[0]===null?1:0;d=f[m],h=ci(d);for(let y=m;y=0?window.pageYOffset:null,u=RT(t,e,a);return o.length&&o.forEach(([d,h])=>{e.getValue(d).set(h)}),e.render(),Cu&&l!==null&&window.scrollTo({top:l}),{target:u,transitionEnd:r}}else return{target:t,transitionEnd:r}};function TT(e,t,n,r){return jT(t)?ET(e,t,n,r):{target:t,transitionEnd:r}}const AT=(e,t,n,r)=>{const s=ST(e,t,r);return t=s.target,r=s.transitionEnd,TT(e,t,n,r)},Nf={current:null},w2={current:!1};function MT(){if(w2.current=!0,!!Cu)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>Nf.current=e.matches;e.addListener(t),t()}else Nf.current=!1}function LT(e,t,n){const{willChange:r}=t;for(const s in t){const o=t[s],i=n[s];if(Ft(o))e.addValue(s,o),Vc(r)&&r.add(s);else if(Ft(i))e.addValue(s,Mo(o,{owner:e})),Vc(r)&&r.remove(s);else if(i!==o)if(e.hasValue(s)){const a=e.getValue(s);!a.hasAnimated&&a.set(o)}else{const a=e.getStaticValue(s);e.addValue(s,Mo(a!==void 0?a:o,{owner:e}))}}for(const s in n)t[s]===void 0&&e.removeValue(s);return t}const Jy=new WeakMap,k2=Object.keys(pa),OT=k2.length,Zy=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],DT=cg.length;class IT{constructor({parent:t,props:n,presenceContext:r,reducedMotionConfig:s,visualState:o},i={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.scheduleRender=()=>Se.render(this.render,!1,!0);const{latestValues:a,renderState:l}=o;this.latestValues=a,this.baseTarget={...a},this.initialValues=n.initial?{...a}:{},this.renderState=l,this.parent=t,this.props=n,this.presenceContext=r,this.depth=t?t.depth+1:0,this.reducedMotionConfig=s,this.options=i,this.isControllingVariants=Pu(n),this.isVariantNode=ik(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:u,...d}=this.scrapeMotionValuesFromProps(n,{});for(const h in d){const f=d[h];a[h]!==void 0&&Ft(f)&&(f.set(a[h],!1),Vc(u)&&u.add(h))}}scrapeMotionValuesFromProps(t,n){return{}}mount(t){this.current=t,Jy.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((n,r)=>this.bindToMotionValue(r,n)),w2.current||MT(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:Nf.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){Jy.delete(this.current),this.projection&&this.projection.unmount(),or(this.notifyUpdate),or(this.render),this.valueSubscriptions.forEach(t=>t()),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const t in this.events)this.events[t].clear();for(const t in this.features)this.features[t].unmount();this.current=null}bindToMotionValue(t,n){const r=Fs.has(t),s=n.on("change",i=>{this.latestValues[t]=i,this.props.onUpdate&&Se.update(this.notifyUpdate,!1,!0),r&&this.projection&&(this.projection.isTransformDirty=!0)}),o=n.on("renderRequest",this.scheduleRender);this.valueSubscriptions.set(t,()=>{s(),o()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}loadFeatures({children:t,...n},r,s,o){let i,a;for(let l=0;lthis.scheduleRender(),animationType:typeof u=="string"?u:"both",initialPromotionConfig:o,layoutScroll:f,layoutRoot:p})}return a}updateFeatures(){for(const t in this.features){const n=this.features[t];n.isMounted?n.update():(n.mount(),n.isMounted=!0)}}triggerBuild(){this.build(this.renderState,this.latestValues,this.options,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Ve()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}makeTargetAnimatable(t,n=!0){return this.makeTargetAnimatableFromInstance(t,this.props,n)}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;rn.variantChildren.delete(t)}addValue(t,n){n!==this.values.get(t)&&(this.removeValue(t),this.bindToMotionValue(t,n)),this.values.set(t,n),this.latestValues[t]=n.get()}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){if(this.props.values&&this.props.values[t])return this.props.values[t];let r=this.values.get(t);return r===void 0&&n!==void 0&&(r=Mo(n,{owner:this}),this.addValue(t,r)),r}readValue(t){var n;return this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:(n=this.getBaseTargetFromProps(this.props,t))!==null&&n!==void 0?n:this.readValueFromInstance(this.current,t,this.options)}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){var n;const{initial:r}=this.props,s=typeof r=="string"||typeof r=="object"?(n=yg(this.props,r))===null||n===void 0?void 0:n[t]:void 0;if(r&&s!==void 0)return s;const o=this.getBaseTargetFromProps(this.props,t);return o!==void 0&&!Ft(o)?o:this.initialValues[t]!==void 0&&s===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new Ng),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}}class S2 extends IT{sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){return t.style?t.style[n]:void 0}removeValueFromRenderState(t,{vars:n,style:r}){delete n[t],delete r[t]}makeTargetAnimatableFromInstance({transition:t,transitionEnd:n,...r},{transformValues:s},o){let i=e3(r,t||{},this);if(s&&(n&&(n=s(n)),r&&(r=s(r)),i&&(i=s(i))),o){JE(this,r,i);const a=AT(this,r,i,n);n=a.transitionEnd,r=a.target}return{transition:t,transitionEnd:n,...r}}}function FT(e){return window.getComputedStyle(e)}class zT extends S2{constructor(){super(...arguments),this.type="html"}readValueFromInstance(t,n){if(Fs.has(n)){const r=kg(n);return r&&r.default||0}else{const r=FT(t),s=(uk(n)?r.getPropertyValue(n):r[n])||0;return typeof s=="string"?s.trim():s}}measureInstanceViewportBox(t,{transformPagePoint:n}){return u2(t,n)}build(t,n,r,s){hg(t,n,r,s.transformTemplate)}scrapeMotionValuesFromProps(t,n){return mg(t,n)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;Ft(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}renderInstance(t,n,r,s){mk(t,n,r,s)}}class VT extends S2{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(Fs.has(n)){const r=kg(n);return r&&r.default||0}return n=yk.has(n)?n:ag(n),t.getAttribute(n)}measureInstanceViewportBox(){return Ve()}scrapeMotionValuesFromProps(t,n){return bk(t,n)}build(t,n,r,s){pg(t,n,r,this.isSVGTag,s.transformTemplate)}renderInstance(t,n,r,s){xk(t,n,r,s)}mount(t){this.isSVGTag=gg(t.tagName),super.mount(t)}}const BT=(e,t)=>dg(e)?new VT(t,{enableHardwareAcceleration:!1}):new zT(t,{enableHardwareAcceleration:!0}),$T={layout:{ProjectionNode:b2,MeasureLayout:h2}},HT={...g3,...O4,...vT,...$T},Oo=UR((e,t)=>k4(e,t,HT,BT));function _2(){const e=S.useRef(!1);return ig(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function UT(){const e=_2(),[t,n]=S.useState(0),r=S.useCallback(()=>{e.current&&n(t+1)},[t]);return[S.useCallback(()=>Se.postRender(r),[r]),t]}class WT extends S.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(n&&t.isPresent&&!this.props.isPresent){const r=this.props.sizeRef.current;r.height=n.offsetHeight||0,r.width=n.offsetWidth||0,r.top=n.offsetTop,r.left=n.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function GT({children:e,isPresent:t}){const n=S.useId(),r=S.useRef(null),s=S.useRef({width:0,height:0,top:0,left:0});return S.useInsertionEffect(()=>{const{width:o,height:i,top:a,left:l}=s.current;if(t||!r.current||!o||!i)return;r.current.dataset.motionPopId=n;const u=document.createElement("style");return document.head.appendChild(u),u.sheet&&u.sheet.insertRule(` [data-motion-pop-id="${n}"] { position: absolute !important; width: ${o}px !important; @@ -402,24 +402,24 @@ Error generating stack: `+o.message+` top: ${a}px !important; left: ${l}px !important; } - `),()=>{document.head.removeChild(u)}},[t]),S.createElement(WT,{isPresent:t,childRef:r,sizeRef:s},S.cloneElement(e,{ref:r}))}const Id=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:s,presenceAffectsLayout:o,mode:i})=>{const a=vk(qT),l=S.useId(),u=S.useMemo(()=>({id:l,initial:t,isPresent:n,custom:s,onExitComplete:d=>{a.set(d,!0);for(const h of a.values())if(!h)return;r&&r()},register:d=>(a.set(d,!1),()=>a.delete(d))}),o?void 0:[n]);return S.useMemo(()=>{a.forEach((d,h)=>a.set(h,!1))},[n]),S.useEffect(()=>{!n&&!a.size&&r&&r()},[n]),i==="popLayout"&&(e=S.createElement(GT,{isPresent:n},e)),S.createElement(ju.Provider,{value:u},e)};function qT(){return new Map}function KT(e){return S.useEffect(()=>()=>e(),[])}const ds=e=>e.key||"";function YT(e,t){e.forEach(n=>{const r=ds(n);t.set(r,n)})}function XT(e){const t=[];return S.Children.forEach(e,n=>{S.isValidElement(n)&&t.push(n)}),t}const QT=({children:e,custom:t,initial:n=!0,onExitComplete:r,exitBeforeEnter:s,presenceAffectsLayout:o=!0,mode:i="sync"})=>{const a=S.useContext(ug).forceRender||UT()[0],l=_2(),u=XT(e);let d=u;const h=S.useRef(new Map).current,f=S.useRef(d),p=S.useRef(new Map).current,g=S.useRef(!0);if(ig(()=>{g.current=!1,YT(u,p),f.current=d}),KT(()=>{g.current=!0,p.clear(),h.clear()}),g.current)return S.createElement(S.Fragment,null,d.map(v=>S.createElement(Id,{key:ds(v),isPresent:!0,initial:n?void 0:!1,presenceAffectsLayout:o,mode:i},v)));d=[...d];const m=f.current.map(ds),y=u.map(ds),x=m.length;for(let v=0;v{if(y.indexOf(b)!==-1)return;const k=p.get(b);if(!k)return;const w=m.indexOf(b);let j=v;if(!j){const N=()=>{h.delete(b);const _=Array.from(p.keys()).filter(P=>!y.includes(P));if(_.forEach(P=>p.delete(P)),f.current=u.filter(P=>{const A=ds(P);return A===b||_.includes(A)}),!h.size){if(l.current===!1)return;a(),r&&r()}};j=S.createElement(Id,{key:ds(k),isPresent:!1,onExitComplete:N,custom:t,presenceAffectsLayout:o,mode:i},k),h.set(b,j)}d.splice(w,0,j)}),d=d.map(v=>{const b=v.key;return h.has(b)?v:S.createElement(Id,{key:ds(v),isPresent:!0,presenceAffectsLayout:o,mode:i},v)}),S.createElement(S.Fragment,null,h.size?d:d.map(v=>S.cloneElement(v)))};function Ms({title:e,description:t,children:n,timeRange:r="7d",onTimeRangeChange:s,showTimeSelector:o=!0,className:i="h-[300px]"}){return c.jsxs(Lo.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"bg-white dark:bg-secondary p-6 rounded-xl shadow-md dark:shadow-lg dark:shadow-black/10 border border-gray-200 dark:border-white/5",children:[c.jsxs("div",{className:"flex items-start justify-between mb-6",children:[c.jsxs("div",{children:[c.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:e}),t&&c.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:t})]}),o&&s&&c.jsxs("select",{value:r,onChange:a=>s(a.target.value),className:"px-3 py-1.5 text-sm bg-white dark:bg-black/50 border border-gray-200 dark:border-white/10 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500 dark:text-white",children:[c.jsx("option",{value:"5m",children:"Last 5 Minutes"}),c.jsx("option",{value:"15m",children:"Last 15 Minutes"}),c.jsx("option",{value:"30m",children:"Last 30 Minutes"}),c.jsx("option",{value:"1h",children:"Last 1 Hour"}),c.jsx("option",{value:"2h",children:"Last 2 Hours"}),c.jsx("option",{value:"6h",children:"Last 6 Hours"}),c.jsx("option",{value:"12h",children:"Last 12 Hours"}),c.jsx("option",{value:"24h",children:"Last 24 Hours"}),c.jsx("option",{value:"7d",children:"Last 7 Days"}),c.jsx("option",{value:"30d",children:"Last 30 Days"}),c.jsx("option",{value:"60d",children:"Last 60 Days"}),c.jsx("option",{value:"90d",children:"Last 90 Days"})]})]}),c.jsx("div",{className:`${i} flex flex-col`,children:n})]})}function St({label:e,value:t,icon:n,color:r,change:s,trend:o="neutral"}){const i={up:"text-green-600 dark:text-green-400 bg-green-50 dark:bg-green-900/20",down:"text-red-600 dark:text-red-400 bg-red-50 dark:bg-red-900/20",neutral:"text-gray-600 dark:text-gray-400 bg-gray-50 dark:bg-gray-900/20"};return c.jsxs(Lo.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"bg-white dark:bg-secondary p-6 rounded-xl shadow-sm border border-gray-100 dark:border-white/5 hover:border-primary-500/20 transition-colors group",children:[c.jsxs("div",{className:"flex items-center justify-between mb-4",children:[c.jsx("div",{className:`p-2 rounded-lg ${r} bg-opacity-10 dark:bg-opacity-20 group-hover:scale-110 transition-transform`,children:c.jsx(n,{className:`w-5 h-5 ${r.replace("bg-","text-")}`})}),s&&c.jsx("span",{className:`text-xs font-medium px-2 py-1 rounded-full ${i[o]}`,children:s})]}),c.jsx("h3",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:e}),c.jsx("p",{className:"text-2xl font-bold text-gray-900 dark:text-white mt-1",children:t})]})}function j2({label:e,options:t,selected:n,onChange:r,className:s=""}){const[o,i]=S.useState(!1),a=S.useRef(null);S.useEffect(()=>{const h=f=>{a.current&&!a.current.contains(f.target)&&i(!1)};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[]);const l=h=>{const f=n.includes(h)?n.filter(p=>p!==h):[...n,h];r(f)},u=()=>{r(t.map(h=>h.value))},d=()=>{r([])};return c.jsxs("div",{className:`relative ${s}`,ref:a,children:[c.jsxs("button",{onClick:()=>i(!o),className:"flex items-center justify-between w-full md:w-64 px-4 py-2 bg-white dark:bg-secondary border border-gray-200 dark:border-white/10 rounded-lg shadow-sm hover:bg-gray-50 dark:hover:bg-white/5 transition-colors focus:outline-none focus:ring-2 focus:ring-primary-500",children:[c.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-200 truncate",children:n.length===0?e:n.length===t.length?"All Selected":`${n.length} Selected`}),c.jsx(G1,{className:`w-4 h-4 text-gray-500 transition-transform ${o?"rotate-180":""}`})]}),o&&c.jsxs("div",{className:"absolute z-50 w-full md:w-72 mt-2 bg-white dark:bg-secondary border border-gray-200 dark:border-white/10 rounded-xl shadow-lg overflow-hidden animate-in fade-in zoom-in-95 duration-100",children:[c.jsxs("div",{className:"p-2 border-b border-gray-200 dark:border-white/10 flex items-center justify-between bg-gray-50 dark:bg-white/5",children:[c.jsx("button",{onClick:u,className:"text-xs font-medium text-primary-600 hover:text-primary-700 dark:text-primary-400",children:"Select All"}),c.jsx("button",{onClick:d,className:"text-xs font-medium text-red-600 hover:text-red-700 dark:text-red-400",children:"Clear"})]}),c.jsx("div",{className:"max-h-64 overflow-y-auto p-2 space-y-1",children:t.map(h=>c.jsxs("button",{onClick:()=>l(h.value),className:"flex items-center w-full px-3 py-2 rounded-lg hover:bg-gray-100 dark:hover:bg-white/10 transition-colors group",children:[c.jsx("div",{className:`w-5 h-5 rounded border flex items-center justify-center mr-3 transition-colors ${n.includes(h.value)?"bg-primary-600 border-primary-600":"border-gray-300 dark:border-gray-600 group-hover:border-primary-500"}`,children:n.includes(h.value)&&c.jsx(vu,{className:"w-3.5 h-3.5 text-white"})}),h.color&&c.jsx("div",{className:"w-3 h-3 rounded-full mr-3 flex-shrink-0",style:{backgroundColor:h.color}}),c.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-200 truncate",children:h.label})]},h.value))})]})]})}function JT(e="7d"){const[t,n]=S.useState(null),[r,s]=S.useState(!0),[o,i]=S.useState(null);return S.useEffect(()=>{(async()=>{var l,u;try{const d=await ae.get(`/api/dashboard/usage?time_range=${e}`);console.log("Response from /api/dashboard/usage:",d.data),n(d.data),console.log(d.data)}catch(d){const h=((u=(l=d.response)==null?void 0:l.data)==null?void 0:u.detail)||"Failed to fetch dashboard data";i(h),_n.error(h)}finally{s(!1)}})()},[e]),{data:t,loading:r,error:o}}function C2(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t{const n=new Array(e.length+t.length);for(let r=0;r({classGroupId:e,validator:t}),N2=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),$c="-",ex=[],nA="arbitrary..",rA=e=>{const t=oA(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return sA(i);const a=i.split($c),l=a[0]===""&&a.length>1?1:0;return P2(a,l,t)},getConflictingClassGroupIds:(i,a)=>{if(a){const l=r[i],u=n[i];return l?u?eA(u,l):l:u||ex}return n[i]||ex}}},P2=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const s=e[t],o=n.nextPart.get(s);if(o){const u=P2(e,t+1,o);if(u)return u}const i=n.validators;if(i===null)return;const a=t===0?e.join($c):e.slice(t).join($c),l=i.length;for(let u=0;ue.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),r=t.slice(0,n);return r?nA+r:void 0})(),oA=e=>{const{theme:t,classGroups:n}=e;return iA(n,t)},iA=(e,t)=>{const n=N2();for(const r in e){const s=e[r];Pg(s,n,r,t)}return n},Pg=(e,t,n,r)=>{const s=e.length;for(let o=0;o{if(typeof e=="string"){lA(e,t,n);return}if(typeof e=="function"){cA(e,t,n,r);return}uA(e,t,n,r)},lA=(e,t,n)=>{const r=e===""?t:R2(t,e);r.classGroupId=n},cA=(e,t,n,r)=>{if(dA(e)){Pg(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(tA(n,e))},uA=(e,t,n,r)=>{const s=Object.entries(e),o=s.length;for(let i=0;i{let n=e;const r=t.split($c),s=r.length;for(let o=0;o"isThemeGetter"in e&&e.isThemeGetter===!0,hA=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const s=(o,i)=>{n[o]=i,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(o){let i=n[o];if(i!==void 0)return i;if((i=r[o])!==void 0)return s(o,i),i},set(o,i){o in n?n[o]=i:s(o,i)}}},Pf="!",tx=":",fA=[],nx=(e,t,n,r,s)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:s}),pA=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=s=>{const o=[];let i=0,a=0,l=0,u;const d=s.length;for(let m=0;ml?u-l:void 0;return nx(o,p,f,g)};if(t){const s=t+tx,o=r;r=i=>i.startsWith(s)?o(i.slice(s.length)):nx(fA,!1,i,void 0,!0)}if(n){const s=r;r=o=>n({className:o,parseClassName:s})}return r},gA=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,r)=>{t.set(n,1e6+r)}),n=>{const r=[];let s=[];for(let o=0;o0&&(s.sort(),r.push(...s),s=[]),r.push(i)):s.push(i)}return s.length>0&&(s.sort(),r.push(...s)),r}},mA=e=>({cache:hA(e.cacheSize),parseClassName:pA(e),sortModifiers:gA(e),...rA(e)}),yA=/\s+/,xA=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s,sortModifiers:o}=t,i=[],a=e.trim().split(yA);let l="";for(let u=a.length-1;u>=0;u-=1){const d=a[u],{isExternal:h,modifiers:f,hasImportantModifier:p,baseClassName:g,maybePostfixModifierPosition:m}=n(d);if(h){l=d+(l.length>0?" "+l:l);continue}let y=!!m,x=r(y?g.substring(0,m):g);if(!x){if(!y){l=d+(l.length>0?" "+l:l);continue}if(x=r(g),!x){l=d+(l.length>0?" "+l:l);continue}y=!1}const v=f.length===0?"":f.length===1?f[0]:o(f).join(":"),b=p?v+Pf:v,k=b+x;if(i.indexOf(k)>-1)continue;i.push(k);const w=s(x,y);for(let j=0;j0?" "+l:l)}return l},bA=(...e)=>{let t=0,n,r,s="";for(;t{if(typeof e=="string")return e;let t,n="";for(let r=0;r{let n,r,s,o;const i=l=>{const u=t.reduce((d,h)=>h(d),e());return n=mA(u),r=n.cache.get,s=n.cache.set,o=a,a(l)},a=l=>{const u=r(l);if(u)return u;const d=xA(l,n);return s(l,d),d};return o=i,(...l)=>o(bA(...l))},wA=[],He=e=>{const t=n=>n[e]||wA;return t.isThemeGetter=!0,t},T2=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,A2=/^\((?:(\w[\w-]*):)?(.+)\)$/i,kA=/^\d+\/\d+$/,SA=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,_A=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,jA=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,CA=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,NA=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,qs=e=>kA.test(e),le=e=>!!e&&!Number.isNaN(Number(e)),dr=e=>!!e&&Number.isInteger(Number(e)),Fd=e=>e.endsWith("%")&&le(e.slice(0,-1)),Fn=e=>SA.test(e),PA=()=>!0,RA=e=>_A.test(e)&&!jA.test(e),M2=()=>!1,EA=e=>CA.test(e),TA=e=>NA.test(e),AA=e=>!X(e)&&!Q(e),MA=e=>qo(e,D2,M2),X=e=>T2.test(e),rs=e=>qo(e,I2,RA),zd=e=>qo(e,FA,le),rx=e=>qo(e,L2,M2),LA=e=>qo(e,O2,TA),ml=e=>qo(e,F2,EA),Q=e=>A2.test(e),ui=e=>Ko(e,I2),OA=e=>Ko(e,zA),sx=e=>Ko(e,L2),DA=e=>Ko(e,D2),IA=e=>Ko(e,O2),yl=e=>Ko(e,F2,!0),qo=(e,t,n)=>{const r=T2.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Ko=(e,t,n=!1)=>{const r=A2.exec(e);return r?r[1]?t(r[1]):n:!1},L2=e=>e==="position"||e==="percentage",O2=e=>e==="image"||e==="url",D2=e=>e==="length"||e==="size"||e==="bg-size",I2=e=>e==="length",FA=e=>e==="number",zA=e=>e==="family-name",F2=e=>e==="shadow",VA=()=>{const e=He("color"),t=He("font"),n=He("text"),r=He("font-weight"),s=He("tracking"),o=He("leading"),i=He("breakpoint"),a=He("container"),l=He("spacing"),u=He("radius"),d=He("shadow"),h=He("inset-shadow"),f=He("text-shadow"),p=He("drop-shadow"),g=He("blur"),m=He("perspective"),y=He("aspect"),x=He("ease"),v=He("animate"),b=()=>["auto","avoid","all","avoid-page","page","left","right","column"],k=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],w=()=>[...k(),Q,X],j=()=>["auto","hidden","clip","visible","scroll"],N=()=>["auto","contain","none"],_=()=>[Q,X,l],P=()=>[qs,"full","auto",..._()],A=()=>[dr,"none","subgrid",Q,X],O=()=>["auto",{span:["full",dr,Q,X]},dr,Q,X],F=()=>[dr,"auto",Q,X],D=()=>["auto","min","max","fr",Q,X],U=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],W=()=>["start","end","center","stretch","center-safe","end-safe"],M=()=>["auto",..._()],H=()=>[qs,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",..._()],C=()=>[e,Q,X],L=()=>[...k(),sx,rx,{position:[Q,X]}],E=()=>["no-repeat",{repeat:["","x","y","space","round"]}],I=()=>["auto","cover","contain",DA,MA,{size:[Q,X]}],Y=()=>[Fd,ui,rs],T=()=>["","none","full",u,Q,X],$=()=>["",le,ui,rs],q=()=>["solid","dashed","dotted","double"],ne=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ce=()=>[le,Fd,sx,rx],fe=()=>["","none",g,Q,X],nt=()=>["none",le,Q,X],lt=()=>["none",le,Q,X],Ye=()=>[le,Q,X],Jt=()=>[qs,"full",..._()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Fn],breakpoint:[Fn],color:[PA],container:[Fn],"drop-shadow":[Fn],ease:["in","out","in-out"],font:[AA],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Fn],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Fn],shadow:[Fn],spacing:["px",le],text:[Fn],"text-shadow":[Fn],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",qs,X,Q,y]}],container:["container"],columns:[{columns:[le,X,Q,a]}],"break-after":[{"break-after":b()}],"break-before":[{"break-before":b()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:w()}],overflow:[{overflow:j()}],"overflow-x":[{"overflow-x":j()}],"overflow-y":[{"overflow-y":j()}],overscroll:[{overscroll:N()}],"overscroll-x":[{"overscroll-x":N()}],"overscroll-y":[{"overscroll-y":N()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:P()}],"inset-x":[{"inset-x":P()}],"inset-y":[{"inset-y":P()}],start:[{start:P()}],end:[{end:P()}],top:[{top:P()}],right:[{right:P()}],bottom:[{bottom:P()}],left:[{left:P()}],visibility:["visible","invisible","collapse"],z:[{z:[dr,"auto",Q,X]}],basis:[{basis:[qs,"full","auto",a,..._()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[le,qs,"auto","initial","none",X]}],grow:[{grow:["",le,Q,X]}],shrink:[{shrink:["",le,Q,X]}],order:[{order:[dr,"first","last","none",Q,X]}],"grid-cols":[{"grid-cols":A()}],"col-start-end":[{col:O()}],"col-start":[{"col-start":F()}],"col-end":[{"col-end":F()}],"grid-rows":[{"grid-rows":A()}],"row-start-end":[{row:O()}],"row-start":[{"row-start":F()}],"row-end":[{"row-end":F()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":D()}],"auto-rows":[{"auto-rows":D()}],gap:[{gap:_()}],"gap-x":[{"gap-x":_()}],"gap-y":[{"gap-y":_()}],"justify-content":[{justify:[...U(),"normal"]}],"justify-items":[{"justify-items":[...W(),"normal"]}],"justify-self":[{"justify-self":["auto",...W()]}],"align-content":[{content:["normal",...U()]}],"align-items":[{items:[...W(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...W(),{baseline:["","last"]}]}],"place-content":[{"place-content":U()}],"place-items":[{"place-items":[...W(),"baseline"]}],"place-self":[{"place-self":["auto",...W()]}],p:[{p:_()}],px:[{px:_()}],py:[{py:_()}],ps:[{ps:_()}],pe:[{pe:_()}],pt:[{pt:_()}],pr:[{pr:_()}],pb:[{pb:_()}],pl:[{pl:_()}],m:[{m:M()}],mx:[{mx:M()}],my:[{my:M()}],ms:[{ms:M()}],me:[{me:M()}],mt:[{mt:M()}],mr:[{mr:M()}],mb:[{mb:M()}],ml:[{ml:M()}],"space-x":[{"space-x":_()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":_()}],"space-y-reverse":["space-y-reverse"],size:[{size:H()}],w:[{w:[a,"screen",...H()]}],"min-w":[{"min-w":[a,"screen","none",...H()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[i]},...H()]}],h:[{h:["screen","lh",...H()]}],"min-h":[{"min-h":["screen","lh","none",...H()]}],"max-h":[{"max-h":["screen","lh",...H()]}],"font-size":[{text:["base",n,ui,rs]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,Q,zd]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Fd,X]}],"font-family":[{font:[OA,X,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[s,Q,X]}],"line-clamp":[{"line-clamp":[le,"none",Q,zd]}],leading:[{leading:[o,..._()]}],"list-image":[{"list-image":["none",Q,X]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Q,X]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:C()}],"text-color":[{text:C()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...q(),"wavy"]}],"text-decoration-thickness":[{decoration:[le,"from-font","auto",Q,rs]}],"text-decoration-color":[{decoration:C()}],"underline-offset":[{"underline-offset":[le,"auto",Q,X]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:_()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Q,X]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Q,X]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:L()}],"bg-repeat":[{bg:E()}],"bg-size":[{bg:I()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},dr,Q,X],radial:["",Q,X],conic:[dr,Q,X]},IA,LA]}],"bg-color":[{bg:C()}],"gradient-from-pos":[{from:Y()}],"gradient-via-pos":[{via:Y()}],"gradient-to-pos":[{to:Y()}],"gradient-from":[{from:C()}],"gradient-via":[{via:C()}],"gradient-to":[{to:C()}],rounded:[{rounded:T()}],"rounded-s":[{"rounded-s":T()}],"rounded-e":[{"rounded-e":T()}],"rounded-t":[{"rounded-t":T()}],"rounded-r":[{"rounded-r":T()}],"rounded-b":[{"rounded-b":T()}],"rounded-l":[{"rounded-l":T()}],"rounded-ss":[{"rounded-ss":T()}],"rounded-se":[{"rounded-se":T()}],"rounded-ee":[{"rounded-ee":T()}],"rounded-es":[{"rounded-es":T()}],"rounded-tl":[{"rounded-tl":T()}],"rounded-tr":[{"rounded-tr":T()}],"rounded-br":[{"rounded-br":T()}],"rounded-bl":[{"rounded-bl":T()}],"border-w":[{border:$()}],"border-w-x":[{"border-x":$()}],"border-w-y":[{"border-y":$()}],"border-w-s":[{"border-s":$()}],"border-w-e":[{"border-e":$()}],"border-w-t":[{"border-t":$()}],"border-w-r":[{"border-r":$()}],"border-w-b":[{"border-b":$()}],"border-w-l":[{"border-l":$()}],"divide-x":[{"divide-x":$()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":$()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...q(),"hidden","none"]}],"divide-style":[{divide:[...q(),"hidden","none"]}],"border-color":[{border:C()}],"border-color-x":[{"border-x":C()}],"border-color-y":[{"border-y":C()}],"border-color-s":[{"border-s":C()}],"border-color-e":[{"border-e":C()}],"border-color-t":[{"border-t":C()}],"border-color-r":[{"border-r":C()}],"border-color-b":[{"border-b":C()}],"border-color-l":[{"border-l":C()}],"divide-color":[{divide:C()}],"outline-style":[{outline:[...q(),"none","hidden"]}],"outline-offset":[{"outline-offset":[le,Q,X]}],"outline-w":[{outline:["",le,ui,rs]}],"outline-color":[{outline:C()}],shadow:[{shadow:["","none",d,yl,ml]}],"shadow-color":[{shadow:C()}],"inset-shadow":[{"inset-shadow":["none",h,yl,ml]}],"inset-shadow-color":[{"inset-shadow":C()}],"ring-w":[{ring:$()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:C()}],"ring-offset-w":[{"ring-offset":[le,rs]}],"ring-offset-color":[{"ring-offset":C()}],"inset-ring-w":[{"inset-ring":$()}],"inset-ring-color":[{"inset-ring":C()}],"text-shadow":[{"text-shadow":["none",f,yl,ml]}],"text-shadow-color":[{"text-shadow":C()}],opacity:[{opacity:[le,Q,X]}],"mix-blend":[{"mix-blend":[...ne(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ne()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[le]}],"mask-image-linear-from-pos":[{"mask-linear-from":ce()}],"mask-image-linear-to-pos":[{"mask-linear-to":ce()}],"mask-image-linear-from-color":[{"mask-linear-from":C()}],"mask-image-linear-to-color":[{"mask-linear-to":C()}],"mask-image-t-from-pos":[{"mask-t-from":ce()}],"mask-image-t-to-pos":[{"mask-t-to":ce()}],"mask-image-t-from-color":[{"mask-t-from":C()}],"mask-image-t-to-color":[{"mask-t-to":C()}],"mask-image-r-from-pos":[{"mask-r-from":ce()}],"mask-image-r-to-pos":[{"mask-r-to":ce()}],"mask-image-r-from-color":[{"mask-r-from":C()}],"mask-image-r-to-color":[{"mask-r-to":C()}],"mask-image-b-from-pos":[{"mask-b-from":ce()}],"mask-image-b-to-pos":[{"mask-b-to":ce()}],"mask-image-b-from-color":[{"mask-b-from":C()}],"mask-image-b-to-color":[{"mask-b-to":C()}],"mask-image-l-from-pos":[{"mask-l-from":ce()}],"mask-image-l-to-pos":[{"mask-l-to":ce()}],"mask-image-l-from-color":[{"mask-l-from":C()}],"mask-image-l-to-color":[{"mask-l-to":C()}],"mask-image-x-from-pos":[{"mask-x-from":ce()}],"mask-image-x-to-pos":[{"mask-x-to":ce()}],"mask-image-x-from-color":[{"mask-x-from":C()}],"mask-image-x-to-color":[{"mask-x-to":C()}],"mask-image-y-from-pos":[{"mask-y-from":ce()}],"mask-image-y-to-pos":[{"mask-y-to":ce()}],"mask-image-y-from-color":[{"mask-y-from":C()}],"mask-image-y-to-color":[{"mask-y-to":C()}],"mask-image-radial":[{"mask-radial":[Q,X]}],"mask-image-radial-from-pos":[{"mask-radial-from":ce()}],"mask-image-radial-to-pos":[{"mask-radial-to":ce()}],"mask-image-radial-from-color":[{"mask-radial-from":C()}],"mask-image-radial-to-color":[{"mask-radial-to":C()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":k()}],"mask-image-conic-pos":[{"mask-conic":[le]}],"mask-image-conic-from-pos":[{"mask-conic-from":ce()}],"mask-image-conic-to-pos":[{"mask-conic-to":ce()}],"mask-image-conic-from-color":[{"mask-conic-from":C()}],"mask-image-conic-to-color":[{"mask-conic-to":C()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:L()}],"mask-repeat":[{mask:E()}],"mask-size":[{mask:I()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Q,X]}],filter:[{filter:["","none",Q,X]}],blur:[{blur:fe()}],brightness:[{brightness:[le,Q,X]}],contrast:[{contrast:[le,Q,X]}],"drop-shadow":[{"drop-shadow":["","none",p,yl,ml]}],"drop-shadow-color":[{"drop-shadow":C()}],grayscale:[{grayscale:["",le,Q,X]}],"hue-rotate":[{"hue-rotate":[le,Q,X]}],invert:[{invert:["",le,Q,X]}],saturate:[{saturate:[le,Q,X]}],sepia:[{sepia:["",le,Q,X]}],"backdrop-filter":[{"backdrop-filter":["","none",Q,X]}],"backdrop-blur":[{"backdrop-blur":fe()}],"backdrop-brightness":[{"backdrop-brightness":[le,Q,X]}],"backdrop-contrast":[{"backdrop-contrast":[le,Q,X]}],"backdrop-grayscale":[{"backdrop-grayscale":["",le,Q,X]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[le,Q,X]}],"backdrop-invert":[{"backdrop-invert":["",le,Q,X]}],"backdrop-opacity":[{"backdrop-opacity":[le,Q,X]}],"backdrop-saturate":[{"backdrop-saturate":[le,Q,X]}],"backdrop-sepia":[{"backdrop-sepia":["",le,Q,X]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":_()}],"border-spacing-x":[{"border-spacing-x":_()}],"border-spacing-y":[{"border-spacing-y":_()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Q,X]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[le,"initial",Q,X]}],ease:[{ease:["linear","initial",x,Q,X]}],delay:[{delay:[le,Q,X]}],animate:[{animate:["none",v,Q,X]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[m,Q,X]}],"perspective-origin":[{"perspective-origin":w()}],rotate:[{rotate:nt()}],"rotate-x":[{"rotate-x":nt()}],"rotate-y":[{"rotate-y":nt()}],"rotate-z":[{"rotate-z":nt()}],scale:[{scale:lt()}],"scale-x":[{"scale-x":lt()}],"scale-y":[{"scale-y":lt()}],"scale-z":[{"scale-z":lt()}],"scale-3d":["scale-3d"],skew:[{skew:Ye()}],"skew-x":[{"skew-x":Ye()}],"skew-y":[{"skew-y":Ye()}],transform:[{transform:[Q,X,"","none","gpu","cpu"]}],"transform-origin":[{origin:w()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Jt()}],"translate-x":[{"translate-x":Jt()}],"translate-y":[{"translate-y":Jt()}],"translate-z":[{"translate-z":Jt()}],"translate-none":["translate-none"],accent:[{accent:C()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:C()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Q,X]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":_()}],"scroll-mx":[{"scroll-mx":_()}],"scroll-my":[{"scroll-my":_()}],"scroll-ms":[{"scroll-ms":_()}],"scroll-me":[{"scroll-me":_()}],"scroll-mt":[{"scroll-mt":_()}],"scroll-mr":[{"scroll-mr":_()}],"scroll-mb":[{"scroll-mb":_()}],"scroll-ml":[{"scroll-ml":_()}],"scroll-p":[{"scroll-p":_()}],"scroll-px":[{"scroll-px":_()}],"scroll-py":[{"scroll-py":_()}],"scroll-ps":[{"scroll-ps":_()}],"scroll-pe":[{"scroll-pe":_()}],"scroll-pt":[{"scroll-pt":_()}],"scroll-pr":[{"scroll-pr":_()}],"scroll-pb":[{"scroll-pb":_()}],"scroll-pl":[{"scroll-pl":_()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Q,X]}],fill:[{fill:["none",...C()]}],"stroke-w":[{stroke:[le,ui,rs,zd]}],stroke:[{stroke:["none",...C()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},BA=vA(VA);function lr(...e){return BA(ZT(e))}function me({className:e,...t}){return c.jsx("div",{className:lr("animate-pulse rounded-md bg-neutral-200 dark:bg-neutral-700",e),...t})}function ox(){const[e,t]=S.useState(!1);return S.useEffect(()=>{(async()=>{try{const r=await ae.get("/auth/profile/status");t(!r.data.is_complete)}catch{t(!1)}})()},[]),e?c.jsxs("div",{className:"bg-gradient-to-r from-primary-500/10 to-primary-500/5 border border-primary-500/20 rounded-xl p-4 mb-6 flex items-center justify-between gap-4",children:[c.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[c.jsx("div",{className:"w-9 h-9 rounded-lg bg-primary-500/15 flex items-center justify-center flex-shrink-0",children:c.jsx(To,{className:"w-[18px] h-[18px] text-primary-600 dark:text-primary-400"})}),c.jsxs("div",{children:[c.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"Complete your profile"}),c.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Add your organization type and impact sectors to help us understand how Sunbird AI is being used."})]})]}),c.jsx(Ee,{to:"/complete-profile",className:"px-5 py-2 bg-primary-600 hover:bg-primary-700 text-white text-sm font-medium rounded-lg transition-colors shadow-sm shadow-primary-500/20 whitespace-nowrap",children:"Update Profile"})]}):null}/*! + `),()=>{document.head.removeChild(u)}},[t]),S.createElement(WT,{isPresent:t,childRef:r,sizeRef:s},S.cloneElement(e,{ref:r}))}const Id=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:s,presenceAffectsLayout:o,mode:i})=>{const a=vk(KT),l=S.useId(),u=S.useMemo(()=>({id:l,initial:t,isPresent:n,custom:s,onExitComplete:d=>{a.set(d,!0);for(const h of a.values())if(!h)return;r&&r()},register:d=>(a.set(d,!1),()=>a.delete(d))}),o?void 0:[n]);return S.useMemo(()=>{a.forEach((d,h)=>a.set(h,!1))},[n]),S.useEffect(()=>{!n&&!a.size&&r&&r()},[n]),i==="popLayout"&&(e=S.createElement(GT,{isPresent:n},e)),S.createElement(ju.Provider,{value:u},e)};function KT(){return new Map}function qT(e){return S.useEffect(()=>()=>e(),[])}const ds=e=>e.key||"";function YT(e,t){e.forEach(n=>{const r=ds(n);t.set(r,n)})}function XT(e){const t=[];return S.Children.forEach(e,n=>{S.isValidElement(n)&&t.push(n)}),t}const QT=({children:e,custom:t,initial:n=!0,onExitComplete:r,exitBeforeEnter:s,presenceAffectsLayout:o=!0,mode:i="sync"})=>{const a=S.useContext(ug).forceRender||UT()[0],l=_2(),u=XT(e);let d=u;const h=S.useRef(new Map).current,f=S.useRef(d),p=S.useRef(new Map).current,g=S.useRef(!0);if(ig(()=>{g.current=!1,YT(u,p),f.current=d}),qT(()=>{g.current=!0,p.clear(),h.clear()}),g.current)return S.createElement(S.Fragment,null,d.map(v=>S.createElement(Id,{key:ds(v),isPresent:!0,initial:n?void 0:!1,presenceAffectsLayout:o,mode:i},v)));d=[...d];const m=f.current.map(ds),y=u.map(ds),x=m.length;for(let v=0;v{if(y.indexOf(b)!==-1)return;const k=p.get(b);if(!k)return;const w=m.indexOf(b);let j=v;if(!j){const N=()=>{h.delete(b);const _=Array.from(p.keys()).filter(P=>!y.includes(P));if(_.forEach(P=>p.delete(P)),f.current=u.filter(P=>{const A=ds(P);return A===b||_.includes(A)}),!h.size){if(l.current===!1)return;a(),r&&r()}};j=S.createElement(Id,{key:ds(k),isPresent:!1,onExitComplete:N,custom:t,presenceAffectsLayout:o,mode:i},k),h.set(b,j)}d.splice(w,0,j)}),d=d.map(v=>{const b=v.key;return h.has(b)?v:S.createElement(Id,{key:ds(v),isPresent:!0,presenceAffectsLayout:o,mode:i},v)}),S.createElement(S.Fragment,null,h.size?d:d.map(v=>S.cloneElement(v)))};function Ms({title:e,description:t,children:n,timeRange:r="7d",onTimeRangeChange:s,showTimeSelector:o=!0,className:i="h-[300px]"}){return c.jsxs(Oo.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"bg-white dark:bg-secondary p-6 rounded-xl shadow-md dark:shadow-lg dark:shadow-black/10 border border-gray-200 dark:border-white/5",children:[c.jsxs("div",{className:"flex items-start justify-between mb-6",children:[c.jsxs("div",{children:[c.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:e}),t&&c.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:t})]}),o&&s&&c.jsxs("select",{value:r,onChange:a=>s(a.target.value),className:"px-3 py-1.5 text-sm bg-white dark:bg-black/50 border border-gray-200 dark:border-white/10 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500 dark:text-white",children:[c.jsx("option",{value:"5m",children:"Last 5 Minutes"}),c.jsx("option",{value:"15m",children:"Last 15 Minutes"}),c.jsx("option",{value:"30m",children:"Last 30 Minutes"}),c.jsx("option",{value:"1h",children:"Last 1 Hour"}),c.jsx("option",{value:"2h",children:"Last 2 Hours"}),c.jsx("option",{value:"6h",children:"Last 6 Hours"}),c.jsx("option",{value:"12h",children:"Last 12 Hours"}),c.jsx("option",{value:"24h",children:"Last 24 Hours"}),c.jsx("option",{value:"7d",children:"Last 7 Days"}),c.jsx("option",{value:"30d",children:"Last 30 Days"}),c.jsx("option",{value:"60d",children:"Last 60 Days"}),c.jsx("option",{value:"90d",children:"Last 90 Days"})]})]}),c.jsx("div",{className:`${i} flex flex-col`,children:n})]})}function St({label:e,value:t,icon:n,color:r,change:s,trend:o="neutral"}){const i={up:"text-green-600 dark:text-green-400 bg-green-50 dark:bg-green-900/20",down:"text-red-600 dark:text-red-400 bg-red-50 dark:bg-red-900/20",neutral:"text-gray-600 dark:text-gray-400 bg-gray-50 dark:bg-gray-900/20"};return c.jsxs(Oo.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"bg-white dark:bg-secondary p-6 rounded-xl shadow-sm border border-gray-100 dark:border-white/5 hover:border-primary-500/20 transition-colors group",children:[c.jsxs("div",{className:"flex items-center justify-between mb-4",children:[c.jsx("div",{className:`p-2 rounded-lg ${r} bg-opacity-10 dark:bg-opacity-20 group-hover:scale-110 transition-transform`,children:c.jsx(n,{className:`w-5 h-5 ${r.replace("bg-","text-")}`})}),s&&c.jsx("span",{className:`text-xs font-medium px-2 py-1 rounded-full ${i[o]}`,children:s})]}),c.jsx("h3",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:e}),c.jsx("p",{className:"text-2xl font-bold text-gray-900 dark:text-white mt-1",children:t})]})}function j2({label:e,options:t,selected:n,onChange:r,className:s=""}){const[o,i]=S.useState(!1),a=S.useRef(null);S.useEffect(()=>{const h=f=>{a.current&&!a.current.contains(f.target)&&i(!1)};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[]);const l=h=>{const f=n.includes(h)?n.filter(p=>p!==h):[...n,h];r(f)},u=()=>{r(t.map(h=>h.value))},d=()=>{r([])};return c.jsxs("div",{className:`relative ${s}`,ref:a,children:[c.jsxs("button",{onClick:()=>i(!o),className:"flex items-center justify-between w-full md:w-64 px-4 py-2 bg-white dark:bg-secondary border border-gray-200 dark:border-white/10 rounded-lg shadow-sm hover:bg-gray-50 dark:hover:bg-white/5 transition-colors focus:outline-none focus:ring-2 focus:ring-primary-500",children:[c.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-200 truncate",children:n.length===0?e:n.length===t.length?"All Selected":`${n.length} Selected`}),c.jsx(G1,{className:`w-4 h-4 text-gray-500 transition-transform ${o?"rotate-180":""}`})]}),o&&c.jsxs("div",{className:"absolute z-50 w-full md:w-72 mt-2 bg-white dark:bg-secondary border border-gray-200 dark:border-white/10 rounded-xl shadow-lg overflow-hidden animate-in fade-in zoom-in-95 duration-100",children:[c.jsxs("div",{className:"p-2 border-b border-gray-200 dark:border-white/10 flex items-center justify-between bg-gray-50 dark:bg-white/5",children:[c.jsx("button",{onClick:u,className:"text-xs font-medium text-primary-600 hover:text-primary-700 dark:text-primary-400",children:"Select All"}),c.jsx("button",{onClick:d,className:"text-xs font-medium text-red-600 hover:text-red-700 dark:text-red-400",children:"Clear"})]}),c.jsx("div",{className:"max-h-64 overflow-y-auto p-2 space-y-1",children:t.map(h=>c.jsxs("button",{onClick:()=>l(h.value),className:"flex items-center w-full px-3 py-2 rounded-lg hover:bg-gray-100 dark:hover:bg-white/10 transition-colors group",children:[c.jsx("div",{className:`w-5 h-5 rounded border flex items-center justify-center mr-3 transition-colors ${n.includes(h.value)?"bg-primary-600 border-primary-600":"border-gray-300 dark:border-gray-600 group-hover:border-primary-500"}`,children:n.includes(h.value)&&c.jsx(vu,{className:"w-3.5 h-3.5 text-white"})}),h.color&&c.jsx("div",{className:"w-3 h-3 rounded-full mr-3 flex-shrink-0",style:{backgroundColor:h.color}}),c.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-200 truncate",children:h.label})]},h.value))})]})]})}function JT(e="7d"){const[t,n]=S.useState(null),[r,s]=S.useState(!0),[o,i]=S.useState(null);return S.useEffect(()=>{(async()=>{var l,u;try{const d=await ae.get(`/api/dashboard/usage?time_range=${e}`);console.log("Response from /api/dashboard/usage:",d.data),n(d.data),console.log(d.data)}catch(d){const h=((u=(l=d.response)==null?void 0:l.data)==null?void 0:u.detail)||"Failed to fetch dashboard data";i(h),_n.error(h)}finally{s(!1)}})()},[e]),{data:t,loading:r,error:o}}function C2(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t{const n=new Array(e.length+t.length);for(let r=0;r({classGroupId:e,validator:t}),N2=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),$c="-",ex=[],nA="arbitrary..",rA=e=>{const t=oA(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return sA(i);const a=i.split($c),l=a[0]===""&&a.length>1?1:0;return P2(a,l,t)},getConflictingClassGroupIds:(i,a)=>{if(a){const l=r[i],u=n[i];return l?u?eA(u,l):l:u||ex}return n[i]||ex}}},P2=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const s=e[t],o=n.nextPart.get(s);if(o){const u=P2(e,t+1,o);if(u)return u}const i=n.validators;if(i===null)return;const a=t===0?e.join($c):e.slice(t).join($c),l=i.length;for(let u=0;ue.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),r=t.slice(0,n);return r?nA+r:void 0})(),oA=e=>{const{theme:t,classGroups:n}=e;return iA(n,t)},iA=(e,t)=>{const n=N2();for(const r in e){const s=e[r];Pg(s,n,r,t)}return n},Pg=(e,t,n,r)=>{const s=e.length;for(let o=0;o{if(typeof e=="string"){lA(e,t,n);return}if(typeof e=="function"){cA(e,t,n,r);return}uA(e,t,n,r)},lA=(e,t,n)=>{const r=e===""?t:R2(t,e);r.classGroupId=n},cA=(e,t,n,r)=>{if(dA(e)){Pg(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(tA(n,e))},uA=(e,t,n,r)=>{const s=Object.entries(e),o=s.length;for(let i=0;i{let n=e;const r=t.split($c),s=r.length;for(let o=0;o"isThemeGetter"in e&&e.isThemeGetter===!0,hA=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const s=(o,i)=>{n[o]=i,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(o){let i=n[o];if(i!==void 0)return i;if((i=r[o])!==void 0)return s(o,i),i},set(o,i){o in n?n[o]=i:s(o,i)}}},Pf="!",tx=":",fA=[],nx=(e,t,n,r,s)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:s}),pA=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=s=>{const o=[];let i=0,a=0,l=0,u;const d=s.length;for(let m=0;ml?u-l:void 0;return nx(o,p,f,g)};if(t){const s=t+tx,o=r;r=i=>i.startsWith(s)?o(i.slice(s.length)):nx(fA,!1,i,void 0,!0)}if(n){const s=r;r=o=>n({className:o,parseClassName:s})}return r},gA=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,r)=>{t.set(n,1e6+r)}),n=>{const r=[];let s=[];for(let o=0;o0&&(s.sort(),r.push(...s),s=[]),r.push(i)):s.push(i)}return s.length>0&&(s.sort(),r.push(...s)),r}},mA=e=>({cache:hA(e.cacheSize),parseClassName:pA(e),sortModifiers:gA(e),...rA(e)}),yA=/\s+/,xA=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s,sortModifiers:o}=t,i=[],a=e.trim().split(yA);let l="";for(let u=a.length-1;u>=0;u-=1){const d=a[u],{isExternal:h,modifiers:f,hasImportantModifier:p,baseClassName:g,maybePostfixModifierPosition:m}=n(d);if(h){l=d+(l.length>0?" "+l:l);continue}let y=!!m,x=r(y?g.substring(0,m):g);if(!x){if(!y){l=d+(l.length>0?" "+l:l);continue}if(x=r(g),!x){l=d+(l.length>0?" "+l:l);continue}y=!1}const v=f.length===0?"":f.length===1?f[0]:o(f).join(":"),b=p?v+Pf:v,k=b+x;if(i.indexOf(k)>-1)continue;i.push(k);const w=s(x,y);for(let j=0;j0?" "+l:l)}return l},bA=(...e)=>{let t=0,n,r,s="";for(;t{if(typeof e=="string")return e;let t,n="";for(let r=0;r{let n,r,s,o;const i=l=>{const u=t.reduce((d,h)=>h(d),e());return n=mA(u),r=n.cache.get,s=n.cache.set,o=a,a(l)},a=l=>{const u=r(l);if(u)return u;const d=xA(l,n);return s(l,d),d};return o=i,(...l)=>o(bA(...l))},wA=[],He=e=>{const t=n=>n[e]||wA;return t.isThemeGetter=!0,t},T2=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,A2=/^\((?:(\w[\w-]*):)?(.+)\)$/i,kA=/^\d+\/\d+$/,SA=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,_A=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,jA=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,CA=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,NA=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ks=e=>kA.test(e),le=e=>!!e&&!Number.isNaN(Number(e)),dr=e=>!!e&&Number.isInteger(Number(e)),Fd=e=>e.endsWith("%")&&le(e.slice(0,-1)),Fn=e=>SA.test(e),PA=()=>!0,RA=e=>_A.test(e)&&!jA.test(e),M2=()=>!1,EA=e=>CA.test(e),TA=e=>NA.test(e),AA=e=>!X(e)&&!Q(e),MA=e=>qo(e,D2,M2),X=e=>T2.test(e),rs=e=>qo(e,I2,RA),zd=e=>qo(e,FA,le),rx=e=>qo(e,L2,M2),LA=e=>qo(e,O2,TA),ml=e=>qo(e,F2,EA),Q=e=>A2.test(e),di=e=>Yo(e,I2),OA=e=>Yo(e,zA),sx=e=>Yo(e,L2),DA=e=>Yo(e,D2),IA=e=>Yo(e,O2),yl=e=>Yo(e,F2,!0),qo=(e,t,n)=>{const r=T2.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Yo=(e,t,n=!1)=>{const r=A2.exec(e);return r?r[1]?t(r[1]):n:!1},L2=e=>e==="position"||e==="percentage",O2=e=>e==="image"||e==="url",D2=e=>e==="length"||e==="size"||e==="bg-size",I2=e=>e==="length",FA=e=>e==="number",zA=e=>e==="family-name",F2=e=>e==="shadow",VA=()=>{const e=He("color"),t=He("font"),n=He("text"),r=He("font-weight"),s=He("tracking"),o=He("leading"),i=He("breakpoint"),a=He("container"),l=He("spacing"),u=He("radius"),d=He("shadow"),h=He("inset-shadow"),f=He("text-shadow"),p=He("drop-shadow"),g=He("blur"),m=He("perspective"),y=He("aspect"),x=He("ease"),v=He("animate"),b=()=>["auto","avoid","all","avoid-page","page","left","right","column"],k=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],w=()=>[...k(),Q,X],j=()=>["auto","hidden","clip","visible","scroll"],N=()=>["auto","contain","none"],_=()=>[Q,X,l],P=()=>[Ks,"full","auto",..._()],A=()=>[dr,"none","subgrid",Q,X],O=()=>["auto",{span:["full",dr,Q,X]},dr,Q,X],F=()=>[dr,"auto",Q,X],D=()=>["auto","min","max","fr",Q,X],W=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],G=()=>["start","end","center","stretch","center-safe","end-safe"],M=()=>["auto",..._()],U=()=>[Ks,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",..._()],C=()=>[e,Q,X],L=()=>[...k(),sx,rx,{position:[Q,X]}],E=()=>["no-repeat",{repeat:["","x","y","space","round"]}],I=()=>["auto","cover","contain",DA,MA,{size:[Q,X]}],Y=()=>[Fd,di,rs],T=()=>["","none","full",u,Q,X],$=()=>["",le,di,rs],K=()=>["solid","dashed","dotted","double"],ne=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ce=()=>[le,Fd,sx,rx],fe=()=>["","none",g,Q,X],nt=()=>["none",le,Q,X],lt=()=>["none",le,Q,X],Ye=()=>[le,Q,X],Jt=()=>[Ks,"full",..._()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Fn],breakpoint:[Fn],color:[PA],container:[Fn],"drop-shadow":[Fn],ease:["in","out","in-out"],font:[AA],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Fn],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Fn],shadow:[Fn],spacing:["px",le],text:[Fn],"text-shadow":[Fn],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Ks,X,Q,y]}],container:["container"],columns:[{columns:[le,X,Q,a]}],"break-after":[{"break-after":b()}],"break-before":[{"break-before":b()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:w()}],overflow:[{overflow:j()}],"overflow-x":[{"overflow-x":j()}],"overflow-y":[{"overflow-y":j()}],overscroll:[{overscroll:N()}],"overscroll-x":[{"overscroll-x":N()}],"overscroll-y":[{"overscroll-y":N()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:P()}],"inset-x":[{"inset-x":P()}],"inset-y":[{"inset-y":P()}],start:[{start:P()}],end:[{end:P()}],top:[{top:P()}],right:[{right:P()}],bottom:[{bottom:P()}],left:[{left:P()}],visibility:["visible","invisible","collapse"],z:[{z:[dr,"auto",Q,X]}],basis:[{basis:[Ks,"full","auto",a,..._()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[le,Ks,"auto","initial","none",X]}],grow:[{grow:["",le,Q,X]}],shrink:[{shrink:["",le,Q,X]}],order:[{order:[dr,"first","last","none",Q,X]}],"grid-cols":[{"grid-cols":A()}],"col-start-end":[{col:O()}],"col-start":[{"col-start":F()}],"col-end":[{"col-end":F()}],"grid-rows":[{"grid-rows":A()}],"row-start-end":[{row:O()}],"row-start":[{"row-start":F()}],"row-end":[{"row-end":F()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":D()}],"auto-rows":[{"auto-rows":D()}],gap:[{gap:_()}],"gap-x":[{"gap-x":_()}],"gap-y":[{"gap-y":_()}],"justify-content":[{justify:[...W(),"normal"]}],"justify-items":[{"justify-items":[...G(),"normal"]}],"justify-self":[{"justify-self":["auto",...G()]}],"align-content":[{content:["normal",...W()]}],"align-items":[{items:[...G(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...G(),{baseline:["","last"]}]}],"place-content":[{"place-content":W()}],"place-items":[{"place-items":[...G(),"baseline"]}],"place-self":[{"place-self":["auto",...G()]}],p:[{p:_()}],px:[{px:_()}],py:[{py:_()}],ps:[{ps:_()}],pe:[{pe:_()}],pt:[{pt:_()}],pr:[{pr:_()}],pb:[{pb:_()}],pl:[{pl:_()}],m:[{m:M()}],mx:[{mx:M()}],my:[{my:M()}],ms:[{ms:M()}],me:[{me:M()}],mt:[{mt:M()}],mr:[{mr:M()}],mb:[{mb:M()}],ml:[{ml:M()}],"space-x":[{"space-x":_()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":_()}],"space-y-reverse":["space-y-reverse"],size:[{size:U()}],w:[{w:[a,"screen",...U()]}],"min-w":[{"min-w":[a,"screen","none",...U()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[i]},...U()]}],h:[{h:["screen","lh",...U()]}],"min-h":[{"min-h":["screen","lh","none",...U()]}],"max-h":[{"max-h":["screen","lh",...U()]}],"font-size":[{text:["base",n,di,rs]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,Q,zd]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Fd,X]}],"font-family":[{font:[OA,X,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[s,Q,X]}],"line-clamp":[{"line-clamp":[le,"none",Q,zd]}],leading:[{leading:[o,..._()]}],"list-image":[{"list-image":["none",Q,X]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Q,X]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:C()}],"text-color":[{text:C()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...K(),"wavy"]}],"text-decoration-thickness":[{decoration:[le,"from-font","auto",Q,rs]}],"text-decoration-color":[{decoration:C()}],"underline-offset":[{"underline-offset":[le,"auto",Q,X]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:_()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Q,X]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Q,X]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:L()}],"bg-repeat":[{bg:E()}],"bg-size":[{bg:I()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},dr,Q,X],radial:["",Q,X],conic:[dr,Q,X]},IA,LA]}],"bg-color":[{bg:C()}],"gradient-from-pos":[{from:Y()}],"gradient-via-pos":[{via:Y()}],"gradient-to-pos":[{to:Y()}],"gradient-from":[{from:C()}],"gradient-via":[{via:C()}],"gradient-to":[{to:C()}],rounded:[{rounded:T()}],"rounded-s":[{"rounded-s":T()}],"rounded-e":[{"rounded-e":T()}],"rounded-t":[{"rounded-t":T()}],"rounded-r":[{"rounded-r":T()}],"rounded-b":[{"rounded-b":T()}],"rounded-l":[{"rounded-l":T()}],"rounded-ss":[{"rounded-ss":T()}],"rounded-se":[{"rounded-se":T()}],"rounded-ee":[{"rounded-ee":T()}],"rounded-es":[{"rounded-es":T()}],"rounded-tl":[{"rounded-tl":T()}],"rounded-tr":[{"rounded-tr":T()}],"rounded-br":[{"rounded-br":T()}],"rounded-bl":[{"rounded-bl":T()}],"border-w":[{border:$()}],"border-w-x":[{"border-x":$()}],"border-w-y":[{"border-y":$()}],"border-w-s":[{"border-s":$()}],"border-w-e":[{"border-e":$()}],"border-w-t":[{"border-t":$()}],"border-w-r":[{"border-r":$()}],"border-w-b":[{"border-b":$()}],"border-w-l":[{"border-l":$()}],"divide-x":[{"divide-x":$()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":$()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...K(),"hidden","none"]}],"divide-style":[{divide:[...K(),"hidden","none"]}],"border-color":[{border:C()}],"border-color-x":[{"border-x":C()}],"border-color-y":[{"border-y":C()}],"border-color-s":[{"border-s":C()}],"border-color-e":[{"border-e":C()}],"border-color-t":[{"border-t":C()}],"border-color-r":[{"border-r":C()}],"border-color-b":[{"border-b":C()}],"border-color-l":[{"border-l":C()}],"divide-color":[{divide:C()}],"outline-style":[{outline:[...K(),"none","hidden"]}],"outline-offset":[{"outline-offset":[le,Q,X]}],"outline-w":[{outline:["",le,di,rs]}],"outline-color":[{outline:C()}],shadow:[{shadow:["","none",d,yl,ml]}],"shadow-color":[{shadow:C()}],"inset-shadow":[{"inset-shadow":["none",h,yl,ml]}],"inset-shadow-color":[{"inset-shadow":C()}],"ring-w":[{ring:$()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:C()}],"ring-offset-w":[{"ring-offset":[le,rs]}],"ring-offset-color":[{"ring-offset":C()}],"inset-ring-w":[{"inset-ring":$()}],"inset-ring-color":[{"inset-ring":C()}],"text-shadow":[{"text-shadow":["none",f,yl,ml]}],"text-shadow-color":[{"text-shadow":C()}],opacity:[{opacity:[le,Q,X]}],"mix-blend":[{"mix-blend":[...ne(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ne()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[le]}],"mask-image-linear-from-pos":[{"mask-linear-from":ce()}],"mask-image-linear-to-pos":[{"mask-linear-to":ce()}],"mask-image-linear-from-color":[{"mask-linear-from":C()}],"mask-image-linear-to-color":[{"mask-linear-to":C()}],"mask-image-t-from-pos":[{"mask-t-from":ce()}],"mask-image-t-to-pos":[{"mask-t-to":ce()}],"mask-image-t-from-color":[{"mask-t-from":C()}],"mask-image-t-to-color":[{"mask-t-to":C()}],"mask-image-r-from-pos":[{"mask-r-from":ce()}],"mask-image-r-to-pos":[{"mask-r-to":ce()}],"mask-image-r-from-color":[{"mask-r-from":C()}],"mask-image-r-to-color":[{"mask-r-to":C()}],"mask-image-b-from-pos":[{"mask-b-from":ce()}],"mask-image-b-to-pos":[{"mask-b-to":ce()}],"mask-image-b-from-color":[{"mask-b-from":C()}],"mask-image-b-to-color":[{"mask-b-to":C()}],"mask-image-l-from-pos":[{"mask-l-from":ce()}],"mask-image-l-to-pos":[{"mask-l-to":ce()}],"mask-image-l-from-color":[{"mask-l-from":C()}],"mask-image-l-to-color":[{"mask-l-to":C()}],"mask-image-x-from-pos":[{"mask-x-from":ce()}],"mask-image-x-to-pos":[{"mask-x-to":ce()}],"mask-image-x-from-color":[{"mask-x-from":C()}],"mask-image-x-to-color":[{"mask-x-to":C()}],"mask-image-y-from-pos":[{"mask-y-from":ce()}],"mask-image-y-to-pos":[{"mask-y-to":ce()}],"mask-image-y-from-color":[{"mask-y-from":C()}],"mask-image-y-to-color":[{"mask-y-to":C()}],"mask-image-radial":[{"mask-radial":[Q,X]}],"mask-image-radial-from-pos":[{"mask-radial-from":ce()}],"mask-image-radial-to-pos":[{"mask-radial-to":ce()}],"mask-image-radial-from-color":[{"mask-radial-from":C()}],"mask-image-radial-to-color":[{"mask-radial-to":C()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":k()}],"mask-image-conic-pos":[{"mask-conic":[le]}],"mask-image-conic-from-pos":[{"mask-conic-from":ce()}],"mask-image-conic-to-pos":[{"mask-conic-to":ce()}],"mask-image-conic-from-color":[{"mask-conic-from":C()}],"mask-image-conic-to-color":[{"mask-conic-to":C()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:L()}],"mask-repeat":[{mask:E()}],"mask-size":[{mask:I()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Q,X]}],filter:[{filter:["","none",Q,X]}],blur:[{blur:fe()}],brightness:[{brightness:[le,Q,X]}],contrast:[{contrast:[le,Q,X]}],"drop-shadow":[{"drop-shadow":["","none",p,yl,ml]}],"drop-shadow-color":[{"drop-shadow":C()}],grayscale:[{grayscale:["",le,Q,X]}],"hue-rotate":[{"hue-rotate":[le,Q,X]}],invert:[{invert:["",le,Q,X]}],saturate:[{saturate:[le,Q,X]}],sepia:[{sepia:["",le,Q,X]}],"backdrop-filter":[{"backdrop-filter":["","none",Q,X]}],"backdrop-blur":[{"backdrop-blur":fe()}],"backdrop-brightness":[{"backdrop-brightness":[le,Q,X]}],"backdrop-contrast":[{"backdrop-contrast":[le,Q,X]}],"backdrop-grayscale":[{"backdrop-grayscale":["",le,Q,X]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[le,Q,X]}],"backdrop-invert":[{"backdrop-invert":["",le,Q,X]}],"backdrop-opacity":[{"backdrop-opacity":[le,Q,X]}],"backdrop-saturate":[{"backdrop-saturate":[le,Q,X]}],"backdrop-sepia":[{"backdrop-sepia":["",le,Q,X]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":_()}],"border-spacing-x":[{"border-spacing-x":_()}],"border-spacing-y":[{"border-spacing-y":_()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Q,X]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[le,"initial",Q,X]}],ease:[{ease:["linear","initial",x,Q,X]}],delay:[{delay:[le,Q,X]}],animate:[{animate:["none",v,Q,X]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[m,Q,X]}],"perspective-origin":[{"perspective-origin":w()}],rotate:[{rotate:nt()}],"rotate-x":[{"rotate-x":nt()}],"rotate-y":[{"rotate-y":nt()}],"rotate-z":[{"rotate-z":nt()}],scale:[{scale:lt()}],"scale-x":[{"scale-x":lt()}],"scale-y":[{"scale-y":lt()}],"scale-z":[{"scale-z":lt()}],"scale-3d":["scale-3d"],skew:[{skew:Ye()}],"skew-x":[{"skew-x":Ye()}],"skew-y":[{"skew-y":Ye()}],transform:[{transform:[Q,X,"","none","gpu","cpu"]}],"transform-origin":[{origin:w()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Jt()}],"translate-x":[{"translate-x":Jt()}],"translate-y":[{"translate-y":Jt()}],"translate-z":[{"translate-z":Jt()}],"translate-none":["translate-none"],accent:[{accent:C()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:C()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Q,X]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":_()}],"scroll-mx":[{"scroll-mx":_()}],"scroll-my":[{"scroll-my":_()}],"scroll-ms":[{"scroll-ms":_()}],"scroll-me":[{"scroll-me":_()}],"scroll-mt":[{"scroll-mt":_()}],"scroll-mr":[{"scroll-mr":_()}],"scroll-mb":[{"scroll-mb":_()}],"scroll-ml":[{"scroll-ml":_()}],"scroll-p":[{"scroll-p":_()}],"scroll-px":[{"scroll-px":_()}],"scroll-py":[{"scroll-py":_()}],"scroll-ps":[{"scroll-ps":_()}],"scroll-pe":[{"scroll-pe":_()}],"scroll-pt":[{"scroll-pt":_()}],"scroll-pr":[{"scroll-pr":_()}],"scroll-pb":[{"scroll-pb":_()}],"scroll-pl":[{"scroll-pl":_()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Q,X]}],fill:[{fill:["none",...C()]}],"stroke-w":[{stroke:[le,di,rs,zd]}],stroke:[{stroke:["none",...C()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},BA=vA(VA);function lr(...e){return BA(ZT(e))}function me({className:e,...t}){return c.jsx("div",{className:lr("animate-pulse rounded-md bg-neutral-200 dark:bg-neutral-700",e),...t})}function ox(){const[e,t]=S.useState(!1);return S.useEffect(()=>{(async()=>{try{const r=await ae.get("/auth/profile/status");t(!r.data.is_complete)}catch{t(!1)}})()},[]),e?c.jsxs("div",{className:"bg-gradient-to-r from-primary-500/10 to-primary-500/5 border border-primary-500/20 rounded-xl p-4 mb-6 flex items-center justify-between gap-4",children:[c.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[c.jsx("div",{className:"w-9 h-9 rounded-lg bg-primary-500/15 flex items-center justify-center flex-shrink-0",children:c.jsx(Ao,{className:"w-[18px] h-[18px] text-primary-600 dark:text-primary-400"})}),c.jsxs("div",{children:[c.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"Complete your profile"}),c.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Add your organization type and impact sectors to help us understand how Sunbird AI is being used."})]})]}),c.jsx(Ee,{to:"/complete-profile",className:"px-5 py-2 bg-primary-600 hover:bg-primary-700 text-white text-sm font-medium rounded-lg transition-colors shadow-sm shadow-primary-500/20 whitespace-nowrap",children:"Update Profile"})]}):null}/*! * @kurkle/color v0.3.4 * https://github.com/kurkle/color#readme * (c) 2024 Jukka Kurkela * Released under the MIT License - */function Ba(e){return e+.5|0}const Sr=(e,t,n)=>Math.max(Math.min(e,n),t);function Si(e){return Sr(Ba(e*2.55),0,255)}function zr(e){return Sr(Ba(e*255),0,255)}function Gn(e){return Sr(Ba(e/2.55)/100,0,1)}function ix(e){return Sr(Ba(e*100),0,100)}const nn={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},Rf=[..."0123456789ABCDEF"],$A=e=>Rf[e&15],HA=e=>Rf[(e&240)>>4]+Rf[e&15],xl=e=>(e&240)>>4===(e&15),UA=e=>xl(e.r)&&xl(e.g)&&xl(e.b)&&xl(e.a);function WA(e){var t=e.length,n;return e[0]==="#"&&(t===4||t===5?n={r:255&nn[e[1]]*17,g:255&nn[e[2]]*17,b:255&nn[e[3]]*17,a:t===5?nn[e[4]]*17:255}:(t===7||t===9)&&(n={r:nn[e[1]]<<4|nn[e[2]],g:nn[e[3]]<<4|nn[e[4]],b:nn[e[5]]<<4|nn[e[6]],a:t===9?nn[e[7]]<<4|nn[e[8]]:255})),n}const GA=(e,t)=>e<255?t(e):"";function qA(e){var t=UA(e)?$A:HA;return e?"#"+t(e.r)+t(e.g)+t(e.b)+GA(e.a,t):void 0}const KA=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function z2(e,t,n){const r=t*Math.min(n,1-n),s=(o,i=(o+e/30)%12)=>n-r*Math.max(Math.min(i-3,9-i,1),-1);return[s(0),s(8),s(4)]}function YA(e,t,n){const r=(s,o=(s+e/60)%6)=>n-n*t*Math.max(Math.min(o,4-o,1),0);return[r(5),r(3),r(1)]}function XA(e,t,n){const r=z2(e,1,.5);let s;for(t+n>1&&(s=1/(t+n),t*=s,n*=s),s=0;s<3;s++)r[s]*=1-t-n,r[s]+=t;return r}function QA(e,t,n,r,s){return e===s?(t-n)/r+(t.5?d/(2-o-i):d/(o+i),l=QA(n,r,s,d,o),l=l*60+.5),[l|0,u||0,a]}function Eg(e,t,n,r){return(Array.isArray(t)?e(t[0],t[1],t[2]):e(t,n,r)).map(zr)}function Tg(e,t,n){return Eg(z2,e,t,n)}function JA(e,t,n){return Eg(XA,e,t,n)}function ZA(e,t,n){return Eg(YA,e,t,n)}function V2(e){return(e%360+360)%360}function eM(e){const t=KA.exec(e);let n=255,r;if(!t)return;t[5]!==r&&(n=t[6]?Si(+t[5]):zr(+t[5]));const s=V2(+t[2]),o=+t[3]/100,i=+t[4]/100;return t[1]==="hwb"?r=JA(s,o,i):t[1]==="hsv"?r=ZA(s,o,i):r=Tg(s,o,i),{r:r[0],g:r[1],b:r[2],a:n}}function tM(e,t){var n=Rg(e);n[0]=V2(n[0]+t),n=Tg(n),e.r=n[0],e.g=n[1],e.b=n[2]}function nM(e){if(!e)return;const t=Rg(e),n=t[0],r=ix(t[1]),s=ix(t[2]);return e.a<255?`hsla(${n}, ${r}%, ${s}%, ${Gn(e.a)})`:`hsl(${n}, ${r}%, ${s}%)`}const ax={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},lx={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};function rM(){const e={},t=Object.keys(lx),n=Object.keys(ax);let r,s,o,i,a;for(r=0;r>16&255,o>>8&255,o&255]}return e}let bl;function sM(e){bl||(bl=rM(),bl.transparent=[0,0,0,0]);const t=bl[e.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:t.length===4?t[3]:255}}const oM=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function iM(e){const t=oM.exec(e);let n=255,r,s,o;if(t){if(t[7]!==r){const i=+t[7];n=t[8]?Si(i):Sr(i*255,0,255)}return r=+t[1],s=+t[3],o=+t[5],r=255&(t[2]?Si(r):Sr(r,0,255)),s=255&(t[4]?Si(s):Sr(s,0,255)),o=255&(t[6]?Si(o):Sr(o,0,255)),{r,g:s,b:o,a:n}}}function aM(e){return e&&(e.a<255?`rgba(${e.r}, ${e.g}, ${e.b}, ${Gn(e.a)})`:`rgb(${e.r}, ${e.g}, ${e.b})`)}const Vd=e=>e<=.0031308?e*12.92:Math.pow(e,1/2.4)*1.055-.055,Ks=e=>e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4);function lM(e,t,n){const r=Ks(Gn(e.r)),s=Ks(Gn(e.g)),o=Ks(Gn(e.b));return{r:zr(Vd(r+n*(Ks(Gn(t.r))-r))),g:zr(Vd(s+n*(Ks(Gn(t.g))-s))),b:zr(Vd(o+n*(Ks(Gn(t.b))-o))),a:e.a+n*(t.a-e.a)}}function vl(e,t,n){if(e){let r=Rg(e);r[t]=Math.max(0,Math.min(r[t]+r[t]*n,t===0?360:1)),r=Tg(r),e.r=r[0],e.g=r[1],e.b=r[2]}}function B2(e,t){return e&&Object.assign(t||{},e)}function cx(e){var t={r:0,g:0,b:0,a:255};return Array.isArray(e)?e.length>=3&&(t={r:e[0],g:e[1],b:e[2],a:255},e.length>3&&(t.a=zr(e[3]))):(t=B2(e,{r:0,g:0,b:0,a:1}),t.a=zr(t.a)),t}function cM(e){return e.charAt(0)==="r"?iM(e):eM(e)}class ma{constructor(t){if(t instanceof ma)return t;const n=typeof t;let r;n==="object"?r=cx(t):n==="string"&&(r=WA(t)||sM(t)||cM(t)),this._rgb=r,this._valid=!!r}get valid(){return this._valid}get rgb(){var t=B2(this._rgb);return t&&(t.a=Gn(t.a)),t}set rgb(t){this._rgb=cx(t)}rgbString(){return this._valid?aM(this._rgb):void 0}hexString(){return this._valid?qA(this._rgb):void 0}hslString(){return this._valid?nM(this._rgb):void 0}mix(t,n){if(t){const r=this.rgb,s=t.rgb;let o;const i=n===o?.5:n,a=2*i-1,l=r.a-s.a,u=((a*l===-1?a:(a+l)/(1+a*l))+1)/2;o=1-u,r.r=255&u*r.r+o*s.r+.5,r.g=255&u*r.g+o*s.g+.5,r.b=255&u*r.b+o*s.b+.5,r.a=i*r.a+(1-i)*s.a,this.rgb=r}return this}interpolate(t,n){return t&&(this._rgb=lM(this._rgb,t._rgb,n)),this}clone(){return new ma(this.rgb)}alpha(t){return this._rgb.a=zr(t),this}clearer(t){const n=this._rgb;return n.a*=1-t,this}greyscale(){const t=this._rgb,n=Ba(t.r*.3+t.g*.59+t.b*.11);return t.r=t.g=t.b=n,this}opaquer(t){const n=this._rgb;return n.a*=1+t,this}negate(){const t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return vl(this._rgb,2,t),this}darken(t){return vl(this._rgb,2,-t),this}saturate(t){return vl(this._rgb,1,t),this}desaturate(t){return vl(this._rgb,1,-t),this}rotate(t){return tM(this._rgb,t),this}}/*! + */function Ba(e){return e+.5|0}const Sr=(e,t,n)=>Math.max(Math.min(e,n),t);function Si(e){return Sr(Ba(e*2.55),0,255)}function zr(e){return Sr(Ba(e*255),0,255)}function Gn(e){return Sr(Ba(e/2.55)/100,0,1)}function ix(e){return Sr(Ba(e*100),0,100)}const nn={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},Rf=[..."0123456789ABCDEF"],$A=e=>Rf[e&15],HA=e=>Rf[(e&240)>>4]+Rf[e&15],xl=e=>(e&240)>>4===(e&15),UA=e=>xl(e.r)&&xl(e.g)&&xl(e.b)&&xl(e.a);function WA(e){var t=e.length,n;return e[0]==="#"&&(t===4||t===5?n={r:255&nn[e[1]]*17,g:255&nn[e[2]]*17,b:255&nn[e[3]]*17,a:t===5?nn[e[4]]*17:255}:(t===7||t===9)&&(n={r:nn[e[1]]<<4|nn[e[2]],g:nn[e[3]]<<4|nn[e[4]],b:nn[e[5]]<<4|nn[e[6]],a:t===9?nn[e[7]]<<4|nn[e[8]]:255})),n}const GA=(e,t)=>e<255?t(e):"";function KA(e){var t=UA(e)?$A:HA;return e?"#"+t(e.r)+t(e.g)+t(e.b)+GA(e.a,t):void 0}const qA=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function z2(e,t,n){const r=t*Math.min(n,1-n),s=(o,i=(o+e/30)%12)=>n-r*Math.max(Math.min(i-3,9-i,1),-1);return[s(0),s(8),s(4)]}function YA(e,t,n){const r=(s,o=(s+e/60)%6)=>n-n*t*Math.max(Math.min(o,4-o,1),0);return[r(5),r(3),r(1)]}function XA(e,t,n){const r=z2(e,1,.5);let s;for(t+n>1&&(s=1/(t+n),t*=s,n*=s),s=0;s<3;s++)r[s]*=1-t-n,r[s]+=t;return r}function QA(e,t,n,r,s){return e===s?(t-n)/r+(t.5?d/(2-o-i):d/(o+i),l=QA(n,r,s,d,o),l=l*60+.5),[l|0,u||0,a]}function Eg(e,t,n,r){return(Array.isArray(t)?e(t[0],t[1],t[2]):e(t,n,r)).map(zr)}function Tg(e,t,n){return Eg(z2,e,t,n)}function JA(e,t,n){return Eg(XA,e,t,n)}function ZA(e,t,n){return Eg(YA,e,t,n)}function V2(e){return(e%360+360)%360}function eM(e){const t=qA.exec(e);let n=255,r;if(!t)return;t[5]!==r&&(n=t[6]?Si(+t[5]):zr(+t[5]));const s=V2(+t[2]),o=+t[3]/100,i=+t[4]/100;return t[1]==="hwb"?r=JA(s,o,i):t[1]==="hsv"?r=ZA(s,o,i):r=Tg(s,o,i),{r:r[0],g:r[1],b:r[2],a:n}}function tM(e,t){var n=Rg(e);n[0]=V2(n[0]+t),n=Tg(n),e.r=n[0],e.g=n[1],e.b=n[2]}function nM(e){if(!e)return;const t=Rg(e),n=t[0],r=ix(t[1]),s=ix(t[2]);return e.a<255?`hsla(${n}, ${r}%, ${s}%, ${Gn(e.a)})`:`hsl(${n}, ${r}%, ${s}%)`}const ax={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},lx={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};function rM(){const e={},t=Object.keys(lx),n=Object.keys(ax);let r,s,o,i,a;for(r=0;r>16&255,o>>8&255,o&255]}return e}let bl;function sM(e){bl||(bl=rM(),bl.transparent=[0,0,0,0]);const t=bl[e.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:t.length===4?t[3]:255}}const oM=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function iM(e){const t=oM.exec(e);let n=255,r,s,o;if(t){if(t[7]!==r){const i=+t[7];n=t[8]?Si(i):Sr(i*255,0,255)}return r=+t[1],s=+t[3],o=+t[5],r=255&(t[2]?Si(r):Sr(r,0,255)),s=255&(t[4]?Si(s):Sr(s,0,255)),o=255&(t[6]?Si(o):Sr(o,0,255)),{r,g:s,b:o,a:n}}}function aM(e){return e&&(e.a<255?`rgba(${e.r}, ${e.g}, ${e.b}, ${Gn(e.a)})`:`rgb(${e.r}, ${e.g}, ${e.b})`)}const Vd=e=>e<=.0031308?e*12.92:Math.pow(e,1/2.4)*1.055-.055,qs=e=>e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4);function lM(e,t,n){const r=qs(Gn(e.r)),s=qs(Gn(e.g)),o=qs(Gn(e.b));return{r:zr(Vd(r+n*(qs(Gn(t.r))-r))),g:zr(Vd(s+n*(qs(Gn(t.g))-s))),b:zr(Vd(o+n*(qs(Gn(t.b))-o))),a:e.a+n*(t.a-e.a)}}function vl(e,t,n){if(e){let r=Rg(e);r[t]=Math.max(0,Math.min(r[t]+r[t]*n,t===0?360:1)),r=Tg(r),e.r=r[0],e.g=r[1],e.b=r[2]}}function B2(e,t){return e&&Object.assign(t||{},e)}function cx(e){var t={r:0,g:0,b:0,a:255};return Array.isArray(e)?e.length>=3&&(t={r:e[0],g:e[1],b:e[2],a:255},e.length>3&&(t.a=zr(e[3]))):(t=B2(e,{r:0,g:0,b:0,a:1}),t.a=zr(t.a)),t}function cM(e){return e.charAt(0)==="r"?iM(e):eM(e)}class ma{constructor(t){if(t instanceof ma)return t;const n=typeof t;let r;n==="object"?r=cx(t):n==="string"&&(r=WA(t)||sM(t)||cM(t)),this._rgb=r,this._valid=!!r}get valid(){return this._valid}get rgb(){var t=B2(this._rgb);return t&&(t.a=Gn(t.a)),t}set rgb(t){this._rgb=cx(t)}rgbString(){return this._valid?aM(this._rgb):void 0}hexString(){return this._valid?KA(this._rgb):void 0}hslString(){return this._valid?nM(this._rgb):void 0}mix(t,n){if(t){const r=this.rgb,s=t.rgb;let o;const i=n===o?.5:n,a=2*i-1,l=r.a-s.a,u=((a*l===-1?a:(a+l)/(1+a*l))+1)/2;o=1-u,r.r=255&u*r.r+o*s.r+.5,r.g=255&u*r.g+o*s.g+.5,r.b=255&u*r.b+o*s.b+.5,r.a=i*r.a+(1-i)*s.a,this.rgb=r}return this}interpolate(t,n){return t&&(this._rgb=lM(this._rgb,t._rgb,n)),this}clone(){return new ma(this.rgb)}alpha(t){return this._rgb.a=zr(t),this}clearer(t){const n=this._rgb;return n.a*=1-t,this}greyscale(){const t=this._rgb,n=Ba(t.r*.3+t.g*.59+t.b*.11);return t.r=t.g=t.b=n,this}opaquer(t){const n=this._rgb;return n.a*=1+t,this}negate(){const t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return vl(this._rgb,2,t),this}darken(t){return vl(this._rgb,2,-t),this}saturate(t){return vl(this._rgb,1,t),this}desaturate(t){return vl(this._rgb,1,-t),this}rotate(t){return tM(this._rgb,t),this}}/*! * Chart.js v4.5.1 * https://www.chartjs.org * (c) 2025 Chart.js Contributors * Released under the MIT License - */function zn(){}const uM=(()=>{let e=0;return()=>e++})();function ke(e){return e==null}function We(e){if(Array.isArray&&Array.isArray(e))return!0;const t=Object.prototype.toString.call(e);return t.slice(0,7)==="[object"&&t.slice(-6)==="Array]"}function he(e){return e!==null&&Object.prototype.toString.call(e)==="[object Object]"}function bt(e){return(typeof e=="number"||e instanceof Number)&&isFinite(+e)}function Pn(e,t){return bt(e)?e:t}function ue(e,t){return typeof e>"u"?t:e}const dM=(e,t)=>typeof e=="string"&&e.endsWith("%")?parseFloat(e)/100:+e/t,$2=(e,t)=>typeof e=="string"&&e.endsWith("%")?parseFloat(e)/100*t:+e;function je(e,t,n){if(e&&typeof e.call=="function")return e.apply(n,t)}function ye(e,t,n,r){let s,o,i;if(We(e))for(o=e.length,s=0;se,x:e=>e.x,y:e=>e.y};function pM(e){const t=e.split("."),n=[];let r="";for(const s of t)r+=s,r.endsWith("\\")?r=r.slice(0,-1)+".":(n.push(r),r="");return n}function gM(e){const t=pM(e);return n=>{for(const r of t){if(r==="")break;n=n&&n[r]}return n}}function xa(e,t){return(ux[t]||(ux[t]=gM(t)))(e)}function Ag(e){return e.charAt(0).toUpperCase()+e.slice(1)}const Wc=e=>typeof e<"u",Ur=e=>typeof e=="function",dx=(e,t)=>{if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0};function mM(e){return e.type==="mouseup"||e.type==="click"||e.type==="contextmenu"}const xe=Math.PI,Ae=2*xe,yM=Ae+xe,Gc=Number.POSITIVE_INFINITY,xM=xe/180,qe=xe/2,ss=xe/4,hx=xe*2/3,U2=Math.log10,Oo=Math.sign;function $i(e,t,n){return Math.abs(e-t)s-o).pop(),t}function vM(e){return typeof e=="symbol"||typeof e=="object"&&e!==null&&!(Symbol.toPrimitive in e||"toString"in e||"valueOf"in e)}function ba(e){return!vM(e)&&!isNaN(parseFloat(e))&&isFinite(e)}function wM(e,t){const n=Math.round(e);return n-t<=e&&n+t>=e}function kM(e,t,n){let r,s,o;for(r=0,s=e.length;rl&&u=Math.min(t,n)-r&&e<=Math.max(t,n)+r}function Mg(e,t,n){n=n||(i=>e[i]1;)o=s+r>>1,n(o)?s=o:r=o;return{lo:s,hi:r}}const vs=(e,t,n,r)=>Mg(e,n,r?s=>{const o=e[s][t];return oe[s][t]Mg(e,n,r=>e[r][t]>=n);function NM(e,t,n){let r=0,s=e.length;for(;rr&&e[s-1]>n;)s--;return r>0||s{const r="_onData"+Ag(n),s=e[n];Object.defineProperty(e,n,{configurable:!0,enumerable:!1,value(...o){const i=s.apply(this,o);return e._chartjs.listeners.forEach(a=>{typeof a[r]=="function"&&a[r](...o)}),i}})})}function gx(e,t){const n=e._chartjs;if(!n)return;const r=n.listeners,s=r.indexOf(t);s!==-1&&r.splice(s,1),!(r.length>0)&&(G2.forEach(o=>{delete e[o]}),delete e._chartjs)}function RM(e){const t=new Set(e);return t.size===e.length?e:Array.from(t)}const q2=(function(){return typeof window>"u"?function(e){return e()}:window.requestAnimationFrame})();function K2(e,t){let n=[],r=!1;return function(...s){n=s,r||(r=!0,q2.call(window,()=>{r=!1,e.apply(t,n)}))}}function EM(e,t){let n;return function(...r){return t?(clearTimeout(n),n=setTimeout(e,t,r)):e.apply(this,r),t}}const Lg=e=>e==="start"?"left":e==="end"?"right":"center",pt=(e,t,n)=>e==="start"?t:e==="end"?n:(t+n)/2,TM=(e,t,n,r)=>e===(r?"left":"right")?n:e==="center"?(t+n)/2:t;function AM(e,t,n){const r=t.length;let s=0,o=r;if(e._sorted){const{iScale:i,vScale:a,_parsed:l}=e,u=e.dataset&&e.dataset.options?e.dataset.options.spanGaps:null,d=i.axis,{min:h,max:f,minDefined:p,maxDefined:g}=i.getUserBounds();if(p){if(s=Math.min(vs(l,d,h).lo,n?r:vs(t,d,i.getPixelForValue(h)).lo),u){const m=l.slice(0,s+1).reverse().findIndex(y=>!ke(y[a.axis]));s-=Math.max(0,m)}s=_t(s,0,r-1)}if(g){let m=Math.max(vs(l,i.axis,f,!0).hi+1,n?0:vs(t,d,i.getPixelForValue(f),!0).hi+1);if(u){const y=l.slice(m-1).findIndex(x=>!ke(x[a.axis]));m+=Math.max(0,y)}o=_t(m,s,r)-s}else o=r-s}return{start:s,count:o}}function MM(e){const{xScale:t,yScale:n,_scaleRanges:r}=e,s={xmin:t.min,xmax:t.max,ymin:n.min,ymax:n.max};if(!r)return e._scaleRanges=s,!0;const o=r.xmin!==t.min||r.xmax!==t.max||r.ymin!==n.min||r.ymax!==n.max;return Object.assign(r,s),o}const wl=e=>e===0||e===1,mx=(e,t,n)=>-(Math.pow(2,10*(e-=1))*Math.sin((e-t)*Ae/n)),yx=(e,t,n)=>Math.pow(2,-10*e)*Math.sin((e-t)*Ae/n)+1,Hi={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>-e*(e-2),easeInOutQuad:e=>(e/=.5)<1?.5*e*e:-.5*(--e*(e-2)-1),easeInCubic:e=>e*e*e,easeOutCubic:e=>(e-=1)*e*e+1,easeInOutCubic:e=>(e/=.5)<1?.5*e*e*e:.5*((e-=2)*e*e+2),easeInQuart:e=>e*e*e*e,easeOutQuart:e=>-((e-=1)*e*e*e-1),easeInOutQuart:e=>(e/=.5)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2),easeInQuint:e=>e*e*e*e*e,easeOutQuint:e=>(e-=1)*e*e*e*e+1,easeInOutQuint:e=>(e/=.5)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2),easeInSine:e=>-Math.cos(e*qe)+1,easeOutSine:e=>Math.sin(e*qe),easeInOutSine:e=>-.5*(Math.cos(xe*e)-1),easeInExpo:e=>e===0?0:Math.pow(2,10*(e-1)),easeOutExpo:e=>e===1?1:-Math.pow(2,-10*e)+1,easeInOutExpo:e=>wl(e)?e:e<.5?.5*Math.pow(2,10*(e*2-1)):.5*(-Math.pow(2,-10*(e*2-1))+2),easeInCirc:e=>e>=1?e:-(Math.sqrt(1-e*e)-1),easeOutCirc:e=>Math.sqrt(1-(e-=1)*e),easeInOutCirc:e=>(e/=.5)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1),easeInElastic:e=>wl(e)?e:mx(e,.075,.3),easeOutElastic:e=>wl(e)?e:yx(e,.075,.3),easeInOutElastic(e){return wl(e)?e:e<.5?.5*mx(e*2,.1125,.45):.5+.5*yx(e*2-1,.1125,.45)},easeInBack(e){return e*e*((1.70158+1)*e-1.70158)},easeOutBack(e){return(e-=1)*e*((1.70158+1)*e+1.70158)+1},easeInOutBack(e){let t=1.70158;return(e/=.5)<1?.5*(e*e*(((t*=1.525)+1)*e-t)):.5*((e-=2)*e*(((t*=1.525)+1)*e+t)+2)},easeInBounce:e=>1-Hi.easeOutBounce(1-e),easeOutBounce(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},easeInOutBounce:e=>e<.5?Hi.easeInBounce(e*2)*.5:Hi.easeOutBounce(e*2-1)*.5+.5};function Og(e){if(e&&typeof e=="object"){const t=e.toString();return t==="[object CanvasPattern]"||t==="[object CanvasGradient]"}return!1}function xx(e){return Og(e)?e:new ma(e)}function Bd(e){return Og(e)?e:new ma(e).saturate(.5).darken(.1).hexString()}const LM=["x","y","borderWidth","radius","tension"],OM=["color","borderColor","backgroundColor"];function DM(e){e.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),e.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>t!=="onProgress"&&t!=="onComplete"&&t!=="fn"}),e.set("animations",{colors:{type:"color",properties:OM},numbers:{type:"number",properties:LM}}),e.describe("animations",{_fallback:"animation"}),e.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>t|0}}}})}function IM(e){e.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}const bx=new Map;function FM(e,t){t=t||{};const n=e+JSON.stringify(t);let r=bx.get(n);return r||(r=new Intl.NumberFormat(e,t),bx.set(n,r)),r}function Dg(e,t,n){return FM(t,n).format(e)}const zM={values(e){return We(e)?e:""+e},numeric(e,t,n){if(e===0)return"0";const r=this.chart.options.locale;let s,o=e;if(n.length>1){const u=Math.max(Math.abs(n[0].value),Math.abs(n[n.length-1].value));(u<1e-4||u>1e15)&&(s="scientific"),o=VM(e,n)}const i=U2(Math.abs(o)),a=isNaN(i)?1:Math.max(Math.min(-1*Math.floor(i),20),0),l={notation:s,minimumFractionDigits:a,maximumFractionDigits:a};return Object.assign(l,this.options.ticks.format),Dg(e,r,l)}};function VM(e,t){let n=t.length>3?t[2].value-t[1].value:t[1].value-t[0].value;return Math.abs(n)>=1&&e!==Math.floor(e)&&(n=e-Math.floor(e)),n}var Y2={formatters:zM};function BM(e){e.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(t,n)=>n.lineWidth,tickColor:(t,n)=>n.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:Y2.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),e.route("scale.ticks","color","","color"),e.route("scale.grid","color","","borderColor"),e.route("scale.border","color","","borderColor"),e.route("scale.title","color","","color"),e.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&t!=="callback"&&t!=="parser",_indexable:t=>t!=="borderDash"&&t!=="tickBorderDash"&&t!=="dash"}),e.describe("scales",{_fallback:"scale"}),e.describe("scale.ticks",{_scriptable:t=>t!=="backdropPadding"&&t!=="callback",_indexable:t=>t!=="backdropPadding"})}const Ls=Object.create(null),Tf=Object.create(null);function Ui(e,t){if(!t)return e;const n=t.split(".");for(let r=0,s=n.length;rr.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(r,s)=>Bd(s.backgroundColor),this.hoverBorderColor=(r,s)=>Bd(s.borderColor),this.hoverColor=(r,s)=>Bd(s.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t),this.apply(n)}set(t,n){return $d(this,t,n)}get(t){return Ui(this,t)}describe(t,n){return $d(Tf,t,n)}override(t,n){return $d(Ls,t,n)}route(t,n,r,s){const o=Ui(this,t),i=Ui(this,r),a="_"+n;Object.defineProperties(o,{[a]:{value:o[n],writable:!0},[n]:{enumerable:!0,get(){const l=this[a],u=i[s];return he(l)?Object.assign({},u,l):ue(l,u)},set(l){this[a]=l}}})}apply(t){t.forEach(n=>n(this))}}var Fe=new $M({_scriptable:e=>!e.startsWith("on"),_indexable:e=>e!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[DM,IM,BM]);function HM(e){return!e||ke(e.size)||ke(e.family)?null:(e.style?e.style+" ":"")+(e.weight?e.weight+" ":"")+e.size+"px "+e.family}function vx(e,t,n,r,s){let o=t[s];return o||(o=t[s]=e.measureText(s).width,n.push(s)),o>r&&(r=o),r}function os(e,t,n){const r=e.currentDevicePixelRatio,s=n!==0?Math.max(n/2,.5):0;return Math.round((t-s)*r)/r+s}function wx(e,t){!t&&!e||(t=t||e.getContext("2d"),t.save(),t.resetTransform(),t.clearRect(0,0,e.width,e.height),t.restore())}function Af(e,t,n,r){X2(e,t,n,r,null)}function X2(e,t,n,r,s){let o,i,a,l,u,d,h,f;const p=t.pointStyle,g=t.rotation,m=t.radius;let y=(g||0)*xM;if(p&&typeof p=="object"&&(o=p.toString(),o==="[object HTMLImageElement]"||o==="[object HTMLCanvasElement]")){e.save(),e.translate(n,r),e.rotate(y),e.drawImage(p,-p.width/2,-p.height/2,p.width,p.height),e.restore();return}if(!(isNaN(m)||m<=0)){switch(e.beginPath(),p){default:s?e.ellipse(n,r,s/2,m,0,0,Ae):e.arc(n,r,m,0,Ae),e.closePath();break;case"triangle":d=s?s/2:m,e.moveTo(n+Math.sin(y)*d,r-Math.cos(y)*m),y+=hx,e.lineTo(n+Math.sin(y)*d,r-Math.cos(y)*m),y+=hx,e.lineTo(n+Math.sin(y)*d,r-Math.cos(y)*m),e.closePath();break;case"rectRounded":u=m*.516,l=m-u,i=Math.cos(y+ss)*l,h=Math.cos(y+ss)*(s?s/2-u:l),a=Math.sin(y+ss)*l,f=Math.sin(y+ss)*(s?s/2-u:l),e.arc(n-h,r-a,u,y-xe,y-qe),e.arc(n+f,r-i,u,y-qe,y),e.arc(n+h,r+a,u,y,y+qe),e.arc(n-f,r+i,u,y+qe,y+xe),e.closePath();break;case"rect":if(!g){l=Math.SQRT1_2*m,d=s?s/2:l,e.rect(n-d,r-l,2*d,2*l);break}y+=ss;case"rectRot":h=Math.cos(y)*(s?s/2:m),i=Math.cos(y)*m,a=Math.sin(y)*m,f=Math.sin(y)*(s?s/2:m),e.moveTo(n-h,r-a),e.lineTo(n+f,r-i),e.lineTo(n+h,r+a),e.lineTo(n-f,r+i),e.closePath();break;case"crossRot":y+=ss;case"cross":h=Math.cos(y)*(s?s/2:m),i=Math.cos(y)*m,a=Math.sin(y)*m,f=Math.sin(y)*(s?s/2:m),e.moveTo(n-h,r-a),e.lineTo(n+h,r+a),e.moveTo(n+f,r-i),e.lineTo(n-f,r+i);break;case"star":h=Math.cos(y)*(s?s/2:m),i=Math.cos(y)*m,a=Math.sin(y)*m,f=Math.sin(y)*(s?s/2:m),e.moveTo(n-h,r-a),e.lineTo(n+h,r+a),e.moveTo(n+f,r-i),e.lineTo(n-f,r+i),y+=ss,h=Math.cos(y)*(s?s/2:m),i=Math.cos(y)*m,a=Math.sin(y)*m,f=Math.sin(y)*(s?s/2:m),e.moveTo(n-h,r-a),e.lineTo(n+h,r+a),e.moveTo(n+f,r-i),e.lineTo(n-f,r+i);break;case"line":i=s?s/2:Math.cos(y)*m,a=Math.sin(y)*m,e.moveTo(n-i,r-a),e.lineTo(n+i,r+a);break;case"dash":e.moveTo(n,r),e.lineTo(n+Math.cos(y)*(s?s/2:m),r+Math.sin(y)*m);break;case!1:e.closePath();break}e.fill(),t.borderWidth>0&&e.stroke()}}function wa(e,t,n){return n=n||.5,!t||e&&e.x>t.left-n&&e.xt.top-n&&e.y0&&o.strokeColor!=="";let l,u;for(e.save(),e.font=s.string,GM(e,o),l=0;l+e||0;function Ig(e,t){const n={},r=he(t),s=r?Object.keys(t):t,o=he(e)?r?i=>ue(e[i],e[t[i]]):i=>e[i]:()=>e;for(const i of s)n[i]=JM(o(i));return n}function ZM(e){return Ig(e,{top:"y",right:"x",bottom:"y",left:"x"})}function Wi(e){return Ig(e,["topLeft","topRight","bottomLeft","bottomRight"])}function hn(e){const t=ZM(e);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function yt(e,t){e=e||{},t=t||Fe.font;let n=ue(e.size,t.size);typeof n=="string"&&(n=parseInt(n,10));let r=ue(e.style,t.style);r&&!(""+r).match(XM)&&(console.warn('Invalid font style specified: "'+r+'"'),r=void 0);const s={family:ue(e.family,t.family),lineHeight:QM(ue(e.lineHeight,t.lineHeight),n),size:n,style:r,weight:ue(e.weight,t.weight),string:""};return s.string=HM(s),s}function kl(e,t,n,r){let s,o,i;for(s=0,o=e.length;sn&&a===0?0:a+l;return{min:i(r,-Math.abs(o)),max:i(s,o)}}function Vs(e,t){return Object.assign(Object.create(e),t)}function Fg(e,t=[""],n,r,s=()=>e[0]){const o=n||e;typeof r>"u"&&(r=eS("_fallback",e));const i={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:e,_rootScopes:o,_fallback:r,_getTarget:s,override:a=>Fg([a,...e],t,o,r)};return new Proxy(i,{deleteProperty(a,l){return delete a[l],delete a._keys,delete e[0][l],!0},get(a,l){return J2(a,l,()=>lL(l,t,e,a))},getOwnPropertyDescriptor(a,l){return Reflect.getOwnPropertyDescriptor(a._scopes[0],l)},getPrototypeOf(){return Reflect.getPrototypeOf(e[0])},has(a,l){return Sx(a).includes(l)},ownKeys(a){return Sx(a)},set(a,l,u){const d=a._storage||(a._storage=s());return a[l]=d[l]=u,delete a._keys,!0}})}function Do(e,t,n,r){const s={_cacheable:!1,_proxy:e,_context:t,_subProxy:n,_stack:new Set,_descriptors:Q2(e,r),setContext:o=>Do(e,o,n,r),override:o=>Do(e.override(o),t,n,r)};return new Proxy(s,{deleteProperty(o,i){return delete o[i],delete e[i],!0},get(o,i,a){return J2(o,i,()=>nL(o,i,a))},getOwnPropertyDescriptor(o,i){return o._descriptors.allKeys?Reflect.has(e,i)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(e,i)},getPrototypeOf(){return Reflect.getPrototypeOf(e)},has(o,i){return Reflect.has(e,i)},ownKeys(){return Reflect.ownKeys(e)},set(o,i,a){return e[i]=a,delete o[i],!0}})}function Q2(e,t={scriptable:!0,indexable:!0}){const{_scriptable:n=t.scriptable,_indexable:r=t.indexable,_allKeys:s=t.allKeys}=e;return{allKeys:s,scriptable:n,indexable:r,isScriptable:Ur(n)?n:()=>n,isIndexable:Ur(r)?r:()=>r}}const tL=(e,t)=>e?e+Ag(t):t,zg=(e,t)=>he(t)&&e!=="adapters"&&(Object.getPrototypeOf(t)===null||t.constructor===Object);function J2(e,t,n){if(Object.prototype.hasOwnProperty.call(e,t)||t==="constructor")return e[t];const r=n();return e[t]=r,r}function nL(e,t,n){const{_proxy:r,_context:s,_subProxy:o,_descriptors:i}=e;let a=r[t];return Ur(a)&&i.isScriptable(t)&&(a=rL(t,a,e,n)),We(a)&&a.length&&(a=sL(t,a,e,i.isIndexable)),zg(t,a)&&(a=Do(a,s,o&&o[t],i)),a}function rL(e,t,n,r){const{_proxy:s,_context:o,_subProxy:i,_stack:a}=n;if(a.has(e))throw new Error("Recursion detected: "+Array.from(a).join("->")+"->"+e);a.add(e);let l=t(o,i||r);return a.delete(e),zg(e,l)&&(l=Vg(s._scopes,s,e,l)),l}function sL(e,t,n,r){const{_proxy:s,_context:o,_subProxy:i,_descriptors:a}=n;if(typeof o.index<"u"&&r(e))return t[o.index%t.length];if(he(t[0])){const l=t,u=s._scopes.filter(d=>d!==l);t=[];for(const d of l){const h=Vg(u,s,e,d);t.push(Do(h,o,i&&i[e],a))}}return t}function Z2(e,t,n){return Ur(e)?e(t,n):e}const oL=(e,t)=>e===!0?t:typeof e=="string"?xa(t,e):void 0;function iL(e,t,n,r,s){for(const o of t){const i=oL(n,o);if(i){e.add(i);const a=Z2(i._fallback,n,s);if(typeof a<"u"&&a!==n&&a!==r)return a}else if(i===!1&&typeof r<"u"&&n!==r)return null}return!1}function Vg(e,t,n,r){const s=t._rootScopes,o=Z2(t._fallback,n,r),i=[...e,...s],a=new Set;a.add(r);let l=kx(a,i,n,o||n,r);return l===null||typeof o<"u"&&o!==n&&(l=kx(a,i,o,l,r),l===null)?!1:Fg(Array.from(a),[""],s,o,()=>aL(t,n,r))}function kx(e,t,n,r,s){for(;n;)n=iL(e,t,n,r,s);return n}function aL(e,t,n){const r=e._getTarget();t in r||(r[t]={});const s=r[t];return We(s)&&he(n)?n:s||{}}function lL(e,t,n,r){let s;for(const o of t)if(s=eS(tL(o,e),n),typeof s<"u")return zg(e,s)?Vg(n,r,e,s):s}function eS(e,t){for(const n of t){if(!n)continue;const r=n[e];if(typeof r<"u")return r}}function Sx(e){let t=e._keys;return t||(t=e._keys=cL(e._scopes)),t}function cL(e){const t=new Set;for(const n of e)for(const r of Object.keys(n).filter(s=>!s.startsWith("_")))t.add(r);return Array.from(t)}const uL=Number.EPSILON||1e-14,Io=(e,t)=>te==="x"?"y":"x";function dL(e,t,n,r){const s=e.skip?t:e,o=t,i=n.skip?t:n,a=Ef(o,s),l=Ef(i,o);let u=a/(a+l),d=l/(a+l);u=isNaN(u)?0:u,d=isNaN(d)?0:d;const h=r*u,f=r*d;return{previous:{x:o.x-h*(i.x-s.x),y:o.y-h*(i.y-s.y)},next:{x:o.x+f*(i.x-s.x),y:o.y+f*(i.y-s.y)}}}function hL(e,t,n){const r=e.length;let s,o,i,a,l,u=Io(e,0);for(let d=0;d!u.skip)),t.cubicInterpolationMode==="monotone")pL(e,s);else{let u=r?e[e.length-1]:e[0];for(o=0,i=e.length;oe.ownerDocument.defaultView.getComputedStyle(e,null);function yL(e,t){return Lu(e).getPropertyValue(t)}const xL=["top","right","bottom","left"];function js(e,t,n){const r={};n=n?"-"+n:"";for(let s=0;s<4;s++){const o=xL[s];r[o]=parseFloat(e[t+"-"+o+n])||0}return r.width=r.left+r.right,r.height=r.top+r.bottom,r}const bL=(e,t,n)=>(e>0||t>0)&&(!n||!n.shadowRoot);function vL(e,t){const n=e.touches,r=n&&n.length?n[0]:e,{offsetX:s,offsetY:o}=r;let i=!1,a,l;if(bL(s,o,e.target))a=s,l=o;else{const u=t.getBoundingClientRect();a=r.clientX-u.left,l=r.clientY-u.top,i=!0}return{x:a,y:l,box:i}}function hs(e,t){if("native"in e)return e;const{canvas:n,currentDevicePixelRatio:r}=t,s=Lu(n),o=s.boxSizing==="border-box",i=js(s,"padding"),a=js(s,"border","width"),{x:l,y:u,box:d}=vL(e,n),h=i.left+(d&&a.left),f=i.top+(d&&a.top);let{width:p,height:g}=t;return o&&(p-=i.width+a.width,g-=i.height+a.height),{x:Math.round((l-h)/p*n.width/r),y:Math.round((u-f)/g*n.height/r)}}function wL(e,t,n){let r,s;if(t===void 0||n===void 0){const o=e&&$g(e);if(!o)t=e.clientWidth,n=e.clientHeight;else{const i=o.getBoundingClientRect(),a=Lu(o),l=js(a,"border","width"),u=js(a,"padding");t=i.width-u.width-l.width,n=i.height-u.height-l.height,r=qc(a.maxWidth,o,"clientWidth"),s=qc(a.maxHeight,o,"clientHeight")}}return{width:t,height:n,maxWidth:r||Gc,maxHeight:s||Gc}}const _r=e=>Math.round(e*10)/10;function kL(e,t,n,r){const s=Lu(e),o=js(s,"margin"),i=qc(s.maxWidth,e,"clientWidth")||Gc,a=qc(s.maxHeight,e,"clientHeight")||Gc,l=wL(e,t,n);let{width:u,height:d}=l;if(s.boxSizing==="content-box"){const f=js(s,"border","width"),p=js(s,"padding");u-=p.width+f.width,d-=p.height+f.height}return u=Math.max(0,u-o.width),d=Math.max(0,r?u/r:d-o.height),u=_r(Math.min(u,i,l.maxWidth)),d=_r(Math.min(d,a,l.maxHeight)),u&&!d&&(d=_r(u/2)),(t!==void 0||n!==void 0)&&r&&l.height&&d>l.height&&(d=l.height,u=_r(Math.floor(d*r))),{width:u,height:d}}function _x(e,t,n){const r=t||1,s=_r(e.height*r),o=_r(e.width*r);e.height=_r(e.height),e.width=_r(e.width);const i=e.canvas;return i.style&&(n||!i.style.height&&!i.style.width)&&(i.style.height=`${e.height}px`,i.style.width=`${e.width}px`),e.currentDevicePixelRatio!==r||i.height!==s||i.width!==o?(e.currentDevicePixelRatio=r,i.height=s,i.width=o,e.ctx.setTransform(r,0,0,r,0,0),!0):!1}const SL=(function(){let e=!1;try{const t={get passive(){return e=!0,!1}};Bg()&&(window.addEventListener("test",null,t),window.removeEventListener("test",null,t))}catch{}return e})();function jx(e,t){const n=yL(e,t),r=n&&n.match(/^(\d+)(\.\d+)?px$/);return r?+r[1]:void 0}function fs(e,t,n,r){return{x:e.x+n*(t.x-e.x),y:e.y+n*(t.y-e.y)}}function _L(e,t,n,r){return{x:e.x+n*(t.x-e.x),y:r==="middle"?n<.5?e.y:t.y:r==="after"?n<1?e.y:t.y:n>0?t.y:e.y}}function jL(e,t,n,r){const s={x:e.cp2x,y:e.cp2y},o={x:t.cp1x,y:t.cp1y},i=fs(e,s,n),a=fs(s,o,n),l=fs(o,t,n),u=fs(i,a,n),d=fs(a,l,n);return fs(u,d,n)}const CL=function(e,t){return{x(n){return e+e+t-n},setWidth(n){t=n},textAlign(n){return n==="center"?n:n==="right"?"left":"right"},xPlus(n,r){return n-r},leftForLtr(n,r){return n-r}}},NL=function(){return{x(e){return e},setWidth(e){},textAlign(e){return e},xPlus(e,t){return e+t},leftForLtr(e,t){return e}}};function vo(e,t,n){return e?CL(t,n):NL()}function nS(e,t){let n,r;(t==="ltr"||t==="rtl")&&(n=e.canvas.style,r=[n.getPropertyValue("direction"),n.getPropertyPriority("direction")],n.setProperty("direction",t,"important"),e.prevTextDirection=r)}function rS(e,t){t!==void 0&&(delete e.prevTextDirection,e.canvas.style.setProperty("direction",t[0],t[1]))}function sS(e){return e==="angle"?{between:va,compare:_M,normalize:Ut}:{between:bs,compare:(t,n)=>t-n,normalize:t=>t}}function Cx({start:e,end:t,count:n,loop:r,style:s}){return{start:e%n,end:t%n,loop:r&&(t-e+1)%n===0,style:s}}function PL(e,t,n){const{property:r,start:s,end:o}=n,{between:i,normalize:a}=sS(r),l=t.length;let{start:u,end:d,loop:h}=e,f,p;if(h){for(u+=l,d+=l,f=0,p=l;fl(s,b,x)&&a(s,b)!==0,w=()=>a(o,x)===0||l(o,b,x),j=()=>m||k(),N=()=>!m||w();for(let _=d,P=d;_<=h;++_)v=t[_%i],!v.skip&&(x=u(v[r]),x!==b&&(m=l(x,s,o),y===null&&j()&&(y=a(x,s)===0?_:P),y!==null&&N()&&(g.push(Cx({start:y,end:_,loop:f,count:i,style:p})),y=null),P=_,b=x));return y!==null&&g.push(Cx({start:y,end:h,loop:f,count:i,style:p})),g}function iS(e,t){const n=[],r=e.segments;for(let s=0;ss&&e[o%t].skip;)o--;return o%=t,{start:s,end:o}}function EL(e,t,n,r){const s=e.length,o=[];let i=t,a=e[t],l;for(l=t+1;l<=n;++l){const u=e[l%s];u.skip||u.stop?a.skip||(r=!1,o.push({start:t%s,end:(l-1)%s,loop:r}),t=i=u.stop?l:null):(i=l,a.skip&&(t=l)),a=u}return i!==null&&o.push({start:t%s,end:i%s,loop:r}),o}function TL(e,t){const n=e.points,r=e.options.spanGaps,s=n.length;if(!s)return[];const o=!!e._loop,{start:i,end:a}=RL(n,s,o,r);if(r===!0)return Nx(e,[{start:i,end:a,loop:o}],n,t);const l=a{let e=0;return()=>e++})();function ke(e){return e==null}function We(e){if(Array.isArray&&Array.isArray(e))return!0;const t=Object.prototype.toString.call(e);return t.slice(0,7)==="[object"&&t.slice(-6)==="Array]"}function he(e){return e!==null&&Object.prototype.toString.call(e)==="[object Object]"}function bt(e){return(typeof e=="number"||e instanceof Number)&&isFinite(+e)}function Pn(e,t){return bt(e)?e:t}function ue(e,t){return typeof e>"u"?t:e}const dM=(e,t)=>typeof e=="string"&&e.endsWith("%")?parseFloat(e)/100:+e/t,$2=(e,t)=>typeof e=="string"&&e.endsWith("%")?parseFloat(e)/100*t:+e;function je(e,t,n){if(e&&typeof e.call=="function")return e.apply(n,t)}function ye(e,t,n,r){let s,o,i;if(We(e))for(o=e.length,s=0;se,x:e=>e.x,y:e=>e.y};function pM(e){const t=e.split("."),n=[];let r="";for(const s of t)r+=s,r.endsWith("\\")?r=r.slice(0,-1)+".":(n.push(r),r="");return n}function gM(e){const t=pM(e);return n=>{for(const r of t){if(r==="")break;n=n&&n[r]}return n}}function xa(e,t){return(ux[t]||(ux[t]=gM(t)))(e)}function Ag(e){return e.charAt(0).toUpperCase()+e.slice(1)}const Wc=e=>typeof e<"u",Ur=e=>typeof e=="function",dx=(e,t)=>{if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0};function mM(e){return e.type==="mouseup"||e.type==="click"||e.type==="contextmenu"}const xe=Math.PI,Ae=2*xe,yM=Ae+xe,Gc=Number.POSITIVE_INFINITY,xM=xe/180,Ke=xe/2,ss=xe/4,hx=xe*2/3,U2=Math.log10,Do=Math.sign;function $i(e,t,n){return Math.abs(e-t)s-o).pop(),t}function vM(e){return typeof e=="symbol"||typeof e=="object"&&e!==null&&!(Symbol.toPrimitive in e||"toString"in e||"valueOf"in e)}function ba(e){return!vM(e)&&!isNaN(parseFloat(e))&&isFinite(e)}function wM(e,t){const n=Math.round(e);return n-t<=e&&n+t>=e}function kM(e,t,n){let r,s,o;for(r=0,s=e.length;rl&&u=Math.min(t,n)-r&&e<=Math.max(t,n)+r}function Mg(e,t,n){n=n||(i=>e[i]1;)o=s+r>>1,n(o)?s=o:r=o;return{lo:s,hi:r}}const vs=(e,t,n,r)=>Mg(e,n,r?s=>{const o=e[s][t];return oe[s][t]Mg(e,n,r=>e[r][t]>=n);function NM(e,t,n){let r=0,s=e.length;for(;rr&&e[s-1]>n;)s--;return r>0||s{const r="_onData"+Ag(n),s=e[n];Object.defineProperty(e,n,{configurable:!0,enumerable:!1,value(...o){const i=s.apply(this,o);return e._chartjs.listeners.forEach(a=>{typeof a[r]=="function"&&a[r](...o)}),i}})})}function gx(e,t){const n=e._chartjs;if(!n)return;const r=n.listeners,s=r.indexOf(t);s!==-1&&r.splice(s,1),!(r.length>0)&&(G2.forEach(o=>{delete e[o]}),delete e._chartjs)}function RM(e){const t=new Set(e);return t.size===e.length?e:Array.from(t)}const K2=(function(){return typeof window>"u"?function(e){return e()}:window.requestAnimationFrame})();function q2(e,t){let n=[],r=!1;return function(...s){n=s,r||(r=!0,K2.call(window,()=>{r=!1,e.apply(t,n)}))}}function EM(e,t){let n;return function(...r){return t?(clearTimeout(n),n=setTimeout(e,t,r)):e.apply(this,r),t}}const Lg=e=>e==="start"?"left":e==="end"?"right":"center",pt=(e,t,n)=>e==="start"?t:e==="end"?n:(t+n)/2,TM=(e,t,n,r)=>e===(r?"left":"right")?n:e==="center"?(t+n)/2:t;function AM(e,t,n){const r=t.length;let s=0,o=r;if(e._sorted){const{iScale:i,vScale:a,_parsed:l}=e,u=e.dataset&&e.dataset.options?e.dataset.options.spanGaps:null,d=i.axis,{min:h,max:f,minDefined:p,maxDefined:g}=i.getUserBounds();if(p){if(s=Math.min(vs(l,d,h).lo,n?r:vs(t,d,i.getPixelForValue(h)).lo),u){const m=l.slice(0,s+1).reverse().findIndex(y=>!ke(y[a.axis]));s-=Math.max(0,m)}s=_t(s,0,r-1)}if(g){let m=Math.max(vs(l,i.axis,f,!0).hi+1,n?0:vs(t,d,i.getPixelForValue(f),!0).hi+1);if(u){const y=l.slice(m-1).findIndex(x=>!ke(x[a.axis]));m+=Math.max(0,y)}o=_t(m,s,r)-s}else o=r-s}return{start:s,count:o}}function MM(e){const{xScale:t,yScale:n,_scaleRanges:r}=e,s={xmin:t.min,xmax:t.max,ymin:n.min,ymax:n.max};if(!r)return e._scaleRanges=s,!0;const o=r.xmin!==t.min||r.xmax!==t.max||r.ymin!==n.min||r.ymax!==n.max;return Object.assign(r,s),o}const wl=e=>e===0||e===1,mx=(e,t,n)=>-(Math.pow(2,10*(e-=1))*Math.sin((e-t)*Ae/n)),yx=(e,t,n)=>Math.pow(2,-10*e)*Math.sin((e-t)*Ae/n)+1,Hi={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>-e*(e-2),easeInOutQuad:e=>(e/=.5)<1?.5*e*e:-.5*(--e*(e-2)-1),easeInCubic:e=>e*e*e,easeOutCubic:e=>(e-=1)*e*e+1,easeInOutCubic:e=>(e/=.5)<1?.5*e*e*e:.5*((e-=2)*e*e+2),easeInQuart:e=>e*e*e*e,easeOutQuart:e=>-((e-=1)*e*e*e-1),easeInOutQuart:e=>(e/=.5)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2),easeInQuint:e=>e*e*e*e*e,easeOutQuint:e=>(e-=1)*e*e*e*e+1,easeInOutQuint:e=>(e/=.5)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2),easeInSine:e=>-Math.cos(e*Ke)+1,easeOutSine:e=>Math.sin(e*Ke),easeInOutSine:e=>-.5*(Math.cos(xe*e)-1),easeInExpo:e=>e===0?0:Math.pow(2,10*(e-1)),easeOutExpo:e=>e===1?1:-Math.pow(2,-10*e)+1,easeInOutExpo:e=>wl(e)?e:e<.5?.5*Math.pow(2,10*(e*2-1)):.5*(-Math.pow(2,-10*(e*2-1))+2),easeInCirc:e=>e>=1?e:-(Math.sqrt(1-e*e)-1),easeOutCirc:e=>Math.sqrt(1-(e-=1)*e),easeInOutCirc:e=>(e/=.5)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1),easeInElastic:e=>wl(e)?e:mx(e,.075,.3),easeOutElastic:e=>wl(e)?e:yx(e,.075,.3),easeInOutElastic(e){return wl(e)?e:e<.5?.5*mx(e*2,.1125,.45):.5+.5*yx(e*2-1,.1125,.45)},easeInBack(e){return e*e*((1.70158+1)*e-1.70158)},easeOutBack(e){return(e-=1)*e*((1.70158+1)*e+1.70158)+1},easeInOutBack(e){let t=1.70158;return(e/=.5)<1?.5*(e*e*(((t*=1.525)+1)*e-t)):.5*((e-=2)*e*(((t*=1.525)+1)*e+t)+2)},easeInBounce:e=>1-Hi.easeOutBounce(1-e),easeOutBounce(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},easeInOutBounce:e=>e<.5?Hi.easeInBounce(e*2)*.5:Hi.easeOutBounce(e*2-1)*.5+.5};function Og(e){if(e&&typeof e=="object"){const t=e.toString();return t==="[object CanvasPattern]"||t==="[object CanvasGradient]"}return!1}function xx(e){return Og(e)?e:new ma(e)}function Bd(e){return Og(e)?e:new ma(e).saturate(.5).darken(.1).hexString()}const LM=["x","y","borderWidth","radius","tension"],OM=["color","borderColor","backgroundColor"];function DM(e){e.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),e.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>t!=="onProgress"&&t!=="onComplete"&&t!=="fn"}),e.set("animations",{colors:{type:"color",properties:OM},numbers:{type:"number",properties:LM}}),e.describe("animations",{_fallback:"animation"}),e.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>t|0}}}})}function IM(e){e.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}const bx=new Map;function FM(e,t){t=t||{};const n=e+JSON.stringify(t);let r=bx.get(n);return r||(r=new Intl.NumberFormat(e,t),bx.set(n,r)),r}function Dg(e,t,n){return FM(t,n).format(e)}const zM={values(e){return We(e)?e:""+e},numeric(e,t,n){if(e===0)return"0";const r=this.chart.options.locale;let s,o=e;if(n.length>1){const u=Math.max(Math.abs(n[0].value),Math.abs(n[n.length-1].value));(u<1e-4||u>1e15)&&(s="scientific"),o=VM(e,n)}const i=U2(Math.abs(o)),a=isNaN(i)?1:Math.max(Math.min(-1*Math.floor(i),20),0),l={notation:s,minimumFractionDigits:a,maximumFractionDigits:a};return Object.assign(l,this.options.ticks.format),Dg(e,r,l)}};function VM(e,t){let n=t.length>3?t[2].value-t[1].value:t[1].value-t[0].value;return Math.abs(n)>=1&&e!==Math.floor(e)&&(n=e-Math.floor(e)),n}var Y2={formatters:zM};function BM(e){e.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(t,n)=>n.lineWidth,tickColor:(t,n)=>n.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:Y2.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),e.route("scale.ticks","color","","color"),e.route("scale.grid","color","","borderColor"),e.route("scale.border","color","","borderColor"),e.route("scale.title","color","","color"),e.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&t!=="callback"&&t!=="parser",_indexable:t=>t!=="borderDash"&&t!=="tickBorderDash"&&t!=="dash"}),e.describe("scales",{_fallback:"scale"}),e.describe("scale.ticks",{_scriptable:t=>t!=="backdropPadding"&&t!=="callback",_indexable:t=>t!=="backdropPadding"})}const Ls=Object.create(null),Tf=Object.create(null);function Ui(e,t){if(!t)return e;const n=t.split(".");for(let r=0,s=n.length;rr.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(r,s)=>Bd(s.backgroundColor),this.hoverBorderColor=(r,s)=>Bd(s.borderColor),this.hoverColor=(r,s)=>Bd(s.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t),this.apply(n)}set(t,n){return $d(this,t,n)}get(t){return Ui(this,t)}describe(t,n){return $d(Tf,t,n)}override(t,n){return $d(Ls,t,n)}route(t,n,r,s){const o=Ui(this,t),i=Ui(this,r),a="_"+n;Object.defineProperties(o,{[a]:{value:o[n],writable:!0},[n]:{enumerable:!0,get(){const l=this[a],u=i[s];return he(l)?Object.assign({},u,l):ue(l,u)},set(l){this[a]=l}}})}apply(t){t.forEach(n=>n(this))}}var Fe=new $M({_scriptable:e=>!e.startsWith("on"),_indexable:e=>e!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[DM,IM,BM]);function HM(e){return!e||ke(e.size)||ke(e.family)?null:(e.style?e.style+" ":"")+(e.weight?e.weight+" ":"")+e.size+"px "+e.family}function vx(e,t,n,r,s){let o=t[s];return o||(o=t[s]=e.measureText(s).width,n.push(s)),o>r&&(r=o),r}function os(e,t,n){const r=e.currentDevicePixelRatio,s=n!==0?Math.max(n/2,.5):0;return Math.round((t-s)*r)/r+s}function wx(e,t){!t&&!e||(t=t||e.getContext("2d"),t.save(),t.resetTransform(),t.clearRect(0,0,e.width,e.height),t.restore())}function Af(e,t,n,r){X2(e,t,n,r,null)}function X2(e,t,n,r,s){let o,i,a,l,u,d,h,f;const p=t.pointStyle,g=t.rotation,m=t.radius;let y=(g||0)*xM;if(p&&typeof p=="object"&&(o=p.toString(),o==="[object HTMLImageElement]"||o==="[object HTMLCanvasElement]")){e.save(),e.translate(n,r),e.rotate(y),e.drawImage(p,-p.width/2,-p.height/2,p.width,p.height),e.restore();return}if(!(isNaN(m)||m<=0)){switch(e.beginPath(),p){default:s?e.ellipse(n,r,s/2,m,0,0,Ae):e.arc(n,r,m,0,Ae),e.closePath();break;case"triangle":d=s?s/2:m,e.moveTo(n+Math.sin(y)*d,r-Math.cos(y)*m),y+=hx,e.lineTo(n+Math.sin(y)*d,r-Math.cos(y)*m),y+=hx,e.lineTo(n+Math.sin(y)*d,r-Math.cos(y)*m),e.closePath();break;case"rectRounded":u=m*.516,l=m-u,i=Math.cos(y+ss)*l,h=Math.cos(y+ss)*(s?s/2-u:l),a=Math.sin(y+ss)*l,f=Math.sin(y+ss)*(s?s/2-u:l),e.arc(n-h,r-a,u,y-xe,y-Ke),e.arc(n+f,r-i,u,y-Ke,y),e.arc(n+h,r+a,u,y,y+Ke),e.arc(n-f,r+i,u,y+Ke,y+xe),e.closePath();break;case"rect":if(!g){l=Math.SQRT1_2*m,d=s?s/2:l,e.rect(n-d,r-l,2*d,2*l);break}y+=ss;case"rectRot":h=Math.cos(y)*(s?s/2:m),i=Math.cos(y)*m,a=Math.sin(y)*m,f=Math.sin(y)*(s?s/2:m),e.moveTo(n-h,r-a),e.lineTo(n+f,r-i),e.lineTo(n+h,r+a),e.lineTo(n-f,r+i),e.closePath();break;case"crossRot":y+=ss;case"cross":h=Math.cos(y)*(s?s/2:m),i=Math.cos(y)*m,a=Math.sin(y)*m,f=Math.sin(y)*(s?s/2:m),e.moveTo(n-h,r-a),e.lineTo(n+h,r+a),e.moveTo(n+f,r-i),e.lineTo(n-f,r+i);break;case"star":h=Math.cos(y)*(s?s/2:m),i=Math.cos(y)*m,a=Math.sin(y)*m,f=Math.sin(y)*(s?s/2:m),e.moveTo(n-h,r-a),e.lineTo(n+h,r+a),e.moveTo(n+f,r-i),e.lineTo(n-f,r+i),y+=ss,h=Math.cos(y)*(s?s/2:m),i=Math.cos(y)*m,a=Math.sin(y)*m,f=Math.sin(y)*(s?s/2:m),e.moveTo(n-h,r-a),e.lineTo(n+h,r+a),e.moveTo(n+f,r-i),e.lineTo(n-f,r+i);break;case"line":i=s?s/2:Math.cos(y)*m,a=Math.sin(y)*m,e.moveTo(n-i,r-a),e.lineTo(n+i,r+a);break;case"dash":e.moveTo(n,r),e.lineTo(n+Math.cos(y)*(s?s/2:m),r+Math.sin(y)*m);break;case!1:e.closePath();break}e.fill(),t.borderWidth>0&&e.stroke()}}function wa(e,t,n){return n=n||.5,!t||e&&e.x>t.left-n&&e.xt.top-n&&e.y0&&o.strokeColor!=="";let l,u;for(e.save(),e.font=s.string,GM(e,o),l=0;l+e||0;function Ig(e,t){const n={},r=he(t),s=r?Object.keys(t):t,o=he(e)?r?i=>ue(e[i],e[t[i]]):i=>e[i]:()=>e;for(const i of s)n[i]=JM(o(i));return n}function ZM(e){return Ig(e,{top:"y",right:"x",bottom:"y",left:"x"})}function Wi(e){return Ig(e,["topLeft","topRight","bottomLeft","bottomRight"])}function hn(e){const t=ZM(e);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function yt(e,t){e=e||{},t=t||Fe.font;let n=ue(e.size,t.size);typeof n=="string"&&(n=parseInt(n,10));let r=ue(e.style,t.style);r&&!(""+r).match(XM)&&(console.warn('Invalid font style specified: "'+r+'"'),r=void 0);const s={family:ue(e.family,t.family),lineHeight:QM(ue(e.lineHeight,t.lineHeight),n),size:n,style:r,weight:ue(e.weight,t.weight),string:""};return s.string=HM(s),s}function kl(e,t,n,r){let s,o,i;for(s=0,o=e.length;sn&&a===0?0:a+l;return{min:i(r,-Math.abs(o)),max:i(s,o)}}function Vs(e,t){return Object.assign(Object.create(e),t)}function Fg(e,t=[""],n,r,s=()=>e[0]){const o=n||e;typeof r>"u"&&(r=eS("_fallback",e));const i={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:e,_rootScopes:o,_fallback:r,_getTarget:s,override:a=>Fg([a,...e],t,o,r)};return new Proxy(i,{deleteProperty(a,l){return delete a[l],delete a._keys,delete e[0][l],!0},get(a,l){return J2(a,l,()=>lL(l,t,e,a))},getOwnPropertyDescriptor(a,l){return Reflect.getOwnPropertyDescriptor(a._scopes[0],l)},getPrototypeOf(){return Reflect.getPrototypeOf(e[0])},has(a,l){return Sx(a).includes(l)},ownKeys(a){return Sx(a)},set(a,l,u){const d=a._storage||(a._storage=s());return a[l]=d[l]=u,delete a._keys,!0}})}function Io(e,t,n,r){const s={_cacheable:!1,_proxy:e,_context:t,_subProxy:n,_stack:new Set,_descriptors:Q2(e,r),setContext:o=>Io(e,o,n,r),override:o=>Io(e.override(o),t,n,r)};return new Proxy(s,{deleteProperty(o,i){return delete o[i],delete e[i],!0},get(o,i,a){return J2(o,i,()=>nL(o,i,a))},getOwnPropertyDescriptor(o,i){return o._descriptors.allKeys?Reflect.has(e,i)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(e,i)},getPrototypeOf(){return Reflect.getPrototypeOf(e)},has(o,i){return Reflect.has(e,i)},ownKeys(){return Reflect.ownKeys(e)},set(o,i,a){return e[i]=a,delete o[i],!0}})}function Q2(e,t={scriptable:!0,indexable:!0}){const{_scriptable:n=t.scriptable,_indexable:r=t.indexable,_allKeys:s=t.allKeys}=e;return{allKeys:s,scriptable:n,indexable:r,isScriptable:Ur(n)?n:()=>n,isIndexable:Ur(r)?r:()=>r}}const tL=(e,t)=>e?e+Ag(t):t,zg=(e,t)=>he(t)&&e!=="adapters"&&(Object.getPrototypeOf(t)===null||t.constructor===Object);function J2(e,t,n){if(Object.prototype.hasOwnProperty.call(e,t)||t==="constructor")return e[t];const r=n();return e[t]=r,r}function nL(e,t,n){const{_proxy:r,_context:s,_subProxy:o,_descriptors:i}=e;let a=r[t];return Ur(a)&&i.isScriptable(t)&&(a=rL(t,a,e,n)),We(a)&&a.length&&(a=sL(t,a,e,i.isIndexable)),zg(t,a)&&(a=Io(a,s,o&&o[t],i)),a}function rL(e,t,n,r){const{_proxy:s,_context:o,_subProxy:i,_stack:a}=n;if(a.has(e))throw new Error("Recursion detected: "+Array.from(a).join("->")+"->"+e);a.add(e);let l=t(o,i||r);return a.delete(e),zg(e,l)&&(l=Vg(s._scopes,s,e,l)),l}function sL(e,t,n,r){const{_proxy:s,_context:o,_subProxy:i,_descriptors:a}=n;if(typeof o.index<"u"&&r(e))return t[o.index%t.length];if(he(t[0])){const l=t,u=s._scopes.filter(d=>d!==l);t=[];for(const d of l){const h=Vg(u,s,e,d);t.push(Io(h,o,i&&i[e],a))}}return t}function Z2(e,t,n){return Ur(e)?e(t,n):e}const oL=(e,t)=>e===!0?t:typeof e=="string"?xa(t,e):void 0;function iL(e,t,n,r,s){for(const o of t){const i=oL(n,o);if(i){e.add(i);const a=Z2(i._fallback,n,s);if(typeof a<"u"&&a!==n&&a!==r)return a}else if(i===!1&&typeof r<"u"&&n!==r)return null}return!1}function Vg(e,t,n,r){const s=t._rootScopes,o=Z2(t._fallback,n,r),i=[...e,...s],a=new Set;a.add(r);let l=kx(a,i,n,o||n,r);return l===null||typeof o<"u"&&o!==n&&(l=kx(a,i,o,l,r),l===null)?!1:Fg(Array.from(a),[""],s,o,()=>aL(t,n,r))}function kx(e,t,n,r,s){for(;n;)n=iL(e,t,n,r,s);return n}function aL(e,t,n){const r=e._getTarget();t in r||(r[t]={});const s=r[t];return We(s)&&he(n)?n:s||{}}function lL(e,t,n,r){let s;for(const o of t)if(s=eS(tL(o,e),n),typeof s<"u")return zg(e,s)?Vg(n,r,e,s):s}function eS(e,t){for(const n of t){if(!n)continue;const r=n[e];if(typeof r<"u")return r}}function Sx(e){let t=e._keys;return t||(t=e._keys=cL(e._scopes)),t}function cL(e){const t=new Set;for(const n of e)for(const r of Object.keys(n).filter(s=>!s.startsWith("_")))t.add(r);return Array.from(t)}const uL=Number.EPSILON||1e-14,Fo=(e,t)=>te==="x"?"y":"x";function dL(e,t,n,r){const s=e.skip?t:e,o=t,i=n.skip?t:n,a=Ef(o,s),l=Ef(i,o);let u=a/(a+l),d=l/(a+l);u=isNaN(u)?0:u,d=isNaN(d)?0:d;const h=r*u,f=r*d;return{previous:{x:o.x-h*(i.x-s.x),y:o.y-h*(i.y-s.y)},next:{x:o.x+f*(i.x-s.x),y:o.y+f*(i.y-s.y)}}}function hL(e,t,n){const r=e.length;let s,o,i,a,l,u=Fo(e,0);for(let d=0;d!u.skip)),t.cubicInterpolationMode==="monotone")pL(e,s);else{let u=r?e[e.length-1]:e[0];for(o=0,i=e.length;oe.ownerDocument.defaultView.getComputedStyle(e,null);function yL(e,t){return Lu(e).getPropertyValue(t)}const xL=["top","right","bottom","left"];function js(e,t,n){const r={};n=n?"-"+n:"";for(let s=0;s<4;s++){const o=xL[s];r[o]=parseFloat(e[t+"-"+o+n])||0}return r.width=r.left+r.right,r.height=r.top+r.bottom,r}const bL=(e,t,n)=>(e>0||t>0)&&(!n||!n.shadowRoot);function vL(e,t){const n=e.touches,r=n&&n.length?n[0]:e,{offsetX:s,offsetY:o}=r;let i=!1,a,l;if(bL(s,o,e.target))a=s,l=o;else{const u=t.getBoundingClientRect();a=r.clientX-u.left,l=r.clientY-u.top,i=!0}return{x:a,y:l,box:i}}function hs(e,t){if("native"in e)return e;const{canvas:n,currentDevicePixelRatio:r}=t,s=Lu(n),o=s.boxSizing==="border-box",i=js(s,"padding"),a=js(s,"border","width"),{x:l,y:u,box:d}=vL(e,n),h=i.left+(d&&a.left),f=i.top+(d&&a.top);let{width:p,height:g}=t;return o&&(p-=i.width+a.width,g-=i.height+a.height),{x:Math.round((l-h)/p*n.width/r),y:Math.round((u-f)/g*n.height/r)}}function wL(e,t,n){let r,s;if(t===void 0||n===void 0){const o=e&&$g(e);if(!o)t=e.clientWidth,n=e.clientHeight;else{const i=o.getBoundingClientRect(),a=Lu(o),l=js(a,"border","width"),u=js(a,"padding");t=i.width-u.width-l.width,n=i.height-u.height-l.height,r=Kc(a.maxWidth,o,"clientWidth"),s=Kc(a.maxHeight,o,"clientHeight")}}return{width:t,height:n,maxWidth:r||Gc,maxHeight:s||Gc}}const _r=e=>Math.round(e*10)/10;function kL(e,t,n,r){const s=Lu(e),o=js(s,"margin"),i=Kc(s.maxWidth,e,"clientWidth")||Gc,a=Kc(s.maxHeight,e,"clientHeight")||Gc,l=wL(e,t,n);let{width:u,height:d}=l;if(s.boxSizing==="content-box"){const f=js(s,"border","width"),p=js(s,"padding");u-=p.width+f.width,d-=p.height+f.height}return u=Math.max(0,u-o.width),d=Math.max(0,r?u/r:d-o.height),u=_r(Math.min(u,i,l.maxWidth)),d=_r(Math.min(d,a,l.maxHeight)),u&&!d&&(d=_r(u/2)),(t!==void 0||n!==void 0)&&r&&l.height&&d>l.height&&(d=l.height,u=_r(Math.floor(d*r))),{width:u,height:d}}function _x(e,t,n){const r=t||1,s=_r(e.height*r),o=_r(e.width*r);e.height=_r(e.height),e.width=_r(e.width);const i=e.canvas;return i.style&&(n||!i.style.height&&!i.style.width)&&(i.style.height=`${e.height}px`,i.style.width=`${e.width}px`),e.currentDevicePixelRatio!==r||i.height!==s||i.width!==o?(e.currentDevicePixelRatio=r,i.height=s,i.width=o,e.ctx.setTransform(r,0,0,r,0,0),!0):!1}const SL=(function(){let e=!1;try{const t={get passive(){return e=!0,!1}};Bg()&&(window.addEventListener("test",null,t),window.removeEventListener("test",null,t))}catch{}return e})();function jx(e,t){const n=yL(e,t),r=n&&n.match(/^(\d+)(\.\d+)?px$/);return r?+r[1]:void 0}function fs(e,t,n,r){return{x:e.x+n*(t.x-e.x),y:e.y+n*(t.y-e.y)}}function _L(e,t,n,r){return{x:e.x+n*(t.x-e.x),y:r==="middle"?n<.5?e.y:t.y:r==="after"?n<1?e.y:t.y:n>0?t.y:e.y}}function jL(e,t,n,r){const s={x:e.cp2x,y:e.cp2y},o={x:t.cp1x,y:t.cp1y},i=fs(e,s,n),a=fs(s,o,n),l=fs(o,t,n),u=fs(i,a,n),d=fs(a,l,n);return fs(u,d,n)}const CL=function(e,t){return{x(n){return e+e+t-n},setWidth(n){t=n},textAlign(n){return n==="center"?n:n==="right"?"left":"right"},xPlus(n,r){return n-r},leftForLtr(n,r){return n-r}}},NL=function(){return{x(e){return e},setWidth(e){},textAlign(e){return e},xPlus(e,t){return e+t},leftForLtr(e,t){return e}}};function wo(e,t,n){return e?CL(t,n):NL()}function nS(e,t){let n,r;(t==="ltr"||t==="rtl")&&(n=e.canvas.style,r=[n.getPropertyValue("direction"),n.getPropertyPriority("direction")],n.setProperty("direction",t,"important"),e.prevTextDirection=r)}function rS(e,t){t!==void 0&&(delete e.prevTextDirection,e.canvas.style.setProperty("direction",t[0],t[1]))}function sS(e){return e==="angle"?{between:va,compare:_M,normalize:Ut}:{between:bs,compare:(t,n)=>t-n,normalize:t=>t}}function Cx({start:e,end:t,count:n,loop:r,style:s}){return{start:e%n,end:t%n,loop:r&&(t-e+1)%n===0,style:s}}function PL(e,t,n){const{property:r,start:s,end:o}=n,{between:i,normalize:a}=sS(r),l=t.length;let{start:u,end:d,loop:h}=e,f,p;if(h){for(u+=l,d+=l,f=0,p=l;fl(s,b,x)&&a(s,b)!==0,w=()=>a(o,x)===0||l(o,b,x),j=()=>m||k(),N=()=>!m||w();for(let _=d,P=d;_<=h;++_)v=t[_%i],!v.skip&&(x=u(v[r]),x!==b&&(m=l(x,s,o),y===null&&j()&&(y=a(x,s)===0?_:P),y!==null&&N()&&(g.push(Cx({start:y,end:_,loop:f,count:i,style:p})),y=null),P=_,b=x));return y!==null&&g.push(Cx({start:y,end:h,loop:f,count:i,style:p})),g}function iS(e,t){const n=[],r=e.segments;for(let s=0;ss&&e[o%t].skip;)o--;return o%=t,{start:s,end:o}}function EL(e,t,n,r){const s=e.length,o=[];let i=t,a=e[t],l;for(l=t+1;l<=n;++l){const u=e[l%s];u.skip||u.stop?a.skip||(r=!1,o.push({start:t%s,end:(l-1)%s,loop:r}),t=i=u.stop?l:null):(i=l,a.skip&&(t=l)),a=u}return i!==null&&o.push({start:t%s,end:i%s,loop:r}),o}function TL(e,t){const n=e.points,r=e.options.spanGaps,s=n.length;if(!s)return[];const o=!!e._loop,{start:i,end:a}=RL(n,s,o,r);if(r===!0)return Nx(e,[{start:i,end:a,loop:o}],n,t);const l=aa({chart:t,initial:n.initial,numSteps:i,currentStep:Math.min(r-n.start,i)}))}_refresh(){this._request||(this._running=!0,this._request=q2.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let n=0;this._charts.forEach((r,s)=>{if(!r.running||!r.items.length)return;const o=r.items;let i=o.length-1,a=!1,l;for(;i>=0;--i)l=o[i],l._active?(l._total>r.duration&&(r.duration=l._total),l.tick(t),a=!0):(o[i]=o[o.length-1],o.pop());a&&(s.draw(),this._notify(s,r,t,"progress")),o.length||(r.running=!1,this._notify(s,r,t,"complete"),r.initial=!1),n+=o.length}),this._lastDate=t,n===0&&(this._running=!1)}_getAnims(t){const n=this._charts;let r=n.get(t);return r||(r={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},n.set(t,r)),r}listen(t,n,r){this._getAnims(t).listeners[n].push(r)}add(t,n){!n||!n.length||this._getAnims(t).items.push(...n)}has(t){return this._getAnims(t).items.length>0}start(t){const n=this._charts.get(t);n&&(n.running=!0,n.start=Date.now(),n.duration=n.items.reduce((r,s)=>Math.max(r,s._duration),0),this._refresh())}running(t){if(!this._running)return!1;const n=this._charts.get(t);return!(!n||!n.running||!n.items.length)}stop(t){const n=this._charts.get(t);if(!n||!n.items.length)return;const r=n.items;let s=r.length-1;for(;s>=0;--s)r[s].cancel();n.items=[],this._notify(t,n,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var Vn=new OL;const Rx="transparent",DL={boolean(e,t,n){return n>.5?t:e},color(e,t,n){const r=xx(e||Rx),s=r.valid&&xx(t||Rx);return s&&s.valid?s.mix(r,n).hexString():t},number(e,t,n){return e+(t-e)*n}};class IL{constructor(t,n,r,s){const o=n[r];s=kl([t.to,s,o,t.from]);const i=kl([t.from,o,s]);this._active=!0,this._fn=t.fn||DL[t.type||typeof i],this._easing=Hi[t.easing]||Hi.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=n,this._prop=r,this._from=i,this._to=s,this._promises=void 0}active(){return this._active}update(t,n,r){if(this._active){this._notify(!1);const s=this._target[this._prop],o=r-this._start,i=this._duration-o;this._start=r,this._duration=Math.floor(Math.max(i,t.duration)),this._total+=o,this._loop=!!t.loop,this._to=kl([t.to,n,s,t.from]),this._from=kl([t.from,s,n])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const n=t-this._start,r=this._duration,s=this._prop,o=this._from,i=this._loop,a=this._to;let l;if(this._active=o!==a&&(i||n1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[s]=this._fn(o,a,l)}wait(){const t=this._promises||(this._promises=[]);return new Promise((n,r)=>{t.push({res:n,rej:r})})}_notify(t){const n=t?"res":"rej",r=this._promises||[];for(let s=0;s{const o=t[s];if(!he(o))return;const i={};for(const a of n)i[a]=o[a];(We(o.properties)&&o.properties||[s]).forEach(a=>{(a===s||!r.has(a))&&r.set(a,i)})})}_animateOptions(t,n){const r=n.options,s=zL(t,r);if(!s)return[];const o=this._createAnimations(s,r);return r.$shared&&FL(t.options.$animations,r).then(()=>{t.options=r},()=>{}),o}_createAnimations(t,n){const r=this._properties,s=[],o=t.$animations||(t.$animations={}),i=Object.keys(n),a=Date.now();let l;for(l=i.length-1;l>=0;--l){const u=i[l];if(u.charAt(0)==="$")continue;if(u==="options"){s.push(...this._animateOptions(t,n));continue}const d=n[u];let h=o[u];const f=r.get(u);if(h)if(f&&h.active()){h.update(f,d,a);continue}else h.cancel();if(!f||!f.duration){t[u]=d;continue}o[u]=h=new IL(f,t,u,d),s.push(h)}return s}update(t,n){if(this._properties.size===0){Object.assign(t,n);return}const r=this._createAnimations(t,n);if(r.length)return Vn.add(this._chart,r),!0}}function FL(e,t){const n=[],r=Object.keys(t);for(let s=0;s0||!n&&o<0)return s.index}return null}function Mx(e,t){const{chart:n,_cachedMeta:r}=e,s=n._stacks||(n._stacks={}),{iScale:o,vScale:i,index:a}=r,l=o.axis,u=i.axis,d=HL(o,i,r),h=t.length;let f;for(let p=0;pn[r].axis===t).shift()}function GL(e,t){return Vs(e,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function qL(e,t,n){return Vs(e,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:n,index:t,mode:"default",type:"data"})}function di(e,t){const n=e.controller.index,r=e.vScale&&e.vScale.axis;if(r){t=t||e._parsed;for(const s of t){const o=s._stacks;if(!o||o[r]===void 0||o[r][n]===void 0)return;delete o[r][n],o[r]._visualValues!==void 0&&o[r]._visualValues[n]!==void 0&&delete o[r]._visualValues[n]}}}const Wd=e=>e==="reset"||e==="none",Lx=(e,t)=>t?e:Object.assign({},e),KL=(e,t,n)=>e&&!t.hidden&&t._stacked&&{keys:cS(n,!0),values:null};class wo{constructor(t,n){this.chart=t,this._ctx=t.ctx,this.index=n,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=Hd(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(t){this.index!==t&&di(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,n=this._cachedMeta,r=this.getDataset(),s=(h,f,p,g)=>h==="x"?f:h==="r"?g:p,o=n.xAxisID=ue(r.xAxisID,Ud(t,"x")),i=n.yAxisID=ue(r.yAxisID,Ud(t,"y")),a=n.rAxisID=ue(r.rAxisID,Ud(t,"r")),l=n.indexAxis,u=n.iAxisID=s(l,o,i,a),d=n.vAxisID=s(l,i,o,a);n.xScale=this.getScaleForId(o),n.yScale=this.getScaleForId(i),n.rScale=this.getScaleForId(a),n.iScale=this.getScaleForId(u),n.vScale=this.getScaleForId(d)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const n=this._cachedMeta;return t===n.iScale?n.vScale:n.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&gx(this._data,this),t._stacked&&di(t)}_dataCheck(){const t=this.getDataset(),n=t.data||(t.data=[]),r=this._data;if(he(n)){const s=this._cachedMeta;this._data=$L(n,s)}else if(r!==n){if(r){gx(r,this);const s=this._cachedMeta;di(s),s._parsed=[]}n&&Object.isExtensible(n)&&PM(n,this),this._syncList=[],this._data=n}}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const n=this._cachedMeta,r=this.getDataset();let s=!1;this._dataCheck();const o=n._stacked;n._stacked=Hd(n.vScale,n),n.stack!==r.stack&&(s=!0,di(n),n.stack=r.stack),this._resyncElements(t),(s||o!==n._stacked)&&(Mx(this,n._parsed),n._stacked=Hd(n.vScale,n))}configure(){const t=this.chart.config,n=t.datasetScopeKeys(this._type),r=t.getOptionScopes(this.getDataset(),n,!0);this.options=t.createResolver(r,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,n){const{_cachedMeta:r,_data:s}=this,{iScale:o,_stacked:i}=r,a=o.axis;let l=t===0&&n===s.length?!0:r._sorted,u=t>0&&r._parsed[t-1],d,h,f;if(this._parsing===!1)r._parsed=s,r._sorted=!0,f=s;else{We(s[t])?f=this.parseArrayData(r,s,t,n):he(s[t])?f=this.parseObjectData(r,s,t,n):f=this.parsePrimitiveData(r,s,t,n);const p=()=>h[a]===null||u&&h[a]m||h=0;--f)if(!g()){this.updateRangeFromParsed(u,t,p,l);break}}return u}getAllParsedValues(t){const n=this._cachedMeta._parsed,r=[];let s,o,i;for(s=0,o=n.length;s=0&&tthis.getContext(r,s,n),m=u.resolveNamedOptions(f,p,g,h);return m.$shared&&(m.$shared=l,o[i]=Object.freeze(Lx(m,l))),m}_resolveAnimations(t,n,r){const s=this.chart,o=this._cachedDataOpts,i=`animation-${n}`,a=o[i];if(a)return a;let l;if(s.options.animation!==!1){const d=this.chart.config,h=d.datasetAnimationScopeKeys(this._type,n),f=d.getOptionScopes(this.getDataset(),h);l=d.createResolver(f,this.getContext(t,r,n))}const u=new lS(s,l&&l.animations);return l&&l._cacheable&&(o[i]=Object.freeze(u)),u}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,n){return!n||Wd(t)||this.chart._animationsDisabled}_getSharedOptions(t,n){const r=this.resolveDataElementOptions(t,n),s=this._sharedOptions,o=this.getSharedOptions(r),i=this.includeOptions(n,o)||o!==s;return this.updateSharedOptions(o,n,r),{sharedOptions:o,includeOptions:i}}updateElement(t,n,r,s){Wd(s)?Object.assign(t,r):this._resolveAnimations(n,s).update(t,r)}updateSharedOptions(t,n,r){t&&!Wd(n)&&this._resolveAnimations(void 0,n).update(t,r)}_setStyle(t,n,r,s){t.active=s;const o=this.getStyle(n,s);this._resolveAnimations(n,r,s).update(t,{options:!s&&this.getSharedOptions(o)||o})}removeHoverStyle(t,n,r){this._setStyle(t,r,"active",!1)}setHoverStyle(t,n,r){this._setStyle(t,r,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const n=this._data,r=this._cachedMeta.data;for(const[a,l,u]of this._syncList)this[a](l,u);this._syncList=[];const s=r.length,o=n.length,i=Math.min(o,s);i&&this.parse(0,i),o>s?this._insertElements(s,o-s,t):o{for(u.length+=n,a=u.length-1;a>=i;a--)u[a]=u[a-n]};for(l(o),a=t;ava(b,a,l,!0)?1:Math.max(k,k*n,w,w*n),g=(b,k,w)=>va(b,a,l,!0)?-1:Math.min(k,k*n,w,w*n),m=p(0,u,h),y=p(qe,d,f),x=g(xe,u,h),v=g(xe+qe,d,f);r=(m-x)/2,s=(y-v)/2,o=-(m+x)/2,i=-(y+v)/2}return{ratioX:r,ratioY:s,offsetX:o,offsetY:i}}class _i extends wo{constructor(t,n){super(t,n),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,n){const r=this.getDataset().data,s=this._cachedMeta;if(this._parsing===!1)s._parsed=r;else{let o=l=>+r[l];if(he(r[t])){const{key:l="value"}=this._parsing;o=u=>+xa(r[u],l)}let i,a;for(i=t,a=t+n;i0&&!isNaN(t)?Ae*(Math.abs(t)/n):0}getLabelAndValue(t){const n=this._cachedMeta,r=this.chart,s=r.data.labels||[],o=Dg(n._parsed[t],r.options.locale);return{label:s[t]||"",value:o}}getMaxBorderWidth(t){let n=0;const r=this.chart;let s,o,i,a,l;if(!t){for(s=0,o=r.data.datasets.length;st!=="spacing",_indexable:t=>t!=="spacing"&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")}),Z(_i,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const n=t.data,{labels:{pointStyle:r,textAlign:s,color:o,useBorderRadius:i,borderRadius:a}}=t.legend.options;return n.labels.length&&n.datasets.length?n.labels.map((l,u)=>{const h=t.getDatasetMeta(0).controller.getStyle(u);return{text:l,fillStyle:h.backgroundColor,fontColor:o,hidden:!t.getDataVisibility(u),lineDash:h.borderDash,lineDashOffset:h.borderDashOffset,lineJoin:h.borderJoinStyle,lineWidth:h.borderWidth,strokeStyle:h.borderColor,textAlign:s,pointStyle:r,borderRadius:i&&(a||h.borderRadius),index:u}}):[]}},onClick(t,n,r){r.chart.toggleDataVisibility(n.index),r.chart.update()}}}});class tc extends wo{initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){const n=this._cachedMeta,{dataset:r,data:s=[],_dataset:o}=n,i=this.chart._animationsDisabled;let{start:a,count:l}=AM(n,s,i);this._drawStart=a,this._drawCount=l,MM(n)&&(a=0,l=s.length),r._chart=this.chart,r._datasetIndex=this.index,r._decimated=!!o._decimated,r.points=s;const u=this.resolveDatasetElementOptions(t);this.options.showLine||(u.borderWidth=0),u.segment=this.options.segment,this.updateElement(r,void 0,{animated:!i,options:u},t),this.updateElements(s,a,l,t)}updateElements(t,n,r,s){const o=s==="reset",{iScale:i,vScale:a,_stacked:l,_dataset:u}=this._cachedMeta,{sharedOptions:d,includeOptions:h}=this._getSharedOptions(n,s),f=i.axis,p=a.axis,{spanGaps:g,segment:m}=this.options,y=ba(g)?g:Number.POSITIVE_INFINITY,x=this.chart._animationsDisabled||o||s==="none",v=n+r,b=t.length;let k=n>0&&this.getParsed(n-1);for(let w=0;w=v){N.skip=!0;continue}const _=this.getParsed(w),P=ke(_[p]),A=N[f]=i.getPixelForValue(_[f],w),O=N[p]=o||P?a.getBasePixel():a.getPixelForValue(l?this.applyStack(a,_,l):_[p],w);N.skip=isNaN(A)||isNaN(O)||P,N.stop=w>0&&Math.abs(_[f]-k[f])>y,m&&(N.parsed=_,N.raw=u.data[w]),h&&(N.options=d||this.resolveDataElementOptions(w,j.active?"active":s)),x||this.updateElement(j,w,N,s),k=_}}getMaxOverflow(){const t=this._cachedMeta,n=t.dataset,r=n.options&&n.options.borderWidth||0,s=t.data||[];if(!s.length)return r;const o=s[0].size(this.resolveDataElementOptions(0)),i=s[s.length-1].size(this.resolveDataElementOptions(s.length-1));return Math.max(r,o,i)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}}Z(tc,"id","line"),Z(tc,"defaults",{datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1}),Z(tc,"overrides",{scales:{_index_:{type:"category"},_value_:{type:"linear"}}});class Lf extends _i{}Z(Lf,"id","pie"),Z(Lf,"defaults",{cutout:0,rotation:0,circumference:360,radius:"100%"});function is(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class Hg{constructor(t){Z(this,"options");this.options=t||{}}static override(t){Object.assign(Hg.prototype,t)}init(){}formats(){return is()}parse(){return is()}format(){return is()}add(){return is()}diff(){return is()}startOf(){return is()}endOf(){return is()}}var XL={_date:Hg};function QL(e,t,n,r){const{controller:s,data:o,_sorted:i}=e,a=s._cachedMeta.iScale,l=e.dataset&&e.dataset.options?e.dataset.options.spanGaps:null;if(a&&t===a.axis&&t!=="r"&&i&&o.length){const u=a._reversePixels?CM:vs;if(r){if(s._sharedOptions){const d=o[0],h=typeof d.getRange=="function"&&d.getRange(t);if(h){const f=u(o,t,n-h),p=u(o,t,n+h);return{lo:f.lo,hi:p.hi}}}}else{const d=u(o,t,n);if(l){const{vScale:h}=s._cachedMeta,{_parsed:f}=e,p=f.slice(0,d.lo+1).reverse().findIndex(m=>!ke(m[h.axis]));d.lo-=Math.max(0,p);const g=f.slice(d.hi).findIndex(m=>!ke(m[h.axis]));d.hi+=Math.max(0,g)}return d}}return{lo:0,hi:o.length-1}}function Ou(e,t,n,r,s){const o=e.getSortedVisibleDatasetMetas(),i=n[t];for(let a=0,l=o.length;a{l[i]&&l[i](t[n],s)&&(o.push({element:l,datasetIndex:u,index:d}),a=a||l.inRange(t.x,t.y,s))}),r&&!a?[]:o}var tO={modes:{index(e,t,n,r){const s=hs(t,e),o=n.axis||"x",i=n.includeInvisible||!1,a=n.intersect?Gd(e,s,o,r,i):qd(e,s,o,!1,r,i),l=[];return a.length?(e.getSortedVisibleDatasetMetas().forEach(u=>{const d=a[0].index,h=u.data[d];h&&!h.skip&&l.push({element:h,datasetIndex:u.index,index:d})}),l):[]},dataset(e,t,n,r){const s=hs(t,e),o=n.axis||"xy",i=n.includeInvisible||!1;let a=n.intersect?Gd(e,s,o,r,i):qd(e,s,o,!1,r,i);if(a.length>0){const l=a[0].datasetIndex,u=e.getDatasetMeta(l).data;a=[];for(let d=0;dn.pos===t)}function Dx(e,t){return e.filter(n=>uS.indexOf(n.pos)===-1&&n.box.axis===t)}function fi(e,t){return e.sort((n,r)=>{const s=t?r:n,o=t?n:r;return s.weight===o.weight?s.index-o.index:s.weight-o.weight})}function nO(e){const t=[];let n,r,s,o,i,a;for(n=0,r=(e||[]).length;nu.box.fullSize),!0),r=fi(hi(t,"left"),!0),s=fi(hi(t,"right")),o=fi(hi(t,"top"),!0),i=fi(hi(t,"bottom")),a=Dx(t,"x"),l=Dx(t,"y");return{fullSize:n,leftAndTop:r.concat(o),rightAndBottom:s.concat(l).concat(i).concat(a),chartArea:hi(t,"chartArea"),vertical:r.concat(s).concat(l),horizontal:o.concat(i).concat(a)}}function Ix(e,t,n,r){return Math.max(e[n],t[n])+Math.max(e[r],t[r])}function dS(e,t){e.top=Math.max(e.top,t.top),e.left=Math.max(e.left,t.left),e.bottom=Math.max(e.bottom,t.bottom),e.right=Math.max(e.right,t.right)}function iO(e,t,n,r){const{pos:s,box:o}=n,i=e.maxPadding;if(!he(s)){n.size&&(e[s]-=n.size);const h=r[n.stack]||{size:0,count:1};h.size=Math.max(h.size,n.horizontal?o.height:o.width),n.size=h.size/h.count,e[s]+=n.size}o.getPadding&&dS(i,o.getPadding());const a=Math.max(0,t.outerWidth-Ix(i,e,"left","right")),l=Math.max(0,t.outerHeight-Ix(i,e,"top","bottom")),u=a!==e.w,d=l!==e.h;return e.w=a,e.h=l,n.horizontal?{same:u,other:d}:{same:d,other:u}}function aO(e){const t=e.maxPadding;function n(r){const s=Math.max(t[r]-e[r],0);return e[r]+=s,s}e.y+=n("top"),e.x+=n("left"),n("right"),n("bottom")}function lO(e,t){const n=t.maxPadding;function r(s){const o={left:0,top:0,right:0,bottom:0};return s.forEach(i=>{o[i]=Math.max(t[i],n[i])}),o}return r(e?["left","right"]:["top","bottom"])}function ji(e,t,n,r){const s=[];let o,i,a,l,u,d;for(o=0,i=e.length,u=0;o{typeof m.beforeLayout=="function"&&m.beforeLayout()});const d=l.reduce((m,y)=>y.box.options&&y.box.options.display===!1?m:m+1,0)||1,h=Object.freeze({outerWidth:t,outerHeight:n,padding:s,availableWidth:o,availableHeight:i,vBoxMaxWidth:o/2/d,hBoxMaxHeight:i/2}),f=Object.assign({},s);dS(f,hn(r));const p=Object.assign({maxPadding:f,w:o,h:i,x:s.left,y:s.top},s),g=sO(l.concat(u),h);ji(a.fullSize,p,h,g),ji(l,p,h,g),ji(u,p,h,g)&&ji(l,p,h,g),aO(p),Fx(a.leftAndTop,p,h,g),p.x+=p.w,p.y+=p.h,Fx(a.rightAndBottom,p,h,g),e.chartArea={left:p.left,top:p.top,right:p.left+p.w,bottom:p.top+p.h,height:p.h,width:p.w},ye(a.chartArea,m=>{const y=m.box;Object.assign(y,e.chartArea),y.update(p.w,p.h,{left:0,top:0,right:0,bottom:0})})}};class hS{acquireContext(t,n){}releaseContext(t){return!1}addEventListener(t,n,r){}removeEventListener(t,n,r){}getDevicePixelRatio(){return 1}getMaximumSize(t,n,r,s){return n=Math.max(0,n||t.width),r=r||t.height,{width:n,height:Math.max(0,s?Math.floor(n/s):r)}}isAttached(t){return!0}updateConfig(t){}}class cO extends hS{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const nc="$chartjs",uO={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},zx=e=>e===null||e==="";function dO(e,t){const n=e.style,r=e.getAttribute("height"),s=e.getAttribute("width");if(e[nc]={initial:{height:r,width:s,style:{display:n.display,height:n.height,width:n.width}}},n.display=n.display||"block",n.boxSizing=n.boxSizing||"border-box",zx(s)){const o=jx(e,"width");o!==void 0&&(e.width=o)}if(zx(r))if(e.style.height==="")e.height=e.width/(t||2);else{const o=jx(e,"height");o!==void 0&&(e.height=o)}return e}const fS=SL?{passive:!0}:!1;function hO(e,t,n){e&&e.addEventListener(t,n,fS)}function fO(e,t,n){e&&e.canvas&&e.canvas.removeEventListener(t,n,fS)}function pO(e,t){const n=uO[e.type]||e.type,{x:r,y:s}=hs(e,t);return{type:n,chart:t,native:e,x:r!==void 0?r:null,y:s!==void 0?s:null}}function Kc(e,t){for(const n of e)if(n===t||n.contains(t))return!0}function gO(e,t,n){const r=e.canvas,s=new MutationObserver(o=>{let i=!1;for(const a of o)i=i||Kc(a.addedNodes,r),i=i&&!Kc(a.removedNodes,r);i&&n()});return s.observe(document,{childList:!0,subtree:!0}),s}function mO(e,t,n){const r=e.canvas,s=new MutationObserver(o=>{let i=!1;for(const a of o)i=i||Kc(a.removedNodes,r),i=i&&!Kc(a.addedNodes,r);i&&n()});return s.observe(document,{childList:!0,subtree:!0}),s}const Sa=new Map;let Vx=0;function pS(){const e=window.devicePixelRatio;e!==Vx&&(Vx=e,Sa.forEach((t,n)=>{n.currentDevicePixelRatio!==e&&t()}))}function yO(e,t){Sa.size||window.addEventListener("resize",pS),Sa.set(e,t)}function xO(e){Sa.delete(e),Sa.size||window.removeEventListener("resize",pS)}function bO(e,t,n){const r=e.canvas,s=r&&$g(r);if(!s)return;const o=K2((a,l)=>{const u=s.clientWidth;n(a,l),u{const l=a[0],u=l.contentRect.width,d=l.contentRect.height;u===0&&d===0||o(u,d)});return i.observe(s),yO(e,o),i}function Kd(e,t,n){n&&n.disconnect(),t==="resize"&&xO(e)}function vO(e,t,n){const r=e.canvas,s=K2(o=>{e.ctx!==null&&n(pO(o,e))},e);return hO(r,t,s),s}class wO extends hS{acquireContext(t,n){const r=t&&t.getContext&&t.getContext("2d");return r&&r.canvas===t?(dO(t,n),r):null}releaseContext(t){const n=t.canvas;if(!n[nc])return!1;const r=n[nc].initial;["height","width"].forEach(o=>{const i=r[o];ke(i)?n.removeAttribute(o):n.setAttribute(o,i)});const s=r.style||{};return Object.keys(s).forEach(o=>{n.style[o]=s[o]}),n.width=n.width,delete n[nc],!0}addEventListener(t,n,r){this.removeEventListener(t,n);const s=t.$proxies||(t.$proxies={}),i={attach:gO,detach:mO,resize:bO}[n]||vO;s[n]=i(t,n,r)}removeEventListener(t,n){const r=t.$proxies||(t.$proxies={}),s=r[n];if(!s)return;({attach:Kd,detach:Kd,resize:Kd}[n]||fO)(t,n,s),r[n]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,n,r,s){return kL(t,n,r,s)}isAttached(t){const n=t&&$g(t);return!!(n&&n.isConnected)}}function kO(e){return!Bg()||typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas?cO:wO}var Dl;let Zr=(Dl=class{constructor(){Z(this,"x");Z(this,"y");Z(this,"active",!1);Z(this,"options");Z(this,"$animations")}tooltipPosition(t){const{x:n,y:r}=this.getProps(["x","y"],t);return{x:n,y:r}}hasValue(){return ba(this.x)&&ba(this.y)}getProps(t,n){const r=this.$animations;if(!n||!r)return this;const s={};return t.forEach(o=>{s[o]=r[o]&&r[o].active()?r[o]._to:this[o]}),s}},Z(Dl,"defaults",{}),Z(Dl,"defaultRoutes"),Dl);function SO(e,t){const n=e.options.ticks,r=_O(e),s=Math.min(n.maxTicksLimit||r,r),o=n.major.enabled?CO(t):[],i=o.length,a=o[0],l=o[i-1],u=[];if(i>s)return NO(t,u,o,i/s),u;const d=jO(o,t,s);if(i>0){let h,f;const p=i>1?Math.round((l-a)/(i-1)):null;for(Cl(t,u,d,ke(p)?0:a-p,a),h=0,f=i-1;hs)return l}return Math.max(s,1)}function CO(e){const t=[];let n,r;for(n=0,r=e.length;ne==="left"?"right":e==="right"?"left":e,Bx=(e,t,n)=>t==="top"||t==="left"?e[t]+n:e[t]-n,$x=(e,t)=>Math.min(t||e,e);function Hx(e,t){const n=[],r=e.length/t,s=e.length;let o=0;for(;oi+a)))return l}function TO(e,t){ye(e,n=>{const r=n.gc,s=r.length/2;let o;if(s>t){for(o=0;or?r:n,r=s&&n>r?n:r,{min:Pn(n,Pn(r,n)),max:Pn(r,Pn(n,r))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){je(this.options.beforeUpdate,[this])}update(t,n,r){const{beginAtZero:s,grace:o,ticks:i}=this.options,a=i.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=n,this._margins=r=Object.assign({left:0,right:0,top:0,bottom:0},r),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+r.left+r.right:this.height+r.top+r.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=eL(this,o,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=a=o||r<=1||!this.isHorizontal()){this.labelRotation=s;return}const d=this._getLabelSizes(),h=d.widest.width,f=d.highest.height,p=_t(this.chart.width-h,0,this.maxWidth);a=t.offset?this.maxWidth/r:p/(r-1),h+6>a&&(a=p/(r-(t.offset?.5:1)),l=this.maxHeight-pi(t.grid)-n.padding-Ux(t.title,this.chart.options.font),u=Math.sqrt(h*h+f*f),i=SM(Math.min(Math.asin(_t((d.highest.height+6)/a,-1,1)),Math.asin(_t(l/u,-1,1))-Math.asin(_t(f/u,-1,1)))),i=Math.max(s,Math.min(o,i))),this.labelRotation=i}afterCalculateLabelRotation(){je(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){je(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:n,options:{ticks:r,title:s,grid:o}}=this,i=this._isVisible(),a=this.isHorizontal();if(i){const l=Ux(s,n.options.font);if(a?(t.width=this.maxWidth,t.height=pi(o)+l):(t.height=this.maxHeight,t.width=pi(o)+l),r.display&&this.ticks.length){const{first:u,last:d,widest:h,highest:f}=this._getLabelSizes(),p=r.padding*2,g=Xn(this.labelRotation),m=Math.cos(g),y=Math.sin(g);if(a){const x=r.mirror?0:y*h.width+m*f.height;t.height=Math.min(this.maxHeight,t.height+x+p)}else{const x=r.mirror?0:m*h.width+y*f.height;t.width=Math.min(this.maxWidth,t.width+x+p)}this._calculatePadding(u,d,y,m)}}this._handleMargins(),a?(this.width=this._length=n.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=n.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,n,r,s){const{ticks:{align:o,padding:i},position:a}=this.options,l=this.labelRotation!==0,u=a!=="top"&&this.axis==="x";if(this.isHorizontal()){const d=this.getPixelForTick(0)-this.left,h=this.right-this.getPixelForTick(this.ticks.length-1);let f=0,p=0;l?u?(f=s*t.width,p=r*n.height):(f=r*t.height,p=s*n.width):o==="start"?p=n.width:o==="end"?f=t.width:o!=="inner"&&(f=t.width/2,p=n.width/2),this.paddingLeft=Math.max((f-d+i)*this.width/(this.width-d),0),this.paddingRight=Math.max((p-h+i)*this.width/(this.width-h),0)}else{let d=n.height/2,h=t.height/2;o==="start"?(d=0,h=t.height):o==="end"&&(d=n.height,h=0),this.paddingTop=d+i,this.paddingBottom=h+i}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){je(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:n}=this.options;return n==="top"||n==="bottom"||t==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){this.beforeTickToLabelConversion(),this.generateTickLabels(t);let n,r;for(n=0,r=t.length;n({width:i[P]||0,height:a[P]||0});return{first:_(0),last:_(n-1),widest:_(j),highest:_(N),widths:i,heights:a}}getLabelForValue(t){return t}getPixelForValue(t,n){return NaN}getValueForPixel(t){}getPixelForTick(t){const n=this.ticks;return t<0||t>n.length-1?null:this.getPixelForValue(n[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const n=this._startPixel+t*this._length;return jM(this._alignToPixels?os(this.chart,n,0):n)}getDecimalForPixel(t){const n=(t-this._startPixel)/this._length;return this._reversePixels?1-n:n}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:n}=this;return t<0&&n<0?n:t>0&&n>0?t:0}getContext(t){const n=this.ticks||[];if(t>=0&&ta*s?a/r:l/s:l*s0}_computeGridLineItems(t){const n=this.axis,r=this.chart,s=this.options,{grid:o,position:i,border:a}=s,l=o.offset,u=this.isHorizontal(),h=this.ticks.length+(l?1:0),f=pi(o),p=[],g=a.setContext(this.getContext()),m=g.display?g.width:0,y=m/2,x=function(M){return os(r,M,m)};let v,b,k,w,j,N,_,P,A,O,F,D;if(i==="top")v=x(this.bottom),N=this.bottom-f,P=v-y,O=x(t.top)+y,D=t.bottom;else if(i==="bottom")v=x(this.top),O=t.top,D=x(t.bottom)-y,N=v+y,P=this.top+f;else if(i==="left")v=x(this.right),j=this.right-f,_=v-y,A=x(t.left)+y,F=t.right;else if(i==="right")v=x(this.left),A=t.left,F=x(t.right)-y,j=v+y,_=this.left+f;else if(n==="x"){if(i==="center")v=x((t.top+t.bottom)/2+.5);else if(he(i)){const M=Object.keys(i)[0],H=i[M];v=x(this.chart.scales[M].getPixelForValue(H))}O=t.top,D=t.bottom,N=v+y,P=N+f}else if(n==="y"){if(i==="center")v=x((t.left+t.right)/2);else if(he(i)){const M=Object.keys(i)[0],H=i[M];v=x(this.chart.scales[M].getPixelForValue(H))}j=v-y,_=j-f,A=t.left,F=t.right}const U=ue(s.ticks.maxTicksLimit,h),W=Math.max(1,Math.ceil(h/U));for(b=0;b0&&(ne-=$/2);break}I={left:ne,top:q,width:$+Y.width,height:T+Y.height,color:W.backdropColor}}y.push({label:k,font:P,textOffset:F,options:{rotation:m,color:H,strokeColor:C,strokeWidth:L,textAlign:E,textBaseline:D,translation:[w,j],backdrop:I}})}return y}_getXAxisLabelAlignment(){const{position:t,ticks:n}=this.options;if(-Xn(this.labelRotation))return t==="top"?"left":"right";let s="center";return n.align==="start"?s="left":n.align==="end"?s="right":n.align==="inner"&&(s="inner"),s}_getYAxisLabelAlignment(t){const{position:n,ticks:{crossAlign:r,mirror:s,padding:o}}=this.options,i=this._getLabelSizes(),a=t+o,l=i.widest.width;let u,d;return n==="left"?s?(d=this.right+o,r==="near"?u="left":r==="center"?(u="center",d+=l/2):(u="right",d+=l)):(d=this.right-a,r==="near"?u="right":r==="center"?(u="center",d-=l/2):(u="left",d=this.left)):n==="right"?s?(d=this.left+o,r==="near"?u="right":r==="center"?(u="center",d-=l/2):(u="left",d-=l)):(d=this.left+a,r==="near"?u="left":r==="center"?(u="center",d+=l/2):(u="right",d=this.right)):u="right",{textAlign:u,x:d}}_computeLabelArea(){if(this.options.ticks.mirror)return;const t=this.chart,n=this.options.position;if(n==="left"||n==="right")return{top:0,left:this.left,bottom:t.height,right:this.right};if(n==="top"||n==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:t.width}}drawBackground(){const{ctx:t,options:{backgroundColor:n},left:r,top:s,width:o,height:i}=this;n&&(t.save(),t.fillStyle=n,t.fillRect(r,s,o,i),t.restore())}getLineWidthForValue(t){const n=this.options.grid;if(!this._isVisible()||!n.display)return 0;const s=this.ticks.findIndex(o=>o.value===t);return s>=0?n.setContext(this.getContext(s)).lineWidth:0}drawGrid(t){const n=this.options.grid,r=this.ctx,s=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let o,i;const a=(l,u,d)=>{!d.width||!d.color||(r.save(),r.lineWidth=d.width,r.strokeStyle=d.color,r.setLineDash(d.borderDash||[]),r.lineDashOffset=d.borderDashOffset,r.beginPath(),r.moveTo(l.x,l.y),r.lineTo(u.x,u.y),r.stroke(),r.restore())};if(n.display)for(o=0,i=s.length;o{this.draw(o)}}]:[{z:r,draw:o=>{this.drawBackground(),this.drawGrid(o),this.drawTitle()}},{z:s,draw:()=>{this.drawBorder()}},{z:n,draw:o=>{this.drawLabels(o)}}]}getMatchingVisibleMetas(t){const n=this.chart.getSortedVisibleDatasetMetas(),r=this.axis+"AxisID",s=[];let o,i;for(o=0,i=n.length;o{const r=n.split("."),s=r.pop(),o=[e].concat(r).join("."),i=t[n].split("."),a=i.pop(),l=i.join(".");Fe.route(o,s,l,a)})}function FO(e){return"id"in e&&"defaults"in e}class zO{constructor(){this.controllers=new Nl(wo,"datasets",!0),this.elements=new Nl(Zr,"elements"),this.plugins=new Nl(Object,"plugins"),this.scales=new Nl(Yo,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,n,r){[...n].forEach(s=>{const o=r||this._getRegistryForType(s);r||o.isForType(s)||o===this.plugins&&s.id?this._exec(t,o,s):ye(s,i=>{const a=r||this._getRegistryForType(i);this._exec(t,a,i)})})}_exec(t,n,r){const s=Ag(t);je(r["before"+s],[],r),n[t](r),je(r["after"+s],[],r)}_getRegistryForType(t){for(let n=0;no.filter(a=>!i.some(l=>a.plugin.id===l.plugin.id));this._notify(s(n,r),t,"stop"),this._notify(s(r,n),t,"start")}}function BO(e){const t={},n=[],r=Object.keys(An.plugins.items);for(let o=0;o1&&Wx(e[0].toLowerCase());if(r)return r}throw new Error(`Cannot determine type of '${e}' axis. Please provide 'axis' or 'position' option.`)}function Gx(e,t,n){if(n[t+"AxisID"]===e)return{axis:t}}function KO(e,t){if(t.data&&t.data.datasets){const n=t.data.datasets.filter(r=>r.xAxisID===e||r.yAxisID===e);if(n.length)return Gx(e,"x",n[0])||Gx(e,"y",n[0])}return{}}function YO(e,t){const n=Ls[e.type]||{scales:{}},r=t.scales||{},s=Of(e.type,t),o=Object.create(null);return Object.keys(r).forEach(i=>{const a=r[i];if(!he(a))return console.error(`Invalid scale configuration for scale: ${i}`);if(a._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${i}`);const l=Df(i,a,KO(i,e),Fe.scales[a.type]),u=GO(l,s),d=n.scales||{};o[i]=Bi(Object.create(null),[{axis:l},a,d[l],d[u]])}),e.data.datasets.forEach(i=>{const a=i.type||e.type,l=i.indexAxis||Of(a,t),d=(Ls[a]||{}).scales||{};Object.keys(d).forEach(h=>{const f=WO(h,l),p=i[f+"AxisID"]||f;o[p]=o[p]||Object.create(null),Bi(o[p],[{axis:f},r[p],d[h]])})}),Object.keys(o).forEach(i=>{const a=o[i];Bi(a,[Fe.scales[a.type],Fe.scale])}),o}function gS(e){const t=e.options||(e.options={});t.plugins=ue(t.plugins,{}),t.scales=YO(e,t)}function mS(e){return e=e||{},e.datasets=e.datasets||[],e.labels=e.labels||[],e}function XO(e){return e=e||{},e.data=mS(e.data),gS(e),e}const qx=new Map,yS=new Set;function Pl(e,t){let n=qx.get(e);return n||(n=t(),qx.set(e,n),yS.add(n)),n}const gi=(e,t,n)=>{const r=xa(t,n);r!==void 0&&e.add(r)};class QO{constructor(t){this._config=XO(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=mS(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),gS(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return Pl(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,n){return Pl(`${t}.transition.${n}`,()=>[[`datasets.${t}.transitions.${n}`,`transitions.${n}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,n){return Pl(`${t}-${n}`,()=>[[`datasets.${t}.elements.${n}`,`datasets.${t}`,`elements.${n}`,""]])}pluginScopeKeys(t){const n=t.id,r=this.type;return Pl(`${r}-plugin-${n}`,()=>[[`plugins.${n}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,n){const r=this._scopeCache;let s=r.get(t);return(!s||n)&&(s=new Map,r.set(t,s)),s}getOptionScopes(t,n,r){const{options:s,type:o}=this,i=this._cachedScopes(t,r),a=i.get(n);if(a)return a;const l=new Set;n.forEach(d=>{t&&(l.add(t),d.forEach(h=>gi(l,t,h))),d.forEach(h=>gi(l,s,h)),d.forEach(h=>gi(l,Ls[o]||{},h)),d.forEach(h=>gi(l,Fe,h)),d.forEach(h=>gi(l,Tf,h))});const u=Array.from(l);return u.length===0&&u.push(Object.create(null)),yS.has(n)&&i.set(n,u),u}chartOptionScopes(){const{options:t,type:n}=this;return[t,Ls[n]||{},Fe.datasets[n]||{},{type:n},Fe,Tf]}resolveNamedOptions(t,n,r,s=[""]){const o={$shared:!0},{resolver:i,subPrefixes:a}=Kx(this._resolverCache,t,s);let l=i;if(ZO(i,n)){o.$shared=!1,r=Ur(r)?r():r;const u=this.createResolver(t,r,a);l=Do(i,r,u)}for(const u of n)o[u]=l[u];return o}createResolver(t,n,r=[""],s){const{resolver:o}=Kx(this._resolverCache,t,r);return he(n)?Do(o,n,void 0,s):o}}function Kx(e,t,n){let r=e.get(t);r||(r=new Map,e.set(t,r));const s=n.join();let o=r.get(s);return o||(o={resolver:Fg(t,n),subPrefixes:n.filter(a=>!a.toLowerCase().includes("hover"))},r.set(s,o)),o}const JO=e=>he(e)&&Object.getOwnPropertyNames(e).some(t=>Ur(e[t]));function ZO(e,t){const{isScriptable:n,isIndexable:r}=Q2(e);for(const s of t){const o=n(s),i=r(s),a=(i||o)&&e[s];if(o&&(Ur(a)||JO(a))||i&&We(a))return!0}return!1}var eD="4.5.1";const tD=["top","bottom","left","right","chartArea"];function Yx(e,t){return e==="top"||e==="bottom"||tD.indexOf(e)===-1&&t==="x"}function Xx(e,t){return function(n,r){return n[e]===r[e]?n[t]-r[t]:n[e]-r[e]}}function Qx(e){const t=e.chart,n=t.options.animation;t.notifyPlugins("afterRender"),je(n&&n.onComplete,[e],t)}function nD(e){const t=e.chart,n=t.options.animation;je(n&&n.onProgress,[e],t)}function xS(e){return Bg()&&typeof e=="string"?e=document.getElementById(e):e&&e.length&&(e=e[0]),e&&e.canvas&&(e=e.canvas),e}const rc={},Jx=e=>{const t=xS(e);return Object.values(rc).filter(n=>n.canvas===t).pop()};function rD(e,t,n){const r=Object.keys(e);for(const s of r){const o=+s;if(o>=t){const i=e[s];delete e[s],(n>0||o>t)&&(e[o+n]=i)}}}function sD(e,t,n,r){return!n||e.type==="mouseout"?null:r?t:e}var fr;let Bs=(fr=class{static register(...t){An.add(...t),Zx()}static unregister(...t){An.remove(...t),Zx()}constructor(t,n){const r=this.config=new QO(n),s=xS(t),o=Jx(s);if(o)throw new Error("Canvas is already in use. Chart with ID '"+o.id+"' must be destroyed before the canvas with ID '"+o.canvas.id+"' can be reused.");const i=r.createResolver(r.chartOptionScopes(),this.getContext());this.platform=new(r.platform||kO(s)),this.platform.updateConfig(r);const a=this.platform.acquireContext(s,i.aspectRatio),l=a&&a.canvas,u=l&&l.height,d=l&&l.width;if(this.id=uM(),this.ctx=a,this.canvas=l,this.width=d,this.height=u,this._options=i,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new VO,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=EM(h=>this.update(h),i.resizeDelay||0),this._dataChanges=[],rc[this.id]=this,!a||!l){console.error("Failed to create chart: can't acquire context from the given item");return}Vn.listen(this,"complete",Qx),Vn.listen(this,"progress",nD),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:n},width:r,height:s,_aspectRatio:o}=this;return ke(t)?n&&o?o:s?r/s:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return An}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():_x(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return wx(this.canvas,this.ctx),this}stop(){return Vn.stop(this),this}resize(t,n){Vn.running(this)?this._resizeBeforeDraw={width:t,height:n}:this._resize(t,n)}_resize(t,n){const r=this.options,s=this.canvas,o=r.maintainAspectRatio&&this.aspectRatio,i=this.platform.getMaximumSize(s,t,n,o),a=r.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=i.width,this.height=i.height,this._aspectRatio=this.aspectRatio,_x(this,a,!0)&&(this.notifyPlugins("resize",{size:i}),je(r.onResize,[this,i],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const n=this.options.scales||{};ye(n,(r,s)=>{r.id=s})}buildOrUpdateScales(){const t=this.options,n=t.scales,r=this.scales,s=Object.keys(r).reduce((i,a)=>(i[a]=!1,i),{});let o=[];n&&(o=o.concat(Object.keys(n).map(i=>{const a=n[i],l=Df(i,a),u=l==="r",d=l==="x";return{options:a,dposition:u?"chartArea":d?"bottom":"left",dtype:u?"radialLinear":d?"category":"linear"}}))),ye(o,i=>{const a=i.options,l=a.id,u=Df(l,a),d=ue(a.type,i.dtype);(a.position===void 0||Yx(a.position,u)!==Yx(i.dposition))&&(a.position=i.dposition),s[l]=!0;let h=null;if(l in r&&r[l].type===d)h=r[l];else{const f=An.getScale(d);h=new f({id:l,type:d,ctx:this.ctx,chart:this}),r[h.id]=h}h.init(a,t)}),ye(s,(i,a)=>{i||delete r[a]}),ye(r,i=>{ln.configure(this,i,i.options),ln.addBox(this,i)})}_updateMetasets(){const t=this._metasets,n=this.data.datasets.length,r=t.length;if(t.sort((s,o)=>s.index-o.index),r>n){for(let s=n;sn.length&&delete this._stacks,t.forEach((r,s)=>{n.filter(o=>o===r._dataset).length===0&&this._destroyDatasetMeta(s)})}buildOrUpdateControllers(){const t=[],n=this.data.datasets;let r,s;for(this._removeUnreferencedMetasets(),r=0,s=n.length;r{this.getDatasetMeta(n).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const n=this.config;n.update();const r=this._options=n.createResolver(n.chartOptionScopes(),this.getContext()),s=this._animationsDisabled=!r.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;const o=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let i=0;for(let u=0,d=this.data.datasets.length;u{u.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(Xx("z","_idx"));const{_active:a,_lastEvent:l}=this;l?this._eventHandler(l,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){ye(this.scales,t=>{ln.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,n=new Set(Object.keys(this._listeners)),r=new Set(t.events);(!dx(n,r)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,n=this._getUniformDataChanges()||[];for(const{method:r,start:s,count:o}of n){const i=r==="_removeElements"?-o:o;rD(t,s,i)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const n=this.data.datasets.length,r=o=>new Set(t.filter(i=>i[0]===o).map((i,a)=>a+","+i.splice(1).join(","))),s=r(0);for(let o=1;oo.split(",")).map(o=>({method:o[1],start:+o[2],count:+o[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;ln.update(this,this.width,this.height,t);const n=this.chartArea,r=n.width<=0||n.height<=0;this._layers=[],ye(this.boxes,s=>{r&&s.position==="chartArea"||(s.configure&&s.configure(),this._layers.push(...s._layers()))},this),this._layers.forEach((s,o)=>{s._idx=o}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let n=0,r=this.data.datasets.length;n=0;--n)this._drawDataset(t[n]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const n=this.ctx,r={meta:t,index:t.index,cancelable:!0},s=aS(this,t);this.notifyPlugins("beforeDatasetDraw",r)!==!1&&(s&&Au(n,s),t.controller.draw(),s&&Mu(n),r.cancelable=!1,this.notifyPlugins("afterDatasetDraw",r))}isPointInArea(t){return wa(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,n,r,s){const o=tO.modes[n];return typeof o=="function"?o(this,t,r,s):[]}getDatasetMeta(t){const n=this.data.datasets[t],r=this._metasets;let s=r.filter(o=>o&&o._dataset===n).pop();return s||(s={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:n&&n.order||0,index:t,_dataset:n,_parsed:[],_sorted:!1},r.push(s)),s}getContext(){return this.$context||(this.$context=Vs(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const n=this.data.datasets[t];if(!n)return!1;const r=this.getDatasetMeta(t);return typeof r.hidden=="boolean"?!r.hidden:!n.hidden}setDatasetVisibility(t,n){const r=this.getDatasetMeta(t);r.hidden=!n}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,n,r){const s=r?"show":"hide",o=this.getDatasetMeta(t),i=o.controller._resolveAnimations(void 0,s);Wc(n)?(o.data[n].hidden=!r,this.update()):(this.setDatasetVisibility(t,r),i.update(o,{visible:r}),this.update(a=>a.datasetIndex===t?s:void 0))}hide(t,n){this._updateVisibility(t,n,!1)}show(t,n){this._updateVisibility(t,n,!0)}_destroyDatasetMeta(t){const n=this._metasets[t];n&&n.controller&&n.controller._destroy(),delete this._metasets[t]}_stop(){let t,n;for(this.stop(),Vn.remove(this),t=0,n=this.data.datasets.length;t{n.addEventListener(this,o,i),t[o]=i},s=(o,i,a)=>{o.offsetX=i,o.offsetY=a,this._eventHandler(o)};ye(this.options.events,o=>r(o,s))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,n=this.platform,r=(l,u)=>{n.addEventListener(this,l,u),t[l]=u},s=(l,u)=>{t[l]&&(n.removeEventListener(this,l,u),delete t[l])},o=(l,u)=>{this.canvas&&this.resize(l,u)};let i;const a=()=>{s("attach",a),this.attached=!0,this.resize(),r("resize",o),r("detach",i)};i=()=>{this.attached=!1,s("resize",o),this._stop(),this._resize(0,0),r("attach",a)},n.isAttached(this.canvas)?a():i()}unbindEvents(){ye(this._listeners,(t,n)=>{this.platform.removeEventListener(this,n,t)}),this._listeners={},ye(this._responsiveListeners,(t,n)=>{this.platform.removeEventListener(this,n,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,n,r){const s=r?"set":"remove";let o,i,a,l;for(n==="dataset"&&(o=this.getDatasetMeta(t[0].datasetIndex),o.controller["_"+s+"DatasetHoverStyle"]()),a=0,l=t.length;a{const a=this.getDatasetMeta(o);if(!a)throw new Error("No dataset found at index "+o);return{datasetIndex:o,element:a.data[i],index:i}});!Hc(r,n)&&(this._active=r,this._lastEvent=null,this._updateHoverStyles(r,n))}notifyPlugins(t,n,r){return this._plugins.notify(this,t,n,r)}isPluginEnabled(t){return this._plugins._cache.filter(n=>n.plugin.id===t).length===1}_updateHoverStyles(t,n,r){const s=this.options.hover,o=(l,u)=>l.filter(d=>!u.some(h=>d.datasetIndex===h.datasetIndex&&d.index===h.index)),i=o(n,t),a=r?t:o(t,n);i.length&&this.updateHoverStyle(i,s.mode,!1),a.length&&s.mode&&this.updateHoverStyle(a,s.mode,!0)}_eventHandler(t,n){const r={event:t,replay:n,cancelable:!0,inChartArea:this.isPointInArea(t)},s=i=>(i.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",r,s)===!1)return;const o=this._handleEvent(t,n,r.inChartArea);return r.cancelable=!1,this.notifyPlugins("afterEvent",r,s),(o||r.changed)&&this.render(),this}_handleEvent(t,n,r){const{_active:s=[],options:o}=this,i=n,a=this._getActiveElements(t,s,r,i),l=mM(t),u=sD(t,this._lastEvent,r,l);r&&(this._lastEvent=null,je(o.onHover,[t,a,this],this),l&&je(o.onClick,[t,a,this],this));const d=!Hc(a,s);return(d||n)&&(this._active=a,this._updateHoverStyles(a,s,n)),this._lastEvent=u,d}_getActiveElements(t,n,r,s){if(t.type==="mouseout")return[];if(!r)return n;const o=this.options.hover;return this.getElementsAtEventForMode(t,o.mode,o,s)}},Z(fr,"defaults",Fe),Z(fr,"instances",rc),Z(fr,"overrides",Ls),Z(fr,"registry",An),Z(fr,"version",eD),Z(fr,"getChart",Jx),fr);function Zx(){return ye(Bs.instances,e=>e._plugins.invalidate())}function oD(e,t,n){const{startAngle:r,x:s,y:o,outerRadius:i,innerRadius:a,options:l}=t,{borderWidth:u,borderJoinStyle:d}=l,h=Math.min(u/i,Ut(r-n));if(e.beginPath(),e.arc(s,o,i-u/2,r+h/2,n-h/2),a>0){const f=Math.min(u/a,Ut(r-n));e.arc(s,o,a+u/2,n-f/2,r+f/2,!0)}else{const f=Math.min(u/2,i*Ut(r-n));if(d==="round")e.arc(s,o,f,n-xe/2,r+xe/2,!0);else if(d==="bevel"){const p=2*f*f,g=-p*Math.cos(n+xe/2)+s,m=-p*Math.sin(n+xe/2)+o,y=p*Math.cos(r+xe/2)+s,x=p*Math.sin(r+xe/2)+o;e.lineTo(g,m),e.lineTo(y,x)}}e.closePath(),e.moveTo(0,0),e.rect(0,0,e.canvas.width,e.canvas.height),e.clip("evenodd")}function iD(e,t,n){const{startAngle:r,pixelMargin:s,x:o,y:i,outerRadius:a,innerRadius:l}=t;let u=s/a;e.beginPath(),e.arc(o,i,a,r-u,n+u),l>s?(u=s/l,e.arc(o,i,l,n+u,r-u,!0)):e.arc(o,i,s,n+qe,r-qe),e.closePath(),e.clip()}function aD(e){return Ig(e,["outerStart","outerEnd","innerStart","innerEnd"])}function lD(e,t,n,r){const s=aD(e.options.borderRadius),o=(n-t)/2,i=Math.min(o,r*t/2),a=l=>{const u=(n-Math.min(o,l))*r/2;return _t(l,0,Math.min(o,u))};return{outerStart:a(s.outerStart),outerEnd:a(s.outerEnd),innerStart:_t(s.innerStart,0,i),innerEnd:_t(s.innerEnd,0,i)}}function Ys(e,t,n,r){return{x:n+e*Math.cos(t),y:r+e*Math.sin(t)}}function Yc(e,t,n,r,s,o){const{x:i,y:a,startAngle:l,pixelMargin:u,innerRadius:d}=t,h=Math.max(t.outerRadius+r+n-u,0),f=d>0?d+r+n+u:0;let p=0;const g=s-l;if(r){const W=d>0?d-r:0,M=h>0?h-r:0,H=(W+M)/2,C=H!==0?g*H/(H+r):g;p=(g-C)/2}const m=Math.max(.001,g*h-n/xe)/h,y=(g-m)/2,x=l+y+p,v=s-y-p,{outerStart:b,outerEnd:k,innerStart:w,innerEnd:j}=lD(t,f,h,v-x),N=h-b,_=h-k,P=x+b/N,A=v-k/_,O=f+w,F=f+j,D=x+w/O,U=v-j/F;if(e.beginPath(),o){const W=(P+A)/2;if(e.arc(i,a,h,P,W),e.arc(i,a,h,W,A),k>0){const L=Ys(_,A,i,a);e.arc(L.x,L.y,k,A,v+qe)}const M=Ys(F,v,i,a);if(e.lineTo(M.x,M.y),j>0){const L=Ys(F,U,i,a);e.arc(L.x,L.y,j,v+qe,U+Math.PI)}const H=(v-j/f+(x+w/f))/2;if(e.arc(i,a,f,v-j/f,H,!0),e.arc(i,a,f,H,x+w/f,!0),w>0){const L=Ys(O,D,i,a);e.arc(L.x,L.y,w,D+Math.PI,x-qe)}const C=Ys(N,x,i,a);if(e.lineTo(C.x,C.y),b>0){const L=Ys(N,P,i,a);e.arc(L.x,L.y,b,x-qe,P)}}else{e.moveTo(i,a);const W=Math.cos(P)*h+i,M=Math.sin(P)*h+a;e.lineTo(W,M);const H=Math.cos(A)*h+i,C=Math.sin(A)*h+a;e.lineTo(H,C)}e.closePath()}function cD(e,t,n,r,s){const{fullCircles:o,startAngle:i,circumference:a}=t;let l=t.endAngle;if(o){Yc(e,t,n,r,l,s);for(let u=0;u=xe&&p===0&&d!=="miter"&&oD(e,t,m),o||(Yc(e,t,n,r,m,s),e.stroke())}class Ci extends Zr{constructor(n){super();Z(this,"circumference");Z(this,"endAngle");Z(this,"fullCircles");Z(this,"innerRadius");Z(this,"outerRadius");Z(this,"pixelMargin");Z(this,"startAngle");this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,n&&Object.assign(this,n)}inRange(n,r,s){const o=this.getProps(["x","y"],s),{angle:i,distance:a}=W2(o,{x:n,y:r}),{startAngle:l,endAngle:u,innerRadius:d,outerRadius:h,circumference:f}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],s),p=(this.options.spacing+this.options.borderWidth)/2,g=ue(f,u-l),m=va(i,l,u)&&l!==u,y=g>=Ae||m,x=bs(a,d+p,h+p);return y&&x}getCenterPoint(n){const{x:r,y:s,startAngle:o,endAngle:i,innerRadius:a,outerRadius:l}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],n),{offset:u,spacing:d}=this.options,h=(o+i)/2,f=(a+l+d+u)/2;return{x:r+Math.cos(h)*f,y:s+Math.sin(h)*f}}tooltipPosition(n){return this.getCenterPoint(n)}draw(n){const{options:r,circumference:s}=this,o=(r.offset||0)/4,i=(r.spacing||0)/2,a=r.circular;if(this.pixelMargin=r.borderAlign==="inner"?.33:0,this.fullCircles=s>Ae?Math.floor(s/Ae):0,s===0||this.innerRadius<0||this.outerRadius<0)return;n.save();const l=(this.startAngle+this.endAngle)/2;n.translate(Math.cos(l)*o,Math.sin(l)*o);const u=1-Math.sin(Math.min(xe,s||0)),d=o*u;n.fillStyle=r.backgroundColor,n.strokeStyle=r.borderColor,cD(n,this,d,i,a),uD(n,this,d,i,a),n.restore()}}Z(Ci,"id","arc"),Z(Ci,"defaults",{borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0,selfJoin:!1}),Z(Ci,"defaultRoutes",{backgroundColor:"backgroundColor"}),Z(Ci,"descriptors",{_scriptable:!0,_indexable:n=>n!=="borderDash"});function bS(e,t,n=t){e.lineCap=ue(n.borderCapStyle,t.borderCapStyle),e.setLineDash(ue(n.borderDash,t.borderDash)),e.lineDashOffset=ue(n.borderDashOffset,t.borderDashOffset),e.lineJoin=ue(n.borderJoinStyle,t.borderJoinStyle),e.lineWidth=ue(n.borderWidth,t.borderWidth),e.strokeStyle=ue(n.borderColor,t.borderColor)}function dD(e,t,n){e.lineTo(n.x,n.y)}function hD(e){return e.stepped?UM:e.tension||e.cubicInterpolationMode==="monotone"?WM:dD}function vS(e,t,n={}){const r=e.length,{start:s=0,end:o=r-1}=n,{start:i,end:a}=t,l=Math.max(s,i),u=Math.min(o,a),d=sa&&o>a;return{count:r,start:l,loop:t.loop,ilen:u(i+(u?a-k:k))%o,b=()=>{m!==y&&(e.lineTo(d,y),e.lineTo(d,m),e.lineTo(d,x))};for(l&&(p=s[v(0)],e.moveTo(p.x,p.y)),f=0;f<=a;++f){if(p=s[v(f)],p.skip)continue;const k=p.x,w=p.y,j=k|0;j===g?(wy&&(y=w),d=(h*d+k)/++h):(b(),e.lineTo(k,w),g=j,h=0,m=y=w),x=w}b()}function If(e){const t=e.options,n=t.borderDash&&t.borderDash.length;return!e._decimated&&!e._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!n?pD:fD}function gD(e){return e.stepped?_L:e.tension||e.cubicInterpolationMode==="monotone"?jL:fs}function mD(e,t,n,r){let s=t._path;s||(s=t._path=new Path2D,t.path(s,n,r)&&s.closePath()),bS(e,t.options),e.stroke(s)}function yD(e,t,n,r){const{segments:s,options:o}=t,i=If(t);for(const a of s)bS(e,o,a.style),e.beginPath(),i(e,t,a,{start:n,end:n+r-1})&&e.closePath(),e.stroke()}const xD=typeof Path2D=="function";function bD(e,t,n,r){xD&&!t.options.segment?mD(e,t,n,r):yD(e,t,n,r)}class bn extends Zr{constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,n){const r=this.options;if((r.tension||r.cubicInterpolationMode==="monotone")&&!r.stepped&&!this._pointsUpdated){const s=r.spanGaps?this._loop:this._fullLoop;mL(this._points,r,t,s,n),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=TL(this,this.options.segment))}first(){const t=this.segments,n=this.points;return t.length&&n[t[0].start]}last(){const t=this.segments,n=this.points,r=t.length;return r&&n[t[r-1].end]}interpolate(t,n){const r=this.options,s=t[n],o=this.points,i=iS(this,{property:n,start:s,end:s});if(!i.length)return;const a=[],l=gD(r);let u,d;for(u=0,d=i.length;ut!=="borderDash"&&t!=="fill"});function eb(e,t,n,r){const s=e.options,{[n]:o}=e.getProps([n],r);return Math.abs(t-o){a=Du(i,a,s);const l=s[i],u=s[a];r!==null?(o.push({x:l.x,y:r}),o.push({x:u.x,y:r})):n!==null&&(o.push({x:n,y:l.y}),o.push({x:n,y:u.y}))}),o}function Du(e,t,n){for(;t>e;t--){const r=n[t];if(!isNaN(r.x)&&!isNaN(r.y))break}return t}function tb(e,t,n,r){return e&&t?r(e[n],t[n]):e?e[n]:t?t[n]:0}function wS(e,t){let n=[],r=!1;return We(e)?(r=!0,n=e):n=wD(e,t),n.length?new bn({points:n,options:{tension:0},_loop:r,_fullLoop:r}):null}function nb(e){return e&&e.fill!==!1}function kD(e,t,n){let s=e[t].fill;const o=[t];let i;if(!n)return s;for(;s!==!1&&o.indexOf(s)===-1;){if(!bt(s))return s;if(i=e[s],!i)return!1;if(i.visible)return s;o.push(s),s=i.fill}return!1}function SD(e,t,n){const r=ND(e);if(he(r))return isNaN(r.value)?!1:r;let s=parseFloat(r);return bt(s)&&Math.floor(s)===s?_D(r[0],t,s,n):["origin","start","end","stack","shape"].indexOf(r)>=0&&r}function _D(e,t,n,r){return(e==="-"||e==="+")&&(n=t+n),n===t||n<0||n>=r?!1:n}function jD(e,t){let n=null;return e==="start"?n=t.bottom:e==="end"?n=t.top:he(e)?n=t.getPixelForValue(e.value):t.getBasePixel&&(n=t.getBasePixel()),n}function CD(e,t,n){let r;return e==="start"?r=n:e==="end"?r=t.options.reverse?t.min:t.max:he(e)?r=e.value:r=t.getBaseValue(),r}function ND(e){const t=e.options,n=t.fill;let r=ue(n&&n.target,n);return r===void 0&&(r=!!t.backgroundColor),r===!1||r===null?!1:r===!0?"origin":r}function PD(e){const{scale:t,index:n,line:r}=e,s=[],o=r.segments,i=r.points,a=RD(t,n);a.push(wS({x:null,y:t.bottom},r));for(let l=0;l=0;--i){const a=s[i].$filler;a&&(a.line.updateControlPoints(o,a.axis),r&&a.fill&&Yd(e.ctx,a,o))}},beforeDatasetsDraw(e,t,n){if(n.drawTime!=="beforeDatasetsDraw")return;const r=e.getSortedVisibleDatasetMetas();for(let s=r.length-1;s>=0;--s){const o=r[s].$filler;nb(o)&&Yd(e.ctx,o,e.chartArea)}},beforeDatasetDraw(e,t,n){const r=t.meta.$filler;!nb(r)||n.drawTime!=="beforeDatasetDraw"||Yd(e.ctx,r,e.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const ib=(e,t)=>{let{boxHeight:n=t,boxWidth:r=t}=e;return e.usePointStyle&&(n=Math.min(n,t),r=e.pointStyleWidth||Math.min(r,t)),{boxWidth:r,boxHeight:n,itemHeight:Math.max(t,n)}},zD=(e,t)=>e!==null&&t!==null&&e.datasetIndex===t.datasetIndex&&e.index===t.index;class ab extends Zr{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,n,r){this.maxWidth=t,this.maxHeight=n,this._margins=r,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const t=this.options.labels||{};let n=je(t.generateLabels,[this.chart],this)||[];t.filter&&(n=n.filter(r=>t.filter(r,this.chart.data))),t.sort&&(n=n.sort((r,s)=>t.sort(r,s,this.chart.data))),this.options.reverse&&n.reverse(),this.legendItems=n}fit(){const{options:t,ctx:n}=this;if(!t.display){this.width=this.height=0;return}const r=t.labels,s=yt(r.font),o=s.size,i=this._computeTitleHeight(),{boxWidth:a,itemHeight:l}=ib(r,o);let u,d;n.font=s.string,this.isHorizontal()?(u=this.maxWidth,d=this._fitRows(i,o,a,l)+10):(d=this.maxHeight,u=this._fitCols(i,s,a,l)+10),this.width=Math.min(u,t.maxWidth||this.maxWidth),this.height=Math.min(d,t.maxHeight||this.maxHeight)}_fitRows(t,n,r,s){const{ctx:o,maxWidth:i,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],u=this.lineWidths=[0],d=s+a;let h=t;o.textAlign="left",o.textBaseline="middle";let f=-1,p=-d;return this.legendItems.forEach((g,m)=>{const y=r+n/2+o.measureText(g.text).width;(m===0||u[u.length-1]+y+2*a>i)&&(h+=d,u[u.length-(m>0?0:1)]=0,p+=d,f++),l[m]={left:0,top:p,row:f,width:y,height:s},u[u.length-1]+=y+a}),h}_fitCols(t,n,r,s){const{ctx:o,maxHeight:i,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],u=this.columnSizes=[],d=i-t;let h=a,f=0,p=0,g=0,m=0;return this.legendItems.forEach((y,x)=>{const{itemWidth:v,itemHeight:b}=VD(r,n,o,y,s);x>0&&p+b+2*a>d&&(h+=f+a,u.push({width:f,height:p}),g+=f+a,m++,f=p=0),l[x]={left:g,top:p,col:m,width:v,height:b},f=Math.max(f,v),p+=b+a}),h+=f,u.push({width:f,height:p}),h}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:n,options:{align:r,labels:{padding:s},rtl:o}}=this,i=vo(o,this.left,this.width);if(this.isHorizontal()){let a=0,l=pt(r,this.left+s,this.right-this.lineWidths[a]);for(const u of n)a!==u.row&&(a=u.row,l=pt(r,this.left+s,this.right-this.lineWidths[a])),u.top+=this.top+t+s,u.left=i.leftForLtr(i.x(l),u.width),l+=u.width+s}else{let a=0,l=pt(r,this.top+t+s,this.bottom-this.columnSizes[a].height);for(const u of n)u.col!==a&&(a=u.col,l=pt(r,this.top+t+s,this.bottom-this.columnSizes[a].height)),u.top=l,u.left+=this.left+s,u.left=i.leftForLtr(i.x(u.left),u.width),l+=u.height+s}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){const t=this.ctx;Au(t,this),this._draw(),Mu(t)}}_draw(){const{options:t,columnSizes:n,lineWidths:r,ctx:s}=this,{align:o,labels:i}=t,a=Fe.color,l=vo(t.rtl,this.left,this.width),u=yt(i.font),{padding:d}=i,h=u.size,f=h/2;let p;this.drawTitle(),s.textAlign=l.textAlign("left"),s.textBaseline="middle",s.lineWidth=.5,s.font=u.string;const{boxWidth:g,boxHeight:m,itemHeight:y}=ib(i,h),x=function(j,N,_){if(isNaN(g)||g<=0||isNaN(m)||m<0)return;s.save();const P=ue(_.lineWidth,1);if(s.fillStyle=ue(_.fillStyle,a),s.lineCap=ue(_.lineCap,"butt"),s.lineDashOffset=ue(_.lineDashOffset,0),s.lineJoin=ue(_.lineJoin,"miter"),s.lineWidth=P,s.strokeStyle=ue(_.strokeStyle,a),s.setLineDash(ue(_.lineDash,[])),i.usePointStyle){const A={radius:m*Math.SQRT2/2,pointStyle:_.pointStyle,rotation:_.rotation,borderWidth:P},O=l.xPlus(j,g/2),F=N+f;X2(s,A,O,F,i.pointStyleWidth&&g)}else{const A=N+Math.max((h-m)/2,0),O=l.leftForLtr(j,g),F=Wi(_.borderRadius);s.beginPath(),Object.values(F).some(D=>D!==0)?Mf(s,{x:O,y:A,w:g,h:m,radius:F}):s.rect(O,A,g,m),s.fill(),P!==0&&s.stroke()}s.restore()},v=function(j,N,_){ka(s,_.text,j,N+y/2,u,{strikethrough:_.hidden,textAlign:l.textAlign(_.textAlign)})},b=this.isHorizontal(),k=this._computeTitleHeight();b?p={x:pt(o,this.left+d,this.right-r[0]),y:this.top+d+k,line:0}:p={x:this.left+d,y:pt(o,this.top+k+d,this.bottom-n[0].height),line:0},nS(this.ctx,t.textDirection);const w=y+d;this.legendItems.forEach((j,N)=>{s.strokeStyle=j.fontColor,s.fillStyle=j.fontColor;const _=s.measureText(j.text).width,P=l.textAlign(j.textAlign||(j.textAlign=i.textAlign)),A=g+f+_;let O=p.x,F=p.y;l.setWidth(this.width),b?N>0&&O+A+d>this.right&&(F=p.y+=w,p.line++,O=p.x=pt(o,this.left+d,this.right-r[p.line])):N>0&&F+w>this.bottom&&(O=p.x=O+n[p.line].width+d,p.line++,F=p.y=pt(o,this.top+k+d,this.bottom-n[p.line].height));const D=l.x(O);if(x(D,F,j),O=TM(P,O+g+f,b?O+A:this.right,t.rtl),v(l.x(O),F,j),b)p.x+=A+d;else if(typeof j.text!="string"){const U=u.lineHeight;p.y+=SS(j,U)+d}else p.y+=w}),rS(this.ctx,t.textDirection)}drawTitle(){const t=this.options,n=t.title,r=yt(n.font),s=hn(n.padding);if(!n.display)return;const o=vo(t.rtl,this.left,this.width),i=this.ctx,a=n.position,l=r.size/2,u=s.top+l;let d,h=this.left,f=this.width;if(this.isHorizontal())f=Math.max(...this.lineWidths),d=this.top+u,h=pt(t.align,h,this.right-f);else{const g=this.columnSizes.reduce((m,y)=>Math.max(m,y.height),0);d=u+pt(t.align,this.top,this.bottom-g-t.labels.padding-this._computeTitleHeight())}const p=pt(a,h,h+f);i.textAlign=o.textAlign(Lg(a)),i.textBaseline="middle",i.strokeStyle=n.color,i.fillStyle=n.color,i.font=r.string,ka(i,n.text,p,d,r)}_computeTitleHeight(){const t=this.options.title,n=yt(t.font),r=hn(t.padding);return t.display?n.lineHeight+r.height:0}_getLegendItemAt(t,n){let r,s,o;if(bs(t,this.left,this.right)&&bs(n,this.top,this.bottom)){for(o=this.legendHitBoxes,r=0;ro.length>i.length?o:i)),t+n.size/2+r.measureText(s).width}function $D(e,t,n){let r=e;return typeof t.text!="string"&&(r=SS(t,n)),r}function SS(e,t){const n=e.text?e.text.length:0;return t*n}function HD(e,t){return!!((e==="mousemove"||e==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(e==="click"||e==="mouseup"))}var Fu={id:"legend",_element:ab,start(e,t,n){const r=e.legend=new ab({ctx:e.ctx,options:n,chart:e});ln.configure(e,r,n),ln.addBox(e,r)},stop(e){ln.removeBox(e,e.legend),delete e.legend},beforeUpdate(e,t,n){const r=e.legend;ln.configure(e,r,n),r.options=n},afterUpdate(e){const t=e.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(e,t){t.replay||e.legend.handleEvent(t.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(e,t,n){const r=t.datasetIndex,s=n.chart;s.isDatasetVisible(r)?(s.hide(r),t.hidden=!0):(s.show(r),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:e=>e.chart.options.color,boxWidth:40,padding:10,generateLabels(e){const t=e.data.datasets,{labels:{usePointStyle:n,pointStyle:r,textAlign:s,color:o,useBorderRadius:i,borderRadius:a}}=e.legend.options;return e._getSortedDatasetMetas().map(l=>{const u=l.controller.getStyle(n?0:void 0),d=hn(u.borderWidth);return{text:t[l.index].label,fillStyle:u.backgroundColor,fontColor:o,hidden:!l.visible,lineCap:u.borderCapStyle,lineDash:u.borderDash,lineDashOffset:u.borderDashOffset,lineJoin:u.borderJoinStyle,lineWidth:(d.width+d.height)/4,strokeStyle:u.borderColor,pointStyle:r||u.pointStyle,rotation:u.rotation,textAlign:s||u.textAlign,borderRadius:i&&(a||u.borderRadius),datasetIndex:l.index}},this)}},title:{color:e=>e.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:e=>!e.startsWith("on"),labels:{_scriptable:e=>!["generateLabels","filter","sort"].includes(e)}}};class _S extends Zr{constructor(t){super(),this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,n){const r=this.options;if(this.left=0,this.top=0,!r.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=t,this.height=this.bottom=n;const s=We(r.text)?r.text.length:1;this._padding=hn(r.padding);const o=s*yt(r.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=o:this.width=o}isHorizontal(){const t=this.options.position;return t==="top"||t==="bottom"}_drawArgs(t){const{top:n,left:r,bottom:s,right:o,options:i}=this,a=i.align;let l=0,u,d,h;return this.isHorizontal()?(d=pt(a,r,o),h=n+t,u=o-r):(i.position==="left"?(d=r+t,h=pt(a,s,n),l=xe*-.5):(d=o-t,h=pt(a,n,s),l=xe*.5),u=s-n),{titleX:d,titleY:h,maxWidth:u,rotation:l}}draw(){const t=this.ctx,n=this.options;if(!n.display)return;const r=yt(n.font),o=r.lineHeight/2+this._padding.top,{titleX:i,titleY:a,maxWidth:l,rotation:u}=this._drawArgs(o);ka(t,n.text,0,0,r,{color:n.color,maxWidth:l,rotation:u,textAlign:Lg(n.align),textBaseline:"middle",translation:[i,a]})}}function UD(e,t){const n=new _S({ctx:e.ctx,options:t,chart:e});ln.configure(e,n,t),ln.addBox(e,n),e.titleBlock=n}var zu={id:"title",_element:_S,start(e,t,n){UD(e,n)},stop(e){const t=e.titleBlock;ln.removeBox(e,t),delete e.titleBlock},beforeUpdate(e,t,n){const r=e.titleBlock;ln.configure(e,r,n),r.options=n},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const Ni={average(e){if(!e.length)return!1;let t,n,r=new Set,s=0,o=0;for(t=0,n=e.length;ta+l)/r.size,y:s/o}},nearest(e,t){if(!e.length)return!1;let n=t.x,r=t.y,s=Number.POSITIVE_INFINITY,o,i,a;for(o=0,i=e.length;oa({chart:t,initial:n.initial,numSteps:i,currentStep:Math.min(r-n.start,i)}))}_refresh(){this._request||(this._running=!0,this._request=K2.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let n=0;this._charts.forEach((r,s)=>{if(!r.running||!r.items.length)return;const o=r.items;let i=o.length-1,a=!1,l;for(;i>=0;--i)l=o[i],l._active?(l._total>r.duration&&(r.duration=l._total),l.tick(t),a=!0):(o[i]=o[o.length-1],o.pop());a&&(s.draw(),this._notify(s,r,t,"progress")),o.length||(r.running=!1,this._notify(s,r,t,"complete"),r.initial=!1),n+=o.length}),this._lastDate=t,n===0&&(this._running=!1)}_getAnims(t){const n=this._charts;let r=n.get(t);return r||(r={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},n.set(t,r)),r}listen(t,n,r){this._getAnims(t).listeners[n].push(r)}add(t,n){!n||!n.length||this._getAnims(t).items.push(...n)}has(t){return this._getAnims(t).items.length>0}start(t){const n=this._charts.get(t);n&&(n.running=!0,n.start=Date.now(),n.duration=n.items.reduce((r,s)=>Math.max(r,s._duration),0),this._refresh())}running(t){if(!this._running)return!1;const n=this._charts.get(t);return!(!n||!n.running||!n.items.length)}stop(t){const n=this._charts.get(t);if(!n||!n.items.length)return;const r=n.items;let s=r.length-1;for(;s>=0;--s)r[s].cancel();n.items=[],this._notify(t,n,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var Vn=new OL;const Rx="transparent",DL={boolean(e,t,n){return n>.5?t:e},color(e,t,n){const r=xx(e||Rx),s=r.valid&&xx(t||Rx);return s&&s.valid?s.mix(r,n).hexString():t},number(e,t,n){return e+(t-e)*n}};class IL{constructor(t,n,r,s){const o=n[r];s=kl([t.to,s,o,t.from]);const i=kl([t.from,o,s]);this._active=!0,this._fn=t.fn||DL[t.type||typeof i],this._easing=Hi[t.easing]||Hi.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=n,this._prop=r,this._from=i,this._to=s,this._promises=void 0}active(){return this._active}update(t,n,r){if(this._active){this._notify(!1);const s=this._target[this._prop],o=r-this._start,i=this._duration-o;this._start=r,this._duration=Math.floor(Math.max(i,t.duration)),this._total+=o,this._loop=!!t.loop,this._to=kl([t.to,n,s,t.from]),this._from=kl([t.from,s,n])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const n=t-this._start,r=this._duration,s=this._prop,o=this._from,i=this._loop,a=this._to;let l;if(this._active=o!==a&&(i||n1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[s]=this._fn(o,a,l)}wait(){const t=this._promises||(this._promises=[]);return new Promise((n,r)=>{t.push({res:n,rej:r})})}_notify(t){const n=t?"res":"rej",r=this._promises||[];for(let s=0;s{const o=t[s];if(!he(o))return;const i={};for(const a of n)i[a]=o[a];(We(o.properties)&&o.properties||[s]).forEach(a=>{(a===s||!r.has(a))&&r.set(a,i)})})}_animateOptions(t,n){const r=n.options,s=zL(t,r);if(!s)return[];const o=this._createAnimations(s,r);return r.$shared&&FL(t.options.$animations,r).then(()=>{t.options=r},()=>{}),o}_createAnimations(t,n){const r=this._properties,s=[],o=t.$animations||(t.$animations={}),i=Object.keys(n),a=Date.now();let l;for(l=i.length-1;l>=0;--l){const u=i[l];if(u.charAt(0)==="$")continue;if(u==="options"){s.push(...this._animateOptions(t,n));continue}const d=n[u];let h=o[u];const f=r.get(u);if(h)if(f&&h.active()){h.update(f,d,a);continue}else h.cancel();if(!f||!f.duration){t[u]=d;continue}o[u]=h=new IL(f,t,u,d),s.push(h)}return s}update(t,n){if(this._properties.size===0){Object.assign(t,n);return}const r=this._createAnimations(t,n);if(r.length)return Vn.add(this._chart,r),!0}}function FL(e,t){const n=[],r=Object.keys(t);for(let s=0;s0||!n&&o<0)return s.index}return null}function Mx(e,t){const{chart:n,_cachedMeta:r}=e,s=n._stacks||(n._stacks={}),{iScale:o,vScale:i,index:a}=r,l=o.axis,u=i.axis,d=HL(o,i,r),h=t.length;let f;for(let p=0;pn[r].axis===t).shift()}function GL(e,t){return Vs(e,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function KL(e,t,n){return Vs(e,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:n,index:t,mode:"default",type:"data"})}function hi(e,t){const n=e.controller.index,r=e.vScale&&e.vScale.axis;if(r){t=t||e._parsed;for(const s of t){const o=s._stacks;if(!o||o[r]===void 0||o[r][n]===void 0)return;delete o[r][n],o[r]._visualValues!==void 0&&o[r]._visualValues[n]!==void 0&&delete o[r]._visualValues[n]}}}const Wd=e=>e==="reset"||e==="none",Lx=(e,t)=>t?e:Object.assign({},e),qL=(e,t,n)=>e&&!t.hidden&&t._stacked&&{keys:cS(n,!0),values:null};class ko{constructor(t,n){this.chart=t,this._ctx=t.ctx,this.index=n,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=Hd(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(t){this.index!==t&&hi(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,n=this._cachedMeta,r=this.getDataset(),s=(h,f,p,g)=>h==="x"?f:h==="r"?g:p,o=n.xAxisID=ue(r.xAxisID,Ud(t,"x")),i=n.yAxisID=ue(r.yAxisID,Ud(t,"y")),a=n.rAxisID=ue(r.rAxisID,Ud(t,"r")),l=n.indexAxis,u=n.iAxisID=s(l,o,i,a),d=n.vAxisID=s(l,i,o,a);n.xScale=this.getScaleForId(o),n.yScale=this.getScaleForId(i),n.rScale=this.getScaleForId(a),n.iScale=this.getScaleForId(u),n.vScale=this.getScaleForId(d)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const n=this._cachedMeta;return t===n.iScale?n.vScale:n.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&gx(this._data,this),t._stacked&&hi(t)}_dataCheck(){const t=this.getDataset(),n=t.data||(t.data=[]),r=this._data;if(he(n)){const s=this._cachedMeta;this._data=$L(n,s)}else if(r!==n){if(r){gx(r,this);const s=this._cachedMeta;hi(s),s._parsed=[]}n&&Object.isExtensible(n)&&PM(n,this),this._syncList=[],this._data=n}}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const n=this._cachedMeta,r=this.getDataset();let s=!1;this._dataCheck();const o=n._stacked;n._stacked=Hd(n.vScale,n),n.stack!==r.stack&&(s=!0,hi(n),n.stack=r.stack),this._resyncElements(t),(s||o!==n._stacked)&&(Mx(this,n._parsed),n._stacked=Hd(n.vScale,n))}configure(){const t=this.chart.config,n=t.datasetScopeKeys(this._type),r=t.getOptionScopes(this.getDataset(),n,!0);this.options=t.createResolver(r,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,n){const{_cachedMeta:r,_data:s}=this,{iScale:o,_stacked:i}=r,a=o.axis;let l=t===0&&n===s.length?!0:r._sorted,u=t>0&&r._parsed[t-1],d,h,f;if(this._parsing===!1)r._parsed=s,r._sorted=!0,f=s;else{We(s[t])?f=this.parseArrayData(r,s,t,n):he(s[t])?f=this.parseObjectData(r,s,t,n):f=this.parsePrimitiveData(r,s,t,n);const p=()=>h[a]===null||u&&h[a]m||h=0;--f)if(!g()){this.updateRangeFromParsed(u,t,p,l);break}}return u}getAllParsedValues(t){const n=this._cachedMeta._parsed,r=[];let s,o,i;for(s=0,o=n.length;s=0&&tthis.getContext(r,s,n),m=u.resolveNamedOptions(f,p,g,h);return m.$shared&&(m.$shared=l,o[i]=Object.freeze(Lx(m,l))),m}_resolveAnimations(t,n,r){const s=this.chart,o=this._cachedDataOpts,i=`animation-${n}`,a=o[i];if(a)return a;let l;if(s.options.animation!==!1){const d=this.chart.config,h=d.datasetAnimationScopeKeys(this._type,n),f=d.getOptionScopes(this.getDataset(),h);l=d.createResolver(f,this.getContext(t,r,n))}const u=new lS(s,l&&l.animations);return l&&l._cacheable&&(o[i]=Object.freeze(u)),u}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,n){return!n||Wd(t)||this.chart._animationsDisabled}_getSharedOptions(t,n){const r=this.resolveDataElementOptions(t,n),s=this._sharedOptions,o=this.getSharedOptions(r),i=this.includeOptions(n,o)||o!==s;return this.updateSharedOptions(o,n,r),{sharedOptions:o,includeOptions:i}}updateElement(t,n,r,s){Wd(s)?Object.assign(t,r):this._resolveAnimations(n,s).update(t,r)}updateSharedOptions(t,n,r){t&&!Wd(n)&&this._resolveAnimations(void 0,n).update(t,r)}_setStyle(t,n,r,s){t.active=s;const o=this.getStyle(n,s);this._resolveAnimations(n,r,s).update(t,{options:!s&&this.getSharedOptions(o)||o})}removeHoverStyle(t,n,r){this._setStyle(t,r,"active",!1)}setHoverStyle(t,n,r){this._setStyle(t,r,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const n=this._data,r=this._cachedMeta.data;for(const[a,l,u]of this._syncList)this[a](l,u);this._syncList=[];const s=r.length,o=n.length,i=Math.min(o,s);i&&this.parse(0,i),o>s?this._insertElements(s,o-s,t):o{for(u.length+=n,a=u.length-1;a>=i;a--)u[a]=u[a-n]};for(l(o),a=t;ava(b,a,l,!0)?1:Math.max(k,k*n,w,w*n),g=(b,k,w)=>va(b,a,l,!0)?-1:Math.min(k,k*n,w,w*n),m=p(0,u,h),y=p(Ke,d,f),x=g(xe,u,h),v=g(xe+Ke,d,f);r=(m-x)/2,s=(y-v)/2,o=-(m+x)/2,i=-(y+v)/2}return{ratioX:r,ratioY:s,offsetX:o,offsetY:i}}class _i extends ko{constructor(t,n){super(t,n),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,n){const r=this.getDataset().data,s=this._cachedMeta;if(this._parsing===!1)s._parsed=r;else{let o=l=>+r[l];if(he(r[t])){const{key:l="value"}=this._parsing;o=u=>+xa(r[u],l)}let i,a;for(i=t,a=t+n;i0&&!isNaN(t)?Ae*(Math.abs(t)/n):0}getLabelAndValue(t){const n=this._cachedMeta,r=this.chart,s=r.data.labels||[],o=Dg(n._parsed[t],r.options.locale);return{label:s[t]||"",value:o}}getMaxBorderWidth(t){let n=0;const r=this.chart;let s,o,i,a,l;if(!t){for(s=0,o=r.data.datasets.length;st!=="spacing",_indexable:t=>t!=="spacing"&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")}),Z(_i,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const n=t.data,{labels:{pointStyle:r,textAlign:s,color:o,useBorderRadius:i,borderRadius:a}}=t.legend.options;return n.labels.length&&n.datasets.length?n.labels.map((l,u)=>{const h=t.getDatasetMeta(0).controller.getStyle(u);return{text:l,fillStyle:h.backgroundColor,fontColor:o,hidden:!t.getDataVisibility(u),lineDash:h.borderDash,lineDashOffset:h.borderDashOffset,lineJoin:h.borderJoinStyle,lineWidth:h.borderWidth,strokeStyle:h.borderColor,textAlign:s,pointStyle:r,borderRadius:i&&(a||h.borderRadius),index:u}}):[]}},onClick(t,n,r){r.chart.toggleDataVisibility(n.index),r.chart.update()}}}});class tc extends ko{initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){const n=this._cachedMeta,{dataset:r,data:s=[],_dataset:o}=n,i=this.chart._animationsDisabled;let{start:a,count:l}=AM(n,s,i);this._drawStart=a,this._drawCount=l,MM(n)&&(a=0,l=s.length),r._chart=this.chart,r._datasetIndex=this.index,r._decimated=!!o._decimated,r.points=s;const u=this.resolveDatasetElementOptions(t);this.options.showLine||(u.borderWidth=0),u.segment=this.options.segment,this.updateElement(r,void 0,{animated:!i,options:u},t),this.updateElements(s,a,l,t)}updateElements(t,n,r,s){const o=s==="reset",{iScale:i,vScale:a,_stacked:l,_dataset:u}=this._cachedMeta,{sharedOptions:d,includeOptions:h}=this._getSharedOptions(n,s),f=i.axis,p=a.axis,{spanGaps:g,segment:m}=this.options,y=ba(g)?g:Number.POSITIVE_INFINITY,x=this.chart._animationsDisabled||o||s==="none",v=n+r,b=t.length;let k=n>0&&this.getParsed(n-1);for(let w=0;w=v){N.skip=!0;continue}const _=this.getParsed(w),P=ke(_[p]),A=N[f]=i.getPixelForValue(_[f],w),O=N[p]=o||P?a.getBasePixel():a.getPixelForValue(l?this.applyStack(a,_,l):_[p],w);N.skip=isNaN(A)||isNaN(O)||P,N.stop=w>0&&Math.abs(_[f]-k[f])>y,m&&(N.parsed=_,N.raw=u.data[w]),h&&(N.options=d||this.resolveDataElementOptions(w,j.active?"active":s)),x||this.updateElement(j,w,N,s),k=_}}getMaxOverflow(){const t=this._cachedMeta,n=t.dataset,r=n.options&&n.options.borderWidth||0,s=t.data||[];if(!s.length)return r;const o=s[0].size(this.resolveDataElementOptions(0)),i=s[s.length-1].size(this.resolveDataElementOptions(s.length-1));return Math.max(r,o,i)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}}Z(tc,"id","line"),Z(tc,"defaults",{datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1}),Z(tc,"overrides",{scales:{_index_:{type:"category"},_value_:{type:"linear"}}});class Lf extends _i{}Z(Lf,"id","pie"),Z(Lf,"defaults",{cutout:0,rotation:0,circumference:360,radius:"100%"});function is(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class Hg{constructor(t){Z(this,"options");this.options=t||{}}static override(t){Object.assign(Hg.prototype,t)}init(){}formats(){return is()}parse(){return is()}format(){return is()}add(){return is()}diff(){return is()}startOf(){return is()}endOf(){return is()}}var XL={_date:Hg};function QL(e,t,n,r){const{controller:s,data:o,_sorted:i}=e,a=s._cachedMeta.iScale,l=e.dataset&&e.dataset.options?e.dataset.options.spanGaps:null;if(a&&t===a.axis&&t!=="r"&&i&&o.length){const u=a._reversePixels?CM:vs;if(r){if(s._sharedOptions){const d=o[0],h=typeof d.getRange=="function"&&d.getRange(t);if(h){const f=u(o,t,n-h),p=u(o,t,n+h);return{lo:f.lo,hi:p.hi}}}}else{const d=u(o,t,n);if(l){const{vScale:h}=s._cachedMeta,{_parsed:f}=e,p=f.slice(0,d.lo+1).reverse().findIndex(m=>!ke(m[h.axis]));d.lo-=Math.max(0,p);const g=f.slice(d.hi).findIndex(m=>!ke(m[h.axis]));d.hi+=Math.max(0,g)}return d}}return{lo:0,hi:o.length-1}}function Ou(e,t,n,r,s){const o=e.getSortedVisibleDatasetMetas(),i=n[t];for(let a=0,l=o.length;a{l[i]&&l[i](t[n],s)&&(o.push({element:l,datasetIndex:u,index:d}),a=a||l.inRange(t.x,t.y,s))}),r&&!a?[]:o}var tO={modes:{index(e,t,n,r){const s=hs(t,e),o=n.axis||"x",i=n.includeInvisible||!1,a=n.intersect?Gd(e,s,o,r,i):Kd(e,s,o,!1,r,i),l=[];return a.length?(e.getSortedVisibleDatasetMetas().forEach(u=>{const d=a[0].index,h=u.data[d];h&&!h.skip&&l.push({element:h,datasetIndex:u.index,index:d})}),l):[]},dataset(e,t,n,r){const s=hs(t,e),o=n.axis||"xy",i=n.includeInvisible||!1;let a=n.intersect?Gd(e,s,o,r,i):Kd(e,s,o,!1,r,i);if(a.length>0){const l=a[0].datasetIndex,u=e.getDatasetMeta(l).data;a=[];for(let d=0;dn.pos===t)}function Dx(e,t){return e.filter(n=>uS.indexOf(n.pos)===-1&&n.box.axis===t)}function pi(e,t){return e.sort((n,r)=>{const s=t?r:n,o=t?n:r;return s.weight===o.weight?s.index-o.index:s.weight-o.weight})}function nO(e){const t=[];let n,r,s,o,i,a;for(n=0,r=(e||[]).length;nu.box.fullSize),!0),r=pi(fi(t,"left"),!0),s=pi(fi(t,"right")),o=pi(fi(t,"top"),!0),i=pi(fi(t,"bottom")),a=Dx(t,"x"),l=Dx(t,"y");return{fullSize:n,leftAndTop:r.concat(o),rightAndBottom:s.concat(l).concat(i).concat(a),chartArea:fi(t,"chartArea"),vertical:r.concat(s).concat(l),horizontal:o.concat(i).concat(a)}}function Ix(e,t,n,r){return Math.max(e[n],t[n])+Math.max(e[r],t[r])}function dS(e,t){e.top=Math.max(e.top,t.top),e.left=Math.max(e.left,t.left),e.bottom=Math.max(e.bottom,t.bottom),e.right=Math.max(e.right,t.right)}function iO(e,t,n,r){const{pos:s,box:o}=n,i=e.maxPadding;if(!he(s)){n.size&&(e[s]-=n.size);const h=r[n.stack]||{size:0,count:1};h.size=Math.max(h.size,n.horizontal?o.height:o.width),n.size=h.size/h.count,e[s]+=n.size}o.getPadding&&dS(i,o.getPadding());const a=Math.max(0,t.outerWidth-Ix(i,e,"left","right")),l=Math.max(0,t.outerHeight-Ix(i,e,"top","bottom")),u=a!==e.w,d=l!==e.h;return e.w=a,e.h=l,n.horizontal?{same:u,other:d}:{same:d,other:u}}function aO(e){const t=e.maxPadding;function n(r){const s=Math.max(t[r]-e[r],0);return e[r]+=s,s}e.y+=n("top"),e.x+=n("left"),n("right"),n("bottom")}function lO(e,t){const n=t.maxPadding;function r(s){const o={left:0,top:0,right:0,bottom:0};return s.forEach(i=>{o[i]=Math.max(t[i],n[i])}),o}return r(e?["left","right"]:["top","bottom"])}function ji(e,t,n,r){const s=[];let o,i,a,l,u,d;for(o=0,i=e.length,u=0;o{typeof m.beforeLayout=="function"&&m.beforeLayout()});const d=l.reduce((m,y)=>y.box.options&&y.box.options.display===!1?m:m+1,0)||1,h=Object.freeze({outerWidth:t,outerHeight:n,padding:s,availableWidth:o,availableHeight:i,vBoxMaxWidth:o/2/d,hBoxMaxHeight:i/2}),f=Object.assign({},s);dS(f,hn(r));const p=Object.assign({maxPadding:f,w:o,h:i,x:s.left,y:s.top},s),g=sO(l.concat(u),h);ji(a.fullSize,p,h,g),ji(l,p,h,g),ji(u,p,h,g)&&ji(l,p,h,g),aO(p),Fx(a.leftAndTop,p,h,g),p.x+=p.w,p.y+=p.h,Fx(a.rightAndBottom,p,h,g),e.chartArea={left:p.left,top:p.top,right:p.left+p.w,bottom:p.top+p.h,height:p.h,width:p.w},ye(a.chartArea,m=>{const y=m.box;Object.assign(y,e.chartArea),y.update(p.w,p.h,{left:0,top:0,right:0,bottom:0})})}};class hS{acquireContext(t,n){}releaseContext(t){return!1}addEventListener(t,n,r){}removeEventListener(t,n,r){}getDevicePixelRatio(){return 1}getMaximumSize(t,n,r,s){return n=Math.max(0,n||t.width),r=r||t.height,{width:n,height:Math.max(0,s?Math.floor(n/s):r)}}isAttached(t){return!0}updateConfig(t){}}class cO extends hS{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const nc="$chartjs",uO={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},zx=e=>e===null||e==="";function dO(e,t){const n=e.style,r=e.getAttribute("height"),s=e.getAttribute("width");if(e[nc]={initial:{height:r,width:s,style:{display:n.display,height:n.height,width:n.width}}},n.display=n.display||"block",n.boxSizing=n.boxSizing||"border-box",zx(s)){const o=jx(e,"width");o!==void 0&&(e.width=o)}if(zx(r))if(e.style.height==="")e.height=e.width/(t||2);else{const o=jx(e,"height");o!==void 0&&(e.height=o)}return e}const fS=SL?{passive:!0}:!1;function hO(e,t,n){e&&e.addEventListener(t,n,fS)}function fO(e,t,n){e&&e.canvas&&e.canvas.removeEventListener(t,n,fS)}function pO(e,t){const n=uO[e.type]||e.type,{x:r,y:s}=hs(e,t);return{type:n,chart:t,native:e,x:r!==void 0?r:null,y:s!==void 0?s:null}}function qc(e,t){for(const n of e)if(n===t||n.contains(t))return!0}function gO(e,t,n){const r=e.canvas,s=new MutationObserver(o=>{let i=!1;for(const a of o)i=i||qc(a.addedNodes,r),i=i&&!qc(a.removedNodes,r);i&&n()});return s.observe(document,{childList:!0,subtree:!0}),s}function mO(e,t,n){const r=e.canvas,s=new MutationObserver(o=>{let i=!1;for(const a of o)i=i||qc(a.removedNodes,r),i=i&&!qc(a.addedNodes,r);i&&n()});return s.observe(document,{childList:!0,subtree:!0}),s}const Sa=new Map;let Vx=0;function pS(){const e=window.devicePixelRatio;e!==Vx&&(Vx=e,Sa.forEach((t,n)=>{n.currentDevicePixelRatio!==e&&t()}))}function yO(e,t){Sa.size||window.addEventListener("resize",pS),Sa.set(e,t)}function xO(e){Sa.delete(e),Sa.size||window.removeEventListener("resize",pS)}function bO(e,t,n){const r=e.canvas,s=r&&$g(r);if(!s)return;const o=q2((a,l)=>{const u=s.clientWidth;n(a,l),u{const l=a[0],u=l.contentRect.width,d=l.contentRect.height;u===0&&d===0||o(u,d)});return i.observe(s),yO(e,o),i}function qd(e,t,n){n&&n.disconnect(),t==="resize"&&xO(e)}function vO(e,t,n){const r=e.canvas,s=q2(o=>{e.ctx!==null&&n(pO(o,e))},e);return hO(r,t,s),s}class wO extends hS{acquireContext(t,n){const r=t&&t.getContext&&t.getContext("2d");return r&&r.canvas===t?(dO(t,n),r):null}releaseContext(t){const n=t.canvas;if(!n[nc])return!1;const r=n[nc].initial;["height","width"].forEach(o=>{const i=r[o];ke(i)?n.removeAttribute(o):n.setAttribute(o,i)});const s=r.style||{};return Object.keys(s).forEach(o=>{n.style[o]=s[o]}),n.width=n.width,delete n[nc],!0}addEventListener(t,n,r){this.removeEventListener(t,n);const s=t.$proxies||(t.$proxies={}),i={attach:gO,detach:mO,resize:bO}[n]||vO;s[n]=i(t,n,r)}removeEventListener(t,n){const r=t.$proxies||(t.$proxies={}),s=r[n];if(!s)return;({attach:qd,detach:qd,resize:qd}[n]||fO)(t,n,s),r[n]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,n,r,s){return kL(t,n,r,s)}isAttached(t){const n=t&&$g(t);return!!(n&&n.isConnected)}}function kO(e){return!Bg()||typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas?cO:wO}var Dl;let Zr=(Dl=class{constructor(){Z(this,"x");Z(this,"y");Z(this,"active",!1);Z(this,"options");Z(this,"$animations")}tooltipPosition(t){const{x:n,y:r}=this.getProps(["x","y"],t);return{x:n,y:r}}hasValue(){return ba(this.x)&&ba(this.y)}getProps(t,n){const r=this.$animations;if(!n||!r)return this;const s={};return t.forEach(o=>{s[o]=r[o]&&r[o].active()?r[o]._to:this[o]}),s}},Z(Dl,"defaults",{}),Z(Dl,"defaultRoutes"),Dl);function SO(e,t){const n=e.options.ticks,r=_O(e),s=Math.min(n.maxTicksLimit||r,r),o=n.major.enabled?CO(t):[],i=o.length,a=o[0],l=o[i-1],u=[];if(i>s)return NO(t,u,o,i/s),u;const d=jO(o,t,s);if(i>0){let h,f;const p=i>1?Math.round((l-a)/(i-1)):null;for(Cl(t,u,d,ke(p)?0:a-p,a),h=0,f=i-1;hs)return l}return Math.max(s,1)}function CO(e){const t=[];let n,r;for(n=0,r=e.length;ne==="left"?"right":e==="right"?"left":e,Bx=(e,t,n)=>t==="top"||t==="left"?e[t]+n:e[t]-n,$x=(e,t)=>Math.min(t||e,e);function Hx(e,t){const n=[],r=e.length/t,s=e.length;let o=0;for(;oi+a)))return l}function TO(e,t){ye(e,n=>{const r=n.gc,s=r.length/2;let o;if(s>t){for(o=0;or?r:n,r=s&&n>r?n:r,{min:Pn(n,Pn(r,n)),max:Pn(r,Pn(n,r))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){je(this.options.beforeUpdate,[this])}update(t,n,r){const{beginAtZero:s,grace:o,ticks:i}=this.options,a=i.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=n,this._margins=r=Object.assign({left:0,right:0,top:0,bottom:0},r),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+r.left+r.right:this.height+r.top+r.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=eL(this,o,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=a=o||r<=1||!this.isHorizontal()){this.labelRotation=s;return}const d=this._getLabelSizes(),h=d.widest.width,f=d.highest.height,p=_t(this.chart.width-h,0,this.maxWidth);a=t.offset?this.maxWidth/r:p/(r-1),h+6>a&&(a=p/(r-(t.offset?.5:1)),l=this.maxHeight-gi(t.grid)-n.padding-Ux(t.title,this.chart.options.font),u=Math.sqrt(h*h+f*f),i=SM(Math.min(Math.asin(_t((d.highest.height+6)/a,-1,1)),Math.asin(_t(l/u,-1,1))-Math.asin(_t(f/u,-1,1)))),i=Math.max(s,Math.min(o,i))),this.labelRotation=i}afterCalculateLabelRotation(){je(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){je(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:n,options:{ticks:r,title:s,grid:o}}=this,i=this._isVisible(),a=this.isHorizontal();if(i){const l=Ux(s,n.options.font);if(a?(t.width=this.maxWidth,t.height=gi(o)+l):(t.height=this.maxHeight,t.width=gi(o)+l),r.display&&this.ticks.length){const{first:u,last:d,widest:h,highest:f}=this._getLabelSizes(),p=r.padding*2,g=Xn(this.labelRotation),m=Math.cos(g),y=Math.sin(g);if(a){const x=r.mirror?0:y*h.width+m*f.height;t.height=Math.min(this.maxHeight,t.height+x+p)}else{const x=r.mirror?0:m*h.width+y*f.height;t.width=Math.min(this.maxWidth,t.width+x+p)}this._calculatePadding(u,d,y,m)}}this._handleMargins(),a?(this.width=this._length=n.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=n.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,n,r,s){const{ticks:{align:o,padding:i},position:a}=this.options,l=this.labelRotation!==0,u=a!=="top"&&this.axis==="x";if(this.isHorizontal()){const d=this.getPixelForTick(0)-this.left,h=this.right-this.getPixelForTick(this.ticks.length-1);let f=0,p=0;l?u?(f=s*t.width,p=r*n.height):(f=r*t.height,p=s*n.width):o==="start"?p=n.width:o==="end"?f=t.width:o!=="inner"&&(f=t.width/2,p=n.width/2),this.paddingLeft=Math.max((f-d+i)*this.width/(this.width-d),0),this.paddingRight=Math.max((p-h+i)*this.width/(this.width-h),0)}else{let d=n.height/2,h=t.height/2;o==="start"?(d=0,h=t.height):o==="end"&&(d=n.height,h=0),this.paddingTop=d+i,this.paddingBottom=h+i}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){je(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:n}=this.options;return n==="top"||n==="bottom"||t==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){this.beforeTickToLabelConversion(),this.generateTickLabels(t);let n,r;for(n=0,r=t.length;n({width:i[P]||0,height:a[P]||0});return{first:_(0),last:_(n-1),widest:_(j),highest:_(N),widths:i,heights:a}}getLabelForValue(t){return t}getPixelForValue(t,n){return NaN}getValueForPixel(t){}getPixelForTick(t){const n=this.ticks;return t<0||t>n.length-1?null:this.getPixelForValue(n[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const n=this._startPixel+t*this._length;return jM(this._alignToPixels?os(this.chart,n,0):n)}getDecimalForPixel(t){const n=(t-this._startPixel)/this._length;return this._reversePixels?1-n:n}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:n}=this;return t<0&&n<0?n:t>0&&n>0?t:0}getContext(t){const n=this.ticks||[];if(t>=0&&ta*s?a/r:l/s:l*s0}_computeGridLineItems(t){const n=this.axis,r=this.chart,s=this.options,{grid:o,position:i,border:a}=s,l=o.offset,u=this.isHorizontal(),h=this.ticks.length+(l?1:0),f=gi(o),p=[],g=a.setContext(this.getContext()),m=g.display?g.width:0,y=m/2,x=function(M){return os(r,M,m)};let v,b,k,w,j,N,_,P,A,O,F,D;if(i==="top")v=x(this.bottom),N=this.bottom-f,P=v-y,O=x(t.top)+y,D=t.bottom;else if(i==="bottom")v=x(this.top),O=t.top,D=x(t.bottom)-y,N=v+y,P=this.top+f;else if(i==="left")v=x(this.right),j=this.right-f,_=v-y,A=x(t.left)+y,F=t.right;else if(i==="right")v=x(this.left),A=t.left,F=x(t.right)-y,j=v+y,_=this.left+f;else if(n==="x"){if(i==="center")v=x((t.top+t.bottom)/2+.5);else if(he(i)){const M=Object.keys(i)[0],U=i[M];v=x(this.chart.scales[M].getPixelForValue(U))}O=t.top,D=t.bottom,N=v+y,P=N+f}else if(n==="y"){if(i==="center")v=x((t.left+t.right)/2);else if(he(i)){const M=Object.keys(i)[0],U=i[M];v=x(this.chart.scales[M].getPixelForValue(U))}j=v-y,_=j-f,A=t.left,F=t.right}const W=ue(s.ticks.maxTicksLimit,h),G=Math.max(1,Math.ceil(h/W));for(b=0;b0&&(ne-=$/2);break}I={left:ne,top:K,width:$+Y.width,height:T+Y.height,color:G.backdropColor}}y.push({label:k,font:P,textOffset:F,options:{rotation:m,color:U,strokeColor:C,strokeWidth:L,textAlign:E,textBaseline:D,translation:[w,j],backdrop:I}})}return y}_getXAxisLabelAlignment(){const{position:t,ticks:n}=this.options;if(-Xn(this.labelRotation))return t==="top"?"left":"right";let s="center";return n.align==="start"?s="left":n.align==="end"?s="right":n.align==="inner"&&(s="inner"),s}_getYAxisLabelAlignment(t){const{position:n,ticks:{crossAlign:r,mirror:s,padding:o}}=this.options,i=this._getLabelSizes(),a=t+o,l=i.widest.width;let u,d;return n==="left"?s?(d=this.right+o,r==="near"?u="left":r==="center"?(u="center",d+=l/2):(u="right",d+=l)):(d=this.right-a,r==="near"?u="right":r==="center"?(u="center",d-=l/2):(u="left",d=this.left)):n==="right"?s?(d=this.left+o,r==="near"?u="right":r==="center"?(u="center",d-=l/2):(u="left",d-=l)):(d=this.left+a,r==="near"?u="left":r==="center"?(u="center",d+=l/2):(u="right",d=this.right)):u="right",{textAlign:u,x:d}}_computeLabelArea(){if(this.options.ticks.mirror)return;const t=this.chart,n=this.options.position;if(n==="left"||n==="right")return{top:0,left:this.left,bottom:t.height,right:this.right};if(n==="top"||n==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:t.width}}drawBackground(){const{ctx:t,options:{backgroundColor:n},left:r,top:s,width:o,height:i}=this;n&&(t.save(),t.fillStyle=n,t.fillRect(r,s,o,i),t.restore())}getLineWidthForValue(t){const n=this.options.grid;if(!this._isVisible()||!n.display)return 0;const s=this.ticks.findIndex(o=>o.value===t);return s>=0?n.setContext(this.getContext(s)).lineWidth:0}drawGrid(t){const n=this.options.grid,r=this.ctx,s=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let o,i;const a=(l,u,d)=>{!d.width||!d.color||(r.save(),r.lineWidth=d.width,r.strokeStyle=d.color,r.setLineDash(d.borderDash||[]),r.lineDashOffset=d.borderDashOffset,r.beginPath(),r.moveTo(l.x,l.y),r.lineTo(u.x,u.y),r.stroke(),r.restore())};if(n.display)for(o=0,i=s.length;o{this.draw(o)}}]:[{z:r,draw:o=>{this.drawBackground(),this.drawGrid(o),this.drawTitle()}},{z:s,draw:()=>{this.drawBorder()}},{z:n,draw:o=>{this.drawLabels(o)}}]}getMatchingVisibleMetas(t){const n=this.chart.getSortedVisibleDatasetMetas(),r=this.axis+"AxisID",s=[];let o,i;for(o=0,i=n.length;o{const r=n.split("."),s=r.pop(),o=[e].concat(r).join("."),i=t[n].split("."),a=i.pop(),l=i.join(".");Fe.route(o,s,l,a)})}function FO(e){return"id"in e&&"defaults"in e}class zO{constructor(){this.controllers=new Nl(ko,"datasets",!0),this.elements=new Nl(Zr,"elements"),this.plugins=new Nl(Object,"plugins"),this.scales=new Nl(Xo,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,n,r){[...n].forEach(s=>{const o=r||this._getRegistryForType(s);r||o.isForType(s)||o===this.plugins&&s.id?this._exec(t,o,s):ye(s,i=>{const a=r||this._getRegistryForType(i);this._exec(t,a,i)})})}_exec(t,n,r){const s=Ag(t);je(r["before"+s],[],r),n[t](r),je(r["after"+s],[],r)}_getRegistryForType(t){for(let n=0;no.filter(a=>!i.some(l=>a.plugin.id===l.plugin.id));this._notify(s(n,r),t,"stop"),this._notify(s(r,n),t,"start")}}function BO(e){const t={},n=[],r=Object.keys(An.plugins.items);for(let o=0;o1&&Wx(e[0].toLowerCase());if(r)return r}throw new Error(`Cannot determine type of '${e}' axis. Please provide 'axis' or 'position' option.`)}function Gx(e,t,n){if(n[t+"AxisID"]===e)return{axis:t}}function qO(e,t){if(t.data&&t.data.datasets){const n=t.data.datasets.filter(r=>r.xAxisID===e||r.yAxisID===e);if(n.length)return Gx(e,"x",n[0])||Gx(e,"y",n[0])}return{}}function YO(e,t){const n=Ls[e.type]||{scales:{}},r=t.scales||{},s=Of(e.type,t),o=Object.create(null);return Object.keys(r).forEach(i=>{const a=r[i];if(!he(a))return console.error(`Invalid scale configuration for scale: ${i}`);if(a._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${i}`);const l=Df(i,a,qO(i,e),Fe.scales[a.type]),u=GO(l,s),d=n.scales||{};o[i]=Bi(Object.create(null),[{axis:l},a,d[l],d[u]])}),e.data.datasets.forEach(i=>{const a=i.type||e.type,l=i.indexAxis||Of(a,t),d=(Ls[a]||{}).scales||{};Object.keys(d).forEach(h=>{const f=WO(h,l),p=i[f+"AxisID"]||f;o[p]=o[p]||Object.create(null),Bi(o[p],[{axis:f},r[p],d[h]])})}),Object.keys(o).forEach(i=>{const a=o[i];Bi(a,[Fe.scales[a.type],Fe.scale])}),o}function gS(e){const t=e.options||(e.options={});t.plugins=ue(t.plugins,{}),t.scales=YO(e,t)}function mS(e){return e=e||{},e.datasets=e.datasets||[],e.labels=e.labels||[],e}function XO(e){return e=e||{},e.data=mS(e.data),gS(e),e}const Kx=new Map,yS=new Set;function Pl(e,t){let n=Kx.get(e);return n||(n=t(),Kx.set(e,n),yS.add(n)),n}const mi=(e,t,n)=>{const r=xa(t,n);r!==void 0&&e.add(r)};class QO{constructor(t){this._config=XO(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=mS(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),gS(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return Pl(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,n){return Pl(`${t}.transition.${n}`,()=>[[`datasets.${t}.transitions.${n}`,`transitions.${n}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,n){return Pl(`${t}-${n}`,()=>[[`datasets.${t}.elements.${n}`,`datasets.${t}`,`elements.${n}`,""]])}pluginScopeKeys(t){const n=t.id,r=this.type;return Pl(`${r}-plugin-${n}`,()=>[[`plugins.${n}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,n){const r=this._scopeCache;let s=r.get(t);return(!s||n)&&(s=new Map,r.set(t,s)),s}getOptionScopes(t,n,r){const{options:s,type:o}=this,i=this._cachedScopes(t,r),a=i.get(n);if(a)return a;const l=new Set;n.forEach(d=>{t&&(l.add(t),d.forEach(h=>mi(l,t,h))),d.forEach(h=>mi(l,s,h)),d.forEach(h=>mi(l,Ls[o]||{},h)),d.forEach(h=>mi(l,Fe,h)),d.forEach(h=>mi(l,Tf,h))});const u=Array.from(l);return u.length===0&&u.push(Object.create(null)),yS.has(n)&&i.set(n,u),u}chartOptionScopes(){const{options:t,type:n}=this;return[t,Ls[n]||{},Fe.datasets[n]||{},{type:n},Fe,Tf]}resolveNamedOptions(t,n,r,s=[""]){const o={$shared:!0},{resolver:i,subPrefixes:a}=qx(this._resolverCache,t,s);let l=i;if(ZO(i,n)){o.$shared=!1,r=Ur(r)?r():r;const u=this.createResolver(t,r,a);l=Io(i,r,u)}for(const u of n)o[u]=l[u];return o}createResolver(t,n,r=[""],s){const{resolver:o}=qx(this._resolverCache,t,r);return he(n)?Io(o,n,void 0,s):o}}function qx(e,t,n){let r=e.get(t);r||(r=new Map,e.set(t,r));const s=n.join();let o=r.get(s);return o||(o={resolver:Fg(t,n),subPrefixes:n.filter(a=>!a.toLowerCase().includes("hover"))},r.set(s,o)),o}const JO=e=>he(e)&&Object.getOwnPropertyNames(e).some(t=>Ur(e[t]));function ZO(e,t){const{isScriptable:n,isIndexable:r}=Q2(e);for(const s of t){const o=n(s),i=r(s),a=(i||o)&&e[s];if(o&&(Ur(a)||JO(a))||i&&We(a))return!0}return!1}var eD="4.5.1";const tD=["top","bottom","left","right","chartArea"];function Yx(e,t){return e==="top"||e==="bottom"||tD.indexOf(e)===-1&&t==="x"}function Xx(e,t){return function(n,r){return n[e]===r[e]?n[t]-r[t]:n[e]-r[e]}}function Qx(e){const t=e.chart,n=t.options.animation;t.notifyPlugins("afterRender"),je(n&&n.onComplete,[e],t)}function nD(e){const t=e.chart,n=t.options.animation;je(n&&n.onProgress,[e],t)}function xS(e){return Bg()&&typeof e=="string"?e=document.getElementById(e):e&&e.length&&(e=e[0]),e&&e.canvas&&(e=e.canvas),e}const rc={},Jx=e=>{const t=xS(e);return Object.values(rc).filter(n=>n.canvas===t).pop()};function rD(e,t,n){const r=Object.keys(e);for(const s of r){const o=+s;if(o>=t){const i=e[s];delete e[s],(n>0||o>t)&&(e[o+n]=i)}}}function sD(e,t,n,r){return!n||e.type==="mouseout"?null:r?t:e}var fr;let Bs=(fr=class{static register(...t){An.add(...t),Zx()}static unregister(...t){An.remove(...t),Zx()}constructor(t,n){const r=this.config=new QO(n),s=xS(t),o=Jx(s);if(o)throw new Error("Canvas is already in use. Chart with ID '"+o.id+"' must be destroyed before the canvas with ID '"+o.canvas.id+"' can be reused.");const i=r.createResolver(r.chartOptionScopes(),this.getContext());this.platform=new(r.platform||kO(s)),this.platform.updateConfig(r);const a=this.platform.acquireContext(s,i.aspectRatio),l=a&&a.canvas,u=l&&l.height,d=l&&l.width;if(this.id=uM(),this.ctx=a,this.canvas=l,this.width=d,this.height=u,this._options=i,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new VO,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=EM(h=>this.update(h),i.resizeDelay||0),this._dataChanges=[],rc[this.id]=this,!a||!l){console.error("Failed to create chart: can't acquire context from the given item");return}Vn.listen(this,"complete",Qx),Vn.listen(this,"progress",nD),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:n},width:r,height:s,_aspectRatio:o}=this;return ke(t)?n&&o?o:s?r/s:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return An}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():_x(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return wx(this.canvas,this.ctx),this}stop(){return Vn.stop(this),this}resize(t,n){Vn.running(this)?this._resizeBeforeDraw={width:t,height:n}:this._resize(t,n)}_resize(t,n){const r=this.options,s=this.canvas,o=r.maintainAspectRatio&&this.aspectRatio,i=this.platform.getMaximumSize(s,t,n,o),a=r.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=i.width,this.height=i.height,this._aspectRatio=this.aspectRatio,_x(this,a,!0)&&(this.notifyPlugins("resize",{size:i}),je(r.onResize,[this,i],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const n=this.options.scales||{};ye(n,(r,s)=>{r.id=s})}buildOrUpdateScales(){const t=this.options,n=t.scales,r=this.scales,s=Object.keys(r).reduce((i,a)=>(i[a]=!1,i),{});let o=[];n&&(o=o.concat(Object.keys(n).map(i=>{const a=n[i],l=Df(i,a),u=l==="r",d=l==="x";return{options:a,dposition:u?"chartArea":d?"bottom":"left",dtype:u?"radialLinear":d?"category":"linear"}}))),ye(o,i=>{const a=i.options,l=a.id,u=Df(l,a),d=ue(a.type,i.dtype);(a.position===void 0||Yx(a.position,u)!==Yx(i.dposition))&&(a.position=i.dposition),s[l]=!0;let h=null;if(l in r&&r[l].type===d)h=r[l];else{const f=An.getScale(d);h=new f({id:l,type:d,ctx:this.ctx,chart:this}),r[h.id]=h}h.init(a,t)}),ye(s,(i,a)=>{i||delete r[a]}),ye(r,i=>{ln.configure(this,i,i.options),ln.addBox(this,i)})}_updateMetasets(){const t=this._metasets,n=this.data.datasets.length,r=t.length;if(t.sort((s,o)=>s.index-o.index),r>n){for(let s=n;sn.length&&delete this._stacks,t.forEach((r,s)=>{n.filter(o=>o===r._dataset).length===0&&this._destroyDatasetMeta(s)})}buildOrUpdateControllers(){const t=[],n=this.data.datasets;let r,s;for(this._removeUnreferencedMetasets(),r=0,s=n.length;r{this.getDatasetMeta(n).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const n=this.config;n.update();const r=this._options=n.createResolver(n.chartOptionScopes(),this.getContext()),s=this._animationsDisabled=!r.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;const o=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let i=0;for(let u=0,d=this.data.datasets.length;u{u.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(Xx("z","_idx"));const{_active:a,_lastEvent:l}=this;l?this._eventHandler(l,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){ye(this.scales,t=>{ln.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,n=new Set(Object.keys(this._listeners)),r=new Set(t.events);(!dx(n,r)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,n=this._getUniformDataChanges()||[];for(const{method:r,start:s,count:o}of n){const i=r==="_removeElements"?-o:o;rD(t,s,i)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const n=this.data.datasets.length,r=o=>new Set(t.filter(i=>i[0]===o).map((i,a)=>a+","+i.splice(1).join(","))),s=r(0);for(let o=1;oo.split(",")).map(o=>({method:o[1],start:+o[2],count:+o[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;ln.update(this,this.width,this.height,t);const n=this.chartArea,r=n.width<=0||n.height<=0;this._layers=[],ye(this.boxes,s=>{r&&s.position==="chartArea"||(s.configure&&s.configure(),this._layers.push(...s._layers()))},this),this._layers.forEach((s,o)=>{s._idx=o}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let n=0,r=this.data.datasets.length;n=0;--n)this._drawDataset(t[n]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const n=this.ctx,r={meta:t,index:t.index,cancelable:!0},s=aS(this,t);this.notifyPlugins("beforeDatasetDraw",r)!==!1&&(s&&Au(n,s),t.controller.draw(),s&&Mu(n),r.cancelable=!1,this.notifyPlugins("afterDatasetDraw",r))}isPointInArea(t){return wa(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,n,r,s){const o=tO.modes[n];return typeof o=="function"?o(this,t,r,s):[]}getDatasetMeta(t){const n=this.data.datasets[t],r=this._metasets;let s=r.filter(o=>o&&o._dataset===n).pop();return s||(s={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:n&&n.order||0,index:t,_dataset:n,_parsed:[],_sorted:!1},r.push(s)),s}getContext(){return this.$context||(this.$context=Vs(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const n=this.data.datasets[t];if(!n)return!1;const r=this.getDatasetMeta(t);return typeof r.hidden=="boolean"?!r.hidden:!n.hidden}setDatasetVisibility(t,n){const r=this.getDatasetMeta(t);r.hidden=!n}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,n,r){const s=r?"show":"hide",o=this.getDatasetMeta(t),i=o.controller._resolveAnimations(void 0,s);Wc(n)?(o.data[n].hidden=!r,this.update()):(this.setDatasetVisibility(t,r),i.update(o,{visible:r}),this.update(a=>a.datasetIndex===t?s:void 0))}hide(t,n){this._updateVisibility(t,n,!1)}show(t,n){this._updateVisibility(t,n,!0)}_destroyDatasetMeta(t){const n=this._metasets[t];n&&n.controller&&n.controller._destroy(),delete this._metasets[t]}_stop(){let t,n;for(this.stop(),Vn.remove(this),t=0,n=this.data.datasets.length;t{n.addEventListener(this,o,i),t[o]=i},s=(o,i,a)=>{o.offsetX=i,o.offsetY=a,this._eventHandler(o)};ye(this.options.events,o=>r(o,s))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,n=this.platform,r=(l,u)=>{n.addEventListener(this,l,u),t[l]=u},s=(l,u)=>{t[l]&&(n.removeEventListener(this,l,u),delete t[l])},o=(l,u)=>{this.canvas&&this.resize(l,u)};let i;const a=()=>{s("attach",a),this.attached=!0,this.resize(),r("resize",o),r("detach",i)};i=()=>{this.attached=!1,s("resize",o),this._stop(),this._resize(0,0),r("attach",a)},n.isAttached(this.canvas)?a():i()}unbindEvents(){ye(this._listeners,(t,n)=>{this.platform.removeEventListener(this,n,t)}),this._listeners={},ye(this._responsiveListeners,(t,n)=>{this.platform.removeEventListener(this,n,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,n,r){const s=r?"set":"remove";let o,i,a,l;for(n==="dataset"&&(o=this.getDatasetMeta(t[0].datasetIndex),o.controller["_"+s+"DatasetHoverStyle"]()),a=0,l=t.length;a{const a=this.getDatasetMeta(o);if(!a)throw new Error("No dataset found at index "+o);return{datasetIndex:o,element:a.data[i],index:i}});!Hc(r,n)&&(this._active=r,this._lastEvent=null,this._updateHoverStyles(r,n))}notifyPlugins(t,n,r){return this._plugins.notify(this,t,n,r)}isPluginEnabled(t){return this._plugins._cache.filter(n=>n.plugin.id===t).length===1}_updateHoverStyles(t,n,r){const s=this.options.hover,o=(l,u)=>l.filter(d=>!u.some(h=>d.datasetIndex===h.datasetIndex&&d.index===h.index)),i=o(n,t),a=r?t:o(t,n);i.length&&this.updateHoverStyle(i,s.mode,!1),a.length&&s.mode&&this.updateHoverStyle(a,s.mode,!0)}_eventHandler(t,n){const r={event:t,replay:n,cancelable:!0,inChartArea:this.isPointInArea(t)},s=i=>(i.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",r,s)===!1)return;const o=this._handleEvent(t,n,r.inChartArea);return r.cancelable=!1,this.notifyPlugins("afterEvent",r,s),(o||r.changed)&&this.render(),this}_handleEvent(t,n,r){const{_active:s=[],options:o}=this,i=n,a=this._getActiveElements(t,s,r,i),l=mM(t),u=sD(t,this._lastEvent,r,l);r&&(this._lastEvent=null,je(o.onHover,[t,a,this],this),l&&je(o.onClick,[t,a,this],this));const d=!Hc(a,s);return(d||n)&&(this._active=a,this._updateHoverStyles(a,s,n)),this._lastEvent=u,d}_getActiveElements(t,n,r,s){if(t.type==="mouseout")return[];if(!r)return n;const o=this.options.hover;return this.getElementsAtEventForMode(t,o.mode,o,s)}},Z(fr,"defaults",Fe),Z(fr,"instances",rc),Z(fr,"overrides",Ls),Z(fr,"registry",An),Z(fr,"version",eD),Z(fr,"getChart",Jx),fr);function Zx(){return ye(Bs.instances,e=>e._plugins.invalidate())}function oD(e,t,n){const{startAngle:r,x:s,y:o,outerRadius:i,innerRadius:a,options:l}=t,{borderWidth:u,borderJoinStyle:d}=l,h=Math.min(u/i,Ut(r-n));if(e.beginPath(),e.arc(s,o,i-u/2,r+h/2,n-h/2),a>0){const f=Math.min(u/a,Ut(r-n));e.arc(s,o,a+u/2,n-f/2,r+f/2,!0)}else{const f=Math.min(u/2,i*Ut(r-n));if(d==="round")e.arc(s,o,f,n-xe/2,r+xe/2,!0);else if(d==="bevel"){const p=2*f*f,g=-p*Math.cos(n+xe/2)+s,m=-p*Math.sin(n+xe/2)+o,y=p*Math.cos(r+xe/2)+s,x=p*Math.sin(r+xe/2)+o;e.lineTo(g,m),e.lineTo(y,x)}}e.closePath(),e.moveTo(0,0),e.rect(0,0,e.canvas.width,e.canvas.height),e.clip("evenodd")}function iD(e,t,n){const{startAngle:r,pixelMargin:s,x:o,y:i,outerRadius:a,innerRadius:l}=t;let u=s/a;e.beginPath(),e.arc(o,i,a,r-u,n+u),l>s?(u=s/l,e.arc(o,i,l,n+u,r-u,!0)):e.arc(o,i,s,n+Ke,r-Ke),e.closePath(),e.clip()}function aD(e){return Ig(e,["outerStart","outerEnd","innerStart","innerEnd"])}function lD(e,t,n,r){const s=aD(e.options.borderRadius),o=(n-t)/2,i=Math.min(o,r*t/2),a=l=>{const u=(n-Math.min(o,l))*r/2;return _t(l,0,Math.min(o,u))};return{outerStart:a(s.outerStart),outerEnd:a(s.outerEnd),innerStart:_t(s.innerStart,0,i),innerEnd:_t(s.innerEnd,0,i)}}function Ys(e,t,n,r){return{x:n+e*Math.cos(t),y:r+e*Math.sin(t)}}function Yc(e,t,n,r,s,o){const{x:i,y:a,startAngle:l,pixelMargin:u,innerRadius:d}=t,h=Math.max(t.outerRadius+r+n-u,0),f=d>0?d+r+n+u:0;let p=0;const g=s-l;if(r){const G=d>0?d-r:0,M=h>0?h-r:0,U=(G+M)/2,C=U!==0?g*U/(U+r):g;p=(g-C)/2}const m=Math.max(.001,g*h-n/xe)/h,y=(g-m)/2,x=l+y+p,v=s-y-p,{outerStart:b,outerEnd:k,innerStart:w,innerEnd:j}=lD(t,f,h,v-x),N=h-b,_=h-k,P=x+b/N,A=v-k/_,O=f+w,F=f+j,D=x+w/O,W=v-j/F;if(e.beginPath(),o){const G=(P+A)/2;if(e.arc(i,a,h,P,G),e.arc(i,a,h,G,A),k>0){const L=Ys(_,A,i,a);e.arc(L.x,L.y,k,A,v+Ke)}const M=Ys(F,v,i,a);if(e.lineTo(M.x,M.y),j>0){const L=Ys(F,W,i,a);e.arc(L.x,L.y,j,v+Ke,W+Math.PI)}const U=(v-j/f+(x+w/f))/2;if(e.arc(i,a,f,v-j/f,U,!0),e.arc(i,a,f,U,x+w/f,!0),w>0){const L=Ys(O,D,i,a);e.arc(L.x,L.y,w,D+Math.PI,x-Ke)}const C=Ys(N,x,i,a);if(e.lineTo(C.x,C.y),b>0){const L=Ys(N,P,i,a);e.arc(L.x,L.y,b,x-Ke,P)}}else{e.moveTo(i,a);const G=Math.cos(P)*h+i,M=Math.sin(P)*h+a;e.lineTo(G,M);const U=Math.cos(A)*h+i,C=Math.sin(A)*h+a;e.lineTo(U,C)}e.closePath()}function cD(e,t,n,r,s){const{fullCircles:o,startAngle:i,circumference:a}=t;let l=t.endAngle;if(o){Yc(e,t,n,r,l,s);for(let u=0;u=xe&&p===0&&d!=="miter"&&oD(e,t,m),o||(Yc(e,t,n,r,m,s),e.stroke())}class Ci extends Zr{constructor(n){super();Z(this,"circumference");Z(this,"endAngle");Z(this,"fullCircles");Z(this,"innerRadius");Z(this,"outerRadius");Z(this,"pixelMargin");Z(this,"startAngle");this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,n&&Object.assign(this,n)}inRange(n,r,s){const o=this.getProps(["x","y"],s),{angle:i,distance:a}=W2(o,{x:n,y:r}),{startAngle:l,endAngle:u,innerRadius:d,outerRadius:h,circumference:f}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],s),p=(this.options.spacing+this.options.borderWidth)/2,g=ue(f,u-l),m=va(i,l,u)&&l!==u,y=g>=Ae||m,x=bs(a,d+p,h+p);return y&&x}getCenterPoint(n){const{x:r,y:s,startAngle:o,endAngle:i,innerRadius:a,outerRadius:l}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],n),{offset:u,spacing:d}=this.options,h=(o+i)/2,f=(a+l+d+u)/2;return{x:r+Math.cos(h)*f,y:s+Math.sin(h)*f}}tooltipPosition(n){return this.getCenterPoint(n)}draw(n){const{options:r,circumference:s}=this,o=(r.offset||0)/4,i=(r.spacing||0)/2,a=r.circular;if(this.pixelMargin=r.borderAlign==="inner"?.33:0,this.fullCircles=s>Ae?Math.floor(s/Ae):0,s===0||this.innerRadius<0||this.outerRadius<0)return;n.save();const l=(this.startAngle+this.endAngle)/2;n.translate(Math.cos(l)*o,Math.sin(l)*o);const u=1-Math.sin(Math.min(xe,s||0)),d=o*u;n.fillStyle=r.backgroundColor,n.strokeStyle=r.borderColor,cD(n,this,d,i,a),uD(n,this,d,i,a),n.restore()}}Z(Ci,"id","arc"),Z(Ci,"defaults",{borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0,selfJoin:!1}),Z(Ci,"defaultRoutes",{backgroundColor:"backgroundColor"}),Z(Ci,"descriptors",{_scriptable:!0,_indexable:n=>n!=="borderDash"});function bS(e,t,n=t){e.lineCap=ue(n.borderCapStyle,t.borderCapStyle),e.setLineDash(ue(n.borderDash,t.borderDash)),e.lineDashOffset=ue(n.borderDashOffset,t.borderDashOffset),e.lineJoin=ue(n.borderJoinStyle,t.borderJoinStyle),e.lineWidth=ue(n.borderWidth,t.borderWidth),e.strokeStyle=ue(n.borderColor,t.borderColor)}function dD(e,t,n){e.lineTo(n.x,n.y)}function hD(e){return e.stepped?UM:e.tension||e.cubicInterpolationMode==="monotone"?WM:dD}function vS(e,t,n={}){const r=e.length,{start:s=0,end:o=r-1}=n,{start:i,end:a}=t,l=Math.max(s,i),u=Math.min(o,a),d=sa&&o>a;return{count:r,start:l,loop:t.loop,ilen:u(i+(u?a-k:k))%o,b=()=>{m!==y&&(e.lineTo(d,y),e.lineTo(d,m),e.lineTo(d,x))};for(l&&(p=s[v(0)],e.moveTo(p.x,p.y)),f=0;f<=a;++f){if(p=s[v(f)],p.skip)continue;const k=p.x,w=p.y,j=k|0;j===g?(wy&&(y=w),d=(h*d+k)/++h):(b(),e.lineTo(k,w),g=j,h=0,m=y=w),x=w}b()}function If(e){const t=e.options,n=t.borderDash&&t.borderDash.length;return!e._decimated&&!e._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!n?pD:fD}function gD(e){return e.stepped?_L:e.tension||e.cubicInterpolationMode==="monotone"?jL:fs}function mD(e,t,n,r){let s=t._path;s||(s=t._path=new Path2D,t.path(s,n,r)&&s.closePath()),bS(e,t.options),e.stroke(s)}function yD(e,t,n,r){const{segments:s,options:o}=t,i=If(t);for(const a of s)bS(e,o,a.style),e.beginPath(),i(e,t,a,{start:n,end:n+r-1})&&e.closePath(),e.stroke()}const xD=typeof Path2D=="function";function bD(e,t,n,r){xD&&!t.options.segment?mD(e,t,n,r):yD(e,t,n,r)}class bn extends Zr{constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,n){const r=this.options;if((r.tension||r.cubicInterpolationMode==="monotone")&&!r.stepped&&!this._pointsUpdated){const s=r.spanGaps?this._loop:this._fullLoop;mL(this._points,r,t,s,n),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=TL(this,this.options.segment))}first(){const t=this.segments,n=this.points;return t.length&&n[t[0].start]}last(){const t=this.segments,n=this.points,r=t.length;return r&&n[t[r-1].end]}interpolate(t,n){const r=this.options,s=t[n],o=this.points,i=iS(this,{property:n,start:s,end:s});if(!i.length)return;const a=[],l=gD(r);let u,d;for(u=0,d=i.length;ut!=="borderDash"&&t!=="fill"});function eb(e,t,n,r){const s=e.options,{[n]:o}=e.getProps([n],r);return Math.abs(t-o){a=Du(i,a,s);const l=s[i],u=s[a];r!==null?(o.push({x:l.x,y:r}),o.push({x:u.x,y:r})):n!==null&&(o.push({x:n,y:l.y}),o.push({x:n,y:u.y}))}),o}function Du(e,t,n){for(;t>e;t--){const r=n[t];if(!isNaN(r.x)&&!isNaN(r.y))break}return t}function tb(e,t,n,r){return e&&t?r(e[n],t[n]):e?e[n]:t?t[n]:0}function wS(e,t){let n=[],r=!1;return We(e)?(r=!0,n=e):n=wD(e,t),n.length?new bn({points:n,options:{tension:0},_loop:r,_fullLoop:r}):null}function nb(e){return e&&e.fill!==!1}function kD(e,t,n){let s=e[t].fill;const o=[t];let i;if(!n)return s;for(;s!==!1&&o.indexOf(s)===-1;){if(!bt(s))return s;if(i=e[s],!i)return!1;if(i.visible)return s;o.push(s),s=i.fill}return!1}function SD(e,t,n){const r=ND(e);if(he(r))return isNaN(r.value)?!1:r;let s=parseFloat(r);return bt(s)&&Math.floor(s)===s?_D(r[0],t,s,n):["origin","start","end","stack","shape"].indexOf(r)>=0&&r}function _D(e,t,n,r){return(e==="-"||e==="+")&&(n=t+n),n===t||n<0||n>=r?!1:n}function jD(e,t){let n=null;return e==="start"?n=t.bottom:e==="end"?n=t.top:he(e)?n=t.getPixelForValue(e.value):t.getBasePixel&&(n=t.getBasePixel()),n}function CD(e,t,n){let r;return e==="start"?r=n:e==="end"?r=t.options.reverse?t.min:t.max:he(e)?r=e.value:r=t.getBaseValue(),r}function ND(e){const t=e.options,n=t.fill;let r=ue(n&&n.target,n);return r===void 0&&(r=!!t.backgroundColor),r===!1||r===null?!1:r===!0?"origin":r}function PD(e){const{scale:t,index:n,line:r}=e,s=[],o=r.segments,i=r.points,a=RD(t,n);a.push(wS({x:null,y:t.bottom},r));for(let l=0;l=0;--i){const a=s[i].$filler;a&&(a.line.updateControlPoints(o,a.axis),r&&a.fill&&Yd(e.ctx,a,o))}},beforeDatasetsDraw(e,t,n){if(n.drawTime!=="beforeDatasetsDraw")return;const r=e.getSortedVisibleDatasetMetas();for(let s=r.length-1;s>=0;--s){const o=r[s].$filler;nb(o)&&Yd(e.ctx,o,e.chartArea)}},beforeDatasetDraw(e,t,n){const r=t.meta.$filler;!nb(r)||n.drawTime!=="beforeDatasetDraw"||Yd(e.ctx,r,e.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const ib=(e,t)=>{let{boxHeight:n=t,boxWidth:r=t}=e;return e.usePointStyle&&(n=Math.min(n,t),r=e.pointStyleWidth||Math.min(r,t)),{boxWidth:r,boxHeight:n,itemHeight:Math.max(t,n)}},zD=(e,t)=>e!==null&&t!==null&&e.datasetIndex===t.datasetIndex&&e.index===t.index;class ab extends Zr{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,n,r){this.maxWidth=t,this.maxHeight=n,this._margins=r,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const t=this.options.labels||{};let n=je(t.generateLabels,[this.chart],this)||[];t.filter&&(n=n.filter(r=>t.filter(r,this.chart.data))),t.sort&&(n=n.sort((r,s)=>t.sort(r,s,this.chart.data))),this.options.reverse&&n.reverse(),this.legendItems=n}fit(){const{options:t,ctx:n}=this;if(!t.display){this.width=this.height=0;return}const r=t.labels,s=yt(r.font),o=s.size,i=this._computeTitleHeight(),{boxWidth:a,itemHeight:l}=ib(r,o);let u,d;n.font=s.string,this.isHorizontal()?(u=this.maxWidth,d=this._fitRows(i,o,a,l)+10):(d=this.maxHeight,u=this._fitCols(i,s,a,l)+10),this.width=Math.min(u,t.maxWidth||this.maxWidth),this.height=Math.min(d,t.maxHeight||this.maxHeight)}_fitRows(t,n,r,s){const{ctx:o,maxWidth:i,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],u=this.lineWidths=[0],d=s+a;let h=t;o.textAlign="left",o.textBaseline="middle";let f=-1,p=-d;return this.legendItems.forEach((g,m)=>{const y=r+n/2+o.measureText(g.text).width;(m===0||u[u.length-1]+y+2*a>i)&&(h+=d,u[u.length-(m>0?0:1)]=0,p+=d,f++),l[m]={left:0,top:p,row:f,width:y,height:s},u[u.length-1]+=y+a}),h}_fitCols(t,n,r,s){const{ctx:o,maxHeight:i,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],u=this.columnSizes=[],d=i-t;let h=a,f=0,p=0,g=0,m=0;return this.legendItems.forEach((y,x)=>{const{itemWidth:v,itemHeight:b}=VD(r,n,o,y,s);x>0&&p+b+2*a>d&&(h+=f+a,u.push({width:f,height:p}),g+=f+a,m++,f=p=0),l[x]={left:g,top:p,col:m,width:v,height:b},f=Math.max(f,v),p+=b+a}),h+=f,u.push({width:f,height:p}),h}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:n,options:{align:r,labels:{padding:s},rtl:o}}=this,i=wo(o,this.left,this.width);if(this.isHorizontal()){let a=0,l=pt(r,this.left+s,this.right-this.lineWidths[a]);for(const u of n)a!==u.row&&(a=u.row,l=pt(r,this.left+s,this.right-this.lineWidths[a])),u.top+=this.top+t+s,u.left=i.leftForLtr(i.x(l),u.width),l+=u.width+s}else{let a=0,l=pt(r,this.top+t+s,this.bottom-this.columnSizes[a].height);for(const u of n)u.col!==a&&(a=u.col,l=pt(r,this.top+t+s,this.bottom-this.columnSizes[a].height)),u.top=l,u.left+=this.left+s,u.left=i.leftForLtr(i.x(u.left),u.width),l+=u.height+s}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){const t=this.ctx;Au(t,this),this._draw(),Mu(t)}}_draw(){const{options:t,columnSizes:n,lineWidths:r,ctx:s}=this,{align:o,labels:i}=t,a=Fe.color,l=wo(t.rtl,this.left,this.width),u=yt(i.font),{padding:d}=i,h=u.size,f=h/2;let p;this.drawTitle(),s.textAlign=l.textAlign("left"),s.textBaseline="middle",s.lineWidth=.5,s.font=u.string;const{boxWidth:g,boxHeight:m,itemHeight:y}=ib(i,h),x=function(j,N,_){if(isNaN(g)||g<=0||isNaN(m)||m<0)return;s.save();const P=ue(_.lineWidth,1);if(s.fillStyle=ue(_.fillStyle,a),s.lineCap=ue(_.lineCap,"butt"),s.lineDashOffset=ue(_.lineDashOffset,0),s.lineJoin=ue(_.lineJoin,"miter"),s.lineWidth=P,s.strokeStyle=ue(_.strokeStyle,a),s.setLineDash(ue(_.lineDash,[])),i.usePointStyle){const A={radius:m*Math.SQRT2/2,pointStyle:_.pointStyle,rotation:_.rotation,borderWidth:P},O=l.xPlus(j,g/2),F=N+f;X2(s,A,O,F,i.pointStyleWidth&&g)}else{const A=N+Math.max((h-m)/2,0),O=l.leftForLtr(j,g),F=Wi(_.borderRadius);s.beginPath(),Object.values(F).some(D=>D!==0)?Mf(s,{x:O,y:A,w:g,h:m,radius:F}):s.rect(O,A,g,m),s.fill(),P!==0&&s.stroke()}s.restore()},v=function(j,N,_){ka(s,_.text,j,N+y/2,u,{strikethrough:_.hidden,textAlign:l.textAlign(_.textAlign)})},b=this.isHorizontal(),k=this._computeTitleHeight();b?p={x:pt(o,this.left+d,this.right-r[0]),y:this.top+d+k,line:0}:p={x:this.left+d,y:pt(o,this.top+k+d,this.bottom-n[0].height),line:0},nS(this.ctx,t.textDirection);const w=y+d;this.legendItems.forEach((j,N)=>{s.strokeStyle=j.fontColor,s.fillStyle=j.fontColor;const _=s.measureText(j.text).width,P=l.textAlign(j.textAlign||(j.textAlign=i.textAlign)),A=g+f+_;let O=p.x,F=p.y;l.setWidth(this.width),b?N>0&&O+A+d>this.right&&(F=p.y+=w,p.line++,O=p.x=pt(o,this.left+d,this.right-r[p.line])):N>0&&F+w>this.bottom&&(O=p.x=O+n[p.line].width+d,p.line++,F=p.y=pt(o,this.top+k+d,this.bottom-n[p.line].height));const D=l.x(O);if(x(D,F,j),O=TM(P,O+g+f,b?O+A:this.right,t.rtl),v(l.x(O),F,j),b)p.x+=A+d;else if(typeof j.text!="string"){const W=u.lineHeight;p.y+=SS(j,W)+d}else p.y+=w}),rS(this.ctx,t.textDirection)}drawTitle(){const t=this.options,n=t.title,r=yt(n.font),s=hn(n.padding);if(!n.display)return;const o=wo(t.rtl,this.left,this.width),i=this.ctx,a=n.position,l=r.size/2,u=s.top+l;let d,h=this.left,f=this.width;if(this.isHorizontal())f=Math.max(...this.lineWidths),d=this.top+u,h=pt(t.align,h,this.right-f);else{const g=this.columnSizes.reduce((m,y)=>Math.max(m,y.height),0);d=u+pt(t.align,this.top,this.bottom-g-t.labels.padding-this._computeTitleHeight())}const p=pt(a,h,h+f);i.textAlign=o.textAlign(Lg(a)),i.textBaseline="middle",i.strokeStyle=n.color,i.fillStyle=n.color,i.font=r.string,ka(i,n.text,p,d,r)}_computeTitleHeight(){const t=this.options.title,n=yt(t.font),r=hn(t.padding);return t.display?n.lineHeight+r.height:0}_getLegendItemAt(t,n){let r,s,o;if(bs(t,this.left,this.right)&&bs(n,this.top,this.bottom)){for(o=this.legendHitBoxes,r=0;ro.length>i.length?o:i)),t+n.size/2+r.measureText(s).width}function $D(e,t,n){let r=e;return typeof t.text!="string"&&(r=SS(t,n)),r}function SS(e,t){const n=e.text?e.text.length:0;return t*n}function HD(e,t){return!!((e==="mousemove"||e==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(e==="click"||e==="mouseup"))}var Fu={id:"legend",_element:ab,start(e,t,n){const r=e.legend=new ab({ctx:e.ctx,options:n,chart:e});ln.configure(e,r,n),ln.addBox(e,r)},stop(e){ln.removeBox(e,e.legend),delete e.legend},beforeUpdate(e,t,n){const r=e.legend;ln.configure(e,r,n),r.options=n},afterUpdate(e){const t=e.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(e,t){t.replay||e.legend.handleEvent(t.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(e,t,n){const r=t.datasetIndex,s=n.chart;s.isDatasetVisible(r)?(s.hide(r),t.hidden=!0):(s.show(r),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:e=>e.chart.options.color,boxWidth:40,padding:10,generateLabels(e){const t=e.data.datasets,{labels:{usePointStyle:n,pointStyle:r,textAlign:s,color:o,useBorderRadius:i,borderRadius:a}}=e.legend.options;return e._getSortedDatasetMetas().map(l=>{const u=l.controller.getStyle(n?0:void 0),d=hn(u.borderWidth);return{text:t[l.index].label,fillStyle:u.backgroundColor,fontColor:o,hidden:!l.visible,lineCap:u.borderCapStyle,lineDash:u.borderDash,lineDashOffset:u.borderDashOffset,lineJoin:u.borderJoinStyle,lineWidth:(d.width+d.height)/4,strokeStyle:u.borderColor,pointStyle:r||u.pointStyle,rotation:u.rotation,textAlign:s||u.textAlign,borderRadius:i&&(a||u.borderRadius),datasetIndex:l.index}},this)}},title:{color:e=>e.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:e=>!e.startsWith("on"),labels:{_scriptable:e=>!["generateLabels","filter","sort"].includes(e)}}};class _S extends Zr{constructor(t){super(),this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,n){const r=this.options;if(this.left=0,this.top=0,!r.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=t,this.height=this.bottom=n;const s=We(r.text)?r.text.length:1;this._padding=hn(r.padding);const o=s*yt(r.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=o:this.width=o}isHorizontal(){const t=this.options.position;return t==="top"||t==="bottom"}_drawArgs(t){const{top:n,left:r,bottom:s,right:o,options:i}=this,a=i.align;let l=0,u,d,h;return this.isHorizontal()?(d=pt(a,r,o),h=n+t,u=o-r):(i.position==="left"?(d=r+t,h=pt(a,s,n),l=xe*-.5):(d=o-t,h=pt(a,n,s),l=xe*.5),u=s-n),{titleX:d,titleY:h,maxWidth:u,rotation:l}}draw(){const t=this.ctx,n=this.options;if(!n.display)return;const r=yt(n.font),o=r.lineHeight/2+this._padding.top,{titleX:i,titleY:a,maxWidth:l,rotation:u}=this._drawArgs(o);ka(t,n.text,0,0,r,{color:n.color,maxWidth:l,rotation:u,textAlign:Lg(n.align),textBaseline:"middle",translation:[i,a]})}}function UD(e,t){const n=new _S({ctx:e.ctx,options:t,chart:e});ln.configure(e,n,t),ln.addBox(e,n),e.titleBlock=n}var zu={id:"title",_element:_S,start(e,t,n){UD(e,n)},stop(e){const t=e.titleBlock;ln.removeBox(e,t),delete e.titleBlock},beforeUpdate(e,t,n){const r=e.titleBlock;ln.configure(e,r,n),r.options=n},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const Ni={average(e){if(!e.length)return!1;let t,n,r=new Set,s=0,o=0;for(t=0,n=e.length;ta+l)/r.size,y:s/o}},nearest(e,t){if(!e.length)return!1;let n=t.x,r=t.y,s=Number.POSITIVE_INFINITY,o,i,a;for(o=0,i=e.length;o-1?e.split(` -`):e}function WD(e,t){const{element:n,datasetIndex:r,index:s}=t,o=e.getDatasetMeta(r).controller,{label:i,value:a}=o.getLabelAndValue(s);return{chart:e,label:i,parsed:o.getParsed(s),raw:e.data.datasets[r].data[s],formattedValue:a,dataset:o.getDataset(),dataIndex:s,datasetIndex:r,element:n}}function lb(e,t){const n=e.chart.ctx,{body:r,footer:s,title:o}=e,{boxWidth:i,boxHeight:a}=t,l=yt(t.bodyFont),u=yt(t.titleFont),d=yt(t.footerFont),h=o.length,f=s.length,p=r.length,g=hn(t.padding);let m=g.height,y=0,x=r.reduce((k,w)=>k+w.before.length+w.lines.length+w.after.length,0);if(x+=e.beforeBody.length+e.afterBody.length,h&&(m+=h*u.lineHeight+(h-1)*t.titleSpacing+t.titleMarginBottom),x){const k=t.displayColors?Math.max(a,l.lineHeight):l.lineHeight;m+=p*k+(x-p)*l.lineHeight+(x-1)*t.bodySpacing}f&&(m+=t.footerMarginTop+f*d.lineHeight+(f-1)*t.footerSpacing);let v=0;const b=function(k){y=Math.max(y,n.measureText(k).width+v)};return n.save(),n.font=u.string,ye(e.title,b),n.font=l.string,ye(e.beforeBody.concat(e.afterBody),b),v=t.displayColors?i+2+t.boxPadding:0,ye(r,k=>{ye(k.before,b),ye(k.lines,b),ye(k.after,b)}),v=0,n.font=d.string,ye(e.footer,b),n.restore(),y+=g.width,{width:y,height:m}}function GD(e,t){const{y:n,height:r}=t;return ne.height-r/2?"bottom":"center"}function qD(e,t,n,r){const{x:s,width:o}=r,i=n.caretSize+n.caretPadding;if(e==="left"&&s+o+i>t.width||e==="right"&&s-o-i<0)return!0}function KD(e,t,n,r){const{x:s,width:o}=n,{width:i,chartArea:{left:a,right:l}}=e;let u="center";return r==="center"?u=s<=(a+l)/2?"left":"right":s<=o/2?u="left":s>=i-o/2&&(u="right"),qD(u,e,t,n)&&(u="center"),u}function cb(e,t,n){const r=n.yAlign||t.yAlign||GD(e,n);return{xAlign:n.xAlign||t.xAlign||KD(e,t,n,r),yAlign:r}}function YD(e,t){let{x:n,width:r}=e;return t==="right"?n-=r:t==="center"&&(n-=r/2),n}function XD(e,t,n){let{y:r,height:s}=e;return t==="top"?r+=n:t==="bottom"?r-=s+n:r-=s/2,r}function ub(e,t,n,r){const{caretSize:s,caretPadding:o,cornerRadius:i}=e,{xAlign:a,yAlign:l}=n,u=s+o,{topLeft:d,topRight:h,bottomLeft:f,bottomRight:p}=Wi(i);let g=YD(t,a);const m=XD(t,l,u);return l==="center"?a==="left"?g+=u:a==="right"&&(g-=u):a==="left"?g-=Math.max(d,f)+s:a==="right"&&(g+=Math.max(h,p)+s),{x:_t(g,0,r.width-t.width),y:_t(m,0,r.height-t.height)}}function Rl(e,t,n){const r=hn(n.padding);return t==="center"?e.x+e.width/2:t==="right"?e.x+e.width-r.right:e.x+r.left}function db(e){return En([],Bn(e))}function QD(e,t,n){return Vs(e,{tooltip:t,tooltipItems:n,type:"tooltip"})}function hb(e,t){const n=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return n?e.override(n):e}const jS={beforeTitle:zn,title(e){if(e.length>0){const t=e[0],n=t.chart.data.labels,r=n?n.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(r>0&&t.dataIndex"u"?jS[t].call(n,r):s}class zf extends Zr{constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const n=this.chart,r=this.options.setContext(this.getContext()),s=r.enabled&&n.options.animation&&r.animations,o=new lS(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=QD(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,n){const{callbacks:r}=n,s=Pt(r,"beforeTitle",this,t),o=Pt(r,"title",this,t),i=Pt(r,"afterTitle",this,t);let a=[];return a=En(a,Bn(s)),a=En(a,Bn(o)),a=En(a,Bn(i)),a}getBeforeBody(t,n){return db(Pt(n.callbacks,"beforeBody",this,t))}getBody(t,n){const{callbacks:r}=n,s=[];return ye(t,o=>{const i={before:[],lines:[],after:[]},a=hb(r,o);En(i.before,Bn(Pt(a,"beforeLabel",this,o))),En(i.lines,Pt(a,"label",this,o)),En(i.after,Bn(Pt(a,"afterLabel",this,o))),s.push(i)}),s}getAfterBody(t,n){return db(Pt(n.callbacks,"afterBody",this,t))}getFooter(t,n){const{callbacks:r}=n,s=Pt(r,"beforeFooter",this,t),o=Pt(r,"footer",this,t),i=Pt(r,"afterFooter",this,t);let a=[];return a=En(a,Bn(s)),a=En(a,Bn(o)),a=En(a,Bn(i)),a}_createItems(t){const n=this._active,r=this.chart.data,s=[],o=[],i=[];let a=[],l,u;for(l=0,u=n.length;lt.filter(d,h,f,r))),t.itemSort&&(a=a.sort((d,h)=>t.itemSort(d,h,r))),ye(a,d=>{const h=hb(t.callbacks,d);s.push(Pt(h,"labelColor",this,d)),o.push(Pt(h,"labelPointStyle",this,d)),i.push(Pt(h,"labelTextColor",this,d))}),this.labelColors=s,this.labelPointStyles=o,this.labelTextColors=i,this.dataPoints=a,a}update(t,n){const r=this.options.setContext(this.getContext()),s=this._active;let o,i=[];if(!s.length)this.opacity!==0&&(o={opacity:0});else{const a=Ni[r.position].call(this,s,this._eventPosition);i=this._createItems(r),this.title=this.getTitle(i,r),this.beforeBody=this.getBeforeBody(i,r),this.body=this.getBody(i,r),this.afterBody=this.getAfterBody(i,r),this.footer=this.getFooter(i,r);const l=this._size=lb(this,r),u=Object.assign({},a,l),d=cb(this.chart,r,u),h=ub(r,u,d,this.chart);this.xAlign=d.xAlign,this.yAlign=d.yAlign,o={opacity:1,x:h.x,y:h.y,width:l.width,height:l.height,caretX:a.x,caretY:a.y}}this._tooltipItems=i,this.$context=void 0,o&&this._resolveAnimations().update(this,o),t&&r.external&&r.external.call(this,{chart:this.chart,tooltip:this,replay:n})}drawCaret(t,n,r,s){const o=this.getCaretPosition(t,r,s);n.lineTo(o.x1,o.y1),n.lineTo(o.x2,o.y2),n.lineTo(o.x3,o.y3)}getCaretPosition(t,n,r){const{xAlign:s,yAlign:o}=this,{caretSize:i,cornerRadius:a}=r,{topLeft:l,topRight:u,bottomLeft:d,bottomRight:h}=Wi(a),{x:f,y:p}=t,{width:g,height:m}=n;let y,x,v,b,k,w;return o==="center"?(k=p+m/2,s==="left"?(y=f,x=y-i,b=k+i,w=k-i):(y=f+g,x=y+i,b=k-i,w=k+i),v=y):(s==="left"?x=f+Math.max(l,d)+i:s==="right"?x=f+g-Math.max(u,h)-i:x=this.caretX,o==="top"?(b=p,k=b-i,y=x-i,v=x+i):(b=p+m,k=b+i,y=x+i,v=x-i),w=b),{x1:y,x2:x,x3:v,y1:b,y2:k,y3:w}}drawTitle(t,n,r){const s=this.title,o=s.length;let i,a,l;if(o){const u=vo(r.rtl,this.x,this.width);for(t.x=Rl(this,r.titleAlign,r),n.textAlign=u.textAlign(r.titleAlign),n.textBaseline="middle",i=yt(r.titleFont),a=r.titleSpacing,n.fillStyle=r.titleColor,n.font=i.string,l=0;lv!==0)?(t.beginPath(),t.fillStyle=o.multiKeyBackground,Mf(t,{x:m,y:g,w:u,h:l,radius:x}),t.fill(),t.stroke(),t.fillStyle=i.backgroundColor,t.beginPath(),Mf(t,{x:y,y:g+1,w:u-2,h:l-2,radius:x}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(m,g,u,l),t.strokeRect(m,g,u,l),t.fillStyle=i.backgroundColor,t.fillRect(y,g+1,u-2,l-2))}t.fillStyle=this.labelTextColors[r]}drawBody(t,n,r){const{body:s}=this,{bodySpacing:o,bodyAlign:i,displayColors:a,boxHeight:l,boxWidth:u,boxPadding:d}=r,h=yt(r.bodyFont);let f=h.lineHeight,p=0;const g=vo(r.rtl,this.x,this.width),m=function(_){n.fillText(_,g.x(t.x+p),t.y+f/2),t.y+=f+o},y=g.textAlign(i);let x,v,b,k,w,j,N;for(n.textAlign=i,n.textBaseline="middle",n.font=h.string,t.x=Rl(this,y,r),n.fillStyle=r.bodyColor,ye(this.beforeBody,m),p=a&&y!=="right"?i==="center"?u/2+d:u+2+d:0,k=0,j=s.length;k0&&n.stroke()}_updateAnimationTarget(t){const n=this.chart,r=this.$animations,s=r&&r.x,o=r&&r.y;if(s||o){const i=Ni[t.position].call(this,this._active,this._eventPosition);if(!i)return;const a=this._size=lb(this,t),l=Object.assign({},i,this._size),u=cb(n,t,l),d=ub(t,l,u,n);(s._to!==d.x||o._to!==d.y)&&(this.xAlign=u.xAlign,this.yAlign=u.yAlign,this.width=a.width,this.height=a.height,this.caretX=i.x,this.caretY=i.y,this._resolveAnimations().update(this,d))}}_willRender(){return!!this.opacity}draw(t){const n=this.options.setContext(this.getContext());let r=this.opacity;if(!r)return;this._updateAnimationTarget(n);const s={width:this.width,height:this.height},o={x:this.x,y:this.y};r=Math.abs(r)<.001?0:r;const i=hn(n.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;n.enabled&&a&&(t.save(),t.globalAlpha=r,this.drawBackground(o,t,s,n),nS(t,n.textDirection),o.y+=i.top,this.drawTitle(o,t,n),this.drawBody(o,t,n),this.drawFooter(o,t,n),rS(t,n.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,n){const r=this._active,s=t.map(({datasetIndex:a,index:l})=>{const u=this.chart.getDatasetMeta(a);if(!u)throw new Error("Cannot find a dataset at index "+a);return{datasetIndex:a,element:u.data[l],index:l}}),o=!Hc(r,s),i=this._positionChanged(s,n);(o||i)&&(this._active=s,this._eventPosition=n,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,n,r=!0){if(n&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const s=this.options,o=this._active||[],i=this._getActiveElements(t,o,n,r),a=this._positionChanged(i,t),l=n||!Hc(i,o)||a;return l&&(this._active=i,(s.enabled||s.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,n))),l}_getActiveElements(t,n,r,s){const o=this.options;if(t.type==="mouseout")return[];if(!s)return n.filter(a=>this.chart.data.datasets[a.datasetIndex]&&this.chart.getDatasetMeta(a.datasetIndex).controller.getParsed(a.index)!==void 0);const i=this.chart.getElementsAtEventForMode(t,o.mode,o,r);return o.reverse&&i.reverse(),i}_positionChanged(t,n){const{caretX:r,caretY:s,options:o}=this,i=Ni[o.position].call(this,t,n);return i!==!1&&(r!==i.x||s!==i.y)}}Z(zf,"positioners",Ni);var Vu={id:"tooltip",_element:zf,positioners:Ni,afterInit(e,t,n){n&&(e.tooltip=new zf({chart:e,options:n}))},beforeUpdate(e,t,n){e.tooltip&&e.tooltip.initialize(n)},reset(e,t,n){e.tooltip&&e.tooltip.initialize(n)},afterDraw(e){const t=e.tooltip;if(t&&t._willRender()){const n={tooltip:t};if(e.notifyPlugins("beforeTooltipDraw",{...n,cancelable:!0})===!1)return;t.draw(e.ctx),e.notifyPlugins("afterTooltipDraw",n)}},afterEvent(e,t){if(e.tooltip){const n=t.replay;e.tooltip.handleEvent(t.event,n,t.inChartArea)&&(t.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(e,t)=>t.bodyFont.size,boxWidth:(e,t)=>t.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:jS},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:e=>e!=="filter"&&e!=="itemSort"&&e!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};const JD=(e,t,n,r)=>(typeof t=="string"?(n=e.push(t)-1,r.unshift({index:n,label:t})):isNaN(t)&&(n=null),n);function ZD(e,t,n,r){const s=e.indexOf(t);if(s===-1)return JD(e,t,n,r);const o=e.lastIndexOf(t);return s!==o?n:s}const eI=(e,t)=>e===null?null:_t(Math.round(e),0,t);function fb(e){const t=this.getLabels();return e>=0&&en.length-1?null:this.getPixelForValue(n[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}Z(Fo,"id","category"),Z(Fo,"defaults",{ticks:{callback:fb}});function tI(e,t){const n=[],{bounds:s,step:o,min:i,max:a,precision:l,count:u,maxTicks:d,maxDigits:h,includeBounds:f}=e,p=o||1,g=d-1,{min:m,max:y}=t,x=!ke(i),v=!ke(a),b=!ke(u),k=(y-m)/(h+1);let w=fx((y-m)/g/p)*p,j,N,_,P;if(w<1e-14&&!x&&!v)return[{value:m},{value:y}];P=Math.ceil(y/w)-Math.floor(m/w),P>g&&(w=fx(P*w/g/p)*p),ke(l)||(j=Math.pow(10,l),w=Math.ceil(w*j)/j),s==="ticks"?(N=Math.floor(m/w)*w,_=Math.ceil(y/w)*w):(N=m,_=y),x&&v&&o&&wM((a-i)/o,w/1e3)?(P=Math.round(Math.min((a-i)/w,d)),w=(a-i)/P,N=i,_=a):b?(N=x?i:N,_=v?a:_,P=u-1,w=(_-N)/P):(P=(_-N)/w,$i(P,Math.round(P),w/1e3)?P=Math.round(P):P=Math.ceil(P));const A=Math.max(px(w),px(N));j=Math.pow(10,ke(l)?A:l),N=Math.round(N*j)/j,_=Math.round(_*j)/j;let O=0;for(x&&(f&&N!==i?(n.push({value:i}),Na)break;n.push({value:F})}return v&&f&&_!==a?n.length&&$i(n[n.length-1].value,a,pb(a,k,e))?n[n.length-1].value=a:n.push({value:a}):(!v||_===a)&&n.push({value:_}),n}function pb(e,t,{horizontal:n,minRotation:r}){const s=Xn(r),o=(n?Math.sin(s):Math.cos(s))||.001,i=.75*t*(""+e).length;return Math.min(t/o,i)}class nI extends Yo{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,n){return ke(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:n,maxDefined:r}=this.getUserBounds();let{min:s,max:o}=this;const i=l=>s=n?s:l,a=l=>o=r?o:l;if(t){const l=Oo(s),u=Oo(o);l<0&&u<0?a(0):l>0&&u>0&&i(0)}if(s===o){let l=o===0?1:Math.abs(o*.05);a(o+l),t||i(s-l)}this.min=s,this.max=o}getTickLimit(){const t=this.options.ticks;let{maxTicksLimit:n,stepSize:r}=t,s;return r?(s=Math.ceil(this.max/r)-Math.floor(this.min/r)+1,s>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${r} would result generating up to ${s} ticks. Limiting to 1000.`),s=1e3)):(s=this.computeTickLimit(),n=n||11),n&&(s=Math.min(n,s)),s}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,n=t.ticks;let r=this.getTickLimit();r=Math.max(2,r);const s={maxTicks:r,bounds:t.bounds,min:t.min,max:t.max,precision:n.precision,step:n.stepSize,count:n.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:n.minRotation||0,includeBounds:n.includeBounds!==!1},o=this._range||this,i=tI(s,o);return t.bounds==="ticks"&&kM(i,this,"value"),t.reverse?(i.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),i}configure(){const t=this.ticks;let n=this.min,r=this.max;if(super.configure(),this.options.offset&&t.length){const s=(r-n)/Math.max(t.length-1,1)/2;n-=s,r+=s}this._startValue=n,this._endValue=r,this._valueRange=r-n}getLabelForValue(t){return Dg(t,this.chart.options.locale,this.options.ticks.format)}}class zo extends nI{determineDataLimits(){const{min:t,max:n}=this.getMinMax(!0);this.min=bt(t)?t:0,this.max=bt(n)?n:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),n=t?this.width:this.height,r=Xn(this.options.ticks.minRotation),s=(t?Math.sin(r):Math.cos(r))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(n/Math.min(40,o.lineHeight/s))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}Z(zo,"id","linear"),Z(zo,"defaults",{ticks:{callback:Y2.formatters.numeric}});const Bu={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},Tt=Object.keys(Bu);function gb(e,t){return e-t}function mb(e,t){if(ke(t))return null;const n=e._adapter,{parser:r,round:s,isoWeekday:o}=e._parseOpts;let i=t;return typeof r=="function"&&(i=r(i)),bt(i)||(i=typeof r=="string"?n.parse(i,r):n.parse(i)),i===null?null:(s&&(i=s==="week"&&(ba(o)||o===!0)?n.startOf(i,"isoWeek",o):n.startOf(i,s)),+i)}function yb(e,t,n,r){const s=Tt.length;for(let o=Tt.indexOf(e);o=Tt.indexOf(n);o--){const i=Tt[o];if(Bu[i].common&&e._adapter.diff(s,r,i)>=t-1)return i}return Tt[n?Tt.indexOf(n):0]}function sI(e){for(let t=Tt.indexOf(e)+1,n=Tt.length;t=t?n[r]:n[s];e[o]=!0}}function oI(e,t,n,r){const s=e._adapter,o=+s.startOf(t[0].value,r),i=t[t.length-1].value;let a,l;for(a=o;a<=i;a=+s.add(a,1,r))l=n[a],l>=0&&(t[l].major=!0);return t}function bb(e,t,n){const r=[],s={},o=t.length;let i,a;for(i=0;i+t.value))}initOffsets(t=[]){let n=0,r=0,s,o;this.options.offset&&t.length&&(s=this.getDecimalForValue(t[0]),t.length===1?n=1-s:n=(this.getDecimalForValue(t[1])-s)/2,o=this.getDecimalForValue(t[t.length-1]),t.length===1?r=o:r=(o-this.getDecimalForValue(t[t.length-2]))/2);const i=t.length<3?.5:.25;n=_t(n,0,i),r=_t(r,0,i),this._offsets={start:n,end:r,factor:1/(n+1+r)}}_generate(){const t=this._adapter,n=this.min,r=this.max,s=this.options,o=s.time,i=o.unit||yb(o.minUnit,n,r,this._getLabelCapacity(n)),a=ue(s.ticks.stepSize,1),l=i==="week"?o.isoWeekday:!1,u=ba(l)||l===!0,d={};let h=n,f,p;if(u&&(h=+t.startOf(h,"isoWeek",l)),h=+t.startOf(h,u?"day":i),t.diff(r,n,i)>1e5*a)throw new Error(n+" and "+r+" are too far apart with stepSize of "+a+" "+i);const g=s.ticks.source==="data"&&this.getDataTimestamps();for(f=h,p=0;f+m)}getLabelForValue(t){const n=this._adapter,r=this.options.time;return r.tooltipFormat?n.format(t,r.tooltipFormat):n.format(t,r.displayFormats.datetime)}format(t,n){const s=this.options.time.displayFormats,o=this._unit,i=n||s[o];return this._adapter.format(t,i)}_tickFormatFunction(t,n,r,s){const o=this.options,i=o.ticks.callback;if(i)return je(i,[t,n,r],this);const a=o.time.displayFormats,l=this._unit,u=this._majorUnit,d=l&&a[l],h=u&&a[u],f=r[n],p=u&&h&&f&&f.major;return this._adapter.format(t,s||(p?h:d))}generateTickLabels(t){let n,r,s;for(n=0,r=t.length;n0?a:1}getDataTimestamps(){let t=this._cache.data||[],n,r;if(t.length)return t;const s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(n=0,r=s.length;n=e[r].pos&&t<=e[s].pos&&({lo:r,hi:s}=vs(e,"pos",t)),{pos:o,time:a}=e[r],{pos:i,time:l}=e[s]):(t>=e[r].time&&t<=e[s].time&&({lo:r,hi:s}=vs(e,"time",t)),{time:o,pos:a}=e[r],{time:i,pos:l}=e[s]);const u=i-o;return u?a+(l-a)*(t-o)/u:a}class vb extends Xc{constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),n=this._table=this.buildLookupTable(t);this._minPos=El(n,this.min),this._tableRange=El(n,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:n,max:r}=this,s=[],o=[];let i,a,l,u,d;for(i=0,a=t.length;i=n&&u<=r&&s.push(u);if(s.length<2)return[{time:n,pos:0},{time:r,pos:1}];for(i=0,a=s.length;is-o)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const n=this.getDataTimestamps(),r=this.getLabelTimestamps();return n.length&&r.length?t=this.normalize(n.concat(r)):t=n.length?n:r,t=this._cache.all=t,t}getDecimalForValue(t){return(El(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const n=this._offsets,r=this.getDecimalForPixel(t)/n.factor-n.end;return El(this._table,r*this._tableRange+this._minPos,!0)}}Z(vb,"id","timeseries"),Z(vb,"defaults",Xc.defaults);const CS="label";function wb(e,t){typeof e=="function"?e(t):e&&(e.current=t)}function iI(e,t){const n=e.options;n&&t&&Object.assign(n,t)}function NS(e,t){e.labels=t}function PS(e,t,n=CS){const r=[];e.datasets=t.map(s=>{const o=e.datasets.find(i=>i[n]===s[n]);return!o||!s.data||r.includes(o)?{...s}:(r.push(o),Object.assign(o,s),o)})}function aI(e,t=CS){const n={labels:[],datasets:[]};return NS(n,e.labels),PS(n,e.datasets,t),n}function lI(e,t){const{height:n=150,width:r=300,redraw:s=!1,datasetIdKey:o,type:i,data:a,options:l,plugins:u=[],fallbackContent:d,updateMode:h,...f}=e,p=S.useRef(null),g=S.useRef(null),m=()=>{p.current&&(g.current=new Bs(p.current,{type:i,data:aI(a,o),options:l&&{...l},plugins:u}),wb(t,g.current))},y=()=>{wb(t,null),g.current&&(g.current.destroy(),g.current=null)};return S.useEffect(()=>{!s&&g.current&&l&&iI(g.current,l)},[s,l]),S.useEffect(()=>{!s&&g.current&&NS(g.current.config.data,a.labels)},[s,a.labels]),S.useEffect(()=>{!s&&g.current&&a.datasets&&PS(g.current.config.data,a.datasets,o)},[s,a.datasets]),S.useEffect(()=>{g.current&&(s?(y(),setTimeout(m)):g.current.update(h))},[s,l,a.labels,a.datasets,h]),S.useEffect(()=>{g.current&&(y(),setTimeout(m))},[i]),S.useEffect(()=>(m(),()=>y()),[]),c.jsx("canvas",{ref:p,role:"img",height:n,width:r,...f,children:d})}const cI=S.forwardRef(lI);function RS(e,t){return Bs.register(t),S.forwardRef((n,r)=>c.jsx(cI,{...n,ref:r,type:e}))}const Vo=RS("line",tc),uI=RS("pie",Lf);Bs.register(Fo,zo,Cs,bn,zu,Vu,Fu,Iu);const dI={Total:"#6B7280"},kb=["#E6194B","#3CB44B","#4363D8","#F58231","#911EB4","#42D4F4","#F032E6","#469990","#9A6324","#800000","#808000","#000075","#000000"];function hI(){var x,v,b,k;const[e,t]=S.useState("7d"),{data:n,loading:r}=JT(e),s=S.useMemo(()=>{var j;const w={Total:"#6B7280"};return(j=n==null?void 0:n.endpoint_chart_data)!=null&&j.datasets&&Object.keys(n.endpoint_chart_data.datasets).sort().forEach((_,P)=>{w[_]=kb[P%kb.length]}),w},[n]),[o,i]=S.useState({Total:!0});S.useEffect(()=>{var w;(w=n==null?void 0:n.endpoint_chart_data)!=null&&w.datasets&&i(j=>{const N={...j};return Object.keys(n.endpoint_chart_data.datasets).forEach(_=>{N[_]===void 0&&(N[_]=!0)}),N})},[n]);const a=S.useMemo(()=>{var j;const w=[{label:"Total",value:"Total",color:s.Total}];return(j=n==null?void 0:n.endpoint_chart_data)!=null&&j.datasets&&Object.keys(n.endpoint_chart_data.datasets).sort().forEach(_=>{w.push({label:_.replace("/v1/",""),value:_,color:s[_]})}),w},[n,s]),l=S.useMemo(()=>Object.keys(o).filter(w=>o[w]!==!1),[o]),u=w=>{const j={};a.forEach(N=>{j[N.value]=w.includes(N.value)}),i(j)},d=((x=n==null?void 0:n.endpoint_chart_data)==null?void 0:x.datasets)||{},h={labels:((v=n==null?void 0:n.endpoint_chart_data)==null?void 0:v.labels)||((b=n==null?void 0:n.chart_data)==null?void 0:b.labels)||[],datasets:[...Object.entries(d).map(([w,j])=>({label:w,data:j,borderColor:s[w]||"#6B7280",backgroundColor:"transparent",tension:.4,borderWidth:2,hidden:o[w]===!1})),{label:"Total",data:((k=n==null?void 0:n.chart_data)==null?void 0:k.data)||[],borderColor:dI.Total,backgroundColor:"transparent",borderWidth:3,tension:.4,hidden:o.Total===!1}]},f={labels:(n==null?void 0:n.latency_chart.labels)||[],datasets:[{label:"Avg Latency (ms)",data:(n==null?void 0:n.latency_chart.data.map(w=>w*1e3))||[],fill:!0,backgroundColor:w=>{const N=w.chart.ctx.createLinearGradient(0,0,0,200);return N.addColorStop(0,"rgba(59, 130, 246, 0.2)"),N.addColorStop(1,"rgba(59, 130, 246, 0)"),N},borderColor:"#3b82f6",tension:.4}]},p={responsive:!0,maintainAspectRatio:!1,plugins:{legend:{display:!1},tooltip:{mode:"index",intersect:!1,backgroundColor:"rgba(0, 0, 0, 0.8)",titleColor:"#fff",bodyColor:"#fff",borderColor:"rgba(255, 255, 255, 0.1)",borderWidth:1,padding:10}},scales:{x:{grid:{display:!1},ticks:{color:"rgba(156, 163, 175, 0.8)"}},y:{grid:{color:"rgba(156, 163, 175, 0.1)"},ticks:{color:"rgba(156, 163, 175, 0.8)"},beginAtZero:!0}},interaction:{mode:"nearest",axis:"x",intersect:!1}};if(r)return c.jsxs("div",{className:"space-y-6 ",children:[c.jsx(ox,{}),c.jsx("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4",children:c.jsxs("div",{children:[c.jsx(me,{className:"h-8 w-48 mb-2"}),c.jsx(me,{className:"h-4 w-64"})]})}),c.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[1,2,3].map(w=>c.jsxs("div",{className:"bg-white dark:bg-secondary p-6 rounded-xl border border-gray-200 dark:border-white/5 shadow-sm",children:[c.jsx("div",{className:"flex items-center justify-between mb-4",children:c.jsx(me,{className:"h-8 w-8 rounded-lg"})}),c.jsx(me,{className:"h-8 w-32 mb-1"}),c.jsx(me,{className:"h-3 w-16"})]},w))}),c.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[c.jsxs("div",{className:"lg:col-span-2 bg-white dark:bg-secondary p-6 rounded-xl border border-gray-200 dark:border-white/5 shadow-sm h-[400px] flex flex-col",children:[c.jsx("div",{className:"flex justify-between mb-6",children:c.jsxs("div",{children:[c.jsx(me,{className:"h-6 w-48 mb-2"}),c.jsx(me,{className:"h-4 w-64"})]})}),c.jsx(me,{className:"h-10 w-48 mb-4"}),c.jsx(me,{className:"w-full flex-1 rounded-lg"})]}),c.jsxs("div",{className:"bg-white dark:bg-secondary p-6 rounded-xl border border-gray-200 dark:border-white/5 shadow-sm h-[300px] flex flex-col",children:[c.jsx(me,{className:"h-6 w-32 mb-2"}),c.jsx(me,{className:"h-4 w-48 mb-6"}),c.jsx(me,{className:"w-full flex-1 rounded-lg"})]}),c.jsxs("div",{className:"bg-white dark:bg-secondary p-6 rounded-xl border border-gray-200 dark:border-white/5 shadow-sm h-[300px]",children:[c.jsx(me,{className:"h-6 w-48 mb-4"}),c.jsx("div",{className:"space-y-4",children:[1,2,3,4].map(w=>c.jsxs("div",{className:"flex justify-between items-center",children:[c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx(me,{className:"h-3 w-3 rounded-full"}),c.jsx(me,{className:"h-4 w-20"})]}),c.jsx(me,{className:"h-4 w-16"})]},w))})]})]})]});const g=(n==null?void 0:n.usage.reduce((w,j)=>w+j.used,0))||0,m=n!=null&&n.latency_chart.data.length?(n.latency_chart.data.reduce((w,j)=>w+j,0)/n.latency_chart.data.length*1e3).toFixed(0):"0",y=n==null?void 0:n.usage.reduce((w,j)=>j.used>((w==null?void 0:w.used)||0)?j:w,null);return c.jsxs("div",{className:"space-y-6",children:[c.jsx(ox,{}),c.jsx("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4",children:c.jsxs("div",{children:[c.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:"Dashboard"}),c.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:"Overview of your API usage and performance."})]})}),c.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[c.jsx(St,{label:"Total Requests",value:g.toLocaleString(),icon:bu,color:"bg-blue-500"}),c.jsx(St,{label:"Avg Latency",value:`${m}ms`,icon:wu,color:"bg-orange-500"}),c.jsx(St,{label:"Most Used",value:(y==null?void 0:y.endpoint.replace("/v1/",""))||"N/A",icon:og,color:"bg-purple-500"})]}),c.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[c.jsx("div",{className:"lg:col-span-2",children:c.jsxs(Ms,{title:"Request Volume by Endpoint",description:"Track usage trends for each API endpoint",showTimeSelector:!0,timeRange:e,onTimeRangeChange:t,className:"h-[400px]",children:[c.jsx("div",{className:"flex flex-wrap gap-3 mb-4 pb-4 border-b border-gray-200 dark:border-white/10",children:c.jsx(j2,{label:"Select Endpoints",options:a,selected:l,onChange:u})}),c.jsx("div",{className:"flex-1 min-h-0",children:c.jsx(Vo,{options:p,data:h})})]})}),c.jsx(Ms,{title:"Latency Trends",description:"Average response time over the selected period",showTimeSelector:!0,timeRange:e,onTimeRangeChange:t,children:c.jsx("div",{className:"flex-1 min-h-0",children:c.jsx(Vo,{options:p,data:f})})}),c.jsxs("div",{className:"bg-white dark:bg-secondary rounded-xl shadow-md dark:shadow-lg dark:shadow-black/10 border border-gray-200 dark:border-white/5 p-6",children:[c.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-4",children:"Endpoint Breakdown"}),c.jsx("div",{className:"space-y-3",children:n==null?void 0:n.usage.filter(w=>w.endpoint!=="unknown").sort((w,j)=>j.used-w.used).map(w=>{const j=g>0?(w.used/g*100).toFixed(1):"0";return c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[c.jsx("div",{className:"w-3 h-3 rounded-full flex-shrink-0",style:{backgroundColor:s[w.endpoint]||"#6B7280"}}),c.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-300",children:w.endpoint.replace("/tasks/","").replace("/tasks","tasks")})]}),c.jsxs("div",{className:"flex items-center gap-4",children:[c.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-white",children:w.used.toLocaleString()}),c.jsxs("span",{className:"text-sm text-gray-500 dark:text-gray-400 w-12 text-right",children:[j,"%"]})]})]},w.endpoint)})})]})]})]})}/** +`):e}function WD(e,t){const{element:n,datasetIndex:r,index:s}=t,o=e.getDatasetMeta(r).controller,{label:i,value:a}=o.getLabelAndValue(s);return{chart:e,label:i,parsed:o.getParsed(s),raw:e.data.datasets[r].data[s],formattedValue:a,dataset:o.getDataset(),dataIndex:s,datasetIndex:r,element:n}}function lb(e,t){const n=e.chart.ctx,{body:r,footer:s,title:o}=e,{boxWidth:i,boxHeight:a}=t,l=yt(t.bodyFont),u=yt(t.titleFont),d=yt(t.footerFont),h=o.length,f=s.length,p=r.length,g=hn(t.padding);let m=g.height,y=0,x=r.reduce((k,w)=>k+w.before.length+w.lines.length+w.after.length,0);if(x+=e.beforeBody.length+e.afterBody.length,h&&(m+=h*u.lineHeight+(h-1)*t.titleSpacing+t.titleMarginBottom),x){const k=t.displayColors?Math.max(a,l.lineHeight):l.lineHeight;m+=p*k+(x-p)*l.lineHeight+(x-1)*t.bodySpacing}f&&(m+=t.footerMarginTop+f*d.lineHeight+(f-1)*t.footerSpacing);let v=0;const b=function(k){y=Math.max(y,n.measureText(k).width+v)};return n.save(),n.font=u.string,ye(e.title,b),n.font=l.string,ye(e.beforeBody.concat(e.afterBody),b),v=t.displayColors?i+2+t.boxPadding:0,ye(r,k=>{ye(k.before,b),ye(k.lines,b),ye(k.after,b)}),v=0,n.font=d.string,ye(e.footer,b),n.restore(),y+=g.width,{width:y,height:m}}function GD(e,t){const{y:n,height:r}=t;return ne.height-r/2?"bottom":"center"}function KD(e,t,n,r){const{x:s,width:o}=r,i=n.caretSize+n.caretPadding;if(e==="left"&&s+o+i>t.width||e==="right"&&s-o-i<0)return!0}function qD(e,t,n,r){const{x:s,width:o}=n,{width:i,chartArea:{left:a,right:l}}=e;let u="center";return r==="center"?u=s<=(a+l)/2?"left":"right":s<=o/2?u="left":s>=i-o/2&&(u="right"),KD(u,e,t,n)&&(u="center"),u}function cb(e,t,n){const r=n.yAlign||t.yAlign||GD(e,n);return{xAlign:n.xAlign||t.xAlign||qD(e,t,n,r),yAlign:r}}function YD(e,t){let{x:n,width:r}=e;return t==="right"?n-=r:t==="center"&&(n-=r/2),n}function XD(e,t,n){let{y:r,height:s}=e;return t==="top"?r+=n:t==="bottom"?r-=s+n:r-=s/2,r}function ub(e,t,n,r){const{caretSize:s,caretPadding:o,cornerRadius:i}=e,{xAlign:a,yAlign:l}=n,u=s+o,{topLeft:d,topRight:h,bottomLeft:f,bottomRight:p}=Wi(i);let g=YD(t,a);const m=XD(t,l,u);return l==="center"?a==="left"?g+=u:a==="right"&&(g-=u):a==="left"?g-=Math.max(d,f)+s:a==="right"&&(g+=Math.max(h,p)+s),{x:_t(g,0,r.width-t.width),y:_t(m,0,r.height-t.height)}}function Rl(e,t,n){const r=hn(n.padding);return t==="center"?e.x+e.width/2:t==="right"?e.x+e.width-r.right:e.x+r.left}function db(e){return En([],Bn(e))}function QD(e,t,n){return Vs(e,{tooltip:t,tooltipItems:n,type:"tooltip"})}function hb(e,t){const n=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return n?e.override(n):e}const jS={beforeTitle:zn,title(e){if(e.length>0){const t=e[0],n=t.chart.data.labels,r=n?n.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(r>0&&t.dataIndex"u"?jS[t].call(n,r):s}class zf extends Zr{constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const n=this.chart,r=this.options.setContext(this.getContext()),s=r.enabled&&n.options.animation&&r.animations,o=new lS(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=QD(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,n){const{callbacks:r}=n,s=Pt(r,"beforeTitle",this,t),o=Pt(r,"title",this,t),i=Pt(r,"afterTitle",this,t);let a=[];return a=En(a,Bn(s)),a=En(a,Bn(o)),a=En(a,Bn(i)),a}getBeforeBody(t,n){return db(Pt(n.callbacks,"beforeBody",this,t))}getBody(t,n){const{callbacks:r}=n,s=[];return ye(t,o=>{const i={before:[],lines:[],after:[]},a=hb(r,o);En(i.before,Bn(Pt(a,"beforeLabel",this,o))),En(i.lines,Pt(a,"label",this,o)),En(i.after,Bn(Pt(a,"afterLabel",this,o))),s.push(i)}),s}getAfterBody(t,n){return db(Pt(n.callbacks,"afterBody",this,t))}getFooter(t,n){const{callbacks:r}=n,s=Pt(r,"beforeFooter",this,t),o=Pt(r,"footer",this,t),i=Pt(r,"afterFooter",this,t);let a=[];return a=En(a,Bn(s)),a=En(a,Bn(o)),a=En(a,Bn(i)),a}_createItems(t){const n=this._active,r=this.chart.data,s=[],o=[],i=[];let a=[],l,u;for(l=0,u=n.length;lt.filter(d,h,f,r))),t.itemSort&&(a=a.sort((d,h)=>t.itemSort(d,h,r))),ye(a,d=>{const h=hb(t.callbacks,d);s.push(Pt(h,"labelColor",this,d)),o.push(Pt(h,"labelPointStyle",this,d)),i.push(Pt(h,"labelTextColor",this,d))}),this.labelColors=s,this.labelPointStyles=o,this.labelTextColors=i,this.dataPoints=a,a}update(t,n){const r=this.options.setContext(this.getContext()),s=this._active;let o,i=[];if(!s.length)this.opacity!==0&&(o={opacity:0});else{const a=Ni[r.position].call(this,s,this._eventPosition);i=this._createItems(r),this.title=this.getTitle(i,r),this.beforeBody=this.getBeforeBody(i,r),this.body=this.getBody(i,r),this.afterBody=this.getAfterBody(i,r),this.footer=this.getFooter(i,r);const l=this._size=lb(this,r),u=Object.assign({},a,l),d=cb(this.chart,r,u),h=ub(r,u,d,this.chart);this.xAlign=d.xAlign,this.yAlign=d.yAlign,o={opacity:1,x:h.x,y:h.y,width:l.width,height:l.height,caretX:a.x,caretY:a.y}}this._tooltipItems=i,this.$context=void 0,o&&this._resolveAnimations().update(this,o),t&&r.external&&r.external.call(this,{chart:this.chart,tooltip:this,replay:n})}drawCaret(t,n,r,s){const o=this.getCaretPosition(t,r,s);n.lineTo(o.x1,o.y1),n.lineTo(o.x2,o.y2),n.lineTo(o.x3,o.y3)}getCaretPosition(t,n,r){const{xAlign:s,yAlign:o}=this,{caretSize:i,cornerRadius:a}=r,{topLeft:l,topRight:u,bottomLeft:d,bottomRight:h}=Wi(a),{x:f,y:p}=t,{width:g,height:m}=n;let y,x,v,b,k,w;return o==="center"?(k=p+m/2,s==="left"?(y=f,x=y-i,b=k+i,w=k-i):(y=f+g,x=y+i,b=k-i,w=k+i),v=y):(s==="left"?x=f+Math.max(l,d)+i:s==="right"?x=f+g-Math.max(u,h)-i:x=this.caretX,o==="top"?(b=p,k=b-i,y=x-i,v=x+i):(b=p+m,k=b+i,y=x+i,v=x-i),w=b),{x1:y,x2:x,x3:v,y1:b,y2:k,y3:w}}drawTitle(t,n,r){const s=this.title,o=s.length;let i,a,l;if(o){const u=wo(r.rtl,this.x,this.width);for(t.x=Rl(this,r.titleAlign,r),n.textAlign=u.textAlign(r.titleAlign),n.textBaseline="middle",i=yt(r.titleFont),a=r.titleSpacing,n.fillStyle=r.titleColor,n.font=i.string,l=0;lv!==0)?(t.beginPath(),t.fillStyle=o.multiKeyBackground,Mf(t,{x:m,y:g,w:u,h:l,radius:x}),t.fill(),t.stroke(),t.fillStyle=i.backgroundColor,t.beginPath(),Mf(t,{x:y,y:g+1,w:u-2,h:l-2,radius:x}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(m,g,u,l),t.strokeRect(m,g,u,l),t.fillStyle=i.backgroundColor,t.fillRect(y,g+1,u-2,l-2))}t.fillStyle=this.labelTextColors[r]}drawBody(t,n,r){const{body:s}=this,{bodySpacing:o,bodyAlign:i,displayColors:a,boxHeight:l,boxWidth:u,boxPadding:d}=r,h=yt(r.bodyFont);let f=h.lineHeight,p=0;const g=wo(r.rtl,this.x,this.width),m=function(_){n.fillText(_,g.x(t.x+p),t.y+f/2),t.y+=f+o},y=g.textAlign(i);let x,v,b,k,w,j,N;for(n.textAlign=i,n.textBaseline="middle",n.font=h.string,t.x=Rl(this,y,r),n.fillStyle=r.bodyColor,ye(this.beforeBody,m),p=a&&y!=="right"?i==="center"?u/2+d:u+2+d:0,k=0,j=s.length;k0&&n.stroke()}_updateAnimationTarget(t){const n=this.chart,r=this.$animations,s=r&&r.x,o=r&&r.y;if(s||o){const i=Ni[t.position].call(this,this._active,this._eventPosition);if(!i)return;const a=this._size=lb(this,t),l=Object.assign({},i,this._size),u=cb(n,t,l),d=ub(t,l,u,n);(s._to!==d.x||o._to!==d.y)&&(this.xAlign=u.xAlign,this.yAlign=u.yAlign,this.width=a.width,this.height=a.height,this.caretX=i.x,this.caretY=i.y,this._resolveAnimations().update(this,d))}}_willRender(){return!!this.opacity}draw(t){const n=this.options.setContext(this.getContext());let r=this.opacity;if(!r)return;this._updateAnimationTarget(n);const s={width:this.width,height:this.height},o={x:this.x,y:this.y};r=Math.abs(r)<.001?0:r;const i=hn(n.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;n.enabled&&a&&(t.save(),t.globalAlpha=r,this.drawBackground(o,t,s,n),nS(t,n.textDirection),o.y+=i.top,this.drawTitle(o,t,n),this.drawBody(o,t,n),this.drawFooter(o,t,n),rS(t,n.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,n){const r=this._active,s=t.map(({datasetIndex:a,index:l})=>{const u=this.chart.getDatasetMeta(a);if(!u)throw new Error("Cannot find a dataset at index "+a);return{datasetIndex:a,element:u.data[l],index:l}}),o=!Hc(r,s),i=this._positionChanged(s,n);(o||i)&&(this._active=s,this._eventPosition=n,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,n,r=!0){if(n&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const s=this.options,o=this._active||[],i=this._getActiveElements(t,o,n,r),a=this._positionChanged(i,t),l=n||!Hc(i,o)||a;return l&&(this._active=i,(s.enabled||s.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,n))),l}_getActiveElements(t,n,r,s){const o=this.options;if(t.type==="mouseout")return[];if(!s)return n.filter(a=>this.chart.data.datasets[a.datasetIndex]&&this.chart.getDatasetMeta(a.datasetIndex).controller.getParsed(a.index)!==void 0);const i=this.chart.getElementsAtEventForMode(t,o.mode,o,r);return o.reverse&&i.reverse(),i}_positionChanged(t,n){const{caretX:r,caretY:s,options:o}=this,i=Ni[o.position].call(this,t,n);return i!==!1&&(r!==i.x||s!==i.y)}}Z(zf,"positioners",Ni);var Vu={id:"tooltip",_element:zf,positioners:Ni,afterInit(e,t,n){n&&(e.tooltip=new zf({chart:e,options:n}))},beforeUpdate(e,t,n){e.tooltip&&e.tooltip.initialize(n)},reset(e,t,n){e.tooltip&&e.tooltip.initialize(n)},afterDraw(e){const t=e.tooltip;if(t&&t._willRender()){const n={tooltip:t};if(e.notifyPlugins("beforeTooltipDraw",{...n,cancelable:!0})===!1)return;t.draw(e.ctx),e.notifyPlugins("afterTooltipDraw",n)}},afterEvent(e,t){if(e.tooltip){const n=t.replay;e.tooltip.handleEvent(t.event,n,t.inChartArea)&&(t.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(e,t)=>t.bodyFont.size,boxWidth:(e,t)=>t.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:jS},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:e=>e!=="filter"&&e!=="itemSort"&&e!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};const JD=(e,t,n,r)=>(typeof t=="string"?(n=e.push(t)-1,r.unshift({index:n,label:t})):isNaN(t)&&(n=null),n);function ZD(e,t,n,r){const s=e.indexOf(t);if(s===-1)return JD(e,t,n,r);const o=e.lastIndexOf(t);return s!==o?n:s}const eI=(e,t)=>e===null?null:_t(Math.round(e),0,t);function fb(e){const t=this.getLabels();return e>=0&&en.length-1?null:this.getPixelForValue(n[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}Z(zo,"id","category"),Z(zo,"defaults",{ticks:{callback:fb}});function tI(e,t){const n=[],{bounds:s,step:o,min:i,max:a,precision:l,count:u,maxTicks:d,maxDigits:h,includeBounds:f}=e,p=o||1,g=d-1,{min:m,max:y}=t,x=!ke(i),v=!ke(a),b=!ke(u),k=(y-m)/(h+1);let w=fx((y-m)/g/p)*p,j,N,_,P;if(w<1e-14&&!x&&!v)return[{value:m},{value:y}];P=Math.ceil(y/w)-Math.floor(m/w),P>g&&(w=fx(P*w/g/p)*p),ke(l)||(j=Math.pow(10,l),w=Math.ceil(w*j)/j),s==="ticks"?(N=Math.floor(m/w)*w,_=Math.ceil(y/w)*w):(N=m,_=y),x&&v&&o&&wM((a-i)/o,w/1e3)?(P=Math.round(Math.min((a-i)/w,d)),w=(a-i)/P,N=i,_=a):b?(N=x?i:N,_=v?a:_,P=u-1,w=(_-N)/P):(P=(_-N)/w,$i(P,Math.round(P),w/1e3)?P=Math.round(P):P=Math.ceil(P));const A=Math.max(px(w),px(N));j=Math.pow(10,ke(l)?A:l),N=Math.round(N*j)/j,_=Math.round(_*j)/j;let O=0;for(x&&(f&&N!==i?(n.push({value:i}),Na)break;n.push({value:F})}return v&&f&&_!==a?n.length&&$i(n[n.length-1].value,a,pb(a,k,e))?n[n.length-1].value=a:n.push({value:a}):(!v||_===a)&&n.push({value:_}),n}function pb(e,t,{horizontal:n,minRotation:r}){const s=Xn(r),o=(n?Math.sin(s):Math.cos(s))||.001,i=.75*t*(""+e).length;return Math.min(t/o,i)}class nI extends Xo{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,n){return ke(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:n,maxDefined:r}=this.getUserBounds();let{min:s,max:o}=this;const i=l=>s=n?s:l,a=l=>o=r?o:l;if(t){const l=Do(s),u=Do(o);l<0&&u<0?a(0):l>0&&u>0&&i(0)}if(s===o){let l=o===0?1:Math.abs(o*.05);a(o+l),t||i(s-l)}this.min=s,this.max=o}getTickLimit(){const t=this.options.ticks;let{maxTicksLimit:n,stepSize:r}=t,s;return r?(s=Math.ceil(this.max/r)-Math.floor(this.min/r)+1,s>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${r} would result generating up to ${s} ticks. Limiting to 1000.`),s=1e3)):(s=this.computeTickLimit(),n=n||11),n&&(s=Math.min(n,s)),s}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,n=t.ticks;let r=this.getTickLimit();r=Math.max(2,r);const s={maxTicks:r,bounds:t.bounds,min:t.min,max:t.max,precision:n.precision,step:n.stepSize,count:n.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:n.minRotation||0,includeBounds:n.includeBounds!==!1},o=this._range||this,i=tI(s,o);return t.bounds==="ticks"&&kM(i,this,"value"),t.reverse?(i.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),i}configure(){const t=this.ticks;let n=this.min,r=this.max;if(super.configure(),this.options.offset&&t.length){const s=(r-n)/Math.max(t.length-1,1)/2;n-=s,r+=s}this._startValue=n,this._endValue=r,this._valueRange=r-n}getLabelForValue(t){return Dg(t,this.chart.options.locale,this.options.ticks.format)}}class Vo extends nI{determineDataLimits(){const{min:t,max:n}=this.getMinMax(!0);this.min=bt(t)?t:0,this.max=bt(n)?n:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),n=t?this.width:this.height,r=Xn(this.options.ticks.minRotation),s=(t?Math.sin(r):Math.cos(r))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(n/Math.min(40,o.lineHeight/s))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}Z(Vo,"id","linear"),Z(Vo,"defaults",{ticks:{callback:Y2.formatters.numeric}});const Bu={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},Tt=Object.keys(Bu);function gb(e,t){return e-t}function mb(e,t){if(ke(t))return null;const n=e._adapter,{parser:r,round:s,isoWeekday:o}=e._parseOpts;let i=t;return typeof r=="function"&&(i=r(i)),bt(i)||(i=typeof r=="string"?n.parse(i,r):n.parse(i)),i===null?null:(s&&(i=s==="week"&&(ba(o)||o===!0)?n.startOf(i,"isoWeek",o):n.startOf(i,s)),+i)}function yb(e,t,n,r){const s=Tt.length;for(let o=Tt.indexOf(e);o=Tt.indexOf(n);o--){const i=Tt[o];if(Bu[i].common&&e._adapter.diff(s,r,i)>=t-1)return i}return Tt[n?Tt.indexOf(n):0]}function sI(e){for(let t=Tt.indexOf(e)+1,n=Tt.length;t=t?n[r]:n[s];e[o]=!0}}function oI(e,t,n,r){const s=e._adapter,o=+s.startOf(t[0].value,r),i=t[t.length-1].value;let a,l;for(a=o;a<=i;a=+s.add(a,1,r))l=n[a],l>=0&&(t[l].major=!0);return t}function bb(e,t,n){const r=[],s={},o=t.length;let i,a;for(i=0;i+t.value))}initOffsets(t=[]){let n=0,r=0,s,o;this.options.offset&&t.length&&(s=this.getDecimalForValue(t[0]),t.length===1?n=1-s:n=(this.getDecimalForValue(t[1])-s)/2,o=this.getDecimalForValue(t[t.length-1]),t.length===1?r=o:r=(o-this.getDecimalForValue(t[t.length-2]))/2);const i=t.length<3?.5:.25;n=_t(n,0,i),r=_t(r,0,i),this._offsets={start:n,end:r,factor:1/(n+1+r)}}_generate(){const t=this._adapter,n=this.min,r=this.max,s=this.options,o=s.time,i=o.unit||yb(o.minUnit,n,r,this._getLabelCapacity(n)),a=ue(s.ticks.stepSize,1),l=i==="week"?o.isoWeekday:!1,u=ba(l)||l===!0,d={};let h=n,f,p;if(u&&(h=+t.startOf(h,"isoWeek",l)),h=+t.startOf(h,u?"day":i),t.diff(r,n,i)>1e5*a)throw new Error(n+" and "+r+" are too far apart with stepSize of "+a+" "+i);const g=s.ticks.source==="data"&&this.getDataTimestamps();for(f=h,p=0;f+m)}getLabelForValue(t){const n=this._adapter,r=this.options.time;return r.tooltipFormat?n.format(t,r.tooltipFormat):n.format(t,r.displayFormats.datetime)}format(t,n){const s=this.options.time.displayFormats,o=this._unit,i=n||s[o];return this._adapter.format(t,i)}_tickFormatFunction(t,n,r,s){const o=this.options,i=o.ticks.callback;if(i)return je(i,[t,n,r],this);const a=o.time.displayFormats,l=this._unit,u=this._majorUnit,d=l&&a[l],h=u&&a[u],f=r[n],p=u&&h&&f&&f.major;return this._adapter.format(t,s||(p?h:d))}generateTickLabels(t){let n,r,s;for(n=0,r=t.length;n0?a:1}getDataTimestamps(){let t=this._cache.data||[],n,r;if(t.length)return t;const s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(n=0,r=s.length;n=e[r].pos&&t<=e[s].pos&&({lo:r,hi:s}=vs(e,"pos",t)),{pos:o,time:a}=e[r],{pos:i,time:l}=e[s]):(t>=e[r].time&&t<=e[s].time&&({lo:r,hi:s}=vs(e,"time",t)),{time:o,pos:a}=e[r],{time:i,pos:l}=e[s]);const u=i-o;return u?a+(l-a)*(t-o)/u:a}class vb extends Xc{constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),n=this._table=this.buildLookupTable(t);this._minPos=El(n,this.min),this._tableRange=El(n,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:n,max:r}=this,s=[],o=[];let i,a,l,u,d;for(i=0,a=t.length;i=n&&u<=r&&s.push(u);if(s.length<2)return[{time:n,pos:0},{time:r,pos:1}];for(i=0,a=s.length;is-o)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const n=this.getDataTimestamps(),r=this.getLabelTimestamps();return n.length&&r.length?t=this.normalize(n.concat(r)):t=n.length?n:r,t=this._cache.all=t,t}getDecimalForValue(t){return(El(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const n=this._offsets,r=this.getDecimalForPixel(t)/n.factor-n.end;return El(this._table,r*this._tableRange+this._minPos,!0)}}Z(vb,"id","timeseries"),Z(vb,"defaults",Xc.defaults);const CS="label";function wb(e,t){typeof e=="function"?e(t):e&&(e.current=t)}function iI(e,t){const n=e.options;n&&t&&Object.assign(n,t)}function NS(e,t){e.labels=t}function PS(e,t,n=CS){const r=[];e.datasets=t.map(s=>{const o=e.datasets.find(i=>i[n]===s[n]);return!o||!s.data||r.includes(o)?{...s}:(r.push(o),Object.assign(o,s),o)})}function aI(e,t=CS){const n={labels:[],datasets:[]};return NS(n,e.labels),PS(n,e.datasets,t),n}function lI(e,t){const{height:n=150,width:r=300,redraw:s=!1,datasetIdKey:o,type:i,data:a,options:l,plugins:u=[],fallbackContent:d,updateMode:h,...f}=e,p=S.useRef(null),g=S.useRef(null),m=()=>{p.current&&(g.current=new Bs(p.current,{type:i,data:aI(a,o),options:l&&{...l},plugins:u}),wb(t,g.current))},y=()=>{wb(t,null),g.current&&(g.current.destroy(),g.current=null)};return S.useEffect(()=>{!s&&g.current&&l&&iI(g.current,l)},[s,l]),S.useEffect(()=>{!s&&g.current&&NS(g.current.config.data,a.labels)},[s,a.labels]),S.useEffect(()=>{!s&&g.current&&a.datasets&&PS(g.current.config.data,a.datasets,o)},[s,a.datasets]),S.useEffect(()=>{g.current&&(s?(y(),setTimeout(m)):g.current.update(h))},[s,l,a.labels,a.datasets,h]),S.useEffect(()=>{g.current&&(y(),setTimeout(m))},[i]),S.useEffect(()=>(m(),()=>y()),[]),c.jsx("canvas",{ref:p,role:"img",height:n,width:r,...f,children:d})}const cI=S.forwardRef(lI);function RS(e,t){return Bs.register(t),S.forwardRef((n,r)=>c.jsx(cI,{...n,ref:r,type:e}))}const Bo=RS("line",tc),uI=RS("pie",Lf);Bs.register(zo,Vo,Cs,bn,zu,Vu,Fu,Iu);const dI={Total:"#6B7280"},kb=["#E6194B","#3CB44B","#4363D8","#F58231","#911EB4","#42D4F4","#F032E6","#469990","#9A6324","#800000","#808000","#000075","#000000"];function hI(){var x,v,b,k;const[e,t]=S.useState("7d"),{data:n,loading:r}=JT(e),s=S.useMemo(()=>{var j;const w={Total:"#6B7280"};return(j=n==null?void 0:n.endpoint_chart_data)!=null&&j.datasets&&Object.keys(n.endpoint_chart_data.datasets).sort().forEach((_,P)=>{w[_]=kb[P%kb.length]}),w},[n]),[o,i]=S.useState({Total:!0});S.useEffect(()=>{var w;(w=n==null?void 0:n.endpoint_chart_data)!=null&&w.datasets&&i(j=>{const N={...j};return Object.keys(n.endpoint_chart_data.datasets).forEach(_=>{N[_]===void 0&&(N[_]=!0)}),N})},[n]);const a=S.useMemo(()=>{var j;const w=[{label:"Total",value:"Total",color:s.Total}];return(j=n==null?void 0:n.endpoint_chart_data)!=null&&j.datasets&&Object.keys(n.endpoint_chart_data.datasets).sort().forEach(_=>{w.push({label:_.replace("/v1/",""),value:_,color:s[_]})}),w},[n,s]),l=S.useMemo(()=>Object.keys(o).filter(w=>o[w]!==!1),[o]),u=w=>{const j={};a.forEach(N=>{j[N.value]=w.includes(N.value)}),i(j)},d=((x=n==null?void 0:n.endpoint_chart_data)==null?void 0:x.datasets)||{},h={labels:((v=n==null?void 0:n.endpoint_chart_data)==null?void 0:v.labels)||((b=n==null?void 0:n.chart_data)==null?void 0:b.labels)||[],datasets:[...Object.entries(d).map(([w,j])=>({label:w,data:j,borderColor:s[w]||"#6B7280",backgroundColor:"transparent",tension:.4,borderWidth:2,hidden:o[w]===!1})),{label:"Total",data:((k=n==null?void 0:n.chart_data)==null?void 0:k.data)||[],borderColor:dI.Total,backgroundColor:"transparent",borderWidth:3,tension:.4,hidden:o.Total===!1}]},f={labels:(n==null?void 0:n.latency_chart.labels)||[],datasets:[{label:"Avg Latency (ms)",data:(n==null?void 0:n.latency_chart.data.map(w=>w*1e3))||[],fill:!0,backgroundColor:w=>{const N=w.chart.ctx.createLinearGradient(0,0,0,200);return N.addColorStop(0,"rgba(59, 130, 246, 0.2)"),N.addColorStop(1,"rgba(59, 130, 246, 0)"),N},borderColor:"#3b82f6",tension:.4}]},p={responsive:!0,maintainAspectRatio:!1,plugins:{legend:{display:!1},tooltip:{mode:"index",intersect:!1,backgroundColor:"rgba(0, 0, 0, 0.8)",titleColor:"#fff",bodyColor:"#fff",borderColor:"rgba(255, 255, 255, 0.1)",borderWidth:1,padding:10}},scales:{x:{grid:{display:!1},ticks:{color:"rgba(156, 163, 175, 0.8)"}},y:{grid:{color:"rgba(156, 163, 175, 0.1)"},ticks:{color:"rgba(156, 163, 175, 0.8)"},beginAtZero:!0}},interaction:{mode:"nearest",axis:"x",intersect:!1}};if(r)return c.jsxs("div",{className:"space-y-6 ",children:[c.jsx(ox,{}),c.jsx("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4",children:c.jsxs("div",{children:[c.jsx(me,{className:"h-8 w-48 mb-2"}),c.jsx(me,{className:"h-4 w-64"})]})}),c.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[1,2,3].map(w=>c.jsxs("div",{className:"bg-white dark:bg-secondary p-6 rounded-xl border border-gray-200 dark:border-white/5 shadow-sm",children:[c.jsx("div",{className:"flex items-center justify-between mb-4",children:c.jsx(me,{className:"h-8 w-8 rounded-lg"})}),c.jsx(me,{className:"h-8 w-32 mb-1"}),c.jsx(me,{className:"h-3 w-16"})]},w))}),c.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[c.jsxs("div",{className:"lg:col-span-2 bg-white dark:bg-secondary p-6 rounded-xl border border-gray-200 dark:border-white/5 shadow-sm h-[400px] flex flex-col",children:[c.jsx("div",{className:"flex justify-between mb-6",children:c.jsxs("div",{children:[c.jsx(me,{className:"h-6 w-48 mb-2"}),c.jsx(me,{className:"h-4 w-64"})]})}),c.jsx(me,{className:"h-10 w-48 mb-4"}),c.jsx(me,{className:"w-full flex-1 rounded-lg"})]}),c.jsxs("div",{className:"bg-white dark:bg-secondary p-6 rounded-xl border border-gray-200 dark:border-white/5 shadow-sm h-[300px] flex flex-col",children:[c.jsx(me,{className:"h-6 w-32 mb-2"}),c.jsx(me,{className:"h-4 w-48 mb-6"}),c.jsx(me,{className:"w-full flex-1 rounded-lg"})]}),c.jsxs("div",{className:"bg-white dark:bg-secondary p-6 rounded-xl border border-gray-200 dark:border-white/5 shadow-sm h-[300px]",children:[c.jsx(me,{className:"h-6 w-48 mb-4"}),c.jsx("div",{className:"space-y-4",children:[1,2,3,4].map(w=>c.jsxs("div",{className:"flex justify-between items-center",children:[c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx(me,{className:"h-3 w-3 rounded-full"}),c.jsx(me,{className:"h-4 w-20"})]}),c.jsx(me,{className:"h-4 w-16"})]},w))})]})]})]});const g=(n==null?void 0:n.usage.reduce((w,j)=>w+j.used,0))||0,m=n!=null&&n.latency_chart.data.length?(n.latency_chart.data.reduce((w,j)=>w+j,0)/n.latency_chart.data.length*1e3).toFixed(0):"0",y=n==null?void 0:n.usage.reduce((w,j)=>j.used>((w==null?void 0:w.used)||0)?j:w,null);return c.jsxs("div",{className:"space-y-6",children:[c.jsx(ox,{}),c.jsx("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4",children:c.jsxs("div",{children:[c.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:"Dashboard"}),c.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:"Overview of your API usage and performance."})]})}),c.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[c.jsx(St,{label:"Total Requests",value:g.toLocaleString(),icon:bu,color:"bg-blue-500"}),c.jsx(St,{label:"Avg Latency",value:`${m}ms`,icon:wu,color:"bg-orange-500"}),c.jsx(St,{label:"Most Used",value:(y==null?void 0:y.endpoint.replace("/v1/",""))||"N/A",icon:og,color:"bg-purple-500"})]}),c.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[c.jsx("div",{className:"lg:col-span-2",children:c.jsxs(Ms,{title:"Request Volume by Endpoint",description:"Track usage trends for each API endpoint",showTimeSelector:!0,timeRange:e,onTimeRangeChange:t,className:"h-[400px]",children:[c.jsx("div",{className:"flex flex-wrap gap-3 mb-4 pb-4 border-b border-gray-200 dark:border-white/10",children:c.jsx(j2,{label:"Select Endpoints",options:a,selected:l,onChange:u})}),c.jsx("div",{className:"flex-1 min-h-0",children:c.jsx(Bo,{options:p,data:h})})]})}),c.jsx(Ms,{title:"Latency Trends",description:"Average response time over the selected period",showTimeSelector:!0,timeRange:e,onTimeRangeChange:t,children:c.jsx("div",{className:"flex-1 min-h-0",children:c.jsx(Bo,{options:p,data:f})})}),c.jsxs("div",{className:"bg-white dark:bg-secondary rounded-xl shadow-md dark:shadow-lg dark:shadow-black/10 border border-gray-200 dark:border-white/5 p-6",children:[c.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-4",children:"Endpoint Breakdown"}),c.jsx("div",{className:"space-y-3",children:n==null?void 0:n.usage.filter(w=>w.endpoint!=="unknown").sort((w,j)=>j.used-w.used).map(w=>{const j=g>0?(w.used/g*100).toFixed(1):"0";return c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[c.jsx("div",{className:"w-3 h-3 rounded-full flex-shrink-0",style:{backgroundColor:s[w.endpoint]||"#6B7280"}}),c.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-300",children:w.endpoint.replace("/tasks/","").replace("/tasks","tasks")})]}),c.jsxs("div",{className:"flex items-center gap-4",children:[c.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-white",children:w.used.toLocaleString()}),c.jsxs("span",{className:"text-sm text-gray-500 dark:text-gray-400 w-12 text-right",children:[j,"%"]})]})]},w.endpoint)})})]})]})]})}/** * table-core * * Copyright (c) TanStack @@ -431,7 +431,7 @@ Error generating stack: `+o.message+` */function jr(e,t){return typeof e=="function"?e(t):e}function Yt(e,t){return n=>{t.setState(r=>({...r,[e]:jr(n,r[e])}))}}function $u(e){return e instanceof Function}function fI(e){return Array.isArray(e)&&e.every(t=>typeof t=="number")}function pI(e,t){const n=[],r=s=>{s.forEach(o=>{n.push(o);const i=t(o);i!=null&&i.length&&r(i)})};return r(e),n}function ee(e,t,n){let r=[],s;return o=>{let i;n.key&&n.debug&&(i=Date.now());const a=e(o);if(!(a.length!==r.length||a.some((d,h)=>r[h]!==d)))return s;r=a;let u;if(n.key&&n.debug&&(u=Date.now()),s=t(...a),n==null||n.onChange==null||n.onChange(s),n.key&&n.debug&&n!=null&&n.debug()){const d=Math.round((Date.now()-i)*100)/100,h=Math.round((Date.now()-u)*100)/100,f=h/16,p=(g,m)=>{for(g=String(g);g.length{var s;return(s=e==null?void 0:e.debugAll)!=null?s:e[t]},key:!1,onChange:r}}function gI(e,t,n,r){const s=()=>{var i;return(i=o.getValue())!=null?i:e.options.renderFallbackValue},o={id:`${t.id}_${n.id}`,row:t,column:n,getValue:()=>t.getValue(r),renderValue:s,getContext:ee(()=>[e,n,t,o],(i,a,l,u)=>({table:i,column:a,row:l,cell:u,getValue:u.getValue,renderValue:u.renderValue}),te(e.options,"debugCells"))};return e._features.forEach(i=>{i.createCell==null||i.createCell(o,n,t,e)},{}),o}function mI(e,t,n,r){var s,o;const a={...e._getDefaultColumnDef(),...t},l=a.accessorKey;let u=(s=(o=a.id)!=null?o:l?typeof String.prototype.replaceAll=="function"?l.replaceAll(".","_"):l.replace(/\./g,"_"):void 0)!=null?s:typeof a.header=="string"?a.header:void 0,d;if(a.accessorFn?d=a.accessorFn:l&&(l.includes(".")?d=f=>{let p=f;for(const m of l.split(".")){var g;p=(g=p)==null?void 0:g[m]}return p}:d=f=>f[a.accessorKey]),!u)throw new Error;let h={id:`${String(u)}`,accessorFn:d,parent:r,depth:n,columnDef:a,columns:[],getFlatColumns:ee(()=>[!0],()=>{var f;return[h,...(f=h.columns)==null?void 0:f.flatMap(p=>p.getFlatColumns())]},te(e.options,"debugColumns")),getLeafColumns:ee(()=>[e._getOrderColumnsFn()],f=>{var p;if((p=h.columns)!=null&&p.length){let g=h.columns.flatMap(m=>m.getLeafColumns());return f(g)}return[h]},te(e.options,"debugColumns"))};for(const f of e._features)f.createColumn==null||f.createColumn(h,e);return h}const ht="debugHeaders";function Sb(e,t,n){var r;let o={id:(r=n.id)!=null?r:t.id,column:t,index:n.index,isPlaceholder:!!n.isPlaceholder,placeholderId:n.placeholderId,depth:n.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const i=[],a=l=>{l.subHeaders&&l.subHeaders.length&&l.subHeaders.map(a),i.push(l)};return a(o),i},getContext:()=>({table:e,header:o,column:t})};return e._features.forEach(i=>{i.createHeader==null||i.createHeader(o,e)}),o}const yI={createTable:e=>{e.getHeaderGroups=ee(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,s)=>{var o,i;const a=(o=r==null?void 0:r.map(h=>n.find(f=>f.id===h)).filter(Boolean))!=null?o:[],l=(i=s==null?void 0:s.map(h=>n.find(f=>f.id===h)).filter(Boolean))!=null?i:[],u=n.filter(h=>!(r!=null&&r.includes(h.id))&&!(s!=null&&s.includes(h.id)));return Tl(t,[...a,...u,...l],e)},te(e.options,ht)),e.getCenterHeaderGroups=ee(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,s)=>(n=n.filter(o=>!(r!=null&&r.includes(o.id))&&!(s!=null&&s.includes(o.id))),Tl(t,n,e,"center")),te(e.options,ht)),e.getLeftHeaderGroups=ee(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(t,n,r)=>{var s;const o=(s=r==null?void 0:r.map(i=>n.find(a=>a.id===i)).filter(Boolean))!=null?s:[];return Tl(t,o,e,"left")},te(e.options,ht)),e.getRightHeaderGroups=ee(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(t,n,r)=>{var s;const o=(s=r==null?void 0:r.map(i=>n.find(a=>a.id===i)).filter(Boolean))!=null?s:[];return Tl(t,o,e,"right")},te(e.options,ht)),e.getFooterGroups=ee(()=>[e.getHeaderGroups()],t=>[...t].reverse(),te(e.options,ht)),e.getLeftFooterGroups=ee(()=>[e.getLeftHeaderGroups()],t=>[...t].reverse(),te(e.options,ht)),e.getCenterFooterGroups=ee(()=>[e.getCenterHeaderGroups()],t=>[...t].reverse(),te(e.options,ht)),e.getRightFooterGroups=ee(()=>[e.getRightHeaderGroups()],t=>[...t].reverse(),te(e.options,ht)),e.getFlatHeaders=ee(()=>[e.getHeaderGroups()],t=>t.map(n=>n.headers).flat(),te(e.options,ht)),e.getLeftFlatHeaders=ee(()=>[e.getLeftHeaderGroups()],t=>t.map(n=>n.headers).flat(),te(e.options,ht)),e.getCenterFlatHeaders=ee(()=>[e.getCenterHeaderGroups()],t=>t.map(n=>n.headers).flat(),te(e.options,ht)),e.getRightFlatHeaders=ee(()=>[e.getRightHeaderGroups()],t=>t.map(n=>n.headers).flat(),te(e.options,ht)),e.getCenterLeafHeaders=ee(()=>[e.getCenterFlatHeaders()],t=>t.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),te(e.options,ht)),e.getLeftLeafHeaders=ee(()=>[e.getLeftFlatHeaders()],t=>t.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),te(e.options,ht)),e.getRightLeafHeaders=ee(()=>[e.getRightFlatHeaders()],t=>t.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),te(e.options,ht)),e.getLeafHeaders=ee(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(t,n,r)=>{var s,o,i,a,l,u;return[...(s=(o=t[0])==null?void 0:o.headers)!=null?s:[],...(i=(a=n[0])==null?void 0:a.headers)!=null?i:[],...(l=(u=r[0])==null?void 0:u.headers)!=null?l:[]].map(d=>d.getLeafHeaders()).flat()},te(e.options,ht))}};function Tl(e,t,n,r){var s,o;let i=0;const a=function(f,p){p===void 0&&(p=1),i=Math.max(i,p),f.filter(g=>g.getIsVisible()).forEach(g=>{var m;(m=g.columns)!=null&&m.length&&a(g.columns,p+1)},0)};a(e);let l=[];const u=(f,p)=>{const g={depth:p,id:[r,`${p}`].filter(Boolean).join("_"),headers:[]},m=[];f.forEach(y=>{const x=[...m].reverse()[0],v=y.column.depth===g.depth;let b,k=!1;if(v&&y.column.parent?b=y.column.parent:(b=y.column,k=!0),x&&(x==null?void 0:x.column)===b)x.subHeaders.push(y);else{const w=Sb(n,b,{id:[r,p,b.id,y==null?void 0:y.id].filter(Boolean).join("_"),isPlaceholder:k,placeholderId:k?`${m.filter(j=>j.column===b).length}`:void 0,depth:p,index:m.length});w.subHeaders.push(y),m.push(w)}g.headers.push(y),y.headerGroup=g}),l.push(g),p>0&&u(m,p-1)},d=t.map((f,p)=>Sb(n,f,{depth:i,index:p}));u(d,i-1),l.reverse();const h=f=>f.filter(g=>g.column.getIsVisible()).map(g=>{let m=0,y=0,x=[0];g.subHeaders&&g.subHeaders.length?(x=[],h(g.subHeaders).forEach(b=>{let{colSpan:k,rowSpan:w}=b;m+=k,x.push(w)})):m=1;const v=Math.min(...x);return y=y+v,g.colSpan=m,g.rowSpan=y,{colSpan:m,rowSpan:y}});return h((s=(o=l[0])==null?void 0:o.headers)!=null?s:[]),l}const Ug=(e,t,n,r,s,o,i)=>{let a={id:t,index:r,original:n,depth:s,parentId:i,_valuesCache:{},_uniqueValuesCache:{},getValue:l=>{if(a._valuesCache.hasOwnProperty(l))return a._valuesCache[l];const u=e.getColumn(l);if(u!=null&&u.accessorFn)return a._valuesCache[l]=u.accessorFn(a.original,r),a._valuesCache[l]},getUniqueValues:l=>{if(a._uniqueValuesCache.hasOwnProperty(l))return a._uniqueValuesCache[l];const u=e.getColumn(l);if(u!=null&&u.accessorFn)return u.columnDef.getUniqueValues?(a._uniqueValuesCache[l]=u.columnDef.getUniqueValues(a.original,r),a._uniqueValuesCache[l]):(a._uniqueValuesCache[l]=[a.getValue(l)],a._uniqueValuesCache[l])},renderValue:l=>{var u;return(u=a.getValue(l))!=null?u:e.options.renderFallbackValue},subRows:[],getLeafRows:()=>pI(a.subRows,l=>l.subRows),getParentRow:()=>a.parentId?e.getRow(a.parentId,!0):void 0,getParentRows:()=>{let l=[],u=a;for(;;){const d=u.getParentRow();if(!d)break;l.push(d),u=d}return l.reverse()},getAllCells:ee(()=>[e.getAllLeafColumns()],l=>l.map(u=>gI(e,a,u,u.id)),te(e.options,"debugRows")),_getAllCellsByColumnId:ee(()=>[a.getAllCells()],l=>l.reduce((u,d)=>(u[d.column.id]=d,u),{}),te(e.options,"debugRows"))};for(let l=0;l{e._getFacetedRowModel=t.options.getFacetedRowModel&&t.options.getFacetedRowModel(t,e.id),e.getFacetedRowModel=()=>e._getFacetedRowModel?e._getFacetedRowModel():t.getPreFilteredRowModel(),e._getFacetedUniqueValues=t.options.getFacetedUniqueValues&&t.options.getFacetedUniqueValues(t,e.id),e.getFacetedUniqueValues=()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,e._getFacetedMinMaxValues=t.options.getFacetedMinMaxValues&&t.options.getFacetedMinMaxValues(t,e.id),e.getFacetedMinMaxValues=()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}}},ES=(e,t,n)=>{var r,s;const o=n==null||(r=n.toString())==null?void 0:r.toLowerCase();return!!(!((s=e.getValue(t))==null||(s=s.toString())==null||(s=s.toLowerCase())==null)&&s.includes(o))};ES.autoRemove=e=>kn(e);const TS=(e,t,n)=>{var r;return!!(!((r=e.getValue(t))==null||(r=r.toString())==null)&&r.includes(n))};TS.autoRemove=e=>kn(e);const AS=(e,t,n)=>{var r;return((r=e.getValue(t))==null||(r=r.toString())==null?void 0:r.toLowerCase())===(n==null?void 0:n.toLowerCase())};AS.autoRemove=e=>kn(e);const MS=(e,t,n)=>{var r;return(r=e.getValue(t))==null?void 0:r.includes(n)};MS.autoRemove=e=>kn(e);const LS=(e,t,n)=>!n.some(r=>{var s;return!((s=e.getValue(t))!=null&&s.includes(r))});LS.autoRemove=e=>kn(e)||!(e!=null&&e.length);const OS=(e,t,n)=>n.some(r=>{var s;return(s=e.getValue(t))==null?void 0:s.includes(r)});OS.autoRemove=e=>kn(e)||!(e!=null&&e.length);const DS=(e,t,n)=>e.getValue(t)===n;DS.autoRemove=e=>kn(e);const IS=(e,t,n)=>e.getValue(t)==n;IS.autoRemove=e=>kn(e);const Wg=(e,t,n)=>{let[r,s]=n;const o=e.getValue(t);return o>=r&&o<=s};Wg.resolveFilterValue=e=>{let[t,n]=e,r=typeof t!="number"?parseFloat(t):t,s=typeof n!="number"?parseFloat(n):n,o=t===null||Number.isNaN(r)?-1/0:r,i=n===null||Number.isNaN(s)?1/0:s;if(o>i){const a=o;o=i,i=a}return[o,i]};Wg.autoRemove=e=>kn(e)||kn(e[0])&&kn(e[1]);const Un={includesString:ES,includesStringSensitive:TS,equalsString:AS,arrIncludes:MS,arrIncludesAll:LS,arrIncludesSome:OS,equals:DS,weakEquals:IS,inNumberRange:Wg};function kn(e){return e==null||e===""}const bI={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:Yt("columnFilters",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(e,t)=>{e.getAutoFilterFn=()=>{const n=t.getCoreRowModel().flatRows[0],r=n==null?void 0:n.getValue(e.id);return typeof r=="string"?Un.includesString:typeof r=="number"?Un.inNumberRange:typeof r=="boolean"||r!==null&&typeof r=="object"?Un.equals:Array.isArray(r)?Un.arrIncludes:Un.weakEquals},e.getFilterFn=()=>{var n,r;return $u(e.columnDef.filterFn)?e.columnDef.filterFn:e.columnDef.filterFn==="auto"?e.getAutoFilterFn():(n=(r=t.options.filterFns)==null?void 0:r[e.columnDef.filterFn])!=null?n:Un[e.columnDef.filterFn]},e.getCanFilter=()=>{var n,r,s;return((n=e.columnDef.enableColumnFilter)!=null?n:!0)&&((r=t.options.enableColumnFilters)!=null?r:!0)&&((s=t.options.enableFilters)!=null?s:!0)&&!!e.accessorFn},e.getIsFiltered=()=>e.getFilterIndex()>-1,e.getFilterValue=()=>{var n;return(n=t.getState().columnFilters)==null||(n=n.find(r=>r.id===e.id))==null?void 0:n.value},e.getFilterIndex=()=>{var n,r;return(n=(r=t.getState().columnFilters)==null?void 0:r.findIndex(s=>s.id===e.id))!=null?n:-1},e.setFilterValue=n=>{t.setColumnFilters(r=>{const s=e.getFilterFn(),o=r==null?void 0:r.find(d=>d.id===e.id),i=jr(n,o?o.value:void 0);if(_b(s,i,e)){var a;return(a=r==null?void 0:r.filter(d=>d.id!==e.id))!=null?a:[]}const l={id:e.id,value:i};if(o){var u;return(u=r==null?void 0:r.map(d=>d.id===e.id?l:d))!=null?u:[]}return r!=null&&r.length?[...r,l]:[l]})}},createRow:(e,t)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.setColumnFilters=t=>{const n=e.getAllLeafColumns(),r=s=>{var o;return(o=jr(t,s))==null?void 0:o.filter(i=>{const a=n.find(l=>l.id===i.id);if(a){const l=a.getFilterFn();if(_b(l,i.value,a))return!1}return!0})};e.options.onColumnFiltersChange==null||e.options.onColumnFiltersChange(r)},e.resetColumnFilters=t=>{var n,r;e.setColumnFilters(t?[]:(n=(r=e.initialState)==null?void 0:r.columnFilters)!=null?n:[])},e.getPreFilteredRowModel=()=>e.getCoreRowModel(),e.getFilteredRowModel=()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel?e.getPreFilteredRowModel():e._getFilteredRowModel())}};function _b(e,t,n){return(e&&e.autoRemove?e.autoRemove(t,n):!1)||typeof t>"u"||typeof t=="string"&&!t}const vI=(e,t,n)=>n.reduce((r,s)=>{const o=s.getValue(e);return r+(typeof o=="number"?o:0)},0),wI=(e,t,n)=>{let r;return n.forEach(s=>{const o=s.getValue(e);o!=null&&(r>o||r===void 0&&o>=o)&&(r=o)}),r},kI=(e,t,n)=>{let r;return n.forEach(s=>{const o=s.getValue(e);o!=null&&(r=o)&&(r=o)}),r},SI=(e,t,n)=>{let r,s;return n.forEach(o=>{const i=o.getValue(e);i!=null&&(r===void 0?i>=i&&(r=s=i):(r>i&&(r=i),s{let n=0,r=0;if(t.forEach(s=>{let o=s.getValue(e);o!=null&&(o=+o)>=o&&(++n,r+=o)}),n)return r/n},jI=(e,t)=>{if(!t.length)return;const n=t.map(o=>o.getValue(e));if(!fI(n))return;if(n.length===1)return n[0];const r=Math.floor(n.length/2),s=n.sort((o,i)=>o-i);return n.length%2!==0?s[r]:(s[r-1]+s[r])/2},CI=(e,t)=>Array.from(new Set(t.map(n=>n.getValue(e))).values()),NI=(e,t)=>new Set(t.map(n=>n.getValue(e))).size,PI=(e,t)=>t.length,Qd={sum:vI,min:wI,max:kI,extent:SI,mean:_I,median:jI,unique:CI,uniqueCount:NI,count:PI},RI={getDefaultColumnDef:()=>({aggregatedCell:e=>{var t,n;return(t=(n=e.getValue())==null||n.toString==null?void 0:n.toString())!=null?t:null},aggregationFn:"auto"}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:Yt("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,t)=>{e.toggleGrouping=()=>{t.setGrouping(n=>n!=null&&n.includes(e.id)?n.filter(r=>r!==e.id):[...n??[],e.id])},e.getCanGroup=()=>{var n,r;return((n=e.columnDef.enableGrouping)!=null?n:!0)&&((r=t.options.enableGrouping)!=null?r:!0)&&(!!e.accessorFn||!!e.columnDef.getGroupingValue)},e.getIsGrouped=()=>{var n;return(n=t.getState().grouping)==null?void 0:n.includes(e.id)},e.getGroupedIndex=()=>{var n;return(n=t.getState().grouping)==null?void 0:n.indexOf(e.id)},e.getToggleGroupingHandler=()=>{const n=e.getCanGroup();return()=>{n&&e.toggleGrouping()}},e.getAutoAggregationFn=()=>{const n=t.getCoreRowModel().flatRows[0],r=n==null?void 0:n.getValue(e.id);if(typeof r=="number")return Qd.sum;if(Object.prototype.toString.call(r)==="[object Date]")return Qd.extent},e.getAggregationFn=()=>{var n,r;if(!e)throw new Error;return $u(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:e.columnDef.aggregationFn==="auto"?e.getAutoAggregationFn():(n=(r=t.options.aggregationFns)==null?void 0:r[e.columnDef.aggregationFn])!=null?n:Qd[e.columnDef.aggregationFn]}},createTable:e=>{e.setGrouping=t=>e.options.onGroupingChange==null?void 0:e.options.onGroupingChange(t),e.resetGrouping=t=>{var n,r;e.setGrouping(t?[]:(n=(r=e.initialState)==null?void 0:r.grouping)!=null?n:[])},e.getPreGroupedRowModel=()=>e.getFilteredRowModel(),e.getGroupedRowModel=()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel?e.getPreGroupedRowModel():e._getGroupedRowModel())},createRow:(e,t)=>{e.getIsGrouped=()=>!!e.groupingColumnId,e.getGroupingValue=n=>{if(e._groupingValuesCache.hasOwnProperty(n))return e._groupingValuesCache[n];const r=t.getColumn(n);return r!=null&&r.columnDef.getGroupingValue?(e._groupingValuesCache[n]=r.columnDef.getGroupingValue(e.original),e._groupingValuesCache[n]):e.getValue(n)},e._groupingValuesCache={}},createCell:(e,t,n,r)=>{e.getIsGrouped=()=>t.getIsGrouped()&&t.id===n.groupingColumnId,e.getIsPlaceholder=()=>!e.getIsGrouped()&&t.getIsGrouped(),e.getIsAggregated=()=>{var s;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!((s=n.subRows)!=null&&s.length)}}};function EI(e,t,n){if(!(t!=null&&t.length)||!n)return e;const r=e.filter(o=>!t.includes(o.id));return n==="remove"?r:[...t.map(o=>e.find(i=>i.id===o)).filter(Boolean),...r]}const TI={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:Yt("columnOrder",e)}),createColumn:(e,t)=>{e.getIndex=ee(n=>[Gi(t,n)],n=>n.findIndex(r=>r.id===e.id),te(t.options,"debugColumns")),e.getIsFirstColumn=n=>{var r;return((r=Gi(t,n)[0])==null?void 0:r.id)===e.id},e.getIsLastColumn=n=>{var r;const s=Gi(t,n);return((r=s[s.length-1])==null?void 0:r.id)===e.id}},createTable:e=>{e.setColumnOrder=t=>e.options.onColumnOrderChange==null?void 0:e.options.onColumnOrderChange(t),e.resetColumnOrder=t=>{var n;e.setColumnOrder(t?[]:(n=e.initialState.columnOrder)!=null?n:[])},e._getOrderColumnsFn=ee(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(t,n,r)=>s=>{let o=[];if(!(t!=null&&t.length))o=s;else{const i=[...t],a=[...s];for(;a.length&&i.length;){const l=i.shift(),u=a.findIndex(d=>d.id===l);u>-1&&o.push(a.splice(u,1)[0])}o=[...o,...a]}return EI(o,n,r)},te(e.options,"debugTable"))}},Jd=()=>({left:[],right:[]}),AI={getInitialState:e=>({columnPinning:Jd(),...e}),getDefaultOptions:e=>({onColumnPinningChange:Yt("columnPinning",e)}),createColumn:(e,t)=>{e.pin=n=>{const r=e.getLeafColumns().map(s=>s.id).filter(Boolean);t.setColumnPinning(s=>{var o,i;if(n==="right"){var a,l;return{left:((a=s==null?void 0:s.left)!=null?a:[]).filter(h=>!(r!=null&&r.includes(h))),right:[...((l=s==null?void 0:s.right)!=null?l:[]).filter(h=>!(r!=null&&r.includes(h))),...r]}}if(n==="left"){var u,d;return{left:[...((u=s==null?void 0:s.left)!=null?u:[]).filter(h=>!(r!=null&&r.includes(h))),...r],right:((d=s==null?void 0:s.right)!=null?d:[]).filter(h=>!(r!=null&&r.includes(h)))}}return{left:((o=s==null?void 0:s.left)!=null?o:[]).filter(h=>!(r!=null&&r.includes(h))),right:((i=s==null?void 0:s.right)!=null?i:[]).filter(h=>!(r!=null&&r.includes(h)))}})},e.getCanPin=()=>e.getLeafColumns().some(r=>{var s,o,i;return((s=r.columnDef.enablePinning)!=null?s:!0)&&((o=(i=t.options.enableColumnPinning)!=null?i:t.options.enablePinning)!=null?o:!0)}),e.getIsPinned=()=>{const n=e.getLeafColumns().map(a=>a.id),{left:r,right:s}=t.getState().columnPinning,o=n.some(a=>r==null?void 0:r.includes(a)),i=n.some(a=>s==null?void 0:s.includes(a));return o?"left":i?"right":!1},e.getPinnedIndex=()=>{var n,r;const s=e.getIsPinned();return s?(n=(r=t.getState().columnPinning)==null||(r=r[s])==null?void 0:r.indexOf(e.id))!=null?n:-1:0}},createRow:(e,t)=>{e.getCenterVisibleCells=ee(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left,t.getState().columnPinning.right],(n,r,s)=>{const o=[...r??[],...s??[]];return n.filter(i=>!o.includes(i.column.id))},te(t.options,"debugRows")),e.getLeftVisibleCells=ee(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left],(n,r)=>(r??[]).map(o=>n.find(i=>i.column.id===o)).filter(Boolean).map(o=>({...o,position:"left"})),te(t.options,"debugRows")),e.getRightVisibleCells=ee(()=>[e._getAllVisibleCells(),t.getState().columnPinning.right],(n,r)=>(r??[]).map(o=>n.find(i=>i.column.id===o)).filter(Boolean).map(o=>({...o,position:"right"})),te(t.options,"debugRows"))},createTable:e=>{e.setColumnPinning=t=>e.options.onColumnPinningChange==null?void 0:e.options.onColumnPinningChange(t),e.resetColumnPinning=t=>{var n,r;return e.setColumnPinning(t?Jd():(n=(r=e.initialState)==null?void 0:r.columnPinning)!=null?n:Jd())},e.getIsSomeColumnsPinned=t=>{var n;const r=e.getState().columnPinning;if(!t){var s,o;return!!((s=r.left)!=null&&s.length||(o=r.right)!=null&&o.length)}return!!((n=r[t])!=null&&n.length)},e.getLeftLeafColumns=ee(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(t,n)=>(n??[]).map(r=>t.find(s=>s.id===r)).filter(Boolean),te(e.options,"debugColumns")),e.getRightLeafColumns=ee(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(t,n)=>(n??[]).map(r=>t.find(s=>s.id===r)).filter(Boolean),te(e.options,"debugColumns")),e.getCenterLeafColumns=ee(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r)=>{const s=[...n??[],...r??[]];return t.filter(o=>!s.includes(o.id))},te(e.options,"debugColumns"))}};function MI(e){return e||(typeof document<"u"?document:null)}const Al={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},Zd=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),LI={getDefaultColumnDef:()=>Al,getInitialState:e=>({columnSizing:{},columnSizingInfo:Zd(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:Yt("columnSizing",e),onColumnSizingInfoChange:Yt("columnSizingInfo",e)}),createColumn:(e,t)=>{e.getSize=()=>{var n,r,s;const o=t.getState().columnSizing[e.id];return Math.min(Math.max((n=e.columnDef.minSize)!=null?n:Al.minSize,(r=o??e.columnDef.size)!=null?r:Al.size),(s=e.columnDef.maxSize)!=null?s:Al.maxSize)},e.getStart=ee(n=>[n,Gi(t,n),t.getState().columnSizing],(n,r)=>r.slice(0,e.getIndex(n)).reduce((s,o)=>s+o.getSize(),0),te(t.options,"debugColumns")),e.getAfter=ee(n=>[n,Gi(t,n),t.getState().columnSizing],(n,r)=>r.slice(e.getIndex(n)+1).reduce((s,o)=>s+o.getSize(),0),te(t.options,"debugColumns")),e.resetSize=()=>{t.setColumnSizing(n=>{let{[e.id]:r,...s}=n;return s})},e.getCanResize=()=>{var n,r;return((n=e.columnDef.enableResizing)!=null?n:!0)&&((r=t.options.enableColumnResizing)!=null?r:!0)},e.getIsResizing=()=>t.getState().columnSizingInfo.isResizingColumn===e.id},createHeader:(e,t)=>{e.getSize=()=>{let n=0;const r=s=>{if(s.subHeaders.length)s.subHeaders.forEach(r);else{var o;n+=(o=s.column.getSize())!=null?o:0}};return r(e),n},e.getStart=()=>{if(e.index>0){const n=e.headerGroup.headers[e.index-1];return n.getStart()+n.getSize()}return 0},e.getResizeHandler=n=>{const r=t.getColumn(e.column.id),s=r==null?void 0:r.getCanResize();return o=>{if(!r||!s||(o.persist==null||o.persist(),eh(o)&&o.touches&&o.touches.length>1))return;const i=e.getSize(),a=e?e.getLeafHeaders().map(x=>[x.column.id,x.column.getSize()]):[[r.id,r.getSize()]],l=eh(o)?Math.round(o.touches[0].clientX):o.clientX,u={},d=(x,v)=>{typeof v=="number"&&(t.setColumnSizingInfo(b=>{var k,w;const j=t.options.columnResizeDirection==="rtl"?-1:1,N=(v-((k=b==null?void 0:b.startOffset)!=null?k:0))*j,_=Math.max(N/((w=b==null?void 0:b.startSize)!=null?w:0),-.999999);return b.columnSizingStart.forEach(P=>{let[A,O]=P;u[A]=Math.round(Math.max(O+O*_,0)*100)/100}),{...b,deltaOffset:N,deltaPercentage:_}}),(t.options.columnResizeMode==="onChange"||x==="end")&&t.setColumnSizing(b=>({...b,...u})))},h=x=>d("move",x),f=x=>{d("end",x),t.setColumnSizingInfo(v=>({...v,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},p=MI(n),g={moveHandler:x=>h(x.clientX),upHandler:x=>{p==null||p.removeEventListener("mousemove",g.moveHandler),p==null||p.removeEventListener("mouseup",g.upHandler),f(x.clientX)}},m={moveHandler:x=>(x.cancelable&&(x.preventDefault(),x.stopPropagation()),h(x.touches[0].clientX),!1),upHandler:x=>{var v;p==null||p.removeEventListener("touchmove",m.moveHandler),p==null||p.removeEventListener("touchend",m.upHandler),x.cancelable&&(x.preventDefault(),x.stopPropagation()),f((v=x.touches[0])==null?void 0:v.clientX)}},y=OI()?{passive:!1}:!1;eh(o)?(p==null||p.addEventListener("touchmove",m.moveHandler,y),p==null||p.addEventListener("touchend",m.upHandler,y)):(p==null||p.addEventListener("mousemove",g.moveHandler,y),p==null||p.addEventListener("mouseup",g.upHandler,y)),t.setColumnSizingInfo(x=>({...x,startOffset:l,startSize:i,deltaOffset:0,deltaPercentage:0,columnSizingStart:a,isResizingColumn:r.id}))}}},createTable:e=>{e.setColumnSizing=t=>e.options.onColumnSizingChange==null?void 0:e.options.onColumnSizingChange(t),e.setColumnSizingInfo=t=>e.options.onColumnSizingInfoChange==null?void 0:e.options.onColumnSizingInfoChange(t),e.resetColumnSizing=t=>{var n;e.setColumnSizing(t?{}:(n=e.initialState.columnSizing)!=null?n:{})},e.resetHeaderSizeInfo=t=>{var n;e.setColumnSizingInfo(t?Zd():(n=e.initialState.columnSizingInfo)!=null?n:Zd())},e.getTotalSize=()=>{var t,n;return(t=(n=e.getHeaderGroups()[0])==null?void 0:n.headers.reduce((r,s)=>r+s.getSize(),0))!=null?t:0},e.getLeftTotalSize=()=>{var t,n;return(t=(n=e.getLeftHeaderGroups()[0])==null?void 0:n.headers.reduce((r,s)=>r+s.getSize(),0))!=null?t:0},e.getCenterTotalSize=()=>{var t,n;return(t=(n=e.getCenterHeaderGroups()[0])==null?void 0:n.headers.reduce((r,s)=>r+s.getSize(),0))!=null?t:0},e.getRightTotalSize=()=>{var t,n;return(t=(n=e.getRightHeaderGroups()[0])==null?void 0:n.headers.reduce((r,s)=>r+s.getSize(),0))!=null?t:0}}};let Ml=null;function OI(){if(typeof Ml=="boolean")return Ml;let e=!1;try{const t={get passive(){return e=!0,!1}},n=()=>{};window.addEventListener("test",n,t),window.removeEventListener("test",n)}catch{e=!1}return Ml=e,Ml}function eh(e){return e.type==="touchstart"}const DI={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:Yt("columnVisibility",e)}),createColumn:(e,t)=>{e.toggleVisibility=n=>{e.getCanHide()&&t.setColumnVisibility(r=>({...r,[e.id]:n??!e.getIsVisible()}))},e.getIsVisible=()=>{var n,r;const s=e.columns;return(n=s.length?s.some(o=>o.getIsVisible()):(r=t.getState().columnVisibility)==null?void 0:r[e.id])!=null?n:!0},e.getCanHide=()=>{var n,r;return((n=e.columnDef.enableHiding)!=null?n:!0)&&((r=t.options.enableHiding)!=null?r:!0)},e.getToggleVisibilityHandler=()=>n=>{e.toggleVisibility==null||e.toggleVisibility(n.target.checked)}},createRow:(e,t)=>{e._getAllVisibleCells=ee(()=>[e.getAllCells(),t.getState().columnVisibility],n=>n.filter(r=>r.column.getIsVisible()),te(t.options,"debugRows")),e.getVisibleCells=ee(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(n,r,s)=>[...n,...r,...s],te(t.options,"debugRows"))},createTable:e=>{const t=(n,r)=>ee(()=>[r(),r().filter(s=>s.getIsVisible()).map(s=>s.id).join("_")],s=>s.filter(o=>o.getIsVisible==null?void 0:o.getIsVisible()),te(e.options,"debugColumns"));e.getVisibleFlatColumns=t("getVisibleFlatColumns",()=>e.getAllFlatColumns()),e.getVisibleLeafColumns=t("getVisibleLeafColumns",()=>e.getAllLeafColumns()),e.getLeftVisibleLeafColumns=t("getLeftVisibleLeafColumns",()=>e.getLeftLeafColumns()),e.getRightVisibleLeafColumns=t("getRightVisibleLeafColumns",()=>e.getRightLeafColumns()),e.getCenterVisibleLeafColumns=t("getCenterVisibleLeafColumns",()=>e.getCenterLeafColumns()),e.setColumnVisibility=n=>e.options.onColumnVisibilityChange==null?void 0:e.options.onColumnVisibilityChange(n),e.resetColumnVisibility=n=>{var r;e.setColumnVisibility(n?{}:(r=e.initialState.columnVisibility)!=null?r:{})},e.toggleAllColumnsVisible=n=>{var r;n=(r=n)!=null?r:!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((s,o)=>({...s,[o.id]:n||!(o.getCanHide!=null&&o.getCanHide())}),{}))},e.getIsAllColumnsVisible=()=>!e.getAllLeafColumns().some(n=>!(n.getIsVisible!=null&&n.getIsVisible())),e.getIsSomeColumnsVisible=()=>e.getAllLeafColumns().some(n=>n.getIsVisible==null?void 0:n.getIsVisible()),e.getToggleAllColumnsVisibilityHandler=()=>n=>{var r;e.toggleAllColumnsVisible((r=n.target)==null?void 0:r.checked)}}};function Gi(e,t){return t?t==="center"?e.getCenterVisibleLeafColumns():t==="left"?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}const II={createTable:e=>{e._getGlobalFacetedRowModel=e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,"__global__"),e.getGlobalFacetedRowModel=()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),e._getGlobalFacetedUniqueValues=e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,"__global__"),e.getGlobalFacetedUniqueValues=()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,e._getGlobalFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,"__global__"),e.getGlobalFacetedMinMaxValues=()=>{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}}},FI={getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:Yt("globalFilter",e),globalFilterFn:"auto",getColumnCanGlobalFilter:t=>{var n;const r=(n=e.getCoreRowModel().flatRows[0])==null||(n=n._getAllCellsByColumnId()[t.id])==null?void 0:n.getValue();return typeof r=="string"||typeof r=="number"}}),createColumn:(e,t)=>{e.getCanGlobalFilter=()=>{var n,r,s,o;return((n=e.columnDef.enableGlobalFilter)!=null?n:!0)&&((r=t.options.enableGlobalFilter)!=null?r:!0)&&((s=t.options.enableFilters)!=null?s:!0)&&((o=t.options.getColumnCanGlobalFilter==null?void 0:t.options.getColumnCanGlobalFilter(e))!=null?o:!0)&&!!e.accessorFn}},createTable:e=>{e.getGlobalAutoFilterFn=()=>Un.includesString,e.getGlobalFilterFn=()=>{var t,n;const{globalFilterFn:r}=e.options;return $u(r)?r:r==="auto"?e.getGlobalAutoFilterFn():(t=(n=e.options.filterFns)==null?void 0:n[r])!=null?t:Un[r]},e.setGlobalFilter=t=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(t)},e.resetGlobalFilter=t=>{e.setGlobalFilter(t?void 0:e.initialState.globalFilter)}}},zI={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:Yt("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let t=!1,n=!1;e._autoResetExpanded=()=>{var r,s;if(!t){e._queue(()=>{t=!0});return}if((r=(s=e.options.autoResetAll)!=null?s:e.options.autoResetExpanded)!=null?r:!e.options.manualExpanding){if(n)return;n=!0,e._queue(()=>{e.resetExpanded(),n=!1})}},e.setExpanded=r=>e.options.onExpandedChange==null?void 0:e.options.onExpandedChange(r),e.toggleAllRowsExpanded=r=>{r??!e.getIsAllRowsExpanded()?e.setExpanded(!0):e.setExpanded({})},e.resetExpanded=r=>{var s,o;e.setExpanded(r?{}:(s=(o=e.initialState)==null?void 0:o.expanded)!=null?s:{})},e.getCanSomeRowsExpand=()=>e.getPrePaginationRowModel().flatRows.some(r=>r.getCanExpand()),e.getToggleAllRowsExpandedHandler=()=>r=>{r.persist==null||r.persist(),e.toggleAllRowsExpanded()},e.getIsSomeRowsExpanded=()=>{const r=e.getState().expanded;return r===!0||Object.values(r).some(Boolean)},e.getIsAllRowsExpanded=()=>{const r=e.getState().expanded;return typeof r=="boolean"?r===!0:!(!Object.keys(r).length||e.getRowModel().flatRows.some(s=>!s.getIsExpanded()))},e.getExpandedDepth=()=>{let r=0;return(e.getState().expanded===!0?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(o=>{const i=o.split(".");r=Math.max(r,i.length)}),r},e.getPreExpandedRowModel=()=>e.getSortedRowModel(),e.getExpandedRowModel=()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel?e.getPreExpandedRowModel():e._getExpandedRowModel())},createRow:(e,t)=>{e.toggleExpanded=n=>{t.setExpanded(r=>{var s;const o=r===!0?!0:!!(r!=null&&r[e.id]);let i={};if(r===!0?Object.keys(t.getRowModel().rowsById).forEach(a=>{i[a]=!0}):i=r,n=(s=n)!=null?s:!o,!o&&n)return{...i,[e.id]:!0};if(o&&!n){const{[e.id]:a,...l}=i;return l}return r})},e.getIsExpanded=()=>{var n;const r=t.getState().expanded;return!!((n=t.options.getIsRowExpanded==null?void 0:t.options.getIsRowExpanded(e))!=null?n:r===!0||r!=null&&r[e.id])},e.getCanExpand=()=>{var n,r,s;return(n=t.options.getRowCanExpand==null?void 0:t.options.getRowCanExpand(e))!=null?n:((r=t.options.enableExpanding)!=null?r:!0)&&!!((s=e.subRows)!=null&&s.length)},e.getIsAllParentsExpanded=()=>{let n=!0,r=e;for(;n&&r.parentId;)r=t.getRow(r.parentId,!0),n=r.getIsExpanded();return n},e.getToggleExpandedHandler=()=>{const n=e.getCanExpand();return()=>{n&&e.toggleExpanded()}}}},Vf=0,Bf=10,th=()=>({pageIndex:Vf,pageSize:Bf}),VI={getInitialState:e=>({...e,pagination:{...th(),...e==null?void 0:e.pagination}}),getDefaultOptions:e=>({onPaginationChange:Yt("pagination",e)}),createTable:e=>{let t=!1,n=!1;e._autoResetPageIndex=()=>{var r,s;if(!t){e._queue(()=>{t=!0});return}if((r=(s=e.options.autoResetAll)!=null?s:e.options.autoResetPageIndex)!=null?r:!e.options.manualPagination){if(n)return;n=!0,e._queue(()=>{e.resetPageIndex(),n=!1})}},e.setPagination=r=>{const s=o=>jr(r,o);return e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(s)},e.resetPagination=r=>{var s;e.setPagination(r?th():(s=e.initialState.pagination)!=null?s:th())},e.setPageIndex=r=>{e.setPagination(s=>{let o=jr(r,s.pageIndex);const i=typeof e.options.pageCount>"u"||e.options.pageCount===-1?Number.MAX_SAFE_INTEGER:e.options.pageCount-1;return o=Math.max(0,Math.min(o,i)),{...s,pageIndex:o}})},e.resetPageIndex=r=>{var s,o;e.setPageIndex(r?Vf:(s=(o=e.initialState)==null||(o=o.pagination)==null?void 0:o.pageIndex)!=null?s:Vf)},e.resetPageSize=r=>{var s,o;e.setPageSize(r?Bf:(s=(o=e.initialState)==null||(o=o.pagination)==null?void 0:o.pageSize)!=null?s:Bf)},e.setPageSize=r=>{e.setPagination(s=>{const o=Math.max(1,jr(r,s.pageSize)),i=s.pageSize*s.pageIndex,a=Math.floor(i/o);return{...s,pageIndex:a,pageSize:o}})},e.setPageCount=r=>e.setPagination(s=>{var o;let i=jr(r,(o=e.options.pageCount)!=null?o:-1);return typeof i=="number"&&(i=Math.max(-1,i)),{...s,pageCount:i}}),e.getPageOptions=ee(()=>[e.getPageCount()],r=>{let s=[];return r&&r>0&&(s=[...new Array(r)].fill(null).map((o,i)=>i)),s},te(e.options,"debugTable")),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{const{pageIndex:r}=e.getState().pagination,s=e.getPageCount();return s===-1?!0:s===0?!1:re.setPageIndex(r=>r-1),e.nextPage=()=>e.setPageIndex(r=>r+1),e.firstPage=()=>e.setPageIndex(0),e.lastPage=()=>e.setPageIndex(e.getPageCount()-1),e.getPrePaginationRowModel=()=>e.getExpandedRowModel(),e.getPaginationRowModel=()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel?e.getPrePaginationRowModel():e._getPaginationRowModel()),e.getPageCount=()=>{var r;return(r=e.options.pageCount)!=null?r:Math.ceil(e.getRowCount()/e.getState().pagination.pageSize)},e.getRowCount=()=>{var r;return(r=e.options.rowCount)!=null?r:e.getPrePaginationRowModel().rows.length}}},nh=()=>({top:[],bottom:[]}),BI={getInitialState:e=>({rowPinning:nh(),...e}),getDefaultOptions:e=>({onRowPinningChange:Yt("rowPinning",e)}),createRow:(e,t)=>{e.pin=(n,r,s)=>{const o=r?e.getLeafRows().map(l=>{let{id:u}=l;return u}):[],i=s?e.getParentRows().map(l=>{let{id:u}=l;return u}):[],a=new Set([...i,e.id,...o]);t.setRowPinning(l=>{var u,d;if(n==="bottom"){var h,f;return{top:((h=l==null?void 0:l.top)!=null?h:[]).filter(m=>!(a!=null&&a.has(m))),bottom:[...((f=l==null?void 0:l.bottom)!=null?f:[]).filter(m=>!(a!=null&&a.has(m))),...Array.from(a)]}}if(n==="top"){var p,g;return{top:[...((p=l==null?void 0:l.top)!=null?p:[]).filter(m=>!(a!=null&&a.has(m))),...Array.from(a)],bottom:((g=l==null?void 0:l.bottom)!=null?g:[]).filter(m=>!(a!=null&&a.has(m)))}}return{top:((u=l==null?void 0:l.top)!=null?u:[]).filter(m=>!(a!=null&&a.has(m))),bottom:((d=l==null?void 0:l.bottom)!=null?d:[]).filter(m=>!(a!=null&&a.has(m)))}})},e.getCanPin=()=>{var n;const{enableRowPinning:r,enablePinning:s}=t.options;return typeof r=="function"?r(e):(n=r??s)!=null?n:!0},e.getIsPinned=()=>{const n=[e.id],{top:r,bottom:s}=t.getState().rowPinning,o=n.some(a=>r==null?void 0:r.includes(a)),i=n.some(a=>s==null?void 0:s.includes(a));return o?"top":i?"bottom":!1},e.getPinnedIndex=()=>{var n,r;const s=e.getIsPinned();if(!s)return-1;const o=(n=s==="top"?t.getTopRows():t.getBottomRows())==null?void 0:n.map(i=>{let{id:a}=i;return a});return(r=o==null?void 0:o.indexOf(e.id))!=null?r:-1}},createTable:e=>{e.setRowPinning=t=>e.options.onRowPinningChange==null?void 0:e.options.onRowPinningChange(t),e.resetRowPinning=t=>{var n,r;return e.setRowPinning(t?nh():(n=(r=e.initialState)==null?void 0:r.rowPinning)!=null?n:nh())},e.getIsSomeRowsPinned=t=>{var n;const r=e.getState().rowPinning;if(!t){var s,o;return!!((s=r.top)!=null&&s.length||(o=r.bottom)!=null&&o.length)}return!!((n=r[t])!=null&&n.length)},e._getPinnedRows=(t,n,r)=>{var s;return((s=e.options.keepPinnedRows)==null||s?(n??[]).map(i=>{const a=e.getRow(i,!0);return a.getIsAllParentsExpanded()?a:null}):(n??[]).map(i=>t.find(a=>a.id===i))).filter(Boolean).map(i=>({...i,position:r}))},e.getTopRows=ee(()=>[e.getRowModel().rows,e.getState().rowPinning.top],(t,n)=>e._getPinnedRows(t,n,"top"),te(e.options,"debugRows")),e.getBottomRows=ee(()=>[e.getRowModel().rows,e.getState().rowPinning.bottom],(t,n)=>e._getPinnedRows(t,n,"bottom"),te(e.options,"debugRows")),e.getCenterRows=ee(()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom],(t,n,r)=>{const s=new Set([...n??[],...r??[]]);return t.filter(o=>!s.has(o.id))},te(e.options,"debugRows"))}},$I={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:Yt("rowSelection",e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>{e.setRowSelection=t=>e.options.onRowSelectionChange==null?void 0:e.options.onRowSelectionChange(t),e.resetRowSelection=t=>{var n;return e.setRowSelection(t?{}:(n=e.initialState.rowSelection)!=null?n:{})},e.toggleAllRowsSelected=t=>{e.setRowSelection(n=>{t=typeof t<"u"?t:!e.getIsAllRowsSelected();const r={...n},s=e.getPreGroupedRowModel().flatRows;return t?s.forEach(o=>{o.getCanSelect()&&(r[o.id]=!0)}):s.forEach(o=>{delete r[o.id]}),r})},e.toggleAllPageRowsSelected=t=>e.setRowSelection(n=>{const r=typeof t<"u"?t:!e.getIsAllPageRowsSelected(),s={...n};return e.getRowModel().rows.forEach(o=>{$f(s,o.id,r,!0,e)}),s}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=ee(()=>[e.getState().rowSelection,e.getCoreRowModel()],(t,n)=>Object.keys(t).length?rh(e,n):{rows:[],flatRows:[],rowsById:{}},te(e.options,"debugTable")),e.getFilteredSelectedRowModel=ee(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(t,n)=>Object.keys(t).length?rh(e,n):{rows:[],flatRows:[],rowsById:{}},te(e.options,"debugTable")),e.getGroupedSelectedRowModel=ee(()=>[e.getState().rowSelection,e.getSortedRowModel()],(t,n)=>Object.keys(t).length?rh(e,n):{rows:[],flatRows:[],rowsById:{}},te(e.options,"debugTable")),e.getIsAllRowsSelected=()=>{const t=e.getFilteredRowModel().flatRows,{rowSelection:n}=e.getState();let r=!!(t.length&&Object.keys(n).length);return r&&t.some(s=>s.getCanSelect()&&!n[s.id])&&(r=!1),r},e.getIsAllPageRowsSelected=()=>{const t=e.getPaginationRowModel().flatRows.filter(s=>s.getCanSelect()),{rowSelection:n}=e.getState();let r=!!t.length;return r&&t.some(s=>!n[s.id])&&(r=!1),r},e.getIsSomeRowsSelected=()=>{var t;const n=Object.keys((t=e.getState().rowSelection)!=null?t:{}).length;return n>0&&n{const t=e.getPaginationRowModel().flatRows;return e.getIsAllPageRowsSelected()?!1:t.filter(n=>n.getCanSelect()).some(n=>n.getIsSelected()||n.getIsSomeSelected())},e.getToggleAllRowsSelectedHandler=()=>t=>{e.toggleAllRowsSelected(t.target.checked)},e.getToggleAllPageRowsSelectedHandler=()=>t=>{e.toggleAllPageRowsSelected(t.target.checked)}},createRow:(e,t)=>{e.toggleSelected=(n,r)=>{const s=e.getIsSelected();t.setRowSelection(o=>{var i;if(n=typeof n<"u"?n:!s,e.getCanSelect()&&s===n)return o;const a={...o};return $f(a,e.id,n,(i=r==null?void 0:r.selectChildren)!=null?i:!0,t),a})},e.getIsSelected=()=>{const{rowSelection:n}=t.getState();return Gg(e,n)},e.getIsSomeSelected=()=>{const{rowSelection:n}=t.getState();return Hf(e,n)==="some"},e.getIsAllSubRowsSelected=()=>{const{rowSelection:n}=t.getState();return Hf(e,n)==="all"},e.getCanSelect=()=>{var n;return typeof t.options.enableRowSelection=="function"?t.options.enableRowSelection(e):(n=t.options.enableRowSelection)!=null?n:!0},e.getCanSelectSubRows=()=>{var n;return typeof t.options.enableSubRowSelection=="function"?t.options.enableSubRowSelection(e):(n=t.options.enableSubRowSelection)!=null?n:!0},e.getCanMultiSelect=()=>{var n;return typeof t.options.enableMultiRowSelection=="function"?t.options.enableMultiRowSelection(e):(n=t.options.enableMultiRowSelection)!=null?n:!0},e.getToggleSelectedHandler=()=>{const n=e.getCanSelect();return r=>{var s;n&&e.toggleSelected((s=r.target)==null?void 0:s.checked)}}}},$f=(e,t,n,r,s)=>{var o;const i=s.getRow(t,!0);n?(i.getCanMultiSelect()||Object.keys(e).forEach(a=>delete e[a]),i.getCanSelect()&&(e[t]=!0)):delete e[t],r&&(o=i.subRows)!=null&&o.length&&i.getCanSelectSubRows()&&i.subRows.forEach(a=>$f(e,a.id,n,r,s))};function rh(e,t){const n=e.getState().rowSelection,r=[],s={},o=function(i,a){return i.map(l=>{var u;const d=Gg(l,n);if(d&&(r.push(l),s[l.id]=l),(u=l.subRows)!=null&&u.length&&(l={...l,subRows:o(l.subRows)}),d)return l}).filter(Boolean)};return{rows:o(t.rows),flatRows:r,rowsById:s}}function Gg(e,t){var n;return(n=t[e.id])!=null?n:!1}function Hf(e,t,n){var r;if(!((r=e.subRows)!=null&&r.length))return!1;let s=!0,o=!1;return e.subRows.forEach(i=>{if(!(o&&!s)&&(i.getCanSelect()&&(Gg(i,t)?o=!0:s=!1),i.subRows&&i.subRows.length)){const a=Hf(i,t);a==="all"?o=!0:(a==="some"&&(o=!0),s=!1)}}),s?"all":o?"some":!1}const Uf=/([0-9]+)/gm,HI=(e,t,n)=>FS(Wr(e.getValue(n)).toLowerCase(),Wr(t.getValue(n)).toLowerCase()),UI=(e,t,n)=>FS(Wr(e.getValue(n)),Wr(t.getValue(n))),WI=(e,t,n)=>qg(Wr(e.getValue(n)).toLowerCase(),Wr(t.getValue(n)).toLowerCase()),GI=(e,t,n)=>qg(Wr(e.getValue(n)),Wr(t.getValue(n))),qI=(e,t,n)=>{const r=e.getValue(n),s=t.getValue(n);return r>s?1:rqg(e.getValue(n),t.getValue(n));function qg(e,t){return e===t?0:e>t?1:-1}function Wr(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}function FS(e,t){const n=e.split(Uf).filter(Boolean),r=t.split(Uf).filter(Boolean);for(;n.length&&r.length;){const s=n.shift(),o=r.shift(),i=parseInt(s,10),a=parseInt(o,10),l=[i,a].sort();if(isNaN(l[0])){if(s>o)return 1;if(o>s)return-1;continue}if(isNaN(l[1]))return isNaN(i)?-1:1;if(i>a)return 1;if(a>i)return-1}return n.length-r.length}const mi={alphanumeric:HI,alphanumericCaseSensitive:UI,text:WI,textCaseSensitive:GI,datetime:qI,basic:KI},YI={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:Yt("sorting",e),isMultiSortEvent:t=>t.shiftKey}),createColumn:(e,t)=>{e.getAutoSortingFn=()=>{const n=t.getFilteredRowModel().flatRows.slice(10);let r=!1;for(const s of n){const o=s==null?void 0:s.getValue(e.id);if(Object.prototype.toString.call(o)==="[object Date]")return mi.datetime;if(typeof o=="string"&&(r=!0,o.split(Uf).length>1))return mi.alphanumeric}return r?mi.text:mi.basic},e.getAutoSortDir=()=>{const n=t.getFilteredRowModel().flatRows[0];return typeof(n==null?void 0:n.getValue(e.id))=="string"?"asc":"desc"},e.getSortingFn=()=>{var n,r;if(!e)throw new Error;return $u(e.columnDef.sortingFn)?e.columnDef.sortingFn:e.columnDef.sortingFn==="auto"?e.getAutoSortingFn():(n=(r=t.options.sortingFns)==null?void 0:r[e.columnDef.sortingFn])!=null?n:mi[e.columnDef.sortingFn]},e.toggleSorting=(n,r)=>{const s=e.getNextSortingOrder(),o=typeof n<"u"&&n!==null;t.setSorting(i=>{const a=i==null?void 0:i.find(p=>p.id===e.id),l=i==null?void 0:i.findIndex(p=>p.id===e.id);let u=[],d,h=o?n:s==="desc";if(i!=null&&i.length&&e.getCanMultiSort()&&r?a?d="toggle":d="add":i!=null&&i.length&&l!==i.length-1?d="replace":a?d="toggle":d="replace",d==="toggle"&&(o||s||(d="remove")),d==="add"){var f;u=[...i,{id:e.id,desc:h}],u.splice(0,u.length-((f=t.options.maxMultiSortColCount)!=null?f:Number.MAX_SAFE_INTEGER))}else d==="toggle"?u=i.map(p=>p.id===e.id?{...p,desc:h}:p):d==="remove"?u=i.filter(p=>p.id!==e.id):u=[{id:e.id,desc:h}];return u})},e.getFirstSortDir=()=>{var n,r;return((n=(r=e.columnDef.sortDescFirst)!=null?r:t.options.sortDescFirst)!=null?n:e.getAutoSortDir()==="desc")?"desc":"asc"},e.getNextSortingOrder=n=>{var r,s;const o=e.getFirstSortDir(),i=e.getIsSorted();return i?i!==o&&((r=t.options.enableSortingRemoval)==null||r)&&(!(n&&(s=t.options.enableMultiRemove)!=null)||s)?!1:i==="desc"?"asc":"desc":o},e.getCanSort=()=>{var n,r;return((n=e.columnDef.enableSorting)!=null?n:!0)&&((r=t.options.enableSorting)!=null?r:!0)&&!!e.accessorFn},e.getCanMultiSort=()=>{var n,r;return(n=(r=e.columnDef.enableMultiSort)!=null?r:t.options.enableMultiSort)!=null?n:!!e.accessorFn},e.getIsSorted=()=>{var n;const r=(n=t.getState().sorting)==null?void 0:n.find(s=>s.id===e.id);return r?r.desc?"desc":"asc":!1},e.getSortIndex=()=>{var n,r;return(n=(r=t.getState().sorting)==null?void 0:r.findIndex(s=>s.id===e.id))!=null?n:-1},e.clearSorting=()=>{t.setSorting(n=>n!=null&&n.length?n.filter(r=>r.id!==e.id):[])},e.getToggleSortingHandler=()=>{const n=e.getCanSort();return r=>{n&&(r.persist==null||r.persist(),e.toggleSorting==null||e.toggleSorting(void 0,e.getCanMultiSort()?t.options.isMultiSortEvent==null?void 0:t.options.isMultiSortEvent(r):!1))}}},createTable:e=>{e.setSorting=t=>e.options.onSortingChange==null?void 0:e.options.onSortingChange(t),e.resetSorting=t=>{var n,r;e.setSorting(t?[]:(n=(r=e.initialState)==null?void 0:r.sorting)!=null?n:[])},e.getPreSortedRowModel=()=>e.getGroupedRowModel(),e.getSortedRowModel=()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel?e.getPreSortedRowModel():e._getSortedRowModel())}},XI=[yI,DI,TI,AI,xI,bI,II,FI,YI,RI,zI,VI,BI,$I,LI];function QI(e){var t,n;const r=[...XI,...(t=e._features)!=null?t:[]];let s={_features:r};const o=s._features.reduce((f,p)=>Object.assign(f,p.getDefaultOptions==null?void 0:p.getDefaultOptions(s)),{}),i=f=>s.options.mergeOptions?s.options.mergeOptions(o,f):{...o,...f};let l={...{},...(n=e.initialState)!=null?n:{}};s._features.forEach(f=>{var p;l=(p=f.getInitialState==null?void 0:f.getInitialState(l))!=null?p:l});const u=[];let d=!1;const h={_features:r,options:{...o,...e},initialState:l,_queue:f=>{u.push(f),d||(d=!0,Promise.resolve().then(()=>{for(;u.length;)u.shift()();d=!1}).catch(p=>setTimeout(()=>{throw p})))},reset:()=>{s.setState(s.initialState)},setOptions:f=>{const p=jr(f,s.options);s.options=i(p)},getState:()=>s.options.state,setState:f=>{s.options.onStateChange==null||s.options.onStateChange(f)},_getRowId:(f,p,g)=>{var m;return(m=s.options.getRowId==null?void 0:s.options.getRowId(f,p,g))!=null?m:`${g?[g.id,p].join("."):p}`},getCoreRowModel:()=>(s._getCoreRowModel||(s._getCoreRowModel=s.options.getCoreRowModel(s)),s._getCoreRowModel()),getRowModel:()=>s.getPaginationRowModel(),getRow:(f,p)=>{let g=(p?s.getPrePaginationRowModel():s.getRowModel()).rowsById[f];if(!g&&(g=s.getCoreRowModel().rowsById[f],!g))throw new Error;return g},_getDefaultColumnDef:ee(()=>[s.options.defaultColumn],f=>{var p;return f=(p=f)!=null?p:{},{header:g=>{const m=g.header.column.columnDef;return m.accessorKey?m.accessorKey:m.accessorFn?m.id:null},cell:g=>{var m,y;return(m=(y=g.renderValue())==null||y.toString==null?void 0:y.toString())!=null?m:null},...s._features.reduce((g,m)=>Object.assign(g,m.getDefaultColumnDef==null?void 0:m.getDefaultColumnDef()),{}),...f}},te(e,"debugColumns")),_getColumnDefs:()=>s.options.columns,getAllColumns:ee(()=>[s._getColumnDefs()],f=>{const p=function(g,m,y){return y===void 0&&(y=0),g.map(x=>{const v=mI(s,x,y,m),b=x;return v.columns=b.columns?p(b.columns,v,y+1):[],v})};return p(f)},te(e,"debugColumns")),getAllFlatColumns:ee(()=>[s.getAllColumns()],f=>f.flatMap(p=>p.getFlatColumns()),te(e,"debugColumns")),_getAllFlatColumnsById:ee(()=>[s.getAllFlatColumns()],f=>f.reduce((p,g)=>(p[g.id]=g,p),{}),te(e,"debugColumns")),getAllLeafColumns:ee(()=>[s.getAllColumns(),s._getOrderColumnsFn()],(f,p)=>{let g=f.flatMap(m=>m.getLeafColumns());return p(g)},te(e,"debugColumns")),getColumn:f=>s._getAllFlatColumnsById()[f]};Object.assign(s,h);for(let f=0;fee(()=>[e.options.data],t=>{const n={rows:[],flatRows:[],rowsById:{}},r=function(s,o,i){o===void 0&&(o=0);const a=[];for(let u=0;ue._autoResetPageIndex()))}function ZI(e){const t=[],n=r=>{var s;t.push(r),(s=r.subRows)!=null&&s.length&&r.getIsExpanded()&&r.subRows.forEach(n)};return e.rows.forEach(n),{rows:t,flatRows:e.flatRows,rowsById:e.rowsById}}function e6(e,t,n){return n.options.filterFromLeafRows?t6(e,t,n):n6(e,t,n)}function t6(e,t,n){var r;const s=[],o={},i=(r=n.options.maxLeafRowFilterDepth)!=null?r:100,a=function(l,u){u===void 0&&(u=0);const d=[];for(let f=0;fee(()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter],(t,n,r)=>{if(!t.rows.length||!(n!=null&&n.length)&&!r){for(let f=0;f{var p;const g=e.getColumn(f.id);if(!g)return;const m=g.getFilterFn();m&&s.push({id:f.id,filterFn:m,resolvedValue:(p=m.resolveFilterValue==null?void 0:m.resolveFilterValue(f.value))!=null?p:f.value})});const i=(n??[]).map(f=>f.id),a=e.getGlobalFilterFn(),l=e.getAllLeafColumns().filter(f=>f.getCanGlobalFilter());r&&a&&l.length&&(i.push("__global__"),l.forEach(f=>{var p;o.push({id:f.id,filterFn:a,resolvedValue:(p=a.resolveFilterValue==null?void 0:a.resolveFilterValue(r))!=null?p:r})}));let u,d;for(let f=0;f{p.columnFiltersMeta[m]=y})}if(o.length){for(let g=0;g{p.columnFiltersMeta[m]=y})){p.columnFilters.__global__=!0;break}}p.columnFilters.__global__!==!0&&(p.columnFilters.__global__=!1)}}const h=f=>{for(let p=0;pe._autoResetPageIndex()))}function s6(e){return t=>ee(()=>[t.getState().pagination,t.getPrePaginationRowModel(),t.options.paginateExpandedRows?void 0:t.getState().expanded],(n,r)=>{if(!r.rows.length)return r;const{pageSize:s,pageIndex:o}=n;let{rows:i,flatRows:a,rowsById:l}=r;const u=s*o,d=u+s;i=i.slice(u,d);let h;t.options.paginateExpandedRows?h={rows:i,flatRows:a,rowsById:l}:h=ZI({rows:i,flatRows:a,rowsById:l}),h.flatRows=[];const f=p=>{h.flatRows.push(p),p.subRows.length&&p.subRows.forEach(f)};return h.rows.forEach(f),h},te(t.options,"debugTable"))}function o6(){return e=>ee(()=>[e.getState().sorting,e.getPreSortedRowModel()],(t,n)=>{if(!n.rows.length||!(t!=null&&t.length))return n;const r=e.getState().sorting,s=[],o=r.filter(l=>{var u;return(u=e.getColumn(l.id))==null?void 0:u.getCanSort()}),i={};o.forEach(l=>{const u=e.getColumn(l.id);u&&(i[l.id]={sortUndefined:u.columnDef.sortUndefined,invertSorting:u.columnDef.invertSorting,sortingFn:u.getSortingFn()})});const a=l=>{const u=l.map(d=>({...d}));return u.sort((d,h)=>{for(let p=0;p{var h;s.push(d),(h=d.subRows)!=null&&h.length&&(d.subRows=a(d.subRows))}),u};return{rows:a(n.rows),flatRows:s,rowsById:n.rowsById}},te(e.options,"debugTable","getSortedRowModel",()=>e._autoResetPageIndex()))}/** + color: hsl(${Math.max(0,Math.min(120-120*f,120))}deg 100% 31%);`,n==null?void 0:n.key)}return s}}function te(e,t,n,r){return{debug:()=>{var s;return(s=e==null?void 0:e.debugAll)!=null?s:e[t]},key:!1,onChange:r}}function gI(e,t,n,r){const s=()=>{var i;return(i=o.getValue())!=null?i:e.options.renderFallbackValue},o={id:`${t.id}_${n.id}`,row:t,column:n,getValue:()=>t.getValue(r),renderValue:s,getContext:ee(()=>[e,n,t,o],(i,a,l,u)=>({table:i,column:a,row:l,cell:u,getValue:u.getValue,renderValue:u.renderValue}),te(e.options,"debugCells"))};return e._features.forEach(i=>{i.createCell==null||i.createCell(o,n,t,e)},{}),o}function mI(e,t,n,r){var s,o;const a={...e._getDefaultColumnDef(),...t},l=a.accessorKey;let u=(s=(o=a.id)!=null?o:l?typeof String.prototype.replaceAll=="function"?l.replaceAll(".","_"):l.replace(/\./g,"_"):void 0)!=null?s:typeof a.header=="string"?a.header:void 0,d;if(a.accessorFn?d=a.accessorFn:l&&(l.includes(".")?d=f=>{let p=f;for(const m of l.split(".")){var g;p=(g=p)==null?void 0:g[m]}return p}:d=f=>f[a.accessorKey]),!u)throw new Error;let h={id:`${String(u)}`,accessorFn:d,parent:r,depth:n,columnDef:a,columns:[],getFlatColumns:ee(()=>[!0],()=>{var f;return[h,...(f=h.columns)==null?void 0:f.flatMap(p=>p.getFlatColumns())]},te(e.options,"debugColumns")),getLeafColumns:ee(()=>[e._getOrderColumnsFn()],f=>{var p;if((p=h.columns)!=null&&p.length){let g=h.columns.flatMap(m=>m.getLeafColumns());return f(g)}return[h]},te(e.options,"debugColumns"))};for(const f of e._features)f.createColumn==null||f.createColumn(h,e);return h}const ht="debugHeaders";function Sb(e,t,n){var r;let o={id:(r=n.id)!=null?r:t.id,column:t,index:n.index,isPlaceholder:!!n.isPlaceholder,placeholderId:n.placeholderId,depth:n.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const i=[],a=l=>{l.subHeaders&&l.subHeaders.length&&l.subHeaders.map(a),i.push(l)};return a(o),i},getContext:()=>({table:e,header:o,column:t})};return e._features.forEach(i=>{i.createHeader==null||i.createHeader(o,e)}),o}const yI={createTable:e=>{e.getHeaderGroups=ee(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,s)=>{var o,i;const a=(o=r==null?void 0:r.map(h=>n.find(f=>f.id===h)).filter(Boolean))!=null?o:[],l=(i=s==null?void 0:s.map(h=>n.find(f=>f.id===h)).filter(Boolean))!=null?i:[],u=n.filter(h=>!(r!=null&&r.includes(h.id))&&!(s!=null&&s.includes(h.id)));return Tl(t,[...a,...u,...l],e)},te(e.options,ht)),e.getCenterHeaderGroups=ee(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,s)=>(n=n.filter(o=>!(r!=null&&r.includes(o.id))&&!(s!=null&&s.includes(o.id))),Tl(t,n,e,"center")),te(e.options,ht)),e.getLeftHeaderGroups=ee(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(t,n,r)=>{var s;const o=(s=r==null?void 0:r.map(i=>n.find(a=>a.id===i)).filter(Boolean))!=null?s:[];return Tl(t,o,e,"left")},te(e.options,ht)),e.getRightHeaderGroups=ee(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(t,n,r)=>{var s;const o=(s=r==null?void 0:r.map(i=>n.find(a=>a.id===i)).filter(Boolean))!=null?s:[];return Tl(t,o,e,"right")},te(e.options,ht)),e.getFooterGroups=ee(()=>[e.getHeaderGroups()],t=>[...t].reverse(),te(e.options,ht)),e.getLeftFooterGroups=ee(()=>[e.getLeftHeaderGroups()],t=>[...t].reverse(),te(e.options,ht)),e.getCenterFooterGroups=ee(()=>[e.getCenterHeaderGroups()],t=>[...t].reverse(),te(e.options,ht)),e.getRightFooterGroups=ee(()=>[e.getRightHeaderGroups()],t=>[...t].reverse(),te(e.options,ht)),e.getFlatHeaders=ee(()=>[e.getHeaderGroups()],t=>t.map(n=>n.headers).flat(),te(e.options,ht)),e.getLeftFlatHeaders=ee(()=>[e.getLeftHeaderGroups()],t=>t.map(n=>n.headers).flat(),te(e.options,ht)),e.getCenterFlatHeaders=ee(()=>[e.getCenterHeaderGroups()],t=>t.map(n=>n.headers).flat(),te(e.options,ht)),e.getRightFlatHeaders=ee(()=>[e.getRightHeaderGroups()],t=>t.map(n=>n.headers).flat(),te(e.options,ht)),e.getCenterLeafHeaders=ee(()=>[e.getCenterFlatHeaders()],t=>t.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),te(e.options,ht)),e.getLeftLeafHeaders=ee(()=>[e.getLeftFlatHeaders()],t=>t.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),te(e.options,ht)),e.getRightLeafHeaders=ee(()=>[e.getRightFlatHeaders()],t=>t.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),te(e.options,ht)),e.getLeafHeaders=ee(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(t,n,r)=>{var s,o,i,a,l,u;return[...(s=(o=t[0])==null?void 0:o.headers)!=null?s:[],...(i=(a=n[0])==null?void 0:a.headers)!=null?i:[],...(l=(u=r[0])==null?void 0:u.headers)!=null?l:[]].map(d=>d.getLeafHeaders()).flat()},te(e.options,ht))}};function Tl(e,t,n,r){var s,o;let i=0;const a=function(f,p){p===void 0&&(p=1),i=Math.max(i,p),f.filter(g=>g.getIsVisible()).forEach(g=>{var m;(m=g.columns)!=null&&m.length&&a(g.columns,p+1)},0)};a(e);let l=[];const u=(f,p)=>{const g={depth:p,id:[r,`${p}`].filter(Boolean).join("_"),headers:[]},m=[];f.forEach(y=>{const x=[...m].reverse()[0],v=y.column.depth===g.depth;let b,k=!1;if(v&&y.column.parent?b=y.column.parent:(b=y.column,k=!0),x&&(x==null?void 0:x.column)===b)x.subHeaders.push(y);else{const w=Sb(n,b,{id:[r,p,b.id,y==null?void 0:y.id].filter(Boolean).join("_"),isPlaceholder:k,placeholderId:k?`${m.filter(j=>j.column===b).length}`:void 0,depth:p,index:m.length});w.subHeaders.push(y),m.push(w)}g.headers.push(y),y.headerGroup=g}),l.push(g),p>0&&u(m,p-1)},d=t.map((f,p)=>Sb(n,f,{depth:i,index:p}));u(d,i-1),l.reverse();const h=f=>f.filter(g=>g.column.getIsVisible()).map(g=>{let m=0,y=0,x=[0];g.subHeaders&&g.subHeaders.length?(x=[],h(g.subHeaders).forEach(b=>{let{colSpan:k,rowSpan:w}=b;m+=k,x.push(w)})):m=1;const v=Math.min(...x);return y=y+v,g.colSpan=m,g.rowSpan=y,{colSpan:m,rowSpan:y}});return h((s=(o=l[0])==null?void 0:o.headers)!=null?s:[]),l}const Ug=(e,t,n,r,s,o,i)=>{let a={id:t,index:r,original:n,depth:s,parentId:i,_valuesCache:{},_uniqueValuesCache:{},getValue:l=>{if(a._valuesCache.hasOwnProperty(l))return a._valuesCache[l];const u=e.getColumn(l);if(u!=null&&u.accessorFn)return a._valuesCache[l]=u.accessorFn(a.original,r),a._valuesCache[l]},getUniqueValues:l=>{if(a._uniqueValuesCache.hasOwnProperty(l))return a._uniqueValuesCache[l];const u=e.getColumn(l);if(u!=null&&u.accessorFn)return u.columnDef.getUniqueValues?(a._uniqueValuesCache[l]=u.columnDef.getUniqueValues(a.original,r),a._uniqueValuesCache[l]):(a._uniqueValuesCache[l]=[a.getValue(l)],a._uniqueValuesCache[l])},renderValue:l=>{var u;return(u=a.getValue(l))!=null?u:e.options.renderFallbackValue},subRows:[],getLeafRows:()=>pI(a.subRows,l=>l.subRows),getParentRow:()=>a.parentId?e.getRow(a.parentId,!0):void 0,getParentRows:()=>{let l=[],u=a;for(;;){const d=u.getParentRow();if(!d)break;l.push(d),u=d}return l.reverse()},getAllCells:ee(()=>[e.getAllLeafColumns()],l=>l.map(u=>gI(e,a,u,u.id)),te(e.options,"debugRows")),_getAllCellsByColumnId:ee(()=>[a.getAllCells()],l=>l.reduce((u,d)=>(u[d.column.id]=d,u),{}),te(e.options,"debugRows"))};for(let l=0;l{e._getFacetedRowModel=t.options.getFacetedRowModel&&t.options.getFacetedRowModel(t,e.id),e.getFacetedRowModel=()=>e._getFacetedRowModel?e._getFacetedRowModel():t.getPreFilteredRowModel(),e._getFacetedUniqueValues=t.options.getFacetedUniqueValues&&t.options.getFacetedUniqueValues(t,e.id),e.getFacetedUniqueValues=()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,e._getFacetedMinMaxValues=t.options.getFacetedMinMaxValues&&t.options.getFacetedMinMaxValues(t,e.id),e.getFacetedMinMaxValues=()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}}},ES=(e,t,n)=>{var r,s;const o=n==null||(r=n.toString())==null?void 0:r.toLowerCase();return!!(!((s=e.getValue(t))==null||(s=s.toString())==null||(s=s.toLowerCase())==null)&&s.includes(o))};ES.autoRemove=e=>kn(e);const TS=(e,t,n)=>{var r;return!!(!((r=e.getValue(t))==null||(r=r.toString())==null)&&r.includes(n))};TS.autoRemove=e=>kn(e);const AS=(e,t,n)=>{var r;return((r=e.getValue(t))==null||(r=r.toString())==null?void 0:r.toLowerCase())===(n==null?void 0:n.toLowerCase())};AS.autoRemove=e=>kn(e);const MS=(e,t,n)=>{var r;return(r=e.getValue(t))==null?void 0:r.includes(n)};MS.autoRemove=e=>kn(e);const LS=(e,t,n)=>!n.some(r=>{var s;return!((s=e.getValue(t))!=null&&s.includes(r))});LS.autoRemove=e=>kn(e)||!(e!=null&&e.length);const OS=(e,t,n)=>n.some(r=>{var s;return(s=e.getValue(t))==null?void 0:s.includes(r)});OS.autoRemove=e=>kn(e)||!(e!=null&&e.length);const DS=(e,t,n)=>e.getValue(t)===n;DS.autoRemove=e=>kn(e);const IS=(e,t,n)=>e.getValue(t)==n;IS.autoRemove=e=>kn(e);const Wg=(e,t,n)=>{let[r,s]=n;const o=e.getValue(t);return o>=r&&o<=s};Wg.resolveFilterValue=e=>{let[t,n]=e,r=typeof t!="number"?parseFloat(t):t,s=typeof n!="number"?parseFloat(n):n,o=t===null||Number.isNaN(r)?-1/0:r,i=n===null||Number.isNaN(s)?1/0:s;if(o>i){const a=o;o=i,i=a}return[o,i]};Wg.autoRemove=e=>kn(e)||kn(e[0])&&kn(e[1]);const Un={includesString:ES,includesStringSensitive:TS,equalsString:AS,arrIncludes:MS,arrIncludesAll:LS,arrIncludesSome:OS,equals:DS,weakEquals:IS,inNumberRange:Wg};function kn(e){return e==null||e===""}const bI={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:Yt("columnFilters",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(e,t)=>{e.getAutoFilterFn=()=>{const n=t.getCoreRowModel().flatRows[0],r=n==null?void 0:n.getValue(e.id);return typeof r=="string"?Un.includesString:typeof r=="number"?Un.inNumberRange:typeof r=="boolean"||r!==null&&typeof r=="object"?Un.equals:Array.isArray(r)?Un.arrIncludes:Un.weakEquals},e.getFilterFn=()=>{var n,r;return $u(e.columnDef.filterFn)?e.columnDef.filterFn:e.columnDef.filterFn==="auto"?e.getAutoFilterFn():(n=(r=t.options.filterFns)==null?void 0:r[e.columnDef.filterFn])!=null?n:Un[e.columnDef.filterFn]},e.getCanFilter=()=>{var n,r,s;return((n=e.columnDef.enableColumnFilter)!=null?n:!0)&&((r=t.options.enableColumnFilters)!=null?r:!0)&&((s=t.options.enableFilters)!=null?s:!0)&&!!e.accessorFn},e.getIsFiltered=()=>e.getFilterIndex()>-1,e.getFilterValue=()=>{var n;return(n=t.getState().columnFilters)==null||(n=n.find(r=>r.id===e.id))==null?void 0:n.value},e.getFilterIndex=()=>{var n,r;return(n=(r=t.getState().columnFilters)==null?void 0:r.findIndex(s=>s.id===e.id))!=null?n:-1},e.setFilterValue=n=>{t.setColumnFilters(r=>{const s=e.getFilterFn(),o=r==null?void 0:r.find(d=>d.id===e.id),i=jr(n,o?o.value:void 0);if(_b(s,i,e)){var a;return(a=r==null?void 0:r.filter(d=>d.id!==e.id))!=null?a:[]}const l={id:e.id,value:i};if(o){var u;return(u=r==null?void 0:r.map(d=>d.id===e.id?l:d))!=null?u:[]}return r!=null&&r.length?[...r,l]:[l]})}},createRow:(e,t)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.setColumnFilters=t=>{const n=e.getAllLeafColumns(),r=s=>{var o;return(o=jr(t,s))==null?void 0:o.filter(i=>{const a=n.find(l=>l.id===i.id);if(a){const l=a.getFilterFn();if(_b(l,i.value,a))return!1}return!0})};e.options.onColumnFiltersChange==null||e.options.onColumnFiltersChange(r)},e.resetColumnFilters=t=>{var n,r;e.setColumnFilters(t?[]:(n=(r=e.initialState)==null?void 0:r.columnFilters)!=null?n:[])},e.getPreFilteredRowModel=()=>e.getCoreRowModel(),e.getFilteredRowModel=()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel?e.getPreFilteredRowModel():e._getFilteredRowModel())}};function _b(e,t,n){return(e&&e.autoRemove?e.autoRemove(t,n):!1)||typeof t>"u"||typeof t=="string"&&!t}const vI=(e,t,n)=>n.reduce((r,s)=>{const o=s.getValue(e);return r+(typeof o=="number"?o:0)},0),wI=(e,t,n)=>{let r;return n.forEach(s=>{const o=s.getValue(e);o!=null&&(r>o||r===void 0&&o>=o)&&(r=o)}),r},kI=(e,t,n)=>{let r;return n.forEach(s=>{const o=s.getValue(e);o!=null&&(r=o)&&(r=o)}),r},SI=(e,t,n)=>{let r,s;return n.forEach(o=>{const i=o.getValue(e);i!=null&&(r===void 0?i>=i&&(r=s=i):(r>i&&(r=i),s{let n=0,r=0;if(t.forEach(s=>{let o=s.getValue(e);o!=null&&(o=+o)>=o&&(++n,r+=o)}),n)return r/n},jI=(e,t)=>{if(!t.length)return;const n=t.map(o=>o.getValue(e));if(!fI(n))return;if(n.length===1)return n[0];const r=Math.floor(n.length/2),s=n.sort((o,i)=>o-i);return n.length%2!==0?s[r]:(s[r-1]+s[r])/2},CI=(e,t)=>Array.from(new Set(t.map(n=>n.getValue(e))).values()),NI=(e,t)=>new Set(t.map(n=>n.getValue(e))).size,PI=(e,t)=>t.length,Qd={sum:vI,min:wI,max:kI,extent:SI,mean:_I,median:jI,unique:CI,uniqueCount:NI,count:PI},RI={getDefaultColumnDef:()=>({aggregatedCell:e=>{var t,n;return(t=(n=e.getValue())==null||n.toString==null?void 0:n.toString())!=null?t:null},aggregationFn:"auto"}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:Yt("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,t)=>{e.toggleGrouping=()=>{t.setGrouping(n=>n!=null&&n.includes(e.id)?n.filter(r=>r!==e.id):[...n??[],e.id])},e.getCanGroup=()=>{var n,r;return((n=e.columnDef.enableGrouping)!=null?n:!0)&&((r=t.options.enableGrouping)!=null?r:!0)&&(!!e.accessorFn||!!e.columnDef.getGroupingValue)},e.getIsGrouped=()=>{var n;return(n=t.getState().grouping)==null?void 0:n.includes(e.id)},e.getGroupedIndex=()=>{var n;return(n=t.getState().grouping)==null?void 0:n.indexOf(e.id)},e.getToggleGroupingHandler=()=>{const n=e.getCanGroup();return()=>{n&&e.toggleGrouping()}},e.getAutoAggregationFn=()=>{const n=t.getCoreRowModel().flatRows[0],r=n==null?void 0:n.getValue(e.id);if(typeof r=="number")return Qd.sum;if(Object.prototype.toString.call(r)==="[object Date]")return Qd.extent},e.getAggregationFn=()=>{var n,r;if(!e)throw new Error;return $u(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:e.columnDef.aggregationFn==="auto"?e.getAutoAggregationFn():(n=(r=t.options.aggregationFns)==null?void 0:r[e.columnDef.aggregationFn])!=null?n:Qd[e.columnDef.aggregationFn]}},createTable:e=>{e.setGrouping=t=>e.options.onGroupingChange==null?void 0:e.options.onGroupingChange(t),e.resetGrouping=t=>{var n,r;e.setGrouping(t?[]:(n=(r=e.initialState)==null?void 0:r.grouping)!=null?n:[])},e.getPreGroupedRowModel=()=>e.getFilteredRowModel(),e.getGroupedRowModel=()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel?e.getPreGroupedRowModel():e._getGroupedRowModel())},createRow:(e,t)=>{e.getIsGrouped=()=>!!e.groupingColumnId,e.getGroupingValue=n=>{if(e._groupingValuesCache.hasOwnProperty(n))return e._groupingValuesCache[n];const r=t.getColumn(n);return r!=null&&r.columnDef.getGroupingValue?(e._groupingValuesCache[n]=r.columnDef.getGroupingValue(e.original),e._groupingValuesCache[n]):e.getValue(n)},e._groupingValuesCache={}},createCell:(e,t,n,r)=>{e.getIsGrouped=()=>t.getIsGrouped()&&t.id===n.groupingColumnId,e.getIsPlaceholder=()=>!e.getIsGrouped()&&t.getIsGrouped(),e.getIsAggregated=()=>{var s;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!((s=n.subRows)!=null&&s.length)}}};function EI(e,t,n){if(!(t!=null&&t.length)||!n)return e;const r=e.filter(o=>!t.includes(o.id));return n==="remove"?r:[...t.map(o=>e.find(i=>i.id===o)).filter(Boolean),...r]}const TI={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:Yt("columnOrder",e)}),createColumn:(e,t)=>{e.getIndex=ee(n=>[Gi(t,n)],n=>n.findIndex(r=>r.id===e.id),te(t.options,"debugColumns")),e.getIsFirstColumn=n=>{var r;return((r=Gi(t,n)[0])==null?void 0:r.id)===e.id},e.getIsLastColumn=n=>{var r;const s=Gi(t,n);return((r=s[s.length-1])==null?void 0:r.id)===e.id}},createTable:e=>{e.setColumnOrder=t=>e.options.onColumnOrderChange==null?void 0:e.options.onColumnOrderChange(t),e.resetColumnOrder=t=>{var n;e.setColumnOrder(t?[]:(n=e.initialState.columnOrder)!=null?n:[])},e._getOrderColumnsFn=ee(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(t,n,r)=>s=>{let o=[];if(!(t!=null&&t.length))o=s;else{const i=[...t],a=[...s];for(;a.length&&i.length;){const l=i.shift(),u=a.findIndex(d=>d.id===l);u>-1&&o.push(a.splice(u,1)[0])}o=[...o,...a]}return EI(o,n,r)},te(e.options,"debugTable"))}},Jd=()=>({left:[],right:[]}),AI={getInitialState:e=>({columnPinning:Jd(),...e}),getDefaultOptions:e=>({onColumnPinningChange:Yt("columnPinning",e)}),createColumn:(e,t)=>{e.pin=n=>{const r=e.getLeafColumns().map(s=>s.id).filter(Boolean);t.setColumnPinning(s=>{var o,i;if(n==="right"){var a,l;return{left:((a=s==null?void 0:s.left)!=null?a:[]).filter(h=>!(r!=null&&r.includes(h))),right:[...((l=s==null?void 0:s.right)!=null?l:[]).filter(h=>!(r!=null&&r.includes(h))),...r]}}if(n==="left"){var u,d;return{left:[...((u=s==null?void 0:s.left)!=null?u:[]).filter(h=>!(r!=null&&r.includes(h))),...r],right:((d=s==null?void 0:s.right)!=null?d:[]).filter(h=>!(r!=null&&r.includes(h)))}}return{left:((o=s==null?void 0:s.left)!=null?o:[]).filter(h=>!(r!=null&&r.includes(h))),right:((i=s==null?void 0:s.right)!=null?i:[]).filter(h=>!(r!=null&&r.includes(h)))}})},e.getCanPin=()=>e.getLeafColumns().some(r=>{var s,o,i;return((s=r.columnDef.enablePinning)!=null?s:!0)&&((o=(i=t.options.enableColumnPinning)!=null?i:t.options.enablePinning)!=null?o:!0)}),e.getIsPinned=()=>{const n=e.getLeafColumns().map(a=>a.id),{left:r,right:s}=t.getState().columnPinning,o=n.some(a=>r==null?void 0:r.includes(a)),i=n.some(a=>s==null?void 0:s.includes(a));return o?"left":i?"right":!1},e.getPinnedIndex=()=>{var n,r;const s=e.getIsPinned();return s?(n=(r=t.getState().columnPinning)==null||(r=r[s])==null?void 0:r.indexOf(e.id))!=null?n:-1:0}},createRow:(e,t)=>{e.getCenterVisibleCells=ee(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left,t.getState().columnPinning.right],(n,r,s)=>{const o=[...r??[],...s??[]];return n.filter(i=>!o.includes(i.column.id))},te(t.options,"debugRows")),e.getLeftVisibleCells=ee(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left],(n,r)=>(r??[]).map(o=>n.find(i=>i.column.id===o)).filter(Boolean).map(o=>({...o,position:"left"})),te(t.options,"debugRows")),e.getRightVisibleCells=ee(()=>[e._getAllVisibleCells(),t.getState().columnPinning.right],(n,r)=>(r??[]).map(o=>n.find(i=>i.column.id===o)).filter(Boolean).map(o=>({...o,position:"right"})),te(t.options,"debugRows"))},createTable:e=>{e.setColumnPinning=t=>e.options.onColumnPinningChange==null?void 0:e.options.onColumnPinningChange(t),e.resetColumnPinning=t=>{var n,r;return e.setColumnPinning(t?Jd():(n=(r=e.initialState)==null?void 0:r.columnPinning)!=null?n:Jd())},e.getIsSomeColumnsPinned=t=>{var n;const r=e.getState().columnPinning;if(!t){var s,o;return!!((s=r.left)!=null&&s.length||(o=r.right)!=null&&o.length)}return!!((n=r[t])!=null&&n.length)},e.getLeftLeafColumns=ee(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(t,n)=>(n??[]).map(r=>t.find(s=>s.id===r)).filter(Boolean),te(e.options,"debugColumns")),e.getRightLeafColumns=ee(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(t,n)=>(n??[]).map(r=>t.find(s=>s.id===r)).filter(Boolean),te(e.options,"debugColumns")),e.getCenterLeafColumns=ee(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r)=>{const s=[...n??[],...r??[]];return t.filter(o=>!s.includes(o.id))},te(e.options,"debugColumns"))}};function MI(e){return e||(typeof document<"u"?document:null)}const Al={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},Zd=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),LI={getDefaultColumnDef:()=>Al,getInitialState:e=>({columnSizing:{},columnSizingInfo:Zd(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:Yt("columnSizing",e),onColumnSizingInfoChange:Yt("columnSizingInfo",e)}),createColumn:(e,t)=>{e.getSize=()=>{var n,r,s;const o=t.getState().columnSizing[e.id];return Math.min(Math.max((n=e.columnDef.minSize)!=null?n:Al.minSize,(r=o??e.columnDef.size)!=null?r:Al.size),(s=e.columnDef.maxSize)!=null?s:Al.maxSize)},e.getStart=ee(n=>[n,Gi(t,n),t.getState().columnSizing],(n,r)=>r.slice(0,e.getIndex(n)).reduce((s,o)=>s+o.getSize(),0),te(t.options,"debugColumns")),e.getAfter=ee(n=>[n,Gi(t,n),t.getState().columnSizing],(n,r)=>r.slice(e.getIndex(n)+1).reduce((s,o)=>s+o.getSize(),0),te(t.options,"debugColumns")),e.resetSize=()=>{t.setColumnSizing(n=>{let{[e.id]:r,...s}=n;return s})},e.getCanResize=()=>{var n,r;return((n=e.columnDef.enableResizing)!=null?n:!0)&&((r=t.options.enableColumnResizing)!=null?r:!0)},e.getIsResizing=()=>t.getState().columnSizingInfo.isResizingColumn===e.id},createHeader:(e,t)=>{e.getSize=()=>{let n=0;const r=s=>{if(s.subHeaders.length)s.subHeaders.forEach(r);else{var o;n+=(o=s.column.getSize())!=null?o:0}};return r(e),n},e.getStart=()=>{if(e.index>0){const n=e.headerGroup.headers[e.index-1];return n.getStart()+n.getSize()}return 0},e.getResizeHandler=n=>{const r=t.getColumn(e.column.id),s=r==null?void 0:r.getCanResize();return o=>{if(!r||!s||(o.persist==null||o.persist(),eh(o)&&o.touches&&o.touches.length>1))return;const i=e.getSize(),a=e?e.getLeafHeaders().map(x=>[x.column.id,x.column.getSize()]):[[r.id,r.getSize()]],l=eh(o)?Math.round(o.touches[0].clientX):o.clientX,u={},d=(x,v)=>{typeof v=="number"&&(t.setColumnSizingInfo(b=>{var k,w;const j=t.options.columnResizeDirection==="rtl"?-1:1,N=(v-((k=b==null?void 0:b.startOffset)!=null?k:0))*j,_=Math.max(N/((w=b==null?void 0:b.startSize)!=null?w:0),-.999999);return b.columnSizingStart.forEach(P=>{let[A,O]=P;u[A]=Math.round(Math.max(O+O*_,0)*100)/100}),{...b,deltaOffset:N,deltaPercentage:_}}),(t.options.columnResizeMode==="onChange"||x==="end")&&t.setColumnSizing(b=>({...b,...u})))},h=x=>d("move",x),f=x=>{d("end",x),t.setColumnSizingInfo(v=>({...v,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},p=MI(n),g={moveHandler:x=>h(x.clientX),upHandler:x=>{p==null||p.removeEventListener("mousemove",g.moveHandler),p==null||p.removeEventListener("mouseup",g.upHandler),f(x.clientX)}},m={moveHandler:x=>(x.cancelable&&(x.preventDefault(),x.stopPropagation()),h(x.touches[0].clientX),!1),upHandler:x=>{var v;p==null||p.removeEventListener("touchmove",m.moveHandler),p==null||p.removeEventListener("touchend",m.upHandler),x.cancelable&&(x.preventDefault(),x.stopPropagation()),f((v=x.touches[0])==null?void 0:v.clientX)}},y=OI()?{passive:!1}:!1;eh(o)?(p==null||p.addEventListener("touchmove",m.moveHandler,y),p==null||p.addEventListener("touchend",m.upHandler,y)):(p==null||p.addEventListener("mousemove",g.moveHandler,y),p==null||p.addEventListener("mouseup",g.upHandler,y)),t.setColumnSizingInfo(x=>({...x,startOffset:l,startSize:i,deltaOffset:0,deltaPercentage:0,columnSizingStart:a,isResizingColumn:r.id}))}}},createTable:e=>{e.setColumnSizing=t=>e.options.onColumnSizingChange==null?void 0:e.options.onColumnSizingChange(t),e.setColumnSizingInfo=t=>e.options.onColumnSizingInfoChange==null?void 0:e.options.onColumnSizingInfoChange(t),e.resetColumnSizing=t=>{var n;e.setColumnSizing(t?{}:(n=e.initialState.columnSizing)!=null?n:{})},e.resetHeaderSizeInfo=t=>{var n;e.setColumnSizingInfo(t?Zd():(n=e.initialState.columnSizingInfo)!=null?n:Zd())},e.getTotalSize=()=>{var t,n;return(t=(n=e.getHeaderGroups()[0])==null?void 0:n.headers.reduce((r,s)=>r+s.getSize(),0))!=null?t:0},e.getLeftTotalSize=()=>{var t,n;return(t=(n=e.getLeftHeaderGroups()[0])==null?void 0:n.headers.reduce((r,s)=>r+s.getSize(),0))!=null?t:0},e.getCenterTotalSize=()=>{var t,n;return(t=(n=e.getCenterHeaderGroups()[0])==null?void 0:n.headers.reduce((r,s)=>r+s.getSize(),0))!=null?t:0},e.getRightTotalSize=()=>{var t,n;return(t=(n=e.getRightHeaderGroups()[0])==null?void 0:n.headers.reduce((r,s)=>r+s.getSize(),0))!=null?t:0}}};let Ml=null;function OI(){if(typeof Ml=="boolean")return Ml;let e=!1;try{const t={get passive(){return e=!0,!1}},n=()=>{};window.addEventListener("test",n,t),window.removeEventListener("test",n)}catch{e=!1}return Ml=e,Ml}function eh(e){return e.type==="touchstart"}const DI={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:Yt("columnVisibility",e)}),createColumn:(e,t)=>{e.toggleVisibility=n=>{e.getCanHide()&&t.setColumnVisibility(r=>({...r,[e.id]:n??!e.getIsVisible()}))},e.getIsVisible=()=>{var n,r;const s=e.columns;return(n=s.length?s.some(o=>o.getIsVisible()):(r=t.getState().columnVisibility)==null?void 0:r[e.id])!=null?n:!0},e.getCanHide=()=>{var n,r;return((n=e.columnDef.enableHiding)!=null?n:!0)&&((r=t.options.enableHiding)!=null?r:!0)},e.getToggleVisibilityHandler=()=>n=>{e.toggleVisibility==null||e.toggleVisibility(n.target.checked)}},createRow:(e,t)=>{e._getAllVisibleCells=ee(()=>[e.getAllCells(),t.getState().columnVisibility],n=>n.filter(r=>r.column.getIsVisible()),te(t.options,"debugRows")),e.getVisibleCells=ee(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(n,r,s)=>[...n,...r,...s],te(t.options,"debugRows"))},createTable:e=>{const t=(n,r)=>ee(()=>[r(),r().filter(s=>s.getIsVisible()).map(s=>s.id).join("_")],s=>s.filter(o=>o.getIsVisible==null?void 0:o.getIsVisible()),te(e.options,"debugColumns"));e.getVisibleFlatColumns=t("getVisibleFlatColumns",()=>e.getAllFlatColumns()),e.getVisibleLeafColumns=t("getVisibleLeafColumns",()=>e.getAllLeafColumns()),e.getLeftVisibleLeafColumns=t("getLeftVisibleLeafColumns",()=>e.getLeftLeafColumns()),e.getRightVisibleLeafColumns=t("getRightVisibleLeafColumns",()=>e.getRightLeafColumns()),e.getCenterVisibleLeafColumns=t("getCenterVisibleLeafColumns",()=>e.getCenterLeafColumns()),e.setColumnVisibility=n=>e.options.onColumnVisibilityChange==null?void 0:e.options.onColumnVisibilityChange(n),e.resetColumnVisibility=n=>{var r;e.setColumnVisibility(n?{}:(r=e.initialState.columnVisibility)!=null?r:{})},e.toggleAllColumnsVisible=n=>{var r;n=(r=n)!=null?r:!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((s,o)=>({...s,[o.id]:n||!(o.getCanHide!=null&&o.getCanHide())}),{}))},e.getIsAllColumnsVisible=()=>!e.getAllLeafColumns().some(n=>!(n.getIsVisible!=null&&n.getIsVisible())),e.getIsSomeColumnsVisible=()=>e.getAllLeafColumns().some(n=>n.getIsVisible==null?void 0:n.getIsVisible()),e.getToggleAllColumnsVisibilityHandler=()=>n=>{var r;e.toggleAllColumnsVisible((r=n.target)==null?void 0:r.checked)}}};function Gi(e,t){return t?t==="center"?e.getCenterVisibleLeafColumns():t==="left"?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}const II={createTable:e=>{e._getGlobalFacetedRowModel=e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,"__global__"),e.getGlobalFacetedRowModel=()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),e._getGlobalFacetedUniqueValues=e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,"__global__"),e.getGlobalFacetedUniqueValues=()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,e._getGlobalFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,"__global__"),e.getGlobalFacetedMinMaxValues=()=>{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}}},FI={getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:Yt("globalFilter",e),globalFilterFn:"auto",getColumnCanGlobalFilter:t=>{var n;const r=(n=e.getCoreRowModel().flatRows[0])==null||(n=n._getAllCellsByColumnId()[t.id])==null?void 0:n.getValue();return typeof r=="string"||typeof r=="number"}}),createColumn:(e,t)=>{e.getCanGlobalFilter=()=>{var n,r,s,o;return((n=e.columnDef.enableGlobalFilter)!=null?n:!0)&&((r=t.options.enableGlobalFilter)!=null?r:!0)&&((s=t.options.enableFilters)!=null?s:!0)&&((o=t.options.getColumnCanGlobalFilter==null?void 0:t.options.getColumnCanGlobalFilter(e))!=null?o:!0)&&!!e.accessorFn}},createTable:e=>{e.getGlobalAutoFilterFn=()=>Un.includesString,e.getGlobalFilterFn=()=>{var t,n;const{globalFilterFn:r}=e.options;return $u(r)?r:r==="auto"?e.getGlobalAutoFilterFn():(t=(n=e.options.filterFns)==null?void 0:n[r])!=null?t:Un[r]},e.setGlobalFilter=t=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(t)},e.resetGlobalFilter=t=>{e.setGlobalFilter(t?void 0:e.initialState.globalFilter)}}},zI={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:Yt("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let t=!1,n=!1;e._autoResetExpanded=()=>{var r,s;if(!t){e._queue(()=>{t=!0});return}if((r=(s=e.options.autoResetAll)!=null?s:e.options.autoResetExpanded)!=null?r:!e.options.manualExpanding){if(n)return;n=!0,e._queue(()=>{e.resetExpanded(),n=!1})}},e.setExpanded=r=>e.options.onExpandedChange==null?void 0:e.options.onExpandedChange(r),e.toggleAllRowsExpanded=r=>{r??!e.getIsAllRowsExpanded()?e.setExpanded(!0):e.setExpanded({})},e.resetExpanded=r=>{var s,o;e.setExpanded(r?{}:(s=(o=e.initialState)==null?void 0:o.expanded)!=null?s:{})},e.getCanSomeRowsExpand=()=>e.getPrePaginationRowModel().flatRows.some(r=>r.getCanExpand()),e.getToggleAllRowsExpandedHandler=()=>r=>{r.persist==null||r.persist(),e.toggleAllRowsExpanded()},e.getIsSomeRowsExpanded=()=>{const r=e.getState().expanded;return r===!0||Object.values(r).some(Boolean)},e.getIsAllRowsExpanded=()=>{const r=e.getState().expanded;return typeof r=="boolean"?r===!0:!(!Object.keys(r).length||e.getRowModel().flatRows.some(s=>!s.getIsExpanded()))},e.getExpandedDepth=()=>{let r=0;return(e.getState().expanded===!0?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(o=>{const i=o.split(".");r=Math.max(r,i.length)}),r},e.getPreExpandedRowModel=()=>e.getSortedRowModel(),e.getExpandedRowModel=()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel?e.getPreExpandedRowModel():e._getExpandedRowModel())},createRow:(e,t)=>{e.toggleExpanded=n=>{t.setExpanded(r=>{var s;const o=r===!0?!0:!!(r!=null&&r[e.id]);let i={};if(r===!0?Object.keys(t.getRowModel().rowsById).forEach(a=>{i[a]=!0}):i=r,n=(s=n)!=null?s:!o,!o&&n)return{...i,[e.id]:!0};if(o&&!n){const{[e.id]:a,...l}=i;return l}return r})},e.getIsExpanded=()=>{var n;const r=t.getState().expanded;return!!((n=t.options.getIsRowExpanded==null?void 0:t.options.getIsRowExpanded(e))!=null?n:r===!0||r!=null&&r[e.id])},e.getCanExpand=()=>{var n,r,s;return(n=t.options.getRowCanExpand==null?void 0:t.options.getRowCanExpand(e))!=null?n:((r=t.options.enableExpanding)!=null?r:!0)&&!!((s=e.subRows)!=null&&s.length)},e.getIsAllParentsExpanded=()=>{let n=!0,r=e;for(;n&&r.parentId;)r=t.getRow(r.parentId,!0),n=r.getIsExpanded();return n},e.getToggleExpandedHandler=()=>{const n=e.getCanExpand();return()=>{n&&e.toggleExpanded()}}}},Vf=0,Bf=10,th=()=>({pageIndex:Vf,pageSize:Bf}),VI={getInitialState:e=>({...e,pagination:{...th(),...e==null?void 0:e.pagination}}),getDefaultOptions:e=>({onPaginationChange:Yt("pagination",e)}),createTable:e=>{let t=!1,n=!1;e._autoResetPageIndex=()=>{var r,s;if(!t){e._queue(()=>{t=!0});return}if((r=(s=e.options.autoResetAll)!=null?s:e.options.autoResetPageIndex)!=null?r:!e.options.manualPagination){if(n)return;n=!0,e._queue(()=>{e.resetPageIndex(),n=!1})}},e.setPagination=r=>{const s=o=>jr(r,o);return e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(s)},e.resetPagination=r=>{var s;e.setPagination(r?th():(s=e.initialState.pagination)!=null?s:th())},e.setPageIndex=r=>{e.setPagination(s=>{let o=jr(r,s.pageIndex);const i=typeof e.options.pageCount>"u"||e.options.pageCount===-1?Number.MAX_SAFE_INTEGER:e.options.pageCount-1;return o=Math.max(0,Math.min(o,i)),{...s,pageIndex:o}})},e.resetPageIndex=r=>{var s,o;e.setPageIndex(r?Vf:(s=(o=e.initialState)==null||(o=o.pagination)==null?void 0:o.pageIndex)!=null?s:Vf)},e.resetPageSize=r=>{var s,o;e.setPageSize(r?Bf:(s=(o=e.initialState)==null||(o=o.pagination)==null?void 0:o.pageSize)!=null?s:Bf)},e.setPageSize=r=>{e.setPagination(s=>{const o=Math.max(1,jr(r,s.pageSize)),i=s.pageSize*s.pageIndex,a=Math.floor(i/o);return{...s,pageIndex:a,pageSize:o}})},e.setPageCount=r=>e.setPagination(s=>{var o;let i=jr(r,(o=e.options.pageCount)!=null?o:-1);return typeof i=="number"&&(i=Math.max(-1,i)),{...s,pageCount:i}}),e.getPageOptions=ee(()=>[e.getPageCount()],r=>{let s=[];return r&&r>0&&(s=[...new Array(r)].fill(null).map((o,i)=>i)),s},te(e.options,"debugTable")),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{const{pageIndex:r}=e.getState().pagination,s=e.getPageCount();return s===-1?!0:s===0?!1:re.setPageIndex(r=>r-1),e.nextPage=()=>e.setPageIndex(r=>r+1),e.firstPage=()=>e.setPageIndex(0),e.lastPage=()=>e.setPageIndex(e.getPageCount()-1),e.getPrePaginationRowModel=()=>e.getExpandedRowModel(),e.getPaginationRowModel=()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel?e.getPrePaginationRowModel():e._getPaginationRowModel()),e.getPageCount=()=>{var r;return(r=e.options.pageCount)!=null?r:Math.ceil(e.getRowCount()/e.getState().pagination.pageSize)},e.getRowCount=()=>{var r;return(r=e.options.rowCount)!=null?r:e.getPrePaginationRowModel().rows.length}}},nh=()=>({top:[],bottom:[]}),BI={getInitialState:e=>({rowPinning:nh(),...e}),getDefaultOptions:e=>({onRowPinningChange:Yt("rowPinning",e)}),createRow:(e,t)=>{e.pin=(n,r,s)=>{const o=r?e.getLeafRows().map(l=>{let{id:u}=l;return u}):[],i=s?e.getParentRows().map(l=>{let{id:u}=l;return u}):[],a=new Set([...i,e.id,...o]);t.setRowPinning(l=>{var u,d;if(n==="bottom"){var h,f;return{top:((h=l==null?void 0:l.top)!=null?h:[]).filter(m=>!(a!=null&&a.has(m))),bottom:[...((f=l==null?void 0:l.bottom)!=null?f:[]).filter(m=>!(a!=null&&a.has(m))),...Array.from(a)]}}if(n==="top"){var p,g;return{top:[...((p=l==null?void 0:l.top)!=null?p:[]).filter(m=>!(a!=null&&a.has(m))),...Array.from(a)],bottom:((g=l==null?void 0:l.bottom)!=null?g:[]).filter(m=>!(a!=null&&a.has(m)))}}return{top:((u=l==null?void 0:l.top)!=null?u:[]).filter(m=>!(a!=null&&a.has(m))),bottom:((d=l==null?void 0:l.bottom)!=null?d:[]).filter(m=>!(a!=null&&a.has(m)))}})},e.getCanPin=()=>{var n;const{enableRowPinning:r,enablePinning:s}=t.options;return typeof r=="function"?r(e):(n=r??s)!=null?n:!0},e.getIsPinned=()=>{const n=[e.id],{top:r,bottom:s}=t.getState().rowPinning,o=n.some(a=>r==null?void 0:r.includes(a)),i=n.some(a=>s==null?void 0:s.includes(a));return o?"top":i?"bottom":!1},e.getPinnedIndex=()=>{var n,r;const s=e.getIsPinned();if(!s)return-1;const o=(n=s==="top"?t.getTopRows():t.getBottomRows())==null?void 0:n.map(i=>{let{id:a}=i;return a});return(r=o==null?void 0:o.indexOf(e.id))!=null?r:-1}},createTable:e=>{e.setRowPinning=t=>e.options.onRowPinningChange==null?void 0:e.options.onRowPinningChange(t),e.resetRowPinning=t=>{var n,r;return e.setRowPinning(t?nh():(n=(r=e.initialState)==null?void 0:r.rowPinning)!=null?n:nh())},e.getIsSomeRowsPinned=t=>{var n;const r=e.getState().rowPinning;if(!t){var s,o;return!!((s=r.top)!=null&&s.length||(o=r.bottom)!=null&&o.length)}return!!((n=r[t])!=null&&n.length)},e._getPinnedRows=(t,n,r)=>{var s;return((s=e.options.keepPinnedRows)==null||s?(n??[]).map(i=>{const a=e.getRow(i,!0);return a.getIsAllParentsExpanded()?a:null}):(n??[]).map(i=>t.find(a=>a.id===i))).filter(Boolean).map(i=>({...i,position:r}))},e.getTopRows=ee(()=>[e.getRowModel().rows,e.getState().rowPinning.top],(t,n)=>e._getPinnedRows(t,n,"top"),te(e.options,"debugRows")),e.getBottomRows=ee(()=>[e.getRowModel().rows,e.getState().rowPinning.bottom],(t,n)=>e._getPinnedRows(t,n,"bottom"),te(e.options,"debugRows")),e.getCenterRows=ee(()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom],(t,n,r)=>{const s=new Set([...n??[],...r??[]]);return t.filter(o=>!s.has(o.id))},te(e.options,"debugRows"))}},$I={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:Yt("rowSelection",e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>{e.setRowSelection=t=>e.options.onRowSelectionChange==null?void 0:e.options.onRowSelectionChange(t),e.resetRowSelection=t=>{var n;return e.setRowSelection(t?{}:(n=e.initialState.rowSelection)!=null?n:{})},e.toggleAllRowsSelected=t=>{e.setRowSelection(n=>{t=typeof t<"u"?t:!e.getIsAllRowsSelected();const r={...n},s=e.getPreGroupedRowModel().flatRows;return t?s.forEach(o=>{o.getCanSelect()&&(r[o.id]=!0)}):s.forEach(o=>{delete r[o.id]}),r})},e.toggleAllPageRowsSelected=t=>e.setRowSelection(n=>{const r=typeof t<"u"?t:!e.getIsAllPageRowsSelected(),s={...n};return e.getRowModel().rows.forEach(o=>{$f(s,o.id,r,!0,e)}),s}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=ee(()=>[e.getState().rowSelection,e.getCoreRowModel()],(t,n)=>Object.keys(t).length?rh(e,n):{rows:[],flatRows:[],rowsById:{}},te(e.options,"debugTable")),e.getFilteredSelectedRowModel=ee(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(t,n)=>Object.keys(t).length?rh(e,n):{rows:[],flatRows:[],rowsById:{}},te(e.options,"debugTable")),e.getGroupedSelectedRowModel=ee(()=>[e.getState().rowSelection,e.getSortedRowModel()],(t,n)=>Object.keys(t).length?rh(e,n):{rows:[],flatRows:[],rowsById:{}},te(e.options,"debugTable")),e.getIsAllRowsSelected=()=>{const t=e.getFilteredRowModel().flatRows,{rowSelection:n}=e.getState();let r=!!(t.length&&Object.keys(n).length);return r&&t.some(s=>s.getCanSelect()&&!n[s.id])&&(r=!1),r},e.getIsAllPageRowsSelected=()=>{const t=e.getPaginationRowModel().flatRows.filter(s=>s.getCanSelect()),{rowSelection:n}=e.getState();let r=!!t.length;return r&&t.some(s=>!n[s.id])&&(r=!1),r},e.getIsSomeRowsSelected=()=>{var t;const n=Object.keys((t=e.getState().rowSelection)!=null?t:{}).length;return n>0&&n{const t=e.getPaginationRowModel().flatRows;return e.getIsAllPageRowsSelected()?!1:t.filter(n=>n.getCanSelect()).some(n=>n.getIsSelected()||n.getIsSomeSelected())},e.getToggleAllRowsSelectedHandler=()=>t=>{e.toggleAllRowsSelected(t.target.checked)},e.getToggleAllPageRowsSelectedHandler=()=>t=>{e.toggleAllPageRowsSelected(t.target.checked)}},createRow:(e,t)=>{e.toggleSelected=(n,r)=>{const s=e.getIsSelected();t.setRowSelection(o=>{var i;if(n=typeof n<"u"?n:!s,e.getCanSelect()&&s===n)return o;const a={...o};return $f(a,e.id,n,(i=r==null?void 0:r.selectChildren)!=null?i:!0,t),a})},e.getIsSelected=()=>{const{rowSelection:n}=t.getState();return Gg(e,n)},e.getIsSomeSelected=()=>{const{rowSelection:n}=t.getState();return Hf(e,n)==="some"},e.getIsAllSubRowsSelected=()=>{const{rowSelection:n}=t.getState();return Hf(e,n)==="all"},e.getCanSelect=()=>{var n;return typeof t.options.enableRowSelection=="function"?t.options.enableRowSelection(e):(n=t.options.enableRowSelection)!=null?n:!0},e.getCanSelectSubRows=()=>{var n;return typeof t.options.enableSubRowSelection=="function"?t.options.enableSubRowSelection(e):(n=t.options.enableSubRowSelection)!=null?n:!0},e.getCanMultiSelect=()=>{var n;return typeof t.options.enableMultiRowSelection=="function"?t.options.enableMultiRowSelection(e):(n=t.options.enableMultiRowSelection)!=null?n:!0},e.getToggleSelectedHandler=()=>{const n=e.getCanSelect();return r=>{var s;n&&e.toggleSelected((s=r.target)==null?void 0:s.checked)}}}},$f=(e,t,n,r,s)=>{var o;const i=s.getRow(t,!0);n?(i.getCanMultiSelect()||Object.keys(e).forEach(a=>delete e[a]),i.getCanSelect()&&(e[t]=!0)):delete e[t],r&&(o=i.subRows)!=null&&o.length&&i.getCanSelectSubRows()&&i.subRows.forEach(a=>$f(e,a.id,n,r,s))};function rh(e,t){const n=e.getState().rowSelection,r=[],s={},o=function(i,a){return i.map(l=>{var u;const d=Gg(l,n);if(d&&(r.push(l),s[l.id]=l),(u=l.subRows)!=null&&u.length&&(l={...l,subRows:o(l.subRows)}),d)return l}).filter(Boolean)};return{rows:o(t.rows),flatRows:r,rowsById:s}}function Gg(e,t){var n;return(n=t[e.id])!=null?n:!1}function Hf(e,t,n){var r;if(!((r=e.subRows)!=null&&r.length))return!1;let s=!0,o=!1;return e.subRows.forEach(i=>{if(!(o&&!s)&&(i.getCanSelect()&&(Gg(i,t)?o=!0:s=!1),i.subRows&&i.subRows.length)){const a=Hf(i,t);a==="all"?o=!0:(a==="some"&&(o=!0),s=!1)}}),s?"all":o?"some":!1}const Uf=/([0-9]+)/gm,HI=(e,t,n)=>FS(Wr(e.getValue(n)).toLowerCase(),Wr(t.getValue(n)).toLowerCase()),UI=(e,t,n)=>FS(Wr(e.getValue(n)),Wr(t.getValue(n))),WI=(e,t,n)=>Kg(Wr(e.getValue(n)).toLowerCase(),Wr(t.getValue(n)).toLowerCase()),GI=(e,t,n)=>Kg(Wr(e.getValue(n)),Wr(t.getValue(n))),KI=(e,t,n)=>{const r=e.getValue(n),s=t.getValue(n);return r>s?1:rKg(e.getValue(n),t.getValue(n));function Kg(e,t){return e===t?0:e>t?1:-1}function Wr(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}function FS(e,t){const n=e.split(Uf).filter(Boolean),r=t.split(Uf).filter(Boolean);for(;n.length&&r.length;){const s=n.shift(),o=r.shift(),i=parseInt(s,10),a=parseInt(o,10),l=[i,a].sort();if(isNaN(l[0])){if(s>o)return 1;if(o>s)return-1;continue}if(isNaN(l[1]))return isNaN(i)?-1:1;if(i>a)return 1;if(a>i)return-1}return n.length-r.length}const yi={alphanumeric:HI,alphanumericCaseSensitive:UI,text:WI,textCaseSensitive:GI,datetime:KI,basic:qI},YI={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:Yt("sorting",e),isMultiSortEvent:t=>t.shiftKey}),createColumn:(e,t)=>{e.getAutoSortingFn=()=>{const n=t.getFilteredRowModel().flatRows.slice(10);let r=!1;for(const s of n){const o=s==null?void 0:s.getValue(e.id);if(Object.prototype.toString.call(o)==="[object Date]")return yi.datetime;if(typeof o=="string"&&(r=!0,o.split(Uf).length>1))return yi.alphanumeric}return r?yi.text:yi.basic},e.getAutoSortDir=()=>{const n=t.getFilteredRowModel().flatRows[0];return typeof(n==null?void 0:n.getValue(e.id))=="string"?"asc":"desc"},e.getSortingFn=()=>{var n,r;if(!e)throw new Error;return $u(e.columnDef.sortingFn)?e.columnDef.sortingFn:e.columnDef.sortingFn==="auto"?e.getAutoSortingFn():(n=(r=t.options.sortingFns)==null?void 0:r[e.columnDef.sortingFn])!=null?n:yi[e.columnDef.sortingFn]},e.toggleSorting=(n,r)=>{const s=e.getNextSortingOrder(),o=typeof n<"u"&&n!==null;t.setSorting(i=>{const a=i==null?void 0:i.find(p=>p.id===e.id),l=i==null?void 0:i.findIndex(p=>p.id===e.id);let u=[],d,h=o?n:s==="desc";if(i!=null&&i.length&&e.getCanMultiSort()&&r?a?d="toggle":d="add":i!=null&&i.length&&l!==i.length-1?d="replace":a?d="toggle":d="replace",d==="toggle"&&(o||s||(d="remove")),d==="add"){var f;u=[...i,{id:e.id,desc:h}],u.splice(0,u.length-((f=t.options.maxMultiSortColCount)!=null?f:Number.MAX_SAFE_INTEGER))}else d==="toggle"?u=i.map(p=>p.id===e.id?{...p,desc:h}:p):d==="remove"?u=i.filter(p=>p.id!==e.id):u=[{id:e.id,desc:h}];return u})},e.getFirstSortDir=()=>{var n,r;return((n=(r=e.columnDef.sortDescFirst)!=null?r:t.options.sortDescFirst)!=null?n:e.getAutoSortDir()==="desc")?"desc":"asc"},e.getNextSortingOrder=n=>{var r,s;const o=e.getFirstSortDir(),i=e.getIsSorted();return i?i!==o&&((r=t.options.enableSortingRemoval)==null||r)&&(!(n&&(s=t.options.enableMultiRemove)!=null)||s)?!1:i==="desc"?"asc":"desc":o},e.getCanSort=()=>{var n,r;return((n=e.columnDef.enableSorting)!=null?n:!0)&&((r=t.options.enableSorting)!=null?r:!0)&&!!e.accessorFn},e.getCanMultiSort=()=>{var n,r;return(n=(r=e.columnDef.enableMultiSort)!=null?r:t.options.enableMultiSort)!=null?n:!!e.accessorFn},e.getIsSorted=()=>{var n;const r=(n=t.getState().sorting)==null?void 0:n.find(s=>s.id===e.id);return r?r.desc?"desc":"asc":!1},e.getSortIndex=()=>{var n,r;return(n=(r=t.getState().sorting)==null?void 0:r.findIndex(s=>s.id===e.id))!=null?n:-1},e.clearSorting=()=>{t.setSorting(n=>n!=null&&n.length?n.filter(r=>r.id!==e.id):[])},e.getToggleSortingHandler=()=>{const n=e.getCanSort();return r=>{n&&(r.persist==null||r.persist(),e.toggleSorting==null||e.toggleSorting(void 0,e.getCanMultiSort()?t.options.isMultiSortEvent==null?void 0:t.options.isMultiSortEvent(r):!1))}}},createTable:e=>{e.setSorting=t=>e.options.onSortingChange==null?void 0:e.options.onSortingChange(t),e.resetSorting=t=>{var n,r;e.setSorting(t?[]:(n=(r=e.initialState)==null?void 0:r.sorting)!=null?n:[])},e.getPreSortedRowModel=()=>e.getGroupedRowModel(),e.getSortedRowModel=()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel?e.getPreSortedRowModel():e._getSortedRowModel())}},XI=[yI,DI,TI,AI,xI,bI,II,FI,YI,RI,zI,VI,BI,$I,LI];function QI(e){var t,n;const r=[...XI,...(t=e._features)!=null?t:[]];let s={_features:r};const o=s._features.reduce((f,p)=>Object.assign(f,p.getDefaultOptions==null?void 0:p.getDefaultOptions(s)),{}),i=f=>s.options.mergeOptions?s.options.mergeOptions(o,f):{...o,...f};let l={...{},...(n=e.initialState)!=null?n:{}};s._features.forEach(f=>{var p;l=(p=f.getInitialState==null?void 0:f.getInitialState(l))!=null?p:l});const u=[];let d=!1;const h={_features:r,options:{...o,...e},initialState:l,_queue:f=>{u.push(f),d||(d=!0,Promise.resolve().then(()=>{for(;u.length;)u.shift()();d=!1}).catch(p=>setTimeout(()=>{throw p})))},reset:()=>{s.setState(s.initialState)},setOptions:f=>{const p=jr(f,s.options);s.options=i(p)},getState:()=>s.options.state,setState:f=>{s.options.onStateChange==null||s.options.onStateChange(f)},_getRowId:(f,p,g)=>{var m;return(m=s.options.getRowId==null?void 0:s.options.getRowId(f,p,g))!=null?m:`${g?[g.id,p].join("."):p}`},getCoreRowModel:()=>(s._getCoreRowModel||(s._getCoreRowModel=s.options.getCoreRowModel(s)),s._getCoreRowModel()),getRowModel:()=>s.getPaginationRowModel(),getRow:(f,p)=>{let g=(p?s.getPrePaginationRowModel():s.getRowModel()).rowsById[f];if(!g&&(g=s.getCoreRowModel().rowsById[f],!g))throw new Error;return g},_getDefaultColumnDef:ee(()=>[s.options.defaultColumn],f=>{var p;return f=(p=f)!=null?p:{},{header:g=>{const m=g.header.column.columnDef;return m.accessorKey?m.accessorKey:m.accessorFn?m.id:null},cell:g=>{var m,y;return(m=(y=g.renderValue())==null||y.toString==null?void 0:y.toString())!=null?m:null},...s._features.reduce((g,m)=>Object.assign(g,m.getDefaultColumnDef==null?void 0:m.getDefaultColumnDef()),{}),...f}},te(e,"debugColumns")),_getColumnDefs:()=>s.options.columns,getAllColumns:ee(()=>[s._getColumnDefs()],f=>{const p=function(g,m,y){return y===void 0&&(y=0),g.map(x=>{const v=mI(s,x,y,m),b=x;return v.columns=b.columns?p(b.columns,v,y+1):[],v})};return p(f)},te(e,"debugColumns")),getAllFlatColumns:ee(()=>[s.getAllColumns()],f=>f.flatMap(p=>p.getFlatColumns()),te(e,"debugColumns")),_getAllFlatColumnsById:ee(()=>[s.getAllFlatColumns()],f=>f.reduce((p,g)=>(p[g.id]=g,p),{}),te(e,"debugColumns")),getAllLeafColumns:ee(()=>[s.getAllColumns(),s._getOrderColumnsFn()],(f,p)=>{let g=f.flatMap(m=>m.getLeafColumns());return p(g)},te(e,"debugColumns")),getColumn:f=>s._getAllFlatColumnsById()[f]};Object.assign(s,h);for(let f=0;fee(()=>[e.options.data],t=>{const n={rows:[],flatRows:[],rowsById:{}},r=function(s,o,i){o===void 0&&(o=0);const a=[];for(let u=0;ue._autoResetPageIndex()))}function ZI(e){const t=[],n=r=>{var s;t.push(r),(s=r.subRows)!=null&&s.length&&r.getIsExpanded()&&r.subRows.forEach(n)};return e.rows.forEach(n),{rows:t,flatRows:e.flatRows,rowsById:e.rowsById}}function e6(e,t,n){return n.options.filterFromLeafRows?t6(e,t,n):n6(e,t,n)}function t6(e,t,n){var r;const s=[],o={},i=(r=n.options.maxLeafRowFilterDepth)!=null?r:100,a=function(l,u){u===void 0&&(u=0);const d=[];for(let f=0;fee(()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter],(t,n,r)=>{if(!t.rows.length||!(n!=null&&n.length)&&!r){for(let f=0;f{var p;const g=e.getColumn(f.id);if(!g)return;const m=g.getFilterFn();m&&s.push({id:f.id,filterFn:m,resolvedValue:(p=m.resolveFilterValue==null?void 0:m.resolveFilterValue(f.value))!=null?p:f.value})});const i=(n??[]).map(f=>f.id),a=e.getGlobalFilterFn(),l=e.getAllLeafColumns().filter(f=>f.getCanGlobalFilter());r&&a&&l.length&&(i.push("__global__"),l.forEach(f=>{var p;o.push({id:f.id,filterFn:a,resolvedValue:(p=a.resolveFilterValue==null?void 0:a.resolveFilterValue(r))!=null?p:r})}));let u,d;for(let f=0;f{p.columnFiltersMeta[m]=y})}if(o.length){for(let g=0;g{p.columnFiltersMeta[m]=y})){p.columnFilters.__global__=!0;break}}p.columnFilters.__global__!==!0&&(p.columnFilters.__global__=!1)}}const h=f=>{for(let p=0;pe._autoResetPageIndex()))}function s6(e){return t=>ee(()=>[t.getState().pagination,t.getPrePaginationRowModel(),t.options.paginateExpandedRows?void 0:t.getState().expanded],(n,r)=>{if(!r.rows.length)return r;const{pageSize:s,pageIndex:o}=n;let{rows:i,flatRows:a,rowsById:l}=r;const u=s*o,d=u+s;i=i.slice(u,d);let h;t.options.paginateExpandedRows?h={rows:i,flatRows:a,rowsById:l}:h=ZI({rows:i,flatRows:a,rowsById:l}),h.flatRows=[];const f=p=>{h.flatRows.push(p),p.subRows.length&&p.subRows.forEach(f)};return h.rows.forEach(f),h},te(t.options,"debugTable"))}function o6(){return e=>ee(()=>[e.getState().sorting,e.getPreSortedRowModel()],(t,n)=>{if(!n.rows.length||!(t!=null&&t.length))return n;const r=e.getState().sorting,s=[],o=r.filter(l=>{var u;return(u=e.getColumn(l.id))==null?void 0:u.getCanSort()}),i={};o.forEach(l=>{const u=e.getColumn(l.id);u&&(i[l.id]={sortUndefined:u.columnDef.sortUndefined,invertSorting:u.columnDef.invertSorting,sortingFn:u.getSortingFn()})});const a=l=>{const u=l.map(d=>({...d}));return u.sort((d,h)=>{for(let p=0;p{var h;s.push(d),(h=d.subRows)!=null&&h.length&&(d.subRows=a(d.subRows))}),u};return{rows:a(n.rows),flatRows:s,rowsById:n.rowsById}},te(e.options,"debugTable","getSortedRowModel",()=>e._autoResetPageIndex()))}/** * react-table * * Copyright (c) TanStack @@ -440,12 +440,12 @@ Error generating stack: `+o.message+` * LICENSE.md file in the root directory of this source tree. * * @license MIT - */function jb(e,t){return e?i6(e)?S.createElement(e,t):e:null}function i6(e){return a6(e)||typeof e=="function"||l6(e)}function a6(e){return typeof e=="function"&&(()=>{const t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}function l6(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function c6(e){const t={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[n]=S.useState(()=>({current:QI(t)})),[r,s]=S.useState(()=>n.current.initialState);return n.current.setOptions(o=>({...o,...e,state:{...r,...e.state},onStateChange:i=>{s(i),e.onStateChange==null||e.onStateChange(i)}})),n.current}const zS=S.forwardRef(({className:e,...t},n)=>c.jsx("div",{className:"relative w-full overflow-auto",children:c.jsx("table",{ref:n,className:lr("w-full caption-bottom text-sm",e),...t})}));zS.displayName="Table";const VS=S.forwardRef(({className:e,...t},n)=>c.jsx("thead",{ref:n,className:lr("[&_tr]:border-b dark:border-white/5",e),...t}));VS.displayName="TableHeader";const BS=S.forwardRef(({className:e,...t},n)=>c.jsx("tbody",{ref:n,className:lr("[&_tr:last-child]:border-0",e),...t}));BS.displayName="TableBody";const u6=S.forwardRef(({className:e,...t},n)=>c.jsx("tfoot",{ref:n,className:lr("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}));u6.displayName="TableFooter";const sc=S.forwardRef(({className:e,...t},n)=>c.jsx("tr",{ref:n,className:lr("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted dark:border-white/5 dark:hover:bg-white/5",e),...t}));sc.displayName="TableRow";const $S=S.forwardRef(({className:e,...t},n)=>c.jsx("th",{ref:n,className:lr("h-12 px-4 text-left align-middle font-semibold text-xs uppercase tracking-wider text-gray-600 dark:text-gray-400 [&:has([role=checkbox])]:pr-0 bg-gray-50 dark:bg-white/5",e),...t}));$S.displayName="TableHead";const Wf=S.forwardRef(({className:e,...t},n)=>c.jsx("td",{ref:n,className:lr("p-4 align-middle [&:has([role=checkbox])]:pr-0 text-gray-900 dark:text-gray-300",e),...t}));Wf.displayName="TableCell";const d6=S.forwardRef(({className:e,...t},n)=>c.jsx("caption",{ref:n,className:lr("mt-4 text-sm text-muted-foreground",e),...t}));d6.displayName="TableCaption";function h6({columns:e,data:t,searchable:n=!0,itemsPerPage:r=10,emptyMessage:s="No results."}){var f;const[o,i]=S.useState([]),[a,l]=S.useState([]),[u,d]=S.useState(""),h=c6({data:t,columns:e,getCoreRowModel:JI(),getPaginationRowModel:s6(),onSortingChange:i,getSortedRowModel:o6(),onColumnFiltersChange:l,getFilteredRowModel:r6(),onGlobalFilterChange:d,state:{sorting:o,columnFilters:a,globalFilter:u},initialState:{pagination:{pageSize:r}}});return c.jsxs("div",{className:"space-y-4",children:[n&&c.jsxs("div",{className:"relative",children:[c.jsx(tk,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),c.jsx("input",{placeholder:"Search...",value:u??"",onChange:p=>d(p.target.value),className:"w-full pl-10 pr-4 py-2 bg-white dark:bg-white/5 border border-gray-200 dark:border-white/10 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-primary-500 dark:text-white placeholder-gray-400 dark:placeholder-gray-600"})]}),c.jsx("div",{className:"rounded-md border border-gray-200 dark:border-white/10 overflow-hidden",children:c.jsxs(zS,{children:[c.jsx(VS,{children:h.getHeaderGroups().map(p=>c.jsx(sc,{children:p.headers.map(g=>c.jsx($S,{children:g.isPlaceholder?null:jb(g.column.columnDef.header,g.getContext())},g.id))},p.id))}),c.jsx(BS,{children:(f=h.getRowModel().rows)!=null&&f.length?h.getRowModel().rows.map(p=>c.jsx(sc,{"data-state":p.getIsSelected()&&"selected",children:p.getVisibleCells().map(g=>c.jsx(Wf,{children:jb(g.column.columnDef.cell,g.getContext())},g.id))},p.id)):c.jsx(sc,{children:c.jsx(Wf,{colSpan:e.length,className:"h-24 text-center",children:s})})})]})}),h.getPageCount()>1&&c.jsxs("div",{className:"flex items-center justify-between space-x-2 py-4",children:[c.jsxs("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:["Page ",h.getState().pagination.pageIndex+1," of ",h.getPageCount()]}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("button",{className:"p-2 rounded-lg border border-gray-200 dark:border-white/10 hover:bg-gray-50 dark:hover:bg-white/5 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",onClick:()=>h.previousPage(),disabled:!h.getCanPreviousPage(),children:c.jsx(q1,{size:16})}),c.jsx("button",{className:"p-2 rounded-lg border border-gray-200 dark:border-white/10 hover:bg-gray-50 dark:hover:bg-white/5 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",onClick:()=>h.nextPage(),disabled:!h.getCanNextPage(),children:c.jsx(K1,{size:16})})]})]})]})}function f6(){const{user:e}=Qr(),[t,n]=S.useState([]),[r,s]=S.useState(null),[o,i]=S.useState(!0);S.useEffect(()=>{e&&(async()=>{try{const d=localStorage.getItem("access_token");d&&n([{id:"1",name:"Current API Key",key:d,status:"Active"}])}catch(d){console.error("Failed to fetch API keys:",d)}finally{i(!1)}})()},[e]);const a=(u,d)=>{navigator.clipboard.writeText(u),s(d),setTimeout(()=>s(null),2e3)},l=[{accessorKey:"name",header:"Name"},{accessorKey:"key",header:"Key",cell:({row:u})=>c.jsxs("div",{className:"flex items-center gap-2 font-mono text-gray-700 dark:text-gray-300",children:[c.jsxs("span",{className:"truncate max-w-xs",children:[u.original.key.substring(0,20),"..."]}),c.jsx("button",{onClick:()=>a(u.original.key,u.original.id),className:"p-1 hover:bg-gray-100 dark:hover:bg-white/10 rounded transition-colors",title:"Copy key",children:r===u.original.id?c.jsx(vu,{className:"w-3 h-3 text-green-500"}):c.jsx(Y1,{className:"w-3 h-3"})})]})},{accessorKey:"status",header:"Status",cell:({row:u})=>c.jsx("span",{className:`px-2 py-1 rounded-full text-xs font-medium ${u.original.status==="Active"?"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400":"bg-gray-100 text-gray-800 dark:bg-gray-800 dark:text-gray-400"}`,children:u.original.status})}];return o?c.jsx("div",{className:"flex items-center justify-center h-64",children:c.jsx("div",{className:"text-gray-500 dark:text-gray-400",children:"Loading API keys..."})}):c.jsxs("div",{className:"max-w-5xl mx-auto space-y-8",children:[c.jsx("div",{className:"flex items-center justify-between",children:c.jsxs("div",{children:[c.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:"API Keys"}),c.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:"Manage your API keys for authentication."})]})}),c.jsx("div",{className:"bg-white dark:bg-secondary rounded-xl shadow-md dark:shadow-lg dark:shadow-black/10 border border-gray-200 dark:border-white/5 p-6",children:c.jsx(h6,{data:t,columns:l,itemsPerPage:10,searchable:!0,emptyMessage:"No API keys found. Generate one to get started."})}),c.jsxs("div",{className:"bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg p-4",children:[c.jsx("h3",{className:"text-sm font-medium text-blue-900 dark:text-blue-300 mb-2",children:"Using Your API Key"}),c.jsx("p",{className:"text-sm text-blue-700 dark:text-blue-400 mb-3",children:"Include your API key in the Authorization header of your requests:"}),c.jsx("code",{className:"block bg-white dark:bg-black/50 p-3 rounded text-xs font-mono text-gray-900 dark:text-gray-100 border border-blue-200 dark:border-blue-800",children:"Authorization: Bearer YOUR_API_KEY"})]})]})}const p6=["NGO","Government","Private Sector","Research","Individual","Other"],Cb=["Health","Agriculture","Energy","Environment","Education","Governance"];function g6(){const{user:e}=Qr(),{theme:t,setTheme:n}=H1(),[r,s]=S.useState({username:(e==null?void 0:e.username)||"",email:(e==null?void 0:e.email)||"",full_name:(e==null?void 0:e.full_name)||"",organization:(e==null?void 0:e.organization)||"",organization_type:(e==null?void 0:e.organization_type)||""}),[o,i]=S.useState((e==null?void 0:e.sector)||[]),[a,l]=S.useState(""),[u,d]=S.useState(""),[h,f]=S.useState(""),[p,g]=S.useState(!1),[m,y]=S.useState({oldPassword:"",newPassword:"",confirmPassword:""}),[x,v]=S.useState(""),[b,k]=S.useState(""),[w,j]=S.useState(!1),[N,_]=S.useState(!1),[P,A]=S.useState(!1),[O,F]=S.useState(!1),D=E=>{i(I=>I.includes(E)?I.filter(Y=>Y!==E):[...I,E])},U=()=>{const E=a.trim();E&&!o.includes(E)&&(i(I=>[...I,E]),l(""))},W=async E=>{var I,Y;E.preventDefault(),f(""),d(""),g(!0);try{await ae.put("/auth/profile",{full_name:r.full_name||void 0,organization:r.organization||void 0,organization_type:r.organization_type||void 0,sector:o.length>0?o:void 0}),d("Profile updated successfully!")}catch(T){f(((Y=(I=T.response)==null?void 0:I.data)==null?void 0:Y.detail)||"Failed to update profile.")}finally{g(!1)}},M=async E=>{var I,Y;if(E.preventDefault(),v(""),k(""),m.newPassword!==m.confirmPassword){v("New passwords do not match");return}j(!0);try{const T=await ae.post("/auth/change-password",{old_password:m.oldPassword,new_password:m.newPassword});T.data.success?(k("Password changed successfully!"),y({oldPassword:"",newPassword:"",confirmPassword:""})):v(T.data.message||"Failed to change password")}catch(T){v(((Y=(I=T.response)==null?void 0:I.data)==null?void 0:Y.detail)||"Failed to change password")}finally{j(!1)}},H=(e==null?void 0:e.oauth_type)==="Google"||(e==null?void 0:e.oauth_type)==="GitHub",C=!H,L=!H;return c.jsxs("div",{className:"max-w-2xl mx-auto space-y-8",children:[c.jsxs("div",{children:[c.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:"Account Settings"}),c.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:"Manage your profile and preferences."})]}),c.jsxs("div",{className:"bg-white dark:bg-secondary rounded-xl p-6 shadow-md dark:shadow-lg dark:shadow-black/10 border border-gray-200 dark:border-white/5 space-y-6",children:[c.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Profile Information"}),c.jsxs("form",{onSubmit:W,className:"space-y-4",children:[h&&c.jsx("div",{className:"bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400 p-3 rounded-lg text-sm",children:h}),u&&c.jsx("div",{className:"bg-green-50 dark:bg-green-900/20 text-green-600 dark:text-green-400 p-3 rounded-lg text-sm",children:u}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Username"}),c.jsxs("div",{className:"relative",children:[c.jsx(To,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),c.jsx("input",{type:"text",value:r.username,onChange:E=>s({...r,username:E.target.value}),className:"w-full pl-9 pr-4 py-2 bg-white dark:bg-black/50 border border-gray-200 dark:border-white/10 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500 dark:text-white"})]})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Full Name"}),c.jsxs("div",{className:"relative",children:[c.jsx(To,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),c.jsx("input",{type:"text",value:r.full_name,onChange:E=>s({...r,full_name:E.target.value}),className:"w-full pl-9 pr-4 py-2 bg-white dark:bg-black/50 border border-gray-200 dark:border-white/10 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500 dark:text-white",placeholder:"John Doe",disabled:p})]})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Email Address"}),c.jsxs("div",{className:"relative",children:[c.jsx(ku,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),c.jsx("input",{type:"email",value:r.email,onChange:E=>s({...r,email:E.target.value}),className:`w-full pl-9 pr-4 py-2 bg-white dark:bg-black/50 border border-gray-200 dark:border-white/10 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500 dark:text-white ${L?"":"opacity-50 cursor-not-allowed"}`,disabled:!L,title:L?"":"Email cannot be changed for OAuth accounts"})]})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Organization"}),c.jsxs("div",{className:"relative",children:[c.jsx(W1,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),c.jsx("input",{type:"text",value:r.organization,onChange:E=>s({...r,organization:E.target.value}),className:"w-full pl-9 pr-4 py-2 bg-white dark:bg-black/50 border border-gray-200 dark:border-white/10 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500 dark:text-white",placeholder:"Organization Name",disabled:p})]})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Organization Type"}),c.jsxs("div",{className:"relative",children:[c.jsx(U1,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),c.jsxs("select",{value:r.organization_type,onChange:E=>s({...r,organization_type:E.target.value}),className:"w-full pl-9 pr-4 py-2 bg-white dark:bg-black/50 border border-gray-200 dark:border-white/10 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500 dark:text-white appearance-none",disabled:p,children:[c.jsx("option",{value:"",children:"Select type..."}),p6.map(E=>c.jsx("option",{value:E,children:E},E))]})]})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Impact Sectors"}),c.jsx("div",{className:"flex flex-wrap gap-2 mt-1",children:[...Cb,...o.filter(E=>!Cb.includes(E))].map(E=>c.jsxs("button",{type:"button",onClick:()=>D(E),disabled:p,className:`px-3 py-1.5 rounded-full text-sm border transition-colors ${o.includes(E)?"border-primary-500 bg-primary-500/10 text-primary-600 dark:text-primary-400":"border-gray-200 dark:border-white/10 text-gray-500 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-white/5"}`,children:[E," ",o.includes(E)&&"✓"]},E))}),c.jsxs("div",{className:"flex gap-2 mt-2",children:[c.jsx("input",{type:"text",value:a,onChange:E=>l(E.target.value),onKeyDown:E=>E.key==="Enter"&&(E.preventDefault(),U()),className:"flex-1 px-3 py-1.5 bg-white dark:bg-black/50 border border-gray-200 dark:border-white/10 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500 dark:text-white text-sm placeholder-gray-400 dark:placeholder-gray-600",placeholder:"Add custom sector...",disabled:p}),c.jsx("button",{type:"button",onClick:U,disabled:p,className:"px-3 py-1.5 text-sm border border-gray-200 dark:border-white/10 rounded-lg text-gray-600 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-white/5 transition-colors",children:"Add"})]})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Account Type"}),c.jsxs("div",{className:"relative",children:[c.jsx(fR,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),c.jsx("input",{type:"text",value:(e==null?void 0:e.account_type)||"Standard",readOnly:!0,className:"w-full pl-9 pr-4 py-2 bg-gray-50 dark:bg-white/5 border border-gray-200 dark:border-white/10 rounded-lg focus:outline-none text-gray-500 dark:text-gray-400 cursor-not-allowed"})]})]}),c.jsx("div",{className:"pt-2",children:c.jsx("button",{type:"submit",disabled:p,className:"px-4 py-2 bg-primary-600 hover:bg-primary-700 text-white rounded-lg text-sm font-medium transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:p?"Saving...":"Save Changes"})})]})]}),c.jsxs("div",{className:"bg-white dark:bg-secondary rounded-xl p-6 shadow-md dark:shadow-lg dark:shadow-black/10 border border-gray-200 dark:border-white/5 space-y-6",children:[c.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Appearance"}),c.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[c.jsxs("button",{onClick:()=>n("light"),className:`p-4 rounded-lg border flex flex-col items-center gap-2 transition-all ${t==="light"?"border-primary-500 bg-primary-50 dark:bg-primary-900/20 text-primary-700 dark:text-primary-400":"border-gray-200 dark:border-white/10 hover:bg-gray-50 dark:hover:bg-white/5 text-gray-700 dark:text-gray-300"}`,children:[c.jsx(pf,{className:"w-6 h-6"}),c.jsx("span",{className:"text-sm font-medium",children:"Light"})]}),c.jsxs("button",{onClick:()=>n("dark"),className:`p-4 rounded-lg border flex flex-col items-center gap-2 transition-all ${t==="dark"?"border-primary-500 bg-primary-50 dark:bg-primary-900/20 text-primary-700 dark:text-primary-400":"border-gray-200 dark:border-white/10 hover:bg-gray-50 dark:hover:bg-white/5 text-gray-700 dark:text-gray-300"}`,children:[c.jsx(ff,{className:"w-6 h-6"}),c.jsx("span",{className:"text-sm font-medium",children:"Dark"})]}),c.jsxs("button",{onClick:()=>n("system"),className:`p-4 rounded-lg border flex flex-col items-center gap-2 transition-all ${t==="system"?"border-primary-500 bg-primary-50 dark:bg-primary-900/20 text-primary-700 dark:text-primary-400":"border-gray-200 dark:border-white/10 hover:bg-gray-50 dark:hover:bg-white/5 text-gray-700 dark:text-gray-300"}`,children:[c.jsx(bR,{className:"w-6 h-6"}),c.jsx("span",{className:"text-sm font-medium",children:"System"})]})]})]}),C&&c.jsxs("div",{className:"bg-white dark:bg-secondary rounded-xl p-6 shadow-md dark:shadow-lg dark:shadow-black/10 border border-gray-200 dark:border-white/5 space-y-6",children:[c.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Change Password"}),c.jsxs("form",{onSubmit:M,className:"space-y-4",children:[x&&c.jsx("div",{className:"bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400 p-3 rounded-lg text-sm",children:x}),b&&c.jsx("div",{className:"bg-green-50 dark:bg-green-900/20 text-green-600 dark:text-green-400 p-3 rounded-lg text-sm",children:b}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Current Password"}),c.jsxs("div",{className:"relative",children:[c.jsx(Jn,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),c.jsx("input",{type:N?"text":"password",required:!0,placeholder:"••••••••",value:m.oldPassword,onChange:E=>y({...m,oldPassword:E.target.value}),className:"w-full pl-9 pr-12 py-2 bg-white dark:bg-black/50 border border-gray-200 dark:border-white/10 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500 dark:text-white",disabled:w}),c.jsx("button",{type:"button",onClick:()=>_(!N),className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300",disabled:w,children:N?c.jsx(Dr,{className:"w-4 h-4"}):c.jsx(Ir,{className:"w-4 h-4"})})]})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"New Password"}),c.jsxs("div",{className:"relative",children:[c.jsx(Jn,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),c.jsx("input",{type:P?"text":"password",placeholder:"••••••••",required:!0,value:m.newPassword,onChange:E=>y({...m,newPassword:E.target.value}),className:"w-full pl-9 pr-12 py-2 bg-white dark:bg-black/50 border border-gray-200 dark:border-white/10 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500 dark:text-white",disabled:w}),c.jsx("button",{type:"button",onClick:()=>A(!P),className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300",disabled:w,children:P?c.jsx(Dr,{className:"w-4 h-4"}):c.jsx(Ir,{className:"w-4 h-4"})})]})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Confirm New Password"}),c.jsxs("div",{className:"relative",children:[c.jsx(Jn,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),c.jsx("input",{type:O?"text":"password",required:!0,placeholder:"••••••••",value:m.confirmPassword,onChange:E=>y({...m,confirmPassword:E.target.value}),className:"w-full pl-9 pr-12 py-2 bg-white dark:bg-black/50 border border-gray-200 dark:border-white/10 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500 dark:text-white",disabled:w}),c.jsx("button",{type:"button",onClick:()=>F(!O),className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300",disabled:w,children:O?c.jsx(Dr,{className:"w-4 h-4"}):c.jsx(Ir,{className:"w-4 h-4"})})]})]}),c.jsx("div",{className:"pt-2",children:c.jsx("button",{type:"submit",disabled:w,className:"px-4 py-2 bg-primary-600 hover:bg-primary-700 text-white rounded-lg text-sm font-medium transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:w?"Changing Password...":"Change Password"})})]})]})]})}function m6({value:e,onChange:t,options:n,placeholder:r="Select...",disabled:s=!1,className:o=""}){const[i,a]=S.useState(!1),[l,u]=S.useState(""),d=S.useRef(null),h=S.useRef(null);S.useEffect(()=>{const m=y=>{d.current&&!d.current.contains(y.target)&&(a(!1),u(""))};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[]),S.useEffect(()=>{i&&h.current&&h.current.focus()},[i]);const f=n.filter(m=>m.toLowerCase().includes(l.toLowerCase())),p=m=>{t(m),a(!1),u("")},g=m=>{m.stopPropagation(),t(""),u("")};return c.jsxs("div",{className:`relative ${o}`,ref:d,children:[c.jsxs("button",{type:"button",onClick:()=>!s&&a(!i),disabled:s,className:"flex items-center justify-between w-full min-w-[240px] px-3 py-2 text-sm bg-white dark:bg-secondary border border-gray-200 dark:border-white/10 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500 dark:text-white disabled:opacity-50 disabled:cursor-not-allowed",children:[c.jsx("span",{className:e?"text-gray-900 dark:text-white":"text-gray-400 dark:text-gray-500",children:e||r}),c.jsxs("div",{className:"flex items-center gap-1 ml-2",children:[e&&c.jsx(Su,{size:14,className:"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 cursor-pointer",onClick:g}),c.jsx(G1,{size:16,className:`text-gray-400 transition-transform ${i?"rotate-180":""}`})]})]}),i&&c.jsxs("div",{className:"absolute z-50 w-full mt-1 bg-white dark:bg-secondary border border-gray-200 dark:border-white/10 rounded-lg shadow-lg overflow-hidden",children:[c.jsx("div",{className:"p-2 border-b border-gray-200 dark:border-white/10",children:c.jsxs("div",{className:"relative",children:[c.jsx(tk,{size:14,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-gray-400"}),c.jsx("input",{ref:h,type:"text",value:l,onChange:m=>u(m.target.value),placeholder:"Search...",className:"w-full pl-8 pr-3 py-1.5 text-sm bg-gray-50 dark:bg-black/30 border border-gray-200 dark:border-white/10 rounded-md focus:outline-none focus:ring-1 focus:ring-primary-500 dark:text-white placeholder-gray-400"})]})}),c.jsx("div",{className:"max-h-60 overflow-y-auto",children:f.length===0?c.jsx("div",{className:"px-3 py-4 text-sm text-gray-400 text-center",children:"No results found"}):f.map(m=>c.jsx("button",{onClick:()=>p(m),className:`w-full text-left px-3 py-2 text-sm transition-colors ${m===e?"bg-primary-50 text-primary-600 dark:bg-primary-900/20 dark:text-primary-400":"text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-white/5"}`,children:m},m))})]})]})}const y6=[{label:"Overview",value:"overview"},{label:"By Organization",value:"organization"},{label:"By Org Type",value:"organization_type"},{label:"By Sector",value:"sector"}];function x6({view:e,onViewChange:t,filterValue:n,onFilterValueChange:r,filters:s,filtersLoading:o}){const a=s?e==="organization"?s.organizations:e==="organization_type"?s.organization_types:e==="sector"?s.sectors:[]:[],l=e!=="overview",u=()=>e==="organization"?"Organization":e==="organization_type"?"Organization Type":e==="sector"?"Sector":"";return c.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-3",children:[c.jsx("div",{className:"flex items-center gap-1 bg-white dark:bg-secondary rounded-lg border border-gray-200 dark:border-white/10 p-1",children:y6.map(d=>c.jsx("button",{onClick:()=>{t(d.value),r("")},className:`px-3 py-1.5 text-sm font-medium rounded-md transition-colors ${e===d.value?"bg-primary-600 text-white":"text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-white/5"}`,children:d.label},d.value))}),l&&c.jsx(m6,{value:n,onChange:r,options:a,placeholder:`Select ${u()}...`,disabled:o||a.length===0})]})}function b6(){const[e,t]=S.useState(null),[n,r]=S.useState(!0);return S.useEffect(()=>{(async()=>{var o,i,a;try{const l=await ae.get("/api/admin/analytics/filters");t(l.data)}catch(l){_n.error(((a=(i=(o=l.response)==null?void 0:o.data)==null?void 0:i.detail)==null?void 0:a.message)||"Failed to fetch filter options")}finally{r(!1)}})()},[]),{filters:e,loading:n}}function v6(e,t,n="7d"){const[r,s]=S.useState(null),[o,i]=S.useState(!0),[a,l]=S.useState(null),u=S.useCallback(async()=>{var d,h,f;i(!0),l(null);try{let p="/api/admin/analytics/";const g=new URLSearchParams({time_range:n});e==="overview"?p+="overview":e==="organization"?(p+="by-organization",g.set("organization",t)):e==="organization_type"?(p+="by-organization-type",g.set("organization_type",t)):e==="sector"&&(p+="by-sector",g.set("sector",t));const m=await ae.get(`${p}?${g.toString()}`);s(m.data)}catch(p){const g=((f=(h=(d=p.response)==null?void 0:d.data)==null?void 0:h.detail)==null?void 0:f.message)||"Failed to fetch analytics data";l(g),_n.error(g)}finally{i(!1)}},[e,t,n]);return S.useEffect(()=>{e==="overview"||t?u():(s(null),i(!1))},[e,t,n,u]),{data:r,loading:o,error:a}}function w6(){return{exportCSV:async(t,n,r)=>{try{const s=new URLSearchParams({view:t,time_range:n});t==="organization"&&r?s.set("organization",r):t==="organization_type"&&r?s.set("organization_type",r):t==="sector"&&r&&s.set("sector",r);const o=await ae.get(`/api/admin/analytics/export?${s.toString()}`,{responseType:"blob"}),i=new Blob([o.data],{type:"text/csv"}),a=window.URL.createObjectURL(i),l=document.createElement("a");l.href=a,l.download=`analytics_${t}_${n}.csv`,document.body.appendChild(l),l.click(),document.body.removeChild(l),window.URL.revokeObjectURL(a),_n.success("CSV exported successfully")}catch{_n.error("Failed to export CSV")}}}}Bs.register(Fo,zo,Cs,bn,zu,Vu,Fu,Iu);const Nb=["#E6194B","#3CB44B","#4363D8","#F58231","#911EB4","#42D4F4","#F032E6","#469990","#9A6324","#800000","#808000","#000075","#000000"];function k6(){var P,A,O,F,D,U,W,M,H,C,L,E,I,Y;const[e,t]=S.useState("7d"),[n,r]=S.useState("overview"),[s,o]=S.useState(""),{filters:i,loading:a}=b6(),{data:l,loading:u}=v6(n,s,e),{exportCSV:d}=w6(),h=S.useMemo(()=>{var $;const T={Total:"#6B7280"};return($=l==null?void 0:l.endpoint_chart_data)!=null&&$.datasets&&Object.keys(l.endpoint_chart_data.datasets).sort().forEach((ne,ce)=>{T[ne]=Nb[ce%Nb.length]}),T},[l]),[f,p]=S.useState({Total:!0});S.useEffect(()=>{var T;(T=l==null?void 0:l.endpoint_chart_data)!=null&&T.datasets&&p($=>{const q={...$};return Object.keys(l.endpoint_chart_data.datasets).forEach(ne=>{q[ne]===void 0&&(q[ne]=!0)}),q})},[l]);const g=S.useMemo(()=>{var $;const T=[{label:"Total",value:"Total",color:h.Total}];return($=l==null?void 0:l.endpoint_chart_data)!=null&&$.datasets&&Object.keys(l.endpoint_chart_data.datasets).sort().forEach(q=>{T.push({label:q.replace("/v1/",""),value:q,color:h[q]})}),T},[l,h]),m=S.useMemo(()=>Object.keys(f).filter(T=>f[T]!==!1),[f]),y=T=>{const $={};g.forEach(q=>{$[q.value]=T.includes(q.value)}),p($)},x=((P=l==null?void 0:l.endpoint_chart_data)==null?void 0:P.datasets)||{},v={labels:((A=l==null?void 0:l.endpoint_chart_data)==null?void 0:A.labels)||((O=l==null?void 0:l.chart_data)==null?void 0:O.labels)||[],datasets:[...Object.entries(x).map(([T,$])=>({label:T,data:$,borderColor:h[T]||"#6B7280",backgroundColor:"transparent",tension:.4,borderWidth:2,hidden:f[T]===!1})),{label:"Total",data:((F=l==null?void 0:l.chart_data)==null?void 0:F.data)||[],borderColor:"#6B7280",backgroundColor:"transparent",borderWidth:3,tension:.4,hidden:f.Total===!1}]},b={labels:((D=l==null?void 0:l.latency_chart)==null?void 0:D.labels)||[],datasets:[{label:"Avg Latency (ms)",data:((W=(U=l==null?void 0:l.latency_chart)==null?void 0:U.data)==null?void 0:W.map(T=>T*1e3))||[],fill:!0,backgroundColor:T=>{const q=T.chart.ctx.createLinearGradient(0,0,0,200);return q.addColorStop(0,"rgba(59, 130, 246, 0.2)"),q.addColorStop(1,"rgba(59, 130, 246, 0)"),q},borderColor:"#3b82f6",tension:.4}]},k={responsive:!0,maintainAspectRatio:!1,plugins:{legend:{display:!1},tooltip:{mode:"index",intersect:!1,backgroundColor:"rgba(0, 0, 0, 0.8)",titleColor:"#fff",bodyColor:"#fff",borderColor:"rgba(255, 255, 255, 0.1)",borderWidth:1,padding:10}},scales:{x:{grid:{display:!1},ticks:{color:"rgba(156, 163, 175, 0.8)"}},y:{grid:{color:"rgba(156, 163, 175, 0.1)"},ticks:{color:"rgba(156, 163, 175, 0.8)"},beginAtZero:!0}},interaction:{mode:"nearest",axis:"x",intersect:!1}},w=((M=l==null?void 0:l.usage)==null?void 0:M.reduce((T,$)=>T+$.used,0))||0,j=(C=(H=l==null?void 0:l.latency_chart)==null?void 0:H.data)!=null&&C.length?(l.latency_chart.data.reduce((T,$)=>T+$,0)/l.latency_chart.data.length*1e3).toFixed(0):"0",N=(L=l==null?void 0:l.usage)==null?void 0:L.reduce((T,$)=>$.used>((T==null?void 0:T.used)||0)?$:T,null),_=((E=i==null?void 0:i.organizations)==null?void 0:E.length)||0;return u&&!l?c.jsxs("div",{className:"space-y-6",children:[c.jsxs("div",{className:"flex flex-col gap-4",children:[c.jsx(me,{className:"h-8 w-48 mb-2"}),c.jsx(me,{className:"h-10 w-full max-w-xl"})]}),c.jsx("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[1,2,3,4].map(T=>c.jsxs("div",{className:"bg-white dark:bg-secondary p-6 rounded-xl border border-gray-200 dark:border-white/5 shadow-sm",children:[c.jsx(me,{className:"h-8 w-8 rounded-lg mb-4"}),c.jsx(me,{className:"h-8 w-32 mb-1"}),c.jsx(me,{className:"h-3 w-16"})]},T))}),c.jsx(me,{className:"h-[400px] w-full rounded-xl"})]}):c.jsxs("div",{className:"space-y-6",children:[c.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4",children:[c.jsxs("div",{children:[c.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:"Admin Analytics"}),c.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:"Platform-wide API usage and performance analytics."})]}),c.jsxs("button",{onClick:()=>d(n,e,s),className:"flex items-center gap-2 px-4 py-2 bg-primary-600 text-white rounded-lg hover:bg-primary-700 transition-colors text-sm font-medium",children:[c.jsx(X1,{size:16}),"Export CSV"]})]}),c.jsx(x6,{view:n,onViewChange:r,filterValue:s,onFilterValueChange:o,filters:i,filtersLoading:a}),n!=="overview"&&!s&&c.jsxs("div",{className:"text-center py-12 text-gray-500 dark:text-gray-400",children:[c.jsx(U0,{size:48,className:"mx-auto mb-4 opacity-50"}),c.jsx("p",{className:"text-lg font-medium",children:"Select a filter value above to view analytics"})]}),(n==="overview"||s)&&l&&c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[c.jsx(St,{label:"Total Requests",value:w.toLocaleString(),icon:bu,color:"bg-blue-500"}),c.jsx(St,{label:"Avg Latency",value:`${j}ms`,icon:wu,color:"bg-orange-500"}),c.jsx(St,{label:"Most Used",value:((I=N==null?void 0:N.endpoint)==null?void 0:I.replace("/v1/",""))||"N/A",icon:og,color:"bg-purple-500"}),c.jsx(St,{label:"Organizations",value:_,icon:U0,color:"bg-green-500"})]}),c.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[c.jsx("div",{className:"lg:col-span-2",children:c.jsxs(Ms,{title:"Request Volume by Endpoint",description:"Track usage trends across all users",showTimeSelector:!0,timeRange:e,onTimeRangeChange:t,className:"h-[400px]",children:[c.jsx("div",{className:"flex flex-wrap gap-3 mb-4 pb-4 border-b border-gray-200 dark:border-white/10",children:c.jsx(j2,{label:"Select Endpoints",options:g,selected:m,onChange:y})}),c.jsx("div",{className:"flex-1 min-h-0",children:c.jsx(Vo,{options:k,data:v})})]})}),c.jsx(Ms,{title:"Latency Trends",description:"Average response time over the selected period",showTimeSelector:!0,timeRange:e,onTimeRangeChange:t,children:c.jsx("div",{className:"flex-1 min-h-0",children:c.jsx(Vo,{options:k,data:b})})}),c.jsxs("div",{className:"bg-white dark:bg-secondary rounded-xl shadow-md dark:shadow-lg dark:shadow-black/10 border border-gray-200 dark:border-white/5 p-6",children:[c.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-4",children:"Endpoint Breakdown"}),c.jsx("div",{className:"space-y-3",children:(Y=l==null?void 0:l.usage)==null?void 0:Y.filter(T=>T.endpoint!=="unknown").sort((T,$)=>$.used-T.used).map(T=>{const $=w>0?(T.used/w*100).toFixed(1):"0";return c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[c.jsx("div",{className:"w-3 h-3 rounded-full flex-shrink-0",style:{backgroundColor:h[T.endpoint]||"#6B7280"}}),c.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-300",children:T.endpoint.replace("/tasks/","").replace("/tasks","tasks")})]}),c.jsxs("div",{className:"flex items-center gap-4",children:[c.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-white",children:T.used.toLocaleString()}),c.jsxs("span",{className:"text-sm text-gray-500 dark:text-gray-400 w-12 text-right",children:[$,"%"]})]})]},T.endpoint)})})]})]}),(l==null?void 0:l.per_user_breakdown)&&l.per_user_breakdown.length>0&&c.jsxs("div",{className:"bg-white dark:bg-secondary rounded-xl shadow-md dark:shadow-lg dark:shadow-black/10 border border-gray-200 dark:border-white/5 p-6",children:[c.jsxs("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-4",children:["User Breakdown — ",l.organization]}),c.jsx("div",{className:"overflow-x-auto",children:c.jsxs("table",{className:"w-full text-sm",children:[c.jsx("thead",{children:c.jsxs("tr",{className:"border-b border-gray-200 dark:border-white/10",children:[c.jsx("th",{className:"text-left py-3 px-4 font-medium text-gray-500 dark:text-gray-400",children:"Username"}),c.jsx("th",{className:"text-right py-3 px-4 font-medium text-gray-500 dark:text-gray-400",children:"Total Requests"}),c.jsx("th",{className:"text-left py-3 px-4 font-medium text-gray-500 dark:text-gray-400",children:"Top Endpoints"})]})}),c.jsx("tbody",{children:l.per_user_breakdown.map(T=>{const $=Object.entries(T.endpoints).sort(([,q],[,ne])=>ne-q).slice(0,3);return c.jsxs("tr",{className:"border-b border-gray-100 dark:border-white/5 hover:bg-gray-50 dark:hover:bg-white/5",children:[c.jsx("td",{className:"py-3 px-4 text-gray-900 dark:text-white font-medium",children:T.username}),c.jsx("td",{className:"py-3 px-4 text-right text-gray-900 dark:text-white",children:T.total_requests.toLocaleString()}),c.jsx("td",{className:"py-3 px-4",children:c.jsx("div",{className:"flex flex-wrap gap-1",children:$.map(([q,ne])=>c.jsxs("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs bg-gray-100 dark:bg-white/10 text-gray-700 dark:text-gray-300",children:[q.replace("/tasks/",""),": ",ne]},q))})})]},T.username)})})]})})]})]})]})}const HS="/api/admin/analytics/billing";function US(e,t={}){return new URLSearchParams({category:e.category,provider:e.provider,range:e.range,resolution:e.resolution,...t})}function $a(e,t,n={}){const[r,s]=S.useState(null),[o,i]=S.useState(!0),a=JSON.stringify(n),l=S.useCallback(async()=>{var u,d;i(!0);try{const h=US(t,JSON.parse(a)),f=await ae.get(`${HS}${e}?${h.toString()}`);s(f.data)}catch(h){const f=h;_n.error(((d=(u=f.response)==null?void 0:u.data)==null?void 0:d.message)||`Failed to load ${e}`)}finally{i(!1)}},[e,t.category,t.provider,t.range,t.resolution,a]);return S.useEffect(()=>{l()},[l]),{data:r,loading:o}}const S6=e=>$a("/summary",e),_6=e=>$a("/timeseries",e,{group_by:e.groupBy||"provider"}),j6=e=>$a("/providers",e),C6=(e,t,n,r)=>$a("/table",e,{page:String(t),page_size:"50",sort:n,sort_dir:r,...e.search?{search:e.search}:{}}),N6=(e,t)=>$a("/breakdown",e,{group_by:t});function P6(){return{exportCSV:async t=>{try{const n=US(t),r=await ae.get(`${HS}/export?${n.toString()}`,{responseType:"blob"}),s=window.URL.createObjectURL(new Blob([r.data],{type:"text/csv"})),o=document.createElement("a");o.href=s,o.download=`billing_${t.provider}_${t.resolution}.csv`,document.body.appendChild(o),o.click(),document.body.removeChild(o),window.URL.revokeObjectURL(s),_n.success("CSV exported")}catch{_n.error("Failed to export CSV")}}}}Bs.register(Fo,zo,Cs,bn,Ci,zu,Vu,Fu,Iu);const R6=[["today","Today"],["yesterday","Yesterday"],["last_7_days","Last 7 Days"],["last_30_days","Last 30 Days"],["last_90_days","Last 90 Days"],["this_month","This Month"],["last_month","Last Month"]],Pb={runpod:"#4363D8",modal:"#F58231",vastai:"#16A34A"},Rb=["#E6194B","#3CB44B","#4363D8","#F58231","#911EB4","#42D4F4","#F032E6","#469990","#9A6324","#800000"];function E6(){var D,U,W,M,H;const[e,t]=S.useState({category:"inference",provider:"all",range:"last_30_days",resolution:"day"}),[n,r]=S.useState(1),[s,o]=S.useState("cost"),[i,a]=S.useState("desc"),[l,u]=S.useState("object"),[d,h]=S.useState(""),{data:f,loading:p}=S6(e),{data:g}=_6(e),{data:m}=j6(e),{data:y}=C6(e,n,s,i),x=e.category==="cloud"?l:"object",{data:v}=N6(e,x),{exportCSV:b}=P6(),k=((v==null?void 0:v.rows)||[]).filter(C=>C.key.toLowerCase().includes(d.toLowerCase())),w=k.reduce((C,L)=>C+L.cost,0),j=C=>{t(L=>({...L,...C})),r(1)},N=C=>{s===C?a(L=>L==="asc"?"desc":"asc"):(o(C),a("desc")),r(1)},_=C=>s===C?i==="asc"?" ▲":" ▼":"",P=(g==null?void 0:g.cost_by_group)||{},A={labels:(g==null?void 0:g.labels)||[],datasets:[...Object.entries(P).map(([C,L],E)=>({label:C,data:L,borderColor:Pb[C]||Rb[E%Rb.length],backgroundColor:"transparent",borderWidth:2,tension:.4})),{label:"Total",data:(g==null?void 0:g.cost)||[],borderColor:"#6B7280",backgroundColor:"transparent",borderWidth:3,borderDash:[5,5],tension:.4}]},O={labels:(m==null?void 0:m.labels)||[],datasets:[{data:(m==null?void 0:m.cost)||[],backgroundColor:((m==null?void 0:m.labels)||[]).map(C=>Pb[C]||"#6B7280")}]},F={responsive:!0,maintainAspectRatio:!1,plugins:{legend:{display:!0,labels:{color:"rgba(156,163,175,0.9)"}}},scales:{x:{grid:{display:!1},ticks:{color:"rgba(156,163,175,0.8)"}},y:{grid:{color:"rgba(156,163,175,0.1)"},beginAtZero:!0,ticks:{color:"rgba(156,163,175,0.8)"}}}};return p&&!f?c.jsxs("div",{className:"space-y-6",children:[c.jsx(me,{className:"h-8 w-64"}),c.jsx("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[1,2,3,4].map(C=>c.jsx(me,{className:"h-28 rounded-xl"},C))}),c.jsx(me,{className:"h-[400px] w-full rounded-xl"})]}):c.jsxs("div",{className:"space-y-6",children:[c.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4",children:[c.jsxs("div",{children:[c.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:"Infrastructure Billing"}),c.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:e.category==="training"?"Vast.ai training spend, GPU hours, and per-job breakdown.":e.category==="cloud"?"AWS spend by service and usage type, from Cost Explorer.":"Runpod & Modal spend, runtime, and storage analytics."})]}),c.jsxs("button",{onClick:()=>b(e),className:"flex items-center gap-2 px-4 py-2 bg-primary-600 text-white rounded-lg hover:bg-primary-700 text-sm font-medium",children:[c.jsx(X1,{size:16})," Export CSV"]})]}),c.jsx("div",{className:"flex gap-1 border-b border-gray-200 dark:border-white/10",children:[["inference","Inference (Runpod & Modal)",!1],["training","Training (Vast.ai)",!1],["cloud","Cloud (AWS)",!1]].map(([C,L,E])=>c.jsx("button",{disabled:E,onClick:()=>{t(I=>({...I,category:C,provider:"all",groupBy:C==="cloud"?"object":void 0})),r(1)},className:"px-4 py-2 text-sm font-medium border-b-2 -mb-px transition-colors "+(E?"text-gray-300 dark:text-gray-600 cursor-not-allowed border-transparent":e.category===C?"border-primary-600 text-primary-700 dark:text-primary-400":"border-transparent text-gray-500 hover:text-gray-800 dark:hover:text-gray-200"),children:L},C))}),c.jsxs("div",{className:"flex flex-wrap gap-3",children:[e.category==="inference"&&c.jsxs("select",{value:e.provider,onChange:C=>j({provider:C.target.value}),className:"px-3 py-2 rounded-lg border border-gray-200 dark:border-white/10 bg-white dark:bg-secondary text-sm",children:[c.jsx("option",{value:"all",children:"All Platforms"}),c.jsx("option",{value:"runpod",children:"Runpod"}),c.jsx("option",{value:"modal",children:"Modal"})]}),c.jsx("select",{value:e.range,onChange:C=>j({range:C.target.value}),className:"px-3 py-2 rounded-lg border border-gray-200 dark:border-white/10 bg-white dark:bg-secondary text-sm",children:R6.map(([C,L])=>c.jsx("option",{value:C,children:L},C))}),c.jsx("select",{value:e.resolution,onChange:C=>j({resolution:C.target.value}),className:"px-3 py-2 rounded-lg border border-gray-200 dark:border-white/10 bg-white dark:bg-secondary text-sm",children:["hour","day","week","month","year"].map(C=>c.jsx("option",{value:C,children:C[0].toUpperCase()+C.slice(1)},C))})]}),(D=f==null?void 0:f.warnings)==null?void 0:D.map(C=>c.jsx("div",{className:"text-sm text-amber-600 dark:text-amber-400 bg-amber-50 dark:bg-amber-900/20 px-4 py-2 rounded-lg",children:C},C)),c.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[c.jsx(St,{label:"Total Spend",value:`$${((f==null?void 0:f.total_spend)||0).toFixed(2)}`,icon:W0,color:"bg-blue-500"}),c.jsx(St,{label:"Avg Daily Spend",value:`$${((f==null?void 0:f.avg_daily_spend)||0).toFixed(2)}`,icon:W0,color:"bg-green-500"}),c.jsx(St,{label:"GPU Hours",value:`${(((f==null?void 0:f.total_runtime_ms)||0)/36e5).toFixed(1)}h`,icon:wu,color:"bg-orange-500"}),c.jsx(St,{label:"Avg Storage",value:`${((f==null?void 0:f.avg_storage_gb)||0).toFixed(0)} GB`,icon:yR,color:"bg-purple-500"})]}),c.jsxs("details",{className:"bg-white dark:bg-secondary rounded-xl border border-gray-200 dark:border-white/5 p-4 text-sm text-gray-600 dark:text-gray-300",children:[c.jsxs("summary",{className:"flex items-center gap-2 cursor-pointer font-medium text-gray-900 dark:text-white",children:[c.jsx(sg,{size:16})," What these numbers mean & how they're computed"]}),c.jsxs("div",{className:"mt-3 space-y-2 leading-relaxed",children:[c.jsxs("p",{children:[c.jsx("b",{children:"Total / Avg Daily Spend"})," — USD billed by the provider for the selected range and platform(s), summed across all records. Modal amounts are pre-credit (before any credits or reservations), so your invoice may be lower."]}),c.jsxs("p",{children:[c.jsx("b",{children:"GPU Hours"})," — total billed run time, from Runpod's ",c.jsx("code",{children:"timeBilledMs"}),"(worker-time across the period). Modal bills per-app cost and does not report a runtime, so this reflects Runpod only."]}),c.jsxs("p",{children:[c.jsx("b",{children:"Avg Storage (GB)"})," — providers bill storage as ",c.jsx("b",{children:"GB-hours"})," (capacity × hours billed), so a steady 350 GB volume reports 350 × 24 = 8,400 per day. We show the time-weighted average — total GB-hours ÷ hours in the range — as actual provisioned GB. The records table and CSV show the raw per-bucket GB-hours."]}),c.jsxs("p",{children:[c.jsx("b",{children:"Active Endpoints / Modal Apps"})," — distinct Runpod endpoints and Modal apps with billing in the range. ",c.jsx("b",{children:"Network Volumes"})," are account-level storage, not an endpoint, so they're excluded from this count (but included in spend/storage)."]}),c.jsxs("p",{children:[c.jsx("b",{children:"Network Volumes"})," — Runpod persistent network storage cost (",c.jsx("code",{children:"/billing/networkvolumes"}),"), shown as its own row and folded into totals."]}),c.jsxs("p",{children:[c.jsx("b",{children:"Cost Over Time"})," — per-bucket spend with a line per platform plus a dashed Total. Buckets roll up to the selected resolution (hour → year)."]}),c.jsxs("p",{children:[c.jsx("b",{children:"Training (Vast.ai)"})," — Vast.ai bills per contract (a whole job), not per day. We spread each contract's cost and GPU-hours evenly across the days it ran so the charts and totals are smooth and correct; the Training Jobs table lists one row per contract (job/instance) with its total GPU-hours and cost. Storage is billed as cost (not GB), so it appears in spend rather than the storage figure."]}),c.jsxs("p",{children:[c.jsx("b",{children:"Cloud (AWS)"})," — AWS costs come from Cost Explorer (UnblendedCost), broken down by service and usage type. The graph shows cost per service over time; the table toggles between Service and Usage-type and is searchable. Hourly granularity is limited by AWS to the last 14 days. Cost Explorer bills per API request, so figures are cached briefly."]}),c.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"Scope & freshness: Runpod is scoped to the configured endpoints; Modal covers the whole workspace. Figures are cached briefly for consistency, so very recent usage settles within the cache window."})]})]}),c.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[c.jsx("div",{className:"lg:col-span-2",children:c.jsx(Ms,{title:"Cost Over Time",description:"Spend per bucket across selected platforms",className:"h-[400px]",children:c.jsx("div",{className:"flex-1 min-h-0",children:c.jsx(Vo,{options:F,data:A})})})}),c.jsx(Ms,{title:"Spend by Platform",description:e.category==="cloud"?"AWS":e.category==="training"?"Vast.ai":"Runpod vs Modal",children:c.jsx("div",{className:"flex-1 min-h-0 flex items-center justify-center",children:c.jsx(uI,{data:O,options:{responsive:!0,maintainAspectRatio:!1}})})}),c.jsxs("div",{className:"bg-white dark:bg-secondary rounded-xl border border-gray-200 dark:border-white/5 p-6",children:[c.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-2",children:"Highlights"}),c.jsxs("ul",{className:"text-sm text-gray-700 dark:text-gray-300 space-y-2",children:[e.category==="training"?c.jsxs("li",{children:["Active jobs/instances: ",c.jsx("b",{children:(f==null?void 0:f.active_instances)??0})]}):e.category==="cloud"?c.jsxs("li",{children:["Active services: ",c.jsx("b",{children:(f==null?void 0:f.active_services)??0})]}):c.jsxs(c.Fragment,{children:[c.jsxs("li",{children:["Active endpoints: ",c.jsx("b",{children:(f==null?void 0:f.active_endpoints)??0})]}),c.jsxs("li",{children:["Active Modal apps: ",c.jsx("b",{children:(f==null?void 0:f.active_modal_apps)??0})]})]}),c.jsxs("li",{children:["Top endpoint: ",c.jsx("b",{children:((U=f==null?void 0:f.highest_cost_endpoint)==null?void 0:U.name)??"N/A"})," ($",(((W=f==null?void 0:f.highest_cost_endpoint)==null?void 0:W.cost)??0).toFixed(2),")"]}),c.jsxs("li",{children:["Top platform: ",c.jsx("b",{children:((M=f==null?void 0:f.highest_cost_platform)==null?void 0:M.name)??"N/A"})," ($",(((H=f==null?void 0:f.highest_cost_platform)==null?void 0:H.cost)??0).toFixed(2),")"]})]})]})]}),c.jsxs("div",{className:"bg-white dark:bg-secondary rounded-xl border border-gray-200 dark:border-white/5 p-6",children:[c.jsxs("div",{className:"flex items-center justify-between mb-4",children:[c.jsxs("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white flex items-center gap-2",children:[c.jsx(CR,{size:18})," ",e.category==="cloud"?"AWS Cost & Usage":e.category==="training"?"Training Jobs":"Billing Records"]}),e.category==="inference"&&c.jsx("input",{type:"text",placeholder:"Search object / GPU / env...",onChange:C=>j({search:C.target.value||void 0}),className:"px-3 py-2 rounded-lg border border-gray-200 dark:border-white/10 bg-white dark:bg-secondary text-sm"})]}),c.jsx("div",{className:"overflow-x-auto",children:e.category==="cloud"?c.jsxs("div",{children:[c.jsxs("div",{className:"flex items-center justify-between mb-3 gap-3",children:[c.jsx("div",{className:"flex gap-1",children:["object","usage_type"].map(C=>c.jsx("button",{onClick:()=>u(C),className:"px-3 py-1 rounded text-sm "+(l===C?"bg-primary-600 text-white":"bg-gray-100 dark:bg-white/10 text-gray-700 dark:text-gray-300"),children:C==="object"?"By Service":"By Usage Type"},C))}),c.jsx("input",{type:"text",value:d,placeholder:"Search service / usage type...",onChange:C=>h(C.target.value),className:"px-3 py-2 rounded-lg border border-gray-200 dark:border-white/10 bg-white dark:bg-secondary text-sm"})]}),c.jsxs("table",{className:"w-full text-sm",children:[c.jsx("thead",{children:c.jsxs("tr",{className:"border-b border-gray-200 dark:border-white/10 text-left text-gray-500 dark:text-gray-400",children:[c.jsx("th",{className:"py-2 px-3",children:l==="object"?"Service":"Usage Type"}),c.jsx("th",{className:"py-2 px-3 text-right",children:"Cost"}),c.jsx("th",{className:"py-2 px-3 text-right",children:"Share"})]})}),c.jsx("tbody",{children:k.map(C=>c.jsxs("tr",{className:"border-b border-gray-100 dark:border-white/5",children:[c.jsx("td",{className:"py-2 px-3",children:C.key}),c.jsxs("td",{className:"py-2 px-3 text-right",children:["$",C.cost.toFixed(2)]}),c.jsxs("td",{className:"py-2 px-3 text-right",children:[w>0?(C.cost/w*100).toFixed(1):"0.0","%"]})]},C.key))})]})]}):e.category==="training"?c.jsxs("table",{className:"w-full text-sm",children:[c.jsx("thead",{children:c.jsxs("tr",{className:"border-b border-gray-200 dark:border-white/10 text-left text-gray-500 dark:text-gray-400",children:[c.jsx("th",{className:"py-2 px-3",children:"Job / Instance"}),c.jsx("th",{className:"py-2 px-3 text-right",children:"GPU Hours"}),c.jsx("th",{className:"py-2 px-3 text-right",children:"Cost"})]})}),c.jsx("tbody",{children:((v==null?void 0:v.rows)||[]).map(C=>c.jsxs("tr",{className:"border-b border-gray-100 dark:border-white/5",children:[c.jsx("td",{className:"py-2 px-3",children:C.key}),c.jsxs("td",{className:"py-2 px-3 text-right",children:[(C.runtime_ms/36e5).toFixed(1),"h"]}),c.jsxs("td",{className:"py-2 px-3 text-right",children:["$",C.cost.toFixed(3)]})]},C.key))})]}):c.jsxs("table",{className:"w-full text-sm",children:[c.jsx("thead",{children:c.jsxs("tr",{className:"border-b border-gray-200 dark:border-white/10 text-left text-gray-500 dark:text-gray-400",children:[c.jsx("th",{className:"py-2 px-3",children:"Provider"}),c.jsx("th",{className:"py-2 px-3",children:"Object"}),c.jsxs("th",{className:"py-2 px-3 cursor-pointer select-none hover:text-gray-700 dark:hover:text-gray-200",onClick:()=>N("timestamp"),children:["Date",_("timestamp")]}),c.jsxs("th",{className:"py-2 px-3 text-right cursor-pointer select-none hover:text-gray-700 dark:hover:text-gray-200",onClick:()=>N("cost"),children:["Cost",_("cost")]}),c.jsx("th",{className:"py-2 px-3",children:"GPU"}),c.jsx("th",{className:"py-2 px-3",children:"Env"})]})}),c.jsx("tbody",{children:((y==null?void 0:y.rows)||[]).map((C,L)=>c.jsxs("tr",{className:"border-b border-gray-100 dark:border-white/5",children:[c.jsx("td",{className:"py-2 px-3",children:C.provider}),c.jsx("td",{className:"py-2 px-3",children:C.object_name}),c.jsx("td",{className:"py-2 px-3",children:C.timestamp.slice(0,10)}),c.jsxs("td",{className:"py-2 px-3 text-right",children:["$",C.cost.toFixed(4)]}),c.jsx("td",{className:"py-2 px-3",children:C.gpu||"-"}),c.jsx("td",{className:"py-2 px-3",children:C.environment||"-"})]},`${C.provider}-${C.object_name}-${C.timestamp}-${L}`))})]})}),e.category==="inference"&&c.jsxs("div",{className:"flex items-center justify-between mt-4 text-sm text-gray-500 dark:text-gray-400",children:[c.jsxs("span",{children:[(y==null?void 0:y.total)??0," records"]}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx("button",{disabled:n<=1,onClick:()=>r(C=>C-1),className:"px-3 py-1 rounded border border-gray-200 dark:border-white/10 disabled:opacity-40",children:"Prev"}),c.jsx("button",{disabled:!y||n*y.page_size>=y.total,onClick:()=>r(C=>C+1),className:"px-3 py-1 rounded border border-gray-200 dark:border-white/10 disabled:opacity-40",children:"Next"})]})]})]})]})}const Gf="/api/admin/google-analytics";function T6(){const[e,t]=S.useState([]),[n,r]=S.useState(!0),[s,o]=S.useState(!1);return S.useEffect(()=>{let i=!1;return(async()=>{var a;try{const{data:l}=await ae.get(`${Gf}/properties`);i||t(l.properties)}catch(l){((a=l==null?void 0:l.response)==null?void 0:a.status)===503?i||o(!0):_n.error("Failed to load GA properties")}finally{i||r(!1)}})(),()=>{i=!0}},[]),{properties:e,loading:n,notConfigured:s}}function A6(e,t){const[n,r]=S.useState(null),[s,o]=S.useState(!1),[i,a]=S.useState(null),l=S.useCallback(async(u=!1)=>{var d,h;if(e){o(!0),a(null);try{const f=u?`${Gf}/refresh`:`${Gf}/overview`,{data:p}=await ae({method:u?"post":"get",url:f,params:{property_id:e,time_range:t}});r(p)}catch(f){const p=((h=(d=f==null?void 0:f.response)==null?void 0:d.data)==null?void 0:h.detail)||"Failed to load analytics";a(typeof p=="string"?p:"Failed to load analytics"),_n.error(typeof p=="string"?p:"Failed to load analytics")}finally{o(!1)}}},[e,t]);return S.useEffect(()=>{l(!1)},[l]),{data:n,loading:s,error:i,refresh:()=>l(!0)}}function M6({series:e}){const t={labels:e.labels,datasets:[{label:"Active users",data:e.active_users,borderColor:"#3b82f6",backgroundColor:"rgba(59,130,246,0.15)",tension:.4},{label:"New users",data:e.new_users,borderColor:"#10b981",backgroundColor:"rgba(16,185,129,0.1)",tension:.4},{label:"Sessions",data:e.sessions,borderColor:"#f59e0b",backgroundColor:"rgba(245,158,11,0.1)",tension:.4}]},n={responsive:!0,maintainAspectRatio:!1,plugins:{legend:{position:"top"}},interaction:{mode:"index",intersect:!1},scales:{y:{beginAtZero:!0,grid:{color:"rgba(156,163,175,0.1)"}},x:{grid:{display:!1}}}};return c.jsx("div",{className:"h-[300px]",children:c.jsx(Vo,{data:t,options:n})})}function L6({pages:e}){return e.length?c.jsx("div",{className:"overflow-x-auto",children:c.jsxs("table",{className:"w-full text-sm",children:[c.jsx("thead",{children:c.jsxs("tr",{className:"border-b border-gray-200 dark:border-white/10 text-left",children:[c.jsx("th",{className:"py-2 px-3 font-medium text-gray-500 dark:text-gray-400",children:"Page"}),c.jsx("th",{className:"py-2 px-3 font-medium text-gray-500 dark:text-gray-400 text-right",children:"Views"}),c.jsx("th",{className:"py-2 px-3 font-medium text-gray-500 dark:text-gray-400 text-right",children:"Users"}),c.jsx("th",{className:"py-2 px-3 font-medium text-gray-500 dark:text-gray-400 text-right",children:"Avg duration"})]})}),c.jsx("tbody",{children:e.map(t=>c.jsxs("tr",{className:"border-b border-gray-100 dark:border-white/5 hover:bg-gray-50 dark:hover:bg-white/5",children:[c.jsxs("td",{className:"py-2 px-3",children:[c.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:t.title||t.path}),c.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:t.path})]}),c.jsx("td",{className:"py-2 px-3 text-right text-gray-900 dark:text-white",children:t.views.toLocaleString()}),c.jsx("td",{className:"py-2 px-3 text-right text-gray-900 dark:text-white",children:t.users.toLocaleString()}),c.jsxs("td",{className:"py-2 px-3 text-right text-gray-700 dark:text-gray-300",children:[t.avg_duration.toFixed(1),"s"]})]},t.path))})]})}):c.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"No page views in this range."})}function sh({title:e,rows:t}){const n=t.reduce((r,s)=>r+s.users,0);return c.jsxs("div",{children:[c.jsx("h4",{className:"text-sm font-semibold text-gray-700 dark:text-gray-200 mb-2",children:e}),t.length===0?c.jsx("p",{className:"text-xs text-gray-500",children:"No data."}):c.jsx("ul",{className:"space-y-1",children:t.map(r=>{const s=n?(r.users/n*100).toFixed(1):"0";return c.jsxs("li",{className:"flex items-center justify-between text-sm",children:[c.jsx("span",{className:"text-gray-700 dark:text-gray-300",children:r.label}),c.jsxs("span",{className:"text-gray-900 dark:text-white font-medium",children:[r.users.toLocaleString()," ",c.jsxs("span",{className:"text-xs text-gray-500",children:["(",s,"%)"]})]})]},r.label)})})]})}function O6({platforms:e}){return c.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[c.jsx(sh,{title:"Device",rows:e.device}),c.jsx(sh,{title:"Operating system",rows:e.os}),c.jsx(sh,{title:"Browser",rows:e.browser})]})}function D6({rows:e}){return e.length?c.jsx("div",{className:"overflow-x-auto",children:c.jsxs("table",{className:"w-full text-sm",children:[c.jsx("thead",{children:c.jsxs("tr",{className:"border-b border-gray-200 dark:border-white/10 text-left",children:[c.jsx("th",{className:"py-2 px-3 font-medium text-gray-500 dark:text-gray-400",children:"Country"}),c.jsx("th",{className:"py-2 px-3 font-medium text-gray-500 dark:text-gray-400",children:"City"}),c.jsx("th",{className:"py-2 px-3 font-medium text-gray-500 dark:text-gray-400 text-right",children:"Users"}),c.jsx("th",{className:"py-2 px-3 font-medium text-gray-500 dark:text-gray-400 text-right",children:"Sessions"})]})}),c.jsx("tbody",{children:e.map(t=>c.jsxs("tr",{className:"border-b border-gray-100 dark:border-white/5 hover:bg-gray-50 dark:hover:bg-white/5",children:[c.jsx("td",{className:"py-2 px-3 text-gray-900 dark:text-white",children:t.country||"—"}),c.jsx("td",{className:"py-2 px-3 text-gray-700 dark:text-gray-300",children:t.city||"—"}),c.jsx("td",{className:"py-2 px-3 text-right text-gray-900 dark:text-white",children:t.users.toLocaleString()}),c.jsx("td",{className:"py-2 px-3 text-right text-gray-700 dark:text-gray-300",children:t.sessions.toLocaleString()})]},`${t.country}-${t.city}`))})]})}):c.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"No geographic data."})}function I6({events:e}){return e.length?c.jsxs("table",{className:"w-full text-sm",children:[c.jsx("thead",{children:c.jsxs("tr",{className:"border-b border-gray-200 dark:border-white/10 text-left",children:[c.jsx("th",{className:"py-2 px-3 font-medium text-gray-500 dark:text-gray-400",children:"Event"}),c.jsx("th",{className:"py-2 px-3 font-medium text-gray-500 dark:text-gray-400 text-right",children:"Count"}),c.jsx("th",{className:"py-2 px-3 font-medium text-gray-500 dark:text-gray-400 text-right",children:"Users"})]})}),c.jsx("tbody",{children:e.map(t=>c.jsxs("tr",{className:"border-b border-gray-100 dark:border-white/5 hover:bg-gray-50 dark:hover:bg-white/5",children:[c.jsx("td",{className:"py-2 px-3 text-gray-900 dark:text-white font-mono text-xs",children:t.name}),c.jsx("td",{className:"py-2 px-3 text-right text-gray-900 dark:text-white",children:t.count.toLocaleString()}),c.jsx("td",{className:"py-2 px-3 text-right text-gray-700 dark:text-gray-300",children:t.users.toLocaleString()})]},t.name))})]}):c.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"No events in this range."})}Bs.register(Fo,zo,Cs,bn,zu,Vu,Fu,Iu);const F6=[{label:"Last 24h",value:"24h"},{label:"Last 7 days",value:"7d"},{label:"Last 30 days",value:"30d"},{label:"Last 60 days",value:"60d"},{label:"Last 90 days",value:"90d"}];function z6(){const{properties:e,loading:t,notConfigured:n}=T6(),[r,s]=x1(),o=r.get("property")||"",i=r.get("range")||"7d";S.useEffect(()=>{!o&&e.length>0&&s({property:e[0].id,range:i},{replace:!0})},[e,o,i,s]);const{data:a,loading:l,error:u,refresh:d}=A6(o,i),h=S.useMemo(()=>{if(!a)return null;const f=g=>g.reduce((m,y)=>m+y,0),p=g=>g.length?f(g)/g.length:0;return{users:f(a.traffic.active_users),sessions:f(a.traffic.sessions),engagementRate:p(a.traffic.engagement_rate),avgSessionSec:p(a.traffic.avg_session_duration)}},[a]);return n?c.jsx("div",{className:"text-center py-12",children:c.jsxs("p",{className:"text-gray-500 dark:text-gray-400",children:["Google Analytics is not configured. See ",c.jsx("code",{children:"docs/google-analytics.md"}),"."]})}):t?c.jsxs("div",{className:"space-y-6",children:[c.jsx(me,{className:"h-8 w-48"}),c.jsx(me,{className:"h-10 w-full max-w-xl"}),c.jsx(me,{className:"h-[400px] w-full rounded-xl"})]}):c.jsxs("div",{className:"space-y-6",children:[c.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4",children:[c.jsxs("div",{children:[c.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:"Google Analytics"}),c.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:"Site & app analytics for Sunbird properties."})]}),c.jsxs("button",{onClick:()=>{d(),_n.info("Refreshing from Google Analytics…")},disabled:l,className:"flex items-center gap-2 px-4 py-2 bg-primary-600 text-white rounded-lg hover:bg-primary-700 disabled:opacity-50 transition-colors text-sm font-medium",children:[c.jsx(jR,{size:16,className:l?"animate-spin":""}),"Refresh"]})]}),c.jsxs("div",{className:"flex flex-wrap gap-3 items-center",children:[c.jsx("select",{value:o,onChange:f=>s({property:f.target.value,range:i}),className:"px-3 py-2 rounded-lg border border-gray-200 dark:border-white/10 bg-white dark:bg-secondary text-sm",children:e.map(f=>c.jsx("option",{value:f.id,children:f.name},f.id))}),c.jsx("select",{value:i,onChange:f=>s({property:o,range:f.target.value}),className:"px-3 py-2 rounded-lg border border-gray-200 dark:border-white/10 bg-white dark:bg-secondary text-sm",children:F6.map(f=>c.jsx("option",{value:f.value,children:f.label},f.value))}),a&&c.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400 ml-auto",children:["Cached until ",new Date(a.cached_until).toLocaleTimeString()]})]}),l&&!a&&c.jsx(me,{className:"h-[400px] w-full rounded-xl"}),u&&!a&&c.jsx("div",{className:"p-4 rounded-lg bg-red-50 dark:bg-red-900/20 text-red-700 dark:text-red-300 text-sm",children:u}),a&&h&&c.jsxs(c.Fragment,{children:[a.partial&&c.jsxs("div",{className:"p-3 rounded-lg bg-amber-50 dark:bg-amber-900/20 text-amber-800 dark:text-amber-200 text-sm",children:["Some reports failed to load: ",a.failed_reports.join(", "),"."]}),c.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[c.jsx(St,{label:"Users",value:h.users.toLocaleString(),icon:nk,color:"bg-blue-500"}),c.jsx(St,{label:"Sessions",value:h.sessions.toLocaleString(),icon:bu,color:"bg-orange-500"}),c.jsx(St,{label:"Engagement",value:`${(h.engagementRate*100).toFixed(1)}%`,icon:og,color:"bg-purple-500"}),c.jsx(St,{label:"Avg session",value:`${h.avgSessionSec.toFixed(0)}s`,icon:wu,color:"bg-green-500"})]}),c.jsx(Ms,{title:"Traffic over time",description:`Active users, new users, sessions for ${a.property_name}`,className:"h-[400px]",children:c.jsx(M6,{series:a.traffic})}),c.jsxs("div",{className:"bg-white dark:bg-secondary rounded-xl shadow-md border border-gray-200 dark:border-white/5 p-6",children:[c.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-4",children:"Top pages"}),c.jsx(L6,{pages:a.top_pages})]}),c.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[c.jsxs("div",{className:"bg-white dark:bg-secondary rounded-xl shadow-md border border-gray-200 dark:border-white/5 p-6",children:[c.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-4",children:"Platforms"}),c.jsx(O6,{platforms:a.platforms})]}),c.jsxs("div",{className:"bg-white dark:bg-secondary rounded-xl shadow-md border border-gray-200 dark:border-white/5 p-6",children:[c.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-4",children:"Geography"}),c.jsx(D6,{rows:a.geography})]})]}),c.jsxs("div",{className:"bg-white dark:bg-secondary rounded-xl shadow-md border border-gray-200 dark:border-white/5 p-6",children:[c.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-4",children:"Top events"}),c.jsx(I6,{events:a.events})]})]})]})}const oh="https://insights.hotjar.com",V6=["info@sunbird.ai","analytics@sunbird.ai"],B6=[{name:"Heatmaps",icon:Q1,color:"bg-orange-500",description:"Aggregate click, move, scroll, and rage-click maps overlaid on each page. Shows where visitors focus attention and where they drop off.",useFor:"Spot unclicked CTAs, dead zones, and content that never gets scrolled into view."},{name:"Session Recordings",icon:SR,color:"bg-red-500",description:"Replay real user sessions with cursor movement, clicks, taps, scrolls, and form interactions. Filter by country, device, page, rage click, or u-turn.",useFor:"Debug confusing UX, watch how real users navigate sign-up, and confirm a bug is reproducible in the wild."},{name:"Funnels",icon:pR,color:"bg-purple-500",description:"Multi-step conversion funnels defined by URL patterns or events. Drop-off rate is shown per step with linked recordings for each stage.",useFor:"Measure landing-page → register → first API call conversion, and watch recordings of users who dropped off."},{name:"Surveys",icon:Jl,color:"bg-blue-500",description:"On-site and link surveys (NPS, CSAT, CES, exit-intent, custom). Trigger on URL, time on page, scroll depth, or exit intent.",useFor:'Ask "What were you hoping to find?" on pages with high bounce, or NPS on the dashboard.'},{name:"Feedback Widget",icon:RR,color:"bg-green-500",description:"Inline rating widget (0–5 stars / emoji) pinned to any page. Visitors pick a rating, leave a comment, and optionally highlight the exact element they are commenting on.",useFor:"Passive, continuous sentiment signal per page. Great for the pricing and docs pages."},{name:"Trends & Dashboards",icon:Z1,color:"bg-indigo-500",description:"Aggregate trends over time: page-level NPS, CSAT, feedback score, rage clicks, u-turns, conversion rate. Composable dashboards.",useFor:"Track whether the last release moved the needle on rage-clicks or feedback scores."},{name:"User Attributes",icon:TR,color:"bg-teal-500",description:"Custom identifiers (user_id, plan, organization, role) sent via the Hotjar JS SDK and used to filter and segment every other tool.",useFor:'Filter recordings to "admin users on the Speech product who hit an error" without leaking PII.'},{name:"Engage (Interviews)",icon:nk,color:"bg-pink-500",description:"Schedule moderated user interviews with calendar integration and automatic incentive delivery. Recruit from the existing visitor pool.",useFor:"Book a live session with a real user who just rage-clicked the upload flow."},{name:"Integrations",icon:LR,color:"bg-amber-500",description:"Native integrations with Slack, Jira, Linear, Microsoft Teams, Google Analytics, Segment, HubSpot, Zapier, and more.",useFor:"Pipe new survey responses into the #product Slack channel, or link a recording to a Jira ticket."}];function $6(){return c.jsxs("div",{className:"space-y-6",children:[c.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4",children:[c.jsxs("div",{children:[c.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:"Website & Engagement Funnel"}),c.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:"Qualitative website insights for all Sunbird products, powered by Hotjar."})]}),c.jsxs("a",{href:oh,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 px-4 py-2 bg-primary-600 text-white rounded-lg hover:bg-primary-700 transition-colors text-sm font-medium shadow-sm",children:["Open Hotjar Insights",c.jsx(Hn,{size:16})]})]}),c.jsxs("div",{className:"flex items-start gap-3 p-4 rounded-xl bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800/40 text-amber-900 dark:text-amber-100 text-sm",children:[c.jsx(sg,{size:18,className:"flex-shrink-0 mt-0.5"}),c.jsxs("div",{children:[c.jsx("p",{className:"font-medium",children:"Why open Hotjar instead of viewing the data here?"}),c.jsx("p",{className:"mt-1 text-amber-800 dark:text-amber-200/90",children:"Hotjar's public API only exposes a limited subset of administrative data (users, sites, survey metadata). Heatmaps, recordings, funnel drop-offs, and survey responses are only viewable inside the Hotjar dashboard. We therefore link out rather than maintain a partial mirror that would miss the highest-value insights."})]})]}),c.jsx(Lo.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"bg-white dark:bg-secondary rounded-xl shadow-sm border border-gray-100 dark:border-white/5 p-6",children:c.jsxs("div",{className:"flex items-start gap-3",children:[c.jsx("div",{className:"p-2 rounded-lg bg-primary-500 bg-opacity-10 dark:bg-opacity-20",children:c.jsx(Jn,{className:"w-5 h-5 text-primary-600 dark:text-primary-400"})}),c.jsxs("div",{className:"flex-1",children:[c.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"How to sign in"}),c.jsxs("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:["Hotjar access is tied to two shared Sunbird Google accounts. Use",c.jsx("span",{className:"font-medium",children:" Sign in with Google"})," — do not sign up with a new email."]}),c.jsxs("ol",{className:"mt-4 space-y-3 text-sm text-gray-700 dark:text-gray-300",children:[c.jsxs("li",{className:"flex gap-3",children:[c.jsx("span",{className:"flex-shrink-0 w-6 h-6 rounded-full bg-primary-50 dark:bg-primary-900/40 text-primary-700 dark:text-primary-300 flex items-center justify-center text-xs font-semibold",children:"1"}),c.jsxs("span",{children:["Open"," ",c.jsx("a",{href:oh,target:"_blank",rel:"noopener noreferrer",className:"text-primary-600 dark:text-primary-400 hover:underline font-medium",children:"insights.hotjar.com"}),"."]})]}),c.jsxs("li",{className:"flex gap-3",children:[c.jsx("span",{className:"flex-shrink-0 w-6 h-6 rounded-full bg-primary-50 dark:bg-primary-900/40 text-primary-700 dark:text-primary-300 flex items-center justify-center text-xs font-semibold",children:"2"}),c.jsxs("span",{children:["Click ",c.jsx("span",{className:"font-medium",children:"Sign in with Google"})," and choose one of the shared accounts below."]})]}),c.jsxs("li",{className:"flex gap-3",children:[c.jsx("span",{className:"flex-shrink-0 w-6 h-6 rounded-full bg-primary-50 dark:bg-primary-900/40 text-primary-700 dark:text-primary-300 flex items-center justify-center text-xs font-semibold",children:"3"}),c.jsx("span",{children:"Pick the site (Sunflower, Sunbird Speech, etc.) from the organization switcher in the top-left."})]})]}),c.jsx("div",{className:"mt-5 grid grid-cols-1 sm:grid-cols-2 gap-3",children:V6.map(e=>c.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg border border-gray-200 dark:border-white/10 bg-gray-50 dark:bg-black/20",children:[c.jsx("div",{className:"p-2 rounded-md bg-primary-50 dark:bg-primary-900/30",children:c.jsx(ku,{className:"w-4 h-4 text-primary-600 dark:text-primary-400"})}),c.jsxs("div",{className:"min-w-0",children:[c.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Shared Google account"}),c.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-white truncate",children:e})]})]},e))}),c.jsxs("p",{className:"mt-4 text-xs text-gray-500 dark:text-gray-400",children:["Credentials are managed in 1Password under ",c.jsx("em",{children:"Sunbird / Hotjar"}),". If you need access, ask an admin to add your email to the shared vault."]})]})]})}),c.jsxs("div",{children:[c.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"What you'll find in Hotjar"}),c.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:"A quick guide to each tool and the kind of question it answers."}),c.jsx("div",{className:"mt-4 grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4",children:B6.map((e,t)=>c.jsxs(Lo.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:t*.04},className:"bg-white dark:bg-secondary p-5 rounded-xl shadow-sm border border-gray-100 dark:border-white/5 hover:border-primary-500/30 transition-colors group flex flex-col",children:[c.jsx("div",{className:`p-2 rounded-lg w-fit ${e.color} bg-opacity-10 dark:bg-opacity-20 group-hover:scale-110 transition-transform`,children:c.jsx(e.icon,{className:`w-5 h-5 ${e.color.replace("bg-","text-")}`})}),c.jsx("h3",{className:"mt-3 text-base font-semibold text-gray-900 dark:text-white",children:e.name}),c.jsx("p",{className:"mt-2 text-sm text-gray-600 dark:text-gray-300 leading-relaxed",children:e.description}),c.jsxs("div",{className:"mt-3 pt-3 border-t border-gray-100 dark:border-white/5",children:[c.jsx("p",{className:"text-xs uppercase tracking-wide text-gray-400 dark:text-gray-500 font-medium",children:"Use it for"}),c.jsx("p",{className:"mt-1 text-xs text-gray-600 dark:text-gray-400",children:e.useFor})]})]},e.name))})]}),c.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4 p-5 rounded-xl border border-gray-200 dark:border-white/10 bg-gray-50 dark:bg-black/20",children:[c.jsxs("div",{children:[c.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"Ready to dig in?"}),c.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1",children:"Open Hotjar in a new tab and pick the product you want to investigate."})]}),c.jsxs("a",{href:oh,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 px-4 py-2 bg-primary-600 text-white rounded-lg hover:bg-primary-700 transition-colors text-sm font-medium",children:["Go to Hotjar Insights",c.jsx(Hn,{size:16})]})]})]})}function Hu(){const{theme:e,setTheme:t}=H1(),{isAuthenticated:n}=Qr(),[r,s]=S.useState(!1);return c.jsxs("nav",{className:"fixed top-0 w-full z-50 bg-white/80 dark:bg-black/80 backdrop-blur-md border-b border-gray-200 dark:border-white/10",children:[c.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:c.jsxs("div",{className:"flex justify-between h-16 items-center",children:[c.jsxs(Ee,{to:"/",className:"flex items-center gap-2 font-bold text-xl text-gray-900 dark:text-white",children:[c.jsx("img",{src:"/logo.png",className:"w-8 h-8 object-cover",alt:"Sunbird AI"}),c.jsx("span",{children:"Sunbird AI"})]}),c.jsxs("div",{className:"hidden md:flex items-center gap-8",children:[c.jsx("a",{href:"https://docs.sunbird.ai",target:"_blank",rel:"noopener noreferrer",className:"text-sm font-medium text-gray-700 hover:text-primary-600 dark:text-gray-300 dark:hover:text-primary-400 transition-colors",children:"Documentation"}),c.jsx("a",{href:"https://github.com/SunbirdAI/sunbird-ai-api",target:"_blank",rel:"noopener noreferrer",className:"text-sm font-medium text-gray-700 hover:text-primary-600 dark:text-gray-300 dark:hover:text-primary-400 transition-colors",children:"GitHub"}),c.jsx("a",{href:"https://sunflower.sunbird.ai",target:"_blank",rel:"noopener noreferrer",className:"text-sm font-medium text-gray-700 hover:text-primary-600 dark:text-gray-300 dark:hover:text-primary-400 transition-colors",children:"Sunflower"})]}),c.jsxs("div",{className:"hidden md:flex items-center gap-4",children:[c.jsx("button",{onClick:()=>t(e==="dark"?"light":"dark"),className:"p-2 rounded-full hover:bg-gray-100 dark:hover:bg-white/10 text-gray-500 dark:text-gray-400 transition-colors","aria-label":"Toggle theme",children:e==="dark"?c.jsx(pf,{size:20}):c.jsx(ff,{size:20})}),c.jsx("div",{className:"h-6 w-px bg-gray-200 dark:bg-white/10 mx-2"}),n?c.jsx(Ee,{to:"/dashboard",className:"px-4 py-2 rounded-lg bg-primary-600 hover:bg-primary-700 text-white text-sm font-medium transition-colors shadow-lg shadow-primary-500/20",children:"Dashboard"}):c.jsxs(c.Fragment,{children:[c.jsx(Ee,{to:"/login",className:"text-sm font-medium text-gray-700 hover:text-primary-600 dark:text-gray-300 dark:hover:text-primary-400 transition-colors",children:"Log in"}),c.jsx(Ee,{to:"/register",className:"px-4 py-2 rounded-lg bg-primary-600 hover:bg-primary-700 text-white text-sm font-medium transition-colors shadow-lg shadow-primary-500/20",children:"Sign Up"})]})]}),c.jsxs("div",{className:"flex items-center gap-4 md:hidden",children:[c.jsx("button",{onClick:()=>t(e==="dark"?"light":"dark"),className:"p-2 rounded-full hover:bg-gray-100 dark:hover:bg-white/10 text-gray-500 dark:text-gray-400 transition-colors",children:e==="dark"?c.jsx(pf,{size:20}):c.jsx(ff,{size:20})}),c.jsx("button",{onClick:()=>s(!r),className:"p-2 rounded-lg text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-white/10",children:r?c.jsx(Su,{size:24}):c.jsx(ek,{size:24})})]})]})}),c.jsx(QT,{children:r&&c.jsx(Lo.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:"md:hidden bg-white dark:bg-black border-b border-gray-200 dark:border-white/10 overflow-hidden",children:c.jsxs("div",{className:"px-4 pt-2 pb-6 space-y-2",children:[c.jsx("a",{href:"https://docs.sunbird.ai",className:"block px-3 py-2 rounded-md text-base font-medium text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-white/5",children:"Documentation"}),c.jsx("a",{href:"https://github.com/SunbirdAI/sunbird-ai-api",className:"block px-3 py-2 rounded-md text-base font-medium text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-white/5",children:"GitHub"}),c.jsx("a",{href:"https://sunflower.sunbird.ai",className:"block px-3 py-2 rounded-md text-base font-medium text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-white/5",children:"Sunflower"}),c.jsx("div",{className:"pt-4 mt-4 border-t border-gray-200 dark:border-white/10",children:n?c.jsx(Ee,{to:"/dashboard",className:"block w-full text-center px-4 py-2 rounded-lg bg-primary-600 text-white font-medium",children:"Dashboard"}):c.jsxs(c.Fragment,{children:[c.jsx(Ee,{to:"/login",className:"block w-full text-center px-4 py-2 rounded-lg border border-gray-300 dark:border-white/10 text-gray-700 dark:text-gray-300 font-medium mb-3",children:"Log in"}),c.jsx(Ee,{to:"/register",className:"block w-full text-center px-4 py-2 rounded-lg bg-primary-600 text-white font-medium",children:"Sign Up"})]})})]})})})]})}function Uu(){return c.jsxs("footer",{className:"border-t border-gray-200 dark:border-white/10 bg-gray-50 dark:bg-black",children:[c.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-12",children:c.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-5 gap-8",children:[c.jsxs("div",{className:"lg:col-span-2",children:[c.jsxs("div",{className:"flex items-center gap-2 font-bold text-xl text-gray-900 dark:text-white mb-4",children:[c.jsx("img",{src:"/logo.png",className:"w-8 h-8 object-cover",alt:"Sunbird AI"}),c.jsx("span",{children:"Sunbird AI"})]}),c.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-4 max-w-sm",children:"Empowering African languages with state-of-the-art AI models for translation, transcription, and speech synthesis."}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx("a",{href:"https://twitter.com/sunbirdai",target:"_blank",rel:"noopener noreferrer","aria-label":"Twitter",children:c.jsx("svg",{className:"w-5 h-5 bg-gray-400 dark:bg-gray-500 hover:bg-gray-500 dark:hover:bg-gray-400",style:{WebkitMaskImage:"url(https://d3gk2c5xim1je2.cloudfront.net/v7.1.0/brands/x-twitter.svg)",WebkitMaskRepeat:"no-repeat",WebkitMaskPosition:"center",maskImage:"url(https://d3gk2c5xim1je2.cloudfront.net/v7.1.0/brands/x-twitter.svg)",maskRepeat:"no-repeat",maskPosition:"center"}})}),c.jsx("a",{href:"https://github.com/SunbirdAI",target:"_blank",rel:"noopener noreferrer","aria-label":"GitHub",children:c.jsx("svg",{className:"w-5 h-5 bg-gray-400 dark:bg-gray-500 hover:bg-gray-500 dark:hover:bg-gray-400",style:{WebkitMaskImage:"url(https://d3gk2c5xim1je2.cloudfront.net/v7.1.0/brands/github.svg)",WebkitMaskRepeat:"no-repeat",WebkitMaskPosition:"center",maskImage:"url(https://d3gk2c5xim1je2.cloudfront.net/v7.1.0/brands/github.svg)",maskRepeat:"no-repeat",maskPosition:"center"}})}),c.jsxs("a",{href:"https://www.linkedin.com/company/sunbird-ai",target:"_blank",rel:"noopener noreferrer","aria-label":"LinkedIn",children:[c.jsx("svg",{className:"w-5 h-5 bg-gray-400 dark:bg-gray-500 hover:bg-gray-500 dark:hover:bg-gray-400",style:{WebkitMaskImage:"url(https://d3gk2c5xim1je2.cloudfront.net/v7.1.0/brands/linkedin.svg)",WebkitMaskRepeat:"no-repeat",WebkitMaskPosition:"center",maskImage:"url(https://d3gk2c5xim1je2.cloudfront.net/v7.1.0/brands/linkedin.svg)",maskRepeat:"no-repeat",maskPosition:"center"}})," "]})]})]}),c.jsxs("div",{children:[c.jsx("h3",{className:"font-semibold text-gray-900 dark:text-white mb-4",children:"Resources"}),c.jsxs("ul",{className:"space-y-3",children:[c.jsx("li",{children:c.jsx("a",{href:"https://docs.sunbird.ai",target:"_blank",rel:"noopener noreferrer",className:"text-sm text-gray-600 dark:text-gray-400 hover:text-primary-600 dark:hover:text-primary-400 transition-colors",children:"Documentation"})}),c.jsx("li",{children:c.jsx("a",{href:"https://github.com/SunbirdAI/sunbird-ai-api",target:"_blank",rel:"noopener noreferrer",className:"text-sm text-gray-600 dark:text-gray-400 hover:text-primary-600 dark:hover:text-primary-400 transition-colors",children:"API Reference"})}),c.jsx("li",{children:c.jsx("a",{href:"https://github.com/SunbirdAI/translation-api-examples",target:"_blank",rel:"noopener noreferrer",className:"text-sm text-gray-600 dark:text-gray-400 hover:text-primary-600 dark:hover:text-primary-400 transition-colors",children:"Code Examples"})}),c.jsx("li",{children:c.jsx("a",{href:"https://github.com/SunbirdAI/sunbird-ai-api/blob/main/tutorial.md",target:"_blank",rel:"noopener noreferrer",className:"text-sm text-gray-600 dark:text-gray-400 hover:text-primary-600 dark:hover:text-primary-400 transition-colors",children:"Tutorial"})})]})]}),c.jsxs("div",{children:[c.jsx("h3",{className:"font-semibold text-gray-900 dark:text-white mb-4",children:"Products"}),c.jsxs("ul",{className:"space-y-3",children:[c.jsx("li",{children:c.jsx("a",{href:"https://sunflower.sunbird.ai",target:"_blank",rel:"noopener noreferrer",className:"text-sm text-gray-600 dark:text-gray-400 hover:text-primary-600 dark:hover:text-primary-400 transition-colors",children:"Sunflower"})}),c.jsx("li",{children:c.jsx(Ee,{to:"https://sunflower.sunbird.ai",className:"text-sm text-gray-600 dark:text-gray-400 hover:text-primary-600 dark:hover:text-primary-400 transition-colors",children:"Translation"})}),c.jsx("li",{children:c.jsx(Ee,{to:"https://speech.sunbird.ai",className:"text-sm text-gray-600 dark:text-gray-400 hover:text-primary-600 dark:hover:text-primary-400 transition-colors",children:"Speech"})})]})]}),c.jsxs("div",{children:[c.jsx("h3",{className:"font-semibold text-gray-900 dark:text-white mb-4",children:"Company"}),c.jsxs("ul",{className:"space-y-3",children:[c.jsx("li",{children:c.jsx("a",{href:"https://sunbird.ai",target:"_blank",rel:"noopener noreferrer",className:"text-sm text-gray-600 dark:text-gray-400 hover:text-primary-600 dark:hover:text-primary-400 transition-colors",children:"About Us"})}),c.jsx("li",{children:c.jsx("a",{href:"https://blog.sunbird.ai",target:"_blank",rel:"noopener noreferrer",className:"text-sm text-gray-600 dark:text-gray-400 hover:text-primary-600 dark:hover:text-primary-400 transition-colors",children:"Blog"})}),c.jsx("li",{children:c.jsx(Ee,{to:"/privacy_policy",className:"text-sm text-gray-600 dark:text-gray-400 hover:text-primary-600 dark:hover:text-primary-400 transition-colors",children:"Privacy Policy"})}),c.jsx("li",{children:c.jsx(Ee,{to:"/terms_of_service",className:"text-sm text-gray-600 dark:text-gray-400 hover:text-primary-600 dark:hover:text-primary-400 transition-colors",children:"Terms of Service"})})]})]})]})}),c.jsx("div",{className:"py-5 border-t border-gray-200 dark:border-white/10 flex items-center justify-center",children:c.jsxs("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:["© ",new Date().getFullYear()," Sunbird AI. All rights reserved."]})})]})}function H6(){return c.jsxs("div",{className:"min-h-screen bg-white dark:bg-black transition-colors duration-300 selection:bg-primary-500 selection:text-white",children:[c.jsx(Hu,{}),c.jsx("div",{className:"relative pt-32 pb-16 sm:pt-40 sm:pb-24 lg:pb-32 px-4 sm:px-6 lg:px-8 max-w-7xl mx-auto text-center overflow-hidden",children:c.jsxs(Lo.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.5},children:[c.jsxs("h1",{className:"relative text-4xl sm:text-5xl lg:text-7xl font-extrabold tracking-tight text-gray-900 dark:text-white mb-6",children:["Welcome to the ",c.jsx("br",{className:"hidden sm:block"}),c.jsx("span",{className:"text-primary-600 dark:text-primary-500",children:"Sunbird AI API"})]}),c.jsx("p",{className:"relative text-xl text-gray-600 dark:text-gray-400 max-w-2xl mx-auto mb-10 leading-relaxed",children:"Get started with African language AI models. Translate, transcribe, and synthesize speech with state-of-the-art models designed for the continent."}),c.jsxs("div",{className:"relative flex flex-col sm:flex-row items-center justify-center gap-4",children:[c.jsxs(Ee,{to:"/register",className:"w-full sm:w-auto px-8 py-4 rounded-xl bg-primary-600 hover:bg-primary-700 text-white font-semibold text-lg transition-all shadow-xl shadow-primary-500/20 hover:shadow-primary-500/30 flex items-center justify-center gap-2",children:["Get Started",c.jsx(hf,{size:20})]}),c.jsxs("a",{href:"https://docs.sunbird.ai",target:"_blank",rel:"noopener noreferrer",className:"w-full sm:w-auto px-8 py-4 rounded-xl bg-white dark:bg-secondary hover:bg-gray-50 dark:hover:bg-white/5 border border-gray-200 dark:border-white/10 text-gray-900 dark:text-white font-semibold text-lg transition-all backdrop-blur-sm flex items-center justify-center gap-2",children:[c.jsx(Mc,{size:20}),"Read Docs"]})]})]})}),c.jsxs("div",{className:"px-4 sm:px-6 lg:px-8 max-w-7xl mx-auto pb-16",children:[c.jsxs("div",{className:"text-center mb-12",children:[c.jsx("h2",{className:"text-3xl sm:text-4xl font-bold text-gray-900 dark:text-white mb-4",children:"What You Can Build"}),c.jsx("p",{className:"text-lg text-gray-600 dark:text-gray-400 max-w-2xl mx-auto",children:"Powerful AI capabilities for African languages at your fingertips"})]}),c.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[c.jsxs("a",{href:"https://docs.sunbird.ai/guides/translation",target:"_blank",rel:"noopener noreferrer",className:"group p-8 rounded-2xl bg-white dark:bg-white/5 border border-gray-200 dark:border-white/10 border-b-4 hover:border-primary-500 dark:hover:border-primary-500 transition-all hover:shadow-2xl hover:-translate-y-1",children:[c.jsx("div",{className:"w-14 h-14 rounded-xl bg-primary-50 dark:bg-primary-900/20 flex items-center justify-center text-primary-600 dark:text-primary-400 mb-4 group-hover:scale-110 transition-transform",children:c.jsx("svg",{className:"w-7 h-7",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 5h12M9 3v2m1.048 9.5A18.022 18.022 0 016.412 9m6.088 9h7M11 21l5-10 5 10M12.751 5C11.783 10.77 8.07 15.61 3 18.129"})})}),c.jsx("h3",{className:"text-xl font-semibold text-gray-900 dark:text-white mb-2",children:"Translate Content"}),c.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:"Translate text between English and 5+ local Ugandan languages with high accuracy."})]}),c.jsxs("a",{href:"https://docs.sunbird.ai/guides/speech-to-text",target:"_blank",rel:"noopener noreferrer",className:"group p-8 rounded-2xl bg-white dark:bg-white/5 border border-gray-200 dark:border-white/10 border-b-4 hover:border-primary-500 dark:hover:border-primary-500 transition-all hover:shadow-2xl hover:-translate-y-1",children:[c.jsx("div",{className:"w-14 h-14 rounded-xl bg-primary-50 dark:bg-primary-900/20 flex items-center justify-center text-primary-600 dark:text-primary-400 mb-4 group-hover:scale-110 transition-transform",children:c.jsx("svg",{className:"w-7 h-7",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 11a7 7 0 01-7 7m0 0a7 7 0 01-7-7m7 7v4m0 0H8m4 0h4m-4-8a3 3 0 01-3-3V5a3 3 0 116 0v6a3 3 0 01-3 3z"})})}),c.jsx("h3",{className:"text-xl font-semibold text-gray-900 dark:text-white mb-2",children:"Transcribe Audio"}),c.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:"Convert speech audio into text for captioning, logging, or analysis."})]}),c.jsxs("a",{href:"https://docs.sunbird.ai/guides/text-to-speech",target:"_blank",rel:"noopener noreferrer",className:"group p-8 rounded-2xl bg-white dark:bg-white/5 border border-gray-200 dark:border-white/10 border-b-4 hover:border-primary-500 dark:hover:border-primary-500 transition-all hover:shadow-2xl hover:-translate-y-1",children:[c.jsx("div",{className:"w-14 h-14 rounded-xl bg-primary-50 dark:bg-primary-900/20 flex items-center justify-center text-primary-600 dark:text-primary-400 mb-4 group-hover:scale-110 transition-transform",children:c.jsx("svg",{className:"w-7 h-7",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15.536 8.464a5 5 0 010 7.072m2.828-9.9a9 9 0 010 12.728M5.586 15H4a1 1 0 01-1-1v-4a1 1 0 011-1h1.586l4.707-4.707C10.923 3.663 12 4.109 12 5v14c0 .891-1.077 1.337-1.707.707L5.586 15z"})})}),c.jsx("h3",{className:"text-xl font-semibold text-gray-900 dark:text-white mb-2",children:"Generate Speech"}),c.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:"Turn text into natural-sounding speech in local languages."})]}),c.jsxs("a",{href:"https://docs.sunbird.ai/guides/sunflower-chat",target:"_blank",rel:"noopener noreferrer",className:"group p-8 rounded-2xl bg-white dark:bg-white/5 border border-gray-200 dark:border-white/10 border-b-4 hover:border-primary-500 dark:hover:border-primary-500 transition-all hover:shadow-2xl hover:-translate-y-1",children:[c.jsx("div",{className:"w-14 h-14 rounded-xl bg-primary-50 dark:bg-primary-900/20 flex items-center justify-center text-primary-600 dark:text-primary-400 mb-4 group-hover:scale-110 transition-transform",children:c.jsx("svg",{className:"w-7 h-7",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 10h.01M12 10h.01M16 10h.01M9 16H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-5l-5 5v-5z"})})}),c.jsx("h3",{className:"text-xl font-semibold text-gray-900 dark:text-white mb-2",children:"Conversational AI"}),c.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:"Build chatbots that understand and respond in local cultural contexts."})]})]})]}),c.jsxs("div",{className:"px-4 sm:px-6 lg:px-8 max-w-7xl mx-auto pb-16",children:[c.jsxs("div",{className:"text-center mb-8",children:[c.jsx("h2",{className:"text-3xl sm:text-4xl font-bold text-gray-900 dark:text-white mb-4",children:"Supported Languages"}),c.jsx("p",{className:"text-lg text-gray-600 dark:text-gray-400",children:"We support translation between English and these Ugandan languages"})]}),c.jsx("div",{className:"flex flex-wrap justify-center gap-4",children:["Luganda","Acholi","Ateso","Lugbara","Runyankole"].map(e=>c.jsx("div",{className:"px-6 py-3 rounded-full bg-white dark:bg-white/5 border border-gray-200 dark:border-white/5 text-gray-900 dark:text-white font-medium hover:border-primary-500 dark:hover:border-primary-500/50 transition-colors shadow-sm dark:shadow-md dark:shadow-black/20",children:e},e))}),c.jsx("div",{className:"text-center mt-6",children:c.jsxs("a",{href:"https://docs.sunbird.ai/languages",target:"_blank",rel:"noopener noreferrer",className:"text-primary-600 dark:text-primary-400 hover:text-primary-700 dark:hover:text-primary-300 font-medium inline-flex items-center gap-2",children:["View all supported languages",c.jsx(hf,{size:16})]})})]}),c.jsxs("div",{className:"px-4 sm:px-6 lg:px-8 max-w-7xl mx-auto pb-24",children:[c.jsx("div",{className:"text-center mb-12",children:c.jsx("h2",{className:"text-3xl sm:text-4xl font-bold text-gray-900 dark:text-white mb-4",children:"Get Started in Minutes"})}),c.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6",children:[c.jsxs(Ee,{to:"/tutorial",className:"group p-6 rounded-2xl bg-white dark:bg-white/5 border border-gray-200 dark:border-white/10 border-b-4 hover:border-primary-500 dark:hover:border-primary-500 transition-all hover:shadow-2xl hover:-translate-y-1 backdrop-blur-sm",children:[c.jsx("div",{className:"w-12 h-12 rounded-xl bg-primary-50 dark:bg-primary-900/20 flex items-center justify-center text-primary-600 dark:text-primary-400 mb-4 group-hover:scale-110 transition-transform",children:c.jsx(Mc,{size:24})}),c.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-2",children:"Tutorial"}),c.jsx("p",{className:"text-gray-500 dark:text-gray-400 text-sm leading-relaxed",children:"Learn how to use the API with step-by-step guides and best practices."})]}),c.jsxs("a",{href:"https://github.com/SunbirdAI/translation-api-examples",target:"_blank",rel:"noopener noreferrer",className:"group p-6 rounded-2xl bg-white dark:bg-white/5 border border-gray-200 dark:border-white/10 border-b-4 hover:border-primary-500 dark:hover:border-primary-500 transition-all hover:shadow-2xl hover:-translate-y-1 backdrop-blur-sm",children:[c.jsx("div",{className:"w-12 h-12 rounded-xl bg-primary-50 dark:bg-primary-900/20 flex items-center justify-center text-primary-600 dark:text-primary-400 mb-4 group-hover:scale-110 transition-transform",children:c.jsx(PR,{size:24})}),c.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-2",children:"Examples"}),c.jsx("p",{className:"text-gray-500 dark:text-gray-400 text-sm leading-relaxed",children:"View code examples and SDK usage on GitHub for Python and JS."})]}),c.jsxs(Ee,{to:"/login",className:"group p-6 rounded-2xl bg-white dark:bg-white/5 border border-gray-200 dark:border-white/10 border-b-4 hover:border-primary-500 dark:hover:border-primary-500 transition-all hover:shadow-2xl hover:-translate-y-1 backdrop-blur-sm",children:[c.jsx("div",{className:"w-12 h-12 rounded-xl bg-primary-50 dark:bg-primary-900/20 flex items-center justify-center text-primary-600 dark:text-primary-400 mb-4 group-hover:scale-110 transition-transform",children:c.jsx(bu,{size:24})}),c.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-2",children:"Usage Stats"}),c.jsx("p",{className:"text-gray-500 dark:text-gray-400 text-sm leading-relaxed",children:"Monitor your API usage, request volume, and limits in real-time."})]}),c.jsxs(Ee,{to:"/login",className:"group p-6 rounded-2xl bg-white dark:bg-white/5 border border-gray-200 dark:border-white/10 border-b-4 hover:border-primary-500 dark:hover:border-primary-500 transition-all hover:shadow-2xl hover:-translate-y-1 backdrop-blur-sm",children:[c.jsx("div",{className:"w-12 h-12 rounded-xl bg-primary-50 dark:bg-primary-900/20 flex items-center justify-center text-primary-600 dark:text-primary-400 mb-4 group-hover:scale-110 transition-transform",children:c.jsx(J1,{size:24})}),c.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-2",children:"API Tokens"}),c.jsx("p",{className:"text-gray-500 dark:text-gray-400 text-sm leading-relaxed",children:"Manage your access tokens and security keys securely."})]})]})]}),c.jsx(Uu,{})]})}const U6=["NGO","Government","Private Sector","Research","Individual","Other"],Eb=["Health","Agriculture","Energy","Environment","Education","Governance"];function W6(){const[e,t]=S.useState({username:"",email:"",full_name:"",organization:"",organization_type:"",password:"",confirmPassword:""}),[n,r]=S.useState([]),[s,o]=S.useState(""),[i,a]=S.useState(""),[l,u]=S.useState(!1),[d,h]=S.useState(!1),[f,p]=S.useState(!1),g=Is(),m=async b=>{var k,w;if(b.preventDefault(),a(""),e.password!==e.confirmPassword){a("Passwords do not match");return}u(!0);try{await ae.post("/auth/register",{username:e.username,email:e.email,organization:e.organization,password:e.password,full_name:e.full_name||void 0,organization_type:e.organization_type||void 0,sector:n.length>0?n:void 0}),g("/login",{state:{message:"Registration successful! Please sign in."}})}catch(j){a(((w=(k=j.response)==null?void 0:k.data)==null?void 0:w.detail)||"Registration failed. Please try again.")}finally{u(!1)}},y=b=>{r(k=>k.includes(b)?k.filter(w=>w!==b):[...k,b])},x=()=>{const b=s.trim();b&&!n.includes(b)&&(r(k=>[...k,b]),o(""))},v=()=>{window.location.href="/auth/google/login?next=/dashboard"};return c.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-50 dark:bg-black px-4 py-12",children:c.jsx("div",{className:"max-w-md w-full space-y-8",children:c.jsxs("div",{className:"bg-white dark:bg-secondary rounded-2xl shadow-lg dark:shadow-lg dark:shadow-black/10 p-8 border border-gray-100 dark:border-white/5",children:[c.jsxs("div",{className:"gap-2 flex flex-col items-center justify-center mb-6",children:[c.jsx("img",{src:"/logo.png",alt:"Sunbird AI",className:"h-10 w-10 rounded-full object-cover"}),c.jsx("h2",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:"Sign Up"}),c.jsx("p",{className:"mt-2 text-sm text-gray-600 dark:text-gray-400",children:"Sign up to access your API dashboard"})]}),c.jsxs("form",{className:"space-y-6",onSubmit:m,children:[i&&c.jsx("div",{className:"bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400 p-3 rounded-lg text-sm",children:i}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Username"}),c.jsxs("div",{className:"relative",children:[c.jsx(To,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-400"}),c.jsx("input",{type:"text",required:!0,value:e.username,onChange:b=>t({...e,username:b.target.value}),className:"w-full pl-10 pr-4 py-2 bg-white dark:bg-black/50 border border-gray-200 dark:border-white/10 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500 dark:text-white placeholder-gray-400 dark:placeholder-gray-600",placeholder:"johndoe",disabled:l})]})]}),c.jsxs("div",{children:[c.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:["Full Name ",c.jsx("span",{className:"text-gray-400 font-normal",children:"(optional)"})]}),c.jsxs("div",{className:"relative",children:[c.jsx(To,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-400"}),c.jsx("input",{type:"text",value:e.full_name,onChange:b=>t({...e,full_name:b.target.value}),className:"w-full pl-10 pr-4 py-2 bg-white dark:bg-black/50 border border-gray-200 dark:border-white/10 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500 dark:text-white placeholder-gray-400 dark:placeholder-gray-600",placeholder:"John Doe",disabled:l})]})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Email address"}),c.jsxs("div",{className:"relative",children:[c.jsx(ku,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-400"}),c.jsx("input",{type:"email",required:!0,value:e.email,onChange:b=>t({...e,email:b.target.value}),className:"w-full pl-10 pr-4 py-2 bg-white dark:bg-black/50 border border-gray-200 dark:border-white/10 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500 dark:text-white placeholder-gray-400 dark:placeholder-gray-600",placeholder:"you@example.com",disabled:l})]})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Organization"}),c.jsxs("div",{className:"relative",children:[c.jsx(W1,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-400"}),c.jsx("input",{type:"text",required:!0,value:e.organization,onChange:b=>t({...e,organization:b.target.value}),className:"w-full pl-10 pr-4 py-2 bg-white dark:bg-black/50 border border-gray-200 dark:border-white/10 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500 dark:text-white placeholder-gray-400 dark:placeholder-gray-600",placeholder:"Company Name",disabled:l})]})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Organization Type"}),c.jsxs("div",{className:"relative",children:[c.jsx(U1,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-400"}),c.jsxs("select",{required:!0,value:e.organization_type,onChange:b=>t({...e,organization_type:b.target.value}),className:"w-full pl-10 pr-4 py-2 bg-white dark:bg-black/50 border border-gray-200 dark:border-white/10 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500 dark:text-white appearance-none",disabled:l,children:[c.jsx("option",{value:"",children:"Select type..."}),U6.map(b=>c.jsx("option",{value:b,children:b},b))]})]})]}),c.jsxs("div",{children:[c.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:["Impact Sectors ",c.jsx("span",{className:"text-gray-400 font-normal",children:"(select all that apply)"})]}),c.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:[...Eb,...n.filter(b=>!Eb.includes(b))].map(b=>c.jsxs("button",{type:"button",onClick:()=>y(b),disabled:l,className:`px-3 py-1.5 rounded-full text-sm border transition-colors ${n.includes(b)?"border-primary-500 bg-primary-500/10 text-primary-600 dark:text-primary-400":"border-gray-200 dark:border-white/10 text-gray-500 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-white/5"}`,children:[b," ",n.includes(b)&&"✓"]},b))}),c.jsxs("div",{className:"flex gap-2 mt-2",children:[c.jsx("input",{type:"text",value:s,onChange:b=>o(b.target.value),onKeyDown:b=>b.key==="Enter"&&(b.preventDefault(),x()),className:"flex-1 px-3 py-1.5 bg-white dark:bg-black/50 border border-gray-200 dark:border-white/10 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500 dark:text-white text-sm placeholder-gray-400 dark:placeholder-gray-600",placeholder:"Add custom sector...",disabled:l}),c.jsx("button",{type:"button",onClick:x,disabled:l,className:"px-3 py-1.5 text-sm border border-gray-200 dark:border-white/10 rounded-lg text-gray-600 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-white/5 transition-colors",children:"Add"})]})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Password"}),c.jsxs("div",{className:"relative",children:[c.jsx(Jn,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-400"}),c.jsx("input",{type:d?"text":"password",required:!0,value:e.password,onChange:b=>t({...e,password:b.target.value}),className:"w-full pl-10 pr-12 py-2 bg-white dark:bg-black/50 border border-gray-200 dark:border-white/10 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500 dark:text-white placeholder-gray-400 dark:placeholder-gray-600",placeholder:"••••••••",disabled:l}),c.jsx("button",{type:"button",onClick:()=>h(!d),className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300",children:d?c.jsx(Dr,{className:"w-5 h-5"}):c.jsx(Ir,{className:"w-5 h-5"})})]})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Confirm Password"}),c.jsxs("div",{className:"relative",children:[c.jsx(Jn,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-400"}),c.jsx("input",{type:f?"text":"password",required:!0,value:e.confirmPassword,onChange:b=>t({...e,confirmPassword:b.target.value}),className:"w-full pl-10 pr-12 py-2 bg-white dark:bg-black/50 border border-gray-200 dark:border-white/10 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500 dark:text-white placeholder-gray-400 dark:placeholder-gray-600",placeholder:"••••••••",disabled:l}),c.jsx("button",{type:"button",onClick:()=>p(!f),className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300",children:f?c.jsx(Dr,{className:"w-5 h-5"}):c.jsx(Ir,{className:"w-5 h-5"})})]})]}),c.jsxs("button",{type:"submit",disabled:l,className:"w-full flex justify-center items-center gap-2 py-2 px-4 border border-transparent rounded-lg shadow-sm text-sm font-medium text-white bg-primary-600 hover:bg-primary-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500 transition-colors shadow-lg shadow-primary-500/20 disabled:opacity-50 disabled:cursor-not-allowed",children:[" ",l&&c.jsx(Da,{className:"w-4 h-4 animate-spin"}),l?"Creating Account...":"Create Account"]})]}),c.jsxs("div",{className:"mt-6",children:[c.jsx("div",{className:"relative",children:c.jsxs("div",{className:"relative flex justify-center items-center text-sm",children:[c.jsx("div",{className:"flex-1 h-px bg-gray-300 dark:bg-white/10"}),c.jsx("span",{className:"px-2 text-gray-500",children:"OR"}),c.jsx("div",{className:"flex-1 h-px bg-gray-300 dark:bg-white/10"})]})}),c.jsx("div",{className:"mt-6",children:c.jsxs("button",{onClick:v,type:"button",className:"w-full inline-flex justify-center items-center gap-2 py-2 px-4 border border-gray-300 dark:border-white/10 rounded-lg shadow-sm bg-white dark:bg-white/5 text-sm font-medium text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-white/10 transition-colors",children:[c.jsxs("svg",{className:"w-5 h-5",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",width:"25",height:"25",viewBox:"0 0 48 48",children:[c.jsx("path",{fill:"#FFC107",d:"M43.611,20.083H42V20H24v8h11.303c-1.649,4.657-6.08,8-11.303,8c-6.627,0-12-5.373-12-12c0-6.627,5.373-12,12-12c3.059,0,5.842,1.154,7.961,3.039l5.657-5.657C34.046,6.053,29.268,4,24,4C12.955,4,4,12.955,4,24c0,11.045,8.955,20,20,20c11.045,0,20-8.955,20-20C44,22.659,43.862,21.35,43.611,20.083z"}),c.jsx("path",{fill:"#FF3D00",d:"M6.306,14.691l6.571,4.819C14.655,15.108,18.961,12,24,12c3.059,0,5.842,1.154,7.961,3.039l5.657-5.657C34.046,6.053,29.268,4,24,4C16.318,4,9.656,8.337,6.306,14.691z"}),c.jsx("path",{fill:"#4CAF50",d:"M24,44c5.166,0,9.86-1.977,13.409-5.192l-6.19-5.238C29.211,35.091,26.715,36,24,36c-5.202,0-9.619-3.317-11.283-7.946l-6.522,5.025C9.505,39.556,16.227,44,24,44z"}),c.jsx("path",{fill:"#1976D2",d:"M43.611,20.083H42V20H24v8h11.303c-0.792,2.237-2.231,4.166-4.087,5.571c0.001-0.001,0.002-0.001,0.003-0.002l6.19,5.238C36.971,39.205,44,34,44,24C44,22.659,43.862,21.35,43.611,20.083z"})]}),"Sign Up with Google"]})})]}),c.jsx("div",{className:"mt-6 text-center",children:c.jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:["Already have an account?"," ",c.jsx(Ee,{to:"/login",className:"font-medium text-primary-600 hover:text-primary-500 dark:text-primary-400",children:"Sign in"})]})})]})})})}function Tb(){const[e,t]=S.useState(""),[n,r]=S.useState(""),[s,o]=S.useState(!1),[i,a]=S.useState(""),[l,u]=S.useState(!1),{login:d,checkAuth:h}=Qr(),f=Is(),p=ar();S.useEffect(()=>{const y=new URLSearchParams(p.search),x=y.get("token"),v=y.get("error");if(x){localStorage.setItem("access_token",x),ae.defaults.headers.common.Authorization=`Bearer ${x}`;const b=y.get("next")||"/dashboard";h().then(()=>{f(b)})}v&&a("Authentication failed. Please try again.")},[p,h,f]);const g=async y=>{var x,v;y.preventDefault(),a(""),u(!0);try{await d(e,n),f("/dashboard")}catch(b){a(((v=(x=b.response)==null?void 0:x.data)==null?void 0:v.detail)||"Invalid username or password")}finally{u(!1)}},m=()=>{window.location.href="/auth/google/login?next=/dashboard"};return c.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-50 dark:bg-black px-4",children:c.jsxs("div",{className:"max-w-md w-full space-y-8",children:[c.jsx("div",{className:"text-center"}),c.jsxs("div",{className:"bg-white dark:bg-secondary rounded-2xl shadow-lg dark:shadow-lg dark:shadow-black/10 p-8 border border-gray-100 dark:border-white/5 backdrop-blur-sm",children:[c.jsxs("div",{className:"gap-2 flex flex-col items-center justify-center mb-6",children:[c.jsx("img",{src:"/logo.png",alt:"Sunbird AI",className:"h-10 w-10 rounded-full object-cover"}),c.jsx("h2",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:"Sign In"}),c.jsx("p",{className:"mt-2 text-sm text-gray-600 dark:text-gray-400",children:"Login to access your API dashboard"})]}),c.jsxs("form",{className:"space-y-6",onSubmit:g,children:[i&&c.jsx("div",{className:"bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400 p-3 rounded-lg text-sm",children:i}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Username"}),c.jsxs("div",{className:"relative",children:[c.jsx(AR,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-400"}),c.jsx("input",{type:"text",required:!0,value:e,onChange:y=>t(y.target.value),className:"w-full pl-10 pr-4 py-2 bg-white dark:bg-black/50 border border-gray-200 dark:border-white/10 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500 dark:text-white placeholder-gray-400 dark:placeholder-gray-600",placeholder:"username",disabled:l})]})]}),c.jsxs("div",{children:[c.jsxs("div",{className:"flex items-center justify-between mb-1",children:[c.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:"Password"}),c.jsx(Ee,{to:"/forgot-password",className:"text-sm font-medium text-primary-600 hover:text-primary-500 dark:text-primary-400",children:"Forgot password?"})]}),c.jsxs("div",{className:"relative",children:[c.jsx(Jn,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-400"}),c.jsx("input",{type:s?"text":"password",required:!0,value:n,onChange:y=>r(y.target.value),className:"w-full pl-10 pr-12 py-2 bg-white dark:bg-black/50 border border-gray-200 dark:border-white/10 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500 dark:text-white placeholder-gray-400 dark:placeholder-gray-600",placeholder:"••••••••",disabled:l}),c.jsx("button",{type:"button",onClick:()=>o(!s),className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300",children:s?c.jsx(Dr,{className:"w-5 h-5"}):c.jsx(Ir,{className:"w-5 h-5"})})]})]}),c.jsxs("button",{type:"submit",disabled:l,className:"w-full flex justify-center items-center gap-2 py-2 px-4 border border-transparent rounded-lg text-sm font-medium text-white bg-primary-600 hover:bg-primary-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[l&&c.jsx(Da,{className:"w-4 h-4 animate-spin"}),l?"Signing in...":"Sign in"]})]}),c.jsxs("div",{className:"mt-6",children:[c.jsx("div",{className:"relative",children:c.jsxs("div",{className:"relative flex justify-center items-center text-sm",children:[c.jsx("div",{className:"flex-1 h-px bg-gray-300 dark:bg-white/10"}),c.jsx("span",{className:"px-2 text-gray-500",children:"OR"}),c.jsx("div",{className:"flex-1 h-px bg-gray-300 dark:bg-white/10"})]})}),c.jsx("div",{className:"mt-6",children:c.jsxs("button",{onClick:m,type:"button",className:"w-full inline-flex justify-center items-center gap-2 py-2 px-4 border border-gray-300 dark:border-white/10 rounded-lg shadow-sm bg-white dark:bg-white/5 text-sm font-medium text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-white/10 transition-colors",children:[c.jsxs("svg",{className:"w-5 h-5",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",width:"25",height:"25",viewBox:"0 0 48 48",children:[c.jsx("path",{fill:"#FFC107",d:"M43.611,20.083H42V20H24v8h11.303c-1.649,4.657-6.08,8-11.303,8c-6.627,0-12-5.373-12-12c0-6.627,5.373-12,12-12c3.059,0,5.842,1.154,7.961,3.039l5.657-5.657C34.046,6.053,29.268,4,24,4C12.955,4,4,12.955,4,24c0,11.045,8.955,20,20,20c11.045,0,20-8.955,20-20C44,22.659,43.862,21.35,43.611,20.083z"}),c.jsx("path",{fill:"#FF3D00",d:"M6.306,14.691l6.571,4.819C14.655,15.108,18.961,12,24,12c3.059,0,5.842,1.154,7.961,3.039l5.657-5.657C34.046,6.053,29.268,4,24,4C16.318,4,9.656,8.337,6.306,14.691z"}),c.jsx("path",{fill:"#4CAF50",d:"M24,44c5.166,0,9.86-1.977,13.409-5.192l-6.19-5.238C29.211,35.091,26.715,36,24,36c-5.202,0-9.619-3.317-11.283-7.946l-6.522,5.025C9.505,39.556,16.227,44,24,44z"}),c.jsx("path",{fill:"#1976D2",d:"M43.611,20.083H42V20H24v8h11.303c-0.792,2.237-2.231,4.166-4.087,5.571c0.001-0.001,0.002-0.001,0.003-0.002l6.19,5.238C36.971,39.205,44,34,44,24C44,22.659,43.862,21.35,43.611,20.083z"})]}),"Sign in with Google"]})})]}),c.jsx("div",{className:"mt-6 text-center",children:c.jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:["Don't have an account?"," ",c.jsx(Ee,{to:"/register",className:"font-medium text-primary-600 hover:text-primary-500 dark:text-primary-400",children:"Sign up"})]})})]})]})})}function G6(){const[e,t]=S.useState(""),[n,r]=S.useState(""),[s,o]=S.useState(""),[i,a]=S.useState(!1),l=async u=>{var d,h;u.preventDefault(),o(""),r(""),a(!0);try{const f=await ae.post("/auth/forgot-password",{email:e});f.data.success?r("Password reset email sent! Please check your inbox."):o(f.data.message||"Failed to send reset email")}catch(f){o(((h=(d=f.response)==null?void 0:d.data)==null?void 0:h.detail)||"Failed to send reset email. Please try again.")}finally{a(!1)}};return c.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-50 dark:bg-black px-4",children:c.jsx("div",{className:"max-w-md w-full space-y-8",children:c.jsxs("div",{className:"bg-white dark:bg-secondary p-8 rounded-2xl shadow-lg dark:shadow-lg dark:shadow-black/10 border border-gray-100 dark:border-white/5 backdrop-blur-sm",children:[c.jsxs("div",{className:"gap-2 flex flex-col items-center justify-center mb-6",children:[c.jsx("img",{src:"/logo.png",alt:"Sunbird AI",className:"h-10 w-10 rounded-full object-cover"}),c.jsx("h2",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:"Forgot Password "}),c.jsx("p",{className:"mt-2 text-sm text-gray-600 dark:text-gray-400",children:"Enter your email address and we'll send you a link to reset your password"})]}),c.jsxs("form",{className:"space-y-6",onSubmit:l,children:[s&&c.jsx("div",{className:"bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400 p-3 rounded-lg text-sm",children:s}),n&&c.jsx("div",{className:"bg-green-50 dark:bg-green-900/20 text-green-600 dark:text-green-400 p-3 rounded-lg text-sm",children:n}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Email address"}),c.jsxs("div",{className:"relative",children:[c.jsx(ku,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-400"}),c.jsx("input",{type:"email",required:!0,value:e,onChange:u=>t(u.target.value),className:"w-full pl-10 pr-4 py-2 bg-white dark:bg-black/50 border border-gray-200 dark:border-white/10 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500 dark:text-white placeholder-gray-400 dark:placeholder-gray-600",placeholder:"you@example.com",disabled:i})]})]}),c.jsxs("button",{type:"submit",disabled:i,className:"w-full flex justify-center items-center gap-2 py-2 px-4 border border-transparent rounded-lg text-sm font-medium text-white bg-primary-600 hover:bg-primary-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[i&&c.jsx(Da,{className:"w-4 h-4 animate-spin"}),i?"Sending...":"Send Reset Link"]})]}),c.jsx("div",{className:"mt-6 text-center",children:c.jsxs(Ee,{to:"/login",className:"inline-flex items-center gap-2 text-sm font-medium text-primary-600 hover:text-primary-500 dark:text-primary-400",children:[c.jsx(uR,{className:"w-4 h-4"}),"Back to Sign In"]})})]})})})}function q6(){const[e,t]=S.useState(""),[n,r]=S.useState(""),[s,o]=S.useState(!1),[i,a]=S.useState(!1),[l,u]=S.useState(""),[d,h]=S.useState(!1),[f]=x1(),p=Is(),g=f.get("token");S.useEffect(()=>{g||u("Invalid or missing reset token")},[g]);const m=async y=>{var x,v;if(y.preventDefault(),u(""),e!==n){u("Passwords do not match");return}if(!g){u("Invalid reset token");return}h(!0);try{await ae.post("/auth/reset-password",{token:g,new_password:e}),p("/login",{state:{message:"Password reset successful! Please sign in with your new password."}})}catch(b){u(((v=(x=b.response)==null?void 0:x.data)==null?void 0:v.detail)||"Failed to reset password. The link may have expired.")}finally{h(!1)}};return c.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-50 dark:bg-black px-4",children:c.jsx("div",{className:"max-w-md w-full space-y-8",children:c.jsxs("div",{className:"bg-white dark:bg-secondary p-8 rounded-2xl shadow-lg dark:shadow-lg dark:shadow-black/10 border border-gray-100 dark:border-white/5 backdrop-blur-sm",children:[c.jsxs("div",{className:"gap-2 flex flex-col items-center justify-center mb-6",children:[c.jsx("img",{src:"/logo.png",alt:"Sunbird AI",className:"h-10 w-10 rounded-full object-cover"}),c.jsx("h2",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:"Reset Password "}),c.jsx("p",{className:"mt-2 text-sm text-gray-600 dark:text-gray-400",children:"Enter your new password below"})]}),c.jsxs("form",{className:"space-y-6",onSubmit:m,children:[l&&c.jsx("div",{className:"bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400 p-3 rounded-lg text-sm",children:l}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"New Password"}),c.jsxs("div",{className:"relative",children:[c.jsx(Jn,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-400"}),c.jsx("input",{type:s?"text":"password",required:!0,value:e,onChange:y=>t(y.target.value),className:"w-full pl-10 pr-12 py-2 bg-white dark:bg-black/50 border border-gray-200 dark:border-white/10 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500 dark:text-white placeholder-gray-400 dark:placeholder-gray-600",placeholder:"••••••••",disabled:d||!g}),c.jsx("button",{type:"button",onClick:()=>o(!s),className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300",disabled:d||!g,children:s?c.jsx(Dr,{className:"w-5 h-5"}):c.jsx(Ir,{className:"w-5 h-5"})})]})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Confirm New Password"}),c.jsxs("div",{className:"relative",children:[c.jsx(Jn,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-400"}),c.jsx("input",{type:i?"text":"password",required:!0,value:n,onChange:y=>r(y.target.value),className:"w-full pl-10 pr-12 py-2 bg-white dark:bg-black/50 border border-gray-200 dark:border-white/10 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500 dark:text-white placeholder-gray-400 dark:placeholder-gray-600",placeholder:"••••••••",disabled:d||!g}),c.jsx("button",{type:"button",onClick:()=>a(!i),className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300",disabled:d||!g,children:i?c.jsx(Dr,{className:"w-5 h-5"}):c.jsx(Ir,{className:"w-5 h-5"})})]})]}),c.jsx("button",{type:"submit",disabled:d||!g,className:"w-full flex justify-center items-center gap-2 py-2 px-4 border border-transparent rounded-lg text-sm font-medium text-white bg-primary-600 hover:bg-primary-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:d?"Resetting Password...":"Reset Password"})]})]})})})}const K6=["NGO","Government","Private Sector","Research","Individual","Other"],Ab=["Health","Agriculture","Energy","Environment","Education","Governance"];function Y6(){const{user:e,checkAuth:t}=Qr(),n=Is(),[r,s]=S.useState({full_name:(e==null?void 0:e.full_name)||"",organization:(e==null?void 0:e.organization)==="Unknown"?"":(e==null?void 0:e.organization)||"",organization_type:(e==null?void 0:e.organization_type)||""}),[o,i]=S.useState((e==null?void 0:e.sector)||[]),[a,l]=S.useState(""),[u,d]=S.useState(!1),[h,f]=S.useState(""),p=y=>{i(x=>x.includes(y)?x.filter(v=>v!==y):[...x,y])},g=()=>{const y=a.trim();y&&!o.includes(y)&&(i(x=>[...x,y]),l(""))},m=async y=>{var x,v;y.preventDefault(),f(""),d(!0);try{await ae.put("/auth/profile",{full_name:r.full_name||void 0,organization:r.organization||void 0,organization_type:r.organization_type||void 0,sector:o.length>0?o:void 0}),await t(),n("/dashboard")}catch(b){f(((v=(x=b.response)==null?void 0:x.data)==null?void 0:v.detail)||"Failed to update profile. Please try again.")}finally{d(!1)}};return c.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-50 dark:bg-black px-4 py-12",children:c.jsxs("div",{className:"max-w-md w-full space-y-8",children:[c.jsxs("div",{className:"text-center",children:[c.jsx("img",{src:"/logo.png",alt:"Sunbird AI",className:"h-10 w-10 rounded-full object-cover mx-auto mb-3"}),c.jsx("h2",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:"Complete Your Profile"}),c.jsx("p",{className:"mt-2 text-sm text-gray-600 dark:text-gray-400",children:"Help us understand how you're using Sunbird AI so we can serve you better."})]}),c.jsxs("div",{className:"bg-white dark:bg-secondary rounded-2xl shadow-lg dark:shadow-lg dark:shadow-black/10 p-8 border border-gray-100 dark:border-white/5",children:[c.jsxs("form",{className:"space-y-6",onSubmit:m,children:[h&&c.jsx("div",{className:"bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400 p-3 rounded-lg text-sm",children:h}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Full Name"}),c.jsx("input",{type:"text",value:r.full_name,onChange:y=>s({...r,full_name:y.target.value}),className:"w-full px-4 py-2 bg-white dark:bg-black/50 border border-gray-200 dark:border-white/10 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500 dark:text-white placeholder-gray-400 dark:placeholder-gray-600",placeholder:"John Doe",disabled:u})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Organization Name"}),c.jsx("input",{type:"text",value:r.organization,onChange:y=>s({...r,organization:y.target.value}),className:"w-full px-4 py-2 bg-white dark:bg-black/50 border border-gray-200 dark:border-white/10 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500 dark:text-white placeholder-gray-400 dark:placeholder-gray-600",placeholder:"Sunbird AI",disabled:u})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Organization Type"}),c.jsxs("select",{value:r.organization_type,onChange:y=>s({...r,organization_type:y.target.value}),className:"w-full px-4 py-2 bg-white dark:bg-black/50 border border-gray-200 dark:border-white/10 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500 dark:text-white appearance-none",disabled:u,children:[c.jsx("option",{value:"",children:"Select type..."}),K6.map(y=>c.jsx("option",{value:y,children:y},y))]})]}),c.jsxs("div",{children:[c.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:["Impact Sectors ",c.jsx("span",{className:"text-gray-400 font-normal",children:"(select all that apply)"})]}),c.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:[...Ab,...o.filter(y=>!Ab.includes(y))].map(y=>c.jsxs("button",{type:"button",onClick:()=>p(y),disabled:u,className:`px-3 py-1.5 rounded-full text-sm border transition-colors ${o.includes(y)?"border-primary-500 bg-primary-500/10 text-primary-600 dark:text-primary-400":"border-gray-200 dark:border-white/10 text-gray-500 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-white/5"}`,children:[y," ",o.includes(y)&&"✓"]},y))}),c.jsxs("div",{className:"flex gap-2 mt-2",children:[c.jsx("input",{type:"text",value:a,onChange:y=>l(y.target.value),onKeyDown:y=>y.key==="Enter"&&(y.preventDefault(),g()),className:"flex-1 px-3 py-1.5 bg-white dark:bg-black/50 border border-gray-200 dark:border-white/10 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500 dark:text-white text-sm placeholder-gray-400 dark:placeholder-gray-600",placeholder:"Add custom sector...",disabled:u}),c.jsx("button",{type:"button",onClick:g,disabled:u,className:"px-3 py-1.5 text-sm border border-gray-200 dark:border-white/10 rounded-lg text-gray-600 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-white/5 transition-colors",children:"Add"})]})]}),c.jsxs("button",{type:"submit",disabled:u,className:"w-full flex justify-center items-center gap-2 py-2 px-4 border border-transparent rounded-lg shadow-sm text-sm font-medium text-white bg-primary-600 hover:bg-primary-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500 transition-colors shadow-lg shadow-primary-500/20 disabled:opacity-50 disabled:cursor-not-allowed",children:[u&&c.jsx(Da,{className:"w-4 h-4 animate-spin"}),u?"Saving...":"Save & Continue to Dashboard"]})]}),c.jsx("div",{className:"mt-4 text-center",children:c.jsx("button",{onClick:()=>n("/dashboard"),className:"text-sm text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 transition-colors",children:"Skip for now →"})})]})]})})}function X6(){return c.jsxs("div",{className:"min-h-screen bg-white dark:bg-black flex flex-col",children:[c.jsx(Hu,{}),c.jsx("main",{className:"flex-1 pt-24 pb-16 px-4 sm:px-6 lg:px-8",children:c.jsxs("div",{className:"max-w-4xl mx-auto",children:[c.jsx("h1",{className:"text-4xl font-bold text-gray-900 dark:text-white mb-8",children:"Privacy Policy"}),c.jsxs("div",{className:"space-y-8 text-gray-700 dark:text-gray-300",children:[c.jsxs("div",{children:[c.jsx("h2",{className:"text-2xl font-semibold text-gray-900 dark:text-white mb-4",children:"Introduction"}),c.jsx("p",{className:"leading-relaxed",children:"Welcome to the Privacy Policy of Sunbird AI. We understand that privacy online is important to users of our services, especially when utilizing our WhatsApp translation bot. This statement governs our privacy policies with respect to the collection, use, and disclosure of personal information when using our services."})]}),c.jsxs("div",{children:[c.jsx("h2",{className:"text-2xl font-semibold text-gray-900 dark:text-white mb-4",children:"Personally Identifiable Information"}),c.jsx("p",{className:"leading-relaxed",children:"Personally Identifiable Information refers to any information that identifies or can be used to identify, contact, or locate the person to whom such information pertains, including, but not limited to, name, address, phone number, email address, IP address, location, and browser."})]}),c.jsxs("div",{children:[c.jsx("h2",{className:"text-2xl font-semibold text-gray-900 dark:text-white mb-4",children:"What Personally Identifiable Information is collected?"}),c.jsx("p",{className:"leading-relaxed",children:"We may collect basic user profile information from all users of our services. Additional information may be collected from users of our WhatsApp translation bot, including but not limited to, the content of messages for translation purposes."})]}),c.jsxs("div",{children:[c.jsx("h2",{className:"text-2xl font-semibold text-gray-900 dark:text-white mb-4",children:"How is Personally Identifiable Information stored?"}),c.jsx("p",{className:"leading-relaxed",children:"Personally Identifiable Information collected by Sunbird AI is securely stored and is not accessible to third parties or employees of Sunbird AI except for use as indicated above."})]}),c.jsxs("div",{children:[c.jsx("h2",{className:"text-2xl font-semibold text-gray-900 dark:text-white mb-4",children:"What choices are available to users regarding collection, use, and distribution of the information?"}),c.jsx("p",{className:"leading-relaxed",children:"Users may opt-out of certain data collection practices as outlined in this Privacy Policy by contacting Sunbird AI."})]}),c.jsxs("div",{children:[c.jsx("h2",{className:"text-2xl font-semibold text-gray-900 dark:text-white mb-4",children:"Changes to this Privacy Policy"}),c.jsx("p",{className:"leading-relaxed",children:"Sunbird AI reserves the right to update or change our Privacy Policy at any time. Users will be notified of any changes by posting the new Privacy Policy on this page."})]}),c.jsxs("div",{children:[c.jsx("h2",{className:"text-2xl font-semibold text-gray-900 dark:text-white mb-4",children:"Contact Us"}),c.jsxs("p",{className:"leading-relaxed",children:["If you have any questions about this Privacy Policy, please contact us at ",c.jsx("a",{href:"mailto:info@sunbird.ai",className:"text-primary-600 hover:text-primary-700 dark:text-primary-400 dark:hover:text-primary-300 underline",children:"info@sunbird.ai"})]})]})]})]})}),c.jsx(Uu,{})]})}function Q6(){return c.jsxs("div",{className:"min-h-screen bg-white dark:bg-black flex flex-col",children:[c.jsx(Hu,{}),c.jsx("main",{className:"flex-1 pt-24 pb-16 px-4 sm:px-6 lg:px-8",children:c.jsxs("div",{className:"max-w-4xl mx-auto",children:[c.jsx("h1",{className:"text-4xl font-bold text-gray-900 dark:text-white mb-8",children:"Terms of Service"}),c.jsxs("div",{className:"space-y-8 text-gray-700 dark:text-gray-300",children:[c.jsxs("div",{children:[c.jsx("h2",{className:"text-2xl font-semibold text-gray-900 dark:text-white mb-4",children:"Agreement"}),c.jsx("p",{className:"leading-relaxed",children:"By accessing or using the services provided by Sunbird AI, you agree to abide by these Terms of Service. These Terms apply to all visitors, users, and others who access or use our services."})]}),c.jsxs("div",{children:[c.jsx("h2",{className:"text-2xl font-semibold text-gray-900 dark:text-white mb-4",children:"Use of Services"}),c.jsx("p",{className:"leading-relaxed",children:'Our services, including the WhatsApp translation bot, are provided on an "as is" and "as available" basis. Users are solely responsible for their use of the services and any consequences thereof.'})]}),c.jsxs("div",{children:[c.jsx("h2",{className:"text-2xl font-semibold text-gray-900 dark:text-white mb-4",children:"Intellectual Property"}),c.jsx("p",{className:"leading-relaxed",children:"All intellectual property rights associated with the services provided by Sunbird AI, including but not limited to, the WhatsApp translation bot, are owned by Sunbird AI. Users are granted a limited, non-exclusive, non-transferable license to use the services for personal or non-commercial purposes."})]}),c.jsxs("div",{children:[c.jsx("h2",{className:"text-2xl font-semibold text-gray-900 dark:text-white mb-4",children:"Limitation of Liability"}),c.jsx("p",{className:"leading-relaxed",children:"Sunbird AI shall not be liable for any indirect, incidental, special, consequential, or punitive damages, or any loss of profits or revenues, whether incurred directly or indirectly, or any loss of data, use, goodwill, or other intangible losses resulting from (i) your access to or use of or inability to access or use the services; (ii) any conduct or content of any third party on the services; (iii) any content obtained from the services; or (iv) unauthorized access, use, or alteration of your transmissions or content."})]}),c.jsxs("div",{children:[c.jsx("h2",{className:"text-2xl font-semibold text-gray-900 dark:text-white mb-4",children:"Changes to Terms of Service"}),c.jsx("p",{className:"leading-relaxed",children:"Sunbird AI reserves the right to update or change these Terms of Service at any time. Users will be notified of any changes by posting the new Terms of Service on this page."})]}),c.jsxs("div",{children:[c.jsx("h2",{className:"text-2xl font-semibold text-gray-900 dark:text-white mb-4",children:"Contact Us"}),c.jsxs("p",{className:"leading-relaxed",children:["If you have any questions about these Terms of Service, please contact us at ",c.jsx("a",{href:"mailto:info@sunbird.ai",className:"text-primary-600 hover:text-primary-700 dark:text-primary-400 dark:hover:text-primary-300 underline",children:"info@sunbird.ai"})]})]})]})]})}),c.jsx(Uu,{})]})}function J6(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function Z6(e,t){if(e==null)return{};var n,r,s=J6(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;re.length)&&(t=e.length);for(var n=0,r=Array(t);n=4)return[e[0],e[1],e[2],e[3],"".concat(e[0],".").concat(e[1]),"".concat(e[0],".").concat(e[2]),"".concat(e[0],".").concat(e[3]),"".concat(e[1],".").concat(e[0]),"".concat(e[1],".").concat(e[2]),"".concat(e[1],".").concat(e[3]),"".concat(e[2],".").concat(e[0]),"".concat(e[2],".").concat(e[1]),"".concat(e[2],".").concat(e[3]),"".concat(e[3],".").concat(e[0]),"".concat(e[3],".").concat(e[1]),"".concat(e[3],".").concat(e[2]),"".concat(e[0],".").concat(e[1],".").concat(e[2]),"".concat(e[0],".").concat(e[1],".").concat(e[3]),"".concat(e[0],".").concat(e[2],".").concat(e[1]),"".concat(e[0],".").concat(e[2],".").concat(e[3]),"".concat(e[0],".").concat(e[3],".").concat(e[1]),"".concat(e[0],".").concat(e[3],".").concat(e[2]),"".concat(e[1],".").concat(e[0],".").concat(e[2]),"".concat(e[1],".").concat(e[0],".").concat(e[3]),"".concat(e[1],".").concat(e[2],".").concat(e[0]),"".concat(e[1],".").concat(e[2],".").concat(e[3]),"".concat(e[1],".").concat(e[3],".").concat(e[0]),"".concat(e[1],".").concat(e[3],".").concat(e[2]),"".concat(e[2],".").concat(e[0],".").concat(e[1]),"".concat(e[2],".").concat(e[0],".").concat(e[3]),"".concat(e[2],".").concat(e[1],".").concat(e[0]),"".concat(e[2],".").concat(e[1],".").concat(e[3]),"".concat(e[2],".").concat(e[3],".").concat(e[0]),"".concat(e[2],".").concat(e[3],".").concat(e[1]),"".concat(e[3],".").concat(e[0],".").concat(e[1]),"".concat(e[3],".").concat(e[0],".").concat(e[2]),"".concat(e[3],".").concat(e[1],".").concat(e[0]),"".concat(e[3],".").concat(e[1],".").concat(e[2]),"".concat(e[3],".").concat(e[2],".").concat(e[0]),"".concat(e[3],".").concat(e[2],".").concat(e[1]),"".concat(e[0],".").concat(e[1],".").concat(e[2],".").concat(e[3]),"".concat(e[0],".").concat(e[1],".").concat(e[3],".").concat(e[2]),"".concat(e[0],".").concat(e[2],".").concat(e[1],".").concat(e[3]),"".concat(e[0],".").concat(e[2],".").concat(e[3],".").concat(e[1]),"".concat(e[0],".").concat(e[3],".").concat(e[1],".").concat(e[2]),"".concat(e[0],".").concat(e[3],".").concat(e[2],".").concat(e[1]),"".concat(e[1],".").concat(e[0],".").concat(e[2],".").concat(e[3]),"".concat(e[1],".").concat(e[0],".").concat(e[3],".").concat(e[2]),"".concat(e[1],".").concat(e[2],".").concat(e[0],".").concat(e[3]),"".concat(e[1],".").concat(e[2],".").concat(e[3],".").concat(e[0]),"".concat(e[1],".").concat(e[3],".").concat(e[0],".").concat(e[2]),"".concat(e[1],".").concat(e[3],".").concat(e[2],".").concat(e[0]),"".concat(e[2],".").concat(e[0],".").concat(e[1],".").concat(e[3]),"".concat(e[2],".").concat(e[0],".").concat(e[3],".").concat(e[1]),"".concat(e[2],".").concat(e[1],".").concat(e[0],".").concat(e[3]),"".concat(e[2],".").concat(e[1],".").concat(e[3],".").concat(e[0]),"".concat(e[2],".").concat(e[3],".").concat(e[0],".").concat(e[1]),"".concat(e[2],".").concat(e[3],".").concat(e[1],".").concat(e[0]),"".concat(e[3],".").concat(e[0],".").concat(e[1],".").concat(e[2]),"".concat(e[3],".").concat(e[0],".").concat(e[2],".").concat(e[1]),"".concat(e[3],".").concat(e[1],".").concat(e[0],".").concat(e[2]),"".concat(e[3],".").concat(e[1],".").concat(e[2],".").concat(e[0]),"".concat(e[3],".").concat(e[2],".").concat(e[0],".").concat(e[1]),"".concat(e[3],".").concat(e[2],".").concat(e[1],".").concat(e[0])]}var ih={};function aF(e){if(e.length===0||e.length===1)return e;var t=e.join(".");return ih[t]||(ih[t]=iF(e)),ih[t]}function lF(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0,r=e.filter(function(o){return o!=="token"}),s=aF(r);return s.reduce(function(o,i){return fo(fo({},o),n[i])},t)}function Lb(e){return e.join(" ")}function cF(e,t){var n=0;return function(r){return n+=1,r.map(function(s,o){return GS({node:s,stylesheet:e,useInlineStyles:t,key:"code-segment-".concat(n,"-").concat(o)})})}}function GS(e){var t=e.node,n=e.stylesheet,r=e.style,s=r===void 0?{}:r,o=e.useInlineStyles,i=e.key,a=t.properties,l=t.type,u=t.tagName,d=t.value;if(l==="text")return d;if(u){var h=cF(n,o),f;if(!o)f=fo(fo({},a),{},{className:Lb(a.className)});else{var p=Object.keys(n).reduce(function(x,v){return v.split(".").forEach(function(b){x.includes(b)||x.push(b)}),x},[]),g=a.className&&a.className.includes("token")?["token"]:[],m=a.className&&g.concat(a.className.filter(function(x){return!p.includes(x)}));f=fo(fo({},a),{},{className:Lb(m)||void 0,style:lF(a.className,Object.assign({},a.style,s),n)})}var y=h(t.children);return z.createElement(u,Yf({key:i},f),y)}}const uF=(function(e,t){var n=e.listLanguages();return n.indexOf(t)!==-1});var dF=["language","children","style","customStyle","codeTagProps","useInlineStyles","showLineNumbers","showInlineLineNumbers","startingLineNumber","lineNumberContainerStyle","lineNumberStyle","wrapLines","wrapLongLines","lineProps","renderer","PreTag","CodeTag","code","astGenerator"];function Ob(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function Cr(e){for(var t=1;t{const t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}function l6(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function c6(e){const t={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[n]=S.useState(()=>({current:QI(t)})),[r,s]=S.useState(()=>n.current.initialState);return n.current.setOptions(o=>({...o,...e,state:{...r,...e.state},onStateChange:i=>{s(i),e.onStateChange==null||e.onStateChange(i)}})),n.current}const zS=S.forwardRef(({className:e,...t},n)=>c.jsx("div",{className:"relative w-full overflow-auto",children:c.jsx("table",{ref:n,className:lr("w-full caption-bottom text-sm",e),...t})}));zS.displayName="Table";const VS=S.forwardRef(({className:e,...t},n)=>c.jsx("thead",{ref:n,className:lr("[&_tr]:border-b dark:border-white/5",e),...t}));VS.displayName="TableHeader";const BS=S.forwardRef(({className:e,...t},n)=>c.jsx("tbody",{ref:n,className:lr("[&_tr:last-child]:border-0",e),...t}));BS.displayName="TableBody";const u6=S.forwardRef(({className:e,...t},n)=>c.jsx("tfoot",{ref:n,className:lr("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}));u6.displayName="TableFooter";const sc=S.forwardRef(({className:e,...t},n)=>c.jsx("tr",{ref:n,className:lr("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted dark:border-white/5 dark:hover:bg-white/5",e),...t}));sc.displayName="TableRow";const $S=S.forwardRef(({className:e,...t},n)=>c.jsx("th",{ref:n,className:lr("h-12 px-4 text-left align-middle font-semibold text-xs uppercase tracking-wider text-gray-600 dark:text-gray-400 [&:has([role=checkbox])]:pr-0 bg-gray-50 dark:bg-white/5",e),...t}));$S.displayName="TableHead";const Wf=S.forwardRef(({className:e,...t},n)=>c.jsx("td",{ref:n,className:lr("p-4 align-middle [&:has([role=checkbox])]:pr-0 text-gray-900 dark:text-gray-300",e),...t}));Wf.displayName="TableCell";const d6=S.forwardRef(({className:e,...t},n)=>c.jsx("caption",{ref:n,className:lr("mt-4 text-sm text-muted-foreground",e),...t}));d6.displayName="TableCaption";function h6({columns:e,data:t,searchable:n=!0,itemsPerPage:r=10,emptyMessage:s="No results."}){var f;const[o,i]=S.useState([]),[a,l]=S.useState([]),[u,d]=S.useState(""),h=c6({data:t,columns:e,getCoreRowModel:JI(),getPaginationRowModel:s6(),onSortingChange:i,getSortedRowModel:o6(),onColumnFiltersChange:l,getFilteredRowModel:r6(),onGlobalFilterChange:d,state:{sorting:o,columnFilters:a,globalFilter:u},initialState:{pagination:{pageSize:r}}});return c.jsxs("div",{className:"space-y-4",children:[n&&c.jsxs("div",{className:"relative",children:[c.jsx(tk,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),c.jsx("input",{placeholder:"Search...",value:u??"",onChange:p=>d(p.target.value),className:"w-full pl-10 pr-4 py-2 bg-white dark:bg-white/5 border border-gray-200 dark:border-white/10 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-primary-500 dark:text-white placeholder-gray-400 dark:placeholder-gray-600"})]}),c.jsx("div",{className:"rounded-md border border-gray-200 dark:border-white/10 overflow-hidden",children:c.jsxs(zS,{children:[c.jsx(VS,{children:h.getHeaderGroups().map(p=>c.jsx(sc,{children:p.headers.map(g=>c.jsx($S,{children:g.isPlaceholder?null:jb(g.column.columnDef.header,g.getContext())},g.id))},p.id))}),c.jsx(BS,{children:(f=h.getRowModel().rows)!=null&&f.length?h.getRowModel().rows.map(p=>c.jsx(sc,{"data-state":p.getIsSelected()&&"selected",children:p.getVisibleCells().map(g=>c.jsx(Wf,{children:jb(g.column.columnDef.cell,g.getContext())},g.id))},p.id)):c.jsx(sc,{children:c.jsx(Wf,{colSpan:e.length,className:"h-24 text-center",children:s})})})]})}),h.getPageCount()>1&&c.jsxs("div",{className:"flex items-center justify-between space-x-2 py-4",children:[c.jsxs("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:["Page ",h.getState().pagination.pageIndex+1," of ",h.getPageCount()]}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("button",{className:"p-2 rounded-lg border border-gray-200 dark:border-white/10 hover:bg-gray-50 dark:hover:bg-white/5 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",onClick:()=>h.previousPage(),disabled:!h.getCanPreviousPage(),children:c.jsx(K1,{size:16})}),c.jsx("button",{className:"p-2 rounded-lg border border-gray-200 dark:border-white/10 hover:bg-gray-50 dark:hover:bg-white/5 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",onClick:()=>h.nextPage(),disabled:!h.getCanNextPage(),children:c.jsx(q1,{size:16})})]})]})]})}function f6(){const{user:e}=Qr(),[t,n]=S.useState([]),[r,s]=S.useState(null),[o,i]=S.useState(!0);S.useEffect(()=>{e&&(async()=>{try{const d=localStorage.getItem("access_token");d&&n([{id:"1",name:"Current API Key",key:d,status:"Active"}])}catch(d){console.error("Failed to fetch API keys:",d)}finally{i(!1)}})()},[e]);const a=(u,d)=>{navigator.clipboard.writeText(u),s(d),setTimeout(()=>s(null),2e3)},l=[{accessorKey:"name",header:"Name"},{accessorKey:"key",header:"Key",cell:({row:u})=>c.jsxs("div",{className:"flex items-center gap-2 font-mono text-gray-700 dark:text-gray-300",children:[c.jsxs("span",{className:"truncate max-w-xs",children:[u.original.key.substring(0,20),"..."]}),c.jsx("button",{onClick:()=>a(u.original.key,u.original.id),className:"p-1 hover:bg-gray-100 dark:hover:bg-white/10 rounded transition-colors",title:"Copy key",children:r===u.original.id?c.jsx(vu,{className:"w-3 h-3 text-green-500"}):c.jsx(Y1,{className:"w-3 h-3"})})]})},{accessorKey:"status",header:"Status",cell:({row:u})=>c.jsx("span",{className:`px-2 py-1 rounded-full text-xs font-medium ${u.original.status==="Active"?"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400":"bg-gray-100 text-gray-800 dark:bg-gray-800 dark:text-gray-400"}`,children:u.original.status})}];return o?c.jsx("div",{className:"flex items-center justify-center h-64",children:c.jsx("div",{className:"text-gray-500 dark:text-gray-400",children:"Loading API keys..."})}):c.jsxs("div",{className:"max-w-5xl mx-auto space-y-8",children:[c.jsx("div",{className:"flex items-center justify-between",children:c.jsxs("div",{children:[c.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:"API Keys"}),c.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:"Manage your API keys for authentication."})]})}),c.jsx("div",{className:"bg-white dark:bg-secondary rounded-xl shadow-md dark:shadow-lg dark:shadow-black/10 border border-gray-200 dark:border-white/5 p-6",children:c.jsx(h6,{data:t,columns:l,itemsPerPage:10,searchable:!0,emptyMessage:"No API keys found. Generate one to get started."})}),c.jsxs("div",{className:"bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg p-4",children:[c.jsx("h3",{className:"text-sm font-medium text-blue-900 dark:text-blue-300 mb-2",children:"Using Your API Key"}),c.jsx("p",{className:"text-sm text-blue-700 dark:text-blue-400 mb-3",children:"Include your API key in the Authorization header of your requests:"}),c.jsx("code",{className:"block bg-white dark:bg-black/50 p-3 rounded text-xs font-mono text-gray-900 dark:text-gray-100 border border-blue-200 dark:border-blue-800",children:"Authorization: Bearer YOUR_API_KEY"})]})]})}const p6=["NGO","Government","Private Sector","Research","Individual","Other"],Cb=["Health","Agriculture","Energy","Environment","Education","Governance"];function g6(){const{user:e}=Qr(),{theme:t,setTheme:n}=H1(),[r,s]=S.useState({username:(e==null?void 0:e.username)||"",email:(e==null?void 0:e.email)||"",full_name:(e==null?void 0:e.full_name)||"",organization:(e==null?void 0:e.organization)||"",organization_type:(e==null?void 0:e.organization_type)||""}),[o,i]=S.useState((e==null?void 0:e.sector)||[]),[a,l]=S.useState(""),[u,d]=S.useState(""),[h,f]=S.useState(""),[p,g]=S.useState(!1),[m,y]=S.useState({oldPassword:"",newPassword:"",confirmPassword:""}),[x,v]=S.useState(""),[b,k]=S.useState(""),[w,j]=S.useState(!1),[N,_]=S.useState(!1),[P,A]=S.useState(!1),[O,F]=S.useState(!1),D=E=>{i(I=>I.includes(E)?I.filter(Y=>Y!==E):[...I,E])},W=()=>{const E=a.trim();E&&!o.includes(E)&&(i(I=>[...I,E]),l(""))},G=async E=>{var I,Y;E.preventDefault(),f(""),d(""),g(!0);try{await ae.put("/auth/profile",{full_name:r.full_name||void 0,organization:r.organization||void 0,organization_type:r.organization_type||void 0,sector:o.length>0?o:void 0}),d("Profile updated successfully!")}catch(T){f(((Y=(I=T.response)==null?void 0:I.data)==null?void 0:Y.detail)||"Failed to update profile.")}finally{g(!1)}},M=async E=>{var I,Y;if(E.preventDefault(),v(""),k(""),m.newPassword!==m.confirmPassword){v("New passwords do not match");return}j(!0);try{const T=await ae.post("/auth/change-password",{old_password:m.oldPassword,new_password:m.newPassword});T.data.success?(k("Password changed successfully!"),y({oldPassword:"",newPassword:"",confirmPassword:""})):v(T.data.message||"Failed to change password")}catch(T){v(((Y=(I=T.response)==null?void 0:I.data)==null?void 0:Y.detail)||"Failed to change password")}finally{j(!1)}},U=(e==null?void 0:e.oauth_type)==="Google"||(e==null?void 0:e.oauth_type)==="GitHub",C=!U,L=!U;return c.jsxs("div",{className:"max-w-2xl mx-auto space-y-8",children:[c.jsxs("div",{children:[c.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:"Account Settings"}),c.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:"Manage your profile and preferences."})]}),c.jsxs("div",{className:"bg-white dark:bg-secondary rounded-xl p-6 shadow-md dark:shadow-lg dark:shadow-black/10 border border-gray-200 dark:border-white/5 space-y-6",children:[c.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Profile Information"}),c.jsxs("form",{onSubmit:G,className:"space-y-4",children:[h&&c.jsx("div",{className:"bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400 p-3 rounded-lg text-sm",children:h}),u&&c.jsx("div",{className:"bg-green-50 dark:bg-green-900/20 text-green-600 dark:text-green-400 p-3 rounded-lg text-sm",children:u}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Username"}),c.jsxs("div",{className:"relative",children:[c.jsx(Ao,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),c.jsx("input",{type:"text",value:r.username,onChange:E=>s({...r,username:E.target.value}),className:"w-full pl-9 pr-4 py-2 bg-white dark:bg-black/50 border border-gray-200 dark:border-white/10 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500 dark:text-white"})]})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Full Name"}),c.jsxs("div",{className:"relative",children:[c.jsx(Ao,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),c.jsx("input",{type:"text",value:r.full_name,onChange:E=>s({...r,full_name:E.target.value}),className:"w-full pl-9 pr-4 py-2 bg-white dark:bg-black/50 border border-gray-200 dark:border-white/10 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500 dark:text-white",placeholder:"John Doe",disabled:p})]})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Email Address"}),c.jsxs("div",{className:"relative",children:[c.jsx(ku,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),c.jsx("input",{type:"email",value:r.email,onChange:E=>s({...r,email:E.target.value}),className:`w-full pl-9 pr-4 py-2 bg-white dark:bg-black/50 border border-gray-200 dark:border-white/10 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500 dark:text-white ${L?"":"opacity-50 cursor-not-allowed"}`,disabled:!L,title:L?"":"Email cannot be changed for OAuth accounts"})]})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Organization"}),c.jsxs("div",{className:"relative",children:[c.jsx(W1,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),c.jsx("input",{type:"text",value:r.organization,onChange:E=>s({...r,organization:E.target.value}),className:"w-full pl-9 pr-4 py-2 bg-white dark:bg-black/50 border border-gray-200 dark:border-white/10 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500 dark:text-white",placeholder:"Organization Name",disabled:p})]})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Organization Type"}),c.jsxs("div",{className:"relative",children:[c.jsx(U1,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),c.jsxs("select",{value:r.organization_type,onChange:E=>s({...r,organization_type:E.target.value}),className:"w-full pl-9 pr-4 py-2 bg-white dark:bg-black/50 border border-gray-200 dark:border-white/10 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500 dark:text-white appearance-none",disabled:p,children:[c.jsx("option",{value:"",children:"Select type..."}),p6.map(E=>c.jsx("option",{value:E,children:E},E))]})]})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Impact Sectors"}),c.jsx("div",{className:"flex flex-wrap gap-2 mt-1",children:[...Cb,...o.filter(E=>!Cb.includes(E))].map(E=>c.jsxs("button",{type:"button",onClick:()=>D(E),disabled:p,className:`px-3 py-1.5 rounded-full text-sm border transition-colors ${o.includes(E)?"border-primary-500 bg-primary-500/10 text-primary-600 dark:text-primary-400":"border-gray-200 dark:border-white/10 text-gray-500 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-white/5"}`,children:[E," ",o.includes(E)&&"✓"]},E))}),c.jsxs("div",{className:"flex gap-2 mt-2",children:[c.jsx("input",{type:"text",value:a,onChange:E=>l(E.target.value),onKeyDown:E=>E.key==="Enter"&&(E.preventDefault(),W()),className:"flex-1 px-3 py-1.5 bg-white dark:bg-black/50 border border-gray-200 dark:border-white/10 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500 dark:text-white text-sm placeholder-gray-400 dark:placeholder-gray-600",placeholder:"Add custom sector...",disabled:p}),c.jsx("button",{type:"button",onClick:W,disabled:p,className:"px-3 py-1.5 text-sm border border-gray-200 dark:border-white/10 rounded-lg text-gray-600 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-white/5 transition-colors",children:"Add"})]})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Account Type"}),c.jsxs("div",{className:"relative",children:[c.jsx(fR,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),c.jsx("input",{type:"text",value:(e==null?void 0:e.account_type)||"Standard",readOnly:!0,className:"w-full pl-9 pr-4 py-2 bg-gray-50 dark:bg-white/5 border border-gray-200 dark:border-white/10 rounded-lg focus:outline-none text-gray-500 dark:text-gray-400 cursor-not-allowed"})]})]}),c.jsx("div",{className:"pt-2",children:c.jsx("button",{type:"submit",disabled:p,className:"px-4 py-2 bg-primary-600 hover:bg-primary-700 text-white rounded-lg text-sm font-medium transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:p?"Saving...":"Save Changes"})})]})]}),c.jsxs("div",{className:"bg-white dark:bg-secondary rounded-xl p-6 shadow-md dark:shadow-lg dark:shadow-black/10 border border-gray-200 dark:border-white/5 space-y-6",children:[c.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Appearance"}),c.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[c.jsxs("button",{onClick:()=>n("light"),className:`p-4 rounded-lg border flex flex-col items-center gap-2 transition-all ${t==="light"?"border-primary-500 bg-primary-50 dark:bg-primary-900/20 text-primary-700 dark:text-primary-400":"border-gray-200 dark:border-white/10 hover:bg-gray-50 dark:hover:bg-white/5 text-gray-700 dark:text-gray-300"}`,children:[c.jsx(pf,{className:"w-6 h-6"}),c.jsx("span",{className:"text-sm font-medium",children:"Light"})]}),c.jsxs("button",{onClick:()=>n("dark"),className:`p-4 rounded-lg border flex flex-col items-center gap-2 transition-all ${t==="dark"?"border-primary-500 bg-primary-50 dark:bg-primary-900/20 text-primary-700 dark:text-primary-400":"border-gray-200 dark:border-white/10 hover:bg-gray-50 dark:hover:bg-white/5 text-gray-700 dark:text-gray-300"}`,children:[c.jsx(ff,{className:"w-6 h-6"}),c.jsx("span",{className:"text-sm font-medium",children:"Dark"})]}),c.jsxs("button",{onClick:()=>n("system"),className:`p-4 rounded-lg border flex flex-col items-center gap-2 transition-all ${t==="system"?"border-primary-500 bg-primary-50 dark:bg-primary-900/20 text-primary-700 dark:text-primary-400":"border-gray-200 dark:border-white/10 hover:bg-gray-50 dark:hover:bg-white/5 text-gray-700 dark:text-gray-300"}`,children:[c.jsx(bR,{className:"w-6 h-6"}),c.jsx("span",{className:"text-sm font-medium",children:"System"})]})]})]}),C&&c.jsxs("div",{className:"bg-white dark:bg-secondary rounded-xl p-6 shadow-md dark:shadow-lg dark:shadow-black/10 border border-gray-200 dark:border-white/5 space-y-6",children:[c.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Change Password"}),c.jsxs("form",{onSubmit:M,className:"space-y-4",children:[x&&c.jsx("div",{className:"bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400 p-3 rounded-lg text-sm",children:x}),b&&c.jsx("div",{className:"bg-green-50 dark:bg-green-900/20 text-green-600 dark:text-green-400 p-3 rounded-lg text-sm",children:b}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Current Password"}),c.jsxs("div",{className:"relative",children:[c.jsx(Jn,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),c.jsx("input",{type:N?"text":"password",required:!0,placeholder:"••••••••",value:m.oldPassword,onChange:E=>y({...m,oldPassword:E.target.value}),className:"w-full pl-9 pr-12 py-2 bg-white dark:bg-black/50 border border-gray-200 dark:border-white/10 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500 dark:text-white",disabled:w}),c.jsx("button",{type:"button",onClick:()=>_(!N),className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300",disabled:w,children:N?c.jsx(Dr,{className:"w-4 h-4"}):c.jsx(Ir,{className:"w-4 h-4"})})]})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"New Password"}),c.jsxs("div",{className:"relative",children:[c.jsx(Jn,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),c.jsx("input",{type:P?"text":"password",placeholder:"••••••••",required:!0,value:m.newPassword,onChange:E=>y({...m,newPassword:E.target.value}),className:"w-full pl-9 pr-12 py-2 bg-white dark:bg-black/50 border border-gray-200 dark:border-white/10 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500 dark:text-white",disabled:w}),c.jsx("button",{type:"button",onClick:()=>A(!P),className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300",disabled:w,children:P?c.jsx(Dr,{className:"w-4 h-4"}):c.jsx(Ir,{className:"w-4 h-4"})})]})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Confirm New Password"}),c.jsxs("div",{className:"relative",children:[c.jsx(Jn,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),c.jsx("input",{type:O?"text":"password",required:!0,placeholder:"••••••••",value:m.confirmPassword,onChange:E=>y({...m,confirmPassword:E.target.value}),className:"w-full pl-9 pr-12 py-2 bg-white dark:bg-black/50 border border-gray-200 dark:border-white/10 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500 dark:text-white",disabled:w}),c.jsx("button",{type:"button",onClick:()=>F(!O),className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300",disabled:w,children:O?c.jsx(Dr,{className:"w-4 h-4"}):c.jsx(Ir,{className:"w-4 h-4"})})]})]}),c.jsx("div",{className:"pt-2",children:c.jsx("button",{type:"submit",disabled:w,className:"px-4 py-2 bg-primary-600 hover:bg-primary-700 text-white rounded-lg text-sm font-medium transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:w?"Changing Password...":"Change Password"})})]})]})]})}function m6({value:e,onChange:t,options:n,placeholder:r="Select...",disabled:s=!1,className:o=""}){const[i,a]=S.useState(!1),[l,u]=S.useState(""),d=S.useRef(null),h=S.useRef(null);S.useEffect(()=>{const m=y=>{d.current&&!d.current.contains(y.target)&&(a(!1),u(""))};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[]),S.useEffect(()=>{i&&h.current&&h.current.focus()},[i]);const f=n.filter(m=>m.toLowerCase().includes(l.toLowerCase())),p=m=>{t(m),a(!1),u("")},g=m=>{m.stopPropagation(),t(""),u("")};return c.jsxs("div",{className:`relative ${o}`,ref:d,children:[c.jsxs("button",{type:"button",onClick:()=>!s&&a(!i),disabled:s,className:"flex items-center justify-between w-full min-w-[240px] px-3 py-2 text-sm bg-white dark:bg-secondary border border-gray-200 dark:border-white/10 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500 dark:text-white disabled:opacity-50 disabled:cursor-not-allowed",children:[c.jsx("span",{className:e?"text-gray-900 dark:text-white":"text-gray-400 dark:text-gray-500",children:e||r}),c.jsxs("div",{className:"flex items-center gap-1 ml-2",children:[e&&c.jsx(Su,{size:14,className:"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 cursor-pointer",onClick:g}),c.jsx(G1,{size:16,className:`text-gray-400 transition-transform ${i?"rotate-180":""}`})]})]}),i&&c.jsxs("div",{className:"absolute z-50 w-full mt-1 bg-white dark:bg-secondary border border-gray-200 dark:border-white/10 rounded-lg shadow-lg overflow-hidden",children:[c.jsx("div",{className:"p-2 border-b border-gray-200 dark:border-white/10",children:c.jsxs("div",{className:"relative",children:[c.jsx(tk,{size:14,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-gray-400"}),c.jsx("input",{ref:h,type:"text",value:l,onChange:m=>u(m.target.value),placeholder:"Search...",className:"w-full pl-8 pr-3 py-1.5 text-sm bg-gray-50 dark:bg-black/30 border border-gray-200 dark:border-white/10 rounded-md focus:outline-none focus:ring-1 focus:ring-primary-500 dark:text-white placeholder-gray-400"})]})}),c.jsx("div",{className:"max-h-60 overflow-y-auto",children:f.length===0?c.jsx("div",{className:"px-3 py-4 text-sm text-gray-400 text-center",children:"No results found"}):f.map(m=>c.jsx("button",{onClick:()=>p(m),className:`w-full text-left px-3 py-2 text-sm transition-colors ${m===e?"bg-primary-50 text-primary-600 dark:bg-primary-900/20 dark:text-primary-400":"text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-white/5"}`,children:m},m))})]})]})}const y6=[{label:"Overview",value:"overview"},{label:"By Organization",value:"organization"},{label:"By Org Type",value:"organization_type"},{label:"By Sector",value:"sector"}];function x6({view:e,onViewChange:t,filterValue:n,onFilterValueChange:r,filters:s,filtersLoading:o}){const a=s?e==="organization"?s.organizations:e==="organization_type"?s.organization_types:e==="sector"?s.sectors:[]:[],l=e!=="overview",u=()=>e==="organization"?"Organization":e==="organization_type"?"Organization Type":e==="sector"?"Sector":"";return c.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-3",children:[c.jsx("div",{className:"flex items-center gap-1 bg-white dark:bg-secondary rounded-lg border border-gray-200 dark:border-white/10 p-1",children:y6.map(d=>c.jsx("button",{onClick:()=>{t(d.value),r("")},className:`px-3 py-1.5 text-sm font-medium rounded-md transition-colors ${e===d.value?"bg-primary-600 text-white":"text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-white/5"}`,children:d.label},d.value))}),l&&c.jsx(m6,{value:n,onChange:r,options:a,placeholder:`Select ${u()}...`,disabled:o||a.length===0})]})}function b6(){const[e,t]=S.useState(null),[n,r]=S.useState(!0);return S.useEffect(()=>{(async()=>{var o,i,a;try{const l=await ae.get("/api/admin/analytics/filters");t(l.data)}catch(l){_n.error(((a=(i=(o=l.response)==null?void 0:o.data)==null?void 0:i.detail)==null?void 0:a.message)||"Failed to fetch filter options")}finally{r(!1)}})()},[]),{filters:e,loading:n}}function v6(e,t,n="7d"){const[r,s]=S.useState(null),[o,i]=S.useState(!0),[a,l]=S.useState(null),u=S.useCallback(async()=>{var d,h,f;i(!0),l(null);try{let p="/api/admin/analytics/";const g=new URLSearchParams({time_range:n});e==="overview"?p+="overview":e==="organization"?(p+="by-organization",g.set("organization",t)):e==="organization_type"?(p+="by-organization-type",g.set("organization_type",t)):e==="sector"&&(p+="by-sector",g.set("sector",t));const m=await ae.get(`${p}?${g.toString()}`);s(m.data)}catch(p){const g=((f=(h=(d=p.response)==null?void 0:d.data)==null?void 0:h.detail)==null?void 0:f.message)||"Failed to fetch analytics data";l(g),_n.error(g)}finally{i(!1)}},[e,t,n]);return S.useEffect(()=>{e==="overview"||t?u():(s(null),i(!1))},[e,t,n,u]),{data:r,loading:o,error:a}}function w6(){return{exportCSV:async(t,n,r)=>{try{const s=new URLSearchParams({view:t,time_range:n});t==="organization"&&r?s.set("organization",r):t==="organization_type"&&r?s.set("organization_type",r):t==="sector"&&r&&s.set("sector",r);const o=await ae.get(`/api/admin/analytics/export?${s.toString()}`,{responseType:"blob"}),i=new Blob([o.data],{type:"text/csv"}),a=window.URL.createObjectURL(i),l=document.createElement("a");l.href=a,l.download=`analytics_${t}_${n}.csv`,document.body.appendChild(l),l.click(),document.body.removeChild(l),window.URL.revokeObjectURL(a),_n.success("CSV exported successfully")}catch{_n.error("Failed to export CSV")}}}}Bs.register(zo,Vo,Cs,bn,zu,Vu,Fu,Iu);const Nb=["#E6194B","#3CB44B","#4363D8","#F58231","#911EB4","#42D4F4","#F032E6","#469990","#9A6324","#800000","#808000","#000075","#000000"];function k6(){var P,A,O,F,D,W,G,M,U,C,L,E,I,Y;const[e,t]=S.useState("7d"),[n,r]=S.useState("overview"),[s,o]=S.useState(""),{filters:i,loading:a}=b6(),{data:l,loading:u}=v6(n,s,e),{exportCSV:d}=w6(),h=S.useMemo(()=>{var $;const T={Total:"#6B7280"};return($=l==null?void 0:l.endpoint_chart_data)!=null&&$.datasets&&Object.keys(l.endpoint_chart_data.datasets).sort().forEach((ne,ce)=>{T[ne]=Nb[ce%Nb.length]}),T},[l]),[f,p]=S.useState({Total:!0});S.useEffect(()=>{var T;(T=l==null?void 0:l.endpoint_chart_data)!=null&&T.datasets&&p($=>{const K={...$};return Object.keys(l.endpoint_chart_data.datasets).forEach(ne=>{K[ne]===void 0&&(K[ne]=!0)}),K})},[l]);const g=S.useMemo(()=>{var $;const T=[{label:"Total",value:"Total",color:h.Total}];return($=l==null?void 0:l.endpoint_chart_data)!=null&&$.datasets&&Object.keys(l.endpoint_chart_data.datasets).sort().forEach(K=>{T.push({label:K.replace("/v1/",""),value:K,color:h[K]})}),T},[l,h]),m=S.useMemo(()=>Object.keys(f).filter(T=>f[T]!==!1),[f]),y=T=>{const $={};g.forEach(K=>{$[K.value]=T.includes(K.value)}),p($)},x=((P=l==null?void 0:l.endpoint_chart_data)==null?void 0:P.datasets)||{},v={labels:((A=l==null?void 0:l.endpoint_chart_data)==null?void 0:A.labels)||((O=l==null?void 0:l.chart_data)==null?void 0:O.labels)||[],datasets:[...Object.entries(x).map(([T,$])=>({label:T,data:$,borderColor:h[T]||"#6B7280",backgroundColor:"transparent",tension:.4,borderWidth:2,hidden:f[T]===!1})),{label:"Total",data:((F=l==null?void 0:l.chart_data)==null?void 0:F.data)||[],borderColor:"#6B7280",backgroundColor:"transparent",borderWidth:3,tension:.4,hidden:f.Total===!1}]},b={labels:((D=l==null?void 0:l.latency_chart)==null?void 0:D.labels)||[],datasets:[{label:"Avg Latency (ms)",data:((G=(W=l==null?void 0:l.latency_chart)==null?void 0:W.data)==null?void 0:G.map(T=>T*1e3))||[],fill:!0,backgroundColor:T=>{const K=T.chart.ctx.createLinearGradient(0,0,0,200);return K.addColorStop(0,"rgba(59, 130, 246, 0.2)"),K.addColorStop(1,"rgba(59, 130, 246, 0)"),K},borderColor:"#3b82f6",tension:.4}]},k={responsive:!0,maintainAspectRatio:!1,plugins:{legend:{display:!1},tooltip:{mode:"index",intersect:!1,backgroundColor:"rgba(0, 0, 0, 0.8)",titleColor:"#fff",bodyColor:"#fff",borderColor:"rgba(255, 255, 255, 0.1)",borderWidth:1,padding:10}},scales:{x:{grid:{display:!1},ticks:{color:"rgba(156, 163, 175, 0.8)"}},y:{grid:{color:"rgba(156, 163, 175, 0.1)"},ticks:{color:"rgba(156, 163, 175, 0.8)"},beginAtZero:!0}},interaction:{mode:"nearest",axis:"x",intersect:!1}},w=((M=l==null?void 0:l.usage)==null?void 0:M.reduce((T,$)=>T+$.used,0))||0,j=(C=(U=l==null?void 0:l.latency_chart)==null?void 0:U.data)!=null&&C.length?(l.latency_chart.data.reduce((T,$)=>T+$,0)/l.latency_chart.data.length*1e3).toFixed(0):"0",N=(L=l==null?void 0:l.usage)==null?void 0:L.reduce((T,$)=>$.used>((T==null?void 0:T.used)||0)?$:T,null),_=((E=i==null?void 0:i.organizations)==null?void 0:E.length)||0;return u&&!l?c.jsxs("div",{className:"space-y-6",children:[c.jsxs("div",{className:"flex flex-col gap-4",children:[c.jsx(me,{className:"h-8 w-48 mb-2"}),c.jsx(me,{className:"h-10 w-full max-w-xl"})]}),c.jsx("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[1,2,3,4].map(T=>c.jsxs("div",{className:"bg-white dark:bg-secondary p-6 rounded-xl border border-gray-200 dark:border-white/5 shadow-sm",children:[c.jsx(me,{className:"h-8 w-8 rounded-lg mb-4"}),c.jsx(me,{className:"h-8 w-32 mb-1"}),c.jsx(me,{className:"h-3 w-16"})]},T))}),c.jsx(me,{className:"h-[400px] w-full rounded-xl"})]}):c.jsxs("div",{className:"space-y-6",children:[c.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4",children:[c.jsxs("div",{children:[c.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:"Admin Analytics"}),c.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:"Platform-wide API usage and performance analytics."})]}),c.jsxs("button",{onClick:()=>d(n,e,s),className:"flex items-center gap-2 px-4 py-2 bg-primary-600 text-white rounded-lg hover:bg-primary-700 transition-colors text-sm font-medium",children:[c.jsx(X1,{size:16}),"Export CSV"]})]}),c.jsx(x6,{view:n,onViewChange:r,filterValue:s,onFilterValueChange:o,filters:i,filtersLoading:a}),n!=="overview"&&!s&&c.jsxs("div",{className:"text-center py-12 text-gray-500 dark:text-gray-400",children:[c.jsx(U0,{size:48,className:"mx-auto mb-4 opacity-50"}),c.jsx("p",{className:"text-lg font-medium",children:"Select a filter value above to view analytics"})]}),(n==="overview"||s)&&l&&c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[c.jsx(St,{label:"Total Requests",value:w.toLocaleString(),icon:bu,color:"bg-blue-500"}),c.jsx(St,{label:"Avg Latency",value:`${j}ms`,icon:wu,color:"bg-orange-500"}),c.jsx(St,{label:"Most Used",value:((I=N==null?void 0:N.endpoint)==null?void 0:I.replace("/v1/",""))||"N/A",icon:og,color:"bg-purple-500"}),c.jsx(St,{label:"Organizations",value:_,icon:U0,color:"bg-green-500"})]}),c.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[c.jsx("div",{className:"lg:col-span-2",children:c.jsxs(Ms,{title:"Request Volume by Endpoint",description:"Track usage trends across all users",showTimeSelector:!0,timeRange:e,onTimeRangeChange:t,className:"h-[400px]",children:[c.jsx("div",{className:"flex flex-wrap gap-3 mb-4 pb-4 border-b border-gray-200 dark:border-white/10",children:c.jsx(j2,{label:"Select Endpoints",options:g,selected:m,onChange:y})}),c.jsx("div",{className:"flex-1 min-h-0",children:c.jsx(Bo,{options:k,data:v})})]})}),c.jsx(Ms,{title:"Latency Trends",description:"Average response time over the selected period",showTimeSelector:!0,timeRange:e,onTimeRangeChange:t,children:c.jsx("div",{className:"flex-1 min-h-0",children:c.jsx(Bo,{options:k,data:b})})}),c.jsxs("div",{className:"bg-white dark:bg-secondary rounded-xl shadow-md dark:shadow-lg dark:shadow-black/10 border border-gray-200 dark:border-white/5 p-6",children:[c.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-4",children:"Endpoint Breakdown"}),c.jsx("div",{className:"space-y-3",children:(Y=l==null?void 0:l.usage)==null?void 0:Y.filter(T=>T.endpoint!=="unknown").sort((T,$)=>$.used-T.used).map(T=>{const $=w>0?(T.used/w*100).toFixed(1):"0";return c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[c.jsx("div",{className:"w-3 h-3 rounded-full flex-shrink-0",style:{backgroundColor:h[T.endpoint]||"#6B7280"}}),c.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-300",children:T.endpoint.replace("/tasks/","").replace("/tasks","tasks")})]}),c.jsxs("div",{className:"flex items-center gap-4",children:[c.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-white",children:T.used.toLocaleString()}),c.jsxs("span",{className:"text-sm text-gray-500 dark:text-gray-400 w-12 text-right",children:[$,"%"]})]})]},T.endpoint)})})]})]}),(l==null?void 0:l.per_user_breakdown)&&l.per_user_breakdown.length>0&&c.jsxs("div",{className:"bg-white dark:bg-secondary rounded-xl shadow-md dark:shadow-lg dark:shadow-black/10 border border-gray-200 dark:border-white/5 p-6",children:[c.jsxs("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-4",children:["User Breakdown — ",l.organization]}),c.jsx("div",{className:"overflow-x-auto",children:c.jsxs("table",{className:"w-full text-sm",children:[c.jsx("thead",{children:c.jsxs("tr",{className:"border-b border-gray-200 dark:border-white/10",children:[c.jsx("th",{className:"text-left py-3 px-4 font-medium text-gray-500 dark:text-gray-400",children:"Username"}),c.jsx("th",{className:"text-right py-3 px-4 font-medium text-gray-500 dark:text-gray-400",children:"Total Requests"}),c.jsx("th",{className:"text-left py-3 px-4 font-medium text-gray-500 dark:text-gray-400",children:"Top Endpoints"})]})}),c.jsx("tbody",{children:l.per_user_breakdown.map(T=>{const $=Object.entries(T.endpoints).sort(([,K],[,ne])=>ne-K).slice(0,3);return c.jsxs("tr",{className:"border-b border-gray-100 dark:border-white/5 hover:bg-gray-50 dark:hover:bg-white/5",children:[c.jsx("td",{className:"py-3 px-4 text-gray-900 dark:text-white font-medium",children:T.username}),c.jsx("td",{className:"py-3 px-4 text-right text-gray-900 dark:text-white",children:T.total_requests.toLocaleString()}),c.jsx("td",{className:"py-3 px-4",children:c.jsx("div",{className:"flex flex-wrap gap-1",children:$.map(([K,ne])=>c.jsxs("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs bg-gray-100 dark:bg-white/10 text-gray-700 dark:text-gray-300",children:[K.replace("/tasks/",""),": ",ne]},K))})})]},T.username)})})]})})]})]})]})}const HS="/api/admin/analytics/billing";function US(e,t={}){return new URLSearchParams({category:e.category,provider:e.provider,range:e.range,resolution:e.resolution,...t})}function $a(e,t,n={}){const[r,s]=S.useState(null),[o,i]=S.useState(!0),a=JSON.stringify(n),l=S.useCallback(async()=>{var u,d;i(!0);try{const h=US(t,JSON.parse(a)),f=await ae.get(`${HS}${e}?${h.toString()}`);s(f.data)}catch(h){const f=h;_n.error(((d=(u=f.response)==null?void 0:u.data)==null?void 0:d.message)||`Failed to load ${e}`)}finally{i(!1)}},[e,t.category,t.provider,t.range,t.resolution,a]);return S.useEffect(()=>{l()},[l]),{data:r,loading:o}}const S6=e=>$a("/summary",e),_6=e=>$a("/timeseries",e,{group_by:e.groupBy||"provider"}),j6=e=>$a("/providers",e),C6=(e,t,n,r)=>$a("/table",e,{page:String(t),page_size:"50",sort:n,sort_dir:r,...e.search?{search:e.search}:{}}),N6=(e,t)=>$a("/breakdown",e,{group_by:t});function P6(){return{exportCSV:async t=>{try{const n=US(t),r=await ae.get(`${HS}/export?${n.toString()}`,{responseType:"blob"}),s=window.URL.createObjectURL(new Blob([r.data],{type:"text/csv"})),o=document.createElement("a");o.href=s,o.download=`billing_${t.provider}_${t.resolution}.csv`,document.body.appendChild(o),o.click(),document.body.removeChild(o),window.URL.revokeObjectURL(s),_n.success("CSV exported")}catch{_n.error("Failed to export CSV")}}}}Bs.register(zo,Vo,Cs,bn,Ci,zu,Vu,Fu,Iu);const R6=[["today","Today"],["yesterday","Yesterday"],["last_7_days","Last 7 Days"],["last_30_days","Last 30 Days"],["last_90_days","Last 90 Days"],["this_month","This Month"],["last_month","Last Month"]],Pb={runpod:"#4363D8",modal:"#F58231",vastai:"#16A34A"},Rb=["#E6194B","#3CB44B","#4363D8","#F58231","#911EB4","#42D4F4","#F032E6","#469990","#9A6324","#800000"];function E6(){var D,W,G,M,U;const[e,t]=S.useState({category:"inference",provider:"all",range:"last_30_days",resolution:"day"}),[n,r]=S.useState(1),[s,o]=S.useState("cost"),[i,a]=S.useState("desc"),[l,u]=S.useState("object"),[d,h]=S.useState(""),{data:f,loading:p}=S6(e),{data:g}=_6(e),{data:m}=j6(e),{data:y}=C6(e,n,s,i),x=e.category==="cloud"?l:"object",{data:v}=N6(e,x),{exportCSV:b}=P6(),k=((v==null?void 0:v.rows)||[]).filter(C=>C.key.toLowerCase().includes(d.toLowerCase())),w=k.reduce((C,L)=>C+L.cost,0),j=C=>{t(L=>({...L,...C})),r(1)},N=C=>{s===C?a(L=>L==="asc"?"desc":"asc"):(o(C),a("desc")),r(1)},_=C=>s===C?i==="asc"?" ▲":" ▼":"",P=(g==null?void 0:g.cost_by_group)||{},A={labels:(g==null?void 0:g.labels)||[],datasets:[...Object.entries(P).map(([C,L],E)=>({label:C,data:L,borderColor:Pb[C]||Rb[E%Rb.length],backgroundColor:"transparent",borderWidth:2,tension:.4})),{label:"Total",data:(g==null?void 0:g.cost)||[],borderColor:"#6B7280",backgroundColor:"transparent",borderWidth:3,borderDash:[5,5],tension:.4}]},O={labels:(m==null?void 0:m.labels)||[],datasets:[{data:(m==null?void 0:m.cost)||[],backgroundColor:((m==null?void 0:m.labels)||[]).map(C=>Pb[C]||"#6B7280")}]},F={responsive:!0,maintainAspectRatio:!1,plugins:{legend:{display:!0,labels:{color:"rgba(156,163,175,0.9)"}}},scales:{x:{grid:{display:!1},ticks:{color:"rgba(156,163,175,0.8)"}},y:{grid:{color:"rgba(156,163,175,0.1)"},beginAtZero:!0,ticks:{color:"rgba(156,163,175,0.8)"}}}};return p&&!f?c.jsxs("div",{className:"space-y-6",children:[c.jsx(me,{className:"h-8 w-64"}),c.jsx("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[1,2,3,4].map(C=>c.jsx(me,{className:"h-28 rounded-xl"},C))}),c.jsx(me,{className:"h-[400px] w-full rounded-xl"})]}):c.jsxs("div",{className:"space-y-6",children:[c.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4",children:[c.jsxs("div",{children:[c.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:"Infrastructure Billing"}),c.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:e.category==="training"?"Vast.ai training spend, GPU hours, and per-job breakdown.":e.category==="cloud"?"AWS spend by service and usage type, from Cost Explorer.":"Runpod & Modal spend, runtime, and storage analytics."})]}),c.jsxs("button",{onClick:()=>b(e),className:"flex items-center gap-2 px-4 py-2 bg-primary-600 text-white rounded-lg hover:bg-primary-700 text-sm font-medium",children:[c.jsx(X1,{size:16})," Export CSV"]})]}),c.jsx("div",{className:"flex gap-1 border-b border-gray-200 dark:border-white/10",children:[["inference","Inference (Runpod & Modal)",!1],["training","Training (Vast.ai)",!1],["cloud","Cloud (AWS)",!1]].map(([C,L,E])=>c.jsx("button",{disabled:E,onClick:()=>{t(I=>({...I,category:C,provider:"all",groupBy:C==="cloud"?"object":void 0})),r(1)},className:"px-4 py-2 text-sm font-medium border-b-2 -mb-px transition-colors "+(E?"text-gray-300 dark:text-gray-600 cursor-not-allowed border-transparent":e.category===C?"border-primary-600 text-primary-700 dark:text-primary-400":"border-transparent text-gray-500 hover:text-gray-800 dark:hover:text-gray-200"),children:L},C))}),c.jsxs("div",{className:"flex flex-wrap gap-3",children:[e.category==="inference"&&c.jsxs("select",{value:e.provider,onChange:C=>j({provider:C.target.value}),className:"px-3 py-2 rounded-lg border border-gray-200 dark:border-white/10 bg-white dark:bg-secondary text-sm",children:[c.jsx("option",{value:"all",children:"All Platforms"}),c.jsx("option",{value:"runpod",children:"Runpod"}),c.jsx("option",{value:"modal",children:"Modal"})]}),c.jsx("select",{value:e.range,onChange:C=>j({range:C.target.value}),className:"px-3 py-2 rounded-lg border border-gray-200 dark:border-white/10 bg-white dark:bg-secondary text-sm",children:R6.map(([C,L])=>c.jsx("option",{value:C,children:L},C))}),c.jsx("select",{value:e.resolution,onChange:C=>j({resolution:C.target.value}),className:"px-3 py-2 rounded-lg border border-gray-200 dark:border-white/10 bg-white dark:bg-secondary text-sm",children:["hour","day","week","month","year"].map(C=>c.jsx("option",{value:C,children:C[0].toUpperCase()+C.slice(1)},C))})]}),(D=f==null?void 0:f.warnings)==null?void 0:D.map(C=>c.jsx("div",{className:"text-sm text-amber-600 dark:text-amber-400 bg-amber-50 dark:bg-amber-900/20 px-4 py-2 rounded-lg",children:C},C)),c.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[c.jsx(St,{label:"Total Spend",value:`$${((f==null?void 0:f.total_spend)||0).toFixed(2)}`,icon:W0,color:"bg-blue-500"}),c.jsx(St,{label:"Avg Daily Spend",value:`$${((f==null?void 0:f.avg_daily_spend)||0).toFixed(2)}`,icon:W0,color:"bg-green-500"}),c.jsx(St,{label:"GPU Hours",value:`${(((f==null?void 0:f.total_runtime_ms)||0)/36e5).toFixed(1)}h`,icon:wu,color:"bg-orange-500"}),c.jsx(St,{label:"Avg Storage",value:`${((f==null?void 0:f.avg_storage_gb)||0).toFixed(0)} GB`,icon:yR,color:"bg-purple-500"})]}),c.jsxs("details",{className:"bg-white dark:bg-secondary rounded-xl border border-gray-200 dark:border-white/5 p-4 text-sm text-gray-600 dark:text-gray-300",children:[c.jsxs("summary",{className:"flex items-center gap-2 cursor-pointer font-medium text-gray-900 dark:text-white",children:[c.jsx(sg,{size:16})," What these numbers mean & how they're computed"]}),c.jsxs("div",{className:"mt-3 space-y-2 leading-relaxed",children:[c.jsxs("p",{children:[c.jsx("b",{children:"Total / Avg Daily Spend"})," — USD billed by the provider for the selected range and platform(s), summed across all records. Modal amounts are pre-credit (before any credits or reservations), so your invoice may be lower."]}),c.jsxs("p",{children:[c.jsx("b",{children:"GPU Hours"})," — total billed run time, from Runpod's ",c.jsx("code",{children:"timeBilledMs"}),"(worker-time across the period). Modal bills per-app cost and does not report a runtime, so this reflects Runpod only."]}),c.jsxs("p",{children:[c.jsx("b",{children:"Avg Storage (GB)"})," — providers bill storage as ",c.jsx("b",{children:"GB-hours"})," (capacity × hours billed), so a steady 350 GB volume reports 350 × 24 = 8,400 per day. We show the time-weighted average — total GB-hours ÷ hours in the range — as actual provisioned GB. The records table and CSV show the raw per-bucket GB-hours."]}),c.jsxs("p",{children:[c.jsx("b",{children:"Active Endpoints / Modal Apps"})," — distinct Runpod endpoints and Modal apps with billing in the range. ",c.jsx("b",{children:"Network Volumes"})," are account-level storage, not an endpoint, so they're excluded from this count (but included in spend/storage)."]}),c.jsxs("p",{children:[c.jsx("b",{children:"Network Volumes"})," — Runpod persistent network storage cost (",c.jsx("code",{children:"/billing/networkvolumes"}),"), shown as its own row and folded into totals."]}),c.jsxs("p",{children:[c.jsx("b",{children:"Cost Over Time"})," — per-bucket spend with a line per platform plus a dashed Total. Buckets roll up to the selected resolution (hour → year)."]}),c.jsxs("p",{children:[c.jsx("b",{children:"Training (Vast.ai)"})," — Vast.ai bills per contract (a whole job), not per day. We spread each contract's cost and GPU-hours evenly across the days it ran so the charts and totals are smooth and correct; the Training Jobs table lists one row per contract (job/instance) with its total GPU-hours and cost. Storage is billed as cost (not GB), so it appears in spend rather than the storage figure."]}),c.jsxs("p",{children:[c.jsx("b",{children:"Cloud (AWS)"})," — AWS costs come from Cost Explorer (UnblendedCost), broken down by service and usage type. The graph shows cost per service over time; the table toggles between Service and Usage-type and is searchable. Hourly granularity is limited by AWS to the last 14 days. Cost Explorer bills per API request, so figures are cached briefly."]}),c.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"Scope & freshness: Runpod is scoped to the configured endpoints; Modal covers the whole workspace. Figures are cached briefly for consistency, so very recent usage settles within the cache window."})]})]}),c.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[c.jsx("div",{className:"lg:col-span-2",children:c.jsx(Ms,{title:"Cost Over Time",description:"Spend per bucket across selected platforms",className:"h-[400px]",children:c.jsx("div",{className:"flex-1 min-h-0",children:c.jsx(Bo,{options:F,data:A})})})}),c.jsx(Ms,{title:"Spend by Platform",description:e.category==="cloud"?"AWS":e.category==="training"?"Vast.ai":"Runpod vs Modal",children:c.jsx("div",{className:"flex-1 min-h-0 flex items-center justify-center",children:c.jsx(uI,{data:O,options:{responsive:!0,maintainAspectRatio:!1}})})}),c.jsxs("div",{className:"bg-white dark:bg-secondary rounded-xl border border-gray-200 dark:border-white/5 p-6",children:[c.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-2",children:"Highlights"}),c.jsxs("ul",{className:"text-sm text-gray-700 dark:text-gray-300 space-y-2",children:[e.category==="training"?c.jsxs("li",{children:["Active jobs/instances: ",c.jsx("b",{children:(f==null?void 0:f.active_instances)??0})]}):e.category==="cloud"?c.jsxs("li",{children:["Active services: ",c.jsx("b",{children:(f==null?void 0:f.active_services)??0})]}):c.jsxs(c.Fragment,{children:[c.jsxs("li",{children:["Active endpoints: ",c.jsx("b",{children:(f==null?void 0:f.active_endpoints)??0})]}),c.jsxs("li",{children:["Active Modal apps: ",c.jsx("b",{children:(f==null?void 0:f.active_modal_apps)??0})]})]}),c.jsxs("li",{children:["Top endpoint: ",c.jsx("b",{children:((W=f==null?void 0:f.highest_cost_endpoint)==null?void 0:W.name)??"N/A"})," ($",(((G=f==null?void 0:f.highest_cost_endpoint)==null?void 0:G.cost)??0).toFixed(2),")"]}),c.jsxs("li",{children:["Top platform: ",c.jsx("b",{children:((M=f==null?void 0:f.highest_cost_platform)==null?void 0:M.name)??"N/A"})," ($",(((U=f==null?void 0:f.highest_cost_platform)==null?void 0:U.cost)??0).toFixed(2),")"]})]})]})]}),c.jsxs("div",{className:"bg-white dark:bg-secondary rounded-xl border border-gray-200 dark:border-white/5 p-6",children:[c.jsxs("div",{className:"flex items-center justify-between mb-4",children:[c.jsxs("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white flex items-center gap-2",children:[c.jsx(CR,{size:18})," ",e.category==="cloud"?"AWS Cost & Usage":e.category==="training"?"Training Jobs":"Billing Records"]}),e.category==="inference"&&c.jsx("input",{type:"text",placeholder:"Search object / GPU / env...",onChange:C=>j({search:C.target.value||void 0}),className:"px-3 py-2 rounded-lg border border-gray-200 dark:border-white/10 bg-white dark:bg-secondary text-sm"})]}),c.jsx("div",{className:"overflow-x-auto",children:e.category==="cloud"?c.jsxs("div",{children:[c.jsxs("div",{className:"flex items-center justify-between mb-3 gap-3",children:[c.jsx("div",{className:"flex gap-1",children:["object","usage_type"].map(C=>c.jsx("button",{onClick:()=>u(C),className:"px-3 py-1 rounded text-sm "+(l===C?"bg-primary-600 text-white":"bg-gray-100 dark:bg-white/10 text-gray-700 dark:text-gray-300"),children:C==="object"?"By Service":"By Usage Type"},C))}),c.jsx("input",{type:"text",value:d,placeholder:"Search service / usage type...",onChange:C=>h(C.target.value),className:"px-3 py-2 rounded-lg border border-gray-200 dark:border-white/10 bg-white dark:bg-secondary text-sm"})]}),c.jsxs("table",{className:"w-full text-sm",children:[c.jsx("thead",{children:c.jsxs("tr",{className:"border-b border-gray-200 dark:border-white/10 text-left text-gray-500 dark:text-gray-400",children:[c.jsx("th",{className:"py-2 px-3",children:l==="object"?"Service":"Usage Type"}),c.jsx("th",{className:"py-2 px-3 text-right",children:"Cost"}),c.jsx("th",{className:"py-2 px-3 text-right",children:"Share"})]})}),c.jsx("tbody",{children:k.map(C=>c.jsxs("tr",{className:"border-b border-gray-100 dark:border-white/5",children:[c.jsx("td",{className:"py-2 px-3",children:C.key}),c.jsxs("td",{className:"py-2 px-3 text-right",children:["$",C.cost.toFixed(2)]}),c.jsxs("td",{className:"py-2 px-3 text-right",children:[w>0?(C.cost/w*100).toFixed(1):"0.0","%"]})]},C.key))})]})]}):e.category==="training"?c.jsxs("table",{className:"w-full text-sm",children:[c.jsx("thead",{children:c.jsxs("tr",{className:"border-b border-gray-200 dark:border-white/10 text-left text-gray-500 dark:text-gray-400",children:[c.jsx("th",{className:"py-2 px-3",children:"Job / Instance"}),c.jsx("th",{className:"py-2 px-3 text-right",children:"GPU Hours"}),c.jsx("th",{className:"py-2 px-3 text-right",children:"Cost"})]})}),c.jsx("tbody",{children:((v==null?void 0:v.rows)||[]).map(C=>c.jsxs("tr",{className:"border-b border-gray-100 dark:border-white/5",children:[c.jsx("td",{className:"py-2 px-3",children:C.key}),c.jsxs("td",{className:"py-2 px-3 text-right",children:[(C.runtime_ms/36e5).toFixed(1),"h"]}),c.jsxs("td",{className:"py-2 px-3 text-right",children:["$",C.cost.toFixed(3)]})]},C.key))})]}):c.jsxs("table",{className:"w-full text-sm",children:[c.jsx("thead",{children:c.jsxs("tr",{className:"border-b border-gray-200 dark:border-white/10 text-left text-gray-500 dark:text-gray-400",children:[c.jsx("th",{className:"py-2 px-3",children:"Provider"}),c.jsx("th",{className:"py-2 px-3",children:"Object"}),c.jsxs("th",{className:"py-2 px-3 cursor-pointer select-none hover:text-gray-700 dark:hover:text-gray-200",onClick:()=>N("timestamp"),children:["Date",_("timestamp")]}),c.jsxs("th",{className:"py-2 px-3 text-right cursor-pointer select-none hover:text-gray-700 dark:hover:text-gray-200",onClick:()=>N("cost"),children:["Cost",_("cost")]}),c.jsx("th",{className:"py-2 px-3",children:"GPU"}),c.jsx("th",{className:"py-2 px-3",children:"Env"})]})}),c.jsx("tbody",{children:((y==null?void 0:y.rows)||[]).map((C,L)=>c.jsxs("tr",{className:"border-b border-gray-100 dark:border-white/5",children:[c.jsx("td",{className:"py-2 px-3",children:C.provider}),c.jsx("td",{className:"py-2 px-3",children:C.object_name}),c.jsx("td",{className:"py-2 px-3",children:C.timestamp.slice(0,10)}),c.jsxs("td",{className:"py-2 px-3 text-right",children:["$",C.cost.toFixed(4)]}),c.jsx("td",{className:"py-2 px-3",children:C.gpu||"-"}),c.jsx("td",{className:"py-2 px-3",children:C.environment||"-"})]},`${C.provider}-${C.object_name}-${C.timestamp}-${L}`))})]})}),e.category==="inference"&&c.jsxs("div",{className:"flex items-center justify-between mt-4 text-sm text-gray-500 dark:text-gray-400",children:[c.jsxs("span",{children:[(y==null?void 0:y.total)??0," records"]}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx("button",{disabled:n<=1,onClick:()=>r(C=>C-1),className:"px-3 py-1 rounded border border-gray-200 dark:border-white/10 disabled:opacity-40",children:"Prev"}),c.jsx("button",{disabled:!y||n*y.page_size>=y.total,onClick:()=>r(C=>C+1),className:"px-3 py-1 rounded border border-gray-200 dark:border-white/10 disabled:opacity-40",children:"Next"})]})]})]})]})}const Gf="/api/admin/google-analytics";function T6(){const[e,t]=S.useState([]),[n,r]=S.useState(!0),[s,o]=S.useState(!1);return S.useEffect(()=>{let i=!1;return(async()=>{var a;try{const{data:l}=await ae.get(`${Gf}/properties`);i||t(l.properties)}catch(l){((a=l==null?void 0:l.response)==null?void 0:a.status)===503?i||o(!0):_n.error("Failed to load GA properties")}finally{i||r(!1)}})(),()=>{i=!0}},[]),{properties:e,loading:n,notConfigured:s}}function A6(e,t){const[n,r]=S.useState(null),[s,o]=S.useState(!1),[i,a]=S.useState(null),l=S.useCallback(async(u=!1)=>{var d,h;if(e){o(!0),a(null);try{const f=u?`${Gf}/refresh`:`${Gf}/overview`,{data:p}=await ae({method:u?"post":"get",url:f,params:{property_id:e,time_range:t}});r(p)}catch(f){const p=((h=(d=f==null?void 0:f.response)==null?void 0:d.data)==null?void 0:h.detail)||"Failed to load analytics";a(typeof p=="string"?p:"Failed to load analytics"),_n.error(typeof p=="string"?p:"Failed to load analytics")}finally{o(!1)}}},[e,t]);return S.useEffect(()=>{l(!1)},[l]),{data:n,loading:s,error:i,refresh:()=>l(!0)}}function M6({series:e}){const t={labels:e.labels,datasets:[{label:"Active users",data:e.active_users,borderColor:"#3b82f6",backgroundColor:"rgba(59,130,246,0.15)",tension:.4},{label:"New users",data:e.new_users,borderColor:"#10b981",backgroundColor:"rgba(16,185,129,0.1)",tension:.4},{label:"Sessions",data:e.sessions,borderColor:"#f59e0b",backgroundColor:"rgba(245,158,11,0.1)",tension:.4}]},n={responsive:!0,maintainAspectRatio:!1,plugins:{legend:{position:"top"}},interaction:{mode:"index",intersect:!1},scales:{y:{beginAtZero:!0,grid:{color:"rgba(156,163,175,0.1)"}},x:{grid:{display:!1}}}};return c.jsx("div",{className:"h-[300px]",children:c.jsx(Bo,{data:t,options:n})})}function L6({pages:e}){return e.length?c.jsx("div",{className:"overflow-x-auto",children:c.jsxs("table",{className:"w-full text-sm",children:[c.jsx("thead",{children:c.jsxs("tr",{className:"border-b border-gray-200 dark:border-white/10 text-left",children:[c.jsx("th",{className:"py-2 px-3 font-medium text-gray-500 dark:text-gray-400",children:"Page"}),c.jsx("th",{className:"py-2 px-3 font-medium text-gray-500 dark:text-gray-400 text-right",children:"Views"}),c.jsx("th",{className:"py-2 px-3 font-medium text-gray-500 dark:text-gray-400 text-right",children:"Users"}),c.jsx("th",{className:"py-2 px-3 font-medium text-gray-500 dark:text-gray-400 text-right",children:"Avg duration"})]})}),c.jsx("tbody",{children:e.map(t=>c.jsxs("tr",{className:"border-b border-gray-100 dark:border-white/5 hover:bg-gray-50 dark:hover:bg-white/5",children:[c.jsxs("td",{className:"py-2 px-3",children:[c.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:t.title||t.path}),c.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:t.path})]}),c.jsx("td",{className:"py-2 px-3 text-right text-gray-900 dark:text-white",children:t.views.toLocaleString()}),c.jsx("td",{className:"py-2 px-3 text-right text-gray-900 dark:text-white",children:t.users.toLocaleString()}),c.jsxs("td",{className:"py-2 px-3 text-right text-gray-700 dark:text-gray-300",children:[t.avg_duration.toFixed(1),"s"]})]},t.path))})]})}):c.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"No page views in this range."})}function sh({title:e,rows:t}){const n=t.reduce((r,s)=>r+s.users,0);return c.jsxs("div",{children:[c.jsx("h4",{className:"text-sm font-semibold text-gray-700 dark:text-gray-200 mb-2",children:e}),t.length===0?c.jsx("p",{className:"text-xs text-gray-500",children:"No data."}):c.jsx("ul",{className:"space-y-1",children:t.map(r=>{const s=n?(r.users/n*100).toFixed(1):"0";return c.jsxs("li",{className:"flex items-center justify-between text-sm",children:[c.jsx("span",{className:"text-gray-700 dark:text-gray-300",children:r.label}),c.jsxs("span",{className:"text-gray-900 dark:text-white font-medium",children:[r.users.toLocaleString()," ",c.jsxs("span",{className:"text-xs text-gray-500",children:["(",s,"%)"]})]})]},r.label)})})]})}function O6({platforms:e}){return c.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[c.jsx(sh,{title:"Device",rows:e.device}),c.jsx(sh,{title:"Operating system",rows:e.os}),c.jsx(sh,{title:"Browser",rows:e.browser})]})}function D6({rows:e}){return e.length?c.jsx("div",{className:"overflow-x-auto",children:c.jsxs("table",{className:"w-full text-sm",children:[c.jsx("thead",{children:c.jsxs("tr",{className:"border-b border-gray-200 dark:border-white/10 text-left",children:[c.jsx("th",{className:"py-2 px-3 font-medium text-gray-500 dark:text-gray-400",children:"Country"}),c.jsx("th",{className:"py-2 px-3 font-medium text-gray-500 dark:text-gray-400",children:"City"}),c.jsx("th",{className:"py-2 px-3 font-medium text-gray-500 dark:text-gray-400 text-right",children:"Users"}),c.jsx("th",{className:"py-2 px-3 font-medium text-gray-500 dark:text-gray-400 text-right",children:"Sessions"})]})}),c.jsx("tbody",{children:e.map(t=>c.jsxs("tr",{className:"border-b border-gray-100 dark:border-white/5 hover:bg-gray-50 dark:hover:bg-white/5",children:[c.jsx("td",{className:"py-2 px-3 text-gray-900 dark:text-white",children:t.country||"—"}),c.jsx("td",{className:"py-2 px-3 text-gray-700 dark:text-gray-300",children:t.city||"—"}),c.jsx("td",{className:"py-2 px-3 text-right text-gray-900 dark:text-white",children:t.users.toLocaleString()}),c.jsx("td",{className:"py-2 px-3 text-right text-gray-700 dark:text-gray-300",children:t.sessions.toLocaleString()})]},`${t.country}-${t.city}`))})]})}):c.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"No geographic data."})}function I6({events:e}){return e.length?c.jsxs("table",{className:"w-full text-sm",children:[c.jsx("thead",{children:c.jsxs("tr",{className:"border-b border-gray-200 dark:border-white/10 text-left",children:[c.jsx("th",{className:"py-2 px-3 font-medium text-gray-500 dark:text-gray-400",children:"Event"}),c.jsx("th",{className:"py-2 px-3 font-medium text-gray-500 dark:text-gray-400 text-right",children:"Count"}),c.jsx("th",{className:"py-2 px-3 font-medium text-gray-500 dark:text-gray-400 text-right",children:"Users"})]})}),c.jsx("tbody",{children:e.map(t=>c.jsxs("tr",{className:"border-b border-gray-100 dark:border-white/5 hover:bg-gray-50 dark:hover:bg-white/5",children:[c.jsx("td",{className:"py-2 px-3 text-gray-900 dark:text-white font-mono text-xs",children:t.name}),c.jsx("td",{className:"py-2 px-3 text-right text-gray-900 dark:text-white",children:t.count.toLocaleString()}),c.jsx("td",{className:"py-2 px-3 text-right text-gray-700 dark:text-gray-300",children:t.users.toLocaleString()})]},t.name))})]}):c.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"No events in this range."})}Bs.register(zo,Vo,Cs,bn,zu,Vu,Fu,Iu);const F6=[{label:"Last 24h",value:"24h"},{label:"Last 7 days",value:"7d"},{label:"Last 30 days",value:"30d"},{label:"Last 60 days",value:"60d"},{label:"Last 90 days",value:"90d"}];function z6(){const{properties:e,loading:t,notConfigured:n}=T6(),[r,s]=x1(),o=r.get("property")||"",i=r.get("range")||"7d";S.useEffect(()=>{!o&&e.length>0&&s({property:e[0].id,range:i},{replace:!0})},[e,o,i,s]);const{data:a,loading:l,error:u,refresh:d}=A6(o,i),h=S.useMemo(()=>{if(!a)return null;const f=g=>g.reduce((m,y)=>m+y,0),p=g=>g.length?f(g)/g.length:0;return{users:f(a.traffic.active_users),sessions:f(a.traffic.sessions),engagementRate:p(a.traffic.engagement_rate),avgSessionSec:p(a.traffic.avg_session_duration)}},[a]);return n?c.jsx("div",{className:"text-center py-12",children:c.jsxs("p",{className:"text-gray-500 dark:text-gray-400",children:["Google Analytics is not configured. See ",c.jsx("code",{children:"docs/google-analytics.md"}),"."]})}):t?c.jsxs("div",{className:"space-y-6",children:[c.jsx(me,{className:"h-8 w-48"}),c.jsx(me,{className:"h-10 w-full max-w-xl"}),c.jsx(me,{className:"h-[400px] w-full rounded-xl"})]}):c.jsxs("div",{className:"space-y-6",children:[c.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4",children:[c.jsxs("div",{children:[c.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:"Google Analytics"}),c.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:"Site & app analytics for Sunbird properties."})]}),c.jsxs("button",{onClick:()=>{d(),_n.info("Refreshing from Google Analytics…")},disabled:l,className:"flex items-center gap-2 px-4 py-2 bg-primary-600 text-white rounded-lg hover:bg-primary-700 disabled:opacity-50 transition-colors text-sm font-medium",children:[c.jsx(jR,{size:16,className:l?"animate-spin":""}),"Refresh"]})]}),c.jsxs("div",{className:"flex flex-wrap gap-3 items-center",children:[c.jsx("select",{value:o,onChange:f=>s({property:f.target.value,range:i}),className:"px-3 py-2 rounded-lg border border-gray-200 dark:border-white/10 bg-white dark:bg-secondary text-sm",children:e.map(f=>c.jsx("option",{value:f.id,children:f.name},f.id))}),c.jsx("select",{value:i,onChange:f=>s({property:o,range:f.target.value}),className:"px-3 py-2 rounded-lg border border-gray-200 dark:border-white/10 bg-white dark:bg-secondary text-sm",children:F6.map(f=>c.jsx("option",{value:f.value,children:f.label},f.value))}),a&&c.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400 ml-auto",children:["Cached until ",new Date(a.cached_until).toLocaleTimeString()]})]}),l&&!a&&c.jsx(me,{className:"h-[400px] w-full rounded-xl"}),u&&!a&&c.jsx("div",{className:"p-4 rounded-lg bg-red-50 dark:bg-red-900/20 text-red-700 dark:text-red-300 text-sm",children:u}),a&&h&&c.jsxs(c.Fragment,{children:[a.partial&&c.jsxs("div",{className:"p-3 rounded-lg bg-amber-50 dark:bg-amber-900/20 text-amber-800 dark:text-amber-200 text-sm",children:["Some reports failed to load: ",a.failed_reports.join(", "),"."]}),c.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[c.jsx(St,{label:"Users",value:h.users.toLocaleString(),icon:nk,color:"bg-blue-500"}),c.jsx(St,{label:"Sessions",value:h.sessions.toLocaleString(),icon:bu,color:"bg-orange-500"}),c.jsx(St,{label:"Engagement",value:`${(h.engagementRate*100).toFixed(1)}%`,icon:og,color:"bg-purple-500"}),c.jsx(St,{label:"Avg session",value:`${h.avgSessionSec.toFixed(0)}s`,icon:wu,color:"bg-green-500"})]}),c.jsx(Ms,{title:"Traffic over time",description:`Active users, new users, sessions for ${a.property_name}`,className:"h-[400px]",children:c.jsx(M6,{series:a.traffic})}),c.jsxs("div",{className:"bg-white dark:bg-secondary rounded-xl shadow-md border border-gray-200 dark:border-white/5 p-6",children:[c.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-4",children:"Top pages"}),c.jsx(L6,{pages:a.top_pages})]}),c.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[c.jsxs("div",{className:"bg-white dark:bg-secondary rounded-xl shadow-md border border-gray-200 dark:border-white/5 p-6",children:[c.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-4",children:"Platforms"}),c.jsx(O6,{platforms:a.platforms})]}),c.jsxs("div",{className:"bg-white dark:bg-secondary rounded-xl shadow-md border border-gray-200 dark:border-white/5 p-6",children:[c.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-4",children:"Geography"}),c.jsx(D6,{rows:a.geography})]})]}),c.jsxs("div",{className:"bg-white dark:bg-secondary rounded-xl shadow-md border border-gray-200 dark:border-white/5 p-6",children:[c.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-4",children:"Top events"}),c.jsx(I6,{events:a.events})]})]})]})}const oh="https://insights.hotjar.com",V6=["info@sunbird.ai","analytics@sunbird.ai"],B6=[{name:"Heatmaps",icon:Q1,color:"bg-orange-500",description:"Aggregate click, move, scroll, and rage-click maps overlaid on each page. Shows where visitors focus attention and where they drop off.",useFor:"Spot unclicked CTAs, dead zones, and content that never gets scrolled into view."},{name:"Session Recordings",icon:SR,color:"bg-red-500",description:"Replay real user sessions with cursor movement, clicks, taps, scrolls, and form interactions. Filter by country, device, page, rage click, or u-turn.",useFor:"Debug confusing UX, watch how real users navigate sign-up, and confirm a bug is reproducible in the wild."},{name:"Funnels",icon:pR,color:"bg-purple-500",description:"Multi-step conversion funnels defined by URL patterns or events. Drop-off rate is shown per step with linked recordings for each stage.",useFor:"Measure landing-page → register → first API call conversion, and watch recordings of users who dropped off."},{name:"Surveys",icon:Jl,color:"bg-blue-500",description:"On-site and link surveys (NPS, CSAT, CES, exit-intent, custom). Trigger on URL, time on page, scroll depth, or exit intent.",useFor:'Ask "What were you hoping to find?" on pages with high bounce, or NPS on the dashboard.'},{name:"Feedback Widget",icon:RR,color:"bg-green-500",description:"Inline rating widget (0–5 stars / emoji) pinned to any page. Visitors pick a rating, leave a comment, and optionally highlight the exact element they are commenting on.",useFor:"Passive, continuous sentiment signal per page. Great for the pricing and docs pages."},{name:"Trends & Dashboards",icon:Z1,color:"bg-indigo-500",description:"Aggregate trends over time: page-level NPS, CSAT, feedback score, rage clicks, u-turns, conversion rate. Composable dashboards.",useFor:"Track whether the last release moved the needle on rage-clicks or feedback scores."},{name:"User Attributes",icon:TR,color:"bg-teal-500",description:"Custom identifiers (user_id, plan, organization, role) sent via the Hotjar JS SDK and used to filter and segment every other tool.",useFor:'Filter recordings to "admin users on the Speech product who hit an error" without leaking PII.'},{name:"Engage (Interviews)",icon:nk,color:"bg-pink-500",description:"Schedule moderated user interviews with calendar integration and automatic incentive delivery. Recruit from the existing visitor pool.",useFor:"Book a live session with a real user who just rage-clicked the upload flow."},{name:"Integrations",icon:LR,color:"bg-amber-500",description:"Native integrations with Slack, Jira, Linear, Microsoft Teams, Google Analytics, Segment, HubSpot, Zapier, and more.",useFor:"Pipe new survey responses into the #product Slack channel, or link a recording to a Jira ticket."}];function $6(){return c.jsxs("div",{className:"space-y-6",children:[c.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4",children:[c.jsxs("div",{children:[c.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:"Website & Engagement Funnel"}),c.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:"Qualitative website insights for all Sunbird products, powered by Hotjar."})]}),c.jsxs("a",{href:oh,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 px-4 py-2 bg-primary-600 text-white rounded-lg hover:bg-primary-700 transition-colors text-sm font-medium shadow-sm",children:["Open Hotjar Insights",c.jsx(Hn,{size:16})]})]}),c.jsxs("div",{className:"flex items-start gap-3 p-4 rounded-xl bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800/40 text-amber-900 dark:text-amber-100 text-sm",children:[c.jsx(sg,{size:18,className:"flex-shrink-0 mt-0.5"}),c.jsxs("div",{children:[c.jsx("p",{className:"font-medium",children:"Why open Hotjar instead of viewing the data here?"}),c.jsx("p",{className:"mt-1 text-amber-800 dark:text-amber-200/90",children:"Hotjar's public API only exposes a limited subset of administrative data (users, sites, survey metadata). Heatmaps, recordings, funnel drop-offs, and survey responses are only viewable inside the Hotjar dashboard. We therefore link out rather than maintain a partial mirror that would miss the highest-value insights."})]})]}),c.jsx(Oo.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"bg-white dark:bg-secondary rounded-xl shadow-sm border border-gray-100 dark:border-white/5 p-6",children:c.jsxs("div",{className:"flex items-start gap-3",children:[c.jsx("div",{className:"p-2 rounded-lg bg-primary-500 bg-opacity-10 dark:bg-opacity-20",children:c.jsx(Jn,{className:"w-5 h-5 text-primary-600 dark:text-primary-400"})}),c.jsxs("div",{className:"flex-1",children:[c.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"How to sign in"}),c.jsxs("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:["Hotjar access is tied to two shared Sunbird Google accounts. Use",c.jsx("span",{className:"font-medium",children:" Sign in with Google"})," — do not sign up with a new email."]}),c.jsxs("ol",{className:"mt-4 space-y-3 text-sm text-gray-700 dark:text-gray-300",children:[c.jsxs("li",{className:"flex gap-3",children:[c.jsx("span",{className:"flex-shrink-0 w-6 h-6 rounded-full bg-primary-50 dark:bg-primary-900/40 text-primary-700 dark:text-primary-300 flex items-center justify-center text-xs font-semibold",children:"1"}),c.jsxs("span",{children:["Open"," ",c.jsx("a",{href:oh,target:"_blank",rel:"noopener noreferrer",className:"text-primary-600 dark:text-primary-400 hover:underline font-medium",children:"insights.hotjar.com"}),"."]})]}),c.jsxs("li",{className:"flex gap-3",children:[c.jsx("span",{className:"flex-shrink-0 w-6 h-6 rounded-full bg-primary-50 dark:bg-primary-900/40 text-primary-700 dark:text-primary-300 flex items-center justify-center text-xs font-semibold",children:"2"}),c.jsxs("span",{children:["Click ",c.jsx("span",{className:"font-medium",children:"Sign in with Google"})," and choose one of the shared accounts below."]})]}),c.jsxs("li",{className:"flex gap-3",children:[c.jsx("span",{className:"flex-shrink-0 w-6 h-6 rounded-full bg-primary-50 dark:bg-primary-900/40 text-primary-700 dark:text-primary-300 flex items-center justify-center text-xs font-semibold",children:"3"}),c.jsx("span",{children:"Pick the site (Sunflower, Sunbird Speech, etc.) from the organization switcher in the top-left."})]})]}),c.jsx("div",{className:"mt-5 grid grid-cols-1 sm:grid-cols-2 gap-3",children:V6.map(e=>c.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg border border-gray-200 dark:border-white/10 bg-gray-50 dark:bg-black/20",children:[c.jsx("div",{className:"p-2 rounded-md bg-primary-50 dark:bg-primary-900/30",children:c.jsx(ku,{className:"w-4 h-4 text-primary-600 dark:text-primary-400"})}),c.jsxs("div",{className:"min-w-0",children:[c.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Shared Google account"}),c.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-white truncate",children:e})]})]},e))}),c.jsxs("p",{className:"mt-4 text-xs text-gray-500 dark:text-gray-400",children:["Credentials are managed in 1Password under ",c.jsx("em",{children:"Sunbird / Hotjar"}),". If you need access, ask an admin to add your email to the shared vault."]})]})]})}),c.jsxs("div",{children:[c.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"What you'll find in Hotjar"}),c.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:"A quick guide to each tool and the kind of question it answers."}),c.jsx("div",{className:"mt-4 grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4",children:B6.map((e,t)=>c.jsxs(Oo.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:t*.04},className:"bg-white dark:bg-secondary p-5 rounded-xl shadow-sm border border-gray-100 dark:border-white/5 hover:border-primary-500/30 transition-colors group flex flex-col",children:[c.jsx("div",{className:`p-2 rounded-lg w-fit ${e.color} bg-opacity-10 dark:bg-opacity-20 group-hover:scale-110 transition-transform`,children:c.jsx(e.icon,{className:`w-5 h-5 ${e.color.replace("bg-","text-")}`})}),c.jsx("h3",{className:"mt-3 text-base font-semibold text-gray-900 dark:text-white",children:e.name}),c.jsx("p",{className:"mt-2 text-sm text-gray-600 dark:text-gray-300 leading-relaxed",children:e.description}),c.jsxs("div",{className:"mt-3 pt-3 border-t border-gray-100 dark:border-white/5",children:[c.jsx("p",{className:"text-xs uppercase tracking-wide text-gray-400 dark:text-gray-500 font-medium",children:"Use it for"}),c.jsx("p",{className:"mt-1 text-xs text-gray-600 dark:text-gray-400",children:e.useFor})]})]},e.name))})]}),c.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4 p-5 rounded-xl border border-gray-200 dark:border-white/10 bg-gray-50 dark:bg-black/20",children:[c.jsxs("div",{children:[c.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"Ready to dig in?"}),c.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1",children:"Open Hotjar in a new tab and pick the product you want to investigate."})]}),c.jsxs("a",{href:oh,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 px-4 py-2 bg-primary-600 text-white rounded-lg hover:bg-primary-700 transition-colors text-sm font-medium",children:["Go to Hotjar Insights",c.jsx(Hn,{size:16})]})]})]})}function Hu(){const{theme:e,setTheme:t}=H1(),{isAuthenticated:n}=Qr(),[r,s]=S.useState(!1);return c.jsxs("nav",{className:"fixed top-0 w-full z-50 bg-white/80 dark:bg-black/80 backdrop-blur-md border-b border-gray-200 dark:border-white/10",children:[c.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:c.jsxs("div",{className:"flex justify-between h-16 items-center",children:[c.jsxs(Ee,{to:"/",className:"flex items-center gap-2 font-bold text-xl text-gray-900 dark:text-white",children:[c.jsx("img",{src:"/logo.png",className:"w-8 h-8 object-cover",alt:"Sunbird AI"}),c.jsx("span",{children:"Sunbird AI"})]}),c.jsxs("div",{className:"hidden md:flex items-center gap-8",children:[c.jsx("a",{href:"https://docs.sunbird.ai",target:"_blank",rel:"noopener noreferrer",className:"text-sm font-medium text-gray-700 hover:text-primary-600 dark:text-gray-300 dark:hover:text-primary-400 transition-colors",children:"Documentation"}),c.jsx("a",{href:"https://github.com/SunbirdAI/sunbird-ai-api",target:"_blank",rel:"noopener noreferrer",className:"text-sm font-medium text-gray-700 hover:text-primary-600 dark:text-gray-300 dark:hover:text-primary-400 transition-colors",children:"GitHub"}),c.jsx("a",{href:"https://sunflower.sunbird.ai",target:"_blank",rel:"noopener noreferrer",className:"text-sm font-medium text-gray-700 hover:text-primary-600 dark:text-gray-300 dark:hover:text-primary-400 transition-colors",children:"Sunflower"})]}),c.jsxs("div",{className:"hidden md:flex items-center gap-4",children:[c.jsx("button",{onClick:()=>t(e==="dark"?"light":"dark"),className:"p-2 rounded-full hover:bg-gray-100 dark:hover:bg-white/10 text-gray-500 dark:text-gray-400 transition-colors","aria-label":"Toggle theme",children:e==="dark"?c.jsx(pf,{size:20}):c.jsx(ff,{size:20})}),c.jsx("div",{className:"h-6 w-px bg-gray-200 dark:bg-white/10 mx-2"}),n?c.jsx(Ee,{to:"/dashboard",className:"px-4 py-2 rounded-lg bg-primary-600 hover:bg-primary-700 text-white text-sm font-medium transition-colors shadow-lg shadow-primary-500/20",children:"Dashboard"}):c.jsxs(c.Fragment,{children:[c.jsx(Ee,{to:"/login",className:"text-sm font-medium text-gray-700 hover:text-primary-600 dark:text-gray-300 dark:hover:text-primary-400 transition-colors",children:"Log in"}),c.jsx(Ee,{to:"/register",className:"px-4 py-2 rounded-lg bg-primary-600 hover:bg-primary-700 text-white text-sm font-medium transition-colors shadow-lg shadow-primary-500/20",children:"Sign Up"})]})]}),c.jsxs("div",{className:"flex items-center gap-4 md:hidden",children:[c.jsx("button",{onClick:()=>t(e==="dark"?"light":"dark"),className:"p-2 rounded-full hover:bg-gray-100 dark:hover:bg-white/10 text-gray-500 dark:text-gray-400 transition-colors",children:e==="dark"?c.jsx(pf,{size:20}):c.jsx(ff,{size:20})}),c.jsx("button",{onClick:()=>s(!r),className:"p-2 rounded-lg text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-white/10",children:r?c.jsx(Su,{size:24}):c.jsx(ek,{size:24})})]})]})}),c.jsx(QT,{children:r&&c.jsx(Oo.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:"md:hidden bg-white dark:bg-black border-b border-gray-200 dark:border-white/10 overflow-hidden",children:c.jsxs("div",{className:"px-4 pt-2 pb-6 space-y-2",children:[c.jsx("a",{href:"https://docs.sunbird.ai",className:"block px-3 py-2 rounded-md text-base font-medium text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-white/5",children:"Documentation"}),c.jsx("a",{href:"https://github.com/SunbirdAI/sunbird-ai-api",className:"block px-3 py-2 rounded-md text-base font-medium text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-white/5",children:"GitHub"}),c.jsx("a",{href:"https://sunflower.sunbird.ai",className:"block px-3 py-2 rounded-md text-base font-medium text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-white/5",children:"Sunflower"}),c.jsx("div",{className:"pt-4 mt-4 border-t border-gray-200 dark:border-white/10",children:n?c.jsx(Ee,{to:"/dashboard",className:"block w-full text-center px-4 py-2 rounded-lg bg-primary-600 text-white font-medium",children:"Dashboard"}):c.jsxs(c.Fragment,{children:[c.jsx(Ee,{to:"/login",className:"block w-full text-center px-4 py-2 rounded-lg border border-gray-300 dark:border-white/10 text-gray-700 dark:text-gray-300 font-medium mb-3",children:"Log in"}),c.jsx(Ee,{to:"/register",className:"block w-full text-center px-4 py-2 rounded-lg bg-primary-600 text-white font-medium",children:"Sign Up"})]})})]})})})]})}function Uu(){return c.jsxs("footer",{className:"border-t border-gray-200 dark:border-white/10 bg-gray-50 dark:bg-black",children:[c.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-12",children:c.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-5 gap-8",children:[c.jsxs("div",{className:"lg:col-span-2",children:[c.jsxs("div",{className:"flex items-center gap-2 font-bold text-xl text-gray-900 dark:text-white mb-4",children:[c.jsx("img",{src:"/logo.png",className:"w-8 h-8 object-cover",alt:"Sunbird AI"}),c.jsx("span",{children:"Sunbird AI"})]}),c.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-4 max-w-sm",children:"Empowering African languages with state-of-the-art AI models for translation, transcription, and speech synthesis."}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx("a",{href:"https://twitter.com/sunbirdai",target:"_blank",rel:"noopener noreferrer","aria-label":"Twitter",children:c.jsx("svg",{className:"w-5 h-5 bg-gray-400 dark:bg-gray-500 hover:bg-gray-500 dark:hover:bg-gray-400",style:{WebkitMaskImage:"url(https://d3gk2c5xim1je2.cloudfront.net/v7.1.0/brands/x-twitter.svg)",WebkitMaskRepeat:"no-repeat",WebkitMaskPosition:"center",maskImage:"url(https://d3gk2c5xim1je2.cloudfront.net/v7.1.0/brands/x-twitter.svg)",maskRepeat:"no-repeat",maskPosition:"center"}})}),c.jsx("a",{href:"https://github.com/SunbirdAI",target:"_blank",rel:"noopener noreferrer","aria-label":"GitHub",children:c.jsx("svg",{className:"w-5 h-5 bg-gray-400 dark:bg-gray-500 hover:bg-gray-500 dark:hover:bg-gray-400",style:{WebkitMaskImage:"url(https://d3gk2c5xim1je2.cloudfront.net/v7.1.0/brands/github.svg)",WebkitMaskRepeat:"no-repeat",WebkitMaskPosition:"center",maskImage:"url(https://d3gk2c5xim1je2.cloudfront.net/v7.1.0/brands/github.svg)",maskRepeat:"no-repeat",maskPosition:"center"}})}),c.jsxs("a",{href:"https://www.linkedin.com/company/sunbird-ai",target:"_blank",rel:"noopener noreferrer","aria-label":"LinkedIn",children:[c.jsx("svg",{className:"w-5 h-5 bg-gray-400 dark:bg-gray-500 hover:bg-gray-500 dark:hover:bg-gray-400",style:{WebkitMaskImage:"url(https://d3gk2c5xim1je2.cloudfront.net/v7.1.0/brands/linkedin.svg)",WebkitMaskRepeat:"no-repeat",WebkitMaskPosition:"center",maskImage:"url(https://d3gk2c5xim1je2.cloudfront.net/v7.1.0/brands/linkedin.svg)",maskRepeat:"no-repeat",maskPosition:"center"}})," "]})]})]}),c.jsxs("div",{children:[c.jsx("h3",{className:"font-semibold text-gray-900 dark:text-white mb-4",children:"Resources"}),c.jsxs("ul",{className:"space-y-3",children:[c.jsx("li",{children:c.jsx("a",{href:"https://docs.sunbird.ai",target:"_blank",rel:"noopener noreferrer",className:"text-sm text-gray-600 dark:text-gray-400 hover:text-primary-600 dark:hover:text-primary-400 transition-colors",children:"Documentation"})}),c.jsx("li",{children:c.jsx("a",{href:"https://github.com/SunbirdAI/sunbird-ai-api",target:"_blank",rel:"noopener noreferrer",className:"text-sm text-gray-600 dark:text-gray-400 hover:text-primary-600 dark:hover:text-primary-400 transition-colors",children:"API Reference"})}),c.jsx("li",{children:c.jsx("a",{href:"https://github.com/SunbirdAI/translation-api-examples",target:"_blank",rel:"noopener noreferrer",className:"text-sm text-gray-600 dark:text-gray-400 hover:text-primary-600 dark:hover:text-primary-400 transition-colors",children:"Code Examples"})}),c.jsx("li",{children:c.jsx("a",{href:"https://github.com/SunbirdAI/sunbird-ai-api/blob/main/tutorial.md",target:"_blank",rel:"noopener noreferrer",className:"text-sm text-gray-600 dark:text-gray-400 hover:text-primary-600 dark:hover:text-primary-400 transition-colors",children:"Tutorial"})})]})]}),c.jsxs("div",{children:[c.jsx("h3",{className:"font-semibold text-gray-900 dark:text-white mb-4",children:"Products"}),c.jsxs("ul",{className:"space-y-3",children:[c.jsx("li",{children:c.jsx("a",{href:"https://sunflower.sunbird.ai",target:"_blank",rel:"noopener noreferrer",className:"text-sm text-gray-600 dark:text-gray-400 hover:text-primary-600 dark:hover:text-primary-400 transition-colors",children:"Sunflower"})}),c.jsx("li",{children:c.jsx(Ee,{to:"https://sunflower.sunbird.ai",className:"text-sm text-gray-600 dark:text-gray-400 hover:text-primary-600 dark:hover:text-primary-400 transition-colors",children:"Translation"})}),c.jsx("li",{children:c.jsx(Ee,{to:"https://speech.sunbird.ai",className:"text-sm text-gray-600 dark:text-gray-400 hover:text-primary-600 dark:hover:text-primary-400 transition-colors",children:"Speech"})})]})]}),c.jsxs("div",{children:[c.jsx("h3",{className:"font-semibold text-gray-900 dark:text-white mb-4",children:"Company"}),c.jsxs("ul",{className:"space-y-3",children:[c.jsx("li",{children:c.jsx("a",{href:"https://sunbird.ai",target:"_blank",rel:"noopener noreferrer",className:"text-sm text-gray-600 dark:text-gray-400 hover:text-primary-600 dark:hover:text-primary-400 transition-colors",children:"About Us"})}),c.jsx("li",{children:c.jsx("a",{href:"https://blog.sunbird.ai",target:"_blank",rel:"noopener noreferrer",className:"text-sm text-gray-600 dark:text-gray-400 hover:text-primary-600 dark:hover:text-primary-400 transition-colors",children:"Blog"})}),c.jsx("li",{children:c.jsx(Ee,{to:"/privacy_policy",className:"text-sm text-gray-600 dark:text-gray-400 hover:text-primary-600 dark:hover:text-primary-400 transition-colors",children:"Privacy Policy"})}),c.jsx("li",{children:c.jsx(Ee,{to:"/terms_of_service",className:"text-sm text-gray-600 dark:text-gray-400 hover:text-primary-600 dark:hover:text-primary-400 transition-colors",children:"Terms of Service"})})]})]})]})}),c.jsx("div",{className:"py-5 border-t border-gray-200 dark:border-white/10 flex items-center justify-center",children:c.jsxs("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:["© ",new Date().getFullYear()," Sunbird AI. All rights reserved."]})})]})}function H6(){return c.jsxs("div",{className:"min-h-screen bg-white dark:bg-black transition-colors duration-300 selection:bg-primary-500 selection:text-white",children:[c.jsx(Hu,{}),c.jsx("div",{className:"relative pt-32 pb-16 sm:pt-40 sm:pb-24 lg:pb-32 px-4 sm:px-6 lg:px-8 max-w-7xl mx-auto text-center overflow-hidden",children:c.jsxs(Oo.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.5},children:[c.jsxs("h1",{className:"relative text-4xl sm:text-5xl lg:text-7xl font-extrabold tracking-tight text-gray-900 dark:text-white mb-6",children:["Welcome to the ",c.jsx("br",{className:"hidden sm:block"}),c.jsx("span",{className:"text-primary-600 dark:text-primary-500",children:"Sunbird AI API"})]}),c.jsx("p",{className:"relative text-xl text-gray-600 dark:text-gray-400 max-w-2xl mx-auto mb-10 leading-relaxed",children:"Get started with African language AI models. Translate, transcribe, and synthesize speech with state-of-the-art models designed for the continent."}),c.jsxs("div",{className:"relative flex flex-col sm:flex-row items-center justify-center gap-4",children:[c.jsxs(Ee,{to:"/register",className:"w-full sm:w-auto px-8 py-4 rounded-xl bg-primary-600 hover:bg-primary-700 text-white font-semibold text-lg transition-all shadow-xl shadow-primary-500/20 hover:shadow-primary-500/30 flex items-center justify-center gap-2",children:["Get Started",c.jsx(hf,{size:20})]}),c.jsxs("a",{href:"https://docs.sunbird.ai",target:"_blank",rel:"noopener noreferrer",className:"w-full sm:w-auto px-8 py-4 rounded-xl bg-white dark:bg-secondary hover:bg-gray-50 dark:hover:bg-white/5 border border-gray-200 dark:border-white/10 text-gray-900 dark:text-white font-semibold text-lg transition-all backdrop-blur-sm flex items-center justify-center gap-2",children:[c.jsx(Mc,{size:20}),"Read Docs"]})]})]})}),c.jsxs("div",{className:"px-4 sm:px-6 lg:px-8 max-w-7xl mx-auto pb-16",children:[c.jsxs("div",{className:"text-center mb-12",children:[c.jsx("h2",{className:"text-3xl sm:text-4xl font-bold text-gray-900 dark:text-white mb-4",children:"What You Can Build"}),c.jsx("p",{className:"text-lg text-gray-600 dark:text-gray-400 max-w-2xl mx-auto",children:"Powerful AI capabilities for African languages at your fingertips"})]}),c.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[c.jsxs("a",{href:"https://docs.sunbird.ai/guides/translation",target:"_blank",rel:"noopener noreferrer",className:"group p-8 rounded-2xl bg-white dark:bg-white/5 border border-gray-200 dark:border-white/10 border-b-4 hover:border-primary-500 dark:hover:border-primary-500 transition-all hover:shadow-2xl hover:-translate-y-1",children:[c.jsx("div",{className:"w-14 h-14 rounded-xl bg-primary-50 dark:bg-primary-900/20 flex items-center justify-center text-primary-600 dark:text-primary-400 mb-4 group-hover:scale-110 transition-transform",children:c.jsx("svg",{className:"w-7 h-7",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 5h12M9 3v2m1.048 9.5A18.022 18.022 0 016.412 9m6.088 9h7M11 21l5-10 5 10M12.751 5C11.783 10.77 8.07 15.61 3 18.129"})})}),c.jsx("h3",{className:"text-xl font-semibold text-gray-900 dark:text-white mb-2",children:"Translate Content"}),c.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:"Translate text between English and 5+ local Ugandan languages with high accuracy."})]}),c.jsxs("a",{href:"https://docs.sunbird.ai/guides/speech-to-text",target:"_blank",rel:"noopener noreferrer",className:"group p-8 rounded-2xl bg-white dark:bg-white/5 border border-gray-200 dark:border-white/10 border-b-4 hover:border-primary-500 dark:hover:border-primary-500 transition-all hover:shadow-2xl hover:-translate-y-1",children:[c.jsx("div",{className:"w-14 h-14 rounded-xl bg-primary-50 dark:bg-primary-900/20 flex items-center justify-center text-primary-600 dark:text-primary-400 mb-4 group-hover:scale-110 transition-transform",children:c.jsx("svg",{className:"w-7 h-7",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 11a7 7 0 01-7 7m0 0a7 7 0 01-7-7m7 7v4m0 0H8m4 0h4m-4-8a3 3 0 01-3-3V5a3 3 0 116 0v6a3 3 0 01-3 3z"})})}),c.jsx("h3",{className:"text-xl font-semibold text-gray-900 dark:text-white mb-2",children:"Transcribe Audio"}),c.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:"Convert speech audio into text for captioning, logging, or analysis."})]}),c.jsxs("a",{href:"https://docs.sunbird.ai/guides/text-to-speech",target:"_blank",rel:"noopener noreferrer",className:"group p-8 rounded-2xl bg-white dark:bg-white/5 border border-gray-200 dark:border-white/10 border-b-4 hover:border-primary-500 dark:hover:border-primary-500 transition-all hover:shadow-2xl hover:-translate-y-1",children:[c.jsx("div",{className:"w-14 h-14 rounded-xl bg-primary-50 dark:bg-primary-900/20 flex items-center justify-center text-primary-600 dark:text-primary-400 mb-4 group-hover:scale-110 transition-transform",children:c.jsx("svg",{className:"w-7 h-7",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15.536 8.464a5 5 0 010 7.072m2.828-9.9a9 9 0 010 12.728M5.586 15H4a1 1 0 01-1-1v-4a1 1 0 011-1h1.586l4.707-4.707C10.923 3.663 12 4.109 12 5v14c0 .891-1.077 1.337-1.707.707L5.586 15z"})})}),c.jsx("h3",{className:"text-xl font-semibold text-gray-900 dark:text-white mb-2",children:"Generate Speech"}),c.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:"Turn text into natural-sounding speech in local languages."})]}),c.jsxs("a",{href:"https://docs.sunbird.ai/guides/sunflower-chat",target:"_blank",rel:"noopener noreferrer",className:"group p-8 rounded-2xl bg-white dark:bg-white/5 border border-gray-200 dark:border-white/10 border-b-4 hover:border-primary-500 dark:hover:border-primary-500 transition-all hover:shadow-2xl hover:-translate-y-1",children:[c.jsx("div",{className:"w-14 h-14 rounded-xl bg-primary-50 dark:bg-primary-900/20 flex items-center justify-center text-primary-600 dark:text-primary-400 mb-4 group-hover:scale-110 transition-transform",children:c.jsx("svg",{className:"w-7 h-7",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 10h.01M12 10h.01M16 10h.01M9 16H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-5l-5 5v-5z"})})}),c.jsx("h3",{className:"text-xl font-semibold text-gray-900 dark:text-white mb-2",children:"Conversational AI"}),c.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:"Build chatbots that understand and respond in local cultural contexts."})]})]})]}),c.jsxs("div",{className:"px-4 sm:px-6 lg:px-8 max-w-7xl mx-auto pb-16",children:[c.jsxs("div",{className:"text-center mb-8",children:[c.jsx("h2",{className:"text-3xl sm:text-4xl font-bold text-gray-900 dark:text-white mb-4",children:"Supported Languages"}),c.jsx("p",{className:"text-lg text-gray-600 dark:text-gray-400",children:"We support translation between English and these Ugandan languages"})]}),c.jsx("div",{className:"flex flex-wrap justify-center gap-4",children:["Luganda","Acholi","Ateso","Lugbara","Runyankole"].map(e=>c.jsx("div",{className:"px-6 py-3 rounded-full bg-white dark:bg-white/5 border border-gray-200 dark:border-white/5 text-gray-900 dark:text-white font-medium hover:border-primary-500 dark:hover:border-primary-500/50 transition-colors shadow-sm dark:shadow-md dark:shadow-black/20",children:e},e))}),c.jsx("div",{className:"text-center mt-6",children:c.jsxs("a",{href:"https://docs.sunbird.ai/languages",target:"_blank",rel:"noopener noreferrer",className:"text-primary-600 dark:text-primary-400 hover:text-primary-700 dark:hover:text-primary-300 font-medium inline-flex items-center gap-2",children:["View all supported languages",c.jsx(hf,{size:16})]})})]}),c.jsxs("div",{className:"px-4 sm:px-6 lg:px-8 max-w-7xl mx-auto pb-24",children:[c.jsx("div",{className:"text-center mb-12",children:c.jsx("h2",{className:"text-3xl sm:text-4xl font-bold text-gray-900 dark:text-white mb-4",children:"Get Started in Minutes"})}),c.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6",children:[c.jsxs(Ee,{to:"/tutorial",className:"group p-6 rounded-2xl bg-white dark:bg-white/5 border border-gray-200 dark:border-white/10 border-b-4 hover:border-primary-500 dark:hover:border-primary-500 transition-all hover:shadow-2xl hover:-translate-y-1 backdrop-blur-sm",children:[c.jsx("div",{className:"w-12 h-12 rounded-xl bg-primary-50 dark:bg-primary-900/20 flex items-center justify-center text-primary-600 dark:text-primary-400 mb-4 group-hover:scale-110 transition-transform",children:c.jsx(Mc,{size:24})}),c.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-2",children:"Tutorial"}),c.jsx("p",{className:"text-gray-500 dark:text-gray-400 text-sm leading-relaxed",children:"Learn how to use the API with step-by-step guides and best practices."})]}),c.jsxs("a",{href:"https://github.com/SunbirdAI/translation-api-examples",target:"_blank",rel:"noopener noreferrer",className:"group p-6 rounded-2xl bg-white dark:bg-white/5 border border-gray-200 dark:border-white/10 border-b-4 hover:border-primary-500 dark:hover:border-primary-500 transition-all hover:shadow-2xl hover:-translate-y-1 backdrop-blur-sm",children:[c.jsx("div",{className:"w-12 h-12 rounded-xl bg-primary-50 dark:bg-primary-900/20 flex items-center justify-center text-primary-600 dark:text-primary-400 mb-4 group-hover:scale-110 transition-transform",children:c.jsx(PR,{size:24})}),c.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-2",children:"Examples"}),c.jsx("p",{className:"text-gray-500 dark:text-gray-400 text-sm leading-relaxed",children:"View code examples and SDK usage on GitHub for Python and JS."})]}),c.jsxs(Ee,{to:"/login",className:"group p-6 rounded-2xl bg-white dark:bg-white/5 border border-gray-200 dark:border-white/10 border-b-4 hover:border-primary-500 dark:hover:border-primary-500 transition-all hover:shadow-2xl hover:-translate-y-1 backdrop-blur-sm",children:[c.jsx("div",{className:"w-12 h-12 rounded-xl bg-primary-50 dark:bg-primary-900/20 flex items-center justify-center text-primary-600 dark:text-primary-400 mb-4 group-hover:scale-110 transition-transform",children:c.jsx(bu,{size:24})}),c.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-2",children:"Usage Stats"}),c.jsx("p",{className:"text-gray-500 dark:text-gray-400 text-sm leading-relaxed",children:"Monitor your API usage, request volume, and limits in real-time."})]}),c.jsxs(Ee,{to:"/login",className:"group p-6 rounded-2xl bg-white dark:bg-white/5 border border-gray-200 dark:border-white/10 border-b-4 hover:border-primary-500 dark:hover:border-primary-500 transition-all hover:shadow-2xl hover:-translate-y-1 backdrop-blur-sm",children:[c.jsx("div",{className:"w-12 h-12 rounded-xl bg-primary-50 dark:bg-primary-900/20 flex items-center justify-center text-primary-600 dark:text-primary-400 mb-4 group-hover:scale-110 transition-transform",children:c.jsx(J1,{size:24})}),c.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-2",children:"API Tokens"}),c.jsx("p",{className:"text-gray-500 dark:text-gray-400 text-sm leading-relaxed",children:"Manage your access tokens and security keys securely."})]})]})]}),c.jsx(Uu,{})]})}const U6=["NGO","Government","Private Sector","Research","Individual","Other"],Eb=["Health","Agriculture","Energy","Environment","Education","Governance"];function W6(){const[e,t]=S.useState({username:"",email:"",full_name:"",organization:"",organization_type:"",password:"",confirmPassword:""}),[n,r]=S.useState([]),[s,o]=S.useState(""),[i,a]=S.useState(""),[l,u]=S.useState(!1),[d,h]=S.useState(!1),[f,p]=S.useState(!1),g=Is(),m=async b=>{var k,w;if(b.preventDefault(),a(""),e.password!==e.confirmPassword){a("Passwords do not match");return}u(!0);try{await ae.post("/auth/register",{username:e.username,email:e.email,organization:e.organization,password:e.password,full_name:e.full_name||void 0,organization_type:e.organization_type||void 0,sector:n.length>0?n:void 0}),g("/login",{state:{message:"Registration successful! Please sign in."}})}catch(j){a(((w=(k=j.response)==null?void 0:k.data)==null?void 0:w.detail)||"Registration failed. Please try again.")}finally{u(!1)}},y=b=>{r(k=>k.includes(b)?k.filter(w=>w!==b):[...k,b])},x=()=>{const b=s.trim();b&&!n.includes(b)&&(r(k=>[...k,b]),o(""))},v=()=>{window.location.href="/auth/google/login?next=/dashboard"};return c.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-50 dark:bg-black px-4 py-12",children:c.jsx("div",{className:"max-w-md w-full space-y-8",children:c.jsxs("div",{className:"bg-white dark:bg-secondary rounded-2xl shadow-lg dark:shadow-lg dark:shadow-black/10 p-8 border border-gray-100 dark:border-white/5",children:[c.jsxs("div",{className:"gap-2 flex flex-col items-center justify-center mb-6",children:[c.jsx("img",{src:"/logo.png",alt:"Sunbird AI",className:"h-10 w-10 rounded-full object-cover"}),c.jsx("h2",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:"Sign Up"}),c.jsx("p",{className:"mt-2 text-sm text-gray-600 dark:text-gray-400",children:"Sign up to access your API dashboard"})]}),c.jsxs("form",{className:"space-y-6",onSubmit:m,children:[i&&c.jsx("div",{className:"bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400 p-3 rounded-lg text-sm",children:i}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Username"}),c.jsxs("div",{className:"relative",children:[c.jsx(Ao,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-400"}),c.jsx("input",{type:"text",required:!0,value:e.username,onChange:b=>t({...e,username:b.target.value}),className:"w-full pl-10 pr-4 py-2 bg-white dark:bg-black/50 border border-gray-200 dark:border-white/10 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500 dark:text-white placeholder-gray-400 dark:placeholder-gray-600",placeholder:"johndoe",disabled:l})]})]}),c.jsxs("div",{children:[c.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:["Full Name ",c.jsx("span",{className:"text-gray-400 font-normal",children:"(optional)"})]}),c.jsxs("div",{className:"relative",children:[c.jsx(Ao,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-400"}),c.jsx("input",{type:"text",value:e.full_name,onChange:b=>t({...e,full_name:b.target.value}),className:"w-full pl-10 pr-4 py-2 bg-white dark:bg-black/50 border border-gray-200 dark:border-white/10 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500 dark:text-white placeholder-gray-400 dark:placeholder-gray-600",placeholder:"John Doe",disabled:l})]})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Email address"}),c.jsxs("div",{className:"relative",children:[c.jsx(ku,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-400"}),c.jsx("input",{type:"email",required:!0,value:e.email,onChange:b=>t({...e,email:b.target.value}),className:"w-full pl-10 pr-4 py-2 bg-white dark:bg-black/50 border border-gray-200 dark:border-white/10 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500 dark:text-white placeholder-gray-400 dark:placeholder-gray-600",placeholder:"you@example.com",disabled:l})]})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Organization"}),c.jsxs("div",{className:"relative",children:[c.jsx(W1,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-400"}),c.jsx("input",{type:"text",required:!0,value:e.organization,onChange:b=>t({...e,organization:b.target.value}),className:"w-full pl-10 pr-4 py-2 bg-white dark:bg-black/50 border border-gray-200 dark:border-white/10 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500 dark:text-white placeholder-gray-400 dark:placeholder-gray-600",placeholder:"Company Name",disabled:l})]})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Organization Type"}),c.jsxs("div",{className:"relative",children:[c.jsx(U1,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-400"}),c.jsxs("select",{required:!0,value:e.organization_type,onChange:b=>t({...e,organization_type:b.target.value}),className:"w-full pl-10 pr-4 py-2 bg-white dark:bg-black/50 border border-gray-200 dark:border-white/10 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500 dark:text-white appearance-none",disabled:l,children:[c.jsx("option",{value:"",children:"Select type..."}),U6.map(b=>c.jsx("option",{value:b,children:b},b))]})]})]}),c.jsxs("div",{children:[c.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:["Impact Sectors ",c.jsx("span",{className:"text-gray-400 font-normal",children:"(select all that apply)"})]}),c.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:[...Eb,...n.filter(b=>!Eb.includes(b))].map(b=>c.jsxs("button",{type:"button",onClick:()=>y(b),disabled:l,className:`px-3 py-1.5 rounded-full text-sm border transition-colors ${n.includes(b)?"border-primary-500 bg-primary-500/10 text-primary-600 dark:text-primary-400":"border-gray-200 dark:border-white/10 text-gray-500 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-white/5"}`,children:[b," ",n.includes(b)&&"✓"]},b))}),c.jsxs("div",{className:"flex gap-2 mt-2",children:[c.jsx("input",{type:"text",value:s,onChange:b=>o(b.target.value),onKeyDown:b=>b.key==="Enter"&&(b.preventDefault(),x()),className:"flex-1 px-3 py-1.5 bg-white dark:bg-black/50 border border-gray-200 dark:border-white/10 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500 dark:text-white text-sm placeholder-gray-400 dark:placeholder-gray-600",placeholder:"Add custom sector...",disabled:l}),c.jsx("button",{type:"button",onClick:x,disabled:l,className:"px-3 py-1.5 text-sm border border-gray-200 dark:border-white/10 rounded-lg text-gray-600 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-white/5 transition-colors",children:"Add"})]})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Password"}),c.jsxs("div",{className:"relative",children:[c.jsx(Jn,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-400"}),c.jsx("input",{type:d?"text":"password",required:!0,value:e.password,onChange:b=>t({...e,password:b.target.value}),className:"w-full pl-10 pr-12 py-2 bg-white dark:bg-black/50 border border-gray-200 dark:border-white/10 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500 dark:text-white placeholder-gray-400 dark:placeholder-gray-600",placeholder:"••••••••",disabled:l}),c.jsx("button",{type:"button",onClick:()=>h(!d),className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300",children:d?c.jsx(Dr,{className:"w-5 h-5"}):c.jsx(Ir,{className:"w-5 h-5"})})]})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Confirm Password"}),c.jsxs("div",{className:"relative",children:[c.jsx(Jn,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-400"}),c.jsx("input",{type:f?"text":"password",required:!0,value:e.confirmPassword,onChange:b=>t({...e,confirmPassword:b.target.value}),className:"w-full pl-10 pr-12 py-2 bg-white dark:bg-black/50 border border-gray-200 dark:border-white/10 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500 dark:text-white placeholder-gray-400 dark:placeholder-gray-600",placeholder:"••••••••",disabled:l}),c.jsx("button",{type:"button",onClick:()=>p(!f),className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300",children:f?c.jsx(Dr,{className:"w-5 h-5"}):c.jsx(Ir,{className:"w-5 h-5"})})]})]}),c.jsxs("button",{type:"submit",disabled:l,className:"w-full flex justify-center items-center gap-2 py-2 px-4 border border-transparent rounded-lg shadow-sm text-sm font-medium text-white bg-primary-600 hover:bg-primary-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500 transition-colors shadow-lg shadow-primary-500/20 disabled:opacity-50 disabled:cursor-not-allowed",children:[" ",l&&c.jsx(Da,{className:"w-4 h-4 animate-spin"}),l?"Creating Account...":"Create Account"]})]}),c.jsxs("div",{className:"mt-6",children:[c.jsx("div",{className:"relative",children:c.jsxs("div",{className:"relative flex justify-center items-center text-sm",children:[c.jsx("div",{className:"flex-1 h-px bg-gray-300 dark:bg-white/10"}),c.jsx("span",{className:"px-2 text-gray-500",children:"OR"}),c.jsx("div",{className:"flex-1 h-px bg-gray-300 dark:bg-white/10"})]})}),c.jsx("div",{className:"mt-6",children:c.jsxs("button",{onClick:v,type:"button",className:"w-full inline-flex justify-center items-center gap-2 py-2 px-4 border border-gray-300 dark:border-white/10 rounded-lg shadow-sm bg-white dark:bg-white/5 text-sm font-medium text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-white/10 transition-colors",children:[c.jsxs("svg",{className:"w-5 h-5",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",width:"25",height:"25",viewBox:"0 0 48 48",children:[c.jsx("path",{fill:"#FFC107",d:"M43.611,20.083H42V20H24v8h11.303c-1.649,4.657-6.08,8-11.303,8c-6.627,0-12-5.373-12-12c0-6.627,5.373-12,12-12c3.059,0,5.842,1.154,7.961,3.039l5.657-5.657C34.046,6.053,29.268,4,24,4C12.955,4,4,12.955,4,24c0,11.045,8.955,20,20,20c11.045,0,20-8.955,20-20C44,22.659,43.862,21.35,43.611,20.083z"}),c.jsx("path",{fill:"#FF3D00",d:"M6.306,14.691l6.571,4.819C14.655,15.108,18.961,12,24,12c3.059,0,5.842,1.154,7.961,3.039l5.657-5.657C34.046,6.053,29.268,4,24,4C16.318,4,9.656,8.337,6.306,14.691z"}),c.jsx("path",{fill:"#4CAF50",d:"M24,44c5.166,0,9.86-1.977,13.409-5.192l-6.19-5.238C29.211,35.091,26.715,36,24,36c-5.202,0-9.619-3.317-11.283-7.946l-6.522,5.025C9.505,39.556,16.227,44,24,44z"}),c.jsx("path",{fill:"#1976D2",d:"M43.611,20.083H42V20H24v8h11.303c-0.792,2.237-2.231,4.166-4.087,5.571c0.001-0.001,0.002-0.001,0.003-0.002l6.19,5.238C36.971,39.205,44,34,44,24C44,22.659,43.862,21.35,43.611,20.083z"})]}),"Sign Up with Google"]})})]}),c.jsx("div",{className:"mt-6 text-center",children:c.jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:["Already have an account?"," ",c.jsx(Ee,{to:"/login",className:"font-medium text-primary-600 hover:text-primary-500 dark:text-primary-400",children:"Sign in"})]})})]})})})}function Tb(){const[e,t]=S.useState(""),[n,r]=S.useState(""),[s,o]=S.useState(!1),[i,a]=S.useState(""),[l,u]=S.useState(!1),{login:d,checkAuth:h}=Qr(),f=Is(),p=ar();S.useEffect(()=>{const y=new URLSearchParams(p.search),x=y.get("token"),v=y.get("error");if(x){localStorage.setItem("access_token",x),ae.defaults.headers.common.Authorization=`Bearer ${x}`;const b=y.get("next")||"/dashboard";h().then(()=>{f(b)})}v&&a("Authentication failed. Please try again.")},[p,h,f]);const g=async y=>{var x,v;y.preventDefault(),a(""),u(!0);try{await d(e,n),f("/dashboard")}catch(b){a(((v=(x=b.response)==null?void 0:x.data)==null?void 0:v.detail)||"Invalid username or password")}finally{u(!1)}},m=()=>{window.location.href="/auth/google/login?next=/dashboard"};return c.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-50 dark:bg-black px-4",children:c.jsxs("div",{className:"max-w-md w-full space-y-8",children:[c.jsx("div",{className:"text-center"}),c.jsxs("div",{className:"bg-white dark:bg-secondary rounded-2xl shadow-lg dark:shadow-lg dark:shadow-black/10 p-8 border border-gray-100 dark:border-white/5 backdrop-blur-sm",children:[c.jsxs("div",{className:"gap-2 flex flex-col items-center justify-center mb-6",children:[c.jsx("img",{src:"/logo.png",alt:"Sunbird AI",className:"h-10 w-10 rounded-full object-cover"}),c.jsx("h2",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:"Sign In"}),c.jsx("p",{className:"mt-2 text-sm text-gray-600 dark:text-gray-400",children:"Login to access your API dashboard"})]}),c.jsxs("form",{className:"space-y-6",onSubmit:g,children:[i&&c.jsx("div",{className:"bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400 p-3 rounded-lg text-sm",children:i}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Username"}),c.jsxs("div",{className:"relative",children:[c.jsx(AR,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-400"}),c.jsx("input",{type:"text",required:!0,value:e,onChange:y=>t(y.target.value),className:"w-full pl-10 pr-4 py-2 bg-white dark:bg-black/50 border border-gray-200 dark:border-white/10 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500 dark:text-white placeholder-gray-400 dark:placeholder-gray-600",placeholder:"username",disabled:l})]})]}),c.jsxs("div",{children:[c.jsxs("div",{className:"flex items-center justify-between mb-1",children:[c.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:"Password"}),c.jsx(Ee,{to:"/forgot-password",className:"text-sm font-medium text-primary-600 hover:text-primary-500 dark:text-primary-400",children:"Forgot password?"})]}),c.jsxs("div",{className:"relative",children:[c.jsx(Jn,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-400"}),c.jsx("input",{type:s?"text":"password",required:!0,value:n,onChange:y=>r(y.target.value),className:"w-full pl-10 pr-12 py-2 bg-white dark:bg-black/50 border border-gray-200 dark:border-white/10 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500 dark:text-white placeholder-gray-400 dark:placeholder-gray-600",placeholder:"••••••••",disabled:l}),c.jsx("button",{type:"button",onClick:()=>o(!s),className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300",children:s?c.jsx(Dr,{className:"w-5 h-5"}):c.jsx(Ir,{className:"w-5 h-5"})})]})]}),c.jsxs("button",{type:"submit",disabled:l,className:"w-full flex justify-center items-center gap-2 py-2 px-4 border border-transparent rounded-lg text-sm font-medium text-white bg-primary-600 hover:bg-primary-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[l&&c.jsx(Da,{className:"w-4 h-4 animate-spin"}),l?"Signing in...":"Sign in"]})]}),c.jsxs("div",{className:"mt-6",children:[c.jsx("div",{className:"relative",children:c.jsxs("div",{className:"relative flex justify-center items-center text-sm",children:[c.jsx("div",{className:"flex-1 h-px bg-gray-300 dark:bg-white/10"}),c.jsx("span",{className:"px-2 text-gray-500",children:"OR"}),c.jsx("div",{className:"flex-1 h-px bg-gray-300 dark:bg-white/10"})]})}),c.jsx("div",{className:"mt-6",children:c.jsxs("button",{onClick:m,type:"button",className:"w-full inline-flex justify-center items-center gap-2 py-2 px-4 border border-gray-300 dark:border-white/10 rounded-lg shadow-sm bg-white dark:bg-white/5 text-sm font-medium text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-white/10 transition-colors",children:[c.jsxs("svg",{className:"w-5 h-5",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",width:"25",height:"25",viewBox:"0 0 48 48",children:[c.jsx("path",{fill:"#FFC107",d:"M43.611,20.083H42V20H24v8h11.303c-1.649,4.657-6.08,8-11.303,8c-6.627,0-12-5.373-12-12c0-6.627,5.373-12,12-12c3.059,0,5.842,1.154,7.961,3.039l5.657-5.657C34.046,6.053,29.268,4,24,4C12.955,4,4,12.955,4,24c0,11.045,8.955,20,20,20c11.045,0,20-8.955,20-20C44,22.659,43.862,21.35,43.611,20.083z"}),c.jsx("path",{fill:"#FF3D00",d:"M6.306,14.691l6.571,4.819C14.655,15.108,18.961,12,24,12c3.059,0,5.842,1.154,7.961,3.039l5.657-5.657C34.046,6.053,29.268,4,24,4C16.318,4,9.656,8.337,6.306,14.691z"}),c.jsx("path",{fill:"#4CAF50",d:"M24,44c5.166,0,9.86-1.977,13.409-5.192l-6.19-5.238C29.211,35.091,26.715,36,24,36c-5.202,0-9.619-3.317-11.283-7.946l-6.522,5.025C9.505,39.556,16.227,44,24,44z"}),c.jsx("path",{fill:"#1976D2",d:"M43.611,20.083H42V20H24v8h11.303c-0.792,2.237-2.231,4.166-4.087,5.571c0.001-0.001,0.002-0.001,0.003-0.002l6.19,5.238C36.971,39.205,44,34,44,24C44,22.659,43.862,21.35,43.611,20.083z"})]}),"Sign in with Google"]})})]}),c.jsx("div",{className:"mt-6 text-center",children:c.jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:["Don't have an account?"," ",c.jsx(Ee,{to:"/register",className:"font-medium text-primary-600 hover:text-primary-500 dark:text-primary-400",children:"Sign up"})]})})]})]})})}function G6(){const[e,t]=S.useState(""),[n,r]=S.useState(""),[s,o]=S.useState(""),[i,a]=S.useState(!1),l=async u=>{var d,h;u.preventDefault(),o(""),r(""),a(!0);try{const f=await ae.post("/auth/forgot-password",{email:e});f.data.success?r("Password reset email sent! Please check your inbox."):o(f.data.message||"Failed to send reset email")}catch(f){o(((h=(d=f.response)==null?void 0:d.data)==null?void 0:h.detail)||"Failed to send reset email. Please try again.")}finally{a(!1)}};return c.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-50 dark:bg-black px-4",children:c.jsx("div",{className:"max-w-md w-full space-y-8",children:c.jsxs("div",{className:"bg-white dark:bg-secondary p-8 rounded-2xl shadow-lg dark:shadow-lg dark:shadow-black/10 border border-gray-100 dark:border-white/5 backdrop-blur-sm",children:[c.jsxs("div",{className:"gap-2 flex flex-col items-center justify-center mb-6",children:[c.jsx("img",{src:"/logo.png",alt:"Sunbird AI",className:"h-10 w-10 rounded-full object-cover"}),c.jsx("h2",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:"Forgot Password "}),c.jsx("p",{className:"mt-2 text-sm text-gray-600 dark:text-gray-400",children:"Enter your email address and we'll send you a link to reset your password"})]}),c.jsxs("form",{className:"space-y-6",onSubmit:l,children:[s&&c.jsx("div",{className:"bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400 p-3 rounded-lg text-sm",children:s}),n&&c.jsx("div",{className:"bg-green-50 dark:bg-green-900/20 text-green-600 dark:text-green-400 p-3 rounded-lg text-sm",children:n}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Email address"}),c.jsxs("div",{className:"relative",children:[c.jsx(ku,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-400"}),c.jsx("input",{type:"email",required:!0,value:e,onChange:u=>t(u.target.value),className:"w-full pl-10 pr-4 py-2 bg-white dark:bg-black/50 border border-gray-200 dark:border-white/10 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500 dark:text-white placeholder-gray-400 dark:placeholder-gray-600",placeholder:"you@example.com",disabled:i})]})]}),c.jsxs("button",{type:"submit",disabled:i,className:"w-full flex justify-center items-center gap-2 py-2 px-4 border border-transparent rounded-lg text-sm font-medium text-white bg-primary-600 hover:bg-primary-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[i&&c.jsx(Da,{className:"w-4 h-4 animate-spin"}),i?"Sending...":"Send Reset Link"]})]}),c.jsx("div",{className:"mt-6 text-center",children:c.jsxs(Ee,{to:"/login",className:"inline-flex items-center gap-2 text-sm font-medium text-primary-600 hover:text-primary-500 dark:text-primary-400",children:[c.jsx(uR,{className:"w-4 h-4"}),"Back to Sign In"]})})]})})})}function K6(){const[e,t]=S.useState(""),[n,r]=S.useState(""),[s,o]=S.useState(!1),[i,a]=S.useState(!1),[l,u]=S.useState(""),[d,h]=S.useState(!1),[f]=x1(),p=Is(),g=f.get("token");S.useEffect(()=>{g||u("Invalid or missing reset token")},[g]);const m=async y=>{var x,v;if(y.preventDefault(),u(""),e!==n){u("Passwords do not match");return}if(!g){u("Invalid reset token");return}h(!0);try{await ae.post("/auth/reset-password",{token:g,new_password:e}),p("/login",{state:{message:"Password reset successful! Please sign in with your new password."}})}catch(b){u(((v=(x=b.response)==null?void 0:x.data)==null?void 0:v.detail)||"Failed to reset password. The link may have expired.")}finally{h(!1)}};return c.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-50 dark:bg-black px-4",children:c.jsx("div",{className:"max-w-md w-full space-y-8",children:c.jsxs("div",{className:"bg-white dark:bg-secondary p-8 rounded-2xl shadow-lg dark:shadow-lg dark:shadow-black/10 border border-gray-100 dark:border-white/5 backdrop-blur-sm",children:[c.jsxs("div",{className:"gap-2 flex flex-col items-center justify-center mb-6",children:[c.jsx("img",{src:"/logo.png",alt:"Sunbird AI",className:"h-10 w-10 rounded-full object-cover"}),c.jsx("h2",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:"Reset Password "}),c.jsx("p",{className:"mt-2 text-sm text-gray-600 dark:text-gray-400",children:"Enter your new password below"})]}),c.jsxs("form",{className:"space-y-6",onSubmit:m,children:[l&&c.jsx("div",{className:"bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400 p-3 rounded-lg text-sm",children:l}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"New Password"}),c.jsxs("div",{className:"relative",children:[c.jsx(Jn,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-400"}),c.jsx("input",{type:s?"text":"password",required:!0,value:e,onChange:y=>t(y.target.value),className:"w-full pl-10 pr-12 py-2 bg-white dark:bg-black/50 border border-gray-200 dark:border-white/10 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500 dark:text-white placeholder-gray-400 dark:placeholder-gray-600",placeholder:"••••••••",disabled:d||!g}),c.jsx("button",{type:"button",onClick:()=>o(!s),className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300",disabled:d||!g,children:s?c.jsx(Dr,{className:"w-5 h-5"}):c.jsx(Ir,{className:"w-5 h-5"})})]})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Confirm New Password"}),c.jsxs("div",{className:"relative",children:[c.jsx(Jn,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-400"}),c.jsx("input",{type:i?"text":"password",required:!0,value:n,onChange:y=>r(y.target.value),className:"w-full pl-10 pr-12 py-2 bg-white dark:bg-black/50 border border-gray-200 dark:border-white/10 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500 dark:text-white placeholder-gray-400 dark:placeholder-gray-600",placeholder:"••••••••",disabled:d||!g}),c.jsx("button",{type:"button",onClick:()=>a(!i),className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300",disabled:d||!g,children:i?c.jsx(Dr,{className:"w-5 h-5"}):c.jsx(Ir,{className:"w-5 h-5"})})]})]}),c.jsx("button",{type:"submit",disabled:d||!g,className:"w-full flex justify-center items-center gap-2 py-2 px-4 border border-transparent rounded-lg text-sm font-medium text-white bg-primary-600 hover:bg-primary-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:d?"Resetting Password...":"Reset Password"})]})]})})})}const q6=["NGO","Government","Private Sector","Research","Individual","Other"],Ab=["Health","Agriculture","Energy","Environment","Education","Governance"];function Y6(){const{user:e,checkAuth:t}=Qr(),n=Is(),[r,s]=S.useState({full_name:(e==null?void 0:e.full_name)||"",organization:(e==null?void 0:e.organization)==="Unknown"?"":(e==null?void 0:e.organization)||"",organization_type:(e==null?void 0:e.organization_type)||""}),[o,i]=S.useState((e==null?void 0:e.sector)||[]),[a,l]=S.useState(""),[u,d]=S.useState(!1),[h,f]=S.useState(""),p=y=>{i(x=>x.includes(y)?x.filter(v=>v!==y):[...x,y])},g=()=>{const y=a.trim();y&&!o.includes(y)&&(i(x=>[...x,y]),l(""))},m=async y=>{var x,v;y.preventDefault(),f(""),d(!0);try{await ae.put("/auth/profile",{full_name:r.full_name||void 0,organization:r.organization||void 0,organization_type:r.organization_type||void 0,sector:o.length>0?o:void 0}),await t(),n("/dashboard")}catch(b){f(((v=(x=b.response)==null?void 0:x.data)==null?void 0:v.detail)||"Failed to update profile. Please try again.")}finally{d(!1)}};return c.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-50 dark:bg-black px-4 py-12",children:c.jsxs("div",{className:"max-w-md w-full space-y-8",children:[c.jsxs("div",{className:"text-center",children:[c.jsx("img",{src:"/logo.png",alt:"Sunbird AI",className:"h-10 w-10 rounded-full object-cover mx-auto mb-3"}),c.jsx("h2",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:"Complete Your Profile"}),c.jsx("p",{className:"mt-2 text-sm text-gray-600 dark:text-gray-400",children:"Help us understand how you're using Sunbird AI so we can serve you better."})]}),c.jsxs("div",{className:"bg-white dark:bg-secondary rounded-2xl shadow-lg dark:shadow-lg dark:shadow-black/10 p-8 border border-gray-100 dark:border-white/5",children:[c.jsxs("form",{className:"space-y-6",onSubmit:m,children:[h&&c.jsx("div",{className:"bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400 p-3 rounded-lg text-sm",children:h}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Full Name"}),c.jsx("input",{type:"text",value:r.full_name,onChange:y=>s({...r,full_name:y.target.value}),className:"w-full px-4 py-2 bg-white dark:bg-black/50 border border-gray-200 dark:border-white/10 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500 dark:text-white placeholder-gray-400 dark:placeholder-gray-600",placeholder:"John Doe",disabled:u})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Organization Name"}),c.jsx("input",{type:"text",value:r.organization,onChange:y=>s({...r,organization:y.target.value}),className:"w-full px-4 py-2 bg-white dark:bg-black/50 border border-gray-200 dark:border-white/10 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500 dark:text-white placeholder-gray-400 dark:placeholder-gray-600",placeholder:"Sunbird AI",disabled:u})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Organization Type"}),c.jsxs("select",{value:r.organization_type,onChange:y=>s({...r,organization_type:y.target.value}),className:"w-full px-4 py-2 bg-white dark:bg-black/50 border border-gray-200 dark:border-white/10 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500 dark:text-white appearance-none",disabled:u,children:[c.jsx("option",{value:"",children:"Select type..."}),q6.map(y=>c.jsx("option",{value:y,children:y},y))]})]}),c.jsxs("div",{children:[c.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:["Impact Sectors ",c.jsx("span",{className:"text-gray-400 font-normal",children:"(select all that apply)"})]}),c.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:[...Ab,...o.filter(y=>!Ab.includes(y))].map(y=>c.jsxs("button",{type:"button",onClick:()=>p(y),disabled:u,className:`px-3 py-1.5 rounded-full text-sm border transition-colors ${o.includes(y)?"border-primary-500 bg-primary-500/10 text-primary-600 dark:text-primary-400":"border-gray-200 dark:border-white/10 text-gray-500 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-white/5"}`,children:[y," ",o.includes(y)&&"✓"]},y))}),c.jsxs("div",{className:"flex gap-2 mt-2",children:[c.jsx("input",{type:"text",value:a,onChange:y=>l(y.target.value),onKeyDown:y=>y.key==="Enter"&&(y.preventDefault(),g()),className:"flex-1 px-3 py-1.5 bg-white dark:bg-black/50 border border-gray-200 dark:border-white/10 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500 dark:text-white text-sm placeholder-gray-400 dark:placeholder-gray-600",placeholder:"Add custom sector...",disabled:u}),c.jsx("button",{type:"button",onClick:g,disabled:u,className:"px-3 py-1.5 text-sm border border-gray-200 dark:border-white/10 rounded-lg text-gray-600 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-white/5 transition-colors",children:"Add"})]})]}),c.jsxs("button",{type:"submit",disabled:u,className:"w-full flex justify-center items-center gap-2 py-2 px-4 border border-transparent rounded-lg shadow-sm text-sm font-medium text-white bg-primary-600 hover:bg-primary-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500 transition-colors shadow-lg shadow-primary-500/20 disabled:opacity-50 disabled:cursor-not-allowed",children:[u&&c.jsx(Da,{className:"w-4 h-4 animate-spin"}),u?"Saving...":"Save & Continue to Dashboard"]})]}),c.jsx("div",{className:"mt-4 text-center",children:c.jsx("button",{onClick:()=>n("/dashboard"),className:"text-sm text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 transition-colors",children:"Skip for now →"})})]})]})})}function X6(){return c.jsxs("div",{className:"min-h-screen bg-white dark:bg-black flex flex-col",children:[c.jsx(Hu,{}),c.jsx("main",{className:"flex-1 pt-24 pb-16 px-4 sm:px-6 lg:px-8",children:c.jsxs("div",{className:"max-w-4xl mx-auto",children:[c.jsx("h1",{className:"text-4xl font-bold text-gray-900 dark:text-white mb-8",children:"Privacy Policy"}),c.jsxs("div",{className:"space-y-8 text-gray-700 dark:text-gray-300",children:[c.jsxs("div",{children:[c.jsx("h2",{className:"text-2xl font-semibold text-gray-900 dark:text-white mb-4",children:"Introduction"}),c.jsx("p",{className:"leading-relaxed",children:"Welcome to the Privacy Policy of Sunbird AI. We understand that privacy online is important to users of our services, especially when utilizing our WhatsApp translation bot. This statement governs our privacy policies with respect to the collection, use, and disclosure of personal information when using our services."})]}),c.jsxs("div",{children:[c.jsx("h2",{className:"text-2xl font-semibold text-gray-900 dark:text-white mb-4",children:"Personally Identifiable Information"}),c.jsx("p",{className:"leading-relaxed",children:"Personally Identifiable Information refers to any information that identifies or can be used to identify, contact, or locate the person to whom such information pertains, including, but not limited to, name, address, phone number, email address, IP address, location, and browser."})]}),c.jsxs("div",{children:[c.jsx("h2",{className:"text-2xl font-semibold text-gray-900 dark:text-white mb-4",children:"What Personally Identifiable Information is collected?"}),c.jsx("p",{className:"leading-relaxed",children:"We may collect basic user profile information from all users of our services. Additional information may be collected from users of our WhatsApp translation bot, including but not limited to, the content of messages for translation purposes."})]}),c.jsxs("div",{children:[c.jsx("h2",{className:"text-2xl font-semibold text-gray-900 dark:text-white mb-4",children:"How is Personally Identifiable Information stored?"}),c.jsx("p",{className:"leading-relaxed",children:"Personally Identifiable Information collected by Sunbird AI is securely stored and is not accessible to third parties or employees of Sunbird AI except for use as indicated above."})]}),c.jsxs("div",{children:[c.jsx("h2",{className:"text-2xl font-semibold text-gray-900 dark:text-white mb-4",children:"What choices are available to users regarding collection, use, and distribution of the information?"}),c.jsx("p",{className:"leading-relaxed",children:"Users may opt-out of certain data collection practices as outlined in this Privacy Policy by contacting Sunbird AI."})]}),c.jsxs("div",{children:[c.jsx("h2",{className:"text-2xl font-semibold text-gray-900 dark:text-white mb-4",children:"Changes to this Privacy Policy"}),c.jsx("p",{className:"leading-relaxed",children:"Sunbird AI reserves the right to update or change our Privacy Policy at any time. Users will be notified of any changes by posting the new Privacy Policy on this page."})]}),c.jsxs("div",{children:[c.jsx("h2",{className:"text-2xl font-semibold text-gray-900 dark:text-white mb-4",children:"Contact Us"}),c.jsxs("p",{className:"leading-relaxed",children:["If you have any questions about this Privacy Policy, please contact us at ",c.jsx("a",{href:"mailto:info@sunbird.ai",className:"text-primary-600 hover:text-primary-700 dark:text-primary-400 dark:hover:text-primary-300 underline",children:"info@sunbird.ai"})]})]})]})]})}),c.jsx(Uu,{})]})}function Q6(){return c.jsxs("div",{className:"min-h-screen bg-white dark:bg-black flex flex-col",children:[c.jsx(Hu,{}),c.jsx("main",{className:"flex-1 pt-24 pb-16 px-4 sm:px-6 lg:px-8",children:c.jsxs("div",{className:"max-w-4xl mx-auto",children:[c.jsx("h1",{className:"text-4xl font-bold text-gray-900 dark:text-white mb-8",children:"Terms of Service"}),c.jsxs("div",{className:"space-y-8 text-gray-700 dark:text-gray-300",children:[c.jsxs("div",{children:[c.jsx("h2",{className:"text-2xl font-semibold text-gray-900 dark:text-white mb-4",children:"Agreement"}),c.jsx("p",{className:"leading-relaxed",children:"By accessing or using the services provided by Sunbird AI, you agree to abide by these Terms of Service. These Terms apply to all visitors, users, and others who access or use our services."})]}),c.jsxs("div",{children:[c.jsx("h2",{className:"text-2xl font-semibold text-gray-900 dark:text-white mb-4",children:"Use of Services"}),c.jsx("p",{className:"leading-relaxed",children:'Our services, including the WhatsApp translation bot, are provided on an "as is" and "as available" basis. Users are solely responsible for their use of the services and any consequences thereof.'})]}),c.jsxs("div",{children:[c.jsx("h2",{className:"text-2xl font-semibold text-gray-900 dark:text-white mb-4",children:"Intellectual Property"}),c.jsx("p",{className:"leading-relaxed",children:"All intellectual property rights associated with the services provided by Sunbird AI, including but not limited to, the WhatsApp translation bot, are owned by Sunbird AI. Users are granted a limited, non-exclusive, non-transferable license to use the services for personal or non-commercial purposes."})]}),c.jsxs("div",{children:[c.jsx("h2",{className:"text-2xl font-semibold text-gray-900 dark:text-white mb-4",children:"Limitation of Liability"}),c.jsx("p",{className:"leading-relaxed",children:"Sunbird AI shall not be liable for any indirect, incidental, special, consequential, or punitive damages, or any loss of profits or revenues, whether incurred directly or indirectly, or any loss of data, use, goodwill, or other intangible losses resulting from (i) your access to or use of or inability to access or use the services; (ii) any conduct or content of any third party on the services; (iii) any content obtained from the services; or (iv) unauthorized access, use, or alteration of your transmissions or content."})]}),c.jsxs("div",{children:[c.jsx("h2",{className:"text-2xl font-semibold text-gray-900 dark:text-white mb-4",children:"Changes to Terms of Service"}),c.jsx("p",{className:"leading-relaxed",children:"Sunbird AI reserves the right to update or change these Terms of Service at any time. Users will be notified of any changes by posting the new Terms of Service on this page."})]}),c.jsxs("div",{children:[c.jsx("h2",{className:"text-2xl font-semibold text-gray-900 dark:text-white mb-4",children:"Contact Us"}),c.jsxs("p",{className:"leading-relaxed",children:["If you have any questions about these Terms of Service, please contact us at ",c.jsx("a",{href:"mailto:info@sunbird.ai",className:"text-primary-600 hover:text-primary-700 dark:text-primary-400 dark:hover:text-primary-300 underline",children:"info@sunbird.ai"})]})]})]})]})}),c.jsx(Uu,{})]})}function J6(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function Z6(e,t){if(e==null)return{};var n,r,s=J6(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;re.length)&&(t=e.length);for(var n=0,r=Array(t);n=4)return[e[0],e[1],e[2],e[3],"".concat(e[0],".").concat(e[1]),"".concat(e[0],".").concat(e[2]),"".concat(e[0],".").concat(e[3]),"".concat(e[1],".").concat(e[0]),"".concat(e[1],".").concat(e[2]),"".concat(e[1],".").concat(e[3]),"".concat(e[2],".").concat(e[0]),"".concat(e[2],".").concat(e[1]),"".concat(e[2],".").concat(e[3]),"".concat(e[3],".").concat(e[0]),"".concat(e[3],".").concat(e[1]),"".concat(e[3],".").concat(e[2]),"".concat(e[0],".").concat(e[1],".").concat(e[2]),"".concat(e[0],".").concat(e[1],".").concat(e[3]),"".concat(e[0],".").concat(e[2],".").concat(e[1]),"".concat(e[0],".").concat(e[2],".").concat(e[3]),"".concat(e[0],".").concat(e[3],".").concat(e[1]),"".concat(e[0],".").concat(e[3],".").concat(e[2]),"".concat(e[1],".").concat(e[0],".").concat(e[2]),"".concat(e[1],".").concat(e[0],".").concat(e[3]),"".concat(e[1],".").concat(e[2],".").concat(e[0]),"".concat(e[1],".").concat(e[2],".").concat(e[3]),"".concat(e[1],".").concat(e[3],".").concat(e[0]),"".concat(e[1],".").concat(e[3],".").concat(e[2]),"".concat(e[2],".").concat(e[0],".").concat(e[1]),"".concat(e[2],".").concat(e[0],".").concat(e[3]),"".concat(e[2],".").concat(e[1],".").concat(e[0]),"".concat(e[2],".").concat(e[1],".").concat(e[3]),"".concat(e[2],".").concat(e[3],".").concat(e[0]),"".concat(e[2],".").concat(e[3],".").concat(e[1]),"".concat(e[3],".").concat(e[0],".").concat(e[1]),"".concat(e[3],".").concat(e[0],".").concat(e[2]),"".concat(e[3],".").concat(e[1],".").concat(e[0]),"".concat(e[3],".").concat(e[1],".").concat(e[2]),"".concat(e[3],".").concat(e[2],".").concat(e[0]),"".concat(e[3],".").concat(e[2],".").concat(e[1]),"".concat(e[0],".").concat(e[1],".").concat(e[2],".").concat(e[3]),"".concat(e[0],".").concat(e[1],".").concat(e[3],".").concat(e[2]),"".concat(e[0],".").concat(e[2],".").concat(e[1],".").concat(e[3]),"".concat(e[0],".").concat(e[2],".").concat(e[3],".").concat(e[1]),"".concat(e[0],".").concat(e[3],".").concat(e[1],".").concat(e[2]),"".concat(e[0],".").concat(e[3],".").concat(e[2],".").concat(e[1]),"".concat(e[1],".").concat(e[0],".").concat(e[2],".").concat(e[3]),"".concat(e[1],".").concat(e[0],".").concat(e[3],".").concat(e[2]),"".concat(e[1],".").concat(e[2],".").concat(e[0],".").concat(e[3]),"".concat(e[1],".").concat(e[2],".").concat(e[3],".").concat(e[0]),"".concat(e[1],".").concat(e[3],".").concat(e[0],".").concat(e[2]),"".concat(e[1],".").concat(e[3],".").concat(e[2],".").concat(e[0]),"".concat(e[2],".").concat(e[0],".").concat(e[1],".").concat(e[3]),"".concat(e[2],".").concat(e[0],".").concat(e[3],".").concat(e[1]),"".concat(e[2],".").concat(e[1],".").concat(e[0],".").concat(e[3]),"".concat(e[2],".").concat(e[1],".").concat(e[3],".").concat(e[0]),"".concat(e[2],".").concat(e[3],".").concat(e[0],".").concat(e[1]),"".concat(e[2],".").concat(e[3],".").concat(e[1],".").concat(e[0]),"".concat(e[3],".").concat(e[0],".").concat(e[1],".").concat(e[2]),"".concat(e[3],".").concat(e[0],".").concat(e[2],".").concat(e[1]),"".concat(e[3],".").concat(e[1],".").concat(e[0],".").concat(e[2]),"".concat(e[3],".").concat(e[1],".").concat(e[2],".").concat(e[0]),"".concat(e[3],".").concat(e[2],".").concat(e[0],".").concat(e[1]),"".concat(e[3],".").concat(e[2],".").concat(e[1],".").concat(e[0])]}var ih={};function aF(e){if(e.length===0||e.length===1)return e;var t=e.join(".");return ih[t]||(ih[t]=iF(e)),ih[t]}function lF(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0,r=e.filter(function(o){return o!=="token"}),s=aF(r);return s.reduce(function(o,i){return po(po({},o),n[i])},t)}function Lb(e){return e.join(" ")}function cF(e,t){var n=0;return function(r){return n+=1,r.map(function(s,o){return GS({node:s,stylesheet:e,useInlineStyles:t,key:"code-segment-".concat(n,"-").concat(o)})})}}function GS(e){var t=e.node,n=e.stylesheet,r=e.style,s=r===void 0?{}:r,o=e.useInlineStyles,i=e.key,a=t.properties,l=t.type,u=t.tagName,d=t.value;if(l==="text")return d;if(u){var h=cF(n,o),f;if(!o)f=po(po({},a),{},{className:Lb(a.className)});else{var p=Object.keys(n).reduce(function(x,v){return v.split(".").forEach(function(b){x.includes(b)||x.push(b)}),x},[]),g=a.className&&a.className.includes("token")?["token"]:[],m=a.className&&g.concat(a.className.filter(function(x){return!p.includes(x)}));f=po(po({},a),{},{className:Lb(m)||void 0,style:lF(a.className,Object.assign({},a.style,s),n)})}var y=h(t.children);return z.createElement(u,Yf({key:i},f),y)}}const uF=(function(e,t){var n=e.listLanguages();return n.indexOf(t)!==-1});var dF=["language","children","style","customStyle","codeTagProps","useInlineStyles","showLineNumbers","showInlineLineNumbers","startingLineNumber","lineNumberContainerStyle","lineNumberStyle","wrapLines","wrapLongLines","lineProps","renderer","PreTag","CodeTag","code","astGenerator"];function Ob(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function Cr(e){for(var t=1;t1&&arguments[1]!==void 0?arguments[1]:[],n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];e.length===void 0&&(e=[e]);for(var r=0;r2&&arguments[2]!==void 0?arguments[2]:[];return oc({children:w,lineNumber:j,lineNumberStyle:a,largestLineNumber:i,showInlineLineNumbers:s,lineProps:n,className:N,showLineNumbers:r,wrapLongLines:l,wrapLines:t})}function m(w,j){if(r&&j&&s){var N=KS(a,j,i);w.unshift(qS(j,N))}return w}function y(w,j){var N=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];return t||N.length>0?g(w,j,N):m(w,j)}for(var x=function(){var j=d[p],N=j.children[0].value,_=fF(N);if(_){var P=N.split(` +`),style:i,startingLineNumber:a}))}function mF(e){return"".concat(e.toString().length,".25em")}function KS(e,t){return{type:"element",tagName:"span",properties:{key:"line-number--".concat(e),className:["comment","linenumber","react-syntax-highlighter-line-number"],style:t},children:[{type:"text",value:e}]}}function qS(e,t,n){var r={display:"inline-block",minWidth:mF(n),paddingRight:"1em",textAlign:"right",userSelect:"none"},s=typeof e=="function"?e(t):e,o=Cr(Cr({},r),s);return o}function oc(e){var t=e.children,n=e.lineNumber,r=e.lineNumberStyle,s=e.largestLineNumber,o=e.showInlineLineNumbers,i=e.lineProps,a=i===void 0?{}:i,l=e.className,u=l===void 0?[]:l,d=e.showLineNumbers,h=e.wrapLongLines,f=e.wrapLines,p=f===void 0?!1:f,g=p?Cr({},typeof a=="function"?a(n):a):{};if(g.className=g.className?[].concat(qf(g.className.trim().split(/\s+/)),qf(u)):u,n&&o){var m=qS(r,n,s);t.unshift(KS(n,m))}return h&d&&(g.style=Cr({display:"flex"},g.style)),{type:"element",tagName:"span",properties:g,children:t}}function YS(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];e.length===void 0&&(e=[e]);for(var r=0;r2&&arguments[2]!==void 0?arguments[2]:[];return oc({children:w,lineNumber:j,lineNumberStyle:a,largestLineNumber:i,showInlineLineNumbers:s,lineProps:n,className:N,showLineNumbers:r,wrapLongLines:l,wrapLines:t})}function m(w,j){if(r&&j&&s){var N=qS(a,j,i);w.unshift(KS(j,N))}return w}function y(w,j){var N=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];return t||N.length>0?g(w,j,N):m(w,j)}for(var x=function(){var j=d[p],N=j.children[0].value,_=fF(N);if(_){var P=N.split(` `);P.forEach(function(A,O){var F=r&&h.length+o,D={type:"text",value:"".concat(A,` -`)};if(O===0){var U=d.slice(f+1,p).concat(oc({children:[D],className:j.properties.className})),W=y(U,F);h.push(W)}else if(O===P.length-1){var M=d[p+1]&&d[p+1].children&&d[p+1].children[0],H={type:"text",value:"".concat(A)};if(M){var C=oc({children:[H],className:j.properties.className});d.splice(p+1,0,C)}else{var L=[H],E=y(L,F,j.properties.className);h.push(E)}}else{var I=[D],Y=y(I,F,j.properties.className);h.push(Y)}}),f=p}p++};p4&&n.slice(0,4)==="data"&&jF.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(Ib,PF);r="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!Ib.test(o)){let i=o.replace(_F,NF);i.charAt(0)!=="-"&&(i="-"+i),t="data"+i}}s=Kg}return new s(r,t)}function NF(e){return"-"+e.toLowerCase()}function PF(e){return e.charAt(1).toUpperCase()}const RF=QS([JS,kF,t_,n_,r_],"html"),EF=QS([JS,SF,t_,n_,r_],"svg");function Fb(e){const t=[],n=String(e||"");let r=n.indexOf(","),s=0,o=!1;for(;!o;){r===-1&&(r=n.length,o=!0);const i=n.slice(s,r).trim();(i||!o)&&t.push(i),s=r+1,r=n.indexOf(",",s)}return t}const zb=/[#.]/g;function TF(e,t){const n=e||"",r={};let s=0,o,i;for(;s=48&&t<=57}function zF(e){const t=typeof e=="string"?e.charCodeAt(0):e;return t>=97&&t<=102||t>=65&&t<=70||t>=48&&t<=57}function VF(e){const t=typeof e=="string"?e.charCodeAt(0):e;return t>=97&&t<=122||t>=65&&t<=90}function Hb(e){return VF(e)||o_(e)}const Ub=document.createElement("i");function Wb(e){const t="&"+e+";";Ub.innerHTML=t;const n=Ub.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}const BF=["","Named character references must be terminated by a semicolon","Numeric character references must be terminated by a semicolon","Named character references cannot be empty","Numeric character references cannot be empty","Named character references must be known","Numeric character references cannot be disallowed","Numeric character references cannot be outside the permissible Unicode range"];function $F(e,t){const n={},r=typeof n.additional=="string"?n.additional.charCodeAt(0):n.additional,s=[];let o=0,i=-1,a="",l,u;n.position&&("start"in n.position||"indent"in n.position?(u=n.position.indent,l=n.position.start):l=n.position);let d=(l?l.line:0)||1,h=(l?l.column:0)||1,f=g(),p;for(o--;++o<=e.length;)if(p===10&&(h=(u?u[i]:0)||1),p=e.charCodeAt(o),p===38){const x=e.charCodeAt(o+1);if(x===9||x===10||x===12||x===32||x===38||x===60||Number.isNaN(x)||r&&x===r){a+=String.fromCharCode(p),h++;continue}const v=o+1;let b=v,k=v,w;if(x===35){k=++b;const D=e.charCodeAt(k);D===88||D===120?(w="hexadecimal",k=++b):w="decimal"}else w="named";let j="",N="",_="";const P=w==="named"?Hb:w==="decimal"?o_:zF;for(k--;++k<=e.length;){const D=e.charCodeAt(k);if(!P(D))break;_+=String.fromCharCode(D),w==="named"&&FF.includes(_)&&(j=_,N=Wb(_))}let A=e.charCodeAt(k)===59;if(A){k++;const D=w==="named"?Wb(_):!1;D&&(j=_,N=D)}let O=1+k-v,F="";if(!(!A&&n.nonTerminated===!1))if(!_)w!=="named"&&m(4,O);else if(w==="named"){if(A&&!N)m(5,1);else if(j!==_&&(k=b+j.length,O=1+k-b,A=!1),!A){const D=j?1:3;if(n.attribute){const U=e.charCodeAt(k);U===61?(m(D,O),N=""):Hb(U)?N="":m(D,O)}else m(D,O)}F=N}else{A||m(2,O);let D=Number.parseInt(_,w==="hexadecimal"?16:10);if(HF(D))m(7,O),F="�";else if(D in $b)m(6,O),F=$b[D];else{let U="";UF(D)&&m(6,O),D>65535&&(D-=65536,U+=String.fromCharCode(D>>>10|55296),D=56320|D&1023),F=U+String.fromCharCode(D)}}if(F){y(),f=g(),o=k-1,h+=k-v+1,s.push(F);const D=g();D.offset++,n.reference&&n.reference.call(n.referenceContext||void 0,F,{start:f,end:D},e.slice(v-1,k)),f=D}else _=e.slice(v-1,k),a+=_,h+=_.length,o=k-1}else p===10&&(d++,i++,h=0),Number.isNaN(p)?y():(a+=String.fromCharCode(p),h++);return s.join("");function g(){return{line:d,column:h,offset:o+((l?l.offset:0)||0)}}function m(x,v){let b;n.warning&&(b=g(),b.column+=v,b.offset+=v,n.warning.call(n.warningContext||void 0,BF[x],b,x))}function y(){a&&(s.push(a),n.text&&n.text.call(n.textContext||void 0,a,{start:f,end:g()}),a="")}}function HF(e){return e>=55296&&e<=57343||e>1114111}function UF(e){return e>=1&&e<=8||e===11||e>=13&&e<=31||e>=127&&e<=159||e>=64976&&e<=65007||(e&65535)===65535||(e&65535)===65534}var WF=0,Ll={},Ze={util:{type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++WF}),e.__id},clone:function e(t,n){n=n||{};var r,s;switch(Ze.util.type(t)){case"Object":if(s=Ze.util.objId(t),n[s])return n[s];r={},n[s]=r;for(var o in t)t.hasOwnProperty(o)&&(r[o]=e(t[o],n));return r;case"Array":return s=Ze.util.objId(t),n[s]?n[s]:(r=[],n[s]=r,t.forEach(function(i,a){r[a]=e(i,n)}),r);default:return t}}},languages:{plain:Ll,plaintext:Ll,text:Ll,txt:Ll,extend:function(e,t){var n=Ze.util.clone(Ze.languages[e]);for(var r in t)n[r]=t[r];return n},insertBefore:function(e,t,n,r){r=r||Ze.languages;var s=r[e],o={};for(var i in s)if(s.hasOwnProperty(i)){if(i==t)for(var a in n)n.hasOwnProperty(a)&&(o[a]=n[a]);n.hasOwnProperty(i)||(o[i]=s[i])}var l=r[e];return r[e]=o,Ze.languages.DFS(Ze.languages,function(u,d){d===l&&u!=e&&(this[u]=o)}),o},DFS:function e(t,n,r,s){s=s||{};var o=Ze.util.objId;for(var i in t)if(t.hasOwnProperty(i)){n.call(t,i,t[i],r||i);var a=t[i],l=Ze.util.type(a);l==="Object"&&!s[o(a)]?(s[o(a)]=!0,e(a,n,null,s)):l==="Array"&&!s[o(a)]&&(s[o(a)]=!0,e(a,n,i,s))}}},plugins:{},highlight:function(e,t,n){var r={code:e,grammar:t,language:n};if(Ze.hooks.run("before-tokenize",r),!r.grammar)throw new Error('The language "'+r.language+'" has no grammar.');return r.tokens=Ze.tokenize(r.code,r.grammar),Ze.hooks.run("after-tokenize",r),qi.stringify(Ze.util.encode(r.tokens),r.language)},tokenize:function(e,t){var n=t.rest;if(n){for(var r in n)t[r]=n[r];delete t.rest}var s=new GF;return ic(s,s.head,e),i_(e,s,t,s.head,0),KF(s)},hooks:{all:{},add:function(e,t){var n=Ze.hooks.all;n[e]=n[e]||[],n[e].push(t)},run:function(e,t){var n=Ze.hooks.all[e];if(!(!n||!n.length))for(var r=0,s;s=n[r++];)s(t)}},Token:qi};function qi(e,t,n,r){this.type=e,this.content=t,this.alias=n,this.length=(r||"").length|0}function Gb(e,t,n,r){e.lastIndex=t;var s=e.exec(n);if(s&&r&&s[1]){var o=s[1].length;s.index+=o,s[0]=s[0].slice(o)}return s}function i_(e,t,n,r,s,o){for(var i in n)if(!(!n.hasOwnProperty(i)||!n[i])){var a=n[i];a=Array.isArray(a)?a:[a];for(var l=0;l=o.reach);x+=y.value.length,y=y.next){var v=y.value;if(t.length>e.length)return;if(!(v instanceof qi)){var b=1,k;if(f){if(k=Gb(m,x,e,h),!k||k.index>=e.length)break;var _=k.index,w=k.index+k[0].length,j=x;for(j+=y.value.length;_>=j;)y=y.next,j+=y.value.length;if(j-=y.value.length,x=j,y.value instanceof qi)continue;for(var N=y;N!==t.tail&&(jo.reach&&(o.reach=F);var D=y.prev;A&&(D=ic(t,D,A),x+=A.length),qF(t,D,b);var U=new qi(i,d?Ze.tokenize(P,d):P,p,P);if(y=ic(t,D,U),O&&ic(t,y,O),b>1){var W={cause:i+","+l,reach:F};i_(e,t,n,y.prev,x,W),o&&W.reach>o.reach&&(o.reach=W.reach)}}}}}}function GF(){var e={value:null,prev:null,next:null},t={value:null,prev:e,next:null};e.next=t,this.head=e,this.tail=t,this.length=0}function ic(e,t,n){var r=t.next,s={value:n,prev:t,next:r};return t.next=s,r.prev=s,e.length++,s}function qF(e,t,n){for(var r=t.next,s=0;s>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp("(\\{)"+n),lookbehind:!0,alias:"constant"}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/};t.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:"important"},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:"function"},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:"function"}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:"variable",lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,inside:{environment:{pattern:RegExp("(^|[\\s;|&]|[<>]\\()"+n),lookbehind:!0,alias:"constant"}},alias:"variable",lookbehind:!0},parameter:{pattern:/(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,alias:"variable",lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:s},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:r}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:s},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:s.entity}}],environment:{pattern:RegExp("\\$?"+n),alias:"constant"},variable:s.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|sysctl|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,lookbehind:!0,alias:"class-name"},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:"important"},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:"important"}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}},r.inside=t.languages.bash;for(var o=["comment","function-name","for-or-select","assign-left","parameter","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"],i=s.variable[1].inside,a=0;a]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},e.languages.python["string-interpolation"].inside.interpolation.inside.rest=e.languages.python,e.languages.py=e.languages.python}const nz={'code[class*="language-"]':{background:"hsl(220, 13%, 18%)",color:"hsl(220, 14%, 71%)",textShadow:"0 1px rgba(0, 0, 0, 0.3)",fontFamily:'"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"2",OTabSize:"2",tabSize:"2",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none"},'pre[class*="language-"]':{background:"hsl(220, 13%, 18%)",color:"hsl(220, 14%, 71%)",textShadow:"0 1px rgba(0, 0, 0, 0.3)",fontFamily:'"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"2",OTabSize:"2",tabSize:"2",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none",padding:"1em",margin:"0.5em 0",overflow:"auto",borderRadius:"0.3em"},'code[class*="language-"]::-moz-selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'code[class*="language-"] *::-moz-selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'pre[class*="language-"] *::-moz-selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'code[class*="language-"]::selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'code[class*="language-"] *::selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'pre[class*="language-"] *::selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},':not(pre) > code[class*="language-"]':{padding:"0.2em 0.3em",borderRadius:"0.3em",whiteSpace:"normal"},comment:{color:"hsl(220, 10%, 40%)",fontStyle:"italic"},prolog:{color:"hsl(220, 10%, 40%)"},cdata:{color:"hsl(220, 10%, 40%)"},doctype:{color:"hsl(220, 14%, 71%)"},punctuation:{color:"hsl(220, 14%, 71%)"},entity:{color:"hsl(220, 14%, 71%)",cursor:"help"},"attr-name":{color:"hsl(29, 54%, 61%)"},"class-name":{color:"hsl(29, 54%, 61%)"},boolean:{color:"hsl(29, 54%, 61%)"},constant:{color:"hsl(29, 54%, 61%)"},number:{color:"hsl(29, 54%, 61%)"},atrule:{color:"hsl(29, 54%, 61%)"},keyword:{color:"hsl(286, 60%, 67%)"},property:{color:"hsl(355, 65%, 65%)"},tag:{color:"hsl(355, 65%, 65%)"},symbol:{color:"hsl(355, 65%, 65%)"},deleted:{color:"hsl(355, 65%, 65%)"},important:{color:"hsl(355, 65%, 65%)"},selector:{color:"hsl(95, 38%, 62%)"},string:{color:"hsl(95, 38%, 62%)"},char:{color:"hsl(95, 38%, 62%)"},builtin:{color:"hsl(95, 38%, 62%)"},inserted:{color:"hsl(95, 38%, 62%)"},regex:{color:"hsl(95, 38%, 62%)"},"attr-value":{color:"hsl(95, 38%, 62%)"},"attr-value > .token.punctuation":{color:"hsl(95, 38%, 62%)"},variable:{color:"hsl(207, 82%, 66%)"},operator:{color:"hsl(207, 82%, 66%)"},function:{color:"hsl(207, 82%, 66%)"},url:{color:"hsl(187, 47%, 55%)"},"attr-value > .token.punctuation.attr-equals":{color:"hsl(220, 14%, 71%)"},"special-attr > .token.attr-value > .token.value.css":{color:"hsl(220, 14%, 71%)"},".language-css .token.selector":{color:"hsl(355, 65%, 65%)"},".language-css .token.property":{color:"hsl(220, 14%, 71%)"},".language-css .token.function":{color:"hsl(187, 47%, 55%)"},".language-css .token.url > .token.function":{color:"hsl(187, 47%, 55%)"},".language-css .token.url > .token.string.url":{color:"hsl(95, 38%, 62%)"},".language-css .token.important":{color:"hsl(286, 60%, 67%)"},".language-css .token.atrule .token.rule":{color:"hsl(286, 60%, 67%)"},".language-javascript .token.operator":{color:"hsl(286, 60%, 67%)"},".language-javascript .token.template-string > .token.interpolation > .token.interpolation-punctuation.punctuation":{color:"hsl(5, 48%, 51%)"},".language-json .token.operator":{color:"hsl(220, 14%, 71%)"},".language-json .token.null.keyword":{color:"hsl(29, 54%, 61%)"},".language-markdown .token.url":{color:"hsl(220, 14%, 71%)"},".language-markdown .token.url > .token.operator":{color:"hsl(220, 14%, 71%)"},".language-markdown .token.url-reference.url > .token.string":{color:"hsl(220, 14%, 71%)"},".language-markdown .token.url > .token.content":{color:"hsl(207, 82%, 66%)"},".language-markdown .token.url > .token.url":{color:"hsl(187, 47%, 55%)"},".language-markdown .token.url-reference.url":{color:"hsl(187, 47%, 55%)"},".language-markdown .token.blockquote.punctuation":{color:"hsl(220, 10%, 40%)",fontStyle:"italic"},".language-markdown .token.hr.punctuation":{color:"hsl(220, 10%, 40%)",fontStyle:"italic"},".language-markdown .token.code-snippet":{color:"hsl(95, 38%, 62%)"},".language-markdown .token.bold .token.content":{color:"hsl(29, 54%, 61%)"},".language-markdown .token.italic .token.content":{color:"hsl(286, 60%, 67%)"},".language-markdown .token.strike .token.content":{color:"hsl(355, 65%, 65%)"},".language-markdown .token.strike .token.punctuation":{color:"hsl(355, 65%, 65%)"},".language-markdown .token.list.punctuation":{color:"hsl(355, 65%, 65%)"},".language-markdown .token.title.important > .token.punctuation":{color:"hsl(355, 65%, 65%)"},bold:{fontWeight:"bold"},italic:{fontStyle:"italic"},namespace:{Opacity:"0.8"},"token.tab:not(:empty):before":{color:"hsla(220, 14%, 71%, 0.15)",textShadow:"none"},"token.cr:before":{color:"hsla(220, 14%, 71%, 0.15)",textShadow:"none"},"token.lf:before":{color:"hsla(220, 14%, 71%, 0.15)",textShadow:"none"},"token.space:before":{color:"hsla(220, 14%, 71%, 0.15)",textShadow:"none"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item":{marginRight:"0.4em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 9%, 55%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 9%, 55%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 9%, 55%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:hover":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:focus":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:hover":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:focus":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:hover":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:focus":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},".line-highlight.line-highlight":{background:"hsla(220, 100%, 80%, 0.04)"},".line-highlight.line-highlight:before":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 14%, 71%)",padding:"0.1em 0.6em",borderRadius:"0.3em",boxShadow:"0 2px 0 0 rgba(0, 0, 0, 0.2)"},".line-highlight.line-highlight[data-end]:after":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 14%, 71%)",padding:"0.1em 0.6em",borderRadius:"0.3em",boxShadow:"0 2px 0 0 rgba(0, 0, 0, 0.2)"},"pre[id].linkable-line-numbers.linkable-line-numbers span.line-numbers-rows > span:hover:before":{backgroundColor:"hsla(220, 100%, 80%, 0.04)"},".line-numbers.line-numbers .line-numbers-rows":{borderRightColor:"hsla(220, 14%, 71%, 0.15)"},".command-line .command-line-prompt":{borderRightColor:"hsla(220, 14%, 71%, 0.15)"},".line-numbers .line-numbers-rows > span:before":{color:"hsl(220, 14%, 45%)"},".command-line .command-line-prompt > span:before":{color:"hsl(220, 14%, 45%)"},".rainbow-braces .token.token.punctuation.brace-level-1":{color:"hsl(355, 65%, 65%)"},".rainbow-braces .token.token.punctuation.brace-level-5":{color:"hsl(355, 65%, 65%)"},".rainbow-braces .token.token.punctuation.brace-level-9":{color:"hsl(355, 65%, 65%)"},".rainbow-braces .token.token.punctuation.brace-level-2":{color:"hsl(95, 38%, 62%)"},".rainbow-braces .token.token.punctuation.brace-level-6":{color:"hsl(95, 38%, 62%)"},".rainbow-braces .token.token.punctuation.brace-level-10":{color:"hsl(95, 38%, 62%)"},".rainbow-braces .token.token.punctuation.brace-level-3":{color:"hsl(207, 82%, 66%)"},".rainbow-braces .token.token.punctuation.brace-level-7":{color:"hsl(207, 82%, 66%)"},".rainbow-braces .token.token.punctuation.brace-level-11":{color:"hsl(207, 82%, 66%)"},".rainbow-braces .token.token.punctuation.brace-level-4":{color:"hsl(286, 60%, 67%)"},".rainbow-braces .token.token.punctuation.brace-level-8":{color:"hsl(286, 60%, 67%)"},".rainbow-braces .token.token.punctuation.brace-level-12":{color:"hsl(286, 60%, 67%)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)":{backgroundColor:"hsla(353, 100%, 66%, 0.15)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)":{backgroundColor:"hsla(353, 100%, 66%, 0.15)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix) *::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix) *::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)":{backgroundColor:"hsla(137, 100%, 55%, 0.15)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)":{backgroundColor:"hsla(137, 100%, 55%, 0.15)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix) *::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix) *::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},".prism-previewer.prism-previewer:before":{borderColor:"hsl(224, 13%, 17%)"},".prism-previewer-gradient.prism-previewer-gradient div":{borderColor:"hsl(224, 13%, 17%)",borderRadius:"0.3em"},".prism-previewer-color.prism-previewer-color:before":{borderRadius:"0.3em"},".prism-previewer-easing.prism-previewer-easing:before":{borderRadius:"0.3em"},".prism-previewer.prism-previewer:after":{borderTopColor:"hsl(224, 13%, 17%)"},".prism-previewer-flipped.prism-previewer-flipped.after":{borderBottomColor:"hsl(224, 13%, 17%)"},".prism-previewer-angle.prism-previewer-angle:before":{background:"hsl(219, 13%, 22%)"},".prism-previewer-time.prism-previewer-time:before":{background:"hsl(219, 13%, 22%)"},".prism-previewer-easing.prism-previewer-easing":{background:"hsl(219, 13%, 22%)"},".prism-previewer-angle.prism-previewer-angle circle":{stroke:"hsl(220, 14%, 71%)",strokeOpacity:"1"},".prism-previewer-time.prism-previewer-time circle":{stroke:"hsl(220, 14%, 71%)",strokeOpacity:"1"},".prism-previewer-easing.prism-previewer-easing circle":{stroke:"hsl(220, 14%, 71%)",fill:"transparent"},".prism-previewer-easing.prism-previewer-easing path":{stroke:"hsl(220, 14%, 71%)"},".prism-previewer-easing.prism-previewer-easing line":{stroke:"hsl(220, 14%, 71%)"}},rz={'code[class*="language-"]':{background:"hsl(230, 1%, 98%)",color:"hsl(230, 8%, 24%)",fontFamily:'"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"2",OTabSize:"2",tabSize:"2",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none"},'pre[class*="language-"]':{background:"hsl(230, 1%, 98%)",color:"hsl(230, 8%, 24%)",fontFamily:'"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"2",OTabSize:"2",tabSize:"2",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none",padding:"1em",margin:"0.5em 0",overflow:"auto",borderRadius:"0.3em"},'code[class*="language-"]::-moz-selection':{background:"hsl(230, 1%, 90%)",color:"inherit"},'code[class*="language-"] *::-moz-selection':{background:"hsl(230, 1%, 90%)",color:"inherit"},'pre[class*="language-"] *::-moz-selection':{background:"hsl(230, 1%, 90%)",color:"inherit"},'code[class*="language-"]::selection':{background:"hsl(230, 1%, 90%)",color:"inherit"},'code[class*="language-"] *::selection':{background:"hsl(230, 1%, 90%)",color:"inherit"},'pre[class*="language-"] *::selection':{background:"hsl(230, 1%, 90%)",color:"inherit"},':not(pre) > code[class*="language-"]':{padding:"0.2em 0.3em",borderRadius:"0.3em",whiteSpace:"normal"},comment:{color:"hsl(230, 4%, 64%)",fontStyle:"italic"},prolog:{color:"hsl(230, 4%, 64%)"},cdata:{color:"hsl(230, 4%, 64%)"},doctype:{color:"hsl(230, 8%, 24%)"},punctuation:{color:"hsl(230, 8%, 24%)"},entity:{color:"hsl(230, 8%, 24%)",cursor:"help"},"attr-name":{color:"hsl(35, 99%, 36%)"},"class-name":{color:"hsl(35, 99%, 36%)"},boolean:{color:"hsl(35, 99%, 36%)"},constant:{color:"hsl(35, 99%, 36%)"},number:{color:"hsl(35, 99%, 36%)"},atrule:{color:"hsl(35, 99%, 36%)"},keyword:{color:"hsl(301, 63%, 40%)"},property:{color:"hsl(5, 74%, 59%)"},tag:{color:"hsl(5, 74%, 59%)"},symbol:{color:"hsl(5, 74%, 59%)"},deleted:{color:"hsl(5, 74%, 59%)"},important:{color:"hsl(5, 74%, 59%)"},selector:{color:"hsl(119, 34%, 47%)"},string:{color:"hsl(119, 34%, 47%)"},char:{color:"hsl(119, 34%, 47%)"},builtin:{color:"hsl(119, 34%, 47%)"},inserted:{color:"hsl(119, 34%, 47%)"},regex:{color:"hsl(119, 34%, 47%)"},"attr-value":{color:"hsl(119, 34%, 47%)"},"attr-value > .token.punctuation":{color:"hsl(119, 34%, 47%)"},variable:{color:"hsl(221, 87%, 60%)"},operator:{color:"hsl(221, 87%, 60%)"},function:{color:"hsl(221, 87%, 60%)"},url:{color:"hsl(198, 99%, 37%)"},"attr-value > .token.punctuation.attr-equals":{color:"hsl(230, 8%, 24%)"},"special-attr > .token.attr-value > .token.value.css":{color:"hsl(230, 8%, 24%)"},".language-css .token.selector":{color:"hsl(5, 74%, 59%)"},".language-css .token.property":{color:"hsl(230, 8%, 24%)"},".language-css .token.function":{color:"hsl(198, 99%, 37%)"},".language-css .token.url > .token.function":{color:"hsl(198, 99%, 37%)"},".language-css .token.url > .token.string.url":{color:"hsl(119, 34%, 47%)"},".language-css .token.important":{color:"hsl(301, 63%, 40%)"},".language-css .token.atrule .token.rule":{color:"hsl(301, 63%, 40%)"},".language-javascript .token.operator":{color:"hsl(301, 63%, 40%)"},".language-javascript .token.template-string > .token.interpolation > .token.interpolation-punctuation.punctuation":{color:"hsl(344, 84%, 43%)"},".language-json .token.operator":{color:"hsl(230, 8%, 24%)"},".language-json .token.null.keyword":{color:"hsl(35, 99%, 36%)"},".language-markdown .token.url":{color:"hsl(230, 8%, 24%)"},".language-markdown .token.url > .token.operator":{color:"hsl(230, 8%, 24%)"},".language-markdown .token.url-reference.url > .token.string":{color:"hsl(230, 8%, 24%)"},".language-markdown .token.url > .token.content":{color:"hsl(221, 87%, 60%)"},".language-markdown .token.url > .token.url":{color:"hsl(198, 99%, 37%)"},".language-markdown .token.url-reference.url":{color:"hsl(198, 99%, 37%)"},".language-markdown .token.blockquote.punctuation":{color:"hsl(230, 4%, 64%)",fontStyle:"italic"},".language-markdown .token.hr.punctuation":{color:"hsl(230, 4%, 64%)",fontStyle:"italic"},".language-markdown .token.code-snippet":{color:"hsl(119, 34%, 47%)"},".language-markdown .token.bold .token.content":{color:"hsl(35, 99%, 36%)"},".language-markdown .token.italic .token.content":{color:"hsl(301, 63%, 40%)"},".language-markdown .token.strike .token.content":{color:"hsl(5, 74%, 59%)"},".language-markdown .token.strike .token.punctuation":{color:"hsl(5, 74%, 59%)"},".language-markdown .token.list.punctuation":{color:"hsl(5, 74%, 59%)"},".language-markdown .token.title.important > .token.punctuation":{color:"hsl(5, 74%, 59%)"},bold:{fontWeight:"bold"},italic:{fontStyle:"italic"},namespace:{Opacity:"0.8"},"token.tab:not(:empty):before":{color:"hsla(230, 8%, 24%, 0.2)"},"token.cr:before":{color:"hsla(230, 8%, 24%, 0.2)"},"token.lf:before":{color:"hsla(230, 8%, 24%, 0.2)"},"token.space:before":{color:"hsla(230, 8%, 24%, 0.2)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item":{marginRight:"0.4em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button":{background:"hsl(230, 1%, 90%)",color:"hsl(230, 6%, 44%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a":{background:"hsl(230, 1%, 90%)",color:"hsl(230, 6%, 44%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span":{background:"hsl(230, 1%, 90%)",color:"hsl(230, 6%, 44%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:hover":{background:"hsl(230, 1%, 78%)",color:"hsl(230, 8%, 24%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:focus":{background:"hsl(230, 1%, 78%)",color:"hsl(230, 8%, 24%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:hover":{background:"hsl(230, 1%, 78%)",color:"hsl(230, 8%, 24%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:focus":{background:"hsl(230, 1%, 78%)",color:"hsl(230, 8%, 24%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:hover":{background:"hsl(230, 1%, 78%)",color:"hsl(230, 8%, 24%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:focus":{background:"hsl(230, 1%, 78%)",color:"hsl(230, 8%, 24%)"},".line-highlight.line-highlight":{background:"hsla(230, 8%, 24%, 0.05)"},".line-highlight.line-highlight:before":{background:"hsl(230, 1%, 90%)",color:"hsl(230, 8%, 24%)",padding:"0.1em 0.6em",borderRadius:"0.3em",boxShadow:"0 2px 0 0 rgba(0, 0, 0, 0.2)"},".line-highlight.line-highlight[data-end]:after":{background:"hsl(230, 1%, 90%)",color:"hsl(230, 8%, 24%)",padding:"0.1em 0.6em",borderRadius:"0.3em",boxShadow:"0 2px 0 0 rgba(0, 0, 0, 0.2)"},"pre[id].linkable-line-numbers.linkable-line-numbers span.line-numbers-rows > span:hover:before":{backgroundColor:"hsla(230, 8%, 24%, 0.05)"},".line-numbers.line-numbers .line-numbers-rows":{borderRightColor:"hsla(230, 8%, 24%, 0.2)"},".command-line .command-line-prompt":{borderRightColor:"hsla(230, 8%, 24%, 0.2)"},".line-numbers .line-numbers-rows > span:before":{color:"hsl(230, 1%, 62%)"},".command-line .command-line-prompt > span:before":{color:"hsl(230, 1%, 62%)"},".rainbow-braces .token.token.punctuation.brace-level-1":{color:"hsl(5, 74%, 59%)"},".rainbow-braces .token.token.punctuation.brace-level-5":{color:"hsl(5, 74%, 59%)"},".rainbow-braces .token.token.punctuation.brace-level-9":{color:"hsl(5, 74%, 59%)"},".rainbow-braces .token.token.punctuation.brace-level-2":{color:"hsl(119, 34%, 47%)"},".rainbow-braces .token.token.punctuation.brace-level-6":{color:"hsl(119, 34%, 47%)"},".rainbow-braces .token.token.punctuation.brace-level-10":{color:"hsl(119, 34%, 47%)"},".rainbow-braces .token.token.punctuation.brace-level-3":{color:"hsl(221, 87%, 60%)"},".rainbow-braces .token.token.punctuation.brace-level-7":{color:"hsl(221, 87%, 60%)"},".rainbow-braces .token.token.punctuation.brace-level-11":{color:"hsl(221, 87%, 60%)"},".rainbow-braces .token.token.punctuation.brace-level-4":{color:"hsl(301, 63%, 40%)"},".rainbow-braces .token.token.punctuation.brace-level-8":{color:"hsl(301, 63%, 40%)"},".rainbow-braces .token.token.punctuation.brace-level-12":{color:"hsl(301, 63%, 40%)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)":{backgroundColor:"hsla(353, 100%, 66%, 0.15)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)":{backgroundColor:"hsla(353, 100%, 66%, 0.15)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix) *::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix) *::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)":{backgroundColor:"hsla(137, 100%, 55%, 0.15)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)":{backgroundColor:"hsla(137, 100%, 55%, 0.15)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix) *::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix) *::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},".prism-previewer.prism-previewer:before":{borderColor:"hsl(0, 0, 95%)"},".prism-previewer-gradient.prism-previewer-gradient div":{borderColor:"hsl(0, 0, 95%)",borderRadius:"0.3em"},".prism-previewer-color.prism-previewer-color:before":{borderRadius:"0.3em"},".prism-previewer-easing.prism-previewer-easing:before":{borderRadius:"0.3em"},".prism-previewer.prism-previewer:after":{borderTopColor:"hsl(0, 0, 95%)"},".prism-previewer-flipped.prism-previewer-flipped.after":{borderBottomColor:"hsl(0, 0, 95%)"},".prism-previewer-angle.prism-previewer-angle:before":{background:"hsl(0, 0%, 100%)"},".prism-previewer-time.prism-previewer-time:before":{background:"hsl(0, 0%, 100%)"},".prism-previewer-easing.prism-previewer-easing":{background:"hsl(0, 0%, 100%)"},".prism-previewer-angle.prism-previewer-angle circle":{stroke:"hsl(230, 8%, 24%)",strokeOpacity:"1"},".prism-previewer-time.prism-previewer-time circle":{stroke:"hsl(230, 8%, 24%)",strokeOpacity:"1"},".prism-previewer-easing.prism-previewer-easing circle":{stroke:"hsl(230, 8%, 24%)",fill:"transparent"},".prism-previewer-easing.prism-previewer-easing path":{stroke:"hsl(230, 8%, 24%)"},".prism-previewer-easing.prism-previewer-easing line":{stroke:"hsl(230, 8%, 24%)"}};Qo.registerLanguage("python",Qg);Qo.registerLanguage("json",Xg);Qo.registerLanguage("bash",Yg);function sz(){const[e,t]=S.useState(()=>typeof document<"u"&&document.documentElement.classList.contains("dark")?"dark":"light");return S.useEffect(()=>{const n=document.documentElement,r=()=>t(n.classList.contains("dark")?"dark":"light");r();const s=new MutationObserver(r);return s.observe(n,{attributes:!0,attributeFilter:["class"]}),()=>s.disconnect()},[]),e}function Pe({code:e,language:t="python",label:n}){const r=sz(),[s,o]=S.useState(!1),i=async()=>{try{await navigator.clipboard.writeText(e),o(!0),setTimeout(()=>o(!1),2e3)}catch{}},a=n??t.toUpperCase(),l=r==="dark"?nz:rz;return c.jsxs("div",{className:"group relative my-4 rounded-2xl border border-gray-200 dark:border-white/10 bg-gray-50 dark:bg-white/5 overflow-hidden",children:[c.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-gray-200 dark:border-white/10 bg-white/50 dark:bg-black/30",children:[c.jsx("span",{className:"text-xs font-mono font-medium text-gray-500 dark:text-gray-400 tracking-wide",children:a}),c.jsx("button",{onClick:i,className:"inline-flex items-center gap-1.5 px-2 py-1 rounded-md text-xs font-medium text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-white/10 transition-colors","aria-label":s?"Copied":"Copy code",children:s?c.jsxs(c.Fragment,{children:[c.jsx(vu,{size:14,className:"text-primary-600 dark:text-primary-400"}),"Copied"]}):c.jsxs(c.Fragment,{children:[c.jsx(Y1,{size:14}),"Copy"]})})]}),c.jsx(Qo,{language:t,style:l,customStyle:{margin:0,padding:"1rem 1.25rem",background:"transparent",fontSize:"0.875rem",lineHeight:"1.6"},codeTagProps:{style:{fontFamily:'ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace'}},children:e})]})}const qb=[{id:"overview",label:"Overview"},{id:"language-support",label:"Language Support"},{id:"authentication",label:"Authentication",part:"Part 1"},{id:"translation",label:"Translation",part:"Part 2"},{id:"speech-to-text",label:"Speech-to-Text",part:"Part 3"},{id:"language-detection",label:"Language Detection",part:"Part 4"},{id:"text-to-speech",label:"Text-to-Speech",part:"Part 5"},{id:"conversational-ai",label:"Conversational AI",part:"Part 6"},{id:"file-upload",label:"File Upload",part:"Part 7"},{id:"resources",label:"Resources"}],oz=[{name:"English",code:"eng"},{name:"Acholi",code:"ach"},{name:"Ateso",code:"teo"},{name:"Luganda",code:"lug"},{name:"Lugbara",code:"lgg"},{name:"Runyankole",code:"nyn"},{name:"Swahili",code:"swa"}],iz=[{name:"Acholi",code:"ach",speech:!0,transcription:!0,chat:!0},{name:"Afrikaans",code:"afr",speech:!0,transcription:!1,chat:!1},{name:"Alur",code:"alz",speech:!1,transcription:!1,chat:!0},{name:"Aringa",code:"luc",speech:!1,transcription:!1,chat:!0},{name:"Ateso",code:"teo",speech:!0,transcription:!0,chat:!0},{name:"Bari",code:"bfa",speech:!1,transcription:!1,chat:!0},{name:"English",code:"eng",speech:!0,transcription:!0,chat:!0},{name:"Ewe",code:"ewe",speech:!0,transcription:!1,chat:!1},{name:"Fulah",code:"ful",speech:!0,transcription:!1,chat:!1},{name:"Hausa",code:"hau",speech:!0,transcription:!1,chat:!1},{name:"Igbo",code:"ibo",speech:!0,transcription:!1,chat:!1},{name:"Jopadhola",code:"adh",speech:!1,transcription:!1,chat:!0},{name:"Kakwa",code:"keo",speech:!1,transcription:!1,chat:!0},{name:"Karamojong",code:"kdj",speech:!1,transcription:!1,chat:!0},{name:"Kikuyu",code:"kik",speech:!0,transcription:!1,chat:!1},{name:"Kinyarwanda",code:"kin",speech:!0,transcription:!0,chat:!0},{name:"Kumam",code:"kdi",speech:!1,transcription:!1,chat:!0},{name:"Kupsabiny",code:"kpz",speech:!1,transcription:!1,chat:!0},{name:"Kwamba",code:"rwm",speech:!1,transcription:!1,chat:!0},{name:"Lango",code:"laj",speech:!1,transcription:!1,chat:!0},{name:"Lingala",code:"lin",speech:!0,transcription:!1,chat:!1},{name:"Lubwisi",code:"tlj",speech:!1,transcription:!1,chat:!0},{name:"Lugbara",code:"lgg",speech:!0,transcription:!0,chat:!0,ttsVoiceless:!0},{name:"Lugungu",code:"rub",speech:!1,transcription:!1,chat:!0},{name:"Lugwere",code:"gwr",speech:!1,transcription:!1,chat:!0},{name:"Luganda",code:"lug",speech:!0,transcription:!0,chat:!0},{name:"Lumasaba",code:"myx",speech:!1,transcription:!0,chat:!0},{name:"Lunyole",code:"nuj",speech:!1,transcription:!1,chat:!0},{name:"Luo (Dholuo)",code:"luo",speech:!0,transcription:!1,chat:!1},{name:"Lusoga",code:"xog",speech:!1,transcription:!0,chat:!0},{name:"Ma'di",code:"mhi",speech:!1,transcription:!1,chat:!0},{name:"Pokot",code:"pok",speech:!1,transcription:!1,chat:!0},{name:"Rukiga",code:"cgg",speech:!1,transcription:!1,chat:!0},{name:"Rukonjo",code:"koo",speech:!1,transcription:!1,chat:!0},{name:"Runyankole",code:"nyn",speech:!0,transcription:!0,chat:!0},{name:"Runyoro",code:"nyo",speech:!1,transcription:!1,chat:!0},{name:"Ruruuli",code:"ruc",speech:!1,transcription:!1,chat:!0},{name:"Rutooro",code:"ttj",speech:!1,transcription:!0,chat:!0},{name:"Samia",code:"lsm",speech:!1,transcription:!1,chat:!0},{name:"Sesotho",code:"sot",speech:!0,transcription:!1,chat:!1,ttsVoiceless:!0},{name:"Setswana",code:"tsn",speech:!0,transcription:!1,chat:!1,ttsVoiceless:!0},{name:"Swahili",code:"swa",speech:!0,transcription:!0,chat:!0},{name:"Xhosa",code:"xho",speech:!0,transcription:!1,chat:!1},{name:"Yoruba",code:"yor",speech:!0,transcription:!1,chat:!1}],az=[{code:"eng",name:"English (Ugandan)"},{code:"swa",name:"Swahili"},{code:"ach",name:"Acholi"},{code:"lgg",name:"Lugbara"},{code:"lug",name:"Luganda"},{code:"nyn",name:"Runyankole"},{code:"teo",name:"Ateso"},{code:"xog",name:"Lusoga"},{code:"ttj",name:"Rutooro"},{code:"kin",name:"Kinyarwanda"},{code:"myx",name:"Lumasaba"}],lz=[{config:"ach",language:"Acholi",iso:"—",region:"Uganda, South Sudan",speakers:["salt_ach_0001","waxal_ach_0001","waxal_ach_0005","waxal_ach_0006","waxal_ach_0008"]},{config:"afr",language:"Afrikaans",iso:"af",region:"South Africa, Namibia",speakers:["slr32_afr_0009"]},{config:"eng",language:"English",iso:"en",region:"(control language)",speakers:["salt_eng_0001","salt_eng_0002","salt_eng_0003"]},{config:"ewe",language:"Ewe",iso:"ee",region:"Ghana, Togo",speakers:["slr129_ewe_0001"]},{config:"ful",language:"Fulah",iso:"ff",region:"West Africa (Sahel)",speakers:["waxal_ful_0003","waxal_ful_0004","waxal_ful_0006"]},{config:"hau",language:"Hausa",iso:"ha",region:"Nigeria, Niger, Chad",speakers:["waxal_hau_0004","waxal_hau_0006","waxal_hau_0007","waxal_hau_0008"]},{config:"ibo",language:"Igbo",iso:"ig",region:"Nigeria",speakers:["waxal_ibo_0003","waxal_ibo_0005","waxal_ibo_0008"]},{config:"kik",language:"Kikuyu",iso:"ki",region:"Kenya",speakers:["waxal_kik_0003","waxal_kik_0004"]},{config:"kin",language:"Kinyarwanda",iso:"rw",region:"Rwanda",speakers:["bateesa_kin_0001"]},{config:"lgg",language:"Lugbara",iso:"—",region:"Uganda, DRC",speakers:[]},{config:"lin",language:"Lingala",iso:"ln",region:"DRC, Republic of Congo",speakers:["slr129_lin_0001"]},{config:"lug",language:"Luganda",iso:"lg",region:"Uganda",speakers:["salt_lug_0001","waxal_lug_0002","waxal_lug_0003","waxal_lug_0004","waxal_lug_0005","waxal_lug_0006","waxal_lug_0007","waxal_lug_0008"]},{config:"luo",language:"Luo (Dholuo)",iso:"—",region:"Kenya, Tanzania",speakers:["waxal_luo_0001","waxal_luo_0002","waxal_luo_0003","waxal_luo_0004"]},{config:"nyn",language:"Runyankole",iso:"—",region:"Uganda",speakers:["salt_nyn_0001","waxal_nyn_0003","waxal_nyn_0004","waxal_nyn_0007","waxal_nyn_0008"]},{config:"sot",language:"Sesotho",iso:"st",region:"Lesotho, South Africa",speakers:[]},{config:"swa",language:"Swahili",iso:"sw",region:"East Africa",speakers:["waxal_swa_0006","waxal_swa_0007"]},{config:"teo",language:"Ateso",iso:"—",region:"Uganda, Kenya",speakers:["salt_teo_0001"]},{config:"tsn",language:"Setswana",iso:"tn",region:"Botswana, South Africa",speakers:[]},{config:"xho",language:"Xhosa",iso:"xh",region:"South Africa",speakers:["slr32_xho_0012"]},{config:"yor",language:"Yoruba",iso:"yo",region:"Nigeria, Benin",speakers:["waxal_yor_0002","waxal_yor_0006","waxal_yor_0008"]}],cz=[{name:"acholi_female",id:241,description:"Acholi (female)"},{name:"ateso_female",id:242,description:"Ateso (female)"},{name:"runyankore_female",id:243,description:"Runyankore (female)"},{name:"lugbara_female",id:245,description:"Lugbara (female)"},{name:"swahili_male",id:246,description:"Swahili (male)"},{name:"luganda_female",id:248,description:"Luganda (female)"}],uz=[{mode:"url",description:"Generate audio, upload to GCP, return a signed URL (valid ~30 minutes) — default"},{mode:"stream",description:"Stream raw audio chunks directly"},{mode:"both",description:"Stream audio and return a final signed URL"}],dz=["Temporary signed URLs (valid for 30 minutes)","Direct upload to Google Cloud Storage","Path traversal protection","Support for multiple content types"],hz=`import requests +`)};if(O===0){var W=d.slice(f+1,p).concat(oc({children:[D],className:j.properties.className})),G=y(W,F);h.push(G)}else if(O===P.length-1){var M=d[p+1]&&d[p+1].children&&d[p+1].children[0],U={type:"text",value:"".concat(A)};if(M){var C=oc({children:[U],className:j.properties.className});d.splice(p+1,0,C)}else{var L=[U],E=y(L,F,j.properties.className);h.push(E)}}else{var I=[D],Y=y(I,F,j.properties.className);h.push(Y)}}),f=p}p++};p4&&n.slice(0,4)==="data"&&jF.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(Ib,PF);r="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!Ib.test(o)){let i=o.replace(_F,NF);i.charAt(0)!=="-"&&(i="-"+i),t="data"+i}}s=qg}return new s(r,t)}function NF(e){return"-"+e.toLowerCase()}function PF(e){return e.charAt(1).toUpperCase()}const RF=QS([JS,kF,t_,n_,r_],"html"),EF=QS([JS,SF,t_,n_,r_],"svg");function Fb(e){const t=[],n=String(e||"");let r=n.indexOf(","),s=0,o=!1;for(;!o;){r===-1&&(r=n.length,o=!0);const i=n.slice(s,r).trim();(i||!o)&&t.push(i),s=r+1,r=n.indexOf(",",s)}return t}const zb=/[#.]/g;function TF(e,t){const n=e||"",r={};let s=0,o,i;for(;s=48&&t<=57}function zF(e){const t=typeof e=="string"?e.charCodeAt(0):e;return t>=97&&t<=102||t>=65&&t<=70||t>=48&&t<=57}function VF(e){const t=typeof e=="string"?e.charCodeAt(0):e;return t>=97&&t<=122||t>=65&&t<=90}function Hb(e){return VF(e)||o_(e)}const Ub=document.createElement("i");function Wb(e){const t="&"+e+";";Ub.innerHTML=t;const n=Ub.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}const BF=["","Named character references must be terminated by a semicolon","Numeric character references must be terminated by a semicolon","Named character references cannot be empty","Numeric character references cannot be empty","Named character references must be known","Numeric character references cannot be disallowed","Numeric character references cannot be outside the permissible Unicode range"];function $F(e,t){const n={},r=typeof n.additional=="string"?n.additional.charCodeAt(0):n.additional,s=[];let o=0,i=-1,a="",l,u;n.position&&("start"in n.position||"indent"in n.position?(u=n.position.indent,l=n.position.start):l=n.position);let d=(l?l.line:0)||1,h=(l?l.column:0)||1,f=g(),p;for(o--;++o<=e.length;)if(p===10&&(h=(u?u[i]:0)||1),p=e.charCodeAt(o),p===38){const x=e.charCodeAt(o+1);if(x===9||x===10||x===12||x===32||x===38||x===60||Number.isNaN(x)||r&&x===r){a+=String.fromCharCode(p),h++;continue}const v=o+1;let b=v,k=v,w;if(x===35){k=++b;const D=e.charCodeAt(k);D===88||D===120?(w="hexadecimal",k=++b):w="decimal"}else w="named";let j="",N="",_="";const P=w==="named"?Hb:w==="decimal"?o_:zF;for(k--;++k<=e.length;){const D=e.charCodeAt(k);if(!P(D))break;_+=String.fromCharCode(D),w==="named"&&FF.includes(_)&&(j=_,N=Wb(_))}let A=e.charCodeAt(k)===59;if(A){k++;const D=w==="named"?Wb(_):!1;D&&(j=_,N=D)}let O=1+k-v,F="";if(!(!A&&n.nonTerminated===!1))if(!_)w!=="named"&&m(4,O);else if(w==="named"){if(A&&!N)m(5,1);else if(j!==_&&(k=b+j.length,O=1+k-b,A=!1),!A){const D=j?1:3;if(n.attribute){const W=e.charCodeAt(k);W===61?(m(D,O),N=""):Hb(W)?N="":m(D,O)}else m(D,O)}F=N}else{A||m(2,O);let D=Number.parseInt(_,w==="hexadecimal"?16:10);if(HF(D))m(7,O),F="�";else if(D in $b)m(6,O),F=$b[D];else{let W="";UF(D)&&m(6,O),D>65535&&(D-=65536,W+=String.fromCharCode(D>>>10|55296),D=56320|D&1023),F=W+String.fromCharCode(D)}}if(F){y(),f=g(),o=k-1,h+=k-v+1,s.push(F);const D=g();D.offset++,n.reference&&n.reference.call(n.referenceContext||void 0,F,{start:f,end:D},e.slice(v-1,k)),f=D}else _=e.slice(v-1,k),a+=_,h+=_.length,o=k-1}else p===10&&(d++,i++,h=0),Number.isNaN(p)?y():(a+=String.fromCharCode(p),h++);return s.join("");function g(){return{line:d,column:h,offset:o+((l?l.offset:0)||0)}}function m(x,v){let b;n.warning&&(b=g(),b.column+=v,b.offset+=v,n.warning.call(n.warningContext||void 0,BF[x],b,x))}function y(){a&&(s.push(a),n.text&&n.text.call(n.textContext||void 0,a,{start:f,end:g()}),a="")}}function HF(e){return e>=55296&&e<=57343||e>1114111}function UF(e){return e>=1&&e<=8||e===11||e>=13&&e<=31||e>=127&&e<=159||e>=64976&&e<=65007||(e&65535)===65535||(e&65535)===65534}var WF=0,Ll={},Ze={util:{type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++WF}),e.__id},clone:function e(t,n){n=n||{};var r,s;switch(Ze.util.type(t)){case"Object":if(s=Ze.util.objId(t),n[s])return n[s];r={},n[s]=r;for(var o in t)t.hasOwnProperty(o)&&(r[o]=e(t[o],n));return r;case"Array":return s=Ze.util.objId(t),n[s]?n[s]:(r=[],n[s]=r,t.forEach(function(i,a){r[a]=e(i,n)}),r);default:return t}}},languages:{plain:Ll,plaintext:Ll,text:Ll,txt:Ll,extend:function(e,t){var n=Ze.util.clone(Ze.languages[e]);for(var r in t)n[r]=t[r];return n},insertBefore:function(e,t,n,r){r=r||Ze.languages;var s=r[e],o={};for(var i in s)if(s.hasOwnProperty(i)){if(i==t)for(var a in n)n.hasOwnProperty(a)&&(o[a]=n[a]);n.hasOwnProperty(i)||(o[i]=s[i])}var l=r[e];return r[e]=o,Ze.languages.DFS(Ze.languages,function(u,d){d===l&&u!=e&&(this[u]=o)}),o},DFS:function e(t,n,r,s){s=s||{};var o=Ze.util.objId;for(var i in t)if(t.hasOwnProperty(i)){n.call(t,i,t[i],r||i);var a=t[i],l=Ze.util.type(a);l==="Object"&&!s[o(a)]?(s[o(a)]=!0,e(a,n,null,s)):l==="Array"&&!s[o(a)]&&(s[o(a)]=!0,e(a,n,i,s))}}},plugins:{},highlight:function(e,t,n){var r={code:e,grammar:t,language:n};if(Ze.hooks.run("before-tokenize",r),!r.grammar)throw new Error('The language "'+r.language+'" has no grammar.');return r.tokens=Ze.tokenize(r.code,r.grammar),Ze.hooks.run("after-tokenize",r),Ki.stringify(Ze.util.encode(r.tokens),r.language)},tokenize:function(e,t){var n=t.rest;if(n){for(var r in n)t[r]=n[r];delete t.rest}var s=new GF;return ic(s,s.head,e),i_(e,s,t,s.head,0),qF(s)},hooks:{all:{},add:function(e,t){var n=Ze.hooks.all;n[e]=n[e]||[],n[e].push(t)},run:function(e,t){var n=Ze.hooks.all[e];if(!(!n||!n.length))for(var r=0,s;s=n[r++];)s(t)}},Token:Ki};function Ki(e,t,n,r){this.type=e,this.content=t,this.alias=n,this.length=(r||"").length|0}function Gb(e,t,n,r){e.lastIndex=t;var s=e.exec(n);if(s&&r&&s[1]){var o=s[1].length;s.index+=o,s[0]=s[0].slice(o)}return s}function i_(e,t,n,r,s,o){for(var i in n)if(!(!n.hasOwnProperty(i)||!n[i])){var a=n[i];a=Array.isArray(a)?a:[a];for(var l=0;l=o.reach);x+=y.value.length,y=y.next){var v=y.value;if(t.length>e.length)return;if(!(v instanceof Ki)){var b=1,k;if(f){if(k=Gb(m,x,e,h),!k||k.index>=e.length)break;var _=k.index,w=k.index+k[0].length,j=x;for(j+=y.value.length;_>=j;)y=y.next,j+=y.value.length;if(j-=y.value.length,x=j,y.value instanceof Ki)continue;for(var N=y;N!==t.tail&&(jo.reach&&(o.reach=F);var D=y.prev;A&&(D=ic(t,D,A),x+=A.length),KF(t,D,b);var W=new Ki(i,d?Ze.tokenize(P,d):P,p,P);if(y=ic(t,D,W),O&&ic(t,y,O),b>1){var G={cause:i+","+l,reach:F};i_(e,t,n,y.prev,x,G),o&&G.reach>o.reach&&(o.reach=G.reach)}}}}}}function GF(){var e={value:null,prev:null,next:null},t={value:null,prev:e,next:null};e.next=t,this.head=e,this.tail=t,this.length=0}function ic(e,t,n){var r=t.next,s={value:n,prev:t,next:r};return t.next=s,r.prev=s,e.length++,s}function KF(e,t,n){for(var r=t.next,s=0;s>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp("(\\{)"+n),lookbehind:!0,alias:"constant"}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/};t.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:"important"},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:"function"},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:"function"}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:"variable",lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,inside:{environment:{pattern:RegExp("(^|[\\s;|&]|[<>]\\()"+n),lookbehind:!0,alias:"constant"}},alias:"variable",lookbehind:!0},parameter:{pattern:/(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,alias:"variable",lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:s},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:r}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:s},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:s.entity}}],environment:{pattern:RegExp("\\$?"+n),alias:"constant"},variable:s.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|sysctl|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,lookbehind:!0,alias:"class-name"},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:"important"},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:"important"}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}},r.inside=t.languages.bash;for(var o=["comment","function-name","for-or-select","assign-left","parameter","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"],i=s.variable[1].inside,a=0;a]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},e.languages.python["string-interpolation"].inside.interpolation.inside.rest=e.languages.python,e.languages.py=e.languages.python}const nz={'code[class*="language-"]':{background:"hsl(220, 13%, 18%)",color:"hsl(220, 14%, 71%)",textShadow:"0 1px rgba(0, 0, 0, 0.3)",fontFamily:'"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"2",OTabSize:"2",tabSize:"2",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none"},'pre[class*="language-"]':{background:"hsl(220, 13%, 18%)",color:"hsl(220, 14%, 71%)",textShadow:"0 1px rgba(0, 0, 0, 0.3)",fontFamily:'"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"2",OTabSize:"2",tabSize:"2",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none",padding:"1em",margin:"0.5em 0",overflow:"auto",borderRadius:"0.3em"},'code[class*="language-"]::-moz-selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'code[class*="language-"] *::-moz-selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'pre[class*="language-"] *::-moz-selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'code[class*="language-"]::selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'code[class*="language-"] *::selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'pre[class*="language-"] *::selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},':not(pre) > code[class*="language-"]':{padding:"0.2em 0.3em",borderRadius:"0.3em",whiteSpace:"normal"},comment:{color:"hsl(220, 10%, 40%)",fontStyle:"italic"},prolog:{color:"hsl(220, 10%, 40%)"},cdata:{color:"hsl(220, 10%, 40%)"},doctype:{color:"hsl(220, 14%, 71%)"},punctuation:{color:"hsl(220, 14%, 71%)"},entity:{color:"hsl(220, 14%, 71%)",cursor:"help"},"attr-name":{color:"hsl(29, 54%, 61%)"},"class-name":{color:"hsl(29, 54%, 61%)"},boolean:{color:"hsl(29, 54%, 61%)"},constant:{color:"hsl(29, 54%, 61%)"},number:{color:"hsl(29, 54%, 61%)"},atrule:{color:"hsl(29, 54%, 61%)"},keyword:{color:"hsl(286, 60%, 67%)"},property:{color:"hsl(355, 65%, 65%)"},tag:{color:"hsl(355, 65%, 65%)"},symbol:{color:"hsl(355, 65%, 65%)"},deleted:{color:"hsl(355, 65%, 65%)"},important:{color:"hsl(355, 65%, 65%)"},selector:{color:"hsl(95, 38%, 62%)"},string:{color:"hsl(95, 38%, 62%)"},char:{color:"hsl(95, 38%, 62%)"},builtin:{color:"hsl(95, 38%, 62%)"},inserted:{color:"hsl(95, 38%, 62%)"},regex:{color:"hsl(95, 38%, 62%)"},"attr-value":{color:"hsl(95, 38%, 62%)"},"attr-value > .token.punctuation":{color:"hsl(95, 38%, 62%)"},variable:{color:"hsl(207, 82%, 66%)"},operator:{color:"hsl(207, 82%, 66%)"},function:{color:"hsl(207, 82%, 66%)"},url:{color:"hsl(187, 47%, 55%)"},"attr-value > .token.punctuation.attr-equals":{color:"hsl(220, 14%, 71%)"},"special-attr > .token.attr-value > .token.value.css":{color:"hsl(220, 14%, 71%)"},".language-css .token.selector":{color:"hsl(355, 65%, 65%)"},".language-css .token.property":{color:"hsl(220, 14%, 71%)"},".language-css .token.function":{color:"hsl(187, 47%, 55%)"},".language-css .token.url > .token.function":{color:"hsl(187, 47%, 55%)"},".language-css .token.url > .token.string.url":{color:"hsl(95, 38%, 62%)"},".language-css .token.important":{color:"hsl(286, 60%, 67%)"},".language-css .token.atrule .token.rule":{color:"hsl(286, 60%, 67%)"},".language-javascript .token.operator":{color:"hsl(286, 60%, 67%)"},".language-javascript .token.template-string > .token.interpolation > .token.interpolation-punctuation.punctuation":{color:"hsl(5, 48%, 51%)"},".language-json .token.operator":{color:"hsl(220, 14%, 71%)"},".language-json .token.null.keyword":{color:"hsl(29, 54%, 61%)"},".language-markdown .token.url":{color:"hsl(220, 14%, 71%)"},".language-markdown .token.url > .token.operator":{color:"hsl(220, 14%, 71%)"},".language-markdown .token.url-reference.url > .token.string":{color:"hsl(220, 14%, 71%)"},".language-markdown .token.url > .token.content":{color:"hsl(207, 82%, 66%)"},".language-markdown .token.url > .token.url":{color:"hsl(187, 47%, 55%)"},".language-markdown .token.url-reference.url":{color:"hsl(187, 47%, 55%)"},".language-markdown .token.blockquote.punctuation":{color:"hsl(220, 10%, 40%)",fontStyle:"italic"},".language-markdown .token.hr.punctuation":{color:"hsl(220, 10%, 40%)",fontStyle:"italic"},".language-markdown .token.code-snippet":{color:"hsl(95, 38%, 62%)"},".language-markdown .token.bold .token.content":{color:"hsl(29, 54%, 61%)"},".language-markdown .token.italic .token.content":{color:"hsl(286, 60%, 67%)"},".language-markdown .token.strike .token.content":{color:"hsl(355, 65%, 65%)"},".language-markdown .token.strike .token.punctuation":{color:"hsl(355, 65%, 65%)"},".language-markdown .token.list.punctuation":{color:"hsl(355, 65%, 65%)"},".language-markdown .token.title.important > .token.punctuation":{color:"hsl(355, 65%, 65%)"},bold:{fontWeight:"bold"},italic:{fontStyle:"italic"},namespace:{Opacity:"0.8"},"token.tab:not(:empty):before":{color:"hsla(220, 14%, 71%, 0.15)",textShadow:"none"},"token.cr:before":{color:"hsla(220, 14%, 71%, 0.15)",textShadow:"none"},"token.lf:before":{color:"hsla(220, 14%, 71%, 0.15)",textShadow:"none"},"token.space:before":{color:"hsla(220, 14%, 71%, 0.15)",textShadow:"none"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item":{marginRight:"0.4em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 9%, 55%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 9%, 55%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 9%, 55%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:hover":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:focus":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:hover":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:focus":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:hover":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:focus":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},".line-highlight.line-highlight":{background:"hsla(220, 100%, 80%, 0.04)"},".line-highlight.line-highlight:before":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 14%, 71%)",padding:"0.1em 0.6em",borderRadius:"0.3em",boxShadow:"0 2px 0 0 rgba(0, 0, 0, 0.2)"},".line-highlight.line-highlight[data-end]:after":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 14%, 71%)",padding:"0.1em 0.6em",borderRadius:"0.3em",boxShadow:"0 2px 0 0 rgba(0, 0, 0, 0.2)"},"pre[id].linkable-line-numbers.linkable-line-numbers span.line-numbers-rows > span:hover:before":{backgroundColor:"hsla(220, 100%, 80%, 0.04)"},".line-numbers.line-numbers .line-numbers-rows":{borderRightColor:"hsla(220, 14%, 71%, 0.15)"},".command-line .command-line-prompt":{borderRightColor:"hsla(220, 14%, 71%, 0.15)"},".line-numbers .line-numbers-rows > span:before":{color:"hsl(220, 14%, 45%)"},".command-line .command-line-prompt > span:before":{color:"hsl(220, 14%, 45%)"},".rainbow-braces .token.token.punctuation.brace-level-1":{color:"hsl(355, 65%, 65%)"},".rainbow-braces .token.token.punctuation.brace-level-5":{color:"hsl(355, 65%, 65%)"},".rainbow-braces .token.token.punctuation.brace-level-9":{color:"hsl(355, 65%, 65%)"},".rainbow-braces .token.token.punctuation.brace-level-2":{color:"hsl(95, 38%, 62%)"},".rainbow-braces .token.token.punctuation.brace-level-6":{color:"hsl(95, 38%, 62%)"},".rainbow-braces .token.token.punctuation.brace-level-10":{color:"hsl(95, 38%, 62%)"},".rainbow-braces .token.token.punctuation.brace-level-3":{color:"hsl(207, 82%, 66%)"},".rainbow-braces .token.token.punctuation.brace-level-7":{color:"hsl(207, 82%, 66%)"},".rainbow-braces .token.token.punctuation.brace-level-11":{color:"hsl(207, 82%, 66%)"},".rainbow-braces .token.token.punctuation.brace-level-4":{color:"hsl(286, 60%, 67%)"},".rainbow-braces .token.token.punctuation.brace-level-8":{color:"hsl(286, 60%, 67%)"},".rainbow-braces .token.token.punctuation.brace-level-12":{color:"hsl(286, 60%, 67%)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)":{backgroundColor:"hsla(353, 100%, 66%, 0.15)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)":{backgroundColor:"hsla(353, 100%, 66%, 0.15)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix) *::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix) *::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)":{backgroundColor:"hsla(137, 100%, 55%, 0.15)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)":{backgroundColor:"hsla(137, 100%, 55%, 0.15)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix) *::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix) *::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},".prism-previewer.prism-previewer:before":{borderColor:"hsl(224, 13%, 17%)"},".prism-previewer-gradient.prism-previewer-gradient div":{borderColor:"hsl(224, 13%, 17%)",borderRadius:"0.3em"},".prism-previewer-color.prism-previewer-color:before":{borderRadius:"0.3em"},".prism-previewer-easing.prism-previewer-easing:before":{borderRadius:"0.3em"},".prism-previewer.prism-previewer:after":{borderTopColor:"hsl(224, 13%, 17%)"},".prism-previewer-flipped.prism-previewer-flipped.after":{borderBottomColor:"hsl(224, 13%, 17%)"},".prism-previewer-angle.prism-previewer-angle:before":{background:"hsl(219, 13%, 22%)"},".prism-previewer-time.prism-previewer-time:before":{background:"hsl(219, 13%, 22%)"},".prism-previewer-easing.prism-previewer-easing":{background:"hsl(219, 13%, 22%)"},".prism-previewer-angle.prism-previewer-angle circle":{stroke:"hsl(220, 14%, 71%)",strokeOpacity:"1"},".prism-previewer-time.prism-previewer-time circle":{stroke:"hsl(220, 14%, 71%)",strokeOpacity:"1"},".prism-previewer-easing.prism-previewer-easing circle":{stroke:"hsl(220, 14%, 71%)",fill:"transparent"},".prism-previewer-easing.prism-previewer-easing path":{stroke:"hsl(220, 14%, 71%)"},".prism-previewer-easing.prism-previewer-easing line":{stroke:"hsl(220, 14%, 71%)"}},rz={'code[class*="language-"]':{background:"hsl(230, 1%, 98%)",color:"hsl(230, 8%, 24%)",fontFamily:'"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"2",OTabSize:"2",tabSize:"2",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none"},'pre[class*="language-"]':{background:"hsl(230, 1%, 98%)",color:"hsl(230, 8%, 24%)",fontFamily:'"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"2",OTabSize:"2",tabSize:"2",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none",padding:"1em",margin:"0.5em 0",overflow:"auto",borderRadius:"0.3em"},'code[class*="language-"]::-moz-selection':{background:"hsl(230, 1%, 90%)",color:"inherit"},'code[class*="language-"] *::-moz-selection':{background:"hsl(230, 1%, 90%)",color:"inherit"},'pre[class*="language-"] *::-moz-selection':{background:"hsl(230, 1%, 90%)",color:"inherit"},'code[class*="language-"]::selection':{background:"hsl(230, 1%, 90%)",color:"inherit"},'code[class*="language-"] *::selection':{background:"hsl(230, 1%, 90%)",color:"inherit"},'pre[class*="language-"] *::selection':{background:"hsl(230, 1%, 90%)",color:"inherit"},':not(pre) > code[class*="language-"]':{padding:"0.2em 0.3em",borderRadius:"0.3em",whiteSpace:"normal"},comment:{color:"hsl(230, 4%, 64%)",fontStyle:"italic"},prolog:{color:"hsl(230, 4%, 64%)"},cdata:{color:"hsl(230, 4%, 64%)"},doctype:{color:"hsl(230, 8%, 24%)"},punctuation:{color:"hsl(230, 8%, 24%)"},entity:{color:"hsl(230, 8%, 24%)",cursor:"help"},"attr-name":{color:"hsl(35, 99%, 36%)"},"class-name":{color:"hsl(35, 99%, 36%)"},boolean:{color:"hsl(35, 99%, 36%)"},constant:{color:"hsl(35, 99%, 36%)"},number:{color:"hsl(35, 99%, 36%)"},atrule:{color:"hsl(35, 99%, 36%)"},keyword:{color:"hsl(301, 63%, 40%)"},property:{color:"hsl(5, 74%, 59%)"},tag:{color:"hsl(5, 74%, 59%)"},symbol:{color:"hsl(5, 74%, 59%)"},deleted:{color:"hsl(5, 74%, 59%)"},important:{color:"hsl(5, 74%, 59%)"},selector:{color:"hsl(119, 34%, 47%)"},string:{color:"hsl(119, 34%, 47%)"},char:{color:"hsl(119, 34%, 47%)"},builtin:{color:"hsl(119, 34%, 47%)"},inserted:{color:"hsl(119, 34%, 47%)"},regex:{color:"hsl(119, 34%, 47%)"},"attr-value":{color:"hsl(119, 34%, 47%)"},"attr-value > .token.punctuation":{color:"hsl(119, 34%, 47%)"},variable:{color:"hsl(221, 87%, 60%)"},operator:{color:"hsl(221, 87%, 60%)"},function:{color:"hsl(221, 87%, 60%)"},url:{color:"hsl(198, 99%, 37%)"},"attr-value > .token.punctuation.attr-equals":{color:"hsl(230, 8%, 24%)"},"special-attr > .token.attr-value > .token.value.css":{color:"hsl(230, 8%, 24%)"},".language-css .token.selector":{color:"hsl(5, 74%, 59%)"},".language-css .token.property":{color:"hsl(230, 8%, 24%)"},".language-css .token.function":{color:"hsl(198, 99%, 37%)"},".language-css .token.url > .token.function":{color:"hsl(198, 99%, 37%)"},".language-css .token.url > .token.string.url":{color:"hsl(119, 34%, 47%)"},".language-css .token.important":{color:"hsl(301, 63%, 40%)"},".language-css .token.atrule .token.rule":{color:"hsl(301, 63%, 40%)"},".language-javascript .token.operator":{color:"hsl(301, 63%, 40%)"},".language-javascript .token.template-string > .token.interpolation > .token.interpolation-punctuation.punctuation":{color:"hsl(344, 84%, 43%)"},".language-json .token.operator":{color:"hsl(230, 8%, 24%)"},".language-json .token.null.keyword":{color:"hsl(35, 99%, 36%)"},".language-markdown .token.url":{color:"hsl(230, 8%, 24%)"},".language-markdown .token.url > .token.operator":{color:"hsl(230, 8%, 24%)"},".language-markdown .token.url-reference.url > .token.string":{color:"hsl(230, 8%, 24%)"},".language-markdown .token.url > .token.content":{color:"hsl(221, 87%, 60%)"},".language-markdown .token.url > .token.url":{color:"hsl(198, 99%, 37%)"},".language-markdown .token.url-reference.url":{color:"hsl(198, 99%, 37%)"},".language-markdown .token.blockquote.punctuation":{color:"hsl(230, 4%, 64%)",fontStyle:"italic"},".language-markdown .token.hr.punctuation":{color:"hsl(230, 4%, 64%)",fontStyle:"italic"},".language-markdown .token.code-snippet":{color:"hsl(119, 34%, 47%)"},".language-markdown .token.bold .token.content":{color:"hsl(35, 99%, 36%)"},".language-markdown .token.italic .token.content":{color:"hsl(301, 63%, 40%)"},".language-markdown .token.strike .token.content":{color:"hsl(5, 74%, 59%)"},".language-markdown .token.strike .token.punctuation":{color:"hsl(5, 74%, 59%)"},".language-markdown .token.list.punctuation":{color:"hsl(5, 74%, 59%)"},".language-markdown .token.title.important > .token.punctuation":{color:"hsl(5, 74%, 59%)"},bold:{fontWeight:"bold"},italic:{fontStyle:"italic"},namespace:{Opacity:"0.8"},"token.tab:not(:empty):before":{color:"hsla(230, 8%, 24%, 0.2)"},"token.cr:before":{color:"hsla(230, 8%, 24%, 0.2)"},"token.lf:before":{color:"hsla(230, 8%, 24%, 0.2)"},"token.space:before":{color:"hsla(230, 8%, 24%, 0.2)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item":{marginRight:"0.4em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button":{background:"hsl(230, 1%, 90%)",color:"hsl(230, 6%, 44%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a":{background:"hsl(230, 1%, 90%)",color:"hsl(230, 6%, 44%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span":{background:"hsl(230, 1%, 90%)",color:"hsl(230, 6%, 44%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:hover":{background:"hsl(230, 1%, 78%)",color:"hsl(230, 8%, 24%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:focus":{background:"hsl(230, 1%, 78%)",color:"hsl(230, 8%, 24%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:hover":{background:"hsl(230, 1%, 78%)",color:"hsl(230, 8%, 24%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:focus":{background:"hsl(230, 1%, 78%)",color:"hsl(230, 8%, 24%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:hover":{background:"hsl(230, 1%, 78%)",color:"hsl(230, 8%, 24%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:focus":{background:"hsl(230, 1%, 78%)",color:"hsl(230, 8%, 24%)"},".line-highlight.line-highlight":{background:"hsla(230, 8%, 24%, 0.05)"},".line-highlight.line-highlight:before":{background:"hsl(230, 1%, 90%)",color:"hsl(230, 8%, 24%)",padding:"0.1em 0.6em",borderRadius:"0.3em",boxShadow:"0 2px 0 0 rgba(0, 0, 0, 0.2)"},".line-highlight.line-highlight[data-end]:after":{background:"hsl(230, 1%, 90%)",color:"hsl(230, 8%, 24%)",padding:"0.1em 0.6em",borderRadius:"0.3em",boxShadow:"0 2px 0 0 rgba(0, 0, 0, 0.2)"},"pre[id].linkable-line-numbers.linkable-line-numbers span.line-numbers-rows > span:hover:before":{backgroundColor:"hsla(230, 8%, 24%, 0.05)"},".line-numbers.line-numbers .line-numbers-rows":{borderRightColor:"hsla(230, 8%, 24%, 0.2)"},".command-line .command-line-prompt":{borderRightColor:"hsla(230, 8%, 24%, 0.2)"},".line-numbers .line-numbers-rows > span:before":{color:"hsl(230, 1%, 62%)"},".command-line .command-line-prompt > span:before":{color:"hsl(230, 1%, 62%)"},".rainbow-braces .token.token.punctuation.brace-level-1":{color:"hsl(5, 74%, 59%)"},".rainbow-braces .token.token.punctuation.brace-level-5":{color:"hsl(5, 74%, 59%)"},".rainbow-braces .token.token.punctuation.brace-level-9":{color:"hsl(5, 74%, 59%)"},".rainbow-braces .token.token.punctuation.brace-level-2":{color:"hsl(119, 34%, 47%)"},".rainbow-braces .token.token.punctuation.brace-level-6":{color:"hsl(119, 34%, 47%)"},".rainbow-braces .token.token.punctuation.brace-level-10":{color:"hsl(119, 34%, 47%)"},".rainbow-braces .token.token.punctuation.brace-level-3":{color:"hsl(221, 87%, 60%)"},".rainbow-braces .token.token.punctuation.brace-level-7":{color:"hsl(221, 87%, 60%)"},".rainbow-braces .token.token.punctuation.brace-level-11":{color:"hsl(221, 87%, 60%)"},".rainbow-braces .token.token.punctuation.brace-level-4":{color:"hsl(301, 63%, 40%)"},".rainbow-braces .token.token.punctuation.brace-level-8":{color:"hsl(301, 63%, 40%)"},".rainbow-braces .token.token.punctuation.brace-level-12":{color:"hsl(301, 63%, 40%)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)":{backgroundColor:"hsla(353, 100%, 66%, 0.15)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)":{backgroundColor:"hsla(353, 100%, 66%, 0.15)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix) *::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix) *::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)":{backgroundColor:"hsla(137, 100%, 55%, 0.15)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)":{backgroundColor:"hsla(137, 100%, 55%, 0.15)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix) *::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix) *::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},".prism-previewer.prism-previewer:before":{borderColor:"hsl(0, 0, 95%)"},".prism-previewer-gradient.prism-previewer-gradient div":{borderColor:"hsl(0, 0, 95%)",borderRadius:"0.3em"},".prism-previewer-color.prism-previewer-color:before":{borderRadius:"0.3em"},".prism-previewer-easing.prism-previewer-easing:before":{borderRadius:"0.3em"},".prism-previewer.prism-previewer:after":{borderTopColor:"hsl(0, 0, 95%)"},".prism-previewer-flipped.prism-previewer-flipped.after":{borderBottomColor:"hsl(0, 0, 95%)"},".prism-previewer-angle.prism-previewer-angle:before":{background:"hsl(0, 0%, 100%)"},".prism-previewer-time.prism-previewer-time:before":{background:"hsl(0, 0%, 100%)"},".prism-previewer-easing.prism-previewer-easing":{background:"hsl(0, 0%, 100%)"},".prism-previewer-angle.prism-previewer-angle circle":{stroke:"hsl(230, 8%, 24%)",strokeOpacity:"1"},".prism-previewer-time.prism-previewer-time circle":{stroke:"hsl(230, 8%, 24%)",strokeOpacity:"1"},".prism-previewer-easing.prism-previewer-easing circle":{stroke:"hsl(230, 8%, 24%)",fill:"transparent"},".prism-previewer-easing.prism-previewer-easing path":{stroke:"hsl(230, 8%, 24%)"},".prism-previewer-easing.prism-previewer-easing line":{stroke:"hsl(230, 8%, 24%)"}};Jo.registerLanguage("python",Qg);Jo.registerLanguage("json",Xg);Jo.registerLanguage("bash",Yg);function sz(){const[e,t]=S.useState(()=>typeof document<"u"&&document.documentElement.classList.contains("dark")?"dark":"light");return S.useEffect(()=>{const n=document.documentElement,r=()=>t(n.classList.contains("dark")?"dark":"light");r();const s=new MutationObserver(r);return s.observe(n,{attributes:!0,attributeFilter:["class"]}),()=>s.disconnect()},[]),e}function Ne({code:e,language:t="python",label:n}){const r=sz(),[s,o]=S.useState(!1),i=async()=>{try{await navigator.clipboard.writeText(e),o(!0),setTimeout(()=>o(!1),2e3)}catch{}},a=n??t.toUpperCase(),l=r==="dark"?nz:rz;return c.jsxs("div",{className:"group relative my-4 rounded-2xl border border-gray-200 dark:border-white/10 bg-gray-50 dark:bg-white/5 overflow-hidden",children:[c.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-gray-200 dark:border-white/10 bg-white/50 dark:bg-black/30",children:[c.jsx("span",{className:"text-xs font-mono font-medium text-gray-500 dark:text-gray-400 tracking-wide",children:a}),c.jsx("button",{onClick:i,className:"inline-flex items-center gap-1.5 px-2 py-1 rounded-md text-xs font-medium text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-white/10 transition-colors","aria-label":s?"Copied":"Copy code",children:s?c.jsxs(c.Fragment,{children:[c.jsx(vu,{size:14,className:"text-primary-600 dark:text-primary-400"}),"Copied"]}):c.jsxs(c.Fragment,{children:[c.jsx(Y1,{size:14}),"Copy"]})})]}),c.jsx(Jo,{language:t,style:l,customStyle:{margin:0,padding:"1rem 1.25rem",background:"transparent",fontSize:"0.875rem",lineHeight:"1.6"},codeTagProps:{style:{fontFamily:'ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace'}},children:e})]})}const Kb=[{id:"overview",label:"Overview"},{id:"language-support",label:"Language Support"},{id:"authentication",label:"Authentication",part:"Part 1"},{id:"translation",label:"Translation",part:"Part 2"},{id:"speech-to-text",label:"Speech-to-Text",part:"Part 3"},{id:"language-detection",label:"Language Detection",part:"Part 4"},{id:"text-to-speech",label:"Text-to-Speech",part:"Part 5"},{id:"conversational-ai",label:"Conversational AI",part:"Part 6"},{id:"file-upload",label:"File Upload",part:"Part 7"},{id:"resources",label:"Resources"}],oz=[{name:"English",code:"eng"},{name:"Acholi",code:"ach"},{name:"Ateso",code:"teo"},{name:"Luganda",code:"lug"},{name:"Lugbara",code:"lgg"},{name:"Runyankole",code:"nyn"},{name:"Swahili",code:"swa"}],iz=[{name:"Acholi",code:"ach",speech:!0,transcription:!0,chat:!0},{name:"Afrikaans",code:"afr",speech:!0,transcription:!0,chat:!1},{name:"Akan",code:"aka",speech:!1,transcription:!0,chat:!1},{name:"Alur",code:"alz",speech:!1,transcription:!1,chat:!0},{name:"Amharic",code:"amh",speech:!1,transcription:!0,chat:!1},{name:"Aringa",code:"luc",speech:!1,transcription:!1,chat:!0},{name:"Ateso",code:"teo",speech:!0,transcription:!0,chat:!0},{name:"Bambara",code:"bam",speech:!1,transcription:!0,chat:!1},{name:"Bari",code:"bfa",speech:!1,transcription:!1,chat:!0},{name:"Bemba",code:"bem",speech:!1,transcription:!0,chat:!1},{name:"Berber",code:"ber",speech:!1,transcription:!0,chat:!1},{name:"Chichewa",code:"nya",speech:!1,transcription:!0,chat:!1},{name:"Dagaare",code:"dga",speech:!1,transcription:!0,chat:!1},{name:"Dagbani",code:"dag",speech:!1,transcription:!0,chat:!1},{name:"English",code:"eng",speech:!0,transcription:!0,chat:!0},{name:"Ewe",code:"ewe",speech:!0,transcription:!0,chat:!1},{name:"French",code:"fra",speech:!1,transcription:!0,chat:!1},{name:"Fulah / Fulani",code:"ful",speech:!0,transcription:!0,chat:!1},{name:"Hausa",code:"hau",speech:!0,transcription:!0,chat:!1},{name:"Igbo",code:"ibo",speech:!0,transcription:!0,chat:!1},{name:"Ikposo",code:"kpo",speech:!1,transcription:!0,chat:!1},{name:"Jopadhola",code:"adh",speech:!1,transcription:!1,chat:!0},{name:"Kabyle",code:"kab",speech:!1,transcription:!0,chat:!1},{name:"Kakwa",code:"keo",speech:!1,transcription:!1,chat:!0},{name:"Kalenjin",code:"kln",speech:!1,transcription:!0,chat:!1},{name:"Kanuri",code:"kau",speech:!1,transcription:!0,chat:!1},{name:"Karamojong",code:"kdj",speech:!1,transcription:!1,chat:!0},{name:"Kikuyu",code:"kik",speech:!0,transcription:!0,chat:!1},{name:"Kinyarwanda",code:"kin",speech:!0,transcription:!0,chat:!0},{name:"Kumam",code:"kdi",speech:!1,transcription:!1,chat:!0},{name:"Kupsabiny",code:"kpz",speech:!1,transcription:!1,chat:!0},{name:"Kwamba",code:"rwm",speech:!1,transcription:!0,chat:!0},{name:"Lango",code:"laj",speech:!1,transcription:!1,chat:!0},{name:"Lendu",code:"led",speech:!1,transcription:!0,chat:!1},{name:"Lingala",code:"lin",speech:!0,transcription:!0,chat:!1},{name:"Lubwisi",code:"tlj",speech:!1,transcription:!1,chat:!0},{name:"Lugbara",code:"lgg",speech:!0,transcription:!0,chat:!0,ttsVoiceless:!0},{name:"Lugungu",code:"rub",speech:!1,transcription:!1,chat:!0},{name:"Lugwere",code:"gwr",speech:!1,transcription:!1,chat:!0},{name:"Luganda",code:"lug",speech:!0,transcription:!0,chat:!0},{name:"Luhya",code:"luy",speech:!1,transcription:!0,chat:!1},{name:"Lumasaba",code:"myx",speech:!1,transcription:!0,chat:!0},{name:"Lunyole",code:"nuj",speech:!1,transcription:!1,chat:!0},{name:"Luo (Dholuo)",code:"luo",speech:!0,transcription:!0,chat:!1},{name:"Lusoga",code:"xog",speech:!1,transcription:!0,chat:!0},{name:"Ma'di",code:"mhi",speech:!1,transcription:!1,chat:!0},{name:"Malagasy",code:"mlg",speech:!1,transcription:!0,chat:!1},{name:"Ndebele",code:"nbl",speech:!1,transcription:!0,chat:!1},{name:"Nigerian Pidgin",code:"pcm",speech:!1,transcription:!0,chat:!1},{name:"Oromo",code:"orm",speech:!1,transcription:!0,chat:!1},{name:"Pokot",code:"pok",speech:!1,transcription:!1,chat:!0},{name:"Rukiga",code:"cgg",speech:!1,transcription:!0,chat:!0},{name:"Rukonjo",code:"koo",speech:!1,transcription:!0,chat:!0},{name:"Runyankole",code:"nyn",speech:!0,transcription:!0,chat:!0},{name:"Runyoro",code:"nyo",speech:!1,transcription:!1,chat:!0},{name:"Ruruuli",code:"ruc",speech:!1,transcription:!0,chat:!0},{name:"Rutooro",code:"ttj",speech:!1,transcription:!0,chat:!0},{name:"Samia",code:"lsm",speech:!1,transcription:!1,chat:!0},{name:"Sesotho / Sotho",code:"sot",speech:!0,transcription:!0,chat:!1,ttsVoiceless:!0},{name:"Setswana / Tswana",code:"tsn",speech:!0,transcription:!0,chat:!1,ttsVoiceless:!0},{name:"Shona",code:"sna",speech:!1,transcription:!0,chat:!1},{name:"Somali",code:"som",speech:!1,transcription:!0,chat:!1},{name:"Swahili",code:"swa",speech:!0,transcription:!0,chat:!0},{name:"Thur",code:"lth",speech:!1,transcription:!0,chat:!1},{name:"Wolof",code:"wol",speech:!1,transcription:!0,chat:!1},{name:"Xhosa",code:"xho",speech:!0,transcription:!0,chat:!1},{name:"Yoruba",code:"yor",speech:!0,transcription:!0,chat:!1},{name:"Zulu",code:"zul",speech:!1,transcription:!0,chat:!1}],az=[{code:"ach",name:"Acholi"},{code:"afr",name:"Afrikaans"},{code:"aka",name:"Akan"},{code:"amh",name:"Amharic"},{code:"bam",name:"Bambara"},{code:"bem",name:"Bemba"},{code:"ber",name:"Berber"},{code:"cgg",name:"Rukiga"},{code:"dag",name:"Dagbani"},{code:"dga",name:"Dagaare"},{code:"eng",name:"English"},{code:"ewe",name:"Ewe"},{code:"fra",name:"French"},{code:"ful",name:"Fulani"},{code:"hau",name:"Hausa"},{code:"ibo",name:"Igbo"},{code:"kab",name:"Kabyle"},{code:"kau",name:"Kanuri"},{code:"kik",name:"Kikuyu"},{code:"kin",name:"Kinyarwanda"},{code:"kln",name:"Kalenjin"},{code:"koo",name:"Rukonjo"},{code:"kpo",name:"Ikposo"},{code:"led",name:"Lendu"},{code:"lgg",name:"Lugbara"},{code:"lin",name:"Lingala"},{code:"lth",name:"Thur"},{code:"lug",name:"Luganda"},{code:"luo",name:"Luo"},{code:"luy",name:"Luhya"},{code:"mlg",name:"Malagasy"},{code:"myx",name:"Lumasaba"},{code:"nbl",name:"Ndebele"},{code:"nya",name:"Chichewa"},{code:"nyn",name:"Runyankole"},{code:"orm",name:"Oromo"},{code:"pcm",name:"Nigerian Pidgin"},{code:"ruc",name:"Ruruuli"},{code:"rwm",name:"Kwamba"},{code:"sna",name:"Shona"},{code:"som",name:"Somali"},{code:"sot",name:"Sotho"},{code:"swa",name:"Swahili"},{code:"teo",name:"Ateso"},{code:"tsn",name:"Tswana"},{code:"ttj",name:"Rutooro"},{code:"wol",name:"Wolof"},{code:"xho",name:"Xhosa"},{code:"xog",name:"Lusoga"},{code:"yor",name:"Yoruba"},{code:"zul",name:"Zulu"}],lz=[{config:"ach",language:"Acholi",iso:"—",region:"Uganda, South Sudan",speakers:["salt_ach_0001","waxal_ach_0001","waxal_ach_0005","waxal_ach_0006","waxal_ach_0008"]},{config:"afr",language:"Afrikaans",iso:"af",region:"South Africa, Namibia",speakers:["slr32_afr_0009"]},{config:"eng",language:"English",iso:"en",region:"(control language)",speakers:["salt_eng_0001","salt_eng_0002","salt_eng_0003"]},{config:"ewe",language:"Ewe",iso:"ee",region:"Ghana, Togo",speakers:["slr129_ewe_0001"]},{config:"ful",language:"Fulah",iso:"ff",region:"West Africa (Sahel)",speakers:["waxal_ful_0003","waxal_ful_0004","waxal_ful_0006"]},{config:"hau",language:"Hausa",iso:"ha",region:"Nigeria, Niger, Chad",speakers:["waxal_hau_0004","waxal_hau_0006","waxal_hau_0007","waxal_hau_0008"]},{config:"ibo",language:"Igbo",iso:"ig",region:"Nigeria",speakers:["waxal_ibo_0003","waxal_ibo_0005","waxal_ibo_0008"]},{config:"kik",language:"Kikuyu",iso:"ki",region:"Kenya",speakers:["waxal_kik_0003","waxal_kik_0004"]},{config:"kin",language:"Kinyarwanda",iso:"rw",region:"Rwanda",speakers:["bateesa_kin_0001"]},{config:"lgg",language:"Lugbara",iso:"—",region:"Uganda, DRC",speakers:[]},{config:"lin",language:"Lingala",iso:"ln",region:"DRC, Republic of Congo",speakers:["slr129_lin_0001"]},{config:"lug",language:"Luganda",iso:"lg",region:"Uganda",speakers:["salt_lug_0001","waxal_lug_0002","waxal_lug_0003","waxal_lug_0004","waxal_lug_0005","waxal_lug_0006","waxal_lug_0007","waxal_lug_0008"]},{config:"luo",language:"Luo (Dholuo)",iso:"—",region:"Kenya, Tanzania",speakers:["waxal_luo_0001","waxal_luo_0002","waxal_luo_0003","waxal_luo_0004"]},{config:"nyn",language:"Runyankole",iso:"—",region:"Uganda",speakers:["salt_nyn_0001","waxal_nyn_0003","waxal_nyn_0004","waxal_nyn_0007","waxal_nyn_0008"]},{config:"sot",language:"Sesotho",iso:"st",region:"Lesotho, South Africa",speakers:[]},{config:"swa",language:"Swahili",iso:"sw",region:"East Africa",speakers:["waxal_swa_0006","waxal_swa_0007"]},{config:"teo",language:"Ateso",iso:"—",region:"Uganda, Kenya",speakers:["salt_teo_0001"]},{config:"tsn",language:"Setswana",iso:"tn",region:"Botswana, South Africa",speakers:[]},{config:"xho",language:"Xhosa",iso:"xh",region:"South Africa",speakers:["slr32_xho_0012"]},{config:"yor",language:"Yoruba",iso:"yo",region:"Nigeria, Benin",speakers:["waxal_yor_0002","waxal_yor_0006","waxal_yor_0008"]}],cz=[{name:"acholi_female",id:241,description:"Acholi (female)"},{name:"ateso_female",id:242,description:"Ateso (female)"},{name:"runyankore_female",id:243,description:"Runyankore (female)"},{name:"lugbara_female",id:245,description:"Lugbara (female)"},{name:"swahili_male",id:246,description:"Swahili (male)"},{name:"luganda_female",id:248,description:"Luganda (female)"}],uz=[{mode:"url",description:"Generate audio, upload to GCP, return a signed URL (valid ~30 minutes) — default"},{mode:"stream",description:"Stream raw audio chunks directly"},{mode:"both",description:"Stream audio and return a final signed URL"}],dz=["Temporary signed URLs (valid for 30 minutes)","Direct upload to Google Cloud Storage","Path traversal protection","Support for multiple content types"],hz=`import requests url = "https://api.sunbird.ai/auth/register" data = { @@ -556,46 +556,60 @@ files = { "audio": ("recording.wav", open(audio_file_path, "rb"), "audio/wav"), } data = { - "language": "lug", # required: 3-letter code or full name (e.g. "Luganda") - "platform": "modal", # "modal" (default, Whisper) or "runpod" + "language": "lug", # required: ISO 639-3 code, one of the 51 supported } response = requests.post(url, headers=headers, files=files, data=data) result = response.json() -print(f"Transcription: {result['audio_transcription']}")`,bz=`files = { - "audio": ("recording.mp3", open("/path/to/audio_file.mp3", "rb"), "audio/mpeg"), -} -data = { - "language": "lug", - "platform": "runpod", - "adapter": "lug", # optional; defaults to language - "whisper": True, # RunPod only - "recognise_speakers": False, # RunPod only — speaker diarization +print(f"Transcription: {result['audio_transcription']}")`,bz=`data = { + "language": "ach", + "timestamps": True, # also return per-segment start/end times } response = requests.post(url, headers=headers, files=files, data=data) -print(response.json())`,vz=`{ +result = response.json() + +print(result["audio_transcription"]) +for segment in result["segments"]: + print(f"[{segment['start']:7.2f} -> {segment['end']:7.2f}] {segment['text']}")`,vz=`{ "audio_transcription": "Ekibiina ekiddukanya ...", "language": "lug", - "audio_url": "https://storage.googleapis.com/.../audio.wav?...", + "audio_url": "gs://.../audio.wav", "audio_transcription_id": 123, - "diarization_output": null, - "formatted_diarization_output": null, + "duration_seconds": 12.4, + "segments": null, + "diarization_output": {}, + "formatted_diarization_output": "", "was_audio_trimmed": false, "original_duration_minutes": null -}`,wz=`SALT_LANGUAGE_IDS_WHISPER = { - 'eng': "English (Ugandan)", - 'swa': "Swahili", - 'ach': "Acholi", - 'lgg': "Lugbara", - 'lug': "Luganda", - 'nyn': "Runyankole", - 'teo': "Ateso", - 'xog': "Lusoga", - 'ttj': "Rutooro", - 'kin': "Kinyarwanda", - 'myx': "Lumasaba", -}`,kz=`import os +}`,wz=`{ + "audio_transcription": "Gyebaleko ssebo", + "language": "ach", + "duration_seconds": 2.25, + "segments": [ + {"start": 0.0, "end": 1.0, "text": "Gyebaleko"}, + {"start": 1.0, "end": 2.25, "text": "ssebo"} + ] +}`,kz=`SALT_LANGUAGE_IDS_WHISPER = { + 'ach': "Acholi", 'kab': "Kabyle", 'nyn': "Runyankole", + 'afr': "Afrikaans", 'kau': "Kanuri", 'orm': "Oromo", + 'aka': "Akan", 'kik': "Kikuyu", 'pcm': "Nigerian Pidgin", + 'amh': "Amharic", 'kin': "Kinyarwanda", 'ruc': "Ruruuli", + 'bam': "Bambara", 'kln': "Kalenjin", 'rwm': "Kwamba", + 'bem': "Bemba", 'koo': "Rukonjo", 'sna': "Shona", + 'ber': "Berber", 'kpo': "Ikposo", 'som': "Somali", + 'cgg': "Rukiga", 'led': "Lendu", 'sot': "Sotho", + 'dag': "Dagbani", 'lgg': "Lugbara", 'swa': "Swahili", + 'dga': "Dagaare", 'lin': "Lingala", 'teo': "Ateso", + 'eng': "English", 'lth': "Thur", 'tsn': "Tswana", + 'ewe': "Ewe", 'lug': "Luganda", 'ttj': "Rutooro", + 'fra': "French", 'luo': "Luo", 'wol': "Wolof", + 'ful': "Fulani", 'luy': "Luhya", 'xho': "Xhosa", + 'hau': "Hausa", 'mlg': "Malagasy", 'xog': "Lusoga", + 'ibo': "Igbo", 'myx': "Lumasaba", 'yor': "Yoruba", + 'nbl': "Ndebele", 'zul': "Zulu", + 'nya': "Chichewa", +}`,Sz=`import os import requests from dotenv import load_dotenv @@ -616,7 +630,7 @@ data = {"text": text} response = requests.post(url, headers=headers, json=data) result = response.json() -print(f"Detected language: {result}")`,Sz=`import os +print(f"Detected language: {result}")`,_z=`import os import requests from dotenv import load_dotenv @@ -640,14 +654,14 @@ payload = { response = requests.post(url, headers=headers, json=payload) print(response.status_code) -print(response.json())`,_z=`payload = { +print(response.json())`,jz=`payload = { "text": "I am a nurse who takes care of many people.", "model": "spark-tts", "voice": "luganda_female", # voice name, or the numeric id as a string e.g. "248" "response_mode": "url", # "url" (default), "stream", or "both" } response = requests.post(url, headers=headers, json=payload) -print(response.json())`,jz=`auth = {"Authorization": f"Bearer {access_token}"} +print(response.json())`,Cz=`auth = {"Authorization": f"Bearer {access_token}"} # Orpheus voices grouped by language (default) print(requests.get("https://api.sunbird.ai/tasks/voice/speakers", headers=auth).json()) @@ -657,7 +671,7 @@ print(requests.get( "https://api.sunbird.ai/tasks/voice/speakers", headers=auth, params={"model": "spark-tts"}, -).json())`,Cz=`url = "https://api.sunbird.ai/tasks/audio/speech/batch" +).json())`,Nz=`url = "https://api.sunbird.ai/tasks/audio/speech/batch" payload = { "items": [ {"text": "Good morning.", "voice": "salt_lug_0001"}, @@ -665,11 +679,11 @@ payload = { ] } response = requests.post(url, headers=headers, json=payload) -print(response.json())`,Nz=`print(requests.get( +print(response.json())`,Pz=`print(requests.get( "https://api.sunbird.ai/tasks/audio/speech/url", headers={"Authorization": f"Bearer {access_token}"}, params={"gcs_object": "orpheus_tts/2026-06-03/abc.wav"}, -).json())`,Pz=`{ +).json())`,Rz=`{ "audio_url": "https://storage.googleapis.com/.../tts_audio/....wav?...", "model": "orpheus-3b-tts", "platform": "modal", @@ -681,7 +695,7 @@ print(response.json())`,Nz=`print(requests.get( "gcs_object": "orpheus_tts/2026-06-03/....wav", "request_id": "0f1e2d3c4b5a...", "timings_ms": {"inference_ms": 1820.5, "upload_ms": 234.1, "total_ms": 2095.6} -}`,Rz=`import requests +}`,Ez=`import requests url = "https://api.sunbird.ai/tasks/chat/completions" @@ -705,7 +719,7 @@ payload = { response = requests.post(url, headers=headers, json=payload) print(response.status_code) -print(response.json())`,Ez=`{ +print(response.json())`,Tz=`{ "id": "chatcmpl-8f14e45fceea167a5a36dedd4bea2543", "object": "chat.completion", "created": 1718000000, @@ -725,7 +739,7 @@ print(response.json())`,Ez=`{ "completion_tokens": 47, "total_tokens": 69 } -}`,Tz=`from openai import OpenAI +}`,Az=`from openai import OpenAI client = OpenAI( api_key="", @@ -744,7 +758,7 @@ completion = client.chat.completions.create( ) print(completion.choices[0].message.content) -# Ndi muyala nnyo, emmere erina okugabibwa mu budde.`,Az=`payload = { +# Ndi muyala nnyo, emmere erina okugabibwa mu budde.`,Mz=`payload = { "model": "sunflower-14b", "messages": [ {"role": "system", "content": "You are a helpful multilingual assistant."}, @@ -752,7 +766,7 @@ print(completion.choices[0].message.content) {"role": "assistant", "content": "'Hello' is 'Gyebaleko'."}, {"role": "user", "content": "And to Acholi?"}, ], -}`,Mz=`stream = client.chat.completions.create( +}`,Lz=`stream = client.chat.completions.create( model="sunflower-14b", messages=[{"role": "user", "content": "Tell me about Uganda."}], stream=True, @@ -760,7 +774,7 @@ print(completion.choices[0].message.content) for chunk in stream: if chunk.choices and chunk.choices[0].delta.content: - print(chunk.choices[0].delta.content, end="", flush=True)`,Lz=[{model:"sunflower-14b",isDefault:!0,coverage:"English + 31 Ugandan / regional languages (32 total)",bestFor:"High-accuracy translation, factual Q&A, summarization, and explanation across Ugandan languages"},{model:"sunflower-9b",isDefault:!1,coverage:"67 African languages (good / moderate / basic tiers)",bestFor:"Broad pan-African translation, instruction-following, and multi-turn chat"}],Oz=[{name:"Acholi",code:"ach"},{name:"Alur",code:"alz"},{name:"Aringa",code:"luc"},{name:"Ateso",code:"teo"},{name:"Bari",code:"bfa"},{name:"English",code:"eng"},{name:"Jopadhola",code:"adh"},{name:"Kakwa",code:"keo"},{name:"Karamojong",code:"kdj"},{name:"Kinyarwanda",code:"kin"},{name:"Kumam",code:"kdi"},{name:"Kupsabiny",code:"kpz"},{name:"Kwamba",code:"rwm"},{name:"Lango",code:"laj"},{name:"Lubwisi",code:"tlj"},{name:"Lugbara",code:"lgg"},{name:"Lugungu",code:"rub"},{name:"Lugwere",code:"gwr"},{name:"Luganda",code:"lug"},{name:"Lumasaba",code:"myx"},{name:"Lunyole",code:"nuj"},{name:"Ma'di",code:"mhi"},{name:"Pokot",code:"pok"},{name:"Rukiga",code:"cgg"},{name:"Rukonjo",code:"koo"},{name:"Runyankole",code:"nyn"},{name:"Runyoro",code:"nyo"},{name:"Ruruuli",code:"ruc"},{name:"Rutooro",code:"ttj"},{name:"Samia",code:"lsm"},{name:"Swahili",code:"swa"},{name:"Lusoga",code:"xog"}],Dz=[{tier:"Good",languages:"Afrikaans, Zulu, Nigerian Pidgin, Chichewa, Swahili, Xhosa, Somali, Lingala, Sotho, Igbo, Malagasy, Kinyarwanda, Hausa, Tswana, Yoruba, Luganda, Shona, Ndebele, Amharic, Kirundi, Runyoro, Luo, Ewe, Runyankole"},{tier:"Moderate",languages:"Kikuyu, Lusoga, Acholi, Rukiga, Rutooro, Oromo, Bemba, Ruruuli, Akan, Lango, Lugwere, Lugbara, Kumam, Lugungu, Lumasaba, Ateso, Lunyole"},{tier:"Basic",languages:"Kabyle, Rukonjo, Bambara, Lubwisi, Wolof, Samia, Jopadhola, Alur, Bari, Kakwa, Dagbani, Karamojong, Berber, Fulani, Kwamba, Ma'di, Aringa, Luhya, Kalenjin, Kupsabiny, Lendu, Dagaare, Ik, Pokot, Kanuri, Dinka"}],Iz=`import os + print(chunk.choices[0].delta.content, end="", flush=True)`,Oz=[{model:"sunflower-14b",isDefault:!0,coverage:"English + 31 Ugandan / regional languages (32 total)",bestFor:"High-accuracy translation, factual Q&A, summarization, and explanation across Ugandan languages"},{model:"sunflower-9b",isDefault:!1,coverage:"67 African languages (good / moderate / basic tiers)",bestFor:"Broad pan-African translation, instruction-following, and multi-turn chat"}],Dz=[{name:"Acholi",code:"ach"},{name:"Alur",code:"alz"},{name:"Aringa",code:"luc"},{name:"Ateso",code:"teo"},{name:"Bari",code:"bfa"},{name:"English",code:"eng"},{name:"Jopadhola",code:"adh"},{name:"Kakwa",code:"keo"},{name:"Karamojong",code:"kdj"},{name:"Kinyarwanda",code:"kin"},{name:"Kumam",code:"kdi"},{name:"Kupsabiny",code:"kpz"},{name:"Kwamba",code:"rwm"},{name:"Lango",code:"laj"},{name:"Lubwisi",code:"tlj"},{name:"Lugbara",code:"lgg"},{name:"Lugungu",code:"rub"},{name:"Lugwere",code:"gwr"},{name:"Luganda",code:"lug"},{name:"Lumasaba",code:"myx"},{name:"Lunyole",code:"nuj"},{name:"Ma'di",code:"mhi"},{name:"Pokot",code:"pok"},{name:"Rukiga",code:"cgg"},{name:"Rukonjo",code:"koo"},{name:"Runyankole",code:"nyn"},{name:"Runyoro",code:"nyo"},{name:"Ruruuli",code:"ruc"},{name:"Rutooro",code:"ttj"},{name:"Samia",code:"lsm"},{name:"Swahili",code:"swa"},{name:"Lusoga",code:"xog"}],Iz=[{tier:"Good",languages:"Afrikaans, Zulu, Nigerian Pidgin, Chichewa, Swahili, Xhosa, Somali, Lingala, Sotho, Igbo, Malagasy, Kinyarwanda, Hausa, Tswana, Yoruba, Luganda, Shona, Ndebele, Amharic, Kirundi, Runyoro, Luo, Ewe, Runyankole"},{tier:"Moderate",languages:"Kikuyu, Lusoga, Acholi, Rukiga, Rutooro, Oromo, Bemba, Ruruuli, Akan, Lango, Lugwere, Lugbara, Kumam, Lugungu, Lumasaba, Ateso, Lunyole"},{tier:"Basic",languages:"Kabyle, Rukonjo, Bambara, Lubwisi, Wolof, Samia, Jopadhola, Alur, Bari, Kakwa, Dagbani, Karamojong, Berber, Fulani, Kwamba, Ma'di, Aringa, Luhya, Kalenjin, Kupsabiny, Lendu, Dagaare, Ik, Pokot, Kanuri, Dinka"}],Fz=`import os import requests from dotenv import load_dotenv @@ -800,4 +814,4 @@ with open("/path/to/your/recording.wav", "rb") as f: ) if upload_response.status_code == 200: - print("File uploaded successfully!")`;function Fz(e){const[t,n]=S.useState(e[0]??"");return S.useEffect(()=>{const r=e.map(o=>document.getElementById(o)).filter(o=>o!==null);if(r.length===0)return;const s=new IntersectionObserver(o=>{const i=o.filter(a=>a.isIntersecting).sort((a,l)=>l.intersectionRatio-a.intersectionRatio);i.length>0&&n(i[0].target.id)},{rootMargin:"-20% 0px -70% 0px",threshold:[0,.25,.5,.75,1]});return r.forEach(o=>s.observe(o)),()=>s.disconnect()},[e]),t}function Rn({id:e,icon:t,part:n,title:r}){return c.jsxs("div",{id:e,className:"scroll-mt-24 mb-6",children:[n&&c.jsx("div",{className:"text-xs font-semibold tracking-widest uppercase text-primary-600 dark:text-primary-400 mb-2",children:n}),c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("div",{className:"w-10 h-10 rounded-xl bg-primary-50 dark:bg-primary-900/20 flex items-center justify-center text-primary-600 dark:text-primary-400 shrink-0",children:c.jsx(t,{size:20})}),c.jsx("h2",{className:"text-2xl sm:text-3xl font-bold text-gray-900 dark:text-white",children:r})]})]})}function yi({children:e}){return c.jsxs("div",{className:"flex items-start gap-3 p-4 my-4 rounded-xl border border-primary-200 dark:border-primary-900/40 bg-primary-50/60 dark:bg-primary-900/10 text-sm text-gray-700 dark:text-gray-200",children:[c.jsx(sg,{size:18,className:"text-primary-600 dark:text-primary-400 shrink-0 mt-0.5"}),c.jsx("div",{className:"leading-relaxed",children:e})]})}function Qe({children:e}){return c.jsx("h3",{className:"text-xl font-semibold text-gray-900 dark:text-white mt-8 mb-3",children:e})}function vt({children:e}){return c.jsx("h4",{className:"text-base font-semibold text-gray-800 dark:text-gray-100 mt-6 mb-2",children:e})}function ge({children:e}){return c.jsx("p",{className:"text-gray-700 dark:text-gray-300 leading-relaxed",children:e})}function Ol({items:e}){return c.jsx("ul",{className:"space-y-2 my-4",children:e.map((t,n)=>c.jsxs("li",{className:"flex items-start gap-2 text-gray-700 dark:text-gray-300",children:[c.jsx("span",{className:"mt-2 w-1.5 h-1.5 rounded-full bg-primary-500 shrink-0"}),c.jsx("span",{className:"leading-relaxed",children:t})]},n))})}function G({children:e}){return c.jsx("code",{className:"px-1.5 py-0.5 rounded-md bg-gray-100 dark:bg-white/10 text-primary-700 dark:text-primary-300 text-[0.9em] font-mono",children:e})}function lh({available:e,dagger:t=!1}){return e?c.jsxs("span",{className:"inline-flex items-center gap-0.5 text-green-600 dark:text-green-400",children:[c.jsx(vu,{size:16,"aria-label":"Available"}),t&&c.jsx("sup",{className:"text-amber-600 dark:text-amber-400",children:"†"})]}):c.jsx(Su,{size:16,className:"inline text-gray-300 dark:text-gray-600","aria-label":"Not supported"})}function zz(){const e=Fz(qb.map(t=>t.id));return c.jsxs("div",{className:"min-h-screen bg-white dark:bg-black transition-colors duration-300 selection:bg-primary-500 selection:text-white flex flex-col",children:[c.jsx(Hu,{}),c.jsx("main",{className:"flex-1 pt-24 pb-16 px-4 sm:px-6 lg:px-8",children:c.jsxs("div",{className:"max-w-7xl mx-auto",children:[c.jsxs("div",{className:"max-w-4xl mx-auto text-center mb-12",children:[c.jsxs("div",{className:"inline-flex items-center gap-2 px-3 py-1 rounded-full bg-primary-50 dark:bg-primary-900/20 text-primary-700 dark:text-primary-300 text-xs font-semibold tracking-wider uppercase mb-4",children:[c.jsx(Y0,{size:14}),"Tutorial"]}),c.jsx("h1",{className:"text-4xl sm:text-5xl lg:text-6xl font-extrabold tracking-tight text-gray-900 dark:text-white mb-4",children:"Sunbird AI API Tutorial"}),c.jsx("p",{className:"text-lg text-gray-600 dark:text-gray-400 max-w-2xl mx-auto leading-relaxed",children:"A comprehensive guide for using the Sunbird AI API with Python code samples — translate, transcribe, synthesize speech, and chat across 30+ African languages."})]}),c.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-[240px_minmax(0,1fr)] gap-10",children:[c.jsx("aside",{className:"hidden lg:block",children:c.jsxs("nav",{className:"sticky top-24 py-2",children:[c.jsx("div",{className:"text-xs font-semibold tracking-widest uppercase text-gray-500 dark:text-gray-400 mb-3 px-3",children:"On this page"}),c.jsx("ul",{className:"space-y-1",children:qb.map(t=>{const n=e===t.id;return c.jsx("li",{children:c.jsxs("a",{href:`#${t.id}`,className:`block px-3 py-2 rounded-lg text-sm transition-colors border-l-2 ${n?"border-primary-500 text-primary-600 dark:text-primary-400 bg-primary-50 dark:bg-primary-900/10 font-medium":"border-transparent text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white hover:bg-gray-50 dark:hover:bg-white/5"}`,children:[t.part&&c.jsx("span",{className:"block text-[10px] font-semibold tracking-wider uppercase opacity-70",children:t.part}),t.label]})},t.id)})})]})}),c.jsxs("article",{className:"max-w-3xl space-y-16",children:[c.jsxs("section",{children:[c.jsx(Rn,{id:"overview",icon:mR,title:"Supported Languages"}),c.jsx(ge,{children:"Sunbird AI provides AI services across English and a growing catalog of African languages. Languages are accepted as a 3-letter ISO code or a full language name; translation alone covers 32 languages."}),c.jsxs("div",{className:"flex flex-wrap gap-2 mt-6",children:[oz.map(t=>c.jsxs("div",{className:"px-3 py-1.5 rounded-full bg-white dark:bg-white/5 border border-gray-200 dark:border-white/10 text-sm text-gray-800 dark:text-gray-100",children:[t.name," ",c.jsxs("span",{className:"text-gray-400 dark:text-gray-500 font-mono text-xs",children:["(",t.code,")"]})]},t.code)),c.jsx("div",{className:"px-3 py-1.5 rounded-full bg-primary-50 dark:bg-primary-900/20 border border-primary-200 dark:border-primary-900/40 text-sm text-primary-700 dark:text-primary-300 font-medium",children:"+ 20 more"})]})]}),c.jsxs("section",{children:[c.jsx(Rn,{id:"language-support",icon:wR,title:"Language Support by Endpoint"}),c.jsxs(ge,{children:["Which languages each task endpoint currently serves. ",c.jsx("strong",{children:"Code"})," is the canonical ISO/SALT code the API accepts (full language names also work where an endpoint takes a"," ",c.jsx(G,{children:"language"})," or ",c.jsx(G,{children:"voice"}),"). The"," ",c.jsx(G,{children:"/tasks/chat/completions"})," column reflects the default"," ",c.jsx(G,{children:"sunflower-14b"})," model (English + 31 Ugandan/regional languages), which"," ",c.jsx(G,{children:"/tasks/translate"})," shares. The alternative"," ",c.jsx(G,{children:"sunflower-9b"})," model covers a broader set of 67 African languages — see"," ",c.jsx("a",{href:"#conversational-ai",className:"text-primary-600 dark:text-primary-400 hover:underline",children:"Part 6"})," ","for the per-model breakdown."]}),c.jsx("div",{className:"overflow-x-auto rounded-2xl border border-gray-200 dark:border-white/10 my-4",children:c.jsxs("table",{className:"w-full text-sm",children:[c.jsx("thead",{className:"bg-gray-50 dark:bg-white/5",children:c.jsxs("tr",{children:[c.jsx("th",{className:"text-left px-4 py-3 font-semibold text-gray-700 dark:text-gray-200",children:"Language"}),c.jsx("th",{className:"text-left px-4 py-3 font-semibold text-gray-700 dark:text-gray-200",children:"Code"}),c.jsxs("th",{className:"px-4 py-3 font-semibold text-gray-700 dark:text-gray-200",children:[c.jsx("div",{className:"text-center",children:"Text-to-Speech"}),c.jsx("div",{className:"text-center font-mono font-normal text-[11px] text-gray-400 dark:text-gray-500",children:"/tasks/audio/speech"})]}),c.jsxs("th",{className:"px-4 py-3 font-semibold text-gray-700 dark:text-gray-200",children:[c.jsx("div",{className:"text-center",children:"Speech-to-Text"}),c.jsx("div",{className:"text-center font-mono font-normal text-[11px] text-gray-400 dark:text-gray-500",children:"/tasks/audio/transcriptions"})]}),c.jsxs("th",{className:"px-4 py-3 font-semibold text-gray-700 dark:text-gray-200",children:[c.jsx("div",{className:"text-center",children:"Chat"}),c.jsx("div",{className:"text-center font-mono font-normal text-[11px] text-gray-400 dark:text-gray-500",children:"/tasks/chat/completions"})]})]})}),c.jsx("tbody",{children:iz.map((t,n)=>c.jsxs("tr",{className:n%2===0?"bg-white dark:bg-transparent":"bg-gray-50/50 dark:bg-white/[0.02]",children:[c.jsx("td",{className:"px-4 py-3 text-gray-700 dark:text-gray-300 whitespace-nowrap",children:t.name}),c.jsx("td",{className:"px-4 py-3 font-mono text-primary-700 dark:text-primary-400",children:t.code}),c.jsx("td",{className:"px-4 py-3 text-center",children:c.jsx(lh,{available:t.speech,dagger:t.ttsVoiceless})}),c.jsx("td",{className:"px-4 py-3 text-center",children:c.jsx(lh,{available:t.transcription})}),c.jsx("td",{className:"px-4 py-3 text-center",children:c.jsx(lh,{available:t.chat})})]},t.code))})]})}),c.jsxs(ge,{children:[c.jsx("strong",{children:"†"})," Lugbara, Sesotho, and Setswana are in the orpheus-3b-tts training mix but currently expose no individual voice IDs, so synthesis depends on a future voice release. Languages outside these sets (for example Zulu) are not yet served by any endpoint."]})]}),c.jsxs("section",{children:[c.jsx(Rn,{id:"authentication",icon:q0,part:"Part 1",title:"Authentication"}),c.jsx(Qe,{children:"Creating an Account"}),c.jsxs("ol",{className:"space-y-3 my-4 list-none counter-reset-item",children:[c.jsxs("li",{className:"flex items-start gap-3 text-gray-700 dark:text-gray-300",children:[c.jsx("span",{className:"flex items-center justify-center w-6 h-6 rounded-full bg-primary-600 text-white text-xs font-semibold shrink-0",children:"1"}),c.jsxs("span",{className:"leading-relaxed",children:["If you don't already have an account, create one at"," ",c.jsxs("a",{href:"https://api.sunbird.ai/register",target:"_blank",rel:"noopener noreferrer",className:"text-primary-600 dark:text-primary-400 hover:underline inline-flex items-center gap-1",children:["api.sunbird.ai/register",c.jsx(Hn,{size:12})]})]})]}),c.jsxs("li",{className:"flex items-start gap-3 text-gray-700 dark:text-gray-300",children:[c.jsx("span",{className:"flex items-center justify-center w-6 h-6 rounded-full bg-primary-600 text-white text-xs font-semibold shrink-0",children:"2"}),c.jsxs("span",{className:"leading-relaxed",children:["Go to the"," ",c.jsxs("a",{href:"https://api.sunbird.ai/keys",target:"_blank",rel:"noopener noreferrer",className:"text-primary-600 dark:text-primary-400 hover:underline inline-flex items-center gap-1",children:["tokens page",c.jsx(Hn,{size:12})]})," ","to get your access token / API key."]})]})]}),c.jsx(Qe,{children:"Using the Authentication API"}),c.jsx(vt,{children:"Register a New User"}),c.jsx(Pe,{code:hz,language:"python",label:"Python — register"}),c.jsx(vt,{children:"Get Access Token"}),c.jsx(Pe,{code:fz,language:"python",label:"Python — get token"})]}),c.jsxs("section",{children:[c.jsx(Rn,{id:"translation",icon:xR,part:"Part 2",title:"Translation (Sunflower Model)"}),c.jsxs(ge,{children:["Translate text between 32 Ugandan and East African languages using the Sunflower model. Languages are accepted as ISO 639-3 codes (",c.jsx(G,{children:"lug"}),") or full names (",c.jsx(G,{children:"Luganda"}),"), case-insensitively, and translation works between"," ",c.jsx("strong",{children:"any pair"})," of supported languages. ",c.jsx(G,{children:"source_language"})," is optional — when omitted, Sunflower infers it from the text."]}),c.jsx(Pe,{code:pz,language:"python",label:"Python — translate"}),c.jsx(vt,{children:"Optional source, full names"}),c.jsxs(ge,{children:[c.jsx(G,{children:"source_language"})," is optional, and full language names work too:"]}),c.jsx(Pe,{code:gz,language:"python",label:"Python — target only"}),c.jsx(vt,{children:"Supported languages (ISO code → name)"}),c.jsx(Pe,{code:mz,language:"python",label:"Python — language codes"}),c.jsx(vt,{children:"Response"}),c.jsx(ge,{children:"The response shape is unchanged from the previous NLLB-backed endpoint:"}),c.jsx(Pe,{code:yz,language:"json",label:"JSON — response"})]}),c.jsxs("section",{children:[c.jsx(Rn,{id:"speech-to-text",icon:K0,part:"Part 3",title:"Speech-to-Text (STT)"}),c.jsxs(ge,{children:["Convert speech audio to text. The unified"," ",c.jsx(G,{children:"POST /tasks/audio/transcriptions"})," endpoint accepts an uploaded audio file (or a GCS object) and routes to the Modal (Whisper large-v3) or RunPod backend. Supports MP3, WAV, M4A, and more."]}),c.jsxs(yi,{children:[c.jsx("strong",{children:"Migrating from the legacy STT routes?"})," ",c.jsx(G,{children:"/tasks/modal/stt"}),","," ",c.jsx(G,{children:"/tasks/stt"}),", ",c.jsx(G,{children:"/tasks/stt_from_gcs"}),", and"," ",c.jsx(G,{children:"/tasks/org/stt"})," are ",c.jsx("strong",{children:"deprecated"})," (they still work but return ",c.jsx(G,{children:"Deprecation"}),"/",c.jsx(G,{children:"Sunset"})," headers). Switch to"," ",c.jsx(G,{children:"/tasks/audio/transcriptions"}),"."]}),c.jsx(Qe,{children:"Transcribe a file (Modal / Whisper)"}),c.jsxs(ge,{children:[c.jsx(G,{children:"language"})," is ",c.jsx("strong",{children:"required"}),"."," ",c.jsx(G,{children:"platform"})," defaults to ",c.jsx(G,{children:"modal"})," (Whisper large-v3)."]}),c.jsx(Pe,{code:xz,language:"python",label:"Python — Modal / Whisper"}),c.jsx(Qe,{children:"Transcribe with RunPod (adapter, Whisper, diarization)"}),c.jsxs(ge,{children:["The RunPod backend adds a language ",c.jsx(G,{children:"adapter"}),", the"," ",c.jsx(G,{children:"whisper"})," flag, and optional speaker diarization (",c.jsx(G,{children:"recognise_speakers"}),")."]}),c.jsx(Pe,{code:bz,language:"python",label:"Python — RunPod"}),c.jsxs(ge,{children:["You can also transcribe audio already in GCS by passing"," ",c.jsx(G,{children:"gcs_blob_name"})," (with ",c.jsx(G,{children:'platform="runpod"'}),") instead of an ",c.jsx(G,{children:"audio"})," file — see ",c.jsx("strong",{children:"Part 7: File Upload"})," for generating upload URLs."]}),c.jsx(vt,{children:"Example response"}),c.jsx(Pe,{code:vz,language:"json",label:"JSON — response"}),c.jsx(vt,{children:"Supported languages"}),c.jsx("div",{className:"flex flex-wrap gap-2 my-4",children:az.map(t=>c.jsxs("div",{className:"px-3 py-1 rounded-full bg-white dark:bg-white/5 border border-gray-200 dark:border-white/10 text-xs text-gray-800 dark:text-gray-100",children:[t.name," ",c.jsxs("span",{className:"text-gray-400 font-mono",children:["(",t.code,")"]})]},t.code))}),c.jsxs(yi,{children:[c.jsx("strong",{children:"Note:"})," For files larger than 100MB, only the first 10 minutes will be transcribed."]}),c.jsx(ge,{children:"The dictionary below represents the language codes available now for the STT endpoint:"}),c.jsx(Pe,{code:wz,language:"python",label:"Python — Whisper language IDs"})]}),c.jsxs("section",{children:[c.jsx(Rn,{id:"language-detection",icon:_R,part:"Part 4",title:"Language Detection"}),c.jsx(ge,{children:"Automatically detect the language of text input. Useful for routing text to appropriate translation or processing pipelines."}),c.jsx(Pe,{code:kz,language:"python",label:"Python — language ID"}),c.jsx(vt,{children:"Supported Languages"}),c.jsx(ge,{children:"Acholi, Ateso, English, Luganda, Lugbara, Runyankole."})]}),c.jsxs("section",{children:[c.jsx(Rn,{id:"text-to-speech",icon:X0,part:"Part 5",title:"Text-to-Speech (TTS)"}),c.jsxs(ge,{children:["Synthesize speech from text. The unified ",c.jsx(G,{children:"POST /tasks/audio/speech"})," ","endpoint replaces ",c.jsx(G,{children:"/tasks/modal/tts"}),","," ",c.jsx(G,{children:"/tasks/runpod/tts"}),", and"," ",c.jsx(G,{children:"/tasks/modal/orpheus/tts"}),". Two models are available:"]}),c.jsx(Ol,{items:[c.jsxs(c.Fragment,{children:[c.jsx(G,{children:"orpheus-3b-tts"})," (default) — multilingual, multi-speaker; voices are catalog tags (e.g. ",c.jsx(G,{children:"salt_lug_0001"}),"). List them with"," ",c.jsx(G,{children:"GET /tasks/voice/speakers"}),"."]}),c.jsxs(c.Fragment,{children:[c.jsx(G,{children:"spark-tts"})," — the six fixed Ugandan voices below; supports streaming on Modal."]})]}),c.jsxs(yi,{children:[c.jsx("strong",{children:"Migrating?"})," The legacy TTS, streaming (",c.jsx(G,{children:"/stream"}),","," ",c.jsx(G,{children:"/stream-with-url"}),"), Orpheus batch, speaker-listing, and"," ",c.jsx(G,{children:"refresh-url"})," endpoints are ",c.jsx("strong",{children:"deprecated"}),". Use the unified endpoints below."]}),c.jsx(Qe,{children:"Single synthesis (orpheus-3b-tts, default)"}),c.jsx(Pe,{code:Sz,language:"python",label:"Python — orpheus-3b-tts"}),c.jsx(vt,{children:"orpheus-3b-tts: languages covered"}),c.jsxs(ge,{children:["Speaker IDs encode both the source corpus (",c.jsx(G,{children:"salt_*"}),","," ",c.jsx(G,{children:"waxal_*"}),", ",c.jsx(G,{children:"slr32_*"}),","," ",c.jsx(G,{children:"slr129_*"}),", ",c.jsx(G,{children:"bateesa_*"}),") and the language. Languages shown with an em dash in the Speaker IDs column are present in the model's training mix but do not currently expose individual voice IDs in this checkpoint."]}),c.jsx("div",{className:"overflow-x-auto rounded-2xl border border-gray-200 dark:border-white/10 my-4",children:c.jsxs("table",{className:"w-full text-sm",children:[c.jsx("thead",{className:"bg-gray-50 dark:bg-white/5",children:c.jsxs("tr",{children:[c.jsx("th",{className:"text-left px-4 py-3 font-semibold text-gray-700 dark:text-gray-200",children:"Config"}),c.jsx("th",{className:"text-left px-4 py-3 font-semibold text-gray-700 dark:text-gray-200",children:"Language"}),c.jsx("th",{className:"text-left px-4 py-3 font-semibold text-gray-700 dark:text-gray-200",children:"ISO 639-1"}),c.jsx("th",{className:"text-left px-4 py-3 font-semibold text-gray-700 dark:text-gray-200",children:"Region"}),c.jsx("th",{className:"text-left px-4 py-3 font-semibold text-gray-700 dark:text-gray-200",children:"Speaker IDs"})]})}),c.jsx("tbody",{children:lz.map((t,n)=>c.jsxs("tr",{className:n%2===0?"bg-white dark:bg-transparent":"bg-gray-50/50 dark:bg-white/[0.02]",children:[c.jsx("td",{className:"px-4 py-3 align-top font-mono text-primary-700 dark:text-primary-400",children:t.config}),c.jsx("td",{className:"px-4 py-3 align-top text-gray-700 dark:text-gray-300 whitespace-nowrap",children:t.language}),c.jsx("td",{className:"px-4 py-3 align-top font-mono text-gray-500 dark:text-gray-400",children:t.iso}),c.jsx("td",{className:"px-4 py-3 align-top text-gray-600 dark:text-gray-400",children:t.region}),c.jsx("td",{className:"px-4 py-3 align-top text-gray-700 dark:text-gray-300",children:t.speakers.length===0?c.jsx("span",{className:"text-gray-400 dark:text-gray-500",children:"—"}):c.jsx("div",{className:"flex flex-wrap gap-1",children:t.speakers.map(r=>c.jsx("code",{className:"px-1.5 py-0.5 rounded-md bg-gray-100 dark:bg-white/10 text-primary-700 dark:text-primary-300 text-xs font-mono",children:r},r))})})]},t.config))})]})}),c.jsxs(ge,{children:["Per-language quality scales with the amount of training data Sunbird collected for that language. Audition the voices for each language before relying on a particular speaker — use the discovery snippet under ",c.jsx("strong",{children:"Listing voices"})," below."]}),c.jsx(Qe,{children:"Single synthesis (spark-tts, fixed voices)"}),c.jsx(Pe,{code:_z,language:"python",label:"Python — spark-tts"}),c.jsx(vt,{children:"spark-tts voices"}),c.jsx("div",{className:"overflow-hidden rounded-2xl border border-gray-200 dark:border-white/10 my-4",children:c.jsxs("table",{className:"w-full text-sm",children:[c.jsx("thead",{className:"bg-gray-50 dark:bg-white/5",children:c.jsxs("tr",{children:[c.jsx("th",{className:"text-left px-4 py-3 font-semibold text-gray-700 dark:text-gray-200",children:"Voice name"}),c.jsx("th",{className:"text-left px-4 py-3 font-semibold text-gray-700 dark:text-gray-200",children:"ID"}),c.jsx("th",{className:"text-left px-4 py-3 font-semibold text-gray-700 dark:text-gray-200",children:"Description"})]})}),c.jsx("tbody",{children:cz.map((t,n)=>c.jsxs("tr",{className:n%2===0?"bg-white dark:bg-transparent":"bg-gray-50/50 dark:bg-white/[0.02]",children:[c.jsx("td",{className:"px-4 py-3 font-mono text-primary-700 dark:text-primary-400",children:t.name}),c.jsx("td",{className:"px-4 py-3 font-mono text-gray-700 dark:text-gray-300",children:t.id}),c.jsx("td",{className:"px-4 py-3 text-gray-700 dark:text-gray-300",children:t.description})]},t.id))})]})}),c.jsx(Qe,{children:"Response Modes"}),c.jsxs(ge,{children:[c.jsx(G,{children:"response_mode"})," applies to ",c.jsx("strong",{children:"spark-tts on Modal"}),":"]}),c.jsx(Ol,{items:uz.map(t=>c.jsxs(c.Fragment,{children:[c.jsx(G,{children:t.mode})," — ",t.description]}))}),c.jsx(Qe,{children:"Listing voices"}),c.jsx(Pe,{code:jz,language:"python",label:"Python — list voices"}),c.jsx(Qe,{children:"Batch synthesis (orpheus-3b-tts)"}),c.jsx(ge,{children:"Synthesize up to 128 items in a single request:"}),c.jsx(Pe,{code:Cz,language:"python",label:"Python — batch"}),c.jsx(Qe,{children:"Refreshing an expired URL"}),c.jsxs(ge,{children:["Signed URLs expire after ~30 minutes. Re-sign a stored object with"," ",c.jsx(G,{children:"GET /tasks/audio/speech/url"}),":"]}),c.jsx(Pe,{code:Nz,language:"python",label:"Python — refresh URL"}),c.jsx(vt,{children:"Example response (POST /tasks/audio/speech)"}),c.jsx(Pe,{code:Pz,language:"json",label:"JSON — response"})]}),c.jsxs("section",{children:[c.jsx(Rn,{id:"conversational-ai",icon:Jl,part:"Part 6",title:"Conversational AI (Sunflower)"}),c.jsxs(ge,{children:["The Sunflower models provide conversational AI for African languages through an OpenAI-compatible endpoint: ",c.jsx(G,{children:"POST /tasks/chat/completions"}),". The request and response formats mirror the OpenAI Chat Completions API, so you can move between the OpenAI API and the Sunbird API by changing only the base URL and API key."]}),c.jsxs(yi,{children:[c.jsx("strong",{children:"Deprecated:"})," ",c.jsx(G,{children:"POST /tasks/sunflower_inference"})," and"," ",c.jsx(G,{children:"POST /tasks/sunflower_simple"})," are deprecated and will be removed in a future release. Use ",c.jsx(G,{children:"POST /tasks/chat/completions"})," instead — a single instruction is just a request with one user message."]}),c.jsx(Qe,{children:"Choosing a model"}),c.jsxs(ge,{children:["Select a model with the ",c.jsx(G,{children:"model"})," field. Two models are available;"," ",c.jsx(G,{children:"sunflower-14b"})," is the default when ",c.jsx(G,{children:"model"})," is omitted. The old ",c.jsx(G,{children:"Sunbird/Sunflower-14B"})," identifier is no longer accepted — sending it returns a ",c.jsx(G,{children:"400"})," error asking you to use"," ",c.jsx(G,{children:"sunflower-14b"})," instead."]}),c.jsx("div",{className:"overflow-x-auto rounded-2xl border border-gray-200 dark:border-white/10 my-4",children:c.jsxs("table",{className:"w-full text-sm",children:[c.jsx("thead",{className:"bg-gray-50 dark:bg-white/5",children:c.jsxs("tr",{children:[c.jsx("th",{className:"text-left px-4 py-3 font-semibold text-gray-700 dark:text-gray-200",children:"model"}),c.jsx("th",{className:"text-left px-4 py-3 font-semibold text-gray-700 dark:text-gray-200",children:"Coverage"}),c.jsx("th",{className:"text-left px-4 py-3 font-semibold text-gray-700 dark:text-gray-200",children:"Best for"})]})}),c.jsx("tbody",{children:Lz.map((t,n)=>c.jsxs("tr",{className:n%2===0?"bg-white dark:bg-transparent":"bg-gray-50/50 dark:bg-white/[0.02]",children:[c.jsxs("td",{className:"px-4 py-3 align-top font-mono text-primary-700 dark:text-primary-400 whitespace-nowrap",children:[t.model,t.isDefault&&c.jsx("span",{className:"ml-2 text-[10px] font-sans font-semibold uppercase tracking-wider text-gray-400 dark:text-gray-500",children:"default"})]}),c.jsx("td",{className:"px-4 py-3 align-top text-gray-700 dark:text-gray-300",children:t.coverage}),c.jsx("td",{className:"px-4 py-3 align-top text-gray-600 dark:text-gray-400",children:t.bestFor})]},t.model))})]})}),c.jsx(vt,{children:"sunflower-14b — supported languages"}),c.jsx(ge,{children:"English plus 31 Ugandan and regional languages (32 total):"}),c.jsx("div",{className:"flex flex-wrap gap-2 my-4",children:Oz.map(t=>c.jsxs("div",{className:"px-3 py-1 rounded-full bg-white dark:bg-white/5 border border-gray-200 dark:border-white/10 text-xs text-gray-800 dark:text-gray-100",children:[t.name," ",c.jsxs("span",{className:"text-gray-400 font-mono",children:["(",t.code,")"]})]},t.code))}),c.jsx(vt,{children:"sunflower-9b — supported languages"}),c.jsx(ge,{children:"67 African languages, grouped by the model's understanding tier (per-language quality scales with available training data):"}),c.jsx(Ol,{items:Dz.map(t=>c.jsxs(c.Fragment,{children:[c.jsxs("strong",{children:[t.tier,":"]})," ",t.languages,"."]}))}),c.jsxs(ge,{children:["Full evaluations and language codes are on the model pages:"," ",c.jsx("a",{href:"https://salt.sunbird.ai/models/sunflower-14b",target:"_blank",rel:"noopener noreferrer",className:"text-primary-600 dark:text-primary-400 hover:underline",children:"sunflower-14b"})," ","and"," ",c.jsx("a",{href:"https://salt.sunbird.ai/models/sunflower-qwen3.5-9b/",target:"_blank",rel:"noopener noreferrer",className:"text-primary-600 dark:text-primary-400 hover:underline",children:"sunflower-qwen3.5-9b"}),"."]}),c.jsx(Qe,{children:"Chat Completion"}),c.jsx(Pe,{code:Rz,language:"python",label:"Python — chat completions"}),c.jsx(vt,{children:"Example Response"}),c.jsx(Pe,{code:Ez,language:"json",label:"JSON — response"}),c.jsx(Qe,{children:"Using the OpenAI SDK"}),c.jsx(ge,{children:"Because the endpoint is OpenAI-compatible, the official OpenAI Python SDK works out of the box:"}),c.jsx(Pe,{code:Tz,language:"python",label:"Python — OpenAI SDK"}),c.jsx(Qe,{children:"Multi-turn Conversations"}),c.jsxs(ge,{children:["Maintain context by sending the running message history. You can also set a custom"," ",c.jsx(G,{children:"system"})," message (when omitted, a default Sunflower system message is applied):"]}),c.jsx(Pe,{code:Az,language:"python",label:"Python — multi-turn"}),c.jsx(Qe,{children:"Streaming"}),c.jsxs(ge,{children:["Set ",c.jsx(G,{children:'"stream": true'})," to receive Server-Sent Events in OpenAI"," ",c.jsx(G,{children:"chat.completion.chunk"})," format, terminated by"," ",c.jsx(G,{children:"data: [DONE]"}),". With the OpenAI SDK:"]}),c.jsx(Pe,{code:Mz,language:"python",label:"Python — streaming"}),c.jsxs(yi,{children:["Supported request parameters: ",c.jsx(G,{children:"model"})," (",c.jsx(G,{children:"sunflower-14b"})," or ",c.jsx(G,{children:"sunflower-9b"}),"; the old"," ",c.jsx(G,{children:"Sunbird/Sunflower-14B"})," identifier is no longer accepted),"," ",c.jsx(G,{children:"messages"}),", ",c.jsx(G,{children:"temperature"})," (0.0–2.0, default 0.3),"," ",c.jsx(G,{children:"max_tokens"}),", ",c.jsx(G,{children:"top_p"}),", ",c.jsx(G,{children:"stop"}),", and ",c.jsx(G,{children:"stream"}),"."]})]}),c.jsxs("section",{children:[c.jsx(Rn,{id:"file-upload",icon:ER,part:"Part 7",title:"File Upload (Signed URLs)"}),c.jsx(ge,{children:"Generate secure signed URLs for direct client uploads to GCP Storage. Useful for uploading audio files before transcription."}),c.jsx(Pe,{code:Iz,language:"python",label:"Python — signed URL upload"}),c.jsx(vt,{children:"Features"}),c.jsx(Ol,{items:dz})]}),c.jsxs("section",{children:[c.jsx(Rn,{id:"resources",icon:G0,title:"Additional Resources"}),c.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 my-4",children:[c.jsxs("a",{href:"https://docs.sunbird.ai/introduction",target:"_blank",rel:"noopener noreferrer",className:"group p-5 rounded-2xl bg-white dark:bg-white/5 border border-gray-200 dark:border-white/10 hover:border-primary-500 dark:hover:border-primary-500 transition-all hover:shadow-lg",children:[c.jsxs("div",{className:"flex items-center gap-2 text-gray-900 dark:text-white font-semibold mb-1",children:[c.jsx(Mc,{size:18,className:"text-primary-600 dark:text-primary-400"}),"API Documentation",c.jsx(Hn,{size:14,className:"text-gray-400 group-hover:text-primary-500 transition-colors"})]}),c.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400 font-mono",children:"docs.sunbird.ai/introduction"})]}),c.jsxs("a",{href:"https://api.sunbird.ai/openapi.json",target:"_blank",rel:"noopener noreferrer",className:"group p-5 rounded-2xl bg-white dark:bg-white/5 border border-gray-200 dark:border-white/10 hover:border-primary-500 dark:hover:border-primary-500 transition-all hover:shadow-lg",children:[c.jsxs("div",{className:"flex items-center gap-2 text-gray-900 dark:text-white font-semibold mb-1",children:[c.jsx(G0,{size:18,className:"text-primary-600 dark:text-primary-400"}),"OpenAPI Specification",c.jsx(Hn,{size:14,className:"text-gray-400 group-hover:text-primary-500 transition-colors"})]}),c.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400 font-mono",children:"api.sunbird.ai/openapi.json"})]}),c.jsxs("a",{href:"https://docs.sunbird.ai/api-reference/introduction",target:"_blank",rel:"noopener noreferrer",className:"group p-5 rounded-2xl bg-white dark:bg-white/5 border border-gray-200 dark:border-white/10 hover:border-primary-500 dark:hover:border-primary-500 transition-all hover:shadow-lg",children:[c.jsxs("div",{className:"flex items-center gap-2 text-gray-900 dark:text-white font-semibold mb-1",children:[c.jsx(Y0,{size:18,className:"text-primary-600 dark:text-primary-400"}),"Usage Guide",c.jsx(Hn,{size:14,className:"text-gray-400 group-hover:text-primary-500 transition-colors"})]}),c.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400 font-mono",children:"docs.sunbird.ai/api-reference/introduction"})]}),c.jsxs("a",{href:"https://github.com/SunbirdAI/sunbird-ai-api/issues",target:"_blank",rel:"noopener noreferrer",className:"group p-5 rounded-2xl bg-white dark:bg-white/5 border border-gray-200 dark:border-white/10 hover:border-primary-500 dark:hover:border-primary-500 transition-all hover:shadow-lg",children:[c.jsxs("div",{className:"flex items-center gap-2 text-gray-900 dark:text-white font-semibold mb-1",children:[c.jsx(Jl,{size:18,className:"text-primary-600 dark:text-primary-400"}),"Feedback & Issues",c.jsx(Hn,{size:14,className:"text-gray-400 group-hover:text-primary-500 transition-colors"})]}),c.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400 font-mono",children:"github.com/SunbirdAI"})]})]}),c.jsx(Qe,{children:"Interactive Notebooks"}),c.jsx(ge,{children:"Prefer to explore in code? These Google Colab notebooks let you test Sunbird AI's models directly — either by running the models yourself or by calling the API. Open any notebook, add your access token where prompted, and run the cells."}),c.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 my-4",children:[{title:"Sunbird AI APIs — Hands-on (Interactive)",desc:"Call every API endpoint with interactive widgets",href:"https://colab.research.google.com/drive/1h02U5CcPScD2JCcEMBuzQv0Yx2BdzXlq?usp=sharing",icon:gR},{title:"Sunbird AI APIs — Non-Interactive",desc:"The same API walkthrough as plain code cells",href:"https://colab.research.google.com/drive/155GQaCFeZ8zhy9CCdEGWTubQTgibrGji?usp=sharing",icon:hR},{title:"Sunflower-Qwen3.5-9B Inference",desc:"Run the sunflower-9b model directly in Colab",href:"https://colab.research.google.com/drive/1hz7NfcA2GgkS-h6wTZ--6tS_IGtwTEEj?usp=sharing",icon:Jl},{title:"Sunflower Gemma 4 E2B — Text & Speech",desc:"Multimodal text and speech demo",href:"https://colab.research.google.com/drive/1P39eYR_KW16oH8tBzycjHG86RfxiRKMJ?usp=sharing",icon:X0},{title:"ASR for 51 African Languages",desc:"Automatic speech recognition across 51 languages",href:"https://colab.research.google.com/drive/1Bs2P3ULkj9zftPItuS2JnjzkFX8cgyz1?usp=sharing",icon:K0}].map(t=>{const n=t.icon;return c.jsxs("a",{href:t.href,target:"_blank",rel:"noopener noreferrer",className:"group p-5 rounded-2xl bg-white dark:bg-white/5 border border-gray-200 dark:border-white/10 hover:border-primary-500 dark:hover:border-primary-500 transition-all hover:shadow-lg",children:[c.jsxs("div",{className:"flex items-center gap-2 text-gray-900 dark:text-white font-semibold mb-1",children:[c.jsx(n,{size:18,className:"text-primary-600 dark:text-primary-400 shrink-0"}),t.title,c.jsx(Hn,{size:14,className:"text-gray-400 group-hover:text-primary-500 transition-colors shrink-0"})]}),c.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:t.desc}),c.jsx("div",{className:"mt-1 text-xs text-gray-400 dark:text-gray-500 font-mono",children:"Open in Google Colab"})]},t.href)})}),c.jsx(Qe,{children:"Rate Limiting"}),c.jsx(ge,{children:"API endpoints are rate-limited to ensure fair usage. If you need higher rate limits for production use, please contact the Sunbird AI team."}),c.jsx(Qe,{children:"Feedback and Questions"}),c.jsxs(ge,{children:["Don't hesitate to leave us any feedback or questions by opening an"," ",c.jsx("a",{href:"https://github.com/SunbirdAI/sunbird-ai-api/issues",target:"_blank",rel:"noopener noreferrer",className:"text-primary-600 dark:text-primary-400 hover:underline",children:"issue on GitHub"}),"."]})]}),c.jsxs("section",{className:"mt-16 p-8 rounded-3xl bg-gradient-to-br from-primary-50 to-primary-100/40 dark:from-primary-900/20 dark:to-primary-900/5 border border-primary-200 dark:border-primary-900/40",children:[c.jsx("h3",{className:"text-2xl font-bold text-gray-900 dark:text-white mb-2",children:"Ready to build?"}),c.jsx("p",{className:"text-gray-700 dark:text-gray-300 mb-5",children:"Get your access token and start calling the Sunbird AI API in minutes."}),c.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[c.jsxs(Ee,{to:"/register",className:"inline-flex items-center justify-center gap-2 px-6 py-3 rounded-xl bg-primary-600 hover:bg-primary-700 text-white font-semibold transition-all shadow-lg shadow-primary-500/20",children:["Create Account",c.jsx(hf,{size:18})]}),c.jsxs(Ee,{to:"/keys",className:"inline-flex items-center justify-center gap-2 px-6 py-3 rounded-xl bg-white dark:bg-white/5 hover:bg-gray-50 dark:hover:bg-white/10 border border-gray-200 dark:border-white/10 text-gray-900 dark:text-white font-semibold transition-all",children:[c.jsx(q0,{size:18}),"Get API Keys"]})]})]})]})]})]})}),c.jsx(Uu,{})]})}function st({title:e,children:t}){return S.useEffect(()=>{document.title=`${e} | Sunbird AI API`},[e]),c.jsx(c.Fragment,{children:t})}function hr({children:e}){const{isAuthenticated:t,isLoading:n}=Qr(),r=ar();return n?c.jsxs("div",{className:"min-h-screen flex items-center justify-center",children:[c.jsx(Da,{size:24,className:"animate-spin mr-2"}),"Loading..."]}):t?e:c.jsx(y1,{to:"/login",state:{from:r},replace:!0})}function Vz(){const{user:e}=Qr();return(e==null?void 0:e.account_type)==="Admin"?c.jsx(y1,{to:"/admin/analytics",replace:!0}):c.jsx(hI,{})}function Bz(){return c.jsxs($N,{children:[c.jsx(Je,{path:"/",element:c.jsx(st,{title:"Home",children:c.jsx(H6,{})})}),c.jsx(Je,{path:"/login",element:c.jsx(st,{title:"Login",children:c.jsx(Tb,{})})}),c.jsx(Je,{path:"/register",element:c.jsx(st,{title:"Register",children:c.jsx(W6,{})})}),c.jsx(Je,{path:"/forgot-password",element:c.jsx(st,{title:"Forgot Password",children:c.jsx(G6,{})})}),c.jsx(Je,{path:"/reset-password",element:c.jsx(st,{title:"Reset Password",children:c.jsx(q6,{})})}),c.jsx(Je,{path:"/privacy_policy",element:c.jsx(st,{title:"Privacy Policy",children:c.jsx(X6,{})})}),c.jsx(Je,{path:"/terms_of_service",element:c.jsx(st,{title:"Terms of Service",children:c.jsx(Q6,{})})}),c.jsx(Je,{path:"/tutorial",element:c.jsx(st,{title:"Tutorial",children:c.jsx(zz,{})})}),c.jsx(Je,{path:"/setup-organization",element:c.jsx(st,{title:"Setup Organization",children:c.jsx(Tb,{})})})," ",c.jsx(Je,{path:"/complete-profile",element:c.jsx(hr,{children:c.jsx(st,{title:"Complete Profile",children:c.jsx(Y6,{})})})}),c.jsx(Je,{path:"/dashboard",element:c.jsx(hr,{children:c.jsx(ts,{children:c.jsx(st,{title:"Dashboard",children:c.jsx(Vz,{})})})})}),c.jsx(Je,{path:"/keys",element:c.jsx(hr,{children:c.jsx(ts,{children:c.jsx(st,{title:"API Keys",children:c.jsx(f6,{})})})})}),c.jsx(Je,{path:"/account",element:c.jsx(hr,{children:c.jsx(ts,{children:c.jsx(st,{title:"Account Settings",children:c.jsx(g6,{})})})})}),c.jsx(Je,{path:"/admin/analytics",element:c.jsx(hr,{children:c.jsx(ts,{children:c.jsx(st,{title:"Admin Analytics",children:c.jsx(k6,{})})})})}),c.jsx(Je,{path:"/admin/billing",element:c.jsx(hr,{children:c.jsx(ts,{children:c.jsx(st,{title:"Infrastructure Billing",children:c.jsx(E6,{})})})})}),c.jsx(Je,{path:"/admin/google-analytics",element:c.jsx(hr,{children:c.jsx(ts,{children:c.jsx(st,{title:"Google Analytics",children:c.jsx(z6,{})})})})}),c.jsx(Je,{path:"/admin/engagement-insights",element:c.jsx(hr,{children:c.jsx(ts,{children:c.jsx(st,{title:"Website & Engagement Funnel",children:c.jsx($6,{})})})})})]})}function $z(){return c.jsx(XN,{children:c.jsx(aR,{defaultTheme:"system",storageKey:"sunbird-ui-theme",children:c.jsxs(oR,{children:[c.jsx(Bz,{}),c.jsx(CP,{position:"top-right",richColors:!0})]})})})}ch.createRoot(document.getElementById("root")).render(c.jsx(z.StrictMode,{children:c.jsx($z,{})})); + print("File uploaded successfully!")`;function zz(e){const[t,n]=S.useState(e[0]??"");return S.useEffect(()=>{const r=e.map(o=>document.getElementById(o)).filter(o=>o!==null);if(r.length===0)return;const s=new IntersectionObserver(o=>{const i=o.filter(a=>a.isIntersecting).sort((a,l)=>l.intersectionRatio-a.intersectionRatio);i.length>0&&n(i[0].target.id)},{rootMargin:"-20% 0px -70% 0px",threshold:[0,.25,.5,.75,1]});return r.forEach(o=>s.observe(o)),()=>s.disconnect()},[e]),t}function Rn({id:e,icon:t,part:n,title:r}){return c.jsxs("div",{id:e,className:"scroll-mt-24 mb-6",children:[n&&c.jsx("div",{className:"text-xs font-semibold tracking-widest uppercase text-primary-600 dark:text-primary-400 mb-2",children:n}),c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("div",{className:"w-10 h-10 rounded-xl bg-primary-50 dark:bg-primary-900/20 flex items-center justify-center text-primary-600 dark:text-primary-400 shrink-0",children:c.jsx(t,{size:20})}),c.jsx("h2",{className:"text-2xl sm:text-3xl font-bold text-gray-900 dark:text-white",children:r})]})]})}function Xs({children:e}){return c.jsxs("div",{className:"flex items-start gap-3 p-4 my-4 rounded-xl border border-primary-200 dark:border-primary-900/40 bg-primary-50/60 dark:bg-primary-900/10 text-sm text-gray-700 dark:text-gray-200",children:[c.jsx(sg,{size:18,className:"text-primary-600 dark:text-primary-400 shrink-0 mt-0.5"}),c.jsx("div",{className:"leading-relaxed",children:e})]})}function Qe({children:e}){return c.jsx("h3",{className:"text-xl font-semibold text-gray-900 dark:text-white mt-8 mb-3",children:e})}function vt({children:e}){return c.jsx("h4",{className:"text-base font-semibold text-gray-800 dark:text-gray-100 mt-6 mb-2",children:e})}function ge({children:e}){return c.jsx("p",{className:"text-gray-700 dark:text-gray-300 leading-relaxed",children:e})}function Ol({items:e}){return c.jsx("ul",{className:"space-y-2 my-4",children:e.map((t,n)=>c.jsxs("li",{className:"flex items-start gap-2 text-gray-700 dark:text-gray-300",children:[c.jsx("span",{className:"mt-2 w-1.5 h-1.5 rounded-full bg-primary-500 shrink-0"}),c.jsx("span",{className:"leading-relaxed",children:t})]},n))})}function H({children:e}){return c.jsx("code",{className:"px-1.5 py-0.5 rounded-md bg-gray-100 dark:bg-white/10 text-primary-700 dark:text-primary-300 text-[0.9em] font-mono",children:e})}function lh({available:e,dagger:t=!1}){return e?c.jsxs("span",{className:"inline-flex items-center gap-0.5 text-green-600 dark:text-green-400",children:[c.jsx(vu,{size:16,"aria-label":"Available"}),t&&c.jsx("sup",{className:"text-amber-600 dark:text-amber-400",children:"†"})]}):c.jsx(Su,{size:16,className:"inline text-gray-300 dark:text-gray-600","aria-label":"Not supported"})}function Vz(){const e=zz(Kb.map(t=>t.id));return c.jsxs("div",{className:"min-h-screen bg-white dark:bg-black transition-colors duration-300 selection:bg-primary-500 selection:text-white flex flex-col",children:[c.jsx(Hu,{}),c.jsx("main",{className:"flex-1 pt-24 pb-16 px-4 sm:px-6 lg:px-8",children:c.jsxs("div",{className:"max-w-7xl mx-auto",children:[c.jsxs("div",{className:"max-w-4xl mx-auto text-center mb-12",children:[c.jsxs("div",{className:"inline-flex items-center gap-2 px-3 py-1 rounded-full bg-primary-50 dark:bg-primary-900/20 text-primary-700 dark:text-primary-300 text-xs font-semibold tracking-wider uppercase mb-4",children:[c.jsx(Y0,{size:14}),"Tutorial"]}),c.jsx("h1",{className:"text-4xl sm:text-5xl lg:text-6xl font-extrabold tracking-tight text-gray-900 dark:text-white mb-4",children:"Sunbird AI API Tutorial"}),c.jsx("p",{className:"text-lg text-gray-600 dark:text-gray-400 max-w-2xl mx-auto leading-relaxed",children:"A comprehensive guide for using the Sunbird AI API with Python code samples — translate, transcribe, synthesize speech, and chat across 30+ African languages."})]}),c.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-[240px_minmax(0,1fr)] gap-10",children:[c.jsx("aside",{className:"hidden lg:block",children:c.jsxs("nav",{className:"sticky top-24 py-2",children:[c.jsx("div",{className:"text-xs font-semibold tracking-widest uppercase text-gray-500 dark:text-gray-400 mb-3 px-3",children:"On this page"}),c.jsx("ul",{className:"space-y-1",children:Kb.map(t=>{const n=e===t.id;return c.jsx("li",{children:c.jsxs("a",{href:`#${t.id}`,className:`block px-3 py-2 rounded-lg text-sm transition-colors border-l-2 ${n?"border-primary-500 text-primary-600 dark:text-primary-400 bg-primary-50 dark:bg-primary-900/10 font-medium":"border-transparent text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white hover:bg-gray-50 dark:hover:bg-white/5"}`,children:[t.part&&c.jsx("span",{className:"block text-[10px] font-semibold tracking-wider uppercase opacity-70",children:t.part}),t.label]})},t.id)})})]})}),c.jsxs("article",{className:"max-w-3xl space-y-16",children:[c.jsxs("section",{children:[c.jsx(Rn,{id:"overview",icon:mR,title:"Supported Languages"}),c.jsxs(ge,{children:["Sunbird AI provides AI services across English and a growing catalog of African languages. Languages are accepted as a 3-letter ISO code or a full language name. Coverage differs per endpoint: speech-to-text spans 51 African languages, chat and translation span 32 (",c.jsx(H,{children:"sunflower-14b"}),") or 67 (",c.jsx(H,{children:"sunflower-9b"}),"), and text-to-speech spans 20."]}),c.jsxs("div",{className:"flex flex-wrap gap-2 mt-6",children:[oz.map(t=>c.jsxs("div",{className:"px-3 py-1.5 rounded-full bg-white dark:bg-white/5 border border-gray-200 dark:border-white/10 text-sm text-gray-800 dark:text-gray-100",children:[t.name," ",c.jsxs("span",{className:"text-gray-400 dark:text-gray-500 font-mono text-xs",children:["(",t.code,")"]})]},t.code)),c.jsx("div",{className:"px-3 py-1.5 rounded-full bg-primary-50 dark:bg-primary-900/20 border border-primary-200 dark:border-primary-900/40 text-sm text-primary-700 dark:text-primary-300 font-medium",children:"+ 20 more"})]})]}),c.jsxs("section",{children:[c.jsx(Rn,{id:"language-support",icon:wR,title:"Language Support by Endpoint"}),c.jsxs(ge,{children:["Which languages each task endpoint currently serves. ",c.jsx("strong",{children:"Code"})," is the canonical ISO/SALT code the API accepts (full language names also work where an endpoint takes a"," ",c.jsx(H,{children:"language"})," or ",c.jsx(H,{children:"voice"}),"). The"," ",c.jsx(H,{children:"/tasks/audio/transcriptions"})," column covers all 51 African languages served by Sunbird's faster-whisper ASR model. The"," ",c.jsx(H,{children:"/tasks/chat/completions"})," column reflects the default"," ",c.jsx(H,{children:"sunflower-14b"})," model (English + 31 Ugandan/regional languages), which"," ",c.jsx(H,{children:"/tasks/translate"})," shares. The alternative"," ",c.jsx(H,{children:"sunflower-9b"})," model covers a broader set of 67 African languages — see"," ",c.jsx("a",{href:"#conversational-ai",className:"text-primary-600 dark:text-primary-400 hover:underline",children:"Part 6"})," ","for the per-model breakdown."]}),c.jsx("div",{className:"overflow-x-auto rounded-2xl border border-gray-200 dark:border-white/10 my-4",children:c.jsxs("table",{className:"w-full text-sm",children:[c.jsx("thead",{className:"bg-gray-50 dark:bg-white/5",children:c.jsxs("tr",{children:[c.jsx("th",{className:"text-left px-4 py-3 font-semibold text-gray-700 dark:text-gray-200",children:"Language"}),c.jsx("th",{className:"text-left px-4 py-3 font-semibold text-gray-700 dark:text-gray-200",children:"Code"}),c.jsxs("th",{className:"px-4 py-3 font-semibold text-gray-700 dark:text-gray-200",children:[c.jsx("div",{className:"text-center",children:"Text-to-Speech"}),c.jsx("div",{className:"text-center font-mono font-normal text-[11px] text-gray-400 dark:text-gray-500",children:"/tasks/audio/speech"})]}),c.jsxs("th",{className:"px-4 py-3 font-semibold text-gray-700 dark:text-gray-200",children:[c.jsx("div",{className:"text-center",children:"Speech-to-Text"}),c.jsx("div",{className:"text-center font-mono font-normal text-[11px] text-gray-400 dark:text-gray-500",children:"/tasks/audio/transcriptions"})]}),c.jsxs("th",{className:"px-4 py-3 font-semibold text-gray-700 dark:text-gray-200",children:[c.jsx("div",{className:"text-center",children:"Chat"}),c.jsx("div",{className:"text-center font-mono font-normal text-[11px] text-gray-400 dark:text-gray-500",children:"/tasks/chat/completions"})]})]})}),c.jsx("tbody",{children:iz.map((t,n)=>c.jsxs("tr",{className:n%2===0?"bg-white dark:bg-transparent":"bg-gray-50/50 dark:bg-white/[0.02]",children:[c.jsx("td",{className:"px-4 py-3 text-gray-700 dark:text-gray-300 whitespace-nowrap",children:t.name}),c.jsx("td",{className:"px-4 py-3 font-mono text-primary-700 dark:text-primary-400",children:t.code}),c.jsx("td",{className:"px-4 py-3 text-center",children:c.jsx(lh,{available:t.speech,dagger:t.ttsVoiceless})}),c.jsx("td",{className:"px-4 py-3 text-center",children:c.jsx(lh,{available:t.transcription})}),c.jsx("td",{className:"px-4 py-3 text-center",children:c.jsx(lh,{available:t.chat})})]},t.code))})]})}),c.jsxs(ge,{children:[c.jsx("strong",{children:"†"})," Lugbara, Sesotho, and Setswana are in the orpheus-3b-tts training mix but currently expose no individual voice IDs, so synthesis depends on a future voice release."]})]}),c.jsxs("section",{children:[c.jsx(Rn,{id:"authentication",icon:K0,part:"Part 1",title:"Authentication"}),c.jsx(Qe,{children:"Creating an Account"}),c.jsxs("ol",{className:"space-y-3 my-4 list-none counter-reset-item",children:[c.jsxs("li",{className:"flex items-start gap-3 text-gray-700 dark:text-gray-300",children:[c.jsx("span",{className:"flex items-center justify-center w-6 h-6 rounded-full bg-primary-600 text-white text-xs font-semibold shrink-0",children:"1"}),c.jsxs("span",{className:"leading-relaxed",children:["If you don't already have an account, create one at"," ",c.jsxs("a",{href:"https://api.sunbird.ai/register",target:"_blank",rel:"noopener noreferrer",className:"text-primary-600 dark:text-primary-400 hover:underline inline-flex items-center gap-1",children:["api.sunbird.ai/register",c.jsx(Hn,{size:12})]})]})]}),c.jsxs("li",{className:"flex items-start gap-3 text-gray-700 dark:text-gray-300",children:[c.jsx("span",{className:"flex items-center justify-center w-6 h-6 rounded-full bg-primary-600 text-white text-xs font-semibold shrink-0",children:"2"}),c.jsxs("span",{className:"leading-relaxed",children:["Go to the"," ",c.jsxs("a",{href:"https://api.sunbird.ai/keys",target:"_blank",rel:"noopener noreferrer",className:"text-primary-600 dark:text-primary-400 hover:underline inline-flex items-center gap-1",children:["tokens page",c.jsx(Hn,{size:12})]})," ","to get your access token / API key."]})]})]}),c.jsx(Qe,{children:"Using the Authentication API"}),c.jsx(vt,{children:"Register a New User"}),c.jsx(Ne,{code:hz,language:"python",label:"Python — register"}),c.jsx(vt,{children:"Get Access Token"}),c.jsx(Ne,{code:fz,language:"python",label:"Python — get token"})]}),c.jsxs("section",{children:[c.jsx(Rn,{id:"translation",icon:xR,part:"Part 2",title:"Translation (Sunflower Model)"}),c.jsxs(ge,{children:["Translate text between 32 Ugandan and East African languages using the Sunflower model. Languages are accepted as ISO 639-3 codes (",c.jsx(H,{children:"lug"}),") or full names (",c.jsx(H,{children:"Luganda"}),"), case-insensitively, and translation works between"," ",c.jsx("strong",{children:"any pair"})," of supported languages. ",c.jsx(H,{children:"source_language"})," is optional — when omitted, Sunflower infers it from the text."]}),c.jsx(Ne,{code:pz,language:"python",label:"Python — translate"}),c.jsx(vt,{children:"Optional source, full names"}),c.jsxs(ge,{children:[c.jsx(H,{children:"source_language"})," is optional, and full language names work too:"]}),c.jsx(Ne,{code:gz,language:"python",label:"Python — target only"}),c.jsx(vt,{children:"Supported languages (ISO code → name)"}),c.jsx(Ne,{code:mz,language:"python",label:"Python — language codes"}),c.jsx(vt,{children:"Response"}),c.jsx(ge,{children:"The response shape is unchanged from the previous NLLB-backed endpoint:"}),c.jsx(Ne,{code:yz,language:"json",label:"JSON — response"})]}),c.jsxs("section",{children:[c.jsx(Rn,{id:"speech-to-text",icon:q0,part:"Part 3",title:"Speech-to-Text (STT)"}),c.jsxs(ge,{children:["Convert speech audio to text. The unified"," ",c.jsx(H,{children:"POST /tasks/audio/transcriptions"})," endpoint is powered by Sunbird's faster-whisper ASR model covering ",c.jsx("strong",{children:"51 African languages"}),". Supports MP3, WAV, M4A, OGG, and more."]}),c.jsxs(Xs,{children:[c.jsx("strong",{children:"Migrating from the legacy STT routes?"})," ",c.jsx(H,{children:"/tasks/modal/stt"}),","," ",c.jsx(H,{children:"/tasks/stt"}),", ",c.jsx(H,{children:"/tasks/stt_from_gcs"}),", and"," ",c.jsx(H,{children:"/tasks/org/stt"})," are ",c.jsx("strong",{children:"deprecated"})," (they still work but return ",c.jsx(H,{children:"Deprecation"}),"/",c.jsx(H,{children:"Sunset"})," headers). Switch to"," ",c.jsx(H,{children:"/tasks/audio/transcriptions"}),"."]}),c.jsxs(Xs,{children:[c.jsx("strong",{children:"Breaking change."})," This endpoint previously accepted"," ",c.jsx(H,{children:"platform"}),", ",c.jsx(H,{children:"adapter"}),","," ",c.jsx(H,{children:"whisper"}),", ",c.jsx(H,{children:"recognise_speakers"}),","," ",c.jsx(H,{children:"org"}),", and ",c.jsx(H,{children:"gcs_blob_name"}),". Those parameters have been ",c.jsx("strong",{children:"removed"})," and are now rejected with ",c.jsx(H,{children:"422"}),". Speaker diarization and the organization workflow remain on the deprecated"," ",c.jsx(H,{children:"/tasks/org/stt"})," and ",c.jsx(H,{children:"/tasks/stt"})," routes."]}),c.jsx(Qe,{children:"Transcribe a file"}),c.jsxs(ge,{children:[c.jsx(H,{children:"audio"})," and ",c.jsx(H,{children:"language"})," are both"," ",c.jsx("strong",{children:"required"}),". The model reuses Whisper's language-token slots for African languages, which makes automatic language detection unreliable — always pass a language explicitly."]}),c.jsx(Ne,{code:xz,language:"python",label:"Python — transcribe"}),c.jsx(vt,{children:"Example response"}),c.jsx(Ne,{code:vz,language:"json",label:"JSON — response"}),c.jsx(Qe,{children:"Timestamped segments"}),c.jsxs(ge,{children:["Set ",c.jsx(H,{children:"timestamps=true"})," to also receive per-segment start/end times in"," ",c.jsx(H,{children:"segments"}),". It is ",c.jsx(H,{children:"false"})," by default, in which case ",c.jsx(H,{children:"segments"})," comes back as ",c.jsx(H,{children:"null"}),"."]}),c.jsx(Ne,{code:bz,language:"python",label:"Python — timestamps"}),c.jsx(Ne,{code:wz,language:"json",label:"JSON — response"}),c.jsx(vt,{children:"Supported languages (51)"}),c.jsx(ge,{children:"All ten languages served by the previous version of this endpoint are still supported."}),c.jsx("div",{className:"flex flex-wrap gap-2 my-4",children:az.map(t=>c.jsxs("div",{className:"px-3 py-1 rounded-full bg-white dark:bg-white/5 border border-gray-200 dark:border-white/10 text-xs text-gray-800 dark:text-gray-100",children:[t.name," ",c.jsxs("span",{className:"text-gray-400 font-mono",children:["(",t.code,")"]})]},t.code))}),c.jsxs(Xs,{children:[c.jsx("strong",{children:"Note:"})," For files larger than 100MB, only the first 10 minutes will be transcribed."]}),c.jsx(ge,{children:"The dictionary below represents the language codes available now for the STT endpoint:"}),c.jsx(Ne,{code:kz,language:"python",label:"Python — ASR language IDs"})]}),c.jsxs("section",{children:[c.jsx(Rn,{id:"language-detection",icon:_R,part:"Part 4",title:"Language Detection"}),c.jsx(ge,{children:"Automatically detect the language of text input. Useful for routing text to appropriate translation or processing pipelines."}),c.jsx(Ne,{code:Sz,language:"python",label:"Python — language ID"}),c.jsx(vt,{children:"Supported Languages"}),c.jsx(ge,{children:"Acholi, Ateso, English, Luganda, Lugbara, Runyankole."})]}),c.jsxs("section",{children:[c.jsx(Rn,{id:"text-to-speech",icon:X0,part:"Part 5",title:"Text-to-Speech (TTS)"}),c.jsxs(ge,{children:["Synthesize speech from text. The unified ",c.jsx(H,{children:"POST /tasks/audio/speech"})," ","endpoint replaces ",c.jsx(H,{children:"/tasks/modal/tts"}),","," ",c.jsx(H,{children:"/tasks/runpod/tts"}),", and"," ",c.jsx(H,{children:"/tasks/modal/orpheus/tts"}),". Two models are available:"]}),c.jsx(Ol,{items:[c.jsxs(c.Fragment,{children:[c.jsx(H,{children:"orpheus-3b-tts"})," (default) — multilingual, multi-speaker; voices are catalog tags (e.g. ",c.jsx(H,{children:"salt_lug_0001"}),"). List them with"," ",c.jsx(H,{children:"GET /tasks/voice/speakers"}),"."]}),c.jsxs(c.Fragment,{children:[c.jsx(H,{children:"spark-tts"})," — the six fixed Ugandan voices below; supports streaming on Modal."]})]}),c.jsxs(Xs,{children:[c.jsx("strong",{children:"Migrating?"})," The legacy TTS, streaming (",c.jsx(H,{children:"/stream"}),","," ",c.jsx(H,{children:"/stream-with-url"}),"), Orpheus batch, speaker-listing, and"," ",c.jsx(H,{children:"refresh-url"})," endpoints are ",c.jsx("strong",{children:"deprecated"}),". Use the unified endpoints below."]}),c.jsx(Qe,{children:"Single synthesis (orpheus-3b-tts, default)"}),c.jsx(Ne,{code:_z,language:"python",label:"Python — orpheus-3b-tts"}),c.jsx(vt,{children:"orpheus-3b-tts: languages covered"}),c.jsxs(ge,{children:["Speaker IDs encode both the source corpus (",c.jsx(H,{children:"salt_*"}),","," ",c.jsx(H,{children:"waxal_*"}),", ",c.jsx(H,{children:"slr32_*"}),","," ",c.jsx(H,{children:"slr129_*"}),", ",c.jsx(H,{children:"bateesa_*"}),") and the language. Languages shown with an em dash in the Speaker IDs column are present in the model's training mix but do not currently expose individual voice IDs in this checkpoint."]}),c.jsx("div",{className:"overflow-x-auto rounded-2xl border border-gray-200 dark:border-white/10 my-4",children:c.jsxs("table",{className:"w-full text-sm",children:[c.jsx("thead",{className:"bg-gray-50 dark:bg-white/5",children:c.jsxs("tr",{children:[c.jsx("th",{className:"text-left px-4 py-3 font-semibold text-gray-700 dark:text-gray-200",children:"Config"}),c.jsx("th",{className:"text-left px-4 py-3 font-semibold text-gray-700 dark:text-gray-200",children:"Language"}),c.jsx("th",{className:"text-left px-4 py-3 font-semibold text-gray-700 dark:text-gray-200",children:"ISO 639-1"}),c.jsx("th",{className:"text-left px-4 py-3 font-semibold text-gray-700 dark:text-gray-200",children:"Region"}),c.jsx("th",{className:"text-left px-4 py-3 font-semibold text-gray-700 dark:text-gray-200",children:"Speaker IDs"})]})}),c.jsx("tbody",{children:lz.map((t,n)=>c.jsxs("tr",{className:n%2===0?"bg-white dark:bg-transparent":"bg-gray-50/50 dark:bg-white/[0.02]",children:[c.jsx("td",{className:"px-4 py-3 align-top font-mono text-primary-700 dark:text-primary-400",children:t.config}),c.jsx("td",{className:"px-4 py-3 align-top text-gray-700 dark:text-gray-300 whitespace-nowrap",children:t.language}),c.jsx("td",{className:"px-4 py-3 align-top font-mono text-gray-500 dark:text-gray-400",children:t.iso}),c.jsx("td",{className:"px-4 py-3 align-top text-gray-600 dark:text-gray-400",children:t.region}),c.jsx("td",{className:"px-4 py-3 align-top text-gray-700 dark:text-gray-300",children:t.speakers.length===0?c.jsx("span",{className:"text-gray-400 dark:text-gray-500",children:"—"}):c.jsx("div",{className:"flex flex-wrap gap-1",children:t.speakers.map(r=>c.jsx("code",{className:"px-1.5 py-0.5 rounded-md bg-gray-100 dark:bg-white/10 text-primary-700 dark:text-primary-300 text-xs font-mono",children:r},r))})})]},t.config))})]})}),c.jsxs(ge,{children:["Per-language quality scales with the amount of training data Sunbird collected for that language. Audition the voices for each language before relying on a particular speaker — use the discovery snippet under ",c.jsx("strong",{children:"Listing voices"})," below."]}),c.jsx(Qe,{children:"Single synthesis (spark-tts, fixed voices)"}),c.jsx(Ne,{code:jz,language:"python",label:"Python — spark-tts"}),c.jsx(vt,{children:"spark-tts voices"}),c.jsx("div",{className:"overflow-hidden rounded-2xl border border-gray-200 dark:border-white/10 my-4",children:c.jsxs("table",{className:"w-full text-sm",children:[c.jsx("thead",{className:"bg-gray-50 dark:bg-white/5",children:c.jsxs("tr",{children:[c.jsx("th",{className:"text-left px-4 py-3 font-semibold text-gray-700 dark:text-gray-200",children:"Voice name"}),c.jsx("th",{className:"text-left px-4 py-3 font-semibold text-gray-700 dark:text-gray-200",children:"ID"}),c.jsx("th",{className:"text-left px-4 py-3 font-semibold text-gray-700 dark:text-gray-200",children:"Description"})]})}),c.jsx("tbody",{children:cz.map((t,n)=>c.jsxs("tr",{className:n%2===0?"bg-white dark:bg-transparent":"bg-gray-50/50 dark:bg-white/[0.02]",children:[c.jsx("td",{className:"px-4 py-3 font-mono text-primary-700 dark:text-primary-400",children:t.name}),c.jsx("td",{className:"px-4 py-3 font-mono text-gray-700 dark:text-gray-300",children:t.id}),c.jsx("td",{className:"px-4 py-3 text-gray-700 dark:text-gray-300",children:t.description})]},t.id))})]})}),c.jsx(Qe,{children:"Response Modes"}),c.jsxs(ge,{children:[c.jsx(H,{children:"response_mode"})," applies to ",c.jsx("strong",{children:"spark-tts on Modal"}),":"]}),c.jsx(Ol,{items:uz.map(t=>c.jsxs(c.Fragment,{children:[c.jsx(H,{children:t.mode})," — ",t.description]}))}),c.jsx(Qe,{children:"Listing voices"}),c.jsx(Ne,{code:Cz,language:"python",label:"Python — list voices"}),c.jsx(Qe,{children:"Batch synthesis (orpheus-3b-tts)"}),c.jsx(ge,{children:"Synthesize up to 128 items in a single request:"}),c.jsx(Ne,{code:Nz,language:"python",label:"Python — batch"}),c.jsx(Qe,{children:"Refreshing an expired URL"}),c.jsxs(ge,{children:["Signed URLs expire after ~30 minutes. Re-sign a stored object with"," ",c.jsx(H,{children:"GET /tasks/audio/speech/url"}),":"]}),c.jsx(Ne,{code:Pz,language:"python",label:"Python — refresh URL"}),c.jsx(vt,{children:"Example response (POST /tasks/audio/speech)"}),c.jsx(Ne,{code:Rz,language:"json",label:"JSON — response"})]}),c.jsxs("section",{children:[c.jsx(Rn,{id:"conversational-ai",icon:Jl,part:"Part 6",title:"Conversational AI (Sunflower)"}),c.jsxs(ge,{children:["The Sunflower models provide conversational AI for African languages through an OpenAI-compatible endpoint: ",c.jsx(H,{children:"POST /tasks/chat/completions"}),". The request and response formats mirror the OpenAI Chat Completions API, so you can move between the OpenAI API and the Sunbird API by changing only the base URL and API key."]}),c.jsxs(Xs,{children:[c.jsx("strong",{children:"Deprecated:"})," ",c.jsx(H,{children:"POST /tasks/sunflower_inference"})," and"," ",c.jsx(H,{children:"POST /tasks/sunflower_simple"})," are deprecated and will be removed in a future release. Use ",c.jsx(H,{children:"POST /tasks/chat/completions"})," instead — a single instruction is just a request with one user message."]}),c.jsx(Qe,{children:"Choosing a model"}),c.jsxs(ge,{children:["Select a model with the ",c.jsx(H,{children:"model"})," field. Two models are available;"," ",c.jsx(H,{children:"sunflower-14b"})," is the default when ",c.jsx(H,{children:"model"})," is omitted. The old ",c.jsx(H,{children:"Sunbird/Sunflower-14B"})," identifier is no longer accepted — sending it returns a ",c.jsx(H,{children:"400"})," error asking you to use"," ",c.jsx(H,{children:"sunflower-14b"})," instead."]}),c.jsx("div",{className:"overflow-x-auto rounded-2xl border border-gray-200 dark:border-white/10 my-4",children:c.jsxs("table",{className:"w-full text-sm",children:[c.jsx("thead",{className:"bg-gray-50 dark:bg-white/5",children:c.jsxs("tr",{children:[c.jsx("th",{className:"text-left px-4 py-3 font-semibold text-gray-700 dark:text-gray-200",children:"model"}),c.jsx("th",{className:"text-left px-4 py-3 font-semibold text-gray-700 dark:text-gray-200",children:"Coverage"}),c.jsx("th",{className:"text-left px-4 py-3 font-semibold text-gray-700 dark:text-gray-200",children:"Best for"})]})}),c.jsx("tbody",{children:Oz.map((t,n)=>c.jsxs("tr",{className:n%2===0?"bg-white dark:bg-transparent":"bg-gray-50/50 dark:bg-white/[0.02]",children:[c.jsxs("td",{className:"px-4 py-3 align-top font-mono text-primary-700 dark:text-primary-400 whitespace-nowrap",children:[t.model,t.isDefault&&c.jsx("span",{className:"ml-2 text-[10px] font-sans font-semibold uppercase tracking-wider text-gray-400 dark:text-gray-500",children:"default"})]}),c.jsx("td",{className:"px-4 py-3 align-top text-gray-700 dark:text-gray-300",children:t.coverage}),c.jsx("td",{className:"px-4 py-3 align-top text-gray-600 dark:text-gray-400",children:t.bestFor})]},t.model))})]})}),c.jsx(vt,{children:"sunflower-14b — supported languages"}),c.jsx(ge,{children:"English plus 31 Ugandan and regional languages (32 total):"}),c.jsx("div",{className:"flex flex-wrap gap-2 my-4",children:Dz.map(t=>c.jsxs("div",{className:"px-3 py-1 rounded-full bg-white dark:bg-white/5 border border-gray-200 dark:border-white/10 text-xs text-gray-800 dark:text-gray-100",children:[t.name," ",c.jsxs("span",{className:"text-gray-400 font-mono",children:["(",t.code,")"]})]},t.code))}),c.jsx(vt,{children:"sunflower-9b — supported languages"}),c.jsx(ge,{children:"67 African languages, grouped by the model's understanding tier (per-language quality scales with available training data):"}),c.jsx(Ol,{items:Iz.map(t=>c.jsxs(c.Fragment,{children:[c.jsxs("strong",{children:[t.tier,":"]})," ",t.languages,"."]}))}),c.jsxs(ge,{children:["Full evaluations and language codes are on the model pages:"," ",c.jsx("a",{href:"https://salt.sunbird.ai/models/sunflower-14b",target:"_blank",rel:"noopener noreferrer",className:"text-primary-600 dark:text-primary-400 hover:underline",children:"sunflower-14b"})," ","and"," ",c.jsx("a",{href:"https://salt.sunbird.ai/models/sunflower-qwen3.5-9b/",target:"_blank",rel:"noopener noreferrer",className:"text-primary-600 dark:text-primary-400 hover:underline",children:"sunflower-qwen3.5-9b"}),"."]}),c.jsx(Qe,{children:"Chat Completion"}),c.jsx(Ne,{code:Ez,language:"python",label:"Python — chat completions"}),c.jsx(vt,{children:"Example Response"}),c.jsx(Ne,{code:Tz,language:"json",label:"JSON — response"}),c.jsx(Qe,{children:"Using the OpenAI SDK"}),c.jsx(ge,{children:"Because the endpoint is OpenAI-compatible, the official OpenAI Python SDK works out of the box:"}),c.jsx(Ne,{code:Az,language:"python",label:"Python — OpenAI SDK"}),c.jsx(Qe,{children:"Multi-turn Conversations"}),c.jsxs(ge,{children:["Maintain context by sending the running message history. You can also set a custom"," ",c.jsx(H,{children:"system"})," message (when omitted, a default Sunflower system message is applied):"]}),c.jsx(Ne,{code:Mz,language:"python",label:"Python — multi-turn"}),c.jsx(Qe,{children:"Streaming"}),c.jsxs(ge,{children:["Set ",c.jsx(H,{children:'"stream": true'})," to receive Server-Sent Events in OpenAI"," ",c.jsx(H,{children:"chat.completion.chunk"})," format, terminated by"," ",c.jsx(H,{children:"data: [DONE]"}),". With the OpenAI SDK:"]}),c.jsx(Ne,{code:Lz,language:"python",label:"Python — streaming"}),c.jsxs(Xs,{children:["Supported request parameters: ",c.jsx(H,{children:"model"})," (",c.jsx(H,{children:"sunflower-14b"})," or ",c.jsx(H,{children:"sunflower-9b"}),"; the old"," ",c.jsx(H,{children:"Sunbird/Sunflower-14B"})," identifier is no longer accepted),"," ",c.jsx(H,{children:"messages"}),", ",c.jsx(H,{children:"temperature"})," (0.0–2.0, default 0.3),"," ",c.jsx(H,{children:"max_tokens"}),", ",c.jsx(H,{children:"top_p"}),", ",c.jsx(H,{children:"stop"}),", and ",c.jsx(H,{children:"stream"}),"."]})]}),c.jsxs("section",{children:[c.jsx(Rn,{id:"file-upload",icon:ER,part:"Part 7",title:"File Upload (Signed URLs)"}),c.jsx(ge,{children:"Generate secure signed URLs for direct client uploads to GCP Storage. Useful for uploading audio files before transcription."}),c.jsx(Ne,{code:Fz,language:"python",label:"Python — signed URL upload"}),c.jsx(vt,{children:"Features"}),c.jsx(Ol,{items:dz})]}),c.jsxs("section",{children:[c.jsx(Rn,{id:"resources",icon:G0,title:"Additional Resources"}),c.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 my-4",children:[c.jsxs("a",{href:"https://docs.sunbird.ai/introduction",target:"_blank",rel:"noopener noreferrer",className:"group p-5 rounded-2xl bg-white dark:bg-white/5 border border-gray-200 dark:border-white/10 hover:border-primary-500 dark:hover:border-primary-500 transition-all hover:shadow-lg",children:[c.jsxs("div",{className:"flex items-center gap-2 text-gray-900 dark:text-white font-semibold mb-1",children:[c.jsx(Mc,{size:18,className:"text-primary-600 dark:text-primary-400"}),"API Documentation",c.jsx(Hn,{size:14,className:"text-gray-400 group-hover:text-primary-500 transition-colors"})]}),c.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400 font-mono",children:"docs.sunbird.ai/introduction"})]}),c.jsxs("a",{href:"https://api.sunbird.ai/openapi.json",target:"_blank",rel:"noopener noreferrer",className:"group p-5 rounded-2xl bg-white dark:bg-white/5 border border-gray-200 dark:border-white/10 hover:border-primary-500 dark:hover:border-primary-500 transition-all hover:shadow-lg",children:[c.jsxs("div",{className:"flex items-center gap-2 text-gray-900 dark:text-white font-semibold mb-1",children:[c.jsx(G0,{size:18,className:"text-primary-600 dark:text-primary-400"}),"OpenAPI Specification",c.jsx(Hn,{size:14,className:"text-gray-400 group-hover:text-primary-500 transition-colors"})]}),c.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400 font-mono",children:"api.sunbird.ai/openapi.json"})]}),c.jsxs("a",{href:"https://docs.sunbird.ai/api-reference/introduction",target:"_blank",rel:"noopener noreferrer",className:"group p-5 rounded-2xl bg-white dark:bg-white/5 border border-gray-200 dark:border-white/10 hover:border-primary-500 dark:hover:border-primary-500 transition-all hover:shadow-lg",children:[c.jsxs("div",{className:"flex items-center gap-2 text-gray-900 dark:text-white font-semibold mb-1",children:[c.jsx(Y0,{size:18,className:"text-primary-600 dark:text-primary-400"}),"Usage Guide",c.jsx(Hn,{size:14,className:"text-gray-400 group-hover:text-primary-500 transition-colors"})]}),c.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400 font-mono",children:"docs.sunbird.ai/api-reference/introduction"})]}),c.jsxs("a",{href:"https://github.com/SunbirdAI/sunbird-ai-api/issues",target:"_blank",rel:"noopener noreferrer",className:"group p-5 rounded-2xl bg-white dark:bg-white/5 border border-gray-200 dark:border-white/10 hover:border-primary-500 dark:hover:border-primary-500 transition-all hover:shadow-lg",children:[c.jsxs("div",{className:"flex items-center gap-2 text-gray-900 dark:text-white font-semibold mb-1",children:[c.jsx(Jl,{size:18,className:"text-primary-600 dark:text-primary-400"}),"Feedback & Issues",c.jsx(Hn,{size:14,className:"text-gray-400 group-hover:text-primary-500 transition-colors"})]}),c.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400 font-mono",children:"github.com/SunbirdAI"})]})]}),c.jsx(Qe,{children:"Interactive Notebooks"}),c.jsx(ge,{children:"Prefer to explore in code? These Google Colab notebooks let you test Sunbird AI's models directly — either by running the models yourself or by calling the API. Open any notebook, add your access token where prompted, and run the cells."}),c.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 my-4",children:[{title:"Sunbird AI APIs — Hands-on (Interactive)",desc:"Call every API endpoint with interactive widgets",href:"https://colab.research.google.com/drive/1h02U5CcPScD2JCcEMBuzQv0Yx2BdzXlq?usp=sharing",icon:gR},{title:"Sunbird AI APIs — Non-Interactive",desc:"The same API walkthrough as plain code cells",href:"https://colab.research.google.com/drive/155GQaCFeZ8zhy9CCdEGWTubQTgibrGji?usp=sharing",icon:hR},{title:"Sunflower-Qwen3.5-9B Inference",desc:"Run the sunflower-9b model directly in Colab",href:"https://colab.research.google.com/drive/1hz7NfcA2GgkS-h6wTZ--6tS_IGtwTEEj?usp=sharing",icon:Jl},{title:"Sunflower Gemma 4 E2B — Text & Speech",desc:"Multimodal text and speech demo",href:"https://colab.research.google.com/drive/1P39eYR_KW16oH8tBzycjHG86RfxiRKMJ?usp=sharing",icon:X0},{title:"ASR for 51 African Languages",desc:"Automatic speech recognition across 51 languages",href:"https://colab.research.google.com/drive/1Bs2P3ULkj9zftPItuS2JnjzkFX8cgyz1?usp=sharing",icon:q0}].map(t=>{const n=t.icon;return c.jsxs("a",{href:t.href,target:"_blank",rel:"noopener noreferrer",className:"group p-5 rounded-2xl bg-white dark:bg-white/5 border border-gray-200 dark:border-white/10 hover:border-primary-500 dark:hover:border-primary-500 transition-all hover:shadow-lg",children:[c.jsxs("div",{className:"flex items-center gap-2 text-gray-900 dark:text-white font-semibold mb-1",children:[c.jsx(n,{size:18,className:"text-primary-600 dark:text-primary-400 shrink-0"}),t.title,c.jsx(Hn,{size:14,className:"text-gray-400 group-hover:text-primary-500 transition-colors shrink-0"})]}),c.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:t.desc}),c.jsx("div",{className:"mt-1 text-xs text-gray-400 dark:text-gray-500 font-mono",children:"Open in Google Colab"})]},t.href)})}),c.jsx(Qe,{children:"Rate Limiting"}),c.jsx(ge,{children:"API endpoints are rate-limited to ensure fair usage. If you need higher rate limits for production use, please contact the Sunbird AI team."}),c.jsx(Qe,{children:"Feedback and Questions"}),c.jsxs(ge,{children:["Don't hesitate to leave us any feedback or questions by opening an"," ",c.jsx("a",{href:"https://github.com/SunbirdAI/sunbird-ai-api/issues",target:"_blank",rel:"noopener noreferrer",className:"text-primary-600 dark:text-primary-400 hover:underline",children:"issue on GitHub"}),"."]})]}),c.jsxs("section",{className:"mt-16 p-8 rounded-3xl bg-gradient-to-br from-primary-50 to-primary-100/40 dark:from-primary-900/20 dark:to-primary-900/5 border border-primary-200 dark:border-primary-900/40",children:[c.jsx("h3",{className:"text-2xl font-bold text-gray-900 dark:text-white mb-2",children:"Ready to build?"}),c.jsx("p",{className:"text-gray-700 dark:text-gray-300 mb-5",children:"Get your access token and start calling the Sunbird AI API in minutes."}),c.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[c.jsxs(Ee,{to:"/register",className:"inline-flex items-center justify-center gap-2 px-6 py-3 rounded-xl bg-primary-600 hover:bg-primary-700 text-white font-semibold transition-all shadow-lg shadow-primary-500/20",children:["Create Account",c.jsx(hf,{size:18})]}),c.jsxs(Ee,{to:"/keys",className:"inline-flex items-center justify-center gap-2 px-6 py-3 rounded-xl bg-white dark:bg-white/5 hover:bg-gray-50 dark:hover:bg-white/10 border border-gray-200 dark:border-white/10 text-gray-900 dark:text-white font-semibold transition-all",children:[c.jsx(K0,{size:18}),"Get API Keys"]})]})]})]})]})]})}),c.jsx(Uu,{})]})}function st({title:e,children:t}){return S.useEffect(()=>{document.title=`${e} | Sunbird AI API`},[e]),c.jsx(c.Fragment,{children:t})}function hr({children:e}){const{isAuthenticated:t,isLoading:n}=Qr(),r=ar();return n?c.jsxs("div",{className:"min-h-screen flex items-center justify-center",children:[c.jsx(Da,{size:24,className:"animate-spin mr-2"}),"Loading..."]}):t?e:c.jsx(y1,{to:"/login",state:{from:r},replace:!0})}function Bz(){const{user:e}=Qr();return(e==null?void 0:e.account_type)==="Admin"?c.jsx(y1,{to:"/admin/analytics",replace:!0}):c.jsx(hI,{})}function $z(){return c.jsxs($N,{children:[c.jsx(Je,{path:"/",element:c.jsx(st,{title:"Home",children:c.jsx(H6,{})})}),c.jsx(Je,{path:"/login",element:c.jsx(st,{title:"Login",children:c.jsx(Tb,{})})}),c.jsx(Je,{path:"/register",element:c.jsx(st,{title:"Register",children:c.jsx(W6,{})})}),c.jsx(Je,{path:"/forgot-password",element:c.jsx(st,{title:"Forgot Password",children:c.jsx(G6,{})})}),c.jsx(Je,{path:"/reset-password",element:c.jsx(st,{title:"Reset Password",children:c.jsx(K6,{})})}),c.jsx(Je,{path:"/privacy_policy",element:c.jsx(st,{title:"Privacy Policy",children:c.jsx(X6,{})})}),c.jsx(Je,{path:"/terms_of_service",element:c.jsx(st,{title:"Terms of Service",children:c.jsx(Q6,{})})}),c.jsx(Je,{path:"/tutorial",element:c.jsx(st,{title:"Tutorial",children:c.jsx(Vz,{})})}),c.jsx(Je,{path:"/setup-organization",element:c.jsx(st,{title:"Setup Organization",children:c.jsx(Tb,{})})})," ",c.jsx(Je,{path:"/complete-profile",element:c.jsx(hr,{children:c.jsx(st,{title:"Complete Profile",children:c.jsx(Y6,{})})})}),c.jsx(Je,{path:"/dashboard",element:c.jsx(hr,{children:c.jsx(ts,{children:c.jsx(st,{title:"Dashboard",children:c.jsx(Bz,{})})})})}),c.jsx(Je,{path:"/keys",element:c.jsx(hr,{children:c.jsx(ts,{children:c.jsx(st,{title:"API Keys",children:c.jsx(f6,{})})})})}),c.jsx(Je,{path:"/account",element:c.jsx(hr,{children:c.jsx(ts,{children:c.jsx(st,{title:"Account Settings",children:c.jsx(g6,{})})})})}),c.jsx(Je,{path:"/admin/analytics",element:c.jsx(hr,{children:c.jsx(ts,{children:c.jsx(st,{title:"Admin Analytics",children:c.jsx(k6,{})})})})}),c.jsx(Je,{path:"/admin/billing",element:c.jsx(hr,{children:c.jsx(ts,{children:c.jsx(st,{title:"Infrastructure Billing",children:c.jsx(E6,{})})})})}),c.jsx(Je,{path:"/admin/google-analytics",element:c.jsx(hr,{children:c.jsx(ts,{children:c.jsx(st,{title:"Google Analytics",children:c.jsx(z6,{})})})})}),c.jsx(Je,{path:"/admin/engagement-insights",element:c.jsx(hr,{children:c.jsx(ts,{children:c.jsx(st,{title:"Website & Engagement Funnel",children:c.jsx($6,{})})})})})]})}function Hz(){return c.jsx(XN,{children:c.jsx(aR,{defaultTheme:"system",storageKey:"sunbird-ui-theme",children:c.jsxs(oR,{children:[c.jsx($z,{}),c.jsx(CP,{position:"top-right",richColors:!0})]})})})}ch.createRoot(document.getElementById("root")).render(c.jsx(z.StrictMode,{children:c.jsx(Hz,{})})); diff --git a/app/static/react_build/index.html b/app/static/react_build/index.html index cd19060d..b359216e 100644 --- a/app/static/react_build/index.html +++ b/app/static/react_build/index.html @@ -5,7 +5,7 @@ Sunbird AI API - + diff --git a/app/tests/test_asr_service.py b/app/tests/test_asr_service.py new file mode 100644 index 00000000..cafdcbec --- /dev/null +++ b/app/tests/test_asr_service.py @@ -0,0 +1,159 @@ +"""Unit tests for ASRService, the client for the Sunbird 51-language ASR model.""" + +import httpx +import pytest + +from app.core.exceptions import ExternalServiceError +from app.services.asr_service import ASRService + + +@pytest.fixture +def mock_transport(monkeypatch): + """Route every httpx.AsyncClient request through a supplied handler.""" + + def install(handler): + transport = httpx.MockTransport(handler) + original_init = httpx.AsyncClient.__init__ + + def patched_init(self, *args, **kwargs): + kwargs["transport"] = transport + original_init(self, *args, **kwargs) + + monkeypatch.setattr(httpx.AsyncClient, "__init__", patched_init) + + return install + + +@pytest.fixture +def service() -> ASRService: + return ASRService( + base_url="https://asr.test/v1/", + model="sunbird-asr-51", + api_key="secret", + timeout=5, + ) + + +def test_base_url_is_normalized(service: ASRService): + """A trailing slash must not produce a double slash in the request URL.""" + assert service.base_url == "https://asr.test/v1" + assert service.transcriptions_url == "https://asr.test/v1/audio/transcriptions" + + +async def test_transcribe_sends_expected_request(service: ASRService, mock_transport): + captured = {} + + def handler(request: httpx.Request) -> httpx.Response: + captured["url"] = str(request.url) + captured["auth"] = request.headers.get("authorization") + captured["body"] = request.content + return httpx.Response(200, json={"text": "gyebaleko", "language": "lug"}) + + mock_transport(handler) + result = await service.transcribe( + audio_bytes=b"RIFFfake", language="lug", filename="a.wav" + ) + + assert result.text == "gyebaleko" + assert result.language == "lug" + assert captured["url"] == "https://asr.test/v1/audio/transcriptions" + assert captured["auth"] == "Bearer secret" + body = captured["body"] + assert b"sunbird-asr-51" in body + assert b"lug" in body + # timestamps defaults to False -> plain json, no granularity field + assert b"verbose_json" not in body + assert b"timestamp_granularities" not in body + + +async def test_transcribe_requests_verbose_json_for_timestamps( + service: ASRService, mock_transport +): + captured = {} + + def handler(request: httpx.Request) -> httpx.Response: + captured["body"] = request.content + return httpx.Response( + 200, + json={ + "text": "gyebaleko ssebo", + "language": "lug", + "duration": 2.25, + "segments": [ + {"start": 0.0, "end": 1.0, "text": " gyebaleko"}, + {"start": 1.0, "end": 2.25, "text": " ssebo"}, + ], + }, + ) + + mock_transport(handler) + result = await service.transcribe( + audio_bytes=b"RIFFfake", language="lug", timestamps=True + ) + + assert b"verbose_json" in captured["body"] + assert b"timestamp_granularities" in captured["body"] + assert result.duration == 2.25 + assert [s.text for s in result.segments] == ["gyebaleko", "ssebo"] + assert result.segments[1].start == 1.0 + + +async def test_language_falls_back_when_absent_from_body( + service: ASRService, mock_transport +): + mock_transport(lambda request: httpx.Response(200, json={"text": "hi"})) + result = await service.transcribe(audio_bytes=b"x", language="ach") + assert result.language == "ach" + + +async def test_http_error_raises_external_service_error( + service: ASRService, mock_transport +): + mock_transport(lambda request: httpx.Response(500, text="upstream exploded")) + with pytest.raises(ExternalServiceError) as exc: + await service.transcribe(audio_bytes=b"x", language="lug") + assert "upstream exploded" in str(exc.value.message) + + +async def test_malformed_body_raises_external_service_error( + service: ASRService, mock_transport +): + mock_transport(lambda request: httpx.Response(200, json={"unexpected": "shape"})) + with pytest.raises(ExternalServiceError): + await service.transcribe(audio_bytes=b"x", language="lug") + + +async def test_timeout_raises_external_service_error( + service: ASRService, mock_transport +): + def handler(request: httpx.Request) -> httpx.Response: + raise httpx.ReadTimeout("too slow", request=request) + + mock_transport(handler) + with pytest.raises(ExternalServiceError) as exc: + await service.transcribe(audio_bytes=b"x", language="lug") + assert "timed out" in str(exc.value.message) + + +async def test_connection_error_raises_external_service_error( + service: ASRService, mock_transport +): + def handler(request: httpx.Request) -> httpx.Response: + raise httpx.ConnectError("no route", request=request) + + mock_transport(handler) + with pytest.raises(ExternalServiceError) as exc: + await service.transcribe(audio_bytes=b"x", language="lug") + assert "connect" in str(exc.value.message).lower() + + +async def test_health_check_true_when_reachable(service: ASRService, mock_transport): + mock_transport(lambda request: httpx.Response(200, json={"data": []})) + assert await service.health_check() is True + + +async def test_health_check_false_when_upstream_errors( + service: ASRService, mock_transport +): + mock_transport(lambda request: httpx.Response(503, text="down")) + assert await service.health_check() is False diff --git a/app/tests/test_audio_transcriptions.py b/app/tests/test_audio_transcriptions.py index 918a2486..b36328d6 100644 --- a/app/tests/test_audio_transcriptions.py +++ b/app/tests/test_audio_transcriptions.py @@ -1,4 +1,9 @@ -"""Integration tests for the unified POST /tasks/audio/transcriptions endpoint.""" +"""Integration tests for the unified POST /tasks/audio/transcriptions endpoint. + +The endpoint is backed by the Sunbird 51-African-language faster-whisper +deployment; the platform/adapter/diarization/GCS parameters of the previous +implementation were removed. +""" import io from typing import Dict @@ -8,8 +13,9 @@ from httpx import AsyncClient from app.api import app -from app.deps import get_transcription_service -from app.services.stt_service import TranscriptionResult +from app.core.exceptions import ExternalServiceError +from app.deps import get_asr_service +from app.services.asr_service import ASRResult, ASRSegment @pytest.fixture(autouse=True) @@ -28,145 +34,167 @@ async def noop_save(*args, **kwargs): yield +@pytest.fixture(autouse=True) +def stub_storage(monkeypatch): + """Stub the GCS upload so tests never touch cloud storage.""" + import app.routers.audio as audio_module + + monkeypatch.setattr( + audio_module, + "upload_audio_file", + lambda file_path: ("a.wav", "gs://bucket/a.wav"), + raising=False, + ) + yield + + @pytest.fixture -def fake_facade(): - """Override the facade dependency with a mock; restore afterward.""" - facade = MagicMock() - facade.validate_and_normalize = MagicMock(return_value=(False, False)) - facade.transcribe = AsyncMock( - return_value=TranscriptionResult( - transcription="hello world", - diarization_output={}, - formatted_diarization_output="", - audio_url="gs://bucket/a.wav", - blob_name="a.wav", +def fake_asr(): + """Override the ASR service dependency with a mock; restore afterward.""" + service = MagicMock() + service.transcribe = AsyncMock( + return_value=ASRResult( + text="hello world", + language="lug", + duration=3.5, + segments=[ASRSegment(start=0.0, end=3.5, text="hello world")], ) ) - app.dependency_overrides[get_transcription_service] = lambda: facade - yield facade - app.dependency_overrides.pop(get_transcription_service, None) + app.dependency_overrides[get_asr_service] = lambda: service + yield service + app.dependency_overrides.pop(get_asr_service, None) def audio_part(): return {"audio": ("sample.wav", io.BytesIO(b"RIFFfake"), "audio/wav")} -async def test_modal_upload_returns_200( - authenticated_client: AsyncClient, fake_facade, test_user: Dict +async def test_upload_returns_200_and_transcript( + authenticated_client: AsyncClient, fake_asr, test_user: Dict ): resp = await authenticated_client.post( "/tasks/audio/transcriptions", - data={"language": "lug", "platform": "modal"}, + data={"language": "lug"}, files=audio_part(), ) assert resp.status_code == 200 - assert resp.json()["audio_transcription"] == "hello world" - assert resp.json()["audio_transcription_id"] is None - _, kwargs = fake_facade.transcribe.call_args - assert kwargs["platform"] == "modal" + body = resp.json() + assert body["audio_transcription"] == "hello world" + assert body["language"] == "lug" + assert body["duration_seconds"] == 3.5 + _, kwargs = fake_asr.transcribe.call_args + assert kwargs["language"] == "lug" + assert kwargs["timestamps"] is False -async def test_runpod_upload_defaults_flags_false( - authenticated_client: AsyncClient, fake_facade, test_user: Dict + +async def test_segments_omitted_unless_requested( + authenticated_client: AsyncClient, fake_asr, test_user: Dict ): - """Omitted whisper/recognise_speakers default to False at the HTTP layer.""" resp = await authenticated_client.post( "/tasks/audio/transcriptions", - data={"language": "lug", "platform": "runpod"}, + data={"language": "lug"}, files=audio_part(), ) assert resp.status_code == 200 - _, vkwargs = fake_facade.validate_and_normalize.call_args - assert vkwargs["whisper"] is False - assert vkwargs["recognise_speakers"] is False - _, tkwargs = fake_facade.transcribe.call_args - assert tkwargs["platform"] == "runpod" + assert resp.json()["segments"] is None -async def test_runpod_upload_forwards_flags_when_set( - authenticated_client: AsyncClient, fake_facade, test_user: Dict +async def test_segments_returned_when_timestamps_true( + authenticated_client: AsyncClient, fake_asr, test_user: Dict ): - """Explicit whisper/recognise_speakers are forwarded to the facade.""" resp = await authenticated_client.post( "/tasks/audio/transcriptions", - data={ - "language": "lug", - "platform": "runpod", - "whisper": "true", - "recognise_speakers": "true", - }, + data={"language": "lug", "timestamps": "true"}, files=audio_part(), ) assert resp.status_code == 200 - _, vkwargs = fake_facade.validate_and_normalize.call_args - assert vkwargs["whisper"] is True - assert vkwargs["recognise_speakers"] is True + segments = resp.json()["segments"] + assert segments == [{"start": 0.0, "end": 3.5, "text": "hello world"}] + + _, kwargs = fake_asr.transcribe.call_args + assert kwargs["timestamps"] is True -async def test_runpod_gcs_returns_200( - authenticated_client: AsyncClient, fake_facade, test_user: Dict +async def test_transcription_is_persisted( + authenticated_client: AsyncClient, fake_asr, test_user: Dict ): resp = await authenticated_client.post( "/tasks/audio/transcriptions", - data={ - "language": "lug", - "platform": "runpod", - "gcs_blob_name": "audio/file.wav", - }, + data={"language": "lug"}, + files=audio_part(), ) assert resp.status_code == 200 - _, kwargs = fake_facade.transcribe.call_args - assert kwargs["gcs_blob_name"] == "audio/file.wav" + assert isinstance(resp.json()["audio_transcription_id"], int) + assert resp.json()["audio_url"] == "gs://bucket/a.wav" -async def test_invalid_combo_returns_400( - authenticated_client: AsyncClient, test_user: Dict +async def test_new_language_beyond_legacy_set_is_accepted( + authenticated_client: AsyncClient, fake_asr, test_user: Dict ): - """A real facade should reject modal+gcs with 400 (no override here).""" + """Codes the old 10-language enum rejected (e.g. Zulu) now work.""" resp = await authenticated_client.post( "/tasks/audio/transcriptions", - data={ - "language": "lug", - "platform": "modal", - "gcs_blob_name": "audio/file.wav", - }, + data={"language": "zul"}, + files=audio_part(), ) - assert resp.status_code == 400 + assert resp.status_code == 200 + _, kwargs = fake_asr.transcribe.call_args + assert kwargs["language"] == "zul" -async def test_requires_authentication(async_client: AsyncClient): - resp = await async_client.post( +async def test_unsupported_language_rejected( + authenticated_client: AsyncClient, fake_asr, test_user: Dict +): + resp = await authenticated_client.post( "/tasks/audio/transcriptions", - data={"language": "lug", "platform": "modal"}, + data={"language": "xyz"}, files=audio_part(), ) - assert resp.status_code == 401 + assert resp.status_code == 422 -async def test_runpod_upload_persists_and_returns_id( - authenticated_client: AsyncClient, fake_facade, test_user: Dict +async def test_language_is_required( + authenticated_client: AsyncClient, fake_asr, test_user: Dict ): - """RunPod non-org transcriptions are saved to the DB and return an id.""" resp = await authenticated_client.post( - "/tasks/audio/transcriptions", - data={"language": "lug", "platform": "runpod"}, - files=audio_part(), + "/tasks/audio/transcriptions", files=audio_part() ) - assert resp.status_code == 200 - assert isinstance(resp.json()["audio_transcription_id"], int) + assert resp.status_code == 422 -async def test_runpod_org_does_not_persist( - authenticated_client: AsyncClient, fake_facade, test_user: Dict +async def test_audio_is_required( + authenticated_client: AsyncClient, fake_asr, test_user: Dict ): - """The org workflow must not persist a transcription (parity with /org/stt).""" + resp = await authenticated_client.post( + "/tasks/audio/transcriptions", data={"language": "lug"} + ) + assert resp.status_code == 422 + + +async def test_upstream_failure_maps_to_502( + authenticated_client: AsyncClient, fake_asr, test_user: Dict +): + fake_asr.transcribe = AsyncMock( + side_effect=ExternalServiceError( + service_name="Sunbird ASR API", message="ASR API error: boom" + ) + ) resp = await authenticated_client.post( "/tasks/audio/transcriptions", - data={"language": "lug", "platform": "runpod", "org": "true"}, + data={"language": "lug"}, files=audio_part(), ) - assert resp.status_code == 200 - assert resp.json()["audio_transcription_id"] is None + assert resp.status_code == 502 + + +async def test_requires_authentication(async_client: AsyncClient): + resp = await async_client.post( + "/tasks/audio/transcriptions", + data={"language": "lug"}, + files=audio_part(), + ) + assert resp.status_code == 401 async def test_openapi_marks_legacy_stt_deprecated(async_client: AsyncClient): @@ -206,38 +234,63 @@ async def test_legacy_modal_stt_returns_deprecation_headers( assert 'rel="successor-version"' in resp.headers.get("Link", "") -async def test_audio_field_renders_as_binary_file_in_openapi(async_client: AsyncClient): - """The `audio` field must be a plain binary string so Swagger UI shows a - file-picker (an anyOf/null schema falls back to a text box).""" +async def test_openapi_request_body_matches_new_contract(async_client: AsyncClient): + """audio is a required binary file; the removed parameters are gone.""" resp = await async_client.get("/openapi.json") assert resp.status_code == 200 body = resp.json()["components"]["schemas"][ "Body_create_transcription_tasks_audio_transcriptions_post" ] props = body["properties"] + audio = props["audio"] assert audio.get("type") == "string" assert audio.get("format") == "binary" assert "anyOf" not in audio - # audio stays optional (gcs_blob_name is the alternative input). - assert "audio" not in body.get("required", []) - - # whisper / recognise_speakers must be plain booleans (true/false selector - # in Swagger), defaulting to False — not anyOf/null text boxes. - for flag in ("whisper", "recognise_speakers"): - assert props[flag].get("type") == "boolean", flag - assert props[flag].get("default") is False, flag - assert "anyOf" not in props[flag], flag - - # adapter must be an enum dropdown (like language), not anyOf/null. - assert "anyOf" not in props["adapter"] - assert "$ref" in str(props["adapter"]) - assert "adapter" not in body.get("required", []) + assert "audio" in body.get("required", []) + assert "language" in body.get("required", []) + + # timestamps is a plain boolean (true/false selector in Swagger). + assert props["timestamps"].get("type") == "boolean" + assert props["timestamps"].get("default") is False + assert "anyOf" not in props["timestamps"] + + for removed in ( + "platform", + "adapter", + "whisper", + "recognise_speakers", + "org", + "gcs_blob_name", + ): + assert removed not in props, removed + + +async def test_openapi_language_enum_covers_51_languages(async_client: AsyncClient): + resp = await async_client.get("/openapi.json") + assert resp.status_code == 200 + schemas = resp.json()["components"]["schemas"] + codes = schemas["ASRLanguage"]["enum"] + assert len(codes) == 51 + # every language the previous 10-code enum served must still be there + for legacy in ( + "ach", + "teo", + "eng", + "lug", + "lgg", + "nyn", + "swa", + "kin", + "xog", + "myx", + ): + assert legacy in codes, legacy @pytest.mark.real_quota async def test_quota_exceeded_returns_429( - authenticated_client: AsyncClient, fake_facade, test_user: Dict, monkeypatch + authenticated_client: AsyncClient, fake_asr, test_user: Dict, monkeypatch ): """When the daily/monthly quota is exhausted, the endpoint returns 429.""" from app.services.quota_service import QuotaResult, QuotaService @@ -248,7 +301,7 @@ async def deny(self, db, user): monkeypatch.setattr(QuotaService, "check_and_consume", deny) resp = await authenticated_client.post( "/tasks/audio/transcriptions", - data={"language": "lug", "platform": "modal"}, + data={"language": "lug"}, files=audio_part(), ) assert resp.status_code == 429 diff --git a/app/tests/test_transcription_service.py b/app/tests/test_transcription_service.py deleted file mode 100644 index 3a69c9b0..00000000 --- a/app/tests/test_transcription_service.py +++ /dev/null @@ -1,258 +0,0 @@ -"""Unit tests for the TranscriptionService facade and its schema.""" - -from unittest.mock import AsyncMock, MagicMock - -import pytest - -from app.core.exceptions import BadRequestError -from app.schemas.stt import TranscriptionPlatform -from app.services.stt_service import TranscriptionResult -from app.services.transcription_service import TranscriptionService -from app.utils.deprecation import ( - STT_SUNSET_DATE, - SUCCESSOR_TRANSCRIPTIONS, - deprecation_headers, -) - - -def test_transcription_platform_values(): - assert TranscriptionPlatform.modal.value == "modal" - assert TranscriptionPlatform.runpod.value == "runpod" - assert TranscriptionPlatform("modal") is TranscriptionPlatform.modal - - -def test_deprecation_headers_contents(): - headers = deprecation_headers(SUCCESSOR_TRANSCRIPTIONS) - assert headers["Deprecation"] == "true" - assert headers["Sunset"] == STT_SUNSET_DATE - assert headers["Link"] == '; rel="successor-version"' - - -def make_facade(): - stt = MagicMock() - stt.validate_audio_file = MagicMock(return_value=None) - stt.transcribe_from_gcs = AsyncMock( - return_value=TranscriptionResult( - transcription="gcs text", - diarization_output={}, - formatted_diarization_output="", - audio_url="gs://bucket/a.wav", - blob_name="a.wav", - ) - ) - stt.transcribe_uploaded_file = AsyncMock( - return_value=TranscriptionResult( - transcription="upload text", - diarization_output={}, - formatted_diarization_output="", - audio_url="gs://bucket/u.wav", - blob_name="u.wav", - ) - ) - stt.transcribe_org_audio = AsyncMock( - return_value=TranscriptionResult( - transcription="org text", - diarization_output={}, - formatted_diarization_output="", - ) - ) - modal = MagicMock() - modal.transcribe = AsyncMock(return_value="modal text") - return TranscriptionService(stt_service=stt, modal_stt_service=modal), stt, modal - - -# --- validate_and_normalize --- - - -def test_validate_runpod_passes_flags_through(): - facade, _, _ = make_facade() - whisper, speakers = facade.validate_and_normalize( - platform="runpod", - has_audio=True, - gcs_blob_name=None, - org=False, - whisper=True, - recognise_speakers=True, - ) - assert whisper is True - assert speakers is True - - -def test_validate_runpod_defaults_false(): - facade, _, _ = make_facade() - whisper, speakers = facade.validate_and_normalize( - platform="runpod", - has_audio=True, - gcs_blob_name=None, - org=False, - whisper=False, - recognise_speakers=False, - ) - assert whisper is False - assert speakers is False - - -def test_validate_modal_allows_false_flags(): - facade, _, _ = make_facade() - whisper, speakers = facade.validate_and_normalize( - platform="modal", - has_audio=True, - gcs_blob_name=None, - org=False, - whisper=False, - recognise_speakers=False, - ) - assert whisper is False - assert speakers is False - - -def test_validate_rejects_no_input(): - facade, _, _ = make_facade() - with pytest.raises(BadRequestError): - facade.validate_and_normalize( - platform="runpod", - has_audio=False, - gcs_blob_name=None, - org=False, - whisper=False, - recognise_speakers=False, - ) - - -def test_validate_rejects_both_inputs(): - facade, _, _ = make_facade() - with pytest.raises(BadRequestError): - facade.validate_and_normalize( - platform="runpod", - has_audio=True, - gcs_blob_name="a.wav", - org=False, - whisper=False, - recognise_speakers=False, - ) - - -def test_validate_rejects_modal_with_gcs(): - facade, _, _ = make_facade() - with pytest.raises(BadRequestError): - facade.validate_and_normalize( - platform="modal", - has_audio=False, - gcs_blob_name="a.wav", - org=False, - whisper=False, - recognise_speakers=False, - ) - - -def test_validate_rejects_modal_with_org(): - facade, _, _ = make_facade() - with pytest.raises(BadRequestError): - facade.validate_and_normalize( - platform="modal", - has_audio=True, - gcs_blob_name=None, - org=True, - whisper=False, - recognise_speakers=False, - ) - - -def test_validate_rejects_modal_with_runpod_only_flags(): - facade, _, _ = make_facade() - with pytest.raises(BadRequestError): - facade.validate_and_normalize( - platform="modal", - has_audio=True, - gcs_blob_name=None, - org=False, - whisper=True, - recognise_speakers=False, - ) - - -def test_validate_rejects_unknown_platform(): - facade, _, _ = make_facade() - with pytest.raises(BadRequestError): - facade.validate_and_normalize( - platform="gcp", - has_audio=True, - gcs_blob_name=None, - org=False, - whisper=False, - recognise_speakers=False, - ) - - -# --- transcribe dispatch --- - - -async def test_transcribe_dispatches_modal(): - facade, stt, modal = make_facade() - result = await facade.transcribe( - platform="modal", - language="lug", - adapter="lug", - audio_bytes=b"xx", - ) - modal.transcribe.assert_awaited_once_with(b"xx", language="lug") - assert result.transcription == "modal text" - stt.transcribe_uploaded_file.assert_not_called() - - -async def test_transcribe_dispatches_gcs(): - facade, stt, _ = make_facade() - result = await facade.transcribe( - platform="runpod", - language="lug", - adapter="lug", - gcs_blob_name="a.wav", - whisper=True, - recognise_speakers=True, - ) - stt.transcribe_from_gcs.assert_awaited_once() - assert result.transcription == "gcs text" - - -async def test_transcribe_dispatches_uploaded(): - facade, stt, _ = make_facade() - result = await facade.transcribe( - platform="runpod", - language="lug", - adapter="lug", - org=False, - whisper=True, - recognise_speakers=True, - file_path="/tmp/u.wav", - file_extension=".wav", - content_type="audio/wav", - ) - stt.validate_audio_file.assert_called_once_with("audio/wav", ".wav") - stt.transcribe_uploaded_file.assert_awaited_once() - assert result.transcription == "upload text" - - -async def test_transcribe_dispatches_org(): - facade, stt, _ = make_facade() - result = await facade.transcribe( - platform="runpod", - language="lug", - adapter="lug", - org=True, - recognise_speakers=True, - file_path="/tmp/o.wav", - file_extension=".wav", - content_type="audio/wav", - ) - stt.validate_audio_file.assert_called_once_with("audio/wav", ".wav") - stt.transcribe_org_audio.assert_awaited_once_with( - file_path="/tmp/o.wav", recognise_speakers=True - ) - assert result.transcription == "org text" - - -def test_transcription_service_dep_is_exported(): - import app.deps as deps - - assert hasattr(deps, "TranscriptionServiceDep") - assert "TranscriptionServiceDep" in deps.__all__ diff --git a/docs/tutorial.md b/docs/tutorial.md index 3b4ec689..44e003e8 100644 --- a/docs/tutorial.md +++ b/docs/tutorial.md @@ -9,7 +9,11 @@ This comprehensive tutorial describes how to use the Sunbird AI API and includes - **Lugbara** (lgg) - **Runyankole** (nyn) - **Swahili** (swa) -- **Plus 20 more Uganda languages** +- **Plus 20 more Ugandan languages** + +Coverage differs per endpoint: speech-to-text spans **51 African languages**, +chat/translation spans 32 (`sunflower-14b`) or 67 (`sunflower-9b`), and +text-to-speech spans 20. See the matrix below. --- @@ -20,7 +24,9 @@ serves. **Code** is the canonical ISO/SALT code the API accepts (full language names also work where an endpoint takes a `language` or `voice`). - **`/tasks/audio/speech`** — text-to-speech (orpheus-3b-tts voice catalog). -- **`/tasks/audio/transcriptions`** — speech-to-text (Whisper language IDs). +- **`/tasks/audio/transcriptions`** — speech-to-text. Now covers **51 African + languages** via Sunbird's faster-whisper ASR model — see + [Part 3](#part-3-speech-to-text-stt). - **`/tasks/chat/completions`** — Sunflower chat. The `/tasks/chat/completions` column below reflects the default **`sunflower-14b`** model (English + 31 Ugandan/regional languages), which `/tasks/translate` shares. The alternative @@ -30,54 +36,77 @@ names also work where an endpoint takes a `language` or `voice`). | Language name | Code | `/tasks/audio/speech` | `/tasks/audio/transcriptions` | `/tasks/chat/completions` | | :---- | :---- | :----: | :----: | :----: | | Acholi | `ach` | ✅ | ✅ | ✅ | -| Afrikaans | `afr` | ✅ | ❌ | ❌ | +| Afrikaans | `afr` | ✅ | ✅ | ❌ | +| Akan | `aka` | ❌ | ✅ | ❌ | | Alur | `alz` | ❌ | ❌ | ✅ | +| Amharic | `amh` | ❌ | ✅ | ❌ | | Aringa | `luc` | ❌ | ❌ | ✅ | | Ateso | `teo` | ✅ | ✅ | ✅ | +| Bambara | `bam` | ❌ | ✅ | ❌ | | Bari | `bfa` | ❌ | ❌ | ✅ | +| Bemba | `bem` | ❌ | ✅ | ❌ | +| Berber | `ber` | ❌ | ✅ | ❌ | +| Chichewa | `nya` | ❌ | ✅ | ❌ | +| Dagaare | `dga` | ❌ | ✅ | ❌ | +| Dagbani | `dag` | ❌ | ✅ | ❌ | | English | `eng` | ✅ | ✅ | ✅ | -| Ewe | `ewe` | ✅ | ❌ | ❌ | -| Fulah | `ful` | ✅ | ❌ | ❌ | -| Hausa | `hau` | ✅ | ❌ | ❌ | -| Igbo | `ibo` | ✅ | ❌ | ❌ | +| Ewe | `ewe` | ✅ | ✅ | ❌ | +| French | `fra` | ❌ | ✅ | ❌ | +| Fulah / Fulani | `ful` | ✅ | ✅ | ❌ | +| Hausa | `hau` | ✅ | ✅ | ❌ | +| Igbo | `ibo` | ✅ | ✅ | ❌ | +| Ikposo | `kpo` | ❌ | ✅ | ❌ | | Jopadhola | `adh` | ❌ | ❌ | ✅ | +| Kabyle | `kab` | ❌ | ✅ | ❌ | | Kakwa | `keo` | ❌ | ❌ | ✅ | +| Kalenjin | `kln` | ❌ | ✅ | ❌ | +| Kanuri | `kau` | ❌ | ✅ | ❌ | | Karamojong | `kdj` | ❌ | ❌ | ✅ | -| Kikuyu | `kik` | ✅ | ❌ | ❌ | +| Kikuyu | `kik` | ✅ | ✅ | ❌ | | Kinyarwanda | `kin` | ✅ | ✅ | ✅ | | Kumam | `kdi` | ❌ | ❌ | ✅ | | Kupsabiny | `kpz` | ❌ | ❌ | ✅ | -| Kwamba | `rwm` | ❌ | ❌ | ✅ | +| Kwamba | `rwm` | ❌ | ✅ | ✅ | | Lango | `laj` | ❌ | ❌ | ✅ | -| Lingala | `lin` | ✅ | ❌ | ❌ | +| Lendu | `led` | ❌ | ✅ | ❌ | +| Lingala | `lin` | ✅ | ✅ | ❌ | | Lubwisi | `tlj` | ❌ | ❌ | ✅ | | Lugbara | `lgg` | ✅ † | ✅ | ✅ | | Lugungu | `rub` | ❌ | ❌ | ✅ | | Lugwere | `gwr` | ❌ | ❌ | ✅ | | Luganda | `lug` | ✅ | ✅ | ✅ | +| Luhya | `luy` | ❌ | ✅ | ❌ | | Lumasaba | `myx` | ❌ | ✅ | ✅ | | Lunyole | `nuj` | ❌ | ❌ | ✅ | -| Luo (Dholuo) | `luo` | ✅ | ❌ | ❌ | +| Luo (Dholuo) | `luo` | ✅ | ✅ | ❌ | | Lusoga | `xog` | ❌ | ✅ | ✅ | | Ma'di | `mhi` | ❌ | ❌ | ✅ | +| Malagasy | `mlg` | ❌ | ✅ | ❌ | +| Ndebele | `nbl` | ❌ | ✅ | ❌ | +| Nigerian Pidgin | `pcm` | ❌ | ✅ | ❌ | +| Oromo | `orm` | ❌ | ✅ | ❌ | | Pokot | `pok` | ❌ | ❌ | ✅ | -| Rukiga | `cgg` | ❌ | ❌ | ✅ | -| Rukonjo | `koo` | ❌ | ❌ | ✅ | +| Rukiga | `cgg` | ❌ | ✅ | ✅ | +| Rukonjo | `koo` | ❌ | ✅ | ✅ | | Runyankole | `nyn` | ✅ | ✅ | ✅ | | Runyoro | `nyo` | ❌ | ❌ | ✅ | -| Ruruuli | `ruc` | ❌ | ❌ | ✅ | +| Ruruuli | `ruc` | ❌ | ✅ | ✅ | | Rutooro | `ttj` | ❌ | ✅ | ✅ | | Samia | `lsm` | ❌ | ❌ | ✅ | -| Sesotho | `sot` | ✅ † | ❌ | ❌ | -| Setswana | `tsn` | ✅ † | ❌ | ❌ | +| Sesotho / Sotho | `sot` | ✅ † | ✅ | ❌ | +| Setswana / Tswana | `tsn` | ✅ † | ✅ | ❌ | +| Shona | `sna` | ❌ | ✅ | ❌ | +| Somali | `som` | ❌ | ✅ | ❌ | | Swahili | `swa` | ✅ | ✅ | ✅ | -| Xhosa | `xho` | ✅ | ❌ | ❌ | -| Yoruba | `yor` | ✅ | ❌ | ❌ | +| Thur | `lth` | ❌ | ✅ | ❌ | +| Wolof | `wol` | ❌ | ✅ | ❌ | +| Xhosa | `xho` | ✅ | ✅ | ❌ | +| Yoruba | `yor` | ✅ | ✅ | ❌ | +| Zulu | `zul` | ❌ | ✅ | ❌ | **†** Lugbara, Sesotho, and Setswana are in the orpheus-3b-tts training mix but currently expose **no individual voice IDs** in this checkpoint, so practical -synthesis depends on a future voice release. Languages outside these sets (for -example Zulu) are not currently served by any endpoint. +synthesis depends on a future voice release. --- @@ -226,13 +255,25 @@ The response shape is unchanged from the previous NLLB-backed endpoint: ## Part 3: Speech-to-Text (STT) -Convert speech audio to text. The unified **`POST /tasks/audio/transcriptions`** endpoint accepts an uploaded audio file (or a GCS object) and routes to the Modal (Whisper large-v3) or RunPod backend. Supports MP3, WAV, M4A, and more. +Convert speech audio to text. The unified **`POST /tasks/audio/transcriptions`** +endpoint is powered by Sunbird's faster-whisper ASR model +([`Sunbird/faster-whisper-51-african-languages`](https://huggingface.co/Sunbird/faster-whisper-51-african-languages), +a [Whisper large-v3 fine-tune](https://huggingface.co/Sunbird/asr-whisper-51-african-languages)) +covering **51 African languages**. Supports MP3, WAV, M4A, OGG, and more. > **Migrating from the legacy STT routes?** `/tasks/modal/stt`, `/tasks/stt`, `/tasks/stt_from_gcs`, and `/tasks/org/stt` are **deprecated** (they still work but return `Deprecation`/`Sunset` headers). Switch to `/tasks/audio/transcriptions`. -### Transcribe a file (Modal / Whisper) +> **Breaking change.** This endpoint previously accepted `platform`, `adapter`, +> `whisper`, `recognise_speakers`, `org`, and `gcs_blob_name`. Those parameters +> have been **removed** and are now rejected with `422`. Speaker diarization and +> the organization workflow are still available on the deprecated +> `/tasks/org/stt` and `/tasks/stt` routes. + +### Transcribe a file -`language` is **required**. `platform` defaults to `modal` (Whisper large-v3). +`audio` and `language` are both **required**. The model reuses Whisper's +language-token slots for African languages, which makes automatic language +detection unreliable — always pass a language explicitly. ```python import os @@ -255,8 +296,7 @@ files = { "audio": ("recording.wav", open(audio_file_path, "rb"), "audio/wav"), } data = { - "language": "lug", # required: 3-letter code or full name (e.g. "Luganda") - "platform": "modal", # "modal" (default, Whisper) or "runpod" + "language": "lug", # required: ISO 639-3 code, one of the 51 below } response = requests.post(url, headers=headers, files=files, data=data) @@ -264,66 +304,110 @@ result = response.json() print(f"Transcription: {result['audio_transcription']}") ``` -### Transcribe with RunPod (adapter, Whisper, diarization) +**Example response:** +```json +{ + "audio_transcription": "Ekibiina ekiddukanya ...", + "language": "lug", + "audio_url": "gs://.../audio.wav", + "audio_transcription_id": 123, + "duration_seconds": 12.4, + "segments": null, + "diarization_output": {}, + "formatted_diarization_output": "", + "was_audio_trimmed": false, + "original_duration_minutes": null +} +``` -The RunPod backend adds a language `adapter`, the `whisper` flag, and optional speaker diarization (`recognise_speakers`). +### Timestamped segments + +Set `timestamps=true` to also receive per-segment start/end times in `segments`. +It is `false` by default, in which case `segments` comes back as `null`. ```python -files = { - "audio": ("recording.mp3", open("/path/to/audio_file.mp3", "rb"), "audio/mpeg"), -} data = { - "language": "lug", - "platform": "runpod", - "adapter": "lug", # optional; defaults to `language` - "whisper": True, # RunPod only - "recognise_speakers": False, # RunPod only — speaker diarization + "language": "ach", + "timestamps": True, } response = requests.post(url, headers=headers, files=files, data=data) -print(response.json()) -``` +result = response.json() -You can also transcribe audio already in GCS by passing `gcs_blob_name` (with `platform="runpod"`) instead of an `audio` file — see **Part 7: File Upload** for generating upload URLs. +print(result["audio_transcription"]) +for segment in result["segments"]: + print(f"[{segment['start']:7.2f} -> {segment['end']:7.2f}] {segment['text']}") +``` -**Example response:** ```json { - "audio_transcription": "Ekibiina ekiddukanya ...", - "language": "lug", - "audio_url": "https://storage.googleapis.com/.../audio.wav?...", - "audio_transcription_id": 123, - "diarization_output": null, - "formatted_diarization_output": null, - "was_audio_trimmed": false, - "original_duration_minutes": null + "audio_transcription": "Gyebaleko ssebo", + "language": "ach", + "duration_seconds": 2.25, + "segments": [ + {"start": 0.0, "end": 1.0, "text": "Gyebaleko"}, + {"start": 1.0, "end": 2.25, "text": "ssebo"} + ] } ``` -**Supported languages:** English (`eng`), Luganda (`lug`), Runyankole (`nyn`), Acholi (`ach`), Ateso (`teo`), Lugbara (`lgg`), Swahili (`swa`), Lusoga (`xog`), Rutooro (`ttj`), Kinyarwanda (`kin`), Lumasaba (`myx`). - **Note:** For files larger than 100MB, only the first 10 minutes will be transcribed. - -The dictionary below represents the language codes available now for the stt endpoint +### Supported languages (51) + +Pass the ISO 639-3 code as `language`. All ten languages served by the previous +version of this endpoint are still supported. + +| Code | Language | Code | Language | Code | Language | +| :--- | :--- | :--- | :--- | :--- | :--- | +| `ach` | Acholi | `kab` | Kabyle | `nyn` | Runyankole | +| `afr` | Afrikaans | `kau` | Kanuri | `orm` | Oromo | +| `aka` | Akan | `kik` | Kikuyu | `pcm` | Nigerian Pidgin | +| `amh` | Amharic | `kin` | Kinyarwanda | `ruc` | Ruruuli | +| `bam` | Bambara | `kln` | Kalenjin | `rwm` | Kwamba | +| `bem` | Bemba | `koo` | Rukonjo | `sna` | Shona | +| `ber` | Berber | `kpo` | Ikposo | `som` | Somali | +| `cgg` | Rukiga | `led` | Lendu | `sot` | Sotho | +| `dag` | Dagbani | `lgg` | Lugbara | `swa` | Swahili | +| `dga` | Dagaare | `lin` | Lingala | `teo` | Ateso | +| `eng` | English | `lth` | Thur | `tsn` | Tswana | +| `ewe` | Ewe | `lug` | Luganda | `ttj` | Rutooro | +| `fra` | French | `luo` | Luo | `wol` | Wolof | +| `ful` | Fulani | `luy` | Luhya | `xho` | Xhosa | +| `hau` | Hausa | `mlg` | Malagasy | `xog` | Lusoga | +| `ibo` | Igbo | `myx` | Lumasaba | `yor` | Yoruba | +| | | `nbl` | Ndebele | `zul` | Zulu | +| | | `nya` | Chichewa | | | + +As a Python dictionary: ```python SALT_LANGUAGE_IDS_WHISPER = { - 'eng': "English (Ugandan)", - 'swa': "Swahili", - 'ach': "Acholi", - 'lgg': "Lugbara", - 'lug': "Luganda", - 'nyn': "Runyankole", - 'teo': "Ateso", - 'xog': "Lusoga", - 'ttj': "Rutooro", - 'kin': "Kinyarwanda", - 'myx': "Lumasaba", + 'ach': "Acholi", 'kab': "Kabyle", 'nyn': "Runyankole", + 'afr': "Afrikaans", 'kau': "Kanuri", 'orm': "Oromo", + 'aka': "Akan", 'kik': "Kikuyu", 'pcm': "Nigerian Pidgin", + 'amh': "Amharic", 'kin': "Kinyarwanda", 'ruc': "Ruruuli", + 'bam': "Bambara", 'kln': "Kalenjin", 'rwm': "Kwamba", + 'bem': "Bemba", 'koo': "Rukonjo", 'sna': "Shona", + 'ber': "Berber", 'kpo': "Ikposo", 'som': "Somali", + 'cgg': "Rukiga", 'led': "Lendu", 'sot': "Sotho", + 'dag': "Dagbani", 'lgg': "Lugbara", 'swa': "Swahili", + 'dga': "Dagaare", 'lin': "Lingala", 'teo': "Ateso", + 'eng': "English", 'lth': "Thur", 'tsn': "Tswana", + 'ewe': "Ewe", 'lug': "Luganda", 'ttj': "Rutooro", + 'fra': "French", 'luo': "Luo", 'wol': "Wolof", + 'ful': "Fulani", 'luy': "Luhya", 'xho': "Xhosa", + 'hau': "Hausa", 'mlg': "Malagasy", 'xog': "Lusoga", + 'ibo': "Igbo", 'myx': "Lumasaba", 'yor': "Yoruba", + 'nbl': "Ndebele", 'zul': "Zulu", + 'nya': "Chichewa", } - ``` +Per-language accuracy scales with the amount of training data available for each +language; see the [model card](https://huggingface.co/Sunbird/asr-whisper-51-african-languages) +for per-language WER/CER figures. + --- ## Part 4: Language Detection diff --git a/frontend/src/pages/Tutorial.tsx b/frontend/src/pages/Tutorial.tsx index 22d6ec02..9c39c44c 100644 --- a/frontend/src/pages/Tutorial.tsx +++ b/frontend/src/pages/Tutorial.tsx @@ -58,72 +58,137 @@ interface LanguageSupportRow { name: string; code: string; speech: boolean; // /tasks/audio/speech (orpheus-3b-tts) - transcription: boolean; // /tasks/audio/transcriptions (Whisper language IDs) + transcription: boolean; // /tasks/audio/transcriptions (51-language Sunbird ASR) chat: boolean; // /tasks/chat/completions (Sunflower) — same set as /tasks/translate ttsVoiceless?: boolean; // covered by the TTS training mix but no voice IDs yet } // Union of every language served by at least one of the three endpoints, sorted -// by name. Languages outside these sets (e.g. Zulu) are intentionally omitted. +// by name. const languageSupport: LanguageSupportRow[] = [ { name: 'Acholi', code: 'ach', speech: true, transcription: true, chat: true }, - { name: 'Afrikaans', code: 'afr', speech: true, transcription: false, chat: false }, + { name: 'Afrikaans', code: 'afr', speech: true, transcription: true, chat: false }, + { name: 'Akan', code: 'aka', speech: false, transcription: true, chat: false }, { name: 'Alur', code: 'alz', speech: false, transcription: false, chat: true }, + { name: 'Amharic', code: 'amh', speech: false, transcription: true, chat: false }, { name: 'Aringa', code: 'luc', speech: false, transcription: false, chat: true }, { name: 'Ateso', code: 'teo', speech: true, transcription: true, chat: true }, + { name: 'Bambara', code: 'bam', speech: false, transcription: true, chat: false }, { name: 'Bari', code: 'bfa', speech: false, transcription: false, chat: true }, + { name: 'Bemba', code: 'bem', speech: false, transcription: true, chat: false }, + { name: 'Berber', code: 'ber', speech: false, transcription: true, chat: false }, + { name: 'Chichewa', code: 'nya', speech: false, transcription: true, chat: false }, + { name: 'Dagaare', code: 'dga', speech: false, transcription: true, chat: false }, + { name: 'Dagbani', code: 'dag', speech: false, transcription: true, chat: false }, { name: 'English', code: 'eng', speech: true, transcription: true, chat: true }, - { name: 'Ewe', code: 'ewe', speech: true, transcription: false, chat: false }, - { name: 'Fulah', code: 'ful', speech: true, transcription: false, chat: false }, - { name: 'Hausa', code: 'hau', speech: true, transcription: false, chat: false }, - { name: 'Igbo', code: 'ibo', speech: true, transcription: false, chat: false }, + { name: 'Ewe', code: 'ewe', speech: true, transcription: true, chat: false }, + { name: 'French', code: 'fra', speech: false, transcription: true, chat: false }, + { name: 'Fulah / Fulani', code: 'ful', speech: true, transcription: true, chat: false }, + { name: 'Hausa', code: 'hau', speech: true, transcription: true, chat: false }, + { name: 'Igbo', code: 'ibo', speech: true, transcription: true, chat: false }, + { name: 'Ikposo', code: 'kpo', speech: false, transcription: true, chat: false }, { name: 'Jopadhola', code: 'adh', speech: false, transcription: false, chat: true }, + { name: 'Kabyle', code: 'kab', speech: false, transcription: true, chat: false }, { name: 'Kakwa', code: 'keo', speech: false, transcription: false, chat: true }, + { name: 'Kalenjin', code: 'kln', speech: false, transcription: true, chat: false }, + { name: 'Kanuri', code: 'kau', speech: false, transcription: true, chat: false }, { name: 'Karamojong', code: 'kdj', speech: false, transcription: false, chat: true }, - { name: 'Kikuyu', code: 'kik', speech: true, transcription: false, chat: false }, + { name: 'Kikuyu', code: 'kik', speech: true, transcription: true, chat: false }, { name: 'Kinyarwanda', code: 'kin', speech: true, transcription: true, chat: true }, { name: 'Kumam', code: 'kdi', speech: false, transcription: false, chat: true }, { name: 'Kupsabiny', code: 'kpz', speech: false, transcription: false, chat: true }, - { name: 'Kwamba', code: 'rwm', speech: false, transcription: false, chat: true }, + { name: 'Kwamba', code: 'rwm', speech: false, transcription: true, chat: true }, { name: 'Lango', code: 'laj', speech: false, transcription: false, chat: true }, - { name: 'Lingala', code: 'lin', speech: true, transcription: false, chat: false }, + { name: 'Lendu', code: 'led', speech: false, transcription: true, chat: false }, + { name: 'Lingala', code: 'lin', speech: true, transcription: true, chat: false }, { name: 'Lubwisi', code: 'tlj', speech: false, transcription: false, chat: true }, { name: 'Lugbara', code: 'lgg', speech: true, transcription: true, chat: true, ttsVoiceless: true }, { name: 'Lugungu', code: 'rub', speech: false, transcription: false, chat: true }, { name: 'Lugwere', code: 'gwr', speech: false, transcription: false, chat: true }, { name: 'Luganda', code: 'lug', speech: true, transcription: true, chat: true }, + { name: 'Luhya', code: 'luy', speech: false, transcription: true, chat: false }, { name: 'Lumasaba', code: 'myx', speech: false, transcription: true, chat: true }, { name: 'Lunyole', code: 'nuj', speech: false, transcription: false, chat: true }, - { name: 'Luo (Dholuo)', code: 'luo', speech: true, transcription: false, chat: false }, + { name: 'Luo (Dholuo)', code: 'luo', speech: true, transcription: true, chat: false }, { name: 'Lusoga', code: 'xog', speech: false, transcription: true, chat: true }, { name: "Ma'di", code: 'mhi', speech: false, transcription: false, chat: true }, + { name: 'Malagasy', code: 'mlg', speech: false, transcription: true, chat: false }, + { name: 'Ndebele', code: 'nbl', speech: false, transcription: true, chat: false }, + { name: 'Nigerian Pidgin', code: 'pcm', speech: false, transcription: true, chat: false }, + { name: 'Oromo', code: 'orm', speech: false, transcription: true, chat: false }, { name: 'Pokot', code: 'pok', speech: false, transcription: false, chat: true }, - { name: 'Rukiga', code: 'cgg', speech: false, transcription: false, chat: true }, - { name: 'Rukonjo', code: 'koo', speech: false, transcription: false, chat: true }, + { name: 'Rukiga', code: 'cgg', speech: false, transcription: true, chat: true }, + { name: 'Rukonjo', code: 'koo', speech: false, transcription: true, chat: true }, { name: 'Runyankole', code: 'nyn', speech: true, transcription: true, chat: true }, { name: 'Runyoro', code: 'nyo', speech: false, transcription: false, chat: true }, - { name: 'Ruruuli', code: 'ruc', speech: false, transcription: false, chat: true }, + { name: 'Ruruuli', code: 'ruc', speech: false, transcription: true, chat: true }, { name: 'Rutooro', code: 'ttj', speech: false, transcription: true, chat: true }, { name: 'Samia', code: 'lsm', speech: false, transcription: false, chat: true }, - { name: 'Sesotho', code: 'sot', speech: true, transcription: false, chat: false, ttsVoiceless: true }, - { name: 'Setswana', code: 'tsn', speech: true, transcription: false, chat: false, ttsVoiceless: true }, + { name: 'Sesotho / Sotho', code: 'sot', speech: true, transcription: true, chat: false, ttsVoiceless: true }, + { name: 'Setswana / Tswana', code: 'tsn', speech: true, transcription: true, chat: false, ttsVoiceless: true }, + { name: 'Shona', code: 'sna', speech: false, transcription: true, chat: false }, + { name: 'Somali', code: 'som', speech: false, transcription: true, chat: false }, { name: 'Swahili', code: 'swa', speech: true, transcription: true, chat: true }, - { name: 'Xhosa', code: 'xho', speech: true, transcription: false, chat: false }, - { name: 'Yoruba', code: 'yor', speech: true, transcription: false, chat: false }, + { name: 'Thur', code: 'lth', speech: false, transcription: true, chat: false }, + { name: 'Wolof', code: 'wol', speech: false, transcription: true, chat: false }, + { name: 'Xhosa', code: 'xho', speech: true, transcription: true, chat: false }, + { name: 'Yoruba', code: 'yor', speech: true, transcription: true, chat: false }, + { name: 'Zulu', code: 'zul', speech: false, transcription: true, chat: false }, ]; +// The 51 languages served by Sunbird/faster-whisper-51-african-languages. const sttLanguages = [ - { code: 'eng', name: 'English (Ugandan)' }, - { code: 'swa', name: 'Swahili' }, { code: 'ach', name: 'Acholi' }, + { code: 'afr', name: 'Afrikaans' }, + { code: 'aka', name: 'Akan' }, + { code: 'amh', name: 'Amharic' }, + { code: 'bam', name: 'Bambara' }, + { code: 'bem', name: 'Bemba' }, + { code: 'ber', name: 'Berber' }, + { code: 'cgg', name: 'Rukiga' }, + { code: 'dag', name: 'Dagbani' }, + { code: 'dga', name: 'Dagaare' }, + { code: 'eng', name: 'English' }, + { code: 'ewe', name: 'Ewe' }, + { code: 'fra', name: 'French' }, + { code: 'ful', name: 'Fulani' }, + { code: 'hau', name: 'Hausa' }, + { code: 'ibo', name: 'Igbo' }, + { code: 'kab', name: 'Kabyle' }, + { code: 'kau', name: 'Kanuri' }, + { code: 'kik', name: 'Kikuyu' }, + { code: 'kin', name: 'Kinyarwanda' }, + { code: 'kln', name: 'Kalenjin' }, + { code: 'koo', name: 'Rukonjo' }, + { code: 'kpo', name: 'Ikposo' }, + { code: 'led', name: 'Lendu' }, { code: 'lgg', name: 'Lugbara' }, + { code: 'lin', name: 'Lingala' }, + { code: 'lth', name: 'Thur' }, { code: 'lug', name: 'Luganda' }, + { code: 'luo', name: 'Luo' }, + { code: 'luy', name: 'Luhya' }, + { code: 'mlg', name: 'Malagasy' }, + { code: 'myx', name: 'Lumasaba' }, + { code: 'nbl', name: 'Ndebele' }, + { code: 'nya', name: 'Chichewa' }, { code: 'nyn', name: 'Runyankole' }, + { code: 'orm', name: 'Oromo' }, + { code: 'pcm', name: 'Nigerian Pidgin' }, + { code: 'ruc', name: 'Ruruuli' }, + { code: 'rwm', name: 'Kwamba' }, + { code: 'sna', name: 'Shona' }, + { code: 'som', name: 'Somali' }, + { code: 'sot', name: 'Sotho' }, + { code: 'swa', name: 'Swahili' }, { code: 'teo', name: 'Ateso' }, - { code: 'xog', name: 'Lusoga' }, + { code: 'tsn', name: 'Tswana' }, { code: 'ttj', name: 'Rutooro' }, - { code: 'kin', name: 'Kinyarwanda' }, - { code: 'myx', name: 'Lumasaba' }, + { code: 'wol', name: 'Wolof' }, + { code: 'xho', name: 'Xhosa' }, + { code: 'xog', name: 'Lusoga' }, + { code: 'yor', name: 'Yoruba' }, + { code: 'zul', name: 'Zulu' }, ]; // orpheus-3b-tts languages covered. Speaker IDs encode both the source corpus @@ -361,51 +426,67 @@ files = { "audio": ("recording.wav", open(audio_file_path, "rb"), "audio/wav"), } data = { - "language": "lug", # required: 3-letter code or full name (e.g. "Luganda") - "platform": "modal", # "modal" (default, Whisper) or "runpod" + "language": "lug", # required: ISO 639-3 code, one of the 51 supported } response = requests.post(url, headers=headers, files=files, data=data) result = response.json() print(f"Transcription: {result['audio_transcription']}")`; -const runpodTranscribeCode = `files = { - "audio": ("recording.mp3", open("/path/to/audio_file.mp3", "rb"), "audio/mpeg"), -} -data = { - "language": "lug", - "platform": "runpod", - "adapter": "lug", # optional; defaults to language - "whisper": True, # RunPod only - "recognise_speakers": False, # RunPod only — speaker diarization +const timestampsTranscribeCode = `data = { + "language": "ach", + "timestamps": True, # also return per-segment start/end times } response = requests.post(url, headers=headers, files=files, data=data) -print(response.json())`; +result = response.json() + +print(result["audio_transcription"]) +for segment in result["segments"]: + print(f"[{segment['start']:7.2f} -> {segment['end']:7.2f}] {segment['text']}")`; const transcribeResponse = `{ "audio_transcription": "Ekibiina ekiddukanya ...", "language": "lug", - "audio_url": "https://storage.googleapis.com/.../audio.wav?...", + "audio_url": "gs://.../audio.wav", "audio_transcription_id": 123, - "diarization_output": null, - "formatted_diarization_output": null, + "duration_seconds": 12.4, + "segments": null, + "diarization_output": {}, + "formatted_diarization_output": "", "was_audio_trimmed": false, "original_duration_minutes": null }`; +const timestampsResponse = `{ + "audio_transcription": "Gyebaleko ssebo", + "language": "ach", + "duration_seconds": 2.25, + "segments": [ + {"start": 0.0, "end": 1.0, "text": "Gyebaleko"}, + {"start": 1.0, "end": 2.25, "text": "ssebo"} + ] +}`; + const saltWhisperCode = `SALT_LANGUAGE_IDS_WHISPER = { - 'eng': "English (Ugandan)", - 'swa': "Swahili", - 'ach': "Acholi", - 'lgg': "Lugbara", - 'lug': "Luganda", - 'nyn': "Runyankole", - 'teo': "Ateso", - 'xog': "Lusoga", - 'ttj': "Rutooro", - 'kin': "Kinyarwanda", - 'myx': "Lumasaba", + 'ach': "Acholi", 'kab': "Kabyle", 'nyn': "Runyankole", + 'afr': "Afrikaans", 'kau': "Kanuri", 'orm': "Oromo", + 'aka': "Akan", 'kik': "Kikuyu", 'pcm': "Nigerian Pidgin", + 'amh': "Amharic", 'kin': "Kinyarwanda", 'ruc': "Ruruuli", + 'bam': "Bambara", 'kln': "Kalenjin", 'rwm': "Kwamba", + 'bem': "Bemba", 'koo': "Rukonjo", 'sna': "Shona", + 'ber': "Berber", 'kpo': "Ikposo", 'som': "Somali", + 'cgg': "Rukiga", 'led': "Lendu", 'sot': "Sotho", + 'dag': "Dagbani", 'lgg': "Lugbara", 'swa': "Swahili", + 'dga': "Dagaare", 'lin': "Lingala", 'teo': "Ateso", + 'eng': "English", 'lth': "Thur", 'tsn': "Tswana", + 'ewe': "Ewe", 'lug': "Luganda", 'ttj': "Rutooro", + 'fra': "French", 'luo': "Luo", 'wol': "Wolof", + 'ful': "Fulani", 'luy': "Luhya", 'xho': "Xhosa", + 'hau': "Hausa", 'mlg': "Malagasy", 'xog': "Lusoga", + 'ibo': "Igbo", 'myx': "Lumasaba", 'yor': "Yoruba", + 'nbl': "Ndebele", 'zul': "Zulu", + 'nya': "Chichewa", }`; const languageDetectCode = `import os @@ -895,8 +976,10 @@ export default function Tutorial() { Sunbird AI provides AI services across English and a growing catalog of African languages. - Languages are accepted as a 3-letter ISO code or a full language name; translation alone covers - 32 languages. + Languages are accepted as a 3-letter ISO code or a full language name. Coverage differs per + endpoint: speech-to-text spans 51 African languages, chat and translation span 32 + (sunflower-14b) or 67 (sunflower-9b), and + text-to-speech spans 20.
{supportedLanguages.map((lang) => ( @@ -925,6 +1008,8 @@ export default function Tutorial() { Which languages each task endpoint currently serves. Code is the canonical ISO/SALT code the API accepts (full language names also work where an endpoint takes a{' '} language or voice). The{' '} + /tasks/audio/transcriptions column covers all 51 African languages + served by Sunbird's faster-whisper ASR model. The{' '} /tasks/chat/completions column reflects the default{' '} sunflower-14b model (English + 31 Ugandan/regional languages), which{' '} /tasks/translate shares. The alternative{' '} @@ -997,7 +1082,6 @@ export default function Tutorial() { Lugbara, Sesotho, and Setswana are in the orpheus-3b-tts training mix but currently expose no individual voice IDs, so synthesis depends on a future voice release. - Languages outside these sets (for example Zulu) are not yet served by any endpoint. @@ -1098,9 +1182,9 @@ export default function Tutorial() { /> Convert speech audio to text. The unified{' '} - POST /tasks/audio/transcriptions endpoint accepts an uploaded audio file - (or a GCS object) and routes to the Modal (Whisper large-v3) or RunPod backend. Supports MP3, - WAV, M4A, and more. + POST /tasks/audio/transcriptions endpoint is powered by Sunbird's + faster-whisper ASR model covering 51 African languages. Supports MP3, WAV, + M4A, OGG, and more. @@ -1111,31 +1195,41 @@ export default function Tutorial() { /tasks/audio/transcriptions. - Transcribe a file (Modal / Whisper) - - language is required.{' '} - platform defaults to modal (Whisper large-v3). - - + + Breaking change. This endpoint previously accepted{' '} + platform, adapter,{' '} + whisper, recognise_speakers,{' '} + org, and gcs_blob_name. Those parameters have + been removed and are now rejected with 422. Speaker + diarization and the organization workflow remain on the deprecated{' '} + /tasks/org/stt and /tasks/stt routes. + - Transcribe with RunPod (adapter, Whisper, diarization) + Transcribe a file - The RunPod backend adds a language adapter, the{' '} - whisper flag, and optional speaker diarization - (recognise_speakers). - - - - You can also transcribe audio already in GCS by passing{' '} - gcs_blob_name (with platform="runpod") instead - of an audio file — see Part 7: File Upload for - generating upload URLs. + audio and language are both{' '} + required. The model reuses Whisper's language-token slots for African + languages, which makes automatic language detection unreliable — always pass a language + explicitly. + Example response - Supported languages + Timestamped segments + + Set timestamps=true to also receive per-segment start/end times in{' '} + segments. It is false by default, in which + case segments comes back as null. + + + + + Supported languages (51) + + All ten languages served by the previous version of this endpoint are still supported. +
{sttLanguages.map((l) => (
The dictionary below represents the language codes available now for the STT endpoint: - + {/* Part 4: Language Detection */} From 03d8297a2c2de3cddd1d7a6958b91ffd3685d584 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 23 Jul 2026 07:39:05 +0000 Subject: [PATCH 2/2] Updated coverage.svg --- coverage.svg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coverage.svg b/coverage.svg index 6dd35eeb..0e8b0023 100644 --- a/coverage.svg +++ b/coverage.svg @@ -1 +1 @@ -coverage: 71.88%coverage71.88% \ No newline at end of file +coverage: 72.13%coverage72.13% \ No newline at end of file