diff --git a/README.md b/README.md index 090d438..291c1ff 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,8 @@

License Apache-2.0 pypi_status - PRs Welcome + Commit activity + Slack

[pykoi](https://www.cambioml.com/pykoi/) is an open-source python library for improving LLMs with RLHF. We provide a unified interface including RLHF/RLAIF data and feedback collection, finetuning with reinforcement learning and reward modeling, and LLM comparisons. @@ -41,43 +42,51 @@ Reinforcement Learning with Human Feedback (RLHF) is a unique training paradigm ## Installation -To get started with `pykoi`, you can choose to one of following compute options: CPU (e.g. your laptop) or GPU (e.g. EC2). +To get started with pykoi, you can choose from any of the installation options. The choice should be based on the features you need (e.g., RAG, RLHF or all) and the compute resources you have, such as a CPU (e.g., your laptop) or GPU (e.g., AWS EC2 or SageMaker). -### Option 1: CPU (e.g. your laptop) -Installation on a CPU is simple if you have conda. If not, install [conda](https://docs.conda.io/projects/conda/en/latest/user-guide/install/index.html) for your operating system. +### Option 1: RAG (CPU) +This option allows you to run RAG on a CPU using either the OpenAI API or the Anthropic Claude2 API. Installation of RAG (CPU) is simple if you have conda. If not, install [conda](https://docs.conda.io/projects/conda/en/latest/user-guide/install/index.html) for your operating system. First, create a conda environment on your terminal using: ``` conda create -n pykoi python=3.10 -y -conda activate pykoi +conda activate pykoi # some OS requires `source activate pykoi` ``` -Then install `pykoi` and the compatible [pytorch based on your os](https://pytorch.org/get-started) +Then install `pykoi` and the compatible [pytorch based on your os](https://pytorch.org/get-started/locally/) ``` -pip3 install pykoi +pip3 install "pykoi[rag]" pip3 install torch ``` -### Option 2: GPU (e.g. EC2 or SageMaker) +### Option 2: RAG (GPU) +This option allows you to run RAG on a GPU using an open-source LLM from HuggingFace. Here's a quick [tutorial](#ec2-dev-setup) on setting up an EC2 GPU instance for the installation below. -If you are on EC2, you can launch a GPU instance with the following config: -- EC2 `g4dn.xlarge` (if you want to run a pretrained LLM with 7B parameters) -- Deep Learning AMI PyTorch GPU 2.0.1 (Ubuntu 20.04) - Alt text -- EBS: at least 100G - Alt text +On your GPU instance terminal, create a conda environment using: +``` +conda create -n pykoi python=3.10 -y && source activate pykoi +``` -Next, on your GPU instance terminal, create a conda environment using: +Then install `pykoi` and [pytorch based on your cuda version](https://pytorch.org/get-started/locally/). You can find your CUDA version via `nvcc -V`. +``` +pip3 install "pykoi[rag, huggingface]" + +pip3 install --pre torch --index-url https://download.pytorch.org/whl/nightly/cu121 # cu121 means cuda 12.1 +``` + +### Option 3: RLHF (GPU) +This option allows you to train LLM via RLHF on a GPU. Here's a quick [tutorial](#ec2-dev-setup) on setting up an EC2 GPU instance for the installation below. + +On your GPU instance terminal, create a conda environment using: ``` conda create -n pykoi python=3.10 -y && source activate pykoi ``` -Then install `pykoi` and [pytorch based on your cuda version](https://pytorch.org/get-started). +Then install `pykoi` and [pytorch based on your cuda version](https://pytorch.org/get-started/locally/). You can find your CUDA version via `nvcc -V`. ``` -pip3 install pykoi +pip3 install "pykoi[rlhf]" -# install torch based on cuda (e.g. cu118 means cuda 11.8) -pip3 install torch --index-url https://download.pytorch.org/whl/cu118 +pip3 install --pre torch --index-url https://download.pytorch.org/whl/nightly/cu121 # cu121 means cuda 12.1 ``` Congrats you have finished the installation! @@ -91,13 +100,41 @@ conda create -n pykoi python=3.10 conda activate pykoi cd pykoi pip3 install poetry -poetry install --no-root ``` +Then, based the feature you need to develop, run one or more installation options below. We recommend install all the options below although it may take ~3 minutes longer. + +- Option 1: RAG (CPU) + ``` + poetry install --no-root --extras rag + ``` +- Option 2: RAG (GPU) + ``` + poetry install --no-root --extras "rag huggingface" + ``` +- Option 3: RLHF (GPU) + ``` + poetry install --no-root --extras rlhf + ``` + +Finally, if you are on a GPU, install [pytorch based on your cuda version](https://pytorch.org/get-started/locally/). You can find your CUDA version via `nvcc -V`. +``` +pip3 install --pre torch --index-url https://download.pytorch.org/whl/nightly/cu121 # cu121 means cuda 12.1 +``` + + ### Frontend Dev Setup -Frontend: ``` cd pykoi/pykoi/frontend npm install npm run build ``` + +### EC2 Dev Setup +If you are on EC2, you can launch a GPU instance with the following config: +- EC2 `g4dn.xlarge` (if you want to run a pretrained LLM with 7B parameters) +- Deep Learning AMI PyTorch GPU 2.0.1 (Ubuntu 20.04) + Alt text +- EBS: at least 100G + Alt text + diff --git a/example/chatbot/demo_launch_app_cpu_openai.ipynb b/example/chatbot/demo_launch_app_cpu_openai.ipynb index 509f776..65c1060 100644 --- a/example/chatbot/demo_launch_app_cpu_openai.ipynb +++ b/example/chatbot/demo_launch_app_cpu_openai.ipynb @@ -1,5 +1,24 @@ { "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Launch a Chatbot UI (with Database) from an OpenAI model\n", + "\n", + "`pykoi` provides simple UI to launch a chatbot UI based on your LLMs, including your own finetuned LLM, a pretrained LLM from huggingface, or OpenAI/Anthropic/Bedrock APIs. This demo shows how to create and launch an LLM chatbot UI and database for OpenAI/Anthropic/Bedrock APIs. Let's get started!\n", + "\n", + "\n", + "### Prerequisites\n", + "To run this jupyter notebook, you need a `pykoi` environment with the `rag` option. You can follow [the installation guide](https://github.com/CambioML/pykoi/tree/install#option-1-rag-cpu) to set up the environment. \n", + "\n", + "You may also need `pip install ipykernel` to run the kernel environment.\n", + "\n", + "\n", + "### (Optional) Developer setup\n", + "If you are a normal user of `pykoi`, you can skip this step. However, if you modify the pykoi code and want to test your changes, you can uncomment the code below." + ] + }, { "cell_type": "code", "execution_count": null, @@ -9,19 +28,18 @@ "# %reload_ext autoreload\n", "# %autoreload 2\n", "\n", - "# import os\n", "# import sys\n", "\n", - "# # Add the root folder to the module search path\n", - "# # Get the current directory\n", - "# current_directory = os.getcwd()\n", - "\n", - "# # Move two levels up (go to the parent directory of the parent directory)\n", - "# two_levels_up_directory = os.path.dirname(os.path.dirname(current_directory))\n", - "\n", - "# print(two_levels_up_directory)\n", - "\n", - "# sys.path.append(two_levels_up_directory)" + "# sys.path.append(\".\")\n", + "# sys.path.append(\"..\")\n", + "# sys.path.append(\"../..\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Import Libraries" ] }, { @@ -30,7 +48,6 @@ "metadata": {}, "outputs": [], "source": [ - "## pip install ipykernel\n", "from pykoi import Application\n", "from pykoi.chat import ModelFactory\n", "from pykoi.chat import QuestionAnswerDatabase\n", diff --git a/example/chatbot/openai_model_demo.py b/example/chatbot/demo_launch_app_cpu_openai.py similarity index 65% rename from example/chatbot/openai_model_demo.py rename to example/chatbot/demo_launch_app_cpu_openai.py index a9f6956..35d6646 100644 --- a/example/chatbot/openai_model_demo.py +++ b/example/chatbot/demo_launch_app_cpu_openai.py @@ -1,4 +1,18 @@ -"""Demo for the chatbot application using OpenAI endpoint.""" +""" +Demo for launching a chatbot UI (with database) from an OpenAI model. + +- Prerequisites: + To run this jupyter notebook, you need a `pykoi` environment with the `rag` option. + You can follow [the installation guide](https://github.com/CambioML/pykoi/tree/install#option-1-rag-cpu) + to set up the environment. +- Run the demo: + 1. Enter your OpenAI API key in the `api_key` below. + 2. On terminal and `~/pykoi` directory, run + ``` + python -m example.chatbot.demo_launch_app_cpu_openai + ``` +""" + from pykoi import Application from pykoi.chat import ModelFactory from pykoi.chat import QuestionAnswerDatabase @@ -9,7 +23,7 @@ # Creating an OpenAI model (requires an OpenAI API key) # ########################################################## # enter openai api key here -api_key = "" +api_key = "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" # Creating an OpenAI model model = ModelFactory.create_model( diff --git a/example/chatbot/demo_launch_app_gpu_huggingface.ipynb b/example/chatbot/demo_launch_app_gpu_huggingface.ipynb index 35768ff..4b3246e 100644 --- a/example/chatbot/demo_launch_app_gpu_huggingface.ipynb +++ b/example/chatbot/demo_launch_app_gpu_huggingface.ipynb @@ -1,5 +1,24 @@ { "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Launch a Chatbot UI (with Database) from Open-source LLMs\n", + "\n", + "`pykoi` provides simple UI to launch a chatbot UI based on your LLMs, including your own finetuned LLM, a pretrained LLM from huggingface, or OpenAI/Anthropic/Bedrock APIs. This demo shows how to create and launch an LLM chatbot UI and database (with Database) from Open-source LLMs from Huggingface. Let's get started!\n", + "\n", + "\n", + "### Prerequisites\n", + "To run this jupyter notebook, you need a `pykoi` environment with the `huggingface` option. You can follow [the installation guide](https://github.com/CambioML/pykoi/tree/install#option-2-rag-gpu) to set up the environment. \n", + "\n", + "You may also need `pip install ipykernel` to run the kernel environment.\n", + "\n", + "\n", + "### (Optional) Developer setup\n", + "If you are a normal user of `pykoi`, you can skip this step. However, if you modify the pykoi code and want to test your changes, you can uncomment the code below." + ] + }, { "cell_type": "code", "execution_count": null, @@ -9,19 +28,18 @@ "# %reload_ext autoreload\n", "# %autoreload 2\n", "\n", - "# import os\n", "# import sys\n", "\n", - "# # Add the root folder to the module search path\n", - "# # Get the current directory\n", - "# current_directory = os.getcwd()\n", - "\n", - "# # Move two levels up (go to the parent directory of the parent directory)\n", - "# two_levels_up_directory = os.path.dirname(os.path.dirname(current_directory))\n", - "\n", - "# print(two_levels_up_directory)\n", - "\n", - "# sys.path.append(two_levels_up_directory)" + "# sys.path.append(\".\")\n", + "# sys.path.append(\"..\")\n", + "# sys.path.append(\"../..\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Import Libraries" ] }, { diff --git a/example/chatbot/huggingface_model_demo.py b/example/chatbot/demo_launch_app_gpu_huggingface.py similarity index 71% rename from example/chatbot/huggingface_model_demo.py rename to example/chatbot/demo_launch_app_gpu_huggingface.py index e2cbc0e..fe72694 100644 --- a/example/chatbot/huggingface_model_demo.py +++ b/example/chatbot/demo_launch_app_gpu_huggingface.py @@ -1,4 +1,16 @@ -"""Demo for the chatbot application.""" +""" +Demo for the chatbot application using open source LLMs from Huggingface. + +- Prerequisites: + To run this jupyter notebook, you need a `pykoi` environment with the `huggingface` option. + You can follow [the installation guide](https://github.com/CambioML/pykoi/tree/install#option-2-rag-gpu) + to set up the environment. +- Run the demo: + 1. On terminal and `~/pykoi` directory, run + ``` + python -m example.chatbot.demo_launch_app_gpu_huggingface + ``` +""" from pykoi import Application from pykoi.chat import ModelFactory from pykoi.chat import QuestionAnswerDatabase diff --git a/example/chatbot/peft_huggingface_model_demo.py b/example/chatbot/demo_launch_app_gpu_huggingface_peft.py similarity index 72% rename from example/chatbot/peft_huggingface_model_demo.py rename to example/chatbot/demo_launch_app_gpu_huggingface_peft.py index be4b8b5..fe82e47 100644 --- a/example/chatbot/peft_huggingface_model_demo.py +++ b/example/chatbot/demo_launch_app_gpu_huggingface_peft.py @@ -1,4 +1,17 @@ -"""Demo for the chatbot application.""" +""" +Demo for the chatbot application using open source LLMs from Huggingface Peft. + +- Prerequisites: + To run this jupyter notebook, you need a `pykoi` environment with the `huggingface` option. + You can follow [the installation guide](https://github.com/CambioML/pykoi/tree/install#option-2-rag-gpu) + to set up the environment. +- Run the demo: + 1. On terminal and `~/pykoi` directory, run + ``` + python -m example.chatbot.demo_launch_app_gpu_huggingface_peft + ``` +""" + from pykoi import Application from pykoi.chat import ModelFactory from pykoi.chat import QuestionAnswerDatabase diff --git a/example/chatbot/demo_model_comparator_cpu_openai.ipynb b/example/comparator/demo_model_comparator_cpu_openai.ipynb similarity index 76% rename from example/chatbot/demo_model_comparator_cpu_openai.ipynb rename to example/comparator/demo_model_comparator_cpu_openai.ipynb index 19a84d1..e75aed6 100644 --- a/example/chatbot/demo_model_comparator_cpu_openai.ipynb +++ b/example/comparator/demo_model_comparator_cpu_openai.ipynb @@ -1,5 +1,23 @@ { "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Demo: LLMs Comparison between OpenAI models\n", + "\n", + "`pykoi` provides simple API to compare between LLMs, including your own finetuned LLM, a pretrained LLM from huggingface, or OpenAI/Anthropic/Bedrock APIs. This demo shows how to create and launch an LLM comparison app for OpenAI/Anthropic/Bedrock APIs. Let's get started!\n", + "\n", + "### Prerequisites\n", + "To run this jupyter notebook, you need a `pykoi` environment with the `rag` option. You can follow [the installation guide](https://github.com/CambioML/pykoi/tree/install#option-1-rag-cpu) to set up the environment. \n", + "\n", + "You may also need `pip install ipykernel` to run the kernel environment.\n", + "\n", + "\n", + "### (Optional) Developer setup\n", + "If you are a normal user of `pykoi`, you can skip this step. However, if you modify the pykoi code and want to test your changes, you can uncomment the code below." + ] + }, { "cell_type": "code", "execution_count": null, @@ -9,19 +27,18 @@ "# %reload_ext autoreload\n", "# %autoreload 2\n", "\n", - "# import os\n", "# import sys\n", "\n", - "# # Add the root folder to the module search path\n", - "# # Get the current directory\n", - "# current_directory = os.getcwd()\n", - "\n", - "# # Move two levels up (go to the parent directory of the parent directory)\n", - "# two_levels_up_directory = os.path.dirname(os.path.dirname(current_directory))\n", - "\n", - "# print(two_levels_up_directory)\n", - "\n", - "# sys.path.append(two_levels_up_directory)" + "# sys.path.append(\".\")\n", + "# sys.path.append(\"..\")\n", + "# sys.path.append(\"../..\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Import Libraries" ] }, { @@ -39,13 +56,9 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# Demo: LLMs Comparison\n", - "\n", - "`pykoi` provides simple API to compare between LLMs, including your own finetuned LLM, a pretrained LLM from huggingface, or OpenAI/Anthropic/Bedrock APIs.\n", "\n", - "This demo shows how to create and launch an LLM comparison app. Let's get started!\n", "\n", - "## Load LLMs\n", + "### Load LLMs\n", "\n", "#### 1. Creating an OpenAI model (requires an OpenAI API key)" ] @@ -108,6 +121,13 @@ "nest_asyncio.apply()" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Launch the App" + ] + }, { "cell_type": "code", "execution_count": null, @@ -137,13 +157,6 @@ " \n", "

" ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] } ], "metadata": { diff --git a/example/chatbot/demo_model_comparator_cpu_openai.py b/example/comparator/demo_model_comparator_cpu_openai.py similarity index 80% rename from example/chatbot/demo_model_comparator_cpu_openai.py rename to example/comparator/demo_model_comparator_cpu_openai.py index b5c45f9..483c3f3 100644 --- a/example/chatbot/demo_model_comparator_cpu_openai.py +++ b/example/comparator/demo_model_comparator_cpu_openai.py @@ -1,4 +1,18 @@ -"""Demo for the chatbot application using multiple model endpoint.""" +""" +Demo for the chatbot application using multiple OpenAI models. + +- Prerequisites: + To run this jupyter notebook, you need a `pykoi` environment with the `rag` option. + You can follow [the installation guide](https://github.com/CambioML/pykoi/tree/install#option-1-rag-cpu) + to set up the environment. +- Run the demo: + 1. Enter your OpenAI API key in the `api_key` below. + 2. On terminal and `~/pykoi` directory, run + ``` + python -m example.comparator.demo_model_comparator_cpu_openai + ``` +""" + from pykoi import Application from pykoi.chat import ModelFactory from pykoi.component import Compare diff --git a/example/chatbot/demo_model_comparator_gpu_huggingface.ipynb b/example/comparator/demo_model_comparator_gpu_huggingface.ipynb similarity index 76% rename from example/chatbot/demo_model_comparator_gpu_huggingface.ipynb rename to example/comparator/demo_model_comparator_gpu_huggingface.ipynb index 92614e9..1799762 100644 --- a/example/chatbot/demo_model_comparator_gpu_huggingface.ipynb +++ b/example/comparator/demo_model_comparator_gpu_huggingface.ipynb @@ -1,5 +1,23 @@ { "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Demo: LLMs Comparison between Open-source LLMs\n", + "\n", + "`pykoi` provides simple API to compare between LLMs, including your own finetuned LLM, a pretrained LLM from huggingface, or OpenAI/Anthropic/Bedrock APIs. This demo shows how to create and launch an LLM comparison app between Open-source LLMs from huggingface. Let's get started!\n", + "\n", + "### Prerequisites\n", + "To run this jupyter notebook, you need a `pykoi` environment with the `huggingface` option. You can follow [the installation guide](https://github.com/CambioML/pykoi/tree/install#option-2-rag-gpu) to set up the environment. \n", + "\n", + "You may also need `pip install ipykernel` to run the kernel environment.\n", + "\n", + "\n", + "### (Optional) Developer setup\n", + "If you are a normal user of `pykoi`, you can skip this step. However, if you modify the pykoi code and want to test your changes, you can uncomment the code below." + ] + }, { "cell_type": "code", "execution_count": null, @@ -9,19 +27,18 @@ "# %reload_ext autoreload\n", "# %autoreload 2\n", "\n", - "# import os\n", "# import sys\n", "\n", - "# # Add the root folder to the module search path\n", - "# # Get the current directory\n", - "# current_directory = os.getcwd()\n", - "\n", - "# # Move two levels up (go to the parent directory of the parent directory)\n", - "# two_levels_up_directory = os.path.dirname(os.path.dirname(current_directory))\n", - "\n", - "# print(two_levels_up_directory)\n", - "\n", - "# sys.path.append(two_levels_up_directory)" + "# sys.path.append(\".\")\n", + "# sys.path.append(\"..\")\n", + "# sys.path.append(\"../..\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Import Libraries" ] }, { @@ -42,21 +59,8 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# Demo: LLMs Comparison\n", - "\n", - "`pykoi` provides simple API to compare between LLMs, including your own finetuned LLM, a pretrained LLM from huggingface, or OpenAI/Anthropic/Bedrock APIs.\n", - "\n", - "This demo shows how to create and launch an LLM comparison app. Let's get started!\n", - "\n", - "## Load LLMs\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "#### Creating a Huggingface model (requires at least EC2 `g4.2xlarge` or GPU with 16G memory)" + "### Load LLMs\n", + "#### Creating a Huggingface model (requires at least EC2 `g4dn.xlarge` or GPU with at least 16G memory)" ] }, { @@ -65,7 +69,7 @@ "metadata": {}, "outputs": [], "source": [ - "## requires a GPU with at least 16GB memory (e.g. g4.2xlarge)\n", + "## requires a GPU with at least 16GB memory (e.g. g4dn.xlarge)\n", "huggingface_model_1 = ModelFactory.create_model(\n", " model_source=\"huggingface\",\n", " pretrained_model_name_or_path=\"tiiuae/falcon-rw-1b\",\n", @@ -78,7 +82,7 @@ "metadata": {}, "outputs": [], "source": [ - "## requires a GPU with at least 16GB memory (e.g. g4.2xlarge)\n", + "## requires a GPU with at least 16GB memory (e.g. g4dn.2xlarge)\n", "huggingface_model_2 = ModelFactory.create_model(\n", " model_source=\"huggingface\",\n", " pretrained_model_name_or_path=\"databricks/dolly-v2-3b\",\n", @@ -102,9 +106,9 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## Create a chatbot comparator\n", + "### Create a chatbot comparator\n", "\n", - "### Add `nest_asyncio` \n", + "#### Add `nest_asyncio` \n", "Add `nest_asyncio` to avoid error. Since we're running another interface inside a Jupyter notebook where an asyncio event loop is already running, we'll encounter the error. (since The uvicorn.run() function uses asyncio.run(), which isn't compatible with a running event loop.)" ] }, @@ -134,7 +138,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "### Add ngrok auth (TODO: change to bash file)" + "#### Add ngrok auth (TODO: change to bash file)" ] }, { diff --git a/example/chatbot/demo_model_comparator_gpu_huggingface.py b/example/comparator/demo_model_comparator_gpu_huggingface.py similarity index 81% rename from example/chatbot/demo_model_comparator_gpu_huggingface.py rename to example/comparator/demo_model_comparator_gpu_huggingface.py index d033143..7ddec16 100644 --- a/example/chatbot/demo_model_comparator_gpu_huggingface.py +++ b/example/comparator/demo_model_comparator_gpu_huggingface.py @@ -1,4 +1,16 @@ -"""Demo for the chatbot application using multiple model endpoint.""" +""" +Demo for the chatbot application using multiple open source LLMs from Huggingface. + +- Prerequisites: + To run this jupyter notebook, you need a `pykoi` environment with the `huggingface` option. + You can follow [the installation guide](https://github.com/CambioML/pykoi/tree/install#option-2-rag-gpu) + to set up the environment. +- Run the demo: + 1. On terminal and `~/pykoi` directory, run + ``` + python -m example.comparator.demo_model_comparator_gpu_huggingface + ``` +""" from pykoi import Application from pykoi.chat import ModelFactory from pykoi.component import Compare diff --git a/example/flex/flex_demo.py b/example/flex/flex_demo.py index 13c0d09..60bf66c 100644 --- a/example/flex/flex_demo.py +++ b/example/flex/flex_demo.py @@ -8,6 +8,7 @@ from pykoi.retrieval import RetrievalFactory from pykoi.retrieval import VectorDbFactory from pykoi.component import Chatbot, Dashboard, RetrievalQA +from pykoi.chat import RAGDatabase load_dotenv() @@ -32,9 +33,9 @@ def main(**kargs): ) # retrieval, chatbot, and dashboard pykoi components - retriever = RetrievalQA(retrieval_model=retrieval_model, vector_db=vector_db) - chatbot = Chatbot(None, feedback="vote", is_retrieval=True) - dashboard = Dashboard(QuestionAnswerDatabase()) + retriever = RetrievalQA(retrieval_model=retrieval_model, vector_db=vector_db, feedback="rag") + chatbot = Chatbot(None, feedback="rag", is_retrieval=True) + dashboard = Dashboard(RAGDatabase(), feedback="rag") ############################################################ # Starting the application and retrieval qa as a component # diff --git a/pykoi/__init__.py b/pykoi/__init__.py index 86c1474..827a46b 100644 --- a/pykoi/__init__.py +++ b/pykoi/__init__.py @@ -1,4 +1,3 @@ from pykoi.application import Application - -__version__ = "0.0.6" +__version__ = "0.0.7" diff --git a/pykoi/application.py b/pykoi/application.py index 50d2850..0bdbf1a 100644 --- a/pykoi/application.py +++ b/pykoi/application.py @@ -20,6 +20,7 @@ from pykoi.interactives.chatbot import Chatbot from pykoi.telemetry.telemetry import Telemetry from pykoi.telemetry.events import AppStartEvent, AppStopEvent +from pykoi.chat.db.constants import QA_LIST_SEPARATOR oauth_scheme = HTTPBasic() @@ -29,6 +30,17 @@ class UpdateQATable(BaseModel): id: int vote_status: str +class UpdateRAGTable(BaseModel): + id: int + vote_status: str + +class UpdateQATableAnswer(BaseModel): + id: int + new_answer: str + +class UpdateRAGTableAnswer(BaseModel): + id: int + new_answer: str class RankingTableUpdate(BaseModel): question: str @@ -212,6 +224,7 @@ async def update_qa_table( user: Union[None, UserInDB] = Depends(self.get_auth_dependency()), ): try: + print("updating QA vote") component["component"].database.update_vote_status( request_body.id, request_body.vote_status ) @@ -219,6 +232,20 @@ async def update_qa_table( except Exception as ex: return {"log": f"Table update failed: {ex}", "status": "500"} + @app.post("/chat/qa_table/update_answer") + async def update_qa_table_response( + request_body: UpdateQATableAnswer, + user: Union[None, UserInDB] = Depends(self.get_auth_dependency()), + ): + try: + component["component"].database.update_answer( + request_body.id, request_body.new_answer + ) + print("/chat/qa_table/update_answer", request_body.id, request_body.new_answer) + return {"log": "Table response updated", "new_answer": request_body.new_answer, "status": "200"} + except Exception as ex: + return {"log": f"Table update failed: {ex}", "status": "500"} + @app.get("/chat/qa_table/close") async def close_qa_table( user: Union[None, UserInDB] = Depends(self.get_auth_dependency()) @@ -274,6 +301,51 @@ async def retrieve_ranking_table( except Exception as ex: return {"log": f"Table retrieval failed: {ex}", "status": "500"} + @app.post("/chat/rag_table/update") + async def update_rag_table( + request_body: UpdateRAGTable, + user: Union[None, UserInDB] = Depends(self.get_auth_dependency()), + ): + try: + print("updating RAG vote") + component["component"].database.update_vote_status( + request_body.id, request_body.vote_status + ) + return {"log": "Table updated", "status": "200"} + except Exception as ex: + return {"log": f"Table update failed: {ex}", "status": "500"} + + @app.post("/chat/rag_table/update_answer") + async def update_rag_table_response( + request_body: UpdateRAGTableAnswer, + user: Union[None, UserInDB] = Depends(self.get_auth_dependency()), + ): + try: + component["component"].database.update_answer( + request_body.id, request_body.new_answer + ) + print("/chat/rag_table/update_answer", request_body.id, request_body.new_answer) + return {"log": "Table response updated", "new_answer": request_body.new_answer, "status": "200"} + except Exception as ex: + return {"log": f"Table update failed: {ex}", "status": "500"} + + @app.get("/chat/rag_table/retrieve") + async def retrieve_rag_table( + user: Union[None, UserInDB] = Depends(self.get_auth_dependency()) + ): + try: + rows = component["component"].database.retrieve_all_question_answers() + modified_rows = [] + for row in rows: + row_list = list(row) # Convert the tuple to a list + row_list[5] = row_list[5].split(QA_LIST_SEPARATOR) + row_list[6] = row_list[6].split(QA_LIST_SEPARATOR) + row_list[7] = row_list[7].split(QA_LIST_SEPARATOR) + modified_rows.append(row_list) # Append the modified list to the new list + return {"rows": modified_rows, "log": "RAG Table retrieved", "status": "200"} + except Exception as ex: + return {"log": f"Table retrieval failed: {ex}", "status": "500"} + def create_feedback_route(self, app: FastAPI, component: Dict[str, Any]): """ Create feedback routes for the application. @@ -491,28 +563,20 @@ async def inference( try: print("[/retrieval]: model inference.....", request_body.prompt) component["component"].retrieval_model.re_init(request_body.file_names) - output = component[ - "component" - ].retrieval_model.run_with_return_source_documents( - {"query": request_body.prompt} - ) - id = component["component"].database.insert_question_answer( - request_body.prompt, output["result"] - ) - print("output", output, output["result"]) + output = component["component"].retrieval_model.run_with_return_source_documents({"query": request_body.prompt}) + print('output', output, output["result"]) if output["source_documents"] == []: - source = "N/A" - source_content = "N/A" + source = ["N/A"] + source_content = ["N/A"] else: - source = output["source_documents"][0].metadata.get( - "file_name", "No file name found" - ) - source_content = ( - "1. " - + output["source_documents"][0].page_content - + "\n2. " - + output["source_documents"][1].page_content - ) + source = [] + source_content = [] + for source_document in output["source_documents"]: + source.append(source_document.metadata.get('file_name', 'No file name found')) + source_content.append(source_document.page_content) + id = component["component"].database.insert_question_answer( + request_body.prompt, output["result"], request_body.file_names, source, source_content + ) return { "id": id, "log": "Inference complete", diff --git a/pykoi/chat/__init__.py b/pykoi/chat/__init__.py index cfdb23d..efbeb29 100644 --- a/pykoi/chat/__init__.py +++ b/pykoi/chat/__init__.py @@ -3,3 +3,4 @@ from pykoi.chat.llm.model_factory import ModelFactory from pykoi.chat.db.qa_database import QuestionAnswerDatabase from pykoi.chat.db.ranking_database import RankingDatabase +from pykoi.chat.db.rag_database import RAGDatabase \ No newline at end of file diff --git a/pykoi/chat/db/constants.py b/pykoi/chat/db/constants.py index 2c4e94d..432109e 100644 --- a/pykoi/chat/db/constants.py +++ b/pykoi/chat/db/constants.py @@ -25,3 +25,6 @@ RANKING_CSV_HEADER_UP_RANKING_ANSWER, RANKING_CSV_HEADER_LOW_RANKING_ANSWER, ) + +# list separator +QA_LIST_SEPARATOR = "||" \ No newline at end of file diff --git a/pykoi/chat/db/rag_database.py b/pykoi/chat/db/rag_database.py new file mode 100644 index 0000000..52a82c7 --- /dev/null +++ b/pykoi/chat/db/rag_database.py @@ -0,0 +1,244 @@ +"""Question answer database module""" +import csv +import datetime +import os +import sqlite3 +import threading + +import pandas as pd + +from pykoi.chat.db.constants import QA_CSV_HEADER, QA_LIST_SEPARATOR + + +class RAGDatabase: + """RAG Question Answer Database class""" + + def __init__( + self, + db_file: str = os.path.join(os.getcwd(), "rag.db"), + debug: bool = False, + ): + """ + Initializes a new instance of the RAGDatabase class. + + Args: + db_file (str): The path to the SQLite database file. + debug (bool, optional): Whether to print debug messages. Defaults to False. + """ + self._db_file = db_file + self._debug = debug + self._local = threading.local() # Thread-local storage + self._lock = threading.Lock() # Lock for concurrent write operations + self.create_table() + + def get_connection(self): + """Returns the thread-local database connection""" + if not hasattr(self._local, "connection"): + self._local.connection = sqlite3.connect(self._db_file) + return self._local.connection + + def get_cursor(self): + """Returns the thread-local database cursor""" + if not hasattr(self._local, "cursor"): + self._local.cursor = self.get_connection().cursor() + return self._local.cursor + + def create_table(self): + """ + Creates the question_answer table if it does not already exist in the database. + The table has 6 columns: id (primary key), question, answer, source, source_content, and vote_status. + vote_status is a text field that can only have the values 'up', 'down', or 'n/a'. + """ + query = """ + CREATE TABLE IF NOT EXISTS rag_question_answer ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + question TEXT, + answer TEXT, + edited_answer TEXT, + vote_status TEXT CHECK (vote_status IN ('up', 'down', 'n/a')), + rag_sources TEXT, + source TEXT, + source_content TEXT, + timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP + ); + """ + with self._lock: + cursor = self.get_cursor() + cursor.execute(query) + self.get_connection().commit() + + if self._debug: + rows = self.retrieve_all_question_answers() + print("Table contents after creating table:") + self.print_table(rows) + + def insert_question_answer(self, question: str, answer: str, rag_sources: list, source: list, source_content: list): + """ + Inserts a new question-answer pair into the database with the given question and answer. + The vote_status field is set to 'n/a' by default. + Returns the ID of the newly inserted row. + + Args: + question (str): The question to insert. + answer (str): The answer to insert. + rag_sources (list): The RAG sources of the question-answer pair. + source (list): The source(s) of the question-answer pair. + source_content (list): The source content(s) of the question-answer pair. + + Returns: + int: The ID of the newly inserted row. + """ + timestamp = datetime.datetime.now() + query = """ + INSERT INTO rag_question_answer (question, answer, edited_answer, rag_sources, source, source_content, vote_status, timestamp) + VALUES (?, ?, '', ?, ?, ?, 'n/a', ?); + """ + rag_sources = QA_LIST_SEPARATOR.join(rag_sources) + source = QA_LIST_SEPARATOR.join(source) + source_content = QA_LIST_SEPARATOR.join(source_content) + print("rag insert question answer", rag_sources) + + with self._lock: + cursor = self.get_cursor() + cursor.execute(query, (question, answer, rag_sources, source, source_content, timestamp)) + self.get_connection().commit() + + if self._debug: + rows = self.retrieve_all_question_answers() + print("Table contents after inserting table:") + self.print_table(rows) + + return cursor.lastrowid + + def update_vote_status(self, id, vote_status): + """ + Updates the vote status of a question-answer pair with the given ID. + + Args: + id (int): The ID of the question-answer pair to update. + vote_status (str): The new vote status to set. Must be one of 'up', 'down', or 'n/a'. + + Raises: + ValueError: If the question with the given ID does not exist. + """ + query = """ + UPDATE rag_question_answer + SET vote_status = ? + WHERE id = ?; + """ + with self._lock: + cursor = self.get_cursor() + cursor.execute(query, (vote_status, id)) + self.get_connection().commit() + + if cursor.rowcount == 0: + raise ValueError(f"Question with ID {id} does not exist.") + + if self._debug: + rows = self.retrieve_all_question_answers() + print("Table contents after updating table:") + self.print_table(rows) + + def update_answer(self, id, new_answer): + """ + Updates the edited_answer of a question-answer pair with the given ID. + + Args: + id (int): The ID of the question-answer pair to update. + new_answer (str): The new modified response to set. + + Raises: + ValueError: If the question with the given ID does not exist. + """ + query = """ + UPDATE rag_question_answer + SET edited_answer = ? + WHERE id = ?; + """ + print('update_answer',new_answer) + with self._lock: + cursor = self.get_cursor() + cursor.execute(query, (new_answer, id)) + self.get_connection().commit() + + if cursor.rowcount == 0: + raise ValueError(f"Question with ID {id} does not exist.") + + if self._debug: + rows = self.retrieve_all_question_answers() + print("Table contents after updating table:") + self.print_table(rows) + + def retrieve_all_question_answers(self): + """ + Retrieves all question-answer pairs from the database. + + Returns: + list: A list of tuples representing the question-answer pairs. + """ + query = """ + SELECT * FROM rag_question_answer; + """ + with self._lock: + cursor = self.get_cursor() + cursor.execute(query) + rows = cursor.fetchall() + return rows + + def retrieve_all_question_answers_as_pandas(self): + """ + Retrieves all question-answer pairs from the database as a pandas dataframe. + + Returns: + DataFrame: A pandas dataframe. + """ + rows = self.retrieve_all_question_answers() + rows_to_pd = pd.DataFrame(rows) + rows_to_pd.columns = QA_CSV_HEADER + return rows_to_pd + + def close_connection(self): + """ + Closes the connection to the database. + """ + if hasattr(self._local, "cursor"): + self._local.cursor.close() + del self._local.cursor + if hasattr(self._local, "connection"): + self._local.connection.close() + del self._local.connection + + def print_table(self, rows): + """ + Prints the contents of the table in a formatted manner. + + Args: + rows (list): A list of tuples where each tuple represents a row in the table. + Each tuple contains five elements: ID, Question, Answer, Timestamp, and Vote Status. + """ + for row in rows: + print( + f"ID: {row[0]}, Question: {row[1]}, " + f"Answer: {row[2]}, Vote Status: {row[3]}, Timestamp: {row[4]}" + ) + + def save_to_csv(self, csv_file_name="question_answer_votes.csv"): + """ + This method saves the contents of the question_answer table into a CSV file. + + Args: + csv_file_name (str, optional): The name of the CSV file to which the data will be written. + Defaults to "question_answer_votes.csv". + + The CSV file will have the following columns: ID, Question, Answer, Vote Status. Each row in the + CSV file corresponds to a row in the question_answer table. + + This method first retrieves all question-answer pairs from the database by calling the + retrieve_all_question_answers method. It then writes this data to the CSV file. + """ + my_sql_data = self.retrieve_all_question_answers() + + with open(csv_file_name, "w", newline="") as file: + writer = csv.writer(file) + writer.writerow(QA_CSV_HEADER) + writer.writerows(my_sql_data) diff --git a/pykoi/component/base.py b/pykoi/component/base.py index 6f6e15e..44960f3 100644 --- a/pykoi/component/base.py +++ b/pykoi/component/base.py @@ -5,6 +5,7 @@ from pykoi.component.chatbot_database_factory import ChatbotDatabaseFactory from pykoi.component.constants import FeedbackType from pykoi.chat.db.qa_database import QuestionAnswerDatabase +from pykoi.chat.db.rag_database import RAGDatabase from pykoi.chat.db.ranking_database import RankingDatabase from pykoi.chat.llm.abs_llm import AbsLlm @@ -129,7 +130,7 @@ class Dashboard(Component): database (str): The database to use for the dashboard. """ - def __init__(self, database: QuestionAnswerDatabase, **kwargs): + def __init__(self, database: any, **kwargs): """ Initialize a new instance of Dashboard. diff --git a/pykoi/component/chatbot_database_factory.py b/pykoi/component/chatbot_database_factory.py index 0c158e3..d774ba8 100644 --- a/pykoi/component/chatbot_database_factory.py +++ b/pykoi/component/chatbot_database_factory.py @@ -4,6 +4,7 @@ from pykoi.component.constants import FeedbackType from pykoi.chat.db.qa_database import QuestionAnswerDatabase from pykoi.chat.db.ranking_database import RankingDatabase +from pykoi.chat.db.rag_database import RAGDatabase class ChatbotDatabaseFactory: @@ -20,13 +21,15 @@ def create(feedback: Union[str, FeedbackType]): feedback (Union[str, FeedbackType]): The type of the chatbot. Returns: - Union[QuestionAnswerDatabase, RankingDatabase]: The created database. + Union[QuestionAnswerDatabase, RankingDatabase, RAGDatabase]: The created database. """ feedback = FeedbackType(feedback) if feedback == FeedbackType.VOTE: return QuestionAnswerDatabase() elif feedback == FeedbackType.RANK: return RankingDatabase() + elif feedback == FeedbackType.RAG: + return RAGDatabase() else: raise ValueError( f"Invalid feedback name: {feedback}. " diff --git a/pykoi/component/constants.py b/pykoi/component/constants.py index 5d78872..f1f30ee 100644 --- a/pykoi/component/constants.py +++ b/pykoi/component/constants.py @@ -7,3 +7,4 @@ class FeedbackType(Enum): VOTE = "vote" RANK = "rank" + RAG = "rag" diff --git a/pykoi/frontend/dist/assets/index-47e316ee.js b/pykoi/frontend/dist/assets/index-47e316ee.js deleted file mode 100644 index 84a03c6..0000000 --- a/pykoi/frontend/dist/assets/index-47e316ee.js +++ /dev/null @@ -1,65 +0,0 @@ -(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const l of o.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).observe(document,{childList:!0,subtree:!0});function n(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 r(i){if(i.ep)return;i.ep=!0;const o=n(i);fetch(i.href,o)}})();function X(){}const Hl=e=>e;function Lr(e,t){for(const n in t)e[n]=t[n];return e}function Ll(e){return e()}function qr(){return Object.create(null)}function we(e){e.forEach(Ll)}function ot(e){return typeof e=="function"}function de(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}function Zs(e){return Object.keys(e).length===0}function fr(e,...t){if(e==null)return X;const n=e.subscribe(...t);return n.unsubscribe?()=>n.unsubscribe():n}function ea(e){let t;return fr(e,n=>t=n)(),t}function ie(e,t,n){e.$$.on_destroy.push(fr(t,n))}function Ue(e,t,n){return e.set(n),t}function qn(e){return e&&ot(e.destroy)?e.destroy:X}const ql=typeof window<"u";let Gl=ql?()=>window.performance.now():()=>Date.now(),gi=ql?e=>requestAnimationFrame(e):X;const Ot=new Set;function Bl(e){Ot.forEach(t=>{t.c(e)||(Ot.delete(t),t.f())}),Ot.size!==0&&gi(Bl)}function jl(e){let t;return Ot.size===0&&gi(Bl),{promise:new Promise(n=>{Ot.add(t={c:e,f:n})}),abort(){Ot.delete(t)}}}let cr=!1;function ta(){cr=!0}function na(){cr=!1}function ra(e,t,n,r){for(;e>1);n(i)<=r?e=i+1:t=i}return e}function ia(e){if(e.hydrate_init)return;e.hydrate_init=!0;let t=e.childNodes;if(e.nodeName==="HEAD"){const a=[];for(let u=0;u0&&t[n[i]].claim_order<=u?i+1:ra(1,i,g=>t[n[g]].claim_order,u))-1;r[a]=n[f]+1;const c=f+1;n[c]=a,i=Math.max(c,i)}const o=[],l=[];let s=t.length-1;for(let a=n[i]+1;a!=0;a=r[a-1]){for(o.push(t[a-1]);s>=a;s--)l.push(t[s]);s--}for(;s>=0;s--)l.push(t[s]);o.reverse(),l.sort((a,u)=>a.claim_order-u.claim_order);for(let a=0,u=0;a=o[u].claim_order;)u++;const f=ue.removeEventListener(t,n,r)}function h(e,t,n){n==null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function ua(e){return Array.from(e.childNodes)}function fa(e){e.claim_info===void 0&&(e.claim_info={last_index:0,total_claimed:0})}function ca(e,t,n,r,i=!1){fa(e);const o=(()=>{for(let l=e.claim_info.last_index;l=0;l--){const s=e[l];if(t(s)){const a=n(s);return a===void 0?e.splice(l,1):e[l]=a,i?a===void 0&&e.claim_info.last_index--:e.claim_info.last_index=l,s}}return r()})();return o.claim_order=e.claim_info.total_claimed,e.claim_info.total_claimed+=1,o}function da(e,t){return ca(e,n=>n.nodeType===3,n=>{const r=""+t;if(n.data.startsWith(r)){if(n.data.length!==r.length)return n.splitText(r.length)}else n.data=r},()=>z(t),!0)}function J(e,t){t=""+t,e.data!==t&&(e.data=t)}function Lt(e,t){e.value=t??""}function Ee(e,t,n,r){n==null?e.style.removeProperty(t):e.style.setProperty(t,n,r?"important":"")}function Gn(e,t,n){for(let r=0;r{l.source===r.contentWindow&&t()})):(r.src="about:blank",r.onload=()=>{o=K(r.contentWindow,"resize",t),t()}),w(e,r),()=>{(i||o&&r.contentWindow)&&o(),N(r)}}function en(e,t,n){e.classList[n?"add":"remove"](t)}function ha(e,t,{bubbles:n=!1,cancelable:r=!1}={}){const i=document.createEvent("CustomEvent");return i.initCustomEvent(e,n,r,t),i}function qt(e,t){return new e(t)}const Bn=new Map;let jn=0;function pa(e){let t=5381,n=e.length;for(;n--;)t=(t<<5)-t^e.charCodeAt(n);return t>>>0}function ma(e,t){const n={stylesheet:oa(t),rules:{}};return Bn.set(e,n),n}function Di(e,t,n,r,i,o,l,s=0){const a=16.666/r;let u=`{ -`;for(let _=0;_<=1;_+=a){const b=t+(n-t)*o(_);u+=_*100+`%{${l(b,1-b)}} -`}const f=u+`100% {${l(n,1-n)}} -}`,c=`__svelte_${pa(f)}_${s}`,g=Ul(e),{stylesheet:d,rules:p}=Bn.get(g)||ma(g,e);p[c]||(p[c]=!0,d.insertRule(`@keyframes ${c} ${f}`,d.cssRules.length));const m=e.style.animation||"";return e.style.animation=`${m?`${m}, `:""}${c} ${r}ms linear ${i}ms 1 both`,jn+=1,c}function _a(e,t){const n=(e.style.animation||"").split(", "),r=n.filter(t?o=>o.indexOf(t)<0:o=>o.indexOf("__svelte")===-1),i=n.length-r.length;i&&(e.style.animation=r.join(", "),jn-=i,jn||va())}function va(){gi(()=>{jn||(Bn.forEach(e=>{const{ownerNode:t}=e.stylesheet;t&&N(t)}),Bn.clear())})}let Gt;function yt(e){Gt=e}function wa(){if(!Gt)throw new Error("Function called outside component initialization");return Gt}function Xt(e){wa().$$.on_mount.push(e)}const Dt=[],Un=[];let Tt=[];const xi=[],ba=Promise.resolve();let Gr=!1;function ya(){Gr||(Gr=!0,ba.then(Xl))}function Re(e){Tt.push(e)}const _r=new Set;let Et=0;function Xl(){if(Et!==0)return;const e=Gt;do{try{for(;Ete.indexOf(r)===-1?t.push(r):n.push(r)),n.forEach(r=>r()),Tt=t}let Qt;function ka(){return Qt||(Qt=Promise.resolve(),Qt.then(()=>{Qt=null})),Qt}function vr(e,t,n){e.dispatchEvent(ha(`${t?"intro":"outro"}${n}`))}const Nn=new Set;let rt;function ke(){rt={r:0,c:[],p:rt}}function $e(){rt.r||we(rt.c),rt=rt.p}function T(e,t){e&&e.i&&(Nn.delete(e),e.i(t))}function L(e,t,n,r){if(e&&e.o){if(Nn.has(e))return;Nn.add(e),rt.c.push(()=>{Nn.delete(e),r&&(n&&e.d(1),r())}),e.o(t)}else r&&r()}const $a={duration:0};function dt(e,t,n,r){const i={direction:"both"};let o=t(e,n,i),l=r?0:1,s=null,a=null,u=null;function f(){u&&_a(e,u)}function c(d,p){const m=d.b-l;return p*=Math.abs(m),{a:l,b:d.b,d:m,duration:p,start:d.start,end:d.start+p,group:d.group}}function g(d){const{delay:p=0,duration:m=300,easing:_=Hl,tick:b=X,css:v}=o||$a,$={start:Gl()+p,b:d};d||($.group=rt,rt.r+=1),s||a?a=$:(v&&(f(),u=Di(e,l,d,m,p,_,v)),d&&b(0,1),s=c($,m),Re(()=>vr(e,d,"start")),jl(A=>{if(a&&A>a.start&&(s=c(a,m),a=null,vr(e,s.b,"start"),v&&(f(),u=Di(e,l,s.b,s.duration,0,_,o.css))),s){if(A>=s.end)b(l=s.b,1-l),vr(e,s.b,"end"),a||(s.b?f():--s.group.r||we(s.group.c)),s=null;else if(A>=s.start){const k=A-s.start;l=s.a+s.d*_(k/s.duration),b(l,1-l)}}return!!(s||a)}))}return{run(d){ot(o)?ka().then(()=>{o=o(i),g(d)}):g(d)},end(){f(),s=a=null}}}function hi(e,t){e.d(1),t.delete(e.key)}function Yl(e,t){L(e,1,1,()=>{t.delete(e.key)})}function _n(e,t,n,r,i,o,l,s,a,u,f,c){let g=e.length,d=o.length,p=g;const m={};for(;p--;)m[e[p].key]=p;const _=[],b=new Map,v=new Map,$=[];for(p=d;p--;){const y=c(i,o,p),C=n(y);let S=l.get(C);S?r&&$.push(()=>S.p(y,t)):(S=u(C,y),S.c()),b.set(C,_[p]=S),C in m&&v.set(C,Math.abs(p-m[C]))}const A=new Set,k=new Set;function E(y){T(y,1),y.m(s,f),l.set(y.key,y),f=y.first,d--}for(;g&&d;){const y=_[d-1],C=e[g-1],S=y.key,M=C.key;y===C?(f=y.first,g--,d--):b.has(M)?!l.has(S)||A.has(S)?E(y):k.has(M)?g--:v.get(S)>v.get(M)?(k.add(S),E(y)):(A.add(M),g--):(a(C,l),g--)}for(;g--;){const y=e[g];b.has(y.key)||a(y,l)}for(;d;)E(_[d-1]);return we($),_}function Ra(e,t){const n={},r={},i={$$scope:1};let o=e.length;for(;o--;){const l=e[o],s=t[o];if(s){for(const a in l)a in s||(r[a]=1);for(const a in s)i[a]||(n[a]=s[a],i[a]=1);e[o]=s}else for(const a in l)i[a]=1}for(const l in r)l in n||(n[l]=void 0);return n}function Aa(e){return typeof e=="object"&&e!==null?e:{}}const Ea=/[&"]/g,Ma=/[&<]/g;function Fa(e,t=!1){const n=String(e),r=t?Ea:Ma;r.lastIndex=0;let i="",o=0;for(;r.test(n);){const l=r.lastIndex-1,s=n[l];i+=n.substring(o,l)+(s==="&"?"&":s==='"'?""":"<"),o=l+1}return i+n.substring(o)}function Ia(e,t){if(!e||!e.$$render)throw t==="svelte:component"&&(t+=" this={...}"),new Error(`<${t}> is not a valid SSR component. You may need to review your build config to ensure that dependencies are compiled, rather than imported as pre-compiled modules. Otherwise you may need to fix a <${t}>.`);return e}let wr;function Ql(e){function t(n,r,i,o,l){const s=Gt,a={on_destroy:wr,context:new Map(l||(s?s.$$.context:[])),on_mount:[],before_update:[],after_update:[],callbacks:qr()};yt({$$:a});const u=e(n,r,i,o);return yt(s),u}return{render:(n={},{$$slots:r={},context:i=new Map}={})=>{wr=[];const o={title:"",head:"",css:new Set},l=t(o,n,{},r,i);return we(wr),{html:l,css:{code:Array.from(o.css).map(s=>s.code).join(` -`),map:null},head:o.title+o.head}},$$render:t}}function ce(e){e&&e.c()}function Da(e,t){e&&e.l(t)}function ae(e,t,n,r){const{fragment:i,after_update:o}=e.$$;i&&i.m(t,n),r||Re(()=>{const l=e.$$.on_mount.map(Ll).filter(ot);e.$$.on_destroy?e.$$.on_destroy.push(...l):we(l),e.$$.on_mount=[]}),o.forEach(Re)}function ue(e,t){const n=e.$$;n.fragment!==null&&(Ca(n.after_update),we(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function xa(e,t){e.$$.dirty[0]===-1&&(Dt.push(e),ya(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<{const p=d.length?d[0]:g;return u.ctx&&i(u.ctx[c],u.ctx[c]=p)&&(!u.skip_bound&&u.bound[c]&&u.bound[c](p),f&&xa(e,c)),g}):[],u.update(),f=!0,we(u.before_update),u.fragment=r?r(u.ctx):!1,t.target){if(t.hydrate){ta();const c=ua(t.target);u.fragment&&u.fragment.l(c),c.forEach(N)}else u.fragment&&u.fragment.c();t.intro&&T(e.$$.fragment),ae(e,t.target,t.anchor,t.customElement),na(),Xl()}yt(a)}class ge{$destroy(){ue(this,1),this.$destroy=X}$on(t,n){if(!ot(n))return X;const r=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return r.push(n),()=>{const i=r.indexOf(n);i!==-1&&r.splice(i,1)}}$set(t){this.$$set&&!Zs(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const Mt=[];function Br(e,t){return{subscribe:Me(e,t).subscribe}}function Me(e,t=X){let n;const r=new Set;function i(s){if(de(e,s)&&(e=s,n)){const a=!Mt.length;for(const u of r)u[1](),Mt.push(u,e);if(a){for(let u=0;u{r.delete(u),r.size===0&&n&&(n(),n=null)}}return{set:i,update:o,subscribe:l}}function Pa(e,t,n){const r=!Array.isArray(e),i=r?[e]:e,o=t.length<2;return Br(n,l=>{let s=!1;const a=[];let u=0,f=X;const c=()=>{if(u)return;f();const d=t(r?a[0]:a,l);o?l(d):f=ot(d)?d:X},g=i.map((d,p)=>fr(d,m=>{a[p]=m,u&=~(1<{u|=1<e;const n=typeof e;if(n!==typeof t||Array.isArray(e)!==Array.isArray(t))throw new Error("Cannot interpolate values of different type");if(Array.isArray(e)){const r=t.map((i,o)=>jr(e[o],i));return i=>r.map(o=>o(i))}if(n==="object"){if(!e||!t)throw new Error("Object cannot be null");if(Pi(e)&&Pi(t)){e=e.getTime(),t=t.getTime();const o=t-e;return l=>new Date(e+l*o)}const r=Object.keys(t),i={};return r.forEach(o=>{i[o]=jr(e[o],t[o])}),o=>{const l={};return r.forEach(s=>{l[s]=i[s](o)}),l}}if(n==="number"){const r=t-e;return i=>e+i*r}throw new Error(`Cannot interpolate ${n} values`)}function mi(e,t={}){const n=Me(e);let r,i=e;function o(l,s){if(e==null)return n.set(e=l),Promise.resolve();i=l;let a=r,u=!1,{delay:f=0,duration:c=400,easing:g=Hl,interpolate:d=jr}=Lr(Lr({},t),s);if(c===0)return a&&(a.abort(),a=null),n.set(e=i),Promise.resolve();const p=Gl()+f;let m;return r=jl(_=>{if(_c?(n.set(e=l),!1):(n.set(e=m(g(b/c))),!0)}),r.promise}return{set:o,update:(l,s)=>o(l(i,e),s),subscribe:n.subscribe}}const qe=Me([]),br=Me([]),yr=Me([]),et=Me("all"),Ni=Me({"n/a":1,up:1,down:1}),Na=["who","what","how","why","where","does","can","n/a"],Ur=mi(Na.map(e=>({question:e,count:0}))),Wr=Me(new Set);var Xr="http://www.w3.org/1999/xhtml";const Oi={svg:"http://www.w3.org/2000/svg",xhtml:Xr,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Kl(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Oi.hasOwnProperty(t)?{space:Oi[t],local:e}:e}function Oa(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Xr&&t.documentElement.namespaceURI===Xr?t.createElement(e):t.createElementNS(n,e)}}function Ta(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Jl(e){var t=Kl(e);return(t.local?Ta:Oa)(t)}function Va(){}function Zl(e){return e==null?Va:function(){return this.querySelector(e)}}function za(e){typeof e!="function"&&(e=Zl(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i=$&&($=v+1);!(k=_[$])&&++$=0;)(l=r[i])&&(o&&l.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(l,o),o=l);return this}function cu(e){e||(e=du);function t(c,g){return c&&g?e(c.__data__,g.__data__):!c-!g}for(var n=this._groups,r=n.length,i=new Array(r),o=0;ot?1:e>=t?0:NaN}function gu(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function hu(){return Array.from(this)}function pu(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?Ru:typeof t=="function"?Eu:Au)(e,t,n??"")):Fu(this.node(),e)}function Fu(e,t){return e.style.getPropertyValue(t)||rs(e).getComputedStyle(e,null).getPropertyValue(t)}function Iu(e){return function(){delete this[e]}}function Du(e,t){return function(){this[e]=t}}function xu(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function Pu(e,t){return arguments.length>1?this.each((t==null?Iu:typeof t=="function"?xu:Du)(e,t)):this.node()[e]}function is(e){return e.trim().split(/^|\s+/)}function _i(e){return e.classList||new os(e)}function os(e){this._node=e,this._names=is(e.getAttribute("class")||"")}os.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function ls(e,t){for(var n=_i(e),r=-1,i=t.length;++r=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function uf(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,o;n`${b[0].toUpperCase()}${b.slice(1)}`),c=parseFloat(o[`padding${f[0]}`]),g=parseFloat(o[`padding${f[1]}`]),d=parseFloat(o[`margin${f[0]}`]),p=parseFloat(o[`margin${f[1]}`]),m=parseFloat(o[`border${f[0]}Width`]),_=parseFloat(o[`border${f[1]}Width`]);return{delay:t,duration:n,easing:r,css:b=>`overflow: hidden;opacity: ${Math.min(b*20,1)*l};${s}: ${b*a}px;padding-${u[0]}: ${b*c}px;padding-${u[1]}: ${b*g}px;margin-${u[0]}: ${b*d}px;margin-${u[1]}: ${b*p}px;border-${u[0]}-width: ${b*m}px;border-${u[1]}-width: ${b*_}px;`}}function Cn(e,{delay:t=0,duration:n=400,easing:r=pi,start:i=0,opacity:o=0}={}){const l=getComputedStyle(e),s=+l.opacity,a=l.transform==="none"?"":l.transform,u=1-i,f=s*(1-o);return{delay:t,duration:n,easing:r,css:(c,g)=>` - transform: ${a} scale(${1-u*g}); - opacity: ${s-f*g} - `}}function Ti(e,t,n){const r=e.slice();return r[8]=t[n],r[10]=n,r}function Vi(e){let t,n,r,i,o=e[8].name+"",l,s,a,u,f;function c(...g){return e[6](e[8],...g)}return{c(){t=R("label"),n=R("input"),l=z(o),s=P(),h(n,"type","checkbox"),h(n,"id",r=e[8].id),n.checked=i=e[1].has(e[8].name),h(t,"for",a=e[8].id)},m(g,d){V(g,t,d),w(t,n),w(t,l),w(t,s),u||(f=K(n,"change",c),u=!0)},p(g,d){e=g,d&1&&r!==(r=e[8].id)&&h(n,"id",r),d&3&&i!==(i=e[1].has(e[8].name))&&(n.checked=i),d&1&&o!==(o=e[8].name+"")&&J(l,o),d&1&&a!==(a=e[8].id)&&h(t,"for",a)},d(g){g&&N(t),u=!1,f()}}}function _f(e){let t,n,r,i,o,l,s,a,u,f,c,g=e[0],d=[];for(let p=0;pn(1,r=c));let{documents:i=[]}=t,o=!1,l;function s(){n(2,o=!o)}function a(c,g){g.target.checked?r.add(c):r.delete(c),Wr.set(new Set(r))}const u=(c,g)=>a(c.name,g);function f(c){Un[c?"unshift":"push"](()=>{l=c,n(3,l)})}return e.$$set=c=>{"documents"in c&&n(0,i=c.documents)},e.$$.update=()=>{e.$$.dirty&2&&console.log(r)},[i,r,o,l,s,a,u,f]}let wf=class extends ge{constructor(t){super(),me(this,t,vf,_f,de,{documents:0})}};function Qr(e,t=2){if(e===0)return"0 Bytes";const n=1024,r=t<0?0:t,i=["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"],o=Math.floor(Math.log(e)/Math.log(n));return parseFloat((e/Math.pow(n,o)).toFixed(r))+" "+i[o]}function bf(e){let t={who:0,what:0,how:0,why:0,where:0,does:0,can:0,"n/a":0};for(let r=0;r({question:r,count:t[r]}))}function fs(e){return e.map(t=>{const n=t.question.split(" ").length,r=t.answer.split(" ").length;return{index:t.index,question:+n,answer:+r,vote:t.vote}})}function yf(e,t){e.classList.add("tooltip"),e.setAttribute("tabindex",0);function n(){const i=document.createElement("span");i.textContent=t,i.setAttribute("id","tooltip"),e.appendChild(i),e.addEventListener("mouseleave",r),e.addEventListener("blur",r),e.removeEventListener("mouseenter",n),e.removeEventListener("focus",n)}function r(){e.removeChild(e.querySelector("#tooltip")),e.removeEventListener("mouseleave",r),e.removeEventListener("blur",r),e.addEventListener("mouseenter",n),e.addEventListener("focus",n)}return e.addEventListener("mouseenter",n),e.addEventListener("focus",n),{onDestroy(){e.classList.remove("tooltip"),e.removeEventListener("mouseenter",n),e.removeEventListener("focus",n)}}}function zi(e,t,n){const r=e.slice();return r[21]=t[n],r[23]=n,r}function Hi(e){let t,n,r,i,o,l;function s(...u){return e[12](e[23],...u)}function a(...u){return e[13](e[23],...u)}return{c(){t=R("div"),n=R("button"),n.textContent="👍",r=P(),i=R("button"),i.textContent="👎",h(n,"class","small-button thumbs-up svelte-1uetn8d"),h(i,"class","small-button thumbs-down svelte-1uetn8d"),h(t,"class","feedback-buttons svelte-1uetn8d")},m(u,f){V(u,t,f),w(t,n),w(t,r),w(t,i),o||(l=[K(n,"click",s),K(i,"click",a)],o=!0)},p(u,f){e=u},d(u){u&&N(t),o=!1,we(l)}}}function Sf(e){let t;return{c(){t=R("p"),t.textContent="⌄"},m(n,r){V(n,t,r)},d(n){n&&N(t)}}}function Cf(e){let t;return{c(){t=R("p"),t.textContent="⌃"},m(n,r){V(n,t,r)},d(n){n&&N(t)}}}function Li(e){let t,n,r=e[21].source_content+"",i,o,l;return{c(){t=R("div"),n=R("p"),i=z(r),h(n,"class","bold svelte-1uetn8d"),h(t,"class","source_content svelte-1uetn8d")},m(s,a){V(s,t,a),w(t,n),w(n,i),l=!0},p(s,a){(!l||a&32)&&r!==(r=s[21].source_content+"")&&J(i,r)},i(s){l||(Re(()=>{l&&(o||(o=dt(t,Yr,{},!0)),o.run(1))}),l=!0)},o(s){o||(o=dt(t,Yr,{},!1)),o.run(0),l=!1},d(s){s&&N(t),s&&o&&o.end()}}}function qi(e,t){let n,r,i,o,l,s,a,u,f,c=t[21].question+"",g,d,p,m,_,b,v,$,A,k,E,y=t[21].answer+"",C,S,M,F,I,D,j,le=t[21].source+"",Z,be,ye,he,te,pe,ut,Ye,Q=t[0]&&Hi(t);function yn(Y,H){return Y[3][Y[23]]?Cf:Sf}let He=yn(t),ne=He(t);function mr(){return t[14](t[23])}let O=t[3][t[23]]&&Li(t);return{key:e,first:null,c(){n=R("div"),r=R("div"),i=R("div"),o=P(),l=R("div"),s=R("div"),a=R("h5"),a.textContent="Question:",u=P(),f=R("p"),g=z(c),d=P(),p=R("div"),m=R("p"),m.textContent="ℹī¸ Retrieval Sources",b=P(),v=R("div"),$=R("div"),A=R("h5"),A.textContent="Response:",k=P(),E=R("p"),C=z(y),S=P(),Q&&Q.c(),M=P(),F=R("div"),I=R("div"),D=R("p"),j=z("📖 Source: "),Z=z(le),be=P(),ne.c(),ye=P(),O&&O.c(),he=P(),h(i,"class","avatar"),h(a,"class","bold svelte-1uetn8d"),h(m,"class","bold svelte-1uetn8d"),h(p,"class","rag-sources svelte-1uetn8d"),h(s,"class","question svelte-1uetn8d"),h(A,"class","bold svelte-1uetn8d"),h($,"class","answer svelte-1uetn8d"),h(D,"class","bold svelte-1uetn8d"),h(I,"class","source_tab svelte-1uetn8d"),h(F,"class","source svelte-1uetn8d"),h(v,"class","answers svelte-1uetn8d"),h(l,"class","message-content svelte-1uetn8d"),h(r,"class","chat-message-center svelte-1uetn8d"),h(n,"class","chat-message svelte-1uetn8d"),this.first=n},m(Y,H){V(Y,n,H),w(n,r),w(r,i),w(r,o),w(r,l),w(l,s),w(s,a),w(s,u),w(s,f),w(f,g),w(s,d),w(s,p),w(p,m),w(l,b),w(l,v),w(v,$),w($,A),w($,k),w($,E),w(E,C),w($,S),Q&&Q.m($,null),w(v,M),w(v,F),w(F,I),w(I,D),w(D,j),w(D,Z),w(I,be),ne.m(I,null),w(F,ye),O&&O.m(F,null),w(n,he),pe=!0,ut||(Ye=[qn(_=yf.call(null,m,Gi(t[21]))),K(I,"click",mr),qn(te=$f.call(null,n,t[23]===t[5].length-1))],ut=!0)},p(Y,H){t=Y,(!pe||H&32)&&c!==(c=t[21].question+"")&&J(g,c),_&&ot(_.update)&&H&32&&_.update.call(null,Gi(t[21])),(!pe||H&32)&&y!==(y=t[21].answer+"")&&J(C,y),t[0]?Q?Q.p(t,H):(Q=Hi(t),Q.c(),Q.m($,null)):Q&&(Q.d(1),Q=null),(!pe||H&32)&&le!==(le=t[21].source+"")&&J(Z,le),He!==(He=yn(t))&&(ne.d(1),ne=He(t),ne&&(ne.c(),ne.m(I,null))),t[3][t[23]]?O?(O.p(t,H),H&40&&T(O,1)):(O=Li(t),O.c(),T(O,1),O.m(F,null)):O&&(ke(),L(O,1,1,()=>{O=null}),$e()),te&&ot(te.update)&&H&32&&te.update.call(null,t[23]===t[5].length-1)},i(Y){pe||(T(O),pe=!0)},o(Y){L(O),pe=!1},d(Y){Y&&N(n),Q&&Q.d(),ne.d(),O&&O.d(),ut=!1,we(Ye)}}}function kf(e){let t,n,r,i,o,l,s=[],a=new Map,u,f,c,g,d,p,m,_,b,v=(e[2]?e[4]:"Send")+"",$,A,k,E,y,C,S,M=e[5];const F=I=>I[23];for(let I=0;IVote Feedback Instructions -

Ask a question to receive an answer from the chatbot. If the response is - satisfactory, click on the 👍 - button. If the repsonse is not satisfactory, click on the - 👎 button.

`,r=P(),i=R("div"),o=R("section"),l=R("div");for(let I=0;I{e.scrollIntoView({behavior:"smooth"})},0)}async function Rf(e){const t=await fetch("/chat/qa_table/update",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(t.ok)console.log("response",t);else{const n=await t.text();alert(n)}}function Gi(e){return e.rag_sources.length===0?"No Sources":e.rag_sources.join(", ")}function Af(e,t,n){let r,i,o,l;ie(e,qe,y=>n(5,i=y)),ie(e,Wr,y=>n(17,o=y));let{feedback:s=!1}=t,{is_retrieval:a=!1}=t;const u=Me([]);ie(e,u,y=>n(6,l=y));let f="",c="",g=!1,d=[];Xt(()=>{m(),p()});async function p(){const C=await(await fetch("/retrieval/file/get")).json();console.log("data",C.files);const M=C.files.map((F,I)=>({id:String(I),name:F.name}));console.log("files",M),Ue(u,l=[...M],l)}async function m(){const M=(await(await fetch("/chat/qa_table/retrieve")).json()).rows.map(F=>({id:F[0],question:F[1],answer:F[2],vote_status:F[3],rag_sources:["doc1.pdf","doc2.pdf","doc3.pdf"]}));n(3,d=new Array(M.length).fill(!1)),Ue(qe,i=[...M],i)}const _=async y=>{y.preventDefault(),f=c,n(1,c=""),n(2,g=!0);const C=[...o];let S={id:i.length+1,question:f,answer:"Loading...",rag_sources:C,vote_status:"na",source:"Loading...",source_content:"Loading..."};Ue(qe,i=[...i,S],i);const M=a?await fetch("/retrieval/new_message",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:f,file_names:C})}):await fetch(`/chat/${f}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:f})});if(M.ok){const F=await M.json();console.log("response data",F),S.answer=F.answer,S.source=F.source,S.source_content=F.source_content,d.push(!1),qe.update(I=>(I[I.length-1]=S,I))}else{const F=await M.text();alert(F)}n(2,g=!1)};let b=0;setInterval(()=>{n(11,b=(b+1)%4)},200);function v(y,C,S){const M=i[S];M.vote=C;const F={id:S+1,vote_status:C};Rf(F),Ct(y.currentTarget.parentNode).selectAll("button").style("border","3px solid transparent").style("opacity",.65),Ct(y.currentTarget).style("border","3px solid var(--black)").style("opacity",1)}[...Array(10).keys()].map(y=>String.fromCharCode(65+y));const $=(y,C)=>v(C,"up",y),A=(y,C)=>v(C,"down",y),k=y=>n(3,d[y]=!d[y],d);function E(){c=this.value,n(1,c)}return e.$$set=y=>{"feedback"in y&&n(0,s=y.feedback),"is_retrieval"in y&&n(10,a=y.is_retrieval)},e.$$.update=()=>{e.$$.dirty&2048&&n(4,r=".".repeat(b).padEnd(3))},[s,c,g,d,r,i,l,u,_,v,a,b,$,A,k,E]}class vi extends ge{constructor(t){super(),me(this,t,Af,kf,de,{feedback:0,is_retrieval:10})}}function Bi(e,t,n){const r=e.slice();return r[14]=t[n],r[16]=n,r}function ji(e,t){let n,r,i,o,l,s,a,u,f,c=t[14].question+"",g,d,p,m,_,b,v,$=t[14].up_ranking_answer+"",A,k,E,y,C,S,M=t[14].low_ranking_answer+"",F,I,D,j,le;function Z(...te){return t[7](t[14],t[16],...te)}function be(...te){return t[8](t[14],t[16],...te)}function ye(...te){return t[9](t[14],t[16],...te)}function he(...te){return t[10](t[14],t[16],...te)}return{key:e,first:null,c(){n=R("div"),r=R("div"),i=R("div"),o=P(),l=R("div"),s=R("div"),a=R("h5"),a.textContent="Question:",u=P(),f=R("p"),g=z(c),d=P(),p=R("div"),m=R("div"),_=R("h5"),_.textContent="Response 1:",b=P(),v=R("p"),A=z($),k=P(),E=R("div"),y=R("h5"),y.textContent="Response 2:",C=P(),S=R("p"),F=z(M),I=P(),h(i,"class","avatar"),h(a,"class","bold svelte-au920n"),h(s,"class","question svelte-au920n"),h(_,"class","bold underline svelte-au920n"),h(m,"class","answer svelte-au920n"),h(y,"class","bold underline svelte-au920n"),h(E,"class","answer svelte-au920n"),h(p,"class","answers svelte-au920n"),h(l,"class","message-content svelte-au920n"),h(r,"class","chat-message-center svelte-au920n"),h(n,"class","chat-message svelte-au920n"),this.first=n},m(te,pe){V(te,n,pe),w(n,r),w(r,i),w(r,o),w(r,l),w(l,s),w(s,a),w(s,u),w(s,f),w(f,g),w(l,d),w(l,p),w(p,m),w(m,_),w(m,b),w(m,v),w(v,A),w(p,k),w(p,E),w(E,y),w(E,C),w(E,S),w(S,F),w(n,I),j||(le=[K(m,"click",Z),K(m,"keydown",be),K(E,"click",ye),K(E,"keydown",he),qn(D=Mf.call(null,n,t[16]===t[3].length-1))],j=!0)},p(te,pe){t=te,pe&8&&c!==(c=t[14].question+"")&&J(g,c),pe&8&&$!==($=t[14].up_ranking_answer+"")&&J(A,$),pe&8&&M!==(M=t[14].low_ranking_answer+"")&&J(F,M),D&&ot(D.update)&&pe&8&&D.update.call(null,t[16]===t[3].length-1)},d(te){te&&N(n),j=!1,we(le)}}}function Ef(e){let t,n,r,i,o,l,s=[],a=new Map,u,f,c,g,d,p,m=(e[1]?e[2]:"Send")+"",_,b,v,$,A,k,E=e[3];const y=C=>C[16];for(let C=0;CRanked Feedback Instructions -

Ask a question and click on the better of the two responses. The better - response will be outlined in green, the worse - response outlined in red. This data will be - automatically fed to RLHF.

- `,r=P(),i=R("div"),o=R("section"),l=R("div");for(let C=0;C{e.scrollIntoView({behavior:"smooth"})},0)}async function Ff(e){const t=await fetch("/chat/ranking_table/update",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(t.ok)console.log("response",t);else{const n=await t.text();alert(n)}}function If(e,t,n){let r,i;ie(e,br,_=>n(3,i=_));let o="",l="",s=!1;Xt(()=>{});const a=async _=>{_.preventDefault(),o=l,n(0,l=""),n(1,s=!0);let b={question:o,up_ranking_answer:"Loading...",low_ranking_answer:"Loading..."};Ue(br,i=[...i,b],i);const v=await fetch(`/chat/multi_responses/${o}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:o})});if(v.ok){const $=await v.json();b.up_ranking_answer=$.answer[0],b.low_ranking_answer=$.answer[1],br.update(A=>(A[A.length-1]=b,A))}else{const $=await v.text();alert($)}n(1,s=!1)};let u=0;setInterval(()=>{n(6,u=(u+1)%4)},200);function f(_,b,v,$){const A=i[v],k={1:"up_ranking_answer",2:"low_ranking_answer"},E={question:A.question,up_ranking_answer:A[k[$]],low_ranking_answer:A[k[$%2+1]]};Ff(E),Ct(_.currentTarget.parentNode).selectAll("div").style("outline","2px solid var(--red)").style("border","1px solid var(--red)"),Ct(_.currentTarget).style("outline","2px solid var(--green)").style("border","1px solid var(--green)")}const c=(_,b,v)=>f(v,_,b,1),g=(_,b,v)=>f(v,_,b,1),d=(_,b,v)=>f(v,_,b,2),p=(_,b,v)=>f(v,_,b,2);function m(){l=this.value,n(0,l)}return e.$$.update=()=>{e.$$.dirty&64&&n(2,r=".".repeat(u).padEnd(3))},[l,s,r,i,a,f,u,c,g,d,p,m]}class Df extends ge{constructor(t){super(),me(this,t,If,Ef,de,{})}}function Ui(e){let t,n;return t=new vi({props:{is_retrieval:e[1]}}),{c(){ce(t.$$.fragment)},m(r,i){ae(t,r,i),n=!0},p(r,i){const o={};i&2&&(o.is_retrieval=r[1]),t.$set(o)},i(r){n||(T(t.$$.fragment,r),n=!0)},o(r){L(t.$$.fragment,r),n=!1},d(r){ue(t,r)}}}function Wi(e){let t,n;return t=new vi({props:{feedback:!0,is_retrieval:e[1]}}),{c(){ce(t.$$.fragment)},m(r,i){ae(t,r,i),n=!0},p(r,i){const o={};i&2&&(o.is_retrieval=r[1]),t.$set(o)},i(r){n||(T(t.$$.fragment,r),n=!0)},o(r){L(t.$$.fragment,r),n=!1},d(r){ue(t,r)}}}function Xi(e){let t,n,r,i;const o=[Pf,xf],l=[];function s(a,u){return a[1]?0:1}return t=s(e),n=l[t]=o[t](e),{c(){n.c(),r=lt()},m(a,u){l[t].m(a,u),V(a,r,u),i=!0},p(a,u){let f=t;t=s(a),t===f?l[t].p(a,u):(ke(),L(l[f],1,1,()=>{l[f]=null}),$e(),n=l[t],n?n.p(a,u):(n=l[t]=o[t](a),n.c()),T(n,1),n.m(r.parentNode,r))},i(a){i||(T(n),i=!0)},o(a){L(n),i=!1},d(a){l[t].d(a),a&&N(r)}}}function xf(e){let t,n;return t=new Df({}),{c(){ce(t.$$.fragment)},m(r,i){ae(t,r,i),n=!0},p:X,i(r){n||(T(t.$$.fragment,r),n=!0)},o(r){L(t.$$.fragment,r),n=!1},d(r){ue(t,r)}}}function Pf(e){let t,n;return t=new vi({props:{feedback:!0,is_retrieval:e[1]}}),{c(){ce(t.$$.fragment)},m(r,i){ae(t,r,i),n=!0},p(r,i){const o={};i&2&&(o.is_retrieval=r[1]),t.$set(o)},i(r){n||(T(t.$$.fragment,r),n=!0)},o(r){L(t.$$.fragment,r),n=!1},d(r){ue(t,r)}}}function Nf(e){let t,n,r,i,o=!e[0]&&Ui(e),l=e[0]==="vote"&&Wi(e),s=e[0]==="rank"&&Xi(e);return{c(){o&&o.c(),t=P(),l&&l.c(),n=P(),s&&s.c(),r=lt()},m(a,u){o&&o.m(a,u),V(a,t,u),l&&l.m(a,u),V(a,n,u),s&&s.m(a,u),V(a,r,u),i=!0},p(a,[u]){a[0]?o&&(ke(),L(o,1,1,()=>{o=null}),$e()):o?(o.p(a,u),u&1&&T(o,1)):(o=Ui(a),o.c(),T(o,1),o.m(t.parentNode,t)),a[0]==="vote"?l?(l.p(a,u),u&1&&T(l,1)):(l=Wi(a),l.c(),T(l,1),l.m(n.parentNode,n)):l&&(ke(),L(l,1,1,()=>{l=null}),$e()),a[0]==="rank"?s?(s.p(a,u),u&1&&T(s,1)):(s=Xi(a),s.c(),T(s,1),s.m(r.parentNode,r)):s&&(ke(),L(s,1,1,()=>{s=null}),$e())},i(a){i||(T(o),T(l),T(s),i=!0)},o(a){L(o),L(l),L(s),i=!1},d(a){o&&o.d(a),a&&N(t),l&&l.d(a),a&&N(n),s&&s.d(a),a&&N(r)}}}function Of(e,t,n){let{feedback:r}=t,{is_retrieval:i}=t;return e.$$set=o=>{"feedback"in o&&n(0,r=o.feedback),"is_retrieval"in o&&n(1,i=o.is_retrieval)},[r,i]}class Tf extends ge{constructor(t){super(),me(this,t,Of,Nf,de,{feedback:0,is_retrieval:1})}}function Yi(e,t,n){const r=e.slice();return r[2]=t[n],r}function Qi(e){let t,n=e[2]+"",r,i;return{c(){t=R("option"),r=z(n),t.__value=i=e[2],t.value=t.__value},m(o,l){V(o,t,l),w(t,r)},p(o,l){l&1&&n!==(n=o[2]+"")&&J(r,n),l&1&&i!==(i=o[2])&&(t.__value=i,t.value=t.__value)},d(o){o&&N(t)}}}function Vf(e){let t,n=e[0],r=[];for(let i=0;i{const o=await fetch(`/data/${r}`);n(0,i=await o.json())}),e.$$set=o=>{"data_endpoint"in o&&n(1,r=o.data_endpoint)},[i,r]}class Hf extends ge{constructor(t){super(),me(this,t,zf,Vf,de,{data_endpoint:1})}}function Vt(e,t){return e==null||t==null?NaN:et?1:e>=t?0:NaN}function Lf(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}function cs(e){let t,n,r;e.length!==2?(t=Vt,n=(s,a)=>Vt(e(s),a),r=(s,a)=>e(s)-a):(t=e===Vt||e===Lf?e:qf,n=e,r=e);function i(s,a,u=0,f=s.length){if(u>>1;n(s[c],a)<0?u=c+1:f=c}while(u>>1;n(s[c],a)<=0?u=c+1:f=c}while(uu&&r(s[c-1],a)>-r(s[c],a)?c-1:c}return{left:i,center:l,right:o}}function qf(){return 0}function Gf(e){return e===null?NaN:+e}function*Bf(e,t){if(t===void 0)for(let n of e)n!=null&&(n=+n)>=n&&(yield n);else{let n=-1;for(let r of e)(r=t(r,++n,e))!=null&&(r=+r)>=r&&(yield r)}}const jf=cs(Vt),Uf=jf.right;cs(Gf).center;const ds=Uf;function Wf(e,t){let n=0;if(t===void 0)for(let r of e)r!=null&&(r=+r)>=r&&++n;else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(i=+i)>=i&&++n}return n}function sn(e,t){let n,r;if(t===void 0)for(const i of e)i!=null&&(n===void 0?i>=i&&(n=r=i):(n>i&&(n=i),r=o&&(n=r=o):(n>o&&(n=o),r{const r=e(t,n);return r||r===0?r:(e(n,n)===0)-(e(t,t)===0)}}function gs(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(et?1:0)}var Zf=Array.prototype,ec=Zf.slice;function Cr(e){return()=>e}const tc=Math.sqrt(50),nc=Math.sqrt(10),rc=Math.sqrt(2);function Xn(e,t,n){const r=(t-e)/Math.max(0,n),i=Math.floor(Math.log10(r)),o=r/Math.pow(10,i),l=o>=tc?10:o>=nc?5:o>=rc?2:1;let s,a,u;return i<0?(u=Math.pow(10,-i)/l,s=Math.round(e*u),a=Math.round(t*u),s/ut&&--a,u=-u):(u=Math.pow(10,i)*l,s=Math.round(e/u),a=Math.round(t/u),s*ut&&--a),a0))return[];if(e===t)return[e];const r=t=i))return[];const s=o-i+1,a=new Array(s);if(r)if(l<0)for(let u=0;u0?(e=Math.floor(e/i)*i,t=Math.ceil(t/i)*i):i<0&&(e=Math.ceil(e*i)/i,t=Math.floor(t*i)/i),r=i}}function lc(e){return Math.max(1,Math.ceil(Math.log(Wf(e))/Math.LN2)+1)}function ps(){var e=Kf,t=sn,n=lc;function r(i){Array.isArray(i)||(i=Array.from(i));var o,l=i.length,s,a,u=new Array(l);for(o=0;o=g)if($>=g&&t===sn){const k=Bt(c,g,A);isFinite(k)&&(k>0?g=(Math.floor(g/k)+1)*k:k<0&&(g=(Math.ceil(g*-k)+1)/-k))}else d.pop()}for(var p=d.length,m=0,_=p;d[m]<=c;)++m;for(;d[_-1]>g;)--_;(m||_0?d[o-1]:c,v.x1=o0)for(o=0;o=r)&&(n=r);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n=i)&&(n=i)}return n}function Zi(e,t){let n;if(t===void 0)for(const r of e)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n>i||n===void 0&&i>=i)&&(n=i)}return n}function ms(e,t,n=0,r=1/0,i){if(t=Math.floor(t),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(e.length-1,r)),!(n<=t&&t<=r))return e;for(i=i===void 0?gs:Jf(i);r>n;){if(r-n>600){const a=r-n+1,u=t-n+1,f=Math.log(a),c=.5*Math.exp(2*f/3),g=.5*Math.sqrt(f*c*(a-c)/a)*(u-a/2<0?-1:1),d=Math.max(n,Math.floor(t-u*c/a+g)),p=Math.min(r,Math.floor(t+(a-u)*c/a+g));ms(e,t,d,p,i)}const o=e[t];let l=n,s=r;for(Kt(e,n,t),i(e[r],o)>0&&Kt(e,n,r);l0;)--s}i(e[n],o)===0?Kt(e,n,s):(++s,Kt(e,s,r)),s<=t&&(n=s+1),t<=s&&(r=s-1)}return e}function Kt(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function sc(e,t,n){if(e=Float64Array.from(Bf(e,n)),!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return Zi(e);if(t>=1)return kt(e);var r,i=(r-1)*t,o=Math.floor(i),l=kt(ms(e,o).subarray(0,o+1)),s=Zi(e.subarray(o+1));return l+(s-l)*(i-o)}}function ac(e,t,n){e=+e,t=+t,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((t-e)/n))|0,o=new Array(i);++r=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function Yn(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function jt(e){return e=Yn(Math.abs(e)),e?e[1]:NaN}function fc(e,t){return function(n,r){for(var i=n.length,o=[],l=0,s=e[0],a=0;i>0&&s>0&&(a+s+1>r&&(s=Math.max(1,r-a)),o.push(n.substring(i-=s,i+s)),!((a+=s+1)>r));)s=e[l=(l+1)%e.length];return o.reverse().join(t)}}function cc(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var dc=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Qn(e){if(!(t=dc.exec(e)))throw new Error("invalid format: "+e);var t;return new wi({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}Qn.prototype=wi.prototype;function wi(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}wi.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 gc(e){e:for(var t=e.length,n=1,r=-1,i;n0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(i+1):e}var _s;function hc(e,t){var n=Yn(e,t);if(!n)return e+"";var r=n[0],i=n[1],o=i-(_s=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,l=r.length;return o===l?r:o>l?r+new Array(o-l+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+Yn(e,Math.max(0,t+o-1))[0]}function eo(e,t){var n=Yn(e,t);if(!n)return e+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}const to={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:uc,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>eo(e*100,t),r:eo,s:hc,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function no(e){return e}var ro=Array.prototype.map,io=["y","z","a","f","p","n","Âĩ","m","","k","M","G","T","P","E","Z","Y"];function pc(e){var t=e.grouping===void 0||e.thousands===void 0?no:fc(ro.call(e.grouping,Number),e.thousands+""),n=e.currency===void 0?"":e.currency[0]+"",r=e.currency===void 0?"":e.currency[1]+"",i=e.decimal===void 0?".":e.decimal+"",o=e.numerals===void 0?no:cc(ro.call(e.numerals,String)),l=e.percent===void 0?"%":e.percent+"",s=e.minus===void 0?"−":e.minus+"",a=e.nan===void 0?"NaN":e.nan+"";function u(c){c=Qn(c);var g=c.fill,d=c.align,p=c.sign,m=c.symbol,_=c.zero,b=c.width,v=c.comma,$=c.precision,A=c.trim,k=c.type;k==="n"?(v=!0,k="g"):to[k]||($===void 0&&($=12),A=!0,k="g"),(_||g==="0"&&d==="=")&&(_=!0,g="0",d="=");var E=m==="$"?n:m==="#"&&/[boxX]/.test(k)?"0"+k.toLowerCase():"",y=m==="$"?r:/[%p]/.test(k)?l:"",C=to[k],S=/[defgprs%]/.test(k);$=$===void 0?6:/[gprs]/.test(k)?Math.max(1,Math.min(21,$)):Math.max(0,Math.min(20,$));function M(F){var I=E,D=y,j,le,Z;if(k==="c")D=C(F)+D,F="";else{F=+F;var be=F<0||1/F<0;if(F=isNaN(F)?a:C(Math.abs(F),$),A&&(F=gc(F)),be&&+F==0&&p!=="+"&&(be=!1),I=(be?p==="("?p:s:p==="-"||p==="("?"":p)+I,D=(k==="s"?io[8+_s/3]:"")+D+(be&&p==="("?")":""),S){for(j=-1,le=F.length;++jZ||Z>57){D=(Z===46?i+F.slice(j+1):F.slice(j))+D,F=F.slice(0,j);break}}}v&&!_&&(F=t(F,1/0));var ye=I.length+F.length+D.length,he=ye>1)+I+F+D+he.slice(ye);break;default:F=he+I+F+D;break}return o(F)}return M.toString=function(){return c+""},M}function f(c,g){var d=u((c=Qn(c),c.type="f",c)),p=Math.max(-8,Math.min(8,Math.floor(jt(g)/3)))*3,m=Math.pow(10,-p),_=io[8+p/3];return function(b){return d(m*b)+_}}return{format:u,formatPrefix:f}}var kn,At,vs;mc({thousands:",",grouping:[3],currency:["$",""]});function mc(e){return kn=pc(e),At=kn.format,vs=kn.formatPrefix,kn}function _c(e){return Math.max(0,-jt(Math.abs(e)))}function vc(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(jt(t)/3)))*3-jt(Math.abs(e)))}function wc(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,jt(t)-jt(e))+1}function bi(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}const oo=Symbol("implicit");function dr(){var e=new Ki,t=[],n=[],r=oo;function i(o){let l=e.get(o);if(l===void 0){if(r!==oo)return r;e.set(o,l=t.push(o)-1)}return n[l%n.length]}return i.domain=function(o){if(!arguments.length)return t.slice();t=[],e=new Ki;for(const l of o)e.has(l)||e.set(l,t.push(l)-1);return i},i.range=function(o){return arguments.length?(n=Array.from(o),i):n.slice()},i.unknown=function(o){return arguments.length?(r=o,i):r},i.copy=function(){return dr(t,n).unknown(r)},bi.apply(i,arguments),i}function yi(){var e=dr().unknown(void 0),t=e.domain,n=e.range,r=0,i=1,o,l,s=!1,a=0,u=0,f=.5;delete e.unknown;function c(){var g=t().length,d=i>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?$n(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?$n(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=yc.exec(e))?new Ne(t[1],t[2],t[3],1):(t=Sc.exec(e))?new Ne(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Cc.exec(e))?$n(t[1],t[2],t[3],t[4]):(t=kc.exec(e))?$n(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=$c.exec(e))?go(t[1],t[2]/100,t[3]/100,1):(t=Rc.exec(e))?go(t[1],t[2]/100,t[3]/100,t[4]):lo.hasOwnProperty(e)?uo(lo[e]):e==="transparent"?new Ne(NaN,NaN,NaN,0):null}function uo(e){return new Ne(e>>16&255,e>>8&255,e&255,1)}function $n(e,t,n,r){return r<=0&&(e=t=n=NaN),new Ne(e,t,n,r)}function Mc(e){return e instanceof vn||(e=pn(e)),e?(e=e.rgb(),new Ne(e.r,e.g,e.b,e.opacity)):new Ne}function Kr(e,t,n,r){return arguments.length===1?Mc(e):new Ne(e,t,n,r??1)}function Ne(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Si(Ne,Kr,ws(vn,{brighter(e){return e=e==null?Kn:Math.pow(Kn,e),new Ne(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?gn:Math.pow(gn,e),new Ne(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Ne(St(this.r),St(this.g),St(this.b),Jn(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:fo,formatHex:fo,formatHex8:Fc,formatRgb:co,toString:co}));function fo(){return`#${bt(this.r)}${bt(this.g)}${bt(this.b)}`}function Fc(){return`#${bt(this.r)}${bt(this.g)}${bt(this.b)}${bt((isNaN(this.opacity)?1:this.opacity)*255)}`}function co(){const e=Jn(this.opacity);return`${e===1?"rgb(":"rgba("}${St(this.r)}, ${St(this.g)}, ${St(this.b)}${e===1?")":`, ${e})`}`}function Jn(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function St(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function bt(e){return e=St(e),(e<16?"0":"")+e.toString(16)}function go(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new je(e,t,n,r)}function bs(e){if(e instanceof je)return new je(e.h,e.s,e.l,e.opacity);if(e instanceof vn||(e=pn(e)),!e)return new je;if(e instanceof je)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),o=Math.max(t,n,r),l=NaN,s=o-i,a=(o+i)/2;return s?(t===o?l=(n-r)/s+(n0&&a<1?0:l,new je(l,s,a,e.opacity)}function Ic(e,t,n,r){return arguments.length===1?bs(e):new je(e,t,n,r??1)}function je(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Si(je,Ic,ws(vn,{brighter(e){return e=e==null?Kn:Math.pow(Kn,e),new je(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?gn:Math.pow(gn,e),new je(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new Ne(kr(e>=240?e-240:e+120,i,r),kr(e,i,r),kr(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new je(ho(this.h),Rn(this.s),Rn(this.l),Jn(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 e=Jn(this.opacity);return`${e===1?"hsl(":"hsla("}${ho(this.h)}, ${Rn(this.s)*100}%, ${Rn(this.l)*100}%${e===1?")":`, ${e})`}`}}));function ho(e){return e=(e||0)%360,e<0?e+360:e}function Rn(e){return Math.max(0,Math.min(1,e||0))}function kr(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const Ci=e=>()=>e;function Dc(e,t){return function(n){return e+n*t}}function xc(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function Pc(e){return(e=+e)==1?ys:function(t,n){return n-t?xc(t,n,e):Ci(isNaN(t)?n:t)}}function ys(e,t){var n=t-e;return n?Dc(e,n):Ci(isNaN(e)?t:e)}const po=function e(t){var n=Pc(t);function r(i,o){var l=n((i=Kr(i)).r,(o=Kr(o)).r),s=n(i.g,o.g),a=n(i.b,o.b),u=ys(i.opacity,o.opacity);return function(f){return i.r=l(f),i.g=s(f),i.b=a(f),i.opacity=u(f),i+""}}return r.gamma=e,r}(1);function Nc(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(o){for(i=0;in&&(o=t.slice(n,o),s[l]?s[l]+=o:s[++l]=o),(r=r[0])===(i=i[0])?s[l]?s[l]+=i:s[++l]=i:(s[++l]=null,a.push({i:l,x:Zn(r,i)})),n=$r.lastIndex;return nt&&(n=e,e=t,t=n),function(r){return Math.max(e,Math.min(t,r))}}function Wc(e,t,n){var r=e[0],i=e[1],o=t[0],l=t[1];return i2?Xc:Wc,a=u=null,c}function c(g){return g==null||isNaN(g=+g)?o:(a||(a=s(e.map(r),t,n)))(r(l(g)))}return c.invert=function(g){return l(i((u||(u=s(t,e.map(r),Zn)))(g)))},c.domain=function(g){return arguments.length?(e=Array.from(g,jc),f()):e.slice()},c.range=function(g){return arguments.length?(t=Array.from(g),f()):t.slice()},c.rangeRound=function(g){return t=Array.from(g),n=Gc,f()},c.clamp=function(g){return arguments.length?(l=g?!0:Pt,f()):l!==Pt},c.interpolate=function(g){return arguments.length?(n=g,f()):n},c.unknown=function(g){return arguments.length?(o=g,c):o},function(g,d){return r=g,i=d,f()}}function Kc(){return Qc()(Pt,Pt)}function Jc(e,t,n,r){var i=ic(e,t,n),o;switch(r=Qn(r??",f"),r.type){case"s":{var l=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(o=vc(i,l))&&(r.precision=o),vs(r,l)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(o=wc(i,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=o-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(o=_c(i))&&(r.precision=o-(r.type==="%")*2);break}}return At(r)}function Zc(e){var t=e.domain;return e.ticks=function(n){var r=t();return hs(r[0],r[r.length-1],n??10)},e.tickFormat=function(n,r){var i=t();return Jc(i[0],i[i.length-1],n??10,r)},e.nice=function(n){n==null&&(n=10);var r=t(),i=0,o=r.length-1,l=r[i],s=r[o],a,u,f=10;for(s0;){if(u=Bt(l,s,n),u===a)return r[i]=l,r[o]=s,t(r);if(u>0)l=Math.floor(l/u)*u,s=Math.ceil(s/u)*u;else if(u<0)l=Math.ceil(l*u)/u,s=Math.floor(s*u)/u;else break;a=u}return e},e}function We(){var e=Kc();return e.copy=function(){return Yc(e,We())},bi.apply(e,arguments),Zc(e)}function An(e){return function(){return e}}function ed(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function ei(e,t){if((l=e.length)>1)for(var n=1,r,i,o=e[t[0]],l,s=o.length;n=0;)n[t]=t;return n}function td(e,t){return e[t]}function nd(e){const t=[];return t.key=e,t}function rd(){var e=An([]),t=ti,n=ei,r=td;function i(o){var l=Array.from(e.apply(this,arguments),nd),s,a=l.length,u=-1,f;for(const c of o)for(s=0,++u;sFeedback Distribution

",n=P(),r=R("div"),i=U("svg");for(let a=0;ae[19].call(r))},m(a,u){V(a,t,u),V(a,n,u),V(a,r,u),w(r,i);for(let f=0;fn(15,c=C)),ie(e,Ni,C=>n(4,g=C)),ie(e,qe,C=>n(16,d=C));let p=300,m=300;const _={up:2,down:1,"n/a":0,all:"all"},b={top:10,bottom:10,left:25,right:5},v=dr().range(["var(--yellow)","var(--red)","var(--green)"]),$=At(".0%");function A(C,S){r===C?n(5,r="all"):n(5,r=C),Ue(et,c=r==="all"?"all":S,c)}const k=(C,S)=>A(C,S.key),E=(C,S)=>A(C,S.key);function y(){m=this.offsetWidth,p=this.offsetHeight,n(1,m),n(0,p)}return e.$$.update=()=>{e.$$.dirty&32768&&n(5,r=_[c]),e.$$.dirty&2&&n(3,i=m-b.left-b.right),e.$$.dirty&1&&n(14,o=p-b.top-b.bottom),e.$$.dirty&65552&&d.forEach(C=>{Ue(Ni,g[C.vote_status]++,g)}),e.$$.dirty&16&&n(2,l=g.up+g.down+g["n/a"]),e.$$.dirty&16384&&n(8,s=yi().rangeRound([b.top,o-b.bottom]).padding(0).domain(["a"])),e.$$.dirty&12&&n(7,a=We().rangeRound([b.left,i-b.right]).domain([0,l])),e.$$.dirty&8208&&n(6,f=u([g]))},n(13,u=rd().keys(["n/a","down","up"]).order(ti).offset(ei)),[p,m,l,i,g,r,f,a,s,b,v,$,A,u,o,c,d,k,E,y]}class ld extends ge{constructor(t){super(),me(this,t,od,id,de,{})}}function sd(e){let t,n,r,i,o,l,s,a,u,f,c,g=e[3][e[2]]+"",d,p;return{c(){t=R("div"),n=R("div"),r=z("Q: "),i=z(e[0]),o=P(),l=R("div"),s=z("A: "),a=z(e[1]),u=P(),f=R("div"),c=z("Rating: "),d=z(g),h(n,"class","question svelte-szi0e"),h(l,"class","answer svelte-szi0e"),h(f,"class",p="feedback "+e[2]+" svelte-szi0e"),h(t,"class","qa-card svelte-szi0e")},m(m,_){V(m,t,_),w(t,n),w(n,r),w(n,i),w(t,o),w(t,l),w(l,s),w(l,a),w(t,u),w(t,f),w(f,c),w(f,d)},p(m,[_]){_&1&&J(i,m[0]),_&2&&J(a,m[1]),_&4&&g!==(g=m[3][m[2]]+"")&&J(d,g),_&4&&p!==(p="feedback "+m[2]+" svelte-szi0e")&&h(f,"class",p)},i:X,o:X,d(m){m&&N(t)}}}function ad(e,t,n){let{question:r="What is gradient descent?"}=t,{answer:i="Gradient descent is an algorithm used to minimize a loss function by taking small steps in the direction of steepest descent."}=t,{feedback:o="Good: 👍"}=t;const l={up:"Good 👍",down:"Bad 👎","n/a":"No Rating",all:"All"};return e.$$set=s=>{"question"in s&&n(0,r=s.question),"answer"in s&&n(1,i=s.answer),"feedback"in s&&n(2,o=s.feedback)},[r,i,o,l]}class ud extends ge{constructor(t){super(),me(this,t,ad,sd,de,{question:0,answer:1,feedback:2})}}function yo(e,t,n){const r=e.slice();return r[5]=t[n].question,r[6]=t[n].answer,r[7]=t[n].vote_status,r}function So(e){let t,n,r,i,o;return n=new ud({props:{question:e[5],answer:e[6],feedback:e[7]}}),{c(){t=R("div"),ce(n.$$.fragment),r=P()},m(l,s){V(l,t,s),ae(n,t,null),w(t,r),o=!0},p(l,s){const a={};s&1&&(a.question=l[5]),s&1&&(a.answer=l[6]),s&1&&(a.feedback=l[7]),n.$set(a)},i(l){o||(T(n.$$.fragment,l),l&&Re(()=>{o&&(i||(i=dt(t,e[1],{duration:300},!0)),i.run(1))}),o=!0)},o(l){L(n.$$.fragment,l),l&&(i||(i=dt(t,e[1],{duration:300},!1)),i.run(0)),o=!1},d(l){l&&N(t),ue(n),l&&i&&i.end()}}}function fd(e){let t,n,r=e[0],i=[];for(let l=0;lL(i[l],1,1,()=>{i[l]=null});return{c(){t=R("div");for(let l=0;ln(4,i=a)),ie(e,et,a=>n(2,o=a)),ie(e,qe,a=>n(3,l=a));const s=(a,{delay:u=0,duration:f=1e3,easing:c=pi})=>Yr(a,{delay:u,duration:f,easing:c});return e.$$.update=()=>{e.$$.dirty&12&&n(0,r=o==="all"?l:l.filter(a=>a.vote_status===o)),e.$$.dirty&1&&Ue(Ur,i=bf(r),i)},[r,s,o,l]}class dd extends ge{constructor(t){super(),me(this,t,cd,fd,de,{})}}function Co(e,t,n){const r=e.slice();return r[13]=t[n],r}function ko(e,t,n){const r=e.slice();return r[16]=t[n],r}function $o(e,t,n){const r=e.slice();return r[16]=t[n],r}function Ro(e){let t,n,r,i,o=e[16]+"",l,s;return{c(){t=U("g"),n=U("line"),i=U("text"),l=z(o),h(n,"class","axis-tick svelte-1oikip4"),h(n,"x1","0"),h(n,"x2","0"),h(n,"y1",0),h(n,"y2",r=-e[2]+e[10].bottom+e[10].top),h(n,"stroke","var(--squidink)"),h(n,"stroke-dasharray","4"),h(i,"class","axis-text svelte-1oikip4"),h(i,"y","15"),h(i,"text-anchor","middle"),h(t,"transform",s=`translate(${e[6](e[16])+e[6].bandwidth()/2} ${e[2]-e[10].bottom})`)},m(a,u){V(a,t,u),w(t,n),w(t,i),w(i,l)},p(a,u){u&4&&r!==(r=-a[2]+a[10].bottom+a[10].top)&&h(n,"y2",r),u&16&&o!==(o=a[16]+"")&&J(l,o),u&84&&s!==(s=`translate(${a[6](a[16])+a[6].bandwidth()/2} ${a[2]-a[10].bottom})`)&&h(t,"transform",s)},d(a){a&&N(t)}}}function Ao(e){let t,n,r,i;return{c(){t=U("g"),n=U("line"),h(n,"class","axis-tick svelte-1oikip4"),h(n,"x1",0),h(n,"x2",r=e[3]-e[10].right-e[10].left),h(n,"y1","0"),h(n,"y2","0"),h(n,"stroke","black"),h(t,"transform",i=`translate(${e[10].left} ${e[5](e[16])+0})`)},m(o,l){V(o,t,l),w(t,n)},p(o,l){l&8&&r!==(r=o[3]-o[10].right-o[10].left)&&h(n,"x2",r),l&32&&i!==(i=`translate(${o[10].left} ${o[5](o[16])+0})`)&&h(t,"transform",i)},d(o){o&&N(t)}}}function Eo(e){let t,n,r,i,o,l,s,a,u=Math.round(e[11](e[13].count))+"",f,c,g;return{c(){t=U("g"),n=U("rect"),a=U("text"),f=z(u),h(n,"x",r=e[6](e[13].question)),h(n,"y",i=e[5](e[13].count)),h(n,"height",o=e[2]-e[5](e[13].count)-e[10].bottom),h(n,"fill",l=e[9][e[7]]),h(n,"fill-opacity","0.95"),h(n,"width",s=e[6].bandwidth()),h(n,"class","svelte-1oikip4"),h(a,"class","axis-text svelte-1oikip4"),h(a,"x",c=e[6](e[13].question)+e[6].bandwidth()/2),h(a,"y",g=e[5](e[13].count)-5),h(a,"text-anchor","middle"),h(t,"class","series")},m(d,p){V(d,t,p),w(t,n),w(t,a),w(a,f)},p(d,p){p&80&&r!==(r=d[6](d[13].question))&&h(n,"x",r),p&48&&i!==(i=d[5](d[13].count))&&h(n,"y",i),p&52&&o!==(o=d[2]-d[5](d[13].count)-d[10].bottom)&&h(n,"height",o),p&128&&l!==(l=d[9][d[7]])&&h(n,"fill",l),p&64&&s!==(s=d[6].bandwidth())&&h(n,"width",s),p&16&&u!==(u=Math.round(d[11](d[13].count))+"")&&J(f,u),p&80&&c!==(c=d[6](d[13].question)+d[6].bandwidth()/2)&&h(a,"x",c),p&48&&g!==(g=d[5](d[13].count)-5)&&h(a,"y",g)},d(d){d&&N(t)}}}function gd(e){let t,n,r,i,o,l,s=e[8][e[7]]+"",a,u,f,c,g,d,p,m,_,b=e[4].map(Mo),v=[];for(let y=0;ye[12].call(t))},m(y,C){V(y,t,C),w(t,n);for(let S=0;Se.question;function hd(e,t,n){let r,i,o,l,s,a;ie(e,Ur,_=>n(4,s=_)),ie(e,et,_=>n(7,a=_));const u={up:"Good 👍",down:"Bad 👎","n/a":"No Rating",all:"All"},f={up:"#00ebc7",down:"#FF5470","n/a":"#fde24f",all:"#bfbfbf"};let c=300,g=300,d={top:35,bottom:10,left:25,right:5};const p=At(".1f");function m(){g=this.offsetWidth,c=this.offsetHeight,n(1,g),n(0,c)}return e.$$.update=()=>{e.$$.dirty&2&&n(3,r=g-d.left-d.right),e.$$.dirty&1&&n(2,i=c-d.top-d.bottom),e.$$.dirty&24&&n(6,o=yi().rangeRound([d.left,r-d.right]).padding(.05).domain(s.map(_=>_.question))),e.$$.dirty&20&&n(5,l=We().rangeRound([i-d.bottom,d.top]).domain([0,kt(s,_=>_.count)])),e.$$.dirty&16&&console.log(s)},[c,g,i,r,s,l,o,a,u,f,d,p,m]}class pd extends ge{constructor(t){super(),me(this,t,hd,gd,de,{})}}function Fo(e,t,n){const r=e.slice();r[19]=t[n];const i=r[7](r[19].x1)-r[7](r[19].x0);return r[20]=i,r}function Io(e,t,n){const r=e.slice();return r[23]=t[n],r}function Do(e){let t,n,r,i,o=e[23]+"",l,s;return{c(){t=U("g"),n=U("line"),i=U("text"),l=z(o),h(n,"class","axis-tick svelte-kz2qh6"),h(n,"x1","0"),h(n,"x2","0"),h(n,"y1",0),h(n,"y2",r=-e[2]+e[9].bottom+e[9].top),h(n,"stroke","var(--squidink)"),h(n,"stroke-dasharray","4"),h(i,"class","axis-text svelte-kz2qh6"),h(i,"y","15"),h(i,"text-anchor","middle"),h(t,"transform",s=`translate(${e[7](e[23])+(e[7](1)-e[7](0))/2} ${e[2]-e[9].bottom})`),h(t,"class","svelte-kz2qh6")},m(a,u){V(a,t,u),w(t,n),w(t,i),w(i,l)},p(a,u){u&4&&r!==(r=-a[2]+a[9].bottom+a[9].top)&&h(n,"y2",r),u&128&&o!==(o=a[23]+"")&&J(l,o),u&132&&s!==(s=`translate(${a[7](a[23])+(a[7](1)-a[7](0))/2} ${a[2]-a[9].bottom})`)&&h(t,"transform",s)},d(a){a&&N(t)}}}function xo(e){let t,n,r,i,o,l,s;return{c(){t=U("g"),n=U("rect"),h(n,"x",r=e[7](e[19].x0)+1),h(n,"width",i=e[20]),h(n,"y",o=e[6](e[19].length)),h(n,"height",l=e[6](0)-e[6](e[19].length)),h(n,"fill",s=e[8][e[5]]),h(n,"class","svelte-kz2qh6"),h(t,"class","histogram-bin svelte-kz2qh6")},m(a,u){V(a,t,u),w(t,n)},p(a,u){u&136&&r!==(r=a[7](a[19].x0)+1)&&h(n,"x",r),u&136&&i!==(i=a[20])&&h(n,"width",i),u&72&&o!==(o=a[6](a[19].length))&&h(n,"y",o),u&72&&l!==(l=a[6](0)-a[6](a[19].length))&&h(n,"height",l),u&32&&s!==(s=a[8][a[5]])&&h(n,"fill",s)},d(a){a&&N(t)}}}function md(e){let t,n,r,i,o,l,s,a,u,f,c,g=e[7].ticks(),d=[];for(let _=0;_e[14].call(t))},m(_,b){V(_,t,b),w(t,n);for(let v=0;vn(5,c=$)),ie(e,qe,$=>n(13,g=$));const d={up:"#00ebc7",down:"#FF5470","n/a":"#fde24f",all:"#bfbfbf"};let p=300,m=300,_={top:15,bottom:10,left:25,right:5};At(".1f");let b=Array.from({length:Po},($,A)=>A);function v(){m=this.offsetWidth,p=this.offsetHeight,n(1,m),n(0,p)}return e.$$.update=()=>{e.$$.dirty&8224&&n(12,r=c==="all"?g:g.filter($=>$.vote_status===c)),e.$$.dirty&4096&&n(11,i=fs(r)),e.$$.dirty&2&&n(4,o=m-_.left-_.right),e.$$.dirty&1&&n(2,l=p-_.top-_.bottom),e.$$.dirty&2048&&n(3,s=ps().thresholds(b).value($=>$.answer)(i)),e.$$.dirty&16&&n(7,a=We().domain([3,Po]).range([_.left,o-_.right])),e.$$.dirty&12&&n(6,u=We().domain([0,kt(s,$=>$.length)]).range([l-_.bottom,_.top])),e.$$.dirty&2048&&n(10,f=kt(i,$=>$.length)),e.$$.dirty&1056&&We().domain([0,f]).range(["white",d[c]]).interpolate(gr)},[p,m,l,s,o,c,u,a,d,_,f,i,r,g,v]}class vd extends ge{constructor(t){super(),me(this,t,_d,md,de,{})}}function No(e,t,n){const r=e.slice();r[18]=t[n];const i=r[7](r[18].x1)-r[7](r[18].x0);return r[19]=i,r}function Oo(e,t,n){const r=e.slice();return r[22]=t[n],r}function To(e){let t,n,r,i,o=e[22]+"",l,s;return{c(){t=U("g"),n=U("line"),i=U("text"),l=z(o),h(n,"class","axis-tick svelte-kz2qh6"),h(n,"x1","0"),h(n,"x2","0"),h(n,"y1",0),h(n,"y2",r=-e[2]+e[9].bottom+e[9].top),h(n,"stroke","var(--squidink)"),h(n,"stroke-dasharray","4"),h(i,"class","axis-text svelte-kz2qh6"),h(i,"y","15"),h(i,"text-anchor","middle"),h(t,"transform",s=`translate(${e[7](e[22])+(e[7](1)-e[7](0))/2} ${e[2]-e[9].bottom})`),h(t,"class","svelte-kz2qh6")},m(a,u){V(a,t,u),w(t,n),w(t,i),w(i,l)},p(a,u){u&4&&r!==(r=-a[2]+a[9].bottom+a[9].top)&&h(n,"y2",r),u&128&&o!==(o=a[22]+"")&&J(l,o),u&132&&s!==(s=`translate(${a[7](a[22])+(a[7](1)-a[7](0))/2} ${a[2]-a[9].bottom})`)&&h(t,"transform",s)},d(a){a&&N(t)}}}function Vo(e){let t,n,r,i,o,l,s;return{c(){t=U("g"),n=U("rect"),h(n,"x",r=e[7](e[18].x0)+1),h(n,"width",i=e[19]),h(n,"y",o=e[6](e[18].length)),h(n,"height",l=e[6](0)-e[6](e[18].length)),h(n,"fill",s=e[8][e[5]]),h(n,"class","svelte-kz2qh6"),h(t,"class","histogram-bin svelte-kz2qh6")},m(a,u){V(a,t,u),w(t,n)},p(a,u){u&136&&r!==(r=a[7](a[18].x0)+1)&&h(n,"x",r),u&136&&i!==(i=a[19])&&h(n,"width",i),u&72&&o!==(o=a[6](a[18].length))&&h(n,"y",o),u&72&&l!==(l=a[6](0)-a[6](a[18].length))&&h(n,"height",l),u&32&&s!==(s=a[8][a[5]])&&h(n,"fill",s)},d(a){a&&N(t)}}}function wd(e){let t,n,r,i,o,l,s,a,u,f,c,g=e[7].ticks(),d=[];for(let _=0;_e[13].call(t))},m(_,b){V(_,t,b),w(t,n);for(let v=0;vn(5,f=v)),ie(e,qe,v=>n(12,c=v));const g={up:"#00ebc7",down:"#FF5470","n/a":"#fde24f",all:"#bfbfbf"};let d=300,p=300,m={top:15,bottom:10,left:25,right:5},_=Array.from({length:zo},(v,$)=>$);dr().range(["var(--yellow)","var(--red)","var(--green)"]);function b(){p=this.offsetWidth,d=this.offsetHeight,n(1,p),n(0,d)}return e.$$.update=()=>{e.$$.dirty&4128&&n(11,r=f==="all"?c:c.filter(v=>v.vote_status===f)),e.$$.dirty&2048&&n(10,i=fs(r)),e.$$.dirty&2&&n(4,o=p-m.left-m.right),e.$$.dirty&1&&n(2,l=d-m.top-m.bottom),e.$$.dirty&1024&&n(3,s=ps().thresholds(_).value(v=>v.question)(i)),e.$$.dirty&16&&n(7,a=We().domain([3,zo]).range([m.left,o-m.right])),e.$$.dirty&12&&n(6,u=We().domain([0,kt(s,v=>v.length)]).range([l-m.bottom,m.top])),e.$$.dirty&1024&&kt(i,v=>v.length)},[d,p,l,s,o,f,u,a,g,m,i,r,c,b]}class yd extends ge{constructor(t){super(),me(this,t,bd,wd,de,{})}}function Sd(e){let t,n,r,i,o,l,s,a,u,f,c,g,d,p=Math.round(e[5](e[3]))+"",m,_,b,v,$,A,k,E;return{c(){t=R("div"),n=R("div"),r=R("p"),r.textContent="Questions",i=P(),o=R("select"),l=R("option"),l.textContent="All",s=R("option"),s.textContent="Good",a=R("option"),a.textContent="Bad",u=R("option"),u.textContent="N/A",f=P(),c=R("div"),g=U("svg"),d=U("text"),m=z(p),$=P(),A=R("p"),A.textContent="number of responses",h(r,"class","card-text svelte-1pknxov"),l.__value="all",l.value=l.__value,h(l,"class","svelte-1pknxov"),s.__value="up",s.value=s.__value,h(s,"class","svelte-1pknxov"),a.__value="down",a.value=a.__value,h(a,"class","svelte-1pknxov"),u.__value="n/a",u.value=u.__value,h(u,"class","svelte-1pknxov"),h(o,"id","feedback-dropdown"),h(o,"name","feedback-dropdown"),Ee(o,"background",e[6][e[0]]),h(o,"class","svelte-1pknxov"),e[0]===void 0&&Re(()=>e[9].call(o)),h(n,"class","svelte-1pknxov"),h(d,"dominant-baseline","middle"),h(d,"x",_=e[2]/2),h(d,"y",b=e[1]/2),h(d,"text-anchor","middle"),h(d,"class","svelte-1pknxov"),h(g,"width",e[2]),h(g,"height",e[1]),h(g,"class","svelte-1pknxov"),h(c,"class","svelte-1pknxov"),Re(()=>e[10].call(c)),h(A,"class","small svelte-1pknxov"),h(t,"class","card-container svelte-1pknxov"),Ee(t,"background",e[6][e[0]])},m(y,C){V(y,t,C),w(t,n),w(n,r),w(n,i),w(n,o),w(o,l),w(o,s),w(o,a),w(o,u),Gn(o,e[0],!0),w(t,f),w(t,c),w(c,g),w(g,d),w(d,m),v=Rt(c,e[10].bind(c)),w(t,$),w(t,A),k||(E=K(o,"change",e[9]),k=!0)},p(y,[C]){C&1&&Ee(o,"background",y[6][y[0]]),C&1&&Gn(o,y[0]),C&8&&p!==(p=Math.round(y[5](y[3]))+"")&&J(m,p),C&4&&_!==(_=y[2]/2)&&h(d,"x",_),C&2&&b!==(b=y[1]/2)&&h(d,"y",b),C&4&&h(g,"width",y[2]),C&2&&h(g,"height",y[1]),C&1&&Ee(t,"background",y[6][y[0]])},i:X,o:X,d(y){y&&N(t),v(),k=!1,E()}}}function Cd(e,t){return t==="all"?e.length:e.filter(r=>r.vote_status===t).length}function kd(e,t,n){let r,i,o,l;ie(e,et,p=>n(0,i=p)),ie(e,qe,p=>n(8,o=p));let s,a,u=mi(0);ie(e,u,p=>n(3,l=p));const f=At(".1f"),c={up:"#00ebc7",down:"#FF5470","n/a":"#fde24f",all:"var(--white)"};function g(){i=Wl(this),et.set(i)}function d(){a=this.clientWidth,s=this.clientHeight,n(2,a),n(1,s)}return e.$$.update=()=>{e.$$.dirty&257&&n(7,r=Cd(o,i)),e.$$.dirty&128&&console.log("fbc",r),e.$$.dirty&128&&u.set(r)},[i,s,a,l,u,f,c,r,o,g,d]}class $d extends ge{constructor(t){super(),me(this,t,kd,Sd,de,{})}}function Rd(e){let t,n,r,i,o,l,s,a,u,f,c,g,d,p=e[5](e[3])+"",m,_,b,v,$,A,k,E;return{c(){t=R("div"),n=R("div"),r=R("p"),r.textContent="Questions",i=P(),o=R("select"),l=R("option"),l.textContent="All",s=R("option"),s.textContent="Good",a=R("option"),a.textContent="Bad",u=R("option"),u.textContent="N/A",f=P(),c=R("div"),g=U("svg"),d=U("text"),m=z(p),$=P(),A=R("p"),A.textContent="percentage of responses",h(r,"class","card-text svelte-mchgj2"),l.__value="all",l.value=l.__value,s.__value="up",s.value=s.__value,a.__value="down",a.value=a.__value,u.__value="n/a",u.value=u.__value,h(o,"id","feedback-dropdown"),h(o,"name","feedback-dropdown"),Ee(o,"background",e[6][e[0]]),h(o,"class","svelte-mchgj2"),e[0]===void 0&&Re(()=>e[9].call(o)),h(d,"dominant-baseline","middle"),h(d,"x",_=e[2]/2),h(d,"y",b=e[1]/2),h(d,"text-anchor","middle"),h(d,"class","svelte-mchgj2"),h(g,"width",e[2]),h(g,"height",e[1]),h(g,"class","svelte-mchgj2"),Re(()=>e[10].call(c)),h(A,"class","small svelte-mchgj2"),h(t,"class","card-container svelte-mchgj2"),Ee(t,"background",e[6][e[0]])},m(y,C){V(y,t,C),w(t,n),w(n,r),w(n,i),w(n,o),w(o,l),w(o,s),w(o,a),w(o,u),Gn(o,e[0],!0),w(t,f),w(t,c),w(c,g),w(g,d),w(d,m),v=Rt(c,e[10].bind(c)),w(t,$),w(t,A),k||(E=K(o,"change",e[9]),k=!0)},p(y,[C]){C&1&&Ee(o,"background",y[6][y[0]]),C&1&&Gn(o,y[0]),C&8&&p!==(p=y[5](y[3])+"")&&J(m,p),C&4&&_!==(_=y[2]/2)&&h(d,"x",_),C&2&&b!==(b=y[1]/2)&&h(d,"y",b),C&4&&h(g,"width",y[2]),C&2&&h(g,"height",y[1]),C&1&&Ee(t,"background",y[6][y[0]])},i:X,o:X,d(y){y&&N(t),v(),k=!1,E()}}}function Ad(e,t){const n=e.length;return t==="all"?1:e.filter(i=>i.vote_status===t).length/n}function Ed(e,t,n){let r,i,o,l;ie(e,et,p=>n(0,i=p)),ie(e,qe,p=>n(8,o=p));let s,a,u=mi(0);ie(e,u,p=>n(3,l=p));const f=At(".1%"),c={up:"#00ebc7",down:"#FF5470","n/a":"#fde24f",all:"var(--white)"};function g(){i=Wl(this),et.set(i)}function d(){a=this.clientWidth,s=this.clientHeight,n(2,a),n(1,s)}return e.$$.update=()=>{e.$$.dirty&257&&n(7,r=Ad(o,i)),e.$$.dirty&128&&u.set(r)},[i,s,a,l,u,f,c,r,o,g,d]}class Md extends ge{constructor(t){super(),me(this,t,Ed,Rd,de,{})}}function Fd(e){let t,n,r,i,o,l,s,a,u,f,c,g,d,p,m,_,b,v,$,A,k,E,y,C,S,M,F;return o=new $d({}),a=new Md({}),c=new ld({}),p=new pd({props:{feedback:"Bad"}}),b=new yd({}),A=new vd({}),M=new dd({}),{c(){t=R("div"),n=R("div"),r=R("div"),i=R("div"),ce(o.$$.fragment),l=P(),s=R("div"),ce(a.$$.fragment),u=P(),f=R("div"),ce(c.$$.fragment),g=P(),d=R("div"),ce(p.$$.fragment),m=P(),_=R("div"),ce(b.$$.fragment),v=P(),$=R("div"),ce(A.$$.fragment),k=P(),E=R("div"),y=R("div"),y.innerHTML=`
-
`,C=P(),S=R("div"),ce(M.$$.fragment),h(i,"class","card-1 svelte-14znspc"),h(s,"class","card-2"),h(r,"class","left-text svelte-14znspc"),h(f,"class","left-confidence svelte-14znspc"),h(d,"class","left-question svelte-14znspc"),h(_,"class","left-filter svelte-14znspc"),h($,"class","left-filter2"),h(n,"class","feedback-left svelte-14znspc"),h(y,"class","right-chart svelte-14znspc"),h(S,"class","right-table svelte-14znspc"),h(E,"class","feedback-right svelte-14znspc"),h(t,"class","feedback-container svelte-14znspc")},m(I,D){V(I,t,D),w(t,n),w(n,r),w(r,i),ae(o,i,null),w(r,l),w(r,s),ae(a,s,null),w(n,u),w(n,f),ae(c,f,null),w(n,g),w(n,d),ae(p,d,null),w(n,m),w(n,_),ae(b,_,null),w(n,v),w(n,$),ae(A,$,null),w(t,k),w(t,E),w(E,y),w(E,C),w(E,S),ae(M,S,null),F=!0},p:X,i(I){F||(T(o.$$.fragment,I),T(a.$$.fragment,I),T(c.$$.fragment,I),T(p.$$.fragment,I),T(b.$$.fragment,I),T(A.$$.fragment,I),T(M.$$.fragment,I),F=!0)},o(I){L(o.$$.fragment,I),L(a.$$.fragment,I),L(c.$$.fragment,I),L(p.$$.fragment,I),L(b.$$.fragment,I),L(A.$$.fragment,I),L(M.$$.fragment,I),F=!1},d(I){I&&N(t),ue(o),ue(a),ue(c),ue(p),ue(b),ue(A),ue(M)}}}function Id(e,t,n){let r;ie(e,qe,o=>n(0,r=o)),Xt(()=>{i()});async function i(){const a=(await(await fetch("/chat/qa_table/retrieve")).json()).rows.map(u=>({id:u[0],question:u[1],answer:u[2],vote_status:u[3]}));Ue(qe,r=[...a],r)}return[]}class Dd extends ge{constructor(t){super(),me(this,t,Id,Fd,de,{})}}/**! - * Sortable 1.15.0 - * @author RubaXa - * @author owenm - * @license MIT - */function Ho(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function tt(e){for(var t=1;t=0)&&(n[i]=e[i]);return n}function Nd(e,t){if(e==null)return{};var n=Pd(e,t),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var Od="1.15.0";function it(e){if(typeof window<"u"&&window.navigator)return!!navigator.userAgent.match(e)}var at=it(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),wn=it(/Edge/i),Lo=it(/firefox/i),an=it(/safari/i)&&!it(/chrome/i)&&!it(/android/i),Ss=it(/iP(ad|od|hone)/i),Cs=it(/chrome/i)&&it(/android/i),ks={capture:!1,passive:!1};function re(e,t,n){e.addEventListener(t,n,!at&&ks)}function ee(e,t,n){e.removeEventListener(t,n,!at&&ks)}function er(e,t){if(t){if(t[0]===">"&&(t=t.substring(1)),e)try{if(e.matches)return e.matches(t);if(e.msMatchesSelector)return e.msMatchesSelector(t);if(e.webkitMatchesSelector)return e.webkitMatchesSelector(t)}catch{return!1}return!1}}function Td(e){return e.host&&e!==document&&e.host.nodeType?e.host:e.parentNode}function Qe(e,t,n,r){if(e){n=n||document;do{if(t!=null&&(t[0]===">"?e.parentNode===n&&er(e,t):er(e,t))||r&&e===n)return e;if(e===n)break}while(e=Td(e))}return null}var qo=/\s+/g;function Te(e,t,n){if(e&&t)if(e.classList)e.classList[n?"add":"remove"](t);else{var r=(" "+e.className+" ").replace(qo," ").replace(" "+t+" "," ");e.className=(r+(n?" "+t:"")).replace(qo," ")}}function G(e,t,n){var r=e&&e.style;if(r){if(n===void 0)return document.defaultView&&document.defaultView.getComputedStyle?n=document.defaultView.getComputedStyle(e,""):e.currentStyle&&(n=e.currentStyle),t===void 0?n:n[t];!(t in r)&&t.indexOf("webkit")===-1&&(t="-webkit-"+t),r[t]=n+(typeof n=="string"?"":"px")}}function Ht(e,t){var n="";if(typeof e=="string")n=e;else do{var r=G(e,"transform");r&&r!=="none"&&(n=r+" "+n)}while(!t&&(e=e.parentNode));var i=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return i&&new i(n)}function $s(e,t,n){if(e){var r=e.getElementsByTagName(t),i=0,o=r.length;if(n)for(;i=o:l=i<=o,!l)return r;if(r===Ze())break;r=ht(r,!1)}return!1}function Ut(e,t,n,r){for(var i=0,o=0,l=e.children;o2&&arguments[2]!==void 0?arguments[2]:{},i=r.evt,o=Nd(r,jd);bn.pluginEvent.bind(q)(t,n,tt({dragEl:x,parentEl:fe,ghostEl:W,rootEl:oe,nextEl:wt,lastDownEl:Tn,cloneEl:se,cloneHidden:ct,dragStarted:tn,putSortable:Ce,activeSortable:q.active,originalEvent:i,oldIndex:Nt,oldDraggableIndex:fn,newIndex:Ve,newDraggableIndex:ft,hideGhostForTarget:Ds,unhideGhostForTarget:xs,cloneNowHidden:function(){ct=!0},cloneNowShown:function(){ct=!1},dispatchSortableEvent:function(s){Fe({sortable:n,name:s,originalEvent:i})}},o))};function Fe(e){Bd(tt({putSortable:Ce,cloneEl:se,targetEl:x,rootEl:oe,oldIndex:Nt,oldDraggableIndex:fn,newIndex:Ve,newDraggableIndex:ft},e))}var x,fe,W,oe,wt,Tn,se,ct,Nt,Ve,fn,ft,En,Ce,xt=!1,tr=!1,nr=[],_t,Be,Er,Mr,jo,Uo,tn,It,cn,dn=!1,Mn=!1,Vn,Ae,Fr=[],ni=!1,rr=[],hr=typeof document<"u",Fn=Ss,Wo=wn||at?"cssFloat":"float",Ud=hr&&!Cs&&!Ss&&"draggable"in document.createElement("div"),Ms=function(){if(hr){if(at)return!1;var e=document.createElement("x");return e.style.cssText="pointer-events:auto",e.style.pointerEvents==="auto"}}(),Fs=function(t,n){var r=G(t),i=parseInt(r.width)-parseInt(r.paddingLeft)-parseInt(r.paddingRight)-parseInt(r.borderLeftWidth)-parseInt(r.borderRightWidth),o=Ut(t,0,n),l=Ut(t,1,n),s=o&&G(o),a=l&&G(l),u=s&&parseInt(s.marginLeft)+parseInt(s.marginRight)+ve(o).width,f=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+ve(l).width;if(r.display==="flex")return r.flexDirection==="column"||r.flexDirection==="column-reverse"?"vertical":"horizontal";if(r.display==="grid")return r.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(o&&s.float&&s.float!=="none"){var c=s.float==="left"?"left":"right";return l&&(a.clear==="both"||a.clear===c)?"vertical":"horizontal"}return o&&(s.display==="block"||s.display==="flex"||s.display==="table"||s.display==="grid"||u>=i&&r[Wo]==="none"||l&&r[Wo]==="none"&&u+f>i)?"vertical":"horizontal"},Wd=function(t,n,r){var i=r?t.left:t.top,o=r?t.right:t.bottom,l=r?t.width:t.height,s=r?n.left:n.top,a=r?n.right:n.bottom,u=r?n.width:n.height;return i===s||o===a||i+l/2===s+u/2},Xd=function(t,n){var r;return nr.some(function(i){var o=i[ze].options.emptyInsertThreshold;if(!(!o||ki(i))){var l=ve(i),s=t>=l.left-o&&t<=l.right+o,a=n>=l.top-o&&n<=l.bottom+o;if(s&&a)return r=i}}),r},Is=function(t){function n(o,l){return function(s,a,u,f){var c=s.options.group.name&&a.options.group.name&&s.options.group.name===a.options.group.name;if(o==null&&(l||c))return!0;if(o==null||o===!1)return!1;if(l&&o==="clone")return o;if(typeof o=="function")return n(o(s,a,u,f),l)(s,a,u,f);var g=(l?s:a).options.group.name;return o===!0||typeof o=="string"&&o===g||o.join&&o.indexOf(g)>-1}}var r={},i=t.group;(!i||On(i)!="object")&&(i={name:i}),r.name=i.name,r.checkPull=n(i.pull,!0),r.checkPut=n(i.put),r.revertClone=i.revertClone,t.group=r},Ds=function(){!Ms&&W&&G(W,"display","none")},xs=function(){!Ms&&W&&G(W,"display","")};hr&&!Cs&&document.addEventListener("click",function(e){if(tr)return e.preventDefault(),e.stopPropagation&&e.stopPropagation(),e.stopImmediatePropagation&&e.stopImmediatePropagation(),tr=!1,!1},!0);var vt=function(t){if(x){t=t.touches?t.touches[0]:t;var n=Xd(t.clientX,t.clientY);if(n){var r={};for(var i in t)t.hasOwnProperty(i)&&(r[i]=t[i]);r.target=r.rootEl=n,r.preventDefault=void 0,r.stopPropagation=void 0,n[ze]._onDragOver(r)}}},Yd=function(t){x&&x.parentNode[ze]._isOutsideThisEl(t.target)};function q(e,t){if(!(e&&e.nodeType&&e.nodeType===1))throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(e));this.el=e,this.options=t=st({},t),e[ze]=this;var n={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(e.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return Fs(e,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(l,s){l.setData("Text",s.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:q.supportPointer!==!1&&"PointerEvent"in window&&!an,emptyInsertThreshold:5};bn.initializePlugins(this,e,n);for(var r in n)!(r in t)&&(t[r]=n[r]);Is(t);for(var i in this)i.charAt(0)==="_"&&typeof this[i]=="function"&&(this[i]=this[i].bind(this));this.nativeDraggable=t.forceFallback?!1:Ud,this.nativeDraggable&&(this.options.touchStartThreshold=1),t.supportPointer?re(e,"pointerdown",this._onTapStart):(re(e,"mousedown",this._onTapStart),re(e,"touchstart",this._onTapStart)),this.nativeDraggable&&(re(e,"dragover",this),re(e,"dragenter",this)),nr.push(this.el),t.store&&t.store.get&&this.sort(t.store.get(this)||[]),st(this,Ld())}q.prototype={constructor:q,_isOutsideThisEl:function(t){!this.el.contains(t)&&t!==this.el&&(It=null)},_getDirection:function(t,n){return typeof this.options.direction=="function"?this.options.direction.call(this,t,n,x):this.options.direction},_onTapStart:function(t){if(t.cancelable){var n=this,r=this.el,i=this.options,o=i.preventOnFilter,l=t.type,s=t.touches&&t.touches[0]||t.pointerType&&t.pointerType==="touch"&&t,a=(s||t).target,u=t.target.shadowRoot&&(t.path&&t.path[0]||t.composedPath&&t.composedPath()[0])||a,f=i.filter;if(rg(r),!x&&!(/mousedown|pointerdown/.test(l)&&t.button!==0||i.disabled)&&!u.isContentEditable&&!(!this.nativeDraggable&&an&&a&&a.tagName.toUpperCase()==="SELECT")&&(a=Qe(a,i.draggable,r,!1),!(a&&a.animated)&&Tn!==a)){if(Nt=Le(a),fn=Le(a,i.draggable),typeof f=="function"){if(f.call(this,t,a,this)){Fe({sortable:n,rootEl:u,name:"filter",targetEl:a,toEl:r,fromEl:r}),xe("filter",n,{evt:t}),o&&t.cancelable&&t.preventDefault();return}}else if(f&&(f=f.split(",").some(function(c){if(c=Qe(u,c.trim(),r,!1),c)return Fe({sortable:n,rootEl:c,name:"filter",targetEl:a,fromEl:r,toEl:r}),xe("filter",n,{evt:t}),!0}),f)){o&&t.cancelable&&t.preventDefault();return}i.handle&&!Qe(u,i.handle,r,!1)||this._prepareDragStart(t,s,a)}}},_prepareDragStart:function(t,n,r){var i=this,o=i.el,l=i.options,s=o.ownerDocument,a;if(r&&!x&&r.parentNode===o){var u=ve(r);if(oe=o,x=r,fe=x.parentNode,wt=x.nextSibling,Tn=r,En=l.group,q.dragged=x,_t={target:x,clientX:(n||t).clientX,clientY:(n||t).clientY},jo=_t.clientX-u.left,Uo=_t.clientY-u.top,this._lastX=(n||t).clientX,this._lastY=(n||t).clientY,x.style["will-change"]="all",a=function(){if(xe("delayEnded",i,{evt:t}),q.eventCanceled){i._onDrop();return}i._disableDelayedDragEvents(),!Lo&&i.nativeDraggable&&(x.draggable=!0),i._triggerDragStart(t,n),Fe({sortable:i,name:"choose",originalEvent:t}),Te(x,l.chosenClass,!0)},l.ignore.split(",").forEach(function(f){$s(x,f.trim(),Ir)}),re(s,"dragover",vt),re(s,"mousemove",vt),re(s,"touchmove",vt),re(s,"mouseup",i._onDrop),re(s,"touchend",i._onDrop),re(s,"touchcancel",i._onDrop),Lo&&this.nativeDraggable&&(this.options.touchStartThreshold=4,x.draggable=!0),xe("delayStart",this,{evt:t}),l.delay&&(!l.delayOnTouchOnly||n)&&(!this.nativeDraggable||!(wn||at))){if(q.eventCanceled){this._onDrop();return}re(s,"mouseup",i._disableDelayedDrag),re(s,"touchend",i._disableDelayedDrag),re(s,"touchcancel",i._disableDelayedDrag),re(s,"mousemove",i._delayedDragTouchMoveHandler),re(s,"touchmove",i._delayedDragTouchMoveHandler),l.supportPointer&&re(s,"pointermove",i._delayedDragTouchMoveHandler),i._dragStartTimer=setTimeout(a,l.delay)}else a()}},_delayedDragTouchMoveHandler:function(t){var n=t.touches?t.touches[0]:t;Math.max(Math.abs(n.clientX-this._lastX),Math.abs(n.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){x&&Ir(x),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var t=this.el.ownerDocument;ee(t,"mouseup",this._disableDelayedDrag),ee(t,"touchend",this._disableDelayedDrag),ee(t,"touchcancel",this._disableDelayedDrag),ee(t,"mousemove",this._delayedDragTouchMoveHandler),ee(t,"touchmove",this._delayedDragTouchMoveHandler),ee(t,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(t,n){n=n||t.pointerType=="touch"&&t,!this.nativeDraggable||n?this.options.supportPointer?re(document,"pointermove",this._onTouchMove):n?re(document,"touchmove",this._onTouchMove):re(document,"mousemove",this._onTouchMove):(re(x,"dragend",this),re(oe,"dragstart",this._onDragStart));try{document.selection?zn(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch{}},_dragStarted:function(t,n){if(xt=!1,oe&&x){xe("dragStarted",this,{evt:n}),this.nativeDraggable&&re(document,"dragover",Yd);var r=this.options;!t&&Te(x,r.dragClass,!1),Te(x,r.ghostClass,!0),q.active=this,t&&this._appendGhost(),Fe({sortable:this,name:"start",originalEvent:n})}else this._nulling()},_emulateDragOver:function(){if(Be){this._lastX=Be.clientX,this._lastY=Be.clientY,Ds();for(var t=document.elementFromPoint(Be.clientX,Be.clientY),n=t;t&&t.shadowRoot&&(t=t.shadowRoot.elementFromPoint(Be.clientX,Be.clientY),t!==n);)n=t;if(x.parentNode[ze]._isOutsideThisEl(t),n)do{if(n[ze]){var r=void 0;if(r=n[ze]._onDragOver({clientX:Be.clientX,clientY:Be.clientY,target:t,rootEl:n}),r&&!this.options.dragoverBubble)break}t=n}while(n=n.parentNode);xs()}},_onTouchMove:function(t){if(_t){var n=this.options,r=n.fallbackTolerance,i=n.fallbackOffset,o=t.touches?t.touches[0]:t,l=W&&Ht(W,!0),s=W&&l&&l.a,a=W&&l&&l.d,u=Fn&&Ae&&Bo(Ae),f=(o.clientX-_t.clientX+i.x)/(s||1)+(u?u[0]-Fr[0]:0)/(s||1),c=(o.clientY-_t.clientY+i.y)/(a||1)+(u?u[1]-Fr[1]:0)/(a||1);if(!q.active&&!xt){if(r&&Math.max(Math.abs(o.clientX-this._lastX),Math.abs(o.clientY-this._lastY))=0&&(Fe({rootEl:fe,name:"add",toEl:fe,fromEl:oe,originalEvent:t}),Fe({sortable:this,name:"remove",toEl:fe,originalEvent:t}),Fe({rootEl:fe,name:"sort",toEl:fe,fromEl:oe,originalEvent:t}),Fe({sortable:this,name:"sort",toEl:fe,originalEvent:t})),Ce&&Ce.save()):Ve!==Nt&&Ve>=0&&(Fe({sortable:this,name:"update",toEl:fe,originalEvent:t}),Fe({sortable:this,name:"sort",toEl:fe,originalEvent:t})),q.active&&((Ve==null||Ve===-1)&&(Ve=Nt,ft=fn),Fe({sortable:this,name:"end",toEl:fe,originalEvent:t}),this.save()))),this._nulling()},_nulling:function(){xe("nulling",this),oe=x=fe=W=wt=se=Tn=ct=_t=Be=tn=Ve=ft=Nt=fn=It=cn=Ce=En=q.dragged=q.ghost=q.clone=q.active=null,rr.forEach(function(t){t.checked=!0}),rr.length=Er=Mr=0},handleEvent:function(t){switch(t.type){case"drop":case"dragend":this._onDrop(t);break;case"dragenter":case"dragover":x&&(this._onDragOver(t),Qd(t));break;case"selectstart":t.preventDefault();break}},toArray:function(){for(var t=[],n,r=this.el.children,i=0,o=r.length,l=this.options;ir.right+i||e.clientX<=r.right&&e.clientY>r.bottom&&e.clientX>=r.left:e.clientX>r.right&&e.clientY>r.top||e.clientX<=r.right&&e.clientY>r.bottom+i}function eg(e,t,n,r,i,o,l,s){var a=r?e.clientY:e.clientX,u=r?n.height:n.width,f=r?n.top:n.left,c=r?n.bottom:n.right,g=!1;if(!l){if(s&&Vnf+u*o/2:ac-Vn)return-cn}else if(a>f+u*(1-i)/2&&ac-u*o/2)?a>f+u/2?1:-1:0}function tg(e){return Le(x)C[24];for(let C=0;CE[21];for(let E=0;EQ & A Comparison Instructions -
-

Ask a question and rank the answers across the models. Drag each answer to - rank it, in ascending order, from left-to-right. Optionally, select the - rank for each via the corresponding dropdown.

-
- `,r=P(),i=R("div"),o=R("section"),l=R("div");for(let E=0;E{e.scrollIntoView({behavior:"smooth"})},0)}async function tl(e){console.log("run update",e);const n=await fetch("/chat/comparator/db/update",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({data:e})});if(n.ok)console.log("ok",n);else{const r=await n.text();alert(r)}}function sg(e,t,n){let r,i,o;ie(e,yr,k=>n(7,o=k));let{numModels:l=1}=t,{models:s=[0]}=t,a="",u="",f=!1;Xt(async()=>{if(await new Promise(k=>setTimeout(k,200)),d){const k=new q(d,{animation:150,onUpdate(E){k.toArray()}});k.toArray()}});const c=async k=>{k.preventDefault(),a=u,n(3,u=""),n(4,f=!0);let E={question:a};for(let C of s)E[C]="Loading...";Ue(yr,o=[...o,E],o);const y=await fetch(`/chat/comparator/${a}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:a})});if(y.ok){const C=await y.json();n(1,s=Object.keys(C.answer)),n(0,l=s.length);for(let S of s)E[S]=C.answer[S];E.qid=C.qid,yr.update(S=>(S[S.length-1]=E,S))}else{const C=await y.text();alert(C)}n(4,f=!1)};let g=0;setInterval(()=>{n(11,g=(g+1)%4)},200);let d,p;function m(k,E){const y=E,S=Ct(k.currentTarget.parentNode).selectAll("div.answer").nodes().map(D=>D.id);S.forEach((D,j)=>{Ct(`#${D}`).select(".answer-rank").property("value",j+1)});let M=[];for(let[D,j]of S.entries()){const le=parseInt(j.split("-")[1]),Z=s[le],be={rank:D,model:Z};M.push(be)}let F=o.filter(D=>D.qid===y),I=[];for(let D of M){const j={model:D.model,qid:parseInt(y),rank:parseInt(D.rank)+1,answer:F[0][D.model]};I.push(j)}tl(I)}function _(k,E,y){const C=E,S=parseInt(k.target.value),M=s[y],F={qid:C,rank:parseInt(S),model:M};let I=[],j=o.filter(Z=>Z.qid===F.qid)[0][F.model];const le={model:F.model,qid:parseInt(F.qid),rank:parseInt(F.rank),answer:j};I.push(le),tl(I)}const b=(k,E,y)=>_(y,k.qid,E),v=(k,E)=>m(E,k.qid);function $(k){Un[k?"unshift":"push"](()=>{d=k,n(2,d)})}function A(){u=this.value,n(3,u)}return e.$$set=k=>{"numModels"in k&&n(0,l=k.numModels),"models"in k&&n(1,s=k.models)},e.$$.update=()=>{e.$$.dirty&1&&n(6,r="1fr ".repeat(l).trim()),e.$$.dirty&2048&&n(5,i=".".repeat(g).padEnd(3)),e.$$.dirty&4100&&d&&(n(12,p=new q(d,{animation:150,dataIdAttr:"id",onUpdate(k){p.toArray()}})),p.toArray())},[l,s,d,u,f,i,r,o,c,m,_,g,p,b,v,$,A]}class ag extends ge{constructor(t){super(),me(this,t,sg,og,de,{numModels:0,models:1})}}function ug(e){const t=+this._x.call(null,e),n=+this._y.call(null,e);return Ns(this.cover(t,n),t,n,e)}function Ns(e,t,n,r){if(isNaN(t)||isNaN(n))return e;var i,o=e._root,l={data:r},s=e._x0,a=e._y0,u=e._x1,f=e._y1,c,g,d,p,m,_,b,v;if(!o)return e._root=l,e;for(;o.length;)if((m=t>=(c=(s+u)/2))?s=c:u=c,(_=n>=(g=(a+f)/2))?a=g:f=g,i=o,!(o=o[b=_<<1|m]))return i[b]=l,e;if(d=+e._x.call(null,o.data),p=+e._y.call(null,o.data),t===d&&n===p)return l.next=o,i?i[b]=l:e._root=l,e;do i=i?i[b]=new Array(4):e._root=new Array(4),(m=t>=(c=(s+u)/2))?s=c:u=c,(_=n>=(g=(a+f)/2))?a=g:f=g;while((b=_<<1|m)===(v=(p>=g)<<1|d>=c));return i[v]=o,i[b]=l,e}function fg(e){var t,n,r=e.length,i,o,l=new Array(r),s=new Array(r),a=1/0,u=1/0,f=-1/0,c=-1/0;for(n=0;nf&&(f=i),oc&&(c=o));if(a>f||u>c)return this;for(this.cover(a,u).cover(f,c),n=0;ne||e>=i||r>t||t>=o;)switch(u=(tf||(s=p.y0)>c||(a=p.x1)=b)<<1|e>=_)&&(p=g[g.length-1],g[g.length-1]=g[g.length-1-m],g[g.length-1-m]=p)}else{var v=e-+this._x.call(null,d.data),$=t-+this._y.call(null,d.data),A=v*v+$*$;if(A=(g=(l+a)/2))?l=g:a=g,(m=c>=(d=(s+u)/2))?s=d:u=d,t=n,!(n=n[_=m<<1|p]))return this;if(!n.length)break;(t[_+1&3]||t[_+2&3]||t[_+3&3])&&(r=t,b=_)}for(;n.data!==e;)if(i=n,!(n=n.next))return this;return(o=n.next)&&delete n.next,i?(o?i.next=o:delete i.next,this):t?(o?t[_]=o:delete t[_],(n=t[0]||t[1]||t[2]||t[3])&&n===(t[3]||t[2]||t[1]||t[0])&&!n.length&&(r?r[b]=n:this._root=n),this):(this._root=o,this)}function mg(e){for(var t=0,n=e.length;tg.index){var F=d-C.x-C.vx,I=p-C.y-C.vy,D=F*F+I*I;Dd+M||Ep+M||yu.r&&(u.r=u[f].r)}function a(){if(t){var u,f=t.length,c;for(n=new Array(f),u=0;u{}};function Ts(){for(var e=0,t=arguments.length,n={},r;e=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Ln.prototype=Ts.prototype={constructor:Ln,on:function(e,t){var n=this._,r=Mg(e+"",n),i,o=-1,l=r.length;if(arguments.length<2){for(;++o0)for(var n=new Array(i),r=0,i,o;r=0&&e._call.call(void 0,t),e=e._next;--Wt}function ol(){$t=(lr=mn.now())+pr,Wt=on=0;try{Dg()}finally{Wt=0,Pg(),$t=0}}function xg(){var e=mn.now(),t=e-lr;t>Vs&&(pr-=t,lr=e)}function Pg(){for(var e,t=or,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:or=n);ln=e,si(r)}function si(e){if(!Wt){on&&(on=clearTimeout(on));var t=e-$t;t>24?(e<1/0&&(on=setTimeout(ol,e-mn.now()-pr)),Jt&&(Jt=clearInterval(Jt))):(Jt||(lr=mn.now(),Jt=setInterval(xg,Vs)),Wt=1,zs(ol))}}const Ng=1664525,Og=1013904223,ll=4294967296;function Tg(){let e=1;return()=>(e=(Ng*e+Og)%ll)/ll}var Vg=10,zg=Math.PI*(3-Math.sqrt(5));function Hg(e){var t,n=1,r=.001,i=1-Math.pow(r,1/300),o=0,l=.6,s=new Map,a=Ls(c),u=Ts("tick","end"),f=Tg();e==null&&(e=[]);function c(){g(),u.call("tick",t),n1?(_==null?s.delete(m):s.set(m,p(_)),t):s.get(m)},find:function(m,_,b){var v=0,$=e.length,A,k,E,y,C;for(b==null?b=1/0:b*=b,v=0;v<$;++v)y=e[v],A=m-y.x,k=_-y.y,E=A*A+k*k,E1?(u.on(m,_),t):u.on(m)}}}function Lg(e){var t=Ke(.1),n,r,i;typeof e!="function"&&(e=Ke(e==null?0:+e));function o(s){for(var a=0,u=n.length,f;ae[4]?1:0),h(t,"class",d="file-circle-g "+(e[20].size>e[4]?"large":"")+" svelte-h2ab3o"),h(t,"style",p=e[5](e[20].x,e[20].y)),h(t,"role","img")},m(v,$){V(v,t,$),w(t,n),w(t,o),w(o,s),w(o,a),w(a,f),m=!0,_||(b=[K(t,"mouseover",e[6]),K(t,"mouseout",e[7]),K(t,"focus",e[6]),K(t,"blur",e[7])],_=!0)},p(v,$){(!m||$&12&&r!==(r=v[3](v[20].size)))&&h(n,"r",r),(!m||$&4)&&l!==(l=v[20].file+"")&&J(s,l),(!m||$&4)&&u!==(u=Qr(v[20].size)+"")&&J(f,u),(!m||$&20&&c!==(c=v[20].size>v[4]?1:0))&&h(o,"opacity",c),(!m||$&20&&d!==(d="file-circle-g "+(v[20].size>v[4]?"large":"")+" svelte-h2ab3o"))&&h(t,"class",d),(!m||$&4&&p!==(p=v[5](v[20].x,v[20].y)))&&h(t,"style",p)},i(v){m||(v&&Re(()=>{m&&(i||(i=dt(n,Cn,{duration:1e3},!0)),i.run(1))}),v&&Re(()=>{m&&(g||(g=dt(o,Cn,{duration:1e3},!0)),g.run(1))}),m=!0)},o(v){v&&(i||(i=dt(n,Cn,{duration:1e3},!1)),i.run(0)),v&&(g||(g=dt(o,Cn,{duration:1e3},!1)),g.run(0)),m=!1},d(v){v&&N(t),v&&i&&i.end(),v&&g&&g.end(),_=!1,we(b)}}}function Gg(e){let t,n,r,i,o=e[2],l=[];for(let a=0;aL(l[a],1,1,()=>{l[a]=null});return{c(){t=R("div"),n=U("svg");for(let a=0;ae[15].call(t))},m(a,u){V(a,t,u),w(t,n);for(let f=0;fn(14,f=k));let c=600,g=350,d=!0,p=!1;const m=(k,E)=>`transform: translate(${k}px, ${E}px)`,_=[-4,4],b=[-1,1];function v(){n(8,d=!0),n(9,p=!0);const k=Ct(this);Sr(".file-circle-g").select("text").style("opacity",0),k.raise(),k.select("circle").attr("fill","var(--red)"),k.select("text").style("opacity",1)}const $=()=>{const k=Sr(".file-circle-g");k.select("circle").attr("fill","var(--yellow)"),k.select("text").style("opacity",0),n(9,p=!1),setTimeout(()=>{n(8,d=!1)},1e3)};function A(){c=this.offsetWidth,g=this.offsetHeight,n(0,c),n(1,g)}return e.$$.update=()=>{e.$$.dirty&16387&&n(2,r=f.map(k=>({...k,x:c/2,y:g/2,tickCount:0}))),e.$$.dirty&16384&&console.log(f.map(k=>k.size).sort((k,E)=>k-E)),e.$$.dirty&1&&n(13,i=Lg().x(c/2)),e.$$.dirty&2&&n(12,o=qg().y(g/2)),e.$$.dirty&16384&&n(3,a=We().domain(sn(f,k=>k.size)).range([12,60])),e.$$.dirty&8&&n(10,l=Ag().radius(k=>a(k.size)+1).iterations(3)),e.$$.dirty&16384&&n(4,s=sc(f.map(k=>k.size).sort((k,E)=>k-E),.85)),e.$$.dirty&1&&We().domain(_).range([5,c]),e.$$.dirty&2&&We().domain(b).range([g,5]),e.$$.dirty&4&&n(11,u=Hg().nodes(r).on("tick",()=>{n(2,r=[...r])})),e.$$.dirty&15360&&(u.force("x",i),u.force("y",o),u.force("collide",l),u.alpha(.02),u.restart()),e.$$.dirty&19468&&(a.domain(sn(f,k=>k.size)),r.forEach(k=>k.radius=a(k.size)),u.nodes(r),l.radius(k=>k.radius+.5)),e.$$.dirty&768&&d===!1&&(p||Sr(".large").select("text").style("opacity",1))},[c,g,r,a,s,m,v,$,d,p,l,u,o,i,f,A]}class jg extends ge{constructor(t){super(),me(this,t,Bg,Gg,de,{})}}/** - * table-core - * - * Copyright (c) TanStack - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function pt(e,t){return typeof e=="function"?e(t):e}function Ge(e,t){return n=>{t.setState(r=>({...r,[e]:pt(n,r[e])}))}}function ar(e){return e instanceof Function}function Ug(e){return Array.isArray(e)&&e.every(t=>typeof t=="number")}function Wg(e,t){const n=[],r=i=>{i.forEach(o=>{n.push(o);const l=t(o);l!=null&&l.length&&r(l)})};return r(e),n}function B(e,t,n){let r=[],i;return()=>{let o;n.key&&n.debug&&(o=Date.now());const l=e();if(!(l.length!==r.length||l.some((u,f)=>r[f]!==u)))return i;r=l;let a;if(n.key&&n.debug&&(a=Date.now()),i=t(...l),n==null||n.onChange==null||n.onChange(i),n.key&&n.debug&&n!=null&&n.debug()){const u=Math.round((Date.now()-o)*100)/100,f=Math.round((Date.now()-a)*100)/100,c=f/16,g=(d,p)=>{for(d=String(d);d.length{let d=g;for(const m of a.split(".")){var p;d=(p=d)==null?void 0:p[m]}return d}:f=g=>g[s.accessorKey]),!u)throw new Error;let c={id:`${String(u)}`,accessorFn:f,parent:r,depth:n,columnDef:s,columns:[],getFlatColumns:B(()=>[!0],()=>{var g;return[c,...(g=c.columns)==null?void 0:g.flatMap(d=>d.getFlatColumns())]},{key:"column.getFlatColumns",debug:()=>{var g;return(g=e.options.debugAll)!=null?g:e.options.debugColumns}}),getLeafColumns:B(()=>[e._getOrderColumnsFn()],g=>{var d;if((d=c.columns)!=null&&d.length){let p=c.columns.flatMap(m=>m.getLeafColumns());return g(p)}return[c]},{key:"column.getLeafColumns",debug:()=>{var g;return(g=e.options.debugAll)!=null?g:e.options.debugColumns}})};return c=e._features.reduce((g,d)=>Object.assign(g,d.createColumn==null?void 0:d.createColumn(c,e)),c),c}function fl(e,t,n){var r;let o={id:(r=n.id)!=null?r:t.id,column:t,index:n.index,isPlaceholder:!!n.isPlaceholder,placeholderId:n.placeholderId,depth:n.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const l=[],s=a=>{a.subHeaders&&a.subHeaders.length&&a.subHeaders.map(s),l.push(a)};return s(o),l},getContext:()=>({table:e,header:o,column:t})};return e._features.forEach(l=>{Object.assign(o,l.createHeader==null?void 0:l.createHeader(o,e))}),o}const Yg={createTable:e=>({getHeaderGroups:B(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,i)=>{var o,l;const s=(o=r==null?void 0:r.map(c=>n.find(g=>g.id===c)).filter(Boolean))!=null?o:[],a=(l=i==null?void 0:i.map(c=>n.find(g=>g.id===c)).filter(Boolean))!=null?l:[],u=n.filter(c=>!(r!=null&&r.includes(c.id))&&!(i!=null&&i.includes(c.id)));return Dn(t,[...s,...u,...a],e)},{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getCenterHeaderGroups:B(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,i)=>(n=n.filter(o=>!(r!=null&&r.includes(o.id))&&!(i!=null&&i.includes(o.id))),Dn(t,n,e,"center")),{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getLeftHeaderGroups:B(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(t,n,r)=>{var i;const o=(i=r==null?void 0:r.map(l=>n.find(s=>s.id===l)).filter(Boolean))!=null?i:[];return Dn(t,o,e,"left")},{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getRightHeaderGroups:B(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(t,n,r)=>{var i;const o=(i=r==null?void 0:r.map(l=>n.find(s=>s.id===l)).filter(Boolean))!=null?i:[];return Dn(t,o,e,"right")},{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getFooterGroups:B(()=>[e.getHeaderGroups()],t=>[...t].reverse(),{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getLeftFooterGroups:B(()=>[e.getLeftHeaderGroups()],t=>[...t].reverse(),{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getCenterFooterGroups:B(()=>[e.getCenterHeaderGroups()],t=>[...t].reverse(),{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getRightFooterGroups:B(()=>[e.getRightHeaderGroups()],t=>[...t].reverse(),{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getFlatHeaders:B(()=>[e.getHeaderGroups()],t=>t.map(n=>n.headers).flat(),{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getLeftFlatHeaders:B(()=>[e.getLeftHeaderGroups()],t=>t.map(n=>n.headers).flat(),{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getCenterFlatHeaders:B(()=>[e.getCenterHeaderGroups()],t=>t.map(n=>n.headers).flat(),{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getRightFlatHeaders:B(()=>[e.getRightHeaderGroups()],t=>t.map(n=>n.headers).flat(),{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getCenterLeafHeaders:B(()=>[e.getCenterFlatHeaders()],t=>t.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getLeftLeafHeaders:B(()=>[e.getLeftFlatHeaders()],t=>t.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getRightLeafHeaders:B(()=>[e.getRightFlatHeaders()],t=>t.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getLeafHeaders:B(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(t,n,r)=>{var i,o,l,s,a,u;return[...(i=(o=t[0])==null?void 0:o.headers)!=null?i:[],...(l=(s=n[0])==null?void 0:s.headers)!=null?l:[],...(a=(u=r[0])==null?void 0:u.headers)!=null?a:[]].map(f=>f.getLeafHeaders()).flat()},{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}})})};function Dn(e,t,n,r){var i,o;let l=0;const s=function(g,d){d===void 0&&(d=1),l=Math.max(l,d),g.filter(p=>p.getIsVisible()).forEach(p=>{var m;(m=p.columns)!=null&&m.length&&s(p.columns,d+1)},0)};s(e);let a=[];const u=(g,d)=>{const p={depth:d,id:[r,`${d}`].filter(Boolean).join("_"),headers:[]},m=[];g.forEach(_=>{const b=[...m].reverse()[0],v=_.column.depth===p.depth;let $,A=!1;if(v&&_.column.parent?$=_.column.parent:($=_.column,A=!0),b&&(b==null?void 0:b.column)===$)b.subHeaders.push(_);else{const k=fl(n,$,{id:[r,d,$.id,_==null?void 0:_.id].filter(Boolean).join("_"),isPlaceholder:A,placeholderId:A?`${m.filter(E=>E.column===$).length}`:void 0,depth:d,index:m.length});k.subHeaders.push(_),m.push(k)}p.headers.push(_),_.headerGroup=p}),a.push(p),d>0&&u(m,d-1)},f=t.map((g,d)=>fl(n,g,{depth:l,index:d}));u(f,l-1),a.reverse();const c=g=>g.filter(p=>p.column.getIsVisible()).map(p=>{let m=0,_=0,b=[0];p.subHeaders&&p.subHeaders.length?(b=[],c(p.subHeaders).forEach($=>{let{colSpan:A,rowSpan:k}=$;m+=A,b.push(k)})):m=1;const v=Math.min(...b);return _=_+v,p.colSpan=m,p.rowSpan=_,{colSpan:m,rowSpan:_}});return c((i=(o=a[0])==null?void 0:o.headers)!=null?i:[]),a}const xn={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},Nr=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),Qg={getDefaultColumnDef:()=>xn,getInitialState:e=>({columnSizing:{},columnSizingInfo:Nr(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",onColumnSizingChange:Ge("columnSizing",e),onColumnSizingInfoChange:Ge("columnSizingInfo",e)}),createColumn:(e,t)=>({getSize:()=>{var n,r,i;const o=t.getState().columnSizing[e.id];return Math.min(Math.max((n=e.columnDef.minSize)!=null?n:xn.minSize,(r=o??e.columnDef.size)!=null?r:xn.size),(i=e.columnDef.maxSize)!=null?i:xn.maxSize)},getStart:n=>{const r=n?n==="left"?t.getLeftVisibleLeafColumns():t.getRightVisibleLeafColumns():t.getVisibleLeafColumns(),i=r.findIndex(o=>o.id===e.id);if(i>0){const o=r[i-1];return o.getStart(n)+o.getSize()}return 0},resetSize:()=>{t.setColumnSizing(n=>{let{[e.id]:r,...i}=n;return i})},getCanResize:()=>{var n,r;return((n=e.columnDef.enableResizing)!=null?n:!0)&&((r=t.options.enableColumnResizing)!=null?r:!0)},getIsResizing:()=>t.getState().columnSizingInfo.isResizingColumn===e.id}),createHeader:(e,t)=>({getSize:()=>{let n=0;const r=i=>{if(i.subHeaders.length)i.subHeaders.forEach(r);else{var o;n+=(o=i.column.getSize())!=null?o:0}};return r(e),n},getStart:()=>{if(e.index>0){const n=e.headerGroup.headers[e.index-1];return n.getStart()+n.getSize()}return 0},getResizeHandler:()=>{const n=t.getColumn(e.column.id),r=n==null?void 0:n.getCanResize();return i=>{if(!n||!r||(i.persist==null||i.persist(),Or(i)&&i.touches&&i.touches.length>1))return;const o=e.getSize(),l=e?e.getLeafHeaders().map(m=>[m.column.id,m.column.getSize()]):[[n.id,n.getSize()]],s=Or(i)?Math.round(i.touches[0].clientX):i.clientX,a={},u=(m,_)=>{typeof _=="number"&&(t.setColumnSizingInfo(b=>{var v,$;const A=_-((v=b==null?void 0:b.startOffset)!=null?v:0),k=Math.max(A/(($=b==null?void 0:b.startSize)!=null?$:0),-.999999);return b.columnSizingStart.forEach(E=>{let[y,C]=E;a[y]=Math.round(Math.max(C+C*k,0)*100)/100}),{...b,deltaOffset:A,deltaPercentage:k}}),(t.options.columnResizeMode==="onChange"||m==="end")&&t.setColumnSizing(b=>({...b,...a})))},f=m=>u("move",m),c=m=>{u("end",m),t.setColumnSizingInfo(_=>({..._,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},g={moveHandler:m=>f(m.clientX),upHandler:m=>{document.removeEventListener("mousemove",g.moveHandler),document.removeEventListener("mouseup",g.upHandler),c(m.clientX)}},d={moveHandler:m=>(m.cancelable&&(m.preventDefault(),m.stopPropagation()),f(m.touches[0].clientX),!1),upHandler:m=>{var _;document.removeEventListener("touchmove",d.moveHandler),document.removeEventListener("touchend",d.upHandler),m.cancelable&&(m.preventDefault(),m.stopPropagation()),c((_=m.touches[0])==null?void 0:_.clientX)}},p=Kg()?{passive:!1}:!1;Or(i)?(document.addEventListener("touchmove",d.moveHandler,p),document.addEventListener("touchend",d.upHandler,p)):(document.addEventListener("mousemove",g.moveHandler,p),document.addEventListener("mouseup",g.upHandler,p)),t.setColumnSizingInfo(m=>({...m,startOffset:s,startSize:o,deltaOffset:0,deltaPercentage:0,columnSizingStart:l,isResizingColumn:n.id}))}}}),createTable:e=>({setColumnSizing:t=>e.options.onColumnSizingChange==null?void 0:e.options.onColumnSizingChange(t),setColumnSizingInfo:t=>e.options.onColumnSizingInfoChange==null?void 0:e.options.onColumnSizingInfoChange(t),resetColumnSizing:t=>{var n;e.setColumnSizing(t?{}:(n=e.initialState.columnSizing)!=null?n:{})},resetHeaderSizeInfo:t=>{var n;e.setColumnSizingInfo(t?Nr():(n=e.initialState.columnSizingInfo)!=null?n:Nr())},getTotalSize:()=>{var t,n;return(t=(n=e.getHeaderGroups()[0])==null?void 0:n.headers.reduce((r,i)=>r+i.getSize(),0))!=null?t:0},getLeftTotalSize:()=>{var t,n;return(t=(n=e.getLeftHeaderGroups()[0])==null?void 0:n.headers.reduce((r,i)=>r+i.getSize(),0))!=null?t:0},getCenterTotalSize:()=>{var t,n;return(t=(n=e.getCenterHeaderGroups()[0])==null?void 0:n.headers.reduce((r,i)=>r+i.getSize(),0))!=null?t:0},getRightTotalSize:()=>{var t,n;return(t=(n=e.getRightHeaderGroups()[0])==null?void 0:n.headers.reduce((r,i)=>r+i.getSize(),0))!=null?t:0}})};let Pn=null;function Kg(){if(typeof Pn=="boolean")return Pn;let e=!1;try{const t={get passive(){return e=!0,!1}},n=()=>{};window.addEventListener("test",n,t),window.removeEventListener("test",n)}catch{e=!1}return Pn=e,Pn}function Or(e){return e.type==="touchstart"}const Jg={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:Ge("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let t=!1,n=!1;return{_autoResetExpanded:()=>{var r,i;if(!t){e._queue(()=>{t=!0});return}if((r=(i=e.options.autoResetAll)!=null?i:e.options.autoResetExpanded)!=null?r:!e.options.manualExpanding){if(n)return;n=!0,e._queue(()=>{e.resetExpanded(),n=!1})}},setExpanded:r=>e.options.onExpandedChange==null?void 0:e.options.onExpandedChange(r),toggleAllRowsExpanded:r=>{r??!e.getIsAllRowsExpanded()?e.setExpanded(!0):e.setExpanded({})},resetExpanded:r=>{var i,o;e.setExpanded(r?{}:(i=(o=e.initialState)==null?void 0:o.expanded)!=null?i:{})},getCanSomeRowsExpand:()=>e.getPrePaginationRowModel().flatRows.some(r=>r.getCanExpand()),getToggleAllRowsExpandedHandler:()=>r=>{r.persist==null||r.persist(),e.toggleAllRowsExpanded()},getIsSomeRowsExpanded:()=>{const r=e.getState().expanded;return r===!0||Object.values(r).some(Boolean)},getIsAllRowsExpanded:()=>{const r=e.getState().expanded;return typeof r=="boolean"?r===!0:!(!Object.keys(r).length||e.getRowModel().flatRows.some(i=>!i.getIsExpanded()))},getExpandedDepth:()=>{let r=0;return(e.getState().expanded===!0?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(o=>{const l=o.split(".");r=Math.max(r,l.length)}),r},getPreExpandedRowModel:()=>e.getSortedRowModel(),getExpandedRowModel:()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel?e.getPreExpandedRowModel():e._getExpandedRowModel())}},createRow:(e,t)=>({toggleExpanded:n=>{t.setExpanded(r=>{var i;const o=r===!0?!0:!!(r!=null&&r[e.id]);let l={};if(r===!0?Object.keys(t.getRowModel().rowsById).forEach(s=>{l[s]=!0}):l=r,n=(i=n)!=null?i:!o,!o&&n)return{...l,[e.id]:!0};if(o&&!n){const{[e.id]:s,...a}=l;return a}return r})},getIsExpanded:()=>{var n;const r=t.getState().expanded;return!!((n=t.options.getIsRowExpanded==null?void 0:t.options.getIsRowExpanded(e))!=null?n:r===!0||r!=null&&r[e.id])},getCanExpand:()=>{var n,r,i;return(n=t.options.getRowCanExpand==null?void 0:t.options.getRowCanExpand(e))!=null?n:((r=t.options.enableExpanding)!=null?r:!0)&&!!((i=e.subRows)!=null&&i.length)},getToggleExpandedHandler:()=>{const n=e.getCanExpand();return()=>{n&&e.toggleExpanded()}}})},qs=(e,t,n)=>{var r,i,o;const l=n.toLowerCase();return!!(!((r=e.getValue(t))==null||(i=r.toString())==null||(o=i.toLowerCase())==null)&&o.includes(l))};qs.autoRemove=e=>Xe(e);const Gs=(e,t,n)=>{var r,i;return!!(!((r=e.getValue(t))==null||(i=r.toString())==null)&&i.includes(n))};Gs.autoRemove=e=>Xe(e);const Bs=(e,t,n)=>{var r,i;return((r=e.getValue(t))==null||(i=r.toString())==null?void 0:i.toLowerCase())===(n==null?void 0:n.toLowerCase())};Bs.autoRemove=e=>Xe(e);const js=(e,t,n)=>{var r;return(r=e.getValue(t))==null?void 0:r.includes(n)};js.autoRemove=e=>Xe(e)||!(e!=null&&e.length);const Us=(e,t,n)=>!n.some(r=>{var i;return!((i=e.getValue(t))!=null&&i.includes(r))});Us.autoRemove=e=>Xe(e)||!(e!=null&&e.length);const Ws=(e,t,n)=>n.some(r=>{var i;return(i=e.getValue(t))==null?void 0:i.includes(r)});Ws.autoRemove=e=>Xe(e)||!(e!=null&&e.length);const Xs=(e,t,n)=>e.getValue(t)===n;Xs.autoRemove=e=>Xe(e);const Ys=(e,t,n)=>e.getValue(t)==n;Ys.autoRemove=e=>Xe(e);const Ei=(e,t,n)=>{let[r,i]=n;const o=e.getValue(t);return o>=r&&o<=i};Ei.resolveFilterValue=e=>{let[t,n]=e,r=typeof t!="number"?parseFloat(t):t,i=typeof n!="number"?parseFloat(n):n,o=t===null||Number.isNaN(r)?-1/0:r,l=n===null||Number.isNaN(i)?1/0:i;if(o>l){const s=o;o=l,l=s}return[o,l]};Ei.autoRemove=e=>Xe(e)||Xe(e[0])&&Xe(e[1]);const nt={includesString:qs,includesStringSensitive:Gs,equalsString:Bs,arrIncludes:js,arrIncludesAll:Us,arrIncludesSome:Ws,equals:Xs,weakEquals:Ys,inNumberRange:Ei};function Xe(e){return e==null||e===""}const Zg={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],globalFilter:void 0,...e}),getDefaultOptions:e=>({onColumnFiltersChange:Ge("columnFilters",e),onGlobalFilterChange:Ge("globalFilter",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100,globalFilterFn:"auto",getColumnCanGlobalFilter:t=>{var n,r;const i=(n=e.getCoreRowModel().flatRows[0])==null||(r=n._getAllCellsByColumnId()[t.id])==null?void 0:r.getValue();return typeof i=="string"||typeof i=="number"}}),createColumn:(e,t)=>({getAutoFilterFn:()=>{const n=t.getCoreRowModel().flatRows[0],r=n==null?void 0:n.getValue(e.id);return typeof r=="string"?nt.includesString:typeof r=="number"?nt.inNumberRange:typeof r=="boolean"||r!==null&&typeof r=="object"?nt.equals:Array.isArray(r)?nt.arrIncludes:nt.weakEquals},getFilterFn:()=>{var n,r;return ar(e.columnDef.filterFn)?e.columnDef.filterFn:e.columnDef.filterFn==="auto"?e.getAutoFilterFn():(n=(r=t.options.filterFns)==null?void 0:r[e.columnDef.filterFn])!=null?n:nt[e.columnDef.filterFn]},getCanFilter:()=>{var n,r,i;return((n=e.columnDef.enableColumnFilter)!=null?n:!0)&&((r=t.options.enableColumnFilters)!=null?r:!0)&&((i=t.options.enableFilters)!=null?i:!0)&&!!e.accessorFn},getCanGlobalFilter:()=>{var n,r,i,o;return((n=e.columnDef.enableGlobalFilter)!=null?n:!0)&&((r=t.options.enableGlobalFilter)!=null?r:!0)&&((i=t.options.enableFilters)!=null?i:!0)&&((o=t.options.getColumnCanGlobalFilter==null?void 0:t.options.getColumnCanGlobalFilter(e))!=null?o:!0)&&!!e.accessorFn},getIsFiltered:()=>e.getFilterIndex()>-1,getFilterValue:()=>{var n,r;return(n=t.getState().columnFilters)==null||(r=n.find(i=>i.id===e.id))==null?void 0:r.value},getFilterIndex:()=>{var n,r;return(n=(r=t.getState().columnFilters)==null?void 0:r.findIndex(i=>i.id===e.id))!=null?n:-1},setFilterValue:n=>{t.setColumnFilters(r=>{const i=e.getFilterFn(),o=r==null?void 0:r.find(f=>f.id===e.id),l=pt(n,o?o.value:void 0);if(cl(i,l,e)){var s;return(s=r==null?void 0:r.filter(f=>f.id!==e.id))!=null?s:[]}const a={id:e.id,value:l};if(o){var u;return(u=r==null?void 0:r.map(f=>f.id===e.id?a:f))!=null?u:[]}return r!=null&&r.length?[...r,a]:[a]})},_getFacetedRowModel:t.options.getFacetedRowModel&&t.options.getFacetedRowModel(t,e.id),getFacetedRowModel:()=>e._getFacetedRowModel?e._getFacetedRowModel():t.getPreFilteredRowModel(),_getFacetedUniqueValues:t.options.getFacetedUniqueValues&&t.options.getFacetedUniqueValues(t,e.id),getFacetedUniqueValues:()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,_getFacetedMinMaxValues:t.options.getFacetedMinMaxValues&&t.options.getFacetedMinMaxValues(t,e.id),getFacetedMinMaxValues:()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}}),createRow:(e,t)=>({columnFilters:{},columnFiltersMeta:{}}),createTable:e=>({getGlobalAutoFilterFn:()=>nt.includesString,getGlobalFilterFn:()=>{var t,n;const{globalFilterFn:r}=e.options;return ar(r)?r:r==="auto"?e.getGlobalAutoFilterFn():(t=(n=e.options.filterFns)==null?void 0:n[r])!=null?t:nt[r]},setColumnFilters:t=>{const n=e.getAllLeafColumns(),r=i=>{var o;return(o=pt(t,i))==null?void 0:o.filter(l=>{const s=n.find(a=>a.id===l.id);if(s){const a=s.getFilterFn();if(cl(a,l.value,s))return!1}return!0})};e.options.onColumnFiltersChange==null||e.options.onColumnFiltersChange(r)},setGlobalFilter:t=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(t)},resetGlobalFilter:t=>{e.setGlobalFilter(t?void 0:e.initialState.globalFilter)},resetColumnFilters:t=>{var n,r;e.setColumnFilters(t?[]:(n=(r=e.initialState)==null?void 0:r.columnFilters)!=null?n:[])},getPreFilteredRowModel:()=>e.getCoreRowModel(),getFilteredRowModel:()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel?e.getPreFilteredRowModel():e._getFilteredRowModel()),_getGlobalFacetedRowModel:e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,"__global__"),getGlobalFacetedRowModel:()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),_getGlobalFacetedUniqueValues:e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,"__global__"),getGlobalFacetedUniqueValues:()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,_getGlobalFacetedMinMaxValues:e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,"__global__"),getGlobalFacetedMinMaxValues:()=>{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}})};function cl(e,t,n){return(e&&e.autoRemove?e.autoRemove(t,n):!1)||typeof t>"u"||typeof t=="string"&&!t}const eh=(e,t,n)=>n.reduce((r,i)=>{const o=i.getValue(e);return r+(typeof o=="number"?o:0)},0),th=(e,t,n)=>{let r;return n.forEach(i=>{const o=i.getValue(e);o!=null&&(r>o||r===void 0&&o>=o)&&(r=o)}),r},nh=(e,t,n)=>{let r;return n.forEach(i=>{const o=i.getValue(e);o!=null&&(r=o)&&(r=o)}),r},rh=(e,t,n)=>{let r,i;return n.forEach(o=>{const l=o.getValue(e);l!=null&&(r===void 0?l>=l&&(r=i=l):(r>l&&(r=l),i{let n=0,r=0;if(t.forEach(i=>{let o=i.getValue(e);o!=null&&(o=+o)>=o&&(++n,r+=o)}),n)return r/n},oh=(e,t)=>{if(!t.length)return;const n=t.map(o=>o.getValue(e));if(!Ug(n))return;if(n.length===1)return n[0];const r=Math.floor(n.length/2),i=n.sort((o,l)=>o-l);return n.length%2!==0?i[r]:(i[r-1]+i[r])/2},lh=(e,t)=>Array.from(new Set(t.map(n=>n.getValue(e))).values()),sh=(e,t)=>new Set(t.map(n=>n.getValue(e))).size,ah=(e,t)=>t.length,Tr={sum:eh,min:th,max:nh,extent:rh,mean:ih,median:oh,unique:lh,uniqueCount:sh,count:ah},uh={getDefaultColumnDef:()=>({aggregatedCell:e=>{var t,n;return(t=(n=e.getValue())==null||n.toString==null?void 0:n.toString())!=null?t:null},aggregationFn:"auto"}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:Ge("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,t)=>({toggleGrouping:()=>{t.setGrouping(n=>n!=null&&n.includes(e.id)?n.filter(r=>r!==e.id):[...n??[],e.id])},getCanGroup:()=>{var n,r,i,o;return(n=(r=(i=(o=e.columnDef.enableGrouping)!=null?o:!0)!=null?i:t.options.enableGrouping)!=null?r:!0)!=null?n:!!e.accessorFn},getIsGrouped:()=>{var n;return(n=t.getState().grouping)==null?void 0:n.includes(e.id)},getGroupedIndex:()=>{var n;return(n=t.getState().grouping)==null?void 0:n.indexOf(e.id)},getToggleGroupingHandler:()=>{const n=e.getCanGroup();return()=>{n&&e.toggleGrouping()}},getAutoAggregationFn:()=>{const n=t.getCoreRowModel().flatRows[0],r=n==null?void 0:n.getValue(e.id);if(typeof r=="number")return Tr.sum;if(Object.prototype.toString.call(r)==="[object Date]")return Tr.extent},getAggregationFn:()=>{var n,r;if(!e)throw new Error;return ar(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:e.columnDef.aggregationFn==="auto"?e.getAutoAggregationFn():(n=(r=t.options.aggregationFns)==null?void 0:r[e.columnDef.aggregationFn])!=null?n:Tr[e.columnDef.aggregationFn]}}),createTable:e=>({setGrouping:t=>e.options.onGroupingChange==null?void 0:e.options.onGroupingChange(t),resetGrouping:t=>{var n,r;e.setGrouping(t?[]:(n=(r=e.initialState)==null?void 0:r.grouping)!=null?n:[])},getPreGroupedRowModel:()=>e.getFilteredRowModel(),getGroupedRowModel:()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel?e.getPreGroupedRowModel():e._getGroupedRowModel())}),createRow:(e,t)=>({getIsGrouped:()=>!!e.groupingColumnId,getGroupingValue:n=>{if(e._groupingValuesCache.hasOwnProperty(n))return e._groupingValuesCache[n];const r=t.getColumn(n);return r!=null&&r.columnDef.getGroupingValue?(e._groupingValuesCache[n]=r.columnDef.getGroupingValue(e.original),e._groupingValuesCache[n]):e.getValue(n)},_groupingValuesCache:{}}),createCell:(e,t,n,r)=>({getIsGrouped:()=>t.getIsGrouped()&&t.id===n.groupingColumnId,getIsPlaceholder:()=>!e.getIsGrouped()&&t.getIsGrouped(),getIsAggregated:()=>{var i;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!((i=n.subRows)!=null&&i.length)}})};function fh(e,t,n){if(!(t!=null&&t.length)||!n)return e;const r=e.filter(o=>!t.includes(o.id));return n==="remove"?r:[...t.map(o=>e.find(l=>l.id===o)).filter(Boolean),...r]}const ch={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:Ge("columnOrder",e)}),createTable:e=>({setColumnOrder:t=>e.options.onColumnOrderChange==null?void 0:e.options.onColumnOrderChange(t),resetColumnOrder:t=>{var n;e.setColumnOrder(t?[]:(n=e.initialState.columnOrder)!=null?n:[])},_getOrderColumnsFn:B(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(t,n,r)=>i=>{let o=[];if(!(t!=null&&t.length))o=i;else{const l=[...t],s=[...i];for(;s.length&&l.length;){const a=l.shift(),u=s.findIndex(f=>f.id===a);u>-1&&o.push(s.splice(u,1)[0])}o=[...o,...s]}return fh(o,n,r)},{key:!1})})},ai=0,ui=10,Vr=()=>({pageIndex:ai,pageSize:ui}),dh={getInitialState:e=>({...e,pagination:{...Vr(),...e==null?void 0:e.pagination}}),getDefaultOptions:e=>({onPaginationChange:Ge("pagination",e)}),createTable:e=>{let t=!1,n=!1;return{_autoResetPageIndex:()=>{var r,i;if(!t){e._queue(()=>{t=!0});return}if((r=(i=e.options.autoResetAll)!=null?i:e.options.autoResetPageIndex)!=null?r:!e.options.manualPagination){if(n)return;n=!0,e._queue(()=>{e.resetPageIndex(),n=!1})}},setPagination:r=>{const i=o=>pt(r,o);return e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(i)},resetPagination:r=>{var i;e.setPagination(r?Vr():(i=e.initialState.pagination)!=null?i:Vr())},setPageIndex:r=>{e.setPagination(i=>{let o=pt(r,i.pageIndex);const l=typeof e.options.pageCount>"u"||e.options.pageCount===-1?Number.MAX_SAFE_INTEGER:e.options.pageCount-1;return o=Math.max(0,Math.min(o,l)),{...i,pageIndex:o}})},resetPageIndex:r=>{var i,o,l;e.setPageIndex(r?ai:(i=(o=e.initialState)==null||(l=o.pagination)==null?void 0:l.pageIndex)!=null?i:ai)},resetPageSize:r=>{var i,o,l;e.setPageSize(r?ui:(i=(o=e.initialState)==null||(l=o.pagination)==null?void 0:l.pageSize)!=null?i:ui)},setPageSize:r=>{e.setPagination(i=>{const o=Math.max(1,pt(r,i.pageSize)),l=i.pageSize*i.pageIndex,s=Math.floor(l/o);return{...i,pageIndex:s,pageSize:o}})},setPageCount:r=>e.setPagination(i=>{var o;let l=pt(r,(o=e.options.pageCount)!=null?o:-1);return typeof l=="number"&&(l=Math.max(-1,l)),{...i,pageCount:l}}),getPageOptions:B(()=>[e.getPageCount()],r=>{let i=[];return r&&r>0&&(i=[...new Array(r)].fill(null).map((o,l)=>l)),i},{key:!1,debug:()=>{var r;return(r=e.options.debugAll)!=null?r:e.options.debugTable}}),getCanPreviousPage:()=>e.getState().pagination.pageIndex>0,getCanNextPage:()=>{const{pageIndex:r}=e.getState().pagination,i=e.getPageCount();return i===-1?!0:i===0?!1:re.setPageIndex(r=>r-1),nextPage:()=>e.setPageIndex(r=>r+1),getPrePaginationRowModel:()=>e.getExpandedRowModel(),getPaginationRowModel:()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel?e.getPrePaginationRowModel():e._getPaginationRowModel()),getPageCount:()=>{var r;return(r=e.options.pageCount)!=null?r:Math.ceil(e.getPrePaginationRowModel().rows.length/e.getState().pagination.pageSize)}}}},zr=()=>({left:[],right:[]}),gh={getInitialState:e=>({columnPinning:zr(),...e}),getDefaultOptions:e=>({onColumnPinningChange:Ge("columnPinning",e)}),createColumn:(e,t)=>({pin:n=>{const r=e.getLeafColumns().map(i=>i.id).filter(Boolean);t.setColumnPinning(i=>{var o,l;if(n==="right"){var s,a;return{left:((s=i==null?void 0:i.left)!=null?s:[]).filter(c=>!(r!=null&&r.includes(c))),right:[...((a=i==null?void 0:i.right)!=null?a:[]).filter(c=>!(r!=null&&r.includes(c))),...r]}}if(n==="left"){var u,f;return{left:[...((u=i==null?void 0:i.left)!=null?u:[]).filter(c=>!(r!=null&&r.includes(c))),...r],right:((f=i==null?void 0:i.right)!=null?f:[]).filter(c=>!(r!=null&&r.includes(c)))}}return{left:((o=i==null?void 0:i.left)!=null?o:[]).filter(c=>!(r!=null&&r.includes(c))),right:((l=i==null?void 0:i.right)!=null?l:[]).filter(c=>!(r!=null&&r.includes(c)))}})},getCanPin:()=>e.getLeafColumns().some(r=>{var i,o;return((i=r.columnDef.enablePinning)!=null?i:!0)&&((o=t.options.enablePinning)!=null?o:!0)}),getIsPinned:()=>{const n=e.getLeafColumns().map(s=>s.id),{left:r,right:i}=t.getState().columnPinning,o=n.some(s=>r==null?void 0:r.includes(s)),l=n.some(s=>i==null?void 0:i.includes(s));return o?"left":l?"right":!1},getPinnedIndex:()=>{var n,r,i;const o=e.getIsPinned();return o?(n=(r=t.getState().columnPinning)==null||(i=r[o])==null?void 0:i.indexOf(e.id))!=null?n:-1:0}}),createRow:(e,t)=>({getCenterVisibleCells:B(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left,t.getState().columnPinning.right],(n,r,i)=>{const o=[...r??[],...i??[]];return n.filter(l=>!o.includes(l.column.id))},{key:"row.getCenterVisibleCells",debug:()=>{var n;return(n=t.options.debugAll)!=null?n:t.options.debugRows}}),getLeftVisibleCells:B(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left,,],(n,r)=>(r??[]).map(o=>n.find(l=>l.column.id===o)).filter(Boolean).map(o=>({...o,position:"left"})),{key:"row.getLeftVisibleCells",debug:()=>{var n;return(n=t.options.debugAll)!=null?n:t.options.debugRows}}),getRightVisibleCells:B(()=>[e._getAllVisibleCells(),t.getState().columnPinning.right],(n,r)=>(r??[]).map(o=>n.find(l=>l.column.id===o)).filter(Boolean).map(o=>({...o,position:"right"})),{key:"row.getRightVisibleCells",debug:()=>{var n;return(n=t.options.debugAll)!=null?n:t.options.debugRows}})}),createTable:e=>({setColumnPinning:t=>e.options.onColumnPinningChange==null?void 0:e.options.onColumnPinningChange(t),resetColumnPinning:t=>{var n,r;return e.setColumnPinning(t?zr():(n=(r=e.initialState)==null?void 0:r.columnPinning)!=null?n:zr())},getIsSomeColumnsPinned:t=>{var n;const r=e.getState().columnPinning;if(!t){var i,o;return!!((i=r.left)!=null&&i.length||(o=r.right)!=null&&o.length)}return!!((n=r[t])!=null&&n.length)},getLeftLeafColumns:B(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(t,n)=>(n??[]).map(r=>t.find(i=>i.id===r)).filter(Boolean),{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugColumns}}),getRightLeafColumns:B(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(t,n)=>(n??[]).map(r=>t.find(i=>i.id===r)).filter(Boolean),{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugColumns}}),getCenterLeafColumns:B(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r)=>{const i=[...n??[],...r??[]];return t.filter(o=>!i.includes(o.id))},{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugColumns}})})},hh={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:Ge("rowSelection",e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>({setRowSelection:t=>e.options.onRowSelectionChange==null?void 0:e.options.onRowSelectionChange(t),resetRowSelection:t=>{var n;return e.setRowSelection(t?{}:(n=e.initialState.rowSelection)!=null?n:{})},toggleAllRowsSelected:t=>{e.setRowSelection(n=>{t=typeof t<"u"?t:!e.getIsAllRowsSelected();const r={...n},i=e.getPreGroupedRowModel().flatRows;return t?i.forEach(o=>{o.getCanSelect()&&(r[o.id]=!0)}):i.forEach(o=>{delete r[o.id]}),r})},toggleAllPageRowsSelected:t=>e.setRowSelection(n=>{const r=typeof t<"u"?t:!e.getIsAllPageRowsSelected(),i={...n};return e.getRowModel().rows.forEach(o=>{fi(i,o.id,r,e)}),i}),getPreSelectedRowModel:()=>e.getCoreRowModel(),getSelectedRowModel:B(()=>[e.getState().rowSelection,e.getCoreRowModel()],(t,n)=>Object.keys(t).length?Hr(e,n):{rows:[],flatRows:[],rowsById:{}},{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugTable}}),getFilteredSelectedRowModel:B(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(t,n)=>Object.keys(t).length?Hr(e,n):{rows:[],flatRows:[],rowsById:{}},{key:"getFilteredSelectedRowModel",debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugTable}}),getGroupedSelectedRowModel:B(()=>[e.getState().rowSelection,e.getSortedRowModel()],(t,n)=>Object.keys(t).length?Hr(e,n):{rows:[],flatRows:[],rowsById:{}},{key:"getGroupedSelectedRowModel",debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugTable}}),getIsAllRowsSelected:()=>{const t=e.getFilteredRowModel().flatRows,{rowSelection:n}=e.getState();let r=!!(t.length&&Object.keys(n).length);return r&&t.some(i=>i.getCanSelect()&&!n[i.id])&&(r=!1),r},getIsAllPageRowsSelected:()=>{const t=e.getPaginationRowModel().flatRows.filter(i=>i.getCanSelect()),{rowSelection:n}=e.getState();let r=!!t.length;return r&&t.some(i=>!n[i.id])&&(r=!1),r},getIsSomeRowsSelected:()=>{var t;const n=Object.keys((t=e.getState().rowSelection)!=null?t:{}).length;return n>0&&n{const t=e.getPaginationRowModel().flatRows;return e.getIsAllPageRowsSelected()?!1:t.filter(n=>n.getCanSelect()).some(n=>n.getIsSelected()||n.getIsSomeSelected())},getToggleAllRowsSelectedHandler:()=>t=>{e.toggleAllRowsSelected(t.target.checked)},getToggleAllPageRowsSelectedHandler:()=>t=>{e.toggleAllPageRowsSelected(t.target.checked)}}),createRow:(e,t)=>({toggleSelected:n=>{const r=e.getIsSelected();t.setRowSelection(i=>{if(n=typeof n<"u"?n:!r,r===n)return i;const o={...i};return fi(o,e.id,n,t),o})},getIsSelected:()=>{const{rowSelection:n}=t.getState();return Mi(e,n)},getIsSomeSelected:()=>{const{rowSelection:n}=t.getState();return dl(e,n)==="some"},getIsAllSubRowsSelected:()=>{const{rowSelection:n}=t.getState();return dl(e,n)==="all"},getCanSelect:()=>{var n;return typeof t.options.enableRowSelection=="function"?t.options.enableRowSelection(e):(n=t.options.enableRowSelection)!=null?n:!0},getCanSelectSubRows:()=>{var n;return typeof t.options.enableSubRowSelection=="function"?t.options.enableSubRowSelection(e):(n=t.options.enableSubRowSelection)!=null?n:!0},getCanMultiSelect:()=>{var n;return typeof t.options.enableMultiRowSelection=="function"?t.options.enableMultiRowSelection(e):(n=t.options.enableMultiRowSelection)!=null?n:!0},getToggleSelectedHandler:()=>{const n=e.getCanSelect();return r=>{var i;n&&e.toggleSelected((i=r.target)==null?void 0:i.checked)}}})},fi=(e,t,n,r)=>{var i;const o=r.getRow(t);n?(o.getCanMultiSelect()||Object.keys(e).forEach(l=>delete e[l]),o.getCanSelect()&&(e[t]=!0)):delete e[t],(i=o.subRows)!=null&&i.length&&o.getCanSelectSubRows()&&o.subRows.forEach(l=>fi(e,l.id,n,r))};function Hr(e,t){const n=e.getState().rowSelection,r=[],i={},o=function(l,s){return l.map(a=>{var u;const f=Mi(a,n);if(f&&(r.push(a),i[a.id]=a),(u=a.subRows)!=null&&u.length&&(a={...a,subRows:o(a.subRows)}),f)return a}).filter(Boolean)};return{rows:o(t.rows),flatRows:r,rowsById:i}}function Mi(e,t){var n;return(n=t[e.id])!=null?n:!1}function dl(e,t,n){if(e.subRows&&e.subRows.length){let r=!0,i=!1;return e.subRows.forEach(o=>{i&&!r||(Mi(o,t)?i=!0:r=!1)}),r?"all":i?"some":!1}return!1}const ci=/([0-9]+)/gm,ph=(e,t,n)=>Qs(mt(e.getValue(n)).toLowerCase(),mt(t.getValue(n)).toLowerCase()),mh=(e,t,n)=>Qs(mt(e.getValue(n)),mt(t.getValue(n))),_h=(e,t,n)=>Fi(mt(e.getValue(n)).toLowerCase(),mt(t.getValue(n)).toLowerCase()),vh=(e,t,n)=>Fi(mt(e.getValue(n)),mt(t.getValue(n))),wh=(e,t,n)=>{const r=e.getValue(n),i=t.getValue(n);return r>i?1:rFi(e.getValue(n),t.getValue(n));function Fi(e,t){return e===t?0:e>t?1:-1}function mt(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}function Qs(e,t){const n=e.split(ci).filter(Boolean),r=t.split(ci).filter(Boolean);for(;n.length&&r.length;){const i=n.shift(),o=r.shift(),l=parseInt(i,10),s=parseInt(o,10),a=[l,s].sort();if(isNaN(a[0])){if(i>o)return 1;if(o>i)return-1;continue}if(isNaN(a[1]))return isNaN(l)?-1:1;if(l>s)return 1;if(s>l)return-1}return n.length-r.length}const Zt={alphanumeric:ph,alphanumericCaseSensitive:mh,text:_h,textCaseSensitive:vh,datetime:wh,basic:bh},yh={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:Ge("sorting",e),isMultiSortEvent:t=>t.shiftKey}),createColumn:(e,t)=>({getAutoSortingFn:()=>{const n=t.getFilteredRowModel().flatRows.slice(10);let r=!1;for(const i of n){const o=i==null?void 0:i.getValue(e.id);if(Object.prototype.toString.call(o)==="[object Date]")return Zt.datetime;if(typeof o=="string"&&(r=!0,o.split(ci).length>1))return Zt.alphanumeric}return r?Zt.text:Zt.basic},getAutoSortDir:()=>{const n=t.getFilteredRowModel().flatRows[0];return typeof(n==null?void 0:n.getValue(e.id))=="string"?"asc":"desc"},getSortingFn:()=>{var n,r;if(!e)throw new Error;return ar(e.columnDef.sortingFn)?e.columnDef.sortingFn:e.columnDef.sortingFn==="auto"?e.getAutoSortingFn():(n=(r=t.options.sortingFns)==null?void 0:r[e.columnDef.sortingFn])!=null?n:Zt[e.columnDef.sortingFn]},toggleSorting:(n,r)=>{const i=e.getNextSortingOrder(),o=typeof n<"u"&&n!==null;t.setSorting(l=>{const s=l==null?void 0:l.find(d=>d.id===e.id),a=l==null?void 0:l.findIndex(d=>d.id===e.id);let u=[],f,c=o?n:i==="desc";if(l!=null&&l.length&&e.getCanMultiSort()&&r?s?f="toggle":f="add":l!=null&&l.length&&a!==l.length-1?f="replace":s?f="toggle":f="replace",f==="toggle"&&(o||i||(f="remove")),f==="add"){var g;u=[...l,{id:e.id,desc:c}],u.splice(0,u.length-((g=t.options.maxMultiSortColCount)!=null?g:Number.MAX_SAFE_INTEGER))}else f==="toggle"?u=l.map(d=>d.id===e.id?{...d,desc:c}:d):f==="remove"?u=l.filter(d=>d.id!==e.id):u=[{id:e.id,desc:c}];return u})},getFirstSortDir:()=>{var n,r;return((n=(r=e.columnDef.sortDescFirst)!=null?r:t.options.sortDescFirst)!=null?n:e.getAutoSortDir()==="desc")?"desc":"asc"},getNextSortingOrder:n=>{var r,i;const o=e.getFirstSortDir(),l=e.getIsSorted();return l?l!==o&&((r=t.options.enableSortingRemoval)==null||r)&&(!(n&&(i=t.options.enableMultiRemove)!=null)||i)?!1:l==="desc"?"asc":"desc":o},getCanSort:()=>{var n,r;return((n=e.columnDef.enableSorting)!=null?n:!0)&&((r=t.options.enableSorting)!=null?r:!0)&&!!e.accessorFn},getCanMultiSort:()=>{var n,r;return(n=(r=e.columnDef.enableMultiSort)!=null?r:t.options.enableMultiSort)!=null?n:!!e.accessorFn},getIsSorted:()=>{var n;const r=(n=t.getState().sorting)==null?void 0:n.find(i=>i.id===e.id);return r?r.desc?"desc":"asc":!1},getSortIndex:()=>{var n,r;return(n=(r=t.getState().sorting)==null?void 0:r.findIndex(i=>i.id===e.id))!=null?n:-1},clearSorting:()=>{t.setSorting(n=>n!=null&&n.length?n.filter(r=>r.id!==e.id):[])},getToggleSortingHandler:()=>{const n=e.getCanSort();return r=>{n&&(r.persist==null||r.persist(),e.toggleSorting==null||e.toggleSorting(void 0,e.getCanMultiSort()?t.options.isMultiSortEvent==null?void 0:t.options.isMultiSortEvent(r):!1))}}}),createTable:e=>({setSorting:t=>e.options.onSortingChange==null?void 0:e.options.onSortingChange(t),resetSorting:t=>{var n,r;e.setSorting(t?[]:(n=(r=e.initialState)==null?void 0:r.sorting)!=null?n:[])},getPreSortedRowModel:()=>e.getGroupedRowModel(),getSortedRowModel:()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel?e.getPreSortedRowModel():e._getSortedRowModel())})},Sh={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:Ge("columnVisibility",e)}),createColumn:(e,t)=>({toggleVisibility:n=>{e.getCanHide()&&t.setColumnVisibility(r=>({...r,[e.id]:n??!e.getIsVisible()}))},getIsVisible:()=>{var n,r;return(n=(r=t.getState().columnVisibility)==null?void 0:r[e.id])!=null?n:!0},getCanHide:()=>{var n,r;return((n=e.columnDef.enableHiding)!=null?n:!0)&&((r=t.options.enableHiding)!=null?r:!0)},getToggleVisibilityHandler:()=>n=>{e.toggleVisibility==null||e.toggleVisibility(n.target.checked)}}),createRow:(e,t)=>({_getAllVisibleCells:B(()=>[e.getAllCells(),t.getState().columnVisibility],n=>n.filter(r=>r.column.getIsVisible()),{key:"row._getAllVisibleCells",debug:()=>{var n;return(n=t.options.debugAll)!=null?n:t.options.debugRows}}),getVisibleCells:B(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(n,r,i)=>[...n,...r,...i],{key:!1,debug:()=>{var n;return(n=t.options.debugAll)!=null?n:t.options.debugRows}})}),createTable:e=>{const t=(n,r)=>B(()=>[r(),r().filter(i=>i.getIsVisible()).map(i=>i.id).join("_")],i=>i.filter(o=>o.getIsVisible==null?void 0:o.getIsVisible()),{key:n,debug:()=>{var i;return(i=e.options.debugAll)!=null?i:e.options.debugColumns}});return{getVisibleFlatColumns:t("getVisibleFlatColumns",()=>e.getAllFlatColumns()),getVisibleLeafColumns:t("getVisibleLeafColumns",()=>e.getAllLeafColumns()),getLeftVisibleLeafColumns:t("getLeftVisibleLeafColumns",()=>e.getLeftLeafColumns()),getRightVisibleLeafColumns:t("getRightVisibleLeafColumns",()=>e.getRightLeafColumns()),getCenterVisibleLeafColumns:t("getCenterVisibleLeafColumns",()=>e.getCenterLeafColumns()),setColumnVisibility:n=>e.options.onColumnVisibilityChange==null?void 0:e.options.onColumnVisibilityChange(n),resetColumnVisibility:n=>{var r;e.setColumnVisibility(n?{}:(r=e.initialState.columnVisibility)!=null?r:{})},toggleAllColumnsVisible:n=>{var r;n=(r=n)!=null?r:!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((i,o)=>({...i,[o.id]:n||!(o.getCanHide!=null&&o.getCanHide())}),{}))},getIsAllColumnsVisible:()=>!e.getAllLeafColumns().some(n=>!(n.getIsVisible!=null&&n.getIsVisible())),getIsSomeColumnsVisible:()=>e.getAllLeafColumns().some(n=>n.getIsVisible==null?void 0:n.getIsVisible()),getToggleAllColumnsVisibilityHandler:()=>n=>{var r;e.toggleAllColumnsVisible((r=n.target)==null?void 0:r.checked)}}}},gl=[Yg,Sh,ch,gh,Zg,yh,uh,Jg,dh,hh,Qg];function Ch(e){var t;(e.debugAll||e.debugTable)&&console.info("Creating Table Instance...");let n={_features:gl};const r=n._features.reduce((f,c)=>Object.assign(f,c.getDefaultOptions==null?void 0:c.getDefaultOptions(n)),{}),i=f=>n.options.mergeOptions?n.options.mergeOptions(r,f):{...r,...f};let l={...{},...(t=e.initialState)!=null?t:{}};n._features.forEach(f=>{var c;l=(c=f.getInitialState==null?void 0:f.getInitialState(l))!=null?c:l});const s=[];let a=!1;const u={_features:gl,options:{...r,...e},initialState:l,_queue:f=>{s.push(f),a||(a=!0,Promise.resolve().then(()=>{for(;s.length;)s.shift()();a=!1}).catch(c=>setTimeout(()=>{throw c})))},reset:()=>{n.setState(n.initialState)},setOptions:f=>{const c=pt(f,n.options);n.options=i(c)},getState:()=>n.options.state,setState:f=>{n.options.onStateChange==null||n.options.onStateChange(f)},_getRowId:(f,c,g)=>{var d;return(d=n.options.getRowId==null?void 0:n.options.getRowId(f,c,g))!=null?d:`${g?[g.id,c].join("."):c}`},getCoreRowModel:()=>(n._getCoreRowModel||(n._getCoreRowModel=n.options.getCoreRowModel(n)),n._getCoreRowModel()),getRowModel:()=>n.getPaginationRowModel(),getRow:f=>{const c=n.getRowModel().rowsById[f];if(!c)throw new Error;return c},_getDefaultColumnDef:B(()=>[n.options.defaultColumn],f=>{var c;return f=(c=f)!=null?c:{},{header:g=>{const d=g.header.column.columnDef;return d.accessorKey?d.accessorKey:d.accessorFn?d.id:null},cell:g=>{var d,p;return(d=(p=g.renderValue())==null||p.toString==null?void 0:p.toString())!=null?d:null},...n._features.reduce((g,d)=>Object.assign(g,d.getDefaultColumnDef==null?void 0:d.getDefaultColumnDef()),{}),...f}},{debug:()=>{var f;return(f=n.options.debugAll)!=null?f:n.options.debugColumns},key:!1}),_getColumnDefs:()=>n.options.columns,getAllColumns:B(()=>[n._getColumnDefs()],f=>{const c=function(g,d,p){return p===void 0&&(p=0),g.map(m=>{const _=Xg(n,m,p,d),b=m;return _.columns=b.columns?c(b.columns,_,p+1):[],_})};return c(f)},{key:!1,debug:()=>{var f;return(f=n.options.debugAll)!=null?f:n.options.debugColumns}}),getAllFlatColumns:B(()=>[n.getAllColumns()],f=>f.flatMap(c=>c.getFlatColumns()),{key:!1,debug:()=>{var f;return(f=n.options.debugAll)!=null?f:n.options.debugColumns}}),_getAllFlatColumnsById:B(()=>[n.getAllFlatColumns()],f=>f.reduce((c,g)=>(c[g.id]=g,c),{}),{key:!1,debug:()=>{var f;return(f=n.options.debugAll)!=null?f:n.options.debugColumns}}),getAllLeafColumns:B(()=>[n.getAllColumns(),n._getOrderColumnsFn()],(f,c)=>{let g=f.flatMap(d=>d.getLeafColumns());return c(g)},{key:!1,debug:()=>{var f;return(f=n.options.debugAll)!=null?f:n.options.debugColumns}}),getColumn:f=>n._getAllFlatColumnsById()[f]};return Object.assign(n,u),n._features.forEach(f=>Object.assign(n,f.createTable==null?void 0:f.createTable(n))),n}function kh(e,t,n,r){const i=()=>{var l;return(l=o.getValue())!=null?l:e.options.renderFallbackValue},o={id:`${t.id}_${n.id}`,row:t,column:n,getValue:()=>t.getValue(r),renderValue:i,getContext:B(()=>[e,n,t,o],(l,s,a,u)=>({table:l,column:s,row:a,cell:u,getValue:u.getValue,renderValue:u.renderValue}),{key:!1,debug:()=>e.options.debugAll})};return e._features.forEach(l=>{Object.assign(o,l.createCell==null?void 0:l.createCell(o,n,t,e))},{}),o}const Ii=(e,t,n,r,i,o,l)=>{let s={id:t,index:r,original:n,depth:i,parentId:l,_valuesCache:{},_uniqueValuesCache:{},getValue:a=>{if(s._valuesCache.hasOwnProperty(a))return s._valuesCache[a];const u=e.getColumn(a);if(u!=null&&u.accessorFn)return s._valuesCache[a]=u.accessorFn(s.original,r),s._valuesCache[a]},getUniqueValues:a=>{if(s._uniqueValuesCache.hasOwnProperty(a))return s._uniqueValuesCache[a];const u=e.getColumn(a);if(u!=null&&u.accessorFn)return u.columnDef.getUniqueValues?(s._uniqueValuesCache[a]=u.columnDef.getUniqueValues(s.original,r),s._uniqueValuesCache[a]):(s._uniqueValuesCache[a]=[s.getValue(a)],s._uniqueValuesCache[a])},renderValue:a=>{var u;return(u=s.getValue(a))!=null?u:e.options.renderFallbackValue},subRows:o??[],getLeafRows:()=>Wg(s.subRows,a=>a.subRows),getParentRow:()=>s.parentId?e.getRow(s.parentId):void 0,getParentRows:()=>{let a=[],u=s;for(;;){const f=u.getParentRow();if(!f)break;a.push(f),u=f}return a.reverse()},getAllCells:B(()=>[e.getAllLeafColumns()],a=>a.map(u=>kh(e,s,u,u.id)),{key:!1,debug:()=>{var a;return(a=e.options.debugAll)!=null?a:e.options.debugRows}}),_getAllCellsByColumnId:B(()=>[s.getAllCells()],a=>a.reduce((u,f)=>(u[f.column.id]=f,u),{}),{key:"row.getAllCellsByColumnId",debug:()=>{var a;return(a=e.options.debugAll)!=null?a:e.options.debugRows}})};for(let a=0;atypeof e=="function"?{...t,accessorFn:e}:{...t,accessorKey:e},display:e=>e,group:e=>e}}function hl(){return e=>B(()=>[e.options.data],t=>{const n={rows:[],flatRows:[],rowsById:{}},r=function(i,o,l){o===void 0&&(o=0);const s=[];for(let u=0;u{var t;return(t=e.options.debugAll)!=null?t:e.options.debugTable},onChange:()=>{e._autoResetPageIndex()}})}function Ks(e,t,n){return n.options.filterFromLeafRows?Rh(e,t,n):Ah(e,t,n)}function Rh(e,t,n){var r;const i=[],o={},l=(r=n.options.maxLeafRowFilterDepth)!=null?r:100,s=function(a,u){u===void 0&&(u=0);const f=[];for(let g=0;gB(()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter],(t,n,r)=>{if(!t.rows.length||!(n!=null&&n.length)&&!r){for(let g=0;g{var d;const p=e.getColumn(g.id);if(!p)return;const m=p.getFilterFn();m&&i.push({id:g.id,filterFn:m,resolvedValue:(d=m.resolveFilterValue==null?void 0:m.resolveFilterValue(g.value))!=null?d:g.value})});const l=n.map(g=>g.id),s=e.getGlobalFilterFn(),a=e.getAllLeafColumns().filter(g=>g.getCanGlobalFilter());r&&s&&a.length&&(l.push("__global__"),a.forEach(g=>{var d;o.push({id:g.id,filterFn:s,resolvedValue:(d=s.resolveFilterValue==null?void 0:s.resolveFilterValue(r))!=null?d:r})}));let u,f;for(let g=0;g{d.columnFiltersMeta[m]=_})}if(o.length){for(let p=0;p{d.columnFiltersMeta[m]=_})){d.columnFilters.__global__=!0;break}}d.columnFilters.__global__!==!0&&(d.columnFilters.__global__=!1)}}const c=g=>{for(let d=0;d{var t;return(t=e.options.debugAll)!=null?t:e.options.debugTable},onChange:()=>{e._autoResetPageIndex()}})}function ml(){return(e,t)=>B(()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter,e.getFilteredRowModel()],(n,r,i)=>{if(!n.rows.length||!(r!=null&&r.length)&&!i)return n;const o=[...r.map(s=>s.id).filter(s=>s!==t),i?"__global__":void 0].filter(Boolean),l=s=>{for(let a=0;a{var n;return(n=e.options.debugAll)!=null?n:e.options.debugTable},onChange:()=>{}})}function _l(){return e=>B(()=>[e.getState().sorting,e.getPreSortedRowModel()],(t,n)=>{if(!n.rows.length||!(t!=null&&t.length))return n;const r=e.getState().sorting,i=[],o=r.filter(a=>{var u;return(u=e.getColumn(a.id))==null?void 0:u.getCanSort()}),l={};o.forEach(a=>{const u=e.getColumn(a.id);u&&(l[a.id]={sortUndefined:u.columnDef.sortUndefined,invertSorting:u.columnDef.invertSorting,sortingFn:u.getSortingFn()})});const s=a=>{const u=[...a];return u.sort((f,c)=>{for(let d=0;d{var c;i.push(f),(c=f.subRows)!=null&&c.length&&(f.subRows=s(f.subRows))}),u};return{rows:s(n.rows),flatRows:i,rowsById:n.rowsById}},{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugTable},onChange:()=>{e._autoResetPageIndex()}})}function Eh(e){const t=[],n=r=>{var i;t.push(r),(i=r.subRows)!=null&&i.length&&r.getIsExpanded()&&r.subRows.forEach(n)};return e.rows.forEach(n),{rows:t,flatRows:e.flatRows,rowsById:e.rowsById}}function vl(e){return t=>B(()=>[t.getState().pagination,t.getPrePaginationRowModel(),t.options.paginateExpandedRows?void 0:t.getState().expanded],(n,r)=>{if(!r.rows.length)return r;const{pageSize:i,pageIndex:o}=n;let{rows:l,flatRows:s,rowsById:a}=r;const u=i*o,f=u+i;l=l.slice(u,f);let c;t.options.paginateExpandedRows?c={rows:l,flatRows:s,rowsById:a}:c=Eh({rows:l,flatRows:s,rowsById:a}),c.flatRows=[];const g=d=>{c.flatRows.push(d),d.subRows.length&&d.subRows.forEach(g)};return c.rows.forEach(g),c},{key:!1,debug:()=>{var n;return(n=t.options.debugAll)!=null?n:t.options.debugTable}})}/** - * svelte-table - * - * Copyright (c) TanStack - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function Mh(e){let t;return{c(){t=z(e[0])},l(n){t=da(n,e[0])},m(n,r){aa(n,t,r)},p(n,[r]){r&1&&J(t,n[0])},i:X,o:X,d(n){n&&N(t)}}}function Fh(e,t,n){let{content:r}=t;return e.$$set=i=>{"content"in i&&n(0,r=i.content)},[r]}class Ih extends ge{constructor(t){super(),me(this,t,Fh,Mh,de,{content:0})}}const Dh=Ql((e,t,n,r)=>`${Fa(t.content)}`);var xh=typeof document>"u"?Dh:Ih;function Ph(e,t,n){let r,i;return r=new t({props:n,$$inline:!0}),{c(){ce(r.$$.fragment)},l(o){Da(r.$$.fragment,o)},m(o,l){ae(r,o,l),i=!0},p:X,i(o){i||(T(r.$$.fragment,o),i=!0)},o(o){L(r.$$.fragment,o),i=!1},d(o){ue(r,o)}}}function Nh(e,t){return class extends ge{constructor(r){super(),me(this,r,null,i=>Ph(i,e,t),de,{},void 0)}}}function Oh(e,t){return Ql((r,i,o,l)=>`${Ia(e,"TableComponent").$$render(r,t,{},{})}`)}const di=typeof window>"u"?Oh:Nh;function Th(e){return typeof e=="object"&&typeof e.$$render=="function"&&typeof e.render=="function"}function Vh(e){var t,n;let r="__SVELTE_HMR"in window;return e.prototype instanceof ge||r&&((t=e.name)==null?void 0:t.startsWith("Proxy<"))&&((n=e.name)==null?void 0:n.endsWith(">"))}function wl(e){return typeof document>"u"?Th(e):Vh(e)}function bl(e){return di(xh,{content:e})}function ur(e,t){if(!e)return null;if(wl(e))return di(e,t);if(typeof e=="function"){const n=e(t);return n==null?null:wl(n)?di(n,t):bl(n)}return bl(e)}function yl(e){let t;"subscribe"in e?t=e:t=Br(e);let n={state:{},onStateChange:()=>{},renderFallbackValue:null,...ea(t)},r=Ch(n),i=Me(r.initialState),o=Pa([i,t],s=>s);return Br(r,function(a){const u=o.subscribe(f=>{let[c,g]=f;r.setOptions(d=>({...d,...g,state:{...c,...g.state},onStateChange:p=>{p instanceof Function?i.update(p):i.set(p),n.onStateChange==null||n.onStateChange(p)}})),a(r)});return function(){u()}})}/** - * match-sorter-utils - * - * Copyright (c) TanStack - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */const Js={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",áē¤:"A",áēŽ:"A",áē˛:"A",áē´:"A",áēļ:"A",Æ:"AE",áēĻ:"A",áē°:"A",Ȃ:"A",Ç:"C",Ḉ:"C",È:"E",É:"E",Ê:"E",Ë:"E",áēž:"E",Ḗ:"E",áģ€:"E",Ḕ:"E",Ḝ:"E",Ȇ:"E",Ì:"I",Í:"I",Î:"I",Ï:"I",Ḏ:"I",Ȋ:"I",Ð:"D",Ñ:"N",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",áģ:"O",Ṍ:"O",Ṓ:"O",Ȏ:"O",Ù:"U",Ú:"U",Û:"U",Ü:"U",Ý:"Y",à:"a",ÃĄ:"a",Ãĸ:"a",ÃŖ:"a",ä:"a",ÃĨ:"a",áēĨ:"a",áē¯:"a",áēŗ:"a",áēĩ:"a",áēˇ:"a",ÃĻ:"ae",áē§:"a",áēą:"a",ȃ:"a",ç:"c",ḉ:"c",è:"e",Ê:"e",ÃĒ:"e",ÃĢ:"e",áēŋ:"e",ḗ:"e",áģ:"e",ḕ:"e",ḝ:"e",ȇ:"e",ÃŦ:"i",í:"i",ÃŽ:"i",ï:"i",ḯ:"i",ȋ:"i",ð:"d",Ãą:"n",Ã˛:"o",Ãŗ:"o",ô:"o",Ãĩ:"o",Ãļ:"o",ø:"o",áģ‘:"o",ᚍ:"o",ṓ:"o",ȏ:"o",Ú:"u",Ãē:"u",Ãģ:"u",Ãŧ:"u",ÃŊ:"y",Ãŋ:"y",Ā:"A",ā:"a",Ă:"A",ă:"a",Ą:"A",ą:"a",Ć:"C",ć:"c",Ĉ:"C",ĉ:"c",Ċ:"C",ċ:"c",Č:"C",č:"c",CĖ†:"C",cĖ†:"c",Ď:"D",ď:"d",Đ:"D",đ:"d",Ē:"E",ē:"e",Ĕ:"E",ĕ:"e",Ė:"E",ė:"e",Ę:"E",ę:"e",Ě:"E",ě:"e",Ĝ:"G",Į´:"G",ĝ:"g",Įĩ:"g",Ğ:"G",ğ:"g",Ä :"G",ÄĄ:"g",Äĸ:"G",ÄŖ:"g",Ĥ:"H",ÄĨ:"h",ÄĻ:"H",ħ:"h",á¸Ē:"H",á¸Ģ:"h",Ĩ:"I",ÄŠ:"i",ÄĒ:"I",ÄĢ:"i",ÄŦ:"I",Ä­:"i",ÄŽ:"I",į:"i",Ä°:"I",Äą:"i",IJ:"IJ",Äŗ:"ij",Ä´:"J",Äĩ:"j",Äļ:"K",ġ:"k",Ḱ:"K",ḹ:"k",KĖ†:"K",kĖ†:"k",Äš:"L",Äē:"l",Äģ:"L",Äŧ:"l",ÄŊ:"L",Äž:"l",Äŋ:"L",ŀ:"l",Ł:"l",ł:"l",Ḟ:"M",á¸ŋ:"m",MĖ†:"M",mĖ†:"m",Ń:"N",ń:"n",Ņ:"N",ņ:"n",Ň:"N",ň:"n",ʼn:"n",NĖ†:"N",nĖ†:"n",Ō:"O",ō:"o",Ŏ:"O",ŏ:"o",Ő:"O",ő:"o",Œ:"OE",œ:"oe",PĖ†:"P",pĖ†:"p",Ŕ:"R",ŕ:"r",Ŗ:"R",ŗ:"r",Ř:"R",ř:"r",RĖ†:"R",rĖ†:"r",Ȓ:"R",ȓ:"r",Ś:"S",ś:"s",Ŝ:"S",ŝ:"s",Ş:"S",Ș:"S",ș:"s",ş:"s",Å :"S",ÅĄ:"s",Åĸ:"T",ÅŖ:"t",ț:"t",Ț:"T",Ť:"T",ÅĨ:"t",ÅĻ:"T",ŧ:"t",TĖ†:"T",tĖ†:"t",Ũ:"U",ÅŠ:"u",ÅĒ:"U",ÅĢ:"u",ÅŦ:"U",Å­:"u",ÅŽ:"U",ů:"u",Å°:"U",Åą:"u",Å˛:"U",Åŗ:"u",Ȗ:"U",ȗ:"u",VĖ†:"V",vĖ†:"v",Å´:"W",Åĩ:"w",áē‚:"W",áēƒ:"w",XĖ†:"X",xĖ†:"x",Åļ:"Y",Åˇ:"y",Ÿ:"Y",YĖ†:"Y",yĖ†:"y",Åš:"Z",Åē:"z",Åģ:"Z",Åŧ:"z",ÅŊ:"Z",Åž:"z",Åŋ:"s",ƒ:"f",Æ :"O",ÆĄ:"o",Ư:"U",Æ°:"u",Į:"A",ĮŽ:"a",Į:"I",Į:"i",Į‘:"O",Į’:"o",Į“:"U",Į”:"u",Į•:"U",Į–:"u",Į—:"U",Į˜:"u",Į™:"U",Įš:"u",Į›:"U",Įœ:"u",áģ¨:"U",áģŠ:"u",ᚸ:"U",ášš:"u",Įē:"A",Įģ:"a",Įŧ:"AE",ĮŊ:"ae",Įž:"O",Įŋ:"o",Þ:"TH",Þ:"th",Ṕ:"P",ṕ:"p",ᚤ:"S",ášĨ:"s",XĖ:"X",xĖ:"x",Ѓ:"Г",Ņ“:"Đŗ",Ќ:"К",Ņœ:"Đē",AĖ‹:"A",aĖ‹:"a",EĖ‹:"E",eĖ‹:"e",IĖ‹:"I",iĖ‹:"i",Į¸:"N",Įš:"n",áģ’:"O",áģ“:"o",ᚐ:"O",ṑ:"o",áģĒ:"U",áģĢ:"u",áē€:"W",áē:"w",áģ˛:"Y",áģŗ:"y",Ȁ:"A",ȁ:"a",Ȅ:"E",ȅ:"e",Ȉ:"I",ȉ:"i",Ȍ:"O",ȍ:"o",Ȑ:"R",ȑ:"r",Ȕ:"U",ȕ:"u",BĖŒ:"B",bĖŒ:"b",ČĖŖ:"C",čĖŖ:"c",ÊĖŒ:"E",ÃĒĖŒ:"e",FĖŒ:"F",fĖŒ:"f",ĮĻ:"G",Į§:"g",Ȟ:"H",ȟ:"h",JĖŒ:"J",Į°:"j",Į¨:"K",ĮŠ:"k",MĖŒ:"M",mĖŒ:"m",PĖŒ:"P",pĖŒ:"p",QĖŒ:"Q",qĖŒ:"q",ŘĖŠ:"R",řĖŠ:"r",ášĻ:"S",ᚧ:"s",VĖŒ:"V",vĖŒ:"v",WĖŒ:"W",wĖŒ:"w",XĖŒ:"X",xĖŒ:"x",YĖŒ:"Y",yĖŒ:"y",AĖ§:"A",aĖ§:"a",BĖ§:"B",bĖ§:"b",Ḑ:"D",ḑ:"d",Ȩ:"E",ČŠ:"e",ƐĖ§:"E",ɛĖ§:"e",Ḩ:"H",Ḋ:"h",IĖ§:"I",iĖ§:"i",ƗĖ§:"I",ɨĖ§:"i",MĖ§:"M",mĖ§:"m",OĖ§:"O",oĖ§:"o",QĖ§:"Q",qĖ§:"q",UĖ§:"U",uĖ§:"u",XĖ§:"X",xĖ§:"x",ZĖ§:"Z",zĖ§:"z"},zh=Object.keys(Js).join("|"),Hh=new RegExp(zh,"g");function Lh(e){return e.replace(Hh,t=>Js[t])}/** - * @name match-sorter - * @license MIT license. - * @copyright (c) 2099 Kent C. Dodds - * @author Kent C. Dodds (https://kentcdodds.com) - */const Pe={CASE_SENSITIVE_EQUAL:7,EQUAL:6,STARTS_WITH:5,WORD_STARTS_WITH:4,CONTAINS:3,ACRONYM:2,MATCHES:1,NO_MATCH:0};function qh(e,t,n){var r;if(n=n||{},n.threshold=(r=n.threshold)!=null?r:Pe.MATCHES,!n.accessors){const l=Sl(e,t,n);return{rankedValue:e,rank:l,accessorIndex:-1,accessorThreshold:n.threshold,passed:l>=n.threshold}}const i=Uh(e,n.accessors),o={rankedValue:e,rank:Pe.NO_MATCH,accessorIndex:-1,accessorThreshold:n.threshold,passed:!1};for(let l=0;l=Pe.MATCHES?a=u:a>f&&(a=f),a=Math.min(a,f),a>=c&&a>o.rank&&(o.rank=a,o.passed=!0,o.accessorIndex=l,o.accessorThreshold=c,o.rankedValue=s.itemValue)}return o}function Sl(e,t,n){return e=Cl(e,n),t=Cl(t,n),t.length>e.length?Pe.NO_MATCH:e===t?Pe.CASE_SENSITIVE_EQUAL:(e=e.toLowerCase(),t=t.toLowerCase(),e===t?Pe.EQUAL:e.startsWith(t)?Pe.STARTS_WITH:e.includes(` ${t}`)?Pe.WORD_STARTS_WITH:e.includes(t)?Pe.CONTAINS:t.length===1?Pe.NO_MATCH:Gh(e).includes(t)?Pe.ACRONYM:Bh(e,t))}function Gh(e){let t="";return e.split(" ").forEach(r=>{r.split("-").forEach(o=>{t+=o.substr(0,1)})}),t}function Bh(e,t){let n=0,r=0;function i(a,u,f){for(let c=f,g=u.length;c-1))return Pe.NO_MATCH}const s=r-l;return o(s)}function Cl(e,t){let{keepDiacritics:n}=t;return e=`${e}`,n||(e=Lh(e)),e}function jh(e,t){let n=t;typeof t=="object"&&(n=t.accessor);const r=n(e);return r==null?[]:Array.isArray(r)?r:[String(r)]}function Uh(e,t){const n=[];for(let r=0,i=t.length;r{ue(p,1)}),$e()}f?(n=qt(f,c()),ce(n.$$.fragment),T(n.$$.fragment,1),ae(n,t,r)):n=null}},i(g){s||(n&&T(n.$$.fragment,g),s=!0)},o(g){n&&L(n.$$.fragment,g),s=!1},d(g){g&&N(t),n&&ue(n),a=!1,u()}}}function Ml(e){let t,n,r=!e[26].isPlaceholder&&Xh(e);return{c(){t=R("th"),r&&r.c(),h(t,"colspan",e[26].colSpan),h(t,"class","svelte-16fb3tv")},m(i,o){V(i,t,o),r&&r.m(t,null),n=!0},p(i,o){i[26].isPlaceholder||r.p(i,o)},i(i){n||(T(r),n=!0)},o(i){L(r),n=!1},d(i){i&&N(t),r&&r.d()}}}function Fl(e){let t,n,r,i=e[23].headers,o=[];for(let s=0;sL(o[s],1,1,()=>{o[s]=null});return{c(){t=R("tr");for(let s=0;s{ue(u,1)}),$e()}o?(r=qt(o,l()),ce(r.$$.fragment),T(r.$$.fragment,1),ae(r,n,null)):r=null}},i(s){i||(r&&T(r.$$.fragment,s),i=!0)},o(s){r&&L(r.$$.fragment,s),i=!1},d(s){s&&N(n),r&&ue(r)}}}function Dl(e){let t,n=[],r=new Map,i,o,l=e[17].getVisibleCells();const s=a=>a[20].id;for(let a=0;a",ye,he,te,pe,ut,Ye=e[5],Q=[];for(let O=0;OL(Q[O],1,1,()=>{Q[O]=null});let He=e[1].getRowModel().rows,ne=[];for(let O=0;OL(ne[O],1,1,()=>{ne[O]=null});return{c(){t=R("div"),n=R("input"),r=P(),i=R("div"),o=R("table"),l=R("thead");for(let O=0;O(o(),o=fr(b,k=>n(1,i=k)),b);ie(e,sr,k=>n(8,r=k)),e.$$.on_destroy.push(()=>o());const s=(k,E,y,C)=>{if(console.log("yessir"),Array.isArray(y))return y.length===0?!0:y.includes(k.getValue(E));typeof y=="number"&&(y=String(y));const S=qh(k.getValue(E),y);return C({itemRank:S}),S.passed},a=$h(),u=[a.accessor("file",{header:"File",cell:k=>k.getValue(),footer:k=>k.column.id}),a.accessor("size",{header:"Size",cell:k=>Qr(k.getValue()),footer:k=>k.column.id}),a.accessor("type",{header:"Type",cell:k=>k.getValue(),footer:k=>k.column.id})];let f="",c=Me({data:r,columns:u,getCoreRowModel:hl(),getSortedRowModel:_l(),getFilteredRowModel:pl(),globalFilterFn:s,getFacetedRowModel:ml(),getPaginationRowModel:vl(),state:{globalFilter:f,pagination:{pageSize:7,pageIndex:0}},enableGlobalFilter:!0});function g(k){n(6,f=k),c.update(E=>({...E,state:{...E.state,globalFilter:k}}))}function d(k){c.update(E=>{var y;return{...E,state:{...E.state,pagination:{...(y=E.state)==null?void 0:y.pagination,pageIndex:k}}}})}let p;function m(k){clearTimeout(p),p=setTimeout(()=>{const E=k.target;g(E.value)},100)}function _(k){const E=k.target;d(parseInt(E.value)-1)}let b=yl(c);l();let v=i.getHeaderGroups();const $=()=>d(i.getState().pagination.pageIndex-1),A=()=>d(i.getState().pagination.pageIndex+1);return e.$$.update=()=>{e.$$.dirty&448&&(n(7,c={data:r,columns:u,getCoreRowModel:hl(),getSortedRowModel:_l(),getFilteredRowModel:pl(),globalFilterFn:s,getFacetedRowModel:ml(),getPaginationRowModel:vl(),state:{globalFilter:f,pagination:{pageSize:7,pageIndex:0}},enableGlobalFilter:!0}),l(n(0,b=yl(Me(c)))))},[b,i,d,m,_,v,f,c,r,$,A]}class Jh extends ge{constructor(t){super(),me(this,t,Kh,Yh,de,{})}}function xl(e){let t,n;return{c(){t=R("p"),n=z(e[3])},m(r,i){V(r,t,i),w(t,n)},p(r,i){i&8&&J(n,r[3])},d(r){r&&N(t)}}}function Pl(e){let t;return{c(){t=R("p"),t.textContent="Data Successfully indexed!"},m(n,r){V(n,t,r)},d(n){n&&N(t)}}}function Nl(e){let t,n;return t=new Jh({}),{c(){ce(t.$$.fragment)},m(r,i){ae(t,r,i),n=!0},i(r){n||(T(t.$$.fragment,r),n=!0)},o(r){L(t.$$.fragment,r),n=!1},d(r){ue(t,r)}}}function Zh(e){let t,n,r,i,o,l,s,a,u,f,c,g,d,p,m,_,b,v,$,A,k,E,y,C=e[2]&&!e[1]&&xl(e),S=e[1]&&Pl();$=new jg({});let M=e[0]&&Nl();return{c(){t=R("div"),n=R("div"),r=R("div"),i=R("div"),o=R("h4"),o.textContent="Upload Data",l=P(),s=R("br"),a=P(),u=R("form"),f=R("input"),c=P(),C&&C.c(),g=P(),S&&S.c(),d=P(),p=R("p"),p.textContent="These are the files your model will use as context.",m=P(),_=R("p"),_.innerHTML="Currently pdf, txt, and md are supported.",b=P(),v=R("div"),ce($.$$.fragment),A=P(),M&&M.c(),h(f,"type","file"),f.multiple=!0,h(i,"class","upload-box svelte-1lu6hos"),h(r,"class","upload-container svelte-1lu6hos"),h(n,"class","file-container svelte-1lu6hos"),h(v,"class","charts-container svelte-1lu6hos"),h(t,"class","data-grid svelte-1lu6hos")},m(F,I){V(F,t,I),w(t,n),w(n,r),w(r,i),w(i,o),w(i,l),w(i,s),w(i,a),w(i,u),w(u,f),w(i,c),C&&C.m(i,null),w(i,g),S&&S.m(i,null),w(i,d),w(i,p),w(i,m),w(i,_),w(t,b),w(t,v),ae($,v,null),w(v,A),M&&M.m(v,null),k=!0,E||(y=K(f,"change",e[4]),E=!0)},p(F,[I]){F[2]&&!F[1]?C?C.p(F,I):(C=xl(F),C.c(),C.m(i,g)):C&&(C.d(1),C=null),F[1]?S||(S=Pl(),S.c(),S.m(i,d)):S&&(S.d(1),S=null),F[0]?M?I&1&&T(M,1):(M=Nl(),M.c(),T(M,1),M.m(v,null)):M&&(ke(),L(M,1,1,()=>{M=null}),$e())},i(F){k||(T($.$$.fragment,F),T(M),k=!0)},o(F){L($.$$.fragment,F),L(M),k=!1},d(F){F&&N(t),C&&C.d(),S&&S.d(),ue($),M&&M.d(),E=!1,y()}}}function ep(e,t,n){let r,i,o;ie(e,sl,p=>n(6,i=p)),ie(e,sr,p=>n(7,o=p));let l=[],s=!1,a=!1;async function u(p){n(0,l=p.target.files);const m=new FormData;for(let _=0;_({file:b.name,size:b.size,type:b.type}));Ue(sr,o=[..._],o)}async function c(){console.log("index!"),n(2,a=!0),await(await fetch("/retrieval/vector_db/index",{method:"POST"})).json(),n(1,s=!0),n(2,a=!1)}async function g(){console.log("getting embeddings...");const m=await(await fetch("/retrieval/vector_db/get")).json();console.log("embeddingData",m),Ue(sl,i=m,i)}Xt(()=>{f()});let d=0;return setInterval(()=>{n(5,d=(d+1)%4)},200),e.$$.update=()=>{e.$$.dirty&32&&n(3,r="Indexing"+".".repeat(d))},[l,s,a,r,u,d]}class tp extends ge{constructor(t){super(),me(this,t,ep,Zh,de,{})}}function Ol(e,t,n){const r=e.slice();return r[7]=t[n],r}function Tl(e){let t,n=e[0],r=[];for(let i=0;i{ue(f,1)}),$e()}o?(t=qt(o,l()),ce(t.$$.fragment),T(t.$$.fragment,1),ae(t,n.parentNode,n)):t=null}else o&&t.$set(u)},i(s){r||(t&&T(t.$$.fragment,s),r=!0)},o(s){t&&L(t.$$.fragment,s),r=!1},d(s){s&&N(n),t&&ue(t,s)}}}function np(e){let t,n,r,i=e[0].length>1&&Tl(e),o=e[1]&&zl(e);return{c(){i&&i.c(),t=P(),o&&o.c(),n=lt()},m(l,s){i&&i.m(l,s),V(l,t,s),o&&o.m(l,s),V(l,n,s),r=!0},p(l,[s]){l[0].length>1?i?i.p(l,s):(i=Tl(l),i.c(),i.m(t.parentNode,t)):i&&(i.d(1),i=null),l[1]?o?(o.p(l,s),s&2&&T(o,1)):(o=zl(l),o.c(),T(o,1),o.m(n.parentNode,n)):o&&(ke(),L(o,1,1,()=>{o=null}),$e())},i(l){r||(T(o),r=!0)},o(l){L(o),r=!1},d(l){i&&i.d(l),l&&N(t),o&&o.d(l),l&&N(n)}}}function rp(e,t,n){let r,i;const o=Me([]);ie(e,o,f=>n(0,r=f));const l=Me(null);ie(e,l,f=>n(1,i=f));const s={Chatbot:Tf,Dropdown:Hf,Feedback:Dd,Compare:ag,RetrievalQA:tp},a=f=>{l.set(f)};return fetch("/components").then(f=>{if(!f.ok)throw new Error(`HTTP error! status: ${f.status}`);return f.json()}).then(f=>{o.set(f),l.set(f[0])}).catch(f=>{console.log("Fetch request failed",f)}),[r,i,o,l,s,a,f=>a(f)]}class ip extends ge{constructor(t){super(),me(this,t,rp,np,de,{})}}new ip({target:document.getElementById("app")}); diff --git a/pykoi/frontend/dist/assets/index-6e8a727f.css b/pykoi/frontend/dist/assets/index-6e8a727f.css new file mode 100644 index 0000000..9767a75 --- /dev/null +++ b/pykoi/frontend/dist/assets/index-6e8a727f.css @@ -0,0 +1 @@ +@import"https://fonts.googleapis.com/css?family=Work+Sans:400|Lato:400|Inconsolata:400";:root{font-family:Inter,system-ui,Avenir,Helvetica,Arial,sans-serif;line-height:1.5;font-weight:400;color-scheme:light dark;color:#ffffffde;background-color:#242424;font-synthesis:none;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;-webkit-text-size-adjust:100%}a{font-weight:500;color:#646cff;text-decoration:inherit}a:hover{color:#535bf2}body{margin:auto;width:100%}h1{font-size:3.2em;line-height:1.1}.card{padding:2em}#app{margin:0 auto;text-align:center}button{border-radius:8px;border:1px solid transparent;padding:.6em 1.2em;font-size:1em;font-weight:500;font-family:inherit;background-color:#1a1a1a;cursor:pointer;transition:border-color .25s}button:hover{border-color:#646cff}button:focus,button:focus-visible{outline:4px auto -webkit-focus-ring-color}@media (prefers-color-scheme: light){:root{color:#213547;background-color:#fff}a:hover{color:#747bff}button{background-color:#f9f9f9}}:root{--green: #00ebc7;--red: #FF5470;--yellow: #fde24f;--black: #1b2d45;--darkBlue: #00214d;--darkGrey: #222;--grey: #bfbfbf;--lightGrey: #f2f4f6;--white: white;--primary: var(--yellow);--danger: var(--red);--background: var(--lightGrey);--textColor: var(--black);--lineColor: var(--grey);--cardBg: var(--white);--headerBackground: var(--white);--footerBackground: var(--darkBlue);--footerTextColor: var(--lightGrey);--headerTextColor: var(--black);--buttonColor: var(--primary);--buttonTextColor: var(--textColor);--borderBottom: solid 2px var(--primary);--line: solid 1px var(--lineColor);--headingFont: "Lato", monospace;--bodyFont: "Inconsolata", sans-serif;--baseFontSize: 100%;--h1: 3.052em;--h2: 2.441em;--h3: 1.953em;--h4: 1.563em;--h5: 1.25em;--smallText: .8em;--shadow-s: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--shadow-md: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--shadow-lg: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--shadow-xl: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--containerPadding: 2.5%;--headerHeight: 3rem;--borderRadius: 0px}header{color:var(--headerTextColor);position:fixed;left:0;top:0;width:100%;height:var(--headerHeight);background:var(--headerBackground);border-bottom:var(--line);display:flex;justify-content:space-between;align-items:center;padding:0 var(--containerPadding)}footer{color:var(--footerTextColor);background-color:var(--footerBackground);padding:calc(var(--headerHeight) * .75) var(--containerPadding);text-align:center;position:absolute;bottom:0;width:100%}button{-webkit-appearance:none;-moz-appearance:none;appearance:none;color:var(--buttonTextColor);background-color:var(--white);border:var(--line);border-radius:var(--borderRadius);padding:5px 25px;box-shadow:var(--shadow-s);transition:.3s ease-in-out box-shadow}.dark{--background: var(--black);--textColor: var(--lightGrey);--headerBackground: var(--darkGrey);--footerBackground: var(--darkGrey);--cardBg: var(--darkGrey);--buttonTextColor: var(--black)}.theme{--green: #00ebc7;--red: #FF5470;--yellow: #fde24f;--black: #1b2d45;--darkBlue: #00214d;--darkGrey: #222;--grey: #bfbfbf;--lightGrey: #f2f4f6;--white: white;--primary: var(--green);--danger: var(--red);--background: var(--lightGrey);--textColor: var(--black);--lineColor: var(--grey);--cardBg: var(--white);--headerBackground: var(--darkBlue);--footerBackground: var(--darkBlue);--footerTextColor: var(--lightGrey);--buttonColor: var(--primary);--buttonTextColor: var(--textColor);--line: solid 1px var(--lineColor);--headingFont: "Lato", monospace;--bodyFont: "Work Sans", sans-serif;--baseFontSize: 100%;--h1: 3.052em;--h2: 2.441em;--h3: 1.953em;--h4: 1.563em;--h5: 1.25em;--smallText: .8em;--shadow-s: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--shadow-md: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--shadow-lg: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--shadow-xl: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--containerPadding: 2.5%;--headerHeight: 3rem;--borderRadius: 10px}:root{--left: 300px}/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0}main{display:block}h1{font-size:2em;margin:.67em 0}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace,monospace;font-size:1em}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace,monospace;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}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button}button::-moz-focus-inner,[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner{border-style:none;padding:0}button:-moz-focusring,[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:.35em .75em .625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{vertical-align:baseline}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none}:root{--green: #00ebc7;--red: #FF5470;--yellow: #fde24f;--black: #1b2d45;--darkBlue: #00214d;--darkGrey: #222;--grey: #bfbfbf;--lightGrey: #f2f4f6;--white: white;--primary: var(--yellow);--danger: var(--red);--background: var(--white);--textColor: var(--black);--lineColor: var(--grey);--cardBg: var(--white);--headerBackground: var(--white);--footerBackground: var(--green);--footerTextColor: var(--black);--headerTextColor: var(--black);--buttonColor: var(--primary);--buttonTextColor: var(--textColor);--borderBottom: solid 2px var(--primary);--line: solid 1px var(--lineColor);--headingFont: "Lato", monospace;--bodyFont: "Work Sans", sans-serif;--baseFontSize: 100%;--h1: 3.052em;--h2: 2.441em;--h3: 1.953em;--h4: 1.563em;--h5: 1.25em;--smallText: .8em;--shadow-s: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--shadow-md: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--shadow-lg: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--shadow-xl: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--containerPadding: 2.5%;--headerHeight: 3rem;--borderRadius: 0px;--height: height: calc(100vh - var(--headerHeight))}html{box-sizing:border-box;font-size:var(--baseFontSize)}*,*:before,*:after{box-sizing:inherit}body{font-family:var(--bodyFont);font-weight:400;line-height:1.75;background:var(--background);color:var(--textColor)}header{color:var(--headerTextColor);margin-top:1%;height:var(--headerHeight);background:var(--headerBackground);font-size:var(--h5);display:flex;justify-content:space-between;align-items:center;padding:0 var(--containerPadding)}header nav a{color:var(--white);text-decoration:none}header nav a+a{margin-left:10px}footer{color:var(--footerTextColor);background-color:var(--footerBackground);padding:calc(var(--headerHeight) * .75) var(--containerPadding);text-align:center;bottom:0;width:100%}footer a{color:var(--footerTextColor)}footer nav a+a{margin-left:10px}footer p{margin-bottom:0;max-width:none}p{margin-bottom:1rem}p a,blockquote a{color:var(--textColor);text-decoration:none;border-bottom:var(--borderBottom)}h1,h2,h3,h4,h5{margin:3rem 0 1.38rem;font-family:var(--headingFont);font-weight:400;line-height:1.15}h1{margin-top:0;font-size:var(--h1)}h2{font-size:var(--h2)}h3{font-size:var(--h3)}h4{font-size:var(--h4)}h5{font-size:var(--h5)}small,.text_small{font-size:var(--smallText)}blockquote{margin:10px;padding:2em;background:var(--cardBg);box-shadow:var(--shadow-lg)}label{display:block;font-size:var(--smallText)}input,textarea{padding:2px 5px;border:var(--line);border-radius:4px}textarea{width:100%;height:5rem}::placeholder{color:var(--grey)}::selection,.highlight{background:#ffb7b7;background:var(--red);color:var(--white)}select{border:var(--line)}hr{border-top:var(--line)}button{-webkit-appearance:none;-moz-appearance:none;appearance:none;color:var(--buttonTextColor);background-color:var(--white);border:var(--line);border-radius:var(--borderRadius);padding:10px 25px;box-shadow:var(--shadow-s);transition:.3s ease-in-out box-shadow}button:hover{cursor:pointer;box-shadow:var(--shadow-md)}button[disabled]{opacity:.4}button.cancel{--buttonColor: var(--danger);--buttonTextColor: var(--white)}button.small{font-size:var(--smallText)}.layout{padding-top:calc(0rem + var(--headerHeight))}.grid{--gridCols: 2;display:block;grid-template-columns:repeat(var(--gridCols),1fr)}.cols-3{--gridCols: 3}.cols-4{--gridCols: 4}.flex{--justifyContent: space-between;display:block;justify-content:var(--justifyContent)}.flex-around{--justifyContent: space-around}.card{padding:2em;background:var(--cardBg);box-shadow:var(--shadow-lg);border-radius:var(--borderRadius)}.grid-split{display:grid;grid-template-columns:33% 67%;gap:20px}@media only screen and (min-width: 600px){:root{--baseFontSize: 100%}.grid{display:grid}.flex{display:flex}}.logo{font-size:var(--baseFontSize);margin:0 0 0 8px}.dark{--background: var(--black);--textColor: var(--lightGrey);--headerBackground: var(--darkGrey);--footerBackground: var(--yellow);--cardBg: var(--darkGrey);--buttonTextColor: var(--black)}.oled{--black: #000;--cardBg: var(--darkGrey);--headerBackground: var(--darkGrey);--footerBackground: var(--darkGrey)}.theme{--green: #00ebc7;--red: #FF5470;--yellow: #fde24f;--black: #1b2d45;--darkBlue: #00214d;--darkGrey: #222;--grey: #bfbfbf;--lightGrey: #f2f4f6;--white: white;--primary: var(--green);--danger: var(--red);--background: var(--lightGrey);--textColor: var(--black);--lineColor: var(--grey);--cardBg: var(--white);--headerBackground: var(--darkBlue);--footerBackground: var(--darkBlue);--footerTextColor: var(--black);--buttonColor: var(--primary);--buttonTextColor: var(--textColor);--line: solid 1px var(--lineColor);--headingFont: "Lato", monospace;--bodyFont: "Work Sans", sans-serif;--baseFontSize: 100%;--h1: 3.052em;--h2: 2.441em;--h3: 1.953em;--h4: 1.563em;--h5: 1.25em;--smallText: .8em;--shadow-s: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--shadow-md: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--shadow-lg: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--shadow-xl: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--containerPadding: 2.5%;--headerHeight: 3rem;--borderRadius: 10px}:root{--left: 25px}.grid-sidemenu{--gridCols: 2;display:grid;grid-template-columns:var(--left) 1fr}header{padding:0 15px 0 0}header nav a+a{margin-left:15px}.corner{margin-left:var(--left)}header nav a{color:var(--black);text-decoration:none}.page{padding:3em}.page-title{text-decoration:none;border-bottom:var(--borderBottom)}.card{padding:2em;background:var(--cardBg);box-shadow:var(--shadow-lg);border-radius:var(--borderRadius);font-size:var(--smallText)}.card:hover{box-shadow:var(--shadow-xl)}.card>*:first-child{margin-top:0}.card>*:last-child{margin-bottom:0}table{margin:auto}button{margin:5px}.small-button.svelte-19cad35.svelte-19cad35{margin-left:10px;background:none;border:3px solid transparent;color:inherit;padding:6px 10px;cursor:pointer;box-shadow:none;font-size:var(--smallText)}.feedback-buttons.svelte-19cad35.svelte-19cad35{text-align:center;margin:auto;width:20%}.small-button.svelte-19cad35.svelte-19cad35:hover{box-shadow:var(--shadow-md)}.thumbs-up.svelte-19cad35.svelte-19cad35,.thumbs-up.svelte-19cad35.svelte-19cad35:hover,.thumbs-up.svelte-19cad35.svelte-19cad35::selection{background:var(--green)}.thumbs-down.svelte-19cad35.svelte-19cad35,.thumbs-down.svelte-19cad35.svelte-19cad35:hover,.thumbs-down.svelte-19cad35.svelte-19cad35::selection{background:var(--red)}.ranked-chat.svelte-19cad35.svelte-19cad35{height:100vh;display:grid;grid-template-columns:100%;grid-template-rows:80% 20%}.message.svelte-19cad35.svelte-19cad35{font-size:var(--smallText);padding-left:40px;padding-right:40px;margin:0 auto}.chat-input-holder.svelte-19cad35.svelte-19cad35{display:flex;flex-direction:column;align-items:center;padding:5px;width:100%;max-width:820px;margin:auto}.chat-input-textarea.svelte-19cad35.svelte-19cad35{background-color:var(--lightgrey);cursor:pointer;width:100%;border:var(--line);border-color:none;margin:12px;outline:none;padding:12px;color:var(--black);font-size:var(--baseFontSize);box-shadow:var(--shadow-md);flex:3;border-radius:0;border-right:0px}.chat-input-form.svelte-19cad35.svelte-19cad35{display:flex;width:100%}.btnyousend.svelte-19cad35.svelte-19cad35{border-radius:0;margin-top:12px;margin-bottom:12px;margin-left:-15px;background:var(--primary);color:var(--black);opacity:.5;transition:all .3s}.active.svelte-19cad35.svelte-19cad35{opacity:1}.green.svelte-19cad35.svelte-19cad35{border-bottom:2px solid var(--green)}.red.svelte-19cad35.svelte-19cad35{border-bottom:2px solid var(--red)}.instructions.svelte-19cad35.svelte-19cad35{text-align:center;padding:5%}.instructions.svelte-19cad35 h5.svelte-19cad35{text-align:left}.instructions.svelte-19cad35 p.svelte-19cad35{font-size:var(--smallText);text-align:left}.ranked-feedback-container.svelte-19cad35.svelte-19cad35{display:grid;grid-template-columns:20% 80%}.underline.svelte-19cad35.svelte-19cad35{border-bottom:var(--line)}.bold.svelte-19cad35.svelte-19cad35{font-weight:700;font-size:var(--smallText);margin:0;padding:0}.chatbox.svelte-19cad35.svelte-19cad35{display:flex;flex-direction:column;justify-content:space-between;height:calc(100vh - var(--headerHeight));background-color:var(--white);box-sizing:border-box;width:95%;margin:auto;height:100%}.chat-log.svelte-19cad35.svelte-19cad35{flex:1;overflow-y:auto;padding:0 10px;box-sizing:border-box}.chat-message.svelte-19cad35.svelte-19cad35{background-color:var(--white);border-bottom:var(--line);box-sizing:border-box}.chat-message-center.svelte-19cad35.svelte-19cad35{display:flex;flex-direction:column;margin-left:auto;margin-right:auto;padding:12px;box-sizing:border-box}.message-content.svelte-19cad35.svelte-19cad35{display:flex;flex-direction:column;box-sizing:border-box}.message-content.svelte-19cad35 .question.svelte-19cad35{text-align:left;border:1px solid var(--grey);padding:5px;background-color:var(--lightGrey)}.message-content.svelte-19cad35 .answer.svelte-19cad35{display:inline-block;text-align:left;padding:10px;border:1px solid var(--black)}.message-content.svelte-19cad35 .answers.svelte-19cad35{display:grid;grid-template-columns:100%;gap:0%;width:100%;margin:auto}#tooltip{position:absolute;bottom:100%;right:.78rem;transform:translate(50%);padding:.2rem .35rem;background:hsl(0,0%,20%);color:#fafafa;font-size:.95em;border-radius:.25rem;filter:drop-shadow(0 1px 2px hsla(0,0%,0%,.2));width:max-content}.tooltip #tooltip:before{content:"";position:absolute;top:100%;left:50%;transform:translate(-50%);width:.6em;height:.25em;background:inherit;clip-path:polygon(0% 0%,100% 0%,50% 100%)}.ranked-chat.svelte-au920n.svelte-au920n{height:100vh;display:grid;grid-template-columns:100%;grid-template-rows:80% 20%}.message.svelte-au920n.svelte-au920n{font-size:var(--smallText);padding-left:40px;padding-right:40px;margin:0 auto}.chat-input-holder.svelte-au920n.svelte-au920n{display:flex;flex-direction:column;align-items:center;padding:24px;width:100%;max-width:640px;margin:auto}.chat-input-textarea.svelte-au920n.svelte-au920n{background-color:var(--lightgrey);cursor:pointer;width:100%;border:var(--line);border-color:none;margin:12px;outline:none;padding:12px;color:var(--black);font-size:var(--baseFontSize);box-shadow:var(--shadow-md);flex:3;border-radius:0;border-right:0px}.chat-input-form.svelte-au920n.svelte-au920n{display:flex;width:100%}.btnyousend.svelte-au920n.svelte-au920n{border-radius:0;margin-top:12px;margin-bottom:12px;margin-left:-15px;background:var(--primary);color:var(--black);opacity:.5;transition:all .3s}.active.svelte-au920n.svelte-au920n{opacity:1}.green.svelte-au920n.svelte-au920n{border-bottom:2px solid var(--green)}.red.svelte-au920n.svelte-au920n{border-bottom:2px solid var(--red)}.instructions.svelte-au920n.svelte-au920n{text-align:center;padding:5%}.instructions.svelte-au920n h5.svelte-au920n{text-align:left}.instructions.svelte-au920n p.svelte-au920n{font-size:var(--smallText);text-align:left}.instructions.svelte-au920n button.svelte-au920n{font-size:var(--smallText)}.ranked-feedback-container.svelte-au920n.svelte-au920n{display:grid;grid-template-columns:20% 80%}.underline.svelte-au920n.svelte-au920n{border-bottom:var(--line)}.bold.svelte-au920n.svelte-au920n{font-weight:700;font-size:var(--smallText);margin:0;padding:0}.chatbox.svelte-au920n.svelte-au920n{display:flex;flex-direction:column;justify-content:space-between;height:calc(100vh - var(--headerHeight));background-color:var(--white);box-sizing:border-box;width:95%;margin:auto;height:100%}.chat-log.svelte-au920n.svelte-au920n{flex:1;overflow-y:auto;padding:0 10px;box-sizing:border-box}.chat-message.svelte-au920n.svelte-au920n{background-color:var(--white);border-bottom:var(--line);box-sizing:border-box}.chat-message-center.svelte-au920n.svelte-au920n{display:flex;flex-direction:column;margin-left:auto;margin-right:auto;padding:12px;box-sizing:border-box}.message-content.svelte-au920n.svelte-au920n{display:flex;flex-direction:column;box-sizing:border-box}.message-content.svelte-au920n .question.svelte-au920n{text-align:left;border:1px solid var(--grey);padding:5px;margin-bottom:10px;background-color:var(--lightGrey)}.message-content.svelte-au920n .answer.svelte-au920n{display:inline-block;text-align:left;padding:10px;border:1px solid var(--black)}.message-content.svelte-au920n .answers.svelte-au920n{display:grid;grid-template-columns:49% 49%;gap:2%;width:100%;margin:auto}.multiselect.svelte-8o2wf2.svelte-8o2wf2{position:relative;max-width:200px}.selectBox.svelte-8o2wf2.svelte-8o2wf2{position:relative}.selectBox.svelte-8o2wf2 select.svelte-8o2wf2{width:100%;font-weight:700}.overSelect.svelte-8o2wf2.svelte-8o2wf2{position:absolute;left:0;right:0;top:0;bottom:0}.dropdown-content.svelte-8o2wf2.svelte-8o2wf2{position:absolute;top:100%;left:0;width:100%;border:1px #dadada solid;background-color:#fff;z-index:1}.source.svelte-1pk2e1k{text-align:left;background-color:var(--lightGrey);border:1px solid var(--grey);border-top:none;padding:0 5px;margin:0;color:var(--darkGrey);box-sizing:border-box}.source_tab.svelte-1pk2e1k{display:flex;justify-content:space-between;align-items:center;cursor:pointer}.source_content.svelte-1pk2e1k{border:1pt solid var(--grey);padding:5px;margin-bottom:5px;background-color:#fff;color:var(--darkGrey)}p.svelte-1pk2e1k{margin:0;padding:0}.source.svelte-1pk2e1k:nth-of-type(2){border-top:1px solid var(--grey)}.sources.svelte-1r759df{display:inline-block;text-align:left;padding:5px;border:1pt solid var(--grey)}.sources-header.svelte-1r759df{display:flex;justify-content:space-between;align-items:center;cursor:pointer}.box.svelte-iwm583.svelte-iwm583{margin-bottom:10px;padding:40px;border:1px solid #dee2e6;border-radius:0 0 .5rem .5rem;border-top:0}ul.svelte-iwm583.svelte-iwm583{display:flex;flex-wrap:wrap;padding-left:0;margin-bottom:0;list-style:none;border-bottom:1px solid #dee2e6}li.svelte-iwm583.svelte-iwm583{margin-bottom:-1px}span.svelte-iwm583.svelte-iwm583{border:1px solid transparent;border-top-left-radius:.25rem;border-top-right-radius:.25rem;display:block;padding:.5rem 1rem;cursor:pointer}span.svelte-iwm583.svelte-iwm583:hover{border-color:#e9ecef #e9ecef #dee2e6;color:#495057}li.svelte-iwm583>span.svelte-iwm583{color:var(--grey)}li.active.svelte-iwm583>span.svelte-iwm583{color:#495057;background-color:#fff;border-color:#dee2e6 #dee2e6 #fff}.button-container.svelte-i9wciy{display:flex;justify-content:space-between}.note.svelte-i9wciy{font-size:var(--smallText);color:var(--gray)}.small-button.svelte-1u8cd0w{margin-left:10px;background:none;border:3px solid transparent;color:inherit;padding:6px 10px;cursor:pointer;box-shadow:none;font-size:var(--smallText)}.feedback-buttons.svelte-1u8cd0w{display:flex;text-align:center;margin:auto;width:20%}.small-button.svelte-1u8cd0w:hover{box-shadow:var(--shadow-md)}.thumbs-up.svelte-1u8cd0w,.thumbs-up.svelte-1u8cd0w:hover,.thumbs-up.svelte-1u8cd0w::selection{background:var(--green)}.thumbs-down.svelte-1u8cd0w,.thumbs-down.svelte-1u8cd0w:hover,.thumbs-down.svelte-1u8cd0w::selection{background:var(--red)}.chat-and-question.svelte-aj7hp0.svelte-aj7hp0{display:grid;grid-template-columns:20% 80%;width:100%}.ranked-chat.svelte-aj7hp0.svelte-aj7hp0{height:100vh;display:grid;grid-template-columns:100%;grid-template-rows:80% 20%}.message.svelte-aj7hp0.svelte-aj7hp0{font-size:var(--smallText);padding-left:40px;padding-right:40px;margin:0 auto}.chat-input-holder.svelte-aj7hp0.svelte-aj7hp0{display:flex;flex-direction:column;align-items:center;padding:5px;width:100%;max-width:820px;margin:auto}.chat-input-textarea.svelte-aj7hp0.svelte-aj7hp0{background-color:var(--lightgrey);cursor:pointer;width:100%;border:var(--line);border-color:none;margin:12px;outline:none;padding:12px;color:var(--black);font-size:var(--baseFontSize);box-shadow:var(--shadow-md);flex:3;border-radius:0;border-right:0px}.chat-input-form.svelte-aj7hp0.svelte-aj7hp0{display:flex;width:100%}.btnyousend.svelte-aj7hp0.svelte-aj7hp0{border-radius:0;margin-top:12px;margin-bottom:12px;margin-left:-15px;background:var(--primary);color:var(--black);opacity:.5;transition:all .3s}.active.svelte-aj7hp0.svelte-aj7hp0{opacity:1}.green.svelte-aj7hp0.svelte-aj7hp0{border-bottom:2px solid var(--green)}.red.svelte-aj7hp0.svelte-aj7hp0{border-bottom:2px solid var(--red)}.instructions.svelte-aj7hp0.svelte-aj7hp0{text-align:center;padding:5%}.instructions.svelte-aj7hp0 h5.svelte-aj7hp0{text-align:left}.instructions.svelte-aj7hp0 p.svelte-aj7hp0{font-size:var(--smallText);text-align:left}.ranked-feedback-container.svelte-aj7hp0.svelte-aj7hp0{display:grid;grid-template-columns:20% 80%}.underline.svelte-aj7hp0.svelte-aj7hp0{border-bottom:var(--line)}.bold{font-weight:700;font-size:var(--smallText);margin:0;padding:0}.chatbox.svelte-aj7hp0.svelte-aj7hp0{display:flex;flex-direction:column;justify-content:space-between;height:calc(100vh - var(--headerHeight));background-color:var(--white);box-sizing:border-box;width:95%;margin:auto;height:100%}.chat-log.svelte-aj7hp0.svelte-aj7hp0{flex:1;overflow-y:auto;padding:0 10px;box-sizing:border-box}.chat-message.svelte-aj7hp0.svelte-aj7hp0{background-color:var(--white);border-bottom:var(--line);box-sizing:border-box}.chat-message-center.svelte-aj7hp0.svelte-aj7hp0{display:flex;flex-direction:column;margin-left:auto;margin-right:auto;padding:12px;box-sizing:border-box}.message-content.svelte-aj7hp0.svelte-aj7hp0{display:flex;flex-direction:column;box-sizing:border-box}.message-content.svelte-aj7hp0 .question.svelte-aj7hp0{text-align:left;border:1px solid var(--grey);padding:5px;background-color:var(--lightGrey)}.message-content.svelte-aj7hp0 .answer.svelte-aj7hp0{display:inline-block;text-align:left;padding:10px;border:1px solid var(--black)}.message-content.svelte-aj7hp0 .answers.svelte-aj7hp0{display:grid;grid-template-columns:100%;gap:0%;width:100%;margin:auto}.rag-sources.svelte-aj7hp0.svelte-aj7hp0{display:flex}.tooltip{white-space:nowrap;position:relative;padding-top:.35rem;cursor:zoom-in}#tooltip{position:absolute;bottom:100%;right:.78rem;transform:translate(calc(100% - 120px));padding:.2rem .35rem;background:hsl(0,0%,20%);color:#fafafa;font-size:.95em;border-radius:.25rem;filter:drop-shadow(0 1px 2px hsla(0,0%,0%,.2));width:max-content}.tooltip #tooltip:before{content:"";position:absolute;top:100%;left:10px;width:.6em;height:.25em;background:inherit;clip-path:polygon(0% 0%,100% 0%,50% 100%)}.series.svelte-tg5p7i:focus{outline:none}.horizontal-bar-rect.selected.svelte-tg5p7i{stroke:var(--black);stroke-width:3}#stackedrect-holder.svelte-tg5p7i{height:100%;width:100%}.line.svelte-tg5p7i{stroke-width:3;stroke:var(--black);fill:none}.horizontal-bar-rect.svelte-tg5p7i{transition:opacity .3s}.horizontal-bar-rect.svelte-tg5p7i:hover{stroke:var(--black);stroke-width:3}.horizontal-bar-text.svelte-tg5p7i{transition:opacity .3s;stroke:var(--white);stroke-width:4px;fill:var(--black);stroke-linejoin:round;paint-order:stroke fill;pointer-events:none;font-size:var(--smallText)}.qa-card.svelte-szi0e{border:2px solid var(--black);display:flex;flex-direction:column;font-size:var(--smallText);padding:4px;margin:6px}.qa-card.svelte-szi0e:hover{border:3px solid var(--black)}.question.svelte-szi0e{background-color:var(--white);margin:0;padding:8px;border-bottom:1px solid var(--black)}.answer.svelte-szi0e{background-color:var(--lightGrey);margin:0;padding:8px}.feedback.svelte-szi0e{margin:0;padding:8px}.up.svelte-szi0e{background-color:var(--green)}.down.svelte-szi0e{background-color:var(--red)}.na.svelte-szi0e{background-color:var(--yellow)}.qa-container.svelte-1xv9cfi{border:2px solid var(--background);max-height:100%;overflow-y:auto}.chart-title.svelte-1oikip4{font-size:var(--smallText)}rect.svelte-1oikip4:hover{stroke:var(--black)}#stackedrect-holder.svelte-1oikip4{height:100%;width:100%}.axis-line.svelte-1oikip4{stroke-width:3;stroke:var(--black);fill:none}.axis-tick.svelte-1oikip4{stroke-width:1;fill:none;opacity:0;font-size:9px}.axis-text.svelte-1oikip4{font-size:calc(var(--smallText) * .9)}.svelte-kz2qh6{transition:all .3s}.chart-title.svelte-kz2qh6{font-size:var(--smallText)}rect.svelte-kz2qh6:hover{stroke:var(--black)}.histogram-container.svelte-kz2qh6{height:100%;width:100%}.axis-line.svelte-kz2qh6{stroke-width:3;stroke:var(--black);fill:none}.axis-tick.svelte-kz2qh6{stroke-width:1;fill:none;opacity:0;font-size:9px}.axis-text.svelte-kz2qh6{font-size:calc(var(--smallText) * .9)}.svelte-1pknxov{font-family:Lato}.card-container.svelte-1pknxov{border:2px solid var(--black);width:100%;height:100%;display:grid;grid-template-columns:100%;grid-template-rows:35% 50% 10%;padding:5px;box-sizing:border-box}.card-text.svelte-1pknxov{text-align:left;margin:0;padding:0 0 0 2px;font-weight:700;font-size:.8em}#feedback-dropdown.svelte-1pknxov{width:98%;border:none;border-bottom:1px solid var(--black);border-top:1px solid var(--black);font-size:var(--smallText);margin-bottom:1px}svg.svelte-1pknxov{width:100%;height:100%;border-bottom:1px solid var(--black)}.small.svelte-1pknxov{font-size:.6em}text.svelte-1pknxov{font-size:3rem;transition:opacity .3s;stroke:#fff;stroke-width:6px;fill:var(--black);stroke-linejoin:round;paint-order:stroke fill;pointer-events:none}.card-container.svelte-mchgj2{border:2px solid var(--black);width:100%;height:100%;display:grid;grid-template-columns:100%;grid-template-rows:35% 50% 10%;padding:5px;box-sizing:border-box}.card-text.svelte-mchgj2{text-align:left;margin:0;padding:0 0 0 2px;font-weight:700;font-size:.8em}#feedback-dropdown.svelte-mchgj2{width:98%;border:none;border-bottom:1px solid var(--black);border-top:1px solid var(--black);font-size:var(--smallText);margin-bottom:1px}svg.svelte-mchgj2{width:100%;height:100%;border-bottom:1px solid var(--black)}.small.svelte-mchgj2{font-size:.6em}text.svelte-mchgj2{font-size:3rem;transition:opacity .3s;stroke:#fff;stroke-width:6px;fill:var(--black);stroke-linejoin:round;paint-order:stroke fill;pointer-events:none}.ranked-chat.svelte-1nj8mt0.svelte-1nj8mt0{height:100vh;display:grid;grid-template-columns:100%;grid-template-rows:80% 20%}.chat-input-holder.svelte-1nj8mt0.svelte-1nj8mt0{display:flex;flex-direction:column;align-items:center;padding:24px;width:100%;max-width:640px;margin:auto}.chat-input-textarea.svelte-1nj8mt0.svelte-1nj8mt0{background-color:var(--lightgrey);cursor:pointer;width:100%;border:var(--line);border-color:none;margin:12px;outline:none;padding:12px;color:var(--black);font-size:var(--baseFontSize);box-shadow:var(--shadow-md);flex:3;border-radius:0;border-right:0px}.chat-input-form.svelte-1nj8mt0.svelte-1nj8mt0{display:flex;width:100%}.btnyousend.svelte-1nj8mt0.svelte-1nj8mt0{border-radius:0;margin-top:12px;margin-bottom:12px;margin-left:-15px;background:var(--primary);color:var(--black);opacity:.5;transition:all .3s}.active.svelte-1nj8mt0.svelte-1nj8mt0{opacity:1}.instructions.svelte-1nj8mt0.svelte-1nj8mt0{text-align:center;padding:5%;border-right:var(--line)}.instructions.svelte-1nj8mt0 h5.svelte-1nj8mt0{text-align:left}.instructions.svelte-1nj8mt0 p.svelte-1nj8mt0{font-size:var(--smallText);text-align:left;margin:0}.instructions.svelte-1nj8mt0 button.svelte-1nj8mt0{font-size:var(--smallText)}.ranked-feedback-container.svelte-1nj8mt0.svelte-1nj8mt0{display:grid;grid-template-columns:20% 80%}.underline.svelte-1nj8mt0.svelte-1nj8mt0{border-bottom:var(--line)}.bold.svelte-1nj8mt0.svelte-1nj8mt0{font-weight:700;font-size:var(--smallText);margin:0;padding:0}.chatbox.svelte-1nj8mt0.svelte-1nj8mt0{display:flex;flex-direction:column;justify-content:space-between;height:calc(100vh - var(--headerHeight));background-color:var(--white);box-sizing:border-box;width:95%;margin:auto;height:100%}.chat-log.svelte-1nj8mt0.svelte-1nj8mt0{flex:1;overflow-y:auto;padding:0 10px;box-sizing:border-box}.chat-message.svelte-1nj8mt0.svelte-1nj8mt0{background-color:var(--white);border-bottom:var(--line);box-sizing:border-box}.chat-message-center.svelte-1nj8mt0.svelte-1nj8mt0{display:flex;flex-direction:column;margin-left:auto;margin-right:auto;padding:12px;box-sizing:border-box}.message-content.svelte-1nj8mt0.svelte-1nj8mt0{display:flex;flex-direction:column;box-sizing:border-box}.message-content.svelte-1nj8mt0 .question.svelte-1nj8mt0{text-align:left;border:1px solid var(--grey);padding:5px;margin-bottom:10px;background-color:var(--lightGrey)}.message-content.svelte-1nj8mt0 .answer.svelte-1nj8mt0{display:inline-block;text-align:left;padding:10px;border:1px solid var(--black)}option.svelte-1nj8mt0.svelte-1nj8mt0{font-weight:700;font-size:120%}p.svelte-1nj8mt0.svelte-1nj8mt0{margin:0}.svelte-1nna9rx{font-family:Lato}#chart-holder.svelte-1nna9rx{height:100%;width:100%}.axis-line.svelte-1nna9rx{stroke-width:3;stroke:#000;fill:none}.axis-tick.svelte-1nna9rx{stroke-width:2;stroke:#000;fill:none;opacity:.13}.axis-text.svelte-1nna9rx{font-family:Arial;font-size:12px}.bump-text.svelte-1nna9rx{font-size:12px;pointer-events:none}.model-path.svelte-1nna9rx{fill:none;stroke-width:5;stroke-linecap:round;stroke-linejoin:round}.model-path-outer.svelte-1nna9rx{fill:none;stroke-width:8;stroke-linecap:round;stroke-linejoin:round}.chart-subtitle.svelte-1nna9rx{font-size:12px}#bar-chart-holder.svelte-1y9gffu{height:100%;width:100%}.axis-text.svelte-1y9gffu{font-size:9px}.axis-line.svelte-1y9gffu{stroke-width:3;stroke:#000;fill:none}.label-text.svelte-1y9gffu{font-size:9px}.cell.svelte-hnulv9{max-height:40px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.cell.active.svelte-hnulv9{max-height:100%;overflow:visible;white-space:normal}.svelte-owgjbp.svelte-owgjbp{font-family:Lato,monospace}.table.svelte-owgjbp.svelte-owgjbp{margin:auto;width:90%}.pretty-pager.svelte-owgjbp.svelte-owgjbp{padding-top:1rem}.pretty-table.normal.svelte-owgjbp.svelte-owgjbp{font-size:15px}.pretty-table.normal.svelte-owgjbp th.svelte-owgjbp,.pretty-table.normal.svelte-owgjbp td.svelte-owgjbp{padding:3px 2px}.pretty-table.svelte-owgjbp th.svelte-owgjbp,.pretty-table.svelte-owgjbp td.svelte-owgjbp{vertical-align:top}.pretty-table.svelte-owgjbp thead th.svelte-owgjbp{text-transform:uppercase;font-weight:700;font-family:Work Sans,sans-serif;border-bottom:2px solid black}.pretty-table.svelte-owgjbp th.svelte-owgjbp{cursor:pointer}.pretty-table.svelte-owgjbp tbody td.cell-type-number.svelte-owgjbp,.pretty-table.svelte-owgjbp tbody td.cell-rank.svelte-owgjbp{text-align:right}.pretty-table.svelte-owgjbp tbody td.cell-type-number.svelte-owgjbp,.pretty-table.svelte-owgjbp tbody td.cell-rank.svelte-owgjbp{font-family:menlo,consolas,monaco,monospace;font-size:90%}.pretty-table.svelte-owgjbp tbody td.cell-rank.svelte-owgjbp{padding-right:1em;color:#666}table.pretty-table.svelte-owgjbp.svelte-owgjbp{border-collapse:collapse}table.pretty-table.svelte-owgjbp.svelte-owgjbp{border-collapse:collapse;table-layout:fixed}.pretty-table.svelte-owgjbp tr.svelte-owgjbp{border-bottom:1px solid #eee}td.active.svelte-owgjbp.svelte-owgjbp{max-height:100%;overflow:auto;color:red}td.svelte-owgjbp.svelte-owgjbp:not(.active){overflow:hidden;white-space:normal}tr.svelte-owgjbp.svelte-owgjbp:hover{background:#eee}.pretty-table.svelte-owgjbp.svelte-owgjbp{width:100%}#heatmap-holder.svelte-t6wv8i{height:100%;width:100%}.axis-text.svelte-t6wv8i,.chart-subtitle.svelte-t6wv8i{font-size:12px}.holder.svelte-1gze3r0.svelte-1gze3r0{height:100vh;width:100%;display:flex;justify-content:center;align-items:center}button.svelte-1gze3r0.svelte-1gze3r0{margin:0}.chart-captions.svelte-1gze3r0.svelte-1gze3r0{margin:auto;width:100%;text-align:left;height:100%}.chart-captions.svelte-1gze3r0 h4.svelte-1gze3r0{padding:0;margin:0}.instructions.svelte-1gze3r0.svelte-1gze3r0{text-align:left;padding-left:0}.instructions.svelte-1gze3r0 p.svelte-1gze3r0{font-size:var(--smallText);text-align:left}.instructions.svelte-1gze3r0 button.svelte-1gze3r0{font-size:var(--smallText)}.underline.svelte-1gze3r0.svelte-1gze3r0{border-bottom:var(--line)}.bold.svelte-1gze3r0.svelte-1gze3r0{font-weight:700;font-size:var(--smallText);margin:0;padding:0}.instructions.svelte-1gze3r0.svelte-1gze3r0{border-right:1px solid #eee}.main-container.svelte-1gze3r0.svelte-1gze3r0{display:grid;grid-template-columns:20% 80%}.eval-container.svelte-1gze3r0.svelte-1gze3r0{display:grid;height:100vh;grid-template-rows:100%;grid-template-columns:65% 35%;padding:1rem}.left-charts.svelte-1gze3r0.svelte-1gze3r0{display:grid;grid-template-columns:100%;grid-template-rows:15% 60% 25%}.eval-table.svelte-1gze3r0.svelte-1gze3r0{margin:auto;width:100%}.right-charts.svelte-1gze3r0.svelte-1gze3r0{display:grid;grid-template-columns:100%;grid-template-rows:10% 33% 33%;gap:1%}.main-annotation-container.svelte-3wjb3y.svelte-3wjb3y{display:grid;grid-template-columns:100%;grid-template-rows:90% 10%;height:100vh;width:100%;margin:auto}.buttons.svelte-3wjb3y.svelte-3wjb3y{display:flex;background:var(--grey)}.rating-button.svelte-3wjb3y.svelte-3wjb3y{padding:10px;border:none}.rating-button.svelte-3wjb3y+.rating-button.svelte-3wjb3y{margin-left:-1px}.ranked-chat.svelte-3wjb3y.svelte-3wjb3y{display:grid;grid-template-columns:100%;grid-template-rows:100%;border:var(--line);margin:12px}.chat-input-holder.svelte-3wjb3y.svelte-3wjb3y{align-items:center;width:100%;margin:auto;border-top:var(--line)}.instructions.svelte-3wjb3y.svelte-3wjb3y{text-align:center;padding:5%}.instructions.svelte-3wjb3y h5.svelte-3wjb3y{text-align:left}.instructions.svelte-3wjb3y p.svelte-3wjb3y{font-size:var(--smallText);text-align:left}.instructions.svelte-3wjb3y button.svelte-3wjb3y{font-size:var(--smallText)}.annotation-container.svelte-3wjb3y.svelte-3wjb3y{display:grid;grid-template-columns:40% 60%}.underline.svelte-3wjb3y.svelte-3wjb3y{border-bottom:var(--line)}.bold.svelte-3wjb3y.svelte-3wjb3y{font-weight:700;font-size:var(--smallText);margin:0;padding:0}.chatbox.svelte-3wjb3y.svelte-3wjb3y{display:flex;flex-direction:column;justify-content:space-between;height:calc(100vh - var(--headerHeight));background-color:var(--white);box-sizing:border-box;width:95%;margin:auto;height:100%}.chat-message-center.svelte-3wjb3y.svelte-3wjb3y{display:flex;flex-direction:column;padding:12px;box-sizing:border-box}.message-content.svelte-3wjb3y.svelte-3wjb3y{display:flex;flex-direction:column;box-sizing:border-box;display:block}.message-content.svelte-3wjb3y .question.svelte-3wjb3y{text-align:left;border:1px solid var(--grey);padding:5px;margin-bottom:10px;background-color:var(--lightGrey)}.message-content.svelte-3wjb3y .answer.svelte-3wjb3y{display:block;text-align:left;padding:10px;border:1px solid var(--black)}.message-content.svelte-3wjb3y .answers.svelte-3wjb3y{display:grid;grid-template-columns:100%;gap:2%;width:100%;margin:auto}svg.svelte-h2ab3o{background:conic-gradient(from 90deg at 1px 1px,#0000 90deg,rgba(0,0,0,.04) 0) 0 0/20px 20px;border:var(--line)}.file-circle-g.svelte-h2ab3o:hover{opacity:1}.bubble-file-text.svelte-h2ab3o{font-size:calc(.99 * var(--smallText));pointer-events:none;stroke:var(--white);stroke-width:4px;fill:var(--black);stroke-linejoin:round;paint-order:stroke fill}circle.svelte-h2ab3o{transition:all .3s ease}circle.svelte-h2ab3o:hover{stroke:var(--black);stroke-width:3}.table-container.svelte-16fb3tv.svelte-16fb3tv{margin:auto;width:100%;overflow-y:scroll;max-height:100%;height:100%;overflow-y:auto}table.svelte-16fb3tv.svelte-16fb3tv{width:100%;border-collapse:collapse;font-size:var(--smallText)}thead.svelte-16fb3tv th.svelte-16fb3tv{text-align:center;padding:5px;border-bottom:4px solid var(--grey);background-color:var(--lightGrey)}thead.svelte-16fb3tv th.svelte-16fb3tv:nth-child(1){text-align:left}tbody.svelte-16fb3tv tr.svelte-16fb3tv{border-bottom:var(--line)}tbody.svelte-16fb3tv tr.svelte-16fb3tv:nth-child(2n){background-color:var(--white)}tbody.svelte-16fb3tv td.svelte-16fb3tv{padding:10px}.is-flex.svelte-16fb3tv.svelte-16fb3tv{display:flex;justify-content:space-between;align-items:center;padding:10px}.button.svelte-16fb3tv.svelte-16fb3tv{padding:5px 10px;border:none;cursor:pointer;transition:background-color .3s ease}.button.is-disabled.svelte-16fb3tv.svelte-16fb3tv{cursor:not-allowed;color:#ccc}.button.svelte-16fb3tv.svelte-16fb3tv:not(.is-disabled):hover{background-color:#f2f2f2}.button.is-white.svelte-16fb3tv.svelte-16fb3tv{color:#000}.mx-1.svelte-16fb3tv.svelte-16fb3tv{margin-left:1em;margin-right:1em}.file-container.svelte-1lu6hos{display:grid;height:calc(100% - var(--headerHeight));align-items:center;justify-content:center}.upload-container.svelte-1lu6hos{margin:auto;max-width:100%;text-align:center}.charts-container.svelte-1lu6hos{height:calc(100vh - var(--headerHeight));display:grid;gap:2%;grid-template-columns:100%;grid-template-rows:50% 40%}.data-grid.svelte-1lu6hos{display:grid;grid-template-columns:45% 50%;gap:0;margin:auto;max-width:1200px;padding-top:20px}.upload-box.svelte-1lu6hos{display:flex;flex-direction:column;justify-content:center;align-items:center;height:100%;max-height:50vh;margin:auto;border:5px dashed var(--grey);padding:20px;box-sizing:border-box}.feedback-container.svelte-14znspc{border-bottom:var(--line);border-right:var(--line);display:grid;grid-template-columns:30% 70%;grid-template-rows:100%;width:90%;height:calc(100vh - var(--headerHeight))}.feedback-left.svelte-14znspc{border-bottom:var(--line);display:grid;grid-template-columns:100%;grid-template-rows:25% 25% 25% 12.5% 12.5%}.left-text.svelte-14znspc{text-align:center;border-bottom:var(--line);border-right:var(--line);display:grid;grid-template-rows:100%;grid-template-columns:50% 50%}.left-confidence.svelte-14znspc{text-align:center;border-bottom:var(--line);border-right:var(--line);display:grid;grid-template-rows:40% 55%}.left-question.svelte-14znspc,.left-filter.svelte-14znspc{border-bottom:var(--line);border-right:var(--line)}.feedback-right.svelte-14znspc{border-bottom:var(--line);border-right:var(--line);display:grid;grid-template-columns:100%;grid-template-rows:30% 70%;grid-template-rows:0% 100%}.right-chart.svelte-14znspc{border-bottom:var(--line);border-right:var(--line);display:grid;grid-template-columns:50% 50%;grid-template-rows:100%}.right-chart-1.svelte-14znspc,.right-chart-2.svelte-14znspc{border-right:var(--line)}.right-table.svelte-14znspc{border-bottom:var(--line);border-right:var(--line)}.card-1.svelte-14znspc{border-right:var(--line)} diff --git a/pykoi/frontend/dist/assets/index-c5532657.css b/pykoi/frontend/dist/assets/index-c5532657.css deleted file mode 100644 index f38bb83..0000000 --- a/pykoi/frontend/dist/assets/index-c5532657.css +++ /dev/null @@ -1 +0,0 @@ -@import"https://fonts.googleapis.com/css?family=Work+Sans:400|Lato:400|Inconsolata:400";:root{font-family:Inter,system-ui,Avenir,Helvetica,Arial,sans-serif;line-height:1.5;font-weight:400;color-scheme:light dark;color:#ffffffde;background-color:#242424;font-synthesis:none;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;-webkit-text-size-adjust:100%}a{font-weight:500;color:#646cff;text-decoration:inherit}a:hover{color:#535bf2}body{margin:auto;width:100%}h1{font-size:3.2em;line-height:1.1}.card{padding:2em}#app{margin:0 auto;text-align:center}button{border-radius:8px;border:1px solid transparent;padding:.6em 1.2em;font-size:1em;font-weight:500;font-family:inherit;background-color:#1a1a1a;cursor:pointer;transition:border-color .25s}button:hover{border-color:#646cff}button:focus,button:focus-visible{outline:4px auto -webkit-focus-ring-color}@media (prefers-color-scheme: light){:root{color:#213547;background-color:#fff}a:hover{color:#747bff}button{background-color:#f9f9f9}}:root{--green: #00ebc7;--red: #FF5470;--yellow: #fde24f;--black: #1b2d45;--darkBlue: #00214d;--darkGrey: #222;--grey: #bfbfbf;--lightGrey: #f2f4f6;--white: white;--primary: var(--yellow);--danger: var(--red);--background: var(--lightGrey);--textColor: var(--black);--lineColor: var(--grey);--cardBg: var(--white);--headerBackground: var(--white);--footerBackground: var(--darkBlue);--footerTextColor: var(--lightGrey);--headerTextColor: var(--black);--buttonColor: var(--primary);--buttonTextColor: var(--textColor);--borderBottom: solid 2px var(--primary);--line: solid 1px var(--lineColor);--headingFont: "Lato", monospace;--bodyFont: "Inconsolata", sans-serif;--baseFontSize: 100%;--h1: 3.052em;--h2: 2.441em;--h3: 1.953em;--h4: 1.563em;--h5: 1.25em;--smallText: .8em;--shadow-s: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--shadow-md: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--shadow-lg: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--shadow-xl: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--containerPadding: 2.5%;--headerHeight: 3rem;--borderRadius: 0px}header{color:var(--headerTextColor);position:fixed;left:0;top:0;width:100%;height:var(--headerHeight);background:var(--headerBackground);border-bottom:var(--line);display:flex;justify-content:space-between;align-items:center;padding:0 var(--containerPadding)}footer{color:var(--footerTextColor);background-color:var(--footerBackground);padding:calc(var(--headerHeight) * .75) var(--containerPadding);text-align:center;position:absolute;bottom:0;width:100%}button{-webkit-appearance:none;-moz-appearance:none;appearance:none;color:var(--buttonTextColor);background-color:var(--white);border:var(--line);border-radius:var(--borderRadius);padding:5px 25px;box-shadow:var(--shadow-s);transition:.3s ease-in-out box-shadow}.dark{--background: var(--black);--textColor: var(--lightGrey);--headerBackground: var(--darkGrey);--footerBackground: var(--darkGrey);--cardBg: var(--darkGrey);--buttonTextColor: var(--black)}.theme{--green: #00ebc7;--red: #FF5470;--yellow: #fde24f;--black: #1b2d45;--darkBlue: #00214d;--darkGrey: #222;--grey: #bfbfbf;--lightGrey: #f2f4f6;--white: white;--primary: var(--green);--danger: var(--red);--background: var(--lightGrey);--textColor: var(--black);--lineColor: var(--grey);--cardBg: var(--white);--headerBackground: var(--darkBlue);--footerBackground: var(--darkBlue);--footerTextColor: var(--lightGrey);--buttonColor: var(--primary);--buttonTextColor: var(--textColor);--line: solid 1px var(--lineColor);--headingFont: "Lato", monospace;--bodyFont: "Work Sans", sans-serif;--baseFontSize: 100%;--h1: 3.052em;--h2: 2.441em;--h3: 1.953em;--h4: 1.563em;--h5: 1.25em;--smallText: .8em;--shadow-s: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--shadow-md: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--shadow-lg: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--shadow-xl: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--containerPadding: 2.5%;--headerHeight: 3rem;--borderRadius: 10px}:root{--left: 300px}/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0}main{display:block}h1{font-size:2em;margin:.67em 0}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace,monospace;font-size:1em}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace,monospace;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}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button}button::-moz-focus-inner,[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner{border-style:none;padding:0}button:-moz-focusring,[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:.35em .75em .625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{vertical-align:baseline}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none}:root{--green: #00ebc7;--red: #FF5470;--yellow: #fde24f;--black: #1b2d45;--darkBlue: #00214d;--darkGrey: #222;--grey: #bfbfbf;--lightGrey: #f2f4f6;--white: white;--primary: var(--yellow);--danger: var(--red);--background: var(--white);--textColor: var(--black);--lineColor: var(--grey);--cardBg: var(--white);--headerBackground: var(--white);--footerBackground: var(--green);--footerTextColor: var(--black);--headerTextColor: var(--black);--buttonColor: var(--primary);--buttonTextColor: var(--textColor);--borderBottom: solid 2px var(--primary);--line: solid 1px var(--lineColor);--headingFont: "Lato", monospace;--bodyFont: "Work Sans", sans-serif;--baseFontSize: 100%;--h1: 3.052em;--h2: 2.441em;--h3: 1.953em;--h4: 1.563em;--h5: 1.25em;--smallText: .8em;--shadow-s: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--shadow-md: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--shadow-lg: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--shadow-xl: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--containerPadding: 2.5%;--headerHeight: 3rem;--borderRadius: 0px;--height: height: calc(100vh - var(--headerHeight))}html{box-sizing:border-box;font-size:var(--baseFontSize)}*,*:before,*:after{box-sizing:inherit}body{font-family:var(--bodyFont);font-weight:400;line-height:1.75;background:var(--background);color:var(--textColor)}header{color:var(--headerTextColor);margin-top:1%;height:var(--headerHeight);background:var(--headerBackground);font-size:var(--h5);display:flex;justify-content:space-between;align-items:center;padding:0 var(--containerPadding)}header nav a{color:var(--white);text-decoration:none}header nav a+a{margin-left:10px}footer{color:var(--footerTextColor);background-color:var(--footerBackground);padding:calc(var(--headerHeight) * .75) var(--containerPadding);text-align:center;bottom:0;width:100%}footer a{color:var(--footerTextColor)}footer nav a+a{margin-left:10px}footer p{margin-bottom:0;max-width:none}p{margin-bottom:1rem}p a,blockquote a{color:var(--textColor);text-decoration:none;border-bottom:var(--borderBottom)}h1,h2,h3,h4,h5{margin:3rem 0 1.38rem;font-family:var(--headingFont);font-weight:400;line-height:1.15}h1{margin-top:0;font-size:var(--h1)}h2{font-size:var(--h2)}h3{font-size:var(--h3)}h4{font-size:var(--h4)}h5{font-size:var(--h5)}small,.text_small{font-size:var(--smallText)}blockquote{margin:10px;padding:2em;background:var(--cardBg);box-shadow:var(--shadow-lg)}label{display:block;font-size:var(--smallText)}input,textarea{padding:2px 5px;border:var(--line);border-radius:4px}textarea{width:100%;height:5rem}::placeholder{color:var(--grey)}::selection,.highlight{background:#ffb7b7;background:var(--red);color:var(--white)}select{border:var(--line)}hr{border-top:var(--line)}button{-webkit-appearance:none;-moz-appearance:none;appearance:none;color:var(--buttonTextColor);background-color:var(--white);border:var(--line);border-radius:var(--borderRadius);padding:10px 25px;box-shadow:var(--shadow-s);transition:.3s ease-in-out box-shadow}button:hover{cursor:pointer;box-shadow:var(--shadow-md)}button[disabled]{opacity:.4}button.cancel{--buttonColor: var(--danger);--buttonTextColor: var(--white)}button.small{font-size:var(--smallText)}.layout{padding-top:calc(0rem + var(--headerHeight))}.grid{--gridCols: 2;display:block;grid-template-columns:repeat(var(--gridCols),1fr)}.cols-3{--gridCols: 3}.cols-4{--gridCols: 4}.flex{--justifyContent: space-between;display:block;justify-content:var(--justifyContent)}.flex-around{--justifyContent: space-around}.card{padding:2em;background:var(--cardBg);box-shadow:var(--shadow-lg);border-radius:var(--borderRadius)}.grid-split{display:grid;grid-template-columns:33% 67%;gap:20px}@media only screen and (min-width: 600px){:root{--baseFontSize: 100%}.grid{display:grid}.flex{display:flex}}.logo{font-size:var(--baseFontSize);margin:0 0 0 8px}.dark{--background: var(--black);--textColor: var(--lightGrey);--headerBackground: var(--darkGrey);--footerBackground: var(--yellow);--cardBg: var(--darkGrey);--buttonTextColor: var(--black)}.oled{--black: #000;--cardBg: var(--darkGrey);--headerBackground: var(--darkGrey);--footerBackground: var(--darkGrey)}.theme{--green: #00ebc7;--red: #FF5470;--yellow: #fde24f;--black: #1b2d45;--darkBlue: #00214d;--darkGrey: #222;--grey: #bfbfbf;--lightGrey: #f2f4f6;--white: white;--primary: var(--green);--danger: var(--red);--background: var(--lightGrey);--textColor: var(--black);--lineColor: var(--grey);--cardBg: var(--white);--headerBackground: var(--darkBlue);--footerBackground: var(--darkBlue);--footerTextColor: var(--black);--buttonColor: var(--primary);--buttonTextColor: var(--textColor);--line: solid 1px var(--lineColor);--headingFont: "Lato", monospace;--bodyFont: "Work Sans", sans-serif;--baseFontSize: 100%;--h1: 3.052em;--h2: 2.441em;--h3: 1.953em;--h4: 1.563em;--h5: 1.25em;--smallText: .8em;--shadow-s: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--shadow-md: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--shadow-lg: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--shadow-xl: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--containerPadding: 2.5%;--headerHeight: 3rem;--borderRadius: 10px}:root{--left: 25px}.grid-sidemenu{--gridCols: 2;display:grid;grid-template-columns:var(--left) 1fr}header{padding:0 15px 0 0}header nav a+a{margin-left:15px}.corner{margin-left:var(--left)}header nav a{color:var(--black);text-decoration:none}.page{padding:3em}.page-title{text-decoration:none;border-bottom:var(--borderBottom)}.card{padding:2em;background:var(--cardBg);box-shadow:var(--shadow-lg);border-radius:var(--borderRadius);font-size:var(--smallText)}.card:hover{box-shadow:var(--shadow-xl)}.card>*:first-child{margin-top:0}.card>*:last-child{margin-bottom:0}table{margin:auto}button{margin:5px}.multiselect.svelte-8o2wf2.svelte-8o2wf2{position:relative;max-width:200px}.selectBox.svelte-8o2wf2.svelte-8o2wf2{position:relative}.selectBox.svelte-8o2wf2 select.svelte-8o2wf2{width:100%;font-weight:700}.overSelect.svelte-8o2wf2.svelte-8o2wf2{position:absolute;left:0;right:0;top:0;bottom:0}.dropdown-content.svelte-8o2wf2.svelte-8o2wf2{position:absolute;top:100%;left:0;width:100%;border:1px #dadada solid;background-color:#fff;z-index:1}.chat-and-question.svelte-1uetn8d.svelte-1uetn8d{display:grid;grid-template-columns:20% 80%;width:100%}.small-button.svelte-1uetn8d.svelte-1uetn8d{margin-left:10px;background:none;border:3px solid transparent;color:inherit;padding:6px 10px;cursor:pointer;box-shadow:none;font-size:var(--smallText)}.feedback-buttons.svelte-1uetn8d.svelte-1uetn8d{text-align:center;margin:auto;width:20%}.small-button.svelte-1uetn8d.svelte-1uetn8d:hover{box-shadow:var(--shadow-md)}.thumbs-up.svelte-1uetn8d.svelte-1uetn8d,.thumbs-up.svelte-1uetn8d.svelte-1uetn8d:hover,.thumbs-up.svelte-1uetn8d.svelte-1uetn8d::selection{background:var(--green)}.thumbs-down.svelte-1uetn8d.svelte-1uetn8d,.thumbs-down.svelte-1uetn8d.svelte-1uetn8d:hover,.thumbs-down.svelte-1uetn8d.svelte-1uetn8d::selection{background:var(--red)}.ranked-chat.svelte-1uetn8d.svelte-1uetn8d{height:100vh;display:grid;grid-template-columns:100%;grid-template-rows:80% 20%}.message.svelte-1uetn8d.svelte-1uetn8d{font-size:var(--smallText);padding-left:40px;padding-right:40px;margin:0 auto}.chat-input-holder.svelte-1uetn8d.svelte-1uetn8d{display:flex;flex-direction:column;align-items:center;padding:5px;width:100%;max-width:820px;margin:auto}.chat-input-textarea.svelte-1uetn8d.svelte-1uetn8d{background-color:var(--lightgrey);cursor:pointer;width:100%;border:var(--line);border-color:none;margin:12px;outline:none;padding:12px;color:var(--black);font-size:var(--baseFontSize);box-shadow:var(--shadow-md);flex:3;border-radius:0;border-right:0px}.chat-input-form.svelte-1uetn8d.svelte-1uetn8d{display:flex;width:100%}.btnyousend.svelte-1uetn8d.svelte-1uetn8d{border-radius:0;margin-top:12px;margin-bottom:12px;margin-left:-15px;background:var(--primary);color:var(--black);opacity:.5;transition:all .3s}.active.svelte-1uetn8d.svelte-1uetn8d{opacity:1}.green.svelte-1uetn8d.svelte-1uetn8d{border-bottom:2px solid var(--green)}.red.svelte-1uetn8d.svelte-1uetn8d{border-bottom:2px solid var(--red)}.instructions.svelte-1uetn8d.svelte-1uetn8d{text-align:center;padding:5%}.instructions.svelte-1uetn8d h5.svelte-1uetn8d{text-align:left}.instructions.svelte-1uetn8d p.svelte-1uetn8d{font-size:var(--smallText);text-align:left}.ranked-feedback-container.svelte-1uetn8d.svelte-1uetn8d{display:grid;grid-template-columns:20% 80%}.underline.svelte-1uetn8d.svelte-1uetn8d{border-bottom:var(--line)}.bold.svelte-1uetn8d.svelte-1uetn8d{font-weight:700;font-size:var(--smallText);margin:0;padding:0}.chatbox.svelte-1uetn8d.svelte-1uetn8d{display:flex;flex-direction:column;justify-content:space-between;height:calc(100vh - var(--headerHeight));background-color:var(--white);box-sizing:border-box;width:95%;margin:auto;height:100%}.chat-log.svelte-1uetn8d.svelte-1uetn8d{flex:1;overflow-y:auto;padding:0 10px;box-sizing:border-box}.chat-message.svelte-1uetn8d.svelte-1uetn8d{background-color:var(--white);border-bottom:var(--line);box-sizing:border-box}.chat-message-center.svelte-1uetn8d.svelte-1uetn8d{display:flex;flex-direction:column;margin-left:auto;margin-right:auto;padding:12px;box-sizing:border-box}.message-content.svelte-1uetn8d.svelte-1uetn8d{display:flex;flex-direction:column;box-sizing:border-box}.message-content.svelte-1uetn8d .question.svelte-1uetn8d{text-align:left;border:1px solid var(--grey);padding:5px;background-color:var(--lightGrey)}.message-content.svelte-1uetn8d .answer.svelte-1uetn8d{display:inline-block;text-align:left;padding:10px;border:1px solid var(--black)}.message-content.svelte-1uetn8d .source.svelte-1uetn8d{text-align:left;border:1px solid var(--grey);padding:5px;background-color:var(--lightGrey);color:var(--darkGrey);box-sizing:border-box}.source_tab.svelte-1uetn8d.svelte-1uetn8d{display:flex;justify-content:space-between;align-items:center;cursor:pointer}.source_content.svelte-1uetn8d.svelte-1uetn8d{background-color:#fff;border:1pt solid var(--grey);padding:5px}.message-content.svelte-1uetn8d .answers.svelte-1uetn8d{display:grid;grid-template-columns:100%;gap:0%;width:100%;margin:auto}.rag-sources.svelte-1uetn8d.svelte-1uetn8d{display:flex}.tooltip{white-space:nowrap;position:relative;padding-top:.35rem;cursor:zoom-in}#tooltip{position:absolute;bottom:100%;right:.78rem;transform:translate(calc(100% - 120px));padding:.2rem .35rem;background:hsl(0,0%,20%);color:#fafafa;font-size:.95em;border-radius:.25rem;filter:drop-shadow(0 1px 2px hsla(0,0%,0%,.2));width:max-content}.tooltip #tooltip:before{content:"";position:absolute;top:100%;left:10px;width:.6em;height:.25em;background:inherit;clip-path:polygon(0% 0%,100% 0%,50% 100%)}.ranked-chat.svelte-au920n.svelte-au920n{height:100vh;display:grid;grid-template-columns:100%;grid-template-rows:80% 20%}.message.svelte-au920n.svelte-au920n{font-size:var(--smallText);padding-left:40px;padding-right:40px;margin:0 auto}.chat-input-holder.svelte-au920n.svelte-au920n{display:flex;flex-direction:column;align-items:center;padding:24px;width:100%;max-width:640px;margin:auto}.chat-input-textarea.svelte-au920n.svelte-au920n{background-color:var(--lightgrey);cursor:pointer;width:100%;border:var(--line);border-color:none;margin:12px;outline:none;padding:12px;color:var(--black);font-size:var(--baseFontSize);box-shadow:var(--shadow-md);flex:3;border-radius:0;border-right:0px}.chat-input-form.svelte-au920n.svelte-au920n{display:flex;width:100%}.btnyousend.svelte-au920n.svelte-au920n{border-radius:0;margin-top:12px;margin-bottom:12px;margin-left:-15px;background:var(--primary);color:var(--black);opacity:.5;transition:all .3s}.active.svelte-au920n.svelte-au920n{opacity:1}.green.svelte-au920n.svelte-au920n{border-bottom:2px solid var(--green)}.red.svelte-au920n.svelte-au920n{border-bottom:2px solid var(--red)}.instructions.svelte-au920n.svelte-au920n{text-align:center;padding:5%}.instructions.svelte-au920n h5.svelte-au920n{text-align:left}.instructions.svelte-au920n p.svelte-au920n{font-size:var(--smallText);text-align:left}.instructions.svelte-au920n button.svelte-au920n{font-size:var(--smallText)}.ranked-feedback-container.svelte-au920n.svelte-au920n{display:grid;grid-template-columns:20% 80%}.underline.svelte-au920n.svelte-au920n{border-bottom:var(--line)}.bold.svelte-au920n.svelte-au920n{font-weight:700;font-size:var(--smallText);margin:0;padding:0}.chatbox.svelte-au920n.svelte-au920n{display:flex;flex-direction:column;justify-content:space-between;height:calc(100vh - var(--headerHeight));background-color:var(--white);box-sizing:border-box;width:95%;margin:auto;height:100%}.chat-log.svelte-au920n.svelte-au920n{flex:1;overflow-y:auto;padding:0 10px;box-sizing:border-box}.chat-message.svelte-au920n.svelte-au920n{background-color:var(--white);border-bottom:var(--line);box-sizing:border-box}.chat-message-center.svelte-au920n.svelte-au920n{display:flex;flex-direction:column;margin-left:auto;margin-right:auto;padding:12px;box-sizing:border-box}.message-content.svelte-au920n.svelte-au920n{display:flex;flex-direction:column;box-sizing:border-box}.message-content.svelte-au920n .question.svelte-au920n{text-align:left;border:1px solid var(--grey);padding:5px;margin-bottom:10px;background-color:var(--lightGrey)}.message-content.svelte-au920n .answer.svelte-au920n{display:inline-block;text-align:left;padding:10px;border:1px solid var(--black)}.message-content.svelte-au920n .answers.svelte-au920n{display:grid;grid-template-columns:49% 49%;gap:2%;width:100%;margin:auto}.series.svelte-tg5p7i:focus{outline:none}.horizontal-bar-rect.selected.svelte-tg5p7i{stroke:var(--black);stroke-width:3}#stackedrect-holder.svelte-tg5p7i{height:100%;width:100%}.line.svelte-tg5p7i{stroke-width:3;stroke:var(--black);fill:none}.horizontal-bar-rect.svelte-tg5p7i{transition:opacity .3s}.horizontal-bar-rect.svelte-tg5p7i:hover{stroke:var(--black);stroke-width:3}.horizontal-bar-text.svelte-tg5p7i{transition:opacity .3s;stroke:var(--white);stroke-width:4px;fill:var(--black);stroke-linejoin:round;paint-order:stroke fill;pointer-events:none;font-size:var(--smallText)}.qa-card.svelte-szi0e{border:2px solid var(--black);display:flex;flex-direction:column;font-size:var(--smallText);padding:4px;margin:6px}.qa-card.svelte-szi0e:hover{border:3px solid var(--black)}.question.svelte-szi0e{background-color:var(--white);margin:0;padding:8px;border-bottom:1px solid var(--black)}.answer.svelte-szi0e{background-color:var(--lightGrey);margin:0;padding:8px}.feedback.svelte-szi0e{margin:0;padding:8px}.up.svelte-szi0e{background-color:var(--green)}.down.svelte-szi0e{background-color:var(--red)}.na.svelte-szi0e{background-color:var(--yellow)}.qa-container.svelte-1xv9cfi{border:2px solid var(--background);max-height:100%;overflow-y:auto}.chart-title.svelte-1oikip4{font-size:var(--smallText)}rect.svelte-1oikip4:hover{stroke:var(--black)}#stackedrect-holder.svelte-1oikip4{height:100%;width:100%}.axis-line.svelte-1oikip4{stroke-width:3;stroke:var(--black);fill:none}.axis-tick.svelte-1oikip4{stroke-width:1;fill:none;opacity:0;font-size:9px}.axis-text.svelte-1oikip4{font-size:calc(var(--smallText) * .9)}.svelte-kz2qh6{transition:all .3s}.chart-title.svelte-kz2qh6{font-size:var(--smallText)}rect.svelte-kz2qh6:hover{stroke:var(--black)}.histogram-container.svelte-kz2qh6{height:100%;width:100%}.axis-line.svelte-kz2qh6{stroke-width:3;stroke:var(--black);fill:none}.axis-tick.svelte-kz2qh6{stroke-width:1;fill:none;opacity:0;font-size:9px}.axis-text.svelte-kz2qh6{font-size:calc(var(--smallText) * .9)}.svelte-1pknxov{font-family:Lato}.card-container.svelte-1pknxov{border:2px solid var(--black);width:100%;height:100%;display:grid;grid-template-columns:100%;grid-template-rows:35% 50% 10%;padding:5px;box-sizing:border-box}.card-text.svelte-1pknxov{text-align:left;margin:0;padding:0 0 0 2px;font-weight:700;font-size:.8em}#feedback-dropdown.svelte-1pknxov{width:98%;border:none;border-bottom:1px solid var(--black);border-top:1px solid var(--black);font-size:var(--smallText);margin-bottom:1px}svg.svelte-1pknxov{width:100%;height:100%;border-bottom:1px solid var(--black)}.small.svelte-1pknxov{font-size:.6em}text.svelte-1pknxov{font-size:3rem;transition:opacity .3s;stroke:#fff;stroke-width:6px;fill:var(--black);stroke-linejoin:round;paint-order:stroke fill;pointer-events:none}.card-container.svelte-mchgj2{border:2px solid var(--black);width:100%;height:100%;display:grid;grid-template-columns:100%;grid-template-rows:35% 50% 10%;padding:5px;box-sizing:border-box}.card-text.svelte-mchgj2{text-align:left;margin:0;padding:0 0 0 2px;font-weight:700;font-size:.8em}#feedback-dropdown.svelte-mchgj2{width:98%;border:none;border-bottom:1px solid var(--black);border-top:1px solid var(--black);font-size:var(--smallText);margin-bottom:1px}svg.svelte-mchgj2{width:100%;height:100%;border-bottom:1px solid var(--black)}.small.svelte-mchgj2{font-size:.6em}text.svelte-mchgj2{font-size:3rem;transition:opacity .3s;stroke:#fff;stroke-width:6px;fill:var(--black);stroke-linejoin:round;paint-order:stroke fill;pointer-events:none}.feedback-container.svelte-14znspc{border-bottom:var(--line);border-right:var(--line);display:grid;grid-template-columns:30% 70%;grid-template-rows:100%;width:90%;height:calc(100vh - var(--headerHeight))}.feedback-left.svelte-14znspc{border-bottom:var(--line);display:grid;grid-template-columns:100%;grid-template-rows:25% 25% 25% 12.5% 12.5%}.left-text.svelte-14znspc{text-align:center;border-bottom:var(--line);border-right:var(--line);display:grid;grid-template-rows:100%;grid-template-columns:50% 50%}.left-confidence.svelte-14znspc{text-align:center;border-bottom:var(--line);border-right:var(--line);display:grid;grid-template-rows:40% 55%}.left-question.svelte-14znspc,.left-filter.svelte-14znspc{border-bottom:var(--line);border-right:var(--line)}.feedback-right.svelte-14znspc{border-bottom:var(--line);border-right:var(--line);display:grid;grid-template-columns:100%;grid-template-rows:30% 70%;grid-template-rows:0% 100%}.right-chart.svelte-14znspc{border-bottom:var(--line);border-right:var(--line);display:grid;grid-template-columns:50% 50%;grid-template-rows:100%}.right-chart-1.svelte-14znspc,.right-chart-2.svelte-14znspc{border-right:var(--line)}.right-table.svelte-14znspc{border-bottom:var(--line);border-right:var(--line)}.card-1.svelte-14znspc{border-right:var(--line)}.ranked-chat.svelte-1nj8mt0.svelte-1nj8mt0{height:100vh;display:grid;grid-template-columns:100%;grid-template-rows:80% 20%}.chat-input-holder.svelte-1nj8mt0.svelte-1nj8mt0{display:flex;flex-direction:column;align-items:center;padding:24px;width:100%;max-width:640px;margin:auto}.chat-input-textarea.svelte-1nj8mt0.svelte-1nj8mt0{background-color:var(--lightgrey);cursor:pointer;width:100%;border:var(--line);border-color:none;margin:12px;outline:none;padding:12px;color:var(--black);font-size:var(--baseFontSize);box-shadow:var(--shadow-md);flex:3;border-radius:0;border-right:0px}.chat-input-form.svelte-1nj8mt0.svelte-1nj8mt0{display:flex;width:100%}.btnyousend.svelte-1nj8mt0.svelte-1nj8mt0{border-radius:0;margin-top:12px;margin-bottom:12px;margin-left:-15px;background:var(--primary);color:var(--black);opacity:.5;transition:all .3s}.active.svelte-1nj8mt0.svelte-1nj8mt0{opacity:1}.instructions.svelte-1nj8mt0.svelte-1nj8mt0{text-align:center;padding:5%;border-right:var(--line)}.instructions.svelte-1nj8mt0 h5.svelte-1nj8mt0{text-align:left}.instructions.svelte-1nj8mt0 p.svelte-1nj8mt0{font-size:var(--smallText);text-align:left;margin:0}.instructions.svelte-1nj8mt0 button.svelte-1nj8mt0{font-size:var(--smallText)}.ranked-feedback-container.svelte-1nj8mt0.svelte-1nj8mt0{display:grid;grid-template-columns:20% 80%}.underline.svelte-1nj8mt0.svelte-1nj8mt0{border-bottom:var(--line)}.bold.svelte-1nj8mt0.svelte-1nj8mt0{font-weight:700;font-size:var(--smallText);margin:0;padding:0}.chatbox.svelte-1nj8mt0.svelte-1nj8mt0{display:flex;flex-direction:column;justify-content:space-between;height:calc(100vh - var(--headerHeight));background-color:var(--white);box-sizing:border-box;width:95%;margin:auto;height:100%}.chat-log.svelte-1nj8mt0.svelte-1nj8mt0{flex:1;overflow-y:auto;padding:0 10px;box-sizing:border-box}.chat-message.svelte-1nj8mt0.svelte-1nj8mt0{background-color:var(--white);border-bottom:var(--line);box-sizing:border-box}.chat-message-center.svelte-1nj8mt0.svelte-1nj8mt0{display:flex;flex-direction:column;margin-left:auto;margin-right:auto;padding:12px;box-sizing:border-box}.message-content.svelte-1nj8mt0.svelte-1nj8mt0{display:flex;flex-direction:column;box-sizing:border-box}.message-content.svelte-1nj8mt0 .question.svelte-1nj8mt0{text-align:left;border:1px solid var(--grey);padding:5px;margin-bottom:10px;background-color:var(--lightGrey)}.message-content.svelte-1nj8mt0 .answer.svelte-1nj8mt0{display:inline-block;text-align:left;padding:10px;border:1px solid var(--black)}option.svelte-1nj8mt0.svelte-1nj8mt0{font-weight:700;font-size:120%}p.svelte-1nj8mt0.svelte-1nj8mt0{margin:0}.svelte-1nna9rx{font-family:Lato}#chart-holder.svelte-1nna9rx{height:100%;width:100%}.axis-line.svelte-1nna9rx{stroke-width:3;stroke:#000;fill:none}.axis-tick.svelte-1nna9rx{stroke-width:2;stroke:#000;fill:none;opacity:.13}.axis-text.svelte-1nna9rx{font-family:Arial;font-size:12px}.bump-text.svelte-1nna9rx{font-size:12px;pointer-events:none}.model-path.svelte-1nna9rx{fill:none;stroke-width:5;stroke-linecap:round;stroke-linejoin:round}.model-path-outer.svelte-1nna9rx{fill:none;stroke-width:8;stroke-linecap:round;stroke-linejoin:round}.chart-subtitle.svelte-1nna9rx{font-size:12px}#bar-chart-holder.svelte-1y9gffu{height:100%;width:100%}.axis-text.svelte-1y9gffu{font-size:9px}.axis-line.svelte-1y9gffu{stroke-width:3;stroke:#000;fill:none}.label-text.svelte-1y9gffu{font-size:9px}.cell.svelte-hnulv9{max-height:40px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.cell.active.svelte-hnulv9{max-height:100%;overflow:visible;white-space:normal}.svelte-owgjbp.svelte-owgjbp{font-family:Lato,monospace}.table.svelte-owgjbp.svelte-owgjbp{margin:auto;width:90%}.pretty-pager.svelte-owgjbp.svelte-owgjbp{padding-top:1rem}.pretty-table.normal.svelte-owgjbp.svelte-owgjbp{font-size:15px}.pretty-table.normal.svelte-owgjbp th.svelte-owgjbp,.pretty-table.normal.svelte-owgjbp td.svelte-owgjbp{padding:3px 2px}.pretty-table.svelte-owgjbp th.svelte-owgjbp,.pretty-table.svelte-owgjbp td.svelte-owgjbp{vertical-align:top}.pretty-table.svelte-owgjbp thead th.svelte-owgjbp{text-transform:uppercase;font-weight:700;font-family:Work Sans,sans-serif;border-bottom:2px solid black}.pretty-table.svelte-owgjbp th.svelte-owgjbp{cursor:pointer}.pretty-table.svelte-owgjbp tbody td.cell-type-number.svelte-owgjbp,.pretty-table.svelte-owgjbp tbody td.cell-rank.svelte-owgjbp{text-align:right}.pretty-table.svelte-owgjbp tbody td.cell-type-number.svelte-owgjbp,.pretty-table.svelte-owgjbp tbody td.cell-rank.svelte-owgjbp{font-family:menlo,consolas,monaco,monospace;font-size:90%}.pretty-table.svelte-owgjbp tbody td.cell-rank.svelte-owgjbp{padding-right:1em;color:#666}table.pretty-table.svelte-owgjbp.svelte-owgjbp{border-collapse:collapse}table.pretty-table.svelte-owgjbp.svelte-owgjbp{border-collapse:collapse;table-layout:fixed}.pretty-table.svelte-owgjbp tr.svelte-owgjbp{border-bottom:1px solid #eee}td.active.svelte-owgjbp.svelte-owgjbp{max-height:100%;overflow:auto;color:red}td.svelte-owgjbp.svelte-owgjbp:not(.active){overflow:hidden;white-space:normal}tr.svelte-owgjbp.svelte-owgjbp:hover{background:#eee}.pretty-table.svelte-owgjbp.svelte-owgjbp{width:100%}#heatmap-holder.svelte-t6wv8i{height:100%;width:100%}.axis-text.svelte-t6wv8i,.chart-subtitle.svelte-t6wv8i{font-size:12px}.holder.svelte-1gze3r0.svelte-1gze3r0{height:100vh;width:100%;display:flex;justify-content:center;align-items:center}button.svelte-1gze3r0.svelte-1gze3r0{margin:0}.chart-captions.svelte-1gze3r0.svelte-1gze3r0{margin:auto;width:100%;text-align:left;height:100%}.chart-captions.svelte-1gze3r0 h4.svelte-1gze3r0{padding:0;margin:0}.instructions.svelte-1gze3r0.svelte-1gze3r0{text-align:left;padding-left:0}.instructions.svelte-1gze3r0 p.svelte-1gze3r0{font-size:var(--smallText);text-align:left}.instructions.svelte-1gze3r0 button.svelte-1gze3r0{font-size:var(--smallText)}.underline.svelte-1gze3r0.svelte-1gze3r0{border-bottom:var(--line)}.bold.svelte-1gze3r0.svelte-1gze3r0{font-weight:700;font-size:var(--smallText);margin:0;padding:0}.instructions.svelte-1gze3r0.svelte-1gze3r0{border-right:1px solid #eee}.main-container.svelte-1gze3r0.svelte-1gze3r0{display:grid;grid-template-columns:20% 80%}.eval-container.svelte-1gze3r0.svelte-1gze3r0{display:grid;height:100vh;grid-template-rows:100%;grid-template-columns:65% 35%;padding:1rem}.left-charts.svelte-1gze3r0.svelte-1gze3r0{display:grid;grid-template-columns:100%;grid-template-rows:15% 60% 25%}.eval-table.svelte-1gze3r0.svelte-1gze3r0{margin:auto;width:100%}.right-charts.svelte-1gze3r0.svelte-1gze3r0{display:grid;grid-template-columns:100%;grid-template-rows:10% 33% 33%;gap:1%}.main-annotation-container.svelte-3wjb3y.svelte-3wjb3y{display:grid;grid-template-columns:100%;grid-template-rows:90% 10%;height:100vh;width:100%;margin:auto}.buttons.svelte-3wjb3y.svelte-3wjb3y{display:flex;background:var(--grey)}.rating-button.svelte-3wjb3y.svelte-3wjb3y{padding:10px;border:none}.rating-button.svelte-3wjb3y+.rating-button.svelte-3wjb3y{margin-left:-1px}.ranked-chat.svelte-3wjb3y.svelte-3wjb3y{display:grid;grid-template-columns:100%;grid-template-rows:100%;border:var(--line);margin:12px}.chat-input-holder.svelte-3wjb3y.svelte-3wjb3y{align-items:center;width:100%;margin:auto;border-top:var(--line)}.instructions.svelte-3wjb3y.svelte-3wjb3y{text-align:center;padding:5%}.instructions.svelte-3wjb3y h5.svelte-3wjb3y{text-align:left}.instructions.svelte-3wjb3y p.svelte-3wjb3y{font-size:var(--smallText);text-align:left}.instructions.svelte-3wjb3y button.svelte-3wjb3y{font-size:var(--smallText)}.annotation-container.svelte-3wjb3y.svelte-3wjb3y{display:grid;grid-template-columns:40% 60%}.underline.svelte-3wjb3y.svelte-3wjb3y{border-bottom:var(--line)}.bold.svelte-3wjb3y.svelte-3wjb3y{font-weight:700;font-size:var(--smallText);margin:0;padding:0}.chatbox.svelte-3wjb3y.svelte-3wjb3y{display:flex;flex-direction:column;justify-content:space-between;height:calc(100vh - var(--headerHeight));background-color:var(--white);box-sizing:border-box;width:95%;margin:auto;height:100%}.chat-message-center.svelte-3wjb3y.svelte-3wjb3y{display:flex;flex-direction:column;padding:12px;box-sizing:border-box}.message-content.svelte-3wjb3y.svelte-3wjb3y{display:flex;flex-direction:column;box-sizing:border-box;display:block}.message-content.svelte-3wjb3y .question.svelte-3wjb3y{text-align:left;border:1px solid var(--grey);padding:5px;margin-bottom:10px;background-color:var(--lightGrey)}.message-content.svelte-3wjb3y .answer.svelte-3wjb3y{display:block;text-align:left;padding:10px;border:1px solid var(--black)}.message-content.svelte-3wjb3y .answers.svelte-3wjb3y{display:grid;grid-template-columns:100%;gap:2%;width:100%;margin:auto}svg.svelte-h2ab3o{background:conic-gradient(from 90deg at 1px 1px,#0000 90deg,rgba(0,0,0,.04) 0) 0 0/20px 20px;border:var(--line)}.file-circle-g.svelte-h2ab3o:hover{opacity:1}.bubble-file-text.svelte-h2ab3o{font-size:calc(.99 * var(--smallText));pointer-events:none;stroke:var(--white);stroke-width:4px;fill:var(--black);stroke-linejoin:round;paint-order:stroke fill}circle.svelte-h2ab3o{transition:all .3s ease}circle.svelte-h2ab3o:hover{stroke:var(--black);stroke-width:3}.table-container.svelte-16fb3tv.svelte-16fb3tv{margin:auto;width:100%;overflow-y:scroll;max-height:100%;height:100%;overflow-y:auto}table.svelte-16fb3tv.svelte-16fb3tv{width:100%;border-collapse:collapse;font-size:var(--smallText)}thead.svelte-16fb3tv th.svelte-16fb3tv{text-align:center;padding:5px;border-bottom:4px solid var(--grey);background-color:var(--lightGrey)}thead.svelte-16fb3tv th.svelte-16fb3tv:nth-child(1){text-align:left}tbody.svelte-16fb3tv tr.svelte-16fb3tv{border-bottom:var(--line)}tbody.svelte-16fb3tv tr.svelte-16fb3tv:nth-child(2n){background-color:var(--white)}tbody.svelte-16fb3tv td.svelte-16fb3tv{padding:10px}.is-flex.svelte-16fb3tv.svelte-16fb3tv{display:flex;justify-content:space-between;align-items:center;padding:10px}.button.svelte-16fb3tv.svelte-16fb3tv{padding:5px 10px;border:none;cursor:pointer;transition:background-color .3s ease}.button.is-disabled.svelte-16fb3tv.svelte-16fb3tv{cursor:not-allowed;color:#ccc}.button.svelte-16fb3tv.svelte-16fb3tv:not(.is-disabled):hover{background-color:#f2f2f2}.button.is-white.svelte-16fb3tv.svelte-16fb3tv{color:#000}.mx-1.svelte-16fb3tv.svelte-16fb3tv{margin-left:1em;margin-right:1em}.file-container.svelte-1lu6hos{display:grid;height:calc(100% - var(--headerHeight));align-items:center;justify-content:center}.upload-container.svelte-1lu6hos{margin:auto;max-width:100%;text-align:center}.charts-container.svelte-1lu6hos{height:calc(100vh - var(--headerHeight));display:grid;gap:2%;grid-template-columns:100%;grid-template-rows:50% 40%}.data-grid.svelte-1lu6hos{display:grid;grid-template-columns:45% 50%;gap:0;margin:auto;max-width:1200px;padding-top:20px}.upload-box.svelte-1lu6hos{display:flex;flex-direction:column;justify-content:center;align-items:center;height:100%;max-height:50vh;margin:auto;border:5px dashed var(--grey);padding:20px;box-sizing:border-box} diff --git a/pykoi/frontend/dist/assets/index-e352a05f.js b/pykoi/frontend/dist/assets/index-e352a05f.js new file mode 100644 index 0000000..de2f783 --- /dev/null +++ b/pykoi/frontend/dist/assets/index-e352a05f.js @@ -0,0 +1,70 @@ +(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const l of o.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).observe(document,{childList:!0,subtree:!0});function n(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 r(i){if(i.ep)return;i.ep=!0;const o=n(i);fetch(i.href,o)}})();function H(){}const ts=e=>e;function Bn(e,t){for(const n in t)e[n]=t[n];return e}function ns(e){return e()}function jr(){return Object.create(null)}function _e(e){e.forEach(ns)}function Ye(e){return typeof e=="function"}function re(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}function Ra(e){return Object.keys(e).length===0}function gr(e,...t){if(e==null)return H;const n=e.subscribe(...t);return n.unsubscribe?()=>n.unsubscribe():n}function Aa(e){let t;return gr(e,n=>t=n)(),t}function ee(e,t,n){e.$$.on_destroy.push(gr(t,n))}function Ii(e){return e??""}function Oe(e,t,n){return e.set(n),t}function gn(e){return e&&Ye(e.destroy)?e.destroy:H}const rs=typeof window<"u";let is=rs?()=>window.performance.now():()=>Date.now(),hi=rs?e=>requestAnimationFrame(e):H;const Vt=new Set;function os(e){Vt.forEach(t=>{t.c(e)||(Vt.delete(t),t.f())}),Vt.size!==0&&hi(os)}function ls(e){let t;return Vt.size===0&&hi(os),{promise:new Promise(n=>{Vt.add(t={c:e,f:n})}),abort(){Vt.delete(t)}}}let hr=!1;function Ea(){hr=!0}function Ma(){hr=!1}function Fa(e,t,n,r){for(;e>1);n(i)<=r?e=i+1:t=i}return e}function Da(e){if(e.hydrate_init)return;e.hydrate_init=!0;let t=e.childNodes;if(e.nodeName==="HEAD"){const s=[];for(let u=0;u0&&t[n[i]].claim_order<=u?i+1:Fa(1,i,d=>t[n[d]].claim_order,u))-1;r[s]=n[c]+1;const f=c+1;n[f]=s,i=Math.max(f,i)}const o=[],l=[];let a=t.length-1;for(let s=n[i]+1;s!=0;s=r[s-1]){for(o.push(t[s-1]);a>=s;a--)l.push(t[a]);a--}for(;a>=0;a--)l.push(t[a]);o.reverse(),l.sort((s,u)=>s.claim_order-u.claim_order);for(let s=0,u=0;s=o[u].claim_order;)u++;const c=ue.removeEventListener(t,n,r)}function h(e,t,n){n==null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function Ta(e){return Array.from(e.childNodes)}function Oa(e){e.claim_info===void 0&&(e.claim_info={last_index:0,total_claimed:0})}function Va(e,t,n,r,i=!1){Oa(e);const o=(()=>{for(let l=e.claim_info.last_index;l=0;l--){const a=e[l];if(t(a)){const s=n(a);return s===void 0?e.splice(l,1):e[l]=s,i?s===void 0&&e.claim_info.last_index--:e.claim_info.last_index=l,a}}return r()})();return o.claim_order=e.claim_info.total_claimed,e.claim_info.total_claimed+=1,o}function za(e,t){return Va(e,n=>n.nodeType===3,n=>{const r=""+t;if(n.data.startsWith(r)){if(n.data.length!==r.length)return n.splitText(r.length)}else n.data=r},()=>z(t),!0)}function Q(e,t){t=""+t,e.data!==t&&(e.data=t)}function tt(e,t){e.value=t??""}function Re(e,t,n,r){n==null?e.style.removeProperty(t):e.style.setProperty(t,n,r?"important":"")}function Un(e,t,n){for(let r=0;r{l.source===r.contentWindow&&t()})):(r.src="about:blank",r.onload=()=>{o=j(r.contentWindow,"resize",t),t()}),v(e,r),()=>{(i||o&&r.contentWindow)&&o(),x(r)}}function en(e,t,n){e.classList[n?"add":"remove"](t)}function La(e,t,{bubbles:n=!1,cancelable:r=!1}={}){const i=document.createEvent("CustomEvent");return i.initCustomEvent(e,n,r,t),i}function mt(e,t){return new e(t)}const Wn=new Map;let Xn=0;function qa(e){let t=5381,n=e.length;for(;n--;)t=(t<<5)-t^e.charCodeAt(n);return t>>>0}function Ga(e,t){const n={stylesheet:Ia(t),rules:{}};return Wn.set(e,n),n}function Ni(e,t,n,r,i,o,l,a=0){const s=16.666/r;let u=`{ +`;for(let _=0;_<=1;_+=s){const b=t+(n-t)*o(_);u+=_*100+`%{${l(b,1-b)}} +`}const c=u+`100% {${l(n,1-n)}} +}`,f=`__svelte_${qa(c)}_${a}`,d=ss(e),{stylesheet:g,rules:p}=Wn.get(d)||Ga(d,e);p[f]||(p[f]=!0,g.insertRule(`@keyframes ${f} ${c}`,g.cssRules.length));const m=e.style.animation||"";return e.style.animation=`${m?`${m}, `:""}${f} ${r}ms linear ${i}ms 1 both`,Xn+=1,f}function ja(e,t){const n=(e.style.animation||"").split(", "),r=n.filter(t?o=>o.indexOf(t)<0:o=>o.indexOf("__svelte")===-1),i=n.length-r.length;i&&(e.style.animation=r.join(", "),Xn-=i,Xn||Ba())}function Ba(){hi(()=>{Xn||(Wn.forEach(e=>{const{ownerNode:t}=e.stylesheet;t&&x(t)}),Wn.clear())})}let Gt;function kt(e){Gt=e}function Ua(){if(!Gt)throw new Error("Function called outside component initialization");return Gt}function ut(e){Ua().$$.on_mount.push(e)}const Pt=[],hn=[];let zt=[];const Pi=[],Wa=Promise.resolve();let Br=!1;function Xa(){Br||(Br=!0,Wa.then(us))}function Se(e){zt.push(e)}const wr=new Set;let Ft=0;function us(){if(Ft!==0)return;const e=Gt;do{try{for(;Fte.indexOf(r)===-1?t.push(r):n.push(r)),n.forEach(r=>r()),zt=t}let Qt;function Ka(){return Qt||(Qt=Promise.resolve(),Qt.then(()=>{Qt=null})),Qt}function yr(e,t,n){e.dispatchEvent(La(`${t?"intro":"outro"}${n}`))}const Vn=new Set;let ot;function ue(){ot={r:0,c:[],p:ot}}function ce(){ot.r||_e(ot.c),ot=ot.p}function N(e,t){e&&e.i&&(Vn.delete(e),e.i(t))}function V(e,t,n,r){if(e&&e.o){if(Vn.has(e))return;Vn.add(e),ot.c.push(()=>{Vn.delete(e),r&&(n&&e.d(1),r())}),e.o(t)}else r&&r()}const Ja={duration:0};function Ke(e,t,n,r){const i={direction:"both"};let o=t(e,n,i),l=r?0:1,a=null,s=null,u=null;function c(){u&&ja(e,u)}function f(g,p){const m=g.b-l;return p*=Math.abs(m),{a:l,b:g.b,d:m,duration:p,start:g.start,end:g.start+p,group:g.group}}function d(g){const{delay:p=0,duration:m=300,easing:_=ts,tick:b=H,css:w}=o||Ja,C={start:is()+p,b:g};g||(C.group=ot,ot.r+=1),a||s?s=C:(w&&(c(),u=Ni(e,l,g,m,p,_,w)),g&&b(0,1),a=f(C,m),Se(()=>yr(e,g,"start")),ls(A=>{if(s&&A>s.start&&(a=f(s,m),s=null,yr(e,a.b,"start"),w&&(c(),u=Ni(e,l,a.b,a.duration,0,_,o.css))),a){if(A>=a.end)b(l=a.b,1-l),yr(e,a.b,"end"),s||(a.b?c():--a.group.r||_e(a.group.c)),a=null;else if(A>=a.start){const $=A-a.start;l=a.a+a.d*_($/a.duration),b(l,1-l)}}return!!(a||s)}))}return{run(g){Ye(o)?Ka().then(()=>{o=o(i),d(g)}):d(g)},end(){c(),a=s=null}}}function pr(e,t){e.d(1),t.delete(e.key)}function cs(e,t){V(e,1,1,()=>{t.delete(e.key)})}function Xt(e,t,n,r,i,o,l,a,s,u,c,f){let d=e.length,g=o.length,p=d;const m={};for(;p--;)m[e[p].key]=p;const _=[],b=new Map,w=new Map,C=[];for(p=g;p--;){const S=f(i,o,p),k=n(S);let y=l.get(k);y?r&&C.push(()=>y.p(S,t)):(y=u(k,S),y.c()),b.set(k,_[p]=y),k in m&&w.set(k,Math.abs(p-m[k]))}const A=new Set,$=new Set;function E(S){N(S,1),S.m(a,c),l.set(S.key,S),c=S.first,g--}for(;d&&g;){const S=_[g-1],k=e[d-1],y=S.key,M=k.key;S===k?(c=S.first,d--,g--):b.has(M)?!l.has(y)||A.has(y)?E(S):$.has(M)?d--:w.get(y)>w.get(M)?($.add(y),E(S)):(A.add(M),d--):(s(k,l),d--)}for(;d--;){const S=e[d];b.has(S.key)||s(S,l)}for(;g;)E(_[g-1]);return _e(C),_}function fs(e,t){const n={},r={},i={$$scope:1};let o=e.length;for(;o--;){const l=e[o],a=t[o];if(a){for(const s in l)s in a||(r[s]=1);for(const s in a)i[s]||(n[s]=a[s],i[s]=1);e[o]=a}else for(const s in l)i[s]=1}for(const l in r)l in n||(n[l]=void 0);return n}function ds(e){return typeof e=="object"&&e!==null?e:{}}const Za=/[&"]/g,eu=/[&<]/g;function tu(e,t=!1){const n=String(e),r=t?Za:eu;r.lastIndex=0;let i="",o=0;for(;r.test(n);){const l=r.lastIndex-1,a=n[l];i+=n.substring(o,l)+(a==="&"?"&":a==='"'?""":"<"),o=l+1}return i+n.substring(o)}function nu(e,t){if(!e||!e.$$render)throw t==="svelte:component"&&(t+=" this={...}"),new Error(`<${t}> is not a valid SSR component. You may need to review your build config to ensure that dependencies are compiled, rather than imported as pre-compiled modules. Otherwise you may need to fix a <${t}>.`);return e}let Sr;function gs(e){function t(n,r,i,o,l){const a=Gt,s={on_destroy:Sr,context:new Map(l||(a?a.$$.context:[])),on_mount:[],before_update:[],after_update:[],callbacks:jr()};kt({$$:s});const u=e(n,r,i,o);return kt(a),u}return{render:(n={},{$$slots:r={},context:i=new Map}={})=>{Sr=[];const o={title:"",head:"",css:new Set},l=t(o,n,{},r,i);return _e(Sr),{html:l,css:{code:Array.from(o.css).map(a=>a.code).join(` +`),map:null},head:o.title+o.head}},$$render:t}}function Z(e){e&&e.c()}function ru(e,t){e&&e.l(t)}function K(e,t,n,r){const{fragment:i,after_update:o}=e.$$;i&&i.m(t,n),r||Se(()=>{const l=e.$$.on_mount.map(ns).filter(Ye);e.$$.on_destroy?e.$$.on_destroy.push(...l):_e(l),e.$$.on_mount=[]}),o.forEach(Se)}function J(e,t){const n=e.$$;n.fragment!==null&&(Qa(n.after_update),_e(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function iu(e,t){e.$$.dirty[0]===-1&&(Pt.push(e),Xa(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<{const p=g.length?g[0]:d;return u.ctx&&i(u.ctx[f],u.ctx[f]=p)&&(!u.skip_bound&&u.bound[f]&&u.bound[f](p),c&&iu(e,f)),d}):[],u.update(),c=!0,_e(u.before_update),u.fragment=r?r(u.ctx):!1,t.target){if(t.hydrate){Ea();const f=Ta(t.target);u.fragment&&u.fragment.l(f),f.forEach(x)}else u.fragment&&u.fragment.c();t.intro&&N(e.$$.fragment),K(e,t.target,t.anchor,t.customElement),Ma(),us()}kt(s)}class ie{$destroy(){J(this,1),this.$destroy=H}$on(t,n){if(!Ye(n))return H;const r=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return r.push(n),()=>{const i=r.indexOf(n);i!==-1&&r.splice(i,1)}}$set(t){this.$$set&&!Ra(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const Dt=[];function Ur(e,t){return{subscribe:ke(e,t).subscribe}}function ke(e,t=H){let n;const r=new Set;function i(a){if(re(e,a)&&(e=a,n)){const s=!Dt.length;for(const u of r)u[1](),Dt.push(u,e);if(s){for(let u=0;u{r.delete(u),r.size===0&&n&&(n(),n=null)}}return{set:i,update:o,subscribe:l}}function ou(e,t,n){const r=!Array.isArray(e),i=r?[e]:e,o=t.length<2;return Ur(n,l=>{let a=!1;const s=[];let u=0,c=H;const f=()=>{if(u)return;c();const g=t(r?s[0]:s,l);o?l(g):c=Ye(g)?g:H},d=i.map((g,p)=>gr(g,m=>{s[p]=m,u&=~(1<{u|=1<e;const n=typeof e;if(n!==typeof t||Array.isArray(e)!==Array.isArray(t))throw new Error("Cannot interpolate values of different type");if(Array.isArray(e)){const r=t.map((i,o)=>Wr(e[o],i));return i=>r.map(o=>o(i))}if(n==="object"){if(!e||!t)throw new Error("Object cannot be null");if(xi(e)&&xi(t)){e=e.getTime(),t=t.getTime();const o=t-e;return l=>new Date(e+l*o)}const r=Object.keys(t),i={};return r.forEach(o=>{i[o]=Wr(e[o],t[o])}),o=>{const l={};return r.forEach(a=>{l[a]=i[a](o)}),l}}if(n==="number"){const r=t-e;return i=>e+i*r}throw new Error(`Cannot interpolate ${n} values`)}function mi(e,t={}){const n=ke(e);let r,i=e;function o(l,a){if(e==null)return n.set(e=l),Promise.resolve();i=l;let s=r,u=!1,{delay:c=0,duration:f=400,easing:d=ts,interpolate:g=Wr}=Bn(Bn({},t),a);if(f===0)return s&&(s.abort(),s=null),n.set(e=i),Promise.resolve();const p=is()+c;let m;return r=ls(_=>{if(_f?(n.set(e=l),!1):(n.set(e=m(d(b/f))),!0)}),r.promise}return{set:o,update:(l,a)=>o(l(i,e),a),subscribe:n.subscribe}}const xe=ke([]),Cr=ke([]),kr=ke([]),pn=ke([]),nt=ke("all"),Ti=ke({"n/a":1,up:1,down:1}),lu=["who","what","how","why","where","does","can","n/a"],Xr=mi(lu.map(e=>({question:e,count:0}))),Yr=ke(new Set);var Qr="http://www.w3.org/1999/xhtml";const Oi={svg:"http://www.w3.org/2000/svg",xhtml:Qr,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function hs(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Oi.hasOwnProperty(t)?{space:Oi[t],local:e}:e}function su(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Qr&&t.documentElement.namespaceURI===Qr?t.createElement(e):t.createElementNS(n,e)}}function au(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function ps(e){var t=hs(e);return(t.local?au:su)(t)}function uu(){}function ms(e){return e==null?uu:function(){return this.querySelector(e)}}function cu(e){typeof e!="function"&&(e=ms(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i=C&&(C=w+1);!($=_[C])&&++C=0;)(l=r[i])&&(o&&l.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(l,o),o=l);return this}function Tu(e){e||(e=Ou);function t(f,d){return f&&d?e(f.__data__,d.__data__):!f-!d}for(var n=this._groups,r=n.length,i=new Array(r),o=0;ot?1:e>=t?0:NaN}function Vu(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function zu(){return Array.from(this)}function Hu(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?Ku:typeof t=="function"?Zu:Ju)(e,t,n??"")):tc(this.node(),e)}function tc(e,t){return e.style.getPropertyValue(t)||ws(e).getComputedStyle(e,null).getPropertyValue(t)}function nc(e){return function(){delete this[e]}}function rc(e,t){return function(){this[e]=t}}function ic(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function oc(e,t){return arguments.length>1?this.each((t==null?nc:typeof t=="function"?ic:rc)(e,t)):this.node()[e]}function ys(e){return e.trim().split(/^|\s+/)}function _i(e){return e.classList||new Ss(e)}function Ss(e){this._node=e,this._names=ys(e.getAttribute("class")||"")}Ss.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function Cs(e,t){for(var n=_i(e),r=-1,i=t.length;++r=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function Nc(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,o;n`${b[0].toUpperCase()}${b.slice(1)}`),f=parseFloat(o[`padding${c[0]}`]),d=parseFloat(o[`padding${c[1]}`]),g=parseFloat(o[`margin${c[0]}`]),p=parseFloat(o[`margin${c[1]}`]),m=parseFloat(o[`border${c[0]}Width`]),_=parseFloat(o[`border${c[1]}Width`]);return{delay:t,duration:n,easing:r,css:b=>`overflow: hidden;opacity: ${Math.min(b*20,1)*l};${a}: ${b*s}px;padding-${u[0]}: ${b*f}px;padding-${u[1]}: ${b*d}px;margin-${u[0]}: ${b*g}px;margin-${u[1]}: ${b*p}px;border-${u[0]}-width: ${b*m}px;border-${u[1]}-width: ${b*_}px;`}}function Rn(e,{delay:t=0,duration:n=400,easing:r=pi,start:i=0,opacity:o=0}={}){const l=getComputedStyle(e),a=+l.opacity,s=l.transform==="none"?"":l.transform,u=1-i,c=a*(1-o);return{delay:t,duration:n,easing:r,css:(f,d)=>` + transform: ${s} scale(${1-u*d}); + opacity: ${a-c*d} + `}}function Kr(e,t=2){if(e===0)return"0 Bytes";const n=1024,r=t<0?0:t,i=["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"],o=Math.floor(Math.log(e)/Math.log(n));return parseFloat((e/Math.pow(n,o)).toFixed(r))+" "+i[o]}function Lc(e){let t={who:0,what:0,how:0,why:0,where:0,does:0,can:0,"n/a":0};for(let r=0;r({question:r,count:t[r]}))}function As(e){return e.map(t=>{const n=t.question.split(" ").length,r=t.answer.split(" ").length;return{index:t.index,question:+n,answer:+r,vote:t.vote}})}function qc(e,t){e.classList.add("tooltip"),e.setAttribute("tabindex",0);function n(){const i=document.createElement("span");i.textContent=t,i.setAttribute("id","tooltip"),e.appendChild(i),e.addEventListener("mouseleave",r),e.addEventListener("blur",r),e.removeEventListener("mouseenter",n),e.removeEventListener("focus",n)}function r(){e.removeChild(e.querySelector("#tooltip")),e.removeEventListener("mouseleave",r),e.removeEventListener("blur",r),e.addEventListener("mouseenter",n),e.addEventListener("focus",n)}return e.addEventListener("mouseenter",n),e.addEventListener("focus",n),{onDestroy(){e.classList.remove("tooltip"),e.removeEventListener("mouseenter",n),e.removeEventListener("focus",n)}}}function Vi(e,t,n){const r=e.slice();return r[16]=t[n],r[18]=n,r}function zi(e){let t,n,r,i,o,l;function a(...u){return e[9](e[18],...u)}function s(...u){return e[10](e[18],...u)}return{c(){t=R("div"),n=R("button"),n.textContent="👍",r=D(),i=R("button"),i.textContent="👎",h(n,"class","small-button thumbs-up svelte-19cad35"),h(i,"class","small-button thumbs-down svelte-19cad35"),h(t,"class","feedback-buttons svelte-19cad35")},m(u,c){T(u,t,c),v(t,n),v(t,r),v(t,i),o||(l=[j(n,"click",a),j(i,"click",s)],o=!0)},p(u,c){e=u},d(u){u&&x(t),o=!1,_e(l)}}}function Hi(e,t){let n,r,i,o,l,a,s,u,c,f=t[16].question+"",d,g,p,m,_,b,w,C=t[16].answer+"",A,$,E,S,k,y,M=t[0]&&zi(t);return{key:e,first:null,c(){n=R("div"),r=R("div"),i=R("div"),o=D(),l=R("div"),a=R("div"),s=R("h5"),s.textContent="Question:",u=D(),c=R("p"),d=z(f),g=D(),p=R("div"),m=R("div"),_=R("h5"),_.textContent="Response:",b=D(),w=R("p"),A=z(C),$=D(),M&&M.c(),E=D(),h(i,"class","avatar"),h(s,"class","bold svelte-19cad35"),h(a,"class","question svelte-19cad35"),h(_,"class","bold svelte-19cad35"),h(m,"class","answer svelte-19cad35"),h(p,"class","answers svelte-19cad35"),h(l,"class","message-content svelte-19cad35"),h(r,"class","chat-message-center svelte-19cad35"),h(n,"class","chat-message svelte-19cad35"),this.first=n},m(I,F){T(I,n,F),v(n,r),v(r,i),v(r,o),v(r,l),v(l,a),v(a,s),v(a,u),v(a,c),v(c,d),v(l,g),v(l,p),v(p,m),v(m,_),v(m,b),v(m,w),v(w,A),v(m,$),M&&M.m(m,null),v(n,E),k||(y=gn(S=jc.call(null,n,t[18]===t[4].length-1)),k=!0)},p(I,F){t=I,F&16&&f!==(f=t[16].question+"")&&Q(d,f),F&16&&C!==(C=t[16].answer+"")&&Q(A,C),t[0]?M?M.p(t,F):(M=zi(t),M.c(),M.m(m,null)):M&&(M.d(1),M=null),S&&Ye(S.update)&&F&16&&S.update.call(null,t[18]===t[4].length-1)},d(I){I&&x(n),M&&M.d(),k=!1,y()}}}function Gc(e){let t,n,r,i,o,l,a=[],s=new Map,u,c,f,d,g,p,m=(e[2]?e[3]:"Send")+"",_,b,w,C,A,$,E=e[4];const S=k=>k[18];for(let k=0;kVote Feedback Instructions +

Ask a question to receive an answer from the chatbot. If the response is + satisfactory, click on the 👍 + button. If the repsonse is not satisfactory, click on the + 👎 button.

`,r=D(),i=R("div"),o=R("section"),l=R("div");for(let k=0;k{e.scrollIntoView({behavior:"smooth"})},0)}async function Bc(e){const t=await fetch("/chat/qa_table/update",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(t.ok)console.log("response",t);else{const n=await t.text();alert(n)}}function Uc(e,t,n){let r,i;ee(e,xe,b=>n(4,i=b));let{feedback:o=!1}=t,{is_retrieval:l=!1}=t,a="",s="",u=!1;ut(()=>{c()});async function c(){const A=(await(await fetch("/chat/qa_table/retrieve")).json()).rows.map($=>({id:$[0],question:$[1],answer:$[2],vote_status:$[3]}));Oe(xe,i=[...A],i)}const f=async b=>{b.preventDefault(),a=s,n(1,s=""),n(2,u=!0);let w={id:i.length+1,question:a,answer:"Loading...",vote_status:"na"};Oe(xe,i=[...i,w],i);const C=l?await fetch("/retrieval/new_message",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:a})}):await fetch(`/chat/${a}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:a})});if(C.ok){const A=await C.json();console.log("response data",A),w.answer=A.answer,xe.update($=>($[$.length-1]=w,$))}else{const A=await C.text();alert(A)}n(2,u=!1)};let d=0;setInterval(()=>{n(8,d=(d+1)%4)},200);function g(b,w,C){const A=i[C];A.vote=w;const $={id:C+1,vote_status:w};Bc($),st(b.currentTarget.parentNode).selectAll("button").style("border","3px solid transparent").style("opacity",.65),st(b.currentTarget).style("border","3px solid var(--black)").style("opacity",1)}[...Array(10).keys()].map(b=>String.fromCharCode(65+b));const p=(b,w)=>g(w,"up",b),m=(b,w)=>g(w,"down",b);function _(){s=this.value,n(1,s)}return e.$$set=b=>{"feedback"in b&&n(0,o=b.feedback),"is_retrieval"in b&&n(7,l=b.is_retrieval)},e.$$.update=()=>{e.$$.dirty&256&&n(3,r=".".repeat(d).padEnd(3))},[o,s,u,r,i,f,g,l,d,p,m,_]}class vi extends ie{constructor(t){super(),se(this,t,Uc,Gc,re,{feedback:0,is_retrieval:7})}}function Li(e,t,n){const r=e.slice();return r[14]=t[n],r[16]=n,r}function qi(e,t){let n,r,i,o,l,a,s,u,c,f=t[14].question+"",d,g,p,m,_,b,w,C=t[14].up_ranking_answer+"",A,$,E,S,k,y,M=t[14].low_ranking_answer+"",I,F,P,B,ge;function oe(...ae){return t[7](t[14],t[16],...ae)}function Ee(...ae){return t[8](t[14],t[16],...ae)}function Me(...ae){return t[9](t[14],t[16],...ae)}function ye(...ae){return t[10](t[14],t[16],...ae)}return{key:e,first:null,c(){n=R("div"),r=R("div"),i=R("div"),o=D(),l=R("div"),a=R("div"),s=R("h5"),s.textContent="Question:",u=D(),c=R("p"),d=z(f),g=D(),p=R("div"),m=R("div"),_=R("h5"),_.textContent="Response 1:",b=D(),w=R("p"),A=z(C),$=D(),E=R("div"),S=R("h5"),S.textContent="Response 2:",k=D(),y=R("p"),I=z(M),F=D(),h(i,"class","avatar"),h(s,"class","bold svelte-au920n"),h(a,"class","question svelte-au920n"),h(_,"class","bold underline svelte-au920n"),h(m,"class","answer svelte-au920n"),h(S,"class","bold underline svelte-au920n"),h(E,"class","answer svelte-au920n"),h(p,"class","answers svelte-au920n"),h(l,"class","message-content svelte-au920n"),h(r,"class","chat-message-center svelte-au920n"),h(n,"class","chat-message svelte-au920n"),this.first=n},m(ae,ze){T(ae,n,ze),v(n,r),v(r,i),v(r,o),v(r,l),v(l,a),v(a,s),v(a,u),v(a,c),v(c,d),v(l,g),v(l,p),v(p,m),v(m,_),v(m,b),v(m,w),v(w,A),v(p,$),v(p,E),v(E,S),v(E,k),v(E,y),v(y,I),v(n,F),B||(ge=[j(m,"click",oe),j(m,"keydown",Ee),j(E,"click",Me),j(E,"keydown",ye),gn(P=Xc.call(null,n,t[16]===t[3].length-1))],B=!0)},p(ae,ze){t=ae,ze&8&&f!==(f=t[14].question+"")&&Q(d,f),ze&8&&C!==(C=t[14].up_ranking_answer+"")&&Q(A,C),ze&8&&M!==(M=t[14].low_ranking_answer+"")&&Q(I,M),P&&Ye(P.update)&&ze&8&&P.update.call(null,t[16]===t[3].length-1)},d(ae){ae&&x(n),B=!1,_e(ge)}}}function Wc(e){let t,n,r,i,o,l,a=[],s=new Map,u,c,f,d,g,p,m=(e[1]?e[2]:"Send")+"",_,b,w,C,A,$,E=e[3];const S=k=>k[16];for(let k=0;kRanked Feedback Instructions +

Ask a question and click on the better of the two responses. The better + response will be outlined in green, the worse + response outlined in red. This data will be + automatically fed to RLHF.

+ `,r=D(),i=R("div"),o=R("section"),l=R("div");for(let k=0;k{e.scrollIntoView({behavior:"smooth"})},0)}async function Yc(e){const t=await fetch("/chat/ranking_table/update",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(t.ok)console.log("response",t);else{const n=await t.text();alert(n)}}function Qc(e,t,n){let r,i;ee(e,Cr,_=>n(3,i=_));let o="",l="",a=!1;ut(()=>{});const s=async _=>{_.preventDefault(),o=l,n(0,l=""),n(1,a=!0);let b={question:o,up_ranking_answer:"Loading...",low_ranking_answer:"Loading..."};Oe(Cr,i=[...i,b],i);const w=await fetch(`/chat/multi_responses/${o}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:o})});if(w.ok){const C=await w.json();b.up_ranking_answer=C.answer[0],b.low_ranking_answer=C.answer[1],Cr.update(A=>(A[A.length-1]=b,A))}else{const C=await w.text();alert(C)}n(1,a=!1)};let u=0;setInterval(()=>{n(6,u=(u+1)%4)},200);function c(_,b,w,C){const A=i[w],$={1:"up_ranking_answer",2:"low_ranking_answer"},E={question:A.question,up_ranking_answer:A[$[C]],low_ranking_answer:A[$[C%2+1]]};Yc(E),st(_.currentTarget.parentNode).selectAll("div").style("outline","2px solid var(--red)").style("border","1px solid var(--red)"),st(_.currentTarget).style("outline","2px solid var(--green)").style("border","1px solid var(--green)")}const f=(_,b,w)=>c(w,_,b,1),d=(_,b,w)=>c(w,_,b,1),g=(_,b,w)=>c(w,_,b,2),p=(_,b,w)=>c(w,_,b,2);function m(){l=this.value,n(0,l)}return e.$$.update=()=>{e.$$.dirty&64&&n(2,r=".".repeat(u).padEnd(3))},[l,a,r,i,s,c,u,f,d,g,p,m]}class Kc extends ie{constructor(t){super(),se(this,t,Qc,Wc,re,{})}}function Gi(e,t,n){const r=e.slice();return r[8]=t[n],r[10]=n,r}function ji(e){let t,n,r,i,o=e[8].name+"",l,a,s,u,c;function f(...d){return e[6](e[8],...d)}return{c(){t=R("label"),n=R("input"),l=z(o),a=D(),h(n,"type","checkbox"),h(n,"id",r=e[8].id),n.checked=i=e[1].has(e[8].name),h(t,"for",s=e[8].id)},m(d,g){T(d,t,g),v(t,n),v(t,l),v(t,a),u||(c=j(n,"change",f),u=!0)},p(d,g){e=d,g&1&&r!==(r=e[8].id)&&h(n,"id",r),g&3&&i!==(i=e[1].has(e[8].name))&&(n.checked=i),g&1&&o!==(o=e[8].name+"")&&Q(l,o),g&1&&s!==(s=e[8].id)&&h(t,"for",s)},d(d){d&&x(t),u=!1,c()}}}function Jc(e){let t,n,r,i,o,l,a,s,u,c,f,d=e[0],g=[];for(let p=0;pn(1,r=f));let{documents:i=[]}=t,o=!1,l;function a(){n(2,o=!o)}function s(f,d){d.target.checked?r.add(f):r.delete(f),Yr.set(new Set(r))}const u=(f,d)=>s(f.name,d);function c(f){hn[f?"unshift":"push"](()=>{l=f,n(3,l)})}return e.$$set=f=>{"documents"in f&&n(0,i=f.documents)},e.$$.update=()=>{e.$$.dirty&2&&console.log(r)},[i,r,o,l,a,s,u,c]}let ef=class extends ie{constructor(t){super(),se(this,t,Zc,Jc,re,{documents:0})}};function tf(e){let t;return{c(){t=R("p"),t.textContent="⌄",h(t,"class","svelte-1pk2e1k")},m(n,r){T(n,t,r)},d(n){n&&x(t)}}}function nf(e){let t;return{c(){t=R("p"),t.textContent="⌃",h(t,"class","svelte-1pk2e1k")},m(n,r){T(n,t,r)},d(n){n&&x(t)}}}function Bi(e){let t,n,r,i,o;return{c(){t=R("div"),n=R("p"),r=z(e[1]),h(n,"class","bold svelte-1pk2e1k"),h(t,"class","source_content svelte-1pk2e1k")},m(l,a){T(l,t,a),v(t,n),v(n,r),o=!0},p(l,a){(!o||a&2)&&Q(r,l[1])},i(l){o||(Se(()=>{o&&(i||(i=Ke(t,mn,{},!0)),i.run(1))}),o=!0)},o(l){i||(i=Ke(t,mn,{},!1)),i.run(0),o=!1},d(l){l&&x(t),l&&i&&i.end()}}}function rf(e){let t,n,r,i=e[2]+1+"",o,l,a,s,u,c,f,d,g;function p(w,C){return w[3]?nf:tf}let m=p(e),_=m(e),b=e[3]&&Bi(e);return{c(){t=R("div"),n=R("div"),r=R("p"),o=z(i),l=z(": "),a=z(e[0]),s=D(),_.c(),c=D(),b&&b.c(),h(r,"class","bold svelte-1pk2e1k"),h(n,"class","source_tab svelte-1pk2e1k"),h(t,"class","source svelte-1pk2e1k")},m(w,C){T(w,t,C),v(t,n),v(n,r),v(r,o),v(r,l),v(r,a),v(n,s),_.m(n,null),v(t,c),b&&b.m(t,null),f=!0,d||(g=j(n,"click",e[4]),d=!0)},p(w,[C]){(!f||C&4)&&i!==(i=w[2]+1+"")&&Q(o,i),(!f||C&1)&&Q(a,w[0]),m!==(m=p(w))&&(_.d(1),_=m(w),_&&(_.c(),_.m(n,null))),w[3]?b?(b.p(w,C),C&8&&N(b,1)):(b=Bi(w),b.c(),N(b,1),b.m(t,null)):b&&(ue(),V(b,1,1,()=>{b=null}),ce())},i(w){f||(Se(()=>{f&&(u||(u=Ke(n,mn,{},!0)),u.run(1))}),N(b),f=!0)},o(w){u||(u=Ke(n,mn,{},!1)),u.run(0),V(b),f=!1},d(w){w&&x(t),_.d(),w&&u&&u.end(),b&&b.d(),d=!1,g()}}}function of(e,t,n){let{source:r=""}=t,{source_content:i=""}=t,{i:o=0}=t,l=o===0;const a=()=>n(3,l=!l);return e.$$set=s=>{"source"in s&&n(0,r=s.source),"source_content"in s&&n(1,i=s.source_content),"i"in s&&n(2,o=s.i)},[r,i,o,l,a]}class lf extends ie{constructor(t){super(),se(this,t,of,rf,re,{source:0,source_content:1,i:2})}}function Ui(e,t,n){const r=e.slice();return r[4]=t[n],r[6]=n,r}function Wi(e){let t,n,r,i;const o=[cf,uf,af,sf],l=[];function a(s,u){return s[0][0]==="N/A"?0:s[0][0]==="Loading..."?1:s[0][0]==="Not loaded"?2:3}return t=a(e),n=l[t]=o[t](e),{c(){n.c(),r=Ae()},m(s,u){l[t].m(s,u),T(s,r,u),i=!0},p(s,u){let c=t;t=a(s),t===c?l[t].p(s,u):(ue(),V(l[c],1,1,()=>{l[c]=null}),ce(),n=l[t],n?n.p(s,u):(n=l[t]=o[t](s),n.c()),N(n,1),n.m(r.parentNode,r))},i(s){i||(N(n),i=!0)},o(s){V(n),i=!1},d(s){l[t].d(s),s&&x(r)}}}function sf(e){let t,n,r,i=e[0].length+"",o,l,a,s,u,c,f,d;function g(b,w){return b[2]?df:ff}let p=g(e),m=p(e),_=e[2]&&Xi(e);return{c(){t=R("div"),n=R("h5"),r=z("📖 Response Sources ("),o=z(i),l=z(")"),a=D(),m.c(),s=D(),_&&_.c(),u=Ae(),h(n,"class","bold"),h(t,"class","sources-header svelte-1r759df")},m(b,w){T(b,t,w),v(t,n),v(n,r),v(n,o),v(n,l),v(t,a),m.m(t,null),T(b,s,w),_&&_.m(b,w),T(b,u,w),c=!0,f||(d=j(t,"click",e[3]),f=!0)},p(b,w){(!c||w&1)&&i!==(i=b[0].length+"")&&Q(o,i),p!==(p=g(b))&&(m.d(1),m=p(b),m&&(m.c(),m.m(t,null))),b[2]?_?(_.p(b,w),w&4&&N(_,1)):(_=Xi(b),_.c(),N(_,1),_.m(u.parentNode,u)):_&&(ue(),V(_,1,1,()=>{_=null}),ce())},i(b){c||(N(_),c=!0)},o(b){V(_),c=!1},d(b){b&&x(t),m.d(),b&&x(s),_&&_.d(b),b&&x(u),f=!1,d()}}}function af(e){let t;return{c(){t=R("h5"),t.textContent="⚠ī¸ No sources loaded",h(t,"class","bold")},m(n,r){T(n,t,r)},p:H,i:H,o:H,d(n){n&&x(t)}}}function uf(e){let t;return{c(){t=R("h5"),t.textContent="📖 Loading...",h(t,"class","bold")},m(n,r){T(n,t,r)},p:H,i:H,o:H,d(n){n&&x(t)}}}function cf(e){let t;return{c(){t=R("h5"),t.textContent="⚠ī¸ No Retrieval Sources selected",h(t,"class","bold")},m(n,r){T(n,t,r)},p:H,i:H,o:H,d(n){n&&x(t)}}}function ff(e){let t;return{c(){t=R("span"),t.textContent="⌄"},m(n,r){T(n,t,r)},d(n){n&&x(t)}}}function df(e){let t;return{c(){t=R("span"),t.textContent="⌃"},m(n,r){T(n,t,r)},d(n){n&&x(t)}}}function Xi(e){let t,n,r=e[0],i=[];for(let l=0;lV(i[l],1,1,()=>{i[l]=null});return{c(){for(let l=0;l{r=null}),ce())},i(i){n||(N(r),n=!0)},o(i){V(r),n=!1},d(i){i&&x(t),r&&r.d()}}}function hf(e,t,n){let{sources:r=[]}=t,{source_content:i=[]}=t,o=!1;const l=()=>n(2,o=!o);return e.$$set=a=>{"sources"in a&&n(0,r=a.sources),"source_content"in a&&n(1,i=a.source_content)},[r,i,o,l]}class pf extends ie{constructor(t){super(),se(this,t,hf,gf,re,{sources:0,source_content:1})}}function Qi(e,t,n){const r=e.slice();return r[4]=t[n],r}function Ki(e,t,n){const r=e.slice();return r[4]=t[n],r}function Ji(e){let t,n,r,i=e[4].label+"",o,l,a,s,u;return{c(){t=R("li"),n=R("span"),r=R("h5"),o=z(i),l=D(),h(r,"class","bold"),h(n,"class","svelte-iwm583"),h(t,"class",a=Ii(e[0]===e[4].value?"active":"")+" svelte-iwm583")},m(c,f){T(c,t,f),v(t,n),v(n,r),v(r,o),v(t,l),s||(u=j(n,"click",function(){Ye(e[3](e[4].value))&&e[3](e[4].value).apply(this,arguments)}),s=!0)},p(c,f){e=c,f&2&&i!==(i=e[4].label+"")&&Q(o,i),f&3&&a!==(a=Ii(e[0]===e[4].value?"active":"")+" svelte-iwm583")&&h(t,"class",a)},d(c){c&&x(t),s=!1,u()}}}function Zi(e){let t,n,r,i;const o=[e[2]];var l=e[4].component;function a(s){let u={};for(let c=0;c{J(f,1)}),ce()}l?(n=mt(l,a()),Z(n.$$.fragment),N(n.$$.fragment,1),K(n,t,r)):n=null}else l&&n.$set(c)},i(s){i||(n&&N(n.$$.fragment,s),i=!0)},o(s){n&&V(n.$$.fragment,s),i=!1},d(s){s&&x(t),n&&J(n)}}}function eo(e){let t,n,r=e[0]==e[4].value&&Zi(e);return{c(){r&&r.c(),t=Ae()},m(i,o){r&&r.m(i,o),T(i,t,o),n=!0},p(i,o){i[0]==i[4].value?r?(r.p(i,o),o&3&&N(r,1)):(r=Zi(i),r.c(),N(r,1),r.m(t.parentNode,t)):r&&(ue(),V(r,1,1,()=>{r=null}),ce())},i(i){n||(N(r),n=!0)},o(i){V(r),n=!1},d(i){r&&r.d(i),i&&x(t)}}}function mf(e){let t,n,r,i,o=e[1],l=[];for(let c=0;cV(s[c],1,1,()=>{s[c]=null});return{c(){t=R("ul");for(let c=0;c()=>n(0,i=a);return e.$$set=a=>{"items"in a&&n(1,r=a.items),"activeTabValue"in a&&n(0,i=a.activeTabValue),"tabProps"in a&&n(2,o=a.tabProps)},[i,r,o,l]}class vf extends ie{constructor(t){super(),se(this,t,_f,mf,re,{items:1,activeTabValue:0,tabProps:2})}}function to(e){let t;return{c(){t=z("Press ENTER to autofill with the RAG answer.")},m(n,r){T(n,t,r)},d(n){n&&x(t)}}}function bf(e){let t,n,r,i,o,l,a,s,u,c,f,d,g,p=e[0].edited_answer===Qn&&to();return{c(){t=R("form"),n=R("textarea"),i=D(),o=R("div"),l=R("div"),p&&p.c(),a=D(),s=R("div"),u=R("button"),u.textContent="Update",c=D(),f=R("button"),f.textContent="Reset",h(n,"placeholder",r=e[0].answer),h(l,"class","note svelte-i9wciy"),h(o,"class","button-container svelte-i9wciy")},m(m,_){T(m,t,_),v(t,n),tt(n,e[0].edited_answer),e[6](n),v(t,i),v(t,o),v(o,l),p&&p.m(l,null),v(o,a),v(o,s),v(s,u),v(s,c),v(s,f),d||(g=[j(n,"input",e[5]),j(n,"keydown",e[4]),j(u,"click",e[2]),j(f,"click",e[3])],d=!0)},p(m,[_]){_&1&&r!==(r=m[0].answer)&&h(n,"placeholder",r),_&1&&tt(n,m[0].edited_answer),m[0].edited_answer===Qn?p||(p=to(),p.c(),p.m(l,null)):p&&(p.d(1),p=null)},i:H,o:H,d(m){m&&x(t),e[6](null),p&&p.d(),d=!1,_e(g)}}}const Qn="";function wf(e,t,n){let{message:r={}}=t,i;const o=async f=>{const d={id:r.id,new_answer:f},g=await fetch("/chat/rag_table/update_answer",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(d)});if(g.ok)console.log("Answer updated successfully",g),n(0,r.edited_answer=f,r);else{const p=await g.text();alert(p)}},l=f=>{f.preventDefault(),o(r.edited_answer)},a=f=>{f.preventDefault(),o(Qn)},s=f=>{f.key=="Enter"&&r.edited_answer===Qn&&(f.preventDefault(),console.log("ENTER"),n(0,r.edited_answer=r.answer,r))};ut(function(){i.focus()});function u(){r.edited_answer=this.value,n(0,r)}function c(f){hn[f?"unshift":"push"](()=>{i=f,n(1,i)})}return e.$$set=f=>{"message"in f&&n(0,r=f.message)},[r,i,l,a,s,u,c]}class yf extends ie{constructor(t){super(),se(this,t,wf,bf,re,{message:0})}}function no(e){let t,n,r,i,o,l;return{c(){t=R("div"),n=R("button"),n.textContent="👍",r=D(),i=R("button"),i.textContent="👎",h(n,"class","small-button thumbs-up svelte-1u8cd0w"),h(i,"class","small-button thumbs-down svelte-1u8cd0w"),h(t,"class","feedback-buttons svelte-1u8cd0w")},m(a,s){T(a,t,s),v(t,n),v(t,r),v(t,i),o||(l=[j(n,"click",e[4]),j(i,"click",e[5])],o=!0)},p:H,d(a){a&&x(t),o=!1,_e(l)}}}function Sf(e){let t,n=e[0].answer+"",r,i,o,l=e[1]&&no(e);return{c(){t=R("div"),r=z(n),i=D(),l&&l.c(),o=Ae()},m(a,s){T(a,t,s),v(t,r),T(a,i,s),l&&l.m(a,s),T(a,o,s)},p(a,[s]){s&1&&n!==(n=a[0].answer+"")&&Q(r,n),a[1]?l?l.p(a,s):(l=no(a),l.c(),l.m(o.parentNode,o)):l&&(l.d(1),l=null)},i:H,o:H,d(a){a&&x(t),a&&x(i),l&&l.d(a),a&&x(o)}}}async function Cf(e){const t=await fetch("/chat/rag_table/update",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(t.ok)console.log("response",t);else{const n=await t.text();alert(n)}}function kf(e,t,n){let r;ee(e,xe,c=>n(6,r=c));let{message:i={}}=t,{feedback:o=!1}=t,{index:l=0}=t;function a(c,f,d){const g=r[d];g.vote=f;const p={id:d+1,vote_status:f};Cf(p),st(c.currentTarget.parentNode).selectAll("button").style("border","3px solid transparent").style("opacity",.65),st(c.currentTarget).style("border","3px solid var(--black)").style("opacity",1)}const s=c=>a(c,"up",l),u=c=>a(c,"down",l);return e.$$set=c=>{"message"in c&&n(0,i=c.message),"feedback"in c&&n(1,o=c.feedback),"index"in c&&n(2,l=c.index)},[i,o,l,a,s,u]}class $f extends ie{constructor(t){super(),se(this,t,kf,Sf,re,{message:0,feedback:1,index:2})}}function ro(e,t,n){const r=e.slice();return r[16]=t[n],r[18]=n,r}function io(e,t){let n,r,i,o,l,a,s,u,c,f=t[16].question+"",d,g,p,m,_,b,w,C,A,$,E,S,k,y,M,I;return A=new vf({props:{items:t[7],tabProps:{message:t[16],feedback:t[0],index:t[18]}}}),E=new pf({props:{sources:t[16].source,source_content:t[16].source_content}}),{key:e,first:null,c(){n=R("div"),r=R("div"),i=R("div"),o=D(),l=R("div"),a=R("div"),s=R("h5"),s.textContent="Question:",u=D(),c=R("p"),d=z(f),g=D(),p=R("div"),m=R("p"),m.textContent="ℹī¸ Retrieval Sources",b=D(),w=R("div"),C=R("div"),Z(A.$$.fragment),$=D(),Z(E.$$.fragment),S=D(),h(i,"class","avatar"),h(s,"class","bold"),h(m,"class","bold"),h(p,"class","rag-sources svelte-aj7hp0"),h(a,"class","question svelte-aj7hp0"),h(C,"class","answer svelte-aj7hp0"),h(w,"class","answers svelte-aj7hp0"),h(l,"class","message-content svelte-aj7hp0"),h(r,"class","chat-message-center svelte-aj7hp0"),h(n,"class","chat-message svelte-aj7hp0"),this.first=n},m(F,P){T(F,n,P),v(n,r),v(r,i),v(r,o),v(r,l),v(l,a),v(a,s),v(a,u),v(a,c),v(c,d),v(a,g),v(a,p),v(p,m),v(l,b),v(l,w),v(w,C),K(A,C,null),v(l,$),K(E,l,null),v(n,S),y=!0,M||(I=[gn(_=qc.call(null,m,oo(t[16]))),gn(k=Af.call(null,n,t[18]===t[4].length-1))],M=!0)},p(F,P){t=F,(!y||P&16)&&f!==(f=t[16].question+"")&&Q(d,f),_&&Ye(_.update)&&P&16&&_.update.call(null,oo(t[16]));const B={};P&17&&(B.tabProps={message:t[16],feedback:t[0],index:t[18]}),A.$set(B);const ge={};P&16&&(ge.sources=t[16].source),P&16&&(ge.source_content=t[16].source_content),E.$set(ge),k&&Ye(k.update)&&P&16&&k.update.call(null,t[18]===t[4].length-1)},i(F){y||(N(A.$$.fragment,F),N(E.$$.fragment,F),y=!0)},o(F){V(A.$$.fragment,F),V(E.$$.fragment,F),y=!1},d(F){F&&x(n),J(A),J(E),M=!1,_e(I)}}}function Rf(e){let t,n,r,i,o,l,a=[],s=new Map,u,c,f,d,g,p,m,_,b,w=(e[2]?e[3]:"Send")+"",C,A,$,E,S,k,y,M=e[4];const I=F=>F[18];for(let F=0;FVote Feedback Instructions +

Ask a question to receive an answer from the chatbot. If the response is + satisfactory, click on the 👍 + button. If the response is not satisfactory, click on the + 👎 button.

`,r=D(),i=R("div"),o=R("section"),l=R("div");for(let F=0;F{e.scrollIntoView({behavior:"smooth"})},0)}function oo(e){return e.rag_sources.length===0?"No Sources":e.rag_sources.join(", ")}function Ef(e,t,n){let r,i,o,l;ee(e,xe,C=>n(4,i=C)),ee(e,Yr,C=>n(13,o=C));let{feedback:a=!1}=t,{is_retrieval:s=!1}=t;const u=ke([]);ee(e,u,C=>n(5,l=C));let c="",f="",d=!1,g=[{label:"Answer",value:1,component:$f},{label:"Modified Answer",value:2,component:yf}];ut(()=>{m(),p()});async function p(){const A=await(await fetch("/retrieval/file/get")).json();console.log("data",A.files);const E=A.files.map((S,k)=>({id:String(k),name:S.name}));console.log("files",E),Oe(u,l=[...E],l)}async function m(){const $=(await(await fetch("/chat/rag_table/retrieve")).json()).rows;console.log("Got data from db",$);const E=$.map(S=>({id:S[0],question:S[1],answer:S[2],edited_answer:S[3],vote_status:S[4],rag_sources:S[5],source:S[6],source_content:S[7]}));Oe(xe,i=[...E],i)}const _=async C=>{C.preventDefault(),c=f,n(1,f=""),n(2,d=!0);const A=[...o];let $={id:i.length+1,question:c,answer:"Loading...",rag_sources:A,vote_status:"na",source:["Loading..."],source_content:["Loading..."]};Oe(xe,i=[...i,$],i);const E=s?await fetch("/retrieval/new_message",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:c,file_names:A})}):await fetch(`/chat/${c}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:c})});if(E.ok){const S=await E.json();console.log("response data",S),$.answer=S.answer,$.source=S.source,$.source_content=S.source_content,xe.update(k=>(k[k.length-1]=$,k))}else{const S=await E.text();alert(S)}n(2,d=!1)};let b=0;setInterval(()=>{n(10,b=(b+1)%4)},200);function w(){f=this.value,n(1,f)}return e.$$set=C=>{"feedback"in C&&n(0,a=C.feedback),"is_retrieval"in C&&n(9,s=C.is_retrieval)},e.$$.update=()=>{e.$$.dirty&1024&&n(3,r=".".repeat(b).padEnd(3))},[a,f,d,r,i,l,u,g,_,s,b,w]}class Mf extends ie{constructor(t){super(),se(this,t,Ef,Rf,re,{feedback:0,is_retrieval:9})}}function lo(e){let t,n;return t=new vi({props:{is_retrieval:e[1]}}),{c(){Z(t.$$.fragment)},m(r,i){K(t,r,i),n=!0},p(r,i){const o={};i&2&&(o.is_retrieval=r[1]),t.$set(o)},i(r){n||(N(t.$$.fragment,r),n=!0)},o(r){V(t.$$.fragment,r),n=!1},d(r){J(t,r)}}}function so(e){let t,n;return t=new vi({props:{feedback:!0,is_retrieval:e[1]}}),{c(){Z(t.$$.fragment)},m(r,i){K(t,r,i),n=!0},p(r,i){const o={};i&2&&(o.is_retrieval=r[1]),t.$set(o)},i(r){n||(N(t.$$.fragment,r),n=!0)},o(r){V(t.$$.fragment,r),n=!1},d(r){J(t,r)}}}function ao(e){let t,n;return t=new Mf({props:{feedback:!0,is_retrieval:e[1]}}),{c(){Z(t.$$.fragment)},m(r,i){K(t,r,i),n=!0},p(r,i){const o={};i&2&&(o.is_retrieval=r[1]),t.$set(o)},i(r){n||(N(t.$$.fragment,r),n=!0)},o(r){V(t.$$.fragment,r),n=!1},d(r){J(t,r)}}}function uo(e){let t,n,r,i;const o=[Df,Ff],l=[];function a(s,u){return s[1]?0:1}return t=a(e),n=l[t]=o[t](e),{c(){n.c(),r=Ae()},m(s,u){l[t].m(s,u),T(s,r,u),i=!0},p(s,u){let c=t;t=a(s),t===c?l[t].p(s,u):(ue(),V(l[c],1,1,()=>{l[c]=null}),ce(),n=l[t],n?n.p(s,u):(n=l[t]=o[t](s),n.c()),N(n,1),n.m(r.parentNode,r))},i(s){i||(N(n),i=!0)},o(s){V(n),i=!1},d(s){l[t].d(s),s&&x(r)}}}function Ff(e){let t,n;return t=new Kc({}),{c(){Z(t.$$.fragment)},m(r,i){K(t,r,i),n=!0},p:H,i(r){n||(N(t.$$.fragment,r),n=!0)},o(r){V(t.$$.fragment,r),n=!1},d(r){J(t,r)}}}function Df(e){let t,n;return t=new vi({props:{feedback:!0,is_retrieval:e[1]}}),{c(){Z(t.$$.fragment)},m(r,i){K(t,r,i),n=!0},p(r,i){const o={};i&2&&(o.is_retrieval=r[1]),t.$set(o)},i(r){n||(N(t.$$.fragment,r),n=!0)},o(r){V(t.$$.fragment,r),n=!1},d(r){J(t,r)}}}function If(e){let t,n,r,i,o,l=!e[0]&&lo(e),a=e[0]==="vote"&&so(e),s=e[0]==="rag"&&ao(e),u=e[0]==="rank"&&uo(e);return{c(){l&&l.c(),t=D(),a&&a.c(),n=D(),s&&s.c(),r=D(),u&&u.c(),i=Ae()},m(c,f){l&&l.m(c,f),T(c,t,f),a&&a.m(c,f),T(c,n,f),s&&s.m(c,f),T(c,r,f),u&&u.m(c,f),T(c,i,f),o=!0},p(c,[f]){c[0]?l&&(ue(),V(l,1,1,()=>{l=null}),ce()):l?(l.p(c,f),f&1&&N(l,1)):(l=lo(c),l.c(),N(l,1),l.m(t.parentNode,t)),c[0]==="vote"?a?(a.p(c,f),f&1&&N(a,1)):(a=so(c),a.c(),N(a,1),a.m(n.parentNode,n)):a&&(ue(),V(a,1,1,()=>{a=null}),ce()),c[0]==="rag"?s?(s.p(c,f),f&1&&N(s,1)):(s=ao(c),s.c(),N(s,1),s.m(r.parentNode,r)):s&&(ue(),V(s,1,1,()=>{s=null}),ce()),c[0]==="rank"?u?(u.p(c,f),f&1&&N(u,1)):(u=uo(c),u.c(),N(u,1),u.m(i.parentNode,i)):u&&(ue(),V(u,1,1,()=>{u=null}),ce())},i(c){o||(N(l),N(a),N(s),N(u),o=!0)},o(c){V(l),V(a),V(s),V(u),o=!1},d(c){l&&l.d(c),c&&x(t),a&&a.d(c),c&&x(n),s&&s.d(c),c&&x(r),u&&u.d(c),c&&x(i)}}}function Nf(e,t,n){let{feedback:r}=t,{is_retrieval:i}=t;return e.$$set=o=>{"feedback"in o&&n(0,r=o.feedback),"is_retrieval"in o&&n(1,i=o.is_retrieval)},[r,i]}class Pf extends ie{constructor(t){super(),se(this,t,Nf,If,re,{feedback:0,is_retrieval:1})}}function co(e,t,n){const r=e.slice();return r[2]=t[n],r}function fo(e){let t,n=e[2]+"",r,i;return{c(){t=R("option"),r=z(n),t.__value=i=e[2],t.value=t.__value},m(o,l){T(o,t,l),v(t,r)},p(o,l){l&1&&n!==(n=o[2]+"")&&Q(r,n),l&1&&i!==(i=o[2])&&(t.__value=i,t.value=t.__value)},d(o){o&&x(t)}}}function xf(e){let t,n=e[0],r=[];for(let i=0;i{const o=await fetch(`/data/${r}`);n(0,i=await o.json())}),e.$$set=o=>{"data_endpoint"in o&&n(1,r=o.data_endpoint)},[i,r]}class Of extends ie{constructor(t){super(),se(this,t,Tf,xf,re,{data_endpoint:1})}}function Ht(e,t){return e==null||t==null?NaN:et?1:e>=t?0:NaN}function Vf(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}function Es(e){let t,n,r;e.length!==2?(t=Ht,n=(a,s)=>Ht(e(a),s),r=(a,s)=>e(a)-s):(t=e===Ht||e===Vf?e:zf,n=e,r=e);function i(a,s,u=0,c=a.length){if(u>>1;n(a[f],s)<0?u=f+1:c=f}while(u>>1;n(a[f],s)<=0?u=f+1:c=f}while(uu&&r(a[f-1],s)>-r(a[f],s)?f-1:f}return{left:i,center:l,right:o}}function zf(){return 0}function Hf(e){return e===null?NaN:+e}function*Lf(e,t){if(t===void 0)for(let n of e)n!=null&&(n=+n)>=n&&(yield n);else{let n=-1;for(let r of e)(r=t(r,++n,e))!=null&&(r=+r)>=r&&(yield r)}}const qf=Es(Ht),Gf=qf.right;Es(Hf).center;const Ms=Gf;function jf(e,t){let n=0;if(t===void 0)for(let r of e)r!=null&&(r=+r)>=r&&++n;else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(i=+i)>=i&&++n}return n}function sn(e,t){let n,r;if(t===void 0)for(const i of e)i!=null&&(n===void 0?i>=i&&(n=r=i):(n>i&&(n=i),r=o&&(n=r=o):(n>o&&(n=o),r{const r=e(t,n);return r||r===0?r:(e(n,n)===0)-(e(t,t)===0)}}function Fs(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(et?1:0)}var Qf=Array.prototype,Kf=Qf.slice;function Rr(e){return()=>e}const Jf=Math.sqrt(50),Zf=Math.sqrt(10),ed=Math.sqrt(2);function Kn(e,t,n){const r=(t-e)/Math.max(0,n),i=Math.floor(Math.log10(r)),o=r/Math.pow(10,i),l=o>=Jf?10:o>=Zf?5:o>=ed?2:1;let a,s,u;return i<0?(u=Math.pow(10,-i)/l,a=Math.round(e*u),s=Math.round(t*u),a/ut&&--s,u=-u):(u=Math.pow(10,i)*l,a=Math.round(e/u),s=Math.round(t/u),a*ut&&--s),s0))return[];if(e===t)return[e];const r=t=i))return[];const a=o-i+1,s=new Array(a);if(r)if(l<0)for(let u=0;u0?(e=Math.floor(e/i)*i,t=Math.ceil(t/i)*i):i<0&&(e=Math.ceil(e*i)/i,t=Math.floor(t*i)/i),r=i}}function rd(e){return Math.max(1,Math.ceil(Math.log(jf(e))/Math.LN2)+1)}function Is(){var e=Xf,t=sn,n=rd;function r(i){Array.isArray(i)||(i=Array.from(i));var o,l=i.length,a,s,u=new Array(l);for(o=0;o=d)if(C>=d&&t===sn){const $=jt(f,d,A);isFinite($)&&($>0?d=(Math.floor(d/$)+1)*$:$<0&&(d=(Math.ceil(d*-$)+1)/-$))}else g.pop()}for(var p=g.length,m=0,_=p;g[m]<=f;)++m;for(;g[_-1]>d;)--_;(m||_0?g[o-1]:f,w.x1=o0)for(o=0;o=r)&&(n=r);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n=i)&&(n=i)}return n}function po(e,t){let n;if(t===void 0)for(const r of e)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n>i||n===void 0&&i>=i)&&(n=i)}return n}function Ns(e,t,n=0,r=1/0,i){if(t=Math.floor(t),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(e.length-1,r)),!(n<=t&&t<=r))return e;for(i=i===void 0?Fs:Yf(i);r>n;){if(r-n>600){const s=r-n+1,u=t-n+1,c=Math.log(s),f=.5*Math.exp(2*c/3),d=.5*Math.sqrt(c*f*(s-f)/s)*(u-s/2<0?-1:1),g=Math.max(n,Math.floor(t-u*f/s+d)),p=Math.min(r,Math.floor(t+(s-u)*f/s+d));Ns(e,t,g,p,i)}const o=e[t];let l=n,a=r;for(Kt(e,n,t),i(e[r],o)>0&&Kt(e,n,r);l0;)--a}i(e[n],o)===0?Kt(e,n,a):(++a,Kt(e,a,r)),a<=t&&(n=a+1),t<=a&&(r=a-1)}return e}function Kt(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function id(e,t,n){if(e=Float64Array.from(Lf(e,n)),!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return po(e);if(t>=1)return Rt(e);var r,i=(r-1)*t,o=Math.floor(i),l=Rt(Ns(e,o).subarray(0,o+1)),a=po(e.subarray(o+1));return l+(a-l)*(i-o)}}function od(e,t,n){e=+e,t=+t,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((t-e)/n))|0,o=new Array(i);++r=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function Jn(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function Bt(e){return e=Jn(Math.abs(e)),e?e[1]:NaN}function sd(e,t){return function(n,r){for(var i=n.length,o=[],l=0,a=e[0],s=0;i>0&&a>0&&(s+a+1>r&&(a=Math.max(1,r-s)),o.push(n.substring(i-=a,i+a)),!((s+=a+1)>r));)a=e[l=(l+1)%e.length];return o.reverse().join(t)}}function ad(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var ud=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Zn(e){if(!(t=ud.exec(e)))throw new Error("invalid format: "+e);var t;return new bi({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}Zn.prototype=bi.prototype;function bi(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}bi.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 cd(e){e:for(var t=e.length,n=1,r=-1,i;n0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(i+1):e}var Ps;function fd(e,t){var n=Jn(e,t);if(!n)return e+"";var r=n[0],i=n[1],o=i-(Ps=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,l=r.length;return o===l?r:o>l?r+new Array(o-l+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+Jn(e,Math.max(0,t+o-1))[0]}function mo(e,t){var n=Jn(e,t);if(!n)return e+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}const _o={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:ld,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>mo(e*100,t),r:mo,s:fd,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function vo(e){return e}var bo=Array.prototype.map,wo=["y","z","a","f","p","n","Âĩ","m","","k","M","G","T","P","E","Z","Y"];function dd(e){var t=e.grouping===void 0||e.thousands===void 0?vo:sd(bo.call(e.grouping,Number),e.thousands+""),n=e.currency===void 0?"":e.currency[0]+"",r=e.currency===void 0?"":e.currency[1]+"",i=e.decimal===void 0?".":e.decimal+"",o=e.numerals===void 0?vo:ad(bo.call(e.numerals,String)),l=e.percent===void 0?"%":e.percent+"",a=e.minus===void 0?"−":e.minus+"",s=e.nan===void 0?"NaN":e.nan+"";function u(f){f=Zn(f);var d=f.fill,g=f.align,p=f.sign,m=f.symbol,_=f.zero,b=f.width,w=f.comma,C=f.precision,A=f.trim,$=f.type;$==="n"?(w=!0,$="g"):_o[$]||(C===void 0&&(C=12),A=!0,$="g"),(_||d==="0"&&g==="=")&&(_=!0,d="0",g="=");var E=m==="$"?n:m==="#"&&/[boxX]/.test($)?"0"+$.toLowerCase():"",S=m==="$"?r:/[%p]/.test($)?l:"",k=_o[$],y=/[defgprs%]/.test($);C=C===void 0?6:/[gprs]/.test($)?Math.max(1,Math.min(21,C)):Math.max(0,Math.min(20,C));function M(I){var F=E,P=S,B,ge,oe;if($==="c")P=k(I)+P,I="";else{I=+I;var Ee=I<0||1/I<0;if(I=isNaN(I)?s:k(Math.abs(I),C),A&&(I=cd(I)),Ee&&+I==0&&p!=="+"&&(Ee=!1),F=(Ee?p==="("?p:a:p==="-"||p==="("?"":p)+F,P=($==="s"?wo[8+Ps/3]:"")+P+(Ee&&p==="("?")":""),y){for(B=-1,ge=I.length;++Boe||oe>57){P=(oe===46?i+I.slice(B+1):I.slice(B))+P,I=I.slice(0,B);break}}}w&&!_&&(I=t(I,1/0));var Me=F.length+I.length+P.length,ye=Me>1)+F+I+P+ye.slice(Me);break;default:I=ye+F+I+P;break}return o(I)}return M.toString=function(){return f+""},M}function c(f,d){var g=u((f=Zn(f),f.type="f",f)),p=Math.max(-8,Math.min(8,Math.floor(Bt(d)/3)))*3,m=Math.pow(10,-p),_=wo[8+p/3];return function(b){return g(m*b)+_}}return{format:u,formatPrefix:c}}var An,Mt,xs;gd({thousands:",",grouping:[3],currency:["$",""]});function gd(e){return An=dd(e),Mt=An.format,xs=An.formatPrefix,An}function hd(e){return Math.max(0,-Bt(Math.abs(e)))}function pd(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Bt(t)/3)))*3-Bt(Math.abs(e)))}function md(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,Bt(t)-Bt(e))+1}function wi(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}const yo=Symbol("implicit");function mr(){var e=new go,t=[],n=[],r=yo;function i(o){let l=e.get(o);if(l===void 0){if(r!==yo)return r;e.set(o,l=t.push(o)-1)}return n[l%n.length]}return i.domain=function(o){if(!arguments.length)return t.slice();t=[],e=new go;for(const l of o)e.has(l)||e.set(l,t.push(l)-1);return i},i.range=function(o){return arguments.length?(n=Array.from(o),i):n.slice()},i.unknown=function(o){return arguments.length?(r=o,i):r},i.copy=function(){return mr(t,n).unknown(r)},wi.apply(i,arguments),i}function yi(){var e=mr().unknown(void 0),t=e.domain,n=e.range,r=0,i=1,o,l,a=!1,s=0,u=0,c=.5;delete e.unknown;function f(){var d=t().length,g=i>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?En(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?En(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=vd.exec(e))?new Te(t[1],t[2],t[3],1):(t=bd.exec(e))?new Te(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=wd.exec(e))?En(t[1],t[2],t[3],t[4]):(t=yd.exec(e))?En(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Sd.exec(e))?Eo(t[1],t[2]/100,t[3]/100,1):(t=Cd.exec(e))?Eo(t[1],t[2]/100,t[3]/100,t[4]):So.hasOwnProperty(e)?$o(So[e]):e==="transparent"?new Te(NaN,NaN,NaN,0):null}function $o(e){return new Te(e>>16&255,e>>8&255,e&255,1)}function En(e,t,n,r){return r<=0&&(e=t=n=NaN),new Te(e,t,n,r)}function Rd(e){return e instanceof yn||(e=bn(e)),e?(e=e.rgb(),new Te(e.r,e.g,e.b,e.opacity)):new Te}function Jr(e,t,n,r){return arguments.length===1?Rd(e):new Te(e,t,n,r??1)}function Te(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Si(Te,Jr,Ts(yn,{brighter(e){return e=e==null?er:Math.pow(er,e),new Te(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?_n:Math.pow(_n,e),new Te(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Te($t(this.r),$t(this.g),$t(this.b),tr(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:Ro,formatHex:Ro,formatHex8:Ad,formatRgb:Ao,toString:Ao}));function Ro(){return`#${Ct(this.r)}${Ct(this.g)}${Ct(this.b)}`}function Ad(){return`#${Ct(this.r)}${Ct(this.g)}${Ct(this.b)}${Ct((isNaN(this.opacity)?1:this.opacity)*255)}`}function Ao(){const e=tr(this.opacity);return`${e===1?"rgb(":"rgba("}${$t(this.r)}, ${$t(this.g)}, ${$t(this.b)}${e===1?")":`, ${e})`}`}function tr(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function $t(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Ct(e){return e=$t(e),(e<16?"0":"")+e.toString(16)}function Eo(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Ue(e,t,n,r)}function Os(e){if(e instanceof Ue)return new Ue(e.h,e.s,e.l,e.opacity);if(e instanceof yn||(e=bn(e)),!e)return new Ue;if(e instanceof Ue)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),o=Math.max(t,n,r),l=NaN,a=o-i,s=(o+i)/2;return a?(t===o?l=(n-r)/a+(n0&&s<1?0:l,new Ue(l,a,s,e.opacity)}function Ed(e,t,n,r){return arguments.length===1?Os(e):new Ue(e,t,n,r??1)}function Ue(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Si(Ue,Ed,Ts(yn,{brighter(e){return e=e==null?er:Math.pow(er,e),new Ue(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?_n:Math.pow(_n,e),new Ue(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new Te(Ar(e>=240?e-240:e+120,i,r),Ar(e,i,r),Ar(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Ue(Mo(this.h),Mn(this.s),Mn(this.l),tr(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 e=tr(this.opacity);return`${e===1?"hsl(":"hsla("}${Mo(this.h)}, ${Mn(this.s)*100}%, ${Mn(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Mo(e){return e=(e||0)%360,e<0?e+360:e}function Mn(e){return Math.max(0,Math.min(1,e||0))}function Ar(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const Ci=e=>()=>e;function Md(e,t){return function(n){return e+n*t}}function Fd(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function Dd(e){return(e=+e)==1?Vs:function(t,n){return n-t?Fd(t,n,e):Ci(isNaN(t)?n:t)}}function Vs(e,t){var n=t-e;return n?Md(e,n):Ci(isNaN(e)?t:e)}const Fo=function e(t){var n=Dd(t);function r(i,o){var l=n((i=Jr(i)).r,(o=Jr(o)).r),a=n(i.g,o.g),s=n(i.b,o.b),u=Vs(i.opacity,o.opacity);return function(c){return i.r=l(c),i.g=a(c),i.b=s(c),i.opacity=u(c),i+""}}return r.gamma=e,r}(1);function Id(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(o){for(i=0;in&&(o=t.slice(n,o),a[l]?a[l]+=o:a[++l]=o),(r=r[0])===(i=i[0])?a[l]?a[l]+=i:a[++l]=i:(a[++l]=null,s.push({i:l,x:nr(r,i)})),n=Er.lastIndex;return nt&&(n=e,e=t,t=n),function(r){return Math.max(e,Math.min(t,r))}}function jd(e,t,n){var r=e[0],i=e[1],o=t[0],l=t[1];return i2?Bd:jd,s=u=null,f}function f(d){return d==null||isNaN(d=+d)?o:(s||(s=a(e.map(r),t,n)))(r(l(d)))}return f.invert=function(d){return l(i((u||(u=a(t,e.map(r),nr)))(d)))},f.domain=function(d){return arguments.length?(e=Array.from(d,qd),c()):e.slice()},f.range=function(d){return arguments.length?(t=Array.from(d),c()):t.slice()},f.rangeRound=function(d){return t=Array.from(d),n=Hd,c()},f.clamp=function(d){return arguments.length?(l=d?!0:Tt,c()):l!==Tt},f.interpolate=function(d){return arguments.length?(n=d,c()):n},f.unknown=function(d){return arguments.length?(o=d,f):o},function(d,g){return r=d,i=g,c()}}function Xd(){return Wd()(Tt,Tt)}function Yd(e,t,n,r){var i=td(e,t,n),o;switch(r=Zn(r??",f"),r.type){case"s":{var l=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(o=pd(i,l))&&(r.precision=o),xs(r,l)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(o=md(i,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=o-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(o=hd(i))&&(r.precision=o-(r.type==="%")*2);break}}return Mt(r)}function Qd(e){var t=e.domain;return e.ticks=function(n){var r=t();return Ds(r[0],r[r.length-1],n??10)},e.tickFormat=function(n,r){var i=t();return Yd(i[0],i[i.length-1],n??10,r)},e.nice=function(n){n==null&&(n=10);var r=t(),i=0,o=r.length-1,l=r[i],a=r[o],s,u,c=10;for(a0;){if(u=jt(l,a,n),u===s)return r[i]=l,r[o]=a,t(r);if(u>0)l=Math.floor(l/u)*u,a=Math.ceil(a/u)*u;else if(u<0)l=Math.ceil(l*u)/u,a=Math.floor(a*u)/u;else break;s=u}return e},e}function We(){var e=Xd();return e.copy=function(){return Ud(e,We())},wi.apply(e,arguments),Qd(e)}function Fn(e){return function(){return e}}function Kd(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function ti(e,t){if((l=e.length)>1)for(var n=1,r,i,o=e[t[0]],l,a=o.length;n=0;)n[t]=t;return n}function Jd(e,t){return e[t]}function Zd(e){const t=[];return t.key=e,t}function eg(){var e=Fn([]),t=ni,n=ti,r=Jd;function i(o){var l=Array.from(e.apply(this,arguments),Zd),a,s=l.length,u=-1,c;for(const f of o)for(a=0,++u;aFeedback Distribution

",n=D(),r=R("div"),i=U("svg");for(let s=0;se[19].call(r))},m(s,u){T(s,t,u),T(s,n,u),T(s,r,u),v(r,i);for(let c=0;cn(15,f=k)),ee(e,Ti,k=>n(4,d=k)),ee(e,xe,k=>n(16,g=k));let p=300,m=300;const _={up:2,down:1,"n/a":0,all:"all"},b={top:10,bottom:10,left:25,right:5},w=mr().range(["var(--yellow)","var(--red)","var(--green)"]),C=Mt(".0%");function A(k,y){r===k?n(5,r="all"):n(5,r=k),Oe(nt,f=r==="all"?"all":y,f)}const $=(k,y)=>A(k,y.key),E=(k,y)=>A(k,y.key);function S(){m=this.offsetWidth,p=this.offsetHeight,n(1,m),n(0,p)}return e.$$.update=()=>{e.$$.dirty&32768&&n(5,r=_[f]),e.$$.dirty&2&&n(3,i=m-b.left-b.right),e.$$.dirty&1&&n(14,o=p-b.top-b.bottom),e.$$.dirty&65552&&g.forEach(k=>{Oe(Ti,d[k.vote_status]++,d)}),e.$$.dirty&16&&n(2,l=d.up+d.down+d["n/a"]),e.$$.dirty&16384&&n(8,a=yi().rangeRound([b.top,o-b.bottom]).padding(0).domain(["a"])),e.$$.dirty&12&&n(7,s=We().rangeRound([b.left,i-b.right]).domain([0,l])),e.$$.dirty&8208&&n(6,c=u([d]))},n(13,u=eg().keys(["n/a","down","up"]).order(ni).offset(ti)),[p,m,l,i,d,r,c,s,a,b,w,C,A,u,o,f,g,$,E,S]}class zs extends ie{constructor(t){super(),se(this,t,ng,tg,re,{})}}function rg(e){let t,n,r,i,o,l,a,s,u,c,f,d=e[3][e[2]]+"",g,p;return{c(){t=R("div"),n=R("div"),r=z("Q: "),i=z(e[0]),o=D(),l=R("div"),a=z("A: "),s=z(e[1]),u=D(),c=R("div"),f=z("Rating: "),g=z(d),h(n,"class","question svelte-szi0e"),h(l,"class","answer svelte-szi0e"),h(c,"class",p="feedback "+e[2]+" svelte-szi0e"),h(t,"class","qa-card svelte-szi0e")},m(m,_){T(m,t,_),v(t,n),v(n,r),v(n,i),v(t,o),v(t,l),v(l,a),v(l,s),v(t,u),v(t,c),v(c,f),v(c,g)},p(m,[_]){_&1&&Q(i,m[0]),_&2&&Q(s,m[1]),_&4&&d!==(d=m[3][m[2]]+"")&&Q(g,d),_&4&&p!==(p="feedback "+m[2]+" svelte-szi0e")&&h(c,"class",p)},i:H,o:H,d(m){m&&x(t)}}}function ig(e,t,n){let{question:r="What is gradient descent?"}=t,{answer:i="Gradient descent is an algorithm used to minimize a loss function by taking small steps in the direction of steepest descent."}=t,{feedback:o="Good: 👍"}=t;const l={up:"Good 👍",down:"Bad 👎","n/a":"No Rating",all:"All"};return e.$$set=a=>{"question"in a&&n(0,r=a.question),"answer"in a&&n(1,i=a.answer),"feedback"in a&&n(2,o=a.feedback)},[r,i,o,l]}class og extends ie{constructor(t){super(),se(this,t,ig,rg,re,{question:0,answer:1,feedback:2})}}function To(e,t,n){const r=e.slice();return r[5]=t[n].question,r[6]=t[n].answer,r[7]=t[n].vote_status,r}function Oo(e){let t,n,r,i,o;return n=new og({props:{question:e[5],answer:e[6],feedback:e[7]}}),{c(){t=R("div"),Z(n.$$.fragment),r=D()},m(l,a){T(l,t,a),K(n,t,null),v(t,r),o=!0},p(l,a){const s={};a&1&&(s.question=l[5]),a&1&&(s.answer=l[6]),a&1&&(s.feedback=l[7]),n.$set(s)},i(l){o||(N(n.$$.fragment,l),l&&Se(()=>{o&&(i||(i=Ke(t,e[1],{duration:300},!0)),i.run(1))}),o=!0)},o(l){V(n.$$.fragment,l),l&&(i||(i=Ke(t,e[1],{duration:300},!1)),i.run(0)),o=!1},d(l){l&&x(t),J(n),l&&i&&i.end()}}}function lg(e){let t,n,r=e[0],i=[];for(let l=0;lV(i[l],1,1,()=>{i[l]=null});return{c(){t=R("div");for(let l=0;ln(4,i=s)),ee(e,nt,s=>n(2,o=s)),ee(e,pn,s=>n(3,l=s));const a=(s,{delay:u=0,duration:c=1e3,easing:f=pi})=>mn(s,{delay:u,duration:c,easing:f});return e.$$.update=()=>{e.$$.dirty&12&&n(0,r=o==="all"?l:l.filter(s=>s.vote_status===o)),e.$$.dirty&1&&Oe(Xr,i=Lc(r),i)},[r,a,o,l]}class Hs extends ie{constructor(t){super(),se(this,t,sg,lg,re,{})}}function Vo(e,t,n){const r=e.slice();return r[13]=t[n],r}function zo(e,t,n){const r=e.slice();return r[16]=t[n],r}function Ho(e,t,n){const r=e.slice();return r[16]=t[n],r}function Lo(e){let t,n,r,i,o=e[16]+"",l,a;return{c(){t=U("g"),n=U("line"),i=U("text"),l=z(o),h(n,"class","axis-tick svelte-1oikip4"),h(n,"x1","0"),h(n,"x2","0"),h(n,"y1",0),h(n,"y2",r=-e[2]+e[10].bottom+e[10].top),h(n,"stroke","var(--squidink)"),h(n,"stroke-dasharray","4"),h(i,"class","axis-text svelte-1oikip4"),h(i,"y","15"),h(i,"text-anchor","middle"),h(t,"transform",a=`translate(${e[6](e[16])+e[6].bandwidth()/2} ${e[2]-e[10].bottom})`)},m(s,u){T(s,t,u),v(t,n),v(t,i),v(i,l)},p(s,u){u&4&&r!==(r=-s[2]+s[10].bottom+s[10].top)&&h(n,"y2",r),u&16&&o!==(o=s[16]+"")&&Q(l,o),u&84&&a!==(a=`translate(${s[6](s[16])+s[6].bandwidth()/2} ${s[2]-s[10].bottom})`)&&h(t,"transform",a)},d(s){s&&x(t)}}}function qo(e){let t,n,r,i;return{c(){t=U("g"),n=U("line"),h(n,"class","axis-tick svelte-1oikip4"),h(n,"x1",0),h(n,"x2",r=e[3]-e[10].right-e[10].left),h(n,"y1","0"),h(n,"y2","0"),h(n,"stroke","black"),h(t,"transform",i=`translate(${e[10].left} ${e[5](e[16])+0})`)},m(o,l){T(o,t,l),v(t,n)},p(o,l){l&8&&r!==(r=o[3]-o[10].right-o[10].left)&&h(n,"x2",r),l&32&&i!==(i=`translate(${o[10].left} ${o[5](o[16])+0})`)&&h(t,"transform",i)},d(o){o&&x(t)}}}function Go(e){let t,n,r,i,o,l,a,s,u=Math.round(e[11](e[13].count))+"",c,f,d;return{c(){t=U("g"),n=U("rect"),s=U("text"),c=z(u),h(n,"x",r=e[6](e[13].question)),h(n,"y",i=e[5](e[13].count)),h(n,"height",o=e[2]-e[5](e[13].count)-e[10].bottom),h(n,"fill",l=e[9][e[7]]),h(n,"fill-opacity","0.95"),h(n,"width",a=e[6].bandwidth()),h(n,"class","svelte-1oikip4"),h(s,"class","axis-text svelte-1oikip4"),h(s,"x",f=e[6](e[13].question)+e[6].bandwidth()/2),h(s,"y",d=e[5](e[13].count)-5),h(s,"text-anchor","middle"),h(t,"class","series")},m(g,p){T(g,t,p),v(t,n),v(t,s),v(s,c)},p(g,p){p&80&&r!==(r=g[6](g[13].question))&&h(n,"x",r),p&48&&i!==(i=g[5](g[13].count))&&h(n,"y",i),p&52&&o!==(o=g[2]-g[5](g[13].count)-g[10].bottom)&&h(n,"height",o),p&128&&l!==(l=g[9][g[7]])&&h(n,"fill",l),p&64&&a!==(a=g[6].bandwidth())&&h(n,"width",a),p&16&&u!==(u=Math.round(g[11](g[13].count))+"")&&Q(c,u),p&80&&f!==(f=g[6](g[13].question)+g[6].bandwidth()/2)&&h(s,"x",f),p&48&&d!==(d=g[5](g[13].count)-5)&&h(s,"y",d)},d(g){g&&x(t)}}}function ag(e){let t,n,r,i,o,l,a=e[8][e[7]]+"",s,u,c,f,d,g,p,m,_,b=e[4].map(jo),w=[];for(let S=0;Se[12].call(t))},m(S,k){T(S,t,k),v(t,n);for(let y=0;ye.question;function ug(e,t,n){let r,i,o,l,a,s;ee(e,Xr,_=>n(4,a=_)),ee(e,nt,_=>n(7,s=_));const u={up:"Good 👍",down:"Bad 👎","n/a":"No Rating",all:"All"},c={up:"#00ebc7",down:"#FF5470","n/a":"#fde24f",all:"#bfbfbf"};let f=300,d=300,g={top:35,bottom:10,left:25,right:5};const p=Mt(".1f");function m(){d=this.offsetWidth,f=this.offsetHeight,n(1,d),n(0,f)}return e.$$.update=()=>{e.$$.dirty&2&&n(3,r=d-g.left-g.right),e.$$.dirty&1&&n(2,i=f-g.top-g.bottom),e.$$.dirty&24&&n(6,o=yi().rangeRound([g.left,r-g.right]).padding(.05).domain(a.map(_=>_.question))),e.$$.dirty&20&&n(5,l=We().rangeRound([i-g.bottom,g.top]).domain([0,Rt(a,_=>_.count)])),e.$$.dirty&16&&console.log(a)},[f,d,i,r,a,l,o,s,u,c,g,p,m]}class Ls extends ie{constructor(t){super(),se(this,t,ug,ag,re,{})}}function Bo(e,t,n){const r=e.slice();r[19]=t[n];const i=r[7](r[19].x1)-r[7](r[19].x0);return r[20]=i,r}function Uo(e,t,n){const r=e.slice();return r[23]=t[n],r}function Wo(e){let t,n,r,i,o=e[23]+"",l,a;return{c(){t=U("g"),n=U("line"),i=U("text"),l=z(o),h(n,"class","axis-tick svelte-kz2qh6"),h(n,"x1","0"),h(n,"x2","0"),h(n,"y1",0),h(n,"y2",r=-e[2]+e[9].bottom+e[9].top),h(n,"stroke","var(--squidink)"),h(n,"stroke-dasharray","4"),h(i,"class","axis-text svelte-kz2qh6"),h(i,"y","15"),h(i,"text-anchor","middle"),h(t,"transform",a=`translate(${e[7](e[23])+(e[7](1)-e[7](0))/2} ${e[2]-e[9].bottom})`),h(t,"class","svelte-kz2qh6")},m(s,u){T(s,t,u),v(t,n),v(t,i),v(i,l)},p(s,u){u&4&&r!==(r=-s[2]+s[9].bottom+s[9].top)&&h(n,"y2",r),u&128&&o!==(o=s[23]+"")&&Q(l,o),u&132&&a!==(a=`translate(${s[7](s[23])+(s[7](1)-s[7](0))/2} ${s[2]-s[9].bottom})`)&&h(t,"transform",a)},d(s){s&&x(t)}}}function Xo(e){let t,n,r,i,o,l,a;return{c(){t=U("g"),n=U("rect"),h(n,"x",r=e[7](e[19].x0)+1),h(n,"width",i=e[20]),h(n,"y",o=e[6](e[19].length)),h(n,"height",l=e[6](0)-e[6](e[19].length)),h(n,"fill",a=e[8][e[5]]),h(n,"class","svelte-kz2qh6"),h(t,"class","histogram-bin svelte-kz2qh6")},m(s,u){T(s,t,u),v(t,n)},p(s,u){u&136&&r!==(r=s[7](s[19].x0)+1)&&h(n,"x",r),u&136&&i!==(i=s[20])&&h(n,"width",i),u&72&&o!==(o=s[6](s[19].length))&&h(n,"y",o),u&72&&l!==(l=s[6](0)-s[6](s[19].length))&&h(n,"height",l),u&32&&a!==(a=s[8][s[5]])&&h(n,"fill",a)},d(s){s&&x(t)}}}function cg(e){let t,n,r,i,o,l,a,s,u,c,f,d=e[7].ticks(),g=[];for(let _=0;_e[14].call(t))},m(_,b){T(_,t,b),v(t,n);for(let w=0;wn(5,f=C)),ee(e,xe,C=>n(13,d=C));const g={up:"#00ebc7",down:"#FF5470","n/a":"#fde24f",all:"#bfbfbf"};let p=300,m=300,_={top:15,bottom:10,left:25,right:5};Mt(".1f");let b=Array.from({length:Yo},(C,A)=>A);function w(){m=this.offsetWidth,p=this.offsetHeight,n(1,m),n(0,p)}return e.$$.update=()=>{e.$$.dirty&8224&&n(12,r=f==="all"?d:d.filter(C=>C.vote_status===f)),e.$$.dirty&4096&&n(11,i=As(r)),e.$$.dirty&2&&n(4,o=m-_.left-_.right),e.$$.dirty&1&&n(2,l=p-_.top-_.bottom),e.$$.dirty&2048&&n(3,a=Is().thresholds(b).value(C=>C.answer)(i)),e.$$.dirty&16&&n(7,s=We().domain([3,Yo]).range([_.left,o-_.right])),e.$$.dirty&12&&n(6,u=We().domain([0,Rt(a,C=>C.length)]).range([l-_.bottom,_.top])),e.$$.dirty&2048&&n(10,c=Rt(i,C=>C.length)),e.$$.dirty&1056&&We().domain([0,c]).range(["white",g[f]]).interpolate(_r)},[p,m,l,a,o,f,u,s,g,_,c,i,r,d,w]}class qs extends ie{constructor(t){super(),se(this,t,fg,cg,re,{})}}function Qo(e,t,n){const r=e.slice();r[18]=t[n];const i=r[7](r[18].x1)-r[7](r[18].x0);return r[19]=i,r}function Ko(e,t,n){const r=e.slice();return r[22]=t[n],r}function Jo(e){let t,n,r,i,o=e[22]+"",l,a;return{c(){t=U("g"),n=U("line"),i=U("text"),l=z(o),h(n,"class","axis-tick svelte-kz2qh6"),h(n,"x1","0"),h(n,"x2","0"),h(n,"y1",0),h(n,"y2",r=-e[2]+e[9].bottom+e[9].top),h(n,"stroke","var(--squidink)"),h(n,"stroke-dasharray","4"),h(i,"class","axis-text svelte-kz2qh6"),h(i,"y","15"),h(i,"text-anchor","middle"),h(t,"transform",a=`translate(${e[7](e[22])+(e[7](1)-e[7](0))/2} ${e[2]-e[9].bottom})`),h(t,"class","svelte-kz2qh6")},m(s,u){T(s,t,u),v(t,n),v(t,i),v(i,l)},p(s,u){u&4&&r!==(r=-s[2]+s[9].bottom+s[9].top)&&h(n,"y2",r),u&128&&o!==(o=s[22]+"")&&Q(l,o),u&132&&a!==(a=`translate(${s[7](s[22])+(s[7](1)-s[7](0))/2} ${s[2]-s[9].bottom})`)&&h(t,"transform",a)},d(s){s&&x(t)}}}function Zo(e){let t,n,r,i,o,l,a;return{c(){t=U("g"),n=U("rect"),h(n,"x",r=e[7](e[18].x0)+1),h(n,"width",i=e[19]),h(n,"y",o=e[6](e[18].length)),h(n,"height",l=e[6](0)-e[6](e[18].length)),h(n,"fill",a=e[8][e[5]]),h(n,"class","svelte-kz2qh6"),h(t,"class","histogram-bin svelte-kz2qh6")},m(s,u){T(s,t,u),v(t,n)},p(s,u){u&136&&r!==(r=s[7](s[18].x0)+1)&&h(n,"x",r),u&136&&i!==(i=s[19])&&h(n,"width",i),u&72&&o!==(o=s[6](s[18].length))&&h(n,"y",o),u&72&&l!==(l=s[6](0)-s[6](s[18].length))&&h(n,"height",l),u&32&&a!==(a=s[8][s[5]])&&h(n,"fill",a)},d(s){s&&x(t)}}}function dg(e){let t,n,r,i,o,l,a,s,u,c,f,d=e[7].ticks(),g=[];for(let _=0;_e[13].call(t))},m(_,b){T(_,t,b),v(t,n);for(let w=0;wn(5,c=w)),ee(e,xe,w=>n(12,f=w));const d={up:"#00ebc7",down:"#FF5470","n/a":"#fde24f",all:"#bfbfbf"};let g=300,p=300,m={top:15,bottom:10,left:25,right:5},_=Array.from({length:el},(w,C)=>C);mr().range(["var(--yellow)","var(--red)","var(--green)"]);function b(){p=this.offsetWidth,g=this.offsetHeight,n(1,p),n(0,g)}return e.$$.update=()=>{e.$$.dirty&4128&&n(11,r=c==="all"?f:f.filter(w=>w.vote_status===c)),e.$$.dirty&2048&&n(10,i=As(r)),e.$$.dirty&2&&n(4,o=p-m.left-m.right),e.$$.dirty&1&&n(2,l=g-m.top-m.bottom),e.$$.dirty&1024&&n(3,a=Is().thresholds(_).value(w=>w.question)(i)),e.$$.dirty&16&&n(7,s=We().domain([3,el]).range([m.left,o-m.right])),e.$$.dirty&12&&n(6,u=We().domain([0,Rt(a,w=>w.length)]).range([l-m.bottom,m.top])),e.$$.dirty&1024&&Rt(i,w=>w.length)},[g,p,l,a,o,c,u,s,d,m,i,r,f,b]}class Gs extends ie{constructor(t){super(),se(this,t,gg,dg,re,{})}}function hg(e){let t,n,r,i,o,l,a,s,u,c,f,d,g,p=Math.round(e[5](e[3]))+"",m,_,b,w,C,A,$,E;return{c(){t=R("div"),n=R("div"),r=R("p"),r.textContent="Questions",i=D(),o=R("select"),l=R("option"),l.textContent="All",a=R("option"),a.textContent="Good",s=R("option"),s.textContent="Bad",u=R("option"),u.textContent="N/A",c=D(),f=R("div"),d=U("svg"),g=U("text"),m=z(p),C=D(),A=R("p"),A.textContent="number of responses",h(r,"class","card-text svelte-1pknxov"),l.__value="all",l.value=l.__value,h(l,"class","svelte-1pknxov"),a.__value="up",a.value=a.__value,h(a,"class","svelte-1pknxov"),s.__value="down",s.value=s.__value,h(s,"class","svelte-1pknxov"),u.__value="n/a",u.value=u.__value,h(u,"class","svelte-1pknxov"),h(o,"id","feedback-dropdown"),h(o,"name","feedback-dropdown"),Re(o,"background",e[6][e[0]]),h(o,"class","svelte-1pknxov"),e[0]===void 0&&Se(()=>e[9].call(o)),h(n,"class","svelte-1pknxov"),h(g,"dominant-baseline","middle"),h(g,"x",_=e[2]/2),h(g,"y",b=e[1]/2),h(g,"text-anchor","middle"),h(g,"class","svelte-1pknxov"),h(d,"width",e[2]),h(d,"height",e[1]),h(d,"class","svelte-1pknxov"),h(f,"class","svelte-1pknxov"),Se(()=>e[10].call(f)),h(A,"class","small svelte-1pknxov"),h(t,"class","card-container svelte-1pknxov"),Re(t,"background",e[6][e[0]])},m(S,k){T(S,t,k),v(t,n),v(n,r),v(n,i),v(n,o),v(o,l),v(o,a),v(o,s),v(o,u),Un(o,e[0],!0),v(t,c),v(t,f),v(f,d),v(d,g),v(g,m),w=Et(f,e[10].bind(f)),v(t,C),v(t,A),$||(E=j(o,"change",e[9]),$=!0)},p(S,[k]){k&1&&Re(o,"background",S[6][S[0]]),k&1&&Un(o,S[0]),k&8&&p!==(p=Math.round(S[5](S[3]))+"")&&Q(m,p),k&4&&_!==(_=S[2]/2)&&h(g,"x",_),k&2&&b!==(b=S[1]/2)&&h(g,"y",b),k&4&&h(d,"width",S[2]),k&2&&h(d,"height",S[1]),k&1&&Re(t,"background",S[6][S[0]])},i:H,o:H,d(S){S&&x(t),w(),$=!1,E()}}}function pg(e,t){return t==="all"?e.length:e.filter(r=>r.vote_status===t).length}function mg(e,t,n){let r,i,o,l;ee(e,nt,p=>n(0,i=p)),ee(e,xe,p=>n(8,o=p));let a,s,u=mi(0);ee(e,u,p=>n(3,l=p));const c=Mt(".1f"),f={up:"#00ebc7",down:"#FF5470","n/a":"#fde24f",all:"var(--white)"};function d(){i=as(this),nt.set(i)}function g(){s=this.clientWidth,a=this.clientHeight,n(2,s),n(1,a)}return e.$$.update=()=>{e.$$.dirty&257&&n(7,r=pg(o,i)),e.$$.dirty&128&&console.log("fbc",r),e.$$.dirty&128&&u.set(r)},[i,a,s,l,u,c,f,r,o,d,g]}class js extends ie{constructor(t){super(),se(this,t,mg,hg,re,{})}}function _g(e){let t,n,r,i,o,l,a,s,u,c,f,d,g,p=e[5](e[3])+"",m,_,b,w,C,A,$,E;return{c(){t=R("div"),n=R("div"),r=R("p"),r.textContent="Questions",i=D(),o=R("select"),l=R("option"),l.textContent="All",a=R("option"),a.textContent="Good",s=R("option"),s.textContent="Bad",u=R("option"),u.textContent="N/A",c=D(),f=R("div"),d=U("svg"),g=U("text"),m=z(p),C=D(),A=R("p"),A.textContent="percentage of responses",h(r,"class","card-text svelte-mchgj2"),l.__value="all",l.value=l.__value,a.__value="up",a.value=a.__value,s.__value="down",s.value=s.__value,u.__value="n/a",u.value=u.__value,h(o,"id","feedback-dropdown"),h(o,"name","feedback-dropdown"),Re(o,"background",e[6][e[0]]),h(o,"class","svelte-mchgj2"),e[0]===void 0&&Se(()=>e[9].call(o)),h(g,"dominant-baseline","middle"),h(g,"x",_=e[2]/2),h(g,"y",b=e[1]/2),h(g,"text-anchor","middle"),h(g,"class","svelte-mchgj2"),h(d,"width",e[2]),h(d,"height",e[1]),h(d,"class","svelte-mchgj2"),Se(()=>e[10].call(f)),h(A,"class","small svelte-mchgj2"),h(t,"class","card-container svelte-mchgj2"),Re(t,"background",e[6][e[0]])},m(S,k){T(S,t,k),v(t,n),v(n,r),v(n,i),v(n,o),v(o,l),v(o,a),v(o,s),v(o,u),Un(o,e[0],!0),v(t,c),v(t,f),v(f,d),v(d,g),v(g,m),w=Et(f,e[10].bind(f)),v(t,C),v(t,A),$||(E=j(o,"change",e[9]),$=!0)},p(S,[k]){k&1&&Re(o,"background",S[6][S[0]]),k&1&&Un(o,S[0]),k&8&&p!==(p=S[5](S[3])+"")&&Q(m,p),k&4&&_!==(_=S[2]/2)&&h(g,"x",_),k&2&&b!==(b=S[1]/2)&&h(g,"y",b),k&4&&h(d,"width",S[2]),k&2&&h(d,"height",S[1]),k&1&&Re(t,"background",S[6][S[0]])},i:H,o:H,d(S){S&&x(t),w(),$=!1,E()}}}function vg(e,t){const n=e.length;return t==="all"?1:e.filter(i=>i.vote_status===t).length/n}function bg(e,t,n){let r,i,o,l;ee(e,nt,p=>n(0,i=p)),ee(e,xe,p=>n(8,o=p));let a,s,u=mi(0);ee(e,u,p=>n(3,l=p));const c=Mt(".1%"),f={up:"#00ebc7",down:"#FF5470","n/a":"#fde24f",all:"var(--white)"};function d(){i=as(this),nt.set(i)}function g(){s=this.clientWidth,a=this.clientHeight,n(2,s),n(1,a)}return e.$$.update=()=>{e.$$.dirty&257&&n(7,r=vg(o,i)),e.$$.dirty&128&&u.set(r)},[i,a,s,l,u,c,f,r,o,d,g]}class Bs extends ie{constructor(t){super(),se(this,t,bg,_g,re,{})}}function wg(e){let t,n,r,i,o,l,a,s,u,c,f,d,g,p,m,_,b,w,C,A,$,E,S,k,y,M,I;return o=new js({}),s=new Bs({}),f=new zs({}),p=new Ls({props:{feedback:"Bad"}}),b=new Gs({}),A=new qs({}),M=new Hs({}),{c(){t=R("div"),n=R("div"),r=R("div"),i=R("div"),Z(o.$$.fragment),l=D(),a=R("div"),Z(s.$$.fragment),u=D(),c=R("div"),Z(f.$$.fragment),d=D(),g=R("div"),Z(p.$$.fragment),m=D(),_=R("div"),Z(b.$$.fragment),w=D(),C=R("div"),Z(A.$$.fragment),$=D(),E=R("div"),S=R("div"),S.innerHTML=`
+
`,k=D(),y=R("div"),Z(M.$$.fragment),h(i,"class","card-1 svelte-14znspc"),h(a,"class","card-2"),h(r,"class","left-text svelte-14znspc"),h(c,"class","left-confidence svelte-14znspc"),h(g,"class","left-question svelte-14znspc"),h(_,"class","left-filter svelte-14znspc"),h(C,"class","left-filter2"),h(n,"class","feedback-left svelte-14znspc"),h(S,"class","right-chart svelte-14znspc"),h(y,"class","right-table svelte-14znspc"),h(E,"class","feedback-right svelte-14znspc"),h(t,"class","feedback-container svelte-14znspc")},m(F,P){T(F,t,P),v(t,n),v(n,r),v(r,i),K(o,i,null),v(r,l),v(r,a),K(s,a,null),v(n,u),v(n,c),K(f,c,null),v(n,d),v(n,g),K(p,g,null),v(n,m),v(n,_),K(b,_,null),v(n,w),v(n,C),K(A,C,null),v(t,$),v(t,E),v(E,S),v(E,k),v(E,y),K(M,y,null),I=!0},p:H,i(F){I||(N(o.$$.fragment,F),N(s.$$.fragment,F),N(f.$$.fragment,F),N(p.$$.fragment,F),N(b.$$.fragment,F),N(A.$$.fragment,F),N(M.$$.fragment,F),I=!0)},o(F){V(o.$$.fragment,F),V(s.$$.fragment,F),V(f.$$.fragment,F),V(p.$$.fragment,F),V(b.$$.fragment,F),V(A.$$.fragment,F),V(M.$$.fragment,F),I=!1},d(F){F&&x(t),J(o),J(s),J(f),J(p),J(b),J(A),J(M)}}}function yg(e,t,n){let r;ee(e,pn,o=>n(0,r=o)),ut(()=>{i()});async function i(){const s=(await(await fetch("/chat/qa_table/retrieve")).json()).rows.map(u=>({id:u[0],question:u[1],answer:u[2],vote_status:u[3]}));Oe(pn,r=[...s],r)}return[]}class Us extends ie{constructor(t){super(),se(this,t,yg,wg,re,{})}}/**! + * Sortable 1.15.0 + * @author RubaXa + * @author owenm + * @license MIT + */function tl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function rt(e){for(var t=1;t=0)&&(n[i]=e[i]);return n}function kg(e,t){if(e==null)return{};var n=Cg(e,t),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var $g="1.15.0";function lt(e){if(typeof window<"u"&&window.navigator)return!!navigator.userAgent.match(e)}var ct=lt(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),Sn=lt(/Edge/i),nl=lt(/firefox/i),an=lt(/safari/i)&&!lt(/chrome/i)&&!lt(/android/i),Ws=lt(/iP(ad|od|hone)/i),Xs=lt(/chrome/i)&<(/android/i),Ys={capture:!1,passive:!1};function ne(e,t,n){e.addEventListener(t,n,!ct&&Ys)}function te(e,t,n){e.removeEventListener(t,n,!ct&&Ys)}function rr(e,t){if(t){if(t[0]===">"&&(t=t.substring(1)),e)try{if(e.matches)return e.matches(t);if(e.msMatchesSelector)return e.msMatchesSelector(t);if(e.webkitMatchesSelector)return e.webkitMatchesSelector(t)}catch{return!1}return!1}}function Rg(e){return e.host&&e!==document&&e.host.nodeType?e.host:e.parentNode}function Qe(e,t,n,r){if(e){n=n||document;do{if(t!=null&&(t[0]===">"?e.parentNode===n&&rr(e,t):rr(e,t))||r&&e===n)return e;if(e===n)break}while(e=Rg(e))}return null}var rl=/\s+/g;function He(e,t,n){if(e&&t)if(e.classList)e.classList[n?"add":"remove"](t);else{var r=(" "+e.className+" ").replace(rl," ").replace(" "+t+" "," ");e.className=(r+(n?" "+t:"")).replace(rl," ")}}function q(e,t,n){var r=e&&e.style;if(r){if(n===void 0)return document.defaultView&&document.defaultView.getComputedStyle?n=document.defaultView.getComputedStyle(e,""):e.currentStyle&&(n=e.currentStyle),t===void 0?n:n[t];!(t in r)&&t.indexOf("webkit")===-1&&(t="-webkit-"+t),r[t]=n+(typeof n=="string"?"":"px")}}function qt(e,t){var n="";if(typeof e=="string")n=e;else do{var r=q(e,"transform");r&&r!=="none"&&(n=r+" "+n)}while(!t&&(e=e.parentNode));var i=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return i&&new i(n)}function Qs(e,t,n){if(e){var r=e.getElementsByTagName(t),i=0,o=r.length;if(n)for(;i=o:l=i<=o,!l)return r;if(r===et())break;r=ht(r,!1)}return!1}function Ut(e,t,n,r){for(var i=0,o=0,l=e.children;o2&&arguments[2]!==void 0?arguments[2]:{},i=r.evt,o=kg(r,Pg);Cn.pluginEvent.bind(L)(t,n,rt({dragEl:O,parentEl:me,ghostEl:X,rootEl:fe,nextEl:St,lastDownEl:Hn,cloneEl:de,cloneHidden:dt,dragStarted:tn,putSortable:Ce,activeSortable:L.active,originalEvent:i,oldIndex:Ot,oldDraggableIndex:cn,newIndex:Le,newDraggableIndex:ft,hideGhostForTarget:ra,unhideGhostForTarget:ia,cloneNowHidden:function(){dt=!0},cloneNowShown:function(){dt=!1},dispatchSortableEvent:function(a){Fe({sortable:n,name:a,originalEvent:i})}},o))};function Fe(e){Ng(rt({putSortable:Ce,cloneEl:de,targetEl:O,rootEl:fe,oldIndex:Ot,oldDraggableIndex:cn,newIndex:Le,newDraggableIndex:ft},e))}var O,me,X,fe,St,Hn,de,dt,Ot,Le,cn,ft,Dn,Ce,xt=!1,ir=!1,or=[],wt,Be,Dr,Ir,ll,sl,tn,Nt,fn,dn=!1,In=!1,Ln,$e,Nr=[],ri=!1,lr=[],vr=typeof document<"u",Nn=Ws,al=Sn||ct?"cssFloat":"float",xg=vr&&!Xs&&!Ws&&"draggable"in document.createElement("div"),ea=function(){if(vr){if(ct)return!1;var e=document.createElement("x");return e.style.cssText="pointer-events:auto",e.style.pointerEvents==="auto"}}(),ta=function(t,n){var r=q(t),i=parseInt(r.width)-parseInt(r.paddingLeft)-parseInt(r.paddingRight)-parseInt(r.borderLeftWidth)-parseInt(r.borderRightWidth),o=Ut(t,0,n),l=Ut(t,1,n),a=o&&q(o),s=l&&q(l),u=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+we(o).width,c=s&&parseInt(s.marginLeft)+parseInt(s.marginRight)+we(l).width;if(r.display==="flex")return r.flexDirection==="column"||r.flexDirection==="column-reverse"?"vertical":"horizontal";if(r.display==="grid")return r.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(o&&a.float&&a.float!=="none"){var f=a.float==="left"?"left":"right";return l&&(s.clear==="both"||s.clear===f)?"vertical":"horizontal"}return o&&(a.display==="block"||a.display==="flex"||a.display==="table"||a.display==="grid"||u>=i&&r[al]==="none"||l&&r[al]==="none"&&u+c>i)?"vertical":"horizontal"},Tg=function(t,n,r){var i=r?t.left:t.top,o=r?t.right:t.bottom,l=r?t.width:t.height,a=r?n.left:n.top,s=r?n.right:n.bottom,u=r?n.width:n.height;return i===a||o===s||i+l/2===a+u/2},Og=function(t,n){var r;return or.some(function(i){var o=i[qe].options.emptyInsertThreshold;if(!(!o||ki(i))){var l=we(i),a=t>=l.left-o&&t<=l.right+o,s=n>=l.top-o&&n<=l.bottom+o;if(a&&s)return r=i}}),r},na=function(t){function n(o,l){return function(a,s,u,c){var f=a.options.group.name&&s.options.group.name&&a.options.group.name===s.options.group.name;if(o==null&&(l||f))return!0;if(o==null||o===!1)return!1;if(l&&o==="clone")return o;if(typeof o=="function")return n(o(a,s,u,c),l)(a,s,u,c);var d=(l?a:s).options.group.name;return o===!0||typeof o=="string"&&o===d||o.join&&o.indexOf(d)>-1}}var r={},i=t.group;(!i||zn(i)!="object")&&(i={name:i}),r.name=i.name,r.checkPull=n(i.pull,!0),r.checkPut=n(i.put),r.revertClone=i.revertClone,t.group=r},ra=function(){!ea&&X&&q(X,"display","none")},ia=function(){!ea&&X&&q(X,"display","")};vr&&!Xs&&document.addEventListener("click",function(e){if(ir)return e.preventDefault(),e.stopPropagation&&e.stopPropagation(),e.stopImmediatePropagation&&e.stopImmediatePropagation(),ir=!1,!1},!0);var yt=function(t){if(O){t=t.touches?t.touches[0]:t;var n=Og(t.clientX,t.clientY);if(n){var r={};for(var i in t)t.hasOwnProperty(i)&&(r[i]=t[i]);r.target=r.rootEl=n,r.preventDefault=void 0,r.stopPropagation=void 0,n[qe]._onDragOver(r)}}},Vg=function(t){O&&O.parentNode[qe]._isOutsideThisEl(t.target)};function L(e,t){if(!(e&&e.nodeType&&e.nodeType===1))throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(e));this.el=e,this.options=t=at({},t),e[qe]=this;var n={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(e.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return ta(e,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(l,a){l.setData("Text",a.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:L.supportPointer!==!1&&"PointerEvent"in window&&!an,emptyInsertThreshold:5};Cn.initializePlugins(this,e,n);for(var r in n)!(r in t)&&(t[r]=n[r]);na(t);for(var i in this)i.charAt(0)==="_"&&typeof this[i]=="function"&&(this[i]=this[i].bind(this));this.nativeDraggable=t.forceFallback?!1:xg,this.nativeDraggable&&(this.options.touchStartThreshold=1),t.supportPointer?ne(e,"pointerdown",this._onTapStart):(ne(e,"mousedown",this._onTapStart),ne(e,"touchstart",this._onTapStart)),this.nativeDraggable&&(ne(e,"dragover",this),ne(e,"dragenter",this)),or.push(this.el),t.store&&t.store.get&&this.sort(t.store.get(this)||[]),at(this,Fg())}L.prototype={constructor:L,_isOutsideThisEl:function(t){!this.el.contains(t)&&t!==this.el&&(Nt=null)},_getDirection:function(t,n){return typeof this.options.direction=="function"?this.options.direction.call(this,t,n,O):this.options.direction},_onTapStart:function(t){if(t.cancelable){var n=this,r=this.el,i=this.options,o=i.preventOnFilter,l=t.type,a=t.touches&&t.touches[0]||t.pointerType&&t.pointerType==="touch"&&t,s=(a||t).target,u=t.target.shadowRoot&&(t.path&&t.path[0]||t.composedPath&&t.composedPath()[0])||s,c=i.filter;if(Ug(r),!O&&!(/mousedown|pointerdown/.test(l)&&t.button!==0||i.disabled)&&!u.isContentEditable&&!(!this.nativeDraggable&&an&&s&&s.tagName.toUpperCase()==="SELECT")&&(s=Qe(s,i.draggable,r,!1),!(s&&s.animated)&&Hn!==s)){if(Ot=Ge(s),cn=Ge(s,i.draggable),typeof c=="function"){if(c.call(this,t,s,this)){Fe({sortable:n,rootEl:u,name:"filter",targetEl:s,toEl:r,fromEl:r}),Ne("filter",n,{evt:t}),o&&t.cancelable&&t.preventDefault();return}}else if(c&&(c=c.split(",").some(function(f){if(f=Qe(u,f.trim(),r,!1),f)return Fe({sortable:n,rootEl:f,name:"filter",targetEl:s,fromEl:r,toEl:r}),Ne("filter",n,{evt:t}),!0}),c)){o&&t.cancelable&&t.preventDefault();return}i.handle&&!Qe(u,i.handle,r,!1)||this._prepareDragStart(t,a,s)}}},_prepareDragStart:function(t,n,r){var i=this,o=i.el,l=i.options,a=o.ownerDocument,s;if(r&&!O&&r.parentNode===o){var u=we(r);if(fe=o,O=r,me=O.parentNode,St=O.nextSibling,Hn=r,Dn=l.group,L.dragged=O,wt={target:O,clientX:(n||t).clientX,clientY:(n||t).clientY},ll=wt.clientX-u.left,sl=wt.clientY-u.top,this._lastX=(n||t).clientX,this._lastY=(n||t).clientY,O.style["will-change"]="all",s=function(){if(Ne("delayEnded",i,{evt:t}),L.eventCanceled){i._onDrop();return}i._disableDelayedDragEvents(),!nl&&i.nativeDraggable&&(O.draggable=!0),i._triggerDragStart(t,n),Fe({sortable:i,name:"choose",originalEvent:t}),He(O,l.chosenClass,!0)},l.ignore.split(",").forEach(function(c){Qs(O,c.trim(),Pr)}),ne(a,"dragover",yt),ne(a,"mousemove",yt),ne(a,"touchmove",yt),ne(a,"mouseup",i._onDrop),ne(a,"touchend",i._onDrop),ne(a,"touchcancel",i._onDrop),nl&&this.nativeDraggable&&(this.options.touchStartThreshold=4,O.draggable=!0),Ne("delayStart",this,{evt:t}),l.delay&&(!l.delayOnTouchOnly||n)&&(!this.nativeDraggable||!(Sn||ct))){if(L.eventCanceled){this._onDrop();return}ne(a,"mouseup",i._disableDelayedDrag),ne(a,"touchend",i._disableDelayedDrag),ne(a,"touchcancel",i._disableDelayedDrag),ne(a,"mousemove",i._delayedDragTouchMoveHandler),ne(a,"touchmove",i._delayedDragTouchMoveHandler),l.supportPointer&&ne(a,"pointermove",i._delayedDragTouchMoveHandler),i._dragStartTimer=setTimeout(s,l.delay)}else s()}},_delayedDragTouchMoveHandler:function(t){var n=t.touches?t.touches[0]:t;Math.max(Math.abs(n.clientX-this._lastX),Math.abs(n.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){O&&Pr(O),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var t=this.el.ownerDocument;te(t,"mouseup",this._disableDelayedDrag),te(t,"touchend",this._disableDelayedDrag),te(t,"touchcancel",this._disableDelayedDrag),te(t,"mousemove",this._delayedDragTouchMoveHandler),te(t,"touchmove",this._delayedDragTouchMoveHandler),te(t,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(t,n){n=n||t.pointerType=="touch"&&t,!this.nativeDraggable||n?this.options.supportPointer?ne(document,"pointermove",this._onTouchMove):n?ne(document,"touchmove",this._onTouchMove):ne(document,"mousemove",this._onTouchMove):(ne(O,"dragend",this),ne(fe,"dragstart",this._onDragStart));try{document.selection?qn(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch{}},_dragStarted:function(t,n){if(xt=!1,fe&&O){Ne("dragStarted",this,{evt:n}),this.nativeDraggable&&ne(document,"dragover",Vg);var r=this.options;!t&&He(O,r.dragClass,!1),He(O,r.ghostClass,!0),L.active=this,t&&this._appendGhost(),Fe({sortable:this,name:"start",originalEvent:n})}else this._nulling()},_emulateDragOver:function(){if(Be){this._lastX=Be.clientX,this._lastY=Be.clientY,ra();for(var t=document.elementFromPoint(Be.clientX,Be.clientY),n=t;t&&t.shadowRoot&&(t=t.shadowRoot.elementFromPoint(Be.clientX,Be.clientY),t!==n);)n=t;if(O.parentNode[qe]._isOutsideThisEl(t),n)do{if(n[qe]){var r=void 0;if(r=n[qe]._onDragOver({clientX:Be.clientX,clientY:Be.clientY,target:t,rootEl:n}),r&&!this.options.dragoverBubble)break}t=n}while(n=n.parentNode);ia()}},_onTouchMove:function(t){if(wt){var n=this.options,r=n.fallbackTolerance,i=n.fallbackOffset,o=t.touches?t.touches[0]:t,l=X&&qt(X,!0),a=X&&l&&l.a,s=X&&l&&l.d,u=Nn&&$e&&ol($e),c=(o.clientX-wt.clientX+i.x)/(a||1)+(u?u[0]-Nr[0]:0)/(a||1),f=(o.clientY-wt.clientY+i.y)/(s||1)+(u?u[1]-Nr[1]:0)/(s||1);if(!L.active&&!xt){if(r&&Math.max(Math.abs(o.clientX-this._lastX),Math.abs(o.clientY-this._lastY))=0&&(Fe({rootEl:me,name:"add",toEl:me,fromEl:fe,originalEvent:t}),Fe({sortable:this,name:"remove",toEl:me,originalEvent:t}),Fe({rootEl:me,name:"sort",toEl:me,fromEl:fe,originalEvent:t}),Fe({sortable:this,name:"sort",toEl:me,originalEvent:t})),Ce&&Ce.save()):Le!==Ot&&Le>=0&&(Fe({sortable:this,name:"update",toEl:me,originalEvent:t}),Fe({sortable:this,name:"sort",toEl:me,originalEvent:t})),L.active&&((Le==null||Le===-1)&&(Le=Ot,ft=cn),Fe({sortable:this,name:"end",toEl:me,originalEvent:t}),this.save()))),this._nulling()},_nulling:function(){Ne("nulling",this),fe=O=me=X=St=de=Hn=dt=wt=Be=tn=Le=ft=Ot=cn=Nt=fn=Ce=Dn=L.dragged=L.ghost=L.clone=L.active=null,lr.forEach(function(t){t.checked=!0}),lr.length=Dr=Ir=0},handleEvent:function(t){switch(t.type){case"drop":case"dragend":this._onDrop(t);break;case"dragenter":case"dragover":O&&(this._onDragOver(t),zg(t));break;case"selectstart":t.preventDefault();break}},toArray:function(){for(var t=[],n,r=this.el.children,i=0,o=r.length,l=this.options;ir.right+i||e.clientX<=r.right&&e.clientY>r.bottom&&e.clientX>=r.left:e.clientX>r.right&&e.clientY>r.top||e.clientX<=r.right&&e.clientY>r.bottom+i}function Gg(e,t,n,r,i,o,l,a){var s=r?e.clientY:e.clientX,u=r?n.height:n.width,c=r?n.top:n.left,f=r?n.bottom:n.right,d=!1;if(!l){if(a&&Lnc+u*o/2:sf-Ln)return-fn}else if(s>c+u*(1-i)/2&&sf-u*o/2)?s>c+u/2?1:-1:0}function jg(e){return Ge(O)k[24];for(let k=0;kE[21];for(let E=0;EQ & A Comparison Instructions +
+

Ask a question and rank the answers across the models. Drag each answer to + rank it, in ascending order, from left-to-right. Optionally, select the + rank for each via the corresponding dropdown.

+
+ `,r=D(),i=R("div"),o=R("section"),l=R("div");for(let E=0;E{e.scrollIntoView({behavior:"smooth"})},0)}async function ml(e){console.log("run update",e);const n=await fetch("/chat/comparator/db/update",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({data:e})});if(n.ok)console.log("ok",n);else{const r=await n.text();alert(r)}}function Qg(e,t,n){let r,i,o;ee(e,kr,$=>n(7,o=$));let{numModels:l=1}=t,{models:a=[0]}=t,s="",u="",c=!1;ut(async()=>{if(await new Promise($=>setTimeout($,200)),g){const $=new L(g,{animation:150,onUpdate(E){$.toArray()}});$.toArray()}});const f=async $=>{$.preventDefault(),s=u,n(3,u=""),n(4,c=!0);let E={question:s};for(let k of a)E[k]="Loading...";Oe(kr,o=[...o,E],o);const S=await fetch(`/chat/comparator/${s}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:s})});if(S.ok){const k=await S.json();n(1,a=Object.keys(k.answer)),n(0,l=a.length);for(let y of a)E[y]=k.answer[y];E.qid=k.qid,kr.update(y=>(y[y.length-1]=E,y))}else{const k=await S.text();alert(k)}n(4,c=!1)};let d=0;setInterval(()=>{n(11,d=(d+1)%4)},200);let g,p;function m($,E){const S=E,y=st($.currentTarget.parentNode).selectAll("div.answer").nodes().map(P=>P.id);y.forEach((P,B)=>{st(`#${P}`).select(".answer-rank").property("value",B+1)});let M=[];for(let[P,B]of y.entries()){const ge=parseInt(B.split("-")[1]),oe=a[ge],Ee={rank:P,model:oe};M.push(Ee)}let I=o.filter(P=>P.qid===S),F=[];for(let P of M){const B={model:P.model,qid:parseInt(S),rank:parseInt(P.rank)+1,answer:I[0][P.model]};F.push(B)}ml(F)}function _($,E,S){const k=E,y=parseInt($.target.value),M=a[S],I={qid:k,rank:parseInt(y),model:M};let F=[],B=o.filter(oe=>oe.qid===I.qid)[0][I.model];const ge={model:I.model,qid:parseInt(I.qid),rank:parseInt(I.rank),answer:B};F.push(ge),ml(F)}const b=($,E,S)=>_(S,$.qid,E),w=($,E)=>m(E,$.qid);function C($){hn[$?"unshift":"push"](()=>{g=$,n(2,g)})}function A(){u=this.value,n(3,u)}return e.$$set=$=>{"numModels"in $&&n(0,l=$.numModels),"models"in $&&n(1,a=$.models)},e.$$.update=()=>{e.$$.dirty&1&&n(6,r="1fr ".repeat(l).trim()),e.$$.dirty&2048&&n(5,i=".".repeat(d).padEnd(3)),e.$$.dirty&4100&&g&&(n(12,p=new L(g,{animation:150,dataIdAttr:"id",onUpdate($){p.toArray()}})),p.toArray())},[l,a,g,u,c,i,r,o,f,m,_,d,p,b,w,C,A]}class Kg extends ie{constructor(t){super(),se(this,t,Qg,Xg,re,{numModels:0,models:1})}}function Jg(e){const t=+this._x.call(null,e),n=+this._y.call(null,e);return la(this.cover(t,n),t,n,e)}function la(e,t,n,r){if(isNaN(t)||isNaN(n))return e;var i,o=e._root,l={data:r},a=e._x0,s=e._y0,u=e._x1,c=e._y1,f,d,g,p,m,_,b,w;if(!o)return e._root=l,e;for(;o.length;)if((m=t>=(f=(a+u)/2))?a=f:u=f,(_=n>=(d=(s+c)/2))?s=d:c=d,i=o,!(o=o[b=_<<1|m]))return i[b]=l,e;if(g=+e._x.call(null,o.data),p=+e._y.call(null,o.data),t===g&&n===p)return l.next=o,i?i[b]=l:e._root=l,e;do i=i?i[b]=new Array(4):e._root=new Array(4),(m=t>=(f=(a+u)/2))?a=f:u=f,(_=n>=(d=(s+c)/2))?s=d:c=d;while((b=_<<1|m)===(w=(p>=d)<<1|g>=f));return i[w]=o,i[b]=l,e}function Zg(e){var t,n,r=e.length,i,o,l=new Array(r),a=new Array(r),s=1/0,u=1/0,c=-1/0,f=-1/0;for(n=0;nc&&(c=i),of&&(f=o));if(s>c||u>f)return this;for(this.cover(s,u).cover(c,f),n=0;ne||e>=i||r>t||t>=o;)switch(u=(tc||(a=p.y0)>f||(s=p.x1)=b)<<1|e>=_)&&(p=d[d.length-1],d[d.length-1]=d[d.length-1-m],d[d.length-1-m]=p)}else{var w=e-+this._x.call(null,g.data),C=t-+this._y.call(null,g.data),A=w*w+C*C;if(A=(d=(l+s)/2))?l=d:s=d,(m=f>=(g=(a+u)/2))?a=g:u=g,t=n,!(n=n[_=m<<1|p]))return this;if(!n.length)break;(t[_+1&3]||t[_+2&3]||t[_+3&3])&&(r=t,b=_)}for(;n.data!==e;)if(i=n,!(n=n.next))return this;return(o=n.next)&&delete n.next,i?(o?i.next=o:delete i.next,this):t?(o?t[_]=o:delete t[_],(n=t[0]||t[1]||t[2]||t[3])&&n===(t[3]||t[2]||t[1]||t[0])&&!n.length&&(r?r[b]=n:this._root=n),this):(this._root=o,this)}function oh(e){for(var t=0,n=e.length;td.index){var I=g-k.x-k.vx,F=p-k.y-k.vy,P=I*I+F*F;Pg+M||Ep+M||Su.r&&(u.r=u[c].r)}function s(){if(t){var u,c=t.length,f;for(n=new Array(c),u=0;u{}};function aa(){for(var e=0,t=arguments.length,n={},r;e=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}jn.prototype=aa.prototype={constructor:jn,on:function(e,t){var n=this._,r=vh(e+"",n),i,o=-1,l=r.length;if(arguments.length<2){for(;++o0)for(var n=new Array(i),r=0,i,o;r=0&&e._call.call(void 0,t),e=e._next;--Wt}function wl(){At=(ur=wn.now())+br,Wt=on=0;try{yh()}finally{Wt=0,Ch(),At=0}}function Sh(){var e=wn.now(),t=e-ur;t>ua&&(br-=t,ur=e)}function Ch(){for(var e,t=ar,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:ar=n);ln=e,ai(r)}function ai(e){if(!Wt){on&&(on=clearTimeout(on));var t=e-At;t>24?(e<1/0&&(on=setTimeout(wl,e-wn.now()-br)),Jt&&(Jt=clearInterval(Jt))):(Jt||(ur=wn.now(),Jt=setInterval(Sh,ua)),Wt=1,ca(wl))}}const kh=1664525,$h=1013904223,yl=4294967296;function Rh(){let e=1;return()=>(e=(kh*e+$h)%yl)/yl}var Ah=10,Eh=Math.PI*(3-Math.sqrt(5));function Mh(e){var t,n=1,r=.001,i=1-Math.pow(r,1/300),o=0,l=.6,a=new Map,s=da(f),u=aa("tick","end"),c=Rh();e==null&&(e=[]);function f(){d(),u.call("tick",t),n1?(_==null?a.delete(m):a.set(m,p(_)),t):a.get(m)},find:function(m,_,b){var w=0,C=e.length,A,$,E,S,k;for(b==null?b=1/0:b*=b,w=0;w1?(u.on(m,_),t):u.on(m)}}}function Fh(e){var t=Je(.1),n,r,i;typeof e!="function"&&(e=Je(e==null?0:+e));function o(a){for(var s=0,u=n.length,c;se[4]?1:0),h(t,"class",g="file-circle-g "+(e[20].size>e[4]?"large":"")+" svelte-h2ab3o"),h(t,"style",p=e[5](e[20].x,e[20].y)),h(t,"role","img")},m(w,C){T(w,t,C),v(t,n),v(t,o),v(o,a),v(o,s),v(s,c),m=!0,_||(b=[j(t,"mouseover",e[6]),j(t,"mouseout",e[7]),j(t,"focus",e[6]),j(t,"blur",e[7])],_=!0)},p(w,C){(!m||C&12&&r!==(r=w[3](w[20].size)))&&h(n,"r",r),(!m||C&4)&&l!==(l=w[20].file+"")&&Q(a,l),(!m||C&4)&&u!==(u=Kr(w[20].size)+"")&&Q(c,u),(!m||C&20&&f!==(f=w[20].size>w[4]?1:0))&&h(o,"opacity",f),(!m||C&20&&g!==(g="file-circle-g "+(w[20].size>w[4]?"large":"")+" svelte-h2ab3o"))&&h(t,"class",g),(!m||C&4&&p!==(p=w[5](w[20].x,w[20].y)))&&h(t,"style",p)},i(w){m||(w&&Se(()=>{m&&(i||(i=Ke(n,Rn,{duration:1e3},!0)),i.run(1))}),w&&Se(()=>{m&&(d||(d=Ke(o,Rn,{duration:1e3},!0)),d.run(1))}),m=!0)},o(w){w&&(i||(i=Ke(n,Rn,{duration:1e3},!1)),i.run(0)),w&&(d||(d=Ke(o,Rn,{duration:1e3},!1)),d.run(0)),m=!1},d(w){w&&x(t),w&&i&&i.end(),w&&d&&d.end(),_=!1,_e(b)}}}function Ih(e){let t,n,r,i,o=e[2],l=[];for(let s=0;sV(l[s],1,1,()=>{l[s]=null});return{c(){t=R("div"),n=U("svg");for(let s=0;se[15].call(t))},m(s,u){T(s,t,u),v(t,n);for(let c=0;cn(14,c=$));let f=600,d=350,g=!0,p=!1;const m=($,E)=>`transform: translate(${$}px, ${E}px)`,_=[-4,4],b=[-1,1];function w(){n(8,g=!0),n(9,p=!0);const $=st(this);$r(".file-circle-g").select("text").style("opacity",0),$.raise(),$.select("circle").attr("fill","var(--red)"),$.select("text").style("opacity",1)}const C=()=>{const $=$r(".file-circle-g");$.select("circle").attr("fill","var(--yellow)"),$.select("text").style("opacity",0),n(9,p=!1),setTimeout(()=>{n(8,g=!1)},1e3)};function A(){f=this.offsetWidth,d=this.offsetHeight,n(0,f),n(1,d)}return e.$$.update=()=>{e.$$.dirty&16387&&n(2,r=c.map($=>({...$,x:f/2,y:d/2,tickCount:0}))),e.$$.dirty&16384&&console.log(c.map($=>$.size).sort(($,E)=>$-E)),e.$$.dirty&1&&n(13,i=Fh().x(f/2)),e.$$.dirty&2&&n(12,o=Dh().y(d/2)),e.$$.dirty&16384&&n(3,s=We().domain(sn(c,$=>$.size)).range([12,60])),e.$$.dirty&8&&n(10,l=mh().radius($=>s($.size)+1).iterations(3)),e.$$.dirty&16384&&n(4,a=id(c.map($=>$.size).sort(($,E)=>$-E),.85)),e.$$.dirty&1&&We().domain(_).range([5,f]),e.$$.dirty&2&&We().domain(b).range([d,5]),e.$$.dirty&4&&n(11,u=Mh().nodes(r).on("tick",()=>{n(2,r=[...r])})),e.$$.dirty&15360&&(u.force("x",i),u.force("y",o),u.force("collide",l),u.alpha(.02),u.restart()),e.$$.dirty&19468&&(s.domain(sn(c,$=>$.size)),r.forEach($=>$.radius=s($.size)),u.nodes(r),l.radius($=>$.radius+.5)),e.$$.dirty&768&&g===!1&&(p||$r(".large").select("text").style("opacity",1))},[f,d,r,s,a,m,w,C,g,p,l,u,o,i,c,A]}class Ph extends ie{constructor(t){super(),se(this,t,Nh,Ih,re,{})}}/** + * table-core + * + * Copyright (c) TanStack + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */function pt(e,t){return typeof e=="function"?e(t):e}function je(e,t){return n=>{t.setState(r=>({...r,[e]:pt(n,r[e])}))}}function fr(e){return e instanceof Function}function xh(e){return Array.isArray(e)&&e.every(t=>typeof t=="number")}function Th(e,t){const n=[],r=i=>{i.forEach(o=>{n.push(o);const l=t(o);l!=null&&l.length&&r(l)})};return r(e),n}function G(e,t,n){let r=[],i;return()=>{let o;n.key&&n.debug&&(o=Date.now());const l=e();if(!(l.length!==r.length||l.some((u,c)=>r[c]!==u)))return i;r=l;let s;if(n.key&&n.debug&&(s=Date.now()),i=t(...l),n==null||n.onChange==null||n.onChange(i),n.key&&n.debug&&n!=null&&n.debug()){const u=Math.round((Date.now()-o)*100)/100,c=Math.round((Date.now()-s)*100)/100,f=c/16,d=(g,p)=>{for(g=String(g);g.length{let g=d;for(const m of s.split(".")){var p;g=(p=g)==null?void 0:p[m]}return g}:c=d=>d[a.accessorKey]),!u)throw new Error;let f={id:`${String(u)}`,accessorFn:c,parent:r,depth:n,columnDef:a,columns:[],getFlatColumns:G(()=>[!0],()=>{var d;return[f,...(d=f.columns)==null?void 0:d.flatMap(g=>g.getFlatColumns())]},{key:"column.getFlatColumns",debug:()=>{var d;return(d=e.options.debugAll)!=null?d:e.options.debugColumns}}),getLeafColumns:G(()=>[e._getOrderColumnsFn()],d=>{var g;if((g=f.columns)!=null&&g.length){let p=f.columns.flatMap(m=>m.getLeafColumns());return d(p)}return[f]},{key:"column.getLeafColumns",debug:()=>{var d;return(d=e.options.debugAll)!=null?d:e.options.debugColumns}})};return f=e._features.reduce((d,g)=>Object.assign(d,g.createColumn==null?void 0:g.createColumn(f,e)),f),f}function $l(e,t,n){var r;let o={id:(r=n.id)!=null?r:t.id,column:t,index:n.index,isPlaceholder:!!n.isPlaceholder,placeholderId:n.placeholderId,depth:n.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const l=[],a=s=>{s.subHeaders&&s.subHeaders.length&&s.subHeaders.map(a),l.push(s)};return a(o),l},getContext:()=>({table:e,header:o,column:t})};return e._features.forEach(l=>{Object.assign(o,l.createHeader==null?void 0:l.createHeader(o,e))}),o}const Vh={createTable:e=>({getHeaderGroups:G(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,i)=>{var o,l;const a=(o=r==null?void 0:r.map(f=>n.find(d=>d.id===f)).filter(Boolean))!=null?o:[],s=(l=i==null?void 0:i.map(f=>n.find(d=>d.id===f)).filter(Boolean))!=null?l:[],u=n.filter(f=>!(r!=null&&r.includes(f.id))&&!(i!=null&&i.includes(f.id)));return xn(t,[...a,...u,...s],e)},{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getCenterHeaderGroups:G(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,i)=>(n=n.filter(o=>!(r!=null&&r.includes(o.id))&&!(i!=null&&i.includes(o.id))),xn(t,n,e,"center")),{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getLeftHeaderGroups:G(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(t,n,r)=>{var i;const o=(i=r==null?void 0:r.map(l=>n.find(a=>a.id===l)).filter(Boolean))!=null?i:[];return xn(t,o,e,"left")},{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getRightHeaderGroups:G(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(t,n,r)=>{var i;const o=(i=r==null?void 0:r.map(l=>n.find(a=>a.id===l)).filter(Boolean))!=null?i:[];return xn(t,o,e,"right")},{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getFooterGroups:G(()=>[e.getHeaderGroups()],t=>[...t].reverse(),{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getLeftFooterGroups:G(()=>[e.getLeftHeaderGroups()],t=>[...t].reverse(),{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getCenterFooterGroups:G(()=>[e.getCenterHeaderGroups()],t=>[...t].reverse(),{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getRightFooterGroups:G(()=>[e.getRightHeaderGroups()],t=>[...t].reverse(),{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getFlatHeaders:G(()=>[e.getHeaderGroups()],t=>t.map(n=>n.headers).flat(),{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getLeftFlatHeaders:G(()=>[e.getLeftHeaderGroups()],t=>t.map(n=>n.headers).flat(),{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getCenterFlatHeaders:G(()=>[e.getCenterHeaderGroups()],t=>t.map(n=>n.headers).flat(),{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getRightFlatHeaders:G(()=>[e.getRightHeaderGroups()],t=>t.map(n=>n.headers).flat(),{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getCenterLeafHeaders:G(()=>[e.getCenterFlatHeaders()],t=>t.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getLeftLeafHeaders:G(()=>[e.getLeftFlatHeaders()],t=>t.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getRightLeafHeaders:G(()=>[e.getRightFlatHeaders()],t=>t.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getLeafHeaders:G(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(t,n,r)=>{var i,o,l,a,s,u;return[...(i=(o=t[0])==null?void 0:o.headers)!=null?i:[],...(l=(a=n[0])==null?void 0:a.headers)!=null?l:[],...(s=(u=r[0])==null?void 0:u.headers)!=null?s:[]].map(c=>c.getLeafHeaders()).flat()},{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}})})};function xn(e,t,n,r){var i,o;let l=0;const a=function(d,g){g===void 0&&(g=1),l=Math.max(l,g),d.filter(p=>p.getIsVisible()).forEach(p=>{var m;(m=p.columns)!=null&&m.length&&a(p.columns,g+1)},0)};a(e);let s=[];const u=(d,g)=>{const p={depth:g,id:[r,`${g}`].filter(Boolean).join("_"),headers:[]},m=[];d.forEach(_=>{const b=[...m].reverse()[0],w=_.column.depth===p.depth;let C,A=!1;if(w&&_.column.parent?C=_.column.parent:(C=_.column,A=!0),b&&(b==null?void 0:b.column)===C)b.subHeaders.push(_);else{const $=$l(n,C,{id:[r,g,C.id,_==null?void 0:_.id].filter(Boolean).join("_"),isPlaceholder:A,placeholderId:A?`${m.filter(E=>E.column===C).length}`:void 0,depth:g,index:m.length});$.subHeaders.push(_),m.push($)}p.headers.push(_),_.headerGroup=p}),s.push(p),g>0&&u(m,g-1)},c=t.map((d,g)=>$l(n,d,{depth:l,index:g}));u(c,l-1),s.reverse();const f=d=>d.filter(p=>p.column.getIsVisible()).map(p=>{let m=0,_=0,b=[0];p.subHeaders&&p.subHeaders.length?(b=[],f(p.subHeaders).forEach(C=>{let{colSpan:A,rowSpan:$}=C;m+=A,b.push($)})):m=1;const w=Math.min(...b);return _=_+w,p.colSpan=m,p.rowSpan=_,{colSpan:m,rowSpan:_}});return f((i=(o=s[0])==null?void 0:o.headers)!=null?i:[]),s}const Tn={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},Vr=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),zh={getDefaultColumnDef:()=>Tn,getInitialState:e=>({columnSizing:{},columnSizingInfo:Vr(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",onColumnSizingChange:je("columnSizing",e),onColumnSizingInfoChange:je("columnSizingInfo",e)}),createColumn:(e,t)=>({getSize:()=>{var n,r,i;const o=t.getState().columnSizing[e.id];return Math.min(Math.max((n=e.columnDef.minSize)!=null?n:Tn.minSize,(r=o??e.columnDef.size)!=null?r:Tn.size),(i=e.columnDef.maxSize)!=null?i:Tn.maxSize)},getStart:n=>{const r=n?n==="left"?t.getLeftVisibleLeafColumns():t.getRightVisibleLeafColumns():t.getVisibleLeafColumns(),i=r.findIndex(o=>o.id===e.id);if(i>0){const o=r[i-1];return o.getStart(n)+o.getSize()}return 0},resetSize:()=>{t.setColumnSizing(n=>{let{[e.id]:r,...i}=n;return i})},getCanResize:()=>{var n,r;return((n=e.columnDef.enableResizing)!=null?n:!0)&&((r=t.options.enableColumnResizing)!=null?r:!0)},getIsResizing:()=>t.getState().columnSizingInfo.isResizingColumn===e.id}),createHeader:(e,t)=>({getSize:()=>{let n=0;const r=i=>{if(i.subHeaders.length)i.subHeaders.forEach(r);else{var o;n+=(o=i.column.getSize())!=null?o:0}};return r(e),n},getStart:()=>{if(e.index>0){const n=e.headerGroup.headers[e.index-1];return n.getStart()+n.getSize()}return 0},getResizeHandler:()=>{const n=t.getColumn(e.column.id),r=n==null?void 0:n.getCanResize();return i=>{if(!n||!r||(i.persist==null||i.persist(),zr(i)&&i.touches&&i.touches.length>1))return;const o=e.getSize(),l=e?e.getLeafHeaders().map(m=>[m.column.id,m.column.getSize()]):[[n.id,n.getSize()]],a=zr(i)?Math.round(i.touches[0].clientX):i.clientX,s={},u=(m,_)=>{typeof _=="number"&&(t.setColumnSizingInfo(b=>{var w,C;const A=_-((w=b==null?void 0:b.startOffset)!=null?w:0),$=Math.max(A/((C=b==null?void 0:b.startSize)!=null?C:0),-.999999);return b.columnSizingStart.forEach(E=>{let[S,k]=E;s[S]=Math.round(Math.max(k+k*$,0)*100)/100}),{...b,deltaOffset:A,deltaPercentage:$}}),(t.options.columnResizeMode==="onChange"||m==="end")&&t.setColumnSizing(b=>({...b,...s})))},c=m=>u("move",m),f=m=>{u("end",m),t.setColumnSizingInfo(_=>({..._,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},d={moveHandler:m=>c(m.clientX),upHandler:m=>{document.removeEventListener("mousemove",d.moveHandler),document.removeEventListener("mouseup",d.upHandler),f(m.clientX)}},g={moveHandler:m=>(m.cancelable&&(m.preventDefault(),m.stopPropagation()),c(m.touches[0].clientX),!1),upHandler:m=>{var _;document.removeEventListener("touchmove",g.moveHandler),document.removeEventListener("touchend",g.upHandler),m.cancelable&&(m.preventDefault(),m.stopPropagation()),f((_=m.touches[0])==null?void 0:_.clientX)}},p=Hh()?{passive:!1}:!1;zr(i)?(document.addEventListener("touchmove",g.moveHandler,p),document.addEventListener("touchend",g.upHandler,p)):(document.addEventListener("mousemove",d.moveHandler,p),document.addEventListener("mouseup",d.upHandler,p)),t.setColumnSizingInfo(m=>({...m,startOffset:a,startSize:o,deltaOffset:0,deltaPercentage:0,columnSizingStart:l,isResizingColumn:n.id}))}}}),createTable:e=>({setColumnSizing:t=>e.options.onColumnSizingChange==null?void 0:e.options.onColumnSizingChange(t),setColumnSizingInfo:t=>e.options.onColumnSizingInfoChange==null?void 0:e.options.onColumnSizingInfoChange(t),resetColumnSizing:t=>{var n;e.setColumnSizing(t?{}:(n=e.initialState.columnSizing)!=null?n:{})},resetHeaderSizeInfo:t=>{var n;e.setColumnSizingInfo(t?Vr():(n=e.initialState.columnSizingInfo)!=null?n:Vr())},getTotalSize:()=>{var t,n;return(t=(n=e.getHeaderGroups()[0])==null?void 0:n.headers.reduce((r,i)=>r+i.getSize(),0))!=null?t:0},getLeftTotalSize:()=>{var t,n;return(t=(n=e.getLeftHeaderGroups()[0])==null?void 0:n.headers.reduce((r,i)=>r+i.getSize(),0))!=null?t:0},getCenterTotalSize:()=>{var t,n;return(t=(n=e.getCenterHeaderGroups()[0])==null?void 0:n.headers.reduce((r,i)=>r+i.getSize(),0))!=null?t:0},getRightTotalSize:()=>{var t,n;return(t=(n=e.getRightHeaderGroups()[0])==null?void 0:n.headers.reduce((r,i)=>r+i.getSize(),0))!=null?t:0}})};let On=null;function Hh(){if(typeof On=="boolean")return On;let e=!1;try{const t={get passive(){return e=!0,!1}},n=()=>{};window.addEventListener("test",n,t),window.removeEventListener("test",n)}catch{e=!1}return On=e,On}function zr(e){return e.type==="touchstart"}const Lh={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:je("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let t=!1,n=!1;return{_autoResetExpanded:()=>{var r,i;if(!t){e._queue(()=>{t=!0});return}if((r=(i=e.options.autoResetAll)!=null?i:e.options.autoResetExpanded)!=null?r:!e.options.manualExpanding){if(n)return;n=!0,e._queue(()=>{e.resetExpanded(),n=!1})}},setExpanded:r=>e.options.onExpandedChange==null?void 0:e.options.onExpandedChange(r),toggleAllRowsExpanded:r=>{r??!e.getIsAllRowsExpanded()?e.setExpanded(!0):e.setExpanded({})},resetExpanded:r=>{var i,o;e.setExpanded(r?{}:(i=(o=e.initialState)==null?void 0:o.expanded)!=null?i:{})},getCanSomeRowsExpand:()=>e.getPrePaginationRowModel().flatRows.some(r=>r.getCanExpand()),getToggleAllRowsExpandedHandler:()=>r=>{r.persist==null||r.persist(),e.toggleAllRowsExpanded()},getIsSomeRowsExpanded:()=>{const r=e.getState().expanded;return r===!0||Object.values(r).some(Boolean)},getIsAllRowsExpanded:()=>{const r=e.getState().expanded;return typeof r=="boolean"?r===!0:!(!Object.keys(r).length||e.getRowModel().flatRows.some(i=>!i.getIsExpanded()))},getExpandedDepth:()=>{let r=0;return(e.getState().expanded===!0?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(o=>{const l=o.split(".");r=Math.max(r,l.length)}),r},getPreExpandedRowModel:()=>e.getSortedRowModel(),getExpandedRowModel:()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel?e.getPreExpandedRowModel():e._getExpandedRowModel())}},createRow:(e,t)=>({toggleExpanded:n=>{t.setExpanded(r=>{var i;const o=r===!0?!0:!!(r!=null&&r[e.id]);let l={};if(r===!0?Object.keys(t.getRowModel().rowsById).forEach(a=>{l[a]=!0}):l=r,n=(i=n)!=null?i:!o,!o&&n)return{...l,[e.id]:!0};if(o&&!n){const{[e.id]:a,...s}=l;return s}return r})},getIsExpanded:()=>{var n;const r=t.getState().expanded;return!!((n=t.options.getIsRowExpanded==null?void 0:t.options.getIsRowExpanded(e))!=null?n:r===!0||r!=null&&r[e.id])},getCanExpand:()=>{var n,r,i;return(n=t.options.getRowCanExpand==null?void 0:t.options.getRowCanExpand(e))!=null?n:((r=t.options.enableExpanding)!=null?r:!0)&&!!((i=e.subRows)!=null&&i.length)},getToggleExpandedHandler:()=>{const n=e.getCanExpand();return()=>{n&&e.toggleExpanded()}}})},ga=(e,t,n)=>{var r,i,o;const l=n.toLowerCase();return!!(!((r=e.getValue(t))==null||(i=r.toString())==null||(o=i.toLowerCase())==null)&&o.includes(l))};ga.autoRemove=e=>Xe(e);const ha=(e,t,n)=>{var r,i;return!!(!((r=e.getValue(t))==null||(i=r.toString())==null)&&i.includes(n))};ha.autoRemove=e=>Xe(e);const pa=(e,t,n)=>{var r,i;return((r=e.getValue(t))==null||(i=r.toString())==null?void 0:i.toLowerCase())===(n==null?void 0:n.toLowerCase())};pa.autoRemove=e=>Xe(e);const ma=(e,t,n)=>{var r;return(r=e.getValue(t))==null?void 0:r.includes(n)};ma.autoRemove=e=>Xe(e)||!(e!=null&&e.length);const _a=(e,t,n)=>!n.some(r=>{var i;return!((i=e.getValue(t))!=null&&i.includes(r))});_a.autoRemove=e=>Xe(e)||!(e!=null&&e.length);const va=(e,t,n)=>n.some(r=>{var i;return(i=e.getValue(t))==null?void 0:i.includes(r)});va.autoRemove=e=>Xe(e)||!(e!=null&&e.length);const ba=(e,t,n)=>e.getValue(t)===n;ba.autoRemove=e=>Xe(e);const wa=(e,t,n)=>e.getValue(t)==n;wa.autoRemove=e=>Xe(e);const Ei=(e,t,n)=>{let[r,i]=n;const o=e.getValue(t);return o>=r&&o<=i};Ei.resolveFilterValue=e=>{let[t,n]=e,r=typeof t!="number"?parseFloat(t):t,i=typeof n!="number"?parseFloat(n):n,o=t===null||Number.isNaN(r)?-1/0:r,l=n===null||Number.isNaN(i)?1/0:i;if(o>l){const a=o;o=l,l=a}return[o,l]};Ei.autoRemove=e=>Xe(e)||Xe(e[0])&&Xe(e[1]);const it={includesString:ga,includesStringSensitive:ha,equalsString:pa,arrIncludes:ma,arrIncludesAll:_a,arrIncludesSome:va,equals:ba,weakEquals:wa,inNumberRange:Ei};function Xe(e){return e==null||e===""}const qh={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],globalFilter:void 0,...e}),getDefaultOptions:e=>({onColumnFiltersChange:je("columnFilters",e),onGlobalFilterChange:je("globalFilter",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100,globalFilterFn:"auto",getColumnCanGlobalFilter:t=>{var n,r;const i=(n=e.getCoreRowModel().flatRows[0])==null||(r=n._getAllCellsByColumnId()[t.id])==null?void 0:r.getValue();return typeof i=="string"||typeof i=="number"}}),createColumn:(e,t)=>({getAutoFilterFn:()=>{const n=t.getCoreRowModel().flatRows[0],r=n==null?void 0:n.getValue(e.id);return typeof r=="string"?it.includesString:typeof r=="number"?it.inNumberRange:typeof r=="boolean"||r!==null&&typeof r=="object"?it.equals:Array.isArray(r)?it.arrIncludes:it.weakEquals},getFilterFn:()=>{var n,r;return fr(e.columnDef.filterFn)?e.columnDef.filterFn:e.columnDef.filterFn==="auto"?e.getAutoFilterFn():(n=(r=t.options.filterFns)==null?void 0:r[e.columnDef.filterFn])!=null?n:it[e.columnDef.filterFn]},getCanFilter:()=>{var n,r,i;return((n=e.columnDef.enableColumnFilter)!=null?n:!0)&&((r=t.options.enableColumnFilters)!=null?r:!0)&&((i=t.options.enableFilters)!=null?i:!0)&&!!e.accessorFn},getCanGlobalFilter:()=>{var n,r,i,o;return((n=e.columnDef.enableGlobalFilter)!=null?n:!0)&&((r=t.options.enableGlobalFilter)!=null?r:!0)&&((i=t.options.enableFilters)!=null?i:!0)&&((o=t.options.getColumnCanGlobalFilter==null?void 0:t.options.getColumnCanGlobalFilter(e))!=null?o:!0)&&!!e.accessorFn},getIsFiltered:()=>e.getFilterIndex()>-1,getFilterValue:()=>{var n,r;return(n=t.getState().columnFilters)==null||(r=n.find(i=>i.id===e.id))==null?void 0:r.value},getFilterIndex:()=>{var n,r;return(n=(r=t.getState().columnFilters)==null?void 0:r.findIndex(i=>i.id===e.id))!=null?n:-1},setFilterValue:n=>{t.setColumnFilters(r=>{const i=e.getFilterFn(),o=r==null?void 0:r.find(c=>c.id===e.id),l=pt(n,o?o.value:void 0);if(Rl(i,l,e)){var a;return(a=r==null?void 0:r.filter(c=>c.id!==e.id))!=null?a:[]}const s={id:e.id,value:l};if(o){var u;return(u=r==null?void 0:r.map(c=>c.id===e.id?s:c))!=null?u:[]}return r!=null&&r.length?[...r,s]:[s]})},_getFacetedRowModel:t.options.getFacetedRowModel&&t.options.getFacetedRowModel(t,e.id),getFacetedRowModel:()=>e._getFacetedRowModel?e._getFacetedRowModel():t.getPreFilteredRowModel(),_getFacetedUniqueValues:t.options.getFacetedUniqueValues&&t.options.getFacetedUniqueValues(t,e.id),getFacetedUniqueValues:()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,_getFacetedMinMaxValues:t.options.getFacetedMinMaxValues&&t.options.getFacetedMinMaxValues(t,e.id),getFacetedMinMaxValues:()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}}),createRow:(e,t)=>({columnFilters:{},columnFiltersMeta:{}}),createTable:e=>({getGlobalAutoFilterFn:()=>it.includesString,getGlobalFilterFn:()=>{var t,n;const{globalFilterFn:r}=e.options;return fr(r)?r:r==="auto"?e.getGlobalAutoFilterFn():(t=(n=e.options.filterFns)==null?void 0:n[r])!=null?t:it[r]},setColumnFilters:t=>{const n=e.getAllLeafColumns(),r=i=>{var o;return(o=pt(t,i))==null?void 0:o.filter(l=>{const a=n.find(s=>s.id===l.id);if(a){const s=a.getFilterFn();if(Rl(s,l.value,a))return!1}return!0})};e.options.onColumnFiltersChange==null||e.options.onColumnFiltersChange(r)},setGlobalFilter:t=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(t)},resetGlobalFilter:t=>{e.setGlobalFilter(t?void 0:e.initialState.globalFilter)},resetColumnFilters:t=>{var n,r;e.setColumnFilters(t?[]:(n=(r=e.initialState)==null?void 0:r.columnFilters)!=null?n:[])},getPreFilteredRowModel:()=>e.getCoreRowModel(),getFilteredRowModel:()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel?e.getPreFilteredRowModel():e._getFilteredRowModel()),_getGlobalFacetedRowModel:e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,"__global__"),getGlobalFacetedRowModel:()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),_getGlobalFacetedUniqueValues:e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,"__global__"),getGlobalFacetedUniqueValues:()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,_getGlobalFacetedMinMaxValues:e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,"__global__"),getGlobalFacetedMinMaxValues:()=>{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}})};function Rl(e,t,n){return(e&&e.autoRemove?e.autoRemove(t,n):!1)||typeof t>"u"||typeof t=="string"&&!t}const Gh=(e,t,n)=>n.reduce((r,i)=>{const o=i.getValue(e);return r+(typeof o=="number"?o:0)},0),jh=(e,t,n)=>{let r;return n.forEach(i=>{const o=i.getValue(e);o!=null&&(r>o||r===void 0&&o>=o)&&(r=o)}),r},Bh=(e,t,n)=>{let r;return n.forEach(i=>{const o=i.getValue(e);o!=null&&(r=o)&&(r=o)}),r},Uh=(e,t,n)=>{let r,i;return n.forEach(o=>{const l=o.getValue(e);l!=null&&(r===void 0?l>=l&&(r=i=l):(r>l&&(r=l),i{let n=0,r=0;if(t.forEach(i=>{let o=i.getValue(e);o!=null&&(o=+o)>=o&&(++n,r+=o)}),n)return r/n},Xh=(e,t)=>{if(!t.length)return;const n=t.map(o=>o.getValue(e));if(!xh(n))return;if(n.length===1)return n[0];const r=Math.floor(n.length/2),i=n.sort((o,l)=>o-l);return n.length%2!==0?i[r]:(i[r-1]+i[r])/2},Yh=(e,t)=>Array.from(new Set(t.map(n=>n.getValue(e))).values()),Qh=(e,t)=>new Set(t.map(n=>n.getValue(e))).size,Kh=(e,t)=>t.length,Hr={sum:Gh,min:jh,max:Bh,extent:Uh,mean:Wh,median:Xh,unique:Yh,uniqueCount:Qh,count:Kh},Jh={getDefaultColumnDef:()=>({aggregatedCell:e=>{var t,n;return(t=(n=e.getValue())==null||n.toString==null?void 0:n.toString())!=null?t:null},aggregationFn:"auto"}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:je("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,t)=>({toggleGrouping:()=>{t.setGrouping(n=>n!=null&&n.includes(e.id)?n.filter(r=>r!==e.id):[...n??[],e.id])},getCanGroup:()=>{var n,r,i,o;return(n=(r=(i=(o=e.columnDef.enableGrouping)!=null?o:!0)!=null?i:t.options.enableGrouping)!=null?r:!0)!=null?n:!!e.accessorFn},getIsGrouped:()=>{var n;return(n=t.getState().grouping)==null?void 0:n.includes(e.id)},getGroupedIndex:()=>{var n;return(n=t.getState().grouping)==null?void 0:n.indexOf(e.id)},getToggleGroupingHandler:()=>{const n=e.getCanGroup();return()=>{n&&e.toggleGrouping()}},getAutoAggregationFn:()=>{const n=t.getCoreRowModel().flatRows[0],r=n==null?void 0:n.getValue(e.id);if(typeof r=="number")return Hr.sum;if(Object.prototype.toString.call(r)==="[object Date]")return Hr.extent},getAggregationFn:()=>{var n,r;if(!e)throw new Error;return fr(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:e.columnDef.aggregationFn==="auto"?e.getAutoAggregationFn():(n=(r=t.options.aggregationFns)==null?void 0:r[e.columnDef.aggregationFn])!=null?n:Hr[e.columnDef.aggregationFn]}}),createTable:e=>({setGrouping:t=>e.options.onGroupingChange==null?void 0:e.options.onGroupingChange(t),resetGrouping:t=>{var n,r;e.setGrouping(t?[]:(n=(r=e.initialState)==null?void 0:r.grouping)!=null?n:[])},getPreGroupedRowModel:()=>e.getFilteredRowModel(),getGroupedRowModel:()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel?e.getPreGroupedRowModel():e._getGroupedRowModel())}),createRow:(e,t)=>({getIsGrouped:()=>!!e.groupingColumnId,getGroupingValue:n=>{if(e._groupingValuesCache.hasOwnProperty(n))return e._groupingValuesCache[n];const r=t.getColumn(n);return r!=null&&r.columnDef.getGroupingValue?(e._groupingValuesCache[n]=r.columnDef.getGroupingValue(e.original),e._groupingValuesCache[n]):e.getValue(n)},_groupingValuesCache:{}}),createCell:(e,t,n,r)=>({getIsGrouped:()=>t.getIsGrouped()&&t.id===n.groupingColumnId,getIsPlaceholder:()=>!e.getIsGrouped()&&t.getIsGrouped(),getIsAggregated:()=>{var i;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!((i=n.subRows)!=null&&i.length)}})};function Zh(e,t,n){if(!(t!=null&&t.length)||!n)return e;const r=e.filter(o=>!t.includes(o.id));return n==="remove"?r:[...t.map(o=>e.find(l=>l.id===o)).filter(Boolean),...r]}const ep={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:je("columnOrder",e)}),createTable:e=>({setColumnOrder:t=>e.options.onColumnOrderChange==null?void 0:e.options.onColumnOrderChange(t),resetColumnOrder:t=>{var n;e.setColumnOrder(t?[]:(n=e.initialState.columnOrder)!=null?n:[])},_getOrderColumnsFn:G(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(t,n,r)=>i=>{let o=[];if(!(t!=null&&t.length))o=i;else{const l=[...t],a=[...i];for(;a.length&&l.length;){const s=l.shift(),u=a.findIndex(c=>c.id===s);u>-1&&o.push(a.splice(u,1)[0])}o=[...o,...a]}return Zh(o,n,r)},{key:!1})})},ui=0,ci=10,Lr=()=>({pageIndex:ui,pageSize:ci}),tp={getInitialState:e=>({...e,pagination:{...Lr(),...e==null?void 0:e.pagination}}),getDefaultOptions:e=>({onPaginationChange:je("pagination",e)}),createTable:e=>{let t=!1,n=!1;return{_autoResetPageIndex:()=>{var r,i;if(!t){e._queue(()=>{t=!0});return}if((r=(i=e.options.autoResetAll)!=null?i:e.options.autoResetPageIndex)!=null?r:!e.options.manualPagination){if(n)return;n=!0,e._queue(()=>{e.resetPageIndex(),n=!1})}},setPagination:r=>{const i=o=>pt(r,o);return e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(i)},resetPagination:r=>{var i;e.setPagination(r?Lr():(i=e.initialState.pagination)!=null?i:Lr())},setPageIndex:r=>{e.setPagination(i=>{let o=pt(r,i.pageIndex);const l=typeof e.options.pageCount>"u"||e.options.pageCount===-1?Number.MAX_SAFE_INTEGER:e.options.pageCount-1;return o=Math.max(0,Math.min(o,l)),{...i,pageIndex:o}})},resetPageIndex:r=>{var i,o,l;e.setPageIndex(r?ui:(i=(o=e.initialState)==null||(l=o.pagination)==null?void 0:l.pageIndex)!=null?i:ui)},resetPageSize:r=>{var i,o,l;e.setPageSize(r?ci:(i=(o=e.initialState)==null||(l=o.pagination)==null?void 0:l.pageSize)!=null?i:ci)},setPageSize:r=>{e.setPagination(i=>{const o=Math.max(1,pt(r,i.pageSize)),l=i.pageSize*i.pageIndex,a=Math.floor(l/o);return{...i,pageIndex:a,pageSize:o}})},setPageCount:r=>e.setPagination(i=>{var o;let l=pt(r,(o=e.options.pageCount)!=null?o:-1);return typeof l=="number"&&(l=Math.max(-1,l)),{...i,pageCount:l}}),getPageOptions:G(()=>[e.getPageCount()],r=>{let i=[];return r&&r>0&&(i=[...new Array(r)].fill(null).map((o,l)=>l)),i},{key:!1,debug:()=>{var r;return(r=e.options.debugAll)!=null?r:e.options.debugTable}}),getCanPreviousPage:()=>e.getState().pagination.pageIndex>0,getCanNextPage:()=>{const{pageIndex:r}=e.getState().pagination,i=e.getPageCount();return i===-1?!0:i===0?!1:re.setPageIndex(r=>r-1),nextPage:()=>e.setPageIndex(r=>r+1),getPrePaginationRowModel:()=>e.getExpandedRowModel(),getPaginationRowModel:()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel?e.getPrePaginationRowModel():e._getPaginationRowModel()),getPageCount:()=>{var r;return(r=e.options.pageCount)!=null?r:Math.ceil(e.getPrePaginationRowModel().rows.length/e.getState().pagination.pageSize)}}}},qr=()=>({left:[],right:[]}),np={getInitialState:e=>({columnPinning:qr(),...e}),getDefaultOptions:e=>({onColumnPinningChange:je("columnPinning",e)}),createColumn:(e,t)=>({pin:n=>{const r=e.getLeafColumns().map(i=>i.id).filter(Boolean);t.setColumnPinning(i=>{var o,l;if(n==="right"){var a,s;return{left:((a=i==null?void 0:i.left)!=null?a:[]).filter(f=>!(r!=null&&r.includes(f))),right:[...((s=i==null?void 0:i.right)!=null?s:[]).filter(f=>!(r!=null&&r.includes(f))),...r]}}if(n==="left"){var u,c;return{left:[...((u=i==null?void 0:i.left)!=null?u:[]).filter(f=>!(r!=null&&r.includes(f))),...r],right:((c=i==null?void 0:i.right)!=null?c:[]).filter(f=>!(r!=null&&r.includes(f)))}}return{left:((o=i==null?void 0:i.left)!=null?o:[]).filter(f=>!(r!=null&&r.includes(f))),right:((l=i==null?void 0:i.right)!=null?l:[]).filter(f=>!(r!=null&&r.includes(f)))}})},getCanPin:()=>e.getLeafColumns().some(r=>{var i,o;return((i=r.columnDef.enablePinning)!=null?i:!0)&&((o=t.options.enablePinning)!=null?o:!0)}),getIsPinned:()=>{const n=e.getLeafColumns().map(a=>a.id),{left:r,right:i}=t.getState().columnPinning,o=n.some(a=>r==null?void 0:r.includes(a)),l=n.some(a=>i==null?void 0:i.includes(a));return o?"left":l?"right":!1},getPinnedIndex:()=>{var n,r,i;const o=e.getIsPinned();return o?(n=(r=t.getState().columnPinning)==null||(i=r[o])==null?void 0:i.indexOf(e.id))!=null?n:-1:0}}),createRow:(e,t)=>({getCenterVisibleCells:G(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left,t.getState().columnPinning.right],(n,r,i)=>{const o=[...r??[],...i??[]];return n.filter(l=>!o.includes(l.column.id))},{key:"row.getCenterVisibleCells",debug:()=>{var n;return(n=t.options.debugAll)!=null?n:t.options.debugRows}}),getLeftVisibleCells:G(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left,,],(n,r)=>(r??[]).map(o=>n.find(l=>l.column.id===o)).filter(Boolean).map(o=>({...o,position:"left"})),{key:"row.getLeftVisibleCells",debug:()=>{var n;return(n=t.options.debugAll)!=null?n:t.options.debugRows}}),getRightVisibleCells:G(()=>[e._getAllVisibleCells(),t.getState().columnPinning.right],(n,r)=>(r??[]).map(o=>n.find(l=>l.column.id===o)).filter(Boolean).map(o=>({...o,position:"right"})),{key:"row.getRightVisibleCells",debug:()=>{var n;return(n=t.options.debugAll)!=null?n:t.options.debugRows}})}),createTable:e=>({setColumnPinning:t=>e.options.onColumnPinningChange==null?void 0:e.options.onColumnPinningChange(t),resetColumnPinning:t=>{var n,r;return e.setColumnPinning(t?qr():(n=(r=e.initialState)==null?void 0:r.columnPinning)!=null?n:qr())},getIsSomeColumnsPinned:t=>{var n;const r=e.getState().columnPinning;if(!t){var i,o;return!!((i=r.left)!=null&&i.length||(o=r.right)!=null&&o.length)}return!!((n=r[t])!=null&&n.length)},getLeftLeafColumns:G(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(t,n)=>(n??[]).map(r=>t.find(i=>i.id===r)).filter(Boolean),{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugColumns}}),getRightLeafColumns:G(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(t,n)=>(n??[]).map(r=>t.find(i=>i.id===r)).filter(Boolean),{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugColumns}}),getCenterLeafColumns:G(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r)=>{const i=[...n??[],...r??[]];return t.filter(o=>!i.includes(o.id))},{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugColumns}})})},rp={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:je("rowSelection",e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>({setRowSelection:t=>e.options.onRowSelectionChange==null?void 0:e.options.onRowSelectionChange(t),resetRowSelection:t=>{var n;return e.setRowSelection(t?{}:(n=e.initialState.rowSelection)!=null?n:{})},toggleAllRowsSelected:t=>{e.setRowSelection(n=>{t=typeof t<"u"?t:!e.getIsAllRowsSelected();const r={...n},i=e.getPreGroupedRowModel().flatRows;return t?i.forEach(o=>{o.getCanSelect()&&(r[o.id]=!0)}):i.forEach(o=>{delete r[o.id]}),r})},toggleAllPageRowsSelected:t=>e.setRowSelection(n=>{const r=typeof t<"u"?t:!e.getIsAllPageRowsSelected(),i={...n};return e.getRowModel().rows.forEach(o=>{fi(i,o.id,r,e)}),i}),getPreSelectedRowModel:()=>e.getCoreRowModel(),getSelectedRowModel:G(()=>[e.getState().rowSelection,e.getCoreRowModel()],(t,n)=>Object.keys(t).length?Gr(e,n):{rows:[],flatRows:[],rowsById:{}},{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugTable}}),getFilteredSelectedRowModel:G(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(t,n)=>Object.keys(t).length?Gr(e,n):{rows:[],flatRows:[],rowsById:{}},{key:"getFilteredSelectedRowModel",debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugTable}}),getGroupedSelectedRowModel:G(()=>[e.getState().rowSelection,e.getSortedRowModel()],(t,n)=>Object.keys(t).length?Gr(e,n):{rows:[],flatRows:[],rowsById:{}},{key:"getGroupedSelectedRowModel",debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugTable}}),getIsAllRowsSelected:()=>{const t=e.getFilteredRowModel().flatRows,{rowSelection:n}=e.getState();let r=!!(t.length&&Object.keys(n).length);return r&&t.some(i=>i.getCanSelect()&&!n[i.id])&&(r=!1),r},getIsAllPageRowsSelected:()=>{const t=e.getPaginationRowModel().flatRows.filter(i=>i.getCanSelect()),{rowSelection:n}=e.getState();let r=!!t.length;return r&&t.some(i=>!n[i.id])&&(r=!1),r},getIsSomeRowsSelected:()=>{var t;const n=Object.keys((t=e.getState().rowSelection)!=null?t:{}).length;return n>0&&n{const t=e.getPaginationRowModel().flatRows;return e.getIsAllPageRowsSelected()?!1:t.filter(n=>n.getCanSelect()).some(n=>n.getIsSelected()||n.getIsSomeSelected())},getToggleAllRowsSelectedHandler:()=>t=>{e.toggleAllRowsSelected(t.target.checked)},getToggleAllPageRowsSelectedHandler:()=>t=>{e.toggleAllPageRowsSelected(t.target.checked)}}),createRow:(e,t)=>({toggleSelected:n=>{const r=e.getIsSelected();t.setRowSelection(i=>{if(n=typeof n<"u"?n:!r,r===n)return i;const o={...i};return fi(o,e.id,n,t),o})},getIsSelected:()=>{const{rowSelection:n}=t.getState();return Mi(e,n)},getIsSomeSelected:()=>{const{rowSelection:n}=t.getState();return Al(e,n)==="some"},getIsAllSubRowsSelected:()=>{const{rowSelection:n}=t.getState();return Al(e,n)==="all"},getCanSelect:()=>{var n;return typeof t.options.enableRowSelection=="function"?t.options.enableRowSelection(e):(n=t.options.enableRowSelection)!=null?n:!0},getCanSelectSubRows:()=>{var n;return typeof t.options.enableSubRowSelection=="function"?t.options.enableSubRowSelection(e):(n=t.options.enableSubRowSelection)!=null?n:!0},getCanMultiSelect:()=>{var n;return typeof t.options.enableMultiRowSelection=="function"?t.options.enableMultiRowSelection(e):(n=t.options.enableMultiRowSelection)!=null?n:!0},getToggleSelectedHandler:()=>{const n=e.getCanSelect();return r=>{var i;n&&e.toggleSelected((i=r.target)==null?void 0:i.checked)}}})},fi=(e,t,n,r)=>{var i;const o=r.getRow(t);n?(o.getCanMultiSelect()||Object.keys(e).forEach(l=>delete e[l]),o.getCanSelect()&&(e[t]=!0)):delete e[t],(i=o.subRows)!=null&&i.length&&o.getCanSelectSubRows()&&o.subRows.forEach(l=>fi(e,l.id,n,r))};function Gr(e,t){const n=e.getState().rowSelection,r=[],i={},o=function(l,a){return l.map(s=>{var u;const c=Mi(s,n);if(c&&(r.push(s),i[s.id]=s),(u=s.subRows)!=null&&u.length&&(s={...s,subRows:o(s.subRows)}),c)return s}).filter(Boolean)};return{rows:o(t.rows),flatRows:r,rowsById:i}}function Mi(e,t){var n;return(n=t[e.id])!=null?n:!1}function Al(e,t,n){if(e.subRows&&e.subRows.length){let r=!0,i=!1;return e.subRows.forEach(o=>{i&&!r||(Mi(o,t)?i=!0:r=!1)}),r?"all":i?"some":!1}return!1}const di=/([0-9]+)/gm,ip=(e,t,n)=>ya(_t(e.getValue(n)).toLowerCase(),_t(t.getValue(n)).toLowerCase()),op=(e,t,n)=>ya(_t(e.getValue(n)),_t(t.getValue(n))),lp=(e,t,n)=>Fi(_t(e.getValue(n)).toLowerCase(),_t(t.getValue(n)).toLowerCase()),sp=(e,t,n)=>Fi(_t(e.getValue(n)),_t(t.getValue(n))),ap=(e,t,n)=>{const r=e.getValue(n),i=t.getValue(n);return r>i?1:rFi(e.getValue(n),t.getValue(n));function Fi(e,t){return e===t?0:e>t?1:-1}function _t(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}function ya(e,t){const n=e.split(di).filter(Boolean),r=t.split(di).filter(Boolean);for(;n.length&&r.length;){const i=n.shift(),o=r.shift(),l=parseInt(i,10),a=parseInt(o,10),s=[l,a].sort();if(isNaN(s[0])){if(i>o)return 1;if(o>i)return-1;continue}if(isNaN(s[1]))return isNaN(l)?-1:1;if(l>a)return 1;if(a>l)return-1}return n.length-r.length}const Zt={alphanumeric:ip,alphanumericCaseSensitive:op,text:lp,textCaseSensitive:sp,datetime:ap,basic:up},cp={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:je("sorting",e),isMultiSortEvent:t=>t.shiftKey}),createColumn:(e,t)=>({getAutoSortingFn:()=>{const n=t.getFilteredRowModel().flatRows.slice(10);let r=!1;for(const i of n){const o=i==null?void 0:i.getValue(e.id);if(Object.prototype.toString.call(o)==="[object Date]")return Zt.datetime;if(typeof o=="string"&&(r=!0,o.split(di).length>1))return Zt.alphanumeric}return r?Zt.text:Zt.basic},getAutoSortDir:()=>{const n=t.getFilteredRowModel().flatRows[0];return typeof(n==null?void 0:n.getValue(e.id))=="string"?"asc":"desc"},getSortingFn:()=>{var n,r;if(!e)throw new Error;return fr(e.columnDef.sortingFn)?e.columnDef.sortingFn:e.columnDef.sortingFn==="auto"?e.getAutoSortingFn():(n=(r=t.options.sortingFns)==null?void 0:r[e.columnDef.sortingFn])!=null?n:Zt[e.columnDef.sortingFn]},toggleSorting:(n,r)=>{const i=e.getNextSortingOrder(),o=typeof n<"u"&&n!==null;t.setSorting(l=>{const a=l==null?void 0:l.find(g=>g.id===e.id),s=l==null?void 0:l.findIndex(g=>g.id===e.id);let u=[],c,f=o?n:i==="desc";if(l!=null&&l.length&&e.getCanMultiSort()&&r?a?c="toggle":c="add":l!=null&&l.length&&s!==l.length-1?c="replace":a?c="toggle":c="replace",c==="toggle"&&(o||i||(c="remove")),c==="add"){var d;u=[...l,{id:e.id,desc:f}],u.splice(0,u.length-((d=t.options.maxMultiSortColCount)!=null?d:Number.MAX_SAFE_INTEGER))}else c==="toggle"?u=l.map(g=>g.id===e.id?{...g,desc:f}:g):c==="remove"?u=l.filter(g=>g.id!==e.id):u=[{id:e.id,desc:f}];return u})},getFirstSortDir:()=>{var n,r;return((n=(r=e.columnDef.sortDescFirst)!=null?r:t.options.sortDescFirst)!=null?n:e.getAutoSortDir()==="desc")?"desc":"asc"},getNextSortingOrder:n=>{var r,i;const o=e.getFirstSortDir(),l=e.getIsSorted();return l?l!==o&&((r=t.options.enableSortingRemoval)==null||r)&&(!(n&&(i=t.options.enableMultiRemove)!=null)||i)?!1:l==="desc"?"asc":"desc":o},getCanSort:()=>{var n,r;return((n=e.columnDef.enableSorting)!=null?n:!0)&&((r=t.options.enableSorting)!=null?r:!0)&&!!e.accessorFn},getCanMultiSort:()=>{var n,r;return(n=(r=e.columnDef.enableMultiSort)!=null?r:t.options.enableMultiSort)!=null?n:!!e.accessorFn},getIsSorted:()=>{var n;const r=(n=t.getState().sorting)==null?void 0:n.find(i=>i.id===e.id);return r?r.desc?"desc":"asc":!1},getSortIndex:()=>{var n,r;return(n=(r=t.getState().sorting)==null?void 0:r.findIndex(i=>i.id===e.id))!=null?n:-1},clearSorting:()=>{t.setSorting(n=>n!=null&&n.length?n.filter(r=>r.id!==e.id):[])},getToggleSortingHandler:()=>{const n=e.getCanSort();return r=>{n&&(r.persist==null||r.persist(),e.toggleSorting==null||e.toggleSorting(void 0,e.getCanMultiSort()?t.options.isMultiSortEvent==null?void 0:t.options.isMultiSortEvent(r):!1))}}}),createTable:e=>({setSorting:t=>e.options.onSortingChange==null?void 0:e.options.onSortingChange(t),resetSorting:t=>{var n,r;e.setSorting(t?[]:(n=(r=e.initialState)==null?void 0:r.sorting)!=null?n:[])},getPreSortedRowModel:()=>e.getGroupedRowModel(),getSortedRowModel:()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel?e.getPreSortedRowModel():e._getSortedRowModel())})},fp={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:je("columnVisibility",e)}),createColumn:(e,t)=>({toggleVisibility:n=>{e.getCanHide()&&t.setColumnVisibility(r=>({...r,[e.id]:n??!e.getIsVisible()}))},getIsVisible:()=>{var n,r;return(n=(r=t.getState().columnVisibility)==null?void 0:r[e.id])!=null?n:!0},getCanHide:()=>{var n,r;return((n=e.columnDef.enableHiding)!=null?n:!0)&&((r=t.options.enableHiding)!=null?r:!0)},getToggleVisibilityHandler:()=>n=>{e.toggleVisibility==null||e.toggleVisibility(n.target.checked)}}),createRow:(e,t)=>({_getAllVisibleCells:G(()=>[e.getAllCells(),t.getState().columnVisibility],n=>n.filter(r=>r.column.getIsVisible()),{key:"row._getAllVisibleCells",debug:()=>{var n;return(n=t.options.debugAll)!=null?n:t.options.debugRows}}),getVisibleCells:G(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(n,r,i)=>[...n,...r,...i],{key:!1,debug:()=>{var n;return(n=t.options.debugAll)!=null?n:t.options.debugRows}})}),createTable:e=>{const t=(n,r)=>G(()=>[r(),r().filter(i=>i.getIsVisible()).map(i=>i.id).join("_")],i=>i.filter(o=>o.getIsVisible==null?void 0:o.getIsVisible()),{key:n,debug:()=>{var i;return(i=e.options.debugAll)!=null?i:e.options.debugColumns}});return{getVisibleFlatColumns:t("getVisibleFlatColumns",()=>e.getAllFlatColumns()),getVisibleLeafColumns:t("getVisibleLeafColumns",()=>e.getAllLeafColumns()),getLeftVisibleLeafColumns:t("getLeftVisibleLeafColumns",()=>e.getLeftLeafColumns()),getRightVisibleLeafColumns:t("getRightVisibleLeafColumns",()=>e.getRightLeafColumns()),getCenterVisibleLeafColumns:t("getCenterVisibleLeafColumns",()=>e.getCenterLeafColumns()),setColumnVisibility:n=>e.options.onColumnVisibilityChange==null?void 0:e.options.onColumnVisibilityChange(n),resetColumnVisibility:n=>{var r;e.setColumnVisibility(n?{}:(r=e.initialState.columnVisibility)!=null?r:{})},toggleAllColumnsVisible:n=>{var r;n=(r=n)!=null?r:!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((i,o)=>({...i,[o.id]:n||!(o.getCanHide!=null&&o.getCanHide())}),{}))},getIsAllColumnsVisible:()=>!e.getAllLeafColumns().some(n=>!(n.getIsVisible!=null&&n.getIsVisible())),getIsSomeColumnsVisible:()=>e.getAllLeafColumns().some(n=>n.getIsVisible==null?void 0:n.getIsVisible()),getToggleAllColumnsVisibilityHandler:()=>n=>{var r;e.toggleAllColumnsVisible((r=n.target)==null?void 0:r.checked)}}}},El=[Vh,fp,ep,np,qh,cp,Jh,Lh,tp,rp,zh];function dp(e){var t;(e.debugAll||e.debugTable)&&console.info("Creating Table Instance...");let n={_features:El};const r=n._features.reduce((c,f)=>Object.assign(c,f.getDefaultOptions==null?void 0:f.getDefaultOptions(n)),{}),i=c=>n.options.mergeOptions?n.options.mergeOptions(r,c):{...r,...c};let l={...{},...(t=e.initialState)!=null?t:{}};n._features.forEach(c=>{var f;l=(f=c.getInitialState==null?void 0:c.getInitialState(l))!=null?f:l});const a=[];let s=!1;const u={_features:El,options:{...r,...e},initialState:l,_queue:c=>{a.push(c),s||(s=!0,Promise.resolve().then(()=>{for(;a.length;)a.shift()();s=!1}).catch(f=>setTimeout(()=>{throw f})))},reset:()=>{n.setState(n.initialState)},setOptions:c=>{const f=pt(c,n.options);n.options=i(f)},getState:()=>n.options.state,setState:c=>{n.options.onStateChange==null||n.options.onStateChange(c)},_getRowId:(c,f,d)=>{var g;return(g=n.options.getRowId==null?void 0:n.options.getRowId(c,f,d))!=null?g:`${d?[d.id,f].join("."):f}`},getCoreRowModel:()=>(n._getCoreRowModel||(n._getCoreRowModel=n.options.getCoreRowModel(n)),n._getCoreRowModel()),getRowModel:()=>n.getPaginationRowModel(),getRow:c=>{const f=n.getRowModel().rowsById[c];if(!f)throw new Error;return f},_getDefaultColumnDef:G(()=>[n.options.defaultColumn],c=>{var f;return c=(f=c)!=null?f:{},{header:d=>{const g=d.header.column.columnDef;return g.accessorKey?g.accessorKey:g.accessorFn?g.id:null},cell:d=>{var g,p;return(g=(p=d.renderValue())==null||p.toString==null?void 0:p.toString())!=null?g:null},...n._features.reduce((d,g)=>Object.assign(d,g.getDefaultColumnDef==null?void 0:g.getDefaultColumnDef()),{}),...c}},{debug:()=>{var c;return(c=n.options.debugAll)!=null?c:n.options.debugColumns},key:!1}),_getColumnDefs:()=>n.options.columns,getAllColumns:G(()=>[n._getColumnDefs()],c=>{const f=function(d,g,p){return p===void 0&&(p=0),d.map(m=>{const _=Oh(n,m,p,g),b=m;return _.columns=b.columns?f(b.columns,_,p+1):[],_})};return f(c)},{key:!1,debug:()=>{var c;return(c=n.options.debugAll)!=null?c:n.options.debugColumns}}),getAllFlatColumns:G(()=>[n.getAllColumns()],c=>c.flatMap(f=>f.getFlatColumns()),{key:!1,debug:()=>{var c;return(c=n.options.debugAll)!=null?c:n.options.debugColumns}}),_getAllFlatColumnsById:G(()=>[n.getAllFlatColumns()],c=>c.reduce((f,d)=>(f[d.id]=d,f),{}),{key:!1,debug:()=>{var c;return(c=n.options.debugAll)!=null?c:n.options.debugColumns}}),getAllLeafColumns:G(()=>[n.getAllColumns(),n._getOrderColumnsFn()],(c,f)=>{let d=c.flatMap(g=>g.getLeafColumns());return f(d)},{key:!1,debug:()=>{var c;return(c=n.options.debugAll)!=null?c:n.options.debugColumns}}),getColumn:c=>n._getAllFlatColumnsById()[c]};return Object.assign(n,u),n._features.forEach(c=>Object.assign(n,c.createTable==null?void 0:c.createTable(n))),n}function gp(e,t,n,r){const i=()=>{var l;return(l=o.getValue())!=null?l:e.options.renderFallbackValue},o={id:`${t.id}_${n.id}`,row:t,column:n,getValue:()=>t.getValue(r),renderValue:i,getContext:G(()=>[e,n,t,o],(l,a,s,u)=>({table:l,column:a,row:s,cell:u,getValue:u.getValue,renderValue:u.renderValue}),{key:!1,debug:()=>e.options.debugAll})};return e._features.forEach(l=>{Object.assign(o,l.createCell==null?void 0:l.createCell(o,n,t,e))},{}),o}const Di=(e,t,n,r,i,o,l)=>{let a={id:t,index:r,original:n,depth:i,parentId:l,_valuesCache:{},_uniqueValuesCache:{},getValue:s=>{if(a._valuesCache.hasOwnProperty(s))return a._valuesCache[s];const u=e.getColumn(s);if(u!=null&&u.accessorFn)return a._valuesCache[s]=u.accessorFn(a.original,r),a._valuesCache[s]},getUniqueValues:s=>{if(a._uniqueValuesCache.hasOwnProperty(s))return a._uniqueValuesCache[s];const u=e.getColumn(s);if(u!=null&&u.accessorFn)return u.columnDef.getUniqueValues?(a._uniqueValuesCache[s]=u.columnDef.getUniqueValues(a.original,r),a._uniqueValuesCache[s]):(a._uniqueValuesCache[s]=[a.getValue(s)],a._uniqueValuesCache[s])},renderValue:s=>{var u;return(u=a.getValue(s))!=null?u:e.options.renderFallbackValue},subRows:o??[],getLeafRows:()=>Th(a.subRows,s=>s.subRows),getParentRow:()=>a.parentId?e.getRow(a.parentId):void 0,getParentRows:()=>{let s=[],u=a;for(;;){const c=u.getParentRow();if(!c)break;s.push(c),u=c}return s.reverse()},getAllCells:G(()=>[e.getAllLeafColumns()],s=>s.map(u=>gp(e,a,u,u.id)),{key:!1,debug:()=>{var s;return(s=e.options.debugAll)!=null?s:e.options.debugRows}}),_getAllCellsByColumnId:G(()=>[a.getAllCells()],s=>s.reduce((u,c)=>(u[c.column.id]=c,u),{}),{key:"row.getAllCellsByColumnId",debug:()=>{var s;return(s=e.options.debugAll)!=null?s:e.options.debugRows}})};for(let s=0;stypeof e=="function"?{...t,accessorFn:e}:{...t,accessorKey:e},display:e=>e,group:e=>e}}function Ml(){return e=>G(()=>[e.options.data],t=>{const n={rows:[],flatRows:[],rowsById:{}},r=function(i,o,l){o===void 0&&(o=0);const a=[];for(let u=0;u{var t;return(t=e.options.debugAll)!=null?t:e.options.debugTable},onChange:()=>{e._autoResetPageIndex()}})}function Sa(e,t,n){return n.options.filterFromLeafRows?pp(e,t,n):mp(e,t,n)}function pp(e,t,n){var r;const i=[],o={},l=(r=n.options.maxLeafRowFilterDepth)!=null?r:100,a=function(s,u){u===void 0&&(u=0);const c=[];for(let d=0;dG(()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter],(t,n,r)=>{if(!t.rows.length||!(n!=null&&n.length)&&!r){for(let d=0;d{var g;const p=e.getColumn(d.id);if(!p)return;const m=p.getFilterFn();m&&i.push({id:d.id,filterFn:m,resolvedValue:(g=m.resolveFilterValue==null?void 0:m.resolveFilterValue(d.value))!=null?g:d.value})});const l=n.map(d=>d.id),a=e.getGlobalFilterFn(),s=e.getAllLeafColumns().filter(d=>d.getCanGlobalFilter());r&&a&&s.length&&(l.push("__global__"),s.forEach(d=>{var g;o.push({id:d.id,filterFn:a,resolvedValue:(g=a.resolveFilterValue==null?void 0:a.resolveFilterValue(r))!=null?g:r})}));let u,c;for(let d=0;d{g.columnFiltersMeta[m]=_})}if(o.length){for(let p=0;p{g.columnFiltersMeta[m]=_})){g.columnFilters.__global__=!0;break}}g.columnFilters.__global__!==!0&&(g.columnFilters.__global__=!1)}}const f=d=>{for(let g=0;g{var t;return(t=e.options.debugAll)!=null?t:e.options.debugTable},onChange:()=>{e._autoResetPageIndex()}})}function Dl(){return(e,t)=>G(()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter,e.getFilteredRowModel()],(n,r,i)=>{if(!n.rows.length||!(r!=null&&r.length)&&!i)return n;const o=[...r.map(a=>a.id).filter(a=>a!==t),i?"__global__":void 0].filter(Boolean),l=a=>{for(let s=0;s{var n;return(n=e.options.debugAll)!=null?n:e.options.debugTable},onChange:()=>{}})}function Il(){return e=>G(()=>[e.getState().sorting,e.getPreSortedRowModel()],(t,n)=>{if(!n.rows.length||!(t!=null&&t.length))return n;const r=e.getState().sorting,i=[],o=r.filter(s=>{var u;return(u=e.getColumn(s.id))==null?void 0:u.getCanSort()}),l={};o.forEach(s=>{const u=e.getColumn(s.id);u&&(l[s.id]={sortUndefined:u.columnDef.sortUndefined,invertSorting:u.columnDef.invertSorting,sortingFn:u.getSortingFn()})});const a=s=>{const u=[...s];return u.sort((c,f)=>{for(let g=0;g{var f;i.push(c),(f=c.subRows)!=null&&f.length&&(c.subRows=a(c.subRows))}),u};return{rows:a(n.rows),flatRows:i,rowsById:n.rowsById}},{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugTable},onChange:()=>{e._autoResetPageIndex()}})}function _p(e){const t=[],n=r=>{var i;t.push(r),(i=r.subRows)!=null&&i.length&&r.getIsExpanded()&&r.subRows.forEach(n)};return e.rows.forEach(n),{rows:t,flatRows:e.flatRows,rowsById:e.rowsById}}function Nl(e){return t=>G(()=>[t.getState().pagination,t.getPrePaginationRowModel(),t.options.paginateExpandedRows?void 0:t.getState().expanded],(n,r)=>{if(!r.rows.length)return r;const{pageSize:i,pageIndex:o}=n;let{rows:l,flatRows:a,rowsById:s}=r;const u=i*o,c=u+i;l=l.slice(u,c);let f;t.options.paginateExpandedRows?f={rows:l,flatRows:a,rowsById:s}:f=_p({rows:l,flatRows:a,rowsById:s}),f.flatRows=[];const d=g=>{f.flatRows.push(g),g.subRows.length&&g.subRows.forEach(d)};return f.rows.forEach(d),f},{key:!1,debug:()=>{var n;return(n=t.options.debugAll)!=null?n:t.options.debugTable}})}/** + * svelte-table + * + * Copyright (c) TanStack + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */function vp(e){let t;return{c(){t=z(e[0])},l(n){t=za(n,e[0])},m(n,r){xa(n,t,r)},p(n,[r]){r&1&&Q(t,n[0])},i:H,o:H,d(n){n&&x(t)}}}function bp(e,t,n){let{content:r}=t;return e.$$set=i=>{"content"in i&&n(0,r=i.content)},[r]}class wp extends ie{constructor(t){super(),se(this,t,bp,vp,re,{content:0})}}const yp=gs((e,t,n,r)=>`${tu(t.content)}`);var Sp=typeof document>"u"?yp:wp;function Cp(e,t,n){let r,i;return r=new t({props:n,$$inline:!0}),{c(){Z(r.$$.fragment)},l(o){ru(r.$$.fragment,o)},m(o,l){K(r,o,l),i=!0},p:H,i(o){i||(N(r.$$.fragment,o),i=!0)},o(o){V(r.$$.fragment,o),i=!1},d(o){J(r,o)}}}function kp(e,t){return class extends ie{constructor(r){super(),se(this,r,null,i=>Cp(i,e,t),re,{},void 0)}}}function $p(e,t){return gs((r,i,o,l)=>`${nu(e,"TableComponent").$$render(r,t,{},{})}`)}const gi=typeof window>"u"?$p:kp;function Rp(e){return typeof e=="object"&&typeof e.$$render=="function"&&typeof e.render=="function"}function Ap(e){var t,n;let r="__SVELTE_HMR"in window;return e.prototype instanceof ie||r&&((t=e.name)==null?void 0:t.startsWith("Proxy<"))&&((n=e.name)==null?void 0:n.endsWith(">"))}function Pl(e){return typeof document>"u"?Rp(e):Ap(e)}function xl(e){return gi(Sp,{content:e})}function dr(e,t){if(!e)return null;if(Pl(e))return gi(e,t);if(typeof e=="function"){const n=e(t);return n==null?null:Pl(n)?gi(n,t):xl(n)}return xl(e)}function Tl(e){let t;"subscribe"in e?t=e:t=Ur(e);let n={state:{},onStateChange:()=>{},renderFallbackValue:null,...Aa(t)},r=dp(n),i=ke(r.initialState),o=ou([i,t],a=>a);return Ur(r,function(s){const u=o.subscribe(c=>{let[f,d]=c;r.setOptions(g=>({...g,...d,state:{...f,...d.state},onStateChange:p=>{p instanceof Function?i.update(p):i.set(p),n.onStateChange==null||n.onStateChange(p)}})),s(r)});return function(){u()}})}/** + * match-sorter-utils + * + * Copyright (c) TanStack + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */const Ca={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",áē¤:"A",áēŽ:"A",áē˛:"A",áē´:"A",áēļ:"A",Æ:"AE",áēĻ:"A",áē°:"A",Ȃ:"A",Ç:"C",Ḉ:"C",È:"E",É:"E",Ê:"E",Ë:"E",áēž:"E",Ḗ:"E",áģ€:"E",Ḕ:"E",Ḝ:"E",Ȇ:"E",Ì:"I",Í:"I",Î:"I",Ï:"I",Ḏ:"I",Ȋ:"I",Ð:"D",Ñ:"N",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",áģ:"O",Ṍ:"O",Ṓ:"O",Ȏ:"O",Ù:"U",Ú:"U",Û:"U",Ü:"U",Ý:"Y",à:"a",ÃĄ:"a",Ãĸ:"a",ÃŖ:"a",ä:"a",ÃĨ:"a",áēĨ:"a",áē¯:"a",áēŗ:"a",áēĩ:"a",áēˇ:"a",ÃĻ:"ae",áē§:"a",áēą:"a",ȃ:"a",ç:"c",ḉ:"c",è:"e",Ê:"e",ÃĒ:"e",ÃĢ:"e",áēŋ:"e",ḗ:"e",áģ:"e",ḕ:"e",ḝ:"e",ȇ:"e",ÃŦ:"i",í:"i",ÃŽ:"i",ï:"i",ḯ:"i",ȋ:"i",ð:"d",Ãą:"n",Ã˛:"o",Ãŗ:"o",ô:"o",Ãĩ:"o",Ãļ:"o",ø:"o",áģ‘:"o",ᚍ:"o",ṓ:"o",ȏ:"o",Ú:"u",Ãē:"u",Ãģ:"u",Ãŧ:"u",ÃŊ:"y",Ãŋ:"y",Ā:"A",ā:"a",Ă:"A",ă:"a",Ą:"A",ą:"a",Ć:"C",ć:"c",Ĉ:"C",ĉ:"c",Ċ:"C",ċ:"c",Č:"C",č:"c",CĖ†:"C",cĖ†:"c",Ď:"D",ď:"d",Đ:"D",đ:"d",Ē:"E",ē:"e",Ĕ:"E",ĕ:"e",Ė:"E",ė:"e",Ę:"E",ę:"e",Ě:"E",ě:"e",Ĝ:"G",Į´:"G",ĝ:"g",Įĩ:"g",Ğ:"G",ğ:"g",Ä :"G",ÄĄ:"g",Äĸ:"G",ÄŖ:"g",Ĥ:"H",ÄĨ:"h",ÄĻ:"H",ħ:"h",á¸Ē:"H",á¸Ģ:"h",Ĩ:"I",ÄŠ:"i",ÄĒ:"I",ÄĢ:"i",ÄŦ:"I",Ä­:"i",ÄŽ:"I",į:"i",Ä°:"I",Äą:"i",IJ:"IJ",Äŗ:"ij",Ä´:"J",Äĩ:"j",Äļ:"K",ġ:"k",Ḱ:"K",ḹ:"k",KĖ†:"K",kĖ†:"k",Äš:"L",Äē:"l",Äģ:"L",Äŧ:"l",ÄŊ:"L",Äž:"l",Äŋ:"L",ŀ:"l",Ł:"l",ł:"l",Ḟ:"M",á¸ŋ:"m",MĖ†:"M",mĖ†:"m",Ń:"N",ń:"n",Ņ:"N",ņ:"n",Ň:"N",ň:"n",ʼn:"n",NĖ†:"N",nĖ†:"n",Ō:"O",ō:"o",Ŏ:"O",ŏ:"o",Ő:"O",ő:"o",Œ:"OE",œ:"oe",PĖ†:"P",pĖ†:"p",Ŕ:"R",ŕ:"r",Ŗ:"R",ŗ:"r",Ř:"R",ř:"r",RĖ†:"R",rĖ†:"r",Ȓ:"R",ȓ:"r",Ś:"S",ś:"s",Ŝ:"S",ŝ:"s",Ş:"S",Ș:"S",ș:"s",ş:"s",Å :"S",ÅĄ:"s",Åĸ:"T",ÅŖ:"t",ț:"t",Ț:"T",Ť:"T",ÅĨ:"t",ÅĻ:"T",ŧ:"t",TĖ†:"T",tĖ†:"t",Ũ:"U",ÅŠ:"u",ÅĒ:"U",ÅĢ:"u",ÅŦ:"U",Å­:"u",ÅŽ:"U",ů:"u",Å°:"U",Åą:"u",Å˛:"U",Åŗ:"u",Ȗ:"U",ȗ:"u",VĖ†:"V",vĖ†:"v",Å´:"W",Åĩ:"w",áē‚:"W",áēƒ:"w",XĖ†:"X",xĖ†:"x",Åļ:"Y",Åˇ:"y",Ÿ:"Y",YĖ†:"Y",yĖ†:"y",Åš:"Z",Åē:"z",Åģ:"Z",Åŧ:"z",ÅŊ:"Z",Åž:"z",Åŋ:"s",ƒ:"f",Æ :"O",ÆĄ:"o",Ư:"U",Æ°:"u",Į:"A",ĮŽ:"a",Į:"I",Į:"i",Į‘:"O",Į’:"o",Į“:"U",Į”:"u",Į•:"U",Į–:"u",Į—:"U",Į˜:"u",Į™:"U",Įš:"u",Į›:"U",Įœ:"u",áģ¨:"U",áģŠ:"u",ᚸ:"U",ášš:"u",Įē:"A",Įģ:"a",Įŧ:"AE",ĮŊ:"ae",Įž:"O",Įŋ:"o",Þ:"TH",Þ:"th",Ṕ:"P",ṕ:"p",ᚤ:"S",ášĨ:"s",XĖ:"X",xĖ:"x",Ѓ:"Г",Ņ“:"Đŗ",Ќ:"К",Ņœ:"Đē",AĖ‹:"A",aĖ‹:"a",EĖ‹:"E",eĖ‹:"e",IĖ‹:"I",iĖ‹:"i",Į¸:"N",Įš:"n",áģ’:"O",áģ“:"o",ᚐ:"O",ṑ:"o",áģĒ:"U",áģĢ:"u",áē€:"W",áē:"w",áģ˛:"Y",áģŗ:"y",Ȁ:"A",ȁ:"a",Ȅ:"E",ȅ:"e",Ȉ:"I",ȉ:"i",Ȍ:"O",ȍ:"o",Ȑ:"R",ȑ:"r",Ȕ:"U",ȕ:"u",BĖŒ:"B",bĖŒ:"b",ČĖŖ:"C",čĖŖ:"c",ÊĖŒ:"E",ÃĒĖŒ:"e",FĖŒ:"F",fĖŒ:"f",ĮĻ:"G",Į§:"g",Ȟ:"H",ȟ:"h",JĖŒ:"J",Į°:"j",Į¨:"K",ĮŠ:"k",MĖŒ:"M",mĖŒ:"m",PĖŒ:"P",pĖŒ:"p",QĖŒ:"Q",qĖŒ:"q",ŘĖŠ:"R",řĖŠ:"r",ášĻ:"S",ᚧ:"s",VĖŒ:"V",vĖŒ:"v",WĖŒ:"W",wĖŒ:"w",XĖŒ:"X",xĖŒ:"x",YĖŒ:"Y",yĖŒ:"y",AĖ§:"A",aĖ§:"a",BĖ§:"B",bĖ§:"b",Ḑ:"D",ḑ:"d",Ȩ:"E",ČŠ:"e",ƐĖ§:"E",ɛĖ§:"e",Ḩ:"H",Ḋ:"h",IĖ§:"I",iĖ§:"i",ƗĖ§:"I",ɨĖ§:"i",MĖ§:"M",mĖ§:"m",OĖ§:"O",oĖ§:"o",QĖ§:"Q",qĖ§:"q",UĖ§:"U",uĖ§:"u",XĖ§:"X",xĖ§:"x",ZĖ§:"Z",zĖ§:"z"},Ep=Object.keys(Ca).join("|"),Mp=new RegExp(Ep,"g");function Fp(e){return e.replace(Mp,t=>Ca[t])}/** + * @name match-sorter + * @license MIT license. + * @copyright (c) 2099 Kent C. Dodds + * @author Kent C. Dodds (https://kentcdodds.com) + */const Pe={CASE_SENSITIVE_EQUAL:7,EQUAL:6,STARTS_WITH:5,WORD_STARTS_WITH:4,CONTAINS:3,ACRONYM:2,MATCHES:1,NO_MATCH:0};function Dp(e,t,n){var r;if(n=n||{},n.threshold=(r=n.threshold)!=null?r:Pe.MATCHES,!n.accessors){const l=Ol(e,t,n);return{rankedValue:e,rank:l,accessorIndex:-1,accessorThreshold:n.threshold,passed:l>=n.threshold}}const i=xp(e,n.accessors),o={rankedValue:e,rank:Pe.NO_MATCH,accessorIndex:-1,accessorThreshold:n.threshold,passed:!1};for(let l=0;l=Pe.MATCHES?s=u:s>c&&(s=c),s=Math.min(s,c),s>=f&&s>o.rank&&(o.rank=s,o.passed=!0,o.accessorIndex=l,o.accessorThreshold=f,o.rankedValue=a.itemValue)}return o}function Ol(e,t,n){return e=Vl(e,n),t=Vl(t,n),t.length>e.length?Pe.NO_MATCH:e===t?Pe.CASE_SENSITIVE_EQUAL:(e=e.toLowerCase(),t=t.toLowerCase(),e===t?Pe.EQUAL:e.startsWith(t)?Pe.STARTS_WITH:e.includes(` ${t}`)?Pe.WORD_STARTS_WITH:e.includes(t)?Pe.CONTAINS:t.length===1?Pe.NO_MATCH:Ip(e).includes(t)?Pe.ACRONYM:Np(e,t))}function Ip(e){let t="";return e.split(" ").forEach(r=>{r.split("-").forEach(o=>{t+=o.substr(0,1)})}),t}function Np(e,t){let n=0,r=0;function i(s,u,c){for(let f=c,d=u.length;f-1))return Pe.NO_MATCH}const a=r-l;return o(a)}function Vl(e,t){let{keepDiacritics:n}=t;return e=`${e}`,n||(e=Fp(e)),e}function Pp(e,t){let n=t;typeof t=="object"&&(n=t.accessor);const r=n(e);return r==null?[]:Array.isArray(r)?r:[String(r)]}function xp(e,t){const n=[];for(let r=0,i=t.length;r{J(p,1)}),ce()}c?(n=mt(c,f()),Z(n.$$.fragment),N(n.$$.fragment,1),K(n,t,r)):n=null}},i(d){a||(n&&N(n.$$.fragment,d),a=!0)},o(d){n&&V(n.$$.fragment,d),a=!1},d(d){d&&x(t),n&&J(n),s=!1,u()}}}function jl(e){let t,n,r=!e[26].isPlaceholder&&Op(e);return{c(){t=R("th"),r&&r.c(),h(t,"colspan",e[26].colSpan),h(t,"class","svelte-16fb3tv")},m(i,o){T(i,t,o),r&&r.m(t,null),n=!0},p(i,o){i[26].isPlaceholder||r.p(i,o)},i(i){n||(N(r),n=!0)},o(i){V(r),n=!1},d(i){i&&x(t),r&&r.d()}}}function Bl(e){let t,n,r,i=e[23].headers,o=[];for(let a=0;aV(o[a],1,1,()=>{o[a]=null});return{c(){t=R("tr");for(let a=0;a{J(u,1)}),ce()}o?(r=mt(o,l()),Z(r.$$.fragment),N(r.$$.fragment,1),K(r,n,null)):r=null}},i(a){i||(r&&N(r.$$.fragment,a),i=!0)},o(a){r&&V(r.$$.fragment,a),i=!1},d(a){a&&x(n),r&&J(r)}}}function Wl(e){let t,n=[],r=new Map,i,o,l=e[17].getVisibleCells();const a=s=>s[20].id;for(let s=0;s",Me,ye,ae,ze,kn,vt=e[5],he=[];for(let W=0;WV(he[W],1,1,()=>{he[W]=null});let bt=e[1].getRowModel().rows,pe=[];for(let W=0;WV(pe[W],1,1,()=>{pe[W]=null});return{c(){t=R("div"),n=R("input"),r=D(),i=R("div"),o=R("table"),l=R("thead");for(let W=0;W(o(),o=gr(b,$=>n(1,i=$)),b);ee(e,cr,$=>n(8,r=$)),e.$$.on_destroy.push(()=>o());const a=($,E,S,k)=>{if(console.log("yessir"),Array.isArray(S))return S.length===0?!0:S.includes($.getValue(E));typeof S=="number"&&(S=String(S));const y=Dp($.getValue(E),S);return k({itemRank:y}),y.passed},s=hp(),u=[s.accessor("file",{header:"File",cell:$=>$.getValue(),footer:$=>$.column.id}),s.accessor("size",{header:"Size",cell:$=>Kr($.getValue()),footer:$=>$.column.id}),s.accessor("type",{header:"Type",cell:$=>$.getValue(),footer:$=>$.column.id})];let c="",f=ke({data:r,columns:u,getCoreRowModel:Ml(),getSortedRowModel:Il(),getFilteredRowModel:Fl(),globalFilterFn:a,getFacetedRowModel:Dl(),getPaginationRowModel:Nl(),state:{globalFilter:c,pagination:{pageSize:7,pageIndex:0}},enableGlobalFilter:!0});function d($){n(6,c=$),f.update(E=>({...E,state:{...E.state,globalFilter:$}}))}function g($){f.update(E=>{var S;return{...E,state:{...E.state,pagination:{...(S=E.state)==null?void 0:S.pagination,pageIndex:$}}}})}let p;function m($){clearTimeout(p),p=setTimeout(()=>{const E=$.target;d(E.value)},100)}function _($){const E=$.target;g(parseInt(E.value)-1)}let b=Tl(f);l();let w=i.getHeaderGroups();const C=()=>g(i.getState().pagination.pageIndex-1),A=()=>g(i.getState().pagination.pageIndex+1);return e.$$.update=()=>{e.$$.dirty&448&&(n(7,f={data:r,columns:u,getCoreRowModel:Ml(),getSortedRowModel:Il(),getFilteredRowModel:Fl(),globalFilterFn:a,getFacetedRowModel:Dl(),getPaginationRowModel:Nl(),state:{globalFilter:c,pagination:{pageSize:7,pageIndex:0}},enableGlobalFilter:!0}),l(n(0,b=Tl(ke(f)))))},[b,i,g,m,_,w,c,f,r,C,A]}class Lp extends ie{constructor(t){super(),se(this,t,Hp,Vp,re,{})}}function Xl(e){let t,n;return{c(){t=R("p"),n=z(e[3])},m(r,i){T(r,t,i),v(t,n)},p(r,i){i&8&&Q(n,r[3])},d(r){r&&x(t)}}}function Yl(e){let t;return{c(){t=R("p"),t.textContent="Data Successfully indexed!"},m(n,r){T(n,t,r)},d(n){n&&x(t)}}}function Ql(e){let t,n;return t=new Lp({}),{c(){Z(t.$$.fragment)},m(r,i){K(t,r,i),n=!0},i(r){n||(N(t.$$.fragment,r),n=!0)},o(r){V(t.$$.fragment,r),n=!1},d(r){J(t,r)}}}function qp(e){let t,n,r,i,o,l,a,s,u,c,f,d,g,p,m,_,b,w,C,A,$,E,S,k=e[2]&&!e[1]&&Xl(e),y=e[1]&&Yl();C=new Ph({});let M=e[0]&&Ql();return{c(){t=R("div"),n=R("div"),r=R("div"),i=R("div"),o=R("h4"),o.textContent="Upload Data",l=D(),a=R("br"),s=D(),u=R("form"),c=R("input"),f=D(),k&&k.c(),d=D(),y&&y.c(),g=D(),p=R("p"),p.textContent="These are the files your model will use as context.",m=D(),_=R("p"),_.innerHTML="Currently pdf, txt, and md are supported.",b=D(),w=R("div"),Z(C.$$.fragment),A=D(),M&&M.c(),h(c,"type","file"),c.multiple=!0,h(i,"class","upload-box svelte-1lu6hos"),h(r,"class","upload-container svelte-1lu6hos"),h(n,"class","file-container svelte-1lu6hos"),h(w,"class","charts-container svelte-1lu6hos"),h(t,"class","data-grid svelte-1lu6hos")},m(I,F){T(I,t,F),v(t,n),v(n,r),v(r,i),v(i,o),v(i,l),v(i,a),v(i,s),v(i,u),v(u,c),v(i,f),k&&k.m(i,null),v(i,d),y&&y.m(i,null),v(i,g),v(i,p),v(i,m),v(i,_),v(t,b),v(t,w),K(C,w,null),v(w,A),M&&M.m(w,null),$=!0,E||(S=j(c,"change",e[4]),E=!0)},p(I,[F]){I[2]&&!I[1]?k?k.p(I,F):(k=Xl(I),k.c(),k.m(i,d)):k&&(k.d(1),k=null),I[1]?y||(y=Yl(),y.c(),y.m(i,g)):y&&(y.d(1),y=null),I[0]?M?F&1&&N(M,1):(M=Ql(),M.c(),N(M,1),M.m(w,null)):M&&(ue(),V(M,1,1,()=>{M=null}),ce())},i(I){$||(N(C.$$.fragment,I),N(M),$=!0)},o(I){V(C.$$.fragment,I),V(M),$=!1},d(I){I&&x(t),k&&k.d(),y&&y.d(),J(C),M&&M.d(),E=!1,S()}}}function Gp(e,t,n){let r,i,o;ee(e,Sl,p=>n(6,i=p)),ee(e,cr,p=>n(7,o=p));let l=[],a=!1,s=!1;async function u(p){n(0,l=p.target.files);const m=new FormData;for(let _=0;_({file:b.name,size:b.size,type:b.type}));Oe(cr,o=[..._],o)}async function f(){console.log("index!"),n(2,s=!0),await(await fetch("/retrieval/vector_db/index",{method:"POST"})).json(),n(1,a=!0),n(2,s=!1)}async function d(){console.log("getting embeddings...");const m=await(await fetch("/retrieval/vector_db/get")).json();console.log("embeddingData",m),Oe(Sl,i=m,i)}ut(()=>{c()});let g=0;return setInterval(()=>{n(5,g=(g+1)%4)},200),e.$$.update=()=>{e.$$.dirty&32&&n(3,r="Indexing"+".".repeat(g))},[l,a,s,r,u,g]}class jp extends ie{constructor(t){super(),se(this,t,Gp,qp,re,{})}}function Bp(e){let t,n,r,i,o,l,a,s,u,c,f,d,g,p,m,_,b,w,C,A,$,E,S,k,y,M,I;return o=new js({}),s=new Bs({}),f=new zs({}),p=new Ls({props:{feedback:"Bad"}}),b=new Gs({}),A=new qs({}),M=new Hs({}),{c(){t=R("div"),n=R("div"),r=R("div"),i=R("div"),Z(o.$$.fragment),l=D(),a=R("div"),Z(s.$$.fragment),u=D(),c=R("div"),Z(f.$$.fragment),d=D(),g=R("div"),Z(p.$$.fragment),m=D(),_=R("div"),Z(b.$$.fragment),w=D(),C=R("div"),Z(A.$$.fragment),$=D(),E=R("div"),S=R("div"),S.innerHTML=`
+
`,k=D(),y=R("div"),Z(M.$$.fragment),h(i,"class","card-1 svelte-14znspc"),h(a,"class","card-2"),h(r,"class","left-text svelte-14znspc"),h(c,"class","left-confidence svelte-14znspc"),h(g,"class","left-question svelte-14znspc"),h(_,"class","left-filter svelte-14znspc"),h(C,"class","left-filter2"),h(n,"class","feedback-left svelte-14znspc"),h(S,"class","right-chart svelte-14znspc"),h(y,"class","right-table svelte-14znspc"),h(E,"class","feedback-right svelte-14znspc"),h(t,"class","feedback-container svelte-14znspc")},m(F,P){T(F,t,P),v(t,n),v(n,r),v(r,i),K(o,i,null),v(r,l),v(r,a),K(s,a,null),v(n,u),v(n,c),K(f,c,null),v(n,d),v(n,g),K(p,g,null),v(n,m),v(n,_),K(b,_,null),v(n,w),v(n,C),K(A,C,null),v(t,$),v(t,E),v(E,S),v(E,k),v(E,y),K(M,y,null),I=!0},p:H,i(F){I||(N(o.$$.fragment,F),N(s.$$.fragment,F),N(f.$$.fragment,F),N(p.$$.fragment,F),N(b.$$.fragment,F),N(A.$$.fragment,F),N(M.$$.fragment,F),I=!0)},o(F){V(o.$$.fragment,F),V(s.$$.fragment,F),V(f.$$.fragment,F),V(p.$$.fragment,F),V(b.$$.fragment,F),V(A.$$.fragment,F),V(M.$$.fragment,F),I=!1},d(F){F&&x(t),J(o),J(s),J(f),J(p),J(b),J(A),J(M)}}}function Up(e,t,n){let r;ee(e,pn,o=>n(0,r=o)),ut(()=>{console.log("FEEDBACK on mount"),i()});async function i(){const s=(await(await fetch("/chat/rag_table/retrieve")).json()).rows.map(u=>({id:u[0],question:u[1],answer:u[2],vote_status:u[4]}));Oe(pn,r=[...s],r)}return[]}class Wp extends ie{constructor(t){super(),se(this,t,Up,Bp,re,{})}}function Xp(e){let t,n;return t=new Us({}),{c(){Z(t.$$.fragment)},m(r,i){K(t,r,i),n=!0},i(r){n||(N(t.$$.fragment,r),n=!0)},o(r){V(t.$$.fragment,r),n=!1},d(r){J(t,r)}}}function Yp(e){let t,n;return t=new Wp({}),{c(){Z(t.$$.fragment)},m(r,i){K(t,r,i),n=!0},i(r){n||(N(t.$$.fragment,r),n=!0)},o(r){V(t.$$.fragment,r),n=!1},d(r){J(t,r)}}}function Qp(e){let t,n;return t=new Us({}),{c(){Z(t.$$.fragment)},m(r,i){K(t,r,i),n=!0},i(r){n||(N(t.$$.fragment,r),n=!0)},o(r){V(t.$$.fragment,r),n=!1},d(r){J(t,r)}}}function Kp(e){let t,n,r,i;const o=[Qp,Yp,Xp],l=[];function a(s,u){return s[0]==="vote"?0:s[0]==="rag"?1:2}return t=a(e),n=l[t]=o[t](e),{c(){n.c(),r=Ae()},m(s,u){l[t].m(s,u),T(s,r,u),i=!0},p(s,[u]){let c=t;t=a(s),t!==c&&(ue(),V(l[c],1,1,()=>{l[c]=null}),ce(),n=l[t],n||(n=l[t]=o[t](s),n.c()),N(n,1),n.m(r.parentNode,r))},i(s){i||(N(n),i=!0)},o(s){V(n),i=!1},d(s){l[t].d(s),s&&x(r)}}}function Jp(e,t,n){let{feedback:r}=t;return e.$$set=i=>{"feedback"in i&&n(0,r=i.feedback)},[r]}class Zp extends ie{constructor(t){super(),se(this,t,Jp,Kp,re,{feedback:0})}}function Kl(e,t,n){const r=e.slice();return r[7]=t[n],r}function Jl(e){let t,n=e[0],r=[];for(let i=0;i{J(c,1)}),ce()}o?(t=mt(o,l()),Z(t.$$.fragment),N(t.$$.fragment,1),K(t,n.parentNode,n)):t=null}else o&&t.$set(u)},i(a){r||(t&&N(t.$$.fragment,a),r=!0)},o(a){t&&V(t.$$.fragment,a),r=!1},d(a){a&&x(n),t&&J(t,a)}}}function em(e){let t,n,r,i=e[0].length>1&&Jl(e),o=e[1]&&es(e);return{c(){i&&i.c(),t=D(),o&&o.c(),n=Ae()},m(l,a){i&&i.m(l,a),T(l,t,a),o&&o.m(l,a),T(l,n,a),r=!0},p(l,[a]){l[0].length>1?i?i.p(l,a):(i=Jl(l),i.c(),i.m(t.parentNode,t)):i&&(i.d(1),i=null),l[1]?o?(o.p(l,a),a&2&&N(o,1)):(o=es(l),o.c(),N(o,1),o.m(n.parentNode,n)):o&&(ue(),V(o,1,1,()=>{o=null}),ce())},i(l){r||(N(o),r=!0)},o(l){V(o),r=!1},d(l){i&&i.d(l),l&&x(t),o&&o.d(l),l&&x(n)}}}function tm(e,t,n){let r,i;const o=ke([]);ee(e,o,c=>n(0,r=c));const l=ke(null);ee(e,l,c=>n(1,i=c));const a={Chatbot:Pf,Dropdown:Of,Feedback:Zp,Compare:Kg,RetrievalQA:jp},s=c=>{l.set(c)};return fetch("/components").then(c=>{if(!c.ok)throw new Error(`HTTP error! status: ${c.status}`);return c.json()}).then(c=>{o.set(c),l.set(c[0])}).catch(c=>{console.log("Fetch request failed",c)}),[r,i,o,l,a,s,c=>s(c)]}class nm extends ie{constructor(t){super(),se(this,t,tm,em,re,{})}}new nm({target:document.getElementById("app")}); diff --git a/pykoi/frontend/dist/index.html b/pykoi/frontend/dist/index.html index c71c999..6137fdc 100644 --- a/pykoi/frontend/dist/index.html +++ b/pykoi/frontend/dist/index.html @@ -5,8 +5,8 @@ Vite + Svelte - - + +
diff --git a/pykoi/frontend/src/App.svelte b/pykoi/frontend/src/App.svelte index be194df..bb9f970 100644 --- a/pykoi/frontend/src/App.svelte +++ b/pykoi/frontend/src/App.svelte @@ -8,6 +8,7 @@ import QuestionRating from "./lib/Annotations/QuestionRating.svelte"; import RankedChatbot from "./lib/Chatbots/RankedChatbot.svelte"; import RAG from "./lib/RAG/RAG.svelte"; + import FeedbackWrapper from "./lib/Dashboards/FeedbackWrapper.svelte"; const components = writable([]); const selectedPage = writable(null); @@ -15,7 +16,7 @@ const componentMap = { Chatbot: Chat, Dropdown: Dropdown, - Feedback: Feedback, + Feedback: FeedbackWrapper, Compare: ComparisonChat, RetrievalQA: RAG, }; diff --git a/pykoi/frontend/src/lib/Chatbots/Chat.svelte b/pykoi/frontend/src/lib/Chatbots/Chat.svelte index ca43ddf..dfd3650 100644 --- a/pykoi/frontend/src/lib/Chatbots/Chat.svelte +++ b/pykoi/frontend/src/lib/Chatbots/Chat.svelte @@ -1,7 +1,7 @@ @@ -12,6 +12,9 @@ {#if feedback === "vote"} {/if} +{#if feedback === "rag"} + +{/if} {#if feedback === "rank"} {#if is_retrieval} diff --git a/pykoi/frontend/src/lib/Chatbots/Chatbot.svelte b/pykoi/frontend/src/lib/Chatbots/Chatbot.svelte index e38e2cc..9f30e0b 100644 --- a/pykoi/frontend/src/lib/Chatbots/Chatbot.svelte +++ b/pykoi/frontend/src/lib/Chatbots/Chatbot.svelte @@ -1,13 +1,11 @@
@@ -198,11 +164,6 @@
Question:

{message.question}

-
-

- ℹī¸ Retrieval Sources -

-
@@ -221,26 +182,6 @@
{/if}
-
- -
- (show_content[index] = !show_content[index])} - > -

📖 Source: {message.source}

- {#if show_content[index]} -

- {:else} -

- {/if} -
- {#if show_content[index]} -
-

{message.source_content}

-
- {/if} -
@@ -250,21 +191,17 @@
-
- - -
- - -
-
+
+ + +

Note - may produce inaccurate information.

@@ -466,28 +403,6 @@ border: 1px solid var(--black); } - .message-content .source { - text-align: left; - border: 1px solid var(--grey); - padding: 5px; - background-color: var(--lightGrey); - color: var(--darkGrey); - box-sizing: border-box; - } - - .source_tab { - display: flex; - justify-content: space-between; - align-items: center; - cursor: pointer; - } - - .source_content { - background-color: white; - border: 1pt solid var(--grey); - padding: 5px; - } - .message-content .answers { display: grid; grid-template-columns: 100%; @@ -496,10 +411,6 @@ margin: auto; } - .rag-sources { - display: flex; - } - :global(.tooltip) { white-space: nowrap; position: relative; @@ -511,7 +422,7 @@ position: absolute; bottom: 100%; right: 0.78rem; - transform: translate(calc(100% - 120px), 0); + transform: translate(50%, 0); padding: 0.2rem 0.35rem; background: hsl(0, 0%, 20%); color: hsl(0, 0%, 98%); @@ -525,7 +436,8 @@ content: ""; position: absolute; top: 100%; - left: 10px; + left: 50%; + transform: translateX(-50%); width: 0.6em; height: 0.25em; background: inherit; diff --git a/pykoi/frontend/src/lib/Chatbots/Components/Answer.svelte b/pykoi/frontend/src/lib/Chatbots/Components/Answer.svelte new file mode 100644 index 0000000..c012c9d --- /dev/null +++ b/pykoi/frontend/src/lib/Chatbots/Components/Answer.svelte @@ -0,0 +1,95 @@ + + +
+ {message.answer} +
+{#if feedback} + +{/if} + + diff --git a/pykoi/frontend/src/lib/Chatbots/Components/ModifiedAnswer.svelte b/pykoi/frontend/src/lib/Chatbots/Components/ModifiedAnswer.svelte new file mode 100644 index 0000000..14e3954 --- /dev/null +++ b/pykoi/frontend/src/lib/Chatbots/Components/ModifiedAnswer.svelte @@ -0,0 +1,87 @@ + + +
+