diff --git a/README.md b/README.md index b217686..0b039ec 100644 --- a/README.md +++ b/README.md @@ -1,112 +1,28 @@ # Introduction -This is a simple reproduction of the analysis done in the [CLIO](https://www.anthropic.com/research/clio) paper. I've written a [walkthrough of the code](https://ivanleo.com/blog/understanding-user-conversations) that you can read to understand the high level ideas behind CLIO. The code isn't entirely optimised, I wrote it for fun over the weekend so I apologise in advance for any bugs. +Kura is an open-source tool that helps you to understand your users. It's built using the same ideas as [CLIO](https://www.anthropic.com/research/clio) but open-sourced so that you can try it on your own data. I've written a [walkthrough of the code](https://ivanleo.com/blog/understanding-user-conversations) that you can read to understand the high level ideas behind CLIO. -## What is CLIO? +It's currently under active development and I'm working on adding more features to it but the eventual goal is to make it a very modular tool that you can use to understand general trends in your user base. If you face any issues or have any suggestions, please feel free to open an issue or a PR. -CLIO (Claude Language Insights and Observability) is a framework developed by Anthropic that enables privacy-preserving analysis of user conversations at scale. It works by combining language models and clustering techniques to generate meaningful insights while protecting user privacy. The system processes conversations through multiple stages of summarization and clustering, gradually abstracting away personal details while preserving important patterns and trends. +At it's core, Kura exposes the following few features as shown in the diagram below -At its core, CLIO uses a two-step approach: first, it employs language models to create privacy-preserving summaries of individual conversations, removing any personally identifiable information (PII). Then, it uses clustering algorithms and hierarchical organization to group similar conversations together, allowing analysts to understand broad usage patterns and user needs without accessing sensitive user data. This methodology achieved a 98.5% success rate in PII removal while maintaining the ability to generate actionable insights from user interactions. +- A Summarisation Model that takes user conversations and summarises them into a task description +- Summary Hooks that take the same conversations and extract out valuable metadata from them ( that you specify) +- A base clustering model that takes the summaries and clusters them into groups based off their embeddings +- A clustering model that takes these clusters and further clusters them into more groups based off their embeddings -This repo shows a simplified implementation of the CLIO framework. It's not optimised and it's not designed to be used in production. I've also provided a simple FastHTML app to help visualise the clusters and generate your own visualisations. +This creates a list of hierachal clusters that are labelled with language models with the metadata that you specify and care about. -![](./clio.png) +![](./kura.png) -It's just a fun project to understand the ideas behind CLIO. - -## Instructions - -> Make sure you have a `GOOGLE_API_KEY` set in your shell and `OPENAI_API_KEY` set in your shell. - -I've provided two ways to run the code - -1. Using the FastHTML app - this allows you to visualise the clusters and generate your own visualisations. I recommend this since it's just nicer to use than a CLI -2. Using the scripts directly - this allows you to run it in a script and get the raw `cluster.json` file generated out - -## Using the FastHTML app - -1. First, you need to install the dependencies inside the `pyproject.toml` file. I recommend doing so in a virtual environment. - -```bash -uv venv -source .venv/bin/activate -uv sync -``` - -2. Then just run the `app.py` file - -```bash -python app.py -``` - -3. Then you want to just click the `Start Analysis` button and wait for the clusters to be generated. Depending on the number of conversations you have this could take a while. For ~800 conversations, it took around 1.5 minutes to generate the clusters with a semaphore of 50. - -Once you've done so, I recommend just taking cluster.json and throwing it into something like Claude to ask more questions about the clusters. - -## Using the Scripts - -> Before running the scripts, make sure that you've downloaded your claude chats. A guide on how to do so can be found [here](https://support.anthropic.com/en/articles/9450526-how-can-i-export-my-claude-ai-data). - -1. First, you need to install the dependencies inside the `pyproject.toml` file. I recommend doing so in a virtual environment. - -``` -uv venv -source .venv/bin/activate -uv sync -``` - -2. Once you've done so, make sure that the claude chats are saved in a file called `conversations.json` and that you've set a `GOOGLE_API_KEY` in your shell. If not you'll have to configure it by doing +Once you've installed the package with the command `pip install kura`, you can use the following initialisation code to get started ```python -import google.generativeai as genai - -genai.configure(api_key=) -``` - -Once you've done so, just run `main.py` to generate the initial clusters. Make sure to modify the following variables to your liking: - -```py -SUMMARIES_PER_CLUSTER = 20 # This determines the number of summaries we want on average per cluster -CHILD_CLUSTERS_PER_CLUSTER = 10 # This determines the number of clusters we want on average to have per higher level cluster -MAX_FINAL_CLUSTERS = 10 # This represents the maximum number of clusters we want to have at the end of the process -``` - -Once you've done so, just run `main.py` to generate the initial clusters. This will create a file called `clusters.json` which contains the initial clusters. - -```python -python main.py -``` - -3. Once you've done so, you can run `visualise.py` to visualise the clusters. This will create a print out that looks like a tree. - -```python -python visualise.py -``` - -You'll see an output that looks like this: +from kura import Kura -```bash -Clusters -├── Improve text, code, and generate diverse content -│ Description: Users requested assistance with improving text and code, and generating diverse content and marketing materials. Tasks included rewriting, debugging, analysis, and content creation across -│ various domains. -│ Contains 308 conversations -│ ├── Rewrite and improve text and code -│ │ Description: Users requested assistance with improving and rewriting various types of text, including articles, marketing materials, technical documents, and code. Tasks ranged from enhancing clarity -│ │ and conciseness to debugging code and analyzing data. -│ │ Contains 183 conversations -│ │ ├── Rewrite articles and marketing copy related to AI and databases -│ │ │ Description: Users requested assistance rewriting articles and marketing materials about AI, databases, and related technologies. The requests involved tasks such as improving clarity, style, -│ │ │ conciseness, and creating outlines and summaries. -│ │ │ Contains 28 conversations -│ │ ├── Rewrite or improve text -│ │ │ Description: Users requested assistance with revising, rewriting, or improving existing text, including paragraphs, articles, summaries, and other written content. Tasks ranged from enhancing -│ │ │ clarity and conciseness to translating languages and improving writing style. -│ │ │ Contains 24 conversations -│ │ ├── Improve or create AI-related documents -│ │ │ Description: Users requested assistance with various tasks related to improving or creating documents about AI, including summarization, rewriting, clarification, and the addition of definitions. -│ │ │ These tasks focused on improving clarity, -... more clusters here +kura = Kura() # The default models and parameters are here +kura.load_conversations(conversations) # Load your conversations +kura.cluster_conversations() # This creates the hierachal clusters for your specific usage ``` -This is a tree representation of the clusters. The clusters are grouped by their parent cluster. The clusters are sorted by the number of conversations they contain. You can then use this tree to understand the conversations and the patterns they contain. +We expose the following parameters that you can use diff --git a/clio.png b/clio.png deleted file mode 100644 index caaeb94..0000000 Binary files a/clio.png and /dev/null differ diff --git a/helpers/clusters.py b/helpers/clusters.py deleted file mode 100644 index 89599aa..0000000 --- a/helpers/clusters.py +++ /dev/null @@ -1,408 +0,0 @@ -import instructor -from asyncio import Semaphore -from helpers.embedding import embed_cluster, embed_summary -import math -from helpers.types import ( - CandidateClusters, - Cluster, - ClusterLabel, - ClusterSummary, - ConsolidatedCluster, -) -from helpers.sampling import get_contrastive_examples -from tqdm.asyncio import tqdm_asyncio as asyncio -from openai import AsyncOpenAI -from sklearn.cluster import KMeans -import numpy as np -import random -import os -import json - - -def cluster_items(items: list[dict], items_per_cluster: int) -> list[dict]: - n_clusters = math.ceil(len(items) // items_per_cluster) - embeddings = [item["embedding"] for item in items] - X = np.array(embeddings) - - kmeans = KMeans(n_clusters=n_clusters) - cluster_labels = kmeans.fit_predict(X) - - group_to_clusters = {} - for i, item in enumerate(items): - item_copy = item.copy() - cluster_id = int(cluster_labels[i]) - del item_copy["embedding"] - if cluster_id not in group_to_clusters: - group_to_clusters[cluster_id] = [] - - group_to_clusters[cluster_id].append(item_copy) - - return group_to_clusters - - -async def generate_base_cluster( - client, - sem, - user_requests: list[dict], - negative_examples: list[dict], -): - async with sem: - cluster = await client.chat.completions.create( - messages=[ - { - "role": "system", - "content": """ - You are tasked with summarizing a group of related statements into a short, precise, and accurate description and name. Your goal is to create a concise summary that captures the essence of these statements and distinguishes them from other similar groups of statements. - - Summarize all the statements into a clear, precise, two-sentence description in the past tense. Your summary should be specific to this group and distinguish it from the contrastive answers of the other groups. - - After creating the summary, generate a short name for the group of statements. This name should be at most ten words long (perhaps less) and be specific but also reflective of most of the statements (rather than reflecting only one or two). The name should distinguish this group from the contrastive examples. For instance, "Write fantasy sexual roleplay with octopi and monsters", "Generate blog spam for gambling websites", or "Assist with high school math homework" would be better and more actionable than general terms like "Write erotic content" or "Help with homework". Be as descriptive as possible and assume neither good nor bad faith. Do not hesitate to identify and describe socially harmful or sensitive topics specifically; specificity is necessary for monitoring - - The cluster name should be a sentence in the imperative that captures the user’s request. For example, ‘Brainstorm ideas for a birthday party’ or ‘Help me find a new job.” - """, - }, - { - "role": "user", - "content": """ - Here are the relevant statements - - Below are the related statements: - - {% for item in user_requests %} - {{ item['user_request'] }} - {% endfor %} - - - For context, here are statements from nearby groups that are NOT part of the group you’re summarizing - - - {% for item in negative_examples %} - {{ item['user_request'] }} - {% endfor %} - - - Remember to analyze both the statements and the contrastive statements carefully to ensure your summary and name accurately represent the specific group while distinguishing it from others. - """, - }, - ], - response_model=ClusterSummary, - context={ - "user_requests": user_requests, - "negative_examples": negative_examples, - }, - ) - - return Cluster( - name=cluster.name, - description=cluster.summary, - chat_ids=[item["chat_id"] for item in user_requests], - parent_id=None, - ) - - -async def embed_summaries( - oai_client: AsyncOpenAI, - sem: Semaphore, - summaries: list[dict], - output_file: str = "checkpoints/embedded_summaries.json", - start_step: str = None, -) -> list[dict]: - should_reembed = start_step in ["embed", "summarize"] if start_step else False - - if not should_reembed and os.path.exists(output_file): - with open(output_file, "r") as f: - return [json.loads(line) for line in f] - - embedded_summaries = await asyncio.gather( - *[ - embed_summary(oai_client, sem, summary, summary["task_description"]) - for summary in summaries - ], - desc="Embedding summaries", - ) - - os.makedirs("checkpoints", exist_ok=True) - with open(output_file, "w") as f: - for summary in embedded_summaries: - f.write(json.dumps(summary) + "\n") - - return embedded_summaries - - -async def cluster_summaries( - client: instructor.Instructor, - sem: Semaphore, - summaries: list[dict], - items_per_cluster: int = 5, - start_step: str = None, -): - oai_client = AsyncOpenAI() - embedded_summaries = await embed_summaries( - oai_client, sem, summaries, start_step=start_step - ) - - cluster_id_to_summaries = cluster_items(embedded_summaries, items_per_cluster) - - return await asyncio.gather( - *[ - generate_base_cluster( - client, - sem, - cluster_id_to_summaries[cluster_id], - get_contrastive_examples( - cluster_id, cluster_id_to_summaries, desired_count=10 - ), - ) - for cluster_id in cluster_id_to_summaries - ] - ) - - -async def label_cluster( - client: instructor.AsyncInstructor, - sem: Semaphore, - cluster: dict, - candidate_clusters: list[str], -) -> dict: - async with sem: - candidate_clusters = candidate_clusters.copy() - random.shuffle(candidate_clusters) - label = await client.chat.completions.create( - messages=[ - { - "role": "system", - "content": """ - You are tasked with categorizing a specific cluster into one of the provided higher-level clusters for observability, monitoring, and content moderation. Your goal is to determine which higher-level cluster best fits the given specific cluster based on its name and description. - - First, here are the ONLY valid higher-level clusters you may select from: - - {% for cluster in candidate_clusters %} - {{ cluster }} - {% endfor %} - - - Here is the specific cluster to categorize: - - Name: {{ cluster["name"] }} - Description: {{ cluster["description"] }} - - - RULES: - 1. You MUST select EXACTLY ONE higher-level cluster from the provided list - 2. You MUST output the higher-level cluster name EXACTLY as written - no modifications allowed - 3. You MUST NOT create new cluster names or combinations - 4. You MUST NOT output any additional text or explanations - 5. You MUST NOT use partial matches or approximate names - - CLASSIFICATION PROCESS: - 1. First, record the exact list of valid higher-level clusters - 2. Read the specific cluster's name and description carefully - 3. Compare the specific cluster's key characteristics against each valid higher-level cluster - 4. Select the single most appropriate higher-level cluster that encompasses the specific cluster - 5. Verify your selected cluster exactly matches one from the valid list - 6. Output ONLY the selected higher-level cluster name, exactly as it appeared in the valid list - - Here is the specific cluster to categorize: - - - Name: {{ cluster["name"] }} - Description: {{ cluster["description"] }} - - - Based on this information, determine the most appropriate higher-level cluster and provide your answer as instructed. - """, - } - ], - context={ - "cluster": cluster, - "candidate_clusters": candidate_clusters, - }, - response_model=ClusterLabel, - max_retries=3, - ) - return { - "cluster": cluster, - "higher_level_cluster": label.higher_level_cluster, - } - - -async def generate_candidate_cluster_names( - client: instructor.Instructor, sem: Semaphore, clusters: list[Cluster] -) -> list[str]: - resp = await client.chat.completions.create( - messages=[ - { - "role": "system", - "content": """ - You are tasked with creating higher-level cluster names based on a given list of clusters and their descriptions. Your goal is to come up with broader categories that could encompass one or more of the provided clusters - - First, review the list of clusters and their descriptions: - - {% for cluster in clusters %} - {{ cluster.name }}: {{ cluster.description }} - {% endfor %} - - - Your task is to create at most {{ desired_number }} higher-level cluster names that could potentially include one or more of the provided clusters. These higher-level clusters should represent broader categories or themes that emerge from the given clusters, while remaining as specific as possible. If there are many clusters with a specific theme, ensure that the higher-level cluster name remains the maximum level of specificity. You are helping to organize user behavior data in order to improve safety, monitoring, and observability. You can generate less than {{ desired_number }} names if you feel that fewer are appropriate and accurately capture the clusters. - - Guidelines for creating higher-level clusters names - 1. Analyze the themes, topics or characteristics common to multiple clusters. - 2. Create names that are specific enough to be meaningful but but not so specific that they can’t meaningfully represent many different clusters. Avoid overly general or vague terms, and do not hesitate to describe socially harmful or sensitive topics (in fact, clusters that clearly describe harmful behavior are slightly preferred); specificity is necessary for observability and enforcement. - 3. Ensure that the higher-level cluster names are distinct from one another. - 4. Use clear, concise, and descriptive language for the cluster names. Assume neither good nor bad faith for the content in the clusters. - - Think about the relationships between the given clusters and potential overarching themes. - - Focus on creating meaningful, distinct and precise ( but not overly specific ) higher-level cluster names that could encompass multiple sub-clusters. - """, - } - ], - response_model=CandidateClusters, - context={ - "clusters": clusters, - "desired_number": math.ceil( - (len(clusters) * 3) // 4 - ), # This ensure we get at least 3/4 of the clusters ( so we have a 25% reduction or more at each stage) - }, - max_retries=3, - ) - - return resp.candidate_cluster_names - - -async def rename_higher_level_cluster( - client: instructor.AsyncInstructor, - sem: Semaphore, - clusters: dict, -) -> dict: - async with sem: - resp = await client.chat.completions.create( - messages=[ - { - "role": "system", - "content": """ - You are tasked with summarizing a group of related cluster names into a short, precise, and accurate overall description and name. Your goal is to create a concise summary that captures the essence of these clusters - - The cluster name should be at most ten words long (perhaps less) and be specific but also reflective of most of the clusters that comprise them. The cluster name should be a sentence in the imperative that captures the user’s request. For example, ‘Brainstorm ideas for a birthday party’ or ‘Help me find a new job are good examples. - - Do not shy away from describing socially harmful or sensitive topics. For instance, "Write fantasy sexual roleplay with octopi and monsters", "Generate blog spam for gambling websites", or "Assist with high school math homework" would be better than "Write erotic content" or "Help with homework". Be as descriptive as possible and assume neither good nor bad faith. Do not hesitate to identify and describe socially harmful or sensitive topics specifically; specificity is necessary for monitoring. - - The cluster description should be a clear, precise, two-sentence description in the past tense. This description should be specific to this cluster. - - Below are the related cluster names - - {% for cluster in clusters %} - {{ cluster.name }}: {{ cluster.description }} - {% endfor %} - - - Ensure your summary and name accurately represent the clusters and are specific to the clusters. - """, - } - ], - context={"clusters": clusters}, - response_model=ConsolidatedCluster, - ) - - return { - "new_cluster": Cluster( - name=resp.cluster_name, - description=resp.cluster_description, - chat_ids=[chat_id for cluster in clusters for chat_id in cluster.chat_ids], - parent_id=None, - ), - "original_clusters": clusters, - } - - -async def generate_higher_level_cluster( - client: instructor.Instructor, - sem: Semaphore, - clusters: list[Cluster], -) -> list[Cluster]: - if len(clusters) == 1: - original_cluster = clusters[0] - new_cluster = Cluster( - name=original_cluster.name, - description=original_cluster.description, - chat_ids=original_cluster.chat_ids, - parent_id=None, - ) - original_cluster.parent_id = new_cluster.id - return [original_cluster, new_cluster] - - candidate_cluster_names = await generate_candidate_cluster_names( - client, sem, clusters - ) - - new_candidate_clusters = await asyncio.gather( - *[ - label_cluster(client, sem, cluster, candidate_cluster_names) - for cluster in clusters - ], - desc="Generating candidate higher-level clusters", - ) - - cluster_groups: dict[str, list[Cluster]] = {} - for cluster in new_candidate_clusters: - original_cluster = cluster["cluster"] - new_higher_level_cluster = cluster["higher_level_cluster"] - if new_higher_level_cluster not in cluster_groups: - cluster_groups[new_higher_level_cluster] = [] - cluster_groups[new_higher_level_cluster].append(original_cluster) - - new_labelled_clusters = await asyncio.gather( - *[ - rename_higher_level_cluster(client, sem, cluster_group) - for cluster_group in cluster_groups.values() - ], - desc="Generating higher-level clusters", - ) - - res = [] - - for new_labelled_cluster in new_labelled_clusters: - res.append(new_labelled_cluster["new_cluster"]) - - for original_cluster in new_labelled_cluster["original_clusters"]: - original_cluster.parent_id = new_labelled_cluster["new_cluster"].id - res.append(original_cluster) - - return res - - -async def reduce_clusters( - client: instructor.Instructor, - sem: Semaphore, - clusters: list[Cluster], - items_per_cluster: int, -) -> list[Cluster]: - oai_client = AsyncOpenAI() - embedded_clusters = await asyncio.gather( - *[embed_cluster(oai_client, sem, cluster) for cluster in clusters] - ) - - cluster_id_to_cluster = { - cluster_id: [item["cluster"] for item in clusters] - for cluster_id, clusters in cluster_items( - embedded_clusters, items_per_cluster - ).items() - } - - new_clusters = await asyncio.gather( - *[ - generate_higher_level_cluster( - client, - sem, - cluster_id_to_cluster[cluster_id], - ) - for cluster_id in cluster_id_to_cluster - ], - desc="Generating higher-level clusters", - ) - return [ - cluster - for clusters in new_clusters - if clusters is not None - for cluster in clusters - ] diff --git a/helpers/conversation.py b/helpers/conversation.py deleted file mode 100644 index c579306..0000000 --- a/helpers/conversation.py +++ /dev/null @@ -1,95 +0,0 @@ -import json -from helpers.types import Conversation, Message, ConversationSummary -from typing import List -import instructor -from asyncio import Semaphore - - -def load_conversations(path: str) -> List[Conversation]: - """ - This is a function that loads in the conversations from the given path and yields the user's conversations - """ - with open(path, "r") as f: - chat_obj = json.load(f) - return [ - Conversation( - chat_id=chat["uuid"], - created_at=chat["created_at"], - messages=[ - Message( - created_at=message["created_at"], - role=message["sender"], - content="\n".join( - [ - item["text"] - for item in message["content"] - if item["type"] == "text" - ] - ), - ) - for message in chat["chat_messages"] - ], - ) - for chat in chat_obj - ] - - -async def summarise_conversation( - client: instructor.AsyncInstructor, sem: Semaphore, conversation: Conversation -) -> dict: - """ - This is a function that given a user conversation will return a summary of the user request and the task description - - Task Description: The task is to do X - User Request: The user's overall request for the assistant is to do Y - - """ - async with sem: - resp = await client.chat.completions.create( - messages=[ - { - "role": "system", - "content": """Generate a summary of the task that the user is asking and a description of the task that the assistant is trying to complete based off the following conversation. - - Here are some examples of user requests - - - The user’s overall request for the assistant is to help implementing a React component to display a paginated list of users from a database. - - The user’s overall request for the assistant is to debug a memory leak in their Python data processing pipeline. - - The user’s overall request for the assistant is to design and architect a REST API for a social media application. - - - Task descriptions should be concise and short. Here are some examples of task descriptions - - - The task is to help build a frontend component with React and implement database integration - The task is to debug performance issues and optimize memory usage in Python code - The task is to design and architect a RESTful API following best practices - - - Here is the conversation - {% for message in messages %} - - {{message.role}}: {{message.content}} - - {% endfor %} - - When answering, do not include any personally identifiable information (PII), like names, locations, phone numbers, email addressess, and so on. When answering, do not include any proper nouns. Output your answer to the question in English inside tags; be clear and concise and get to the point in at most two sentences (don't say "Based on the conversation..." and avoid mentioning Claude/the chatbot). For example: - - Remember that - - User requests and task descriptions should be concise and short. They should each be at most 1-2 sentences and at most 20 words. - - User requests should start with "The user's overall request for the assistant is to" - - Task descriptions should start with "The task is to" - - Make sure to omit any personally identifiable information (PII), like names, locations, phone numbers, email addressess, company names and so on. - - Make sure to indicate specific details such as programming languages, frameworks, libraries and so on which are relevant to the task. Also mention the specific source of the data if it's relevant to the task. For instance, if the user is asking to perform a calculation, let's talk about the specific source of the data. - """, - } - ], - context={"messages": conversation.messages}, - response_model=ConversationSummary, - ) - return { - "chat_id": conversation.chat_id, - "task_description": resp.task_description, - "user_request": resp.user_request, - "turns": len(conversation.messages), - } diff --git a/helpers/embedding.py b/helpers/embedding.py deleted file mode 100644 index 300d16b..0000000 --- a/helpers/embedding.py +++ /dev/null @@ -1,37 +0,0 @@ -from openai import AsyncOpenAI -from asyncio import Semaphore -from helpers.types import Cluster - - -async def embed_summary( - oai_client: AsyncOpenAI, sem: Semaphore, item: str, text_to_embed: str -) -> list[float]: - return { - "embedding": ( - await oai_client.embeddings.create( - input=text_to_embed, model="text-embedding-3-small" - ) - ) - .data[0] - .embedding, - **item, - } - - -async def embed_cluster( - oai_client: AsyncOpenAI, sem: Semaphore, cluster: Cluster -) -> list[float]: - return { - "embedding": ( - await oai_client.embeddings.create( - input=f""" - Name: {cluster.name} - Description: {cluster.description} - """, - model="text-embedding-3-small", - ) - ) - .data[0] - .embedding, - "cluster": cluster, - } diff --git a/helpers/sampling.py b/helpers/sampling.py deleted file mode 100644 index bf4d5e9..0000000 --- a/helpers/sampling.py +++ /dev/null @@ -1,24 +0,0 @@ -import numpy as np - - -def get_contrastive_examples( - cluster_id: int, - grouped_clusters: dict[int, list[dict]], - desired_count: int = 10, -) -> dict[int, list[dict]]: - other_clusters = [c for c in grouped_clusters.keys() if c != cluster_id] - - if len(other_clusters) == 0: - raise ValueError("No other clusters to compare against") - - # Get all examples from other clusters - all_examples = [] - for cluster in other_clusters: - all_examples.extend(grouped_clusters[cluster]) - - # If we don't have enough examples, use replacement - if len(all_examples) < desired_count: - return all_examples - - # Otherwise sample without replacement - return list(np.random.choice(all_examples, size=desired_count, replace=False)) diff --git a/helpers/types.py b/helpers/types.py deleted file mode 100644 index f80ba31..0000000 --- a/helpers/types.py +++ /dev/null @@ -1,94 +0,0 @@ -from pydantic import BaseModel, field_validator, computed_field, Field, ValidationInfo -import uuid - - -class Message(BaseModel): - created_at: str - role: str - content: str - - -class Conversation(BaseModel): - chat_id: str - created_at: str - messages: list[Message] - - -class Cluster(BaseModel): - id: str = Field( - default_factory=lambda: uuid.uuid4().hex, - ) - name: str - description: str - parent_id: str | None - chat_ids: list[str] - - @computed_field - def count(self) -> int: - return len(self.chat_ids) - - def add_child_count(self, child: "Cluster"): - return Cluster( - name=self.name, - description=self.description, - chat_ids=self.chat_ids + child.chat_ids, - ) - - -class ConversationSummary(BaseModel): - task_description: str - user_request: str - - @field_validator("user_request", "task_description") - def validate_length(cls, v): - if len(v.split()) > 25: - raise ValueError( - f"Please summarize the sentence {v} to at most 20 words. It's currently {len(v.split())} words long. Remove any unnecessary words and make sure to retain the most important information." - ) - return v - - -class ClusterSummary(BaseModel): - """ - This is a summary of the related statements into a single cluster that captures the essence of these statements and distinguishes them from the contrastive answers of other groups. - - Your job is to create a final name and summary for the cluster - """ - - name: str - summary: str - - -class CandidateClusters(BaseModel): - candidate_cluster_names: list[str] - - @field_validator("candidate_cluster_names") - def validate_length(cls, v, info: ValidationInfo): - desired_number = info.context["desired_number"] - if len(v) > desired_number: - raise ValueError( - f"Too many candidate cluster names: got {len(v)}, expected at most {desired_number}. Please combine similar clusters to reduce the total number." - ) - return v - - -class ClusterLabel(BaseModel): - higher_level_cluster: str - - @field_validator("higher_level_cluster") - def validate_length(cls, v, info: ValidationInfo): - candidate_clusters = info.context["candidate_clusters"] - if v not in candidate_clusters: - raise ValueError( - f"The chosen label of {v} is not in the list of candidate clusters provided of {candidate_clusters}. You must choose a label that belongs to the list of candidate clusters - {candidate_clusters}." - ) - return v - - -class ConsolidatedCluster(BaseModel): - """ - This is a consolidated cluster that is the result of merging multiple clusters into a single higher levle cluster - """ - - cluster_name: str - cluster_description: str diff --git a/helpers/visualisation.py b/helpers/visualisation.py deleted file mode 100644 index 7e441a0..0000000 --- a/helpers/visualisation.py +++ /dev/null @@ -1,208 +0,0 @@ -from datetime import datetime, timedelta -import pandas as pd -from fasthtml.common import Script -import json -from typing import List -from helpers.types import Conversation - - -def generate_cumulative_chart(conversations: List[Conversation]) -> Script: - """ - Generate a cumulative word count chart for human messages in conversations. - Returns a Script element containing the Plotly visualization. - """ - # Create DataFrame from messages - messages_data = [] - for conv in conversations: - for msg in conv.messages: - if msg.role == "human": - messages_data.append( - { - "datetime": pd.to_datetime( - msg.created_at.replace("Z", "+00:00") - ), - "words": len(msg.content.split()), - } - ) - - df = pd.DataFrame(messages_data) - df["week_start"] = df["datetime"].dt.to_period("W-MON").dt.start_time - - # Calculate weekly and cumulative word counts - weekly_df = df.groupby("week_start")["words"].sum().reset_index() - weekly_df["cumulative_words"] = weekly_df["words"].cumsum() - weekly_df["week_start"] = weekly_df["week_start"].dt.strftime("%Y-%m-%d") - - data = json.dumps( - { - "data": [ - { - "x": weekly_df["week_start"].tolist(), - "y": weekly_df["cumulative_words"].tolist(), - "type": "scatter", - "mode": "lines", - "name": "Cumulative Words in Human Messages", - "line": {"color": "red"}, - } - ], - "layout": { - "title": "Cumulative Words in Human Messages by Week", - "xaxis": {"title": "Week Starting"}, - "yaxis": {"title": "Total Words"}, - "showlegend": True, - "hovermode": "closest", - }, - } - ) - - return Script(f"var data = {data}; Plotly.newPlot('myDiv', data);") - - -def generate_messages_per_chat_chart(conversations): - # Create DataFrame from messages - messages_data = [] - for conv in conversations: - for msg in conv.messages: - if msg.role == "human": - messages_data.append( - { - "datetime": pd.to_datetime( - msg.created_at.replace("Z", "+00:00") - ), - "chat_id": conv.chat_id, - } - ) - - df = pd.DataFrame(messages_data) - df["week_start"] = df["datetime"].dt.to_period("W-MON").dt.start_time - - # Calculate messages and unique chats per week - weekly_messages = df.groupby("week_start").size().reset_index(name="message_count") - weekly_chats = ( - df.groupby("week_start")["chat_id"].nunique().reset_index(name="chat_count") - ) - - # Merge and calculate average - weekly_df = pd.merge(weekly_messages, weekly_chats, on="week_start") - weekly_df["avg_messages"] = weekly_df["message_count"] / weekly_df["chat_count"] - weekly_df["week_start"] = weekly_df["week_start"].dt.strftime("%Y-%m-%d") - - data = json.dumps( - { - "data": [ - { - "x": weekly_df["week_start"].tolist(), - "y": weekly_df["avg_messages"].tolist(), - "type": "scatter", - "mode": "lines+markers", - "name": "Average Messages per Chat", - "line": {"color": "coral"}, - "marker": {"size": 6}, - } - ], - "layout": { - "title": "Average Number of Messages per Chat by Week", - "xaxis": {"title": "Week Starting"}, - "yaxis": {"title": "Average Messages per Chat"}, - "showlegend": True, - "hovermode": "closest", - }, - } - ) - - return Script( - f"var messages_data = {data}; Plotly.newPlot('messagesDiv', messages_data);" - ) - - -def generate_messages_per_week_chart(conversations: List[Conversation]): - messages_data = [] - for conv in conversations: - for msg in conv.messages: - messages_data.append( - { - "datetime": pd.to_datetime(msg.created_at.replace("Z", "+00:00")), - "chat_id": conv.chat_id, - } - ) - - df = pd.DataFrame(messages_data) - df["week_start"] = df["datetime"].dt.to_period("W-MON").dt.start_time - - # Calculate messages per week - weekly_messages = df.groupby("week_start").size().reset_index(name="message_count") - weekly_messages["week_start"] = weekly_messages["week_start"].dt.strftime( - "%Y-%m-%d" - ) - - data = json.dumps( - { - "data": [ - { - "x": weekly_messages["week_start"].tolist(), - "y": weekly_messages["message_count"].tolist(), - "type": "bar", - "name": "Messages per Week", - "marker": {"color": "coral"}, - } - ], - "layout": { - "title": "Messages per Week", - "xaxis": {"title": "Week Starting"}, - "yaxis": {"title": "Number of Messages"}, - "showlegend": True, - "hovermode": "closest", - "bargap": 0.15, - }, - } - ) - - return Script( - f"var messages_per_week = {data}; Plotly.newPlot('messagesPerWeekDiv', messages_per_week.data, messages_per_week.layout);" - ) - - -def generate_new_chats_per_week_chart(conversations: List[Conversation]): - # Calculate new chats per week - chat_starts = pd.DataFrame( - [ - { - "datetime": pd.to_datetime(conv.created_at.replace("Z", "+00:00")), - "chat_id": conv.chat_id, - } - for conv in conversations - ] - ) - chat_starts["week_start"] = ( - chat_starts["datetime"].dt.to_period("W-MON").dt.start_time - ) - weekly_chats = ( - chat_starts.groupby("week_start").size().reset_index(name="chat_count") - ) - weekly_chats["week_start"] = weekly_chats["week_start"].dt.strftime("%Y-%m-%d") - - data = json.dumps( - { - "data": [ - { - "x": weekly_chats["week_start"].tolist(), - "y": weekly_chats["chat_count"].tolist(), - "type": "bar", - "name": "New Chats per Week", - "marker": {"color": "skyblue"}, - } - ], - "layout": { - "title": "New Chats Created per Week", - "xaxis": {"title": "Week Starting"}, - "yaxis": {"title": "Number of New Chats"}, - "showlegend": True, - "hovermode": "closest", - "bargap": 0.15, - }, - } - ) - - return Script( - f"var chats_per_week = {data}; Plotly.newPlot('chatsPerWeekDiv', chats_per_week.data, chats_per_week.layout);" - ) diff --git a/kura.png b/kura.png new file mode 100644 index 0000000..b6a43af Binary files /dev/null and b/kura.png differ diff --git a/kura/__init__.py b/kura/__init__.py index 45730d2..2768ccb 100644 --- a/kura/__init__.py +++ b/kura/__init__.py @@ -1,14 +1,5 @@ -from .cluster import ClusterModel -from .types import Cluster, ConversationSummary, Conversation, Message -from .llm_cluster import LLMCluster -from .summarise import SummariseBase +from .kura import Kura __all__ = [ - "ClusterModel", - "Cluster", - "ConversationSummary", - "Conversation", - "Message", - "LLMCluster", - "SummariseBase", + "Kura", ] diff --git a/kura/base_classes/__init__.py b/kura/base_classes/__init__.py new file mode 100644 index 0000000..0f7d06c --- /dev/null +++ b/kura/base_classes/__init__.py @@ -0,0 +1,15 @@ +from .embedding import BaseEmbeddingModel +from .summarisation import BaseSummaryModel +from .clustering_method import BaseClusteringMethod +from .cluster import BaseClusterModel +from .meta_cluster import BaseMetaClusterModel +from .dimensionality import BaseDimensionalityReduction + +__all__ = [ + "BaseEmbeddingModel", + "BaseSummaryModel", + "BaseClusteringMethod", + "BaseClusterModel", + "BaseMetaClusterModel", + "BaseDimensionalityReduction", +] diff --git a/kura/base_classes/cluster.py b/kura/base_classes/cluster.py new file mode 100644 index 0000000..bebfa23 --- /dev/null +++ b/kura/base_classes/cluster.py @@ -0,0 +1,10 @@ +from abc import ABC, abstractmethod +from kura.types import Cluster, ConversationSummary + + +class BaseClusterModel(ABC): + @abstractmethod + def cluster_summaries(self, summaries: list[ConversationSummary]) -> list[Cluster]: + pass + + # TODO : Add abstract method for hooks here once we start supporting it diff --git a/kura/base_classes/clustering_method.py b/kura/base_classes/clustering_method.py new file mode 100644 index 0000000..01365d8 --- /dev/null +++ b/kura/base_classes/clustering_method.py @@ -0,0 +1,12 @@ +from abc import ABC, abstractmethod +from typing import TypeVar, Union + +T = TypeVar("T") + + +class BaseClusteringMethod(ABC): + @abstractmethod + def cluster( + self, items: list[dict[str, Union[T, list[float]]]] + ) -> dict[int, list[T]]: + pass diff --git a/kura/base_classes/dimensionality.py b/kura/base_classes/dimensionality.py new file mode 100644 index 0000000..10c2a8c --- /dev/null +++ b/kura/base_classes/dimensionality.py @@ -0,0 +1,12 @@ +from abc import ABC, abstractmethod + +from kura.types import Cluster + + +class BaseDimensionalityReduction(ABC): + @abstractmethod + async def reduce_dimensionality(self, clusters: list[Cluster]) -> list[Cluster]: + """ + This reduces the dimensionality of the individual clusters that we've created so we can visualise them in a lower dimension + """ + pass diff --git a/kura/base_classes/embedding.py b/kura/base_classes/embedding.py new file mode 100644 index 0000000..d1d650f --- /dev/null +++ b/kura/base_classes/embedding.py @@ -0,0 +1,9 @@ +from abc import ABC, abstractmethod +from asyncio import Semaphore + + +class BaseEmbeddingModel(ABC): + @abstractmethod + async def embed(self, text: str) -> list[float]: + """Embed a single text into a list of floats""" + pass diff --git a/kura/base_classes/meta_cluster.py b/kura/base_classes/meta_cluster.py new file mode 100644 index 0000000..8ea6196 --- /dev/null +++ b/kura/base_classes/meta_cluster.py @@ -0,0 +1,8 @@ +from abc import ABC, abstractmethod +from kura.types.cluster import Cluster + + +class BaseMetaClusterModel(ABC): + @abstractmethod + def reduce_clusters(self, clusters: list[Cluster]) -> list[Cluster]: + pass diff --git a/kura/base_classes/summarisation.py b/kura/base_classes/summarisation.py new file mode 100644 index 0000000..4729b37 --- /dev/null +++ b/kura/base_classes/summarisation.py @@ -0,0 +1,28 @@ +from abc import ABC, abstractmethod + +from kura.types import Conversation, ConversationSummary + + +class BaseSummaryModel(ABC): + @abstractmethod + async def summarise( + self, conversations: list[Conversation] + ) -> list[ConversationSummary]: + """Summarise the conversations into a list of ConversationSummary""" + pass + + @abstractmethod + async def summarise_conversation( + self, conversation: Conversation + ) -> ConversationSummary: + """Summarise a single conversation into a single string""" + pass + + @abstractmethod + async def apply_hooks( + self, conversation: ConversationSummary + ) -> ConversationSummary: + """Apply hooks to the conversation summary""" + # Assert that the implementation of the class has a hooks attribute so we can call it in summarise_conversation + assert hasattr(self, "hooks") + pass diff --git a/kura/cli/server.py b/kura/cli/server.py index b4dfc9c..ca88b9d 100644 --- a/kura/cli/server.py +++ b/kura/cli/server.py @@ -2,7 +2,8 @@ from fastapi.middleware.cors import CORSMiddleware from pydantic import BaseModel from pathlib import Path -from kura.types import Cluster, Conversation, Message +from kura import Kura +from kura.types import ProjectedCluster, Conversation, Message from kura.cli.visualisation import ( generate_cumulative_chart_data, generate_messages_per_chat_data, @@ -57,16 +58,24 @@ async def analyse_conversations(conversation_data: ConversationData): ] # Load clusters from checkpoint file if it exists - clusters_file = Path(__file__).parent.parent.parent / "checkpoints/clusters.json" + clusters_file = ( + Path(__file__).parent.parent.parent + / "checkpoints/dimensionality_checkpoints.json" + ) clusters = [] - print(clusters_file) - if clusters_file.exists(): - print("") - with open(clusters_file) as f: - clusters_data = [] - for line in f: - clusters_data.append(line) - clusters = [Cluster(**json.loads(cluster)) for cluster in clusters_data] + + if not clusters_file.exists(): + kura = Kura() + kura.conversations = conversations + await kura.cluster_conversations() + + with open(clusters_file) as f: + clusters_data = [] + for line in f: + clusters_data.append(line) + clusters = [ + ProjectedCluster(**json.loads(cluster)) for cluster in clusters_data + ] return { "cumulative_words": generate_cumulative_chart_data(conversations), diff --git a/kura/cli/visualisation.py b/kura/cli/visualisation.py index 4e46ec1..3be54aa 100644 --- a/kura/cli/visualisation.py +++ b/kura/cli/visualisation.py @@ -1,6 +1,6 @@ import pandas as pd from typing import List -from helpers.types import Conversation +from kura.types import Conversation def generate_cumulative_chart_data(conversations: List[Conversation]) -> dict: diff --git a/kura/cluster.py b/kura/cluster.py index 31cd10c..b916ad5 100644 --- a/kura/cluster.py +++ b/kura/cluster.py @@ -1,329 +1,163 @@ -from .types import Cluster, GeneratedCluster -from openai import AsyncOpenAI -from asyncio import Semaphore -from tqdm.asyncio import tqdm_asyncio as asyncio -import math -import re -import random +from kura.base_classes import BaseClusterModel, BaseClusteringMethod, BaseEmbeddingModel +from kura.embedding import OpenAIEmbeddingModel +from kura.k_means import KmeansClusteringMethod +from kura.types import ConversationSummary, Cluster, GeneratedCluster +from tqdm.asyncio import tqdm_asyncio import numpy as np -from sklearn.cluster import KMeans -from pydantic import BaseModel, field_validator, ValidationInfo -from instructor import from_gemini, AsyncInstructor +from asyncio import Semaphore +import instructor import google.generativeai as genai +import os -class CandidateClusters(BaseModel): - candidate_cluster_names: list[str] - - @field_validator("candidate_cluster_names") - def validate_candidate_cluster_names( - cls, v: list[str], info: ValidationInfo - ) -> list[str]: - if len(v) == 0: - raise ValueError("Candidate cluster names must be a non-empty list") - - v = [label.strip() for label in v] - v = [label[:-1] if label.endswith(".") else label for label in v] - - return [re.sub(r"\\{1,}", "", label.replace('"', "")) for label in v] - - -class ClusterLabel(BaseModel): - higher_level_cluster: str - - @field_validator("higher_level_cluster") - def validate_higher_level_cluster(cls, v: str, info: ValidationInfo) -> str: - if v not in info.context["candidate_clusters"]: - raise ValueError( - f""" - Invalid higher-level cluster: |{v}| - - Valid clusters are: - {', '.join(f'|{c}|' for c in info.context['candidate_clusters'])} - """ - ) - return v - - -class ClusterModel: +class ClusterModel(BaseClusterModel): def __init__( self, - embed_model: AsyncOpenAI = AsyncOpenAI(), - cluster_model: AsyncInstructor = from_gemini( + clustering_method: BaseClusteringMethod = KmeansClusteringMethod(), + embedding_model: BaseEmbeddingModel = OpenAIEmbeddingModel(), + max_concurrent_requests: int = 50, + client=instructor.from_gemini( genai.GenerativeModel("gemini-1.5-flash-latest"), use_async=True ), - max_concurrent_calls: int = 40, - base_cluster_per_cluster: int = 20, - ) -> None: - self.sem = Semaphore(max_concurrent_calls) - self.embed_model = embed_model - self.cluster_model = cluster_model - self.base_cluster_per_cluster = base_cluster_per_cluster - - async def embed_cluster(self, cluster: Cluster) -> Cluster: - async with self.sem: - embedding = await self.embed_model.embeddings.create( - input=f""" - Name: {cluster.name} - Description: {cluster.description} - """, - model="text-embedding-3-small", - ) - return { - "item": cluster, - "embedding": embedding.data[0].embedding, - } - - def cluster_base_clusters( - self, clusters: list[Cluster] - ) -> dict[int, list[Cluster]]: - n_clusters = math.ceil(len(clusters) / self.base_cluster_per_cluster) - - if n_clusters == 1: - return {0: [item["item"] for item in clusters]} - - embeddings = [item["embedding"] for item in clusters] - X = np.array(embeddings) - - kmeans = KMeans(n_clusters=n_clusters) - cluster_labels = kmeans.fit_predict(X) - - group_to_clusters = {} - for i, item in enumerate(clusters): - cluster_id = int(cluster_labels[i]) - if cluster_id not in group_to_clusters: - group_to_clusters[cluster_id] = [] - - group_to_clusters[cluster_id].append(item["item"]) - - return group_to_clusters - - async def generate_candidate_cluster_names( - self, clusters: list[Cluster] - ) -> list[str]: - async with self.sem: - resp = await self.cluster_model.chat.completions.create( - messages=[ - { - "role": "system", - "content": """ - You are tasked with creating higher-level cluster names based on a given list of clusters and their descriptions. Your goal is to come up with broader categories that could encompass one or more of the provided clusters - - First, review the list of clusters and their descriptions: - - {% for cluster in clusters %} - {{ cluster.name }}: {{ cluster.description }} - {% endfor %} - - - Your task is to create at most {{ desired_number }} higher-level cluster names that could potentially include one or more of the provided clusters. These higher-level clusters should represent broader categories or themes that emerge from the given clusters, while remaining as specific as possible. If there are many clusters with a specific theme, ensure that the higher-level cluster name remains the maximum level of specificity. You are helping to organize user behavior data in order to improve safety, monitoring, and observability. You can generate less than {{ desired_number }} names if you feel that fewer are appropriate and accurately capture the clusters. - - Guidelines for creating higher-level clusters names - 1. Analyze the themes, topics or characteristics common to multiple clusters. - 2. Create names that are specific enough to be meaningful but but not so specific that they can’t meaningfully represent many different clusters. Avoid overly general or vague terms, and do not hesitate to describe socially harmful or sensitive topics (in fact, clusters that clearly describe harmful behavior are slightly preferred); specificity is necessary for observability and enforcement. - 3. Ensure that the higher-level cluster names are distinct from one another. - 4. Use clear, concise, and descriptive language for the cluster names. Assume neither good nor bad faith for the content in the clusters. + checkpoint_dir: str = "checkpoints", + checkpoint_file: str = "cluster_checkpoint.json", + ): + self.clustering_method = clustering_method + self.embedding_model = embedding_model + self.max_concurrent_requests = max_concurrent_requests + self.client = client + self.checkpoint_dir = checkpoint_dir + self.checkpoint_file = checkpoint_file + + if not os.path.exists(self.checkpoint_dir): + print(f"Creating checkpoint directory {self.checkpoint_dir}") + os.makedirs(self.checkpoint_dir) + + def save_checkpoint(self, clusters: list[Cluster]): + with open(os.path.join(self.checkpoint_dir, self.checkpoint_file), "w") as f: + for cluster in clusters: + f.write(cluster.model_dump_json() + "\n") + + print( + f"Saved checkpoint to {os.path.join(self.checkpoint_dir, self.checkpoint_file)}" + ) - Think about the relationships between the given clusters and potential overarching themes. - - Focus on creating meaningful, distinct and precise ( but not overly specific ) higher-level cluster names that could encompass multiple sub-clusters. - """, - } - ], - response_model=CandidateClusters, - context={ - "clusters": clusters, - "desired_number": math.ceil(len(clusters) / 2), - }, - max_retries=3, - ) - return resp.candidate_cluster_names + def load_checkpoint(self) -> list[Cluster]: + print( + f"Loading Cluster Checkpoint from {os.path.join(self.checkpoint_dir, self.checkpoint_file)}" + ) + with open(os.path.join(self.checkpoint_dir, self.checkpoint_file), "r") as f: + return [Cluster.model_validate_json(line) for line in f] - async def label_cluster( + def get_contrastive_examples( + self, + cluster_id: int, + cluster_id_to_summaries: dict[int, list[ConversationSummary]], + desired_count: int = 10, + ): + other_clusters = [c for c in cluster_id_to_summaries.keys() if c != cluster_id] + all_examples = [] + for cluster in other_clusters: + all_examples.extend(cluster_id_to_summaries[cluster]) + + # If we don't have enough examples, return all of them + if len(all_examples) <= desired_count: + return all_examples + + # Otherwise sample without replacement + return list(np.random.choice(all_examples, size=desired_count, replace=False)) + + async def generate_cluster( self, - cluster: Cluster, - candidate_clusters: list[str], - ) -> dict: - async with self.sem: - candidate_clusters = candidate_clusters.copy() - random.shuffle(candidate_clusters) - label = await self.cluster_model.chat.completions.create( + summaries: list[ConversationSummary], + contrastive_examples: list[ConversationSummary], + sem: Semaphore, + ) -> Cluster: + async with sem: + resp = await self.client.chat.completions.create( messages=[ { "role": "system", "content": """ - You are tasked with categorizing a specific cluster into one of the provided higher-level clusters for observability, monitoring, and content moderation. Your goal is to determine which higher-level cluster best fits the given specific cluster based on its name and description. - - First, here are the ONLY valid higher-level clusters you may select from: - - {% for cluster in candidate_clusters %} - {{ cluster }} - {% endfor %} - - - Here is the specific cluster to categorize: - - Name: {{ cluster["name"] }} - Description: {{ cluster["description"] }} - - - RULES: - 1. You MUST select EXACTLY ONE higher-level cluster from the provided list - 2. You MUST output the higher-level cluster name EXACTLY as written - no modifications allowed - 3. You MUST NOT create new cluster names or combinations - 4. You MUST NOT output any additional text or explanations - 5. You MUST NOT use partial matches or approximate names - - CLASSIFICATION PROCESS: - 1. First, record the exact list of valid higher-level clusters - 2. Read the specific cluster's name and description carefully - 3. Compare the specific cluster's key characteristics against each valid higher-level cluster - 4. Select the single most appropriate higher-level cluster that encompasses the specific cluster - 5. Verify your selected cluster exactly matches one from the valid list - 6. Output ONLY the selected higher-level cluster name, exactly as it appeared in the valid list - - Here is the specific cluster to categorize: - - - Name: {{ cluster["name"] }} - Description: {{ cluster["description"] }} - - - Based on this information, determine the most appropriate higher-level cluster and provide your answer as instructed. - """, - } - ], - context={ - "cluster": cluster, - "candidate_clusters": candidate_clusters, - }, - response_model=ClusterLabel, - max_retries=3, - ) - return { - "cluster": cluster, - "higher_level_cluster": label.higher_level_cluster, - } - - async def rename_cluster_group(self, clusters: list[Cluster]) -> Cluster: - async with self.sem: - resp = await self.cluster_model.chat.completions.create( - messages=[ + You are tasked with summarizing a group of related statements into a short, precise, and accurate description and name. Your goal is to create a concise summary that captures the essence of these statements and distinguishes them from other similar groups of statements. + + Summarize all the statements into a clear, precise, two-sentence description in the past tense. Your summary should be specific to this group and distinguish it from the contrastive answers of the other groups. + + After creating the summary, generate a short name for the group of statements. This name should be at most ten words long (perhaps less) and be specific but also reflective of most of the statements (rather than reflecting only one or two). The name should distinguish this group from the contrastive examples. For instance, "Write fantasy sexual roleplay with octopi and monsters", "Generate blog spam for gambling websites", or "Assist with high school math homework" would be better and more actionable than general terms like "Write erotic content" or "Help with homework". Be as descriptive as possible and assume neither good nor bad faith. Do not hesitate to identify and describe socially harmful or sensitive topics specifically; specificity is necessary for monitoring + + The cluster name should be a sentence in the imperative that captures the user’s request. For example, ‘Brainstorm ideas for a birthday party’ or ‘Help me find a new job.” + """, + }, { - "role": "system", + "role": "user", "content": """ - You are tasked with summarizing a group of related cluster names into a short, precise, and accurate overall description and name. Your goal is to create a concise summary that captures the essence of these clusters - - The cluster name should be at most ten words long (perhaps less) and be specific but also reflective of most of the clusters that comprise them. The cluster name should be a sentence in the imperative that captures the user’s request. For example, ‘Brainstorm ideas for a birthday party’ or ‘Help me find a new job are good examples. - - Do not shy away from describing socially harmful or sensitive topics. For instance, "Write fantasy sexual roleplay with octopi and monsters", "Generate blog spam for gambling websites", or "Assist with high school math homework" would be better than "Write erotic content" or "Help with homework". Be as descriptive as possible and assume neither good nor bad faith. Do not hesitate to identify and describe socially harmful or sensitive topics specifically; specificity is necessary for monitoring. + Here are the relevant statements - The cluster description should be a clear, precise, two-sentence description in the past tense. This description should be specific to this cluster. Make sure that you've captured the most important details of the cluster. - - Below are the related cluster names - - {% for cluster in clusters %} - {{ cluster.name }}: {{ cluster.description }} - {% endfor %} - - - Ensure your summary and name accurately represent the clusters and are specific to the clusters. - """, - } + Below are the related statements: + + {% for item in positive_examples %} + {{ item.summary }} + {% endfor %} + + + For context, here are statements from nearby groups that are NOT part of the group you’re summarizing + + + {% for item in contrastive_examples %} + {{ item.summary }} + {% endfor %} + + + Remember to analyze both the statements and the contrastive statements carefully to ensure your summary and name accurately represent the specific group while distinguishing it from others. + """, + }, ], - context={"clusters": clusters}, response_model=GeneratedCluster, + context={ + "positive_examples": summaries, + "contrastive_examples": contrastive_examples, + }, ) - res = [] - - new_cluster = Cluster( - name=resp.name, - description=resp.summary, - chat_ids=[chat_id for cluster in clusters for chat_id in cluster.chat_ids], - parent_id=None, - ) - - res.append(new_cluster) - - for cluster in clusters: - res.append( - Cluster( - id=cluster.id, - name=cluster.name, - description=cluster.description, - chat_ids=cluster.chat_ids, - parent_id=new_cluster.id, - ) + return Cluster( + name=resp.name, + description=resp.summary, + chat_ids=[item.chat_id for item in summaries], + parent_id=None, ) - return res + async def cluster_summaries( + self, items: list[ConversationSummary] + ) -> dict[int, list[ConversationSummary]]: + if os.path.exists(os.path.join(self.checkpoint_dir, self.checkpoint_file)): + return self.load_checkpoint() - async def generate_higher_level_cluster( - self, clusters: list[Cluster] - ) -> list[Cluster]: - """ - This takes in a list of clusters and generates a smaller list of clusters that are more general. - - We do so in a 3 step process - - 1. First we generate a list of candidate cluster names - 2. Then we label each base cluster with a potential candidate cluster name - 3. Lastly, for our new clusters, we then generate a new re-labelled cluster with a new title and description that is more representative of these new clusters - - We do have a base case, in which that if a cluster contains a single item, it's just returned as is. - """ - if len(clusters) == 1: - return clusters - - candidates_cluster_names = await self.generate_candidate_cluster_names(clusters) - - labelled_clusters = await asyncio.gather( - *[ - self.label_cluster(cluster, candidates_cluster_names) - for cluster in clusters - ], - disable=True, - ) - label_to_cluster = {} - for labelled_cluster in labelled_clusters: - if labelled_cluster["higher_level_cluster"] not in label_to_cluster: - label_to_cluster[labelled_cluster["higher_level_cluster"]] = [] - - label_to_cluster[labelled_cluster["higher_level_cluster"]].append( - labelled_cluster["cluster"] - ) - - new_clusters = await asyncio.gather( - *[ - self.rename_cluster_group(cluster) - for cluster in label_to_cluster.values() - ], - disable=True, + sem = Semaphore(self.max_concurrent_requests) + embeddings: list[list[float]] = await tqdm_asyncio.gather( + *[self.embedding_model.embed(item.summary, sem) for item in items], + desc="Embedding Summaries", ) - - final_clusters = [] - - for clusters in new_clusters: - final_clusters.extend(clusters) - - return final_clusters - - async def cluster_clusters(self, clusters: list[Cluster]) -> list[Cluster]: - embedded_clusters = await asyncio.gather( - *[self.embed_cluster(cluster) for cluster in clusters], disable=True + cluster_id_to_summaries = self.clustering_method.cluster( + [ + { + "item": item, + "embedding": embedding, + } + for item, embedding in zip(items, embeddings) + ] ) - clusters = self.cluster_base_clusters(embedded_clusters) - new_clusters = await asyncio.gather( + clusters: list[Cluster] = await tqdm_asyncio.gather( *[ - self.generate_higher_level_cluster(cluster) - for cluster in clusters.values() + self.generate_cluster( + summaries, + self.get_contrastive_examples( + cluster_id, cluster_id_to_summaries, 10 + ), + sem, + ) + for cluster_id, summaries in cluster_id_to_summaries.items() ], - desc="Generating New Higher Level Clusters", + desc="Generating Base Clusters", ) - - res = [] - for clusters in new_clusters: - res.extend(clusters) - - return res + self.save_checkpoint(clusters) + return clusters diff --git a/kura/dimensionality.py b/kura/dimensionality.py new file mode 100644 index 0000000..9355f78 --- /dev/null +++ b/kura/dimensionality.py @@ -0,0 +1,77 @@ +from kura.base_classes import BaseDimensionalityReduction, BaseEmbeddingModel +from kura.types import Cluster, ProjectedCluster +from kura.embedding import OpenAIEmbeddingModel +from umap import UMAP +import numpy as np +import asyncio +import os + + +class HDBUMAP(BaseDimensionalityReduction): + def __init__( + self, + embedding_model: BaseEmbeddingModel = OpenAIEmbeddingModel(), + checkpoint_dir: str = "checkpoints", + checkpoint_name: str = "dimensionality_checkpoints.json", + ): + self.embedding_model = embedding_model + self.checkpoint_dir = checkpoint_dir + self.checkpoint_name = checkpoint_name + + async def reduce_dimensionality( + self, clusters: list[Cluster] + ) -> list[ProjectedCluster]: + if os.path.exists(os.path.join(self.checkpoint_dir, self.checkpoint_name)): + with open( + os.path.join(self.checkpoint_dir, self.checkpoint_name), "r" + ) as f: + print( + f"Loading UMAP Checkpoint from {self.checkpoint_dir}/{self.checkpoint_name}" + ) + return [ProjectedCluster.model_validate_json(line) for line in f] + + # Embed all clusters + sem = asyncio.Semaphore(50) + cluster_embeddings = await asyncio.gather( + *[ + self.embedding_model.embed( + f"Name: {c.name}\nDescription: {c.description}", sem + ) + for c in clusters + ] + ) + + # Convert embeddings to numpy array + embeddings = np.array(cluster_embeddings) + + # Project to 2D using UMAP + umap_reducer = UMAP( + n_components=2, + n_neighbors=min(15, len(embeddings) - 1), + min_dist=0, + metric="cosine", + ) + reduced_embeddings = umap_reducer.fit_transform(embeddings) + + # Create projected clusters with 2D coordinates + res = [] + for i, cluster in enumerate(clusters): + projected = ProjectedCluster( + id=cluster.id, + name=cluster.name, + description=cluster.description, + chat_ids=cluster.chat_ids, + parent_id=cluster.parent_id, + x_coord=float(reduced_embeddings[i][0]), + y_coord=float(reduced_embeddings[i][1]), + level=0 if cluster.parent_id is None else 1, + ) + res.append(projected) + + with open(os.path.join(self.checkpoint_dir, self.checkpoint_name), "w") as f: + for c in res: + f.write(c.model_dump_json() + "\n") + + print(f"Saved UMAP Checkpoint to {self.checkpoint_dir}/{self.checkpoint_name}") + + return res diff --git a/kura/embedding.py b/kura/embedding.py new file mode 100644 index 0000000..1a9aaae --- /dev/null +++ b/kura/embedding.py @@ -0,0 +1,20 @@ +from kura.base_classes import BaseEmbeddingModel +from asyncio import Semaphore, wait_for +from tenacity import retry, wait_fixed, stop_after_attempt +from openai import AsyncOpenAI + + +class OpenAIEmbeddingModel(BaseEmbeddingModel): + def __init__(self): + self.client = AsyncOpenAI() + + @retry(wait=wait_fixed(3), stop=stop_after_attempt(3)) + async def embed(self, text: str, sem: Semaphore) -> list[float]: + async with sem: + resp = await wait_for( + self.client.embeddings.create( + input=text, model="text-embedding-3-small" + ), + timeout=5, + ) + return resp.data[0].embedding diff --git a/kura/k_means.py b/kura/k_means.py new file mode 100644 index 0000000..96f5a3d --- /dev/null +++ b/kura/k_means.py @@ -0,0 +1,34 @@ +from kura.base_classes import BaseClusteringMethod +from sklearn.cluster import KMeans +import math +from typing import TypeVar +import numpy as np + +T = TypeVar("T") + + +class KmeansClusteringMethod(BaseClusteringMethod): + def __init__(self, clusters_per_group: int = 10): + self.clusters_per_group = clusters_per_group + + def cluster(self, items: list[T]) -> dict[int, list[T]]: + """ + We perform a clustering here using an embedding defined on each individual item. + + We assume that the item is passed in as a dictionary with + + - its relevant embedding stored in the "embedding" key. + - the item itself stored in the "item" key. + """ + embeddings = [item["embedding"] for item in items] + data: list[T] = [item["item"] for item in items] + n_clusters = math.ceil(len(data) / self.clusters_per_group) + + X = np.array(embeddings) + kmeans = KMeans(n_clusters=n_clusters) + cluster_labels = kmeans.fit_predict(X) + + return { + i: [data[j] for j in range(len(data)) if cluster_labels[j] == i] + for i in range(n_clusters) + } diff --git a/kura/kura.py b/kura/kura.py new file mode 100644 index 0000000..b7f1e87 --- /dev/null +++ b/kura/kura.py @@ -0,0 +1,123 @@ +from kura.dimensionality import HDBUMAP +from kura.types import Conversation, Message, Cluster +from kura.embedding import OpenAIEmbeddingModel +from kura.summarisation import SummaryModel +from kura.meta_cluster import MetaClusterModel +from kura.cluster import ClusterModel +from kura.base_classes import ( + BaseEmbeddingModel, + BaseSummaryModel, + BaseClusterModel, + BaseMetaClusterModel, + BaseDimensionalityReduction, +) +import json +import os + + +class Kura: + def __init__( + self, + conversations: list[Conversation] = [], + embedding_model: BaseEmbeddingModel = OpenAIEmbeddingModel(), + summarisation_model: BaseSummaryModel = SummaryModel(), + cluster_model: BaseClusterModel = ClusterModel(), + meta_cluster_model: BaseMetaClusterModel = MetaClusterModel(), + dimensionality_reduction: BaseDimensionalityReduction = HDBUMAP(), + max_clusters: int = 10, + checkpoint_dir: str = "checkpoints", + cluster_checkpoint_name: str = "clusters.json", + meta_cluster_checkpoint_name: str = "meta_clusters.json", + ): + self.embedding_model = embedding_model + self.summarisation_model = summarisation_model + self.conversations = conversations + self.max_clusters = max_clusters + self.cluster_model = cluster_model + self.meta_cluster_model = meta_cluster_model + self.dimensionality_reduction = dimensionality_reduction + self.checkpoint_dir = checkpoint_dir + self.cluster_checkpoint_name = cluster_checkpoint_name + self.meta_cluster_checkpoint_name = meta_cluster_checkpoint_name + + async def reduce_clusters(self, clusters: list[Cluster]) -> list[Cluster]: + if os.path.exists( + os.path.join(self.checkpoint_dir, self.cluster_checkpoint_name) + ): + print( + f"Loading Meta Cluster Checkpoint from {self.checkpoint_dir}/{self.cluster_checkpoint_name}" + ) + with open( + os.path.join(self.checkpoint_dir, self.cluster_checkpoint_name), "r" + ) as f: + return [Cluster(**json.loads(line)) for line in f] + + root_clusters = clusters + + print(f"Starting with {len(root_clusters)} clusters") + + while len(root_clusters) > self.max_clusters: + # We get the updated list of clusters + new_current_level = await self.meta_cluster_model.reduce_clusters( + root_clusters + ) + + # These are the new root clusters that we've generated + root_clusters = [c for c in new_current_level if c.parent_id is None] + + # We then remove outdated versions of clusters + old_cluster_ids = {rc.id for rc in new_current_level if rc.parent_id} + clusters = [c for c in clusters if c.id not in old_cluster_ids] + + # We then add the new clusters to the list + clusters.extend(new_current_level) + + print(f"Reduced to {len(root_clusters)} clusters") + + with open( + os.path.join(self.checkpoint_dir, self.cluster_checkpoint_name), "w" + ) as f: + print(f"Saving {len(clusters)} clusters to checkpoint") + for c in clusters: + f.write(c.model_dump_json() + "\n") + + return clusters + + async def cluster_conversations(self): + summaries = await self.summarisation_model.summarise(self.conversations) + clusters: list[Cluster] = await self.cluster_model.cluster_summaries(summaries) + processed_clusters = await self.reduce_clusters(clusters) + dimensionality_reduced_clusters = ( + await self.dimensionality_reduction.reduce_dimensionality( + processed_clusters + ) + ) + + return dimensionality_reduced_clusters + + def load_conversations_from_file(self, file_path: str): + """Load a list of conversations from a file in Claude's conversation format dump""" + with open(file_path, "r") as f: + conversations = [] + for conversation in json.load(f): + conversations.append( + Conversation( + chat_id=conversation["uuid"], + created_at=conversation["created_at"], + messages=[ + Message( + created_at=message["created_at"], + role=message["sender"], + content="\n".join( + [ + item["text"] + for item in message["content"] + if item["type"] == "text" + ] + ), + ) + for message in conversation["chat_messages"] + ], + ) + ) + self.conversations = conversations diff --git a/kura/llm_cluster.py b/kura/llm_cluster.py deleted file mode 100644 index 0a382d0..0000000 --- a/kura/llm_cluster.py +++ /dev/null @@ -1,122 +0,0 @@ -from .summarise import SummariseBase -from .summary_cluster import SummaryCluster -from .types import Cluster, Conversation, Message -import json -import os -from .cluster import ClusterModel - - -class LLMCluster: - def __init__( - self, - summariser: SummariseBase = SummariseBase(), - base_cluster_model: SummaryCluster = SummaryCluster(), - cluster_model: ClusterModel = ClusterModel(), - max_clusters: int = 10, - checkpoint_dir: str = "checkpoints", - ): - self.summariser = summariser - self.base_cluster_model = base_cluster_model - self.max_clusters = max_clusters - self.checkpoint_dir = checkpoint_dir - self.cluster_model = cluster_model - - self.clusters = [] - - if not os.path.exists(self.checkpoint_dir): - os.makedirs(self.checkpoint_dir) - - async def reduce_clusters( - self, clusters: list[Cluster], root_clusters: list[Cluster], iteration: int = 1 - ): - while len(root_clusters) > self.max_clusters: - print(f"\n=== Iteration {iteration} ===") - print(f" Starting with {len(root_clusters)} root clusters...") - - # Generate new parent clusters from current level - new_parent_clusters = await self.cluster_model.cluster_clusters( - root_clusters - ) - - # This is the new layer - root_clusters = [c for c in new_parent_clusters if not c.parent_id] - - # Remove the outdated versions of clusters that were just reduced - old_cluster_ids = {rc.id for rc in new_parent_clusters if rc.parent_id} - clusters = [c for c in clusters if c.id not in old_cluster_ids] - - # Add both the updated original clusters and new parent clusters - clusters.extend(new_parent_clusters) - print(f" Successfully reduced to {len(root_clusters)} root clusters") - - iteration += 1 - - return clusters, root_clusters - - async def cluster_conversations(self): - summarized_conversations = await self.summariser.summarise_conversations( - self.conversations - ) - - base_clusters = await self.base_cluster_model.cluster_conversation_summaries( - summarized_conversations - ) - - clusters_path = os.path.join(self.checkpoint_dir, "clusters.json") - - if os.path.exists(clusters_path): - with open(clusters_path, "r") as f: - clusters = [Cluster.model_validate_json(line) for line in f] - else: - clusters = base_clusters - root_clusters = base_clusters - - clusters, root_clusters = await self.reduce_clusters( - clusters, root_clusters - ) - - # Save final clusters to checkpoint directory - - with open(clusters_path, "w") as f: - for cluster in clusters: - f.write(cluster.model_dump_json() + "\n") - - - - - print(f"\nSaved {len(clusters)} total clusters to {clusters_path}") - - return clusters - - def load_claude_messages( - self, path: str, max_conversations: int = -1 - ) -> list[Conversation]: - with open(path, "r") as f: - conversations = [] - for conversation in json.load(f): - conversations.append( - Conversation( - chat_id=conversation["uuid"], - created_at=conversation["created_at"], - messages=[ - Message( - created_at=message["created_at"], - role=message["sender"], - content="\n".join( - [ - item["text"] - for item in message["content"] - if item["type"] == "text" - ] - ), - ) - for message in conversation["chat_messages"] - ], - ) - ) - self.conversations = ( - conversations - if max_conversations == -1 - else conversations[:max_conversations] - ) - print(f"Read in {len(self.conversations)} conversations") diff --git a/kura/meta_cluster.py b/kura/meta_cluster.py new file mode 100644 index 0000000..3f46ddd --- /dev/null +++ b/kura/meta_cluster.py @@ -0,0 +1,308 @@ +from kura.base_classes import ( + BaseMetaClusterModel, + BaseEmbeddingModel, + BaseClusteringMethod, +) +import math +from kura.types.cluster import Cluster, GeneratedCluster +from kura.embedding import OpenAIEmbeddingModel +from kura.k_means import KmeansClusteringMethod +import instructor +import google.generativeai as genai +from tqdm.asyncio import tqdm_asyncio +from asyncio import Semaphore +from pydantic import BaseModel, field_validator, ValidationInfo +import re + + +class CandidateClusters(BaseModel): + candidate_cluster_names: list[str] + + @field_validator("candidate_cluster_names") + def validate_candidate_cluster_names( + cls, v: list[str], info: ValidationInfo + ) -> list[str]: + if len(v) == 0: + raise ValueError("Candidate cluster names must be a non-empty list") + + v = [label.strip() for label in v] + v = [label[:-1] if label.endswith(".") else label for label in v] + + return [re.sub(r"\\{1,}", "", label.replace('"', "")) for label in v] + + +class ClusterLabel(BaseModel): + higher_level_cluster: str + + @field_validator("higher_level_cluster") + def validate_higher_level_cluster(cls, v: str, info: ValidationInfo) -> str: + if v not in info.context["candidate_clusters"]: + raise ValueError( + f""" + Invalid higher-level cluster: |{v}| + + Valid clusters are: + {", ".join(f"|{c}|" for c in info.context["candidate_clusters"])} + """ + ) + return v + + +class MetaClusterModel(BaseMetaClusterModel): + def __init__( + self, + max_concurrent_requests: int = 50, + client=instructor.from_gemini( + genai.GenerativeModel("gemini-1.5-flash-latest"), use_async=True + ), + embedding_model: BaseEmbeddingModel = OpenAIEmbeddingModel(), + clustering_model: BaseClusteringMethod = KmeansClusteringMethod(12), + ): + self.max_concurrent_requests = max_concurrent_requests + self.client = client + self.embedding_model = embedding_model + self.clustering_model = clustering_model + + async def generate_candidate_clusters( + self, clusters: list[Cluster], sem: Semaphore + ) -> list[Cluster]: + async with sem: + resp = await self.client.chat.completions.create( + messages=[ + { + "role": "system", + "content": """ + You are tasked with creating higher-level cluster names based on a given list of clusters and their descriptions. Your goal is to come up with broader categories that could encompass one or more of the provided clusters + + First, review the list of clusters and their descriptions: + + {% for cluster in clusters %} + {{ cluster.name }}: {{ cluster.description }} + {% endfor %} + + + Your task is to create at most {{ desired_number }} higher-level cluster names that could potentially include one or more of the provided clusters. These higher-level clusters should represent broader categories or themes that emerge from the given clusters, while remaining as specific as possible. If there are many clusters with a specific theme, ensure that the higher-level cluster name remains the maximum level of specificity. You are helping to organize user behavior data in order to improve safety, monitoring, and observability. You can generate less than {{ desired_number }} names if you feel that fewer are appropriate and accurately capture the clusters. + + Guidelines for creating higher-level clusters names + 1. Analyze the themes, topics or characteristics common to multiple clusters. + 2. Create names that are specific enough to be meaningful but but not so specific that they can’t meaningfully represent many different clusters. Avoid overly general or vague terms, and do not hesitate to describe socially harmful or sensitive topics (in fact, clusters that clearly describe harmful behavior are slightly preferred); specificity is necessary for observability and enforcement. + 3. Ensure that the higher-level cluster names are distinct from one another. + 4. Use clear, concise, and descriptive language for the cluster names. Assume neither good nor bad faith for the content in the clusters. + + Think about the relationships between the given clusters and potential overarching themes. + + Focus on creating meaningful, distinct and precise ( but not overly specific ) higher-level cluster names that could encompass multiple sub-clusters. + """.strip(), + } + ], + response_model=CandidateClusters, + context={ + "clusters": clusters, + "desired_number": math.ceil(len(clusters) / 2), + }, + max_retries=3, + ) + return resp.candidate_cluster_names + + async def label_cluster(self, cluster: Cluster, candidate_clusters: list[str]): + async with self.sem: + resp = await self.client.chat.completions.create( + messages=[ + { + "role": "system", + "content": """ +You are tasked with categorizing a specific cluster into one of the provided higher-level clusters for observability, monitoring, and content moderation. Your goal is to determine which higher-level cluster best fits the given specific cluster based on its name and description. + +First, here are the ONLY valid higher-level clusters you may select from: + +{% for cluster in candidate_clusters %} +{{ cluster }} +{% endfor %} + + +Here is the specific cluster to categorize: + +Name: {{ cluster.name }} +Description: {{ cluster.description }} + + +RULES: +1. You MUST select EXACTLY ONE higher-level cluster from the provided list +2. You MUST output the higher-level cluster name EXACTLY as written - no modifications allowed +3. You MUST NOT create new cluster names or combinations +4. You MUST NOT output any additional text or explanations +5. You MUST NOT use partial matches or approximate names + +CLASSIFICATION PROCESS: +1. First, record the exact list of valid higher-level clusters +2. Read the specific cluster's name and description carefully +3. Compare the specific cluster's key characteristics against each valid higher-level cluster +4. Select the single most appropriate higher-level cluster that encompasses the specific cluster +5. Verify your selected cluster exactly matches one from the valid list +6. Output ONLY the selected higher-level cluster name, exactly as it appeared in the valid list + +Here is the specific cluster to categorize: + + +Name: {{ cluster.name }} +Description: {{ cluster.description }} + + +Based on this information, determine the most appropriate higher-level cluster and provide your answer as instructed. + """, + } + ], + response_model=ClusterLabel, + context={ + "cluster": cluster, + "candidate_clusters": candidate_clusters, + }, + max_retries=3, + ) + return { + "cluster": cluster, + "label": resp.higher_level_cluster, + } + + async def rename_cluster_group(self, clusters: list[Cluster]) -> list[Cluster]: + async with self.sem: + resp = await self.client.chat.completions.create( + messages=[ + { + "role": "system", + "content": """ + You are tasked with summarizing a group of related cluster names into a short, precise, and accurate overall description and name. Your goal is to create a concise summary that captures the essence of these clusters + + The cluster name should be at most ten words long (perhaps less) and be specific but also reflective of most of the clusters that comprise them. The cluster name should be a sentence in the imperative that captures the user’s request. For example, ‘Brainstorm ideas for a birthday party’ or ‘Help me find a new job are good examples. + + Do not shy away from describing socially harmful or sensitive topics. For instance, "Write fantasy sexual roleplay with octopi and monsters", "Generate blog spam for gambling websites", or "Assist with high school math homework" would be better than "Write erotic content" or "Help with homework". Be as descriptive as possible and assume neither good nor bad faith. Do not hesitate to identify and describe socially harmful or sensitive topics specifically; specificity is necessary for monitoring. + + The cluster description should be a clear, precise, two-sentence description in the past tense. This description should be specific to this cluster. Make sure that you've captured the most important details of the cluster. + + Below are the related cluster names + + {% for cluster in clusters %} + {{ cluster.name }}: {{ cluster.description }} + {% endfor %} + + + Ensure your summary and name accurately represent the clusters and are specific to the clusters. + """, + } + ], + context={"clusters": clusters}, + response_model=GeneratedCluster, + ) + + res = [] + + new_cluster = Cluster( + name=resp.name, + description=resp.summary, + chat_ids=[ + chat_id for cluster in clusters for chat_id in cluster.chat_ids + ], + parent_id=None, + ) + + res.append(new_cluster) + + for cluster in clusters: + res.append( + Cluster( + id=cluster.id, + name=cluster.name, + description=cluster.description, + chat_ids=cluster.chat_ids, + parent_id=new_cluster.id, + ) + ) + + return res + + async def generate_meta_clusters(self, clusters: list[Cluster]) -> list[Cluster]: + candidate_labels = await self.generate_candidate_clusters( + clusters, Semaphore(self.max_concurrent_requests) + ) + + cluster_labels = await tqdm_asyncio.gather( + *[self.label_cluster(cluster, candidate_labels) for cluster in clusters], + disable=True, + ) + + label_to_clusters = {} + for label in cluster_labels: + if label["label"] not in label_to_clusters: + label_to_clusters[label["label"]] = [] + + label_to_clusters[label["label"]].append(label["cluster"]) + + new_clusters = await tqdm_asyncio.gather( + *[ + self.rename_cluster_group(cluster) + for cluster in label_to_clusters.values() + ], + disable=True, + ) + + res = [] + for new_cluster in new_clusters: + res.extend(new_cluster) + + return res + + async def reduce_clusters(self, clusters: list[Cluster]) -> list[Cluster]: + """ + This takes in a list of existing clusters and generates a few higher order clusters that are more general. This represents a single iteration of the meta clustering process. + + In the event that we have a single cluster, we will just return a new higher level cluster which has the same name as the original cluster. ( This is an edge case which we should definitely handle better ) + """ + if len(clusters) == 1: + new_cluster = Cluster( + name=clusters[0].name, + description=clusters[0].description, + chat_ids=clusters[0].chat_ids, + parent_id=None, + ) + clusters[0].parent_id = new_cluster.id + return [new_cluster, clusters[0]] + + self.sem = Semaphore(self.max_concurrent_requests) + cluster_embeddings: list[list[float]] = await tqdm_asyncio.gather( + *[ + self.embedding_model.embed( + f""" +Name: {cluster.name} +Description: {cluster.description} + """.strip(), + self.sem, + ) + for cluster in clusters + ], + desc="Embedding Clusters", + ) + clusters_and_embeddings = [ + { + "item": cluster, + "embedding": embedding, + } + for cluster, embedding in zip(clusters, cluster_embeddings) + ] + + cluster_id_to_clusters: dict[int, list[Cluster]] = ( + self.clustering_model.cluster(clusters_and_embeddings) + ) + + new_clusters = await tqdm_asyncio.gather( + *[ + self.generate_meta_clusters(cluster_id_to_clusters[cluster_id]) + for cluster_id in cluster_id_to_clusters + ], + desc="Generating Meta Clusters", + ) + + res = [] + for new_cluster in new_clusters: + res.extend(new_cluster) + + return res diff --git a/kura/static/dist/assets/index-CvLvA1NY.css b/kura/static/dist/assets/index-CvLvA1NY.css new file mode 100644 index 0000000..00f02f9 --- /dev/null +++ b/kura/static/dist/assets/index-CvLvA1NY.css @@ -0,0 +1 @@ +*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}:root{--foreground: 0 0% 3.9%;--card: 0 0% 100%;--card-foreground: 0 0% 3.9%;--popover: 0 0% 100%;--popover-foreground: 0 0% 3.9%;--primary: 0 0% 9%;--primary-foreground: 0 0% 98%;--secondary: 0 0% 96.1%;--secondary-foreground: 0 0% 9%;--muted: 0 0% 96.1%;--muted-foreground: 0 0% 45.1%;--accent: 0 0% 96.1%;--accent-foreground: 0 0% 9%;--destructive: 0 84.2% 60.2%;--destructive-foreground: 0 0% 98%;--border: 0 0% 89.8%;--input: 0 0% 89.8%;--ring: 0 0% 3.9%;--chart-1: 12 76% 61%;--chart-2: 173 58% 39%;--chart-3: 197 37% 24%;--chart-4: 43 74% 66%;--chart-5: 27 87% 67%;--radius: .5rem }.dark{--background: 0 0% 3.9%;--foreground: 0 0% 98%;--card: 0 0% 3.9%;--card-foreground: 0 0% 98%;--popover: 0 0% 3.9%;--popover-foreground: 0 0% 98%;--primary: 0 0% 98%;--primary-foreground: 0 0% 9%;--secondary: 0 0% 14.9%;--secondary-foreground: 0 0% 98%;--muted: 0 0% 14.9%;--muted-foreground: 0 0% 63.9%;--accent: 0 0% 14.9%;--accent-foreground: 0 0% 98%;--destructive: 0 62.8% 30.6%;--destructive-foreground: 0 0% 98%;--border: 0 0% 14.9%;--input: 0 0% 14.9%;--ring: 0 0% 83.1%;--chart-1: 220 70% 50%;--chart-2: 160 60% 45%;--chart-3: 30 80% 55%;--chart-4: 280 65% 60%;--chart-5: 340 75% 55% }*{border-color:hsl(var(--border))}body{background-color:hsl(var(--background));color:hsl(var(--foreground))}:root{--chart-1: 12 76% 61%;--chart-2: 173 58% 39%;--chart-3: 197 37% 24%;--chart-4: 43 74% 66%;--chart-5: 27 87% 67%}.dark{--chart-1: 220 70% 50%;--chart-2: 160 60% 45%;--chart-3: 30 80% 55%;--chart-4: 280 65% 60%;--chart-5: 340 75% 55%}.absolute{position:absolute}.relative{position:relative}.inset-0{top:0;right:0;bottom:0;left:0}.z-10{z-index:10}.mx-auto{margin-left:auto;margin-right:auto}.my-0\.5{margin-top:.125rem;margin-bottom:.125rem}.my-8{margin-top:2rem;margin-bottom:2rem}.-ml-1{margin-left:-.25rem}.mb-10{margin-bottom:2.5rem}.mb-4{margin-bottom:1rem}.mb-8{margin-bottom:2rem}.mr-2{margin-right:.5rem}.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-4{margin-top:1rem}.flex{display:flex}.inline-flex{display:inline-flex}.grid{display:grid}.aspect-video{aspect-ratio:16 / 9}.h-10{height:2.5rem}.h-12{height:3rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-3{height:.75rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-\[1px\]{height:1px}.h-\[200px\]{height:200px}.h-\[400px\]{height:400px}.h-\[600px\]{height:600px}.h-\[calc\(100\%-4rem\)\]{height:calc(100% - 4rem)}.h-full{height:100%}.w-0{width:0px}.w-1{width:.25rem}.w-12{width:3rem}.w-2{width:.5rem}.w-2\.5{width:.625rem}.w-2\/5{width:40%}.w-3{width:.75rem}.w-3\/5{width:60%}.w-4{width:1rem}.w-5{width:1.25rem}.w-9{width:2.25rem}.w-\[1px\]{width:1px}.w-full{width:100%}.w-px{width:1px}.min-w-\[8rem\]{min-width:8rem}.max-w-7xl{max-width:80rem}.flex-1{flex:1 1 0%}.shrink-0{flex-shrink:0}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-pointer{cursor:pointer}.touch-none{touch-action:none}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.items-stretch{align-items:stretch}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-8{gap:2rem}.space-y-0\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.125rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.125rem * var(--tw-space-y-reverse))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.overflow-hidden{overflow:hidden}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-\[2px\]{border-radius:2px}.rounded-\[inherit\]{border-radius:inherit}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-xl{border-radius:.75rem}.border{border-width:1px}.border-0{border-width:0px}.border-\[1\.5px\]{border-width:1.5px}.border-b{border-bottom-width:1px}.border-l{border-left-width:1px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-\[--color-border\]{border-color:var(--color-border)}.border-border\/50{border-color:hsl(var(--border) / .5)}.border-input{border-color:hsl(var(--input))}.border-transparent{border-color:transparent}.border-l-transparent{border-left-color:transparent}.border-t-transparent{border-top-color:transparent}.bg-\[--color-bg\]{background-color:var(--color-bg)}.bg-accent{background-color:hsl(var(--accent))}.bg-background{background-color:hsl(var(--background))}.bg-border{background-color:hsl(var(--border))}.bg-card{background-color:hsl(var(--card))}.bg-destructive{background-color:hsl(var(--destructive))}.bg-muted{background-color:hsl(var(--muted))}.bg-muted\/40{background-color:hsl(var(--muted) / .4)}.bg-primary{background-color:hsl(var(--primary))}.bg-secondary{background-color:hsl(var(--secondary))}.bg-transparent{background-color:transparent}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.p-0{padding:0}.p-1{padding:.25rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.p-\[1px\]{padding:1px}.px-0{padding-left:0;padding-right:0}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.px-8{padding-left:2rem;padding-right:2rem}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-20{padding-top:5rem;padding-bottom:5rem}.py-4{padding-top:1rem;padding-bottom:1rem}.pb-3{padding-bottom:.75rem}.pt-0{padding-top:0}.pt-3{padding-top:.75rem}.text-left{text-align:left}.text-center{text-align:center}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-2xl{font-size:1.5rem;line-height:2rem}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-semibold{font-weight:600}.tabular-nums{--tw-numeric-spacing: tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.leading-none{line-height:1}.leading-relaxed{line-height:1.625}.tracking-tight{letter-spacing:-.025em}.text-accent-foreground{color:hsl(var(--accent-foreground))}.text-card-foreground{color:hsl(var(--card-foreground))}.text-destructive-foreground{color:hsl(var(--destructive-foreground))}.text-foreground{color:hsl(var(--foreground))}.text-muted-foreground{color:hsl(var(--muted-foreground))}.text-primary{color:hsl(var(--primary))}.text-primary-foreground{color:hsl(var(--primary-foreground))}.text-secondary-foreground{color:hsl(var(--secondary-foreground))}.underline-offset-4{text-underline-offset:4px}.opacity-0{opacity:0}.opacity-20{opacity:.2}.opacity-25{opacity:.25}.opacity-75{opacity:.75}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-none{--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline{outline-style:solid}.ring-offset-background{--tw-ring-offset-color: hsl(var(--background))}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-200{transition-duration:.2s}@keyframes enter{0%{opacity:var(--tw-enter-opacity, 1);transform:translate3d(var(--tw-enter-translate-x, 0),var(--tw-enter-translate-y, 0),0) scale3d(var(--tw-enter-scale, 1),var(--tw-enter-scale, 1),var(--tw-enter-scale, 1)) rotate(var(--tw-enter-rotate, 0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity, 1);transform:translate3d(var(--tw-exit-translate-x, 0),var(--tw-exit-translate-y, 0),0) scale3d(var(--tw-exit-scale, 1),var(--tw-exit-scale, 1),var(--tw-exit-scale, 1)) rotate(var(--tw-exit-rotate, 0))}}.duration-200{animation-duration:.2s}.after\:absolute:after{content:var(--tw-content);position:absolute}.after\:inset-y-0:after{content:var(--tw-content);top:0;bottom:0}.after\:left-1\/2:after{content:var(--tw-content);left:50%}.after\:w-1:after{content:var(--tw-content);width:.25rem}.after\:-translate-x-1\/2:after{content:var(--tw-content);--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:bg-accent:hover{background-color:hsl(var(--accent))}.hover\:bg-accent\/50:hover{background-color:hsl(var(--accent) / .5)}.hover\:bg-destructive\/80:hover{background-color:hsl(var(--destructive) / .8)}.hover\:bg-destructive\/90:hover{background-color:hsl(var(--destructive) / .9)}.hover\:bg-primary\/80:hover{background-color:hsl(var(--primary) / .8)}.hover\:bg-primary\/90:hover{background-color:hsl(var(--primary) / .9)}.hover\:bg-secondary\/80:hover{background-color:hsl(var(--secondary) / .8)}.hover\:bg-transparent:hover{background-color:transparent}.hover\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\:underline:hover{text-decoration-line:underline}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-ring:focus{--tw-ring-color: hsl(var(--ring))}.focus\:ring-offset-2:focus{--tw-ring-offset-width: 2px}.focus-visible\:outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\:ring-1:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-2:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-ring:focus-visible{--tw-ring-color: hsl(var(--ring))}.focus-visible\:ring-offset-1:focus-visible{--tw-ring-offset-width: 1px}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width: 2px}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:opacity-50:disabled{opacity:.5}.data-\[panel-group-direction\=vertical\]\:h-px[data-panel-group-direction=vertical]{height:1px}.data-\[panel-group-direction\=vertical\]\:w-full[data-panel-group-direction=vertical]{width:100%}.data-\[panel-group-direction\=vertical\]\:flex-col[data-panel-group-direction=vertical]{flex-direction:column}.data-\[state\=active\]\:bg-background[data-state=active]{background-color:hsl(var(--background))}.data-\[state\=active\]\:text-foreground[data-state=active]{color:hsl(var(--foreground))}.data-\[state\=active\]\:shadow[data-state=active]{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.data-\[panel-group-direction\=vertical\]\:after\:left-0[data-panel-group-direction=vertical]:after{content:var(--tw-content);left:0}.data-\[panel-group-direction\=vertical\]\:after\:h-1[data-panel-group-direction=vertical]:after{content:var(--tw-content);height:.25rem}.data-\[panel-group-direction\=vertical\]\:after\:w-full[data-panel-group-direction=vertical]:after{content:var(--tw-content);width:100%}.data-\[panel-group-direction\=vertical\]\:after\:-translate-y-1\/2[data-panel-group-direction=vertical]:after{content:var(--tw-content);--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[panel-group-direction\=vertical\]\:after\:translate-x-0[data-panel-group-direction=vertical]:after{content:var(--tw-content);--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@media (min-width: 768px){.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}.\[\&\>svg\]\:h-2\.5>svg{height:.625rem}.\[\&\>svg\]\:h-3>svg{height:.75rem}.\[\&\>svg\]\:w-2\.5>svg{width:.625rem}.\[\&\>svg\]\:w-3>svg{width:.75rem}.\[\&\>svg\]\:text-muted-foreground>svg{color:hsl(var(--muted-foreground))}.\[\&\[data-panel-group-direction\=vertical\]\>div\]\:rotate-90[data-panel-group-direction=vertical]>div{--tw-rotate: 90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&_\.recharts-cartesian-axis-tick_text\]\:fill-muted-foreground .recharts-cartesian-axis-tick text{fill:hsl(var(--muted-foreground))}.\[\&_\.recharts-cartesian-grid_line\[stroke\=\'\#ccc\'\]\]\:stroke-border\/50 .recharts-cartesian-grid line[stroke="#ccc"]{stroke:hsl(var(--border) / .5)}.\[\&_\.recharts-curve\.recharts-tooltip-cursor\]\:stroke-border .recharts-curve.recharts-tooltip-cursor{stroke:hsl(var(--border))}.\[\&_\.recharts-dot\[stroke\=\'\#fff\'\]\]\:stroke-transparent .recharts-dot[stroke="#fff"]{stroke:transparent}.\[\&_\.recharts-layer\]\:outline-none .recharts-layer{outline:2px solid transparent;outline-offset:2px}.\[\&_\.recharts-polar-grid_\[stroke\=\'\#ccc\'\]\]\:stroke-border .recharts-polar-grid [stroke="#ccc"]{stroke:hsl(var(--border))}.\[\&_\.recharts-radial-bar-background-sector\]\:fill-muted .recharts-radial-bar-background-sector,.\[\&_\.recharts-rectangle\.recharts-tooltip-cursor\]\:fill-muted .recharts-rectangle.recharts-tooltip-cursor{fill:hsl(var(--muted))}.\[\&_\.recharts-reference-line_\[stroke\=\'\#ccc\'\]\]\:stroke-border .recharts-reference-line [stroke="#ccc"]{stroke:hsl(var(--border))}.\[\&_\.recharts-sector\[stroke\=\'\#fff\'\]\]\:stroke-transparent .recharts-sector[stroke="#fff"]{stroke:transparent}.\[\&_\.recharts-sector\]\:outline-none .recharts-sector,.\[\&_\.recharts-surface\]\:outline-none .recharts-surface{outline:2px solid transparent;outline-offset:2px}.\[\&_svg\]\:pointer-events-none svg{pointer-events:none}.\[\&_svg\]\:size-4 svg{width:1rem;height:1rem}.\[\&_svg\]\:shrink-0 svg{flex-shrink:0} diff --git a/kura/static/dist/assets/index-DztdrX1V.js b/kura/static/dist/assets/index-DztdrX1V.js new file mode 100644 index 0000000..d1ac496 --- /dev/null +++ b/kura/static/dist/assets/index-DztdrX1V.js @@ -0,0 +1,168 @@ +function vI(t,e){for(var r=0;rn[i]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const s of o.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&n(s)}).observe(document,{childList:!0,subtree:!0});function r(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function n(i){if(i.ep)return;i.ep=!0;const o=r(i);fetch(i.href,o)}})();var fc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Qe(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var fh={exports:{}},Pu={},dh={exports:{}},De={};/** + * @license React + * react.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Y_;function yI(){if(Y_)return De;Y_=1;var t=Symbol.for("react.element"),e=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),s=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),m=Symbol.iterator;function v(M){return M===null||typeof M!="object"?null:(M=m&&M[m]||M["@@iterator"],typeof M=="function"?M:null)}var g={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_=Object.assign,w={};function x(M,F,le){this.props=M,this.context=F,this.refs=w,this.updater=le||g}x.prototype.isReactComponent={},x.prototype.setState=function(M,F){if(typeof M!="object"&&typeof M!="function"&&M!=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,M,F,"setState")},x.prototype.forceUpdate=function(M){this.updater.enqueueForceUpdate(this,M,"forceUpdate")};function O(){}O.prototype=x.prototype;function P(M,F,le){this.props=M,this.context=F,this.refs=w,this.updater=le||g}var A=P.prototype=new O;A.constructor=P,_(A,x.prototype),A.isPureReactComponent=!0;var C=Array.isArray,S=Object.prototype.hasOwnProperty,E={current:null},k={key:!0,ref:!0,__self:!0,__source:!0};function N(M,F,le){var ye,_e={},Ce=null,qe=null;if(F!=null)for(ye in F.ref!==void 0&&(qe=F.ref),F.key!==void 0&&(Ce=""+F.key),F)S.call(F,ye)&&!k.hasOwnProperty(ye)&&(_e[ye]=F[ye]);var ke=arguments.length-2;if(ke===1)_e.children=le;else if(1>>1,F=H[M];if(0>>1;Mi(_e,ee))Cei(qe,_e)?(H[M]=qe,H[Ce]=ee,M=Ce):(H[M]=_e,H[ye]=ee,M=ye);else if(Cei(qe,ee))H[M]=qe,H[Ce]=ee,M=Ce;else break e}}return Q}function i(H,Q){var ee=H.sortIndex-Q.sortIndex;return ee!==0?ee:H.id-Q.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;t.unstable_now=function(){return o.now()}}else{var s=Date,l=s.now();t.unstable_now=function(){return s.now()-l}}var f=[],d=[],h=1,m=null,v=3,g=!1,_=!1,w=!1,x=typeof setTimeout=="function"?setTimeout:null,O=typeof clearTimeout=="function"?clearTimeout:null,P=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function A(H){for(var Q=r(d);Q!==null;){if(Q.callback===null)n(d);else if(Q.startTime<=H)n(d),Q.sortIndex=Q.expirationTime,e(f,Q);else break;Q=r(d)}}function C(H){if(w=!1,A(H),!_)if(r(f)!==null)_=!0,Y(S);else{var Q=r(d);Q!==null&&te(C,Q.startTime-H)}}function S(H,Q){_=!1,w&&(w=!1,O(N),N=-1),g=!0;var ee=v;try{for(A(Q),m=r(f);m!==null&&(!(m.expirationTime>Q)||H&&!$());){var M=m.callback;if(typeof M=="function"){m.callback=null,v=m.priorityLevel;var F=M(m.expirationTime<=Q);Q=t.unstable_now(),typeof F=="function"?m.callback=F:m===r(f)&&n(f),A(Q)}else n(f);m=r(f)}if(m!==null)var le=!0;else{var ye=r(d);ye!==null&&te(C,ye.startTime-Q),le=!1}return le}finally{m=null,v=ee,g=!1}}var E=!1,k=null,N=-1,I=5,U=-1;function $(){return!(t.unstable_now()-UH||125M?(H.sortIndex=ee,e(d,H),r(f)===null&&H===r(d)&&(w?(O(N),N=-1):w=!0,te(C,ee-M))):(H.sortIndex=F,e(f,H),_||g||(_=!0,Y(S))),H},t.unstable_shouldYield=$,t.unstable_wrapCallback=function(H){var Q=v;return function(){var ee=v;v=Q;try{return H.apply(this,arguments)}finally{v=ee}}}}(mh)),mh}var r1;function _I(){return r1||(r1=1,hh.exports=wI()),hh.exports}/** + * @license React + * react-dom.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var n1;function SI(){if(n1)return ir;n1=1;var t=Kb(),e=_I();function r(a){for(var u="https://reactjs.org/docs/error-decoder.html?invariant="+a,c=1;c"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),f=Object.prototype.hasOwnProperty,d=/^[: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]*$/,h={},m={};function v(a){return f.call(m,a)?!0:f.call(h,a)?!1:d.test(a)?m[a]=!0:(h[a]=!0,!1)}function g(a,u,c,p){if(c!==null&&c.type===0)return!1;switch(typeof u){case"function":case"symbol":return!0;case"boolean":return p?!1:c!==null?!c.acceptsBooleans:(a=a.toLowerCase().slice(0,5),a!=="data-"&&a!=="aria-");default:return!1}}function _(a,u,c,p){if(u===null||typeof u>"u"||g(a,u,c,p))return!0;if(p)return!1;if(c!==null)switch(c.type){case 3:return!u;case 4:return u===!1;case 5:return isNaN(u);case 6:return isNaN(u)||1>u}return!1}function w(a,u,c,p,y,b,T){this.acceptsBooleans=u===2||u===3||u===4,this.attributeName=p,this.attributeNamespace=y,this.mustUseProperty=c,this.propertyName=a,this.type=u,this.sanitizeURL=b,this.removeEmptyString=T}var x={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(a){x[a]=new w(a,0,!1,a,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(a){var u=a[0];x[u]=new w(u,1,!1,a[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(a){x[a]=new w(a,2,!1,a.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(a){x[a]=new w(a,2,!1,a,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(a){x[a]=new w(a,3,!1,a.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(a){x[a]=new w(a,3,!0,a,null,!1,!1)}),["capture","download"].forEach(function(a){x[a]=new w(a,4,!1,a,null,!1,!1)}),["cols","rows","size","span"].forEach(function(a){x[a]=new w(a,6,!1,a,null,!1,!1)}),["rowSpan","start"].forEach(function(a){x[a]=new w(a,5,!1,a.toLowerCase(),null,!1,!1)});var O=/[\-:]([a-z])/g;function P(a){return a[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(a){var u=a.replace(O,P);x[u]=new w(u,1,!1,a,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(a){var u=a.replace(O,P);x[u]=new w(u,1,!1,a,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(a){var u=a.replace(O,P);x[u]=new w(u,1,!1,a,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(a){x[a]=new w(a,1,!1,a.toLowerCase(),null,!1,!1)}),x.xlinkHref=new w("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(a){x[a]=new w(a,1,!1,a.toLowerCase(),null,!0,!0)});function A(a,u,c,p){var y=x.hasOwnProperty(u)?x[u]:null;(y!==null?y.type!==0:p||!(2j||y[T]!==b[j]){var z=` +`+y[T].replace(" at new "," at ");return a.displayName&&z.includes("")&&(z=z.replace("",a.displayName)),z}while(1<=T&&0<=j);break}}}finally{le=!1,Error.prepareStackTrace=c}return(a=a?a.displayName||a.name:"")?F(a):""}function _e(a){switch(a.tag){case 5:return F(a.type);case 16:return F("Lazy");case 13:return F("Suspense");case 19:return F("SuspenseList");case 0:case 2:case 15:return a=ye(a.type,!1),a;case 11:return a=ye(a.type.render,!1),a;case 1:return a=ye(a.type,!0),a;default:return""}}function Ce(a){if(a==null)return null;if(typeof a=="function")return a.displayName||a.name||null;if(typeof a=="string")return a;switch(a){case k:return"Fragment";case E:return"Portal";case I:return"Profiler";case N:return"StrictMode";case V:return"Suspense";case X:return"SuspenseList"}if(typeof a=="object")switch(a.$$typeof){case $:return(a.displayName||"Context")+".Consumer";case U:return(a._context.displayName||"Context")+".Provider";case B:var u=a.render;return a=a.displayName,a||(a=u.displayName||u.name||"",a=a!==""?"ForwardRef("+a+")":"ForwardRef"),a;case Z:return u=a.displayName||null,u!==null?u:Ce(a.type)||"Memo";case Y:u=a._payload,a=a._init;try{return Ce(a(u))}catch{}}return null}function qe(a){var u=a.type;switch(a.tag){case 24:return"Cache";case 9:return(u.displayName||"Context")+".Consumer";case 10:return(u._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return a=u.render,a=a.displayName||a.name||"",u.displayName||(a!==""?"ForwardRef("+a+")":"ForwardRef");case 7:return"Fragment";case 5:return u;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Ce(u);case 8:return u===N?"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 u=="function")return u.displayName||u.name||null;if(typeof u=="string")return u}return null}function ke(a){switch(typeof a){case"boolean":case"number":case"string":case"undefined":return a;case"object":return a;default:return""}}function oe(a){var u=a.type;return(a=a.nodeName)&&a.toLowerCase()==="input"&&(u==="checkbox"||u==="radio")}function we(a){var u=oe(a)?"checked":"value",c=Object.getOwnPropertyDescriptor(a.constructor.prototype,u),p=""+a[u];if(!a.hasOwnProperty(u)&&typeof c<"u"&&typeof c.get=="function"&&typeof c.set=="function"){var y=c.get,b=c.set;return Object.defineProperty(a,u,{configurable:!0,get:function(){return y.call(this)},set:function(T){p=""+T,b.call(this,T)}}),Object.defineProperty(a,u,{enumerable:c.enumerable}),{getValue:function(){return p},setValue:function(T){p=""+T},stopTracking:function(){a._valueTracker=null,delete a[u]}}}}function je(a){a._valueTracker||(a._valueTracker=we(a))}function ie(a){if(!a)return!1;var u=a._valueTracker;if(!u)return!0;var c=u.getValue(),p="";return a&&(p=oe(a)?a.checked?"true":"false":a.value),a=p,a!==c?(u.setValue(a),!0):!1}function Xe(a){if(a=a||(typeof document<"u"?document:void 0),typeof a>"u")return null;try{return a.activeElement||a.body}catch{return a.body}}function ze(a,u){var c=u.checked;return ee({},u,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:c??a._wrapperState.initialChecked})}function ft(a,u){var c=u.defaultValue==null?"":u.defaultValue,p=u.checked!=null?u.checked:u.defaultChecked;c=ke(u.value!=null?u.value:c),a._wrapperState={initialChecked:p,initialValue:c,controlled:u.type==="checkbox"||u.type==="radio"?u.checked!=null:u.value!=null}}function dt(a,u){u=u.checked,u!=null&&A(a,"checked",u,!1)}function At(a,u){dt(a,u);var c=ke(u.value),p=u.type;if(c!=null)p==="number"?(c===0&&a.value===""||a.value!=c)&&(a.value=""+c):a.value!==""+c&&(a.value=""+c);else if(p==="submit"||p==="reset"){a.removeAttribute("value");return}u.hasOwnProperty("value")?Qr(a,u.type,c):u.hasOwnProperty("defaultValue")&&Qr(a,u.type,ke(u.defaultValue)),u.checked==null&&u.defaultChecked!=null&&(a.defaultChecked=!!u.defaultChecked)}function Nr(a,u,c){if(u.hasOwnProperty("value")||u.hasOwnProperty("defaultValue")){var p=u.type;if(!(p!=="submit"&&p!=="reset"||u.value!==void 0&&u.value!==null))return;u=""+a._wrapperState.initialValue,c||u===a.value||(a.value=u),a.defaultValue=u}c=a.name,c!==""&&(a.name=""),a.defaultChecked=!!a._wrapperState.initialChecked,c!==""&&(a.name=c)}function Qr(a,u,c){(u!=="number"||Xe(a.ownerDocument)!==a)&&(c==null?a.defaultValue=""+a._wrapperState.initialValue:a.defaultValue!==""+c&&(a.defaultValue=""+c))}var Jr=Array.isArray;function Qt(a,u,c,p){if(a=a.options,u){u={};for(var y=0;y"+u.valueOf().toString()+"",u=nl.firstChild;a.firstChild;)a.removeChild(a.firstChild);for(;u.firstChild;)a.appendChild(u.firstChild)}});function qo(a,u){if(u){var c=a.firstChild;if(c&&c===a.lastChild&&c.nodeType===3){c.nodeValue=u;return}}a.textContent=u}var Fo={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},wM=["Webkit","ms","Moz","O"];Object.keys(Fo).forEach(function(a){wM.forEach(function(u){u=u+a.charAt(0).toUpperCase()+a.substring(1),Fo[u]=Fo[a]})});function dx(a,u,c){return u==null||typeof u=="boolean"||u===""?"":c||typeof u!="number"||u===0||Fo.hasOwnProperty(a)&&Fo[a]?(""+u).trim():u+"px"}function px(a,u){a=a.style;for(var c in u)if(u.hasOwnProperty(c)){var p=c.indexOf("--")===0,y=dx(c,u[c],p);c==="float"&&(c="cssFloat"),p?a.setProperty(c,y):a[c]=y}}var _M=ee({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 Sd(a,u){if(u){if(_M[a]&&(u.children!=null||u.dangerouslySetInnerHTML!=null))throw Error(r(137,a));if(u.dangerouslySetInnerHTML!=null){if(u.children!=null)throw Error(r(60));if(typeof u.dangerouslySetInnerHTML!="object"||!("__html"in u.dangerouslySetInnerHTML))throw Error(r(61))}if(u.style!=null&&typeof u.style!="object")throw Error(r(62))}}function Od(a,u){if(a.indexOf("-")===-1)return typeof u.is=="string";switch(a){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 Pd=null;function Ad(a){return a=a.target||a.srcElement||window,a.correspondingUseElement&&(a=a.correspondingUseElement),a.nodeType===3?a.parentNode:a}var Ed=null,da=null,pa=null;function hx(a){if(a=cu(a)){if(typeof Ed!="function")throw Error(r(280));var u=a.stateNode;u&&(u=Al(u),Ed(a.stateNode,a.type,u))}}function mx(a){da?pa?pa.push(a):pa=[a]:da=a}function vx(){if(da){var a=da,u=pa;if(pa=da=null,hx(a),u)for(a=0;a>>=0,a===0?32:31-(MM(a)/IM|0)|0}var sl=64,ll=4194304;function Ho(a){switch(a&-a){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 a&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return a&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return a}}function cl(a,u){var c=a.pendingLanes;if(c===0)return 0;var p=0,y=a.suspendedLanes,b=a.pingedLanes,T=c&268435455;if(T!==0){var j=T&~y;j!==0?p=Ho(j):(b&=T,b!==0&&(p=Ho(b)))}else T=c&~y,T!==0?p=Ho(T):b!==0&&(p=Ho(b));if(p===0)return 0;if(u!==0&&u!==p&&!(u&y)&&(y=p&-p,b=u&-u,y>=b||y===16&&(b&4194240)!==0))return u;if(p&4&&(p|=c&16),u=a.entangledLanes,u!==0)for(a=a.entanglements,u&=p;0c;c++)u.push(a);return u}function Go(a,u,c){a.pendingLanes|=u,u!==536870912&&(a.suspendedLanes=0,a.pingedLanes=0),a=a.eventTimes,u=31-Ir(u),a[u]=c}function LM(a,u){var c=a.pendingLanes&~u;a.pendingLanes=u,a.suspendedLanes=0,a.pingedLanes=0,a.expiredLanes&=u,a.mutableReadLanes&=u,a.entangledLanes&=u,u=a.entanglements;var p=a.eventTimes;for(a=a.expirationTimes;0=tu),Wx=" ",Vx=!1;function Hx(a,u){switch(a){case"keyup":return d2.indexOf(u.keyCode)!==-1;case"keydown":return u.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Gx(a){return a=a.detail,typeof a=="object"&&"data"in a?a.data:null}var va=!1;function h2(a,u){switch(a){case"compositionend":return Gx(u);case"keypress":return u.which!==32?null:(Vx=!0,Wx);case"textInput":return a=u.data,a===Wx&&Vx?null:a;default:return null}}function m2(a,u){if(va)return a==="compositionend"||!Vd&&Hx(a,u)?(a=Lx(),ml=zd=Qn=null,va=!1,a):null;switch(a){case"paste":return null;case"keypress":if(!(u.ctrlKey||u.altKey||u.metaKey)||u.ctrlKey&&u.altKey){if(u.char&&1=u)return{node:c,offset:u-a};a=p}e:{for(;c;){if(c.nextSibling){c=c.nextSibling;break e}c=c.parentNode}c=void 0}c=ew(c)}}function rw(a,u){return a&&u?a===u?!0:a&&a.nodeType===3?!1:u&&u.nodeType===3?rw(a,u.parentNode):"contains"in a?a.contains(u):a.compareDocumentPosition?!!(a.compareDocumentPosition(u)&16):!1:!1}function nw(){for(var a=window,u=Xe();u instanceof a.HTMLIFrameElement;){try{var c=typeof u.contentWindow.location.href=="string"}catch{c=!1}if(c)a=u.contentWindow;else break;u=Xe(a.document)}return u}function Kd(a){var u=a&&a.nodeName&&a.nodeName.toLowerCase();return u&&(u==="input"&&(a.type==="text"||a.type==="search"||a.type==="tel"||a.type==="url"||a.type==="password")||u==="textarea"||a.contentEditable==="true")}function O2(a){var u=nw(),c=a.focusedElem,p=a.selectionRange;if(u!==c&&c&&c.ownerDocument&&rw(c.ownerDocument.documentElement,c)){if(p!==null&&Kd(c)){if(u=p.start,a=p.end,a===void 0&&(a=u),"selectionStart"in c)c.selectionStart=u,c.selectionEnd=Math.min(a,c.value.length);else if(a=(u=c.ownerDocument||document)&&u.defaultView||window,a.getSelection){a=a.getSelection();var y=c.textContent.length,b=Math.min(p.start,y);p=p.end===void 0?b:Math.min(p.end,y),!a.extend&&b>p&&(y=p,p=b,b=y),y=tw(c,b);var T=tw(c,p);y&&T&&(a.rangeCount!==1||a.anchorNode!==y.node||a.anchorOffset!==y.offset||a.focusNode!==T.node||a.focusOffset!==T.offset)&&(u=u.createRange(),u.setStart(y.node,y.offset),a.removeAllRanges(),b>p?(a.addRange(u),a.extend(T.node,T.offset)):(u.setEnd(T.node,T.offset),a.addRange(u)))}}for(u=[],a=c;a=a.parentNode;)a.nodeType===1&&u.push({element:a,left:a.scrollLeft,top:a.scrollTop});for(typeof c.focus=="function"&&c.focus(),c=0;c=document.documentMode,ya=null,Zd=null,au=null,Xd=!1;function iw(a,u,c){var p=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;Xd||ya==null||ya!==Xe(p)||(p=ya,"selectionStart"in p&&Kd(p)?p={start:p.selectionStart,end:p.selectionEnd}:(p=(p.ownerDocument&&p.ownerDocument.defaultView||window).getSelection(),p={anchorNode:p.anchorNode,anchorOffset:p.anchorOffset,focusNode:p.focusNode,focusOffset:p.focusOffset}),au&&iu(au,p)||(au=p,p=Sl(Zd,"onSelect"),0_a||(a.current=sp[_a],sp[_a]=null,_a--)}function Je(a,u){_a++,sp[_a]=a.current,a.current=u}var ri={},Dt=ti(ri),Jt=ti(!1),Ni=ri;function Sa(a,u){var c=a.type.contextTypes;if(!c)return ri;var p=a.stateNode;if(p&&p.__reactInternalMemoizedUnmaskedChildContext===u)return p.__reactInternalMemoizedMaskedChildContext;var y={},b;for(b in c)y[b]=u[b];return p&&(a=a.stateNode,a.__reactInternalMemoizedUnmaskedChildContext=u,a.__reactInternalMemoizedMaskedChildContext=y),y}function er(a){return a=a.childContextTypes,a!=null}function El(){nt(Jt),nt(Dt)}function bw(a,u,c){if(Dt.current!==ri)throw Error(r(168));Je(Dt,u),Je(Jt,c)}function xw(a,u,c){var p=a.stateNode;if(u=u.childContextTypes,typeof p.getChildContext!="function")return c;p=p.getChildContext();for(var y in p)if(!(y in u))throw Error(r(108,qe(a)||"Unknown",y));return ee({},c,p)}function Tl(a){return a=(a=a.stateNode)&&a.__reactInternalMemoizedMergedChildContext||ri,Ni=Dt.current,Je(Dt,a),Je(Jt,Jt.current),!0}function ww(a,u,c){var p=a.stateNode;if(!p)throw Error(r(169));c?(a=xw(a,u,Ni),p.__reactInternalMemoizedMergedChildContext=a,nt(Jt),nt(Dt),Je(Dt,a)):nt(Jt),Je(Jt,c)}var Sn=null,Cl=!1,lp=!1;function _w(a){Sn===null?Sn=[a]:Sn.push(a)}function $2(a){Cl=!0,_w(a)}function ni(){if(!lp&&Sn!==null){lp=!0;var a=0,u=Ke;try{var c=Sn;for(Ke=1;a>=T,y-=T,On=1<<32-Ir(u)+y|c<Te?(Ct=Oe,Oe=null):Ct=Oe.sibling;var We=re(W,Oe,G[Te],se);if(We===null){Oe===null&&(Oe=Ct);break}a&&Oe&&We.alternate===null&&u(W,Oe),q=b(We,q,Te),Se===null?be=We:Se.sibling=We,Se=We,Oe=Ct}if(Te===G.length)return c(W,Oe),ot&&Ii(W,Te),be;if(Oe===null){for(;TeTe?(Ct=Oe,Oe=null):Ct=Oe.sibling;var di=re(W,Oe,We.value,se);if(di===null){Oe===null&&(Oe=Ct);break}a&&Oe&&di.alternate===null&&u(W,Oe),q=b(di,q,Te),Se===null?be=di:Se.sibling=di,Se=di,Oe=Ct}if(We.done)return c(W,Oe),ot&&Ii(W,Te),be;if(Oe===null){for(;!We.done;Te++,We=G.next())We=ae(W,We.value,se),We!==null&&(q=b(We,q,Te),Se===null?be=We:Se.sibling=We,Se=We);return ot&&Ii(W,Te),be}for(Oe=p(W,Oe);!We.done;Te++,We=G.next())We=de(Oe,W,Te,We.value,se),We!==null&&(a&&We.alternate!==null&&Oe.delete(We.key===null?Te:We.key),q=b(We,q,Te),Se===null?be=We:Se.sibling=We,Se=We);return a&&Oe.forEach(function(mI){return u(W,mI)}),ot&&Ii(W,Te),be}function vt(W,q,G,se){if(typeof G=="object"&&G!==null&&G.type===k&&G.key===null&&(G=G.props.children),typeof G=="object"&&G!==null){switch(G.$$typeof){case S:e:{for(var be=G.key,Se=q;Se!==null;){if(Se.key===be){if(be=G.type,be===k){if(Se.tag===7){c(W,Se.sibling),q=y(Se,G.props.children),q.return=W,W=q;break e}}else if(Se.elementType===be||typeof be=="object"&&be!==null&&be.$$typeof===Y&&Tw(be)===Se.type){c(W,Se.sibling),q=y(Se,G.props),q.ref=fu(W,Se,G),q.return=W,W=q;break e}c(W,Se);break}else u(W,Se);Se=Se.sibling}G.type===k?(q=Fi(G.props.children,W.mode,se,G.key),q.return=W,W=q):(se=nc(G.type,G.key,G.props,null,W.mode,se),se.ref=fu(W,q,G),se.return=W,W=se)}return T(W);case E:e:{for(Se=G.key;q!==null;){if(q.key===Se)if(q.tag===4&&q.stateNode.containerInfo===G.containerInfo&&q.stateNode.implementation===G.implementation){c(W,q.sibling),q=y(q,G.children||[]),q.return=W,W=q;break e}else{c(W,q);break}else u(W,q);q=q.sibling}q=oh(G,W.mode,se),q.return=W,W=q}return T(W);case Y:return Se=G._init,vt(W,q,Se(G._payload),se)}if(Jr(G))return ve(W,q,G,se);if(Q(G))return ge(W,q,G,se);Ml(W,G)}return typeof G=="string"&&G!==""||typeof G=="number"?(G=""+G,q!==null&&q.tag===6?(c(W,q.sibling),q=y(q,G),q.return=W,W=q):(c(W,q),q=ah(G,W.mode,se),q.return=W,W=q),T(W)):c(W,q)}return vt}var Ea=Cw(!0),kw=Cw(!1),Il=ti(null),Rl=null,Ta=null,mp=null;function vp(){mp=Ta=Rl=null}function yp(a){var u=Il.current;nt(Il),a._currentValue=u}function gp(a,u,c){for(;a!==null;){var p=a.alternate;if((a.childLanes&u)!==u?(a.childLanes|=u,p!==null&&(p.childLanes|=u)):p!==null&&(p.childLanes&u)!==u&&(p.childLanes|=u),a===c)break;a=a.return}}function Ca(a,u){Rl=a,mp=Ta=null,a=a.dependencies,a!==null&&a.firstContext!==null&&(a.lanes&u&&(tr=!0),a.firstContext=null)}function xr(a){var u=a._currentValue;if(mp!==a)if(a={context:a,memoizedValue:u,next:null},Ta===null){if(Rl===null)throw Error(r(308));Ta=a,Rl.dependencies={lanes:0,firstContext:a}}else Ta=Ta.next=a;return u}var Ri=null;function bp(a){Ri===null?Ri=[a]:Ri.push(a)}function jw(a,u,c,p){var y=u.interleaved;return y===null?(c.next=c,bp(u)):(c.next=y.next,y.next=c),u.interleaved=c,An(a,p)}function An(a,u){a.lanes|=u;var c=a.alternate;for(c!==null&&(c.lanes|=u),c=a,a=a.return;a!==null;)a.childLanes|=u,c=a.alternate,c!==null&&(c.childLanes|=u),c=a,a=a.return;return c.tag===3?c.stateNode:null}var ii=!1;function xp(a){a.updateQueue={baseState:a.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Nw(a,u){a=a.updateQueue,u.updateQueue===a&&(u.updateQueue={baseState:a.baseState,firstBaseUpdate:a.firstBaseUpdate,lastBaseUpdate:a.lastBaseUpdate,shared:a.shared,effects:a.effects})}function En(a,u){return{eventTime:a,lane:u,tag:0,payload:null,callback:null,next:null}}function ai(a,u,c){var p=a.updateQueue;if(p===null)return null;if(p=p.shared,Ue&2){var y=p.pending;return y===null?u.next=u:(u.next=y.next,y.next=u),p.pending=u,An(a,c)}return y=p.interleaved,y===null?(u.next=u,bp(p)):(u.next=y.next,y.next=u),p.interleaved=u,An(a,c)}function $l(a,u,c){if(u=u.updateQueue,u!==null&&(u=u.shared,(c&4194240)!==0)){var p=u.lanes;p&=a.pendingLanes,c|=p,u.lanes=c,Id(a,c)}}function Mw(a,u){var c=a.updateQueue,p=a.alternate;if(p!==null&&(p=p.updateQueue,c===p)){var y=null,b=null;if(c=c.firstBaseUpdate,c!==null){do{var T={eventTime:c.eventTime,lane:c.lane,tag:c.tag,payload:c.payload,callback:c.callback,next:null};b===null?y=b=T:b=b.next=T,c=c.next}while(c!==null);b===null?y=b=u:b=b.next=u}else y=b=u;c={baseState:p.baseState,firstBaseUpdate:y,lastBaseUpdate:b,shared:p.shared,effects:p.effects},a.updateQueue=c;return}a=c.lastBaseUpdate,a===null?c.firstBaseUpdate=u:a.next=u,c.lastBaseUpdate=u}function Dl(a,u,c,p){var y=a.updateQueue;ii=!1;var b=y.firstBaseUpdate,T=y.lastBaseUpdate,j=y.shared.pending;if(j!==null){y.shared.pending=null;var z=j,K=z.next;z.next=null,T===null?b=K:T.next=K,T=z;var ne=a.alternate;ne!==null&&(ne=ne.updateQueue,j=ne.lastBaseUpdate,j!==T&&(j===null?ne.firstBaseUpdate=K:j.next=K,ne.lastBaseUpdate=z))}if(b!==null){var ae=y.baseState;T=0,ne=K=z=null,j=b;do{var re=j.lane,de=j.eventTime;if((p&re)===re){ne!==null&&(ne=ne.next={eventTime:de,lane:0,tag:j.tag,payload:j.payload,callback:j.callback,next:null});e:{var ve=a,ge=j;switch(re=u,de=c,ge.tag){case 1:if(ve=ge.payload,typeof ve=="function"){ae=ve.call(de,ae,re);break e}ae=ve;break e;case 3:ve.flags=ve.flags&-65537|128;case 0:if(ve=ge.payload,re=typeof ve=="function"?ve.call(de,ae,re):ve,re==null)break e;ae=ee({},ae,re);break e;case 2:ii=!0}}j.callback!==null&&j.lane!==0&&(a.flags|=64,re=y.effects,re===null?y.effects=[j]:re.push(j))}else de={eventTime:de,lane:re,tag:j.tag,payload:j.payload,callback:j.callback,next:null},ne===null?(K=ne=de,z=ae):ne=ne.next=de,T|=re;if(j=j.next,j===null){if(j=y.shared.pending,j===null)break;re=j,j=re.next,re.next=null,y.lastBaseUpdate=re,y.shared.pending=null}}while(!0);if(ne===null&&(z=ae),y.baseState=z,y.firstBaseUpdate=K,y.lastBaseUpdate=ne,u=y.shared.interleaved,u!==null){y=u;do T|=y.lane,y=y.next;while(y!==u)}else b===null&&(y.shared.lanes=0);Li|=T,a.lanes=T,a.memoizedState=ae}}function Iw(a,u,c){if(a=u.effects,u.effects=null,a!==null)for(u=0;uc?c:4,a(!0);var p=Pp.transition;Pp.transition={};try{a(!1),u()}finally{Ke=c,Pp.transition=p}}function Jw(){return wr().memoizedState}function B2(a,u,c){var p=li(a);if(c={lane:p,action:c,hasEagerState:!1,eagerState:null,next:null},e_(a))t_(u,c);else if(c=jw(a,u,c,p),c!==null){var y=Gt();Br(c,a,p,y),r_(c,u,p)}}function q2(a,u,c){var p=li(a),y={lane:p,action:c,hasEagerState:!1,eagerState:null,next:null};if(e_(a))t_(u,y);else{var b=a.alternate;if(a.lanes===0&&(b===null||b.lanes===0)&&(b=u.lastRenderedReducer,b!==null))try{var T=u.lastRenderedState,j=b(T,c);if(y.hasEagerState=!0,y.eagerState=j,Rr(j,T)){var z=u.interleaved;z===null?(y.next=y,bp(u)):(y.next=z.next,z.next=y),u.interleaved=y;return}}catch{}finally{}c=jw(a,u,y,p),c!==null&&(y=Gt(),Br(c,a,p,y),r_(c,u,p))}}function e_(a){var u=a.alternate;return a===lt||u!==null&&u===lt}function t_(a,u){mu=Bl=!0;var c=a.pending;c===null?u.next=u:(u.next=c.next,c.next=u),a.pending=u}function r_(a,u,c){if(c&4194240){var p=u.lanes;p&=a.pendingLanes,c|=p,u.lanes=c,Id(a,c)}}var Ul={readContext:xr,useCallback:Lt,useContext:Lt,useEffect:Lt,useImperativeHandle:Lt,useInsertionEffect:Lt,useLayoutEffect:Lt,useMemo:Lt,useReducer:Lt,useRef:Lt,useState:Lt,useDebugValue:Lt,useDeferredValue:Lt,useTransition:Lt,useMutableSource:Lt,useSyncExternalStore:Lt,useId:Lt,unstable_isNewReconciler:!1},F2={readContext:xr,useCallback:function(a,u){return nn().memoizedState=[a,u===void 0?null:u],a},useContext:xr,useEffect:Vw,useImperativeHandle:function(a,u,c){return c=c!=null?c.concat([a]):null,ql(4194308,4,Kw.bind(null,u,a),c)},useLayoutEffect:function(a,u){return ql(4194308,4,a,u)},useInsertionEffect:function(a,u){return ql(4,2,a,u)},useMemo:function(a,u){var c=nn();return u=u===void 0?null:u,a=a(),c.memoizedState=[a,u],a},useReducer:function(a,u,c){var p=nn();return u=c!==void 0?c(u):u,p.memoizedState=p.baseState=u,a={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:a,lastRenderedState:u},p.queue=a,a=a.dispatch=B2.bind(null,lt,a),[p.memoizedState,a]},useRef:function(a){var u=nn();return a={current:a},u.memoizedState=a},useState:Uw,useDebugValue:Np,useDeferredValue:function(a){return nn().memoizedState=a},useTransition:function(){var a=Uw(!1),u=a[0];return a=z2.bind(null,a[1]),nn().memoizedState=a,[u,a]},useMutableSource:function(){},useSyncExternalStore:function(a,u,c){var p=lt,y=nn();if(ot){if(c===void 0)throw Error(r(407));c=c()}else{if(c=u(),Tt===null)throw Error(r(349));Di&30||Lw(p,u,c)}y.memoizedState=c;var b={value:c,getSnapshot:u};return y.queue=b,Vw(Bw.bind(null,p,b,a),[a]),p.flags|=2048,gu(9,zw.bind(null,p,b,c,u),void 0,null),c},useId:function(){var a=nn(),u=Tt.identifierPrefix;if(ot){var c=Pn,p=On;c=(p&~(1<<32-Ir(p)-1)).toString(32)+c,u=":"+u+"R"+c,c=vu++,0<\/script>",a=a.removeChild(a.firstChild)):typeof p.is=="string"?a=T.createElement(c,{is:p.is}):(a=T.createElement(c),c==="select"&&(T=a,p.multiple?T.multiple=!0:p.size&&(T.size=p.size))):a=T.createElementNS(a,c),a[tn]=u,a[lu]=p,__(a,u,!1,!1),u.stateNode=a;e:{switch(T=Od(c,p),c){case"dialog":rt("cancel",a),rt("close",a),y=p;break;case"iframe":case"object":case"embed":rt("load",a),y=p;break;case"video":case"audio":for(y=0;yIa&&(u.flags|=128,p=!0,bu(b,!1),u.lanes=4194304)}else{if(!p)if(a=Ll(T),a!==null){if(u.flags|=128,p=!0,c=a.updateQueue,c!==null&&(u.updateQueue=c,u.flags|=4),bu(b,!0),b.tail===null&&b.tailMode==="hidden"&&!T.alternate&&!ot)return zt(u),null}else 2*mt()-b.renderingStartTime>Ia&&c!==1073741824&&(u.flags|=128,p=!0,bu(b,!1),u.lanes=4194304);b.isBackwards?(T.sibling=u.child,u.child=T):(c=b.last,c!==null?c.sibling=T:u.child=T,b.last=T)}return b.tail!==null?(u=b.tail,b.rendering=u,b.tail=u.sibling,b.renderingStartTime=mt(),u.sibling=null,c=st.current,Je(st,p?c&1|2:c&1),u):(zt(u),null);case 22:case 23:return rh(),p=u.memoizedState!==null,a!==null&&a.memoizedState!==null!==p&&(u.flags|=8192),p&&u.mode&1?fr&1073741824&&(zt(u),u.subtreeFlags&6&&(u.flags|=8192)):zt(u),null;case 24:return null;case 25:return null}throw Error(r(156,u.tag))}function X2(a,u){switch(fp(u),u.tag){case 1:return er(u.type)&&El(),a=u.flags,a&65536?(u.flags=a&-65537|128,u):null;case 3:return ka(),nt(Jt),nt(Dt),Op(),a=u.flags,a&65536&&!(a&128)?(u.flags=a&-65537|128,u):null;case 5:return _p(u),null;case 13:if(nt(st),a=u.memoizedState,a!==null&&a.dehydrated!==null){if(u.alternate===null)throw Error(r(340));Aa()}return a=u.flags,a&65536?(u.flags=a&-65537|128,u):null;case 19:return nt(st),null;case 4:return ka(),null;case 10:return yp(u.type._context),null;case 22:case 23:return rh(),null;case 24:return null;default:return null}}var Gl=!1,Bt=!1,Y2=typeof WeakSet=="function"?WeakSet:Set,he=null;function Na(a,u){var c=a.ref;if(c!==null)if(typeof c=="function")try{c(null)}catch(p){pt(a,u,p)}else c.current=null}function Wp(a,u,c){try{c()}catch(p){pt(a,u,p)}}var P_=!1;function Q2(a,u){if(rp=pl,a=nw(),Kd(a)){if("selectionStart"in a)var c={start:a.selectionStart,end:a.selectionEnd};else e:{c=(c=a.ownerDocument)&&c.defaultView||window;var p=c.getSelection&&c.getSelection();if(p&&p.rangeCount!==0){c=p.anchorNode;var y=p.anchorOffset,b=p.focusNode;p=p.focusOffset;try{c.nodeType,b.nodeType}catch{c=null;break e}var T=0,j=-1,z=-1,K=0,ne=0,ae=a,re=null;t:for(;;){for(var de;ae!==c||y!==0&&ae.nodeType!==3||(j=T+y),ae!==b||p!==0&&ae.nodeType!==3||(z=T+p),ae.nodeType===3&&(T+=ae.nodeValue.length),(de=ae.firstChild)!==null;)re=ae,ae=de;for(;;){if(ae===a)break t;if(re===c&&++K===y&&(j=T),re===b&&++ne===p&&(z=T),(de=ae.nextSibling)!==null)break;ae=re,re=ae.parentNode}ae=de}c=j===-1||z===-1?null:{start:j,end:z}}else c=null}c=c||{start:0,end:0}}else c=null;for(np={focusedElem:a,selectionRange:c},pl=!1,he=u;he!==null;)if(u=he,a=u.child,(u.subtreeFlags&1028)!==0&&a!==null)a.return=u,he=a;else for(;he!==null;){u=he;try{var ve=u.alternate;if(u.flags&1024)switch(u.tag){case 0:case 11:case 15:break;case 1:if(ve!==null){var ge=ve.memoizedProps,vt=ve.memoizedState,W=u.stateNode,q=W.getSnapshotBeforeUpdate(u.elementType===u.type?ge:Dr(u.type,ge),vt);W.__reactInternalSnapshotBeforeUpdate=q}break;case 3:var G=u.stateNode.containerInfo;G.nodeType===1?G.textContent="":G.nodeType===9&&G.documentElement&&G.removeChild(G.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(se){pt(u,u.return,se)}if(a=u.sibling,a!==null){a.return=u.return,he=a;break}he=u.return}return ve=P_,P_=!1,ve}function xu(a,u,c){var p=u.updateQueue;if(p=p!==null?p.lastEffect:null,p!==null){var y=p=p.next;do{if((y.tag&a)===a){var b=y.destroy;y.destroy=void 0,b!==void 0&&Wp(u,c,b)}y=y.next}while(y!==p)}}function Kl(a,u){if(u=u.updateQueue,u=u!==null?u.lastEffect:null,u!==null){var c=u=u.next;do{if((c.tag&a)===a){var p=c.create;c.destroy=p()}c=c.next}while(c!==u)}}function Vp(a){var u=a.ref;if(u!==null){var c=a.stateNode;switch(a.tag){case 5:a=c;break;default:a=c}typeof u=="function"?u(a):u.current=a}}function A_(a){var u=a.alternate;u!==null&&(a.alternate=null,A_(u)),a.child=null,a.deletions=null,a.sibling=null,a.tag===5&&(u=a.stateNode,u!==null&&(delete u[tn],delete u[lu],delete u[up],delete u[I2],delete u[R2])),a.stateNode=null,a.return=null,a.dependencies=null,a.memoizedProps=null,a.memoizedState=null,a.pendingProps=null,a.stateNode=null,a.updateQueue=null}function E_(a){return a.tag===5||a.tag===3||a.tag===4}function T_(a){e:for(;;){for(;a.sibling===null;){if(a.return===null||E_(a.return))return null;a=a.return}for(a.sibling.return=a.return,a=a.sibling;a.tag!==5&&a.tag!==6&&a.tag!==18;){if(a.flags&2||a.child===null||a.tag===4)continue e;a.child.return=a,a=a.child}if(!(a.flags&2))return a.stateNode}}function Hp(a,u,c){var p=a.tag;if(p===5||p===6)a=a.stateNode,u?c.nodeType===8?c.parentNode.insertBefore(a,u):c.insertBefore(a,u):(c.nodeType===8?(u=c.parentNode,u.insertBefore(a,c)):(u=c,u.appendChild(a)),c=c._reactRootContainer,c!=null||u.onclick!==null||(u.onclick=Pl));else if(p!==4&&(a=a.child,a!==null))for(Hp(a,u,c),a=a.sibling;a!==null;)Hp(a,u,c),a=a.sibling}function Gp(a,u,c){var p=a.tag;if(p===5||p===6)a=a.stateNode,u?c.insertBefore(a,u):c.appendChild(a);else if(p!==4&&(a=a.child,a!==null))for(Gp(a,u,c),a=a.sibling;a!==null;)Gp(a,u,c),a=a.sibling}var Nt=null,Lr=!1;function oi(a,u,c){for(c=c.child;c!==null;)C_(a,u,c),c=c.sibling}function C_(a,u,c){if(en&&typeof en.onCommitFiberUnmount=="function")try{en.onCommitFiberUnmount(ul,c)}catch{}switch(c.tag){case 5:Bt||Na(c,u);case 6:var p=Nt,y=Lr;Nt=null,oi(a,u,c),Nt=p,Lr=y,Nt!==null&&(Lr?(a=Nt,c=c.stateNode,a.nodeType===8?a.parentNode.removeChild(c):a.removeChild(c)):Nt.removeChild(c.stateNode));break;case 18:Nt!==null&&(Lr?(a=Nt,c=c.stateNode,a.nodeType===8?op(a.parentNode,c):a.nodeType===1&&op(a,c),Qo(a)):op(Nt,c.stateNode));break;case 4:p=Nt,y=Lr,Nt=c.stateNode.containerInfo,Lr=!0,oi(a,u,c),Nt=p,Lr=y;break;case 0:case 11:case 14:case 15:if(!Bt&&(p=c.updateQueue,p!==null&&(p=p.lastEffect,p!==null))){y=p=p.next;do{var b=y,T=b.destroy;b=b.tag,T!==void 0&&(b&2||b&4)&&Wp(c,u,T),y=y.next}while(y!==p)}oi(a,u,c);break;case 1:if(!Bt&&(Na(c,u),p=c.stateNode,typeof p.componentWillUnmount=="function"))try{p.props=c.memoizedProps,p.state=c.memoizedState,p.componentWillUnmount()}catch(j){pt(c,u,j)}oi(a,u,c);break;case 21:oi(a,u,c);break;case 22:c.mode&1?(Bt=(p=Bt)||c.memoizedState!==null,oi(a,u,c),Bt=p):oi(a,u,c);break;default:oi(a,u,c)}}function k_(a){var u=a.updateQueue;if(u!==null){a.updateQueue=null;var c=a.stateNode;c===null&&(c=a.stateNode=new Y2),u.forEach(function(p){var y=uI.bind(null,a,p);c.has(p)||(c.add(p),p.then(y,y))})}}function zr(a,u){var c=u.deletions;if(c!==null)for(var p=0;py&&(y=T),p&=~b}if(p=y,p=mt()-p,p=(120>p?120:480>p?480:1080>p?1080:1920>p?1920:3e3>p?3e3:4320>p?4320:1960*eI(p/1960))-p,10a?16:a,si===null)var p=!1;else{if(a=si,si=null,Jl=0,Ue&6)throw Error(r(331));var y=Ue;for(Ue|=4,he=a.current;he!==null;){var b=he,T=b.child;if(he.flags&16){var j=b.deletions;if(j!==null){for(var z=0;zmt()-Xp?Bi(a,0):Zp|=c),nr(a,u)}function U_(a,u){u===0&&(a.mode&1?(u=ll,ll<<=1,!(ll&130023424)&&(ll=4194304)):u=1);var c=Gt();a=An(a,u),a!==null&&(Go(a,u,c),nr(a,c))}function oI(a){var u=a.memoizedState,c=0;u!==null&&(c=u.retryLane),U_(a,c)}function uI(a,u){var c=0;switch(a.tag){case 13:var p=a.stateNode,y=a.memoizedState;y!==null&&(c=y.retryLane);break;case 19:p=a.stateNode;break;default:throw Error(r(314))}p!==null&&p.delete(u),U_(a,c)}var W_;W_=function(a,u,c){if(a!==null)if(a.memoizedProps!==u.pendingProps||Jt.current)tr=!0;else{if(!(a.lanes&c)&&!(u.flags&128))return tr=!1,K2(a,u,c);tr=!!(a.flags&131072)}else tr=!1,ot&&u.flags&1048576&&Sw(u,jl,u.index);switch(u.lanes=0,u.tag){case 2:var p=u.type;Hl(a,u),a=u.pendingProps;var y=Sa(u,Dt.current);Ca(u,c),y=Ep(null,u,p,a,y,c);var b=Tp();return u.flags|=1,typeof y=="object"&&y!==null&&typeof y.render=="function"&&y.$$typeof===void 0?(u.tag=1,u.memoizedState=null,u.updateQueue=null,er(p)?(b=!0,Tl(u)):b=!1,u.memoizedState=y.state!==null&&y.state!==void 0?y.state:null,xp(u),y.updater=Wl,u.stateNode=y,y._reactInternals=u,Ip(u,p,a,c),u=Lp(null,u,p,!0,b,c)):(u.tag=0,ot&&b&&cp(u),Ht(null,u,y,c),u=u.child),u;case 16:p=u.elementType;e:{switch(Hl(a,u),a=u.pendingProps,y=p._init,p=y(p._payload),u.type=p,y=u.tag=lI(p),a=Dr(p,a),y){case 0:u=Dp(null,u,p,a,c);break e;case 1:u=v_(null,u,p,a,c);break e;case 11:u=f_(null,u,p,a,c);break e;case 14:u=d_(null,u,p,Dr(p.type,a),c);break e}throw Error(r(306,p,""))}return u;case 0:return p=u.type,y=u.pendingProps,y=u.elementType===p?y:Dr(p,y),Dp(a,u,p,y,c);case 1:return p=u.type,y=u.pendingProps,y=u.elementType===p?y:Dr(p,y),v_(a,u,p,y,c);case 3:e:{if(y_(u),a===null)throw Error(r(387));p=u.pendingProps,b=u.memoizedState,y=b.element,Nw(a,u),Dl(u,p,null,c);var T=u.memoizedState;if(p=T.element,b.isDehydrated)if(b={element:p,isDehydrated:!1,cache:T.cache,pendingSuspenseBoundaries:T.pendingSuspenseBoundaries,transitions:T.transitions},u.updateQueue.baseState=b,u.memoizedState=b,u.flags&256){y=ja(Error(r(423)),u),u=g_(a,u,p,c,y);break e}else if(p!==y){y=ja(Error(r(424)),u),u=g_(a,u,p,c,y);break e}else for(cr=ei(u.stateNode.containerInfo.firstChild),lr=u,ot=!0,$r=null,c=kw(u,null,p,c),u.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling;else{if(Aa(),p===y){u=Tn(a,u,c);break e}Ht(a,u,p,c)}u=u.child}return u;case 5:return Rw(u),a===null&&pp(u),p=u.type,y=u.pendingProps,b=a!==null?a.memoizedProps:null,T=y.children,ip(p,y)?T=null:b!==null&&ip(p,b)&&(u.flags|=32),m_(a,u),Ht(a,u,T,c),u.child;case 6:return a===null&&pp(u),null;case 13:return b_(a,u,c);case 4:return wp(u,u.stateNode.containerInfo),p=u.pendingProps,a===null?u.child=Ea(u,null,p,c):Ht(a,u,p,c),u.child;case 11:return p=u.type,y=u.pendingProps,y=u.elementType===p?y:Dr(p,y),f_(a,u,p,y,c);case 7:return Ht(a,u,u.pendingProps,c),u.child;case 8:return Ht(a,u,u.pendingProps.children,c),u.child;case 12:return Ht(a,u,u.pendingProps.children,c),u.child;case 10:e:{if(p=u.type._context,y=u.pendingProps,b=u.memoizedProps,T=y.value,Je(Il,p._currentValue),p._currentValue=T,b!==null)if(Rr(b.value,T)){if(b.children===y.children&&!Jt.current){u=Tn(a,u,c);break e}}else for(b=u.child,b!==null&&(b.return=u);b!==null;){var j=b.dependencies;if(j!==null){T=b.child;for(var z=j.firstContext;z!==null;){if(z.context===p){if(b.tag===1){z=En(-1,c&-c),z.tag=2;var K=b.updateQueue;if(K!==null){K=K.shared;var ne=K.pending;ne===null?z.next=z:(z.next=ne.next,ne.next=z),K.pending=z}}b.lanes|=c,z=b.alternate,z!==null&&(z.lanes|=c),gp(b.return,c,u),j.lanes|=c;break}z=z.next}}else if(b.tag===10)T=b.type===u.type?null:b.child;else if(b.tag===18){if(T=b.return,T===null)throw Error(r(341));T.lanes|=c,j=T.alternate,j!==null&&(j.lanes|=c),gp(T,c,u),T=b.sibling}else T=b.child;if(T!==null)T.return=b;else for(T=b;T!==null;){if(T===u){T=null;break}if(b=T.sibling,b!==null){b.return=T.return,T=b;break}T=T.return}b=T}Ht(a,u,y.children,c),u=u.child}return u;case 9:return y=u.type,p=u.pendingProps.children,Ca(u,c),y=xr(y),p=p(y),u.flags|=1,Ht(a,u,p,c),u.child;case 14:return p=u.type,y=Dr(p,u.pendingProps),y=Dr(p.type,y),d_(a,u,p,y,c);case 15:return p_(a,u,u.type,u.pendingProps,c);case 17:return p=u.type,y=u.pendingProps,y=u.elementType===p?y:Dr(p,y),Hl(a,u),u.tag=1,er(p)?(a=!0,Tl(u)):a=!1,Ca(u,c),i_(u,p,y),Ip(u,p,y,c),Lp(null,u,p,!0,a,c);case 19:return w_(a,u,c);case 22:return h_(a,u,c)}throw Error(r(156,u.tag))};function V_(a,u){return Ox(a,u)}function sI(a,u,c,p){this.tag=a,this.key=c,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=u,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=p,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Sr(a,u,c,p){return new sI(a,u,c,p)}function ih(a){return a=a.prototype,!(!a||!a.isReactComponent)}function lI(a){if(typeof a=="function")return ih(a)?1:0;if(a!=null){if(a=a.$$typeof,a===B)return 11;if(a===Z)return 14}return 2}function fi(a,u){var c=a.alternate;return c===null?(c=Sr(a.tag,u,a.key,a.mode),c.elementType=a.elementType,c.type=a.type,c.stateNode=a.stateNode,c.alternate=a,a.alternate=c):(c.pendingProps=u,c.type=a.type,c.flags=0,c.subtreeFlags=0,c.deletions=null),c.flags=a.flags&14680064,c.childLanes=a.childLanes,c.lanes=a.lanes,c.child=a.child,c.memoizedProps=a.memoizedProps,c.memoizedState=a.memoizedState,c.updateQueue=a.updateQueue,u=a.dependencies,c.dependencies=u===null?null:{lanes:u.lanes,firstContext:u.firstContext},c.sibling=a.sibling,c.index=a.index,c.ref=a.ref,c}function nc(a,u,c,p,y,b){var T=2;if(p=a,typeof a=="function")ih(a)&&(T=1);else if(typeof a=="string")T=5;else e:switch(a){case k:return Fi(c.children,y,b,u);case N:T=8,y|=8;break;case I:return a=Sr(12,c,u,y|2),a.elementType=I,a.lanes=b,a;case V:return a=Sr(13,c,u,y),a.elementType=V,a.lanes=b,a;case X:return a=Sr(19,c,u,y),a.elementType=X,a.lanes=b,a;case te:return ic(c,y,b,u);default:if(typeof a=="object"&&a!==null)switch(a.$$typeof){case U:T=10;break e;case $:T=9;break e;case B:T=11;break e;case Z:T=14;break e;case Y:T=16,p=null;break e}throw Error(r(130,a==null?a:typeof a,""))}return u=Sr(T,c,u,y),u.elementType=a,u.type=p,u.lanes=b,u}function Fi(a,u,c,p){return a=Sr(7,a,p,u),a.lanes=c,a}function ic(a,u,c,p){return a=Sr(22,a,p,u),a.elementType=te,a.lanes=c,a.stateNode={isHidden:!1},a}function ah(a,u,c){return a=Sr(6,a,null,u),a.lanes=c,a}function oh(a,u,c){return u=Sr(4,a.children!==null?a.children:[],a.key,u),u.lanes=c,u.stateNode={containerInfo:a.containerInfo,pendingChildren:null,implementation:a.implementation},u}function cI(a,u,c,p,y){this.tag=u,this.containerInfo=a,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Md(0),this.expirationTimes=Md(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Md(0),this.identifierPrefix=p,this.onRecoverableError=y,this.mutableSourceEagerHydrationData=null}function uh(a,u,c,p,y,b,T,j,z){return a=new cI(a,u,c,j,z),u===1?(u=1,b===!0&&(u|=8)):u=0,b=Sr(3,null,null,u),a.current=b,b.stateNode=a,b.memoizedState={element:p,isDehydrated:c,cache:null,transitions:null,pendingSuspenseBoundaries:null},xp(b),a}function fI(a,u,c){var p=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),ph.exports=SI(),ph.exports}var a1;function OI(){if(a1)return dc;a1=1;var t=nC();return dc.createRoot=t.createRoot,dc.hydrateRoot=t.hydrateRoot,dc}var PI=OI();/** + * @license lucide-react v0.469.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const AI=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),iC=(...t)=>t.filter((e,r,n)=>!!e&&e.trim()!==""&&n.indexOf(e)===r).join(" ").trim();/** + * @license lucide-react v0.469.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */var EI={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** + * @license lucide-react v0.469.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const TI=R.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:i="",children:o,iconNode:s,...l},f)=>R.createElement("svg",{ref:f,...EI,width:e,height:e,stroke:t,strokeWidth:n?Number(r)*24/Number(e):r,className:iC("lucide",i),...l},[...s.map(([d,h])=>R.createElement(d,h)),...Array.isArray(o)?o:[o]]));/** + * @license lucide-react v0.469.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const oa=(t,e)=>{const r=R.forwardRef(({className:n,...i},o)=>R.createElement(TI,{ref:o,iconNode:e,className:iC(`lucide-${AI(t)}`,n),...i}));return r.displayName=`${t}`,r};/** + * @license lucide-react v0.469.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const aC=oa("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** + * @license lucide-react v0.469.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const CI=oa("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** + * @license lucide-react v0.469.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const kI=oa("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/** + * @license lucide-react v0.469.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const jI=oa("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);/** + * @license lucide-react v0.469.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const NI=oa("FolderTree",[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]]);/** + * @license lucide-react v0.469.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const MI=oa("MessageCircle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]);/** + * @license lucide-react v0.469.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const II=oa("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);function o1(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function oC(...t){return e=>{let r=!1;const n=t.map(i=>{const o=o1(i,e);return!r&&typeof o=="function"&&(r=!0),o});if(r)return()=>{for(let i=0;i{const{children:r,...n}=t,i=R.Children.toArray(r),o=i.find($I);if(o){const s=o.props.children,l=i.map(f=>f===o?R.Children.count(s)>1?R.Children.only(null):R.isValidElement(s)?s.props.children:null:f);return D.jsx(bg,{...n,ref:e,children:R.isValidElement(s)?R.cloneElement(s,void 0,l):null})}return D.jsx(bg,{...n,ref:e,children:r})});Xu.displayName="Slot";var bg=R.forwardRef((t,e)=>{const{children:r,...n}=t;if(R.isValidElement(r)){const i=LI(r);return R.cloneElement(r,{...DI(n,r.props),ref:e?oC(e,i):i})}return R.Children.count(r)>1?R.Children.only(null):null});bg.displayName="SlotClone";var RI=({children:t})=>D.jsx(D.Fragment,{children:t});function $I(t){return R.isValidElement(t)&&t.type===RI}function DI(t,e){const r={...e};for(const n in e){const i=t[n],o=e[n];/^on[A-Z]/.test(n)?i&&o?r[n]=(...l)=>{o(...l),i(...l)}:i&&(r[n]=i):n==="style"?r[n]={...i,...o}:n==="className"&&(r[n]=[i,o].filter(Boolean).join(" "))}return{...t,...r}}function LI(t){var n,i;let e=(n=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:n.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}function uC(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;etypeof t=="boolean"?`${t}`:t===0?"0":t,s1=Be,sC=(t,e)=>r=>{var n;if((e==null?void 0:e.variants)==null)return s1(t,r==null?void 0:r.class,r==null?void 0:r.className);const{variants:i,defaultVariants:o}=e,s=Object.keys(i).map(d=>{const h=r==null?void 0:r[d],m=o==null?void 0:o[d];if(h===null)return null;const v=u1(h)||u1(m);return i[d][v]}),l=r&&Object.entries(r).reduce((d,h)=>{let[m,v]=h;return v===void 0||(d[m]=v),d},{}),f=e==null||(n=e.compoundVariants)===null||n===void 0?void 0:n.reduce((d,h)=>{let{class:m,className:v,...g}=h;return Object.entries(g).every(_=>{let[w,x]=_;return Array.isArray(x)?x.includes({...o,...l}[w]):{...o,...l}[w]===x})?[...d,m,v]:d},[]);return s1(t,s,f,r==null?void 0:r.class,r==null?void 0:r.className)},Zb="-",zI=t=>{const e=qI(t),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=t;return{getClassGroupId:s=>{const l=s.split(Zb);return l[0]===""&&l.length!==1&&l.shift(),lC(l,e)||BI(s)},getConflictingClassGroupIds:(s,l)=>{const f=r[s]||[];return l&&n[s]?[...f,...n[s]]:f}}},lC=(t,e)=>{var s;if(t.length===0)return e.classGroupId;const r=t[0],n=e.nextPart.get(r),i=n?lC(t.slice(1),n):void 0;if(i)return i;if(e.validators.length===0)return;const o=t.join(Zb);return(s=e.validators.find(({validator:l})=>l(o)))==null?void 0:s.classGroupId},l1=/^\[(.+)\]$/,BI=t=>{if(l1.test(t)){const e=l1.exec(t)[1],r=e==null?void 0:e.substring(0,e.indexOf(":"));if(r)return"arbitrary.."+r}},qI=t=>{const{theme:e,prefix:r}=t,n={nextPart:new Map,validators:[]};return UI(Object.entries(t.classGroups),r).forEach(([o,s])=>{xg(s,n,o,e)}),n},xg=(t,e,r,n)=>{t.forEach(i=>{if(typeof i=="string"){const o=i===""?e:c1(e,i);o.classGroupId=r;return}if(typeof i=="function"){if(FI(i)){xg(i(n),e,r,n);return}e.validators.push({validator:i,classGroupId:r});return}Object.entries(i).forEach(([o,s])=>{xg(s,c1(e,o),r,n)})})},c1=(t,e)=>{let r=t;return e.split(Zb).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},FI=t=>t.isThemeGetter,UI=(t,e)=>e?t.map(([r,n])=>{const i=n.map(o=>typeof o=="string"?e+o:typeof o=="object"?Object.fromEntries(Object.entries(o).map(([s,l])=>[e+s,l])):o);return[r,i]}):t,WI=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,r=new Map,n=new Map;const i=(o,s)=>{r.set(o,s),e++,e>t&&(e=0,n=r,r=new Map)};return{get(o){let s=r.get(o);if(s!==void 0)return s;if((s=n.get(o))!==void 0)return i(o,s),s},set(o,s){r.has(o)?r.set(o,s):i(o,s)}}},cC="!",VI=t=>{const{separator:e,experimentalParseClassName:r}=t,n=e.length===1,i=e[0],o=e.length,s=l=>{const f=[];let d=0,h=0,m;for(let x=0;xh?m-h:void 0;return{modifiers:f,hasImportantModifier:g,baseClassName:_,maybePostfixModifierPosition:w}};return r?l=>r({className:l,parseClassName:s}):s},HI=t=>{if(t.length<=1)return t;const e=[];let r=[];return t.forEach(n=>{n[0]==="["?(e.push(...r.sort(),n),r=[]):r.push(n)}),e.push(...r.sort()),e},GI=t=>({cache:WI(t.cacheSize),parseClassName:VI(t),...zI(t)}),KI=/\s+/,ZI=(t,e)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:i}=e,o=[],s=t.trim().split(KI);let l="";for(let f=s.length-1;f>=0;f-=1){const d=s[f],{modifiers:h,hasImportantModifier:m,baseClassName:v,maybePostfixModifierPosition:g}=r(d);let _=!!g,w=n(_?v.substring(0,g):v);if(!w){if(!_){l=d+(l.length>0?" "+l:l);continue}if(w=n(v),!w){l=d+(l.length>0?" "+l:l);continue}_=!1}const x=HI(h).join(":"),O=m?x+cC:x,P=O+w;if(o.includes(P))continue;o.push(P);const A=i(w,_);for(let C=0;C0?" "+l:l)}return l};function XI(){let t=0,e,r,n="";for(;t{if(typeof t=="string")return t;let e,r="";for(let n=0;nm(h),t());return r=GI(d),n=r.cache.get,i=r.cache.set,o=l,l(f)}function l(f){const d=n(f);if(d)return d;const h=ZI(f,r);return i(f,h),h}return function(){return o(XI.apply(null,arguments))}}const it=t=>{const e=r=>r[t]||[];return e.isThemeGetter=!0,e},dC=/^\[(?:([a-z-]+):)?(.+)\]$/i,QI=/^\d+\/\d+$/,JI=new Set(["px","full","screen"]),eR=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,tR=/\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$/,rR=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,nR=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,iR=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,kn=t=>Va(t)||JI.has(t)||QI.test(t),pi=t=>To(t,"length",dR),Va=t=>!!t&&!Number.isNaN(Number(t)),vh=t=>To(t,"number",Va),Au=t=>!!t&&Number.isInteger(Number(t)),aR=t=>t.endsWith("%")&&Va(t.slice(0,-1)),Ie=t=>dC.test(t),hi=t=>eR.test(t),oR=new Set(["length","size","percentage"]),uR=t=>To(t,oR,pC),sR=t=>To(t,"position",pC),lR=new Set(["image","url"]),cR=t=>To(t,lR,hR),fR=t=>To(t,"",pR),Eu=()=>!0,To=(t,e,r)=>{const n=dC.exec(t);return n?n[1]?typeof e=="string"?n[1]===e:e.has(n[1]):r(n[2]):!1},dR=t=>tR.test(t)&&!rR.test(t),pC=()=>!1,pR=t=>nR.test(t),hR=t=>iR.test(t),mR=()=>{const t=it("colors"),e=it("spacing"),r=it("blur"),n=it("brightness"),i=it("borderColor"),o=it("borderRadius"),s=it("borderSpacing"),l=it("borderWidth"),f=it("contrast"),d=it("grayscale"),h=it("hueRotate"),m=it("invert"),v=it("gap"),g=it("gradientColorStops"),_=it("gradientColorStopPositions"),w=it("inset"),x=it("margin"),O=it("opacity"),P=it("padding"),A=it("saturate"),C=it("scale"),S=it("sepia"),E=it("skew"),k=it("space"),N=it("translate"),I=()=>["auto","contain","none"],U=()=>["auto","hidden","clip","visible","scroll"],$=()=>["auto",Ie,e],B=()=>[Ie,e],V=()=>["",kn,pi],X=()=>["auto",Va,Ie],Z=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],Y=()=>["solid","dashed","dotted","double","none"],te=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],H=()=>["start","end","center","between","around","evenly","stretch"],Q=()=>["","0",Ie],ee=()=>["auto","avoid","all","avoid-page","page","left","right","column"],M=()=>[Va,Ie];return{cacheSize:500,separator:":",theme:{colors:[Eu],spacing:[kn,pi],blur:["none","",hi,Ie],brightness:M(),borderColor:[t],borderRadius:["none","","full",hi,Ie],borderSpacing:B(),borderWidth:V(),contrast:M(),grayscale:Q(),hueRotate:M(),invert:Q(),gap:B(),gradientColorStops:[t],gradientColorStopPositions:[aR,pi],inset:$(),margin:$(),opacity:M(),padding:B(),saturate:M(),scale:M(),sepia:Q(),skew:M(),space:B(),translate:B()},classGroups:{aspect:[{aspect:["auto","square","video",Ie]}],container:["container"],columns:[{columns:[hi]}],"break-after":[{"break-after":ee()}],"break-before":[{"break-before":ee()}],"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"],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:[...Z(),Ie]}],overflow:[{overflow:U()}],"overflow-x":[{"overflow-x":U()}],"overflow-y":[{"overflow-y":U()}],overscroll:[{overscroll:I()}],"overscroll-x":[{"overscroll-x":I()}],"overscroll-y":[{"overscroll-y":I()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[w]}],"inset-x":[{"inset-x":[w]}],"inset-y":[{"inset-y":[w]}],start:[{start:[w]}],end:[{end:[w]}],top:[{top:[w]}],right:[{right:[w]}],bottom:[{bottom:[w]}],left:[{left:[w]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Au,Ie]}],basis:[{basis:$()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Ie]}],grow:[{grow:Q()}],shrink:[{shrink:Q()}],order:[{order:["first","last","none",Au,Ie]}],"grid-cols":[{"grid-cols":[Eu]}],"col-start-end":[{col:["auto",{span:["full",Au,Ie]},Ie]}],"col-start":[{"col-start":X()}],"col-end":[{"col-end":X()}],"grid-rows":[{"grid-rows":[Eu]}],"row-start-end":[{row:["auto",{span:[Au,Ie]},Ie]}],"row-start":[{"row-start":X()}],"row-end":[{"row-end":X()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Ie]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Ie]}],gap:[{gap:[v]}],"gap-x":[{"gap-x":[v]}],"gap-y":[{"gap-y":[v]}],"justify-content":[{justify:["normal",...H()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...H(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...H(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[P]}],px:[{px:[P]}],py:[{py:[P]}],ps:[{ps:[P]}],pe:[{pe:[P]}],pt:[{pt:[P]}],pr:[{pr:[P]}],pb:[{pb:[P]}],pl:[{pl:[P]}],m:[{m:[x]}],mx:[{mx:[x]}],my:[{my:[x]}],ms:[{ms:[x]}],me:[{me:[x]}],mt:[{mt:[x]}],mr:[{mr:[x]}],mb:[{mb:[x]}],ml:[{ml:[x]}],"space-x":[{"space-x":[k]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[k]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Ie,e]}],"min-w":[{"min-w":[Ie,e,"min","max","fit"]}],"max-w":[{"max-w":[Ie,e,"none","full","min","max","fit","prose",{screen:[hi]},hi]}],h:[{h:[Ie,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Ie,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Ie,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Ie,e,"auto","min","max","fit"]}],"font-size":[{text:["base",hi,pi]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",vh]}],"font-family":[{font:[Eu]}],"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:["tighter","tight","normal","wide","wider","widest",Ie]}],"line-clamp":[{"line-clamp":["none",Va,vh]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",kn,Ie]}],"list-image":[{"list-image":["none",Ie]}],"list-style-type":[{list:["none","disc","decimal",Ie]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[O]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[O]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Y(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",kn,pi]}],"underline-offset":[{"underline-offset":["auto",kn,Ie]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:B()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ie]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ie]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[O]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...Z(),sR]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",uR]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},cR]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[_]}],"gradient-via-pos":[{via:[_]}],"gradient-to-pos":[{to:[_]}],"gradient-from":[{from:[g]}],"gradient-via":[{via:[g]}],"gradient-to":[{to:[g]}],rounded:[{rounded:[o]}],"rounded-s":[{"rounded-s":[o]}],"rounded-e":[{"rounded-e":[o]}],"rounded-t":[{"rounded-t":[o]}],"rounded-r":[{"rounded-r":[o]}],"rounded-b":[{"rounded-b":[o]}],"rounded-l":[{"rounded-l":[o]}],"rounded-ss":[{"rounded-ss":[o]}],"rounded-se":[{"rounded-se":[o]}],"rounded-ee":[{"rounded-ee":[o]}],"rounded-es":[{"rounded-es":[o]}],"rounded-tl":[{"rounded-tl":[o]}],"rounded-tr":[{"rounded-tr":[o]}],"rounded-br":[{"rounded-br":[o]}],"rounded-bl":[{"rounded-bl":[o]}],"border-w":[{border:[l]}],"border-w-x":[{"border-x":[l]}],"border-w-y":[{"border-y":[l]}],"border-w-s":[{"border-s":[l]}],"border-w-e":[{"border-e":[l]}],"border-w-t":[{"border-t":[l]}],"border-w-r":[{"border-r":[l]}],"border-w-b":[{"border-b":[l]}],"border-w-l":[{"border-l":[l]}],"border-opacity":[{"border-opacity":[O]}],"border-style":[{border:[...Y(),"hidden"]}],"divide-x":[{"divide-x":[l]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[l]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[O]}],"divide-style":[{divide:Y()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...Y()]}],"outline-offset":[{"outline-offset":[kn,Ie]}],"outline-w":[{outline:[kn,pi]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:V()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[O]}],"ring-offset-w":[{"ring-offset":[kn,pi]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",hi,fR]}],"shadow-color":[{shadow:[Eu]}],opacity:[{opacity:[O]}],"mix-blend":[{"mix-blend":[...te(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":te()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[n]}],contrast:[{contrast:[f]}],"drop-shadow":[{"drop-shadow":["","none",hi,Ie]}],grayscale:[{grayscale:[d]}],"hue-rotate":[{"hue-rotate":[h]}],invert:[{invert:[m]}],saturate:[{saturate:[A]}],sepia:[{sepia:[S]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[f]}],"backdrop-grayscale":[{"backdrop-grayscale":[d]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[h]}],"backdrop-invert":[{"backdrop-invert":[m]}],"backdrop-opacity":[{"backdrop-opacity":[O]}],"backdrop-saturate":[{"backdrop-saturate":[A]}],"backdrop-sepia":[{"backdrop-sepia":[S]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[s]}],"border-spacing-x":[{"border-spacing-x":[s]}],"border-spacing-y":[{"border-spacing-y":[s]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Ie]}],duration:[{duration:M()}],ease:[{ease:["linear","in","out","in-out",Ie]}],delay:[{delay:M()}],animate:[{animate:["none","spin","ping","pulse","bounce",Ie]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[C]}],"scale-x":[{"scale-x":[C]}],"scale-y":[{"scale-y":[C]}],rotate:[{rotate:[Au,Ie]}],"translate-x":[{"translate-x":[N]}],"translate-y":[{"translate-y":[N]}],"skew-x":[{"skew-x":[E]}],"skew-y":[{"skew-y":[E]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Ie]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],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",Ie]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":B()}],"scroll-mx":[{"scroll-mx":B()}],"scroll-my":[{"scroll-my":B()}],"scroll-ms":[{"scroll-ms":B()}],"scroll-me":[{"scroll-me":B()}],"scroll-mt":[{"scroll-mt":B()}],"scroll-mr":[{"scroll-mr":B()}],"scroll-mb":[{"scroll-mb":B()}],"scroll-ml":[{"scroll-ml":B()}],"scroll-p":[{"scroll-p":B()}],"scroll-px":[{"scroll-px":B()}],"scroll-py":[{"scroll-py":B()}],"scroll-ps":[{"scroll-ps":B()}],"scroll-pe":[{"scroll-pe":B()}],"scroll-pt":[{"scroll-pt":B()}],"scroll-pr":[{"scroll-pr":B()}],"scroll-pb":[{"scroll-pb":B()}],"scroll-pl":[{"scroll-pl":B()}],"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",Ie]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[kn,pi,vh]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"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-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-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"],"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"]}}},vR=YI(mR);function yr(...t){return vR(Be(t))}const yR=sC("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),Ya=R.forwardRef(({className:t,variant:e,size:r,asChild:n=!1,...i},o)=>{const s=n?Xu:"button";return D.jsx(s,{className:yr(yR({variant:e,size:r,className:t})),ref:o,...i})});Ya.displayName="Button";var Fe;(function(t){t.assertEqual=i=>i;function e(i){}t.assertIs=e;function r(i){throw new Error}t.assertNever=r,t.arrayToEnum=i=>{const o={};for(const s of i)o[s]=s;return o},t.getValidEnumValues=i=>{const o=t.objectKeys(i).filter(l=>typeof i[i[l]]!="number"),s={};for(const l of o)s[l]=i[l];return t.objectValues(s)},t.objectValues=i=>t.objectKeys(i).map(function(o){return i[o]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const o=[];for(const s in i)Object.prototype.hasOwnProperty.call(i,s)&&o.push(s);return o},t.find=(i,o)=>{for(const s of i)if(o(s))return s},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function n(i,o=" | "){return i.map(s=>typeof s=="string"?`'${s}'`:s).join(o)}t.joinValues=n,t.jsonStringifyReplacer=(i,o)=>typeof o=="bigint"?o.toString():o})(Fe||(Fe={}));var wg;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(wg||(wg={}));const pe=Fe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Mn=t=>{switch(typeof t){case"undefined":return pe.undefined;case"string":return pe.string;case"number":return isNaN(t)?pe.nan:pe.number;case"boolean":return pe.boolean;case"function":return pe.function;case"bigint":return pe.bigint;case"symbol":return pe.symbol;case"object":return Array.isArray(t)?pe.array:t===null?pe.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?pe.promise:typeof Map<"u"&&t instanceof Map?pe.map:typeof Set<"u"&&t instanceof Set?pe.set:typeof Date<"u"&&t instanceof Date?pe.date:pe.object;default:return pe.unknown}},ue=Fe.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),gR=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");class vr extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){const r=e||function(o){return o.message},n={_errors:[]},i=o=>{for(const s of o.issues)if(s.code==="invalid_union")s.unionErrors.map(i);else if(s.code==="invalid_return_type")i(s.returnTypeError);else if(s.code==="invalid_arguments")i(s.argumentsError);else if(s.path.length===0)n._errors.push(r(s));else{let l=n,f=0;for(;fr.message){const r={},n=[];for(const i of this.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(e(i))):n.push(e(i));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}}vr.create=t=>new vr(t);const Qa=(t,e)=>{let r;switch(t.code){case ue.invalid_type:t.received===pe.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case ue.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,Fe.jsonStringifyReplacer)}`;break;case ue.unrecognized_keys:r=`Unrecognized key(s) in object: ${Fe.joinValues(t.keys,", ")}`;break;case ue.invalid_union:r="Invalid input";break;case ue.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Fe.joinValues(t.options)}`;break;case ue.invalid_enum_value:r=`Invalid enum value. Expected ${Fe.joinValues(t.options)}, received '${t.received}'`;break;case ue.invalid_arguments:r="Invalid function arguments";break;case ue.invalid_return_type:r="Invalid function return type";break;case ue.invalid_date:r="Invalid date";break;case ue.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:Fe.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case ue.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case ue.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case ue.custom:r="Invalid input";break;case ue.invalid_intersection_types:r="Intersection results could not be merged";break;case ue.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case ue.not_finite:r="Number must be finite";break;default:r=e.defaultError,Fe.assertNever(t)}return{message:r}};let hC=Qa;function bR(t){hC=t}function Tc(){return hC}const Cc=t=>{const{data:e,path:r,errorMaps:n,issueData:i}=t,o=[...r,...i.path||[]],s={...i,path:o};if(i.message!==void 0)return{...i,path:o,message:i.message};let l="";const f=n.filter(d=>!!d).slice().reverse();for(const d of f)l=d(s,{data:e,defaultError:l}).message;return{...i,path:o,message:l}},xR=[];function fe(t,e){const r=Tc(),n=Cc({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===Qa?void 0:Qa].filter(i=>!!i)});t.common.issues.push(n)}class Vt{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){const n=[];for(const i of r){if(i.status==="aborted")return Ee;i.status==="dirty"&&e.dirty(),n.push(i.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){const n=[];for(const i of r){const o=await i.key,s=await i.value;n.push({key:o,value:s})}return Vt.mergeObjectSync(e,n)}static mergeObjectSync(e,r){const n={};for(const i of r){const{key:o,value:s}=i;if(o.status==="aborted"||s.status==="aborted")return Ee;o.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),o.value!=="__proto__"&&(typeof s.value<"u"||i.alwaysSet)&&(n[o.value]=s.value)}return{status:e.value,value:n}}}const Ee=Object.freeze({status:"aborted"}),qa=t=>({status:"dirty",value:t}),Yt=t=>({status:"valid",value:t}),_g=t=>t.status==="aborted",Sg=t=>t.status==="dirty",Ji=t=>t.status==="valid",Yu=t=>typeof Promise<"u"&&t instanceof Promise;function kc(t,e,r,n){if(typeof e=="function"?t!==e||!0:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(t)}function mC(t,e,r,n,i){if(typeof e=="function"?t!==e||!0:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(t,r),r}var xe;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(xe||(xe={}));var Du,Lu;class vn{constructor(e,r,n,i){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=i}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const f1=(t,e)=>{if(Ji(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const r=new vr(t.common.issues);return this._error=r,this._error}}};function Me(t){if(!t)return{};const{errorMap:e,invalid_type_error:r,required_error:n,description:i}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(s,l)=>{var f,d;const{message:h}=t;return s.code==="invalid_enum_value"?{message:h??l.defaultError}:typeof l.data>"u"?{message:(f=h??n)!==null&&f!==void 0?f:l.defaultError}:s.code!=="invalid_type"?{message:l.defaultError}:{message:(d=h??r)!==null&&d!==void 0?d:l.defaultError}},description:i}}class $e{get description(){return this._def.description}_getType(e){return Mn(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Mn(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Vt,ctx:{common:e.parent.common,data:e.data,parsedType:Mn(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const r=this._parse(e);if(Yu(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){const r=this._parse(e);return Promise.resolve(r)}parse(e,r){const n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){var n;const i={common:{issues:[],async:(n=r==null?void 0:r.async)!==null&&n!==void 0?n:!1,contextualErrorMap:r==null?void 0:r.errorMap},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Mn(e)},o=this._parseSync({data:e,path:i.path,parent:i});return f1(i,o)}"~validate"(e){var r,n;const i={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Mn(e)};if(!this["~standard"].async)try{const o=this._parseSync({data:e,path:[],parent:i});return Ji(o)?{value:o.value}:{issues:i.common.issues}}catch(o){!((n=(r=o==null?void 0:o.message)===null||r===void 0?void 0:r.toLowerCase())===null||n===void 0)&&n.includes("encountered")&&(this["~standard"].async=!0),i.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:i}).then(o=>Ji(o)?{value:o.value}:{issues:i.common.issues})}async parseAsync(e,r){const n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){const n={common:{issues:[],contextualErrorMap:r==null?void 0:r.errorMap,async:!0},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Mn(e)},i=this._parse({data:e,path:n.path,parent:n}),o=await(Yu(i)?i:Promise.resolve(i));return f1(n,o)}refine(e,r){const n=i=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(i):r;return this._refinement((i,o)=>{const s=e(i),l=()=>o.addIssue({code:ue.custom,...n(i)});return typeof Promise<"u"&&s instanceof Promise?s.then(f=>f?!0:(l(),!1)):s?!0:(l(),!1)})}refinement(e,r){return this._refinement((n,i)=>e(n)?!0:(i.addIssue(typeof r=="function"?r(n,i):r),!1))}_refinement(e){return new Zr({schema:this,typeName:Ae.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return fn.create(this,this._def)}nullable(){return Si.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Kr.create(this)}promise(){return eo.create(this,this._def)}or(e){return ts.create([this,e],this._def)}and(e){return rs.create(this,e,this._def)}transform(e){return new Zr({...Me(this._def),schema:this,typeName:Ae.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const r=typeof e=="function"?e:()=>e;return new us({...Me(this._def),innerType:this,defaultValue:r,typeName:Ae.ZodDefault})}brand(){return new Xb({typeName:Ae.ZodBranded,type:this,...Me(this._def)})}catch(e){const r=typeof e=="function"?e:()=>e;return new ss({...Me(this._def),innerType:this,catchValue:r,typeName:Ae.ZodCatch})}describe(e){const r=this.constructor;return new r({...this._def,description:e})}pipe(e){return Hs.create(this,e)}readonly(){return ls.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const wR=/^c[^\s-]{8,}$/i,_R=/^[0-9a-z]+$/,SR=/^[0-9A-HJKMNP-TV-Z]{26}$/i,OR=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,PR=/^[a-z0-9_-]{21}$/i,AR=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,ER=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,TR=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,CR="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let yh;const kR=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,jR=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,NR=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,MR=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,IR=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,RR=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,vC="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",$R=new RegExp(`^${vC}$`);function yC(t){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`),e}function DR(t){return new RegExp(`^${yC(t)}$`)}function gC(t){let e=`${vC}T${yC(t)}`;const r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function LR(t,e){return!!((e==="v4"||!e)&&kR.test(t)||(e==="v6"||!e)&&NR.test(t))}function zR(t,e){if(!AR.test(t))return!1;try{const[r]=t.split("."),n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(n));return!(typeof i!="object"||i===null||!i.typ||!i.alg||e&&i.alg!==e)}catch{return!1}}function BR(t,e){return!!((e==="v4"||!e)&&jR.test(t)||(e==="v6"||!e)&&MR.test(t))}class Hr extends $e{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==pe.string){const o=this._getOrReturnCtx(e);return fe(o,{code:ue.invalid_type,expected:pe.string,received:o.parsedType}),Ee}const n=new Vt;let i;for(const o of this._def.checks)if(o.kind==="min")e.data.lengtho.value&&(i=this._getOrReturnCtx(e,i),fe(i,{code:ue.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="length"){const s=e.data.length>o.value,l=e.data.lengthe.test(i),{validation:r,code:ue.invalid_string,...xe.errToObj(n)})}_addCheck(e){return new Hr({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...xe.errToObj(e)})}url(e){return this._addCheck({kind:"url",...xe.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...xe.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...xe.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...xe.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...xe.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...xe.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...xe.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...xe.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...xe.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...xe.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...xe.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...xe.errToObj(e)})}datetime(e){var r,n;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(r=e==null?void 0:e.offset)!==null&&r!==void 0?r:!1,local:(n=e==null?void 0:e.local)!==null&&n!==void 0?n:!1,...xe.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...xe.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...xe.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...xe.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r==null?void 0:r.position,...xe.errToObj(r==null?void 0:r.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...xe.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...xe.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...xe.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...xe.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...xe.errToObj(r)})}nonempty(e){return this.min(1,xe.errToObj(e))}trim(){return new Hr({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Hr({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Hr({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value{var e;return new Hr({checks:[],typeName:Ae.ZodString,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...Me(t)})};function qR(t,e){const r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,i=r>n?r:n,o=parseInt(t.toFixed(i).replace(".","")),s=parseInt(e.toFixed(i).replace(".",""));return o%s/Math.pow(10,i)}class xi extends $e{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==pe.number){const o=this._getOrReturnCtx(e);return fe(o,{code:ue.invalid_type,expected:pe.number,received:o.parsedType}),Ee}let n;const i=new Vt;for(const o of this._def.checks)o.kind==="int"?Fe.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),fe(n,{code:ue.invalid_type,expected:"integer",received:"float",message:o.message}),i.dirty()):o.kind==="min"?(o.inclusive?e.datao.value:e.data>=o.value)&&(n=this._getOrReturnCtx(e,n),fe(n,{code:ue.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="multipleOf"?qR(e.data,o.value)!==0&&(n=this._getOrReturnCtx(e,n),fe(n,{code:ue.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):o.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),fe(n,{code:ue.not_finite,message:o.message}),i.dirty()):Fe.assertNever(o);return{status:i.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,xe.toString(r))}gt(e,r){return this.setLimit("min",e,!1,xe.toString(r))}lte(e,r){return this.setLimit("max",e,!0,xe.toString(r))}lt(e,r){return this.setLimit("max",e,!1,xe.toString(r))}setLimit(e,r,n,i){return new xi({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:xe.toString(i)}]})}_addCheck(e){return new xi({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:xe.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:xe.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:xe.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:xe.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:xe.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:xe.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:xe.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:xe.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:xe.toString(e)})}get minValue(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.valuee.kind==="int"||e.kind==="multipleOf"&&Fe.isInteger(e.value))}get isFinite(){let e=null,r=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.valuenew xi({checks:[],typeName:Ae.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...Me(t)});class wi extends $e{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==pe.bigint)return this._getInvalidInput(e);let n;const i=new Vt;for(const o of this._def.checks)o.kind==="min"?(o.inclusive?e.datao.value:e.data>=o.value)&&(n=this._getOrReturnCtx(e,n),fe(n,{code:ue.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="multipleOf"?e.data%o.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),fe(n,{code:ue.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):Fe.assertNever(o);return{status:i.value,value:e.data}}_getInvalidInput(e){const r=this._getOrReturnCtx(e);return fe(r,{code:ue.invalid_type,expected:pe.bigint,received:r.parsedType}),Ee}gte(e,r){return this.setLimit("min",e,!0,xe.toString(r))}gt(e,r){return this.setLimit("min",e,!1,xe.toString(r))}lte(e,r){return this.setLimit("max",e,!0,xe.toString(r))}lt(e,r){return this.setLimit("max",e,!1,xe.toString(r))}setLimit(e,r,n,i){return new wi({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:xe.toString(i)}]})}_addCheck(e){return new wi({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:xe.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:xe.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:xe.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:xe.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:xe.toString(r)})}get minValue(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value{var e;return new wi({checks:[],typeName:Ae.ZodBigInt,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...Me(t)})};class Qu extends $e{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==pe.boolean){const n=this._getOrReturnCtx(e);return fe(n,{code:ue.invalid_type,expected:pe.boolean,received:n.parsedType}),Ee}return Yt(e.data)}}Qu.create=t=>new Qu({typeName:Ae.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...Me(t)});class ea extends $e{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==pe.date){const o=this._getOrReturnCtx(e);return fe(o,{code:ue.invalid_type,expected:pe.date,received:o.parsedType}),Ee}if(isNaN(e.data.getTime())){const o=this._getOrReturnCtx(e);return fe(o,{code:ue.invalid_date}),Ee}const n=new Vt;let i;for(const o of this._def.checks)o.kind==="min"?e.data.getTime()o.value&&(i=this._getOrReturnCtx(e,i),fe(i,{code:ue.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),n.dirty()):Fe.assertNever(o);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new ea({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:xe.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:xe.toString(r)})}get minDate(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.valuenew ea({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:Ae.ZodDate,...Me(t)});class jc extends $e{_parse(e){if(this._getType(e)!==pe.symbol){const n=this._getOrReturnCtx(e);return fe(n,{code:ue.invalid_type,expected:pe.symbol,received:n.parsedType}),Ee}return Yt(e.data)}}jc.create=t=>new jc({typeName:Ae.ZodSymbol,...Me(t)});class Ju extends $e{_parse(e){if(this._getType(e)!==pe.undefined){const n=this._getOrReturnCtx(e);return fe(n,{code:ue.invalid_type,expected:pe.undefined,received:n.parsedType}),Ee}return Yt(e.data)}}Ju.create=t=>new Ju({typeName:Ae.ZodUndefined,...Me(t)});class es extends $e{_parse(e){if(this._getType(e)!==pe.null){const n=this._getOrReturnCtx(e);return fe(n,{code:ue.invalid_type,expected:pe.null,received:n.parsedType}),Ee}return Yt(e.data)}}es.create=t=>new es({typeName:Ae.ZodNull,...Me(t)});class Ja extends $e{constructor(){super(...arguments),this._any=!0}_parse(e){return Yt(e.data)}}Ja.create=t=>new Ja({typeName:Ae.ZodAny,...Me(t)});class Xi extends $e{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Yt(e.data)}}Xi.create=t=>new Xi({typeName:Ae.ZodUnknown,...Me(t)});class qn extends $e{_parse(e){const r=this._getOrReturnCtx(e);return fe(r,{code:ue.invalid_type,expected:pe.never,received:r.parsedType}),Ee}}qn.create=t=>new qn({typeName:Ae.ZodNever,...Me(t)});class Nc extends $e{_parse(e){if(this._getType(e)!==pe.undefined){const n=this._getOrReturnCtx(e);return fe(n,{code:ue.invalid_type,expected:pe.void,received:n.parsedType}),Ee}return Yt(e.data)}}Nc.create=t=>new Nc({typeName:Ae.ZodVoid,...Me(t)});class Kr extends $e{_parse(e){const{ctx:r,status:n}=this._processInputParams(e),i=this._def;if(r.parsedType!==pe.array)return fe(r,{code:ue.invalid_type,expected:pe.array,received:r.parsedType}),Ee;if(i.exactLength!==null){const s=r.data.length>i.exactLength.value,l=r.data.lengthi.maxLength.value&&(fe(r,{code:ue.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((s,l)=>i.type._parseAsync(new vn(r,s,r.path,l)))).then(s=>Vt.mergeArray(n,s));const o=[...r.data].map((s,l)=>i.type._parseSync(new vn(r,s,r.path,l)));return Vt.mergeArray(n,o)}get element(){return this._def.type}min(e,r){return new Kr({...this._def,minLength:{value:e,message:xe.toString(r)}})}max(e,r){return new Kr({...this._def,maxLength:{value:e,message:xe.toString(r)}})}length(e,r){return new Kr({...this._def,exactLength:{value:e,message:xe.toString(r)}})}nonempty(e){return this.min(1,e)}}Kr.create=(t,e)=>new Kr({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Ae.ZodArray,...Me(e)});function Ba(t){if(t instanceof ct){const e={};for(const r in t.shape){const n=t.shape[r];e[r]=fn.create(Ba(n))}return new ct({...t._def,shape:()=>e})}else return t instanceof Kr?new Kr({...t._def,type:Ba(t.element)}):t instanceof fn?fn.create(Ba(t.unwrap())):t instanceof Si?Si.create(Ba(t.unwrap())):t instanceof yn?yn.create(t.items.map(e=>Ba(e))):t}class ct extends $e{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),r=Fe.objectKeys(e);return this._cached={shape:e,keys:r}}_parse(e){if(this._getType(e)!==pe.object){const d=this._getOrReturnCtx(e);return fe(d,{code:ue.invalid_type,expected:pe.object,received:d.parsedType}),Ee}const{status:n,ctx:i}=this._processInputParams(e),{shape:o,keys:s}=this._getCached(),l=[];if(!(this._def.catchall instanceof qn&&this._def.unknownKeys==="strip"))for(const d in i.data)s.includes(d)||l.push(d);const f=[];for(const d of s){const h=o[d],m=i.data[d];f.push({key:{status:"valid",value:d},value:h._parse(new vn(i,m,i.path,d)),alwaysSet:d in i.data})}if(this._def.catchall instanceof qn){const d=this._def.unknownKeys;if(d==="passthrough")for(const h of l)f.push({key:{status:"valid",value:h},value:{status:"valid",value:i.data[h]}});else if(d==="strict")l.length>0&&(fe(i,{code:ue.unrecognized_keys,keys:l}),n.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const d=this._def.catchall;for(const h of l){const m=i.data[h];f.push({key:{status:"valid",value:h},value:d._parse(new vn(i,m,i.path,h)),alwaysSet:h in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const d=[];for(const h of f){const m=await h.key,v=await h.value;d.push({key:m,value:v,alwaysSet:h.alwaysSet})}return d}).then(d=>Vt.mergeObjectSync(n,d)):Vt.mergeObjectSync(n,f)}get shape(){return this._def.shape()}strict(e){return xe.errToObj,new ct({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{var i,o,s,l;const f=(s=(o=(i=this._def).errorMap)===null||o===void 0?void 0:o.call(i,r,n).message)!==null&&s!==void 0?s:n.defaultError;return r.code==="unrecognized_keys"?{message:(l=xe.errToObj(e).message)!==null&&l!==void 0?l:f}:{message:f}}}:{}})}strip(){return new ct({...this._def,unknownKeys:"strip"})}passthrough(){return new ct({...this._def,unknownKeys:"passthrough"})}extend(e){return new ct({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new ct({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Ae.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new ct({...this._def,catchall:e})}pick(e){const r={};return Fe.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(r[n]=this.shape[n])}),new ct({...this._def,shape:()=>r})}omit(e){const r={};return Fe.objectKeys(this.shape).forEach(n=>{e[n]||(r[n]=this.shape[n])}),new ct({...this._def,shape:()=>r})}deepPartial(){return Ba(this)}partial(e){const r={};return Fe.objectKeys(this.shape).forEach(n=>{const i=this.shape[n];e&&!e[n]?r[n]=i:r[n]=i.optional()}),new ct({...this._def,shape:()=>r})}required(e){const r={};return Fe.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])r[n]=this.shape[n];else{let o=this.shape[n];for(;o instanceof fn;)o=o._def.innerType;r[n]=o}}),new ct({...this._def,shape:()=>r})}keyof(){return bC(Fe.objectKeys(this.shape))}}ct.create=(t,e)=>new ct({shape:()=>t,unknownKeys:"strip",catchall:qn.create(),typeName:Ae.ZodObject,...Me(e)});ct.strictCreate=(t,e)=>new ct({shape:()=>t,unknownKeys:"strict",catchall:qn.create(),typeName:Ae.ZodObject,...Me(e)});ct.lazycreate=(t,e)=>new ct({shape:t,unknownKeys:"strip",catchall:qn.create(),typeName:Ae.ZodObject,...Me(e)});class ts extends $e{_parse(e){const{ctx:r}=this._processInputParams(e),n=this._def.options;function i(o){for(const l of o)if(l.result.status==="valid")return l.result;for(const l of o)if(l.result.status==="dirty")return r.common.issues.push(...l.ctx.common.issues),l.result;const s=o.map(l=>new vr(l.ctx.common.issues));return fe(r,{code:ue.invalid_union,unionErrors:s}),Ee}if(r.common.async)return Promise.all(n.map(async o=>{const s={...r,common:{...r.common,issues:[]},parent:null};return{result:await o._parseAsync({data:r.data,path:r.path,parent:s}),ctx:s}})).then(i);{let o;const s=[];for(const f of n){const d={...r,common:{...r.common,issues:[]},parent:null},h=f._parseSync({data:r.data,path:r.path,parent:d});if(h.status==="valid")return h;h.status==="dirty"&&!o&&(o={result:h,ctx:d}),d.common.issues.length&&s.push(d.common.issues)}if(o)return r.common.issues.push(...o.ctx.common.issues),o.result;const l=s.map(f=>new vr(f));return fe(r,{code:ue.invalid_union,unionErrors:l}),Ee}}get options(){return this._def.options}}ts.create=(t,e)=>new ts({options:t,typeName:Ae.ZodUnion,...Me(e)});const Nn=t=>t instanceof is?Nn(t.schema):t instanceof Zr?Nn(t.innerType()):t instanceof as?[t.value]:t instanceof _i?t.options:t instanceof os?Fe.objectValues(t.enum):t instanceof us?Nn(t._def.innerType):t instanceof Ju?[void 0]:t instanceof es?[null]:t instanceof fn?[void 0,...Nn(t.unwrap())]:t instanceof Si?[null,...Nn(t.unwrap())]:t instanceof Xb||t instanceof ls?Nn(t.unwrap()):t instanceof ss?Nn(t._def.innerType):[];class Lf extends $e{_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==pe.object)return fe(r,{code:ue.invalid_type,expected:pe.object,received:r.parsedType}),Ee;const n=this.discriminator,i=r.data[n],o=this.optionsMap.get(i);return o?r.common.async?o._parseAsync({data:r.data,path:r.path,parent:r}):o._parseSync({data:r.data,path:r.path,parent:r}):(fe(r,{code:ue.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Ee)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){const i=new Map;for(const o of r){const s=Nn(o.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const l of s){if(i.has(l))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(l)}`);i.set(l,o)}}return new Lf({typeName:Ae.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:i,...Me(n)})}}function Og(t,e){const r=Mn(t),n=Mn(e);if(t===e)return{valid:!0,data:t};if(r===pe.object&&n===pe.object){const i=Fe.objectKeys(e),o=Fe.objectKeys(t).filter(l=>i.indexOf(l)!==-1),s={...t,...e};for(const l of o){const f=Og(t[l],e[l]);if(!f.valid)return{valid:!1};s[l]=f.data}return{valid:!0,data:s}}else if(r===pe.array&&n===pe.array){if(t.length!==e.length)return{valid:!1};const i=[];for(let o=0;o{if(_g(o)||_g(s))return Ee;const l=Og(o.value,s.value);return l.valid?((Sg(o)||Sg(s))&&r.dirty(),{status:r.value,value:l.data}):(fe(n,{code:ue.invalid_intersection_types}),Ee)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([o,s])=>i(o,s)):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}rs.create=(t,e,r)=>new rs({left:t,right:e,typeName:Ae.ZodIntersection,...Me(r)});class yn extends $e{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==pe.array)return fe(n,{code:ue.invalid_type,expected:pe.array,received:n.parsedType}),Ee;if(n.data.lengththis._def.items.length&&(fe(n,{code:ue.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());const o=[...n.data].map((s,l)=>{const f=this._def.items[l]||this._def.rest;return f?f._parse(new vn(n,s,n.path,l)):null}).filter(s=>!!s);return n.common.async?Promise.all(o).then(s=>Vt.mergeArray(r,s)):Vt.mergeArray(r,o)}get items(){return this._def.items}rest(e){return new yn({...this._def,rest:e})}}yn.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new yn({items:t,typeName:Ae.ZodTuple,rest:null,...Me(e)})};class ns extends $e{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==pe.object)return fe(n,{code:ue.invalid_type,expected:pe.object,received:n.parsedType}),Ee;const i=[],o=this._def.keyType,s=this._def.valueType;for(const l in n.data)i.push({key:o._parse(new vn(n,l,n.path,l)),value:s._parse(new vn(n,n.data[l],n.path,l)),alwaysSet:l in n.data});return n.common.async?Vt.mergeObjectAsync(r,i):Vt.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof $e?new ns({keyType:e,valueType:r,typeName:Ae.ZodRecord,...Me(n)}):new ns({keyType:Hr.create(),valueType:e,typeName:Ae.ZodRecord,...Me(r)})}}class Mc extends $e{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==pe.map)return fe(n,{code:ue.invalid_type,expected:pe.map,received:n.parsedType}),Ee;const i=this._def.keyType,o=this._def.valueType,s=[...n.data.entries()].map(([l,f],d)=>({key:i._parse(new vn(n,l,n.path,[d,"key"])),value:o._parse(new vn(n,f,n.path,[d,"value"]))}));if(n.common.async){const l=new Map;return Promise.resolve().then(async()=>{for(const f of s){const d=await f.key,h=await f.value;if(d.status==="aborted"||h.status==="aborted")return Ee;(d.status==="dirty"||h.status==="dirty")&&r.dirty(),l.set(d.value,h.value)}return{status:r.value,value:l}})}else{const l=new Map;for(const f of s){const d=f.key,h=f.value;if(d.status==="aborted"||h.status==="aborted")return Ee;(d.status==="dirty"||h.status==="dirty")&&r.dirty(),l.set(d.value,h.value)}return{status:r.value,value:l}}}}Mc.create=(t,e,r)=>new Mc({valueType:e,keyType:t,typeName:Ae.ZodMap,...Me(r)});class ta extends $e{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==pe.set)return fe(n,{code:ue.invalid_type,expected:pe.set,received:n.parsedType}),Ee;const i=this._def;i.minSize!==null&&n.data.sizei.maxSize.value&&(fe(n,{code:ue.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());const o=this._def.valueType;function s(f){const d=new Set;for(const h of f){if(h.status==="aborted")return Ee;h.status==="dirty"&&r.dirty(),d.add(h.value)}return{status:r.value,value:d}}const l=[...n.data.values()].map((f,d)=>o._parse(new vn(n,f,n.path,d)));return n.common.async?Promise.all(l).then(f=>s(f)):s(l)}min(e,r){return new ta({...this._def,minSize:{value:e,message:xe.toString(r)}})}max(e,r){return new ta({...this._def,maxSize:{value:e,message:xe.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}}ta.create=(t,e)=>new ta({valueType:t,minSize:null,maxSize:null,typeName:Ae.ZodSet,...Me(e)});class Ha extends $e{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==pe.function)return fe(r,{code:ue.invalid_type,expected:pe.function,received:r.parsedType}),Ee;function n(l,f){return Cc({data:l,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Tc(),Qa].filter(d=>!!d),issueData:{code:ue.invalid_arguments,argumentsError:f}})}function i(l,f){return Cc({data:l,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Tc(),Qa].filter(d=>!!d),issueData:{code:ue.invalid_return_type,returnTypeError:f}})}const o={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof eo){const l=this;return Yt(async function(...f){const d=new vr([]),h=await l._def.args.parseAsync(f,o).catch(g=>{throw d.addIssue(n(f,g)),d}),m=await Reflect.apply(s,this,h);return await l._def.returns._def.type.parseAsync(m,o).catch(g=>{throw d.addIssue(i(m,g)),d})})}else{const l=this;return Yt(function(...f){const d=l._def.args.safeParse(f,o);if(!d.success)throw new vr([n(f,d.error)]);const h=Reflect.apply(s,this,d.data),m=l._def.returns.safeParse(h,o);if(!m.success)throw new vr([i(h,m.error)]);return m.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Ha({...this._def,args:yn.create(e).rest(Xi.create())})}returns(e){return new Ha({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new Ha({args:e||yn.create([]).rest(Xi.create()),returns:r||Xi.create(),typeName:Ae.ZodFunction,...Me(n)})}}class is extends $e{get schema(){return this._def.getter()}_parse(e){const{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}}is.create=(t,e)=>new is({getter:t,typeName:Ae.ZodLazy,...Me(e)});class as extends $e{_parse(e){if(e.data!==this._def.value){const r=this._getOrReturnCtx(e);return fe(r,{received:r.data,code:ue.invalid_literal,expected:this._def.value}),Ee}return{status:"valid",value:e.data}}get value(){return this._def.value}}as.create=(t,e)=>new as({value:t,typeName:Ae.ZodLiteral,...Me(e)});function bC(t,e){return new _i({values:t,typeName:Ae.ZodEnum,...Me(e)})}class _i extends $e{constructor(){super(...arguments),Du.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const r=this._getOrReturnCtx(e),n=this._def.values;return fe(r,{expected:Fe.joinValues(n),received:r.parsedType,code:ue.invalid_type}),Ee}if(kc(this,Du)||mC(this,Du,new Set(this._def.values)),!kc(this,Du).has(e.data)){const r=this._getOrReturnCtx(e),n=this._def.values;return fe(r,{received:r.data,code:ue.invalid_enum_value,options:n}),Ee}return Yt(e.data)}get options(){return this._def.values}get enum(){const e={};for(const r of this._def.values)e[r]=r;return e}get Values(){const e={};for(const r of this._def.values)e[r]=r;return e}get Enum(){const e={};for(const r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return _i.create(e,{...this._def,...r})}exclude(e,r=this._def){return _i.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}}Du=new WeakMap;_i.create=bC;class os extends $e{constructor(){super(...arguments),Lu.set(this,void 0)}_parse(e){const r=Fe.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==pe.string&&n.parsedType!==pe.number){const i=Fe.objectValues(r);return fe(n,{expected:Fe.joinValues(i),received:n.parsedType,code:ue.invalid_type}),Ee}if(kc(this,Lu)||mC(this,Lu,new Set(Fe.getValidEnumValues(this._def.values))),!kc(this,Lu).has(e.data)){const i=Fe.objectValues(r);return fe(n,{received:n.data,code:ue.invalid_enum_value,options:i}),Ee}return Yt(e.data)}get enum(){return this._def.values}}Lu=new WeakMap;os.create=(t,e)=>new os({values:t,typeName:Ae.ZodNativeEnum,...Me(e)});class eo extends $e{unwrap(){return this._def.type}_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==pe.promise&&r.common.async===!1)return fe(r,{code:ue.invalid_type,expected:pe.promise,received:r.parsedType}),Ee;const n=r.parsedType===pe.promise?r.data:Promise.resolve(r.data);return Yt(n.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}}eo.create=(t,e)=>new eo({type:t,typeName:Ae.ZodPromise,...Me(e)});class Zr extends $e{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ae.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:r,ctx:n}=this._processInputParams(e),i=this._def.effect||null,o={addIssue:s=>{fe(n,s),s.fatal?r.abort():r.dirty()},get path(){return n.path}};if(o.addIssue=o.addIssue.bind(o),i.type==="preprocess"){const s=i.transform(n.data,o);if(n.common.async)return Promise.resolve(s).then(async l=>{if(r.value==="aborted")return Ee;const f=await this._def.schema._parseAsync({data:l,path:n.path,parent:n});return f.status==="aborted"?Ee:f.status==="dirty"||r.value==="dirty"?qa(f.value):f});{if(r.value==="aborted")return Ee;const l=this._def.schema._parseSync({data:s,path:n.path,parent:n});return l.status==="aborted"?Ee:l.status==="dirty"||r.value==="dirty"?qa(l.value):l}}if(i.type==="refinement"){const s=l=>{const f=i.refinement(l,o);if(n.common.async)return Promise.resolve(f);if(f instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return l};if(n.common.async===!1){const l=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return l.status==="aborted"?Ee:(l.status==="dirty"&&r.dirty(),s(l.value),{status:r.value,value:l.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(l=>l.status==="aborted"?Ee:(l.status==="dirty"&&r.dirty(),s(l.value).then(()=>({status:r.value,value:l.value}))))}if(i.type==="transform")if(n.common.async===!1){const s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Ji(s))return s;const l=i.transform(s.value,o);if(l instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:l}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>Ji(s)?Promise.resolve(i.transform(s.value,o)).then(l=>({status:r.value,value:l})):s);Fe.assertNever(i)}}Zr.create=(t,e,r)=>new Zr({schema:t,typeName:Ae.ZodEffects,effect:e,...Me(r)});Zr.createWithPreprocess=(t,e,r)=>new Zr({schema:e,effect:{type:"preprocess",transform:t},typeName:Ae.ZodEffects,...Me(r)});class fn extends $e{_parse(e){return this._getType(e)===pe.undefined?Yt(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}fn.create=(t,e)=>new fn({innerType:t,typeName:Ae.ZodOptional,...Me(e)});class Si extends $e{_parse(e){return this._getType(e)===pe.null?Yt(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Si.create=(t,e)=>new Si({innerType:t,typeName:Ae.ZodNullable,...Me(e)});class us extends $e{_parse(e){const{ctx:r}=this._processInputParams(e);let n=r.data;return r.parsedType===pe.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}}us.create=(t,e)=>new us({innerType:t,typeName:Ae.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Me(e)});class ss extends $e{_parse(e){const{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Yu(i)?i.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new vr(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new vr(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}ss.create=(t,e)=>new ss({innerType:t,typeName:Ae.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Me(e)});class Ic extends $e{_parse(e){if(this._getType(e)!==pe.nan){const n=this._getOrReturnCtx(e);return fe(n,{code:ue.invalid_type,expected:pe.nan,received:n.parsedType}),Ee}return{status:"valid",value:e.data}}}Ic.create=t=>new Ic({typeName:Ae.ZodNaN,...Me(t)});const FR=Symbol("zod_brand");class Xb extends $e{_parse(e){const{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}}class Hs extends $e{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const o=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?Ee:o.status==="dirty"?(r.dirty(),qa(o.value)):this._def.out._parseAsync({data:o.value,path:n.path,parent:n})})();{const i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?Ee:i.status==="dirty"?(r.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(e,r){return new Hs({in:e,out:r,typeName:Ae.ZodPipeline})}}class ls extends $e{_parse(e){const r=this._def.innerType._parse(e),n=i=>(Ji(i)&&(i.value=Object.freeze(i.value)),i);return Yu(r)?r.then(i=>n(i)):n(r)}unwrap(){return this._def.innerType}}ls.create=(t,e)=>new ls({innerType:t,typeName:Ae.ZodReadonly,...Me(e)});function xC(t,e={},r){return t?Ja.create().superRefine((n,i)=>{var o,s;if(!t(n)){const l=typeof e=="function"?e(n):typeof e=="string"?{message:e}:e,f=(s=(o=l.fatal)!==null&&o!==void 0?o:r)!==null&&s!==void 0?s:!0,d=typeof l=="string"?{message:l}:l;i.addIssue({code:"custom",...d,fatal:f})}}):Ja.create()}const UR={object:ct.lazycreate};var Ae;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(Ae||(Ae={}));const WR=(t,e={message:`Input not instance of ${t.name}`})=>xC(r=>r instanceof t,e),wC=Hr.create,_C=xi.create,VR=Ic.create,HR=wi.create,SC=Qu.create,GR=ea.create,KR=jc.create,ZR=Ju.create,XR=es.create,YR=Ja.create,QR=Xi.create,JR=qn.create,e$=Nc.create,t$=Kr.create,r$=ct.create,n$=ct.strictCreate,i$=ts.create,a$=Lf.create,o$=rs.create,u$=yn.create,s$=ns.create,l$=Mc.create,c$=ta.create,f$=Ha.create,d$=is.create,p$=as.create,h$=_i.create,m$=os.create,v$=eo.create,d1=Zr.create,y$=fn.create,g$=Si.create,b$=Zr.createWithPreprocess,x$=Hs.create,w$=()=>wC().optional(),_$=()=>_C().optional(),S$=()=>SC().optional(),O$={string:t=>Hr.create({...t,coerce:!0}),number:t=>xi.create({...t,coerce:!0}),boolean:t=>Qu.create({...t,coerce:!0}),bigint:t=>wi.create({...t,coerce:!0}),date:t=>ea.create({...t,coerce:!0})},P$=Ee;var bt=Object.freeze({__proto__:null,defaultErrorMap:Qa,setErrorMap:bR,getErrorMap:Tc,makeIssue:Cc,EMPTY_PATH:xR,addIssueToContext:fe,ParseStatus:Vt,INVALID:Ee,DIRTY:qa,OK:Yt,isAborted:_g,isDirty:Sg,isValid:Ji,isAsync:Yu,get util(){return Fe},get objectUtil(){return wg},ZodParsedType:pe,getParsedType:Mn,ZodType:$e,datetimeRegex:gC,ZodString:Hr,ZodNumber:xi,ZodBigInt:wi,ZodBoolean:Qu,ZodDate:ea,ZodSymbol:jc,ZodUndefined:Ju,ZodNull:es,ZodAny:Ja,ZodUnknown:Xi,ZodNever:qn,ZodVoid:Nc,ZodArray:Kr,ZodObject:ct,ZodUnion:ts,ZodDiscriminatedUnion:Lf,ZodIntersection:rs,ZodTuple:yn,ZodRecord:ns,ZodMap:Mc,ZodSet:ta,ZodFunction:Ha,ZodLazy:is,ZodLiteral:as,ZodEnum:_i,ZodNativeEnum:os,ZodPromise:eo,ZodEffects:Zr,ZodTransformer:Zr,ZodOptional:fn,ZodNullable:Si,ZodDefault:us,ZodCatch:ss,ZodNaN:Ic,BRAND:FR,ZodBranded:Xb,ZodPipeline:Hs,ZodReadonly:ls,custom:xC,Schema:$e,ZodSchema:$e,late:UR,get ZodFirstPartyTypeKind(){return Ae},coerce:O$,any:YR,array:t$,bigint:HR,boolean:SC,date:GR,discriminatedUnion:a$,effect:d1,enum:h$,function:f$,instanceof:WR,intersection:o$,lazy:d$,literal:p$,map:l$,nan:VR,nativeEnum:m$,never:JR,null:XR,nullable:g$,number:_C,object:r$,oboolean:S$,onumber:_$,optional:y$,ostring:w$,pipeline:x$,preprocess:b$,promise:v$,record:s$,set:c$,strictObject:n$,string:wC,symbol:KR,transformer:d1,tuple:u$,undefined:ZR,union:i$,unknown:QR,void:e$,NEVER:P$,ZodIssueCode:ue,quotelessJson:gR,ZodError:vr});const pc=bt.object({x:bt.string(),y:bt.number()}),A$=bt.object({id:bt.string(),name:bt.string(),description:bt.string(),chat_ids:bt.array(bt.string()),parent_id:bt.string().nullable(),count:bt.number(),x_coord:bt.number(),y_coord:bt.number(),level:bt.number()}),E$=bt.object({cumulative_words:bt.array(pc),messages_per_chat:bt.array(pc),messages_per_week:bt.array(pc),new_chats_per_week:bt.array(pc),clusters:bt.array(A$)});function T$({onSuccess:t}){const[e,r]=R.useState(!1),[n,i]=R.useState(null),o=l=>{var d;const f=(d=l.target.files)==null?void 0:d[0];if(f){if(f.type!=="application/json"){alert("Please upload a JSON file");return}i(f)}},s=async()=>{if(n){r(!0);try{const l=await n.text(),f=JSON.parse(l),d=await fetch("http://127.0.0.1:8000/api/analyse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({data:f})});if(!d.ok)throw new Error("Upload failed");const h=await d.json(),m=E$.parse(h);t(m)}catch(l){console.error(l),alert("Error uploading file")}finally{r(!1)}}};return D.jsxs("div",{className:"flex gap-2 justify-center my-8",children:[D.jsxs("div",{className:"relative",children:[D.jsx("input",{type:"file",accept:"application/json",onChange:o,className:"absolute inset-0 w-full opacity-0 cursor-pointer",disabled:e}),D.jsxs(Ya,{variant:"outline",size:"sm",className:"text-xs",disabled:e,children:[D.jsx(II,{className:"mr-2 h-3 w-3"}),n?`${n.name}`:"Upload your conversations"]})]}),D.jsx(Ya,{variant:"default",size:"sm",className:"text-xs",disabled:e||!n,onClick:s,children:e?D.jsxs("div",{className:"flex items-center",children:[D.jsxs("svg",{className:"animate-spin -ml-1 mr-2 h-3 w-3",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[D.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),D.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Processing..."]}):"Submit File"})]})}var gh,p1;function ur(){if(p1)return gh;p1=1;var t=Array.isArray;return gh=t,gh}var bh,h1;function OC(){if(h1)return bh;h1=1;var t=typeof fc=="object"&&fc&&fc.Object===Object&&fc;return bh=t,bh}var xh,m1;function xn(){if(m1)return xh;m1=1;var t=OC(),e=typeof self=="object"&&self&&self.Object===Object&&self,r=t||e||Function("return this")();return xh=r,xh}var wh,v1;function Gs(){if(v1)return wh;v1=1;var t=xn(),e=t.Symbol;return wh=e,wh}var _h,y1;function C$(){if(y1)return _h;y1=1;var t=Gs(),e=Object.prototype,r=e.hasOwnProperty,n=e.toString,i=t?t.toStringTag:void 0;function o(s){var l=r.call(s,i),f=s[i];try{s[i]=void 0;var d=!0}catch{}var h=n.call(s);return d&&(l?s[i]=f:delete s[i]),h}return _h=o,_h}var Sh,g1;function k$(){if(g1)return Sh;g1=1;var t=Object.prototype,e=t.toString;function r(n){return e.call(n)}return Sh=r,Sh}var Oh,b1;function Vn(){if(b1)return Oh;b1=1;var t=Gs(),e=C$(),r=k$(),n="[object Null]",i="[object Undefined]",o=t?t.toStringTag:void 0;function s(l){return l==null?l===void 0?i:n:o&&o in Object(l)?e(l):r(l)}return Oh=s,Oh}var Ph,x1;function Hn(){if(x1)return Ph;x1=1;function t(e){return e!=null&&typeof e=="object"}return Ph=t,Ph}var Ah,w1;function Co(){if(w1)return Ah;w1=1;var t=Vn(),e=Hn(),r="[object Symbol]";function n(i){return typeof i=="symbol"||e(i)&&t(i)==r}return Ah=n,Ah}var Eh,_1;function Yb(){if(_1)return Eh;_1=1;var t=ur(),e=Co(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;function i(o,s){if(t(o))return!1;var l=typeof o;return l=="number"||l=="symbol"||l=="boolean"||o==null||e(o)?!0:n.test(o)||!r.test(o)||s!=null&&o in Object(s)}return Eh=i,Eh}var Th,S1;function Pi(){if(S1)return Th;S1=1;function t(e){var r=typeof e;return e!=null&&(r=="object"||r=="function")}return Th=t,Th}var Ch,O1;function Qb(){if(O1)return Ch;O1=1;var t=Vn(),e=Pi(),r="[object AsyncFunction]",n="[object Function]",i="[object GeneratorFunction]",o="[object Proxy]";function s(l){if(!e(l))return!1;var f=t(l);return f==n||f==i||f==r||f==o}return Ch=s,Ch}var kh,P1;function j$(){if(P1)return kh;P1=1;var t=xn(),e=t["__core-js_shared__"];return kh=e,kh}var jh,A1;function N$(){if(A1)return jh;A1=1;var t=j$(),e=function(){var n=/[^.]+$/.exec(t&&t.keys&&t.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""}();function r(n){return!!e&&e in n}return jh=r,jh}var Nh,E1;function PC(){if(E1)return Nh;E1=1;var t=Function.prototype,e=t.toString;function r(n){if(n!=null){try{return e.call(n)}catch{}try{return n+""}catch{}}return""}return Nh=r,Nh}var Mh,T1;function M$(){if(T1)return Mh;T1=1;var t=Qb(),e=N$(),r=Pi(),n=PC(),i=/[\\^$.*+?()[\]{}|]/g,o=/^\[object .+?Constructor\]$/,s=Function.prototype,l=Object.prototype,f=s.toString,d=l.hasOwnProperty,h=RegExp("^"+f.call(d).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function m(v){if(!r(v)||e(v))return!1;var g=t(v)?h:o;return g.test(n(v))}return Mh=m,Mh}var Ih,C1;function I$(){if(C1)return Ih;C1=1;function t(e,r){return e==null?void 0:e[r]}return Ih=t,Ih}var Rh,k1;function ua(){if(k1)return Rh;k1=1;var t=M$(),e=I$();function r(n,i){var o=e(n,i);return t(o)?o:void 0}return Rh=r,Rh}var $h,j1;function zf(){if(j1)return $h;j1=1;var t=ua(),e=t(Object,"create");return $h=e,$h}var Dh,N1;function R$(){if(N1)return Dh;N1=1;var t=zf();function e(){this.__data__=t?t(null):{},this.size=0}return Dh=e,Dh}var Lh,M1;function $$(){if(M1)return Lh;M1=1;function t(e){var r=this.has(e)&&delete this.__data__[e];return this.size-=r?1:0,r}return Lh=t,Lh}var zh,I1;function D$(){if(I1)return zh;I1=1;var t=zf(),e="__lodash_hash_undefined__",r=Object.prototype,n=r.hasOwnProperty;function i(o){var s=this.__data__;if(t){var l=s[o];return l===e?void 0:l}return n.call(s,o)?s[o]:void 0}return zh=i,zh}var Bh,R1;function L$(){if(R1)return Bh;R1=1;var t=zf(),e=Object.prototype,r=e.hasOwnProperty;function n(i){var o=this.__data__;return t?o[i]!==void 0:r.call(o,i)}return Bh=n,Bh}var qh,$1;function z$(){if($1)return qh;$1=1;var t=zf(),e="__lodash_hash_undefined__";function r(n,i){var o=this.__data__;return this.size+=this.has(n)?0:1,o[n]=t&&i===void 0?e:i,this}return qh=r,qh}var Fh,D1;function B$(){if(D1)return Fh;D1=1;var t=R$(),e=$$(),r=D$(),n=L$(),i=z$();function o(s){var l=-1,f=s==null?0:s.length;for(this.clear();++l-1}return Kh=e,Kh}var Zh,W1;function V$(){if(W1)return Zh;W1=1;var t=Bf();function e(r,n){var i=this.__data__,o=t(i,r);return o<0?(++this.size,i.push([r,n])):i[o][1]=n,this}return Zh=e,Zh}var Xh,V1;function qf(){if(V1)return Xh;V1=1;var t=q$(),e=F$(),r=U$(),n=W$(),i=V$();function o(s){var l=-1,f=s==null?0:s.length;for(this.clear();++l0?1:-1},Hi=function(e){return Ks(e)&&e.indexOf("%")===e.length-1},ce=function(e){return hD(e)&&!Zs(e)},Ot=function(e){return ce(e)||Ks(e)},mD=0,jo=function(e){var r=++mD;return"".concat(e||"").concat(r)},ra=function(e,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!ce(e)&&!Ks(e))return n;var o;if(Hi(e)){var s=e.indexOf("%");o=r*parseFloat(e.slice(0,s))/100}else o=+e;return Zs(o)&&(o=n),i&&o>r&&(o=r),o},vi=function(e){if(!e)return null;var r=Object.keys(e);return r&&r.length?e[r[0]]:null},vD=function(e){if(!Array.isArray(e))return!1;for(var r=e.length,n={},i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function SD(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}function Ag(t){"@babel/helpers - typeof";return Ag=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ag(t)}var bS={click:"onClick",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",touchcancel:"onTouchCancel",touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart",contextmenu:"onContextMenu",dblclick:"onDoubleClick"},Dn=function(e){return typeof e=="string"?e:e?e.displayName||e.name||"Component":""},xS=null,_m=null,a0=function t(e){if(e===xS&&Array.isArray(_m))return _m;var r=[];return R.Children.forEach(e,function(n){Ne(n)||(cD.isFragment(n)?r=r.concat(t(n.props.children)):r.push(n))}),_m=r,xS=e,r};function or(t,e){var r=[],n=[];return Array.isArray(e)?n=e.map(function(i){return Dn(i)}):n=[Dn(e)],a0(t).forEach(function(i){var o=Tr(i,"type.displayName")||Tr(i,"type.name");n.indexOf(o)!==-1&&r.push(i)}),r}function hr(t,e){var r=or(t,e);return r[0]}var wS=function(e){if(!e||!e.props)return!1;var r=e.props,n=r.width,i=r.height;return!(!ce(n)||n<=0||!ce(i)||i<=0)},OD=["a","altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColormatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-url","foreignObject","g","glyph","glyphRef","hkern","image","line","lineGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","svg","switch","symbol","text","textPath","title","tref","tspan","use","view","vkern"],PD=function(e){return e&&e.type&&Ks(e.type)&&OD.indexOf(e.type)>=0},AD=function(e){return e&&Ag(e)==="object"&&"clipDot"in e},ED=function(e,r,n,i){var o,s=(o=wm==null?void 0:wm[i])!==null&&o!==void 0?o:[];return!Re(e)&&(i&&s.includes(r)||bD.includes(r))||n&&i0.includes(r)},Le=function(e,r,n){if(!e||typeof e=="function"||typeof e=="boolean")return null;var i=e;if(R.isValidElement(e)&&(i=e.props),!ko(i))return null;var o={};return Object.keys(i).forEach(function(s){var l;ED((l=i)===null||l===void 0?void 0:l[s],s,r,n)&&(o[s]=i[s])}),o},Eg=function t(e,r){if(e===r)return!0;var n=R.Children.count(e);if(n!==R.Children.count(r))return!1;if(n===0)return!0;if(n===1)return _S(Array.isArray(e)?e[0]:e,Array.isArray(r)?r[0]:r);for(var i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function ND(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}function Cg(t){var e=t.children,r=t.width,n=t.height,i=t.viewBox,o=t.className,s=t.style,l=t.title,f=t.desc,d=jD(t,kD),h=i||{width:r,height:n,x:0,y:0},m=Be("recharts-surface",o);return L.createElement("svg",Tg({},Le(d,!0,"svg"),{className:m,width:r,height:n,style:s,viewBox:"".concat(h.x," ").concat(h.y," ").concat(h.width," ").concat(h.height)}),L.createElement("title",null,l),L.createElement("desc",null,f),e)}var MD=["children","className"];function kg(){return kg=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function RD(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}var tt=L.forwardRef(function(t,e){var r=t.children,n=t.className,i=ID(t,MD),o=Be("recharts-layer",n);return L.createElement("g",kg({className:o},Le(i,!0),{ref:e}),r)}),Ln=function(e,r){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;oo?0:o+r),n=n>o?o:n,n<0&&(n+=o),o=r>n?0:n-r>>>0,r>>>=0;for(var s=Array(o);++i=o?r:t(r,n,i)}return Om=e,Om}var Pm,AS;function jC(){if(AS)return Pm;AS=1;var t="\\ud800-\\udfff",e="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",i=e+r+n,o="\\ufe0e\\ufe0f",s="\\u200d",l=RegExp("["+s+t+i+o+"]");function f(d){return l.test(d)}return Pm=f,Pm}var Am,ES;function LD(){if(ES)return Am;ES=1;function t(e){return e.split("")}return Am=t,Am}var Em,TS;function zD(){if(TS)return Em;TS=1;var t="\\ud800-\\udfff",e="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",i=e+r+n,o="\\ufe0e\\ufe0f",s="["+t+"]",l="["+i+"]",f="\\ud83c[\\udffb-\\udfff]",d="(?:"+l+"|"+f+")",h="[^"+t+"]",m="(?:\\ud83c[\\udde6-\\uddff]){2}",v="[\\ud800-\\udbff][\\udc00-\\udfff]",g="\\u200d",_=d+"?",w="["+o+"]?",x="(?:"+g+"(?:"+[h,m,v].join("|")+")"+w+_+")*",O=w+_+x,P="(?:"+[h+l+"?",l,m,v,s].join("|")+")",A=RegExp(f+"(?="+f+")|"+P+O,"g");function C(S){return S.match(A)||[]}return Em=C,Em}var Tm,CS;function BD(){if(CS)return Tm;CS=1;var t=LD(),e=jC(),r=zD();function n(i){return e(i)?r(i):t(i)}return Tm=n,Tm}var Cm,kS;function qD(){if(kS)return Cm;kS=1;var t=DD(),e=jC(),r=BD(),n=EC();function i(o){return function(s){s=n(s);var l=e(s)?r(s):void 0,f=l?l[0]:s.charAt(0),d=l?t(l,1).join(""):s.slice(1);return f[o]()+d}}return Cm=i,Cm}var km,jS;function FD(){if(jS)return km;jS=1;var t=qD(),e=t("toUpperCase");return km=e,km}var UD=FD();const Wf=Qe(UD);function et(t){return function(){return t}}const NC=Math.cos,Dc=Math.sin,Xr=Math.sqrt,Lc=Math.PI,Vf=2*Lc,jg=Math.PI,Ng=2*jg,Wi=1e-6,WD=Ng-Wi;function MC(t){this._+=t[0];for(let e=1,r=t.length;e=0))throw new Error(`invalid digits: ${t}`);if(e>15)return MC;const r=10**e;return function(n){this._+=n[0];for(let i=1,o=n.length;iWi)if(!(Math.abs(m*f-d*h)>Wi)||!o)this._append`L${this._x1=e},${this._y1=r}`;else{let g=n-s,_=i-l,w=f*f+d*d,x=g*g+_*_,O=Math.sqrt(w),P=Math.sqrt(v),A=o*Math.tan((jg-Math.acos((w+v-x)/(2*O*P)))/2),C=A/P,S=A/O;Math.abs(C-1)>Wi&&this._append`L${e+C*h},${r+C*m}`,this._append`A${o},${o},0,0,${+(m*g>h*_)},${this._x1=e+S*f},${this._y1=r+S*d}`}}arc(e,r,n,i,o,s){if(e=+e,r=+r,n=+n,s=!!s,n<0)throw new Error(`negative radius: ${n}`);let l=n*Math.cos(i),f=n*Math.sin(i),d=e+l,h=r+f,m=1^s,v=s?i-o:o-i;this._x1===null?this._append`M${d},${h}`:(Math.abs(this._x1-d)>Wi||Math.abs(this._y1-h)>Wi)&&this._append`L${d},${h}`,n&&(v<0&&(v=v%Ng+Ng),v>WD?this._append`A${n},${n},0,1,${m},${e-l},${r-f}A${n},${n},0,1,${m},${this._x1=d},${this._y1=h}`:v>Wi&&this._append`A${n},${n},0,${+(v>=jg)},${m},${this._x1=e+n*Math.cos(o)},${this._y1=r+n*Math.sin(o)}`)}rect(e,r,n,i){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+r}h${n=+n}v${+i}h${-n}Z`}toString(){return this._}}function o0(t){let e=3;return t.digits=function(r){if(!arguments.length)return e;if(r==null)e=null;else{const n=Math.floor(r);if(!(n>=0))throw new RangeError(`invalid digits: ${r}`);e=n}return t},()=>new HD(e)}function u0(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function IC(t){this._context=t}IC.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e);break}}};function Hf(t){return new IC(t)}function RC(t){return t[0]}function $C(t){return t[1]}function DC(t,e){var r=et(!0),n=null,i=Hf,o=null,s=o0(l);t=typeof t=="function"?t:t===void 0?RC:et(t),e=typeof e=="function"?e:e===void 0?$C:et(e);function l(f){var d,h=(f=u0(f)).length,m,v=!1,g;for(n==null&&(o=i(g=s())),d=0;d<=h;++d)!(d=g;--_)l.point(A[_],C[_]);l.lineEnd(),l.areaEnd()}O&&(A[v]=+t(x,v,m),C[v]=+e(x,v,m),l.point(n?+n(x,v,m):A[v],r?+r(x,v,m):C[v]))}if(P)return l=null,P+""||null}function h(){return DC().defined(i).curve(s).context(o)}return d.x=function(m){return arguments.length?(t=typeof m=="function"?m:et(+m),n=null,d):t},d.x0=function(m){return arguments.length?(t=typeof m=="function"?m:et(+m),d):t},d.x1=function(m){return arguments.length?(n=m==null?null:typeof m=="function"?m:et(+m),d):n},d.y=function(m){return arguments.length?(e=typeof m=="function"?m:et(+m),r=null,d):e},d.y0=function(m){return arguments.length?(e=typeof m=="function"?m:et(+m),d):e},d.y1=function(m){return arguments.length?(r=m==null?null:typeof m=="function"?m:et(+m),d):r},d.lineX0=d.lineY0=function(){return h().x(t).y(e)},d.lineY1=function(){return h().x(t).y(r)},d.lineX1=function(){return h().x(n).y(e)},d.defined=function(m){return arguments.length?(i=typeof m=="function"?m:et(!!m),d):i},d.curve=function(m){return arguments.length?(s=m,o!=null&&(l=s(o)),d):s},d.context=function(m){return arguments.length?(m==null?o=l=null:l=s(o=m),d):o},d}class LC{constructor(e,r){this._context=e,this._x=r}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(e,r){switch(e=+e,r=+r,this._point){case 0:{this._point=1,this._line?this._context.lineTo(e,r):this._context.moveTo(e,r);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,r,e,r):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+r)/2,e,this._y0,e,r);break}}this._x0=e,this._y0=r}}function GD(t){return new LC(t,!0)}function KD(t){return new LC(t,!1)}const s0={draw(t,e){const r=Xr(e/Lc);t.moveTo(r,0),t.arc(0,0,r,0,Vf)}},ZD={draw(t,e){const r=Xr(e/5)/2;t.moveTo(-3*r,-r),t.lineTo(-r,-r),t.lineTo(-r,-3*r),t.lineTo(r,-3*r),t.lineTo(r,-r),t.lineTo(3*r,-r),t.lineTo(3*r,r),t.lineTo(r,r),t.lineTo(r,3*r),t.lineTo(-r,3*r),t.lineTo(-r,r),t.lineTo(-3*r,r),t.closePath()}},zC=Xr(1/3),XD=zC*2,YD={draw(t,e){const r=Xr(e/XD),n=r*zC;t.moveTo(0,-r),t.lineTo(n,0),t.lineTo(0,r),t.lineTo(-n,0),t.closePath()}},QD={draw(t,e){const r=Xr(e),n=-r/2;t.rect(n,n,r,r)}},JD=.8908130915292852,BC=Dc(Lc/10)/Dc(7*Lc/10),eL=Dc(Vf/10)*BC,tL=-NC(Vf/10)*BC,rL={draw(t,e){const r=Xr(e*JD),n=eL*r,i=tL*r;t.moveTo(0,-r),t.lineTo(n,i);for(let o=1;o<5;++o){const s=Vf*o/5,l=NC(s),f=Dc(s);t.lineTo(f*r,-l*r),t.lineTo(l*n-f*i,f*n+l*i)}t.closePath()}},jm=Xr(3),nL={draw(t,e){const r=-Xr(e/(jm*3));t.moveTo(0,r*2),t.lineTo(-jm*r,-r),t.lineTo(jm*r,-r),t.closePath()}},Or=-.5,Pr=Xr(3)/2,Mg=1/Xr(12),iL=(Mg/2+1)*3,aL={draw(t,e){const r=Xr(e/iL),n=r/2,i=r*Mg,o=n,s=r*Mg+r,l=-o,f=s;t.moveTo(n,i),t.lineTo(o,s),t.lineTo(l,f),t.lineTo(Or*n-Pr*i,Pr*n+Or*i),t.lineTo(Or*o-Pr*s,Pr*o+Or*s),t.lineTo(Or*l-Pr*f,Pr*l+Or*f),t.lineTo(Or*n+Pr*i,Or*i-Pr*n),t.lineTo(Or*o+Pr*s,Or*s-Pr*o),t.lineTo(Or*l+Pr*f,Or*f-Pr*l),t.closePath()}};function oL(t,e){let r=null,n=o0(i);t=typeof t=="function"?t:et(t||s0),e=typeof e=="function"?e:et(e===void 0?64:+e);function i(){let o;if(r||(r=o=n()),t.apply(this,arguments).draw(r,+e.apply(this,arguments)),o)return r=null,o+""||null}return i.type=function(o){return arguments.length?(t=typeof o=="function"?o:et(o),i):t},i.size=function(o){return arguments.length?(e=typeof o=="function"?o:et(+o),i):e},i.context=function(o){return arguments.length?(r=o??null,i):r},i}function zc(){}function Bc(t,e,r){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+r)/6)}function qC(t){this._context=t}qC.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Bc(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Bc(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function uL(t){return new qC(t)}function FC(t){this._context=t}FC.prototype={areaStart:zc,areaEnd:zc,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x2=t,this._y2=e;break;case 1:this._point=2,this._x3=t,this._y3=e;break;case 2:this._point=3,this._x4=t,this._y4=e,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+e)/6);break;default:Bc(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function sL(t){return new FC(t)}function UC(t){this._context=t}UC.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var r=(this._x0+4*this._x1+t)/6,n=(this._y0+4*this._y1+e)/6;this._line?this._context.lineTo(r,n):this._context.moveTo(r,n);break;case 3:this._point=4;default:Bc(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function lL(t){return new UC(t)}function WC(t){this._context=t}WC.prototype={areaStart:zc,areaEnd:zc,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,e){t=+t,e=+e,this._point?this._context.lineTo(t,e):(this._point=1,this._context.moveTo(t,e))}};function cL(t){return new WC(t)}function NS(t){return t<0?-1:1}function MS(t,e,r){var n=t._x1-t._x0,i=e-t._x1,o=(t._y1-t._y0)/(n||i<0&&-0),s=(r-t._y1)/(i||n<0&&-0),l=(o*i+s*n)/(n+i);return(NS(o)+NS(s))*Math.min(Math.abs(o),Math.abs(s),.5*Math.abs(l))||0}function IS(t,e){var r=t._x1-t._x0;return r?(3*(t._y1-t._y0)/r-e)/2:e}function Nm(t,e,r){var n=t._x0,i=t._y0,o=t._x1,s=t._y1,l=(o-n)/3;t._context.bezierCurveTo(n+l,i+l*e,o-l,s-l*r,o,s)}function qc(t){this._context=t}qc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:Nm(this,this._t0,IS(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){var r=NaN;if(t=+t,e=+e,!(t===this._x1&&e===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,Nm(this,IS(this,r=MS(this,t,e)),r);break;default:Nm(this,this._t0,r=MS(this,t,e));break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=r}}};function VC(t){this._context=new HC(t)}(VC.prototype=Object.create(qc.prototype)).point=function(t,e){qc.prototype.point.call(this,e,t)};function HC(t){this._context=t}HC.prototype={moveTo:function(t,e){this._context.moveTo(e,t)},closePath:function(){this._context.closePath()},lineTo:function(t,e){this._context.lineTo(e,t)},bezierCurveTo:function(t,e,r,n,i,o){this._context.bezierCurveTo(e,t,n,r,o,i)}};function fL(t){return new qc(t)}function dL(t){return new VC(t)}function GC(t){this._context=t}GC.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,e=this._y,r=t.length;if(r)if(this._line?this._context.lineTo(t[0],e[0]):this._context.moveTo(t[0],e[0]),r===2)this._context.lineTo(t[1],e[1]);else for(var n=RS(t),i=RS(e),o=0,s=1;s=0;--e)i[e]=(s[e]-i[e+1])/o[e];for(o[r-1]=(t[r]+i[r-1])/2,e=0;e=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var r=this._x*(1-this._t)+t*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,e)}break}}this._x=t,this._y=e}};function hL(t){return new Gf(t,.5)}function mL(t){return new Gf(t,0)}function vL(t){return new Gf(t,1)}function to(t,e){if((s=t.length)>1)for(var r=1,n,i,o=t[e[0]],s,l=o.length;r=0;)r[e]=e;return r}function yL(t,e){return t[e]}function gL(t){const e=[];return e.key=t,e}function bL(){var t=et([]),e=Ig,r=to,n=yL;function i(o){var s=Array.from(t.apply(this,arguments),gL),l,f=s.length,d=-1,h;for(const m of o)for(l=0,++d;l0){for(var r,n,i=0,o=t[0].length,s;i0){for(var r=0,n=t[e[0]],i,o=n.length;r0)||!((o=(i=t[e[0]]).length)>0))){for(var r=0,n=1,i,o,s;n=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function TL(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}var KC={symbolCircle:s0,symbolCross:ZD,symbolDiamond:YD,symbolSquare:QD,symbolStar:rL,symbolTriangle:nL,symbolWye:aL},CL=Math.PI/180,kL=function(e){var r="symbol".concat(Wf(e));return KC[r]||s0},jL=function(e,r,n){if(r==="area")return e;switch(n){case"cross":return 5*e*e/9;case"diamond":return .5*e*e/Math.sqrt(3);case"square":return e*e;case"star":{var i=18*CL;return 1.25*e*e*(Math.tan(i)-Math.tan(i*2)*Math.pow(Math.tan(i),2))}case"triangle":return Math.sqrt(3)*e*e/4;case"wye":return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}},NL=function(e,r){KC["symbol".concat(Wf(e))]=r},Kf=function(e){var r=e.type,n=r===void 0?"circle":r,i=e.size,o=i===void 0?64:i,s=e.sizeType,l=s===void 0?"area":s,f=EL(e,SL),d=DS(DS({},f),{},{type:n,size:o,sizeType:l}),h=function(){var x=kL(n),O=oL().type(x).size(jL(o,l,n));return O()},m=d.className,v=d.cx,g=d.cy,_=Le(d,!0);return v===+v&&g===+g&&o===+o?L.createElement("path",Rg({},_,{className:Be("recharts-symbols",m),transform:"translate(".concat(v,", ").concat(g,")"),d:h()})):null};Kf.registerSymbol=NL;function ro(t){"@babel/helpers - typeof";return ro=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ro(t)}function $g(){return $g=Object.assign?Object.assign.bind():function(t){for(var e=1;e`);var P=g.inactive?d:g.color;return L.createElement("li",$g({className:x,style:m,key:"legend-item-".concat(_)},cs(n.props,g,_)),L.createElement(Cg,{width:s,height:s,viewBox:h,style:v},n.renderIcon(g)),L.createElement("span",{className:"recharts-legend-item-text",style:{color:P}},w?w(O,g,_):O))})}},{key:"render",value:function(){var n=this.props,i=n.payload,o=n.layout,s=n.align;if(!i||!i.length)return null;var l={padding:0,margin:0,textAlign:o==="horizontal"?s:"left"};return L.createElement("ul",{className:"recharts-default-legend",style:l},this.renderItems())}}])}(R.PureComponent);ds(l0,"displayName","Legend");ds(l0,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});var Mm,zS;function FL(){if(zS)return Mm;zS=1;var t=qf();function e(){this.__data__=new t,this.size=0}return Mm=e,Mm}var Im,BS;function UL(){if(BS)return Im;BS=1;function t(e){var r=this.__data__,n=r.delete(e);return this.size=r.size,n}return Im=t,Im}var Rm,qS;function WL(){if(qS)return Rm;qS=1;function t(e){return this.__data__.get(e)}return Rm=t,Rm}var $m,FS;function VL(){if(FS)return $m;FS=1;function t(e){return this.__data__.has(e)}return $m=t,$m}var Dm,US;function HL(){if(US)return Dm;US=1;var t=qf(),e=e0(),r=t0(),n=200;function i(o,s){var l=this.__data__;if(l instanceof t){var f=l.__data__;if(!e||f.lengthg))return!1;var w=m.get(s),x=m.get(l);if(w&&x)return w==l&&x==s;var O=-1,P=!0,A=f&i?new t:void 0;for(m.set(s,l),m.set(l,s);++O-1&&n%1==0&&n-1&&r%1==0&&r<=t}return av=e,av}var ov,pO;function az(){if(pO)return ov;pO=1;var t=Vn(),e=p0(),r=Hn(),n="[object Arguments]",i="[object Array]",o="[object Boolean]",s="[object Date]",l="[object Error]",f="[object Function]",d="[object Map]",h="[object Number]",m="[object Object]",v="[object RegExp]",g="[object Set]",_="[object String]",w="[object WeakMap]",x="[object ArrayBuffer]",O="[object DataView]",P="[object Float32Array]",A="[object Float64Array]",C="[object Int8Array]",S="[object Int16Array]",E="[object Int32Array]",k="[object Uint8Array]",N="[object Uint8ClampedArray]",I="[object Uint16Array]",U="[object Uint32Array]",$={};$[P]=$[A]=$[C]=$[S]=$[E]=$[k]=$[N]=$[I]=$[U]=!0,$[n]=$[i]=$[x]=$[o]=$[O]=$[s]=$[l]=$[f]=$[d]=$[h]=$[m]=$[v]=$[g]=$[_]=$[w]=!1;function B(V){return r(V)&&e(V.length)&&!!$[t(V)]}return ov=B,ov}var uv,hO;function ik(){if(hO)return uv;hO=1;function t(e){return function(r){return e(r)}}return uv=t,uv}var Bu={exports:{}};Bu.exports;var mO;function oz(){return mO||(mO=1,function(t,e){var r=OC(),n=e&&!e.nodeType&&e,i=n&&!0&&t&&!t.nodeType&&t,o=i&&i.exports===n,s=o&&r.process,l=function(){try{var f=i&&i.require&&i.require("util").types;return f||s&&s.binding&&s.binding("util")}catch{}}();t.exports=l}(Bu,Bu.exports)),Bu.exports}var sv,vO;function ak(){if(vO)return sv;vO=1;var t=az(),e=ik(),r=oz(),n=r&&r.isTypedArray,i=n?e(n):t;return sv=i,sv}var lv,yO;function uz(){if(yO)return lv;yO=1;var t=rz(),e=f0(),r=ur(),n=nk(),i=d0(),o=ak(),s=Object.prototype,l=s.hasOwnProperty;function f(d,h){var m=r(d),v=!m&&e(d),g=!m&&!v&&n(d),_=!m&&!v&&!g&&o(d),w=m||v||g||_,x=w?t(d.length,String):[],O=x.length;for(var P in d)(h||l.call(d,P))&&!(w&&(P=="length"||g&&(P=="offset"||P=="parent")||_&&(P=="buffer"||P=="byteLength"||P=="byteOffset")||i(P,O)))&&x.push(P);return x}return lv=f,lv}var cv,gO;function sz(){if(gO)return cv;gO=1;var t=Object.prototype;function e(r){var n=r&&r.constructor,i=typeof n=="function"&&n.prototype||t;return r===i}return cv=e,cv}var fv,bO;function ok(){if(bO)return fv;bO=1;function t(e,r){return function(n){return e(r(n))}}return fv=t,fv}var dv,xO;function lz(){if(xO)return dv;xO=1;var t=ok(),e=t(Object.keys,Object);return dv=e,dv}var pv,wO;function cz(){if(wO)return pv;wO=1;var t=sz(),e=lz(),r=Object.prototype,n=r.hasOwnProperty;function i(o){if(!t(o))return e(o);var s=[];for(var l in Object(o))n.call(o,l)&&l!="constructor"&&s.push(l);return s}return pv=i,pv}var hv,_O;function Xs(){if(_O)return hv;_O=1;var t=Qb(),e=p0();function r(n){return n!=null&&e(n.length)&&!t(n)}return hv=r,hv}var mv,SO;function Zf(){if(SO)return mv;SO=1;var t=uz(),e=cz(),r=Xs();function n(i){return r(i)?t(i):e(i)}return mv=n,mv}var vv,OO;function fz(){if(OO)return vv;OO=1;var t=QL(),e=tz(),r=Zf();function n(i){return t(i,r,e)}return vv=n,vv}var yv,PO;function dz(){if(PO)return yv;PO=1;var t=fz(),e=1,r=Object.prototype,n=r.hasOwnProperty;function i(o,s,l,f,d,h){var m=l&e,v=t(o),g=v.length,_=t(s),w=_.length;if(g!=w&&!m)return!1;for(var x=g;x--;){var O=v[x];if(!(m?O in s:n.call(s,O)))return!1}var P=h.get(o),A=h.get(s);if(P&&A)return P==s&&A==o;var C=!0;h.set(o,s),h.set(s,o);for(var S=m;++x-1}return Uv=e,Uv}var Wv,QO;function Nz(){if(QO)return Wv;QO=1;function t(e,r,n){for(var i=-1,o=e==null?0:e.length;++i=s){var O=d?null:i(f);if(O)return o(O);_=!1,v=n,x=new t}else x=d?[]:w;e:for(;++m=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function Gz(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}function Kz(t){return t.value}function Zz(t,e){if(L.isValidElement(t))return L.cloneElement(t,e);if(typeof t=="function")return L.createElement(t,e);e.ref;var r=Hz(e,Lz);return L.createElement(l0,r)}var oP=1,Ka=function(t){function e(){var r;zz(this,e);for(var n=arguments.length,i=new Array(n),o=0;ooP||Math.abs(i.height-this.lastBoundingBox.height)>oP)&&(this.lastBoundingBox.width=i.width,this.lastBoundingBox.height=i.height,n&&n(i)):(this.lastBoundingBox.width!==-1||this.lastBoundingBox.height!==-1)&&(this.lastBoundingBox.width=-1,this.lastBoundingBox.height=-1,n&&n(null))}},{key:"getBBoxSnapshot",value:function(){return this.lastBoundingBox.width>=0&&this.lastBoundingBox.height>=0?jn({},this.lastBoundingBox):{width:0,height:0}}},{key:"getDefaultPosition",value:function(n){var i=this.props,o=i.layout,s=i.align,l=i.verticalAlign,f=i.margin,d=i.chartWidth,h=i.chartHeight,m,v;if(!n||(n.left===void 0||n.left===null)&&(n.right===void 0||n.right===null))if(s==="center"&&o==="vertical"){var g=this.getBBoxSnapshot();m={left:((d||0)-g.width)/2}}else m=s==="right"?{right:f&&f.right||0}:{left:f&&f.left||0};if(!n||(n.top===void 0||n.top===null)&&(n.bottom===void 0||n.bottom===null))if(l==="middle"){var _=this.getBBoxSnapshot();v={top:((h||0)-_.height)/2}}else v=l==="bottom"?{bottom:f&&f.bottom||0}:{top:f&&f.top||0};return jn(jn({},m),v)}},{key:"render",value:function(){var n=this,i=this.props,o=i.content,s=i.width,l=i.height,f=i.wrapperStyle,d=i.payloadUniqBy,h=i.payload,m=jn(jn({position:"absolute",width:s||"auto",height:l||"auto"},this.getDefaultPosition(f)),f);return L.createElement("div",{className:"recharts-legend-wrapper",style:m,ref:function(g){n.wrapperNode=g}},Zz(o,jn(jn({},this.props),{},{payload:fk(h,d,Kz)})))}}],[{key:"getWithHeight",value:function(n,i){var o=jn(jn({},this.defaultProps),n.props),s=o.layout;return s==="vertical"&&ce(n.props.height)?{height:n.props.height}:s==="horizontal"?{width:n.props.width||i}:null}}])}(R.PureComponent);Xf(Ka,"displayName","Legend");Xf(Ka,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"});var Zv,uP;function Xz(){if(uP)return Zv;uP=1;var t=Gs(),e=f0(),r=ur(),n=t?t.isConcatSpreadable:void 0;function i(o){return r(o)||e(o)||!!(n&&o&&o[n])}return Zv=i,Zv}var Xv,sP;function hk(){if(sP)return Xv;sP=1;var t=rk(),e=Xz();function r(n,i,o,s,l){var f=-1,d=n.length;for(o||(o=e),l||(l=[]);++f0&&o(h)?i>1?r(h,i-1,o,s,l):t(l,h):s||(l[l.length]=h)}return l}return Xv=r,Xv}var Yv,lP;function Yz(){if(lP)return Yv;lP=1;function t(e){return function(r,n,i){for(var o=-1,s=Object(r),l=i(r),f=l.length;f--;){var d=l[e?f:++o];if(n(s[d],d,s)===!1)break}return r}}return Yv=t,Yv}var Qv,cP;function Qz(){if(cP)return Qv;cP=1;var t=Yz(),e=t();return Qv=e,Qv}var Jv,fP;function mk(){if(fP)return Jv;fP=1;var t=Qz(),e=Zf();function r(n,i){return n&&t(n,i,e)}return Jv=r,Jv}var ey,dP;function Jz(){if(dP)return ey;dP=1;var t=Xs();function e(r,n){return function(i,o){if(i==null)return i;if(!t(i))return r(i,o);for(var s=i.length,l=n?s:-1,f=Object(i);(n?l--:++ln||l&&f&&h&&!d&&!m||o&&f&&h||!i&&h||!s)return 1;if(!o&&!l&&!m&&r=d)return h;var m=i[o];return h*(m=="desc"?-1:1)}}return r.index-n.index}return ay=e,ay}var oy,gP;function n3(){if(gP)return oy;gP=1;var t=r0(),e=n0(),r=Ai(),n=vk(),i=e3(),o=ik(),s=r3(),l=No(),f=ur();function d(h,m,v){m.length?m=t(m,function(w){return f(w)?function(x){return e(x,w.length===1?w[0]:w)}:w}):m=[l];var g=-1;m=t(m,o(r));var _=n(h,function(w,x,O){var P=t(m,function(A){return A(w)});return{criteria:P,index:++g,value:w}});return i(_,function(w,x){return s(w,x,v)})}return oy=d,oy}var uy,bP;function i3(){if(bP)return uy;bP=1;function t(e,r,n){switch(n.length){case 0:return e.call(r);case 1:return e.call(r,n[0]);case 2:return e.call(r,n[0],n[1]);case 3:return e.call(r,n[0],n[1],n[2])}return e.apply(r,n)}return uy=t,uy}var sy,xP;function a3(){if(xP)return sy;xP=1;var t=i3(),e=Math.max;function r(n,i,o){return i=e(i===void 0?n.length-1:i,0),function(){for(var s=arguments,l=-1,f=e(s.length-i,0),d=Array(f);++l0){if(++o>=t)return arguments[0]}else o=0;return i.apply(void 0,arguments)}}return dy=n,dy}var py,PP;function l3(){if(PP)return py;PP=1;var t=u3(),e=s3(),r=e(t);return py=r,py}var hy,AP;function c3(){if(AP)return hy;AP=1;var t=No(),e=a3(),r=l3();function n(i,o){return r(e(i,o,t),i+"")}return hy=n,hy}var my,EP;function Yf(){if(EP)return my;EP=1;var t=Jb(),e=Xs(),r=d0(),n=Pi();function i(o,s,l){if(!n(l))return!1;var f=typeof s;return(f=="number"?e(l)&&r(s,l.length):f=="string"&&s in l)?t(l[s],o):!1}return my=i,my}var vy,TP;function f3(){if(TP)return vy;TP=1;var t=hk(),e=n3(),r=c3(),n=Yf(),i=r(function(o,s){if(o==null)return[];var l=s.length;return l>1&&n(o,s[0],s[1])?s=[]:l>2&&n(s[0],s[1],s[2])&&(s=[s[0]]),e(o,t(s,1),[])});return vy=i,vy}var d3=f3();const v0=Qe(d3);function ps(t){"@babel/helpers - typeof";return ps=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ps(t)}function zg(){return zg=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var r=0,n=new Array(e);r=e.x),"".concat(Tu,"-left"),ce(r)&&e&&ce(e.x)&&r=e.y),"".concat(Tu,"-top"),ce(n)&&e&&ce(e.y)&&nw?Math.max(h,f[n]):Math.max(m,f[n])}function E3(t){var e=t.translateX,r=t.translateY,n=t.useTranslate3d;return{transform:n?"translate3d(".concat(e,"px, ").concat(r,"px, 0)"):"translate(".concat(e,"px, ").concat(r,"px)")}}function T3(t){var e=t.allowEscapeViewBox,r=t.coordinate,n=t.offsetTopLeft,i=t.position,o=t.reverseDirection,s=t.tooltipBox,l=t.useTranslate3d,f=t.viewBox,d,h,m;return s.height>0&&s.width>0&&r?(h=jP({allowEscapeViewBox:e,coordinate:r,key:"x",offsetTopLeft:n,position:i,reverseDirection:o,tooltipDimension:s.width,viewBox:f,viewBoxDimension:f.width}),m=jP({allowEscapeViewBox:e,coordinate:r,key:"y",offsetTopLeft:n,position:i,reverseDirection:o,tooltipDimension:s.height,viewBox:f,viewBoxDimension:f.height}),d=E3({translateX:h,translateY:m,useTranslate3d:l})):d=P3,{cssProperties:d,cssClasses:A3({translateX:h,translateY:m,coordinate:r})}}function io(t){"@babel/helpers - typeof";return io=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},io(t)}function NP(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function MP(t){for(var e=1;eIP||Math.abs(n.height-this.state.lastBoundingBox.height)>IP)&&this.setState({lastBoundingBox:{width:n.width,height:n.height}})}else(this.state.lastBoundingBox.width!==-1||this.state.lastBoundingBox.height!==-1)&&this.setState({lastBoundingBox:{width:-1,height:-1}})}},{key:"componentDidMount",value:function(){document.addEventListener("keydown",this.handleKeyDown),this.updateBBox()}},{key:"componentWillUnmount",value:function(){document.removeEventListener("keydown",this.handleKeyDown)}},{key:"componentDidUpdate",value:function(){var n,i;this.props.active&&this.updateBBox(),this.state.dismissed&&(((n=this.props.coordinate)===null||n===void 0?void 0:n.x)!==this.state.dismissedAtCoordinate.x||((i=this.props.coordinate)===null||i===void 0?void 0:i.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}},{key:"render",value:function(){var n=this,i=this.props,o=i.active,s=i.allowEscapeViewBox,l=i.animationDuration,f=i.animationEasing,d=i.children,h=i.coordinate,m=i.hasPayload,v=i.isAnimationActive,g=i.offset,_=i.position,w=i.reverseDirection,x=i.useTranslate3d,O=i.viewBox,P=i.wrapperStyle,A=T3({allowEscapeViewBox:s,coordinate:h,offsetTopLeft:g,position:_,reverseDirection:w,tooltipBox:this.state.lastBoundingBox,useTranslate3d:x,viewBox:O}),C=A.cssClasses,S=A.cssProperties,E=MP(MP({transition:v&&o?"transform ".concat(l,"ms ").concat(f):void 0},S),{},{pointerEvents:"none",visibility:!this.state.dismissed&&o&&m?"visible":"hidden",position:"absolute",top:0,left:0},P);return L.createElement("div",{tabIndex:-1,className:C,style:E,ref:function(N){n.wrapperNode=N}},d)}}])}(R.PureComponent),L3=function(){return!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout)},dn={isSsr:L3(),get:function(e){return dn[e]},set:function(e,r){if(typeof e=="string")dn[e]=r;else{var n=Object.keys(e);n&&n.length&&n.forEach(function(i){dn[i]=e[i]})}}};function ao(t){"@babel/helpers - typeof";return ao=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ao(t)}function RP(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function $P(t){for(var e=1;e0;return L.createElement(D3,{allowEscapeViewBox:s,animationDuration:l,animationEasing:f,isAnimationActive:v,active:o,coordinate:h,hasPayload:E,offset:g,position:x,reverseDirection:O,useTranslate3d:P,viewBox:A,wrapperStyle:C},K3(d,$P($P({},this.props),{},{payload:S})))}}])}(R.PureComponent);y0(on,"displayName","Tooltip");y0(on,"defaultProps",{accessibilityLayer:!1,allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",contentStyle:{},coordinate:{x:0,y:0},cursor:!0,cursorStyle:{},filterNull:!0,isAnimationActive:!dn.isSsr,itemStyle:{},labelStyle:{},offset:10,reverseDirection:{x:!1,y:!1},separator:" : ",trigger:"hover",useTranslate3d:!1,viewBox:{x:0,y:0,height:0,width:0},wrapperStyle:{}});var gy,DP;function Z3(){if(DP)return gy;DP=1;var t=xn(),e=function(){return t.Date.now()};return gy=e,gy}var by,LP;function X3(){if(LP)return by;LP=1;var t=/\s/;function e(r){for(var n=r.length;n--&&t.test(r.charAt(n)););return n}return by=e,by}var xy,zP;function Y3(){if(zP)return xy;zP=1;var t=X3(),e=/^\s+/;function r(n){return n&&n.slice(0,t(n)+1).replace(e,"")}return xy=r,xy}var wy,BP;function _k(){if(BP)return wy;BP=1;var t=Y3(),e=Pi(),r=Co(),n=NaN,i=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,s=/^0o[0-7]+$/i,l=parseInt;function f(d){if(typeof d=="number")return d;if(r(d))return n;if(e(d)){var h=typeof d.valueOf=="function"?d.valueOf():d;d=e(h)?h+"":h}if(typeof d!="string")return d===0?d:+d;d=t(d);var m=o.test(d);return m||s.test(d)?l(d.slice(2),m?2:8):i.test(d)?n:+d}return wy=f,wy}var _y,qP;function Q3(){if(qP)return _y;qP=1;var t=Pi(),e=Z3(),r=_k(),n="Expected a function",i=Math.max,o=Math.min;function s(l,f,d){var h,m,v,g,_,w,x=0,O=!1,P=!1,A=!0;if(typeof l!="function")throw new TypeError(n);f=r(f)||0,t(d)&&(O=!!d.leading,P="maxWait"in d,v=P?i(r(d.maxWait)||0,f):v,A="trailing"in d?!!d.trailing:A);function C(V){var X=h,Z=m;return h=m=void 0,x=V,g=l.apply(Z,X),g}function S(V){return x=V,_=setTimeout(N,f),O?C(V):g}function E(V){var X=V-w,Z=V-x,Y=f-X;return P?o(Y,v-Z):Y}function k(V){var X=V-w,Z=V-x;return w===void 0||X>=f||X<0||P&&Z>=v}function N(){var V=e();if(k(V))return I(V);_=setTimeout(N,E(V))}function I(V){return _=void 0,A&&h?C(V):(h=m=void 0,g)}function U(){_!==void 0&&clearTimeout(_),x=0,h=w=m=_=void 0}function $(){return _===void 0?g:I(e())}function B(){var V=e(),X=k(V);if(h=arguments,m=this,w=V,X){if(_===void 0)return S(w);if(P)return clearTimeout(_),_=setTimeout(N,f),C(w)}return _===void 0&&(_=setTimeout(N,f)),g}return B.cancel=U,B.flush=$,B}return _y=s,_y}var Sy,FP;function J3(){if(FP)return Sy;FP=1;var t=Q3(),e=Pi(),r="Expected a function";function n(i,o,s){var l=!0,f=!0;if(typeof i!="function")throw new TypeError(r);return e(s)&&(l="leading"in s?!!s.leading:l,f="trailing"in s?!!s.trailing:f),t(i,o,{leading:l,maxWait:o,trailing:f})}return Sy=n,Sy}var eB=J3();const Sk=Qe(eB);function ms(t){"@babel/helpers - typeof";return ms=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ms(t)}function UP(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function vc(t){for(var e=1;et.length)&&(e=t.length);for(var r=0,n=new Array(e);r0&&(V=Sk(V,w,{trailing:!0,leading:!1}));var X=new ResizeObserver(V),Z=S.current.getBoundingClientRect(),Y=Z.width,te=Z.height;return $(Y,te),X.observe(S.current),function(){X.disconnect()}},[$,w]);var B=R.useMemo(function(){var V=I.containerWidth,X=I.containerHeight;if(V<0||X<0)return null;Ln(Hi(s)||Hi(f),`The width(%s) and height(%s) are both fixed numbers, + maybe you don't need to use a ResponsiveContainer.`,s,f),Ln(!r||r>0,"The aspect(%s) must be greater than zero.",r);var Z=Hi(s)?V:s,Y=Hi(f)?X:f;r&&r>0&&(Z?Y=Z/r:Y&&(Z=Y*r),v&&Y>v&&(Y=v)),Ln(Z>0||Y>0,`The width(%s) and height(%s) of chart should be greater than 0, + please check the style of container, or the props width(%s) and height(%s), + or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the + height and width.`,Z,Y,s,f,h,m,r);var te=!Array.isArray(g)&&Dn(g.type).endsWith("Chart");return L.Children.map(g,function(H){return L.isValidElement(H)?R.cloneElement(H,vc({width:Z,height:Y},te?{style:vc({height:"100%",width:"100%",maxHeight:Y,maxWidth:Z},H.props.style)}:{})):H})},[r,g,f,v,m,h,I,s]);return L.createElement("div",{id:x?"".concat(x):void 0,className:Be("recharts-responsive-container",O),style:vc(vc({},C),{},{width:s,height:f,minWidth:h,minHeight:m,maxHeight:v}),ref:S},B)}),g0=function(e){return null};g0.displayName="Cell";function vs(t){"@babel/helpers - typeof";return vs=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},vs(t)}function VP(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function Ug(t){for(var e=1;e1&&arguments[1]!==void 0?arguments[1]:{};if(e==null||dn.isSsr)return{width:0,height:0};var n=mB(r),i=JSON.stringify({text:e,copyStyle:n});if($a.widthCache[i])return $a.widthCache[i];try{var o=document.getElementById(HP);o||(o=document.createElement("span"),o.setAttribute("id",HP),o.setAttribute("aria-hidden","true"),document.body.appendChild(o));var s=Ug(Ug({},hB),n);Object.assign(o.style,s),o.textContent="".concat(e);var l=o.getBoundingClientRect(),f={width:l.width,height:l.height};return $a.widthCache[i]=f,++$a.cacheCount>pB&&($a.cacheCount=0,$a.widthCache={}),f}catch{return{width:0,height:0}}},vB=function(e){return{top:e.top+window.scrollY-document.documentElement.clientTop,left:e.left+window.scrollX-document.documentElement.clientLeft}};function ys(t){"@babel/helpers - typeof";return ys=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ys(t)}function Hc(t,e){return xB(t)||bB(t,e)||gB(t,e)||yB()}function yB(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function gB(t,e){if(t){if(typeof t=="string")return GP(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return GP(t,e)}}function GP(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function IB(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}function JP(t,e){return LB(t)||DB(t,e)||$B(t,e)||RB()}function RB(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function $B(t,e){if(t){if(typeof t=="string")return eA(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return eA(t,e)}}function eA(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r0&&arguments[0]!==void 0?arguments[0]:[];return Z.reduce(function(Y,te){var H=te.word,Q=te.width,ee=Y[Y.length-1];if(ee&&(i==null||o||ee.width+Q+nte.width?Y:te})};if(!h)return g;for(var w="…",x=function(Z){var Y=m.slice(0,Z),te=Ek({breakAll:d,style:f,children:Y+w}).wordsWithComputedWidth,H=v(te),Q=H.length>s||_(H).width>Number(i);return[Q,H]},O=0,P=m.length-1,A=0,C;O<=P&&A<=m.length-1;){var S=Math.floor((O+P)/2),E=S-1,k=x(E),N=JP(k,2),I=N[0],U=N[1],$=x(S),B=JP($,1),V=B[0];if(!I&&!V&&(O=S+1),I&&V&&(P=S-1),!I&&V){C=U;break}A++}return C||g},tA=function(e){var r=Ne(e)?[]:e.toString().split(Ak);return[{words:r}]},BB=function(e){var r=e.width,n=e.scaleToFit,i=e.children,o=e.style,s=e.breakAll,l=e.maxLines;if((r||n)&&!dn.isSsr){var f,d,h=Ek({breakAll:s,children:i,style:o});if(h){var m=h.wordsWithComputedWidth,v=h.spaceWidth;f=m,d=v}else return tA(i);return zB({breakAll:s,children:i,maxLines:l,style:o},f,d,r,n)}return tA(i)},rA="#808080",Gc=function(e){var r=e.x,n=r===void 0?0:r,i=e.y,o=i===void 0?0:i,s=e.lineHeight,l=s===void 0?"1em":s,f=e.capHeight,d=f===void 0?"0.71em":f,h=e.scaleToFit,m=h===void 0?!1:h,v=e.textAnchor,g=v===void 0?"start":v,_=e.verticalAnchor,w=_===void 0?"end":_,x=e.fill,O=x===void 0?rA:x,P=QP(e,NB),A=R.useMemo(function(){return BB({breakAll:P.breakAll,children:P.children,maxLines:P.maxLines,scaleToFit:m,style:P.style,width:P.width})},[P.breakAll,P.children,P.maxLines,m,P.style,P.width]),C=P.dx,S=P.dy,E=P.angle,k=P.className,N=P.breakAll,I=QP(P,MB);if(!Ot(n)||!Ot(o))return null;var U=n+(ce(C)?C:0),$=o+(ce(S)?S:0),B;switch(w){case"start":B=Oy("calc(".concat(d,")"));break;case"middle":B=Oy("calc(".concat((A.length-1)/2," * -").concat(l," + (").concat(d," / 2))"));break;default:B=Oy("calc(".concat(A.length-1," * -").concat(l,")"));break}var V=[];if(m){var X=A[0].width,Z=P.width;V.push("scale(".concat((ce(Z)?Z/X:1)/X,")"))}return E&&V.push("rotate(".concat(E,", ").concat(U,", ").concat($,")")),V.length&&(I.transform=V.join(" ")),L.createElement("text",Wg({},Le(I,!0),{x:U,y:$,className:Be("recharts-text",k),textAnchor:g,fill:O.includes("url")?rA:O}),A.map(function(Y,te){var H=Y.words.join(N?"":" ");return L.createElement("tspan",{x:U,dy:te===0?B:l,key:"".concat(H,"-").concat(te)},H)}))};function bi(t,e){return t==null||e==null?NaN:te?1:t>=e?0:NaN}function qB(t,e){return t==null||e==null?NaN:et?1:e>=t?0:NaN}function b0(t){let e,r,n;t.length!==2?(e=bi,r=(l,f)=>bi(t(l),f),n=(l,f)=>t(l)-f):(e=t===bi||t===qB?t:FB,r=t,n=t);function i(l,f,d=0,h=l.length){if(d>>1;r(l[m],f)<0?d=m+1:h=m}while(d>>1;r(l[m],f)<=0?d=m+1:h=m}while(dd&&n(l[m-1],f)>-n(l[m],f)?m-1:m}return{left:i,center:s,right:o}}function FB(){return 0}function Tk(t){return t===null?NaN:+t}function*UB(t,e){for(let r of t)r!=null&&(r=+r)>=r&&(yield r)}const WB=b0(bi),Ys=WB.right;b0(Tk).center;class nA extends Map{constructor(e,r=GB){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:r}}),e!=null)for(const[n,i]of e)this.set(n,i)}get(e){return super.get(iA(this,e))}has(e){return super.has(iA(this,e))}set(e,r){return super.set(VB(this,e),r)}delete(e){return super.delete(HB(this,e))}}function iA({_intern:t,_key:e},r){const n=e(r);return t.has(n)?t.get(n):r}function VB({_intern:t,_key:e},r){const n=e(r);return t.has(n)?t.get(n):(t.set(n,r),r)}function HB({_intern:t,_key:e},r){const n=e(r);return t.has(n)&&(r=t.get(n),t.delete(n)),r}function GB(t){return t!==null&&typeof t=="object"?t.valueOf():t}function KB(t=bi){if(t===bi)return Ck;if(typeof t!="function")throw new TypeError("compare is not a function");return(e,r)=>{const n=t(e,r);return n||n===0?n:(t(r,r)===0)-(t(e,e)===0)}}function Ck(t,e){return(t==null||!(t>=t))-(e==null||!(e>=e))||(te?1:0)}const ZB=Math.sqrt(50),XB=Math.sqrt(10),YB=Math.sqrt(2);function Kc(t,e,r){const n=(e-t)/Math.max(0,r),i=Math.floor(Math.log10(n)),o=n/Math.pow(10,i),s=o>=ZB?10:o>=XB?5:o>=YB?2:1;let l,f,d;return i<0?(d=Math.pow(10,-i)/s,l=Math.round(t*d),f=Math.round(e*d),l/de&&--f,d=-d):(d=Math.pow(10,i)*s,l=Math.round(t/d),f=Math.round(e/d),l*de&&--f),f0))return[];if(t===e)return[t];const n=e=i))return[];const l=o-i+1,f=new Array(l);if(n)if(s<0)for(let d=0;d=n)&&(r=n);return r}function oA(t,e){let r;for(const n of t)n!=null&&(r>n||r===void 0&&n>=n)&&(r=n);return r}function kk(t,e,r=0,n=1/0,i){if(e=Math.floor(e),r=Math.floor(Math.max(0,r)),n=Math.floor(Math.min(t.length-1,n)),!(r<=e&&e<=n))return t;for(i=i===void 0?Ck:KB(i);n>r;){if(n-r>600){const f=n-r+1,d=e-r+1,h=Math.log(f),m=.5*Math.exp(2*h/3),v=.5*Math.sqrt(h*m*(f-m)/f)*(d-f/2<0?-1:1),g=Math.max(r,Math.floor(e-d*m/f+v)),_=Math.min(n,Math.floor(e+(f-d)*m/f+v));kk(t,e,g,_,i)}const o=t[e];let s=r,l=n;for(Cu(t,r,e),i(t[n],o)>0&&Cu(t,r,n);s0;)--l}i(t[r],o)===0?Cu(t,r,l):(++l,Cu(t,l,n)),l<=e&&(r=l+1),e<=l&&(n=l-1)}return t}function Cu(t,e,r){const n=t[e];t[e]=t[r],t[r]=n}function QB(t,e,r){if(t=Float64Array.from(UB(t)),!(!(n=t.length)||isNaN(e=+e))){if(e<=0||n<2)return oA(t);if(e>=1)return aA(t);var n,i=(n-1)*e,o=Math.floor(i),s=aA(kk(t,o).subarray(0,o+1)),l=oA(t.subarray(o+1));return s+(l-s)*(i-o)}}function JB(t,e,r=Tk){if(!(!(n=t.length)||isNaN(e=+e))){if(e<=0||n<2)return+r(t[0],0,t);if(e>=1)return+r(t[n-1],n-1,t);var n,i=(n-1)*e,o=Math.floor(i),s=+r(t[o],o,t),l=+r(t[o+1],o+1,t);return s+(l-s)*(i-o)}}function eq(t,e,r){t=+t,e=+e,r=(i=arguments.length)<2?(e=t,t=0,1):i<3?1:+r;for(var n=-1,i=Math.max(0,Math.ceil((e-t)/r))|0,o=new Array(i);++n>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):r===8?gc(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):r===4?gc(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=rq.exec(t))?new ar(e[1],e[2],e[3],1):(e=nq.exec(t))?new ar(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=iq.exec(t))?gc(e[1],e[2],e[3],e[4]):(e=aq.exec(t))?gc(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=oq.exec(t))?pA(e[1],e[2]/100,e[3]/100,1):(e=uq.exec(t))?pA(e[1],e[2]/100,e[3]/100,e[4]):uA.hasOwnProperty(t)?cA(uA[t]):t==="transparent"?new ar(NaN,NaN,NaN,0):null}function cA(t){return new ar(t>>16&255,t>>8&255,t&255,1)}function gc(t,e,r,n){return n<=0&&(t=e=r=NaN),new ar(t,e,r,n)}function cq(t){return t instanceof Qs||(t=ws(t)),t?(t=t.rgb(),new ar(t.r,t.g,t.b,t.opacity)):new ar}function Zg(t,e,r,n){return arguments.length===1?cq(t):new ar(t,e,r,n??1)}function ar(t,e,r,n){this.r=+t,this.g=+e,this.b=+r,this.opacity=+n}w0(ar,Zg,Nk(Qs,{brighter(t){return t=t==null?Zc:Math.pow(Zc,t),new ar(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?bs:Math.pow(bs,t),new ar(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new ar(Yi(this.r),Yi(this.g),Yi(this.b),Xc(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:fA,formatHex:fA,formatHex8:fq,formatRgb:dA,toString:dA}));function fA(){return`#${Gi(this.r)}${Gi(this.g)}${Gi(this.b)}`}function fq(){return`#${Gi(this.r)}${Gi(this.g)}${Gi(this.b)}${Gi((isNaN(this.opacity)?1:this.opacity)*255)}`}function dA(){const t=Xc(this.opacity);return`${t===1?"rgb(":"rgba("}${Yi(this.r)}, ${Yi(this.g)}, ${Yi(this.b)}${t===1?")":`, ${t})`}`}function Xc(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Yi(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Gi(t){return t=Yi(t),(t<16?"0":"")+t.toString(16)}function pA(t,e,r,n){return n<=0?t=e=r=NaN:r<=0||r>=1?t=e=NaN:e<=0&&(t=NaN),new Vr(t,e,r,n)}function Mk(t){if(t instanceof Vr)return new Vr(t.h,t.s,t.l,t.opacity);if(t instanceof Qs||(t=ws(t)),!t)return new Vr;if(t instanceof Vr)return t;t=t.rgb();var e=t.r/255,r=t.g/255,n=t.b/255,i=Math.min(e,r,n),o=Math.max(e,r,n),s=NaN,l=o-i,f=(o+i)/2;return l?(e===o?s=(r-n)/l+(r0&&f<1?0:s,new Vr(s,l,f,t.opacity)}function dq(t,e,r,n){return arguments.length===1?Mk(t):new Vr(t,e,r,n??1)}function Vr(t,e,r,n){this.h=+t,this.s=+e,this.l=+r,this.opacity=+n}w0(Vr,dq,Nk(Qs,{brighter(t){return t=t==null?Zc:Math.pow(Zc,t),new Vr(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?bs:Math.pow(bs,t),new Vr(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*e,i=2*r-n;return new ar(Py(t>=240?t-240:t+120,i,n),Py(t,i,n),Py(t<120?t+240:t-120,i,n),this.opacity)},clamp(){return new Vr(hA(this.h),bc(this.s),bc(this.l),Xc(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=Xc(this.opacity);return`${t===1?"hsl(":"hsla("}${hA(this.h)}, ${bc(this.s)*100}%, ${bc(this.l)*100}%${t===1?")":`, ${t})`}`}}));function hA(t){return t=(t||0)%360,t<0?t+360:t}function bc(t){return Math.max(0,Math.min(1,t||0))}function Py(t,e,r){return(t<60?e+(r-e)*t/60:t<180?r:t<240?e+(r-e)*(240-t)/60:e)*255}const _0=t=>()=>t;function pq(t,e){return function(r){return t+r*e}}function hq(t,e,r){return t=Math.pow(t,r),e=Math.pow(e,r)-t,r=1/r,function(n){return Math.pow(t+n*e,r)}}function mq(t){return(t=+t)==1?Ik:function(e,r){return r-e?hq(e,r,t):_0(isNaN(e)?r:e)}}function Ik(t,e){var r=e-t;return r?pq(t,r):_0(isNaN(t)?e:t)}const mA=function t(e){var r=mq(e);function n(i,o){var s=r((i=Zg(i)).r,(o=Zg(o)).r),l=r(i.g,o.g),f=r(i.b,o.b),d=Ik(i.opacity,o.opacity);return function(h){return i.r=s(h),i.g=l(h),i.b=f(h),i.opacity=d(h),i+""}}return n.gamma=t,n}(1);function vq(t,e){e||(e=[]);var r=t?Math.min(e.length,t.length):0,n=e.slice(),i;return function(o){for(i=0;ir&&(o=e.slice(r,o),l[s]?l[s]+=o:l[++s]=o),(n=n[0])===(i=i[0])?l[s]?l[s]+=i:l[++s]=i:(l[++s]=null,f.push({i:s,x:Yc(n,i)})),r=Ay.lastIndex;return re&&(r=t,t=e,e=r),function(n){return Math.max(t,Math.min(e,n))}}function Eq(t,e,r){var n=t[0],i=t[1],o=e[0],s=e[1];return i2?Tq:Eq,f=d=null,m}function m(v){return v==null||isNaN(v=+v)?o:(f||(f=l(t.map(n),e,r)))(n(s(v)))}return m.invert=function(v){return s(i((d||(d=l(e,t.map(n),Yc)))(v)))},m.domain=function(v){return arguments.length?(t=Array.from(v,Qc),h()):t.slice()},m.range=function(v){return arguments.length?(e=Array.from(v),h()):e.slice()},m.rangeRound=function(v){return e=Array.from(v),r=S0,h()},m.clamp=function(v){return arguments.length?(s=v?!0:Xt,h()):s!==Xt},m.interpolate=function(v){return arguments.length?(r=v,h()):r},m.unknown=function(v){return arguments.length?(o=v,m):o},function(v,g){return n=v,i=g,h()}}function O0(){return Qf()(Xt,Xt)}function Cq(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function Jc(t,e){if((r=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var r,n=t.slice(0,r);return[n.length>1?n[0]+n.slice(2):n,+t.slice(r+1)]}function oo(t){return t=Jc(Math.abs(t)),t?t[1]:NaN}function kq(t,e){return function(r,n){for(var i=r.length,o=[],s=0,l=t[0],f=0;i>0&&l>0&&(f+l+1>n&&(l=Math.max(1,n-f)),o.push(r.substring(i-=l,i+l)),!((f+=l+1)>n));)l=t[s=(s+1)%t.length];return o.reverse().join(e)}}function jq(t){return function(e){return e.replace(/[0-9]/g,function(r){return t[+r]})}}var Nq=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function _s(t){if(!(e=Nq.exec(t)))throw new Error("invalid format: "+t);var e;return new P0({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}_s.prototype=P0.prototype;function P0(t){this.fill=t.fill===void 0?" ":t.fill+"",this.align=t.align===void 0?">":t.align+"",this.sign=t.sign===void 0?"-":t.sign+"",this.symbol=t.symbol===void 0?"":t.symbol+"",this.zero=!!t.zero,this.width=t.width===void 0?void 0:+t.width,this.comma=!!t.comma,this.precision=t.precision===void 0?void 0:+t.precision,this.trim=!!t.trim,this.type=t.type===void 0?"":t.type+""}P0.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function Mq(t){e:for(var e=t.length,r=1,n=-1,i;r0&&(n=0);break}return n>0?t.slice(0,n)+t.slice(i+1):t}var Rk;function Iq(t,e){var r=Jc(t,e);if(!r)return t+"";var n=r[0],i=r[1],o=i-(Rk=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,s=n.length;return o===s?n:o>s?n+new Array(o-s+1).join("0"):o>0?n.slice(0,o)+"."+n.slice(o):"0."+new Array(1-o).join("0")+Jc(t,Math.max(0,e+o-1))[0]}function yA(t,e){var r=Jc(t,e);if(!r)return t+"";var n=r[0],i=r[1];return i<0?"0."+new Array(-i).join("0")+n:n.length>i+1?n.slice(0,i+1)+"."+n.slice(i+1):n+new Array(i-n.length+2).join("0")}const gA={"%":(t,e)=>(t*100).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:Cq,e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>yA(t*100,e),r:yA,s:Iq,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function bA(t){return t}var xA=Array.prototype.map,wA=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Rq(t){var e=t.grouping===void 0||t.thousands===void 0?bA:kq(xA.call(t.grouping,Number),t.thousands+""),r=t.currency===void 0?"":t.currency[0]+"",n=t.currency===void 0?"":t.currency[1]+"",i=t.decimal===void 0?".":t.decimal+"",o=t.numerals===void 0?bA:jq(xA.call(t.numerals,String)),s=t.percent===void 0?"%":t.percent+"",l=t.minus===void 0?"−":t.minus+"",f=t.nan===void 0?"NaN":t.nan+"";function d(m){m=_s(m);var v=m.fill,g=m.align,_=m.sign,w=m.symbol,x=m.zero,O=m.width,P=m.comma,A=m.precision,C=m.trim,S=m.type;S==="n"?(P=!0,S="g"):gA[S]||(A===void 0&&(A=12),C=!0,S="g"),(x||v==="0"&&g==="=")&&(x=!0,v="0",g="=");var E=w==="$"?r:w==="#"&&/[boxX]/.test(S)?"0"+S.toLowerCase():"",k=w==="$"?n:/[%p]/.test(S)?s:"",N=gA[S],I=/[defgprs%]/.test(S);A=A===void 0?6:/[gprs]/.test(S)?Math.max(1,Math.min(21,A)):Math.max(0,Math.min(20,A));function U($){var B=E,V=k,X,Z,Y;if(S==="c")V=N($)+V,$="";else{$=+$;var te=$<0||1/$<0;if($=isNaN($)?f:N(Math.abs($),A),C&&($=Mq($)),te&&+$==0&&_!=="+"&&(te=!1),B=(te?_==="("?_:l:_==="-"||_==="("?"":_)+B,V=(S==="s"?wA[8+Rk/3]:"")+V+(te&&_==="("?")":""),I){for(X=-1,Z=$.length;++XY||Y>57){V=(Y===46?i+$.slice(X+1):$.slice(X))+V,$=$.slice(0,X);break}}}P&&!x&&($=e($,1/0));var H=B.length+$.length+V.length,Q=H>1)+B+$+V+Q.slice(H);break;default:$=Q+B+$+V;break}return o($)}return U.toString=function(){return m+""},U}function h(m,v){var g=d((m=_s(m),m.type="f",m)),_=Math.max(-8,Math.min(8,Math.floor(oo(v)/3)))*3,w=Math.pow(10,-_),x=wA[8+_/3];return function(O){return g(w*O)+x}}return{format:d,formatPrefix:h}}var xc,A0,$k;$q({thousands:",",grouping:[3],currency:["$",""]});function $q(t){return xc=Rq(t),A0=xc.format,$k=xc.formatPrefix,xc}function Dq(t){return Math.max(0,-oo(Math.abs(t)))}function Lq(t,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(oo(e)/3)))*3-oo(Math.abs(t)))}function zq(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,oo(e)-oo(t))+1}function Dk(t,e,r,n){var i=Gg(t,e,r),o;switch(n=_s(n??",f"),n.type){case"s":{var s=Math.max(Math.abs(t),Math.abs(e));return n.precision==null&&!isNaN(o=Lq(i,s))&&(n.precision=o),$k(n,s)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(o=zq(i,Math.max(Math.abs(t),Math.abs(e))))&&(n.precision=o-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(o=Dq(i))&&(n.precision=o-(n.type==="%")*2);break}}return A0(n)}function Ei(t){var e=t.domain;return t.ticks=function(r){var n=e();return Vg(n[0],n[n.length-1],r??10)},t.tickFormat=function(r,n){var i=e();return Dk(i[0],i[i.length-1],r??10,n)},t.nice=function(r){r==null&&(r=10);var n=e(),i=0,o=n.length-1,s=n[i],l=n[o],f,d,h=10;for(l0;){if(d=Hg(s,l,r),d===f)return n[i]=s,n[o]=l,e(n);if(d>0)s=Math.floor(s/d)*d,l=Math.ceil(l/d)*d;else if(d<0)s=Math.ceil(s*d)/d,l=Math.floor(l*d)/d;else break;f=d}return t},t}function ef(){var t=O0();return t.copy=function(){return Js(t,ef())},kr.apply(t,arguments),Ei(t)}function Lk(t){var e;function r(n){return n==null||isNaN(n=+n)?e:n}return r.invert=r,r.domain=r.range=function(n){return arguments.length?(t=Array.from(n,Qc),r):t.slice()},r.unknown=function(n){return arguments.length?(e=n,r):e},r.copy=function(){return Lk(t).unknown(e)},t=arguments.length?Array.from(t,Qc):[0,1],Ei(r)}function zk(t,e){t=t.slice();var r=0,n=t.length-1,i=t[r],o=t[n],s;return oMath.pow(t,e)}function Wq(t){return t===Math.E?Math.log:t===10&&Math.log10||t===2&&Math.log2||(t=Math.log(t),e=>Math.log(e)/t)}function OA(t){return(e,r)=>-t(-e,r)}function E0(t){const e=t(_A,SA),r=e.domain;let n=10,i,o;function s(){return i=Wq(n),o=Uq(n),r()[0]<0?(i=OA(i),o=OA(o),t(Bq,qq)):t(_A,SA),e}return e.base=function(l){return arguments.length?(n=+l,s()):n},e.domain=function(l){return arguments.length?(r(l),s()):r()},e.ticks=l=>{const f=r();let d=f[0],h=f[f.length-1];const m=h0){for(;v<=g;++v)for(_=1;_h)break;O.push(w)}}else for(;v<=g;++v)for(_=n-1;_>=1;--_)if(w=v>0?_/o(-v):_*o(v),!(wh)break;O.push(w)}O.length*2{if(l==null&&(l=10),f==null&&(f=n===10?"s":","),typeof f!="function"&&(!(n%1)&&(f=_s(f)).precision==null&&(f.trim=!0),f=A0(f)),l===1/0)return f;const d=Math.max(1,n*l/e.ticks().length);return h=>{let m=h/o(Math.round(i(h)));return m*nr(zk(r(),{floor:l=>o(Math.floor(i(l))),ceil:l=>o(Math.ceil(i(l)))})),e}function Bk(){const t=E0(Qf()).domain([1,10]);return t.copy=()=>Js(t,Bk()).base(t.base()),kr.apply(t,arguments),t}function PA(t){return function(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))}}function AA(t){return function(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}function T0(t){var e=1,r=t(PA(e),AA(e));return r.constant=function(n){return arguments.length?t(PA(e=+n),AA(e)):e},Ei(r)}function qk(){var t=T0(Qf());return t.copy=function(){return Js(t,qk()).constant(t.constant())},kr.apply(t,arguments)}function EA(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function Vq(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function Hq(t){return t<0?-t*t:t*t}function C0(t){var e=t(Xt,Xt),r=1;function n(){return r===1?t(Xt,Xt):r===.5?t(Vq,Hq):t(EA(r),EA(1/r))}return e.exponent=function(i){return arguments.length?(r=+i,n()):r},Ei(e)}function k0(){var t=C0(Qf());return t.copy=function(){return Js(t,k0()).exponent(t.exponent())},kr.apply(t,arguments),t}function Gq(){return k0.apply(null,arguments).exponent(.5)}function TA(t){return Math.sign(t)*t*t}function Kq(t){return Math.sign(t)*Math.sqrt(Math.abs(t))}function Fk(){var t=O0(),e=[0,1],r=!1,n;function i(o){var s=Kq(t(o));return isNaN(s)?n:r?Math.round(s):s}return i.invert=function(o){return t.invert(TA(o))},i.domain=function(o){return arguments.length?(t.domain(o),i):t.domain()},i.range=function(o){return arguments.length?(t.range((e=Array.from(o,Qc)).map(TA)),i):e.slice()},i.rangeRound=function(o){return i.range(o).round(!0)},i.round=function(o){return arguments.length?(r=!!o,i):r},i.clamp=function(o){return arguments.length?(t.clamp(o),i):t.clamp()},i.unknown=function(o){return arguments.length?(n=o,i):n},i.copy=function(){return Fk(t.domain(),e).round(r).clamp(t.clamp()).unknown(n)},kr.apply(i,arguments),Ei(i)}function Uk(){var t=[],e=[],r=[],n;function i(){var s=0,l=Math.max(1,e.length);for(r=new Array(l-1);++s0?r[l-1]:t[0],l=r?[n[r-1],e]:[n[d-1],n[d]]},s.unknown=function(f){return arguments.length&&(o=f),s},s.thresholds=function(){return n.slice()},s.copy=function(){return Wk().domain([t,e]).range(i).unknown(o)},kr.apply(Ei(s),arguments)}function Vk(){var t=[.5],e=[0,1],r,n=1;function i(o){return o!=null&&o<=o?e[Ys(t,o,0,n)]:r}return i.domain=function(o){return arguments.length?(t=Array.from(o),n=Math.min(t.length,e.length-1),i):t.slice()},i.range=function(o){return arguments.length?(e=Array.from(o),n=Math.min(t.length,e.length-1),i):e.slice()},i.invertExtent=function(o){var s=e.indexOf(o);return[t[s-1],t[s]]},i.unknown=function(o){return arguments.length?(r=o,i):r},i.copy=function(){return Vk().domain(t).range(e).unknown(r)},kr.apply(i,arguments)}const Ey=new Date,Ty=new Date;function Pt(t,e,r,n){function i(o){return t(o=arguments.length===0?new Date:new Date(+o)),o}return i.floor=o=>(t(o=new Date(+o)),o),i.ceil=o=>(t(o=new Date(o-1)),e(o,1),t(o),o),i.round=o=>{const s=i(o),l=i.ceil(o);return o-s(e(o=new Date(+o),s==null?1:Math.floor(s)),o),i.range=(o,s,l)=>{const f=[];if(o=i.ceil(o),l=l==null?1:Math.floor(l),!(o0))return f;let d;do f.push(d=new Date(+o)),e(o,l),t(o);while(dPt(s=>{if(s>=s)for(;t(s),!o(s);)s.setTime(s-1)},(s,l)=>{if(s>=s)if(l<0)for(;++l<=0;)for(;e(s,-1),!o(s););else for(;--l>=0;)for(;e(s,1),!o(s););}),r&&(i.count=(o,s)=>(Ey.setTime(+o),Ty.setTime(+s),t(Ey),t(Ty),Math.floor(r(Ey,Ty))),i.every=o=>(o=Math.floor(o),!isFinite(o)||!(o>0)?null:o>1?i.filter(n?s=>n(s)%o===0:s=>i.count(0,s)%o===0):i)),i}const tf=Pt(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);tf.every=t=>(t=Math.floor(t),!isFinite(t)||!(t>0)?null:t>1?Pt(e=>{e.setTime(Math.floor(e/t)*t)},(e,r)=>{e.setTime(+e+r*t)},(e,r)=>(r-e)/t):tf);tf.range;const In=1e3,Er=In*60,Rn=Er*60,Fn=Rn*24,j0=Fn*7,CA=Fn*30,Cy=Fn*365,Ki=Pt(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+e*In)},(t,e)=>(e-t)/In,t=>t.getUTCSeconds());Ki.range;const N0=Pt(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*In)},(t,e)=>{t.setTime(+t+e*Er)},(t,e)=>(e-t)/Er,t=>t.getMinutes());N0.range;const M0=Pt(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*Er)},(t,e)=>(e-t)/Er,t=>t.getUTCMinutes());M0.range;const I0=Pt(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*In-t.getMinutes()*Er)},(t,e)=>{t.setTime(+t+e*Rn)},(t,e)=>(e-t)/Rn,t=>t.getHours());I0.range;const R0=Pt(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*Rn)},(t,e)=>(e-t)/Rn,t=>t.getUTCHours());R0.range;const el=Pt(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*Er)/Fn,t=>t.getDate()-1);el.range;const Jf=Pt(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/Fn,t=>t.getUTCDate()-1);Jf.range;const Hk=Pt(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/Fn,t=>Math.floor(t/Fn));Hk.range;function sa(t){return Pt(e=>{e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)},(e,r)=>{e.setDate(e.getDate()+r*7)},(e,r)=>(r-e-(r.getTimezoneOffset()-e.getTimezoneOffset())*Er)/j0)}const ed=sa(0),rf=sa(1),Zq=sa(2),Xq=sa(3),uo=sa(4),Yq=sa(5),Qq=sa(6);ed.range;rf.range;Zq.range;Xq.range;uo.range;Yq.range;Qq.range;function la(t){return Pt(e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)},(e,r)=>{e.setUTCDate(e.getUTCDate()+r*7)},(e,r)=>(r-e)/j0)}const td=la(0),nf=la(1),Jq=la(2),e4=la(3),so=la(4),t4=la(5),r4=la(6);td.range;nf.range;Jq.range;e4.range;so.range;t4.range;r4.range;const $0=Pt(t=>{t.setDate(1),t.setHours(0,0,0,0)},(t,e)=>{t.setMonth(t.getMonth()+e)},(t,e)=>e.getMonth()-t.getMonth()+(e.getFullYear()-t.getFullYear())*12,t=>t.getMonth());$0.range;const D0=Pt(t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCMonth(t.getUTCMonth()+e)},(t,e)=>e.getUTCMonth()-t.getUTCMonth()+(e.getUTCFullYear()-t.getUTCFullYear())*12,t=>t.getUTCMonth());D0.range;const Un=Pt(t=>{t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e)=>{t.setFullYear(t.getFullYear()+e)},(t,e)=>e.getFullYear()-t.getFullYear(),t=>t.getFullYear());Un.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:Pt(e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)},(e,r)=>{e.setFullYear(e.getFullYear()+r*t)});Un.range;const Wn=Pt(t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)},(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),t=>t.getUTCFullYear());Wn.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:Pt(e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,r)=>{e.setUTCFullYear(e.getUTCFullYear()+r*t)});Wn.range;function Gk(t,e,r,n,i,o){const s=[[Ki,1,In],[Ki,5,5*In],[Ki,15,15*In],[Ki,30,30*In],[o,1,Er],[o,5,5*Er],[o,15,15*Er],[o,30,30*Er],[i,1,Rn],[i,3,3*Rn],[i,6,6*Rn],[i,12,12*Rn],[n,1,Fn],[n,2,2*Fn],[r,1,j0],[e,1,CA],[e,3,3*CA],[t,1,Cy]];function l(d,h,m){const v=hx).right(s,v);if(g===s.length)return t.every(Gg(d/Cy,h/Cy,m));if(g===0)return tf.every(Math.max(Gg(d,h,m),1));const[_,w]=s[v/s[g-1][2]53)return null;"w"in ie||(ie.w=1),"Z"in ie?(ze=jy(ku(ie.y,0,1)),ft=ze.getUTCDay(),ze=ft>4||ft===0?nf.ceil(ze):nf(ze),ze=Jf.offset(ze,(ie.V-1)*7),ie.y=ze.getUTCFullYear(),ie.m=ze.getUTCMonth(),ie.d=ze.getUTCDate()+(ie.w+6)%7):(ze=ky(ku(ie.y,0,1)),ft=ze.getDay(),ze=ft>4||ft===0?rf.ceil(ze):rf(ze),ze=el.offset(ze,(ie.V-1)*7),ie.y=ze.getFullYear(),ie.m=ze.getMonth(),ie.d=ze.getDate()+(ie.w+6)%7)}else("W"in ie||"U"in ie)&&("w"in ie||(ie.w="u"in ie?ie.u%7:"W"in ie?1:0),ft="Z"in ie?jy(ku(ie.y,0,1)).getUTCDay():ky(ku(ie.y,0,1)).getDay(),ie.m=0,ie.d="W"in ie?(ie.w+6)%7+ie.W*7-(ft+5)%7:ie.w+ie.U*7-(ft+6)%7);return"Z"in ie?(ie.H+=ie.Z/100|0,ie.M+=ie.Z%100,jy(ie)):ky(ie)}}function N(oe,we,je,ie){for(var Xe=0,ze=we.length,ft=je.length,dt,At;Xe=ft)return-1;if(dt=we.charCodeAt(Xe++),dt===37){if(dt=we.charAt(Xe++),At=S[dt in kA?we.charAt(Xe++):dt],!At||(ie=At(oe,je,ie))<0)return-1}else if(dt!=je.charCodeAt(ie++))return-1}return ie}function I(oe,we,je){var ie=d.exec(we.slice(je));return ie?(oe.p=h.get(ie[0].toLowerCase()),je+ie[0].length):-1}function U(oe,we,je){var ie=g.exec(we.slice(je));return ie?(oe.w=_.get(ie[0].toLowerCase()),je+ie[0].length):-1}function $(oe,we,je){var ie=m.exec(we.slice(je));return ie?(oe.w=v.get(ie[0].toLowerCase()),je+ie[0].length):-1}function B(oe,we,je){var ie=O.exec(we.slice(je));return ie?(oe.m=P.get(ie[0].toLowerCase()),je+ie[0].length):-1}function V(oe,we,je){var ie=w.exec(we.slice(je));return ie?(oe.m=x.get(ie[0].toLowerCase()),je+ie[0].length):-1}function X(oe,we,je){return N(oe,e,we,je)}function Z(oe,we,je){return N(oe,r,we,je)}function Y(oe,we,je){return N(oe,n,we,je)}function te(oe){return s[oe.getDay()]}function H(oe){return o[oe.getDay()]}function Q(oe){return f[oe.getMonth()]}function ee(oe){return l[oe.getMonth()]}function M(oe){return i[+(oe.getHours()>=12)]}function F(oe){return 1+~~(oe.getMonth()/3)}function le(oe){return s[oe.getUTCDay()]}function ye(oe){return o[oe.getUTCDay()]}function _e(oe){return f[oe.getUTCMonth()]}function Ce(oe){return l[oe.getUTCMonth()]}function qe(oe){return i[+(oe.getUTCHours()>=12)]}function ke(oe){return 1+~~(oe.getUTCMonth()/3)}return{format:function(oe){var we=E(oe+="",A);return we.toString=function(){return oe},we},parse:function(oe){var we=k(oe+="",!1);return we.toString=function(){return oe},we},utcFormat:function(oe){var we=E(oe+="",C);return we.toString=function(){return oe},we},utcParse:function(oe){var we=k(oe+="",!0);return we.toString=function(){return oe},we}}}var kA={"-":"",_:" ",0:"0"},jt=/^\s*\d+/,s4=/^%/,l4=/[\\^$*+?|[\]().{}]/g;function Ve(t,e,r){var n=t<0?"-":"",i=(n?-t:t)+"",o=i.length;return n+(o[e.toLowerCase(),r]))}function f4(t,e,r){var n=jt.exec(e.slice(r,r+1));return n?(t.w=+n[0],r+n[0].length):-1}function d4(t,e,r){var n=jt.exec(e.slice(r,r+1));return n?(t.u=+n[0],r+n[0].length):-1}function p4(t,e,r){var n=jt.exec(e.slice(r,r+2));return n?(t.U=+n[0],r+n[0].length):-1}function h4(t,e,r){var n=jt.exec(e.slice(r,r+2));return n?(t.V=+n[0],r+n[0].length):-1}function m4(t,e,r){var n=jt.exec(e.slice(r,r+2));return n?(t.W=+n[0],r+n[0].length):-1}function jA(t,e,r){var n=jt.exec(e.slice(r,r+4));return n?(t.y=+n[0],r+n[0].length):-1}function NA(t,e,r){var n=jt.exec(e.slice(r,r+2));return n?(t.y=+n[0]+(+n[0]>68?1900:2e3),r+n[0].length):-1}function v4(t,e,r){var n=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(r,r+6));return n?(t.Z=n[1]?0:-(n[2]+(n[3]||"00")),r+n[0].length):-1}function y4(t,e,r){var n=jt.exec(e.slice(r,r+1));return n?(t.q=n[0]*3-3,r+n[0].length):-1}function g4(t,e,r){var n=jt.exec(e.slice(r,r+2));return n?(t.m=n[0]-1,r+n[0].length):-1}function MA(t,e,r){var n=jt.exec(e.slice(r,r+2));return n?(t.d=+n[0],r+n[0].length):-1}function b4(t,e,r){var n=jt.exec(e.slice(r,r+3));return n?(t.m=0,t.d=+n[0],r+n[0].length):-1}function IA(t,e,r){var n=jt.exec(e.slice(r,r+2));return n?(t.H=+n[0],r+n[0].length):-1}function x4(t,e,r){var n=jt.exec(e.slice(r,r+2));return n?(t.M=+n[0],r+n[0].length):-1}function w4(t,e,r){var n=jt.exec(e.slice(r,r+2));return n?(t.S=+n[0],r+n[0].length):-1}function _4(t,e,r){var n=jt.exec(e.slice(r,r+3));return n?(t.L=+n[0],r+n[0].length):-1}function S4(t,e,r){var n=jt.exec(e.slice(r,r+6));return n?(t.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function O4(t,e,r){var n=s4.exec(e.slice(r,r+1));return n?r+n[0].length:-1}function P4(t,e,r){var n=jt.exec(e.slice(r));return n?(t.Q=+n[0],r+n[0].length):-1}function A4(t,e,r){var n=jt.exec(e.slice(r));return n?(t.s=+n[0],r+n[0].length):-1}function RA(t,e){return Ve(t.getDate(),e,2)}function E4(t,e){return Ve(t.getHours(),e,2)}function T4(t,e){return Ve(t.getHours()%12||12,e,2)}function C4(t,e){return Ve(1+el.count(Un(t),t),e,3)}function Kk(t,e){return Ve(t.getMilliseconds(),e,3)}function k4(t,e){return Kk(t,e)+"000"}function j4(t,e){return Ve(t.getMonth()+1,e,2)}function N4(t,e){return Ve(t.getMinutes(),e,2)}function M4(t,e){return Ve(t.getSeconds(),e,2)}function I4(t){var e=t.getDay();return e===0?7:e}function R4(t,e){return Ve(ed.count(Un(t)-1,t),e,2)}function Zk(t){var e=t.getDay();return e>=4||e===0?uo(t):uo.ceil(t)}function $4(t,e){return t=Zk(t),Ve(uo.count(Un(t),t)+(Un(t).getDay()===4),e,2)}function D4(t){return t.getDay()}function L4(t,e){return Ve(rf.count(Un(t)-1,t),e,2)}function z4(t,e){return Ve(t.getFullYear()%100,e,2)}function B4(t,e){return t=Zk(t),Ve(t.getFullYear()%100,e,2)}function q4(t,e){return Ve(t.getFullYear()%1e4,e,4)}function F4(t,e){var r=t.getDay();return t=r>=4||r===0?uo(t):uo.ceil(t),Ve(t.getFullYear()%1e4,e,4)}function U4(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+Ve(e/60|0,"0",2)+Ve(e%60,"0",2)}function $A(t,e){return Ve(t.getUTCDate(),e,2)}function W4(t,e){return Ve(t.getUTCHours(),e,2)}function V4(t,e){return Ve(t.getUTCHours()%12||12,e,2)}function H4(t,e){return Ve(1+Jf.count(Wn(t),t),e,3)}function Xk(t,e){return Ve(t.getUTCMilliseconds(),e,3)}function G4(t,e){return Xk(t,e)+"000"}function K4(t,e){return Ve(t.getUTCMonth()+1,e,2)}function Z4(t,e){return Ve(t.getUTCMinutes(),e,2)}function X4(t,e){return Ve(t.getUTCSeconds(),e,2)}function Y4(t){var e=t.getUTCDay();return e===0?7:e}function Q4(t,e){return Ve(td.count(Wn(t)-1,t),e,2)}function Yk(t){var e=t.getUTCDay();return e>=4||e===0?so(t):so.ceil(t)}function J4(t,e){return t=Yk(t),Ve(so.count(Wn(t),t)+(Wn(t).getUTCDay()===4),e,2)}function eF(t){return t.getUTCDay()}function tF(t,e){return Ve(nf.count(Wn(t)-1,t),e,2)}function rF(t,e){return Ve(t.getUTCFullYear()%100,e,2)}function nF(t,e){return t=Yk(t),Ve(t.getUTCFullYear()%100,e,2)}function iF(t,e){return Ve(t.getUTCFullYear()%1e4,e,4)}function aF(t,e){var r=t.getUTCDay();return t=r>=4||r===0?so(t):so.ceil(t),Ve(t.getUTCFullYear()%1e4,e,4)}function oF(){return"+0000"}function DA(){return"%"}function LA(t){return+t}function zA(t){return Math.floor(+t/1e3)}var Da,Qk,Jk;uF({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function uF(t){return Da=u4(t),Qk=Da.format,Da.parse,Jk=Da.utcFormat,Da.utcParse,Da}function sF(t){return new Date(t)}function lF(t){return t instanceof Date?+t:+new Date(+t)}function L0(t,e,r,n,i,o,s,l,f,d){var h=O0(),m=h.invert,v=h.domain,g=d(".%L"),_=d(":%S"),w=d("%I:%M"),x=d("%I %p"),O=d("%a %d"),P=d("%b %d"),A=d("%B"),C=d("%Y");function S(E){return(f(E)e(i/(t.length-1)))},r.quantiles=function(n){return Array.from({length:n+1},(i,o)=>QB(t,o/n))},r.copy=function(){return nj(e).domain(t)},Gn.apply(r,arguments)}function nd(){var t=0,e=.5,r=1,n=1,i,o,s,l,f,d=Xt,h,m=!1,v;function g(w){return isNaN(w=+w)?v:(w=.5+((w=+h(w))-o)*(n*wr}return My=t,My}var Iy,UA;function mF(){if(UA)return Iy;UA=1;var t=uj(),e=hF(),r=No();function n(i){return i&&i.length?t(i,r,e):void 0}return Iy=n,Iy}var vF=mF();const id=Qe(vF);var Ry,WA;function yF(){if(WA)return Ry;WA=1;function t(e,r){return et.e^o.s<0?1:-1;for(n=o.d.length,i=t.d.length,e=0,r=nt.d[e]^o.s<0?1:-1;return n===i?0:n>i^o.s<0?1:-1};me.decimalPlaces=me.dp=function(){var t=this,e=t.d.length-1,r=(e-t.e)*at;if(e=t.d[e],e)for(;e%10==0;e/=10)r--;return r<0?0:r};me.dividedBy=me.div=function(t){return zn(this,new this.constructor(t))};me.dividedToIntegerBy=me.idiv=function(t){var e=this,r=e.constructor;return Ye(zn(e,new r(t),0,1),r.precision)};me.equals=me.eq=function(t){return!this.cmp(t)};me.exponent=function(){return xt(this)};me.greaterThan=me.gt=function(t){return this.cmp(t)>0};me.greaterThanOrEqualTo=me.gte=function(t){return this.cmp(t)>=0};me.isInteger=me.isint=function(){return this.e>this.d.length-2};me.isNegative=me.isneg=function(){return this.s<0};me.isPositive=me.ispos=function(){return this.s>0};me.isZero=function(){return this.s===0};me.lessThan=me.lt=function(t){return this.cmp(t)<0};me.lessThanOrEqualTo=me.lte=function(t){return this.cmp(t)<1};me.logarithm=me.log=function(t){var e,r=this,n=r.constructor,i=n.precision,o=i+5;if(t===void 0)t=new n(10);else if(t=new n(t),t.s<1||t.eq(mr))throw Error(Cr+"NaN");if(r.s<1)throw Error(Cr+(r.s?"NaN":"-Infinity"));return r.eq(mr)?new n(0):(ut=!1,e=zn(Ss(r,o),Ss(t,o),o),ut=!0,Ye(e,i))};me.minus=me.sub=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?fj(e,t):lj(e,(t.s=-t.s,t))};me.modulo=me.mod=function(t){var e,r=this,n=r.constructor,i=n.precision;if(t=new n(t),!t.s)throw Error(Cr+"NaN");return r.s?(ut=!1,e=zn(r,t,0,1).times(t),ut=!0,r.minus(e)):Ye(new n(r),i)};me.naturalExponential=me.exp=function(){return cj(this)};me.naturalLogarithm=me.ln=function(){return Ss(this)};me.negated=me.neg=function(){var t=new this.constructor(this);return t.s=-t.s||0,t};me.plus=me.add=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?lj(e,t):fj(e,(t.s=-t.s,t))};me.precision=me.sd=function(t){var e,r,n,i=this;if(t!==void 0&&t!==!!t&&t!==1&&t!==0)throw Error(Qi+t);if(e=xt(i)+1,n=i.d.length-1,r=n*at+1,n=i.d[n],n){for(;n%10==0;n/=10)r--;for(n=i.d[0];n>=10;n/=10)r++}return t&&e>r?e:r};me.squareRoot=me.sqrt=function(){var t,e,r,n,i,o,s,l=this,f=l.constructor;if(l.s<1){if(!l.s)return new f(0);throw Error(Cr+"NaN")}for(t=xt(l),ut=!1,i=Math.sqrt(+l),i==0||i==1/0?(e=sn(l.d),(e.length+t)%2==0&&(e+="0"),i=Math.sqrt(e),t=Ro((t+1)/2)-(t<0||t%2),i==1/0?e="5e"+t:(e=i.toExponential(),e=e.slice(0,e.indexOf("e")+1)+t),n=new f(e)):n=new f(i.toString()),r=f.precision,i=s=r+3;;)if(o=n,n=o.plus(zn(l,o,s+2)).times(.5),sn(o.d).slice(0,s)===(e=sn(n.d)).slice(0,s)){if(e=e.slice(s-3,s+1),i==s&&e=="4999"){if(Ye(o,r+1,0),o.times(o).eq(l)){n=o;break}}else if(e!="9999")break;s+=4}return ut=!0,Ye(n,r)};me.times=me.mul=function(t){var e,r,n,i,o,s,l,f,d,h=this,m=h.constructor,v=h.d,g=(t=new m(t)).d;if(!h.s||!t.s)return new m(0);for(t.s*=h.s,r=h.e+t.e,f=v.length,d=g.length,f=0;){for(e=0,i=f+n;i>n;)l=o[i]+g[n]*v[i-n-1]+e,o[i--]=l%kt|0,e=l/kt|0;o[i]=(o[i]+e)%kt|0}for(;!o[--s];)o.pop();return e?++r:o.shift(),t.d=o,t.e=r,ut?Ye(t,m.precision):t};me.toDecimalPlaces=me.todp=function(t,e){var r=this,n=r.constructor;return r=new n(r),t===void 0?r:(gn(t,0,Io),e===void 0?e=n.rounding:gn(e,0,8),Ye(r,t+xt(r)+1,e))};me.toExponential=function(t,e){var r,n=this,i=n.constructor;return t===void 0?r=na(n,!0):(gn(t,0,Io),e===void 0?e=i.rounding:gn(e,0,8),n=Ye(new i(n),t+1,e),r=na(n,!0,t+1)),r};me.toFixed=function(t,e){var r,n,i=this,o=i.constructor;return t===void 0?na(i):(gn(t,0,Io),e===void 0?e=o.rounding:gn(e,0,8),n=Ye(new o(i),t+xt(i)+1,e),r=na(n.abs(),!1,t+xt(n)+1),i.isneg()&&!i.isZero()?"-"+r:r)};me.toInteger=me.toint=function(){var t=this,e=t.constructor;return Ye(new e(t),xt(t)+1,e.rounding)};me.toNumber=function(){return+this};me.toPower=me.pow=function(t){var e,r,n,i,o,s,l=this,f=l.constructor,d=12,h=+(t=new f(t));if(!t.s)return new f(mr);if(l=new f(l),!l.s){if(t.s<1)throw Error(Cr+"Infinity");return l}if(l.eq(mr))return l;if(n=f.precision,t.eq(mr))return Ye(l,n);if(e=t.e,r=t.d.length-1,s=e>=r,o=l.s,s){if((r=h<0?-h:h)<=sj){for(i=new f(mr),e=Math.ceil(n/at+4),ut=!1;r%2&&(i=i.times(l),XA(i.d,e)),r=Ro(r/2),r!==0;)l=l.times(l),XA(l.d,e);return ut=!0,t.s<0?new f(mr).div(i):Ye(i,n)}}else if(o<0)throw Error(Cr+"NaN");return o=o<0&&t.d[Math.max(e,r)]&1?-1:1,l.s=1,ut=!1,i=t.times(Ss(l,n+d)),ut=!0,i=cj(i),i.s=o,i};me.toPrecision=function(t,e){var r,n,i=this,o=i.constructor;return t===void 0?(r=xt(i),n=na(i,r<=o.toExpNeg||r>=o.toExpPos)):(gn(t,1,Io),e===void 0?e=o.rounding:gn(e,0,8),i=Ye(new o(i),t,e),r=xt(i),n=na(i,t<=r||r<=o.toExpNeg,t)),n};me.toSignificantDigits=me.tosd=function(t,e){var r=this,n=r.constructor;return t===void 0?(t=n.precision,e=n.rounding):(gn(t,1,Io),e===void 0?e=n.rounding:gn(e,0,8)),Ye(new n(r),t,e)};me.toString=me.valueOf=me.val=me.toJSON=me[Symbol.for("nodejs.util.inspect.custom")]=function(){var t=this,e=xt(t),r=t.constructor;return na(t,e<=r.toExpNeg||e>=r.toExpPos)};function lj(t,e){var r,n,i,o,s,l,f,d,h=t.constructor,m=h.precision;if(!t.s||!e.s)return e.s||(e=new h(t)),ut?Ye(e,m):e;if(f=t.d,d=e.d,s=t.e,i=e.e,f=f.slice(),o=s-i,o){for(o<0?(n=f,o=-o,l=d.length):(n=d,i=s,l=f.length),s=Math.ceil(m/at),l=s>l?s+1:l+1,o>l&&(o=l,n.length=1),n.reverse();o--;)n.push(0);n.reverse()}for(l=f.length,o=d.length,l-o<0&&(o=l,n=d,d=f,f=n),r=0;o;)r=(f[--o]=f[o]+d[o]+r)/kt|0,f[o]%=kt;for(r&&(f.unshift(r),++i),l=f.length;f[--l]==0;)f.pop();return e.d=f,e.e=i,ut?Ye(e,m):e}function gn(t,e,r){if(t!==~~t||tr)throw Error(Qi+t)}function sn(t){var e,r,n,i=t.length-1,o="",s=t[0];if(i>0){for(o+=s,e=1;es?1:-1;else for(l=f=0;li[l]?1:-1;break}return f}function r(n,i,o){for(var s=0;o--;)n[o]-=s,s=n[o]1;)n.shift()}return function(n,i,o,s){var l,f,d,h,m,v,g,_,w,x,O,P,A,C,S,E,k,N,I=n.constructor,U=n.s==i.s?1:-1,$=n.d,B=i.d;if(!n.s)return new I(n);if(!i.s)throw Error(Cr+"Division by zero");for(f=n.e-i.e,k=B.length,S=$.length,g=new I(U),_=g.d=[],d=0;B[d]==($[d]||0);)++d;if(B[d]>($[d]||0)&&--f,o==null?P=o=I.precision:s?P=o+(xt(n)-xt(i))+1:P=o,P<0)return new I(0);if(P=P/at+2|0,d=0,k==1)for(h=0,B=B[0],P++;(d1&&(B=t(B,h),$=t($,h),k=B.length,S=$.length),C=k,w=$.slice(0,k),x=w.length;x=kt/2&&++E;do h=0,l=e(B,w,k,x),l<0?(O=w[0],k!=x&&(O=O*kt+(w[1]||0)),h=O/E|0,h>1?(h>=kt&&(h=kt-1),m=t(B,h),v=m.length,x=w.length,l=e(m,w,v,x),l==1&&(h--,r(m,k16)throw Error(q0+xt(t));if(!t.s)return new h(mr);for(e==null?(ut=!1,l=m):l=e,s=new h(.03125);t.abs().gte(.1);)t=t.times(s),d+=5;for(n=Math.log(Vi(2,d))/Math.LN10*2+5|0,l+=n,r=i=o=new h(mr),h.precision=l;;){if(i=Ye(i.times(t),l),r=r.times(++f),s=o.plus(zn(i,r,l)),sn(s.d).slice(0,l)===sn(o.d).slice(0,l)){for(;d--;)o=Ye(o.times(o),l);return h.precision=m,e==null?(ut=!0,Ye(o,m)):o}o=s}}function xt(t){for(var e=t.e*at,r=t.d[0];r>=10;r/=10)e++;return e}function By(t,e,r){if(e>t.LN10.sd())throw ut=!0,r&&(t.precision=r),Error(Cr+"LN10 precision limit exceeded");return Ye(new t(t.LN10),e)}function mi(t){for(var e="";t--;)e+="0";return e}function Ss(t,e){var r,n,i,o,s,l,f,d,h,m=1,v=10,g=t,_=g.d,w=g.constructor,x=w.precision;if(g.s<1)throw Error(Cr+(g.s?"NaN":"-Infinity"));if(g.eq(mr))return new w(0);if(e==null?(ut=!1,d=x):d=e,g.eq(10))return e==null&&(ut=!0),By(w,d);if(d+=v,w.precision=d,r=sn(_),n=r.charAt(0),o=xt(g),Math.abs(o)<15e14){for(;n<7&&n!=1||n==1&&r.charAt(1)>3;)g=g.times(t),r=sn(g.d),n=r.charAt(0),m++;o=xt(g),n>1?(g=new w("0."+r),o++):g=new w(n+"."+r.slice(1))}else return f=By(w,d+2,x).times(o+""),g=Ss(new w(n+"."+r.slice(1)),d-v).plus(f),w.precision=x,e==null?(ut=!0,Ye(g,x)):g;for(l=s=g=zn(g.minus(mr),g.plus(mr),d),h=Ye(g.times(g),d),i=3;;){if(s=Ye(s.times(h),d),f=l.plus(zn(s,new w(i),d)),sn(f.d).slice(0,d)===sn(l.d).slice(0,d))return l=l.times(2),o!==0&&(l=l.plus(By(w,d+2,x).times(o+""))),l=zn(l,new w(m),d),w.precision=x,e==null?(ut=!0,Ye(l,x)):l;l=f,i+=2}}function ZA(t,e){var r,n,i;for((r=e.indexOf("."))>-1&&(e=e.replace(".","")),(n=e.search(/e/i))>0?(r<0&&(r=n),r+=+e.slice(n+1),e=e.substring(0,n)):r<0&&(r=e.length),n=0;e.charCodeAt(n)===48;)++n;for(i=e.length;e.charCodeAt(i-1)===48;)--i;if(e=e.slice(n,i),e){if(i-=n,r=r-n-1,t.e=Ro(r/at),t.d=[],n=(r+1)%at,r<0&&(n+=at),naf||t.e<-af))throw Error(q0+r)}else t.s=0,t.e=0,t.d=[0];return t}function Ye(t,e,r){var n,i,o,s,l,f,d,h,m=t.d;for(s=1,o=m[0];o>=10;o/=10)s++;if(n=e-s,n<0)n+=at,i=e,d=m[h=0];else{if(h=Math.ceil((n+1)/at),o=m.length,h>=o)return t;for(d=o=m[h],s=1;o>=10;o/=10)s++;n%=at,i=n-at+s}if(r!==void 0&&(o=Vi(10,s-i-1),l=d/o%10|0,f=e<0||m[h+1]!==void 0||d%o,f=r<4?(l||f)&&(r==0||r==(t.s<0?3:2)):l>5||l==5&&(r==4||f||r==6&&(n>0?i>0?d/Vi(10,s-i):0:m[h-1])%10&1||r==(t.s<0?8:7))),e<1||!m[0])return f?(o=xt(t),m.length=1,e=e-o-1,m[0]=Vi(10,(at-e%at)%at),t.e=Ro(-e/at)||0):(m.length=1,m[0]=t.e=t.s=0),t;if(n==0?(m.length=h,o=1,h--):(m.length=h+1,o=Vi(10,at-n),m[h]=i>0?(d/Vi(10,s-i)%Vi(10,i)|0)*o:0),f)for(;;)if(h==0){(m[0]+=o)==kt&&(m[0]=1,++t.e);break}else{if(m[h]+=o,m[h]!=kt)break;m[h--]=0,o=1}for(n=m.length;m[--n]===0;)m.pop();if(ut&&(t.e>af||t.e<-af))throw Error(q0+xt(t));return t}function fj(t,e){var r,n,i,o,s,l,f,d,h,m,v=t.constructor,g=v.precision;if(!t.s||!e.s)return e.s?e.s=-e.s:e=new v(t),ut?Ye(e,g):e;if(f=t.d,m=e.d,n=e.e,d=t.e,f=f.slice(),s=d-n,s){for(h=s<0,h?(r=f,s=-s,l=m.length):(r=m,n=d,l=f.length),i=Math.max(Math.ceil(g/at),l)+2,s>i&&(s=i,r.length=1),r.reverse(),i=s;i--;)r.push(0);r.reverse()}else{for(i=f.length,l=m.length,h=i0;--i)f[l++]=0;for(i=m.length;i>s;){if(f[--i]0?o=o.charAt(0)+"."+o.slice(1)+mi(n):s>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(i<0?"e":"e+")+i):i<0?(o="0."+mi(-i-1)+o,r&&(n=r-s)>0&&(o+=mi(n))):i>=s?(o+=mi(i+1-s),r&&(n=r-i-1)>0&&(o=o+"."+mi(n))):((n=i+1)0&&(i+1===s&&(o+="."),o+=mi(n))),t.s<0?"-"+o:o}function XA(t,e){if(t.length>e)return t.length=e,!0}function dj(t){var e,r,n;function i(o){var s=this;if(!(s instanceof i))return new i(o);if(s.constructor=i,o instanceof i){s.s=o.s,s.e=o.e,s.d=(o=o.d)?o.slice():o;return}if(typeof o=="number"){if(o*0!==0)throw Error(Qi+o);if(o>0)s.s=1;else if(o<0)o=-o,s.s=-1;else{s.s=0,s.e=0,s.d=[0];return}if(o===~~o&&o<1e7){s.e=0,s.d=[o];return}return ZA(s,o.toString())}else if(typeof o!="string")throw Error(Qi+o);if(o.charCodeAt(0)===45?(o=o.slice(1),s.s=-1):s.s=1,EF.test(o))ZA(s,o);else throw Error(Qi+o)}if(i.prototype=me,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.clone=dj,i.config=i.set=TF,t===void 0&&(t={}),t)for(n=["precision","rounding","toExpNeg","toExpPos","LN10"],e=0;e=i[e+1]&&n<=i[e+2])this[r]=n;else throw Error(Qi+r+": "+n);if((n=t[r="LN10"])!==void 0)if(n==Math.LN10)this[r]=new this(n);else throw Error(Qi+r+": "+n);return this}var F0=dj(AF);mr=new F0(1);const Ze=F0;function CF(t){return MF(t)||NF(t)||jF(t)||kF()}function kF(){throw new TypeError(`Invalid attempt to spread non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function jF(t,e){if(t){if(typeof t=="string")return Qg(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Qg(t,e)}}function NF(t){if(typeof Symbol<"u"&&Symbol.iterator in Object(t))return Array.from(t)}function MF(t){if(Array.isArray(t))return Qg(t)}function Qg(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r=e?r.apply(void 0,i):t(e-s,YA(function(){for(var l=arguments.length,f=new Array(l),d=0;dt.length)&&(e=t.length);for(var r=0,n=new Array(e);r"u"||!(Symbol.iterator in Object(t)))){var r=[],n=!0,i=!1,o=void 0;try{for(var s=t[Symbol.iterator](),l;!(n=(l=s.next()).done)&&(r.push(l.value),!(e&&r.length===e));n=!0);}catch(f){i=!0,o=f}finally{try{!n&&s.return!=null&&s.return()}finally{if(i)throw o}}return r}}function KF(t){if(Array.isArray(t))return t}function yj(t){var e=Os(t,2),r=e[0],n=e[1],i=r,o=n;return r>n&&(i=n,o=r),[i,o]}function gj(t,e,r){if(t.lte(0))return new Ze(0);var n=ud.getDigitCount(t.toNumber()),i=new Ze(10).pow(n),o=t.div(i),s=n!==1?.05:.1,l=new Ze(Math.ceil(o.div(s).toNumber())).add(r).mul(s),f=l.mul(i);return e?f:new Ze(Math.ceil(f))}function ZF(t,e,r){var n=1,i=new Ze(t);if(!i.isint()&&r){var o=Math.abs(t);o<1?(n=new Ze(10).pow(ud.getDigitCount(t)-1),i=new Ze(Math.floor(i.div(n).toNumber())).mul(n)):o>1&&(i=new Ze(Math.floor(t)))}else t===0?i=new Ze(Math.floor((e-1)/2)):r||(i=new Ze(Math.floor(t)));var s=Math.floor((e-1)/2),l=DF($F(function(f){return i.add(new Ze(f-s).mul(n)).toNumber()}),Jg);return l(0,e)}function bj(t,e,r,n){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((e-t)/(r-1)))return{step:new Ze(0),tickMin:new Ze(0),tickMax:new Ze(0)};var o=gj(new Ze(e).sub(t).div(r-1),n,i),s;t<=0&&e>=0?s=new Ze(0):(s=new Ze(t).add(e).div(2),s=s.sub(new Ze(s).mod(o)));var l=Math.ceil(s.sub(t).div(o).toNumber()),f=Math.ceil(new Ze(e).sub(s).div(o).toNumber()),d=l+f+1;return d>r?bj(t,e,r,n,i+1):(d0?f+(r-d):f,l=e>0?l:l+(r-d)),{step:o,tickMin:s.sub(new Ze(l).mul(o)),tickMax:s.add(new Ze(f).mul(o))})}function XF(t){var e=Os(t,2),r=e[0],n=e[1],i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,s=Math.max(i,2),l=yj([r,n]),f=Os(l,2),d=f[0],h=f[1];if(d===-1/0||h===1/0){var m=h===1/0?[d].concat(tb(Jg(0,i-1).map(function(){return 1/0}))):[].concat(tb(Jg(0,i-1).map(function(){return-1/0})),[h]);return r>n?eb(m):m}if(d===h)return ZF(d,i,o);var v=bj(d,h,s,o),g=v.step,_=v.tickMin,w=v.tickMax,x=ud.rangeStep(_,w.add(new Ze(.1).mul(g)),g);return r>n?eb(x):x}function YF(t,e){var r=Os(t,2),n=r[0],i=r[1],o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,s=yj([n,i]),l=Os(s,2),f=l[0],d=l[1];if(f===-1/0||d===1/0)return[n,i];if(f===d)return[f];var h=Math.max(e,2),m=gj(new Ze(d).sub(f).div(h-1),o,0),v=[].concat(tb(ud.rangeStep(new Ze(f),new Ze(d).sub(new Ze(.99).mul(m)),m)),[d]);return n>i?eb(v):v}var QF=mj(XF),JF=mj(YF),e8="Invariant failed";function ia(t,e){throw new Error(e8)}var t8=["offset","layout","width","dataKey","data","dataPointFormatter","xAxis","yAxis"];function lo(t){"@babel/helpers - typeof";return lo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},lo(t)}function of(){return of=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var r=0,n=new Array(e);r=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function s8(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}function l8(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function c8(t,e){for(var r=0;rt.length)&&(e=t.length);for(var r=0,n=new Array(e);r1&&arguments[1]!==void 0?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0,o=arguments.length>3?arguments[3]:void 0,s=-1,l=(r=n==null?void 0:n.length)!==null&&r!==void 0?r:0;if(l<=1)return 0;if(o&&o.axisType==="angleAxis"&&Math.abs(Math.abs(o.range[1]-o.range[0])-360)<=1e-6)for(var f=o.range,d=0;d0?i[d-1].coordinate:i[l-1].coordinate,m=i[d].coordinate,v=d>=l-1?i[0].coordinate:i[d+1].coordinate,g=void 0;if(Gr(m-h)!==Gr(v-m)){var _=[];if(Gr(v-m)===Gr(f[1]-f[0])){g=v;var w=m+f[1]-f[0];_[0]=Math.min(w,(w+h)/2),_[1]=Math.max(w,(w+h)/2)}else{g=h;var x=v+f[1]-f[0];_[0]=Math.min(m,(x+m)/2),_[1]=Math.max(m,(x+m)/2)}var O=[Math.min(m,(g+m)/2),Math.max(m,(g+m)/2)];if(e>O[0]&&e<=O[1]||e>=_[0]&&e<=_[1]){s=i[d].index;break}}else{var P=Math.min(h,v),A=Math.max(h,v);if(e>(P+m)/2&&e<=(A+m)/2){s=i[d].index;break}}}else for(var C=0;C0&&C(n[C].coordinate+n[C-1].coordinate)/2&&e<=(n[C].coordinate+n[C+1].coordinate)/2||C===l-1&&e>(n[C].coordinate+n[C-1].coordinate)/2){s=n[C].index;break}return s},U0=function(e){var r,n=e,i=n.type.displayName,o=(r=e.type)!==null&&r!==void 0&&r.defaultProps?ht(ht({},e.type.defaultProps),e.props):e.props,s=o.stroke,l=o.fill,f;switch(i){case"Line":f=s;break;case"Area":case"Radar":f=s&&s!=="none"?s:l;break;default:f=l;break}return f},E8=function(e){var r=e.barSize,n=e.totalSize,i=e.stackGroups,o=i===void 0?{}:i;if(!o)return{};for(var s={},l=Object.keys(o),f=0,d=l.length;f=0});if(O&&O.length){var P=O[0].type.defaultProps,A=P!==void 0?ht(ht({},P),O[0].props):O[0].props,C=A.barSize,S=A[x];s[S]||(s[S]=[]);var E=Ne(C)?r:C;s[S].push({item:O[0],stackList:O.slice(1),barSize:Ne(E)?void 0:ra(E,n,0)})}}return s},T8=function(e){var r=e.barGap,n=e.barCategoryGap,i=e.bandSize,o=e.sizeList,s=o===void 0?[]:o,l=e.maxBarSize,f=s.length;if(f<1)return null;var d=ra(r,i,0,!0),h,m=[];if(s[0].barSize===+s[0].barSize){var v=!1,g=i/f,_=s.reduce(function(C,S){return C+S.barSize||0},0);_+=(f-1)*d,_>=i&&(_-=(f-1)*d,d=0),_>=i&&g>0&&(v=!0,g*=.9,_=f*g);var w=(i-_)/2>>0,x={offset:w-d,size:0};h=s.reduce(function(C,S){var E={item:S.item,position:{offset:x.offset+x.size+d,size:v?g:S.barSize}},k=[].concat(eE(C),[E]);return x=k[k.length-1].position,S.stackList&&S.stackList.length&&S.stackList.forEach(function(N){k.push({item:N,position:x})}),k},m)}else{var O=ra(n,i,0,!0);i-2*O-(f-1)*d<=0&&(d=0);var P=(i-2*O-(f-1)*d)/f;P>1&&(P>>=0);var A=l===+l?Math.min(P,l):P;h=s.reduce(function(C,S,E){var k=[].concat(eE(C),[{item:S.item,position:{offset:O+(P+d)*E+(P-A)/2,size:A}}]);return S.stackList&&S.stackList.length&&S.stackList.forEach(function(N){k.push({item:N,position:k[k.length-1].position})}),k},m)}return h},C8=function(e,r,n,i){var o=n.children,s=n.width,l=n.margin,f=s-(l.left||0)-(l.right||0),d=Sj({children:o,legendWidth:f});if(d){var h=i||{},m=h.width,v=h.height,g=d.align,_=d.verticalAlign,w=d.layout;if((w==="vertical"||w==="horizontal"&&_==="middle")&&g!=="center"&&ce(e[g]))return ht(ht({},e),{},Xa({},g,e[g]+(m||0)));if((w==="horizontal"||w==="vertical"&&g==="center")&&_!=="middle"&&ce(e[_]))return ht(ht({},e),{},Xa({},_,e[_]+(v||0)))}return e},k8=function(e,r,n){return Ne(r)?!0:e==="horizontal"?r==="yAxis":e==="vertical"||n==="x"?r==="xAxis":n==="y"?r==="yAxis":!0},Oj=function(e,r,n,i,o){var s=r.props.children,l=or(s,$o).filter(function(d){return k8(i,o,d.props.direction)});if(l&&l.length){var f=l.map(function(d){return d.props.dataKey});return e.reduce(function(d,h){var m=$t(h,n);if(Ne(m))return d;var v=Array.isArray(m)?[ad(m),id(m)]:[m,m],g=f.reduce(function(_,w){var x=$t(h,w,0),O=v[0]-Math.abs(Array.isArray(x)?x[0]:x),P=v[1]+Math.abs(Array.isArray(x)?x[1]:x);return[Math.min(O,_[0]),Math.max(P,_[1])]},[1/0,-1/0]);return[Math.min(g[0],d[0]),Math.max(g[1],d[1])]},[1/0,-1/0])}return null},j8=function(e,r,n,i,o){var s=r.map(function(l){return Oj(e,l,n,o,i)}).filter(function(l){return!Ne(l)});return s&&s.length?s.reduce(function(l,f){return[Math.min(l[0],f[0]),Math.max(l[1],f[1])]},[1/0,-1/0]):null},Pj=function(e,r,n,i,o){var s=r.map(function(f){var d=f.props.dataKey;return n==="number"&&d&&Oj(e,f,d,i)||Vu(e,d,n,o)});if(n==="number")return s.reduce(function(f,d){return[Math.min(f[0],d[0]),Math.max(f[1],d[1])]},[1/0,-1/0]);var l={};return s.reduce(function(f,d){for(var h=0,m=d.length;h=2?Gr(l[0]-l[1])*2*d:d,r&&(e.ticks||e.niceTicks)){var h=(e.ticks||e.niceTicks).map(function(m){var v=o?o.indexOf(m):m;return{coordinate:i(v)+d,value:m,offset:d}});return h.filter(function(m){return!Zs(m.coordinate)})}return e.isCategorical&&e.categoricalDomain?e.categoricalDomain.map(function(m,v){return{coordinate:i(m)+d,value:m,index:v,offset:d}}):i.ticks&&!n?i.ticks(e.tickCount).map(function(m){return{coordinate:i(m)+d,value:m,offset:d}}):i.domain().map(function(m,v){return{coordinate:i(m)+d,value:o?o[m]:m,index:v,offset:d}})},qy=new WeakMap,wc=function(e,r){if(typeof r!="function")return e;qy.has(e)||qy.set(e,new WeakMap);var n=qy.get(e);if(n.has(r))return n.get(r);var i=function(){e.apply(void 0,arguments),r.apply(void 0,arguments)};return n.set(r,i),i},N8=function(e,r,n){var i=e.scale,o=e.type,s=e.layout,l=e.axisType;if(i==="auto")return s==="radial"&&l==="radiusAxis"?{scale:gs(),realScaleType:"band"}:s==="radial"&&l==="angleAxis"?{scale:ef(),realScaleType:"linear"}:o==="category"&&r&&(r.indexOf("LineChart")>=0||r.indexOf("AreaChart")>=0||r.indexOf("ComposedChart")>=0&&!n)?{scale:Wu(),realScaleType:"point"}:o==="category"?{scale:gs(),realScaleType:"band"}:{scale:ef(),realScaleType:"linear"};if(Ks(i)){var f="scale".concat(Wf(i));return{scale:(BA[f]||Wu)(),realScaleType:BA[f]?f:"point"}}return Re(i)?{scale:i}:{scale:Wu(),realScaleType:"point"}},rE=1e-4,M8=function(e){var r=e.domain();if(!(!r||r.length<=2)){var n=r.length,i=e.range(),o=Math.min(i[0],i[1])-rE,s=Math.max(i[0],i[1])+rE,l=e(r[0]),f=e(r[n-1]);(ls||fs)&&e.domain([r[0],r[n-1]])}},I8=function(e,r){if(!e)return null;for(var n=0,i=e.length;ni)&&(o[1]=i),o[0]>i&&(o[0]=i),o[1]=0?(e[l][n][0]=o,e[l][n][1]=o+f,o=e[l][n][1]):(e[l][n][0]=s,e[l][n][1]=s+f,s=e[l][n][1])}},D8=function(e){var r=e.length;if(!(r<=0))for(var n=0,i=e[0].length;n=0?(e[s][n][0]=o,e[s][n][1]=o+l,o=e[s][n][1]):(e[s][n][0]=0,e[s][n][1]=0)}},L8={sign:$8,expand:xL,none:to,silhouette:wL,wiggle:_L,positive:D8},z8=function(e,r,n){var i=r.map(function(l){return l.props.dataKey}),o=L8[n],s=bL().keys(i).value(function(l,f){return+$t(l,f,0)}).order(Ig).offset(o);return s(e)},B8=function(e,r,n,i,o,s){if(!e)return null;var l=s?r.reverse():r,f={},d=l.reduce(function(m,v){var g,_=(g=v.type)!==null&&g!==void 0&&g.defaultProps?ht(ht({},v.type.defaultProps),v.props):v.props,w=_.stackId,x=_.hide;if(x)return m;var O=_[n],P=m[O]||{hasStack:!1,stackGroups:{}};if(Ot(w)){var A=P.stackGroups[w]||{numericAxisId:n,cateAxisId:i,items:[]};A.items.push(v),P.hasStack=!0,P.stackGroups[w]=A}else P.stackGroups[jo("_stackId_")]={numericAxisId:n,cateAxisId:i,items:[v]};return ht(ht({},m),{},Xa({},O,P))},f),h={};return Object.keys(d).reduce(function(m,v){var g=d[v];if(g.hasStack){var _={};g.stackGroups=Object.keys(g.stackGroups).reduce(function(w,x){var O=g.stackGroups[x];return ht(ht({},w),{},Xa({},x,{numericAxisId:n,cateAxisId:i,items:O.items,stackedData:z8(e,O.items,o)}))},_)}return ht(ht({},m),{},Xa({},v,g))},h)},q8=function(e,r){var n=r.realScaleType,i=r.type,o=r.tickCount,s=r.originalDomain,l=r.allowDecimals,f=n||r.scale;if(f!=="auto"&&f!=="linear")return null;if(o&&i==="number"&&s&&(s[0]==="auto"||s[1]==="auto")){var d=e.domain();if(!d.length)return null;var h=QF(d,o,l);return e.domain([ad(h),id(h)]),{niceTicks:h}}if(o&&i==="number"){var m=e.domain(),v=JF(m,o,l);return{niceTicks:v}}return null};function sf(t){var e=t.axis,r=t.ticks,n=t.bandSize,i=t.entry,o=t.index,s=t.dataKey;if(e.type==="category"){if(!e.allowDuplicatedCategory&&e.dataKey&&!Ne(i[e.dataKey])){var l=Rc(r,"value",i[e.dataKey]);if(l)return l.coordinate+n/2}return r[o]?r[o].coordinate+n/2:null}var f=$t(i,Ne(s)?e.dataKey:s);return Ne(f)?null:e.scale(f)}var nE=function(e){var r=e.axis,n=e.ticks,i=e.offset,o=e.bandSize,s=e.entry,l=e.index;if(r.type==="category")return n[l]?n[l].coordinate+i:null;var f=$t(s,r.dataKey,r.domain[l]);return Ne(f)?null:r.scale(f)-o/2+i},F8=function(e){var r=e.numericAxis,n=r.scale.domain();if(r.type==="number"){var i=Math.min(n[0],n[1]),o=Math.max(n[0],n[1]);return i<=0&&o>=0?0:o<0?o:i}return n[0]},U8=function(e,r){var n,i=(n=e.type)!==null&&n!==void 0&&n.defaultProps?ht(ht({},e.type.defaultProps),e.props):e.props,o=i.stackId;if(Ot(o)){var s=r[o];if(s){var l=s.items.indexOf(e);return l>=0?s.stackedData[l]:null}}return null},W8=function(e){return e.reduce(function(r,n){return[ad(n.concat([r[0]]).filter(ce)),id(n.concat([r[1]]).filter(ce))]},[1/0,-1/0])},Tj=function(e,r,n){return Object.keys(e).reduce(function(i,o){var s=e[o],l=s.stackedData,f=l.reduce(function(d,h){var m=W8(h.slice(r,n+1));return[Math.min(d[0],m[0]),Math.max(d[1],m[1])]},[1/0,-1/0]);return[Math.min(f[0],i[0]),Math.max(f[1],i[1])]},[1/0,-1/0]).map(function(i){return i===1/0||i===-1/0?0:i})},iE=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,aE=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,ab=function(e,r,n){if(Re(e))return e(r,n);if(!Array.isArray(e))return r;var i=[];if(ce(e[0]))i[0]=n?e[0]:Math.min(e[0],r[0]);else if(iE.test(e[0])){var o=+iE.exec(e[0])[1];i[0]=r[0]-o}else Re(e[0])?i[0]=e[0](r[0]):i[0]=r[0];if(ce(e[1]))i[1]=n?e[1]:Math.max(e[1],r[1]);else if(aE.test(e[1])){var s=+aE.exec(e[1])[1];i[1]=r[1]+s}else Re(e[1])?i[1]=e[1](r[1]):i[1]=r[1];return i},lf=function(e,r,n){if(e&&e.scale&&e.scale.bandwidth){var i=e.scale.bandwidth();if(!n||i>0)return i}if(e&&r&&r.length>=2){for(var o=v0(r,function(m){return m.coordinate}),s=1/0,l=1,f=o.length;ls&&(d=2*Math.PI-d),{radius:l,angle:K8(d),angleInRadian:d}},Y8=function(e){var r=e.startAngle,n=e.endAngle,i=Math.floor(r/360),o=Math.floor(n/360),s=Math.min(i,o);return{startAngle:r-s*360,endAngle:n-s*360}},Q8=function(e,r){var n=r.startAngle,i=r.endAngle,o=Math.floor(n/360),s=Math.floor(i/360),l=Math.min(o,s);return e+l*360},lE=function(e,r){var n=e.x,i=e.y,o=X8({x:n,y:i},r),s=o.radius,l=o.angle,f=r.innerRadius,d=r.outerRadius;if(sd)return!1;if(s===0)return!0;var h=Y8(r),m=h.startAngle,v=h.endAngle,g=l,_;if(m<=v){for(;g>v;)g-=360;for(;g=m&&g<=v}else{for(;g>m;)g-=360;for(;g=v&&g<=m}return _?sE(sE({},r),{},{radius:s,angle:Q8(g,r)}):null};function Ts(t){"@babel/helpers - typeof";return Ts=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ts(t)}var J8=["offset"];function e5(t){return i5(t)||n5(t)||r5(t)||t5()}function t5(){throw new TypeError(`Invalid attempt to spread non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function r5(t,e){if(t){if(typeof t=="string")return ob(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ob(t,e)}}function n5(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function i5(t){if(Array.isArray(t))return ob(t)}function ob(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function o5(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}function cE(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function St(t){for(var e=1;e=0?1:-1,A,C;i==="insideStart"?(A=g+P*s,C=w):i==="insideEnd"?(A=_-P*s,C=!w):i==="end"&&(A=_+P*s,C=w),C=O<=0?C:!C;var S=Rt(d,h,x,A),E=Rt(d,h,x,A+(C?1:-1)*359),k="M".concat(S.x,",").concat(S.y,` + A`).concat(x,",").concat(x,",0,1,").concat(C?0:1,`, + `).concat(E.x,",").concat(E.y),N=Ne(e.id)?jo("recharts-radial-line-"):e.id;return L.createElement("text",Cs({},n,{dominantBaseline:"central",className:Be("recharts-radial-bar-label",l)}),L.createElement("defs",null,L.createElement("path",{id:N,d:k})),L.createElement("textPath",{xlinkHref:"#".concat(N)},r))},p5=function(e){var r=e.viewBox,n=e.offset,i=e.position,o=r,s=o.cx,l=o.cy,f=o.innerRadius,d=o.outerRadius,h=o.startAngle,m=o.endAngle,v=(h+m)/2;if(i==="outside"){var g=Rt(s,l,d+n,v),_=g.x,w=g.y;return{x:_,y:w,textAnchor:_>=s?"start":"end",verticalAnchor:"middle"}}if(i==="center")return{x:s,y:l,textAnchor:"middle",verticalAnchor:"middle"};if(i==="centerTop")return{x:s,y:l,textAnchor:"middle",verticalAnchor:"start"};if(i==="centerBottom")return{x:s,y:l,textAnchor:"middle",verticalAnchor:"end"};var x=(f+d)/2,O=Rt(s,l,x,v),P=O.x,A=O.y;return{x:P,y:A,textAnchor:"middle",verticalAnchor:"middle"}},h5=function(e){var r=e.viewBox,n=e.parentViewBox,i=e.offset,o=e.position,s=r,l=s.x,f=s.y,d=s.width,h=s.height,m=h>=0?1:-1,v=m*i,g=m>0?"end":"start",_=m>0?"start":"end",w=d>=0?1:-1,x=w*i,O=w>0?"end":"start",P=w>0?"start":"end";if(o==="top"){var A={x:l+d/2,y:f-m*i,textAnchor:"middle",verticalAnchor:g};return St(St({},A),n?{height:Math.max(f-n.y,0),width:d}:{})}if(o==="bottom"){var C={x:l+d/2,y:f+h+v,textAnchor:"middle",verticalAnchor:_};return St(St({},C),n?{height:Math.max(n.y+n.height-(f+h),0),width:d}:{})}if(o==="left"){var S={x:l-x,y:f+h/2,textAnchor:O,verticalAnchor:"middle"};return St(St({},S),n?{width:Math.max(S.x-n.x,0),height:h}:{})}if(o==="right"){var E={x:l+d+x,y:f+h/2,textAnchor:P,verticalAnchor:"middle"};return St(St({},E),n?{width:Math.max(n.x+n.width-E.x,0),height:h}:{})}var k=n?{width:d,height:h}:{};return o==="insideLeft"?St({x:l+x,y:f+h/2,textAnchor:P,verticalAnchor:"middle"},k):o==="insideRight"?St({x:l+d-x,y:f+h/2,textAnchor:O,verticalAnchor:"middle"},k):o==="insideTop"?St({x:l+d/2,y:f+v,textAnchor:"middle",verticalAnchor:_},k):o==="insideBottom"?St({x:l+d/2,y:f+h-v,textAnchor:"middle",verticalAnchor:g},k):o==="insideTopLeft"?St({x:l+x,y:f+v,textAnchor:P,verticalAnchor:_},k):o==="insideTopRight"?St({x:l+d-x,y:f+v,textAnchor:O,verticalAnchor:_},k):o==="insideBottomLeft"?St({x:l+x,y:f+h-v,textAnchor:P,verticalAnchor:g},k):o==="insideBottomRight"?St({x:l+d-x,y:f+h-v,textAnchor:O,verticalAnchor:g},k):ko(o)&&(ce(o.x)||Hi(o.x))&&(ce(o.y)||Hi(o.y))?St({x:l+ra(o.x,d),y:f+ra(o.y,h),textAnchor:"end",verticalAnchor:"end"},k):St({x:l+d/2,y:f+h/2,textAnchor:"middle",verticalAnchor:"middle"},k)},m5=function(e){return"cx"in e&&ce(e.cx)};function Ft(t){var e=t.offset,r=e===void 0?5:e,n=a5(t,J8),i=St({offset:r},n),o=i.viewBox,s=i.position,l=i.value,f=i.children,d=i.content,h=i.className,m=h===void 0?"":h,v=i.textBreakAll;if(!o||Ne(l)&&Ne(f)&&!R.isValidElement(d)&&!Re(d))return null;if(R.isValidElement(d))return R.cloneElement(d,i);var g;if(Re(d)){if(g=R.createElement(d,i),R.isValidElement(g))return g}else g=c5(i);var _=m5(o),w=Le(i,!0);if(_&&(s==="insideStart"||s==="insideEnd"||s==="end"))return d5(i,g,w);var x=_?p5(i):h5(i);return L.createElement(Gc,Cs({className:Be("recharts-label",m)},w,x,{breakAll:v}),g)}Ft.displayName="Label";var kj=function(e){var r=e.cx,n=e.cy,i=e.angle,o=e.startAngle,s=e.endAngle,l=e.r,f=e.radius,d=e.innerRadius,h=e.outerRadius,m=e.x,v=e.y,g=e.top,_=e.left,w=e.width,x=e.height,O=e.clockWise,P=e.labelViewBox;if(P)return P;if(ce(w)&&ce(x)){if(ce(m)&&ce(v))return{x:m,y:v,width:w,height:x};if(ce(g)&&ce(_))return{x:g,y:_,width:w,height:x}}return ce(m)&&ce(v)?{x:m,y:v,width:0,height:0}:ce(r)&&ce(n)?{cx:r,cy:n,startAngle:o||i||0,endAngle:s||i||0,innerRadius:d||0,outerRadius:h||f||l||0,clockWise:O}:e.viewBox?e.viewBox:{}},v5=function(e,r){return e?e===!0?L.createElement(Ft,{key:"label-implicit",viewBox:r}):Ot(e)?L.createElement(Ft,{key:"label-implicit",viewBox:r,value:e}):R.isValidElement(e)?e.type===Ft?R.cloneElement(e,{key:"label-implicit",viewBox:r}):L.createElement(Ft,{key:"label-implicit",content:e,viewBox:r}):Re(e)?L.createElement(Ft,{key:"label-implicit",content:e,viewBox:r}):ko(e)?L.createElement(Ft,Cs({viewBox:r},e,{key:"label-implicit"})):null:null},y5=function(e,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!e||!e.children&&n&&!e.label)return null;var i=e.children,o=kj(e),s=or(i,Ft).map(function(f,d){return R.cloneElement(f,{viewBox:r||o,key:"label-".concat(d)})});if(!n)return s;var l=v5(e.label,r||o);return[l].concat(e5(s))};Ft.parseViewBox=kj;Ft.renderCallByParent=y5;var Fy,fE;function g5(){if(fE)return Fy;fE=1;function t(e){var r=e==null?0:e.length;return r?e[r-1]:void 0}return Fy=t,Fy}var b5=g5();const x5=Qe(b5);function ks(t){"@babel/helpers - typeof";return ks=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ks(t)}var w5=["valueAccessor"],_5=["data","dataKey","clockWise","id","textBreakAll"];function S5(t){return E5(t)||A5(t)||P5(t)||O5()}function O5(){throw new TypeError(`Invalid attempt to spread non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function P5(t,e){if(t){if(typeof t=="string")return ub(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ub(t,e)}}function A5(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function E5(t){if(Array.isArray(t))return ub(t)}function ub(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function j5(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}var N5=function(e){return Array.isArray(e.value)?x5(e.value):e.value};function Bn(t){var e=t.valueAccessor,r=e===void 0?N5:e,n=hE(t,w5),i=n.data,o=n.dataKey,s=n.clockWise,l=n.id,f=n.textBreakAll,d=hE(n,_5);return!i||!i.length?null:L.createElement(tt,{className:"recharts-label-list"},i.map(function(h,m){var v=Ne(o)?r(h,m):$t(h&&h.payload,o),g=Ne(l)?{}:{id:"".concat(l,"-").concat(m)};return L.createElement(Ft,ff({},Le(h,!0),d,g,{parentViewBox:h.parentViewBox,value:v,textBreakAll:f,viewBox:Ft.parseViewBox(Ne(s)?h:pE(pE({},h),{},{clockWise:s})),key:"label-".concat(m),index:m}))}))}Bn.displayName="LabelList";function M5(t,e){return t?t===!0?L.createElement(Bn,{key:"labelList-implicit",data:e}):L.isValidElement(t)||Re(t)?L.createElement(Bn,{key:"labelList-implicit",data:e,content:t}):ko(t)?L.createElement(Bn,ff({data:e},t,{key:"labelList-implicit"})):null:null}function I5(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!t||!t.children&&r&&!t.label)return null;var n=t.children,i=or(n,Bn).map(function(s,l){return R.cloneElement(s,{data:e,key:"labelList-".concat(l)})});if(!r)return i;var o=M5(t.label,e);return[o].concat(S5(i))}Bn.renderCallByParent=I5;function js(t){"@babel/helpers - typeof";return js=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},js(t)}function sb(){return sb=Object.assign?Object.assign.bind():function(t){for(var e=1;e180),",").concat(+(s>d),`, + `).concat(m.x,",").concat(m.y,` + `);if(i>0){var g=Rt(r,n,i,s),_=Rt(r,n,i,d);v+="L ".concat(_.x,",").concat(_.y,` + A `).concat(i,",").concat(i,`,0, + `).concat(+(Math.abs(f)>180),",").concat(+(s<=d),`, + `).concat(g.x,",").concat(g.y," Z")}else v+="L ".concat(r,",").concat(n," Z");return v},z5=function(e){var r=e.cx,n=e.cy,i=e.innerRadius,o=e.outerRadius,s=e.cornerRadius,l=e.forceCornerRadius,f=e.cornerIsExternal,d=e.startAngle,h=e.endAngle,m=Gr(h-d),v=_c({cx:r,cy:n,radius:o,angle:d,sign:m,cornerRadius:s,cornerIsExternal:f}),g=v.circleTangency,_=v.lineTangency,w=v.theta,x=_c({cx:r,cy:n,radius:o,angle:h,sign:-m,cornerRadius:s,cornerIsExternal:f}),O=x.circleTangency,P=x.lineTangency,A=x.theta,C=f?Math.abs(d-h):Math.abs(d-h)-w-A;if(C<0)return l?"M ".concat(_.x,",").concat(_.y,` + a`).concat(s,",").concat(s,",0,0,1,").concat(s*2,`,0 + a`).concat(s,",").concat(s,",0,0,1,").concat(-s*2,`,0 + `):jj({cx:r,cy:n,innerRadius:i,outerRadius:o,startAngle:d,endAngle:h});var S="M ".concat(_.x,",").concat(_.y,` + A`).concat(s,",").concat(s,",0,0,").concat(+(m<0),",").concat(g.x,",").concat(g.y,` + A`).concat(o,",").concat(o,",0,").concat(+(C>180),",").concat(+(m<0),",").concat(O.x,",").concat(O.y,` + A`).concat(s,",").concat(s,",0,0,").concat(+(m<0),",").concat(P.x,",").concat(P.y,` + `);if(i>0){var E=_c({cx:r,cy:n,radius:i,angle:d,sign:m,isExternal:!0,cornerRadius:s,cornerIsExternal:f}),k=E.circleTangency,N=E.lineTangency,I=E.theta,U=_c({cx:r,cy:n,radius:i,angle:h,sign:-m,isExternal:!0,cornerRadius:s,cornerIsExternal:f}),$=U.circleTangency,B=U.lineTangency,V=U.theta,X=f?Math.abs(d-h):Math.abs(d-h)-I-V;if(X<0&&s===0)return"".concat(S,"L").concat(r,",").concat(n,"Z");S+="L".concat(B.x,",").concat(B.y,` + A`).concat(s,",").concat(s,",0,0,").concat(+(m<0),",").concat($.x,",").concat($.y,` + A`).concat(i,",").concat(i,",0,").concat(+(X>180),",").concat(+(m>0),",").concat(k.x,",").concat(k.y,` + A`).concat(s,",").concat(s,",0,0,").concat(+(m<0),",").concat(N.x,",").concat(N.y,"Z")}else S+="L".concat(r,",").concat(n,"Z");return S},B5={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},Nj=function(e){var r=vE(vE({},B5),e),n=r.cx,i=r.cy,o=r.innerRadius,s=r.outerRadius,l=r.cornerRadius,f=r.forceCornerRadius,d=r.cornerIsExternal,h=r.startAngle,m=r.endAngle,v=r.className;if(s0&&Math.abs(h-m)<360?x=z5({cx:n,cy:i,innerRadius:o,outerRadius:s,cornerRadius:Math.min(w,_/2),forceCornerRadius:f,cornerIsExternal:d,startAngle:h,endAngle:m}):x=jj({cx:n,cy:i,innerRadius:o,outerRadius:s,startAngle:h,endAngle:m}),L.createElement("path",sb({},Le(r,!0),{className:g,d:x,role:"img"}))};function Ns(t){"@babel/helpers - typeof";return Ns=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ns(t)}function lb(){return lb=Object.assign?Object.assign.bind():function(t){for(var e=1;e0;)if(!r.equals(t[n],e[n],n,n,t,e,r))return!1;return!0}function iU(t,e){return ca(t.getTime(),e.getTime())}function aU(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function oU(t,e){return t===e}function EE(t,e,r){var n=t.size;if(n!==e.size)return!1;if(!n)return!0;for(var i=new Array(n),o=t.entries(),s,l,f=0;(s=o.next())&&!s.done;){for(var d=e.entries(),h=!1,m=0;(l=d.next())&&!l.done;){if(i[m]){m++;continue}var v=s.value,g=l.value;if(r.equals(v[0],g[0],f,m,t,e,r)&&r.equals(v[1],g[1],v[0],g[0],t,e,r)){h=i[m]=!0;break}m++}if(!h)return!1;f++}return!0}var uU=ca;function sU(t,e,r){var n=AE(t),i=n.length;if(AE(e).length!==i)return!1;for(;i-- >0;)if(!Mj(t,e,r,n[i]))return!1;return!0}function Ru(t,e,r){var n=OE(t),i=n.length;if(OE(e).length!==i)return!1;for(var o,s,l;i-- >0;)if(o=n[i],!Mj(t,e,r,o)||(s=PE(t,o),l=PE(e,o),(s||l)&&(!s||!l||s.configurable!==l.configurable||s.enumerable!==l.enumerable||s.writable!==l.writable)))return!1;return!0}function lU(t,e){return ca(t.valueOf(),e.valueOf())}function cU(t,e){return t.source===e.source&&t.flags===e.flags}function TE(t,e,r){var n=t.size;if(n!==e.size)return!1;if(!n)return!0;for(var i=new Array(n),o=t.values(),s,l;(s=o.next())&&!s.done;){for(var f=e.values(),d=!1,h=0;(l=f.next())&&!l.done;){if(!i[h]&&r.equals(s.value,l.value,s.value,l.value,t,e,r)){d=i[h]=!0;break}h++}if(!d)return!1}return!0}function fU(t,e){var r=t.length;if(e.length!==r)return!1;for(;r-- >0;)if(t[r]!==e[r])return!1;return!0}function dU(t,e){return t.hostname===e.hostname&&t.pathname===e.pathname&&t.protocol===e.protocol&&t.port===e.port&&t.hash===e.hash&&t.username===e.username&&t.password===e.password}function Mj(t,e,r,n){return(n===rU||n===tU||n===eU)&&(t.$$typeof||e.$$typeof)?!0:J5(e,n)&&r.equals(t[n],e[n],n,n,t,e,r)}var pU="[object Arguments]",hU="[object Boolean]",mU="[object Date]",vU="[object Error]",yU="[object Map]",gU="[object Number]",bU="[object Object]",xU="[object RegExp]",wU="[object Set]",_U="[object String]",SU="[object URL]",OU=Array.isArray,CE=typeof ArrayBuffer=="function"&&ArrayBuffer.isView?ArrayBuffer.isView:null,kE=Object.assign,PU=Object.prototype.toString.call.bind(Object.prototype.toString);function AU(t){var e=t.areArraysEqual,r=t.areDatesEqual,n=t.areErrorsEqual,i=t.areFunctionsEqual,o=t.areMapsEqual,s=t.areNumbersEqual,l=t.areObjectsEqual,f=t.arePrimitiveWrappersEqual,d=t.areRegExpsEqual,h=t.areSetsEqual,m=t.areTypedArraysEqual,v=t.areUrlsEqual;return function(_,w,x){if(_===w)return!0;if(_==null||w==null)return!1;var O=typeof _;if(O!==typeof w)return!1;if(O!=="object")return O==="number"?s(_,w,x):O==="function"?i(_,w,x):!1;var P=_.constructor;if(P!==w.constructor)return!1;if(P===Object)return l(_,w,x);if(OU(_))return e(_,w,x);if(CE!=null&&CE(_))return m(_,w,x);if(P===Date)return r(_,w,x);if(P===RegExp)return d(_,w,x);if(P===Map)return o(_,w,x);if(P===Set)return h(_,w,x);var A=PU(_);return A===mU?r(_,w,x):A===xU?d(_,w,x):A===yU?o(_,w,x):A===wU?h(_,w,x):A===bU?typeof _.then!="function"&&typeof w.then!="function"&&l(_,w,x):A===SU?v(_,w,x):A===vU?n(_,w,x):A===pU?l(_,w,x):A===hU||A===gU||A===_U?f(_,w,x):!1}}function EU(t){var e=t.circular,r=t.createCustomConfig,n=t.strict,i={areArraysEqual:n?Ru:nU,areDatesEqual:iU,areErrorsEqual:aU,areFunctionsEqual:oU,areMapsEqual:n?SE(EE,Ru):EE,areNumbersEqual:uU,areObjectsEqual:n?Ru:sU,arePrimitiveWrappersEqual:lU,areRegExpsEqual:cU,areSetsEqual:n?SE(TE,Ru):TE,areTypedArraysEqual:n?Ru:fU,areUrlsEqual:dU};if(r&&(i=kE({},i,r(i))),e){var o=Oc(i.areArraysEqual),s=Oc(i.areMapsEqual),l=Oc(i.areObjectsEqual),f=Oc(i.areSetsEqual);i=kE({},i,{areArraysEqual:o,areMapsEqual:s,areObjectsEqual:l,areSetsEqual:f})}return i}function TU(t){return function(e,r,n,i,o,s,l){return t(e,r,l)}}function CU(t){var e=t.circular,r=t.comparator,n=t.createState,i=t.equals,o=t.strict;if(n)return function(f,d){var h=n(),m=h.cache,v=m===void 0?e?new WeakMap:void 0:m,g=h.meta;return r(f,d,{cache:v,equals:i,meta:g,strict:o})};if(e)return function(f,d){return r(f,d,{cache:new WeakMap,equals:i,meta:void 0,strict:o})};var s={cache:void 0,equals:i,meta:void 0,strict:o};return function(f,d){return r(f,d,s)}}var kU=Ci();Ci({strict:!0});Ci({circular:!0});Ci({circular:!0,strict:!0});Ci({createInternalComparator:function(){return ca}});Ci({strict:!0,createInternalComparator:function(){return ca}});Ci({circular:!0,createInternalComparator:function(){return ca}});Ci({circular:!0,createInternalComparator:function(){return ca},strict:!0});function Ci(t){t===void 0&&(t={});var e=t.circular,r=e===void 0?!1:e,n=t.createInternalComparator,i=t.createState,o=t.strict,s=o===void 0?!1:o,l=EU(t),f=AU(l),d=n?n(f):TU(f);return CU({circular:r,comparator:f,createState:i,equals:d,strict:s})}function jU(t){typeof requestAnimationFrame<"u"&&requestAnimationFrame(t)}function jE(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=-1,n=function i(o){r<0&&(r=o),o-r>e?(t(o),r=-1):jU(i)};requestAnimationFrame(n)}function cb(t){"@babel/helpers - typeof";return cb=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},cb(t)}function NU(t){return $U(t)||RU(t)||IU(t)||MU()}function MU(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function IU(t,e){if(t){if(typeof t=="string")return NE(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return NE(t,e)}}function NE(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);rt.length)&&(e=t.length);for(var r=0,n=new Array(e);r1?1:O<0?0:O},w=function(O){for(var P=O>1?1:O,A=P,C=0;C<8;++C){var S=m(A)-P,E=g(A);if(Math.abs(S-P)0&&arguments[0]!==void 0?arguments[0]:{},r=e.stiff,n=r===void 0?100:r,i=e.damping,o=i===void 0?8:i,s=e.dt,l=s===void 0?17:s,f=function(h,m,v){var g=-(h-m)*n,_=v*o,w=v+(g-_)*l/1e3,x=v*l/1e3+h;return Math.abs(x-m)t.length)&&(e=t.length);for(var r=0,n=new Array(e);r=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function p6(t,e){if(t==null)return{};var r={},n=Object.keys(t),i,o;for(o=0;o=0)&&(r[i]=t[i]);return r}function Hy(t){return y6(t)||v6(t)||m6(t)||h6()}function h6(){throw new TypeError(`Invalid attempt to spread non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function m6(t,e){if(t){if(typeof t=="string")return mb(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return mb(t,e)}}function v6(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function y6(t){if(Array.isArray(t))return mb(t)}function mb(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function mf(t){return mf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},mf(t)}var bn=function(t){_6(r,t);var e=S6(r);function r(n,i){var o;g6(this,r),o=e.call(this,n,i);var s=o.props,l=s.isActive,f=s.attributeName,d=s.from,h=s.to,m=s.steps,v=s.children,g=s.duration;if(o.handleStyleChange=o.handleStyleChange.bind(gb(o)),o.changeStyle=o.changeStyle.bind(gb(o)),!l||g<=0)return o.state={style:{}},typeof v=="function"&&(o.state={style:h}),yb(o);if(m&&m.length)o.state={style:m[0].style};else if(d){if(typeof v=="function")return o.state={style:d},yb(o);o.state={style:f?qu({},f,d):d}}else o.state={style:{}};return o}return x6(r,[{key:"componentDidMount",value:function(){var i=this.props,o=i.isActive,s=i.canBegin;this.mounted=!0,!(!o||!s)&&this.runAnimation(this.props)}},{key:"componentDidUpdate",value:function(i){var o=this.props,s=o.isActive,l=o.canBegin,f=o.attributeName,d=o.shouldReAnimate,h=o.to,m=o.from,v=this.state.style;if(l){if(!s){var g={style:f?qu({},f,h):h};this.state&&v&&(f&&v[f]!==h||!f&&v!==h)&&this.setState(g);return}if(!(kU(i.to,h)&&i.canBegin&&i.isActive)){var _=!i.canBegin||!i.isActive;this.manager&&this.manager.stop(),this.stopJSAnimation&&this.stopJSAnimation();var w=_||d?m:i.to;if(this.state&&v){var x={style:f?qu({},f,w):w};(f&&v[f]!==w||!f&&v!==w)&&this.setState(x)}this.runAnimation(Fr(Fr({},this.props),{},{from:w,begin:0}))}}}},{key:"componentWillUnmount",value:function(){this.mounted=!1;var i=this.props.onAnimationEnd;this.unSubscribe&&this.unSubscribe(),this.manager&&(this.manager.stop(),this.manager=null),this.stopJSAnimation&&this.stopJSAnimation(),i&&i()}},{key:"handleStyleChange",value:function(i){this.changeStyle(i)}},{key:"changeStyle",value:function(i){this.mounted&&this.setState({style:i})}},{key:"runJSAnimation",value:function(i){var o=this,s=i.from,l=i.to,f=i.duration,d=i.easing,h=i.begin,m=i.onAnimationEnd,v=i.onAnimationStart,g=c6(s,l,JU(d),f,this.changeStyle),_=function(){o.stopJSAnimation=g()};this.manager.start([v,h,_,f,m])}},{key:"runStepAnimation",value:function(i){var o=this,s=i.steps,l=i.begin,f=i.onAnimationStart,d=s[0],h=d.style,m=d.duration,v=m===void 0?0:m,g=function(w,x,O){if(O===0)return w;var P=x.duration,A=x.easing,C=A===void 0?"ease":A,S=x.style,E=x.properties,k=x.onAnimationEnd,N=O>0?s[O-1]:x,I=E||Object.keys(S);if(typeof C=="function"||C==="spring")return[].concat(Hy(w),[o.runJSAnimation.bind(o,{from:N.style,to:S,duration:P,easing:C}),P]);var U=RE(I,P,C),$=Fr(Fr(Fr({},N.style),S),{},{transition:U});return[].concat(Hy(w),[$,P,k]).filter(qU)};return this.manager.start([f].concat(Hy(s.reduce(g,[h,Math.max(v,l)])),[i.onAnimationEnd]))}},{key:"runAnimation",value:function(i){this.manager||(this.manager=DU());var o=i.begin,s=i.duration,l=i.attributeName,f=i.to,d=i.easing,h=i.onAnimationStart,m=i.onAnimationEnd,v=i.steps,g=i.children,_=this.manager;if(this.unSubscribe=_.subscribe(this.handleStyleChange),typeof d=="function"||typeof g=="function"||d==="spring"){this.runJSAnimation(i);return}if(v.length>1){this.runStepAnimation(i);return}var w=l?qu({},l,f):f,x=RE(Object.keys(w),s,d);_.start([h,o,Fr(Fr({},w),{},{transition:x}),s,m])}},{key:"render",value:function(){var i=this.props,o=i.children;i.begin;var s=i.duration;i.attributeName,i.easing;var l=i.isActive;i.steps,i.from,i.to,i.canBegin,i.onAnimationEnd,i.shouldReAnimate,i.onAnimationReStart;var f=d6(i,f6),d=R.Children.count(o),h=this.state.style;if(typeof o=="function")return o(h);if(!l||d===0||s<=0)return o;var m=function(g){var _=g.props,w=_.style,x=w===void 0?{}:w,O=_.className,P=R.cloneElement(g,Fr(Fr({},f),{},{style:Fr(Fr({},x),h),className:O}));return P};return d===1?m(R.Children.only(o)):L.createElement("div",null,R.Children.map(o,function(v){return m(v)}))}}]),r}(R.PureComponent);bn.displayName="Animate";bn.defaultProps={begin:0,duration:1e3,from:"",to:"",attributeName:"",easing:"ease",isActive:!0,canBegin:!0,steps:[],onAnimationEnd:function(){},onAnimationStart:function(){}};bn.propTypes={from:Ge.oneOfType([Ge.object,Ge.string]),to:Ge.oneOfType([Ge.object,Ge.string]),attributeName:Ge.string,duration:Ge.number,begin:Ge.number,easing:Ge.oneOfType([Ge.string,Ge.func]),steps:Ge.arrayOf(Ge.shape({duration:Ge.number.isRequired,style:Ge.object.isRequired,easing:Ge.oneOfType([Ge.oneOf(["ease","ease-in","ease-out","ease-in-out","linear"]),Ge.func]),properties:Ge.arrayOf("string"),onAnimationEnd:Ge.func})),children:Ge.oneOfType([Ge.node,Ge.func]),isActive:Ge.bool,canBegin:Ge.bool,onAnimationEnd:Ge.func,shouldReAnimate:Ge.bool,onAnimationStart:Ge.func,onAnimationReStart:Ge.func};nC();function Rs(t){"@babel/helpers - typeof";return Rs=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Rs(t)}function vf(){return vf=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var r=0,n=new Array(e);r=0?1:-1,f=n>=0?1:-1,d=i>=0&&n>=0||i<0&&n<0?1:0,h;if(s>0&&o instanceof Array){for(var m=[0,0,0,0],v=0,g=4;vs?s:o[v];h="M".concat(e,",").concat(r+l*m[0]),m[0]>0&&(h+="A ".concat(m[0],",").concat(m[0],",0,0,").concat(d,",").concat(e+f*m[0],",").concat(r)),h+="L ".concat(e+n-f*m[1],",").concat(r),m[1]>0&&(h+="A ".concat(m[1],",").concat(m[1],",0,0,").concat(d,`, + `).concat(e+n,",").concat(r+l*m[1])),h+="L ".concat(e+n,",").concat(r+i-l*m[2]),m[2]>0&&(h+="A ".concat(m[2],",").concat(m[2],",0,0,").concat(d,`, + `).concat(e+n-f*m[2],",").concat(r+i)),h+="L ".concat(e+f*m[3],",").concat(r+i),m[3]>0&&(h+="A ".concat(m[3],",").concat(m[3],",0,0,").concat(d,`, + `).concat(e,",").concat(r+i-l*m[3])),h+="Z"}else if(s>0&&o===+o&&o>0){var _=Math.min(s,o);h="M ".concat(e,",").concat(r+l*_,` + A `).concat(_,",").concat(_,",0,0,").concat(d,",").concat(e+f*_,",").concat(r,` + L `).concat(e+n-f*_,",").concat(r,` + A `).concat(_,",").concat(_,",0,0,").concat(d,",").concat(e+n,",").concat(r+l*_,` + L `).concat(e+n,",").concat(r+i-l*_,` + A `).concat(_,",").concat(_,",0,0,").concat(d,",").concat(e+n-f*_,",").concat(r+i,` + L `).concat(e+f*_,",").concat(r+i,` + A `).concat(_,",").concat(_,",0,0,").concat(d,",").concat(e,",").concat(r+i-l*_," Z")}else h="M ".concat(e,",").concat(r," h ").concat(n," v ").concat(i," h ").concat(-n," Z");return h},M6=function(e,r){if(!e||!r)return!1;var n=e.x,i=e.y,o=r.x,s=r.y,l=r.width,f=r.height;if(Math.abs(l)>0&&Math.abs(f)>0){var d=Math.min(o,o+l),h=Math.max(o,o+l),m=Math.min(s,s+f),v=Math.max(s,s+f);return n>=d&&n<=h&&i>=m&&i<=v}return!1},I6={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},W0=function(e){var r=UE(UE({},I6),e),n=R.useRef(),i=R.useState(-1),o=P6(i,2),s=o[0],l=o[1];R.useEffect(function(){if(n.current&&n.current.getTotalLength)try{var C=n.current.getTotalLength();C&&l(C)}catch{}},[]);var f=r.x,d=r.y,h=r.width,m=r.height,v=r.radius,g=r.className,_=r.animationEasing,w=r.animationDuration,x=r.animationBegin,O=r.isAnimationActive,P=r.isUpdateAnimationActive;if(f!==+f||d!==+d||h!==+h||m!==+m||h===0||m===0)return null;var A=Be("recharts-rectangle",g);return P?L.createElement(bn,{canBegin:s>0,from:{width:h,height:m,x:f,y:d},to:{width:h,height:m,x:f,y:d},duration:w,animationEasing:_,isActive:P},function(C){var S=C.width,E=C.height,k=C.x,N=C.y;return L.createElement(bn,{canBegin:s>0,from:"0px ".concat(s===-1?1:s,"px"),to:"".concat(s,"px 0px"),attributeName:"strokeDasharray",begin:x,duration:w,isActive:O,easing:_},L.createElement("path",vf({},Le(r,!0),{className:A,d:WE(k,N,S,E,v),ref:n})))}):L.createElement("path",vf({},Le(r,!0),{className:A,d:WE(f,d,h,m,v)}))};function bb(){return bb=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function q6(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}var F6=function(e,r,n,i,o,s){return"M".concat(e,",").concat(o,"v").concat(i,"M").concat(s,",").concat(r,"h").concat(n)},U6=function(e){var r=e.x,n=r===void 0?0:r,i=e.y,o=i===void 0?0:i,s=e.top,l=s===void 0?0:s,f=e.left,d=f===void 0?0:f,h=e.width,m=h===void 0?0:h,v=e.height,g=v===void 0?0:v,_=e.className,w=B6(e,R6),x=$6({x:n,y:o,top:l,left:d,width:m,height:g},w);return!ce(n)||!ce(o)||!ce(m)||!ce(g)||!ce(l)||!ce(d)?null:L.createElement("path",xb({},Le(x,!0),{className:Be("recharts-cross",_),d:F6(n,o,m,g,l,d)}))},Gy,HE;function W6(){if(HE)return Gy;HE=1;var t=ok(),e=t(Object.getPrototypeOf,Object);return Gy=e,Gy}var Ky,GE;function V6(){if(GE)return Ky;GE=1;var t=Vn(),e=W6(),r=Hn(),n="[object Object]",i=Function.prototype,o=Object.prototype,s=i.toString,l=o.hasOwnProperty,f=s.call(Object);function d(h){if(!r(h)||t(h)!=n)return!1;var m=e(h);if(m===null)return!0;var v=l.call(m,"constructor")&&m.constructor;return typeof v=="function"&&v instanceof v&&s.call(v)==f}return Ky=d,Ky}var H6=V6();const G6=Qe(H6);var Zy,KE;function K6(){if(KE)return Zy;KE=1;var t=Vn(),e=Hn(),r="[object Boolean]";function n(i){return i===!0||i===!1||e(i)&&t(i)==r}return Zy=n,Zy}var Z6=K6();const X6=Qe(Z6);function Ds(t){"@babel/helpers - typeof";return Ds=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ds(t)}function yf(){return yf=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var r=0,n=new Array(e);r0,from:{upperWidth:0,lowerWidth:0,height:v,x:f,y:d},to:{upperWidth:h,lowerWidth:m,height:v,x:f,y:d},duration:w,animationEasing:_,isActive:O},function(A){var C=A.upperWidth,S=A.lowerWidth,E=A.height,k=A.x,N=A.y;return L.createElement(bn,{canBegin:s>0,from:"0px ".concat(s===-1?1:s,"px"),to:"".concat(s,"px 0px"),attributeName:"strokeDasharray",begin:x,duration:w,easing:_},L.createElement("path",yf({},Le(r,!0),{className:P,d:QE(k,N,C,S,E),ref:n})))}):L.createElement("g",null,L.createElement("path",yf({},Le(r,!0),{className:P,d:QE(f,d,h,m,v)})))},uW=["option","shapeType","propTransformer","activeClassName","isActive"];function Ls(t){"@babel/helpers - typeof";return Ls=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ls(t)}function sW(t,e){if(t==null)return{};var r=lW(t,e),n,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function lW(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}function JE(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function gf(t){for(var e=1;e0&&n.handleDrag(i.changedTouches[0])}),pr(n,"handleDragEnd",function(){n.setState({isTravellerMoving:!1,isSlideMoving:!1},function(){var i=n.props,o=i.endIndex,s=i.onDragEnd,l=i.startIndex;s==null||s({endIndex:o,startIndex:l})}),n.detachDragEndListener()}),pr(n,"handleLeaveWrapper",function(){(n.state.isTravellerMoving||n.state.isSlideMoving)&&(n.leaveTimer=window.setTimeout(n.handleDragEnd,n.props.leaveTimeOut))}),pr(n,"handleEnterSlideOrTraveller",function(){n.setState({isTextActive:!0})}),pr(n,"handleLeaveSlideOrTraveller",function(){n.setState({isTextActive:!1})}),pr(n,"handleSlideDragStart",function(i){var o=lT(i)?i.changedTouches[0]:i;n.setState({isTravellerMoving:!1,isSlideMoving:!0,slideMoveStartX:o.pageX}),n.attachDragEndListener()}),n.travellerDragStartHandlers={startX:n.handleTravellerDragStart.bind(n,"startX"),endX:n.handleTravellerDragStart.bind(n,"endX")},n.state={},n}return $W(e,t),NW(e,[{key:"componentWillUnmount",value:function(){this.leaveTimer&&(clearTimeout(this.leaveTimer),this.leaveTimer=null),this.detachDragEndListener()}},{key:"getIndex",value:function(n){var i=n.startX,o=n.endX,s=this.state.scaleValues,l=this.props,f=l.gap,d=l.data,h=d.length-1,m=Math.min(i,o),v=Math.max(i,o),g=e.getIndexInRange(s,m),_=e.getIndexInRange(s,v);return{startIndex:g-g%f,endIndex:_===h?h:_-_%f}}},{key:"getTextOfTick",value:function(n){var i=this.props,o=i.data,s=i.tickFormatter,l=i.dataKey,f=$t(o[n],l,n);return Re(s)?s(f,n):f}},{key:"attachDragEndListener",value:function(){window.addEventListener("mouseup",this.handleDragEnd,!0),window.addEventListener("touchend",this.handleDragEnd,!0),window.addEventListener("mousemove",this.handleDrag,!0)}},{key:"detachDragEndListener",value:function(){window.removeEventListener("mouseup",this.handleDragEnd,!0),window.removeEventListener("touchend",this.handleDragEnd,!0),window.removeEventListener("mousemove",this.handleDrag,!0)}},{key:"handleSlideDrag",value:function(n){var i=this.state,o=i.slideMoveStartX,s=i.startX,l=i.endX,f=this.props,d=f.x,h=f.width,m=f.travellerWidth,v=f.startIndex,g=f.endIndex,_=f.onChange,w=n.pageX-o;w>0?w=Math.min(w,d+h-m-l,d+h-m-s):w<0&&(w=Math.max(w,d-s,d-l));var x=this.getIndex({startX:s+w,endX:l+w});(x.startIndex!==v||x.endIndex!==g)&&_&&_(x),this.setState({startX:s+w,endX:l+w,slideMoveStartX:n.pageX})}},{key:"handleTravellerDragStart",value:function(n,i){var o=lT(i)?i.changedTouches[0]:i;this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:n,brushMoveStartX:o.pageX}),this.attachDragEndListener()}},{key:"handleTravellerMove",value:function(n){var i=this.state,o=i.brushMoveStartX,s=i.movingTravellerId,l=i.endX,f=i.startX,d=this.state[s],h=this.props,m=h.x,v=h.width,g=h.travellerWidth,_=h.onChange,w=h.gap,x=h.data,O={startX:this.state.startX,endX:this.state.endX},P=n.pageX-o;P>0?P=Math.min(P,m+v-g-d):P<0&&(P=Math.max(P,m-d)),O[s]=d+P;var A=this.getIndex(O),C=A.startIndex,S=A.endIndex,E=function(){var N=x.length-1;return s==="startX"&&(l>f?C%w===0:S%w===0)||lf?S%w===0:C%w===0)||l>f&&S===N};this.setState(pr(pr({},s,d+P),"brushMoveStartX",n.pageX),function(){_&&E()&&_(A)})}},{key:"handleTravellerMoveKeyboard",value:function(n,i){var o=this,s=this.state,l=s.scaleValues,f=s.startX,d=s.endX,h=this.state[i],m=l.indexOf(h);if(m!==-1){var v=m+n;if(!(v===-1||v>=l.length)){var g=l[v];i==="startX"&&g>=d||i==="endX"&&g<=f||this.setState(pr({},i,g),function(){o.props.onChange(o.getIndex({startX:o.state.startX,endX:o.state.endX}))})}}}},{key:"renderBackground",value:function(){var n=this.props,i=n.x,o=n.y,s=n.width,l=n.height,f=n.fill,d=n.stroke;return L.createElement("rect",{stroke:d,fill:f,x:i,y:o,width:s,height:l})}},{key:"renderPanorama",value:function(){var n=this.props,i=n.x,o=n.y,s=n.width,l=n.height,f=n.data,d=n.children,h=n.padding,m=R.Children.only(d);return m?L.cloneElement(m,{x:i,y:o,width:s,height:l,margin:h,compact:!0,data:f}):null}},{key:"renderTravellerLayer",value:function(n,i){var o,s,l=this,f=this.props,d=f.y,h=f.travellerWidth,m=f.height,v=f.traveller,g=f.ariaLabel,_=f.data,w=f.startIndex,x=f.endIndex,O=Math.max(n,this.props.x),P=eg(eg({},Le(this.props,!1)),{},{x:O,y:d,width:h,height:m}),A=g||"Min value: ".concat((o=_[w])===null||o===void 0?void 0:o.name,", Max value: ").concat((s=_[x])===null||s===void 0?void 0:s.name);return L.createElement(tt,{tabIndex:0,role:"slider","aria-label":A,"aria-valuenow":n,className:"recharts-brush-traveller",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers[i],onTouchStart:this.travellerDragStartHandlers[i],onKeyDown:function(S){["ArrowLeft","ArrowRight"].includes(S.key)&&(S.preventDefault(),S.stopPropagation(),l.handleTravellerMoveKeyboard(S.key==="ArrowRight"?1:-1,i))},onFocus:function(){l.setState({isTravellerFocused:!0})},onBlur:function(){l.setState({isTravellerFocused:!1})},style:{cursor:"col-resize"}},e.renderTraveller(v,P))}},{key:"renderSlide",value:function(n,i){var o=this.props,s=o.y,l=o.height,f=o.stroke,d=o.travellerWidth,h=Math.min(n,i)+d,m=Math.max(Math.abs(i-n)-d,0);return L.createElement("rect",{className:"recharts-brush-slide",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.handleSlideDragStart,onTouchStart:this.handleSlideDragStart,style:{cursor:"move"},stroke:"none",fill:f,fillOpacity:.2,x:h,y:s,width:m,height:l})}},{key:"renderText",value:function(){var n=this.props,i=n.startIndex,o=n.endIndex,s=n.y,l=n.height,f=n.travellerWidth,d=n.stroke,h=this.state,m=h.startX,v=h.endX,g=5,_={pointerEvents:"none",fill:d};return L.createElement(tt,{className:"recharts-brush-texts"},L.createElement(Gc,xf({textAnchor:"end",verticalAnchor:"middle",x:Math.min(m,v)-g,y:s+l/2},_),this.getTextOfTick(i)),L.createElement(Gc,xf({textAnchor:"start",verticalAnchor:"middle",x:Math.max(m,v)+f+g,y:s+l/2},_),this.getTextOfTick(o)))}},{key:"render",value:function(){var n=this.props,i=n.data,o=n.className,s=n.children,l=n.x,f=n.y,d=n.width,h=n.height,m=n.alwaysShowText,v=this.state,g=v.startX,_=v.endX,w=v.isTextActive,x=v.isSlideMoving,O=v.isTravellerMoving,P=v.isTravellerFocused;if(!i||!i.length||!ce(l)||!ce(f)||!ce(d)||!ce(h)||d<=0||h<=0)return null;var A=Be("recharts-brush",o),C=L.Children.count(s)===1,S=kW("userSelect","none");return L.createElement(tt,{className:A,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:S},this.renderBackground(),C&&this.renderPanorama(),this.renderSlide(g,_),this.renderTravellerLayer(g,"startX"),this.renderTravellerLayer(_,"endX"),(w||x||O||P||m)&&this.renderText())}}],[{key:"renderDefaultTraveller",value:function(n){var i=n.x,o=n.y,s=n.width,l=n.height,f=n.stroke,d=Math.floor(o+l/2)-1;return L.createElement(L.Fragment,null,L.createElement("rect",{x:i,y:o,width:s,height:l,fill:f,stroke:"none"}),L.createElement("line",{x1:i+1,y1:d,x2:i+s-1,y2:d,fill:"none",stroke:"#fff"}),L.createElement("line",{x1:i+1,y1:d+2,x2:i+s-1,y2:d+2,fill:"none",stroke:"#fff"}))}},{key:"renderTraveller",value:function(n,i){var o;return L.isValidElement(n)?o=L.cloneElement(n,i):Re(n)?o=n(i):o=e.renderDefaultTraveller(i),o}},{key:"getDerivedStateFromProps",value:function(n,i){var o=n.data,s=n.width,l=n.x,f=n.travellerWidth,d=n.updateId,h=n.startIndex,m=n.endIndex;if(o!==i.prevData||d!==i.prevUpdateId)return eg({prevData:o,prevTravellerWidth:f,prevUpdateId:d,prevX:l,prevWidth:s},o&&o.length?LW({data:o,width:s,x:l,travellerWidth:f,startIndex:h,endIndex:m}):{scale:null,scaleValues:null});if(i.scale&&(s!==i.prevWidth||l!==i.prevX||f!==i.prevTravellerWidth)){i.scale.range([l,l+s-f]);var v=i.scale.domain().map(function(g){return i.scale(g)});return{prevData:o,prevTravellerWidth:f,prevUpdateId:d,prevX:l,prevWidth:s,startX:i.scale(n.startIndex),endX:i.scale(n.endIndex),scaleValues:v}}return null}},{key:"getIndexInRange",value:function(n,i){for(var o=n.length,s=0,l=o-1;l-s>1;){var f=Math.floor((s+l)/2);n[f]>i?l=f:s=f}return i>=n[l]?l:s}}])}(R.PureComponent);pr(po,"displayName","Brush");pr(po,"defaultProps",{height:40,travellerWidth:5,gap:1,fill:"#fff",stroke:"#666",padding:{top:1,right:1,bottom:1,left:1},leaveTimeOut:1e3,alwaysShowText:!1});var tg,cT;function zW(){if(cT)return tg;cT=1;var t=m0();function e(r,n){var i;return t(r,function(o,s,l){return i=n(o,s,l),!i}),!!i}return tg=e,tg}var rg,fT;function BW(){if(fT)return rg;fT=1;var t=JC(),e=Ai(),r=zW(),n=ur(),i=Yf();function o(s,l,f){var d=n(s)?t:r;return f&&i(s,l,f)&&(l=void 0),d(s,e(l,3))}return rg=o,rg}var qW=BW();const FW=Qe(qW);var hn=function(e,r){var n=e.alwaysShow,i=e.ifOverflow;return n&&(i="extendDomain"),i===r},ng,dT;function UW(){if(dT)return ng;dT=1;var t=yk();function e(r,n,i){n=="__proto__"&&t?t(r,n,{configurable:!0,enumerable:!0,value:i,writable:!0}):r[n]=i}return ng=e,ng}var ig,pT;function WW(){if(pT)return ig;pT=1;var t=UW(),e=mk(),r=Ai();function n(i,o){var s={};return o=r(o,3),e(i,function(l,f,d){t(s,f,o(l,f,d))}),s}return ig=n,ig}var VW=WW();const HW=Qe(VW);var ag,hT;function GW(){if(hT)return ag;hT=1;function t(e,r){for(var n=-1,i=e==null?0:e.length;++n=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function r9(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}function n9(t,e){var r=t.x,n=t.y,i=t9(t,YW),o="".concat(r),s=parseInt(o,10),l="".concat(n),f=parseInt(l,10),d="".concat(e.height||i.height),h=parseInt(d,10),m="".concat(e.width||i.width),v=parseInt(m,10);return $u($u($u($u($u({},e),i),s?{x:s}:{}),f?{y:f}:{}),{},{height:h,width:v,name:e.name,radius:e.radius})}function gT(t){return L.createElement(wb,Sb({shapeType:"rectangle",propTransformer:n9,activeClassName:"recharts-active-bar"},t))}var i9=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return function(n,i){if(typeof e=="number")return e;var o=typeof n=="number";return o?e(n,i):(o||ia(),r)}},a9=["value","background"],Vj;function ho(t){"@babel/helpers - typeof";return ho=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ho(t)}function o9(t,e){if(t==null)return{};var r=u9(t,e),n,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function u9(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}function _f(){return _f=Object.assign?Object.assign.bind():function(t){for(var e=1;e0&&Math.abs(Z)0&&Math.abs(X)0&&(V=Math.min((ye||0)-(X[_e-1]||0),V))}),Number.isFinite(V)){var Z=V/B,Y=w.layout==="vertical"?n.height:n.width;if(w.padding==="gap"&&(k=Z*Y/2),w.padding==="no-gap"){var te=ra(e.barCategoryGap,Z*Y),H=Z*Y/2;k=H-te-(H-te)/Y*te}}}i==="xAxis"?N=[n.left+(A.left||0)+(k||0),n.left+n.width-(A.right||0)-(k||0)]:i==="yAxis"?N=f==="horizontal"?[n.top+n.height-(A.bottom||0),n.top+(A.top||0)]:[n.top+(A.top||0)+(k||0),n.top+n.height-(A.bottom||0)-(k||0)]:N=w.range,S&&(N=[N[1],N[0]]);var Q=N8(w,o,v),ee=Q.scale,M=Q.realScaleType;ee.domain(O).range(N),M8(ee);var F=q8(ee,Ur(Ur({},w),{},{realScaleType:M}));i==="xAxis"?($=x==="top"&&!C||x==="bottom"&&C,I=n.left,U=m[E]-$*w.height):i==="yAxis"&&($=x==="left"&&!C||x==="right"&&C,I=m[E]-$*w.width,U=n.top);var le=Ur(Ur(Ur({},w),F),{},{realScaleType:M,x:I,y:U,scale:ee,width:i==="xAxis"?n.width:w.width,height:i==="yAxis"?n.height:w.height});return le.bandSize=lf(le,F),!w.hide&&i==="xAxis"?m[E]+=($?-1:1)*le.height:w.hide||(m[E]+=($?-1:1)*le.width),Ur(Ur({},g),{},cd({},_,le))},{})},Zj=function(e,r){var n=e.x,i=e.y,o=r.x,s=r.y;return{x:Math.min(n,o),y:Math.min(i,s),width:Math.abs(o-n),height:Math.abs(s-i)}},g9=function(e){var r=e.x1,n=e.y1,i=e.x2,o=e.y2;return Zj({x:r,y:n},{x:i,y:o})},Xj=function(){function t(e){m9(this,t),this.scale=e}return v9(t,[{key:"domain",get:function(){return this.scale.domain}},{key:"range",get:function(){return this.scale.range}},{key:"rangeMin",get:function(){return this.range()[0]}},{key:"rangeMax",get:function(){return this.range()[1]}},{key:"bandwidth",get:function(){return this.scale.bandwidth}},{key:"apply",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=n.bandAware,o=n.position;if(r!==void 0){if(o)switch(o){case"start":return this.scale(r);case"middle":{var s=this.bandwidth?this.bandwidth()/2:0;return this.scale(r)+s}case"end":{var l=this.bandwidth?this.bandwidth():0;return this.scale(r)+l}default:return this.scale(r)}if(i){var f=this.bandwidth?this.bandwidth()/2:0;return this.scale(r)+f}return this.scale(r)}}},{key:"isInRange",value:function(r){var n=this.range(),i=n[0],o=n[n.length-1];return i<=o?r>=i&&r<=o:r>=o&&r<=i}}],[{key:"create",value:function(r){return new t(r)}}])}();cd(Xj,"EPS",1e-4);var G0=function(e){var r=Object.keys(e).reduce(function(n,i){return Ur(Ur({},n),{},cd({},i,Xj.create(e[i])))},{});return Ur(Ur({},r),{},{apply:function(i){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=o.bandAware,l=o.position;return HW(i,function(f,d){return r[d].apply(f,{bandAware:s,position:l})})},isInRange:function(i){return Wj(i,function(o,s){return r[s].isInRange(o)})}})};function b9(t){return(t%180+180)%180}var x9=function(e){var r=e.width,n=e.height,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,o=b9(i),s=o*Math.PI/180,l=Math.atan(n/r),f=s>l&&s-1?f[d?o[h]:h]:void 0}}return sg=n,sg}var lg,OT;function _9(){if(OT)return lg;OT=1;var t=Bj();function e(r){var n=t(r),i=n%1;return n===n?i?n-i:n:0}return lg=e,lg}var cg,PT;function S9(){if(PT)return cg;PT=1;var t=ck(),e=Ai(),r=_9(),n=Math.max;function i(o,s,l){var f=o==null?0:o.length;if(!f)return-1;var d=l==null?0:r(l);return d<0&&(d=n(f+d,0)),t(o,e(s,3),d)}return cg=i,cg}var fg,AT;function O9(){if(AT)return fg;AT=1;var t=w9(),e=S9(),r=t(e);return fg=r,fg}var P9=O9();const A9=Qe(P9);var E9=AC();const T9=Qe(E9);var C9=T9(function(t){return{x:t.left,y:t.top,width:t.width,height:t.height}},function(t){return["l",t.left,"t",t.top,"w",t.width,"h",t.height].join("")}),K0=R.createContext(void 0),Z0=R.createContext(void 0),Yj=R.createContext(void 0),Qj=R.createContext({}),Jj=R.createContext(void 0),eN=R.createContext(0),tN=R.createContext(0),ET=function(e){var r=e.state,n=r.xAxisMap,i=r.yAxisMap,o=r.offset,s=e.clipPathId,l=e.children,f=e.width,d=e.height,h=C9(o);return L.createElement(K0.Provider,{value:n},L.createElement(Z0.Provider,{value:i},L.createElement(Qj.Provider,{value:o},L.createElement(Yj.Provider,{value:h},L.createElement(Jj.Provider,{value:s},L.createElement(eN.Provider,{value:d},L.createElement(tN.Provider,{value:f},l)))))))},k9=function(){return R.useContext(Jj)},rN=function(e){var r=R.useContext(K0);r==null&&ia();var n=r[e];return n==null&&ia(),n},j9=function(){var e=R.useContext(K0);return vi(e)},N9=function(){var e=R.useContext(Z0),r=A9(e,function(n){return Wj(n.domain,Number.isFinite)});return r||vi(e)},nN=function(e){var r=R.useContext(Z0);r==null&&ia();var n=r[e];return n==null&&ia(),n},M9=function(){var e=R.useContext(Yj);return e},I9=function(){return R.useContext(Qj)},X0=function(){return R.useContext(tN)},Y0=function(){return R.useContext(eN)};function mo(t){"@babel/helpers - typeof";return mo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},mo(t)}function R9(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function $9(t,e){for(var r=0;rt.length)&&(e=t.length);for(var r=0,n=new Array(e);rt*i)return!1;var o=r();return t*(e-t*o/2-n)>=0&&t*(e+t*o/2-i)<=0}function yV(t,e){return cN(t,e+1)}function gV(t,e,r,n,i){for(var o=(n||[]).slice(),s=e.start,l=e.end,f=0,d=1,h=s,m=function(){var _=n==null?void 0:n[f];if(_===void 0)return{v:cN(n,d)};var w=f,x,O=function(){return x===void 0&&(x=r(_,w)),x},P=_.coordinate,A=f===0||Ef(t,P,O,h,l);A||(f=0,h=s,d+=1),A&&(h=P+t*(O()/2+i),f+=d)},v;d<=o.length;)if(v=m(),v)return v.v;return[]}function Us(t){"@babel/helpers - typeof";return Us=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Us(t)}function RT(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function qt(t){for(var e=1;e0?g.coordinate-x*t:g.coordinate})}else o[v]=g=qt(qt({},g),{},{tickCoord:g.coordinate});var O=Ef(t,g.tickCoord,w,l,f);O&&(f=g.tickCoord-t*(w()/2+i),o[v]=qt(qt({},g),{},{isShow:!0}))},h=s-1;h>=0;h--)d(h);return o}function SV(t,e,r,n,i,o){var s=(n||[]).slice(),l=s.length,f=e.start,d=e.end;if(o){var h=n[l-1],m=r(h,l-1),v=t*(h.coordinate+t*m/2-d);s[l-1]=h=qt(qt({},h),{},{tickCoord:v>0?h.coordinate-v*t:h.coordinate});var g=Ef(t,h.tickCoord,function(){return m},f,d);g&&(d=h.tickCoord-t*(m/2+i),s[l-1]=qt(qt({},h),{},{isShow:!0}))}for(var _=o?l-1:l,w=function(P){var A=s[P],C,S=function(){return C===void 0&&(C=r(A,P)),C};if(P===0){var E=t*(A.coordinate-t*S()/2-f);s[P]=A=qt(qt({},A),{},{tickCoord:E<0?A.coordinate-E*t:A.coordinate})}else s[P]=A=qt(qt({},A),{},{tickCoord:A.coordinate});var k=Ef(t,A.tickCoord,S,f,d);k&&(f=A.tickCoord+t*(S()/2+i),s[P]=qt(qt({},A),{},{isShow:!0}))},x=0;x<_;x++)w(x);return s}function ex(t,e,r){var n=t.tick,i=t.ticks,o=t.viewBox,s=t.minTickGap,l=t.orientation,f=t.interval,d=t.tickFormatter,h=t.unit,m=t.angle;if(!i||!i.length||!n)return[];if(ce(f)||dn.isSsr)return yV(i,typeof f=="number"&&ce(f)?f:0);var v=[],g=l==="top"||l==="bottom"?"width":"height",_=h&&g==="width"?Uu(h,{fontSize:e,letterSpacing:r}):{width:0,height:0},w=function(A,C){var S=Re(d)?d(A.value,C):A.value;return g==="width"?mV(Uu(S,{fontSize:e,letterSpacing:r}),_,m):Uu(S,{fontSize:e,letterSpacing:r})[g]},x=i.length>=2?Gr(i[1].coordinate-i[0].coordinate):1,O=vV(o,x,g);return f==="equidistantPreserveStart"?gV(x,O,w,i,s):(f==="preserveStart"||f==="preserveStartEnd"?v=SV(x,O,w,i,s,f==="preserveStartEnd"):v=_V(x,O,w,i,s),v.filter(function(P){return P.isShow}))}var OV=["viewBox"],PV=["viewBox"],AV=["ticks"];function go(t){"@babel/helpers - typeof";return go=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},go(t)}function Ua(){return Ua=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function EV(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}function TV(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function DT(t,e){for(var r=0;r0?f(this.props):f(g)),s<=0||l<=0||!_||!_.length?null:L.createElement(tt,{className:Be("recharts-cartesian-axis",d),ref:function(x){n.layerReference=x}},o&&this.renderAxisLine(),this.renderTicks(_,this.state.fontSize,this.state.letterSpacing),Ft.renderCallByParent(this.props))}}],[{key:"renderTickItem",value:function(n,i,o){var s;return L.isValidElement(n)?s=L.cloneElement(n,i):Re(n)?s=n(i):s=L.createElement(Gc,Ua({},i,{className:"recharts-cartesian-axis-tick-value"}),o),s}}])}(R.Component);tx(Do,"displayName","CartesianAxis");tx(Do,"defaultProps",{x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:"bottom",ticks:[],stroke:"#666",tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:"preserveEnd"});var RV=["x1","y1","x2","y2","key"],$V=["offset"];function aa(t){"@babel/helpers - typeof";return aa=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},aa(t)}function LT(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function Ut(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function BV(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}var qV=function(e){var r=e.fill;if(!r||r==="none")return null;var n=e.fillOpacity,i=e.x,o=e.y,s=e.width,l=e.height,f=e.ry;return L.createElement("rect",{x:i,y:o,ry:f,width:s,height:l,stroke:"none",fill:r,fillOpacity:n,className:"recharts-cartesian-grid-bg"})};function pN(t,e){var r;if(L.isValidElement(t))r=L.cloneElement(t,e);else if(Re(t))r=t(e);else{var n=e.x1,i=e.y1,o=e.x2,s=e.y2,l=e.key,f=zT(e,RV),d=Le(f,!1);d.offset;var h=zT(d,$V);r=L.createElement("line",Zi({},h,{x1:n,y1:i,x2:o,y2:s,fill:"none",key:l}))}return r}function FV(t){var e=t.x,r=t.width,n=t.horizontal,i=n===void 0?!0:n,o=t.horizontalPoints;if(!i||!o||!o.length)return null;var s=o.map(function(l,f){var d=Ut(Ut({},t),{},{x1:e,y1:l,x2:e+r,y2:l,key:"line-".concat(f),index:f});return pN(i,d)});return L.createElement("g",{className:"recharts-cartesian-grid-horizontal"},s)}function UV(t){var e=t.y,r=t.height,n=t.vertical,i=n===void 0?!0:n,o=t.verticalPoints;if(!i||!o||!o.length)return null;var s=o.map(function(l,f){var d=Ut(Ut({},t),{},{x1:l,y1:e,x2:l,y2:e+r,key:"line-".concat(f),index:f});return pN(i,d)});return L.createElement("g",{className:"recharts-cartesian-grid-vertical"},s)}function WV(t){var e=t.horizontalFill,r=t.fillOpacity,n=t.x,i=t.y,o=t.width,s=t.height,l=t.horizontalPoints,f=t.horizontal,d=f===void 0?!0:f;if(!d||!e||!e.length)return null;var h=l.map(function(v){return Math.round(v+i-i)}).sort(function(v,g){return v-g});i!==h[0]&&h.unshift(0);var m=h.map(function(v,g){var _=!h[g+1],w=_?i+s-v:h[g+1]-v;if(w<=0)return null;var x=g%e.length;return L.createElement("rect",{key:"react-".concat(g),y:v,x:n,height:w,width:o,stroke:"none",fill:e[x],fillOpacity:r,className:"recharts-cartesian-grid-bg"})});return L.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},m)}function VV(t){var e=t.vertical,r=e===void 0?!0:e,n=t.verticalFill,i=t.fillOpacity,o=t.x,s=t.y,l=t.width,f=t.height,d=t.verticalPoints;if(!r||!n||!n.length)return null;var h=d.map(function(v){return Math.round(v+o-o)}).sort(function(v,g){return v-g});o!==h[0]&&h.unshift(0);var m=h.map(function(v,g){var _=!h[g+1],w=_?o+l-v:h[g+1]-v;if(w<=0)return null;var x=g%n.length;return L.createElement("rect",{key:"react-".concat(g),x:v,y:s,width:w,height:f,stroke:"none",fill:n[x],fillOpacity:i,className:"recharts-cartesian-grid-bg"})});return L.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},m)}var HV=function(e,r){var n=e.xAxis,i=e.width,o=e.height,s=e.offset;return Ej(ex(Ut(Ut(Ut({},Do.defaultProps),n),{},{ticks:$n(n,!0),viewBox:{x:0,y:0,width:i,height:o}})),s.left,s.left+s.width,r)},GV=function(e,r){var n=e.yAxis,i=e.width,o=e.height,s=e.offset;return Ej(ex(Ut(Ut(Ut({},Do.defaultProps),n),{},{ticks:$n(n,!0),viewBox:{x:0,y:0,width:i,height:o}})),s.top,s.top+s.height,r)},La={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[]};function Fu(t){var e,r,n,i,o,s,l=X0(),f=Y0(),d=I9(),h=Ut(Ut({},t),{},{stroke:(e=t.stroke)!==null&&e!==void 0?e:La.stroke,fill:(r=t.fill)!==null&&r!==void 0?r:La.fill,horizontal:(n=t.horizontal)!==null&&n!==void 0?n:La.horizontal,horizontalFill:(i=t.horizontalFill)!==null&&i!==void 0?i:La.horizontalFill,vertical:(o=t.vertical)!==null&&o!==void 0?o:La.vertical,verticalFill:(s=t.verticalFill)!==null&&s!==void 0?s:La.verticalFill,x:ce(t.x)?t.x:d.left,y:ce(t.y)?t.y:d.top,width:ce(t.width)?t.width:d.width,height:ce(t.height)?t.height:d.height}),m=h.x,v=h.y,g=h.width,_=h.height,w=h.syncWithTicks,x=h.horizontalValues,O=h.verticalValues,P=j9(),A=N9();if(!ce(g)||g<=0||!ce(_)||_<=0||!ce(m)||m!==+m||!ce(v)||v!==+v)return null;var C=h.verticalCoordinatesGenerator||HV,S=h.horizontalCoordinatesGenerator||GV,E=h.horizontalPoints,k=h.verticalPoints;if((!E||!E.length)&&Re(S)){var N=x&&x.length,I=S({yAxis:A?Ut(Ut({},A),{},{ticks:N?x:A.ticks}):void 0,width:l,height:f,offset:d},N?!0:w);Ln(Array.isArray(I),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(aa(I),"]")),Array.isArray(I)&&(E=I)}if((!k||!k.length)&&Re(C)){var U=O&&O.length,$=C({xAxis:P?Ut(Ut({},P),{},{ticks:U?O:P.ticks}):void 0,width:l,height:f,offset:d},U?!0:w);Ln(Array.isArray($),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(aa($),"]")),Array.isArray($)&&(k=$)}return L.createElement("g",{className:"recharts-cartesian-grid"},L.createElement(qV,{fill:h.fill,fillOpacity:h.fillOpacity,x:h.x,y:h.y,width:h.width,height:h.height,ry:h.ry}),L.createElement(FV,Zi({},h,{offset:d,horizontalPoints:E,xAxis:P,yAxis:A})),L.createElement(UV,Zi({},h,{offset:d,verticalPoints:k,xAxis:P,yAxis:A})),L.createElement(WV,Zi({},h,{horizontalPoints:E})),L.createElement(VV,Zi({},h,{verticalPoints:k})))}Fu.displayName="CartesianGrid";var KV=["type","layout","connectNulls","ref"],ZV=["key"];function bo(t){"@babel/helpers - typeof";return bo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},bo(t)}function BT(t,e){if(t==null)return{};var r=XV(t,e),n,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function XV(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}function Gu(){return Gu=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var r=0,n=new Array(e);rm){g=[].concat(za(f.slice(0,_)),[m-w]);break}var x=g.length%2===0?[0,v]:[v];return[].concat(za(e.repeat(f,h)),za(g),x).map(function(O){return"".concat(O,"px")}).join(", ")}),Wr(r,"id",jo("recharts-line-")),Wr(r,"pathRef",function(s){r.mainCurve=s}),Wr(r,"handleAnimationEnd",function(){r.setState({isAnimationFinished:!0}),r.props.onAnimationEnd&&r.props.onAnimationEnd()}),Wr(r,"handleAnimationStart",function(){r.setState({isAnimationFinished:!1}),r.props.onAnimationStart&&r.props.onAnimationStart()}),r}return oH(e,t),rH(e,[{key:"componentDidMount",value:function(){if(this.props.isAnimationActive){var n=this.getTotalLength();this.setState({totalLength:n})}}},{key:"componentDidUpdate",value:function(){if(this.props.isAnimationActive){var n=this.getTotalLength();n!==this.state.totalLength&&this.setState({totalLength:n})}}},{key:"getTotalLength",value:function(){var n=this.mainCurve;try{return n&&n.getTotalLength&&n.getTotalLength()||0}catch{return 0}}},{key:"renderErrorBar",value:function(n,i){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var o=this.props,s=o.points,l=o.xAxis,f=o.yAxis,d=o.layout,h=o.children,m=or(h,$o);if(!m)return null;var v=function(w,x){return{x:w.x,y:w.y,value:w.value,errorVal:$t(w.payload,x)}},g={clipPath:n?"url(#clipPath-".concat(i,")"):null};return L.createElement(tt,g,m.map(function(_){return L.cloneElement(_,{key:"bar-".concat(_.props.dataKey),data:s,xAxis:l,yAxis:f,layout:d,dataPointFormatter:v})}))}},{key:"renderDots",value:function(n,i,o){var s=this.props.isAnimationActive;if(s&&!this.state.isAnimationFinished)return null;var l=this.props,f=l.dot,d=l.points,h=l.dataKey,m=Le(this.props,!1),v=Le(f,!0),g=d.map(function(w,x){var O=dr(dr(dr({key:"dot-".concat(x),r:3},m),v),{},{value:w.value,dataKey:h,cx:w.x,cy:w.y,index:x,payload:w.payload});return e.renderDotItem(f,O)}),_={clipPath:n?"url(#clipPath-".concat(i?"":"dots-").concat(o,")"):null};return L.createElement(tt,Gu({className:"recharts-line-dots",key:"dots"},_),g)}},{key:"renderCurveStatically",value:function(n,i,o,s){var l=this.props,f=l.type,d=l.layout,h=l.connectNulls;l.ref;var m=BT(l,KV),v=dr(dr(dr({},Le(m,!0)),{},{fill:"none",className:"recharts-line-curve",clipPath:i?"url(#clipPath-".concat(o,")"):null,points:n},s),{},{type:f,layout:d,connectNulls:h});return L.createElement(df,Gu({},v,{pathRef:this.pathRef}))}},{key:"renderCurveWithAnimation",value:function(n,i){var o=this,s=this.props,l=s.points,f=s.strokeDasharray,d=s.isAnimationActive,h=s.animationBegin,m=s.animationDuration,v=s.animationEasing,g=s.animationId,_=s.animateNewValues,w=s.width,x=s.height,O=this.state,P=O.prevPoints,A=O.totalLength;return L.createElement(bn,{begin:h,duration:m,isActive:d,easing:v,from:{t:0},to:{t:1},key:"line-".concat(g),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(C){var S=C.t;if(P){var E=P.length/l.length,k=l.map(function(B,V){var X=Math.floor(V*E);if(P[X]){var Z=P[X],Y=Zt(Z.x,B.x),te=Zt(Z.y,B.y);return dr(dr({},B),{},{x:Y(S),y:te(S)})}if(_){var H=Zt(w*2,B.x),Q=Zt(x/2,B.y);return dr(dr({},B),{},{x:H(S),y:Q(S)})}return dr(dr({},B),{},{x:B.x,y:B.y})});return o.renderCurveStatically(k,n,i)}var N=Zt(0,A),I=N(S),U;if(f){var $="".concat(f).split(/[,\s]+/gim).map(function(B){return parseFloat(B)});U=o.getStrokeDasharray(I,A,$)}else U=o.generateSimpleStrokeDasharray(A,I);return o.renderCurveStatically(l,n,i,{strokeDasharray:U})})}},{key:"renderCurve",value:function(n,i){var o=this.props,s=o.points,l=o.isAnimationActive,f=this.state,d=f.prevPoints,h=f.totalLength;return l&&s&&s.length&&(!d&&h>0||!tl(d,s))?this.renderCurveWithAnimation(n,i):this.renderCurveStatically(s,n,i)}},{key:"render",value:function(){var n,i=this.props,o=i.hide,s=i.dot,l=i.points,f=i.className,d=i.xAxis,h=i.yAxis,m=i.top,v=i.left,g=i.width,_=i.height,w=i.isAnimationActive,x=i.id;if(o||!l||!l.length)return null;var O=this.state.isAnimationFinished,P=l.length===1,A=Be("recharts-line",f),C=d&&d.allowDataOverflow,S=h&&h.allowDataOverflow,E=C||S,k=Ne(x)?this.id:x,N=(n=Le(s,!1))!==null&&n!==void 0?n:{r:3,strokeWidth:2},I=N.r,U=I===void 0?3:I,$=N.strokeWidth,B=$===void 0?2:$,V=AD(s)?s:{},X=V.clipDot,Z=X===void 0?!0:X,Y=U*2+B;return L.createElement(tt,{className:A},C||S?L.createElement("defs",null,L.createElement("clipPath",{id:"clipPath-".concat(k)},L.createElement("rect",{x:C?v:v-g/2,y:S?m:m-_/2,width:C?g:g*2,height:S?_:_*2})),!Z&&L.createElement("clipPath",{id:"clipPath-dots-".concat(k)},L.createElement("rect",{x:v-Y/2,y:m-Y/2,width:g+Y,height:_+Y}))):null,!P&&this.renderCurve(E,k),this.renderErrorBar(E,k),(P||s)&&this.renderDots(E,Z,k),(!w||O)&&Bn.renderCallByParent(this.props,l))}}],[{key:"getDerivedStateFromProps",value:function(n,i){return n.animationId!==i.prevAnimationId?{prevAnimationId:n.animationId,curPoints:n.points,prevPoints:i.curPoints}:n.points!==i.curPoints?{curPoints:n.points}:null}},{key:"repeat",value:function(n,i){for(var o=n.length%2!==0?[].concat(za(n),[0]):n,s=[],l=0;l=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function gH(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}function bH(t){var e=t.option,r=t.isActive,n=yH(t,vH);return typeof e=="string"?L.createElement(wb,Ku({option:L.createElement(Kf,Ku({type:e},n)),isActive:r,shapeType:"symbols"},n)):L.createElement(wb,Ku({option:e,isActive:r,shapeType:"symbols"},n))}function _o(t){"@babel/helpers - typeof";return _o=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_o(t)}function Zu(){return Zu=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var r=0,n=new Array(e);r=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function mG(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}function vG(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function yG(t,e){for(var r=0;rt.length)&&(e=t.length);for(var r=0,n=new Array(e);r0?s:e&&e.length&&ce(i)&&ce(o)?e.slice(i,o+1):[]};function MN(t){return t==="number"?[0,"auto"]:void 0}var Wb=function(e,r,n,i){var o=e.graphicalItems,s=e.tooltipAxis,l=vd(r,e);return n<0||!o||!o.length||n>=l.length?null:o.reduce(function(f,d){var h,m=(h=d.props.data)!==null&&h!==void 0?h:r;m&&e.dataStartIndex+e.dataEndIndex!==0&&e.dataEndIndex-e.dataStartIndex>=n&&(m=m.slice(e.dataStartIndex,e.dataEndIndex+1));var v;if(s.dataKey&&!s.allowDuplicatedCategory){var g=m===void 0?l:m;v=Rc(g,s.dataKey,i)}else v=m&&m[n]||l[n];return v?[].concat(Ao(f),[Cj(d,v)]):f},[])},YT=function(e,r,n,i){var o=i||{x:e.chartX,y:e.chartY},s=CG(o,n),l=e.orderedTooltipTicks,f=e.tooltipAxis,d=e.tooltipTicks,h=A8(s,l,d,f);if(h>=0&&d){var m=d[h]&&d[h].value,v=Wb(e,r,h,m),g=kG(n,l,h,o);return{activeTooltipIndex:h,activeLabel:m,activePayload:v,activeCoordinate:g}}return null},jG=function(e,r){var n=r.axes,i=r.graphicalItems,o=r.axisType,s=r.axisIdKey,l=r.stackGroups,f=r.dataStartIndex,d=r.dataEndIndex,h=e.layout,m=e.children,v=e.stackOffset,g=Aj(h,o);return n.reduce(function(_,w){var x,O=w.type.defaultProps!==void 0?J(J({},w.type.defaultProps),w.props):w.props,P=O.type,A=O.dataKey,C=O.allowDataOverflow,S=O.allowDuplicatedCategory,E=O.scale,k=O.ticks,N=O.includeHidden,I=O[s];if(_[I])return _;var U=vd(e.data,{graphicalItems:i.filter(function(F){var le,ye=s in F.props?F.props[s]:(le=F.type.defaultProps)===null||le===void 0?void 0:le[s];return ye===I}),dataStartIndex:f,dataEndIndex:d}),$=U.length,B,V,X;nG(O.domain,C,P)&&(B=ab(O.domain,null,C),g&&(P==="number"||E!=="auto")&&(X=Vu(U,A,"category")));var Z=MN(P);if(!B||B.length===0){var Y,te=(Y=O.domain)!==null&&Y!==void 0?Y:Z;if(A){if(B=Vu(U,A,P),P==="category"&&g){var H=vD(B);S&&H?(V=B,B=bf(0,$)):S||(B=oE(te,B,w).reduce(function(F,le){return F.indexOf(le)>=0?F:[].concat(Ao(F),[le])},[]))}else if(P==="category")S?B=B.filter(function(F){return F!==""&&!Ne(F)}):B=oE(te,B,w).reduce(function(F,le){return F.indexOf(le)>=0||le===""||Ne(le)?F:[].concat(Ao(F),[le])},[]);else if(P==="number"){var Q=j8(U,i.filter(function(F){var le,ye,_e=s in F.props?F.props[s]:(le=F.type.defaultProps)===null||le===void 0?void 0:le[s],Ce="hide"in F.props?F.props.hide:(ye=F.type.defaultProps)===null||ye===void 0?void 0:ye.hide;return _e===I&&(N||!Ce)}),A,o,h);Q&&(B=Q)}g&&(P==="number"||E!=="auto")&&(X=Vu(U,A,"category"))}else g?B=bf(0,$):l&&l[I]&&l[I].hasStack&&P==="number"?B=v==="expand"?[0,1]:Tj(l[I].stackGroups,f,d):B=Pj(U,i.filter(function(F){var le=s in F.props?F.props[s]:F.type.defaultProps[s],ye="hide"in F.props?F.props.hide:F.type.defaultProps.hide;return le===I&&(N||!ye)}),P,h,!0);if(P==="number")B=qb(m,B,I,o,k),te&&(B=ab(te,B,C));else if(P==="category"&&te){var ee=te,M=B.every(function(F){return ee.indexOf(F)>=0});M&&(B=ee)}}return J(J({},_),{},Pe({},I,J(J({},O),{},{axisType:o,domain:B,categoricalDomain:X,duplicateDomain:V,originalDomain:(x=O.domain)!==null&&x!==void 0?x:Z,isCategorical:g,layout:h})))},{})},NG=function(e,r){var n=r.graphicalItems,i=r.Axis,o=r.axisType,s=r.axisIdKey,l=r.stackGroups,f=r.dataStartIndex,d=r.dataEndIndex,h=e.layout,m=e.children,v=vd(e.data,{graphicalItems:n,dataStartIndex:f,dataEndIndex:d}),g=v.length,_=Aj(h,o),w=-1;return n.reduce(function(x,O){var P=O.type.defaultProps!==void 0?J(J({},O.type.defaultProps),O.props):O.props,A=P[s],C=MN("number");if(!x[A]){w++;var S;return _?S=bf(0,g):l&&l[A]&&l[A].hasStack?(S=Tj(l[A].stackGroups,f,d),S=qb(m,S,A,o)):(S=ab(C,Pj(v,n.filter(function(E){var k,N,I=s in E.props?E.props[s]:(k=E.type.defaultProps)===null||k===void 0?void 0:k[s],U="hide"in E.props?E.props.hide:(N=E.type.defaultProps)===null||N===void 0?void 0:N.hide;return I===A&&!U}),"number",h),i.defaultProps.allowDataOverflow),S=qb(m,S,A,o)),J(J({},x),{},Pe({},A,J(J({axisType:o},i.defaultProps),{},{hide:!0,orientation:Tr(EG,"".concat(o,".").concat(w%2),null),domain:S,originalDomain:C,isCategorical:_,layout:h})))}return x},{})},MG=function(e,r){var n=r.axisType,i=n===void 0?"xAxis":n,o=r.AxisComp,s=r.graphicalItems,l=r.stackGroups,f=r.dataStartIndex,d=r.dataEndIndex,h=e.children,m="".concat(i,"Id"),v=or(h,o),g={};return v.length?g=jG(e,{axes:v,graphicalItems:s,axisType:i,axisIdKey:m,stackGroups:l,dataStartIndex:f,dataEndIndex:d}):s&&s.length&&(g=NG(e,{Axis:o,graphicalItems:s,axisType:i,axisIdKey:m,stackGroups:l,dataStartIndex:f,dataEndIndex:d})),g},IG=function(e){var r=vi(e),n=$n(r,!1,!0);return{tooltipTicks:n,orderedTooltipTicks:v0(n,function(i){return i.coordinate}),tooltipAxis:r,tooltipAxisBandSize:lf(r,n)}},QT=function(e){var r=e.children,n=e.defaultShowTooltip,i=hr(r,po),o=0,s=0;return e.data&&e.data.length!==0&&(s=e.data.length-1),i&&i.props&&(i.props.startIndex>=0&&(o=i.props.startIndex),i.props.endIndex>=0&&(s=i.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:o,dataEndIndex:s,activeTooltipIndex:-1,isTooltipActive:!!n}},RG=function(e){return!e||!e.length?!1:e.some(function(r){var n=Dn(r&&r.type);return n&&n.indexOf("Bar")>=0})},JT=function(e){return e==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:e==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:e==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},$G=function(e,r){var n=e.props,i=e.graphicalItems,o=e.xAxisMap,s=o===void 0?{}:o,l=e.yAxisMap,f=l===void 0?{}:l,d=n.width,h=n.height,m=n.children,v=n.margin||{},g=hr(m,po),_=hr(m,Ka),w=Object.keys(f).reduce(function(S,E){var k=f[E],N=k.orientation;return!k.mirror&&!k.hide?J(J({},S),{},Pe({},N,S[N]+k.width)):S},{left:v.left||0,right:v.right||0}),x=Object.keys(s).reduce(function(S,E){var k=s[E],N=k.orientation;return!k.mirror&&!k.hide?J(J({},S),{},Pe({},N,Tr(S,"".concat(N))+k.height)):S},{top:v.top||0,bottom:v.bottom||0}),O=J(J({},x),w),P=O.bottom;g&&(O.bottom+=g.props.height||po.defaultProps.height),_&&r&&(O=C8(O,i,n,r));var A=d-O.left-O.right,C=h-O.top-O.bottom;return J(J({brushBottom:P},O),{},{width:Math.max(A,0),height:Math.max(C,0)})},DG=function(e,r){if(r==="xAxis")return e[r].width;if(r==="yAxis")return e[r].height},rx=function(e){var r=e.chartName,n=e.GraphicalChild,i=e.defaultTooltipEventType,o=i===void 0?"axis":i,s=e.validateTooltipEventTypes,l=s===void 0?["axis"]:s,f=e.axisComponents,d=e.legendContent,h=e.formatAxisMap,m=e.defaultProps,v=function(O,P){var A=P.graphicalItems,C=P.stackGroups,S=P.offset,E=P.updateId,k=P.dataStartIndex,N=P.dataEndIndex,I=O.barSize,U=O.layout,$=O.barGap,B=O.barCategoryGap,V=O.maxBarSize,X=JT(U),Z=X.numericAxisName,Y=X.cateAxisName,te=RG(A),H=[];return A.forEach(function(Q,ee){var M=vd(O.data,{graphicalItems:[Q],dataStartIndex:k,dataEndIndex:N}),F=Q.type.defaultProps!==void 0?J(J({},Q.type.defaultProps),Q.props):Q.props,le=F.dataKey,ye=F.maxBarSize,_e=F["".concat(Z,"Id")],Ce=F["".concat(Y,"Id")],qe={},ke=f.reduce(function(Qt,Mr){var fa=P["".concat(Mr.axisType,"Map")],zo=F["".concat(Mr.axisType,"Id")];fa&&fa[zo]||Mr.axisType==="zAxis"||ia();var Bo=fa[zo];return J(J({},Qt),{},Pe(Pe({},Mr.axisType,Bo),"".concat(Mr.axisType,"Ticks"),$n(Bo)))},qe),oe=ke[Y],we=ke["".concat(Y,"Ticks")],je=C&&C[_e]&&C[_e].hasStack&&U8(Q,C[_e].stackGroups),ie=Dn(Q.type).indexOf("Bar")>=0,Xe=lf(oe,we),ze=[],ft=te&&E8({barSize:I,stackGroups:C,totalSize:DG(ke,Y)});if(ie){var dt,At,Nr=Ne(ye)?V:ye,Qr=(dt=(At=lf(oe,we,!0))!==null&&At!==void 0?At:Nr)!==null&&dt!==void 0?dt:0;ze=T8({barGap:$,barCategoryGap:B,bandSize:Qr!==Xe?Qr:Xe,sizeList:ft[Ce],maxBarSize:Nr}),Qr!==Xe&&(ze=ze.map(function(Qt){return J(J({},Qt),{},{position:J(J({},Qt.position),{},{offset:Qt.position.offset-Qr/2})})}))}var Jr=Q&&Q.type&&Q.type.getComposedData;Jr&&H.push({props:J(J({},Jr(J(J({},ke),{},{displayedData:M,props:O,dataKey:le,item:Q,bandSize:Xe,barPosition:ze,offset:S,stackedData:je,layout:U,dataStartIndex:k,dataEndIndex:N}))),{},Pe(Pe(Pe({key:Q.key||"item-".concat(ee)},Z,ke[Z]),Y,ke[Y]),"animationId",E)),childIndex:CD(Q,O.children),item:Q})}),H},g=function(O,P){var A=O.props,C=O.dataStartIndex,S=O.dataEndIndex,E=O.updateId;if(!wS({props:A}))return null;var k=A.children,N=A.layout,I=A.stackOffset,U=A.data,$=A.reverseStackOrder,B=JT(N),V=B.numericAxisName,X=B.cateAxisName,Z=or(k,n),Y=B8(U,Z,"".concat(V,"Id"),"".concat(X,"Id"),I,$),te=f.reduce(function(F,le){var ye="".concat(le.axisType,"Map");return J(J({},F),{},Pe({},ye,MG(A,J(J({},le),{},{graphicalItems:Z,stackGroups:le.axisType===V&&Y,dataStartIndex:C,dataEndIndex:S}))))},{}),H=$G(J(J({},te),{},{props:A,graphicalItems:Z}),P==null?void 0:P.legendBBox);Object.keys(te).forEach(function(F){te[F]=h(A,te[F],H,F.replace("Map",""),r)});var Q=te["".concat(X,"Map")],ee=IG(Q),M=v(A,J(J({},te),{},{dataStartIndex:C,dataEndIndex:S,updateId:E,graphicalItems:Z,stackGroups:Y,offset:H}));return J(J({formattedGraphicalItems:M,graphicalItems:Z,offset:H,stackGroups:Y},ee),te)},_=function(x){function O(P){var A,C,S;return vG(this,O),S=bG(this,O,[P]),Pe(S,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),Pe(S,"accessibilityManager",new rG),Pe(S,"handleLegendBBoxUpdate",function(E){if(E){var k=S.state,N=k.dataStartIndex,I=k.dataEndIndex,U=k.updateId;S.setState(J({legendBBox:E},g({props:S.props,dataStartIndex:N,dataEndIndex:I,updateId:U},J(J({},S.state),{},{legendBBox:E}))))}}),Pe(S,"handleReceiveSyncEvent",function(E,k,N){if(S.props.syncId===E){if(N===S.eventEmitterSymbol&&typeof S.props.syncMethod!="function")return;S.applySyncEvent(k)}}),Pe(S,"handleBrushChange",function(E){var k=E.startIndex,N=E.endIndex;if(k!==S.state.dataStartIndex||N!==S.state.dataEndIndex){var I=S.state.updateId;S.setState(function(){return J({dataStartIndex:k,dataEndIndex:N},g({props:S.props,dataStartIndex:k,dataEndIndex:N,updateId:I},S.state))}),S.triggerSyncEvent({dataStartIndex:k,dataEndIndex:N})}}),Pe(S,"handleMouseEnter",function(E){var k=S.getMouseInfo(E);if(k){var N=J(J({},k),{},{isTooltipActive:!0});S.setState(N),S.triggerSyncEvent(N);var I=S.props.onMouseEnter;Re(I)&&I(N,E)}}),Pe(S,"triggeredAfterMouseMove",function(E){var k=S.getMouseInfo(E),N=k?J(J({},k),{},{isTooltipActive:!0}):{isTooltipActive:!1};S.setState(N),S.triggerSyncEvent(N);var I=S.props.onMouseMove;Re(I)&&I(N,E)}),Pe(S,"handleItemMouseEnter",function(E){S.setState(function(){return{isTooltipActive:!0,activeItem:E,activePayload:E.tooltipPayload,activeCoordinate:E.tooltipPosition||{x:E.cx,y:E.cy}}})}),Pe(S,"handleItemMouseLeave",function(){S.setState(function(){return{isTooltipActive:!1}})}),Pe(S,"handleMouseMove",function(E){E.persist(),S.throttleTriggeredAfterMouseMove(E)}),Pe(S,"handleMouseLeave",function(E){S.throttleTriggeredAfterMouseMove.cancel();var k={isTooltipActive:!1};S.setState(k),S.triggerSyncEvent(k);var N=S.props.onMouseLeave;Re(N)&&N(k,E)}),Pe(S,"handleOuterEvent",function(E){var k=TD(E),N=Tr(S.props,"".concat(k));if(k&&Re(N)){var I,U;/.*touch.*/i.test(k)?U=S.getMouseInfo(E.changedTouches[0]):U=S.getMouseInfo(E),N((I=U)!==null&&I!==void 0?I:{},E)}}),Pe(S,"handleClick",function(E){var k=S.getMouseInfo(E);if(k){var N=J(J({},k),{},{isTooltipActive:!0});S.setState(N),S.triggerSyncEvent(N);var I=S.props.onClick;Re(I)&&I(N,E)}}),Pe(S,"handleMouseDown",function(E){var k=S.props.onMouseDown;if(Re(k)){var N=S.getMouseInfo(E);k(N,E)}}),Pe(S,"handleMouseUp",function(E){var k=S.props.onMouseUp;if(Re(k)){var N=S.getMouseInfo(E);k(N,E)}}),Pe(S,"handleTouchMove",function(E){E.changedTouches!=null&&E.changedTouches.length>0&&S.throttleTriggeredAfterMouseMove(E.changedTouches[0])}),Pe(S,"handleTouchStart",function(E){E.changedTouches!=null&&E.changedTouches.length>0&&S.handleMouseDown(E.changedTouches[0])}),Pe(S,"handleTouchEnd",function(E){E.changedTouches!=null&&E.changedTouches.length>0&&S.handleMouseUp(E.changedTouches[0])}),Pe(S,"handleDoubleClick",function(E){var k=S.props.onDoubleClick;if(Re(k)){var N=S.getMouseInfo(E);k(N,E)}}),Pe(S,"handleContextMenu",function(E){var k=S.props.onContextMenu;if(Re(k)){var N=S.getMouseInfo(E);k(N,E)}}),Pe(S,"triggerSyncEvent",function(E){S.props.syncId!==void 0&&hg.emit(mg,S.props.syncId,E,S.eventEmitterSymbol)}),Pe(S,"applySyncEvent",function(E){var k=S.props,N=k.layout,I=k.syncMethod,U=S.state.updateId,$=E.dataStartIndex,B=E.dataEndIndex;if(E.dataStartIndex!==void 0||E.dataEndIndex!==void 0)S.setState(J({dataStartIndex:$,dataEndIndex:B},g({props:S.props,dataStartIndex:$,dataEndIndex:B,updateId:U},S.state)));else if(E.activeTooltipIndex!==void 0){var V=E.chartX,X=E.chartY,Z=E.activeTooltipIndex,Y=S.state,te=Y.offset,H=Y.tooltipTicks;if(!te)return;if(typeof I=="function")Z=I(H,E);else if(I==="value"){Z=-1;for(var Q=0;Q=0){var je,ie;if(V.dataKey&&!V.allowDuplicatedCategory){var Xe=typeof V.dataKey=="function"?we:"payload.".concat(V.dataKey.toString());je=Rc(Q,Xe,Z),ie=ee&&M&&Rc(M,Xe,Z)}else je=Q==null?void 0:Q[X],ie=ee&&M&&M[X];if(Ce||_e){var ze=E.props.activeIndex!==void 0?E.props.activeIndex:X;return[R.cloneElement(E,J(J(J({},I.props),ke),{},{activeIndex:ze})),null,null]}if(!Ne(je))return[oe].concat(Ao(S.renderActivePoints({item:I,activePoint:je,basePoint:ie,childIndex:X,isRange:ee})))}else{var ft,dt=(ft=S.getItemByXY(S.state.activeCoordinate))!==null&&ft!==void 0?ft:{graphicalItem:oe},At=dt.graphicalItem,Nr=At.item,Qr=Nr===void 0?E:Nr,Jr=At.childIndex,Qt=J(J(J({},I.props),ke),{},{activeIndex:Jr});return[R.cloneElement(Qr,Qt),null,null]}return ee?[oe,null,null]:[oe,null]}),Pe(S,"renderCustomized",function(E,k,N){return R.cloneElement(E,J(J({key:"recharts-customized-".concat(N)},S.props),S.state))}),Pe(S,"renderMap",{CartesianGrid:{handler:Ac,once:!0},ReferenceArea:{handler:S.renderReferenceElement},ReferenceLine:{handler:Ac},ReferenceDot:{handler:S.renderReferenceElement},XAxis:{handler:Ac},YAxis:{handler:Ac},Brush:{handler:S.renderBrush,once:!0},Bar:{handler:S.renderGraphicChild},Line:{handler:S.renderGraphicChild},Area:{handler:S.renderGraphicChild},Radar:{handler:S.renderGraphicChild},RadialBar:{handler:S.renderGraphicChild},Scatter:{handler:S.renderGraphicChild},Pie:{handler:S.renderGraphicChild},Funnel:{handler:S.renderGraphicChild},Tooltip:{handler:S.renderCursor,once:!0},PolarGrid:{handler:S.renderPolarGrid,once:!0},PolarAngleAxis:{handler:S.renderPolarAxis},PolarRadiusAxis:{handler:S.renderPolarAxis},Customized:{handler:S.renderCustomized}}),S.clipPathId="".concat((A=P.id)!==null&&A!==void 0?A:jo("recharts"),"-clip"),S.throttleTriggeredAfterMouseMove=Sk(S.triggeredAfterMouseMove,(C=P.throttleDelay)!==null&&C!==void 0?C:1e3/60),S.state={},S}return _G(O,x),gG(O,[{key:"componentDidMount",value:function(){var A,C;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(A=this.props.margin.left)!==null&&A!==void 0?A:0,top:(C=this.props.margin.top)!==null&&C!==void 0?C:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var A=this.props,C=A.children,S=A.data,E=A.height,k=A.layout,N=hr(C,on);if(N){var I=N.props.defaultIndex;if(!(typeof I!="number"||I<0||I>this.state.tooltipTicks.length-1)){var U=this.state.tooltipTicks[I]&&this.state.tooltipTicks[I].value,$=Wb(this.state,S,I,U),B=this.state.tooltipTicks[I].coordinate,V=(this.state.offset.top+E)/2,X=k==="horizontal",Z=X?{x:B,y:V}:{y:B,x:V},Y=this.state.formattedGraphicalItems.find(function(H){var Q=H.item;return Q.type.name==="Scatter"});Y&&(Z=J(J({},Z),Y.props.points[I].tooltipPosition),$=Y.props.points[I].tooltipPayload);var te={activeTooltipIndex:I,isTooltipActive:!0,activeLabel:U,activePayload:$,activeCoordinate:Z};this.setState(te),this.renderCursor(N),this.accessibilityManager.setIndex(I)}}}},{key:"getSnapshotBeforeUpdate",value:function(A,C){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==C.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==A.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==A.margin){var S,E;this.accessibilityManager.setDetails({offset:{left:(S=this.props.margin.left)!==null&&S!==void 0?S:0,top:(E=this.props.margin.top)!==null&&E!==void 0?E:0}})}return null}},{key:"componentDidUpdate",value:function(A){Eg([hr(A.children,on)],[hr(this.props.children,on)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var A=hr(this.props.children,on);if(A&&typeof A.props.shared=="boolean"){var C=A.props.shared?"axis":"item";return l.indexOf(C)>=0?C:o}return o}},{key:"getMouseInfo",value:function(A){if(!this.container)return null;var C=this.container,S=C.getBoundingClientRect(),E=vB(S),k={chartX:Math.round(A.pageX-E.left),chartY:Math.round(A.pageY-E.top)},N=S.width/C.offsetWidth||1,I=this.inRange(k.chartX,k.chartY,N);if(!I)return null;var U=this.state,$=U.xAxisMap,B=U.yAxisMap,V=this.getTooltipEventType();if(V!=="axis"&&$&&B){var X=vi($).scale,Z=vi(B).scale,Y=X&&X.invert?X.invert(k.chartX):null,te=Z&&Z.invert?Z.invert(k.chartY):null;return J(J({},k),{},{xValue:Y,yValue:te})}var H=YT(this.state,this.props.data,this.props.layout,I);return H?J(J({},k),H):null}},{key:"inRange",value:function(A,C){var S=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,E=this.props.layout,k=A/S,N=C/S;if(E==="horizontal"||E==="vertical"){var I=this.state.offset,U=k>=I.left&&k<=I.left+I.width&&N>=I.top&&N<=I.top+I.height;return U?{x:k,y:N}:null}var $=this.state,B=$.angleAxisMap,V=$.radiusAxisMap;if(B&&V){var X=vi(B);return lE({x:k,y:N},X)}return null}},{key:"parseEventsOfWrapper",value:function(){var A=this.props.children,C=this.getTooltipEventType(),S=hr(A,on),E={};S&&C==="axis"&&(S.props.trigger==="click"?E={onClick:this.handleClick}:E={onMouseEnter:this.handleMouseEnter,onDoubleClick:this.handleDoubleClick,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd,onContextMenu:this.handleContextMenu});var k=$c(this.props,this.handleOuterEvent);return J(J({},k),E)}},{key:"addListener",value:function(){hg.on(mg,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){hg.removeListener(mg,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(A,C,S){for(var E=this.state.formattedGraphicalItems,k=0,N=E.length;ke.split(" ")[0]}),D.jsx(cn,{tickLine:!1,axisLine:!1,fontSize:12,tickFormatter:e=>`${e/1e3}k`}),D.jsx(xo,{type:"monotone",dataKey:"y",stroke:"hsl(var(--foreground))",strokeWidth:1.5,dot:!1})]})})]}),D.jsxs("div",{className:"space-y-2",children:[D.jsxs("div",{className:"space-y-1",children:[D.jsx("h2",{className:"text-base font-medium",children:"New Chats Created"}),D.jsx("p",{className:"text-sm text-muted-foreground",children:"Weekly chat creation activity"})]}),D.jsx("div",{className:"h-[200px] w-full",children:D.jsxs(tC,{width:500,height:400,data:t.new_chats_per_week,children:[D.jsx(Fu,{strokeDasharray:"3 3",vertical:!1,stroke:"hsl(var(--border))"}),D.jsx(ln,{dataKey:"x",tickLine:!1,axisLine:!1,fontSize:12,tickFormatter:e=>e.split(" ")[0]}),D.jsx(cn,{tickLine:!1,axisLine:!1,fontSize:12}),D.jsx(Oi,{dataKey:"y",fill:"rgb(231, 91, 87)",radius:[4,4,0,0]})]})})]}),D.jsxs("div",{className:"space-y-2",children:[D.jsxs("div",{className:"space-y-1",children:[D.jsx("h2",{className:"text-base font-medium",children:"Average Messages per Chat"}),D.jsx("p",{className:"text-sm text-muted-foreground",children:"Message density trends"})]}),D.jsx("div",{className:"h-[400px] w-full",children:D.jsxs(eC,{width:500,height:400,data:t.messages_per_chat,children:[D.jsx(Fu,{strokeDasharray:"3 3",vertical:!1,stroke:"hsl(var(--border))"}),D.jsx(ln,{dataKey:"x",tickLine:!1,axisLine:!1,fontSize:12,tickFormatter:e=>new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric"})}),D.jsx(cn,{tickLine:!1,axisLine:!1,fontSize:12,domain:[0,"auto"],tickFormatter:e=>`${e.toFixed(1)}`}),D.jsx(xo,{type:"monotone",dataKey:"y",stroke:"hsl(var(--foreground))",strokeWidth:1.5,dot:!1})]})})]}),D.jsxs("div",{className:"space-y-2",children:[D.jsxs("div",{className:"space-y-1",children:[D.jsx("h2",{className:"text-base font-medium",children:"Weekly Message Volume"}),D.jsx("p",{className:"text-sm text-muted-foreground",children:"Total messages sent per week"})]}),D.jsx("div",{className:"h-[200px] w-full",children:D.jsxs(tC,{width:500,height:400,data:t.messages_per_week,children:[D.jsx(Fu,{strokeDasharray:"3 3",vertical:!1,stroke:"hsl(var(--border))"}),D.jsx(ln,{dataKey:"x",tickLine:!1,axisLine:!1,fontSize:12,tickFormatter:e=>e.split(" ")[0]}),D.jsx(cn,{tickLine:!1,axisLine:!1,fontSize:12}),D.jsx(Oi,{dataKey:"y",fill:"rgb(231, 91, 87)",radius:[4,4,0,0]})]})})]})]})}var BG=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Yr=BG.reduce((t,e)=>{const r=R.forwardRef((n,i)=>{const{asChild:o,...s}=n,l=o?Xu:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),D.jsx(l,{...s,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),Rf=globalThis!=null&&globalThis.document?R.useLayoutEffect:()=>{};function qG(t,e){return R.useReducer((r,n)=>e[r][n]??r,t)}var Lo=t=>{const{present:e,children:r}=t,n=FG(e),i=typeof r=="function"?r({present:n.isPresent}):R.Children.only(r),o=mn(n.ref,UG(i));return typeof r=="function"||n.isPresent?R.cloneElement(i,{ref:o}):null};Lo.displayName="Presence";function FG(t){const[e,r]=R.useState(),n=R.useRef({}),i=R.useRef(t),o=R.useRef("none"),s=t?"mounted":"unmounted",[l,f]=qG(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return R.useEffect(()=>{const d=Ec(n.current);o.current=l==="mounted"?d:"none"},[l]),Rf(()=>{const d=n.current,h=i.current;if(h!==t){const v=o.current,g=Ec(d);t?f("MOUNT"):g==="none"||(d==null?void 0:d.display)==="none"?f("UNMOUNT"):f(h&&v!==g?"ANIMATION_OUT":"UNMOUNT"),i.current=t}},[t,f]),Rf(()=>{if(e){let d;const h=e.ownerDocument.defaultView??window,m=g=>{const w=Ec(n.current).includes(g.animationName);if(g.target===e&&w&&(f("ANIMATION_END"),!i.current)){const x=e.style.animationFillMode;e.style.animationFillMode="forwards",d=h.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=x)})}},v=g=>{g.target===e&&(o.current=Ec(n.current))};return e.addEventListener("animationstart",v),e.addEventListener("animationcancel",m),e.addEventListener("animationend",m),()=>{h.clearTimeout(d),e.removeEventListener("animationstart",v),e.removeEventListener("animationcancel",m),e.removeEventListener("animationend",m)}}else f("ANIMATION_END")},[e,f]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:R.useCallback(d=>{d&&(n.current=getComputedStyle(d)),r(d)},[])}}function Ec(t){return(t==null?void 0:t.animationName)||"none"}function UG(t){var n,i;let e=(n=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:n.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}function yd(t,e=[]){let r=[];function n(o,s){const l=R.createContext(s),f=r.length;r=[...r,s];const d=m=>{var O;const{scope:v,children:g,..._}=m,w=((O=v==null?void 0:v[t])==null?void 0:O[f])||l,x=R.useMemo(()=>_,Object.values(_));return D.jsx(w.Provider,{value:x,children:g})};d.displayName=o+"Provider";function h(m,v){var w;const g=((w=v==null?void 0:v[t])==null?void 0:w[f])||l,_=R.useContext(g);if(_)return _;if(s!==void 0)return s;throw new Error(`\`${m}\` must be used within \`${o}\``)}return[d,h]}const i=()=>{const o=r.map(s=>R.createContext(s));return function(l){const f=(l==null?void 0:l[t])||o;return R.useMemo(()=>({[`__scope${t}`]:{...l,[t]:f}}),[l,f])}};return i.scopeName=t,[n,WG(i,...e)]}function WG(...t){const e=t[0];if(t.length===1)return e;const r=()=>{const n=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const s=n.reduce((l,{useScope:f,scopeName:d})=>{const m=f(o)[`__scope${d}`];return{...l,...m}},{});return R.useMemo(()=>({[`__scope${e.scopeName}`]:s}),[s])}};return r.scopeName=e.scopeName,r}function un(t){const e=R.useRef(t);return R.useEffect(()=>{e.current=t}),R.useMemo(()=>(...r)=>{var n;return(n=e.current)==null?void 0:n.call(e,...r)},[])}var VG=R.createContext(void 0);function nx(t){const e=R.useContext(VG);return t||e||"ltr"}function HG(t,[e,r]){return Math.min(r,Math.max(e,t))}function Wt(t,e,{checkForDefaultPrevented:r=!0}={}){return function(i){if(t==null||t(i),r===!1||!i.defaultPrevented)return e==null?void 0:e(i)}}function GG(t,e){return R.useReducer((r,n)=>e[r][n]??r,t)}var ix="ScrollArea",[IN,$K]=yd(ix),[KG,jr]=IN(ix),RN=R.forwardRef((t,e)=>{const{__scopeScrollArea:r,type:n="hover",dir:i,scrollHideDelay:o=600,...s}=t,[l,f]=R.useState(null),[d,h]=R.useState(null),[m,v]=R.useState(null),[g,_]=R.useState(null),[w,x]=R.useState(null),[O,P]=R.useState(0),[A,C]=R.useState(0),[S,E]=R.useState(!1),[k,N]=R.useState(!1),I=mn(e,$=>f($)),U=nx(i);return D.jsx(KG,{scope:r,type:n,dir:U,scrollHideDelay:o,scrollArea:l,viewport:d,onViewportChange:h,content:m,onContentChange:v,scrollbarX:g,onScrollbarXChange:_,scrollbarXEnabled:S,onScrollbarXEnabledChange:E,scrollbarY:w,onScrollbarYChange:x,scrollbarYEnabled:k,onScrollbarYEnabledChange:N,onCornerWidthChange:P,onCornerHeightChange:C,children:D.jsx(Yr.div,{dir:U,...s,ref:I,style:{position:"relative","--radix-scroll-area-corner-width":O+"px","--radix-scroll-area-corner-height":A+"px",...t.style}})})});RN.displayName=ix;var $N="ScrollAreaViewport",DN=R.forwardRef((t,e)=>{const{__scopeScrollArea:r,children:n,nonce:i,...o}=t,s=jr($N,r),l=R.useRef(null),f=mn(e,l,s.onViewportChange);return D.jsxs(D.Fragment,{children:[D.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:i}),D.jsx(Yr.div,{"data-radix-scroll-area-viewport":"",...o,ref:f,style:{overflowX:s.scrollbarXEnabled?"scroll":"hidden",overflowY:s.scrollbarYEnabled?"scroll":"hidden",...t.style},children:D.jsx("div",{ref:s.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})});DN.displayName=$N;var wn="ScrollAreaScrollbar",ax=R.forwardRef((t,e)=>{const{forceMount:r,...n}=t,i=jr(wn,t.__scopeScrollArea),{onScrollbarXEnabledChange:o,onScrollbarYEnabledChange:s}=i,l=t.orientation==="horizontal";return R.useEffect(()=>(l?o(!0):s(!0),()=>{l?o(!1):s(!1)}),[l,o,s]),i.type==="hover"?D.jsx(ZG,{...n,ref:e,forceMount:r}):i.type==="scroll"?D.jsx(XG,{...n,ref:e,forceMount:r}):i.type==="auto"?D.jsx(LN,{...n,ref:e,forceMount:r}):i.type==="always"?D.jsx(ox,{...n,ref:e}):null});ax.displayName=wn;var ZG=R.forwardRef((t,e)=>{const{forceMount:r,...n}=t,i=jr(wn,t.__scopeScrollArea),[o,s]=R.useState(!1);return R.useEffect(()=>{const l=i.scrollArea;let f=0;if(l){const d=()=>{window.clearTimeout(f),s(!0)},h=()=>{f=window.setTimeout(()=>s(!1),i.scrollHideDelay)};return l.addEventListener("pointerenter",d),l.addEventListener("pointerleave",h),()=>{window.clearTimeout(f),l.removeEventListener("pointerenter",d),l.removeEventListener("pointerleave",h)}}},[i.scrollArea,i.scrollHideDelay]),D.jsx(Lo,{present:r||o,children:D.jsx(LN,{"data-state":o?"visible":"hidden",...n,ref:e})})}),XG=R.forwardRef((t,e)=>{const{forceMount:r,...n}=t,i=jr(wn,t.__scopeScrollArea),o=t.orientation==="horizontal",s=bd(()=>f("SCROLL_END"),100),[l,f]=GG("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return R.useEffect(()=>{if(l==="idle"){const d=window.setTimeout(()=>f("HIDE"),i.scrollHideDelay);return()=>window.clearTimeout(d)}},[l,i.scrollHideDelay,f]),R.useEffect(()=>{const d=i.viewport,h=o?"scrollLeft":"scrollTop";if(d){let m=d[h];const v=()=>{const g=d[h];m!==g&&(f("SCROLL"),s()),m=g};return d.addEventListener("scroll",v),()=>d.removeEventListener("scroll",v)}},[i.viewport,o,f,s]),D.jsx(Lo,{present:r||l!=="hidden",children:D.jsx(ox,{"data-state":l==="hidden"?"hidden":"visible",...n,ref:e,onPointerEnter:Wt(t.onPointerEnter,()=>f("POINTER_ENTER")),onPointerLeave:Wt(t.onPointerLeave,()=>f("POINTER_LEAVE"))})})}),LN=R.forwardRef((t,e)=>{const r=jr(wn,t.__scopeScrollArea),{forceMount:n,...i}=t,[o,s]=R.useState(!1),l=t.orientation==="horizontal",f=bd(()=>{if(r.viewport){const d=r.viewport.offsetWidth{const{orientation:r="vertical",...n}=t,i=jr(wn,t.__scopeScrollArea),o=R.useRef(null),s=R.useRef(0),[l,f]=R.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),d=UN(l.viewport,l.content),h={...n,sizes:l,onSizesChange:f,hasThumb:d>0&&d<1,onThumbChange:v=>o.current=v,onThumbPointerUp:()=>s.current=0,onThumbPointerDown:v=>s.current=v};function m(v,g){return rK(v,s.current,l,g)}return r==="horizontal"?D.jsx(YG,{...h,ref:e,onThumbPositionChange:()=>{if(i.viewport&&o.current){const v=i.viewport.scrollLeft,g=rC(v,l,i.dir);o.current.style.transform=`translate3d(${g}px, 0, 0)`}},onWheelScroll:v=>{i.viewport&&(i.viewport.scrollLeft=v)},onDragScroll:v=>{i.viewport&&(i.viewport.scrollLeft=m(v,i.dir))}}):r==="vertical"?D.jsx(QG,{...h,ref:e,onThumbPositionChange:()=>{if(i.viewport&&o.current){const v=i.viewport.scrollTop,g=rC(v,l);o.current.style.transform=`translate3d(0, ${g}px, 0)`}},onWheelScroll:v=>{i.viewport&&(i.viewport.scrollTop=v)},onDragScroll:v=>{i.viewport&&(i.viewport.scrollTop=m(v))}}):null}),YG=R.forwardRef((t,e)=>{const{sizes:r,onSizesChange:n,...i}=t,o=jr(wn,t.__scopeScrollArea),[s,l]=R.useState(),f=R.useRef(null),d=mn(e,f,o.onScrollbarXChange);return R.useEffect(()=>{f.current&&l(getComputedStyle(f.current))},[f]),D.jsx(BN,{"data-orientation":"horizontal",...i,ref:d,sizes:r,style:{bottom:0,left:o.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:o.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":gd(r)+"px",...t.style},onThumbPointerDown:h=>t.onThumbPointerDown(h.x),onDragScroll:h=>t.onDragScroll(h.x),onWheelScroll:(h,m)=>{if(o.viewport){const v=o.viewport.scrollLeft+h.deltaX;t.onWheelScroll(v),VN(v,m)&&h.preventDefault()}},onResize:()=>{f.current&&o.viewport&&s&&n({content:o.viewport.scrollWidth,viewport:o.viewport.offsetWidth,scrollbar:{size:f.current.clientWidth,paddingStart:Df(s.paddingLeft),paddingEnd:Df(s.paddingRight)}})}})}),QG=R.forwardRef((t,e)=>{const{sizes:r,onSizesChange:n,...i}=t,o=jr(wn,t.__scopeScrollArea),[s,l]=R.useState(),f=R.useRef(null),d=mn(e,f,o.onScrollbarYChange);return R.useEffect(()=>{f.current&&l(getComputedStyle(f.current))},[f]),D.jsx(BN,{"data-orientation":"vertical",...i,ref:d,sizes:r,style:{top:0,right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":gd(r)+"px",...t.style},onThumbPointerDown:h=>t.onThumbPointerDown(h.y),onDragScroll:h=>t.onDragScroll(h.y),onWheelScroll:(h,m)=>{if(o.viewport){const v=o.viewport.scrollTop+h.deltaY;t.onWheelScroll(v),VN(v,m)&&h.preventDefault()}},onResize:()=>{f.current&&o.viewport&&s&&n({content:o.viewport.scrollHeight,viewport:o.viewport.offsetHeight,scrollbar:{size:f.current.clientHeight,paddingStart:Df(s.paddingTop),paddingEnd:Df(s.paddingBottom)}})}})}),[JG,zN]=IN(wn),BN=R.forwardRef((t,e)=>{const{__scopeScrollArea:r,sizes:n,hasThumb:i,onThumbChange:o,onThumbPointerUp:s,onThumbPointerDown:l,onThumbPositionChange:f,onDragScroll:d,onWheelScroll:h,onResize:m,...v}=t,g=jr(wn,r),[_,w]=R.useState(null),x=mn(e,I=>w(I)),O=R.useRef(null),P=R.useRef(""),A=g.viewport,C=n.content-n.viewport,S=un(h),E=un(f),k=bd(m,10);function N(I){if(O.current){const U=I.clientX-O.current.left,$=I.clientY-O.current.top;d({x:U,y:$})}}return R.useEffect(()=>{const I=U=>{const $=U.target;(_==null?void 0:_.contains($))&&S(U,C)};return document.addEventListener("wheel",I,{passive:!1}),()=>document.removeEventListener("wheel",I,{passive:!1})},[A,_,C,S]),R.useEffect(E,[n,E]),Eo(_,k),Eo(g.content,k),D.jsx(JG,{scope:r,scrollbar:_,hasThumb:i,onThumbChange:un(o),onThumbPointerUp:un(s),onThumbPositionChange:E,onThumbPointerDown:un(l),children:D.jsx(Yr.div,{...v,ref:x,style:{position:"absolute",...v.style},onPointerDown:Wt(t.onPointerDown,I=>{I.button===0&&(I.target.setPointerCapture(I.pointerId),O.current=_.getBoundingClientRect(),P.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",g.viewport&&(g.viewport.style.scrollBehavior="auto"),N(I))}),onPointerMove:Wt(t.onPointerMove,N),onPointerUp:Wt(t.onPointerUp,I=>{const U=I.target;U.hasPointerCapture(I.pointerId)&&U.releasePointerCapture(I.pointerId),document.body.style.webkitUserSelect=P.current,g.viewport&&(g.viewport.style.scrollBehavior=""),O.current=null})})})}),$f="ScrollAreaThumb",qN=R.forwardRef((t,e)=>{const{forceMount:r,...n}=t,i=zN($f,t.__scopeScrollArea);return D.jsx(Lo,{present:r||i.hasThumb,children:D.jsx(eK,{ref:e,...n})})}),eK=R.forwardRef((t,e)=>{const{__scopeScrollArea:r,style:n,...i}=t,o=jr($f,r),s=zN($f,r),{onThumbPositionChange:l}=s,f=mn(e,m=>s.onThumbChange(m)),d=R.useRef(void 0),h=bd(()=>{d.current&&(d.current(),d.current=void 0)},100);return R.useEffect(()=>{const m=o.viewport;if(m){const v=()=>{if(h(),!d.current){const g=nK(m,l);d.current=g,l()}};return l(),m.addEventListener("scroll",v),()=>m.removeEventListener("scroll",v)}},[o.viewport,h,l]),D.jsx(Yr.div,{"data-state":s.hasThumb?"visible":"hidden",...i,ref:f,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...n},onPointerDownCapture:Wt(t.onPointerDownCapture,m=>{const g=m.target.getBoundingClientRect(),_=m.clientX-g.left,w=m.clientY-g.top;s.onThumbPointerDown({x:_,y:w})}),onPointerUp:Wt(t.onPointerUp,s.onThumbPointerUp)})});qN.displayName=$f;var ux="ScrollAreaCorner",FN=R.forwardRef((t,e)=>{const r=jr(ux,t.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&n?D.jsx(tK,{...t,ref:e}):null});FN.displayName=ux;var tK=R.forwardRef((t,e)=>{const{__scopeScrollArea:r,...n}=t,i=jr(ux,r),[o,s]=R.useState(0),[l,f]=R.useState(0),d=!!(o&&l);return Eo(i.scrollbarX,()=>{var m;const h=((m=i.scrollbarX)==null?void 0:m.offsetHeight)||0;i.onCornerHeightChange(h),f(h)}),Eo(i.scrollbarY,()=>{var m;const h=((m=i.scrollbarY)==null?void 0:m.offsetWidth)||0;i.onCornerWidthChange(h),s(h)}),d?D.jsx(Yr.div,{...n,ref:e,style:{width:o,height:l,position:"absolute",right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null});function Df(t){return t?parseInt(t,10):0}function UN(t,e){const r=t/e;return isNaN(r)?0:r}function gd(t){const e=UN(t.viewport,t.content),r=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,n=(t.scrollbar.size-r)*e;return Math.max(n,18)}function rK(t,e,r,n="ltr"){const i=gd(r),o=i/2,s=e||o,l=i-s,f=r.scrollbar.paddingStart+s,d=r.scrollbar.size-r.scrollbar.paddingEnd-l,h=r.content-r.viewport,m=n==="ltr"?[0,h]:[h*-1,0];return WN([f,d],m)(t)}function rC(t,e,r="ltr"){const n=gd(e),i=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,o=e.scrollbar.size-i,s=e.content-e.viewport,l=o-n,f=r==="ltr"?[0,s]:[s*-1,0],d=HG(t,f);return WN([0,s],[0,l])(d)}function WN(t,e){return r=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const n=(e[1]-e[0])/(t[1]-t[0]);return e[0]+n*(r-t[0])}}function VN(t,e){return t>0&&t{})=>{let r={left:t.scrollLeft,top:t.scrollTop},n=0;return function i(){const o={left:t.scrollLeft,top:t.scrollTop},s=r.left!==o.left,l=r.top!==o.top;(s||l)&&e(),r=o,n=window.requestAnimationFrame(i)}(),()=>window.cancelAnimationFrame(n)};function bd(t,e){const r=un(t),n=R.useRef(0);return R.useEffect(()=>()=>window.clearTimeout(n.current),[]),R.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,e)},[r,e])}function Eo(t,e){const r=un(e);Rf(()=>{let n=0;if(t){const i=new ResizeObserver(()=>{cancelAnimationFrame(n),n=window.requestAnimationFrame(r)});return i.observe(t),()=>{window.cancelAnimationFrame(n),i.unobserve(t)}}},[t,r])}var HN=RN,iK=DN,aK=FN;const xd=R.forwardRef(({className:t,children:e,...r},n)=>D.jsxs(HN,{ref:n,className:yr("relative overflow-hidden",t),...r,children:[D.jsx(iK,{className:"h-full w-full rounded-[inherit]",children:e}),D.jsx(GN,{}),D.jsx(aK,{})]}));xd.displayName=HN.displayName;const GN=R.forwardRef(({className:t,orientation:e="vertical",...r},n)=>D.jsx(ax,{ref:n,orientation:e,className:yr("flex touch-none select-none transition-colors",e==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",e==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",t),...r,children:D.jsx(qN,{className:"relative flex-1 rounded-full bg-border"})}));GN.displayName=ax.displayName;function KN({cluster:t,allClusters:e,level:r,selectedClusterId:n,levelMap:i,onSelectCluster:o}){var m;const[s,l]=R.useState(!1),f=e.filter(v=>v.parent_id===t.id),d=((m=i.get(r))==null?void 0:m.reduce((v,g)=>v+g.count,0))||0,h=t.count/d*100;return D.jsxs("div",{className:"text-md text-left",children:[D.jsxs("div",{className:` + flex items-center gap-2 py-2 px-3 hover:bg-accent/50 rounded-md cursor-pointer + transition-colors duration-200 + ${n===t.id?"bg-accent text-accent-foreground":""} + `,style:{paddingLeft:`${r*16+12}px`},onClick:()=>o(t),children:[f.length>0?D.jsx(Ya,{variant:"ghost",size:"sm",className:"h-4 w-4 p-0 hover:bg-transparent",onClick:v=>{v.stopPropagation(),l(!s)},children:s?D.jsx(aC,{className:"h-3 w-3"}):D.jsx(CI,{className:"h-3 w-3"})}):D.jsx("div",{className:"w-4"}),D.jsx("span",{className:"flex-1 font-medium truncate",children:t.name}),D.jsxs("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:[h.toFixed(2),"% • ",t.count.toLocaleString(),f.length>0&&` • ${f.length}`]})]}),s&&f.map(v=>D.jsx(KN,{cluster:v,allClusters:e,level:r+1,selectedClusterId:n,levelMap:i,onSelectCluster:o},v.id))]})}function oK({clusters:t,selectedClusterId:e,onSelectCluster:r,levelMap:n}){const i=n.get(0)||[];return D.jsxs("div",{className:"h-full flex flex-col",children:[D.jsxs("div",{className:"flex items-center gap-2 p-4 border-b",children:[D.jsx(NI,{className:"h-5 w-5 text-primary"}),D.jsx("h2",{className:"font-semibold",children:"Cluster Hierarchy"})]}),D.jsx(xd,{className:"flex-1 p-2",children:D.jsx("div",{className:"space-y-0.5",children:i.map(o=>D.jsx(KN,{cluster:o,levelMap:n,allClusters:t,level:0,selectedClusterId:e,onSelectCluster:r},o.id))})})]})}const ZN=R.forwardRef(({className:t,...e},r)=>D.jsx("div",{ref:r,className:yr("rounded-xl border bg-card text-card-foreground shadow",t),...e}));ZN.displayName="Card";const XN=R.forwardRef(({className:t,...e},r)=>D.jsx("div",{ref:r,className:yr("flex flex-col space-y-1.5 p-6",t),...e}));XN.displayName="CardHeader";const YN=R.forwardRef(({className:t,...e},r)=>D.jsx("div",{ref:r,className:yr("font-semibold leading-none tracking-tight",t),...e}));YN.displayName="CardTitle";const uK=R.forwardRef(({className:t,...e},r)=>D.jsx("div",{ref:r,className:yr("text-sm text-muted-foreground",t),...e}));uK.displayName="CardDescription";const QN=R.forwardRef(({className:t,...e},r)=>D.jsx("div",{ref:r,className:yr("p-6 pt-0",t),...e}));QN.displayName="CardContent";const sK=R.forwardRef(({className:t,...e},r)=>D.jsx("div",{ref:r,className:yr("flex items-center p-6 pt-0",t),...e}));sK.displayName="CardFooter";const lK=sC("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function yg({className:t,variant:e,...r}){return D.jsx("div",{className:yr(lK({variant:e}),t),...r})}function cK({cluster:t}){return t?D.jsxs("div",{className:"h-full flex flex-col bg-background",children:[D.jsxs("div",{className:"flex items-center gap-3 p-4 border-b bg-card",children:[D.jsx(MI,{className:"h-5 w-5 text-primary"}),D.jsx("h2",{className:"text-lg font-semibold",children:"Cluster Details"})]}),D.jsx(xd,{className:"flex-1 px-6 py-4",children:D.jsxs(ZN,{className:"border-0 shadow-none",children:[D.jsx(XN,{className:"px-0 space-y-6",children:D.jsxs("div",{className:"space-y-3",children:[D.jsx(YN,{className:"text-2xl font-bold text-left",children:t.name}),D.jsxs("div",{className:"flex flex-wrap gap-2",children:[D.jsxs(yg,{variant:"secondary",className:"px-3 py-1 rounded-lg text-sm",children:[t.count.toLocaleString()," conversations"]}),D.jsxs(yg,{variant:"outline",className:"px-3 py-1 rounded-lg text-sm font-mono",children:["ID: ",t.id]})]})]})}),D.jsxs(QN,{className:"px-0 space-y-8",children:[D.jsxs("div",{className:"space-y-3 text-left",children:[D.jsx("h3",{className:"text-base font-semibold",children:"Description"}),D.jsx("p",{className:"text-muted-foreground leading-relaxed",children:t.description})]}),D.jsxs("div",{className:"space-y-3",children:[D.jsx("h3",{className:"text-base font-semibold",children:"Chat IDs"}),D.jsxs("div",{className:"text-sm text-muted-foreground bg-muted/40 rounded-lg p-4 font-mono break-all",children:[t.chat_ids.slice(0,5).join(`, +`),t.chat_ids.length>5&&"..."]})]}),t.parent_id&&D.jsxs("div",{className:"space-y-3",children:[D.jsx("h3",{className:"text-base font-semibold",children:"Parent Cluster"}),D.jsx(yg,{variant:"outline",className:"px-3 py-1 rounded-lg text-sm font-mono",children:t.parent_id})]})]})]})})]}):D.jsx("div",{className:"h-full flex items-center justify-center text-muted-foreground",children:D.jsxs("div",{className:"text-center",children:[D.jsx(jI,{className:"h-12 w-12 mx-auto mb-4 opacity-20"}),D.jsx("p",{className:"text-lg",children:"Select a cluster to view details"})]})})}function fK(t){const e=t+"CollectionProvider",[r,n]=yd(e),[i,o]=r(e,{collectionRef:{current:null},itemMap:new Map}),s=g=>{const{scope:_,children:w}=g,x=L.useRef(null),O=L.useRef(new Map).current;return D.jsx(i,{scope:_,itemMap:O,collectionRef:x,children:w})};s.displayName=e;const l=t+"CollectionSlot",f=L.forwardRef((g,_)=>{const{scope:w,children:x}=g,O=o(l,w),P=mn(_,O.collectionRef);return D.jsx(Xu,{ref:P,children:x})});f.displayName=l;const d=t+"CollectionItemSlot",h="data-radix-collection-item",m=L.forwardRef((g,_)=>{const{scope:w,children:x,...O}=g,P=L.useRef(null),A=mn(_,P),C=o(d,w);return L.useEffect(()=>(C.itemMap.set(P,{ref:P,...O}),()=>void C.itemMap.delete(P))),D.jsx(Xu,{[h]:"",ref:A,children:x})});m.displayName=d;function v(g){const _=o(t+"CollectionConsumer",g);return L.useCallback(()=>{const x=_.collectionRef.current;if(!x)return[];const O=Array.from(x.querySelectorAll(`[${h}]`));return Array.from(_.itemMap.values()).sort((C,S)=>O.indexOf(C.ref.current)-O.indexOf(S.ref.current))},[_.collectionRef,_.itemMap])}return[{Provider:s,Slot:f,ItemSlot:m},v,n]}var dK=xI.useId||(()=>{}),pK=0;function JN(t){const[e,r]=R.useState(dK());return Rf(()=>{t||r(n=>n??String(pK++))},[t]),t||(e?`radix-${e}`:"")}function eM({prop:t,defaultProp:e,onChange:r=()=>{}}){const[n,i]=hK({defaultProp:e,onChange:r}),o=t!==void 0,s=o?t:n,l=un(r),f=R.useCallback(d=>{if(o){const m=typeof d=="function"?d(t):d;m!==t&&l(m)}else i(d)},[o,t,i,l]);return[s,f]}function hK({defaultProp:t,onChange:e}){const r=R.useState(t),[n]=r,i=R.useRef(n),o=un(e);return R.useEffect(()=>{i.current!==n&&(o(n),i.current=n)},[n,i,o]),r}var gg="rovingFocusGroup.onEntryFocus",mK={bubbles:!1,cancelable:!0},wd="RovingFocusGroup",[Vb,tM,vK]=fK(wd),[yK,rM]=yd(wd,[vK]),[gK,bK]=yK(wd),nM=R.forwardRef((t,e)=>D.jsx(Vb.Provider,{scope:t.__scopeRovingFocusGroup,children:D.jsx(Vb.Slot,{scope:t.__scopeRovingFocusGroup,children:D.jsx(xK,{...t,ref:e})})}));nM.displayName=wd;var xK=R.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:r,orientation:n,loop:i=!1,dir:o,currentTabStopId:s,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:f,onEntryFocus:d,preventScrollOnEntryFocus:h=!1,...m}=t,v=R.useRef(null),g=mn(e,v),_=nx(o),[w=null,x]=eM({prop:s,defaultProp:l,onChange:f}),[O,P]=R.useState(!1),A=un(d),C=tM(r),S=R.useRef(!1),[E,k]=R.useState(0);return R.useEffect(()=>{const N=v.current;if(N)return N.addEventListener(gg,A),()=>N.removeEventListener(gg,A)},[A]),D.jsx(gK,{scope:r,orientation:n,dir:_,loop:i,currentTabStopId:w,onItemFocus:R.useCallback(N=>x(N),[x]),onItemShiftTab:R.useCallback(()=>P(!0),[]),onFocusableItemAdd:R.useCallback(()=>k(N=>N+1),[]),onFocusableItemRemove:R.useCallback(()=>k(N=>N-1),[]),children:D.jsx(Yr.div,{tabIndex:O||E===0?-1:0,"data-orientation":n,...m,ref:g,style:{outline:"none",...t.style},onMouseDown:Wt(t.onMouseDown,()=>{S.current=!0}),onFocus:Wt(t.onFocus,N=>{const I=!S.current;if(N.target===N.currentTarget&&I&&!O){const U=new CustomEvent(gg,mK);if(N.currentTarget.dispatchEvent(U),!U.defaultPrevented){const $=C().filter(Y=>Y.focusable),B=$.find(Y=>Y.active),V=$.find(Y=>Y.id===w),Z=[B,V,...$].filter(Boolean).map(Y=>Y.ref.current);oM(Z,h)}}S.current=!1}),onBlur:Wt(t.onBlur,()=>P(!1))})})}),iM="RovingFocusGroupItem",aM=R.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:r,focusable:n=!0,active:i=!1,tabStopId:o,...s}=t,l=JN(),f=o||l,d=bK(iM,r),h=d.currentTabStopId===f,m=tM(r),{onFocusableItemAdd:v,onFocusableItemRemove:g}=d;return R.useEffect(()=>{if(n)return v(),()=>g()},[n,v,g]),D.jsx(Vb.ItemSlot,{scope:r,id:f,focusable:n,active:i,children:D.jsx(Yr.span,{tabIndex:h?0:-1,"data-orientation":d.orientation,...s,ref:e,onMouseDown:Wt(t.onMouseDown,_=>{n?d.onItemFocus(f):_.preventDefault()}),onFocus:Wt(t.onFocus,()=>d.onItemFocus(f)),onKeyDown:Wt(t.onKeyDown,_=>{if(_.key==="Tab"&&_.shiftKey){d.onItemShiftTab();return}if(_.target!==_.currentTarget)return;const w=SK(_,d.orientation,d.dir);if(w!==void 0){if(_.metaKey||_.ctrlKey||_.altKey||_.shiftKey)return;_.preventDefault();let O=m().filter(P=>P.focusable).map(P=>P.ref.current);if(w==="last")O.reverse();else if(w==="prev"||w==="next"){w==="prev"&&O.reverse();const P=O.indexOf(_.currentTarget);O=d.loop?OK(O,P+1):O.slice(P+1)}setTimeout(()=>oM(O))}})})})});aM.displayName=iM;var wK={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function _K(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function SK(t,e,r){const n=_K(t.key,r);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return wK[n]}function oM(t,e=!1){const r=document.activeElement;for(const n of t)if(n===r||(n.focus({preventScroll:e}),document.activeElement!==r))return}function OK(t,e){return t.map((r,n)=>t[(e+n)%t.length])}var PK=nM,AK=aM,sx="Tabs",[EK,DK]=yd(sx,[rM]),uM=rM(),[TK,lx]=EK(sx),sM=R.forwardRef((t,e)=>{const{__scopeTabs:r,value:n,onValueChange:i,defaultValue:o,orientation:s="horizontal",dir:l,activationMode:f="automatic",...d}=t,h=nx(l),[m,v]=eM({prop:n,onChange:i,defaultProp:o});return D.jsx(TK,{scope:r,baseId:JN(),value:m,onValueChange:v,orientation:s,dir:h,activationMode:f,children:D.jsx(Yr.div,{dir:h,"data-orientation":s,...d,ref:e})})});sM.displayName=sx;var lM="TabsList",cM=R.forwardRef((t,e)=>{const{__scopeTabs:r,loop:n=!0,...i}=t,o=lx(lM,r),s=uM(r);return D.jsx(PK,{asChild:!0,...s,orientation:o.orientation,dir:o.dir,loop:n,children:D.jsx(Yr.div,{role:"tablist","aria-orientation":o.orientation,...i,ref:e})})});cM.displayName=lM;var fM="TabsTrigger",dM=R.forwardRef((t,e)=>{const{__scopeTabs:r,value:n,disabled:i=!1,...o}=t,s=lx(fM,r),l=uM(r),f=mM(s.baseId,n),d=vM(s.baseId,n),h=n===s.value;return D.jsx(AK,{asChild:!0,...l,focusable:!i,active:h,children:D.jsx(Yr.button,{type:"button",role:"tab","aria-selected":h,"aria-controls":d,"data-state":h?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:f,...o,ref:e,onMouseDown:Wt(t.onMouseDown,m=>{!i&&m.button===0&&m.ctrlKey===!1?s.onValueChange(n):m.preventDefault()}),onKeyDown:Wt(t.onKeyDown,m=>{[" ","Enter"].includes(m.key)&&s.onValueChange(n)}),onFocus:Wt(t.onFocus,()=>{const m=s.activationMode!=="manual";!h&&!i&&m&&s.onValueChange(n)})})})});dM.displayName=fM;var pM="TabsContent",hM=R.forwardRef((t,e)=>{const{__scopeTabs:r,value:n,forceMount:i,children:o,...s}=t,l=lx(pM,r),f=mM(l.baseId,n),d=vM(l.baseId,n),h=n===l.value,m=R.useRef(h);return R.useEffect(()=>{const v=requestAnimationFrame(()=>m.current=!1);return()=>cancelAnimationFrame(v)},[]),D.jsx(Lo,{present:i||h,children:({present:v})=>D.jsx(Yr.div,{"data-state":h?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":f,hidden:!v,id:d,tabIndex:0,...s,ref:e,style:{...t.style,animationDuration:m.current?"0s":void 0},children:v&&o})})});hM.displayName=pM;function mM(t,e){return`${t}-trigger-${e}`}function vM(t,e){return`${t}-content-${e}`}var CK=sM,yM=cM,gM=dM,bM=hM;const kK=CK,xM=R.forwardRef(({className:t,...e},r)=>D.jsx(yM,{ref:r,className:yr("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",t),...e}));xM.displayName=yM.displayName;const Hb=R.forwardRef(({className:t,...e},r)=>D.jsx(gM,{ref:r,className:yr("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",t),...e}));Hb.displayName=gM.displayName;const Gb=R.forwardRef(({className:t,...e},r)=>D.jsx(bM,{ref:r,className:yr("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...e}));Gb.displayName=bM.displayName;const jK=({cluster:t,isHovered:e})=>D.jsxs("div",{id:t.id,className:`p-3 border-b hover:bg-accent/50 cursor-pointer ${e?"bg-accent":""}`,children:[D.jsx("div",{className:"font-medium",children:t.name}),D.jsxs("div",{className:"text-sm text-muted-foreground mt-1",children:[t.count.toLocaleString()," conversations"]}),D.jsxs("div",{className:"text-xs font-mono text-muted-foreground mt-1",children:["ID: ",t.id]}),D.jsx("div",{className:"text-xs mt-4 font-mono text-muted-foreground mt-1",children:t.description})]}),NK=({levelMap:t})=>{const[e,r]=R.useState(0),[n,i]=R.useState(null),o=R.useRef(null),s=t.get(e)||[],l=t.size-1,f=s.map(d=>({label:d.name,x:d.x_coord,y:d.y_coord,id:d.id}));return R.useEffect(()=>{var d;if(n){const h=document.querySelector(`div[id="${n}"]`),m=(d=o.current)==null?void 0:d.querySelector("[data-radix-scroll-area-viewport]");if(h&&m){const v=h.getBoundingClientRect(),g=m.getBoundingClientRect();(v.topg.bottom)&&m.scrollTo({top:h.offsetTop-m.clientHeight/2+h.clientHeight/2,behavior:"smooth"})}}},[n]),D.jsxs("div",{className:"flex h-full",children:[D.jsx("div",{className:"w-3/5 flex flex-col",children:D.jsx(lB,{width:"100%",height:600,children:D.jsxs(LG,{margin:{top:20,right:20,bottom:20,left:20},width:500,height:600,children:[D.jsx(ln,{type:"number",dataKey:"x"}),D.jsx(cn,{type:"number",dataKey:"y"}),D.jsx(on,{cursor:{strokeDasharray:"3 3"},content:({payload:d})=>d&&d[0]?D.jsx("div",{className:"bg-white p-2 border rounded shadow",children:d[0].payload.label}):null}),D.jsx(rl,{name:"Current nodes",data:f,fill:"#8884d8",cursor:"pointer",label:({label:d})=>d,onMouseEnter:d=>{d&&d.id&&i(d.id)},onMouseLeave:()=>i(null)})]})})}),D.jsxs("div",{className:"w-2/5 border-l",children:[D.jsxs("div",{className:"flex items-center justify-between p-4 border-b",children:[D.jsxs("h3",{className:"font-semibold",children:["All Clusters - Level ",e," (",s.length,")"]}),D.jsxs("div",{className:"flex gap-2",children:[D.jsx(Ya,{variant:"outline",size:"sm",onClick:()=>r(e-1),disabled:e===0,children:D.jsx(kI,{className:"h-4 w-4"})}),D.jsx(Ya,{variant:"outline",size:"sm",onClick:()=>r(e+1),disabled:e===l,children:D.jsx(aC,{className:"h-4 w-4"})})]})]}),D.jsx(xd,{ref:o,className:"h-[calc(100%-4rem)]",children:D.jsx("div",{className:"p-4",children:s.map(d=>D.jsx(jK,{cluster:d,isHovered:n===d.id},d.id))})})]})]})},MK=t=>{const e=new Map;let r=0,n=t.filter(i=>i.parent_id===null);for(;n.length>0;){e.set(r,n);const i=n.map(o=>o.id);n=t.filter(o=>i.includes(o.parent_id??"")),r++}return e},IK=({clusters:t})=>{const[e,r]=R.useState(null),n=t.find(s=>s.id===e),i=s=>{r(s.id)},o=MK(t);return D.jsxs("div",{className:"w-full flex flex-col items-center",children:[D.jsxs("div",{className:"space-y-1 mb-8 mx-auto text-center",children:[D.jsx("h2",{className:"text-lg font-medium",children:"Clusters"}),D.jsx("p",{className:"text-sm text-muted-foreground",children:"Visualise your clusters here"})]}),D.jsx("div",{className:"w-full px-2",style:{maxWidth:"1400px"},children:D.jsxs(kK,{defaultValue:"tree",className:"h-[600px] w-full",children:[D.jsxs(xM,{className:"mb-4",children:[D.jsx(Hb,{value:"tree",children:"Tree View"}),D.jsx(Hb,{value:"map",children:"Map View"})]}),D.jsx(Gb,{value:"tree",children:D.jsxs("div",{className:"flex items-start w-full gap-4",children:[D.jsx("div",{className:"w-2/5",children:D.jsx(cK,{cluster:n||null})}),D.jsx("div",{className:"w-3/5",children:D.jsx(oK,{clusters:t,selectedClusterId:e,onSelectCluster:i,levelMap:o})})]})}),D.jsx(Gb,{value:"map",children:D.jsx("div",{className:"h-[600px] w-full border rounded-md",children:D.jsx(NK,{clusters:t,levelMap:o})})})]})}),D.jsx("div",{className:"py-20"})]})};function RK(){const[t,e]=R.useState(null),r=n=>{e(n)};return D.jsxs(D.Fragment,{children:[D.jsx("div",{className:"max-w-7xl mx-auto mb-10",children:D.jsxs("div",{className:"space-y-8 p-8",children:[D.jsxs("div",{className:"space-y-2 text-center",children:[D.jsx("h1",{className:"text-2xl font-semibold",children:"Chat Analysis"}),D.jsx("p",{className:"text-sm text-muted-foreground",children:"Detailed metrics and insights about chat activity"})]}),D.jsx(T$,{onSuccess:r}),t&&D.jsx(zG,{data:t})]})}),t&&D.jsx(IK,{clusters:t.clusters})]})}PI.createRoot(document.getElementById("root")).render(D.jsx(R.StrictMode,{children:D.jsx(RK,{})})); diff --git a/kura/static/dist/index.html b/kura/static/dist/index.html new file mode 100644 index 0000000..0cbc7d9 --- /dev/null +++ b/kura/static/dist/index.html @@ -0,0 +1,14 @@ + + + + + + + Kura - Using Language Models for Conversation Clustering + + + + +
+ + diff --git a/kura/static/dist/vite.svg b/kura/static/dist/vite.svg new file mode 100644 index 0000000..e7b8dfb --- /dev/null +++ b/kura/static/dist/vite.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/kura/summarisation.py b/kura/summarisation.py new file mode 100644 index 0000000..7be65f7 --- /dev/null +++ b/kura/summarisation.py @@ -0,0 +1,116 @@ +from kura.base_classes import BaseSummaryModel +from kura.types import Conversation, ConversationSummary +from kura.types.summarisation import GeneratedSummary +from asyncio import Semaphore +from tqdm.asyncio import tqdm_asyncio +import google.generativeai as genai +import instructor +import os + + +class SummaryModel(BaseSummaryModel): + def __init__( + self, + max_concurrent_requests: int = 50, + checkpoint_dir: str = "checkpoints", + checkpoint_file: str = "summarisation_checkpoint.json", + ): + self.sem = Semaphore(max_concurrent_requests) + self.client = instructor.from_gemini( + genai.GenerativeModel( + model_name="gemini-1.5-flash-latest", + ), + use_async=True, + ) + self.checkpoint_dir = checkpoint_dir + self.checkpoint_file = checkpoint_file + + if not os.path.exists(self.checkpoint_dir): + print(f"Creating checkpoint directory {self.checkpoint_dir}") + os.makedirs(self.checkpoint_dir) + + def load_checkpoint(self): + print( + f"Loading Summary Checkpoint from {os.path.join(self.checkpoint_dir, self.checkpoint_file)}" + ) + with open(os.path.join(self.checkpoint_dir, self.checkpoint_file), "r") as f: + return [ConversationSummary.model_validate_json(line) for line in f] + + def save_checkpoint(self, summaries: list[ConversationSummary]): + with open(os.path.join(self.checkpoint_dir, self.checkpoint_file), "w") as f: + for summary in summaries: + f.write(summary.model_dump_json() + "\n") + + print( + f"Saved {len(summaries)} summaries to {os.path.join(self.checkpoint_dir, self.checkpoint_file)}" + ) + + async def summarise( + self, conversations: list[Conversation] + ) -> list[ConversationSummary]: + if os.path.exists(os.path.join(self.checkpoint_dir, self.checkpoint_file)): + return self.load_checkpoint() + + summaries = await tqdm_asyncio.gather( + *[ + self.summarise_conversation(conversation) + for conversation in conversations + ], + desc=f"Summarising {len(conversations)} conversations", + ) + + self.save_checkpoint(summaries) + return summaries + + async def apply_hooks( + self, conversation: ConversationSummary + ) -> ConversationSummary: + # TODO: Implement hooks here for extra metadata extraction + return await super().apply_hooks(conversation) + + async def summarise_conversation( + self, conversation: Conversation + ) -> ConversationSummary: + resp = await self.client.chat.completions.create( + messages=[ + { + "role": "system", + "content": """ + Generate a summary of the task that the user is asking the language model to do based off the following conversation. + + + The summary should be concise and short. It should be at most 1-2 sentences and at most 30 words. Here are some examples of summaries: + - The user’s overall request for the assistant is to help implementing a React component to display a paginated list of users from a database. + - The user’s overall request for the assistant is to debug a memory leak in their Python data processing pipeline. + - The user’s overall request for the assistant is to design and architect a REST API for a social media application. + + + Here is the conversation + + {% for message in messages %} + {{message.role}}: {{message.content}} + {% endfor %} + + + When answering, do not include any personally identifiable information (PII), like names, locations, phone numbers, email addressess, and so on. When answering, do not include any proper nouns. Make sure that you're clear, concise and that you get to the point in at most two sentences. + + For example: + + Remember that + - Summaries should be concise and short. They should each be at most 1-2 sentences and at most 30 words. + - Summaries should start with "The user's overall request for the assistant is to" + - Make sure to omit any personally identifiable information (PII), like names, locations, phone numbers, email addressess, company names and so on. + - Make sure to indicate specific details such as programming languages, frameworks, libraries and so on which are relevant to the task. + """, + } + ], + context={"messages": conversation.messages}, + response_model=GeneratedSummary, + ) + return ConversationSummary( + chat_id=conversation.chat_id, + summary=resp.summary, + metadata={ + "conversation_turns": len(conversation.messages), + }, + ) diff --git a/kura/summarise.py b/kura/summarise.py deleted file mode 100644 index 0fee4b6..0000000 --- a/kura/summarise.py +++ /dev/null @@ -1,113 +0,0 @@ -from asyncio import Semaphore -from tqdm.asyncio import tqdm_asyncio as asyncio -from .types import Conversation, ConversationSummary -from instructor import AsyncInstructor, from_gemini -import google.generativeai as genai -from pydantic import BaseModel, field_validator -import os - - -class GeneratedSummary(BaseModel): - task_description: str - user_request: str - - @field_validator("user_request") - def validate_user_request_length(cls, v): - if len(v.split()) > 30: - raise ValueError( - f"User request is {len(v.split())} words long. Please condense the user request by removing any unnecessary/less important details while retaining the core request." - ) - return v - - -class SummariseBase: - def __init__( - self, - client: AsyncInstructor = from_gemini( - genai.GenerativeModel("gemini-1.5-flash-latest"), use_async=True - ), - max_concurrent_summaries: int = 40, - checkpoint_dir: str = "checkpoints", - checkpoint_file_name: str = "summarized_conversations.json", - ): - self.sem = Semaphore(max_concurrent_summaries) - self.client = client - self.checkpoint_dir = checkpoint_dir - self.checkpoint_file_name = checkpoint_file_name - - def load_checkpoint(self) -> list[ConversationSummary]: - with open( - os.path.join(self.checkpoint_dir, self.checkpoint_file_name), "r" - ) as f: - return [ConversationSummary.model_validate_json(line) for line in f] - - def save_checkpoint(self, data: list[ConversationSummary]): - with open( - os.path.join(self.checkpoint_dir, self.checkpoint_file_name), "w" - ) as f: - for item in data: - f.write(item.model_dump_json() + "\n") - - async def summarise_conversations( - self, conversations: list[Conversation] - ) -> list[ConversationSummary]: - if os.path.exists(os.path.join(self.checkpoint_dir, self.checkpoint_file_name)): - return self.load_checkpoint() - - coros = [self._summarise(conversation) for conversation in conversations] - res = await asyncio.gather(*coros, desc="Summarising Conversations") - self.save_checkpoint(res) - return res - - async def _summarise(self, conversation: Conversation) -> ConversationSummary: - async with self.sem: - resp = await self.client.chat.completions.create( - messages=[ - { - "role": "system", - "content": """Generate a summary of the task that the user is asking and a description of the task that the assistant is trying to complete based off the following conversation. - - Here are some examples of user requests - - - The user’s overall request for the assistant is to help implementing a React component to display a paginated list of users from a database. - - The user’s overall request for the assistant is to debug a memory leak in their Python data processing pipeline. - - The user’s overall request for the assistant is to design and architect a REST API for a social media application. - - - Task descriptions should be concise and short. Here are some examples of task descriptions - - - The task is to help build a frontend component with React and implement database integration - The task is to debug performance issues and optimize memory usage in Python code - The task is to design and architect a RESTful API following best practices - - - Here is the conversation - {% for message in messages %} - - {{message.role}}: {{message.content}} - - {% endfor %} - - When answering, do not include any personally identifiable information (PII), like names, locations, phone numbers, email addressess, and so on. When answering, do not include any proper nouns. Output your answer to the question in English inside tags; be clear and concise and get to the point in at most two sentences (don't say "Based on the conversation..." and avoid mentioning Claude/the chatbot). For example: - - Remember that - - User requests and task descriptions should be concise and short. They should each be at most 1-2 sentences and at most 30 words. - - User requests should start with "The user's overall request for the assistant is to" - - Task descriptions should start with "The task is to" - - Make sure to omit any personally identifiable information (PII), like names, locations, phone numbers, email addressess, company names and so on. - - Make sure to indicate specific details such as programming languages, frameworks, libraries and so on which are relevant to the task. Also mention the specific source of the data if it's relevant to the task. For instance, if the user is asking to perform a calculation, let's talk about the specific source of the data. - """, - } - ], - context={"messages": conversation.messages}, - response_model=GeneratedSummary, - ) - return ConversationSummary( - chat_id=conversation.chat_id, - task_description=resp.task_description, - user_request=resp.user_request, - metadata={ - "turns": len(conversation.messages), - }, - ) diff --git a/kura/summary_cluster.py b/kura/summary_cluster.py deleted file mode 100644 index ad67c63..0000000 --- a/kura/summary_cluster.py +++ /dev/null @@ -1,185 +0,0 @@ -from asyncio import Semaphore -from kura.types import ConversationSummary, GeneratedCluster, Cluster -from instructor import from_gemini -import google.generativeai as genai -from openai import AsyncOpenAI -from tqdm.asyncio import tqdm_asyncio as asyncio -import numpy as np -from sklearn.cluster import KMeans -import math -import os -import json - - -class SummaryCluster: - def __init__( - self, - cluster_model=from_gemini( - genai.GenerativeModel("gemini-1.5-flash-latest"), use_async=True - ), - embedding_model=AsyncOpenAI(), - max_concurrent_calls: int = 40, - summaries_per_cluster: int = 10, - checkpoint_dir: str = "checkpoints", - checkpoint_file_name: str = "base_clusters.json", - ): - self.sem = Semaphore(max_concurrent_calls) - self.cluster_model = cluster_model - self.embedding_model = embedding_model - self.summaries_per_cluster = summaries_per_cluster - self.checkpoint_dir = checkpoint_dir - self.checkpoint_file_name = checkpoint_file_name - - async def _embed(self, summary: ConversationSummary): - async with self.sem: - embedding = await self.embedding_model.embeddings.create( - input=summary.user_request, - model="text-embedding-3-small", - ) - return { - "item": summary, - "embedding": embedding.data[0].embedding, - } - - async def cluster_summaries( - self, summaries: list[ConversationSummary] - ) -> dict[int, list[ConversationSummary]]: - n_clusters = math.ceil(len(summaries) / self.summaries_per_cluster) - embeddings = [summary["embedding"] for summary in summaries] - X = np.array(embeddings) - - kmeans = KMeans(n_clusters=n_clusters) - cluster_labels = kmeans.fit_predict(X) - - group_to_clusters = {} - for i, summary in enumerate(summaries): - cluster_id = int(cluster_labels[i]) - if cluster_id not in group_to_clusters: - group_to_clusters[cluster_id] = [] - group_to_clusters[cluster_id].append(summary["item"]) - - return group_to_clusters - - def get_contrastive_examples( - self, - cluster_id: int, - cluster_id_to_summaries: dict[int, list[ConversationSummary]], - desired_count: int = 10, - ): - other_clusters = [c for c in cluster_id_to_summaries.keys() if c != cluster_id] - all_examples = [] - for cluster in other_clusters: - all_examples.extend(cluster_id_to_summaries[cluster]) - - # If we don't have enough examples, return all of them - if len(all_examples) <= desired_count: - return all_examples - - # Otherwise sample without replacement - return list(np.random.choice(all_examples, size=desired_count, replace=False)) - - async def generate_base_cluster( - self, - cluster_id: int, - cluster_id_to_summaries: dict[int, list[ConversationSummary]], - ): - async with self.sem: - contrastive_examples = self.get_contrastive_examples( - cluster_id, cluster_id_to_summaries - ) - positive_examples = cluster_id_to_summaries[cluster_id] - cluster = await self.cluster_model.chat.completions.create( - messages=[ - { - "role": "system", - "content": """ - You are tasked with summarizing a group of related statements into a short, precise, and accurate description and name. Your goal is to create a concise summary that captures the essence of these statements and distinguishes them from other similar groups of statements. - - Summarize all the statements into a clear, precise, two-sentence description in the past tense. Your summary should be specific to this group and distinguish it from the contrastive answers of the other groups. - - After creating the summary, generate a short name for the group of statements. This name should be at most ten words long (perhaps less) and be specific but also reflective of most of the statements (rather than reflecting only one or two). The name should distinguish this group from the contrastive examples. For instance, "Write fantasy sexual roleplay with octopi and monsters", "Generate blog spam for gambling websites", or "Assist with high school math homework" would be better and more actionable than general terms like "Write erotic content" or "Help with homework". Be as descriptive as possible and assume neither good nor bad faith. Do not hesitate to identify and describe socially harmful or sensitive topics specifically; specificity is necessary for monitoring - - The cluster name should be a sentence in the imperative that captures the user’s request. For example, ‘Brainstorm ideas for a birthday party’ or ‘Help me find a new job.” - """, - }, - { - "role": "user", - "content": """ - Here are the relevant statements - - Below are the related statements: - - {% for item in positive_examples %} - {{ item.user_request }} - {% endfor %} - - - For context, here are statements from nearby groups that are NOT part of the group you’re summarizing - - - {% for item in contrastive_examples %} - {{ item.user_request }} - {% endfor %} - - - Remember to analyze both the statements and the contrastive statements carefully to ensure your summary and name accurately represent the specific group while distinguishing it from others. - """, - }, - ], - response_model=GeneratedCluster, - context={ - "positive_examples": positive_examples, - "contrastive_examples": contrastive_examples, - }, - ) - - return Cluster( - name=cluster.name, - description=cluster.summary, - chat_ids=[item.chat_id for item in positive_examples], - parent_id=None, - ) - - async def embed_summaries(self, summaries: list[ConversationSummary]): - coros = [self._embed(summary) for summary in summaries] - return await asyncio.gather(*coros, desc="Embedding Summaries") - - def save_checkpoint(self, data: list[ConversationSummary]): - with open( - os.path.join(self.checkpoint_dir, self.checkpoint_file_name), "w" - ) as f: - for item in data: - f.write(item.model_dump_json() + "\n") - - def load_checkpoint(self) -> list[ConversationSummary]: - with open( - os.path.join(self.checkpoint_dir, self.checkpoint_file_name), "r" - ) as f: - return [Cluster(**json.loads(line)) for line in f] - - def save_checkpoint_clusters(self, clusters: list[Cluster]): - with open( - os.path.join(self.checkpoint_dir, self.checkpoint_file_name), "w" - ) as f: - for cluster in clusters: - f.write(cluster.model_dump_json() + "\n") - - async def cluster_conversation_summaries( - self, summaries: list[ConversationSummary] - ) -> list[Cluster]: - # Load Checkpoint By Default - if os.path.exists(os.path.join(self.checkpoint_dir, self.checkpoint_file_name)): - print("Loading Base Cluster Checkpoint") - return self.load_checkpoint() - - embedded_summaries = await self.embed_summaries(summaries) - cluster_id_to_summaries = await self.cluster_summaries(embedded_summaries) - clusters = await asyncio.gather( - *[ - self.generate_base_cluster(cluster_id, cluster_id_to_summaries) - for cluster_id in cluster_id_to_summaries.keys() - ], - desc="Generating Base Clusters", - ) - self.save_checkpoint(clusters) - return clusters diff --git a/kura/types/__init__.py b/kura/types/__init__.py new file mode 100644 index 0000000..27ad4ba --- /dev/null +++ b/kura/types/__init__.py @@ -0,0 +1,14 @@ +from .conversation import Conversation, Message +from .summarisation import ConversationSummary, GeneratedSummary +from .cluster import Cluster, GeneratedCluster +from .dimensionality import ProjectedCluster + +__all__ = [ + "Cluster", + "Conversation", + "Message", + "ConversationSummary", + "GeneratedSummary", + "GeneratedCluster", + "ProjectedCluster", +] diff --git a/kura/types.py b/kura/types/cluster.py similarity index 51% rename from kura/types.py rename to kura/types/cluster.py index 7b6a06e..ea38a15 100644 --- a/kura/types.py +++ b/kura/types/cluster.py @@ -1,28 +1,8 @@ from pydantic import BaseModel, Field, computed_field -from datetime import datetime import uuid from typing import Union -class Message(BaseModel): - created_at: datetime - role: str - content: str - - -class Conversation(BaseModel): - chat_id: str - created_at: datetime - messages: list[Message] - - -class ConversationSummary(BaseModel): - chat_id: str - task_description: str - user_request: str - metadata: dict - - class Cluster(BaseModel): id: str = Field( default_factory=lambda: uuid.uuid4().hex, @@ -40,7 +20,3 @@ def count(self) -> int: class GeneratedCluster(BaseModel): name: str summary: str - - -class CachedCluster(Cluster): - umap_embedding: list[float] diff --git a/kura/types/conversation.py b/kura/types/conversation.py new file mode 100644 index 0000000..6b2e03f --- /dev/null +++ b/kura/types/conversation.py @@ -0,0 +1,13 @@ +from pydantic import BaseModel +from datetime import datetime + +class Message(BaseModel): + created_at: datetime + role: str + content: str + + +class Conversation(BaseModel): + chat_id: str + created_at: datetime + messages: list[Message] \ No newline at end of file diff --git a/kura/types/dimensionality.py b/kura/types/dimensionality.py new file mode 100644 index 0000000..e0a93e4 --- /dev/null +++ b/kura/types/dimensionality.py @@ -0,0 +1,7 @@ +from .cluster import Cluster + + +class ProjectedCluster(Cluster): + x_coord: float + y_coord: float + level: int diff --git a/kura/types/summarisation.py b/kura/types/summarisation.py new file mode 100644 index 0000000..873e1b4 --- /dev/null +++ b/kura/types/summarisation.py @@ -0,0 +1,11 @@ +from pydantic import BaseModel + + +class ConversationSummary(BaseModel): + chat_id: str + summary: str + metadata: dict + + +class GeneratedSummary(BaseModel): + summary: str diff --git a/pyproject.toml b/pyproject.toml index 315f6fa..a6d16b2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "kura" -version = "0.2.0" +version = "0.4.0" description = "Kura is a tool for analysing and visualising chat data" readme = "README.md" authors = [ @@ -15,6 +15,8 @@ dependencies = [ "uvicorn>=0.34.0", "fastapi[standard]>=0.115.6", "umap-learn>=0.5.7", + "hdbscan>=0.8.40", + "eval-type-backport>=0.2.2", ] diff --git a/ui/bun.lockb b/ui/bun.lockb index 149b1bd..d3e592e 100755 Binary files a/ui/bun.lockb and b/ui/bun.lockb differ diff --git a/ui/package.json b/ui/package.json index 73a64ea..5398c6a 100644 --- a/ui/package.json +++ b/ui/package.json @@ -13,6 +13,7 @@ "@radix-ui/react-scroll-area": "^1.2.2", "@radix-ui/react-separator": "^1.1.1", "@radix-ui/react-slot": "^1.1.1", + "@radix-ui/react-tabs": "^1.1.2", "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", "lucide-react": "^0.469.0", diff --git a/ui/src/App.css b/ui/src/App.css deleted file mode 100644 index b9d355d..0000000 --- a/ui/src/App.css +++ /dev/null @@ -1,42 +0,0 @@ -#root { - max-width: 1280px; - margin: 0 auto; - padding: 2rem; - text-align: center; -} - -.logo { - height: 6em; - padding: 1.5em; - will-change: filter; - transition: filter 300ms; -} -.logo:hover { - filter: drop-shadow(0 0 2em #646cffaa); -} -.logo.react:hover { - filter: drop-shadow(0 0 2em #61dafbaa); -} - -@keyframes logo-spin { - from { - transform: rotate(0deg); - } - to { - transform: rotate(360deg); - } -} - -@media (prefers-reduced-motion: no-preference) { - a:nth-of-type(2) .logo { - animation: logo-spin infinite 20s linear; - } -} - -.card { - padding: 2em; -} - -.read-the-docs { - color: #888; -} diff --git a/ui/src/App.tsx b/ui/src/App.tsx index 4424ba4..4cb2597 100644 --- a/ui/src/App.tsx +++ b/ui/src/App.tsx @@ -1,5 +1,4 @@ import { useState } from "react"; -import "./App.css"; import { UploadButton } from "./components/upload-button"; import type { Analytics } from "./types/analytics"; import { AnalyticsCharts } from "./components/analytics-charts"; @@ -14,18 +13,20 @@ function App() { return ( <> -
-
-

Chat Analysis

-

- Detailed metrics and insights about chat activity -

+
+
+
+

Chat Analysis

+

+ Detailed metrics and insights about chat activity +

+
+ + {data && }
- - {data && }
+ {data && } - {/* {data && } */} ); } diff --git a/ui/src/components/cluster-details.tsx b/ui/src/components/cluster-details.tsx index e32ed4f..b641a96 100644 --- a/ui/src/components/cluster-details.tsx +++ b/ui/src/components/cluster-details.tsx @@ -1,6 +1,5 @@ import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; import { ScrollArea } from "@/components/ui/scroll-area"; -import { Separator } from "@/components/ui/separator"; import { Badge } from "@/components/ui/badge"; import { FolderOpen, MessageCircle } from "lucide-react"; import { Cluster } from "@/types/analytics"; @@ -50,7 +49,6 @@ export default function ClusterDetail({ cluster }: ClusterDetailProps) {
- diff --git a/ui/src/components/cluster-tree.tsx b/ui/src/components/cluster-tree.tsx index 92b823c..32b7225 100644 --- a/ui/src/components/cluster-tree.tsx +++ b/ui/src/components/cluster-tree.tsx @@ -9,6 +9,7 @@ import { Cluster } from "@/types/analytics"; interface ClusterTreeProps { clusters: Cluster[]; selectedClusterId: string | null; + levelMap: Map; onSelectCluster: (cluster: Cluster) => void; } @@ -18,6 +19,7 @@ interface ClusterTreeItemProps { level: number; selectedClusterId: string | null; onSelectCluster: (cluster: Cluster) => void; + levelMap: Map; } function ClusterTreeItem({ @@ -25,12 +27,15 @@ function ClusterTreeItem({ allClusters, level, selectedClusterId, + levelMap, onSelectCluster, }: ClusterTreeItemProps) { const [isExpanded, setIsExpanded] = useState(false); const childClusters = allClusters.filter((c) => c.parent_id === cluster.id); - const hasChildren = childClusters.length > 0; - const percentage = ((cluster.count / 10000) * 100).toFixed(1); + + const total_count = + levelMap.get(level)?.reduce((acc, curr) => acc + curr.count, 0) || 0; + const percentage = (cluster.count / total_count) * 100; return (
@@ -47,7 +52,7 @@ function ClusterTreeItem({ style={{ paddingLeft: `${level * 16 + 12}px` }} onClick={() => onSelectCluster(cluster)} > - {hasChildren ? ( + {childClusters.length > 0 ? (
{isExpanded && @@ -80,6 +85,7 @@ function ClusterTreeItem({ allClusters={allClusters} level={level + 1} selectedClusterId={selectedClusterId} + levelMap={levelMap} onSelectCluster={onSelectCluster} /> ))} @@ -91,8 +97,9 @@ export function ClusterTree({ clusters, selectedClusterId, onSelectCluster, + levelMap, }: ClusterTreeProps) { - const rootClusters = clusters.filter((cluster) => cluster.parent_id === null); + const rootClusters = levelMap.get(0) || []; return (
@@ -106,6 +113,7 @@ export function ClusterTree({ { + const levelMap = new Map(); + let currentLevel = 0; + let currentLevelNodes = clusters.filter((item) => item.parent_id === null); + + while (currentLevelNodes.length > 0) { + levelMap.set(currentLevel, currentLevelNodes); + + const parentIds = currentLevelNodes.map((n) => n.id); + currentLevelNodes = clusters.filter((item) => + parentIds.includes(item.parent_id ?? "") + ); + currentLevel++; + } + + return levelMap; +}; const ClusterVisualisation = ({ clusters }: { clusters: Cluster[] }) => { const [selectedClusterId, setSelectedClusterId] = useState( null ); + const selectedCluster = clusters.find((c) => c.id === selectedClusterId); const updateSelectedCluster = (cluster: Cluster) => { setSelectedClusterId(cluster.id); }; + const levelMap = getClusterDepth(clusters); + return ( -
-
-

Clusters

+
+
+

Clusters

Visualise your clusters here

- - - - - - - - - +
+ + + Tree View + Map View + + +
+
+ +
+
+ +
+
+
+ +
+ +
+
+
+
+ +
); }; diff --git a/ui/src/components/ui/tabs.tsx b/ui/src/components/ui/tabs.tsx new file mode 100644 index 0000000..85d83be --- /dev/null +++ b/ui/src/components/ui/tabs.tsx @@ -0,0 +1,53 @@ +import * as React from "react" +import * as TabsPrimitive from "@radix-ui/react-tabs" + +import { cn } from "@/lib/utils" + +const Tabs = TabsPrimitive.Root + +const TabsList = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +TabsList.displayName = TabsPrimitive.List.displayName + +const TabsTrigger = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +TabsTrigger.displayName = TabsPrimitive.Trigger.displayName + +const TabsContent = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +TabsContent.displayName = TabsPrimitive.Content.displayName + +export { Tabs, TabsList, TabsTrigger, TabsContent } diff --git a/ui/src/components/umap_visualisation.tsx b/ui/src/components/umap_visualisation.tsx new file mode 100644 index 0000000..72c2cbb --- /dev/null +++ b/ui/src/components/umap_visualisation.tsx @@ -0,0 +1,175 @@ +import { useState, useRef, useEffect } from "react"; +import { + ScatterChart, + Scatter, + ResponsiveContainer, + XAxis, + YAxis, + Tooltip, +} from "recharts"; +import { ScrollArea } from "@/components/ui/scroll-area"; +import { Cluster } from "@/types/analytics"; +import { Button } from "./ui/button"; +import { ChevronDown, ChevronUp } from "lucide-react"; + +type Props = { + clusters: Cluster[]; + levelMap: Map; +}; + +const ClusterListItem = ({ + cluster, + isHovered, +}: { + cluster: Cluster; + isHovered: boolean; +}) => { + return ( +
+
{cluster.name}
+
+ {cluster.count.toLocaleString()} conversations +
+
+ ID: {cluster.id} +
+
+ {cluster.description} +
+
+ ); +}; + +const PointVisualisation = ({ levelMap }: Props) => { + const [currentLevel, setCurrentLevel] = useState(0); + const [hoveredNodeId, setHoveredNodeId] = useState(null); + const scrollAreaRef = useRef(null); + + const currentNodes = levelMap.get(currentLevel) || []; + const maxLevel = levelMap.size - 1; + const nodeCoordinates = currentNodes.map((item) => ({ + label: item.name, + x: item.x_coord, + y: item.y_coord, + id: item.id, + })); + + useEffect(() => { + if (hoveredNodeId) { + const element = document.querySelector(`div[id="${hoveredNodeId}"]`); + const viewport = scrollAreaRef.current?.querySelector( + "[data-radix-scroll-area-viewport]" + ); + + if (element && viewport) { + const elementRect = element.getBoundingClientRect(); + const viewportRect = viewport.getBoundingClientRect(); + + // Check if element is outside viewport + if ( + elementRect.top < viewportRect.top || + elementRect.bottom > viewportRect.bottom + ) { + viewport.scrollTo({ + top: + (element as HTMLElement).offsetTop - + viewport.clientHeight / 2 + + element.clientHeight / 2, + behavior: "smooth", + }); + } + } + } + }, [hoveredNodeId]); + + return ( +
+
+ + + + + { + if (payload && payload[0]) { + return ( +
+ {payload[0].payload.label} +
+ ); + } + return null; + }} + /> + label} + onMouseEnter={(data) => { + if (data && data.id) { + setHoveredNodeId(data.id); + } + }} + onMouseLeave={() => setHoveredNodeId(null)} + /> +
+
+
+
+
+

+ All Clusters - Level {currentLevel} ({currentNodes.length}) +

+
+ + +
+
+ +
+ {currentNodes.map((cluster) => ( + + ))} +
+
+
+
+ ); +}; + +export default PointVisualisation; diff --git a/ui/src/components/upload-button.tsx b/ui/src/components/upload-button.tsx index 8b2c4ff..0288e19 100644 --- a/ui/src/components/upload-button.tsx +++ b/ui/src/components/upload-button.tsx @@ -52,6 +52,7 @@ export function UploadButton({ onSuccess }: UploadButtonProps) { onSuccess(validatedData); } catch (error) { + console.error(error); alert("Error uploading file"); } finally { setIsLoading(false); @@ -75,7 +76,7 @@ export function UploadButton({ onSuccess }: UploadButtonProps) { disabled={isLoading} > - Select conversations.json + {selectedFile ? `${selectedFile.name}` : "Upload your conversations"}
@@ -86,7 +87,33 @@ export function UploadButton({ onSuccess }: UploadButtonProps) { disabled={isLoading || !selectedFile} onClick={handleSubmit} > - {isLoading ? "Uploading..." : "Submit File"} + {isLoading ? ( +
+ + + + + Processing... +
+ ) : ( + "Submit File" + )}
); diff --git a/ui/src/index.css b/ui/src/index.css index 83bebd5..7b71f99 100644 --- a/ui/src/index.css +++ b/ui/src/index.css @@ -3,7 +3,7 @@ @tailwind utilities; @layer base { :root { - --background: 0 0% 100%; + --foreground: 0 0% 3.9%; --card: 0 0% 100%; --card-foreground: 0 0% 3.9%; diff --git a/ui/src/lib/area-calculations.ts b/ui/src/lib/area-calculations.ts new file mode 100644 index 0000000..1448f65 --- /dev/null +++ b/ui/src/lib/area-calculations.ts @@ -0,0 +1,46 @@ +interface Point { + x: number; + y: number; +} + +export function calculateBoundingBox(points: Point[]) { + if (points.length === 0) return { minX: 0, minY: 0, maxX: 0, maxY: 0 }; + + return points.reduce( + (bounds, point) => ({ + minX: Math.min(bounds.minX, point.x), + minY: Math.min(bounds.minY, point.y), + maxX: Math.max(bounds.maxX, point.x), + maxY: Math.max(bounds.maxY, point.y), + }), + { + minX: points[0].x, + minY: points[0].y, + maxX: points[0].x, + maxY: points[0].y, + } + ); +} + +export function calculateClusterSize(children: Point[], paddingFactor = 1.5) { + if (children.length === 0) return { size: 140, width: 50, height: 50 }; + + const bounds = calculateBoundingBox(children); + const width = bounds.maxX - bounds.minX; + const height = bounds.maxY - bounds.minY; + + // Calculate diagonal length for better coverage + const diagonal = Math.sqrt(width * width + height * height); + + // Use diagonal as base size and apply padding factor + const baseSize = diagonal * paddingFactor; + + // Add padding proportional to the cluster size + const padding = baseSize * 0.2; // 20% of baseSize as padding + + return { + size: baseSize * 100, // Scale for visualization + width: (width + padding) * paddingFactor, + height: (height + padding) * paddingFactor, + }; +} diff --git a/ui/src/types/analytics.ts b/ui/src/types/analytics.ts index 7af55f8..bc93c85 100644 --- a/ui/src/types/analytics.ts +++ b/ui/src/types/analytics.ts @@ -12,6 +12,9 @@ export const Cluster = z.object({ chat_ids: z.array(z.string()), parent_id: z.string().nullable(), count: z.number(), + x_coord: z.number(), + y_coord: z.number(), + level: z.number(), }); export const analyticsSchema = z.object({ diff --git a/ui/tsconfig.app.tsbuildinfo b/ui/tsconfig.app.tsbuildinfo index 861a0cf..c3aa9ec 100644 --- a/ui/tsconfig.app.tsbuildinfo +++ b/ui/tsconfig.app.tsbuildinfo @@ -1 +1 @@ -{"root":["./src/app.tsx","./src/main.tsx","./src/vite-env.d.ts","./src/components/analytics-charts.tsx","./src/components/cluster-details.tsx","./src/components/cluster-tree.tsx","./src/components/cluster.tsx","./src/components/upload-button.tsx","./src/components/ui/badge.tsx","./src/components/ui/button.tsx","./src/components/ui/card.tsx","./src/components/ui/chart.tsx","./src/components/ui/resizable.tsx","./src/components/ui/scroll-area.tsx","./src/components/ui/separator.tsx","./src/lib/utils.ts","./src/types/analytics.ts"],"version":"5.6.3"} \ No newline at end of file +{"root":["./src/app.tsx","./src/main.tsx","./src/vite-env.d.ts","./src/components/analytics-charts.tsx","./src/components/cluster-details.tsx","./src/components/cluster-tree.tsx","./src/components/cluster.tsx","./src/components/umap_visualisation.tsx","./src/components/upload-button.tsx","./src/components/ui/badge.tsx","./src/components/ui/button.tsx","./src/components/ui/card.tsx","./src/components/ui/chart.tsx","./src/components/ui/resizable.tsx","./src/components/ui/scroll-area.tsx","./src/components/ui/separator.tsx","./src/components/ui/tabs.tsx","./src/lib/area-calculations.ts","./src/lib/utils.ts","./src/types/analytics.ts"],"version":"5.6.3"} \ No newline at end of file diff --git a/uv.lock b/uv.lock index 5a7d05e..88afeba 100644 --- a/uv.lock +++ b/uv.lock @@ -316,6 +316,15 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/d7/ee/bf0adb559ad3c786f12bcbc9296b3f5675f529199bef03e2df281fa1fadb/email_validator-2.2.0-py3-none-any.whl", hash = "sha256:561977c2d73ce3611850a06fa56b414621e0c8faa9d66f2611407d87465da631", size = 33521 }, ] +[[package]] +name = "eval-type-backport" +version = "0.2.2" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/30/ea/8b0ac4469d4c347c6a385ff09dc3c048c2d021696664e26c7ee6791631b5/eval_type_backport-0.2.2.tar.gz", hash = "sha256:f0576b4cf01ebb5bd358d02314d31846af5e07678387486e2c798af0e7d849c1", size = 9079 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/ce/31/55cd413eaccd39125368be33c46de24a1f639f2e12349b0361b4678f3915/eval_type_backport-0.2.2-py3-none-any.whl", hash = "sha256:cb6ad7c393517f476f96d456d0412ea80f0a8cf96f6892834cd9340149111b0a", size = 5830 }, +] + [[package]] name = "exceptiongroup" version = "1.2.2" @@ -638,6 +647,31 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/95/04/ff642e65ad6b90db43e668d70ffb6736436c7ce41fcc549f4e9472234127/h11-0.14.0-py3-none-any.whl", hash = "sha256:e3fe4ac4b851c468cc8363d500db52c2ead036020723024a109d37346efaa761", size = 58259 }, ] +[[package]] +name = "hdbscan" +version = "0.8.40" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "joblib" }, + { name = "numpy" }, + { name = "scikit-learn" }, + { name = "scipy" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/c1/84/6b010387b795f774e1ec695df3c8660c15abd041783647d5e7e4076bfc6b/hdbscan-0.8.40.tar.gz", hash = "sha256:c9e383ff17beee0591075ff65d524bda5b5a35dfb01d218245a7ba30c8d48a17", size = 6904096 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/2c/ce/489bb941c77e67f6bdc7b47f28318780fd478db655113a073cf7c89cd8f5/hdbscan-0.8.40-cp310-cp310-macosx_12_0_x86_64.whl", hash = "sha256:811a248e57353a4aa815019176879fd16bace55ed633583a6b47734edcb5397c", size = 813672 }, + { url = "https://files.pythonhosted.org/packages/8a/d9/11564d3ebfe7429fb2e54356b07b2e44ac3dca668c47401d98170809a2f6/hdbscan-0.8.40-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:cda06a6f4e65c6c34bed083bb8cdf29fdb1ffcb15580829d79b2906c7bdc6dbc", size = 4244270 }, + { url = "https://files.pythonhosted.org/packages/97/eb/fd2093176b439d6741e92996f6d1d7273ddb0819de59934bc64fe2b1c308/hdbscan-0.8.40-cp310-cp310-win_amd64.whl", hash = "sha256:9ba82e510508921e0b30a234b639f5d84a7d475746e7db814517c5c4d1589016", size = 730887 }, + { url = "https://files.pythonhosted.org/packages/26/6b/88b8c8023c0c0b27589ad83c82084a1b751917a3e09bdf7fcacf7e6bd523/hdbscan-0.8.40-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:5e958f0d7a33cd2b5e8e927b47f7360bf8a3e7d72355dd65a701e8aabe407b27", size = 1491349 }, + { url = "https://files.pythonhosted.org/packages/a3/ef/32c8a0b3dc6e6c4e433b85b30c3723d8eb48d115c0185b82ab89e1a0ef89/hdbscan-0.8.40-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6e0d6197ee045b173e1f16e6884386f335a56091e373a839dd24f7331a8fa9ed", size = 4576215 }, + { url = "https://files.pythonhosted.org/packages/64/b1/96c347c7740efa1ac803be64155159284f92fafcff88c1077344e64eead5/hdbscan-0.8.40-cp311-cp311-win_amd64.whl", hash = "sha256:127cbe8c858dc77adfde33a3e1ce4f3bea810f78b01d2bd47b1147d4b5a50472", size = 732173 }, + { url = "https://files.pythonhosted.org/packages/33/ff/4739886abb990dc6feb7b02eafb38a7eaf090fffef6336e70a03d693f433/hdbscan-0.8.40-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:353eaa22e42bee69df095744dbb8b29360e516bd9dcb84580dceeeb755f004cc", size = 1497291 }, + { url = "https://files.pythonhosted.org/packages/c0/cb/6b4254f8a33e075118512e55acf3485c155ea52c6c35d69a985bdc59297c/hdbscan-0.8.40-cp312-cp312-win_amd64.whl", hash = "sha256:1b55a935ed7b329adac52072e1c4028979dfc54312ca08de2deece9c97d6ebb1", size = 726198 }, + { url = "https://files.pythonhosted.org/packages/9a/af/acf0a9fd7ed549ced9186fb754a0a28fb17116618a78195ab20321f77052/hdbscan-0.8.40-cp39-cp39-macosx_12_0_x86_64.whl", hash = "sha256:cf094aeea4df4513644333b9dda408ef8ef385d0ab5f3f8681e239a9008cbeb5", size = 814923 }, + { url = "https://files.pythonhosted.org/packages/a9/f4/91149998cd0dbc32b5db911dd13ac490b1801b255830d68c474acaa0827e/hdbscan-0.8.40-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:05668ae7a17479a9061676290a66a810a62f2a4ec577ba18f561088b726ab01d", size = 4250145 }, + { url = "https://files.pythonhosted.org/packages/a0/32/96299e30b21476c5c3073b1be85a5d12a078d21cd5e1b97b37ecd8ae1b30/hdbscan-0.8.40-cp39-cp39-win_amd64.whl", hash = "sha256:56d3057d483d112ff8e0f0a49f0d59df8c078d444dbd5dea7b987faab0c6fb49", size = 811222 }, +] + [[package]] name = "httpcore" version = "1.0.7" @@ -861,10 +895,12 @@ wheels = [ [[package]] name = "kura" -version = "0.1.0" +version = "0.3.0" source = { editable = "." } dependencies = [ + { name = "eval-type-backport" }, { name = "fastapi", extra = ["standard"] }, + { name = "hdbscan" }, { name = "instructor", extra = ["google-generativeai"] }, { name = "pandas" }, { name = "rich" }, @@ -875,7 +911,9 @@ dependencies = [ [package.metadata] requires-dist = [ + { name = "eval-type-backport", specifier = ">=0.2.2" }, { name = "fastapi", extras = ["standard"], specifier = ">=0.115.6" }, + { name = "hdbscan", specifier = ">=0.8.40" }, { name = "instructor", extras = ["google-generativeai"], specifier = ">=1.7.2" }, { name = "pandas", specifier = ">=2.2.3" }, { name = "rich", specifier = ">=13.9.4" }, @@ -884,31 +922,10 @@ requires-dist = [ { name = "uvicorn", specifier = ">=0.34.0" }, ] -[[package]] -name = "llvmlite" -version = "0.36.0" -source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version == '3.11.*'", - "python_full_version == '3.12.*'", - "python_full_version >= '3.13'", -] -sdist = { url = "https://files.pythonhosted.org/packages/19/66/6b2c49c7c68da48d17059882fdb9ad9ac9e5ac3f22b00874d7996e3c44a8/llvmlite-0.36.0.tar.gz", hash = "sha256:765128fdf5f149ed0b889ffbe2b05eb1717f8e20a5c87fa2b4018fbcce0fcfc9", size = 126219 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/90/a9/ec0175e6c2d519fc450086ac60ffb1bdfad4a66e2bcc68f8275ec4bd89d4/llvmlite-0.36.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:6a3abc8a8889aeb06bf9c4a7e5df5bc7bb1aa0aedd91a599813809abeec80b5a", size = 18513222 }, - { url = "https://files.pythonhosted.org/packages/c2/8b/b9a9e00ff28f8428687f287135853babbf6b8af3d695f8888e58a0312422/llvmlite-0.36.0-cp39-cp39-manylinux2010_i686.whl", hash = "sha256:705f0323d931684428bb3451549603299bb5e17dd60fb979d67c3807de0debc1", size = 27443194 }, - { url = "https://files.pythonhosted.org/packages/21/e4/bd58362e7613bce9a570278352832289b2a9f1da48e8c22e1a2f883a2167/llvmlite-0.36.0-cp39-cp39-manylinux2010_x86_64.whl", hash = "sha256:5a6548b4899facb182145147185e9166c69826fb424895f227e6b7cf924a8da1", size = 25268821 }, - { url = "https://files.pythonhosted.org/packages/8b/f5/73b92c97c5c1806103598ad121a41d53a9e975f719ae7d58298fcf7e25f7/llvmlite-0.36.0-cp39-cp39-win32.whl", hash = "sha256:ff52fb9c2be66b95b0e67d56fce11038397e5be1ea410ee53f5f1175fdbb107a", size = 12986003 }, - { url = "https://files.pythonhosted.org/packages/b7/ab/cf1bc85ae2aa7ce35c3bdeb34084b805ac5d2c9e49c1ac4a6eff20bb91dc/llvmlite-0.36.0-cp39-cp39-win_amd64.whl", hash = "sha256:1dee416ea49fd338c74ec15c0c013e5273b0961528169af06ff90772614f7f6c", size = 15985217 }, -] - [[package]] name = "llvmlite" version = "0.43.0" source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version < '3.11'", -] sdist = { url = "https://files.pythonhosted.org/packages/9f/3d/f513755f285db51ab363a53e898b85562e950f79a2e6767a364530c2f645/llvmlite-0.43.0.tar.gz", hash = "sha256:ae2b5b5c3ef67354824fb75517c8db5fbe93bc02cd9671f3c62271626bc041d5", size = 157069 } wheels = [ { url = "https://files.pythonhosted.org/packages/23/ff/6ca7e98998b573b4bd6566f15c35e5c8bea829663a6df0c7aa55ab559da9/llvmlite-0.43.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:a289af9a1687c6cf463478f0fa8e8aa3b6fb813317b0d70bf1ed0759eab6f761", size = 31064408 }, @@ -1109,39 +1126,13 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/99/b7/b9e70fde2c0f0c9af4cc5277782a89b66d35948ea3369ec9f598358c3ac5/multidict-6.1.0-py3-none-any.whl", hash = "sha256:48e171e52d1c4d33888e529b999e5900356b9ae588c2f09a52dcefb158b27506", size = 10051 }, ] -[[package]] -name = "numba" -version = "0.53.1" -source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version == '3.11.*'", - "python_full_version == '3.12.*'", - "python_full_version >= '3.13'", -] -dependencies = [ - { name = "llvmlite", version = "0.36.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" }, - { name = "numpy", version = "2.2.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" }, - { name = "setuptools", marker = "python_full_version >= '3.11'" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/e3/7d/3d61160836e49f40913741c464f119551c15ed371c1d91ea50308495b93b/numba-0.53.1.tar.gz", hash = "sha256:9cd4e5216acdc66c4e9dab2dfd22ddb5bef151185c070d4a3cd8e78638aff5b0", size = 2213956 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/5f/c4/31d32d3e47a2a9f4c665b5158547b30f66e8b3f438fa8e6e695b47c70ad5/numba-0.53.1-cp39-cp39-macosx_10_14_x86_64.whl", hash = "sha256:224d197a46a9e602a16780d87636e199e2cdef528caef084a4d8fd8909c2455c", size = 2227187 }, - { url = "https://files.pythonhosted.org/packages/59/61/2d330282528a88a907278f5f6964e55b00461c688468966741720873e302/numba-0.53.1-cp39-cp39-manylinux2014_i686.whl", hash = "sha256:aba7acb247a09d7f12bd17a8e28bbb04e8adef9fc20ca29835d03b7894e1b49f", size = 3098584 }, - { url = "https://files.pythonhosted.org/packages/2e/74/dec288f1365c695ee4a271eef1bd5439693e9263431a367c5ecde045d7e5/numba-0.53.1-cp39-cp39-manylinux2014_x86_64.whl", hash = "sha256:bd126f1f49da6fc4b3169cf1d96f1c3b3f84a7badd11fe22da344b923a00e744", size = 3374647 }, - { url = "https://files.pythonhosted.org/packages/14/fe/ee29b1a645649105f32657eba0ab7cc9837abf7131f6ed1f3463ff6f97d4/numba-0.53.1-cp39-cp39-win32.whl", hash = "sha256:0ef9d1f347b251282ae46e5a5033600aa2d0dfa1ee8c16cb8137b8cd6f79e221", size = 2276146 }, - { url = "https://files.pythonhosted.org/packages/f5/0c/cab8c134f8814a0345cac9a1bd2ec0eec5ee4c1ea198ce536c69df8b9671/numba-0.53.1-cp39-cp39-win_amd64.whl", hash = "sha256:17146885cbe4e89c9d4abd4fcb8886dee06d4591943dc4343500c36ce2fcfa69", size = 2295290 }, -] - [[package]] name = "numba" version = "0.60.0" source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version < '3.11'", -] dependencies = [ - { name = "llvmlite", version = "0.43.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" }, - { name = "numpy", version = "2.0.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" }, + { name = "llvmlite" }, + { name = "numpy" }, ] sdist = { url = "https://files.pythonhosted.org/packages/3c/93/2849300a9184775ba274aba6f82f303343669b0592b7bb0849ea713dabb0/numba-0.60.0.tar.gz", hash = "sha256:5df6158e5584eece5fc83294b949fd30b9f1125df7708862205217e068aabf16", size = 2702171 } wheels = [ @@ -1171,9 +1162,6 @@ wheels = [ name = "numpy" version = "2.0.2" source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version < '3.11'", -] sdist = { url = "https://files.pythonhosted.org/packages/a9/75/10dd1f8116a8b796cb2c737b674e02d02e80454bda953fa7e65d8c12b016/numpy-2.0.2.tar.gz", hash = "sha256:883c987dee1880e2a864ab0dc9892292582510604156762362d9326444636e78", size = 18902015 } wheels = [ { url = "https://files.pythonhosted.org/packages/21/91/3495b3237510f79f5d81f2508f9f13fea78ebfdf07538fc7444badda173d/numpy-2.0.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:51129a29dbe56f9ca83438b706e2e69a39892b5eda6cedcb6b0c9fdc9b0d3ece", size = 21165245 }, @@ -1222,73 +1210,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/cc/dc/d330a6faefd92b446ec0f0dfea4c3207bb1fef3c4771d19cf4543efd2c78/numpy-2.0.2-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:a46288ec55ebbd58947d31d72be2c63cbf839f0a63b49cb755022310792a3385", size = 15828784 }, ] -[[package]] -name = "numpy" -version = "2.2.1" -source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version == '3.11.*'", - "python_full_version == '3.12.*'", - "python_full_version >= '3.13'", -] -sdist = { url = "https://files.pythonhosted.org/packages/f2/a5/fdbf6a7871703df6160b5cf3dd774074b086d278172285c52c2758b76305/numpy-2.2.1.tar.gz", hash = "sha256:45681fd7128c8ad1c379f0ca0776a8b0c6583d2f69889ddac01559dfe4390918", size = 20227662 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/c7/c4/5588367dc9f91e1a813beb77de46ea8cab13f778e1b3a0e661ab031aba44/numpy-2.2.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:5edb4e4caf751c1518e6a26a83501fda79bff41cc59dac48d70e6d65d4ec4440", size = 21213214 }, - { url = "https://files.pythonhosted.org/packages/d8/8b/32dd9f08419023a4cf856c5ad0b4eba9b830da85eafdef841a104c4fc05a/numpy-2.2.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:aa3017c40d513ccac9621a2364f939d39e550c542eb2a894b4c8da92b38896ab", size = 14352248 }, - { url = "https://files.pythonhosted.org/packages/84/2d/0e895d02940ba6e12389f0ab5cac5afcf8dc2dc0ade4e8cad33288a721bd/numpy-2.2.1-cp310-cp310-macosx_14_0_arm64.whl", hash = "sha256:61048b4a49b1c93fe13426e04e04fdf5a03f456616f6e98c7576144677598675", size = 5391007 }, - { url = "https://files.pythonhosted.org/packages/11/b9/7f1e64a0d46d9c2af6d17966f641fb12d5b8ea3003f31b2308f3e3b9a6aa/numpy-2.2.1-cp310-cp310-macosx_14_0_x86_64.whl", hash = "sha256:7671dc19c7019103ca44e8d94917eba8534c76133523ca8406822efdd19c9308", size = 6926174 }, - { url = "https://files.pythonhosted.org/packages/2e/8c/043fa4418bc9364e364ab7aba8ff6ef5f6b9171ade22de8fbcf0e2fa4165/numpy-2.2.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4250888bcb96617e00bfa28ac24850a83c9f3a16db471eca2ee1f1714df0f957", size = 14330914 }, - { url = "https://files.pythonhosted.org/packages/f7/b6/d8110985501ca8912dfc1c3bbef99d66e62d487f72e46b2337494df77364/numpy-2.2.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a7746f235c47abc72b102d3bce9977714c2444bdfaea7888d241b4c4bb6a78bf", size = 16379607 }, - { url = "https://files.pythonhosted.org/packages/e2/57/bdca9fb8bdaa810c3a4ff2eb3231379b77f618a7c0d24be9f7070db50775/numpy-2.2.1-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:059e6a747ae84fce488c3ee397cee7e5f905fd1bda5fb18c66bc41807ff119b2", size = 15541760 }, - { url = "https://files.pythonhosted.org/packages/97/55/3b9147b3cbc3b6b1abc2a411dec5337a46c873deca0dd0bf5bef9d0579cc/numpy-2.2.1-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:f62aa6ee4eb43b024b0e5a01cf65a0bb078ef8c395e8713c6e8a12a697144528", size = 18168476 }, - { url = "https://files.pythonhosted.org/packages/00/e7/7c2cde16c9b87a8e14fdd262ca7849c4681cf48c8a774505f7e6f5e3b643/numpy-2.2.1-cp310-cp310-win32.whl", hash = "sha256:48fd472630715e1c1c89bf1feab55c29098cb403cc184b4859f9c86d4fcb6a95", size = 6570985 }, - { url = "https://files.pythonhosted.org/packages/a1/a8/554b0e99fc4ac11ec481254781a10da180d0559c2ebf2c324232317349ee/numpy-2.2.1-cp310-cp310-win_amd64.whl", hash = "sha256:b541032178a718c165a49638d28272b771053f628382d5e9d1c93df23ff58dbf", size = 12913384 }, - { url = "https://files.pythonhosted.org/packages/59/14/645887347124e101d983e1daf95b48dc3e136bf8525cb4257bf9eab1b768/numpy-2.2.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:40f9e544c1c56ba8f1cf7686a8c9b5bb249e665d40d626a23899ba6d5d9e1484", size = 21217379 }, - { url = "https://files.pythonhosted.org/packages/9f/fd/2279000cf29f58ccfd3778cbf4670dfe3f7ce772df5e198c5abe9e88b7d7/numpy-2.2.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:f9b57eaa3b0cd8db52049ed0330747b0364e899e8a606a624813452b8203d5f7", size = 14388520 }, - { url = "https://files.pythonhosted.org/packages/58/b0/034eb5d5ba12d66ab658ff3455a31f20add0b78df8203c6a7451bd1bee21/numpy-2.2.1-cp311-cp311-macosx_14_0_arm64.whl", hash = "sha256:bc8a37ad5b22c08e2dbd27df2b3ef7e5c0864235805b1e718a235bcb200cf1cb", size = 5389286 }, - { url = "https://files.pythonhosted.org/packages/5d/69/6f3cccde92e82e7835fdb475c2bf439761cbf8a1daa7c07338e1e132dfec/numpy-2.2.1-cp311-cp311-macosx_14_0_x86_64.whl", hash = "sha256:9036d6365d13b6cbe8f27a0eaf73ddcc070cae584e5ff94bb45e3e9d729feab5", size = 6930345 }, - { url = "https://files.pythonhosted.org/packages/d1/72/1cd38e91ab563e67f584293fcc6aca855c9ae46dba42e6b5ff4600022899/numpy-2.2.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:51faf345324db860b515d3f364eaa93d0e0551a88d6218a7d61286554d190d73", size = 14335748 }, - { url = "https://files.pythonhosted.org/packages/f2/d4/f999444e86986f3533e7151c272bd8186c55dda554284def18557e013a2a/numpy-2.2.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:38efc1e56b73cc9b182fe55e56e63b044dd26a72128fd2fbd502f75555d92591", size = 16391057 }, - { url = "https://files.pythonhosted.org/packages/99/7b/85cef6a3ae1b19542b7afd97d0b296526b6ef9e3c43ea0c4d9c4404fb2d0/numpy-2.2.1-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:31b89fa67a8042e96715c68e071a1200c4e172f93b0fbe01a14c0ff3ff820fc8", size = 15556943 }, - { url = "https://files.pythonhosted.org/packages/69/7e/b83cc884c3508e91af78760f6b17ab46ad649831b1fa35acb3eb26d9e6d2/numpy-2.2.1-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:4c86e2a209199ead7ee0af65e1d9992d1dce7e1f63c4b9a616500f93820658d0", size = 18180785 }, - { url = "https://files.pythonhosted.org/packages/b2/9f/eb4a9a38867de059dcd4b6e18d47c3867fbd3795d4c9557bb49278f94087/numpy-2.2.1-cp311-cp311-win32.whl", hash = "sha256:b34d87e8a3090ea626003f87f9392b3929a7bbf4104a05b6667348b6bd4bf1cd", size = 6568983 }, - { url = "https://files.pythonhosted.org/packages/6d/1e/be3b9f3073da2f8c7fa361fcdc231b548266b0781029fdbaf75eeab997fd/numpy-2.2.1-cp311-cp311-win_amd64.whl", hash = "sha256:360137f8fb1b753c5cde3ac388597ad680eccbbbb3865ab65efea062c4a1fd16", size = 12917260 }, - { url = "https://files.pythonhosted.org/packages/62/12/b928871c570d4a87ab13d2cc19f8817f17e340d5481621930e76b80ffb7d/numpy-2.2.1-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:694f9e921a0c8f252980e85bce61ebbd07ed2b7d4fa72d0e4246f2f8aa6642ab", size = 20909861 }, - { url = "https://files.pythonhosted.org/packages/3d/c3/59df91ae1d8ad7c5e03efd63fd785dec62d96b0fe56d1f9ab600b55009af/numpy-2.2.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:3683a8d166f2692664262fd4900f207791d005fb088d7fdb973cc8d663626faa", size = 14095776 }, - { url = "https://files.pythonhosted.org/packages/af/4e/8ed5868efc8e601fb69419644a280e9c482b75691466b73bfaab7d86922c/numpy-2.2.1-cp312-cp312-macosx_14_0_arm64.whl", hash = "sha256:780077d95eafc2ccc3ced969db22377b3864e5b9a0ea5eb347cc93b3ea900315", size = 5126239 }, - { url = "https://files.pythonhosted.org/packages/1a/74/dd0bbe650d7bc0014b051f092f2de65e34a8155aabb1287698919d124d7f/numpy-2.2.1-cp312-cp312-macosx_14_0_x86_64.whl", hash = "sha256:55ba24ebe208344aa7a00e4482f65742969a039c2acfcb910bc6fcd776eb4355", size = 6659296 }, - { url = "https://files.pythonhosted.org/packages/7f/11/4ebd7a3f4a655764dc98481f97bd0a662fb340d1001be6050606be13e162/numpy-2.2.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:9b1d07b53b78bf84a96898c1bc139ad7f10fda7423f5fd158fd0f47ec5e01ac7", size = 14047121 }, - { url = "https://files.pythonhosted.org/packages/7f/a7/c1f1d978166eb6b98ad009503e4d93a8c1962d0eb14a885c352ee0276a54/numpy-2.2.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5062dc1a4e32a10dc2b8b13cedd58988261416e811c1dc4dbdea4f57eea61b0d", size = 16096599 }, - { url = "https://files.pythonhosted.org/packages/3d/6d/0e22afd5fcbb4d8d0091f3f46bf4e8906399c458d4293da23292c0ba5022/numpy-2.2.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:fce4f615f8ca31b2e61aa0eb5865a21e14f5629515c9151850aa936c02a1ee51", size = 15243932 }, - { url = "https://files.pythonhosted.org/packages/03/39/e4e5832820131ba424092b9610d996b37e5557180f8e2d6aebb05c31ae54/numpy-2.2.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:67d4cda6fa6ffa073b08c8372aa5fa767ceb10c9a0587c707505a6d426f4e046", size = 17861032 }, - { url = "https://files.pythonhosted.org/packages/5f/8a/3794313acbf5e70df2d5c7d2aba8718676f8d054a05abe59e48417fb2981/numpy-2.2.1-cp312-cp312-win32.whl", hash = "sha256:32cb94448be47c500d2c7a95f93e2f21a01f1fd05dd2beea1ccd049bb6001cd2", size = 6274018 }, - { url = "https://files.pythonhosted.org/packages/17/c1/c31d3637f2641e25c7a19adf2ae822fdaf4ddd198b05d79a92a9ce7cb63e/numpy-2.2.1-cp312-cp312-win_amd64.whl", hash = "sha256:ba5511d8f31c033a5fcbda22dd5c813630af98c70b2661f2d2c654ae3cdfcfc8", size = 12613843 }, - { url = "https://files.pythonhosted.org/packages/20/d6/91a26e671c396e0c10e327b763485ee295f5a5a7a48c553f18417e5a0ed5/numpy-2.2.1-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:f1d09e520217618e76396377c81fba6f290d5f926f50c35f3a5f72b01a0da780", size = 20896464 }, - { url = "https://files.pythonhosted.org/packages/8c/40/5792ccccd91d45e87d9e00033abc4f6ca8a828467b193f711139ff1f1cd9/numpy-2.2.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:3ecc47cd7f6ea0336042be87d9e7da378e5c7e9b3c8ad0f7c966f714fc10d821", size = 14111350 }, - { url = "https://files.pythonhosted.org/packages/c0/2a/fb0a27f846cb857cef0c4c92bef89f133a3a1abb4e16bba1c4dace2e9b49/numpy-2.2.1-cp313-cp313-macosx_14_0_arm64.whl", hash = "sha256:f419290bc8968a46c4933158c91a0012b7a99bb2e465d5ef5293879742f8797e", size = 5111629 }, - { url = "https://files.pythonhosted.org/packages/eb/e5/8e81bb9d84db88b047baf4e8b681a3e48d6390bc4d4e4453eca428ecbb49/numpy-2.2.1-cp313-cp313-macosx_14_0_x86_64.whl", hash = "sha256:5b6c390bfaef8c45a260554888966618328d30e72173697e5cabe6b285fb2348", size = 6645865 }, - { url = "https://files.pythonhosted.org/packages/7a/1a/a90ceb191dd2f9e2897c69dde93ccc2d57dd21ce2acbd7b0333e8eea4e8d/numpy-2.2.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:526fc406ab991a340744aad7e25251dd47a6720a685fa3331e5c59fef5282a59", size = 14043508 }, - { url = "https://files.pythonhosted.org/packages/f1/5a/e572284c86a59dec0871a49cd4e5351e20b9c751399d5f1d79628c0542cb/numpy-2.2.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f74e6fdeb9a265624ec3a3918430205dff1df7e95a230779746a6af78bc615af", size = 16094100 }, - { url = "https://files.pythonhosted.org/packages/0c/2c/a79d24f364788386d85899dd280a94f30b0950be4b4a545f4fa4ed1d4ca7/numpy-2.2.1-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:53c09385ff0b72ba79d8715683c1168c12e0b6e84fb0372e97553d1ea91efe51", size = 15239691 }, - { url = "https://files.pythonhosted.org/packages/cf/79/1e20fd1c9ce5a932111f964b544facc5bb9bde7865f5b42f00b4a6a9192b/numpy-2.2.1-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:f3eac17d9ec51be534685ba877b6ab5edc3ab7ec95c8f163e5d7b39859524716", size = 17856571 }, - { url = "https://files.pythonhosted.org/packages/be/5b/cc155e107f75d694f562bdc84a26cc930569f3dfdfbccb3420b626065777/numpy-2.2.1-cp313-cp313-win32.whl", hash = "sha256:9ad014faa93dbb52c80d8f4d3dcf855865c876c9660cb9bd7553843dd03a4b1e", size = 6270841 }, - { url = "https://files.pythonhosted.org/packages/44/be/0e5cd009d2162e4138d79a5afb3b5d2341f0fe4777ab6e675aa3d4a42e21/numpy-2.2.1-cp313-cp313-win_amd64.whl", hash = "sha256:164a829b6aacf79ca47ba4814b130c4020b202522a93d7bff2202bfb33b61c60", size = 12606618 }, - { url = "https://files.pythonhosted.org/packages/a8/87/04ddf02dd86fb17c7485a5f87b605c4437966d53de1e3745d450343a6f56/numpy-2.2.1-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:4dfda918a13cc4f81e9118dea249e192ab167a0bb1966272d5503e39234d694e", size = 20921004 }, - { url = "https://files.pythonhosted.org/packages/6e/3e/d0e9e32ab14005425d180ef950badf31b862f3839c5b927796648b11f88a/numpy-2.2.1-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:733585f9f4b62e9b3528dd1070ec4f52b8acf64215b60a845fa13ebd73cd0712", size = 14119910 }, - { url = "https://files.pythonhosted.org/packages/b5/5b/aa2d1905b04a8fb681e08742bb79a7bddfc160c7ce8e1ff6d5c821be0236/numpy-2.2.1-cp313-cp313t-macosx_14_0_arm64.whl", hash = "sha256:89b16a18e7bba224ce5114db863e7029803c179979e1af6ad6a6b11f70545008", size = 5153612 }, - { url = "https://files.pythonhosted.org/packages/ce/35/6831808028df0648d9b43c5df7e1051129aa0d562525bacb70019c5f5030/numpy-2.2.1-cp313-cp313t-macosx_14_0_x86_64.whl", hash = "sha256:676f4eebf6b2d430300f1f4f4c2461685f8269f94c89698d832cdf9277f30b84", size = 6668401 }, - { url = "https://files.pythonhosted.org/packages/b1/38/10ef509ad63a5946cc042f98d838daebfe7eaf45b9daaf13df2086b15ff9/numpy-2.2.1-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:27f5cdf9f493b35f7e41e8368e7d7b4bbafaf9660cba53fb21d2cd174ec09631", size = 14014198 }, - { url = "https://files.pythonhosted.org/packages/df/f8/c80968ae01df23e249ee0a4487fae55a4c0fe2f838dfe9cc907aa8aea0fa/numpy-2.2.1-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c1ad395cf254c4fbb5b2132fee391f361a6e8c1adbd28f2cd8e79308a615fe9d", size = 16076211 }, - { url = "https://files.pythonhosted.org/packages/09/69/05c169376016a0b614b432967ac46ff14269eaffab80040ec03ae1ae8e2c/numpy-2.2.1-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:08ef779aed40dbc52729d6ffe7dd51df85796a702afbf68a4f4e41fafdc8bda5", size = 15220266 }, - { url = "https://files.pythonhosted.org/packages/f1/ff/94a4ce67ea909f41cf7ea712aebbe832dc67decad22944a1020bb398a5ee/numpy-2.2.1-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:26c9c4382b19fcfbbed3238a14abf7ff223890ea1936b8890f058e7ba35e8d71", size = 17852844 }, - { url = "https://files.pythonhosted.org/packages/46/72/8a5dbce4020dfc595592333ef2fbb0a187d084ca243b67766d29d03e0096/numpy-2.2.1-cp313-cp313t-win32.whl", hash = "sha256:93cf4e045bae74c90ca833cba583c14b62cb4ba2cba0abd2b141ab52548247e2", size = 6326007 }, - { url = "https://files.pythonhosted.org/packages/7b/9c/4fce9cf39dde2562584e4cfd351a0140240f82c0e3569ce25a250f47037d/numpy-2.2.1-cp313-cp313t-win_amd64.whl", hash = "sha256:bff7d8ec20f5f42607599f9994770fa65d76edca264a87b5e4ea5629bce12268", size = 12693107 }, - { url = "https://files.pythonhosted.org/packages/f1/65/d36a76b811ffe0a4515e290cb05cb0e22171b1b0f0db6bee9141cf023545/numpy-2.2.1-pp310-pypy310_pp73-macosx_10_15_x86_64.whl", hash = "sha256:7ba9cc93a91d86365a5d270dee221fdc04fb68d7478e6bf6af650de78a8339e3", size = 21044672 }, - { url = "https://files.pythonhosted.org/packages/aa/3f/b644199f165063154df486d95198d814578f13dd4d8c1651e075bf1cb8af/numpy-2.2.1-pp310-pypy310_pp73-macosx_14_0_x86_64.whl", hash = "sha256:3d03883435a19794e41f147612a77a8f56d4e52822337844fff3d4040a142964", size = 6789873 }, - { url = "https://files.pythonhosted.org/packages/d7/df/2adb0bb98a3cbe8a6c3c6d1019aede1f1d8b83927ced228a46cc56c7a206/numpy-2.2.1-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4511d9e6071452b944207c8ce46ad2f897307910b402ea5fa975da32e0102800", size = 16194933 }, - { url = "https://files.pythonhosted.org/packages/13/3e/1959d5219a9e6d200638d924cedda6a606392f7186a4ed56478252e70d55/numpy-2.2.1-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:5c5cc0cbabe9452038ed984d05ac87910f89370b9242371bd9079cb4af61811e", size = 12820057 }, -] - [[package]] name = "openai" version = "1.58.1" @@ -1313,8 +1234,7 @@ name = "pandas" version = "2.2.3" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "numpy", version = "2.0.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" }, - { name = "numpy", version = "2.2.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" }, + { name = "numpy" }, { name = "python-dateutil" }, { name = "pytz" }, { name = "tzdata" }, @@ -1628,13 +1548,10 @@ version = "0.5.13" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "joblib" }, - { name = "llvmlite", version = "0.36.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" }, - { name = "llvmlite", version = "0.43.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" }, - { name = "numba", version = "0.53.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" }, - { name = "numba", version = "0.60.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" }, + { name = "llvmlite" }, + { name = "numba" }, { name = "scikit-learn" }, - { name = "scipy", version = "1.13.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" }, - { name = "scipy", version = "1.14.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" }, + { name = "scipy" }, ] sdist = { url = "https://files.pythonhosted.org/packages/7e/58/560a4db5eb3794d922fe55804b10326534ded3d971e1933c1eef91193f5e/pynndescent-0.5.13.tar.gz", hash = "sha256:d74254c0ee0a1eeec84597d5fe89fedcf778593eeabe32c2f97412934a9800fb", size = 2975955 } wheels = [ @@ -1803,10 +1720,8 @@ version = "1.6.0" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "joblib" }, - { name = "numpy", version = "2.0.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" }, - { name = "numpy", version = "2.2.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" }, - { name = "scipy", version = "1.13.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" }, - { name = "scipy", version = "1.14.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" }, + { name = "numpy" }, + { name = "scipy" }, { name = "threadpoolctl" }, ] sdist = { url = "https://files.pythonhosted.org/packages/fa/19/5aa2002044afc297ecaf1e3517ed07bba4aece3b5613b5160c1212995fc8/scikit_learn-1.6.0.tar.gz", hash = "sha256:9d58481f9f7499dff4196927aedd4285a0baec8caa3790efbe205f13de37dd6e", size = 7074944 } @@ -1846,11 +1761,8 @@ wheels = [ name = "scipy" version = "1.13.1" source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version < '3.11'", -] dependencies = [ - { name = "numpy", version = "2.0.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" }, + { name = "numpy" }, ] sdist = { url = "https://files.pythonhosted.org/packages/ae/00/48c2f661e2816ccf2ecd77982f6605b2950afe60f60a52b4cbbc2504aa8f/scipy-1.13.1.tar.gz", hash = "sha256:095a87a0312b08dfd6a6155cbbd310a8c51800fc931b8c0b84003014b874ed3c", size = 57210720 } wheels = [ @@ -1880,63 +1792,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/3e/77/dab54fe647a08ee4253963bcd8f9cf17509c8ca64d6335141422fe2e2114/scipy-1.13.1-cp39-cp39-win_amd64.whl", hash = "sha256:392e4ec766654852c25ebad4f64e4e584cf19820b980bc04960bca0b0cd6eaa2", size = 46227440 }, ] -[[package]] -name = "scipy" -version = "1.14.1" -source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version == '3.11.*'", - "python_full_version == '3.12.*'", - "python_full_version >= '3.13'", -] -dependencies = [ - { name = "numpy", version = "2.2.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/62/11/4d44a1f274e002784e4dbdb81e0ea96d2de2d1045b2132d5af62cc31fd28/scipy-1.14.1.tar.gz", hash = "sha256:5a275584e726026a5699459aa72f828a610821006228e841b94275c4a7c08417", size = 58620554 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/64/68/3bc0cfaf64ff507d82b1e5d5b64521df4c8bf7e22bc0b897827cbee9872c/scipy-1.14.1-cp310-cp310-macosx_10_13_x86_64.whl", hash = "sha256:b28d2ca4add7ac16ae8bb6632a3c86e4b9e4d52d3e34267f6e1b0c1f8d87e389", size = 39069598 }, - { url = "https://files.pythonhosted.org/packages/43/a5/8d02f9c372790326ad405d94f04d4339482ec082455b9e6e288f7100513b/scipy-1.14.1-cp310-cp310-macosx_12_0_arm64.whl", hash = "sha256:d0d2821003174de06b69e58cef2316a6622b60ee613121199cb2852a873f8cf3", size = 29879676 }, - { url = "https://files.pythonhosted.org/packages/07/42/0e0bea9666fcbf2cb6ea0205db42c81b1f34d7b729ba251010edf9c80ebd/scipy-1.14.1-cp310-cp310-macosx_14_0_arm64.whl", hash = "sha256:8bddf15838ba768bb5f5083c1ea012d64c9a444e16192762bd858f1e126196d0", size = 23088696 }, - { url = "https://files.pythonhosted.org/packages/15/47/298ab6fef5ebf31b426560e978b8b8548421d4ed0bf99263e1eb44532306/scipy-1.14.1-cp310-cp310-macosx_14_0_x86_64.whl", hash = "sha256:97c5dddd5932bd2a1a31c927ba5e1463a53b87ca96b5c9bdf5dfd6096e27efc3", size = 25470699 }, - { url = "https://files.pythonhosted.org/packages/d8/df/cdb6be5274bc694c4c22862ac3438cb04f360ed9df0aecee02ce0b798380/scipy-1.14.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2ff0a7e01e422c15739ecd64432743cf7aae2b03f3084288f399affcefe5222d", size = 35606631 }, - { url = "https://files.pythonhosted.org/packages/47/78/b0c2c23880dd1e99e938ad49ccfb011ae353758a2dc5ed7ee59baff684c3/scipy-1.14.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8e32dced201274bf96899e6491d9ba3e9a5f6b336708656466ad0522d8528f69", size = 41178528 }, - { url = "https://files.pythonhosted.org/packages/5d/aa/994b45c34b897637b853ec04334afa55a85650a0d11dacfa67232260fb0a/scipy-1.14.1-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:8426251ad1e4ad903a4514712d2fa8fdd5382c978010d1c6f5f37ef286a713ad", size = 42784535 }, - { url = "https://files.pythonhosted.org/packages/e7/1c/8daa6df17a945cb1a2a1e3bae3c49643f7b3b94017ff01a4787064f03f84/scipy-1.14.1-cp310-cp310-win_amd64.whl", hash = "sha256:a49f6ed96f83966f576b33a44257d869756df6cf1ef4934f59dd58b25e0327e5", size = 44772117 }, - { url = "https://files.pythonhosted.org/packages/b2/ab/070ccfabe870d9f105b04aee1e2860520460ef7ca0213172abfe871463b9/scipy-1.14.1-cp311-cp311-macosx_10_13_x86_64.whl", hash = "sha256:2da0469a4ef0ecd3693761acbdc20f2fdeafb69e6819cc081308cc978153c675", size = 39076999 }, - { url = "https://files.pythonhosted.org/packages/a7/c5/02ac82f9bb8f70818099df7e86c3ad28dae64e1347b421d8e3adf26acab6/scipy-1.14.1-cp311-cp311-macosx_12_0_arm64.whl", hash = "sha256:c0ee987efa6737242745f347835da2cc5bb9f1b42996a4d97d5c7ff7928cb6f2", size = 29894570 }, - { url = "https://files.pythonhosted.org/packages/ed/05/7f03e680cc5249c4f96c9e4e845acde08eb1aee5bc216eff8a089baa4ddb/scipy-1.14.1-cp311-cp311-macosx_14_0_arm64.whl", hash = "sha256:3a1b111fac6baec1c1d92f27e76511c9e7218f1695d61b59e05e0fe04dc59617", size = 23103567 }, - { url = "https://files.pythonhosted.org/packages/5e/fc/9f1413bef53171f379d786aabc104d4abeea48ee84c553a3e3d8c9f96a9c/scipy-1.14.1-cp311-cp311-macosx_14_0_x86_64.whl", hash = "sha256:8475230e55549ab3f207bff11ebfc91c805dc3463ef62eda3ccf593254524ce8", size = 25499102 }, - { url = "https://files.pythonhosted.org/packages/c2/4b/b44bee3c2ddc316b0159b3d87a3d467ef8d7edfd525e6f7364a62cd87d90/scipy-1.14.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:278266012eb69f4a720827bdd2dc54b2271c97d84255b2faaa8f161a158c3b37", size = 35586346 }, - { url = "https://files.pythonhosted.org/packages/93/6b/701776d4bd6bdd9b629c387b5140f006185bd8ddea16788a44434376b98f/scipy-1.14.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:fef8c87f8abfb884dac04e97824b61299880c43f4ce675dd2cbeadd3c9b466d2", size = 41165244 }, - { url = "https://files.pythonhosted.org/packages/06/57/e6aa6f55729a8f245d8a6984f2855696c5992113a5dc789065020f8be753/scipy-1.14.1-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:b05d43735bb2f07d689f56f7b474788a13ed8adc484a85aa65c0fd931cf9ccd2", size = 42817917 }, - { url = "https://files.pythonhosted.org/packages/ea/c2/5ecadc5fcccefaece775feadcd795060adf5c3b29a883bff0e678cfe89af/scipy-1.14.1-cp311-cp311-win_amd64.whl", hash = "sha256:716e389b694c4bb564b4fc0c51bc84d381735e0d39d3f26ec1af2556ec6aad94", size = 44781033 }, - { url = "https://files.pythonhosted.org/packages/c0/04/2bdacc8ac6387b15db6faa40295f8bd25eccf33f1f13e68a72dc3c60a99e/scipy-1.14.1-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:631f07b3734d34aced009aaf6fedfd0eb3498a97e581c3b1e5f14a04164a456d", size = 39128781 }, - { url = "https://files.pythonhosted.org/packages/c8/53/35b4d41f5fd42f5781dbd0dd6c05d35ba8aa75c84ecddc7d44756cd8da2e/scipy-1.14.1-cp312-cp312-macosx_12_0_arm64.whl", hash = "sha256:af29a935803cc707ab2ed7791c44288a682f9c8107bc00f0eccc4f92c08d6e07", size = 29939542 }, - { url = "https://files.pythonhosted.org/packages/66/67/6ef192e0e4d77b20cc33a01e743b00bc9e68fb83b88e06e636d2619a8767/scipy-1.14.1-cp312-cp312-macosx_14_0_arm64.whl", hash = "sha256:2843f2d527d9eebec9a43e6b406fb7266f3af25a751aa91d62ff416f54170bc5", size = 23148375 }, - { url = "https://files.pythonhosted.org/packages/f6/32/3a6dedd51d68eb7b8e7dc7947d5d841bcb699f1bf4463639554986f4d782/scipy-1.14.1-cp312-cp312-macosx_14_0_x86_64.whl", hash = "sha256:eb58ca0abd96911932f688528977858681a59d61a7ce908ffd355957f7025cfc", size = 25578573 }, - { url = "https://files.pythonhosted.org/packages/f0/5a/efa92a58dc3a2898705f1dc9dbaf390ca7d4fba26d6ab8cfffb0c72f656f/scipy-1.14.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:30ac8812c1d2aab7131a79ba62933a2a76f582d5dbbc695192453dae67ad6310", size = 35319299 }, - { url = "https://files.pythonhosted.org/packages/8e/ee/8a26858ca517e9c64f84b4c7734b89bda8e63bec85c3d2f432d225bb1886/scipy-1.14.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8f9ea80f2e65bdaa0b7627fb00cbeb2daf163caa015e59b7516395fe3bd1e066", size = 40849331 }, - { url = "https://files.pythonhosted.org/packages/a5/cd/06f72bc9187840f1c99e1a8750aad4216fc7dfdd7df46e6280add14b4822/scipy-1.14.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:edaf02b82cd7639db00dbff629995ef185c8df4c3ffa71a5562a595765a06ce1", size = 42544049 }, - { url = "https://files.pythonhosted.org/packages/aa/7d/43ab67228ef98c6b5dd42ab386eae2d7877036970a0d7e3dd3eb47a0d530/scipy-1.14.1-cp312-cp312-win_amd64.whl", hash = "sha256:2ff38e22128e6c03ff73b6bb0f85f897d2362f8c052e3b8ad00532198fbdae3f", size = 44521212 }, - { url = "https://files.pythonhosted.org/packages/50/ef/ac98346db016ff18a6ad7626a35808f37074d25796fd0234c2bb0ed1e054/scipy-1.14.1-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:1729560c906963fc8389f6aac023739ff3983e727b1a4d87696b7bf108316a79", size = 39091068 }, - { url = "https://files.pythonhosted.org/packages/b9/cc/70948fe9f393b911b4251e96b55bbdeaa8cca41f37c26fd1df0232933b9e/scipy-1.14.1-cp313-cp313-macosx_12_0_arm64.whl", hash = "sha256:4079b90df244709e675cdc8b93bfd8a395d59af40b72e339c2287c91860deb8e", size = 29875417 }, - { url = "https://files.pythonhosted.org/packages/3b/2e/35f549b7d231c1c9f9639f9ef49b815d816bf54dd050da5da1c11517a218/scipy-1.14.1-cp313-cp313-macosx_14_0_arm64.whl", hash = "sha256:e0cf28db0f24a38b2a0ca33a85a54852586e43cf6fd876365c86e0657cfe7d73", size = 23084508 }, - { url = "https://files.pythonhosted.org/packages/3f/d6/b028e3f3e59fae61fb8c0f450db732c43dd1d836223a589a8be9f6377203/scipy-1.14.1-cp313-cp313-macosx_14_0_x86_64.whl", hash = "sha256:0c2f95de3b04e26f5f3ad5bb05e74ba7f68b837133a4492414b3afd79dfe540e", size = 25503364 }, - { url = "https://files.pythonhosted.org/packages/a7/2f/6c142b352ac15967744d62b165537a965e95d557085db4beab2a11f7943b/scipy-1.14.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b99722ea48b7ea25e8e015e8341ae74624f72e5f21fc2abd45f3a93266de4c5d", size = 35292639 }, - { url = "https://files.pythonhosted.org/packages/56/46/2449e6e51e0d7c3575f289f6acb7f828938eaab8874dbccfeb0cd2b71a27/scipy-1.14.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5149e3fd2d686e42144a093b206aef01932a0059c2a33ddfa67f5f035bdfe13e", size = 40798288 }, - { url = "https://files.pythonhosted.org/packages/32/cd/9d86f7ed7f4497c9fd3e39f8918dd93d9f647ba80d7e34e4946c0c2d1a7c/scipy-1.14.1-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:e4f5a7c49323533f9103d4dacf4e4f07078f360743dec7f7596949149efeec06", size = 42524647 }, - { url = "https://files.pythonhosted.org/packages/f5/1b/6ee032251bf4cdb0cc50059374e86a9f076308c1512b61c4e003e241efb7/scipy-1.14.1-cp313-cp313-win_amd64.whl", hash = "sha256:baff393942b550823bfce952bb62270ee17504d02a1801d7fd0719534dfb9c84", size = 44469524 }, -] - -[[package]] -name = "setuptools" -version = "75.8.0" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/92/ec/089608b791d210aec4e7f97488e67ab0d33add3efccb83a056cbafe3a2a6/setuptools-75.8.0.tar.gz", hash = "sha256:c5afc8f407c626b8313a86e10311dd3f661c6cd9c09d4bf8c15c0e11f9f2b0e6", size = 1343222 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/69/8a/b9dc7678803429e4a3bc9ba462fa3dd9066824d3c607490235c6a796be5a/setuptools-75.8.0-py3-none-any.whl", hash = "sha256:e3982f444617239225d675215d51f6ba05f845d4eec313da4418fdbb56fb27e3", size = 1228782 }, -] - [[package]] name = "shellingham" version = "1.5.4" @@ -2045,14 +1900,11 @@ name = "umap-learn" version = "0.5.7" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "numba", version = "0.53.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" }, - { name = "numba", version = "0.60.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" }, - { name = "numpy", version = "2.0.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" }, - { name = "numpy", version = "2.2.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" }, + { name = "numba" }, + { name = "numpy" }, { name = "pynndescent" }, { name = "scikit-learn" }, - { name = "scipy", version = "1.13.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" }, - { name = "scipy", version = "1.14.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" }, + { name = "scipy" }, { name = "tqdm" }, ] sdist = { url = "https://files.pythonhosted.org/packages/6f/d4/9ed627905f7993349671283b3c5bf2d9f543ef79229fa1c7e01324eb900c/umap-learn-0.5.7.tar.gz", hash = "sha256:b2a97973e4c6ffcebf241100a8de589a4c84126a832ab40f296c6d9fcc5eb19e", size = 92680 }